@openframe-org/criteria-set-protocol 1.4.9 → 1.5.1

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.
@@ -0,0 +1,400 @@
1
+ import { z } from 'zod';
2
+ export declare const taskSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"task">;
4
+ title: z.ZodString;
5
+ code: z.ZodString;
6
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
+ documentation: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
8
+ type: z.ZodLiteral<"pdf">;
9
+ label: z.ZodString;
10
+ url: z.ZodString;
11
+ text: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ type: "pdf";
14
+ url: string;
15
+ label: string;
16
+ text: string;
17
+ }, {
18
+ type: "pdf";
19
+ url: string;
20
+ label: string;
21
+ text: string;
22
+ }>, z.ZodObject<{
23
+ type: z.ZodLiteral<"text">;
24
+ label: z.ZodString;
25
+ text: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ type: "text";
28
+ label: string;
29
+ text: string;
30
+ }, {
31
+ type: "text";
32
+ label: string;
33
+ text: string;
34
+ }>, z.ZodObject<{
35
+ type: z.ZodLiteral<"link">;
36
+ label: z.ZodString;
37
+ url: z.ZodString;
38
+ text: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ type: "link";
41
+ url: string;
42
+ label: string;
43
+ text: string;
44
+ }, {
45
+ type: "link";
46
+ url: string;
47
+ label: string;
48
+ text: string;
49
+ }>]>, "many">>;
50
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
51
+ sortOrder: z.ZodOptional<z.ZodNumber>;
52
+ description: z.ZodOptional<z.ZodString>;
53
+ items: z.ZodArray<z.ZodObject<{
54
+ type: z.ZodLiteral<"task-item">;
55
+ code: z.ZodString;
56
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ documentation: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
58
+ type: z.ZodLiteral<"pdf">;
59
+ label: z.ZodString;
60
+ url: z.ZodString;
61
+ text: z.ZodString;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: "pdf";
64
+ url: string;
65
+ label: string;
66
+ text: string;
67
+ }, {
68
+ type: "pdf";
69
+ url: string;
70
+ label: string;
71
+ text: string;
72
+ }>, z.ZodObject<{
73
+ type: z.ZodLiteral<"text">;
74
+ label: z.ZodString;
75
+ text: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ type: "text";
78
+ label: string;
79
+ text: string;
80
+ }, {
81
+ type: "text";
82
+ label: string;
83
+ text: string;
84
+ }>, z.ZodObject<{
85
+ type: z.ZodLiteral<"link">;
86
+ label: z.ZodString;
87
+ url: z.ZodString;
88
+ text: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "link";
91
+ url: string;
92
+ label: string;
93
+ text: string;
94
+ }, {
95
+ type: "link";
96
+ url: string;
97
+ label: string;
98
+ text: string;
99
+ }>]>, "many">>;
100
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
101
+ sortOrder: z.ZodOptional<z.ZodNumber>;
102
+ definition: z.ZodUnion<[z.ZodObject<{
103
+ type: z.ZodLiteral<"select-single">;
104
+ options: z.ZodArray<z.ZodObject<{
105
+ id: z.ZodOptional<z.ZodString>;
106
+ text: z.ZodString;
107
+ intro: z.ZodOptional<z.ZodString>;
108
+ outro: z.ZodOptional<z.ZodString>;
109
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ value: string | number | boolean | null;
112
+ text: string;
113
+ id?: string | undefined;
114
+ intro?: string | undefined;
115
+ outro?: string | undefined;
116
+ }, {
117
+ value: string | number | boolean | null;
118
+ text: string;
119
+ id?: string | undefined;
120
+ intro?: string | undefined;
121
+ outro?: string | undefined;
122
+ }>, "many">;
123
+ }, "strip", z.ZodTypeAny, {
124
+ type: "select-single";
125
+ options: {
126
+ value: string | number | boolean | null;
127
+ text: string;
128
+ id?: string | undefined;
129
+ intro?: string | undefined;
130
+ outro?: string | undefined;
131
+ }[];
132
+ }, {
133
+ type: "select-single";
134
+ options: {
135
+ value: string | number | boolean | null;
136
+ text: string;
137
+ id?: string | undefined;
138
+ intro?: string | undefined;
139
+ outro?: string | undefined;
140
+ }[];
141
+ }>, z.ZodObject<{
142
+ type: z.ZodLiteral<"select-multiple">;
143
+ options: z.ZodArray<z.ZodObject<{
144
+ id: z.ZodOptional<z.ZodString>;
145
+ text: z.ZodString;
146
+ intro: z.ZodOptional<z.ZodString>;
147
+ outro: z.ZodOptional<z.ZodString>;
148
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ value: string | number | boolean | null;
151
+ text: string;
152
+ id?: string | undefined;
153
+ intro?: string | undefined;
154
+ outro?: string | undefined;
155
+ }, {
156
+ value: string | number | boolean | null;
157
+ text: string;
158
+ id?: string | undefined;
159
+ intro?: string | undefined;
160
+ outro?: string | undefined;
161
+ }>, "many">;
162
+ }, "strip", z.ZodTypeAny, {
163
+ type: "select-multiple";
164
+ options: {
165
+ value: string | number | boolean | null;
166
+ text: string;
167
+ id?: string | undefined;
168
+ intro?: string | undefined;
169
+ outro?: string | undefined;
170
+ }[];
171
+ }, {
172
+ type: "select-multiple";
173
+ options: {
174
+ value: string | number | boolean | null;
175
+ text: string;
176
+ id?: string | undefined;
177
+ intro?: string | undefined;
178
+ outro?: string | undefined;
179
+ }[];
180
+ }>]>;
181
+ description: z.ZodOptional<z.ZodString>;
182
+ providedData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ type: "task-item";
185
+ code: string;
186
+ definition: {
187
+ type: "select-single";
188
+ options: {
189
+ value: string | number | boolean | null;
190
+ text: string;
191
+ id?: string | undefined;
192
+ intro?: string | undefined;
193
+ outro?: string | undefined;
194
+ }[];
195
+ } | {
196
+ type: "select-multiple";
197
+ options: {
198
+ value: string | number | boolean | null;
199
+ text: string;
200
+ id?: string | undefined;
201
+ intro?: string | undefined;
202
+ outro?: string | undefined;
203
+ }[];
204
+ };
205
+ data?: Record<string, string> | undefined;
206
+ description?: string | undefined;
207
+ tags?: string[] | undefined;
208
+ documentation?: ({
209
+ type: "pdf";
210
+ url: string;
211
+ label: string;
212
+ text: string;
213
+ } | {
214
+ type: "text";
215
+ label: string;
216
+ text: string;
217
+ } | {
218
+ type: "link";
219
+ url: string;
220
+ label: string;
221
+ text: string;
222
+ })[] | undefined;
223
+ sortOrder?: number | undefined;
224
+ providedData?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
225
+ }, {
226
+ type: "task-item";
227
+ code: string;
228
+ definition: {
229
+ type: "select-single";
230
+ options: {
231
+ value: string | number | boolean | null;
232
+ text: string;
233
+ id?: string | undefined;
234
+ intro?: string | undefined;
235
+ outro?: string | undefined;
236
+ }[];
237
+ } | {
238
+ type: "select-multiple";
239
+ options: {
240
+ value: string | number | boolean | null;
241
+ text: string;
242
+ id?: string | undefined;
243
+ intro?: string | undefined;
244
+ outro?: string | undefined;
245
+ }[];
246
+ };
247
+ data?: Record<string, string> | undefined;
248
+ description?: string | undefined;
249
+ tags?: string[] | undefined;
250
+ documentation?: ({
251
+ type: "pdf";
252
+ url: string;
253
+ label: string;
254
+ text: string;
255
+ } | {
256
+ type: "text";
257
+ label: string;
258
+ text: string;
259
+ } | {
260
+ type: "link";
261
+ url: string;
262
+ label: string;
263
+ text: string;
264
+ })[] | undefined;
265
+ sortOrder?: number | undefined;
266
+ providedData?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
267
+ }>, "many">;
268
+ }, "strip", z.ZodTypeAny, {
269
+ type: "task";
270
+ code: string;
271
+ title: string;
272
+ items: {
273
+ type: "task-item";
274
+ code: string;
275
+ definition: {
276
+ type: "select-single";
277
+ options: {
278
+ value: string | number | boolean | null;
279
+ text: string;
280
+ id?: string | undefined;
281
+ intro?: string | undefined;
282
+ outro?: string | undefined;
283
+ }[];
284
+ } | {
285
+ type: "select-multiple";
286
+ options: {
287
+ value: string | number | boolean | null;
288
+ text: string;
289
+ id?: string | undefined;
290
+ intro?: string | undefined;
291
+ outro?: string | undefined;
292
+ }[];
293
+ };
294
+ data?: Record<string, string> | undefined;
295
+ description?: string | undefined;
296
+ tags?: string[] | undefined;
297
+ documentation?: ({
298
+ type: "pdf";
299
+ url: string;
300
+ label: string;
301
+ text: string;
302
+ } | {
303
+ type: "text";
304
+ label: string;
305
+ text: string;
306
+ } | {
307
+ type: "link";
308
+ url: string;
309
+ label: string;
310
+ text: string;
311
+ })[] | undefined;
312
+ sortOrder?: number | undefined;
313
+ providedData?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
314
+ }[];
315
+ data?: Record<string, any> | undefined;
316
+ description?: string | undefined;
317
+ tags?: string[] | undefined;
318
+ documentation?: ({
319
+ type: "pdf";
320
+ url: string;
321
+ label: string;
322
+ text: string;
323
+ } | {
324
+ type: "text";
325
+ label: string;
326
+ text: string;
327
+ } | {
328
+ type: "link";
329
+ url: string;
330
+ label: string;
331
+ text: string;
332
+ })[] | undefined;
333
+ sortOrder?: number | undefined;
334
+ }, {
335
+ type: "task";
336
+ code: string;
337
+ title: string;
338
+ items: {
339
+ type: "task-item";
340
+ code: string;
341
+ definition: {
342
+ type: "select-single";
343
+ options: {
344
+ value: string | number | boolean | null;
345
+ text: string;
346
+ id?: string | undefined;
347
+ intro?: string | undefined;
348
+ outro?: string | undefined;
349
+ }[];
350
+ } | {
351
+ type: "select-multiple";
352
+ options: {
353
+ value: string | number | boolean | null;
354
+ text: string;
355
+ id?: string | undefined;
356
+ intro?: string | undefined;
357
+ outro?: string | undefined;
358
+ }[];
359
+ };
360
+ data?: Record<string, string> | undefined;
361
+ description?: string | undefined;
362
+ tags?: string[] | undefined;
363
+ documentation?: ({
364
+ type: "pdf";
365
+ url: string;
366
+ label: string;
367
+ text: string;
368
+ } | {
369
+ type: "text";
370
+ label: string;
371
+ text: string;
372
+ } | {
373
+ type: "link";
374
+ url: string;
375
+ label: string;
376
+ text: string;
377
+ })[] | undefined;
378
+ sortOrder?: number | undefined;
379
+ providedData?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
380
+ }[];
381
+ data?: Record<string, any> | undefined;
382
+ description?: string | undefined;
383
+ tags?: string[] | undefined;
384
+ documentation?: ({
385
+ type: "pdf";
386
+ url: string;
387
+ label: string;
388
+ text: string;
389
+ } | {
390
+ type: "text";
391
+ label: string;
392
+ text: string;
393
+ } | {
394
+ type: "link";
395
+ url: string;
396
+ label: string;
397
+ text: string;
398
+ })[] | undefined;
399
+ sortOrder?: number | undefined;
400
+ }>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.taskSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const task_item_1 = require("./task-item");
6
+ exports.taskSchema = zod_1.z.object({
7
+ type: zod_1.z.literal('task'),
8
+ title: zod_1.z.string(),
9
+ code: zod_1.z.string(),
10
+ tags: zod_1.z.array(zod_1.z.string()).optional(),
11
+ documentation: zod_1.z.array(task_item_1.documentationItemSchema).optional(),
12
+ data: zod_1.z.record(zod_1.z.any()).optional(),
13
+ sortOrder: zod_1.z.number().optional(),
14
+ description: zod_1.z.string().optional(),
15
+ items: zod_1.z.array(task_item_1.taskItemSchema)
16
+ });
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validates the request body for the tree and data endpoints
4
+ */
5
+ export declare const treeAndDataBodySchema: z.ZodOptional<z.ZodObject<{
6
+ locale: z.ZodOptional<z.ZodString>;
7
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
8
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ values?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
11
+ locale?: string | undefined;
12
+ parameters?: Record<string, string> | undefined;
13
+ }, {
14
+ values?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
15
+ locale?: string | undefined;
16
+ parameters?: Record<string, string> | undefined;
17
+ }>>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.treeAndDataBodySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const task_item_1 = require("./task-item");
6
+ /**
7
+ * Validates the request body for the tree and data endpoints
8
+ */
9
+ exports.treeAndDataBodySchema = zod_1.z.object({
10
+ locale: zod_1.z.string().optional(),
11
+ parameters: zod_1.z.record(zod_1.z.string()).optional(),
12
+ values: task_item_1.taskItemValueMapSchema.optional()
13
+ }).optional();
@@ -1,13 +1,11 @@
1
- import * as yup from 'yup';
1
+ import { z } from 'zod';
2
2
  /**
3
3
  * Validates the version parameter for endpoints which use it
4
4
  */
