@sanity/workflow-engine 0.17.0 → 0.18.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 +44 -0
- package/DATAMODEL.md +140 -13
- package/README.md +23 -0
- package/dist/_chunks-cjs/invariants.cjs +620 -116
- package/dist/_chunks-es/invariants.js +567 -117
- package/dist/define.cjs +6 -1
- package/dist/define.d.cts +185 -36
- package/dist/define.d.ts +185 -36
- package/dist/define.js +7 -2
- package/dist/index.cjs +852 -392
- package/dist/index.d.cts +746 -198
- package/dist/index.d.ts +746 -198
- package/dist/index.js +752 -330
- package/package.json +1 -1
package/dist/define.cjs
CHANGED
|
@@ -17,11 +17,16 @@ function defineWorkflow(definition) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function defineWorkflowConfig(config) {
|
|
20
|
-
|
|
20
|
+
const parsed = invariants.parseOrThrow({
|
|
21
21
|
schema: invariants.WorkflowConfigSchema,
|
|
22
22
|
input: config,
|
|
23
23
|
label: "defineWorkflowConfig"
|
|
24
24
|
});
|
|
25
|
+
return assertDeploymentAcknowledgements(parsed), parsed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function assertDeploymentAcknowledgements(config) {
|
|
29
|
+
for (const [index, deployment] of config.deployments.entries()) invariants.assertReaderModelAcknowledgement(deployment.expectedMinReaderModel, `Deployment ${deployment.name || `at deployments[${index}]`}`);
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
function defineStage(stage) {
|
package/dist/define.d.cts
CHANGED
|
@@ -4,10 +4,16 @@ declare type Action = ActionFields<Op, string[]> & {
|
|
|
4
4
|
roles?: string[] | undefined;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
declare const ACTION_SEMANTICS: readonly [
|
|
8
|
+
"decision.accept",
|
|
9
|
+
"decision.decline",
|
|
10
|
+
];
|
|
11
|
+
|
|
7
12
|
/** Type-mirror of {@link actionFields}, parameterised over the op and
|
|
8
13
|
* group-membership grammars. */
|
|
9
14
|
declare type ActionFields<TOp, TGroup> = {
|
|
10
15
|
name: string;
|
|
16
|
+
semantics?: ActionSemantic[] | undefined;
|
|
11
17
|
title?: string | undefined;
|
|
12
18
|
description?: string | undefined;
|
|
13
19
|
group?: TGroup | undefined;
|
|
@@ -27,38 +33,135 @@ declare type ActionParam = v.InferOutput<typeof ActionParamSchema>;
|
|
|
27
33
|
* effects: missing required params → ActionParamsInvalidError, action
|
|
28
34
|
* does not commit. Resolved values feed `ValueExpr.param` lookups.
|
|
29
35
|
*/
|
|
30
|
-
declare const ActionParamSchema: v.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
v.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
declare const ActionParamSchema: v.SchemaWithPipe<
|
|
37
|
+
readonly [
|
|
38
|
+
v.StrictObjectSchema<
|
|
39
|
+
{
|
|
40
|
+
readonly type: v.PicklistSchema<
|
|
41
|
+
readonly [
|
|
42
|
+
"string",
|
|
43
|
+
"number",
|
|
44
|
+
"boolean",
|
|
45
|
+
"url",
|
|
46
|
+
"dateTime",
|
|
47
|
+
"actor",
|
|
48
|
+
"doc.ref",
|
|
49
|
+
"doc.refs",
|
|
50
|
+
"json",
|
|
51
|
+
],
|
|
52
|
+
`Invalid option: expected one of ${string}`
|
|
53
|
+
>;
|
|
54
|
+
readonly name: v.SchemaWithPipe<
|
|
55
|
+
readonly [
|
|
56
|
+
v.StringSchema<undefined>,
|
|
57
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
58
|
+
]
|
|
59
|
+
>;
|
|
60
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
61
|
+
readonly description: v.OptionalSchema<
|
|
62
|
+
v.StringSchema<undefined>,
|
|
63
|
+
undefined
|
|
64
|
+
>;
|
|
65
|
+
readonly required: v.OptionalSchema<
|
|
66
|
+
v.BooleanSchema<undefined>,
|
|
67
|
+
undefined
|
|
68
|
+
>;
|
|
69
|
+
readonly options: v.OptionalSchema<
|
|
70
|
+
v.GenericSchema<ChoiceOptions>,
|
|
71
|
+
undefined
|
|
72
|
+
>;
|
|
73
|
+
readonly validation: v.OptionalSchema<
|
|
74
|
+
v.GenericSchema<ScalarValidation>,
|
|
75
|
+
undefined
|
|
76
|
+
>;
|
|
77
|
+
},
|
|
55
78
|
undefined
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
>,
|
|
80
|
+
v.CheckAction<
|
|
81
|
+
{
|
|
82
|
+
type:
|
|
83
|
+
| "string"
|
|
84
|
+
| "number"
|
|
85
|
+
| "boolean"
|
|
86
|
+
| "doc.ref"
|
|
87
|
+
| "doc.refs"
|
|
88
|
+
| "url"
|
|
89
|
+
| "actor"
|
|
90
|
+
| "dateTime"
|
|
91
|
+
| "json";
|
|
92
|
+
name: string;
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
description?: string | undefined;
|
|
95
|
+
required?: boolean | undefined;
|
|
96
|
+
options?: ChoiceOptions | undefined;
|
|
97
|
+
validation?: ScalarValidation | undefined;
|
|
98
|
+
},
|
|
99
|
+
(
|
|
100
|
+
issue: v.CheckIssue<{
|
|
101
|
+
type:
|
|
102
|
+
| "string"
|
|
103
|
+
| "number"
|
|
104
|
+
| "boolean"
|
|
105
|
+
| "doc.ref"
|
|
106
|
+
| "doc.refs"
|
|
107
|
+
| "url"
|
|
108
|
+
| "actor"
|
|
109
|
+
| "dateTime"
|
|
110
|
+
| "json";
|
|
111
|
+
name: string;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
description?: string | undefined;
|
|
114
|
+
required?: boolean | undefined;
|
|
115
|
+
options?: ChoiceOptions | undefined;
|
|
116
|
+
validation?: ScalarValidation | undefined;
|
|
117
|
+
}>,
|
|
118
|
+
) => string
|
|
119
|
+
>,
|
|
120
|
+
v.CheckAction<
|
|
121
|
+
{
|
|
122
|
+
type:
|
|
123
|
+
| "string"
|
|
124
|
+
| "number"
|
|
125
|
+
| "boolean"
|
|
126
|
+
| "doc.ref"
|
|
127
|
+
| "doc.refs"
|
|
128
|
+
| "url"
|
|
129
|
+
| "actor"
|
|
130
|
+
| "dateTime"
|
|
131
|
+
| "json";
|
|
132
|
+
name: string;
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
description?: string | undefined;
|
|
135
|
+
required?: boolean | undefined;
|
|
136
|
+
options?: ChoiceOptions | undefined;
|
|
137
|
+
validation?: ScalarValidation | undefined;
|
|
138
|
+
},
|
|
139
|
+
(
|
|
140
|
+
issue: v.CheckIssue<{
|
|
141
|
+
type:
|
|
142
|
+
| "string"
|
|
143
|
+
| "number"
|
|
144
|
+
| "boolean"
|
|
145
|
+
| "doc.ref"
|
|
146
|
+
| "doc.refs"
|
|
147
|
+
| "url"
|
|
148
|
+
| "actor"
|
|
149
|
+
| "dateTime"
|
|
150
|
+
| "json";
|
|
151
|
+
name: string;
|
|
152
|
+
title?: string | undefined;
|
|
153
|
+
description?: string | undefined;
|
|
154
|
+
required?: boolean | undefined;
|
|
155
|
+
options?: ChoiceOptions | undefined;
|
|
156
|
+
validation?: ScalarValidation | undefined;
|
|
157
|
+
}>,
|
|
158
|
+
) => string
|
|
159
|
+
>,
|
|
160
|
+
]
|
|
60
161
|
>;
|
|
61
162
|
|
|
163
|
+
declare type ActionSemantic = (typeof ACTION_SEMANTICS)[number];
|
|
164
|
+
|
|
62
165
|
declare type Activity = ActivityFields<
|
|
63
166
|
FieldEntry,
|
|
64
167
|
Action,
|
|
@@ -770,6 +873,17 @@ declare type AuthoringWorkflow = WorkflowFields<
|
|
|
770
873
|
AuthoringStartBlock
|
|
771
874
|
>;
|
|
772
875
|
|
|
876
|
+
declare interface ChoiceOption {
|
|
877
|
+
title: string;
|
|
878
|
+
value: ChoiceValue;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
declare interface ChoiceOptions {
|
|
882
|
+
list: ChoiceOption[];
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
declare type ChoiceValue = string | number;
|
|
886
|
+
|
|
773
887
|
/**
|
|
774
888
|
* The action half of the mirrored claim pair. `field` references an
|
|
775
889
|
* author-declared actor-valued entry (the pair's other half), resolved
|
|
@@ -871,6 +985,15 @@ export declare interface ConditionVar {
|
|
|
871
985
|
*/
|
|
872
986
|
export declare type ConditionVarBinding = "always" | "caller" | "spawn";
|
|
873
987
|
|
|
988
|
+
/**
|
|
989
|
+
* The maximum reader floor this writer can emit. Individual documents derive
|
|
990
|
+
* their `minReaderModel` from the compatibility-bearing features actually
|
|
991
|
+
* present; a document written at {@link DATA_MODEL_VERSION} may therefore
|
|
992
|
+
* carry a lower floor. Raising this maximum is a declared, DATAMODEL.md-logged
|
|
993
|
+
* decision that requires readers-first fleet sequencing.
|
|
994
|
+
*/
|
|
995
|
+
declare const DATA_MODEL_MIN_READER = 2;
|
|
996
|
+
|
|
874
997
|
export declare function defineAction(action: AuthoringAction): AuthoringAction;
|
|
875
998
|
|
|
876
999
|
export declare function defineActivity(
|
|
@@ -1028,6 +1151,7 @@ declare const EffectSchema: v.StrictObjectSchema<
|
|
|
1028
1151
|
declare const FIELD_VALUE_KINDS: readonly [
|
|
1029
1152
|
"doc.ref",
|
|
1030
1153
|
"doc.refs",
|
|
1154
|
+
"subject",
|
|
1031
1155
|
"release.ref",
|
|
1032
1156
|
"string",
|
|
1033
1157
|
"text",
|
|
@@ -1064,6 +1188,8 @@ declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
|
|
|
1064
1188
|
TGroup
|
|
1065
1189
|
> & {
|
|
1066
1190
|
type: FieldValueKind;
|
|
1191
|
+
options?: ChoiceOptions | undefined;
|
|
1192
|
+
validation?: ScalarValidation | undefined;
|
|
1067
1193
|
types?: string[] | undefined;
|
|
1068
1194
|
fields?: FieldShape[] | undefined;
|
|
1069
1195
|
of?: FieldShape[] | undefined;
|
|
@@ -1081,6 +1207,8 @@ declare interface FieldShape {
|
|
|
1081
1207
|
name: string;
|
|
1082
1208
|
title?: string | undefined;
|
|
1083
1209
|
description?: string | undefined;
|
|
1210
|
+
options?: ChoiceOptions | undefined;
|
|
1211
|
+
validation?: ScalarValidation | undefined;
|
|
1084
1212
|
fields?: FieldShape[] | undefined;
|
|
1085
1213
|
of?: FieldShape[] | undefined;
|
|
1086
1214
|
}
|
|
@@ -1297,12 +1425,11 @@ declare type NotesField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
|
1297
1425
|
|
|
1298
1426
|
declare type Op = v.InferOutput<typeof StoredOpSchema>;
|
|
1299
1427
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
*/
|
|
1428
|
+
declare type ParsedWorkflowConfig = v.InferOutput<typeof WorkflowConfigSchema>;
|
|
1429
|
+
|
|
1430
|
+
declare type ParsedWorkflowDeployment =
|
|
1431
|
+
ParsedWorkflowConfig["deployments"][number];
|
|
1432
|
+
|
|
1306
1433
|
export declare const RESERVED_CONDITION_VARS: readonly string[];
|
|
1307
1434
|
|
|
1308
1435
|
declare type RoleAliases = v.InferOutput<typeof RoleAliasesSchema>;
|
|
@@ -1362,6 +1489,13 @@ declare const RoleAliasesSchema: v.RecordSchema<
|
|
|
1362
1489
|
undefined
|
|
1363
1490
|
>;
|
|
1364
1491
|
|
|
1492
|
+
/** Inclusive scalar bounds. String/text bounds measure character length;
|
|
1493
|
+
* number bounds measure the numeric value. */
|
|
1494
|
+
declare interface ScalarValidation {
|
|
1495
|
+
min?: number | undefined;
|
|
1496
|
+
max?: number | undefined;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1365
1499
|
declare type Stage = StageFields<
|
|
1366
1500
|
FieldEntry,
|
|
1367
1501
|
Activity,
|
|
@@ -1779,7 +1913,9 @@ declare type ValueExprInternal =
|
|
|
1779
1913
|
|
|
1780
1914
|
declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
|
|
1781
1915
|
|
|
1782
|
-
declare type WorkflowConfig =
|
|
1916
|
+
declare type WorkflowConfig = Omit<ParsedWorkflowConfig, "deployments"> & {
|
|
1917
|
+
deployments: WorkflowDeployment[];
|
|
1918
|
+
};
|
|
1783
1919
|
|
|
1784
1920
|
declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
1785
1921
|
{
|
|
@@ -1794,6 +1930,10 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
1794
1930
|
v.NonEmptyAction<string, "must not be empty">,
|
|
1795
1931
|
]
|
|
1796
1932
|
>;
|
|
1933
|
+
readonly expectedMinReaderModel: v.OptionalSchema<
|
|
1934
|
+
v.CustomSchema<2, undefined>,
|
|
1935
|
+
undefined
|
|
1936
|
+
>;
|
|
1797
1937
|
readonly tag: v.SchemaWithPipe<
|
|
1798
1938
|
readonly [
|
|
1799
1939
|
v.StringSchema<undefined>,
|
|
@@ -2055,6 +2195,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2055
2195
|
v.MinLengthAction<
|
|
2056
2196
|
{
|
|
2057
2197
|
name: string;
|
|
2198
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
2058
2199
|
tag: string;
|
|
2059
2200
|
workflowResource:
|
|
2060
2201
|
| {
|
|
@@ -2115,6 +2256,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2115
2256
|
v.CheckAction<
|
|
2116
2257
|
{
|
|
2117
2258
|
name: string;
|
|
2259
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
2118
2260
|
tag: string;
|
|
2119
2261
|
workflowResource:
|
|
2120
2262
|
| {
|
|
@@ -2213,6 +2355,13 @@ declare const WorkflowDefinitionSchema: v.GenericSchema<
|
|
|
2213
2355
|
WorkflowFields<FieldEntry, Stage, StartBlock>
|
|
2214
2356
|
>;
|
|
2215
2357
|
|
|
2358
|
+
declare type WorkflowDeployment = Omit<
|
|
2359
|
+
ParsedWorkflowDeployment,
|
|
2360
|
+
"expectedMinReaderModel"
|
|
2361
|
+
> & {
|
|
2362
|
+
expectedMinReaderModel: typeof DATA_MODEL_MIN_READER;
|
|
2363
|
+
};
|
|
2364
|
+
|
|
2216
2365
|
/** Type-mirror of {@link workflowFields}, parameterised over field/stage/start. */
|
|
2217
2366
|
declare type WorkflowFields<TField, TStage, TStart> = {
|
|
2218
2367
|
/**
|
package/dist/define.d.ts
CHANGED
|
@@ -4,10 +4,16 @@ declare type Action = ActionFields<Op, string[]> & {
|
|
|
4
4
|
roles?: string[] | undefined;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
declare const ACTION_SEMANTICS: readonly [
|
|
8
|
+
"decision.accept",
|
|
9
|
+
"decision.decline",
|
|
10
|
+
];
|
|
11
|
+
|
|
7
12
|
/** Type-mirror of {@link actionFields}, parameterised over the op and
|
|
8
13
|
* group-membership grammars. */
|
|
9
14
|
declare type ActionFields<TOp, TGroup> = {
|
|
10
15
|
name: string;
|
|
16
|
+
semantics?: ActionSemantic[] | undefined;
|
|
11
17
|
title?: string | undefined;
|
|
12
18
|
description?: string | undefined;
|
|
13
19
|
group?: TGroup | undefined;
|
|
@@ -27,38 +33,135 @@ declare type ActionParam = v.InferOutput<typeof ActionParamSchema>;
|
|
|
27
33
|
* effects: missing required params → ActionParamsInvalidError, action
|
|
28
34
|
* does not commit. Resolved values feed `ValueExpr.param` lookups.
|
|
29
35
|
*/
|
|
30
|
-
declare const ActionParamSchema: v.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
v.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
declare const ActionParamSchema: v.SchemaWithPipe<
|
|
37
|
+
readonly [
|
|
38
|
+
v.StrictObjectSchema<
|
|
39
|
+
{
|
|
40
|
+
readonly type: v.PicklistSchema<
|
|
41
|
+
readonly [
|
|
42
|
+
"string",
|
|
43
|
+
"number",
|
|
44
|
+
"boolean",
|
|
45
|
+
"url",
|
|
46
|
+
"dateTime",
|
|
47
|
+
"actor",
|
|
48
|
+
"doc.ref",
|
|
49
|
+
"doc.refs",
|
|
50
|
+
"json",
|
|
51
|
+
],
|
|
52
|
+
`Invalid option: expected one of ${string}`
|
|
53
|
+
>;
|
|
54
|
+
readonly name: v.SchemaWithPipe<
|
|
55
|
+
readonly [
|
|
56
|
+
v.StringSchema<undefined>,
|
|
57
|
+
v.MinLengthAction<string, 1, "must be a non-empty string">,
|
|
58
|
+
]
|
|
59
|
+
>;
|
|
60
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
61
|
+
readonly description: v.OptionalSchema<
|
|
62
|
+
v.StringSchema<undefined>,
|
|
63
|
+
undefined
|
|
64
|
+
>;
|
|
65
|
+
readonly required: v.OptionalSchema<
|
|
66
|
+
v.BooleanSchema<undefined>,
|
|
67
|
+
undefined
|
|
68
|
+
>;
|
|
69
|
+
readonly options: v.OptionalSchema<
|
|
70
|
+
v.GenericSchema<ChoiceOptions>,
|
|
71
|
+
undefined
|
|
72
|
+
>;
|
|
73
|
+
readonly validation: v.OptionalSchema<
|
|
74
|
+
v.GenericSchema<ScalarValidation>,
|
|
75
|
+
undefined
|
|
76
|
+
>;
|
|
77
|
+
},
|
|
55
78
|
undefined
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
>,
|
|
80
|
+
v.CheckAction<
|
|
81
|
+
{
|
|
82
|
+
type:
|
|
83
|
+
| "string"
|
|
84
|
+
| "number"
|
|
85
|
+
| "boolean"
|
|
86
|
+
| "doc.ref"
|
|
87
|
+
| "doc.refs"
|
|
88
|
+
| "url"
|
|
89
|
+
| "actor"
|
|
90
|
+
| "dateTime"
|
|
91
|
+
| "json";
|
|
92
|
+
name: string;
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
description?: string | undefined;
|
|
95
|
+
required?: boolean | undefined;
|
|
96
|
+
options?: ChoiceOptions | undefined;
|
|
97
|
+
validation?: ScalarValidation | undefined;
|
|
98
|
+
},
|
|
99
|
+
(
|
|
100
|
+
issue: v.CheckIssue<{
|
|
101
|
+
type:
|
|
102
|
+
| "string"
|
|
103
|
+
| "number"
|
|
104
|
+
| "boolean"
|
|
105
|
+
| "doc.ref"
|
|
106
|
+
| "doc.refs"
|
|
107
|
+
| "url"
|
|
108
|
+
| "actor"
|
|
109
|
+
| "dateTime"
|
|
110
|
+
| "json";
|
|
111
|
+
name: string;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
description?: string | undefined;
|
|
114
|
+
required?: boolean | undefined;
|
|
115
|
+
options?: ChoiceOptions | undefined;
|
|
116
|
+
validation?: ScalarValidation | undefined;
|
|
117
|
+
}>,
|
|
118
|
+
) => string
|
|
119
|
+
>,
|
|
120
|
+
v.CheckAction<
|
|
121
|
+
{
|
|
122
|
+
type:
|
|
123
|
+
| "string"
|
|
124
|
+
| "number"
|
|
125
|
+
| "boolean"
|
|
126
|
+
| "doc.ref"
|
|
127
|
+
| "doc.refs"
|
|
128
|
+
| "url"
|
|
129
|
+
| "actor"
|
|
130
|
+
| "dateTime"
|
|
131
|
+
| "json";
|
|
132
|
+
name: string;
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
description?: string | undefined;
|
|
135
|
+
required?: boolean | undefined;
|
|
136
|
+
options?: ChoiceOptions | undefined;
|
|
137
|
+
validation?: ScalarValidation | undefined;
|
|
138
|
+
},
|
|
139
|
+
(
|
|
140
|
+
issue: v.CheckIssue<{
|
|
141
|
+
type:
|
|
142
|
+
| "string"
|
|
143
|
+
| "number"
|
|
144
|
+
| "boolean"
|
|
145
|
+
| "doc.ref"
|
|
146
|
+
| "doc.refs"
|
|
147
|
+
| "url"
|
|
148
|
+
| "actor"
|
|
149
|
+
| "dateTime"
|
|
150
|
+
| "json";
|
|
151
|
+
name: string;
|
|
152
|
+
title?: string | undefined;
|
|
153
|
+
description?: string | undefined;
|
|
154
|
+
required?: boolean | undefined;
|
|
155
|
+
options?: ChoiceOptions | undefined;
|
|
156
|
+
validation?: ScalarValidation | undefined;
|
|
157
|
+
}>,
|
|
158
|
+
) => string
|
|
159
|
+
>,
|
|
160
|
+
]
|
|
60
161
|
>;
|
|
61
162
|
|
|
163
|
+
declare type ActionSemantic = (typeof ACTION_SEMANTICS)[number];
|
|
164
|
+
|
|
62
165
|
declare type Activity = ActivityFields<
|
|
63
166
|
FieldEntry,
|
|
64
167
|
Action,
|
|
@@ -770,6 +873,17 @@ declare type AuthoringWorkflow = WorkflowFields<
|
|
|
770
873
|
AuthoringStartBlock
|
|
771
874
|
>;
|
|
772
875
|
|
|
876
|
+
declare interface ChoiceOption {
|
|
877
|
+
title: string;
|
|
878
|
+
value: ChoiceValue;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
declare interface ChoiceOptions {
|
|
882
|
+
list: ChoiceOption[];
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
declare type ChoiceValue = string | number;
|
|
886
|
+
|
|
773
887
|
/**
|
|
774
888
|
* The action half of the mirrored claim pair. `field` references an
|
|
775
889
|
* author-declared actor-valued entry (the pair's other half), resolved
|
|
@@ -871,6 +985,15 @@ export declare interface ConditionVar {
|
|
|
871
985
|
*/
|
|
872
986
|
export declare type ConditionVarBinding = "always" | "caller" | "spawn";
|
|
873
987
|
|
|
988
|
+
/**
|
|
989
|
+
* The maximum reader floor this writer can emit. Individual documents derive
|
|
990
|
+
* their `minReaderModel` from the compatibility-bearing features actually
|
|
991
|
+
* present; a document written at {@link DATA_MODEL_VERSION} may therefore
|
|
992
|
+
* carry a lower floor. Raising this maximum is a declared, DATAMODEL.md-logged
|
|
993
|
+
* decision that requires readers-first fleet sequencing.
|
|
994
|
+
*/
|
|
995
|
+
declare const DATA_MODEL_MIN_READER = 2;
|
|
996
|
+
|
|
874
997
|
export declare function defineAction(action: AuthoringAction): AuthoringAction;
|
|
875
998
|
|
|
876
999
|
export declare function defineActivity(
|
|
@@ -1028,6 +1151,7 @@ declare const EffectSchema: v.StrictObjectSchema<
|
|
|
1028
1151
|
declare const FIELD_VALUE_KINDS: readonly [
|
|
1029
1152
|
"doc.ref",
|
|
1030
1153
|
"doc.refs",
|
|
1154
|
+
"subject",
|
|
1031
1155
|
"release.ref",
|
|
1032
1156
|
"string",
|
|
1033
1157
|
"text",
|
|
@@ -1064,6 +1188,8 @@ declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
|
|
|
1064
1188
|
TGroup
|
|
1065
1189
|
> & {
|
|
1066
1190
|
type: FieldValueKind;
|
|
1191
|
+
options?: ChoiceOptions | undefined;
|
|
1192
|
+
validation?: ScalarValidation | undefined;
|
|
1067
1193
|
types?: string[] | undefined;
|
|
1068
1194
|
fields?: FieldShape[] | undefined;
|
|
1069
1195
|
of?: FieldShape[] | undefined;
|
|
@@ -1081,6 +1207,8 @@ declare interface FieldShape {
|
|
|
1081
1207
|
name: string;
|
|
1082
1208
|
title?: string | undefined;
|
|
1083
1209
|
description?: string | undefined;
|
|
1210
|
+
options?: ChoiceOptions | undefined;
|
|
1211
|
+
validation?: ScalarValidation | undefined;
|
|
1084
1212
|
fields?: FieldShape[] | undefined;
|
|
1085
1213
|
of?: FieldShape[] | undefined;
|
|
1086
1214
|
}
|
|
@@ -1297,12 +1425,11 @@ declare type NotesField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
|
1297
1425
|
|
|
1298
1426
|
declare type Op = v.InferOutput<typeof StoredOpSchema>;
|
|
1299
1427
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
*/
|
|
1428
|
+
declare type ParsedWorkflowConfig = v.InferOutput<typeof WorkflowConfigSchema>;
|
|
1429
|
+
|
|
1430
|
+
declare type ParsedWorkflowDeployment =
|
|
1431
|
+
ParsedWorkflowConfig["deployments"][number];
|
|
1432
|
+
|
|
1306
1433
|
export declare const RESERVED_CONDITION_VARS: readonly string[];
|
|
1307
1434
|
|
|
1308
1435
|
declare type RoleAliases = v.InferOutput<typeof RoleAliasesSchema>;
|
|
@@ -1362,6 +1489,13 @@ declare const RoleAliasesSchema: v.RecordSchema<
|
|
|
1362
1489
|
undefined
|
|
1363
1490
|
>;
|
|
1364
1491
|
|
|
1492
|
+
/** Inclusive scalar bounds. String/text bounds measure character length;
|
|
1493
|
+
* number bounds measure the numeric value. */
|
|
1494
|
+
declare interface ScalarValidation {
|
|
1495
|
+
min?: number | undefined;
|
|
1496
|
+
max?: number | undefined;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1365
1499
|
declare type Stage = StageFields<
|
|
1366
1500
|
FieldEntry,
|
|
1367
1501
|
Activity,
|
|
@@ -1779,7 +1913,9 @@ declare type ValueExprInternal =
|
|
|
1779
1913
|
|
|
1780
1914
|
declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
|
|
1781
1915
|
|
|
1782
|
-
declare type WorkflowConfig =
|
|
1916
|
+
declare type WorkflowConfig = Omit<ParsedWorkflowConfig, "deployments"> & {
|
|
1917
|
+
deployments: WorkflowDeployment[];
|
|
1918
|
+
};
|
|
1783
1919
|
|
|
1784
1920
|
declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
1785
1921
|
{
|
|
@@ -1794,6 +1930,10 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
1794
1930
|
v.NonEmptyAction<string, "must not be empty">,
|
|
1795
1931
|
]
|
|
1796
1932
|
>;
|
|
1933
|
+
readonly expectedMinReaderModel: v.OptionalSchema<
|
|
1934
|
+
v.CustomSchema<2, undefined>,
|
|
1935
|
+
undefined
|
|
1936
|
+
>;
|
|
1797
1937
|
readonly tag: v.SchemaWithPipe<
|
|
1798
1938
|
readonly [
|
|
1799
1939
|
v.StringSchema<undefined>,
|
|
@@ -2055,6 +2195,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2055
2195
|
v.MinLengthAction<
|
|
2056
2196
|
{
|
|
2057
2197
|
name: string;
|
|
2198
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
2058
2199
|
tag: string;
|
|
2059
2200
|
workflowResource:
|
|
2060
2201
|
| {
|
|
@@ -2115,6 +2256,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
|
|
|
2115
2256
|
v.CheckAction<
|
|
2116
2257
|
{
|
|
2117
2258
|
name: string;
|
|
2259
|
+
expectedMinReaderModel?: 2 | undefined;
|
|
2118
2260
|
tag: string;
|
|
2119
2261
|
workflowResource:
|
|
2120
2262
|
| {
|
|
@@ -2213,6 +2355,13 @@ declare const WorkflowDefinitionSchema: v.GenericSchema<
|
|
|
2213
2355
|
WorkflowFields<FieldEntry, Stage, StartBlock>
|
|
2214
2356
|
>;
|
|
2215
2357
|
|
|
2358
|
+
declare type WorkflowDeployment = Omit<
|
|
2359
|
+
ParsedWorkflowDeployment,
|
|
2360
|
+
"expectedMinReaderModel"
|
|
2361
|
+
> & {
|
|
2362
|
+
expectedMinReaderModel: typeof DATA_MODEL_MIN_READER;
|
|
2363
|
+
};
|
|
2364
|
+
|
|
2216
2365
|
/** Type-mirror of {@link workflowFields}, parameterised over field/stage/start. */
|
|
2217
2366
|
declare type WorkflowFields<TField, TStage, TStart> = {
|
|
2218
2367
|
/**
|
package/dist/define.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseOrThrow, desugarWorkflow, checkWorkflowInvariants, formatValidationError, AuthoringWorkflowSchema, labelFor,
|
|
1
|
+
import { parseOrThrow, desugarWorkflow, checkWorkflowInvariants, formatValidationError, WorkflowConfigSchema, assertReaderModelAcknowledgement, AuthoringWorkflowSchema, labelFor, AuthoringStageSchema, AuthoringActivitySchema, AuthoringActionSchema, AuthoringTransitionSchema, AuthoringFieldEntrySchema, AuthoringOpSchema, GroupSchema, AuthoringGuardSchema, EffectSchema } from "./_chunks-es/invariants.js";
|
|
2
2
|
|
|
3
3
|
import { CONDITION_VARS, FILTER_SCOPE_VARS, GUARD_PREDICATE_VARS, RESERVED_CONDITION_VARS, groq } from "./_chunks-es/invariants.js";
|
|
4
4
|
|
|
@@ -13,11 +13,16 @@ function defineWorkflow(definition) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function defineWorkflowConfig(config) {
|
|
16
|
-
|
|
16
|
+
const parsed = parseOrThrow({
|
|
17
17
|
schema: WorkflowConfigSchema,
|
|
18
18
|
input: config,
|
|
19
19
|
label: "defineWorkflowConfig"
|
|
20
20
|
});
|
|
21
|
+
return assertDeploymentAcknowledgements(parsed), parsed;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function assertDeploymentAcknowledgements(config) {
|
|
25
|
+
for (const [index, deployment] of config.deployments.entries()) assertReaderModelAcknowledgement(deployment.expectedMinReaderModel, `Deployment ${deployment.name || `at deployments[${index}]`}`);
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
function defineStage(stage) {
|