@toolproof-core/schema 1.0.0

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 (74) hide show
  1. package/dist/generated/types/Resource_Genesis.d.ts +3 -0
  2. package/dist/generated/types/Resource_Genesis.js +1 -0
  3. package/dist/generated/types/Resource_Job.d.ts +3 -0
  4. package/dist/generated/types/Resource_Job.js +1 -0
  5. package/dist/generated/types/Resource_RawStrategy.d.ts +3 -0
  6. package/dist/generated/types/Resource_RawStrategy.js +1 -0
  7. package/dist/generated/types/Resource_ResourceType.d.ts +3 -0
  8. package/dist/generated/types/Resource_ResourceType.js +1 -0
  9. package/dist/generated/types/Resource_RunnableStrategy.d.ts +3 -0
  10. package/dist/generated/types/Resource_RunnableStrategy.js +1 -0
  11. package/dist/generated/types/types.d.ts +1784 -0
  12. package/dist/generated/types/types.js +1 -0
  13. package/dist/scripts/_lib/config.d.ts +53 -0
  14. package/dist/scripts/_lib/config.js +138 -0
  15. package/dist/scripts/extractSchemas.d.ts +1 -0
  16. package/dist/scripts/extractSchemas.js +210 -0
  17. package/dist/scripts/extractSubSchemaWithDefs.d.ts +1 -0
  18. package/dist/scripts/extractSubSchemaWithDefs.js +187 -0
  19. package/dist/scripts/generateDependencies.d.ts +1 -0
  20. package/dist/scripts/generateDependencies.js +106 -0
  21. package/dist/scripts/generateResourceShells.d.ts +1 -0
  22. package/dist/scripts/generateResourceShells.js +91 -0
  23. package/dist/scripts/generateResourceTypeType.d.ts +1 -0
  24. package/dist/scripts/generateResourceTypeType.js +93 -0
  25. package/dist/scripts/generateSchemaShims.d.ts +1 -0
  26. package/dist/scripts/generateSchemaShims.js +105 -0
  27. package/dist/scripts/generateTypes.d.ts +1 -0
  28. package/dist/scripts/generateTypes.js +550 -0
  29. package/dist/scripts/rewriteAnchors.d.ts +1 -0
  30. package/dist/scripts/rewriteAnchors.js +96 -0
  31. package/package.json +45 -0
  32. package/src/Genesis.json +2043 -0
  33. package/src/Roadmap.json +102 -0
  34. package/src/generated/dependencies.json +299 -0
  35. package/src/generated/resourceTypes/Genesis.json +2043 -0
  36. package/src/generated/resourceTypes/Genesis.ts +2 -0
  37. package/src/generated/resources/Genesis.json +2962 -0
  38. package/src/generated/resources/Genesis.ts +2 -0
  39. package/src/generated/schemas/Genesis.json +1489 -0
  40. package/src/generated/schemas/Genesis.ts +2 -0
  41. package/src/generated/schemas/Goal.json +86 -0
  42. package/src/generated/schemas/Goal.ts +2 -0
  43. package/src/generated/schemas/Job.json +236 -0
  44. package/src/generated/schemas/Job.ts +2 -0
  45. package/src/generated/schemas/RawStrategy.json +667 -0
  46. package/src/generated/schemas/RawStrategy.ts +2 -0
  47. package/src/generated/schemas/ResourceType.json +140 -0
  48. package/src/generated/schemas/ResourceType.ts +2 -0
  49. package/src/generated/schemas/RunnableStrategy.json +737 -0
  50. package/src/generated/schemas/RunnableStrategy.ts +2 -0
  51. package/src/generated/schemas/StrategyRun.json +1025 -0
  52. package/src/generated/schemas/StrategyRun.ts +2 -0
  53. package/src/generated/types/Resource_Genesis.d.ts +3 -0
  54. package/src/generated/types/Resource_Genesis.js +1 -0
  55. package/src/generated/types/Resource_Job.d.ts +3 -0
  56. package/src/generated/types/Resource_Job.js +1 -0
  57. package/src/generated/types/Resource_RawStrategy.d.ts +3 -0
  58. package/src/generated/types/Resource_RawStrategy.js +1 -0
  59. package/src/generated/types/Resource_ResourceType.d.ts +3 -0
  60. package/src/generated/types/Resource_ResourceType.js +1 -0
  61. package/src/generated/types/Resource_RunnableStrategy.d.ts +3 -0
  62. package/src/generated/types/Resource_RunnableStrategy.js +1 -0
  63. package/src/generated/types/types.d.ts +1784 -0
  64. package/src/generated/types/types.js +1 -0
  65. package/src/index.ts +1 -0
  66. package/src/scripts/_lib/config.ts +181 -0
  67. package/src/scripts/extractSchemas.ts +229 -0
  68. package/src/scripts/extractSubSchemaWithDefs.ts +196 -0
  69. package/src/scripts/generateDependencies.ts +120 -0
  70. package/src/scripts/generateResourceShells.ts +105 -0
  71. package/src/scripts/generateResourceTypeType.ts +110 -0
  72. package/src/scripts/generateSchemaShims.ts +115 -0
  73. package/src/scripts/generateTypes.ts +615 -0
  74. package/src/scripts/rewriteAnchors.ts +123 -0
