@squiz/dx-json-schema-lib 1.21.1-alpha.4 → 1.21.1-alpha.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/.npm/_logs/2023-03-27T02_22_05_371Z-debug-0.log +37 -0
  2. package/lib/JsonValidationService.d.ts +1 -1
  3. package/lib/JsonValidationService.js +18 -5
  4. package/lib/JsonValidationService.js.map +1 -1
  5. package/lib/JsonValidationService.spec.js +444 -445
  6. package/lib/JsonValidationService.spec.js.map +1 -1
  7. package/lib/index.d.ts +6 -1
  8. package/lib/index.js +6 -1
  9. package/lib/index.js.map +1 -1
  10. package/lib/jsonTypeResolution/{arbitraryTypeResolution.d.ts → TypeResolver.d.ts} +7 -12
  11. package/lib/jsonTypeResolution/{arbitraryTypeResolution.js → TypeResolver.js} +17 -17
  12. package/lib/jsonTypeResolution/TypeResolver.js.map +1 -0
  13. package/lib/jsonTypeResolution/{arbitraryTypeResolution.spec.js → TypeResolver.spec.js} +12 -39
  14. package/lib/jsonTypeResolution/TypeResolver.spec.js.map +1 -0
  15. package/lib/jsonTypeResolution/TypeResolverBuilder.d.ts +12 -0
  16. package/lib/jsonTypeResolution/TypeResolverBuilder.js +32 -0
  17. package/lib/jsonTypeResolution/TypeResolverBuilder.js.map +1 -0
  18. package/lib/manifest/v1/DxContentMetaSchema.json +1 -1
  19. package/lib/manifest/v1/MatrixAssetSchema.json +390 -0
  20. package/lib/manifest/v1/subSchemas.d.ts +2 -1
  21. package/lib/manifest/v1/subSchemas.js +3 -1
  22. package/lib/manifest/v1/subSchemas.js.map +1 -1
  23. package/lib/manifest/v1/v1.d.ts +401 -2
  24. package/lib/manifest/v1/v1.json +48 -0
  25. package/lib/primitiveTypes/FormattedText.d.ts +8 -0
  26. package/lib/primitiveTypes/FormattedText.js +21 -0
  27. package/lib/primitiveTypes/FormattedText.js.map +1 -0
  28. package/lib/primitiveTypes/SquizImage.d.ts +26 -0
  29. package/lib/primitiveTypes/SquizImage.js +105 -0
  30. package/lib/primitiveTypes/SquizImage.js.map +1 -0
  31. package/lib/primitiveTypes/index.d.ts +2 -0
  32. package/lib/primitiveTypes/index.js +19 -0
  33. package/lib/primitiveTypes/index.js.map +1 -0
  34. package/lib/resolvableTypes/MatrixAsset.d.ts +9 -0
  35. package/lib/resolvableTypes/MatrixAsset.js +21 -0
  36. package/lib/resolvableTypes/MatrixAsset.js.map +1 -0
  37. package/lib/resolvableTypes/index.d.ts +1 -0
  38. package/lib/resolvableTypes/index.js +18 -0
  39. package/lib/resolvableTypes/index.js.map +1 -0
  40. package/package.json +5 -4
  41. package/src/JsonValidationService.spec.ts +585 -584
  42. package/src/JsonValidationService.ts +23 -9
  43. package/src/index.ts +8 -1
  44. package/src/jsonTypeResolution/{arbitraryTypeResolution.spec.ts → TypeResolver.spec.ts} +23 -70
  45. package/src/jsonTypeResolution/{arbitraryTypeResolution.ts → TypeResolver.ts} +27 -23
  46. package/src/jsonTypeResolution/TypeResolverBuilder.ts +43 -0
  47. package/src/manifest/v1/DxContentMetaSchema.json +1 -1
  48. package/src/manifest/v1/MatrixAssetSchema.json +391 -0
  49. package/src/manifest/v1/subSchemas.ts +2 -1
  50. package/src/manifest/v1/v1.json +48 -0
  51. package/src/manifest/v1/v1.ts +451 -4
  52. package/src/primitiveTypes/FormattedText.ts +24 -0
  53. package/src/primitiveTypes/SquizImage.ts +128 -0
  54. package/src/primitiveTypes/index.ts +2 -0
  55. package/src/resolvableTypes/MatrixAsset.ts +24 -0
  56. package/src/resolvableTypes/index.ts +1 -0
  57. package/tsconfig.tsbuildinfo +1 -1
  58. package/.npm/_logs/2023-03-06T05_16_32_570Z-debug-0.log +0 -39
  59. package/lib/jsonTypeResolution/arbitraryTypeResolution.js.map +0 -1
  60. package/lib/jsonTypeResolution/arbitraryTypeResolution.spec.js.map +0 -1
  61. package/lib/jsonTypeResolution/index.d.ts +0 -76
  62. package/lib/jsonTypeResolution/index.js +0 -35
  63. package/lib/jsonTypeResolution/index.js.map +0 -1
  64. package/lib/jsonTypeResolution/primitiveTypes.d.ts +0 -10
  65. package/lib/jsonTypeResolution/primitiveTypes.js +0 -27
  66. package/lib/jsonTypeResolution/primitiveTypes.js.map +0 -1
  67. package/lib/jsonTypeResolution/resolvableTypes.d.ts +0 -12
  68. package/lib/jsonTypeResolution/resolvableTypes.js +0 -30
  69. package/lib/jsonTypeResolution/resolvableTypes.js.map +0 -1
  70. package/src/jsonTypeResolution/index.ts +0 -16
  71. package/src/jsonTypeResolution/primitiveTypes.ts +0 -32
  72. package/src/jsonTypeResolution/resolvableTypes.ts +0 -37
  73. /package/lib/jsonTypeResolution/{arbitraryTypeResolution.spec.d.ts → TypeResolver.spec.d.ts} +0 -0
