@dmptool/types 1.2.6 → 2.0.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 (97) hide show
  1. package/README.md +1 -1
  2. package/dist/answers/__tests__/defaults.spec.js +216 -0
  3. package/dist/answers/answer.d.ts +29 -14
  4. package/dist/answers/answer.js +11 -5
  5. package/dist/answers/dateAnswers.d.ts +20 -47
  6. package/dist/answers/dateAnswers.js +20 -10
  7. package/dist/answers/graphQLAnswers.d.ts +48 -120
  8. package/dist/answers/graphQLAnswers.js +46 -21
  9. package/dist/answers/index.d.ts +155 -1439
  10. package/dist/answers/index.js +26 -1
  11. package/dist/answers/numberAnswers.d.ts +38 -92
  12. package/dist/answers/numberAnswers.js +38 -19
  13. package/dist/answers/optionBasedAnswers.d.ts +42 -87
  14. package/dist/answers/optionBasedAnswers.js +37 -21
  15. package/dist/answers/tableAnswers.d.ts +348 -3032
  16. package/dist/answers/tableAnswers.js +25 -61
  17. package/dist/answers/textAnswers.d.ts +32 -68
  18. package/dist/answers/textAnswers.js +30 -17
  19. package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
  20. package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
  21. package/dist/questions/__tests__/defaults.spec.js +668 -0
  22. package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
  23. package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
  24. package/dist/questions/__tests__/textQuestions.spec.js +32 -0
  25. package/dist/questions/dateQuestions.d.ts +45 -191
  26. package/dist/questions/dateQuestions.js +26 -23
  27. package/dist/questions/graphQLQuestions.d.ts +262 -556
  28. package/dist/questions/graphQLQuestions.js +225 -223
  29. package/dist/questions/index.d.ts +689 -7440
  30. package/dist/questions/index.js +26 -1
  31. package/dist/questions/numberQuestions.d.ts +85 -331
  32. package/dist/questions/numberQuestions.js +50 -36
  33. package/dist/questions/optionBasedQuestions.d.ts +83 -290
  34. package/dist/questions/optionBasedQuestions.js +58 -41
  35. package/dist/questions/question.d.ts +72 -35
  36. package/dist/questions/question.js +14 -5
  37. package/dist/questions/tableQuestions.d.ts +1977 -9646
  38. package/dist/questions/tableQuestions.js +184 -192
  39. package/dist/questions/textQuestions.d.ts +70 -226
  40. package/dist/questions/textQuestions.js +31 -31
  41. package/package.json +4 -5
  42. package/dist/answers/__tests__/usage.spec.js +0 -178
  43. package/dist/questions/__tests__/usage.spec.d.ts +0 -8
  44. package/dist/questions/__tests__/usage.spec.js +0 -473
  45. package/dist/schemas/affiliationSearchAnswer.schema.json +0 -45
  46. package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
  47. package/dist/schemas/anyAnswer.schema.json +0 -605
  48. package/dist/schemas/anyQuestion.schema.json +0 -2455
  49. package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
  50. package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
  51. package/dist/schemas/booleanAnswer.schema.json +0 -34
  52. package/dist/schemas/booleanQuestion.schema.json +0 -56
  53. package/dist/schemas/checkboxesAnswer.schema.json +0 -39
  54. package/dist/schemas/checkboxesQuestion.schema.json +0 -76
  55. package/dist/schemas/currencyAnswer.schema.json +0 -34
  56. package/dist/schemas/currencyQuestion.schema.json +0 -67
  57. package/dist/schemas/dateAnswer.schema.json +0 -34
  58. package/dist/schemas/datePickerAnswer.schema.json +0 -37
  59. package/dist/schemas/datePickerQuestion.schema.json +0 -52
  60. package/dist/schemas/dateQuestion.schema.json +0 -62
  61. package/dist/schemas/dateRangeAnswer.schema.json +0 -45
  62. package/dist/schemas/dateRangeQuestion.schema.json +0 -112
  63. package/dist/schemas/emailAnswer.schema.json +0 -34
  64. package/dist/schemas/emailQuestion.schema.json +0 -66
  65. package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
  66. package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
  67. package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
  68. package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
  69. package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
  70. package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
  71. package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
  72. package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
  73. package/dist/schemas/numberAnswer.schema.json +0 -34
  74. package/dist/schemas/numberQuestion.schema.json +0 -63
  75. package/dist/schemas/numberRangeAnswer.schema.json +0 -45
  76. package/dist/schemas/numberRangeQuestion.schema.json +0 -94
  77. package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
  78. package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
  79. package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
  80. package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
  81. package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
  82. package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
  83. package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
  84. package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
  85. package/dist/schemas/selectBoxAnswer.schema.json +0 -34
  86. package/dist/schemas/selectBoxQuestion.schema.json +0 -85
  87. package/dist/schemas/tableAnswer.schema.json +0 -519
  88. package/dist/schemas/tableQuestion.schema.json +0 -1183
  89. package/dist/schemas/textAnswer.schema.json +0 -34
  90. package/dist/schemas/textAreaAnswer.schema.json +0 -34
  91. package/dist/schemas/textAreaQuestion.schema.json +0 -70
  92. package/dist/schemas/textQuestion.schema.json +0 -62
  93. package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
  94. package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
  95. package/dist/schemas/urlAnswer.schema.json +0 -34
  96. package/dist/schemas/urlQuestion.schema.json +0 -62
  97. /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
