@sanity/workflow-studio-plugin 0.31.0 → 0.33.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.cjs CHANGED
@@ -6,6 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var index = require("./_chunks-cjs/index.cjs");
8
8
 
9
+ exports.ForMeTable = index.ForMeTable;
10
+
11
+ exports.RunsTable = index.RunsTable;
12
+
13
+ exports.forMeTaskRowsOf = index.forMeTaskRowsOf;
14
+
15
+ exports.runRowsOf = index.runRowsOf;
16
+
9
17
  exports.workflowDefaultDocumentNode = index.workflowDefaultDocumentNode;
10
18
 
11
19
  exports.workflowStudioPlugin = index.workflowStudioPlugin;
package/dist/index.d.cts CHANGED
@@ -1,13 +1,259 @@
1
+ import { ActivityStatus } from "@sanity/workflow-engine";
2
+ import { Assignee } from "@sanity/workflow-engine";
3
+ import { AssignmentIdentity } from "@sanity/workflow-components";
1
4
  import type { DefaultDocumentNodeResolver } from "sanity/structure";
5
+ import { DeployedDefinition } from "@sanity/workflow-engine";
2
6
  import { EffectHandler } from "@sanity/workflow-engine";
3
7
  import { GlobalDocumentReference } from "@sanity/workflow-engine";
4
8
  import { InitialFieldValue } from "@sanity/workflow-engine";
9
+ import { JSX } from "react";
5
10
  import { Plugin as Plugin_2 } from "sanity";
6
11
  import { ResourceClientResolver } from "@sanity/workflow-engine";
12
+ import { RoleAliases } from "@sanity/workflow-engine";
7
13
  import type { SanityClient } from "sanity";
8
14
  import { StartContext } from "@sanity/workflow-engine";
9
15
  import type { StructureBuilder } from "sanity/structure";
10
16
  import type { ViewBuilder } from "sanity/structure";
