@dmptool/types 1.0.8 → 1.1.1

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 (60) hide show
  1. package/README.md +2 -0
  2. package/dist/answers/__tests__/answers.spec.js +18 -17
  3. package/dist/answers/index.d.ts +80 -55
  4. package/dist/answers/index.js +19 -17
  5. package/dist/answers/numberAnswers.d.ts +91 -0
  6. package/dist/answers/numberAnswers.js +21 -0
  7. package/dist/answers/optionBasedAnswers.d.ts +25 -0
  8. package/dist/answers/optionBasedAnswers.js +5 -1
  9. package/dist/answers/tableAnswers.d.ts +108 -108
  10. package/dist/answers/tableAnswers.js +9 -8
  11. package/dist/answers/textAnswers.d.ts +101 -0
  12. package/dist/answers/textAnswers.js +22 -0
  13. package/dist/questions/__tests__/dateQuestions.spec.js +20 -74
  14. package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -0
  15. package/dist/questions/__tests__/numberQuestions.spec.js +108 -0
  16. package/dist/questions/__tests__/optionBasedQuestions.spec.js +91 -54
  17. package/dist/questions/__tests__/tableQuestion.spec.js +2 -0
  18. package/dist/questions/__tests__/textQuestions.spec.d.ts +1 -0
  19. package/dist/questions/__tests__/textQuestions.spec.js +120 -0
  20. package/dist/questions/dateQuestions.d.ts +159 -178
  21. package/dist/questions/dateQuestions.js +9 -15
  22. package/dist/questions/graphQLQuestions.d.ts +67 -38
  23. package/dist/questions/graphQLQuestions.js +3 -2
  24. package/dist/questions/index.d.ts +1800 -1379
  25. package/dist/questions/index.js +22 -19
  26. package/dist/questions/numberQuestions.d.ts +292 -0
  27. package/dist/questions/numberQuestions.js +28 -0
  28. package/dist/questions/optionBasedQuestions.d.ts +186 -157
  29. package/dist/questions/optionBasedQuestions.js +17 -20
  30. package/dist/questions/question.d.ts +29 -11
  31. package/dist/questions/question.js +10 -4
  32. package/dist/questions/tableQuestions.d.ts +2395 -2048
  33. package/dist/questions/tableQuestions.js +12 -10
  34. package/dist/questions/textQuestions.d.ts +261 -0
  35. package/dist/questions/textQuestions.js +42 -0
  36. package/dist/schemas/anyQuestion.schema.json +269 -238
  37. package/dist/schemas/anyTableColumnQuestion.schema.json +207 -216
  38. package/dist/schemas/booleanQuestion.schema.json +17 -11
  39. package/dist/schemas/checkboxesQuestion.schema.json +24 -27
  40. package/dist/schemas/currencyQuestion.schema.json +23 -18
  41. package/dist/schemas/dateQuestion.schema.json +21 -16
  42. package/dist/schemas/dateRangeQuestion.schema.json +31 -56
  43. package/dist/schemas/emailQuestion.schema.json +24 -19
  44. package/dist/schemas/filteredSearchQuestion.schema.json +18 -13
  45. package/dist/schemas/numberQuestion.schema.json +21 -16
  46. package/dist/schemas/numberRangeQuestion.schema.json +31 -56
  47. package/dist/schemas/radioButtonsQuestion.schema.json +24 -27
  48. package/dist/schemas/selectBoxQuestion.schema.json +27 -36
  49. package/dist/schemas/tableQuestion.schema.json +233 -234
  50. package/dist/schemas/textAreaQuestion.schema.json +22 -16
  51. package/dist/schemas/textQuestion.schema.json +21 -16
  52. package/dist/schemas/typeaheadSearchQuestion.schema.json +15 -4
  53. package/dist/schemas/urlQuestion.schema.json +21 -16
  54. package/package.json +1 -1
  55. package/dist/answers/primitiveAnswers.d.ts +0 -216
  56. package/dist/answers/primitiveAnswers.js +0 -41
  57. package/dist/questions/__tests__/primitiveQuestions.spec.js +0 -281
  58. package/dist/questions/primitiveQuestions.d.ts +0 -555
  59. package/dist/questions/primitiveQuestions.js +0 -86
  60. /package/dist/questions/__tests__/{primitiveQuestions.spec.d.ts → numberQuestions.spec.d.ts} +0 -0
