@dmptool/types 1.2.6 → 2.1.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.
Files changed (103) hide show
  1. package/README.md +1 -1
  2. package/dist/answers/__tests__/defaults.spec.js +216 -0
  3. package/dist/answers/answer.d.ts +29 -14
  4. package/dist/answers/answer.js +11 -5
  5. package/dist/answers/dateAnswers.d.ts +20 -47
  6. package/dist/answers/dateAnswers.js +20 -10
  7. package/dist/answers/graphQLAnswers.d.ts +48 -120
  8. package/dist/answers/graphQLAnswers.js +46 -21
  9. package/dist/answers/index.d.ts +155 -1439
  10. package/dist/answers/index.js +26 -1
  11. package/dist/answers/numberAnswers.d.ts +38 -92
  12. package/dist/answers/numberAnswers.js +38 -19
  13. package/dist/answers/optionBasedAnswers.d.ts +42 -87
  14. package/dist/answers/optionBasedAnswers.js +37 -21
  15. package/dist/answers/tableAnswers.d.ts +348 -3032
  16. package/dist/answers/tableAnswers.js +25 -61
  17. package/dist/answers/textAnswers.d.ts +32 -68
  18. package/dist/answers/textAnswers.js +30 -17
  19. package/dist/dmp/__tests__/commonStandard.spec.d.ts +1 -0
  20. package/dist/dmp/__tests__/commonStandard.spec.js +210 -0
  21. package/dist/dmp/__tests__/extensions.spec.d.ts +1 -0
  22. package/dist/dmp/__tests__/extensions.spec.js +99 -0
  23. package/dist/dmp/extension.d.ts +1006 -0
  24. package/dist/dmp/extension.js +234 -0
  25. package/dist/dmp/index.d.ts +9 -0
  26. package/dist/dmp/index.js +23 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
  30. package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
  31. package/dist/questions/__tests__/defaults.spec.js +668 -0
  32. package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
  33. package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
  34. package/dist/questions/__tests__/textQuestions.spec.js +32 -0
  35. package/dist/questions/dateQuestions.d.ts +45 -191
  36. package/dist/questions/dateQuestions.js +26 -23
  37. package/dist/questions/graphQLQuestions.d.ts +262 -556
  38. package/dist/questions/graphQLQuestions.js +225 -223
  39. package/dist/questions/index.d.ts +670 -7441
  40. package/dist/questions/index.js +26 -1
  41. package/dist/questions/numberQuestions.d.ts +85 -331
  42. package/dist/questions/numberQuestions.js +50 -36
  43. package/dist/questions/optionBasedQuestions.d.ts +83 -290
  44. package/dist/questions/optionBasedQuestions.js +58 -41
  45. package/dist/questions/question.d.ts +72 -35
  46. package/dist/questions/question.js +14 -5
  47. package/dist/questions/tableQuestions.d.ts +2228 -9599
  48. package/dist/questions/tableQuestions.js +185 -192
  49. package/dist/questions/textQuestions.d.ts +70 -226
  50. package/dist/questions/textQuestions.js +31 -31
  51. package/dist/schemas/affiliationSearchAnswer.schema.json +35 -33
  52. package/dist/schemas/affiliationSearchQuestion.schema.json +124 -122
  53. package/dist/schemas/anyAnswer.schema.json +1229 -408
  54. package/dist/schemas/anyQuestion.schema.json +4312 -2023
  55. package/dist/schemas/anyTableColumnAnswer.schema.json +535 -314
  56. package/dist/schemas/anyTableColumnQuestion.schema.json +1309 -874
  57. package/dist/schemas/booleanAnswer.schema.json +22 -23
  58. package/dist/schemas/booleanQuestion.schema.json +39 -43
  59. package/dist/schemas/checkboxesAnswer.schema.json +27 -28
  60. package/dist/schemas/checkboxesQuestion.schema.json +63 -62
  61. package/dist/schemas/currencyAnswer.schema.json +22 -23
  62. package/dist/schemas/currencyQuestion.schema.json +57 -54
  63. package/dist/schemas/dateAnswer.schema.json +22 -23
  64. package/dist/schemas/dateQuestion.schema.json +50 -49
  65. package/dist/schemas/dateRangeAnswer.schema.json +35 -33
  66. package/dist/schemas/dateRangeQuestion.schema.json +87 -78
  67. package/dist/schemas/dmp.schema.json +2070 -0
  68. package/dist/schemas/dmpExtension.schema.json +1874 -0
  69. package/dist/schemas/emailAnswer.schema.json +22 -23
  70. package/dist/schemas/emailQuestion.schema.json +55 -53
  71. package/dist/schemas/licenseSearchAnswer.schema.json +40 -38
  72. package/dist/schemas/licenseSearchQuestion.schema.json +122 -146
  73. package/dist/schemas/metadataStandardSearchAnswer.schema.json +40 -38
  74. package/dist/schemas/metadataStandardSearchQuestion.schema.json +123 -156
  75. package/dist/schemas/multiselectBoxAnswer.schema.json +27 -28
  76. package/dist/schemas/multiselectBoxQuestion.schema.json +70 -71
  77. package/dist/schemas/numberAnswer.schema.json +22 -23
  78. package/dist/schemas/numberQuestion.schema.json +52 -50
  79. package/dist/schemas/numberRangeAnswer.schema.json +35 -33
  80. package/dist/schemas/numberRangeQuestion.schema.json +91 -60
  81. package/dist/schemas/numberWithContextAnswer.schema.json +35 -33
  82. package/dist/schemas/numberWithContextQuestion.schema.json +81 -70
  83. package/dist/schemas/radioButtonsAnswer.schema.json +22 -23
  84. package/dist/schemas/radioButtonsQuestion.schema.json +63 -62
  85. package/dist/schemas/repositorySearchAnswer.schema.json +40 -38
  86. package/dist/schemas/repositorySearchQuestion.schema.json +122 -162
  87. package/dist/schemas/researchOutputTableAnswer.schema.json +16622 -411
  88. package/dist/schemas/researchOutputTableQuestion.schema.json +114 -1157
  89. package/dist/schemas/selectBoxAnswer.schema.json +22 -23
  90. package/dist/schemas/selectBoxQuestion.schema.json +70 -71
  91. package/dist/schemas/tableAnswer.schema.json +581 -360
  92. package/dist/schemas/tableQuestion.schema.json +1388 -942
  93. package/dist/schemas/textAnswer.schema.json +22 -23
  94. package/dist/schemas/textAreaAnswer.schema.json +22 -23
  95. package/dist/schemas/textAreaQuestion.schema.json +65 -57
  96. package/dist/schemas/textQuestion.schema.json +50 -49
  97. package/dist/schemas/urlAnswer.schema.json +22 -23
  98. package/dist/schemas/urlQuestion.schema.json +50 -49
  99. package/package.json +6 -4
  100. package/dist/answers/__tests__/usage.spec.js +0 -178
  101. package/dist/questions/__tests__/usage.spec.d.ts +0 -8
  102. package/dist/questions/__tests__/usage.spec.js +0 -473
  103. /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
