@toolproof-npm/schema 0.1.44 → 0.1.45

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 (28) hide show
  1. package/dist/_lib/test.js +38 -31
  2. package/dist/genesis/generated/resources/Genesis.json +742 -452
  3. package/dist/genesis/generated/schemas/Genesis.json +441 -166
  4. package/dist/genesis/generated/schemas/Job.json +26 -26
  5. package/dist/genesis/generated/schemas/ResourceFormat.json +9 -9
  6. package/dist/genesis/generated/schemas/ResourceType.json +317 -42
  7. package/dist/genesis/generated/schemas/StatefulStrategy.json +76 -76
  8. package/dist/genesis/generated/schemas/StatelessStrategy.json +40 -40
  9. package/dist/{_lib → genesis/generated}/types/Resource_Job.d.ts +16 -16
  10. package/dist/{_lib → genesis/generated}/types/Resource_ResourceFormat.d.ts +10 -10
  11. package/dist/{_lib → genesis/generated}/types/Resource_ResourceType.d.ts +15 -15
  12. package/dist/{_lib → genesis/generated}/types/Resource_StatelessStrategy.d.ts +16 -16
  13. package/dist/{_lib → genesis/generated}/types/types.d.ts +289 -261
  14. package/dist/genesis/resourceTypes/Genesis.json +530 -250
  15. package/dist/index.d.ts +6 -6
  16. package/dist/index.js +2 -2
  17. package/dist/scripts/_lib/config.js +2 -2
  18. package/dist/scripts/brandFactories.d.ts +37 -23
  19. package/dist/scripts/brandFactories.js +26 -29
  20. package/dist/scripts/extractSchemas.js +1 -1
  21. package/dist/scripts/generateResourceEnvelopes.js +6 -6
  22. package/dist/scripts/generateTypes.js +38 -26
  23. package/package.json +1 -1
  24. /package/dist/{_lib → genesis/generated}/types/Resource_Job.js +0 -0
  25. /package/dist/{_lib → genesis/generated}/types/Resource_ResourceFormat.js +0 -0
  26. /package/dist/{_lib → genesis/generated}/types/Resource_ResourceType.js +0 -0
  27. /package/dist/{_lib → genesis/generated}/types/Resource_StatelessStrategy.js +0 -0
  28. /package/dist/{_lib → genesis/generated}/types/types.js +0 -0
