@dmptool/types 1.1.3 → 1.2.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 (76) hide show
  1. package/README.md +119 -47
  2. package/dist/answers/__tests__/answers.spec.js +20 -28
  3. package/dist/answers/__tests__/usage.spec.d.ts +1 -0
  4. package/dist/answers/__tests__/usage.spec.js +175 -0
  5. package/dist/answers/answer.d.ts +12 -15
  6. package/dist/answers/answer.js +3 -4
  7. package/dist/answers/dateAnswers.d.ts +30 -30
  8. package/dist/answers/dateAnswers.js +6 -5
  9. package/dist/answers/graphQLAnswers.d.ts +25 -25
  10. package/dist/answers/graphQLAnswers.js +4 -4
  11. package/dist/answers/index.d.ts +860 -1088
  12. package/dist/answers/index.js +2 -2
  13. package/dist/answers/numberAnswers.d.ts +41 -41
  14. package/dist/answers/numberAnswers.js +8 -8
  15. package/dist/answers/optionBasedAnswers.d.ts +55 -55
  16. package/dist/answers/optionBasedAnswers.js +10 -10
  17. package/dist/answers/tableAnswers.d.ts +811 -1772
  18. package/dist/answers/tableAnswers.js +12 -8
  19. package/dist/answers/textAnswers.d.ts +44 -44
  20. package/dist/answers/textAnswers.js +8 -8
  21. package/dist/questions/__tests__/graphQLQuestions.spec.js +1 -1
  22. package/dist/questions/__tests__/usage.spec.d.ts +8 -0
  23. package/dist/questions/__tests__/usage.spec.js +312 -0
  24. package/dist/questions/dateQuestions.d.ts +81 -82
  25. package/dist/questions/dateQuestions.js +12 -16
  26. package/dist/questions/graphQLQuestions.d.ts +142 -142
  27. package/dist/questions/graphQLQuestions.js +35 -30
  28. package/dist/questions/index.d.ts +1494 -1674
  29. package/dist/questions/index.js +2 -2
  30. package/dist/questions/numberQuestions.d.ts +97 -98
  31. package/dist/questions/numberQuestions.js +7 -19
  32. package/dist/questions/optionBasedQuestions.d.ts +163 -166
  33. package/dist/questions/optionBasedQuestions.js +20 -36
  34. package/dist/questions/question.d.ts +24 -48
  35. package/dist/questions/question.js +78 -17
  36. package/dist/questions/tableQuestions.d.ts +2219 -2231
  37. package/dist/questions/tableQuestions.js +6 -11
  38. package/dist/questions/textQuestions.d.ts +104 -104
  39. package/dist/questions/textQuestions.js +6 -23
  40. package/dist/schemas/affiliationSearchAnswer.schema.json +9 -12
  41. package/dist/schemas/affiliationSearchQuestion.schema.json +30 -36
  42. package/dist/schemas/anyAnswer.schema.json +228 -237
  43. package/dist/schemas/anyQuestion.schema.json +292 -493
  44. package/dist/schemas/anyTableColumnAnswer.schema.json +93 -106
  45. package/dist/schemas/anyTableColumnQuestion.schema.json +164 -325
  46. package/dist/schemas/booleanAnswer.schema.json +8 -11
  47. package/dist/schemas/booleanQuestion.schema.json +7 -10
  48. package/dist/schemas/checkboxesAnswer.schema.json +13 -14
  49. package/dist/schemas/checkboxesQuestion.schema.json +12 -13
  50. package/dist/schemas/currencyAnswer.schema.json +8 -11
  51. package/dist/schemas/currencyQuestion.schema.json +7 -10
  52. package/dist/schemas/dateAnswer.schema.json +8 -11
  53. package/dist/schemas/dateQuestion.schema.json +7 -10
  54. package/dist/schemas/dateRangeAnswer.schema.json +16 -21
  55. package/dist/schemas/dateRangeQuestion.schema.json +38 -20
  56. package/dist/schemas/emailAnswer.schema.json +8 -11
  57. package/dist/schemas/emailQuestion.schema.json +7 -10
  58. package/dist/schemas/multiselectBoxAnswer.schema.json +13 -14
  59. package/dist/schemas/multiselectBoxQuestion.schema.json +14 -14
  60. package/dist/schemas/numberAnswer.schema.json +8 -11
  61. package/dist/schemas/numberQuestion.schema.json +7 -10
  62. package/dist/schemas/numberRangeAnswer.schema.json +17 -22
  63. package/dist/schemas/numberRangeQuestion.schema.json +18 -19
  64. package/dist/schemas/radioButtonsAnswer.schema.json +8 -11
  65. package/dist/schemas/radioButtonsQuestion.schema.json +12 -13
  66. package/dist/schemas/selectBoxAnswer.schema.json +8 -11
  67. package/dist/schemas/selectBoxQuestion.schema.json +18 -15
  68. package/dist/schemas/tableAnswer.schema.json +337 -343
  69. package/dist/schemas/tableQuestion.schema.json +178 -352
  70. package/dist/schemas/textAnswer.schema.json +8 -11
  71. package/dist/schemas/textAreaAnswer.schema.json +8 -11
  72. package/dist/schemas/textAreaQuestion.schema.json +7 -10
  73. package/dist/schemas/textQuestion.schema.json +7 -10
  74. package/dist/schemas/urlAnswer.schema.json +8 -11
  75. package/dist/schemas/urlQuestion.schema.json +7 -10
  76. package/package.json +1 -1
