@dmptool/types 2.2.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/dist/questions/__tests__/defaults.spec.js +10 -10
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +17 -12
- package/dist/questions/index.d.ts +10 -7
- package/dist/questions/optionBasedQuestions.d.ts +8 -6
- package/dist/questions/optionBasedQuestions.js +21 -8
- package/dist/questions/tableQuestions.d.ts +24 -16
- package/dist/questions/tableQuestions.js +9 -9
- package/dist/schemas/anyQuestion.schema.json +30 -35
- package/dist/schemas/anyTableColumnQuestion.schema.json +9 -10
- package/dist/schemas/checkboxesQuestion.schema.json +3 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +3 -5
- package/dist/schemas/radioButtonsQuestion.schema.json +3 -5
- package/dist/schemas/selectBoxQuestion.schema.json +3 -5
- package/dist/schemas/tableQuestion.schema.json +9 -10
- package/package.json +1 -1
- package/schemas/anyQuestion.schema.json +30 -35
- package/schemas/anyTableColumnQuestion.schema.json +9 -10
- package/schemas/checkboxesQuestion.schema.json +3 -0
- package/schemas/multiselectBoxQuestion.schema.json +3 -5
- package/schemas/radioButtonsQuestion.schema.json +3 -5
- package/schemas/selectBoxQuestion.schema.json +3 -5
- package/schemas/tableQuestion.schema.json +9 -10
|
@@ -194,7 +194,7 @@ describe('questions return the expected defaults', () => {
|
|
|
194
194
|
type: "multiselectBox",
|
|
195
195
|
attributes: { multiple: true },
|
|
196
196
|
meta: { schemaVersion: "1.0" },
|
|
197
|
-
options: [{ label: 'Option A',
|
|
197
|
+
options: [{ label: 'Option A', value: 'a' }]
|
|
198
198
|
};
|
|
199
199
|
(0, globals_1.expect)(optionBasedQuestions_1.DefaultMultiselectBoxQuestion).toEqual(expected);
|
|
200
200
|
});
|
|
@@ -231,7 +231,7 @@ describe('questions return the expected defaults', () => {
|
|
|
231
231
|
type: "radioButtons",
|
|
232
232
|
attributes: {},
|
|
233
233
|
meta: { schemaVersion: "1.0" },
|
|
234
|
-
options: [{ label: 'Option A',
|
|
234
|
+
options: [{ label: 'Option A', value: 'a' }]
|
|
235
235
|
};
|
|
236
236
|
(0, globals_1.expect)(optionBasedQuestions_1.DefaultRadioButtonsQuestion).toEqual(expected);
|
|
237
237
|
});
|
|
@@ -281,9 +281,9 @@ describe('questions return the expected defaults', () => {
|
|
|
281
281
|
type: "selectBox",
|
|
282
282
|
attributes: { multiple: false },
|
|
283
283
|
options: [
|
|
284
|
-
{ label: 'Dataset', value: 'dataset'
|
|
285
|
-
{ label: 'Software', value: 'software'
|
|
286
|
-
{ label: 'Other', value: 'other'
|
|
284
|
+
{ label: 'Dataset', value: 'dataset' },
|
|
285
|
+
{ label: 'Software', value: 'software' },
|
|
286
|
+
{ label: 'Other', value: 'other' }
|
|
287
287
|
],
|
|
288
288
|
meta: { schemaVersion: "1.0" }
|
|
289
289
|
}
|
|
@@ -321,9 +321,9 @@ describe('questions return the expected defaults', () => {
|
|
|
321
321
|
meta: { schemaVersion: "1.0" },
|
|
322
322
|
attributes: {},
|
|
323
323
|
options: [
|
|
324
|
-
{ label: 'Open Access', value: 'open'
|
|
325
|
-
{ label: 'Restricted Access', value: 'restricted'
|
|
326
|
-
{ label: 'Other', value: 'closed'
|
|
324
|
+
{ label: 'Open Access', value: 'open' },
|
|
325
|
+
{ label: 'Restricted Access', value: 'restricted' },
|
|
326
|
+
{ label: 'Other', value: 'closed' },
|
|
327
327
|
]
|
|
328
328
|
}
|
|
329
329
|
},
|
|
@@ -352,7 +352,7 @@ describe('questions return the expected defaults', () => {
|
|
|
352
352
|
step: 1,
|
|
353
353
|
context: [
|
|
354
354
|
{ label: 'bytes', value: 'bytes', selected: false },
|
|
355
|
-
{ label: 'KB (kilobytes)', value: 'kb', selected:
|
|
355
|
+
{ label: 'KB (kilobytes)', value: 'kb', selected: false },
|
|
356
356
|
{ label: 'MB (megabytes)', value: 'mb', selected: false },
|
|
357
357
|
{ label: 'GB (gigabytes)', value: 'gb', selected: false },
|
|
358
358
|
{ label: 'TB (terabytes)', value: 'tb', selected: false },
|
|
@@ -630,7 +630,7 @@ describe('questions return the expected defaults', () => {
|
|
|
630
630
|
type: "selectBox",
|
|
631
631
|
attributes: { multiple: false },
|
|
632
632
|
meta: { schemaVersion: "1.0" },
|
|
633
|
-
options: [{ label: 'Option A',
|
|
633
|
+
options: [{ label: 'Option A', value: 'a' }]
|
|
634
634
|
};
|
|
635
635
|
(0, globals_1.expect)(optionBasedQuestions_1.DefaultSelectBoxQuestion).toEqual(expected);
|
|
636
636
|
});
|
|
@@ -101,12 +101,10 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
101
101
|
{
|
|
102
102
|
label: "Male",
|
|
103
103
|
value: "male",
|
|
104
|
-
selected: true,
|
|
105
104
|
},
|
|
106
105
|
{
|
|
107
106
|
label: "Female",
|
|
108
107
|
value: "female",
|
|
109
|
-
selected: true,
|
|
110
108
|
},
|
|
111
109
|
],
|
|
112
110
|
meta: {
|
|
@@ -122,8 +120,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
122
120
|
options: [
|
|
123
121
|
{
|
|
124
122
|
label: "Male",
|
|
125
|
-
value: "male"
|
|
126
|
-
selected: "true", // Invalid type for selected
|
|
123
|
+
value: "male"
|
|
127
124
|
},
|
|
128
125
|
],
|
|
129
126
|
meta: {
|
|
@@ -146,12 +143,10 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
146
143
|
{
|
|
147
144
|
label: "USA",
|
|
148
145
|
value: "us",
|
|
149
|
-
selected: true,
|
|
150
146
|
},
|
|
151
147
|
{
|
|
152
148
|
label: "Canada",
|
|
153
149
|
value: "ca",
|
|
154
|
-
selected: false,
|
|
155
150
|
},
|
|
156
151
|
],
|
|
157
152
|
meta: {
|
|
@@ -168,8 +163,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
168
163
|
options: [
|
|
169
164
|
{
|
|
170
165
|
label: "USA",
|
|
171
|
-
value: "us"
|
|
172
|
-
selected: "true", // Invalid type for selected
|
|
166
|
+
value: "us"
|
|
173
167
|
},
|
|
174
168
|
],
|
|
175
169
|
attributes: {
|
|
@@ -195,12 +189,10 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
195
189
|
{
|
|
196
190
|
label: "USA",
|
|
197
191
|
value: "us",
|
|
198
|
-
selected: true,
|
|
199
192
|
},
|
|
200
193
|
{
|
|
201
194
|
label: "Canada",
|
|
202
195
|
value: "ca",
|
|
203
|
-
selected: false,
|
|
204
196
|
},
|
|
205
197
|
],
|
|
206
198
|
meta: {
|
|
@@ -217,8 +209,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
217
209
|
options: [
|
|
218
210
|
{
|
|
219
211
|
label: "USA",
|
|
220
|
-
value: "us"
|
|
221
|
-
selected: "true", // Invalid type for selected
|
|
212
|
+
value: "us"
|
|
222
213
|
},
|
|
223
214
|
],
|
|
224
215
|
attributes: {
|
|
@@ -231,3 +222,17 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
|
|
|
231
222
|
(0, globals_1.expect)(() => optionBasedQuestions_1.MultiselectBoxQuestionSchema.parse(invalidSelectBoxQuestion)).toThrow();
|
|
232
223
|
});
|
|
233
224
|
});
|
|
225
|
+
(0, globals_1.describe)("Option descriptions", () => {
|
|
226
|
+
(0, globals_1.it)("should accept and preserve an optional description on options", () => {
|
|
227
|
+
const selectWithDescription = {
|
|
228
|
+
type: "selectBox",
|
|
229
|
+
attributes: { multiple: false },
|
|
230
|
+
options: [
|
|
231
|
+
{ label: "Data paper", value: "data-paper", description: "A published description of a dataset" },
|
|
232
|
+
],
|
|
233
|
+
meta: { schemaVersion: "1.0" }
|
|
234
|
+
};
|
|
235
|
+
const parsed = optionBasedQuestions_1.SelectBoxQuestionSchema.parse(selectWithDescription);
|
|
236
|
+
(0, globals_1.expect)(parsed.options[0].description).toBe("A published description of a dataset");
|
|
237
|
+
});
|
|
238
|
+
});
|
|
@@ -63,6 +63,7 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
63
63
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
64
64
|
label: z.ZodDefault<z.ZodString>;
|
|
65
65
|
value: z.ZodDefault<z.ZodString>;
|
|
66
|
+
description: z.ZodOptional<z.ZodString>;
|
|
66
67
|
}, z.core.$strip>>;
|
|
67
68
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
68
69
|
attributes: z.ZodObject<{
|
|
@@ -223,9 +224,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
223
224
|
}, z.core.$strip>, z.ZodObject<{
|
|
224
225
|
type: z.ZodLiteral<"multiselectBox">;
|
|
225
226
|
options: z.ZodArray<z.ZodObject<{
|
|
226
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
227
227
|
label: z.ZodDefault<z.ZodString>;
|
|
228
228
|
value: z.ZodDefault<z.ZodString>;
|
|
229
|
+
description: z.ZodOptional<z.ZodString>;
|
|
229
230
|
}, z.core.$strip>>;
|
|
230
231
|
attributes: z.ZodObject<{
|
|
231
232
|
multiple: z.ZodLiteral<true>;
|
|
@@ -289,9 +290,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
289
290
|
}, z.core.$strip>, z.ZodObject<{
|
|
290
291
|
type: z.ZodLiteral<"radioButtons">;
|
|
291
292
|
options: z.ZodArray<z.ZodObject<{
|
|
292
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
293
293
|
label: z.ZodDefault<z.ZodString>;
|
|
294
294
|
value: z.ZodDefault<z.ZodString>;
|
|
295
|
+
description: z.ZodOptional<z.ZodString>;
|
|
295
296
|
}, z.core.$strip>>;
|
|
296
297
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
297
298
|
attributes: z.ZodObject<{
|
|
@@ -390,9 +391,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
390
391
|
content: z.ZodObject<{
|
|
391
392
|
type: z.ZodLiteral<"selectBox">;
|
|
392
393
|
options: z.ZodArray<z.ZodObject<{
|
|
393
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
394
394
|
label: z.ZodDefault<z.ZodString>;
|
|
395
395
|
value: z.ZodDefault<z.ZodString>;
|
|
396
|
+
description: z.ZodOptional<z.ZodString>;
|
|
396
397
|
}, z.core.$strip>>;
|
|
397
398
|
attributes: z.ZodObject<{
|
|
398
399
|
multiple: z.ZodLiteral<false>;
|
|
@@ -418,6 +419,7 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
418
419
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
419
420
|
label: z.ZodDefault<z.ZodString>;
|
|
420
421
|
value: z.ZodDefault<z.ZodString>;
|
|
422
|
+
description: z.ZodOptional<z.ZodString>;
|
|
421
423
|
}, z.core.$strip>>;
|
|
422
424
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
423
425
|
attributes: z.ZodObject<{
|
|
@@ -439,9 +441,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
439
441
|
content: z.ZodObject<{
|
|
440
442
|
type: z.ZodLiteral<"radioButtons">;
|
|
441
443
|
options: z.ZodArray<z.ZodObject<{
|
|
442
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
443
444
|
label: z.ZodDefault<z.ZodString>;
|
|
444
445
|
value: z.ZodDefault<z.ZodString>;
|
|
446
|
+
description: z.ZodOptional<z.ZodString>;
|
|
445
447
|
}, z.core.$strip>>;
|
|
446
448
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
447
449
|
attributes: z.ZodObject<{
|
|
@@ -673,9 +675,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
673
675
|
}, z.core.$strip>, z.ZodObject<{
|
|
674
676
|
type: z.ZodLiteral<"selectBox">;
|
|
675
677
|
options: z.ZodArray<z.ZodObject<{
|
|
676
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
677
678
|
label: z.ZodDefault<z.ZodString>;
|
|
678
679
|
value: z.ZodDefault<z.ZodString>;
|
|
680
|
+
description: z.ZodOptional<z.ZodString>;
|
|
679
681
|
}, z.core.$strip>>;
|
|
680
682
|
attributes: z.ZodObject<{
|
|
681
683
|
multiple: z.ZodLiteral<false>;
|
|
@@ -746,6 +748,7 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
746
748
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
747
749
|
label: z.ZodDefault<z.ZodString>;
|
|
748
750
|
value: z.ZodDefault<z.ZodString>;
|
|
751
|
+
description: z.ZodOptional<z.ZodString>;
|
|
749
752
|
}, z.core.$strip>>;
|
|
750
753
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
751
754
|
attributes: z.ZodObject<{
|
|
@@ -944,9 +947,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
944
947
|
}, z.core.$strip>, z.ZodObject<{
|
|
945
948
|
type: z.ZodLiteral<"radioButtons">;
|
|
946
949
|
options: z.ZodArray<z.ZodObject<{
|
|
947
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
948
950
|
label: z.ZodDefault<z.ZodString>;
|
|
949
951
|
value: z.ZodDefault<z.ZodString>;
|
|
952
|
+
description: z.ZodOptional<z.ZodString>;
|
|
950
953
|
}, z.core.$strip>>;
|
|
951
954
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
952
955
|
attributes: z.ZodObject<{
|
|
@@ -994,9 +997,9 @@ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
994
997
|
}, z.core.$strip>, z.ZodObject<{
|
|
995
998
|
type: z.ZodLiteral<"selectBox">;
|
|
996
999
|
options: z.ZodArray<z.ZodObject<{
|
|
997
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
998
1000
|
label: z.ZodDefault<z.ZodString>;
|
|
999
1001
|
value: z.ZodDefault<z.ZodString>;
|
|
1002
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1000
1003
|
}, z.core.$strip>>;
|
|
1001
1004
|
attributes: z.ZodObject<{
|
|
1002
1005
|
multiple: z.ZodLiteral<false>;
|
|
@@ -31,6 +31,7 @@ export declare const CheckboxesQuestionSchema: z.ZodObject<{
|
|
|
31
31
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
32
32
|
label: z.ZodDefault<z.ZodString>;
|
|
33
33
|
value: z.ZodDefault<z.ZodString>;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
34
35
|
}, z.core.$strip>>;
|
|
35
36
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
36
37
|
attributes: z.ZodObject<{
|
|
@@ -50,6 +51,7 @@ export declare const DefaultCheckboxesQuestion: {
|
|
|
50
51
|
checked: boolean;
|
|
51
52
|
label: string;
|
|
52
53
|
value: string;
|
|
54
|
+
description?: string | undefined;
|
|
53
55
|
}[];
|
|
54
56
|
attributes: {
|
|
55
57
|
label?: string | undefined;
|
|
@@ -66,9 +68,9 @@ export declare const DefaultCheckboxesQuestion: {
|
|
|
66
68
|
export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
67
69
|
type: z.ZodLiteral<"radioButtons">;
|
|
68
70
|
options: z.ZodArray<z.ZodObject<{
|
|
69
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
70
71
|
label: z.ZodDefault<z.ZodString>;
|
|
71
72
|
value: z.ZodDefault<z.ZodString>;
|
|
73
|
+
description: z.ZodOptional<z.ZodString>;
|
|
72
74
|
}, z.core.$strip>>;
|
|
73
75
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
74
76
|
attributes: z.ZodObject<{
|
|
@@ -85,9 +87,9 @@ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
|
|
|
85
87
|
export declare const DefaultRadioButtonsQuestion: {
|
|
86
88
|
type: "radioButtons";
|
|
87
89
|
options: {
|
|
88
|
-
selected: boolean;
|
|
89
90
|
label: string;
|
|
90
91
|
value: string;
|
|
92
|
+
description?: string | undefined;
|
|
91
93
|
}[];
|
|
92
94
|
attributes: {
|
|
93
95
|
label?: string | undefined;
|
|
@@ -104,9 +106,9 @@ export declare const DefaultRadioButtonsQuestion: {
|
|
|
104
106
|
export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
105
107
|
type: z.ZodLiteral<"selectBox">;
|
|
106
108
|
options: z.ZodArray<z.ZodObject<{
|
|
107
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
108
109
|
label: z.ZodDefault<z.ZodString>;
|
|
109
110
|
value: z.ZodDefault<z.ZodString>;
|
|
111
|
+
description: z.ZodOptional<z.ZodString>;
|
|
110
112
|
}, z.core.$strip>>;
|
|
111
113
|
attributes: z.ZodObject<{
|
|
112
114
|
multiple: z.ZodLiteral<false>;
|
|
@@ -124,9 +126,9 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
|
|
|
124
126
|
export declare const DefaultSelectBoxQuestion: {
|
|
125
127
|
type: "selectBox";
|
|
126
128
|
options: {
|
|
127
|
-
selected: boolean;
|
|
128
129
|
label: string;
|
|
129
130
|
value: string;
|
|
131
|
+
description?: string | undefined;
|
|
130
132
|
}[];
|
|
131
133
|
attributes: {
|
|
132
134
|
multiple: false;
|
|
@@ -144,9 +146,9 @@ export declare const DefaultSelectBoxQuestion: {
|
|
|
144
146
|
export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
145
147
|
type: z.ZodLiteral<"multiselectBox">;
|
|
146
148
|
options: z.ZodArray<z.ZodObject<{
|
|
147
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
148
149
|
label: z.ZodDefault<z.ZodString>;
|
|
149
150
|
value: z.ZodDefault<z.ZodString>;
|
|
151
|
+
description: z.ZodOptional<z.ZodString>;
|
|
150
152
|
}, z.core.$strip>>;
|
|
151
153
|
attributes: z.ZodObject<{
|
|
152
154
|
multiple: z.ZodLiteral<true>;
|
|
@@ -164,9 +166,9 @@ export declare const MultiselectBoxQuestionSchema: z.ZodObject<{
|
|
|
164
166
|
export declare const DefaultMultiselectBoxQuestion: {
|
|
165
167
|
type: "multiselectBox";
|
|
166
168
|
options: {
|
|
167
|
-
selected: boolean;
|
|
168
169
|
label: string;
|
|
169
170
|
value: string;
|
|
171
|
+
description?: string | undefined;
|
|
170
172
|
}[];
|
|
171
173
|
attributes: {
|
|
172
174
|
multiple: true;
|
|
@@ -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
|
|
@@ -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);
|
|
@@ -49,6 +49,7 @@ export declare const AnyTableColumnQuestionSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
49
49
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
50
50
|
label: z.ZodDefault<z.ZodString>;
|
|
51
51
|
value: z.ZodDefault<z.ZodString>;
|
|
52
|
+
description: z.ZodOptional<z.ZodString>;
|
|
52
53
|
}, z.core.$strip>>;
|
|
53
54
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
54
55
|
attributes: z.ZodObject<{
|
|
@@ -247,9 +248,9 @@ export declare const AnyTableColumnQuestionSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
247
248
|
}, z.core.$strip>, z.ZodObject<{
|
|
248
249
|
type: z.ZodLiteral<"radioButtons">;
|
|
249
250
|
options: z.ZodArray<z.ZodObject<{
|
|
250
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
251
251
|
label: z.ZodDefault<z.ZodString>;
|
|
252
252
|
value: z.ZodDefault<z.ZodString>;
|
|
253
|
+
description: z.ZodOptional<z.ZodString>;
|
|
253
254
|
}, z.core.$strip>>;
|
|
254
255
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
255
256
|
attributes: z.ZodObject<{
|
|
@@ -297,9 +298,9 @@ export declare const AnyTableColumnQuestionSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
297
298
|
}, z.core.$strip>, z.ZodObject<{
|
|
298
299
|
type: z.ZodLiteral<"selectBox">;
|
|
299
300
|
options: z.ZodArray<z.ZodObject<{
|
|
300
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
301
301
|
label: z.ZodDefault<z.ZodString>;
|
|
302
302
|
value: z.ZodDefault<z.ZodString>;
|
|
303
|
+
description: z.ZodOptional<z.ZodString>;
|
|
303
304
|
}, z.core.$strip>>;
|
|
304
305
|
attributes: z.ZodObject<{
|
|
305
306
|
multiple: z.ZodLiteral<false>;
|
|
@@ -418,6 +419,7 @@ export declare const TableColumnSchema: z.ZodObject<{
|
|
|
418
419
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
419
420
|
label: z.ZodDefault<z.ZodString>;
|
|
420
421
|
value: z.ZodDefault<z.ZodString>;
|
|
422
|
+
description: z.ZodOptional<z.ZodString>;
|
|
421
423
|
}, z.core.$strip>>;
|
|
422
424
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
423
425
|
attributes: z.ZodObject<{
|
|
@@ -616,9 +618,9 @@ export declare const TableColumnSchema: z.ZodObject<{
|
|
|
616
618
|
}, z.core.$strip>, z.ZodObject<{
|
|
617
619
|
type: z.ZodLiteral<"radioButtons">;
|
|
618
620
|
options: z.ZodArray<z.ZodObject<{
|
|
619
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
620
621
|
label: z.ZodDefault<z.ZodString>;
|
|
621
622
|
value: z.ZodDefault<z.ZodString>;
|
|
623
|
+
description: z.ZodOptional<z.ZodString>;
|
|
622
624
|
}, z.core.$strip>>;
|
|
623
625
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
624
626
|
attributes: z.ZodObject<{
|
|
@@ -666,9 +668,9 @@ export declare const TableColumnSchema: z.ZodObject<{
|
|
|
666
668
|
}, z.core.$strip>, z.ZodObject<{
|
|
667
669
|
type: z.ZodLiteral<"selectBox">;
|
|
668
670
|
options: z.ZodArray<z.ZodObject<{
|
|
669
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
670
671
|
label: z.ZodDefault<z.ZodString>;
|
|
671
672
|
value: z.ZodDefault<z.ZodString>;
|
|
673
|
+
description: z.ZodOptional<z.ZodString>;
|
|
672
674
|
}, z.core.$strip>>;
|
|
673
675
|
attributes: z.ZodObject<{
|
|
674
676
|
multiple: z.ZodLiteral<false>;
|
|
@@ -923,6 +925,7 @@ export declare const DefaultTableColumn: {
|
|
|
923
925
|
checked: boolean;
|
|
924
926
|
label: string;
|
|
925
927
|
value: string;
|
|
928
|
+
description?: string | undefined;
|
|
926
929
|
}[];
|
|
927
930
|
attributes: {
|
|
928
931
|
label?: string | undefined;
|
|
@@ -938,9 +941,9 @@ export declare const DefaultTableColumn: {
|
|
|
938
941
|
} | {
|
|
939
942
|
type: "radioButtons";
|
|
940
943
|
options: {
|
|
941
|
-
selected: boolean;
|
|
942
944
|
label: string;
|
|
943
945
|
value: string;
|
|
946
|
+
description?: string | undefined;
|
|
944
947
|
}[];
|
|
945
948
|
attributes: {
|
|
946
949
|
label?: string | undefined;
|
|
@@ -956,9 +959,9 @@ export declare const DefaultTableColumn: {
|
|
|
956
959
|
} | {
|
|
957
960
|
type: "selectBox";
|
|
958
961
|
options: {
|
|
959
|
-
selected: boolean;
|
|
960
962
|
label: string;
|
|
961
963
|
value: string;
|
|
964
|
+
description?: string | undefined;
|
|
962
965
|
}[];
|
|
963
966
|
attributes: {
|
|
964
967
|
multiple: false;
|
|
@@ -1160,6 +1163,7 @@ export declare const TableQuestionSchema: z.ZodObject<{
|
|
|
1160
1163
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
1161
1164
|
label: z.ZodDefault<z.ZodString>;
|
|
1162
1165
|
value: z.ZodDefault<z.ZodString>;
|
|
1166
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1163
1167
|
}, z.core.$strip>>;
|
|
1164
1168
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
1165
1169
|
attributes: z.ZodObject<{
|
|
@@ -1358,9 +1362,9 @@ export declare const TableQuestionSchema: z.ZodObject<{
|
|
|
1358
1362
|
}, z.core.$strip>, z.ZodObject<{
|
|
1359
1363
|
type: z.ZodLiteral<"radioButtons">;
|
|
1360
1364
|
options: z.ZodArray<z.ZodObject<{
|
|
1361
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
1362
1365
|
label: z.ZodDefault<z.ZodString>;
|
|
1363
1366
|
value: z.ZodDefault<z.ZodString>;
|
|
1367
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1364
1368
|
}, z.core.$strip>>;
|
|
1365
1369
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
1366
1370
|
attributes: z.ZodObject<{
|
|
@@ -1408,9 +1412,9 @@ export declare const TableQuestionSchema: z.ZodObject<{
|
|
|
1408
1412
|
}, z.core.$strip>, z.ZodObject<{
|
|
1409
1413
|
type: z.ZodLiteral<"selectBox">;
|
|
1410
1414
|
options: z.ZodArray<z.ZodObject<{
|
|
1411
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
1412
1415
|
label: z.ZodDefault<z.ZodString>;
|
|
1413
1416
|
value: z.ZodDefault<z.ZodString>;
|
|
1417
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1414
1418
|
}, z.core.$strip>>;
|
|
1415
1419
|
attributes: z.ZodObject<{
|
|
1416
1420
|
multiple: z.ZodLiteral<false>;
|
|
@@ -1683,6 +1687,7 @@ export declare const DefaultTableQuestion: {
|
|
|
1683
1687
|
checked: boolean;
|
|
1684
1688
|
label: string;
|
|
1685
1689
|
value: string;
|
|
1690
|
+
description?: string | undefined;
|
|
1686
1691
|
}[];
|
|
1687
1692
|
attributes: {
|
|
1688
1693
|
label?: string | undefined;
|
|
@@ -1698,9 +1703,9 @@ export declare const DefaultTableQuestion: {
|
|
|
1698
1703
|
} | {
|
|
1699
1704
|
type: "radioButtons";
|
|
1700
1705
|
options: {
|
|
1701
|
-
selected: boolean;
|
|
1702
1706
|
label: string;
|
|
1703
1707
|
value: string;
|
|
1708
|
+
description?: string | undefined;
|
|
1704
1709
|
}[];
|
|
1705
1710
|
attributes: {
|
|
1706
1711
|
label?: string | undefined;
|
|
@@ -1716,9 +1721,9 @@ export declare const DefaultTableQuestion: {
|
|
|
1716
1721
|
} | {
|
|
1717
1722
|
type: "selectBox";
|
|
1718
1723
|
options: {
|
|
1719
|
-
selected: boolean;
|
|
1720
1724
|
label: string;
|
|
1721
1725
|
value: string;
|
|
1726
|
+
description?: string | undefined;
|
|
1722
1727
|
}[];
|
|
1723
1728
|
attributes: {
|
|
1724
1729
|
multiple: false;
|
|
@@ -1977,9 +1982,9 @@ declare const AnyResearchOutputColumnSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1977
1982
|
content: z.ZodObject<{
|
|
1978
1983
|
type: z.ZodLiteral<"selectBox">;
|
|
1979
1984
|
options: z.ZodArray<z.ZodObject<{
|
|
1980
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
1981
1985
|
label: z.ZodDefault<z.ZodString>;
|
|
1982
1986
|
value: z.ZodDefault<z.ZodString>;
|
|
1987
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1983
1988
|
}, z.core.$strip>>;
|
|
1984
1989
|
attributes: z.ZodObject<{
|
|
1985
1990
|
multiple: z.ZodLiteral<false>;
|
|
@@ -2005,6 +2010,7 @@ declare const AnyResearchOutputColumnSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2005
2010
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
2006
2011
|
label: z.ZodDefault<z.ZodString>;
|
|
2007
2012
|
value: z.ZodDefault<z.ZodString>;
|
|
2013
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2008
2014
|
}, z.core.$strip>>;
|
|
2009
2015
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
2010
2016
|
attributes: z.ZodObject<{
|
|
@@ -2026,9 +2032,9 @@ declare const AnyResearchOutputColumnSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2026
2032
|
content: z.ZodObject<{
|
|
2027
2033
|
type: z.ZodLiteral<"radioButtons">;
|
|
2028
2034
|
options: z.ZodArray<z.ZodObject<{
|
|
2029
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
2030
2035
|
label: z.ZodDefault<z.ZodString>;
|
|
2031
2036
|
value: z.ZodDefault<z.ZodString>;
|
|
2037
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2032
2038
|
}, z.core.$strip>>;
|
|
2033
2039
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
2034
2040
|
attributes: z.ZodObject<{
|
|
@@ -2296,9 +2302,9 @@ export declare const ResearchOutputTableQuestionSchema: z.ZodObject<{
|
|
|
2296
2302
|
content: z.ZodObject<{
|
|
2297
2303
|
type: z.ZodLiteral<"selectBox">;
|
|
2298
2304
|
options: z.ZodArray<z.ZodObject<{
|
|
2299
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
2300
2305
|
label: z.ZodDefault<z.ZodString>;
|
|
2301
2306
|
value: z.ZodDefault<z.ZodString>;
|
|
2307
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2302
2308
|
}, z.core.$strip>>;
|
|
2303
2309
|
attributes: z.ZodObject<{
|
|
2304
2310
|
multiple: z.ZodLiteral<false>;
|
|
@@ -2324,6 +2330,7 @@ export declare const ResearchOutputTableQuestionSchema: z.ZodObject<{
|
|
|
2324
2330
|
checked: z.ZodDefault<z.ZodBoolean>;
|
|
2325
2331
|
label: z.ZodDefault<z.ZodString>;
|
|
2326
2332
|
value: z.ZodDefault<z.ZodString>;
|
|
2333
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2327
2334
|
}, z.core.$strip>>;
|
|
2328
2335
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
2329
2336
|
attributes: z.ZodObject<{
|
|
@@ -2345,9 +2352,9 @@ export declare const ResearchOutputTableQuestionSchema: z.ZodObject<{
|
|
|
2345
2352
|
content: z.ZodObject<{
|
|
2346
2353
|
type: z.ZodLiteral<"radioButtons">;
|
|
2347
2354
|
options: z.ZodArray<z.ZodObject<{
|
|
2348
|
-
selected: z.ZodDefault<z.ZodBoolean>;
|
|
2349
2355
|
label: z.ZodDefault<z.ZodString>;
|
|
2350
2356
|
value: z.ZodDefault<z.ZodString>;
|
|
2357
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2351
2358
|
}, z.core.$strip>>;
|
|
2352
2359
|
showCommentField: z.ZodOptional<z.ZodBoolean>;
|
|
2353
2360
|
attributes: z.ZodObject<{
|
|
@@ -2631,9 +2638,9 @@ export declare const DefaultResearchOutputTableQuestion: {
|
|
|
2631
2638
|
content: {
|
|
2632
2639
|
type: "selectBox";
|
|
2633
2640
|
options: {
|
|
2634
|
-
selected: boolean;
|
|
2635
2641
|
label: string;
|
|
2636
2642
|
value: string;
|
|
2643
|
+
description?: string | undefined;
|
|
2637
2644
|
}[];
|
|
2638
2645
|
attributes: {
|
|
2639
2646
|
multiple: false;
|
|
@@ -2659,6 +2666,7 @@ export declare const DefaultResearchOutputTableQuestion: {
|
|
|
2659
2666
|
checked: boolean;
|
|
2660
2667
|
label: string;
|
|
2661
2668
|
value: string;
|
|
2669
|
+
description?: string | undefined;
|
|
2662
2670
|
}[];
|
|
2663
2671
|
attributes: {
|
|
2664
2672
|
label?: string | undefined;
|
|
@@ -2680,9 +2688,9 @@ export declare const DefaultResearchOutputTableQuestion: {
|
|
|
2680
2688
|
content: {
|
|
2681
2689
|
type: "radioButtons";
|
|
2682
2690
|
options: {
|
|
2683
|
-
selected: boolean;
|
|
2684
2691
|
label: string;
|
|
2685
2692
|
value: string;
|
|
2693
|
+
description?: string | undefined;
|
|
2686
2694
|
}[];
|
|
2687
2695
|
attributes: {
|
|
2688
2696
|
label?: string | undefined;
|
|
@@ -116,9 +116,9 @@ const DefaultResearchOutputDataFlagsColumn = ResearchOutputDataFlagsColumnSchema
|
|
|
116
116
|
content: DefaultResearchOutputDataFlagsContent
|
|
117
117
|
});
|
|
118
118
|
const DefaultResearchOutputAccessLevelOptions = [
|
|
119
|
-
{ label: 'Open Access', value: 'open'
|
|
120
|
-
{ label: 'Restricted Access', value: 'restricted'
|
|
121
|
-
{ label: 'Other', value: 'closed'
|
|
119
|
+
{ label: 'Open Access', value: 'open' },
|
|
120
|
+
{ label: 'Restricted Access', value: 'restricted' },
|
|
121
|
+
{ label: 'Other', value: 'closed' },
|
|
122
122
|
];
|
|
123
123
|
const DefaultResearchOutputAccessLevelContent = optionBasedQuestions_1.RadioButtonsQuestionSchema.parse({
|
|
124
124
|
type: 'radioButtons',
|
|
@@ -139,12 +139,12 @@ const DefaultResearchOutputReleaseDateColumn = ResearchOutputReleaseDateColumnSc
|
|
|
139
139
|
content: dateQuestions_1.DefaultDateQuestion,
|
|
140
140
|
});
|
|
141
141
|
const DefaultResearchOutputByteSizeOptions = [
|
|
142
|
-
{ label: 'bytes', value: 'bytes'
|
|
143
|
-
{ label: 'KB (kilobytes)', value: 'kb'
|
|
144
|
-
{ label: 'MB (megabytes)', value: 'mb'
|
|
145
|
-
{ label: 'GB (gigabytes)', value: 'gb'
|
|
146
|
-
{ label: 'TB (terabytes)', value: 'tb'
|
|
147
|
-
{ label: 'PB (petabytes)', value: 'pb'
|
|
142
|
+
{ label: 'bytes', value: 'bytes' },
|
|
143
|
+
{ label: 'KB (kilobytes)', value: 'kb' },
|
|
144
|
+
{ label: 'MB (megabytes)', value: 'mb' },
|
|
145
|
+
{ label: 'GB (gigabytes)', value: 'gb' },
|
|
146
|
+
{ label: 'TB (terabytes)', value: 'tb' },
|
|
147
|
+
{ label: 'PB (petabytes)', value: 'pb' }
|
|
148
148
|
];
|
|
149
149
|
const DefaultResearchOutputByteSizeContentAttributes = Object.assign(Object.assign({}, numberQuestions_1.DefaultNumberWithContextQuestion.attributes), { context: DefaultResearchOutputByteSizeOptions });
|
|
150
150
|
const DefaultResearchOutputByteSizeContent = numberQuestions_1.NumberWithContextQuestionSchema.parse({
|