@sanity/workflow-engine 0.31.0 → 0.33.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.
- package/CHANGELOG.md +323 -0
- package/DATAMODEL.md +223 -9
- package/README.md +2 -2
- package/dist/_chunks-cjs/invariants.cjs +2113 -1940
- package/dist/_chunks-es/invariants.js +2041 -1918
- package/dist/define.cjs +6 -3
- package/dist/define.d.cts +668 -1195
- package/dist/define.d.ts +668 -1195
- package/dist/define.js +7 -4
- package/dist/index.cjs +2513 -968
- package/dist/index.d.cts +1467 -1923
- package/dist/index.d.ts +1467 -1923
- package/dist/index.js +2432 -927
- package/package.json +6 -4
package/dist/define.d.ts
CHANGED
|
@@ -14,14 +14,15 @@ import * as v from "valibot";
|
|
|
14
14
|
* only when cascade-fired (the pin on which identities may execute the
|
|
15
15
|
* trigger); a fireAction-fired action's `roles` folds into `filter` at
|
|
16
16
|
* desugar instead.
|
|
17
|
+
*
|
|
18
|
+
* @interface
|
|
17
19
|
*/
|
|
18
|
-
declare type Action = ActionFields<Op, string[]> & {
|
|
20
|
+
declare type Action = ActionFields<Op, string[], Effect> & {
|
|
19
21
|
roles?: string[] | undefined;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
declare type ActionFields<TOp, TGroup> = {
|
|
24
|
+
/** @inline */
|
|
25
|
+
declare type ActionFields<TOp, TGroup, TEffect> = {
|
|
25
26
|
name: string;
|
|
26
27
|
semantics?: ActionSemantic[] | undefined;
|
|
27
28
|
title?: string | undefined;
|
|
@@ -31,7 +32,7 @@ declare type ActionFields<TOp, TGroup> = {
|
|
|
31
32
|
filter?: string | undefined;
|
|
32
33
|
params?: ActionParam[] | undefined;
|
|
33
34
|
ops?: TOp[] | undefined;
|
|
34
|
-
effects?:
|
|
35
|
+
effects?: TEffect[] | undefined;
|
|
35
36
|
spawn?: Subworkflows | undefined;
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -40,6 +41,8 @@ declare type ActionFields<TOp, TGroup> = {
|
|
|
40
41
|
* or queuing effects: a missing required param throws
|
|
41
42
|
* `ActionParamsInvalidError` and the action does not commit. Resolved values
|
|
42
43
|
* feed `ValueExpr.param` lookups.
|
|
44
|
+
*
|
|
45
|
+
* @interface
|
|
43
46
|
*/
|
|
44
47
|
declare type ActionParam = v.InferOutput<typeof ActionParamSchema>;
|
|
45
48
|
|
|
@@ -185,6 +188,8 @@ declare type ActionSemantic = DecisionSemantic | Semantic;
|
|
|
185
188
|
* `requirements` are readiness gates orthogonal to `filter` — an unmet one
|
|
186
189
|
* keeps the activity visible but disables its actions with a
|
|
187
190
|
* `requirements-unmet` verdict; distinct from ACL and guards.
|
|
191
|
+
*
|
|
192
|
+
* @interface
|
|
188
193
|
*/
|
|
189
194
|
declare type Activity = ActivityFields<
|
|
190
195
|
FieldEntry,
|
|
@@ -193,7 +198,7 @@ declare type Activity = ActivityFields<
|
|
|
193
198
|
string[]
|
|
194
199
|
>;
|
|
195
200
|
|
|
196
|
-
/**
|
|
201
|
+
/** @inline */
|
|
197
202
|
declare type ActivityFields<TField, TAction, TTarget, TGroup> = {
|
|
198
203
|
name: string;
|
|
199
204
|
semantics?: Semantic[] | undefined;
|
|
@@ -209,8 +214,15 @@ declare type ActivityFields<TField, TAction, TTarget, TGroup> = {
|
|
|
209
214
|
};
|
|
210
215
|
|
|
211
216
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
217
|
+
* An activity is `active` from stage entry (or `skipped` when its `filter`
|
|
218
|
+
* excluded it) until a terminal status resolves it — there is no pre-active
|
|
219
|
+
* state. The authored action `status:` sugar (and the `status.set` op it
|
|
220
|
+
* desugars to) is constrained to {@link TerminalActivityStatus}.
|
|
221
|
+
*/
|
|
222
|
+
declare type ActivityStatus = "active" | "done" | "skipped" | "failed";
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The stored action fields plus authoring sugar. `roles`: on a fireAction-fired action (no
|
|
214
226
|
* `when`) it desugars into a `count($actor.roles[@ in [...]]) > 0` condition
|
|
215
227
|
* ANDed with `filter`; on a CASCADE-FIRED action it stores VERBATIM instead —
|
|
216
228
|
* the pin on which identities may execute the trigger, since folding it into
|
|
@@ -220,8 +232,9 @@ declare type ActivityFields<TField, TAction, TTarget, TGroup> = {
|
|
|
220
232
|
* deliberately never implied, so a forgotten `status` is a visible stall
|
|
221
233
|
* rather than a silently completed action.
|
|
222
234
|
*/
|
|
223
|
-
declare type AuthoringAction = AuthoringRawAction
|
|
235
|
+
declare type AuthoringAction = AuthoringRawAction;
|
|
224
236
|
|
|
237
|
+
/** @interface */
|
|
225
238
|
declare type AuthoringActivity = ActivityFields<
|
|
226
239
|
AuthoringFieldEntry,
|
|
227
240
|
AuthoringAction,
|
|
@@ -235,38 +248,45 @@ declare type AuthoringActivity = ActivityFields<
|
|
|
235
248
|
* predicate `action.roles` produces. `true` opens the field to anyone in its
|
|
236
249
|
* window; a bare string is a raw predicate.
|
|
237
250
|
*/
|
|
238
|
-
declare type AuthoringEditable =
|
|
251
|
+
declare type AuthoringEditable = true | string[] | string;
|
|
239
252
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
]
|
|
257
|
-
>,
|
|
258
|
-
],
|
|
259
|
-
undefined
|
|
260
|
-
>;
|
|
253
|
+
/**
|
|
254
|
+
* An {@link Effect} whose `retry` block may omit its `kind`, plus the
|
|
255
|
+
* authoring-only `runtime` block that says where the generated runtime hosts
|
|
256
|
+
* this handler. `retry` is stored; `runtime` is stripped before the deploy
|
|
257
|
+
* writes the definition.
|
|
258
|
+
*
|
|
259
|
+
* @interface
|
|
260
|
+
*/
|
|
261
|
+
declare type AuthoringEffect = EffectFields<AuthoringEffectRetry> & {
|
|
262
|
+
runtime?: EffectRuntimeBlock | undefined;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/** An {@link EffectRetry} whose omitted `kind` defaults to `engine`. */
|
|
266
|
+
declare type AuthoringEffectRetry = EffectRetryFields & {
|
|
267
|
+
kind?: EffectRetryKind | undefined;
|
|
268
|
+
};
|
|
261
269
|
|
|
270
|
+
/**
|
|
271
|
+
* A raw field entry or one of the authoring-only field sugars. `todoList`
|
|
272
|
+
* expands to an array of objects with `label`, `status`, optional `assignee`,
|
|
273
|
+
* and optional `dueDate`; that due date remains an ordinary date field.
|
|
274
|
+
* `notes` expands to an array of audit-shaped objects with `body`, `actor`,
|
|
275
|
+
* and `at` fields. Sugar type names are compiled away and never become stored
|
|
276
|
+
* field kinds.
|
|
277
|
+
* See {@link FieldEntry} for scope, required-input, and field-type constraints.
|
|
278
|
+
*/
|
|
262
279
|
declare type AuthoringFieldEntry =
|
|
263
280
|
| AuthoringRawFieldEntry
|
|
264
|
-
| ClaimField
|
|
265
281
|
| TodoListField
|
|
266
282
|
| NotesField;
|
|
267
283
|
|
|
268
|
-
/**
|
|
269
|
-
*
|
|
284
|
+
/**
|
|
285
|
+
* A field reference with `scope` optional; desugar resolves it lexically
|
|
286
|
+
* (activity → stage → workflow) into {@link StoredFieldRef}.
|
|
287
|
+
*
|
|
288
|
+
* @interface
|
|
289
|
+
*/
|
|
270
290
|
declare type AuthoringFieldRef = v.InferOutput<typeof AuthoringFieldRefSchema>;
|
|
271
291
|
|
|
272
292
|
declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
|
|
@@ -285,8 +305,26 @@ declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
|
|
|
285
305
|
undefined
|
|
286
306
|
>;
|
|
287
307
|
|
|
288
|
-
/**
|
|
289
|
-
*
|
|
308
|
+
/**
|
|
309
|
+
* A stage's content mutation guard. Its name must be unique across the whole
|
|
310
|
+
* definition and use lowercase letters, digits, and dashes, starting with a
|
|
311
|
+
* letter or digit. `match.actions` must contain at least one action.
|
|
312
|
+
*
|
|
313
|
+
* `match.types` intersects the ID criteria. Within the ID criteria, matching
|
|
314
|
+
* either `idRefs` or `idPatterns` is sufficient. Omitted or empty optional
|
|
315
|
+
* criteria do not constrain the match. `idRefs` uses typed {@link GuardRead}s.
|
|
316
|
+
* Patterns use resource-local document-ID characters and `*` wildcards.
|
|
317
|
+
* A release-version pattern is rejected if translating it for a lifecycle
|
|
318
|
+
* action would broaden it to every document.
|
|
319
|
+
*
|
|
320
|
+
* `predicate` is delta-mode GROQ over `document`, `guard`, and `mutation`;
|
|
321
|
+
* see {@link GUARD_PREDICATE_VARS}. Only a strict `true` allows a matching
|
|
322
|
+
* mutation. An omitted or empty predicate denies it. `metadata` resolves
|
|
323
|
+
* {@link GuardRead}s into values available as `guard.metadata` in the predicate.
|
|
324
|
+
* Engine evaluations are advisory; the Content Lake is the enforcement point.
|
|
325
|
+
*
|
|
326
|
+
* @interface
|
|
327
|
+
*/
|
|
290
328
|
declare type AuthoringGuard = v.InferOutput<typeof AuthoringGuardSchema>;
|
|
291
329
|
|
|
292
330
|
declare const AuthoringGuardSchema: v.StrictObjectSchema<
|
|
@@ -314,105 +352,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
|
|
|
314
352
|
undefined
|
|
315
353
|
>;
|
|
316
354
|
idRefs: v.OptionalSchema<
|
|
317
|
-
v.ArraySchema<
|
|
318
|
-
v.VariantSchema<
|
|
319
|
-
"type",
|
|
320
|
-
[
|
|
321
|
-
v.StrictObjectSchema<
|
|
322
|
-
{
|
|
323
|
-
readonly type: v.LiteralSchema<"self", undefined>;
|
|
324
|
-
},
|
|
325
|
-
undefined
|
|
326
|
-
>,
|
|
327
|
-
v.StrictObjectSchema<
|
|
328
|
-
{
|
|
329
|
-
readonly type: v.LiteralSchema<"now", undefined>;
|
|
330
|
-
},
|
|
331
|
-
undefined
|
|
332
|
-
>,
|
|
333
|
-
v.StrictObjectSchema<
|
|
334
|
-
{
|
|
335
|
-
readonly type: v.LiteralSchema<"fieldRead", undefined>;
|
|
336
|
-
readonly field: v.SchemaWithPipe<
|
|
337
|
-
readonly [
|
|
338
|
-
v.StringSchema<undefined>,
|
|
339
|
-
v.RegexAction<string, string>,
|
|
340
|
-
]
|
|
341
|
-
>;
|
|
342
|
-
readonly path: v.OptionalSchema<
|
|
343
|
-
v.SchemaWithPipe<
|
|
344
|
-
readonly [
|
|
345
|
-
v.SchemaWithPipe<
|
|
346
|
-
readonly [
|
|
347
|
-
v.StringSchema<undefined>,
|
|
348
|
-
v.MinLengthAction<
|
|
349
|
-
string,
|
|
350
|
-
1,
|
|
351
|
-
"must be a non-empty string"
|
|
352
|
-
>,
|
|
353
|
-
]
|
|
354
|
-
>,
|
|
355
|
-
v.CheckAction<
|
|
356
|
-
string,
|
|
357
|
-
"a guard read path cannot contain a line break"
|
|
358
|
-
>,
|
|
359
|
-
]
|
|
360
|
-
>,
|
|
361
|
-
undefined
|
|
362
|
-
>;
|
|
363
|
-
},
|
|
364
|
-
undefined
|
|
365
|
-
>,
|
|
366
|
-
v.StrictObjectSchema<
|
|
367
|
-
{
|
|
368
|
-
readonly type: v.LiteralSchema<"effectsRead", undefined>;
|
|
369
|
-
readonly effect: v.SchemaWithPipe<
|
|
370
|
-
readonly [
|
|
371
|
-
v.SchemaWithPipe<
|
|
372
|
-
readonly [
|
|
373
|
-
v.StringSchema<undefined>,
|
|
374
|
-
v.MinLengthAction<
|
|
375
|
-
string,
|
|
376
|
-
1,
|
|
377
|
-
"must be a non-empty string"
|
|
378
|
-
>,
|
|
379
|
-
]
|
|
380
|
-
>,
|
|
381
|
-
v.CheckAction<
|
|
382
|
-
string,
|
|
383
|
-
"an effect name cannot contain `'`"
|
|
384
|
-
>,
|
|
385
|
-
]
|
|
386
|
-
>;
|
|
387
|
-
readonly path: v.OptionalSchema<
|
|
388
|
-
v.SchemaWithPipe<
|
|
389
|
-
readonly [
|
|
390
|
-
v.SchemaWithPipe<
|
|
391
|
-
readonly [
|
|
392
|
-
v.StringSchema<undefined>,
|
|
393
|
-
v.MinLengthAction<
|
|
394
|
-
string,
|
|
395
|
-
1,
|
|
396
|
-
"must be a non-empty string"
|
|
397
|
-
>,
|
|
398
|
-
]
|
|
399
|
-
>,
|
|
400
|
-
v.CheckAction<
|
|
401
|
-
string,
|
|
402
|
-
"a guard read path cannot contain a line break"
|
|
403
|
-
>,
|
|
404
|
-
]
|
|
405
|
-
>,
|
|
406
|
-
undefined
|
|
407
|
-
>;
|
|
408
|
-
},
|
|
409
|
-
undefined
|
|
410
|
-
>,
|
|
411
|
-
],
|
|
412
|
-
undefined
|
|
413
|
-
>,
|
|
414
|
-
undefined
|
|
415
|
-
>,
|
|
355
|
+
v.ArraySchema<v.GenericSchema<GuardRead>, undefined>,
|
|
416
356
|
undefined
|
|
417
357
|
>;
|
|
418
358
|
idPatterns: v.OptionalSchema<
|
|
@@ -455,99 +395,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
|
|
|
455
395
|
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
456
396
|
]
|
|
457
397
|
>,
|
|
458
|
-
v.
|
|
459
|
-
"type",
|
|
460
|
-
[
|
|
461
|
-
v.StrictObjectSchema<
|
|
462
|
-
{
|
|
463
|
-
readonly type: v.LiteralSchema<"self", undefined>;
|
|
464
|
-
},
|
|
465
|
-
undefined
|
|
466
|
-
>,
|
|
467
|
-
v.StrictObjectSchema<
|
|
468
|
-
{
|
|
469
|
-
readonly type: v.LiteralSchema<"now", undefined>;
|
|
470
|
-
},
|
|
471
|
-
undefined
|
|
472
|
-
>,
|
|
473
|
-
v.StrictObjectSchema<
|
|
474
|
-
{
|
|
475
|
-
readonly type: v.LiteralSchema<"fieldRead", undefined>;
|
|
476
|
-
readonly field: v.SchemaWithPipe<
|
|
477
|
-
readonly [
|
|
478
|
-
v.StringSchema<undefined>,
|
|
479
|
-
v.RegexAction<string, string>,
|
|
480
|
-
]
|
|
481
|
-
>;
|
|
482
|
-
readonly path: v.OptionalSchema<
|
|
483
|
-
v.SchemaWithPipe<
|
|
484
|
-
readonly [
|
|
485
|
-
v.SchemaWithPipe<
|
|
486
|
-
readonly [
|
|
487
|
-
v.StringSchema<undefined>,
|
|
488
|
-
v.MinLengthAction<
|
|
489
|
-
string,
|
|
490
|
-
1,
|
|
491
|
-
"must be a non-empty string"
|
|
492
|
-
>,
|
|
493
|
-
]
|
|
494
|
-
>,
|
|
495
|
-
v.CheckAction<
|
|
496
|
-
string,
|
|
497
|
-
"a guard read path cannot contain a line break"
|
|
498
|
-
>,
|
|
499
|
-
]
|
|
500
|
-
>,
|
|
501
|
-
undefined
|
|
502
|
-
>;
|
|
503
|
-
},
|
|
504
|
-
undefined
|
|
505
|
-
>,
|
|
506
|
-
v.StrictObjectSchema<
|
|
507
|
-
{
|
|
508
|
-
readonly type: v.LiteralSchema<"effectsRead", undefined>;
|
|
509
|
-
readonly effect: v.SchemaWithPipe<
|
|
510
|
-
readonly [
|
|
511
|
-
v.SchemaWithPipe<
|
|
512
|
-
readonly [
|
|
513
|
-
v.StringSchema<undefined>,
|
|
514
|
-
v.MinLengthAction<
|
|
515
|
-
string,
|
|
516
|
-
1,
|
|
517
|
-
"must be a non-empty string"
|
|
518
|
-
>,
|
|
519
|
-
]
|
|
520
|
-
>,
|
|
521
|
-
v.CheckAction<string, "an effect name cannot contain `'`">,
|
|
522
|
-
]
|
|
523
|
-
>;
|
|
524
|
-
readonly path: v.OptionalSchema<
|
|
525
|
-
v.SchemaWithPipe<
|
|
526
|
-
readonly [
|
|
527
|
-
v.SchemaWithPipe<
|
|
528
|
-
readonly [
|
|
529
|
-
v.StringSchema<undefined>,
|
|
530
|
-
v.MinLengthAction<
|
|
531
|
-
string,
|
|
532
|
-
1,
|
|
533
|
-
"must be a non-empty string"
|
|
534
|
-
>,
|
|
535
|
-
]
|
|
536
|
-
>,
|
|
537
|
-
v.CheckAction<
|
|
538
|
-
string,
|
|
539
|
-
"a guard read path cannot contain a line break"
|
|
540
|
-
>,
|
|
541
|
-
]
|
|
542
|
-
>,
|
|
543
|
-
undefined
|
|
544
|
-
>;
|
|
545
|
-
},
|
|
546
|
-
undefined
|
|
547
|
-
>,
|
|
548
|
-
],
|
|
549
|
-
undefined
|
|
550
|
-
>,
|
|
398
|
+
v.GenericSchema<GuardRead>,
|
|
551
399
|
undefined
|
|
552
400
|
>,
|
|
553
401
|
undefined
|
|
@@ -558,373 +406,61 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
|
|
|
558
406
|
|
|
559
407
|
/** Like {@link ManualTarget}, but the `field` variant also accepts a bare
|
|
560
408
|
* field name; desugar normalises it into {@link AuthoringFieldRef}. */
|
|
561
|
-
declare type AuthoringManualTarget =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
readonly type: v.LiteralSchema<"url", undefined>;
|
|
571
|
-
readonly url: v.SchemaWithPipe<
|
|
572
|
-
readonly [
|
|
573
|
-
v.StringSchema<undefined>,
|
|
574
|
-
v.UrlAction<string, "must be a valid URL">,
|
|
575
|
-
v.CheckAction<string, "must be an http(s) URL">,
|
|
576
|
-
]
|
|
577
|
-
>;
|
|
578
|
-
},
|
|
579
|
-
undefined
|
|
580
|
-
>,
|
|
581
|
-
v.StrictObjectSchema<
|
|
582
|
-
{
|
|
583
|
-
readonly type: v.LiteralSchema<"field", undefined>;
|
|
584
|
-
readonly field: v.UnionSchema<
|
|
585
|
-
[
|
|
586
|
-
v.SchemaWithPipe<
|
|
587
|
-
readonly [
|
|
588
|
-
v.StringSchema<undefined>,
|
|
589
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
590
|
-
]
|
|
591
|
-
>,
|
|
592
|
-
v.StrictObjectSchema<
|
|
593
|
-
{
|
|
594
|
-
readonly scope: v.OptionalSchema<
|
|
595
|
-
v.PicklistSchema<
|
|
596
|
-
readonly ["workflow", "stage", "activity"],
|
|
597
|
-
string
|
|
598
|
-
>,
|
|
599
|
-
undefined
|
|
600
|
-
>;
|
|
601
|
-
readonly field: v.SchemaWithPipe<
|
|
602
|
-
readonly [
|
|
603
|
-
v.StringSchema<undefined>,
|
|
604
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
605
|
-
]
|
|
606
|
-
>;
|
|
607
|
-
},
|
|
608
|
-
undefined
|
|
609
|
-
>,
|
|
610
|
-
],
|
|
611
|
-
undefined
|
|
612
|
-
>;
|
|
613
|
-
},
|
|
614
|
-
undefined
|
|
615
|
-
>,
|
|
616
|
-
],
|
|
617
|
-
undefined
|
|
618
|
-
>;
|
|
409
|
+
declare type AuthoringManualTarget =
|
|
410
|
+
| {
|
|
411
|
+
type: "url";
|
|
412
|
+
url: string;
|
|
413
|
+
}
|
|
414
|
+
| {
|
|
415
|
+
type: "field";
|
|
416
|
+
field: string | AuthoringFieldRef;
|
|
417
|
+
};
|
|
619
418
|
|
|
620
419
|
/** Like {@link Op}, plus: `status.set`'s `activity` is optional (desugar fills
|
|
621
420
|
* the firing activity), and the `audit` sugar — a stamped append merging
|
|
622
|
-
* `actor`/`at` {@link ValueExpr} fields into its own value.
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
v.StringSchema<undefined>,
|
|
643
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
644
|
-
]
|
|
645
|
-
>;
|
|
646
|
-
},
|
|
647
|
-
undefined
|
|
648
|
-
>;
|
|
649
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
650
|
-
},
|
|
651
|
-
undefined
|
|
652
|
-
>,
|
|
653
|
-
v.StrictObjectSchema<
|
|
654
|
-
{
|
|
655
|
-
readonly type: v.LiteralSchema<"field.setIfMissing", undefined>;
|
|
656
|
-
readonly target: v.StrictObjectSchema<
|
|
657
|
-
{
|
|
658
|
-
readonly scope: v.OptionalSchema<
|
|
659
|
-
v.PicklistSchema<
|
|
660
|
-
readonly ["workflow", "stage", "activity"],
|
|
661
|
-
string
|
|
662
|
-
>,
|
|
663
|
-
undefined
|
|
664
|
-
>;
|
|
665
|
-
readonly field: v.SchemaWithPipe<
|
|
666
|
-
readonly [
|
|
667
|
-
v.StringSchema<undefined>,
|
|
668
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
669
|
-
]
|
|
670
|
-
>;
|
|
671
|
-
},
|
|
672
|
-
undefined
|
|
673
|
-
>;
|
|
674
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
675
|
-
},
|
|
676
|
-
undefined
|
|
677
|
-
>,
|
|
678
|
-
v.StrictObjectSchema<
|
|
679
|
-
{
|
|
680
|
-
readonly type: v.LiteralSchema<"field.unset", undefined>;
|
|
681
|
-
readonly target: v.StrictObjectSchema<
|
|
682
|
-
{
|
|
683
|
-
readonly scope: v.OptionalSchema<
|
|
684
|
-
v.PicklistSchema<
|
|
685
|
-
readonly ["workflow", "stage", "activity"],
|
|
686
|
-
string
|
|
687
|
-
>,
|
|
688
|
-
undefined
|
|
689
|
-
>;
|
|
690
|
-
readonly field: v.SchemaWithPipe<
|
|
691
|
-
readonly [
|
|
692
|
-
v.StringSchema<undefined>,
|
|
693
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
694
|
-
]
|
|
695
|
-
>;
|
|
696
|
-
},
|
|
697
|
-
undefined
|
|
698
|
-
>;
|
|
699
|
-
},
|
|
700
|
-
undefined
|
|
701
|
-
>,
|
|
702
|
-
v.StrictObjectSchema<
|
|
703
|
-
{
|
|
704
|
-
readonly type: v.LiteralSchema<"field.append", undefined>;
|
|
705
|
-
readonly target: v.StrictObjectSchema<
|
|
706
|
-
{
|
|
707
|
-
readonly scope: v.OptionalSchema<
|
|
708
|
-
v.PicklistSchema<
|
|
709
|
-
readonly ["workflow", "stage", "activity"],
|
|
710
|
-
string
|
|
711
|
-
>,
|
|
712
|
-
undefined
|
|
713
|
-
>;
|
|
714
|
-
readonly field: v.SchemaWithPipe<
|
|
715
|
-
readonly [
|
|
716
|
-
v.StringSchema<undefined>,
|
|
717
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
718
|
-
]
|
|
719
|
-
>;
|
|
720
|
-
},
|
|
721
|
-
undefined
|
|
722
|
-
>;
|
|
723
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
724
|
-
},
|
|
725
|
-
undefined
|
|
726
|
-
>,
|
|
727
|
-
v.StrictObjectSchema<
|
|
728
|
-
{
|
|
729
|
-
readonly type: v.LiteralSchema<"field.inc", undefined>;
|
|
730
|
-
readonly target: v.StrictObjectSchema<
|
|
731
|
-
{
|
|
732
|
-
readonly scope: v.OptionalSchema<
|
|
733
|
-
v.PicklistSchema<
|
|
734
|
-
readonly ["workflow", "stage", "activity"],
|
|
735
|
-
string
|
|
736
|
-
>,
|
|
737
|
-
undefined
|
|
738
|
-
>;
|
|
739
|
-
readonly field: v.SchemaWithPipe<
|
|
740
|
-
readonly [
|
|
741
|
-
v.StringSchema<undefined>,
|
|
742
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
743
|
-
]
|
|
744
|
-
>;
|
|
745
|
-
},
|
|
746
|
-
undefined
|
|
747
|
-
>;
|
|
748
|
-
readonly value: v.OptionalSchema<
|
|
749
|
-
v.GenericSchema<ValueExprInternal>,
|
|
750
|
-
undefined
|
|
751
|
-
>;
|
|
752
|
-
},
|
|
753
|
-
undefined
|
|
754
|
-
>,
|
|
755
|
-
v.StrictObjectSchema<
|
|
756
|
-
{
|
|
757
|
-
readonly type: v.LiteralSchema<"field.dec", undefined>;
|
|
758
|
-
readonly target: v.StrictObjectSchema<
|
|
759
|
-
{
|
|
760
|
-
readonly scope: v.OptionalSchema<
|
|
761
|
-
v.PicklistSchema<
|
|
762
|
-
readonly ["workflow", "stage", "activity"],
|
|
763
|
-
string
|
|
764
|
-
>,
|
|
765
|
-
undefined
|
|
766
|
-
>;
|
|
767
|
-
readonly field: v.SchemaWithPipe<
|
|
768
|
-
readonly [
|
|
769
|
-
v.StringSchema<undefined>,
|
|
770
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
771
|
-
]
|
|
772
|
-
>;
|
|
773
|
-
},
|
|
774
|
-
undefined
|
|
775
|
-
>;
|
|
776
|
-
readonly value: v.OptionalSchema<
|
|
777
|
-
v.GenericSchema<ValueExprInternal>,
|
|
778
|
-
undefined
|
|
779
|
-
>;
|
|
780
|
-
},
|
|
781
|
-
undefined
|
|
782
|
-
>,
|
|
783
|
-
v.StrictObjectSchema<
|
|
784
|
-
{
|
|
785
|
-
readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
|
|
786
|
-
readonly target: v.StrictObjectSchema<
|
|
787
|
-
{
|
|
788
|
-
readonly scope: v.OptionalSchema<
|
|
789
|
-
v.PicklistSchema<
|
|
790
|
-
readonly ["workflow", "stage", "activity"],
|
|
791
|
-
string
|
|
792
|
-
>,
|
|
793
|
-
undefined
|
|
794
|
-
>;
|
|
795
|
-
readonly field: v.SchemaWithPipe<
|
|
796
|
-
readonly [
|
|
797
|
-
v.StringSchema<undefined>,
|
|
798
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
799
|
-
]
|
|
800
|
-
>;
|
|
801
|
-
},
|
|
802
|
-
undefined
|
|
803
|
-
>;
|
|
804
|
-
readonly where: v.SchemaWithPipe<
|
|
805
|
-
readonly [
|
|
806
|
-
v.StringSchema<undefined>,
|
|
807
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
808
|
-
]
|
|
809
|
-
>;
|
|
810
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
811
|
-
},
|
|
812
|
-
undefined
|
|
813
|
-
>,
|
|
814
|
-
v.StrictObjectSchema<
|
|
815
|
-
{
|
|
816
|
-
readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
|
|
817
|
-
readonly target: v.StrictObjectSchema<
|
|
818
|
-
{
|
|
819
|
-
readonly scope: v.OptionalSchema<
|
|
820
|
-
v.PicklistSchema<
|
|
821
|
-
readonly ["workflow", "stage", "activity"],
|
|
822
|
-
string
|
|
823
|
-
>,
|
|
824
|
-
undefined
|
|
825
|
-
>;
|
|
826
|
-
readonly field: v.SchemaWithPipe<
|
|
827
|
-
readonly [
|
|
828
|
-
v.StringSchema<undefined>,
|
|
829
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
830
|
-
]
|
|
831
|
-
>;
|
|
832
|
-
},
|
|
833
|
-
undefined
|
|
834
|
-
>;
|
|
835
|
-
readonly where: v.SchemaWithPipe<
|
|
836
|
-
readonly [
|
|
837
|
-
v.StringSchema<undefined>,
|
|
838
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
839
|
-
]
|
|
840
|
-
>;
|
|
841
|
-
},
|
|
842
|
-
undefined
|
|
843
|
-
>,
|
|
844
|
-
v.StrictObjectSchema<
|
|
845
|
-
{
|
|
846
|
-
readonly type: v.LiteralSchema<"status.set", undefined>;
|
|
847
|
-
readonly activity: v.OptionalSchema<
|
|
848
|
-
v.SchemaWithPipe<
|
|
849
|
-
readonly [
|
|
850
|
-
v.StringSchema<undefined>,
|
|
851
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
852
|
-
]
|
|
853
|
-
>,
|
|
854
|
-
undefined
|
|
855
|
-
>;
|
|
856
|
-
readonly status: v.PicklistSchema<
|
|
857
|
-
readonly ["active", "done", "skipped", "failed"],
|
|
858
|
-
string
|
|
859
|
-
>;
|
|
860
|
-
},
|
|
861
|
-
undefined
|
|
862
|
-
>,
|
|
863
|
-
v.StrictObjectSchema<
|
|
864
|
-
{
|
|
865
|
-
readonly type: v.LiteralSchema<"audit", undefined>;
|
|
866
|
-
readonly target: v.StrictObjectSchema<
|
|
867
|
-
{
|
|
868
|
-
readonly scope: v.OptionalSchema<
|
|
869
|
-
v.PicklistSchema<
|
|
870
|
-
readonly ["workflow", "stage", "activity"],
|
|
871
|
-
string
|
|
872
|
-
>,
|
|
873
|
-
undefined
|
|
874
|
-
>;
|
|
875
|
-
readonly field: v.SchemaWithPipe<
|
|
876
|
-
readonly [
|
|
877
|
-
v.StringSchema<undefined>,
|
|
878
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
879
|
-
]
|
|
880
|
-
>;
|
|
881
|
-
},
|
|
882
|
-
undefined
|
|
883
|
-
>;
|
|
884
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
885
|
-
readonly stampFields: v.OptionalSchema<
|
|
886
|
-
v.StrictObjectSchema<
|
|
887
|
-
{
|
|
888
|
-
readonly actor: v.OptionalSchema<
|
|
889
|
-
v.SchemaWithPipe<
|
|
890
|
-
readonly [
|
|
891
|
-
v.StringSchema<undefined>,
|
|
892
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
893
|
-
]
|
|
894
|
-
>,
|
|
895
|
-
undefined
|
|
896
|
-
>;
|
|
897
|
-
readonly at: v.OptionalSchema<
|
|
898
|
-
v.SchemaWithPipe<
|
|
899
|
-
readonly [
|
|
900
|
-
v.StringSchema<undefined>,
|
|
901
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
902
|
-
]
|
|
903
|
-
>,
|
|
904
|
-
undefined
|
|
905
|
-
>;
|
|
906
|
-
},
|
|
907
|
-
undefined
|
|
908
|
-
>,
|
|
909
|
-
undefined
|
|
910
|
-
>;
|
|
911
|
-
},
|
|
912
|
-
undefined
|
|
913
|
-
>,
|
|
914
|
-
],
|
|
915
|
-
undefined
|
|
916
|
-
>;
|
|
421
|
+
* `actor`/`at` {@link ValueExpr} fields into its own value.
|
|
422
|
+
*/
|
|
423
|
+
declare type AuthoringOp =
|
|
424
|
+
| FieldMutationOp<AuthoringFieldRef>
|
|
425
|
+
| {
|
|
426
|
+
type: "status.set";
|
|
427
|
+
activity?: string | undefined;
|
|
428
|
+
status: ActivityStatus;
|
|
429
|
+
}
|
|
430
|
+
| {
|
|
431
|
+
type: "audit";
|
|
432
|
+
target: AuthoringFieldRef;
|
|
433
|
+
value: ValueExpr;
|
|
434
|
+
stampFields?:
|
|
435
|
+
| {
|
|
436
|
+
actor?: string | undefined;
|
|
437
|
+
at?: string | undefined;
|
|
438
|
+
}
|
|
439
|
+
| undefined;
|
|
440
|
+
};
|
|
917
441
|
|
|
918
|
-
|
|
442
|
+
/** @inline */
|
|
443
|
+
declare type AuthoringRawAction = ActionFields<
|
|
444
|
+
AuthoringOp,
|
|
445
|
+
GroupMembership,
|
|
446
|
+
AuthoringEffect
|
|
447
|
+
> & {
|
|
919
448
|
roles?: string[] | undefined;
|
|
920
449
|
status?: TerminalActivityStatus | undefined;
|
|
921
450
|
};
|
|
922
451
|
|
|
452
|
+
/** @inline */
|
|
923
453
|
declare type AuthoringRawFieldEntry = FieldEntryFields<
|
|
924
454
|
AuthoringEditable,
|
|
925
455
|
GroupMembership
|
|
926
456
|
>;
|
|
927
457
|
|
|
458
|
+
/**
|
|
459
|
+
* A {@link Stage} accepting authoring fields, activities, transitions, guards,
|
|
460
|
+
* and role-list editability. The same terminal-stage constraints apply.
|
|
461
|
+
*
|
|
462
|
+
* @interface
|
|
463
|
+
*/
|
|
928
464
|
declare type AuthoringStage = StageFields<
|
|
929
465
|
AuthoringFieldEntry,
|
|
930
466
|
AuthoringActivity,
|
|
@@ -933,61 +469,65 @@ declare type AuthoringStage = StageFields<
|
|
|
933
469
|
AuthoringEditable
|
|
934
470
|
>;
|
|
935
471
|
|
|
472
|
+
/** A {@link StartBlock} whose omitted `kind` defaults to `interactive`. */
|
|
936
473
|
declare type AuthoringStartBlock = StartFields & {
|
|
937
474
|
kind?: StartKind | undefined;
|
|
938
475
|
};
|
|
939
476
|
|
|
940
477
|
/**
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
* stays spellable as an explicit `when: "true"`.
|
|
478
|
+
* A {@link Transition} whose `when` may be omitted, defaulting to
|
|
479
|
+
* `$allActivitiesDone`. Use `when: 'true'` for an unconditional route.
|
|
944
480
|
*/
|
|
945
481
|
declare type AuthoringTransition = TransitionFields & {
|
|
946
482
|
when?: string | undefined;
|
|
947
483
|
};
|
|
948
484
|
|
|
949
|
-
/**
|
|
485
|
+
/**
|
|
486
|
+
* The authoring surface: stored primitives plus the define-time sugar. `runtime`
|
|
487
|
+
* says where the generated unattended runtime hosts this workflow, overriding
|
|
488
|
+
* its deployment's kind; an effect node overrides it in turn.
|
|
489
|
+
*
|
|
490
|
+
* @interface
|
|
491
|
+
*/
|
|
950
492
|
declare type AuthoringWorkflow = WorkflowFields<
|
|
951
493
|
AuthoringFieldEntry,
|
|
952
494
|
AuthoringStage,
|
|
953
495
|
AuthoringStartBlock
|
|
954
|
-
|
|
496
|
+
> & {
|
|
497
|
+
runtime?: RuntimeBlock | undefined;
|
|
498
|
+
};
|
|
955
499
|
|
|
956
500
|
declare interface ChoiceOption {
|
|
957
501
|
title: string;
|
|
958
502
|
value: ChoiceValue;
|
|
959
503
|
}
|
|
960
504
|
|
|
505
|
+
/**
|
|
506
|
+
* A closed list of allowed non-null scalar values. The list must be nonempty,
|
|
507
|
+
* with unique values and nonempty titles. Each value must satisfy the
|
|
508
|
+
* receiving type and its validation bounds.
|
|
509
|
+
*
|
|
510
|
+
* Fields accept choices on `string`, `text`, `number`, `url`, `date`,
|
|
511
|
+
* `dueDate`, `datetime`, and `dueDatetime`. Action parameters accept choices
|
|
512
|
+
* on `string`, `number`, `url`, and `dateTime`.
|
|
513
|
+
*/
|
|
961
514
|
declare interface ChoiceOptions {
|
|
962
515
|
list: ChoiceOption[];
|
|
963
516
|
}
|
|
964
517
|
|
|
965
518
|
declare type ChoiceValue = string | number;
|
|
966
519
|
|
|
967
|
-
/**
|
|
968
|
-
*
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
params?: ActionParam[] | undefined;
|
|
979
|
-
effects?: Effect[] | undefined;
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
/** The field half of the mirrored claim pair, expanding strictly within this entry: an `actor`
|
|
983
|
-
* working-memory field with no `initialValue` — the paired {@link ClaimAction}'s op fills it. */
|
|
984
|
-
declare type ClaimField = {
|
|
985
|
-
type: "claim";
|
|
986
|
-
name: string;
|
|
987
|
-
title?: string | undefined;
|
|
988
|
-
description?: string | undefined;
|
|
989
|
-
group?: GroupMembership | undefined;
|
|
990
|
-
};
|
|
520
|
+
/**
|
|
521
|
+
* A raw GROQ string evaluated over the rendered scope: the engine-bound
|
|
522
|
+
* variables inventoried in {@link CONDITION_VARS} (each annotated with the
|
|
523
|
+
* context that binds it) plus the author's nullary `predicates` as `$<name>`
|
|
524
|
+
* booleans. Evaluation runs against the instance's in-memory snapshot —
|
|
525
|
+
* never a `_type` scan over the lake (rejected at deploy).
|
|
526
|
+
*
|
|
527
|
+
* There is no `{ref, args}` wrapper: parameterized reuse is a define-time
|
|
528
|
+
* TypeScript function producing a condition string (see the {@link define.groq | groq} tag).
|
|
529
|
+
*/
|
|
530
|
+
declare type Condition = string;
|
|
991
531
|
|
|
992
532
|
/**
|
|
993
533
|
* Every variable the engine binds for the RENDERED condition scope (every
|
|
@@ -1048,11 +588,21 @@ export declare function defineActivity(
|
|
|
1048
588
|
activity: AuthoringActivity,
|
|
1049
589
|
): AuthoringActivity;
|
|
1050
590
|
|
|
591
|
+
/**
|
|
592
|
+
* What `defineWorkflow` returns: the stored definition, plus `runtime` when the
|
|
593
|
+
* workflow or one of its effects declared a hosting kind. Generation and the
|
|
594
|
+
* blueprint tooling read `runtime`; the deploy drops it, so it never reaches the
|
|
595
|
+
* Content Lake and never affects a definition's content fingerprint.
|
|
596
|
+
*/
|
|
597
|
+
declare type DefinedWorkflow = WorkflowDefinition & {
|
|
598
|
+
runtime?: DefinitionRuntime | undefined;
|
|
599
|
+
};
|
|
600
|
+
|
|
1051
601
|
/**
|
|
1052
602
|
* Validate and return an effect declaration — the registry model: `name` is
|
|
1053
603
|
* the effect's only identity; the host app registers a handler against it.
|
|
1054
604
|
*/
|
|
1055
|
-
export declare function defineEffect(effect:
|
|
605
|
+
export declare function defineEffect(effect: AuthoringEffect): AuthoringEffect;
|
|
1056
606
|
|
|
1057
607
|
export declare function defineEffectDescriptor(
|
|
1058
608
|
descriptor: EffectDescriptor,
|
|
@@ -1081,8 +631,9 @@ export declare function defineTransition(
|
|
|
1081
631
|
): AuthoringTransition;
|
|
1082
632
|
|
|
1083
633
|
/**
|
|
1084
|
-
* Validate, desugar, and return a workflow definition in its stored shape
|
|
1085
|
-
*
|
|
634
|
+
* Validate, desugar, and return a workflow definition in its stored shape, plus
|
|
635
|
+
* the `runtime` hosting the workflow or its effects declared. Throws with a
|
|
636
|
+
* formatted, path-prefixed error message if validation fails.
|
|
1086
637
|
*
|
|
1087
638
|
* Example error:
|
|
1088
639
|
*
|
|
@@ -1094,13 +645,13 @@ export declare function defineTransition(
|
|
|
1094
645
|
*/
|
|
1095
646
|
export declare function defineWorkflow(
|
|
1096
647
|
definition: AuthoringWorkflow,
|
|
1097
|
-
):
|
|
648
|
+
): DefinedWorkflow;
|
|
1098
649
|
|
|
1099
650
|
/**
|
|
1100
651
|
* Validate a deploy config — the binding of each definition's logical resource
|
|
1101
652
|
* handles to physical resources, per environment (tag). Throws a formatted,
|
|
1102
653
|
* path-prefixed error if the shape is invalid. The CLI collapses the selected
|
|
1103
|
-
* deployment's bindings via {@link resourceAliasesToMap} into the
|
|
654
|
+
* deployment's bindings via {@link index.resourceAliasesToMap | resourceAliasesToMap} into the
|
|
1104
655
|
* `resourceAliases` map `deployDefinitions` expands against.
|
|
1105
656
|
*
|
|
1106
657
|
* Validates shape only; reader-floor acknowledgement belongs to paths that
|
|
@@ -1116,6 +667,17 @@ export declare function defineWorkflowConfig(
|
|
|
1116
667
|
config: WorkflowConfigInput,
|
|
1117
668
|
): WorkflowConfig;
|
|
1118
669
|
|
|
670
|
+
/**
|
|
671
|
+
* The hosting declarations {@link DefinedWorkflow} carries for the generator,
|
|
672
|
+
* collected out of the authored tree. `kind` is present only when the workflow
|
|
673
|
+
* declared one, so an absent `kind` inherits the deployment's. `effects` holds
|
|
674
|
+
* one entry per effect that declared a block, keyed by effect name.
|
|
675
|
+
*/
|
|
676
|
+
declare interface DefinitionRuntime {
|
|
677
|
+
kind?: RuntimeKind | undefined;
|
|
678
|
+
effects?: Record<string, EffectRuntimeBlock> | undefined;
|
|
679
|
+
}
|
|
680
|
+
|
|
1119
681
|
/**
|
|
1120
682
|
* Declared editability of a field — the generic edit seam's gate. Default
|
|
1121
683
|
* (absent) is NOT editable: a field is op-only engine working memory unless the
|
|
@@ -1125,21 +687,27 @@ export declare function defineWorkflowConfig(
|
|
|
1125
687
|
* to decide who-may-edit. ADVISORY like every engine gate — it disables the
|
|
1126
688
|
* inline field and explains; a {@link Guard} declares the intended write-lock.
|
|
1127
689
|
*/
|
|
1128
|
-
declare type Editable =
|
|
690
|
+
declare type Editable = true | string;
|
|
1129
691
|
|
|
1130
692
|
/**
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
* `bindings`
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
693
|
+
* External work queued for the handler registered under `name`. Names are
|
|
694
|
+
* unique within a definition; completed outputs are read as `$effects['<name>']`.
|
|
695
|
+
*
|
|
696
|
+
* `bindings` resolves GROQ expressions against the action's rendered scope
|
|
697
|
+
* when the effect is queued. The handler receives one parameter bag combining
|
|
698
|
+
* those values with static `input`. An `input` key overrides a same-named
|
|
699
|
+
* binding, including when its value is null.
|
|
700
|
+
*
|
|
701
|
+
* `outputs` declares the allowed result keys and their {@link FieldShape}s.
|
|
702
|
+
* An undeclared key or invalid value rejects the completion without storing
|
|
703
|
+
* it. Omitting `outputs` allows no output keys.
|
|
704
|
+
*
|
|
705
|
+
* `retry` ({@link EffectRetry}) bounds how many times a failing handler is
|
|
706
|
+
* attempted. Omitting it completes the effect as failed on the first failure.
|
|
707
|
+
*
|
|
708
|
+
* @interface
|
|
1141
709
|
*/
|
|
1142
|
-
declare type Effect =
|
|
710
|
+
declare type Effect = EffectFields<EffectRetry>;
|
|
1143
711
|
|
|
1144
712
|
/**
|
|
1145
713
|
* Effect handler descriptor, registered by the runtime against an effect
|
|
@@ -1160,43 +728,96 @@ export declare interface EffectDescriptorParam {
|
|
|
1160
728
|
description?: string;
|
|
1161
729
|
}
|
|
1162
730
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
731
|
+
/** @inline */
|
|
732
|
+
declare type EffectFields<TRetry> = {
|
|
733
|
+
name: string;
|
|
734
|
+
title?: string | undefined;
|
|
735
|
+
description?: string | undefined;
|
|
736
|
+
bindings?: Record<string, string> | undefined;
|
|
737
|
+
input?: Record<string, unknown> | undefined;
|
|
738
|
+
outputs?: FieldShape[] | undefined;
|
|
739
|
+
retry?: TRetry | undefined;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* A bounded retry policy for one effect. Both bounds govern one drain's run of
|
|
744
|
+
* the policy, not the effect's lifetime: a drainer that dies mid-run leaves the
|
|
745
|
+
* entry for the next drain, which starts a fresh run with the full budget, so
|
|
746
|
+
* an effect can see more handler calls in total than `attempts`.
|
|
747
|
+
*
|
|
748
|
+
* `attempts` is the total number of attempts in a run, the first included, so
|
|
749
|
+
* `1` means "never retry".
|
|
750
|
+
*
|
|
751
|
+
* `expiryMs` and the backoff a policy accumulates are each capped at 366 days
|
|
752
|
+
* (`31_622_400_000` ms), inclusive. Deploy refuses a policy declaring more,
|
|
753
|
+
* and one whose accumulated backoff reaches its own `expiryMs` before its
|
|
754
|
+
* `attempts` are spent. Those checks weigh the declared waits alone. At
|
|
755
|
+
* runtime every elapsed millisecond counts against `expiryMs`, handler time
|
|
756
|
+
* included, so a slow handler can leave attempts unused. `backoff` paces
|
|
757
|
+
* them; omitting it retries with no wait. Every duration is a whole number of
|
|
758
|
+
* milliseconds above zero, and `attempts` a whole count above zero; deploy
|
|
759
|
+
* rejects anything else.
|
|
760
|
+
*
|
|
761
|
+
* `expiryMs` decides whether a further attempt may start, measured from the
|
|
762
|
+
* moment this run dispatched its first attempt. The window closes
|
|
763
|
+
* on reaching it, so an attempt is admitted only while less than `expiryMs`
|
|
764
|
+
* has elapsed. It is not a handler timeout. An attempt already running is
|
|
765
|
+
* never interrupted, so a run can finish after the window, and a success then
|
|
766
|
+
* still counts. Omitting it leaves `attempts` as the only bound.
|
|
767
|
+
*
|
|
768
|
+
* A policy that runs out of attempts, or that `expiryMs` stops, completes the
|
|
769
|
+
* effect as failed, and `$effectStatus['<name>'] == 'failed'` routes the
|
|
770
|
+
* instance. A successful attempt completes it as done, whichever attempt
|
|
771
|
+
* succeeded. An effect with no `retry` completes as failed on its handler's
|
|
772
|
+
* first failure.
|
|
773
|
+
*/
|
|
774
|
+
declare type EffectRetry = EffectRetryFields & {
|
|
775
|
+
kind: EffectRetryKind;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* How long the engine waits between two attempts. `delayMs` is that wait in
|
|
780
|
+
* milliseconds: `'fixed'` waits it every time, `'exponential'` doubles it per
|
|
781
|
+
* attempt already made (`delayMs`, then `2 × delayMs`, then `4 × delayMs`).
|
|
782
|
+
*/
|
|
783
|
+
declare type EffectRetryBackoff = {
|
|
784
|
+
kind: "fixed" | "exponential";
|
|
785
|
+
delayMs: number;
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
/** @inline */
|
|
789
|
+
declare type EffectRetryFields = {
|
|
790
|
+
attempts: number;
|
|
791
|
+
backoff?: EffectRetryBackoff | undefined;
|
|
792
|
+
expiryMs?: number | undefined;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Who runs a retry policy. `'engine'` is the only member: the engine loops
|
|
797
|
+
* inside the `drainEffects` call that picked the effect up, holding the claim
|
|
798
|
+
* across the waits.
|
|
799
|
+
*/
|
|
800
|
+
declare type EffectRetryKind = "engine";
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* The `runtime` block on an effect node, overriding its workflow's kind.
|
|
804
|
+
* `timeout` is seconds and `memory` megabytes of the function that runs this
|
|
805
|
+
* handler, and an effect declaring either gets its own drain function instead of
|
|
806
|
+
* sharing the deployment's. Both are the function budget, so both are accepted
|
|
807
|
+
* only under `'function'`.
|
|
808
|
+
*/
|
|
809
|
+
declare type EffectRuntimeBlock =
|
|
810
|
+
| {
|
|
811
|
+
kind: "function";
|
|
812
|
+
timeout?: number | undefined;
|
|
813
|
+
memory?: number | undefined;
|
|
814
|
+
}
|
|
815
|
+
| {
|
|
816
|
+
kind: "durableFunction";
|
|
817
|
+
}
|
|
818
|
+
| {
|
|
819
|
+
kind: "selfHosted";
|
|
820
|
+
};
|
|
1200
821
|
|
|
1201
822
|
/**
|
|
1202
823
|
* The kinds a VALUE can take — scalars aligned to Sanity's names, the
|
|
@@ -1232,8 +853,7 @@ declare const FIELD_VALUE_KINDS: readonly [
|
|
|
1232
853
|
"array",
|
|
1233
854
|
];
|
|
1234
855
|
|
|
1235
|
-
/**
|
|
1236
|
-
* `group` grammars (stored membership is the canonical list form). */
|
|
856
|
+
/** @inline */
|
|
1237
857
|
declare type FieldBase<TEditable, TGroup> = {
|
|
1238
858
|
name: string;
|
|
1239
859
|
title?: string | undefined;
|
|
@@ -1244,11 +864,33 @@ declare type FieldBase<TEditable, TGroup> = {
|
|
|
1244
864
|
editable?: TEditable | undefined;
|
|
1245
865
|
};
|
|
1246
866
|
|
|
1247
|
-
/**
|
|
867
|
+
/**
|
|
868
|
+
* A field declaration whose location determines its scope and lifetime.
|
|
869
|
+
* Workflow fields initialize at start; stage and activity fields initialize
|
|
870
|
+
* on each stage visit. {@link FieldSource} controls initialization;
|
|
871
|
+
* {@link Editable} controls direct edits independently.
|
|
872
|
+
*
|
|
873
|
+
* `required: true` is valid only on workflow-scope fields with an `input`
|
|
874
|
+
* source. It requires a non-null value at start or spawn. On `subject`,
|
|
875
|
+
* `doc.ref`, and `doc.refs`, selected targets must also remain readable in the
|
|
876
|
+
* workflow perspective after initialization. Missing targets block normal
|
|
877
|
+
* actions, triggered actions, and transitions. Abort and permitted field edits remain available.
|
|
878
|
+
* `subject` is also
|
|
879
|
+
* workflow-scope-only, with at most one subject per definition. Each scope
|
|
880
|
+
* may declare at most one `dueDate` or `dueDatetime` field, always top-level.
|
|
881
|
+
*
|
|
882
|
+
* `types` is a nonempty list of accepted document types on `subject`,
|
|
883
|
+
* `doc.ref`, or `doc.refs`; omit it to accept any document type. `roles`
|
|
884
|
+
* constrains assignment eligibility only on `assignee` and `assignees`.
|
|
885
|
+
* {@link FieldShape}, {@link ChoiceOptions}, and {@link ScalarValidation}
|
|
886
|
+
* define the nested-shape and scalar constraints. Authoring conveniences are
|
|
887
|
+
* accepted by {@link AuthoringFieldEntry}.
|
|
888
|
+
*
|
|
889
|
+
* @interface
|
|
890
|
+
*/
|
|
1248
891
|
declare type FieldEntry = FieldEntryFields<Editable, string[]>;
|
|
1249
892
|
|
|
1250
|
-
/**
|
|
1251
|
-
* editability and group-membership grammars. */
|
|
893
|
+
/** @inline */
|
|
1252
894
|
declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
|
|
1253
895
|
TEditable,
|
|
1254
896
|
TGroup
|
|
@@ -1263,6 +905,76 @@ declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
|
|
|
1263
905
|
of?: FieldShape[] | undefined;
|
|
1264
906
|
};
|
|
1265
907
|
|
|
908
|
+
/**
|
|
909
|
+
* A field mutation targeting a declared field. Resolved values must satisfy
|
|
910
|
+
* that field's shape, choices, validation, and assignment constraints.
|
|
911
|
+
*
|
|
912
|
+
* `field.setIfMissing` supports nullable fields only. If a value exists, it
|
|
913
|
+
* leaves the value unchanged and records no `opApplied` history event.
|
|
914
|
+
* `field.inc` and `field.dec` require an initialized `number` field; their
|
|
915
|
+
* delta defaults to `1`. Both the delta and resulting value must be finite,
|
|
916
|
+
* and the result must satisfy the field's validation bounds.
|
|
917
|
+
*
|
|
918
|
+
* `field.append` adds one valid list member. `field.updateWhere` accepts only
|
|
919
|
+
* `array` fields and merges an object into matching rows. The merge cannot
|
|
920
|
+
* write `_key` or `_type`, and each resulting row must satisfy its declared
|
|
921
|
+
* shape. `field.removeWhere` supports list fields. See {@link Op} for row
|
|
922
|
+
* selection and history behavior.
|
|
923
|
+
*/
|
|
924
|
+
declare type FieldMutationOp<
|
|
925
|
+
TTarget extends {
|
|
926
|
+
field: string;
|
|
927
|
+
},
|
|
928
|
+
> =
|
|
929
|
+
| {
|
|
930
|
+
type: "field.set";
|
|
931
|
+
target: TTarget;
|
|
932
|
+
value: ValueExpr;
|
|
933
|
+
}
|
|
934
|
+
| {
|
|
935
|
+
type: "field.setIfMissing";
|
|
936
|
+
target: TTarget;
|
|
937
|
+
value: ValueExpr;
|
|
938
|
+
}
|
|
939
|
+
| {
|
|
940
|
+
type: "field.unset";
|
|
941
|
+
target: TTarget;
|
|
942
|
+
}
|
|
943
|
+
| {
|
|
944
|
+
type: "field.append";
|
|
945
|
+
target: TTarget;
|
|
946
|
+
value: ValueExpr;
|
|
947
|
+
}
|
|
948
|
+
| {
|
|
949
|
+
type: "field.inc";
|
|
950
|
+
target: TTarget;
|
|
951
|
+
value?: ValueExpr | undefined;
|
|
952
|
+
}
|
|
953
|
+
| {
|
|
954
|
+
type: "field.dec";
|
|
955
|
+
target: TTarget;
|
|
956
|
+
value?: ValueExpr | undefined;
|
|
957
|
+
}
|
|
958
|
+
| {
|
|
959
|
+
type: "field.updateWhere";
|
|
960
|
+
target: TTarget;
|
|
961
|
+
where: Condition;
|
|
962
|
+
value: ValueExpr;
|
|
963
|
+
}
|
|
964
|
+
| {
|
|
965
|
+
type: "field.removeWhere";
|
|
966
|
+
target: TTarget;
|
|
967
|
+
where: Condition;
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* A {@link FieldMutationOp} whose target scope is explicit. Actions can write
|
|
972
|
+
* fields in their activity, stage, or workflow. Effect completions accept only
|
|
973
|
+
* workflow- or stage-scoped field operations, never activity status changes.
|
|
974
|
+
*/
|
|
975
|
+
declare type FieldOp = FieldMutationOp<StoredFieldRef>;
|
|
976
|
+
|
|
977
|
+
/** @inline */
|
|
1266
978
|
declare type FieldReadExpr = {
|
|
1267
979
|
type: "fieldRead";
|
|
1268
980
|
scope?: "workflow" | "stage" | undefined;
|
|
@@ -1271,12 +983,16 @@ declare type FieldReadExpr = {
|
|
|
1271
983
|
};
|
|
1272
984
|
|
|
1273
985
|
/**
|
|
1274
|
-
* A
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
986
|
+
* A nested field shape inside an object's `fields`, an array's `of`, or an
|
|
987
|
+
* effect's `outputs`. It has no initialization, direct editability, or required
|
|
988
|
+
* setting; those belong to {@link FieldEntry}.
|
|
989
|
+
*
|
|
990
|
+
* An `object` requires nonempty `fields` and no `of`. An `array` requires
|
|
991
|
+
* nonempty `of` and no `fields`. Other types accept neither. Sibling names
|
|
992
|
+
* must be unique. Use ordinary `date` and `datetime` here; `dueDate` and
|
|
993
|
+
* `dueDatetime` are not valid nested fields or effect outputs.
|
|
994
|
+
* {@link ChoiceOptions} and {@link ScalarValidation} constrain supported
|
|
995
|
+
* scalar types. `roles` is valid only on `assignee` and `assignees` shapes.
|
|
1280
996
|
*/
|
|
1281
997
|
declare interface FieldShape {
|
|
1282
998
|
type: FieldValueKind;
|
|
@@ -1292,14 +1008,32 @@ declare interface FieldShape {
|
|
|
1292
1008
|
}
|
|
1293
1009
|
|
|
1294
1010
|
/**
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1011
|
+
* Supplies a field's `initialValue` once, when the field is initialized.
|
|
1012
|
+
* Omitting the source starts the field empty; an operation can fill it later.
|
|
1013
|
+
* The source does not grant permission to edit. Direct editing requires an
|
|
1014
|
+
* {@link Editable | editable} declaration.
|
|
1015
|
+
*
|
|
1016
|
+
* Distinct from {@link ValueExpr}, which supplies an operation's write value.
|
|
1017
|
+
* Only the literal and field-read forms are shared.
|
|
1018
|
+
*
|
|
1019
|
+
* `input` reads workflow inputs supplied at start or spawn. Stage and activity
|
|
1020
|
+
* input seeds receive no caller value; activity input seeds produce a deploy
|
|
1021
|
+
* warning. `literal` supplies a fixed value. `query` runs against the Content
|
|
1022
|
+
* Lake with earlier fields in the same scope available as `$fields`.
|
|
1023
|
+
* Reference normalization can omit unrecognized values without recording
|
|
1024
|
+
* `fieldQueryDiscarded`. A result that fails validation after normalization
|
|
1025
|
+
* uses the field's empty value (`null` or `[]`) and records that event.
|
|
1026
|
+
* A failed query throws.
|
|
1027
|
+
*
|
|
1028
|
+
* A `fieldRead` seed reads earlier fields in its own scope when `scope` is
|
|
1029
|
+
* omitted. A stage or activity seed can read workflow fields with
|
|
1030
|
+
* `scope: 'workflow'`. An activity seed cannot read stage fields. At workflow
|
|
1031
|
+
* scope, omit `scope` to read an earlier workflow field. `path` selects a
|
|
1032
|
+
* nested value; these reads do not load referenced documents.
|
|
1300
1033
|
*/
|
|
1301
1034
|
declare type FieldSource = FieldSourceInternal;
|
|
1302
1035
|
|
|
1036
|
+
/** @inline */
|
|
1303
1037
|
declare type FieldSourceInternal =
|
|
1304
1038
|
| {
|
|
1305
1039
|
type: "input";
|
|
@@ -1340,8 +1074,13 @@ export declare function groq(
|
|
|
1340
1074
|
...values: unknown[]
|
|
1341
1075
|
): string;
|
|
1342
1076
|
|
|
1343
|
-
/**
|
|
1344
|
-
*
|
|
1077
|
+
/**
|
|
1078
|
+
* A named GROQ readiness condition. Its name must be unique in the containing
|
|
1079
|
+
* requirements array. Activity requirements use instance and caller variables;
|
|
1080
|
+
* workflow requirements use the input and projected dataset in {@link StartBlock}.
|
|
1081
|
+
* Every requirement must pass before the corresponding caller action or fresh
|
|
1082
|
+
* standalone start can commit.
|
|
1083
|
+
*/
|
|
1345
1084
|
declare type GroqRequirement = RequirementBase & {
|
|
1346
1085
|
type: "groq";
|
|
1347
1086
|
query: string;
|
|
@@ -1388,25 +1127,11 @@ declare type GroupKind = (typeof GROUP_KINDS)[number];
|
|
|
1388
1127
|
declare type GroupMembership = string | string[];
|
|
1389
1128
|
|
|
1390
1129
|
/**
|
|
1391
|
-
* A
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
* `_id` derives from `(instanceId, name)` at stage entry) and the deploy-time
|
|
1397
|
-
* read VALUES on `match.idRefs` / `metadata` (a typed {@link GuardRead} when
|
|
1398
|
-
* authoring, resolved to bare values at deploy). `match` selects mutations by
|
|
1399
|
-
* `types` (empty matches any), `idRefs` (field reads resolved to bare ids),
|
|
1400
|
-
* `idPatterns` (bare glob ids), and `actions` (at least one). `predicate` is
|
|
1401
|
-
* lake GROQ in a distinct delta-mode eval context (`before()`/`after()`,
|
|
1402
|
-
* `mutation`, `guard`, `identity()`, bare ids/fields only): strictly `true`
|
|
1403
|
-
* ALLOWS the mutation; anything else — false, null, an evaluation error, or
|
|
1404
|
-
* an omitted/empty predicate — DENIES. `metadata` is the only bridge from
|
|
1405
|
-
* that eval context (which cannot see `$fields`) to workflow fields, read as
|
|
1406
|
-
* `guard.metadata.*` and re-synced by the post-field-op guard refresh. The
|
|
1407
|
-
* lake does not enforce the guard document type yet: a deployed guard denies
|
|
1408
|
-
* optimistically engine-side, and the lake ACL is the only hard gate until
|
|
1409
|
-
* guard enforcement ships.
|
|
1130
|
+
* A stored workflow guard. Its string reads and authored lifecycle actions
|
|
1131
|
+
* remain unresolved until stage entry produces the Lake-shaped documents
|
|
1132
|
+
* deployed for that stage.
|
|
1133
|
+
*
|
|
1134
|
+
* @interface
|
|
1410
1135
|
*/
|
|
1411
1136
|
declare type Guard = v.InferOutput<typeof GuardSchema>;
|
|
1412
1137
|
|
|
@@ -1414,14 +1139,41 @@ declare type Guard = v.InferOutput<typeof GuardSchema>;
|
|
|
1414
1139
|
* The identifiers a lake mutation guard's `predicate` reads — the wire
|
|
1415
1140
|
* dialect, not the condition scope (so no {@link ConditionVarBinding}: these
|
|
1416
1141
|
* bind only when a guard evaluates a mutation). `before()`/`after()`/
|
|
1417
|
-
* `identity()` are groq-js delta-mode natives on top of these.
|
|
1418
|
-
*
|
|
1142
|
+
* `identity()` are groq-js delta-mode natives on top of these. The guard
|
|
1143
|
+
* evaluator must bind every entry here at the predicate root.
|
|
1419
1144
|
*/
|
|
1420
1145
|
export declare const GUARD_PREDICATE_VARS: readonly {
|
|
1421
1146
|
name: string;
|
|
1422
1147
|
description: string;
|
|
1423
1148
|
}[];
|
|
1424
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* A value read for a guard's `match.idRefs` or `metadata`, resolved when the
|
|
1152
|
+
* guard is created or refreshed. `fieldRead` reads workflow fields only;
|
|
1153
|
+
* stage and activity fields are unavailable. `effectsRead` reads a completed
|
|
1154
|
+
* effect's output. `self` supplies the instance's GDR URI and `now` its ISO
|
|
1155
|
+
* clock value.
|
|
1156
|
+
* Paths cannot contain line breaks, and effect names cannot contain `'`.
|
|
1157
|
+
* Stored {@link Guard} declarations carry string forms of these reads.
|
|
1158
|
+
*/
|
|
1159
|
+
declare type GuardRead =
|
|
1160
|
+
| {
|
|
1161
|
+
type: "self";
|
|
1162
|
+
}
|
|
1163
|
+
| {
|
|
1164
|
+
type: "now";
|
|
1165
|
+
}
|
|
1166
|
+
| {
|
|
1167
|
+
type: "fieldRead";
|
|
1168
|
+
field: string;
|
|
1169
|
+
path?: string | undefined;
|
|
1170
|
+
}
|
|
1171
|
+
| {
|
|
1172
|
+
type: "effectsRead";
|
|
1173
|
+
effect: string;
|
|
1174
|
+
path?: string | undefined;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1425
1177
|
declare const GuardSchema: v.StrictObjectSchema<
|
|
1426
1178
|
{
|
|
1427
1179
|
name: v.SchemaWithPipe<
|
|
@@ -1470,21 +1222,12 @@ declare const GuardSchema: v.StrictObjectSchema<
|
|
|
1470
1222
|
>,
|
|
1471
1223
|
undefined
|
|
1472
1224
|
>;
|
|
1473
|
-
actions: v.
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
>,
|
|
1480
|
-
undefined
|
|
1481
|
-
>,
|
|
1482
|
-
v.MinLengthAction<
|
|
1483
|
-
("create" | "update" | "delete" | "publish" | "unpublish")[],
|
|
1484
|
-
1,
|
|
1485
|
-
"a guard must match at least one action"
|
|
1486
|
-
>,
|
|
1487
|
-
]
|
|
1225
|
+
actions: v.ArraySchema<
|
|
1226
|
+
v.PicklistSchema<
|
|
1227
|
+
readonly ["create", "update", "delete", "publish", "unpublish"],
|
|
1228
|
+
string
|
|
1229
|
+
>,
|
|
1230
|
+
undefined
|
|
1488
1231
|
>;
|
|
1489
1232
|
},
|
|
1490
1233
|
undefined
|
|
@@ -1512,6 +1255,7 @@ declare const GuardSchema: v.StrictObjectSchema<
|
|
|
1512
1255
|
undefined
|
|
1513
1256
|
>;
|
|
1514
1257
|
|
|
1258
|
+
/** @inline */
|
|
1515
1259
|
declare type LiteralExpr = {
|
|
1516
1260
|
type: "literal";
|
|
1517
1261
|
value: unknown;
|
|
@@ -1523,18 +1267,39 @@ declare type LiteralExpr = {
|
|
|
1523
1267
|
* reference whose resolved document the consumer opens; deploy checks the
|
|
1524
1268
|
* `field` variant points at a doc-valued entry.
|
|
1525
1269
|
*/
|
|
1526
|
-
declare type ManualTarget =
|
|
1270
|
+
declare type ManualTarget =
|
|
1271
|
+
| {
|
|
1272
|
+
type: "url";
|
|
1273
|
+
url: string;
|
|
1274
|
+
}
|
|
1275
|
+
| {
|
|
1276
|
+
type: "field";
|
|
1277
|
+
field: StoredFieldRef;
|
|
1278
|
+
};
|
|
1527
1279
|
|
|
1528
|
-
/**
|
|
1529
|
-
* names match the `audit` op's stamp fields, so it pairs with it. Never a stored kind. */
|
|
1280
|
+
/** @inline */
|
|
1530
1281
|
declare type NotesField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
1531
1282
|
type: "notes";
|
|
1532
1283
|
};
|
|
1533
1284
|
|
|
1534
|
-
/**
|
|
1535
|
-
*
|
|
1536
|
-
|
|
1285
|
+
/**
|
|
1286
|
+
* An action operation: a {@link FieldOp} or a status change on an activity in
|
|
1287
|
+
* the current stage.
|
|
1288
|
+
*
|
|
1289
|
+
* For `field.updateWhere` and `field.removeWhere`, `where` evaluates each row
|
|
1290
|
+
* as `$row`. Caller-fired actions also supply `$params`. Referenced document
|
|
1291
|
+
* content is not loaded for row selection, and an unevaluable row never
|
|
1292
|
+
* matches. An operation matching no rows still records `opApplied` history.
|
|
1293
|
+
*/
|
|
1294
|
+
declare type Op =
|
|
1295
|
+
| FieldOp
|
|
1296
|
+
| {
|
|
1297
|
+
type: "status.set";
|
|
1298
|
+
activity: string;
|
|
1299
|
+
status: ActivityStatus;
|
|
1300
|
+
};
|
|
1537
1301
|
|
|
1302
|
+
/** @inline */
|
|
1538
1303
|
declare type RequirementBase = {
|
|
1539
1304
|
name: string;
|
|
1540
1305
|
title?: string | undefined;
|
|
@@ -1556,38 +1321,40 @@ export declare const RESERVED_CONDITION_VARS: readonly string[];
|
|
|
1556
1321
|
* literal ownership values and are not widened by this map. The authored `"*"`
|
|
1557
1322
|
* key lists universal fulfillers and is normalized before persistence.
|
|
1558
1323
|
*/
|
|
1559
|
-
declare type RoleAliases =
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
>,
|
|
1584
|
-
]
|
|
1585
|
-
>,
|
|
1586
|
-
undefined
|
|
1587
|
-
>;
|
|
1324
|
+
declare type RoleAliases = Record<string, string[]>;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* The `runtime` block on a deployment and on `defineWorkflow`. A workflow that
|
|
1328
|
+
* declares none inherits its deployment's kind, and a deployment that declares
|
|
1329
|
+
* none hosts on `'function'`. Authoring-only: the deploy strips it and stores
|
|
1330
|
+
* nothing.
|
|
1331
|
+
*
|
|
1332
|
+
* It is a hint to the generator and to callers, never a rule the engine
|
|
1333
|
+
* enforces. The engine never sees it: any engine built anywhere with a handler
|
|
1334
|
+
* for an effect drains that effect when it calls `drainEffects`, whatever kind
|
|
1335
|
+
* the node declares, so a `'selfHosted'` effect is drained by whoever registers
|
|
1336
|
+
* its handler, the Studio included.
|
|
1337
|
+
*/
|
|
1338
|
+
declare interface RuntimeBlock {
|
|
1339
|
+
kind: RuntimeKind;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Where the generated unattended runtime hosts a workflow or an effect.
|
|
1344
|
+
* `'function'` is a plain Sanity Function, `'durableFunction'` a durable one,
|
|
1345
|
+
* and `'selfHosted'` a process you run yourself.
|
|
1346
|
+
*/
|
|
1347
|
+
declare type RuntimeKind = "function" | "durableFunction" | "selfHosted";
|
|
1588
1348
|
|
|
1589
|
-
/**
|
|
1590
|
-
*
|
|
1349
|
+
/**
|
|
1350
|
+
* Inclusive bounds for `string`, `text`, `number`, or `progress` values.
|
|
1351
|
+
* String/text bounds count characters and must be non-negative integers.
|
|
1352
|
+
* Number bounds are finite numeric values. Progress bounds may only narrow
|
|
1353
|
+
* its inclusive 0–100 range.
|
|
1354
|
+
*
|
|
1355
|
+
* Supply at least one bound. When both are present, `min` must not exceed
|
|
1356
|
+
* `max`. Null values remain allowed unless an input is required separately.
|
|
1357
|
+
*/
|
|
1591
1358
|
declare interface ScalarValidation {
|
|
1592
1359
|
min?: number | undefined;
|
|
1593
1360
|
max?: number | undefined;
|
|
@@ -1603,21 +1370,30 @@ declare const SIGNAL_SEMANTICS: readonly [
|
|
|
1603
1370
|
|
|
1604
1371
|
declare type SignalSemantic = (typeof SIGNAL_SEMANTICS)[number];
|
|
1605
1372
|
|
|
1373
|
+
/**
|
|
1374
|
+
* A start requirement that rejects a fresh start when an unfinished run of
|
|
1375
|
+
* this definition holds the same subject, across deployed versions.
|
|
1376
|
+
* The workflow must declare an input-sourced `subject` field. Names are unique
|
|
1377
|
+
* within the requirements array. Like other engine checks, this is advisory;
|
|
1378
|
+
* it is not Content Lake enforcement.
|
|
1379
|
+
*/
|
|
1606
1380
|
declare type SingleSubjectRequirement = RequirementBase & {
|
|
1607
1381
|
type: "singleSubject";
|
|
1608
1382
|
};
|
|
1609
1383
|
|
|
1610
1384
|
/**
|
|
1611
|
-
*
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
*
|
|
1616
|
-
*
|
|
1617
|
-
*
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1620
|
-
* unlisted field inherits its baseline.
|
|
1385
|
+
* The fields, activities, guards, and outgoing routes for one stage visit.
|
|
1386
|
+
* A stage with no transitions is terminal: entering it completes the instance,
|
|
1387
|
+
* and it cannot declare activities. Put completion work in the source stage
|
|
1388
|
+
* or give the working stage an outgoing transition.
|
|
1389
|
+
*
|
|
1390
|
+
* Guards are registered on entry and retracted on exit. `editable` overrides
|
|
1391
|
+
* are keyed by in-scope field name and apply while the stage is current.
|
|
1392
|
+
* Each combines with the field's own edit condition using AND, so an override
|
|
1393
|
+
* can restrict editing but cannot open a field whose baseline is closed.
|
|
1394
|
+
* An unlisted field inherits its baseline.
|
|
1395
|
+
*
|
|
1396
|
+
* @interface
|
|
1621
1397
|
*/
|
|
1622
1398
|
declare type Stage = StageFields<
|
|
1623
1399
|
FieldEntry,
|
|
@@ -1627,7 +1403,7 @@ declare type Stage = StageFields<
|
|
|
1627
1403
|
Editable
|
|
1628
1404
|
>;
|
|
1629
1405
|
|
|
1630
|
-
/**
|
|
1406
|
+
/** @inline */
|
|
1631
1407
|
declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
|
|
1632
1408
|
name: string;
|
|
1633
1409
|
semantics?: Semantic[] | undefined;
|
|
@@ -1641,25 +1417,31 @@ declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
|
|
|
1641
1417
|
editable?: Record<string, TEditable> | undefined;
|
|
1642
1418
|
};
|
|
1643
1419
|
|
|
1644
|
-
declare const START_KINDS: readonly ["interactive", "autonomous"];
|
|
1645
|
-
|
|
1646
1420
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1652
|
-
*
|
|
1653
|
-
*
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
* `
|
|
1657
|
-
*
|
|
1421
|
+
* Discovery and readiness rules for standalone starts.
|
|
1422
|
+
* `filter` evaluates against a candidate document with `$tag`, `$definition`,
|
|
1423
|
+
* and `$now`. It controls discovery and never gates `startInstance`.
|
|
1424
|
+
* It cannot read `$fields` or caller variables.
|
|
1425
|
+
*
|
|
1426
|
+
* `requirements` evaluates named checks in declaration order before a fresh
|
|
1427
|
+
* standalone start. All must pass. Resuming an existing start and spawning
|
|
1428
|
+
* children do not rerun these checks. A GROQ requirement binds `$tag`,
|
|
1429
|
+
* `$definition`, `$now`, and `$fields`, with no candidate document root.
|
|
1430
|
+
* `$fields` contains supplied input values, including GDR reference envelopes;
|
|
1431
|
+
* it excludes computed defaults and hydrated document content.
|
|
1432
|
+
*
|
|
1433
|
+
* At both sites, `*` scans projected instances in the engine's tag. Each row
|
|
1434
|
+
* contains only `definition` (name), `subject` (GDR URI or null), and
|
|
1435
|
+
* `completedAt` (ISO timestamp or null). Completed and aborted runs are
|
|
1436
|
+
* included. Raw fields such as `_type`, `tag`, and `fields` are unavailable.
|
|
1437
|
+
* Use {@link SingleSubjectRequirement} for one unfinished run per subject.
|
|
1438
|
+
* These checks are advisory; the Content Lake remains the enforcement point.
|
|
1658
1439
|
*/
|
|
1659
1440
|
declare type StartBlock = StartFields & {
|
|
1660
1441
|
kind: StartKind;
|
|
1661
1442
|
};
|
|
1662
1443
|
|
|
1444
|
+
/** @inline */
|
|
1663
1445
|
declare type StartFields = {
|
|
1664
1446
|
filter?: string | undefined;
|
|
1665
1447
|
requirements?: StartRequirement[] | undefined;
|
|
@@ -1674,292 +1456,58 @@ declare type StartFields = {
|
|
|
1674
1456
|
* path for every kind, and an interactive start of an autonomous workflow is
|
|
1675
1457
|
* legal.
|
|
1676
1458
|
*/
|
|
1677
|
-
declare type StartKind =
|
|
1459
|
+
declare type StartKind = "interactive" | "autonomous";
|
|
1678
1460
|
|
|
1679
1461
|
/** Every named readiness requirement accepted by workflow `start.requirements`. */
|
|
1680
1462
|
declare type StartRequirement = GroqRequirement | SingleSubjectRequirement;
|
|
1681
1463
|
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1464
|
+
/**
|
|
1465
|
+
* A field reference with `scope` already resolved — the form every op target carries.
|
|
1466
|
+
*
|
|
1467
|
+
* @interface
|
|
1468
|
+
*/
|
|
1469
|
+
declare type StoredFieldRef = v.InferOutput<typeof StoredFieldRefSchema>;
|
|
1470
|
+
|
|
1471
|
+
declare const StoredFieldRefSchema: v.StrictObjectSchema<
|
|
1472
|
+
{
|
|
1473
|
+
readonly scope: v.PicklistSchema<
|
|
1474
|
+
readonly ["workflow", "stage", "activity"],
|
|
1475
|
+
string
|
|
1476
|
+
>;
|
|
1477
|
+
readonly field: v.SchemaWithPipe<
|
|
1686
1478
|
readonly [
|
|
1687
1479
|
v.StringSchema<undefined>,
|
|
1688
1480
|
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1689
1481
|
]
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
undefined
|
|
1693
|
-
>;
|
|
1694
|
-
|
|
1695
|
-
declare const StoredManualTargetSchema: v.VariantSchema<
|
|
1696
|
-
"type",
|
|
1697
|
-
[
|
|
1698
|
-
v.StrictObjectSchema<
|
|
1699
|
-
{
|
|
1700
|
-
readonly type: v.LiteralSchema<"url", undefined>;
|
|
1701
|
-
readonly url: v.SchemaWithPipe<
|
|
1702
|
-
readonly [
|
|
1703
|
-
v.StringSchema<undefined>,
|
|
1704
|
-
v.UrlAction<string, "must be a valid URL">,
|
|
1705
|
-
v.CheckAction<string, "must be an http(s) URL">,
|
|
1706
|
-
]
|
|
1707
|
-
>;
|
|
1708
|
-
},
|
|
1709
|
-
undefined
|
|
1710
|
-
>,
|
|
1711
|
-
v.StrictObjectSchema<
|
|
1712
|
-
{
|
|
1713
|
-
readonly type: v.LiteralSchema<"field", undefined>;
|
|
1714
|
-
readonly field: v.StrictObjectSchema<
|
|
1715
|
-
{
|
|
1716
|
-
readonly scope: v.PicklistSchema<
|
|
1717
|
-
readonly ["workflow", "stage", "activity"],
|
|
1718
|
-
string
|
|
1719
|
-
>;
|
|
1720
|
-
readonly field: v.SchemaWithPipe<
|
|
1721
|
-
readonly [
|
|
1722
|
-
v.StringSchema<undefined>,
|
|
1723
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1724
|
-
]
|
|
1725
|
-
>;
|
|
1726
|
-
},
|
|
1727
|
-
undefined
|
|
1728
|
-
>;
|
|
1729
|
-
},
|
|
1730
|
-
undefined
|
|
1731
|
-
>,
|
|
1732
|
-
],
|
|
1733
|
-
undefined
|
|
1734
|
-
>;
|
|
1735
|
-
|
|
1736
|
-
declare const StoredOpSchema: v.VariantSchema<
|
|
1737
|
-
"type",
|
|
1738
|
-
[
|
|
1739
|
-
v.StrictObjectSchema<
|
|
1740
|
-
{
|
|
1741
|
-
readonly type: v.LiteralSchema<"field.set", undefined>;
|
|
1742
|
-
readonly target: v.StrictObjectSchema<
|
|
1743
|
-
{
|
|
1744
|
-
readonly scope: v.PicklistSchema<
|
|
1745
|
-
readonly ["workflow", "stage", "activity"],
|
|
1746
|
-
string
|
|
1747
|
-
>;
|
|
1748
|
-
readonly field: v.SchemaWithPipe<
|
|
1749
|
-
readonly [
|
|
1750
|
-
v.StringSchema<undefined>,
|
|
1751
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1752
|
-
]
|
|
1753
|
-
>;
|
|
1754
|
-
},
|
|
1755
|
-
undefined
|
|
1756
|
-
>;
|
|
1757
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
1758
|
-
},
|
|
1759
|
-
undefined
|
|
1760
|
-
>,
|
|
1761
|
-
v.StrictObjectSchema<
|
|
1762
|
-
{
|
|
1763
|
-
readonly type: v.LiteralSchema<"field.setIfMissing", undefined>;
|
|
1764
|
-
readonly target: v.StrictObjectSchema<
|
|
1765
|
-
{
|
|
1766
|
-
readonly scope: v.PicklistSchema<
|
|
1767
|
-
readonly ["workflow", "stage", "activity"],
|
|
1768
|
-
string
|
|
1769
|
-
>;
|
|
1770
|
-
readonly field: v.SchemaWithPipe<
|
|
1771
|
-
readonly [
|
|
1772
|
-
v.StringSchema<undefined>,
|
|
1773
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1774
|
-
]
|
|
1775
|
-
>;
|
|
1776
|
-
},
|
|
1777
|
-
undefined
|
|
1778
|
-
>;
|
|
1779
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
1780
|
-
},
|
|
1781
|
-
undefined
|
|
1782
|
-
>,
|
|
1783
|
-
v.StrictObjectSchema<
|
|
1784
|
-
{
|
|
1785
|
-
readonly type: v.LiteralSchema<"field.unset", undefined>;
|
|
1786
|
-
readonly target: v.StrictObjectSchema<
|
|
1787
|
-
{
|
|
1788
|
-
readonly scope: v.PicklistSchema<
|
|
1789
|
-
readonly ["workflow", "stage", "activity"],
|
|
1790
|
-
string
|
|
1791
|
-
>;
|
|
1792
|
-
readonly field: v.SchemaWithPipe<
|
|
1793
|
-
readonly [
|
|
1794
|
-
v.StringSchema<undefined>,
|
|
1795
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1796
|
-
]
|
|
1797
|
-
>;
|
|
1798
|
-
},
|
|
1799
|
-
undefined
|
|
1800
|
-
>;
|
|
1801
|
-
},
|
|
1802
|
-
undefined
|
|
1803
|
-
>,
|
|
1804
|
-
v.StrictObjectSchema<
|
|
1805
|
-
{
|
|
1806
|
-
readonly type: v.LiteralSchema<"field.append", undefined>;
|
|
1807
|
-
readonly target: v.StrictObjectSchema<
|
|
1808
|
-
{
|
|
1809
|
-
readonly scope: v.PicklistSchema<
|
|
1810
|
-
readonly ["workflow", "stage", "activity"],
|
|
1811
|
-
string
|
|
1812
|
-
>;
|
|
1813
|
-
readonly field: v.SchemaWithPipe<
|
|
1814
|
-
readonly [
|
|
1815
|
-
v.StringSchema<undefined>,
|
|
1816
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1817
|
-
]
|
|
1818
|
-
>;
|
|
1819
|
-
},
|
|
1820
|
-
undefined
|
|
1821
|
-
>;
|
|
1822
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
1823
|
-
},
|
|
1824
|
-
undefined
|
|
1825
|
-
>,
|
|
1826
|
-
v.StrictObjectSchema<
|
|
1827
|
-
{
|
|
1828
|
-
readonly type: v.LiteralSchema<"field.inc", undefined>;
|
|
1829
|
-
readonly target: v.StrictObjectSchema<
|
|
1830
|
-
{
|
|
1831
|
-
readonly scope: v.PicklistSchema<
|
|
1832
|
-
readonly ["workflow", "stage", "activity"],
|
|
1833
|
-
string
|
|
1834
|
-
>;
|
|
1835
|
-
readonly field: v.SchemaWithPipe<
|
|
1836
|
-
readonly [
|
|
1837
|
-
v.StringSchema<undefined>,
|
|
1838
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1839
|
-
]
|
|
1840
|
-
>;
|
|
1841
|
-
},
|
|
1842
|
-
undefined
|
|
1843
|
-
>;
|
|
1844
|
-
readonly value: v.OptionalSchema<
|
|
1845
|
-
v.GenericSchema<ValueExprInternal>,
|
|
1846
|
-
undefined
|
|
1847
|
-
>;
|
|
1848
|
-
},
|
|
1849
|
-
undefined
|
|
1850
|
-
>,
|
|
1851
|
-
v.StrictObjectSchema<
|
|
1852
|
-
{
|
|
1853
|
-
readonly type: v.LiteralSchema<"field.dec", undefined>;
|
|
1854
|
-
readonly target: v.StrictObjectSchema<
|
|
1855
|
-
{
|
|
1856
|
-
readonly scope: v.PicklistSchema<
|
|
1857
|
-
readonly ["workflow", "stage", "activity"],
|
|
1858
|
-
string
|
|
1859
|
-
>;
|
|
1860
|
-
readonly field: v.SchemaWithPipe<
|
|
1861
|
-
readonly [
|
|
1862
|
-
v.StringSchema<undefined>,
|
|
1863
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1864
|
-
]
|
|
1865
|
-
>;
|
|
1866
|
-
},
|
|
1867
|
-
undefined
|
|
1868
|
-
>;
|
|
1869
|
-
readonly value: v.OptionalSchema<
|
|
1870
|
-
v.GenericSchema<ValueExprInternal>,
|
|
1871
|
-
undefined
|
|
1872
|
-
>;
|
|
1873
|
-
},
|
|
1874
|
-
undefined
|
|
1875
|
-
>,
|
|
1876
|
-
v.StrictObjectSchema<
|
|
1877
|
-
{
|
|
1878
|
-
readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
|
|
1879
|
-
readonly target: v.StrictObjectSchema<
|
|
1880
|
-
{
|
|
1881
|
-
readonly scope: v.PicklistSchema<
|
|
1882
|
-
readonly ["workflow", "stage", "activity"],
|
|
1883
|
-
string
|
|
1884
|
-
>;
|
|
1885
|
-
readonly field: v.SchemaWithPipe<
|
|
1886
|
-
readonly [
|
|
1887
|
-
v.StringSchema<undefined>,
|
|
1888
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1889
|
-
]
|
|
1890
|
-
>;
|
|
1891
|
-
},
|
|
1892
|
-
undefined
|
|
1893
|
-
>;
|
|
1894
|
-
readonly where: v.SchemaWithPipe<
|
|
1895
|
-
readonly [
|
|
1896
|
-
v.StringSchema<undefined>,
|
|
1897
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1898
|
-
]
|
|
1899
|
-
>;
|
|
1900
|
-
readonly value: v.GenericSchema<ValueExprInternal>;
|
|
1901
|
-
},
|
|
1902
|
-
undefined
|
|
1903
|
-
>,
|
|
1904
|
-
v.StrictObjectSchema<
|
|
1905
|
-
{
|
|
1906
|
-
readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
|
|
1907
|
-
readonly target: v.StrictObjectSchema<
|
|
1908
|
-
{
|
|
1909
|
-
readonly scope: v.PicklistSchema<
|
|
1910
|
-
readonly ["workflow", "stage", "activity"],
|
|
1911
|
-
string
|
|
1912
|
-
>;
|
|
1913
|
-
readonly field: v.SchemaWithPipe<
|
|
1914
|
-
readonly [
|
|
1915
|
-
v.StringSchema<undefined>,
|
|
1916
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1917
|
-
]
|
|
1918
|
-
>;
|
|
1919
|
-
},
|
|
1920
|
-
undefined
|
|
1921
|
-
>;
|
|
1922
|
-
readonly where: v.SchemaWithPipe<
|
|
1923
|
-
readonly [
|
|
1924
|
-
v.StringSchema<undefined>,
|
|
1925
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1926
|
-
]
|
|
1927
|
-
>;
|
|
1928
|
-
},
|
|
1929
|
-
undefined
|
|
1930
|
-
>,
|
|
1931
|
-
v.StrictObjectSchema<
|
|
1932
|
-
{
|
|
1933
|
-
readonly type: v.LiteralSchema<"status.set", undefined>;
|
|
1934
|
-
readonly activity: v.SchemaWithPipe<
|
|
1935
|
-
readonly [
|
|
1936
|
-
v.StringSchema<undefined>,
|
|
1937
|
-
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
1938
|
-
]
|
|
1939
|
-
>;
|
|
1940
|
-
readonly status: v.PicklistSchema<
|
|
1941
|
-
readonly ["active", "done", "skipped", "failed"],
|
|
1942
|
-
string
|
|
1943
|
-
>;
|
|
1944
|
-
},
|
|
1945
|
-
undefined
|
|
1946
|
-
>,
|
|
1947
|
-
],
|
|
1482
|
+
>;
|
|
1483
|
+
},
|
|
1948
1484
|
undefined
|
|
1949
1485
|
>;
|
|
1950
1486
|
|
|
1951
1487
|
/**
|
|
1952
|
-
*
|
|
1953
|
-
* `
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
1959
|
-
*
|
|
1960
|
-
*
|
|
1961
|
-
*
|
|
1962
|
-
*
|
|
1488
|
+
* Child workflows created by an action's `spawn`, exposed as `$subworkflows`.
|
|
1489
|
+
* `definition` selects the highest deployed version unless a version is pinned.
|
|
1490
|
+
*
|
|
1491
|
+
* `forEach` evaluates with workflow fields only and no caller variables, even
|
|
1492
|
+
* for a caller-fired action. Rows need unique identities: a nonempty `_key`,
|
|
1493
|
+
* then `_id`, then a GDR's `id`, or a scalar's string representation.
|
|
1494
|
+
* Missing or duplicate identities reject the spawn. Re-entry adopts matching
|
|
1495
|
+
* live children from the same activity, action, and definition instead of
|
|
1496
|
+
* duplicating them.
|
|
1497
|
+
*
|
|
1498
|
+
* `with` maps child input-field names to expressions evaluated with `$row`.
|
|
1499
|
+
* `context` evaluates once without `$row` and supplies the child's `$context`.
|
|
1500
|
+
* Both use the parent activity's field scope and the acting identity when
|
|
1501
|
+
* available. Neither binds `$can`, `$attributes`, or `$params`.
|
|
1502
|
+
* Context results must be strings, numbers, booleans, or full GDRs; null and
|
|
1503
|
+
* undefined omit the entry. Other objects and arrays reject the spawn.
|
|
1504
|
+
*
|
|
1505
|
+
* `onExit` governs live children when their cohort leaves scope: `detach`
|
|
1506
|
+
* (the default) leaves them running; `abort` stops them recursively. Aborting
|
|
1507
|
+
* the parent always stops its children. Parent transitions must separately
|
|
1508
|
+
* declare whether they wait for the cohort to settle.
|
|
1509
|
+
*
|
|
1510
|
+
* @interface
|
|
1963
1511
|
*/
|
|
1964
1512
|
declare type Subworkflows = v.InferOutput<typeof SubworkflowsSchema>;
|
|
1965
1513
|
|
|
@@ -2050,37 +1598,28 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
|
|
|
2050
1598
|
* `$allActivitiesDone` — a `failed` activity blocks it permanently, surfacing
|
|
2051
1599
|
* via `$anyActivityFailed`.
|
|
2052
1600
|
*/
|
|
2053
|
-
declare
|
|
2054
|
-
"done",
|
|
2055
|
-
"skipped",
|
|
2056
|
-
"failed",
|
|
2057
|
-
];
|
|
1601
|
+
declare type TerminalActivityStatus = "done" | "skipped" | "failed";
|
|
2058
1602
|
|
|
2059
|
-
|
|
2060
|
-
(typeof TERMINAL_ACTIVITY_STATUSES)[number];
|
|
2061
|
-
|
|
2062
|
-
/** Ad-hoc, status-tracked work items: sugar over `array of object {label, status, assignee?, dueDate?}`; a plain checklist is that with `{label, status}` alone.
|
|
2063
|
-
* Its `dueDate` is a `date` column named `dueDate`, not the elevated `dueDate` kind, which reserves one deadline slot per level. Never a stored kind. */
|
|
1603
|
+
/** @inline */
|
|
2064
1604
|
declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
2065
1605
|
type: "todoList";
|
|
2066
1606
|
};
|
|
2067
1607
|
|
|
2068
1608
|
/**
|
|
2069
|
-
* A
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
2075
|
-
* stage
|
|
2076
|
-
*
|
|
1609
|
+
* A one-way route to another stage, without operations or effects. Selection
|
|
1610
|
+
* checks `when` conditions in declaration order. The first satisfied condition
|
|
1611
|
+
* fires; an earlier unevaluable condition, such as GROQ null, stops selection
|
|
1612
|
+
* without considering later routes. A false condition permits the next route.
|
|
1613
|
+
*
|
|
1614
|
+
* Actions write routing decisions into fields; transitions read that state.
|
|
1615
|
+
* Source-stage triggered actions run before transition selection. Arrival work
|
|
1616
|
+
* belongs to a triggered action in a nonterminal destination stage.
|
|
2077
1617
|
*/
|
|
2078
1618
|
declare type Transition = TransitionFields & {
|
|
2079
1619
|
when: string;
|
|
2080
1620
|
};
|
|
2081
1621
|
|
|
2082
|
-
/**
|
|
2083
|
-
* authoring omits it (desugar fills the default), so each variant declares it. */
|
|
1622
|
+
/** @inline */
|
|
2084
1623
|
declare type TransitionFields = {
|
|
2085
1624
|
name: string;
|
|
2086
1625
|
title?: string | undefined;
|
|
@@ -2088,6 +1627,23 @@ declare type TransitionFields = {
|
|
|
2088
1627
|
to: string;
|
|
2089
1628
|
};
|
|
2090
1629
|
|
|
1630
|
+
/**
|
|
1631
|
+
* An operation's write value, resolved when the operation applies.
|
|
1632
|
+
* `param` reads a caller-supplied action argument; `actor` records the acting
|
|
1633
|
+
* identity. `now` supplies the operation's ISO timestamp, `self` its instance's
|
|
1634
|
+
* GDR URI, and `stage` the current stage name. `object` resolves its fields
|
|
1635
|
+
* recursively.
|
|
1636
|
+
*
|
|
1637
|
+
* A `fieldRead` with no scope searches activity, stage, then workflow fields.
|
|
1638
|
+
* An explicit scope searches only that scope. A pathless read from a subject
|
|
1639
|
+
* or `doc.ref` into another subject or `doc.ref` preserves the stored reference.
|
|
1640
|
+
* Other reads use the referenced snapshot document, or only its `_id` and
|
|
1641
|
+
* `_type` when it is not loaded. No additional documents are fetched.
|
|
1642
|
+
* Initialization uses {@link FieldSource}, whose field-read scope rules differ.
|
|
1643
|
+
*/
|
|
1644
|
+
declare type ValueExpr = ValueExprInternal;
|
|
1645
|
+
|
|
1646
|
+
/** @inline */
|
|
2091
1647
|
declare type ValueExprInternal =
|
|
2092
1648
|
| LiteralExpr
|
|
2093
1649
|
| FieldReadExpr
|
|
@@ -2112,8 +1668,6 @@ declare type ValueExprInternal =
|
|
|
2112
1668
|
fields: Record<string, ValueExprInternal>;
|
|
2113
1669
|
};
|
|
2114
1670
|
|
|
2115
|
-
declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
|
|
2116
|
-
|
|
2117
1671
|
/**
|
|
2118
1672
|
* `deployments` names must be unique (the selector deployment-targeted
|
|
2119
1673
|
* commands resolve by), and each `(workflowResource, tag)` pair must be
|
|
@@ -2123,6 +1677,8 @@ declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
|
|
|
2123
1677
|
* logger unconditionally (CI and `DO_NOT_TRACK` included), and consent,
|
|
2124
1678
|
* environment suppression, and transport become this implementation's
|
|
2125
1679
|
* business.
|
|
1680
|
+
*
|
|
1681
|
+
* @interface
|
|
2126
1682
|
*/
|
|
2127
1683
|
declare type WorkflowConfig = v.InferOutput<typeof WorkflowConfigSchema>;
|
|
2128
1684
|
|
|
@@ -2396,44 +1952,22 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2396
1952
|
readonly [
|
|
2397
1953
|
v.ArraySchema<
|
|
2398
1954
|
v.CustomSchema<
|
|
2399
|
-
|
|
2400
|
-
name: string;
|
|
2401
|
-
semantics?: Semantic[] | undefined;
|
|
2402
|
-
title: string;
|
|
2403
|
-
description?: string | undefined;
|
|
2404
|
-
groups?: Group[] | undefined;
|
|
2405
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2406
|
-
start?: StartBlock | undefined;
|
|
2407
|
-
initialStage: string;
|
|
2408
|
-
fields?: FieldEntry[] | undefined;
|
|
2409
|
-
stages: Stage[];
|
|
2410
|
-
predicates?: Record<string, string> | undefined;
|
|
2411
|
-
roleAliases?: RoleAliases | undefined;
|
|
2412
|
-
},
|
|
1955
|
+
DefinedWorkflow,
|
|
2413
1956
|
v.ErrorMessage<v.CustomIssue> | undefined
|
|
2414
1957
|
>,
|
|
2415
1958
|
undefined
|
|
2416
1959
|
>,
|
|
2417
1960
|
v.MinLengthAction<
|
|
2418
|
-
|
|
2419
|
-
name: string;
|
|
2420
|
-
semantics?: Semantic[] | undefined;
|
|
2421
|
-
title: string;
|
|
2422
|
-
description?: string | undefined;
|
|
2423
|
-
groups?: Group[] | undefined;
|
|
2424
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2425
|
-
start?: StartBlock | undefined;
|
|
2426
|
-
initialStage: string;
|
|
2427
|
-
fields?: FieldEntry[] | undefined;
|
|
2428
|
-
stages: Stage[];
|
|
2429
|
-
predicates?: Record<string, string> | undefined;
|
|
2430
|
-
roleAliases?: RoleAliases | undefined;
|
|
2431
|
-
}[],
|
|
1961
|
+
DefinedWorkflow[],
|
|
2432
1962
|
1,
|
|
2433
1963
|
"a deployment needs at least one definition"
|
|
2434
1964
|
>,
|
|
2435
1965
|
]
|
|
2436
1966
|
>;
|
|
1967
|
+
readonly runtime: v.OptionalSchema<
|
|
1968
|
+
v.GenericSchema<RuntimeBlock>,
|
|
1969
|
+
undefined
|
|
1970
|
+
>;
|
|
2437
1971
|
},
|
|
2438
1972
|
undefined
|
|
2439
1973
|
>,
|
|
@@ -2483,20 +2017,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2483
2017
|
};
|
|
2484
2018
|
}[]
|
|
2485
2019
|
| undefined;
|
|
2486
|
-
definitions:
|
|
2487
|
-
|
|
2488
|
-
semantics?: Semantic[] | undefined;
|
|
2489
|
-
title: string;
|
|
2490
|
-
description?: string | undefined;
|
|
2491
|
-
groups?: Group[] | undefined;
|
|
2492
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2493
|
-
start?: StartBlock | undefined;
|
|
2494
|
-
initialStage: string;
|
|
2495
|
-
fields?: FieldEntry[] | undefined;
|
|
2496
|
-
stages: Stage[];
|
|
2497
|
-
predicates?: Record<string, string> | undefined;
|
|
2498
|
-
roleAliases?: RoleAliases | undefined;
|
|
2499
|
-
}[];
|
|
2020
|
+
definitions: DefinedWorkflow[];
|
|
2021
|
+
runtime?: RuntimeBlock | undefined;
|
|
2500
2022
|
}[],
|
|
2501
2023
|
1,
|
|
2502
2024
|
"a config needs at least one deployment"
|
|
@@ -2545,20 +2067,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2545
2067
|
};
|
|
2546
2068
|
}[]
|
|
2547
2069
|
| undefined;
|
|
2548
|
-
definitions:
|
|
2549
|
-
|
|
2550
|
-
semantics?: Semantic[] | undefined;
|
|
2551
|
-
title: string;
|
|
2552
|
-
description?: string | undefined;
|
|
2553
|
-
groups?: Group[] | undefined;
|
|
2554
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2555
|
-
start?: StartBlock | undefined;
|
|
2556
|
-
initialStage: string;
|
|
2557
|
-
fields?: FieldEntry[] | undefined;
|
|
2558
|
-
stages: Stage[];
|
|
2559
|
-
predicates?: Record<string, string> | undefined;
|
|
2560
|
-
roleAliases?: RoleAliases | undefined;
|
|
2561
|
-
}[];
|
|
2070
|
+
definitions: DefinedWorkflow[];
|
|
2071
|
+
runtime?: RuntimeBlock | undefined;
|
|
2562
2072
|
}[],
|
|
2563
2073
|
(
|
|
2564
2074
|
issue: v.CheckIssue<
|
|
@@ -2605,20 +2115,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2605
2115
|
};
|
|
2606
2116
|
}[]
|
|
2607
2117
|
| undefined;
|
|
2608
|
-
definitions:
|
|
2609
|
-
|
|
2610
|
-
semantics?: Semantic[] | undefined;
|
|
2611
|
-
title: string;
|
|
2612
|
-
description?: string | undefined;
|
|
2613
|
-
groups?: Group[] | undefined;
|
|
2614
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2615
|
-
start?: StartBlock | undefined;
|
|
2616
|
-
initialStage: string;
|
|
2617
|
-
fields?: FieldEntry[] | undefined;
|
|
2618
|
-
stages: Stage[];
|
|
2619
|
-
predicates?: Record<string, string> | undefined;
|
|
2620
|
-
roleAliases?: RoleAliases | undefined;
|
|
2621
|
-
}[];
|
|
2118
|
+
definitions: DefinedWorkflow[];
|
|
2119
|
+
runtime?: RuntimeBlock | undefined;
|
|
2622
2120
|
}[]
|
|
2623
2121
|
>,
|
|
2624
2122
|
) => string
|
|
@@ -2667,20 +2165,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2667
2165
|
};
|
|
2668
2166
|
}[]
|
|
2669
2167
|
| undefined;
|
|
2670
|
-
definitions:
|
|
2671
|
-
|
|
2672
|
-
semantics?: Semantic[] | undefined;
|
|
2673
|
-
title: string;
|
|
2674
|
-
description?: string | undefined;
|
|
2675
|
-
groups?: Group[] | undefined;
|
|
2676
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2677
|
-
start?: StartBlock | undefined;
|
|
2678
|
-
initialStage: string;
|
|
2679
|
-
fields?: FieldEntry[] | undefined;
|
|
2680
|
-
stages: Stage[];
|
|
2681
|
-
predicates?: Record<string, string> | undefined;
|
|
2682
|
-
roleAliases?: RoleAliases | undefined;
|
|
2683
|
-
}[];
|
|
2168
|
+
definitions: DefinedWorkflow[];
|
|
2169
|
+
runtime?: RuntimeBlock | undefined;
|
|
2684
2170
|
}[],
|
|
2685
2171
|
(
|
|
2686
2172
|
issue: v.CheckIssue<
|
|
@@ -2727,20 +2213,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2727
2213
|
};
|
|
2728
2214
|
}[]
|
|
2729
2215
|
| undefined;
|
|
2730
|
-
definitions:
|
|
2731
|
-
|
|
2732
|
-
semantics?: Semantic[] | undefined;
|
|
2733
|
-
title: string;
|
|
2734
|
-
description?: string | undefined;
|
|
2735
|
-
groups?: Group[] | undefined;
|
|
2736
|
-
lifecycle?: WorkflowLifecycle | undefined;
|
|
2737
|
-
start?: StartBlock | undefined;
|
|
2738
|
-
initialStage: string;
|
|
2739
|
-
fields?: FieldEntry[] | undefined;
|
|
2740
|
-
stages: Stage[];
|
|
2741
|
-
predicates?: Record<string, string> | undefined;
|
|
2742
|
-
roleAliases?: RoleAliases | undefined;
|
|
2743
|
-
}[];
|
|
2216
|
+
definitions: DefinedWorkflow[];
|
|
2217
|
+
runtime?: RuntimeBlock | undefined;
|
|
2744
2218
|
}[]
|
|
2745
2219
|
>,
|
|
2746
2220
|
) => string
|
|
@@ -2772,26 +2246,13 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2772
2246
|
* conditions — each `name: groq` entry is pre-evaluated and bound as the
|
|
2773
2247
|
* boolean `$name` var; redefining a built-in var is a deploy error, never a
|
|
2774
2248
|
* silent shadow.
|
|
2249
|
+
*
|
|
2250
|
+
* @interface
|
|
2775
2251
|
*/
|
|
2776
2252
|
declare type WorkflowDefinition = v.InferOutput<
|
|
2777
2253
|
typeof WorkflowDefinitionSchema
|
|
2778
2254
|
>;
|
|
2779
2255
|
|
|
2780
|
-
/**
|
|
2781
|
-
* Structural schema for a STORED workflow definition — primitives only,
|
|
2782
|
-
* every reference scope resolved. Cross-field invariants (unique names,
|
|
2783
|
-
* transition targets, effect-name uniqueness, predicate shadowing) are
|
|
2784
|
-
* checked by `checkWorkflowInvariants` after desugar — see `defineWorkflow`.
|
|
2785
|
-
* Carries NO `version`: a definition's version and content fingerprint are
|
|
2786
|
-
* stamped onto the deployed document at deploy time, derived from the
|
|
2787
|
-
* content itself, so redeploying identical content is a no-op and any
|
|
2788
|
-
* change mints the next version.
|
|
2789
|
-
*
|
|
2790
|
-
* Exported (module-level, not package API) for the model-surface gate's
|
|
2791
|
-
* coverage test and for `parseStoredDefinition` — the boundary parse for a
|
|
2792
|
-
* definition that did not come out of `defineWorkflow` in-process; trusted
|
|
2793
|
-
* in-process desugar output is never re-parsed.
|
|
2794
|
-
*/
|
|
2795
2256
|
declare const WorkflowDefinitionSchema: v.GenericSchema<
|
|
2796
2257
|
WorkflowFields<FieldEntry, Stage, StartBlock>
|
|
2797
2258
|
>;
|
|
@@ -2803,10 +2264,22 @@ declare const WorkflowDefinitionSchema: v.GenericSchema<
|
|
|
2803
2264
|
declare type WorkflowDeployment = WorkflowConfig["deployments"][number];
|
|
2804
2265
|
|
|
2805
2266
|
/**
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
*
|
|
2267
|
+
* Author one deployment with a nonempty `definitions` array and a
|
|
2268
|
+
* {@link WorkflowResource}. Dataset resource IDs use `<projectId>.<dataset>`.
|
|
2269
|
+
*
|
|
2270
|
+
* `name` and `tag` must contain only ASCII lowercase letters, digits, and dashes,
|
|
2271
|
+
* starting with a letter or digit. Deployment names and `(workflowResource, tag)`
|
|
2272
|
+
* pairs must be unique across the config. Optional `resourceAliases` use the same
|
|
2273
|
+
* name grammar, with unique names within this deployment.
|
|
2274
|
+
*
|
|
2275
|
+
* `expectedMinReaderModel` is the highest reader model you have verified across
|
|
2276
|
+
* runtimes sharing the workflow resource. Supply a reviewed numeric literal.
|
|
2277
|
+
* Definition submission checks it against the required reader floor; upgrading
|
|
2278
|
+
* a dependency alone does not require changing it.
|
|
2279
|
+
*
|
|
2280
|
+
* `runtime` is the default hosting kind for this deployment's workflows, which
|
|
2281
|
+
* each workflow and effect may override. Omitted, its workflows host on
|
|
2282
|
+
* `'function'`.
|
|
2810
2283
|
*/
|
|
2811
2284
|
declare type WorkflowDeploymentInput = Omit<
|
|
2812
2285
|
WorkflowDeployment,
|
|
@@ -2815,7 +2288,7 @@ declare type WorkflowDeploymentInput = Omit<
|
|
|
2815
2288
|
expectedMinReaderModel: number;
|
|
2816
2289
|
};
|
|
2817
2290
|
|
|
2818
|
-
/**
|
|
2291
|
+
/** @inline */
|
|
2819
2292
|
declare type WorkflowFields<TField, TStage, TStart> = {
|
|
2820
2293
|
name: string;
|
|
2821
2294
|
semantics?: Semantic[] | undefined;
|
|
@@ -2834,7 +2307,7 @@ declare type WorkflowFields<TField, TStage, TStart> = {
|
|
|
2834
2307
|
/** How instances of a definition come to exist: started standalone (the
|
|
2835
2308
|
* default) or spawned by a parent. `'child'` is spawn-only — see
|
|
2836
2309
|
* {@link isStartableDefinition}. */
|
|
2837
|
-
declare type WorkflowLifecycle =
|
|
2310
|
+
declare type WorkflowLifecycle = "standalone" | "child";
|
|
2838
2311
|
|
|
2839
2312
|
/**
|
|
2840
2313
|
* A telemetry event descriptor — a structural mirror of `@sanity/telemetry`'s
|