@dmptool/types 1.0.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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/answers.d.ts +558 -0
- package/dist/answers.js +87 -0
- package/dist/dateQuestions.d.ts +244 -0
- package/dist/dateQuestions.js +30 -0
- package/dist/graphQLQuestions.d.ts +288 -0
- package/dist/graphQLQuestions.js +41 -0
- package/dist/optionBasedQuestions.d.ts +236 -0
- package/dist/optionBasedQuestions.js +44 -0
- package/dist/primitiveQuestions.d.ts +367 -0
- package/dist/primitiveQuestions.js +96 -0
- package/dist/schemas/anyAnswer.schema.json +267 -0
- package/dist/schemas/anyQuestion.schema.json +726 -0
- package/dist/schemas/booleanAnswer.schema.json +23 -0
- package/dist/schemas/booleanQuestion.schema.json +46 -0
- package/dist/schemas/checkboxesAnswer.schema.json +26 -0
- package/dist/schemas/checkboxesQuestion.schema.json +73 -0
- package/dist/schemas/currencyAnswer.schema.json +23 -0
- package/dist/schemas/currencyQuestion.schema.json +45 -0
- package/dist/schemas/datePickerAnswer.schema.json +23 -0
- package/dist/schemas/datePickerQuestion.schema.json +52 -0
- package/dist/schemas/dateRangeAnswer.schema.json +36 -0
- package/dist/schemas/dateRangeQuestion.schema.json +106 -0
- package/dist/schemas/emailAnswer.schema.json +23 -0
- package/dist/schemas/emailQuestion.schema.json +55 -0
- package/dist/schemas/filteredSearchAnswer.schema.json +26 -0
- package/dist/schemas/filteredSearchQuestion.schema.json +120 -0
- package/dist/schemas/numberAnswer.schema.json +23 -0
- package/dist/schemas/numberQuestion.schema.json +52 -0
- package/dist/schemas/radioButtonsAnswer.schema.json +23 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +73 -0
- package/dist/schemas/selectBoxAnswer.schema.json +23 -0
- package/dist/schemas/selectBoxQuestion.schema.json +83 -0
- package/dist/schemas/tableAnswer.schema.json +284 -0
- package/dist/schemas/tableQuestion.schema.json +680 -0
- package/dist/schemas/textAnswer.schema.json +23 -0
- package/dist/schemas/textAreaAnswer.schema.json +23 -0
- package/dist/schemas/textAreaQuestion.schema.json +48 -0
- package/dist/schemas/textQuestion.schema.json +52 -0
- package/dist/schemas/typeaheadSearchAnswer.schema.json +23 -0
- package/dist/schemas/typeaheadSearchQuestion.schema.json +110 -0
- package/dist/schemas/urlAnswer.schema.json +23 -0
- package/dist/schemas/urlQuestion.schema.json +52 -0
- package/dist/tableQuestions.d.ts +4195 -0
- package/dist/tableQuestions.js +55 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 UC Curation Center (California Digital Library)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# dmptool-types
|
|
2
|
+
|
|
3
|
+
This package provides Types, Zod schemas and JSON schemas to aide in integrations with the DMP Tool.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To run tests: `npm run test`
|
|
8
|
+
|
|
9
|
+
To run linter checks: `npm run lint`
|
|
10
|
+
|
|
11
|
+
To generate JSON schemas from the Zod schemas: `npm run generate`
|
|
12
|
+
|
|
13
|
+
To build the Types, Zod schemas and JSON schemas: `npm run build`
|
|
14
|
+
|
|
15
|
+
## Types/Schemas
|
|
16
|
+
|
|
17
|
+
If you want to work with DMP Templates or Answers to template questions, the following :
|
|
18
|
+
- CURRENT_SCHEMA_VERSION (the current version of the schemas)
|
|
19
|
+
- QuestionTypesEnum (Contains the `type` for each Question/Answer below)
|
|
20
|
+
- AnyQuestion & AnyAnswer (Union of all types below)
|
|
21
|
+
- BooleanQuestion & Boolean Answer
|
|
22
|
+
- CheckboxesQuestion & Checkboxes Answer
|
|
23
|
+
- CurrencyQuestion & CurrencyAnswer
|
|
24
|
+
- DatePickerQuestion & DatePickerAnswer
|
|
25
|
+
- DateRangeQuestion & DateRangeAnswer
|
|
26
|
+
- EmailQuestion & EmailAnswer
|
|
27
|
+
- FilteredSearchQuestion & FilteredSearchAnswer
|
|
28
|
+
- NumberQuestion & NumberAnswer
|
|
29
|
+
- RadioButtonsQuestion & RadioButtonsAnswer
|
|
30
|
+
- SelectBoxQuestion & SelectBoxAnswer
|
|
31
|
+
- TableQuestion & TableAnswer
|
|
32
|
+
- TextAreaQuestion & TextAreaAnswer
|
|
33
|
+
- TextQuestion & TextAnswer
|
|
34
|
+
- TypeaheadSearchQuestion & TypeaheadSearchAnswer
|
|
35
|
+
- URLQuestion & URLAnswer
|
|
36
|
+
|
|
37
|
+
### Coming soon
|
|
38
|
+
|
|
39
|
+
RDA Common Standard for DMPs
|
|
40
|
+
|
|
41
|
+
DMP Tool specific extensions to the RDA Common Standard for DMPs
|
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BooleanAnswer: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"boolean">;
|
|
4
|
+
answer: z.ZodBoolean;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
type: "boolean";
|
|
7
|
+
answer: boolean;
|
|
8
|
+
}, {
|
|
9
|
+
type: "boolean";
|
|
10
|
+
answer: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const CheckboxesAnswer: z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
14
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
type: "checkBoxes";
|
|
17
|
+
answer: string[];
|
|
18
|
+
}, {
|
|
19
|
+
type: "checkBoxes";
|
|
20
|
+
answer: string[];
|
|
21
|
+
}>;
|
|
22
|
+
export declare const CurrencyAnswer: z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"currency">;
|
|
24
|
+
answer: z.ZodNumber;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type: "currency";
|
|
27
|
+
answer: number;
|
|
28
|
+
}, {
|
|
29
|
+
type: "currency";
|
|
30
|
+
answer: number;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const DatePickerAnswer: z.ZodObject<{
|
|
33
|
+
answer: z.ZodString;
|
|
34
|
+
} & {
|
|
35
|
+
type: z.ZodLiteral<"datePicker">;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
type: "datePicker";
|
|
38
|
+
answer: string;
|
|
39
|
+
}, {
|
|
40
|
+
type: "datePicker";
|
|
41
|
+
answer: string;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const DateRangeAnswer: z.ZodObject<{} & {
|
|
44
|
+
type: z.ZodLiteral<"dateRange">;
|
|
45
|
+
answer: z.ZodObject<{
|
|
46
|
+
start: z.ZodString;
|
|
47
|
+
end: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
start: string;
|
|
50
|
+
end: string;
|
|
51
|
+
}, {
|
|
52
|
+
start: string;
|
|
53
|
+
end: string;
|
|
54
|
+
}>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
type: "dateRange";
|
|
57
|
+
answer: {
|
|
58
|
+
start: string;
|
|
59
|
+
end: string;
|
|
60
|
+
};
|
|
61
|
+
}, {
|
|
62
|
+
type: "dateRange";
|
|
63
|
+
answer: {
|
|
64
|
+
start: string;
|
|
65
|
+
end: string;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
export declare const EmailAnswer: z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"email">;
|
|
70
|
+
answer: z.ZodString;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
type: "email";
|
|
73
|
+
answer: string;
|
|
74
|
+
}, {
|
|
75
|
+
type: "email";
|
|
76
|
+
answer: string;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const FilteredSearchAnswer: z.ZodObject<{} & {
|
|
79
|
+
type: z.ZodLiteral<"filteredSearch">;
|
|
80
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
type: "filteredSearch";
|
|
83
|
+
answer: string[];
|
|
84
|
+
}, {
|
|
85
|
+
type: "filteredSearch";
|
|
86
|
+
answer: string[];
|
|
87
|
+
}>;
|
|
88
|
+
export declare const NumberAnswer: z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"number">;
|
|
90
|
+
answer: z.ZodNumber;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
type: "number";
|
|
93
|
+
answer: number;
|
|
94
|
+
}, {
|
|
95
|
+
type: "number";
|
|
96
|
+
answer: number;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const RadioButtonsAnswer: z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
100
|
+
answer: z.ZodString;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
type: "radioButtons";
|
|
103
|
+
answer: string;
|
|
104
|
+
}, {
|
|
105
|
+
type: "radioButtons";
|
|
106
|
+
answer: string;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const SelectBoxAnswer: z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"selectBox">;
|
|
110
|
+
answer: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
type: "selectBox";
|
|
113
|
+
answer: string;
|
|
114
|
+
}, {
|
|
115
|
+
type: "selectBox";
|
|
116
|
+
answer: string;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const TextAnswer: z.ZodObject<{
|
|
119
|
+
type: z.ZodLiteral<"text">;
|
|
120
|
+
answer: z.ZodString;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
type: "text";
|
|
123
|
+
answer: string;
|
|
124
|
+
}, {
|
|
125
|
+
type: "text";
|
|
126
|
+
answer: string;
|
|
127
|
+
}>;
|
|
128
|
+
export declare const TextAreaAnswer: z.ZodObject<{
|
|
129
|
+
type: z.ZodLiteral<"textArea">;
|
|
130
|
+
answer: z.ZodString;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
type: "textArea";
|
|
133
|
+
answer: string;
|
|
134
|
+
}, {
|
|
135
|
+
type: "textArea";
|
|
136
|
+
answer: string;
|
|
137
|
+
}>;
|
|
138
|
+
export declare const TypeaheadSearchAnswer: z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
140
|
+
answer: z.ZodString;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
type: "typeaheadSearch";
|
|
143
|
+
answer: string;
|
|
144
|
+
}, {
|
|
145
|
+
type: "typeaheadSearch";
|
|
146
|
+
answer: string;
|
|
147
|
+
}>;
|
|
148
|
+
export declare const URLAnswer: z.ZodObject<{
|
|
149
|
+
type: z.ZodLiteral<"url">;
|
|
150
|
+
answer: z.ZodString;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
type: "url";
|
|
153
|
+
answer: string;
|
|
154
|
+
}, {
|
|
155
|
+
type: "url";
|
|
156
|
+
answer: string;
|
|
157
|
+
}>;
|
|
158
|
+
export declare const AnyAnswer: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"boolean">;
|
|
160
|
+
answer: z.ZodBoolean;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
type: "boolean";
|
|
163
|
+
answer: boolean;
|
|
164
|
+
}, {
|
|
165
|
+
type: "boolean";
|
|
166
|
+
answer: boolean;
|
|
167
|
+
}>, z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
169
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
type: "checkBoxes";
|
|
172
|
+
answer: string[];
|
|
173
|
+
}, {
|
|
174
|
+
type: "checkBoxes";
|
|
175
|
+
answer: string[];
|
|
176
|
+
}>, z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"currency">;
|
|
178
|
+
answer: z.ZodNumber;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
type: "currency";
|
|
181
|
+
answer: number;
|
|
182
|
+
}, {
|
|
183
|
+
type: "currency";
|
|
184
|
+
answer: number;
|
|
185
|
+
}>, z.ZodObject<{
|
|
186
|
+
answer: z.ZodString;
|
|
187
|
+
} & {
|
|
188
|
+
type: z.ZodLiteral<"datePicker">;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
type: "datePicker";
|
|
191
|
+
answer: string;
|
|
192
|
+
}, {
|
|
193
|
+
type: "datePicker";
|
|
194
|
+
answer: string;
|
|
195
|
+
}>, z.ZodObject<{} & {
|
|
196
|
+
type: z.ZodLiteral<"dateRange">;
|
|
197
|
+
answer: z.ZodObject<{
|
|
198
|
+
start: z.ZodString;
|
|
199
|
+
end: z.ZodString;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
start: string;
|
|
202
|
+
end: string;
|
|
203
|
+
}, {
|
|
204
|
+
start: string;
|
|
205
|
+
end: string;
|
|
206
|
+
}>;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
type: "dateRange";
|
|
209
|
+
answer: {
|
|
210
|
+
start: string;
|
|
211
|
+
end: string;
|
|
212
|
+
};
|
|
213
|
+
}, {
|
|
214
|
+
type: "dateRange";
|
|
215
|
+
answer: {
|
|
216
|
+
start: string;
|
|
217
|
+
end: string;
|
|
218
|
+
};
|
|
219
|
+
}>, z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"email">;
|
|
221
|
+
answer: z.ZodString;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
type: "email";
|
|
224
|
+
answer: string;
|
|
225
|
+
}, {
|
|
226
|
+
type: "email";
|
|
227
|
+
answer: string;
|
|
228
|
+
}>, z.ZodObject<{} & {
|
|
229
|
+
type: z.ZodLiteral<"filteredSearch">;
|
|
230
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
type: "filteredSearch";
|
|
233
|
+
answer: string[];
|
|
234
|
+
}, {
|
|
235
|
+
type: "filteredSearch";
|
|
236
|
+
answer: string[];
|
|
237
|
+
}>, z.ZodObject<{
|
|
238
|
+
type: z.ZodLiteral<"number">;
|
|
239
|
+
answer: z.ZodNumber;
|
|
240
|
+
}, "strip", z.ZodTypeAny, {
|
|
241
|
+
type: "number";
|
|
242
|
+
answer: number;
|
|
243
|
+
}, {
|
|
244
|
+
type: "number";
|
|
245
|
+
answer: number;
|
|
246
|
+
}>, z.ZodObject<{
|
|
247
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
248
|
+
answer: z.ZodString;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
type: "radioButtons";
|
|
251
|
+
answer: string;
|
|
252
|
+
}, {
|
|
253
|
+
type: "radioButtons";
|
|
254
|
+
answer: string;
|
|
255
|
+
}>, z.ZodObject<{
|
|
256
|
+
type: z.ZodLiteral<"selectBox">;
|
|
257
|
+
answer: z.ZodString;
|
|
258
|
+
}, "strip", z.ZodTypeAny, {
|
|
259
|
+
type: "selectBox";
|
|
260
|
+
answer: string;
|
|
261
|
+
}, {
|
|
262
|
+
type: "selectBox";
|
|
263
|
+
answer: string;
|
|
264
|
+
}>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"textArea">;
|
|
266
|
+
answer: z.ZodString;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
type: "textArea";
|
|
269
|
+
answer: string;
|
|
270
|
+
}, {
|
|
271
|
+
type: "textArea";
|
|
272
|
+
answer: string;
|
|
273
|
+
}>, z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"text">;
|
|
275
|
+
answer: z.ZodString;
|
|
276
|
+
}, "strip", z.ZodTypeAny, {
|
|
277
|
+
type: "text";
|
|
278
|
+
answer: string;
|
|
279
|
+
}, {
|
|
280
|
+
type: "text";
|
|
281
|
+
answer: string;
|
|
282
|
+
}>, z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
284
|
+
answer: z.ZodString;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
type: "typeaheadSearch";
|
|
287
|
+
answer: string;
|
|
288
|
+
}, {
|
|
289
|
+
type: "typeaheadSearch";
|
|
290
|
+
answer: string;
|
|
291
|
+
}>, z.ZodObject<{
|
|
292
|
+
type: z.ZodLiteral<"url">;
|
|
293
|
+
answer: z.ZodString;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
type: "url";
|
|
296
|
+
answer: string;
|
|
297
|
+
}, {
|
|
298
|
+
type: "url";
|
|
299
|
+
answer: string;
|
|
300
|
+
}>]>;
|
|
301
|
+
export declare const TableAnswer: z.ZodObject<{
|
|
302
|
+
type: z.ZodLiteral<"table">;
|
|
303
|
+
answer: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
304
|
+
type: z.ZodLiteral<"boolean">;
|
|
305
|
+
answer: z.ZodBoolean;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
type: "boolean";
|
|
308
|
+
answer: boolean;
|
|
309
|
+
}, {
|
|
310
|
+
type: "boolean";
|
|
311
|
+
answer: boolean;
|
|
312
|
+
}>, z.ZodObject<{
|
|
313
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
314
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
315
|
+
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
type: "checkBoxes";
|
|
317
|
+
answer: string[];
|
|
318
|
+
}, {
|
|
319
|
+
type: "checkBoxes";
|
|
320
|
+
answer: string[];
|
|
321
|
+
}>, z.ZodObject<{
|
|
322
|
+
type: z.ZodLiteral<"currency">;
|
|
323
|
+
answer: z.ZodNumber;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
type: "currency";
|
|
326
|
+
answer: number;
|
|
327
|
+
}, {
|
|
328
|
+
type: "currency";
|
|
329
|
+
answer: number;
|
|
330
|
+
}>, z.ZodObject<{
|
|
331
|
+
answer: z.ZodString;
|
|
332
|
+
} & {
|
|
333
|
+
type: z.ZodLiteral<"datePicker">;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
type: "datePicker";
|
|
336
|
+
answer: string;
|
|
337
|
+
}, {
|
|
338
|
+
type: "datePicker";
|
|
339
|
+
answer: string;
|
|
340
|
+
}>, z.ZodObject<{} & {
|
|
341
|
+
type: z.ZodLiteral<"dateRange">;
|
|
342
|
+
answer: z.ZodObject<{
|
|
343
|
+
start: z.ZodString;
|
|
344
|
+
end: z.ZodString;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
start: string;
|
|
347
|
+
end: string;
|
|
348
|
+
}, {
|
|
349
|
+
start: string;
|
|
350
|
+
end: string;
|
|
351
|
+
}>;
|
|
352
|
+
}, "strip", z.ZodTypeAny, {
|
|
353
|
+
type: "dateRange";
|
|
354
|
+
answer: {
|
|
355
|
+
start: string;
|
|
356
|
+
end: string;
|
|
357
|
+
};
|
|
358
|
+
}, {
|
|
359
|
+
type: "dateRange";
|
|
360
|
+
answer: {
|
|
361
|
+
start: string;
|
|
362
|
+
end: string;
|
|
363
|
+
};
|
|
364
|
+
}>, z.ZodObject<{
|
|
365
|
+
type: z.ZodLiteral<"email">;
|
|
366
|
+
answer: z.ZodString;
|
|
367
|
+
}, "strip", z.ZodTypeAny, {
|
|
368
|
+
type: "email";
|
|
369
|
+
answer: string;
|
|
370
|
+
}, {
|
|
371
|
+
type: "email";
|
|
372
|
+
answer: string;
|
|
373
|
+
}>, z.ZodObject<{} & {
|
|
374
|
+
type: z.ZodLiteral<"filteredSearch">;
|
|
375
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
376
|
+
}, "strip", z.ZodTypeAny, {
|
|
377
|
+
type: "filteredSearch";
|
|
378
|
+
answer: string[];
|
|
379
|
+
}, {
|
|
380
|
+
type: "filteredSearch";
|
|
381
|
+
answer: string[];
|
|
382
|
+
}>, z.ZodObject<{
|
|
383
|
+
type: z.ZodLiteral<"number">;
|
|
384
|
+
answer: z.ZodNumber;
|
|
385
|
+
}, "strip", z.ZodTypeAny, {
|
|
386
|
+
type: "number";
|
|
387
|
+
answer: number;
|
|
388
|
+
}, {
|
|
389
|
+
type: "number";
|
|
390
|
+
answer: number;
|
|
391
|
+
}>, z.ZodObject<{
|
|
392
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
393
|
+
answer: z.ZodString;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
type: "radioButtons";
|
|
396
|
+
answer: string;
|
|
397
|
+
}, {
|
|
398
|
+
type: "radioButtons";
|
|
399
|
+
answer: string;
|
|
400
|
+
}>, z.ZodObject<{
|
|
401
|
+
type: z.ZodLiteral<"selectBox">;
|
|
402
|
+
answer: z.ZodString;
|
|
403
|
+
}, "strip", z.ZodTypeAny, {
|
|
404
|
+
type: "selectBox";
|
|
405
|
+
answer: string;
|
|
406
|
+
}, {
|
|
407
|
+
type: "selectBox";
|
|
408
|
+
answer: string;
|
|
409
|
+
}>, z.ZodObject<{
|
|
410
|
+
type: z.ZodLiteral<"textArea">;
|
|
411
|
+
answer: z.ZodString;
|
|
412
|
+
}, "strip", z.ZodTypeAny, {
|
|
413
|
+
type: "textArea";
|
|
414
|
+
answer: string;
|
|
415
|
+
}, {
|
|
416
|
+
type: "textArea";
|
|
417
|
+
answer: string;
|
|
418
|
+
}>, z.ZodObject<{
|
|
419
|
+
type: z.ZodLiteral<"text">;
|
|
420
|
+
answer: z.ZodString;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
type: "text";
|
|
423
|
+
answer: string;
|
|
424
|
+
}, {
|
|
425
|
+
type: "text";
|
|
426
|
+
answer: string;
|
|
427
|
+
}>, z.ZodObject<{
|
|
428
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
429
|
+
answer: z.ZodString;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
type: "typeaheadSearch";
|
|
432
|
+
answer: string;
|
|
433
|
+
}, {
|
|
434
|
+
type: "typeaheadSearch";
|
|
435
|
+
answer: string;
|
|
436
|
+
}>, z.ZodObject<{
|
|
437
|
+
type: z.ZodLiteral<"url">;
|
|
438
|
+
answer: z.ZodString;
|
|
439
|
+
}, "strip", z.ZodTypeAny, {
|
|
440
|
+
type: "url";
|
|
441
|
+
answer: string;
|
|
442
|
+
}, {
|
|
443
|
+
type: "url";
|
|
444
|
+
answer: string;
|
|
445
|
+
}>]>, "many">;
|
|
446
|
+
}, "strip", z.ZodTypeAny, {
|
|
447
|
+
type: "table";
|
|
448
|
+
answer: ({
|
|
449
|
+
type: "boolean";
|
|
450
|
+
answer: boolean;
|
|
451
|
+
} | {
|
|
452
|
+
type: "checkBoxes";
|
|
453
|
+
answer: string[];
|
|
454
|
+
} | {
|
|
455
|
+
type: "currency";
|
|
456
|
+
answer: number;
|
|
457
|
+
} | {
|
|
458
|
+
type: "datePicker";
|
|
459
|
+
answer: string;
|
|
460
|
+
} | {
|
|
461
|
+
type: "dateRange";
|
|
462
|
+
answer: {
|
|
463
|
+
start: string;
|
|
464
|
+
end: string;
|
|
465
|
+
};
|
|
466
|
+
} | {
|
|
467
|
+
type: "email";
|
|
468
|
+
answer: string;
|
|
469
|
+
} | {
|
|
470
|
+
type: "filteredSearch";
|
|
471
|
+
answer: string[];
|
|
472
|
+
} | {
|
|
473
|
+
type: "number";
|
|
474
|
+
answer: number;
|
|
475
|
+
} | {
|
|
476
|
+
type: "radioButtons";
|
|
477
|
+
answer: string;
|
|
478
|
+
} | {
|
|
479
|
+
type: "selectBox";
|
|
480
|
+
answer: string;
|
|
481
|
+
} | {
|
|
482
|
+
type: "text";
|
|
483
|
+
answer: string;
|
|
484
|
+
} | {
|
|
485
|
+
type: "textArea";
|
|
486
|
+
answer: string;
|
|
487
|
+
} | {
|
|
488
|
+
type: "typeaheadSearch";
|
|
489
|
+
answer: string;
|
|
490
|
+
} | {
|
|
491
|
+
type: "url";
|
|
492
|
+
answer: string;
|
|
493
|
+
})[];
|
|
494
|
+
}, {
|
|
495
|
+
type: "table";
|
|
496
|
+
answer: ({
|
|
497
|
+
type: "boolean";
|
|
498
|
+
answer: boolean;
|
|
499
|
+
} | {
|
|
500
|
+
type: "checkBoxes";
|
|
501
|
+
answer: string[];
|
|
502
|
+
} | {
|
|
503
|
+
type: "currency";
|
|
504
|
+
answer: number;
|
|
505
|
+
} | {
|
|
506
|
+
type: "datePicker";
|
|
507
|
+
answer: string;
|
|
508
|
+
} | {
|
|
509
|
+
type: "dateRange";
|
|
510
|
+
answer: {
|
|
511
|
+
start: string;
|
|
512
|
+
end: string;
|
|
513
|
+
};
|
|
514
|
+
} | {
|
|
515
|
+
type: "email";
|
|
516
|
+
answer: string;
|
|
517
|
+
} | {
|
|
518
|
+
type: "filteredSearch";
|
|
519
|
+
answer: string[];
|
|
520
|
+
} | {
|
|
521
|
+
type: "number";
|
|
522
|
+
answer: number;
|
|
523
|
+
} | {
|
|
524
|
+
type: "radioButtons";
|
|
525
|
+
answer: string;
|
|
526
|
+
} | {
|
|
527
|
+
type: "selectBox";
|
|
528
|
+
answer: string;
|
|
529
|
+
} | {
|
|
530
|
+
type: "text";
|
|
531
|
+
answer: string;
|
|
532
|
+
} | {
|
|
533
|
+
type: "textArea";
|
|
534
|
+
answer: string;
|
|
535
|
+
} | {
|
|
536
|
+
type: "typeaheadSearch";
|
|
537
|
+
answer: string;
|
|
538
|
+
} | {
|
|
539
|
+
type: "url";
|
|
540
|
+
answer: string;
|
|
541
|
+
})[];
|
|
542
|
+
}>;
|
|
543
|
+
export type AnyAnswerType = z.infer<typeof AnyAnswer>;
|
|
544
|
+
export type BooleanAnswerType = z.infer<typeof BooleanAnswer>;
|
|
545
|
+
export type CheckboxesAnswerType = z.infer<typeof CheckboxesAnswer>;
|
|
546
|
+
export type CurrencyAnswerType = z.infer<typeof CurrencyAnswer>;
|
|
547
|
+
export type DatePickerAnswerType = z.infer<typeof DatePickerAnswer>;
|
|
548
|
+
export type DateRangeAnswerType = z.infer<typeof DateRangeAnswer>;
|
|
549
|
+
export type EmailAnswerType = z.infer<typeof EmailAnswer>;
|
|
550
|
+
export type FilteredSearchAnswerType = z.infer<typeof FilteredSearchAnswer>;
|
|
551
|
+
export type NumberAnswerType = z.infer<typeof NumberAnswer>;
|
|
552
|
+
export type RadioButtonsAnswerType = z.infer<typeof RadioButtonsAnswer>;
|
|
553
|
+
export type SelectBoxAnswerType = z.infer<typeof SelectBoxAnswer>;
|
|
554
|
+
export type TableAnswerType = z.infer<typeof TableAnswer>;
|
|
555
|
+
export type TextAnswerType = z.infer<typeof TextAnswer>;
|
|
556
|
+
export type TextAreaAnswerType = z.infer<typeof TextAreaAnswer>;
|
|
557
|
+
export type TypeaheadSearchAnswerType = z.infer<typeof TypeaheadSearchAnswer>;
|
|
558
|
+
export type URLAnswerType = z.infer<typeof URLAnswer>;
|
package/dist/answers.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableAnswer = exports.AnyAnswer = exports.URLAnswer = exports.TypeaheadSearchAnswer = exports.TextAreaAnswer = exports.TextAnswer = exports.SelectBoxAnswer = exports.RadioButtonsAnswer = exports.NumberAnswer = exports.FilteredSearchAnswer = exports.EmailAnswer = exports.DateRangeAnswer = exports.DatePickerAnswer = exports.CurrencyAnswer = exports.CheckboxesAnswer = exports.BooleanAnswer = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const primitiveQuestions_1 = require("./primitiveQuestions");
|
|
6
|
+
const Answer = zod_1.z.object({
|
|
7
|
+
type: primitiveQuestions_1.QuestionTypesEnum, // The type of answer
|
|
8
|
+
answer: zod_1.z.string(), // The answer to the question (string)
|
|
9
|
+
});
|
|
10
|
+
exports.BooleanAnswer = zod_1.z.object({
|
|
11
|
+
type: zod_1.z.literal('boolean'), // The type of answer
|
|
12
|
+
answer: zod_1.z.boolean() // The answer to the question (true/false)
|
|
13
|
+
});
|
|
14
|
+
exports.CheckboxesAnswer = zod_1.z.object({
|
|
15
|
+
type: zod_1.z.literal('checkBoxes'), // The type of answer
|
|
16
|
+
answer: zod_1.z.array(zod_1.z.string()) // The answer to the question (array of strings)
|
|
17
|
+
});
|
|
18
|
+
exports.CurrencyAnswer = zod_1.z.object({
|
|
19
|
+
type: zod_1.z.literal('currency'), // The type of answer
|
|
20
|
+
answer: zod_1.z.number() // The answer to the question (number)
|
|
21
|
+
});
|
|
22
|
+
exports.DatePickerAnswer = Answer.merge(zod_1.z.object({
|
|
23
|
+
type: zod_1.z.literal('datePicker'), // The type of question
|
|
24
|
+
}));
|
|
25
|
+
exports.DateRangeAnswer = Answer.merge(zod_1.z.object({
|
|
26
|
+
type: zod_1.z.literal('dateRange'), // The type of answer
|
|
27
|
+
answer: zod_1.z.object({
|
|
28
|
+
start: zod_1.z.string(), // The start date (string)
|
|
29
|
+
end: zod_1.z.string() // The end date (string)
|
|
30
|
+
})
|
|
31
|
+
}));
|
|
32
|
+
exports.EmailAnswer = zod_1.z.object({
|
|
33
|
+
type: zod_1.z.literal('email'), // The type of question
|
|
34
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
35
|
+
});
|
|
36
|
+
exports.FilteredSearchAnswer = Answer.merge(zod_1.z.object({
|
|
37
|
+
type: zod_1.z.literal('filteredSearch'), // The type of answer
|
|
38
|
+
answer: zod_1.z.array(zod_1.z.string()) // The answer to the filtered search (array of strings)
|
|
39
|
+
}));
|
|
40
|
+
exports.NumberAnswer = zod_1.z.object({
|
|
41
|
+
type: zod_1.z.literal('number'), // The type of answer
|
|
42
|
+
answer: zod_1.z.number() // The answer to the question (number)
|
|
43
|
+
});
|
|
44
|
+
exports.RadioButtonsAnswer = zod_1.z.object({
|
|
45
|
+
type: zod_1.z.literal('radioButtons'), // The type of answer
|
|
46
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
47
|
+
});
|
|
48
|
+
exports.SelectBoxAnswer = zod_1.z.object({
|
|
49
|
+
type: zod_1.z.literal('selectBox'), // The type of answer
|
|
50
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
51
|
+
});
|
|
52
|
+
exports.TextAnswer = zod_1.z.object({
|
|
53
|
+
type: zod_1.z.literal('text'), // The type of answer
|
|
54
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
55
|
+
});
|
|
56
|
+
exports.TextAreaAnswer = zod_1.z.object({
|
|
57
|
+
type: zod_1.z.literal('textArea'), // The type of answer
|
|
58
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
59
|
+
});
|
|
60
|
+
exports.TypeaheadSearchAnswer = zod_1.z.object({
|
|
61
|
+
type: zod_1.z.literal('typeaheadSearch'), // The type of answer
|
|
62
|
+
answer: zod_1.z.string() // The answer to the typeahead search (string)
|
|
63
|
+
});
|
|
64
|
+
exports.URLAnswer = zod_1.z.object({
|
|
65
|
+
type: zod_1.z.literal('url'), // The type of answer
|
|
66
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
67
|
+
});
|
|
68
|
+
exports.AnyAnswer = zod_1.z.discriminatedUnion('type', [
|
|
69
|
+
exports.BooleanAnswer,
|
|
70
|
+
exports.CheckboxesAnswer,
|
|
71
|
+
exports.CurrencyAnswer,
|
|
72
|
+
exports.DatePickerAnswer,
|
|
73
|
+
exports.DateRangeAnswer,
|
|
74
|
+
exports.EmailAnswer,
|
|
75
|
+
exports.FilteredSearchAnswer,
|
|
76
|
+
exports.NumberAnswer,
|
|
77
|
+
exports.RadioButtonsAnswer,
|
|
78
|
+
exports.SelectBoxAnswer,
|
|
79
|
+
exports.TextAreaAnswer,
|
|
80
|
+
exports.TextAnswer,
|
|
81
|
+
exports.TypeaheadSearchAnswer,
|
|
82
|
+
exports.URLAnswer
|
|
83
|
+
]);
|
|
84
|
+
exports.TableAnswer = zod_1.z.object({
|
|
85
|
+
type: zod_1.z.literal('table'), // The type of answer
|
|
86
|
+
answer: zod_1.z.array(exports.AnyAnswer) // The answer to the question (array of answers)
|
|
87
|
+
});
|