@toolproof-npm/schema 0.1.34 → 0.1.35

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 (53) hide show
  1. package/dist/_lib/test.js +12 -12
  2. package/dist/_lib/types/Resource_Job.d.ts +55 -0
  3. package/dist/_lib/types/Resource_ResourceFormat.d.ts +40 -0
  4. package/dist/_lib/types/Resource_ResourceFormat.js +1 -0
  5. package/dist/_lib/types/Resource_ResourceType.d.ts +60 -0
  6. package/dist/_lib/types/Resource_ResourceType.js +1 -0
  7. package/dist/_lib/types/Resource_StatelessStrategy.d.ts +79 -0
  8. package/dist/_lib/types/Resource_StatelessStrategy.js +1 -0
  9. package/dist/_lib/types/types.d.ts +491 -353
  10. package/dist/genesis/generated/resources/Genesis.d.ts +2 -0
  11. package/dist/genesis/generated/resources/Genesis.js +2 -0
  12. package/dist/genesis/generated/resources/Genesis.json +2113 -0
  13. package/dist/{schemas → genesis/generated/schemas}/Genesis.json +266 -345
  14. package/dist/{schemas → genesis/generated/schemas}/Job.json +24 -26
  15. package/dist/genesis/generated/schemas/ResourceFormat.d.ts +2 -0
  16. package/dist/genesis/generated/schemas/ResourceFormat.js +2 -0
  17. package/dist/genesis/generated/schemas/ResourceFormat.json +74 -0
  18. package/dist/genesis/generated/schemas/ResourceType.d.ts +2 -0
  19. package/dist/genesis/generated/schemas/ResourceType.js +2 -0
  20. package/dist/genesis/generated/schemas/ResourceType.json +361 -0
  21. package/dist/genesis/generated/schemas/StatefulStrategy.d.ts +2 -0
  22. package/dist/genesis/generated/schemas/StatefulStrategy.js +2 -0
  23. package/dist/genesis/generated/schemas/StatefulStrategy.json +647 -0
  24. package/dist/genesis/generated/schemas/StatelessStrategy.d.ts +2 -0
  25. package/dist/genesis/generated/schemas/StatelessStrategy.js +2 -0
  26. package/dist/genesis/generated/schemas/StatelessStrategy.json +324 -0
  27. package/dist/genesis/resourceTypes/Genesis.d.ts +2 -0
  28. package/dist/genesis/resourceTypes/Genesis.js +2 -0
  29. package/dist/genesis/resourceTypes/Genesis.json +1523 -0
  30. package/dist/index.d.ts +8 -5
  31. package/dist/index.js +4 -3
  32. package/dist/scripts/_lib/config.d.ts +45 -0
  33. package/dist/scripts/_lib/config.js +109 -0
  34. package/dist/scripts/brandFactories.d.ts +5 -5
  35. package/dist/scripts/brandFactories.js +4 -5
  36. package/dist/scripts/extractSchemas.js +33 -8
  37. package/dist/scripts/extractSubschemaWithDefs.js +36 -7
  38. package/dist/scripts/generateResourceEnvelopes.js +77 -0
  39. package/dist/scripts/generateResourceTypeType.d.ts +1 -0
  40. package/dist/scripts/{generateResourceData.js → generateResourceTypeType.js} +21 -19
  41. package/dist/scripts/generateSchemaShims.d.ts +1 -0
  42. package/dist/scripts/generateSchemaShims.js +63 -0
  43. package/dist/scripts/generateTypes.js +116 -83
  44. package/dist/scripts/rewriteAnchors.d.ts +1 -0
  45. package/dist/scripts/rewriteAnchors.js +90 -0
  46. package/package.json +50 -52
  47. package/dist/_lib/types/ResourceData_Job.d.ts +0 -97
  48. /package/dist/_lib/types/{ResourceData_Job.js → Resource_Job.js} +0 -0
  49. /package/dist/{schemas → genesis/generated/schemas}/Genesis.d.ts +0 -0
  50. /package/dist/{schemas → genesis/generated/schemas}/Genesis.js +0 -0
  51. /package/dist/{schemas → genesis/generated/schemas}/Job.d.ts +0 -0
  52. /package/dist/{schemas → genesis/generated/schemas}/Job.js +0 -0
  53. /package/dist/scripts/{generateResourceData.d.ts → generateResourceEnvelopes.d.ts} +0 -0
@@ -3,26 +3,37 @@
3
3
  "type": "object",
