@sanity/workflows-cli 0.0.0 → 0.39.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 +407 -0
- package/README.md +95 -44
- package/dist/commands/workflows/codemod/packages.js +2 -2
- package/dist/commands/workflows/definitions/delete.js +2 -2
- package/dist/commands/workflows/definitions/list.d.ts +1 -0
- package/dist/commands/workflows/definitions/show.d.ts +1 -0
- package/dist/commands/workflows/definitions/validate.js +3 -3
- package/dist/commands/workflows/deploy.d.ts +2 -2
- package/dist/commands/workflows/deploy.js +4 -4
- package/dist/commands/workflows/diagnose.d.ts +1 -0
- package/dist/commands/workflows/diagnose.js +2 -2
- package/dist/commands/workflows/fire-action.js +3 -3
- package/dist/commands/workflows/list.d.ts +1 -0
- package/dist/commands/workflows/list.js +2 -1
- package/dist/commands/workflows/nuke.js +2 -3
- package/dist/commands/workflows/show.d.ts +1 -0
- package/dist/commands/workflows/start.js +6 -6
- package/dist/commands/workflows/tail.d.ts +1 -0
- package/dist/commands/workflows/tail.js +3 -3
- package/dist/commands/workflows/whoami.d.ts +1 -0
- package/dist/commands/workflows/whoami.js +11 -11
- package/dist/hooks/finally/telemetry.js +2 -1
- package/dist/hooks/prerun/telemetry.d.ts +5 -0
- package/dist/hooks/prerun/telemetry.js +19 -4
- package/dist/lib/base-command.d.ts +3 -3
- package/dist/lib/base-command.js +12 -5
- package/dist/lib/blueprint-needs.d.ts +1 -1
- package/dist/lib/blueprint-needs.js +98 -19
- package/dist/lib/blueprint-stacks.js +38 -8
- package/dist/lib/client.d.ts +4 -1
- package/dist/lib/client.js +9 -4
- package/dist/lib/codemod/ast.d.ts +17 -0
- package/dist/lib/codemod/ast.js +14 -0
- package/dist/lib/codemod/export-rename.d.ts +19 -0
- package/dist/lib/codemod/export-rename.js +337 -0
- package/dist/lib/codemod/manifest-rewrite.d.ts +5 -2
- package/dist/lib/codemod/manifest-rewrite.js +57 -21
- package/dist/lib/codemod/package-map.d.ts +5 -0
- package/dist/lib/codemod/package-map.js +27 -0
- package/dist/lib/codemod/report.d.ts +0 -1
- package/dist/lib/codemod/report.js +9 -1
- package/dist/lib/codemod/run.d.ts +5 -3
- package/dist/lib/codemod/run.js +6 -1
- package/dist/lib/codemod/source-rewrite.d.ts +6 -4
- package/dist/lib/codemod/source-rewrite.js +12 -17
- package/dist/lib/context.d.ts +6 -10
- package/dist/lib/context.js +18 -23
- package/dist/lib/default-partition.js +2 -3
- package/dist/lib/definition-files.d.ts +3 -0
- package/dist/lib/definition-files.js +5 -3
- package/dist/lib/fail.d.ts +8 -1
- package/dist/lib/fail.js +16 -7
- package/dist/lib/failure-kind.d.ts +7 -0
- package/dist/lib/failure-kind.js +66 -0
- package/dist/lib/flags.d.ts +7 -3
- package/dist/lib/flags.js +16 -6
- package/dist/lib/load-config.d.ts +5 -0
- package/dist/lib/load-config.js +4 -6
- package/dist/lib/nuke.d.ts +4 -4
- package/dist/lib/nuke.js +3 -3
- package/dist/lib/operation-args.d.ts +4 -4
- package/dist/lib/operation-args.js +1 -1
- package/dist/lib/ops-report.d.ts +1 -3
- package/dist/lib/ops-report.js +2 -2
- package/dist/lib/pick-resource.d.ts +13 -0
- package/dist/lib/pick-resource.js +82 -0
- package/dist/lib/read-fanout.d.ts +4 -4
- package/dist/lib/read-fanout.js +5 -4
- package/dist/lib/resource-target.d.ts +10 -0
- package/dist/lib/resource-target.js +12 -0
- package/dist/lib/telemetry-setup.d.ts +20 -24
- package/dist/lib/telemetry-setup.js +36 -30
- package/dist/lib/telemetry.d.ts +3 -0
- package/dist/lib/telemetry.js +2 -2
- package/dist/lib/ui.d.ts +1 -4
- package/dist/lib/ui.js +2 -4
- package/oclif.manifest.json +189 -26
- package/package.json +5 -5
- package/dist/lib/pick-dataset.d.ts +0 -10
- package/dist/lib/pick-dataset.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,412 @@
|
|
|
1
1
|
# @sanity/workflow-cli
|
|
2
2
|
|
|
3
|
+
## 0.39.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 60502c8: `sanity-workflows codemod packages` now also renames imports of the UI exports renamed to "Workflows" in the same release, and every reference to them in the file: `workflowStudioPlugin`, `workflowDefaultDocumentNode`, `WorkflowPluginConfig`, `LegacyTagWorkflowPluginConfig`, `WorkflowTelemetryProvider`, and `useWorkflowTelemetry`. An aliased import keeps its local name, a named re-export or local export keeps the name it exports, and members read through a namespace import and names after an `import()` type are renamed too. When a file declares the old or the new name again, the codemod imports the new export under the old local name instead, so references keep their meaning, and lists the line. When a file declares a namespace name again, members read through that namespace are left unchanged and listed; rename one by hand if it reads the import.
|
|
8
|
+
|
|
9
|
+
No upgrade action required: run `npx @sanity/workflows-cli codemod packages` as the package upgrade already describes. A name read through `export *`, `require()`, `import x = require()`, a dynamic `import()`, a mocked module factory, a computed member, or destructuring from a namespace keeps its old name. In TypeScript files typecheck points to most of these; check `require()` calls, plain JavaScript files, and test mocks by hand.
|
|
10
|
+
|
|
11
|
+
**Docs impact:** In the upgrade guide, say that `codemod packages` also renames the renamed UI exports and list the forms it does not rename, and add that behaviour to the `codemod packages` entry in the CLI command reference.
|
|
12
|
+
|
|
13
|
+
- 532e3e3: The generated heartbeat now starts an autonomous workflow hosted as `'function'` whose `start.filter` reads `$now`, such as `embargoAt <= $now` or `expiresAt <= $now`, on a document that becomes eligible by time alone, when the filter reads no other document, is recognized as a boolean expression, the subject is taken from the started document, and the workflow's `start.roles`, if any, admit the project `editor` role the heartbeat robot holds (with a Media Library workflow resource, a workflow declaring `start.roles` is not started on the clock). A document created before its embargo, and never written again, starts on the first heartbeat run past the moment, attributed to the heartbeat; in a resource other than the workflow resource, each run checks a window of 500 matching documents, held ones included, and with `n` matching documents, a heartbeat that runs every minute checks every window within `2 * ceil(n / 500) - 1` runs; on an hourly or daily cadence the windows still rotate, with no fixed bound. Each run starts at most its share, so when more documents are eligible at once, starting them spreads over later runs. A start the engine refuses, such as one an unmet start requirement refuses, is logged as one info line per run and skipped, and later runs move on to other documents. A document that already holds an instance of the workflow, finished or not, is not started again. This covers dataset documents and Media Library assets alike: for such a workflow, `blueprints generate` no longer refuses an asset `start.filter` that reads `$now`, and emits no library watcher for it, because the heartbeat alone starts it.
|
|
14
|
+
|
|
15
|
+
Each run costs up to two queries per such workflow in the workflow resource, and up to three in each other resource its subjects can live in plus one in the workflow resource; `blueprints generate` reports the total. When there is such a workflow, a run works on at most 20 instances for each of re-queueing, ticking and starting, instead of 30 each for re-queueing and ticking, and a deployment whose only need is such a workflow now gets a heartbeat. Any other `$now` start filter still starts only on a write: `blueprints generate` warns about it on a dataset and still fails for it on a Media Library. The report also names the window bound and the first-run catch-up. The generated heartbeat blueprint now lists each clock-started workflow's subject types and start filter, so editing them marks the heartbeat stack for redeploy.
|
|
16
|
+
|
|
17
|
+
Run `npx @sanity/workflows-cli blueprints generate`, then redeploy both stacks, the heartbeat stack with an organization deploy token, so the heartbeat starts clock-eligible documents. Until then, such a document starts only on its next write, as before. After the redeploy, the heartbeat starts every existing document the filter already admits that holds no instance of the workflow, including documents that became eligible before the deploy and were never written since, at most 20 per run across its runs: check which documents that is before you redeploy.
|
|
18
|
+
|
|
19
|
+
**Docs impact:** Update the generated runtime guide where it describes the heartbeat's duties, its per-run limits, start filters that read `$now`, and Media Library asset start filters, and the CLI's `blueprints generate` reference for the start queries the runtime needs report lists.
|
|
20
|
+
|
|
21
|
+
- af2e8b8: Refs into any resource (another dataset, a Media Library, a Canvas or a dashboard) now work by default. An engine created without `resourceClients` reads and writes them through its own client, so Studio and App SDK hosts need no options and no change.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const engine = useWorkflowEngine({workflowResource, partition})
|
|
25
|
+
await engine.fireAction({
|
|
26
|
+
// ...
|
|
27
|
+
params: {asset: {id: 'media-library:ml1:asset-1', type: 'sanity.imageAsset'}},
|
|
28
|
+
})
|
|
29
|
+
// Before: throws RefResourceUndeclaredError.
|
|
30
|
+
// Now: the ref is stored and read through the Media Library.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To keep refs inside the workflow resource, pass `resourceClients`: `deploymentResourceClients({client, deployment})` serves only the resources the deployment binds, and `() => undefined` serves none. `deploymentResourceClients` now always returns a resolver.
|
|
34
|
+
|
|
35
|
+
- Studio's default `studioResourceClients` returns a client for every resource. A custom resolver that calls it should try its own routes first: `(parsed) => ownRoute(parsed) ?? studioResourceClients(client)(parsed)`.
|
|
36
|
+
- The CLI and the generated Blueprint runtime keep their deployment-bound refs.
|
|
37
|
+
- The Workflows service reads subjects in every resource type with the caller's token.
|
|
38
|
+
- New `ResourceCapabilityError` (`kind: 'resource-capability-unavailable'`, `resourceType`, `capability`) names a capability a resource type doesn't have. It is exported and crosses the service protocol; the access changes in this release throw it at deploy for a capability the workflow resource's type lacks.
|
|
39
|
+
|
|
40
|
+
**Docs impact:** Update the declared resource surface and `createEngine` `resourceClients` entries in the engine reference, the Studio `useWorkflowEngine` reference and the `@sanity/workflow-studio` README, the App SDK `useWorkflowEngine` reference, the concepts section on GDRs and the declared surface, and add `ResourceCapabilityError` to the error reference.
|
|
41
|
+
|
|
42
|
+
- 002c35e: **BREAKING:** `RuntimeClientConfig`, the argument a custom `clientFactory` passed to `createRuntime` receives, is now `{resource, token?, apiHost?}` instead of `{projectId, dataset, token?, apiHost?}`, and the factory is called once for the workflow resource and once for each other resource a deployment alias binds. Before, a non-dataset alias was served by `withConfig` on the workflow client. A custom factory that reads `projectId` and `dataset` builds a client for the wrong resource until it reads `resource` (spread `clientConfigFromResource(config.resource)` from `@sanity/workflow-engine` into your `createClient` call). Generated functions use the default factory and need no change.
|
|
43
|
+
|
|
44
|
+
The generated runtime now serves a workflow stored in a Media Library. `sanity-workflows blueprints generate` emits its start watchers on the library and on each alias, a scheduled drain per drain in the heartbeat stack (a Media Library asset function fires only on `sanity.asset` writes, never on an instance write), and the heartbeat. A Media Library watcher uses the same start filter as a dataset watcher, so an asset definition whose `start.filter` reads asset fields starts on the write that makes it true. A library `start.filter` that reads `$now` or another document, reads `$tag` or `$definition` together with an asset field other than `_type`, or is not a recognized boolean expression still fails generate with `ContractViolationError`, unchanged from earlier releases (one upload reaches a library watcher as more than one write, so a watcher that fires on every write would start the asset more than once). The heartbeat robot of such a deployment holds the organization role `media-library-editor-robot`. It holds no project role, so `blueprints generate` warns when such a deployment binds a dataset alias: a scheduled drain or tick that reads that alias fails. `createRuntime` accepts a Media Library workflow resource and gains `runtime.drainQueued()`, which the scheduled drains call.
|
|
45
|
+
|
|
46
|
+
`blueprints generate` now fails instead of silently dropping a start it cannot serve: with `ResourceCapabilityError` (capability `functionEvents`) when a deployment needs a function triggered on a Canvas or a dashboard, whether that is the workflow resource or an alias watched for autonomous starts; and with `ContractViolationError` when an autonomous definition's subject types fire no watched resource's trigger. `@sanity/workflow-engine/generate` exports the capability table's Functions trigger rows (`functionTriggerOf`), and `@sanity/workflow-engine` exports `foreignAliasResources`, the resources a deployment's aliases bind besides its workflow resource, and `deploymentAliasResolver`, which builds the alias resolver `deploymentResourceClients` uses from clients you construct. Deployments that bind only datasets generate the same files as before; a dataset deployment that binds a Media Library, Canvas or dashboard alias gets one more alias line in its heartbeat blueprint header, so redeploy the heartbeat stack when the command reports it changed.
|
|
47
|
+
|
|
48
|
+
Upgrade: regenerate with `sanity-workflows blueprints generate`, then redeploy the project stack and, when the command reports it changed, the heartbeat stack. A deployment that binds a Canvas or dashboard alias and starts definitions autonomously now fails generate: remove the binding from that deployment or drop the autonomous start. Update a custom `clientFactory` as described above.
|
|
49
|
+
|
|
50
|
+
<!-- replay: does not change persisted instance behaviour: start ids for dataset events keep their key, and no stored field changes -->
|
|
51
|
+
|
|
52
|
+
**Docs impact:** Update the generate-functions guide's start-watcher and stack sections for Media Library stores, scheduled drains and the Canvas and dashboard refusals, the `createRuntime` reference for `drainQueued` and the `clientFactory` argument, the `ResourceCapabilityError` reference entry, the `@sanity/workflow-engine/generate` reference for `functionTriggerOf`, and the `@sanity/workflow-engine` reference for `foreignAliasResources` and `deploymentAliasResolver` beside `deploymentResourceClients`.
|
|
53
|
+
|
|
54
|
+
- 65fc915: **BREAKING:** `sanity-workflows whoami --json` reports `resource` as `<type>:<id>` (`dataset:acme.production`, `media-library:mlAbc123`) instead of a bare `acme.production`, and `nuke` asks you to type each target back in the same `<type>:<id>` form. Scripts that parse `whoami --json` or pipe the `nuke` confirmation must read and write the new form; until they do, they see a resource string they do not recognize and a `nuke` confirmation that does not match.
|
|
55
|
+
|
|
56
|
+
The Studio plugin can keep workflow state in any resource Studio can observe, and shows refs to documents in other resources with their title instead of a bare id.
|
|
57
|
+
|
|
58
|
+
- New plugin option `workflowResource`, named as `createEngine` names it: `{type: 'dataset', id: '<projectId>.<dataset>'}`, `{type: 'media-library', id}` or `{type: 'canvas', id}`. A dashboard resource, or setting both `workflowResource` and `workflowDataset`, fails at startup.
|
|
59
|
+
- `workflowDataset` is deprecated and will be removed in a later release. Replace `workflowDataset: 'workflows'` with `workflowResource: {type: 'dataset', id: '<projectId>.workflows'}`.
|
|
60
|
+
- A ref to a Media Library, Canvas or dashboard document, or to a document in another dataset, shows the document's title in every surface. Preview cards, runs-table rows, board cards and inline chips also name the resource (`Media Library`, `Canvas`, `Dashboard`, `Dataset · staging`) and show `Document unavailable` for a document that cannot be read; pills and history lines show the title alone, or `Untitled`. Media Library and Canvas refs open the document in the Sanity Dashboard in a new tab.
|
|
61
|
+
- Assignee pickers, role names, actor names, and the assigned-to-me filter read the people and roles of the workflow resource: the project of a `workflowResource` dataset (which can be another project than the Studio's), or the members of a Media Library. A Canvas has no members or roles, so Studio hides its person and role pickers, shows stored assignees read-only, and says a workflow or action with a required person input cannot start or fire from Studio. The signed-in user needs permission to read those members. When the workflow resource is a Media Library or a dataset in another project and that read fails, the assigned-to-me filter is unavailable to that user and notes they write are stamped without roles.
|
|
62
|
+
- Media Library and Canvas links open under the organization that owns the linked resource, so a resource in another organization opens there instead of on an error page.
|
|
63
|
+
- A picked document ref from another resource no longer shows a local document's title when the two documents share an id.
|
|
64
|
+
- Clicking a link to a document in another resource logs the new `Workflows Studio Plugin External Document Link Clicked` telemetry event with the surface and resource type.
|
|
65
|
+
|
|
66
|
+
The Workflows CLI read commands (`list`, `show`, `tail`, `diagnose`, `whoami`, `definitions list` and `definitions show`) take `--workflow-resource <type>:<id>` for any resource type, for example `--workflow-resource canvas:cvXyz` or `--workflow-resource dashboard:dbQ1`. Without a config, the interactive picker asks for a resource type first and prints the `--workflow-resource` flag that reads the same resource. Messages name the resource type with its id (`dataset acme.production`, `Media Library mlAbc123`), and so does a failed `list` or `definitions list` of one resource without `--json` (`Could not read Canvas cvNope:`). CLI telemetry records the resource type and id. `--media-library-id` is deprecated.
|
|
67
|
+
|
|
68
|
+
The engine exports the capability-table helpers integrations use for this: `resourceLabel`, `isResourceType`, `RESOURCE_TYPES`, `describeResource`, `resourceName`, `documentUrl`, `resourceListPath`, `hasCapability` and `directoryOf`. `@sanity/workflows-ui/studio` adds `useStudioResourceMembers` for the people of a Media Library or another Access API resource, and `useStudioProjectUsers` takes an optional project id.
|
|
69
|
+
|
|
70
|
+
**Upgrade action:** replace `workflowDataset` with `workflowResource` in the plugin configuration, and `--media-library-id <id>` with `--workflow-resource media-library:<id>` in scripts. Both old forms continue to work in this release. Update scripts that parse `whoami --json` or answer the `nuke` confirmation to the `<type>:<id>` form.
|
|
71
|
+
|
|
72
|
+
<!-- replay: does not change persisted instance behaviour: it changes CLI output and Studio rendering, not the engine's stored documents -->
|
|
73
|
+
|
|
74
|
+
**Docs impact:** Update the Studio plugin configuration reference (new `workflowResource`, deprecated `workflowDataset`), the Studio guide section that shows document references, the CLI reference for `--workflow-resource`, the picker, `whoami --json`, the `nuke` confirmation and the deprecated `--media-library-id`, the CLI telemetry disclosure, the Studio guide's note on who assignee pickers list for each resource type, and the engine and Studio adapter API references for the new exports.
|
|
75
|
+
|
|
76
|
+
- 60502c8: **BREAKING:** The 12 Workflows packages are replaced by four, split by where the code runs. `@sanity/workflows` holds the engine, the Blueprints generator and Functions runtime, condition descriptions, and the code agent tools call; it is what a Function installs. `@sanity/workflows-ui` holds the Studio plugin, React hooks, the Studio and App SDK adapters, components, and the diagram. `@sanity/workflows-cli` holds the `sanity-workflows` command. `@sanity/workflows-test` holds the test bench. Every user of a `@sanity/workflow-*` package or `@sanity/groq-condition-describe` is affected: the old packages no longer publish, so a project that keeps them stays on the last old release and gets no further fixes.
|
|
77
|
+
|
|
78
|
+
Each old entry point is now a subpath of a new package with the same behaviour and the same exported names, except six UI exports now named for "Workflows": `workflowStudioPlugin` → `workflowsStudioPlugin`, `workflowDefaultDocumentNode` → `workflowsDefaultDocumentNode`, `WorkflowPluginConfig` → `WorkflowsPluginConfig`, `LegacyTagWorkflowPluginConfig` → `LegacyTagWorkflowsPluginConfig`, `WorkflowTelemetryProvider` → `WorkflowsTelemetryProvider`, and `useWorkflowTelemetry` → `useWorkflowsTelemetry`. Stored data, the CLI command, and its flags do not change.
|
|
79
|
+
|
|
80
|
+
| Old | New |
|
|
81
|
+
| ------------------------------------- | ----------------------------------------------------------------- |
|
|
82
|
+
| `@sanity/workflow-engine` | `@sanity/workflows` |
|
|
83
|
+
| `@sanity/workflow-engine/define` | `@sanity/workflows/define` |
|
|
84
|
+
| `@sanity/workflow-engine/generate` | `@sanity/workflows/generate` |
|
|
85
|
+
| `@sanity/workflow-blueprint` | `@sanity/workflows/blueprints` |
|
|
86
|
+
| `@sanity/workflow-blueprint/generate` | `@sanity/workflows/blueprints/generate` |
|
|
87
|
+
| `@sanity/workflow-blueprint/runtime` | `@sanity/workflows/blueprints/runtime` |
|
|
88
|
+
| `@sanity/groq-condition-describe` | `@sanity/workflows/describe` |
|
|
89
|
+
| `@sanity/workflow-mcp` | `@sanity/workflows/agents` |
|
|
90
|
+
| `@sanity/workflow-studio-plugin` | `@sanity/workflows-ui/studio-plugin` |
|
|
91
|
+
| `@sanity/workflow-studio` | `@sanity/workflows-ui/studio` |
|
|
92
|
+
| `@sanity/workflow-react` | `@sanity/workflows-ui/react` |
|
|
93
|
+
| `@sanity/workflow-react/observer` | `@sanity/workflows-ui/react/observer` |
|
|
94
|
+
| `@sanity/workflow-sdk` | `@sanity/workflows-ui/sdk` |
|
|
95
|
+
| `@sanity/workflow-sdk/observer` | `@sanity/workflows-ui/sdk/observer` |
|
|
96
|
+
| `@sanity/workflow-sdk/project-users` | `@sanity/workflows-ui/sdk/project-users` |
|
|
97
|
+
| `@sanity/workflow-components` | `@sanity/workflows-ui/components` |
|
|
98
|
+
| `@sanity/workflow-diagram` | `@sanity/workflows-ui/diagram` |
|
|
99
|
+
| `@sanity/workflow-cli` | `@sanity/workflows-cli` (the command is still `sanity-workflows`) |
|
|
100
|
+
| `@sanity/workflow-engine-test` | `@sanity/workflows-test` |
|
|
101
|
+
|
|
102
|
+
`@sanity/workflows-ui` has no root entry point; import from a subpath. `sanity`, `@sanity/sdk`, `@sanity/sdk-react`, `react-dom`, and `styled-components` are optional peer dependencies of `@sanity/workflows-ui`, so an App SDK app does not install Studio. `@sanity/blueprints-resource-workflow` now peers on `@sanity/workflows` instead of the engine and blueprint packages.
|
|
103
|
+
|
|
104
|
+
To upgrade:
|
|
105
|
+
|
|
106
|
+
1. Run `npx @sanity/workflows-cli codemod packages --dry-run` to see the changes, then `npx @sanity/workflows-cli codemod packages` to apply them. It rewrites imports and `package.json` dependencies and renames the six exports above. It lists any package name it could not rewrite safely, and any member read through a namespace name the file declares again; rename a listed member if it reads the import. Some reads of those exports keep the old name. Typecheck finds most of them, but check `require()` calls, plain JavaScript files, and test mocks by hand.
|
|
107
|
+
2. Install dependencies.
|
|
108
|
+
3. If the project has a generated blueprint, run `npx @sanity/workflows-cli blueprints generate`, so every Function imports `@sanity/workflows` and its `package.json` lists it, then deploy the Functions and the heartbeat stack. Until you regenerate, `deploy` and `blueprints generate --check` report the generated tree as out of date.
|
|
109
|
+
4. Typecheck.
|
|
110
|
+
|
|
111
|
+
`codemod packages` never edits lockfiles or generated blueprint files.
|
|
112
|
+
|
|
113
|
+
<!-- replay: does not change persisted instance behaviour: it renames the packages and moves their code, and the engine reads and writes the same documents -->
|
|
114
|
+
|
|
115
|
+
**Docs impact:** Replace every install command, import, and package name in the Workflows docs and examples with the new names, and add an upgrade guide with the table above, the six renamed UI exports, and the four steps. Add `codemod packages` to the CLI command reference. Update the release notes with the new package list, and point the reference docs at the four new package names.
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- 068e2d3: `codemod packages` now also renames the member directory exports of `@sanity/workflow-components`: `ProjectMember`, `ProjectMembersState`, `projectMemberRow` and `findProjectMember` become `ResourceMember`, `ResourceMembersState`, `resourceMemberRow` and `findResourceMember` in `@sanity/workflows-ui/components`. Before this, an upgraded app kept the old names and failed to typecheck. When the codemod moves `@sanity/workflows-test` from `dependencies` to `devDependencies`, it now prints a line saying so: declare it in `dependencies` instead if your app runs the test bench at runtime.
|
|
120
|
+
|
|
121
|
+
**No upgrade action required.** Run `npx @sanity/workflows-cli codemod packages` as the upgrade guide describes; a project that already ran it can run it again to pick up the member renames.
|
|
122
|
+
|
|
123
|
+
**Docs impact:** Add the four member directory names to the renamed exports the upgrade guide and the `codemod packages` reference list.
|
|
124
|
+
|
|
125
|
+
- 68dba8d: `sanity-workflows codemod packages` now writes code that compiles when a renamed export's new name is already in the file, and gives merged dependencies the release range. A renamed import whose new name the file already imports from the same entry point joins that import instead of adding a duplicate. When the new name is bound to something else, the import keeps its old local name through an alias and the codemod reports the file and both names. When several retired packages become one package, such as `@sanity/workflow-engine` and `@sanity/workflow-blueprint` becoming `@sanity/workflows`, the merged entry gets the same range a single rename gets, or the workspace link as written when any merged entry was one. An entry for the new package that already allows that range is kept, and any other entry is set to it.
|
|
126
|
+
|
|
127
|
+
**No upgrade action required.** Run the codemod from this release.
|
|
128
|
+
|
|
129
|
+
**Docs impact:** Remove the import-collision caveat from the 0.37 to 0.39 upgrade guide.
|
|
130
|
+
|
|
131
|
+
- cf46b41: Every package README now opens with a link to the public Workflows documentation at https://www.sanity.io/docs/workflows and to the docs page for that package, and each package's npm homepage link points at that page. README links that pointed into the source repository, which is not public, are removed.
|
|
132
|
+
|
|
133
|
+
**No upgrade action required.** The change affects the npm package page and the README in `node_modules` only; runtime behavior is unchanged.
|
|
134
|
+
|
|
135
|
+
**Docs impact: None.** The packages now link to existing documentation pages; no documentation content changes.
|
|
136
|
+
|
|
137
|
+
- Updated dependencies [7e8bafb]
|
|
138
|
+
- Updated dependencies [7be3254]
|
|
139
|
+
- Updated dependencies [8987126]
|
|
140
|
+
- Updated dependencies [21ec12e]
|
|
141
|
+
- Updated dependencies [5f14e3c]
|
|
142
|
+
- Updated dependencies [b6edbb4]
|
|
143
|
+
- Updated dependencies [532e3e3]
|
|
144
|
+
- Updated dependencies [8ca11d4]
|
|
145
|
+
- Updated dependencies [1f92d47]
|
|
146
|
+
- Updated dependencies [b64861c]
|
|
147
|
+
- Updated dependencies [50b1cb0]
|
|
148
|
+
- Updated dependencies [1610006]
|
|
149
|
+
- Updated dependencies [1610006]
|
|
150
|
+
- Updated dependencies [cf46b41]
|
|
151
|
+
- Updated dependencies [e92f57b]
|
|
152
|
+
- Updated dependencies [af2e8b8]
|
|
153
|
+
- Updated dependencies [120bea7]
|
|
154
|
+
- Updated dependencies [002c35e]
|
|
155
|
+
- Updated dependencies [c966ac2]
|
|
156
|
+
- Updated dependencies [65fc915]
|
|
157
|
+
- Updated dependencies [60502c8]
|
|
158
|
+
- Updated dependencies [b94aaae]
|
|
159
|
+
- Updated dependencies [f978046]
|
|
160
|
+
- Updated dependencies [60502c8]
|
|
161
|
+
- @sanity/workflows@0.39.0
|
|
162
|
+
|
|
163
|
+
## 0.38.0
|
|
164
|
+
|
|
165
|
+
### Minor Changes
|
|
166
|
+
|
|
167
|
+
- 64f88c3: The CLI's `Workflows CLI Command Executed` telemetry event now reports why a failed command failed. When `success` is false, the payload adds `failureKind`: the engine error kind for an engine error, or one of `usage`, `auth-missing`, `permission-denied`, `resource-not-found`, `request-failed`, `config-invalid`, `definition-file-invalid`, or `other`. It is absent on success. The kind is a fixed label; error messages and stack traces are still never sent. The event version moves to 3.
|
|
168
|
+
|
|
169
|
+
**No upgrade action required.** A telemetry logger supplied through the config receives the new optional field on failed commands.
|
|
170
|
+
|
|
171
|
+
**Docs impact:** Update the Workflows CLI telemetry reference to list the failure kind among the collected data.
|
|
172
|
+
|
|
173
|
+
- 20a68f4: The Workflows CLI's read commands (`list`, `show`, `tail`, `diagnose`, `definitions list`, and `definitions show`) can now run without a `sanity.workflow.ts` and without targeting flags. In an interactive terminal, when no config is found and none of `--project-id`/`--dataset`, `--media-library-id`, `--path`, or `--deployment` is passed, the command asks on stderr for a project and then one of its datasets from those your `sanity login` session can access, reads that dataset, and prints the `--project-id <id> --dataset <name>` flags that select it, so the next run can be scripted. The picker offers datasets only; media libraries stay reachable through `--media-library-id`. With `--json` or in a non-interactive shell, the command still fails when no config is found, and the failure now names the targeting flags. Commands that write still require a config and fail as before.
|
|
174
|
+
|
|
175
|
+
**No upgrade action required.** Runs with a config, or with the targeting flags, behave as before; scripts that run without either keep failing, now with a message that names the flags.
|
|
176
|
+
|
|
177
|
+
**Docs impact:** Update the CLI guide section on how reads choose their resources to describe the interactive project and dataset picker for the no-config case, and add it to the CLI reference entry for read targets.
|
|
178
|
+
|
|
179
|
+
- 1def098: Add `whoami`, which prints the user Workflows records for your login: the kind (`user` or `robot`), your Sanity user ID, and your project user ID. Put the Sanity user ID in user assignee fields, for example in `start --field`. `--json` prints the same values as one object. The command picks its project like the other read commands: from `sanity.workflow.ts`, `--deployment`, or `--project-id` with `--dataset`.
|
|
180
|
+
|
|
181
|
+
**No upgrade action required.**
|
|
182
|
+
|
|
183
|
+
**Docs impact:** Add `whoami` to the CLI command reference, and mention it where the docs explain which user ID to put in user assignee fields.
|
|
184
|
+
|
|
185
|
+
- cdd07a3: **BREAKING:** `grantsFromPath` is deprecated and ignored on every engine and `workflow.*` verb, `engine.session()`, and the `useWorkflowSession` hooks of `@sanity/workflow-react`, `@sanity/workflow-sdk` and `@sanity/workflow-studio`. Without an asserted `access`, the engine now always reads the caller's grants from the ACL of its `workflowResource` (`/projects/<id>/datasets/<dataset>/acl` for a dataset, `/canvases/<id>/acl` for a Canvas). Hosts that never passed `grantsFromPath`, such as an MCP host, now see `$can` bound, so `$can` conditions that always failed closed now evaluate against the caller's grants. A host that passed a different path gets the workflow resource's grants instead. The member stays in the types until it is removed with the old package names.
|
|
186
|
+
|
|
187
|
+
Engines created with `createEngine` contain write-routing paths for the unreleased Workflows service. They are off by default and not supported for use; with the Workflows service switch off, every instance write commits directly and nothing requests `/workflow/*`. A grants read that fails for a reason other than a `401`–`404` refusal is no longer kept for the client's lifetime: the next evaluation or write fetches the grants again, so `$can` and the subject-write forecast recover after a transient failure.
|
|
188
|
+
|
|
189
|
+
The CLI's `start`, `fire-action` and `abort` now run on a `createEngine` engine. The test bench's `createBench({service})` option exists for the engine's own tests and is not supported for use.
|
|
190
|
+
|
|
191
|
+
**Upgrade action:** stop passing `grantsFromPath`; it has no effect. Review `$can` conditions in definitions run by hosts that did not pass it, since they now evaluate instead of failing closed.
|
|
192
|
+
|
|
193
|
+
<!-- replay: pending.engine-write-routing -->
|
|
194
|
+
|
|
195
|
+
**Docs impact:** Remove `grantsFromPath` from every reference signature, guide and example and note its deprecation, and add the `$can` behaviour change to the release notes. For write routing: No docs change: the Workflows service is unreleased.
|
|
196
|
+
|
|
197
|
+
- 393526c: **BREAKING:** `sanity-workflows blueprints generate` now emits the generated runtime as two stacks. The scheduled heartbeat moves out of `workflows.blueprint.ts` into a blueprint of its own, `workflows-heartbeat/sanity.blueprint.ts`, with its own robot token (`wf-<deployment>-heartbeat-runtime`). Your `sanity.blueprint.ts` now holds only document functions (drains and start watchers), so it deploys to a project-scoped stack with a token that can deploy to the project. Only the heartbeat stack needs an organization deploy token. This affects every project whose generated runtime includes a heartbeat. If you regenerate and redeploy only your existing stack, the heartbeat is removed from it, and `$now` deadlines, parents waiting on spawned children, effects queued before their drain existed, and drains that timed out stop recovering, with no error anywhere.
|
|
198
|
+
|
|
199
|
+
The command now ends with a `Deploy:` section naming which token deploys which stack, and which of the heartbeat stack's files this run changed. That blueprint's header lists what the heartbeat depends on: the partition, the datasets, the `'function'`-hosted workflows it ticks and the `'function'`-hosted effects it re-queues. Editing an existing workflow leaves it unchanged, so only the project stack needs redeploying. Adding or removing a `'function'`-hosted workflow or effect changes it, and `blueprints generate --check` reports it as `differs`. The command also writes `workflows-heartbeat/package.json`, which copies your project's declared specifications for `@sanity/functions`, `@sanity/workflow-blueprint` and `@sanity/workflow-engine`, the same ones each generated function's `package.json` gets. When the heartbeat stack is built from `workflows-heartbeat/`, the Functions build installs the heartbeat's dependencies from that file, so the deployed heartbeat runs the versions your project pins. Keep it next to the stack's blueprint: without it, a project installed with npm builds the heartbeat against the latest published Workflows packages, which can fail on every run while the deploy reports success. Moving a declared specification for one of those three packages changes `workflows-heartbeat/package.json`, and `blueprints generate --check` reports it as `differs`. Redeploy the heartbeat stack with the organization token whenever the `Deploy:` section lists a heartbeat-stack file as changed. The heartbeat bundles the installed Workflows runtime when it is deployed, so after upgrading the Workflows packages, redeploy both stacks even when every generated file is unchanged. Until you do, the running heartbeat does not tick the new workflow's instances or re-queue the new effect. When a heartbeat is generated, the command also lists what stays stuck, silently, if the heartbeat stack is not running.
|
|
200
|
+
|
|
201
|
+
To migrate an existing single organization-scoped stack without running two heartbeats or two sets of document functions at once:
|
|
202
|
+
|
|
203
|
+
1. Regenerate with `sanity-workflows blueprints generate`.
|
|
204
|
+
2. From the project root, run `npx sanity@latest blueprints deploy` against your existing stack. This removes the heartbeat from it and keeps its document functions.
|
|
205
|
+
3. From `workflows-heartbeat/`, run `npx sanity@latest blueprints init . --organization-id <organizationId>` and `npx sanity@latest blueprints deploy` with the organization deploy token. Deadlines, children and stale effects that came due between steps 2 and 3 are picked up once the new heartbeat runs; each run works on at most 30 instances per step, so a large backlog takes several runs.
|
|
206
|
+
4. Optional: to move the document functions to a project-scoped stack, run `npx sanity@latest blueprints destroy` on the old stack, then `npx sanity@latest blueprints init . --project-id <projectId>` and `npx sanity@latest blueprints deploy` from the project root with a project token. The heartbeat re-queues effects queued in between, but a document written in between starts no instance; start it with `sanity-workflows start`.
|
|
207
|
+
|
|
208
|
+
Each heartbeat stack counts toward the organization's limit of 10 organization-scoped stacks.
|
|
209
|
+
|
|
210
|
+
<!-- replay: does not change persisted instance behaviour: it changes how the generated runtime is deployed, not the engine -->
|
|
211
|
+
|
|
212
|
+
**Docs impact:** Update the generated-runtime guide's layout and deploy sections (two blueprints, the generated `workflows-heartbeat/package.json` the heartbeat's build installs from, which token deploys each, when the heartbeat stack needs redeploying, the stuck-instance consequences of a missing heartbeat stack, and the organization stack limit), the CLI reference output for `blueprints generate`, and add this migration to the release notes.
|
|
213
|
+
|
|
214
|
+
- 71e3f25: **BREAKING:** `createRuntime` now serves every resource alias that is not a dataset (a Media Library, Canvas, or Dashboard) by deriving its client from the workflow dataset's client with `withConfig`. Before, the runtime ignored those aliases, so a custom `clientFactory` could return any client. If you pass your own `clientFactory` and the deployment binds such an alias, the client your factory returns must now have `withConfig`; until it does, `createRuntime` throws and every generated function on that deployment fails. The default factory and `@sanity/client` already have `withConfig`, so generated runtimes that keep the default need no change for this.
|
|
215
|
+
|
|
216
|
+
**BREAKING:** `startWatcherName` from `@sanity/workflow-blueprint/generate` takes `{deploymentName, source, group}` instead of `{deploymentName, dataset, group}`, because a watcher's source can now be a Media Library id as well as a dataset name. Code that calls it directly must pass the dataset name as `source`; until it does, the call fails to type-check, and an untyped caller throws a `TypeError`. The generator and `createRuntime` already pass `source`, so generated handlers need no change.
|
|
217
|
+
|
|
218
|
+
An autonomous workflow whose subject is a Media Library asset now starts in the generated runtime. Before, `sanity-workflows blueprints generate` watched only datasets, so a workflow typed `types: ['sanity.asset']` never started when an asset was uploaded to a Media Library bound in `resourceAliases`, and nothing reported it. The generator now emits a Media Library asset function (`defineMediaLibraryAssetFunction`) for each bound Media Library, which starts an asset when it is created. A Media Library trigger cannot evaluate a filter before and after a write, so `blueprints generate` now fails when such a definition's `start.filter` reads more of the asset than `_type`, instead of emitting a watcher that would never fire. `runtime.start` references the asset as `media-library:<library id>:<asset id>`, so drains, effect handlers, and the heartbeat's `$now` deadlines read the asset through the alias. `blueprints generate` names each Media Library watcher and warns which robot tokens need access to the library.
|
|
219
|
+
|
|
220
|
+
Upgrade action: if a deployment binds a Media Library alias and has an autonomous definition whose subject is an asset, regenerate the runtime with `sanity-workflows blueprints generate` and redeploy the project stack. If the deployment has a heartbeat stack, redeploy it too from `workflows-heartbeat/` with the organization deploy token: the heartbeat bundles its own copy of the runtime. Deploy the project stack with an identity that can read the library; the deploy fails otherwise. Confirm the runtime robot token (`wf-<deployment>-runtime`) and the heartbeat robot token can read the library, or every start there fails. Other deployments generate the same files as before and need no upgrade action beyond the custom `clientFactory` and `startWatcherName` cases above.
|
|
221
|
+
|
|
222
|
+
<!-- replay: does not change persisted instance behaviour: it changes the generated runtime's client wiring and start watchers, not the engine -->
|
|
223
|
+
|
|
224
|
+
**Docs impact:** Update the generated-runtime guide (start watchers, the project stack, and robot token access) to cover Media Library aliases and asset-typed subjects, document the `withConfig` requirement for a custom `clientFactory` in the runtime reference, replace `dataset` with `source` in any reference that shows `startWatcherName`'s arguments, and add the asset-intake pattern (upload starts review, rights expiry as a `$now` transition) to the Media Library workflow examples.
|
|
225
|
+
|
|
226
|
+
- 860bb6c: `sanity-workflows blueprints generate` now prints a short summary by default: one line per deployment with the functions it needs, only the files that need you (a new effect-handler scaffold, a change to your own `sanity.blueprint.ts`, anything it could not resolve), a count of files written by status, and a `Deploy:` section. The project stack is still named whenever there are document functions; the heartbeat stack is named only when this run created or updated one of its files. When a heartbeat-stack file changes, the instruction is now conditional ("if you have deployed the heartbeat stack, redeploy it"), because the command cannot tell whether that stack was deployed. The new `--verbose` flag prints the full output: the runtime-needs report, every file with its status, and the heartbeat stack's instructions on every run. `--check` output and every exit code are unchanged. `deploy` now marks an `unchanged` definition with an info symbol instead of a warning symbol.
|
|
227
|
+
|
|
228
|
+
**No upgrade action required.** Scripts that parse the default `blueprints generate` output for the needs report, the per-file rows, or the `Deploy:` section should pass `--verbose`.
|
|
229
|
+
|
|
230
|
+
**Docs impact:** Update the CLI command reference for `blueprints generate` with the `--verbose` flag, and any guide or example that quotes `blueprints generate` output (the Blueprints runtime setup guide and the Slack effect example) to show the shorter default output.
|
|
231
|
+
|
|
232
|
+
- caa6a86: **BREAKING:** The `setStage` admin override is removed. Every stage move now
|
|
233
|
+
goes through a declared transition. This affects engine callers of
|
|
234
|
+
`workflow.setStage` or `Engine.setStage`, test suites that call
|
|
235
|
+
`bench.setStage`, operators who run `sanity workflows set-stage`, and
|
|
236
|
+
consumers of the diagnose `RemediationVerb` vocabulary. Calls to the removed
|
|
237
|
+
API fail to compile, and the CLI no longer recognizes `set-stage`.
|
|
238
|
+
|
|
239
|
+
- **Engine:** `workflow.setStage`, `Engine.setStage`, `SetStageArgs`, the
|
|
240
|
+
`REQUEST_TAG.setStage` request tag, and the `WorkflowStageSet` telemetry
|
|
241
|
+
event (`Workflows Engine Stage Set`) are removed. `WorkflowStageTransitioned`
|
|
242
|
+
now always reports `via: 'transition'`.
|
|
243
|
+
- **Test bench:** `bench.setStage` and `BenchSetStageArgs` are removed. Move a
|
|
244
|
+
test instance by firing the actions its transitions read, or by seeding the
|
|
245
|
+
content and fields they read and calling `bench.tick`.
|
|
246
|
+
- **CLI:** `sanity workflows set-stage` is removed.
|
|
247
|
+
- **Diagnose:** `RemediationVerb` replaces `'set-stage'` with `'tick'`. A
|
|
248
|
+
`failed-activity` diagnosis suggests only `reset-activity`. A
|
|
249
|
+
`no-transition-fires` diagnosis suggests `tick` once the content or fields
|
|
250
|
+
the intended transition reads are fixed, then `abort`. The CLI has no `tick`
|
|
251
|
+
command: the rationale tells operators to call `workflow.tick` from code, or
|
|
252
|
+
to let the next commit or a deployed heartbeat re-check. Code that switches
|
|
253
|
+
on `RemediationVerb` must handle `'tick'` and drop `'set-stage'`.
|
|
254
|
+
- **Studio plugin:** a stuck instance with no firing transition now says to
|
|
255
|
+
fix the content or fields the workflow needs instead of telling the editor to
|
|
256
|
+
move the workflow on themselves.
|
|
257
|
+
|
|
258
|
+
To recover an instance that `set-stage` used to move, fix the content or
|
|
259
|
+
fields its intended transition reads. Then re-check its transitions: call
|
|
260
|
+
`workflow.tick` from code, or wait for the next commit on the instance or a
|
|
261
|
+
tick from a deployed heartbeat. There is no CLI `tick` command. Reset a failed
|
|
262
|
+
activity with `sanity workflows reset-activity`, or abort the instance with
|
|
263
|
+
`sanity workflows abort`.
|
|
264
|
+
|
|
265
|
+
Stored instances keep working unchanged: history rows with `via: 'setStage'`
|
|
266
|
+
still parse, and the CLI and Studio still render them as forced moves.
|
|
267
|
+
|
|
268
|
+
<!-- replay: pending.remove-set-stage-override -->
|
|
269
|
+
|
|
270
|
+
**Docs impact:** `set-stage` must be purged from the docs completely. Remove
|
|
271
|
+
`setStage` and `set-stage` from the engine API and CLI
|
|
272
|
+
references, the test-bench guide, and any recovery guidance; update the
|
|
273
|
+
diagnose remediation reference to the new verb set; call out the removal and
|
|
274
|
+
the recovery path in the release notes.
|
|
275
|
+
|
|
276
|
+
- 0317021: `@sanity/workflow-engine` exports `ServiceReaderModelError` (`kind: 'service-reader-model'`), part of a deploy check against the data model of the unreleased Workflows service. The check runs only with the Workflows service switch on, which is off by default; with it off, `deployDefinitions`, `computeDiffEntries`, `sanity-workflows deploy` and `deploy --dry-run` behave as before and request nothing from `/workflow/*`.
|
|
277
|
+
|
|
278
|
+
**No upgrade action required.**
|
|
279
|
+
|
|
280
|
+
**Docs impact:** No docs change: the Workflows service is unreleased.
|
|
281
|
+
|
|
282
|
+
- 5c549dd: `sanity-workflows start` now accepts a bare Content Release name for a field declared as `release.ref`, for example `--field release=rA1b2C3d4`. The CLI builds the release ref on the one resource the deployment binds in `resourceAliases` other than its `workflowResource`, or on `workflowResource` when it binds no other. When the deployment binds several other resources, pick one with the new `--release-resource <alias>` flag, which names a `resourceAliases` binding; without it `start` fails and asks for the flag or the full JSON object, which keeps working as before. Values for other field kinds are unchanged.
|
|
283
|
+
|
|
284
|
+
**No upgrade action required.**
|
|
285
|
+
|
|
286
|
+
**Docs impact:** Update the CLI reference for `start --field` to show the bare release-name form and how the CLI picks the release's resource, including `--release-resource`.
|
|
287
|
+
|
|
288
|
+
- 4f5a100: A generated start watcher now starts a definition only on the write that makes its `start.filter` true: a create where the filter already holds, or an update that turns it from false to true. An edit to a document whose filter was already true no longer starts another instance, even when the edit changes a field the filter reads. A filter that evaluates to null counts as false, as it does in the engine. A document whose filter turns false and then true again still gets one instance for each time it becomes true. `start.filter` keeps its meaning, and definitions without one keep starting on create only.
|
|
289
|
+
|
|
290
|
+
A `start.filter` the trigger cannot evaluate the way the engine does starts on every matching write, each write deduplicated as before: one that reads `$now` or another document through `*[...]` or `->`; one that reads `$tag` or `$definition` and also reads the written document beyond `_type` (a field of it, or the whole document as `references()` does); and one the generator does not recognize as always evaluating to a boolean or null, such as a bare field like `slug.current`, `count(tags)`, or a `select(...)`, whose value the engine counts by truthiness. Only filters reading `$now`, another document, or the whole document already fired on every write. A `$tag`/`$definition` filter that reads a field, and an unrecognized filter that reads fields only, used to fire only on a write that changed one of those fields; their watcher now fires on every write to a matching document, so an edit to an unrelated field can start another instance while the filter holds. `sanity-workflows blueprints generate` now warns for each of these definitions which of those reasons applies and that a later matching write can start another instance for the same document. To avoid repeated starts, move the part the trigger cannot evaluate (the time, cross-document, or `$tag`/`$definition` condition) into a stage, rewrite an unrecognized filter as a boolean expression (comparisons, `&&`, `||`, `!`, `defined()`, `references()`) such as `count(tags) > 0` or `defined(slug.current) && slug.current != ""`, or self-host the start. `DeploymentPlan.unnarrowedStartFilters` is renamed `everyWriteStartFilters` and lists exactly these definitions, each with its reason; a filter that reads the whole document and no variable, such as `references("campaign-1")`, is now edge-detected and no longer listed.
|
|
291
|
+
|
|
292
|
+
To upgrade, update `@sanity/workflow-blueprint` and `@sanity/workflow-cli`, run `sanity-workflows blueprints generate`, commit the regenerated files, and redeploy the stack with `sanity blueprints deploy`. Until you regenerate, `sanity-workflows deploy` stops because the generated tree differs and `sanity-workflows blueprints generate --check` fails in CI: the generated function manifests copy the package versions your project declares, and many definitions with a `start.filter` get a different trigger in `workflows.blueprint.ts`. The trigger filter is compiled into the deployed functions, so until you redeploy the stack they behave as before: an edit that changes a field the start filter reads keeps starting another instance while the filter holds, and a filter that reads the whole document keeps starting one on every edit. Instances already started are not removed.
|
|
293
|
+
|
|
294
|
+
**Docs impact:** The Functions runtime guide should say a start watcher starts a definition on the write that makes its start filter true, not on every matching write, list the filters that start on every matching write with the warning and its remedies, including the ones whose watcher widened, and tell existing users to regenerate and redeploy; the CLI's generated-runtime caveats in the `@sanity/workflow-cli` README already describe the new behaviour.
|
|
295
|
+
|
|
296
|
+
### Patch Changes
|
|
297
|
+
|
|
298
|
+
- 3c92b4a: The Blueprint files and function shells that `sanity-workflows blueprints generate` writes work with `@sanity/blueprints` 0.31. Neither package's exports change.
|
|
299
|
+
|
|
300
|
+
**No upgrade action required.** `@sanity/blueprints` is not a dependency of either package, and the generated files do not record its version: your project keeps the version it declares, and moving it to 0.31 does not require regenerating.
|
|
301
|
+
|
|
302
|
+
**Docs impact: None.** Compatibility with `@sanity/blueprints` 0.31 needs no documentation change.
|
|
303
|
+
|
|
304
|
+
- 2f32af1: Workflow authoring help and package documentation now match what the engine
|
|
305
|
+
and commands accept.
|
|
306
|
+
|
|
307
|
+
- `START_FILTER_VARS` no longer tells authors to scan with `tag == $tag`, which
|
|
308
|
+
never matches: start-filter scans already cover only the engine's partition,
|
|
309
|
+
and their rows carry only `definition`, `subject`, and `completedAt`. The
|
|
310
|
+
`$tag` entry's description, which editor completion shows, now gives a scan
|
|
311
|
+
that works:
|
|
312
|
+
`count(*[definition == $definition && !defined(completedAt)]) < 3`. `$tag`
|
|
313
|
+
stays bound as before.
|
|
314
|
+
- The MCP authoring guide (`workflows_get_authoring_guide`) now teaches
|
|
315
|
+
subworkflows: action `spawn`, `lifecycle: 'child'`, `$row`, `$subworkflows`,
|
|
316
|
+
the explicit completion gate, and a parent and child validated together. It
|
|
317
|
+
also explains that a transition whose `when` cannot be evaluated holds the
|
|
318
|
+
stage: no later transition fires, and once the missing value is set the
|
|
319
|
+
next cascade checks the transitions again. When every activity in the stage
|
|
320
|
+
is resolved, `workflows_diagnose` reports the hold as the recoverable
|
|
321
|
+
`transition-unevaluable` stuck cause, even when a later transition is
|
|
322
|
+
satisfied, because that transition does not fire until the held ones
|
|
323
|
+
resolve.
|
|
324
|
+
- `sanity-workflows blueprints generate` and the `@sanity/workflow-blueprint`
|
|
325
|
+
README no longer say that without the heartbeat stack `$now` deadlines never
|
|
326
|
+
pass, a spawning parent never advances, and a stalled effect is never
|
|
327
|
+
retried. A settling child re-evaluates its parent directly. Without the
|
|
328
|
+
heartbeat, nothing checks these on a schedule: a deadline or a parent that
|
|
329
|
+
missed a child settling waits until another engine call evaluates it, and a
|
|
330
|
+
stalled effect waits until a later drain picks it up. The needs report and
|
|
331
|
+
`HeartbeatSpec.reasons` likewise stop saying the heartbeat re-evaluates a
|
|
332
|
+
parent when a child settles. The spawning reason now reads
|
|
333
|
+
`re-evaluates spawning parents`, and a self-hosted spawning definition is
|
|
334
|
+
listed as a parent to re-evaluate after it misses a child settling.
|
|
335
|
+
- `sanity-workflows` help examples use the definition name `product-launch`
|
|
336
|
+
instead of `productLaunch`, a name the definition-name grammar rejects, so no
|
|
337
|
+
deployed definition can carry it.
|
|
338
|
+
- The `@sanity/workflow-mcp` and `@sanity/workflow-cli` READMEs no longer
|
|
339
|
+
reference unpublished source files or repository-only commands. The MCP
|
|
340
|
+
README shows how to run the shipped `workflow-mcp` binary with `npx` or from
|
|
341
|
+
`node_modules`.
|
|
342
|
+
- The `driverKind` documentation names `person`, `agent`, and `service` as the
|
|
343
|
+
values new `actionFired` entries record. The `ActivityEntry.filterEvaluation`
|
|
344
|
+
documentation says that it is a write-once record no engine API reads back.
|
|
345
|
+
|
|
346
|
+
**No upgrade action required.** No definition, stored document, or command
|
|
347
|
+
behaves differently; only help, report, and documentation wording changes.
|
|
348
|
+
|
|
349
|
+
**Docs impact:** Update start-filter guidance wherever it shows `tag == $tag`
|
|
350
|
+
inside a `*[...]` scan; update the MCP authoring and subworkflow guides to
|
|
351
|
+
cover spawning, the unevaluable-transition hold, and its recoverable
|
|
352
|
+
`transition-unevaluable` diagnosis; use `product-launch` in CLI
|
|
353
|
+
examples; describe `filterEvaluation` as a write-once stored record; and
|
|
354
|
+
where the generated-runtime guide lists what happens without the heartbeat
|
|
355
|
+
stack, say that deadlines and a parent that missed a child settling wait for
|
|
356
|
+
another engine call and a stalled effect waits for a later drain, rather than
|
|
357
|
+
that they stay stuck.
|
|
358
|
+
|
|
359
|
+
- 450fd4e: `sanity-workflows blueprints generate` and the runtime it generates are no longer labelled experimental or not ready for production, in the command's help text or in the package READMEs. The generated runtime carries the same prerelease status as the rest of Workflows; the command, its output, and its behavior are unchanged.
|
|
360
|
+
|
|
361
|
+
**No upgrade action required.**
|
|
362
|
+
|
|
363
|
+
**Docs impact:** Remove the experimental or not-ready-for-production labelling of runtime generation from the published Workflows documentation, such as the "Experimental generator" callout, and state no separate status for it; Workflows' prerelease guidance already covers it.
|
|
364
|
+
|
|
365
|
+
- 7623b3e: Engines no longer call the Workflows service unless the experimental Workflows service switch is on, and it is off by default. While it is off, every instance write commits directly, and `deployDefinitions`, `computeDiffEntries`, `sanity-workflows deploy` and `deploy --dry-run` skip the service data-model check, so nothing requests `/workflow/*`. Write routing and that check are experimental.
|
|
366
|
+
|
|
367
|
+
**No upgrade action required.**
|
|
368
|
+
|
|
369
|
+
**Docs impact:** No docs change: the Workflows service is unreleased.
|
|
370
|
+
|
|
371
|
+
- Updated dependencies [bb9c414]
|
|
372
|
+
- Updated dependencies [ceac057]
|
|
373
|
+
- Updated dependencies [ceac057]
|
|
374
|
+
- Updated dependencies [3c92b4a]
|
|
375
|
+
- Updated dependencies [0cb1f0c]
|
|
376
|
+
- Updated dependencies [74aa45f]
|
|
377
|
+
- Updated dependencies [2f32af1]
|
|
378
|
+
- Updated dependencies [ddb8c65]
|
|
379
|
+
- Updated dependencies [6c4beff]
|
|
380
|
+
- Updated dependencies [f20e083]
|
|
381
|
+
- Updated dependencies [ba999be]
|
|
382
|
+
- Updated dependencies [9c085c8]
|
|
383
|
+
- Updated dependencies [e5676c7]
|
|
384
|
+
- Updated dependencies [025df76]
|
|
385
|
+
- Updated dependencies [cdd07a3]
|
|
386
|
+
- Updated dependencies [4f5a100]
|
|
387
|
+
- Updated dependencies [393526c]
|
|
388
|
+
- Updated dependencies [0984e59]
|
|
389
|
+
- Updated dependencies [e7973da]
|
|
390
|
+
- Updated dependencies [7e9a9e1]
|
|
391
|
+
- Updated dependencies [71e3f25]
|
|
392
|
+
- Updated dependencies [e0251b7]
|
|
393
|
+
- Updated dependencies [429bf8a]
|
|
394
|
+
- Updated dependencies [a1fc434]
|
|
395
|
+
- Updated dependencies [10b3f0c]
|
|
396
|
+
- Updated dependencies [e0251b7]
|
|
397
|
+
- Updated dependencies [c65f2ae]
|
|
398
|
+
- Updated dependencies [21b3e35]
|
|
399
|
+
- Updated dependencies [caa6a86]
|
|
400
|
+
- Updated dependencies [393526c]
|
|
401
|
+
- Updated dependencies [0317021]
|
|
402
|
+
- Updated dependencies [4f5a100]
|
|
403
|
+
- Updated dependencies [3019624]
|
|
404
|
+
- Updated dependencies [621c963]
|
|
405
|
+
- Updated dependencies [1a3238d]
|
|
406
|
+
- Updated dependencies [7623b3e]
|
|
407
|
+
- @sanity/workflow-engine@0.38.0
|
|
408
|
+
- @sanity/workflow-blueprint@0.38.0
|
|
409
|
+
|
|
3
410
|
## 0.37.0
|
|
4
411
|
|
|
5
412
|
### Minor Changes
|