@sanity/workflow-engine 0.13.0 → 0.14.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/README.md +30 -0
- package/dist/_chunks-cjs/schema.cjs +715 -67
- package/dist/_chunks-cjs/schema.cjs.map +1 -1
- package/dist/_chunks-es/schema.js +716 -68
- package/dist/_chunks-es/schema.js.map +1 -1
- package/dist/define.cjs +66 -25
- package/dist/define.cjs.map +1 -1
- package/dist/define.d.cts +867 -71
- package/dist/define.d.ts +867 -71
- package/dist/define.js +67 -25
- package/dist/define.js.map +1 -1
- package/dist/index.cjs +2126 -2169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1630 -517
- package/dist/index.d.ts +1630 -517
- package/dist/index.js +2061 -2104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,36 @@ effects for runtimes to drain.
|
|
|
13
13
|
npm install @sanity/workflow-engine
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
## Fields vs Sanity schema fields
|
|
17
|
+
|
|
18
|
+
A workflow **field** is the engine's state primitive: a typed value a workflow
|
|
19
|
+
instance carries — an assignee, a decision, a due date, a reference to the
|
|
20
|
+
document under review. Fields are declared in `fields: [...]` at workflow,
|
|
21
|
+
stage, or activity scope and live on the workflow **instance** document. They
|
|
22
|
+
are not Sanity schema fields: they never touch your content documents' shape.
|
|
23
|
+
|
|
24
|
+
The authoring DSL deliberately borrows Sanity's schema idiom, so
|
|
25
|
+
`@sanity/workflow-engine/define` exports its own `defineField`. A Studio file
|
|
26
|
+
that also imports `defineField` from `sanity` should alias one of them:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import {defineField as defineWorkflowField} from '@sanity/workflow-engine/define'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The `fields` key itself appears at four nesting levels, meaning something
|
|
33
|
+
different at each — read it by where it sits:
|
|
34
|
+
|
|
35
|
+
1. **Declared field entries** — on a definition's workflow / stage / activity
|
|
36
|
+
nodes: the typed state that scope carries.
|
|
37
|
+
2. **Sub-field shapes** — inside an `object`- or `array`-kind field entry:
|
|
38
|
+
lightweight `{type, name}` shapes for the value's structure, mirroring
|
|
39
|
+
Sanity's `object.fields` / `array.of`.
|
|
40
|
+
3. **Object value expressions** — a `{type: 'object', fields: {...}}` value
|
|
41
|
+
expression in an op or `initialValue`: one expression per key of the
|
|
42
|
+
computed object value.
|
|
43
|
+
4. **Resolved runtime values** — `fields` on a workflow instance document: the
|
|
44
|
+
declared entries with their current values, written by ops and edits.
|
|
45
|
+
|
|
16
46
|
## License
|
|
17
47
|
|
|
18
48
|
[MIT](./LICENSE)
|