@@ -5,31 +5,31 @@
5
5
  {
6
6
  "properties": {
7
7
  "identity": {
8
- "$ref": "#/$defs/ResourceTypeId"
8
+ "$ref": "#/$defs/ResourceTypeIdentity"
9
9
  },
10
- "resourceFormatId": {
11
- "$ref": "#/$defs/ResourceFormatId"
10
+ "resourceFormatRef": {
11
+ "$ref": "#/$defs/ResourceFormatIdentity"
12
12
  }
13
13
  },
14
14
  "required": [
15
15
  "identity",
16
- "resourceFormatId"
16
+ "resourceFormatRef"
17
17
  ]
18
18
  },
19
19
  {
20
20
  "$ref": "#/$defs/Documented"
21
21
  },
22
22
  {
23
- "$ref": "#/$defs/ExtractionSchema"
23
+ "$ref": "#/$defs/ExtractionSchemaWrapper"
24
24
  },
25
25
  {
26
26
  "if": {
27
27
  "properties": {
28
- "resourceFormatId": {
28
+ "resourceFormatRef": {
29
29
  "const": "FORMAT-ApplicationJson"
30
30
  }
31
31
  },
32
- "$comment": "If resourceFormatId is FORMAT-ApplicationJson, then extractor must not be present, but if resourceFormatId is not FORMAT-ApplicationJson, then extractor must be present. This is because resources of types with format FORMAT-ApplicationJson are self-contained and do not need an extractor."
32
+ "$comment": "If resourceFormatRef is FORMAT-ApplicationJson, then extractor must not be present, but if resourceFormatRef is not FORMAT-ApplicationJson, then extractor must be present. This is because resources of types with format FORMAT-ApplicationJson are self-contained and do not need an extractor."
33
33
  },
34
34
  "then": {
35
35
  "not": {
@@ -54,16 +54,16 @@
54
54
  ],
55
55
  "$anchor": "ResourceType",
56
56
  "$defs": {
57
- "ResourceTypeId": {
57
+ "ResourceTypeIdentity": {
58
58
  "$schema": "https://json-schema.org/draft/2020-12/schema",
59
59
  "type": "string",
60
- "$anchor": "ResourceTypeId",
60
+ "$anchor": "ResourceTypeIdentity",
61
61
  "pattern": "^TYPE-.+$"
62
62
  },
63
- "ResourceFormatId": {
63
+ "ResourceFormatIdentity": {
64
64
  "$schema": "https://json-schema.org/draft/2020-12/schema",
65
65
  "type": "string",
66
- "$anchor": "ResourceFormatId",
66
+ "$anchor": "ResourceFormatIdentity",
67
67
  "pattern": "^FORMAT-.+$"
68
68
  },
69
69
  "Documented": {
@@ -71,28 +71,28 @@
71
71
  "type": "object",
72
72
  "allOf": [
73
73
  {
74
- "$ref": "#/$defs/Name"
74
+ "$ref": "#/$defs/Named"
75
75
  },
76
76
  {
77
- "$ref": "#/$defs/Description"
77
+ "$ref": "#/$defs/Described"
78
78
  }
79
79
  ],
80
80
  "$anchor": "Documented"
81
81
  },
82
- "ExtractionSchema": {
82
+ "ExtractionSchemaWrapper": {
83
83
  "$schema": "https://json-schema.org/draft/2020-12/schema",
84
84
  "type": "object",
85
85
  "properties": {
86
86
  "extractionSchema": {
87
- "$ref": "#/$defs/ExtractionSchemaValue"
87
+ "$ref": "#/$defs/ExtractionSchema"
88
88
  }
89
89
  },
90
90
  "required": [
91
91
  "extractionSchema"
92
92
  ],
93
- "$anchor": "ExtractionSchema"
93
+ "$anchor": "ExtractionSchemaWrapper"
94
94
  },
95
- "Name": {
95
+ "Named": {
96
96
  "$schema": "https://json-schema.org/draft/2020-12/schema",
97
97
  "type": "object",
98
98
  "properties": {
@@ -107,9 +107,9 @@
107
107
  "required": [
108
108
  "name"
109
109
  ],
110
- "$anchor": "Name"
110
+ "$anchor": "Named"
111
111
  },
112
- "Description": {
112
+ "Described": {
113
113
  "$schema": "https://json-schema.org/draft/2020-12/schema",
114
114
  "type": "object",
115
115
  "properties": {
@@ -123,9 +123,9 @@
123
123
  "required": [
124
124
  "description"
125
125
  ],
126
- "$anchor": "Description"
126
+ "$anchor": "Described"
127
127
  },
128
- "ExtractionSchemaValue": {
128
+ "ExtractionSchema": {
129
129
  "$schema": "https://json-schema.org/draft/2020-12/schema",
130
130
  "type": "object",
131
131
  "allOf": [
@@ -160,14 +160,28 @@
160
160
  },
161
161
  {
162
162
  "if": {
163
- "properties": {
164
- "properties": {
165
- "type": "object",
163
+ "anyOf": [
164
+ {
165
+ "properties": {
166
+ "properties": {
167
+ "type": "object",
168
+ "properties": {
169
+ "merit": {}
170
+ }
171
+ }
172
+ }
173
+ },
174
+ {
166
175
  "properties": {
167
- "merit": {}
176
+ "required": {
177
+ "type": "array",
178
+ "contains": {
179
+ "const": "merit"
180
+ }
181
+ }
168
182
  }
169
183
  }
170
- }
184
+ ]
171
185
  },
172
186
  "then": {
173
187
  "$ref": "#/$defs/MeritProp"
@@ -232,7 +246,7 @@
232
246
  "type"
233
247
  ],
234
248
  "unevaluatedProperties": false,
235
- "$anchor": "ExtractionSchemaValue"
249
+ "$anchor": "ExtractionSchema"
236
250
  },
237
251
  "IdentityProp": {
238
252
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -241,22 +255,22 @@
241
255
  "$defs": {
242
256
  "type": "object",
243
257
  "additionalProperties": true,
244
- "$comment": "Ajv-specific: patternRequired enforces at least one Id-like key in this $defs block when identity is present.",
258
+ "$comment": "Ajv-specific: patternRequired enforces at least one Identity-like key in this $defs block when identity is present.",
245
259
  "minProperties": 1,
246
260
  "patternProperties": {
247
- "^[A-Za-z][A-Za-z0-9._-]*Id$": {
248
- "$ref": "#/$defs/IdSchemaValue"
261
+ "^[A-Za-z][A-Za-z0-9._-]*Identity$": {
262
+ "$ref": "#/$defs/IdentitySchema"
249
263
  }
250
264
  },
251
265
  "patternRequired": [
252
- "^[A-Za-z][A-Za-z0-9._-]*Id$"
266
+ "^[A-Za-z][A-Za-z0-9._-]*Identity$"
253
267
  ]
254
268
  },
255
269
  "properties": {
256
270
  "type": "object",
257
271
  "properties": {
258
272
  "identity": {
259
- "$ref": "#/$defs/IdentityValue"
273
+ "$ref": "#/$defs/IdentitySchemaRef"
260
274
  }
261
275
  },
262
276
  "required": [
@@ -285,21 +299,154 @@
285
299
  "$schema": "https://json-schema.org/draft/2020-12/schema",
286
300
  "type": "object",
287
301
  "properties": {
302
+ "$defs": {
303
+ "type": "object",
304
+ "additionalProperties": true,
305
+ "$comment": "Ajv-specific: patternRequired enforces at least one Merit-like key in this $defs block when merit is present.",
306
+ "minProperties": 1,
307
+ "patternProperties": {
308
+ "^[A-Za-z][A-Za-z0-9._-]*Merit$": {
309
+ "$ref": "#/$defs/MeritSchema"
310
+ }
311
+ },
312
+ "patternRequired": [
313
+ "^[A-Za-z][A-Za-z0-9._-]*Merit$"
314
+ ]
315
+ },
288
316
  "properties": {
289
317
  "type": "object",
290
318
  "properties": {
291
319
  "merit": {
292
- "$ref": "#/$defs/MeritValue"
320
+ "$ref": "#/$defs/MeritSchemaRef"
293
321
  }
294
- }
322
+ },
323
+ "required": [
324
+ "merit"
325
+ ]
326
+ },
327
+ "required": {
328
+ "type": "array",
329
+ "items": {
330
+ "type": "string"
331
+ },
332
+ "uniqueItems": true
295
333
  }
296
334
  },
335
+ "required": [
336
+ "$defs",
337
+ "required",
338
+ "properties"
339
+ ],
340
+ "additionalProperties": false,
297
341
  "$anchor": "MeritProp"
298
342
  },
299
- "IdSchemaValue": {
343
+ "IdentitySchema": {
300
344
  "$schema": "https://json-schema.org/draft/2020-12/schema",
301
345
  "type": "object",
346
+ "allOf": [
347
+ {
348
+ "if": {
349
+ "properties": {
350
+ "type": {
351
+ "const": "string"
352
+ }
353
+ }
354
+ },
355
+ "then": {
356
+ "properties": {
357
+ "enum": {
358
+ "items": {
359
+ "type": "string"
360
+ }
361
+ }
362
+ }
363
+ },
364
+ "else": {
365
+ "not": {
366
+ "anyOf": [
367
+ {
368
+ "required": [
369
+ "pattern"
370
+ ]
371
+ },
372
+ {
373
+ "required": [
374
+ "format"
375
+ ]
376
+ },
377
+ {
378
+ "required": [
379
+ "minLength"
380
+ ]
381
+ },
382
+ {
383
+ "required": [
384
+ "maxLength"
385
+ ]
386
+ }
387
+ ]
388
+ }
389
+ }
390
+ },
391
+ {
392
+ "if": {
393
+ "properties": {
394
+ "type": {
395
+ "const": "number"
396
+ }
397
+ }
398
+ },
399
+ "then": {
400
+ "properties": {
401
+ "enum": {
402
+ "items": {
403
+ "type": "number"
404
+ }
405
+ }
406
+ }
407
+ }
408
+ },
409
+ {
410
+ "if": {
411
+ "properties": {
412
+ "type": {
413
+ "const": "integer"
414
+ }
415
+ }
416
+ },
417
+ "then": {
418
+ "properties": {
419
+ "enum": {
420
+ "items": {
421
+ "type": "integer"
422
+ }
423
+ }
424
+ }
425
+ }
426
+ },
427
+ {
428
+ "if": {
429
+ "properties": {
430
+ "type": {
431
+ "const": "boolean"
432
+ }
433
+ }
434
+ },
435
+ "then": {
436
+ "properties": {
437
+ "enum": {
438
+ "items": {
439
+ "type": "boolean"
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ ],
302
446
  "properties": {
447
+ "$schema": {
448
+ "const": "https://json-schema.org/draft/2020-12/schema"
449
+ },
303
450
  "type": {
304
451
  "enum": [
305
452
  "string",
@@ -307,32 +454,101 @@
307
454
  "integer",
308
455
  "boolean"
309
456
  ]
457
+ },
458
+ "$anchor": {
459
+ "type": "string",
460
+ "pattern": "^[A-Za-z][A-Za-z0-9._-]*Identity$"
461
+ },
462
+ "$comment": {
463
+ "type": "string"
464
+ },
465
+ "enum": {
466
+ "type": "array",
467
+ "minItems": 1,
468
+ "uniqueItems": true
469
+ },
470
+ "format": {
471
+ "type": "string"
472
+ },
473
+ "maxLength": {
474
+ "type": "integer",
475
+ "minimum": 0
476
+ },
477
+ "minLength": {
478
+ "type": "integer",
479
+ "minimum": 0
480
+ },
481
+ "pattern": {
482
+ "type": "string"
310
483
  }
311
484
  },
312
485
  "required": [
313
486
  "type"
314
487
  ],
315
- "$anchor": "IdSchemaValue"
488
+ "additionalProperties": false,
489
+ "$anchor": "IdentitySchema"
316
490
  },
317
- "IdentityValue": {
491
+ "IdentitySchemaRef": {
318
492
  "$schema": "https://json-schema.org/draft/2020-12/schema",
319
493
  "type": "object",
320
494
  "properties": {
321
495
  "$ref": {
322
496
  "type": "string",
323
- "$comment": "Supports both anchor syntax (#<Name>Id) and JSON Pointer syntax (#/path/to/definition). Anchors use #<Name>Id for identity refs. Top-level and nested $defs should expose an $anchor matching <Name>Id.",
324
- "pattern": "^#([A-Za-z][A-Za-z0-9._-]*Id|/.*)$"
497
+ "$comment": "Supports both anchor syntax (#<Name>Identity) and JSON Pointer syntax (#/path/to/definition). Anchors use #<Name>Identity for identity refs. Top-level and nested $defs should expose an $anchor matching <Name>Identity.",
498
+ "pattern": "^#([A-Za-z][A-Za-z0-9._-]*Identity|/.*)$"
325
499
  }
326
500
  },
327
501
  "required": [
328
502
  "$ref"
329
503
  ],
330
504
  "additionalProperties": false,
331
- "$anchor": "IdentityValue"
505
+ "$anchor": "IdentitySchemaRef"
332
506
  },
333
- "MeritValue": {
507
+ "MeritSchema": {
334
508
  "$schema": "https://json-schema.org/draft/2020-12/schema",
335
509
  "type": "object",
510
+ "allOf": [
511
+ {
512
+ "if": {
513
+ "required": [
514
+ "type"
515
+ ]
516
+ },
517
+ "then": {},
518
+ "else": {
519
+ "not": {
520
+ "anyOf": [
521
+ {
522
+ "required": [
523
+ "minimum"
524
+ ]
525
+ },
526
+ {
527
+ "required": [
528
+ "maximum"
529
+ ]
530
+ },
531
+ {
532
+ "required": [
533
+ "exclusiveMinimum"
534
+ ]
535
+ },
536
+ {
537
+ "required": [
538
+ "exclusiveMaximum"
539
+ ]
540
+ },
541
+ {
542
+ "required": [
543
+ "multipleOf"
544
+ ]
545
+ }
546
+ ]
547
+ }
548
+ },
549
+ "$comment": "Numeric constraints (minimum/maximum/etc) only make sense when using the explicit type form; the enum-only form is allowed for simple enumerations."
550
+ }
551
+ ],
336
552
  "oneOf": [
337
553
  {
338
554
  "properties": {
@@ -362,7 +578,66 @@
362
578
  ]
363
579
  }
364
580
  ],
365
- "$anchor": "MeritValue"
581
+ "properties": {
582
+ "$schema": {
583
+ "const": "https://json-schema.org/draft/2020-12/schema"
584
+ },
585
+ "type": {
586
+ "enum": [
587
+ "number",
588
+ "integer"
589
+ ]
590
+ },
591
+ "$anchor": {
592
+ "type": "string",
593
+ "pattern": "^[A-Za-z][A-Za-z0-9._-]*Merit$"
594
+ },
595
+ "$comment": {
596
+ "type": "string"
597
+ },
598
+ "enum": {
599
+ "type": "array",
600
+ "items": {
601
+ "type": "number"
602
+ },
603
+ "minItems": 1,
604
+ "uniqueItems": true
605
+ },
606
+ "exclusiveMaximum": {
607
+ "type": "number"
608
+ },
609
+ "exclusiveMinimum": {
610
+ "type": "number"
611
+ },
612
+ "maximum": {
613
+ "type": "number"
614
+ },
615
+ "minimum": {
616
+ "type": "number"
617
+ },
618
+ "multipleOf": {
619
+ "type": "number",
620
+ "exclusiveMinimum": 0
621
+ }
622
+ },
623
+ "additionalProperties": false,
624
+ "$anchor": "MeritSchema"
625
+ },
626
+ "MeritSchemaRef": {
627
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
628
+ "type": "object",
629
+ "properties": {
630
+ "$ref": {
631
+ "type": "string",
632
+ "$comment": "Supports both anchor syntax (#<Name>Merit) and JSON Pointer syntax (#/path/to/definition). Anchors use #<Name>Merit for merit refs. Top-level and nested $defs should expose an $anchor matching <Name>Merit.",
633
+ "pattern": "^#([A-Za-z][A-Za-z0-9._-]*Merit|/.*)$"
634
+ }
635
+ },
636
+ "required": [
637
+ "$ref"
638
+ ],
639
+ "additionalProperties": false,
640
+ "$anchor": "MeritSchemaRef"
366
641
  }
367
642
  }
368
643
  }