@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
|
@@ -3,18 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const globals_1 = require("@jest/globals");
|
|
4
4
|
const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
5
5
|
(0, globals_1.describe)("BooleanQuestion", () => {
|
|
6
|
-
(0, globals_1.it)('optional fields should not throw an error if the value is undefined', () => {
|
|
7
|
-
const validBooleanQuestion = {
|
|
8
|
-
type: "boolean",
|
|
9
|
-
meta: {
|
|
10
|
-
schemaVersion: "1.0",
|
|
11
|
-
},
|
|
12
|
-
attributes: {
|
|
13
|
-
checked: undefined, // Valid value
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
(0, globals_1.expect)(() => optionBasedQuestions_1.BooleanQuestionSchema.parse(validBooleanQuestion)).not.toThrow();
|
|
17
|
-
});
|
|
18
6
|
(0, globals_1.it)('optional fields should throw an error if the value is null', () => {
|
|
19
7
|
const invalidBooleanQuestion = {
|
|
20
8
|
type: "boolean",
|
|
@@ -69,6 +57,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
69
57
|
{
|
|
70
58
|
label: "Banana",
|
|
71
59
|
value: "banana",
|
|
60
|
+
checked: false,
|
|
72
61
|
},
|
|
73
62
|
],
|
|
74
63
|
meta: {
|
|
@@ -115,6 +104,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
115
104
|
{
|
|
116
105
|
label: "Female",
|
|
117
106
|
value: "female",
|
|
107
|
+
selected: true,
|
|
118
108
|
},
|
|
119
109
|
],
|
|
120
110
|
meta: {
|
|
@@ -147,7 +137,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
147
137
|
attributes: {
|
|
148
138
|
label: "Fruits",
|
|
149
139
|
help: "Select all fruits you like",
|
|
150
|
-
multiple:
|
|
140
|
+
multiple: false,
|
|
151
141
|
},
|
|
152
142
|
options: [
|
|
153
143
|
{
|
|
@@ -158,6 +148,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
158
148
|
{
|
|
159
149
|
label: "Canada",
|
|
160
150
|
value: "ca",
|
|
151
|
+
selected: false,
|
|
161
152
|
},
|
|
162
153
|
],
|
|
163
154
|
meta: {
|
|
@@ -187,3 +178,51 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
187
178
|
(0, globals_1.expect)(() => optionBasedQuestions_1.SelectBoxQuestionSchema.parse(invalidSelectBoxQuestion)).toThrow();
|
|
188
179
|
});
|
|
189
180
|
});
|
|
181
|
+
(0, globals_1.describe)("MultiselectBoxQuestion", () => {
|
|
182
|
+
(0, globals_1.it)("should validate a valid MultiselectBoxQuestion object", () => {
|
|
183
|
+
const validSelectBoxQuestion = {
|
|
184
|
+
type: "multiselectBox",
|
|
185
|
+
attributes: {
|
|
186
|
+
label: "Fruits",
|
|
187
|
+
help: "Select all fruits you like",
|
|
188
|
+
multiple: true,
|
|
189
|
+
},
|
|
190
|
+
options: [
|
|
191
|
+
{
|
|
192
|
+
label: "USA",
|
|
193
|
+
value: "us",
|
|
194
|
+
selected: true,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: "Canada",
|
|
198
|
+
value: "ca",
|
|
199
|
+
selected: false,
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
meta: {
|
|
203
|
+
schemaVersion: "1.0"
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
(0, globals_1.expect)(() => optionBasedQuestions_1.MultiselectBoxQuestionSchema.parse(validSelectBoxQuestion)).not.toThrow();
|
|
207
|
+
});
|
|
208
|
+
(0, globals_1.it)("should throw an error for an invalid MultiselectBoxQuestion object", () => {
|
|
209
|
+
const invalidSelectBoxQuestion = {
|
|
210
|
+
type: "multiselectBox",
|
|
211
|
+
questionText: "Select your country",
|
|
212
|
+
options: [
|
|
213
|
+
{
|
|
214
|
+
label: "USA",
|
|
215
|
+
value: "us",
|
|
216
|
+
selected: "true", // Invalid type for selected
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
attributes: {
|
|
220
|
+
multiple: "true", // Invalid type for multiple
|
|
221
|
+
},
|
|
222
|
+
meta: {
|
|
223
|
+
schemaVersion: "1.0"
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
(0, globals_1.expect)(() => optionBasedQuestions_1.MultiselectBoxQuestionSchema.parse(invalidSelectBoxQuestion)).toThrow();
|
|
227
|
+
});
|
|
228
|
+
});
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const DateQuestionSchema: 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 DateQuestionSchema: z.ZodObject<{} & {
|
|
11
3
|
type: z.ZodLiteral<"date">;
|
|
12
4
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
13
5
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -16,14 +8,14 @@ export declare const DateQuestionSchema: z.ZodObject<{
|
|
|
16
8
|
} & {
|
|
17
9
|
max: z.ZodOptional<z.ZodString>;
|
|
18
10
|
min: z.ZodOptional<z.ZodString>;
|
|
19
|
-
step: z.
|
|
11
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
20
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
step: number;
|
|
21
14
|
label?: string | undefined;
|
|
22
15
|
help?: string | undefined;
|
|
23
16
|
labelTranslationKey?: string | undefined;
|
|
24
17
|
max?: string | undefined;
|
|
25
18
|
min?: string | undefined;
|
|
26
|
-
step?: number | undefined;
|
|
27
19
|
}, {
|
|
28
20
|
label?: string | undefined;
|
|
29
21
|
help?: string | undefined;
|
|
@@ -32,18 +24,34 @@ export declare const DateQuestionSchema: z.ZodObject<{
|
|
|
32
24
|
min?: string | undefined;
|
|
33
25
|
step?: number | undefined;
|
|
34
26
|
}>>;
|
|
27
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
29
|
+
} & {
|
|
30
|
+
title: z.ZodOptional<z.ZodLiteral<"Date Field">>;
|
|
31
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a date.">>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
schemaVersion: "1.0";
|
|
34
|
+
title?: "Date Field" | undefined;
|
|
35
|
+
usageDescription?: "For questions that require a date." | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
schemaVersion: "1.0";
|
|
38
|
+
title?: "Date Field" | undefined;
|
|
39
|
+
usageDescription?: "For questions that require a date." | undefined;
|
|
40
|
+
}>>;
|
|
35
41
|
}, "strip", z.ZodTypeAny, {
|
|
36
42
|
type: "date";
|
|
37
43
|
attributes?: {
|
|
44
|
+
step: number;
|
|
38
45
|
label?: string | undefined;
|
|
39
46
|
help?: string | undefined;
|
|
40
47
|
labelTranslationKey?: string | undefined;
|
|
41
48
|
max?: string | undefined;
|
|
42
49
|
min?: string | undefined;
|
|
43
|
-
step?: number | undefined;
|
|
44
50
|
} | undefined;
|
|
45
51
|
meta?: {
|
|
46
52
|
schemaVersion: "1.0";
|
|
53
|
+
title?: "Date Field" | undefined;
|
|
54
|
+
usageDescription?: "For questions that require a date." | undefined;
|
|
47
55
|
} | undefined;
|
|
48
56
|
}, {
|
|
49
57
|
type: "date";
|
|
@@ -57,6 +65,8 @@ export declare const DateQuestionSchema: z.ZodObject<{
|
|
|
57
65
|
} | undefined;
|
|
58
66
|
meta?: {
|
|
59
67
|
schemaVersion: "1.0";
|
|
68
|
+
title?: "Date Field" | undefined;
|
|
69
|
+
usageDescription?: "For questions that require a date." | undefined;
|
|
60
70
|
} | undefined;
|
|
61
71
|
}>;
|
|
62
72
|
export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
@@ -73,31 +83,24 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
73
83
|
help?: string | undefined;
|
|
74
84
|
labelTranslationKey?: string | undefined;
|
|
75
85
|
}>>;
|
|
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
|
-
}>>;
|
|
83
86
|
} & {
|
|
84
87
|
type: z.ZodLiteral<"dateRange">;
|
|
85
88
|
columns: z.ZodObject<{
|
|
86
|
-
start: z.
|
|
89
|
+
start: z.ZodObject<{
|
|
87
90
|
label: z.ZodOptional<z.ZodString>;
|
|
88
91
|
help: z.ZodOptional<z.ZodString>;
|
|
89
92
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
90
93
|
} & {
|
|
91
94
|
max: z.ZodOptional<z.ZodString>;
|
|
92
95
|
min: z.ZodOptional<z.ZodString>;
|
|
93
|
-
step: z.
|
|
96
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
94
97
|
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
step: number;
|
|
95
99
|
label?: string | undefined;
|
|
96
100
|
help?: string | undefined;
|
|
97
101
|
labelTranslationKey?: string | undefined;
|
|
98
102
|
max?: string | undefined;
|
|
99
103
|
min?: string | undefined;
|
|
100
|
-
step?: number | undefined;
|
|
101
104
|
}, {
|
|
102
105
|
label?: string | undefined;
|
|
103
106
|
help?: string | undefined;
|
|
@@ -105,22 +108,22 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
105
108
|
max?: string | undefined;
|
|
106
109
|
min?: string | undefined;
|
|
107
110
|
step?: number | undefined;
|
|
108
|
-
}
|
|
109
|
-
end: z.
|
|
111
|
+
}>;
|
|
112
|
+
end: z.ZodObject<{
|
|
110
113
|
label: z.ZodOptional<z.ZodString>;
|
|
111
114
|
help: z.ZodOptional<z.ZodString>;
|
|
112
115
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
113
116
|
} & {
|
|
114
117
|
max: z.ZodOptional<z.ZodString>;
|
|
115
118
|
min: z.ZodOptional<z.ZodString>;
|
|
116
|
-
step: z.
|
|
119
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
117
120
|
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
step: number;
|
|
118
122
|
label?: string | undefined;
|
|
119
123
|
help?: string | undefined;
|
|
120
124
|
labelTranslationKey?: string | undefined;
|
|
121
125
|
max?: string | undefined;
|
|
122
126
|
min?: string | undefined;
|
|
123
|
-
step?: number | undefined;
|
|
124
127
|
}, {
|
|
125
128
|
label?: string | undefined;
|
|
126
129
|
help?: string | undefined;
|
|
@@ -128,61 +131,75 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
128
131
|
max?: string | undefined;
|
|
129
132
|
min?: string | undefined;
|
|
130
133
|
step?: number | undefined;
|
|
131
|
-
}
|
|
134
|
+
}>;
|
|
132
135
|
}, "strip", z.ZodTypeAny, {
|
|
133
|
-
start
|
|
136
|
+
start: {
|
|
137
|
+
step: number;
|
|
134
138
|
label?: string | undefined;
|
|
135
139
|
help?: string | undefined;
|
|
136
140
|
labelTranslationKey?: string | undefined;
|
|
137
141
|
max?: string | undefined;
|
|
138
142
|
min?: string | undefined;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
};
|
|
144
|
+
end: {
|
|
145
|
+
step: number;
|
|
142
146
|
label?: string | undefined;
|
|
143
147
|
help?: string | undefined;
|
|
144
148
|
labelTranslationKey?: string | undefined;
|
|
145
149
|
max?: string | undefined;
|
|
146
150
|
min?: string | undefined;
|
|
147
|
-
|
|
148
|
-
} | undefined;
|
|
151
|
+
};
|
|
149
152
|
}, {
|
|
150
|
-
start
|
|
153
|
+
start: {
|
|
151
154
|
label?: string | undefined;
|
|
152
155
|
help?: string | undefined;
|
|
153
156
|
labelTranslationKey?: string | undefined;
|
|
154
157
|
max?: string | undefined;
|
|
155
158
|
min?: string | undefined;
|
|
156
159
|
step?: number | undefined;
|
|
157
|
-
}
|
|
158
|
-
end
|
|
160
|
+
};
|
|
161
|
+
end: {
|
|
159
162
|
label?: string | undefined;
|
|
160
163
|
help?: string | undefined;
|
|
161
164
|
labelTranslationKey?: string | undefined;
|
|
162
165
|
max?: string | undefined;
|
|
163
166
|
min?: string | undefined;
|
|
164
167
|
step?: number | undefined;
|
|
165
|
-
}
|
|
168
|
+
};
|
|
166
169
|
}>;
|
|
170
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
172
|
+
} & {
|
|
173
|
+
title: z.ZodOptional<z.ZodLiteral<"Date Range">>;
|
|
174
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a date range (e.g. From/To, Start/End)">>;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
schemaVersion: "1.0";
|
|
177
|
+
title?: "Date Range" | undefined;
|
|
178
|
+
usageDescription?: "For questions that require a date range (e.g. From/To, Start/End)" | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
schemaVersion: "1.0";
|
|
181
|
+
title?: "Date Range" | undefined;
|
|
182
|
+
usageDescription?: "For questions that require a date range (e.g. From/To, Start/End)" | undefined;
|
|
183
|
+
}>>;
|
|
167
184
|
}, "strip", z.ZodTypeAny, {
|
|
168
185
|
type: "dateRange";
|
|
169
186
|
columns: {
|
|
170
|
-
start
|
|
187
|
+
start: {
|
|
188
|
+
step: number;
|
|
171
189
|
label?: string | undefined;
|
|
172
190
|
help?: string | undefined;
|
|
173
191
|
labelTranslationKey?: string | undefined;
|
|
174
192
|
max?: string | undefined;
|
|
175
193
|
min?: string | undefined;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
};
|
|
195
|
+
end: {
|
|
196
|
+
step: number;
|
|
179
197
|
label?: string | undefined;
|
|
180
198
|
help?: string | undefined;
|
|
181
199
|
labelTranslationKey?: string | undefined;
|
|
182
200
|
max?: string | undefined;
|
|
183
201
|
min?: string | undefined;
|
|
184
|
-
|
|
185
|
-
} | undefined;
|
|
202
|
+
};
|
|
186
203
|
};
|
|
187
204
|
attributes?: {
|
|
188
205
|
label?: string | undefined;
|
|
@@ -191,26 +208,28 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
191
208
|
} | undefined;
|
|
192
209
|
meta?: {
|
|
193
210
|
schemaVersion: "1.0";
|
|
211
|
+
title?: "Date Range" | undefined;
|
|
212
|
+
usageDescription?: "For questions that require a date range (e.g. From/To, Start/End)" | undefined;
|
|
194
213
|
} | undefined;
|
|
195
214
|
}, {
|
|
196
215
|
type: "dateRange";
|
|
197
216
|
columns: {
|
|
198
|
-
start
|
|
217
|
+
start: {
|
|
199
218
|
label?: string | undefined;
|
|
200
219
|
help?: string | undefined;
|
|
201
220
|
labelTranslationKey?: string | undefined;
|
|
202
221
|
max?: string | undefined;
|
|
203
222
|
min?: string | undefined;
|
|
204
223
|
step?: number | undefined;
|
|
205
|
-
}
|
|
206
|
-
end
|
|
224
|
+
};
|
|
225
|
+
end: {
|
|
207
226
|
label?: string | undefined;
|
|
208
227
|
help?: string | undefined;
|
|
209
228
|
labelTranslationKey?: string | undefined;
|
|
210
229
|
max?: string | undefined;
|
|
211
230
|
min?: string | undefined;
|
|
212
231
|
step?: number | undefined;
|
|
213
|
-
}
|
|
232
|
+
};
|
|
214
233
|
};
|
|
215
234
|
attributes?: {
|
|
216
235
|
label?: string | undefined;
|
|
@@ -219,6 +238,8 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
219
238
|
} | undefined;
|
|
220
239
|
meta?: {
|
|
221
240
|
schemaVersion: "1.0";
|
|
241
|
+
title?: "Date Range" | undefined;
|
|
242
|
+
usageDescription?: "For questions that require a date range (e.g. From/To, Start/End)" | undefined;
|
|
222
243
|
} | undefined;
|
|
223
244
|
}>;
|
|
224
245
|
export type DateQuestionType = z.infer<typeof DateQuestionSchema>;
|
|
@@ -4,21 +4,30 @@ exports.DateRangeQuestionSchema = exports.DateQuestionSchema = void 0;
|
|
|
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 DateAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
8
|
-
max: zod_1.z.string().optional(),
|
|
9
|
-
min: zod_1.z.string().optional(),
|
|
10
|
-
step: zod_1.z.number().
|
|
9
|
+
max: zod_1.z.string().optional(),
|
|
10
|
+
min: zod_1.z.string().optional(),
|
|
11
|
+
step: zod_1.z.number().default(1),
|
|
11
12
|
}));
|
|
12
13
|
// Date question and answer
|
|
13
14
|
exports.DateQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
14
15
|
type: zod_1.z.literal('date'), // The type of question
|
|
15
16
|
attributes: DateAttributesSchema.optional(),
|
|
17
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
18
|
+
title: zod_1.z.literal('Date Field').optional(),
|
|
19
|
+
usageDescription: zod_1.z.literal('For questions that require a date.').optional(),
|
|
20
|
+
})).optional(),
|
|
16
21
|
}));
|
|
17
22
|
// Date range question and answer
|
|
18
23
|
exports.DateRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
19
24
|
type: zod_1.z.literal('dateRange'), // The type of question
|
|
20
25
|
columns: zod_1.z.object({
|
|
21
|
-
start: DateAttributesSchema
|
|
22
|
-
end: DateAttributesSchema
|
|
23
|
-
})
|
|
26
|
+
start: DateAttributesSchema,
|
|
27
|
+
end: DateAttributesSchema
|
|
28
|
+
}),
|
|
29
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
30
|
+
title: zod_1.z.literal('Date Range').optional(),
|
|
31
|
+
usageDescription: zod_1.z.literal('For questions that require a date range (e.g. From/To, Start/End)').optional(),
|
|
32
|
+
})).optional(),
|
|
24
33
|
}));
|