@@ -38,7 +38,7 @@ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
38
38
  dateQuestions_1.DateQuestionSchema,
39
39
  dateQuestions_1.DateRangeQuestionSchema,
40
40
  textQuestions_1.EmailQuestionSchema,
41
- graphQLQuestions_1.FilteredSearchQuestionSchema,
41
+ // FilteredSearchQuestionSchema,
42
42
  optionBasedQuestions_1.MultiselectBoxQuestionSchema,
43
43
  numberQuestions_1.NumberQuestionSchema,
44
44
  numberQuestions_1.NumberRangeQuestionSchema,
@@ -58,7 +58,7 @@ exports.QuestionSchemaMap = {
58
58
  date: dateQuestions_1.DateQuestionSchema,
59
59
  dateRange: dateQuestions_1.DateRangeQuestionSchema,
60
60
  email: textQuestions_1.EmailQuestionSchema,
61
- filteredSearch: graphQLQuestions_1.FilteredSearchQuestionSchema,
61
+ // filteredSearch: FilteredSearchQuestionSchema,
62
62
  multiselectBox: optionBasedQuestions_1.MultiselectBoxQuestionSchema,
63
63
  number: numberQuestions_1.NumberQuestionSchema,
64
64
  numberRange: numberQuestions_1.NumberRangeQuestionSchema,
@@ -1,7 +1,21 @@
1
1
  import { z } from "zod";
2
- export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
2
+ export declare const CurrencyQuestionSchema: z.ZodObject<{
3
+ meta: z.ZodDefault<z.ZodObject<{
4
+ schemaVersion: z.ZodDefault<z.ZodString>;
5
+ title: z.ZodOptional<z.ZodString>;
6
+ 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
+ } & {
3
17
  type: z.ZodLiteral<"currency">;
4
- attributes: z.ZodOptional<z.ZodObject<{
18
+ attributes: z.ZodDefault<z.ZodObject<{
5
19
  label: z.ZodOptional<z.ZodString>;
6
20
  help: z.ZodOptional<z.ZodString>;
7
21
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -28,23 +42,9 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
28
42
  step?: number | undefined;
29
43
  denomination?: string | undefined;
30
44
  }>>;
31
- meta: z.ZodOptional<z.ZodObject<{
32
- schemaVersion: z.ZodLiteral<"1.0">;
33
- } & {
34
- title: z.ZodOptional<z.ZodLiteral<"Currency Field">>;
35
- usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a monetary amount (e.g. Cost or Budget).">>;
36
- }, "strip", z.ZodTypeAny, {
37
- schemaVersion: "1.0";
38
- title?: "Currency Field" | undefined;
39
- usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
40
- }, {
41
- schemaVersion: "1.0";
42
- title?: "Currency Field" | undefined;
43
- usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
44
- }>>;
45
45
  }, "strip", z.ZodTypeAny, {
46
46
  type: "currency";
47
- attributes?: {
47
+ attributes: {
48
48
  min: number;
49
49
  step: number;
50
50
  denomination: string;
@@ -52,12 +52,12 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
52
52
  help?: string | undefined;
53
53
  labelTranslationKey?: string | undefined;
54
54
  max?: number | undefined;
55
- } | undefined;
56
- meta?: {
57
- schemaVersion: "1.0";
58
- title?: "Currency Field" | undefined;
59
- usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
60
- } | undefined;
55
+ };
56
+ meta: {
57
+ schemaVersion: string;
58
+ title?: string | undefined;
59
+ usageDescription?: string | undefined;
60
+ };
61
61
  }, {
62
62
  type: "currency";
63
63
  attributes?: {
@@ -70,14 +70,28 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
70
70
  denomination?: string | undefined;
71
71
  } | undefined;
72
72
  meta?: {
73
- schemaVersion: "1.0";
74
- title?: "Currency Field" | undefined;
75
- usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
73
+ schemaVersion?: string | undefined;
74
+ title?: string | undefined;
75
+ usageDescription?: string | undefined;
76
76
  } | undefined;
77
77
  }>;
78
- export declare const NumberQuestionSchema: z.ZodObject<{} & {
78
+ export declare const NumberQuestionSchema: z.ZodObject<{
79
+ meta: z.ZodDefault<z.ZodObject<{
80
+ schemaVersion: z.ZodDefault<z.ZodString>;
81
+ title: z.ZodOptional<z.ZodString>;
82
+ usageDescription: z.ZodOptional<z.ZodString>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ schemaVersion: string;
85
+ title?: string | undefined;
86
+ usageDescription?: string | undefined;
87
+ }, {
88
+ schemaVersion?: string | undefined;
89
+ title?: string | undefined;
90
+ usageDescription?: string | undefined;
91
+ }>>;
92
+ } & {
79
93
  type: z.ZodLiteral<"number">;
80
- attributes: z.ZodOptional<z.ZodObject<{
94
+ attributes: z.ZodDefault<z.ZodObject<{
81
95
  label: z.ZodOptional<z.ZodString>;
82
96
  help: z.ZodOptional<z.ZodString>;
83
97
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -100,35 +114,21 @@ export declare const NumberQuestionSchema: z.ZodObject<{} & {
100
114
  min?: number | undefined;
101
115
  step?: number | undefined;
102
116
  }>>;
103
- meta: z.ZodOptional<z.ZodObject<{
104
- schemaVersion: z.ZodLiteral<"1.0">;
105
- } & {
106
- title: z.ZodOptional<z.ZodLiteral<"Number Field">>;
107
- usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a single numeric value.">>;
108
- }, "strip", z.ZodTypeAny, {
109
- schemaVersion: "1.0";
110
- title?: "Number Field" | undefined;
111
- usageDescription?: "For questions that require a single numeric value." | undefined;
112
- }, {
113
- schemaVersion: "1.0";
114
- title?: "Number Field" | undefined;
115
- usageDescription?: "For questions that require a single numeric value." | undefined;
116
- }>>;
117
117
  }, "strip", z.ZodTypeAny, {
118
118
  type: "number";
119
- attributes?: {
119
+ attributes: {
120
120
  min: number;
121
121
  step: number;
122
122
  label?: string | undefined;
123
123
  help?: string | undefined;
124
124
  labelTranslationKey?: string | undefined;
125
125
  max?: number | undefined;
126
- } | undefined;
127
- meta?: {
128
- schemaVersion: "1.0";
129
- title?: "Number Field" | undefined;
130
- usageDescription?: "For questions that require a single numeric value." | undefined;
131
- } | undefined;
126
+ };
127
+ meta: {
128
+ schemaVersion: string;
129
+ title?: string | undefined;
130
+ usageDescription?: string | undefined;
131
+ };
132
132
  }, {
133
133
  type: "number";
134
134
  attributes?: {
@@ -140,13 +140,28 @@ export declare const NumberQuestionSchema: z.ZodObject<{} & {
140
140
  step?: number | undefined;
141
141
  } | undefined;
142
142
  meta?: {
143
- schemaVersion: "1.0";
144
- title?: "Number Field" | undefined;
145
- usageDescription?: "For questions that require a single numeric value." | undefined;
143
+ schemaVersion?: string | undefined;
144
+ title?: string | undefined;
145
+ usageDescription?: string | undefined;
146
146
  } | undefined;
147
147
  }>;
148
148
  export declare const NumberRangeQuestionSchema: z.ZodObject<{
149
- attributes: z.ZodOptional<z.ZodObject<{
149
+ meta: z.ZodDefault<z.ZodObject<{
150
+ schemaVersion: z.ZodDefault<z.ZodString>;
151
+ title: z.ZodOptional<z.ZodString>;
152
+ usageDescription: z.ZodOptional<z.ZodString>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ schemaVersion: string;
155
+ title?: string | undefined;
156
+ usageDescription?: string | undefined;
157
+ }, {
158
+ schemaVersion?: string | undefined;
159
+ title?: string | undefined;
160
+ usageDescription?: string | undefined;
161
+ }>>;
162
+ } & {
163
+ type: z.ZodLiteral<"numberRange">;
164
+ attributes: z.ZodDefault<z.ZodObject<{
150
165
  label: z.ZodOptional<z.ZodString>;
151
166
  help: z.ZodOptional<z.ZodString>;
152
167
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -159,10 +174,8 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
159
174
  help?: string | undefined;
160
175
  labelTranslationKey?: string | undefined;
161
176
  }>>;
162
- } & {
163
- type: z.ZodLiteral<"numberRange">;
164
- columns: z.ZodObject<{
165
- start: z.ZodObject<{
177
+ columns: z.ZodDefault<z.ZodObject<{
178
+ start: z.ZodDefault<z.ZodObject<{
166
179
  label: z.ZodOptional<z.ZodString>;
167
180
  help: z.ZodOptional<z.ZodString>;
168
181
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -184,8 +197,8 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
184
197
  max?: number | undefined;
185
198
  min?: number | undefined;
186
199
  step?: number | undefined;
187
- }>;
188
- end: z.ZodObject<{
200
+ }>>;
201
+ end: z.ZodDefault<z.ZodObject<{
189
202
  label: z.ZodOptional<z.ZodString>;
190
203
  help: z.ZodOptional<z.ZodString>;
191
204
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -207,7 +220,7 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
207
220
  max?: number | undefined;
208
221
  min?: number | undefined;
209
222
  step?: number | undefined;
210
- }>;
223
+ }>>;
211
224
  }, "strip", z.ZodTypeAny, {
212
225
  start: {
213
226
  min: number;
@@ -226,39 +239,35 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
226
239
  max?: number | undefined;
227
240
  };
228
241
  }, {
229
- start: {
242
+ start?: {
230
243
  label?: string | undefined;
231
244
  help?: string | undefined;
232
245
  labelTranslationKey?: string | undefined;
233
246
  max?: number | undefined;
234
247
  min?: number | undefined;
235
248
  step?: number | undefined;
236
- };
237
- end: {
249
+ } | undefined;
250
+ end?: {
238
251
  label?: string | undefined;
239
252
  help?: string | undefined;
240
253
  labelTranslationKey?: string | undefined;
241
254
  max?: number | undefined;
242
255
  min?: number | undefined;
243
256
  step?: number | undefined;
244
- };
245
- }>;
246
- meta: z.ZodOptional<z.ZodObject<{
247
- schemaVersion: z.ZodLiteral<"1.0">;
248
- } & {
249
- title: z.ZodOptional<z.ZodLiteral<"Number Range">>;
250
- usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a numerical range (e.g. From/To, Min/Max).">>;
251
- }, "strip", z.ZodTypeAny, {
252
- schemaVersion: "1.0";
253
- title?: "Number Range" | undefined;
254
- usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
255
- }, {
256
- schemaVersion: "1.0";
257
- title?: "Number Range" | undefined;
258
- usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
257
+ } | undefined;
259
258
  }>>;
260
259
  }, "strip", z.ZodTypeAny, {
261
260
  type: "numberRange";
261
+ attributes: {
262
+ label?: string | undefined;
263
+ help?: string | undefined;
264
+ labelTranslationKey?: string | undefined;
265
+ };
266
+ meta: {
267
+ schemaVersion: string;
268
+ title?: string | undefined;
269
+ usageDescription?: string | undefined;
270
+ };
262
271
  columns: {
263
272
  start: {
264
273
  min: number;
@@ -277,45 +286,35 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
277
286
  max?: number | undefined;
278
287
  };
279
288
  };
289
+ }, {
290
+ type: "numberRange";
280
291
  attributes?: {
281
292
  label?: string | undefined;
282
293
  help?: string | undefined;
283
294
  labelTranslationKey?: string | undefined;
284
295
  } | undefined;
285
296
  meta?: {
286
- schemaVersion: "1.0";
287
- title?: "Number Range" | undefined;
288
- usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
297
+ schemaVersion?: string | undefined;
298
+ title?: string | undefined;
299
+ usageDescription?: string | undefined;
289
300
  } | undefined;
290
- }, {
291
- type: "numberRange";
292
- columns: {
293
- start: {
301
+ columns?: {
302
+ start?: {
294
303
  label?: string | undefined;
295
304
  help?: string | undefined;
296
305
  labelTranslationKey?: string | undefined;
297
306
  max?: number | undefined;
298
307
  min?: number | undefined;
299
308
  step?: number | undefined;
300
- };
301
- end: {
309
+ } | undefined;
310
+ end?: {
302
311
  label?: string | undefined;
303
312
  help?: string | undefined;
304
313
  labelTranslationKey?: string | undefined;
305
314
  max?: number | undefined;
306
315
  min?: number | undefined;
307
316
  step?: number | undefined;
308
- };
309
- };
310
- attributes?: {
311
- label?: string | undefined;
312
- help?: string | undefined;
313
- labelTranslationKey?: string | undefined;
314
- } | undefined;
315
- meta?: {
316
- schemaVersion: "1.0";
317
- title?: "Number Range" | undefined;
318
- usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
317
+ } | undefined;
319
318
  } | undefined;
320
319
  }>;
321
320
  export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
@@ -4,8 +4,7 @@ exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.Curre
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  const BaseAttributes = question_1.QuestionSchema.shape.attributes;
7
- const BaseMeta = question_1.QuestionSchema.shape.meta;
8
- const NumberAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
7
+ const NumberAttributesSchema = BaseAttributes.merge(zod_1.z.object({
9
8
  max: zod_1.z.number().optional(),
10
9
  min: zod_1.z.number().default(0),
11
10
  step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
@@ -14,28 +13,17 @@ exports.CurrencyQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object(
14
13
  type: zod_1.z.literal('currency'),
15
14
  attributes: NumberAttributesSchema.merge(zod_1.z.object({
16
15
  denomination: zod_1.z.string().default('USD')
17
- })).optional(),
18
- meta: BaseMeta.unwrap().merge(zod_1.z.object({
19
- title: zod_1.z.literal('Currency Field').optional(),
20
- usageDescription: zod_1.z.literal('For questions that require a monetary amount (e.g. Cost or Budget).').optional(),
21
- })).optional()
16
+ })).default({})
22
17
  }));
23
18
  exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
24
19
  type: zod_1.z.literal('number'),
25
- attributes: NumberAttributesSchema.optional(),
26
- meta: BaseMeta.unwrap().merge(zod_1.z.object({
27
- title: zod_1.z.literal('Number Field').optional(),
28
- usageDescription: zod_1.z.literal('For questions that require a single numeric value.').optional(),
29
- })).optional()
20
+ attributes: NumberAttributesSchema.default({})
30
21
  }));
31
22
  exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
32
23
  type: zod_1.z.literal('numberRange'),
24
+ attributes: BaseAttributes.default({}),
33
25
  columns: zod_1.z.object({
34
- start: NumberAttributesSchema,
35
- end: NumberAttributesSchema
36
- }),
37
- meta: BaseMeta.unwrap().merge(zod_1.z.object({
38
- title: zod_1.z.literal('Number Range').optional(),
39
- usageDescription: zod_1.z.literal('For questions that require a numerical range (e.g. From/To, Min/Max).').optional(),
40
- })).optional()
26
+ start: NumberAttributesSchema.default({ label: 'From' }),
27
+ end: NumberAttributesSchema.default({ label: 'To' }),
28
+ }).default({})
41
29
  }));