17
+ import { WorkflowInstancePreview } from "@sanity/workflow-engine";
18
+
19
+ export { AssignmentIdentity };
20
+
21
+ export declare interface ForMeSort {
22
+ readonly key: ForMeSortKey;
23
+ readonly dir: "asc" | "desc";
24
+ }
25
+
26
+ export declare type ForMeSortKey =
27
+ | "document"
28
+ | "due"
29
+ | "opened"
30
+ | "task"
31
+ | "workflow";
32
+
33
+ /** Render within a Studio configured with {@link workflowStudioPlugin}, in a height-constrained vertical scroll container. The host supplies sorted rows and owns selection. */
34
+ export declare function ForMeTable({
35
+ now,
36
+ onNavigateKey,
37
+ onSelect,
38
+ onSort,
39
+ rows,
40
+ selectedId,
41
+ selectedRef,
42
+ sort,
43
+ }: ForMeTableProps): JSX.Element;
44
+
45
+ /** Assigned-task table with Studio document previews, member lookups, and attention hints. */
46
+ export declare interface ForMeTableProps {
47
+ /** Update this clock to refresh relative timestamps. */
48
+ now: Date;
49
+ /** Called for keyboard input on the selected row. The host owns navigation. */
50
+ onNavigateKey: (event: RunNavigationKeyEvent) => void;
51
+ onSelect: (row: ForMeTaskRow) => void;
52
+ /** Reports the requested column; the host applies sorting and updates rows. */
53
+ onSort: (key: ForMeSortKey) => void;
54
+ rows: readonly ForMeTaskRow[];
55
+ /** The selected row becomes the table's roving tab stop. */
56
+ selectedId: string | undefined;
57
+ /** Receives the selected row element for host focus and scrolling. */
58
+ selectedRef: (element: HTMLElement | null) => void;
59
+ sort: ForMeSort;
60
+ }
61
+
62
+ export declare interface ForMeTaskRow {
63
+ readonly id: string;
64
+ readonly instanceId: string;
65
+ readonly activityName: string;
66
+ readonly title: string;
67
+ readonly document: RunRow["document"];
68
+ readonly workflowTitle: string;
69
+ readonly releases: readonly string[];
70
+ readonly openedAt: string;
71
+ readonly due: string | undefined;
72
+ readonly attention: RunAttention | undefined;
73
+ readonly attentionDetail: RunAttentionDetail | undefined;
74
+ /** Everyone the task names, not only the assignment the reader holds it by —
75
+ * the row shows co-assignees, and the role a claimable task sits with. */
76
+ readonly assignees: readonly Assignee[];
77
+ /** How the reader holds this task. A direct assignment outranks a held role. */
78
+ readonly assignment: TaskAssignment;
79
+ }
80
+
81
+ export declare function forMeTaskRowsOf(args: {
82
+ rows: readonly RunRow[];
83
+ who: AssignmentIdentity;
84
+ }): ForMeTaskRow[];
85
+
86
+ /** Attention mark on an open row. Blocked outranks overdue when both apply. */
87
+ export declare type RunAttention = "blocked" | "overdue";
88
+
89
+ /** Why the row shows its attention mark, in the unit its hint is phrased in:
90
+ * the one nameable task or automation, or that several tasks are involved.
91
+ * A bare `blocked` arm means the cause could not be named. */
92
+ export declare type RunAttentionDetail = RunBlockedDetail | RunOverdueDetail;
93
+
94
+ export declare type RunBlockedDetail =
95
+ | {
96
+ readonly kind: "blocked";
97
+ readonly task?: string;
98
+ }
99
+ | {
100
+ readonly kind: "blocked-effect";
101
+ readonly effect: string;
102
+ /** Whether the automation reported a failure — a claimed effect that
103
+ * never reported back is not one. */
104
+ readonly failed: boolean;
105
+ }
106
+ | {
107
+ readonly kind: "blocked-many";
108
+ readonly count: number;
109
+ };
110
+
111
+ export declare interface RunNavigationKeyEvent {
112
+ readonly key: string;
113
+ readonly preventDefault: () => void;
114
+ }
115
+
116
+ /** How late the run is, listed per late task. The mark shows a shared span
117
+ * only when every late task shares that span. */
118
+ export declare interface RunOverdueDetail {
119
+ readonly kind: "overdue";
120
+ /** One passed due date per late task, so the count of late tasks is this
121
+ * list's length. A task with several passed dates contributes the earliest
122
+ * that parses, else a stored value as written. */
123
+ readonly dues: readonly string[];
124
+ /** Set exactly when one task is late — with more, no single title stands
125
+ * for the mark. */
126
+ readonly task: string | undefined;
127
+ }
128
+
129
+ export declare interface RunRow {
130
+ readonly id: string;
131
+ /** The document the run's work belongs to, resolved through its root so a
132
+ * spawned child is attributed to its root's document. Absent when the
133
+ * chain references no document. */
134
+ readonly document: GlobalDocumentReference | undefined;
135
+ readonly workflowName: string;
136
+ readonly workflowTitle: string;
137
+ /** The current stage's machine name — what the stage filter matches; the
138
+ * title beside it is display only. An aborted run keeps the stage it was
139
+ * in when stopped. */
140
+ readonly stage: string;
141
+ readonly stageTitle: string;
142
+ /** The Content Release names the run's perspective pins — a release
143
+ * stack minus its `drafts` tail. Empty for the global modes (raw,
144
+ * published, drafts) and for a run with no perspective at all. */
145
+ readonly releases: readonly string[];
146
+ readonly startedAt: string;
147
+ /** ISO timestamp for when the run settled; absent while it is in flight. */
148
+ readonly endedAt: string | undefined;
149
+ /** Set on closed rows: the terminal stage's title, or Aborted for a run
150
+ * stopped at whatever stage it was in. */
151
+ readonly outcome: string | undefined;
152
+ readonly attention: RunAttention | undefined;
153
+ /** Set exactly when {@link attention} is — which task (or how many) the
154
+ * mark refers to; the glyph's hint is built from it. */
155
+ readonly attentionDetail: RunAttentionDetail | undefined;
156
+ /** Active owners across the open stage's activities after per-activity
157
+ * direct-user shadowing, deduplicated with users before roles. Empty on
158
+ * closed rows — a settled run holds no one's work. */
159
+ readonly assignees: readonly Assignee[];
160
+ /** Assignment values kept at activity grain so shadowing never leaks
161
+ * across two independent tasks in the same run. */
162
+ readonly assignments: readonly (readonly Assignee[])[];
163
+ /** Open plus failed (blocked) human activities in the current stage, in
164
+ * declared order — the Tasks column's grain. Empty on closed rows. */
165
+ readonly tasks: readonly StageTask[];
166
+ /** Open activities counted once by assignment state, including automations
167
+ * because committed state does not carry activity classification. */
168
+ readonly assignmentStateCounts: {
169
+ readonly unrouted: number;
170
+ readonly routed: number;
171
+ readonly held: number;
172
+ };
173
+ }
174
+
175
+ export declare function runRowsOf(args: {
176
+ /** Every preview the read returned, settled ones included — a detached
177
+ * child's root may be settled, and attribution needs it present. */
178
+ previews: readonly WorkflowInstancePreview[];
179
+ /** The deployed catalog by definition name — previews hold no titles, so
180
+ * every display string joins from here; raw names are used for the
181
+ * definitions the catalog lacks. */
182
+ definitions: ReadonlyMap<string, DeployedDefinition>;
183
+ /** The moment overdue is measured against. */
184
+ now: Date;
185
+ }): RunRow[];
186
+
187
+ export declare interface RunSort {
188
+ readonly key: RunSortKey;
189
+ readonly dir: "asc" | "desc";
190
+ }
191
+
192
+ export declare type RunSortKey =
193
+ | "document"
194
+ | "workflow"
195
+ | "stage"
196
+ | "outcome"
197
+ | "started"
198
+ | "ended";
199
+
200
+ /** The table's two lifecycle cuts — a row belongs to exactly one. */
201
+ export declare type RunsScope = "open" | "closed";
202
+
203
+ /** Render within a Studio configured with {@link workflowStudioPlugin}, in a height-constrained vertical scroll container. The host supplies sorted rows and owns selection. */
204
+ export declare function RunsTable({
205
+ now,
206
+ onNavigateKey,
207
+ onSelectRun,
208
+ onSort,
209
+ rows,
210
+ scope,
211
+ scopedToWorkflow,
212
+ selectedId,
213
+ selectedRef,
214
+ sort,
215
+ }: RunsTableProps): JSX.Element;
216
+
217
+ /** Overview table with Studio document previews, assignee faces, and task hints. */
218
+ export declare interface RunsTableProps {
219
+ /** Update this clock to refresh relative timestamps. */
220
+ now: Date;
221
+ /** Called for keyboard input on the selected row. The host owns navigation. */
222
+ onNavigateKey: (event: RunNavigationKeyEvent) => void;
223
+ onSelectRun: (row: RunRow) => void;
224
+ /** Reports the requested column; the host applies sorting and updates rows. */
225
+ onSort: (key: RunSortKey) => void;
226
+ rows: readonly RunRow[];
227
+ scope: RunsScope;
228
+ /** Hides the workflow column when the host filters every row to one workflow. */
229
+ scopedToWorkflow: boolean;
230
+ /** The selected row becomes the table's roving tab stop. */
231
+ selectedId: string | undefined;
232
+ /** Receives the selected row element for host focus and scrolling. */
233
+ selectedRef: (element: HTMLElement | null) => void;
234
+ sort: RunSort;
235
+ }
236
+
237
+ export declare interface StageTask {
238
+ readonly name: string;
239
+ readonly title: string;
240
+ readonly assignees: readonly Assignee[];
241
+ /** Alias context from the run's pinned definition. */
242
+ readonly roleAliases: RoleAliases | undefined;
243
+ /** When the task's current stage opened. */
244
+ readonly openedAt: string;
245
+ /** The earliest due date on the task, whether or not it has passed. */
246
+ readonly due: string | undefined;
247
+ /** A passed due date on the task, set exactly while it is late — the
248
+ * earliest that parses, else the stored value as written. */
249
+ readonly overdueSince: string | undefined;
250
+ readonly status: ActivityStatus;
251
+ }
252
+
253
+ export declare type TaskAssignment = Exclude<TaskHolding, "other">;
254
+
255
+ /** Whether the current person holds a task directly, through a role, or does not hold it. */
256
+ export declare type TaskHolding = "you" | "role" | "other";
11
257
 