@@ -0,0 +1,390 @@
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
+ "anyOf": [
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
+ "if": {
264
+ "properties": {
265
+ "type": {
266
+ "const": "image"
267
+ }
268
+ }
269
+ },
270
+ "then": {
271
+ "properties": {
272
+ "additional": {
273
+ "allOf": [
274
+ {
275
+ "$ref": "#/definitions/AssetFileAdditional"
276
+ },
277
+ {
278
+ "$ref": "#/definitions/AssetImageAdditional"
279
+ }
280
+ ]
281
+ }
282
+ }
283
+ },
284
+ "required": [
285
+ "id",
286
+ "type",
287
+ "type_name",
288
+ "version",
289
+ "name",
290
+ "short_name",
291
+ "status",
292
+ "created",
293
+ "updated",
294
+ "published",
295
+ "url",
296
+ "urls",
297
+ "attributes",
298
+ "additional"
299
+ ],
300
+ "definitions": {
301
+ "AssetAdditional": {
302
+ "title": "Asset additional info",
303
+ "type": "object",
304
+ "properties": {}
305
+ },
306
+ "AssetFileAdditional": {
307
+ "title": "File additional info",
308
+ "type": "object",
309
+ "properties": {
310
+ "file_info": {
311
+ "type": "object",
312
+ "properties": {
313
+ "file_name": {
314
+ "type": "string"
315
+ },
316
+ "size_readable": {
317
+ "type": "string"
318
+ },
319
+ "size_bytes": {
320
+ "type": "integer"
321
+ },
322
+ "width": {
323
+ "type": "integer",
324
+ "nullable": true
325
+ },
326
+ "height": {
327
+ "type": "integer",
328
+ "nullable": true
329
+ },
330
+ "modified_readable": {
331
+ "type": "string"
332
+ },
333
+ "modified_unix": {
334
+ "type": "integer"
335
+ }
336
+ }
337
+ }
338
+ },
339
+ "example": {
340
+ "file_info": {
341
+ "file_name": "logo.png",
342
+ "size_readable": "6.2 MB",
343
+ "size_bytes": 6553070,
344
+ "width": 1200,
345
+ "height": 600,
346
+ "modified_readable": "Feb 3, 2023 12:26 PM",
347
+ "modified_unix": 1675387561
348
+ }
349
+ },
350
+ "required": ["file_info"]
351
+ },
352
+ "AssetImageAdditional": {
353
+ "title": "Image additional info",
354
+ "properties": {
355
+ "varieties": {
356
+ "type": "array",
357
+ "items": {
358
+ "$ref": "#"
359
+ }
360
+ }
361
+ },
362
+ "required": ["varieties"]
363
+ },
364
+ "AssetCalendarEventAdditional": {
365
+ "title": "Calendar Event additional info",
366
+ "type": "object",
367
+ "properties": {
368
+ "event_info": {
369
+ "type": "object",
370
+ "properties": {
371
+ "duration": {
372
+ "type": "integer"
373
+ },
374
+ "frequency": {
375
+ "type": "string",
376
+ "nullable": true
377
+ }
378
+ }
379
+ }
380
+ },
381
+ "required": ["event_info"],
382
+ "example": {
383
+ "event_info": {
384
+ "duration": 1800,
385
+ "frequency": "FREQ=DAILY;INTERVAL=1"
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
@@ -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"}