@sanity/workflow-engine 0.6.0 → 0.8.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.cts CHANGED
@@ -808,6 +808,33 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
808
808
  >,
809
809
  undefined
810
810
  >;
811
+ /**
812
+ * Readiness gates, by name — conditions over the rendered scope that must
813
+ * hold for the task to be *executable*, orthogonal to `filter`
814
+ * (visibility). An unmet requirement keeps the task visible but disables
815
+ * its actions with a `requirements-unmet` verdict naming the unmet keys;
816
+ * all must hold (any-of lives inside one condition). Advisory like every
817
+ * engine gate — the lake still enforces. Distinct from ACL (authorization)
818
+ * and guards (content-write locks).
819
+ */
820
+ requirements: v.OptionalSchema<
821
+ v.RecordSchema<
822
+ v.SchemaWithPipe<
823
+ readonly [
824
+ v.StringSchema<undefined>,
825
+ v.MinLengthAction<string, 1, "must be a non-empty string">,
826
+ ]
827
+ >,
828
+ v.SchemaWithPipe<
829
+ readonly [
830
+ v.StringSchema<undefined>,
831
+ v.MinLengthAction<string, 1, "must be a non-empty string">,
832
+ ]
833
+ >,
834
+ undefined
835
+ >,
836
+ undefined
837
+ >;
811
838
  /**
812
839
  * Auto-completion condition — evaluated at activation and on every
813
840
  * cascade; truthy flips the task to `done` with a system actor. On a
@@ -1960,6 +1987,17 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
1960
1987
  v.StringSchema<undefined>,
1961
1988
  undefined
1962
1989
  >;
1990
+ /**
1991
+ * When true, the caller MUST supply this entry at start (via
1992
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
1993
+ * missing required entry throws rather than silently defaulting to
1994
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
1995
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
1996
+ */
1997
+ readonly required: v.OptionalSchema<
1998
+ v.BooleanSchema<undefined>,
1999
+ undefined
2000
+ >;
1963
2001
  readonly source: v.GenericSchema<SourceInternal>;
1964
2002
  },
1965
2003
  undefined
@@ -2509,6 +2547,17 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
2509
2547
  v.StringSchema<undefined>,
2510
2548
  undefined
2511
2549
  >;
2550
+ /**
2551
+ * When true, the caller MUST supply this entry at start (via
2552
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
2553
+ * missing required entry throws rather than silently defaulting to
2554
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
2555
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
2556
+ */
2557
+ readonly required: v.OptionalSchema<
2558
+ v.BooleanSchema<undefined>,
2559
+ undefined
2560
+ >;
2512
2561
  readonly source: v.GenericSchema<SourceInternal>;
2513
2562
  },
2514
2563
  undefined
@@ -2578,6 +2627,17 @@ declare const AuthoringStateEntrySchema: v.UnionSchema<
2578
2627
  v.StringSchema<undefined>,
2579
2628
  undefined
2580
2629
  >;
2630
+ /**
2631
+ * When true, the caller MUST supply this entry at start (via
2632
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
2633
+ * missing required entry throws rather than silently defaulting to
2634
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
2635
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
2636
+ */
2637
+ readonly required: v.OptionalSchema<
2638
+ v.BooleanSchema<undefined>,
2639
+ undefined
2640
+ >;
2581
2641
  readonly source: v.GenericSchema<SourceInternal>;
2582
2642
  },
2583
2643
  undefined
@@ -2628,6 +2688,33 @@ declare const AuthoringTaskSchema: v.StrictObjectSchema<
2628
2688
  >,
2629
2689
  undefined
2630
2690
  >;
