@sanity/workflow-studio 0.34.0 → 0.35.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,25 @@
1
1
  # @sanity/workflow-studio
2
2
 
3
+ ## 0.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7e24e4a: `useWorkflowEngine` builds its engine through the shared adapter path now used by both the Studio and App SDK integrations, so the two stay in step on how the client is rebound, how telemetry is attached, and how the host is declared.
8
+
9
+ **No upgrade action required.** The hook's signature, the rebind configuration, the `sanity.workflows.studio` request-tag family, the declared `studio` host, and the `studioResourceClients` default routing are all unchanged, and the existing test suite passes against the rewrite without modification.
10
+
11
+ **Docs impact: None.** The supported surface is unchanged, and the shared hook it delegates to is `@internal` and excluded from the API reference.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [7e24e4a]
16
+ - Updated dependencies [7e24e4a]
17
+ - Updated dependencies [7e24e4a]
18
+ - Updated dependencies [ab8754a]
19
+ - @sanity/workflow-react@0.35.0
20
+ - @sanity/workflow-sdk@0.35.0
21
+ - @sanity/workflow-engine@0.35.0
22
+
3
23
  ## 0.34.0
4
24
 
5
25
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -103,31 +103,25 @@ function useSharedDispose(owner, shared) {
103
103
  }, [ owner, shared ]);
104
104
  }
105
105
 
106
+ const STUDIO_TAG_PREFIX = "sanity.workflows.studio", STUDIO_EXECUTION = {
107
+ kind: workflowEngine.EXECUTION_KINDS.studio
108
+ };
109
+
106
110
  function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effects: effects}) {
107
111
  const client = sanity.useClient({
108
112
  apiVersion: workflowEngine.ENGINE_API_VERSION
109
- }), resource = observer.useKeyed([ workflowResource.type, workflowResource.id ], () => workflowResource), telemetry = workflowReact.useWorkflowTelemetry();
110
- return react.useMemo(() => {
111
- const engineDataset = observer.datasetResourceId(resource), engineClient = client.withConfig({
112
- projectId: engineDataset.projectId,
113
- dataset: engineDataset.dataset,
114
- useCdn: !1,
115
- requestTagPrefix: "sanity.workflows.studio"
116
- });
117
- return workflowEngine.createEngine({
118
- client: engineClient,
119
- workflowResource: resource,
120
- tag: tag,
121
- resourceClients: resourceClients ?? studioResourceClients(client),
122
- executionContext: {
123
- kind: workflowEngine.EXECUTION_KINDS.studio
124
- },
125
- ...effects !== void 0 ? {
126
- effects: effects
127
- } : {},
128
- telemetry: telemetry
129
- });
130
- }, [ client, resource, tag, resourceClients, effects, telemetry ]);
113
+ }), defaultRouting = react.useMemo(() => studioResourceClients(client), [ client ]);
114
+ return workflowReact._useAdapterEngine({
115
+ client: client,
116
+ workflowResource: workflowResource,
117
+ tag: tag,
118
+ requestTagPrefix: STUDIO_TAG_PREFIX,
119
+ executionContext: STUDIO_EXECUTION,
120
+ resourceClients: resourceClients ?? defaultRouting,
121
+ ...effects !== void 0 ? {
122
+ effects: effects
123
+ } : {}
124
+ });
131
125
  }
132
126
 
133
127
  function studioResourceClients(client) {
@@ -135,7 +129,7 @@ function studioResourceClients(client) {
135
129
  projectId: parsed.projectId,
136
130
  dataset: parsed.dataset,
137
131
  useCdn: !1,
138
- requestTagPrefix: "sanity.workflows.studio"
132
+ requestTagPrefix: STUDIO_TAG_PREFIX
139
133
  }) : void 0;
140
134
  }
141
135
 
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { ensureDocumentExists, datasetResourceId, useKeyed } from "@sanity/workflow-react/observer";
1
+ import { ensureDocumentExists, datasetResourceId } from "@sanity/workflow-react/observer";
2
2
 
3
3
  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, _requestProjectMembers } from "@sanity/workflow-engine";
7
+ import { ENGINE_API_VERSION, EXECUTION_KINDS, _requestProjectMembers } from "@sanity/workflow-engine";
8
8
 
9
9
  import { useMemo, useEffect, useSyncExternalStore } from "react";
10
10
 
11
11
  import { useSource, useClient } from "sanity";
