@sanity/workflow-studio 0.32.0 → 0.34.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,57 @@
1
1
  # @sanity/workflow-studio
2
2
 
3
+ ## 0.34.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @sanity/workflow-sdk@0.34.0
8
+ - @sanity/workflow-engine@0.34.0
9
+ - @sanity/workflow-react@0.34.0
10
+
11
+ ## 0.33.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 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.
16
+
17
+ 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.
18
+
19
+ 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.
20
+
21
+ 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.
22
+
23
+ **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.
24
+
25
+ ### Patch Changes
26
+
27
+ - 7eb9eca: Correct the API references for field initialization and edits, start requirements,
28
+ transitions, reference IDs, effect handling, reactive state, member controls,
29
+ Studio mappings, test helpers, and GROQ condition outcomes. The references state
30
+ caller constraints and defaults that were missing or incorrect. Package setup
31
+ guidance identifies the public npm packages and supported deployment command;
32
+ the MCP validation description distinguishes validation from deployment checks.
33
+ Runtime behavior and API signatures are unchanged.
34
+
35
+ **No upgrade action required.**
36
+
37
+ **Docs impact:** After release and reference sync, reconcile the modeling,
38
+ runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
39
+ guides and references with the corrected contracts. Fix affected examples and
40
+ replace redundant API inventories with verified symbol links while preserving
41
+ useful teaching and the CLI/MCP reference material not exposed by TypeDoc.
42
+
43
+ - Updated dependencies [393ac71]
44
+ - Updated dependencies [8874c50]
45
+ - Updated dependencies [0555271]
46
+ - Updated dependencies [b3b2797]
47
+ - Updated dependencies [225e0fb]
48
+ - Updated dependencies [7eb9eca]
49
+ - Updated dependencies [2cef086]
50
+ - Updated dependencies [232f811]
51
+ - @sanity/workflow-engine@0.33.0
52
+ - @sanity/workflow-sdk@0.33.0
53
+ - @sanity/workflow-react@0.33.0
54
+
3
55
  ## 0.32.0
4
56
 
5
57
  ### Minor 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
@@ -215,15 +215,11 @@ function isRole(value) {
215
215
  }
216
216
 
217
217
  function isMembership(value) {
218
- 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));
219
219
  }
220
220
 
