@dmptool/types 1.1.1 → 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.
Files changed (54) hide show
  1. package/dist/answers/__tests__/answers.spec.js +11 -5
  2. package/dist/answers/answer.d.ts +3 -3
  3. package/dist/answers/graphQLAnswers.d.ts +2 -2
  4. package/dist/answers/graphQLAnswers.js +2 -2
  5. package/dist/answers/index.d.ts +92 -55
  6. package/dist/answers/index.js +2 -2
  7. package/dist/answers/optionBasedAnswers.d.ts +27 -2
  8. package/dist/answers/optionBasedAnswers.js +5 -1
  9. package/dist/answers/tableAnswers.d.ts +268 -104
  10. package/dist/answers/tableAnswers.js +2 -1
  11. package/dist/questions/__tests__/graphQLQuestions.spec.js +13 -11
  12. package/dist/questions/__tests__/optionBasedQuestions.spec.js +52 -13
  13. package/dist/questions/dateQuestions.d.ts +68 -47
  14. package/dist/questions/dateQuestions.js +15 -6
  15. package/dist/questions/graphQLQuestions.d.ts +121 -96
  16. package/dist/questions/graphQLQuestions.js +34 -3
  17. package/dist/questions/index.d.ts +1524 -1006
  18. package/dist/questions/index.js +4 -2
  19. package/dist/questions/numberQuestions.d.ts +107 -76
  20. package/dist/questions/numberQuestions.js +20 -7
  21. package/dist/questions/optionBasedQuestions.d.ts +202 -74
  22. package/dist/questions/optionBasedQuestions.js +41 -11
  23. package/dist/questions/question.d.ts +43 -4
  24. package/dist/questions/question.js +13 -2
  25. package/dist/questions/tableQuestions.d.ts +2056 -1428
  26. package/dist/questions/tableQuestions.js +9 -4
  27. package/dist/questions/textQuestions.d.ts +98 -58
  28. package/dist/questions/textQuestions.js +29 -15
  29. package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
  30. package/dist/schemas/affiliationSearchQuestion.schema.json +146 -0
  31. package/dist/schemas/anyAnswer.schema.json +41 -23
  32. package/dist/schemas/anyQuestion.schema.json +525 -108
  33. package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
  34. package/dist/schemas/anyTableColumnQuestion.schema.json +396 -80
  35. package/dist/schemas/booleanQuestion.schema.json +11 -3
  36. package/dist/schemas/checkboxesQuestion.schema.json +14 -7
  37. package/dist/schemas/currencyQuestion.schema.json +14 -3
  38. package/dist/schemas/dateQuestion.schema.json +10 -1
  39. package/dist/schemas/dateRangeQuestion.schema.json +14 -1
  40. package/dist/schemas/emailQuestion.schema.json +12 -2
  41. package/dist/schemas/filteredSearchQuestion.schema.json +7 -0
  42. package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
  43. package/dist/schemas/multiselectBoxQuestion.schema.json +85 -0
  44. package/dist/schemas/numberQuestion.schema.json +12 -2
  45. package/dist/schemas/numberRangeQuestion.schema.json +16 -2
  46. package/dist/schemas/radioButtonsQuestion.schema.json +14 -7
  47. package/dist/schemas/selectBoxAnswer.schema.json +1 -4
  48. package/dist/schemas/selectBoxQuestion.schema.json +17 -8
  49. package/dist/schemas/tableAnswer.schema.json +35 -14
  50. package/dist/schemas/tableQuestion.schema.json +420 -84
  51. package/dist/schemas/textAreaQuestion.schema.json +16 -6
  52. package/dist/schemas/textQuestion.schema.json +10 -1
  53. package/dist/schemas/urlQuestion.schema.json +10 -1
  54. package/package.json +1 -1
@@ -9,8 +9,10 @@ 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', [
15
+ graphQLQuestions_1.AffiliationSearchQuestionSchema,
14
16
  optionBasedQuestions_1.BooleanQuestionSchema,