2691
+ /**
2692
+ * Readiness gates, by name — conditions over the rendered scope that must
2693
+ * hold for the task to be *executable*, orthogonal to `filter`
2694
+ * (visibility). An unmet requirement keeps the task visible but disables
2695
+ * its actions with a `requirements-unmet` verdict naming the unmet keys;
2696
+ * all must hold (any-of lives inside one condition). Advisory like every
2697
+ * engine gate — the lake still enforces. Distinct from ACL (authorization)
2698
+ * and guards (content-write locks).
2699
+ */
2700
+ requirements: v.OptionalSchema<
2701
+ v.RecordSchema<
2702
+ v.SchemaWithPipe<
2703
+ readonly [
2704
+ v.StringSchema<undefined>,
2705
+ v.MinLengthAction<string, 1, "must be a non-empty string">,
2706
+ ]
2707
+ >,
2708
+ v.SchemaWithPipe<
2709
+ readonly [
2710
+ v.StringSchema<undefined>,
2711
+ v.MinLengthAction<string, 1, "must be a non-empty string">,
2712
+ ]
2713
+ >,
2714
+ undefined
2715
+ >,
2716
+ undefined
2717
+ >;
2631
2718
  /**
2632
2719
  * Auto-completion condition — evaluated at activation and on every
2633
2720
  * cascade; truthy flips the task to `done` with a system actor. On a
@@ -3695,6 +3782,17 @@ declare const AuthoringTaskSchema: v.StrictObjectSchema<
3695
3782
  v.StringSchema<undefined>,
3696
3783
  undefined
3697
3784
  >;
3785
+ /**
3786
+ * When true, the caller MUST supply this entry at start (via
3787
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
3788
+ * missing required entry throws rather than silently defaulting to
3789
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
3790
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
3791
+ */
3792
+ readonly required: v.OptionalSchema<
3793
+ v.BooleanSchema<undefined>,
3794
+ undefined
3795
+ >;
3698
3796
  readonly source: v.GenericSchema<SourceInternal>;
3699
3797
  },
3700
3798
  undefined
@@ -4057,6 +4155,22 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
4057
4155
  ]
4058
4156
  >;
4059
4157
  description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4158
+ /**
4159
+ * Whether a human may start this workflow standalone. `'child'` marks a
4160
+ * spawn-only definition — instantiated by a parent via `task.subworkflows`,
4161
+ * never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
4162
+ * Advisory: consumers filter their start pickers on it (see
4163
+ * {@link isStartableDefinition}); the engine does NOT refuse a
4164
+ * `startInstance` on a `'child'` def — load-bearing `required` state is the
4165
+ * runtime backstop.
4166
+ */
4167
+ role: v.OptionalSchema<
4168
+ v.PicklistSchema<
4169
+ readonly ["workflow", "child"],
4170
+ `Invalid option: expected one of ${string}`
4171
+ >,
4172
+ undefined
4173
+ >;
4060
4174
  /** Reference field: named for the target, holds the stage's `name`. */
4061
4175
  initialStage: v.SchemaWithPipe<
4062
4176
  readonly [
@@ -4103,6 +4217,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
4103
4217
  v.StringSchema<undefined>,
4104
4218
  undefined
4105
4219
  >;
4220
+ /**
4221
+ * When true, the caller MUST supply this entry at start (via
4222
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
4223
+ * missing required entry throws rather than silently defaulting to
4224
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
4225
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
4226
+ */
4227
+ readonly required: v.OptionalSchema<
4228
+ v.BooleanSchema<undefined>,
4229
+ undefined
4230
+ >;
4106
4231
  readonly source: v.GenericSchema<SourceInternal>;
4107
4232
  },
4108
4233
  undefined
@@ -4192,6 +4317,41 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
4192
4317
  >,
4193
4318
  undefined
4194
4319
  >;
