@inf-monkeys-tech/monkeys 1.0.17 → 1.0.19
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/lib/contracts/continuity.d.ts +2 -2
- package/lib/contracts/continuity.d.ts.map +1 -1
- package/lib/contracts/continuity.js +39 -2
- package/lib/contracts/continuity.js.map +1 -1
- package/lib/contracts/index.d.ts +1 -0
- package/lib/contracts/index.d.ts.map +1 -1
- package/lib/contracts/index.js +1 -0
- package/lib/contracts/index.js.map +1 -1
- package/lib/contracts/tenant.d.ts +3 -0
- package/lib/contracts/tenant.d.ts.map +1 -1
- package/lib/contracts/tenant.js +1 -0
- package/lib/contracts/tenant.js.map +1 -1
- package/lib/contracts/workflow-runtime.d.ts +287 -0
- package/lib/contracts/workflow-runtime.d.ts.map +1 -0
- package/lib/contracts/workflow-runtime.js +198 -0
- package/lib/contracts/workflow-runtime.js.map +1 -0
- package/lib/esm/contracts/index.mjs +218 -2
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +223 -3
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +1 -0
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +223 -3
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/application-run.schema.json +0 -1
- package/lib/json-schema/index.json +5 -1
- package/lib/json-schema/tenant-product-config.schema.json +9 -0
- package/lib/json-schema/tenant-runtime-config.schema.json +9 -0
- package/lib/json-schema/workflow-catalog-entry.schema.json +238 -0
- package/lib/json-schema/workflow-completion-commit.schema.json +1163 -0
- package/lib/json-schema/workflow-completion-receipt.schema.json +160 -0
- package/lib/json-schema/workflow-publication.schema.json +168 -0
- package/lib/schemas/index.d.ts +286 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +11 -1
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
- package/test/fixtures/tenant-product-config.public.json +1 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowCompletionReceiptSchema = exports.WorkflowCompletionCommitSchema = exports.WorkflowPublicationSchema = exports.WorkflowCatalogEntrySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const artifact_1 = require("./artifact");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const continuity_1 = require("./continuity");
|
|
8
|
+
const data_1 = require("./data");
|
|
9
|
+
exports.WorkflowCatalogEntrySchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
contract: zod_1.z.literal('WorkflowCatalogEntry'),
|
|
12
|
+
workflowId: common_1.ContractIdentifierSchema,
|
|
13
|
+
teamId: common_1.ContractIdentifierSchema,
|
|
14
|
+
creatorRef: common_1.EntityRefSchema,
|
|
15
|
+
currentDefinitionRef: common_1.EntityRefSchema,
|
|
16
|
+
lifecycle: zod_1.z.enum(['ACTIVE', 'DELETED']),
|
|
17
|
+
asset: zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
preset: zod_1.z.boolean(),
|
|
20
|
+
marketplacePublished: zod_1.z.boolean(),
|
|
21
|
+
publishConfig: common_1.JsonObjectSchema.optional(),
|
|
22
|
+
sort: zod_1.z.number().int(),
|
|
23
|
+
forkFromRef: common_1.EntityRefSchema.optional(),
|
|
24
|
+
notAuthorized: zod_1.z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.strict(),
|
|
27
|
+
createdAt: common_1.IsoDateTimeSchema,
|
|
28
|
+
updatedAt: common_1.IsoDateTimeSchema,
|
|
29
|
+
deletedAt: common_1.IsoDateTimeSchema.optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
.superRefine((entry, context) => {
|
|
33
|
+
if (entry.creatorRef.kind !== 'user' &&
|
|
34
|
+
entry.creatorRef.kind !== 'service') {
|
|
35
|
+
context.addIssue({
|
|
36
|
+
code: 'custom',
|
|
37
|
+
path: ['creatorRef', 'kind'],
|
|
38
|
+
message: 'creatorRef must reference a user or service.',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (entry.currentDefinitionRef.kind !== 'workflow-definition') {
|
|
42
|
+
context.addIssue({
|
|
43
|
+
code: 'custom',
|
|
44
|
+
path: ['currentDefinitionRef', 'kind'],
|
|
45
|
+
message: 'currentDefinitionRef must reference a workflow-definition.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (entry.lifecycle === 'DELETED' && !entry.deletedAt) {
|
|
49
|
+
context.addIssue({
|
|
50
|
+
code: 'custom',
|
|
51
|
+
path: ['deletedAt'],
|
|
52
|
+
message: 'Deleted workflow catalog entries require deletedAt.',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (entry.lifecycle === 'ACTIVE' && entry.deletedAt) {
|
|
56
|
+
context.addIssue({
|
|
57
|
+
code: 'custom',
|
|
58
|
+
path: ['deletedAt'],
|
|
59
|
+
message: 'Active workflow catalog entries cannot declare deletedAt.',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
exports.WorkflowPublicationSchema = zod_1.z
|
|
64
|
+
.object({
|
|
65
|
+
contract: zod_1.z.literal('WorkflowPublication'),
|
|
66
|
+
publicationId: common_1.ContractIdentifierSchema,
|
|
67
|
+
definitionRef: common_1.EntityRefSchema,
|
|
68
|
+
runtimeDefinitionRef: common_1.EntityRefSchema,
|
|
69
|
+
sourceHash: common_1.Sha256Schema,
|
|
70
|
+
compiledHash: common_1.Sha256Schema,
|
|
71
|
+
status: zod_1.z.enum(['PENDING', 'PUBLISHED', 'FAILED', 'RETIRED']),
|
|
72
|
+
publisherRef: common_1.EntityRefSchema,
|
|
73
|
+
publishedAt: common_1.IsoDateTimeSchema.optional(),
|
|
74
|
+
failureReason: zod_1.z.string().trim().min(1).optional(),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
.superRefine((publication, context) => {
|
|
78
|
+
if (publication.definitionRef.kind !== 'workflow-definition') {
|
|
79
|
+
context.addIssue({
|
|
80
|
+
code: 'custom',
|
|
81
|
+
path: ['definitionRef', 'kind'],
|
|
82
|
+
message: 'definitionRef must reference a workflow-definition.',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (publication.runtimeDefinitionRef.kind !== 'conductor-workflow-definition') {
|
|
86
|
+
context.addIssue({
|
|
87
|
+
code: 'custom',
|
|
88
|
+
path: ['runtimeDefinitionRef', 'kind'],
|
|
89
|
+
message: 'runtimeDefinitionRef must reference a conductor-workflow-definition.',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (publication.status === 'PUBLISHED' && !publication.publishedAt) {
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: 'custom',
|
|
95
|
+
path: ['publishedAt'],
|
|
96
|
+
message: 'Published workflow publications require publishedAt.',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (publication.status === 'FAILED' && !publication.failureReason) {
|
|
100
|
+
context.addIssue({
|
|
101
|
+
code: 'custom',
|
|
102
|
+
path: ['failureReason'],
|
|
103
|
+
message: 'Failed workflow publications require failureReason.',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
exports.WorkflowCompletionCommitSchema = zod_1.z
|
|
108
|
+
.object({
|
|
109
|
+
contract: zod_1.z.literal('WorkflowCompletionCommit'),
|
|
110
|
+
commitId: common_1.ContractIdentifierSchema,
|
|
111
|
+
run: continuity_1.ApplicationRunSchema,
|
|
112
|
+
outputs: zod_1.z.array(artifact_1.OutputRecordSchema),
|
|
113
|
+
artifacts: zod_1.z.array(artifact_1.ArtifactManifestSchema),
|
|
114
|
+
lineage: data_1.LineageRecordSchema,
|
|
115
|
+
completedAt: common_1.IsoDateTimeSchema,
|
|
116
|
+
})
|
|
117
|
+
.strict()
|
|
118
|
+
.superRefine((commit, context) => {
|
|
119
|
+
const expectedRunId = commit.run.runId;
|
|
120
|
+
const referencesRun = (value) => value.runRef.kind === 'application-run' && value.runRef.id === expectedRunId;
|
|
121
|
+
commit.outputs.forEach((output, index) => {
|
|
122
|
+
if (!referencesRun(output)) {
|
|
123
|
+
context.addIssue({
|
|
124
|
+
code: 'custom',
|
|
125
|
+
path: ['outputs', index, 'runRef'],
|
|
126
|
+
message: 'Every output must reference the committed ApplicationRun.',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
131
|
+
if (!referencesRun(artifact)) {
|
|
132
|
+
context.addIssue({
|
|
133
|
+
code: 'custom',
|
|
134
|
+
path: ['artifacts', index, 'runRef'],
|
|
135
|
+
message: 'Every artifact must reference the committed ApplicationRun.',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
if (commit.lineage.subjectRef.kind !== 'application-run' ||
|
|
140
|
+
commit.lineage.subjectRef.id !== expectedRunId) {
|
|
141
|
+
context.addIssue({
|
|
142
|
+
code: 'custom',
|
|
143
|
+
path: ['lineage', 'subjectRef'],
|
|
144
|
+
message: 'Completion lineage must use the committed ApplicationRun as its subject.',
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const outputIds = new Set(commit.outputs.map(output => output.outputId));
|
|
148
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
149
|
+
if (artifact.outputRef.kind !== 'workflow-output' ||
|
|
150
|
+
!outputIds.has(artifact.outputRef.id)) {
|
|
151
|
+
context.addIssue({
|
|
152
|
+
code: 'custom',
|
|
153
|
+
path: ['artifacts', index, 'outputRef'],
|
|
154
|
+
message: 'Artifact outputRef must reference an output in the same commit.',
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
exports.WorkflowCompletionReceiptSchema = zod_1.z
|
|
160
|
+
.object({
|
|
161
|
+
contract: zod_1.z.literal('WorkflowCompletionReceipt'),
|
|
162
|
+
commitId: common_1.ContractIdentifierSchema,
|
|
163
|
+
runRef: common_1.EntityRefSchema,
|
|
164
|
+
outputRefs: zod_1.z.array(common_1.EntityRefSchema),
|
|
165
|
+
artifactRefs: zod_1.z.array(common_1.EntityRefSchema),
|
|
166
|
+
contentHash: common_1.Sha256Schema,
|
|
167
|
+
committedAt: common_1.IsoDateTimeSchema,
|
|
168
|
+
idempotentReplay: zod_1.z.boolean(),
|
|
169
|
+
})
|
|
170
|
+
.strict()
|
|
171
|
+
.superRefine((receipt, context) => {
|
|
172
|
+
if (receipt.runRef.kind !== 'application-run') {
|
|
173
|
+
context.addIssue({
|
|
174
|
+
code: 'custom',
|
|
175
|
+
path: ['runRef', 'kind'],
|
|
176
|
+
message: 'runRef must reference an application-run.',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
receipt.outputRefs.forEach((ref, index) => {
|
|
180
|
+
if (ref.kind !== 'workflow-output') {
|
|
181
|
+
context.addIssue({
|
|
182
|
+
code: 'custom',
|
|
183
|
+
path: ['outputRefs', index, 'kind'],
|
|
184
|
+
message: 'outputRefs must reference workflow-output records.',
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
receipt.artifactRefs.forEach((ref, index) => {
|
|
189
|
+
if (ref.kind !== 'artifact') {
|
|
190
|
+
context.addIssue({
|
|
191
|
+
code: 'custom',
|
|
192
|
+
path: ['artifactRefs', index, 'kind'],
|
|
193
|
+
message: 'artifactRefs must reference artifacts.',
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=workflow-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-runtime.js","sourceRoot":"","sources":["../../src/contracts/workflow-runtime.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yCAAwE;AACxE,qCAMkB;AAClB,6CAAoD;AACpD,iCAA6C;AAEhC,QAAA,0BAA0B,GAAG,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;SACrD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACnC,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC;gBACnC,OAAO,EAAE,oDAAoD;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1C,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC;gBACrC,OAAO,EAAE,wCAAwC;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -7589,7 +7589,7 @@ var ApplicationRunSchema = z7.object({
|
|
|
7589
7589
|
contract: z7.literal("ApplicationRun"),
|
|
7590
7590
|
runId: ContractIdentifierSchema,
|
|
7591
7591
|
definitionRef: EntityRefSchema,
|
|
7592
|
-
runtimeLedgerRef: EntityRefSchema,
|
|
7592
|
+
runtimeLedgerRef: EntityRefSchema.optional(),
|
|
7593
7593
|
requestId: ContractIdentifierSchema,
|
|
7594
7594
|
actorRef: EntityRefSchema,
|
|
7595
7595
|
status: z7.enum(["PENDING", "RUNNING", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]),
|
|
@@ -7599,7 +7599,43 @@ var ApplicationRunSchema = z7.object({
|
|
|
7599
7599
|
completedAt: IsoDateTimeSchema.optional(),
|
|
7600
7600
|
expiresAt: IsoDateTimeSchema.optional(),
|
|
7601
7601
|
metadata: JsonObjectSchema.default({})
|
|
7602
|
-
}).strict()
|
|
7602
|
+
}).strict().superRefine((run, context) => {
|
|
7603
|
+
if (run.definitionRef.kind !== "workflow-definition") {
|
|
7604
|
+
context.addIssue({
|
|
7605
|
+
code: "custom",
|
|
7606
|
+
path: ["definitionRef", "kind"],
|
|
7607
|
+
message: "definitionRef must reference a workflow-definition."
|
|
7608
|
+
});
|
|
7609
|
+
}
|
|
7610
|
+
if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== "workflow-run") {
|
|
7611
|
+
context.addIssue({
|
|
7612
|
+
code: "custom",
|
|
7613
|
+
path: ["runtimeLedgerRef", "kind"],
|
|
7614
|
+
message: "runtimeLedgerRef must reference a workflow-run."
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7617
|
+
if ((run.status === "RUNNING" || run.status === "COMPLETED" || run.status === "CANCELLED") && !run.runtimeLedgerRef) {
|
|
7618
|
+
context.addIssue({
|
|
7619
|
+
code: "custom",
|
|
7620
|
+
path: ["runtimeLedgerRef"],
|
|
7621
|
+
message: `${run.status} ApplicationRun requires runtimeLedgerRef.`
|
|
7622
|
+
});
|
|
7623
|
+
}
|
|
7624
|
+
if (run.status === "RUNNING" && !run.startedAt) {
|
|
7625
|
+
context.addIssue({
|
|
7626
|
+
code: "custom",
|
|
7627
|
+
path: ["startedAt"],
|
|
7628
|
+
message: "RUNNING ApplicationRun requires startedAt."
|
|
7629
|
+
});
|
|
7630
|
+
}
|
|
7631
|
+
if (["COMPLETED", "FAILED", "CANCELLED", "EXPIRED"].includes(run.status) && !run.completedAt) {
|
|
7632
|
+
context.addIssue({
|
|
7633
|
+
code: "custom",
|
|
7634
|
+
path: ["completedAt"],
|
|
7635
|
+
message: `Terminal ApplicationRun status ${run.status} requires completedAt.`
|
|
7636
|
+
});
|
|
7637
|
+
}
|
|
7638
|
+
});
|
|
7603
7639
|
var ExpiringAccessGrantSchema = z7.object({
|
|
7604
7640
|
contract: z7.literal("ExpiringAccessGrant"),
|
|
7605
7641
|
grantId: ContractIdentifierSchema,
|
|
@@ -10682,6 +10718,7 @@ var TenantApplicationConfigSchema = z12.object({
|
|
|
10682
10718
|
dataManagement: z12.object({
|
|
10683
10719
|
favoriteOntologyId: z12.string().optional(),
|
|
10684
10720
|
pairedOntologyId: z12.string().optional(),
|
|
10721
|
+
galleryOntologyIds: z12.array(ContractIdentifierSchema).max(20).optional(),
|
|
10685
10722
|
galleryOntologyId: z12.string().optional(),
|
|
10686
10723
|
dataBrowserDefaultOntologyId: z12.string().optional(),
|
|
10687
10724
|
workflowResultOntologyId: z12.string().optional(),
|
|
@@ -11445,6 +11482,181 @@ var WorkflowDefinitionSchema = z14.object({
|
|
|
11445
11482
|
});
|
|
11446
11483
|
if (definition.revision.kind === "release" && definition.metadata.version !== definition.revision.recordVersion) context.addIssue({ code: "custom", path: ["revision", "recordVersion"], message: "Release recordVersion must equal metadata.version." });
|
|
11447
11484
|
});
|
|
11485
|
+
|
|
11486
|
+
// src/contracts/workflow-runtime.ts
|
|
11487
|
+
import { z as z15 } from "zod";
|
|
11488
|
+
var WorkflowCatalogEntrySchema = z15.object({
|
|
11489
|
+
contract: z15.literal("WorkflowCatalogEntry"),
|
|
11490
|
+
workflowId: ContractIdentifierSchema,
|
|
11491
|
+
teamId: ContractIdentifierSchema,
|
|
11492
|
+
creatorRef: EntityRefSchema,
|
|
11493
|
+
currentDefinitionRef: EntityRefSchema,
|
|
11494
|
+
lifecycle: z15.enum(["ACTIVE", "DELETED"]),
|
|
11495
|
+
asset: z15.object({
|
|
11496
|
+
preset: z15.boolean(),
|
|
11497
|
+
marketplacePublished: z15.boolean(),
|
|
11498
|
+
publishConfig: JsonObjectSchema.optional(),
|
|
11499
|
+
sort: z15.number().int(),
|
|
11500
|
+
forkFromRef: EntityRefSchema.optional(),
|
|
11501
|
+
notAuthorized: z15.boolean()
|
|
11502
|
+
}).strict(),
|
|
11503
|
+
createdAt: IsoDateTimeSchema,
|
|
11504
|
+
updatedAt: IsoDateTimeSchema,
|
|
11505
|
+
deletedAt: IsoDateTimeSchema.optional()
|
|
11506
|
+
}).strict().superRefine((entry, context) => {
|
|
11507
|
+
if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
|
|
11508
|
+
context.addIssue({
|
|
11509
|
+
code: "custom",
|
|
11510
|
+
path: ["creatorRef", "kind"],
|
|
11511
|
+
message: "creatorRef must reference a user or service."
|
|
11512
|
+
});
|
|
11513
|
+
}
|
|
11514
|
+
if (entry.currentDefinitionRef.kind !== "workflow-definition") {
|
|
11515
|
+
context.addIssue({
|
|
11516
|
+
code: "custom",
|
|
11517
|
+
path: ["currentDefinitionRef", "kind"],
|
|
11518
|
+
message: "currentDefinitionRef must reference a workflow-definition."
|
|
11519
|
+
});
|
|
11520
|
+
}
|
|
11521
|
+
if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
|
|
11522
|
+
context.addIssue({
|
|
11523
|
+
code: "custom",
|
|
11524
|
+
path: ["deletedAt"],
|
|
11525
|
+
message: "Deleted workflow catalog entries require deletedAt."
|
|
11526
|
+
});
|
|
11527
|
+
}
|
|
11528
|
+
if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
|
|
11529
|
+
context.addIssue({
|
|
11530
|
+
code: "custom",
|
|
11531
|
+
path: ["deletedAt"],
|
|
11532
|
+
message: "Active workflow catalog entries cannot declare deletedAt."
|
|
11533
|
+
});
|
|
11534
|
+
}
|
|
11535
|
+
});
|
|
11536
|
+
var WorkflowPublicationSchema = z15.object({
|
|
11537
|
+
contract: z15.literal("WorkflowPublication"),
|
|
11538
|
+
publicationId: ContractIdentifierSchema,
|
|
11539
|
+
definitionRef: EntityRefSchema,
|
|
11540
|
+
runtimeDefinitionRef: EntityRefSchema,
|
|
11541
|
+
sourceHash: Sha256Schema,
|
|
11542
|
+
compiledHash: Sha256Schema,
|
|
11543
|
+
status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
|
|
11544
|
+
publisherRef: EntityRefSchema,
|
|
11545
|
+
publishedAt: IsoDateTimeSchema.optional(),
|
|
11546
|
+
failureReason: z15.string().trim().min(1).optional()
|
|
11547
|
+
}).strict().superRefine((publication, context) => {
|
|
11548
|
+
if (publication.definitionRef.kind !== "workflow-definition") {
|
|
11549
|
+
context.addIssue({
|
|
11550
|
+
code: "custom",
|
|
11551
|
+
path: ["definitionRef", "kind"],
|
|
11552
|
+
message: "definitionRef must reference a workflow-definition."
|
|
11553
|
+
});
|
|
11554
|
+
}
|
|
11555
|
+
if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
|
|
11556
|
+
context.addIssue({
|
|
11557
|
+
code: "custom",
|
|
11558
|
+
path: ["runtimeDefinitionRef", "kind"],
|
|
11559
|
+
message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
|
|
11560
|
+
});
|
|
11561
|
+
}
|
|
11562
|
+
if (publication.status === "PUBLISHED" && !publication.publishedAt) {
|
|
11563
|
+
context.addIssue({
|
|
11564
|
+
code: "custom",
|
|
11565
|
+
path: ["publishedAt"],
|
|
11566
|
+
message: "Published workflow publications require publishedAt."
|
|
11567
|
+
});
|
|
11568
|
+
}
|
|
11569
|
+
if (publication.status === "FAILED" && !publication.failureReason) {
|
|
11570
|
+
context.addIssue({
|
|
11571
|
+
code: "custom",
|
|
11572
|
+
path: ["failureReason"],
|
|
11573
|
+
message: "Failed workflow publications require failureReason."
|
|
11574
|
+
});
|
|
11575
|
+
}
|
|
11576
|
+
});
|
|
11577
|
+
var WorkflowCompletionCommitSchema = z15.object({
|
|
11578
|
+
contract: z15.literal("WorkflowCompletionCommit"),
|
|
11579
|
+
commitId: ContractIdentifierSchema,
|
|
11580
|
+
run: ApplicationRunSchema,
|
|
11581
|
+
outputs: z15.array(OutputRecordSchema),
|
|
11582
|
+
artifacts: z15.array(ArtifactManifestSchema),
|
|
11583
|
+
lineage: LineageRecordSchema,
|
|
11584
|
+
completedAt: IsoDateTimeSchema
|
|
11585
|
+
}).strict().superRefine((commit, context) => {
|
|
11586
|
+
const expectedRunId = commit.run.runId;
|
|
11587
|
+
const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
|
|
11588
|
+
commit.outputs.forEach((output, index) => {
|
|
11589
|
+
if (!referencesRun(output)) {
|
|
11590
|
+
context.addIssue({
|
|
11591
|
+
code: "custom",
|
|
11592
|
+
path: ["outputs", index, "runRef"],
|
|
11593
|
+
message: "Every output must reference the committed ApplicationRun."
|
|
11594
|
+
});
|
|
11595
|
+
}
|
|
11596
|
+
});
|
|
11597
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11598
|
+
if (!referencesRun(artifact)) {
|
|
11599
|
+
context.addIssue({
|
|
11600
|
+
code: "custom",
|
|
11601
|
+
path: ["artifacts", index, "runRef"],
|
|
11602
|
+
message: "Every artifact must reference the committed ApplicationRun."
|
|
11603
|
+
});
|
|
11604
|
+
}
|
|
11605
|
+
});
|
|
11606
|
+
if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
|
|
11607
|
+
context.addIssue({
|
|
11608
|
+
code: "custom",
|
|
11609
|
+
path: ["lineage", "subjectRef"],
|
|
11610
|
+
message: "Completion lineage must use the committed ApplicationRun as its subject."
|
|
11611
|
+
});
|
|
11612
|
+
}
|
|
11613
|
+
const outputIds = new Set(commit.outputs.map((output) => output.outputId));
|
|
11614
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11615
|
+
if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
|
|
11616
|
+
context.addIssue({
|
|
11617
|
+
code: "custom",
|
|
11618
|
+
path: ["artifacts", index, "outputRef"],
|
|
11619
|
+
message: "Artifact outputRef must reference an output in the same commit."
|
|
11620
|
+
});
|
|
11621
|
+
}
|
|
11622
|
+
});
|
|
11623
|
+
});
|
|
11624
|
+
var WorkflowCompletionReceiptSchema = z15.object({
|
|
11625
|
+
contract: z15.literal("WorkflowCompletionReceipt"),
|
|
11626
|
+
commitId: ContractIdentifierSchema,
|
|
11627
|
+
runRef: EntityRefSchema,
|
|
11628
|
+
outputRefs: z15.array(EntityRefSchema),
|
|
11629
|
+
artifactRefs: z15.array(EntityRefSchema),
|
|
11630
|
+
contentHash: Sha256Schema,
|
|
11631
|
+
committedAt: IsoDateTimeSchema,
|
|
11632
|
+
idempotentReplay: z15.boolean()
|
|
11633
|
+
}).strict().superRefine((receipt, context) => {
|
|
11634
|
+
if (receipt.runRef.kind !== "application-run") {
|
|
11635
|
+
context.addIssue({
|
|
11636
|
+
code: "custom",
|
|
11637
|
+
path: ["runRef", "kind"],
|
|
11638
|
+
message: "runRef must reference an application-run."
|
|
11639
|
+
});
|
|
11640
|
+
}
|
|
11641
|
+
receipt.outputRefs.forEach((ref, index) => {
|
|
11642
|
+
if (ref.kind !== "workflow-output") {
|
|
11643
|
+
context.addIssue({
|
|
11644
|
+
code: "custom",
|
|
11645
|
+
path: ["outputRefs", index, "kind"],
|
|
11646
|
+
message: "outputRefs must reference workflow-output records."
|
|
11647
|
+
});
|
|
11648
|
+
}
|
|
11649
|
+
});
|
|
11650
|
+
receipt.artifactRefs.forEach((ref, index) => {
|
|
11651
|
+
if (ref.kind !== "artifact") {
|
|
11652
|
+
context.addIssue({
|
|
11653
|
+
code: "custom",
|
|
11654
|
+
path: ["artifactRefs", index, "kind"],
|
|
11655
|
+
message: "artifactRefs must reference artifacts."
|
|
11656
|
+
});
|
|
11657
|
+
}
|
|
11658
|
+
});
|
|
11659
|
+
});
|
|
11448
11660
|
export {
|
|
11449
11661
|
AGENT_MODE_CAPABILITIES,
|
|
11450
11662
|
AGENT_SESSION_CAPABILITY_EVIDENCE,
|
|
@@ -11583,12 +11795,16 @@ export {
|
|
|
11583
11795
|
TrendSourceRecordSchema,
|
|
11584
11796
|
TrendSourceSchema,
|
|
11585
11797
|
ViewProviderDescriptorSchema,
|
|
11798
|
+
WorkflowCatalogEntrySchema,
|
|
11799
|
+
WorkflowCompletionCommitSchema,
|
|
11800
|
+
WorkflowCompletionReceiptSchema,
|
|
11586
11801
|
WorkflowDefinitionSchema,
|
|
11587
11802
|
WorkflowEdgeSchema,
|
|
11588
11803
|
WorkflowNodeSchema,
|
|
11589
11804
|
WorkflowOutputBindingSchema,
|
|
11590
11805
|
WorkflowParameterSchema,
|
|
11591
11806
|
WorkflowParameterTypeSchema,
|
|
11807
|
+
WorkflowPublicationSchema,
|
|
11592
11808
|
WorkflowTriggerSchema,
|
|
11593
11809
|
WorkflowValidationIssueSchema,
|
|
11594
11810
|
agentModeHasCapability,
|