@dmptool/types 1.0.7 → 1.1.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.
Files changed (56) hide show
  1. package/dist/answers/__tests__/answers.spec.js +18 -17
  2. package/dist/answers/index.d.ts +50 -25
  3. package/dist/answers/index.js +19 -17
  4. package/dist/answers/{primitiveAnswers.d.ts → numberAnswers.d.ts} +1 -100
  5. package/dist/answers/numberAnswers.js +25 -0
  6. package/dist/answers/tableAnswers.d.ts +48 -48
  7. package/dist/answers/tableAnswers.js +9 -8
  8. package/dist/answers/textAnswers.d.ts +101 -0
  9. package/dist/answers/textAnswers.js +22 -0
  10. package/dist/questions/__tests__/dateQuestions.spec.js +20 -74
  11. package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -0
  12. package/dist/questions/__tests__/numberQuestions.spec.js +156 -0
  13. package/dist/questions/__tests__/optionBasedQuestions.spec.js +41 -54
  14. package/dist/questions/__tests__/tableQuestion.spec.js +2 -0
  15. package/dist/questions/__tests__/textQuestions.spec.d.ts +1 -0
  16. package/dist/questions/__tests__/textQuestions.spec.js +120 -0
  17. package/dist/questions/dateQuestions.d.ts +159 -178
  18. package/dist/questions/dateQuestions.js +9 -15
  19. package/dist/questions/graphQLQuestions.d.ts +67 -38
  20. package/dist/questions/graphQLQuestions.js +3 -2
  21. package/dist/questions/index.d.ts +1616 -1356
  22. package/dist/questions/index.js +21 -19
  23. package/dist/questions/numberQuestions.d.ts +343 -0
  24. package/dist/questions/numberQuestions.js +34 -0
  25. package/dist/questions/optionBasedQuestions.d.ts +136 -158
  26. package/dist/questions/optionBasedQuestions.js +11 -20
  27. package/dist/questions/question.d.ts +29 -11
  28. package/dist/questions/question.js +10 -4
  29. package/dist/questions/tableQuestions.d.ts +2377 -2030
  30. package/dist/questions/tableQuestions.js +12 -10
  31. package/dist/questions/textQuestions.d.ts +261 -0
  32. package/dist/questions/textQuestions.js +42 -0
  33. package/dist/schemas/anyQuestion.schema.json +237 -239
  34. package/dist/schemas/anyTableColumnQuestion.schema.json +207 -217
  35. package/dist/schemas/booleanQuestion.schema.json +17 -12
  36. package/dist/schemas/checkboxesQuestion.schema.json +24 -27
  37. package/dist/schemas/currencyQuestion.schema.json +23 -18
  38. package/dist/schemas/dateQuestion.schema.json +21 -16
  39. package/dist/schemas/dateRangeQuestion.schema.json +31 -56
  40. package/dist/schemas/emailQuestion.schema.json +24 -19
  41. package/dist/schemas/filteredSearchQuestion.schema.json +18 -13
  42. package/dist/schemas/numberQuestion.schema.json +21 -16
  43. package/dist/schemas/numberRangeQuestion.schema.json +31 -56
  44. package/dist/schemas/radioButtonsQuestion.schema.json +24 -27
  45. package/dist/schemas/selectBoxQuestion.schema.json +27 -36
  46. package/dist/schemas/tableQuestion.schema.json +233 -235
  47. package/dist/schemas/textAreaQuestion.schema.json +22 -16
  48. package/dist/schemas/textQuestion.schema.json +21 -16
  49. package/dist/schemas/typeaheadSearchQuestion.schema.json +15 -4
  50. package/dist/schemas/urlQuestion.schema.json +21 -16
  51. package/package.json +1 -1
  52. package/dist/answers/primitiveAnswers.js +0 -41
  53. package/dist/questions/__tests__/primitiveQuestions.spec.js +0 -281
  54. package/dist/questions/primitiveQuestions.d.ts +0 -554
  55. package/dist/questions/primitiveQuestions.js +0 -86
  56. /package/dist/questions/__tests__/{primitiveQuestions.spec.d.ts → numberQuestions.spec.d.ts} +0 -0
