@sanity/workflow-engine 0.10.0 → 0.12.0

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.
@@ -21,6 +21,12 @@ function andConditions(parts) {
21
21
  if (present.length !== 0)
22
22
  return present.length === 1 ? present[0] : present.map((p) => `(${p})`).join(" && ");
23
23
  }
24
+ const UNIVERSAL_ROLE_ALIAS_KEY = "$all";
25
+ function normalizeRoleAliases(aliases) {
26
+ if (aliases === void 0 || !("*" in aliases)) return aliases;
27
+ const { ["*"]: universal, ...perRole } = aliases;
28
+ return { ...perRole, [UNIVERSAL_ROLE_ALIAS_KEY]: universal };
29
+ }
24
30
  function expandRequiredRoles(required, aliases) {
25
31
  if (aliases === void 0) return [...required];
26
32
  const out = /* @__PURE__ */ new Set();
@@ -28,7 +34,7 @@ function expandRequiredRoles(required, aliases) {
28
34
  out.add(role);
29
35
  for (const fulfiller of aliases[role] ?? []) out.add(fulfiller);
30
36
  }
31
- for (const fulfiller of aliases["*"] ?? []) out.add(fulfiller);
37
+ for (const fulfiller of aliases[UNIVERSAL_ROLE_ALIAS_KEY] ?? []) out.add(fulfiller);
32
38
  return [...out];
33
39
  }