4320
+ /**
4321
+ * Readiness gates, by name — conditions over the rendered scope that must
4322
+ * hold for the task to be *executable*, orthogonal to `filter`
4323
+ * (visibility). An unmet requirement keeps the task visible but disables
4324
+ * its actions with a `requirements-unmet` verdict naming the unmet keys;
4325
+ * all must hold (any-of lives inside one condition). Advisory like every
4326
+ * engine gate — the lake still enforces. Distinct from ACL (authorization)
4327
+ * and guards (content-write locks).
4328
+ */
4329
+ requirements: v.OptionalSchema<
4330
+ v.RecordSchema<
4331
+ v.SchemaWithPipe<
4332
+ readonly [
4333
+ v.StringSchema<undefined>,
4334
+ v.MinLengthAction<
4335
+ string,
4336
+ 1,
4337
+ "must be a non-empty string"
4338
+ >,
4339
+ ]
4340
+ >,
4341
+ v.SchemaWithPipe<
4342
+ readonly [
4343
+ v.StringSchema<undefined>,
4344
+ v.MinLengthAction<
4345
+ string,
4346
+ 1,
4347
+ "must be a non-empty string"
4348
+ >,
4349
+ ]
4350
+ >,
4351
+ undefined
4352
+ >,
4353
+ undefined
4354
+ >;
4195
4355
  /**
4196
4356
  * Auto-completion condition — evaluated at activation and on every
4197
4357
  * cascade; truthy flips the task to `done` with a system actor. On a
@@ -5396,6 +5556,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
5396
5556
  v.StringSchema<undefined>,
5397
5557
  undefined
5398
5558
  >;
5559
+ /**
5560
+ * When true, the caller MUST supply this entry at start (via
5561
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
5562
+ * missing required entry throws rather than silently defaulting to
5563
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
5564
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
5565
+ */
5566
+ readonly required: v.OptionalSchema<
5567
+ v.BooleanSchema<undefined>,
5568
+ undefined
5569
+ >;
5399
5570
  readonly source: v.GenericSchema<SourceInternal>;
5400
5571
  },
5401
5572
  undefined
@@ -6008,6 +6179,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
6008
6179
  v.StringSchema<undefined>,
6009
6180
  undefined
6010
6181
  >;
6182
+ /**
6183
+ * When true, the caller MUST supply this entry at start (via
6184
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
6185
+ * missing required entry throws rather than silently defaulting to
6186
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
6187
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
6188
+ */
6189
+ readonly required: v.OptionalSchema<
6190
+ v.BooleanSchema<undefined>,
6191
+ undefined
6192
+ >;
6011
6193
  readonly source: v.GenericSchema<SourceInternal>;
6012
6194
  },
6013
6195
  undefined
@@ -6056,6 +6238,11 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
6056
6238
  description?: string | undefined;
6057
6239
  activation?: "auto" | "manual" | undefined;
6058
6240
  filter?: string | undefined;
6241
+ requirements?:
6242
+ | {
6243
+ [x: string]: string;
6244
+ }
6245
+ | undefined;
6059
6246
  completeWhen?: string | undefined;
6060
6247
  failWhen?: string | undefined;
6061
6248
  ops?:
@@ -6374,6 +6561,7 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
6374
6561
  name: string;
6375
6562
  title?: string | undefined;
6376
6563
  description?: string | undefined;
6564
+ required?: boolean | undefined;
6377
6565
  source: SourceInternal;
6378
6566
  }
6379
6567
  | {
@@ -6515,6 +6703,7 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
6515
6703
  name: string;
6516
6704
  title?: string | undefined;
6517
6705
  description?: string | undefined;
6706
+ required?: boolean | undefined;
6518
6707
  source: SourceInternal;
6519
6708
  }
6520
6709
  | {
@@ -6879,6 +7068,22 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
6879
7068
  ]
6880
7069
  >;
6881
7070
  description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
7071
+ /**
7072
+ * Whether a human may start this workflow standalone. `'child'` marks a
7073
+ * spawn-only definition — instantiated by a parent via `task.subworkflows`,
7074
+ * never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
7075
+ * Advisory: consumers filter their start pickers on it (see
7076
+ * {@link isStartableDefinition}); the engine does NOT refuse a
7077
+ * `startInstance` on a `'child'` def — load-bearing `required` state is the
7078
+ * runtime backstop.
7079
+ */
7080
+ role: v.OptionalSchema<
7081
+ v.PicklistSchema<
7082
+ readonly ["workflow", "child"],
7083
+ `Invalid option: expected one of ${string}`
7084
+ >,
7085
+ undefined
7086
+ >;
6882
7087
  /** Reference field: named for the target, holds the stage's `name`. */
6883
7088
  initialStage: v.SchemaWithPipe<
6884
7089
  readonly [
@@ -6923,6 +7128,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
6923
7128
  v.StringSchema<undefined>,
6924
7129
  undefined
6925
7130
  >;
7131
+ /**
7132
+ * When true, the caller MUST supply this entry at start (via
7133
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
7134
+ * missing required entry throws rather than silently defaulting to
7135
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
7136
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
7137
+ */
7138
+ readonly required: v.OptionalSchema<
7139
+ v.BooleanSchema<undefined>,
7140
+ undefined
7141
+ >;
6926
7142
  readonly source: v.GenericSchema<SourceInternal>;
6927
7143
  },
