@dmptool/types 1.0.6 → 1.0.7

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 (43) hide show
  1. package/README.md +5 -4
  2. package/dist/answers/__tests__/answers.spec.js +59 -7
  3. package/dist/answers/answer.d.ts +3 -3
  4. package/dist/answers/dateAnswers.d.ts +5 -5
  5. package/dist/answers/dateAnswers.js +3 -3
  6. package/dist/answers/index.d.ts +892 -513
  7. package/dist/answers/index.js +3 -2
  8. package/dist/answers/primitiveAnswers.d.ts +39 -0
  9. package/dist/answers/primitiveAnswers.js +8 -1
  10. package/dist/answers/tableAnswers.d.ts +1639 -32
  11. package/dist/answers/tableAnswers.js +10 -3
  12. package/dist/questions/__tests__/dateQuestions.spec.js +20 -20
  13. package/dist/questions/__tests__/primitiveQuestions.spec.js +92 -0
  14. package/dist/questions/__tests__/tableQuestion.spec.d.ts +1 -0
  15. package/dist/questions/__tests__/tableQuestion.spec.js +73 -0
  16. package/dist/questions/dateQuestions.d.ts +19 -19
  17. package/dist/questions/dateQuestions.js +8 -8
  18. package/dist/questions/graphQLQuestions.d.ts +20 -20
  19. package/dist/questions/graphQLQuestions.js +1 -1
  20. package/dist/questions/index.d.ts +1856 -1413
  21. package/dist/questions/index.js +3 -2
  22. package/dist/questions/optionBasedQuestions.js +1 -1
  23. package/dist/questions/primitiveQuestions.d.ts +192 -0
  24. package/dist/questions/primitiveQuestions.js +17 -1
  25. package/dist/questions/question.d.ts +4 -4
  26. package/dist/questions/question.js +2 -1
  27. package/dist/questions/tableQuestions.d.ts +2124 -145
  28. package/dist/questions/tableQuestions.js +7 -3
  29. package/dist/schemas/anyAnswer.schema.json +144 -119
  30. package/dist/schemas/anyQuestion.schema.json +148 -137
  31. package/dist/schemas/anyTableColumnAnswer.schema.json +1 -1
  32. package/dist/schemas/anyTableColumnQuestion.schema.json +2 -3
  33. package/dist/schemas/dateAnswer.schema.json +37 -0
  34. package/dist/schemas/datePickerAnswer.schema.json +4 -4
  35. package/dist/schemas/datePickerQuestion.schema.json +6 -5
  36. package/dist/schemas/dateQuestion.schema.json +51 -0
  37. package/dist/schemas/dateRangeQuestion.schema.json +1 -1
  38. package/dist/schemas/filteredSearchQuestion.schema.json +1 -2
  39. package/dist/schemas/numberRangeAnswer.schema.json +50 -0
  40. package/dist/schemas/numberRangeQuestion.schema.json +106 -0
  41. package/dist/schemas/tableAnswer.schema.json +349 -324
  42. package/dist/schemas/tableQuestion.schema.json +491 -480
  43. package/package.json +1 -1
@@ -33,7 +33,7 @@ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
33
33
  primitiveQuestions_1.BooleanQuestionSchema,
34
34
  optionBasedQuestions_1.CheckboxesQuestionSchema,
35
35
  primitiveQuestions_1.CurrencyQuestionSchema,
36
- dateQuestions_1.DatePickerQuestionSchema,
36
+ dateQuestions_1.DateQuestionSchema,
37
37
  dateQuestions_1.DateRangeQuestionSchema,
38
38
  primitiveQuestions_1.EmailQuestionSchema,
39
39
  graphQLQuestions_1.FilteredSearchQuestionSchema,
@@ -51,11 +51,12 @@ exports.QuestionSchemaMap = {
51
51
  boolean: primitiveQuestions_1.BooleanQuestionSchema,
52
52
  checkBoxes: optionBasedQuestions_1.CheckboxesQuestionSchema,
53
53
  currency: primitiveQuestions_1.CurrencyQuestionSchema,
54
- datePicker: dateQuestions_1.DatePickerQuestionSchema,
54
+ date: dateQuestions_1.DateQuestionSchema,
55
55
  dateRange: dateQuestions_1.DateRangeQuestionSchema,
56
56
  email: primitiveQuestions_1.EmailQuestionSchema,
57
57
  filteredSearch: graphQLQuestions_1.FilteredSearchQuestionSchema,
58
58
  number: primitiveQuestions_1.NumberQuestionSchema,
59
+ numberRange: primitiveQuestions_1.NumberRangeQuestionSchema,
59
60
  radioButtons: optionBasedQuestions_1.RadioButtonsQuestionSchema,
60
61
  selectBox: optionBasedQuestions_1.SelectBoxQuestionSchema,
61
62
  table: tableQuestions_1.TableQuestionSchema,
@@ -40,5 +40,5 @@ exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object
40
40
  options: zod_1.z.array(SelectedOptionSchema),
41
41
  attributes: zod_1.z.object({
42
42
  multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is false)
43
- }).optional(),
43
+ }).optional()
44
44
  }));