4
4
  "allOf": [
5
5
  {
6
- "$ref": "#/$defs/Documented"
6
+ "properties": {
7
+ "identity": {
8
+ "$ref": "#/$defs/JobId"
9
+ },
10
+ "implementation": {
11
+ "type": "string",
12
+ "format": "uri"
13
+ }
14
+ },
15
+ "required": [
16
+ "identity",
17
+ "implementation"
18
+ ]
7
19
  },
8
20
  {
9
- "$ref": "#/$defs/RolesOuter"
21
+ "$ref": "#/$defs/Documented"
10
22
  },
11
23
  {
12
- "$ref": "#/$defs/Uri"
13
- }
14
- ],
15
- "properties": {
16
- "identity": {
17
- "type": "string"
24
+ "$ref": "#/$defs/RolesOuter"
18
25
  }
19
- },
20
- "required": [
21
- "identity"
22
26
  ],
23
27
  "unevaluatedProperties": false,
24
28
  "$anchor": "Job",
25
29
  "$defs": {
30
+ "JobId": {
31
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
32
+ "type": "string",
33
+ "$anchor": "JobId",
34
+ "$comment": "",
35
+ "pattern": "^JOB-.+$"
36
+ },
26
37
  "Documented": {
27
38
  "$schema": "https://json-schema.org/draft/2020-12/schema",
28
39
  "type": "object",
@@ -49,20 +60,6 @@
49
60
  ],
50
61
  "$anchor": "RolesOuter"
51
62
  },
52
- "Uri": {
53
- "$schema": "https://json-schema.org/draft/2020-12/schema",
54
- "type": "object",
55
- "properties": {
56
- "uri": {
57
- "type": "string",
58
- "format": "uri"
59
- }
60
- },
61
- "required": [
62
- "uri"
63
- ],
64
- "$anchor": "Uri"
65
- },
66
63
  "Name": {
67
64
  "$schema": "https://json-schema.org/draft/2020-12/schema",
68
65
  "type": "object",
@@ -137,7 +134,8 @@
137
134
  },
138
135
  "required": [
139
136
  "resourceTypeId"
140
- ]
137
+ ],
138
+ "$comment": "A ResourceRole does not have a self-contained identity, as it is always defined in the context of a RoleMap."
141
139
  },