6928
7144
  undefined
@@ -6989,6 +7205,41 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
6989
7205
  >,
6990
7206
  undefined
6991
7207
  >;
7208
+ /**
7209
+ * Readiness gates, by name — conditions over the rendered scope that must
7210
+ * hold for the task to be *executable*, orthogonal to `filter`
7211
+ * (visibility). An unmet requirement keeps the task visible but disables
7212
+ * its actions with a `requirements-unmet` verdict naming the unmet keys;
7213
+ * all must hold (any-of lives inside one condition). Advisory like every
7214
+ * engine gate — the lake still enforces. Distinct from ACL (authorization)
7215
+ * and guards (content-write locks).
7216
+ */
7217
+ requirements: v.OptionalSchema<
7218
+ v.RecordSchema<
7219
+ v.SchemaWithPipe<
7220
+ readonly [
7221
+ v.StringSchema<undefined>,
7222
+ v.MinLengthAction<
7223
+ string,
7224
+ 1,
7225
+ "must be a non-empty string"
7226
+ >,
7227
+ ]
7228
+ >,
7229
+ v.SchemaWithPipe<
7230
+ readonly [
7231
+ v.StringSchema<undefined>,
7232
+ v.MinLengthAction<
7233
+ string,
7234
+ 1,
7235
+ "must be a non-empty string"
7236
+ >,
7237
+ ]
7238
+ >,
7239
+ undefined
7240
+ >,
7241
+ undefined
7242
+ >;
6992
7243
  /**
6993
7244
  * Auto-completion condition — evaluated at activation and on every
6994
7245
  * cascade; truthy flips the task to `done` with a system actor. On a
@@ -7772,6 +8023,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
7772
8023
  v.StringSchema<undefined>,
7773
8024
  undefined
7774
8025
  >;
8026
+ /**
8027
+ * When true, the caller MUST supply this entry at start (via
8028
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
8029
+ * missing required entry throws rather than silently defaulting to
8030
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
8031
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
8032
+ */
8033
+ readonly required: v.OptionalSchema<
8034
+ v.BooleanSchema<undefined>,
8035
+ undefined
8036
+ >;
7775
8037
  readonly source: v.GenericSchema<SourceInternal>;
7776
8038
  },
7777
8039
  undefined
@@ -8248,6 +8510,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
8248
8510
  v.StringSchema<undefined>,
8249
8511
  undefined
8250
8512
  >;
8513
+ /**
8514
+ * When true, the caller MUST supply this entry at start (via
8515
+ * `initialState`) or spawn (via the parent's `subworkflows.with`). A
8516
+ * missing required entry throws rather than silently defaulting to
8517
+ * `null`/`[]` — the same fail-fast an action's `required` param gets.
8518
+ * Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
8519
+ */
8520
+ readonly required: v.OptionalSchema<
8521
+ v.BooleanSchema<undefined>,
8522
+ undefined
8523
+ >;
8251
8524
  readonly source: v.GenericSchema<SourceInternal>;
8252
8525
  },
8253
8526
  undefined
@@ -8273,6 +8546,11 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
8273
8546
  description?: string | undefined;
8274
8547
  activation?: "auto" | "manual" | undefined;
8275
8548
  filter?: string | undefined;
8549
+ requirements?:
8550
+ | {
8551
+ [x: string]: string;
8552
+ }
8553
+ | undefined;
8276
8554
  completeWhen?: string | undefined;
8277
8555
  failWhen?: string | undefined;
8278
8556
  ops?:
@@ -8481,6 +8759,7 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
8481
8759
  name: string;
8482
8760
  title?: string | undefined;
8483
8761
  description?: string | undefined;
8762
+ required?: boolean | undefined;
8484
8763
  source: SourceInternal;
8485
8764
  }[]
8486
8765
  | undefined;
@@ -8600,6 +8879,7 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
8600
8879
  name: string;
8601
8880
  title?: string | undefined;
8602
8881
  description?: string | undefined;
8882
+ required?: boolean | undefined;
8603
8883
  source: SourceInternal;
8604
8884
  }[]
8605
8885
  | undefined;