@@ -87,6 +87,198 @@ export declare const NumberQuestionSchema: z.ZodObject<{
87
87
  step?: number | undefined;
88
88
  } | undefined;
89
89
  }>;
90
+ export declare const NumberRangeQuestionSchema: z.ZodObject<{
91
+ meta: z.ZodObject<{
92
+ schemaVersion: z.ZodLiteral<"1.0">;
93
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ schemaVersion: "1.0";
96
+ labelTranslationKey?: string | undefined;
97
+ }, {
98
+ schemaVersion: "1.0";
99
+ labelTranslationKey?: string | undefined;
100
+ }>;
101
+ } & {
102
+ type: z.ZodLiteral<"numberRange">;
103
+ columns: z.ZodObject<{
104
+ start: 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<"number">;
116
+ } & {
117
+ attributes: z.ZodObject<{
118
+ label: z.ZodString;
119
+ }, "strip", z.ZodTypeAny, {
120
+ label: string;
121
+ }, {
122
+ label: string;
123
+ }>;
124
+ }, "strip", z.ZodTypeAny, {
125
+ type: "number";
126
+ meta: {
127
+ schemaVersion: "1.0";
128
+ labelTranslationKey?: string | undefined;
129
+ };
130
+ attributes: {
131
+ label: string;
132
+ };
133
+ }, {
134
+ type: "number";
135
+ meta: {
136
+ schemaVersion: "1.0";
137
+ labelTranslationKey?: string | undefined;
138
+ };
139
+ attributes: {
140
+ label: string;
141
+ };
142
+ }>;
143
+ end: z.ZodObject<{
144
+ meta: z.ZodObject<{
145
+ schemaVersion: z.ZodLiteral<"1.0">;
146
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ schemaVersion: "1.0";
149
+ labelTranslationKey?: string | undefined;
150
+ }, {
151
+ schemaVersion: "1.0";
152
+ labelTranslationKey?: string | undefined;
153
+ }>;
154
+ type: z.ZodLiteral<"number">;
155
+ } & {
156
+ attributes: z.ZodObject<{
157
+ label: z.ZodString;
158
+ }, "strip", z.ZodTypeAny, {
159
+ label: string;
160
+ }, {
161
+ label: string;
162
+ }>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ type: "number";
165
+ meta: {
166
+ schemaVersion: "1.0";
167
+ labelTranslationKey?: string | undefined;
168
+ };
169
+ attributes: {
170
+ label: string;
171
+ };
172
+ }, {
173
+ type: "number";
174
+ meta: {
175
+ schemaVersion: "1.0";
176
+ labelTranslationKey?: string | undefined;
177
+ };
178
+ attributes: {
179
+ label: string;
180
+ };
181
+ }>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ start: {
184
+ type: "number";
185
+ meta: {
186
+ schemaVersion: "1.0";
187
+ labelTranslationKey?: string | undefined;
188
+ };
189
+ attributes: {
190
+ label: string;
191
+ };
192
+ };
193
+ end: {
194
+ type: "number";
195
+ meta: {
196
+ schemaVersion: "1.0";
197
+ labelTranslationKey?: string | undefined;
198
+ };
199
+ attributes: {
200
+ label: string;
201
+ };
202
+ };
203
+ }, {
204
+ start: {
205
+ type: "number";
206
+ meta: {
207
+ schemaVersion: "1.0";
208
+ labelTranslationKey?: string | undefined;
209
+ };
210
+ attributes: {
211
+ label: string;
212
+ };
213
+ };
214
+ end: {
215
+ type: "number";
216
+ meta: {
217
+ schemaVersion: "1.0";
218
+ labelTranslationKey?: string | undefined;
219
+ };
220
+ attributes: {
221
+ label: string;
222
+ };
223
+ };
224
+ }>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ type: "numberRange";
227
+ meta: {
228
+ schemaVersion: "1.0";
229
+ labelTranslationKey?: string | undefined;
230
+ };
231
+ columns: {
232
+ start: {
233
+ type: "number";
234
+ meta: {
235
+ schemaVersion: "1.0";
236
+ labelTranslationKey?: string | undefined;
237
+ };
238
+ attributes: {
239
+ label: string;
240
+ };
241
+ };
242
+ end: {
243
+ type: "number";
244
+ meta: {
245
+ schemaVersion: "1.0";
246
+ labelTranslationKey?: string | undefined;
247
+ };
248
+ attributes: {
249
+ label: string;
250
+ };
251
+ };
252
+ };
253
+ }, {
254
+ type: "numberRange";
255
+ meta: {
256
+ schemaVersion: "1.0";
257
+ labelTranslationKey?: string | undefined;
258
+ };
259
+ columns: {
260
+ start: {
261
+ type: "number";
262
+ meta: {
263
+ schemaVersion: "1.0";
264
+ labelTranslationKey?: string | undefined;
265
+ };
266
+ attributes: {
267
+ label: string;
268
+ };
269
+ };
270
+ end: {
271
+ type: "number";
272
+ meta: {
273
+ schemaVersion: "1.0";
274
+ labelTranslationKey?: string | undefined;
275
+ };
276
+ attributes: {
277
+ label: string;
278
+ };
279
+ };
280
+ };
281
+ }>;
90
282
  export declare const CurrencyQuestionSchema: z.ZodObject<{
91
283
  attributes: z.ZodOptional<z.ZodObject<{
92
284
  max: z.ZodOptional<z.ZodNumber>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = exports.CurrencyQuestionSchema = exports.NumberQuestionSchema = exports.BooleanQuestionSchema = void 0;
3
+ exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = exports.CurrencyQuestionSchema = exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.BooleanQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  const BaseMeta = question_1.QuestionSchema.shape.meta;
@@ -20,6 +20,22 @@ exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
20
20
  step: zod_1.z.number().optional() // The step value (use 0.01 or similar for float)
21
21
  }).optional(),
