@sanity/workflow-engine 0.11.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
- ], TASK_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_]*$/;
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),
@@ -119,7 +121,7 @@ const StoredManualTargetSchema = manualTargetSchema(StoredFieldRefSchema), Autho
119
121
  v__namespace.strictObject({
120
122
  type: v__namespace.literal("field"),
121
123
  field: NonEmpty,
122
- equals: SourceSchema
124
+ equals: ValueExprSchema
123
125
  }),
124
126
  v__namespace.strictObject({ type: v__namespace.literal("all"), of: v__namespace.array(OpPredicateSchema) }),
125
127
  v__namespace.strictObject({ type: v__namespace.literal("any"), of: v__namespace.array(OpPredicateSchema) })
@@ -130,7 +132,7 @@ function opSchemas(targetSchema) {
130
132
  v__namespace.strictObject({
131
133
  type: v__namespace.literal("field.set"),
132
134
  target: targetSchema,
133
- value: SourceSchema
135
+ value: ValueExprSchema
134
136
  }),
135
137
  v__namespace.strictObject({
136
138
  type: v__namespace.literal("field.unset"),
@@ -139,13 +141,13 @@ function opSchemas(targetSchema) {
139
141
  v__namespace.strictObject({
140
142
  type: v__namespace.literal("field.append"),
141
143
  target: targetSchema,
142
- value: SourceSchema
144
+ value: ValueExprSchema
143
145
  }),
144
146
  v__namespace.strictObject({
145
147
  type: v__namespace.literal("field.updateWhere"),
146
148
  target: targetSchema,
147
149
  where: OpPredicateSchema,
148
- value: SourceSchema
150
+ value: ValueExprSchema
149
151
  }),
150
152
  v__namespace.strictObject({
151
153
  type: v__namespace.literal("field.removeWhere"),
@@ -158,13 +160,13 @@ const StoredOpSchema = v__namespace.variant("type", [
158
160
  ...opSchemas(StoredFieldRefSchema),
159
161
  v__namespace.strictObject({
160
162
  type: v__namespace.literal("status.set"),
161
- task: NonEmpty,
162
- status: picklist(TASK_STATUSES)
163
+ activity: NonEmpty,
164
+ status: picklist(ACTIVITY_STATUSES)
163
165
  })
164
166
  ]), StoredTransitionOpSchema = v__namespace.variant("type", [...opSchemas(StoredFieldRefSchema)]), AuditOpSchema = v__namespace.strictObject({
165
167
  type: v__namespace.literal("audit"),
166
168
  target: AuthoringFieldRefSchema,
167
- value: SourceSchema,
169
+ value: ValueExprSchema,
168
170
  stampFields: v__namespace.optional(
169
171
  v__namespace.strictObject({
170
172
  actor: v__namespace.optional(NonEmpty),
@@ -175,33 +177,83 @@ const StoredOpSchema = v__namespace.variant("type", [
175
177
  ...opSchemas(AuthoringFieldRefSchema),
176
178
  v__namespace.strictObject({
177
179
  type: v__namespace.literal("status.set"),
178
- task: v__namespace.optional(NonEmpty),
179
- status: picklist(TASK_STATUSES)
180
+ activity: v__namespace.optional(NonEmpty),
181
+ status: picklist(ACTIVITY_STATUSES)
180
182
  }),
181
183
  AuditOpSchema
182
- ]), FieldKindSchema = picklist([
184
+ ]), FIELD_VALUE_KINDS = [
183
185
  "doc.ref",
184
186
  "doc.refs",
185
187
  // Release reference. A workflow declares this entry to say "I target a
186
188
  // Content Release"; the runtime fills it at start time and auto-derives
187
189
  // the instance's read perspective from it.
188
190
  "release.ref",
189
- "query",
190
- "value.string",
191
- "value.url",
192
- "value.number",
193
- "value.boolean",
194
- "value.dateTime",
195
- "value.actor",
196
- "checklist",
197
- "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",
198
201
  // The WHO-FOR entry: the inbox reverse-query reads it by kind, and the
199
202
  // rendered `$assigned` gate matches the caller against it.
200
- "assignees"
201
- ]), 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]);
202
- 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) {
203
256
  return {
204
- type: FieldKindSchema,
205
257
  name: FieldEntryName,
206
258
  title: v__namespace.optional(v__namespace.string()),
207
259
  description: v__namespace.optional(v__namespace.string()),
@@ -210,20 +262,47 @@ function fieldEntryFields(editable) {
210
262
  * `initialFields`) or spawn (via the parent's `subworkflows.with`). A
211
263
  * missing required entry throws rather than silently defaulting to
212
264
  * `null`/`[]` — the same fail-fast an action's `required` param gets.
213
- * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
265
+ * Valid only on a workflow-scope `input`-sourced entry (deploy invariant).
214
266
  */
215
267
  required: v__namespace.optional(v__namespace.boolean()),
216
- 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),
217
274
  /** Who-may-edit this slot via the edit seam — see {@link StoredEditableSchema}. */
218
275
  editable: v__namespace.optional(editable)
219
276
  };
220
277
  }
221
- 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({
222
289
  type: v__namespace.literal("claim"),
223
290
  name: FieldEntryName,
224
291
  title: v__namespace.optional(v__namespace.string()),
225
292
  description: v__namespace.optional(v__namespace.string())
226
- }), 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({
227
306
  name: NonEmpty,
228
307
  title: v__namespace.optional(v__namespace.string()),
229
308
  description: v__namespace.optional(v__namespace.string()),
@@ -264,10 +343,10 @@ function actionFields(op) {
264
343
  effects: v__namespace.optional(v__namespace.array(EffectSchema))
265
344
  };
266
345
  }
267
- 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({
268
347
  ...actionFields(AuthoringOpSchema),
269
348
  roles: v__namespace.optional(v__namespace.array(NonEmpty)),
270
- status: v__namespace.optional(TerminalTaskStatus)
349
+ status: v__namespace.optional(TerminalActivityStatus)
271
350
  }), ClaimActionSchema = v__namespace.strictObject({
272
351
  type: v__namespace.literal("claim"),
273
352
  name: NonEmpty,
@@ -294,27 +373,27 @@ const StoredActionSchema = v__namespace.strictObject(actionFields(StoredOpSchema
294
373
  */
295
374
  context: v__namespace.optional(v__namespace.record(NonEmpty, ConditionSchema))
296
375
  });
297
- function taskFields(field, action, op, target) {
376
+ function activityFields(field, action, op, target) {
298
377
  return {
299
378
  name: NonEmpty,
300
379
  title: v__namespace.optional(v__namespace.string()),
301
380
  description: v__namespace.optional(v__namespace.string()),
302
381
  /**
303
- * Advisory BPMN-aligned classification of this task by its executor (see
304
- * {@link TASK_KINDS}). Optional and derived from the task's shape when
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
305
384
  * omitted; declaring it lets deploy check the shape matches the lane.
306
385
  * Changes no gating or resolution — a label for tooling, like `assignees`.
307
386
  */
308
- kind: v__namespace.optional(picklist(TASK_KINDS)),
309
- /** Deep-link target for a `kind: "manual"` task (off-system work). Render-only
310
- * metadata; only valid on a manual task (deploy-checked). */
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). */
311
390
  target: v__namespace.optional(target),
312
391
  activation: v__namespace.optional(picklist(["auto", "manual"])),
313
392
  filter: v__namespace.optional(ConditionSchema),
314
393
  /**
315
394
  * Readiness gates, by name — conditions over the rendered scope that must
316
- * hold for the task to be *executable*, orthogonal to `filter`
317
- * (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
318
397
  * its actions with a `requirements-unmet` verdict naming the unmet keys;
319
398
  * all must hold (any-of lives inside one condition). Advisory like every
320
399
  * engine gate — the lake still enforces. Distinct from ACL (authorization)
@@ -323,8 +402,8 @@ function taskFields(field, action, op, target) {
323
402
  requirements: v__namespace.optional(v__namespace.record(NonEmpty, ConditionSchema)),
324
403
  /**
325
404
  * Auto-completion condition — evaluated at activation and on every
326
- * cascade; truthy flips the task to `done` with a system actor. On a
327
- * 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`.
328
407
  */
329
408
  completeWhen: v__namespace.optional(ConditionSchema),
330
409
  /**
@@ -337,14 +416,14 @@ function taskFields(field, action, op, target) {
337
416
  effects: v__namespace.optional(v__namespace.array(EffectSchema)),
338
417
  actions: v__namespace.optional(v__namespace.array(action)),
339
418
  subworkflows: v__namespace.optional(SubworkflowsSchema),
340
- /** Task-scoped field entries. Resolved at task activation time. */
419
+ /** Activity-scoped field entries. Resolved at activity activation time. */
341
420
  fields: v__namespace.optional(v__namespace.array(field))
342
421
  };
343
422
  }
344
- const StoredTaskSchema = v__namespace.strictObject(
345
- taskFields(FieldEntrySchema, StoredActionSchema, StoredOpSchema, StoredManualTargetSchema)
346
- ), AuthoringTaskSchema = v__namespace.strictObject(
347
- taskFields(
423
+ const StoredActivitySchema = v__namespace.strictObject(
424
+ activityFields(FieldEntrySchema, StoredActionSchema, StoredOpSchema, StoredManualTargetSchema)
425
+ ), AuthoringActivitySchema = v__namespace.strictObject(
426
+ activityFields(
348
427
  AuthoringFieldEntrySchema,
349
428
  AuthoringActionSchema,
350
429
  AuthoringOpSchema,
@@ -403,12 +482,12 @@ const StoredTransitionSchema = v__namespace.strictObject(
403
482
  */
404
483
  metadata: v__namespace.optional(v__namespace.record(NonEmpty, NonEmpty))
405
484
  });
406
- function stageFields(field, task, transition, editable) {
485
+ function stageFields(field, activity, transition, editable) {
407
486
  return {
408
487
  name: NonEmpty,
409
488
  title: v__namespace.optional(v__namespace.string()),
410
489
  description: v__namespace.optional(v__namespace.string()),
411
- tasks: v__namespace.optional(v__namespace.array(task)),
490
+ activities: v__namespace.optional(v__namespace.array(activity)),
412
491
  transitions: v__namespace.optional(v__namespace.array(transition)),
413
492
  /**
414
493
  * Lake mutation guards active while this stage holds. Each compiles to a
@@ -428,11 +507,11 @@ function stageFields(field, task, transition, editable) {
428
507
  };
429
508
  }
430
509
  const StoredStageSchema = v__namespace.strictObject(
431
- stageFields(FieldEntrySchema, StoredTaskSchema, StoredTransitionSchema, StoredEditableSchema)
510
+ stageFields(FieldEntrySchema, StoredActivitySchema, StoredTransitionSchema, StoredEditableSchema)
432
511
  ), AuthoringStageSchema = v__namespace.strictObject(
433
512
  stageFields(
434
513
  AuthoringFieldEntrySchema,
435
- AuthoringTaskSchema,
514
+ AuthoringActivitySchema,
436
515
  AuthoringTransitionSchema,
437
516
  AuthoringEditableSchema
438
517
  )
@@ -443,12 +522,11 @@ const StoredStageSchema = v__namespace.strictObject(
443
522
  function workflowFields(field, stage) {
444
523
  return {
445
524
  name: NonEmpty,
446
- version: PositiveInt,
447
525
  title: NonEmpty,
448
526
  description: v__namespace.optional(v__namespace.string()),
449
527
  /**
450
528
  * Whether a human may start this workflow standalone. `'child'` marks a
451
- * spawn-only definition — instantiated by a parent via `task.subworkflows`,
529
+ * spawn-only definition — instantiated by a parent via `activity.subworkflows`,
452
530
  * never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
453
531
  * Advisory: consumers filter their start pickers on it (see
454
532
  * {@link isStartableDefinition}); the engine does NOT refuse a
@@ -496,11 +574,12 @@ function formatPath(path) {
496
574
  typeof seg == "number" ? out += `[${seg}]` : out += out.length === 0 ? String(seg) : `.${String(seg)}`;
497
575
  return out;
498
576
  }
577
+ exports.ACTIVITY_KINDS = ACTIVITY_KINDS;
499
578
  exports.AuthoringActionSchema = AuthoringActionSchema;
579
+ exports.AuthoringActivitySchema = AuthoringActivitySchema;
500
580
  exports.AuthoringFieldEntrySchema = AuthoringFieldEntrySchema;
501
581
  exports.AuthoringOpSchema = AuthoringOpSchema;
502
582
  exports.AuthoringStageSchema = AuthoringStageSchema;
503
- exports.AuthoringTaskSchema = AuthoringTaskSchema;
504
583
  exports.AuthoringTransitionSchema = AuthoringTransitionSchema;
505
584
  exports.AuthoringWorkflowSchema = AuthoringWorkflowSchema;
506
585
  exports.DOCUMENT_VALUE_PERMISSIONS = DOCUMENT_VALUE_PERMISSIONS;
@@ -508,13 +587,13 @@ exports.DRIVER_KINDS = DRIVER_KINDS;
508
587
  exports.EffectSchema = EffectSchema;
509
588
  exports.GROQ_IDENTIFIER = GROQ_IDENTIFIER;
510
589
  exports.GuardSchema = GuardSchema;
511
- exports.TASK_KINDS = TASK_KINDS;
512
590
  exports.WORKFLOW_DEFINITION_TYPE = WORKFLOW_DEFINITION_TYPE;
513
591
  exports.actorFulfillsRole = actorFulfillsRole;
514
592
  exports.andConditions = andConditions;
515
593
  exports.expandRequiredRoles = expandRequiredRoles;
516
594
  exports.formatValidationError = formatValidationError;
517
595
  exports.isStartableDefinition = isStartableDefinition;
518
- exports.isTerminalTaskStatus = isTerminalTaskStatus;
596
+ exports.isTerminalActivityStatus = isTerminalActivityStatus;
519
597
  exports.issuesFromValibot = issuesFromValibot;
598
+ exports.normalizeRoleAliases = normalizeRoleAliases;
520
599
  //# sourceMappingURL=schema.cjs.map