221
221
  async function fetchProjectUsers(client, projectId) {
222
- const project = await client.request({
223
- uri: `/projects/${projectId}`
224
- });
225
- if (!isRecord(project) || !Array.isArray(project.members)) throw new Error("Studio project user response did not contain a members array");
226
- const membershipRows = project.members;
222
+ const membershipRows = await workflowEngine._requestProjectMembers(options => client.request(options), projectId);
227
223
  if (!membershipRows.every(isMembership)) throw new Error("Studio project user response contained an invalid membership row");
228
224
  const memberships = membershipRows.filter(member => !member.isRobot);
229
225
  if (memberships.length === 0) return [];
package/dist/index.d.cts CHANGED
@@ -10,6 +10,7 @@ import { MutationGuardDoc } from "@sanity/workflow-react";
10
10
  import { ProjectRole } from "@sanity/workflow-sdk/project-users";
11
11
  import { ProjectUserDirectory } from "@sanity/workflow-engine";
12
12
  import { ProjectUserProfile } from "@sanity/workflow-sdk/project-users";
13
+ import { ProjectUserProfileClient } from "@sanity/workflow-sdk/project-users";
13
14
  import { ResourceClientResolver } from "@sanity/workflow-engine";
14
15
  import { SanityClient } from "sanity";
15
16
  import { SanityInstance } from "@sanity/sdk";
@@ -93,14 +94,10 @@ export declare function studioResourceClients(
93
94
  client: SanityClient,
94
95
  ): ResourceClientResolver;
95
96
 
96
- export declare interface StudioUserClient {
97
+ export declare interface StudioUserClient extends ProjectUserProfileClient {
97
98
  readonly config: () => {
98
99
  readonly projectId?: string;
99
100
  };
100
- readonly request: (options: {
101
- readonly uri: string;
102
- readonly tag?: string;
103
- }) => Promise<unknown>;
104
101
  }
105
102
 
106
103
  export declare interface StudioUserProfile extends ProjectUserProfile {
@@ -173,8 +170,10 @@ export declare function useWorkflowInstancePreviews({
173
170
  }: {
174
171
  engine: Engine;
175
172
  filter?: InstancePreviewsFilter;
176
- /** 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. */
177
175
  interPageDelayMs?: number;
176
+ /** Rows per hydration page. Defaults to `500`. */
178
177
  pageSize?: number;
179
178
  sdk?: SanityInstance;
180
179
  }): InstancePreviewList;
@@ -211,6 +210,10 @@ export declare function useWorkflowSession({
211
210
  }: {
212
211
  engine: Engine;
213
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. */
214
217
  grantsFromPath?: string;
215
218
  /** The id-set of every co-mounted session, handed identically to each one
216
219
  * so guard observation consolidates into one shared live query per
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { MutationGuardDoc } from "@sanity/workflow-react";
10
10
  import { ProjectRole } from "@sanity/workflow-sdk/project-users";
11
11
  import { ProjectUserDirectory } from "@sanity/workflow-engine";
12
12
  import { ProjectUserProfile } from "@sanity/workflow-sdk/project-users";
13
+ import { ProjectUserProfileClient } from "@sanity/workflow-sdk/project-users";
13
14
  import { ResourceClientResolver } from "@sanity/workflow-engine";
14
15
  import { SanityClient } from "sanity";
15
16
  import { SanityInstance } from "@sanity/sdk";
@@ -93,14 +94,10 @@ export declare function studioResourceClients(
93
94
  client: SanityClient,
94
95
  ): ResourceClientResolver;
95
96
 
96
- export declare interface StudioUserClient {
97
+ export declare interface StudioUserClient extends ProjectUserProfileClient {
97
98
  readonly config: () => {
98
99
  readonly projectId?: string;
99
100
  };
100
- readonly request: (options: {
101
- readonly uri: string;
102
- readonly tag?: string;
103
- }) => Promise<unknown>;
104
101
  }
105
102
 
106
103
  export declare interface StudioUserProfile extends ProjectUserProfile {
@@ -173,8 +170,10 @@ export declare function useWorkflowInstancePreviews({
173
170
  }: {
174
171
  engine: Engine;
175
172
  filter?: InstancePreviewsFilter;
176
- /** 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. */
177
175
  interPageDelayMs?: number;
176
+ /** Rows per hydration page. Defaults to `500`. */
178
177
  pageSize?: number;
179
178
  sdk?: SanityInstance;
180
179
  }): InstancePreviewList;
@@ -211,6 +210,10 @@ export declare function useWorkflowSession({
211
210
  }: {
212
211
  engine: Engine;
213
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. */
214
217
  grantsFromPath?: string;
215
218
  /** The id-set of every co-mounted session, handed identically to each one
216
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
 
@@ -223,15 +223,11 @@ function isRole(value) {
223
223
  }
224
224
 
225
225
  function isMembership(value) {
226
- 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));
227
227
  }
228
228
 
229
229
  async function fetchProjectUsers(client, projectId) {
230
- const project = await client.request({
231
- uri: `/projects/${projectId}`
232
- });
233
- if (!isRecord(project) || !Array.isArray(project.members)) throw new Error("Studio project user response did not contain a members array");
234
- const membershipRows = project.members;
230
+ const membershipRows = await _requestProjectMembers(options => client.request(options), projectId);
235
231
  if (!membershipRows.every(isMembership)) throw new Error("Studio project user response contained an invalid membership row");
236
232
  const memberships = membershipRows.filter(member => !member.isRobot);
237
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.32.0",
3
+ "version": "0.34.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,25 +42,25 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@sanity/pkg-utils": "^10.5.2",
45
- "@sanity/sdk": "^2.12.0",
45
+ "@sanity/sdk": "^3.3.0",
46
46
  "@testing-library/react": "^16.3.2",
47
47
  "@types/react": "^19.2.17",
48
48
  "jsdom": "^29.1.1",
49
- "react": "^19.2.7",
50
- "react-dom": "^19.2.7",
51
- "sanity": "^6",
49
+ "react": "^19.3.0",
50
+ "react-dom": "^19.3.0",
51
+ "sanity": "^6.15.0",
52
52
  "vitest": "^4.1.8",
53
- "@sanity/workflow-engine": "0.32.0",
54
- "@sanity/workflow-react": "0.32.0",
55
- "@sanity/workflow-sdk": "0.32.0"
53
+ "@sanity/workflow-engine": "0.34.0",
54
+ "@sanity/workflow-react": "0.34.0",
55
+ "@sanity/workflow-sdk": "0.34.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.32.0",
62
- "@sanity/workflow-react": "0.32.0",
63
- "@sanity/workflow-sdk": "0.32.0"
61
+ "@sanity/workflow-react": "0.34.0",
62
+ "@sanity/workflow-engine": "0.34.0",
63
+ "@sanity/workflow-sdk": "0.34.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=20"