22
22
  }));
23
+ // A range of numbers question and answer
24
+ exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
25
+ type: zod_1.z.literal('numberRange'), // The type of question
26
+ columns: zod_1.z.object({
27
+ start: exports.NumberQuestionSchema.merge(zod_1.z.object({
28
+ attributes: zod_1.z.object({
29
+ label: zod_1.z.string() // The label for the start number
30
+ })
31
+ })),
32
+ end: exports.NumberQuestionSchema.merge(zod_1.z.object({
33
+ attributes: zod_1.z.object({
34
+ label: zod_1.z.string() // The label for the end number
35
+ })
36
+ }))
37
+ })
38
+ }));
23
39
  // Currency question and answer
24
40
  exports.CurrencyQuestionSchema = exports.NumberQuestionSchema.merge(zod_1.z.object({
25
41
  type: zod_1.z.literal('currency'), // The type of question
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const CURRENT_SCHEMA_VERSION = "1.0";
3
- export declare const QuestionTypesEnum: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
3
+ export declare const QuestionTypesEnum: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
4
4
  export declare const QuestionSchema: z.ZodObject<{
5
- type: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
5
+ type: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
6
6
  meta: z.ZodObject<{
7
7
  schemaVersion: z.ZodLiteral<"1.0">;
8
8
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -14,13 +14,13 @@ export declare const QuestionSchema: z.ZodObject<{
14
14
  labelTranslationKey?: string | undefined;
15
15
  }>;
16
16
  }, "strip", z.ZodTypeAny, {
17
- type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
17
+ type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
18
18
  meta: {
19
19
  schemaVersion: "1.0";
20
20
  labelTranslationKey?: string | undefined;
21
21
  };
22
22
  }, {
23
- type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
23
+ type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
24
24
  meta: {
25
25
  schemaVersion: "1.0";
26
26
  labelTranslationKey?: string | undefined;
@@ -8,11 +8,12 @@ exports.QuestionTypesEnum = zod_1.z.enum([
8
8
  'boolean',
9
9
  'checkBoxes',
10
10
  'currency',
11
- 'datePicker',
11
+ 'date',
12
12
  'dateRange',
13
13
  'email',
14
14
  'filteredSearch',
15
15
  'number',
16
+ 'numberRange',
16
17
  'radioButtons',
17
18
  'selectBox',
18
19
  'table',