@@ -1,301 +1,145 @@
1
1
  import { z } from "zod";
2
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
- } & {
17
3
  type: z.ZodLiteral<"email">;
18
- attributes: z.ZodDefault<z.ZodObject<{
19
- label: z.ZodOptional<z.ZodString>;
20
- help: z.ZodOptional<z.ZodString>;
21
- labelTranslationKey: z.ZodOptional<z.ZodString>;
22
- } & {
4
+ attributes: z.ZodObject<{
5
+ multiple: z.ZodDefault<z.ZodBoolean>;
23
6
  maxLength: z.ZodDefault<z.ZodNumber>;
24
7
  minLength: z.ZodOptional<z.ZodNumber>;
25
8
  pattern: z.ZodOptional<z.ZodString>;
26
- } & {
27
- multiple: z.ZodDefault<z.ZodBoolean>;
28
- }, "strip", z.ZodTypeAny, {
29
- maxLength: number;
30
- multiple: boolean;
31
- label?: string | undefined;
32
- help?: string | undefined;
33
- labelTranslationKey?: string | undefined;
34
- minLength?: number | undefined;
35
- pattern?: string | undefined;
36
- }, {
37
- label?: string | undefined;
38
- help?: string | undefined;
39
- labelTranslationKey?: string | undefined;
40
- maxLength?: number | undefined;
41
- minLength?: number | undefined;
42
- pattern?: string | undefined;
43
- multiple?: boolean | undefined;
44
- }>>;
45
- }, "strip", z.ZodTypeAny, {
9
+ label: z.ZodOptional<z.ZodString>;
10
+ help: z.ZodOptional<z.ZodString>;
11
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ meta: z.ZodObject<{
14
+ schemaVersion: z.ZodDefault<z.ZodString>;
15
+ title: z.ZodOptional<z.ZodString>;
16
+ usageDescription: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>;
19
+ export declare const DefaultEmailQuestion: {
46
20
  type: "email";
47
21
  attributes: {
48
- maxLength: number;
49
22
  multiple: boolean;
23
+ maxLength: number;
24
+ minLength?: number | undefined;
25
+ pattern?: string | undefined;
50
26
  label?: string | undefined;
51
27
  help?: string | undefined;
52
28
  labelTranslationKey?: string | undefined;
53
- minLength?: number | undefined;
54
- pattern?: string | undefined;
55
29
  };
56
30
  meta: {
57
31
  schemaVersion: string;
58
32
  title?: string | undefined;
59
33
  usageDescription?: string | undefined;
60
34
  };
61
- }, {
62
- type: "email";
63
- attributes?: {
64
- label?: string | undefined;
65
- help?: string | undefined;
66
- labelTranslationKey?: string | undefined;
67
- maxLength?: number | undefined;
68
- minLength?: number | undefined;
69
- pattern?: string | undefined;
70
- multiple?: boolean | undefined;
71
- } | undefined;
72
- meta?: {
73
- schemaVersion?: string | undefined;
74
- title?: string | undefined;
75
- usageDescription?: string | undefined;
76
- } | undefined;
77
- }>;
35
+ };
78
36
  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
- } & {
93
37
  type: z.ZodLiteral<"textArea">;
94
- attributes: z.ZodDefault<z.ZodObject<{
95
- label: z.ZodOptional<z.ZodString>;
96
- help: z.ZodOptional<z.ZodString>;
97
- labelTranslationKey: z.ZodOptional<z.ZodString>;
98
- } & {
38
+ attributes: z.ZodObject<{
99
39
  cols: z.ZodDefault<z.ZodNumber>;
100
- maxLength: z.ZodOptional<z.ZodNumber>;
101
- minLength: z.ZodOptional<z.ZodNumber>;
102
40
  rows: z.ZodDefault<z.ZodNumber>;
103
41
  asRichText: z.ZodDefault<z.ZodBoolean>;
104
- }, "strip", z.ZodTypeAny, {
105
- cols: number;
106
- rows: number;
107
- asRichText: boolean;
108
- label?: string | undefined;
109
- help?: string | undefined;
110
- labelTranslationKey?: string | undefined;
111
- maxLength?: number | undefined;
112
- minLength?: number | undefined;
113
- }, {
114
- label?: string | undefined;
115
- help?: string | undefined;
116
- labelTranslationKey?: string | undefined;
117
- maxLength?: number | undefined;
118
- minLength?: number | undefined;
119
- cols?: number | undefined;
120
- rows?: number | undefined;
121
- asRichText?: boolean | undefined;
122
- }>>;
123
- }, "strip", z.ZodTypeAny, {
42
+ maxLength: z.ZodDefault<z.ZodNumber>;
43
+ minLength: z.ZodOptional<z.ZodNumber>;
44
+ pattern: z.ZodOptional<z.ZodString>;
45
+ label: z.ZodOptional<z.ZodString>;
46
+ help: z.ZodOptional<z.ZodString>;
47
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ meta: z.ZodObject<{
50
+ schemaVersion: z.ZodDefault<z.ZodString>;
51
+ title: z.ZodOptional<z.ZodString>;
52
+ usageDescription: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strip>;
54
+ }, z.core.$strip>;
55
+ export declare const DefaultTextAreaQuestion: {
124
56
  type: "textArea";
125
57
  attributes: {
126
58
  cols: number;
127
59
  rows: number;
128
60
  asRichText: boolean;
61
+ maxLength: number;
62
+ minLength?: number | undefined;
63
+ pattern?: string | undefined;
129
64
  label?: string | undefined;
130
65
  help?: string | undefined;
131
66
  labelTranslationKey?: string | undefined;
132
- maxLength?: number | undefined;
133
- minLength?: number | undefined;
134
67
  };
135
68
  meta: {
136
69
  schemaVersion: string;
137
70
  title?: string | undefined;
138
71
  usageDescription?: string | undefined;
139
72
  };
140
- }, {
141
- type: "textArea";
142
- attributes?: {
143
- label?: string | undefined;
144
- help?: string | undefined;
145
- labelTranslationKey?: string | undefined;
146
- maxLength?: number | undefined;
147
- minLength?: number | undefined;
148
- cols?: number | undefined;
149
- rows?: number | undefined;
150
- asRichText?: boolean | undefined;
151
- } | undefined;
152
- meta?: {
153
- schemaVersion?: string | undefined;
154
- title?: string | undefined;
155
- usageDescription?: string | undefined;
156
- } | undefined;
157
- }>;
73
+ };
158
74
  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
- } & {
173
75
  type: z.ZodLiteral<"text">;
174
- attributes: z.ZodDefault<z.ZodObject<{
175
- label: z.ZodOptional<z.ZodString>;
176
- help: z.ZodOptional<z.ZodString>;
177
- labelTranslationKey: z.ZodOptional<z.ZodString>;
178
- } & {
76
+ attributes: z.ZodObject<{
179
77
  maxLength: z.ZodDefault<z.ZodNumber>;
180
78
  minLength: z.ZodOptional<z.ZodNumber>;
181
79
  pattern: z.ZodOptional<z.ZodString>;
182
- }, "strip", z.ZodTypeAny, {
183
- maxLength: number;
184
- label?: string | undefined;
185
- help?: string | undefined;
186
- labelTranslationKey?: string | undefined;
187
- minLength?: number | undefined;
188
- pattern?: string | undefined;
189
- }, {
190
- label?: string | undefined;
191
- help?: string | undefined;
192
- labelTranslationKey?: string | undefined;
193
- maxLength?: number | undefined;
194
- minLength?: number | undefined;
195
- pattern?: string | undefined;
196
- }>>;
197
- }, "strip", z.ZodTypeAny, {
80
+ label: z.ZodOptional<z.ZodString>;
81
+ help: z.ZodOptional<z.ZodString>;
82
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strip>;
84
+ meta: z.ZodObject<{
85
+ schemaVersion: z.ZodDefault<z.ZodString>;
86
+ title: z.ZodOptional<z.ZodString>;
87
+ usageDescription: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>;
90
+ export declare const DefaultTextQuestion: {
198
91
  type: "text";
199
92
  attributes: {
200
93
  maxLength: number;
94
+ minLength?: number | undefined;
95
+ pattern?: string | undefined;
201
96
  label?: string | undefined;
202
97
  help?: string | undefined;
203
98
  labelTranslationKey?: string | undefined;
204
- minLength?: number | undefined;
205
- pattern?: string | undefined;
206
99
  };
207
100
  meta: {
208
101
  schemaVersion: string;
209
102
  title?: string | undefined;
210
103
  usageDescription?: string | undefined;
211
104
  };
212
- }, {
213
- type: "text";
214
- attributes?: {
215
- label?: string | undefined;
216
- help?: string | undefined;
217
- labelTranslationKey?: string | undefined;
218
- maxLength?: number | undefined;
219
- minLength?: number | undefined;
220
- pattern?: string | undefined;
221
- } | undefined;
222
- meta?: {
223
- schemaVersion?: string | undefined;
224
- title?: string | undefined;
225
- usageDescription?: string | undefined;
226
- } | undefined;
227
- }>;
105
+ };
228
106
  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
- } & {
243
107
  type: z.ZodLiteral<"url">;
244
- attributes: z.ZodDefault<z.ZodObject<{
245
- label: z.ZodOptional<z.ZodString>;
246
- help: z.ZodOptional<z.ZodString>;
247
- labelTranslationKey: z.ZodOptional<z.ZodString>;
248
- } & {
108
+ attributes: z.ZodObject<{
249
109
  maxLength: z.ZodDefault<z.ZodNumber>;
250
110
  minLength: z.ZodOptional<z.ZodNumber>;
251
111
  pattern: z.ZodOptional<z.ZodString>;
252
- }, "strip", z.ZodTypeAny, {
253
- maxLength: number;
254
- label?: string | undefined;
255
- help?: string | undefined;
256
- labelTranslationKey?: string | undefined;
257
- minLength?: number | undefined;
258
- pattern?: string | undefined;
259
- }, {
260
- label?: string | undefined;
261
- help?: string | undefined;
262
- labelTranslationKey?: string | undefined;
263
- maxLength?: number | undefined;
264
- minLength?: number | undefined;
265
- pattern?: string | undefined;
266
- }>>;
267
- }, "strip", z.ZodTypeAny, {
112
+ label: z.ZodOptional<z.ZodString>;
113
+ help: z.ZodOptional<z.ZodString>;
114
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>;
116
+ meta: z.ZodObject<{
117
+ schemaVersion: z.ZodDefault<z.ZodString>;
118
+ title: z.ZodOptional<z.ZodString>;
119
+ usageDescription: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>;
121
+ }, z.core.$strip>;
122
+ export declare const DefaultURLQuestion: {
268
123
  type: "url";
269
124
  attributes: {
270
125
  maxLength: number;
126
+ minLength?: number | undefined;
127
+ pattern?: string | undefined;
271
128
  label?: string | undefined;
272
129
  help?: string | undefined;
273
130
  labelTranslationKey?: string | undefined;
274
- minLength?: number | undefined;
275
- pattern?: string | undefined;
276
131
  };
277
132
  meta: {
278
133
  schemaVersion: string;
279
134
  title?: string | undefined;
280
135
  usageDescription?: string | undefined;
281
136
  };
282
- }, {
283
- type: "url";
284
- attributes?: {
285
- label?: string | undefined;
286
- help?: string | undefined;
287
- labelTranslationKey?: string | undefined;
288
- maxLength?: number | undefined;
289
- minLength?: number | undefined;
290
- pattern?: string | undefined;
291
- } | undefined;
292
- meta?: {
293
- schemaVersion?: string | undefined;
294
- title?: string | undefined;
295
- usageDescription?: string | undefined;
296
- } | undefined;
297
- }>;
137
+ };
298
138
  export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
299
139
  export type TextAreaQuestionType = z.infer<typeof TextAreaQuestionSchema>;
300
140
  export type TextQuestionType = z.infer<typeof TextQuestionSchema>;
301
141
  export type URLQuestionType = z.infer<typeof URLQuestionSchema>;
142
+ export declare const EmailQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
143
+ export declare const TextAreaQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
144
+ export declare const TextQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
145
+ export declare const URLQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
@@ -1,39 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = void 0;
3
+ exports.URLQuestionJSONSchema = exports.TextQuestionJSONSchema = exports.TextAreaQuestionJSONSchema = exports.EmailQuestionJSONSchema = exports.DefaultURLQuestion = exports.URLQuestionSchema = exports.DefaultTextQuestion = exports.TextQuestionSchema = exports.DefaultTextAreaQuestion = exports.TextAreaQuestionSchema = exports.DefaultEmailQuestion = exports.EmailQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
- const BaseAttributes = question_1.QuestionSchema.shape.attributes;
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()
11
- }));
6
+ const TextAttributesSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { maxLength: zod_1.z.number().default(255), minLength: zod_1.z.number().optional(), pattern: zod_1.z.string().optional() }));
7
+ const DefaultTextAttributes = TextAttributesSchema.parse({});
12
8
  // Email question and answer
