@dmptool/types 1.1.1 → 1.1.3
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 +11 -5
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +2 -2
- package/dist/answers/graphQLAnswers.js +2 -2
- package/dist/answers/index.d.ts +92 -55
- package/dist/answers/index.js +2 -2
- package/dist/answers/optionBasedAnswers.d.ts +27 -2
- package/dist/answers/optionBasedAnswers.js +5 -1
- package/dist/answers/tableAnswers.d.ts +268 -104
- package/dist/answers/tableAnswers.js +2 -1
- package/dist/questions/__tests__/graphQLQuestions.spec.js +13 -11
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +52 -13
- package/dist/questions/dateQuestions.d.ts +68 -47
- package/dist/questions/dateQuestions.js +15 -6
- package/dist/questions/graphQLQuestions.d.ts +121 -96
- package/dist/questions/graphQLQuestions.js +34 -3
- package/dist/questions/index.d.ts +1524 -1006
- package/dist/questions/index.js +4 -2
- package/dist/questions/numberQuestions.d.ts +107 -76
- package/dist/questions/numberQuestions.js +20 -7
- package/dist/questions/optionBasedQuestions.d.ts +202 -74
- package/dist/questions/optionBasedQuestions.js +41 -11
- package/dist/questions/question.d.ts +43 -4
- package/dist/questions/question.js +13 -2
- package/dist/questions/tableQuestions.d.ts +2056 -1428
- package/dist/questions/tableQuestions.js +9 -4
- package/dist/questions/textQuestions.d.ts +98 -58
- package/dist/questions/textQuestions.js +29 -15
- package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +146 -0
- package/dist/schemas/anyAnswer.schema.json +41 -23
- package/dist/schemas/anyQuestion.schema.json +525 -108
- package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
- package/dist/schemas/anyTableColumnQuestion.schema.json +396 -80
- package/dist/schemas/booleanQuestion.schema.json +11 -3
- package/dist/schemas/checkboxesQuestion.schema.json +14 -7
- package/dist/schemas/currencyQuestion.schema.json +14 -3
- package/dist/schemas/dateQuestion.schema.json +10 -1
- package/dist/schemas/dateRangeQuestion.schema.json +14 -1
- package/dist/schemas/emailQuestion.schema.json +12 -2
- package/dist/schemas/filteredSearchQuestion.schema.json +7 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +85 -0
- package/dist/schemas/numberQuestion.schema.json +12 -2
- package/dist/schemas/numberRangeQuestion.schema.json +16 -2
- package/dist/schemas/radioButtonsQuestion.schema.json +14 -7
- package/dist/schemas/selectBoxAnswer.schema.json +1 -4
- package/dist/schemas/selectBoxQuestion.schema.json +17 -8
- package/dist/schemas/tableAnswer.schema.json +35 -14
- package/dist/schemas/tableQuestion.schema.json +420 -84
- package/dist/schemas/textAreaQuestion.schema.json +16 -6
- package/dist/schemas/textQuestion.schema.json +10 -1
- package/dist/schemas/urlQuestion.schema.json +10 -1
- package/package.json +1 -1
package/dist/questions/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __exportStar(require("./optionBasedQuestions"), exports);
|
|
|
31
31
|
__exportStar(require("./tableQuestions"), exports);
|
|
32
32
|
__exportStar(require("./textQuestions"), exports);
|
|
33
33
|
exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
34
|
+
graphQLQuestions_1.AffiliationSearchQuestionSchema,
|
|
34
35
|
optionBasedQuestions_1.BooleanQuestionSchema,
|
|
35
36
|
optionBasedQuestions_1.CheckboxesQuestionSchema,
|
|
36
37
|
numberQuestions_1.CurrencyQuestionSchema,
|
|
@@ -38,6 +39,7 @@ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
38
39
|
dateQuestions_1.DateRangeQuestionSchema,
|
|
39
40
|
textQuestions_1.EmailQuestionSchema,
|
|
40
41
|
graphQLQuestions_1.FilteredSearchQuestionSchema,
|
|
42
|
+
optionBasedQuestions_1.MultiselectBoxQuestionSchema,
|
|
41
43
|
numberQuestions_1.NumberQuestionSchema,
|
|
42
44
|
numberQuestions_1.NumberRangeQuestionSchema,
|
|
43
45
|
optionBasedQuestions_1.RadioButtonsQuestionSchema,
|
|
@@ -45,11 +47,11 @@ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
45
47
|
tableQuestions_1.TableQuestionSchema,
|
|
46
48
|
textQuestions_1.TextAreaQuestionSchema,
|
|
47
49
|
textQuestions_1.TextQuestionSchema,
|
|
48
|
-
graphQLQuestions_1.TypeaheadSearchQuestionSchema,
|
|
49
50
|
textQuestions_1.URLQuestionSchema
|
|
50
51
|
]);
|
|
51
52
|
// Export a mapping between Zod Schemas and their corresponding question type label
|
|
52
53
|
exports.QuestionSchemaMap = {
|
|
54
|
+
affiliationSearch: graphQLQuestions_1.AffiliationSearchQuestionSchema,
|
|
53
55
|
boolean: optionBasedQuestions_1.BooleanQuestionSchema,
|
|
54
56
|
checkBoxes: optionBasedQuestions_1.CheckboxesQuestionSchema,
|
|
55
57
|
currency: numberQuestions_1.CurrencyQuestionSchema,
|
|
@@ -57,6 +59,7 @@ exports.QuestionSchemaMap = {
|
|
|
57
59
|
dateRange: dateQuestions_1.DateRangeQuestionSchema,
|
|
58
60
|
email: textQuestions_1.EmailQuestionSchema,
|
|
59
61
|
filteredSearch: graphQLQuestions_1.FilteredSearchQuestionSchema,
|
|
62
|
+
multiselectBox: optionBasedQuestions_1.MultiselectBoxQuestionSchema,
|
|
60
63
|
number: numberQuestions_1.NumberQuestionSchema,
|
|
61
64
|
numberRange: numberQuestions_1.NumberRangeQuestionSchema,
|
|
62
65
|
radioButtons: optionBasedQuestions_1.RadioButtonsQuestionSchema,
|
|
@@ -64,7 +67,6 @@ exports.QuestionSchemaMap = {
|
|
|
64
67
|
table: tableQuestions_1.TableQuestionSchema,
|
|
65
68
|
text: textQuestions_1.TextQuestionSchema,
|
|
66
69
|
textArea: textQuestions_1.TextAreaQuestionSchema,
|
|
67
|
-
typeaheadSearch: graphQLQuestions_1.TypeaheadSearchQuestionSchema,
|
|
68
70
|
url: textQuestions_1.URLQuestionSchema
|
|
69
71
|
};
|
|
70
72
|
;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const CurrencyQuestionSchema: z.ZodObject<{
|
|
3
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
4
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
schemaVersion: "1.0";
|
|
7
|
-
}, {
|
|
8
|
-
schemaVersion: "1.0";
|
|
9
|
-
}>>;
|
|
10
|
-
} & {
|
|
2
|
+
export declare const CurrencyQuestionSchema: z.ZodObject<{} & {
|
|
11
3
|
type: z.ZodLiteral<"currency">;
|
|
12
4
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
13
5
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -15,18 +7,18 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{
|
|
|
15
7
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
16
8
|
} & {
|
|
17
9
|
max: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
min: z.
|
|
19
|
-
step: z.
|
|
10
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
20
12
|
} & {
|
|
21
|
-
denomination: z.
|
|
13
|
+
denomination: z.ZodDefault<z.ZodString>;
|
|
22
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
min: number;
|
|
16
|
+
step: number;
|
|
17
|
+
denomination: string;
|
|
23
18
|
label?: string | undefined;
|
|
24
19
|
help?: string | undefined;
|
|
25
20
|
labelTranslationKey?: string | undefined;
|
|
26
21
|
max?: number | undefined;
|
|
27
|
-
min?: number | undefined;
|
|
28
|
-
step?: number | undefined;
|
|
29
|
-
denomination?: string | undefined;
|
|
30
22
|
}, {
|
|
31
23
|
label?: string | undefined;
|
|
32
24
|
help?: string | undefined;
|
|
@@ -36,19 +28,35 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{
|
|
|
36
28
|
step?: number | undefined;
|
|
37
29
|
denomination?: string | undefined;
|
|
38
30
|
}>>;
|
|
31
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
33
|
+
} & {
|
|
34
|
+
title: z.ZodOptional<z.ZodLiteral<"Currency Field">>;
|
|
35
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a monetary amount (e.g. Cost or Budget).">>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
schemaVersion: "1.0";
|
|
38
|
+
title?: "Currency Field" | undefined;
|
|
39
|
+
usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
schemaVersion: "1.0";
|
|
42
|
+
title?: "Currency Field" | undefined;
|
|
43
|
+
usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
|
|
44
|
+
}>>;
|
|
39
45
|
}, "strip", z.ZodTypeAny, {
|
|
40
46
|
type: "currency";
|
|
41
47
|
attributes?: {
|
|
48
|
+
min: number;
|
|
49
|
+
step: number;
|
|
50
|
+
denomination: string;
|
|
42
51
|
label?: string | undefined;
|
|
43
52
|
help?: string | undefined;
|
|
44
53
|
labelTranslationKey?: string | undefined;
|
|
45
54
|
max?: number | undefined;
|
|
46
|
-
min?: number | undefined;
|
|
47
|
-
step?: number | undefined;
|
|
48
|
-
denomination?: string | undefined;
|
|
49
55
|
} | undefined;
|
|
50
56
|
meta?: {
|
|
51
57
|
schemaVersion: "1.0";
|
|
58
|
+
title?: "Currency Field" | undefined;
|
|
59
|
+
usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
|
|
52
60
|
} | undefined;
|
|
53
61
|
}, {
|
|
54
62
|
type: "currency";
|
|
@@ -63,17 +71,11 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{
|
|
|
63
71
|
} | undefined;
|
|
64
72
|
meta?: {
|
|
65
73
|
schemaVersion: "1.0";
|
|
74
|
+
title?: "Currency Field" | undefined;
|
|
75
|
+
usageDescription?: "For questions that require a monetary amount (e.g. Cost or Budget)." | undefined;
|
|
66
76
|
} | undefined;
|
|
67
77
|
}>;
|
|
68
|
-
export declare const NumberQuestionSchema: z.ZodObject<{
|
|
69
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
70
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
71
|
-
}, "strip", z.ZodTypeAny, {
|
|
72
|
-
schemaVersion: "1.0";
|
|
73
|
-
}, {
|
|
74
|
-
schemaVersion: "1.0";
|
|
75
|
-
}>>;
|
|
76
|
-
} & {
|
|
78
|
+
export declare const NumberQuestionSchema: z.ZodObject<{} & {
|
|
77
79
|
type: z.ZodLiteral<"number">;
|
|
78
80
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
79
81
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -81,15 +83,15 @@ export declare const NumberQuestionSchema: z.ZodObject<{
|
|
|
81
83
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
82
84
|
} & {
|
|
83
85
|
max: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
min: z.
|
|
85
|
-
step: z.
|
|
86
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
87
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
86
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
min: number;
|
|
90
|
+
step: number;
|
|
87
91
|
label?: string | undefined;
|
|
88
92
|
help?: string | undefined;
|
|
89
93
|
labelTranslationKey?: string | undefined;
|
|
90
94
|
max?: number | undefined;
|
|
91
|
-
min?: number | undefined;
|
|
92
|
-
step?: number | undefined;
|
|
93
95
|
}, {
|
|
94
96
|
label?: string | undefined;
|
|
95
97
|
help?: string | undefined;
|
|
@@ -98,18 +100,34 @@ export declare const NumberQuestionSchema: z.ZodObject<{
|
|
|
98
100
|
min?: number | undefined;
|
|
99
101
|
step?: number | undefined;
|
|
100
102
|
}>>;
|
|
103
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
105
|
+
} & {
|
|
106
|
+
title: z.ZodOptional<z.ZodLiteral<"Number Field">>;
|
|
107
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a single numeric value.">>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
schemaVersion: "1.0";
|
|
110
|
+
title?: "Number Field" | undefined;
|
|
111
|
+
usageDescription?: "For questions that require a single numeric value." | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
schemaVersion: "1.0";
|
|
114
|
+
title?: "Number Field" | undefined;
|
|
115
|
+
usageDescription?: "For questions that require a single numeric value." | undefined;
|
|
116
|
+
}>>;
|
|
101
117
|
}, "strip", z.ZodTypeAny, {
|
|
102
118
|
type: "number";
|
|
103
119
|
attributes?: {
|
|
120
|
+
min: number;
|
|
121
|
+
step: number;
|
|
104
122
|
label?: string | undefined;
|
|
105
123
|
help?: string | undefined;
|
|
106
124
|
labelTranslationKey?: string | undefined;
|
|
107
125
|
max?: number | undefined;
|
|
108
|
-
min?: number | undefined;
|
|
109
|
-
step?: number | undefined;
|
|
110
126
|
} | undefined;
|
|
111
127
|
meta?: {
|
|
112
128
|
schemaVersion: "1.0";
|
|
129
|
+
title?: "Number Field" | undefined;
|
|
130
|
+
usageDescription?: "For questions that require a single numeric value." | undefined;
|
|
113
131
|
} | undefined;
|
|
114
132
|
}, {
|
|
115
133
|
type: "number";
|
|
@@ -123,6 +141,8 @@ export declare const NumberQuestionSchema: z.ZodObject<{
|
|
|
123
141
|
} | undefined;
|
|
124
142
|
meta?: {
|
|
125
143
|
schemaVersion: "1.0";
|
|
144
|
+
title?: "Number Field" | undefined;
|
|
145
|
+
usageDescription?: "For questions that require a single numeric value." | undefined;
|
|
126
146
|
} | undefined;
|
|
127
147
|
}>;
|
|
128
148
|
export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
@@ -139,31 +159,24 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
|
139
159
|
help?: string | undefined;
|
|
140
160
|
labelTranslationKey?: string | undefined;
|
|
141
161
|
}>>;
|
|
142
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
143
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
144
|
-
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
schemaVersion: "1.0";
|
|
146
|
-
}, {
|
|
147
|
-
schemaVersion: "1.0";
|
|
148
|
-
}>>;
|
|
149
162
|
} & {
|
|
150
163
|
type: z.ZodLiteral<"numberRange">;
|
|
151
164
|
columns: z.ZodObject<{
|
|
152
|
-
start: z.
|
|
165
|
+
start: z.ZodObject<{
|
|
153
166
|
label: z.ZodOptional<z.ZodString>;
|
|
154
167
|
help: z.ZodOptional<z.ZodString>;
|
|
155
168
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
156
169
|
} & {
|
|
157
170
|
max: z.ZodOptional<z.ZodNumber>;
|
|
158
|
-
min: z.
|
|
159
|
-
step: z.
|
|
171
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
172
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
160
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
min: number;
|
|
175
|
+
step: number;
|
|
161
176
|
label?: string | undefined;
|
|
162
177
|
help?: string | undefined;
|
|
163
178
|
labelTranslationKey?: string | undefined;
|
|
164
179
|
max?: number | undefined;
|
|
165
|
-
min?: number | undefined;
|
|
166
|
-
step?: number | undefined;
|
|
167
180
|
}, {
|
|
168
181
|
label?: string | undefined;
|
|
169
182
|
help?: string | undefined;
|
|
@@ -171,22 +184,22 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
|
171
184
|
max?: number | undefined;
|
|
172
185
|
min?: number | undefined;
|
|
173
186
|
step?: number | undefined;
|
|
174
|
-
}
|
|
175
|
-
end: z.
|
|
187
|
+
}>;
|
|
188
|
+
end: z.ZodObject<{
|
|
176
189
|
label: z.ZodOptional<z.ZodString>;
|
|
177
190
|
help: z.ZodOptional<z.ZodString>;
|
|
178
191
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
179
192
|
} & {
|
|
180
193
|
max: z.ZodOptional<z.ZodNumber>;
|
|
181
|
-
min: z.
|
|
182
|
-
step: z.
|
|
194
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
195
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
183
196
|
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
min: number;
|
|
198
|
+
step: number;
|
|
184
199
|
label?: string | undefined;
|
|
185
200
|
help?: string | undefined;
|
|
186
201
|
labelTranslationKey?: string | undefined;
|
|
187
202
|
max?: number | undefined;
|
|
188
|
-
min?: number | undefined;
|
|
189
|
-
step?: number | undefined;
|
|
190
203
|
}, {
|
|
191
204
|
label?: string | undefined;
|
|
192
205
|
help?: string | undefined;
|
|
@@ -194,61 +207,75 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
|
194
207
|
max?: number | undefined;
|
|
195
208
|
min?: number | undefined;
|
|
196
209
|
step?: number | undefined;
|
|
197
|
-
}
|
|
210
|
+
}>;
|
|
198
211
|
}, "strip", z.ZodTypeAny, {
|
|
199
|
-
start
|
|
212
|
+
start: {
|
|
213
|
+
min: number;
|
|
214
|
+
step: number;
|
|
200
215
|
label?: string | undefined;
|
|
201
216
|
help?: string | undefined;
|
|
202
217
|
labelTranslationKey?: string | undefined;
|
|
203
218
|
max?: number | undefined;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
};
|
|
220
|
+
end: {
|
|
221
|
+
min: number;
|
|
222
|
+
step: number;
|
|
208
223
|
label?: string | undefined;
|
|
209
224
|
help?: string | undefined;
|
|
210
225
|
labelTranslationKey?: string | undefined;
|
|
211
226
|
max?: number | undefined;
|
|
212
|
-
|
|
213
|
-
step?: number | undefined;
|
|
214
|
-
} | undefined;
|
|
227
|
+
};
|
|
215
228
|
}, {
|
|
216
|
-
start
|
|
229
|
+
start: {
|
|
217
230
|
label?: string | undefined;
|
|
218
231
|
help?: string | undefined;
|
|
219
232
|
labelTranslationKey?: string | undefined;
|
|
220
233
|
max?: number | undefined;
|
|
221
234
|
min?: number | undefined;
|
|
222
235
|
step?: number | undefined;
|
|
223
|
-
}
|
|
224
|
-
end
|
|
236
|
+
};
|
|
237
|
+
end: {
|
|
225
238
|
label?: string | undefined;
|
|
226
239
|
help?: string | undefined;
|
|
227
240
|
labelTranslationKey?: string | undefined;
|
|
228
241
|
max?: number | undefined;
|
|
229
242
|
min?: number | undefined;
|
|
230
243
|
step?: number | undefined;
|
|
231
|
-
}
|
|
244
|
+
};
|
|
232
245
|
}>;
|
|
246
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
247
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
248
|
+
} & {
|
|
249
|
+
title: z.ZodOptional<z.ZodLiteral<"Number Range">>;
|
|
250
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a numerical range (e.g. From/To, Min/Max).">>;
|
|
251
|
+
}, "strip", z.ZodTypeAny, {
|
|
252
|
+
schemaVersion: "1.0";
|
|
253
|
+
title?: "Number Range" | undefined;
|
|
254
|
+
usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
|
|
255
|
+
}, {
|
|
256
|
+
schemaVersion: "1.0";
|
|
257
|
+
title?: "Number Range" | undefined;
|
|
258
|
+
usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
|
|
259
|
+
}>>;
|
|
233
260
|
}, "strip", z.ZodTypeAny, {
|
|
234
261
|
type: "numberRange";
|
|
235
262
|
columns: {
|
|
236
|
-
start
|
|
263
|
+
start: {
|
|
264
|
+
min: number;
|
|
265
|
+
step: number;
|
|
237
266
|
label?: string | undefined;
|
|
238
267
|
help?: string | undefined;
|
|
239
268
|
labelTranslationKey?: string | undefined;
|
|
240
269
|
max?: number | undefined;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
270
|
+
};
|
|
271
|
+
end: {
|
|
272
|
+
min: number;
|
|
273
|
+
step: number;
|
|
245
274
|
label?: string | undefined;
|
|
246
275
|
help?: string | undefined;
|
|
247
276
|
labelTranslationKey?: string | undefined;
|
|
248
277
|
max?: number | undefined;
|
|
249
|
-
|
|
250
|
-
step?: number | undefined;
|
|
251
|
-
} | undefined;
|
|
278
|
+
};
|
|
252
279
|
};
|
|
253
280
|
attributes?: {
|
|
254
281
|
label?: string | undefined;
|
|
@@ -257,26 +284,28 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
|
257
284
|
} | undefined;
|
|
258
285
|
meta?: {
|
|
259
286
|
schemaVersion: "1.0";
|
|
287
|
+
title?: "Number Range" | undefined;
|
|
288
|
+
usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
|
|
260
289
|
} | undefined;
|
|
261
290
|
}, {
|
|
262
291
|
type: "numberRange";
|
|
263
292
|
columns: {
|
|
264
|
-
start
|
|
293
|
+
start: {
|
|
265
294
|
label?: string | undefined;
|
|
266
295
|
help?: string | undefined;
|
|
267
296
|
labelTranslationKey?: string | undefined;
|
|
268
297
|
max?: number | undefined;
|
|
269
298
|
min?: number | undefined;
|
|
270
299
|
step?: number | undefined;
|
|
271
|
-
}
|
|
272
|
-
end
|
|
300
|
+
};
|
|
301
|
+
end: {
|
|
273
302
|
label?: string | undefined;
|
|
274
303
|
help?: string | undefined;
|
|
275
304
|
labelTranslationKey?: string | undefined;
|
|
276
305
|
max?: number | undefined;
|
|
277
306
|
min?: number | undefined;
|
|
278
307
|
step?: number | undefined;
|
|
279
|
-
}
|
|
308
|
+
};
|
|
280
309
|
};
|
|
281
310
|
attributes?: {
|
|
282
311
|
label?: string | undefined;
|
|
@@ -285,6 +314,8 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
|
|
|
285
314
|
} | undefined;
|
|
286
315
|
meta?: {
|
|
287
316
|
schemaVersion: "1.0";
|
|
317
|
+
title?: "Number Range" | undefined;
|
|
318
|
+
usageDescription?: "For questions that require a numerical range (e.g. From/To, Min/Max)." | undefined;
|
|
288
319
|
} | undefined;
|
|
289
320
|
}>;
|
|
290
321
|
export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
|
|
@@ -4,25 +4,38 @@ exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.Curre
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
7
|
+
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
7
8
|
const NumberAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
8
|
-
max: zod_1.z.number().optional(),
|
|
9
|
-
min: zod_1.z.number().
|
|
10
|
-
step: zod_1.z.number().
|
|
9
|
+
max: zod_1.z.number().optional(),
|
|
10
|
+
min: zod_1.z.number().default(0),
|
|
11
|
+
step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
|
|
11
12
|
}));
|
|
12
13
|
exports.CurrencyQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
13
14
|
type: zod_1.z.literal('currency'),
|
|
14
15
|
attributes: NumberAttributesSchema.merge(zod_1.z.object({
|
|
15
|
-
denomination: zod_1.z.string().
|
|
16
|
+
denomination: zod_1.z.string().default('USD')
|
|
16
17
|
})).optional(),
|
|
18
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
19
|
+
title: zod_1.z.literal('Currency Field').optional(),
|
|
20
|
+
usageDescription: zod_1.z.literal('For questions that require a monetary amount (e.g. Cost or Budget).').optional(),
|
|
21
|
+
})).optional()
|
|
17
22
|
}));
|
|
18
23
|
exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
19
24
|
type: zod_1.z.literal('number'),
|
|
20
25
|
attributes: NumberAttributesSchema.optional(),
|
|
26
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
27
|
+
title: zod_1.z.literal('Number Field').optional(),
|
|
28
|
+
usageDescription: zod_1.z.literal('For questions that require a single numeric value.').optional(),
|
|
29
|
+
})).optional()
|
|
21
30
|
}));
|
|
22
31
|
exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
23
32
|
type: zod_1.z.literal('numberRange'),
|
|
24
33
|
columns: zod_1.z.object({
|
|
25
|
-
start: NumberAttributesSchema
|
|
26
|
-
end: NumberAttributesSchema
|
|
27
|
-
})
|
|
34
|
+
start: NumberAttributesSchema,
|
|
35
|
+
end: NumberAttributesSchema
|
|
36
|
+
}),
|
|
37
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
38
|
+
title: zod_1.z.literal('Number Range').optional(),
|
|
39
|
+
usageDescription: zod_1.z.literal('For questions that require a numerical range (e.g. From/To, Min/Max).').optional(),
|
|
40
|
+
})).optional()
|
|
28
41
|
}));
|