@toolproof-core/schema 1.0.8 → 1.0.10

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 (49) hide show
  1. package/dist/generated/artifacts/constants.d.ts +120 -0
  2. package/dist/generated/artifacts/constants.js +120 -0
  3. package/dist/generated/artifacts/mappings.d.ts +23 -0
  4. package/dist/generated/artifacts/mappings.js +23 -0
  5. package/dist/generated/normalized/Genesis.json +67 -53
  6. package/dist/generated/resources/Genesis.json +424 -236
  7. package/dist/generated/schemas/Genesis.json +56 -42
  8. package/dist/generated/schemas/standalone/Job.json +2 -0
  9. package/dist/generated/schemas/standalone/RawStrategy.json +86 -110
  10. package/dist/generated/schemas/standalone/RunnableStrategy.json +108 -132
  11. package/dist/generated/schemas/standalone/StrategyRun.json +86 -110
  12. package/dist/generated/types/types.d.ts +34 -34
  13. package/dist/index.d.ts +6 -3
  14. package/dist/index.js +5 -2
  15. package/dist/scripts/_lib/config.d.ts +3 -5
  16. package/dist/scripts/_lib/config.js +8 -14
  17. package/dist/scripts/generateConstantsAndMappings.d.ts +31 -0
  18. package/dist/scripts/generateConstantsAndMappings.js +243 -0
  19. package/dist/scripts/generateDependencies.js +1 -1
  20. package/dist/scripts/generateTerminals.js +2 -2
  21. package/dist/scripts/generateTypes.js +47 -2
  22. package/dist/scripts/wrapResourceTypesWithResourceShells.js +7 -3
  23. package/package.json +3 -3
  24. package/src/Genesis.json +71 -57
  25. package/src/generated/artifacts/constants.ts +121 -0
  26. package/src/generated/{dependencies → artifacts}/dependencyMap.json +16 -18
  27. package/src/generated/artifacts/mappings.ts +24 -0
  28. package/src/generated/{dependencies → artifacts}/terminals.json +1 -0
  29. package/src/generated/normalized/Genesis.json +1760 -1746
  30. package/src/generated/resources/Genesis.json +2796 -2608
  31. package/src/generated/schemas/Genesis.json +1329 -1315
  32. package/src/generated/schemas/standalone/Job.json +2 -0
  33. package/src/generated/schemas/standalone/RawStrategy.json +580 -604
  34. package/src/generated/schemas/standalone/RunnableStrategy.json +645 -669
  35. package/src/generated/schemas/standalone/StrategyRun.json +913 -937
  36. package/src/generated/types/types.d.ts +709 -709
  37. package/src/index.ts +8 -2
  38. package/src/scripts/_lib/config.ts +9 -17
  39. package/src/scripts/generateConstantsAndMappings.ts +309 -0
  40. package/src/scripts/generateDependencies.ts +1 -1
  41. package/src/scripts/generateTerminals.ts +2 -2
  42. package/src/scripts/generateTypes.ts +58 -2
  43. package/src/scripts/wrapResourceTypesWithResourceShells.ts +7 -3
  44. package/dist/generated/constants/constants.d.ts +0 -60
  45. package/dist/generated/constants/constants.js +0 -60
  46. package/dist/scripts/generateConstants.d.ts +0 -12
  47. package/dist/scripts/generateConstants.js +0 -179
  48. package/src/generated/constants/constants.ts +0 -61
  49. package/src/scripts/generateConstants.ts +0 -217
