@dmptool/types 1.0.0 → 1.0.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 +33 -2
- package/dist/answers/__tests__/answers.spec.d.ts +1 -0
- package/dist/answers/__tests__/answers.spec.js +122 -0
- package/dist/answers/answer.d.ts +12 -0
- package/dist/answers/answer.js +10 -0
- package/dist/answers/dateAnswers.d.ts +39 -0
- package/dist/answers/dateAnswers.js +16 -0
- package/dist/answers/graphQLAnswers.d.ts +23 -0
- package/dist/answers/graphQLAnswers.js +14 -0
- package/dist/{answers.d.ts → answers/index.d.ts} +102 -268
- package/dist/answers/index.js +48 -0
- package/dist/answers/optionBasedAnswers.d.ts +34 -0
- package/dist/answers/optionBasedAnswers.js +18 -0
- package/dist/answers/primitiveAnswers.d.ts +78 -0
- package/dist/answers/primitiveAnswers.js +34 -0
- package/dist/answers/tableAnswers.d.ts +388 -0
- package/dist/answers/tableAnswers.js +31 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -0
- package/dist/questions/__tests__/dateQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/dateQuestions.spec.js +149 -0
- package/dist/questions/__tests__/graphQLQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/graphQLQuestions.spec.js +87 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +152 -0
- package/dist/questions/__tests__/primitiveQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/primitiveQuestions.spec.js +189 -0
- package/dist/{dateQuestions.js → questions/dateQuestions.js} +3 -3
- package/dist/{graphQLQuestions.js → questions/graphQLQuestions.js} +3 -3
- package/dist/{tableQuestions.d.ts → questions/index.d.ts} +97 -1650
- package/dist/questions/index.js +48 -0
- package/dist/{optionBasedQuestions.js → questions/optionBasedQuestions.js} +4 -4
- package/dist/{primitiveQuestions.d.ts → questions/primitiveQuestions.d.ts} +0 -27
- package/dist/{primitiveQuestions.js → questions/primitiveQuestions.js} +8 -35
- package/dist/questions/question.d.ts +29 -0
- package/dist/questions/question.js +32 -0
- package/dist/questions/tableQuestions.d.ts +2638 -0
- package/dist/{tableQuestions.js → questions/tableQuestions.js} +5 -22
- package/dist/schemas/anyAnswer.schema.json +110 -47
- package/dist/schemas/anyTableColumnAnswer.schema.json +267 -0
- package/dist/schemas/anyTableColumnQuestion.schema.json +637 -0
- package/dist/schemas/tableAnswer.schema.json +2 -2
- package/package.json +8 -1
- package/dist/answers.js +0 -87
- /package/dist/{dateQuestions.d.ts → questions/dateQuestions.d.ts} +0 -0
- /package/dist/{graphQLQuestions.d.ts → questions/graphQLQuestions.d.ts} +0 -0
- /package/dist/{optionBasedQuestions.d.ts → questions/optionBasedQuestions.d.ts} +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
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 CurrencyAnswer: z.ZodObject<{} & {
|
|
13
|
+
type: z.ZodLiteral<"currency">;
|
|
14
|
+
answer: z.ZodNumber;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
type: "currency";
|
|
17
|
+
answer: number;
|
|
18
|
+
}, {
|
|
19
|
+
type: "currency";
|
|
20
|
+
answer: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const EmailAnswer: z.ZodObject<{} & {
|
|
23
|
+
type: z.ZodLiteral<"email">;
|
|
24
|
+
answer: z.ZodString;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type: "email";
|
|
27
|
+
answer: string;
|
|
28
|
+
}, {
|
|
29
|
+
type: "email";
|
|
30
|
+
answer: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const NumberAnswer: z.ZodObject<{} & {
|
|
33
|
+
type: z.ZodLiteral<"number">;
|
|
34
|
+
answer: z.ZodNumber;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
type: "number";
|
|
37
|
+
answer: number;
|
|
38
|
+
}, {
|
|
39
|
+
type: "number";
|
|
40
|
+
answer: number;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const TextAnswer: z.ZodObject<{} & {
|
|
43
|
+
type: z.ZodLiteral<"text">;
|
|
44
|
+
answer: z.ZodString;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
type: "text";
|
|
47
|
+
answer: string;
|
|
48
|
+
}, {
|
|
49
|
+
type: "text";
|
|
50
|
+
answer: string;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const TextAreaAnswer: z.ZodObject<{} & {
|
|
53
|
+
type: z.ZodLiteral<"textArea">;
|
|
54
|
+
answer: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
type: "textArea";
|
|
57
|
+
answer: string;
|
|
58
|
+
}, {
|
|
59
|
+
type: "textArea";
|
|
60
|
+
answer: string;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const URLAnswer: z.ZodObject<{} & {
|
|
63
|
+
type: z.ZodLiteral<"url">;
|
|
64
|
+
answer: z.ZodString;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
type: "url";
|
|
67
|
+
answer: string;
|
|
68
|
+
}, {
|
|
69
|
+
type: "url";
|
|
70
|
+
answer: string;
|
|
71
|
+
}>;
|
|
72
|
+
export type BooleanAnswerType = z.infer<typeof BooleanAnswer>;
|
|
73
|
+
export type CurrencyAnswerType = z.infer<typeof CurrencyAnswer>;
|
|
74
|
+
export type EmailAnswerType = z.infer<typeof EmailAnswer>;
|
|
75
|
+
export type NumberAnswerType = z.infer<typeof NumberAnswer>;
|
|
76
|
+
export type TextAnswerType = z.infer<typeof TextAnswer>;
|
|
77
|
+
export type TextAreaAnswerType = z.infer<typeof TextAreaAnswer>;
|
|
78
|
+
export type URLAnswerType = z.infer<typeof URLAnswer>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URLAnswer = exports.TextAreaAnswer = exports.TextAnswer = exports.NumberAnswer = exports.EmailAnswer = exports.CurrencyAnswer = exports.BooleanAnswer = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const answer_1 = require("./answer");
|
|
6
|
+
// Answers to Primitive Question Types
|
|
7
|
+
exports.BooleanAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
8
|
+
type: zod_1.z.literal('boolean'), // The type of answer
|
|
9
|
+
answer: zod_1.z.boolean() // The answer to the question (true/false)
|
|
10
|
+
}));
|
|
11
|
+
exports.CurrencyAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
12
|
+
type: zod_1.z.literal('currency'), // The type of answer
|
|
13
|
+
answer: zod_1.z.number() // The answer to the question (number)
|
|
14
|
+
}));
|
|
15
|
+
exports.EmailAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
16
|
+
type: zod_1.z.literal('email'), // The type of question
|
|
17
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
18
|
+
}));
|
|
19
|
+
exports.NumberAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
20
|
+
type: zod_1.z.literal('number'), // The type of answer
|
|
21
|
+
answer: zod_1.z.number() // The answer to the question (number)
|
|
22
|
+
}));
|
|
23
|
+
exports.TextAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
24
|
+
type: zod_1.z.literal('text'), // The type of answer
|
|
25
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
26
|
+
}));
|
|
27
|
+
exports.TextAreaAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
28
|
+
type: zod_1.z.literal('textArea'), // The type of answer
|
|
29
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
30
|
+
}));
|
|
31
|
+
exports.URLAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
32
|
+
type: zod_1.z.literal('url'), // The type of answer
|
|
33
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
34
|
+
}));
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AnyTableColumnAnswer: z.ZodDiscriminatedUnion<"type", [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
|
+
}>, z.ZodObject<{} & {
|
|
12
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
13
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "checkBoxes";
|
|
16
|
+
answer: string[];
|
|
17
|
+
}, {
|
|
18
|
+
type: "checkBoxes";
|
|
19
|
+
answer: string[];
|
|
20
|
+
}>, z.ZodObject<{} & {
|
|
21
|
+
type: z.ZodLiteral<"currency">;
|
|
22
|
+
answer: z.ZodNumber;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
type: "currency";
|
|
25
|
+
answer: number;
|
|
26
|
+
}, {
|
|
27
|
+
type: "currency";
|
|
28
|
+
answer: number;
|
|
29
|
+
}>, z.ZodObject<{
|
|
30
|
+
answer: z.ZodString;
|
|
31
|
+
} & {
|
|
32
|
+
type: z.ZodLiteral<"datePicker">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
type: "datePicker";
|
|
35
|
+
answer: string;
|
|
36
|
+
}, {
|
|
37
|
+
type: "datePicker";
|
|
38
|
+
answer: string;
|
|
39
|
+
}>, z.ZodObject<{} & {
|
|
40
|
+
type: z.ZodLiteral<"dateRange">;
|
|
41
|
+
answer: z.ZodObject<{
|
|
42
|
+
start: z.ZodString;
|
|
43
|
+
end: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
start: string;
|
|
46
|
+
end: string;
|
|
47
|
+
}, {
|
|
48
|
+
start: string;
|
|
49
|
+
end: string;
|
|
50
|
+
}>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
type: "dateRange";
|
|
53
|
+
answer: {
|
|
54
|
+
start: string;
|
|
55
|
+
end: string;
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
type: "dateRange";
|
|
59
|
+
answer: {
|
|
60
|
+
start: string;
|
|
61
|
+
end: string;
|
|
62
|
+
};
|
|
63
|
+
}>, z.ZodObject<{} & {
|
|
64
|
+
type: z.ZodLiteral<"email">;
|
|
65
|
+
answer: z.ZodString;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
type: "email";
|
|
68
|
+
answer: string;
|
|
69
|
+
}, {
|
|
70
|
+
type: "email";
|
|
71
|
+
answer: string;
|
|
72
|
+
}>, z.ZodObject<{} & {
|
|
73
|
+
type: z.ZodLiteral<"filteredSearch">;
|
|
74
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
type: "filteredSearch";
|
|
77
|
+
answer: string[];
|
|
78
|
+
}, {
|
|
79
|
+
type: "filteredSearch";
|
|
80
|
+
answer: string[];
|
|
81
|
+
}>, z.ZodObject<{} & {
|
|
82
|
+
type: z.ZodLiteral<"number">;
|
|
83
|
+
answer: z.ZodNumber;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
type: "number";
|
|
86
|
+
answer: number;
|
|
87
|
+
}, {
|
|
88
|
+
type: "number";
|
|
89
|
+
answer: number;
|
|
90
|
+
}>, z.ZodObject<{} & {
|
|
91
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
92
|
+
answer: z.ZodString;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: "radioButtons";
|
|
95
|
+
answer: string;
|
|
96
|
+
}, {
|
|
97
|
+
type: "radioButtons";
|
|
98
|
+
answer: string;
|
|
99
|
+
}>, z.ZodObject<{} & {
|
|
100
|
+
type: z.ZodLiteral<"selectBox">;
|
|
101
|
+
answer: z.ZodString;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
type: "selectBox";
|
|
104
|
+
answer: string;
|
|
105
|
+
}, {
|
|
106
|
+
type: "selectBox";
|
|
107
|
+
answer: string;
|
|
108
|
+
}>, z.ZodObject<{} & {
|
|
109
|
+
type: z.ZodLiteral<"text">;
|
|
110
|
+
answer: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
type: "text";
|
|
113
|
+
answer: string;
|
|
114
|
+
}, {
|
|
115
|
+
type: "text";
|
|
116
|
+
answer: string;
|
|
117
|
+
}>, z.ZodObject<{} & {
|
|
118
|
+
type: z.ZodLiteral<"textArea">;
|
|
119
|
+
answer: z.ZodString;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
type: "textArea";
|
|
122
|
+
answer: string;
|
|
123
|
+
}, {
|
|
124
|
+
type: "textArea";
|
|
125
|
+
answer: string;
|
|
126
|
+
}>, z.ZodObject<{} & {
|
|
127
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
128
|
+
answer: z.ZodString;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
type: "typeaheadSearch";
|
|
131
|
+
answer: string;
|
|
132
|
+
}, {
|
|
133
|
+
type: "typeaheadSearch";
|
|
134
|
+
answer: string;
|
|
135
|
+
}>, z.ZodObject<{} & {
|
|
136
|
+
type: z.ZodLiteral<"url">;
|
|
137
|
+
answer: z.ZodString;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
type: "url";
|
|
140
|
+
answer: string;
|
|
141
|
+
}, {
|
|
142
|
+
type: "url";
|
|
143
|
+
answer: string;
|
|
144
|
+
}>]>;
|
|
145
|
+
export declare const TableAnswer: z.ZodObject<{} & {
|
|
146
|
+
type: z.ZodLiteral<"table">;
|
|
147
|
+
answer: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{} & {
|
|
148
|
+
type: z.ZodLiteral<"boolean">;
|
|
149
|
+
answer: z.ZodBoolean;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
type: "boolean";
|
|
152
|
+
answer: boolean;
|
|
153
|
+
}, {
|
|
154
|
+
type: "boolean";
|
|
155
|
+
answer: boolean;
|
|
156
|
+
}>, z.ZodObject<{} & {
|
|
157
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
158
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "checkBoxes";
|
|
161
|
+
answer: string[];
|
|
162
|
+
}, {
|
|
163
|
+
type: "checkBoxes";
|
|
164
|
+
answer: string[];
|
|
165
|
+
}>, z.ZodObject<{} & {
|
|
166
|
+
type: z.ZodLiteral<"currency">;
|
|
167
|
+
answer: z.ZodNumber;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
type: "currency";
|
|
170
|
+
answer: number;
|
|
171
|
+
}, {
|
|
172
|
+
type: "currency";
|
|
173
|
+
answer: number;
|
|
174
|
+
}>, z.ZodObject<{
|
|
175
|
+
answer: z.ZodString;
|
|
176
|
+
} & {
|
|
177
|
+
type: z.ZodLiteral<"datePicker">;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
type: "datePicker";
|
|
180
|
+
answer: string;
|
|
181
|
+
}, {
|
|
182
|
+
type: "datePicker";
|
|
183
|
+
answer: string;
|
|
184
|
+
}>, z.ZodObject<{} & {
|
|
185
|
+
type: z.ZodLiteral<"dateRange">;
|
|
186
|
+
answer: z.ZodObject<{
|
|
187
|
+
start: z.ZodString;
|
|
188
|
+
end: z.ZodString;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
start: string;
|
|
191
|
+
end: string;
|
|
192
|
+
}, {
|
|
193
|
+
start: string;
|
|
194
|
+
end: string;
|
|
195
|
+
}>;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
type: "dateRange";
|
|
198
|
+
answer: {
|
|
199
|
+
start: string;
|
|
200
|
+
end: string;
|
|
201
|
+
};
|
|
202
|
+
}, {
|
|
203
|
+
type: "dateRange";
|
|
204
|
+
answer: {
|
|
205
|
+
start: string;
|
|
206
|
+
end: string;
|
|
207
|
+
};
|
|
208
|
+
}>, z.ZodObject<{} & {
|
|
209
|
+
type: z.ZodLiteral<"email">;
|
|
210
|
+
answer: z.ZodString;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
type: "email";
|
|
213
|
+
answer: string;
|
|
214
|
+
}, {
|
|
215
|
+
type: "email";
|
|
216
|
+
answer: string;
|
|
217
|
+
}>, z.ZodObject<{} & {
|
|
218
|
+
type: z.ZodLiteral<"filteredSearch">;
|
|
219
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
220
|
+
}, "strip", z.ZodTypeAny, {
|
|
221
|
+
type: "filteredSearch";
|
|
222
|
+
answer: string[];
|
|
223
|
+
}, {
|
|
224
|
+
type: "filteredSearch";
|
|
225
|
+
answer: string[];
|
|
226
|
+
}>, z.ZodObject<{} & {
|
|
227
|
+
type: z.ZodLiteral<"number">;
|
|
228
|
+
answer: z.ZodNumber;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
type: "number";
|
|
231
|
+
answer: number;
|
|
232
|
+
}, {
|
|
233
|
+
type: "number";
|
|
234
|
+
answer: number;
|
|
235
|
+
}>, z.ZodObject<{} & {
|
|
236
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
237
|
+
answer: z.ZodString;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
type: "radioButtons";
|
|
240
|
+
answer: string;
|
|
241
|
+
}, {
|
|
242
|
+
type: "radioButtons";
|
|
243
|
+
answer: string;
|
|
244
|
+
}>, z.ZodObject<{} & {
|
|
245
|
+
type: z.ZodLiteral<"selectBox">;
|
|
246
|
+
answer: z.ZodString;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
type: "selectBox";
|
|
249
|
+
answer: string;
|
|
250
|
+
}, {
|
|
251
|
+
type: "selectBox";
|
|
252
|
+
answer: string;
|
|
253
|
+
}>, z.ZodObject<{} & {
|
|
254
|
+
type: z.ZodLiteral<"text">;
|
|
255
|
+
answer: z.ZodString;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
type: "text";
|
|
258
|
+
answer: string;
|
|
259
|
+
}, {
|
|
260
|
+
type: "text";
|
|
261
|
+
answer: string;
|
|
262
|
+
}>, z.ZodObject<{} & {
|
|
263
|
+
type: z.ZodLiteral<"textArea">;
|
|
264
|
+
answer: z.ZodString;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
type: "textArea";
|
|
267
|
+
answer: string;
|
|
268
|
+
}, {
|
|
269
|
+
type: "textArea";
|
|
270
|
+
answer: string;
|
|
271
|
+
}>, z.ZodObject<{} & {
|
|
272
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
273
|
+
answer: z.ZodString;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
type: "typeaheadSearch";
|
|
276
|
+
answer: string;
|
|
277
|
+
}, {
|
|
278
|
+
type: "typeaheadSearch";
|
|
279
|
+
answer: string;
|
|
280
|
+
}>, z.ZodObject<{} & {
|
|
281
|
+
type: z.ZodLiteral<"url">;
|
|
282
|
+
answer: z.ZodString;
|
|
283
|
+
}, "strip", z.ZodTypeAny, {
|
|
284
|
+
type: "url";
|
|
285
|
+
answer: string;
|
|
286
|
+
}, {
|
|
287
|
+
type: "url";
|
|
288
|
+
answer: string;
|
|
289
|
+
}>]>, "many">;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
type: "table";
|
|
292
|
+
answer: ({
|
|
293
|
+
type: "datePicker";
|
|
294
|
+
answer: string;
|
|
295
|
+
} | {
|
|
296
|
+
type: "dateRange";
|
|
297
|
+
answer: {
|
|
298
|
+
start: string;
|
|
299
|
+
end: string;
|
|
300
|
+
};
|
|
301
|
+
} | {
|
|
302
|
+
type: "filteredSearch";
|
|
303
|
+
answer: string[];
|
|
304
|
+
} | {
|
|
305
|
+
type: "typeaheadSearch";
|
|
306
|
+
answer: string;
|
|
307
|
+
} | {
|
|
308
|
+
type: "checkBoxes";
|
|
309
|
+
answer: string[];
|
|
310
|
+
} | {
|
|
311
|
+
type: "radioButtons";
|
|
312
|
+
answer: string;
|
|
313
|
+
} | {
|
|
314
|
+
type: "selectBox";
|
|
315
|
+
answer: string;
|
|
316
|
+
} | {
|
|
317
|
+
type: "boolean";
|
|
318
|
+
answer: boolean;
|
|
319
|
+
} | {
|
|
320
|
+
type: "currency";
|
|
321
|
+
answer: number;
|
|
322
|
+
} | {
|
|
323
|
+
type: "email";
|
|
324
|
+
answer: string;
|
|
325
|
+
} | {
|
|
326
|
+
type: "number";
|
|
327
|
+
answer: number;
|
|
328
|
+
} | {
|
|
329
|
+
type: "text";
|
|
330
|
+
answer: string;
|
|
331
|
+
} | {
|
|
332
|
+
type: "textArea";
|
|
333
|
+
answer: string;
|
|
334
|
+
} | {
|
|
335
|
+
type: "url";
|
|
336
|
+
answer: string;
|
|
337
|
+
})[];
|
|
338
|
+
}, {
|
|
339
|
+
type: "table";
|
|
340
|
+
answer: ({
|
|
341
|
+
type: "datePicker";
|
|
342
|
+
answer: string;
|
|
343
|
+
} | {
|
|
344
|
+
type: "dateRange";
|
|
345
|
+
answer: {
|
|
346
|
+
start: string;
|
|
347
|
+
end: string;
|
|
348
|
+
};
|
|
349
|
+
} | {
|
|
350
|
+
type: "filteredSearch";
|
|
351
|
+
answer: string[];
|
|
352
|
+
} | {
|
|
353
|
+
type: "typeaheadSearch";
|
|
354
|
+
answer: string;
|
|
355
|
+
} | {
|
|
356
|
+
type: "checkBoxes";
|
|
357
|
+
answer: string[];
|
|
358
|
+
} | {
|
|
359
|
+
type: "radioButtons";
|
|
360
|
+
answer: string;
|
|
361
|
+
} | {
|
|
362
|
+
type: "selectBox";
|
|
363
|
+
answer: string;
|
|
364
|
+
} | {
|
|
365
|
+
type: "boolean";
|
|
366
|
+
answer: boolean;
|
|
367
|
+
} | {
|
|
368
|
+
type: "currency";
|
|
369
|
+
answer: number;
|
|
370
|
+
} | {
|
|
371
|
+
type: "email";
|
|
372
|
+
answer: string;
|
|
373
|
+
} | {
|
|
374
|
+
type: "number";
|
|
375
|
+
answer: number;
|
|
376
|
+
} | {
|
|
377
|
+
type: "text";
|
|
378
|
+
answer: string;
|
|
379
|
+
} | {
|
|
380
|
+
type: "textArea";
|
|
381
|
+
answer: string;
|
|
382
|
+
} | {
|
|
383
|
+
type: "url";
|
|
384
|
+
answer: string;
|
|
385
|
+
})[];
|
|
386
|
+
}>;
|
|
387
|
+
export type TableAnswerType = z.infer<typeof TableAnswer>;
|
|
388
|
+
export type AnyTableColumnAnswerType = z.infer<typeof AnyTableColumnAnswer>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableAnswer = exports.AnyTableColumnAnswer = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const answer_1 = require("./answer");
|
|
6
|
+
const optionBasedAnswers_1 = require("./optionBasedAnswers");
|
|
7
|
+
const dateAnswers_1 = require("./dateAnswers");
|
|
8
|
+
const graphQLAnswers_1 = require("./graphQLAnswers");
|
|
9
|
+
const primitiveAnswers_1 = require("./primitiveAnswers");
|
|
10
|
+
// Answers to Table Column Question Types (note that TableAnswer is not included here because we don't allow nested tables)
|
|
11
|
+
exports.AnyTableColumnAnswer = zod_1.z.discriminatedUnion('type', [
|
|
12
|
+
primitiveAnswers_1.BooleanAnswer,
|
|
13
|
+
optionBasedAnswers_1.CheckboxesAnswer,
|
|
14
|
+
primitiveAnswers_1.CurrencyAnswer,
|
|
15
|
+
dateAnswers_1.DatePickerAnswer,
|
|
16
|
+
dateAnswers_1.DateRangeAnswer,
|
|
17
|
+
primitiveAnswers_1.EmailAnswer,
|
|
18
|
+
graphQLAnswers_1.FilteredSearchAnswer,
|
|
19
|
+
primitiveAnswers_1.NumberAnswer,
|
|
20
|
+
optionBasedAnswers_1.RadioButtonsAnswer,
|
|
21
|
+
optionBasedAnswers_1.SelectBoxAnswer,
|
|
22
|
+
primitiveAnswers_1.TextAnswer,
|
|
23
|
+
primitiveAnswers_1.TextAreaAnswer,
|
|
24
|
+
graphQLAnswers_1.TypeaheadSearchAnswer,
|
|
25
|
+
primitiveAnswers_1.URLAnswer
|
|
26
|
+
]);
|
|
27
|
+
// Answers to Table Question Types
|
|
28
|
+
exports.TableAnswer = answer_1.Answer.merge(zod_1.z.object({
|
|
29
|
+
type: zod_1.z.literal('table'), // The type of answer
|
|
30
|
+
answer: zod_1.z.array(exports.AnyTableColumnAnswer) // The answer to the question (array of answers)
|
|
31
|
+
}));
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Export All the Zod schemas and types
|
|
18
|
+
__exportStar(require("./answers"), exports);
|
|
19
|
+
__exportStar(require("./questions"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|