@adminiumjs/add-on-contracts 0.3.39 → 0.3.41
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/add-on-block.d.ts +47 -2
- package/dist/add-on-block.d.ts.map +1 -1
- package/dist/add-on-block.js +18 -2
- package/dist/add-on-block.js.map +1 -1
- package/dist/forms/check.d.ts +82 -0
- package/dist/forms/check.d.ts.map +1 -0
- package/dist/forms/check.js +298 -0
- package/dist/forms/check.js.map +1 -0
- package/dist/forms/definition.d.ts +1462 -0
- package/dist/forms/definition.d.ts.map +1 -0
- package/dist/forms/definition.js +451 -0
- package/dist/forms/definition.js.map +1 -0
- package/dist/forms/index.d.ts +18 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +19 -0
- package/dist/forms/index.js.map +1 -0
- package/dist/forms/parse.d.ts +30 -0
- package/dist/forms/parse.d.ts.map +1 -0
- package/dist/forms/parse.js +93 -0
- package/dist/forms/parse.js.map +1 -0
- package/dist/forms/scales.d.ts +34 -0
- package/dist/forms/scales.d.ts.map +1 -0
- package/dist/forms/scales.js +17 -0
- package/dist/forms/scales.js.map +1 -0
- package/dist/forms/settings.d.ts +77 -0
- package/dist/forms/settings.d.ts.map +1 -0
- package/dist/forms/settings.js +68 -0
- package/dist/forms/settings.js.map +1 -0
- package/dist/forms/slug.d.ts +23 -0
- package/dist/forms/slug.d.ts.map +1 -0
- package/dist/forms/slug.js +26 -0
- package/dist/forms/slug.js.map +1 -0
- package/dist/forms/summary.d.ts +60 -0
- package/dist/forms/summary.d.ts.map +1 -0
- package/dist/forms/summary.js +91 -0
- package/dist/forms/summary.js.map +1 -0
- package/dist/forms/websites.d.ts +54 -0
- package/dist/forms/websites.d.ts.map +1 -0
- package/dist/forms/websites.js +97 -0
- package/dist/forms/websites.js.map +1 -0
- package/dist/forms/words.d.ts +49 -0
- package/dist/forms/words.d.ts.map +1 -0
- package/dist/forms/words.js +31 -0
- package/dist/forms/words.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/data-types.d.ts +55 -0
- package/dist/runtime/data-types.d.ts.map +1 -1
- package/dist/runtime/data.d.ts +2 -0
- package/dist/runtime/data.d.ts.map +1 -1
- package/dist/runtime/data.js +2 -0
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/steps.d.ts +150 -5
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +59 -8
- package/dist/steps.js.map +1 -1
- package/package.json +13 -1
package/dist/steps.d.ts
CHANGED
|
@@ -13,9 +13,24 @@
|
|
|
13
13
|
* check against the manifest's `requiredSchema`.
|
|
14
14
|
*/
|
|
15
15
|
import { z } from 'zod';
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* What a person fills in for one input, and how the builder draws it. A
|
|
18
|
+
* `person` (from Adminium 0.3.41) is whose row of a people table the step
|
|
19
|
+
* is about: the rule's record itself when its table holds people, or the
|
|
20
|
+
* person one link of it names ("the job's main contact"). The rule keeps
|
|
21
|
+
* `@record` or `@link:<column>`; the step's values read that person's
|
|
22
|
+
* fields (`{ person, field }`).
|
|
23
|
+
*/
|
|
24
|
+
export declare const ADD_ON_STEP_INPUT_KINDS: readonly ["text", "email", "number", "choice", "record", "person"];
|
|
18
25
|
export type AddOnStepInputKind = (typeof ADD_ON_STEP_INPUT_KINDS)[number];
|
|
26
|
+
/** How a `person` input is kept in a rule: the record itself, or the person one link column of it names. */
|
|
27
|
+
export declare const ADD_ON_STEP_PERSON: RegExp;
|
|
28
|
+
/** A condition a `record` input's rows meet, in the picker and at the run: one column, one value. */
|
|
29
|
+
export declare const addOnStepWhereSchema: z.ZodObject<{
|
|
30
|
+
column: z.ZodString;
|
|
31
|
+
eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type AddOnStepWhere = z.infer<typeof addOnStepWhereSchema>;
|
|
19
34
|
export declare const addOnStepInputSchema: z.ZodObject<{
|
|
20
35
|
key: z.ZodString;
|
|
21
36
|
label: z.ZodObject<{
|
|
@@ -34,8 +49,19 @@ export declare const addOnStepInputSchema: z.ZodObject<{
|
|
|
34
49
|
text: "text";
|
|
35
50
|
email: "email";
|
|
36
51
|
choice: "choice";
|
|
52
|
+
person: "person";
|
|
37
53
|
}>;
|
|
38
54
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
"ar-EG": z.ZodString;
|
|
57
|
+
"cs-CZ": z.ZodString;
|
|
58
|
+
"da-DK": z.ZodString;
|
|
59
|
+
"de-DE": z.ZodString;
|
|
60
|
+
"en-US": z.ZodString;
|
|
61
|
+
"fr-FR": z.ZodString;
|
|
62
|
+
"zh-CN": z.ZodString;
|
|
63
|
+
"zh-TW": z.ZodString;
|
|
64
|
+
}, z.core.$strict>>;
|
|
39
65
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
66
|
value: z.ZodString;
|
|
41
67
|
label: z.ZodObject<{
|
|
@@ -48,13 +74,44 @@ export declare const addOnStepInputSchema: z.ZodObject<{
|
|
|
48
74
|
"zh-CN": z.ZodString;
|
|
49
75
|
"zh-TW": z.ZodString;
|
|
50
76
|
}, z.core.$strict>;
|
|
77
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
"ar-EG": z.ZodString;
|
|
79
|
+
"cs-CZ": z.ZodString;
|
|
80
|
+
"da-DK": z.ZodString;
|
|
81
|
+
"de-DE": z.ZodString;
|
|
82
|
+
"en-US": z.ZodString;
|
|
83
|
+
"fr-FR": z.ZodString;
|
|
84
|
+
"zh-CN": z.ZodString;
|
|
85
|
+
"zh-TW": z.ZodString;
|
|
86
|
+
}, z.core.$strict>>;
|
|
51
87
|
}, z.core.$strict>>>;
|
|
52
88
|
table: z.ZodOptional<z.ZodString>;
|
|
89
|
+
by: z.ZodOptional<z.ZodString>;
|
|
90
|
+
where: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
|
+
column: z.ZodString;
|
|
92
|
+
eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
93
|
+
}, z.core.$strict>>>;
|
|
53
94
|
}, z.core.$strict>;
|
|
54
95
|
export type AddOnStepInput = z.infer<typeof addOnStepInputSchema>;
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
96
|
+
/**
|
|
97
|
+
* What the run's own words a written column may take. `recordTable` and
|
|
98
|
+
* `recordKey` (from Adminium 0.3.41) are the rule's record as rows of other
|
|
99
|
+
* tables name it: its table's stored name (`<app>:<table>`, what an add-on's
|
|
100
|
+
* record tab matches on) and its key as text.
|
|
101
|
+
*/
|
|
102
|
+
export declare const ADD_ON_STEP_TOKENS: readonly ["now", "ruleName", "recordLabel", "recordTable", "recordKey"];
|
|
103
|
+
/**
|
|
104
|
+
* What a `person` input gives a column: their address, name and language
|
|
105
|
+
* (the install's own language where their table keeps none), the name of the
|
|
106
|
+
* company they work for, and their row as the consent log names it (its
|
|
107
|
+
* table and key). The address and the name are personal: they go only into
|
|
108
|
+
* columns the add-on keeps personal.
|
|
109
|
+
*/
|
|
110
|
+
export declare const ADD_ON_STEP_PERSON_FIELDS: readonly ["email", "name", "language", "company", "table", "key"];
|
|
111
|
+
export type AddOnStepPersonField = (typeof ADD_ON_STEP_PERSON_FIELDS)[number];
|
|
112
|
+
/** The person's fields that are personal: written only into columns the add-on keeps personal, and never logged. */
|
|
113
|
+
export declare const ADD_ON_STEP_PERSONAL_FIELDS: readonly AddOnStepPersonField[];
|
|
114
|
+
/** How one column of the written row is filled: from an input, with a fixed text, with one of the run's own words, or with a field of a person input. */
|
|
58
115
|
export declare const addOnStepValueSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
59
116
|
input: z.ZodString;
|
|
60
117
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -64,6 +121,18 @@ export declare const addOnStepValueSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
64
121
|
now: "now";
|
|
65
122
|
ruleName: "ruleName";
|
|
66
123
|
recordLabel: "recordLabel";
|
|
124
|
+
recordTable: "recordTable";
|
|
125
|
+
recordKey: "recordKey";
|
|
126
|
+
}>;
|
|
127
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
128
|
+
person: z.ZodString;
|
|
129
|
+
field: z.ZodEnum<{
|
|
130
|
+
key: "key";
|
|
131
|
+
table: "table";
|
|
132
|
+
email: "email";
|
|
133
|
+
name: "name";
|
|
134
|
+
language: "language";
|
|
135
|
+
company: "company";
|
|
67
136
|
}>;
|
|
68
137
|
}, z.core.$strict>]>;
|
|
69
138
|
export type AddOnStepValue = z.infer<typeof addOnStepValueSchema>;
|
|
@@ -107,8 +176,19 @@ export declare const addOnStepSchema: z.ZodObject<{
|
|
|
107
176
|
text: "text";
|
|
108
177
|
email: "email";
|
|
109
178
|
choice: "choice";
|
|
179
|
+
person: "person";
|
|
110
180
|
}>;
|
|
111
181
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
"ar-EG": z.ZodString;
|
|
184
|
+
"cs-CZ": z.ZodString;
|
|
185
|
+
"da-DK": z.ZodString;
|
|
186
|
+
"de-DE": z.ZodString;
|
|
187
|
+
"en-US": z.ZodString;
|
|
188
|
+
"fr-FR": z.ZodString;
|
|
189
|
+
"zh-CN": z.ZodString;
|
|
190
|
+
"zh-TW": z.ZodString;
|
|
191
|
+
}, z.core.$strict>>;
|
|
112
192
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
113
193
|
value: z.ZodString;
|
|
114
194
|
label: z.ZodObject<{
|
|
@@ -121,8 +201,23 @@ export declare const addOnStepSchema: z.ZodObject<{
|
|
|
121
201
|
"zh-CN": z.ZodString;
|
|
122
202
|
"zh-TW": z.ZodString;
|
|
123
203
|
}, z.core.$strict>;
|
|
204
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
205
|
+
"ar-EG": z.ZodString;
|
|
206
|
+
"cs-CZ": z.ZodString;
|
|
207
|
+
"da-DK": z.ZodString;
|
|
208
|
+
"de-DE": z.ZodString;
|
|
209
|
+
"en-US": z.ZodString;
|
|
210
|
+
"fr-FR": z.ZodString;
|
|
211
|
+
"zh-CN": z.ZodString;
|
|
212
|
+
"zh-TW": z.ZodString;
|
|
213
|
+
}, z.core.$strict>>;
|
|
124
214
|
}, z.core.$strict>>>;
|
|
125
215
|
table: z.ZodOptional<z.ZodString>;
|
|
216
|
+
by: z.ZodOptional<z.ZodString>;
|
|
217
|
+
where: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
218
|
+
column: z.ZodString;
|
|
219
|
+
eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
220
|
+
}, z.core.$strict>>>;
|
|
126
221
|
}, z.core.$strict>>;
|
|
127
222
|
writes: z.ZodObject<{
|
|
128
223
|
table: z.ZodString;
|
|
@@ -135,6 +230,18 @@ export declare const addOnStepSchema: z.ZodObject<{
|
|
|
135
230
|
now: "now";
|
|
136
231
|
ruleName: "ruleName";
|
|
137
232
|
recordLabel: "recordLabel";
|
|
233
|
+
recordTable: "recordTable";
|
|
234
|
+
recordKey: "recordKey";
|
|
235
|
+
}>;
|
|
236
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
237
|
+
person: z.ZodString;
|
|
238
|
+
field: z.ZodEnum<{
|
|
239
|
+
key: "key";
|
|
240
|
+
table: "table";
|
|
241
|
+
email: "email";
|
|
242
|
+
name: "name";
|
|
243
|
+
language: "language";
|
|
244
|
+
company: "company";
|
|
138
245
|
}>;
|
|
139
246
|
}, z.core.$strict>]>>;
|
|
140
247
|
}, z.core.$strict>;
|
|
@@ -180,8 +287,19 @@ export declare const addOnStepsSchema: z.ZodArray<z.ZodObject<{
|
|
|
180
287
|
text: "text";
|
|
181
288
|
email: "email";
|
|
182
289
|
choice: "choice";
|
|
290
|
+
person: "person";
|
|
183
291
|
}>;
|
|
184
292
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
294
|
+
"ar-EG": z.ZodString;
|
|
295
|
+
"cs-CZ": z.ZodString;
|
|
296
|
+
"da-DK": z.ZodString;
|
|
297
|
+
"de-DE": z.ZodString;
|
|
298
|
+
"en-US": z.ZodString;
|
|
299
|
+
"fr-FR": z.ZodString;
|
|
300
|
+
"zh-CN": z.ZodString;
|
|
301
|
+
"zh-TW": z.ZodString;
|
|
302
|
+
}, z.core.$strict>>;
|
|
185
303
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
186
304
|
value: z.ZodString;
|
|
187
305
|
label: z.ZodObject<{
|
|
@@ -194,8 +312,23 @@ export declare const addOnStepsSchema: z.ZodArray<z.ZodObject<{
|
|
|
194
312
|
"zh-CN": z.ZodString;
|
|
195
313
|
"zh-TW": z.ZodString;
|
|
196
314
|
}, z.core.$strict>;
|
|
315
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
"ar-EG": z.ZodString;
|
|
317
|
+
"cs-CZ": z.ZodString;
|
|
318
|
+
"da-DK": z.ZodString;
|
|
319
|
+
"de-DE": z.ZodString;
|
|
320
|
+
"en-US": z.ZodString;
|
|
321
|
+
"fr-FR": z.ZodString;
|
|
322
|
+
"zh-CN": z.ZodString;
|
|
323
|
+
"zh-TW": z.ZodString;
|
|
324
|
+
}, z.core.$strict>>;
|
|
197
325
|
}, z.core.$strict>>>;
|
|
198
326
|
table: z.ZodOptional<z.ZodString>;
|
|
327
|
+
by: z.ZodOptional<z.ZodString>;
|
|
328
|
+
where: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
329
|
+
column: z.ZodString;
|
|
330
|
+
eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
331
|
+
}, z.core.$strict>>>;
|
|
199
332
|
}, z.core.$strict>>;
|
|
200
333
|
writes: z.ZodObject<{
|
|
201
334
|
table: z.ZodString;
|
|
@@ -208,6 +341,18 @@ export declare const addOnStepsSchema: z.ZodArray<z.ZodObject<{
|
|
|
208
341
|
now: "now";
|
|
209
342
|
ruleName: "ruleName";
|
|
210
343
|
recordLabel: "recordLabel";
|
|
344
|
+
recordTable: "recordTable";
|
|
345
|
+
recordKey: "recordKey";
|
|
346
|
+
}>;
|
|
347
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
348
|
+
person: z.ZodString;
|
|
349
|
+
field: z.ZodEnum<{
|
|
350
|
+
key: "key";
|
|
351
|
+
table: "table";
|
|
352
|
+
email: "email";
|
|
353
|
+
name: "name";
|
|
354
|
+
language: "language";
|
|
355
|
+
company: "company";
|
|
211
356
|
}>;
|
|
212
357
|
}, z.core.$strict>]>>;
|
|
213
358
|
}, z.core.$strict>;
|
package/dist/steps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,oEAAqE,CAAC;AAC1G,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB,QAAkD,CAAC;AAElF,qGAAqG;A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
|
24
24
|
const key = z.string().regex(/^[a-z][a-z0-9-]{0,39}$/, 'a key is kebab-case, at most 40 characters');
|
|
25
25
|
/** A table or a column of the add-on's own schema, by its ref. */
|
|
26
26
|
const ref = z.string().regex(/^[a-z][a-z0-9_]{0,62}$/, 'a ref of the add-on\'s own schema');
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* What a person fills in for one input, and how the builder draws it. A
|
|
29
|
+
* `person` (from Adminium 0.3.41) is whose row of a people table the step
|
|
30
|
+
* is about: the rule's record itself when its table holds people, or the
|
|
31
|
+
* person one link of it names ("the job's main contact"). The rule keeps
|
|
32
|
+
* `@record` or `@link:<column>`; the step's values read that person's
|
|
33
|
+
* fields (`{ person, field }`).
|
|
34
|
+
*/
|
|
35
|
+
export const ADD_ON_STEP_INPUT_KINDS = ['text', 'email', 'number', 'choice', 'record', 'person'];
|
|
36
|
+
/** How a `person` input is kept in a rule: the record itself, or the person one link column of it names. */
|
|
37
|
+
export const ADD_ON_STEP_PERSON = /^@record$|^@link:[A-Za-z_][A-Za-z0-9_]{0,62}$/;
|
|
38
|
+
/** A condition a `record` input's rows meet, in the picker and at the run: one column, one value. */
|
|
39
|
+
export const addOnStepWhereSchema = z.object({ column: ref, eq: z.union([z.string().max(60), z.number(), z.boolean()]) }).strict();
|
|
29
40
|
export const addOnStepInputSchema = z
|
|
30
41
|
.object({
|
|
31
42
|
key,
|
|
32
43
|
label: localized(60),
|
|
33
44
|
kind: z.enum(ADD_ON_STEP_INPUT_KINDS),
|
|
34
45
|
required: z.boolean().optional(),
|
|
35
|
-
/**
|
|
36
|
-
|
|
46
|
+
/** One line under the field (from Adminium 0.3.41): "Only live surveys are listed." */
|
|
47
|
+
help: localized(160).optional(),
|
|
48
|
+
/**
|
|
49
|
+
* For `choice`: what may be chosen. With a `help` line on each (from
|
|
50
|
+
* Adminium 0.3.41), the rule editor draws the choice as cards, each with
|
|
51
|
+
* its line under it.
|
|
52
|
+
*/
|
|
53
|
+
options: z.array(z.object({ value: z.string().min(1).max(60), label: localized(60), help: localized(160).optional() }).strict()).min(1).max(20).optional(),
|
|
37
54
|
/** For `record`: the add-on's table a row is picked from; the row's key is what is written. */
|
|
38
55
|
table: ref.optional(),
|
|
56
|
+
/**
|
|
57
|
+
* For `record` (from Adminium 0.3.41): the unique column of that table a
|
|
58
|
+
* rule names the row by, in place of its key: a rule shipped in a
|
|
59
|
+
* manifest names a survey by its slug. The run finds the row by it, and
|
|
60
|
+
* the row's key is still what is written.
|
|
61
|
+
*/
|
|
62
|
+
by: ref.optional(),
|
|
63
|
+
/** For `record` (from Adminium 0.3.41): what a row must hold to be picked, in the editor's list and at the run (only live surveys). */
|
|
64
|
+
where: z.array(addOnStepWhereSchema).min(1).max(3).optional(),
|
|
39
65
|
})
|
|
40
66
|
.strict();
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
67
|
+
/**
|
|
68
|
+
* What the run's own words a written column may take. `recordTable` and
|
|
69
|
+
* `recordKey` (from Adminium 0.3.41) are the rule's record as rows of other
|
|
70
|
+
* tables name it: its table's stored name (`<app>:<table>`, what an add-on's
|
|
71
|
+
* record tab matches on) and its key as text.
|
|
72
|
+
*/
|
|
73
|
+
export const ADD_ON_STEP_TOKENS = ['now', 'ruleName', 'recordLabel', 'recordTable', 'recordKey'];
|
|
74
|
+
/**
|
|
75
|
+
* What a `person` input gives a column: their address, name and language
|
|
76
|
+
* (the install's own language where their table keeps none), the name of the
|
|
77
|
+
* company they work for, and their row as the consent log names it (its
|
|
78
|
+
* table and key). The address and the name are personal: they go only into
|
|
79
|
+
* columns the add-on keeps personal.
|
|
80
|
+
*/
|
|
81
|
+
export const ADD_ON_STEP_PERSON_FIELDS = ['email', 'name', 'language', 'company', 'table', 'key'];
|
|
82
|
+
/** The person's fields that are personal: written only into columns the add-on keeps personal, and never logged. */
|
|
83
|
+
export const ADD_ON_STEP_PERSONAL_FIELDS = ['email', 'name'];
|
|
84
|
+
/** How one column of the written row is filled: from an input, with a fixed text, with one of the run's own words, or with a field of a person input. */
|
|
44
85
|
export const addOnStepValueSchema = z.union([
|
|
45
86
|
z.object({ input: key }).strict(),
|
|
46
87
|
// Plain text only: a `{{…}}` here would read the rule's record with nobody having chosen it.
|
|
47
88
|
z.object({ text: z.string().max(400).regex(/^[^{}]*$/, 'a fixed text holds no braces') }).strict(),
|
|
48
89
|
z.object({ token: z.enum(ADD_ON_STEP_TOKENS) }).strict(),
|
|
90
|
+
z.object({ person: key, field: z.enum(ADD_ON_STEP_PERSON_FIELDS) }).strict(),
|
|
49
91
|
]);
|
|
50
92
|
export const addOnStepSchema = z
|
|
51
93
|
.object({
|
|
@@ -60,7 +102,16 @@ export const addOnStepSchema = z
|
|
|
60
102
|
.strict()
|
|
61
103
|
.refine((step) => new Set(step.inputs.map((input) => input.key)).size === step.inputs.length, { message: 'duplicate input key', path: ['inputs'] })
|
|
62
104
|
.refine((step) => step.inputs.every((input) => (input.kind === 'choice') === (input.options !== undefined)), { message: 'a choice input lists its options, and only a choice does', path: ['inputs'] })
|
|
63
|
-
.refine((step) => step.inputs.every((input) => (input.kind === 'record') === (input.table !== undefined)), { message: 'a record input names its table, and only a record does', path: ['inputs'] })
|
|
105
|
+
.refine((step) => step.inputs.every((input) => (input.kind === 'record') === (input.table !== undefined)), { message: 'a record input names its table, and only a record does', path: ['inputs'] })
|
|
106
|
+
.refine((step) => step.inputs.every((input) => input.kind === 'record' || (input.by === undefined && input.where === undefined)), { message: 'only a record input names a row by a column, or says which rows may be picked', path: ['inputs'] })
|
|
107
|
+
.refine((step) => Object.values(step.writes.values).every((value) => !('person' in value) || step.inputs.some((input) => input.key === value.person && input.kind === 'person')), {
|
|
108
|
+
message: 'a person\'s field is read from one of the step\'s person inputs',
|
|
109
|
+
path: ['writes', 'values'],
|
|
110
|
+
})
|
|
111
|
+
.refine((step) => Object.values(step.writes.values).every((value) => !('input' in value) || step.inputs.find((input) => input.key === value.input)?.kind !== 'person'), {
|
|
112
|
+
message: 'a person input fills columns by its fields ({ person, field }), never as a whole',
|
|
113
|
+
path: ['writes', 'values'],
|
|
114
|
+
});
|
|
64
115
|
export const addOnStepsSchema = z
|
|
65
116
|
.array(addOnStepSchema)
|
|
66
117
|
.min(1)
|
package/dist/steps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAyB,MAAM,sBAAsB,CAAC;AAElF,qFAAqF;AACrF,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,CAAC;SACL,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAA0C,CAAC;SACtI,MAAM,EAAE,CAAC;AACd,CAAC;AAED,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,EAAE,4CAA4C,CAAC,CAAC;AACrG,kEAAkE;AAClE,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,EAAE,mCAAmC,CAAC,CAAC;AAE5F
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAyB,MAAM,sBAAsB,CAAC;AAElF,qFAAqF;AACrF,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,CAAC;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type": "git",
|
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
"types": "./dist/testing/index.d.ts",
|
|
27
27
|
"default": "./dist/testing/index.js"
|
|
28
28
|
},
|
|
29
|
+
"./forms": {
|
|
30
|
+
"types": "./dist/forms/index.d.ts",
|
|
31
|
+
"default": "./dist/forms/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./forms/check": {
|
|
34
|
+
"types": "./dist/forms/check.d.ts",
|
|
35
|
+
"default": "./dist/forms/check.js"
|
|
36
|
+
},
|
|
37
|
+
"./forms/websites": {
|
|
38
|
+
"types": "./dist/forms/websites.d.ts",
|
|
39
|
+
"default": "./dist/forms/websites.js"
|
|
40
|
+
},
|
|
29
41
|
"./runtime": {
|
|
30
42
|
"types": "./dist/runtime/index.d.ts",
|
|
31
43
|
"default": "./dist/runtime/index.js"
|