@@ -0,0 +1,243 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getConfig } from './_lib/config.js';
4
+ // PURE: Convert a string enum member into PascalCase.
5
+ // Examples: 'job' -> 'Job', 'graph_start' -> 'GraphStart'
6
+ function toPascalCase(value) {
7
+ return value
8
+ .split(/[^A-Za-z0-9]+/g)
9
+ .filter(Boolean)
10
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
11
+ .join('');
12
+ }
13
+ // PURE: Attempt to derive a canonical identity prefix from a canonical identity regex pattern.
14
+ function deriveIdentityPrefixFromPattern(pattern) {
15
+ // Canonical (currently used across schemas): ^PREFIX-.+$
16
+ const match = /^\^([^$]+)\.\+\$$/.exec(pattern);
17
+ if (!match)
18
+ return undefined;
19
+ const prefix = match[1];
20
+ if (!prefix || /[`\n\r]/.test(prefix))
21
+ return undefined;
22
+ return prefix;
23
+ }
24
+ // PURE: Extract all identity prefixes from `$defs/*Identity` string-pattern definitions.
25
+ export function extractIdentityPrefixes(schema) {
26
+ if (!schema || typeof schema !== 'object')
27
+ return {};
28
+ const defs = schema.$defs;
29
+ if (!defs || typeof defs !== 'object')
30
+ return {};
31
+ const defEntries = Object.entries(defs);
32
+ defEntries.sort(([a], [b]) => a.localeCompare(b));
33
+ const out = {};
34
+ for (const [defName, defVal] of defEntries) {
35
+ if (!/Identity$/.test(defName))
36
+ continue;
37
+ if (!defVal || typeof defVal !== 'object' || Array.isArray(defVal))
38
+ continue;
39
+ const v = defVal;
40
+ if (v.type !== 'string')
41
+ continue;
42
+ if (typeof v.pattern !== 'string')
43
+ continue;
44
+ const prefix = deriveIdentityPrefixFromPattern(v.pattern);
45
+ if (!prefix)
46
+ continue;
47
+ out[defName] = prefix;
48
+ }
49
+ return out;
50
+ }
51
+ // PURE: Extract all subschema names from `$defs/*`.
52
+ // Shape: { JobStep: 'JobStep', StepKind: 'StepKind', ... }
53
+ export function extractSubschemaNames(schema) {
54
+ if (!schema || typeof schema !== 'object')
55
+ return {};
56
+ const defs = schema.$defs;
57
+ if (!defs || typeof defs !== 'object')
58
+ return {};
59
+ const defEntries = Object.entries(defs);
60
+ defEntries.sort(([a], [b]) => a.localeCompare(b));
61
+ const out = {};
62
+ for (const [defName] of defEntries) {
63
+ if (!defName || /[\n\r`]/.test(defName))
64
+ continue;
65
+ out[defName] = defName;
66
+ }
67
+ return out;
68
+ }
69
+ // PURE: Extract all string enums from `$defs/*Kind|*Status` definitions.
70
+ // Shape: { StepKind: { job: 'job', ... }, ResourceShellKind: { inputPotential': 'inputPotential', ... } }
71
+ export function extractEnums(schema) {
72
+ if (!schema || typeof schema !== 'object')
73
+ return {};
74
+ const defs = schema.$defs;
75
+ if (!defs || typeof defs !== 'object')
76
+ return {};
77
+ const defEntries = Object.entries(defs);
78
+ defEntries.sort(([a], [b]) => a.localeCompare(b));
79
+ const out = {};
80
+ for (const [defName, defVal] of defEntries) {
81
+ if (!/(Kind|Status)$/.test(defName))
82
+ continue;
83
+ if (!defVal || typeof defVal !== 'object' || Array.isArray(defVal))
84
+ continue;
85
+ const v = defVal;
86
+ if (v.type !== 'string')
87
+ continue;
88
+ if (!Array.isArray(v.enum) || v.enum.length === 0)
89
+ continue;
90
+ if (v.enum.some((x) => typeof x !== 'string'))
91
+ continue;
92
+ const members = {};
93
+ for (const member of v.enum) {
94
+ members[member] = member;
95
+ }
96
+ out[defName] = members;
97
+ }
98
+ return out;
99
+ }
100
+ // PURE: Derive a StepKind -> StepIdentityPrefix mapping.
101
+ // Example: { job: 'job' } + IdentityNameToIdentityPrefix['JobStepIdentity']='JOB_STEP-' => { job: 'JOB_STEP-' }
102
+ export function deriveStepKindToStepIdentityPrefix(enums, identityNameToIdentityPrefix) {
103
+ const stepKindEnum = enums.StepKind;
104
+ if (!stepKindEnum || typeof stepKindEnum !== 'object')
105
+ return { mapping: {}, missing: [] };
106
+ const stepKinds = Object.keys(stepKindEnum).sort((a, b) => a.localeCompare(b));
107
+ const mapping = {};
108
+ const missing = [];
109
+ for (const stepKind of stepKinds) {
110
+ const identityName = `${toPascalCase(stepKind)}StepIdentity`;
111
+ const prefix = identityNameToIdentityPrefix[identityName];
112
+ if (!prefix) {
113
+ missing.push({ stepKind, identityName });
114
+ continue;
115
+ }
116
+ mapping[stepKind] = prefix;
117
+ }
118
+ return { mapping, missing };
119
+ }
120
+ // PURE: Extract generated CONSTANTS + MAPPINGS from a parsed schema.
121
+ export function extractGeneratedConstantsAndMappings(schema) {
122
+ const names = extractSubschemaNames(schema);
123
+ const enums = extractEnums(schema);
124
+ const identityPrefixes = extractIdentityPrefixes(schema);
125
+ const derivedStepKind = deriveStepKindToStepIdentityPrefix(enums, identityPrefixes);
126
+ return {
127
+ CONSTANTS: {
128
+ Names: names,
129
+ Enums: enums,
130
+ },
131
+ MAPPINGS: {
132
+ IdentityNameToIdentityPrefix: identityPrefixes,
133
+ StepKindToStepIdentityPrefix: derivedStepKind.mapping,
134
+ },
135
+ DIAGNOSTICS: {
136
+ missingStepKindIdentityPrefixes: derivedStepKind.missing,
137
+ },
138
+ };
139
+ }
140
+ // PURE: Render helpers for TS keys/strings.
141
+ function escapeTsString(value) {
142
+ return value
143
+ .replace(/\\/g, '\\\\')
144
+ .replace(/\r/g, '\\r')
145
+ .replace(/\n/g, '\\n')
146
+ .replace(/\t/g, '\\t')
147
+ .replace(/'/g, "\\'");
148
+ }
149
+ function renderTsStringLiteral(value) {
150
+ return `'${escapeTsString(value)}'`;
151
+ }
152
+ function isValidTsIdentifier(key) {
153
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
154
+ }
155
+ function renderTsKey(key) {
156
+ return isValidTsIdentifier(key) ? key : renderTsStringLiteral(key);
157
+ }
158
+ // PURE: Render constants TypeScript source.
159
+ export function renderConstantsTs(constants) {
160
+ const nameKeys = Object.keys(constants.Names).sort((a, b) => a.localeCompare(b));
161
+ const enumKeys = Object.keys(constants.Enums).sort((a, b) => a.localeCompare(b));
162
+ const lines = [];
163
+ lines.push('const CONSTANTS = {');
164
+ lines.push(' Names: {');
165
+ for (const key of nameKeys) {
166
+ const value = constants.Names[key] ?? '';
167
+ lines.push(` ${renderTsKey(key)}: ${renderTsStringLiteral(value)},`);
168
+ }
169
+ lines.push(' },');
170
+ lines.push(' Enums: {');
171
+ for (const key of enumKeys) {
172
+ const members = constants.Enums[key] ?? {};
173
+ lines.push(` ${renderTsKey(key)}: {`);
174
+ for (const memberKey of Object.keys(members)) {
175
+ const value = members[memberKey] ?? '';
176
+ lines.push(` ${renderTsKey(memberKey)}: ${renderTsStringLiteral(value)},`);
177
+ }
178
+ lines.push(' },');
179
+ }
180
+ lines.push(' }');
181
+ lines.push('} as const;');
182
+ lines.push('');
183
+ lines.push('export default CONSTANTS;');
184
+ lines.push('');
185
+ return lines.join('\n');
186
+ }
187
+ // PURE: Render mappings TypeScript source.
188
+ export function renderMappingsTs(mappings) {
189
+ const identityKeys = Object.keys(mappings.IdentityNameToIdentityPrefix).sort((a, b) => a.localeCompare(b));
190
+ const stepKindKeys = Object.keys(mappings.StepKindToStepIdentityPrefix).sort((a, b) => a.localeCompare(b));
191
+ const lines = [];
192
+ lines.push('const MAPPINGS = {');
193
+ lines.push(' IdentityNameToIdentityPrefix: {');
194
+ for (const key of identityKeys) {
195
+ const value = mappings.IdentityNameToIdentityPrefix[key] ?? '';
196
+ lines.push(` ${renderTsKey(key)}: ${renderTsStringLiteral(value)},`);
197
+ }
198
+ lines.push(' },');
199
+ lines.push(' StepKindToStepIdentityPrefix: {');
200
+ for (const key of stepKindKeys) {
201
+ const value = mappings.StepKindToStepIdentityPrefix[key] ?? '';
202
+ lines.push(` ${renderTsKey(key)}: ${renderTsStringLiteral(value)},`);
203
+ }
204
+ lines.push(' },');
205
+ lines.push('} as const;');
206
+ lines.push('');
207
+ lines.push('export default MAPPINGS;');
208
+ lines.push('');
209
+ return lines.join('\n');
210
+ }
211
+ // IMPURE: Script entrypoint (config + filesystem I/O + console + process exit code).
212
+ function main() {
213
+ try {
214
+ const config = getConfig();
215
+ const inPath = config.getSchemaPath('Genesis.json');
216
+ const outConstantsPath = config.getArtifactsPath('constants.ts');
217
+ const outMappingsPath = config.getArtifactsPath('mappings.ts');
218
+ if (!fs.existsSync(inPath)) {
219
+ throw new Error(`Genesis schema not found at ${inPath}. Run extractSchemasFromResourceTypeShells first.`);
220
+ }
221
+ const raw = fs.readFileSync(inPath, 'utf8');
222
+ const doc = JSON.parse(raw);
223
+ const { CONSTANTS, MAPPINGS, DIAGNOSTICS } = extractGeneratedConstantsAndMappings(doc);
224
+ if (DIAGNOSTICS.missingStepKindIdentityPrefixes.length) {
225
+ const rows = DIAGNOSTICS.missingStepKindIdentityPrefixes
226
+ .map(({ stepKind, identityName }) => `${stepKind} -> ${identityName}`)
227
+ .join(', ');
228
+ throw new Error(`Missing IdentityNameToIdentityPrefix entries required for StepKindToStepIdentityPrefix: ${rows}`);
229
+ }
230
+ const constantsTs = renderConstantsTs(CONSTANTS);
231
+ const mappingsTs = renderMappingsTs(MAPPINGS);
232
+ fs.mkdirSync(path.dirname(outConstantsPath), { recursive: true });
233
+ fs.writeFileSync(outConstantsPath, constantsTs, 'utf8');
234
+ fs.writeFileSync(outMappingsPath, mappingsTs, 'utf8');
235
+ console.log(`Wrote constants to ${outConstantsPath}`);
236
+ console.log(`Wrote mappings to ${outMappingsPath}`);
237
+ }
238
+ catch (error) {
239
+ console.error(`Error generating constants/mappings: ${error?.message ?? error}`);
240
+ process.exitCode = 1;
241
+ }
242
+ }
243
+ main();
@@ -88,7 +88,7 @@ function main() {
88
88
  try {
89
89
  const config = getConfig();
90
90
  const inPath = config.getSchemaPath("Genesis.json");
91
- const outPath = config.getDependencyMapPath();
91
+ const outPath = config.getArtifactsPath("dependencyMap.json");
92
92
  if (!fs.existsSync(inPath)) {
93
93
  throw new Error(`Genesis schema not found at ${inPath}. Run extractSchemasFromResourceTypeShells first.`);
94
94
  }
@@ -37,8 +37,8 @@ function computeTerminalsInKeyOrder(dependencyMap) {
37
37
  function main() {
38
38
  try {
39
39
  const config = getConfig();
40
- const inPath = config.getDependencyMapPath();
41
- const outPath = path.join(path.dirname(inPath), "terminals.json");
40
+ const inPath = config.getArtifactsPath("dependencyMap.json");
41
+ const outPath = config.getArtifactsPath("terminals.json");
42
42
  if (!fs.existsSync(inPath)) {
43
43
  throw new Error(`Dependency map not found at ${inPath}. Run generateDependencies first.`);
44
44
  }
@@ -227,6 +227,48 @@ function removeDuplicateUnionEntries(ts) {
227
227
  function escapeRegExpLiteral(value) {
228
228
  return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
229
229
  }
230
+ // PURE: Derive the TS value type for JobStepSocket from Genesis.json.
231
+ // We prefer to match the schema shape:
232
+ // JobStepSocket.additionalProperties.oneOf = [#ResourcePotential, #Resource]
233
+ // so the emitted TS becomes:
234
+ // Record<ResourceRoleIdentity, Resource | ResourcePotential>
235
+ function deriveJobStepSocketValueType(parsedSchema) {
236
+ // NOTE: The generator reads from `src/generated/schemas/Genesis.json`, where `$defs.*`
237
+ // entries are plain JSON-Schema objects.
238
+ // The source-of-truth `src/Genesis.json` uses a wrapper shape:
239
+ // $defs.X = { identity, name, description, nucleusSchema: { ...actual schema... } }
240
+ // Support both.
241
+ const defs = parsedSchema?.$defs ?? parsedSchema?.nucleusSchema?.$defs;
242
+ const def = defs?.JobStepSocket;
243
+ const schemaNode = def?.nucleusSchema ?? def;
244
+ const additionalProperties = schemaNode?.additionalProperties;
245
+ if (!additionalProperties || typeof additionalProperties !== 'object' || Array.isArray(additionalProperties)) {
246
+ return 'Resource';
247
+ }
248
+ const union = additionalProperties.oneOf ??
249
+ additionalProperties.anyOf;
250
+ if (!Array.isArray(union) || union.length === 0) {
251
+ return 'Resource';
252
+ }
253
+ const names = [];
254
+ for (const item of union) {
255
+ const ref = item && typeof item === 'object' ? item.$ref : undefined;
256
+ if (typeof ref !== 'string')
257
+ continue;
258
+ // Accept both internal anchor refs like "#Resource" and JSON Pointer refs like "#/$defs/Resource".
259
+ const m = /^#(?:\/(?:\$defs|definitions)\/)?([A-Za-z_][A-Za-z0-9_]*)$/.exec(ref);
260
+ if (m)
261
+ names.push(m[1]);
262
+ }
263
+ const unique = Array.from(new Set(names));
264
+ if (!unique.length)
265
+ return 'Resource';
266
+ // Preserve an intentional ordering when we recognize the canonical pair.
267
+ if (unique.includes('Resource') && unique.includes('ResourcePotential')) {
268
+ return 'Resource | ResourcePotential';
269
+ }
270
+ return unique.join(' | ');
271
+ }
230
272
  // PURE: Fix a known json-schema-to-typescript edge case where a JSON-like recursive value union
231
273
  // accidentally includes a direct self-reference (`| JsonData`) instead of the intended array case (`| JsonData[]`).
232
274
  function fixJsonDataSelfReference(ts) {
@@ -309,10 +351,13 @@ function postProcessEmittedTypes(ts, parsedSchema) {
309
351
  ts = ts.replace(/export interface RoleMap\s*{[^}]*}/g, `export type RoleMap = Record<${resourceRoleKeyType}, ResourceRoleValue>;`);
310
352
  // Normalize StrategyState & related socket maps to identity-keyed Records.
311
353
  // These are emitted as `[k: string]` by json-schema-to-typescript but are identity-keyed in practice.
312
- // Per schema: JobStepSocket: Record<ResourceRoleIdentity, Resource>
354
+ // Per schema: JobStepSocket: Record<ResourceRoleIdentity, Resource | ResourcePotential>
313
355
  // StrategyState: Record<JobStepIdentity, JobStepSocket>
314
- const jobStepSocketValueType = 'Resource';
356
+ const jobStepSocketValueType = deriveJobStepSocketValueType(parsedSchema);
315
357
  ts = ts.replace(/export interface JobStepSocket\s*\{\s*\[k:\s*string\]:\s*[^;]+;\s*\}/g, `export type JobStepSocket = Record<${resourceRoleKeyType}, ${jobStepSocketValueType}>;`);
358
+ // If the upstream generator (or earlier passes) already emitted a Record-based alias,
359
+ // force its value type to match the schema-derived union.
360
+ ts = ts.replace(/export\s+type\s+JobStepSocket\s*=\s*Record<\s*ResourceRoleIdentity\s*,\s*[^>]+>\s*;/g, `export type JobStepSocket = Record<${resourceRoleKeyType}, ${jobStepSocketValueType}>;`);
316
361
  ts = ts.replace(/export interface StrategyState\s*\{\s*\[k:\s*string\]:\s*JobStepSocket;\s*\}/g, `export type StrategyState = Record<${jobStepKeyType}, JobStepSocket>;`);
317
362
  ts = ts.replace(/(strategyStateUpdate\??:\s*)\{\s*\[k:\s*string\]:\s*JobStepSocket;\s*\};/g, `$1Record<${jobStepKeyType}, JobStepSocket>;`);
318
363
  // Ensure key constraints for strategyThreadMap are preserved as template-literal identity keys.
@@ -22,8 +22,10 @@ function generateResourceShellLogic(genesis) {
22
22
  resourceRoleHandle: 'ROLE-Genesis',
23
23
  jobStepHandle: 'JOB_STEP-Genesis'
24
24
  },
25
- kind: 'materialized',
25
+ resourceShellKind: 'materialized',
26
+ version: 1,
26
27
  timestamp: genesisTimestamp,
28
+ path: 'https://schemas.toolproof.com/v1/Genesis.json',
27
29
  nucleus: {}
28
30
  };
29
31
  defKeys.forEach((defName) => {
@@ -33,10 +35,12 @@ function generateResourceShellLogic(genesis) {
33
35
  resourceTypeHandle: 'TYPE-ResourceType',
34
36
  creationContext: {
35
37
  resourceRoleHandle: 'ROLE-Genesis',
36
- jobStepHandle: `JOB_STEP-${defName}`
38
+ jobStepHandle: 'JOB_STEP-Genesis'
37
39
  },
38
- kind: 'materialized',
40
+ resourceShellKind: 'materialized',
41
+ version: 1,
39
42
  timestamp: genesisTimestamp,
43
+ path: `https://schemas.toolproof.com/v1/Genesis.json#/$defs/${defName}`,
40
44
  nucleus: defValue
41
45
  };
42
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolproof-core/schema",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "JSON schemas and TypeScript types for ToolProof",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,9 +39,9 @@
39
39
  "wrapResourceTypesWithResourceShells": "node ./dist/scripts/wrapResourceTypesWithResourceShells.js",
40
40
  "generateSchemaShims": "node ./dist/scripts/generateSchemaShims.js",
41
41
  "generateDependencies": "node ./dist/scripts/generateDependencies.js",
42
- "generateConstants": "node ./dist/scripts/generateConstants.js",
42
+ "generateConstantsAndMappings": "node ./dist/scripts/generateConstantsAndMappings.js",
43
43
  "generateTerminals": "node ./dist/scripts/generateTerminals.js",
44
44
  "generateResourceTypeGenesisType": "node ./dist/scripts/generateStandaloneType.js --name Genesis",
45
- "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run normalizeAnchorsToPointers && pnpm run extractSchemasFromResourceTypeShells && pnpm run generateConstants && pnpm run generateStandaloneSchema -- --name Job && pnpm run generateStandaloneSchema -- --name ResourceType && pnpm run generateStandaloneSchema -- --name RawStrategy && pnpm run generateStandaloneSchema -- --name RunnableStrategy && pnpm run generateStandaloneSchema -- --name StrategyRun && pnpm run generateStandaloneSchema -- --name Goal && pnpm run wrapResourceTypesWithResourceShells && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateStandaloneType -- --name Job && pnpm run generateStandaloneType -- --name ResourceType && pnpm run generateStandaloneType -- --name RawStrategy && pnpm run generateStandaloneType -- --name RunnableStrategy && pnpm run generateResourceTypeGenesisType && pnpm run generateDependencies && pnpm run generateTerminals && pnpm run build"
45
+ "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run normalizeAnchorsToPointers && pnpm run extractSchemasFromResourceTypeShells && pnpm run generateConstantsAndMappings && pnpm run generateStandaloneSchema -- --name Job && pnpm run generateStandaloneSchema -- --name ResourceType && pnpm run generateStandaloneSchema -- --name RawStrategy && pnpm run generateStandaloneSchema -- --name RunnableStrategy && pnpm run generateStandaloneSchema -- --name StrategyRun && pnpm run generateStandaloneSchema -- --name Goal && pnpm run wrapResourceTypesWithResourceShells && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateStandaloneType -- --name Job && pnpm run generateStandaloneType -- --name ResourceType && pnpm run generateStandaloneType -- --name RawStrategy && pnpm run generateStandaloneType -- --name RunnableStrategy && pnpm run generateResourceTypeGenesisType && pnpm run generateDependencies && pnpm run generateTerminals && pnpm run build"
46
46
  }
47
47
  }
package/src/Genesis.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nucleusSchema": {
6
6
  "$comment": "This file defines all schemas used internally by ToolProof.",
7
7
  "$anchor": "Genesis",
8
- "$id": "https://schemas.toolproof.com/v2/Genesis.json",
8
+ "$id": "https://schemas.toolproof.com/v1/Genesis.json",
9
9
  "$schema": "https://json-schema.org/draft/2020-12/schema",
10
10
  "$defs": {
11
11
  "Name": {
@@ -259,6 +259,7 @@
259
259
  "$ref": "#RoleMap"
260
260
  },
261
261
  {
262
+ "type": "object",
262
263
  "required": [
263
264
  "ROLE-ErrorOutput"
264
265
  ],
@@ -343,6 +344,7 @@
343
344
  "$ref": "#JobIdentity"
344
345
  },
345
346
  "implementationUri": {
347
+ "$comment": "Instances of a ResourceType that requires implementationUri are 'executable' ResourceTypes. TYPE-Job is the canonical executable ResourceType in the ecosystem.",
346
348
  "$ref": "#Uri"
347
349
  }
348
350
  },
@@ -756,7 +758,7 @@
756
758
  "required": [
757
759
  "identity",
758
760
  "resourceTypeHandle",
759
- "resourceKind"
761
+ "resourceShellKind"
760
762
  ],
761
763
  "properties": {
762
764
  "identity": {
@@ -765,18 +767,18 @@
765
767
  "resourceTypeHandle": {
766
768
  "$ref": "#ResourceTypeIdentity"
767
769
  },
768
- "resourceKind": {
769
- "$ref": "#ResourceKind"
770
+ "resourceShellKind": {
771
+ "$ref": "#ResourceShellKind"
770
772
  }
771
773
  }
772
774
  }
773
775
  },
774
- "ResourceKind": {
775
- "identity": "TYPE-ResourceKind",
776
- "name": "ResourceKind",
776
+ "ResourceShellKind": {
777
+ "identity": "TYPE-ResourceShellKind",
778
+ "name": "ResourceShellKind",
777
779
  "description": "dummy-description",
778
780
  "nucleusSchema": {
779
- "$anchor": "ResourceKind",
781
+ "$anchor": "ResourceShellKind",
780
782
  "$schema": "https://json-schema.org/draft/2020-12/schema",
781
783
  "type": "string",
782
784
  "enum": [
@@ -787,20 +789,20 @@
787
789
  ]
788
790
  }
789
791
  },
790
- "ResourceKindFacet": {
791
- "identity": "TYPE-ResourceKindFacet",
792
- "name": "ResourceKindFacet",
792
+ "ResourceShellKindFacet": {
793
+ "identity": "TYPE-ResourceShellKindFacet",
794
+ "name": "ResourceShellKindFacet",
793
795
  "description": "dummy-description",
794
796
  "nucleusSchema": {
795
- "$anchor": "ResourceKindFacet",
797
+ "$anchor": "ResourceShellKindFacet",
796
798
  "$schema": "https://json-schema.org/draft/2020-12/schema",
797
799
  "type": "object",
798
800
  "required": [
799
- "resourceKind"
801
+ "resourceShellKind"
800
802
  ],
801
803
  "properties": {
802
- "resourceKind": {
803
- "$ref": "#ResourceKind"
804
+ "resourceShellKind": {
805
+ "$ref": "#ResourceShellKind"
804
806
  }
805
807
  }
806
808
  }
@@ -813,8 +815,11 @@
813
815
  "$anchor": "ShellMissing",
814
816
  "$schema": "https://json-schema.org/draft/2020-12/schema",
815
817
  "type": "object",
818
+ "required": [
819
+ "resourceShellKind"
820
+ ],
816
821
  "properties": {
817
- "resourceKind": {
822
+ "resourceShellKind": {
818
823
  "const": "missing"
819
824
  }
820
825
  },
@@ -823,7 +828,7 @@
823
828
  "$ref": "#ResourceShellBase"
824
829
  },
825
830
  {
826
- "$ref": "#ResourceKindFacet"
831
+ "$ref": "#ResourceShellKindFacet"
827
832
  }
828
833
  ],
829
834
  "unevaluatedProperties": false
@@ -837,8 +842,11 @@
837
842
  "$anchor": "ShellInputPotential",
838
843
  "$schema": "https://json-schema.org/draft/2020-12/schema",
839
844
  "type": "object",
845
+ "required": [
846
+ "resourceShellKind"
847
+ ],
840
848
  "properties": {
841
- "resourceKind": {
849
+ "resourceShellKind": {
842
850
  "const": "inputPotential"
843
851
  }
844
852
  },
@@ -850,7 +858,7 @@
850
858
  "$ref": "#CreationContextFacet"
851
859
  },
852
860
  {
853
- "$ref": "#ResourceKindFacet"
861
+ "$ref": "#ResourceShellKindFacet"
854
862
  }
855
863
  ],
856
864
  "unevaluatedProperties": false
@@ -864,8 +872,11 @@
864
872
  "$anchor": "ShellOutputPotential",
865
873
  "$schema": "https://json-schema.org/draft/2020-12/schema",
866
874
  "type": "object",
875
+ "required": [
876
+ "resourceShellKind"
877
+ ],
867
878
  "properties": {
868
- "resourceKind": {
879
+ "resourceShellKind": {
869
880
  "const": "outputPotential"
870
881
  }
871
882
  },
@@ -877,7 +888,7 @@
877
888
  "$ref": "#CreationContextFacet"
878
889
  },
879
890
  {
880
- "$ref": "#ResourceKindFacet"
891
+ "$ref": "#ResourceShellKindFacet"
881
892
  }
882
893
  ],
883
894
  "unevaluatedProperties": false
@@ -950,13 +961,14 @@
950
961
  "$schema": "https://json-schema.org/draft/2020-12/schema",
951
962
  "type": "object",
952
963
  "required": [
953
- "version"
964
+ "version",
965
+ "resourceShellKind"
954
966
  ],
955
967
  "properties": {
956
968
  "version": {
957
969
  "const": 1
958
970
  },
959
- "resourceKind": {
971
+ "resourceShellKind": {
960
972
  "const": "materialized"
961
973
  }
962
974
  },
@@ -968,7 +980,7 @@
968
980
  "$ref": "#CreationContextFacet"
969
981
  },
970
982
  {
971
- "$ref": "#ResourceKindFacet"
983
+ "$ref": "#ResourceShellKindFacet"
972
984
  },
973
985
  {
974
986
  "$ref": "#TimestampFacet"
@@ -1027,6 +1039,28 @@
1027
1039
  "unevaluatedProperties": false
1028
1040
  }
1029
1041
  },
1042
+ "ResourcePotential": {
1043
+ "identity": "TYPE-ResourcePotential",
1044
+ "name": "ResourcePotential",
1045
+ "description": "dummy-description",
1046
+ "nucleusSchema": {
1047
+ "$anchor": "ResourcePotential",
1048
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1049
+ "type": "object",
1050
+ "oneOf": [
1051
+ {
1052
+ "$ref": "#ResourceMissing"
1053
+ },
1054
+ {
1055
+ "$ref": "#ResourceInputPotential"
1056
+ },
1057
+ {
1058
+ "$ref": "#ResourceOutputPotential"
1059
+ }
1060
+ ],
1061
+ "unevaluatedProperties": false
1062
+ }
1063
+ },
1030
1064
  "JsonData": {
1031
1065
  "identity": "TYPE-JsonData",
1032
1066
  "name": "JsonData",
@@ -1087,32 +1121,10 @@
1087
1121
  "nucleus"
1088
1122
  ],
1089
1123
  "properties": {
1090
- "nucleus": {
1091
- "$ref": "#Nucleus"
1092
- }
1124
+ "nucleus": true
1093
1125
  }
1094
1126
  }
1095
1127
  },
1096
- "ResourceMaterialized": {
1097
- "identity": "TYPE-ResourceMaterialized",
1098
- "name": "ResourceMaterialized",
1099
- "description": "dummy-description",
1100
- "nucleusSchema": {
1101
- "$anchor": "ResourceMaterialized",
1102
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1103
- "type": "object",
1104
- "allOf": [
1105
- {
1106
- "$ref": "#ShellMaterializedBase"
1107
- },
1108
- {
1109
- "$comment": "This will be overlayed dynamically to match the data structure of the underlying ResourceType's nucleusSchema.",
1110
- "$ref": "#NucleusFacet"
1111
- }
1112
- ],
1113
- "unevaluatedProperties": false
1114
- }
1115
- },
1116
1128
  "Resource": {
1117
1129
  "identity": "TYPE-Resource",
1118
1130
  "name": "Resource",
@@ -1121,18 +1133,13 @@
1121
1133
  "$anchor": "Resource",
1122
1134
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1123
1135
  "type": "object",
1124
- "oneOf": [
1125
- {
1126
- "$ref": "#ResourceMissing"
1127
- },
1128
- {
1129
- "$ref": "#ResourceInputPotential"
1130
- },
1136
+ "allOf": [
1131
1137
  {
1132
- "$ref": "#ResourceOutputPotential"
1138
+ "$ref": "#ShellMaterializedBase"
1133
1139
  },
1134
1140
  {
1135
- "$ref": "#ResourceMaterialized"
1141
+ "$comment": "This will be overlayed dynamically to match the data structure of the underlying ResourceType's nucleusSchema.",
1142
+ "$ref": "#NucleusFacet"
1136
1143
  }
1137
1144
  ],
1138
1145
  "unevaluatedProperties": false
@@ -1150,7 +1157,14 @@
1150
1157
  "$ref": "#ResourceRoleIdentity"
1151
1158
  },
1152
1159
  "additionalProperties": {
1153
- "$ref": "#Resource"
1160
+ "oneOf": [
1161
+ {
1162
+ "$ref": "#ResourcePotential"
1163
+ },
1164
+ {
1165
+ "$ref": "#Resource"
1166
+ }
1167
+ ]
1154
1168
  }
1155
1169
  }
1156
1170
  },