@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.
- package/README.md +2 -0
- package/dist/answers/__tests__/answers.spec.js +18 -17
- package/dist/answers/index.d.ts +80 -55
- package/dist/answers/index.js +19 -17
- package/dist/answers/numberAnswers.d.ts +91 -0
- package/dist/answers/numberAnswers.js +21 -0
- package/dist/answers/optionBasedAnswers.d.ts +25 -0
- package/dist/answers/optionBasedAnswers.js +5 -1
- package/dist/answers/tableAnswers.d.ts +108 -108
- package/dist/answers/tableAnswers.js +9 -8
- package/dist/answers/textAnswers.d.ts +101 -0
- package/dist/answers/textAnswers.js +22 -0
- package/dist/questions/__tests__/dateQuestions.spec.js +20 -74
- package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -0
- package/dist/questions/__tests__/numberQuestions.spec.js +108 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +91 -54
- package/dist/questions/__tests__/tableQuestion.spec.js +2 -0
- package/dist/questions/__tests__/textQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/textQuestions.spec.js +120 -0
- package/dist/questions/dateQuestions.d.ts +159 -178
- package/dist/questions/dateQuestions.js +9 -15
- package/dist/questions/graphQLQuestions.d.ts +67 -38
- package/dist/questions/graphQLQuestions.js +3 -2
- package/dist/questions/index.d.ts +1800 -1379
- package/dist/questions/index.js +22 -19
- package/dist/questions/numberQuestions.d.ts +292 -0
- package/dist/questions/numberQuestions.js +28 -0
- package/dist/questions/optionBasedQuestions.d.ts +186 -157
- package/dist/questions/optionBasedQuestions.js +17 -20
- package/dist/questions/question.d.ts +29 -11
- package/dist/questions/question.js +10 -4
- package/dist/questions/tableQuestions.d.ts +2395 -2048
- package/dist/questions/tableQuestions.js +12 -10
- package/dist/questions/textQuestions.d.ts +261 -0
- package/dist/questions/textQuestions.js +42 -0
- package/dist/schemas/anyQuestion.schema.json +269 -238
- package/dist/schemas/anyTableColumnQuestion.schema.json +207 -216
- package/dist/schemas/booleanQuestion.schema.json +17 -11
- package/dist/schemas/checkboxesQuestion.schema.json +24 -27
- package/dist/schemas/currencyQuestion.schema.json +23 -18
- package/dist/schemas/dateQuestion.schema.json +21 -16
- package/dist/schemas/dateRangeQuestion.schema.json +31 -56
- package/dist/schemas/emailQuestion.schema.json +24 -19
- package/dist/schemas/filteredSearchQuestion.schema.json +18 -13
- package/dist/schemas/numberQuestion.schema.json +21 -16
- package/dist/schemas/numberRangeQuestion.schema.json +31 -56
- package/dist/schemas/radioButtonsQuestion.schema.json +24 -27
- package/dist/schemas/selectBoxQuestion.schema.json +27 -36
- package/dist/schemas/tableQuestion.schema.json +233 -234
- package/dist/schemas/textAreaQuestion.schema.json +22 -16
- package/dist/schemas/textQuestion.schema.json +21 -16
- package/dist/schemas/typeaheadSearchQuestion.schema.json +15 -4
- package/dist/schemas/urlQuestion.schema.json +21 -16
- package/package.json +1 -1
- package/dist/answers/primitiveAnswers.d.ts +0 -216
- package/dist/answers/primitiveAnswers.js +0 -41
- package/dist/questions/__tests__/primitiveQuestions.spec.js +0 -281
- package/dist/questions/primitiveQuestions.d.ts +0 -555
- package/dist/questions/primitiveQuestions.js +0 -86
- /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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
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
|
-
|
|
68
|
+
label?: string | undefined;
|
|
69
|
+
help?: string | undefined;
|
|
57
70
|
labelTranslationKey?: string | undefined;
|
|
58
71
|
}, {
|
|
59
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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:
|
|
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:
|
|
20
|
-
|
|
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
|
}));
|