@@ -1,244 +1,225 @@
1
1
  import { z } from "zod";
2
2
  export declare const DateQuestionSchema: z.ZodObject<{
3
- meta: z.ZodObject<{
3
+ meta: z.ZodOptional<z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
- labelTranslationKey: z.ZodOptional<z.ZodString>;
6
5
  }, "strip", z.ZodTypeAny, {
7
6
  schemaVersion: "1.0";
8
- labelTranslationKey?: string | undefined;
9
7
  }, {
10
8
  schemaVersion: "1.0";
11
- labelTranslationKey?: string | undefined;
12
- }>;
9
+ }>>;
13
10
  } & {
14
11
  type: z.ZodLiteral<"date">;
15
12
  attributes: z.ZodOptional<z.ZodObject<{
13
+ label: z.ZodOptional<z.ZodString>;
14
+ help: z.ZodOptional<z.ZodString>;
15
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
16
+ } & {
16
17
  max: z.ZodOptional<z.ZodString>;
17
18
  min: z.ZodOptional<z.ZodString>;
18
19
  step: z.ZodOptional<z.ZodNumber>;
19
20
  }, "strip", z.ZodTypeAny, {
21
+ label?: string | undefined;
22
+ help?: string | undefined;
23
+ labelTranslationKey?: string | undefined;
20
24
  max?: string | undefined;
21
25
  min?: string | undefined;
22
26
  step?: number | undefined;
23
27
  }, {
28
+ label?: string | undefined;
29
+ help?: string | undefined;
30
+ labelTranslationKey?: string | undefined;
24
31
  max?: string | undefined;
25
32
  min?: string | undefined;
26
33
  step?: number | undefined;
27
34
  }>>;
28
35
  }, "strip", z.ZodTypeAny, {
29
36
  type: "date";
30
- meta: {
31
- schemaVersion: "1.0";
32
- labelTranslationKey?: string | undefined;
33
- };
34
37
  attributes?: {
38
+ label?: string | undefined;
39
+ help?: string | undefined;
40
+ labelTranslationKey?: string | undefined;
35
41
  max?: string | undefined;
36
42
  min?: string | undefined;
37
43
  step?: number | undefined;
38
44
  } | undefined;
45
+ meta?: {
46
+ schemaVersion: "1.0";
47
+ } | undefined;
39
48
  }, {
40
49
  type: "date";
41
- meta: {
42
- schemaVersion: "1.0";
43
- labelTranslationKey?: string | undefined;
44
- };
45
50
  attributes?: {
51
+ label?: string | undefined;
52
+ help?: string | undefined;
53
+ labelTranslationKey?: string | undefined;
46
54
  max?: string | undefined;
47
55
  min?: string | undefined;
48
56
  step?: number | undefined;
49
57
  } | undefined;
58
+ meta?: {
59
+ schemaVersion: "1.0";
60
+ } | undefined;
50
61
  }>;
