@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,15 +1,12 @@
1
1
  import { z } from "zod";
2
2
  export declare const FilteredSearchQuestionSchema: 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<"filteredSearch">;
15
12
  graphQL: z.ZodObject<{
@@ -39,15 +36,15 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
39
36
  }, "strip", z.ZodTypeAny, {
40
37
  type: string;
41
38
  name: string;
42
- labelTranslationKey?: string | undefined;
43
39
  label?: string | undefined;
40
+ labelTranslationKey?: string | undefined;
44
41
  minLength?: number | undefined;
45
42
  defaultValue?: string | undefined;
46
43
  }, {
47
44
  type: string;
48
45
  name: string;
49
- labelTranslationKey?: string | undefined;
50
46
  label?: string | undefined;
47
+ labelTranslationKey?: string | undefined;
51
48
  minLength?: number | undefined;
52
49
  defaultValue?: string | undefined;
53
50
  }>, "many">>;
@@ -63,8 +60,8 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
63
60
  variables?: {
64
61
  type: string;
65
62
  name: string;
66
- labelTranslationKey?: string | undefined;
67
63
  label?: string | undefined;
64
+ labelTranslationKey?: string | undefined;
68
65
  minLength?: number | undefined;
69
66
  defaultValue?: string | undefined;
70
67
  }[] | undefined;
@@ -80,25 +77,31 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
80
77
  variables?: {
81
78
  type: string;
82
79
  name: string;
83
- labelTranslationKey?: string | undefined;
84
80
  label?: string | undefined;
81
+ labelTranslationKey?: string | undefined;
85
82
  minLength?: number | undefined;
86
83
  defaultValue?: string | undefined;
87
84
  }[] | undefined;
88
85
  }>;
89
86
  attributes: z.ZodOptional<z.ZodObject<{
87
+ label: z.ZodOptional<z.ZodString>;
88
+ help: z.ZodOptional<z.ZodString>;
89
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
90
+ } & {
90
91
  multiple: z.ZodOptional<z.ZodBoolean>;
91
92
  }, "strip", z.ZodTypeAny, {
93
+ label?: string | undefined;
94
+ help?: string | undefined;
95
+ labelTranslationKey?: string | undefined;
92
96
  multiple?: boolean | undefined;
93
97
  }, {
98
+ label?: string | undefined;
99
+ help?: string | undefined;
100
+ labelTranslationKey?: string | undefined;
94
101
  multiple?: boolean | undefined;
95
102
  }>>;
