@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,236 +1,265 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
3
|
-
meta: z.ZodObject<{
|
|
2
|
+
export declare const BooleanQuestionSchema: 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";
|
|
9
|
+
}>>;
|
|
10
|
+
} & {
|
|
11
|
+
type: z.ZodLiteral<"boolean">;
|
|
12
|
+
attributes: z.ZodObject<{
|
|
13
|
+
label: z.ZodOptional<z.ZodString>;
|
|
14
|
+
help: z.ZodOptional<z.ZodString>;
|
|
15
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
16
|
+
} & {
|
|
17
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
label?: string | undefined;
|
|
20
|
+
help?: string | undefined;
|
|
11
21
|
labelTranslationKey?: string | undefined;
|
|
22
|
+
checked?: boolean | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
label?: string | undefined;
|
|
25
|
+
help?: string | undefined;
|
|
26
|
+
labelTranslationKey?: string | undefined;
|
|
27
|
+
checked?: boolean | undefined;
|
|
12
28
|
}>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
type: "boolean";
|
|
31
|
+
attributes: {
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
help?: string | undefined;
|
|
34
|
+
labelTranslationKey?: string | undefined;
|
|
35
|
+
checked?: boolean | undefined;
|
|
36
|
+
};
|
|
37
|
+
meta?: {
|
|
38
|
+
schemaVersion: "1.0";
|
|
39
|
+
} | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
type: "boolean";
|
|
42
|
+
attributes: {
|
|
43
|
+
label?: string | undefined;
|
|
44
|
+
help?: string | undefined;
|
|
45
|
+
labelTranslationKey?: string | undefined;
|
|
46
|
+
checked?: boolean | undefined;
|
|
47
|
+
};
|
|
48
|
+
meta?: {
|
|
49
|
+
schemaVersion: "1.0";
|
|
50
|
+
} | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
53
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
label: z.ZodOptional<z.ZodString>;
|
|
55
|
+
help: z.ZodOptional<z.ZodString>;
|
|
56
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
label?: string | undefined;
|
|
59
|
+
help?: string | undefined;
|
|
60
|
+
labelTranslationKey?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
label?: string | undefined;
|
|
63
|
+
help?: string | undefined;
|
|
64
|
+
labelTranslationKey?: string | undefined;
|
|
65
|
+
}>>;
|
|
66
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
schemaVersion: "1.0";
|
|
70
|
+
}, {
|
|
71
|
+
schemaVersion: "1.0";
|
|
72
|
+
}>>;
|
|
13
73
|
} & {
|
|
14
74
|
type: z.ZodLiteral<"checkBoxes">;
|
|
15
75
|
options: z.ZodArray<z.ZodObject<{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} & {
|
|
21
|
-
checked: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
value: string;
|
|
24
|
-
label: string;
|
|
25
|
-
checked?: boolean | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
value: string;
|
|
28
|
-
label: string;
|
|
29
|
-
checked?: boolean | undefined;
|
|
30
|
-
}>;
|
|
76
|
+
label: z.ZodString;
|
|
77
|
+
value: z.ZodString;
|
|
78
|
+
} & {
|
|
79
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
31
80
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
label: string;
|
|
36
|
-
checked?: boolean | undefined;
|
|
37
|
-
};
|
|
81
|
+
value: string;
|
|
82
|
+
label: string;
|
|
83
|
+
checked?: boolean | undefined;
|
|
38
84
|
}, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
label: string;
|
|
43
|
-
checked?: boolean | undefined;
|
|
44
|
-
};
|
|
85
|
+
value: string;
|
|
86
|
+
label: string;
|
|
87
|
+
checked?: boolean | undefined;
|
|
45
88
|
}>, "many">;
|
|
46
89
|
}, "strip", z.ZodTypeAny, {
|
|
47
|
-
type: "checkBoxes";
|
|
48
90
|
options: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
label: string;
|
|
53
|
-
checked?: boolean | undefined;
|
|
54
|
-
};
|
|
91
|
+
value: string;
|
|
92
|
+
label: string;
|
|
93
|
+
checked?: boolean | undefined;
|
|
55
94
|
}[];
|
|
56
|
-
|
|
57
|
-
|
|
95
|
+
type: "checkBoxes";
|
|
96
|
+
attributes?: {
|
|
97
|
+
label?: string | undefined;
|
|
98
|
+
help?: string | undefined;
|
|
58
99
|
labelTranslationKey?: string | undefined;
|
|
59
|
-
};
|
|
100
|
+
} | undefined;
|
|
101
|
+
meta?: {
|
|
102
|
+
schemaVersion: "1.0";
|
|
103
|
+
} | undefined;
|
|
60
104
|
}, {
|
|
61
|
-
type: "checkBoxes";
|
|
62
105
|
options: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
label: string;
|
|
67
|
-
checked?: boolean | undefined;
|
|
68
|
-
};
|
|
106
|
+
value: string;
|
|
107
|
+
label: string;
|
|
108
|
+
checked?: boolean | undefined;
|
|
69
109
|
}[];
|
|
70
|
-
|
|
71
|
-
|
|
110
|
+
type: "checkBoxes";
|
|
111
|
+
attributes?: {
|
|
112
|
+
label?: string | undefined;
|
|
113
|
+
help?: string | undefined;
|
|
72
114
|
labelTranslationKey?: string | undefined;
|
|
73
|
-
};
|
|
115
|
+
} | undefined;
|
|
116
|
+
meta?: {
|
|
117
|
+
schemaVersion: "1.0";
|
|
118
|
+
} | undefined;
|
|
74
119
|
}>;
|
|
75
120
|
export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
76
|
-
|
|
77
|
-
|
|
121
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
122
|
+
label: z.ZodOptional<z.ZodString>;
|
|
123
|
+
help: z.ZodOptional<z.ZodString>;
|
|
78
124
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
79
125
|
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
|
|
126
|
+
label?: string | undefined;
|
|
127
|
+
help?: string | undefined;
|
|
81
128
|
labelTranslationKey?: string | undefined;
|
|
82
129
|
}, {
|
|
83
|
-
|
|
130
|
+
label?: string | undefined;
|
|
131
|
+
help?: string | undefined;
|
|
84
132
|
labelTranslationKey?: string | undefined;
|
|
85
|
-
}
|
|
133
|
+
}>>;
|
|
134
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
schemaVersion: "1.0";
|
|
138
|
+
}, {
|
|
139
|
+
schemaVersion: "1.0";
|
|
140
|
+
}>>;
|
|
86
141
|
} & {
|
|
87
142
|
type: z.ZodLiteral<"radioButtons">;
|
|
88
143
|
options: z.ZodArray<z.ZodObject<{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} & {
|
|
94
|
-
selected: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
-
}, "strip", z.ZodTypeAny, {
|
|
96
|
-
value: string;
|
|
97
|
-
label: string;
|
|
98
|
-
selected?: boolean | undefined;
|
|
99
|
-
}, {
|
|
100
|
-
value: string;
|
|
101
|
-
label: string;
|
|
102
|
-
selected?: boolean | undefined;
|
|
103
|
-
}>;
|
|
144
|
+
label: z.ZodString;
|
|
145
|
+
value: z.ZodString;
|
|
146
|
+
} & {
|
|
147
|
+
selected: z.ZodOptional<z.ZodBoolean>;
|
|
104
148
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
label: string;
|
|
109
|
-
selected?: boolean | undefined;
|
|
110
|
-
};
|
|
149
|
+
value: string;
|
|
150
|
+
label: string;
|
|
151
|
+
selected?: boolean | undefined;
|
|
111
152
|
}, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
label: string;
|
|
116
|
-
selected?: boolean | undefined;
|
|
117
|
-
};
|
|
153
|
+
value: string;
|
|
154
|
+
label: string;
|
|
155
|
+
selected?: boolean | undefined;
|
|
118
156
|
}>, "many">;
|
|
119
157
|
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
type: "radioButtons";
|
|
121
158
|
options: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
label: string;
|
|
126
|
-
selected?: boolean | undefined;
|
|
127
|
-
};
|
|
159
|
+
value: string;
|
|
160
|
+
label: string;
|
|
161
|
+
selected?: boolean | undefined;
|
|
128
162
|
}[];
|
|
129
|
-
|
|
130
|
-
|
|
163
|
+
type: "radioButtons";
|
|
164
|
+
attributes?: {
|
|
165
|
+
label?: string | undefined;
|
|
166
|
+
help?: string | undefined;
|
|
131
167
|
labelTranslationKey?: string | undefined;
|
|
132
|
-
};
|
|
168
|
+
} | undefined;
|
|
169
|
+
meta?: {
|
|
170
|
+
schemaVersion: "1.0";
|
|
171
|
+
} | undefined;
|
|
133
172
|
}, {
|
|
134
|
-
type: "radioButtons";
|
|
135
173
|
options: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
label: string;
|
|
140
|
-
selected?: boolean | undefined;
|
|
141
|
-
};
|
|
174
|
+
value: string;
|
|
175
|
+
label: string;
|
|
176
|
+
selected?: boolean | undefined;
|
|
142
177
|
}[];
|
|
143
|
-
|
|
144
|
-
|
|
178
|
+
type: "radioButtons";
|
|
179
|
+
attributes?: {
|
|
180
|
+
label?: string | undefined;
|
|
181
|
+
help?: string | undefined;
|
|
145
182
|
labelTranslationKey?: string | undefined;
|
|
146
|
-
};
|
|
183
|
+
} | undefined;
|
|
184
|
+
meta?: {
|
|
185
|
+
schemaVersion: "1.0";
|
|
186
|
+
} | undefined;
|
|
147
187
|
}>;
|
|
148
188
|
export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
149
|
-
meta: z.ZodObject<{
|
|
189
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
150
190
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
151
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
152
191
|
}, "strip", z.ZodTypeAny, {
|
|
153
192
|
schemaVersion: "1.0";
|
|
154
|
-
labelTranslationKey?: string | undefined;
|
|
155
193
|
}, {
|
|
156
194
|
schemaVersion: "1.0";
|
|
157
|
-
|
|
158
|
-
}>;
|
|
195
|
+
}>>;
|
|
159
196
|
} & {
|
|
160
197
|
type: z.ZodLiteral<"selectBox">;
|
|
161
198
|
options: z.ZodArray<z.ZodObject<{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} & {
|
|
167
|
-
selected: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
-
}, "strip", z.ZodTypeAny, {
|
|
169
|
-
value: string;
|
|
170
|
-
label: string;
|
|
171
|
-
selected?: boolean | undefined;
|
|
172
|
-
}, {
|
|
173
|
-
value: string;
|
|
174
|
-
label: string;
|
|
175
|
-
selected?: boolean | undefined;
|
|
176
|
-
}>;
|
|
199
|
+
label: z.ZodString;
|
|
200
|
+
value: z.ZodString;
|
|
201
|
+
} & {
|
|
202
|
+
selected: z.ZodOptional<z.ZodBoolean>;
|
|
177
203
|
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
label: string;
|
|
182
|
-
selected?: boolean | undefined;
|
|
183
|
-
};
|
|
204
|
+
value: string;
|
|
205
|
+
label: string;
|
|
206
|
+
selected?: boolean | undefined;
|
|
184
207
|
}, {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
label: string;
|
|
189
|
-
selected?: boolean | undefined;
|
|
190
|
-
};
|
|
208
|
+
value: string;
|
|
209
|
+
label: string;
|
|
210
|
+
selected?: boolean | undefined;
|
|
191
211
|
}>, "many">;
|
|
192
212
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
213
|
+
label: z.ZodOptional<z.ZodString>;
|
|
214
|
+
help: z.ZodOptional<z.ZodString>;
|
|
215
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
216
|
+
} & {
|
|
193
217
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
194
218
|
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
label?: string | undefined;
|
|
220
|
+
help?: string | undefined;
|
|
221
|
+
labelTranslationKey?: string | undefined;
|
|
195
222
|
multiple?: boolean | undefined;
|
|
196
223
|
}, {
|
|
224
|
+
label?: string | undefined;
|
|
225
|
+
help?: string | undefined;
|
|
226
|
+
labelTranslationKey?: string | undefined;
|
|
197
227
|
multiple?: boolean | undefined;
|
|
198
228
|
}>>;
|
|
199
229
|
}, "strip", z.ZodTypeAny, {
|
|
200
|
-
type: "selectBox";
|
|
201
230
|
options: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
label: string;
|
|
206
|
-
selected?: boolean | undefined;
|
|
207
|
-
};
|
|
231
|
+
value: string;
|
|
232
|
+
label: string;
|
|
233
|
+
selected?: boolean | undefined;
|
|
208
234
|
}[];
|
|
209
|
-
|
|
210
|
-
schemaVersion: "1.0";
|
|
211
|
-
labelTranslationKey?: string | undefined;
|
|
212
|
-
};
|
|
235
|
+
type: "selectBox";
|
|
213
236
|
attributes?: {
|
|
237
|
+
label?: string | undefined;
|
|
238
|
+
help?: string | undefined;
|
|
239
|
+
labelTranslationKey?: string | undefined;
|
|
214
240
|
multiple?: boolean | undefined;
|
|
215
241
|
} | undefined;
|
|
242
|
+
meta?: {
|
|
243
|
+
schemaVersion: "1.0";
|
|
244
|
+
} | undefined;
|
|
216
245
|
}, {
|
|
217
|
-
type: "selectBox";
|
|
218
246
|
options: {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
label: string;
|
|
223
|
-
selected?: boolean | undefined;
|
|
224
|
-
};
|
|
247
|
+
value: string;
|
|
248
|
+
label: string;
|
|
249
|
+
selected?: boolean | undefined;
|
|
225
250
|
}[];
|
|
226
|
-
|
|
227
|
-
schemaVersion: "1.0";
|
|
228
|
-
labelTranslationKey?: string | undefined;
|
|
229
|
-
};
|
|
251
|
+
type: "selectBox";
|
|
230
252
|
attributes?: {
|
|
253
|
+
label?: string | undefined;
|
|
254
|
+
help?: string | undefined;
|
|
255
|
+
labelTranslationKey?: string | undefined;
|
|
231
256
|
multiple?: boolean | undefined;
|
|
232
257
|
} | undefined;
|
|
258
|
+
meta?: {
|
|
259
|
+
schemaVersion: "1.0";
|
|
260
|
+
} | undefined;
|
|
233
261
|
}>;
|
|
262
|
+
export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
|
|
234
263
|
export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
|
|
235
264
|
export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
|
|
236
265
|
export type SelectBoxQuestionType = z.infer<typeof SelectBoxQuestionSchema>;
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = void 0;
|
|
3
|
+
exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = exports.BooleanQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
// A select box, radio buttons, or checkboxes option
|
|
7
7
|
const OptionSchema = zod_1.z.object({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
label: zod_1.z.string(), // The label of the option
|
|
11
|
-
value: zod_1.z.string(), // The value of the option
|
|
12
|
-
}),
|
|
8
|
+
label: zod_1.z.string(), // The label of the option
|
|
9
|
+
value: zod_1.z.string(), // The value of the option
|
|
13
10
|
});
|
|
14
|
-
const
|
|
15
|
-
const CheckedOptionSchema = zod_1.z.object({
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
12
|
+
const CheckedOptionSchema = OptionSchema.merge(zod_1.z.object({
|
|
13
|
+
checked: zod_1.z.boolean().optional(),
|
|
14
|
+
}));
|
|
15
|
+
const SelectedOptionSchema = OptionSchema.merge(zod_1.z.object({
|
|
16
|
+
selected: zod_1.z.boolean().optional(),
|
|
17
|
+
}));
|
|
18
|
+
exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
19
|
+
type: zod_1.z.literal('boolean'),
|
|
20
|
+
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
18
21
|
checked: zod_1.z.boolean().optional(),
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
const SelectedOptionSchema = zod_1.z.object({
|
|
22
|
-
type: zod_1.z.literal('option'),
|
|
23
|
-
attributes: BaseOptionAttributes.extend({
|
|
24
|
-
selected: zod_1.z.boolean().optional(),
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
22
|
+
})),
|
|
23
|
+
}));
|
|
27
24
|
// Check boxes question and answer
|
|
28
25
|
exports.CheckboxesQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
29
26
|
type: zod_1.z.literal('checkBoxes'), // The type of question
|
|
@@ -38,7 +35,7 @@ exports.RadioButtonsQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.obj
|
|
|
38
35
|
exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
39
36
|
type: zod_1.z.literal('selectBox'), // The type of question
|
|
40
37
|
options: zod_1.z.array(SelectedOptionSchema),
|
|
41
|
-
attributes: zod_1.z.object({
|
|
38
|
+
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
42
39
|
multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is false)
|
|
43
|
-
}).optional()
|
|
40
|
+
})).optional()
|
|
44
41
|
}));
|
|
@@ -3,27 +3,45 @@ export declare const CURRENT_SCHEMA_VERSION = "1.0";
|
|
|
3
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
5
|
type: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
label: z.ZodOptional<z.ZodString>;
|
|
8
|
+
help: z.ZodOptional<z.ZodString>;
|
|
8
9
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
9
10
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
help?: string | undefined;
|
|
11
13
|
labelTranslationKey?: string | undefined;
|
|
12
14
|
}, {
|
|
13
|
-
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
help?: string | undefined;
|
|
14
17
|
labelTranslationKey?: string | undefined;
|
|
15
|
-
}
|
|
18
|
+
}>>;
|
|
19
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
schemaVersion: "1.0";
|
|
23
|
+
}, {
|
|
24
|
+
schemaVersion: "1.0";
|
|
25
|
+
}>>;
|
|
16
26
|
}, "strip", z.ZodTypeAny, {
|
|
17
27
|
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
attributes?: {
|
|
29
|
+
label?: string | undefined;
|
|
30
|
+
help?: string | undefined;
|
|
20
31
|
labelTranslationKey?: string | undefined;
|
|
21
|
-
};
|
|
32
|
+
} | undefined;
|
|
33
|
+
meta?: {
|
|
34
|
+
schemaVersion: "1.0";
|
|
35
|
+
} | undefined;
|
|
22
36
|
}, {
|
|
23
37
|
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
attributes?: {
|
|
39
|
+
label?: string | undefined;
|
|
40
|
+
help?: string | undefined;
|
|
26
41
|
labelTranslationKey?: string | undefined;
|
|
27
|
-
};
|
|
42
|
+
} | undefined;
|
|
43
|
+
meta?: {
|
|
44
|
+
schemaVersion: "1.0";
|
|
45
|
+
} | undefined;
|
|
28
46
|
}>;
|
|
29
47
|
export type QuestionType = z.infer<typeof QuestionSchema>;
|
|
@@ -22,11 +22,17 @@ exports.QuestionTypesEnum = zod_1.z.enum([
|
|
|
22
22
|
'typeaheadSearch',
|
|
23
23
|
'url'
|
|
24
24
|
]);
|
|
25
|
+
const DefaultMetaSchema = zod_1.z.object({
|
|
26
|
+
schemaVersion: zod_1.z.literal(exports.CURRENT_SCHEMA_VERSION), // The schema version (default is CURRENT_SCHEMA_VERSION)
|
|
27
|
+
});
|
|
28
|
+
const DefaultAttributesSchema = zod_1.z.object({
|
|
29
|
+
label: zod_1.z.string().optional(), // UI label for the field
|
|
30
|
+
help: zod_1.z.string().optional(), // Help/tooltip text for the field
|
|
31
|
+
labelTranslationKey: zod_1.z.string().optional() // The translation key for the label (DMP Tool only)
|
|
32
|
+
});
|
|
25
33
|
// Base abstract type for all questions
|
|
26
34
|
exports.QuestionSchema = zod_1.z.object({
|
|
27
35
|
type: exports.QuestionTypesEnum, // The type of question
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
labelTranslationKey: zod_1.z.string().optional() // The translation key for the label (DMP Tool only)
|
|
31
|
-
}),
|
|
36
|
+
attributes: DefaultAttributesSchema.optional(), // Field attributes
|
|
37
|
+
meta: DefaultMetaSchema.optional(), // Meta information for the field
|
|
32
38
|
});
|