@3e/sqa-common 6.0.7-test → 6.0.8-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +115 -41
  2. package/package.json +1 -1
  3. package/sqa_common.js +958 -942
package/index.d.ts CHANGED
@@ -783,6 +783,14 @@ declare module '@3e/sqa-common' {
783
783
  | 'sensor'
784
784
  | 'strings'
785
785
  | 'tracker'
786
+ | 'turbine'
787
+
788
+ export type DashboardLevel =
789
+ | 'site-group'
790
+ | 'site'
791
+ | 'ac-node'
792
+ | 'inverter'
793
+ | 'turbine'
786
794
 
787
795
  export type RepresentationValue =
788
796
  | 'line'
@@ -871,6 +879,83 @@ declare module '@3e/sqa-common' {
871
879
  stops?: [number, string][]
872
880
  }
873
881
 
882
+ export type MeasurementsRowExtraInfo = {
883
+ indicator?: {
884
+ label: string
885
+ indicator_label: string
886
+ reference_label: string
887
+ unit: string
888
+ unit_key: string
889
+ description: string
890
+ key: string
891
+ default_graphical_representation: string
892
+ level: LevelValue
893
+ }
894
+ object?: {
895
+ name: string
896
+ level: LevelValue
897
+ ref: string
898
+ }
899
+ }
900
+
901
+ export type MeasurementsWidgetResult = {
902
+ meta: {
903
+ rows: MeasurementsRowExtraInfo[]
904
+ }
905
+ header: string[]
906
+ rows: (string | number | null)[][]
907
+ }
908
+
909
+
910
+ export type HighChartsSpec = {
911
+ series: []
912
+ time: {timezone: string}
913
+ legend: {enabled: boolean}
914
+ title: boolean
915
+ chart: {_SQ_: {type: ViewType}; zoomType: string; animation: boolean}
916
+ yAxis: []
917
+ credits: {enabled: boolean}
918
+ display: 'highcharts'
919
+ $schema: 'https://highcharts/7.2'
920
+ xAxis: {
921
+ type: string
922
+ min: number
923
+ max: number
924
+ tickInterval: null //TODO: better types
925
+ }
926
+ tooltip: {
927
+ borderRadius: number
928
+ borderColor: string
929
+ formatter: () => string
930
+ borderWidth: number
931
+ valueDecimals: number
932
+ style: {
933
+ fontFamily: string
934
+ fontSize: string
935
+ lineHeight: string
936
+ }
937
+ useHTML: boolean
938
+ split: boolean
939
+ shared: boolean
940
+ shadow: {color: string; offsetY: number; opacity: number; width: number}
941
+ backgroundColor: string
942
+ enabled: boolean
943
+ }
944
+ }
945
+
946
+ export type TableSpec = {
947
+ display: 'table'
948
+ header: string[]
949
+ rows: (number | string)[][]
950
+ }
951
+
952
+ export type MessageSpec = {
953
+ display: 'message'
954
+ label: string
955
+ }
956
+
957
+ export type VisualizationSpec = TableSpec | MessageSpec | HighChartsSpec
958
+
874
959
  export interface Visualization {
875
960
  data: {
876
961
  datasets: []
@@ -884,41 +969,7 @@ declare module '@3e/sqa-common' {
884
969
  info: {title: string; type: ViewType; color_scheme: ColorSchemeValue}
885
970
  values: {}
886
971
  disableIncrementalUpdates: boolean
887
- spec: {
888
- series: []
889
- time: {timezone: string}
890
- legend: {enabled: boolean}
891
- title: boolean
892
- chart: {_SQ_: {type: ViewType}; zoomType: string; animation: boolean}
893
- yAxis: []
894
- credits: {enabled: boolean}
895
- display: 'highcharts'
896
- $schema: 'https://highcharts/7.2'
897
- xAxis: {
898
- type: string
899
- min: number
900
- max: number
901
- tickInterval: null //TODO: better types
902
- }
903
- tooltip: {
904
- borderRadius: number
905
- borderColor: string
906
- formatter: () => string
907
- borderWidth: number
908
- valueDecimals: number
909
- style: {
910
- fontFamily: string
911
- fontSize: string
912
- lineHeight: string
913
- }
914
- useHTML: boolean
915
- split: boolean
916
- shared: boolean
917
- shadow: {color: string; offsetY: number; opacity: number; width: number}
918
- backgroundColor: string
919
- enabled: boolean
920
- }
921
- }
972
+ spec: VisualizationSpec
922
973
  }
923
974
 
924
975
  export interface LdType {
@@ -1042,7 +1093,7 @@ declare module '@3e/sqa-common' {
1042
1093
  }
1043
1094
  | {status: 'running'}
1044
1095
 
1045
- type SaveDataJobResponse = SaveDataJobStatus & {
1096
+ export type SaveDataJobResponse = SaveDataJobStatus & {
1046
1097
  actorSqid: string
1047
1098
  numRetries: number
1048
1099
  sqid: string
@@ -1170,23 +1221,46 @@ declare module '@3e/sqa-common' {
1170
1221
 
1171
1222
  /**
1172
1223
  * Populates a visualization with data, using the default `append-data` to append each page.
1173
- * @param visualisation - the visualization to be populated
1224
+ * @param visualization - the visualization to be populated
1174
1225
  * @param callback - Callback function called with the populated viz when the operation is done
1175
1226
  *
1176
1227
  * @returns a function to cancel the operation
1177
1228
  */
1178
- populateVisualisation(
1179
- visualisation: Visualization,
1229
+ populateVisualization(
1230
+ visualization: Visualization,
1180
1231
  callback: (visualization: Visualization) => void,
1181
1232
  ): () => void
1182
1233
 
1183
1234
  /**
1184
- * @param visualisation - the visualization to be populated
1235
+ * @param visualization - the visualization to be populated
1185
1236
  *
1186
1237
  * @returns A promise with the populated visualization
1187
1238
  */
1188
- populateVisualisation(visualisation: Visualization): Promise<Visualization>
1239
+ populateVisualization(visualization: Visualization): Promise<Visualization>
1189
1240
 
1241
+ /**
1242
+ * Creates a table for measurements, for a single selected object
1243
+ *
1244
+ * @param object - the object reference
1245
+ * @param granularity - the granularity for the data fetched
1246
+ * @param period - the period for the data fetched
1247
+ * @param callback - Callback function called with the populated table
1248
+ *
1249
+ * @returns a function to cancel the operation
1250
+ */
1251
+ getMeasurements(
1252
+ object: string,
1253
+ granularity: 'raw' | 'scaled' | 'normalised',
1254
+ period: Period,
1255
+ callback: (result: MeasurementsWidgetResult) => void,
1256
+ ): () => void
1257
+
1258
+ /**
1259
+ * Returns measurable levels contained in a dashboard level
1260
+ * @param dashboardLevel - dashboard level. See type for possible values
1261
+ * @throws Error - If input is not contained in the possible dashboard levels
1262
+ */
1263
+ getMeasurableSubLevels(dashboardLevel: DashboardLevel): Level[]
1190
1264
  /**
1191
1265
  * Returns the granularity for the view
1192
1266
  * @param view
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3e/sqa-common",
3
- "version": "6.0.7-test",
3
+ "version": "6.0.8-1",
4
4
  "description": "SynaptiQ utilities package",
5
5
  "main": "sqa_common.js",
6
6
  "dependencies": {