@@ -1,114 +1,53 @@
1
1
  import { z } from "zod";
2
2
  export declare const BooleanQuestionSchema: z.ZodObject<{
3
- meta: z.ZodDefault<z.ZodObject<{
3
+ type: z.ZodLiteral<"boolean">;
4
+ attributes: z.ZodObject<{
5
+ label: z.ZodString;
6
+ value: z.ZodDefault<z.ZodBoolean>;
7
+ }, z.core.$strip>;
8
+ meta: z.ZodObject<{
4
9
  schemaVersion: z.ZodDefault<z.ZodString>;
5
10
  title: z.ZodOptional<z.ZodString>;
6
11
  usageDescription: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- schemaVersion: string;
9
- title?: string | undefined;
10
- usageDescription?: string | undefined;
11
- }, {
12
- schemaVersion?: string | undefined;
13
- title?: string | undefined;
14
- usageDescription?: string | undefined;
15
- }>>;
16
- } & {
17
- type: z.ZodLiteral<"boolean">;
18
- attributes: z.ZodDefault<z.ZodObject<{
19
- label: z.ZodOptional<z.ZodString>;
20
- help: z.ZodOptional<z.ZodString>;
21
- labelTranslationKey: z.ZodOptional<z.ZodString>;
22
- } & {
23
- checked: z.ZodDefault<z.ZodBoolean>;
24
- }, "strip", z.ZodTypeAny, {
25
- checked: boolean;
26
- label?: string | undefined;
27
- help?: string | undefined;
28
- labelTranslationKey?: string | undefined;
29
- }, {
30
- label?: string | undefined;
31
- help?: string | undefined;
32
- labelTranslationKey?: string | undefined;
33
- checked?: boolean | undefined;
34
- }>>;
35
- }, "strip", z.ZodTypeAny, {
12
+ }, z.core.$strip>;
13
+ }, z.core.$strip>;
14
+ export declare const DefaultBooleanQuestion: {
36
15
  type: "boolean";
37
16
  attributes: {
38
- checked: boolean;
39
- label?: string | undefined;
40
- help?: string | undefined;
41
- labelTranslationKey?: string | undefined;
17
+ label: string;
18
+ value: boolean;
42
19
  };
43
20
  meta: {
44
21
  schemaVersion: string;
45
22
  title?: string | undefined;
46
23
  usageDescription?: string | undefined;
47
24
  };
48
- }, {
49
- type: "boolean";
50
- attributes?: {
51
- label?: string | undefined;
52
- help?: string | undefined;
53
- labelTranslationKey?: string | undefined;
54
- checked?: boolean | undefined;
55
- } | undefined;
56
- meta?: {
57
- schemaVersion?: string | undefined;
58
- title?: string | undefined;
59
- usageDescription?: string | undefined;
60
- } | undefined;
61
- }>;
25
+ };
62
26
  export declare const CheckboxesQuestionSchema: z.ZodObject<{
63
- meta: z.ZodDefault<z.ZodObject<{
64
- schemaVersion: z.ZodDefault<z.ZodString>;
65
- title: z.ZodOptional<z.ZodString>;
66
- usageDescription: z.ZodOptional<z.ZodString>;
67
- }, "strip", z.ZodTypeAny, {
68
- schemaVersion: string;
69
- title?: string | undefined;
70
- usageDescription?: string | undefined;
71
- }, {
72
- schemaVersion?: string | undefined;
73
- title?: string | undefined;
74
- usageDescription?: string | undefined;
75
- }>>;
76
- } & {
77
27
  type: z.ZodLiteral<"checkBoxes">;
78
- options: z.ZodDefault<z.ZodArray<z.ZodObject<{
28
+ options: z.ZodArray<z.ZodObject<{
29
+ checked: z.ZodDefault<z.ZodBoolean>;
79
30
  label: z.ZodDefault<z.ZodString>;
80
31
  value: z.ZodDefault<z.ZodString>;
81
- } & {
82
- checked: z.ZodDefault<z.ZodBoolean>;
83
- }, "strip", z.ZodTypeAny, {
84
- value: string;
85
- label: string;
86
- checked: boolean;
87
- }, {
88
- value?: string | undefined;
89
- label?: string | undefined;
90
- checked?: boolean | undefined;
91
- }>, "many">>;
92
- attributes: z.ZodDefault<z.ZodObject<{
32
+ }, z.core.$strip>>;
33
+ attributes: z.ZodObject<{
93
34
  label: z.ZodOptional<z.ZodString>;
94
35
  help: z.ZodOptional<z.ZodString>;
95
36
  labelTranslationKey: z.ZodOptional<z.ZodString>;
96
- }, "strip", z.ZodTypeAny, {
97
- label?: string | undefined;
98
- help?: string | undefined;
99
- labelTranslationKey?: string | undefined;
100
- }, {
101
- label?: string | undefined;
102
- help?: string | undefined;
103
- labelTranslationKey?: string | undefined;
104
- }>>;
105
- }, "strip", z.ZodTypeAny, {
37
+ }, z.core.$strip>;
38
+ meta: z.ZodObject<{
39
+ schemaVersion: z.ZodDefault<z.ZodString>;
40
+ title: z.ZodOptional<z.ZodString>;
41
+ usageDescription: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>;
43
+ }, z.core.$strip>;
44
+ export declare const DefaultCheckboxesQuestion: {
45
+ type: "checkBoxes";
106
46
  options: {
107
- value: string;
108
- label: string;
109
47
  checked: boolean;
48
+ label: string;
49
+ value: string;
110
50
  }[];
111
- type: "checkBoxes";
112
51
  attributes: {
113
52
  label?: string | undefined;
114
53
  help?: string | undefined;
@@ -119,74 +58,32 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
119
58
  title?: string | undefined;
120
59
  usageDescription?: string | undefined;
121
60
  };
122
- }, {
123
- type: "checkBoxes";
124
- options?: {
125
- value?: string | undefined;
126
- label?: string | undefined;
127
- checked?: boolean | undefined;
128
- }[] | undefined;
129
- attributes?: {
130
- label?: string | undefined;
131
- help?: string | undefined;
132
- labelTranslationKey?: string | undefined;
133
- } | undefined;
134
- meta?: {
135
- schemaVersion?: string | undefined;
136
- title?: string | undefined;
137
- usageDescription?: string | undefined;
138
- } | undefined;
139
- }>;
61
+ };
140
62
  export declare const RadioButtonsQuestionSchema: z.ZodObject<{
141
- meta: z.ZodDefault<z.ZodObject<{
142
- schemaVersion: z.ZodDefault<z.ZodString>;
143
- title: z.ZodOptional<z.ZodString>;
144
- usageDescription: z.ZodOptional<z.ZodString>;
145
- }, "strip", z.ZodTypeAny, {
146
- schemaVersion: string;
147
- title?: string | undefined;
148
- usageDescription?: string | undefined;
149
- }, {
150
- schemaVersion?: string | undefined;
151
- title?: string | undefined;
152
- usageDescription?: string | undefined;
153
- }>>;
154
- } & {
155
63
  type: z.ZodLiteral<"radioButtons">;
156
- options: z.ZodDefault<z.ZodArray<z.ZodObject<{
64
+ options: z.ZodArray<z.ZodObject<{
65
+ selected: z.ZodDefault<z.ZodBoolean>;
157
66
  label: z.ZodDefault<z.ZodString>;
158
67
  value: z.ZodDefault<z.ZodString>;
159
- } & {
160
- selected: z.ZodDefault<z.ZodBoolean>;
161
- }, "strip", z.ZodTypeAny, {
162
- value: string;
163
- label: string;
164
- selected: boolean;
165
- }, {
166
- value?: string | undefined;
167
- label?: string | undefined;
168
- selected?: boolean | undefined;
169
- }>, "many">>;
170
- attributes: z.ZodDefault<z.ZodObject<{
68
+ }, z.core.$strip>>;
69
+ attributes: z.ZodObject<{
171
70
  label: z.ZodOptional<z.ZodString>;
172
71
  help: z.ZodOptional<z.ZodString>;
173
72
  labelTranslationKey: z.ZodOptional<z.ZodString>;
174
- }, "strip", z.ZodTypeAny, {
175
- label?: string | undefined;
176
- help?: string | undefined;
177
- labelTranslationKey?: string | undefined;
178
- }, {
179
- label?: string | undefined;
180
- help?: string | undefined;
181
- labelTranslationKey?: string | undefined;
182
- }>>;
183
- }, "strip", z.ZodTypeAny, {
73
+ }, z.core.$strip>;
74
+ meta: z.ZodObject<{
75
+ schemaVersion: z.ZodDefault<z.ZodString>;
76
+ title: z.ZodOptional<z.ZodString>;
77
+ usageDescription: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ }, z.core.$strip>;
80
+ export declare const DefaultRadioButtonsQuestion: {
81
+ type: "radioButtons";
184
82
  options: {
185
- value: string;
186
- label: string;
187
83
  selected: boolean;
84
+ label: string;
85
+ value: string;
188
86
  }[];
189
- type: "radioButtons";
190
87
  attributes: {
191
88
  label?: string | undefined;
192
89
  help?: string | undefined;
@@ -197,78 +94,33 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
197
94
  title?: string | undefined;
198
95
  usageDescription?: string | undefined;
199
96
  };
200
- }, {
201
- type: "radioButtons";
202
- options?: {
203
- value?: string | undefined;
204
- label?: string | undefined;
205
- selected?: boolean | undefined;
206
- }[] | undefined;
207
- attributes?: {
208
- label?: string | undefined;
209
- help?: string | undefined;
210
- labelTranslationKey?: string | undefined;
211
- } | undefined;
212
- meta?: {
213
- schemaVersion?: string | undefined;
214
- title?: string | undefined;
215
- usageDescription?: string | undefined;
216
- } | undefined;
217
- }>;
97
+ };
218
98
  export declare const SelectBoxQuestionSchema: z.ZodObject<{
219
- meta: z.ZodDefault<z.ZodObject<{
220
- schemaVersion: z.ZodDefault<z.ZodString>;
221
- title: z.ZodOptional<z.ZodString>;
222
- usageDescription: z.ZodOptional<z.ZodString>;
223
- }, "strip", z.ZodTypeAny, {
224
- schemaVersion: string;
225
- title?: string | undefined;
226
- usageDescription?: string | undefined;
227
- }, {
228
- schemaVersion?: string | undefined;
229
- title?: string | undefined;
230
- usageDescription?: string | undefined;
231
- }>>;
232
- } & {
233
99
  type: z.ZodLiteral<"selectBox">;
234
- options: z.ZodDefault<z.ZodArray<z.ZodObject<{
100
+ options: z.ZodArray<z.ZodObject<{
101
+ selected: z.ZodDefault<z.ZodBoolean>;
235
102
  label: z.ZodDefault<z.ZodString>;
236
103
  value: z.ZodDefault<z.ZodString>;
237
- } & {
238
- selected: z.ZodDefault<z.ZodBoolean>;
239
- }, "strip", z.ZodTypeAny, {
240
- value: string;
241
- label: string;
242
- selected: boolean;
243
- }, {
244
- value?: string | undefined;
245
- label?: string | undefined;
246
- selected?: boolean | undefined;
247
- }>, "many">>;
248
- attributes: z.ZodDefault<z.ZodObject<{
104
+ }, z.core.$strip>>;
105
+ attributes: z.ZodObject<{
106
+ multiple: z.ZodLiteral<false>;
249
107
  label: z.ZodOptional<z.ZodString>;
250
108
  help: z.ZodOptional<z.ZodString>;
251
109
  labelTranslationKey: z.ZodOptional<z.ZodString>;
252
- } & {
253
- multiple: z.ZodLiteral<false>;
254
- }, "strip", z.ZodTypeAny, {
255
- multiple: false;
256
- label?: string | undefined;
257
- help?: string | undefined;
258
- labelTranslationKey?: string | undefined;
259
- }, {
260
- multiple: false;
261
- label?: string | undefined;
262
- help?: string | undefined;
263
- labelTranslationKey?: string | undefined;
264
- }>>;
265
- }, "strip", z.ZodTypeAny, {
110
+ }, z.core.$strip>;
111
+ meta: z.ZodObject<{
112
+ schemaVersion: z.ZodDefault<z.ZodString>;
113
+ title: z.ZodOptional<z.ZodString>;
114
+ usageDescription: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>;
116
+ }, z.core.$strip>;
117
+ export declare const DefaultSelectBoxQuestion: {
118
+ type: "selectBox";
266
119
  options: {
267
- value: string;
268
- label: string;
269
120
  selected: boolean;
121
+ label: string;
122
+ value: string;
270
123
  }[];
271
- type: "selectBox";
272
124
  attributes: {
273
125
  multiple: false;
274
126
  label?: string | undefined;
@@ -280,79 +132,33 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
280
132
  title?: string | undefined;
281
133
  usageDescription?: string | undefined;
282
134
  };
283
- }, {
284
- type: "selectBox";
285
- options?: {
286
- value?: string | undefined;
287
- label?: string | undefined;
288
- selected?: boolean | undefined;
289
- }[] | undefined;
290
- attributes?: {
291
- multiple: false;
292
- label?: string | undefined;
293
- help?: string | undefined;
294
- labelTranslationKey?: string | undefined;
295
- } | undefined;
296
- meta?: {
297
- schemaVersion?: string | undefined;
298
- title?: string | undefined;
299
- usageDescription?: string | undefined;
300
- } | undefined;
301
- }>;
135
+ };
302
136
  export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
