@squiz/dx-json-schema-lib 1.21.1-alpha.1 → 1.21.1-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/.npm/_logs/2023-03-09T00_01_12_827Z-debug-0.log +39 -0
  2. package/lib/JsonValidationService.js +8 -0
  3. package/lib/JsonValidationService.js.map +1 -1
  4. package/lib/JsonValidationService.spec.js +44 -0
  5. package/lib/JsonValidationService.spec.js.map +1 -1
  6. package/lib/index.d.ts +1 -0
  7. package/lib/index.js +1 -0
  8. package/lib/index.js.map +1 -1
  9. package/lib/manifest/v1/DxContentMetaSchema.json +116 -1
  10. package/lib/manifest/v1/MatrixAssetSchema.json +370 -0
  11. package/lib/manifest/v1/__test__/schemas/inputStringWithFormat.json +29 -0
  12. package/lib/manifest/v1/subSchemas.d.ts +2 -1
  13. package/lib/manifest/v1/subSchemas.js +3 -1
  14. package/lib/manifest/v1/subSchemas.js.map +1 -1
  15. package/lib/manifest/v1/v1.d.ts +400 -2
  16. package/lib/manifest/v1/v1.json +48 -0
  17. package/lib/validators/customFormatValidators.d.ts +2 -0
  18. package/lib/validators/customFormatValidators.js +14 -0
  19. package/lib/validators/customFormatValidators.js.map +1 -0
  20. package/lib/validators/utils/matrixAssetValidator.d.ts +2 -0
  21. package/lib/validators/utils/matrixAssetValidator.js +11 -0
  22. package/lib/validators/utils/matrixAssetValidator.js.map +1 -0
  23. package/lib/validators/utils/matrixAssetValidator.spec.d.ts +1 -0
  24. package/lib/validators/utils/matrixAssetValidator.spec.js +43 -0
  25. package/lib/validators/utils/matrixAssetValidator.spec.js.map +1 -0
  26. package/package.json +2 -2
  27. package/src/JsonValidationService.spec.ts +62 -0
  28. package/src/JsonValidationService.ts +9 -1
  29. package/src/index.ts +2 -0
  30. package/src/manifest/v1/DxContentMetaSchema.json +116 -1
  31. package/src/manifest/v1/MatrixAssetSchema.json +371 -0
  32. package/src/manifest/v1/__test__/schemas/inputStringWithFormat.json +29 -0
  33. package/src/manifest/v1/subSchemas.ts +2 -1
  34. package/src/manifest/v1/v1.json +48 -0
  35. package/src/manifest/v1/v1.ts +640 -2
  36. package/src/validators/customFormatValidators.ts +15 -0
  37. package/src/validators/utils/matrixAssetValidator.spec.ts +49 -0
  38. package/src/validators/utils/matrixAssetValidator.ts +8 -0
  39. package/tsconfig.tsbuildinfo +1 -1
  40. package/.npm/_logs/2023-03-01T02_29_05_245Z-debug-0.log +0 -39