13
- exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
14
- type: zod_1.z.literal('email'),
15
- attributes: TextAttributesSchema.merge(zod_1.z.object({
16
- multiple: zod_1.z.boolean().default(false),
17
- })).default({})
18
- }));
9
+ exports.EmailQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('email'), attributes: zod_1.z.object(Object.assign(Object.assign({}, TextAttributesSchema.shape), { multiple: zod_1.z.boolean().default(false) })) }));
10
+ exports.DefaultEmailQuestion = exports.EmailQuestionSchema.parse({
11
+ type: 'email',
12
+ attributes: exports.EmailQuestionSchema.shape.attributes,
13
+ meta: question_1.DefaultMeta
14
+ });
19
15
  // Text area question and answer
20
- exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
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({})
29
- }));
16
+ exports.TextAreaQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('textArea'), attributes: zod_1.z.object(Object.assign(Object.assign({}, TextAttributesSchema.shape), { cols: zod_1.z.number().default(20), rows: zod_1.z.number().default(2), asRichText: zod_1.z.boolean().default(true), maxLength: zod_1.z.number().default(10000) })) }));
17
+ exports.DefaultTextAreaQuestion = exports.TextAreaQuestionSchema.parse({
18
+ type: 'textArea',
19
+ attributes: exports.TextAreaQuestionSchema.shape.attributes,
20
+ meta: question_1.DefaultMeta
21
+ });
30
22
  // Text question and answer
