@dmptool/types 1.1.3 → 1.2.0
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 +119 -47
- package/dist/answers/__tests__/answers.spec.js +20 -28
- package/dist/answers/__tests__/usage.spec.d.ts +1 -0
- package/dist/answers/__tests__/usage.spec.js +175 -0
- package/dist/answers/answer.d.ts +12 -15
- package/dist/answers/answer.js +3 -4
- package/dist/answers/dateAnswers.d.ts +30 -30
- package/dist/answers/dateAnswers.js +6 -5
- package/dist/answers/graphQLAnswers.d.ts +25 -25
- package/dist/answers/graphQLAnswers.js +4 -4
- package/dist/answers/index.d.ts +860 -1088
- package/dist/answers/index.js +2 -2
- package/dist/answers/numberAnswers.d.ts +41 -41
- package/dist/answers/numberAnswers.js +8 -8
- package/dist/answers/optionBasedAnswers.d.ts +55 -55
- package/dist/answers/optionBasedAnswers.js +10 -10
- package/dist/answers/tableAnswers.d.ts +811 -1772
- package/dist/answers/tableAnswers.js +12 -8
- package/dist/answers/textAnswers.d.ts +44 -44
- package/dist/answers/textAnswers.js +8 -8
- package/dist/questions/__tests__/graphQLQuestions.spec.js +1 -1
- package/dist/questions/__tests__/usage.spec.d.ts +8 -0
- package/dist/questions/__tests__/usage.spec.js +312 -0
- package/dist/questions/dateQuestions.d.ts +81 -82
- package/dist/questions/dateQuestions.js +12 -16
- package/dist/questions/graphQLQuestions.d.ts +142 -142
- package/dist/questions/graphQLQuestions.js +35 -30
- package/dist/questions/index.d.ts +1494 -1674
- package/dist/questions/index.js +2 -2
- package/dist/questions/numberQuestions.d.ts +97 -98
- package/dist/questions/numberQuestions.js +7 -19
- package/dist/questions/optionBasedQuestions.d.ts +163 -166
- package/dist/questions/optionBasedQuestions.js +20 -36
- package/dist/questions/question.d.ts +24 -48
- package/dist/questions/question.js +78 -17
- package/dist/questions/tableQuestions.d.ts +2219 -2231
- package/dist/questions/tableQuestions.js +6 -11
- package/dist/questions/textQuestions.d.ts +104 -104
- package/dist/questions/textQuestions.js +6 -23
- package/dist/schemas/affiliationSearchAnswer.schema.json +9 -12
- package/dist/schemas/affiliationSearchQuestion.schema.json +30 -36
- package/dist/schemas/anyAnswer.schema.json +228 -237
- package/dist/schemas/anyQuestion.schema.json +292 -493
- package/dist/schemas/anyTableColumnAnswer.schema.json +93 -106
- package/dist/schemas/anyTableColumnQuestion.schema.json +164 -325
- package/dist/schemas/booleanAnswer.schema.json +8 -11
- package/dist/schemas/booleanQuestion.schema.json +7 -10
- package/dist/schemas/checkboxesAnswer.schema.json +13 -14
- package/dist/schemas/checkboxesQuestion.schema.json +12 -13
- package/dist/schemas/currencyAnswer.schema.json +8 -11
- package/dist/schemas/currencyQuestion.schema.json +7 -10
- package/dist/schemas/dateAnswer.schema.json +8 -11
- package/dist/schemas/dateQuestion.schema.json +7 -10
- package/dist/schemas/dateRangeAnswer.schema.json +16 -21
- package/dist/schemas/dateRangeQuestion.schema.json +38 -20
- package/dist/schemas/emailAnswer.schema.json +8 -11
- package/dist/schemas/emailQuestion.schema.json +7 -10
- package/dist/schemas/multiselectBoxAnswer.schema.json +13 -14
- package/dist/schemas/multiselectBoxQuestion.schema.json +14 -14
- package/dist/schemas/numberAnswer.schema.json +8 -11
- package/dist/schemas/numberQuestion.schema.json +7 -10
- package/dist/schemas/numberRangeAnswer.schema.json +17 -22
- package/dist/schemas/numberRangeQuestion.schema.json +18 -19
- package/dist/schemas/radioButtonsAnswer.schema.json +8 -11
- package/dist/schemas/radioButtonsQuestion.schema.json +12 -13
- package/dist/schemas/selectBoxAnswer.schema.json +8 -11
- package/dist/schemas/selectBoxQuestion.schema.json +18 -15
- package/dist/schemas/tableAnswer.schema.json +337 -343
- package/dist/schemas/tableQuestion.schema.json +178 -352
- package/dist/schemas/textAnswer.schema.json +8 -11
- package/dist/schemas/textAreaAnswer.schema.json +8 -11
- package/dist/schemas/textAreaQuestion.schema.json +7 -10
- package/dist/schemas/textQuestion.schema.json +7 -10
- package/dist/schemas/urlAnswer.schema.json +8 -11
- package/dist/schemas/urlQuestion.schema.json +7 -10
- package/package.json +1 -1
|
@@ -9,7 +9,6 @@ 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;
|
|
13
12
|
// Union types for all questions and answers (tables cannot be nested so no TableQuestion here!)
|
|
14
13
|
exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
15
14
|
graphQLQuestions_1.AffiliationSearchQuestionSchema,
|
|
@@ -28,22 +27,18 @@ exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
28
27
|
textQuestions_1.URLQuestionSchema
|
|
29
28
|
]);
|
|
30
29
|
exports.TableColumn = zod_1.z.object({
|
|
31
|
-
heading: zod_1.z.string().
|
|
32
|
-
content: exports.AnyTableColumnQuestionSchema, // The question for the column
|
|
30
|
+
heading: zod_1.z.string().default('Column A'), // The heading of the column
|
|
31
|
+
content: exports.AnyTableColumnQuestionSchema.default({ type: 'textArea' }), // The question for the column
|
|
33
32
|
});
|
|
34
33
|
// Table question and answer
|
|
35
34
|
exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
36
|
-
type: zod_1.z.literal('table'),
|
|
37
|
-
columns: zod_1.z.array(exports.TableColumn), // The columns of the table
|
|
38
|
-
attributes: BaseAttributes.
|
|
35
|
+
type: zod_1.z.literal('table'),
|
|
36
|
+
columns: zod_1.z.array(exports.TableColumn).default([{}]), // The columns of the table
|
|
37
|
+
attributes: BaseAttributes.merge(zod_1.z.object({
|
|
39
38
|
canAddRows: zod_1.z.boolean().default(true),
|
|
40
39
|
canRemoveRows: zod_1.z.boolean().default(true),
|
|
41
40
|
initialRows: zod_1.z.number().default(1),
|
|
42
41
|
maxRows: zod_1.z.number().optional(), // The maximum number of rows (no default)
|
|
43
42
|
minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
|
|
44
|
-
})).
|
|
45
|
-
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
46
|
-
title: zod_1.z.literal('Table').optional(),
|
|
47
|
-
usageDescription: zod_1.z.literal('For questions that require a tabular format.').optional(),
|
|
48
|
-
})).optional()
|
|
43
|
+
})).default({})
|
|
49
44
|
}));
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const EmailQuestionSchema: z.ZodObject<{
|
|
2
|
+
export declare const EmailQuestionSchema: z.ZodObject<{
|
|
3
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
5
|
+
title: z.ZodOptional<z.ZodString>;
|
|
6
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
schemaVersion: string;
|
|
9
|
+
title?: string | undefined;
|
|
10
|
+
usageDescription?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
schemaVersion?: string | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
usageDescription?: string | undefined;
|
|
15
|
+
}>>;
|
|
16
|
+
} & {
|
|
3
17
|
type: z.ZodLiteral<"email">;
|
|
4
|
-
attributes: z.
|
|
18
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
5
19
|
label: z.ZodOptional<z.ZodString>;
|
|
6
20
|
help: z.ZodOptional<z.ZodString>;
|
|
7
21
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -28,23 +42,9 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
28
42
|
pattern?: string | undefined;
|
|
29
43
|
multiple?: boolean | undefined;
|
|
30
44
|
}>>;
|
|
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
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
schemaVersion: "1.0";
|
|
38
|
-
title?: "Email Field" | undefined;
|
|
39
|
-
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
40
|
-
}, {
|
|
41
|
-
schemaVersion: "1.0";
|
|
42
|
-
title?: "Email Field" | undefined;
|
|
43
|
-
usageDescription?: "For questions that require require email address(es)." | undefined;
|
|
44
|
-
}>>;
|
|
45
45
|
}, "strip", z.ZodTypeAny, {
|
|
46
46
|
type: "email";
|
|
47
|
-
attributes
|
|
47
|
+
attributes: {
|
|
48
48
|
maxLength: number;
|
|
49
49
|
multiple: boolean;
|
|
50
50
|
label?: string | undefined;
|
|
@@ -52,12 +52,12 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
52
52
|
labelTranslationKey?: string | undefined;
|
|
53
53
|
minLength?: number | undefined;
|
|
54
54
|
pattern?: string | undefined;
|
|
55
|
-
}
|
|
56
|
-
meta
|
|
57
|
-
schemaVersion:
|
|
58
|
-
title?:
|
|
59
|
-
usageDescription?:
|
|
60
|
-
}
|
|
55
|
+
};
|
|
56
|
+
meta: {
|
|
57
|
+
schemaVersion: string;
|
|
58
|
+
title?: string | undefined;
|
|
59
|
+
usageDescription?: string | undefined;
|
|
60
|
+
};
|
|
61
61
|
}, {
|
|
62
62
|
type: "email";
|
|
63
63
|
attributes?: {
|
|
@@ -70,14 +70,28 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
70
70
|
multiple?: boolean | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
meta?: {
|
|
73
|
-
schemaVersion
|
|
74
|
-
title?:
|
|
75
|
-
usageDescription?:
|
|
73
|
+
schemaVersion?: string | undefined;
|
|
74
|
+
title?: string | undefined;
|
|
75
|
+
usageDescription?: string | undefined;
|
|
76
76
|
} | undefined;
|
|
77
77
|
}>;
|
|
78
|
-
export declare const TextAreaQuestionSchema: z.ZodObject<{
|
|
78
|
+
export declare const TextAreaQuestionSchema: z.ZodObject<{
|
|
79
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
80
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
81
|
+
title: z.ZodOptional<z.ZodString>;
|
|
82
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
schemaVersion: string;
|
|
85
|
+
title?: string | undefined;
|
|
86
|
+
usageDescription?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
schemaVersion?: string | undefined;
|
|
89
|
+
title?: string | undefined;
|
|
90
|
+
usageDescription?: string | undefined;
|
|
91
|
+
}>>;
|
|
92
|
+
} & {
|
|
79
93
|
type: z.ZodLiteral<"textArea">;
|
|
80
|
-
attributes: z.
|
|
94
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
81
95
|
label: z.ZodOptional<z.ZodString>;
|
|
82
96
|
help: z.ZodOptional<z.ZodString>;
|
|
83
97
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -106,23 +120,9 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
106
120
|
rows?: number | undefined;
|
|
107
121
|
asRichText?: boolean | undefined;
|
|
108
122
|
}>>;
|
|
109
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
110
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
111
|
-
} & {
|
|
112
|
-
title: z.ZodOptional<z.ZodLiteral<"Text Area">>;
|
|
113
|
-
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require longer answers, you can select formatting options too.">>;
|
|
114
|
-
}, "strip", z.ZodTypeAny, {
|
|
115
|
-
schemaVersion: "1.0";
|
|
116
|
-
title?: "Text Area" | undefined;
|
|
117
|
-
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
118
|
-
}, {
|
|
119
|
-
schemaVersion: "1.0";
|
|
120
|
-
title?: "Text Area" | undefined;
|
|
121
|
-
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
122
|
-
}>>;
|
|
123
123
|
}, "strip", z.ZodTypeAny, {
|
|
124
124
|
type: "textArea";
|
|
125
|
-
attributes
|
|
125
|
+
attributes: {
|
|
126
126
|
cols: number;
|
|
127
127
|
rows: number;
|
|
128
128
|
asRichText: boolean;
|
|
@@ -131,12 +131,12 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
131
131
|
labelTranslationKey?: string | undefined;
|
|
132
132
|
maxLength?: number | undefined;
|
|
133
133
|
minLength?: number | undefined;
|
|
134
|
-
}
|
|
135
|
-
meta
|
|
136
|
-
schemaVersion:
|
|
137
|
-
title?:
|
|
138
|
-
usageDescription?:
|
|
139
|
-
}
|
|
134
|
+
};
|
|
135
|
+
meta: {
|
|
136
|
+
schemaVersion: string;
|
|
137
|
+
title?: string | undefined;
|
|
138
|
+
usageDescription?: string | undefined;
|
|
139
|
+
};
|
|
140
140
|
}, {
|
|
141
141
|
type: "textArea";
|
|
142
142
|
attributes?: {
|
|
@@ -150,14 +150,28 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
150
150
|
asRichText?: boolean | undefined;
|
|
151
151
|
} | undefined;
|
|
152
152
|
meta?: {
|
|
153
|
-
schemaVersion
|
|
154
|
-
title?:
|
|
155
|
-
usageDescription?:
|
|
153
|
+
schemaVersion?: string | undefined;
|
|
154
|
+
title?: string | undefined;
|
|
155
|
+
usageDescription?: string | undefined;
|
|
156
156
|
} | undefined;
|
|
157
157
|
}>;
|
|
158
|
-
export declare const TextQuestionSchema: z.ZodObject<{
|
|
158
|
+
export declare const TextQuestionSchema: z.ZodObject<{
|
|
159
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
160
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
161
|
+
title: z.ZodOptional<z.ZodString>;
|
|
162
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
schemaVersion: string;
|
|
165
|
+
title?: string | undefined;
|
|
166
|
+
usageDescription?: string | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
schemaVersion?: string | undefined;
|
|
169
|
+
title?: string | undefined;
|
|
170
|
+
usageDescription?: string | undefined;
|
|
171
|
+
}>>;
|
|
172
|
+
} & {
|
|
159
173
|
type: z.ZodLiteral<"text">;
|
|
160
|
-
attributes: z.
|
|
174
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
161
175
|
label: z.ZodOptional<z.ZodString>;
|
|
162
176
|
help: z.ZodOptional<z.ZodString>;
|
|
163
177
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -180,35 +194,21 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
180
194
|
minLength?: number | undefined;
|
|
181
195
|
pattern?: string | undefined;
|
|
182
196
|
}>>;
|
|
183
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
184
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
185
|
-
} & {
|
|
186
|
-
title: z.ZodOptional<z.ZodLiteral<"Text Field">>;
|
|
187
|
-
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require short, simple answers.">>;
|
|
188
|
-
}, "strip", z.ZodTypeAny, {
|
|
189
|
-
schemaVersion: "1.0";
|
|
190
|
-
title?: "Text Field" | undefined;
|
|
191
|
-
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
192
|
-
}, {
|
|
193
|
-
schemaVersion: "1.0";
|
|
194
|
-
title?: "Text Field" | undefined;
|
|
195
|
-
usageDescription?: "For questions that require short, simple answers." | undefined;
|
|
196
|
-
}>>;
|
|
197
197
|
}, "strip", z.ZodTypeAny, {
|
|
198
198
|
type: "text";
|
|
199
|
-
attributes
|
|
199
|
+
attributes: {
|
|
200
200
|
maxLength: number;
|
|
201
201
|
label?: string | undefined;
|
|
202
202
|
help?: string | undefined;
|
|
203
203
|
labelTranslationKey?: string | undefined;
|
|
204
204
|
minLength?: number | undefined;
|
|
205
205
|
pattern?: string | undefined;
|
|
206
|
-
}
|
|
207
|
-
meta
|
|
208
|
-
schemaVersion:
|
|
209
|
-
title?:
|
|
210
|
-
usageDescription?:
|
|
211
|
-
}
|
|
206
|
+
};
|
|
207
|
+
meta: {
|
|
208
|
+
schemaVersion: string;
|
|
209
|
+
title?: string | undefined;
|
|
210
|
+
usageDescription?: string | undefined;
|
|
211
|
+
};
|
|
212
212
|
}, {
|
|
213
213
|
type: "text";
|
|
214
214
|
attributes?: {
|
|
@@ -220,14 +220,28 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
220
220
|
pattern?: string | undefined;
|
|
221
221
|
} | undefined;
|
|
222
222
|
meta?: {
|
|
223
|
-
schemaVersion
|
|
224
|
-
title?:
|
|
225
|
-
usageDescription?:
|
|
223
|
+
schemaVersion?: string | undefined;
|
|
224
|
+
title?: string | undefined;
|
|
225
|
+
usageDescription?: string | undefined;
|
|
226
226
|
} | undefined;
|
|
227
227
|
}>;
|
|
228
|
-
export declare const URLQuestionSchema: z.ZodObject<{
|
|
228
|
+
export declare const URLQuestionSchema: z.ZodObject<{
|
|
229
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
230
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
231
|
+
title: z.ZodOptional<z.ZodString>;
|
|
232
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
schemaVersion: string;
|
|
235
|
+
title?: string | undefined;
|
|
236
|
+
usageDescription?: string | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
schemaVersion?: string | undefined;
|
|
239
|
+
title?: string | undefined;
|
|
240
|
+
usageDescription?: string | undefined;
|
|
241
|
+
}>>;
|
|
242
|
+
} & {
|
|
229
243
|
type: z.ZodLiteral<"url">;
|
|
230
|
-
attributes: z.
|
|
244
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
231
245
|
label: z.ZodOptional<z.ZodString>;
|
|
232
246
|
help: z.ZodOptional<z.ZodString>;
|
|
233
247
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -250,35 +264,21 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
250
264
|
minLength?: number | undefined;
|
|
251
265
|
pattern?: string | undefined;
|
|
252
266
|
}>>;
|
|
253
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
254
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
255
|
-
} & {
|
|
256
|
-
title: z.ZodOptional<z.ZodLiteral<"URL Field">>;
|
|
257
|
-
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require a website, DOI or other URL.">>;
|
|
258
|
-
}, "strip", z.ZodTypeAny, {
|
|
259
|
-
schemaVersion: "1.0";
|
|
260
|
-
title?: "URL Field" | undefined;
|
|
261
|
-
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
262
|
-
}, {
|
|
263
|
-
schemaVersion: "1.0";
|
|
264
|
-
title?: "URL Field" | undefined;
|
|
265
|
-
usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
|
|
266
|
-
}>>;
|
|
267
267
|
}, "strip", z.ZodTypeAny, {
|
|
268
268
|
type: "url";
|
|
269
|
-
attributes
|
|
269
|
+
attributes: {
|
|
270
270
|
maxLength: number;
|
|
271
271
|
label?: string | undefined;
|
|
272
272
|
help?: string | undefined;
|
|
273
273
|
labelTranslationKey?: string | undefined;
|
|
274
274
|
minLength?: number | undefined;
|
|
275
275
|
pattern?: string | undefined;
|
|
276
|
-
}
|
|
277
|
-
meta
|
|
278
|
-
schemaVersion:
|
|
279
|
-
title?:
|
|
280
|
-
usageDescription?:
|
|
281
|
-
}
|
|
276
|
+
};
|
|
277
|
+
meta: {
|
|
278
|
+
schemaVersion: string;
|
|
279
|
+
title?: string | undefined;
|
|
280
|
+
usageDescription?: string | undefined;
|
|
281
|
+
};
|
|
282
282
|
}, {
|
|
283
283
|
type: "url";
|
|
284
284
|
attributes?: {
|
|
@@ -290,9 +290,9 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
290
290
|
pattern?: string | undefined;
|
|
291
291
|
} | undefined;
|
|
292
292
|
meta?: {
|
|
293
|
-
schemaVersion
|
|
294
|
-
title?:
|
|
295
|
-
usageDescription?:
|
|
293
|
+
schemaVersion?: string | undefined;
|
|
294
|
+
title?: string | undefined;
|
|
295
|
+
usageDescription?: string | undefined;
|
|
296
296
|
} | undefined;
|
|
297
297
|
}>;
|
|
298
298
|
export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
|
-
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
7
6
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
8
|
-
const TextAttributesSchema = BaseAttributes.
|
|
7
|
+
const TextAttributesSchema = BaseAttributes.merge(zod_1.z.object({
|
|
9
8
|
maxLength: zod_1.z.number().default(255),
|
|
10
9
|
minLength: zod_1.z.number().optional(),
|
|
11
10
|
pattern: zod_1.z.string().optional()
|
|
@@ -15,42 +14,26 @@ exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
|
15
14
|
type: zod_1.z.literal('email'),
|
|
16
15
|
attributes: TextAttributesSchema.merge(zod_1.z.object({
|
|
17
16
|
multiple: zod_1.z.boolean().default(false),
|
|
18
|
-
})).
|
|
19
|
-
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
20
|
-
title: zod_1.z.literal('Email Field').optional(),
|
|
21
|
-
usageDescription: zod_1.z.literal('For questions that require require email address(es).').optional(),
|
|
22
|
-
})).optional()
|
|
17
|
+
})).default({})
|
|
23
18
|
}));
|
|
24
19
|
// Text area question and answer
|
|
25
20
|
exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
26
21
|
type: zod_1.z.literal('textArea'),
|
|
27
|
-
attributes: BaseAttributes.
|
|
22
|
+
attributes: BaseAttributes.merge(zod_1.z.object({
|
|
28
23
|
cols: zod_1.z.number().default(20),
|
|
29
24
|
maxLength: zod_1.z.number().optional(),
|
|
30
25
|
minLength: zod_1.z.number().optional(),
|
|
31
26
|
rows: zod_1.z.number().default(2),
|
|
32
27
|
asRichText: zod_1.z.boolean().default(true),
|
|
33
|
-
})).
|
|
34
|
-
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
35
|
-
title: zod_1.z.literal('Text Area').optional(),
|
|
36
|
-
usageDescription: zod_1.z.literal('For questions that require longer answers, you can select formatting options too.').optional(),
|
|
37
|
-
})).optional()
|
|
28
|
+
})).default({})
|
|
38
29
|
}));
|
|
39
30
|
// Text question and answer
|
|
40
31
|
exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
41
32
|
type: zod_1.z.literal('text'),
|
|
42
|
-
attributes: TextAttributesSchema.
|
|
43
|
-
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
44
|
-
title: zod_1.z.literal('Text Field').optional(),
|
|
45
|
-
usageDescription: zod_1.z.literal('For questions that require short, simple answers.').optional(),
|
|
46
|
-
})).optional()
|
|
33
|
+
attributes: TextAttributesSchema.default({})
|
|
47
34
|
}));
|
|
48
35
|
// URL question and answer
|
|
49
36
|
exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
50
37
|
type: zod_1.z.literal('url'),
|
|
51
|
-
attributes: TextAttributesSchema.
|
|
52
|
-
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
53
|
-
title: zod_1.z.literal('URL Field').optional(),
|
|
54
|
-
usageDescription: zod_1.z.literal('For questions that require a website, DOI or other URL.').optional(),
|
|
55
|
-
})).optional()
|
|
38
|
+
attributes: TextAttributesSchema.default({})
|
|
56
39
|
}));
|
|
@@ -6,29 +6,26 @@
|
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
8
8
|
"type": "string",
|
|
9
|
-
"const": "
|
|
10
|
-
},
|
|
11
|
-
"answer": {
|
|
12
|
-
"type": "string"
|
|
9
|
+
"const": "affiliationSearch"
|
|
13
10
|
},
|
|
14
11
|
"meta": {
|
|
15
12
|
"type": "object",
|
|
16
13
|
"properties": {
|
|
17
14
|
"schemaVersion": {
|
|
18
15
|
"type": "string",
|
|
19
|
-
"
|
|
16
|
+
"default": "1.0"
|
|
20
17
|
}
|
|
21
18
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"default": {}
|
|
21
|
+
},
|
|
22
|
+
"answer": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"default": ""
|
|
26
25
|
}
|
|
27
26
|
},
|
|
28
27
|
"required": [
|
|
29
|
-
"type"
|
|
30
|
-
"answer",
|
|
31
|
-
"meta"
|
|
28
|
+
"type"
|
|
32
29
|
],
|
|
33
30
|
"additionalProperties": false
|
|
34
31
|
}
|
|
@@ -21,28 +21,25 @@
|
|
|
21
21
|
"type": "string"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"additionalProperties": false
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"default": {}
|
|
25
26
|
},
|
|
26
27
|
"meta": {
|
|
27
28
|
"type": "object",
|
|
28
29
|
"properties": {
|
|
29
30
|
"schemaVersion": {
|
|
30
31
|
"type": "string",
|
|
31
|
-
"
|
|
32
|
+
"default": "1.0"
|
|
32
33
|
},
|
|
33
34
|
"title": {
|
|
34
|
-
"type": "string"
|
|
35
|
-
"const": "Affiliation Search"
|
|
35
|
+
"type": "string"
|
|
36
36
|
},
|
|
37
37
|
"usageDescription": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
"const": "For questions that require the user to select from a controlled list of institutions."
|
|
38
|
+
"type": "string"
|
|
40
39
|
}
|
|
41
40
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
"additionalProperties": false
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"default": {}
|
|
46
43
|
},
|
|
47
44
|
"graphQL": {
|
|
48
45
|
"type": "object",
|
|
@@ -54,7 +51,8 @@
|
|
|
54
51
|
"properties": {
|
|
55
52
|
"propertyName": {
|
|
56
53
|
"type": "string",
|
|
57
|
-
"const": "displayName"
|
|
54
|
+
"const": "displayName",
|
|
55
|
+
"default": "displayName"
|
|
58
56
|
},
|
|
59
57
|
"label": {
|
|
60
58
|
"type": "string",
|
|
@@ -65,22 +63,24 @@
|
|
|
65
63
|
"default": "SignupPage.institution"
|
|
66
64
|
}
|
|
67
65
|
},
|
|
68
|
-
"required": [
|
|
69
|
-
"propertyName"
|
|
70
|
-
],
|
|
71
66
|
"additionalProperties": false
|
|
72
|
-
}
|
|
67
|
+
},
|
|
68
|
+
"default": [
|
|
69
|
+
{}
|
|
70
|
+
]
|
|
73
71
|
},
|
|
74
72
|
"localQueryId": {
|
|
75
73
|
"type": "string"
|
|
76
74
|
},
|
|
77
75
|
"query": {
|
|
78
76
|
"type": "string",
|
|
79
|
-
"const": "
|
|
77
|
+
"const": "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}",
|
|
78
|
+
"default": "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}"
|
|
80
79
|
},
|
|
81
80
|
"responseField": {
|
|
82
81
|
"type": "string",
|
|
83
|
-
"const": "affiliations.items"
|
|
82
|
+
"const": "affiliations.items",
|
|
83
|
+
"default": "affiliations.items"
|
|
84
84
|
},
|
|
85
85
|
"variables": {
|
|
86
86
|
"type": "array",
|
|
@@ -89,7 +89,8 @@
|
|
|
89
89
|
"properties": {
|
|
90
90
|
"name": {
|
|
91
91
|
"type": "string",
|
|
92
|
-
"const": "name"
|
|
92
|
+
"const": "name",
|
|
93
|
+
"default": "name"
|
|
93
94
|
},
|
|
94
95
|
"type": {
|
|
95
96
|
"type": "string",
|
|
@@ -101,19 +102,19 @@
|
|
|
101
102
|
},
|
|
102
103
|
"minLength": {
|
|
103
104
|
"type": "number",
|
|
104
|
-
"const": 3
|
|
105
|
+
"const": 3,
|
|
106
|
+
"default": 3
|
|
105
107
|
},
|
|
106
108
|
"labelTranslationKey": {
|
|
107
109
|
"type": "string",
|
|
108
110
|
"default": "SignupPage.institutionHelp"
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
|
-
"required": [
|
|
112
|
-
"name",
|
|
113
|
-
"minLength"
|
|
114
|
-
],
|
|
115
113
|
"additionalProperties": false
|
|
116
|
-
}
|
|
114
|
+
},
|
|
115
|
+
"default": [
|
|
116
|
+
{}
|
|
117
|
+
]
|
|
117
118
|
},
|
|
118
119
|
"queryId": {
|
|
119
120
|
"type": "string",
|
|
@@ -121,23 +122,16 @@
|
|
|
121
122
|
},
|
|
122
123
|
"answerField": {
|
|
123
124
|
"type": "string",
|
|
124
|
-
"const": "uri"
|
|
125
|
+
"const": "uri",
|
|
126
|
+
"default": "uri"
|
|
125
127
|
}
|
|
126
128
|
},
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
"query",
|
|
130
|
-
"responseField",
|
|
131
|
-
"variables",
|
|
132
|
-
"answerField"
|
|
133
|
-
],
|
|
134
|
-
"additionalProperties": false
|
|
129
|
+
"additionalProperties": false,
|
|
130
|
+
"default": {}
|
|
135
131
|
}
|
|
136
132
|
},
|
|
137
133
|
"required": [
|
|
138
|
-
"type"
|
|
139
|
-
"meta",
|
|
140
|
-
"graphQL"
|
|
134
|
+
"type"
|
|
141
135
|
],
|
|
142
136
|
"additionalProperties": false
|
|
143
137
|
}
|