@squiz/dx-json-schema-lib 1.76.3 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/lib/JsonValidationService.spec.js +160 -0
- package/lib/JsonValidationService.spec.js.map +1 -1
- package/lib/formatted-text/v1/formattedText.d.ts +19 -0
- package/lib/formatted-text/v1/formattedText.json +52 -3
- package/lib/manifest/v1/DxContentMetaSchema.json +8 -1
- package/lib/manifest/v1/JobV1.d.ts +27 -20
- package/lib/manifest/v1/v1.d.ts +45 -34
- package/lib/manifest/v1/v1.json +9 -0
- package/lib/manifest/v1/v1.spec.js +18 -0
- package/lib/manifest/v1/v1.spec.js.map +1 -1
- package/package.json +2 -2
- package/src/JsonValidationService.spec.ts +172 -0
- package/src/formatted-text/v1/formattedText.json +52 -3
- package/src/formatted-text/v1/formattedText.ts +19 -0
- package/src/manifest/v1/DxContentMetaSchema.json +8 -1
- package/src/manifest/v1/JobV1.ts +30 -22
- package/src/manifest/v1/v1.json +9 -0
- package/src/manifest/v1/v1.spec.ts +31 -0
- package/src/manifest/v1/v1.ts +48 -36
- package/tsconfig.tsbuildinfo +1 -1
@@ -12,6 +12,18 @@ export type DxComponentInputSchema = CoreSchemaMetaSchema & {
|
|
12
12
|
[k: string]: unknown;
|
13
13
|
};
|
14
14
|
export type CoreSchemaMetaSchema = CoreSchemaMetaSchema1 & CoreSchemaMetaSchema2;
|
15
|
+
export type UiMetadata = {
|
16
|
+
/**
|
17
|
+
* Whether the component should automatically reload when the input is changed
|
18
|
+
*/
|
19
|
+
autoReload?: boolean;
|
20
|
+
[k: string]: unknown;
|
21
|
+
} & ({
|
22
|
+
collapsedByDefault?: boolean;
|
23
|
+
} | {
|
24
|
+
inlineEditable?: boolean;
|
25
|
+
quickOption?: boolean;
|
26
|
+
});
|
15
27
|
export type CoreSchemaMetaSchema2 = {
|
16
28
|
$id?: string;
|
17
29
|
'ui:metadata'?: {
|
@@ -25,26 +37,26 @@ export type CoreSchemaMetaSchema2 = {
|
|
25
37
|
$comment?: string;
|
26
38
|
title?: string;
|
27
39
|
description?: string;
|
28
|
-
default?:
|
40
|
+
default?: unknown;
|
29
41
|
readOnly?: boolean;
|
30
42
|
writeOnly?: boolean;
|
31
|
-
examples?:
|
43
|
+
examples?: unknown[];
|
32
44
|
multipleOf?: number;
|
33
45
|
maximum?: number;
|
34
46
|
exclusiveMaximum?: number;
|
35
47
|
minimum?: number;
|
36
48
|
exclusiveMinimum?: number;
|
37
49
|
maxLength?: number;
|
38
|
-
minLength?: number
|
50
|
+
minLength?: number;
|
39
51
|
pattern?: string;
|
40
52
|
additionalItems?: CoreSchemaMetaSchema2;
|
41
53
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
42
54
|
maxItems?: number;
|
43
|
-
minItems?: number
|
55
|
+
minItems?: number;
|
44
56
|
uniqueItems?: boolean;
|
45
57
|
contains?: CoreSchemaMetaSchema2;
|
46
58
|
maxProperties?: number;
|
47
|
-
minProperties?: number
|
59
|
+
minProperties?: number;
|
48
60
|
required?: StringArray;
|
49
61
|
additionalProperties?: CoreSchemaMetaSchema2;
|
50
62
|
definitions?: {
|
@@ -60,11 +72,11 @@ export type CoreSchemaMetaSchema2 = {
|
|
60
72
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
61
73
|
};
|
62
74
|
propertyNames?: CoreSchemaMetaSchema2;
|
63
|
-
const?:
|
75
|
+
const?: unknown;
|
64
76
|
/**
|
65
77
|
* @minItems 1
|
66
78
|
*/
|
67
|
-
enum?:
|
79
|
+
enum?: unknown[];
|
68
80
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
69
81
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
70
82
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
@@ -138,37 +150,32 @@ export interface JobFunction {
|
|
138
150
|
}
|
139
151
|
export interface CoreSchemaMetaSchema1 {
|
140
152
|
$id?: string;
|
141
|
-
'ui:metadata'?:
|
142
|
-
collapsedByDefault?: boolean;
|
143
|
-
} | {
|
144
|
-
inlineEditable?: boolean;
|
145
|
-
quickOption?: boolean;
|
146
|
-
};
|
153
|
+
'ui:metadata'?: UiMetadata;
|
147
154
|
$schema?: string;
|
148
155
|
$ref?: string;
|
149
156
|
$comment?: string;
|
150
157
|
title?: string;
|
151
158
|
description?: string;
|
152
|
-
default?:
|
159
|
+
default?: unknown;
|
153
160
|
readOnly?: boolean;
|
154
161
|
writeOnly?: boolean;
|
155
|
-
examples?:
|
162
|
+
examples?: unknown[];
|
156
163
|
multipleOf?: number;
|
157
164
|
maximum?: number;
|
158
165
|
exclusiveMaximum?: number;
|
159
166
|
minimum?: number;
|
160
167
|
exclusiveMinimum?: number;
|
161
168
|
maxLength?: number;
|
162
|
-
minLength?: number
|
169
|
+
minLength?: number;
|
163
170
|
pattern?: string;
|
164
171
|
additionalItems?: CoreSchemaMetaSchema2;
|
165
172
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
166
173
|
maxItems?: number;
|
167
|
-
minItems?: number
|
174
|
+
minItems?: number;
|
168
175
|
uniqueItems?: boolean;
|
169
176
|
contains?: CoreSchemaMetaSchema2;
|
170
177
|
maxProperties?: number;
|
171
|
-
minProperties?: number
|
178
|
+
minProperties?: number;
|
172
179
|
required?: StringArray;
|
173
180
|
additionalProperties?: CoreSchemaMetaSchema2;
|
174
181
|
definitions?: {
|
@@ -184,11 +191,11 @@ export interface CoreSchemaMetaSchema1 {
|
|
184
191
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
185
192
|
};
|
186
193
|
propertyNames?: CoreSchemaMetaSchema2;
|
187
|
-
const?:
|
194
|
+
const?: unknown;
|
188
195
|
/**
|
189
196
|
* @minItems 1
|
190
197
|
*/
|
191
|
-
enum?:
|
198
|
+
enum?: unknown[];
|
192
199
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
193
200
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
194
201
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
package/lib/manifest/v1/v1.d.ts
CHANGED
@@ -12,6 +12,18 @@ export type DxComponentInputSchema = CoreSchemaMetaSchema & {
|
|
12
12
|
[k: string]: unknown;
|
13
13
|
};
|
14
14
|
export type CoreSchemaMetaSchema = CoreSchemaMetaSchema1 & CoreSchemaMetaSchema2;
|
15
|
+
export type UiMetadata = {
|
16
|
+
/**
|
17
|
+
* Whether the component should automatically reload when the input is changed
|
18
|
+
*/
|
19
|
+
autoReload?: boolean;
|
20
|
+
[k: string]: unknown;
|
21
|
+
} & ({
|
22
|
+
collapsedByDefault?: boolean;
|
23
|
+
} | {
|
24
|
+
inlineEditable?: boolean;
|
25
|
+
quickOption?: boolean;
|
26
|
+
});
|
15
27
|
export type CoreSchemaMetaSchema2 = {
|
16
28
|
$id?: string;
|
17
29
|
'ui:metadata'?: {
|
@@ -25,26 +37,26 @@ export type CoreSchemaMetaSchema2 = {
|
|
25
37
|
$comment?: string;
|
26
38
|
title?: string;
|
27
39
|
description?: string;
|
28
|
-
default?:
|
40
|
+
default?: unknown;
|
29
41
|
readOnly?: boolean;
|
30
42
|
writeOnly?: boolean;
|
31
|
-
examples?:
|
43
|
+
examples?: unknown[];
|
32
44
|
multipleOf?: number;
|
33
45
|
maximum?: number;
|
34
46
|
exclusiveMaximum?: number;
|
35
47
|
minimum?: number;
|
36
48
|
exclusiveMinimum?: number;
|
37
49
|
maxLength?: number;
|
38
|
-
minLength?: number
|
50
|
+
minLength?: number;
|
39
51
|
pattern?: string;
|
40
52
|
additionalItems?: CoreSchemaMetaSchema2;
|
41
53
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
42
54
|
maxItems?: number;
|
43
|
-
minItems?: number
|
55
|
+
minItems?: number;
|
44
56
|
uniqueItems?: boolean;
|
45
57
|
contains?: CoreSchemaMetaSchema2;
|
46
58
|
maxProperties?: number;
|
47
|
-
minProperties?: number
|
59
|
+
minProperties?: number;
|
48
60
|
required?: StringArray;
|
49
61
|
additionalProperties?: CoreSchemaMetaSchema2;
|
50
62
|
definitions?: {
|
@@ -60,11 +72,11 @@ export type CoreSchemaMetaSchema2 = {
|
|
60
72
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
61
73
|
};
|
62
74
|
propertyNames?: CoreSchemaMetaSchema2;
|
63
|
-
const?:
|
75
|
+
const?: unknown;
|
64
76
|
/**
|
65
77
|
* @minItems 1
|
66
78
|
*/
|
67
|
-
enum?:
|
79
|
+
enum?: unknown[];
|
68
80
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
69
81
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
70
82
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
@@ -91,26 +103,26 @@ export type CoreSchemaMetaSchema5 = {
|
|
91
103
|
$comment?: string;
|
92
104
|
title?: string;
|
93
105
|
description?: string;
|
94
|
-
default?:
|
106
|
+
default?: unknown;
|
95
107
|
readOnly?: boolean;
|
96
108
|
writeOnly?: boolean;
|
97
|
-
examples?:
|
109
|
+
examples?: unknown[];
|
98
110
|
multipleOf?: number;
|
99
111
|
maximum?: number;
|
100
112
|
exclusiveMaximum?: number;
|
101
113
|
minimum?: number;
|
102
114
|
exclusiveMinimum?: number;
|
103
115
|
maxLength?: number;
|
104
|
-
minLength?: number
|
116
|
+
minLength?: number;
|
105
117
|
pattern?: string;
|
106
118
|
additionalItems?: CoreSchemaMetaSchema5;
|
107
119
|
items?: CoreSchemaMetaSchema5 | SchemaArray1;
|
108
120
|
maxItems?: number;
|
109
|
-
minItems?: number
|
121
|
+
minItems?: number;
|
110
122
|
uniqueItems?: boolean;
|
111
123
|
contains?: CoreSchemaMetaSchema5;
|
112
124
|
maxProperties?: number;
|
113
|
-
minProperties?: number
|
125
|
+
minProperties?: number;
|
114
126
|
required?: StringArray1;
|
115
127
|
additionalProperties?: CoreSchemaMetaSchema5;
|
116
128
|
definitions?: {
|
@@ -126,11 +138,11 @@ export type CoreSchemaMetaSchema5 = {
|
|
126
138
|
[k: string]: CoreSchemaMetaSchema5 | StringArray1;
|
127
139
|
};
|
128
140
|
propertyNames?: CoreSchemaMetaSchema5;
|
129
|
-
const?:
|
141
|
+
const?: unknown;
|
130
142
|
/**
|
131
143
|
* @minItems 1
|
132
144
|
*/
|
133
|
-
enum?:
|
145
|
+
enum?: unknown[];
|
134
146
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string')[];
|
135
147
|
format?: string;
|
136
148
|
contentMediaType?: string;
|
@@ -231,6 +243,10 @@ export interface ComponentManifest {
|
|
231
243
|
[k: string]: unknown;
|
232
244
|
};
|
233
245
|
};
|
246
|
+
'ui:metadata'?: {
|
247
|
+
autoReload: boolean & string;
|
248
|
+
[k: string]: unknown;
|
249
|
+
};
|
234
250
|
}
|
235
251
|
/**
|
236
252
|
* Icon for the component in Matrix and the DXP
|
@@ -268,37 +284,32 @@ export interface ComponentFunction {
|
|
268
284
|
}
|
269
285
|
export interface CoreSchemaMetaSchema1 {
|
270
286
|
$id?: string;
|
271
|
-
'ui:metadata'?:
|
272
|
-
collapsedByDefault?: boolean;
|
273
|
-
} | {
|
274
|
-
inlineEditable?: boolean;
|
275
|
-
quickOption?: boolean;
|
276
|
-
};
|
287
|
+
'ui:metadata'?: UiMetadata;
|
277
288
|
$schema?: string;
|
278
289
|
$ref?: string;
|
279
290
|
$comment?: string;
|
280
291
|
title?: string;
|
281
292
|
description?: string;
|
282
|
-
default?:
|
293
|
+
default?: unknown;
|
283
294
|
readOnly?: boolean;
|
284
295
|
writeOnly?: boolean;
|
285
|
-
examples?:
|
296
|
+
examples?: unknown[];
|
286
297
|
multipleOf?: number;
|
287
298
|
maximum?: number;
|
288
299
|
exclusiveMaximum?: number;
|
289
300
|
minimum?: number;
|
290
301
|
exclusiveMinimum?: number;
|
291
302
|
maxLength?: number;
|
292
|
-
minLength?: number
|
303
|
+
minLength?: number;
|
293
304
|
pattern?: string;
|
294
305
|
additionalItems?: CoreSchemaMetaSchema2;
|
295
306
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
296
307
|
maxItems?: number;
|
297
|
-
minItems?: number
|
308
|
+
minItems?: number;
|
298
309
|
uniqueItems?: boolean;
|
299
310
|
contains?: CoreSchemaMetaSchema2;
|
300
311
|
maxProperties?: number;
|
301
|
-
minProperties?: number
|
312
|
+
minProperties?: number;
|
302
313
|
required?: StringArray;
|
303
314
|
additionalProperties?: CoreSchemaMetaSchema2;
|
304
315
|
definitions?: {
|
@@ -314,11 +325,11 @@ export interface CoreSchemaMetaSchema1 {
|
|
314
325
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
315
326
|
};
|
316
327
|
propertyNames?: CoreSchemaMetaSchema2;
|
317
|
-
const?:
|
328
|
+
const?: unknown;
|
318
329
|
/**
|
319
330
|
* @minItems 1
|
320
331
|
*/
|
321
|
-
enum?:
|
332
|
+
enum?: unknown[];
|
322
333
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
323
334
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
324
335
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
@@ -384,26 +395,26 @@ export interface CoreSchemaMetaSchema4 {
|
|
384
395
|
$comment?: string;
|
385
396
|
title?: string;
|
386
397
|
description?: string;
|
387
|
-
default?:
|
398
|
+
default?: unknown;
|
388
399
|
readOnly?: boolean;
|
389
400
|
writeOnly?: boolean;
|
390
|
-
examples?:
|
401
|
+
examples?: unknown[];
|
391
402
|
multipleOf?: number;
|
392
403
|
maximum?: number;
|
393
404
|
exclusiveMaximum?: number;
|
394
405
|
minimum?: number;
|
395
406
|
exclusiveMinimum?: number;
|
396
407
|
maxLength?: number;
|
397
|
-
minLength?: number
|
408
|
+
minLength?: number;
|
398
409
|
pattern?: string;
|
399
410
|
additionalItems?: CoreSchemaMetaSchema5;
|
400
411
|
items?: CoreSchemaMetaSchema5 | SchemaArray1;
|
401
412
|
maxItems?: number;
|
402
|
-
minItems?: number
|
413
|
+
minItems?: number;
|
403
414
|
uniqueItems?: boolean;
|
404
415
|
contains?: CoreSchemaMetaSchema5;
|
405
416
|
maxProperties?: number;
|
406
|
-
minProperties?: number
|
417
|
+
minProperties?: number;
|
407
418
|
required?: StringArray1;
|
408
419
|
additionalProperties?: CoreSchemaMetaSchema5;
|
409
420
|
definitions?: {
|
@@ -419,11 +430,11 @@ export interface CoreSchemaMetaSchema4 {
|
|
419
430
|
[k: string]: CoreSchemaMetaSchema5 | StringArray1;
|
420
431
|
};
|
421
432
|
propertyNames?: CoreSchemaMetaSchema5;
|
422
|
-
const?:
|
433
|
+
const?: unknown;
|
423
434
|
/**
|
424
435
|
* @minItems 1
|
425
436
|
*/
|
426
|
-
enum?:
|
437
|
+
enum?: unknown[];
|
427
438
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string')[];
|
428
439
|
format?: string;
|
429
440
|
contentMediaType?: string;
|
package/lib/manifest/v1/v1.json
CHANGED
@@ -449,6 +449,15 @@
|
|
449
449
|
}
|
450
450
|
]
|
451
451
|
}
|
452
|
+
},
|
453
|
+
"ui:metadata": {
|
454
|
+
"properties": {
|
455
|
+
"autoReload": {
|
456
|
+
"type": "boolean",
|
457
|
+
"default": "false"
|
458
|
+
}
|
459
|
+
},
|
460
|
+
"required": ["autoReload"]
|
452
461
|
}
|
453
462
|
},
|
454
463
|
"required": ["name", "namespace", "displayName", "description", "version", "functions", "$schema", "mainFunction"],
|
@@ -275,6 +275,24 @@ describe('manifest/v1', () => {
|
|
275
275
|
}, 'v1');
|
276
276
|
}, SchemaValidationError_1.SchemaValidationError, 'failed validation: Value `{"collapsedByDefault":true,"quickOption":false,"inlineEditable":true}` in `#/functions/0/input/properties/users-contact/ui:metadata` does not match any given oneof schema');
|
277
277
|
});
|
278
|
+
it('should allow the autoReload field on the manifest', async () => {
|
279
|
+
const manifest = await fetchTestManifest('validComponent.json');
|
280
|
+
expect(validationService.validateManifest({
|
281
|
+
...manifest,
|
282
|
+
'ui:metadata': {
|
283
|
+
autoReload: false,
|
284
|
+
},
|
285
|
+
}, 'v1')).toEqual(true);
|
286
|
+
});
|
287
|
+
it('autoReload is required if ui:metadata is specified on the root of the manifest', async () => {
|
288
|
+
const manifest = await fetchTestManifest('validComponent.json');
|
289
|
+
expectToThrowErrorMatchingTypeAndMessage(() => {
|
290
|
+
validationService.validateManifest({
|
291
|
+
...manifest,
|
292
|
+
'ui:metadata': {},
|
293
|
+
}, 'v1');
|
294
|
+
}, SchemaValidationError_1.SchemaValidationError, 'failed validation: The required property `autoReload` is missing at `#/ui:metadata`');
|
295
|
+
});
|
278
296
|
it('should fail if ui:metadata property on object with type string has collapsedByDefault flag', async () => {
|
279
297
|
const manifest = await fetchTestManifest('validComponent.json');
|
280
298
|
expectToThrowErrorMatchingTypeAndMessage(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"v1.spec.js","sourceRoot":"","sources":["../../../src/manifest/v1/v1.spec.ts"],"names":[],"mappings":";;AAAA,0CAAuC;AACvC,+BAA+B;AAC/B,8EAA2E;AAC3E,uEAAoE;AAEpE,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IAC/C,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,cAAO,EAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE;QACnF,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AACD,wDAAwD;AACxD,SAAS,w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ACb,cAAc,EAAE,IAAI;gDACpB,WAAW,EAAE,KAAK;gDAClB,kBAAkB,EAAE,IAAI;6CACzB;yCACF;wCACD,WAAW,EAAE;4CACX,IAAI,EAAE,QAAQ;4CACd,aAAa,EAAE;gDACb,cAAc,EAAE,IAAI;gDACpB,WAAW,EAAE,KAAK;6CACnB;yCACF;wCACD,cAAc,EAAE;4CACd,IAAI,EAAE,QAAQ;4CACd,aAAa,EAAE;gDACb,cAAc,EAAE,IAAI;gDACpB,WAAW,EAAE,KAAK;6CACnB;yCACF;wCACD,KAAK,EAAE;4CACL,IAAI,EAAE,QAAQ;4CACd,aAAa,EAAE;gDACb,cAAc,EAAE,IAAI;gDACpB,WAAW,EAAE,KAAK;6CACnB;yCACF;qCACF;iCACF;6BACF;4BACD,QAAQ,EAAE,CAAC,eAAe,CAAC;yBAC5B;qBACF;iBACF;aACF,EACD,IAAI,CACL,CAAC;QACJ,CAAC,EACD,6CAAqB,EACrB,2NAA2N,CAC5N,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/dx-json-schema-lib",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.78.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"private": false,
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"@types/node": "20.12.12",
|
24
24
|
"dotenv": "16.0.3",
|
25
25
|
"jest": "29.4.1",
|
26
|
-
"json-schema-to-typescript": "
|
26
|
+
"json-schema-to-typescript": "14.1.0",
|
27
27
|
"rimraf": "5.0.7",
|
28
28
|
"ts-jest": "29.0.5",
|
29
29
|
"ts-loader": "9.3.1",
|
@@ -1060,6 +1060,178 @@ describe('JsonSchemaService', () => {
|
|
1060
1060
|
|
1061
1061
|
expect(jsonSchemaService.validateInput({ 'my-input': [] }, schema)).toEqual(true);
|
1062
1062
|
});
|
1063
|
+
|
1064
|
+
it.each([
|
1065
|
+
['with attributes', { title: 'Link title' }],
|
1066
|
+
['without attributes', undefined],
|
1067
|
+
])('should validate link-to-matrix-asset - %s', (_: string, attributes?: Record<string, string>) => {
|
1068
|
+
const formattedText: FormattedText = [
|
1069
|
+
{
|
1070
|
+
type: 'link-to-matrix-asset',
|
1071
|
+
matrixIdentifier: 'matrix-identifier',
|
1072
|
+
matrixDomain: 'https://matrix-api-url',
|
1073
|
+
target: '_blank',
|
1074
|
+
matrixAssetId: '12345',
|
1075
|
+
children: [{ type: 'text', value: 'hello' }],
|
1076
|
+
attributes,
|
1077
|
+
},
|
1078
|
+
];
|
1079
|
+
const schema = {
|
1080
|
+
type: 'object',
|
1081
|
+
properties: {
|
1082
|
+
myInput: {
|
1083
|
+
type: 'FormattedText',
|
1084
|
+
},
|
1085
|
+
},
|
1086
|
+
};
|
1087
|
+
const value = {
|
1088
|
+
myInput: formattedText,
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1092
|
+
});
|
1093
|
+
|
1094
|
+
it('should throw if link-to-matrix-asset contains a reserved attribute', () => {
|
1095
|
+
const formattedText: FormattedText = [
|
1096
|
+
{
|
1097
|
+
type: 'link-to-matrix-asset',
|
1098
|
+
matrixIdentifier: 'matrix-identifier',
|
1099
|
+
matrixDomain: 'https://matrix-api-url',
|
1100
|
+
target: '_blank',
|
1101
|
+
matrixAssetId: '12345',
|
1102
|
+
children: [{ type: 'text', value: 'hello' }],
|
1103
|
+
attributes: {
|
1104
|
+
// href is reserved (resolved from the selected Matrix asset)
|
1105
|
+
href: 'https://www.my-matrix.squiz.net',
|
1106
|
+
} as any,
|
1107
|
+
},
|
1108
|
+
];
|
1109
|
+
const schema = {
|
1110
|
+
type: 'object',
|
1111
|
+
properties: {
|
1112
|
+
myInput: {
|
1113
|
+
type: 'FormattedText',
|
1114
|
+
},
|
1115
|
+
},
|
1116
|
+
};
|
1117
|
+
const value = {
|
1118
|
+
myInput: formattedText,
|
1119
|
+
};
|
1120
|
+
|
1121
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1122
|
+
});
|
1123
|
+
|
1124
|
+
it.each([
|
1125
|
+
['with attributes', { title: 'Link title' }],
|
1126
|
+
['without attributes', undefined],
|
1127
|
+
])('should validate matrix-image - %s', (_: string, attributes?: Record<string, string>) => {
|
1128
|
+
const formattedText: FormattedText = [
|
1129
|
+
{
|
1130
|
+
type: 'matrix-image',
|
1131
|
+
matrixIdentifier: 'matrix-identifier',
|
1132
|
+
matrixDomain: 'https://matrix-api-url',
|
1133
|
+
matrixAssetId: '12345',
|
1134
|
+
attributes,
|
1135
|
+
},
|
1136
|
+
];
|
1137
|
+
const schema = {
|
1138
|
+
type: 'object',
|
1139
|
+
properties: {
|
1140
|
+
myInput: {
|
1141
|
+
type: 'FormattedText',
|
1142
|
+
},
|
1143
|
+
},
|
1144
|
+
};
|
1145
|
+
const value = {
|
1146
|
+
myInput: formattedText,
|
1147
|
+
};
|
1148
|
+
|
1149
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1150
|
+
});
|
1151
|
+
|
1152
|
+
it('should throw if matrix-image contains a reserved attribute', () => {
|
1153
|
+
const formattedText: FormattedText = [
|
1154
|
+
{
|
1155
|
+
type: 'matrix-image',
|
1156
|
+
matrixIdentifier: 'matrix-identifier',
|
1157
|
+
matrixDomain: 'https://matrix-api-url',
|
1158
|
+
matrixAssetId: '12345',
|
1159
|
+
attributes: {
|
1160
|
+
// src is reserved (resolved from the selected Matrix asset)
|
1161
|
+
src: 'https://www.my-matrix.squiz.net/image.png',
|
1162
|
+
} as any,
|
1163
|
+
},
|
1164
|
+
];
|
1165
|
+
const schema = {
|
1166
|
+
type: 'object',
|
1167
|
+
properties: {
|
1168
|
+
myInput: {
|
1169
|
+
type: 'FormattedText',
|
1170
|
+
},
|
1171
|
+
},
|
1172
|
+
};
|
1173
|
+
const value = {
|
1174
|
+
myInput: formattedText,
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1178
|
+
});
|
1179
|
+
|
1180
|
+
it.each([
|
1181
|
+
['with attributes', { title: 'Link title' }],
|
1182
|
+
['without attributes', undefined],
|
1183
|
+
])('should validate dam-image - %s', (_: string, attributes?: Record<string, string>) => {
|
1184
|
+
const formattedText: FormattedText = [
|
1185
|
+
{
|
1186
|
+
type: 'dam-image',
|
1187
|
+
damSystemIdentifier: 'dam-identifier',
|
1188
|
+
damObjectId: '12345',
|
1189
|
+
damSystemType: 'bynder',
|
1190
|
+
attributes,
|
1191
|
+
},
|
1192
|
+
];
|
1193
|
+
const schema = {
|
1194
|
+
type: 'object',
|
1195
|
+
properties: {
|
1196
|
+
myInput: {
|
1197
|
+
type: 'FormattedText',
|
1198
|
+
},
|
1199
|
+
},
|
1200
|
+
};
|
1201
|
+
const value = {
|
1202
|
+
myInput: formattedText,
|
1203
|
+
};
|
1204
|
+
|
1205
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1206
|
+
});
|
1207
|
+
|
1208
|
+
it('should throw if dam-image contains a reserved attribute', () => {
|
1209
|
+
const formattedText: FormattedText = [
|
1210
|
+
{
|
1211
|
+
type: 'dam-image',
|
1212
|
+
damSystemIdentifier: 'dam-identifier',
|
1213
|
+
damObjectId: '12345',
|
1214
|
+
damSystemType: 'bynder',
|
1215
|
+
attributes: {
|
1216
|
+
// src is reserved (resolved from the selected DAM asset)
|
1217
|
+
src: 'https://www.my-matrix.squiz.net/image.png',
|
1218
|
+
} as any,
|
1219
|
+
},
|
1220
|
+
];
|
1221
|
+
const schema = {
|
1222
|
+
type: 'object',
|
1223
|
+
properties: {
|
1224
|
+
myInput: {
|
1225
|
+
type: 'FormattedText',
|
1226
|
+
},
|
1227
|
+
},
|
1228
|
+
};
|
1229
|
+
const value = {
|
1230
|
+
myInput: formattedText,
|
1231
|
+
};
|
1232
|
+
|
1233
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1234
|
+
});
|
1063
1235
|
});
|
1064
1236
|
|
1065
1237
|
describe('standard inputs', () => {
|