@sanity/workflow-engine 0.30.0 → 0.32.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/dist/define.d.ts CHANGED
@@ -14,13 +14,14 @@ 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
20
  declare type Action = ActionFields<Op, string[]> & {
19
21
  roles?: string[] | undefined;
20
22
  };
21
23
 
22
- /** Type-mirror of {@link actionFields}, parameterised over the op and
23
- * group-membership grammars. */
24
+ /** @inline */
24
25
  declare type ActionFields<TOp, TGroup> = {
25
26
  name: string;
26
27
  semantics?: ActionSemantic[] | undefined;
@@ -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
- /** Type-mirror of {@link activityFields}, parameterised over field/action/target/group. */
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
- * The stored action fields plus two authoring sugars, or the
213
- * {@link ClaimAction} pair-half. `roles`: on a fireAction-fired action (no
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 | ClaimAction;
235
+ declare type AuthoringAction = AuthoringRawAction;
224
236
 
237
+ /** @interface */
225
238
  declare type AuthoringActivity = ActivityFields<
226
239
  AuthoringFieldEntry,
227
240
  AuthoringAction,
@@ -235,38 +248,27 @@ 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 = v.InferOutput<typeof AuthoringEditableSchema>;
239
-
240
- declare const AuthoringEditableSchema: v.UnionSchema<
241
- [
242
- v.LiteralSchema<true, undefined>,
243
- v.ArraySchema<
244
- v.SchemaWithPipe<
245
- readonly [
246
- v.StringSchema<undefined>,
247
- v.MinLengthAction<string, 1, "must be a non-empty string">,
248
- ]
249
- >,
250
- undefined
251
- >,
252
- v.SchemaWithPipe<
253
- readonly [
254
- v.StringSchema<undefined>,
255
- v.MinLengthAction<string, 1, "must be a non-empty string">,
256
- ]
257
- >,
258
- ],
259
- undefined
260
- >;
251
+ declare type AuthoringEditable = true | string[] | string;
261
252
 
253
+ /**
254
+ * A raw field entry or one of the authoring-only field sugars. `todoList`
255
+ * expands to an array of objects with `label`, `status`, optional `assignee`,
256
+ * and optional `dueDate`; that due date remains an ordinary date field.
257
+ * `notes` expands to an array of audit-shaped objects with `body`, `actor`,
258
+ * and `at` fields. Sugar type names are compiled away and never become stored
259
+ * field kinds.
260
+ */
262
261
  declare type AuthoringFieldEntry =
263
262
  | AuthoringRawFieldEntry
264
- | ClaimField
265
263
  | TodoListField
266
264
  | NotesField;
267
265
 
268
- /** A field reference with `scope` optional; desugar resolves it lexically
269
- * (activity stage workflow) into {@link StoredFieldRef}. */
266
+ /**
267
+ * A field reference with `scope` optional; desugar resolves it lexically
268
+ * (activity → stage → workflow) into {@link StoredFieldRef}.
269
+ *
270
+ * @interface
271
+ */
270
272
  declare type AuthoringFieldRef = v.InferOutput<typeof AuthoringFieldRefSchema>;
271
273
 
272
274
  declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
@@ -285,8 +287,12 @@ declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
285
287
  undefined
286
288
  >;
287
289
 
288
- /** {@link Guard}'s contract as authored: `match.idRefs` and `metadata` carry
289
- * typed {@link GuardRead} values that deploy resolves to bare ones. */
290
+ /**
291
+ * {@link Guard}'s contract as authored: `match.idRefs` and `metadata` carry
292
+ * typed {@link GuardRead} values that deploy resolves to bare ones.
293
+ *
294
+ * @interface
295
+ */
290
296
  declare type AuthoringGuard = v.InferOutput<typeof AuthoringGuardSchema>;
291
297
 
292
298
  declare const AuthoringGuardSchema: v.StrictObjectSchema<
@@ -314,105 +320,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
314
320
  undefined
315
321
  >;
316
322
  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
- >,
323
+ v.ArraySchema<v.GenericSchema<GuardRead>, undefined>,
416
324
  undefined
417
325
  >;
418
326
  idPatterns: v.OptionalSchema<
@@ -455,99 +363,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
455
363
  v.MinLengthAction<string, 1, "must be a non-empty string">,
456
364
  ]
457
365
  >,
458
- v.VariantSchema<
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
- >,
366
+ v.GenericSchema<GuardRead>,
551
367
  undefined
552
368
  >,
553
369
  undefined
@@ -558,373 +374,52 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
558
374
 
559
375
  /** Like {@link ManualTarget}, but the `field` variant also accepts a bare
560
376
  * field name; desugar normalises it into {@link AuthoringFieldRef}. */
561
- declare type AuthoringManualTarget = v.InferOutput<
562
- typeof AuthoringManualTargetSchema
563
- >;
564
-
565
- declare const AuthoringManualTargetSchema: v.VariantSchema<
566
- "type",
567
- [
568
- v.StrictObjectSchema<
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
- >;
377
+ declare type AuthoringManualTarget =
378
+ | {
379
+ type: "url";
380
+ url: string;
381
+ }
382
+ | {
383
+ type: "field";
384
+ field: string | AuthoringFieldRef;
385
+ };
619
386
 
620
387
  /** Like {@link Op}, plus: `status.set`'s `activity` is optional (desugar fills
621
388
  * the firing activity), and the `audit` sugar — a stamped append merging
622
- * `actor`/`at` {@link ValueExpr} fields into its own value. */
623
- declare type AuthoringOp = v.InferOutput<typeof AuthoringOpSchema>;
624
-
625
- declare const AuthoringOpSchema: v.VariantSchema<
626
- "type",
627
- [
628
- v.StrictObjectSchema<
629
- {
630
- readonly type: v.LiteralSchema<"field.set", undefined>;
631
- readonly target: v.StrictObjectSchema<
632
- {
633
- readonly scope: v.OptionalSchema<
634
- v.PicklistSchema<
635
- readonly ["workflow", "stage", "activity"],
636
- string
637
- >,
638
- undefined
639
- >;
640
- readonly field: v.SchemaWithPipe<
641
- readonly [
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
- >;
389
+ * `actor`/`at` {@link ValueExpr} fields into its own value.
390
+ */
391
+ declare type AuthoringOp =
392
+ | FieldMutationOp<AuthoringFieldRef>
393
+ | {
394
+ type: "status.set";
395
+ activity?: string | undefined;
396
+ status: ActivityStatus;
397
+ }
398
+ | {
399
+ type: "audit";
400
+ target: AuthoringFieldRef;
401
+ value: ValueExpr;
402
+ stampFields?:
403
+ | {
404
+ actor?: string | undefined;
405
+ at?: string | undefined;
406
+ }
407
+ | undefined;
408
+ };
917
409
 
410
+ /** @inline */
918
411
  declare type AuthoringRawAction = ActionFields<AuthoringOp, GroupMembership> & {
919
412
  roles?: string[] | undefined;
920
413
  status?: TerminalActivityStatus | undefined;
921
414
  };
922
415
 
416
+ /** @inline */
923
417
  declare type AuthoringRawFieldEntry = FieldEntryFields<
924
418
  AuthoringEditable,
925
419
  GroupMembership
926
420
  >;
927
421
 
422
+ /** @interface */
928
423
  declare type AuthoringStage = StageFields<
929
424
  AuthoringFieldEntry,
930
425
  AuthoringActivity,
@@ -946,7 +441,11 @@ declare type AuthoringTransition = TransitionFields & {
946
441
  when?: string | undefined;
947
442
  };
948
443
 
949
- /** The authoring surface: stored primitives plus the define-time sugar. */
444
+ /**
445
+ * The authoring surface: stored primitives plus the define-time sugar.
446
+ *
447
+ * @interface
448
+ */
950
449
  declare type AuthoringWorkflow = WorkflowFields<
951
450
  AuthoringFieldEntry,
952
451
  AuthoringStage,
@@ -959,35 +458,22 @@ declare interface ChoiceOption {
959
458
  }
960
459
 
961
460
  declare interface ChoiceOptions {
962
- list: ChoiceOption[];
963
- }
964
-
965
- declare type ChoiceValue = string | number;
966
-
967
- /** The action half of the mirrored claim pair: `field` names the actor-valued entry this action claims, resolved lexically, and the expansion
968
- * adds a no-steal `!defined($fields.<field>)` filter ANDed with `roles`/`filter` plus a `field.set` ← actor op. `ops`/`status` are reserved (strictObject rejects them). */
969
- declare type ClaimAction = {
970
- type: "claim";
971
- name: string;
972
- title?: string | undefined;
973
- description?: string | undefined;
974
- group?: GroupMembership | undefined;
975
- field: string | AuthoringFieldRef;
976
- roles?: string[] | undefined;
977
- filter?: string | undefined;
978
- params?: ActionParam[] | undefined;
979
- effects?: Effect[] | undefined;
980
- };
461
+ list: ChoiceOption[];
462
+ }
981
463
 
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
- };
464
+ declare type ChoiceValue = string | number;
465
+
466
+ /**
467
+ * A raw GROQ string evaluated over the rendered scope: the engine-bound
468
+ * variables inventoried in {@link CONDITION_VARS} (each annotated with the
469
+ * context that binds it) plus the author's nullary `predicates` as `$<name>`
470
+ * booleans. Evaluation runs against the instance's in-memory snapshot —
471
+ * never a `_type` scan over the lake (rejected at deploy).
472
+ *
473
+ * There is no `{ref, args}` wrapper: parameterized reuse is a define-time
474
+ * TypeScript function producing a condition string (see the {@link define.groq | groq} tag).
475
+ */
476
+ declare type Condition = string;
991
477
 
992
478
  /**
993
479
  * Every variable the engine binds for the RENDERED condition scope (every
@@ -1100,7 +586,7 @@ export declare function defineWorkflow(
1100
586
  * Validate a deploy config — the binding of each definition's logical resource
1101
587
  * handles to physical resources, per environment (tag). Throws a formatted,
1102
588
  * path-prefixed error if the shape is invalid. The CLI collapses the selected
1103
- * deployment's bindings via {@link resourceAliasesToMap} into the
589
+ * deployment's bindings via {@link index.resourceAliasesToMap | resourceAliasesToMap} into the
1104
590
  * `resourceAliases` map `deployDefinitions` expands against.
1105
591
  *
1106
592
  * Validates shape only; reader-floor acknowledgement belongs to paths that
@@ -1125,7 +611,7 @@ export declare function defineWorkflowConfig(
1125
611
  * to decide who-may-edit. ADVISORY like every engine gate — it disables the
1126
612
  * inline field and explains; a {@link Guard} declares the intended write-lock.
1127
613
  */
1128
- declare type Editable = v.InferOutput<typeof StoredEditableSchema>;
614
+ declare type Editable = true | string;
1129
615
 
1130
616
  /**
1131
617
  * A registered effect: `name` is its only identity (unique per definition,
@@ -1138,6 +624,8 @@ declare type Editable = v.InferOutput<typeof StoredEditableSchema>;
1138
624
  * completion and nothing is stored. Omitting `outputs` is an EMPTY allowlist,
1139
625
  * so ANY returned output is rejected and fails the completion — the bound is
1140
626
  * universal, not opt-in.
627
+ *
628
+ * @interface
1141
629
  */
1142
630
  declare type Effect = v.InferOutput<typeof EffectSchema>;
1143
631
 
@@ -1232,8 +720,7 @@ declare const FIELD_VALUE_KINDS: readonly [
1232
720
  "array",
1233
721
  ];
1234
722
 
1235
- /** Type-mirror of {@link fieldBase}, parameterised over the `editable` and
1236
- * `group` grammars (stored membership is the canonical list form). */
723
+ /** @inline */
1237
724
  declare type FieldBase<TEditable, TGroup> = {
1238
725
  name: string;
1239
726
  title?: string | undefined;
@@ -1244,11 +731,14 @@ declare type FieldBase<TEditable, TGroup> = {
1244
731
  editable?: TEditable | undefined;
1245
732
  };
1246
733
 
1247
- /** One declared field entry as authored and stored: name, value kind, and its scope's sourcing and editability. */
734
+ /**
735
+ * One declared field entry as authored and stored: name, value kind, and its scope's sourcing and editability.
736
+ *
737
+ * @interface
738
+ */
1248
739
  declare type FieldEntry = FieldEntryFields<Editable, string[]>;
1249
740
 
1250
- /** Type-mirror of {@link fieldEntryFields}: a raw field entry of the given
1251
- * editability and group-membership grammars. */
741
+ /** @inline */
1252
742
  declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
1253
743
  TEditable,
1254
744
  TGroup
@@ -1263,6 +753,60 @@ declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
1263
753
  of?: FieldShape[] | undefined;
1264
754
  };
1265
755
 
756
+ /** A field mutation targeting the supplied field-reference shape. */
757
+ declare type FieldMutationOp<
758
+ TTarget extends {
759
+ field: string;
760
+ },
761
+ > =
762
+ | {
763
+ type: "field.set";
764
+ target: TTarget;
765
+ value: ValueExpr;
766
+ }
767
+ | {
768
+ type: "field.setIfMissing";
769
+ target: TTarget;
770
+ value: ValueExpr;
771
+ }
772
+ | {
773
+ type: "field.unset";
774
+ target: TTarget;
775
+ }
776
+ | {
777
+ type: "field.append";
778
+ target: TTarget;
779
+ value: ValueExpr;
780
+ }
781
+ | {
782
+ type: "field.inc";
783
+ target: TTarget;
784
+ value?: ValueExpr | undefined;
785
+ }
786
+ | {
787
+ type: "field.dec";
788
+ target: TTarget;
789
+ value?: ValueExpr | undefined;
790
+ }
791
+ | {
792
+ type: "field.updateWhere";
793
+ target: TTarget;
794
+ where: Condition;
795
+ value: ValueExpr;
796
+ }
797
+ | {
798
+ type: "field.removeWhere";
799
+ target: TTarget;
800
+ where: Condition;
801
+ };
802
+
803
+ /**
804
+ * A stored field mutation. `field.inc` and `field.dec` use the same names as
805
+ * `@sanity/client` patches and default an omitted `value` to a delta of `1`.
806
+ */
807
+ declare type FieldOp = FieldMutationOp<StoredFieldRef>;
808
+
809
+ /** @inline */
1266
810
  declare type FieldReadExpr = {
1267
811
  type: "fieldRead";
1268
812
  scope?: "workflow" | "stage" | undefined;
@@ -1300,6 +844,7 @@ declare interface FieldShape {
1300
844
  */
1301
845
  declare type FieldSource = FieldSourceInternal;
1302
846
 
847
+ /** @inline */
1303
848
  declare type FieldSourceInternal =
1304
849
  | {
1305
850
  type: "input";
@@ -1388,25 +933,11 @@ declare type GroupKind = (typeof GROUP_KINDS)[number];
1388
933
  declare type GroupMembership = string | string[];
1389
934
 
1390
935
  /**
1391
- * A lake mutation guard. A FOREIGN CONTRACT mirrored 1:1: `match`,
1392
- * `predicate`, and `metadata` are the content lake's persisted guard-document
1393
- * API, not engine-invented surface — the stored form keeps the lake's
1394
- * vocabulary verbatim. The engine adds exactly two things: `name` (a
1395
- * lake-id-segment, `^[a-z0-9][a-z0-9-]*$`, unique per definition — the lake
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.
936
+ * A stored workflow guard. Its string reads and authored lifecycle actions
937
+ * remain unresolved until stage entry produces the Lake-shaped documents
938
+ * deployed for that stage.
939
+ *
940
+ * @interface
1410
941
  */
1411
942
  declare type Guard = v.InferOutput<typeof GuardSchema>;
1412
943
 
@@ -1414,14 +945,43 @@ declare type Guard = v.InferOutput<typeof GuardSchema>;
1414
945
  * The identifiers a lake mutation guard's `predicate` reads — the wire
1415
946
  * dialect, not the condition scope (so no {@link ConditionVarBinding}: these
1416
947
  * bind only when a guard evaluates a mutation). `before()`/`after()`/
1417
- * `identity()` are groq-js delta-mode natives on top of these. Bound in one
1418
- * place: `guardPredicateParams` in the guard evaluator.
948
+ * `identity()` are groq-js delta-mode natives on top of these. The guard
949
+ * evaluator must bind every entry here at the predicate root.
1419
950
  */
1420
951
  export declare const GUARD_PREDICATE_VARS: readonly {
1421
952
  name: string;
1422
953
  description: string;
1423
954
  }[];
1424
955
 
956
+ /**
957
+ * A deploy-time value read on a guard's `match.idRefs` / `metadata`, typed
958
+ * like {@link ValueExpr} (`self`/`now`/`fieldRead`, plus the guard-only
959
+ * `effectsRead` for a completed effect's output). Workflow-scope only — a
960
+ * guard outlives any activity, so `fieldRead` here carries no `scope`.
961
+ * Desugar prints the STORED string spelling the deploy resolver and guard
962
+ * refresh parse (`"$self"`, `"$now"`, `"$fields.<name>[.path]"`,
963
+ * `"$effects['<name>'][.path]"`); those spellings are single-line strings
964
+ * matched by anchored regexes, so a line break in a path would print an
965
+ * unparseable read.
966
+ */
967
+ declare type GuardRead =
968
+ | {
969
+ type: "self";
970
+ }
971
+ | {
972
+ type: "now";
973
+ }
974
+ | {
975
+ type: "fieldRead";
976
+ field: string;
977
+ path?: string | undefined;
978
+ }
979
+ | {
980
+ type: "effectsRead";
981
+ effect: string;
982
+ path?: string | undefined;
983
+ };
984
+
1425
985
  declare const GuardSchema: v.StrictObjectSchema<
1426
986
  {
1427
987
  name: v.SchemaWithPipe<
@@ -1470,21 +1030,12 @@ declare const GuardSchema: v.StrictObjectSchema<
1470
1030
  >,
1471
1031
  undefined
1472
1032
  >;
1473
- actions: v.SchemaWithPipe<
1474
- readonly [
1475
- v.ArraySchema<
1476
- v.PicklistSchema<
1477
- readonly ["create", "update", "delete", "publish", "unpublish"],
1478
- string
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
- ]
1033
+ actions: v.ArraySchema<
1034
+ v.PicklistSchema<
1035
+ readonly ["create", "update", "delete", "publish", "unpublish"],
1036
+ string
1037
+ >,
1038
+ undefined
1488
1039
  >;
1489
1040
  },
1490
1041
  undefined
@@ -1512,6 +1063,7 @@ declare const GuardSchema: v.StrictObjectSchema<
1512
1063
  undefined
1513
1064
  >;
1514
1065
 
1066
+ /** @inline */
1515
1067
  declare type LiteralExpr = {
1516
1068
  type: "literal";
1517
1069
  value: unknown;
@@ -1523,18 +1075,32 @@ declare type LiteralExpr = {
1523
1075
  * reference whose resolved document the consumer opens; deploy checks the
1524
1076
  * `field` variant points at a doc-valued entry.
1525
1077
  */
1526
- declare type ManualTarget = v.InferOutput<typeof StoredManualTargetSchema>;
1078
+ declare type ManualTarget =
1079
+ | {
1080
+ type: "url";
1081
+ url: string;
1082
+ }
1083
+ | {
1084
+ type: "field";
1085
+ field: StoredFieldRef;
1086
+ };
1527
1087
 
1528
- /** An append-only audit/comment log: sugar over `array of object {body, actor, at}` — the `actor`/`at`
1529
- * names match the `audit` op's stamp fields, so it pairs with it. Never a stored kind. */
1088
+ /** @inline */
1530
1089
  declare type NotesField = FieldBase<AuthoringEditable, GroupMembership> & {
1531
1090
  type: "notes";
1532
1091
  };
1533
1092
 
1534
1093
  /** A `field.updateWhere` / `field.removeWhere` op's `where` selects rows to
1535
1094
  * mutate with rendered-scope GROQ (`$row`, `$params` bound) — row selection, not a gate; an unevaluable row never matches. */
1536
- declare type Op = v.InferOutput<typeof StoredOpSchema>;
1095
+ declare type Op =
1096
+ | FieldOp
1097
+ | {
1098
+ type: "status.set";
1099
+ activity: string;
1100
+ status: ActivityStatus;
1101
+ };
1537
1102
 
1103
+ /** @inline */
1538
1104
  declare type RequirementBase = {
1539
1105
  name: string;
1540
1106
  title?: string | undefined;
@@ -1556,35 +1122,7 @@ export declare const RESERVED_CONDITION_VARS: readonly string[];
1556
1122
  * literal ownership values and are not widened by this map. The authored `"*"`
1557
1123
  * key lists universal fulfillers and is normalized before persistence.
1558
1124
  */
1559
- declare type RoleAliases = v.InferOutput<typeof RoleAliasesSchema>;
1560
-
1561
- declare const RoleAliasesSchema: v.RecordSchema<
1562
- v.SchemaWithPipe<
1563
- readonly [
1564
- v.StringSchema<undefined>,
1565
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1566
- ]
1567
- >,
1568
- v.SchemaWithPipe<
1569
- readonly [
1570
- v.ArraySchema<
1571
- v.SchemaWithPipe<
1572
- readonly [
1573
- v.StringSchema<undefined>,
1574
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1575
- ]
1576
- >,
1577
- undefined
1578
- >,
1579
- v.MinLengthAction<
1580
- string[],
1581
- 1,
1582
- "a role alias must list at least one fulfilling role"
1583
- >,
1584
- ]
1585
- >,
1586
- undefined
1587
- >;
1125
+ declare type RoleAliases = Record<string, string[]>;
1588
1126
 
1589
1127
  /** Inclusive scalar bounds. String/text bounds measure character length;
1590
1128
  * number bounds measure the numeric value. */
@@ -1618,6 +1156,8 @@ declare type SingleSubjectRequirement = RequirementBase & {
1618
1156
  * own `editable` is the ceiling, ANDed with the stage value at runtime, so an
1619
1157
  * override can only NARROW — never open a field the baseline left closed. An
1620
1158
  * unlisted field inherits its baseline.
1159
+ *
1160
+ * @interface
1621
1161
  */
1622
1162
  declare type Stage = StageFields<
1623
1163
  FieldEntry,
@@ -1627,7 +1167,7 @@ declare type Stage = StageFields<
1627
1167
  Editable
1628
1168
  >;
1629
1169
 
1630
- /** Type-mirror of {@link stageFields}, parameterised over field/activity/transition/guard/editable. */
1170
+ /** @inline */
1631
1171
  declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
1632
1172
  name: string;
1633
1173
  semantics?: Semantic[] | undefined;
@@ -1641,8 +1181,6 @@ declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
1641
1181
  editable?: Record<string, TEditable> | undefined;
1642
1182
  };
1643
1183
 
1644
- declare const START_KINDS: readonly ["interactive", "autonomous"];
1645
-
1646
1184
  /**
1647
1185
  * How standalone runs of this workflow begin. `filter` is a READ-SIDE
1648
1186
  * visibility predicate — "should a start surface offer this workflow for
@@ -1660,6 +1198,7 @@ declare type StartBlock = StartFields & {
1660
1198
  kind: StartKind;
1661
1199
  };
1662
1200
 
1201
+ /** @inline */
1663
1202
  declare type StartFields = {
1664
1203
  filter?: string | undefined;
1665
1204
  requirements?: StartRequirement[] | undefined;
@@ -1674,277 +1213,31 @@ declare type StartFields = {
1674
1213
  * path for every kind, and an interactive start of an autonomous workflow is
1675
1214
  * legal.
1676
1215
  */
1677
- declare type StartKind = (typeof START_KINDS)[number];
1216
+ declare type StartKind = "interactive" | "autonomous";
1678
1217
 
1679
1218
  /** Every named readiness requirement accepted by workflow `start.requirements`. */
1680
1219
  declare type StartRequirement = GroqRequirement | SingleSubjectRequirement;
1681
1220
 
1682
- declare const StoredEditableSchema: v.UnionSchema<
1683
- [
1684
- v.LiteralSchema<true, undefined>,
1685
- v.SchemaWithPipe<
1221
+ /**
1222
+ * A field reference with `scope` already resolved — the form every op target carries.
1223
+ *
1224
+ * @interface
1225
+ */
1226
+ declare type StoredFieldRef = v.InferOutput<typeof StoredFieldRefSchema>;
1227
+
1228
+ declare const StoredFieldRefSchema: v.StrictObjectSchema<
1229
+ {
1230
+ readonly scope: v.PicklistSchema<
1231
+ readonly ["workflow", "stage", "activity"],
1232
+ string
1233
+ >;
1234
+ readonly field: v.SchemaWithPipe<
1686
1235
  readonly [
1687
1236
  v.StringSchema<undefined>,
1688
1237
  v.MinLengthAction<string, 1, "must be a non-empty string">,
1689
1238
  ]
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
- ],
1239
+ >;
1240
+ },
1948
1241
  undefined
1949
1242
  >;
1950
1243
 
@@ -1960,6 +1253,8 @@ declare const StoredOpSchema: v.VariantSchema<
1960
1253
  * (default) lets them run to completion, `'abort'` kills them recursively —
1961
1254
  * always an authored choice, never automatic. Whether the PARENT may move at
1962
1255
  * all is a separate gate over `$subworkflows`.
1256
+ *
1257
+ * @interface
1963
1258
  */
1964
1259
  declare type Subworkflows = v.InferOutput<typeof SubworkflowsSchema>;
1965
1260
 
@@ -2050,17 +1345,9 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
2050
1345
  * `$allActivitiesDone` — a `failed` activity blocks it permanently, surfacing
2051
1346
  * via `$anyActivityFailed`.
2052
1347
  */
2053
- declare const TERMINAL_ACTIVITY_STATUSES: readonly [
2054
- "done",
2055
- "skipped",
2056
- "failed",
2057
- ];
2058
-
2059
- declare type TerminalActivityStatus =
2060
- (typeof TERMINAL_ACTIVITY_STATUSES)[number];
1348
+ declare type TerminalActivityStatus = "done" | "skipped" | "failed";
2061
1349
 
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. */
1350
+ /** @inline */
2064
1351
  declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
2065
1352
  type: "todoList";
2066
1353
  };
@@ -2079,8 +1366,7 @@ declare type Transition = TransitionFields & {
2079
1366
  when: string;
2080
1367
  };
2081
1368
 
2082
- /** Type-mirror of {@link transitionFields} minus `when` — stored requires it,
2083
- * authoring omits it (desugar fills the default), so each variant declares it. */
1369
+ /** @inline */
2084
1370
  declare type TransitionFields = {
2085
1371
  name: string;
2086
1372
  title?: string | undefined;
@@ -2088,6 +1374,15 @@ declare type TransitionFields = {
2088
1374
  to: string;
2089
1375
  };
2090
1376
 
1377
+ /**
1378
+ * An op's write payload, resolved to concrete JSON when the op applies. Each
1379
+ * context-bound arm has a rendered `$`-twin in conditions (`actor` ↔
1380
+ * `$actor`, `now` ↔ `$now`, `self` ↔ `$self`), so learning one side teaches
1381
+ * the other. Distinct from {@link FieldSource}, a field's seed recipe.
1382
+ */
1383
+ declare type ValueExpr = ValueExprInternal;
1384
+
1385
+ /** @inline */
2091
1386
  declare type ValueExprInternal =
2092
1387
  | LiteralExpr
2093
1388
  | FieldReadExpr
@@ -2112,8 +1407,6 @@ declare type ValueExprInternal =
2112
1407
  fields: Record<string, ValueExprInternal>;
2113
1408
  };
2114
1409
 
2115
- declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
2116
-
2117
1410
  /**
2118
1411
  * `deployments` names must be unique (the selector deployment-targeted
2119
1412
  * commands resolve by), and each `(workflowResource, tag)` pair must be
@@ -2123,6 +1416,8 @@ declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
2123
1416
  * logger unconditionally (CI and `DO_NOT_TRACK` included), and consent,
2124
1417
  * environment suppression, and transport become this implementation's
2125
1418
  * business.
1419
+ *
1420
+ * @interface
2126
1421
  */
2127
1422
  declare type WorkflowConfig = v.InferOutput<typeof WorkflowConfigSchema>;
2128
1423
 
@@ -2772,6 +2067,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
2772
2067
  * conditions — each `name: groq` entry is pre-evaluated and bound as the
2773
2068
  * boolean `$name` var; redefining a built-in var is a deploy error, never a
2774
2069
  * silent shadow.
2070
+ *
2071
+ * @interface
2775
2072
  */
2776
2073
  declare type WorkflowDefinition = v.InferOutput<
2777
2074
  typeof WorkflowDefinitionSchema
@@ -2815,7 +2112,7 @@ declare type WorkflowDeploymentInput = Omit<
2815
2112
  expectedMinReaderModel: number;
2816
2113
  };
2817
2114
 
2818
- /** Type-mirror of {@link workflowFields}, parameterised over field/stage/start. */
2115
+ /** @inline */
2819
2116
  declare type WorkflowFields<TField, TStage, TStart> = {
2820
2117
  name: string;
2821
2118
  semantics?: Semantic[] | undefined;
@@ -2834,7 +2131,7 @@ declare type WorkflowFields<TField, TStage, TStart> = {
2834
2131
  /** How instances of a definition come to exist: started standalone (the
2835
2132
  * default) or spawned by a parent. `'child'` is spawn-only — see
2836
2133
  * {@link isStartableDefinition}. */
2837
- declare type WorkflowLifecycle = (typeof WORKFLOW_LIFECYCLES)[number];
2134
+ declare type WorkflowLifecycle = "standalone" | "child";
2838
2135
 
2839
2136
  /**
2840
2137
  * A telemetry event descriptor — a structural mirror of `@sanity/telemetry`'s