@dmptool/types 1.0.8 → 1.1.0
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/dist/answers/__tests__/answers.spec.js +18 -17
- package/dist/answers/index.d.ts +50 -25
- package/dist/answers/index.js +19 -17
- package/dist/answers/{primitiveAnswers.d.ts → numberAnswers.d.ts} +0 -100
- package/dist/answers/numberAnswers.js +25 -0
- package/dist/answers/tableAnswers.d.ts +48 -48
- 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 +156 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +41 -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 +1616 -1356
- package/dist/questions/index.js +21 -19
- package/dist/questions/numberQuestions.d.ts +343 -0
- package/dist/questions/numberQuestions.js +34 -0
- package/dist/questions/optionBasedQuestions.d.ts +136 -158
- package/dist/questions/optionBasedQuestions.js +11 -20
- package/dist/questions/question.d.ts +29 -11
- package/dist/questions/question.js +10 -4
- package/dist/questions/tableQuestions.d.ts +2377 -2030
- 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 +237 -239
- package/dist/schemas/anyTableColumnQuestion.schema.json +207 -217
- package/dist/schemas/booleanQuestion.schema.json +17 -12
- 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 -235
- 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.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,235 +1,213 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
label: z.ZodOptional<z.ZodString>;
|
|
5
|
+
help: z.ZodOptional<z.ZodString>;
|
|
5
6
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
6
7
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
help?: string | undefined;
|
|
8
10
|
labelTranslationKey?: string | undefined;
|
|
9
11
|
}, {
|
|
10
|
-
|
|
12
|
+
label?: string | undefined;
|
|
13
|
+
help?: string | undefined;
|
|
11
14
|
labelTranslationKey?: string | undefined;
|
|
12
|
-
}
|
|
15
|
+
}>>;
|
|
16
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
schemaVersion: "1.0";
|
|
20
|
+
}, {
|
|
21
|
+
schemaVersion: "1.0";
|
|
22
|
+
}>>;
|
|
13
23
|
} & {
|
|
14
24
|
type: z.ZodLiteral<"checkBoxes">;
|
|
15
25
|
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
|
-
}>;
|
|
26
|
+
label: z.ZodString;
|
|
27
|
+
value: z.ZodString;
|
|
28
|
+
} & {
|
|
29
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
31
30
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
label: string;
|
|
36
|
-
checked?: boolean | undefined;
|
|
37
|
-
};
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
checked?: boolean | undefined;
|
|
38
34
|
}, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
label: string;
|
|
43
|
-
checked?: boolean | undefined;
|
|
44
|
-
};
|
|
35
|
+
value: string;
|
|
36
|
+
label: string;
|
|
37
|
+
checked?: boolean | undefined;
|
|
45
38
|
}>, "many">;
|
|
46
39
|
}, "strip", z.ZodTypeAny, {
|
|
47
|
-
type: "checkBoxes";
|
|
48
40
|
options: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
label: string;
|
|
53
|
-
checked?: boolean | undefined;
|
|
54
|
-
};
|
|
41
|
+
value: string;
|
|
42
|
+
label: string;
|
|
43
|
+
checked?: boolean | undefined;
|
|
55
44
|
}[];
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
type: "checkBoxes";
|
|
46
|
+
attributes?: {
|
|
47
|
+
label?: string | undefined;
|
|
48
|
+
help?: string | undefined;
|
|
58
49
|
labelTranslationKey?: string | undefined;
|
|
59
|
-
};
|
|
50
|
+
} | undefined;
|
|
51
|
+
meta?: {
|
|
52
|
+
schemaVersion: "1.0";
|
|
53
|
+
} | undefined;
|
|
60
54
|
}, {
|
|
61
|
-
type: "checkBoxes";
|
|
62
55
|
options: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
label: string;
|
|
67
|
-
checked?: boolean | undefined;
|
|
68
|
-
};
|
|
56
|
+
value: string;
|
|
57
|
+
label: string;
|
|
58
|
+
checked?: boolean | undefined;
|
|
69
59
|
}[];
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
type: "checkBoxes";
|
|
61
|
+
attributes?: {
|
|
62
|
+
label?: string | undefined;
|
|
63
|
+
help?: string | undefined;
|
|
72
64
|
labelTranslationKey?: string | undefined;
|
|
73
|
-
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
meta?: {
|
|
67
|
+
schemaVersion: "1.0";
|
|
68
|
+
} | undefined;
|
|
74
69
|
}>;
|
|
75
70
|
export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
label: z.ZodOptional<z.ZodString>;
|
|
73
|
+
help: z.ZodOptional<z.ZodString>;
|
|
78
74
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
79
75
|
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
|
|
76
|
+
label?: string | undefined;
|
|
77
|
+
help?: string | undefined;
|
|
81
78
|
labelTranslationKey?: string | undefined;
|
|
82
79
|
}, {
|
|
83
|
-
|
|
80
|
+
label?: string | undefined;
|
|
81
|
+
help?: string | undefined;
|
|
84
82
|
labelTranslationKey?: string | undefined;
|
|
85
|
-
}
|
|
83
|
+
}>>;
|
|
84
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
schemaVersion: "1.0";
|
|
88
|
+
}, {
|
|
89
|
+
schemaVersion: "1.0";
|
|
90
|
+
}>>;
|
|
86
91
|
} & {
|
|
87
92
|
type: z.ZodLiteral<"radioButtons">;
|
|
88
93
|
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
|
-
}>;
|
|
94
|
+
label: z.ZodString;
|
|
95
|
+
value: z.ZodString;
|
|
96
|
+
} & {
|
|
97
|
+
selected: z.ZodOptional<z.ZodBoolean>;
|
|
104
98
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
label: string;
|
|
109
|
-
selected?: boolean | undefined;
|
|
110
|
-
};
|
|
99
|
+
value: string;
|
|
100
|
+
label: string;
|
|
101
|
+
selected?: boolean | undefined;
|
|
111
102
|
}, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
label: string;
|
|
116
|
-
selected?: boolean | undefined;
|
|
117
|
-
};
|
|
103
|
+
value: string;
|
|
104
|
+
label: string;
|
|
105
|
+
selected?: boolean | undefined;
|
|
118
106
|
}>, "many">;
|
|
119
107
|
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
type: "radioButtons";
|
|
121
108
|
options: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
label: string;
|
|
126
|
-
selected?: boolean | undefined;
|
|
127
|
-
};
|
|
109
|
+
value: string;
|
|
110
|
+
label: string;
|
|
111
|
+
selected?: boolean | undefined;
|
|
128
112
|
}[];
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
type: "radioButtons";
|
|
114
|
+
attributes?: {
|
|
115
|
+
label?: string | undefined;
|
|
116
|
+
help?: string | undefined;
|
|
131
117
|
labelTranslationKey?: string | undefined;
|
|
132
|
-
};
|
|
118
|
+
} | undefined;
|
|
119
|
+
meta?: {
|
|
120
|
+
schemaVersion: "1.0";
|
|
121
|
+
} | undefined;
|
|
133
122
|
}, {
|
|
134
|
-
type: "radioButtons";
|
|
135
123
|
options: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
label: string;
|
|
140
|
-
selected?: boolean | undefined;
|
|
141
|
-
};
|
|
124
|
+
value: string;
|
|
125
|
+
label: string;
|
|
126
|
+
selected?: boolean | undefined;
|
|
142
127
|
}[];
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
type: "radioButtons";
|
|
129
|
+
attributes?: {
|
|
130
|
+
label?: string | undefined;
|
|
131
|
+
help?: string | undefined;
|
|
145
132
|
labelTranslationKey?: string | undefined;
|
|
146
|
-
};
|
|
133
|
+
} | undefined;
|
|
134
|
+
meta?: {
|
|
135
|
+
schemaVersion: "1.0";
|
|
136
|
+
} | undefined;
|
|
147
137
|
}>;
|
|
148
138
|
export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
149
|
-
meta: z.ZodObject<{
|
|
139
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
150
140
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
151
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
152
141
|
}, "strip", z.ZodTypeAny, {
|
|
153
142
|
schemaVersion: "1.0";
|
|
154
|
-
labelTranslationKey?: string | undefined;
|
|
155
143
|
}, {
|
|
156
144
|
schemaVersion: "1.0";
|
|
157
|
-
|
|
158
|
-
}>;
|
|
145
|
+
}>>;
|
|
159
146
|
} & {
|
|
160
147
|
type: z.ZodLiteral<"selectBox">;
|
|
161
148
|
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
|
-
}>;
|
|
149
|
+
label: z.ZodString;
|
|
150
|
+
value: z.ZodString;
|
|
151
|
+
} & {
|
|
152
|
+
selected: z.ZodOptional<z.ZodBoolean>;
|
|
177
153
|
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
label: string;
|
|
182
|
-
selected?: boolean | undefined;
|
|
183
|
-
};
|
|
154
|
+
value: string;
|
|
155
|
+
label: string;
|
|
156
|
+
selected?: boolean | undefined;
|
|
184
157
|
}, {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
label: string;
|
|
189
|
-
selected?: boolean | undefined;
|
|
190
|
-
};
|
|
158
|
+
value: string;
|
|
159
|
+
label: string;
|
|
160
|
+
selected?: boolean | undefined;
|
|
191
161
|
}>, "many">;
|
|
192
162
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
label: z.ZodOptional<z.ZodString>;
|
|
164
|
+
help: z.ZodOptional<z.ZodString>;
|
|
165
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
166
|
+
} & {
|
|
193
167
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
194
168
|
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
label?: string | undefined;
|
|
170
|
+
help?: string | undefined;
|
|
171
|
+
labelTranslationKey?: string | undefined;
|
|
195
172
|
multiple?: boolean | undefined;
|
|
196
173
|
}, {
|
|
174
|
+
label?: string | undefined;
|
|
175
|
+
help?: string | undefined;
|
|
176
|
+
labelTranslationKey?: string | undefined;
|
|
197
177
|
multiple?: boolean | undefined;
|
|
198
178
|
}>>;
|
|
199
179
|
}, "strip", z.ZodTypeAny, {
|
|
200
|
-
type: "selectBox";
|
|
201
180
|
options: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
label: string;
|
|
206
|
-
selected?: boolean | undefined;
|
|
207
|
-
};
|
|
181
|
+
value: string;
|
|
182
|
+
label: string;
|
|
183
|
+
selected?: boolean | undefined;
|
|
208
184
|
}[];
|
|
209
|
-
|
|
210
|
-
schemaVersion: "1.0";
|
|
211
|
-
labelTranslationKey?: string | undefined;
|
|
212
|
-
};
|
|
185
|
+
type: "selectBox";
|
|
213
186
|
attributes?: {
|
|
187
|
+
label?: string | undefined;
|
|
188
|
+
help?: string | undefined;
|
|
189
|
+
labelTranslationKey?: string | undefined;
|
|
214
190
|
multiple?: boolean | undefined;
|
|
215
191
|
} | undefined;
|
|
192
|
+
meta?: {
|
|
193
|
+
schemaVersion: "1.0";
|
|
194
|
+
} | undefined;
|
|
216
195
|
}, {
|
|
217
|
-
type: "selectBox";
|
|
218
196
|
options: {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
label: string;
|
|
223
|
-
selected?: boolean | undefined;
|
|
224
|
-
};
|
|
197
|
+
value: string;
|
|
198
|
+
label: string;
|
|
199
|
+
selected?: boolean | undefined;
|
|
225
200
|
}[];
|
|
226
|
-
|
|
227
|
-
schemaVersion: "1.0";
|
|
228
|
-
labelTranslationKey?: string | undefined;
|
|
229
|
-
};
|
|
201
|
+
type: "selectBox";
|
|
230
202
|
attributes?: {
|
|
203
|
+
label?: string | undefined;
|
|
204
|
+
help?: string | undefined;
|
|
205
|
+
labelTranslationKey?: string | undefined;
|
|
231
206
|
multiple?: boolean | undefined;
|
|
232
207
|
} | undefined;
|
|
208
|
+
meta?: {
|
|
209
|
+
schemaVersion: "1.0";
|
|
210
|
+
} | undefined;
|
|
233
211
|
}>;
|
|
234
212
|
export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
|
|
235
213
|
export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
|
|
@@ -5,25 +5,16 @@ 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
|
-
}),
|
|
13
|
-
});
|
|
14
|
-
const BaseOptionAttributes = OptionSchema.shape.attributes;
|
|
15
|
-
const CheckedOptionSchema = zod_1.z.object({
|
|
16
|
-
type: zod_1.z.literal('option'),
|
|
17
|
-
attributes: BaseOptionAttributes.extend({
|
|
18
|
-
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
|
-
}),
|
|
8
|
+
label: zod_1.z.string(), // The label of the option
|
|
9
|
+
value: zod_1.z.string(), // The value of the option
|
|
26
10
|
});
|
|
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
|
+
}));
|
|
27
18
|
// Check boxes question and answer
|
|
28
19
|
exports.CheckboxesQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
29
20
|
type: zod_1.z.literal('checkBoxes'), // The type of question
|
|
@@ -38,7 +29,7 @@ exports.RadioButtonsQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.obj
|
|
|
38
29
|
exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
39
30
|
type: zod_1.z.literal('selectBox'), // The type of question
|
|
40
31
|
options: zod_1.z.array(SelectedOptionSchema),
|
|
41
|
-
attributes: zod_1.z.object({
|
|
32
|
+
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
42
33
|
multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is false)
|
|
43
|
-
}).optional()
|
|
34
|
+
})).optional()
|
|
44
35
|
}));
|
|
@@ -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
|
});
|