31
- exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
32
- type: zod_1.z.literal('text'),
33
- attributes: TextAttributesSchema.default({})
34
- }));
23
+ exports.TextQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('text'), attributes: TextAttributesSchema }));
24
+ exports.DefaultTextQuestion = exports.TextQuestionSchema.parse({
25
+ type: 'text',
26
+ attributes: DefaultTextAttributes,
27
+ meta: question_1.DefaultMeta
28
+ });
35
29
  // URL question and answer
36
- exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
37
- type: zod_1.z.literal('url'),
38
- attributes: TextAttributesSchema.default({})
39
- }));
30
+ exports.URLQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('url'), attributes: TextAttributesSchema }));
31
+ exports.DefaultURLQuestion = exports.URLQuestionSchema.parse({
32
+ type: 'url',
33
+ attributes: DefaultTextAttributes,
34
+ meta: question_1.DefaultMeta
35
+ });
36
+ exports.EmailQuestionJSONSchema = zod_1.z.toJSONSchema(exports.EmailQuestionSchema);
37
+ exports.TextAreaQuestionJSONSchema = zod_1.z.toJSONSchema(exports.TextAreaQuestionSchema);
38
+ exports.TextQuestionJSONSchema = zod_1.z.toJSONSchema(exports.TextQuestionSchema);
39
+ exports.URLQuestionJSONSchema = zod_1.z.toJSONSchema(exports.URLQuestionSchema);
@@ -1,45 +1,47 @@
1
1
  {
2
- "$ref": "#/definitions/AffiliationSearchAnswer",
3
- "definitions": {
4
- "AffiliationSearchAnswer": {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "type": {
6
+ "type": "string",
7
+ "const": "affiliationSearch"
8
+ },
9
+ "meta": {
5
10
  "type": "object",
6
11
  "properties": {
7
- "type": {
8
- "type": "string",
9
- "const": "affiliationSearch"
10
- },
11
- "meta": {
12
- "type": "object",
13
- "properties": {
14
- "schemaVersion": {
15
- "type": "string",
16
- "default": "1.0"
17
- }
18
- },
19
- "additionalProperties": false,
20
- "default": {}
12
+ "schemaVersion": {
13
+ "default": "1.0",
14
+ "type": "string"
15
+ }
16
+ },
17
+ "required": [
18
+ "schemaVersion"
19
+ ],
20
+ "additionalProperties": false
21
+ },
22
+ "answer": {
23
+ "type": "object",
24
+ "properties": {
25
+ "affiliationId": {
26
+ "default": "",
27
+ "type": "string"
21
28
  },
22
- "answer": {
23
- "type": "object",
24
- "properties": {
25
- "affiliationId": {
26
- "type": "string",
27
- "default": ""
28
- },
29
- "affiliationName": {
30
- "type": "string",
31
- "default": ""
32
- }
33
- },
34
- "additionalProperties": false,
35
- "default": {}
29
+ "affiliationName": {
30
+ "default": "",
31
+ "type": "string"
36
32
  }
37
33
  },
38
34
  "required": [
39
- "type"
35
+ "affiliationId",
36
+ "affiliationName"
40
37
  ],
41
38
  "additionalProperties": false
42
39
  }
43
40
  },
44
- "$schema": "http://json-schema.org/draft-07/schema#"
41
+ "required": [
42
+ "type",
43
+ "meta",
44
+ "answer"
45
+ ],
46
+ "additionalProperties": false
45
47
  }