@dmptool/types 1.1.2 → 1.1.3
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__/graphQLQuestions.spec.js +6 -4
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +4 -12
- package/dist/questions/dateQuestions.d.ts +31 -41
- package/dist/questions/dateQuestions.js +5 -20
- package/dist/questions/graphQLQuestions.d.ts +75 -81
- package/dist/questions/graphQLQuestions.js +18 -24
- package/dist/questions/index.d.ts +524 -723
- package/dist/questions/numberQuestions.d.ts +51 -66
- package/dist/questions/numberQuestions.js +6 -28
- package/dist/questions/optionBasedQuestions.d.ts +44 -69
- package/dist/questions/optionBasedQuestions.js +7 -55
- package/dist/questions/question.d.ts +0 -8
- package/dist/questions/question.js +0 -1
- package/dist/questions/tableQuestions.d.ts +717 -998
- package/dist/questions/tableQuestions.js +3 -10
- package/dist/questions/textQuestions.d.ts +21 -41
- package/dist/questions/textQuestions.js +10 -34
- package/dist/schemas/affiliationSearchQuestion.schema.json +39 -26
- package/dist/schemas/anyQuestion.schema.json +152 -119
- package/dist/schemas/anyTableColumnQuestion.schema.json +142 -104
- package/dist/schemas/booleanQuestion.schema.json +2 -5
- package/dist/schemas/checkboxesQuestion.schema.json +6 -11
- package/dist/schemas/currencyQuestion.schema.json +6 -7
- package/dist/schemas/dateQuestion.schema.json +2 -5
- package/dist/schemas/dateRangeQuestion.schema.json +6 -5
- package/dist/schemas/emailQuestion.schema.json +4 -6
- package/dist/schemas/filteredSearchQuestion.schema.json +0 -3
- package/dist/schemas/multiselectBoxQuestion.schema.json +6 -11
- package/dist/schemas/numberQuestion.schema.json +4 -6
- package/dist/schemas/numberRangeQuestion.schema.json +8 -6
- package/dist/schemas/radioButtonsQuestion.schema.json +6 -11
- package/dist/schemas/selectBoxQuestion.schema.json +7 -15
- package/dist/schemas/tableQuestion.schema.json +148 -111
- package/dist/schemas/textAreaQuestion.schema.json +6 -7
- package/dist/schemas/textQuestion.schema.json +2 -5
- package/dist/schemas/urlQuestion.schema.json +2 -5
- package/package.json +1 -1
|
@@ -32,25 +32,18 @@ exports.TableColumn = zod_1.z.object({
|
|
|
32
32
|
content: exports.AnyTableColumnQuestionSchema, // The question for the column
|
|
33
33
|
});
|
|
34
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
|
-
};
|
|
41
35
|
exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
42
36
|
type: zod_1.z.literal('table'), // The type of question
|
|
43
37
|
columns: zod_1.z.array(exports.TableColumn), // The columns of the table
|
|
44
38
|
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
45
|
-
canAddRows: zod_1.z.boolean().
|
|
46
|
-
canRemoveRows: zod_1.z.boolean().
|
|
47
|
-
initialRows: zod_1.z.number().
|
|
39
|
+
canAddRows: zod_1.z.boolean().default(true),
|
|
40
|
+
canRemoveRows: zod_1.z.boolean().default(true),
|
|
41
|
+
initialRows: zod_1.z.number().default(1),
|
|
48
42
|
maxRows: zod_1.z.number().optional(), // The maximum number of rows (no default)
|
|
49
43
|
minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
|
|
50
44
|
})).optional(),
|
|
51
45
|
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
52
46
|
title: zod_1.z.literal('Table').optional(),
|
|
53
47
|
usageDescription: zod_1.z.literal('For questions that require a tabular format.').optional(),
|
|
54
|
-
defaultJSON: zod_1.z.literal(JSON.stringify(defaultTableJSON)).optional()
|
|
55
48
|
})).optional()
|
|
56
49
|
}));
|
|
@@ -6,19 +6,19 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
6
6
|
help: z.ZodOptional<z.ZodString>;
|
|
7
7
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
8
8
|
} & {
|
|
9
|
-
maxLength: z.
|
|
9
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
10
10
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
pattern: z.ZodOptional<z.ZodString>;
|
|
12
12
|
} & {
|
|
13
|
-
multiple: z.
|
|
13
|
+
multiple: z.ZodDefault<z.ZodBoolean>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
maxLength: number;
|
|
16
|
+
multiple: boolean;
|
|
15
17
|
label?: string | undefined;
|
|
16
18
|
help?: string | undefined;
|
|
17
19
|
labelTranslationKey?: string | undefined;
|
|
18
|
-
maxLength?: number | undefined;
|
|
19
20
|
minLength?: number | undefined;
|
|
20
21
|
pattern?: string | undefined;
|
|
21
|
-
multiple?: boolean | undefined;
|
|
22
22
|
}, {
|
|
23
23
|
label?: string | undefined;
|
|
24
24
|
help?: string | undefined;
|
|
@@ -33,34 +33,30 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
33
33
|
} & {
|
|
34
34
|
title: z.ZodOptional<z.ZodLiteral<"Email Field">>;
|
|
35
35
|
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require require email address(es).">>;
|
|
36
|
-
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
37
36
|
}, "strip", z.ZodTypeAny, {
|
|
38
37
|
schemaVersion: "1.0";
|
|
39
38
|
title?: "Email Field" | undefined;
|
|
40
39
|
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
41
|
-
defaultJSON?: string | undefined;
|
|
42
40
|
}, {
|
|
43
41
|
schemaVersion: "1.0";
|
|
44
42
|
title?: "Email Field" | undefined;
|
|
45
43
|
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
46
|
-
defaultJSON?: string | undefined;
|
|
47
44
|
}>>;
|
|
48
45
|
}, "strip", z.ZodTypeAny, {
|
|
49
46
|
type: "email";
|
|
50
47
|
attributes?: {
|
|
48
|
+
maxLength: number;
|
|
49
|
+
multiple: boolean;
|
|
51
50
|
label?: string | undefined;
|
|
52
51
|
help?: string | undefined;
|
|
53
52
|
labelTranslationKey?: string | undefined;
|
|
54
|
-
maxLength?: number | undefined;
|
|
55
53
|
minLength?: number | undefined;
|
|
56
54
|
pattern?: string | undefined;
|
|
57
|
-
multiple?: boolean | undefined;
|
|
58
55
|
} | undefined;
|
|
59
56
|
meta?: {
|
|
60
57
|
schemaVersion: "1.0";
|
|
61
58
|
title?: "Email Field" | undefined;
|
|
62
59
|
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
63
|
-
defaultJSON?: string | undefined;
|
|
64
60
|
} | undefined;
|
|
65
61
|
}, {
|
|
66
62
|
type: "email";
|
|
@@ -77,7 +73,6 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
77
73
|
schemaVersion: "1.0";
|
|
78
74
|
title?: "Email Field" | undefined;
|
|
79
75
|
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
80
|
-
defaultJSON?: string | undefined;
|
|
81
76
|
} | undefined;
|
|
82
77
|
}>;
|
|
83
78
|
export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
@@ -87,20 +82,20 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
87
82
|
help: z.ZodOptional<z.ZodString>;
|
|
88
83
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
89
84
|
} & {
|
|
90
|
-
cols: z.
|
|
85
|
+
cols: z.ZodDefault<z.ZodNumber>;
|
|
91
86
|
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
92
87
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
93
|
-
rows: z.
|
|
94
|
-
asRichText: z.
|
|
88
|
+
rows: z.ZodDefault<z.ZodNumber>;
|
|
89
|
+
asRichText: z.ZodDefault<z.ZodBoolean>;
|
|
95
90
|
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
cols: number;
|
|
92
|
+
rows: number;
|
|
93
|
+
asRichText: boolean;
|
|
96
94
|
label?: string | undefined;
|
|
97
95
|
help?: string | undefined;
|
|
98
96
|
labelTranslationKey?: string | undefined;
|
|
99
97
|
maxLength?: number | undefined;
|
|
100
98
|
minLength?: number | undefined;
|
|
101
|
-
cols?: number | undefined;
|
|
102
|
-
rows?: number | undefined;
|
|
103
|
-
asRichText?: boolean | undefined;
|
|
104
99
|
}, {
|
|
105
100
|
label?: string | undefined;
|
|
106
101
|
help?: string | undefined;
|
|
@@ -116,35 +111,31 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
116
111
|
} & {
|
|
117
112
|
title: z.ZodOptional<z.ZodLiteral<"Text Area">>;
|
|
118
113
|
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require longer answers, you can select formatting options too.">>;
|
|
119
|
-
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
120
114
|
}, "strip", z.ZodTypeAny, {
|
|
121
115
|
schemaVersion: "1.0";
|
|
122
116
|
title?: "Text Area" | undefined;
|
|
123
117
|
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
124
|
-
defaultJSON?: string | undefined;
|
|
125
118
|
}, {
|
|
126
119
|
schemaVersion: "1.0";
|
|
127
120
|
title?: "Text Area" | undefined;
|
|
128
121
|
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
129
|
-
defaultJSON?: string | undefined;
|
|
130
122
|
}>>;
|
|
131
123
|
}, "strip", z.ZodTypeAny, {
|
|
132
124
|
type: "textArea";
|
|
133
125
|
attributes?: {
|
|
126
|
+
cols: number;
|
|
127
|
+
rows: number;
|
|
128
|
+
asRichText: boolean;
|
|
134
129
|
label?: string | undefined;
|
|
135
130
|
help?: string | undefined;
|
|
136
131
|
labelTranslationKey?: string | undefined;
|
|
137
132
|
maxLength?: number | undefined;
|
|
138
133
|
minLength?: number | undefined;
|
|
139
|
-
cols?: number | undefined;
|
|
140
|
-
rows?: number | undefined;
|
|
141
|
-
asRichText?: boolean | undefined;
|
|
142
134
|
} | undefined;
|
|
143
135
|
meta?: {
|
|
144
136
|
schemaVersion: "1.0";
|
|
145
137
|
title?: "Text Area" | undefined;
|
|
146
138
|
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
147
|
-
defaultJSON?: string | undefined;
|
|
148
139
|
} | undefined;
|
|
149
140
|
}, {
|
|
150
141
|
type: "textArea";
|
|
@@ -162,7 +153,6 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
162
153
|
schemaVersion: "1.0";
|
|
163
154
|
title?: "Text Area" | undefined;
|
|
164
155
|
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
165
|
-
defaultJSON?: string | undefined;
|
|
166
156
|
} | undefined;
|
|
167
157
|
}>;
|
|
168
158
|
export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
@@ -172,14 +162,14 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
172
162
|
help: z.ZodOptional<z.ZodString>;
|
|
173
163
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
174
164
|
} & {
|
|
175
|
-
maxLength: z.
|
|
165
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
176
166
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
177
167
|
pattern: z.ZodOptional<z.ZodString>;
|
|
178
168
|
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
maxLength: number;
|
|
179
170
|
label?: string | undefined;
|
|
180
171
|
help?: string | undefined;
|
|
181
172
|
labelTranslationKey?: string | undefined;
|
|
182
|
-
maxLength?: number | undefined;
|
|
183
173
|
minLength?: number | undefined;
|
|
184
174
|
pattern?: string | undefined;
|
|
185
175
|
}, {
|
|
@@ -195,25 +185,22 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
195
185
|
} & {
|
|
196
186
|
title: z.ZodOptional<z.ZodLiteral<"Text Field">>;
|
|
197
187
|
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require short, simple answers.">>;
|
|
198
|
-
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
199
188
|
}, "strip", z.ZodTypeAny, {
|
|
200
189
|
schemaVersion: "1.0";
|
|
201
190
|
title?: "Text Field" | undefined;
|
|
202
191
|
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
203
|
-
defaultJSON?: string | undefined;
|
|
204
192
|
}, {
|
|
205
193
|
schemaVersion: "1.0";
|
|
206
194
|
title?: "Text Field" | undefined;
|
|
207
195
|
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
208
|
-
defaultJSON?: string | undefined;
|
|
209
196
|
}>>;
|
|
210
197
|
}, "strip", z.ZodTypeAny, {
|
|
211
198
|
type: "text";
|
|
212
199
|
attributes?: {
|
|
200
|
+
maxLength: number;
|
|
213
201
|
label?: string | undefined;
|
|
214
202
|
help?: string | undefined;
|
|
215
203
|
labelTranslationKey?: string | undefined;
|
|
216
|
-
maxLength?: number | undefined;
|
|
217
204
|
minLength?: number | undefined;
|
|
218
205
|
pattern?: string | undefined;
|
|
219
206
|
} | undefined;
|
|
@@ -221,7 +208,6 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
221
208
|
schemaVersion: "1.0";
|
|
222
209
|
title?: "Text Field" | undefined;
|
|
223
210
|
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
224
|
-
defaultJSON?: string | undefined;
|
|
225
211
|
} | undefined;
|
|
226
212
|
}, {
|
|
227
213
|
type: "text";
|
|
@@ -237,7 +223,6 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
237
223
|
schemaVersion: "1.0";
|
|
238
224
|
title?: "Text Field" | undefined;
|
|
239
225
|
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
240
|
-
defaultJSON?: string | undefined;
|
|
241
226
|
} | undefined;
|
|
242
227
|
}>;
|
|
243
228
|
export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
@@ -247,14 +232,14 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
247
232
|
help: z.ZodOptional<z.ZodString>;
|
|
248
233
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
249
234
|
} & {
|
|
250
|
-
maxLength: z.
|
|
235
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
251
236
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
252
237
|
pattern: z.ZodOptional<z.ZodString>;
|
|
253
238
|
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
maxLength: number;
|
|
254
240
|
label?: string | undefined;
|
|
255
241
|
help?: string | undefined;
|
|
256
242
|
labelTranslationKey?: string | undefined;
|
|
257
|
-
maxLength?: number | undefined;
|
|
258
243
|
minLength?: number | undefined;
|
|
259
244
|
pattern?: string | undefined;
|
|
260
245
|
}, {
|
|
@@ -270,25 +255,22 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
270
255
|
} & {
|
|
271
256
|
title: z.ZodOptional<z.ZodLiteral<"URL Field">>;
|
|
272
257
|
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a website, DOI or other URL.">>;
|
|
273
|
-
defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
|
|
274
258
|
}, "strip", z.ZodTypeAny, {
|
|
275
259
|
schemaVersion: "1.0";
|
|
276
260
|
title?: "URL Field" | undefined;
|
|
277
261
|
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
278
|
-
defaultJSON?: string | undefined;
|
|
279
262
|
}, {
|
|
280
263
|
schemaVersion: "1.0";
|
|
281
264
|
title?: "URL Field" | undefined;
|
|
282
265
|
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
283
|
-
defaultJSON?: string | undefined;
|
|
284
266
|
}>>;
|
|
285
267
|
}, "strip", z.ZodTypeAny, {
|
|
286
268
|
type: "url";
|
|
287
269
|
attributes?: {
|
|
270
|
+
maxLength: number;
|
|
288
271
|
label?: string | undefined;
|
|
289
272
|
help?: string | undefined;
|
|
290
273
|
labelTranslationKey?: string | undefined;
|
|
291
|
-
maxLength?: number | undefined;
|
|
292
274
|
minLength?: number | undefined;
|
|
293
275
|
pattern?: string | undefined;
|
|
294
276
|
} | undefined;
|
|
@@ -296,7 +278,6 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
296
278
|
schemaVersion: "1.0";
|
|
297
279
|
title?: "URL Field" | undefined;
|
|
298
280
|
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
299
|
-
defaultJSON?: string | undefined;
|
|
300
281
|
} | undefined;
|
|
301
282
|
}, {
|
|
302
283
|
type: "url";
|
|
@@ -312,7 +293,6 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
312
293
|
schemaVersion: "1.0";
|
|
313
294
|
title?: "URL Field" | undefined;
|
|
314
295
|
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
315
|
-
defaultJSON?: string | undefined;
|
|
316
296
|
} | undefined;
|
|
317
297
|
}>;
|
|
318
298
|
export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
|
|
@@ -6,75 +6,51 @@ const question_1 = require("./question");
|
|
|
6
6
|
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
7
7
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
8
8
|
const TextAttributesSchema = BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
9
|
-
maxLength: zod_1.z.number().
|
|
10
|
-
minLength: zod_1.z.number().optional(),
|
|
11
|
-
pattern: zod_1.z.string().optional()
|
|
9
|
+
maxLength: zod_1.z.number().default(255),
|
|
10
|
+
minLength: zod_1.z.number().optional(),
|
|
11
|
+
pattern: zod_1.z.string().optional()
|
|
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
|
-
};
|
|
19
14
|
exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
20
15
|
type: zod_1.z.literal('email'),
|
|
21
16
|
attributes: TextAttributesSchema.merge(zod_1.z.object({
|
|
22
|
-
multiple: zod_1.z.boolean().
|
|
17
|
+
multiple: zod_1.z.boolean().default(false),
|
|
23
18
|
})).optional(),
|
|
24
19
|
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
25
20
|
title: zod_1.z.literal('Email Field').optional(),
|
|
26
21
|
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
22
|
})).optional()
|
|
29
23
|
}));
|
|
30
24
|
// 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
|
-
};
|
|
36
25
|
exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
37
|
-
type: zod_1.z.literal('textArea'),
|
|
26
|
+
type: zod_1.z.literal('textArea'),
|
|
38
27
|
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
39
|
-
cols: zod_1.z.number().
|
|
40
|
-
maxLength: zod_1.z.number().optional(),
|
|
41
|
-
minLength: zod_1.z.number().optional(),
|
|
42
|
-
rows: zod_1.z.number().
|
|
43
|
-
asRichText: zod_1.z.boolean().
|
|
28
|
+
cols: zod_1.z.number().default(20),
|
|
29
|
+
maxLength: zod_1.z.number().optional(),
|
|
30
|
+
minLength: zod_1.z.number().optional(),
|
|
31
|
+
rows: zod_1.z.number().default(2),
|
|
32
|
+
asRichText: zod_1.z.boolean().default(true),
|
|
44
33
|
})).optional(),
|
|
45
34
|
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
46
35
|
title: zod_1.z.literal('Text Area').optional(),
|
|
47
36
|
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
37
|
})).optional()
|
|
50
38
|
}));
|
|
51
39
|
// 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
|
-
};
|
|
57
40
|
exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
58
41
|
type: zod_1.z.literal('text'),
|
|
59
42
|
attributes: TextAttributesSchema.optional(),
|
|
60
43
|
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
61
44
|
title: zod_1.z.literal('Text Field').optional(),
|
|
62
45
|
usageDescription: zod_1.z.literal('For questions that require short, simple answers.').optional(),
|
|
63
|
-
defaultJSON: zod_1.z.literal(JSON.stringify(defaultTextJSON)).optional(),
|
|
64
46
|
})).optional()
|
|
65
47
|
}));
|
|
66
48
|
// 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
|
-
};
|
|
72
49
|
exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
73
50
|
type: zod_1.z.literal('url'),
|
|
74
51
|
attributes: TextAttributesSchema.optional(),
|
|
75
52
|
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
76
53
|
title: zod_1.z.literal('URL Field').optional(),
|
|
77
54
|
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
55
|
})).optional()
|
|
80
56
|
}));
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
"usageDescription": {
|
|
38
38
|
"type": "string",
|
|
39
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
40
|
}
|
|
45
41
|
},
|
|
46
42
|
"required": [
|
|
@@ -57,18 +53,20 @@
|
|
|
57
53
|
"type": "object",
|
|
58
54
|
"properties": {
|
|
59
55
|
"propertyName": {
|
|
60
|
-
"type": "string"
|
|
56
|
+
"type": "string",
|
|
57
|
+
"const": "displayName"
|
|
61
58
|
},
|
|
62
59
|
"label": {
|
|
63
|
-
"type": "string"
|
|
60
|
+
"type": "string",
|
|
61
|
+
"default": "Institution"
|
|
64
62
|
},
|
|
65
63
|
"labelTranslationKey": {
|
|
66
|
-
"type": "string"
|
|
64
|
+
"type": "string",
|
|
65
|
+
"default": "SignupPage.institution"
|
|
67
66
|
}
|
|
68
67
|
},
|
|
69
68
|
"required": [
|
|
70
|
-
"propertyName"
|
|
71
|
-
"label"
|
|
69
|
+
"propertyName"
|
|
72
70
|
],
|
|
73
71
|
"additionalProperties": false
|
|
74
72
|
}
|
|
@@ -77,46 +75,61 @@
|
|
|
77
75
|
"type": "string"
|
|
78
76
|
},
|
|
79
77
|
"query": {
|
|
80
|
-
"type": "string"
|
|
78
|
+
"type": "string",
|
|
79
|
+
"const": "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}"
|
|
81
80
|
},
|
|
82
81
|
"responseField": {
|
|
83
|
-
"type": "string"
|
|
82
|
+
"type": "string",
|
|
83
|
+
"const": "affiliations.items"
|
|
84
84
|
},
|
|
85
85
|
"variables": {
|
|
86
86
|
"type": "array",
|
|
87
87
|
"items": {
|
|
88
88
|
"type": "object",
|
|
89
89
|
"properties": {
|
|
90
|
-
"minLength": {
|
|
91
|
-
"type": "number"
|
|
92
|
-
},
|
|
93
|
-
"label": {
|
|
94
|
-
"type": "string"
|
|
95
|
-
},
|
|
96
|
-
"labelTranslationKey": {
|
|
97
|
-
"type": "string"
|
|
98
|
-
},
|
|
99
90
|
"name": {
|
|
100
|
-
"type": "string"
|
|
91
|
+
"type": "string",
|
|
92
|
+
"const": "name"
|
|
101
93
|
},
|
|
102
94
|
"type": {
|
|
103
|
-
"type": "string"
|
|
95
|
+
"type": "string",
|
|
96
|
+
"default": "string"
|
|
97
|
+
},
|
|
98
|
+
"label": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"default": "Search for your institution"
|
|
101
|
+
},
|
|
102
|
+
"minLength": {
|
|
103
|
+
"type": "number",
|
|
104
|
+
"const": 3
|
|
104
105
|
},
|
|
105
|
-
"
|
|
106
|
-
"type": "string"
|
|
106
|
+
"labelTranslationKey": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"default": "SignupPage.institutionHelp"
|
|
107
109
|
}
|
|
108
110
|
},
|
|
109
111
|
"required": [
|
|
110
112
|
"name",
|
|
111
|
-
"
|
|
113
|
+
"minLength"
|
|
112
114
|
],
|
|
113
115
|
"additionalProperties": false
|
|
114
116
|
}
|
|
117
|
+
},
|
|
118
|
+
"queryId": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"default": "useAffiliationsQuery"
|
|
121
|
+
},
|
|
122
|
+
"answerField": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"const": "uri"
|
|
115
125
|
}
|
|
116
126
|
},
|
|
117
127
|
"required": [
|
|
118
128
|
"displayFields",
|
|
119
|
-
"
|
|
129
|
+
"query",
|
|
130
|
+
"responseField",
|
|
131
|
+
"variables",
|
|
132
|
+
"answerField"
|
|
120
133
|
],
|
|
121
134
|
"additionalProperties": false
|
|
122
135
|
}
|