@dmptool/types 1.1.2 → 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 (37) hide show
  1. package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -4
  2. package/dist/questions/__tests__/optionBasedQuestions.spec.js +4 -12
  3. package/dist/questions/dateQuestions.d.ts +31 -41
  4. package/dist/questions/dateQuestions.js +5 -20
  5. package/dist/questions/graphQLQuestions.d.ts +75 -81
  6. package/dist/questions/graphQLQuestions.js +18 -24
  7. package/dist/questions/index.d.ts +524 -723
  8. package/dist/questions/numberQuestions.d.ts +51 -66
  9. package/dist/questions/numberQuestions.js +6 -28
  10. package/dist/questions/optionBasedQuestions.d.ts +44 -69
  11. package/dist/questions/optionBasedQuestions.js +7 -55
  12. package/dist/questions/question.d.ts +0 -8
  13. package/dist/questions/question.js +0 -1
  14. package/dist/questions/tableQuestions.d.ts +717 -998
  15. package/dist/questions/tableQuestions.js +3 -10
  16. package/dist/questions/textQuestions.d.ts +21 -41
  17. package/dist/questions/textQuestions.js +10 -34
  18. package/dist/schemas/affiliationSearchQuestion.schema.json +39 -26
  19. package/dist/schemas/anyQuestion.schema.json +152 -119
  20. package/dist/schemas/anyTableColumnQuestion.schema.json +142 -104
  21. package/dist/schemas/booleanQuestion.schema.json +2 -5
  22. package/dist/schemas/checkboxesQuestion.schema.json +6 -11
  23. package/dist/schemas/currencyQuestion.schema.json +6 -7
  24. package/dist/schemas/dateQuestion.schema.json +2 -5
  25. package/dist/schemas/dateRangeQuestion.schema.json +6 -5
  26. package/dist/schemas/emailQuestion.schema.json +4 -6
  27. package/dist/schemas/filteredSearchQuestion.schema.json +0 -3
  28. package/dist/schemas/multiselectBoxQuestion.schema.json +6 -11
  29. package/dist/schemas/numberQuestion.schema.json +4 -6
  30. package/dist/schemas/numberRangeQuestion.schema.json +8 -6
  31. package/dist/schemas/radioButtonsQuestion.schema.json +6 -11
  32. package/dist/schemas/selectBoxQuestion.schema.json +7 -15
  33. package/dist/schemas/tableQuestion.schema.json +148 -111
  34. package/dist/schemas/textAreaQuestion.schema.json +6 -7
  35. package/dist/schemas/textQuestion.schema.json +2 -5
  36. package/dist/schemas/urlQuestion.schema.json +2 -5
  37. package/package.json +1 -1
@@ -7,18 +7,18 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
7
7
  labelTranslationKey: z.ZodOptional<z.ZodString>;
8
8
  } & {
9
9
  max: z.ZodOptional<z.ZodNumber>;
10
- min: z.ZodOptional<z.ZodNumber>;
11
- step: z.ZodOptional<z.ZodNumber>;
10
+ min: z.ZodDefault<z.ZodNumber>;
11
+ step: z.ZodDefault<z.ZodNumber>;
12
12
  } & {
13
- denomination: z.ZodOptional<z.ZodString>;
13
+ denomination: z.ZodDefault<z.ZodString>;
14
14
  }, "strip", z.ZodTypeAny, {
15
+ min: number;
16
+ step: number;
17
+ denomination: string;
15
18
  label?: string | undefined;
16
19
  help?: string | undefined;
17
20
  labelTranslationKey?: string | undefined;
18
21
  max?: number | undefined;
19
- min?: number | undefined;
20
- step?: number | undefined;
21
- denomination?: string | undefined;
22
22
  }, {
23
23
  label?: string | undefined;
24
24
  help?: string | undefined;
@@ -33,34 +33,30 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
33
33
  } & {
34
34
  title: z.ZodOptional<z.ZodLiteral<"Currency Field">>;
35
35
  usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a monetary amount (e.g. Cost or Budget).">>;
36
- defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
37
36
  }, "strip", z.ZodTypeAny, {
38
37
  schemaVersion: "1.0";
39
38
  title?: "Currency Field" | undefined;
40
39
  usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
41
- defaultJSON?: string | undefined;
42
40
  }, {
43
41
  schemaVersion: "1.0";
44
42
  title?: "Currency Field" | undefined;
45
43
  usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
46
- defaultJSON?: string | undefined;
47
44
  }>>;
