@sanity/workflow-studio 0.31.0 → 0.33.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,81 @@
1
1
  # @sanity/workflow-studio
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 225e0fb: **BREAKING:** Workflows App SDK and Studio integrations now require `@sanity/sdk` 3.1 or later in the 3.x line, and `@sanity/workflow-sdk` requires the matching `@sanity/sdk-react` 3.1 line when its React entry is used. The previous SDK 2 peer contract is no longer supported. The exported `WorkflowClient`, `TelemetryIntakeClient`, `ProjectUserProfileClient`, and `StudioUserClient` request contracts now pass their target in `url`; the previous `uri` request target is no longer used. The engine's effective client config also accepts the broader `{type: string, id: string}` resource descriptors returned by Sanity client 8.
8
+
9
+ Before upgrading Workflows, upgrade `@sanity/sdk` and `@sanity/sdk-react` together to 3.1 or later. Applications that stay on SDK 2 must stay on an earlier Workflows release. If you implement any of the request contracts named above, update it to read the request target from `url` instead of `uri`; otherwise its request-backed reads will fail. Existing `WorkflowClient.config()` implementations need no change when their resource descriptor already has string `type` and `id` fields. No separate CLI upgrade action is required; its definition-sharing and telemetry requests adopt `url` internally.
10
+
11
+ Before installing, override SDK 3's `@sanity/mutate` dependency to `0.18.2` in your application's root package-manager configuration, reinstall, and commit the updated lockfile. SDK 3.1.0 allows Mutate 0.18.1, which can leave document reads pending with client 8. For npm, set `overrides["@sanity/sdk"]["@sanity/mutate"]` to `"0.18.2"` in `package.json`. For pnpm, set `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in `pnpm-workspace.yaml`. Keep the override until your SDK release requires Mutate 0.18.2 or later. Complete examples and verification steps are in the Installation section of the published `@sanity/workflow-sdk` README.
12
+
13
+ Malformed project-member responses now report an inaccessible directory and can recover on a later lookup, instead of being cached as a missing user. No additional upgrade action is required for this correction.
14
+
15
+ **Docs impact:** Update the App SDK and Studio integration installation guidance, package compatibility references, and examples to require Sanity App SDK 3.1 and the consumer Mutate override described in the published `@sanity/workflow-sdk` README; update the client API references for `request({url})`, effective resource descriptors, and directory-response failures.
16
+
17
+ ### Patch Changes
18
+
19
+ - 7eb9eca: Correct the API references for field initialization and edits, start requirements,
20
+ transitions, reference IDs, effect handling, reactive state, member controls,
21
+ Studio mappings, test helpers, and GROQ condition outcomes. The references state
22
+ caller constraints and defaults that were missing or incorrect. Package setup
23
+ guidance identifies the public npm packages and supported deployment command;
24
+ the MCP validation description distinguishes validation from deployment checks.
25
+ Runtime behavior and API signatures are unchanged.
26
+
27
+ **No upgrade action required.**
28
+
29
+ **Docs impact:** After release and reference sync, reconcile the modeling,
30
+ runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
31
+ guides and references with the corrected contracts. Fix affected examples and
32
+ replace redundant API inventories with verified symbol links while preserving
33
+ useful teaching and the CLI/MCP reference material not exposed by TypeDoc.
34
+
35
+ - Updated dependencies [393ac71]
36
+ - Updated dependencies [8874c50]
37
+ - Updated dependencies [0555271]
38
+ - Updated dependencies [b3b2797]
39
+ - Updated dependencies [225e0fb]
40
+ - Updated dependencies [7eb9eca]
41
+ - Updated dependencies [2cef086]
42
+ - Updated dependencies [232f811]
43
+ - @sanity/workflow-engine@0.33.0
44
+ - @sanity/workflow-sdk@0.33.0
45
+ - @sanity/workflow-react@0.33.0
46
+
47
+ ## 0.32.0
48
+
49
+ ### Minor Changes
50
+
51
+ - 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.
52
+
53
+ 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.
54
+
55
+ `@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.
56
+
57
+ **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.
58
+
59
+ - 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.
60
+
61
+ **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.
62
+
63
+ **Docs impact:** Refresh the generated API references for the affected packages; no conceptual guides, examples, or migration guidance need changes.
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies [a8ed312]
68
+ - Updated dependencies [2ba0c09]
69
+ - Updated dependencies [2de38fd]
70
+ - Updated dependencies [a2ce4a7]
71
+ - Updated dependencies [2ddd3d7]
72
+ - Updated dependencies [6035672]
73
+ - Updated dependencies [26dd4e5]
74
+ - Updated dependencies [b04580d]
75
+ - @sanity/workflow-engine@0.32.0
76
+ - @sanity/workflow-react@0.32.0
77
+ - @sanity/workflow-sdk@0.32.0
78
+
3
79
  ## 0.31.0