34
40
  function actorFulfillsRole(actorRoles, required, aliases) {
@@ -36,17 +42,17 @@ function actorFulfillsRole(actorRoles, required, aliases) {
36
42
  const accepted = new Set(expandRequiredRoles([required], aliases));
37
43
  return actorRoles.some((role) => accepted.has(role));
38
44
  }
39
- const TASK_STATUSES = ["pending", "active", "done", "skipped", "failed"], TERMINAL_TASK_STATUSES = ["done", "skipped", "failed"];
40
- function isTerminalTaskStatus(status) {
41
- return TERMINAL_TASK_STATUSES.includes(status);
45
+ const ACTIVITY_STATUSES = ["pending", "active", "done", "skipped", "failed"], TERMINAL_ACTIVITY_STATUSES = ["done", "skipped", "failed"];
46
+ function isTerminalActivityStatus(status) {
47
+ return TERMINAL_ACTIVITY_STATUSES.includes(status);
42
48
  }
43
- const FIELD_SCOPES = ["workflow", "stage", "task"], DOCUMENT_VALUE_PERMISSIONS = ["create", "read", "update"], MUTATION_GUARD_ACTIONS = [
49
+ const FIELD_SCOPES = ["workflow", "stage", "activity"], DOCUMENT_VALUE_PERMISSIONS = ["create", "read", "update"], MUTATION_GUARD_ACTIONS = [
44
50
  "create",
45
51
  "update",
46
52
  "delete",
47
53
  "publish",
48
54
  "unpublish"
49
- ], NonEmpty = v__namespace.pipe(v__namespace.string(), v__namespace.minLength(1, "must be a non-empty string")), PositiveInt = v__namespace.pipe(v__namespace.number(), v__namespace.integer(), v__namespace.minValue(1)), GROQ_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
55
+ ], ACTIVITY_KINDS = ["user", "service", "script", "manual", "receive"], DRIVER_KINDS = ["person", "agent", "service", "engine"], NonEmpty = v__namespace.pipe(v__namespace.string(), v__namespace.minLength(1, "must be a non-empty string")), PositiveInt = v__namespace.pipe(v__namespace.number(), v__namespace.integer(), v__namespace.minValue(1)), GROQ_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
50
56
  function groqIdentifier(referencedAs) {
51
57
  return v__namespace.pipe(
52
58
  v__namespace.string(),
@@ -62,32 +68,28 @@ function picklist(options) {
62
68
  `Invalid option: expected one of ${options.map((o) => `"${o}"`).join("|")}`
63
69
  );
64
70
  }
65
- const SourceSchema = v__namespace.lazy(
71
+ const LiteralSchema = v__namespace.strictObject({ type: v__namespace.literal("literal"), value: v__namespace.unknown() }), FieldReadSchema = v__namespace.strictObject({
72
+ type: v__namespace.literal("fieldRead"),
73
+ scope: v__namespace.optional(v__namespace.union([v__namespace.literal("workflow"), v__namespace.literal("stage")])),
74
+ field: NonEmpty,
75
+ path: v__namespace.optional(v__namespace.string())
76
+ }), FieldSourceSchema = v__namespace.union([
77
+ // The caller supplies it at start/spawn (`initialFields` / `subworkflows.with`).
78
+ v__namespace.strictObject({ type: v__namespace.literal("input") }),
79
+ // Computed once by running GROQ against the lake at materialisation.
80
+ v__namespace.strictObject({ type: v__namespace.literal("query"), query: NonEmpty }),
81
+ LiteralSchema,
82
+ FieldReadSchema
83
+ ]), ValueExprSchema = v__namespace.lazy(
66
84
  () => v__namespace.union([
67
- // Field-entry origins: who fills the entry, and when.
68
- v__namespace.strictObject({ type: v__namespace.literal("init") }),
69
- v__namespace.strictObject({ type: v__namespace.literal("write") }),
70
- v__namespace.strictObject({
71
- type: v__namespace.literal("query"),
72
- query: NonEmpty
73
- }),
74
- // Value sources: resolved to concrete JSON when an op or seed applies.
75
- v__namespace.strictObject({ type: v__namespace.literal("literal"), value: v__namespace.unknown() }),
85
+ LiteralSchema,
86
+ FieldReadSchema,
76
87
  v__namespace.strictObject({ type: v__namespace.literal("param"), param: NonEmpty }),
77
88
  v__namespace.strictObject({ type: v__namespace.literal("actor") }),
78
89
  v__namespace.strictObject({ type: v__namespace.literal("now") }),
79
90
  v__namespace.strictObject({ type: v__namespace.literal("self") }),
80
91
  v__namespace.strictObject({ type: v__namespace.literal("stage") }),
81
- v__namespace.strictObject({
82
- type: v__namespace.literal("fieldRead"),
83
- scope: v__namespace.optional(v__namespace.union([v__namespace.literal("workflow"), v__namespace.literal("stage")])),
84
- field: NonEmpty,
85
- path: v__namespace.optional(v__namespace.string())
86
- }),
87
- v__namespace.strictObject({
88
- type: v__namespace.literal("object"),
89
- fields: v__namespace.record(NonEmpty, SourceSchema)
90
- })
92
+ v__namespace.strictObject({ type: v__namespace.literal("object"), fields: v__namespace.record(NonEmpty, ValueExprSchema) })
91
93
  ])
92
94
  ), StoredFieldRefSchema = v__namespace.strictObject({
93
95
  scope: picklist(FIELD_SCOPES),
@@ -95,12 +97,31 @@ const SourceSchema = v__namespace.lazy(
95
97
  }), AuthoringFieldRefSchema = v__namespace.strictObject({
96
98
  scope: v__namespace.optional(picklist(FIELD_SCOPES)),
97
99
  field: NonEmpty
98
- }), OpPredicateSchema = v__namespace.lazy(
100
+ }), HREF_SCHEMES = ["http:", "https:"];
101
+ function isHttpUrl(value) {
102
+ try {
103
+ return HREF_SCHEMES.includes(new URL(value).protocol);
104
+ } catch {
105
+ return !1;
106
+ }
107
+ }
108
+ const UrlString = v__namespace.pipe(
109
+ v__namespace.string(),
110
+ v__namespace.url("must be a valid URL"),
111
+ v__namespace.check(isHttpUrl, "must be an http(s) URL")
112
+ );
113
+ function manualTargetSchema(ref) {
114
+ return v__namespace.variant("type", [
115
+ v__namespace.strictObject({ type: v__namespace.literal("url"), url: UrlString }),
116
+ v__namespace.strictObject({ type: v__namespace.literal("field"), field: ref })
117
+ ]);
118
+ }
119
+ const StoredManualTargetSchema = manualTargetSchema(StoredFieldRefSchema), AuthoringManualTargetSchema = manualTargetSchema(v__namespace.union([NonEmpty, AuthoringFieldRefSchema])), OpPredicateSchema = v__namespace.lazy(
99
120
  () => v__namespace.union([
100
121
  v__namespace.strictObject({
101
122
  type: v__namespace.literal("field"),
102
123
  field: NonEmpty,
103
- equals: SourceSchema
124
+ equals: ValueExprSchema
104
125
  }),
105
126
  v__namespace.strictObject({ type: v__namespace.literal("all"), of: v__namespace.array(OpPredicateSchema) }),
106
127
  v__namespace.strictObject({ type: v__namespace.literal("any"), of: v__namespace.array(OpPredicateSchema) })
@@ -111,7 +132,7 @@ function opSchemas(targetSchema) {
111
132
  v__namespace.strictObject({
112
133
  type: v__namespace.literal("field.set"),
113
134
  target: targetSchema,
114
- value: SourceSchema
135
+ value: ValueExprSchema
115
136
  }),
116
137
  v__namespace.strictObject({
117
138
  type: v__namespace.literal("field.unset"),
@@ -120,13 +141,13 @@ function opSchemas(targetSchema) {
120
141
  v__namespace.strictObject({
121
142
  type: v__namespace.literal("field.append"),
122
143
  target: targetSchema,
123
- value: SourceSchema
144
+ value: ValueExprSchema
124
145
  }),
125
146
  v__namespace.strictObject({
126
147
  type: v__namespace.literal("field.updateWhere"),
127
148
  target: targetSchema,
128
149
  where: OpPredicateSchema,
129
- value: SourceSchema
150
+ value: ValueExprSchema
130
151
  }),
131
152
  v__namespace.strictObject({
132
153
  type: v__namespace.literal("field.removeWhere"),
@@ -139,13 +160,13 @@ const StoredOpSchema = v__namespace.variant("type", [
139
160
  ...opSchemas(StoredFieldRefSchema),
140
161
  v__namespace.strictObject({
141
162
  type: v__namespace.literal("status.set"),
142
- task: NonEmpty,
143
- status: picklist(TASK_STATUSES)
163
+ activity: NonEmpty,
164
+ status: picklist(ACTIVITY_STATUSES)
144
165
  })
145
166
  ]), StoredTransitionOpSchema = v__namespace.variant("type", [...opSchemas(StoredFieldRefSchema)]), AuditOpSchema = v__namespace.strictObject({
146
167
  type: v__namespace.literal("audit"),
147
168
  target: AuthoringFieldRefSchema,
148
- value: SourceSchema,
169
+ value: ValueExprSchema,
149
170
  stampFields: v__namespace.optional(
150
171
  v__namespace.strictObject({
151
172
  actor: v__namespace.optional(NonEmpty),
@@ -156,33 +177,83 @@ const StoredOpSchema = v__namespace.variant("type", [
156
177
  ...opSchemas(AuthoringFieldRefSchema),
157
178
  v__namespace.strictObject({
158
179
  type: v__namespace.literal("status.set"),
159
- task: v__namespace.optional(NonEmpty),
160
- status: picklist(TASK_STATUSES)
180
+ activity: v__namespace.optional(NonEmpty),
181
+ status: picklist(ACTIVITY_STATUSES)
161
182
  }),
162
183
  AuditOpSchema
163
- ]), FieldKindSchema = picklist([
184
+ ]), FIELD_VALUE_KINDS = [
164
185
  "doc.ref",
165
186
  "doc.refs",
166
187
  // Release reference. A workflow declares this entry to say "I target a
167
188
  // Content Release"; the runtime fills it at start time and auto-derives
168
189
  // the instance's read perspective from it.
169
190
  "release.ref",
170
- "query",
171
- "value.string",
172
- "value.url",
173
- "value.number",
174
- "value.boolean",
175
- "value.dateTime",
176
- "value.actor",
177
- "checklist",
178
- "notes",
191
+ "string",
192
+ "text",
193
+ "number",
194
+ "boolean",
195
+ "date",
196
+ "datetime",
197
+ "url",
198
+ "actor",
199
+ // A single {@link Assignee} — the singular of `assignees`.
200
+ "assignee",
179
201
  // The WHO-FOR entry: the inbox reverse-query reads it by kind, and the
180
202
  // rendered `$assigned` gate matches the caller against it.
181
- "assignees"
182
- ]), FieldEntryName = groqIdentifier("`$fields.<name>`"), StoredEditableSchema = v__namespace.union([v__namespace.literal(!0), NonEmpty]), AuthoringEditableSchema = v__namespace.union([v__namespace.literal(!0), v__namespace.array(NonEmpty), NonEmpty]);
183
- function fieldEntryFields(editable) {
203
+ "assignees",
204
+ // Compositional kinds mirror Sanity's `object.fields` / `array.of`.
205
+ "object",
206
+ "array"
207
+ ], FieldValueKindSchema = picklist(FIELD_VALUE_KINDS), FieldKindSchema = picklist(FIELD_VALUE_KINDS), FieldEntryName = groqIdentifier("`$fields.<name>`");
208
+ function asShape(input) {
209
+ return typeof input == "object" && input !== null ? input : {};
210
+ }
211
+ function compositeShapeOk(input) {
212
+ const shape = asShape(input);
213
+ return shape.type === "object" ? Array.isArray(shape.fields) && shape.fields.length > 0 && shape.of === void 0 : shape.type === "array" ? Array.isArray(shape.of) && shape.of.length > 0 && shape.fields === void 0 : shape.fields === void 0 && shape.of === void 0;
214
+ }
215
+ function compositeShapeMessage(input) {
216
+ const shape = asShape(input);
217
+ return shape.type === "object" ? shape.of !== void 0 ? "an `object` kind declares its sub-fields with `fields`, not `of`" : "an `object` kind needs a non-empty `fields` list of sub-field shapes" : shape.type === "array" ? shape.fields !== void 0 ? "an `array` kind declares its item shape with `of`, not `fields`" : "an `array` kind needs a non-empty `of` list of sub-field shapes" : `\`fields\` / \`of\` are only valid on the \`object\` / \`array\` kinds, not "${String(shape.type)}"`;
218
+ }
219
+ function duplicateSubfieldName(input) {
220
+ const shape = asShape(input);
221
+ let list = [];
222
+ Array.isArray(shape.fields) ? list = shape.fields : Array.isArray(shape.of) && (list = shape.of);
223
+ const seen = /* @__PURE__ */ new Set();
224
+ for (const item of list) {
225
+ const name = asShape(item).name;
226
+ if (typeof name == "string") {
227
+ if (seen.has(name)) return name;
228
+ seen.add(name);
229
+ }
230
+ }
231
+ }
232
+ function compositeChecked(entries) {
233
+ return v__namespace.pipe(
234
+ v__namespace.strictObject(entries),
235
+ v__namespace.check(
236
+ (input) => compositeShapeOk(input),
237
+ (issue) => compositeShapeMessage(issue.input)
238
+ ),
239
+ v__namespace.check(
240
+ (input) => duplicateSubfieldName(input) === void 0,
241
+ (issue) => `duplicate sub-field name "${duplicateSubfieldName(issue.input)}" \u2014 sub-field names must be unique within \`fields\` / \`of\``
242
+ )
243
+ );
244
+ }
245
+ const FieldShapeSchema = v__namespace.lazy(
246
+ () => compositeChecked({
247
+ type: FieldValueKindSchema,
248
+ name: FieldEntryName,
249
+ title: v__namespace.optional(v__namespace.string()),
250
+ description: v__namespace.optional(v__namespace.string()),
251
+ fields: v__namespace.optional(v__namespace.array(FieldShapeSchema)),
252
+ of: v__namespace.optional(v__namespace.array(FieldShapeSchema))
253
+ })
254
+ ), StoredEditableSchema = v__namespace.union([v__namespace.literal(!0), NonEmpty]), AuthoringEditableSchema = v__namespace.union([v__namespace.literal(!0), v__namespace.array(NonEmpty), NonEmpty]);
255
+ function slotFields(editable) {
184
256
  return {
185
- type: FieldKindSchema,
186
257
  name: FieldEntryName,
187
258
  title: v__namespace.optional(v__namespace.string()),
188
259
  description: v__namespace.optional(v__namespace.string()),
@@ -191,20 +262,47 @@ function fieldEntryFields(editable) {
191
262
  * `initialFields`) or spawn (via the parent's `subworkflows.with`). A
192
263
  * missing required entry throws rather than silently defaulting to
193
264
  * `null`/`[]` — the same fail-fast an action's `required` param gets.
194
- * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
265
+ * Valid only on a workflow-scope `input`-sourced entry (deploy invariant).
195
266
  */
196
267
  required: v__namespace.optional(v__namespace.boolean()),
197
- source: SourceSchema,
268
+ /**
269
+ * How this field SEEDS its value at materialisation — see
270
+ * {@link FieldSourceSchema}. Optional: an absent `initialValue` is working
271
+ * memory (the slot starts empty and an op fills it later), the common case.
272
+ */
273
+ initialValue: v__namespace.optional(FieldSourceSchema),
198
274
  /** Who-may-edit this slot via the edit seam — see {@link StoredEditableSchema}. */
199
275
  editable: v__namespace.optional(editable)
200
276
  };
201
277
  }
202
- const FieldEntrySchema = v__namespace.strictObject(fieldEntryFields(StoredEditableSchema)), RawAuthoringFieldEntrySchema = v__namespace.strictObject(fieldEntryFields(AuthoringEditableSchema)), ClaimFieldSchema = v__namespace.strictObject({
278
+ function fieldEntryFields(editable) {
279
+ return {
280
+ type: FieldKindSchema,
281
+ ...slotFields(editable),
282
+ /** Sub-field shapes for an `object` kind (see {@link compositeShapeOk}). */
283
+ fields: v__namespace.optional(v__namespace.array(FieldShapeSchema)),
284
+ /** Item sub-field shapes for an `array` kind (see {@link compositeShapeOk}). */
285
+ of: v__namespace.optional(v__namespace.array(FieldShapeSchema))
286
+ };
287
+ }
288
+ const FieldEntrySchema = compositeChecked(fieldEntryFields(StoredEditableSchema)), RawAuthoringFieldEntrySchema = compositeChecked(fieldEntryFields(AuthoringEditableSchema)), ClaimFieldSchema = v__namespace.strictObject({
203
289
  type: v__namespace.literal("claim"),
204
290
  name: FieldEntryName,
205
291
  title: v__namespace.optional(v__namespace.string()),
206
292
  description: v__namespace.optional(v__namespace.string())
207
- }), AuthoringFieldEntrySchema = v__namespace.union([RawAuthoringFieldEntrySchema, ClaimFieldSchema]), ConditionSchema = NonEmpty, EffectSchema = v__namespace.strictObject({
293
+ });
294
+ function listSugarFields(type) {
295
+ return {
296
+ type: v__namespace.literal(type),
297
+ ...slotFields(AuthoringEditableSchema)
298
+ };
299
+ }
300
+ const TodoListFieldSchema = v__namespace.strictObject(listSugarFields("todoList")), NotesFieldSchema = v__namespace.strictObject(listSugarFields("notes")), AuthoringFieldEntrySchema = v__namespace.union([
301
+ RawAuthoringFieldEntrySchema,
302
+ ClaimFieldSchema,
303
+ TodoListFieldSchema,
304
+ NotesFieldSchema
305
+ ]), ConditionSchema = NonEmpty, EffectSchema = v__namespace.strictObject({
208
306
  name: NonEmpty,
209
307
  title: v__namespace.optional(v__namespace.string()),
210
308
  description: v__namespace.optional(v__namespace.string()),
@@ -245,10 +343,10 @@ function actionFields(op) {
245
343
  effects: v__namespace.optional(v__namespace.array(EffectSchema))
246
344
  };
247
345
  }
248
- const StoredActionSchema = v__namespace.strictObject(actionFields(StoredOpSchema)), TerminalTaskStatus = picklist(TERMINAL_TASK_STATUSES), RawAuthoringActionSchema = v__namespace.strictObject({
346
+ const StoredActionSchema = v__namespace.strictObject(actionFields(StoredOpSchema)), TerminalActivityStatus = picklist(TERMINAL_ACTIVITY_STATUSES), RawAuthoringActionSchema = v__namespace.strictObject({
249
347
  ...actionFields(AuthoringOpSchema),
250
348
  roles: v__namespace.optional(v__namespace.array(NonEmpty)),
251
- status: v__namespace.optional(TerminalTaskStatus)
349
+ status: v__namespace.optional(TerminalActivityStatus)
252
350
  }), ClaimActionSchema = v__namespace.strictObject({
253
351
  type: v__namespace.literal("claim"),
254
352
  name: NonEmpty,
@@ -275,17 +373,27 @@ const StoredActionSchema = v__namespace.strictObject(actionFields(StoredOpSchema
275
373
  */
276
374
  context: v__namespace.optional(v__namespace.record(NonEmpty, ConditionSchema))
277
375
  });
278
- function taskFields(field, action, op) {
376
+ function activityFields(field, action, op, target) {
279
377
  return {
280
378
  name: NonEmpty,
281
379
  title: v__namespace.optional(v__namespace.string()),
282
380
  description: v__namespace.optional(v__namespace.string()),
381
+ /**
382
+ * Advisory BPMN-aligned classification of this activity by its executor (see
383
+ * {@link ACTIVITY_KINDS}). Optional and derived from the activity's shape when
384
+ * omitted; declaring it lets deploy check the shape matches the lane.
385
+ * Changes no gating or resolution — a label for tooling, like `assignees`.
386
+ */
387
+ kind: v__namespace.optional(picklist(ACTIVITY_KINDS)),
388
+ /** Deep-link target for a `kind: "manual"` activity (off-system work). Render-only
389
+ * metadata; only valid on a manual activity (deploy-checked). */
390
+ target: v__namespace.optional(target),
283
391
  activation: v__namespace.optional(picklist(["auto", "manual"])),
284
392
  filter: v__namespace.optional(ConditionSchema),
285
393
  /**
286
394
  * Readiness gates, by name — conditions over the rendered scope that must
287
- * hold for the task to be *executable*, orthogonal to `filter`
288
- * (visibility). An unmet requirement keeps the task visible but disables
395
+ * hold for the activity to be *executable*, orthogonal to `filter`
396
+ * (visibility). An unmet requirement keeps the activity visible but disables
289
397
  * its actions with a `requirements-unmet` verdict naming the unmet keys;
290
398
  * all must hold (any-of lives inside one condition). Advisory like every
291
399
  * engine gate — the lake still enforces. Distinct from ACL (authorization)
@@ -294,8 +402,8 @@ function taskFields(field, action, op) {
294
402
  requirements: v__namespace.optional(v__namespace.record(NonEmpty, ConditionSchema)),
295
403
  /**
296
404
  * Auto-completion condition — evaluated at activation and on every
297
- * cascade; truthy flips the task to `done` with a system actor. On a
298
- * spawning task it typically reads `$subworkflows`.
405
+ * cascade; truthy flips the activity to `done` with a system actor. On a
406
+ * spawning activity it typically reads `$subworkflows`.
299
407
  */
300
408
  completeWhen: v__namespace.optional(ConditionSchema),
301
409
  /**
@@ -308,14 +416,19 @@ function taskFields(field, action, op) {
308
416
  effects: v__namespace.optional(v__namespace.array(EffectSchema)),
309
417
  actions: v__namespace.optional(v__namespace.array(action)),
310
418
  subworkflows: v__namespace.optional(SubworkflowsSchema),
311
- /** Task-scoped field entries. Resolved at task activation time. */
419
+ /** Activity-scoped field entries. Resolved at activity activation time. */
312
420
  fields: v__namespace.optional(v__namespace.array(field))
313
421
  };
314
422
  }
315
- const StoredTaskSchema = v__namespace.strictObject(
316
- taskFields(FieldEntrySchema, StoredActionSchema, StoredOpSchema)
317
- ), AuthoringTaskSchema = v__namespace.strictObject(
318
- taskFields(AuthoringFieldEntrySchema, AuthoringActionSchema, AuthoringOpSchema)
423
+ const StoredActivitySchema = v__namespace.strictObject(
424
+ activityFields(FieldEntrySchema, StoredActionSchema, StoredOpSchema, StoredManualTargetSchema)
425
+ ), AuthoringActivitySchema = v__namespace.strictObject(
426
+ activityFields(
427
+ AuthoringFieldEntrySchema,
428
+ AuthoringActionSchema,
429
+ AuthoringOpSchema,
430
+ AuthoringManualTargetSchema
431
+ )
319
432
  );
320
433
  function transitionFields(op, filter) {
321
434
  return {
@@ -369,12 +482,12 @@ const StoredTransitionSchema = v__namespace.strictObject(
369
482
  */
370
483
  metadata: v__namespace.optional(v__namespace.record(NonEmpty, NonEmpty))
371
484
  });
372
- function stageFields(field, task, transition, editable) {
485
+ function stageFields(field, activity, transition, editable) {
373
486
  return {
374
487
  name: NonEmpty,
375
488
  title: v__namespace.optional(v__namespace.string()),
376
489
  description: v__namespace.optional(v__namespace.string()),
377
- tasks: v__namespace.optional(v__namespace.array(task)),
490
+ activities: v__namespace.optional(v__namespace.array(activity)),
378
491
  transitions: v__namespace.optional(v__namespace.array(transition)),
379
492
  /**
380
493
  * Lake mutation guards active while this stage holds. Each compiles to a
@@ -394,11 +507,11 @@ function stageFields(field, task, transition, editable) {
394
507
  };
395
508
  }
396
509
  const StoredStageSchema = v__namespace.strictObject(
397
- stageFields(FieldEntrySchema, StoredTaskSchema, StoredTransitionSchema, StoredEditableSchema)
510
+ stageFields(FieldEntrySchema, StoredActivitySchema, StoredTransitionSchema, StoredEditableSchema)
398
511
  ), AuthoringStageSchema = v__namespace.strictObject(
399
512
  stageFields(
400
513
  AuthoringFieldEntrySchema,
401
- AuthoringTaskSchema,
514
+ AuthoringActivitySchema,
402
515
  AuthoringTransitionSchema,
403
516
  AuthoringEditableSchema
404
517
  )
@@ -409,12 +522,11 @@ const StoredStageSchema = v__namespace.strictObject(
409
522
  function workflowFields(field, stage) {
410
523
  return {
411
524
  name: NonEmpty,
412
- version: PositiveInt,
413
525
  title: NonEmpty,
414
526
  description: v__namespace.optional(v__namespace.string()),
415
527
  /**
416
528
  * Whether a human may start this workflow standalone. `'child'` marks a
417
- * spawn-only definition — instantiated by a parent via `task.subworkflows`,
529
+ * spawn-only definition — instantiated by a parent via `activity.subworkflows`,
418
530
  * never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
419
531
  * Advisory: consumers filter their start pickers on it (see
420
532
  * {@link isStartableDefinition}); the engine does NOT refuse a
@@ -462,14 +574,16 @@ function formatPath(path) {
462
574
  typeof seg == "number" ? out += `[${seg}]` : out += out.length === 0 ? String(seg) : `.${String(seg)}`;
463
575
  return out;
464
576
  }
577
+ exports.ACTIVITY_KINDS = ACTIVITY_KINDS;
465
578
  exports.AuthoringActionSchema = AuthoringActionSchema;
579
+ exports.AuthoringActivitySchema = AuthoringActivitySchema;
466
580
  exports.AuthoringFieldEntrySchema = AuthoringFieldEntrySchema;
467
581
  exports.AuthoringOpSchema = AuthoringOpSchema;
468
582
  exports.AuthoringStageSchema = AuthoringStageSchema;
469
- exports.AuthoringTaskSchema = AuthoringTaskSchema;
470
583
  exports.AuthoringTransitionSchema = AuthoringTransitionSchema;
471
584
  exports.AuthoringWorkflowSchema = AuthoringWorkflowSchema;
472
585
  exports.DOCUMENT_VALUE_PERMISSIONS = DOCUMENT_VALUE_PERMISSIONS;
586
+ exports.DRIVER_KINDS = DRIVER_KINDS;
473
587
  exports.EffectSchema = EffectSchema;
474
588
  exports.GROQ_IDENTIFIER = GROQ_IDENTIFIER;
475
589
  exports.GuardSchema = GuardSchema;
@@ -479,6 +593,7 @@ exports.andConditions = andConditions;
479
593
  exports.expandRequiredRoles = expandRequiredRoles;
480
594
  exports.formatValidationError = formatValidationError;
481
595
  exports.isStartableDefinition = isStartableDefinition;
482
- exports.isTerminalTaskStatus = isTerminalTaskStatus;
596
+ exports.isTerminalActivityStatus = isTerminalActivityStatus;
483
597
  exports.issuesFromValibot = issuesFromValibot;
598
+ exports.normalizeRoleAliases = normalizeRoleAliases;
484
599
  //# sourceMappingURL=schema.cjs.map