@3e/sqa-common 6.0.6-9 → 6.0.7-test

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 +101 -2
  2. package/package.json +1 -1
  3. package/sqa_common.js +929 -925
package/index.d.ts CHANGED
@@ -672,6 +672,24 @@ declare module '@3e/sqa-common' {
672
672
  body: Section[]
673
673
  }
674
674
 
675
+ export type Parameters = {
676
+ class: string
677
+ id: string
678
+ }
679
+
680
+ export type ViewData = SQView & {
681
+ artifact: {
682
+ type: string
683
+ version: string
684
+ }
685
+ body: {
686
+ body: Parameters[]
687
+ class: string
688
+ id: string
689
+ }[]
690
+ version: string
691
+ }
692
+
675
693
  export type ParameterOption = {
676
694
  options: {value: string; label: string}[]
677
695
  id: string
@@ -1015,6 +1033,53 @@ declare module '@3e/sqa-common' {
1015
1033
  // TODO: Better types for PacoViewParameters
1016
1034
  type PacoViewParameters = any
1017
1035
 
1036
+ type SaveDataJobStatus =
1037
+ | {
1038
+ status: 'terminated'
1039
+ respResult: {downloadUrl: string}
1040
+ completedTime: ISODateString
1041
+ respStatus: number
1042
+ }
1043
+ | {status: 'running'}
1044
+
1045
+ type SaveDataJobResponse = SaveDataJobStatus & {
1046
+ actorSqid: string
1047
+ numRetries: number
1048
+ sqid: string
1049
+ maxRetries: number
1050
+
1051
+ /**
1052
+ * The arguments derived from the visualization given as argument
1053
+ * for the `createSaveDataJob` function
1054
+ */
1055
+ arguments: {
1056
+ object: string[]
1057
+ toDate: ISODateString
1058
+ filename: string
1059
+ replyTz: string
1060
+ fromDate: string
1061
+ indicator: string[]
1062
+ granularity: Granularity[] // must be a single value
1063
+ }
1064
+ /**
1065
+ * The place in the queue
1066
+ */
1067
+ priority: number
1068
+
1069
+ timeout: number
1070
+
1071
+ /**
1072
+ * currently can be just save_data
1073
+ */
1074
+ typeSqid: number
1075
+ }
1076
+
1077
+ type Parameter = {
1078
+ id: string
1079
+ class: 'Parameter'
1080
+ parameter: {class: string; label: string; initial: unknown; value: unknown}
1081
+ }
1082
+
1018
1083
  /**
1019
1084
  * Type definitions for all the API
1020
1085
  */
@@ -1153,7 +1218,7 @@ declare module '@3e/sqa-common' {
1153
1218
  * @param id - The ID of the parameter //TODO: Get list of possible parameters
1154
1219
  * @param value - Value of the parameter
1155
1220
  */
1156
- setObjectParameters(view: SQView, id: string, value: string): SQView
1221
+ setObjectParameter(view: SQView, id: string, value: string): SQView
1157
1222
 
1158
1223
  DataTimezoneModes: [
1159
1224
  {value: 'user'; label: 'Display data in my own timezone'},
@@ -1237,7 +1302,7 @@ declare module '@3e/sqa-common' {
1237
1302
  */
1238
1303
  getContainers(
1239
1304
  selectedLevel: LevelValue,
1240
- selectedContainerLdType: string,
1305
+ selectedContainerLdType?: string,
1241
1306
  ): Promise<Container[]>
1242
1307
 
1243
1308
  /**
@@ -1405,6 +1470,40 @@ declare module '@3e/sqa-common' {
1405
1470
  * @param visualization
1406
1471
  */
1407
1472
  updateVisualization(visualization: Visualization): Visualization
1473
+
1474
+ /**
1475
+ * Create a SAVE_DATA job request for a visualization. After a job is
1476
+ * successfully created, a *JobUrl* is returned to be polled for a status
1477
+ * on the job
1478
+ *
1479
+ * @param visualization - The visualization to be saved in a .csv format
1480
+ * @param filename - the name of the csv.zip file to be downloaded
1481
+ *
1482
+ * @throws An error in case the provided parameters were incorrect. Wrap the
1483
+ * request inside a `try-catch` block
1484
+ */
1485
+ createSaveDataJob(
1486
+ visualization: Visualization,
1487
+ filename: string,
1488
+ ): Promise<string>
1489
+
1490
+ /**
1491
+ * Used for polling the SQA API for the job status.
1492
+ *
1493
+ * Use the jobUrl returned from `createSaveDataJob` and poll until `status` is `terminated`
1494
+ * @param jobUrl
1495
+ *
1496
+ * @throws An error in case something goes wrong with the request or the job does not
1497
+ * exist. Wrap the call inside a `try-catch` block
1498
+ */
1499
+ checkJobStatus(jobUrl: string): Promise<SaveDataJobResponse>
1500
+
1501
+ /**
1502
+ * Returns the parameters of a view
1503
+ * @param view
1504
+ */
1505
+ getViewParameters(view: SQView): Parameter[]
1506
+
1408
1507
  }
1409
1508
 
1410
1509
  export const sqa: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3e/sqa-common",
3
- "version": "6.0.6-9",
3
+ "version": "6.0.7-test",
4
4
  "description": "SynaptiQ utilities package",
5
5
  "main": "sqa_common.js",
6
6
  "dependencies": {