@dmptool/types 1.1.0 → 1.1.2
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 +2 -0
- package/dist/answers/__tests__/answers.spec.js +13 -7
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +2 -2
- package/dist/answers/graphQLAnswers.js +2 -2
- package/dist/answers/index.d.ts +111 -74
- package/dist/answers/index.js +4 -4
- package/dist/answers/numberAnswers.d.ts +0 -25
- package/dist/answers/numberAnswers.js +1 -5
- package/dist/answers/optionBasedAnswers.d.ts +52 -2
- package/dist/answers/optionBasedAnswers.js +9 -1
- package/dist/answers/tableAnswers.d.ts +304 -140
- package/dist/answers/tableAnswers.js +3 -2
- package/dist/questions/__tests__/graphQLQuestions.spec.js +7 -7
- package/dist/questions/__tests__/numberQuestions.spec.js +0 -48
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +98 -1
- package/dist/questions/dateQuestions.d.ts +47 -16
- package/dist/questions/dateQuestions.js +25 -1
- package/dist/questions/graphQLQuestions.d.ts +59 -28
- package/dist/questions/graphQLQuestions.js +40 -3
- package/dist/questions/index.d.ts +1567 -689
- package/dist/questions/index.js +7 -4
- package/dist/questions/numberQuestions.d.ts +71 -76
- package/dist/questions/numberQuestions.js +37 -8
- package/dist/questions/optionBasedQuestions.d.ts +227 -23
- package/dist/questions/optionBasedQuestions.js +89 -5
- package/dist/questions/question.d.ts +51 -4
- package/dist/questions/question.js +14 -2
- package/dist/questions/tableQuestions.d.ts +1965 -1056
- package/dist/questions/tableQuestions.js +14 -2
- package/dist/questions/textQuestions.d.ts +100 -40
- package/dist/questions/textQuestions.js +45 -7
- package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +133 -0
- package/dist/schemas/anyAnswer.schema.json +41 -23
- package/dist/schemas/anyQuestion.schema.json +563 -146
- package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
- package/dist/schemas/anyTableColumnQuestion.schema.json +398 -119
- package/dist/schemas/booleanQuestion.schema.json +12 -0
- package/dist/schemas/checkboxesQuestion.schema.json +12 -0
- package/dist/schemas/currencyQuestion.schema.json +12 -0
- package/dist/schemas/dateQuestion.schema.json +12 -0
- package/dist/schemas/dateRangeQuestion.schema.json +12 -0
- package/dist/schemas/emailQuestion.schema.json +12 -0
- package/dist/schemas/filteredSearchQuestion.schema.json +10 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +90 -0
- package/dist/schemas/numberQuestion.schema.json +12 -0
- package/dist/schemas/numberRangeQuestion.schema.json +12 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +12 -0
- package/dist/schemas/selectBoxAnswer.schema.json +1 -4
- package/dist/schemas/selectBoxQuestion.schema.json +18 -1
- package/dist/schemas/tableAnswer.schema.json +35 -14
- package/dist/schemas/tableQuestion.schema.json +420 -120
- package/dist/schemas/textAreaQuestion.schema.json +15 -4
- package/dist/schemas/textQuestion.schema.json +12 -0
- package/dist/schemas/urlQuestion.schema.json +12 -0
- package/package.json +1 -1
|
@@ -9,9 +9,11 @@ const optionBasedQuestions_1 = require("./optionBasedQuestions");
|
|
|
9
9
|
const graphQLQuestions_1 = require("./graphQLQuestions");
|
|
10
10
|
const question_1 = require("./question");
|
|
11
11
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
12
|
+
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
12
13
|
// Union types for all questions and answers (tables cannot be nested so no TableQuestion here!)
|
|
13
14
|
exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
14
|
-
|
|
15
|
+
graphQLQuestions_1.AffiliationSearchQuestionSchema,
|
|
16
|
+
optionBasedQuestions_1.BooleanQuestionSchema,
|
|
15
17
|
optionBasedQuestions_1.CheckboxesQuestionSchema,
|
|
16
18
|
numberQuestions_1.CurrencyQuestionSchema,
|
|
17
19
|
dateQuestions_1.DateQuestionSchema,
|
|
@@ -23,7 +25,6 @@ exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
23
25
|
optionBasedQuestions_1.SelectBoxQuestionSchema,
|
|
24
26
|
textQuestions_1.TextAreaQuestionSchema,
|
|
25
27
|
textQuestions_1.TextQuestionSchema,
|
|
26
|
-
graphQLQuestions_1.TypeaheadSearchQuestionSchema,
|
|
27
28
|
textQuestions_1.URLQuestionSchema
|
|
28
29
|
]);
|
|
29
30
|
exports.TableColumn = zod_1.z.object({
|
|
@@ -31,6 +32,12 @@ exports.TableColumn = zod_1.z.object({
|
|
|
31
32
|
content: exports.AnyTableColumnQuestionSchema, // The question for the column
|
|
32
33
|
});
|
|
33
34
|
// Table question and answer
|
|
35
|
+
const defaultTableJSON = {
|
|
36
|
+
type: 'table',
|
|
37
|
+
columns: [],
|
|
38
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { canAddRows: true, canRemoveRows: true, initialRows: 1, maxRows: undefined, minRows: undefined }),
|
|
39
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
40
|
+
};
|
|
34
41
|
exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
35
42
|
type: zod_1.z.literal('table'), // The type of question
|
|
36
43
|
columns: zod_1.z.array(exports.TableColumn), // The columns of the table
|
|
@@ -41,4 +48,9 @@ exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
|
41
48
|
maxRows: zod_1.z.number().optional(), // The maximum number of rows (no default)
|
|
42
49
|
minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
|
|
43
50
|
})).optional(),
|
|
51
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
52
|
+
title: zod_1.z.literal('Table').optional(),
|
|
53
|
+
usageDescription: zod_1.z.literal('For questions that require a tabular format.').optional(),
|
|
54
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultTableJSON)).optional()
|
|
55
|
+
})).optional()
|
|
44
56
|
}));
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const EmailQuestionSchema: z.ZodObject<{
|
|
3
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
4
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
schemaVersion: "1.0";
|
|
7
|
-
}, {
|
|
8
|
-
schemaVersion: "1.0";
|
|
9
|
-
}>>;
|
|
10
|
-
} & {
|
|
2
|
+
export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
11
3
|
type: z.ZodLiteral<"email">;
|
|
12
4
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
13
5
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -36,6 +28,23 @@ export declare const EmailQuestionSchema: z.ZodObject<{
|
|
|
36
28
|
pattern?: string | undefined;
|
|
37
29
|
multiple?: boolean | undefined;
|
|
38
30
|
}>>;
|
|
31
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
33
|
+
} & {
|
|
34
|
+
title: z.ZodOptional<z.ZodLiteral<"Email Field">>;
|
|
35
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require require email address(es).">>;
|
|
36
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
schemaVersion: "1.0";
|
|
39
|
+
title?: "Email Field" | undefined;
|
|
40
|
+
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
41
|
+
defaultJSON?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
schemaVersion: "1.0";
|
|
44
|
+
title?: "Email Field" | undefined;
|
|
45
|
+
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
46
|
+
defaultJSON?: string | undefined;
|
|
47
|
+
}>>;
|
|
39
48
|
}, "strip", z.ZodTypeAny, {
|
|
40
49
|
type: "email";
|
|
41
50
|
attributes?: {
|
|
@@ -49,6 +58,9 @@ export declare const EmailQuestionSchema: z.ZodObject<{
|
|
|
49
58
|
} | undefined;
|
|
50
59
|
meta?: {
|
|
51
60
|
schemaVersion: "1.0";
|
|
61
|
+
title?: "Email Field" | undefined;
|
|
62
|
+
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
63
|
+
defaultJSON?: string | undefined;
|
|
52
64
|
} | undefined;
|
|
53
65
|
}, {
|
|
54
66
|
type: "email";
|
|
@@ -63,6 +75,9 @@ export declare const EmailQuestionSchema: z.ZodObject<{
|
|
|
63
75
|
} | undefined;
|
|
64
76
|
meta?: {
|
|
65
77
|
schemaVersion: "1.0";
|
|
78
|
+
title?: "Email Field" | undefined;
|
|
79
|
+
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
80
|
+
defaultJSON?: string | undefined;
|
|
66
81
|
} | undefined;
|
|
67
82
|
}>;
|
|
68
83
|
export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
@@ -76,6 +91,7 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
76
91
|
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
77
92
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
78
93
|
rows: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
asRichText: z.ZodOptional<z.ZodBoolean>;
|
|
79
95
|
}, "strip", z.ZodTypeAny, {
|
|
80
96
|
label?: string | undefined;
|
|
81
97
|
help?: string | undefined;
|
|
@@ -84,6 +100,7 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
84
100
|
minLength?: number | undefined;
|
|
85
101
|
cols?: number | undefined;
|
|
86
102
|
rows?: number | undefined;
|
|
103
|
+
asRichText?: boolean | undefined;
|
|
87
104
|
}, {
|
|
88
105
|
label?: string | undefined;
|
|
89
106
|
help?: string | undefined;
|
|
@@ -92,24 +109,27 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
92
109
|
minLength?: number | undefined;
|
|
93
110
|
cols?: number | undefined;
|
|
94
111
|
rows?: number | undefined;
|
|
112
|
+
asRichText?: boolean | undefined;
|
|
95
113
|
}>>;
|
|
96
|
-
meta: z.ZodObject<{
|
|
114
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
97
115
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
98
116
|
} & {
|
|
99
|
-
|
|
117
|
+
title: z.ZodOptional<z.ZodLiteral<"Text Area">>;
|
|
118
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require longer answers, you can select formatting options too.">>;
|
|
119
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
100
120
|
}, "strip", z.ZodTypeAny, {
|
|
101
121
|
schemaVersion: "1.0";
|
|
102
|
-
|
|
122
|
+
title?: "Text Area" | undefined;
|
|
123
|
+
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
124
|
+
defaultJSON?: string | undefined;
|
|
103
125
|
}, {
|
|
104
126
|
schemaVersion: "1.0";
|
|
105
|
-
|
|
106
|
-
|
|
127
|
+
title?: "Text Area" | undefined;
|
|
128
|
+
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
129
|
+
defaultJSON?: string | undefined;
|
|
130
|
+
}>>;
|
|
107
131
|
}, "strip", z.ZodTypeAny, {
|
|
108
132
|
type: "textArea";
|
|
109
|
-
meta: {
|
|
110
|
-
schemaVersion: "1.0";
|
|
111
|
-
asRichText?: boolean | undefined;
|
|
112
|
-
};
|
|
113
133
|
attributes?: {
|
|
114
134
|
label?: string | undefined;
|
|
115
135
|
help?: string | undefined;
|
|
@@ -118,13 +138,16 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
118
138
|
minLength?: number | undefined;
|
|
119
139
|
cols?: number | undefined;
|
|
120
140
|
rows?: number | undefined;
|
|
141
|
+
asRichText?: boolean | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
meta?: {
|
|
144
|
+
schemaVersion: "1.0";
|
|
145
|
+
title?: "Text Area" | undefined;
|
|
146
|
+
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
147
|
+
defaultJSON?: string | undefined;
|
|
121
148
|
} | undefined;
|
|
122
149
|
}, {
|
|
123
150
|
type: "textArea";
|
|
124
|
-
meta: {
|
|
125
|
-
schemaVersion: "1.0";
|
|
126
|
-
asRichText?: boolean | undefined;
|
|
127
|
-
};
|
|
128
151
|
attributes?: {
|
|
129
152
|
label?: string | undefined;
|
|
130
153
|
help?: string | undefined;
|
|
@@ -133,17 +156,16 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
133
156
|
minLength?: number | undefined;
|
|
134
157
|
cols?: number | undefined;
|
|
135
158
|
rows?: number | undefined;
|
|
159
|
+
asRichText?: boolean | undefined;
|
|
136
160
|
} | undefined;
|
|
137
|
-
|
|
138
|
-
export declare const TextQuestionSchema: z.ZodObject<{
|
|
139
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
140
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
141
|
-
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
schemaVersion: "1.0";
|
|
143
|
-
}, {
|
|
161
|
+
meta?: {
|
|
144
162
|
schemaVersion: "1.0";
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
title?: "Text Area" | undefined;
|
|
164
|
+
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
165
|
+
defaultJSON?: string | undefined;
|
|
166
|
+
} | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
147
169
|
type: z.ZodLiteral<"text">;
|
|
148
170
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
149
171
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -168,6 +190,23 @@ export declare const TextQuestionSchema: z.ZodObject<{
|
|
|
168
190
|
minLength?: number | undefined;
|
|
169
191
|
pattern?: string | undefined;
|
|
170
192
|
}>>;
|
|
193
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
195
|
+
} & {
|
|
196
|
+
title: z.ZodOptional<z.ZodLiteral<"Text Field">>;
|
|
197
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require short, simple answers.">>;
|
|
198
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
schemaVersion: "1.0";
|
|
201
|
+
title?: "Text Field" | undefined;
|
|
202
|
+
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
203
|
+
defaultJSON?: string | undefined;
|
|
204
|
+
}, {
|
|
205
|
+
schemaVersion: "1.0";
|
|
206
|
+
title?: "Text Field" | undefined;
|
|
207
|
+
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
208
|
+
defaultJSON?: string | undefined;
|
|
209
|
+
}>>;
|
|
171
210
|
}, "strip", z.ZodTypeAny, {
|
|
172
211
|
type: "text";
|
|
173
212
|
attributes?: {
|
|
@@ -180,6 +219,9 @@ export declare const TextQuestionSchema: z.ZodObject<{
|
|
|
180
219
|
} | undefined;
|
|
181
220
|
meta?: {
|
|
182
221
|
schemaVersion: "1.0";
|
|
222
|
+
title?: "Text Field" | undefined;
|
|
223
|
+
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
224
|
+
defaultJSON?: string | undefined;
|
|
183
225
|
} | undefined;
|
|
184
226
|
}, {
|
|
185
227
|
type: "text";
|
|
@@ -193,17 +235,12 @@ export declare const TextQuestionSchema: z.ZodObject<{
|
|
|
193
235
|
} | undefined;
|
|
194
236
|
meta?: {
|
|
195
237
|
schemaVersion: "1.0";
|
|
238
|
+
title?: "Text Field" | undefined;
|
|
239
|
+
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
240
|
+
defaultJSON?: string | undefined;
|
|
196
241
|
} | undefined;
|
|
197
242
|
}>;
|
|
198
|
-
export declare const URLQuestionSchema: z.ZodObject<{
|
|
199
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
200
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
201
|
-
}, "strip", z.ZodTypeAny, {
|
|
202
|
-
schemaVersion: "1.0";
|
|
203
|
-
}, {
|
|
204
|
-
schemaVersion: "1.0";
|
|
205
|
-
}>>;
|
|
206
|
-
} & {
|
|
243
|
+
export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
207
244
|
type: z.ZodLiteral<"url">;
|
|
208
245
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
209
246
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -228,6 +265,23 @@ export declare const URLQuestionSchema: z.ZodObject<{
|
|
|
228
265
|
minLength?: number | undefined;
|
|
229
266
|
pattern?: string | undefined;
|
|
230
267
|
}>>;
|
|
268
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
269
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
270
|
+
} & {
|
|
271
|
+
title: z.ZodOptional<z.ZodLiteral<"URL Field">>;
|
|
272
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a website, DOI or other URL.">>;
|
|
273
|
+
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
schemaVersion: "1.0";
|
|
276
|
+
title?: "URL Field" | undefined;
|
|
277
|
+
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
278
|
+
defaultJSON?: string | undefined;
|
|
279
|
+
}, {
|
|
280
|
+
schemaVersion: "1.0";
|
|
281
|
+
title?: "URL Field" | undefined;
|
|
282
|
+
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
283
|
+
defaultJSON?: string | undefined;
|
|
284
|
+
}>>;
|
|
231
285
|
}, "strip", z.ZodTypeAny, {
|
|
232
286
|
type: "url";
|
|
233
287
|
attributes?: {
|
|
@@ -240,6 +294,9 @@ export declare const URLQuestionSchema: z.ZodObject<{
|
|
|
240
294
|
} | undefined;
|
|
241
295
|
meta?: {
|
|
242
296
|
schemaVersion: "1.0";
|
|
297
|
+
title?: "URL Field" | undefined;
|
|
298
|
+
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
299
|
+
defaultJSON?: string | undefined;
|
|
243
300
|
} | undefined;
|
|
244
301
|
}, {
|
|
245
302
|
type: "url";
|
|
@@ -253,6 +310,9 @@ export declare const URLQuestionSchema: z.ZodObject<{
|
|
|
253
310
|
} | undefined;
|
|
254
311
|
meta?: {
|
|
255
312
|
schemaVersion: "1.0";
|
|
313
|
+
title?: "URL Field" | undefined;
|
|
314
|
+
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
315
|
+
defaultJSON?: string | undefined;
|
|
256
316
|
} | undefined;
|
|
257
317
|
}>;
|
|
258
318
|
export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
|
|
@@ -11,32 +11,70 @@ const TextAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
|
11
11
|
pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
|
|
12
12
|
}));
|
|
13
13
|
// Email question and answer
|
|
14
|
+
const defaultEmailJSON = {
|
|
15
|
+
type: 'email',
|
|
16
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { maxLength: 255, minLength: 1, pattern: undefined, multiple: false }),
|
|
17
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
18
|
+
};
|
|
14
19
|
exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
15
|
-
type: zod_1.z.literal('email'),
|
|
20
|
+
type: zod_1.z.literal('email'),
|
|
16
21
|
attributes: TextAttributesSchema.merge(zod_1.z.object({
|
|
17
22
|
multiple: zod_1.z.boolean().optional(), // Allow multiple emails (default is false; comma separated)
|
|
18
23
|
})).optional(),
|
|
24
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
25
|
+
title: zod_1.z.literal('Email Field').optional(),
|
|
26
|
+
usageDescription: zod_1.z.literal('For questions that require require email address(es).').optional(),
|
|
27
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultEmailJSON)).optional(),
|
|
28
|
+
})).optional()
|
|
19
29
|
}));
|
|
20
30
|
// Text area question and answer
|
|
31
|
+
const defaultTextAreaJSON = {
|
|
32
|
+
type: 'textArea',
|
|
33
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { cols: 20, maxLength: undefined, minLength: undefined, rows: 2, asRichText: true }),
|
|
34
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
35
|
+
};
|
|
21
36
|
exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
22
37
|
type: zod_1.z.literal('textArea'), // The type of question
|
|
23
38
|
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
24
39
|
cols: zod_1.z.number().optional(), // The number of columns (default is 20)
|
|
25
40
|
maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
|
|
26
41
|
minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
|
|
27
|
-
rows: zod_1.z.number().optional() // The number of rows (default is 2)
|
|
42
|
+
rows: zod_1.z.number().optional(), // The number of rows (default is 2)
|
|
43
|
+
asRichText: zod_1.z.boolean().optional() // Whether to use a WYSIWYG editor (default true)
|
|
28
44
|
})).optional(),
|
|
29
|
-
meta: BaseMeta.unwrap().
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
46
|
+
title: zod_1.z.literal('Text Area').optional(),
|
|
47
|
+
usageDescription: zod_1.z.literal('For questions that require longer answers, you can select formatting options too.').optional(),
|
|
48
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultTextAreaJSON)).optional(),
|
|
49
|
+
})).optional()
|
|
32
50
|
}));
|
|
33
51
|
// Text question and answer
|
|
52
|
+
const defaultTextJSON = {
|
|
53
|
+
type: 'text',
|
|
54
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { maxLength: 255, minLength: undefined, pattern: undefined }),
|
|
55
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
56
|
+
};
|
|
34
57
|
exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
35
|
-
type: zod_1.z.literal('text'),
|
|
58
|
+
type: zod_1.z.literal('text'),
|
|
36
59
|
attributes: TextAttributesSchema.optional(),
|
|
60
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
61
|
+
title: zod_1.z.literal('Text Field').optional(),
|
|
62
|
+
usageDescription: zod_1.z.literal('For questions that require short, simple answers.').optional(),
|
|
63
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultTextJSON)).optional(),
|
|
64
|
+
})).optional()
|
|
37
65
|
}));
|
|
38
66
|
// URL question and answer
|
|
67
|
+
const defaultURLJSON = {
|
|
68
|
+
type: 'url',
|
|
69
|
+
attributes: Object.assign(Object.assign({}, question_1.defaultAttributes), { maxLength: 255, minLength: undefined, pattern: undefined }),
|
|
70
|
+
meta: Object.assign({}, question_1.defaultMeta)
|
|
71
|
+
};
|
|
39
72
|
exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
40
|
-
type: zod_1.z.literal('url'),
|
|
73
|
+
type: zod_1.z.literal('url'),
|
|
41
74
|
attributes: TextAttributesSchema.optional(),
|
|
75
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
76
|
+
title: zod_1.z.literal('URL Field').optional(),
|
|
77
|
+
usageDescription: zod_1.z.literal('For questions that require a website, DOI or other URL.').optional(),
|
|
78
|
+
defaultJSON: zod_1.z.literal(JSON.stringify(defaultURLJSON)).optional(),
|
|
79
|
+
})).optional()
|
|
42
80
|
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/AffiliationSearchAnswer",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"AffiliationSearchAnswer": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"const": "typeaheadSearch"
|
|
10
|
+
},
|
|
11
|
+
"answer": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"meta": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"schemaVersion": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"const": "1.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"schemaVersion"
|
|
24
|
+
],
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": [
|
|
29
|
+
"type",
|
|
30
|
+
"answer",
|
|
31
|
+
"meta"
|
|
32
|
+
],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
37
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/AffiliationSearchQuestion",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"AffiliationSearchQuestion": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"const": "affiliationSearch"
|
|
10
|
+
},
|
|
11
|
+
"attributes": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"label": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"help": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"labelTranslationKey": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
},
|
|
26
|
+
"meta": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"schemaVersion": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"const": "1.0"
|
|
32
|
+
},
|
|
33
|
+
"title": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"const": "Affiliation Search"
|
|
36
|
+
},
|
|
37
|
+
"usageDescription": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"const": "For questions that require the user to select from a controlled list of institutions."
|
|
40
|
+
},
|
|
41
|
+
"defaultJSON": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"const": "{\"type\":\"affiliationSearch\",\"attributes\":{},\"meta\":{\"schemaVersion\":\"1.0\"},\"graphQL\":{\"query\":\"query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}\",\"queryId\":\"useAffiliationsQuery\",\"variables\":[{\"name\":\"term\",\"type\":\"string\",\"label\":\"Search for your institution\",\"minLength\":3,\"labelTranslationKey\":\"SignupPage.institutionHelp\"}],\"answerField\":\"uri\",\"displayFields\":[{\"label\":\"Institution\",\"propertyName\":\"displayName\",\"labelTranslationKey\":\"SignupPage.institution\"}],\"responseField\":\"affiliations.items\"}}"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"schemaVersion"
|
|
48
|
+
],
|
|
49
|
+
"additionalProperties": false
|
|
50
|
+
},
|
|
51
|
+
"graphQL": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"displayFields": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"propertyName": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"label": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"labelTranslationKey": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"propertyName",
|
|
71
|
+
"label"
|
|
72
|
+
],
|
|
73
|
+
"additionalProperties": false
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"localQueryId": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
},
|
|
79
|
+
"query": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"responseField": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"variables": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": {
|
|
90
|
+
"minLength": {
|
|
91
|
+
"type": "number"
|
|
92
|
+
},
|
|
93
|
+
"label": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"labelTranslationKey": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
},
|
|
99
|
+
"name": {
|
|
100
|
+
"type": "string"
|
|
101
|
+
},
|
|
102
|
+
"type": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
},
|
|
105
|
+
"defaultValue": {
|
|
106
|
+
"type": "string"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": [
|
|
110
|
+
"name",
|
|
111
|
+
"type"
|
|
112
|
+
],
|
|
113
|
+
"additionalProperties": false
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"required": [
|
|
118
|
+
"displayFields",
|
|
119
|
+
"responseField"
|
|
120
|
+
],
|
|
121
|
+
"additionalProperties": false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"required": [
|
|
125
|
+
"type",
|
|
126
|
+
"meta",
|
|
127
|
+
"graphQL"
|
|
128
|
+
],
|
|
129
|
+
"additionalProperties": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
133
|
+
}
|
|
@@ -229,10 +229,7 @@
|
|
|
229
229
|
"const": "selectBox"
|
|
230
230
|
},
|
|
231
231
|
"answer": {
|
|
232
|
-
"type": "
|
|
233
|
-
"items": {
|
|
234
|
-
"type": "string"
|
|
235
|
-
}
|
|
232
|
+
"type": "string"
|
|
236
233
|
},
|
|
237
234
|
"meta": {
|
|
238
235
|
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
@@ -267,6 +264,27 @@
|
|
|
267
264
|
},
|
|
268
265
|
"content": {
|
|
269
266
|
"anyOf": [
|
|
267
|
+
{
|
|
268
|
+
"type": "object",
|
|
269
|
+
"properties": {
|
|
270
|
+
"type": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"const": "typeaheadSearch"
|
|
273
|
+
},
|
|
274
|
+
"answer": {
|
|
275
|
+
"type": "string"
|
|
276
|
+
},
|
|
277
|
+
"meta": {
|
|
278
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"required": [
|
|
282
|
+
"type",
|
|
283
|
+
"answer",
|
|
284
|
+
"meta"
|
|
285
|
+
],
|
|
286
|
+
"additionalProperties": false
|
|
287
|
+
},
|
|
270
288
|
{
|
|
271
289
|
"$ref": "#/definitions/AnyAnswer/anyOf/0"
|
|
272
290
|
},
|
|
@@ -288,24 +306,18 @@
|
|
|
288
306
|
{
|
|
289
307
|
"$ref": "#/definitions/AnyAnswer/anyOf/6"
|
|
290
308
|
},
|
|
291
|
-
{
|
|
292
|
-
"$ref": "#/definitions/AnyAnswer/anyOf/7"
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"$ref": "#/definitions/AnyAnswer/anyOf/8"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"$ref": "#/definitions/AnyAnswer/anyOf/9"
|
|
299
|
-
},
|
|
300
309
|
{
|
|
301
310
|
"type": "object",
|
|
302
311
|
"properties": {
|
|
303
312
|
"type": {
|
|
304
313
|
"type": "string",
|
|
305
|
-
"const": "
|
|
314
|
+
"const": "multiselectBox"
|
|
306
315
|
},
|
|
307
316
|
"answer": {
|
|
308
|
-
"type": "
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": {
|
|
319
|
+
"type": "string"
|
|
320
|
+
}
|
|
309
321
|
},
|
|
310
322
|
"meta": {
|
|
311
323
|
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
@@ -318,12 +330,21 @@
|
|
|
318
330
|
],
|
|
319
331
|
"additionalProperties": false
|
|
320
332
|
},
|
|
333
|
+
{
|
|
334
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/7"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/8"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/9"
|
|
341
|
+
},
|
|
321
342
|
{
|
|
322
343
|
"type": "object",
|
|
323
344
|
"properties": {
|
|
324
345
|
"type": {
|
|
325
346
|
"type": "string",
|
|
326
|
-
"const": "
|
|
347
|
+
"const": "text"
|
|
327
348
|
},
|
|
328
349
|
"answer": {
|
|
329
350
|
"type": "string"
|
|
@@ -344,7 +365,7 @@
|
|
|
344
365
|
"properties": {
|
|
345
366
|
"type": {
|
|
346
367
|
"type": "string",
|
|
347
|
-
"const": "
|
|
368
|
+
"const": "textArea"
|
|
348
369
|
},
|
|
349
370
|
"answer": {
|
|
350
371
|
"type": "string"
|
|
@@ -409,17 +430,14 @@
|
|
|
409
430
|
],
|
|
410
431
|
"additionalProperties": false
|
|
411
432
|
},
|
|
412
|
-
{
|
|
413
|
-
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/properties/columns/items/properties/content/anyOf/10"
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/properties/columns/items/properties/content/anyOf/11"
|
|
417
|
-
},
|
|
418
433
|
{
|
|
419
434
|
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/properties/columns/items/properties/content/anyOf/12"
|
|
420
435
|
},
|
|
421
436
|
{
|
|
422
437
|
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/properties/columns/items/properties/content/anyOf/13"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/properties/columns/items/properties/content/anyOf/14"
|
|
423
441
|
}
|
|
424
442
|
]
|
|
425
443
|
}
|