@dmptool/types 1.0.5 → 1.0.7
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 +5 -4
- package/dist/answers/__tests__/answers.spec.js +59 -7
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/dateAnswers.d.ts +5 -5
- package/dist/answers/dateAnswers.js +3 -3
- package/dist/answers/index.d.ts +892 -513
- package/dist/answers/index.js +3 -2
- package/dist/answers/primitiveAnswers.d.ts +39 -0
- package/dist/answers/primitiveAnswers.js +8 -1
- package/dist/answers/tableAnswers.d.ts +1639 -32
- package/dist/answers/tableAnswers.js +10 -3
- package/dist/questions/__tests__/dateQuestions.spec.js +20 -20
- package/dist/questions/__tests__/primitiveQuestions.spec.js +92 -0
- package/dist/questions/__tests__/tableQuestion.spec.d.ts +1 -0
- package/dist/questions/__tests__/tableQuestion.spec.js +73 -0
- package/dist/questions/dateQuestions.d.ts +19 -19
- package/dist/questions/dateQuestions.js +8 -8
- package/dist/questions/graphQLQuestions.d.ts +20 -20
- package/dist/questions/graphQLQuestions.js +1 -1
- package/dist/questions/index.d.ts +1875 -1380
- package/dist/questions/index.js +3 -2
- package/dist/questions/optionBasedQuestions.js +1 -1
- package/dist/questions/primitiveQuestions.d.ts +214 -0
- package/dist/questions/primitiveQuestions.js +20 -3
- package/dist/questions/question.d.ts +4 -4
- package/dist/questions/question.js +2 -1
- package/dist/questions/tableQuestions.d.ts +2176 -145
- package/dist/questions/tableQuestions.js +7 -3
- package/dist/schemas/anyAnswer.schema.json +144 -119
- package/dist/schemas/anyQuestion.schema.json +161 -132
- package/dist/schemas/anyTableColumnAnswer.schema.json +1 -1
- package/dist/schemas/anyTableColumnQuestion.schema.json +20 -3
- package/dist/schemas/currencyQuestion.schema.json +10 -0
- package/dist/schemas/dateAnswer.schema.json +37 -0
- package/dist/schemas/datePickerAnswer.schema.json +4 -4
- package/dist/schemas/datePickerQuestion.schema.json +6 -5
- package/dist/schemas/dateQuestion.schema.json +51 -0
- package/dist/schemas/dateRangeQuestion.schema.json +1 -1
- package/dist/schemas/filteredSearchQuestion.schema.json +1 -2
- package/dist/schemas/numberRangeAnswer.schema.json +50 -0
- package/dist/schemas/numberRangeQuestion.schema.json +106 -0
- package/dist/schemas/tableAnswer.schema.json +349 -324
- package/dist/schemas/tableQuestion.schema.json +497 -468
- package/dist/schemas/textAreaQuestion.schema.json +10 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableAnswerSchema = exports.AnyTableColumnAnswerSchema = void 0;
|
|
3
|
+
exports.TableAnswerSchema = exports.TableRowAnswerSchema = exports.TableColumnAnswerSchema = exports.AnyTableColumnAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
6
|
const optionBasedAnswers_1 = require("./optionBasedAnswers");
|
|
@@ -12,7 +12,7 @@ exports.AnyTableColumnAnswerSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
12
12
|
primitiveAnswers_1.BooleanAnswerSchema,
|
|
13
13
|
optionBasedAnswers_1.CheckboxesAnswerSchema,
|
|
14
14
|
primitiveAnswers_1.CurrencyAnswerSchema,
|
|
15
|
-
dateAnswers_1.
|
|
15
|
+
dateAnswers_1.DateAnswerSchema,
|
|
16
16
|
dateAnswers_1.DateRangeAnswerSchema,
|
|
17
17
|
primitiveAnswers_1.EmailAnswerSchema,
|
|
18
18
|
graphQLAnswers_1.FilteredSearchAnswerSchema,
|
|
@@ -24,8 +24,15 @@ exports.AnyTableColumnAnswerSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
24
24
|
graphQLAnswers_1.TypeaheadSearchAnswerSchema,
|
|
25
25
|
primitiveAnswers_1.URLAnswerSchema
|
|
26
26
|
]);
|
|
27
|
+
exports.TableColumnAnswerSchema = zod_1.z.object({
|
|
28
|
+
heading: zod_1.z.string(), // The heading of the column
|
|
29
|
+
content: exports.AnyTableColumnAnswerSchema // The answer to the column (based on the type)
|
|
30
|
+
});
|
|
31
|
+
exports.TableRowAnswerSchema = zod_1.z.object({
|
|
32
|
+
columns: zod_1.z.array(exports.TableColumnAnswerSchema) // The answers for each column in the row
|
|
33
|
+
});
|
|
27
34
|
// Answers to Table Question Types
|
|
28
35
|
exports.TableAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
29
36
|
type: zod_1.z.literal('table'), // The type of answer
|
|
30
|
-
answer: zod_1.z.array(exports.
|
|
37
|
+
answer: zod_1.z.array(exports.TableRowAnswerSchema) // The answers to the question (array of rows containing an array of columns)
|
|
31
38
|
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const dateQuestions_1 = require("../dateQuestions");
|
|
4
|
-
describe("
|
|
5
|
-
it("should validate a valid
|
|
6
|
-
const
|
|
7
|
-
type: "
|
|
4
|
+
describe("DateQuestion", () => {
|
|
5
|
+
it("should validate a valid DateQuestion object", () => {
|
|
6
|
+
const validDate = {
|
|
7
|
+
type: "date",
|
|
8
8
|
attributes: {
|
|
9
9
|
max: "2023-12-31",
|
|
10
10
|
min: "2023-01-01",
|
|
@@ -14,11 +14,11 @@ describe("DatePickerQuestion", () => {
|
|
|
14
14
|
schemaVersion: "1.0"
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
expect(() => dateQuestions_1.
|
|
17
|
+
expect(() => dateQuestions_1.DateQuestionSchema.parse(validDate)).not.toThrow();
|
|
18
18
|
});
|
|
19
|
-
it("should throw an error for an invalid
|
|
20
|
-
const
|
|
21
|
-
type: "
|
|
19
|
+
it("should throw an error for an invalid DateQuestion object", () => {
|
|
20
|
+
const invalidDate = {
|
|
21
|
+
type: "date",
|
|
22
22
|
attributes: {
|
|
23
23
|
max: 123, // Invalid type for max
|
|
24
24
|
min: "2023-01-01",
|
|
@@ -28,17 +28,17 @@ describe("DatePickerQuestion", () => {
|
|
|
28
28
|
schemaVersion: "1.0"
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
expect(() => dateQuestions_1.
|
|
31
|
+
expect(() => dateQuestions_1.DateQuestionSchema.parse(invalidDate)).toThrow();
|
|
32
32
|
});
|
|
33
|
-
it("should allow optional attributes in
|
|
34
|
-
const
|
|
35
|
-
type: "
|
|
33
|
+
it("should allow optional attributes in DateQuestion", () => {
|
|
34
|
+
const validDate = {
|
|
35
|
+
type: "date",
|
|
36
36
|
attributes: {},
|
|
37
37
|
meta: {
|
|
38
38
|
schemaVersion: "1.0"
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
expect(() => dateQuestions_1.
|
|
41
|
+
expect(() => dateQuestions_1.DateQuestionSchema.parse(validDate)).not.toThrow();
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
describe("DateRangeQuestion", () => {
|
|
@@ -47,7 +47,7 @@ describe("DateRangeQuestion", () => {
|
|
|
47
47
|
type: "dateRange",
|
|
48
48
|
columns: {
|
|
49
49
|
start: {
|
|
50
|
-
type: "
|
|
50
|
+
type: "date",
|
|
51
51
|
attributes: {
|
|
52
52
|
label: "Start Date",
|
|
53
53
|
max: "2023-12-31",
|
|
@@ -59,7 +59,7 @@ describe("DateRangeQuestion", () => {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
end: {
|
|
62
|
-
type: "
|
|
62
|
+
type: "date",
|
|
63
63
|
attributes: {
|
|
64
64
|
label: "End Date",
|
|
65
65
|
max: "2023-12-31",
|
|
@@ -82,7 +82,7 @@ describe("DateRangeQuestion", () => {
|
|
|
82
82
|
type: "dateRange",
|
|
83
83
|
columns: {
|
|
84
84
|
start: {
|
|
85
|
-
type: "
|
|
85
|
+
type: "date",
|
|
86
86
|
attributes: {
|
|
87
87
|
label: "Start Date",
|
|
88
88
|
max: "2023-12-31",
|
|
@@ -94,7 +94,7 @@ describe("DateRangeQuestion", () => {
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
end: {
|
|
97
|
-
type: "
|
|
97
|
+
type: "date",
|
|
98
98
|
attributes: {
|
|
99
99
|
label: 123, // Invalid type for label
|
|
100
100
|
max: "2023-12-31",
|
|
@@ -112,12 +112,12 @@ describe("DateRangeQuestion", () => {
|
|
|
112
112
|
};
|
|
113
113
|
expect(() => dateQuestions_1.DateRangeQuestionSchema.parse(invalidDateRange)).toThrow();
|
|
114
114
|
});
|
|
115
|
-
it("should require labels for start and end
|
|
115
|
+
it("should require labels for start and end dates", () => {
|
|
116
116
|
const invalidDateRange = {
|
|
117
117
|
type: "dateRange",
|
|
118
118
|
columns: {
|
|
119
119
|
start: {
|
|
120
|
-
type: "
|
|
120
|
+
type: "date",
|
|
121
121
|
attributes: {
|
|
122
122
|
max: "2023-12-31",
|
|
123
123
|
min: "2023-01-01",
|
|
@@ -128,7 +128,7 @@ describe("DateRangeQuestion", () => {
|
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
end: {
|
|
131
|
-
type: "
|
|
131
|
+
type: "date",
|
|
132
132
|
attributes: {
|
|
133
133
|
label: "End Date",
|
|
134
134
|
max: "2023-12-31",
|
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const primitiveQuestions_1 = require("../primitiveQuestions");
|
|
4
4
|
describe("Primitive Questions Zod Schemas", () => {
|
|
5
|
+
it('optional fields should not throw an error if the value is undefined', () => {
|
|
6
|
+
const validBooleanQuestion = {
|
|
7
|
+
type: "boolean",
|
|
8
|
+
meta: {
|
|
9
|
+
schemaVersion: "1.0",
|
|
10
|
+
},
|
|
11
|
+
attributes: {
|
|
12
|
+
checked: undefined, // Valid value
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
expect(() => primitiveQuestions_1.BooleanQuestionSchema.parse(validBooleanQuestion)).not.toThrow();
|
|
16
|
+
});
|
|
17
|
+
it('optional fields should throw an error if the value is null', () => {
|
|
18
|
+
const invalidBooleanQuestion = {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
meta: {
|
|
21
|
+
schemaVersion: "1.0",
|
|
22
|
+
},
|
|
23
|
+
attributes: {
|
|
24
|
+
checked: null, // Invalid value
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
expect(() => primitiveQuestions_1.BooleanQuestionSchema.parse(invalidBooleanQuestion)).toThrow();
|
|
28
|
+
});
|
|
5
29
|
it("should validate a valid BooleanQuestion", () => {
|
|
6
30
|
const validBooleanQuestion = {
|
|
7
31
|
type: "boolean",
|
|
@@ -106,6 +130,74 @@ describe("Primitive Questions Zod Schemas", () => {
|
|
|
106
130
|
};
|
|
107
131
|
expect(() => primitiveQuestions_1.NumberQuestionSchema.parse(invalidNumberQuestion)).toThrow();
|
|
108
132
|
});
|
|
133
|
+
it("should validate a valid NumberRangeQuestion", () => {
|
|
134
|
+
const validNumberRangeQuestion = {
|
|
135
|
+
type: "numberRange",
|
|
136
|
+
meta: {
|
|
137
|
+
schemaVersion: "1.0",
|
|
138
|
+
},
|
|
139
|
+
columns: {
|
|
140
|
+
start: {
|
|
141
|
+
type: "number",
|
|
142
|
+
attributes: {
|
|
143
|
+
label: "Start",
|
|
144
|
+
min: 0,
|
|
145
|
+
max: 50,
|
|
146
|
+
step: 1,
|
|
147
|
+
},
|
|
148
|
+
meta: {
|
|
149
|
+
schemaVersion: "1.0",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
end: {
|
|
153
|
+
type: "number",
|
|
154
|
+
attributes: {
|
|
155
|
+
label: "End",
|
|
156
|
+
min: 50,
|
|
157
|
+
max: 100,
|
|
158
|
+
step: 1,
|
|
159
|
+
},
|
|
160
|
+
meta: {
|
|
161
|
+
schemaVersion: "1.0",
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
expect(() => primitiveQuestions_1.NumberRangeQuestionSchema.parse(validNumberRangeQuestion)).not.toThrow();
|
|
167
|
+
});
|
|
168
|
+
it("should invalidate an invalid NumberRangeQuestion", () => {
|
|
169
|
+
const invalidNumberRangeQuestion = {
|
|
170
|
+
type: "numberRange",
|
|
171
|
+
meta: {
|
|
172
|
+
schemaVersion: "1.0",
|
|
173
|
+
},
|
|
174
|
+
columns: {
|
|
175
|
+
start: {
|
|
176
|
+
type: "number",
|
|
177
|
+
attributes: {
|
|
178
|
+
min: 0,
|
|
179
|
+
max: 50,
|
|
180
|
+
},
|
|
181
|
+
meta: {
|
|
182
|
+
schemaVersion: "1.0",
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
end: {
|
|
186
|
+
type: "number",
|
|
187
|
+
attributes: {
|
|
188
|
+
label: "End",
|
|
189
|
+
min: 50,
|
|
190
|
+
max: 100,
|
|
191
|
+
step: 1,
|
|
192
|
+
},
|
|
193
|
+
meta: {
|
|
194
|
+
schemaVersion: "1.0",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
expect(() => primitiveQuestions_1.NumberRangeQuestionSchema.parse(invalidNumberRangeQuestion)).toThrow();
|
|
200
|
+
});
|
|
109
201
|
it("should validate a valid TextAreaQuestion", () => {
|
|
110
202
|
const validTextAreaQuestion = {
|
|
111
203
|
type: "textArea",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tableQuestions_1 = require("../tableQuestions");
|
|
4
|
+
describe("TableQuestionSchema", () => {
|
|
5
|
+
it("should validate a valid TableQuestion object", () => {
|
|
6
|
+
const validTableQuestion = {
|
|
7
|
+
type: "table",
|
|
8
|
+
columns: [
|
|
9
|
+
{
|
|
10
|
+
heading: "Name",
|
|
11
|
+
content: {
|
|
12
|
+
type: "text",
|
|
13
|
+
meta: {
|
|
14
|
+
schemaVersion: "1.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
heading: "Age",
|
|
20
|
+
content: {
|
|
21
|
+
type: "number",
|
|
22
|
+
attributes: {
|
|
23
|
+
min: 18,
|
|
24
|
+
max: 65,
|
|
25
|
+
step: 1,
|
|
26
|
+
},
|
|
27
|
+
meta: {
|
|
28
|
+
schemaVersion: "1.0"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
meta: {
|
|
34
|
+
schemaVersion: "1.0"
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
expect(() => tableQuestions_1.TableQuestionSchema.parse(validTableQuestion)).not.toThrow();
|
|
38
|
+
});
|
|
39
|
+
it("should throw an error for an invalid TableQuestion object", () => {
|
|
40
|
+
const invalidTableQuestion = {
|
|
41
|
+
type: "table",
|
|
42
|
+
columns: [
|
|
43
|
+
{
|
|
44
|
+
heading: "Name",
|
|
45
|
+
content: {
|
|
46
|
+
type: "text",
|
|
47
|
+
meta: {
|
|
48
|
+
schemaVersion: "1.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
heading: "Age",
|
|
54
|
+
content: {
|
|
55
|
+
type: "number",
|
|
56
|
+
attributes: {
|
|
57
|
+
min: '10', // Invalid value
|
|
58
|
+
max: 120,
|
|
59
|
+
step: 1,
|
|
60
|
+
},
|
|
61
|
+
meta: {
|
|
62
|
+
schemaVersion: "1.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
meta: {
|
|
68
|
+
schemaVersion: "1.0"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
expect(() => tableQuestions_1.TableQuestionSchema.parse(invalidTableQuestion)).toThrow();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const DateQuestionSchema: z.ZodObject<{
|
|
3
3
|
meta: z.ZodObject<{
|
|
4
4
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
5
5
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -11,7 +11,7 @@ export declare const DatePickerQuestionSchema: z.ZodObject<{
|
|
|
11
11
|
labelTranslationKey?: string | undefined;
|
|
12
12
|
}>;
|
|
13
13
|
} & {
|
|
14
|
-
type: z.ZodLiteral<"
|
|
14
|
+
type: z.ZodLiteral<"date">;
|
|
15
15
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
16
16
|
max: z.ZodOptional<z.ZodString>;
|
|
17
17
|
min: z.ZodOptional<z.ZodString>;
|
|
@@ -26,7 +26,7 @@ export declare const DatePickerQuestionSchema: z.ZodObject<{
|
|
|
26
26
|
step?: number | undefined;
|
|
27
27
|
}>>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
type: "
|
|
29
|
+
type: "date";
|
|
30
30
|
meta: {
|
|
31
31
|
schemaVersion: "1.0";
|
|
32
32
|
labelTranslationKey?: string | undefined;
|
|
@@ -37,7 +37,7 @@ export declare const DatePickerQuestionSchema: z.ZodObject<{
|
|
|
37
37
|
step?: number | undefined;
|
|
38
38
|
} | undefined;
|
|
39
39
|
}, {
|
|
40
|
-
type: "
|
|
40
|
+
type: "date";
|
|
41
41
|
meta: {
|
|
42
42
|
schemaVersion: "1.0";
|
|
43
43
|
labelTranslationKey?: string | undefined;
|
|
@@ -73,7 +73,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
73
73
|
schemaVersion: "1.0";
|
|
74
74
|
labelTranslationKey?: string | undefined;
|
|
75
75
|
}>;
|
|
76
|
-
type: z.ZodLiteral<"
|
|
76
|
+
type: z.ZodLiteral<"date">;
|
|
77
77
|
} & {
|
|
78
78
|
attributes: z.ZodObject<{
|
|
79
79
|
label: z.ZodString;
|
|
@@ -83,7 +83,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
83
83
|
label: string;
|
|
84
84
|
}>;
|
|
85
85
|
}, "strip", z.ZodTypeAny, {
|
|
86
|
-
type: "
|
|
86
|
+
type: "date";
|
|
87
87
|
meta: {
|
|
88
88
|
schemaVersion: "1.0";
|
|
89
89
|
labelTranslationKey?: string | undefined;
|
|
@@ -92,7 +92,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
92
92
|
label: string;
|
|
93
93
|
};
|
|
94
94
|
}, {
|
|
95
|
-
type: "
|
|
95
|
+
type: "date";
|
|
96
96
|
meta: {
|
|
97
97
|
schemaVersion: "1.0";
|
|
98
98
|
labelTranslationKey?: string | undefined;
|
|
@@ -112,7 +112,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
112
112
|
schemaVersion: "1.0";
|
|
113
113
|
labelTranslationKey?: string | undefined;
|
|
114
114
|
}>;
|
|
115
|
-
type: z.ZodLiteral<"
|
|
115
|
+
type: z.ZodLiteral<"date">;
|
|
116
116
|
} & {
|
|
117
117
|
attributes: z.ZodObject<{
|
|
118
118
|
label: z.ZodString;
|
|
@@ -122,7 +122,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
122
122
|
label: string;
|
|
123
123
|
}>;
|
|
124
124
|
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
type: "
|
|
125
|
+
type: "date";
|
|
126
126
|
meta: {
|
|
127
127
|
schemaVersion: "1.0";
|
|
128
128
|
labelTranslationKey?: string | undefined;
|
|
@@ -131,7 +131,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
131
131
|
label: string;
|
|
132
132
|
};
|
|
133
133
|
}, {
|
|
134
|
-
type: "
|
|
134
|
+
type: "date";
|
|
135
135
|
meta: {
|
|
136
136
|
schemaVersion: "1.0";
|
|
137
137
|
labelTranslationKey?: string | undefined;
|
|
@@ -142,7 +142,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
142
142
|
}>;
|
|
143
143
|
}, "strip", z.ZodTypeAny, {
|
|
144
144
|
start: {
|
|
145
|
-
type: "
|
|
145
|
+
type: "date";
|
|
146
146
|
meta: {
|
|
147
147
|
schemaVersion: "1.0";
|
|
148
148
|
labelTranslationKey?: string | undefined;
|
|
@@ -152,7 +152,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
end: {
|
|
155
|
-
type: "
|
|
155
|
+
type: "date";
|
|
156
156
|
meta: {
|
|
157
157
|
schemaVersion: "1.0";
|
|
158
158
|
labelTranslationKey?: string | undefined;
|
|
@@ -163,7 +163,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
163
163
|
};
|
|
164
164
|
}, {
|
|
165
165
|
start: {
|
|
166
|
-
type: "
|
|
166
|
+
type: "date";
|
|
167
167
|
meta: {
|
|
168
168
|
schemaVersion: "1.0";
|
|
169
169
|
labelTranslationKey?: string | undefined;
|
|
@@ -173,7 +173,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
end: {
|
|
176
|
-
type: "
|
|
176
|
+
type: "date";
|
|
177
177
|
meta: {
|
|
178
178
|
schemaVersion: "1.0";
|
|
179
179
|
labelTranslationKey?: string | undefined;
|
|
@@ -191,7 +191,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
191
191
|
};
|
|
192
192
|
columns: {
|
|
193
193
|
start: {
|
|
194
|
-
type: "
|
|
194
|
+
type: "date";
|
|
195
195
|
meta: {
|
|
196
196
|
schemaVersion: "1.0";
|
|
197
197
|
labelTranslationKey?: string | undefined;
|
|
@@ -201,7 +201,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
203
|
end: {
|
|
204
|
-
type: "
|
|
204
|
+
type: "date";
|
|
205
205
|
meta: {
|
|
206
206
|
schemaVersion: "1.0";
|
|
207
207
|
labelTranslationKey?: string | undefined;
|
|
@@ -219,7 +219,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
219
219
|
};
|
|
220
220
|
columns: {
|
|
221
221
|
start: {
|
|
222
|
-
type: "
|
|
222
|
+
type: "date";
|
|
223
223
|
meta: {
|
|
224
224
|
schemaVersion: "1.0";
|
|
225
225
|
labelTranslationKey?: string | undefined;
|
|
@@ -229,7 +229,7 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
229
229
|
};
|
|
230
230
|
};
|
|
231
231
|
end: {
|
|
232
|
-
type: "
|
|
232
|
+
type: "date";
|
|
233
233
|
meta: {
|
|
234
234
|
schemaVersion: "1.0";
|
|
235
235
|
labelTranslationKey?: string | undefined;
|
|
@@ -240,5 +240,5 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
240
240
|
};
|
|
241
241
|
};
|
|
242
242
|
}>;
|
|
243
|
-
export type
|
|
243
|
+
export type DateQuestionType = z.infer<typeof DateQuestionSchema>;
|
|
244
244
|
export type DateRangeQuestionType = z.infer<typeof DateRangeQuestionSchema>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateRangeQuestionSchema = exports.
|
|
3
|
+
exports.DateRangeQuestionSchema = exports.DateQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
|
-
// Date
|
|
7
|
-
exports.
|
|
8
|
-
type: zod_1.z.literal('
|
|
6
|
+
// Date question and answer
|
|
7
|
+
exports.DateQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
8
|
+
type: zod_1.z.literal('date'), // The type of question
|
|
9
9
|
attributes: zod_1.z.object({
|
|
10
10
|
max: zod_1.z.string().optional(), // The maximum date (no default)
|
|
11
11
|
min: zod_1.z.string().optional(), // The minimum date (no default)
|
|
@@ -16,14 +16,14 @@ exports.DatePickerQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.objec
|
|
|
16
16
|
exports.DateRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
17
17
|
type: zod_1.z.literal('dateRange'), // The type of question
|
|
18
18
|
columns: zod_1.z.object({
|
|
19
|
-
start: exports.
|
|
19
|
+
start: exports.DateQuestionSchema.merge(zod_1.z.object({
|
|
20
20
|
attributes: zod_1.z.object({
|
|
21
|
-
label: zod_1.z.string() // The label for the start date
|
|
21
|
+
label: zod_1.z.string() // The label for the start date
|
|
22
22
|
})
|
|
23
23
|
})),
|
|
24
|
-
end: exports.
|
|
24
|
+
end: exports.DateQuestionSchema.merge(zod_1.z.object({
|
|
25
25
|
attributes: zod_1.z.object({
|
|
26
|
-
label: zod_1.z.string() // The label for the end date
|
|
26
|
+
label: zod_1.z.string() // The label for the end date
|
|
27
27
|
})
|
|
28
28
|
}))
|
|
29
29
|
})
|
|
@@ -40,15 +40,15 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
40
40
|
type: string;
|
|
41
41
|
name: string;
|
|
42
42
|
labelTranslationKey?: string | undefined;
|
|
43
|
-
minLength?: number | undefined;
|
|
44
43
|
label?: string | undefined;
|
|
44
|
+
minLength?: number | undefined;
|
|
45
45
|
defaultValue?: string | undefined;
|
|
46
46
|
}, {
|
|
47
47
|
type: string;
|
|
48
48
|
name: string;
|
|
49
49
|
labelTranslationKey?: string | undefined;
|
|
50
|
-
minLength?: number | undefined;
|
|
51
50
|
label?: string | undefined;
|
|
51
|
+
minLength?: number | undefined;
|
|
52
52
|
defaultValue?: string | undefined;
|
|
53
53
|
}>, "many">>;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -64,8 +64,8 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
64
64
|
type: string;
|
|
65
65
|
name: string;
|
|
66
66
|
labelTranslationKey?: string | undefined;
|
|
67
|
-
minLength?: number | undefined;
|
|
68
67
|
label?: string | undefined;
|
|
68
|
+
minLength?: number | undefined;
|
|
69
69
|
defaultValue?: string | undefined;
|
|
70
70
|
}[] | undefined;
|
|
71
71
|
}, {
|
|
@@ -81,27 +81,24 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
81
81
|
type: string;
|
|
82
82
|
name: string;
|
|
83
83
|
labelTranslationKey?: string | undefined;
|
|
84
|
-
minLength?: number | undefined;
|
|
85
84
|
label?: string | undefined;
|
|
85
|
+
minLength?: number | undefined;
|
|
86
86
|
defaultValue?: string | undefined;
|
|
87
87
|
}[] | undefined;
|
|
88
88
|
}>;
|
|
89
|
-
attributes: z.ZodObject<{
|
|
89
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
90
90
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
91
91
|
}, "strip", z.ZodTypeAny, {
|
|
92
92
|
multiple?: boolean | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
multiple?: boolean | undefined;
|
|
95
|
-
}
|
|
95
|
+
}>>;
|
|
96
96
|
}, "strip", z.ZodTypeAny, {
|
|
97
97
|
type: "filteredSearch";
|
|
98
98
|
meta: {
|
|
99
99
|
schemaVersion: "1.0";
|
|
100
100
|
labelTranslationKey?: string | undefined;
|
|
101
101
|
};
|
|
102
|
-
attributes: {
|
|
103
|
-
multiple?: boolean | undefined;
|
|
104
|
-
};
|
|
105
102
|
graphQL: {
|
|
106
103
|
displayFields: {
|
|
107
104
|
label: string;
|
|
@@ -115,20 +112,20 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
115
112
|
type: string;
|
|
116
113
|
name: string;
|
|
117
114
|
labelTranslationKey?: string | undefined;
|
|
118
|
-
minLength?: number | undefined;
|
|
119
115
|
label?: string | undefined;
|
|
116
|
+
minLength?: number | undefined;
|
|
120
117
|
defaultValue?: string | undefined;
|
|
121
118
|
}[] | undefined;
|
|
122
119
|
};
|
|
120
|
+
attributes?: {
|
|
121
|
+
multiple?: boolean | undefined;
|
|
122
|
+
} | undefined;
|
|
123
123
|
}, {
|
|
124
124
|
type: "filteredSearch";
|
|
125
125
|
meta: {
|
|
126
126
|
schemaVersion: "1.0";
|
|
127
127
|
labelTranslationKey?: string | undefined;
|
|
128
128
|
};
|
|
129
|
-
attributes: {
|
|
130
|
-
multiple?: boolean | undefined;
|
|
131
|
-
};
|
|
132
129
|
graphQL: {
|
|
133
130
|
displayFields: {
|
|
134
131
|
label: string;
|
|
@@ -142,11 +139,14 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
142
139
|
type: string;
|
|
143
140
|
name: string;
|
|
144
141
|
labelTranslationKey?: string | undefined;
|
|
145
|
-
minLength?: number | undefined;
|
|
146
142
|
label?: string | undefined;
|
|
143
|
+
minLength?: number | undefined;
|
|
147
144
|
defaultValue?: string | undefined;
|
|
148
145
|
}[] | undefined;
|
|
149
146
|
};
|
|
147
|
+
attributes?: {
|
|
148
|
+
multiple?: boolean | undefined;
|
|
149
|
+
} | undefined;
|
|
150
150
|
}>;
|
|
151
151
|
export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
152
152
|
meta: z.ZodObject<{
|
|
@@ -189,15 +189,15 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
189
189
|
type: string;
|
|
190
190
|
name: string;
|
|
191
191
|
labelTranslationKey?: string | undefined;
|
|
192
|
-
minLength?: number | undefined;
|
|
193
192
|
label?: string | undefined;
|
|
193
|
+
minLength?: number | undefined;
|
|
194
194
|
defaultValue?: string | undefined;
|
|
195
195
|
}, {
|
|
196
196
|
type: string;
|
|
197
197
|
name: string;
|
|
198
198
|
labelTranslationKey?: string | undefined;
|
|
199
|
-
minLength?: number | undefined;
|
|
200
199
|
label?: string | undefined;
|
|
200
|
+
minLength?: number | undefined;
|
|
201
201
|
defaultValue?: string | undefined;
|
|
202
202
|
}>, "many">>;
|
|
203
203
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -213,8 +213,8 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
213
213
|
type: string;
|
|
214
214
|
name: string;
|
|
215
215
|
labelTranslationKey?: string | undefined;
|
|
216
|
-
minLength?: number | undefined;
|
|
217
216
|
label?: string | undefined;
|
|
217
|
+
minLength?: number | undefined;
|
|
218
218
|
defaultValue?: string | undefined;
|
|
219
219
|
}[] | undefined;
|
|
220
220
|
}, {
|
|
@@ -230,8 +230,8 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
230
230
|
type: string;
|
|
231
231
|
name: string;
|
|
232
232
|
labelTranslationKey?: string | undefined;
|
|
233
|
-
minLength?: number | undefined;
|
|
234
233
|
label?: string | undefined;
|
|
234
|
+
minLength?: number | undefined;
|
|
235
235
|
defaultValue?: string | undefined;
|
|
236
236
|
}[] | undefined;
|
|
237
237
|
}>;
|
|
@@ -254,8 +254,8 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
254
254
|
type: string;
|
|
255
255
|
name: string;
|
|
256
256
|
labelTranslationKey?: string | undefined;
|
|
257
|
-
minLength?: number | undefined;
|
|
258
257
|
label?: string | undefined;
|
|
258
|
+
minLength?: number | undefined;
|
|
259
259
|
defaultValue?: string | undefined;
|
|
260
260
|
}[] | undefined;
|
|
261
261
|
};
|
|
@@ -278,8 +278,8 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
278
278
|
type: string;
|
|
279
279
|
name: string;
|
|
280
280
|
labelTranslationKey?: string | undefined;
|
|
281
|
-
minLength?: number | undefined;
|
|
282
281
|
label?: string | undefined;
|
|
282
|
+
minLength?: number | undefined;
|
|
283
283
|
defaultValue?: string | undefined;
|
|
284
284
|
}[] | undefined;
|
|
285
285
|
};
|