@@ -0,0 +1,370 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "MatrixAssetSchema.json",
4
+ "title": "Matrix asset schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "id": {
8
+ "type": "string",
9
+ "description": "The asset ID."
10
+ },
11
+ "type": {
12
+ "type": "string",
13
+ "description": "The asset type code."
14
+ },
15
+ "type_name": {
16
+ "type": "string",
17
+ "description": "The asset type friendly name."
18
+ },
19
+ "version": {
20
+ "type": "string",
21
+ "description": "The asset semantic version."
22
+ },
23
+ "name": {
24
+ "type": "string",
25
+ "description": "The asset standard field name."
26
+ },
27
+ "short_name": {
28
+ "type": "string",
29
+ "description": "The asset standard field short name."
30
+ },
31
+ "status": {
32
+ "type": "object",
33
+ "description": "A object representing the asset status of the asset resource.",
34
+ "additionalProperties": false,
35
+ "properties": {
36
+ "id": {
37
+ "type": "integer",
38
+ "format": "int32",
39
+ "description": "The bitwise id of the asset status",
40
+ "enum": [1, 2, 4, 8, 16, 32, 64, 128, 256]
41
+ },
42
+ "code": {
43
+ "type": "string",
44
+ "description": "The type code of the asset status",
45
+ "enum": [
46
+ "archived",
47
+ "under_construction",
48
+ "pending_approval",
49
+ "approved",
50
+ "live",
51
+ "live_approval",
52
+ "editing",
53
+ "editing_approval",
54
+ "editing_approved"
55
+ ]
56
+ },
57
+ "name": {
58
+ "type": "string",
59
+ "description": "The description of the asset status",
60
+ "enum": [
61
+ "Archived",
62
+ "Under Construction",
63
+ "Pending Approval",
64
+ "Approved To Go Live",
65
+ "Live",
66
+ "Up For Review",
67
+ "Safe Editing",
68
+ "Safe Editing Pending Approval",
69
+ "Safe Edit Approved To Go Live"
70
+ ]
71
+ }
72
+ },
73
+ "required": ["id", "code"]
74
+ },
75
+ "created": {
76
+ "type": "object",
77
+ "description": "A object representing when the asset status was created.",
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "date": {
81
+ "type": ["string", "null"],
82
+ "format": "date-time",
83
+ "description": "The creation date of the asset in ISO 8601 format."
84
+ },
85
+ "user_id": {
86
+ "type": ["string", "null"],
87
+ "description": "The asset ID of the User that created the asset."
88
+ }
89
+ },
90
+ "required": ["date", "user_id"]
91
+ },
92
+ "updated": {
93
+ "type": "object",
94
+ "description": "A object representing when the asset status was last updated.",
95
+ "additionalProperties": false,
96
+ "properties": {
97
+ "date": {
98
+ "type": ["string", "null"],
99
+ "format": "date-time",
100
+ "description": "The last updated date of the asset in ISO 8601 format."
101
+ },
102
+ "user_id": {
103
+ "type": ["string", "null"],
104
+ "description": "The asset ID of the User that last updated the asset."
105
+ }
106
+ },
107
+ "required": ["date", "user_id"]
108
+ },
109
+ "published": {
110
+ "type": "object",
111
+ "description": "A object representing when the asset status was last published.",
112
+ "additionalProperties": false,
113
+ "properties": {
114
+ "date": {
115
+ "type": ["string", "null"],
116
+ "format": "date-time",
117
+ "description": "The last published date of the asset in ISO 8601 format."
118
+ },
119
+ "user_id": {
120
+ "type": ["string", "null"],
121
+ "description": "The asset ID of the User that last published the asset."
122
+ }
123
+ },
124
+ "required": ["date", "user_id"]
125
+ },
126
+ "status_changed": {
127
+ "type": "object",
128
+ "description": "A object representing when the asset status was last changed.",
129
+ "additionalProperties": false,
130
+ "properties": {
131
+ "date": {
132
+ "type": ["string", "null"],
133
+ "format": "date-time",
134
+ "description": "The last date the state of the asset was changed in ISO 8601 format."
135
+ },
136
+ "user_id": {
137
+ "type": ["string", "null"],
138
+ "description": "The asset ID of the User that last changed the asset status."
139
+ }
140
+ },
141
+ "required": ["date", "user_id"]
142
+ },
143
+ "url": {
144
+ "type": "string",
145
+ "description": "The primary URL for the asset.",
146
+ "example": "http://mydomain.net/page"
147
+ },
148
+ "urls": {
149
+ "type": "array",
150
+ "items": {
151
+ "type": "string"
152
+ },
153
+ "description": "All URLs for the asset including the primary URL.",
154
+ "example": ["http://mydomain.net/page", "http://seconddomain.net/blog"]
155
+ },
156
+ "attributes": {
157
+ "type": "object",
158
+ "description": "List of attributes for the asset in key-value form."
159
+ },
160
+ "metadata": {
161
+ "type": "object",
162
+ "nullable": true,
163
+ "additionalProperties": {
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string"
167
+ }
168
+ },
169
+ "example": {
170
+ "foo": ["bar1", "bar2"],
171
+ "bar": ["foo"]
172
+ },
173
+ "description": "List of metadata values in key-value form."
174
+ },
175
+ "contents": {
176
+ "type": "string",
177
+ "description": "The contents for the asset (excluding file assets)."
178
+ },
179
+ "thumbnail": {
180
+ "type": "object",
181
+ "nullable": true,
182
+ "properties": {
183
+ "asset_id": {
184
+ "type": "string",
185
+ "description": "The asset ID of the Image asset of the file."
186
+ },
187
+ "url": {
188
+ "type": "string",
189
+ "description": "The accessible URL of the thumbnail image file."
190
+ },
191
+ "file_name": {
192
+ "type": "string",
193
+ "description": "The file name of the thumbnail image."
194
+ },
195
+ "width": {
196
+ "type": "integer",
197
+ "description": "The image file width in pixels."
198
+ },
199
+ "height": {
200
+ "type": "integer",
201
+ "description": "The image file height in pixels."
202
+ },
203
+ "file_type": {
204
+ "type": "string",
205
+ "description": "The file type of the image file, generally its extension."
206
+ },
207
+ "file_size": {
208
+ "type": "integer",
209
+ "description": "The file size in bytes"
210
+ },
211
+ "file_size_readable": {
212
+ "type": "integer",
213
+ "description": "The file size in human readable format"
214
+ },
215
+ "title": {
216
+ "type": "string",
217
+ "description": "The friendly name of the file asset"
218
+ },
219
+ "alt": {
220
+ "type": "string",
221
+ "description": "The alt attribute of the Image asset"
222
+ }
223
+ },
224
+ "description": "The thumbnail image associated with the asset, shows a subset data of an image or image variety.",
225
+ "example": {
226
+ "asset_id": "42",
227
+ "url": "http://mydomain.net/image.png",
228
+ "file_name": "image.png",
229
+ "width": 630,
230
+ "height": 630,
231
+ "file_type": "png",
232
+ "file_size": 40336,
233
+ "file_size_readable": "39.4 KB",
234
+ "title": "Company Logo",
235
+ "alt": "A company logo image"
236
+ }
237
+ },
238
+ "include_dependents": {
239
+ "type": "array",
240
+ "items": {
241
+ "$ref": "#"
242
+ },
243
+ "description": "All direct dependent child assets of the asset in normalized asset format."
244
+ },
245
+ "additional": {
246
+ "description": "Additional data of an arbitrary nature related to the requested asset, which may include derived information or special child asset information.",
247
+ "oneOf": [
248
+ {
249
+ "$ref": "#/definitions/AssetAdditional"
250
+ },
251
+ {
252
+ "$ref": "#/definitions/AssetFileAdditional"
253
+ },
254
+ {
255
+ "$ref": "#/definitions/AssetImageAdditional"
256
+ },
257
+ {
258
+ "$ref": "#/definitions/AssetCalendarEventAdditional"
259
+ }
260
+ ]
261
+ }
262
+ },
263
+ "required": [
264
+ "id",
265
+ "type",
266
+ "type_name",
267
+ "version",
268
+ "name",
269
+ "short_name",
270
+ "status",
271
+ "created",
272
+ "updated",
273
+ "published",
274
+ "url",
275
+ "urls",
276
+ "attributes"
277
+ ],
278
+ "definitions": {
279
+ "AssetAdditional": {
280
+ "title": "Asset additional info",
281
+ "type": "object",
282
+ "properties": {}
283
+ },
284
+ "AssetFileAdditional": {
285
+ "title": "File additional info",
286
+ "type": "object",
287
+ "properties": {
288
+ "file_info": {
289
+ "type": "object",
290
+ "properties": {
291
+ "file_name": {
292
+ "type": "string"
293
+ },
294
+ "size_readable": {
295
+ "type": "string"
296
+ },
297
+ "size_bytes": {
298
+ "type": "integer"
299
+ },
300
+ "width": {
301
+ "type": "integer",
302
+ "nullable": true
303
+ },
304
+ "height": {
305
+ "type": "integer",
306
+ "nullable": true
307
+ },
308
+ "modified_readable": {
309
+ "type": "string"
310
+ },
311
+ "modified_unix": {
312
+ "type": "integer"
313
+ }
314
+ }
315
+ }
316
+ },
317
+ "example": {
318
+ "file_info": {
319
+ "file_name": "logo.png",
320
+ "size_readable": "6.2 MB",
321
+ "size_bytes": 6553070,
322
+ "width": 1200,
323
+ "height": 600,
324
+ "modified_readable": "Feb 3, 2023 12:26 PM",
325
+ "modified_unix": 1675387561
326
+ }
327
+ }
328
+ },
329
+ "AssetImageAdditional": {
330
+ "title": "Image additional info",
331
+ "properties": {
332
+ "varieties": {
333
+ "type": "array",
334
+ "items": {
335
+ "$ref": "#"
336
+ }
337
+ }
338
+ },
339
+ "allOf": [
340
+ {
341
+ "$ref": "#/definitions/AssetFileAdditional"
342
+ }
343
+ ]
344
+ },
345
+ "AssetCalendarEventAdditional": {
346
+ "title": "Calendar Event additional info",
347
+ "type": "object",
348
+ "properties": {
349
+ "event_info": {
350
+ "type": "object",
351
+ "properties": {
352
+ "duration": {
353
+ "type": "integer"
354
+ },
355
+ "frequency": {
356
+ "type": "string",
357
+ "nullable": true
358
+ }
359
+ }
360
+ }
361
+ },
362
+ "example": {
363
+ "event_info": {
364
+ "duration": 1800,
365
+ "frequency": "FREQ=DAILY;INTERVAL=1"
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "../../v1.json",
3
+ "description": "t",
4
+ "displayName": "t",
5
+ "name": "test",
6
+ "namespace": "other",
7
+ "mainFunction": "main",
8
+ "version": "1.0.4",
9
+ "environment": [],
10
+ "functions": [
11
+ {
12
+ "entry": "main.js",
13
+ "name": "main",
14
+ "output": {
15
+ "responseType": "html"
16
+ },
17
+ "input": {
18
+ "type": "object",
19
+ "properties": {
20
+ "prop": {
21
+ "type": "string",
22
+ "format": "matrix-asset-uri"
23
+ }
24
+ },
25
+ "required": []
26
+ }
27
+ }
28
+ ]
29
+ }
@@ -1,4 +1,5 @@
1
1
  import DxComponentIcons from './DxComponentIcons.json';
2
2
  import DxComponentInputSchema from './DxComponentInputSchema.json';
3
3
  import DxContentMetaSchema from './DxContentMetaSchema.json';
4
- export { DxComponentIcons, DxComponentInputSchema, DxContentMetaSchema };
4
+ import MatrixAssetSchema from './MatrixAssetSchema.json';
5
+ export { DxComponentIcons, DxComponentInputSchema, DxContentMetaSchema, MatrixAssetSchema };
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DxContentMetaSchema = exports.DxComponentInputSchema = exports.DxComponentIcons = void 0;
6
+ exports.MatrixAssetSchema = exports.DxContentMetaSchema = exports.DxComponentInputSchema = exports.DxComponentIcons = void 0;
7
7
  const DxComponentIcons_json_1 = __importDefault(require("./DxComponentIcons.json"));
8
8
  exports.DxComponentIcons = DxComponentIcons_json_1.default;
9
9
  const DxComponentInputSchema_json_1 = __importDefault(require("./DxComponentInputSchema.json"));
10
10
  exports.DxComponentInputSchema = DxComponentInputSchema_json_1.default;
11
11
  const DxContentMetaSchema_json_1 = __importDefault(require("./DxContentMetaSchema.json"));
12
12
  exports.DxContentMetaSchema = DxContentMetaSchema_json_1.default;
13
+ const MatrixAssetSchema_json_1 = __importDefault(require("./MatrixAssetSchema.json"));
14
+ exports.MatrixAssetSchema = MatrixAssetSchema_json_1.default;
13
15
  //# sourceMappingURL=subSchemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subSchemas.js","sourceRoot":"","sources":["../../../src/manifest/v1/subSchemas.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAuD;AAI9C,2BAJF,+BAAgB,CAIE;AAHzB,gGAAmE;AAGxC,iCAHpB,qCAAsB,CAGoB;AAFjD,0FAA6D;AAEV,8BAF5C,kCAAmB,CAE4C"}
1
+ {"version":3,"file":"subSchemas.js","sourceRoot":"","sources":["../../../src/manifest/v1/subSchemas.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAuD;AAK9C,2BALF,+BAAgB,CAKE;AAJzB,gGAAmE;AAIxC,iCAJpB,qCAAsB,CAIoB;AAHjD,0FAA6D;AAGV,8BAH5C,kCAAmB,CAG4C;AAFtE,sFAAyD;AAEe,4BAFjE,gCAAiB,CAEiE"}