@@ -0,0 +1,102 @@
1
+ {
2
+ "Tasks": [
3
+ {
4
+ "name": "Familiarization",
5
+ "comment": "Familiarize yourself with the new schema structure and the changes made. Consult the 'Notes' section for specific changes in naming and structure. This will help you understand how to adapt the existing codebase to work with the new schema. Prepare a list of any questions or clarifications needed regarding the new schema structure and we'll discuss them."
6
+ },
7
+ {
8
+ "name": "Scripts",
9
+ "comment": "Implement the scripts specified in the 'Scripts' section so that they work with the new schema structure. Try to do it with business logic contained in reusable pure functions as much as possible, and with clear separation between this and file I/O. In the future, we might let Ajv take over some of this work since it already has a lot of this functionality built-in (dereferencing, $defs bundling, etc.)."
10
+ },
11
+ {
12
+ "name": "NPM Publishing",
13
+ "comment": "Publish the schema package to the new npm organization 'toolproof-core' (I have sent you an invite). Take a pull of the latest master and merge it into your branch. For schema/package.json, keep my 'name' change. The package is now called '@toolproof-core/schema' instead of '@toolproof-npm/schema'. The reason for this change is that we can now name all core packages with the '@toolproof-core' prefix, regardless of whether they are published to npm or not. I've also done one change in Genesis.json. ShellMaterializedBase now has a required 'version' property with const value 1. This should not cause any merge conflicts since you've only done changes inside scripts/ and generated/ (in addition to package.json). The only thing that needs to be changed in scripts/ is the generateResourceShells script to add the version property (with value 1)when wrapping ResourceTypes in a ShellMaterialized. Note that while we call the new ToolProof version 'v2' during development, it will officially be called 'v1'. The old version (current 'v1') will be degraded to 'v0' and deprecated. This aligns with our npm package naming, where we've till now given the packages a '0.x.x' version. In the new npm organization 'toolproof-core', we will start with version '1.0.0' for all packages. Note that I've also updated other packages (console, engine, validation, visualization), but that should not cause any merge conflicts."
14
+ },
15
+ {
16
+ "name": "GitHub Actions",
17
+ "comment": "Create a GitHub Actions workflow for the schema package (like we have in the old ToolProof repository). We'll create actions for other packages later."
18
+ }
19
+ ],
20
+ "Notes": [
21
+ {
22
+ "oldName": "-Wrapper",
23
+ "newName": "-Facet",
24
+ "comment": "The 'Wrapper' suffix is changed to 'Facet' everywhere."
25
+ },
26
+ {
27
+ "oldName": "Name&DescriptionWrapper",
28
+ "newName": "DocumentationFacet"
29
+ },
30
+ {
31
+ "oldName": "extractionSchema",
32
+ "newName": "nucleusSchema",
33
+ "comment": "This is now a maximum-permissive 'true' schema. We'll validate user-written schemas in a much better way separately."
34
+ },
35
+ {
36
+ "oldName": "extractedData",
37
+ "newName": "nucleus"
38
+ },
39
+ {
40
+ "oldName": "Execution",
41
+ "newName": "JobRun"
42
+ },
43
+ {
44
+ "oldName": "WorkStep",
45
+ "newName": "JobStep"
46
+ },
47
+ {
48
+ "oldName": "ResourceMeta",
49
+ "newName": "ShellMaterialized"
50
+ },
51
+ {
52
+ "oldName": "StatelessStrategy",
53
+ "newName": "StepsFacet",
54
+ "comment": "This is a different concept. We no longer have the concept of Stateless vs Stateful strategies. We'll rather allow RunnableStrategies to be reused with new bindings."
55
+ },
56
+ {
57
+ "oldName": "StatefulStrategy",
58
+ "newName": "RawStrategy"
59
+ },
60
+ {
61
+ "oldName": "RunRecording",
62
+ "newName": "StrategyRun"
63
+ }
64
+ ],
65
+ "Scripts": {
66
+ "rewriteAnchors": {
67
+ "newName": "rewriteAnchors",
68
+ "comment": "Rewrites anchor-style refs (e.g. #SomeAnchor) inside Genesis.json’s nucleusSchema to JSON Pointer refs (e.g. #/$defs/SomeAnchor) for stricter tooling compatibility. Outputs normalized Genesis.json written to the configured location.",
69
+ "status": "Done, In PR"
70
+ },
71
+ "extractSchemas": {
72
+ "newName": "extractSchemas",
73
+ "comment": "Takes the (normalized) Genesis.json document (expects a top-level nucleusSchema), unwraps nested ResourceTypes into raw JSON Schemas. Outputs a flattened Genesis.json at the configured location.",
74
+ "status": "Done, In PR"
75
+ },
76
+ "extractSubSchemaWithDefs": {
77
+ "newName": "extractSubSchemaWithDefs",
78
+ "comment": "Extracts a single $defs.<Name> from the flattened Genesis.json and bundles it into a standalone schema including all direct + transitive local $defs dependencies referenced via #/$defs/...",
79
+ "status": "Done, In PR"
80
+ },
81
+ "generateSchemaShims": {
82
+ "newName": "generateSchemaShims",
83
+ "comment": "Generates .ts shim files next to generated .json files so TypeScript/NodeNext can import JSON schemas/resources via import assertions consistently."
84
+ },
85
+ "generateResourceEnvelopes": {
86
+ "newName": "generateResourceShells",
87
+ "comment": "Wraps every Genesis.nucleusSchema.$defs[DefName] schema in a Resource shell (ToolProof resource object). Special-cases Genesis with nucleus: {} to avoid duplicating all $defs."
88
+ },
89
+ "generateTypes": {
90
+ "newName": "generateTypes",
91
+ "comment": "Runs json-schema-to-typescript across the extracted schemas directory, with a custom resolver so absolute $id URLs map to local files (no network). Applies a few normalizations (e.g., allOf sibling keyword handling), prunes noisy generated names, and overlays template-literal types for ...Identity/...Ref patterns when possible. Ensures runtime .js shims exist alongside .d.ts. Note that some of this additional processing might be unnecessary or might not fit the new schema structure."
92
+ },
93
+ "generateResourceTypeType": {
94
+ "newName": "generateResourceTypeType",
95
+ "comment": "Generates a typed Resource variant Resource_<Name> where nucleus is typed to the extracted nucleusSchema <Name>.json."
96
+ },
97
+ "generateDependencies": {
98
+ "newName": "generateDependencies",
99
+ "comment": "Generates a list of dependencies for each schema."
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,299 @@
1
+ {
2
+ "Boolean": [
3
+ "BooleanIdentity"
4
+ ],
5
+ "BooleanIdentity": [],
6
+ "BranchStep": [
7
+ "StepKindFacet",
8
+ "Conditional",
9
+ "BranchStepIdentity"
10
+ ],
11
+ "BranchStepIdentity": [],
12
+ "Conditional": [
13
+ "JobStep"
14
+ ],
15
+ "CreationContext": [
16
+ "JobRunIdentity",
17
+ "ResourceRoleIdentity"
18
+ ],
19
+ "CreationContextFacet": [
20
+ "CreationContext"
21
+ ],
22
+ "Description": [],
23
+ "DescriptionFacet": [
24
+ "Description"
25
+ ],
26
+ "DocumentationFacet": [
27
+ "NameFacet",
28
+ "DescriptionFacet"
29
+ ],
30
+ "Domain": [],
31
+ "DomainFacet": [
32
+ "Domain"
33
+ ],
34
+ "Error": [
35
+ "DocumentationFacet"
36
+ ],
37
+ "ForStep": [
38
+ "StepKindFacet",
39
+ "Conditional",
40
+ "ForStepIdentity"
41
+ ],
42
+ "ForStepIdentity": [],
43
+ "Goal": [
44
+ "DomainFacet",
45
+ "JobIdentity",
46
+ "GoalIdentity"
47
+ ],
48
+ "GoalIdentity": [],
49
+ "GraphEndRunEvent": [
50
+ "RunEventBase"
51
+ ],
52
+ "GraphStartRunEvent": [
53
+ "RunEventBase",
54
+ "RunnableStrategy"
55
+ ],
56
+ "InterruptRunEvent": [
57
+ "RunEventBase"
58
+ ],
59
+ "Job": [
60
+ "DocumentationFacet",
61
+ "DomainFacet",
62
+ "RolesFacet",
63
+ "JobIdentity",
64
+ "Uri"
65
+ ],
66
+ "JobIdentity": [],
67
+ "JobRun": [
68
+ "RoleBindingsFacet",
69
+ "JobRunIdentity",
70
+ "JobIdentity"
71
+ ],
72
+ "JobRunIdentity": [],
73
+ "JobRunSocket": [
74
+ "Resource",
75
+ "ResourceRoleIdentity"
76
+ ],
77
+ "JobStep": [
78
+ "StepKindFacet",
79
+ "JobStepIdentity",
80
+ "JobRun"
81
+ ],
82
+ "JobStepIdentity": [],
83
+ "JsonData": [],
84
+ "Name": [],
85
+ "NameFacet": [
86
+ "Name"
87
+ ],
88
+ "Natural": [
89
+ "NaturalIdentity"
90
+ ],
91
+ "NaturalIdentity": [],
92
+ "Nucleus": [
93
+ "JsonData"
94
+ ],
95
+ "NucleusFacet": [
96
+ "Nucleus"
97
+ ],
98
+ "Path": [],
99
+ "PathFacet": [
100
+ "Path"
101
+ ],
102
+ "RawStrategy": [
103
+ "StepsFacet",
104
+ "StrategyStateFacet"
105
+ ],
106
+ "Resource": [
107
+ "ResourceMissing",
108
+ "ResourceInputPotential",
109
+ "ResourceOutputPotential",
110
+ "ResourceMaterialized"
111
+ ],
112
+ "ResourceBase": [
113
+ "ResourceIdentity",
114
+ "ResourceTypeIdentity"
115
+ ],
116
+ "ResourceIdentity": [],
117
+ "ResourceInputPotential": [
118
+ "ShellInputPotential"
119
+ ],
120
+ "ResourceKind": [],
121
+ "ResourceKindFacet": [
122
+ "ResourceKind"
123
+ ],
124
+ "ResourceMaterialized": [
125
+ "ShellMaterializedBase",
126
+ "NucleusFacet"
127
+ ],
128
+ "ResourceMissing": [
129
+ "ShellMissing"
130
+ ],
131
+ "ResourceOutputPotential": [
132
+ "ShellOutputPotential"
133
+ ],
134
+ "ResourceRoleIdentity": [],
135
+ "ResourceRoleValue": [
136
+ "ResourceTypeIdentity",
137
+ "DocumentationFacet"
138
+ ],
139
+ "ResourceType": [
140
+ "DocumentationFacet",
141
+ "ResourceTypeImplementationKindFacet",
142
+ "Uri",
143
+ "ResourceTypeIdentity"
144
+ ],
145
+ "ResourceTypeIdentity": [],
146
+ "ResourceTypeImplementationKind": [],
147
+ "ResourceTypeImplementationKindFacet": [
148
+ "ResourceTypeImplementationKind"
149
+ ],
150
+ "RoleBindingArray": [
151
+ "ResourceRoleIdentity"
152
+ ],
153
+ "RoleBindings": [
154
+ "RoleBindingArray"
155
+ ],
156
+ "RoleBindingsFacet": [
157
+ "RoleBindings"
158
+ ],
159
+ "RoleMap": [
160
+ "ResourceRoleValue",
161
+ "ResourceRoleIdentity"
162
+ ],
163
+ "Roles": [
164
+ "RoleMap",
165
+ "ResourceRoleValue"
166
+ ],
167
+ "RolesFacet": [
168
+ "Roles"
169
+ ],
170
+ "RunEvent": [
171
+ "GraphStartRunEvent",
172
+ "TickRunEvent",
173
+ "InterruptRunEvent",
174
+ "GraphEndRunEvent"
175
+ ],
176
+ "RunEventBase": [
177
+ "RunEventCounters",
178
+ "Timestamp",
179
+ "RunEventKind",
180
+ "RunnableStrategyIdentity",
181
+ "RunEventStepMetadata",
182
+ "StrategyThreadIdentity",
183
+ "RunEventUpdates"
184
+ ],
185
+ "RunEventCounters": [],
186
+ "RunEventKind": [],
187
+ "RunEventStepMetadata": [
188
+ "JobIdentity",
189
+ "JobRunIdentity",
190
+ "StepIdentity",
191
+ "StepKind"
192
+ ],
193
+ "RunEventUpdates": [
194
+ "StrategyStateDelta",
195
+ "StepArray"
196
+ ],
197
+ "RunnableStrategy": [
198
+ "StrategyThreadMapFacet",
199
+ "StrategyStateFacet",
200
+ "RunnableStrategyIdentity",
201
+ "RunnableStrategyContext"
202
+ ],
203
+ "RunnableStrategyContext": [
204
+ "Timestamp",
205
+ "RunnableStrategyStatus"
206
+ ],
207
+ "RunnableStrategyIdentity": [],
208
+ "RunnableStrategyStatus": [],
209
+ "RunnableStrategyUpdate": [
210
+ "StrategyStateDelta",
211
+ "RunnableStrategy",
212
+ "RunnableStrategyIdentity"
213
+ ],
214
+ "ShellInputPotential": [
215
+ "ResourceBase",
216
+ "CreationContextFacet",
217
+ "ResourceKindFacet"
218
+ ],
219
+ "ShellMaterialized": [
220
+ "ShellMaterializedBase"
221
+ ],
222
+ "ShellMaterializedBase": [
223
+ "ResourceBase",
224
+ "CreationContextFacet",
225
+ "ResourceKindFacet",
226
+ "TimestampFacet",
227
+ "PathFacet"
228
+ ],
229
+ "ShellMissing": [
230
+ "ResourceBase",
231
+ "ResourceKindFacet"
232
+ ],
233
+ "ShellOutputPotential": [
234
+ "ResourceBase",
235
+ "CreationContextFacet",
236
+ "ResourceKindFacet"
237
+ ],
238
+ "Step": [
239
+ "JobStep",
240
+ "BranchStep",
241
+ "WhileStep",
242
+ "ForStep"
243
+ ],
244
+ "StepArray": [
245
+ "Step"
246
+ ],
247
+ "StepIdentity": [
248
+ "JobStepIdentity",
249
+ "BranchStepIdentity",
250
+ "WhileStepIdentity",
251
+ "ForStepIdentity"
252
+ ],
253
+ "StepKind": [],
254
+ "StepKindFacet": [
255
+ "StepKind"
256
+ ],
257
+ "StepsFacet": [
258
+ "StepArray"
259
+ ],
260
+ "StrategyRun": [
261
+ "StrategyRunIdentity",
262
+ "Timestamp",
263
+ "RunEvent",
264
+ "RunnableStrategyIdentity"
265
+ ],
266
+ "StrategyRunIdentity": [],
267
+ "StrategyState": [
268
+ "JobRunSocket",
269
+ "JobRunIdentity"
270
+ ],
271
+ "StrategyStateDelta": [
272
+ "StrategyState"
273
+ ],
274
+ "StrategyStateFacet": [
275
+ "StrategyState"
276
+ ],
277
+ "StrategyThreadIdentity": [],
278
+ "StrategyThreadMap": [
279
+ "StepArray",
280
+ "StrategyThreadIdentity"
281
+ ],
282
+ "StrategyThreadMapFacet": [
283
+ "StrategyThreadMap"
284
+ ],
285
+ "TickRunEvent": [
286
+ "RunEventBase"
287
+ ],
288
+ "Timestamp": [],
289
+ "TimestampFacet": [
290
+ "Timestamp"
291
+ ],
292
+ "Uri": [],
293
+ "WhileStep": [
294
+ "StepKindFacet",
295
+ "Conditional",
296
+ "WhileStepIdentity"
297
+ ],
298
+ "WhileStepIdentity": []
299
+ }