@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/_chunks-cjs/schema.cjs +33 -1
- package/dist/_chunks-cjs/schema.cjs.map +1 -1
- package/dist/_chunks-es/schema.js +33 -1
- package/dist/_chunks-es/schema.js.map +1 -1
- package/dist/define.cjs +19 -2
- package/dist/define.cjs.map +1 -1
- package/dist/define.d.cts +280 -0
- package/dist/define.d.ts +280 -0
- package/dist/define.js +19 -2
- package/dist/define.js.map +1 -1
- package/dist/index.cjs +467 -241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +570 -24
- package/dist/index.d.ts +570 -24
- package/dist/index.js +468 -241
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -136,13 +136,6 @@ export declare type Assignee =
|
|
|
136
136
|
role: string;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
/** The assignees recorded for a task in a stage — the runtime half of the
|
|
140
|
-
* "who is this waiting on" answer. Empty when the task is unassigned. */
|
|
141
|
-
export declare function assigneesOf(
|
|
142
|
-
stage: StageEntry | undefined,
|
|
143
|
-
taskName: string,
|
|
144
|
-
): Assignee[];
|
|
145
|
-
|
|
146
139
|
/**
|
|
147
140
|
* Persisted document and effect-queue `_type` discriminators.
|
|
148
141
|
*/
|
|
@@ -771,6 +764,33 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
|
|
|
771
764
|
>,
|
|
772
765
|
undefined
|
|
773
766
|
>;
|
|
767
|
+
/**
|
|
768
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
769
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
770
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
771
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
772
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
773
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
774
|
+
* and guards (content-write locks).
|
|
775
|
+
*/
|
|
776
|
+
requirements: v.OptionalSchema<
|
|
777
|
+
v.RecordSchema<
|
|
778
|
+
v.SchemaWithPipe<
|
|
779
|
+
readonly [
|
|
780
|
+
v.StringSchema<undefined>,
|
|
781
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
782
|
+
]
|
|
783
|
+
>,
|
|
784
|
+
v.SchemaWithPipe<
|
|
785
|
+
readonly [
|
|
786
|
+
v.StringSchema<undefined>,
|
|
787
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
788
|
+
]
|
|
789
|
+
>,
|
|
790
|
+
undefined
|
|
791
|
+
>,
|
|
792
|
+
undefined
|
|
793
|
+
>;
|
|
774
794
|
/**
|
|
775
795
|
* Auto-completion condition — evaluated at activation and on every
|
|
776
796
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -1923,6 +1943,17 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
|
|
|
1923
1943
|
v.StringSchema<undefined>,
|
|
1924
1944
|
undefined
|
|
1925
1945
|
>;
|
|
1946
|
+
/**
|
|
1947
|
+
* When true, the caller MUST supply this entry at start (via
|
|
1948
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
1949
|
+
* missing required entry throws rather than silently defaulting to
|
|
1950
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
1951
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
1952
|
+
*/
|
|
1953
|
+
readonly required: v.OptionalSchema<
|
|
1954
|
+
v.BooleanSchema<undefined>,
|
|
1955
|
+
undefined
|
|
1956
|
+
>;
|
|
1926
1957
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
1927
1958
|
},
|
|
1928
1959
|
undefined
|
|
@@ -2472,6 +2503,17 @@ declare const AuthoringStageSchema: v.StrictObjectSchema<
|
|
|
2472
2503
|
v.StringSchema<undefined>,
|
|
2473
2504
|
undefined
|
|
2474
2505
|
>;
|
|
2506
|
+
/**
|
|
2507
|
+
* When true, the caller MUST supply this entry at start (via
|
|
2508
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
2509
|
+
* missing required entry throws rather than silently defaulting to
|
|
2510
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
2511
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
2512
|
+
*/
|
|
2513
|
+
readonly required: v.OptionalSchema<
|
|
2514
|
+
v.BooleanSchema<undefined>,
|
|
2515
|
+
undefined
|
|
2516
|
+
>;
|
|
2475
2517
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
2476
2518
|
},
|
|
2477
2519
|
undefined
|
|
@@ -2541,6 +2583,17 @@ declare const AuthoringStateEntrySchema: v.UnionSchema<
|
|
|
2541
2583
|
v.StringSchema<undefined>,
|
|
2542
2584
|
undefined
|
|
2543
2585
|
>;
|
|
2586
|
+
/**
|
|
2587
|
+
* When true, the caller MUST supply this entry at start (via
|
|
2588
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
2589
|
+
* missing required entry throws rather than silently defaulting to
|
|
2590
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
2591
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
2592
|
+
*/
|
|
2593
|
+
readonly required: v.OptionalSchema<
|
|
2594
|
+
v.BooleanSchema<undefined>,
|
|
2595
|
+
undefined
|
|
2596
|
+
>;
|
|
2544
2597
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
2545
2598
|
},
|
|
2546
2599
|
undefined
|
|
@@ -2591,6 +2644,33 @@ declare const AuthoringTaskSchema: v.StrictObjectSchema<
|
|
|
2591
2644
|
>,
|
|
2592
2645
|
undefined
|
|
2593
2646
|
>;
|
|
2647
|
+
/**
|
|
2648
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
2649
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
2650
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
2651
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
2652
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
2653
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
2654
|
+
* and guards (content-write locks).
|
|
2655
|
+
*/
|
|
2656
|
+
requirements: v.OptionalSchema<
|
|
2657
|
+
v.RecordSchema<
|
|
2658
|
+
v.SchemaWithPipe<
|
|
2659
|
+
readonly [
|
|
2660
|
+
v.StringSchema<undefined>,
|
|
2661
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
2662
|
+
]
|
|
2663
|
+
>,
|
|
2664
|
+
v.SchemaWithPipe<
|
|
2665
|
+
readonly [
|
|
2666
|
+
v.StringSchema<undefined>,
|
|
2667
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
2668
|
+
]
|
|
2669
|
+
>,
|
|
2670
|
+
undefined
|
|
2671
|
+
>,
|
|
2672
|
+
undefined
|
|
2673
|
+
>;
|
|
2594
2674
|
/**
|
|
2595
2675
|
* Auto-completion condition — evaluated at activation and on every
|
|
2596
2676
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -3658,6 +3738,17 @@ declare const AuthoringTaskSchema: v.StrictObjectSchema<
|
|
|
3658
3738
|
v.StringSchema<undefined>,
|
|
3659
3739
|
undefined
|
|
3660
3740
|
>;
|
|
3741
|
+
/**
|
|
3742
|
+
* When true, the caller MUST supply this entry at start (via
|
|
3743
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
3744
|
+
* missing required entry throws rather than silently defaulting to
|
|
3745
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
3746
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
3747
|
+
*/
|
|
3748
|
+
readonly required: v.OptionalSchema<
|
|
3749
|
+
v.BooleanSchema<undefined>,
|
|
3750
|
+
undefined
|
|
3751
|
+
>;
|
|
3661
3752
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
3662
3753
|
},
|
|
3663
3754
|
undefined
|
|
@@ -4022,6 +4113,22 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
4022
4113
|
]
|
|
4023
4114
|
>;
|
|
4024
4115
|
description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
4116
|
+
/**
|
|
4117
|
+
* Whether a human may start this workflow standalone. `'child'` marks a
|
|
4118
|
+
* spawn-only definition — instantiated by a parent via `task.subworkflows`,
|
|
4119
|
+
* never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
|
|
4120
|
+
* Advisory: consumers filter their start pickers on it (see
|
|
4121
|
+
* {@link isStartableDefinition}); the engine does NOT refuse a
|
|
4122
|
+
* `startInstance` on a `'child'` def — load-bearing `required` state is the
|
|
4123
|
+
* runtime backstop.
|
|
4124
|
+
*/
|
|
4125
|
+
role: v.OptionalSchema<
|
|
4126
|
+
v.PicklistSchema<
|
|
4127
|
+
readonly ["workflow", "child"],
|
|
4128
|
+
`Invalid option: expected one of ${string}`
|
|
4129
|
+
>,
|
|
4130
|
+
undefined
|
|
4131
|
+
>;
|
|
4025
4132
|
/** Reference field: named for the target, holds the stage's `name`. */
|
|
4026
4133
|
initialStage: v.SchemaWithPipe<
|
|
4027
4134
|
readonly [
|
|
@@ -4068,6 +4175,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
4068
4175
|
v.StringSchema<undefined>,
|
|
4069
4176
|
undefined
|
|
4070
4177
|
>;
|
|
4178
|
+
/**
|
|
4179
|
+
* When true, the caller MUST supply this entry at start (via
|
|
4180
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
4181
|
+
* missing required entry throws rather than silently defaulting to
|
|
4182
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
4183
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
4184
|
+
*/
|
|
4185
|
+
readonly required: v.OptionalSchema<
|
|
4186
|
+
v.BooleanSchema<undefined>,
|
|
4187
|
+
undefined
|
|
4188
|
+
>;
|
|
4071
4189
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
4072
4190
|
},
|
|
4073
4191
|
undefined
|
|
@@ -4157,6 +4275,41 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
4157
4275
|
>,
|
|
4158
4276
|
undefined
|
|
4159
4277
|
>;
|
|
4278
|
+
/**
|
|
4279
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
4280
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
4281
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
4282
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
4283
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
4284
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
4285
|
+
* and guards (content-write locks).
|
|
4286
|
+
*/
|
|
4287
|
+
requirements: v.OptionalSchema<
|
|
4288
|
+
v.RecordSchema<
|
|
4289
|
+
v.SchemaWithPipe<
|
|
4290
|
+
readonly [
|
|
4291
|
+
v.StringSchema<undefined>,
|
|
4292
|
+
v.MinLengthAction<
|
|
4293
|
+
string,
|
|
4294
|
+
1,
|
|
4295
|
+
"must be a non-empty string"
|
|
4296
|
+
>,
|
|
4297
|
+
]
|
|
4298
|
+
>,
|
|
4299
|
+
v.SchemaWithPipe<
|
|
4300
|
+
readonly [
|
|
4301
|
+
v.StringSchema<undefined>,
|
|
4302
|
+
v.MinLengthAction<
|
|
4303
|
+
string,
|
|
4304
|
+
1,
|
|
4305
|
+
"must be a non-empty string"
|
|
4306
|
+
>,
|
|
4307
|
+
]
|
|
4308
|
+
>,
|
|
4309
|
+
undefined
|
|
4310
|
+
>,
|
|
4311
|
+
undefined
|
|
4312
|
+
>;
|
|
4160
4313
|
/**
|
|
4161
4314
|
* Auto-completion condition — evaluated at activation and on every
|
|
4162
4315
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -5361,6 +5514,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
5361
5514
|
v.StringSchema<undefined>,
|
|
5362
5515
|
undefined
|
|
5363
5516
|
>;
|
|
5517
|
+
/**
|
|
5518
|
+
* When true, the caller MUST supply this entry at start (via
|
|
5519
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
5520
|
+
* missing required entry throws rather than silently defaulting to
|
|
5521
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
5522
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
5523
|
+
*/
|
|
5524
|
+
readonly required: v.OptionalSchema<
|
|
5525
|
+
v.BooleanSchema<undefined>,
|
|
5526
|
+
undefined
|
|
5527
|
+
>;
|
|
5364
5528
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
5365
5529
|
},
|
|
5366
5530
|
undefined
|
|
@@ -5973,6 +6137,17 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
5973
6137
|
v.StringSchema<undefined>,
|
|
5974
6138
|
undefined
|
|
5975
6139
|
>;
|
|
6140
|
+
/**
|
|
6141
|
+
* When true, the caller MUST supply this entry at start (via
|
|
6142
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
6143
|
+
* missing required entry throws rather than silently defaulting to
|
|
6144
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
6145
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
6146
|
+
*/
|
|
6147
|
+
readonly required: v.OptionalSchema<
|
|
6148
|
+
v.BooleanSchema<undefined>,
|
|
6149
|
+
undefined
|
|
6150
|
+
>;
|
|
5976
6151
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
5977
6152
|
},
|
|
5978
6153
|
undefined
|
|
@@ -6021,6 +6196,11 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
6021
6196
|
description?: string | undefined;
|
|
6022
6197
|
activation?: "auto" | "manual" | undefined;
|
|
6023
6198
|
filter?: string | undefined;
|
|
6199
|
+
requirements?:
|
|
6200
|
+
| {
|
|
6201
|
+
[x: string]: string;
|
|
6202
|
+
}
|
|
6203
|
+
| undefined;
|
|
6024
6204
|
completeWhen?: string | undefined;
|
|
6025
6205
|
failWhen?: string | undefined;
|
|
6026
6206
|
ops?:
|
|
@@ -6339,6 +6519,7 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
6339
6519
|
name: string;
|
|
6340
6520
|
title?: string | undefined;
|
|
6341
6521
|
description?: string | undefined;
|
|
6522
|
+
required?: boolean | undefined;
|
|
6342
6523
|
source: SourceInternal;
|
|
6343
6524
|
}
|
|
6344
6525
|
| {
|
|
@@ -6480,6 +6661,7 @@ declare const AuthoringWorkflowSchema: v.StrictObjectSchema<
|
|
|
6480
6661
|
name: string;
|
|
6481
6662
|
title?: string | undefined;
|
|
6482
6663
|
description?: string | undefined;
|
|
6664
|
+
required?: boolean | undefined;
|
|
6483
6665
|
source: SourceInternal;
|
|
6484
6666
|
}
|
|
6485
6667
|
| {
|
|
@@ -6769,6 +6951,16 @@ export declare function datasetResourceParts(id: string): {
|
|
|
6769
6951
|
dataset: string;
|
|
6770
6952
|
};
|
|
6771
6953
|
|
|
6954
|
+
/**
|
|
6955
|
+
* The perspective a content read falls back to when the instance has no
|
|
6956
|
+
* explicit release perspective: `drafts` overlay published (Sanity
|
|
6957
|
+
* draft-precedence), so an unpublished or in-flight subject is what the engine
|
|
6958
|
+
* — and the reactive adapters — evaluate, never a published-only read that
|
|
6959
|
+
* silently misses the draft. The single home for the draft-precedence default;
|
|
6960
|
+
* every content read uses `instance.perspective ?? DEFAULT_CONTENT_PERSPECTIVE`.
|
|
6961
|
+
*/
|
|
6962
|
+
export declare const DEFAULT_CONTENT_PERSPECTIVE = "drafts";
|
|
6963
|
+
|
|
6772
6964
|
/**
|
|
6773
6965
|
* Default LoggerFactory — writes through the global `console`. Exposed
|
|
6774
6966
|
* so callers outside `createEngine` (drive scripts, the
|
|
@@ -6892,7 +7084,6 @@ export declare interface DiagnoseInput {
|
|
|
6892
7084
|
instance: Pick<
|
|
6893
7085
|
WorkflowInstance,
|
|
6894
7086
|
| "currentStage"
|
|
6895
|
-
| "stages"
|
|
6896
7087
|
| "completedAt"
|
|
6897
7088
|
| "abortedAt"
|
|
6898
7089
|
| "effectHistory"
|
|
@@ -6901,6 +7092,7 @@ export declare interface DiagnoseInput {
|
|
|
6901
7092
|
>;
|
|
6902
7093
|
tasks: TaskEvaluation[];
|
|
6903
7094
|
transitions: TransitionEvaluation[];
|
|
7095
|
+
assignees: Record<string, Assignee[]>;
|
|
6904
7096
|
}
|
|
6905
7097
|
|
|
6906
7098
|
/** Narrow a full {@link WorkflowEvaluation} to the {@link DiagnoseInput} the
|
|
@@ -6912,17 +7104,20 @@ export declare function diagnoseInputFromEvaluation(
|
|
|
6912
7104
|
/**
|
|
6913
7105
|
* Classify an instance. Terminal states win first; then the genuine stuck
|
|
6914
7106
|
* causes (nothing advances on its own or via a normal action); then `waiting`
|
|
6915
|
-
* (an action is available — healthy);
|
|
6916
|
-
*
|
|
7107
|
+
* (an action is available — healthy); then `blocked` (an active task held by
|
|
7108
|
+
* an unmet requirement — healthy, not yet actionable); else `progressing` (a
|
|
7109
|
+
* transition is already satisfied and will cascade).
|
|
6917
7110
|
*/
|
|
6918
7111
|
export declare function diagnoseInstance(input: DiagnoseInput): Diagnosis;
|
|
6919
7112
|
|
|
6920
|
-
/** The `workflow.diagnose` result — the verdict
|
|
7113
|
+
/** The `workflow.diagnose` result — the verdict, the structured remediations
|
|
7114
|
+
* that would unstick it (empty unless `stuck`), and the evaluation it was
|
|
6921
7115
|
* derived from, so a consumer can render the supporting evidence (current
|
|
6922
7116
|
* stage tasks + transitions) without a second projection. */
|
|
6923
7117
|
export declare interface DiagnoseResult {
|
|
6924
7118
|
evaluation: WorkflowEvaluation;
|
|
6925
7119
|
diagnosis: Diagnosis;
|
|
7120
|
+
remediations: SuggestedRemediation[];
|
|
6926
7121
|
}
|
|
6927
7122
|
|
|
6928
7123
|
export declare type Diagnosis =
|
|
@@ -6935,6 +7130,12 @@ export declare type Diagnosis =
|
|
|
6935
7130
|
assignees: Assignee[];
|
|
6936
7131
|
actions: string[];
|
|
6937
7132
|
}
|
|
7133
|
+
| {
|
|
7134
|
+
state: "blocked";
|
|
7135
|
+
task: string;
|
|
7136
|
+
requirements: string[];
|
|
7137
|
+
assignees: Assignee[];
|
|
7138
|
+
}
|
|
6938
7139
|
| {
|
|
6939
7140
|
state: "completed";
|
|
6940
7141
|
at: string;
|
|
@@ -7004,6 +7205,18 @@ export declare type DisabledReason =
|
|
|
7004
7205
|
| {
|
|
7005
7206
|
kind: "instance-completed";
|
|
7006
7207
|
completedAt: string;
|
|
7208
|
+
}
|
|
7209
|
+
| {
|
|
7210
|
+
/**
|
|
7211
|
+
* The task's declared {@link Task.requirements} aren't all satisfied —
|
|
7212
|
+
* the readiness axis. The task is visible and the actor authorized, but
|
|
7213
|
+
* its own preconditions don't hold yet. `unmetRequirements` names the
|
|
7214
|
+
* failing keys so a consumer can disable the affirmative control and say
|
|
7215
|
+
* which precondition is outstanding. Distinct from `filter-failed`
|
|
7216
|
+
* (visibility/authorization) and `mutation-guard-denied` (content-write).
|
|
7217
|
+
*/
|
|
7218
|
+
kind: "requirements-unmet";
|
|
7219
|
+
unmetRequirements: string[];
|
|
7007
7220
|
};
|
|
7008
7221
|
|
|
7009
7222
|
export declare interface DispatchResult {
|
|
@@ -8143,6 +8356,18 @@ export declare function isDefinitionUnchanged(
|
|
|
8143
8356
|
/** Type filter for GDR shape. */
|
|
8144
8357
|
export declare function isGdr(value: unknown): value is GlobalDocumentReference;
|
|
8145
8358
|
|
|
8359
|
+
/**
|
|
8360
|
+
* Whether a human may start this definition standalone (the default). A
|
|
8361
|
+
* `role: 'child'` definition is spawn-only — instantiated by a parent via
|
|
8362
|
+
* `task.subworkflows`, so consumers exclude it from top-level start pickers.
|
|
8363
|
+
* Advisory: the engine does not enforce it (see the `required`-state backstop
|
|
8364
|
+
* for load-bearing init slots). Accepts any definition-shaped value (authored,
|
|
8365
|
+
* stored, deployed, or a projected list row).
|
|
8366
|
+
*/
|
|
8367
|
+
export declare function isStartableDefinition(definition: {
|
|
8368
|
+
role?: WorkflowRole | undefined;
|
|
8369
|
+
}): boolean;
|
|
8370
|
+
|
|
8146
8371
|
/**
|
|
8147
8372
|
* A stage with no transitions out IS terminal — structural, not declared.
|
|
8148
8373
|
* Reaching one completes the instance.
|
|
@@ -8372,12 +8597,6 @@ export declare interface OpAppliedSummary {
|
|
|
8372
8597
|
resolved?: Record<string, unknown>;
|
|
8373
8598
|
}
|
|
8374
8599
|
|
|
8375
|
-
/** The instance's current, not-yet-exited {@link StageEntry}, if it has one —
|
|
8376
|
-
* the engine's canonical {@link findOpenStageEntry}, over the diagnosis input. */
|
|
8377
|
-
export declare function openStage(
|
|
8378
|
-
instance: Pick<WorkflowInstance, "currentStage" | "stages">,
|
|
8379
|
-
): StageEntry | undefined;
|
|
8380
|
-
|
|
8381
8600
|
export declare interface OperationArgs {
|
|
8382
8601
|
client: WorkflowClient;
|
|
8383
8602
|
/** Engine-scope environment partition — required. */
|
|
@@ -8434,6 +8653,20 @@ export declare interface ParsedGdr {
|
|
|
8434
8653
|
*/
|
|
8435
8654
|
export declare function parseGdr(uri: string): ParsedGdr;
|
|
8436
8655
|
|
|
8656
|
+
/**
|
|
8657
|
+
* A stage's multi-guard deploy failed *after* at least one guard already landed.
|
|
8658
|
+
* Those partial locks can't be cleanly undone (guard docs have no transactional
|
|
8659
|
+
* deploy). Inside the engine {@link deployOrRollback} rolls the state move back
|
|
8660
|
+
* and escalates this to a loud {@link WorkflowStateDivergedError}; a caller that
|
|
8661
|
+
* invokes {@link deployStageGuards} directly (without that rollback wrapper) can
|
|
8662
|
+
* also see it, so it's exported to be catchable by type.
|
|
8663
|
+
*/
|
|
8664
|
+
export declare class PartialGuardDeployError extends Error {
|
|
8665
|
+
readonly stageName: string;
|
|
8666
|
+
readonly deployed: number;
|
|
8667
|
+
constructor(args: { stageName: string; deployed: number; cause: unknown });
|
|
8668
|
+
}
|
|
8669
|
+
|
|
8437
8670
|
export declare interface PendingEffect {
|
|
8438
8671
|
_key: string;
|
|
8439
8672
|
_type?: "pendingEffect";
|
|
@@ -8534,6 +8767,52 @@ export declare interface ReleaseRef extends GlobalDocumentReference {
|
|
|
8534
8767
|
releaseName: string;
|
|
8535
8768
|
}
|
|
8536
8769
|
|
|
8770
|
+
/**
|
|
8771
|
+
* The remediations that would unstick a diagnosis — the *what to do about it*
|
|
8772
|
+
* half. Empty unless the instance is `stuck`: a `waiting` instance advances on
|
|
8773
|
+
* its own next action (see `availableActions`), and terminal or `progressing`
|
|
8774
|
+
* ones need nothing. Each verb is flagged
|
|
8775
|
+
* {@link SuggestedRemediation.available} from {@link RUNNABLE_VERBS}.
|
|
8776
|
+
*/
|
|
8777
|
+
export declare function remediationsFor(
|
|
8778
|
+
diagnosis: Diagnosis,
|
|
8779
|
+
): SuggestedRemediation[];
|
|
8780
|
+
|
|
8781
|
+
/**
|
|
8782
|
+
* A verb that would unstick a {@link StuckCause} — the *what to do about it*
|
|
8783
|
+
* half of a diagnosis. Surface-neutral identifiers; a consumer maps each to
|
|
8784
|
+
* its own command or button. `retry-effect`, `drain-effects` and `reset-task`
|
|
8785
|
+
* are not yet callable engine operations — see {@link SuggestedRemediation.available}.
|
|
8786
|
+
*/
|
|
8787
|
+
export declare type RemediationVerb =
|
|
8788
|
+
| "retry-effect"
|
|
8789
|
+
| "drain-effects"
|
|
8790
|
+
| "reset-task"
|
|
8791
|
+
| "set-stage"
|
|
8792
|
+
| "abort";
|
|
8793
|
+
|
|
8794
|
+
/**
|
|
8795
|
+
* Thrown when a workflow is started (or a child spawned) without a value for
|
|
8796
|
+
* a state entry marked `required`. Mirrors {@link ActionParamsInvalidError}:
|
|
8797
|
+
* the engine has NOT created the instance — a missing load-bearing slot
|
|
8798
|
+
* (e.g. the subject of a review) screams here rather than silently defaulting
|
|
8799
|
+
* to `null`/`[]` and birthing a half-formed instance mid-process.
|
|
8800
|
+
*/
|
|
8801
|
+
export declare class RequiredStateNotProvidedError extends Error {
|
|
8802
|
+
readonly definition?: string;
|
|
8803
|
+
readonly missing: {
|
|
8804
|
+
name: string;
|
|
8805
|
+
type: string;
|
|
8806
|
+
}[];
|
|
8807
|
+
constructor(args: {
|
|
8808
|
+
definition?: string;
|
|
8809
|
+
missing: {
|
|
8810
|
+
name: string;
|
|
8811
|
+
type: string;
|
|
8812
|
+
}[];
|
|
8813
|
+
});
|
|
8814
|
+
}
|
|
8815
|
+
|
|
8537
8816
|
/**
|
|
8538
8817
|
* Resolve the engine's `WorkflowAccess` for a client. Override wins
|
|
8539
8818
|
* outright; otherwise both halves are fetched in parallel and
|
|
@@ -8892,6 +9171,14 @@ declare const StateEntrySchema: v.StrictObjectSchema<
|
|
|
8892
9171
|
v.StringSchema<undefined>,
|
|
8893
9172
|
undefined
|
|
8894
9173
|
>;
|
|
9174
|
+
/**
|
|
9175
|
+
* When true, the caller MUST supply this entry at start (via
|
|
9176
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
9177
|
+
* missing required entry throws rather than silently defaulting to
|
|
9178
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
9179
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
9180
|
+
*/
|
|
9181
|
+
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
8895
9182
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
8896
9183
|
},
|
|
8897
9184
|
undefined
|
|
@@ -9365,6 +9652,33 @@ declare const StoredStageSchema: v.StrictObjectSchema<
|
|
|
9365
9652
|
>,
|
|
9366
9653
|
undefined
|
|
9367
9654
|
>;
|
|
9655
|
+
/**
|
|
9656
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
9657
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
9658
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
9659
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
9660
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
9661
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
9662
|
+
* and guards (content-write locks).
|
|
9663
|
+
*/
|
|
9664
|
+
requirements: v.OptionalSchema<
|
|
9665
|
+
v.RecordSchema<
|
|
9666
|
+
v.SchemaWithPipe<
|
|
9667
|
+
readonly [
|
|
9668
|
+
v.StringSchema<undefined>,
|
|
9669
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
9670
|
+
]
|
|
9671
|
+
>,
|
|
9672
|
+
v.SchemaWithPipe<
|
|
9673
|
+
readonly [
|
|
9674
|
+
v.StringSchema<undefined>,
|
|
9675
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
9676
|
+
]
|
|
9677
|
+
>,
|
|
9678
|
+
undefined
|
|
9679
|
+
>,
|
|
9680
|
+
undefined
|
|
9681
|
+
>;
|
|
9368
9682
|
/**
|
|
9369
9683
|
* Auto-completion condition — evaluated at activation and on every
|
|
9370
9684
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -10110,6 +10424,17 @@ declare const StoredStageSchema: v.StrictObjectSchema<
|
|
|
10110
10424
|
v.StringSchema<undefined>,
|
|
10111
10425
|
undefined
|
|
10112
10426
|
>;
|
|
10427
|
+
/**
|
|
10428
|
+
* When true, the caller MUST supply this entry at start (via
|
|
10429
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
10430
|
+
* missing required entry throws rather than silently defaulting to
|
|
10431
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
10432
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
10433
|
+
*/
|
|
10434
|
+
readonly required: v.OptionalSchema<
|
|
10435
|
+
v.BooleanSchema<undefined>,
|
|
10436
|
+
undefined
|
|
10437
|
+
>;
|
|
10113
10438
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
10114
10439
|
},
|
|
10115
10440
|
undefined
|
|
@@ -10553,6 +10878,17 @@ declare const StoredStageSchema: v.StrictObjectSchema<
|
|
|
10553
10878
|
v.StringSchema<undefined>,
|
|
10554
10879
|
undefined
|
|
10555
10880
|
>;
|
|
10881
|
+
/**
|
|
10882
|
+
* When true, the caller MUST supply this entry at start (via
|
|
10883
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
10884
|
+
* missing required entry throws rather than silently defaulting to
|
|
10885
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
10886
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
10887
|
+
*/
|
|
10888
|
+
readonly required: v.OptionalSchema<
|
|
10889
|
+
v.BooleanSchema<undefined>,
|
|
10890
|
+
undefined
|
|
10891
|
+
>;
|
|
10556
10892
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
10557
10893
|
},
|
|
10558
10894
|
undefined
|
|
@@ -10609,6 +10945,33 @@ declare const StoredTaskSchema: v.StrictObjectSchema<
|
|
|
10609
10945
|
>,
|
|
10610
10946
|
undefined
|
|
10611
10947
|
>;
|
|
10948
|
+
/**
|
|
10949
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
10950
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
10951
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
10952
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
10953
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
10954
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
10955
|
+
* and guards (content-write locks).
|
|
10956
|
+
*/
|
|
10957
|
+
requirements: v.OptionalSchema<
|
|
10958
|
+
v.RecordSchema<
|
|
10959
|
+
v.SchemaWithPipe<
|
|
10960
|
+
readonly [
|
|
10961
|
+
v.StringSchema<undefined>,
|
|
10962
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
10963
|
+
]
|
|
10964
|
+
>,
|
|
10965
|
+
v.SchemaWithPipe<
|
|
10966
|
+
readonly [
|
|
10967
|
+
v.StringSchema<undefined>,
|
|
10968
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
10969
|
+
]
|
|
10970
|
+
>,
|
|
10971
|
+
undefined
|
|
10972
|
+
>,
|
|
10973
|
+
undefined
|
|
10974
|
+
>;
|
|
10612
10975
|
/**
|
|
10613
10976
|
* Auto-completion condition — evaluated at activation and on every
|
|
10614
10977
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -11280,6 +11643,17 @@ declare const StoredTaskSchema: v.StrictObjectSchema<
|
|
|
11280
11643
|
v.StringSchema<undefined>,
|
|
11281
11644
|
undefined
|
|
11282
11645
|
>;
|
|
11646
|
+
/**
|
|
11647
|
+
* When true, the caller MUST supply this entry at start (via
|
|
11648
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
11649
|
+
* missing required entry throws rather than silently defaulting to
|
|
11650
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
11651
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
11652
|
+
*/
|
|
11653
|
+
readonly required: v.OptionalSchema<
|
|
11654
|
+
v.BooleanSchema<undefined>,
|
|
11655
|
+
undefined
|
|
11656
|
+
>;
|
|
11283
11657
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
11284
11658
|
},
|
|
11285
11659
|
undefined
|
|
@@ -11658,6 +12032,17 @@ export declare type StuckCause =
|
|
|
11658
12032
|
}
|
|
11659
12033
|
| {
|
|
11660
12034
|
kind: "no-transition-fires";
|
|
12035
|
+
}
|
|
12036
|
+
/**
|
|
12037
|
+
* Every task resolved, but an exit transition's filter is *unevaluable*
|
|
12038
|
+
* (GROQ `null` — a referenced operand is missing/unreadable), so selection
|
|
12039
|
+
* halts. Unlike {@link StuckCause} `no-transition-fires` this is recoverable:
|
|
12040
|
+
* the cascade re-fires once the operand resolves (e.g. the subject is
|
|
12041
|
+
* published or the field is filled). Carries the undecidable transitions.
|
|
12042
|
+
*/
|
|
12043
|
+
| {
|
|
12044
|
+
kind: "transition-unevaluable";
|
|
12045
|
+
transitions: string[];
|
|
11661
12046
|
};
|
|
11662
12047
|
|
|
11663
12048
|
/**
|
|
@@ -11773,6 +12158,17 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
|
|
|
11773
12158
|
undefined
|
|
11774
12159
|
>;
|
|
11775
12160
|
|
|
12161
|
+
export declare interface SuggestedRemediation {
|
|
12162
|
+
verb: RemediationVerb;
|
|
12163
|
+
/** True iff a consumer can run this as an engine operation today. `false`
|
|
12164
|
+
* marks a remediation we can name but not yet execute — a planned verb, or
|
|
12165
|
+
* an operational step (re-running the effect drainer). */
|
|
12166
|
+
available: boolean;
|
|
12167
|
+
/** Surface-neutral one-line rationale — no color or terminal symbols; a
|
|
12168
|
+
* consumer decorates it for its own surface. */
|
|
12169
|
+
rationale: string;
|
|
12170
|
+
}
|
|
12171
|
+
|
|
11776
12172
|
/**
|
|
11777
12173
|
* The engine's read-partition invariant as a GROQ predicate: a document is
|
|
11778
12174
|
* visible when its `tag` equals the caller's `$tag` param. The single
|
|
@@ -11811,6 +12207,13 @@ export declare interface TaskEntry {
|
|
|
11811
12207
|
filterEvaluation?: {
|
|
11812
12208
|
at: string;
|
|
11813
12209
|
truthy: boolean;
|
|
12210
|
+
/**
|
|
12211
|
+
* The filter evaluated to GROQ `null` — a referenced operand was missing
|
|
12212
|
+
* or incomparable, so it couldn't be decided. The engine fails closed
|
|
12213
|
+
* (keeps the task in scope) rather than reading this as a deliberate
|
|
12214
|
+
* `false`; `truthy` is `false` here but the task is NOT skipped.
|
|
12215
|
+
*/
|
|
12216
|
+
unevaluable?: boolean;
|
|
11814
12217
|
detail?: string;
|
|
11815
12218
|
};
|
|
11816
12219
|
/**
|
|
@@ -11829,6 +12232,13 @@ export declare interface TaskEvaluation {
|
|
|
11829
12232
|
status: TaskStatus;
|
|
11830
12233
|
/** Whether this task is the current actor's responsibility right now. */
|
|
11831
12234
|
pendingOnActor: boolean;
|
|
12235
|
+
/**
|
|
12236
|
+
* The task's unmet {@link Task.requirements}, by name — present iff at least
|
|
12237
|
+
* one is unmet. The task's own readiness summary: a consumer can explain why
|
|
12238
|
+
* the whole task is gated without inspecting each action (every action also
|
|
12239
|
+
* carries the matching `requirements-unmet` `disabledReason`).
|
|
12240
|
+
*/
|
|
12241
|
+
unmetRequirements?: string[];
|
|
11832
12242
|
actions: ActionEvaluation[];
|
|
11833
12243
|
}
|
|
11834
12244
|
|
|
@@ -11845,8 +12255,17 @@ export declare type Transition = v.InferOutput<typeof StoredTransitionSchema>;
|
|
|
11845
12255
|
|
|
11846
12256
|
export declare interface TransitionEvaluation {
|
|
11847
12257
|
transition: Transition;
|
|
11848
|
-
/**
|
|
12258
|
+
/** Whether the transition's filter is definitively satisfied at read time. */
|
|
11849
12259
|
filterSatisfied: boolean;
|
|
12260
|
+
/**
|
|
12261
|
+
* The filter evaluated to GROQ `null` — a referenced operand was missing or
|
|
12262
|
+
* incomparable, so it couldn't be decided. `filterSatisfied` is `false`, but
|
|
12263
|
+
* this is a *recoverable hold*, not a deliberate `false`: the engine halts
|
|
12264
|
+
* selection (it won't fall through to a later transition) and the cascade
|
|
12265
|
+
* re-fires once the operand resolves. Lets a diagnosis tell an undecidable
|
|
12266
|
+
* hold apart from a genuine routing dead-end.
|
|
12267
|
+
*/
|
|
12268
|
+
unevaluable: boolean;
|
|
11850
12269
|
}
|
|
11851
12270
|
|
|
11852
12271
|
export declare type TransitionOp = v.InferOutput<
|
|
@@ -12209,6 +12628,8 @@ export declare const WORKFLOW_DEFINITION_TYPE = "sanity.workflow.definition";
|
|
|
12209
12628
|
*/
|
|
12210
12629
|
export declare const WORKFLOW_INSTANCE_TYPE = "sanity.workflow.instance";
|
|
12211
12630
|
|
|
12631
|
+
declare const WORKFLOW_ROLES: readonly ["workflow", "child"];
|
|
12632
|
+
|
|
12212
12633
|
/**
|
|
12213
12634
|
* The engine's view of "who am I, what can I do?". `actor` is who
|
|
12214
12635
|
* the engine stamps onto history / `completedBy` / `Source.actor`.
|
|
@@ -12269,6 +12690,7 @@ export declare interface WorkflowClient {
|
|
|
12269
12690
|
},
|
|
12270
12691
|
>(
|
|
12271
12692
|
doc: T,
|
|
12693
|
+
options?: WorkflowCommitOptions,
|
|
12272
12694
|
) => Promise<T>;
|
|
12273
12695
|
/**
|
|
12274
12696
|
* Build a multi-document transaction. All operations succeed or fail
|
|
@@ -12321,6 +12743,21 @@ export declare interface WorkflowClient {
|
|
|
12321
12743
|
}) => Promise<T>;
|
|
12322
12744
|
}
|
|
12323
12745
|
|
|
12746
|
+
export declare interface WorkflowCommitOptions {
|
|
12747
|
+
/**
|
|
12748
|
+
* When the mutation becomes visible to subsequent queries. The engine
|
|
12749
|
+
* reads its own writes back through GROQ (`fetch`) — a freshly-spawned
|
|
12750
|
+
* child listed by id, a just-deployed definition — so single-document
|
|
12751
|
+
* writes (`create`, `patch().commit()`) commit `'sync'`: the change is
|
|
12752
|
+
* query-visible before the call resolves and the next read can't miss it.
|
|
12753
|
+
* `@sanity/client` already defaults to `'sync'`, but the engine states it
|
|
12754
|
+
* rather than depend on a transport default a consumer's client config
|
|
12755
|
+
* could change underneath it. (Transactions ride that same default — see
|
|
12756
|
+
* {@link WorkflowTransaction.commit}.)
|
|
12757
|
+
*/
|
|
12758
|
+
visibility?: WorkflowVisibility;
|
|
12759
|
+
}
|
|
12760
|
+
|
|
12324
12761
|
export declare type WorkflowDefinition = v.InferOutput<
|
|
12325
12762
|
typeof WorkflowDefinitionSchema
|
|
12326
12763
|
>;
|
|
@@ -12353,6 +12790,22 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
12353
12790
|
]
|
|
12354
12791
|
>;
|
|
12355
12792
|
description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
12793
|
+
/**
|
|
12794
|
+
* Whether a human may start this workflow standalone. `'child'` marks a
|
|
12795
|
+
* spawn-only definition — instantiated by a parent via `task.subworkflows`,
|
|
12796
|
+
* never started cold from a picker. Omitted ⇒ `'workflow'` (startable).
|
|
12797
|
+
* Advisory: consumers filter their start pickers on it (see
|
|
12798
|
+
* {@link isStartableDefinition}); the engine does NOT refuse a
|
|
12799
|
+
* `startInstance` on a `'child'` def — load-bearing `required` state is the
|
|
12800
|
+
* runtime backstop.
|
|
12801
|
+
*/
|
|
12802
|
+
role: v.OptionalSchema<
|
|
12803
|
+
v.PicklistSchema<
|
|
12804
|
+
readonly ["workflow", "child"],
|
|
12805
|
+
`Invalid option: expected one of ${string}`
|
|
12806
|
+
>,
|
|
12807
|
+
undefined
|
|
12808
|
+
>;
|
|
12356
12809
|
/** Reference field: named for the target, holds the stage's `name`. */
|
|
12357
12810
|
initialStage: v.SchemaWithPipe<
|
|
12358
12811
|
readonly [
|
|
@@ -12397,6 +12850,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
12397
12850
|
v.StringSchema<undefined>,
|
|
12398
12851
|
undefined
|
|
12399
12852
|
>;
|
|
12853
|
+
/**
|
|
12854
|
+
* When true, the caller MUST supply this entry at start (via
|
|
12855
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
12856
|
+
* missing required entry throws rather than silently defaulting to
|
|
12857
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
12858
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
12859
|
+
*/
|
|
12860
|
+
readonly required: v.OptionalSchema<
|
|
12861
|
+
v.BooleanSchema<undefined>,
|
|
12862
|
+
undefined
|
|
12863
|
+
>;
|
|
12400
12864
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
12401
12865
|
},
|
|
12402
12866
|
undefined
|
|
@@ -12463,6 +12927,41 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
12463
12927
|
>,
|
|
12464
12928
|
undefined
|
|
12465
12929
|
>;
|
|
12930
|
+
/**
|
|
12931
|
+
* Readiness gates, by name — conditions over the rendered scope that must
|
|
12932
|
+
* hold for the task to be *executable*, orthogonal to `filter`
|
|
12933
|
+
* (visibility). An unmet requirement keeps the task visible but disables
|
|
12934
|
+
* its actions with a `requirements-unmet` verdict naming the unmet keys;
|
|
12935
|
+
* all must hold (any-of lives inside one condition). Advisory like every
|
|
12936
|
+
* engine gate — the lake still enforces. Distinct from ACL (authorization)
|
|
12937
|
+
* and guards (content-write locks).
|
|
12938
|
+
*/
|
|
12939
|
+
requirements: v.OptionalSchema<
|
|
12940
|
+
v.RecordSchema<
|
|
12941
|
+
v.SchemaWithPipe<
|
|
12942
|
+
readonly [
|
|
12943
|
+
v.StringSchema<undefined>,
|
|
12944
|
+
v.MinLengthAction<
|
|
12945
|
+
string,
|
|
12946
|
+
1,
|
|
12947
|
+
"must be a non-empty string"
|
|
12948
|
+
>,
|
|
12949
|
+
]
|
|
12950
|
+
>,
|
|
12951
|
+
v.SchemaWithPipe<
|
|
12952
|
+
readonly [
|
|
12953
|
+
v.StringSchema<undefined>,
|
|
12954
|
+
v.MinLengthAction<
|
|
12955
|
+
string,
|
|
12956
|
+
1,
|
|
12957
|
+
"must be a non-empty string"
|
|
12958
|
+
>,
|
|
12959
|
+
]
|
|
12960
|
+
>,
|
|
12961
|
+
undefined
|
|
12962
|
+
>,
|
|
12963
|
+
undefined
|
|
12964
|
+
>;
|
|
12466
12965
|
/**
|
|
12467
12966
|
* Auto-completion condition — evaluated at activation and on every
|
|
12468
12967
|
* cascade; truthy flips the task to `done` with a system actor. On a
|
|
@@ -13246,6 +13745,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
13246
13745
|
v.StringSchema<undefined>,
|
|
13247
13746
|
undefined
|
|
13248
13747
|
>;
|
|
13748
|
+
/**
|
|
13749
|
+
* When true, the caller MUST supply this entry at start (via
|
|
13750
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
13751
|
+
* missing required entry throws rather than silently defaulting to
|
|
13752
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
13753
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
13754
|
+
*/
|
|
13755
|
+
readonly required: v.OptionalSchema<
|
|
13756
|
+
v.BooleanSchema<undefined>,
|
|
13757
|
+
undefined
|
|
13758
|
+
>;
|
|
13249
13759
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
13250
13760
|
},
|
|
13251
13761
|
undefined
|
|
@@ -13722,6 +14232,17 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
13722
14232
|
v.StringSchema<undefined>,
|
|
13723
14233
|
undefined
|
|
13724
14234
|
>;
|
|
14235
|
+
/**
|
|
14236
|
+
* When true, the caller MUST supply this entry at start (via
|
|
14237
|
+
* `initialState`) or spawn (via the parent's `subworkflows.with`). A
|
|
14238
|
+
* missing required entry throws rather than silently defaulting to
|
|
14239
|
+
* `null`/`[]` — the same fail-fast an action's `required` param gets.
|
|
14240
|
+
* Valid only on a workflow-scope `init`-sourced entry (deploy invariant).
|
|
14241
|
+
*/
|
|
14242
|
+
readonly required: v.OptionalSchema<
|
|
14243
|
+
v.BooleanSchema<undefined>,
|
|
14244
|
+
undefined
|
|
14245
|
+
>;
|
|
13725
14246
|
readonly source: v.GenericSchema<SourceInternal>;
|
|
13726
14247
|
},
|
|
13727
14248
|
undefined
|
|
@@ -13747,6 +14268,11 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
13747
14268
|
description?: string | undefined;
|
|
13748
14269
|
activation?: "auto" | "manual" | undefined;
|
|
13749
14270
|
filter?: string | undefined;
|
|
14271
|
+
requirements?:
|
|
14272
|
+
| {
|
|
14273
|
+
[x: string]: string;
|
|
14274
|
+
}
|
|
14275
|
+
| undefined;
|
|
13750
14276
|
completeWhen?: string | undefined;
|
|
13751
14277
|
failWhen?: string | undefined;
|
|
13752
14278
|
ops?:
|
|
@@ -13955,6 +14481,7 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
13955
14481
|
name: string;
|
|
13956
14482
|
title?: string | undefined;
|
|
13957
14483
|
description?: string | undefined;
|
|
14484
|
+
required?: boolean | undefined;
|
|
13958
14485
|
source: SourceInternal;
|
|
13959
14486
|
}[]
|
|
13960
14487
|
| undefined;
|
|
@@ -14074,6 +14601,7 @@ declare const WorkflowDefinitionSchema: v.StrictObjectSchema<
|
|
|
14074
14601
|
name: string;
|
|
14075
14602
|
title?: string | undefined;
|
|
14076
14603
|
description?: string | undefined;
|
|
14604
|
+
required?: boolean | undefined;
|
|
14077
14605
|
source: SourceInternal;
|
|
14078
14606
|
}[]
|
|
14079
14607
|
| undefined;
|
|
@@ -14225,7 +14753,7 @@ export declare interface WorkflowPatch {
|
|
|
14225
14753
|
setIfMissing: (props: Record<string, unknown>) => WorkflowPatch;
|
|
14226
14754
|
unset: (paths: string[]) => WorkflowPatch;
|
|
14227
14755
|
ifRevisionId: (rev: string) => WorkflowPatch;
|
|
14228
|
-
commit: () => Promise<SanityDocument>;
|
|
14756
|
+
commit: (options?: WorkflowCommitOptions) => Promise<SanityDocument>;
|
|
14229
14757
|
}
|
|
14230
14758
|
|
|
14231
14759
|
/**
|
|
@@ -14270,13 +14798,18 @@ export declare type WorkflowResource =
|
|
|
14270
14798
|
id: string;
|
|
14271
14799
|
};
|
|
14272
14800
|
|
|
14801
|
+
/** A definition's lifecycle role. `'child'` is spawn-only — see {@link isStartableDefinition}. */
|
|
14802
|
+
export declare type WorkflowRole = (typeof WORKFLOW_ROLES)[number];
|
|
14803
|
+
|
|
14273
14804
|
/**
|
|
14274
14805
|
* Thrown when a guard deploy fails *after* its state move committed and the
|
|
14275
|
-
* engine could not
|
|
14276
|
-
*
|
|
14277
|
-
*
|
|
14278
|
-
*
|
|
14279
|
-
*
|
|
14806
|
+
* engine could not cleanly undo the result — any of: the rollback write itself
|
|
14807
|
+
* failed; the move created sibling docs (spawn) that a parent-only rollback
|
|
14808
|
+
* cannot undo; or a multi-guard deploy partially applied, so even a clean state
|
|
14809
|
+
* rollback leaves the earlier guards orphaned ({@link PartialGuardDeployError}).
|
|
14810
|
+
* The workflow's persisted state and its deployed guards are now divergent and
|
|
14811
|
+
* need manual reconciliation; the engine screams rather than leaving the
|
|
14812
|
+
* inconsistency silent.
|
|
14280
14813
|
*/
|
|
14281
14814
|
export declare class WorkflowStateDivergedError extends Error {
|
|
14282
14815
|
readonly instanceId: string;
|
|
@@ -14326,7 +14859,20 @@ export declare interface WorkflowTransaction {
|
|
|
14326
14859
|
* carry this shape.
|
|
14327
14860
|
*/
|
|
14328
14861
|
delete: (id: string) => WorkflowTransaction;
|
|
14862
|
+
/**
|
|
14863
|
+
* Commit the batch. No options — a transaction rides the client's *default*
|
|
14864
|
+
* `visibility`: `'sync'` in `@sanity/client` (so a post-spawn `listInstances`
|
|
14865
|
+
* GROQ sees freshly-created children), immediate in the in-memory test fake.
|
|
14866
|
+
* This is a standing engine assumption — a consumer that configured an
|
|
14867
|
+
* `async` default would make spawn read-backs racy. Single-document writes
|
|
14868
|
+
* state `'sync'` explicitly via {@link WorkflowCommitOptions}; transactions
|
|
14869
|
+
* can't (yet) — the test fake's commit options don't carry `visibility`, and
|
|
14870
|
+
* per repo convention that gap is closed upstream in the fake, not worked
|
|
14871
|
+
* around here.
|
|
14872
|
+
*/
|
|
14329
14873
|
commit: () => Promise<unknown>;
|
|
14330
14874
|
}
|
|
14331
14875
|
|
|
14876
|
+
export declare type WorkflowVisibility = "sync" | "async" | "deferred";
|
|
14877
|
+
|
|
14332
14878
|
export {};
|