Skip to content

Commit

Permalink
Merge branch 'main' into feature/x-ray-connector
Browse files Browse the repository at this point in the history
  • Loading branch information
bre1470 committed Sep 12, 2024
2 parents 2fd8da6 + fab4ddc commit 9d1dead
Show file tree
Hide file tree
Showing 9 changed files with 2,742 additions and 273 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ The connectors are available as
`@highcharts/connectors-morningstar/connectors-morningstar.js` script to your
web app or web page.

**Note:** The UMD bundle is not available via
`https://code.highcharts.com/connectors/connectors-morningstar.js` yet.
* You can also include the UMD bundle for testing purposes directly in HTML:
``` HTML
<script src="https://code.highcharts.com/connectors/morningstar/connectors-morningstar.js"></script>
```



Expand Down
2 changes: 1 addition & 1 deletion package-build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "0.3.0",
"version": "0.4.0",
"name": "@highcharts/connectors-morningstar",
"license": "UNLICENSED",
"description": "Highcharts connectors for Morningstar Direct Web Services",
Expand Down
2,296 changes: 2,055 additions & 241 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"main": "code/es-modules/index.js",
"types": "code/es-modules/index.d.ts",
"devDependencies": {
"@aws-sdk/client-s3": "^3.592.0",
"@aws-sdk/credential-providers": "^3.592.0",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.0.0",
Expand All @@ -22,8 +24,8 @@
"jsdom": "^24.1.1",
"lint-staged": "^15.2.7",
"ts-node": "^10.9.2",
"typescript": "^5.5.4",
"webpack": "^5.93.0",
"typescript": "~5.5.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
"lint-staged": {
Expand All @@ -35,7 +37,7 @@
]
},
"peerDependencies": {
"@highcharts/dashboards": ">=2.2.0",
"@highcharts/dashboards": ">=2.3.0",
"highcharts": ">=11.4.0"
},
"scripts": {
Expand All @@ -46,6 +48,7 @@
"build:prepare": "rm -rf build/ ; mkdir -p build/package/",
"demos": "npm run webpack && npm run demos:server",
"demos:server": "(sleep 1 ; open http://localhost:8080) & node bin/connectors-morningstar demos",
"dryrun": "ts-node tools/dist --dryrun",
"husky:pre-commit": "npx lint-staged && npm run webpack",
"prepare": "rm -rf '.husky/_' ; husky",
"scripts": "npm run scripts:bin && npm run scripts:code",
Expand Down
41 changes: 29 additions & 12 deletions src/Shared/External.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
* */


import type * as _Dashboards from '@highcharts/dashboards';
import type * as _DataGrid from '@highcharts/dashboards/datagrid';


import _DataConnector from '@highcharts/dashboards/es-modules/Data/Connectors/DataConnector';
import _DataConverter from '@highcharts/dashboards/es-modules/Data/Converters/DataConverter';
import * as _Dashboards from '@highcharts/dashboards';
import _DataTable from '@highcharts/dashboards/es-modules/Data/DataTable';


/* *
Expand All @@ -33,19 +38,13 @@ import * as _Dashboards from '@highcharts/dashboards';
* */


export type DataConnector = _Dashboards.DataConnector;


export type DataConnectorOptions = Partial<_Dashboards.DataConnector.UserOptions>;


export type DataConveter = _DataConverter;
export type DataConnectorOptions = Partial<_DataConnector.UserOptions>;


export type DataConverterOptions = Partial<_DataConverter.Options>;


export type DataTable = _Dashboards.DataTable;
export type DataTable = _DataTable;


/* *
Expand All @@ -55,13 +54,31 @@ export type DataTable = _Dashboards.DataTable;
* */


export const DataConnector = _Dashboards.DataConnector;
const Dashboards: typeof _Dashboards = globalThis.Dashboards;


const DataGrid: typeof _DataGrid = globalThis.DataGrid;


export const DataConnector = (
Dashboards?.DataConnector ||
DataGrid?.DataConnector ||
_DataConnector
);


export const DataConverter = _DataConverter;
export const DataConverter = (
Dashboards?.DataConverter ||
DataGrid?.DataConverter ||
_DataConverter
);


export const DataTable = _Dashboards.DataTable;
export const DataTable = (
Dashboards?.DataTable ||
DataGrid?.DataTable ||
_DataTable
);


/* *
Expand Down
100 changes: 100 additions & 0 deletions src/Shared/MorningstarOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,51 @@ export interface MorningstarConverterOptions extends External.DataConverterOptio
}


export interface MorningstarHoldingAmountOptions extends MorningstarSecurityOptions {

/**
* Holding amount.
*/
amount: number;

/**
* Name of holding.
*/
name?: string;

}


export interface MorningstarHoldingWeightOptions extends MorningstarSecurityOptions {

/**
* Name of holding.
*/
name?: string;

/**
* Holding weight.
*/
weight: (number|string);

}


export interface MorningstarHoldingValueOptions extends MorningstarSecurityOptions {

/**
* Name of holding.
*/
name?: string;

/**
* Holding value.
*/
value: number;

}


export interface MorningstarOptions extends External.DataConnectorOptions {

/**
Expand Down Expand Up @@ -186,6 +231,61 @@ export enum MorningstarSecurityType {
}


/* *
*
* Functions
*
* */


export function isMorningstarHoldingAmountOptions (
options?: unknown
): options is MorningstarHoldingAmountOptions {
return (
!!options &&
typeof options === 'object' &&
(
typeof (options as MorningstarHoldingAmountOptions).amount === 'number' ||
typeof (options as MorningstarHoldingAmountOptions).amount === 'string'
) &&
typeof (options as MorningstarHoldingValueOptions).value === 'undefined' &&
typeof (options as MorningstarHoldingWeightOptions).weight === 'undefined'
);
}


export function isMorningstarHoldingValueOptions (
options?: unknown
): options is MorningstarHoldingValueOptions {
return (
!!options &&
typeof options === 'object' &&
typeof (options as MorningstarHoldingAmountOptions).amount === 'undefined' &&
(
typeof (options as MorningstarHoldingValueOptions).value === 'number' ||
typeof (options as MorningstarHoldingValueOptions).value === 'string'
) &&
typeof (options as MorningstarHoldingWeightOptions).weight === 'undefined'
);
}


export function isMorningstarHoldingWeightOptions (
options?: unknown
): options is MorningstarHoldingWeightOptions {
return (
!!options &&
typeof options === 'object' &&
typeof (options as MorningstarHoldingAmountOptions).amount === 'undefined' &&
typeof (options as MorningstarHoldingValueOptions).value === 'undefined' &&
(
typeof (options as MorningstarHoldingWeightOptions).weight === 'number' ||
typeof (options as MorningstarHoldingWeightOptions).weight === 'string'
)
);
}


/* *
*
* Default Export
Expand Down
22 changes: 22 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Highcharts Morningstar Connectors Tools
=======================================

These scripts are used to prepare distribution of new releases.



Dry-run
-------

1. Run `npm test` and make sure everything works as expected.

2. Run `npx ts-node tools/dist --bucket [...] --region [...] --release [x.x.x] --dryrun`.



Release
-------

1. Run `npm test` and make sure everything works as expected.

2. Run `npx ts-node tools/dist --bucket [...] --region [...] --release [x.x.x]`.
Loading

0 comments on commit 9d1dead

Please sign in to comment.