@sanity/workflow-studio 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @sanity/workflow-studio
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2de38fd: **BREAKING:** `createEngine` takes its effect settings as one `effects` group. The top-level `effectHandlers`, `effectLeaseMs`, and `missingHandler` options are removed, with no alias and no deprecation shim, so everyone who builds an engine — a Sanity Function drainer, a hosted runtime, a script, a test — must move them into `effects: {handlers, leaseMs, missingHandler}`. An unmigrated TypeScript call stops compiling. An unmigrated plain-JavaScript call still builds an engine, but one with no handlers and the default `fail` policy, so its first drain throws `MissingHandlerError` instead of dispatching.
8
+
9
+ Migrate every construction site: `createEngine({client, workflowResource, tag, effectHandlers: H, effectLeaseMs: L, missingHandler: P})` becomes `createEngine({client, workflowResource, tag, effects: {handlers: H, leaseMs: L, missingHandler: P}})`. The resolved values read back off the engine under the same word, so `engine.effectHandlers` and `engine.missingHandler` become `engine.effects.handlers` and `engine.effects.missingHandler`. Nothing about draining changes: the same `fail` default, the same five-minute default lease, and the same claim, dispatch, and deploy-verification semantics. `@sanity/workflow-engine-test`'s `createBenchEngine(bench, overrides)` forwards `CreateEngineArgs` unchanged, so bench engines move their handler and policy overrides into the same group.
10
+
11
+ `@sanity/workflow-studio`'s `useWorkflowEngine` follows the engine: its `effectHandlers` and `missingHandler` props are replaced by one `effects` prop taking the engine's exported `EngineEffectsArgs`, so a Studio-side drainer passes `effects: {handlers, missingHandler}`. Keep that object referentially stable, at module scope or through `useMemo` — the hook memoizes the engine on it, and a new object every render rebuilds the engine every render. The `@sanity/workflow-studio-plugin` `effectHandlers` config key is unchanged; the plugin translates it into the group where it builds the engine.
12
+
13
+ **Docs impact:** Update the `createEngine` options reference and the effects concepts page for the new group, the missing-handler and claim-lease reference entries that named the old keys, the `useWorkflowEngine` adapter reference, the Studio plugin README's drain-function example, and every cookbook or runtime example that constructs an engine with handlers; carry the migration into the release notes.
14
+
15
+ - 26dd4e5: Generated API references now include every type used by a public signature and link cross-package symbols to their authoritative package entry. Caller-facing helper contracts such as field mutation operations, engine operation context types, test-bench argument types, member avatar data, MCP client policy, and Studio user clients are now available as named exports where their public APIs already expose those shapes. GROQ condition consumers can import the documented `COMPARISON_OPS` list alongside its `ComparisonOp` type, while the shared cross-package exhaustiveness helper is an unsupported `@internal` export and is omitted from the reference.
16
+
17
+ **No upgrade action required.** Existing imports and runtime behavior remain compatible; consumers may adopt the new named type exports instead of reconstructing those shapes locally.
18
+
19
+ **Docs impact:** Refresh the generated API references for the affected packages; no conceptual guides, examples, or migration guidance need changes.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [a8ed312]
24
+ - Updated dependencies [2ba0c09]
25
+ - Updated dependencies [2de38fd]
26
+ - Updated dependencies [a2ce4a7]
27
+ - Updated dependencies [2ddd3d7]
28
+ - Updated dependencies [6035672]
29
+ - Updated dependencies [26dd4e5]
30
+ - Updated dependencies [b04580d]
31
+ - @sanity/workflow-engine@0.32.0
32
+ - @sanity/workflow-react@0.32.0
33
+ - @sanity/workflow-sdk@0.32.0
34
+
3
35
  ## 0.31.0
4
36
 
5
37
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -103,7 +103,7 @@ function useSharedDispose(owner, shared) {
103
103
  }, [ owner, shared ]);
104
104
  }
105
105
 
106
- function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effectHandlers: effectHandlers, missingHandler: missingHandler}) {
106
+ function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effects: effects}) {
107
107
  const client = sanity.useClient({
108
108
  apiVersion: workflowEngine.ENGINE_API_VERSION
109
109
  }), resource = observer.useKeyed([ workflowResource.type, workflowResource.id ], () => workflowResource), telemetry = workflowReact.useWorkflowTelemetry();
@@ -122,15 +122,12 @@ function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resour
122
122
  executionContext: {
123
123
  kind: workflowEngine.EXECUTION_KINDS.studio
124
124
  },
125
- ...effectHandlers !== void 0 ? {
126
- effectHandlers: effectHandlers
127
- } : {},
128
- ...missingHandler !== void 0 ? {
129
- missingHandler: missingHandler
125
+ ...effects !== void 0 ? {
126
+ effects: effects
130
127
  } : {},
131
128
  telemetry: telemetry
132
129
  });