12
12
 
13
- import { useWorkflowTelemetry, useWorkflowSession as useWorkflowSession$1, useDocumentWorkflows as useDocumentWorkflows$1, useInstancePreviews, useWorkflowInstances as useWorkflowInstances$1 } from "@sanity/workflow-react";
13
+ import { _useAdapterEngine, useWorkflowSession as useWorkflowSession$1, useDocumentWorkflows as useDocumentWorkflows$1, useInstancePreviews, useWorkflowInstances as useWorkflowInstances$1 } from "@sanity/workflow-react";
14
14
 
15
15
  import { loadProjectRolesOrNone, loadProjectUserProfiles } from "@sanity/workflow-sdk/project-users";
16
16
 
@@ -111,31 +111,25 @@ function useSharedDispose(owner, shared) {
111
111
  }, [ owner, shared ]);
112
112
  }
113
113
 
114
+ const STUDIO_TAG_PREFIX = "sanity.workflows.studio", STUDIO_EXECUTION = {
115
+ kind: EXECUTION_KINDS.studio
116
+ };
117
+
114
118
  function useWorkflowEngine({workflowResource: workflowResource, tag: tag, resourceClients: resourceClients, effects: effects}) {
115
119
  const client = useClient({
116
120
  apiVersion: ENGINE_API_VERSION
117
- }), resource = useKeyed([ workflowResource.type, workflowResource.id ], () => workflowResource), telemetry = useWorkflowTelemetry();
118
- return useMemo(() => {
119
- const engineDataset = datasetResourceId(resource), engineClient = client.withConfig({
120
- projectId: engineDataset.projectId,
121
- dataset: engineDataset.dataset,
122
- useCdn: !1,
123
- requestTagPrefix: "sanity.workflows.studio"
124
- });
125
- return createEngine({
126
- client: engineClient,
127
- workflowResource: resource,
128
- tag: tag,
129
- resourceClients: resourceClients ?? studioResourceClients(client),
130
- executionContext: {
131
- kind: EXECUTION_KINDS.studio
132
- },
133
- ...effects !== void 0 ? {
134
- effects: effects
135
- } : {},
136
- telemetry: telemetry
137
- });
138
- }, [ client, resource, tag, resourceClients, effects, telemetry ]);
121
+ }), defaultRouting = useMemo(() => studioResourceClients(client), [ client ]);
122
+ return _useAdapterEngine({
123
+ client: client,
124
+ workflowResource: workflowResource,
125
+ tag: tag,
126
+ requestTagPrefix: STUDIO_TAG_PREFIX,
127
+ executionContext: STUDIO_EXECUTION,
128
+ resourceClients: resourceClients ?? defaultRouting,
129
+ ...effects !== void 0 ? {
130
+ effects: effects
131
+ } : {}
132
+ });
139
133
  }
140
134
 
141
135
  function studioResourceClients(client) {
@@ -143,7 +137,7 @@ function studioResourceClients(client) {
143
137
  projectId: parsed.projectId,
144
138
  dataset: parsed.dataset,
145
139
  useCdn: !1,
146
- requestTagPrefix: "sanity.workflows.studio"
140
+ requestTagPrefix: STUDIO_TAG_PREFIX
147
141
  }) : void 0;
148
142
  }
149
143
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-studio",
3
- "version": "0.34.0",
3
+ "version": "0.35.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,17 +50,17 @@
50
50
  "react-dom": "^19.3.0",
51
51
  "sanity": "^6.15.0",
52
52
  "vitest": "^4.1.8",
53
- "@sanity/workflow-engine": "0.34.0",
54
- "@sanity/workflow-react": "0.34.0",
55
- "@sanity/workflow-sdk": "0.34.0"
53
+ "@sanity/workflow-react": "0.35.0",
54
+ "@sanity/workflow-sdk": "0.35.0",
55
+ "@sanity/workflow-engine": "0.35.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@sanity/sdk": "^3.1.0",
59
59
  "react": "^19.2.7",
60
60
  "sanity": "^6",
61
- "@sanity/workflow-react": "0.34.0",
62
- "@sanity/workflow-engine": "0.34.0",
63
- "@sanity/workflow-sdk": "0.34.0"
61
+ "@sanity/workflow-react": "0.35.0",
62
+ "@sanity/workflow-engine": "0.35.0",
63
+ "@sanity/workflow-sdk": "0.35.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=20"