@toolproof-core/schema 1.0.16 → 1.0.17
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/generated/schemas/zod/Goal.d.ts +2 -0
- package/dist/generated/schemas/zod/Goal.js +5 -0
- package/dist/generated/schemas/zod/Job.d.ts +6 -0
- package/dist/generated/schemas/zod/Job.js +25 -0
- package/dist/generated/schemas/zod/RawStrategy.d.ts +12 -0
- package/dist/generated/schemas/zod/RawStrategy.js +66 -0
- package/dist/generated/schemas/zod/ResourceType.d.ts +2 -0
- package/dist/generated/schemas/zod/ResourceType.js +18 -0
- package/dist/generated/schemas/zod/RunnableStrategy.d.ts +12 -0
- package/dist/generated/schemas/zod/RunnableStrategy.js +74 -0
- package/dist/generated/schemas/zod/StrategyRun.d.ts +12 -0
- package/dist/generated/schemas/zod/StrategyRun.js +88 -0
- package/dist/generated/schemas/zod/index.d.ts +6 -0
- package/dist/generated/schemas/zod/index.js +7 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -0
- package/dist/scripts/_lib/config.d.ts +3 -0
- package/dist/scripts/_lib/config.js +9 -0
- package/dist/scripts/_lib/utils/jsonSchemaToZod.d.ts +18 -0
- package/dist/scripts/_lib/utils/jsonSchemaToZod.js +607 -0
- package/dist/scripts/generateStandaloneZodSchema.d.ts +1 -0
- package/dist/scripts/generateStandaloneZodSchema.js +116 -0
- package/package.json +6 -2
- package/src/generated/schemas/zod/Goal.ts +8 -0
- package/src/generated/schemas/zod/Job.ts +26 -0
- package/src/generated/schemas/zod/RawStrategy.ts +64 -0
- package/src/generated/schemas/zod/ResourceType.ts +13 -0
- package/src/generated/schemas/zod/RunnableStrategy.ts +69 -0
- package/src/generated/schemas/zod/StrategyRun.ts +83 -0
- package/src/generated/schemas/zod/index.ts +7 -0
- package/src/index.ts +10 -0
- package/src/scripts/_lib/config.ts +12 -0
- package/src/scripts/_lib/utils/jsonSchemaToZod.ts +646 -0
- package/src/scripts/generateStandaloneZodSchema.ts +139 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'Goal'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
const GoalIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^GOAL-.+$")));
|
|
4
|
+
const JobIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
|
|
5
|
+
export const GoalSchema = z.lazy(() => z.object({ "identity": GoalIdentitySchema, "target": z.number().int().min(0), "disallowedJobs": z.array(JobIdentitySchema).optional(), "disallowedSequences": z.array(z.array(JobIdentitySchema)).optional(), "minSteps": z.number().int().min(1).optional(), "maxSteps": z.number().int().min(1).optional() }).strict());
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const JobZodGenerationWarnings: readonly [{
|
|
3
|
+
readonly path: "$defs.Roles.properties.outputDict.allOfMerged.propertyNames";
|
|
4
|
+
readonly message: "propertyNames on fixed-shape object not enforced by generated Zod.";
|
|
5
|
+
}];
|
|
6
|
+
export declare const JobSchema: z.ZodTypeAny;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'Job'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export const JobZodGenerationWarnings = [
|
|
4
|
+
{
|
|
5
|
+
"path": "$defs.Roles.properties.outputDict.allOfMerged.propertyNames",
|
|
6
|
+
"message": "propertyNames on fixed-shape object not enforced by generated Zod."
|
|
7
|
+
}
|
|
8
|
+
];
|
|
9
|
+
const DescriptionSchema = z.lazy(() => z.string().min(1));
|
|
10
|
+
const DescriptionFacetSchema = z.lazy(() => z.object({ "description": DescriptionSchema }));
|
|
11
|
+
const DocumentationFacetSchema = z.lazy(() => z.object({ "name": NameSchema, "description": DescriptionSchema }));
|
|
12
|
+
const JobIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
|
|
13
|
+
const NameSchema = z.lazy(() => z.string().min(1).regex(new RegExp("^(?:[A-Z][^0-9]*|[a-z]+/[a-z.+&-]+)$")));
|
|
14
|
+
const NameFacetSchema = z.lazy(() => z.object({ "name": NameSchema }));
|
|
15
|
+
const ResourceRoleIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
|
|
16
|
+
const ResourceRoleValueSchema = z.lazy(() => z.object({ "resourceTypeHandle": ResourceTypeIdentitySchema, "name": NameSchema, "description": DescriptionSchema }));
|
|
17
|
+
const ResourceTypeIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
|
|
18
|
+
const RoleDictSchema = z.lazy(() => z.record(z.string(), ResourceRoleValueSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
19
|
+
if (!new RegExp("^ROLE-.+$").test(k))
|
|
20
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
21
|
+
} }));
|
|
22
|
+
const RolesSchema = z.lazy(() => z.object({ "inputDict": RoleDictSchema, "outputDict": z.object({ "ROLE-ErrorOutput": z.object({ "resourceTypeHandle": z.intersection(ResourceTypeIdentitySchema, z.literal("TYPE-Error")), "name": z.intersection(NameSchema, z.literal("ErrorOutput")), "description": z.intersection(DescriptionSchema, z.literal("Represents error outputs from job runs.")) }) }).catchall(ResourceRoleValueSchema) }).strict());
|
|
23
|
+
const RolesFacetSchema = z.lazy(() => z.object({ "roles": RolesSchema }));
|
|
24
|
+
const UriSchema = z.lazy(() => z.string().url());
|
|
25
|
+
export const JobSchema = z.lazy(() => z.object({ "identity": JobIdentitySchema, "implementationUri": UriSchema, "name": NameSchema, "description": DescriptionSchema, "roles": RolesSchema }).strict());
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const RawStrategyZodGenerationWarnings: readonly [{
|
|
3
|
+
readonly path: "$defs.StepArray.uniqueItems";
|
|
4
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
5
|
+
}, {
|
|
6
|
+
readonly path: "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems";
|
|
7
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
8
|
+
}, {
|
|
9
|
+
readonly path: "$defs.Path.format";
|
|
10
|
+
readonly message: "Ignoring format 'uri-reference' (not enforced by generated Zod).";
|
|
11
|
+
}];
|
|
12
|
+
export declare const RawStrategySchema: z.ZodTypeAny;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'RawStrategy'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export const RawStrategyZodGenerationWarnings = [
|
|
4
|
+
{
|
|
5
|
+
"path": "$defs.StepArray.uniqueItems",
|
|
6
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
|
|
10
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "$defs.Path.format",
|
|
14
|
+
"message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
const BranchStepSchema = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
|
|
18
|
+
const BranchStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
|
|
19
|
+
const CaseSchema = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
|
|
20
|
+
const CreationContextSchema = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
|
|
21
|
+
const CreationContextFacetSchema = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
|
|
22
|
+
const ForStepSchema = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
|
|
23
|
+
const ForStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
|
|
24
|
+
const JobIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
|
|
25
|
+
const JobStepSchema = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
|
|
26
|
+
const JobStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
|
|
27
|
+
const JobStepSocketSchema = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
28
|
+
if (!new RegExp("^ROLE-.+$").test(k))
|
|
29
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
30
|
+
} }));
|
|
31
|
+
const NucleusFacetSchema = z.lazy(() => z.object({ "nucleus": z.any() }));
|
|
32
|
+
const PathSchema = z.lazy(() => z.string());
|
|
33
|
+
const PathFacetSchema = z.lazy(() => z.object({ "path": PathSchema }));
|
|
34
|
+
const ResourceSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
|
|
35
|
+
const ResourceIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
|
|
36
|
+
const ResourceInputPotentialSchema = z.lazy(() => ShellInputPotentialSchema);
|
|
37
|
+
const ResourceMissingSchema = z.lazy(() => ShellMissingSchema);
|
|
38
|
+
const ResourceOutputPotentialSchema = z.lazy(() => ShellOutputPotentialSchema);
|
|
39
|
+
const ResourcePotentialSchema = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
|
|
40
|
+
const ResourceRoleIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
|
|
41
|
+
const ResourceShellBaseSchema = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
|
|
42
|
+
const ResourceShellKindSchema = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
|
|
43
|
+
const ResourceShellKindFacetSchema = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
|
|
44
|
+
const ResourceTypeIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
|
|
45
|
+
const RoleBindingArraySchema = z.lazy(() => z.array(ResourceRoleIdentitySchema));
|
|
46
|
+
const RoleBindingsSchema = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
|
|
47
|
+
const RoleBindingsFacetSchema = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
|
|
48
|
+
const ShellInputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
49
|
+
const ShellMaterializedBaseSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
|
|
50
|
+
const ShellMissingSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
|
|
51
|
+
const ShellOutputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
52
|
+
const StepSchema = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
|
|
53
|
+
const StepArraySchema = z.lazy(() => z.array(StepSchema));
|
|
54
|
+
const StepKindSchema = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
|
|
55
|
+
const StepKindFacetSchema = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
|
|
56
|
+
const StepsFacetSchema = z.lazy(() => z.object({ "steps": StepArraySchema }));
|
|
57
|
+
const StrategyStateSchema = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
58
|
+
if (!new RegExp("^JOB_STEP-.+$").test(k))
|
|
59
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
60
|
+
} }));
|
|
61
|
+
const StrategyStateFacetSchema = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
|
|
62
|
+
const TimestampSchema = z.lazy(() => z.string().datetime());
|
|
63
|
+
const TimestampFacetSchema = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
|
|
64
|
+
const WhileStepSchema = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
|
|
65
|
+
const WhileStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
|
|
66
|
+
export const RawStrategySchema = z.lazy(() => z.object({ "steps": StepArraySchema, "strategyState": StrategyStateSchema }).strict());
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'ResourceType'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
const DescriptionSchema = z.lazy(() => z.string().min(1));
|
|
4
|
+
const DescriptionFacetSchema = z.lazy(() => z.object({ "description": DescriptionSchema }));
|
|
5
|
+
const DocumentationFacetSchema = z.lazy(() => z.object({ "name": NameSchema, "description": DescriptionSchema }));
|
|
6
|
+
const NameSchema = z.lazy(() => z.string().min(1).regex(new RegExp("^(?:[A-Z][^0-9]*|[a-z]+/[a-z.+&-]+)$")));
|
|
7
|
+
const NameFacetSchema = z.lazy(() => z.object({ "name": NameSchema }));
|
|
8
|
+
const ResourceTypeIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
|
|
9
|
+
const UriSchema = z.lazy(() => z.string().url());
|
|
10
|
+
export const ResourceTypeSchema = z.lazy(() => z.object({ "identity": ResourceTypeIdentitySchema, "nucleusSchema": z.any(), "embeddingUriDict": z.record(z.string(), UriSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
11
|
+
if (!new RegExp("^EMBEDDING-.+$").test(k))
|
|
12
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
13
|
+
} if (Object.keys(obj).length < 1)
|
|
14
|
+
ctx.addIssue({ code: 'custom', message: 'Expected at least 1 properties' }); }).optional(), "generatorUriDict": z.record(z.string(), UriSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
15
|
+
if (!new RegExp("^GENERATOR-.+$").test(k))
|
|
16
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
17
|
+
} if (Object.keys(obj).length < 1)
|
|
18
|
+
ctx.addIssue({ code: 'custom', message: 'Expected at least 1 properties' }); }).optional(), "name": NameSchema, "description": DescriptionSchema }));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const RunnableStrategyZodGenerationWarnings: readonly [{
|
|
3
|
+
readonly path: "$defs.StepArray.uniqueItems";
|
|
4
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
5
|
+
}, {
|
|
6
|
+
readonly path: "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems";
|
|
7
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
8
|
+
}, {
|
|
9
|
+
readonly path: "$defs.Path.format";
|
|
10
|
+
readonly message: "Ignoring format 'uri-reference' (not enforced by generated Zod).";
|
|
11
|
+
}];
|
|
12
|
+
export declare const RunnableStrategySchema: z.ZodTypeAny;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'RunnableStrategy'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export const RunnableStrategyZodGenerationWarnings = [
|
|
4
|
+
{
|
|
5
|
+
"path": "$defs.StepArray.uniqueItems",
|
|
6
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
|
|
10
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "$defs.Path.format",
|
|
14
|
+
"message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
const BranchStepSchema = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
|
|
18
|
+
const BranchStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
|
|
19
|
+
const CaseSchema = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
|
|
20
|
+
const CreationContextSchema = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
|
|
21
|
+
const CreationContextFacetSchema = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
|
|
22
|
+
const ForStepSchema = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
|
|
23
|
+
const ForStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
|
|
24
|
+
const JobIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
|
|
25
|
+
const JobStepSchema = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
|
|
26
|
+
const JobStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
|
|
27
|
+
const JobStepSocketSchema = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
28
|
+
if (!new RegExp("^ROLE-.+$").test(k))
|
|
29
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
30
|
+
} }));
|
|
31
|
+
const NucleusFacetSchema = z.lazy(() => z.object({ "nucleus": z.any() }));
|
|
32
|
+
const PathSchema = z.lazy(() => z.string());
|
|
33
|
+
const PathFacetSchema = z.lazy(() => z.object({ "path": PathSchema }));
|
|
34
|
+
const ResourceSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
|
|
35
|
+
const ResourceIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
|
|
36
|
+
const ResourceInputPotentialSchema = z.lazy(() => ShellInputPotentialSchema);
|
|
37
|
+
const ResourceMissingSchema = z.lazy(() => ShellMissingSchema);
|
|
38
|
+
const ResourceOutputPotentialSchema = z.lazy(() => ShellOutputPotentialSchema);
|
|
39
|
+
const ResourcePotentialSchema = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
|
|
40
|
+
const ResourceRoleIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
|
|
41
|
+
const ResourceShellBaseSchema = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
|
|
42
|
+
const ResourceShellKindSchema = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
|
|
43
|
+
const ResourceShellKindFacetSchema = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
|
|
44
|
+
const ResourceTypeIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
|
|
45
|
+
const RoleBindingArraySchema = z.lazy(() => z.array(ResourceRoleIdentitySchema));
|
|
46
|
+
const RoleBindingsSchema = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
|
|
47
|
+
const RoleBindingsFacetSchema = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
|
|
48
|
+
const RunnableStrategyContextSchema = z.lazy(() => z.object({ "status": RunnableStrategyStatusSchema, "startedAt": TimestampSchema.optional(), "completedAt": TimestampSchema.optional() }).strict());
|
|
49
|
+
const RunnableStrategyIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^RUNNABLE_STRATEGY-.+$")));
|
|
50
|
+
const RunnableStrategyStatusSchema = z.lazy(() => z.union([z.literal("pending"), z.literal("running"), z.literal("completed"), z.literal("failed"), z.literal("cancelled")]));
|
|
51
|
+
const ShellInputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
52
|
+
const ShellMaterializedBaseSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
|
|
53
|
+
const ShellMissingSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
|
|
54
|
+
const ShellOutputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
55
|
+
const StepSchema = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
|
|
56
|
+
const StepArraySchema = z.lazy(() => z.array(StepSchema));
|
|
57
|
+
const StepKindSchema = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
|
|
58
|
+
const StepKindFacetSchema = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
|
|
59
|
+
const StrategyStateSchema = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
60
|
+
if (!new RegExp("^JOB_STEP-.+$").test(k))
|
|
61
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
62
|
+
} }));
|
|
63
|
+
const StrategyStateFacetSchema = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
|
|
64
|
+
const StrategyThreadDictSchema = z.lazy(() => z.record(z.string(), StepArraySchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
65
|
+
if (!new RegExp("^STRATEGY_THREAD-.+$").test(k))
|
|
66
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
67
|
+
} }));
|
|
68
|
+
const StrategyThreadDictFacetSchema = z.lazy(() => z.object({ "strategyThreadDict": StrategyThreadDictSchema }));
|
|
69
|
+
const StrategyThreadIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_THREAD-.+$")));
|
|
70
|
+
const TimestampSchema = z.lazy(() => z.string().datetime());
|
|
71
|
+
const TimestampFacetSchema = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
|
|
72
|
+
const WhileStepSchema = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
|
|
73
|
+
const WhileStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
|
|
74
|
+
export const RunnableStrategySchema = z.lazy(() => z.object({ "identity": RunnableStrategyIdentitySchema, "runnableStrategyContext": RunnableStrategyContextSchema, "strategyThreadDict": StrategyThreadDictSchema, "strategyState": StrategyStateSchema }).strict());
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const StrategyRunZodGenerationWarnings: readonly [{
|
|
3
|
+
readonly path: "$defs.StepArray.uniqueItems";
|
|
4
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
5
|
+
}, {
|
|
6
|
+
readonly path: "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems";
|
|
7
|
+
readonly message: "uniqueItems not enforced by generated Zod.";
|
|
8
|
+
}, {
|
|
9
|
+
readonly path: "$defs.Path.format";
|
|
10
|
+
readonly message: "Ignoring format 'uri-reference' (not enforced by generated Zod).";
|
|
11
|
+
}];
|
|
12
|
+
export declare const StrategyRunSchema: z.ZodTypeAny;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Auto-generated from standalone schema 'StrategyRun'. Do not edit.
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export const StrategyRunZodGenerationWarnings = [
|
|
4
|
+
{
|
|
5
|
+
"path": "$defs.StepArray.uniqueItems",
|
|
6
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
|
|
10
|
+
"message": "uniqueItems not enforced by generated Zod."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "$defs.Path.format",
|
|
14
|
+
"message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
const BranchStepSchema = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
|
|
18
|
+
const BranchStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
|
|
19
|
+
const CaseSchema = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
|
|
20
|
+
const CreationContextSchema = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
|
|
21
|
+
const CreationContextFacetSchema = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
|
|
22
|
+
const ForStepSchema = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
|
|
23
|
+
const ForStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
|
|
24
|
+
const GraphEndRunEventSchema = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("graph_end")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
|
|
25
|
+
const GraphStartRunEventSchema = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("graph_start")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional(), "runnableStrategySeed": RunnableStrategySchema }));
|
|
26
|
+
const InterruptRunEventSchema = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("interrupt")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
|
|
27
|
+
const JobIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
|
|
28
|
+
const JobStepSchema = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
|
|
29
|
+
const JobStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
|
|
30
|
+
const JobStepSocketSchema = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
31
|
+
if (!new RegExp("^ROLE-.+$").test(k))
|
|
32
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
33
|
+
} }));
|
|
34
|
+
const NucleusFacetSchema = z.lazy(() => z.object({ "nucleus": z.any() }));
|
|
35
|
+
const PathSchema = z.lazy(() => z.string());
|
|
36
|
+
const PathFacetSchema = z.lazy(() => z.object({ "path": PathSchema }));
|
|
37
|
+
const ResourceSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
|
|
38
|
+
const ResourceIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
|
|
39
|
+
const ResourceInputPotentialSchema = z.lazy(() => ShellInputPotentialSchema);
|
|
40
|
+
const ResourceMissingSchema = z.lazy(() => ShellMissingSchema);
|
|
41
|
+
const ResourceOutputPotentialSchema = z.lazy(() => ShellOutputPotentialSchema);
|
|
42
|
+
const ResourcePotentialSchema = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
|
|
43
|
+
const ResourceRoleIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
|
|
44
|
+
const ResourceShellBaseSchema = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
|
|
45
|
+
const ResourceShellKindSchema = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
|
|
46
|
+
const ResourceShellKindFacetSchema = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
|
|
47
|
+
const ResourceTypeIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
|
|
48
|
+
const RoleBindingArraySchema = z.lazy(() => z.array(ResourceRoleIdentitySchema));
|
|
49
|
+
const RoleBindingsSchema = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
|
|
50
|
+
const RoleBindingsFacetSchema = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
|
|
51
|
+
const RunEventSchema = z.lazy(() => z.union([GraphStartRunEventSchema, TickRunEventSchema, InterruptRunEventSchema, GraphEndRunEventSchema]));
|
|
52
|
+
const RunEventBaseSchema = z.lazy(() => z.object({ "runEventKind": RunEventKindSchema, "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
|
|
53
|
+
const RunEventCountersSchema = z.lazy(() => z.object({ "stepCounterAfter": z.number().int().optional(), "iterationCounterAfter": z.number().int().optional() }));
|
|
54
|
+
const RunEventKindSchema = z.lazy(() => z.union([z.literal("graph_start"), z.literal("tick"), z.literal("interrupt"), z.literal("graph_end")]));
|
|
55
|
+
const RunEventStepMetadataSchema = z.lazy(() => z.object({ "stepHandle": StepIdentitySchema, "stepKind": StepKindSchema, "threadStepIndex": z.number().int() }));
|
|
56
|
+
const RunEventUpdatesSchema = z.lazy(() => z.object({ "stepsMutation": z.object({ "insertAt": z.number().int(), "inserted": StepArraySchema }).optional(), "interruptData": z.union([z.object({}), z.null()]).optional(), "strategyStateUpdate": StrategyStateSchema }));
|
|
57
|
+
const RunnableStrategySchema = z.lazy(() => z.object({ "identity": RunnableStrategyIdentitySchema, "runnableStrategyContext": RunnableStrategyContextSchema, "strategyThreadDict": StrategyThreadDictSchema, "strategyState": StrategyStateSchema }).strict());
|
|
58
|
+
const RunnableStrategyContextSchema = z.lazy(() => z.object({ "status": RunnableStrategyStatusSchema, "startedAt": TimestampSchema.optional(), "completedAt": TimestampSchema.optional() }).strict());
|
|
59
|
+
const RunnableStrategyIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^RUNNABLE_STRATEGY-.+$")));
|
|
60
|
+
const RunnableStrategyStatusSchema = z.lazy(() => z.union([z.literal("pending"), z.literal("running"), z.literal("completed"), z.literal("failed"), z.literal("cancelled")]));
|
|
61
|
+
const ShellInputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
62
|
+
const ShellMaterializedBaseSchema = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
|
|
63
|
+
const ShellMissingSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
|
|
64
|
+
const ShellOutputPotentialSchema = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
|
|
65
|
+
const StepSchema = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
|
|
66
|
+
const StepArraySchema = z.lazy(() => z.array(StepSchema));
|
|
67
|
+
const StepIdentitySchema = z.lazy(() => z.union([JobStepIdentitySchema, BranchStepIdentitySchema, WhileStepIdentitySchema, ForStepIdentitySchema]));
|
|
68
|
+
const StepKindSchema = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
|
|
69
|
+
const StepKindFacetSchema = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
|
|
70
|
+
const StrategyRunIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_RUN-.+$")));
|
|
71
|
+
const StrategyStateSchema = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
72
|
+
if (!new RegExp("^JOB_STEP-.+$").test(k))
|
|
73
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
74
|
+
} }));
|
|
75
|
+
const StrategyStateDeltaSchema = z.lazy(() => z.object({ "strategyStateUpdate": StrategyStateSchema }));
|
|
76
|
+
const StrategyStateFacetSchema = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
|
|
77
|
+
const StrategyThreadDictSchema = z.lazy(() => z.record(z.string(), StepArraySchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) {
|
|
78
|
+
if (!new RegExp("^STRATEGY_THREAD-.+$").test(k))
|
|
79
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k });
|
|
80
|
+
} }));
|
|
81
|
+
const StrategyThreadDictFacetSchema = z.lazy(() => z.object({ "strategyThreadDict": StrategyThreadDictSchema }));
|
|
82
|
+
const StrategyThreadIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_THREAD-.+$")));
|
|
83
|
+
const TickRunEventSchema = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("tick")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
|
|
84
|
+
const TimestampSchema = z.lazy(() => z.string().datetime());
|
|
85
|
+
const TimestampFacetSchema = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
|
|
86
|
+
const WhileStepSchema = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
|
|
87
|
+
const WhileStepIdentitySchema = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
|
|
88
|
+
export const StrategyRunSchema = z.lazy(() => z.object({ "identity": StrategyRunIdentitySchema, "runnableStrategyHandle": RunnableStrategyIdentitySchema, "recordedAt": TimestampSchema, "runEvents": z.array(RunEventSchema) }).strict());
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GoalSchema } from './Goal.js';
|
|
2
|
+
export { JobSchema } from './Job.js';
|
|
3
|
+
export { RawStrategySchema } from './RawStrategy.js';
|
|
4
|
+
export { ResourceTypeSchema } from './ResourceType.js';
|
|
5
|
+
export { RunnableStrategySchema } from './RunnableStrategy.js';
|
|
6
|
+
export { StrategyRunSchema } from './StrategyRun.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Auto-generated barrel file. Do not edit.
|
|
2
|
+
export { GoalSchema } from './Goal.js';
|
|
3
|
+
export { JobSchema } from './Job.js';
|
|
4
|
+
export { RawStrategySchema } from './RawStrategy.js';
|
|
5
|
+
export { ResourceTypeSchema } from './ResourceType.js';
|
|
6
|
+
export { RunnableStrategySchema } from './RunnableStrategy.js';
|
|
7
|
+
export { StrategyRunSchema } from './StrategyRun.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,16 @@ export { default as SchemaStrategyRun } from './generated/schemas/standalone/Str
|
|
|
6
6
|
export { default as ResourceGenesis } from './generated/resources/Genesis.js';
|
|
7
7
|
export { default as CONSTANTS } from './generated/artifacts/constants.js';
|
|
8
8
|
export { default as MAPPINGS } from './generated/artifacts/mappings.js';
|
|
9
|
+
export { JobSchema as ZodJobSchema } from './generated/schemas/zod/Job.js';
|
|
10
|
+
export { ResourceTypeSchema as ZodResourceTypeSchema } from './generated/schemas/zod/ResourceType.js';
|
|
11
|
+
export { RawStrategySchema as ZodRawStrategySchema } from './generated/schemas/zod/RawStrategy.js';
|
|
12
|
+
export { RunnableStrategySchema as ZodRunnableStrategySchema } from './generated/schemas/zod/RunnableStrategy.js';
|
|
13
|
+
export { StrategyRunSchema as ZodStrategyRunSchema } from './generated/schemas/zod/StrategyRun.js';
|
|
14
|
+
export { GoalSchema as ZodGoalSchema } from './generated/schemas/zod/Goal.js';
|
|
15
|
+
export * as ZodSchemas from './generated/schemas/zod/index.js';
|
|
9
16
|
export type { Resource_Genesis as Resource_GenesisJson } from './generated/types/standalone/Resource_Genesis.js';
|
|
10
17
|
export type { Resource_ResourceType as Resource_ResourceTypeJson } from './generated/types/standalone/Resource_ResourceType.js';
|
|
11
18
|
export type { Resource_Job as Resource_JobJson } from './generated/types/standalone/Resource_Job.js';
|
|
12
19
|
export type { Resource_RawStrategy as Resource_RawStrategyJson } from './generated/types/standalone/Resource_RawStrategy.js';
|
|
13
20
|
export type { Resource_RunnableStrategy as Resource_RunnableStrategyJson } from './generated/types/standalone/Resource_RunnableStrategy.js';
|
|
14
|
-
export type { DocumentationFacetJson, NucleusFacetJson, ResourceTypeIdentityJson, ResourceTypeJson, ResourceRoleIdentityJson, ResourceRoleValueJson, ResourceRoleJson, CaseJson, RoleDictJson, RolesJson, RoleBindingsJson, ResourceIdentityJson, JobStepIdentityJson, BranchStepIdentityJson, WhileStepIdentityJson, ForStepIdentityJson, JobStepJson, BranchStepJson, WhileStepJson, ForStepJson, StepKindJson, StepIdentityJson, StepJson, CreationContextJson, ResourceMissingJson, ResourceInputPotentialJson, ResourceOutputPotentialJson, ShellMaterializedBaseJson, ResourceJson, StrategyStateJson, StepsFacetJson, RawStrategyJson, RunnableStrategyIdentityJson, RunnableStrategyStatusJson, RunnableStrategyJson, RunnableStrategyUpdateJson, JobIdentityJson, JobJson, StrategyThreadIdentityJson, StrategyThreadDictJson, JobStepSocketJson, TimestampJson, StrategyRunIdentityJson, StrategyRunJson, GoalIdentityJson, GoalJson, ErrorJson, RunEventJson, RunEventBaseJson, RunEventKindJson, RunEventCountersJson, RunEventStepMetadataJson, RunEventUpdatesJson, GraphStartRunEventJson, GraphEndRunEventJson, TickRunEventJson, InterruptRunEventJson, } from './generated/types/types.js';
|
|
21
|
+
export type { DocumentationFacetJson, NucleusFacetJson, ResourceTypeIdentityJson, ResourceTypeJson, ResourceRoleIdentityJson, ResourceRoleValueJson, ResourceRoleJson, CaseJson, RoleDictJson, RolesJson, RoleBindingsJson, ResourceIdentityJson, JobStepIdentityJson, BranchStepIdentityJson, WhileStepIdentityJson, ForStepIdentityJson, JobStepJson, BranchStepJson, WhileStepJson, ForStepJson, StepKindJson, StepIdentityJson, StepJson, CreationContextJson, ResourceMissingJson, ResourceInputPotentialJson, ResourceOutputPotentialJson, ResourcePotentialJson, ShellMaterializedBaseJson, ResourceJson, StrategyStateJson, StepsFacetJson, RawStrategyJson, RunnableStrategyIdentityJson, RunnableStrategyStatusJson, RunnableStrategyJson, RunnableStrategyUpdateJson, JobIdentityJson, JobJson, StrategyThreadIdentityJson, StrategyThreadDictJson, JobStepSocketJson, TimestampJson, StrategyRunIdentityJson, StrategyRunJson, GoalIdentityJson, GoalJson, ErrorJson, RunEventJson, RunEventBaseJson, RunEventKindJson, RunEventCountersJson, RunEventStepMetadataJson, RunEventUpdatesJson, GraphStartRunEventJson, GraphEndRunEventJson, TickRunEventJson, InterruptRunEventJson, } from './generated/types/types.js';
|
package/dist/index.js
CHANGED
|
@@ -7,3 +7,11 @@ export { default as SchemaStrategyRun } from './generated/schemas/standalone/Str
|
|
|
7
7
|
export { default as ResourceGenesis } from './generated/resources/Genesis.js';
|
|
8
8
|
export { default as CONSTANTS } from './generated/artifacts/constants.js';
|
|
9
9
|
export { default as MAPPINGS } from './generated/artifacts/mappings.js';
|
|
10
|
+
// Re-export generated Zod validators
|
|
11
|
+
export { JobSchema as ZodJobSchema } from './generated/schemas/zod/Job.js';
|
|
12
|
+
export { ResourceTypeSchema as ZodResourceTypeSchema } from './generated/schemas/zod/ResourceType.js';
|
|
13
|
+
export { RawStrategySchema as ZodRawStrategySchema } from './generated/schemas/zod/RawStrategy.js';
|
|
14
|
+
export { RunnableStrategySchema as ZodRunnableStrategySchema } from './generated/schemas/zod/RunnableStrategy.js';
|
|
15
|
+
export { StrategyRunSchema as ZodStrategyRunSchema } from './generated/schemas/zod/StrategyRun.js';
|
|
16
|
+
export { GoalSchema as ZodGoalSchema } from './generated/schemas/zod/Goal.js';
|
|
17
|
+
export * as ZodSchemas from './generated/schemas/zod/index.js';
|
|
@@ -12,6 +12,7 @@ export declare class SchemaConfig {
|
|
|
12
12
|
private readonly sourceFile;
|
|
13
13
|
private readonly normalizedDir;
|
|
14
14
|
private readonly schemasDir;
|
|
15
|
+
private readonly zodSchemasDir;
|
|
15
16
|
private readonly artifactsDir;
|
|
16
17
|
private readonly resourcesDir;
|
|
17
18
|
private readonly typesSrcDir;
|
|
@@ -27,6 +28,8 @@ export declare class SchemaConfig {
|
|
|
27
28
|
getNormalizedSourceFile(): string;
|
|
28
29
|
getNormalizedSourcePath(): string;
|
|
29
30
|
getSchemasDir(): string;
|
|
31
|
+
getZodSchemasDir(): string;
|
|
32
|
+
getZodSchemaPath(filename: string): string;
|
|
30
33
|
getSchemaPath(filename: string): string;
|
|
31
34
|
getArtifactsDir(): string;
|
|
32
35
|
getArtifactsPath(filename: string): string;
|
|
@@ -22,6 +22,7 @@ export class SchemaConfig {
|
|
|
22
22
|
this.sourceFile = getEnv('TP_SCHEMA_SOURCE_FILE', 'Genesis.json');
|
|
23
23
|
this.normalizedDir = getEnv('TP_SCHEMA_NORMALIZED_DIR', 'src/generated/normalized');
|
|
24
24
|
this.schemasDir = getEnv('TP_SCHEMA_SCHEMAS_DIR', 'src/generated/schemas');
|
|
25
|
+
this.zodSchemasDir = getEnv('TP_SCHEMA_ZOD_SCHEMAS_DIR', 'src/generated/schemas/zod');
|
|
25
26
|
this.artifactsDir = getEnv('TP_SCHEMA_ARTIFACTS_DIR', 'src/generated/artifacts');
|
|
26
27
|
this.resourcesDir = getEnv('TP_SCHEMA_RESOURCES_DIR', 'src/generated/resources');
|
|
27
28
|
this.typesSrcDir = getEnv('TP_SCHEMA_TYPES_SRC_DIR', 'src/generated/types');
|
|
@@ -63,6 +64,14 @@ export class SchemaConfig {
|
|
|
63
64
|
? this.schemasDir
|
|
64
65
|
: path.join(this.root, this.schemasDir);
|
|
65
66
|
}
|
|
67
|
+
getZodSchemasDir() {
|
|
68
|
+
return path.isAbsolute(this.zodSchemasDir)
|
|
69
|
+
? this.zodSchemasDir
|
|
70
|
+
: path.join(this.root, this.zodSchemasDir);
|
|
71
|
+
}
|
|
72
|
+
getZodSchemaPath(filename) {
|
|
73
|
+
return path.join(this.getZodSchemasDir(), filename);
|
|
74
|
+
}
|
|
66
75
|
getSchemaPath(filename) {
|
|
67
76
|
return path.join(this.getSchemasDir(), filename);
|
|
68
77
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type JsonSchema = any;
|
|
2
|
+
export type JsonSchemaToZodWarning = {
|
|
3
|
+
path: string;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
export type JsonSchemaToZodResult = {
|
|
7
|
+
/** Map: schemaName -> emitted `z...` expression string (no wrapping lazy). */
|
|
8
|
+
expressionsByName: Record<string, string>;
|
|
9
|
+
/** Ordered warnings for approximations/unsupported keywords. */
|
|
10
|
+
warnings: JsonSchemaToZodWarning[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Convert a standalone schema JSON into a set of named Zod expressions.
|
|
14
|
+
*
|
|
15
|
+
* The output intentionally returns *expressions* (no imports/exports), so the
|
|
16
|
+
* caller can decide on file/module layout.
|
|
17
|
+
*/
|
|
18
|
+
export declare function jsonSchemaToZodExpressions(standaloneSchema: JsonSchema, rootName: string): JsonSchemaToZodResult;
|