133
- }, [ client, resource, tag, resourceClients, effectHandlers, missingHandler, telemetry ]);
130
+ }, [ client, resource, tag, resourceClients, effects, telemetry ]);
134
131
  }
135
132
 
136
133
  function studioResourceClients(client) {
package/dist/index.d.cts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { DatasetResourceId } from "@sanity/workflow-react/observer";
2
- import { EffectHandler } from "@sanity/workflow-engine";
3
2
  import { Engine } from "@sanity/workflow-engine";
3
+ import { EngineEffectsArgs } from "@sanity/workflow-engine";
4
4
  import { EnsureDocumentClient } from "@sanity/workflow-react/observer";
5
5
  import type { GdrUri } from "@sanity/workflow-engine";
6
6
  import { InstancePreviewList } from "@sanity/workflow-react";
7
7
  import { InstancePreviewsFilter } from "@sanity/workflow-react";
8
8
  import type { InstancesQueryFilter } from "@sanity/workflow-engine";
9
- import { MissingHandlerPolicy } from "@sanity/workflow-engine";
10
9
  import { MutationGuardDoc } from "@sanity/workflow-react";
11
10
  import { ProjectRole } from "@sanity/workflow-sdk/project-users";
12
11
  import { ProjectUserDirectory } from "@sanity/workflow-engine";
@@ -94,7 +93,7 @@ export declare function studioResourceClients(
94
93
  client: SanityClient,
95
94
  ): ResourceClientResolver;
96
95
 
97
- declare interface StudioUserClient {
96
+ export declare interface StudioUserClient {
98
97
  readonly config: () => {
99
98
  readonly projectId?: string;
100
99
  };
@@ -144,24 +143,22 @@ export declare function useStudioProjectUsers(): StudioProjectUsersState;
144
143
  * per-resource routing — so subjects and refs across many content datasets
145
144
  * resolve without call sites assembling clients. Pass `resourceClients` to
146
145
  * override the routing (compose with {@link studioResourceClients} to keep
147
- * dataset-GDR routing). `effectHandlers`/`missingHandler` feed
148
- * {@link Engine.drainEffects} for engines that drain effects in the Studio.
146
+ * dataset-GDR routing). `effects` feeds {@link Engine.drainEffects} for engines
147
+ * that drain effects in the Studio.
149
148
  * Memoized on the config's content, so inline `workflowResource` literals are
150
- * fine; custom `resourceClients` and `effectHandlers` values should still be
149
+ * fine; custom `resourceClients` and `effects` values should still be
151
150
  * stable. Must render inside Studio source context.
152
151
  */
153
152
  export declare function useWorkflowEngine({
154
153
  workflowResource,
155
154
  tag,
156
155
  resourceClients,
157
- effectHandlers,
158
- missingHandler,
156
+ effects,
159
157
  }: {
160
158
  workflowResource: WorkflowResource;
161
159
  tag: string;
162
160
  resourceClients?: ResourceClientResolver;
163
- effectHandlers?: Record<string, EffectHandler<SanityClient>>;
164
- missingHandler?: MissingHandlerPolicy;
161
+ effects?: EngineEffectsArgs<SanityClient>;
165
162
  }): Engine;
166
163
 
167
164
  /** A live, progressively-hydrated instance-preview list observed from Sanity
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { DatasetResourceId } from "@sanity/workflow-react/observer";
2
- import { EffectHandler } from "@sanity/workflow-engine";
3
2
  import { Engine } from "@sanity/workflow-engine";
3
+ import { EngineEffectsArgs } from "@sanity/workflow-engine";
4
4
  import { EnsureDocumentClient } from "@sanity/workflow-react/observer";
5
5
  import type { GdrUri } from "@sanity/workflow-engine";
6
6
  import { InstancePreviewList } from "@sanity/workflow-react";
7
7
  import { InstancePreviewsFilter } from "@sanity/workflow-react";
8
8
  import type { InstancesQueryFilter } from "@sanity/workflow-engine";
9
- import { MissingHandlerPolicy } from "@sanity/workflow-engine";
10
9
  import { MutationGuardDoc } from "@sanity/workflow-react";
11
10
  import { ProjectRole } from "@sanity/workflow-sdk/project-users";
12
11
  import { ProjectUserDirectory } from "@sanity/workflow-engine";
@@ -94,7 +93,7 @@ export declare function studioResourceClients(
94
93
  client: SanityClient,
95
94
  ): ResourceClientResolver;
96
95
 
97
- declare interface StudioUserClient {
96
+ export declare interface StudioUserClient {
98
97
  readonly config: () => {
99
98
  readonly projectId?: string;
100
99
  };
@@ -144,24 +143,22 @@ export declare function useStudioProjectUsers(): StudioProjectUsersState;
144
143
  * per-resource routing — so subjects and refs across many content datasets
145
144
  * resolve without call sites assembling clients. Pass `resourceClients` to
146
145
  * override the routing (compose with {@link studioResourceClients} to keep
147
- * dataset-GDR routing). `effectHandlers`/`missingHandler` feed
148
- * {@link Engine.drainEffects} for engines that drain effects in the Studio.
146
+ * dataset-GDR routing). `effects` feeds {@link Engine.drainEffects} for engines
147
+ * that drain effects in the Studio.
149
148
  * Memoized on the config's content, so inline `workflowResource` literals are
150
- * fine; custom `resourceClients` and `effectHandlers` values should still be
149
+ * fine; custom `resourceClients` and `effects` values should still be
151
150
  * stable. Must render inside Studio source context.
152
151
  */
153
152
  export declare function useWorkflowEngine({
154
153
  workflowResource,
155
154
  tag,
156
155
  resourceClients,
157
- effectHandlers,
158
- missingHandler,
156
+ effects,
159
157
  }: {
160
158
  workflowResource: WorkflowResource;
161
159
  tag: string;
162
160
  resourceClients?: ResourceClientResolver;
163
- effectHandlers?: Record<string, EffectHandler<SanityClient>>;
164
- missingHandler?: MissingHandlerPolicy;
161
+ effects?: EngineEffectsArgs<SanityClient>;
165
162
  }): Engine;
166
163
 
167
164
  /** A live, progressively-hydrated instance-preview list observed from Sanity
package/dist/index.js CHANGED
@@ -111,7 +111,7 @@ function useSharedDispose(owner, shared) {
111
111
  }, [ owner, shared ]);
112
112
  }
113
113
 
114
- function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effectHandlers: effectHandlers, missingHandler: missingHandler}) {
114
+ function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effects: effects}) {
115
115
  const client = useClient({
116
116
  apiVersion: ENGINE_API_VERSION
117
117
  }), resource = useKeyed([ workflowResource.type, workflowResource.id ], () => workflowResource), telemetry = useWorkflowTelemetry();
@@ -130,15 +130,12 @@ function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resour
130
130
  executionContext: {
131
131
  kind: EXECUTION_KINDS.studio
132
132
  },
133
- ...effectHandlers !== void 0 ? {
134
- effectHandlers: effectHandlers
135
- } : {},
136
- ...missingHandler !== void 0 ? {
137
- missingHandler: missingHandler
133
+ ...effects !== void 0 ? {
134
+ effects: effects
138
135
  } : {},
139
136
  telemetry: telemetry
140
137
  });
141
- }, [ client, resource, tag, resourceClients, effectHandlers, missingHandler, telemetry ]);
138
+ }, [ client, resource, tag, resourceClients, effects, telemetry ]);
142
139
  }
143
140
 
144
141
  function studioResourceClients(client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-studio",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "React adapter that drives the @sanity/workflow-engine reactive session in Sanity Studio through the App SDK store.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -50,23 +50,24 @@
50
50
  "react-dom": "^19.2.7",
51
51
  "sanity": "^6",
52
52
  "vitest": "^4.1.8",
53
- "@sanity/workflow-engine": "0.31.0",
54
- "@sanity/workflow-react": "0.31.0",
55
- "@sanity/workflow-sdk": "0.31.0"
53
+ "@sanity/workflow-engine": "0.32.0",
54
+ "@sanity/workflow-react": "0.32.0",
55
+ "@sanity/workflow-sdk": "0.32.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@sanity/sdk": "^2.12.0",
59
59
  "react": "^19.2.7",
60
60
  "sanity": "^6",
61
- "@sanity/workflow-engine": "0.31.0",
62
- "@sanity/workflow-react": "0.31.0",
63
- "@sanity/workflow-sdk": "0.31.0"
61
+ "@sanity/workflow-engine": "0.32.0",
62
+ "@sanity/workflow-react": "0.32.0",
63
+ "@sanity/workflow-sdk": "0.32.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=20"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "pkg-utils build --clean",
70
+ "docs": "node ../../scripts/run-typedoc.mjs",
70
71
  "test": "vitest run",
71
72
  "test:watch": "vitest",
72
73
  "typecheck": "tsc --noEmit -p tsconfig.json"