303
- meta: z.ZodDefault<z.ZodObject<{
304
- schemaVersion: z.ZodDefault<z.ZodString>;
305
- title: z.ZodOptional<z.ZodString>;
306
- usageDescription: z.ZodOptional<z.ZodString>;
307
- }, "strip", z.ZodTypeAny, {
308
- schemaVersion: string;
309
- title?: string | undefined;
310
- usageDescription?: string | undefined;
311
- }, {
312
- schemaVersion?: string | undefined;
313
- title?: string | undefined;
314
- usageDescription?: string | undefined;
315
- }>>;
316
- } & {
317
137
  type: z.ZodLiteral<"multiselectBox">;
318
- options: z.ZodDefault<z.ZodArray<z.ZodObject<{
138
+ options: z.ZodArray<z.ZodObject<{
139
+ selected: z.ZodDefault<z.ZodBoolean>;
319
140
  label: z.ZodDefault<z.ZodString>;
320
141
  value: z.ZodDefault<z.ZodString>;
321
- } & {
322
- selected: z.ZodDefault<z.ZodBoolean>;
323
- }, "strip", z.ZodTypeAny, {
324
- value: string;
325
- label: string;
326
- selected: boolean;
327
- }, {
328
- value?: string | undefined;
329
- label?: string | undefined;
330
- selected?: boolean | undefined;
331
- }>, "many">>;
332
- attributes: z.ZodDefault<z.ZodObject<{
142
+ }, z.core.$strip>>;
143
+ attributes: z.ZodObject<{
144
+ multiple: z.ZodLiteral<true>;
333
145
  label: z.ZodOptional<z.ZodString>;
334
146
  help: z.ZodOptional<z.ZodString>;
335
147
  labelTranslationKey: z.ZodOptional<z.ZodString>;
336
- } & {
337
- multiple: z.ZodLiteral<true>;
338
- }, "strip", z.ZodTypeAny, {
339
- multiple: true;
340
- label?: string | undefined;
341
- help?: string | undefined;
342
- labelTranslationKey?: string | undefined;
343
- }, {
344
- multiple: true;
345
- label?: string | undefined;
346
- help?: string | undefined;
347
- labelTranslationKey?: string | undefined;
348
- }>>;
349
- }, "strip", z.ZodTypeAny, {
148
+ }, z.core.$strip>;
149
+ meta: z.ZodObject<{
150
+ schemaVersion: z.ZodDefault<z.ZodString>;
151
+ title: z.ZodOptional<z.ZodString>;
152
+ usageDescription: z.ZodOptional<z.ZodString>;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ export declare const DefaultMultiselectBoxQuestion: {
156
+ type: "multiselectBox";
350
157
  options: {
351
- value: string;
352
- label: string;
353
158
  selected: boolean;
159
+ label: string;
160
+ value: string;
354
161
  }[];
355
- type: "multiselectBox";
356
162
  attributes: {
357
163
  multiple: true;
358
164
  label?: string | undefined;
@@ -364,27 +170,14 @@ export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
364
170
  title?: string | undefined;
365
171
  usageDescription?: string | undefined;
366
172
  };
367
- }, {
368
- type: "multiselectBox";
369
- options?: {
370
- value?: string | undefined;
371
- label?: string | undefined;
372
- selected?: boolean | undefined;
373
- }[] | undefined;
374
- attributes?: {
375
- multiple: true;
376
- label?: string | undefined;
377
- help?: string | undefined;
378
- labelTranslationKey?: string | undefined;
379
- } | undefined;
380
- meta?: {
381
- schemaVersion?: string | undefined;
382
- title?: string | undefined;
383
- usageDescription?: string | undefined;
384
- } | undefined;
385
- }>;
173
+ };
386
174
  export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
387
175
  export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
388
176
  export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
389
177
  export type SelectBoxQuestionType = z.infer<typeof SelectBoxQuestionSchema>;
390
178
  export type MultiselectBoxQuestionType = z.infer<typeof MultiselectBoxQuestionSchema>;
179
+ export declare const BooleanQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
180
+ export declare const CheckboxesQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
181
+ export declare const RadioButtonsQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
182
+ export declare const SelectBoxQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
183
+ export declare const MultiselectBoxQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
@@ -1,55 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultiselectBoxQuestionSchema = exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = exports.BooleanQuestionSchema = void 0;
3
+ exports.MultiselectBoxQuestionJSONSchema = exports.SelectBoxQuestionJSONSchema = exports.RadioButtonsQuestionJSONSchema = exports.CheckboxesQuestionJSONSchema = exports.BooleanQuestionJSONSchema = exports.DefaultMultiselectBoxQuestion = exports.MultiselectBoxQuestionSchema = exports.DefaultSelectBoxQuestion = exports.SelectBoxQuestionSchema = exports.DefaultRadioButtonsQuestion = exports.RadioButtonsQuestionSchema = exports.DefaultCheckboxesQuestion = exports.CheckboxesQuestionSchema = exports.DefaultBooleanQuestion = exports.BooleanQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
- const BaseAttributes = question_1.QuestionSchema.shape.attributes;
7
6
  // A select box, radio buttons, or checkboxes option
8
7
  const OptionSchema = zod_1.z.object({
9
8
  label: zod_1.z.string().default('Option A'),
10
9
  value: zod_1.z.string().default('a'),
11
10
  });
12
- const CheckedOptionSchema = OptionSchema.merge(zod_1.z.object({
13
- checked: zod_1.z.boolean().default(false),
14
- }));
15
- const SelectedOptionSchema = OptionSchema.merge(zod_1.z.object({
16
- selected: zod_1.z.boolean().default(false),
17
- }));
18
- const selectBoxAttributes = BaseAttributes.merge(zod_1.z.object({
19
- multiple: zod_1.z.boolean().default(false)
20
- }));
11
+ const CheckedOptionSchema = zod_1.z.object(Object.assign(Object.assign({}, OptionSchema.shape), { checked: zod_1.z.boolean().default(false) }));
12
+ const DefaultCheckedOption = CheckedOptionSchema.parse({});
13
+ const SelectedOptionSchema = zod_1.z.object(Object.assign(Object.assign({}, OptionSchema.shape), { selected: zod_1.z.boolean().default(false) }));
14
+ const DefaultSelectedOption = SelectedOptionSchema.parse({});
15
+ const selectBoxAttributes = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { multiple: zod_1.z.literal(false) }));
16
+ const DefaultSelectBoxAttributes = selectBoxAttributes.parse({
17
+ multiple: false
18
+ });
21
19
  // Yes/No (boolean) question