51
62
  export declare const DateRangeQuestionSchema: z.ZodObject<{
52
- meta: z.ZodObject<{
53
- schemaVersion: z.ZodLiteral<"1.0">;
63
+ attributes: z.ZodOptional<z.ZodObject<{
64
+ label: z.ZodOptional<z.ZodString>;
65
+ help: z.ZodOptional<z.ZodString>;
54
66
  labelTranslationKey: z.ZodOptional<z.ZodString>;
55
67
  }, "strip", z.ZodTypeAny, {
56
- schemaVersion: "1.0";
68
+ label?: string | undefined;
69
+ help?: string | undefined;
57
70
  labelTranslationKey?: string | undefined;
58
71
  }, {
59
- schemaVersion: "1.0";
72
+ label?: string | undefined;
73
+ help?: string | undefined;
60
74
  labelTranslationKey?: string | undefined;
61
- }>;
75
+ }>>;
76
+ meta: z.ZodOptional<z.ZodObject<{
77
+ schemaVersion: z.ZodLiteral<"1.0">;
78
+ }, "strip", z.ZodTypeAny, {
79
+ schemaVersion: "1.0";
80
+ }, {
81
+ schemaVersion: "1.0";
82
+ }>>;
62
83
  } & {
63
84
  type: z.ZodLiteral<"dateRange">;
64
85
  columns: z.ZodObject<{
65
- start: z.ZodObject<{
66
- meta: z.ZodObject<{
67
- schemaVersion: z.ZodLiteral<"1.0">;
68
- labelTranslationKey: z.ZodOptional<z.ZodString>;
69
- }, "strip", z.ZodTypeAny, {
70
- schemaVersion: "1.0";
71
- labelTranslationKey?: string | undefined;
72
- }, {
73
- schemaVersion: "1.0";
74
- labelTranslationKey?: string | undefined;
75
- }>;
76
- type: z.ZodLiteral<"date">;
86
+ start: z.ZodOptional<z.ZodObject<{
87
+ label: z.ZodOptional<z.ZodString>;
88
+ help: z.ZodOptional<z.ZodString>;
89
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
77
90
  } & {
78
- attributes: z.ZodObject<{
79
- label: z.ZodString;
80
- }, "strip", z.ZodTypeAny, {
81
- label: string;
82
- }, {
83
- label: string;
84
- }>;
91
+ max: z.ZodOptional<z.ZodString>;
92
+ min: z.ZodOptional<z.ZodString>;
93
+ step: z.ZodOptional<z.ZodNumber>;
85
94
  }, "strip", z.ZodTypeAny, {
86
- type: "date";
87
- meta: {
88
- schemaVersion: "1.0";
89
- labelTranslationKey?: string | undefined;
90
- };
91
- attributes: {
92
- label: string;
93
- };
95
+ label?: string | undefined;
96
+ help?: string | undefined;
97
+ labelTranslationKey?: string | undefined;
98
+ max?: string | undefined;
99
+ min?: string | undefined;
100
+ step?: number | undefined;
94
101
  }, {
95
- type: "date";
96
- meta: {
97
- schemaVersion: "1.0";
98
- labelTranslationKey?: string | undefined;
99
- };
100
- attributes: {
101
- label: string;
102
- };
103
- }>;
104
- end: z.ZodObject<{
105
- meta: z.ZodObject<{
106
- schemaVersion: z.ZodLiteral<"1.0">;
107
- labelTranslationKey: z.ZodOptional<z.ZodString>;
108
- }, "strip", z.ZodTypeAny, {
109
- schemaVersion: "1.0";
110
- labelTranslationKey?: string | undefined;
111
- }, {
112
- schemaVersion: "1.0";
113
- labelTranslationKey?: string | undefined;
114
- }>;
115
- type: z.ZodLiteral<"date">;
102
+ label?: string | undefined;
103
+ help?: string | undefined;
104
+ labelTranslationKey?: string | undefined;
105
+ max?: string | undefined;
106
+ min?: string | undefined;
107
+ step?: number | undefined;
108
+ }>>;
109
+ end: z.ZodOptional<z.ZodObject<{
110
+ label: z.ZodOptional<z.ZodString>;
111
+ help: z.ZodOptional<z.ZodString>;
112
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
116
113
  } & {
117
- attributes: z.ZodObject<{
118
- label: z.ZodString;
119
- }, "strip", z.ZodTypeAny, {
120
- label: string;
121
- }, {
122
- label: string;
123
- }>;
114
+ max: z.ZodOptional<z.ZodString>;
115
+ min: z.ZodOptional<z.ZodString>;
116
+ step: z.ZodOptional<z.ZodNumber>;
124
117
  }, "strip", z.ZodTypeAny, {
125
- type: "date";
126
- meta: {
127
- schemaVersion: "1.0";
128
- labelTranslationKey?: string | undefined;
129
- };
130
- attributes: {
131
- label: string;
132
- };
118
+ label?: string | undefined;
119
+ help?: string | undefined;
120
+ labelTranslationKey?: string | undefined;
121
+ max?: string | undefined;
122
+ min?: string | undefined;
123
+ step?: number | undefined;
133
124
  }, {
134
- type: "date";
135
- meta: {
136
- schemaVersion: "1.0";
137
- labelTranslationKey?: string | undefined;
138
- };
139
- attributes: {
140
- label: string;
141
- };
142
- }>;
125
+ label?: string | undefined;
126
+ help?: string | undefined;
127
+ labelTranslationKey?: string | undefined;
128
+ max?: string | undefined;
129
+ min?: string | undefined;
130
+ step?: number | undefined;
131
+ }>>;
143
132
  }, "strip", z.ZodTypeAny, {
144
- start: {
145
- type: "date";
146
- meta: {
147
- schemaVersion: "1.0";
148
- labelTranslationKey?: string | undefined;
149
- };
150
- attributes: {
151
- label: string;
152
- };
153
- };
154
- end: {
155
- type: "date";
156
- meta: {
157
- schemaVersion: "1.0";
158
- labelTranslationKey?: string | undefined;
159
- };
160
- attributes: {
161
- label: string;
162
- };
163
- };
133
+ start?: {
134
+ label?: string | undefined;
135
+ help?: string | undefined;
136
+ labelTranslationKey?: string | undefined;
137
+ max?: string | undefined;
138
+ min?: string | undefined;
139
+ step?: number | undefined;
140
+ } | undefined;
141
+ end?: {
142
+ label?: string | undefined;
143
+ help?: string | undefined;
144
+ labelTranslationKey?: string | undefined;
145
+ max?: string | undefined;
146
+ min?: string | undefined;
147
+ step?: number | undefined;
148
+ } | undefined;
164
149
  }, {
165
- start: {
166
- type: "date";
167
- meta: {
168
- schemaVersion: "1.0";
169
- labelTranslationKey?: string | undefined;
170
- };
171
- attributes: {
172
- label: string;
173
- };
174
- };
175
- end: {
176
- type: "date";
177
- meta: {
178
- schemaVersion: "1.0";
179
- labelTranslationKey?: string | undefined;
180
- };
181
- attributes: {
182
- label: string;
183
- };
184
- };
150
+ start?: {
151
+ label?: string | undefined;
152
+ help?: string | undefined;
153
+ labelTranslationKey?: string | undefined;
154
+ max?: string | undefined;
155
+ min?: string | undefined;
156
+ step?: number | undefined;
157
+ } | undefined;
158
+ end?: {
159
+ label?: string | undefined;
160
+ help?: string | undefined;
161
+ labelTranslationKey?: string | undefined;
162
+ max?: string | undefined;
163
+ min?: string | undefined;
164
+ step?: number | undefined;
165
+ } | undefined;
185
166
  }>;
186
167
  }, "strip", z.ZodTypeAny, {
187
168
  type: "dateRange";
188
- meta: {
189
- schemaVersion: "1.0";
190
- labelTranslationKey?: string | undefined;
191
- };
192
169
  columns: {
193
- start: {
194
- type: "date";
195
- meta: {
196
- schemaVersion: "1.0";
197
- labelTranslationKey?: string | undefined;
198
- };
199
- attributes: {
200
- label: string;
201
- };
202
- };
203
- end: {
204
- type: "date";
205
- meta: {
206
- schemaVersion: "1.0";
207
- labelTranslationKey?: string | undefined;
208
- };
209
- attributes: {
210
- label: string;
211
- };
212
- };
170
+ start?: {
171
+ label?: string | undefined;
172
+ help?: string | undefined;
173
+ labelTranslationKey?: string | undefined;
174
+ max?: string | undefined;
175
+ min?: string | undefined;
176
+ step?: number | undefined;
177
+ } | undefined;
178
+ end?: {
179
+ label?: string | undefined;
180
+ help?: string | undefined;
181
+ labelTranslationKey?: string | undefined;
182
+ max?: string | undefined;
183
+ min?: string | undefined;
184
+ step?: number | undefined;
185
+ } | undefined;
213
186
  };
187
+ attributes?: {
188
+ label?: string | undefined;
189
+ help?: string | undefined;
190
+ labelTranslationKey?: string | undefined;
191
+ } | undefined;
192
+ meta?: {
193
+ schemaVersion: "1.0";
194
+ } | undefined;
214
195
  }, {
215
196
  type: "dateRange";
216
- meta: {
217
- schemaVersion: "1.0";
218
- labelTranslationKey?: string | undefined;
219
- };
220
197
  columns: {
221
- start: {
222
- type: "date";
223
- meta: {
224
- schemaVersion: "1.0";
225
- labelTranslationKey?: string | undefined;
226
- };
227
- attributes: {
228
- label: string;
229
- };
230
- };
231
- end: {
232
- type: "date";
233
- meta: {
234
- schemaVersion: "1.0";
235
- labelTranslationKey?: string | undefined;
236
- };
237
- attributes: {
238
- label: string;
239
- };
240
- };
198
+ start?: {
199
+ label?: string | undefined;
200
+ help?: string | undefined;
201
+ labelTranslationKey?: string | undefined;
202
+ max?: string | undefined;
203
+ min?: string | undefined;
204
+ step?: number | undefined;
205
+ } | undefined;
206
+ end?: {
207
+ label?: string | undefined;
208
+ help?: string | undefined;
209
+ labelTranslationKey?: string | undefined;
210
+ max?: string | undefined;
211
+ min?: string | undefined;
212
+ step?: number | undefined;
213
+ } | undefined;
241
214
  };
215
+ attributes?: {
216
+ label?: string | undefined;
217
+ help?: string | undefined;
218
+ labelTranslationKey?: string | undefined;
219
+ } | undefined;
220
+ meta?: {
221
+ schemaVersion: "1.0";
222
+ } | undefined;
242
223
  }>;