142
140
  {
143
141
  "$ref": "#/$defs/Documented"
@@ -0,0 +1,2 @@
1
+ import schema from './ResourceFormat.json';
2
+ export default schema;
@@ -0,0 +1,2 @@
1
+ import schema from './ResourceFormat.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "allOf": [
5
+ {
6
+ "properties": {
7
+ "identity": {
8
+ "$ref": "#/$defs/ResourceFormatId"
9
+ }
10
+ },
11
+ "required": [
12
+ "identity"
13
+ ]
14
+ },
15
+ {
16
+ "$ref": "#/$defs/Documented"
17
+ }
18
+ ],
19
+ "$anchor": "ResourceFormat",
20
+ "$defs": {
21
+ "ResourceFormatId": {
22
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
23
+ "type": "string",
24
+ "$anchor": "ResourceFormatId",
25
+ "pattern": "^FORMAT-.+$"
26
+ },
27
+ "Documented": {
28
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
29
+ "type": "object",
30
+ "allOf": [
31
+ {
32
+ "$ref": "#/$defs/Name"
33
+ },
34
+ {
35
+ "$ref": "#/$defs/Description"
36
+ }
37
+ ],
38
+ "$anchor": "Documented"
39
+ },
40
+ "Name": {
41
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
42
+ "type": "object",
43
+ "properties": {
44
+ "name": {
45
+ "type": "string",
46
+ "$comment": "Validation is intercepted by an AI Agent that verifies the name against Toolproof's naming conventions.",
47
+ "minLength": 1,
48
+ "pattern": "^(?:[A-Z].*|[a-z]+/[a-z0-9.+-]+)$",
49
+ "semanticValidation": "Ajv custom keyword to verify name."
50
+ }
51
+ },
52
+ "required": [
53
+ "name"
54
+ ],
55
+ "$anchor": "Name"
56
+ },
57
+ "Description": {
58
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
59
+ "type": "object",
60
+ "properties": {
61
+ "description": {
62
+ "type": "string",
63
+ "$comment": "Validation is intercepted by an AI Agent that verifies the description against Toolproof's documentation standards.",
64
+ "minLength": 1,
65
+ "semanticValidation": "Ajv custom keyword to verify description."
66
+ }
67
+ },
68
+ "required": [
69
+ "description"
70
+ ],
71
+ "$anchor": "Description"
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './ResourceType.json';
2
+ export default schema;
@@ -0,0 +1,2 @@
1
+ import schema from './ResourceType.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,361 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "allOf": [
5
+ {
6
+ "properties": {
7
+ "identity": {
8
+ "$ref": "#/$defs/ResourceTypeId"
9
+ },
10
+ "resourceFormatId": {
11
+ "$ref": "#/$defs/ResourceFormatId"
12
+ }
13
+ },
14
+ "required": [
15
+ "identity",
16
+ "resourceFormatId"
17
+ ]
18
+ },
19
+ {
20
+ "$ref": "#/$defs/Documented"
21
+ },
22
+ {
23
+ "$ref": "#/$defs/ExtractionSchema"
24
+ },
25
+ {
26
+ "if": {
27
+ "properties": {
28
+ "resourceFormatId": {
29
+ "const": "FORMAT-ApplicationJson"
30
+ }
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."
33
+ },
34
+ "then": {
35
+ "not": {
36
+ "required": [
37
+ "extractor"
38
+ ]
39
+ }
40
+ },
41
+ "else": {
42
+ "type": "object",
43
+ "properties": {
44
+ "extractor": {
45
+ "type": "string",
46
+ "format": "uri"
47
+ }
48
+ },
49
+ "required": [
50
+ "extractor"
51
+ ]
52
+ }
53
+ }
54
+ ],
55
+ "$anchor": "ResourceType",
56
+ "$defs": {
57
+ "ResourceTypeId": {
58
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
59
+ "type": "string",
60
+ "$anchor": "ResourceTypeId",
61
+ "pattern": "^TYPE-.+$"
62
+ },
63
+ "ResourceFormatId": {
64
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
65
+ "type": "string",
66
+ "$anchor": "ResourceFormatId",
67
+ "pattern": "^FORMAT-.+$"
68
+ },
69
+ "Documented": {
70
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
71
+ "type": "object",
72
+ "allOf": [
73
+ {
74
+ "$ref": "#/$defs/Name"
75
+ },
76
+ {
77
+ "$ref": "#/$defs/Description"
78
+ }
79
+ ],
80
+ "$anchor": "Documented"
81
+ },
82
+ "ExtractionSchema": {
83
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
84
+ "type": "object",
85
+ "properties": {
86
+ "extractionSchema": {
87
+ "$ref": "#/$defs/ExtractionSchemaValue"
88
+ }
89
+ },
90
+ "required": [
91
+ "extractionSchema"
92
+ ],
93
+ "$anchor": "ExtractionSchema"
94
+ },
95
+ "Name": {
96
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
97
+ "type": "object",
98
+ "properties": {
99
+ "name": {
100
+ "type": "string",
101
+ "$comment": "Validation is intercepted by an AI Agent that verifies the name against Toolproof's naming conventions.",
102
+ "minLength": 1,
103
+ "pattern": "^(?:[A-Z].*|[a-z]+/[a-z0-9.+-]+)$",
104
+ "semanticValidation": "Ajv custom keyword to verify name."
105
+ }
106
+ },
107
+ "required": [
108
+ "name"
109
+ ],
110
+ "$anchor": "Name"
111
+ },
112
+ "Description": {
113
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
114
+ "type": "object",
115
+ "properties": {
116
+ "description": {
117
+ "type": "string",
118
+ "$comment": "Validation is intercepted by an AI Agent that verifies the description against Toolproof's documentation standards.",
119
+ "minLength": 1,
120
+ "semanticValidation": "Ajv custom keyword to verify description."
121
+ }
122
+ },
123
+ "required": [
124
+ "description"
125
+ ],
126
+ "$anchor": "Description"
127
+ },
128
+ "ExtractionSchemaValue": {
129
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
130
+ "type": "object",
131
+ "allOf": [
132
+ {
133
+ "if": {
134
+ "anyOf": [
135
+ {
136
+ "properties": {
137
+ "properties": {
138
+ "type": "object",
139
+ "properties": {
140
+ "identity": {}
141
+ }
142
+ }
143
+ }
144
+ },
145
+ {
146
+ "properties": {
147
+ "required": {
148
+ "type": "array",
149
+ "contains": {
150
+ "const": "identity"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ ]
156
+ },
157
+ "then": {
158
+ "$ref": "#/$defs/IdentityProp"
159
+ }
160
+ },
161
+ {
162
+ "if": {
163
+ "properties": {
164
+ "properties": {
165
+ "type": "object",
166
+ "properties": {
167
+ "merit": {}
168
+ }
169
+ }
170
+ }
171
+ },
172
+ "then": {
173
+ "$ref": "#/$defs/MeritProp"
174
+ }
175
+ },
176
+ {
177
+ "oneOf": [
178
+ {
179
+ "required": [
180
+ "additionalProperties"
181
+ ]
182
+ },
183
+ {
184
+ "required": [
185
+ "unevaluatedProperties"
186
+ ]
187
+ }
188
+ ]
189
+ }
190
+ ],
191
+ "properties": {
192
+ "$schema": {
193
+ "const": "https://json-schema.org/draft/2020-12/schema"
194
+ },
195
+ "$defs": {
196
+ "type": "object"
197
+ },
198
+ "type": {
199
+ "const": "object"
200
+ },
201
+ "allOf": {
202
+ "type": "array",
203
+ "items": {
204
+ "type": "object"
205
+ }
206
+ },
207
+ "properties": {
208
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
209
+ "type": "object"
210
+ },
211
+ "additionalProperties": {
212
+ "const": false
213
+ },
214
+ "unevaluatedProperties": {
215
+ "const": false
216
+ },
217
+ "$anchor": {
218
+ "type": "string",
219
+ "pattern": "^[A-Za-z][A-Za-z0-9._-]*$"
220
+ }
221
+ },
222
+ "required": [
223
+ "$schema",
224
+ "$anchor",
225
+ "type"
226
+ ],
227
+ "unevaluatedProperties": false,
228
+ "$anchor": "ExtractionSchemaValue"
229
+ },
230
+ "IdentityProp": {
231
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
232
+ "type": "object",
233
+ "properties": {
234
+ "$defs": {
235
+ "type": "object",
236
+ "additionalProperties": true,
237
+ "$comment": "Ajv-specific: patternRequired enforces at least one Id-like key in this $defs block when identity is present.",
238
+ "minProperties": 1,
239
+ "patternProperties": {
240
+ "^[A-Za-z][A-Za-z0-9._-]*Id$": {
241
+ "$ref": "#/$defs/IdSchemaValue"
242
+ }
243
+ },
244
+ "patternRequired": [
245
+ "^[A-Za-z][A-Za-z0-9._-]*Id$"
246
+ ]
247
+ },
248
+ "properties": {
249
+ "type": "object",
250
+ "properties": {
251
+ "identity": {
252
+ "$ref": "#/$defs/IdentityValue"
253
+ }
254
+ },
255
+ "required": [
256
+ "identity"
257
+ ]
258
+ },
259
+ "required": {
260
+ "type": "array",
261
+ "contains": {
262
+ "const": "identity"
263
+ },
264
+ "items": {
265
+ "type": "string"
266
+ },
267
+ "uniqueItems": true
268
+ }
269
+ },
270
+ "required": [
271
+ "$defs",
272
+ "required",
273
+ "properties"
274
+ ],
275
+ "$anchor": "IdentityProp"
276
+ },
277
+ "MeritProp": {
278
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
279
+ "type": "object",
280
+ "properties": {
281
+ "properties": {
282
+ "type": "object",
283
+ "properties": {
284
+ "merit": {
285
+ "$ref": "#/$defs/MeritValue"
286
+ }
287
+ }
288
+ }
289
+ },
290
+ "$anchor": "MeritProp"
291
+ },
292
+ "IdSchemaValue": {
293
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
294
+ "type": "object",
295
+ "properties": {
296
+ "type": {
297
+ "const": "string"
298
+ },
299
+ "pattern": {
300
+ "type": "string",
301
+ "pattern": "^[A-Z][A-Z0-9._-]*-.+$"
302
+ }
303
+ },
304
+ "required": [
305
+ "type",
306
+ "pattern"
307
+ ],
308
+ "$anchor": "IdSchemaValue"
309
+ },
310
+ "IdentityValue": {
311
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
312
+ "type": "object",
313
+ "properties": {
314
+ "$ref": {
315
+ "type": "string",
316
+ "$comment": "Anchors-only: use #<Name>Id for identity refs. Top-level and nested $defs should expose an $anchor matching <Name>Id.",
317
+ "pattern": "^#[A-Za-z][A-Za-z0-9._-]*Id$"
318
+ }
319
+ },
320
+ "required": [
321
+ "$ref"
322
+ ],
323
+ "additionalProperties": false,
324
+ "$anchor": "IdentityValue"
325
+ },
326
+ "MeritValue": {
327
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
328
+ "type": "object",
329
+ "oneOf": [
330
+ {
331
+ "properties": {
332
+ "type": {
333
+ "enum": [
334
+ "number",
335
+ "integer"
336
+ ]
337
+ }
338
+ },
339
+ "required": [
340
+ "type"
341
+ ]
342
+ },
343
+ {
344
+ "properties": {
345
+ "enum": {
346
+ "type": "array",
347
+ "items": {
348
+ "type": "number"
349
+ },
350
+ "minItems": 1
351
+ }
352
+ },
353
+ "required": [
354
+ "enum"
355
+ ]
356
+ }
357
+ ],
358
+ "$anchor": "MeritValue"
359
+ }
360
+ }
361
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './StatefulStrategy.json';
2
+ export default schema;
@@ -0,0 +1,2 @@
1
+ import schema from './StatefulStrategy.json' with { type: 'json' };
2
+ export default schema;