12
258
  /**
13
259
  * Convenience `defaultDocumentNode`: every content-document type gets the
@@ -21,24 +267,32 @@ import type { ViewBuilder } from "sanity/structure";
21
267
  export declare function workflowDefaultDocumentNode(): DefaultDocumentNodeResolver;
22
268
 
23
269
  /**
24
- * Studio-specific behavior for one `(docType, definition)` binding. A row may
25
- * customize an automatically discovered subject binding or explicitly bind a
26
- * definition modeled with a plain `doc.ref`.
270
+ * Binds one Studio document type to one deployed definition. A row replaces
271
+ * the discovered binding for its `(docType, definition)` pair or adds that
272
+ * pair when discovery found none. Multiple definitions may share a document
273
+ * type; duplicate pairs throw during plugin configuration.
27
274
  */
28
275
  export declare interface WorkflowMapping {
29
276
  /** Studio schema type. */
30
277
  readonly docType: string;
31
278
  /** The definition `name` the engine deployed under. */
32
279
  readonly definition: string;
33
- /** Human-readable label for menus and dialogs. */
280
+ /** Menu and dialog label. Discovered rows use the definition's title, falling back to its name. */
34
281
  readonly label: string;
35
- /** Start this workflow when a fresh document of {@link docType} is created. */
282
+ /**
283
+ * Start this workflow when a fresh document of {@link docType} is created
284
+ * in Studio. Defaults to `false`; existing documents and writes outside
285
+ * Studio do not trigger it. Requires an input-sourced document subject.
286
+ */
36
287
  readonly autoStart?: boolean;
37
- /** Optional initial workflow field entries to seed on Start. */
288
+ /**
289
+ * Initial workflow field entries for a manual start. Replaces the default
290
+ * subject seed; returning `[]` omits that seed. Not used by {@link autoStart}.
291
+ */
38
292
  readonly initialStateBuilder?: (
39
293
  subjectGdr: GlobalDocumentReference,
40
294
  ) => InitialFieldValue[];
41
- /** Optional `$context` seed passed to `startInstance` as its `context`. */
295
+ /** Initial `$context` for a manual start. Not used by {@link autoStart}. */
42
296
  readonly contextBuilder?: (
43
297
  subjectGdr: GlobalDocumentReference,
44
298
  ) => StartContext;
@@ -69,9 +323,12 @@ export declare interface WorkflowPluginConfig {
69
323
  * workspace's own dataset (single-dataset setup). */
70
324
  readonly workflowDataset?: string;
71
325
  /**
72
- * Studio-specific bindings. Rows customize discovered first-class subjects
73
- * or explicitly register definitions that use the `doc.ref` subject
74
- * convention.
326
+ * Overrides for automatically discovered bindings. Discovery uses each
327
+ * definition's latest deployed version and includes only startable workflows
328
+ * whose input-sourced `subject` accepts a Studio schema document type.
329
+ * System types, including the `sanity.` namespace, assets, and engine-owned
330
+ * types, require an explicit row. Use a row to bind a plain `doc.ref`
331
+ * subject. Omit to use discovery without overrides.
75
332
  */
76
333
  readonly mappings?: readonly WorkflowMapping[];
77
334
  /**
@@ -91,13 +348,14 @@ export declare interface WorkflowPluginConfig {
91
348
  */
92
349
  readonly resourceClients?: ResourceClientResolver;
93
350
  /**
94
- * Tuning for the Workflows tool's progressive run hydration page size,
95
- * and a development-only pause between pages for watching the hydration
96
- * land. Defaults suit production; set these in a dev harness to simulate
97
- * small pages and slow reads.
351
+ * Controls progressive loading of run previews in the Workflows tool.
352
+ * Leave unset for production defaults; override to test smaller pages or
353
+ * slower loading in a development harness.
98
354
  */
99
355
  readonly previewHydration?: {
356
+ /** Pause between pages, in milliseconds. Defaults to `0`. */
100
357
  readonly interPageDelayMs?: number;
358
+ /** Number of run previews requested per page. Defaults to `500`. */
101
359
  readonly pageSize?: number;
102
360
  };
103
361
  }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,259 @@
1
+ import { ActivityStatus } from "@sanity/workflow-engine";
2
+ import { Assignee } from "@sanity/workflow-engine";
3
+ import { AssignmentIdentity } from "@sanity/workflow-components";
1
4
  import type { DefaultDocumentNodeResolver } from "sanity/structure";
5
+ import { DeployedDefinition } from "@sanity/workflow-engine";
2
6
  import { EffectHandler } from "@sanity/workflow-engine";
3
7
  import { GlobalDocumentReference } from "@sanity/workflow-engine";
4
8
  import { InitialFieldValue } from "@sanity/workflow-engine";
9
+ import { JSX } from "react";
5
10
  import { Plugin as Plugin_2 } from "sanity";
6
11
  import { ResourceClientResolver } from "@sanity/workflow-engine";
12
+ import { RoleAliases } from "@sanity/workflow-engine";
7
13
  import type { SanityClient } from "sanity";
8
14
  import { StartContext } from "@sanity/workflow-engine";
9
15
  import type { StructureBuilder } from "sanity/structure";
10
16
  import type { ViewBuilder } from "sanity/structure";
17
+ import { WorkflowInstancePreview } from "@sanity/workflow-engine";
18
+
19
+ export { AssignmentIdentity };
20
+
21
+ export declare interface ForMeSort {
22
+ readonly key: ForMeSortKey;
23
+ readonly dir: "asc" | "desc";
24
+ }
25
+
26
+ export declare type ForMeSortKey =
27
+ | "document"
28
+ | "due"
29
+ | "opened"
30
+ | "task"
31
+ | "workflow";
32
+
33
+ /** Render within a Studio configured with {@link workflowStudioPlugin}, in a height-constrained vertical scroll container. The host supplies sorted rows and owns selection. */
34
+ export declare function ForMeTable({
35
+ now,
36
+ onNavigateKey,
37
+ onSelect,
38
+ onSort,
39
+ rows,
40
+ selectedId,
41
+ selectedRef,
42
+ sort,
43
+ }: ForMeTableProps): JSX.Element;
44
+
45
+ /** Assigned-task table with Studio document previews, member lookups, and attention hints. */
46
+ export declare interface ForMeTableProps {
47
+ /** Update this clock to refresh relative timestamps. */
48
+ now: Date;
49
+ /** Called for keyboard input on the selected row. The host owns navigation. */
50
+ onNavigateKey: (event: RunNavigationKeyEvent) => void;
51
+ onSelect: (row: ForMeTaskRow) => void;
52
+ /** Reports the requested column; the host applies sorting and updates rows. */
53
+ onSort: (key: ForMeSortKey) => void;
54
+ rows: readonly ForMeTaskRow[];
55
+ /** The selected row becomes the table's roving tab stop. */
56
+ selectedId: string | undefined;
57
+ /** Receives the selected row element for host focus and scrolling. */
58
+ selectedRef: (element: HTMLElement | null) => void;
59
+ sort: ForMeSort;
60
+ }
61
+
62
+ export declare interface ForMeTaskRow {
63
+ readonly id: string;
64
+ readonly instanceId: string;
65
+ readonly activityName: string;
66
+ readonly title: string;
67
+ readonly document: RunRow["document"];
68
+ readonly workflowTitle: string;
69
+ readonly releases: readonly string[];
70
+ readonly openedAt: string;
71
+ readonly due: string | undefined;
72
+ readonly attention: RunAttention | undefined;
73
+ readonly attentionDetail: RunAttentionDetail | undefined;
74
+ /** Everyone the task names, not only the assignment the reader holds it by —
75
+ * the row shows co-assignees, and the role a claimable task sits with. */
76
+ readonly assignees: readonly Assignee[];
77
+ /** How the reader holds this task. A direct assignment outranks a held role. */
78
+ readonly assignment: TaskAssignment;
79
+ }
80
+
81
+ export declare function forMeTaskRowsOf(args: {
82
+ rows: readonly RunRow[];
83
+ who: AssignmentIdentity;
84
+ }): ForMeTaskRow[];
85
+
86
+ /** Attention mark on an open row. Blocked outranks overdue when both apply. */
87
+ export declare type RunAttention = "blocked" | "overdue";
88
+
89
+ /** Why the row shows its attention mark, in the unit its hint is phrased in:
90
+ * the one nameable task or automation, or that several tasks are involved.
91
+ * A bare `blocked` arm means the cause could not be named. */
92
+ export declare type RunAttentionDetail = RunBlockedDetail | RunOverdueDetail;
93
+
94
+ export declare type RunBlockedDetail =
95
+ | {
96
+ readonly kind: "blocked";
97
+ readonly task?: string;
98
+ }
99
+ | {
100
+ readonly kind: "blocked-effect";
101
+ readonly effect: string;
102
+ /** Whether the automation reported a failure — a claimed effect that
103
+ * never reported back is not one. */
104
+ readonly failed: boolean;
105
+ }
106
+ | {
107
+ readonly kind: "blocked-many";
108
+ readonly count: number;
109
+ };
110
+
111
+ export declare interface RunNavigationKeyEvent {
112
+ readonly key: string;
113
+ readonly preventDefault: () => void;
114
+ }
115
+
116
+ /** How late the run is, listed per late task. The mark shows a shared span
117
+ * only when every late task shares that span. */
118
+ export declare interface RunOverdueDetail {
119
+ readonly kind: "overdue";
120
+ /** One passed due date per late task, so the count of late tasks is this
121
+ * list's length. A task with several passed dates contributes the earliest
122
+ * that parses, else a stored value as written. */
123
+ readonly dues: readonly string[];
124
+ /** Set exactly when one task is late — with more, no single title stands
125
+ * for the mark. */
126
+ readonly task: string | undefined;
127
+ }
128
+
129
+ export declare interface RunRow {
130
+ readonly id: string;
131
+ /** The document the run's work belongs to, resolved through its root so a
132
+ * spawned child is attributed to its root's document. Absent when the
133
+ * chain references no document. */
134
+ readonly document: GlobalDocumentReference | undefined;
135
+ readonly workflowName: string;
136
+ readonly workflowTitle: string;
137
+ /** The current stage's machine name — what the stage filter matches; the
138
+ * title beside it is display only. An aborted run keeps the stage it was
139
+ * in when stopped. */
140
+ readonly stage: string;
141
+ readonly stageTitle: string;
142
+ /** The Content Release names the run's perspective pins — a release
143
+ * stack minus its `drafts` tail. Empty for the global modes (raw,
144
+ * published, drafts) and for a run with no perspective at all. */
145
+ readonly releases: readonly string[];
146
+ readonly startedAt: string;
147
+ /** ISO timestamp for when the run settled; absent while it is in flight. */
148
+ readonly endedAt: string | undefined;
149
+ /** Set on closed rows: the terminal stage's title, or Aborted for a run
150
+ * stopped at whatever stage it was in. */
151
+ readonly outcome: string | undefined;
152
+ readonly attention: RunAttention | undefined;
153
+ /** Set exactly when {@link attention} is — which task (or how many) the
154
+ * mark refers to; the glyph's hint is built from it. */
155
+ readonly attentionDetail: RunAttentionDetail | undefined;
156
+ /** Active owners across the open stage's activities after per-activity
157
+ * direct-user shadowing, deduplicated with users before roles. Empty on
158
+ * closed rows — a settled run holds no one's work. */
159
+ readonly assignees: readonly Assignee[];
160
+ /** Assignment values kept at activity grain so shadowing never leaks
161
+ * across two independent tasks in the same run. */
162
+ readonly assignments: readonly (readonly Assignee[])[];
163
+ /** Open plus failed (blocked) human activities in the current stage, in
164
+ * declared order — the Tasks column's grain. Empty on closed rows. */
165
+ readonly tasks: readonly StageTask[];
166
+ /** Open activities counted once by assignment state, including automations
167
+ * because committed state does not carry activity classification. */
168
+ readonly assignmentStateCounts: {
169
+ readonly unrouted: number;
170
+ readonly routed: number;
171
+ readonly held: number;
172
+ };
173
+ }
174
+
175
+ export declare function runRowsOf(args: {
176
+ /** Every preview the read returned, settled ones included — a detached
177
+ * child's root may be settled, and attribution needs it present. */
178
+ previews: readonly WorkflowInstancePreview[];
179
+ /** The deployed catalog by definition name — previews hold no titles, so
180
+ * every display string joins from here; raw names are used for the
181
+ * definitions the catalog lacks. */
182
+ definitions: ReadonlyMap<string, DeployedDefinition>;
183
+ /** The moment overdue is measured against. */
184
+ now: Date;
185
+ }): RunRow[];
186
+
187
+ export declare interface RunSort {
188
+ readonly key: RunSortKey;
189
+ readonly dir: "asc" | "desc";
190
+ }
191
+
192
+ export declare type RunSortKey =
193
+ | "document"
194
+ | "workflow"
195
+ | "stage"
196
+ | "outcome"
197
+ | "started"
198
+ | "ended";
199
+
200
+ /** The table's two lifecycle cuts — a row belongs to exactly one. */
201
+ export declare type RunsScope = "open" | "closed";
202
+
203
+ /** Render within a Studio configured with {@link workflowStudioPlugin}, in a height-constrained vertical scroll container. The host supplies sorted rows and owns selection. */
204
+ export declare function RunsTable({
205
+ now,
206
+ onNavigateKey,
207
+ onSelectRun,
208
+ onSort,
209
+ rows,
210
+ scope,
211
+ scopedToWorkflow,
212
+ selectedId,
213
+ selectedRef,
214
+ sort,
215
+ }: RunsTableProps): JSX.Element;
216
+
217
+ /** Overview table with Studio document previews, assignee faces, and task hints. */
218
+ export declare interface RunsTableProps {
219
+ /** Update this clock to refresh relative timestamps. */
220
+ now: Date;
221
+ /** Called for keyboard input on the selected row. The host owns navigation. */
222
+ onNavigateKey: (event: RunNavigationKeyEvent) => void;
223
+ onSelectRun: (row: RunRow) => void;
224
+ /** Reports the requested column; the host applies sorting and updates rows. */
225
+ onSort: (key: RunSortKey) => void;
226
+ rows: readonly RunRow[];
227
+ scope: RunsScope;
228
+ /** Hides the workflow column when the host filters every row to one workflow. */
229
+ scopedToWorkflow: boolean;
230
+ /** The selected row becomes the table's roving tab stop. */
231
+ selectedId: string | undefined;
232
+ /** Receives the selected row element for host focus and scrolling. */
233
+ selectedRef: (element: HTMLElement | null) => void;
234
+ sort: RunSort;
235
+ }
236
+
237
+ export declare interface StageTask {
238
+ readonly name: string;
239
+ readonly title: string;
240
+ readonly assignees: readonly Assignee[];
241
+ /** Alias context from the run's pinned definition. */
242
+ readonly roleAliases: RoleAliases | undefined;
243
+ /** When the task's current stage opened. */
244
+ readonly openedAt: string;
245
+ /** The earliest due date on the task, whether or not it has passed. */
246
+ readonly due: string | undefined;
247
+ /** A passed due date on the task, set exactly while it is late — the
248
+ * earliest that parses, else the stored value as written. */
249
+ readonly overdueSince: string | undefined;
250
+ readonly status: ActivityStatus;
251
+ }
252
+
253
+ export declare type TaskAssignment = Exclude<TaskHolding, "other">;
254
+
255
+ /** Whether the current person holds a task directly, through a role, or does not hold it. */
256
+ export declare type TaskHolding = "you" | "role" | "other";
11
257
 
12
258
  /**
13
259
  * Convenience `defaultDocumentNode`: every content-document type gets the
@@ -21,24 +267,32 @@ import type { ViewBuilder } from "sanity/structure";
21
267
  export declare function workflowDefaultDocumentNode(): DefaultDocumentNodeResolver;
22
268
 
23
269
  /**
24
- * Studio-specific behavior for one `(docType, definition)` binding. A row may
25
- * customize an automatically discovered subject binding or explicitly bind a
26
- * definition modeled with a plain `doc.ref`.
270
+ * Binds one Studio document type to one deployed definition. A row replaces
271
+ * the discovered binding for its `(docType, definition)` pair or adds that
272
+ * pair when discovery found none. Multiple definitions may share a document
273
+ * type; duplicate pairs throw during plugin configuration.
27
274
  */
28
275
  export declare interface WorkflowMapping {
29
276
  /** Studio schema type. */
30
277
  readonly docType: string;
31
278
  /** The definition `name` the engine deployed under. */
32
279
  readonly definition: string;
33
- /** Human-readable label for menus and dialogs. */
280
+ /** Menu and dialog label. Discovered rows use the definition's title, falling back to its name. */
34
281
  readonly label: string;
35
- /** Start this workflow when a fresh document of {@link docType} is created. */
282
+ /**
283
+ * Start this workflow when a fresh document of {@link docType} is created
284
+ * in Studio. Defaults to `false`; existing documents and writes outside
285
+ * Studio do not trigger it. Requires an input-sourced document subject.
286
+ */
36
287
  readonly autoStart?: boolean;
37
- /** Optional initial workflow field entries to seed on Start. */
288
+ /**
289
+ * Initial workflow field entries for a manual start. Replaces the default
290
+ * subject seed; returning `[]` omits that seed. Not used by {@link autoStart}.
291
+ */
38
292
  readonly initialStateBuilder?: (
39
293
  subjectGdr: GlobalDocumentReference,
40
294
  ) => InitialFieldValue[];
41
- /** Optional `$context` seed passed to `startInstance` as its `context`. */
295
+ /** Initial `$context` for a manual start. Not used by {@link autoStart}. */
42
296
  readonly contextBuilder?: (
43
297
  subjectGdr: GlobalDocumentReference,
44
298
  ) => StartContext;
@@ -69,9 +323,12 @@ export declare interface WorkflowPluginConfig {
69
323
  * workspace's own dataset (single-dataset setup). */
70
324
  readonly workflowDataset?: string;
71
325
  /**
72
- * Studio-specific bindings. Rows customize discovered first-class subjects
73
- * or explicitly register definitions that use the `doc.ref` subject
74
- * convention.
326
+ * Overrides for automatically discovered bindings. Discovery uses each
327
+ * definition's latest deployed version and includes only startable workflows
328
+ * whose input-sourced `subject` accepts a Studio schema document type.
329
+ * System types, including the `sanity.` namespace, assets, and engine-owned
330
+ * types, require an explicit row. Use a row to bind a plain `doc.ref`
331
+ * subject. Omit to use discovery without overrides.
75
332
  */
76
333
  readonly mappings?: readonly WorkflowMapping[];
77
334
  /**
@@ -91,13 +348,14 @@ export declare interface WorkflowPluginConfig {
91
348
  */
92
349
  readonly resourceClients?: ResourceClientResolver;
93
350
  /**
94
- * Tuning for the Workflows tool's progressive run hydration page size,
95
- * and a development-only pause between pages for watching the hydration
96
- * land. Defaults suit production; set these in a dev harness to simulate
97
- * small pages and slow reads.
351
+ * Controls progressive loading of run previews in the Workflows tool.
352
+ * Leave unset for production defaults; override to test smaller pages or
353
+ * slower loading in a development harness.
98
354
  */
99
355
  readonly previewHydration?: {
356
+ /** Pause between pages, in milliseconds. Defaults to `0`. */
100
357
  readonly interPageDelayMs?: number;
358
+ /** Number of run previews requested per page. Defaults to `500`. */
101
359
  readonly pageSize?: number;
102
360
  };
103
361
  }