@dmptool/types 1.1.1 → 1.1.3

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