@dmptool/types 1.1.2 → 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 +6 -4
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +4 -12
- 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 +90 -101
- package/dist/questions/dateQuestions.js +15 -34
- package/dist/questions/graphQLQuestions.d.ts +176 -182
- package/dist/questions/graphQLQuestions.js +44 -45
- package/dist/questions/index.d.ts +1791 -2170
- package/dist/questions/index.js +2 -2
- package/dist/questions/numberQuestions.d.ts +126 -142
- package/dist/questions/numberQuestions.js +11 -45
- package/dist/questions/optionBasedQuestions.d.ts +197 -225
- package/dist/questions/optionBasedQuestions.js +24 -88
- package/dist/questions/question.d.ts +24 -56
- package/dist/questions/question.js +78 -18
- package/dist/questions/tableQuestions.d.ts +2637 -2930
- package/dist/questions/tableQuestions.js +9 -21
- package/dist/questions/textQuestions.d.ts +125 -145
- package/dist/questions/textQuestions.js +16 -57
- package/dist/schemas/affiliationSearchAnswer.schema.json +9 -12
- package/dist/schemas/affiliationSearchQuestion.schema.json +57 -50
- package/dist/schemas/anyAnswer.schema.json +228 -237
- package/dist/schemas/anyQuestion.schema.json +349 -517
- package/dist/schemas/anyTableColumnAnswer.schema.json +93 -106
- package/dist/schemas/anyTableColumnQuestion.schema.json +259 -382
- package/dist/schemas/booleanAnswer.schema.json +8 -11
- package/dist/schemas/booleanQuestion.schema.json +9 -15
- package/dist/schemas/checkboxesAnswer.schema.json +13 -14
- package/dist/schemas/checkboxesQuestion.schema.json +18 -24
- package/dist/schemas/currencyAnswer.schema.json +8 -11
- package/dist/schemas/currencyQuestion.schema.json +13 -17
- package/dist/schemas/dateAnswer.schema.json +8 -11
- package/dist/schemas/dateQuestion.schema.json +9 -15
- package/dist/schemas/dateRangeAnswer.schema.json +16 -21
- package/dist/schemas/dateRangeQuestion.schema.json +40 -21
- package/dist/schemas/emailAnswer.schema.json +8 -11
- package/dist/schemas/emailQuestion.schema.json +11 -16
- package/dist/schemas/filteredSearchQuestion.schema.json +0 -3
- package/dist/schemas/multiselectBoxAnswer.schema.json +13 -14
- package/dist/schemas/multiselectBoxQuestion.schema.json +20 -25
- package/dist/schemas/numberAnswer.schema.json +8 -11
- package/dist/schemas/numberQuestion.schema.json +11 -16
- package/dist/schemas/numberRangeAnswer.schema.json +17 -22
- package/dist/schemas/numberRangeQuestion.schema.json +22 -21
- package/dist/schemas/radioButtonsAnswer.schema.json +8 -11
- package/dist/schemas/radioButtonsQuestion.schema.json +18 -24
- package/dist/schemas/selectBoxAnswer.schema.json +8 -11
- package/dist/schemas/selectBoxQuestion.schema.json +20 -25
- package/dist/schemas/tableAnswer.schema.json +337 -343
- package/dist/schemas/tableQuestion.schema.json +279 -416
- package/dist/schemas/textAnswer.schema.json +8 -11
- package/dist/schemas/textAreaAnswer.schema.json +8 -11
- package/dist/schemas/textAreaQuestion.schema.json +13 -17
- package/dist/schemas/textQuestion.schema.json +9 -15
- package/dist/schemas/urlAnswer.schema.json +8 -11
- package/dist/schemas/urlQuestion.schema.json +9 -15
- 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,29 +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
|
-
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
34
|
exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
42
|
-
type: zod_1.z.literal('table'),
|
|
43
|
-
columns: zod_1.z.array(exports.TableColumn), // The columns of the table
|
|
44
|
-
attributes: BaseAttributes.
|
|
45
|
-
canAddRows: zod_1.z.boolean().
|
|
46
|
-
canRemoveRows: zod_1.z.boolean().
|
|
47
|
-
initialRows: zod_1.z.number().
|
|
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({
|
|
38
|
+
canAddRows: zod_1.z.boolean().default(true),
|
|
39
|
+
canRemoveRows: zod_1.z.boolean().default(true),
|
|
40
|
+
initialRows: zod_1.z.number().default(1),
|
|
48
41
|
maxRows: zod_1.z.number().optional(), // The maximum number of rows (no default)
|
|
49
42
|
minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
|
|
50
|
-
})).
|
|
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()
|
|
43
|
+
})).default({})
|
|
56
44
|
}));
|
|
@@ -1,24 +1,38 @@
|
|
|
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>;
|
|
8
22
|
} & {
|
|
9
|
-
maxLength: z.
|
|
23
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
10
24
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
11
25
|
pattern: z.ZodOptional<z.ZodString>;
|
|
12
26
|
} & {
|
|
13
|
-
multiple: z.
|
|
27
|
+
multiple: z.ZodDefault<z.ZodBoolean>;
|
|
14
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
maxLength: number;
|
|
30
|
+
multiple: boolean;
|
|
15
31
|
label?: string | undefined;
|
|
16
32
|
help?: string | undefined;
|
|
17
33
|
labelTranslationKey?: string | undefined;
|
|
18
|
-
maxLength?: number | undefined;
|
|
19
34
|
minLength?: number | undefined;
|
|
20
35
|
pattern?: string | undefined;
|
|
21
|
-
multiple?: boolean | undefined;
|
|
22
36
|
}, {
|
|
23
37
|
label?: string | undefined;
|
|
24
38
|
help?: string | undefined;
|
|
@@ -28,40 +42,22 @@ 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
|
-
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
|
-
}>>;
|
|
48
45
|
}, "strip", z.ZodTypeAny, {
|
|
49
46
|
type: "email";
|
|
50
|
-
attributes
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
defaultJSON?: string | undefined;
|
|
64
|
-
} | undefined;
|
|
55
|
+
};
|
|
56
|
+
meta: {
|
|
57
|
+
schemaVersion: string;
|
|
58
|
+
title?: string | undefined;
|
|
59
|
+
usageDescription?: string | undefined;
|
|
60
|
+
};
|
|
65
61
|
}, {
|
|
66
62
|
type: "email";
|
|
67
63
|
attributes?: {
|
|
@@ -74,33 +70,46 @@ export declare const EmailQuestionSchema: z.ZodObject<{} & {
|
|
|
74
70
|
multiple?: boolean | undefined;
|
|
75
71
|
} | undefined;
|
|
76
72
|
meta?: {
|
|
77
|
-
schemaVersion
|
|
78
|
-
title?:
|
|
79
|
-
usageDescription?:
|
|
80
|
-
defaultJSON?: string | undefined;
|
|
73
|
+
schemaVersion?: string | undefined;
|
|
74
|
+
title?: string | undefined;
|
|
75
|
+
usageDescription?: string | undefined;
|
|
81
76
|
} | undefined;
|
|
82
77
|
}>;
|
|
83
|
-
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
|
+
} & {
|
|
84
93
|
type: z.ZodLiteral<"textArea">;
|
|
85
|
-
attributes: z.
|
|
94
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
86
95
|
label: z.ZodOptional<z.ZodString>;
|
|
87
96
|
help: z.ZodOptional<z.ZodString>;
|
|
88
97
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
89
98
|
} & {
|
|
90
|
-
cols: z.
|
|
99
|
+
cols: z.ZodDefault<z.ZodNumber>;
|
|
91
100
|
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
92
101
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
93
|
-
rows: z.
|
|
94
|
-
asRichText: z.
|
|
102
|
+
rows: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
asRichText: z.ZodDefault<z.ZodBoolean>;
|
|
95
104
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
cols: number;
|
|
106
|
+
rows: number;
|
|
107
|
+
asRichText: boolean;
|
|
96
108
|
label?: string | undefined;
|
|
97
109
|
help?: string | undefined;
|
|
98
110
|
labelTranslationKey?: string | undefined;
|
|
99
111
|
maxLength?: number | undefined;
|
|
100
112
|
minLength?: number | undefined;
|
|
101
|
-
cols?: number | undefined;
|
|
102
|
-
rows?: number | undefined;
|
|
103
|
-
asRichText?: boolean | undefined;
|
|
104
113
|
}, {
|
|
105
114
|
label?: string | undefined;
|
|
106
115
|
help?: string | undefined;
|
|
@@ -111,41 +120,23 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
111
120
|
rows?: number | undefined;
|
|
112
121
|
asRichText?: boolean | undefined;
|
|
113
122
|
}>>;
|
|
114
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
115
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
116
|
-
} & {
|
|
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>>;
|
|
120
|
-
}, "strip", z.ZodTypeAny, {
|
|
121
|
-
schemaVersion: "1.0";
|
|
122
|
-
title?: "Text Area" | undefined;
|
|
123
|
-
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
124
|
-
defaultJSON?: string | undefined;
|
|
125
|
-
}, {
|
|
126
|
-
schemaVersion: "1.0";
|
|
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
|
-
}>>;
|
|
131
123
|
}, "strip", z.ZodTypeAny, {
|
|
132
124
|
type: "textArea";
|
|
133
|
-
attributes
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
title?: "Text Area" | undefined;
|
|
146
|
-
usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
|
|
147
|
-
defaultJSON?: string | undefined;
|
|
148
|
-
} | undefined;
|
|
134
|
+
};
|
|
135
|
+
meta: {
|
|
136
|
+
schemaVersion: string;
|
|
137
|
+
title?: string | undefined;
|
|
138
|
+
usageDescription?: string | undefined;
|
|
139
|
+
};
|
|
149
140
|
}, {
|
|
150
141
|
type: "textArea";
|
|
151
142
|
attributes?: {
|
|
@@ -159,27 +150,40 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
|
|
|
159
150
|
asRichText?: boolean | undefined;
|
|
160
151
|
} | undefined;
|
|
161
152
|
meta?: {
|
|
162
|
-
schemaVersion
|
|
163
|
-
title?:
|
|
164
|
-
usageDescription?:
|
|
165
|
-
defaultJSON?: string | undefined;
|
|
153
|
+
schemaVersion?: string | undefined;
|
|
154
|
+
title?: string | undefined;
|
|
155
|
+
usageDescription?: string | undefined;
|
|
166
156
|
} | undefined;
|
|
167
157
|
}>;
|
|
168
|
-
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
|
+
} & {
|
|
169
173
|
type: z.ZodLiteral<"text">;
|
|
170
|
-
attributes: z.
|
|
174
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
171
175
|
label: z.ZodOptional<z.ZodString>;
|
|
172
176
|
help: z.ZodOptional<z.ZodString>;
|
|
173
177
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
174
178
|
} & {
|
|
175
|
-
maxLength: z.
|
|
179
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
176
180
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
177
181
|
pattern: z.ZodOptional<z.ZodString>;
|
|
178
182
|
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
maxLength: number;
|
|
179
184
|
label?: string | undefined;
|
|
180
185
|
help?: string | undefined;
|
|
181
186
|
labelTranslationKey?: string | undefined;
|
|
182
|
-
maxLength?: number | undefined;
|
|
183
187
|
minLength?: number | undefined;
|
|
184
188
|
pattern?: string | undefined;
|
|
185
189
|
}, {
|
|
@@ -190,39 +194,21 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
190
194
|
minLength?: number | undefined;
|
|
191
195
|
pattern?: string | undefined;
|
|
192
196
|
}>>;
|
|
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
|
-
}>>;
|
|
210
197
|
}, "strip", z.ZodTypeAny, {
|
|
211
198
|
type: "text";
|
|
212
|
-
attributes
|
|
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
|
-
}
|
|
220
|
-
meta
|
|
221
|
-
schemaVersion:
|
|
222
|
-
title?:
|
|
223
|
-
usageDescription?:
|
|
224
|
-
|
|
225
|
-
} | undefined;
|
|
206
|
+
};
|
|
207
|
+
meta: {
|
|
208
|
+
schemaVersion: string;
|
|
209
|
+
title?: string | undefined;
|
|
210
|
+
usageDescription?: string | undefined;
|
|
211
|
+
};
|
|
226
212
|
}, {
|
|
227
213
|
type: "text";
|
|
228
214
|
attributes?: {
|
|
@@ -234,27 +220,40 @@ export declare const TextQuestionSchema: z.ZodObject<{} & {
|
|
|
234
220
|
pattern?: string | undefined;
|
|
235
221
|
} | undefined;
|
|
236
222
|
meta?: {
|
|
237
|
-
schemaVersion
|
|
238
|
-
title?:
|
|
239
|
-
usageDescription?:
|
|
240
|
-
defaultJSON?: string | undefined;
|
|
223
|
+
schemaVersion?: string | undefined;
|
|
224
|
+
title?: string | undefined;
|
|
225
|
+
usageDescription?: string | undefined;
|
|
241
226
|
} | undefined;
|
|
242
227
|
}>;
|
|
243
|
-
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
|
+
} & {
|
|
244
243
|
type: z.ZodLiteral<"url">;
|
|
245
|
-
attributes: z.
|
|
244
|
+
attributes: z.ZodDefault<z.ZodObject<{
|
|
246
245
|
label: z.ZodOptional<z.ZodString>;
|
|
247
246
|
help: z.ZodOptional<z.ZodString>;
|
|
248
247
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
249
248
|
} & {
|
|
250
|
-
maxLength: z.
|
|
249
|
+
maxLength: z.ZodDefault<z.ZodNumber>;
|
|
251
250
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
252
251
|
pattern: z.ZodOptional<z.ZodString>;
|
|
253
252
|
}, "strip", z.ZodTypeAny, {
|
|
253
|
+
maxLength: number;
|
|
254
254
|
label?: string | undefined;
|
|
255
255
|
help?: string | undefined;
|
|
256
256
|
labelTranslationKey?: string | undefined;
|
|
257
|
-
maxLength?: number | undefined;
|
|
258
257
|
minLength?: number | undefined;
|
|
259
258
|
pattern?: string | undefined;
|
|
260
259
|
}, {
|
|
@@ -265,39 +264,21 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
265
264
|
minLength?: number | undefined;
|
|
266
265
|
pattern?: string | undefined;
|
|
267
266
|
}>>;
|
|
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
|
-
}>>;
|
|
285
267
|
}, "strip", z.ZodTypeAny, {
|
|
286
268
|
type: "url";
|
|
287
|
-
attributes
|
|
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
|
-
}
|
|
295
|
-
meta
|
|
296
|
-
schemaVersion:
|
|
297
|
-
title?:
|
|
298
|
-
usageDescription?:
|
|
299
|
-
|
|
300
|
-
} | undefined;
|
|
276
|
+
};
|
|
277
|
+
meta: {
|
|
278
|
+
schemaVersion: string;
|
|
279
|
+
title?: string | undefined;
|
|
280
|
+
usageDescription?: string | undefined;
|
|
281
|
+
};
|
|
301
282
|
}, {
|
|
302
283
|
type: "url";
|
|
303
284
|
attributes?: {
|
|
@@ -309,10 +290,9 @@ export declare const URLQuestionSchema: z.ZodObject<{} & {
|
|
|
309
290
|
pattern?: string | undefined;
|
|
310
291
|
} | undefined;
|
|
311
292
|
meta?: {
|
|
312
|
-
schemaVersion
|
|
313
|
-
title?:
|
|
314
|
-
usageDescription?:
|
|
315
|
-
defaultJSON?: string | undefined;
|
|
293
|
+
schemaVersion?: string | undefined;
|
|
294
|
+
title?: string | undefined;
|
|
295
|
+
usageDescription?: string | undefined;
|
|
316
296
|
} | undefined;
|
|
317
297
|
}>;
|
|
318
298
|
export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
|
|
@@ -3,78 +3,37 @@ 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.
|
|
9
|
-
maxLength: zod_1.z.number().
|
|
10
|
-
minLength: zod_1.z.number().optional(),
|
|
11
|
-
pattern: zod_1.z.string().optional()
|
|
7
|
+
const TextAttributesSchema = BaseAttributes.merge(zod_1.z.object({
|
|
8
|
+
maxLength: zod_1.z.number().default(255),
|
|
9
|
+
minLength: zod_1.z.number().optional(),
|
|
10
|
+
pattern: zod_1.z.string().optional()
|
|
12
11
|
}));
|
|
13
12
|
// 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
13
|
exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
20
14
|
type: zod_1.z.literal('email'),
|
|
21
15
|
attributes: TextAttributesSchema.merge(zod_1.z.object({
|
|
22
|
-
multiple: zod_1.z.boolean().
|
|
23
|
-
})).
|
|
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()
|
|
16
|
+
multiple: zod_1.z.boolean().default(false),
|
|
17
|
+
})).default({})
|
|
29
18
|
}));
|
|
30
19
|
// 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
20
|
exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
37
|
-
type: zod_1.z.literal('textArea'),
|
|
38
|
-
attributes: BaseAttributes.
|
|
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().
|
|
44
|
-
})).
|
|
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()
|
|
21
|
+
type: zod_1.z.literal('textArea'),
|
|
22
|
+
attributes: BaseAttributes.merge(zod_1.z.object({
|
|
23
|
+
cols: zod_1.z.number().default(20),
|
|
24
|
+
maxLength: zod_1.z.number().optional(),
|
|
25
|
+
minLength: zod_1.z.number().optional(),
|
|
26
|
+
rows: zod_1.z.number().default(2),
|
|
27
|
+
asRichText: zod_1.z.boolean().default(true),
|
|
28
|
+
})).default({})
|
|
50
29
|
}));
|
|
51
30
|
// 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
31
|
exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
58
32
|
type: zod_1.z.literal('text'),
|
|
59
|
-
attributes: TextAttributesSchema.
|
|
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()
|
|
33
|
+
attributes: TextAttributesSchema.default({})
|
|
65
34
|
}));
|
|
66
35
|
// 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
36
|
exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
73
37
|
type: zod_1.z.literal('url'),
|
|
74
|
-
attributes: TextAttributesSchema.
|
|
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()
|
|
38
|
+
attributes: TextAttributesSchema.default({})
|
|
80
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
|
}
|