@sanity/workflow-studio 0.6.0 → 0.7.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 +354 -0
- package/README.md +14 -10
- package/dist/index.cjs +237 -189
- package/dist/index.d.cts +40 -14
- package/dist/index.d.ts +40 -14
- package/dist/index.js +236 -200
- package/package.json +7 -6
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# @sanity/workflow-studio
|
|
2
|
+
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- adf32f7: **BREAKING:** `useWorkflowSession`'s `access` argument is removed — identity is the Studio client's token. `useWorkflowEngine` now declares `executionContext {kind: 'studio'}` so history records the environment.
|
|
8
|
+
- d6e92ed: Now published with public npm access (previously restricted) — installable without `@sanity` org membership.
|
|
9
|
+
- 2834704: **BREAKING:** `useWorkflowEngine` no longer takes an `apiVersion` option. The engine now owns its API version for all engine traffic — including the clients `studioResourceClients` resolves — so the option had no remaining effect except steering routed subject reads onto a caller-chosen version, the silent-incomplete failure mode the engine pin removes. The workspace client is used as-is; nothing version-related needs configuring.
|
|
10
|
+
- 2511bb5: **BREAKING:** `makeStudioObserver` requires a `client` option (a workspace-bound `SanityClient`) — it carries the store contract's new `ensureDocumentExists` writes, which address the mounted dataset. `useStudioObserver` (now exported) supplies the source client automatically, so hook consumers are unaffected.
|
|
11
|
+
- 15337f1: `useWorkflowEngine` feeds Studio's telemetry logger into the engine seam, and sessions report the `studio` host on the session-start adoption event. Studio owns store/consent/transport; engine request tags compose under Studio's `sanity.studio` request-tag prefix.
|
|
12
|
+
- 2511bb5: `useWorkflowEngine` accepts optional `effectHandlers` and `missingHandler`, forwarded to `createEngine` — a Studio-built engine can now drain effects (`engine.drainEffects`) with in-browser handlers without dropping down to manual engine construction.
|
|
13
|
+
- ced40e4: Request tags move to workflows-owned families with the runtime as the segment: `sanity.workflows.cli`, `sanity.workflows.studio`, `sanity.workflows.sdk` — never another team's family (`sanity.cli.*`, `sanity.studio.*`) — and platform analysis zero-rates `sanity.workflows.*`. The MCP server deliberately sits outside that family as `sanity.workflows-mcp` (no dot boundary), so agent-driven traffic bills. Under any workflows-family prefix the engine's tag wrapper strips the now-redundant `workflow.` root from every relative op tag — stamped fallback and explicit alike — so traffic lands as `sanity.workflows.cli.deploy` with exactly one workflows segment; on raw consumer clients and under foreign host prefixes the root stays, since there it is what identifies the traffic. The Studio adapter's engine and resource-router clients and the SDK telemetry shell's intake client now set their family prefix themselves instead of riding the host's.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 325c2d1: README: the `useWorkflowSession` return shape now lists `previewField` / `discardFieldPreview`.
|
|
18
|
+
- dc64968: Published tarballs no longer include sourcemaps (whose `sourcesContent` embedded the complete TypeScript source) or inline code comments in the compiled JS — license markers and bundler annotations (`/*@__PURE__*/`-style tree-shaking hints) are preserved. Types and TSDoc in `.d.ts` files ship unchanged, and the tarballs shrink accordingly (workflow-engine: ~3× smaller). Each tarball now ships its `CHANGELOG.md`, so release notes reach consumers who can install the package but cannot see the repository.
|
|
19
|
+
- 2511bb5: The studio observer's streams (edit state, guard list, instance list) survive listener errors: an RxJS error terminates the subscription, which previously froze the store on its last snapshot with nothing logged. The error is now logged naming the stream, and the store resubscribes after a 5-second pause; a pending resubscribe is cancelled on teardown.
|
|
20
|
+
- 9f5a40f: Correct the `studioResourceClients` routing docs: a resolver `undefined` no longer falls back to the engine's own client — the engine derives a sibling client for the target resource from its own credentials.
|
|
21
|
+
- 325c2d1: `useWorkflowSession`'s TSDoc now points at the full `WorkflowSession` return shape instead of enumerating a stale subset that omitted the preview verbs.
|
|
22
|
+
- 114dcae: Ship the MIT `LICENSE` file in the published package. The package.json already declared `"license": "MIT"`, but the license text itself was missing from the tarball.
|
|
23
|
+
- Updated dependencies [325c2d1]
|
|
24
|
+
- Updated dependencies [4ca17bb]
|
|
25
|
+
- Updated dependencies [5143707]
|
|
26
|
+
- Updated dependencies [0709ab1]
|
|
27
|
+
- Updated dependencies [6bbf3ca]
|
|
28
|
+
- Updated dependencies [9f5a40f]
|
|
29
|
+
- Updated dependencies [d192d68]
|
|
30
|
+
- Updated dependencies [6c21009]
|
|
31
|
+
- Updated dependencies [109f900]
|
|
32
|
+
- Updated dependencies [109f900]
|
|
33
|
+
- Updated dependencies [444b0e6]
|
|
34
|
+
- Updated dependencies [2511bb5]
|
|
35
|
+
- Updated dependencies [d4fd8e6]
|
|
36
|
+
- Updated dependencies [30ed0e8]
|
|
37
|
+
- Updated dependencies [2834704]
|
|
38
|
+
- Updated dependencies [2511bb5]
|
|
39
|
+
- Updated dependencies [2511bb5]
|
|
40
|
+
- Updated dependencies [2511bb5]
|
|
41
|
+
- Updated dependencies [4607d59]
|
|
42
|
+
- Updated dependencies [52f6024]
|
|
43
|
+
- Updated dependencies [a8f1cb9]
|
|
44
|
+
- Updated dependencies [adf32f7]
|
|
45
|
+
- Updated dependencies [adf32f7]
|
|
46
|
+
- Updated dependencies [adf32f7]
|
|
47
|
+
- Updated dependencies [5cb0850]
|
|
48
|
+
- Updated dependencies [70a136c]
|
|
49
|
+
- Updated dependencies [91540de]
|
|
50
|
+
- Updated dependencies [91540de]
|
|
51
|
+
- Updated dependencies [8455fbb]
|
|
52
|
+
- Updated dependencies [325c2d1]
|
|
53
|
+
- Updated dependencies [325c2d1]
|
|
54
|
+
- Updated dependencies [d6e92ed]
|
|
55
|
+
- Updated dependencies [6c21009]
|
|
56
|
+
- Updated dependencies [2511bb5]
|
|
57
|
+
- Updated dependencies [15337f1]
|
|
58
|
+
- Updated dependencies [325c2d1]
|
|
59
|
+
- Updated dependencies [7ffdc77]
|
|
60
|
+
- Updated dependencies [2511bb5]
|
|
61
|
+
- Updated dependencies [325c2d1]
|
|
62
|
+
- Updated dependencies [15337f1]
|
|
63
|
+
- Updated dependencies [325c2d1]
|
|
64
|
+
- Updated dependencies [7ffdc77]
|
|
65
|
+
- Updated dependencies [ced40e4]
|
|
66
|
+
- Updated dependencies [9b1b40d]
|
|
67
|
+
- Updated dependencies [8c319b2]
|
|
68
|
+
- Updated dependencies [dc64968]
|
|
69
|
+
- Updated dependencies [23cf131]
|
|
70
|
+
- Updated dependencies [d192d68]
|
|
71
|
+
- Updated dependencies [15337f1]
|
|
72
|
+
- Updated dependencies [2d1a8e1]
|
|
73
|
+
- Updated dependencies [12cdbd6]
|
|
74
|
+
- Updated dependencies [437b544]
|
|
75
|
+
- Updated dependencies [114dcae]
|
|
76
|
+
- Updated dependencies [ced40e4]
|
|
77
|
+
- @sanity/workflow-sdk@0.7.0
|
|
78
|
+
- @sanity/workflow-engine@0.15.0
|
|
79
|
+
- @sanity/workflow-react@0.10.0
|
|
80
|
+
|
|
81
|
+
## 0.6.0
|
|
82
|
+
|
|
83
|
+
### Minor Changes
|
|
84
|
+
|
|
85
|
+
- df00bbb: New live instance-list hooks: `useWorkflowInstances({engine, filter})` and `useDocumentWorkflows({engine, document})`, each returning `{instances, loading}`. The Studio adapter reads the list through `documentStore.listenQuery` when the engine dataset is the workspace's own, else through the App SDK store (`sdkInstancesStore`, newly exported from `@sanity/workflow-sdk`) — the same routing and `sdk` bootstrap rules as the instance doc. The Studio package also gains `useWorkflowEngine({workflowResource, tag, resourceClients?})`, which builds the engine once from the workspace client with default per-resource routing to any `dataset:` GDR.
|
|
86
|
+
- 5c69928: **BREAKING:** runtime API coherence pass — one result shape, one session noun, nameable engine args.
|
|
87
|
+
- `DispatchResult` → `OperationResult`, and its `fired` flag → `changed` with one meaning honored by every verb: this call changed the instance's workflow state (`false` = successful no-op — an idempotent re-fire, a tick that wrote nothing, a `setStage` already at the target, an abort of an already-terminal instance; failures still throw). `tick` derives it from the instance revision, so a persisted activity-gate flip that didn't unlock a transition still reports `changed: true`. `abortInstance` documents its always-`0` cascade (a terminal instance doesn't cascade; ancestor propagation reports on the ancestors).
|
|
88
|
+
- `startInstance` now returns `OperationResult` instead of a bare `WorkflowInstance` — its cascade is finally observable. Reach the instance via `result.instance`.
|
|
89
|
+
- Engine argument types are exported and nameable: the exported `*Args` shapes are now exactly what `Engine` methods take, and the raw `workflow.*` namespace takes `<Verb>Args & EngineScopeArgs` (the new exported scope type: `client` / `tag` / `workflowResource` / `resourceClients`). New named args for the read/housekeeping verbs: `InstanceRefArgs`, `ChildrenArgs`, `GuardsForDefinitionArgs`, `InstancesForDocumentArgs`, `QueryArgs`, `QueryInScopeArgs`, `FindPendingEffectsArgs`, `DrainEffectsArgs`, `SessionArgs`. `EvaluateArgs` is likewise scope-free now.
|
|
90
|
+
- Verb-surface parity between `Engine` and `workflow.*` is exact and documented: `Engine.evaluateInstance` → `Engine.evaluate` (matching `workflow.evaluate`); engine-only members (`session`, `subscriptionDocumentsForInstance`, `drainEffects`, `verifyDeployedDefinitions`) and the namespace-only `workflow.permissions` are called out as deliberate.
|
|
91
|
+
- One noun for the reactive session handle: `engine.instance(doc, opts?)` → `engine.session({instance, access?, grantsFromPath?})` (args object — no positional outlier), still returning `InstanceSession`; workflow-react's `WorkflowInstanceController` → `WorkflowSession`; the studio/sdk hooks `useWorkflowInstance` → `useWorkflowSession`. "Instance" now always means the document.
|
|
92
|
+
- Test bench mirrors the engine: `bench.startInstance` returns `OperationResult`, and the `Bench*Args` types are the engine-bound shapes minus `access`.
|
|
93
|
+
- CLI reports follow the rename: the report objects for `fire-action` / `move-stage` / `abort` (and `fire-action`'s `--json` payload) now say `changed` instead of `fired`.
|
|
94
|
+
|
|
95
|
+
- ad9b6f6: **BREAKING:** the observer's guard stream reports `undefined` until the first `listenQuery` emission, instead of masking loading as an empty guard list — the signal `@sanity/workflow-react` now uses to gate `ready` on guards.
|
|
96
|
+
- 748b23e: Read the Studio session token for the auto-bootstrapped App SDK instance from the source client's config (public `getClient` API) instead of scraping Studio's private localStorage entry — cookie-authenticated studios funnel into the same actionable error. Consume the SDK store layer through `@sanity/workflow-sdk/observer` and drop the unused `@sanity/sdk-react` peer dependency. The README now states the packaging truth (this adapter is a superset of the SDK store layer, not its peer) and documents the one remaining non-public Studio seam (`pair.editState`, `@hidden`/`@beta`).
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- 113a796: READMEs: the documented controller shape now includes `editField` (with its discrete-commit caveat — bind inline-field UIs to blur/Enter/debounce, never an `onChange` per keystroke), and the App SDK README's `createEngine` sample passes the shipped `tag` argument instead of the nonexistent `tags`.
|
|
101
|
+
- Updated dependencies [df00bbb]
|
|
102
|
+
- Updated dependencies [df00bbb]
|
|
103
|
+
- Updated dependencies [a0443c4]
|
|
104
|
+
- Updated dependencies [a0443c4]
|
|
105
|
+
- Updated dependencies [ad9b6f6]
|
|
106
|
+
- Updated dependencies [83d5924]
|
|
107
|
+
- Updated dependencies [7a655bd]
|
|
108
|
+
- Updated dependencies [d9c8179]
|
|
109
|
+
- Updated dependencies [0a7979a]
|
|
110
|
+
- Updated dependencies [df00bbb]
|
|
111
|
+
- Updated dependencies [df00bbb]
|
|
112
|
+
- Updated dependencies [df00bbb]
|
|
113
|
+
- Updated dependencies [ad9b6f6]
|
|
114
|
+
- Updated dependencies [5c69928]
|
|
115
|
+
- Updated dependencies [ad9b6f6]
|
|
116
|
+
- Updated dependencies [748b23e]
|
|
117
|
+
- Updated dependencies [2f081a3]
|
|
118
|
+
- Updated dependencies [df00bbb]
|
|
119
|
+
- Updated dependencies [113a796]
|
|
120
|
+
- Updated dependencies [113a796]
|
|
121
|
+
- Updated dependencies [df00bbb]
|
|
122
|
+
- Updated dependencies [8553787]
|
|
123
|
+
- Updated dependencies [2829643]
|
|
124
|
+
- Updated dependencies [6ee9068]
|
|
125
|
+
- Updated dependencies [6ee9068]
|
|
126
|
+
- Updated dependencies [2829643]
|
|
127
|
+
- Updated dependencies [a0443c4]
|
|
128
|
+
- @sanity/workflow-sdk@0.6.0
|
|
129
|
+
- @sanity/workflow-react@0.9.0
|
|
130
|
+
- @sanity/workflow-engine@0.14.0
|
|
131
|
+
|
|
132
|
+
## 0.5.0
|
|
133
|
+
|
|
134
|
+
### Minor Changes
|
|
135
|
+
|
|
136
|
+
- 5bbc3f0: **BREAKING:** `useWorkflowInstance` now takes a single options object, with the former `opts` bag flattened to top-level fields (matching `@sanity/workflow-sdk`'s hook):
|
|
137
|
+
- `useWorkflowInstance(engine, instanceId, opts)` → `useWorkflowInstance({engine, instanceId, access?, grantsFromPath?, sdk?})`
|
|
138
|
+
|
|
139
|
+
Behavior is unchanged — only the calling convention.
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [416d4c9]
|
|
144
|
+
- Updated dependencies [4dfe72a]
|
|
145
|
+
- Updated dependencies [5bbc3f0]
|
|
146
|
+
- Updated dependencies [5bbc3f0]
|
|
147
|
+
- Updated dependencies [5bbc3f0]
|
|
148
|
+
- Updated dependencies [0bf7503]
|
|
149
|
+
- Updated dependencies [6e51913]
|
|
150
|
+
- Updated dependencies [3229f41]
|
|
151
|
+
- @sanity/workflow-engine@0.13.0
|
|
152
|
+
- @sanity/workflow-react@0.8.0
|
|
153
|
+
- @sanity/workflow-sdk@0.5.0
|
|
154
|
+
|
|
155
|
+
## 0.4.2
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- Updated dependencies [5b10863]
|
|
160
|
+
- Updated dependencies [ae1434e]
|
|
161
|
+
- Updated dependencies [d850aef]
|
|
162
|
+
- Updated dependencies [9519c76]
|
|
163
|
+
- Updated dependencies [9233cd3]
|
|
164
|
+
- Updated dependencies [3ea4953]
|
|
165
|
+
- Updated dependencies [e5a862a]
|
|
166
|
+
- @sanity/workflow-engine@0.12.0
|
|
167
|
+
- @sanity/workflow-react@0.7.0
|
|
168
|
+
- @sanity/workflow-sdk@0.4.2
|
|
169
|
+
|
|
170
|
+
## 0.4.1
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- Updated dependencies [3b8f3de]
|
|
175
|
+
- @sanity/workflow-engine@0.11.0
|
|
176
|
+
- @sanity/workflow-react@0.6.1
|
|
177
|
+
- @sanity/workflow-sdk@0.4.1
|
|
178
|
+
|
|
179
|
+
## 0.4.0
|
|
180
|
+
|
|
181
|
+
### Minor Changes
|
|
182
|
+
|
|
183
|
+
- fae3553: **BREAKING:** Rename the domain concept **state → fields** across the whole API and persisted data model.
|
|
184
|
+
|
|
185
|
+
"State" was too easily conflated with "stage". The typed, valued data attached to workflows, stages, and tasks is now called **fields** — clearer, and aligned with Sanity schemas: the fields on a workflow, stage, and task can have typed values. This is a clean break (no migration, no back-compat); already-deployed definitions and instances must be redeployed/recreated.
|
|
186
|
+
|
|
187
|
+
**Authoring DSL**
|
|
188
|
+
- `defineState(...)` → `defineField(...)`
|
|
189
|
+
- The `state: [...]` array on a workflow / stage / task → `fields: [...]`
|
|
190
|
+
- The `$state.<name>` GROQ scope token → `$fields.<name>`
|
|
191
|
+
- A `claim` action's `state:` reference → `field:`
|
|
192
|
+
- A `stateRead` source → `fieldRead`; its `state:` (entry name) → `field:`
|
|
193
|
+
- Op targets address the entry by `field:` instead of `state:`
|
|
194
|
+
|
|
195
|
+
**Persisted / wire format**
|
|
196
|
+
- Op type strings `state.set` / `state.unset` / `state.append` / `state.updateWhere` / `state.removeWhere` → `field.*`
|
|
197
|
+
- The stored `state[]` array on instances, stage entries, and task entries → `fields[]`
|
|
198
|
+
- `startInstance({ initialState })` → `startInstance({ initialFields })`
|
|
199
|
+
|
|
200
|
+
**Types & functions** (engine)
|
|
201
|
+
|
|
202
|
+
`StateEntry`→`FieldEntry`, `AuthoringStateEntry`→`AuthoringFieldEntry`, `ResolvedStateEntry`→`ResolvedFieldEntry`, `InitialStateValue`→`InitialFieldValue`, `StateKind`→`FieldKind`, `StateValueMap`→`FieldValueMap`, `StateScope`→`FieldScope`, `StoredStateRef`→`StoredFieldRef`, `STATE_SLOT_DISPLAY`→`FIELD_SLOT_DISPLAY`, `EditStateArgs`→`EditFieldArgs`, `EditStateTarget`→`EditFieldTarget`, `EditStateDeniedError`→`EditFieldDeniedError`, `ConcurrentEditStateError`→`ConcurrentEditFieldError`, `RequiredStateNotProvidedError`→`RequiredFieldNotProvidedError`, and the `editState` verb → `editField`.
|
|
203
|
+
|
|
204
|
+
Unchanged: runtime/lifecycle instance "state" (stage moves, `WorkflowStateDivergedError`, the projected instance snapshot), the `field`/`fields` JSON-matching primitives in `updateWhere`/`removeWhere` predicates and object Sources, and the Content Lake release `state`.
|
|
205
|
+
|
|
206
|
+
### Patch Changes
|
|
207
|
+
|
|
208
|
+
- Updated dependencies [fae3553]
|
|
209
|
+
- @sanity/workflow-engine@0.10.0
|
|
210
|
+
- @sanity/workflow-react@0.6.0
|
|
211
|
+
- @sanity/workflow-sdk@0.4.0
|
|
212
|
+
|
|
213
|
+
## 0.3.5
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- 2e4c980: Add a generic edit seam for declared-editable workflow state.
|
|
218
|
+
|
|
219
|
+
State slots can now declare `editable` (default off) and be written directly
|
|
220
|
+
through one `editState` verb — reassign, reschedule, claim-by-hand, append to a
|
|
221
|
+
log — instead of a bespoke action per field.
|
|
222
|
+
- `editable` on a state slot — default off. _Who_ may edit is expressed with
|
|
223
|
+
the gating actions already have, not a new permission concept: `true` (anyone
|
|
224
|
+
in the slot's scope window), a **role list** (the same `action.roles` sugar —
|
|
225
|
+
it desugars to the identical `count($actor.roles[@ in [...]]) > 0` membership
|
|
226
|
+
predicate), or a raw GROQ predicate (checked like `action.filter`). A stage
|
|
227
|
+
may TIGHTEN a slot via an `editable` override map — the override is ANDed with
|
|
228
|
+
the slot's baseline, so it can only narrow, never open a closed slot.
|
|
229
|
+
- `editState` engine verb (and `engine.editState` / `instanceSession.editState`):
|
|
230
|
+
gates on the slot's editability and scope window, applies the edit as a
|
|
231
|
+
`state.*` op (so provenance + history are stamped by the op path), refreshes
|
|
232
|
+
the stage's guards, then cascades — an edit to a value a transition reads can
|
|
233
|
+
move the instance. Advisory like every engine gate; the lake ACL + guards are
|
|
234
|
+
the only hard locks.
|
|
235
|
+
- Scope is the editable window: a workflow slot is editable while the instance
|
|
236
|
+
is live, a stage slot while its stage is current, a task slot while its task
|
|
237
|
+
is active.
|
|
238
|
+
- The projection gains `editableSlots`: each declared-editable slot in scope
|
|
239
|
+
with this actor's edit verdict and the current value's provenance (`setBy` /
|
|
240
|
+
`setAt`, read off `opApplied` history — no denormalised copy). `EditDisabledReason`
|
|
241
|
+
and `EditStateDeniedError` mirror the action verdict surface.
|
|
242
|
+
- `@sanity/workflow-react`'s controller exposes `editState`, threaded through
|
|
243
|
+
the Studio and App SDK adapters.
|
|
244
|
+
|
|
245
|
+
- Updated dependencies [2e4c980]
|
|
246
|
+
- Updated dependencies [fd6b866]
|
|
247
|
+
- @sanity/workflow-engine@0.9.0
|
|
248
|
+
- @sanity/workflow-react@0.5.0
|
|
249
|
+
- @sanity/workflow-sdk@0.3.5
|
|
250
|
+
|
|
251
|
+
## 0.3.4
|
|
252
|
+
|
|
253
|
+
### Patch Changes
|
|
254
|
+
|
|
255
|
+
- Updated dependencies [c298ee2]
|
|
256
|
+
- Updated dependencies [8131dd5]
|
|
257
|
+
- Updated dependencies [8bf467e]
|
|
258
|
+
- @sanity/workflow-engine@0.8.0
|
|
259
|
+
- @sanity/workflow-react@0.4.2
|
|
260
|
+
- @sanity/workflow-sdk@0.3.4
|
|
261
|
+
|
|
262
|
+
## 0.3.3
|
|
263
|
+
|
|
264
|
+
### Patch Changes
|
|
265
|
+
|
|
266
|
+
- Updated dependencies [ef927bc]
|
|
267
|
+
- Updated dependencies [32f5e64]
|
|
268
|
+
- Updated dependencies [df7582f]
|
|
269
|
+
- Updated dependencies [ed4174c]
|
|
270
|
+
- Updated dependencies [129258c]
|
|
271
|
+
- @sanity/workflow-engine@0.7.0
|
|
272
|
+
- @sanity/workflow-sdk@0.3.3
|
|
273
|
+
- @sanity/workflow-react@0.4.1
|
|
274
|
+
|
|
275
|
+
## 0.3.2
|
|
276
|
+
|
|
277
|
+
### Patch Changes
|
|
278
|
+
|
|
279
|
+
- 6d5290b: `makeStudioObserver`'s guard stream now spans every dataset resource the instance's GDRs name: guards in the mounted workspace dataset observe through `documentStore.listenQuery`, guards in any other dataset (the engine's own, or a subject's) through the embedded App SDK — the same routing `observeDocs` already uses for foreign content refs. Previously only the engine dataset was read, so a guard locking a subject in another dataset was invisible. Tracks the updated `observeGuards` contract in `@sanity/workflow-react`.
|
|
280
|
+
- Updated dependencies [6d5290b]
|
|
281
|
+
- Updated dependencies [6d5290b]
|
|
282
|
+
- Updated dependencies [c6d1762]
|
|
283
|
+
- @sanity/workflow-react@0.4.0
|
|
284
|
+
- @sanity/workflow-sdk@0.3.2
|
|
285
|
+
- @sanity/workflow-engine@0.6.0
|
|
286
|
+
|
|
287
|
+
## 0.3.1
|
|
288
|
+
|
|
289
|
+
### Patch Changes
|
|
290
|
+
|
|
291
|
+
- Updated dependencies [dbc4afa]
|
|
292
|
+
- Updated dependencies [e2a6d5d]
|
|
293
|
+
- Updated dependencies [aa87a1c]
|
|
294
|
+
- @sanity/workflow-engine@0.5.0
|
|
295
|
+
- @sanity/workflow-react@0.3.1
|
|
296
|
+
- @sanity/workflow-sdk@0.3.1
|
|
297
|
+
|
|
298
|
+
## 0.3.0
|
|
299
|
+
|
|
300
|
+
### Minor Changes
|
|
301
|
+
|
|
302
|
+
- 12e23b0: Support a dedicated workflow-state dataset: the engine's `workflowResource` is routinely a different dataset (e.g. `workflows`) from every content workspace, so the adapters now route **instance and guard observation** to the engine's dataset, derived automatically from `engine.workflowResource`.
|
|
303
|
+
- `@sanity/workflow-react`: `datasetResourceId(workflowResource)` + `sameDataset` helpers.
|
|
304
|
+
- `@sanity/workflow-sdk` (breaking for direct `makeSdkObserver` callers): the observer takes `{engineResource}`; new exports `sdkInstanceDocStore` / `sdkGuardStore` observe the instance + guards in the engine dataset via per-resource SDK stores.
|
|
305
|
+
- `@sanity/workflow-studio` (breaking for direct `makeStudioObserver` callers): the observer takes `{mounted, engineResource, sdk?}` and is now exported alongside `StudioObserverOptions` (matching `makeSdkObserver`); when the engine dataset is not the workspace, the hook bootstraps an App SDK instance automatically from the Studio session (override with `opts.sdk`; cookie-authenticated studios must supply one — the failure is loud and actionable), and instance + guard observation delegate to it. `documentStore` is used only for what it can address: the mounted dataset.
|
|
306
|
+
|
|
307
|
+
Adds `apps/test-studio` + `apps/test-sdk` — private validation harnesses that render the controller state as plain JSON against the live multi-dataset topology (see `apps/README.md`).
|
|
308
|
+
|
|
309
|
+
- 12e23b0: Watched refs now route to a store that can actually address them — never a silent wrong-dataset read.
|
|
310
|
+
|
|
311
|
+
**workflow-react:** new `classifyRef(ref, mounted)` — the routing verdict (`mounted-dataset` vs `foreign-resource`) the Studio adapter keys its per-ref dispatch on (the SDK adapter routes every ref per-resource unconditionally).
|
|
312
|
+
|
|
313
|
+
**workflow-sdk:** `sdkContentDocStore` (exported) routes each content ref to the App SDK document store keyed by the ref's own `projectId`/`dataset` — the SDK store spins up a per-resource listener + resource-scoped client, so cross-dataset refs are observed live (the instance's auth must cover the resource). Non-`dataset:` schemes (`canvas:`, `media-library:`, `dashboard:`) now throw an actionable error instead of being silently misread against the default dataset.
|
|
314
|
+
|
|
315
|
+
**workflow-studio (breaking for direct `makeStudioObserver` callers — now exported):** the observer takes `{mounted, engineResource, sdk?}` and routes per ref — refs in the mounted workspace dataset observe through `documentStore.pair.editState` (Studio's local uncommitted edits included); every other resource observes through an App SDK instance: the one supplied via `useWorkflowInstance(engine, id, {sdk})`, or the one the hook bootstraps automatically when the engine dataset is foreign (see the engine-dataset routing entry in this release). A foreign ref with no SDK instance available throws the config-mismatch error the adapter always needed instead of silently watching the workspace dataset under the same `_id`.
|
|
316
|
+
|
|
317
|
+
- fcf938a: The document-store observers now watch the renamed `sanity.workflow.instance` document type, importing the engine's exported `WORKFLOW_INSTANCE_TYPE` constant instead of hardcoding the old `workflow.instance` type string — so instance documents resolve again in the App SDK and Studio adapters.
|
|
318
|
+
- 12e23b0: Live lake mutation guards now flow through the reactive stack and into evaluation.
|
|
319
|
+
|
|
320
|
+
**Engine:** `InstanceSession` gains `updateGuards(guards)`, and `evaluateFromSnapshot` accepts `guards` — every action commit is an `update` write to the instance doc, so a held guard that matches the instance and denies that write disables every action with the (previously declared but never produced) `mutation-guard-denied` reason, carrying the denying `guardIds`. A lifted guard (predicate `"true"`) allows; deny-all (`""`) denies; fail-closed. `fireAction`'s soft-gate uses the same projection, so firing while guard-denied throws `ActionDisabledError` with the structured reason. The stateless fetch path agrees: `workflow.evaluate` / `workflow.fireAction` load the instance's guards (new `verdictGuardsForInstance`) before evaluating, so both paths produce the same verdicts for the same state. Verdict loads are **physically scoped to the engine's own datasource** — a guard enforces solely within the datasource it lives in, so neither an honestly-stamped foreign guard nor a forged guard doc planted in a watched content dataset can ever flip a verdict (the cross-datasource `guardsForInstance` union remains housekeeping-only). `tick` (session and stateless) pre-flights the same instance write and fails fast with `MutationGuardDeniedError` before entering the multi-step cascade, instead of risking a partially-applied move; best-effort — the lake remains the final arbiter and the rollback machinery stays the backstop. New `instanceGuardQuery(instanceId)` is the single definition of the per-instance guard filter, shared by the verdict load and the adapters' subscriptions.
|
|
321
|
+
|
|
322
|
+
**Adapters:** `useWorkflowInstance` / `useWorkflowSession` expose a live `guards` field and feed the stream into the session, so action verdicts re-evaluate as guards are deployed on stage entry and lifted on exit. Driven by a new required `observeGuards` method on `WorkflowObserver` (breaking for custom observers; the first-party SDK and Studio observers implement it via the SDK query store / Studio's `listenQuery`, engine-dataset-scoped), built on the engine's `instanceGuardQuery` and workflow-react's shared `NO_GUARDS` unresolved snapshot.
|
|
323
|
+
|
|
324
|
+
### Patch Changes
|
|
325
|
+
|
|
326
|
+
- Updated dependencies [fcf938a]
|
|
327
|
+
- Updated dependencies [4b5f59a]
|
|
328
|
+
- Updated dependencies [fcf938a]
|
|
329
|
+
- Updated dependencies [12e23b0]
|
|
330
|
+
- Updated dependencies [12e23b0]
|
|
331
|
+
- Updated dependencies [6c4e0a0]
|
|
332
|
+
- Updated dependencies [fcf938a]
|
|
333
|
+
- Updated dependencies [12e23b0]
|
|
334
|
+
- Updated dependencies [12e23b0]
|
|
335
|
+
- @sanity/workflow-react@0.3.0
|
|
336
|
+
- @sanity/workflow-engine@0.4.0
|
|
337
|
+
- @sanity/workflow-sdk@0.3.0
|
|
338
|
+
|
|
339
|
+
## 0.2.0
|
|
340
|
+
|
|
341
|
+
### Minor Changes
|
|
342
|
+
|
|
343
|
+
- 3abbd22: New package: a React adapter that drives the `@sanity/workflow-engine` reactive session from the Sanity Studio document store.
|
|
344
|
+
- `useWorkflowInstance(engine, instanceId)` → `{evaluation, ready, tick, fireAction}`. A thin wrapper over `@sanity/workflow-react`: it builds a `WorkflowObserver` over `documentStore.pair.editState` (Studio's optimistic, replayed store) and hands it to `useWorkflowSession`, which owns the session orchestration.
|
|
345
|
+
- Content docs resolve under the perspective's release via the `editState` version arg (from the engine's `contentReleaseName`); instance / ancestor / `system.release` docs read raw. `editState.ready` gates the feed. Observe-only — `tick`/`fireAction` commit through the engine's own lake-guarded client.
|
|
346
|
+
- Peer-deps `react` / `sanity` (Sanity-plugin pattern). Must render inside Studio source context. `documentStore.pair.editState` is `@beta`/`@internal` in Studio, so the `sanity` peer range is pinned tightly.
|
|
347
|
+
|
|
348
|
+
### Patch Changes
|
|
349
|
+
|
|
350
|
+
- Updated dependencies [41ddd80]
|
|
351
|
+
- Updated dependencies [0c6ccde]
|
|
352
|
+
- Updated dependencies [bdcba10]
|
|
353
|
+
- @sanity/workflow-engine@0.3.0
|
|
354
|
+
- @sanity/workflow-react@0.2.0
|
package/README.md
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
Reactive workflow adapter for **Sanity Studio**. Everything must render inside
|
|
4
4
|
Studio source context (`useDocumentStore` / `useSource` / `useClient`).
|
|
5
5
|
|
|
6
|
-
- `useWorkflowEngine({workflowResource, tag, resourceClients
|
|
6
|
+
- `useWorkflowEngine({workflowResource, tag, resourceClients?})` —
|
|
7
7
|
build the Studio-side engine once: the workspace client rebound to the
|
|
8
|
-
engine's state dataset (
|
|
9
|
-
`
|
|
10
|
-
default per-resource routing that reaches any `dataset:`
|
|
11
|
-
the same client. A custom `resourceClients` replaces the default — delegate
|
|
12
|
-
to `studioResourceClients` for the dataset arm
|
|
13
|
-
(media-library, canvas)
|
|
8
|
+
engine's state dataset (engine traffic always rides the engine's own API
|
|
9
|
+
version — `createEngine` pins it), with `studioResourceClients` (also
|
|
10
|
+
exported) as the default per-resource routing that reaches any `dataset:`
|
|
11
|
+
GDR by rebinding the same client, pinned to the engine version too. A custom `resourceClients` replaces the default — delegate
|
|
12
|
+
to `studioResourceClients` for the dataset arm; schemes it returns
|
|
13
|
+
`undefined` for (media-library, canvas) are routed by the engine itself,
|
|
14
|
+
which derives a sibling client from the engine client's credentials.
|
|
14
15
|
- `useWorkflowSession` — drives an engine session for one instance and
|
|
15
|
-
returns
|
|
16
|
+
returns
|
|
17
|
+
`{evaluation, ready, guards, tick, fireAction, editField, previewField, discardFieldPreview}`.
|
|
16
18
|
- `useWorkflowInstances` / `useDocumentWorkflows` — live instance lists
|
|
17
19
|
(filterable collection / per-document discovery), each returning
|
|
18
20
|
`{instances, loading}`. The list observes `documentStore.listenQuery` when
|
|
@@ -58,8 +60,10 @@ throws, instead of being misread from the workspace dataset under the same
|
|
|
58
60
|
instance, the same path foreign content refs take.
|
|
59
61
|
- **Auth caveat for foreign refs:** the SDK instance's auth must cover the
|
|
60
62
|
foreign resource; a foreign _project_ needs a session/token valid there.
|
|
61
|
-
- `makeStudioObserver(documentStore, {mounted, engineResource, sdk?})`
|
|
62
|
-
exported for custom wiring, matching `makeSdkObserver`.
|
|
63
|
+
- `makeStudioObserver(documentStore, {mounted, client, engineResource, sdk?})`
|
|
64
|
+
is exported for custom wiring, matching `makeSdkObserver`. `client` is
|
|
65
|
+
required: a workspace-bound client that carries `ensureDocumentExists`
|
|
66
|
+
writes into the mounted dataset.
|
|
63
67
|
|
|
64
68
|
Remaining gaps (ancestor-instance guards, full cascade write-set pre-flight,
|
|
65
69
|
live cross-dataset end-to-end verification) are known follow-up work.
|