@sanity/workflow-studio-plugin 0.0.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,14 +1,16 @@
1
1
  import type { DefaultDocumentNodeResolver } from "sanity/structure";
2
2
  import { EffectHandler } from "@sanity/workflow-engine";
3
- import { EffectsContext } from "@sanity/workflow-engine";
4
3
  import { GlobalDocumentReference } from "@sanity/workflow-engine";
5
4
  import { InitialFieldValue } from "@sanity/workflow-engine";
6
5
  import { JSX } from "react";
7
6
  import { Plugin as Plugin_2 } from "sanity";
8
7
  import { PreviewProps } from "sanity";
8
+ import { StartContext } from "@sanity/workflow-engine";
9
9
  import type { StructureBuilder } from "sanity/structure";
10
10
  import type { ViewBuilder } from "sanity/structure";
11
11
 
12
+ /** The first mapping row for a document type — the tie-break wherever a
13
+ * surface binds to exactly one row. */
12
14
  export declare function mappingForDocType(
13
15
  mappings: readonly WorkflowMapping[],
14
16
  docType: string,
@@ -43,9 +45,11 @@ export declare interface WorkflowMapping {
43
45
  readonly docType: string;
44
46
  /**
45
47
  * The document type must have a workflow: the editor form is gated until
46
- * an instance references the document. Advisory, UI-only enforcement
47
- * any raw API client can still write; the Content Lake is the only
48
- * enforcement point.
48
+ * an instance references the document. Doctype-level: the flag on ANY
49
+ * mapping row for a docType gates the form, and starting any mapped
50
+ * workflow satisfies the gate. Advisory, UI-only enforcement — any raw
51
+ * API client can still write; the Content Lake is the only enforcement
52
+ * point.
49
53
  */
50
54
  readonly mandatory?: boolean;
51
55
  /** The definition `name` the engine deployed under. */
@@ -61,10 +65,10 @@ export declare interface WorkflowMapping {
61
65
  readonly initialStateBuilder?: (
62
66
  subjectGdr: GlobalDocumentReference,
63
67
  ) => InitialFieldValue[];
64
- /** Optional effectsContext seed. */
65
- readonly effectsContextBuilder?: (
68
+ /** Optional `$context` seed passed to `startInstance` as its `context`. */
69
+ readonly contextBuilder?: (
66
70
  subjectGdr: GlobalDocumentReference,
67
- ) => EffectsContext;
71
+ ) => StartContext;
68
72
  /**
69
73
  * When set, the Start action reads Studio's `usePerspective()` to pull the
70
74
  * active release. If a release is selected, the named `release.ref` field
package/dist/index.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import type { DefaultDocumentNodeResolver } from "sanity/structure";
2
2
  import { EffectHandler } from "@sanity/workflow-engine";
3
- import { EffectsContext } from "@sanity/workflow-engine";
4
3
  import { GlobalDocumentReference } from "@sanity/workflow-engine";
5
4
  import { InitialFieldValue } from "@sanity/workflow-engine";
6
5
  import { JSX } from "react";
7
6
  import { Plugin as Plugin_2 } from "sanity";
8
7
  import { PreviewProps } from "sanity";
8
+ import { StartContext } from "@sanity/workflow-engine";
9
9
  import type { StructureBuilder } from "sanity/structure";
10
10
  import type { ViewBuilder } from "sanity/structure";
11
11
 
12
+ /** The first mapping row for a document type — the tie-break wherever a
13
+ * surface binds to exactly one row. */
12
14
  export declare function mappingForDocType(
13
15
  mappings: readonly WorkflowMapping[],
14
16
  docType: string,
@@ -43,9 +45,11 @@ export declare interface WorkflowMapping {
43
45
  readonly docType: string;
44
46
  /**
45
47
  * The document type must have a workflow: the editor form is gated until
46
- * an instance references the document. Advisory, UI-only enforcement
47
- * any raw API client can still write; the Content Lake is the only
48
- * enforcement point.
48
+ * an instance references the document. Doctype-level: the flag on ANY
49
+ * mapping row for a docType gates the form, and starting any mapped
50
+ * workflow satisfies the gate. Advisory, UI-only enforcement — any raw
51
+ * API client can still write; the Content Lake is the only enforcement
52
+ * point.
49
53
  */
50
54
  readonly mandatory?: boolean;
51
55
  /** The definition `name` the engine deployed under. */
@@ -61,10 +65,10 @@ export declare interface WorkflowMapping {
61
65
  readonly initialStateBuilder?: (
62
66
  subjectGdr: GlobalDocumentReference,
63
67
  ) => InitialFieldValue[];
64
- /** Optional effectsContext seed. */
65
- readonly effectsContextBuilder?: (
68
+ /** Optional `$context` seed passed to `startInstance` as its `context`. */
69
+ readonly contextBuilder?: (
66
70
  subjectGdr: GlobalDocumentReference,
67
- ) => EffectsContext;
71
+ ) => StartContext;
68
72
  /**
69
73
  * When set, the Start action reads Studio's `usePerspective()` to pull the
70
74
  * active release. If a release is selected, the named `release.ref` field