4
80
 
5
81
  ### Patch Changes
package/README.md CHANGED
@@ -99,12 +99,26 @@ live cross-dataset end-to-end verification) are known follow-up work.
99
99
  This adapter composes `@sanity/workflow-sdk`'s store layer through its headless
100
100
  `./observer` entry. What that means for installs:
101
101
 
102
- - **`@sanity/sdk` is required** (peer) — it addresses every observed resource.
102
+ - **`@sanity/sdk` 3.1 or later in the 3.x line is required** (peer) — it addresses every observed resource.
103
103
  - **`@sanity/workflow-engine` is required** (peer) — the host and adapter share one engine runtime.
104
104
  - **`@sanity/workflow-react` and `@sanity/workflow-sdk` are required** (exact-version peers) — install the matching Workflows release stack so the reactive context and SDK store are single-sourced.
105
105
  - **`@sanity/sdk-react` is NOT required** — nothing here touches the App
106
106
  SDK's React binding.
107
107
 
108
+ Before installing, configure your application's root overrides to select
109
+ Mutate 0.18.2 for SDK 3. For npm, set
110
+ `overrides["@sanity/sdk"]["@sanity/mutate"]` to `"0.18.2"` in
111
+ `package.json`. For pnpm, set
112
+ `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in
113
+ `pnpm-workspace.yaml`. An existing lockfile can otherwise retain Mutate
114
+ 0.18.1 and leave document reads pending.
115
+
116
+ Reinstall, commit the configuration and lockfile, and verify SDK 3 resolves
117
+ Mutate 0.18.2 with `npm ls @sanity/sdk @sanity/mutate` or
118
+ `pnpm why @sanity/mutate`. Remove the override only once your SDK release
119
+ requires Mutate 0.18.2 or later. Complete examples are in the
120
+ [SDK package's installation guide](https://www.npmjs.com/package/@sanity/workflow-sdk#installation).
121
+
108
122
  `useSource` remains a non-public Studio context hook, which is the standard
109
123
  plugin-context caveat.
110
124
 
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) {
@@ -218,15 +215,11 @@ function isRole(value) {
218
215
  }
219
216
 
220
217
  function isMembership(value) {
221
- return isRecord(value) && typeof value.id == "string" && (value.isRobot === void 0 || typeof value.isRobot == "boolean") && (value.isCurrentUser === void 0 || typeof value.isCurrentUser == "boolean") && (value.roles === void 0 || Array.isArray(value.roles) && value.roles.every(isRole));
218
+ return (value.isCurrentUser === void 0 || typeof value.isCurrentUser == "boolean") && (value.roles === void 0 || Array.isArray(value.roles) && value.roles.every(isRole));
222
219
  }
223
220
 
224
221
  async function fetchProjectUsers(client, projectId) {
225
- const project = await client.request({
226
- uri: `/projects/${projectId}`
227
- });
228
- if (!isRecord(project) || !Array.isArray(project.members)) throw new Error("Studio project user response did not contain a members array");
229
- const membershipRows = project.members;
222
+ const membershipRows = await workflowEngine._requestProjectMembers(options => client.request(options), projectId);
230
223
  if (!membershipRows.every(isMembership)) throw new Error("Studio project user response contained an invalid membership row");
231
224
  const memberships = membershipRows.filter(member => !member.isRobot);
232
225
  if (memberships.length === 0) return [];
package/dist/index.d.cts CHANGED
@@ -1,16 +1,16 @@
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";
13
12
  import { ProjectUserProfile } from "@sanity/workflow-sdk/project-users";
13
+ import { ProjectUserProfileClient } from "@sanity/workflow-sdk/project-users";
14
14
  import { ResourceClientResolver } from "@sanity/workflow-engine";
15
15
  import { SanityClient } from "sanity";
16
16
  import { SanityInstance } from "@sanity/sdk";
@@ -94,14 +94,10 @@ export declare function studioResourceClients(
94
94
  client: SanityClient,
95
95
  ): ResourceClientResolver;
96
96
 
97
- declare interface StudioUserClient {
97
+ export declare interface StudioUserClient extends ProjectUserProfileClient {
98
98
  readonly config: () => {
99
99
  readonly projectId?: string;
100
100
  };
101
- readonly request: (options: {
102
- readonly uri: string;
103
- readonly tag?: string;
104
- }) => Promise<unknown>;
105
101
  }
106
102
 
107
103
  export declare interface StudioUserProfile extends ProjectUserProfile {
@@ -144,24 +140,22 @@ export declare function useStudioProjectUsers(): StudioProjectUsersState;
144
140
  * per-resource routing — so subjects and refs across many content datasets
145
141
  * resolve without call sites assembling clients. Pass `resourceClients` to
146
142
  * 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.
143
+ * dataset-GDR routing). `effects` feeds {@link Engine.drainEffects} for engines
144
+ * that drain effects in the Studio.
149
145
  * Memoized on the config's content, so inline `workflowResource` literals are
150
- * fine; custom `resourceClients` and `effectHandlers` values should still be
146
+ * fine; custom `resourceClients` and `effects` values should still be
151
147
  * stable. Must render inside Studio source context.
152
148
  */
153
149
  export declare function useWorkflowEngine({
154
150
  workflowResource,
155
151
  tag,
156
152
  resourceClients,
157
- effectHandlers,
158
- missingHandler,
153
+ effects,
159
154
  }: {
160
155
  workflowResource: WorkflowResource;
161
156
  tag: string;
162
157
  resourceClients?: ResourceClientResolver;
163
- effectHandlers?: Record<string, EffectHandler<SanityClient>>;
164
- missingHandler?: MissingHandlerPolicy;
158
+ effects?: EngineEffectsArgs<SanityClient>;
165
159
  }): Engine;
166
160
 
167
161
  /** A live, progressively-hydrated instance-preview list observed from Sanity
@@ -176,8 +170,10 @@ export declare function useWorkflowInstancePreviews({
176
170
  }: {
177
171
  engine: Engine;
178
172
  filter?: InstancePreviewsFilter;
179
- /** A development throttle between hydration pages; leave unset in production. */
173
+ /** Milliseconds between hydration pages. Defaults to `0`, with no delay.
174
+ * Leave unset in production; use a delay to inspect progressive loading. */
180
175
  interPageDelayMs?: number;
176
+ /** Rows per hydration page. Defaults to `500`. */
181
177
  pageSize?: number;
182
178
  sdk?: SanityInstance;
183
179
  }): InstancePreviewList;
@@ -214,6 +210,10 @@ export declare function useWorkflowSession({
214
210
  }: {
215
211
  engine: Engine;
216
212
  instanceId: string;
213
+ /** URL path where the engine client reads the actor's ACL grants, such as
214
+ * `/projects/PROJECT_ID/datasets/DATASET/acl` or `/canvases/CANVAS_ID/acl`.
215
+ * Supply it for conditions using `$can`; omission leaves `$can` undefined.
216
+ * Grants inform advisory verdicts. Content Lake enforces writes. */
217
217
  grantsFromPath?: string;
218
218
  /** The id-set of every co-mounted session, handed identically to each one
219
219
  * so guard observation consolidates into one shared live query per
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
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";
13
12
  import { ProjectUserProfile } from "@sanity/workflow-sdk/project-users";
13
+ import { ProjectUserProfileClient } from "@sanity/workflow-sdk/project-users";
14
14
  import { ResourceClientResolver } from "@sanity/workflow-engine";
15
15
  import { SanityClient } from "sanity";
16
16
  import { SanityInstance } from "@sanity/sdk";
@@ -94,14 +94,10 @@ export declare function studioResourceClients(
94
94
  client: SanityClient,
95
95
  ): ResourceClientResolver;
96
96
 
97
- declare interface StudioUserClient {
97
+ export declare interface StudioUserClient extends ProjectUserProfileClient {
98
98
  readonly config: () => {
99
99
  readonly projectId?: string;
100
100
  };
101
- readonly request: (options: {
102
- readonly uri: string;
103
- readonly tag?: string;
104
- }) => Promise<unknown>;
105
101
  }
106
102
 
107
103
  export declare interface StudioUserProfile extends ProjectUserProfile {
@@ -144,24 +140,22 @@ export declare function useStudioProjectUsers(): StudioProjectUsersState;
144
140
  * per-resource routing — so subjects and refs across many content datasets
145
141
  * resolve without call sites assembling clients. Pass `resourceClients` to
146
142
  * 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.
143
+ * dataset-GDR routing). `effects` feeds {@link Engine.drainEffects} for engines
144
+ * that drain effects in the Studio.
149
145
  * Memoized on the config's content, so inline `workflowResource` literals are
150
- * fine; custom `resourceClients` and `effectHandlers` values should still be
146
+ * fine; custom `resourceClients` and `effects` values should still be
151
147
  * stable. Must render inside Studio source context.
152
148
  */
153
149
  export declare function useWorkflowEngine({
154
150
  workflowResource,
155
151
  tag,
156
152
  resourceClients,
157
- effectHandlers,
158
- missingHandler,
153
+ effects,
159
154
  }: {
160
155
  workflowResource: WorkflowResource;
161
156
  tag: string;
162
157
  resourceClients?: ResourceClientResolver;
163
- effectHandlers?: Record<string, EffectHandler<SanityClient>>;
164
- missingHandler?: MissingHandlerPolicy;
158
+ effects?: EngineEffectsArgs<SanityClient>;
165
159
  }): Engine;
166
160
 
167
161
  /** A live, progressively-hydrated instance-preview list observed from Sanity
@@ -176,8 +170,10 @@ export declare function useWorkflowInstancePreviews({
176
170
  }: {
177
171
  engine: Engine;
178
172
  filter?: InstancePreviewsFilter;
179
- /** A development throttle between hydration pages; leave unset in production. */
173
+ /** Milliseconds between hydration pages. Defaults to `0`, with no delay.
174
+ * Leave unset in production; use a delay to inspect progressive loading. */
180
175
  interPageDelayMs?: number;
176
+ /** Rows per hydration page. Defaults to `500`. */
181
177
  pageSize?: number;
182
178
  sdk?: SanityInstance;
183
179
  }): InstancePreviewList;
@@ -214,6 +210,10 @@ export declare function useWorkflowSession({
214
210
  }: {
215
211
  engine: Engine;
216
212
  instanceId: string;
213
+ /** URL path where the engine client reads the actor's ACL grants, such as
214
+ * `/projects/PROJECT_ID/datasets/DATASET/acl` or `/canvases/CANVAS_ID/acl`.
215
+ * Supply it for conditions using `$can`; omission leaves `$can` undefined.
216
+ * Grants inform advisory verdicts. Content Lake enforces writes. */
217
217
  grantsFromPath?: string;
218
218
  /** The id-set of every co-mounted session, handed identically to each one
219
219
  * so guard observation consolidates into one shared live query per
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { makeSdkObserver } from "@sanity/workflow-sdk/observer";
4
4
 
5
5
  import { createSanityInstance } from "@sanity/sdk";
6
6
 
7
- import { ENGINE_API_VERSION, createEngine, EXECUTION_KINDS } from "@sanity/workflow-engine";
7
+ import { ENGINE_API_VERSION, createEngine, EXECUTION_KINDS, _requestProjectMembers } from "@sanity/workflow-engine";
8
8
 
9
9
  import { useMemo, useEffect, useSyncExternalStore } from "react";
10
10
 
@@ -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) {
@@ -226,15 +223,11 @@ function isRole(value) {
226
223
  }
227
224
 
228
225
  function isMembership(value) {
229
- return isRecord(value) && typeof value.id == "string" && (value.isRobot === void 0 || typeof value.isRobot == "boolean") && (value.isCurrentUser === void 0 || typeof value.isCurrentUser == "boolean") && (value.roles === void 0 || Array.isArray(value.roles) && value.roles.every(isRole));
226
+ return (value.isCurrentUser === void 0 || typeof value.isCurrentUser == "boolean") && (value.roles === void 0 || Array.isArray(value.roles) && value.roles.every(isRole));
230
227
  }
231
228
 
232
229
  async function fetchProjectUsers(client, projectId) {
233
- const project = await client.request({
234
- uri: `/projects/${projectId}`
235
- });
236
- if (!isRecord(project) || !Array.isArray(project.members)) throw new Error("Studio project user response did not contain a members array");
237
- const membershipRows = project.members;
230
+ const membershipRows = await _requestProjectMembers(options => client.request(options), projectId);
238
231
  if (!membershipRows.every(isMembership)) throw new Error("Studio project user response contained an invalid membership row");
239
232
  const memberships = membershipRows.filter(member => !member.isRobot);
240
233
  if (memberships.length === 0) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-studio",
3
- "version": "0.31.0",
3
+ "version": "0.33.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",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@sanity/pkg-utils": "^10.5.2",
45
- "@sanity/sdk": "^2.12.0",
45
+ "@sanity/sdk": "^3.1.0",
46
46
  "@testing-library/react": "^16.3.2",
47
47
  "@types/react": "^19.2.17",
48
48
  "jsdom": "^29.1.1",
@@ -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.33.0",
54
+ "@sanity/workflow-react": "0.33.0",
55
+ "@sanity/workflow-sdk": "0.33.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@sanity/sdk": "^2.12.0",
58
+ "@sanity/sdk": "^3.1.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.33.0",
62
+ "@sanity/workflow-react": "0.33.0",
63
+ "@sanity/workflow-sdk": "0.33.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"