@dmptool/types 2.1.0 → 2.2.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 +70 -1
- package/dist/answers/__tests__/defaults.spec.js +80 -21
- package/dist/answers/answer.d.ts +2 -0
- package/dist/answers/answer.js +4 -2
- package/dist/answers/dateAnswers.d.ts +4 -0
- package/dist/answers/graphQLAnswers.d.ts +8 -0
- package/dist/answers/index.d.ts +37 -0
- package/dist/answers/numberAnswers.d.ts +8 -0
- package/dist/answers/optionBasedAnswers.d.ts +10 -0
- package/dist/answers/tableAnswers.d.ts +94 -0
- package/dist/answers/textAnswers.d.ts +8 -0
- package/dist/dmp/extension.d.ts +111 -0
- package/dist/dmp/index.js +48 -2
- package/dist/questions/__tests__/defaults.spec.js +12 -12
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +25 -16
- package/dist/questions/dateQuestions.d.ts +4 -0
- package/dist/questions/dateQuestions.js +2 -2
- package/dist/questions/index.d.ts +38 -7
- package/dist/questions/numberQuestions.d.ts +8 -0
- package/dist/questions/numberQuestions.js +4 -4
- package/dist/questions/optionBasedQuestions.d.ts +18 -6
- package/dist/questions/optionBasedQuestions.js +23 -10
- package/dist/questions/tableQuestions.d.ts +94 -16
- package/dist/questions/tableQuestions.js +9 -9
- package/dist/questions/textQuestions.d.ts +4 -0
- package/dist/questions/textQuestions.js +2 -2
- package/dist/schemas/affiliationSearchAnswer.schema.json +3 -0
- package/dist/schemas/anyAnswer.schema.json +111 -0
- package/dist/schemas/anyQuestion.schema.json +114 -35
- package/dist/schemas/anyTableColumnAnswer.schema.json +54 -0
- package/dist/schemas/anyTableColumnQuestion.schema.json +42 -10
- package/dist/schemas/booleanAnswer.schema.json +3 -0
- package/dist/schemas/booleanQuestion.schema.json +3 -0
- package/dist/schemas/checkboxesAnswer.schema.json +3 -0
- package/dist/schemas/checkboxesQuestion.schema.json +6 -0
- package/dist/schemas/currencyAnswer.schema.json +3 -0
- package/dist/schemas/currencyQuestion.schema.json +3 -0
- package/dist/schemas/dateAnswer.schema.json +3 -0
- package/dist/schemas/dateQuestion.schema.json +3 -0
- package/dist/schemas/dateRangeAnswer.schema.json +3 -0
- package/dist/schemas/dateRangeQuestion.schema.json +3 -0
- package/dist/schemas/dmpExtension.schema.json +111 -0
- package/dist/schemas/emailAnswer.schema.json +3 -0
- package/dist/schemas/emailQuestion.schema.json +3 -0
- package/dist/schemas/licenseSearchAnswer.schema.json +3 -0
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +3 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +3 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +6 -5
- package/dist/schemas/numberAnswer.schema.json +3 -0
- package/dist/schemas/numberQuestion.schema.json +3 -0
- package/dist/schemas/numberRangeAnswer.schema.json +3 -0
- package/dist/schemas/numberRangeQuestion.schema.json +3 -0
- package/dist/schemas/numberWithContextAnswer.schema.json +3 -0
- package/dist/schemas/numberWithContextQuestion.schema.json +3 -0
- package/dist/schemas/radioButtonsAnswer.schema.json +3 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +6 -5
- package/dist/schemas/repositorySearchAnswer.schema.json +3 -0
- package/dist/schemas/researchOutputTableAnswer.schema.json +3344 -9
- package/dist/schemas/selectBoxAnswer.schema.json +3 -0
- package/dist/schemas/selectBoxQuestion.schema.json +6 -5
- package/dist/schemas/tableAnswer.schema.json +57 -0
- package/dist/schemas/tableQuestion.schema.json +42 -10
- package/dist/schemas/textAnswer.schema.json +3 -0
- package/dist/schemas/textAreaAnswer.schema.json +3 -0
- package/dist/schemas/urlAnswer.schema.json +3 -0
- package/dist/schemas/urlQuestion.schema.json +3 -0
- package/package.json +9 -4
- package/schemas/.placeholder +0 -0
- package/schemas/affiliationSearchAnswer.schema.json +50 -0
- package/schemas/affiliationSearchQuestion.schema.json +142 -0
- package/schemas/anyAnswer.schema.json +1537 -0
- package/schemas/anyQuestion.schema.json +4823 -0
- package/schemas/anyTableColumnAnswer.schema.json +741 -0
- package/schemas/anyTableColumnQuestion.schema.json +1559 -0
- package/schemas/booleanAnswer.schema.json +36 -0
- package/schemas/booleanQuestion.schema.json +55 -0
- package/schemas/checkboxesAnswer.schema.json +41 -0
- package/schemas/checkboxesQuestion.schema.json +83 -0
- package/schemas/currencyAnswer.schema.json +36 -0
- package/schemas/currencyQuestion.schema.json +73 -0
- package/schemas/dateAnswer.schema.json +36 -0
- package/schemas/datePickerAnswer.schema.json +37 -0
- package/schemas/datePickerQuestion.schema.json +52 -0
- package/schemas/dateQuestion.schema.json +66 -0
- package/schemas/dateRangeAnswer.schema.json +50 -0
- package/schemas/dateRangeQuestion.schema.json +124 -0
- package/schemas/dmp.schema.json +2070 -0
- package/schemas/dmpExtension.schema.json +1985 -0
- package/schemas/emailAnswer.schema.json +36 -0
- package/schemas/emailQuestion.schema.json +71 -0
- package/schemas/filteredSearchAnswer.schema.json +40 -0
- package/schemas/filteredSearchQuestion.schema.json +130 -0
- package/schemas/licenseSearchAnswer.schema.json +54 -0
- package/schemas/licenseSearchQuestion.schema.json +140 -0
- package/schemas/metadataStandardSearchAnswer.schema.json +54 -0
- package/schemas/metadataStandardSearchQuestion.schema.json +141 -0
- package/schemas/multiselectBoxAnswer.schema.json +41 -0
- package/schemas/multiselectBoxQuestion.schema.json +85 -0
- package/schemas/numberAnswer.schema.json +36 -0
- package/schemas/numberQuestion.schema.json +68 -0
- package/schemas/numberRangeAnswer.schema.json +50 -0
- package/schemas/numberRangeQuestion.schema.json +128 -0
- package/schemas/numberWithContextAnswer.schema.json +50 -0
- package/schemas/numberWithContextQuestion.schema.json +98 -0
- package/schemas/radioButtonsAnswer.schema.json +36 -0
- package/schemas/radioButtonsQuestion.schema.json +78 -0
- package/schemas/repositorySearchAnswer.schema.json +54 -0
- package/schemas/repositorySearchQuestion.schema.json +140 -0
- package/schemas/researchOutputTableAnswer.schema.json +20065 -0
- package/schemas/researchOutputTableQuestion.schema.json +140 -0
- package/schemas/selectBoxAnswer.schema.json +36 -0
- package/schemas/selectBoxQuestion.schema.json +85 -0
- package/schemas/tableAnswer.schema.json +797 -0
- package/schemas/tableQuestion.schema.json +1661 -0
- package/schemas/textAnswer.schema.json +36 -0
- package/schemas/textAreaAnswer.schema.json +36 -0
- package/schemas/textAreaQuestion.schema.json +78 -0
- package/schemas/textQuestion.schema.json +63 -0
- package/schemas/typeaheadSearchAnswer.schema.json +37 -0
- package/schemas/typeaheadSearchQuestion.schema.json +120 -0
- package/schemas/urlAnswer.schema.json +36 -0
- package/schemas/urlQuestion.schema.json +66 -0
|
@@ -6,13 +6,13 @@ const question_1 = require("./question");
|
|
|
6
6
|
const NumberAttributesSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { max: zod_1.z.number().optional(), min: zod_1.z.number().default(0), step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
|
|
7
7
|
}));
|
|
8
8
|
const DefaultNumberAttributes = NumberAttributesSchema.parse({});
|
|
9
|
-
exports.CurrencyQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('currency'), attributes: zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), { denomination: zod_1.z.string().default('USD') })) }));
|
|
9
|
+
exports.CurrencyQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('currency'), attributes: zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), { denomination: zod_1.z.string().default('USD') })), showCommentField: zod_1.z.boolean().optional() }));
|
|
10
10
|
exports.DefaultCurrencyQuestion = exports.CurrencyQuestionSchema.parse({
|
|
11
11
|
type: 'currency',
|
|
12
12
|
attributes: DefaultNumberAttributes,
|
|
13
13
|
meta: question_1.DefaultMeta
|
|
14
14
|
});
|
|
15
|
-
exports.NumberQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('number'), attributes: NumberAttributesSchema }));
|
|
15
|
+
exports.NumberQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('number'), attributes: NumberAttributesSchema, showCommentField: zod_1.z.boolean().optional() }));
|
|
16
16
|
exports.DefaultNumberQuestion = exports.NumberQuestionSchema.parse({
|
|
17
17
|
type: 'number',
|
|
18
18
|
attributes: DefaultNumberAttributes,
|
|
@@ -23,7 +23,7 @@ const NumberRangeEndColumnSchema = zod_1.z.object(Object.assign(Object.assign({}
|
|
|
23
23
|
exports.NumberRangeQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('numberRange'), columns: zod_1.z.object({
|
|
24
24
|
start: NumberRangeStartColumnSchema,
|
|
25
25
|
end: NumberRangeEndColumnSchema
|
|
26
|
-
}) }));
|
|
26
|
+
}), showCommentField: zod_1.z.boolean().optional() }));
|
|
27
27
|
exports.DefaultNumberRangeQuestion = exports.NumberRangeQuestionSchema.parse({
|
|
28
28
|
type: 'numberRange',
|
|
29
29
|
attributes: question_1.BaseAttributesSchema.parse({}),
|
|
@@ -42,7 +42,7 @@ const NumberWithContextAttributesSchema = zod_1.z.object(Object.assign(Object.as
|
|
|
42
42
|
selected: zod_1.z.boolean().default(false)
|
|
43
43
|
})) }));
|
|
44
44
|
const DefaultNumberWithContextAttributes = NumberWithContextAttributesSchema.parse(Object.assign(Object.assign({}, exports.DefaultNumberQuestion.attributes), { context: [] }));
|
|
45
|
-
exports.NumberWithContextQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('numberWithContext'), attributes: NumberWithContextAttributesSchema }));
|
|
45
|
+
exports.NumberWithContextQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('numberWithContext'), attributes: NumberWithContextAttributesSchema, showCommentField: zod_1.z.boolean().optional() }));
|
|
46
46
|
exports.DefaultNumberWithContextQuestion = exports.NumberWithContextQuestionSchema.parse({
|
|
47
47
|
type: 'numberWithContext',
|
|
48
48
|
attributes: DefaultNumberWithContextAttributes,
|
|
@@ -5,6 +5,7 @@ export declare const BooleanQuestionSchema: z.ZodObject<{
|
|
|
5
5
|
label: z.ZodString;
|
|
6
6
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
}, z.core.$strip>;
|
|
8
|
+
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
8
9
|
meta: z.ZodObject<{
|
|
9
10
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
10
11
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -22,6 +23,7 @@ export declare const DefaultBooleanQuestion: {
|
|
|
22
23
|
title?: string | undefined;
|
|
23
24
|
usageDescription?: string | undefined;
|
|
24
25
|
};
|
|
26
|
+
showCommentField?: boolean | undefined;
|
|
25
27
|
};
|
|
26
28
|
export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
27
29
|
type: z.ZodLiteral<"checkBoxes">;
|
|
@@ -29,7 +31,9 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
|
29
31
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
30
32
|
label: z.ZodDefault<z.ZodString>;
|
|
31
33
|
value: z.ZodDefault<z.ZodString>;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
32
35
|
}, z.core.$strip>>;
|
|
36
|
+
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
33
37
|
attributes: z.ZodObject<{
|
|
34
38
|
label: z.ZodOptional<z.ZodString>;
|
|
35
39
|
help: z.ZodOptional<z.ZodString>;
|
|
@@ -47,6 +51,7 @@ export declare const DefaultCheckboxesQuestion: {
|
|
|
47
51
|
checked: boolean;
|
|
48
52
|
label: string;
|
|
49
53
|
value: string;
|
|
54
|
+
description?: string | undefined;
|
|
50
55
|
}[];
|
|
51
56
|
attributes: {
|
|
52
57
|
label?: string | undefined;
|
|
@@ -58,14 +63,16 @@ export declare const DefaultCheckboxesQuestion: {
|
|
|
58
63
|
title?: string | undefined;
|
|
59
64
|
usageDescription?: string | undefined;
|
|
60
65
|
};
|
|
66
|
+
showCommentField?: boolean | undefined;
|
|
61
67
|
};
|
|
62
68
|
export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
63
69
|
type: z.ZodLiteral<"radioButtons">;
|
|
64
70
|
options: z.ZodArray<z.ZodObject<{
|
|
65
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
66
71
|
label: z.ZodDefault<z.ZodString>;
|
|
67
72
|
value: z.ZodDefault<z.ZodString>;
|
|
73
|
+
description: z.ZodOptional<z.ZodString>;
|
|
68
74
|
}, z.core.$strip>>;
|
|
75
|
+
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
69
76
|
attributes: z.ZodObject<{
|
|
70
77
|
label: z.ZodOptional<z.ZodString>;
|
|
71
78
|
help: z.ZodOptional<z.ZodString>;
|
|
@@ -80,9 +87,9 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
80
87
|
export declare const DefaultRadioButtonsQuestion: {
|
|
81
88
|
type: "radioButtons";
|
|
82
89
|
options: {
|
|
83
|
-
selected: boolean;
|
|
84
90
|
label: string;
|
|
85
91
|
value: string;
|
|
92
|
+
description?: string | undefined;
|
|
86
93
|
}[];
|
|
87
94
|
attributes: {
|
|
88
95
|
label?: string | undefined;
|
|
@@ -94,13 +101,14 @@ export declare const DefaultRadioButtonsQuestion: {
|
|
|
94
101
|
title?: string | undefined;
|
|
95
102
|
usageDescription?: string | undefined;
|
|
96
103
|
};
|
|
104
|
+
showCommentField?: boolean | undefined;
|
|
97
105
|
};
|
|
98
106
|
export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
99
107
|
type: z.ZodLiteral<"selectBox">;
|
|
100
108
|
options: z.ZodArray<z.ZodObject<{
|
|
101
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
102
109
|
label: z.ZodDefault<z.ZodString>;
|
|
103
110
|
value: z.ZodDefault<z.ZodString>;
|
|
111
|
+
description: z.ZodOptional<z.ZodString>;
|
|
104
112
|
}, z.core.$strip>>;
|
|
105
113
|
attributes: z.ZodObject<{
|
|
106
114
|
multiple: z.ZodLiteral<false>;
|
|
@@ -108,6 +116,7 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
108
116
|
help: z.ZodOptional<z.ZodString>;
|
|
109
117
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
110
118
|
}, z.core.$strip>;
|
|
119
|
+
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
111
120
|
meta: z.ZodObject<{
|
|
112
121
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
113
122
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -117,9 +126,9 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
117
126
|
export declare const DefaultSelectBoxQuestion: {
|
|
118
127
|
type: "selectBox";
|
|
119
128
|
options: {
|
|
120
|
-
selected: boolean;
|
|
121
129
|
label: string;
|
|
122
130
|
value: string;
|
|
131
|
+
description?: string | undefined;
|
|
123
132
|
}[];
|
|
124
133
|
attributes: {
|
|
125
134
|
multiple: false;
|
|
@@ -132,13 +141,14 @@ export declare const DefaultSelectBoxQuestion: {
|
|
|
132
141
|
title?: string | undefined;
|
|
133
142
|
usageDescription?: string | undefined;
|
|
134
143
|
};
|
|
144
|
+
showCommentField?: boolean | undefined;
|
|
135
145
|
};
|
|
136
146
|
export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
137
147
|
type: z.ZodLiteral<"multiselectBox">;
|
|
138
148
|
options: z.ZodArray<z.ZodObject<{
|
|
139
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
140
149
|
label: z.ZodDefault<z.ZodString>;
|
|
141
150
|
value: z.ZodDefault<z.ZodString>;
|
|
151
|
+
description: z.ZodOptional<z.ZodString>;
|
|
142
152
|
}, z.core.$strip>>;
|
|
143
153
|
attributes: z.ZodObject<{
|
|
144
154
|
multiple: z.ZodLiteral<true>;
|
|
@@ -146,6 +156,7 @@ export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
|
146
156
|
help: z.ZodOptional<z.ZodString>;
|
|
147
157
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
148
158
|
}, z.core.$strip>;
|
|
159
|
+
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
149
160
|
meta: z.ZodObject<{
|
|
150
161
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
151
162
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -155,9 +166,9 @@ export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
|
155
166
|
export declare const DefaultMultiselectBoxQuestion: {
|
|
156
167
|
type: "multiselectBox";
|
|
157
168
|
options: {
|
|
158
|
-
selected: boolean;
|
|
159
169
|
label: string;
|
|
160
170
|
value: string;
|
|
171
|
+
description?: string | undefined;
|
|
161
172
|
}[];
|
|
162
173
|
attributes: {
|
|
163
174
|
multiple: true;
|
|
@@ -170,6 +181,7 @@ export declare const DefaultMultiselectBoxQuestion: {
|
|
|
170
181
|
title?: string | undefined;
|
|
171
182
|
usageDescription?: string | undefined;
|
|
172
183
|
};
|
|
184
|
+
showCommentField?: boolean | undefined;
|
|
173
185
|
};
|
|
174
186
|
export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
|
|
175
187
|
export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
|
|
@@ -4,14 +4,21 @@ exports.MultiselectBoxQuestionJSONSchema = exports.SelectBoxQuestionJSONSchema =
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
// A select box, radio buttons, or checkboxes option
|
|
7
|
+
// NOTE: Question option shapes are intentionally minimal: they describe the configurable
|
|
8
|
+
// properties of each option (label, value, description). We deliberately do NOT include
|
|
9
|
+
// answer-state flags such as `selected` on question definitions because those represent
|
|
10
|
+
// user response state and belong in answer objects/schemas (not in the question configuration).
|
|
11
|
+
// For checkboxes we include a `checked` default on the question option to allow a configured
|
|
12
|
+
// default checked state. Radio/select/multiselect questions should not contain `selected`;
|
|
13
|
+
// user selections are captured by the answer schemas.
|
|
7
14
|
const OptionSchema = zod_1.z.object({
|
|
8
15
|
label: zod_1.z.string().default('Option A'),
|
|
9
16
|
value: zod_1.z.string().default('a'),
|
|
17
|
+
description: zod_1.z.string().optional(),
|
|
10
18
|
});
|
|
19
|
+
const DefaultOption = OptionSchema.parse({});
|
|
11
20
|
const CheckedOptionSchema = zod_1.z.object(Object.assign(Object.assign({}, OptionSchema.shape), { checked: zod_1.z.boolean().default(false) }));
|
|
12
21
|
const DefaultCheckedOption = CheckedOptionSchema.parse({});
|
|
13
|
-
const SelectedOptionSchema = zod_1.z.object(Object.assign(Object.assign({}, OptionSchema.shape), { selected: zod_1.z.boolean().default(false) }));
|
|
14
|
-
const DefaultSelectedOption = SelectedOptionSchema.parse({});
|
|
15
22
|
const selectBoxAttributes = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { multiple: zod_1.z.literal(false) }));
|
|
16
23
|
const DefaultSelectBoxAttributes = selectBoxAttributes.parse({
|
|
17
24
|
multiple: false
|
|
@@ -20,7 +27,7 @@ const DefaultSelectBoxAttributes = selectBoxAttributes.parse({
|
|
|
20
27
|
exports.BooleanQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('boolean'), attributes: zod_1.z.object({
|
|
21
28
|
label: zod_1.z.string(),
|
|
22
29
|
value: zod_1.z.boolean().default(false),
|
|
23
|
-
}) }));
|
|
30
|
+
}), showCommentField: zod_1.z.boolean().optional() }));
|
|
24
31
|
exports.DefaultBooleanQuestion = exports.BooleanQuestionSchema.parse({
|
|
25
32
|
type: 'boolean',
|
|
26
33
|
attributes: {
|
|
@@ -30,7 +37,7 @@ exports.DefaultBooleanQuestion = exports.BooleanQuestionSchema.parse({
|
|
|
30
37
|
meta: question_1.DefaultMeta
|
|
31
38
|
});
|
|
32
39
|
// Check boxes question and answer
|
|
33
|
-
exports.CheckboxesQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('checkBoxes'), options: zod_1.z.array(CheckedOptionSchema) }));
|
|
40
|
+
exports.CheckboxesQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('checkBoxes'), options: zod_1.z.array(CheckedOptionSchema), showCommentField: zod_1.z.boolean().optional() }));
|
|
34
41
|
exports.DefaultCheckboxesQuestion = exports.CheckboxesQuestionSchema.parse({
|
|
35
42
|
type: 'checkBoxes',
|
|
36
43
|
attributes: CheckedOptionSchema,
|
|
@@ -38,32 +45,38 @@ exports.DefaultCheckboxesQuestion = exports.CheckboxesQuestionSchema.parse({
|
|
|
38
45
|
options: [DefaultCheckedOption]
|
|
39
46
|
});
|
|
40
47
|
// Radio buttons question and answer
|
|
41
|
-
exports.RadioButtonsQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('radioButtons'),
|
|
48
|
+
exports.RadioButtonsQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('radioButtons'),
|
|
49
|
+
// Questions should not include the `selected` flag on options
|
|
50
|
+
options: zod_1.z.array(OptionSchema), showCommentField: zod_1.z.boolean().optional() }));
|
|
42
51
|
exports.DefaultRadioButtonsQuestion = exports.RadioButtonsQuestionSchema.parse({
|
|
43
52
|
type: 'radioButtons',
|
|
44
53
|
attributes: DefaultSelectBoxAttributes,
|
|
45
54
|
meta: question_1.DefaultMeta,
|
|
46
|
-
options: [
|
|
55
|
+
options: [DefaultOption]
|
|
47
56
|
});
|
|
48
57
|
// Select box question and answer
|
|
49
|
-
exports.SelectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('selectBox'),
|
|
58
|
+
exports.SelectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('selectBox'),
|
|
59
|
+
// Questions should not include the `selected` flag on options
|
|
60
|
+
options: zod_1.z.array(OptionSchema), attributes: selectBoxAttributes, showCommentField: zod_1.z.boolean().optional() }));
|
|
50
61
|
exports.DefaultSelectBoxQuestion = exports.SelectBoxQuestionSchema.parse({
|
|
51
62
|
type: 'selectBox',
|
|
52
63
|
attributes: DefaultSelectBoxAttributes,
|
|
53
64
|
meta: question_1.DefaultMeta,
|
|
54
|
-
options: [
|
|
65
|
+
options: [DefaultOption]
|
|
55
66
|
});
|
|
56
67
|
const multiselectBoxAttributes = zod_1.z.object(Object.assign(Object.assign({}, selectBoxAttributes.shape), { multiple: zod_1.z.literal(true) }));
|
|
57
68
|
const DefaultMultiselectBoxAttributes = multiselectBoxAttributes.parse({
|
|
58
69
|
multiple: true
|
|
59
70
|
});
|
|
60
71
|
// Multi-select box question and answer
|
|
61
|
-
exports.MultiselectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, exports.SelectBoxQuestionSchema.shape), { type: zod_1.z.literal('multiselectBox'),
|
|
72
|
+
exports.MultiselectBoxQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, exports.SelectBoxQuestionSchema.shape), { type: zod_1.z.literal('multiselectBox'),
|
|
73
|
+
// Questions should not include the `selected` flag on options
|
|
74
|
+
options: zod_1.z.array(OptionSchema), attributes: multiselectBoxAttributes, showCommentField: zod_1.z.boolean().optional() }));
|
|
62
75
|
exports.DefaultMultiselectBoxQuestion = exports.MultiselectBoxQuestionSchema.parse({
|
|
63
76
|
type: 'multiselectBox',
|
|
64
77
|
attributes: DefaultMultiselectBoxAttributes,
|
|
65
78
|
meta: question_1.DefaultMeta,
|
|
66
|
-
options: [
|
|
79
|
+
options: [DefaultOption]
|
|
67
80
|
});
|
|
68
81
|
exports.BooleanQuestionJSONSchema = zod_1.z.toJSONSchema(exports.BooleanQuestionSchema);
|
|
69
82
|
exports.CheckboxesQuestionJSONSchema = zod_1.z.toJSONSchema(exports.CheckboxesQuestionSchema);
|