@xemahq/dsl 0.7.0 → 0.8.1
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/deliverable-spec/lib/schema.d.ts +2 -0
- package/dist/deliverable-spec/lib/schema.d.ts.map +1 -1
- package/dist/deliverable-spec/lib/schema.js +10 -1
- package/dist/deliverable-spec/lib/schema.js.map +1 -1
- package/dist/payload-codec/lib/blob-store.js +0 -0
- package/dist/payload-codec/lib/blob-store.js.map +1 -1
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +7 -1
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/lib/deliverable-spec-introspection-error.d.ts +12 -0
- package/dist/workflow/lib/deliverable-spec-introspection-error.d.ts.map +1 -0
- package/dist/workflow/lib/deliverable-spec-introspection-error.js +33 -0
- package/dist/workflow/lib/deliverable-spec-introspection-error.js.map +1 -0
- package/dist/workflow/lib/deliverable-spec-keys.d.ts +1 -1
- package/dist/workflow/lib/deliverable-spec-keys.d.ts.map +1 -1
- package/dist/workflow/lib/deliverable-spec-keys.js +27 -52
- package/dist/workflow/lib/deliverable-spec-keys.js.map +1 -1
- package/dist/workflow/lib/deliverable-spec-source-scan.d.ts +6 -0
- package/dist/workflow/lib/deliverable-spec-source-scan.d.ts.map +1 -0
- package/dist/workflow/lib/deliverable-spec-source-scan.js +189 -0
- package/dist/workflow/lib/deliverable-spec-source-scan.js.map +1 -0
- package/package.json +3 -3
- package/src/deliverable-spec/lib/schema.ts +23 -0
- package/src/payload-codec/lib/blob-store.ts +0 -0
- package/src/workflow/index.ts +7 -0
- package/src/workflow/lib/deliverable-spec-introspection-error.ts +63 -0
- package/src/workflow/lib/deliverable-spec-keys.ts +88 -50
- package/src/workflow/lib/deliverable-spec-source-scan.ts +280 -0
|
@@ -57,6 +57,7 @@ export declare const DeliverableSpecSpecSchema: z.ZodObject<{
|
|
|
57
57
|
standards: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
58
58
|
zodSchemaSource: z.ZodOptional<z.ZodString>;
|
|
59
59
|
zodSchemaSourceFile: z.ZodOptional<z.ZodString>;
|
|
60
|
+
zodSchemaExport: z.ZodOptional<z.ZodString>;
|
|
60
61
|
fetchSpec: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
61
62
|
assets: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
62
63
|
rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -109,6 +110,7 @@ export declare const DeliverableSpecManifestSchema: z.ZodObject<{
|
|
|
109
110
|
standards: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
110
111
|
zodSchemaSource: z.ZodOptional<z.ZodString>;
|
|
111
112
|
zodSchemaSourceFile: z.ZodOptional<z.ZodString>;
|
|
113
|
+
zodSchemaExport: z.ZodOptional<z.ZodString>;
|
|
112
114
|
fetchSpec: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
113
115
|
assets: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
114
116
|
rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/deliverable-spec/lib/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsCxB,eAAO,MAAM,sBAAsB,6HAQzB,CAAC;AAEX,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAOjF,eAAO,MAAM,gBAAgB,uCAAwC,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAOtE,eAAO,MAAM,sBAAsB;;;;iBAQjC,CAAC;AAOH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;mBAG3B,CAAC;AAMH,eAAO,MAAM,6BAA6B;;;;;iBAcxC,CAAC;AAEH,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/deliverable-spec/lib/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsCxB,eAAO,MAAM,sBAAsB,6HAQzB,CAAC;AAEX,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAOjF,eAAO,MAAM,gBAAgB,uCAAwC,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAOtE,eAAO,MAAM,sBAAsB;;;;iBAQjC,CAAC;AAOH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;mBAG3B,CAAC;AAMH,eAAO,MAAM,6BAA6B;;;;;iBAcxC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2FnC,CAAC;AAEJ,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYtC,CAAC;AAIL,eAAO,MAAM,oCAAoC;;;iBAU/C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;iBA0B1C,CAAC;AAEJ,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;iBAY7C,CAAC"}
|
|
@@ -69,6 +69,10 @@ exports.DeliverableSpecSpecSchema = zod_1.z
|
|
|
69
69
|
standards: zod_1.z.array(zod_1.z.unknown()).optional(),
|
|
70
70
|
zodSchemaSource: zod_1.z.string().max(200_000).optional(),
|
|
71
71
|
zodSchemaSourceFile: zod_1.z.string().min(1).optional(),
|
|
72
|
+
zodSchemaExport: zod_1.z
|
|
73
|
+
.string()
|
|
74
|
+
.regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, 'zodSchemaExport must be a JavaScript identifier (the exported const name)')
|
|
75
|
+
.optional(),
|
|
72
76
|
fetchSpec: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
73
77
|
assets: zod_1.z.array(zod_1.z.unknown()).optional(),
|
|
74
78
|
rules: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
@@ -82,7 +86,12 @@ exports.DeliverableSpecSpecSchema = zod_1.z
|
|
|
82
86
|
.refine((s) => !(s.zodSchemaSource !== undefined && s.zodSchemaSourceFile !== undefined), {
|
|
83
87
|
message: 'spec cannot declare both `zodSchemaSource` and `zodSchemaSourceFile`',
|
|
84
88
|
})
|
|
85
|
-
.refine((s) => !(s.multiPage === true && (s.pages === undefined || s.pages.length === 0)), { message: 'multiPage=true requires non-empty `pages[]`' })
|
|
89
|
+
.refine((s) => !(s.multiPage === true && (s.pages === undefined || s.pages.length === 0)), { message: 'multiPage=true requires non-empty `pages[]`' })
|
|
90
|
+
.refine((s) => s.zodSchemaExport === undefined ||
|
|
91
|
+
s.zodSchemaSource !== undefined ||
|
|
92
|
+
s.zodSchemaSourceFile !== undefined, {
|
|
93
|
+
message: '`zodSchemaExport` names an export in the Zod source, so it requires `zodSchemaSource` or `zodSchemaSourceFile`',
|
|
94
|
+
});
|
|
86
95
|
exports.DeliverableSpecManifestSchema = zod_1.z
|
|
87
96
|
.object({
|
|
88
97
|
apiVersion: zod_1.z.literal('xema.dev/deliverable/v1'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/deliverable-spec/lib/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAoBxB,MAAM,SAAS,GAAG,yCAAyC,CAAC;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E,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAGD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAGD,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF;AAvFD,8CAuFC;AAGD,SAAgB,SAAS,CAAC,KAAiB;IACzC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AASD,SAAS,OAAO,CAAC,KAAa,EAAE,MAAc;IAC5C,OAAO,GAAG,KAAK,SAAS,MAAM,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,0BAAiB,CACzB,8BAAqB,CAAC,eAAe,EACrC,iDAAiD,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -10,5 +10,8 @@ export { dispatchInputsToJsonSchema } from './lib/dispatch-inputs/to-json-schema
|
|
|
10
10
|
export { serializeWorkflowDocument } from './lib/serializer';
|
|
11
11
|
export { DECISION_GATE_ACTION_ID, applyGateDefaults, canonicalJsonSha256, canonicalJsonStringify, compileManifestSource, compileWorkflow, getWorkspaceManifestContract, isAgentShapedAction, type CompileInput, type ResolvedAgentMeta, type ResolvedDeliverableSpec, type ResolvedRef, } from './lib/compiler';
|
|
12
12
|
export { extractZodTopLevelObjectKeys, extractJsonSchemaTopLevelKeys, } from './lib/deliverable-spec-keys';
|
|
13
|
+
export { DeliverableSpecIntrospectionError, DeliverableSpecIntrospectionFailure, isDeliverableSpecIntrospectionError, } from './lib/deliverable-spec-introspection-error';
|
|
14
|
+
export { scanTopLevelZodObjectDeclarations } from './lib/deliverable-spec-source-scan';
|
|
15
|
+
export type { TopLevelZodObjectDeclaration } from './lib/deliverable-spec-source-scan';
|
|
13
16
|
export type { ActionContract, ActionManifest, ActionManifestMetadata, ActionManifestRetryDefaults, ActionManifestSpec, ActionManifestTimeoutDefaults, WorkspaceManifestActionContract, ScheduleDeclaration, WebhookDeclaration, WorkflowCallDeclaration, WorkflowConcurrencyDeclaration, WorkflowDefaults, WorkflowGateDefaults, WorkflowDispatchDeclaration, WorkflowDocument, WorkflowDynamicStrategyDeclaration, WorkflowInputDeclaration, WorkflowJobDeclaration, WorkflowMetadata, WorkflowPermissions, WorkflowRetryDeclaration, WorkflowStrategyDeclaration, WorkflowTriggerDeclarations, } from './lib/types';
|
|
14
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,gCAAgC,EAChC,KAAK,6BAA6B,GACnC,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,EACpC,4BAA4B,EAC5B,sBAAsB,EACtB,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,+BAA+B,EAC/B,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,EAC9B,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,EAClC,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,gCAAgC,EAChC,KAAK,6BAA6B,GACnC,MAAM,k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AAkB,EAClB,6BAA6B,EAC7B,+BAA+B,EAC/B,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,EAC9B,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,EAClC,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,aAAa,CAAC"}
|
package/dist/workflow/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractJsonSchemaTopLevelKeys = exports.extractZodTopLevelObjectKeys = exports.isAgentShapedAction = exports.getWorkspaceManifestContract = exports.compileWorkflow = exports.compileManifestSource = exports.canonicalJsonStringify = exports.canonicalJsonSha256 = exports.applyGateDefaults = exports.DECISION_GATE_ACTION_ID = exports.serializeWorkflowDocument = exports.dispatchInputsToJsonSchema = exports.extractDispatchInputDescriptors = exports.DispatchInputStringFormat = exports.DispatchInputFieldType = exports.parseDurationMs = exports.stripInterpolation = exports.isInterpolationWrapped = exports.extractInterpolations = exports.evaluateExpression = exports.compileExpression = exports.ExpressionRoot = exports.ExpressionNodeKind = exports.ExpressionFunction = exports.EMPTY_CONTEXT_SEEDS = exports.validateWorkflowDocument = exports.validateReusableWorkflowDocument = exports.validateActionManifest = exports.parseAndValidateWorkflowYaml = exports.parseAndValidateReusableWorkflowYaml = exports.parseAndValidateActionYaml = exports.collectInstallationResourceHints = exports.InstallationResourceKind = exports.validateActionInputs = exports.isWorkflowDslError = exports.WorkflowDslError = void 0;
|
|
3
|
+
exports.scanTopLevelZodObjectDeclarations = exports.isDeliverableSpecIntrospectionError = exports.DeliverableSpecIntrospectionFailure = exports.DeliverableSpecIntrospectionError = exports.extractJsonSchemaTopLevelKeys = exports.extractZodTopLevelObjectKeys = exports.isAgentShapedAction = exports.getWorkspaceManifestContract = exports.compileWorkflow = exports.compileManifestSource = exports.canonicalJsonStringify = exports.canonicalJsonSha256 = exports.applyGateDefaults = exports.DECISION_GATE_ACTION_ID = exports.serializeWorkflowDocument = exports.dispatchInputsToJsonSchema = exports.extractDispatchInputDescriptors = exports.DispatchInputStringFormat = exports.DispatchInputFieldType = exports.parseDurationMs = exports.stripInterpolation = exports.isInterpolationWrapped = exports.extractInterpolations = exports.evaluateExpression = exports.compileExpression = exports.ExpressionRoot = exports.ExpressionNodeKind = exports.ExpressionFunction = exports.EMPTY_CONTEXT_SEEDS = exports.validateWorkflowDocument = exports.validateReusableWorkflowDocument = exports.validateActionManifest = exports.parseAndValidateWorkflowYaml = exports.parseAndValidateReusableWorkflowYaml = exports.parseAndValidateActionYaml = exports.collectInstallationResourceHints = exports.InstallationResourceKind = exports.validateActionInputs = exports.isWorkflowDslError = exports.WorkflowDslError = void 0;
|
|
4
4
|
var errors_1 = require("./lib/errors");
|
|
5
5
|
Object.defineProperty(exports, "WorkflowDslError", { enumerable: true, get: function () { return errors_1.WorkflowDslError; } });
|
|
6
6
|
Object.defineProperty(exports, "isWorkflowDslError", { enumerable: true, get: function () { return errors_1.isWorkflowDslError; } });
|
|
@@ -48,4 +48,10 @@ Object.defineProperty(exports, "isAgentShapedAction", { enumerable: true, get: f
|
|
|
48
48
|
var deliverable_spec_keys_1 = require("./lib/deliverable-spec-keys");
|
|
49
49
|
Object.defineProperty(exports, "extractZodTopLevelObjectKeys", { enumerable: true, get: function () { return deliverable_spec_keys_1.extractZodTopLevelObjectKeys; } });
|
|
50
50
|
Object.defineProperty(exports, "extractJsonSchemaTopLevelKeys", { enumerable: true, get: function () { return deliverable_spec_keys_1.extractJsonSchemaTopLevelKeys; } });
|
|
51
|
+
var deliverable_spec_introspection_error_1 = require("./lib/deliverable-spec-introspection-error");
|
|
52
|
+
Object.defineProperty(exports, "DeliverableSpecIntrospectionError", { enumerable: true, get: function () { return deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionError; } });
|
|
53
|
+
Object.defineProperty(exports, "DeliverableSpecIntrospectionFailure", { enumerable: true, get: function () { return deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionFailure; } });
|
|
54
|
+
Object.defineProperty(exports, "isDeliverableSpecIntrospectionError", { enumerable: true, get: function () { return deliverable_spec_introspection_error_1.isDeliverableSpecIntrospectionError; } });
|
|
55
|
+
var deliverable_spec_source_scan_1 = require("./lib/deliverable-spec-source-scan");
|
|
56
|
+
Object.defineProperty(exports, "scanTopLevelZodObjectDeclarations", { enumerable: true, get: function () { return deliverable_spec_source_scan_1.scanTopLevelZodObjectDeclarations; } });
|
|
51
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":";;;AAeA,uCAAoE;AAA3D,0GAAA,gBAAgB,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAC7C,uEAIsC;AAHpC,8HAAA,oBAAoB,OAAA;AAItB,+EAI0C;AAHxC,sIAAA,wBAAwB,OAAA;AACxB,8IAAA,gCAAgC,OAAA;AAIlC,2CAOwB;AANtB,sHAAA,0BAA0B,OAAA;AAC1B,gIAAA,oCAAoC,OAAA;AACpC,wHAAA,4BAA4B,OAAA;AAC5B,kHAAA,sBAAsB,OAAA;AACtB,4HAAA,gCAAgC,OAAA;AAChC,oHAAA,wBAAwB,OAAA;AAE1B,+CAa0B;AAZxB,iHAAA,mBAAmB,OAAA;AACnB,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,4GAAA,cAAc,OAAA;AACd,+GAAA,iBAAiB,OAAA;AACjB,gHAAA,kBAAkB,OAAA;AAClB,mHAAA,qBAAqB,OAAA;AACrB,oHAAA,sBAAsB,OAAA;AACtB,gHAAA,kBAAkB,OAAA;AAKpB,2CAAiD;AAAxC,2GAAA,eAAe,OAAA;AACxB,yDAK+B;AAJ7B,yHAA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B;AAJ7B,yHAAA,sBAAsB,OAAA;AACtB,4HAAA,yBAAyB,OAAA;AACzB,kIAAA,+BAA+B,OAAA;AAGjC,uEAAkF;AAAzE,4HAAA,0BAA0B,OAAA;AACnC,+CAA6D;AAApD,uHAAA,yBAAyB,OAAA;AAClC,2CAawB;AAZtB,mHAAA,uBAAuB,OAAA;AACvB,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AACnB,kHAAA,sBAAsB,OAAA;AACtB,iHAAA,qBAAqB,OAAA;AACrB,2GAAA,eAAe,OAAA;AACf,wHAAA,4BAA4B,OAAA;AAC5B,+GAAA,mBAAmB,OAAA;AAMrB,qEAGqC;AAFnC,qIAAA,4BAA4B,OAAA;AAC5B,sIAAA,6BAA6B,OAAA;AAE/B,mGAIoD;AAHlD,yJAAA,iCAAiC,OAAA;AACjC,2JAAA,mCAAmC,OAAA;AACnC,2JAAA,mCAAmC,OAAA;AAErC,mFAAuF;AAA9E,iJAAA,iCAAiC,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum DeliverableSpecIntrospectionFailure {
|
|
2
|
+
AmbiguousSchema = "AMBIGUOUS_SCHEMA",
|
|
3
|
+
ExportNotFound = "EXPORT_NOT_FOUND"
|
|
4
|
+
}
|
|
5
|
+
export declare class DeliverableSpecIntrospectionError extends Error {
|
|
6
|
+
readonly reason: DeliverableSpecIntrospectionFailure;
|
|
7
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
8
|
+
constructor(reason: DeliverableSpecIntrospectionFailure, message: string, details?: Readonly<Record<string, unknown>>);
|
|
9
|
+
toJSON(): Readonly<Record<string, unknown>>;
|
|
10
|
+
}
|
|
11
|
+
export declare function isDeliverableSpecIntrospectionError(err: unknown): err is DeliverableSpecIntrospectionError;
|
|
12
|
+
//# sourceMappingURL=deliverable-spec-introspection-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable-spec-introspection-error.d.ts","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-introspection-error.ts"],"names":[],"mappings":"AAcA,oBAAY,mCAAmC;IAQ7C,eAAe,qBAAqB;IAMpC,cAAc,qBAAqB;CACpC;AAED,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,MAAM,EAAE,mCAAmC,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;gBAGlD,MAAM,EAAE,mCAAmC,EAC3C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IASjD,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAQ5C;AAGD,wBAAgB,mCAAmC,CACjD,GAAG,EAAE,OAAO,GACX,GAAG,IAAI,iCAAiC,CAE1C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeliverableSpecIntrospectionError = exports.DeliverableSpecIntrospectionFailure = void 0;
|
|
4
|
+
exports.isDeliverableSpecIntrospectionError = isDeliverableSpecIntrospectionError;
|
|
5
|
+
var DeliverableSpecIntrospectionFailure;
|
|
6
|
+
(function (DeliverableSpecIntrospectionFailure) {
|
|
7
|
+
DeliverableSpecIntrospectionFailure["AmbiguousSchema"] = "AMBIGUOUS_SCHEMA";
|
|
8
|
+
DeliverableSpecIntrospectionFailure["ExportNotFound"] = "EXPORT_NOT_FOUND";
|
|
9
|
+
})(DeliverableSpecIntrospectionFailure || (exports.DeliverableSpecIntrospectionFailure = DeliverableSpecIntrospectionFailure = {}));
|
|
10
|
+
class DeliverableSpecIntrospectionError extends Error {
|
|
11
|
+
reason;
|
|
12
|
+
details;
|
|
13
|
+
constructor(reason, message, details = {}) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'DeliverableSpecIntrospectionError';
|
|
16
|
+
this.reason = reason;
|
|
17
|
+
this.details = details;
|
|
18
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
19
|
+
}
|
|
20
|
+
toJSON() {
|
|
21
|
+
return {
|
|
22
|
+
name: this.name,
|
|
23
|
+
reason: this.reason,
|
|
24
|
+
message: this.message,
|
|
25
|
+
details: this.details,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.DeliverableSpecIntrospectionError = DeliverableSpecIntrospectionError;
|
|
30
|
+
function isDeliverableSpecIntrospectionError(err) {
|
|
31
|
+
return err instanceof DeliverableSpecIntrospectionError;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=deliverable-spec-introspection-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable-spec-introspection-error.js","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-introspection-error.ts"],"names":[],"mappings":";;;AA0DA,kFAIC;AAhDD,IAAY,mCAeX;AAfD,WAAY,mCAAmC;IAQ7C,2EAAoC,CAAA;IAMpC,0EAAmC,CAAA;AACrC,CAAC,EAfW,mCAAmC,mDAAnC,mCAAmC,QAe9C;AAED,MAAa,iCAAkC,SAAQ,KAAK;IACjD,MAAM,CAAsC;IAC5C,OAAO,CAAoC;IAEpD,YACE,MAA2C,EAC3C,OAAe,EACf,UAA6C,EAAE;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAxBD,8EAwBC;AAGD,SAAgB,mCAAmC,CACjD,GAAY;IAEZ,OAAO,GAAG,YAAY,iCAAiC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function extractZodTopLevelObjectKeys(source: string): readonly string[] | null;
|
|
1
|
+
export declare function extractZodTopLevelObjectKeys(source: string, exportName?: string | null): readonly string[] | null;
|
|
2
2
|
export declare function extractJsonSchemaTopLevelKeys(source: string | object): readonly string[] | null;
|
|
3
3
|
//# sourceMappingURL=deliverable-spec-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliverable-spec-keys.d.ts","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-keys.ts"],"names":[],"mappings":"AA+
|
|
1
|
+
{"version":3,"file":"deliverable-spec-keys.d.ts","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-keys.ts"],"names":[],"mappings":"AA+DA,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,SAAS,MAAM,EAAE,GAAG,IAAI,CA2B1B;AAYD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,SAAS,MAAM,EAAE,GAAG,IAAI,CAiB1B"}
|
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractZodTopLevelObjectKeys = extractZodTopLevelObjectKeys;
|
|
4
4
|
exports.extractJsonSchemaTopLevelKeys = extractJsonSchemaTopLevelKeys;
|
|
5
|
-
|
|
5
|
+
const deliverable_spec_introspection_error_1 = require("./deliverable-spec-introspection-error");
|
|
6
|
+
const deliverable_spec_source_scan_1 = require("./deliverable-spec-source-scan");
|
|
7
|
+
function extractZodTopLevelObjectKeys(source, exportName) {
|
|
6
8
|
if (!source || source.trim().length === 0)
|
|
7
9
|
return null;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
+
const declarations = (0, deliverable_spec_source_scan_1.scanTopLevelZodObjectDeclarations)(source);
|
|
11
|
+
const named = exportName?.trim() ?? '';
|
|
12
|
+
if (named.length > 0) {
|
|
13
|
+
const match = declarations.find((d) => d.exportName === named);
|
|
14
|
+
if (!match) {
|
|
15
|
+
throw new deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionError(deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionFailure.ExportNotFound, `deliverable spec names '${named}' as its Zod contract, but the source declares no top-level \`z.object({ … })\` bound to that name. ` +
|
|
16
|
+
`${describeDeclarations(declarations)} Fix the spec's \`zodSchemaExport\`, or check the literal's braces are balanced.`, { exportName: named, available: availableNames(declarations) });
|
|
17
|
+
}
|
|
18
|
+
return match.keys;
|
|
19
|
+
}
|
|
20
|
+
if (declarations.length === 0)
|
|
10
21
|
return null;
|
|
11
|
-
|
|
22
|
+
if (declarations.length === 1)
|
|
23
|
+
return declarations[0].keys;
|
|
24
|
+
throw new deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionError(deliverable_spec_introspection_error_1.DeliverableSpecIntrospectionFailure.AmbiguousSchema, `deliverable spec source declares ${declarations.length} top-level \`z.object({ … })\` schemas and the spec does not say which one is the contract. ` +
|
|
25
|
+
`${describeDeclarations(declarations)} Set \`zodSchemaExport\` on the spec to the contract's export name.`, { available: availableNames(declarations) });
|
|
12
26
|
}
|
|
13
27
|
function extractJsonSchemaTopLevelKeys(source) {
|
|
14
28
|
let parsed;
|
|
@@ -36,55 +50,16 @@ function extractJsonSchemaTopLevelKeys(source) {
|
|
|
36
50
|
function isPlainObject(v) {
|
|
37
51
|
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
38
52
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const start = match.index + match[0].length;
|
|
44
|
-
let depth = 1;
|
|
45
|
-
for (let i = start; i < source.length; i += 1) {
|
|
46
|
-
const ch = source[i];
|
|
47
|
-
if (ch === '{')
|
|
48
|
-
depth += 1;
|
|
49
|
-
else if (ch === '}' && --depth === 0)
|
|
50
|
-
return source.slice(start, i);
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
+
function availableNames(declarations) {
|
|
54
|
+
return declarations
|
|
55
|
+
.map((d) => d.exportName)
|
|
56
|
+
.filter((n) => n !== null);
|
|
53
57
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (updateDepth(depth, body[i]))
|
|
59
|
-
continue;
|
|
60
|
-
if (depth.brace !== 0 || depth.paren !== 0)
|
|
61
|
-
continue;
|
|
62
|
-
if (i !== 0 && body[i] !== '\n' && body[i] !== ',')
|
|
63
|
-
continue;
|
|
64
|
-
const rest = body.slice(i === 0 ? 0 : i + 1);
|
|
65
|
-
const keyMatch = /^\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*:/.exec(rest);
|
|
66
|
-
if (keyMatch?.[1])
|
|
67
|
-
keys.push(keyMatch[1]);
|
|
68
|
-
}
|
|
69
|
-
return keys;
|
|
70
|
-
}
|
|
71
|
-
function updateDepth(depth, ch) {
|
|
72
|
-
if (ch === '{') {
|
|
73
|
-
depth.brace += 1;
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
if (ch === '}') {
|
|
77
|
-
depth.brace = Math.max(0, depth.brace - 1);
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
if (ch === '(') {
|
|
81
|
-
depth.paren += 1;
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
if (ch === ')') {
|
|
85
|
-
depth.paren = Math.max(0, depth.paren - 1);
|
|
86
|
-
return true;
|
|
58
|
+
function describeDeclarations(declarations) {
|
|
59
|
+
const names = availableNames(declarations);
|
|
60
|
+
if (names.length === 0) {
|
|
61
|
+
return 'The source declares no NAMED top-level schema.';
|
|
87
62
|
}
|
|
88
|
-
return
|
|
63
|
+
return `Top-level schemas in this source: ${names.join(', ')}.`;
|
|
89
64
|
}
|
|
90
65
|
//# sourceMappingURL=deliverable-spec-keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliverable-spec-keys.js","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-keys.ts"],"names":[],"mappings":";;AA+
|
|
1
|
+
{"version":3,"file":"deliverable-spec-keys.js","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-keys.ts"],"names":[],"mappings":";;AA+DA,oEA8BC;AAYD,sEAmBC;AAjGD,iGAGgD;AAChD,iFAAmF;AAgCnF,SAAgB,4BAA4B,CAC1C,MAAc,EACd,UAA0B;IAE1B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,YAAY,GAAG,IAAA,gEAAiC,EAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEvC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,wEAAiC,CACzC,0EAAmC,CAAC,cAAc,EAClD,2BAA2B,KAAK,sGAAsG;gBACpI,GAAG,oBAAoB,CAAC,YAAY,CAAC,kFAAkF,EACzH,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,YAAY,CAAC,EAAE,CAC/D,CAAC;QACJ,CAA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CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,cAAc,CACrB,YAAqD;IAErD,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;SACxB,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,oBAAoB,CAC3B,YAAqD;IAErD,MAAM,KAAK,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,gDAAgD,CAAC;IAC1D,CAAC;IACD,OAAO,qCAAqC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface TopLevelZodObjectDeclaration {
|
|
2
|
+
readonly exportName: string | null;
|
|
3
|
+
readonly keys: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export declare function scanTopLevelZodObjectDeclarations(source: string): readonly TopLevelZodObjectDeclaration[];
|
|
6
|
+
//# sourceMappingURL=deliverable-spec-source-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable-spec-source-scan.d.ts","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-source-scan.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,4BAA4B;IAE3C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAwFD,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,GACb,SAAS,4BAA4B,EAAE,CAsCzC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanTopLevelZodObjectDeclarations = scanTopLevelZodObjectDeclarations;
|
|
4
|
+
function skipTriviaAt(source, index, prevCode) {
|
|
5
|
+
const ch = source[index];
|
|
6
|
+
const next = source[index + 1];
|
|
7
|
+
if (ch === '/' && next === '/')
|
|
8
|
+
return endOfLineComment(source, index + 2);
|
|
9
|
+
if (ch === '/' && next === '*')
|
|
10
|
+
return endOfBlockComment(source, index + 2);
|
|
11
|
+
if (ch === "'" || ch === '"' || ch === '`') {
|
|
12
|
+
return endOfQuoted(source, index + 1, ch);
|
|
13
|
+
}
|
|
14
|
+
if (ch === '/' && (prevCode === '(' || prevCode === ',')) {
|
|
15
|
+
return endOfQuoted(source, index + 1, '/');
|
|
16
|
+
}
|
|
17
|
+
return index;
|
|
18
|
+
}
|
|
19
|
+
function endOfLineComment(source, from) {
|
|
20
|
+
const nl = source.indexOf('\n', from);
|
|
21
|
+
return nl === -1 ? source.length : nl + 1;
|
|
22
|
+
}
|
|
23
|
+
function endOfBlockComment(source, from) {
|
|
24
|
+
const end = source.indexOf('*/', from);
|
|
25
|
+
return end === -1 ? source.length : end + 2;
|
|
26
|
+
}
|
|
27
|
+
function endOfQuoted(source, from, terminator) {
|
|
28
|
+
for (let i = from; i < source.length; i += 1) {
|
|
29
|
+
const ch = source[i];
|
|
30
|
+
if (ch === '\\') {
|
|
31
|
+
i += 1;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (ch === terminator)
|
|
35
|
+
return i + 1;
|
|
36
|
+
}
|
|
37
|
+
return source.length;
|
|
38
|
+
}
|
|
39
|
+
function newDepths() {
|
|
40
|
+
return { brace: 0, paren: 0, bracket: 0 };
|
|
41
|
+
}
|
|
42
|
+
function applyDepth(depths, ch) {
|
|
43
|
+
if (ch === '{')
|
|
44
|
+
depths.brace += 1;
|
|
45
|
+
else if (ch === '}')
|
|
46
|
+
depths.brace = Math.max(0, depths.brace - 1);
|
|
47
|
+
else if (ch === '(')
|
|
48
|
+
depths.paren += 1;
|
|
49
|
+
else if (ch === ')')
|
|
50
|
+
depths.paren = Math.max(0, depths.paren - 1);
|
|
51
|
+
else if (ch === '[')
|
|
52
|
+
depths.bracket += 1;
|
|
53
|
+
else if (ch === ']')
|
|
54
|
+
depths.bracket = Math.max(0, depths.bracket - 1);
|
|
55
|
+
}
|
|
56
|
+
function isAtTopLevel(depths) {
|
|
57
|
+
return (depths.brace === 0 && depths.paren === 0 && depths.bracket === 0);
|
|
58
|
+
}
|
|
59
|
+
function scanTopLevelZodObjectDeclarations(source) {
|
|
60
|
+
const out = [];
|
|
61
|
+
const depths = newDepths();
|
|
62
|
+
let prevCode = '';
|
|
63
|
+
let i = 0;
|
|
64
|
+
while (i < source.length) {
|
|
65
|
+
const afterTrivia = skipTriviaAt(source, i, prevCode);
|
|
66
|
+
if (afterTrivia !== i) {
|
|
67
|
+
i = afterTrivia;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (isAtTopLevel(depths) && matchesZodObjectAt(source, i)) {
|
|
71
|
+
const bodyStart = openingBraceIndexAfterZodObject(source, i);
|
|
72
|
+
const bodyEnd = bodyStart === null ? null : matchingBraceIndex(source, bodyStart);
|
|
73
|
+
if (bodyStart !== null && bodyEnd !== null) {
|
|
74
|
+
out.push({
|
|
75
|
+
exportName: bindingNameBefore(source, i),
|
|
76
|
+
keys: parseObjectKeysAtTopLevel(source.slice(bodyStart, bodyEnd)),
|
|
77
|
+
});
|
|
78
|
+
i = bodyEnd + 1;
|
|
79
|
+
prevCode = '}';
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const ch = source[i];
|
|
84
|
+
applyDepth(depths, ch);
|
|
85
|
+
if (ch !== undefined && !/\s/.test(ch))
|
|
86
|
+
prevCode = ch;
|
|
87
|
+
i += 1;
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
function matchesZodObjectAt(source, index) {
|
|
92
|
+
if (!source.startsWith('z.object', index))
|
|
93
|
+
return false;
|
|
94
|
+
const prev = index > 0 ? (source[index - 1] ?? '') : '';
|
|
95
|
+
return !/[A-Za-z0-9_$.]/.test(prev);
|
|
96
|
+
}
|
|
97
|
+
function openingBraceIndexAfterZodObject(source, index) {
|
|
98
|
+
let i = skipWhitespace(source, index + 'z.object'.length);
|
|
99
|
+
if (source[i] !== '(')
|
|
100
|
+
return null;
|
|
101
|
+
i = skipWhitespace(source, i + 1);
|
|
102
|
+
if (source[i] !== '{')
|
|
103
|
+
return null;
|
|
104
|
+
return i + 1;
|
|
105
|
+
}
|
|
106
|
+
function matchingBraceIndex(source, bodyStart) {
|
|
107
|
+
let depth = 1;
|
|
108
|
+
let prevCode = '{';
|
|
109
|
+
let i = bodyStart;
|
|
110
|
+
while (i < source.length) {
|
|
111
|
+
const afterTrivia = skipTriviaAt(source, i, prevCode);
|
|
112
|
+
if (afterTrivia !== i) {
|
|
113
|
+
i = afterTrivia;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const ch = source[i];
|
|
117
|
+
if (ch === '{')
|
|
118
|
+
depth += 1;
|
|
119
|
+
else if (ch === '}') {
|
|
120
|
+
depth -= 1;
|
|
121
|
+
if (depth === 0)
|
|
122
|
+
return i;
|
|
123
|
+
}
|
|
124
|
+
if (ch !== undefined && !/\s/.test(ch))
|
|
125
|
+
prevCode = ch;
|
|
126
|
+
i += 1;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const BINDING_LOOKBEHIND = 400;
|
|
131
|
+
const BINDING_TAIL = /(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*(?::[^=]*)?=\s*$/;
|
|
132
|
+
function bindingNameBefore(source, index) {
|
|
133
|
+
const from = Math.max(0, index - BINDING_LOOKBEHIND);
|
|
134
|
+
return BINDING_TAIL.exec(source.slice(from, index))?.[1] ?? null;
|
|
135
|
+
}
|
|
136
|
+
function skipWhitespace(source, index) {
|
|
137
|
+
let i = index;
|
|
138
|
+
while (i < source.length && /\s/.test(source[i]))
|
|
139
|
+
i += 1;
|
|
140
|
+
return i;
|
|
141
|
+
}
|
|
142
|
+
function parseObjectKeysAtTopLevel(body) {
|
|
143
|
+
const keys = [];
|
|
144
|
+
const seen = new Set();
|
|
145
|
+
for (const segment of splitTopLevelSegments(body)) {
|
|
146
|
+
const key = leadingKeyOf(segment);
|
|
147
|
+
if (key !== null && !seen.has(key)) {
|
|
148
|
+
seen.add(key);
|
|
149
|
+
keys.push(key);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return Object.freeze(keys);
|
|
153
|
+
}
|
|
154
|
+
function splitTopLevelSegments(body) {
|
|
155
|
+
const segments = [];
|
|
156
|
+
const depths = newDepths();
|
|
157
|
+
let prevCode = '';
|
|
158
|
+
let start = 0;
|
|
159
|
+
let i = 0;
|
|
160
|
+
while (i < body.length) {
|
|
161
|
+
const afterTrivia = skipTriviaAt(body, i, prevCode);
|
|
162
|
+
if (afterTrivia !== i) {
|
|
163
|
+
i = afterTrivia;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const ch = body[i];
|
|
167
|
+
if (ch === ',' && isAtTopLevel(depths)) {
|
|
168
|
+
segments.push(body.slice(start, i));
|
|
169
|
+
start = i + 1;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
applyDepth(depths, ch);
|
|
173
|
+
}
|
|
174
|
+
if (ch !== undefined && !/\s/.test(ch))
|
|
175
|
+
prevCode = ch;
|
|
176
|
+
i += 1;
|
|
177
|
+
}
|
|
178
|
+
segments.push(body.slice(start));
|
|
179
|
+
return segments;
|
|
180
|
+
}
|
|
181
|
+
const LEADING_TRIVIA = /^(?:\s|\/\/[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)+/;
|
|
182
|
+
const LEADING_KEY = /^(?:([A-Za-z_$][A-Za-z0-9_$]*)|'([^']+)'|"([^"]+)")\s*:/;
|
|
183
|
+
function leadingKeyOf(segment) {
|
|
184
|
+
const match = LEADING_KEY.exec(segment.replace(LEADING_TRIVIA, ''));
|
|
185
|
+
if (!match)
|
|
186
|
+
return null;
|
|
187
|
+
return match[1] ?? match[2] ?? match[3] ?? null;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=deliverable-spec-source-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable-spec-source-scan.js","sourceRoot":"","sources":["../../../src/workflow/lib/deliverable-spec-source-scan.ts"],"names":[],"mappings":";;AAsHA,8EAwCC;AAjHD,SAAS,YAAY,CAAC,MAAc,EAAE,KAAa,EAAE,QAAgB;IACnE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAE/B,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,gBAAgB,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,iBAAiB,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC5E,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;QAC3C,OAAO,WAAW,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,CAAC,EAAE,CAAC;QACzD,OAAO,WAAW,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAA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C,IAAI,IAAI,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/dsl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Consolidated Xema OS DSL bundle — pure compilers/codecs for the workflow DSL, workspace-manifest DSL, deliverable-spec DSL, and the workflow payload codec. One package, per-surface subpath exports. No framework/runtime deps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ts-jest": "^29.4.9",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
34
|
"undici-types": "~7.16.0",
|
|
35
|
-
"@xemahq/kernel-contracts": "^0.
|
|
35
|
+
"@xemahq/kernel-contracts": "^8.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"ajv": "^8.20.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"clean": "rm -rf dist",
|
|
104
|
-
"build": "tsc -p tsconfig.json && node ./scripts/copy-schemas.mjs",
|
|
104
|
+
"build": "tsc -p tsconfig.build.json && node ./scripts/copy-schemas.mjs",
|
|
105
105
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
106
106
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
107
107
|
"test": "jest --config jest.config.ts"
|
|
@@ -138,6 +138,19 @@ export const DeliverableSpecSpecSchema = z
|
|
|
138
138
|
// ZOD_SCHEMA-specific. Mutually exclusive with `zodSchemaSourceFile`.
|
|
139
139
|
zodSchemaSource: z.string().max(200_000).optional(),
|
|
140
140
|
zodSchemaSourceFile: z.string().min(1).optional(),
|
|
141
|
+
// Names WHICH exported `z.object({ … })` in the source is the
|
|
142
|
+
// deliverable contract. Required only when the source declares more
|
|
143
|
+
// than one top-level schema — with a single schema there is nothing
|
|
144
|
+
// to disambiguate. A multi-schema source without this fails fast at
|
|
145
|
+
// introspection rather than silently taking the first literal (which
|
|
146
|
+
// is an element/helper schema whenever the contract references one).
|
|
147
|
+
zodSchemaExport: z
|
|
148
|
+
.string()
|
|
149
|
+
.regex(
|
|
150
|
+
/^[A-Za-z_$][A-Za-z0-9_$]*$/,
|
|
151
|
+
'zodSchemaExport must be a JavaScript identifier (the exported const name)',
|
|
152
|
+
)
|
|
153
|
+
.optional(),
|
|
141
154
|
|
|
142
155
|
// ENDPOINT_FETCH-specific. Shape matches `EndpointFetchSpec` in
|
|
143
156
|
// `@xemahq/kernel-contracts/agent-workspace` — kept as an open record here
|
|
@@ -174,6 +187,16 @@ export const DeliverableSpecSpecSchema = z
|
|
|
174
187
|
(s) =>
|
|
175
188
|
!(s.multiPage === true && (s.pages === undefined || s.pages.length === 0)),
|
|
176
189
|
{ message: 'multiPage=true requires non-empty `pages[]`' },
|
|
190
|
+
)
|
|
191
|
+
.refine(
|
|
192
|
+
(s) =>
|
|
193
|
+
s.zodSchemaExport === undefined ||
|
|
194
|
+
s.zodSchemaSource !== undefined ||
|
|
195
|
+
s.zodSchemaSourceFile !== undefined,
|
|
196
|
+
{
|
|
197
|
+
message:
|
|
198
|
+
'`zodSchemaExport` names an export in the Zod source, so it requires `zodSchemaSource` or `zodSchemaSourceFile`',
|
|
199
|
+
},
|
|
177
200
|
);
|
|
178
201
|
|
|
179
202
|
export const DeliverableSpecManifestSchema = z
|
|
Binary file
|
package/src/workflow/index.ts
CHANGED
|
@@ -74,6 +74,13 @@ export {
|
|
|
74
74
|
extractZodTopLevelObjectKeys,
|
|
75
75
|
extractJsonSchemaTopLevelKeys,
|
|
76
76
|
} from './lib/deliverable-spec-keys';
|
|
77
|
+
export {
|
|
78
|
+
DeliverableSpecIntrospectionError,
|
|
79
|
+
DeliverableSpecIntrospectionFailure,
|
|
80
|
+
isDeliverableSpecIntrospectionError,
|
|
81
|
+
} from './lib/deliverable-spec-introspection-error';
|
|
82
|
+
export { scanTopLevelZodObjectDeclarations } from './lib/deliverable-spec-source-scan';
|
|
83
|
+
export type { TopLevelZodObjectDeclaration } from './lib/deliverable-spec-source-scan';
|
|
77
84
|
export type {
|
|
78
85
|
ActionContract,
|
|
79
86
|
ActionManifest,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failure raised when a deliverable spec's Zod source cannot be
|
|
3
|
+
* introspected UNAMBIGUOUSLY. Distinct from the `null` return of the
|
|
4
|
+
* extractors, which means "this source has no introspectable shape at
|
|
5
|
+
* all" — a spec kind or body we simply cannot read. This error means the
|
|
6
|
+
* opposite: the source DOES declare a shape, but the spec has not said
|
|
7
|
+
* WHICH one is the contract, so any answer would be a guess.
|
|
8
|
+
*
|
|
9
|
+
* Callers MUST branch on `.reason` — free-form message matching is
|
|
10
|
+
* forbidden so handling stays exhaustive (same convention as
|
|
11
|
+
* `WorkflowDslError.code`).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Closed set of introspection failure reasons. */
|
|
15
|
+
export enum DeliverableSpecIntrospectionFailure {
|
|
16
|
+
/**
|
|
17
|
+
* The source declares two or more top-level `z.object({ … })` schemas
|
|
18
|
+
* and the spec did not name which one is the contract. Resolving this
|
|
19
|
+
* by position ("the first one") is guesswork: a schema hoisted above
|
|
20
|
+
* the contract purely so the contract can reference it would silently
|
|
21
|
+
* become the contract.
|
|
22
|
+
*/
|
|
23
|
+
AmbiguousSchema = 'AMBIGUOUS_SCHEMA',
|
|
24
|
+
/**
|
|
25
|
+
* The spec named a contract export (`zodSchemaExport`) that the source
|
|
26
|
+
* does not declare as a top-level `z.object({ … })` — a typo, a rename,
|
|
27
|
+
* or an unbalanced literal the scanner could not close.
|
|
28
|
+
*/
|
|
29
|
+
ExportNotFound = 'EXPORT_NOT_FOUND',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class DeliverableSpecIntrospectionError extends Error {
|
|
33
|
+
readonly reason: DeliverableSpecIntrospectionFailure;
|
|
34
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
reason: DeliverableSpecIntrospectionFailure,
|
|
38
|
+
message: string,
|
|
39
|
+
details: Readonly<Record<string, unknown>> = {},
|
|
40
|
+
) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = 'DeliverableSpecIntrospectionError';
|
|
43
|
+
this.reason = reason;
|
|
44
|
+
this.details = details;
|
|
45
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toJSON(): Readonly<Record<string, unknown>> {
|
|
49
|
+
return {
|
|
50
|
+
name: this.name,
|
|
51
|
+
reason: this.reason,
|
|
52
|
+
message: this.message,
|
|
53
|
+
details: this.details,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Narrowing helper. */
|
|
59
|
+
export function isDeliverableSpecIntrospectionError(
|
|
60
|
+
err: unknown,
|
|
61
|
+
): err is DeliverableSpecIntrospectionError {
|
|
62
|
+
return err instanceof DeliverableSpecIntrospectionError;
|
|
63
|
+
}
|
|
@@ -6,34 +6,91 @@
|
|
|
6
6
|
* spec the producing job declared via `with.deliverableSpecRef` —
|
|
7
7
|
* catching "the YAML reads `.changeUnits` but the spec has
|
|
8
8
|
* `.handoffPackage`" at compile time, not at runtime when projection
|
|
9
|
-
* blows up.
|
|
9
|
+
* blows up. The same keys are the ONLY content gate the harvester has
|
|
10
|
+
* for a `ZOD_SCHEMA` spec (nothing anywhere evaluates the Zod schema),
|
|
11
|
+
* so a wrong key set silently rejects correct agent output.
|
|
10
12
|
*
|
|
11
13
|
* Two extractors:
|
|
12
|
-
* - `extractZodTopLevelObjectKeys`:
|
|
13
|
-
* literal
|
|
14
|
-
* the deliverable-specs-api
|
|
15
|
-
* validation; single source of
|
|
16
|
-
* and the harvester agree.
|
|
14
|
+
* - `extractZodTopLevelObjectKeys`: reads the field names of the
|
|
15
|
+
* `z.object({ … })` literal a spec designates as its contract, out of
|
|
16
|
+
* TypeScript Zod source. Same scanner the deliverable-specs-api
|
|
17
|
+
* ZodSchemaHandler uses for harvest-time validation; single source of
|
|
18
|
+
* truth lives here so the DSL compiler and the harvester agree.
|
|
17
19
|
* - `extractJsonSchemaTopLevelKeys`: pulls keys from the `properties`
|
|
18
20
|
* object of a JSON Schema document.
|
|
19
21
|
*
|
|
20
|
-
* Both return `null` when
|
|
21
|
-
* field check (preview / specs without introspectable
|
|
22
|
+
* Both return `null` when a source has NO introspectable shape, so
|
|
23
|
+
* callers can skip the field check (preview / specs without introspectable
|
|
24
|
+
* shape). `null` never means "we guessed" — an unresolvable-but-present
|
|
25
|
+
* shape raises `DeliverableSpecIntrospectionError` instead.
|
|
22
26
|
*/
|
|
23
27
|
|
|
28
|
+
import {
|
|
29
|
+
DeliverableSpecIntrospectionError,
|
|
30
|
+
DeliverableSpecIntrospectionFailure,
|
|
31
|
+
} from './deliverable-spec-introspection-error';
|
|
32
|
+
import { scanTopLevelZodObjectDeclarations } from './deliverable-spec-source-scan';
|
|
33
|
+
|
|
34
|
+
import type { TopLevelZodObjectDeclaration } from './deliverable-spec-source-scan';
|
|
35
|
+
|
|
24
36
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
37
|
+
* Return the top-level field identifiers of the `z.object({ … })` literal
|
|
38
|
+
* that IS this spec's contract.
|
|
39
|
+
*
|
|
40
|
+
* Which literal that is comes from the spec, not from source order:
|
|
41
|
+
*
|
|
42
|
+
* - `exportName` given → the literal bound to that name. Absent from
|
|
43
|
+
* the source ⇒ `EXPORT_NOT_FOUND`, never a fallback to another
|
|
44
|
+
* schema. A spec that names a contract it does not have is broken,
|
|
45
|
+
* and guessing would reintroduce exactly the bug this parameter
|
|
46
|
+
* exists to remove.
|
|
47
|
+
* - `exportName` omitted, source declares exactly ONE top-level
|
|
48
|
+
* literal → that one. There is nothing to choose between, so the
|
|
49
|
+
* spec is not asked to restate it.
|
|
50
|
+
* - `exportName` omitted, source declares TWO OR MORE →
|
|
51
|
+
* `AMBIGUOUS_SCHEMA`. This is the case the predecessor resolved by
|
|
52
|
+
* taking the first literal in the file, which silently picked an
|
|
53
|
+
* element/helper schema hoisted above the contract that references
|
|
54
|
+
* it. There is no correct positional answer; the spec must say.
|
|
55
|
+
* - source declares NONE → `null` (no introspectable shape).
|
|
56
|
+
*
|
|
57
|
+
* Deliberately a scanner, not a Zod evaluation: this runs in the DSL
|
|
58
|
+
* compiler, a CI gate, and a request-scoped API handler, none of which
|
|
59
|
+
* may transpile or execute spec-authored TypeScript.
|
|
60
|
+
*
|
|
61
|
+
* @throws {DeliverableSpecIntrospectionError} on a named export that is
|
|
62
|
+
* absent, or on an unnamed contract in a multi-schema source.
|
|
31
63
|
*/
|
|
32
|
-
export function extractZodTopLevelObjectKeys(
|
|
64
|
+
export function extractZodTopLevelObjectKeys(
|
|
65
|
+
source: string,
|
|
66
|
+
exportName?: string | null,
|
|
67
|
+
): readonly string[] | null {
|
|
33
68
|
if (!source || source.trim().length === 0) return null;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
const declarations = scanTopLevelZodObjectDeclarations(source);
|
|
70
|
+
const named = exportName?.trim() ?? '';
|
|
71
|
+
|
|
72
|
+
if (named.length > 0) {
|
|
73
|
+
const match = declarations.find((d) => d.exportName === named);
|
|
74
|
+
if (!match) {
|
|
75
|
+
throw new DeliverableSpecIntrospectionError(
|
|
76
|
+
DeliverableSpecIntrospectionFailure.ExportNotFound,
|
|
77
|
+
`deliverable spec names '${named}' as its Zod contract, but the source declares no top-level \`z.object({ … })\` bound to that name. ` +
|
|
78
|
+
`${describeDeclarations(declarations)} Fix the spec's \`zodSchemaExport\`, or check the literal's braces are balanced.`,
|
|
79
|
+
{ exportName: named, available: availableNames(declarations) },
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return match.keys;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (declarations.length === 0) return null;
|
|
86
|
+
if (declarations.length === 1) return declarations[0]!.keys;
|
|
87
|
+
|
|
88
|
+
throw new DeliverableSpecIntrospectionError(
|
|
89
|
+
DeliverableSpecIntrospectionFailure.AmbiguousSchema,
|
|
90
|
+
`deliverable spec source declares ${declarations.length} top-level \`z.object({ … })\` schemas and the spec does not say which one is the contract. ` +
|
|
91
|
+
`${describeDeclarations(declarations)} Set \`zodSchemaExport\` on the spec to the contract's export name.`,
|
|
92
|
+
{ available: availableNames(declarations) },
|
|
93
|
+
);
|
|
37
94
|
}
|
|
38
95
|
|
|
39
96
|
/**
|
|
@@ -71,39 +128,20 @@ function isPlainObject(v: unknown): v is Record<string, unknown> {
|
|
|
71
128
|
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
72
129
|
}
|
|
73
130
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
for (let i = start; i < source.length; i += 1) {
|
|
81
|
-
const ch = source[i];
|
|
82
|
-
if (ch === '{') depth += 1;
|
|
83
|
-
else if (ch === '}' && --depth === 0) return source.slice(start, i);
|
|
84
|
-
}
|
|
85
|
-
return null;
|
|
131
|
+
function availableNames(
|
|
132
|
+
declarations: readonly TopLevelZodObjectDeclaration[],
|
|
133
|
+
): readonly string[] {
|
|
134
|
+
return declarations
|
|
135
|
+
.map((d) => d.exportName)
|
|
136
|
+
.filter((n): n is string => n !== null);
|
|
86
137
|
}
|
|
87
138
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (depth.brace !== 0 || depth.paren !== 0) continue;
|
|
95
|
-
if (i !== 0 && body[i] !== '\n' && body[i] !== ',') continue;
|
|
96
|
-
const rest = body.slice(i === 0 ? 0 : i + 1);
|
|
97
|
-
const keyMatch = /^\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*:/.exec(rest);
|
|
98
|
-
if (keyMatch?.[1]) keys.push(keyMatch[1]);
|
|
139
|
+
function describeDeclarations(
|
|
140
|
+
declarations: readonly TopLevelZodObjectDeclaration[],
|
|
141
|
+
): string {
|
|
142
|
+
const names = availableNames(declarations);
|
|
143
|
+
if (names.length === 0) {
|
|
144
|
+
return 'The source declares no NAMED top-level schema.';
|
|
99
145
|
}
|
|
100
|
-
return
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function updateDepth(depth: { brace: number; paren: number }, ch: string | undefined): boolean {
|
|
104
|
-
if (ch === '{') { depth.brace += 1; return true; }
|
|
105
|
-
if (ch === '}') { depth.brace = Math.max(0, depth.brace - 1); return true; }
|
|
106
|
-
if (ch === '(') { depth.paren += 1; return true; }
|
|
107
|
-
if (ch === ')') { depth.paren = Math.max(0, depth.paren - 1); return true; }
|
|
108
|
-
return false;
|
|
146
|
+
return `Top-level schemas in this source: ${names.join(', ')}.`;
|
|
109
147
|
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character-level scanner over TypeScript Zod source, used to locate the
|
|
3
|
+
* `z.object({ … })` literals a deliverable spec declares at the TOP level
|
|
4
|
+
* and to read their field names.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately NOT a TypeScript parse or a Zod evaluation: introspection
|
|
7
|
+
* runs inside the DSL compiler, the CI gate, and a request-scoped API
|
|
8
|
+
* handler, none of which may transpile or execute spec-authored code.
|
|
9
|
+
* A scanner is enough because the only question asked is "which
|
|
10
|
+
* identifiers sit at depth 0 of this object literal".
|
|
11
|
+
*
|
|
12
|
+
* What it tracks, and why the naive regex it replaced could not:
|
|
13
|
+
* - comments, strings, template literals and regex literals, so a
|
|
14
|
+
* `z.object(`, a brace, or a comma appearing INSIDE one of those is
|
|
15
|
+
* never read as code;
|
|
16
|
+
* - brace + paren depth, so a NESTED `z.object(` (a field's own shape)
|
|
17
|
+
* is never confused with a top-level schema declaration;
|
|
18
|
+
* - the `const <Name> =` binding preceding each top-level literal, so a
|
|
19
|
+
* spec can name its contract instead of relying on source order.
|
|
20
|
+
*
|
|
21
|
+
* All three walkers below share ONE trivia primitive (`skipTriviaAt`) so
|
|
22
|
+
* they cannot drift into disagreeing about what counts as code.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** A `z.object({ … })` literal declared at the top level of the source. */
|
|
26
|
+
export interface TopLevelZodObjectDeclaration {
|
|
27
|
+
/** Binding name (`export const Foo = z.object({…})` → `Foo`), or null when anonymous. */
|
|
28
|
+
readonly exportName: string | null;
|
|
29
|
+
/** Field identifiers at depth 0 of the literal, in source order, de-duplicated. */
|
|
30
|
+
readonly keys: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* If a comment / string / template / regex literal STARTS at `index`,
|
|
35
|
+
* return the index just past its end; otherwise return `index` unchanged.
|
|
36
|
+
* An unterminated token consumes the rest of the source, which makes the
|
|
37
|
+
* callers treat it as "no readable shape from here" rather than
|
|
38
|
+
* re-entering code state mid-literal.
|
|
39
|
+
*
|
|
40
|
+
* Regex detection is bounded on purpose: a `/` is treated as a regex only
|
|
41
|
+
* when the previous non-whitespace code character is `(` or `,` — the only
|
|
42
|
+
* positions a regex occupies in a schema-declaration module
|
|
43
|
+
* (`.regex(/…/)`, `.refine(x, /…/)`). Division never appears in that
|
|
44
|
+
* position, so there is no ambiguous case to guess at.
|
|
45
|
+
*/
|
|
46
|
+
function skipTriviaAt(source: string, index: number, prevCode: string): number {
|
|
47
|
+
const ch = source[index];
|
|
48
|
+
const next = source[index + 1];
|
|
49
|
+
|
|
50
|
+
if (ch === '/' && next === '/') return endOfLineComment(source, index + 2);
|
|
51
|
+
if (ch === '/' && next === '*') return endOfBlockComment(source, index + 2);
|
|
52
|
+
if (ch === "'" || ch === '"' || ch === '`') {
|
|
53
|
+
return endOfQuoted(source, index + 1, ch);
|
|
54
|
+
}
|
|
55
|
+
if (ch === '/' && (prevCode === '(' || prevCode === ',')) {
|
|
56
|
+
return endOfQuoted(source, index + 1, '/');
|
|
57
|
+
}
|
|
58
|
+
return index;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function endOfLineComment(source: string, from: number): number {
|
|
62
|
+
const nl = source.indexOf('\n', from);
|
|
63
|
+
return nl === -1 ? source.length : nl + 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function endOfBlockComment(source: string, from: number): number {
|
|
67
|
+
const end = source.indexOf('*/', from);
|
|
68
|
+
return end === -1 ? source.length : end + 2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** End of a `'…'` / `"…"` / `` `…` `` / `/…/` token, honoring backslash escapes. */
|
|
72
|
+
function endOfQuoted(source: string, from: number, terminator: string): number {
|
|
73
|
+
for (let i = from; i < source.length; i += 1) {
|
|
74
|
+
const ch = source[i];
|
|
75
|
+
if (ch === '\\') {
|
|
76
|
+
i += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (ch === terminator) return i + 1;
|
|
80
|
+
}
|
|
81
|
+
return source.length;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Nesting counters shared by the depth-tracking walkers. */
|
|
85
|
+
interface Depths {
|
|
86
|
+
brace: number;
|
|
87
|
+
paren: number;
|
|
88
|
+
bracket: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function newDepths(): Depths {
|
|
92
|
+
return { brace: 0, paren: 0, bracket: 0 };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function applyDepth(depths: Depths, ch: string | undefined): void {
|
|
96
|
+
if (ch === '{') depths.brace += 1;
|
|
97
|
+
else if (ch === '}') depths.brace = Math.max(0, depths.brace - 1);
|
|
98
|
+
else if (ch === '(') depths.paren += 1;
|
|
99
|
+
else if (ch === ')') depths.paren = Math.max(0, depths.paren - 1);
|
|
100
|
+
else if (ch === '[') depths.bracket += 1;
|
|
101
|
+
else if (ch === ']') depths.bracket = Math.max(0, depths.bracket - 1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function isAtTopLevel(depths: Depths): boolean {
|
|
105
|
+
return (
|
|
106
|
+
depths.brace === 0 && depths.paren === 0 && depths.bracket === 0
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Find every `z.object({ … })` literal that sits at depth 0 — i.e. every
|
|
112
|
+
* schema the module declares in its own right, as opposed to a shape
|
|
113
|
+
* nested inside another schema.
|
|
114
|
+
*
|
|
115
|
+
* Literals whose braces never close are skipped: an unbalanced source has
|
|
116
|
+
* no readable shape, and reporting a truncated key list would be worse
|
|
117
|
+
* than reporting none.
|
|
118
|
+
*/
|
|
119
|
+
export function scanTopLevelZodObjectDeclarations(
|
|
120
|
+
source: string,
|
|
121
|
+
): readonly TopLevelZodObjectDeclaration[] {
|
|
122
|
+
const out: TopLevelZodObjectDeclaration[] = [];
|
|
123
|
+
const depths = newDepths();
|
|
124
|
+
let prevCode = '';
|
|
125
|
+
let i = 0;
|
|
126
|
+
|
|
127
|
+
while (i < source.length) {
|
|
128
|
+
const afterTrivia = skipTriviaAt(source, i, prevCode);
|
|
129
|
+
if (afterTrivia !== i) {
|
|
130
|
+
i = afterTrivia;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isAtTopLevel(depths) && matchesZodObjectAt(source, i)) {
|
|
135
|
+
const bodyStart = openingBraceIndexAfterZodObject(source, i);
|
|
136
|
+
const bodyEnd =
|
|
137
|
+
bodyStart === null ? null : matchingBraceIndex(source, bodyStart);
|
|
138
|
+
if (bodyStart !== null && bodyEnd !== null) {
|
|
139
|
+
out.push({
|
|
140
|
+
exportName: bindingNameBefore(source, i),
|
|
141
|
+
keys: parseObjectKeysAtTopLevel(source.slice(bodyStart, bodyEnd)),
|
|
142
|
+
});
|
|
143
|
+
// Resume AFTER the literal: its interior is already accounted
|
|
144
|
+
// for, and re-walking it could only produce nested matches we
|
|
145
|
+
// deliberately exclude.
|
|
146
|
+
i = bodyEnd + 1;
|
|
147
|
+
prevCode = '}';
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const ch = source[i];
|
|
153
|
+
applyDepth(depths, ch);
|
|
154
|
+
if (ch !== undefined && !/\s/.test(ch)) prevCode = ch;
|
|
155
|
+
i += 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return out;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** True when `z.object` starts exactly at `index` and is not part of a longer identifier. */
|
|
162
|
+
function matchesZodObjectAt(source: string, index: number): boolean {
|
|
163
|
+
if (!source.startsWith('z.object', index)) return false;
|
|
164
|
+
const prev = index > 0 ? (source[index - 1] ?? '') : '';
|
|
165
|
+
return !/[A-Za-z0-9_$.]/.test(prev);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Index just past the `{` of `z.object ( {`, or null when the call is not an object literal. */
|
|
169
|
+
function openingBraceIndexAfterZodObject(
|
|
170
|
+
source: string,
|
|
171
|
+
index: number,
|
|
172
|
+
): number | null {
|
|
173
|
+
let i = skipWhitespace(source, index + 'z.object'.length);
|
|
174
|
+
if (source[i] !== '(') return null;
|
|
175
|
+
i = skipWhitespace(source, i + 1);
|
|
176
|
+
if (source[i] !== '{') return null;
|
|
177
|
+
return i + 1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Index of the `}` closing the literal that starts at `bodyStart`, or null
|
|
182
|
+
* when it never closes.
|
|
183
|
+
*/
|
|
184
|
+
function matchingBraceIndex(source: string, bodyStart: number): number | null {
|
|
185
|
+
let depth = 1;
|
|
186
|
+
let prevCode = '{';
|
|
187
|
+
let i = bodyStart;
|
|
188
|
+
|
|
189
|
+
while (i < source.length) {
|
|
190
|
+
const afterTrivia = skipTriviaAt(source, i, prevCode);
|
|
191
|
+
if (afterTrivia !== i) {
|
|
192
|
+
i = afterTrivia;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const ch = source[i];
|
|
196
|
+
if (ch === '{') depth += 1;
|
|
197
|
+
else if (ch === '}') {
|
|
198
|
+
depth -= 1;
|
|
199
|
+
if (depth === 0) return i;
|
|
200
|
+
}
|
|
201
|
+
if (ch !== undefined && !/\s/.test(ch)) prevCode = ch;
|
|
202
|
+
i += 1;
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const BINDING_LOOKBEHIND = 400;
|
|
208
|
+
const BINDING_TAIL =
|
|
209
|
+
/(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*(?::[^=]*)?=\s*$/;
|
|
210
|
+
|
|
211
|
+
/** Name bound to the literal starting at `index` (`export const Foo = z.object(`), or null. */
|
|
212
|
+
function bindingNameBefore(source: string, index: number): string | null {
|
|
213
|
+
const from = Math.max(0, index - BINDING_LOOKBEHIND);
|
|
214
|
+
return BINDING_TAIL.exec(source.slice(from, index))?.[1] ?? null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function skipWhitespace(source: string, index: number): number {
|
|
218
|
+
let i = index;
|
|
219
|
+
while (i < source.length && /\s/.test(source[i]!)) i += 1;
|
|
220
|
+
return i;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Field identifiers at depth 0 of an object-literal body.
|
|
225
|
+
*
|
|
226
|
+
* Splits on depth-0 commas and reads the leading key of each segment, so
|
|
227
|
+
* a key is recorded exactly once. (The predecessor scanned for a key after
|
|
228
|
+
* BOTH the comma and the newline that followed it, emitting every
|
|
229
|
+
* multi-line key twice — harmless for a set-membership test, but the
|
|
230
|
+
* duplicates leaked into compiler error messages and the "known fields"
|
|
231
|
+
* preview shown to authors.)
|
|
232
|
+
*/
|
|
233
|
+
function parseObjectKeysAtTopLevel(body: string): readonly string[] {
|
|
234
|
+
const keys: string[] = [];
|
|
235
|
+
const seen = new Set<string>();
|
|
236
|
+
for (const segment of splitTopLevelSegments(body)) {
|
|
237
|
+
const key = leadingKeyOf(segment);
|
|
238
|
+
if (key !== null && !seen.has(key)) {
|
|
239
|
+
seen.add(key);
|
|
240
|
+
keys.push(key);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return Object.freeze(keys);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function splitTopLevelSegments(body: string): readonly string[] {
|
|
247
|
+
const segments: string[] = [];
|
|
248
|
+
const depths = newDepths();
|
|
249
|
+
let prevCode = '';
|
|
250
|
+
let start = 0;
|
|
251
|
+
let i = 0;
|
|
252
|
+
|
|
253
|
+
while (i < body.length) {
|
|
254
|
+
const afterTrivia = skipTriviaAt(body, i, prevCode);
|
|
255
|
+
if (afterTrivia !== i) {
|
|
256
|
+
i = afterTrivia;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const ch = body[i];
|
|
260
|
+
if (ch === ',' && isAtTopLevel(depths)) {
|
|
261
|
+
segments.push(body.slice(start, i));
|
|
262
|
+
start = i + 1;
|
|
263
|
+
} else {
|
|
264
|
+
applyDepth(depths, ch);
|
|
265
|
+
}
|
|
266
|
+
if (ch !== undefined && !/\s/.test(ch)) prevCode = ch;
|
|
267
|
+
i += 1;
|
|
268
|
+
}
|
|
269
|
+
segments.push(body.slice(start));
|
|
270
|
+
return segments;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const LEADING_TRIVIA = /^(?:\s|\/\/[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)+/;
|
|
274
|
+
const LEADING_KEY = /^(?:([A-Za-z_$][A-Za-z0-9_$]*)|'([^']+)'|"([^"]+)")\s*:/;
|
|
275
|
+
|
|
276
|
+
function leadingKeyOf(segment: string): string | null {
|
|
277
|
+
const match = LEADING_KEY.exec(segment.replace(LEADING_TRIVIA, ''));
|
|
278
|
+
if (!match) return null;
|
|
279
|
+
return match[1] ?? match[2] ?? match[3] ?? null;
|
|
280
|
+
}
|