@sanity/workflow-engine 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/DATAMODEL.md +53 -0
- package/dist/_chunks-cjs/invariants.cjs +138 -28
- package/dist/_chunks-es/invariants.js +138 -28
- package/dist/define.d.cts +232 -30
- package/dist/define.d.ts +232 -30
- package/dist/index.cjs +2586 -1930
- package/dist/index.d.cts +545 -75
- package/dist/index.d.ts +545 -75
- package/dist/index.js +2607 -1967
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -140,6 +140,19 @@ export declare interface ActionEvaluation {
|
|
|
140
140
|
triggered?: true;
|
|
141
141
|
/** Present iff `allowed === false`. The first failing gate wins. */
|
|
142
142
|
disabledReason?: DisabledReason;
|
|
143
|
+
/**
|
|
144
|
+
* What firing this action would do to the flow RIGHT NOW — the fire
|
|
145
|
+
* replayed in memory on the engine's own machinery (ops, the triggered
|
|
146
|
+
* fixpoint, transition selection) against this projection's state, and
|
|
147
|
+
* conditional on the commit landing (rejectability is `allowed` /
|
|
148
|
+
* `disabledReason`'s story). Omitted when the consequence depends on
|
|
149
|
+
* inputs the projection doesn't hold — caller params, a spawn's
|
|
150
|
+
* dataset-driven fan-out, a terminal instance, a stage visit whose
|
|
151
|
+
* entries have diverged from the pinned definition — and on cascade-fired
|
|
152
|
+
* actions, which are never a caller's to fire. Advisory like every
|
|
153
|
+
* derived verdict: a placement/phrasing hint, never a gate.
|
|
154
|
+
*/
|
|
155
|
+
firing?: FiringConsequence;
|
|
143
156
|
/** Derived state of the action's `filter` gate — why it holds or fails,
|
|
144
157
|
* atom by atom. Present iff the action declares a filter. */
|
|
145
158
|
insight?: ConditionInsight;
|
|
@@ -190,7 +203,7 @@ declare const ActionParamSchema: v.SchemaWithPipe<
|
|
|
190
203
|
"doc.refs",
|
|
191
204
|
"json",
|
|
192
205
|
],
|
|
193
|
-
|
|
206
|
+
string
|
|
194
207
|
>;
|
|
195
208
|
readonly name: v.SchemaWithPipe<
|
|
196
209
|
readonly [
|
|
@@ -734,10 +747,7 @@ declare type AuthoringFieldRef = v.InferOutput<typeof AuthoringFieldRefSchema>;
|
|
|
734
747
|
declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
|
|
735
748
|
{
|
|
736
749
|
readonly scope: v.OptionalSchema<
|
|
737
|
-
v.PicklistSchema<
|
|
738
|
-
readonly ["workflow", "stage", "activity"],
|
|
739
|
-
`Invalid option: expected one of ${string}`
|
|
740
|
-
>,
|
|
750
|
+
v.PicklistSchema<readonly ["workflow", "stage", "activity"], string>,
|
|
741
751
|
undefined
|
|
742
752
|
>;
|
|
743
753
|
readonly field: v.SchemaWithPipe<
|
|
@@ -903,7 +913,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
|
|
|
903
913
|
v.ArraySchema<
|
|
904
914
|
v.PicklistSchema<
|
|
905
915
|
readonly ["create", "update", "delete", "publish", "unpublish"],
|
|
906
|
-
|
|
916
|
+
string
|
|
907
917
|
>,
|
|
908
918
|
undefined
|
|
909
919
|
>,
|
|
@@ -1078,7 +1088,7 @@ declare const AuthoringManualTargetSchema: v.VariantSchema<
|
|
|
1078
1088
|
readonly scope: v.OptionalSchema<
|
|
1079
1089
|
v.PicklistSchema<
|
|
1080
1090
|
readonly ["workflow", "stage", "activity"],
|
|
1081
|
-
|
|
1091
|
+
string
|
|
1082
1092
|
>,
|
|
1083
1093
|
undefined
|
|
1084
1094
|
>;
|
|
@@ -1114,7 +1124,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1114
1124
|
readonly scope: v.OptionalSchema<
|
|
1115
1125
|
v.PicklistSchema<
|
|
1116
1126
|
readonly ["workflow", "stage", "activity"],
|
|
1117
|
-
|
|
1127
|
+
string
|
|
1118
1128
|
>,
|
|
1119
1129
|
undefined
|
|
1120
1130
|
>;
|
|
@@ -1139,7 +1149,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1139
1149
|
readonly scope: v.OptionalSchema<
|
|
1140
1150
|
v.PicklistSchema<
|
|
1141
1151
|
readonly ["workflow", "stage", "activity"],
|
|
1142
|
-
|
|
1152
|
+
string
|
|
1143
1153
|
>,
|
|
1144
1154
|
undefined
|
|
1145
1155
|
>;
|
|
@@ -1163,7 +1173,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1163
1173
|
readonly scope: v.OptionalSchema<
|
|
1164
1174
|
v.PicklistSchema<
|
|
1165
1175
|
readonly ["workflow", "stage", "activity"],
|
|
1166
|
-
|
|
1176
|
+
string
|
|
1167
1177
|
>,
|
|
1168
1178
|
undefined
|
|
1169
1179
|
>;
|
|
@@ -1188,7 +1198,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1188
1198
|
readonly scope: v.OptionalSchema<
|
|
1189
1199
|
v.PicklistSchema<
|
|
1190
1200
|
readonly ["workflow", "stage", "activity"],
|
|
1191
|
-
|
|
1201
|
+
string
|
|
1192
1202
|
>,
|
|
1193
1203
|
undefined
|
|
1194
1204
|
>;
|
|
@@ -1219,7 +1229,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1219
1229
|
readonly scope: v.OptionalSchema<
|
|
1220
1230
|
v.PicklistSchema<
|
|
1221
1231
|
readonly ["workflow", "stage", "activity"],
|
|
1222
|
-
|
|
1232
|
+
string
|
|
1223
1233
|
>,
|
|
1224
1234
|
undefined
|
|
1225
1235
|
>;
|
|
@@ -1255,7 +1265,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1255
1265
|
>;
|
|
1256
1266
|
readonly status: v.PicklistSchema<
|
|
1257
1267
|
readonly ["active", "done", "skipped", "failed"],
|
|
1258
|
-
|
|
1268
|
+
string
|
|
1259
1269
|
>;
|
|
1260
1270
|
},
|
|
1261
1271
|
undefined
|
|
@@ -1268,7 +1278,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
|
|
|
1268
1278
|
readonly scope: v.OptionalSchema<
|
|
1269
1279
|
v.PicklistSchema<
|
|
1270
1280
|
readonly ["workflow", "stage", "activity"],
|
|
1271
|
-
|
|
1281
|
+
string
|
|
1272
1282
|
>,
|
|
1273
1283
|
undefined
|
|
1274
1284
|
>;
|
|
@@ -1672,6 +1682,42 @@ declare type Clocked<T> = T & {
|
|
|
1672
1682
|
clock?: Clock;
|
|
1673
1683
|
};
|
|
1674
1684
|
|
|
1685
|
+
declare interface CommitEffectOpsArgs extends DedupableOperationArgs {
|
|
1686
|
+
/** The `_key` of the pending effect being reported on. */
|
|
1687
|
+
effectKey: string;
|
|
1688
|
+
/**
|
|
1689
|
+
* Required here, unlike the other dedupable verbs: the engine cannot
|
|
1690
|
+
* assume a supplied field op is idempotent, so every mid-dispatch report
|
|
1691
|
+
* must be retry-safe. (The runtime check remains for untyped callers.)
|
|
1692
|
+
*/
|
|
1693
|
+
idempotencyKey: string;
|
|
1694
|
+
/**
|
|
1695
|
+
* The exact-claim identity handed to the reporting dispatch. The commit
|
|
1696
|
+
* re-reads the instance and rejects (writing nothing) unless the entry's
|
|
1697
|
+
* live claim carries this token unexpired — so an expired, released, or
|
|
1698
|
+
* superseded handler cannot update state. A successful commit renews the
|
|
1699
|
+
* claim's lease.
|
|
1700
|
+
*/
|
|
1701
|
+
claimToken: string;
|
|
1702
|
+
/**
|
|
1703
|
+
* Mid-dispatch field state, `field.*` ops only — validated and applied
|
|
1704
|
+
* exactly like completion ops (same applier, same target resolution
|
|
1705
|
+
* against the current open stage, workflow-/stage-scope only, never
|
|
1706
|
+
* `status.set`). Must be non-empty. Completion ops remain the final
|
|
1707
|
+
* atomic result committed when the handler returns; these are separately
|
|
1708
|
+
* committed and observable before it.
|
|
1709
|
+
*/
|
|
1710
|
+
ops: FieldOp[];
|
|
1711
|
+
/** Lease duration the successful commit renews the claim to — the
|
|
1712
|
+
* drain's `effectLeaseMs`. Default `DEFAULT_EFFECT_LEASE_MS` (5 min). */
|
|
1713
|
+
leaseMs?: number;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
export declare interface CommitOpsRequest {
|
|
1717
|
+
ops: FieldOp[];
|
|
1718
|
+
idempotencyKey: string;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1675
1721
|
export { ComparisonOp };
|
|
1676
1722
|
|
|
1677
1723
|
/**
|
|
@@ -1749,6 +1795,20 @@ export declare function computeDiffEntries<
|
|
|
1749
1795
|
target: DeployTarget;
|
|
1750
1796
|
}): Promise<DiffEntry[]>;
|
|
1751
1797
|
|
|
1798
|
+
/** {@link ConcurrentCompleteEffectError}'s mid-dispatch sibling: a
|
|
1799
|
+
* `commitEffectOps` commit lost every optimistic-locking attempt. Nothing
|
|
1800
|
+
* was written; the report may be retried under the same idempotency key. */
|
|
1801
|
+
export declare class ConcurrentCommitEffectOpsError extends WorkflowError<"concurrent-commit-effect-ops"> {
|
|
1802
|
+
readonly instanceId: string;
|
|
1803
|
+
readonly effectKey: string;
|
|
1804
|
+
readonly attempts: number;
|
|
1805
|
+
constructor(args: {
|
|
1806
|
+
instanceId: string;
|
|
1807
|
+
effectKey: string;
|
|
1808
|
+
attempts: number;
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1752
1812
|
/**
|
|
1753
1813
|
* Completion twin of {@link ConcurrentFireActionError}: a `completeEffect`
|
|
1754
1814
|
* commit lost the optimistic-locking race on every attempt. Same contract —
|
|
@@ -1934,10 +1994,9 @@ export declare type ConditionVarBinding = "always" | "caller" | "spawn";
|
|
|
1934
1994
|
|
|
1935
1995
|
/**
|
|
1936
1996
|
* The one-doc read a reactive adapter subscribes with to observe a content doc
|
|
1937
|
-
* under a perspective stack
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1940
|
-
* exists only as a draft (or only inside a release) still visible.
|
|
1997
|
+
* under a perspective stack. It uses the same perspective semantics as
|
|
1998
|
+
* {@link hydrateSnapshot}: draft/version content is projected onto the published
|
|
1999
|
+
* id, and a doc that exists only as a draft or release version remains visible.
|
|
1941
2000
|
*/
|
|
1942
2001
|
export declare function contentDocQuery(documentId: string): CompiledQuery;
|
|
1943
2002
|
|
|
@@ -2221,6 +2280,24 @@ export declare const DATA_MODEL_CHANGES: readonly [
|
|
|
2221
2280
|
applicability: "detectable";
|
|
2222
2281
|
summary: "String, text, and number values may carry persisted inclusive bounds.";
|
|
2223
2282
|
}>,
|
|
2283
|
+
Readonly<{
|
|
2284
|
+
id: "progress-field-kind";
|
|
2285
|
+
introducedInModel: 3;
|
|
2286
|
+
minReaderModel: 0;
|
|
2287
|
+
documentTypes: readonly ["definition", "instance"];
|
|
2288
|
+
compatibility: "additive";
|
|
2289
|
+
applicability: "detectable";
|
|
2290
|
+
summary: "A progress field kind carries application-defined 0–100 completion.";
|
|
2291
|
+
}>,
|
|
2292
|
+
Readonly<{
|
|
2293
|
+
id: "effect-claim-tokens";
|
|
2294
|
+
introducedInModel: 3;
|
|
2295
|
+
minReaderModel: 0;
|
|
2296
|
+
documentTypes: readonly ["instance"];
|
|
2297
|
+
compatibility: "additive";
|
|
2298
|
+
applicability: "detectable";
|
|
2299
|
+
summary: "Pending-effect claims carry an exact-claim token gating mid-dispatch state reports.";
|
|
2300
|
+
}>,
|
|
2224
2301
|
];
|
|
2225
2302
|
|
|
2226
2303
|
/**
|
|
@@ -2245,7 +2322,7 @@ export declare const DATA_MODEL_MIN_READER = 2;
|
|
|
2245
2322
|
* job. Declare every bump in `DATAMODEL.md`; the model-surface snapshot test
|
|
2246
2323
|
* keeps undeclared drift red.
|
|
2247
2324
|
*/
|
|
2248
|
-
export declare const DATA_MODEL_VERSION =
|
|
2325
|
+
export declare const DATA_MODEL_VERSION = 3;
|
|
2249
2326
|
|
|
2250
2327
|
export declare interface DataModelChange {
|
|
2251
2328
|
readonly id: string;
|
|
@@ -2278,9 +2355,10 @@ export declare type DeclaredExecutionContext = Pick<
|
|
|
2278
2355
|
|
|
2279
2356
|
/**
|
|
2280
2357
|
* The {@link OperationArgs} of the verbs that own a discrete commit —
|
|
2281
|
-
* `fireAction`, `editField`, `completeEffect`, `
|
|
2282
|
-
* `tick` deliberately takes the plain base: it owns no
|
|
2283
|
-
* re-derives everything, so retrying it blind is
|
|
2358
|
+
* `fireAction`, `editField`, `completeEffect`, `commitEffectOps`, `setStage`,
|
|
2359
|
+
* `abortInstance`. `tick` deliberately takes the plain base: it owns no
|
|
2360
|
+
* commit of its own and re-derives everything, so retrying it blind is
|
|
2361
|
+
* already safe.
|
|
2284
2362
|
*/
|
|
2285
2363
|
export declare interface DedupableOperationArgs extends OperationArgs {
|
|
2286
2364
|
/**
|
|
@@ -3285,6 +3363,16 @@ export declare type EditMode = "set" | "append" | "unset";
|
|
|
3285
3363
|
|
|
3286
3364
|
export declare type Effect = v.InferOutput<typeof EffectSchema>;
|
|
3287
3365
|
|
|
3366
|
+
/** Total commits one dispatch may make — the runaway-handler bound: without
|
|
3367
|
+
* it, a looping reporter renews its own lease and appends history forever.
|
|
3368
|
+
* 2× the ceiling of 1%-granularity progress reporting. */
|
|
3369
|
+
export declare const EFFECT_COMMIT_DISPATCH_CAP = 200;
|
|
3370
|
+
|
|
3371
|
+
/** Pending mid-dispatch commits one dispatch may hold before `commitOps` /
|
|
3372
|
+
* `setProgress` throws synchronously. An awaiting handler never reaches it
|
|
3373
|
+
* (its queue depth stays ≤ 1). */
|
|
3374
|
+
export declare const EFFECT_COMMIT_QUEUE_DEPTH = 32;
|
|
3375
|
+
|
|
3288
3376
|
/**
|
|
3289
3377
|
* Every terminal state an effect run can record. `done` and `failed` are
|
|
3290
3378
|
* reported through completion ({@link EffectCompletionStatus}); `cancelled`
|
|
@@ -3294,6 +3382,22 @@ export declare type Effect = v.InferOutput<typeof EffectSchema>;
|
|
|
3294
3382
|
*/
|
|
3295
3383
|
declare const EFFECT_RUN_STATUSES: readonly ["done", "failed", "cancelled"];
|
|
3296
3384
|
|
|
3385
|
+
/**
|
|
3386
|
+
* A `ctx.commitOps` / `ctx.setProgress` call hit one of the dispatch's
|
|
3387
|
+
* bounds. Thrown synchronously at the call site — see the module doc for why
|
|
3388
|
+
* a rejection would be invisible to exactly the caller the bound exists for.
|
|
3389
|
+
*/
|
|
3390
|
+
export declare class EffectCommitQueueOverflowError extends WorkflowError<"effect-commit-queue-overflow"> {
|
|
3391
|
+
readonly effectKey: string;
|
|
3392
|
+
readonly bound: "queue-depth" | "dispatch-cap";
|
|
3393
|
+
readonly limit: number;
|
|
3394
|
+
constructor(args: {
|
|
3395
|
+
effectKey: string;
|
|
3396
|
+
bound: "queue-depth" | "dispatch-cap";
|
|
3397
|
+
limit: number;
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3297
3401
|
/** The outcomes a completer may report through `completeEffect` — a run
|
|
3298
3402
|
* either succeeded or failed. `cancelled` is not reportable: only an abort
|
|
3299
3403
|
* stamps it, on entries that never dispatched. */
|
|
@@ -3349,11 +3453,13 @@ export declare type EffectHandler<
|
|
|
3349
3453
|
*/
|
|
3350
3454
|
declare type EffectHandlerContext<Client extends WorkflowClient> = {
|
|
3351
3455
|
/**
|
|
3352
|
-
*
|
|
3353
|
-
* workflow resource
|
|
3354
|
-
*
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3456
|
+
* A concrete sibling of the client supplied to `createEngine`, bound to the
|
|
3457
|
+
* workflow resource with the same namespaces and credentials. Untagged
|
|
3458
|
+
* handler requests on its workflow-client surface carry the `workflow.effect`
|
|
3459
|
+
* request tag by default. A concrete client's explicit tags compose beneath
|
|
3460
|
+
* that prefix. On the structural fallback for minimal clients, pass-through
|
|
3461
|
+
* namespaces are not stamped and core builders expose the engine's minimal
|
|
3462
|
+
* workflow-client surface.
|
|
3357
3463
|
*/
|
|
3358
3464
|
client: Client;
|
|
3359
3465
|
/**
|
|
@@ -3369,8 +3475,8 @@ declare type EffectHandlerContext<Client extends WorkflowClient> = {
|
|
|
3369
3475
|
* {@link GlobalDocumentReference}. Returns the `resourceClients` client
|
|
3370
3476
|
* for that resource when one is mapped, {@link client} for the workflow
|
|
3371
3477
|
* resource itself, and a sibling derived from {@link client}'s
|
|
3372
|
-
* credentials otherwise.
|
|
3373
|
-
*
|
|
3478
|
+
* credentials otherwise. Returned clients preserve their concrete APIs and
|
|
3479
|
+
* apply the same default effect request tag.
|
|
3374
3480
|
* Throws if `ref` isn't a GDR — a bare id can't
|
|
3375
3481
|
* be routed, so failing loud beats silently patching the wrong dataset.
|
|
3376
3482
|
*/
|
|
@@ -3378,6 +3484,34 @@ declare type EffectHandlerContext<Client extends WorkflowClient> = {
|
|
|
3378
3484
|
instanceId: string;
|
|
3379
3485
|
effectKey: string;
|
|
3380
3486
|
log: (message: string, extra?: Record<string, unknown>) => void;
|
|
3487
|
+
/**
|
|
3488
|
+
* Commit mid-dispatch field state as a real engine transaction —
|
|
3489
|
+
* validated like completion ops (`field.*` only, never `status.set`),
|
|
3490
|
+
* gated on THIS dispatch's exact claim (a stale/superseded claim
|
|
3491
|
+
* rejects before writing), history + idempotency recorded, guards
|
|
3492
|
+
* refreshed, cascade run, and the claim's lease renewed in the same
|
|
3493
|
+
* commit. Calls enqueue synchronously into a bounded per-dispatch FIFO
|
|
3494
|
+
* and execute strictly in call order, one at a time — forgetting to
|
|
3495
|
+
* `await` cannot create same-handler write races, and overflow (or the
|
|
3496
|
+
* per-dispatch commit cap) throws synchronously at the call site.
|
|
3497
|
+
* Await each call anyway: that is where errors surface promptly and
|
|
3498
|
+
* engine commit latency paces the reporter. `idempotencyKey` is
|
|
3499
|
+
* required — the engine does not assume a supplied op is idempotent.
|
|
3500
|
+
* An accepted-but-unawaited commit that fails still fails the effect
|
|
3501
|
+
* at settlement; the final completion always waits for this queue to
|
|
3502
|
+
* drain. Never coalesced.
|
|
3503
|
+
*/
|
|
3504
|
+
commitOps: (req: CommitOpsRequest) => Promise<void>;
|
|
3505
|
+
/**
|
|
3506
|
+
* Report absolute progress — sugar over {@link commitOps} that
|
|
3507
|
+
* `field.set`s a number (a `progress` field's 0–100 contract is
|
|
3508
|
+
* enforced by the engine at commit). A bare string targets a
|
|
3509
|
+
* workflow-scope field; pass `{scope: 'stage', field}` for stage
|
|
3510
|
+
* scope. Unlike `commitOps`, PENDING sets to the same field coalesce
|
|
3511
|
+
* (latest value wins, one commit), so a tight reporting loop is safe
|
|
3512
|
+
* by construction; idempotency keys are engine-derived.
|
|
3513
|
+
*/
|
|
3514
|
+
setProgress: (target: ProgressTarget, value: number) => Promise<void>;
|
|
3381
3515
|
};
|
|
3382
3516
|
|
|
3383
3517
|
export declare interface EffectHistoryEntry {
|
|
@@ -3579,6 +3713,10 @@ export declare interface Engine {
|
|
|
3579
3713
|
* reassign / reschedule / claim-by-hand / append-to-log, then cascade. */
|
|
3580
3714
|
editField: (args: EditFieldArgs) => Promise<OperationResult>;
|
|
3581
3715
|
completeEffect: (args: CompleteEffectArgs) => Promise<OperationResult>;
|
|
3716
|
+
/** Commit mid-dispatch field state from a running effect handler — the
|
|
3717
|
+
* verb behind `ctx.commitOps`. Gated on the dispatch's exact claim token;
|
|
3718
|
+
* a successful commit renews the claim's lease. */
|
|
3719
|
+
commitEffectOps: (args: CommitEffectOpsArgs) => Promise<OperationResult>;
|
|
3582
3720
|
tick: (args: OperationArgs) => Promise<OperationResult>;
|
|
3583
3721
|
/** Project the instance from an actor's perspective — per-action verdicts
|
|
3584
3722
|
* with structured disabled reasons. Pure read. */
|
|
@@ -3705,10 +3843,10 @@ export declare interface Engine {
|
|
|
3705
3843
|
* {@link WorkflowClient.withConfig}, and `resourceClients`-resolved clients
|
|
3706
3844
|
* are rebound the same way. A caller's configured `apiVersion` therefore
|
|
3707
3845
|
* never reaches engine-owned traffic (the caller's own client instance is
|
|
3708
|
-
* untouched). Effect handlers
|
|
3709
|
-
*
|
|
3710
|
-
* cannot be rebound — it must be built to serve
|
|
3711
|
-
* {@link WorkflowClient.withConfig}.
|
|
3846
|
+
* untouched). Effect handlers keep the caller's `apiVersion`; their derived
|
|
3847
|
+
* clients change only the request-tag prefix. The other exception is a client
|
|
3848
|
+
* that lacks `withConfig` and so cannot be rebound — it must be built to serve
|
|
3849
|
+
* this version; see {@link WorkflowClient.withConfig}.
|
|
3712
3850
|
*/
|
|
3713
3851
|
export declare const ENGINE_API_VERSION = "2026-04-29";
|
|
3714
3852
|
|
|
@@ -4117,6 +4255,10 @@ export declare const FIELD_KIND_DISPLAY: {
|
|
|
4117
4255
|
title: string;
|
|
4118
4256
|
description: string;
|
|
4119
4257
|
};
|
|
4258
|
+
progress: {
|
|
4259
|
+
title: string;
|
|
4260
|
+
description: string;
|
|
4261
|
+
};
|
|
4120
4262
|
boolean: {
|
|
4121
4263
|
title: string;
|
|
4122
4264
|
description: string;
|
|
@@ -4174,6 +4316,7 @@ declare const FIELD_VALUE_KINDS: readonly [
|
|
|
4174
4316
|
"string",
|
|
4175
4317
|
"text",
|
|
4176
4318
|
"number",
|
|
4319
|
+
"progress",
|
|
4177
4320
|
"boolean",
|
|
4178
4321
|
"date",
|
|
4179
4322
|
"datetime",
|
|
@@ -4314,6 +4457,10 @@ export declare interface FieldValueMap {
|
|
|
4314
4457
|
/** Multiline string — same value as {@link FieldValueMap.string}, distinct kind for rendering. */
|
|
4315
4458
|
text: string | null;
|
|
4316
4459
|
number: number | null;
|
|
4460
|
+
/** Application-defined 0–100 completion — same stored value as
|
|
4461
|
+
* {@link FieldValueMap.number}, distinct kind so surfaces can elevate it;
|
|
4462
|
+
* always finite and within 0–100 inclusive (fractions allowed). */
|
|
4463
|
+
progress: number | null;
|
|
4317
4464
|
boolean: boolean | null;
|
|
4318
4465
|
/** Date-only (`YYYY-MM-DD`), no time component. */
|
|
4319
4466
|
date: string | null;
|
|
@@ -4411,6 +4558,20 @@ export declare interface FireActionArgs extends DedupableOperationArgs {
|
|
|
4411
4558
|
idempotent?: boolean;
|
|
4412
4559
|
}
|
|
4413
4560
|
|
|
4561
|
+
/**
|
|
4562
|
+
* The flow consequence of one caller fire, computed by replaying it in
|
|
4563
|
+
* memory through the same machinery a real commit runs — never by a
|
|
4564
|
+
* parallel model of it. State-dependent: it answers "now", not "always".
|
|
4565
|
+
*/
|
|
4566
|
+
export declare interface FiringConsequence {
|
|
4567
|
+
/** The replayed commit's cascade exits the current stage in its first
|
|
4568
|
+
* hop. `false` is a definite answer for the current state — including
|
|
4569
|
+
* a selection halted by an unevaluable trigger, which holds the stage. */
|
|
4570
|
+
exitsStage: boolean;
|
|
4571
|
+
/** The transition the selection picked, present iff `exitsStage`. */
|
|
4572
|
+
transition?: string;
|
|
4573
|
+
}
|
|
4574
|
+
|
|
4414
4575
|
export { formatRead };
|
|
4415
4576
|
|
|
4416
4577
|
/**
|
|
@@ -4663,7 +4824,7 @@ export declare type GuardAction = v.InferOutput<typeof GuardActionSchema>;
|
|
|
4663
4824
|
|
|
4664
4825
|
declare const GuardActionSchema: v.PicklistSchema<
|
|
4665
4826
|
readonly ["create", "update", "delete", "publish", "unpublish"],
|
|
4666
|
-
|
|
4827
|
+
string
|
|
4667
4828
|
>;
|
|
4668
4829
|
|
|
4669
4830
|
export declare type GuardMatch = Guard["match"];
|
|
@@ -4828,7 +4989,7 @@ declare const GuardSchema: v.StrictObjectSchema<
|
|
|
4828
4989
|
v.ArraySchema<
|
|
4829
4990
|
v.PicklistSchema<
|
|
4830
4991
|
readonly ["create", "update", "delete", "publish", "unpublish"],
|
|
4831
|
-
|
|
4992
|
+
string
|
|
4832
4993
|
>,
|
|
4833
4994
|
undefined
|
|
4834
4995
|
>,
|
|
@@ -5364,13 +5525,14 @@ export declare type InsightSite =
|
|
|
5364
5525
|
export declare function instanceDocId(tag: string): string;
|
|
5365
5526
|
|
|
5366
5527
|
/**
|
|
5367
|
-
* The per-instance guard filter —
|
|
5368
|
-
*
|
|
5369
|
-
*
|
|
5370
|
-
*
|
|
5371
|
-
*
|
|
5372
|
-
*
|
|
5373
|
-
*
|
|
5528
|
+
* The per-instance guard filter — "this instance's guards in one datasource".
|
|
5529
|
+
* The engine's verdict load ({@link verdictGuardsForInstance}) fetches it once
|
|
5530
|
+
* against the engine datasource, and {@link guardsForInstance} unions it
|
|
5531
|
+
* across datasources for housekeeping; the reactive adapters subscribe the
|
|
5532
|
+
* set-shaped {@link instancesGuardQuery} this delegates to (one shared
|
|
5533
|
+
* live query per resource, sliced per `sourceInstanceId`), so every path
|
|
5534
|
+
* reads through one filter definition. Ordinary stage retraction deletes
|
|
5535
|
+
* guards, so results represent active persisted guard documents.
|
|
5374
5536
|
*/
|
|
5375
5537
|
export declare function instanceGuardQuery(instanceId: string): CompiledQuery;
|
|
5376
5538
|
|
|
@@ -5423,6 +5585,12 @@ export declare interface InstanceSession {
|
|
|
5423
5585
|
* docs are processed), never from the commit itself — the commit's
|
|
5424
5586
|
* outcome is never masked by a store echo's failure. */
|
|
5425
5587
|
update(docs: LoadedDoc[]): void;
|
|
5588
|
+
/** Replace one held document without rebuilding the rest of the overlay.
|
|
5589
|
+
* Consumers with per-document streams use this after the initial
|
|
5590
|
+
* {@link InstanceSession.update} snapshot. Self-doc recency, commit-time
|
|
5591
|
+
* buffering, and deferred buffered-validation errors follow the same
|
|
5592
|
+
* contract as {@link InstanceSession.update}. */
|
|
5593
|
+
updateDocument(doc: LoadedDoc): void;
|
|
5426
5594
|
/** Replace the held live guards (the consumer's guard stream,
|
|
5427
5595
|
* last-write-wins). Guards are a separate stream from the watch-set:
|
|
5428
5596
|
* {@link InstanceSession.evaluate} pre-flights the instance write against
|
|
@@ -5484,6 +5652,18 @@ export declare interface InstancesForDocumentArgs {
|
|
|
5484
5652
|
document: GdrUri;
|
|
5485
5653
|
}
|
|
5486
5654
|
|
|
5655
|
+
/**
|
|
5656
|
+
* The guard filter for a SET of instances in one datasource — the single
|
|
5657
|
+
* definition every per-instance read delegates to ({@link instanceGuardQuery}).
|
|
5658
|
+
* Reactive adapters subscribe it as ONE shared live query per resource for
|
|
5659
|
+
* every co-mounted session, fanning results back out per `sourceInstanceId`,
|
|
5660
|
+
* so a document's guard subscription count doesn't grow with its instance
|
|
5661
|
+
* count. Deterministically ordered, matching {@link guardsForResource}.
|
|
5662
|
+
*/
|
|
5663
|
+
export declare function instancesGuardQuery(
|
|
5664
|
+
instanceIds: readonly string[],
|
|
5665
|
+
): CompiledQuery;
|
|
5666
|
+
|
|
5487
5667
|
/**
|
|
5488
5668
|
* The instance-list GROQ for a {@link InstancesQueryFilter}, ordered by
|
|
5489
5669
|
* `startedAt` ascending (descending + sliced under
|
|
@@ -5577,6 +5757,10 @@ export declare function isClaimExpired(
|
|
|
5577
5757
|
now: string,
|
|
5578
5758
|
): boolean;
|
|
5579
5759
|
|
|
5760
|
+
export declare function isClientProjectUser(
|
|
5761
|
+
value: unknown,
|
|
5762
|
+
): value is ClientProjectUser;
|
|
5763
|
+
|
|
5580
5764
|
export { isComparisonOp };
|
|
5581
5765
|
|
|
5582
5766
|
/**
|
|
@@ -6335,6 +6519,16 @@ export declare interface PendingEffectClaim {
|
|
|
6335
6519
|
* live claim), and a field would drift from that trail across releases.
|
|
6336
6520
|
*/
|
|
6337
6521
|
leaseExpiresAt?: string;
|
|
6522
|
+
/**
|
|
6523
|
+
* The exact-claim identity a mid-dispatch state report must present.
|
|
6524
|
+
* `effectKey` cannot serve: a lease takeover keeps the same key, so a
|
|
6525
|
+
* superseded handler holding only the key could still write. The token is
|
|
6526
|
+
* minted fresh on every claim and takeover; `commitEffectOps` rejects a
|
|
6527
|
+
* report whose token no longer matches before writing anything. Absent
|
|
6528
|
+
* only on claims persisted before tokens existed — those never match, so
|
|
6529
|
+
* their dispatches simply cannot report mid-flight.
|
|
6530
|
+
*/
|
|
6531
|
+
claimToken?: string;
|
|
6338
6532
|
}
|
|
6339
6533
|
|
|
6340
6534
|
/**
|
|
@@ -6400,14 +6594,23 @@ export declare function processShellUserProperties<
|
|
|
6400
6594
|
runtimeVersion: string;
|
|
6401
6595
|
};
|
|
6402
6596
|
|
|
6597
|
+
/** `setProgress`'s field addressing: a bare name targets the workflow scope;
|
|
6598
|
+
* pass `{scope: 'stage', field}` for a stage-scope progress field. */
|
|
6599
|
+
export declare type ProgressTarget =
|
|
6600
|
+
| string
|
|
6601
|
+
| {
|
|
6602
|
+
scope: "workflow" | "stage";
|
|
6603
|
+
field: string;
|
|
6604
|
+
};
|
|
6605
|
+
|
|
6403
6606
|
/**
|
|
6404
6607
|
* Project a store-resolved doc onto its watch ref's identity, the way the
|
|
6405
6608
|
* lake's perspective reads do: the published-form id becomes `_id` (the form
|
|
6406
6609
|
* the session keys its overlay and snapshot by), and a draft/version
|
|
6407
6610
|
* representation's stored id rides along as `_originalId` — session-side
|
|
6408
6611
|
* conditions (including the `_originalId in path("versions.**")` shape) then
|
|
6409
|
-
* read
|
|
6410
|
-
*
|
|
6612
|
+
* read the same projected identity as the engine's perspective-aware hydration.
|
|
6613
|
+
* Strict by construction: only the ids in
|
|
6411
6614
|
* {@link watchRefRepresentations} are accepted — an id that merely *ends* in
|
|
6412
6615
|
* the watched id (another doc's dotted id under a version prefix), a release
|
|
6413
6616
|
* the perspective doesn't read, or a draft the perspective makes invisible is
|
|
@@ -6457,7 +6660,7 @@ export declare class ReaderModelAcknowledgementError extends WorkflowError<"read
|
|
|
6457
6660
|
readonly code = "WORKFLOW_READER_MODEL_ACKNOWLEDGEMENT_MISMATCH";
|
|
6458
6661
|
readonly expectedMinReaderModel: unknown;
|
|
6459
6662
|
readonly engineMinReaderModel = 2;
|
|
6460
|
-
readonly engineModelVersion =
|
|
6663
|
+
readonly engineModelVersion = 3;
|
|
6461
6664
|
readonly documentationUrl =
|
|
6462
6665
|
"https://github.com/sanity-io/workflows/blob/main/docs/reader-model-rollout.md";
|
|
6463
6666
|
constructor(expectedMinReaderModel: unknown, context?: string);
|
|
@@ -6795,8 +6998,8 @@ export declare function resourceAliasesToMap(
|
|
|
6795
6998
|
* refs to the resources it stops serving.
|
|
6796
6999
|
*
|
|
6797
7000
|
* Engine-owned verb scopes rebind resolved clients onto
|
|
6798
|
-
* `ENGINE_API_VERSION`. Effect handlers
|
|
6799
|
-
*
|
|
7001
|
+
* `ENGINE_API_VERSION`. Effect handlers derive request-tagged siblings from
|
|
7002
|
+
* resolver clients so their concrete APIs remain available and attributed.
|
|
6800
7003
|
*/
|
|
6801
7004
|
export declare type ResourceClientResolver = (
|
|
6802
7005
|
parsed: ParsedGdr,
|
|
@@ -7079,6 +7282,32 @@ declare interface StageGuardArgs {
|
|
|
7079
7282
|
|
|
7080
7283
|
export declare type StageName = string;
|
|
7081
7284
|
|
|
7285
|
+
/** Why a mid-dispatch report's claim no longer authorises it — see
|
|
7286
|
+
* {@link StaleEffectClaimError}. */
|
|
7287
|
+
export declare type StaleClaimReason =
|
|
7288
|
+
| "unclaimed"
|
|
7289
|
+
| "claim-superseded"
|
|
7290
|
+
| "lease-expired";
|
|
7291
|
+
|
|
7292
|
+
/**
|
|
7293
|
+
* Thrown when a mid-dispatch state report (`commitEffectOps`) presents a
|
|
7294
|
+
* claim token that no longer authorises writing: the entry's claim was
|
|
7295
|
+
* released, taken over by another dispatch (`claim-superseded`), or its
|
|
7296
|
+
* lease lapsed. Nothing was written — the gate runs before any mutation.
|
|
7297
|
+
* The handler should stop reporting; its completion still follows the
|
|
7298
|
+
* normal first-writer-wins completion semantics.
|
|
7299
|
+
*/
|
|
7300
|
+
export declare class StaleEffectClaimError extends WorkflowError<"stale-effect-claim"> {
|
|
7301
|
+
readonly instanceId: string;
|
|
7302
|
+
readonly effectKey: string;
|
|
7303
|
+
readonly reason: StaleClaimReason;
|
|
7304
|
+
constructor(args: {
|
|
7305
|
+
instanceId: string;
|
|
7306
|
+
effectKey: string;
|
|
7307
|
+
reason: StaleClaimReason;
|
|
7308
|
+
});
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7082
7311
|
/**
|
|
7083
7312
|
* The vars a definition's `start.allowed` reads — the start-time permission
|
|
7084
7313
|
* dialect: everything the filter context binds ({@link START_FILTER_VARS})
|
|
@@ -7428,7 +7657,7 @@ declare const StoredFieldOpSchema: v.VariantSchema<
|
|
|
7428
7657
|
{
|
|
7429
7658
|
readonly scope: v.PicklistSchema<
|
|
7430
7659
|
readonly ["workflow", "stage", "activity"],
|
|
7431
|
-
|
|
7660
|
+
string
|
|
7432
7661
|
>;
|
|
7433
7662
|
readonly field: v.SchemaWithPipe<
|
|
7434
7663
|
readonly [
|
|
@@ -7450,7 +7679,7 @@ declare const StoredFieldOpSchema: v.VariantSchema<
|
|
|
7450
7679
|
{
|
|
7451
7680
|
readonly scope: v.PicklistSchema<
|
|
7452
7681
|
readonly ["workflow", "stage", "activity"],
|
|
7453
|
-
|
|
7682
|
+
string
|
|
7454
7683
|
>;
|
|
7455
7684
|
readonly field: v.SchemaWithPipe<
|
|
7456
7685
|
readonly [
|
|
@@ -7471,7 +7700,7 @@ declare const StoredFieldOpSchema: v.VariantSchema<
|
|
|
7471
7700
|
{
|
|
7472
7701
|
readonly scope: v.PicklistSchema<
|
|
7473
7702
|
readonly ["workflow", "stage", "activity"],
|
|
7474
|
-
|
|
7703
|
+
string
|
|
7475
7704
|
>;
|
|
7476
7705
|
readonly field: v.SchemaWithPipe<
|
|
7477
7706
|
readonly [
|
|
@@ -7493,7 +7722,7 @@ declare const StoredFieldOpSchema: v.VariantSchema<
|
|
|
7493
7722
|
{
|
|
7494
7723
|
readonly scope: v.PicklistSchema<
|
|
7495
7724
|
readonly ["workflow", "stage", "activity"],
|
|
7496
|
-
|
|
7725
|
+
string
|
|
7497
7726
|
>;
|
|
7498
7727
|
readonly field: v.SchemaWithPipe<
|
|
7499
7728
|
readonly [
|
|
@@ -7521,7 +7750,7 @@ declare const StoredFieldOpSchema: v.VariantSchema<
|
|
|
7521
7750
|
{
|
|
7522
7751
|
readonly scope: v.PicklistSchema<
|
|
7523
7752
|
readonly ["workflow", "stage", "activity"],
|
|
7524
|
-
|
|
7753
|
+
string
|
|
7525
7754
|
>;
|
|
7526
7755
|
readonly field: v.SchemaWithPipe<
|
|
7527
7756
|
readonly [
|
|
@@ -7551,7 +7780,7 @@ declare const StoredFieldRefSchema: v.StrictObjectSchema<
|
|
|
7551
7780
|
{
|
|
7552
7781
|
readonly scope: v.PicklistSchema<
|
|
7553
7782
|
readonly ["workflow", "stage", "activity"],
|
|
7554
|
-
|
|
7783
|
+
string
|
|
7555
7784
|
>;
|
|
7556
7785
|
readonly field: v.SchemaWithPipe<
|
|
7557
7786
|
readonly [
|
|
@@ -7586,7 +7815,7 @@ declare const StoredManualTargetSchema: v.VariantSchema<
|
|
|
7586
7815
|
{
|
|
7587
7816
|
readonly scope: v.PicklistSchema<
|
|
7588
7817
|
readonly ["workflow", "stage", "activity"],
|
|
7589
|
-
|
|
7818
|
+
string
|
|
7590
7819
|
>;
|
|
7591
7820
|
readonly field: v.SchemaWithPipe<
|
|
7592
7821
|
readonly [
|
|
@@ -7614,7 +7843,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7614
7843
|
{
|
|
7615
7844
|
readonly scope: v.PicklistSchema<
|
|
7616
7845
|
readonly ["workflow", "stage", "activity"],
|
|
7617
|
-
|
|
7846
|
+
string
|
|
7618
7847
|
>;
|
|
7619
7848
|
readonly field: v.SchemaWithPipe<
|
|
7620
7849
|
readonly [
|
|
@@ -7636,7 +7865,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7636
7865
|
{
|
|
7637
7866
|
readonly scope: v.PicklistSchema<
|
|
7638
7867
|
readonly ["workflow", "stage", "activity"],
|
|
7639
|
-
|
|
7868
|
+
string
|
|
7640
7869
|
>;
|
|
7641
7870
|
readonly field: v.SchemaWithPipe<
|
|
7642
7871
|
readonly [
|
|
@@ -7657,7 +7886,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7657
7886
|
{
|
|
7658
7887
|
readonly scope: v.PicklistSchema<
|
|
7659
7888
|
readonly ["workflow", "stage", "activity"],
|
|
7660
|
-
|
|
7889
|
+
string
|
|
7661
7890
|
>;
|
|
7662
7891
|
readonly field: v.SchemaWithPipe<
|
|
7663
7892
|
readonly [
|
|
@@ -7679,7 +7908,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7679
7908
|
{
|
|
7680
7909
|
readonly scope: v.PicklistSchema<
|
|
7681
7910
|
readonly ["workflow", "stage", "activity"],
|
|
7682
|
-
|
|
7911
|
+
string
|
|
7683
7912
|
>;
|
|
7684
7913
|
readonly field: v.SchemaWithPipe<
|
|
7685
7914
|
readonly [
|
|
@@ -7707,7 +7936,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7707
7936
|
{
|
|
7708
7937
|
readonly scope: v.PicklistSchema<
|
|
7709
7938
|
readonly ["workflow", "stage", "activity"],
|
|
7710
|
-
|
|
7939
|
+
string
|
|
7711
7940
|
>;
|
|
7712
7941
|
readonly field: v.SchemaWithPipe<
|
|
7713
7942
|
readonly [
|
|
@@ -7738,7 +7967,7 @@ declare const StoredOpSchema: v.VariantSchema<
|
|
|
7738
7967
|
>;
|
|
7739
7968
|
readonly status: v.PicklistSchema<
|
|
7740
7969
|
readonly ["active", "done", "skipped", "failed"],
|
|
7741
|
-
|
|
7970
|
+
string
|
|
7742
7971
|
>;
|
|
7743
7972
|
},
|
|
7744
7973
|
undefined
|
|
@@ -8012,10 +8241,7 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
|
|
|
8012
8241
|
* `$subworkflows`) decide.
|
|
8013
8242
|
*/
|
|
8014
8243
|
readonly onExit: v.OptionalSchema<
|
|
8015
|
-
v.PicklistSchema<
|
|
8016
|
-
readonly ["detach", "abort"],
|
|
8017
|
-
`Invalid option: expected one of ${string}`
|
|
8018
|
-
>,
|
|
8244
|
+
v.PicklistSchema<readonly ["detach", "abort"], string>,
|
|
8019
8245
|
undefined
|
|
8020
8246
|
>;
|
|
8021
8247
|
},
|
|
@@ -8333,9 +8559,10 @@ declare type ValueExprInternal =
|
|
|
8333
8559
|
* physically scoped: a guard doc in a watched content dataset that
|
|
8334
8560
|
* self-declares the engine's resource id must never reach a verdict. This
|
|
8335
8561
|
* keeps the advisory layer consistent (verdicts are UX, not enforcement);
|
|
8336
|
-
* it is not itself a security boundary.
|
|
8337
|
-
* adapters subscribe with
|
|
8338
|
-
*
|
|
8562
|
+
* it is not itself a security boundary. Reads through the same filter
|
|
8563
|
+
* definition the reactive adapters subscribe with
|
|
8564
|
+
* ({@link instanceGuardQuery}, the one-id form of the set-shaped
|
|
8565
|
+
* {@link instancesGuardQuery}), so the stateless and reactive paths agree.
|
|
8339
8566
|
*/
|
|
8340
8567
|
export declare function verdictGuardsForInstance(
|
|
8341
8568
|
client: WorkflowClient,
|
|
@@ -8527,6 +8754,23 @@ export declare const workflow: {
|
|
|
8527
8754
|
completeEffect: (
|
|
8528
8755
|
rawArgs: Clocked<Telemetered<CompleteEffectArgs & EngineScopeArgs>>,
|
|
8529
8756
|
) => Promise<OperationResult>;
|
|
8757
|
+
/**
|
|
8758
|
+
* Commit mid-dispatch field state from a running effect handler — the
|
|
8759
|
+
* engine verb behind `ctx.commitOps`. Gates on the dispatch's exact claim
|
|
8760
|
+
* (token match + unexpired lease; a stale report throws
|
|
8761
|
+
* `StaleEffectClaimError` and writes nothing), validates and applies the
|
|
8762
|
+
* `field.*` ops through the shared op applier, records history and the
|
|
8763
|
+
* mandatory idempotency key, renews the claim's lease in the same
|
|
8764
|
+
* compare-and-swap commit, refreshes the stage's guards, then cascades —
|
|
8765
|
+
* a report that satisfies a transition moves the instance, by design.
|
|
8766
|
+
*
|
|
8767
|
+
* Completion (`completeEffect`) remains the authoritative final result
|
|
8768
|
+
* and stays claim-blind; this verb only protects the mid-dispatch write
|
|
8769
|
+
* channel from superseded handlers.
|
|
8770
|
+
*/
|
|
8771
|
+
commitEffectOps: (
|
|
8772
|
+
rawArgs: Clocked<Telemetered<CommitEffectOpsArgs & EngineScopeArgs>>,
|
|
8773
|
+
) => Promise<OperationResult>;
|
|
8530
8774
|
/**
|
|
8531
8775
|
* Run the cascade until stable — triggered actions fire, transitions move.
|
|
8532
8776
|
*
|
|
@@ -8882,7 +9126,7 @@ export declare interface WorkflowClient {
|
|
|
8882
9126
|
* Optional — present on the real `@sanity/client` and the in-memory test
|
|
8883
9127
|
* fake. Returns a sibling client with the given config overrides,
|
|
8884
9128
|
* inheriting everything else from the source (token, apiHost). The engine
|
|
8885
|
-
* derives
|
|
9129
|
+
* derives three things from it:
|
|
8886
9130
|
*
|
|
8887
9131
|
* - **Cross-resource routing** (`resource` + the dataset pair): a sibling
|
|
8888
9132
|
* for a foreign GDR when `resourceClients` doesn't map it. A client
|
|
@@ -8896,6 +9140,10 @@ export declare interface WorkflowClient {
|
|
|
8896
9140
|
* rebound and is used as-is — it must be built to serve
|
|
8897
9141
|
* {@link ENGINE_API_VERSION} already; older dated versions fail
|
|
8898
9142
|
* silently incomplete, not loud.
|
|
9143
|
+
* - **Effect request attribution** (`requestTagPrefix`): handlers receive a
|
|
9144
|
+
* derived client whose untagged traffic carries the effect tag while the
|
|
9145
|
+
* caller's own client remains untouched. A client without `withConfig`
|
|
9146
|
+
* uses the structural request wrapper instead.
|
|
8899
9147
|
*
|
|
8900
9148
|
* Dataset resources carry the `{projectId, dataset}` pair alongside
|
|
8901
9149
|
* `resource`: the real client routes by `resource` (it takes precedence in
|
|
@@ -8904,7 +9152,7 @@ export declare interface WorkflowClient {
|
|
|
8904
9152
|
* only — a canvas/media-library derivation on the fake aliases the current
|
|
8905
9153
|
* store until the fake learns `resource` upstream.
|
|
8906
9154
|
*/
|
|
8907
|
-
withConfig?: (config: WorkflowClientConfig) =>
|
|
9155
|
+
withConfig?: (config: WorkflowClientConfig) => this;
|
|
8908
9156
|
/**
|
|
8909
9157
|
* Optional — present on the real `@sanity/client`, absent on the
|
|
8910
9158
|
* in-memory test client. The engine probes for it when auto-resolving
|
|
@@ -8930,14 +9178,15 @@ export declare interface WorkflowClient {
|
|
|
8930
9178
|
/**
|
|
8931
9179
|
* The config bag {@link WorkflowClient.withConfig} accepts — all optional: a
|
|
8932
9180
|
* resource rebind (`resource`, plus the dataset pair for dataset targets), an
|
|
8933
|
-
* `apiVersion` rebind,
|
|
8934
|
-
* source client.
|
|
9181
|
+
* `apiVersion` rebind, a request-tag prefix, or any combination. Everything
|
|
9182
|
+
* omitted is inherited from the source client.
|
|
8935
9183
|
*/
|
|
8936
9184
|
export declare interface WorkflowClientConfig {
|
|
8937
9185
|
resource?: WorkflowResource;
|
|
8938
9186
|
projectId?: string;
|
|
8939
9187
|
dataset?: string;
|
|
8940
9188
|
apiVersion?: string;
|
|
9189
|
+
requestTagPrefix?: string;
|
|
8941
9190
|
}
|
|
8942
9191
|
|
|
8943
9192
|
export declare interface WorkflowCommitOptions {
|
|
@@ -8979,7 +9228,11 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
8979
9228
|
readonly name: v.SchemaWithPipe<
|
|
8980
9229
|
readonly [
|
|
8981
9230
|
v.StringSchema<undefined>,
|
|
8982
|
-
v.NonEmptyAction<string,
|
|
9231
|
+
v.NonEmptyAction<string, undefined>,
|
|
9232
|
+
v.CheckAction<
|
|
9233
|
+
string,
|
|
9234
|
+
`invalid ${string} \u2014 ASCII lowercase + digits + dashes, no leading dash, no dots`
|
|
9235
|
+
>,
|
|
8983
9236
|
]
|
|
8984
9237
|
>;
|
|
8985
9238
|
readonly expectedMinReaderModel: v.OptionalSchema<
|
|
@@ -8992,7 +9245,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
8992
9245
|
v.NonEmptyAction<string, undefined>,
|
|
8993
9246
|
v.CheckAction<
|
|
8994
9247
|
string,
|
|
8995
|
-
|
|
9248
|
+
`invalid ${string} \u2014 ASCII lowercase + digits + dashes, no leading dash, no dots`
|
|
8996
9249
|
>,
|
|
8997
9250
|
]
|
|
8998
9251
|
>;
|
|
@@ -9193,7 +9446,30 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
9193
9446
|
id: string;
|
|
9194
9447
|
};
|
|
9195
9448
|
}[],
|
|
9196
|
-
|
|
9449
|
+
(
|
|
9450
|
+
issue: v.CheckIssue<
|
|
9451
|
+
{
|
|
9452
|
+
name: string;
|
|
9453
|
+
resource:
|
|
9454
|
+
| {
|
|
9455
|
+
type: "dataset";
|
|
9456
|
+
id: string;
|
|
9457
|
+
}
|
|
9458
|
+
| {
|
|
9459
|
+
type: "canvas";
|
|
9460
|
+
id: string;
|
|
9461
|
+
}
|
|
9462
|
+
| {
|
|
9463
|
+
type: "media-library";
|
|
9464
|
+
id: string;
|
|
9465
|
+
}
|
|
9466
|
+
| {
|
|
9467
|
+
type: "dashboard";
|
|
9468
|
+
id: string;
|
|
9469
|
+
};
|
|
9470
|
+
}[]
|
|
9471
|
+
>,
|
|
9472
|
+
) => string
|
|
9197
9473
|
>,
|
|
9198
9474
|
]
|
|
9199
9475
|
>,
|
|
@@ -9363,7 +9639,187 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
9363
9639
|
roleAliases?: RoleAliases | undefined;
|
|
9364
9640
|
}[];
|
|
9365
9641
|
}[],
|
|
9366
|
-
|
|
9642
|
+
(
|
|
9643
|
+
issue: v.CheckIssue<
|
|
9644
|
+
{
|
|
9645
|
+
name: string;
|
|
9646
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
9647
|
+
tag: string;
|
|
9648
|
+
workflowResource:
|
|
9649
|
+
| {
|
|
9650
|
+
type: "dataset";
|
|
9651
|
+
id: string;
|
|
9652
|
+
}
|
|
9653
|
+
| {
|
|
9654
|
+
type: "canvas";
|
|
9655
|
+
id: string;
|
|
9656
|
+
}
|
|
9657
|
+
| {
|
|
9658
|
+
type: "media-library";
|
|
9659
|
+
id: string;
|
|
9660
|
+
}
|
|
9661
|
+
| {
|
|
9662
|
+
type: "dashboard";
|
|
9663
|
+
id: string;
|
|
9664
|
+
};
|
|
9665
|
+
resourceAliases?:
|
|
9666
|
+
| {
|
|
9667
|
+
name: string;
|
|
9668
|
+
resource:
|
|
9669
|
+
| {
|
|
9670
|
+
type: "dataset";
|
|
9671
|
+
id: string;
|
|
9672
|
+
}
|
|
9673
|
+
| {
|
|
9674
|
+
type: "canvas";
|
|
9675
|
+
id: string;
|
|
9676
|
+
}
|
|
9677
|
+
| {
|
|
9678
|
+
type: "media-library";
|
|
9679
|
+
id: string;
|
|
9680
|
+
}
|
|
9681
|
+
| {
|
|
9682
|
+
type: "dashboard";
|
|
9683
|
+
id: string;
|
|
9684
|
+
};
|
|
9685
|
+
}[]
|
|
9686
|
+
| undefined;
|
|
9687
|
+
definitions: {
|
|
9688
|
+
name: string;
|
|
9689
|
+
title: string;
|
|
9690
|
+
description?: string | undefined;
|
|
9691
|
+
groups?: Group[] | undefined;
|
|
9692
|
+
lifecycle?: WorkflowLifecycle | undefined;
|
|
9693
|
+
start?: StartBlock | undefined;
|
|
9694
|
+
initialStage: string;
|
|
9695
|
+
fields?: FieldEntry[] | undefined;
|
|
9696
|
+
stages: Stage[];
|
|
9697
|
+
predicates?: Record<string, string> | undefined;
|
|
9698
|
+
roleAliases?: RoleAliases | undefined;
|
|
9699
|
+
}[];
|
|
9700
|
+
}[]
|
|
9701
|
+
>,
|
|
9702
|
+
) => string
|
|
9703
|
+
>,
|
|
9704
|
+
v.CheckAction<
|
|
9705
|
+
{
|
|
9706
|
+
name: string;
|
|
9707
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
9708
|
+
tag: string;
|
|
9709
|
+
workflowResource:
|
|
9710
|
+
| {
|
|
9711
|
+
type: "dataset";
|
|
9712
|
+
id: string;
|
|
9713
|
+
}
|
|
9714
|
+
| {
|
|
9715
|
+
type: "canvas";
|
|
9716
|
+
id: string;
|
|
9717
|
+
}
|
|
9718
|
+
| {
|
|
9719
|
+
type: "media-library";
|
|
9720
|
+
id: string;
|
|
9721
|
+
}
|
|
9722
|
+
| {
|
|
9723
|
+
type: "dashboard";
|
|
9724
|
+
id: string;
|
|
9725
|
+
};
|
|
9726
|
+
resourceAliases?:
|
|
9727
|
+
| {
|
|
9728
|
+
name: string;
|
|
9729
|
+
resource:
|
|
9730
|
+
| {
|
|
9731
|
+
type: "dataset";
|
|
9732
|
+
id: string;
|
|
9733
|
+
}
|
|
9734
|
+
| {
|
|
9735
|
+
type: "canvas";
|
|
9736
|
+
id: string;
|
|
9737
|
+
}
|
|
9738
|
+
| {
|
|
9739
|
+
type: "media-library";
|
|
9740
|
+
id: string;
|
|
9741
|
+
}
|
|
9742
|
+
| {
|
|
9743
|
+
type: "dashboard";
|
|
9744
|
+
id: string;
|
|
9745
|
+
};
|
|
9746
|
+
}[]
|
|
9747
|
+
| undefined;
|
|
9748
|
+
definitions: {
|
|
9749
|
+
name: string;
|
|
9750
|
+
title: string;
|
|
9751
|
+
description?: string | undefined;
|
|
9752
|
+
groups?: Group[] | undefined;
|
|
9753
|
+
lifecycle?: WorkflowLifecycle | undefined;
|
|
9754
|
+
start?: StartBlock | undefined;
|
|
9755
|
+
initialStage: string;
|
|
9756
|
+
fields?: FieldEntry[] | undefined;
|
|
9757
|
+
stages: Stage[];
|
|
9758
|
+
predicates?: Record<string, string> | undefined;
|
|
9759
|
+
roleAliases?: RoleAliases | undefined;
|
|
9760
|
+
}[];
|
|
9761
|
+
}[],
|
|
9762
|
+
(
|
|
9763
|
+
issue: v.CheckIssue<
|
|
9764
|
+
{
|
|
9765
|
+
name: string;
|
|
9766
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
9767
|
+
tag: string;
|
|
9768
|
+
workflowResource:
|
|
9769
|
+
| {
|
|
9770
|
+
type: "dataset";
|
|
9771
|
+
id: string;
|
|
9772
|
+
}
|
|
9773
|
+
| {
|
|
9774
|
+
type: "canvas";
|
|
9775
|
+
id: string;
|
|
9776
|
+
}
|
|
9777
|
+
| {
|
|
9778
|
+
type: "media-library";
|
|
9779
|
+
id: string;
|
|
9780
|
+
}
|
|
9781
|
+
| {
|
|
9782
|
+
type: "dashboard";
|
|
9783
|
+
id: string;
|
|
9784
|
+
};
|
|
9785
|
+
resourceAliases?:
|
|
9786
|
+
| {
|
|
9787
|
+
name: string;
|
|
9788
|
+
resource:
|
|
9789
|
+
| {
|
|
9790
|
+
type: "dataset";
|
|
9791
|
+
id: string;
|
|
9792
|
+
}
|
|
9793
|
+
| {
|
|
9794
|
+
type: "canvas";
|
|
9795
|
+
id: string;
|
|
9796
|
+
}
|
|
9797
|
+
| {
|
|
9798
|
+
type: "media-library";
|
|
9799
|
+
id: string;
|
|
9800
|
+
}
|
|
9801
|
+
| {
|
|
9802
|
+
type: "dashboard";
|
|
9803
|
+
id: string;
|
|
9804
|
+
};
|
|
9805
|
+
}[]
|
|
9806
|
+
| undefined;
|
|
9807
|
+
definitions: {
|
|
9808
|
+
name: string;
|
|
9809
|
+
title: string;
|
|
9810
|
+
description?: string | undefined;
|
|
9811
|
+
groups?: Group[] | undefined;
|
|
9812
|
+
lifecycle?: WorkflowLifecycle | undefined;
|
|
9813
|
+
start?: StartBlock | undefined;
|
|
9814
|
+
initialStage: string;
|
|
9815
|
+
fields?: FieldEntry[] | undefined;
|
|
9816
|
+
stages: Stage[];
|
|
9817
|
+
predicates?: Record<string, string> | undefined;
|
|
9818
|
+
roleAliases?: RoleAliases | undefined;
|
|
9819
|
+
}[];
|
|
9820
|
+
}[]
|
|
9821
|
+
>,
|
|
9822
|
+
) => string
|
|
9367
9823
|
>,
|
|
9368
9824
|
]
|
|
9369
9825
|
>;
|
|
@@ -9506,6 +9962,17 @@ export declare interface WorkflowEffectsDrainedData extends InstanceScopedEventD
|
|
|
9506
9962
|
drainedEffects: EffectName[];
|
|
9507
9963
|
}
|
|
9508
9964
|
|
|
9965
|
+
export declare const WorkflowEffectStateReported: WorkflowTelemetryEvent<WorkflowEffectStateReportedData>;
|
|
9966
|
+
|
|
9967
|
+
export declare interface WorkflowEffectStateReportedData extends InstanceScopedEventData {
|
|
9968
|
+
/** The reporting effect's author-chosen name — one of the payload policy's
|
|
9969
|
+
* two deliberate customer-string exceptions (module doc). */
|
|
9970
|
+
effect: EffectName;
|
|
9971
|
+
/** Auto-transitions fired during the post-report cascade — a report that
|
|
9972
|
+
* satisfies a transition moves the instance. */
|
|
9973
|
+
cascaded: number;
|
|
9974
|
+
}
|
|
9975
|
+
|
|
9509
9976
|
/**
|
|
9510
9977
|
* Base class of the engine's structured errors. `kind` is the stable
|
|
9511
9978
|
* discriminant — render on it; `name` mirrors the concrete class for logs.
|
|
@@ -9538,6 +10005,9 @@ export declare type WorkflowErrorKind =
|
|
|
9538
10005
|
| "concurrent-fire-action"
|
|
9539
10006
|
| "concurrent-edit-field"
|
|
9540
10007
|
| "concurrent-complete-effect"
|
|
10008
|
+
| "concurrent-commit-effect-ops"
|
|
10009
|
+
| "stale-effect-claim"
|
|
10010
|
+
| "effect-commit-queue-overflow"
|
|
9541
10011
|
| "cascade-limit"
|
|
9542
10012
|
| "field-value-shape"
|
|
9543
10013
|
| "ref-resource-undeclared"
|