22
- exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
23
- type: zod_1.z.literal('boolean'),
24
- attributes: BaseAttributes.merge(zod_1.z.object({
25
- checked: zod_1.z.boolean().default(false),
26
- })).default({})
27
- }));
20
+ exports.BooleanQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('boolean'), attributes: zod_1.z.object({
21
+ label: zod_1.z.string(),
22
+ value: zod_1.z.boolean().default(false),
23
+ }) }));
24
+ exports.DefaultBooleanQuestion = exports.BooleanQuestionSchema.parse({
25
+ type: 'boolean',
26
+ attributes: {
27
+ label: 'Is it true?',
28
+ value: false,
29
+ },
30
+ meta: question_1.DefaultMeta
31
+ });
28
32
  // Check boxes question and answer
29
- exports.CheckboxesQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
30
- type: zod_1.z.literal('checkBoxes'),
31
- options: zod_1.z.array(CheckedOptionSchema).default([{}]),
32
- attributes: BaseAttributes.default({}),
33
- }));
33
+ exports.CheckboxesQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('checkBoxes'), options: zod_1.z.array(CheckedOptionSchema) }));
34
+ exports.DefaultCheckboxesQuestion = exports.CheckboxesQuestionSchema.parse({
35
+ type: 'checkBoxes',
36
+ attributes: CheckedOptionSchema,
37
+ meta: question_1.DefaultMeta,
38
+ options: [DefaultCheckedOption]
39
+ });
34
40
  // Radio buttons question and answer
