@dmptool/types 1.1.0 → 1.1.2
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/README.md +2 -0
- package/dist/answers/__tests__/answers.spec.js +13 -7
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +2 -2
- package/dist/answers/graphQLAnswers.js +2 -2
- package/dist/answers/index.d.ts +111 -74
- package/dist/answers/index.js +4 -4
- package/dist/answers/numberAnswers.d.ts +0 -25
- package/dist/answers/numberAnswers.js +1 -5
- package/dist/answers/optionBasedAnswers.d.ts +52 -2
- package/dist/answers/optionBasedAnswers.js +9 -1
- package/dist/answers/tableAnswers.d.ts +304 -140
- package/dist/answers/tableAnswers.js +3 -2
- package/dist/questions/__tests__/graphQLQuestions.spec.js +7 -7
- package/dist/questions/__tests__/numberQuestions.spec.js +0 -48
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +98 -1
- package/dist/questions/dateQuestions.d.ts +47 -16
- package/dist/questions/dateQuestions.js +25 -1
- package/dist/questions/graphQLQuestions.d.ts +59 -28
- package/dist/questions/graphQLQuestions.js +40 -3
- package/dist/questions/index.d.ts +1567 -689
- package/dist/questions/index.js +7 -4
- package/dist/questions/numberQuestions.d.ts +71 -76
- package/dist/questions/numberQuestions.js +37 -8
- package/dist/questions/optionBasedQuestions.d.ts +227 -23
- package/dist/questions/optionBasedQuestions.js +89 -5
- package/dist/questions/question.d.ts +51 -4
- package/dist/questions/question.js +14 -2
- package/dist/questions/tableQuestions.d.ts +1965 -1056
- package/dist/questions/tableQuestions.js +14 -2
- package/dist/questions/textQuestions.d.ts +100 -40
- package/dist/questions/textQuestions.js +45 -7
- package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +133 -0
- package/dist/schemas/anyAnswer.schema.json +41 -23
- package/dist/schemas/anyQuestion.schema.json +563 -146
- package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
- package/dist/schemas/anyTableColumnQuestion.schema.json +398 -119
- package/dist/schemas/booleanQuestion.schema.json +12 -0
- package/dist/schemas/checkboxesQuestion.schema.json +12 -0
- package/dist/schemas/currencyQuestion.schema.json +12 -0
- package/dist/schemas/dateQuestion.schema.json +12 -0
- package/dist/schemas/dateRangeQuestion.schema.json +12 -0
- package/dist/schemas/emailQuestion.schema.json +12 -0
- package/dist/schemas/filteredSearchQuestion.schema.json +10 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +90 -0
- package/dist/schemas/numberQuestion.schema.json +12 -0
- package/dist/schemas/numberRangeQuestion.schema.json +12 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +12 -0
- package/dist/schemas/selectBoxAnswer.schema.json +1 -4
- package/dist/schemas/selectBoxQuestion.schema.json +18 -1
- package/dist/schemas/tableAnswer.schema.json +35 -14
- package/dist/schemas/tableQuestion.schema.json +420 -120
- package/dist/schemas/textAreaQuestion.schema.json +15 -4
- package/dist/schemas/textQuestion.schema.json +12 -0
- package/dist/schemas/urlQuestion.schema.json +12 -0
- package/package.json +1 -1
|
@@ -1,24 +1,82 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const BooleanQuestionSchema: z.ZodObject<{} & {
|
|
3
|
+
type: z.ZodLiteral<"boolean">;
|
|
3
4
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
4
5
|
label: z.ZodOptional<z.ZodString>;
|
|
5
6
|
help: z.ZodOptional<z.ZodString>;
|
|
6
7
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
8
|
+
} & {
|
|
9
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
7
10
|
}, "strip", z.ZodTypeAny, {
|
|
8
11
|
label?: string | undefined;
|
|
9
12
|
help?: string | undefined;
|
|
10
13
|
labelTranslationKey?: string | undefined;
|
|
14
|
+
checked?: boolean | undefined;
|
|
11
15
|
}, {
|
|
12
16
|
label?: string | undefined;
|
|
13
17
|
help?: string | undefined;
|
|
14
18
|
labelTranslationKey?: string | undefined;
|
|
19
|
+
checked?: boolean | undefined;
|
|
15
20
|
}>>;
|
|
16
21
|
meta: z.ZodOptional<z.ZodObject<{
|
|
17
22
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
23
|
+
} & {
|
|
24
|
+
title: z.ZodOptional<z.ZodLiteral<"Yes/No Field">>;
|
|
25
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a simple Yes/No response.">>;
|
|
26
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
18
27
|
}, "strip", z.ZodTypeAny, {
|
|
19
28
|
schemaVersion: "1.0";
|
|
29
|
+
title?: "Yes/No Field" | undefined;
|
|
30
|
+
usageDescription?: "For questions that require a simple Yes/No response." | undefined;
|
|
31
|
+
defaultJSON?: string | undefined;
|
|
20
32
|
}, {
|
|
21
33
|
schemaVersion: "1.0";
|
|
34
|
+
title?: "Yes/No Field" | undefined;
|
|
35
|
+
usageDescription?: "For questions that require a simple Yes/No response." | undefined;
|
|
36
|
+
defaultJSON?: string | undefined;
|
|
37
|
+
}>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
type: "boolean";
|
|
40
|
+
attributes?: {
|
|
41
|
+
label?: string | undefined;
|
|
42
|
+
help?: string | undefined;
|
|
43
|
+
labelTranslationKey?: string | undefined;
|
|
44
|
+
checked?: boolean | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
meta?: {
|
|
47
|
+
schemaVersion: "1.0";
|
|
48
|
+
title?: "Yes/No Field" | undefined;
|
|
49
|
+
usageDescription?: "For questions that require a simple Yes/No response." | undefined;
|
|
50
|
+
defaultJSON?: string | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
type: "boolean";
|
|
54
|
+
attributes?: {
|
|
55
|
+
label?: string | undefined;
|
|
56
|
+
help?: string | undefined;
|
|
57
|
+
labelTranslationKey?: string | undefined;
|
|
58
|
+
checked?: boolean | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
meta?: {
|
|
61
|
+
schemaVersion: "1.0";
|
|
62
|
+
title?: "Yes/No Field" | undefined;
|
|
63
|
+
usageDescription?: "For questions that require a simple Yes/No response." | undefined;
|
|
64
|
+
defaultJSON?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
68
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
label: z.ZodOptional<z.ZodString>;
|
|
70
|
+
help: z.ZodOptional<z.ZodString>;
|
|
71
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
label?: string | undefined;
|
|
74
|
+
help?: string | undefined;
|
|
75
|
+
labelTranslationKey?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
label?: string | undefined;
|
|
78
|
+
help?: string | undefined;
|
|
79
|
+
labelTranslationKey?: string | undefined;
|
|
22
80
|
}>>;
|
|
23
81
|
} & {
|
|
24
82
|
type: z.ZodLiteral<"checkBoxes">;
|
|
@@ -36,6 +94,23 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
|
36
94
|
label: string;
|
|
37
95
|
checked?: boolean | undefined;
|
|
38
96
|
}>, "many">;
|
|
97
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
99
|
+
} & {
|
|
100
|
+
title: z.ZodOptional<z.ZodLiteral<"Check Boxes">>;
|
|
101
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For multiple choice questions where users can select multiple options.">>;
|
|
102
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
schemaVersion: "1.0";
|
|
105
|
+
title?: "Check Boxes" | undefined;
|
|
106
|
+
usageDescription?: "For multiple choice questions where users can select multiple options." | undefined;
|
|
107
|
+
defaultJSON?: string | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
schemaVersion: "1.0";
|
|
110
|
+
title?: "Check Boxes" | undefined;
|
|
111
|
+
usageDescription?: "For multiple choice questions where users can select multiple options." | undefined;
|
|
112
|
+
defaultJSON?: string | undefined;
|
|
113
|
+
}>>;
|
|
39
114
|
}, "strip", z.ZodTypeAny, {
|
|
40
115
|
options: {
|
|
41
116
|
value: string;
|
|
@@ -50,6 +125,9 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
|
50
125
|
} | undefined;
|
|
51
126
|
meta?: {
|
|
52
127
|
schemaVersion: "1.0";
|
|
128
|
+
title?: "Check Boxes" | undefined;
|
|
129
|
+
usageDescription?: "For multiple choice questions where users can select multiple options." | undefined;
|
|
130
|
+
defaultJSON?: string | undefined;
|
|
53
131
|
} | undefined;
|
|
54
132
|
}, {
|
|
55
133
|
options: {
|
|
@@ -65,6 +143,9 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
|
65
143
|
} | undefined;
|
|
66
144
|
meta?: {
|
|
67
145
|
schemaVersion: "1.0";
|
|
146
|
+
title?: "Check Boxes" | undefined;
|
|
147
|
+
usageDescription?: "For multiple choice questions where users can select multiple options." | undefined;
|
|
148
|
+
defaultJSON?: string | undefined;
|
|
68
149
|
} | undefined;
|
|
69
150
|
}>;
|
|
70
151
|
export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
@@ -81,13 +162,6 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
81
162
|
help?: string | undefined;
|
|
82
163
|
labelTranslationKey?: string | undefined;
|
|
83
164
|
}>>;
|
|
84
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
85
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
schemaVersion: "1.0";
|
|
88
|
-
}, {
|
|
89
|
-
schemaVersion: "1.0";
|
|
90
|
-
}>>;
|
|
91
165
|
} & {
|
|
92
166
|
type: z.ZodLiteral<"radioButtons">;
|
|
93
167
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -104,6 +178,23 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
104
178
|
label: string;
|
|
105
179
|
selected?: boolean | undefined;
|
|
106
180
|
}>, "many">;
|
|
181
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
183
|
+
} & {
|
|
184
|
+
title: z.ZodOptional<z.ZodLiteral<"Radio Buttons">>;
|
|
185
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For multiple choice questions where users select just one option.">>;
|
|
186
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
schemaVersion: "1.0";
|
|
189
|
+
title?: "Radio Buttons" | undefined;
|
|
190
|
+
usageDescription?: "For multiple choice questions where users select just one option." | undefined;
|
|
191
|
+
defaultJSON?: string | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
schemaVersion: "1.0";
|
|
194
|
+
title?: "Radio Buttons" | undefined;
|
|
195
|
+
usageDescription?: "For multiple choice questions where users select just one option." | undefined;
|
|
196
|
+
defaultJSON?: string | undefined;
|
|
197
|
+
}>>;
|
|
107
198
|
}, "strip", z.ZodTypeAny, {
|
|
108
199
|
options: {
|
|
109
200
|
value: string;
|
|
@@ -118,6 +209,9 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
118
209
|
} | undefined;
|
|
119
210
|
meta?: {
|
|
120
211
|
schemaVersion: "1.0";
|
|
212
|
+
title?: "Radio Buttons" | undefined;
|
|
213
|
+
usageDescription?: "For multiple choice questions where users select just one option." | undefined;
|
|
214
|
+
defaultJSON?: string | undefined;
|
|
121
215
|
} | undefined;
|
|
122
216
|
}, {
|
|
123
217
|
options: {
|
|
@@ -133,18 +227,101 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
133
227
|
} | undefined;
|
|
134
228
|
meta?: {
|
|
135
229
|
schemaVersion: "1.0";
|
|
230
|
+
title?: "Radio Buttons" | undefined;
|
|
231
|
+
usageDescription?: "For multiple choice questions where users select just one option." | undefined;
|
|
232
|
+
defaultJSON?: string | undefined;
|
|
136
233
|
} | undefined;
|
|
137
234
|
}>;
|
|
138
|
-
export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
235
|
+
export declare const SelectBoxQuestionSchema: z.ZodObject<{} & {
|
|
236
|
+
type: z.ZodLiteral<"selectBox">;
|
|
237
|
+
options: z.ZodArray<z.ZodObject<{
|
|
238
|
+
label: z.ZodString;
|
|
239
|
+
value: z.ZodString;
|
|
240
|
+
} & {
|
|
241
|
+
selected: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
value: string;
|
|
244
|
+
label: string;
|
|
245
|
+
selected?: boolean | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
value: string;
|
|
248
|
+
label: string;
|
|
249
|
+
selected?: boolean | undefined;
|
|
250
|
+
}>, "many">;
|
|
251
|
+
attributes: z.ZodObject<{
|
|
252
|
+
label: z.ZodOptional<z.ZodString>;
|
|
253
|
+
help: z.ZodOptional<z.ZodString>;
|
|
254
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
255
|
+
} & {
|
|
256
|
+
multiple: z.ZodLiteral<false>;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
multiple: false;
|
|
259
|
+
label?: string | undefined;
|
|
260
|
+
help?: string | undefined;
|
|
261
|
+
labelTranslationKey?: string | undefined;
|
|
262
|
+
}, {
|
|
263
|
+
multiple: false;
|
|
264
|
+
label?: string | undefined;
|
|
265
|
+
help?: string | undefined;
|
|
266
|
+
labelTranslationKey?: string | undefined;
|
|
267
|
+
}>;
|
|
139
268
|
meta: z.ZodOptional<z.ZodObject<{
|
|
140
269
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
270
|
+
} & {
|
|
271
|
+
title: z.ZodOptional<z.ZodLiteral<"Select Box">>;
|
|
272
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions where users select one option from a list.">>;
|
|
273
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
141
274
|
}, "strip", z.ZodTypeAny, {
|
|
142
275
|
schemaVersion: "1.0";
|
|
276
|
+
title?: "Select Box" | undefined;
|
|
277
|
+
usageDescription?: "For questions where users select one option from a list." | undefined;
|
|
278
|
+
defaultJSON?: string | undefined;
|
|
143
279
|
}, {
|
|
144
280
|
schemaVersion: "1.0";
|
|
281
|
+
title?: "Select Box" | undefined;
|
|
282
|
+
usageDescription?: "For questions where users select one option from a list." | undefined;
|
|
283
|
+
defaultJSON?: string | undefined;
|
|
145
284
|
}>>;
|
|
146
|
-
}
|
|
147
|
-
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
options: {
|
|
287
|
+
value: string;
|
|
288
|
+
label: string;
|
|
289
|
+
selected?: boolean | undefined;
|
|
290
|
+
}[];
|
|
291
|
+
type: "selectBox";
|
|
292
|
+
attributes: {
|
|
293
|
+
multiple: false;
|
|
294
|
+
label?: string | undefined;
|
|
295
|
+
help?: string | undefined;
|
|
296
|
+
labelTranslationKey?: string | undefined;
|
|
297
|
+
};
|
|
298
|
+
meta?: {
|
|
299
|
+
schemaVersion: "1.0";
|
|
300
|
+
title?: "Select Box" | undefined;
|
|
301
|
+
usageDescription?: "For questions where users select one option from a list." | undefined;
|
|
302
|
+
defaultJSON?: string | undefined;
|
|
303
|
+
} | undefined;
|
|
304
|
+
}, {
|
|
305
|
+
options: {
|
|
306
|
+
value: string;
|
|
307
|
+
label: string;
|
|
308
|
+
selected?: boolean | undefined;
|
|
309
|
+
}[];
|
|
310
|
+
type: "selectBox";
|
|
311
|
+
attributes: {
|
|
312
|
+
multiple: false;
|
|
313
|
+
label?: string | undefined;
|
|
314
|
+
help?: string | undefined;
|
|
315
|
+
labelTranslationKey?: string | undefined;
|
|
316
|
+
};
|
|
317
|
+
meta?: {
|
|
318
|
+
schemaVersion: "1.0";
|
|
319
|
+
title?: "Select Box" | undefined;
|
|
320
|
+
usageDescription?: "For questions where users select one option from a list." | undefined;
|
|
321
|
+
defaultJSON?: string | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
}>;
|
|
324
|
+
export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
148
325
|
options: z.ZodArray<z.ZodObject<{
|
|
149
326
|
label: z.ZodString;
|
|
150
327
|
value: z.ZodString;
|
|
@@ -159,22 +336,41 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
159
336
|
label: string;
|
|
160
337
|
selected?: boolean | undefined;
|
|
161
338
|
}>, "many">;
|
|
162
|
-
|
|
339
|
+
} & {
|
|
340
|
+
type: z.ZodLiteral<"multiselectBox">;
|
|
341
|
+
attributes: z.ZodObject<{
|
|
163
342
|
label: z.ZodOptional<z.ZodString>;
|
|
164
343
|
help: z.ZodOptional<z.ZodString>;
|
|
165
344
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
166
345
|
} & {
|
|
167
|
-
multiple: z.
|
|
346
|
+
multiple: z.ZodLiteral<true>;
|
|
168
347
|
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
multiple: true;
|
|
169
349
|
label?: string | undefined;
|
|
170
350
|
help?: string | undefined;
|
|
171
351
|
labelTranslationKey?: string | undefined;
|
|
172
|
-
multiple?: boolean | undefined;
|
|
173
352
|
}, {
|
|
353
|
+
multiple: true;
|
|
174
354
|
label?: string | undefined;
|
|
175
355
|
help?: string | undefined;
|
|
176
356
|
labelTranslationKey?: string | undefined;
|
|
177
|
-
|
|
357
|
+
}>;
|
|
358
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
360
|
+
} & {
|
|
361
|
+
title: z.ZodOptional<z.ZodLiteral<"Multi-select Box">>;
|
|
362
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses.">>;
|
|
363
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
364
|
+
}, "strip", z.ZodTypeAny, {
|
|
365
|
+
schemaVersion: "1.0";
|
|
366
|
+
title?: "Multi-select Box" | undefined;
|
|
367
|
+
usageDescription?: "For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses." | undefined;
|
|
368
|
+
defaultJSON?: string | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
schemaVersion: "1.0";
|
|
371
|
+
title?: "Multi-select Box" | undefined;
|
|
372
|
+
usageDescription?: "For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses." | undefined;
|
|
373
|
+
defaultJSON?: string | undefined;
|
|
178
374
|
}>>;
|
|
179
375
|
}, "strip", z.ZodTypeAny, {
|
|
180
376
|
options: {
|
|
@@ -182,15 +378,18 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
182
378
|
label: string;
|
|
183
379
|
selected?: boolean | undefined;
|
|
184
380
|
}[];
|
|
185
|
-
type: "
|
|
186
|
-
attributes
|
|
381
|
+
type: "multiselectBox";
|
|
382
|
+
attributes: {
|
|
383
|
+
multiple: true;
|
|
187
384
|
label?: string | undefined;
|
|
188
385
|
help?: string | undefined;
|
|
189
386
|
labelTranslationKey?: string | undefined;
|
|
190
|
-
|
|
191
|
-
} | undefined;
|
|
387
|
+
};
|
|
192
388
|
meta?: {
|
|
193
389
|
schemaVersion: "1.0";
|
|
390
|
+
title?: "Multi-select Box" | undefined;
|
|
391
|
+
usageDescription?: "For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses." | undefined;
|
|
392
|
+
defaultJSON?: string | undefined;
|
|
194
393
|
} | undefined;
|
|
195
394
|
}, {
|
|
196
395
|
options: {
|
|
@@ -198,17 +397,22 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
198
397
|
label: string;
|
|
199
398
|
selected?: boolean | undefined;
|
|
200
399
|
}[];
|
|
201
|
-
type: "
|
|
202
|
-
attributes
|
|
400
|
+
type: "multiselectBox";
|
|
401
|
+
attributes: {
|
|
402
|
+
multiple: true;
|
|
203
403
|
label?: string | undefined;
|
|
204
404
|
help?: string | undefined;
|
|
205
405
|
labelTranslationKey?: string | undefined;
|
|
206
|
-
|
|
207
|
-
} | undefined;
|
|
406
|
+
};
|
|
208
407
|
meta?: {
|
|
209
408
|
schemaVersion: "1.0";
|
|
409
|
+
title?: "Multi-select Box" | undefined;
|
|
410
|
+
usageDescription?: "For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses." | undefined;
|
|
411
|
+
defaultJSON?: string | undefined;
|
|
210
412
|
} | undefined;
|
|
211
413
|
}>;
|
|
414
|
+
export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
|
|
212
415
|
export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
|
|
213
416
|
export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
|
|
214
417
|
export type SelectBoxQuestionType = z.infer<typeof SelectBoxQuestionSchema>;
|
|
418
|
+
export type MultiselectBoxQuestionType = z.infer<typeof MultiselectBoxQuestionSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = void 0;
|
|
3
|
+
exports.MultiselectBoxQuestionSchema = exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = exports.BooleanQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
// A select box, radio buttons, or checkboxes option
|
|
@@ -9,27 +9,111 @@ const OptionSchema = zod_1.z.object({
|
|
|
9
9
|
value: zod_1.z.string(), // The value of the option
|
|
10
10
|
});
|
|
11
11
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
12
|
+
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
12
13
|
const CheckedOptionSchema = OptionSchema.merge(zod_1.z.object({
|
|
13
14
|
checked: zod_1.z.boolean().optional(),
|
|
14
15
|
}));
|
|
15
16
|
const SelectedOptionSchema = OptionSchema.merge(zod_1.z.object({
|
|
16
17
|
selected: zod_1.z.boolean().optional(),
|
|
17
18
|
}));
|
|
19
|
+
// Yes/No (boolean) question
|
|
20
|
+
const defaultBooleanJSON = {
|
|
21
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { checked: false }),
|
|
22
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
23
|
+
};
|
|
24
|
+
exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
25
|
+
type: zod_1.z.literal('boolean'),
|
|
26
|
+
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
27
|
+
checked: zod_1.z.boolean().optional(),
|
|
28
|
+
})).optional(),
|
|
29
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
30
|
+
title: zod_1.z.literal('Yes/No Field').optional(),
|
|
31
|
+
usageDescription: zod_1.z.literal('For questions that require a simple Yes/No response.').optional(),
|
|
32
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultBooleanJSON, null, 2)).optional(),
|
|
33
|
+
})).optional()
|
|
34
|
+
}));
|
|
18
35
|
// Check boxes question and answer
|
|
36
|
+
const defaultCheckboxesJSON = {
|
|
37
|
+
type: 'checkBoxes',
|
|
38
|
+
attributes: Object.assign({}, question_1.defaultAttributes),
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
label: 'Option 1',
|
|
42
|
+
value: '1',
|
|
43
|
+
checked: false
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
47
|
+
};
|
|
19
48
|
exports.CheckboxesQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
20
49
|
type: zod_1.z.literal('checkBoxes'), // The type of question
|
|
21
|
-
options: zod_1.z.array(CheckedOptionSchema)
|
|
50
|
+
options: zod_1.z.array(CheckedOptionSchema),
|
|
51
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
52
|
+
title: zod_1.z.literal('Check Boxes').optional(),
|
|
53
|
+
usageDescription: zod_1.z.literal('For multiple choice questions where users can select multiple options.').optional(),
|
|
54
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultCheckboxesJSON, null, 2)).optional(),
|
|
55
|
+
})).optional()
|
|
22
56
|
}));
|
|
23
57
|
// Radio buttons question and answer
|
|
58
|
+
const defaultRadioButtonsJSON = {
|
|
59
|
+
type: 'radioButtons',
|
|
60
|
+
attributes: Object.assign({}, question_1.defaultAttributes),
|
|
61
|
+
options: [
|
|
62
|
+
{
|
|
63
|
+
label: 'Option 1',
|
|
64
|
+
value: 'option1',
|
|
65
|
+
selected: false
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
69
|
+
};
|
|
24
70
|
exports.RadioButtonsQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
25
71
|
type: zod_1.z.literal('radioButtons'), // The type of question
|
|
26
|
-
options: zod_1.z.array(SelectedOptionSchema)
|
|
72
|
+
options: zod_1.z.array(SelectedOptionSchema),
|
|
73
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
74
|
+
title: zod_1.z.literal('Radio Buttons').optional(),
|
|
75
|
+
usageDescription: zod_1.z.literal('For multiple choice questions where users select just one option.').optional(),
|
|
76
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultRadioButtonsJSON, null, 2)).optional(),
|
|
77
|
+
})).optional()
|
|
27
78
|
}));
|
|
28
79
|
// Select box question and answer
|
|
80
|
+
const selectBoxAttributes = BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
81
|
+
multiple: zod_1.z.boolean()
|
|
82
|
+
}));
|
|
83
|
+
const defaultSelectBoxJSON = {
|
|
84
|
+
type: 'selectBox',
|
|
85
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { multiple: false }),
|
|
86
|
+
options: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Option 1',
|
|
89
|
+
value: 'option1',
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
93
|
+
};
|
|
29
94
|
exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
30
95
|
type: zod_1.z.literal('selectBox'), // The type of question
|
|
31
96
|
options: zod_1.z.array(SelectedOptionSchema),
|
|
32
|
-
attributes:
|
|
33
|
-
multiple: zod_1.z.
|
|
97
|
+
attributes: selectBoxAttributes.merge(zod_1.z.object({
|
|
98
|
+
multiple: zod_1.z.literal(false) // Whether to allow multiple selections (default is false)
|
|
99
|
+
})),
|
|
100
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
101
|
+
title: zod_1.z.literal('Select Box').optional(),
|
|
102
|
+
usageDescription: zod_1.z.literal('For questions where users select one option from a list.').optional(),
|
|
103
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultSelectBoxJSON, null, 2)).optional(),
|
|
34
104
|
})).optional()
|
|
35
105
|
}));
|
|
106
|
+
// Multi-select box question and answer
|
|
107
|
+
const defaultMultiselectBoxJSON = defaultSelectBoxJSON;
|
|
108
|
+
defaultMultiselectBoxJSON.attributes.multiple = true;
|
|
109
|
+
exports.MultiselectBoxQuestionSchema = exports.SelectBoxQuestionSchema.merge(zod_1.z.object({
|
|
110
|
+
type: zod_1.z.literal('multiselectBox'),
|
|
111
|
+
attributes: selectBoxAttributes.merge(zod_1.z.object({
|
|
112
|
+
multiple: zod_1.z.literal(true) // Whether to allow multiple selections (default is false)
|
|
113
|
+
})),
|
|
114
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
115
|
+
title: zod_1.z.literal('Multi-select Box').optional(),
|
|
116
|
+
usageDescription: zod_1.z.literal('For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses.').optional(),
|
|
117
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultMultiselectBoxJSON, null, 2)).optional(),
|
|
118
|
+
})).optional(),
|
|
119
|
+
}));
|
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const CURRENT_SCHEMA_VERSION = "1.0";
|
|
3
|
-
export declare const QuestionTypesEnum: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "
|
|
3
|
+
export declare const QuestionTypesEnum: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
|
|
4
|
+
export declare const defaultMeta: z.infer<typeof DefaultMetaSchema>;
|
|
5
|
+
export declare const defaultAttributes: z.infer<typeof DefaultAttributesSchema>;
|
|
6
|
+
declare const DefaultMetaSchema: z.ZodObject<{
|
|
7
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
8
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
10
|
+
defaultJSON: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
schemaVersion: "1.0";
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
usageDescription?: string | undefined;
|
|
15
|
+
defaultJSON?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
schemaVersion: "1.0";
|
|
18
|
+
title?: string | undefined;
|
|
19
|
+
usageDescription?: string | undefined;
|
|
20
|
+
defaultJSON?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
declare const DefaultAttributesSchema: z.ZodObject<{
|
|
23
|
+
label: z.ZodOptional<z.ZodString>;
|
|
24
|
+
help: z.ZodOptional<z.ZodString>;
|
|
25
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
label?: string | undefined;
|
|
28
|
+
help?: string | undefined;
|
|
29
|
+
labelTranslationKey?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
label?: string | undefined;
|
|
32
|
+
help?: string | undefined;
|
|
33
|
+
labelTranslationKey?: string | undefined;
|
|
34
|
+
}>;
|
|
4
35
|
export declare const QuestionSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "
|
|
36
|
+
type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
|
|
6
37
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
7
38
|
label: z.ZodOptional<z.ZodString>;
|
|
8
39
|
help: z.ZodOptional<z.ZodString>;
|
|
@@ -18,13 +49,22 @@ export declare const QuestionSchema: z.ZodObject<{
|
|
|
18
49
|
}>>;
|
|
19
50
|
meta: z.ZodOptional<z.ZodObject<{
|
|
20
51
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
52
|
+
title: z.ZodOptional<z.ZodString>;
|
|
53
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
54
|
+
defaultJSON: z.ZodOptional<z.ZodString>;
|
|
21
55
|
}, "strip", z.ZodTypeAny, {
|
|
22
56
|
schemaVersion: "1.0";
|
|
57
|
+
title?: string | undefined;
|
|
58
|
+
usageDescription?: string | undefined;
|
|
59
|
+
defaultJSON?: string | undefined;
|
|
23
60
|
}, {
|
|
24
61
|
schemaVersion: "1.0";
|
|
62
|
+
title?: string | undefined;
|
|
63
|
+
usageDescription?: string | undefined;
|
|
64
|
+
defaultJSON?: string | undefined;
|
|
25
65
|
}>>;
|
|
26
66
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "
|
|
67
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
28
68
|
attributes?: {
|
|
29
69
|
label?: string | undefined;
|
|
30
70
|
help?: string | undefined;
|
|
@@ -32,9 +72,12 @@ export declare const QuestionSchema: z.ZodObject<{
|
|
|
32
72
|
} | undefined;
|
|
33
73
|
meta?: {
|
|
34
74
|
schemaVersion: "1.0";
|
|
75
|
+
title?: string | undefined;
|
|
76
|
+
usageDescription?: string | undefined;
|
|
77
|
+
defaultJSON?: string | undefined;
|
|
35
78
|
} | undefined;
|
|
36
79
|
}, {
|
|
37
|
-
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "
|
|
80
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
38
81
|
attributes?: {
|
|
39
82
|
label?: string | undefined;
|
|
40
83
|
help?: string | undefined;
|
|
@@ -42,6 +85,10 @@ export declare const QuestionSchema: z.ZodObject<{
|
|
|
42
85
|
} | undefined;
|
|
43
86
|
meta?: {
|
|
44
87
|
schemaVersion: "1.0";
|
|
88
|
+
title?: string | undefined;
|
|
89
|
+
usageDescription?: string | undefined;
|
|
90
|
+
defaultJSON?: string | undefined;
|
|
45
91
|
} | undefined;
|
|
46
92
|
}>;
|
|
47
93
|
export type QuestionType = z.infer<typeof QuestionSchema>;
|
|
94
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestionSchema = exports.QuestionTypesEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
|
|
3
|
+
exports.QuestionSchema = exports.defaultAttributes = exports.defaultMeta = exports.QuestionTypesEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.CURRENT_SCHEMA_VERSION = '1.0'; // The current schema version
|
|
6
6
|
// The type of question
|
|
7
7
|
exports.QuestionTypesEnum = zod_1.z.enum([
|
|
8
|
+
'affiliationSearch',
|
|
8
9
|
'boolean',
|
|
9
10
|
'checkBoxes',
|
|
10
11
|
'currency',
|
|
@@ -12,6 +13,7 @@ exports.QuestionTypesEnum = zod_1.z.enum([
|
|
|
12
13
|
'dateRange',
|
|
13
14
|
'email',
|
|
14
15
|
'filteredSearch',
|
|
16
|
+
'multiselectBox',
|
|
15
17
|
'number',
|
|
16
18
|
'numberRange',
|
|
17
19
|
'radioButtons',
|
|
@@ -19,11 +21,21 @@ exports.QuestionTypesEnum = zod_1.z.enum([
|
|
|
19
21
|
'table',
|
|
20
22
|
'text',
|
|
21
23
|
'textArea',
|
|
22
|
-
'typeaheadSearch',
|
|
23
24
|
'url'
|
|
24
25
|
]);
|
|
26
|
+
exports.defaultMeta = {
|
|
27
|
+
schemaVersion: exports.CURRENT_SCHEMA_VERSION,
|
|
28
|
+
};
|
|
29
|
+
exports.defaultAttributes = {
|
|
30
|
+
label: undefined,
|
|
31
|
+
help: undefined,
|
|
32
|
+
labelTranslationKey: undefined,
|
|
33
|
+
};
|
|
25
34
|
const DefaultMetaSchema = zod_1.z.object({
|
|
26
35
|
schemaVersion: zod_1.z.literal(exports.CURRENT_SCHEMA_VERSION), // The schema version (default is CURRENT_SCHEMA_VERSION)
|
|
36
|
+
title: zod_1.z.string().optional(), // The title of the question type
|
|
37
|
+
usageDescription: zod_1.z.string().optional(), // A description of when to use the question type
|
|
38
|
+
defaultJSON: zod_1.z.string().optional(), // A default version of the question
|
|
27
39
|
});
|
|
28
40
|
const DefaultAttributesSchema = zod_1.z.object({
|
|
29
41
|
label: zod_1.z.string().optional(), // UI label for the field
|