48
45
  }, "strip", z.ZodTypeAny, {
49
46
  type: "currency";
50
47
  attributes?: {
48
+ min: number;
49
+ step: number;
50
+ denomination: string;
51
51
  label?: string | undefined;
52
52
  help?: string | undefined;
53
53
  labelTranslationKey?: string | undefined;
54
54
  max?: number | undefined;
55
- min?: number | undefined;
56
- step?: number | undefined;
57
- denomination?: string | undefined;
58
55
  } | undefined;
59
56
  meta?: {
60
57
  schemaVersion: "1.0";
61
58
  title?: "Currency Field" | undefined;
62
59
  usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
63
- defaultJSON?: string | undefined;
64
60
  } | undefined;
65
61
  }, {
66
62
  type: "currency";
@@ -77,7 +73,6 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
77
73
  schemaVersion: "1.0";
78
74
  title?: "Currency Field" | undefined;
79
75
  usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
80
- defaultJSON?: string | undefined;
81
76
  } | undefined;
82
77
  }>;
83
78
  export declare const NumberQuestionSchema: z.ZodObject<{} & {
@@ -88,15 +83,15 @@ export declare const NumberQuestionSchema: z.ZodObject<{} & {
88
83
  labelTranslationKey: z.ZodOptional<z.ZodString>;
89
84
  } & {
90
85
  max: z.ZodOptional<z.ZodNumber>;
91
- min: z.ZodOptional<z.ZodNumber>;
92
- step: z.ZodOptional<z.ZodNumber>;
86
+ min: z.ZodDefault<z.ZodNumber>;
87
+ step: z.ZodDefault<z.ZodNumber>;
93
88
  }, "strip", z.ZodTypeAny, {
89
+ min: number;
90
+ step: number;
94
91
  label?: string | undefined;
95
92
  help?: string | undefined;
96
93
  labelTranslationKey?: string | undefined;
97
94
  max?: number | undefined;
98
- min?: number | undefined;
99
- step?: number | undefined;
100
95
  }, {
101
96
  label?: string | undefined;
102
97
  help?: string | undefined;
@@ -110,33 +105,29 @@ export declare const NumberQuestionSchema: z.ZodObject<{} & {
110
105
  } & {
111
106
  title: z.ZodOptional<z.ZodLiteral<"Number Field">>;
112
107
  usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a single numeric value.">>;
113
- defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
114
108
  }, "strip", z.ZodTypeAny, {
115
109
  schemaVersion: "1.0";
116
110
  title?: "Number Field" | undefined;
117
111
  usageDescription?: "For questions that require a single numeric value." | undefined;
118
- defaultJSON?: string | undefined;
119
112
  }, {
120
113
  schemaVersion: "1.0";
121
114
  title?: "Number Field" | undefined;
122
115
  usageDescription?: "For questions that require a single numeric value." | undefined;
123
- defaultJSON?: string | undefined;
124
116
  }>>;
125
117
  }, "strip", z.ZodTypeAny, {
126
118
  type: "number";
127
119
  attributes?: {
120
+ min: number;
121
+ step: number;
128
122
  label?: string | undefined;
129
123
  help?: string | undefined;
130
124
  labelTranslationKey?: string | undefined;
131
125
  max?: number | undefined;
132
- min?: number | undefined;
133
- step?: number | undefined;
134
126
  } | undefined;
135
127
  meta?: {
136
128
  schemaVersion: "1.0";
137
129
  title?: "Number Field" | undefined;
138
130
  usageDescription?: "For questions that require a single numeric value." | undefined;
139
- defaultJSON?: string | undefined;
140
131
  } | undefined;
141
132
  }, {
142
133
  type: "number";
@@ -152,7 +143,6 @@ export declare const NumberQuestionSchema: z.ZodObject<{} & {
152
143
  schemaVersion: "1.0";
153
144
  title?: "Number Field" | undefined;
154
145
  usageDescription?: "For questions that require a single numeric value." | undefined;
155
- defaultJSON?: string | undefined;
156
146
  } | undefined;
157
147
  }>;
158
148
  export declare const NumberRangeQuestionSchema: z.ZodObject<{
@@ -172,21 +162,21 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
172
162
  } & {
173
163
  type: z.ZodLiteral<"numberRange">;
174
164
  columns: z.ZodObject<{
175
- start: z.ZodOptional<z.ZodObject<{
165
+ start: z.ZodObject<{
176
166
  label: z.ZodOptional<z.ZodString>;
177
167
  help: z.ZodOptional<z.ZodString>;
178
168
  labelTranslationKey: z.ZodOptional<z.ZodString>;
179
169
  } & {
180
170
  max: z.ZodOptional<z.ZodNumber>;
181
- min: z.ZodOptional<z.ZodNumber>;
182
- step: z.ZodOptional<z.ZodNumber>;
171
+ min: z.ZodDefault<z.ZodNumber>;
172
+ step: z.ZodDefault<z.ZodNumber>;
183
173
  }, "strip", z.ZodTypeAny, {
174
+ min: number;
175
+ step: number;
184
176
  label?: string | undefined;
185
177
  help?: string | undefined;
186
178
  labelTranslationKey?: string | undefined;
187
179
  max?: number | undefined;
188
- min?: number | undefined;
189
- step?: number | undefined;
190
180
  }, {
191
181
  label?: string | undefined;
192
182
  help?: string | undefined;
@@ -194,22 +184,22 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
194
184
  max?: number | undefined;
195
185
  min?: number | undefined;
196
186
  step?: number | undefined;
197
- }>>;
198
- end: z.ZodOptional<z.ZodObject<{
187
+ }>;
188
+ end: z.ZodObject<{
199
189
  label: z.ZodOptional<z.ZodString>;
200
190
  help: z.ZodOptional<z.ZodString>;
201
191
  labelTranslationKey: z.ZodOptional<z.ZodString>;
202
192
  } & {
203
193
  max: z.ZodOptional<z.ZodNumber>;
204
- min: z.ZodOptional<z.ZodNumber>;
205
- step: z.ZodOptional<z.ZodNumber>;
194
+ min: z.ZodDefault<z.ZodNumber>;
195
+ step: z.ZodDefault<z.ZodNumber>;
206
196
  }, "strip", z.ZodTypeAny, {
197
+ min: number;
198
+ step: number;
207
199
  label?: string | undefined;
208
200
  help?: string | undefined;
209
201
  labelTranslationKey?: string | undefined;
210
202
  max?: number | undefined;
211
- min?: number | undefined;
212
- step?: number | undefined;
213
203
  }, {
214
204
  label?: string | undefined;
215
205
  help?: string | undefined;
@@ -217,78 +207,75 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
217
207
  max?: number | undefined;
218
208
  min?: number | undefined;
219
209
  step?: number | undefined;
220
- }>>;
210
+ }>;
221
211
  }, "strip", z.ZodTypeAny, {
222
- start?: {
212
+ start: {
213
+ min: number;
214
+ step: number;
223
215
  label?: string | undefined;
224
216
  help?: string | undefined;
225
217
  labelTranslationKey?: string | undefined;
226
218
  max?: number | undefined;
227
- min?: number | undefined;
228
- step?: number | undefined;
229
- } | undefined;
230
- end?: {
219
+ };
220
+ end: {
221
+ min: number;
222
+ step: number;
231
223
  label?: string | undefined;
232
224
  help?: string | undefined;
233
225
  labelTranslationKey?: string | undefined;
234
226
  max?: number | undefined;
235
- min?: number | undefined;
236
- step?: number | undefined;
237
- } | undefined;
227
+ };
238
228
  }, {
239
- start?: {
229
+ start: {
240
230
  label?: string | undefined;
241
231
  help?: string | undefined;
242
232
  labelTranslationKey?: string | undefined;
243
233
  max?: number | undefined;
244
234
  min?: number | undefined;
245
235
  step?: number | undefined;
246
- } | undefined;
247
- end?: {
236
+ };
237
+ end: {
248
238
  label?: string | undefined;
249
239
  help?: string | undefined;
250
240
  labelTranslationKey?: string | undefined;
251
241
  max?: number | undefined;
252
242
  min?: number | undefined;
253
243
  step?: number | undefined;
254
- } | undefined;
244
+ };
255
245
  }>;
256
246
  meta: z.ZodOptional<z.ZodObject<{
257
247
  schemaVersion: z.ZodLiteral<"1.0">;
258
248
  } & {
259
249
  title: z.ZodOptional<z.ZodLiteral<"Number Range">>;
260
250
  usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a numerical range (e.g. From/To, Min/Max).">>;
261
- defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
262
251
  }, "strip", z.ZodTypeAny, {
263
252
  schemaVersion: "1.0";
264
253
  title?: "Number Range" | undefined;
265
254
  usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
266
- defaultJSON?: string | undefined;
267
255
  }, {
268
256
  schemaVersion: "1.0";
269
257
  title?: "Number Range" | undefined;
270
258
  usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
271
- defaultJSON?: string | undefined;
272
259
  }>>;
273
260
  }, "strip", z.ZodTypeAny, {
274
261
  type: "numberRange";
275
262
  columns: {
276
- start?: {
263
+ start: {
264
+ min: number;
265
+ step: number;
277
266
  label?: string | undefined;
278
267
  help?: string | undefined;
279
268
  labelTranslationKey?: string | undefined;
280
269
  max?: number | undefined;
281
- min?: number | undefined;
282
- step?: number | undefined;
283
- } | undefined;
284
- end?: {
270
+ };
271
+ end: {
272
+ min: number;
273
+ step: number;
285
274
  label?: string | undefined;
286
275
  help?: string | undefined;
287
276
  labelTranslationKey?: string | undefined;
288
277
  max?: number | undefined;
289
- min?: number | undefined;
290
- step?: number | undefined;
291
- } | undefined;
278
+ };
292
279
  };
293
280
  attributes?: {
294
281
  label?: string | undefined;
@@ -299,27 +286,26 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
299
286
  schemaVersion: "1.0";
300
287
  title?: "Number Range" | undefined;
301
288
  usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
302
- defaultJSON?: string | undefined;
303
289
  } | undefined;
304
290
  }, {
305
291
  type: "numberRange";
306
292
  columns: {
307
- start?: {
293
+ start: {
308
294
  label?: string | undefined;
309
295
  help?: string | undefined;
310
296
  labelTranslationKey?: string | undefined;
311
297
  max?: number | undefined;
312
298
  min?: number | undefined;
313
299
  step?: number | undefined;
314
- } | undefined;
315
- end?: {
300
+ };
301
+ end: {
316
302
  label?: string | undefined;
317
303
  help?: string | undefined;
318
304
  labelTranslationKey?: string | undefined;
319
305
  max?: number | undefined;
320
306
  min?: number | undefined;
321
307
  step?: number | undefined;
322
- } | undefined;
308
+ };
323
309
  };
324
310
  attributes?: {
325
311
  label?: string | undefined;
@@ -330,7 +316,6 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
330
316
  schemaVersion: "1.0";
331
317
  title?: "Number Range" | undefined;
332
318
  usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
333
- defaultJSON?: string | undefined;
334
319
  } | undefined;
335
320
  }>;
336
321
  export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
@@ -6,58 +6,36 @@ const question_1 = require("./question");
6
6
  const BaseAttributes = question_1.QuestionSchema.shape.attributes;
7
7
  const BaseMeta = question_1.QuestionSchema.shape.meta;
8
8
  const NumberAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
9
- max: zod_1.z.number().optional(), // The highest value allowed (default no max)
10
- min: zod_1.z.number().optional(), // The lowest amount allowed (default 0)
11
- step: zod_1.z.number().optional() // The amount to increment. To allow decimals, use 0.01 (default 1)
9
+ max: zod_1.z.number().optional(),
10
+ min: zod_1.z.number().default(0),
11
+ step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
12
12
  }));