15
17
  optionBasedQuestions_1.CheckboxesQuestionSchema,
16
18
  numberQuestions_1.CurrencyQuestionSchema,
@@ -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({
@@ -35,10 +36,14 @@ exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
35
36
  type: zod_1.z.literal('table'), // The type of question
36
37
  columns: zod_1.z.array(exports.TableColumn), // The columns of the table
37
38
  attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
38
- canAddRows: zod_1.z.boolean().optional(), // Whether to allow adding rows (default is true)
39
- canRemoveRows: zod_1.z.boolean().optional(), // Whether to allow removing rows (default is true)
40
- initialRows: zod_1.z.number().optional(), // The initial number of rows (default is 1)
39
+ canAddRows: zod_1.z.boolean().default(true),
40
+ canRemoveRows: zod_1.z.boolean().default(true),
41
+ initialRows: zod_1.z.number().default(1),
41
42
  maxRows: zod_1.z.number().optional(), // The maximum number of rows (no default)
42
43
  minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
43
44
  })).optional(),
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()
44
49
  }));
@@ -1,32 +1,24 @@
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>;
14
6
  help: z.ZodOptional<z.ZodString>;
15
7
  labelTranslationKey: z.ZodOptional<z.ZodString>;
16
8
  } & {
17
- maxLength: z.ZodOptional<z.ZodNumber>;
9
+ maxLength: z.ZodDefault<z.ZodNumber>;
18
10
  minLength: z.ZodOptional<z.ZodNumber>;
19
11
  pattern: z.ZodOptional<z.ZodString>;
20
12
  } & {
21
- multiple: z.ZodOptional<z.ZodBoolean>;
13
+ multiple: z.ZodDefault<z.ZodBoolean>;
22
14
  }, "strip", z.ZodTypeAny, {
15
+ maxLength: number;
16
+ multiple: boolean;
23
17
  label?: string | undefined;
24
18
  help?: string | undefined;
25
19
  labelTranslationKey?: string | undefined;
26
- maxLength?: number | undefined;
27
20
  minLength?: number | undefined;
28
21
  pattern?: string | undefined;
29
- multiple?: boolean | undefined;
30
22
  }, {
31
23
  label?: string | undefined;
32
24
  help?: string | undefined;
@@ -36,19 +28,35 @@ 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
+ }, "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
+ }>>;
39
45
  }, "strip", z.ZodTypeAny, {
40
46
  type: "email";
41
47
  attributes?: {
48
+ maxLength: number;
49
+ multiple: boolean;
42
50
  label?: string | undefined;
43
51
  help?: string | undefined;
44
52
  labelTranslationKey?: string | undefined;
45
- maxLength?: number | undefined;
46
53
  minLength?: number | undefined;
47
54
  pattern?: string | undefined;
48
- multiple?: boolean | undefined;
49
55
  } | undefined;
50
56
  meta?: {
51
57
  schemaVersion: "1.0";
58
+ title?: "Email Field" | undefined;
59
+ usageDescription?: "For questions that require require email address(es)." | undefined;
52
60
  } | undefined;
53
61
  }, {
54
62
  type: "email";
@@ -63,6 +71,8 @@ export declare const EmailQuestionSchema: z.ZodObject<{
63
71
  } | undefined;
64
72
  meta?: {
65
73
  schemaVersion: "1.0";
74
+ title?: "Email Field" | undefined;
75
+ usageDescription?: "For questions that require require email address(es)." | undefined;
66
76
  } | undefined;
67
77
  }>;
68
78
  export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
@@ -72,18 +82,20 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
72
82
  help: z.ZodOptional<z.ZodString>;
73
83
  labelTranslationKey: z.ZodOptional<z.ZodString>;
