@squiz/dx-json-schema-lib 1.39.0 → 1.39.1-alpha.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 (34) hide show
  1. package/.npm/_logs/{2023-06-21T06_19_37_197Z-debug-0.log → 2023-06-22T05_23_22_241Z-debug-0.log} +9 -9
  2. package/jsonCompiler.ts +1 -0
  3. package/lib/JsonValidationService.d.ts +1 -1
  4. package/lib/JsonValidationService.js +7 -0
  5. package/lib/JsonValidationService.js.map +1 -1
  6. package/lib/manifest/v1/JobV1.d.ts +192 -0
  7. package/lib/manifest/v1/JobV1.js +9 -0
  8. package/lib/manifest/v1/JobV1.js.map +1 -0
  9. package/lib/manifest/v1/JobV1.json +88 -0
  10. package/lib/manifest/v1/JobV1.spec.d.ts +1 -0
  11. package/lib/manifest/v1/JobV1.spec.js +75 -0
  12. package/lib/manifest/v1/JobV1.spec.js.map +1 -0
  13. package/lib/manifest/v1/__test__/schemas/badFunctionInputJob.json +25 -0
  14. package/lib/manifest/v1/__test__/schemas/nonObjectFunctionInputJob.json +25 -0
  15. package/lib/manifest/v1/__test__/schemas/validJob.json +25 -0
  16. package/lib/manifest/v1/manifestModels.d.ts +1 -0
  17. package/lib/manifest/v1/manifestModels.js +2 -1
  18. package/lib/manifest/v1/manifestModels.js.map +1 -1
  19. package/lib/manifest/v1/manifestSchemas.d.ts +2 -1
  20. package/lib/manifest/v1/manifestSchemas.js +3 -1
  21. package/lib/manifest/v1/manifestSchemas.js.map +1 -1
  22. package/lib/manifest/v1/v1.json +26 -7
  23. package/package.json +2 -2
  24. package/src/JsonValidationService.ts +9 -1
  25. package/src/manifest/v1/JobV1.json +88 -0
  26. package/src/manifest/v1/JobV1.spec.ts +110 -0
  27. package/src/manifest/v1/JobV1.ts +447 -0
  28. package/src/manifest/v1/__test__/schemas/badFunctionInputJob.json +25 -0
  29. package/src/manifest/v1/__test__/schemas/nonObjectFunctionInputJob.json +25 -0
  30. package/src/manifest/v1/__test__/schemas/validJob.json +25 -0
  31. package/src/manifest/v1/manifestModels.ts +1 -0
  32. package/src/manifest/v1/manifestSchemas.ts +2 -1
  33. package/src/manifest/v1/v1.json +26 -14
  34. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,447 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ /**
9
+ * Input schema for a DxComponent
10
+ */
11
+ export type DxComponentInputSchema = CoreSchemaMetaSchema & {
12
+ type?: 'object';
13
+ additionalProperties?: boolean;
14
+ [k: string]: unknown;
15
+ };
16
+ export type CoreSchemaMetaSchema = CoreSchemaMetaSchema1 & CoreSchemaMetaSchema2;
17
+ export type CoreSchemaMetaSchema2 =
18
+ | {
19
+ $id?: string;
20
+ $schema?: string;
21
+ $ref?: string;
22
+ $comment?: string;
23
+ title?: string;
24
+ description?: string;
25
+ default?: true;
26
+ readOnly?: boolean;
27
+ writeOnly?: boolean;
28
+ examples?: true[];
29
+ multipleOf?: number;
30
+ maximum?: number;
31
+ exclusiveMaximum?: number;
32
+ minimum?: number;
33
+ exclusiveMinimum?: number;
34
+ maxLength?: number;
35
+ minLength?: number & number;
36
+ pattern?: string;
37
+ additionalItems?: CoreSchemaMetaSchema2;
38
+ items?: CoreSchemaMetaSchema2 | SchemaArray;
39
+ maxItems?: number;
40
+ minItems?: number & number;
41
+ uniqueItems?: boolean;
42
+ contains?: CoreSchemaMetaSchema2;
43
+ maxProperties?: number;
44
+ minProperties?: number & number;
45
+ required?: StringArray;
46
+ additionalProperties?: CoreSchemaMetaSchema2;
47
+ definitions?: {
48
+ [k: string]: CoreSchemaMetaSchema2;
49
+ };
50
+ properties?: {
51
+ [k: string]: CoreSchemaMetaSchema2;
52
+ };
53
+ patternProperties?: {
54
+ [k: string]: CoreSchemaMetaSchema2;
55
+ };
56
+ dependencies?: {
57
+ [k: string]: CoreSchemaMetaSchema2 | StringArray;
58
+ };
59
+ propertyNames?: CoreSchemaMetaSchema2;
60
+ const?: true;
61
+ /**
62
+ * @minItems 1
63
+ */
64
+ enum?: true[];
65
+ type?:
66
+ | (
67
+ | 'array'
68
+ | 'boolean'
69
+ | 'integer'
70
+ | 'null'
71
+ | 'number'
72
+ | 'object'
73
+ | 'string'
74
+ | 'FormattedText'
75
+ | 'SquizImage'
76
+ | 'SquizLink'
77
+ )
78
+ | (
79
+ | 'array'
80
+ | 'boolean'
81
+ | 'integer'
82
+ | 'null'
83
+ | 'number'
84
+ | 'object'
85
+ | 'string'
86
+ | 'FormattedText'
87
+ | 'SquizImage'
88
+ | 'SquizLink'
89
+ )[];
90
+ format?:
91
+ | 'date-time'
92
+ | 'email'
93
+ | 'hostname'
94
+ | 'ipv4'
95
+ | 'ipv6'
96
+ | 'json-pointer'
97
+ | 'matrix-asset-uri'
98
+ | 'multi-line'
99
+ | 'password'
100
+ | 'phone'
101
+ | 'regex'
102
+ | 'relative-json-pointer'
103
+ | 'uri-reference'
104
+ | 'uri-template'
105
+ | 'uri'
106
+ | 'uuid';
107
+ matrixAssetTypes?: (
108
+ | 'audioFile'
109
+ | 'bodycopyContainer'
110
+ | 'bodycopyDiv'
111
+ | 'calendarEventsSearchPage'
112
+ | 'contentContainerTemplate'
113
+ | 'contentTypeMarkdown'
114
+ | 'contentTypeNestContent'
115
+ | 'contentTypeRawHtml'
116
+ | 'contentTypeSnippet'
117
+ | 'contentTypeWysiwyg'
118
+ | 'cssFileFolder'
119
+ | 'cssFile'
120
+ | 'customForm'
121
+ | 'dataRecord'
122
+ | 'designAreaAssetLineage'
123
+ | 'designAreaBody'
124
+ | 'designAreaMenuNormal'
125
+ | 'designAreaNestContent'
126
+ | 'designCssCustomisation'
127
+ | 'designCss'
128
+ | 'designCustomisation'
129
+ | 'designScss'
130
+ | 'design'
131
+ | 'docx'
132
+ | 'excelDoc'
133
+ | 'file'
134
+ | 'folder'
135
+ | 'gitBridge'
136
+ | 'googleAnalyticsConnector'
137
+ | 'googleAnalyticsView'
138
+ | 'image'
139
+ | 'jsFileFolder'
140
+ | 'jsFile'
141
+ | 'jsonWebToken'
142
+ | 'layoutManager'
143
+ | 'layout'
144
+ | 'link'
145
+ | 'metadataFieldDate'
146
+ | 'metadataFieldRelatedAsset'
147
+ | 'metadataFieldSelect'
148
+ | 'metadataFieldText'
149
+ | 'metadataFieldWysiwyg'
150
+ | 'metadataSchema'
151
+ | 'metadataSection'
152
+ | 'newsItem'
153
+ | 'oauthAccountManager'
154
+ | 'pageAccountManager'
155
+ | 'pageAssetListing'
156
+ | 'pageCalendarEventsSearch'
157
+ | 'pageCalendar'
158
+ | 'pagePasswordReset'
159
+ | 'pageRemoteContent'
160
+ | 'pageRestResourceJs'
161
+ | 'pageRestResourceOauthSession'
162
+ | 'pageRestResourceOauthTwoLegged'
163
+ | 'pageRestResource'
164
+ | 'pageSiteMap'
165
+ | 'pageStandard'
166
+ | 'paintLayoutBodycopy'
167
+ | 'paintLayoutPage'
168
+ | 'pdfFile'
169
+ | 'pdf'
170
+ | 'persona'
171
+ | 'powerpointDoc'
172
+ | 'pptx'
173
+ | 'redirectPage'
174
+ | 'regex'
175
+ | 'regularExpression'
176
+ | 'rtfFile'
177
+ | 'samlAccountManager'
178
+ | 'saml2Acs'
179
+ | 'saml2Sls'
180
+ | 'searchPage'
181
+ | 'site'
182
+ | 'textFile'
183
+ | 'TriggerTypes?'
184
+ | 'userGroup'
185
+ | 'wordDoc'
186
+ | 'workflowSchema'
187
+ | 'workflowStepCondition'
188
+ | 'workflowStep'
189
+ | 'workflowStream'
190
+ | 'xlsx'
191
+ | 'xmlFile'
192
+ )[];
193
+ contentMediaType?: string;
194
+ contentEncoding?: string;
195
+ if?: CoreSchemaMetaSchema2;
196
+ then?: CoreSchemaMetaSchema2;
197
+ else?: CoreSchemaMetaSchema2;
198
+ allOf?: SchemaArray;
199
+ anyOf?: SchemaArray;
200
+ oneOf?: SchemaArray;
201
+ not?: CoreSchemaMetaSchema2;
202
+ }
203
+ | boolean;
204
+ /**
205
+ * @minItems 1
206
+ */
207
+ export type SchemaArray = CoreSchemaMetaSchema2[];
208
+ export type StringArray = string[];
209
+
210
+ export interface JobManifest {
211
+ /**
212
+ * the manifest schema version
213
+ */
214
+ $schema: string;
215
+ /**
216
+ * Name of the job
217
+ */
218
+ name: string;
219
+ /**
220
+ * Display name of the job
221
+ */
222
+ displayName: string;
223
+ /**
224
+ * Description of the job
225
+ */
226
+ description: string;
227
+ /**
228
+ * Name of the main function to be executed at the root of the access url
229
+ */
230
+ mainFunction: string;
231
+ /**
232
+ * Semver version number
233
+ */
234
+ version: string;
235
+ /**
236
+ * Timeout in seconds before a job is stopped (min 5s, max 8h)
237
+ */
238
+ timeout: number;
239
+ /**
240
+ * The number of these jobs that can be run at once
241
+ */
242
+ concurrency: number;
243
+ /**
244
+ * @minItems 0
245
+ */
246
+ functions: JobFunction[];
247
+ }
248
+ /**
249
+ * Job function definition, this object provides the runtime with input validation and what to execute
250
+ */
251
+ export interface JobFunction {
252
+ /**
253
+ * Function name
254
+ */
255
+ name: string;
256
+ /**
257
+ * File path to the javascript file to execute. The file path must be relative to the manifest file and cannot be in a folder above the manifest file.
258
+ */
259
+ entry: string;
260
+ input: DxComponentInputSchema;
261
+ [k: string]: unknown;
262
+ }
263
+ export interface CoreSchemaMetaSchema1 {
264
+ $id?: string;
265
+ $schema?: string;
266
+ $ref?: string;
267
+ $comment?: string;
268
+ title?: string;
269
+ description?: string;
270
+ default?: true;
271
+ readOnly?: boolean;
272
+ writeOnly?: boolean;
273
+ examples?: true[];
274
+ multipleOf?: number;
275
+ maximum?: number;
276
+ exclusiveMaximum?: number;
277
+ minimum?: number;
278
+ exclusiveMinimum?: number;
279
+ maxLength?: number;
280
+ minLength?: number & number;
281
+ pattern?: string;
282
+ additionalItems?: CoreSchemaMetaSchema2;
283
+ items?: CoreSchemaMetaSchema2 | SchemaArray;
284
+ maxItems?: number;
285
+ minItems?: number & number;
286
+ uniqueItems?: boolean;
287
+ contains?: CoreSchemaMetaSchema2;
288
+ maxProperties?: number;
289
+ minProperties?: number & number;
290
+ required?: StringArray;
291
+ additionalProperties?: CoreSchemaMetaSchema2;
292
+ definitions?: {
293
+ [k: string]: CoreSchemaMetaSchema2;
294
+ };
295
+ properties?: {
296
+ [k: string]: CoreSchemaMetaSchema2;
297
+ };
298
+ patternProperties?: {
299
+ [k: string]: CoreSchemaMetaSchema2;
300
+ };
301
+ dependencies?: {
302
+ [k: string]: CoreSchemaMetaSchema2 | StringArray;
303
+ };
304
+ propertyNames?: CoreSchemaMetaSchema2;
305
+ const?: true;
306
+ /**
307
+ * @minItems 1
308
+ */
309
+ enum?: true[];
310
+ type?:
311
+ | (
312
+ | 'array'
313
+ | 'boolean'
314
+ | 'integer'
315
+ | 'null'
316
+ | 'number'
317
+ | 'object'
318
+ | 'string'
319
+ | 'FormattedText'
320
+ | 'SquizImage'
321
+ | 'SquizLink'
322
+ )
323
+ | (
324
+ | 'array'
325
+ | 'boolean'
326
+ | 'integer'
327
+ | 'null'
328
+ | 'number'
329
+ | 'object'
330
+ | 'string'
331
+ | 'FormattedText'
332
+ | 'SquizImage'
333
+ | 'SquizLink'
334
+ )[];
335
+ format?:
336
+ | 'date-time'
337
+ | 'email'
338
+ | 'hostname'
339
+ | 'ipv4'
340
+ | 'ipv6'
341
+ | 'json-pointer'
342
+ | 'matrix-asset-uri'
343
+ | 'multi-line'
344
+ | 'password'
345
+ | 'phone'
346
+ | 'regex'
347
+ | 'relative-json-pointer'
348
+ | 'uri-reference'
349
+ | 'uri-template'
350
+ | 'uri'
351
+ | 'uuid';
352
+ matrixAssetTypes?: (
353
+ | 'audioFile'
354
+ | 'bodycopyContainer'
355
+ | 'bodycopyDiv'
356
+ | 'calendarEventsSearchPage'
357
+ | 'contentContainerTemplate'
358
+ | 'contentTypeMarkdown'
359
+ | 'contentTypeNestContent'
360
+ | 'contentTypeRawHtml'
361
+ | 'contentTypeSnippet'
362
+ | 'contentTypeWysiwyg'
363
+ | 'cssFileFolder'
364
+ | 'cssFile'
365
+ | 'customForm'
366
+ | 'dataRecord'
367
+ | 'designAreaAssetLineage'
368
+ | 'designAreaBody'
369
+ | 'designAreaMenuNormal'
370
+ | 'designAreaNestContent'
371
+ | 'designCssCustomisation'
372
+ | 'designCss'
373
+ | 'designCustomisation'
374
+ | 'designScss'
375
+ | 'design'
376
+ | 'docx'
377
+ | 'excelDoc'
378
+ | 'file'
379
+ | 'folder'
380
+ | 'gitBridge'
381
+ | 'googleAnalyticsConnector'
382
+ | 'googleAnalyticsView'
383
+ | 'image'
384
+ | 'jsFileFolder'
385
+ | 'jsFile'
386
+ | 'jsonWebToken'
387
+ | 'layoutManager'
388
+ | 'layout'
389
+ | 'link'
390
+ | 'metadataFieldDate'
391
+ | 'metadataFieldRelatedAsset'
392
+ | 'metadataFieldSelect'
393
+ | 'metadataFieldText'
394
+ | 'metadataFieldWysiwyg'
395
+ | 'metadataSchema'
396
+ | 'metadataSection'
397
+ | 'newsItem'
398
+ | 'oauthAccountManager'
399
+ | 'pageAccountManager'
400
+ | 'pageAssetListing'
401
+ | 'pageCalendarEventsSearch'
402
+ | 'pageCalendar'
403
+ | 'pagePasswordReset'
404
+ | 'pageRemoteContent'
405
+ | 'pageRestResourceJs'
406
+ | 'pageRestResourceOauthSession'
407
+ | 'pageRestResourceOauthTwoLegged'
408
+ | 'pageRestResource'
409
+ | 'pageSiteMap'
410
+ | 'pageStandard'
411
+ | 'paintLayoutBodycopy'
412
+ | 'paintLayoutPage'
413
+ | 'pdfFile'
414
+ | 'pdf'
415
+ | 'persona'
416
+ | 'powerpointDoc'
417
+ | 'pptx'
418
+ | 'redirectPage'
419
+ | 'regex'
420
+ | 'regularExpression'
421
+ | 'rtfFile'
422
+ | 'samlAccountManager'
423
+ | 'saml2Acs'
424
+ | 'saml2Sls'
425
+ | 'searchPage'
426
+ | 'site'
427
+ | 'textFile'
428
+ | 'TriggerTypes?'
429
+ | 'userGroup'
430
+ | 'wordDoc'
431
+ | 'workflowSchema'
432
+ | 'workflowStepCondition'
433
+ | 'workflowStep'
434
+ | 'workflowStream'
435
+ | 'xlsx'
436
+ | 'xmlFile'
437
+ )[];
438
+ contentMediaType?: string;
439
+ contentEncoding?: string;
440
+ if?: CoreSchemaMetaSchema2;
441
+ then?: CoreSchemaMetaSchema2;
442
+ else?: CoreSchemaMetaSchema2;
443
+ allOf?: SchemaArray;
444
+ anyOf?: SchemaArray;
445
+ oneOf?: SchemaArray;
446
+ not?: CoreSchemaMetaSchema2;
447
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://localhost:3040/schemas/JobV1.json#",
3
+ "name": "simple-job",
4
+ "displayName": "Simple job",
5
+ "version": "1.0.22",
6
+ "mainFunction": "main",
7
+ "description": "some-description",
8
+ "concurrency": 1,
9
+ "timeout": 10000,
10
+ "functions": [
11
+ {
12
+ "entry": "main.js",
13
+ "name": "main",
14
+ "input": {
15
+ "type": "object",
16
+ "properties": {
17
+ "something": {
18
+ "type": "wrongType"
19
+ }
20
+ },
21
+ "required": ["something"]
22
+ }
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://localhost:3040/schemas/JobV1.json#",
3
+ "name": "simple-job",
4
+ "displayName": "Simple Job",
5
+ "version": "1.0.22",
6
+ "mainFunction": "main",
7
+ "description": "some-description",
8
+ "concurrency": 1,
9
+ "timeout": 10000,
10
+ "functions": [
11
+ {
12
+ "entry": "main.js",
13
+ "name": "main",
14
+ "input": {
15
+ "type": "string",
16
+ "properties": {
17
+ "something": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "required": ["something"]
22
+ }
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://localhost:3040/schemas/JobV1.json#",
3
+ "name": "simple-job",
4
+ "displayName": "Simple Job",
5
+ "version": "1.0.22",
6
+ "mainFunction": "main",
7
+ "description": "some-description",
8
+ "concurrency": 1,
9
+ "timeout": 10000,
10
+ "functions": [
11
+ {
12
+ "entry": "main.js",
13
+ "name": "main",
14
+ "input": {
15
+ "type": "object",
16
+ "properties": {
17
+ "something": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "required": ["something"]
22
+ }
23
+ }
24
+ ]
25
+ }
@@ -1 +1,2 @@
1
1
  export * as v1 from './v1';
2
+ export * as JobV1 from './JobV1';
@@ -1,3 +1,4 @@
1
1
  import v1 from './v1.json';
2
+ import JobV1 from './JobV1.json';
2
3
 
3
- export { v1 };
4
+ export { v1, JobV1 };
@@ -4,15 +4,28 @@
4
4
  "title": "ComponentManifest",
5
5
  "additionalProperties": false,
6
6
  "properties": {
7
- "$schema": { "type": "string", "description": "the manifest schema version" },
7
+ "$schema": {
8
+ "type": "string",
9
+ "description": "the manifest schema version"
10
+ },
8
11
  "namespace": {
9
12
  "type": "string",
10
13
  "description": "Namespace of the component",
11
14
  "$ref": "#/definitions/name-pattern"
12
15
  },
13
- "name": { "type": "string", "description": "Name of the component", "$ref": "#/definitions/name-pattern" },
14
- "displayName": { "type": "string", "description": "Display name of the component" },
15
- "description": { "type": "string", "description": "Description of the component" },
16
+ "name": {
17
+ "type": "string",
18
+ "description": "Name of the component",
19
+ "$ref": "#/definitions/name-pattern"
20
+ },
21
+ "displayName": {
22
+ "type": "string",
23
+ "description": "Display name of the component"
24
+ },
25
+ "description": {
26
+ "type": "string",
27
+ "description": "Description of the component"
28
+ },
16
29
  "mainFunction": {
17
30
  "type": "string",
18
31
  "description": "Name of the main function to be executed at the root of the access url"
@@ -46,7 +59,6 @@
46
59
  "required": ["name"]
47
60
  }
48
61
  },
49
-
50
62
  "staticFiles": {
51
63
  "type": "object",
52
64
  "properties": {
@@ -55,7 +67,6 @@
55
67
  "description": "The location the system begins looking static files. All static files will be referenced from here."
56
68
  }
57
69
  },
58
-
59
70
  "required": ["locationRoot"]
60
71
  },
61
72
  "functions": {
@@ -86,8 +97,9 @@
86
97
  "additionalProperties": false,
87
98
  "description": "The HtmlResponse type is for returning html content. The response out of the function must be a string. This response object also includes references to resources (staticFiles) the component needs to execute correctly. It is up to the integrating system to respect this.",
88
99
  "properties": {
89
- "responseType": { "const": "html" },
90
-
100
+ "responseType": {
101
+ "const": "html"
102
+ },
91
103
  "staticFiles": {
92
104
  "type": "array",
93
105
  "description": "A list of static resources that are required for the component to execute correctly",
@@ -247,7 +259,6 @@
247
259
  }
248
260
  }
249
261
  },
250
-
251
262
  "required": ["responseType"]
252
263
  },
253
264
  {
@@ -255,8 +266,12 @@
255
266
  "type": "object",
256
267
  "additionalProperties": false,
257
268
  "properties": {
258
- "responseType": { "const": "json" },
259
- "definition": { "$ref": "http://json-schema.org/draft-07/schema#" },
269
+ "responseType": {
270
+ "const": "json"
271
+ },
272
+ "definition": {
273
+ "$ref": "http://json-schema.org/draft-07/schema#"
274
+ },
260
275
  "headers": {
261
276
  "title": "ResponseHeaders",
262
277
  "type": "object",
@@ -266,7 +281,6 @@
266
281
  }
267
282
  }
268
283
  },
269
-
270
284
  "required": ["responseType", "definition"]
271
285
  }
272
286
  ]
@@ -432,9 +446,7 @@
432
446
  }
433
447
  }
434
448
  },
435
-
436
449
  "required": ["name", "namespace", "displayName", "description", "version", "functions", "$schema", "mainFunction"],
437
-
438
450
  "definitions": {
439
451
  "name-pattern": {
440
452
  "type": "string",