13
- const defaultCurrencyJSON = {
14
- type: 'currency',
15
- attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { denomination: 'USD', max: undefined, min: 0, step: 1 }),
16
- meta: Object.assign({}, question_1.defaultMeta)
17
- };
18
13
  exports.CurrencyQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
19
14
  type: zod_1.z.literal('currency'),
20
15
  attributes: NumberAttributesSchema.merge(zod_1.z.object({
21
- denomination: zod_1.z.string().optional(), // The currency type (default is "USD")
16
+ denomination: zod_1.z.string().default('USD')
22
17
  })).optional(),
23
18
  meta: BaseMeta.unwrap().merge(zod_1.z.object({
24
19
  title: zod_1.z.literal('Currency Field').optional(),
25
20
  usageDescription: zod_1.z.literal('For questions that require a monetary amount (e.g. Cost or Budget).').optional(),
26
- defaultJSON: zod_1.z.literal(JSON.stringify(defaultCurrencyJSON, null, 2)).optional(),
27
21
  })).optional()
28
22
  }));
29
- const defaultNumberJSON = {
30
- type: 'number',
31
- attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { max: undefined, min: 0, step: 1 }),
32
- meta: Object.assign({}, question_1.defaultMeta)
33
- };
34
23
  exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
35
24
  type: zod_1.z.literal('number'),
