@toolproof-npm/schema 0.1.47 → 0.1.49
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.
- package/dist/genesis/generated/resources/Genesis.json +7 -2
- package/dist/genesis/generated/schemas/Genesis.json +8 -3
- package/dist/genesis/generated/schemas/ResourceType.json +8 -3
- package/dist/genesis/generated/types/Resource_Job.d.ts +2 -55
- package/dist/genesis/generated/types/Resource_ResourceFormat.d.ts +2 -40
- package/dist/genesis/generated/types/Resource_ResourceType.d.ts +2 -61
- package/dist/genesis/generated/types/Resource_StatelessStrategy.d.ts +2 -79
- package/dist/genesis/resourceTypes/Genesis.json +7 -2
- package/dist/scripts/generateResourceTypeType.js +26 -70
- package/package.json +1 -1
|
@@ -585,8 +585,7 @@
|
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
}
|
|
589
|
-
"additionalProperties": false
|
|
588
|
+
}
|
|
590
589
|
}
|
|
591
590
|
}
|
|
592
591
|
},
|
|
@@ -659,6 +658,9 @@
|
|
|
659
658
|
"properties": {
|
|
660
659
|
"properties": {
|
|
661
660
|
"type": "object",
|
|
661
|
+
"required": [
|
|
662
|
+
"identity"
|
|
663
|
+
],
|
|
662
664
|
"properties": {
|
|
663
665
|
"identity": {}
|
|
664
666
|
}
|
|
@@ -688,6 +690,9 @@
|
|
|
688
690
|
"properties": {
|
|
689
691
|
"properties": {
|
|
690
692
|
"type": "object",
|
|
693
|
+
"required": [
|
|
694
|
+
"merit"
|
|
695
|
+
],
|
|
691
696
|
"properties": {
|
|
692
697
|
"merit": {}
|
|
693
698
|
}
|
|
@@ -164,7 +164,10 @@
|
|
|
164
164
|
"type": "object",
|
|
165
165
|
"properties": {
|
|
166
166
|
"identity": {}
|
|
167
|
-
}
|
|
167
|
+
},
|
|
168
|
+
"required": [
|
|
169
|
+
"identity"
|
|
170
|
+
]
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
},
|
|
@@ -193,7 +196,10 @@
|
|
|
193
196
|
"type": "object",
|
|
194
197
|
"properties": {
|
|
195
198
|
"merit": {}
|
|
196
|
-
}
|
|
199
|
+
},
|
|
200
|
+
"required": [
|
|
201
|
+
"merit"
|
|
202
|
+
]
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
205
|
},
|
|
@@ -641,7 +647,6 @@
|
|
|
641
647
|
"required",
|
|
642
648
|
"properties"
|
|
643
649
|
],
|
|
644
|
-
"additionalProperties": false,
|
|
645
650
|
"$anchor": "MeritProp"
|
|
646
651
|
},
|
|
647
652
|
"MeritSchema": {
|
|
@@ -138,7 +138,10 @@
|
|
|
138
138
|
"type": "object",
|
|
139
139
|
"properties": {
|
|
140
140
|
"identity": {}
|
|
141
|
-
}
|
|
141
|
+
},
|
|
142
|
+
"required": [
|
|
143
|
+
"identity"
|
|
144
|
+
]
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
},
|
|
@@ -167,7 +170,10 @@
|
|
|
167
170
|
"type": "object",
|
|
168
171
|
"properties": {
|
|
169
172
|
"merit": {}
|
|
170
|
-
}
|
|
173
|
+
},
|
|
174
|
+
"required": [
|
|
175
|
+
"merit"
|
|
176
|
+
]
|
|
171
177
|
}
|
|
172
178
|
}
|
|
173
179
|
},
|
|
@@ -337,7 +343,6 @@
|
|
|
337
343
|
"required",
|
|
338
344
|
"properties"
|
|
339
345
|
],
|
|
340
|
-
"additionalProperties": false,
|
|
341
346
|
"$anchor": "MeritProp"
|
|
342
347
|
},
|
|
343
348
|
"IdentitySchema": {
|
|
@@ -1,56 +1,3 @@
|
|
|
1
1
|
// Auto-generated strict composite type. Do not edit.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type ResourceMetaBase = ResourceBase &
|
|
6
|
-
CreationContextWrapper &
|
|
7
|
-
ResourceKind & {
|
|
8
|
-
kind: "materialized";
|
|
9
|
-
} & Timestamp &
|
|
10
|
-
Path;
|
|
11
|
-
export type ResourceBase = {
|
|
12
|
-
identity: string;
|
|
13
|
-
resourceTypeRef: string;
|
|
14
|
-
};
|
|
15
|
-
export type Job = {
|
|
16
|
-
identity: string;
|
|
17
|
-
implementationUri: string;
|
|
18
|
-
} & Documented &
|
|
19
|
-
RolesWrapper;
|
|
20
|
-
export type Documented = Named & Described;
|
|
21
|
-
export type ResourceRoleValue = {
|
|
22
|
-
resourceTypeRef: string;
|
|
23
|
-
} & Documented;
|
|
24
|
-
|
|
25
|
-
export interface CreationContextWrapper {
|
|
26
|
-
creationContext: CreationContext;
|
|
27
|
-
}
|
|
28
|
-
export interface CreationContext {
|
|
29
|
-
executionRef: string;
|
|
30
|
-
resourceRoleRef: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ResourceKind {
|
|
33
|
-
kind: "missing" | "potential-input" | "potential-output" | "materialized";
|
|
34
|
-
}
|
|
35
|
-
export interface Timestamp {
|
|
36
|
-
timestamp: string;
|
|
37
|
-
}
|
|
38
|
-
export interface Path {
|
|
39
|
-
path: string;
|
|
40
|
-
}
|
|
41
|
-
export interface Named {
|
|
42
|
-
name: string;
|
|
43
|
-
}
|
|
44
|
-
export interface Described {
|
|
45
|
-
description: string;
|
|
46
|
-
}
|
|
47
|
-
export interface RolesWrapper {
|
|
48
|
-
roles: Roles;
|
|
49
|
-
}
|
|
50
|
-
export interface Roles {
|
|
51
|
-
inputMap: RoleMap;
|
|
52
|
-
outputMap: RoleMap;
|
|
53
|
-
}
|
|
54
|
-
export interface RoleMap {
|
|
55
|
-
[k: string]: ResourceRoleValue;
|
|
56
|
-
}
|
|
2
|
+
import type { ResourceMetaBase, Job as ExtractedData } from './types.js';
|
|
3
|
+
export type Resource_Job = ResourceMetaBase & { extractedData: ExtractedData };
|
|
@@ -1,41 +1,3 @@
|
|
|
1
1
|
// Auto-generated strict composite type. Do not edit.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type ResourceMetaBase = ResourceBase &
|
|
6
|
-
CreationContextWrapper &
|
|
7
|
-
ResourceKind & {
|
|
8
|
-
kind: "materialized";
|
|
9
|
-
} & Timestamp &
|
|
10
|
-
Path;
|
|
11
|
-
export type ResourceBase = {
|
|
12
|
-
identity: string;
|
|
13
|
-
resourceTypeRef: string;
|
|
14
|
-
};
|
|
15
|
-
export type ResourceFormat = {
|
|
16
|
-
identity: string;
|
|
17
|
-
} & Documented;
|
|
18
|
-
export type Documented = Named & Described;
|
|
19
|
-
|
|
20
|
-
export interface CreationContextWrapper {
|
|
21
|
-
creationContext: CreationContext;
|
|
22
|
-
}
|
|
23
|
-
export interface CreationContext {
|
|
24
|
-
executionRef: string;
|
|
25
|
-
resourceRoleRef: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ResourceKind {
|
|
28
|
-
kind: "missing" | "potential-input" | "potential-output" | "materialized";
|
|
29
|
-
}
|
|
30
|
-
export interface Timestamp {
|
|
31
|
-
timestamp: string;
|
|
32
|
-
}
|
|
33
|
-
export interface Path {
|
|
34
|
-
path: string;
|
|
35
|
-
}
|
|
36
|
-
export interface Named {
|
|
37
|
-
name: string;
|
|
38
|
-
}
|
|
39
|
-
export interface Described {
|
|
40
|
-
description: string;
|
|
41
|
-
}
|
|
2
|
+
import type { ResourceMetaBase, ResourceFormat as ExtractedData } from './types.js';
|
|
3
|
+
export type Resource_ResourceFormat = ResourceMetaBase & { extractedData: ExtractedData };
|
|
@@ -1,62 +1,3 @@
|
|
|
1
1
|
// Auto-generated strict composite type. Do not edit.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type ResourceMetaBase = ResourceBase &
|
|
6
|
-
CreationContextWrapper &
|
|
7
|
-
ResourceKind & {
|
|
8
|
-
kind: "materialized";
|
|
9
|
-
} & Timestamp &
|
|
10
|
-
Path;
|
|
11
|
-
export type ResourceBase = {
|
|
12
|
-
identity: string;
|
|
13
|
-
resourceTypeRef: string;
|
|
14
|
-
};
|
|
15
|
-
export type ResourceType = {
|
|
16
|
-
identity: string;
|
|
17
|
-
resourceFormatRef: string;
|
|
18
|
-
} & Documented &
|
|
19
|
-
ExtractionSchemaWrapper & {
|
|
20
|
-
};
|
|
21
|
-
export type Documented = Named & Described;
|
|
22
|
-
export type ExtractionSchema = {
|
|
23
|
-
} & {
|
|
24
|
-
$schema: "https://json-schema.org/draft/2020-12/schema";
|
|
25
|
-
$defs?: {
|
|
26
|
-
};
|
|
27
|
-
type: "object";
|
|
28
|
-
allOf?: {
|
|
29
|
-
}[];
|
|
30
|
-
properties?: {
|
|
31
|
-
};
|
|
32
|
-
required?: string[];
|
|
33
|
-
additionalProperties?: false;
|
|
34
|
-
unevaluatedProperties?: false;
|
|
35
|
-
$anchor: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export interface CreationContextWrapper {
|
|
39
|
-
creationContext: CreationContext;
|
|
40
|
-
}
|
|
41
|
-
export interface CreationContext {
|
|
42
|
-
executionRef: string;
|
|
43
|
-
resourceRoleRef: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ResourceKind {
|
|
46
|
-
kind: "missing" | "potential-input" | "potential-output" | "materialized";
|
|
47
|
-
}
|
|
48
|
-
export interface Timestamp {
|
|
49
|
-
timestamp: string;
|
|
50
|
-
}
|
|
51
|
-
export interface Path {
|
|
52
|
-
path: string;
|
|
53
|
-
}
|
|
54
|
-
export interface Named {
|
|
55
|
-
name: string;
|
|
56
|
-
}
|
|
57
|
-
export interface Described {
|
|
58
|
-
description: string;
|
|
59
|
-
}
|
|
60
|
-
export interface ExtractionSchemaWrapper {
|
|
61
|
-
extractionSchema: ExtractionSchema;
|
|
62
|
-
}
|
|
2
|
+
import type { ResourceMetaBase, ResourceType as ExtractedData } from './types.js';
|
|
3
|
+
export type Resource_ResourceType = ResourceMetaBase & { extractedData: ExtractedData };
|
|
@@ -1,80 +1,3 @@
|
|
|
1
1
|
// Auto-generated strict composite type. Do not edit.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type ResourceMetaBase = ResourceBase &
|
|
6
|
-
CreationContextWrapper &
|
|
7
|
-
ResourceKind & {
|
|
8
|
-
kind: "materialized";
|
|
9
|
-
} & Timestamp &
|
|
10
|
-
Path;
|
|
11
|
-
export type ResourceBase = {
|
|
12
|
-
identity: string;
|
|
13
|
-
resourceTypeRef: string;
|
|
14
|
-
};
|
|
15
|
-
export type StatelessStrategy = {
|
|
16
|
-
identity: string;
|
|
17
|
-
steps: Step[];
|
|
18
|
-
};
|
|
19
|
-
export type Step = WorkStep | BranchStep | WhileStep | ForStep;
|
|
20
|
-
export type WorkStep = StepKind & {
|
|
21
|
-
execution: Execution;
|
|
22
|
-
identity: string;
|
|
23
|
-
kind: "work";
|
|
24
|
-
};
|
|
25
|
-
export type Execution = {
|
|
26
|
-
identity: string;
|
|
27
|
-
jobRef: string;
|
|
28
|
-
} & RoleBindingsWrapper;
|
|
29
|
-
export type BranchStep = StepKind & {
|
|
30
|
-
/**
|
|
31
|
-
* @minItems 1
|
|
32
|
-
*/
|
|
33
|
-
cases: [Conditional, ...Conditional[]];
|
|
34
|
-
identity: string;
|
|
35
|
-
kind: "branch";
|
|
36
|
-
};
|
|
37
|
-
export type WhileStep = StepKind & {
|
|
38
|
-
case: Conditional;
|
|
39
|
-
identity: string;
|
|
40
|
-
kind: "while";
|
|
41
|
-
};
|
|
42
|
-
export type ForStep = StepKind & {
|
|
43
|
-
case: Conditional;
|
|
44
|
-
identity: string;
|
|
45
|
-
kind: "for";
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export interface CreationContextWrapper {
|
|
49
|
-
creationContext: CreationContext;
|
|
50
|
-
}
|
|
51
|
-
export interface CreationContext {
|
|
52
|
-
executionRef: string;
|
|
53
|
-
resourceRoleRef: string;
|
|
54
|
-
}
|
|
55
|
-
export interface ResourceKind {
|
|
56
|
-
kind: "missing" | "potential-input" | "potential-output" | "materialized";
|
|
57
|
-
}
|
|
58
|
-
export interface Timestamp {
|
|
59
|
-
timestamp: string;
|
|
60
|
-
}
|
|
61
|
-
export interface Path {
|
|
62
|
-
path: string;
|
|
63
|
-
}
|
|
64
|
-
export interface StepKind {
|
|
65
|
-
kind: "work" | "branch" | "while" | "for";
|
|
66
|
-
}
|
|
67
|
-
export interface RoleBindingsWrapper {
|
|
68
|
-
roleBindings: RoleBindings;
|
|
69
|
-
}
|
|
70
|
-
export interface RoleBindings {
|
|
71
|
-
inputBindingMap: RoleBindingMap;
|
|
72
|
-
outputBindingMap: RoleBindingMap;
|
|
73
|
-
}
|
|
74
|
-
export interface RoleBindingMap {
|
|
75
|
-
[k: string]: string;
|
|
76
|
-
}
|
|
77
|
-
export interface Conditional {
|
|
78
|
-
what: WorkStep;
|
|
79
|
-
when: WorkStep;
|
|
80
|
-
}
|
|
2
|
+
import type { ResourceMetaBase, StatelessStrategy as ExtractedData } from './types.js';
|
|
3
|
+
export type Resource_StatelessStrategy = ResourceMetaBase & { extractedData: ExtractedData };
|
|
@@ -494,8 +494,7 @@
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
}
|
|
498
|
-
"additionalProperties": false
|
|
497
|
+
}
|
|
499
498
|
}
|
|
500
499
|
},
|
|
501
500
|
"ExtractionSchema": {
|
|
@@ -558,6 +557,9 @@
|
|
|
558
557
|
"properties": {
|
|
559
558
|
"properties": {
|
|
560
559
|
"type": "object",
|
|
560
|
+
"required": [
|
|
561
|
+
"identity"
|
|
562
|
+
],
|
|
561
563
|
"properties": {
|
|
562
564
|
"identity": {}
|
|
563
565
|
}
|
|
@@ -587,6 +589,9 @@
|
|
|
587
589
|
"properties": {
|
|
588
590
|
"properties": {
|
|
589
591
|
"type": "object",
|
|
592
|
+
"required": [
|
|
593
|
+
"merit"
|
|
594
|
+
],
|
|
590
595
|
"properties": {
|
|
591
596
|
"merit": {}
|
|
592
597
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { compileFromFile } from 'json-schema-to-typescript';
|
|
4
2
|
import { getConfig } from './_lib/config.js';
|
|
5
3
|
/**
|
|
6
4
|
* Generate a typed Resource variant where `extractedData` is typed to a specific schema
|
|
@@ -15,8 +13,6 @@ async function main() {
|
|
|
15
13
|
console.error('Missing --name <SchemaBasename> argument');
|
|
16
14
|
process.exit(1);
|
|
17
15
|
}
|
|
18
|
-
const projectRoot = config.getRoot();
|
|
19
|
-
const schemasDir = config.getOutputDir();
|
|
20
16
|
const inPath = config.getOutputPath(`${name}.json`);
|
|
21
17
|
if (!fs.existsSync(inPath)) {
|
|
22
18
|
console.error(`Schema file not found: ${inPath}`);
|
|
@@ -46,73 +42,33 @@ async function main() {
|
|
|
46
42
|
const outPath = config.getTypesSrcPath(outName);
|
|
47
43
|
const outJsName = `Resource_${name}.js`;
|
|
48
44
|
const outJsPath = config.getTypesSrcPath(outJsName);
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
],
|
|
67
|
-
unevaluatedProperties: false
|
|
68
|
-
};
|
|
69
|
-
// Write composite schema
|
|
70
|
-
fs.writeFileSync(compositePath, JSON.stringify(compositeSchema, null, 2), 'utf8');
|
|
71
|
-
try {
|
|
72
|
-
// Compile to TypeScript declarations
|
|
73
|
-
let ts = await compileFromFile(compositePath, {
|
|
74
|
-
bannerComment: '',
|
|
75
|
-
declareExternallyReferenced: true,
|
|
76
|
-
unreachableDefinitions: true,
|
|
77
|
-
$refOptions: {
|
|
78
|
-
resolve: {
|
|
79
|
-
file: { order: 1 },
|
|
80
|
-
http: false,
|
|
81
|
-
https: false
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
// Remove noisy index signatures that make types too permissive
|
|
86
|
-
ts = ts.replace(/\n\s*\[k:\s*string\]:\s*unknown;\n/g, '\n');
|
|
87
|
-
// Ensure it is a module
|
|
88
|
-
if (!/\bexport\b/.test(ts)) {
|
|
89
|
-
ts += '\nexport {}\n';
|
|
90
|
-
}
|
|
91
|
-
const header = '// Auto-generated strict composite type. Do not edit.\n';
|
|
92
|
-
fs.writeFileSync(outPath, header + ts, 'utf8');
|
|
93
|
-
console.log(`Wrote ${outPath}`);
|
|
94
|
-
// Ensure a runtime-resolvable JS shim exists alongside the .d.ts for NodeNext resolution
|
|
95
|
-
if (!fs.existsSync(outJsPath)) {
|
|
96
|
-
fs.writeFileSync(outJsPath, 'export {}\n', 'utf8');
|
|
97
|
-
console.log(`Wrote ${outJsPath}`);
|
|
98
|
-
}
|
|
99
|
-
// Also copy both files into dist so consumers can resolve the module and its types
|
|
100
|
-
const distLibDir = config.getTypesDistDir();
|
|
101
|
-
fs.mkdirSync(distLibDir, { recursive: true });
|
|
102
|
-
const distDtsPath = config.getTypesDistPath(outName);
|
|
103
|
-
const distJsPath = config.getTypesDistPath(outJsName);
|
|
104
|
-
fs.writeFileSync(distDtsPath, header + ts, 'utf8');
|
|
105
|
-
fs.writeFileSync(distJsPath, 'export {}\n', 'utf8');
|
|
106
|
-
console.log(`Wrote ${distDtsPath}`);
|
|
107
|
-
console.log(`Wrote ${distJsPath}`);
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
// Cleanup composite schema file
|
|
111
|
-
try {
|
|
112
|
-
fs.unlinkSync(compositePath);
|
|
113
|
-
}
|
|
114
|
-
catch { }
|
|
45
|
+
// IMPORTANT:
|
|
46
|
+
// We intentionally do NOT re-run json-schema-to-typescript here.
|
|
47
|
+
// That path produces self-contained types that degrade schema-patterned identities/refs
|
|
48
|
+
// into plain `string`, which then becomes incompatible with our canonical branded
|
|
49
|
+
// identity types in `types.d.ts` (e.g. `ResourceIdentity = `RESOURCE-${string}``).
|
|
50
|
+
//
|
|
51
|
+
// Instead, we generate a tiny module that composes the canonical types:
|
|
52
|
+
// Resource_<Name> = ResourceMetaBase & { extractedData: <Name> }
|
|
53
|
+
const header = '// Auto-generated strict composite type. Do not edit.\n';
|
|
54
|
+
const ts = `import type { ResourceMetaBase, ${name} as ExtractedData } from './types.js';\n` +
|
|
55
|
+
`export type Resource_${name} = ResourceMetaBase & { extractedData: ExtractedData };\n`;
|
|
56
|
+
fs.writeFileSync(outPath, header + ts, 'utf8');
|
|
57
|
+
console.log(`Wrote ${outPath}`);
|
|
58
|
+
// Ensure a runtime-resolvable JS shim exists alongside the .d.ts for NodeNext resolution
|
|
59
|
+
if (!fs.existsSync(outJsPath)) {
|
|
60
|
+
fs.writeFileSync(outJsPath, 'export {}\n', 'utf8');
|
|
61
|
+
console.log(`Wrote ${outJsPath}`);
|
|
115
62
|
}
|
|
63
|
+
// Also copy both files into dist so consumers can resolve the module and its types
|
|
64
|
+
const distLibDir = config.getTypesDistDir();
|
|
65
|
+
fs.mkdirSync(distLibDir, { recursive: true });
|
|
66
|
+
const distDtsPath = config.getTypesDistPath(outName);
|
|
67
|
+
const distJsPath = config.getTypesDistPath(outJsName);
|
|
68
|
+
fs.writeFileSync(distDtsPath, header + ts, 'utf8');
|
|
69
|
+
fs.writeFileSync(distJsPath, 'export {}\n', 'utf8');
|
|
70
|
+
console.log(`Wrote ${distDtsPath}`);
|
|
71
|
+
console.log(`Wrote ${distJsPath}`);
|
|
116
72
|
}
|
|
117
73
|
function parseArgs(args) {
|
|
118
74
|
let name;
|