74
84
  } & {
75
- cols: z.ZodOptional<z.ZodNumber>;
85
+ cols: z.ZodDefault<z.ZodNumber>;
76
86
  maxLength: z.ZodOptional<z.ZodNumber>;
77
87
  minLength: z.ZodOptional<z.ZodNumber>;
78
- rows: z.ZodOptional<z.ZodNumber>;
88
+ rows: z.ZodDefault<z.ZodNumber>;
89
+ asRichText: z.ZodDefault<z.ZodBoolean>;
79
90
  }, "strip", z.ZodTypeAny, {
91
+ cols: number;
92
+ rows: number;
93
+ asRichText: boolean;
80
94
  label?: string | undefined;
81
95
  help?: string | undefined;
82
96
  labelTranslationKey?: string | undefined;
83
97
  maxLength?: number | undefined;
84
98
  minLength?: number | undefined;
85
- cols?: number | undefined;
86
- rows?: number | undefined;
87
99
  }, {
88
100
  label?: string | undefined;
89
101
  help?: string | undefined;
@@ -92,39 +104,41 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
92
104
  minLength?: number | undefined;
93
105
  cols?: number | undefined;
94
106
  rows?: number | undefined;
107
+ asRichText?: boolean | undefined;
95
108
  }>>;
96
- meta: z.ZodObject<{
109
+ meta: z.ZodOptional<z.ZodObject<{
97
110
  schemaVersion: z.ZodLiteral<"1.0">;
98
111
  } & {
99
- asRichText: z.ZodOptional<z.ZodBoolean>;
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.">>;
100
114
  }, "strip", z.ZodTypeAny, {
101
115
  schemaVersion: "1.0";
102
- asRichText?: boolean | undefined;
116
+ title?: "Text Area" | undefined;
117
+ usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
103
118
  }, {
104
119
  schemaVersion: "1.0";
105
- asRichText?: boolean | undefined;
106
- }>;
120
+ title?: "Text Area" | undefined;
121
+ usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
122
+ }>>;
107
123
  }, "strip", z.ZodTypeAny, {
108
124
  type: "textArea";
109
- meta: {
110
- schemaVersion: "1.0";
111
- asRichText?: boolean | undefined;
112
- };
113
125
  attributes?: {
126
+ cols: number;
127
+ rows: number;
128
+ asRichText: boolean;
114
129
  label?: string | undefined;
115
130
  help?: string | undefined;
116
131
  labelTranslationKey?: string | undefined;
117
132
  maxLength?: number | undefined;
118
133
  minLength?: number | undefined;
119
- cols?: number | undefined;
120
- rows?: number | undefined;
134
+ } | undefined;
135
+ meta?: {
136
+ schemaVersion: "1.0";
137
+ title?: "Text Area" | undefined;
138
+ usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
121
139
  } | undefined;
122
140
  }, {
123
141
  type: "textArea";
124
- meta: {
125
- schemaVersion: "1.0";
126
- asRichText?: boolean | undefined;
127
- };
128
142
  attributes?: {
129
143
  label?: string | undefined;
130
144
  help?: string | undefined;
@@ -133,31 +147,29 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
133
147
  minLength?: number | undefined;
134
148
  cols?: number | undefined;
135
149
  rows?: number | undefined;
150
+ asRichText?: boolean | undefined;
136
151
  } | 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
- }, {
152
+ meta?: {
144
153
  schemaVersion: "1.0";
145
- }>>;
146
- } & {
154
+ title?: "Text Area" | undefined;
155
+ usageDescription?: "For questions that require longer answers, you can select formatting options too." | undefined;
156
+ } | undefined;
157
+ }>;
158
+ export declare const TextQuestionSchema: z.ZodObject<{} & {
147
159
  type: z.ZodLiteral<"text">;
148
160
  attributes: z.ZodOptional<z.ZodObject<{
149
161
  label: z.ZodOptional<z.ZodString>;
150
162
  help: z.ZodOptional<z.ZodString>;
151
163
  labelTranslationKey: z.ZodOptional<z.ZodString>;
152
164
  } & {
153
- maxLength: z.ZodOptional<z.ZodNumber>;
165
+ maxLength: z.ZodDefault<z.ZodNumber>;
154
166
  minLength: z.ZodOptional<z.ZodNumber>;
155
167
  pattern: z.ZodOptional<z.ZodString>;
156
168
  }, "strip", z.ZodTypeAny, {
169
+ maxLength: number;
157
170
  label?: string | undefined;
158
171
  help?: string | undefined;
159
172
  labelTranslationKey?: string | undefined;
160
- maxLength?: number | undefined;
161
173
  minLength?: number | undefined;
162
174
  pattern?: string | undefined;
163
175
  }, {
@@ -168,18 +180,34 @@ export declare const TextQuestionSchema: z.ZodObject<{
168
180
  minLength?: number | undefined;
169
181
  pattern?: string | undefined;
170
182
  }>>;
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
+ }>>;
171
197
  }, "strip", z.ZodTypeAny, {
172
198
  type: "text";
173
199
  attributes?: {
200
+ maxLength: number;
174
201
  label?: string | undefined;
175
202
  help?: string | undefined;
176
203
  labelTranslationKey?: string | undefined;
177
- maxLength?: number | undefined;
178
204
  minLength?: number | undefined;
179
205
  pattern?: string | undefined;
180
206
  } | undefined;
181
207
  meta?: {
182
208
  schemaVersion: "1.0";
209
+ title?: "Text Field" | undefined;
210
+ usageDescription?: "For questions that require short, simple answers." | undefined;
183
211
  } | undefined;
184
212
  }, {
185
213
  type: "text";
@@ -193,31 +221,25 @@ export declare const TextQuestionSchema: z.ZodObject<{
193
221
  } | undefined;
194
222
  meta?: {
195
223
  schemaVersion: "1.0";
224
+ title?: "Text Field" | undefined;
225
+ usageDescription?: "For questions that require short, simple answers." | undefined;
196
226
  } | undefined;
197
227
  }>;
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
- } & {
228
+ export declare const URLQuestionSchema: z.ZodObject<{} & {
207
229
  type: z.ZodLiteral<"url">;
208
230
  attributes: z.ZodOptional<z.ZodObject<{
209
231
  label: z.ZodOptional<z.ZodString>;
210
232
  help: z.ZodOptional<z.ZodString>;
211
233
  labelTranslationKey: z.ZodOptional<z.ZodString>;
212
234
  } & {
213
- maxLength: z.ZodOptional<z.ZodNumber>;
235
+ maxLength: z.ZodDefault<z.ZodNumber>;
214
236
  minLength: z.ZodOptional<z.ZodNumber>;
215
237
  pattern: z.ZodOptional<z.ZodString>;
216
238
  }, "strip", z.ZodTypeAny, {
239
+ maxLength: number;
217
240
  label?: string | undefined;
218
241
  help?: string | undefined;
219
242
  labelTranslationKey?: string | undefined;
220
- maxLength?: number | undefined;
221
243
  minLength?: number | undefined;
222
244
  pattern?: string | undefined;
223
245
  }, {
@@ -228,18 +250,34 @@ export declare const URLQuestionSchema: z.ZodObject<{
228
250
  minLength?: number | undefined;
229
251
  pattern?: string | undefined;
230
252
  }>>;
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
+ }>>;
231
267
  }, "strip", z.ZodTypeAny, {
232
268
  type: "url";
233
269
  attributes?: {
270
+ maxLength: number;
234
271
  label?: string | undefined;
235
272
  help?: string | undefined;
236
273
  labelTranslationKey?: string | undefined;
237
- maxLength?: number | undefined;
238
274
  minLength?: number | undefined;
239
275
  pattern?: string | undefined;
240
276
  } | undefined;
241
277
  meta?: {
242
278
  schemaVersion: "1.0";
279
+ title?: "URL Field" | undefined;
280
+ usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
243
281
  } | undefined;
244
282
  }, {
245
283
  type: "url";
@@ -253,6 +291,8 @@ export declare const URLQuestionSchema: z.ZodObject<{
253
291
  } | undefined;
254
292
  meta?: {
255
293
  schemaVersion: "1.0";
294
+ title?: "URL Field" | undefined;
295
+ usageDescription?: "For questions that require a website, DOI or other URL." | undefined;
256
296
  } | undefined;
257
297
  }>;
258
298
  export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
@@ -6,37 +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().optional(), // The maximum length of the text (no default)
10
- minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
11
- pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
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
14
  exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
15
- type: zod_1.z.literal('email'), // The type of question
15
+ type: zod_1.z.literal('email'),
16
16
  attributes: TextAttributesSchema.merge(zod_1.z.object({
17
- multiple: zod_1.z.boolean().optional(), // Allow multiple emails (default is false; comma separated)
17
+ multiple: zod_1.z.boolean().default(false),
18
18
  })).optional(),
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()
19
23
  }));