96
103
  }, "strip", z.ZodTypeAny, {
97
104
  type: "filteredSearch";
98
- meta: {
99
- schemaVersion: "1.0";
100
- labelTranslationKey?: string | undefined;
101
- };
102
105
  graphQL: {
103
106
  displayFields: {
104
107
  label: string;
@@ -111,21 +114,23 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
111
114
  variables?: {
112
115
  type: string;
113
116
  name: string;
114
- labelTranslationKey?: string | undefined;
115
117
  label?: string | undefined;
118
+ labelTranslationKey?: string | undefined;
116
119
  minLength?: number | undefined;
117
120
  defaultValue?: string | undefined;
118
121
  }[] | undefined;
119
122
  };
120
123
  attributes?: {
124
+ label?: string | undefined;
125
+ help?: string | undefined;
126
+ labelTranslationKey?: string | undefined;
121
127
  multiple?: boolean | undefined;
122
128
  } | undefined;
129
+ meta?: {
130
+ schemaVersion: "1.0";
131
+ } | undefined;
123
132
  }, {
124
133
  type: "filteredSearch";
125
- meta: {
126
- schemaVersion: "1.0";
127
- labelTranslationKey?: string | undefined;
128
- };
129
134
  graphQL: {
130
135
  displayFields: {
131
136
  label: string;
@@ -138,27 +143,43 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
138
143
  variables?: {
139
144
  type: string;
140
145
  name: string;
141
- labelTranslationKey?: string | undefined;
142
146
  label?: string | undefined;
147
+ labelTranslationKey?: string | undefined;
143
148
  minLength?: number | undefined;
144
149
  defaultValue?: string | undefined;
145
150
  }[] | undefined;
146
151
  };
147
152
  attributes?: {
153
+ label?: string | undefined;
154
+ help?: string | undefined;
155
+ labelTranslationKey?: string | undefined;
148
156
  multiple?: boolean | undefined;
149
157
  } | undefined;
158
+ meta?: {
159
+ schemaVersion: "1.0";
160
+ } | undefined;
150
161
  }>;
151
162
  export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
152
- meta: z.ZodObject<{
153
- schemaVersion: z.ZodLiteral<"1.0">;
163
+ attributes: z.ZodOptional<z.ZodObject<{
164
+ label: z.ZodOptional<z.ZodString>;
165
+ help: z.ZodOptional<z.ZodString>;
154
166
  labelTranslationKey: z.ZodOptional<z.ZodString>;
155
167
  }, "strip", z.ZodTypeAny, {
156
- schemaVersion: "1.0";
168
+ label?: string | undefined;
169
+ help?: string | undefined;
157
170
  labelTranslationKey?: string | undefined;
158
171
  }, {
159
- schemaVersion: "1.0";
172
+ label?: string | undefined;
173
+ help?: string | undefined;
160
174
  labelTranslationKey?: string | undefined;
161
- }>;
175
+ }>>;
176
+ meta: z.ZodOptional<z.ZodObject<{
177
+ schemaVersion: z.ZodLiteral<"1.0">;
178
+ }, "strip", z.ZodTypeAny, {
179
+ schemaVersion: "1.0";
180
+ }, {
181
+ schemaVersion: "1.0";
182
+ }>>;
162
183
  } & {
163
184
  type: z.ZodLiteral<"typeaheadSearch">;
164
185
  graphQL: z.ZodObject<{
@@ -188,15 +209,15 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
188
209
  }, "strip", z.ZodTypeAny, {
189
210
  type: string;
190
211
  name: string;
191
- labelTranslationKey?: string | undefined;
192
212
  label?: string | undefined;
213
+ labelTranslationKey?: string | undefined;
193
214
  minLength?: number | undefined;
194
215
  defaultValue?: string | undefined;
195
216
  }, {
196
217
  type: string;
197
218
  name: string;
198
- labelTranslationKey?: string | undefined;
199
219
  label?: string | undefined;
220
+ labelTranslationKey?: string | undefined;
200
221
  minLength?: number | undefined;
201
222
  defaultValue?: string | undefined;
202
223
  }>, "many">>;
@@ -212,8 +233,8 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
212
233
  variables?: {
213
234
  type: string;
214
235
  name: string;
215
- labelTranslationKey?: string | undefined;
216
236
  label?: string | undefined;
237
+ labelTranslationKey?: string | undefined;
217
238
  minLength?: number | undefined;
218
239
  defaultValue?: string | undefined;
219
240
  }[] | undefined;
@@ -229,18 +250,14 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
229
250
  variables?: {
230
251
  type: string;
231
252
  name: string;
232
- labelTranslationKey?: string | undefined;
233
253
  label?: string | undefined;
254
+ labelTranslationKey?: string | undefined;
234
255
  minLength?: number | undefined;
235
256
  defaultValue?: string | undefined;
236
257
  }[] | undefined;
237
258
  }>;
238
259
  }, "strip", z.ZodTypeAny, {
239
260
  type: "typeaheadSearch";
240
- meta: {
241
- schemaVersion: "1.0";
242
- labelTranslationKey?: string | undefined;
243
- };
244
261
  graphQL: {
245
262
  displayFields: {
246
263
  label: string;
@@ -253,18 +270,22 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
253
270
  variables?: {
254
271
  type: string;
255
272
  name: string;
256
- labelTranslationKey?: string | undefined;
257
273
  label?: string | undefined;
274
+ labelTranslationKey?: string | undefined;
258
275
  minLength?: number | undefined;
259
276
  defaultValue?: string | undefined;
260
277
  }[] | undefined;
261
278
  };
279
+ attributes?: {
280
+ label?: string | undefined;
281
+ help?: string | undefined;
282
+ labelTranslationKey?: string | undefined;
283
+ } | undefined;
284
+ meta?: {
285
+ schemaVersion: "1.0";
286
+ } | undefined;
262
287
  }, {
263
288
  type: "typeaheadSearch";
264
- meta: {
265
- schemaVersion: "1.0";
266
- labelTranslationKey?: string | undefined;
267
- };
268
289
  graphQL: {
269
290
  displayFields: {
270
291
  label: string;
@@ -277,12 +298,20 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
277
298
  variables?: {
278
299
  type: string;
279
300
  name: string;
280
- labelTranslationKey?: string | undefined;
281
301
  label?: string | undefined;
302
+ labelTranslationKey?: string | undefined;
282
303
  minLength?: number | undefined;
283
304
  defaultValue?: string | undefined;
284
305
  }[] | undefined;
285
306
  };
307
+ attributes?: {
308
+ label?: string | undefined;
309
+ help?: string | undefined;
310
+ labelTranslationKey?: string | undefined;
311
+ } | undefined;
312
+ meta?: {
313
+ schemaVersion: "1.0";
314
+ } | undefined;
286
315
  }>;
287
316
  export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestionSchema>;
288
317
  export type TypeaheadSearchQuestionType = z.infer<typeof TypeaheadSearchQuestionSchema>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypeaheadSearchQuestionSchema = exports.FilteredSearchQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
+ const BaseAttributes = question_1.QuestionSchema.shape.attributes;
6
7
  // An input variable for a GraphQL query
7
8
  const GraphQLVariable = zod_1.z.object({
8
9
  minLength: zod_1.z.number().optional(), // A min length for the variable before executing the query
@@ -30,9 +31,9 @@ const GraphQLQuery = zod_1.z.object({
30
31
  exports.FilteredSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
31
32
  type: zod_1.z.literal('filteredSearch'), // The type of question
32
33
  graphQL: GraphQLQuery, // The GraphQL query options for the filtered search
33
- attributes: zod_1.z.object({
34
+ attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
34
35
  multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is true)
35
- }).optional()
36
+ })).optional()
36
37
  }));
37
38
  // Typeahead search question and answer
38
39
  exports.TypeaheadSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({