@@ -1,554 +0,0 @@
1
- import { z } from "zod";
2
- export declare const BooleanQuestionSchema: z.ZodObject<{
3
- meta: z.ZodObject<{
4
- schemaVersion: z.ZodLiteral<"1.0">;
5
- labelTranslationKey: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- schemaVersion: "1.0";
8
- labelTranslationKey?: string | undefined;
9
- }, {
10
- schemaVersion: "1.0";
11
- labelTranslationKey?: string | undefined;
12
- }>;
13
- } & {
14
- type: z.ZodLiteral<"boolean">;
15
- attributes: z.ZodOptional<z.ZodObject<{
16
- checked: z.ZodOptional<z.ZodBoolean>;
17
- }, "strip", z.ZodTypeAny, {
18
- checked?: boolean | undefined;
19
- }, {
20
- checked?: boolean | undefined;
21
- }>>;
22
- }, "strip", z.ZodTypeAny, {
23
- type: "boolean";
24
- meta: {
25
- schemaVersion: "1.0";
26
- labelTranslationKey?: string | undefined;
27
- };
28
- attributes?: {
29
- checked?: boolean | undefined;
30
- } | undefined;
31
- }, {
32
- type: "boolean";
33
- meta: {
34
- schemaVersion: "1.0";
35
- labelTranslationKey?: string | undefined;
36
- };
37
- attributes?: {
38
- checked?: boolean | undefined;
39
- } | undefined;
40
- }>;
41
- export declare const NumberQuestionSchema: z.ZodObject<{
42
- meta: z.ZodObject<{
43
- schemaVersion: z.ZodLiteral<"1.0">;
44
- labelTranslationKey: z.ZodOptional<z.ZodString>;
45
- }, "strip", z.ZodTypeAny, {
46
- schemaVersion: "1.0";
47
- labelTranslationKey?: string | undefined;
48
- }, {
49
- schemaVersion: "1.0";
50
- labelTranslationKey?: string | undefined;
51
- }>;
52
- } & {
53
- type: z.ZodLiteral<"number">;
54
- attributes: z.ZodOptional<z.ZodObject<{
55
- max: z.ZodOptional<z.ZodNumber>;
56
- min: z.ZodOptional<z.ZodNumber>;
57
- step: z.ZodOptional<z.ZodNumber>;
58
- }, "strip", z.ZodTypeAny, {
59
- max?: number | undefined;
60
- min?: number | undefined;
61
- step?: number | undefined;
62
- }, {
63
- max?: number | undefined;
64
- min?: number | undefined;
65
- step?: number | undefined;
66
- }>>;
67
- }, "strip", z.ZodTypeAny, {
68
- type: "number";
69
- meta: {
70
- schemaVersion: "1.0";
71
- labelTranslationKey?: string | undefined;
72
- };
73
- attributes?: {
74
- max?: number | undefined;
75
- min?: number | undefined;
76
- step?: number | undefined;
77
- } | undefined;
78
- }, {
79
- type: "number";
80
- meta: {
81
- schemaVersion: "1.0";
82
- labelTranslationKey?: string | undefined;
83
- };
84
- attributes?: {
85
- max?: number | undefined;
86
- min?: number | undefined;
87
- step?: number | undefined;
88
- } | undefined;
89
- }>;
90
- export declare const NumberRangeQuestionSchema: z.ZodObject<{
91
- meta: z.ZodObject<{
92
- schemaVersion: z.ZodLiteral<"1.0">;
93
- labelTranslationKey: z.ZodOptional<z.ZodString>;
94
- }, "strip", z.ZodTypeAny, {
95
- schemaVersion: "1.0";
96
- labelTranslationKey?: string | undefined;
97
- }, {
98
- schemaVersion: "1.0";
99
- labelTranslationKey?: string | undefined;
100
- }>;
101
- } & {
102
- type: z.ZodLiteral<"numberRange">;
103
- columns: z.ZodObject<{
104
- start: z.ZodObject<{
105
- meta: z.ZodObject<{
106
- schemaVersion: z.ZodLiteral<"1.0">;
107
- labelTranslationKey: z.ZodOptional<z.ZodString>;
108
- }, "strip", z.ZodTypeAny, {
109
- schemaVersion: "1.0";
110
- labelTranslationKey?: string | undefined;
111
- }, {
112
- schemaVersion: "1.0";
113
- labelTranslationKey?: string | undefined;
114
- }>;
115
- type: z.ZodLiteral<"number">;
116
- } & {
117
- attributes: z.ZodObject<{
118
- label: z.ZodString;
119
- }, "strip", z.ZodTypeAny, {
120
- label: string;
121
- }, {
122
- label: string;
123
- }>;
124
- }, "strip", z.ZodTypeAny, {
125
- type: "number";
126
- meta: {
127
- schemaVersion: "1.0";
128
- labelTranslationKey?: string | undefined;
129
- };
130
- attributes: {
131
- label: string;
132
- };
133
- }, {
134
- type: "number";
135
- meta: {
136
- schemaVersion: "1.0";
137
- labelTranslationKey?: string | undefined;
138
- };
139
- attributes: {
140
- label: string;
141
- };
142
- }>;
143
- end: z.ZodObject<{
144
- meta: z.ZodObject<{
145
- schemaVersion: z.ZodLiteral<"1.0">;
146
- labelTranslationKey: z.ZodOptional<z.ZodString>;
147
- }, "strip", z.ZodTypeAny, {
148
- schemaVersion: "1.0";
149
- labelTranslationKey?: string | undefined;
150
- }, {
151
- schemaVersion: "1.0";
152
- labelTranslationKey?: string | undefined;
153
- }>;
154
- type: z.ZodLiteral<"number">;
155
- } & {
156
- attributes: z.ZodObject<{
157
- label: z.ZodString;
158
- }, "strip", z.ZodTypeAny, {
159
- label: string;
160
- }, {
161
- label: string;
162
- }>;
163
- }, "strip", z.ZodTypeAny, {
164
- type: "number";
165
- meta: {
166
- schemaVersion: "1.0";
167
- labelTranslationKey?: string | undefined;
168
- };
169
- attributes: {
170
- label: string;
171
- };
172
- }, {
173
- type: "number";
174
- meta: {
175
- schemaVersion: "1.0";
176
- labelTranslationKey?: string | undefined;
177
- };
178
- attributes: {
179
- label: string;
180
- };
181
- }>;
182
- }, "strip", z.ZodTypeAny, {
183
- start: {
184
- type: "number";
185
- meta: {
186
- schemaVersion: "1.0";
187
- labelTranslationKey?: string | undefined;
188
- };
189
- attributes: {
190
- label: string;
191
- };
192
- };
193
- end: {
194
- type: "number";
195
- meta: {
196
- schemaVersion: "1.0";
197
- labelTranslationKey?: string | undefined;
198
- };
199
- attributes: {
200
- label: string;
201
- };
202
- };
203
- }, {
204
- start: {
205
- type: "number";
206
- meta: {
207
- schemaVersion: "1.0";
208
- labelTranslationKey?: string | undefined;
209
- };
210
- attributes: {
211
- label: string;
212
- };
213
- };
214
- end: {
215
- type: "number";
216
- meta: {
217
- schemaVersion: "1.0";
218
- labelTranslationKey?: string | undefined;
219
- };
220
- attributes: {
221
- label: string;
222
- };
223
- };
224
- }>;
225
- }, "strip", z.ZodTypeAny, {
226
- type: "numberRange";
227
- meta: {
228
- schemaVersion: "1.0";
229
- labelTranslationKey?: string | undefined;
230
- };
231
- columns: {
232
- start: {
233
- type: "number";
234
- meta: {
235
- schemaVersion: "1.0";
236
- labelTranslationKey?: string | undefined;
237
- };
238
- attributes: {
239
- label: string;
240
- };
241
- };
242
- end: {
243
- type: "number";
244
- meta: {
245
- schemaVersion: "1.0";
246
- labelTranslationKey?: string | undefined;
247
- };
248
- attributes: {
249
- label: string;
250
- };
251
- };
252
- };
253
- }, {
254
- type: "numberRange";
255
- meta: {
256
- schemaVersion: "1.0";
257
- labelTranslationKey?: string | undefined;
258
- };
259
- columns: {
260
- start: {
261
- type: "number";
262
- meta: {
263
- schemaVersion: "1.0";
264
- labelTranslationKey?: string | undefined;
265
- };
266
- attributes: {
267
- label: string;
268
- };
269
- };
270
- end: {
271
- type: "number";
272
- meta: {
273
- schemaVersion: "1.0";
274
- labelTranslationKey?: string | undefined;
275
- };
276
- attributes: {
277
- label: string;
278
- };
279
- };
280
- };
281
- }>;
282
- export declare const CurrencyQuestionSchema: z.ZodObject<{
283
- attributes: z.ZodOptional<z.ZodObject<{
284
- max: z.ZodOptional<z.ZodNumber>;
285
- min: z.ZodOptional<z.ZodNumber>;
286
- step: z.ZodOptional<z.ZodNumber>;
287
- }, "strip", z.ZodTypeAny, {
288
- max?: number | undefined;
289
- min?: number | undefined;
290
- step?: number | undefined;
291
- }, {
292
- max?: number | undefined;
293
- min?: number | undefined;
294
- step?: number | undefined;
295
- }>>;
296
- } & {
297
- type: z.ZodLiteral<"currency">;
298
- meta: z.ZodObject<{
299
- schemaVersion: z.ZodLiteral<"1.0">;
300
- labelTranslationKey: z.ZodOptional<z.ZodString>;
301
- } & {
302
- denomination: z.ZodOptional<z.ZodString>;
303
- }, "strip", z.ZodTypeAny, {
304
- schemaVersion: "1.0";
305
- labelTranslationKey?: string | undefined;
306
- denomination?: string | undefined;
307
- }, {
308
- schemaVersion: "1.0";
309
- labelTranslationKey?: string | undefined;
310
- denomination?: string | undefined;
311
- }>;
312
- }, "strip", z.ZodTypeAny, {
313
- type: "currency";
314
- meta: {
315
- schemaVersion: "1.0";
316
- labelTranslationKey?: string | undefined;
317
- denomination?: string | undefined;
318
- };
319
- attributes?: {
320
- max?: number | undefined;
321
- min?: number | undefined;
322
- step?: number | undefined;
323
- } | undefined;
324
- }, {
325
- type: "currency";
326
- meta: {
327
- schemaVersion: "1.0";
328
- labelTranslationKey?: string | undefined;
329
- denomination?: string | undefined;
330
- };
331
- attributes?: {
332
- max?: number | undefined;
333
- min?: number | undefined;
334
- step?: number | undefined;
335
- } | undefined;
336
- }>;
337
- export declare const EmailQuestionSchema: z.ZodObject<{
338
- meta: z.ZodObject<{
339
- schemaVersion: z.ZodLiteral<"1.0">;
340
- labelTranslationKey: z.ZodOptional<z.ZodString>;
341
- }, "strip", z.ZodTypeAny, {
342
- schemaVersion: "1.0";
343
- labelTranslationKey?: string | undefined;
344
- }, {
345
- schemaVersion: "1.0";
346
- labelTranslationKey?: string | undefined;
347
- }>;
348
- } & {
349
- type: z.ZodLiteral<"email">;
350
- attributes: z.ZodOptional<z.ZodObject<{
351
- maxLength: z.ZodOptional<z.ZodNumber>;
352
- minLength: z.ZodOptional<z.ZodNumber>;
353
- multiple: z.ZodOptional<z.ZodBoolean>;
354
- pattern: z.ZodOptional<z.ZodString>;
355
- }, "strip", z.ZodTypeAny, {
356
- maxLength?: number | undefined;
357
- minLength?: number | undefined;
358
- multiple?: boolean | undefined;
359
- pattern?: string | undefined;
360
- }, {
361
- maxLength?: number | undefined;
362
- minLength?: number | undefined;
363
- multiple?: boolean | undefined;
364
- pattern?: string | undefined;
365
- }>>;
366
- }, "strip", z.ZodTypeAny, {
367
- type: "email";
368
- meta: {
369
- schemaVersion: "1.0";
370
- labelTranslationKey?: string | undefined;
371
- };
372
- attributes?: {
373
- maxLength?: number | undefined;
374
- minLength?: number | undefined;
375
- multiple?: boolean | undefined;
376
- pattern?: string | undefined;
377
- } | undefined;
378
- }, {
379
- type: "email";
380
- meta: {
381
- schemaVersion: "1.0";
382
- labelTranslationKey?: string | undefined;
383
- };
384
- attributes?: {
385
- maxLength?: number | undefined;
386
- minLength?: number | undefined;
387
- multiple?: boolean | undefined;
388
- pattern?: string | undefined;
389
- } | undefined;
390
- }>;
391
- export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
392
- type: z.ZodLiteral<"textArea">;
393
- attributes: z.ZodOptional<z.ZodObject<{
394
- cols: z.ZodOptional<z.ZodNumber>;
395
- maxLength: z.ZodOptional<z.ZodNumber>;
396
- minLength: z.ZodOptional<z.ZodNumber>;
397
- rows: z.ZodOptional<z.ZodNumber>;
398
- }, "strip", z.ZodTypeAny, {
399
- maxLength?: number | undefined;
400
- minLength?: number | undefined;
401
- cols?: number | undefined;
402
- rows?: number | undefined;
403
- }, {
404
- maxLength?: number | undefined;
405
- minLength?: number | undefined;
406
- cols?: number | undefined;
407
- rows?: number | undefined;
408
- }>>;
409
- meta: z.ZodObject<{
410
- schemaVersion: z.ZodLiteral<"1.0">;
411
- labelTranslationKey: z.ZodOptional<z.ZodString>;
412
- } & {
413
- asRichText: z.ZodOptional<z.ZodBoolean>;
414
- }, "strip", z.ZodTypeAny, {
415
- schemaVersion: "1.0";
416
- labelTranslationKey?: string | undefined;
417
- asRichText?: boolean | undefined;
418
- }, {
419
- schemaVersion: "1.0";
420
- labelTranslationKey?: string | undefined;
421
- asRichText?: boolean | undefined;
422
- }>;
423
- }, "strip", z.ZodTypeAny, {
424
- type: "textArea";
425
- meta: {
426
- schemaVersion: "1.0";
427
- labelTranslationKey?: string | undefined;
428
- asRichText?: boolean | undefined;
429
- };
430
- attributes?: {
431
- maxLength?: number | undefined;
432
- minLength?: number | undefined;
433
- cols?: number | undefined;
434
- rows?: number | undefined;
435
- } | undefined;
436
- }, {
437
- type: "textArea";
438
- meta: {
439
- schemaVersion: "1.0";
440
- labelTranslationKey?: string | undefined;
441
- asRichText?: boolean | undefined;
442
- };
443
- attributes?: {
444
- maxLength?: number | undefined;
445
- minLength?: number | undefined;
446
- cols?: number | undefined;
447
- rows?: number | undefined;
448
- } | undefined;
449
- }>;
450
- export declare const TextQuestionSchema: z.ZodObject<{
451
- meta: z.ZodObject<{
452
- schemaVersion: z.ZodLiteral<"1.0">;
453
- labelTranslationKey: z.ZodOptional<z.ZodString>;
454
- }, "strip", z.ZodTypeAny, {
455
- schemaVersion: "1.0";
456
- labelTranslationKey?: string | undefined;
457
- }, {
458
- schemaVersion: "1.0";
459
- labelTranslationKey?: string | undefined;
460
- }>;
461
- } & {
462
- type: z.ZodLiteral<"text">;
463
- attributes: z.ZodOptional<z.ZodObject<{
464
- maxLength: z.ZodOptional<z.ZodNumber>;
465
- minLength: z.ZodOptional<z.ZodNumber>;
466
- pattern: z.ZodOptional<z.ZodString>;
467
- }, "strip", z.ZodTypeAny, {
468
- maxLength?: number | undefined;
469
- minLength?: number | undefined;
470
- pattern?: string | undefined;
471
- }, {
472
- maxLength?: number | undefined;
473
- minLength?: number | undefined;
474
- pattern?: string | undefined;
475
- }>>;
476
- }, "strip", z.ZodTypeAny, {
477
- type: "text";
478
- meta: {
479
- schemaVersion: "1.0";
480
- labelTranslationKey?: string | undefined;
481
- };
482
- attributes?: {
483
- maxLength?: number | undefined;
484
- minLength?: number | undefined;
485
- pattern?: string | undefined;
486
- } | undefined;
487
- }, {
488
- type: "text";
489
- meta: {
490
- schemaVersion: "1.0";
491
- labelTranslationKey?: string | undefined;
492
- };
493
- attributes?: {
494
- maxLength?: number | undefined;
495
- minLength?: number | undefined;
496
- pattern?: string | undefined;
497
- } | undefined;
498
- }>;
499
- export declare const URLQuestionSchema: z.ZodObject<{
500
- meta: z.ZodObject<{
501
- schemaVersion: z.ZodLiteral<"1.0">;
502
- labelTranslationKey: z.ZodOptional<z.ZodString>;
503
- }, "strip", z.ZodTypeAny, {
504
- schemaVersion: "1.0";
505
- labelTranslationKey?: string | undefined;
506
- }, {
507
- schemaVersion: "1.0";
508
- labelTranslationKey?: string | undefined;
509
- }>;
510
- } & {
511
- type: z.ZodLiteral<"url">;
512
- attributes: z.ZodOptional<z.ZodObject<{
513
- maxLength: z.ZodOptional<z.ZodNumber>;
514
- minLength: z.ZodOptional<z.ZodNumber>;
515
- pattern: z.ZodOptional<z.ZodString>;
516
- }, "strip", z.ZodTypeAny, {
517
- maxLength?: number | undefined;
518
- minLength?: number | undefined;
519
- pattern?: string | undefined;
520
- }, {
521
- maxLength?: number | undefined;
522
- minLength?: number | undefined;
523
- pattern?: string | undefined;
524
- }>>;
525
- }, "strip", z.ZodTypeAny, {
526
- type: "url";
527
- meta: {
528
- schemaVersion: "1.0";
529
- labelTranslationKey?: string | undefined;
530
- };
531
- attributes?: {
532
- maxLength?: number | undefined;
533
- minLength?: number | undefined;
534
- pattern?: string | undefined;
535
- } | undefined;
536
- }, {
537
- type: "url";
538
- meta: {
539
- schemaVersion: "1.0";
540
- labelTranslationKey?: string | undefined;
541
- };
542
- attributes?: {
543
- maxLength?: number | undefined;
544
- minLength?: number | undefined;
545
- pattern?: string | undefined;
546
- } | undefined;
547
- }>;
548
- export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
549
- export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
550
- export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
551
- export type NumberQuestionType = z.infer<typeof NumberQuestionSchema>;
552
- export type TextAreaQuestionType = z.infer<typeof TextAreaQuestionSchema>;
553
- export type TextQuestionType = z.infer<typeof TextQuestionSchema>;
554
- export type URLQuestionType = z.infer<typeof URLQuestionSchema>;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = exports.CurrencyQuestionSchema = exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.BooleanQuestionSchema = void 0;
4
- const zod_1 = require("zod");
5
- const question_1 = require("./question");
6
- const BaseMeta = question_1.QuestionSchema.shape.meta;
7
- // A Yes/No True/False question and answer
8
- exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
9
- type: zod_1.z.literal('boolean'), // The type of question
10
- attributes: zod_1.z.object({
11
- checked: zod_1.z.boolean().optional() // If it is checked by default when rendered (default is false)
12
- }).optional(),
13
- }));
14
- // A number question and answer
15
- exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
16
- type: zod_1.z.literal('number'), // The type of question
17
- attributes: zod_1.z.object({
18
- max: zod_1.z.number().optional(), // The maximum value (no default)
19
- min: zod_1.z.number().optional(), // The minimum value (default is 0)
20
- step: zod_1.z.number().optional() // The step value (use 0.01 or similar for float)
21
- }).optional(),
22
- }));
23
- // A range of numbers question and answer
24
- exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
25
- type: zod_1.z.literal('numberRange'), // The type of question
26
- columns: zod_1.z.object({
27
- start: exports.NumberQuestionSchema.merge(zod_1.z.object({
28
- attributes: zod_1.z.object({
29
- label: zod_1.z.string() // The label for the start number
30
- })
31
- })),
32
- end: exports.NumberQuestionSchema.merge(zod_1.z.object({
33
- attributes: zod_1.z.object({
34
- label: zod_1.z.string() // The label for the end number
35
- })
36
- }))
37
- })
38
- }));
39
- // Currency question and answer
40
- exports.CurrencyQuestionSchema = exports.NumberQuestionSchema.merge(zod_1.z.object({
41
- type: zod_1.z.literal('currency'), // The type of question
42
- meta: BaseMeta.extend({
43
- denomination: zod_1.z.string().optional() // The currency denomination (default is USD)
44
- })
45
- }));
46
- // Email question and answer
47
- exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
48
- type: zod_1.z.literal('email'), // The type of question
49
- attributes: zod_1.z.object({
50
- maxLength: zod_1.z.number().optional(), // The maximum length of the email (no default)
51
- minLength: zod_1.z.number().optional(), // The minimum length of the email (no default)
52
- multiple: zod_1.z.boolean().optional(), // Allow multiple emails (default is false; comma separated)
53
- pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
54
- }).optional(),
55
- }));
56
- // Text area question and answer
57
- exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
58
- type: zod_1.z.literal('textArea'), // The type of question
59
- attributes: zod_1.z.object({
60
- cols: zod_1.z.number().optional(), // The number of columns (default is 20)
61
- maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
62
- minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
63
- rows: zod_1.z.number().optional() // The number of rows (default is 2)
64
- }).optional(),
65
- meta: BaseMeta.extend({
66
- asRichText: zod_1.z.boolean().optional() // Whether to use rich text (default is false)
67
- })
68
- }));
69
- // Text question and answer
70
- exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
71
- type: zod_1.z.literal('text'), // The type of question
72
- attributes: zod_1.z.object({
73
- maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
74
- minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
75
- pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
76
- }).optional(),
77
- }));
78
- // URL question and answer
79
- exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
80
- type: zod_1.z.literal('url'), // The type of question
81
- attributes: zod_1.z.object({
82
- maxLength: zod_1.z.number().optional(), // The maximum length of the URL (no default)
83
- minLength: zod_1.z.number().optional(), // The minimum length of the URL (no default)
84
- pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
85
- }).optional(),
86
- }));