35
- exports.RadioButtonsQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
36
- type: zod_1.z.literal('radioButtons'),
37
- options: zod_1.z.array(SelectedOptionSchema).default([{}]),
38
- attributes: BaseAttributes.default({})
39
- }));
41
+ exports.RadioButtonsQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('radioButtons'), options: zod_1.z.array(SelectedOptionSchema) }));
42
+ exports.DefaultRadioButtonsQuestion = exports.RadioButtonsQuestionSchema.parse({
43
+ type: 'radioButtons',
44
+ attributes: DefaultSelectBoxAttributes,
45
+ meta: question_1.DefaultMeta,
46
+ options: [DefaultSelectedOption]
47
+ });
40
48
  // Select box question and answer
41
- exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
42
- type: zod_1.z.literal('selectBox'),
43
- options: zod_1.z.array(SelectedOptionSchema).default([{}]),
44
- attributes: selectBoxAttributes.merge(zod_1.z.object({
45
- multiple: zod_1.z.literal(false)
46
- })).default({ multiple: false })
47
- }));
49
+ exports.SelectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('selectBox'), options: zod_1.z.array(SelectedOptionSchema), attributes: selectBoxAttributes }));
50
+ exports.DefaultSelectBoxQuestion = exports.SelectBoxQuestionSchema.parse({
51
+ type: 'selectBox',
52
+ attributes: DefaultSelectBoxAttributes,
53
+ meta: question_1.DefaultMeta,
54
+ options: [DefaultSelectedOption]
55
+ });
56
+ const multiselectBoxAttributes = zod_1.z.object(Object.assign(Object.assign({}, selectBoxAttributes.shape), { multiple: zod_1.z.literal(true) }));
57
+ const DefaultMultiselectBoxAttributes = multiselectBoxAttributes.parse({
58
+ multiple: true
59
+ });
48
60
  // Multi-select box question and answer
