@sanity/workflow-studio-plugin 0.4.0 → 0.20.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 +161 -0
- package/README.md +38 -64
- package/dist/_chunks-cjs/index.cjs +1640 -806
- package/dist/_chunks-cjs/workflows-tool-root.cjs +1435 -1572
- package/dist/_chunks-es/index.js +1646 -842
- package/dist/_chunks-es/workflows-tool-root.js +909 -1048
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +16 -74
- package/dist/index.d.ts +16 -74
- package/dist/index.js +2 -2
- package/package.json +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,166 @@
|
|
|
1
1
|
# @sanity/workflow-studio-plugin
|
|
2
2
|
|
|
3
|
+
## 0.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 419cd5e: Action buttons and action-menu items take their face from declared decision semantics: `decision.accept` renders positive with a checkmark icon, `decision.decline` renders caution with a cross icon, in the quiet top-row, the concluding footer, and the "Select action" menu treatments alike — the icon doubles the tone as a non-color channel. A declared `failed` status keeps its bare critical face and outranks the semantics; actions without semantics render as before.
|
|
8
|
+
- e3122cc: The document view's boot indicators consolidate: section headers no longer spin while sessions boot — the Active Workflows heading carries one spinner for the group (held back 400ms so warm boots paint nothing), since a document's sections boot together over shared discovery and one consolidated guard query. A section speaks up individually only when it diverges: its invalid notice, or its stage body's loading row — now shaped as a work row (spinner in the status glyph's slot) so a one-activity stage swaps loading for content with zero layout shift.
|
|
9
|
+
- 46b0285: **BREAKING:** Replace manually declared document applicability with automatic
|
|
10
|
+
discovery from deployed first-class subject fields.
|
|
11
|
+
|
|
12
|
+
Update Studio configuration as follows:
|
|
13
|
+
- `mappings` is optional. Omit it when every applicable definition declares a
|
|
14
|
+
first-class subject. A mapping may customize an automatically discovered
|
|
15
|
+
`(docType, definition)` binding or explicitly register a definition modeled
|
|
16
|
+
with a plain `doc.ref` instead of a first-class subject.
|
|
17
|
+
- Multiple workflows may target one document type. Use one mapping row for each
|
|
18
|
+
distinct `(docType, definition)` pair. An exact duplicate pair is a
|
|
19
|
+
configuration error rather than a last-row-wins override.
|
|
20
|
+
- Remove the top-level `autoStart` map or function. Put `autoStart: true` on
|
|
21
|
+
each mapping row that should start automatically. Configure workspace-specific
|
|
22
|
+
behavior in that workspace's mapping rows. This also works for explicitly
|
|
23
|
+
registered definitions using the `doc.ref` field named `subject` convention.
|
|
24
|
+
- Replace `workflowDefaultDocumentNode({mappings})` with
|
|
25
|
+
`workflowDefaultDocumentNode()`.
|
|
26
|
+
|
|
27
|
+
Before:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
structureTool({defaultDocumentNode: workflowDefaultDocumentNode({mappings})})
|
|
31
|
+
workflowStudioPlugin({
|
|
32
|
+
tag: 'production',
|
|
33
|
+
mappings,
|
|
34
|
+
autoStart: {article: ['article-review', 'legal-review']},
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
After:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
structureTool({defaultDocumentNode: workflowDefaultDocumentNode()})
|
|
42
|
+
workflowStudioPlugin({
|
|
43
|
+
tag: 'production',
|
|
44
|
+
mappings: [
|
|
45
|
+
{
|
|
46
|
+
docType: 'article',
|
|
47
|
+
definition: 'article-review',
|
|
48
|
+
label: 'Article review',
|
|
49
|
+
autoStart: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
docType: 'article',
|
|
53
|
+
definition: 'legal-review',
|
|
54
|
+
label: 'Legal review',
|
|
55
|
+
autoStart: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Also remove all per-schema Editorial Workflows preview wiring:
|
|
62
|
+
- Remove `components: {preview: WorkflowStagePreview}`.
|
|
63
|
+
- Remove `_id` added only for Editorial Workflows from `preview.select` and
|
|
64
|
+
stop passing it through `preview.prepare`.
|
|
65
|
+
- Remove imports of `WorkflowStagePreview`; that component is no longer a
|
|
66
|
+
public package export.
|
|
67
|
+
- Remove imports of `mappingForDocType` and `workflowDocTypes`; effective
|
|
68
|
+
mappings are resolved inside the plugin and those host-side helpers are no
|
|
69
|
+
longer exported.
|
|
70
|
+
- Keep each schema's native inferred or custom preview unchanged. The plugin
|
|
71
|
+
now installs preview middleware itself, consumes the document identity Studio
|
|
72
|
+
already supplies, and delegates title, subtitle, media, and custom preview
|
|
73
|
+
composition through `renderDefault`.
|
|
74
|
+
|
|
75
|
+
Workflow stage pills appear on Studio surfaces that invoke preview middleware,
|
|
76
|
+
including reference and array-item previews. Custom preview components that
|
|
77
|
+
replace Studio's layout must render the `status` prop they receive. Studio's
|
|
78
|
+
Structure document-list rows bypass both plugin and schema preview middleware,
|
|
79
|
+
so they do not show workflow stage pills. Workflow status remains available in
|
|
80
|
+
the document form, footer badge, Workflows view, and Workflows tool.
|
|
81
|
+
|
|
82
|
+
Document-reference GDRs for dataset content now reject stored draft IDs
|
|
83
|
+
(`drafts.<id>`) and Content Release version IDs
|
|
84
|
+
(`versions.<release>.<id>`). Use the stable document ID in the GDR and select
|
|
85
|
+
the draft or release through workflow perspective instead. The validation error
|
|
86
|
+
includes the corresponding stable ID so CLI and API callers can correct the
|
|
87
|
+
input before an unresolvable workflow instance is created.
|
|
88
|
+
|
|
89
|
+
Previously persisted draft/version GDRs remain invalid workflow identities.
|
|
90
|
+
Read-side Studio displays now tolerate them by showing the raw URI instead of
|
|
91
|
+
crashing, and query-sourced occurrences are discarded through the existing
|
|
92
|
+
fail-soft field-resolution path. Correct existing data by starting a new
|
|
93
|
+
instance with the stable document ID; perspective selects the desired draft or
|
|
94
|
+
release content.
|
|
95
|
+
|
|
96
|
+
- 98e488e: Stabilize Editorial Workflows discovery subscriptions and limit full reactive sessions to surfaces that need live evaluation.
|
|
97
|
+
- e3122cc: Settled workflow runs no longer boot reactive sessions. The provider mounts an evaluator only for in-flight discovered instances (plus any instance explicitly pulled in through the refcounted request seam, settled or not); settled entries render from committed documents and are vacuously `ready`, so the accordion header no longer spins for finished sections. The mounted sessions share one consolidated guard live query per resource (the plan's `guardScope`), so opening a document costs one discovery subscription plus guard machinery that doesn't grow with its active-run count.
|
|
98
|
+
- e860898: **BREAKING:** Published Editorial Workflows packages now ship as one fixed release stack and require exact-version peers for every shared runtime package. Install the matching stack so the engine, reactive core, adapters, tools, and UI cannot silently load private or version-skewed copies.
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- 8a76c67: Add incremental reactive-session document feeds, coalesce watched-document emissions, and reuse discovery derivations and Studio layout output. Deleted watched documents now leave the held snapshot instead of remaining as stale evaluation input. The component test runner also has aggregate-suite timeout headroom.
|
|
103
|
+
- ab5e454: Share projected project members and use indexed, memoized assignee display lookups.
|
|
104
|
+
- Updated dependencies [bce09fc]
|
|
105
|
+
- Updated dependencies [efb4cd9]
|
|
106
|
+
- Updated dependencies [ab5e454]
|
|
107
|
+
- Updated dependencies [46b0285]
|
|
108
|
+
- Updated dependencies [ab5e454]
|
|
109
|
+
- Updated dependencies [8a76c67]
|
|
110
|
+
- Updated dependencies [e3122cc]
|
|
111
|
+
- Updated dependencies [e3122cc]
|
|
112
|
+
- Updated dependencies [7e8f459]
|
|
113
|
+
- Updated dependencies [98e488e]
|
|
114
|
+
- Updated dependencies [7c4dd86]
|
|
115
|
+
- Updated dependencies [e860898]
|
|
116
|
+
- Updated dependencies [e3122cc]
|
|
117
|
+
- @sanity/workflow-engine@0.20.0
|
|
118
|
+
- @sanity/workflow-studio@0.20.0
|
|
119
|
+
- @sanity/workflow-react@0.20.0
|
|
120
|
+
- @sanity/workflow-components@0.20.0
|
|
121
|
+
- @sanity/workflow-diagram@0.20.0
|
|
122
|
+
|
|
123
|
+
## 0.5.0
|
|
124
|
+
|
|
125
|
+
### Minor Changes
|
|
126
|
+
|
|
127
|
+
- 767497c: Document reference previews render as hoverable card links: the preview card IS the edit-intent link, with hover/focus affordances instead of a static-text face. Compact row lockups (the tool's group bands) compose the chip from schema icon + live title on the row's own text metric — Studio's portable-text inline preview misaligns outside a text run — so chips center exactly with the badges and buttons beside them. The tool's document group bands step up one radius, give the collapse toggle a larger hit area, and vertically center every band item.
|
|
128
|
+
- 0143226: The document form strip now shows every workflow run instead of hiding finished ones and collapsing concurrent actives. Each active instance renders its own line (definition title, current stage, its own assigned-task count — the "N active workflows" aggregate line is gone), and each workflow type whose runs have all settled keeps one line showing its latest run's terminal state (an Aborted chip for a run that never completed), with the settle time on hover; a type running again is represented by its active line instead. Clicking any line opens the Workflows view focused on that run — only its section unfurled, via a sticky pane param that survives reloads.
|
|
129
|
+
- 767497c: Tool instance bands render the form strip's instance lockup — title, then the stage face with its glyph in the primary tone — and the lockup is a real link to the instance's detail view: plain clicks navigate in place (carrying the selected tab), modified clicks open the resolved route in a new tab.
|
|
130
|
+
- 24b11dd: Surface the `progress` field kind: a progress field's pill wears its value as a tweened background fill with a whole-number percent caption in a reserved-width slot (at-a-glance progress that never resizes as it ticks), the tweened `ProgressBar` (from `@sanity/workflow-components`) renders on every field-value display surface — pill popovers, field rows, the activity dialog — and edits go through native 0–100 number inputs honoring declared validation bounds; the MCP authoring guide documents the kind.
|
|
131
|
+
- 767497c: The Workflows tool drops its All workflows tab: the tool is Overview and For me. The instance-level filter arms that only backed that listing are gone with it.
|
|
132
|
+
- 2005ab7: Terminal-action placement keys on what firing concludes: an action whose fire would exit the stage right now (the engine's `firing` consequence) joins the own-status settling actions in the dialog footer and the row's terminal cluster — no longer a quiet top-strip button. The activity detail dialog's footer also drops its Cancel button (field edits commit on their own gestures, so there was nothing to cancel — dismissal is the header X, Esc, or the overlay) and renders only when terminal actions exist.
|
|
133
|
+
- 47fd2b5: Terminal actions fold into menus instead of the primary-plus-chevron split button. An activity list row with two or more actions offers one "Select action" menu listing them all; a lone action stays a plain ghost button. The activity dialog footer lays actions out inline — capped at three, and only as many as the measured footer width fits without wrapping, refitting as the dialog resizes — with the surplus behind a "More actions" menu.
|
|
134
|
+
- 767497c: Workflows tool layout: the title, tabs, and the active tab's filter row are a fixed header — only the task list scrolls, with a stable scrollbar gutter so the scrollbar appearing doesn't reflow rows. Task rows indent under their instance band (the document view's stage inset) and share the bands' border radius. Header padding is uniform, with the tool title optically aligned to the tab labels; the tabs' loading rows share the same optical indent. The plugin now declares `react-dom` as a peer dependency (the header slot renders through a portal).
|
|
135
|
+
- 767497c: Workflows tool: one tab strip — Overview (all tasks, default) and For me (the user's assignments) — replacing the Tasks/All workflows tabs and the nested My tasks/All tasks toggle. The selected tab now rides the tool's URL search params with the same contract as the document view's tab (default elided, unknown values read as the default), so reloads, bookmarks, and detail-view round-trips keep the tab. The "New workflow" button drops its primary tone and tightens its icon-to-label gap.
|
|
136
|
+
- 767497c: Workflows tool: task rows are now the document view's shared activity row — same geometry and the same inline controls: the assignee picker and a new date chip. The Overview groups one dimension per level — a band per document, lighter collapsible bands per workflow instance under it (the title + current-stage lockup, a link to the instance's detail view; every band's affordance acts on exactly the entity it names), and the instance's activity rows below. Instances without a Studio document band bare in a trailing section. The For me segment reads the same hierarchy cut to the user's assignments, its rows carrying the inline terminal-action cluster (everything listed is yours to act on — Overview rows stay action-free); the document pane's For me tab keeps its flat list. Rendered rows pull their instances into the provider's live evaluation to drive the controls; rows hold the committed facts in the same shell until it lands.
|
|
137
|
+
|
|
138
|
+
The inline assign and date controls are state-driven so identical-looking triggers never behave differently across rows: a declared-editable field with anything to show always renders its trigger — the popover shows a loading state until the live evaluation lands, and the picker while the field is editable for the actor; once editing is closed (a settled activity, a denying predicate) the trigger swallows the click and explains itself in the hover hint instead of falling through to the row's dialog. Values whose field is never declared editable render as plain content, without button chrome. The activity row gains an optional date-control slot for surfaces that show dates on rows.
|
|
139
|
+
|
|
140
|
+
- 767497c: An unreadable workflow document no longer blanks the Workflows tool: the task list renders every readable row and flags the refused ones in a compact caution note with a Copy details button producing a paste-ready report (id, reason, and the validation detail naming the offending fields). Document surfaces keep the conservative wholesale notice: an unreadable row can't be attributed to a document, so discovery still fails loud there.
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- 767497c: Tool bands drop their overflow menus — the document chip and the instance lockup are the inline affordances now, each carrying a tooltip ("Open document" / "View workflow") — and instance bands trail a centered hairline rule filling the rest of the band.
|
|
145
|
+
- 767497c: The document view's workflow instance accordion wears the tool's band shell: a discrete chevron toggle, the title lockup, and the trailing hairline, with the instance menu kept at the band's end. One shared CollapsibleBand component now backs both surfaces, so their geometry can't drift.
|
|
146
|
+
- 767497c: Overflow menus render the standard surface wherever they open — the popover no longer inherits a toned host card's background (a group band's transparent tone painted the menu grey). Menus anchor to the trigger's end edge, flipping above only when there's no room below.
|
|
147
|
+
- 767497c: The inline "Document unavailable" face aligns with linked document chips: same padded box, the warning icon in its own text cell, and the chip's gap before the label.
|
|
148
|
+
- 0143226: The Workflows view's instance section header spinner renders at the header lockup's own text scale (size 1) instead of the default size.
|
|
149
|
+
- 767497c: The tool's task rows stay mounted across the committed-facts → live-evaluation transition: one row component renders either source, so a loading popover opened before the instance's evaluation lands resolves in place into the picker instead of closing. The shared activity row now takes a normalized face (title, status, tags) rather than a raw activity evaluation, so any surface can render it from committed facts.
|
|
150
|
+
- 2005ab7: A terminal-action cluster (a row's lone button or "Select action" menu, the dialog footer's inline buttons plus "More actions" menu) shares one in-flight fire lock: while any member fires, the firing button shows loading, the menu trigger and every item disable, and sibling fires drop before reaching the session. Firing from a menu no longer leaves the cluster looking idle (a menu item unmounts when its menu closes, so its own pending state — and its double-fire guard — died with it).
|
|
151
|
+
- 767497c: Per-instance session updates no longer re-render every workflow surface: the provider's live entries move out of the context value into a subscribable store, consumers subscribe per key with identity-stable snapshots, and report bursts coalesce into one trailing flush per fixed window (never extended, so a steady stream of reports still flushes on cadence). Opening the Workflows tool over dozens of instances now settles in seconds instead of tens of seconds of main-thread churn.
|
|
152
|
+
- Updated dependencies [24b11dd]
|
|
153
|
+
- Updated dependencies [2005ab7]
|
|
154
|
+
- Updated dependencies [767497c]
|
|
155
|
+
- Updated dependencies [24b11dd]
|
|
156
|
+
- Updated dependencies [24b11dd]
|
|
157
|
+
- Updated dependencies [59b40fd]
|
|
158
|
+
- @sanity/workflow-engine@0.19.0
|
|
159
|
+
- @sanity/workflow-react@0.14.0
|
|
160
|
+
- @sanity/workflow-studio@0.10.0
|
|
161
|
+
- @sanity/workflow-components@0.2.0
|
|
162
|
+
- @sanity/workflow-diagram@0.4.1
|
|
163
|
+
|
|
3
164
|
## 0.4.0
|
|
4
165
|
|
|
5
166
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ UI: a **workflow strip** above the editor form of mapped documents (the
|
|
|
11
11
|
current stage, your task count, and a **Start workflow** button), and a
|
|
12
12
|
**Workflows tab** next to the editor with the stage's activities and to-dos,
|
|
13
13
|
where they fire actions and read the history, and a **Workflows tool** in the
|
|
14
|
-
Studio navbar —
|
|
15
|
-
and a deep-linkable per-workflow detail view.
|
|
14
|
+
Studio navbar — the open tasks across the newest workflow instances (capped),
|
|
15
|
+
the user's own cut of them, and a deep-linkable per-workflow detail view.
|
|
16
16
|
|
|
17
17
|
Four ideas cover everything in this guide:
|
|
18
18
|
|
|
@@ -33,11 +33,10 @@ treat plugin-side checks as a security boundary.
|
|
|
33
33
|
## 1. Install
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
npm install @sanity/workflow-studio-plugin @sanity/workflow-engine @sanity/workflow-cli
|
|
36
|
+
npm install @sanity/workflow-studio-plugin @sanity/workflow-components @sanity/workflow-diagram @sanity/workflow-engine @sanity/workflow-react @sanity/workflow-sdk @sanity/workflow-studio @sanity/workflow-cli
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
`styled-components ^6`, `@sanity/sdk ^2.12` — the usual studio peers).
|
|
39
|
+
Use one matching version for every `@sanity/workflow-*` package in that command; they publish as a fixed runtime stack. The plugin also requires a Studio v6 project (`sanity ^6`, `react ^19`, `styled-components ^6`, `@sanity/sdk ^2.12` — the usual Studio peers).
|
|
41
40
|
|
|
42
41
|
## 2. Define a workflow
|
|
43
42
|
|
|
@@ -125,100 +124,76 @@ no-op.
|
|
|
125
124
|
|
|
126
125
|
## 4. Wire the studio
|
|
127
126
|
|
|
128
|
-
Add to your `sanity.config.ts
|
|
129
|
-
document types:
|
|
127
|
+
Add to your `sanity.config.ts`:
|
|
130
128
|
|
|
131
129
|
```ts
|
|
132
130
|
import {defineConfig} from 'sanity'
|
|
133
131
|
import {structureTool} from 'sanity/structure'
|
|
134
|
-
import {
|
|
135
|
-
workflowDefaultDocumentNode,
|
|
136
|
-
workflowStudioPlugin,
|
|
137
|
-
type WorkflowMapping,
|
|
138
|
-
} from '@sanity/workflow-studio-plugin'
|
|
139
|
-
|
|
140
|
-
const workflowMappings: readonly WorkflowMapping[] = [
|
|
141
|
-
{
|
|
142
|
-
docType: 'article', // your schema type
|
|
143
|
-
definition: 'article-review', // the deployed definition's `name`
|
|
144
|
-
label: 'Article review',
|
|
145
|
-
},
|
|
146
|
-
]
|
|
132
|
+
import {workflowDefaultDocumentNode, workflowStudioPlugin} from '@sanity/workflow-studio-plugin'
|
|
147
133
|
|
|
148
134
|
export default defineConfig({
|
|
149
135
|
// ...your projectId, dataset, schema...
|
|
150
136
|
plugins: [
|
|
151
137
|
structureTool({
|
|
152
|
-
// Adds the "Workflows" tab next to
|
|
153
|
-
defaultDocumentNode: workflowDefaultDocumentNode(
|
|
138
|
+
// Adds the "Workflows" tab next to document editors.
|
|
139
|
+
defaultDocumentNode: workflowDefaultDocumentNode(),
|
|
154
140
|
}),
|
|
155
141
|
workflowStudioPlugin({
|
|
156
142
|
tag: 'production', // must match the deploy tag
|
|
157
|
-
mappings: workflowMappings,
|
|
158
143
|
}),
|
|
159
144
|
],
|
|
160
145
|
})
|
|
161
146
|
```
|
|
162
147
|
|
|
163
|
-
|
|
148
|
+
The plugin discovers deployed definitions whose caller-provided subject accepts
|
|
149
|
+
a document type in this Studio schema. Start the studio and open an `article`:
|
|
150
|
+
the workflow strip above the form
|
|
164
151
|
offers **Start workflow**. Once started, the strip shows the current
|
|
165
152
|
stage, the document footer shows an **active workflow** chip, and the
|
|
166
153
|
**Workflows** tab lists the stage's activities — click one to open it and
|
|
167
154
|
fire _Submit for review_, then _Approve_, and watch it reach Approved.
|
|
168
155
|
|
|
169
|
-
|
|
156
|
+
Mappings customize discovered subject bindings or explicitly bind definitions
|
|
157
|
+
that use a plain `doc.ref` instead of a first-class subject. Multiple
|
|
158
|
+
definitions for the same `docType` remain separate workflows. A mapping row
|
|
159
|
+
replaces the discovered defaults for its exact `(docType, definition)` pair or
|
|
160
|
+
adds that pair when discovery did not produce it. Duplicate rows for the same
|
|
161
|
+
pair are rejected as configuration errors.
|
|
170
162
|
|
|
171
|
-
|
|
172
|
-
status slot (it defers to the default preview for everything else). Wire it
|
|
173
|
-
per mapped schema type via `components.preview`, and select `_id` in the
|
|
174
|
-
type's `preview` so the component knows which document to look up — a custom
|
|
175
|
-
`prepare` must pass `_id` through:
|
|
163
|
+
### Workflow status in previews
|
|
176
164
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
165
|
+
Editorial Workflows status does not require `components.preview`, a projected
|
|
166
|
+
`_id`, or changes to `preview.select` / `preview.prepare`. Studio already
|
|
167
|
+
supplies document identity to preview middleware, and the plugin uses it while delegating
|
|
168
|
+
the document's title, subtitle, media, and custom preview component unchanged.
|
|
180
169
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
prepare: ({_id, title}) => ({_id, title}),
|
|
190
|
-
},
|
|
191
|
-
components: {preview: WorkflowStagePreview},
|
|
192
|
-
})
|
|
193
|
-
```
|
|
170
|
+
The status pill appears on Studio surfaces that invoke preview middleware,
|
|
171
|
+
including reference and array-item previews. A custom preview component must
|
|
172
|
+
render the `status` prop it receives if it replaces Studio's default layout.
|
|
173
|
+
|
|
174
|
+
Studio's Structure document-list rows bypass plugin preview middleware, so
|
|
175
|
+
those rows do not render workflow stage status. Their native previews remain
|
|
176
|
+
unchanged; workflow status is available in
|
|
177
|
+
the document form, footer badge, and Workflows tab.
|
|
194
178
|
|
|
195
179
|
### Auto-start a workflow on new documents
|
|
196
180
|
|
|
197
|
-
`autoStart` starts a workflow the moment an editor opens a **fresh** document
|
|
181
|
+
`autoStart` on a mapping override starts a workflow the moment an editor opens a **fresh** document
|
|
198
182
|
of a given type — the document is born with its workflow instead of relying on
|
|
199
|
-
someone to press "Start".
|
|
200
|
-
|
|
183
|
+
someone to press "Start". Add one override row for each definition that should
|
|
184
|
+
start automatically:
|
|
201
185
|
|
|
202
186
|
```ts
|
|
203
187
|
workflowStudioPlugin({
|
|
204
188
|
tag: 'production',
|
|
205
189
|
mappings: [
|
|
206
|
-
|
|
190
|
+
{docType: 'article', definition: 'article-review', label: 'Article review', autoStart: true},
|
|
191
|
+
{docType: 'campaign', definition: 'legal-review', label: 'Legal review', autoStart: true},
|
|
192
|
+
{docType: 'campaign', definition: 'brand-review', label: 'Brand review', autoStart: true},
|
|
207
193
|
],
|
|
208
|
-
autoStart: {
|
|
209
|
-
article: 'article-review', // one workflow
|
|
210
|
-
campaign: ['legal-review', 'brand-review'], // several, started together
|
|
211
|
-
},
|
|
212
194
|
})
|
|
213
195
|
```
|
|
214
196
|
|
|
215
|
-
Pass a function instead of a map to vary it by workspace (its name, or the
|
|
216
|
-
schema):
|
|
217
|
-
|
|
218
|
-
```ts
|
|
219
|
-
autoStart: ({workspaceName}) => (workspaceName === 'editorial' ? {article: 'article-review'} : {})
|
|
220
|
-
```
|
|
221
|
-
|
|
222
197
|
How it behaves:
|
|
223
198
|
|
|
224
199
|
- **Fresh only.** Studio doesn't persist a new document until its first edit,
|
|
@@ -246,9 +221,8 @@ How it behaves:
|
|
|
246
221
|
type, undeployed or spawn-only workflow, a subject that doesn't accept the
|
|
247
222
|
type) is dropped with a `console.warn`, never a crash.
|
|
248
223
|
|
|
249
|
-
|
|
250
|
-
from the deployed definition
|
|
251
|
-
same document also carries the workflow strip and views.
|
|
224
|
+
Each auto-start workflow needs a mapping override with `autoStart: true`; its
|
|
225
|
+
inputs still come from the deployed definition.
|
|
252
226
|
|
|
253
227
|
Plugin options, for later: `workflowDataset` (keep workflow state in a
|
|
254
228
|
separate dataset), `effectHandlers` (run effect side-effects in the browser
|