20
24
  // Text area question and answer
21
25
  exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
22
- type: zod_1.z.literal('textArea'), // The type of question
26
+ type: zod_1.z.literal('textArea'),
23
27
  attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
24
- cols: zod_1.z.number().optional(), // The number of columns (default is 20)
25
- maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
26
- 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)
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),
28
33
  })).optional(),
29
- meta: BaseMeta.unwrap().extend({
30
- asRichText: zod_1.z.boolean().optional() // Whether to use rich text (default is false)
31
- })
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()
32
38
  }));
33
39
  // Text question and answer
34
40
  exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
35
- type: zod_1.z.literal('text'), // The type of question
41
+ type: zod_1.z.literal('text'),
36
42
  attributes: TextAttributesSchema.optional(),
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()
37
47
  }));
38
48
  // URL question and answer
39
49
  exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
40
- type: zod_1.z.literal('url'), // The type of question
50
+ type: zod_1.z.literal('url'),
41
51
  attributes: TextAttributesSchema.optional(),
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()
42
56
  }));
@@ -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,146 @@
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
+ },
42
+ "required": [
43
+ "schemaVersion"
44
+ ],
45
+ "additionalProperties": false
46
+ },
47
+ "graphQL": {
48
+ "type": "object",
49
+ "properties": {
50
+ "displayFields": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "object",
54
+ "properties": {
55
+ "propertyName": {
56
+ "type": "string",
57
+ "const": "displayName"
58
+ },
59
+ "label": {
60
+ "type": "string",
61
+ "default": "Institution"
62
+ },
63
+ "labelTranslationKey": {
64
+ "type": "string",
65
+ "default": "SignupPage.institution"
66
+ }
67
+ },
68
+ "required": [
69
+ "propertyName"
70
+ ],
71
+ "additionalProperties": false
72
+ }
73
+ },
74
+ "localQueryId": {
75
+ "type": "string"
76
+ },
77
+ "query": {
78
+ "type": "string",
79
+ "const": "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}"
80
+ },
81
+ "responseField": {
82
+ "type": "string",
83
+ "const": "affiliations.items"
84
+ },
85
+ "variables": {
86
+ "type": "array",
87
+ "items": {
88
+ "type": "object",
89
+ "properties": {
90
+ "name": {
91
+ "type": "string",
92
+ "const": "name"
93
+ },
94
+ "type": {
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
105
+ },
106
+ "labelTranslationKey": {
107
+ "type": "string",
108
+ "default": "SignupPage.institutionHelp"
109
+ }
110
+ },
111
+ "required": [
112
+ "name",
113
+ "minLength"
114
+ ],
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ "queryId": {
119
+ "type": "string",
120
+ "default": "useAffiliationsQuery"
121
+ },
122
+ "answerField": {
123
+ "type": "string",
124
+ "const": "uri"
125
+ }
126
+ },
127
+ "required": [
128
+ "displayFields",
129
+ "query",
130
+ "responseField",
131
+ "variables",
132
+ "answerField"
133
+ ],
134
+ "additionalProperties": false
135
+ }
136
+ },
137
+ "required": [
138
+ "type",
139
+ "meta",
140
+ "graphQL"
141
+ ],
142
+ "additionalProperties": false
143
+ }
144
+ },
145
+ "$schema": "http://json-schema.org/draft-07/schema#"
146
+ }