49
- exports.MultiselectBoxQuestionSchema = exports.SelectBoxQuestionSchema.merge(zod_1.z.object({
50
- type: zod_1.z.literal('multiselectBox'),
51
- options: zod_1.z.array(SelectedOptionSchema).default([{}]),
52
- attributes: selectBoxAttributes.merge(zod_1.z.object({
53
- multiple: zod_1.z.literal(true)
54
- })).default({ multiple: true })
55
- }));
61
+ exports.MultiselectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, exports.SelectBoxQuestionSchema.shape), { type: zod_1.z.literal('multiselectBox'), options: zod_1.z.array(SelectedOptionSchema), attributes: multiselectBoxAttributes }));
62
+ exports.DefaultMultiselectBoxQuestion = exports.MultiselectBoxQuestionSchema.parse({
63
+ type: 'multiselectBox',
64
+ attributes: DefaultMultiselectBoxAttributes,
65
+ meta: question_1.DefaultMeta,
66
+ options: [DefaultSelectedOption]
67
+ });
68
+ exports.BooleanQuestionJSONSchema = zod_1.z.toJSONSchema(exports.BooleanQuestionSchema);
69
+ exports.CheckboxesQuestionJSONSchema = zod_1.z.toJSONSchema(exports.CheckboxesQuestionSchema);
70
+ exports.RadioButtonsQuestionJSONSchema = zod_1.z.toJSONSchema(exports.RadioButtonsQuestionSchema);
71
+ exports.SelectBoxQuestionJSONSchema = zod_1.z.toJSONSchema(exports.SelectBoxQuestionSchema);
72
+ exports.MultiselectBoxQuestionJSONSchema = zod_1.z.toJSONSchema(exports.MultiselectBoxQuestionSchema);