5
- export declare const versionParamSchema: yup.ObjectSchema<{
6
- params: {
7
- version: string;
8
- };
9
- }, yup.AnyObject, {
10
- params: {
11
- version: undefined;
12
- };
13
- }, "">;
5
+ export declare const versionParamSchema: z.ZodObject<{
6
+ version: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ version: string;
9
+ }, {
10
+ version: string;
11
+ }>;
@@ -1,37 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.versionParamSchema = void 0;
27
- const yup = __importStar(require("yup"));
4
+ const zod_1 = require("zod");
28
5
  /**
29
6
  * Validates the version parameter for endpoints which use it
30
7
  */
31
- exports.versionParamSchema = yup.object({
32
- params: yup.object({
33
- version: yup.string()
34
- .matches(/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/, 'Service version must be a SemVer-formatted string which includes exclusively a major, minor and patch version')
35
- .required()
36
- })
8
+ exports.versionParamSchema = zod_1.z.object({
9
+ version: zod_1.z.string()
10
+ .regex(/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/, 'Service version must be a SemVer-formatted string which includes exclusively a major, minor and patch version')
37
11
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "1.4.9",
3
+ "version": "1.5.1",
4
4
  "description": "A protocol and tools for defining and working with criteria sets",
5
5
  "private": false,
6
6
  "author": "Andrés Angulo <aa@openframe.org>",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@types/node": "^20.6.3",
18
- "yup": "^1.2.0"
18
+ "zod": "^3.23.8"
19
19
  },
20
20
  "devDependencies": {
21
21
  "typescript": "^5.2.2"