36
25
  attributes: NumberAttributesSchema.optional(),
37
26
  meta: BaseMeta.unwrap().merge(zod_1.z.object({
38
27
  title: zod_1.z.literal('Number Field').optional(),
39
28
  usageDescription: zod_1.z.literal('For questions that require a single numeric value.').optional(),
40
- defaultJSON: zod_1.z.literal(JSON.stringify(defaultNumberJSON, null, 2)).optional(),
41
29
  })).optional()
42
30
  }));
43
- const defaultNumberRangeJSON = {
44
- type: 'numberRange',
45
- attributes: Object.assign({}, question_1.defaultAttributes),
46
- columns: {
47
- start: Object.assign(Object.assign({}, question_1.defaultAttributes), { label: 'From', max: undefined, min: 0, step: 1 }),
48
- end: Object.assign(Object.assign({}, question_1.defaultAttributes), { label: 'To', max: undefined, min: 0, step: 1 })
49
- },
50
- meta: Object.assign({}, question_1.defaultMeta)
51
- };
52
31
  exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
53
32
  type: zod_1.z.literal('numberRange'),
54
33
  columns: zod_1.z.object({
55
- start: NumberAttributesSchema.optional(),
56
- end: NumberAttributesSchema.optional()
34
+ start: NumberAttributesSchema,
35
+ end: NumberAttributesSchema
57
36
  }),
58
37
  meta: BaseMeta.unwrap().merge(zod_1.z.object({
59
38
  title: zod_1.z.literal('Number Range').optional(),
60
39
  usageDescription: zod_1.z.literal('For questions that require a numerical range (e.g. From/To, Min/Max).').optional(),
61
- defaultJSON: zod_1.z.literal(JSON.stringify(defaultNumberRangeJSON, null, 2)).optional(),
62
40
  })).optional()
63
41
  }));