243
224
  export type DateQuestionType = z.infer<typeof DateQuestionSchema>;
244
225
  export type DateRangeQuestionType = z.infer<typeof DateRangeQuestionSchema>;
@@ -3,28 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DateRangeQuestionSchema = exports.DateQuestionSchema = 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
+ const DateAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
8
+ max: zod_1.z.string().optional(), // The maximum date (no default)
9
+ min: zod_1.z.string().optional(), // The minimum date (no default)
10
+ step: zod_1.z.number().optional() // The step value (default is 1 day)
11
+ }));
6
12
  // Date question and answer
7
13
  exports.DateQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
8
14
  type: zod_1.z.literal('date'), // The type of question
9
- attributes: zod_1.z.object({
10
- max: zod_1.z.string().optional(), // The maximum date (no default)
11
- min: zod_1.z.string().optional(), // The minimum date (no default)
12
- step: zod_1.z.number().optional() // The step value (default is 1 day)
13
- }).optional(),
15
+ attributes: DateAttributesSchema.optional(),
14
16
  }));
15
17
  // Date range question and answer
16
18
  exports.DateRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
17
19
  type: zod_1.z.literal('dateRange'), // The type of question
18
20
  columns: zod_1.z.object({
19
- start: exports.DateQuestionSchema.merge(zod_1.z.object({
20
- attributes: zod_1.z.object({
21
- label: zod_1.z.string() // The label for the start date
22
- })
23
- })),
24
- end: exports.DateQuestionSchema.merge(zod_1.z.object({
25
- attributes: zod_1.z.object({
26
- label: zod_1.z.string() // The label for the end date
27
- })
28
- }))
21
+ start: DateAttributesSchema.optional(),
22
+ end: DateAttributesSchema.optional()
29
23
  })
30
24
  }));