@dmptool/types 1.2.6 → 2.0.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 (97) 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/questions/__tests__/dateQuestions.spec.js +3 -0
  20. package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
  21. package/dist/questions/__tests__/defaults.spec.js +668 -0
  22. package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
  23. package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
  24. package/dist/questions/__tests__/textQuestions.spec.js +32 -0
  25. package/dist/questions/dateQuestions.d.ts +45 -191
  26. package/dist/questions/dateQuestions.js +26 -23
  27. package/dist/questions/graphQLQuestions.d.ts +262 -556
  28. package/dist/questions/graphQLQuestions.js +225 -223
  29. package/dist/questions/index.d.ts +689 -7440
  30. package/dist/questions/index.js +26 -1
  31. package/dist/questions/numberQuestions.d.ts +85 -331
  32. package/dist/questions/numberQuestions.js +50 -36
  33. package/dist/questions/optionBasedQuestions.d.ts +83 -290
  34. package/dist/questions/optionBasedQuestions.js +58 -41
  35. package/dist/questions/question.d.ts +72 -35
  36. package/dist/questions/question.js +14 -5
  37. package/dist/questions/tableQuestions.d.ts +1977 -9646
  38. package/dist/questions/tableQuestions.js +184 -192
  39. package/dist/questions/textQuestions.d.ts +70 -226
  40. package/dist/questions/textQuestions.js +31 -31
  41. package/package.json +4 -5
  42. package/dist/answers/__tests__/usage.spec.js +0 -178
  43. package/dist/questions/__tests__/usage.spec.d.ts +0 -8
  44. package/dist/questions/__tests__/usage.spec.js +0 -473
  45. package/dist/schemas/affiliationSearchAnswer.schema.json +0 -45
  46. package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
  47. package/dist/schemas/anyAnswer.schema.json +0 -605
  48. package/dist/schemas/anyQuestion.schema.json +0 -2455
  49. package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
  50. package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
  51. package/dist/schemas/booleanAnswer.schema.json +0 -34
  52. package/dist/schemas/booleanQuestion.schema.json +0 -56
  53. package/dist/schemas/checkboxesAnswer.schema.json +0 -39
  54. package/dist/schemas/checkboxesQuestion.schema.json +0 -76
  55. package/dist/schemas/currencyAnswer.schema.json +0 -34
  56. package/dist/schemas/currencyQuestion.schema.json +0 -67
  57. package/dist/schemas/dateAnswer.schema.json +0 -34
  58. package/dist/schemas/datePickerAnswer.schema.json +0 -37
  59. package/dist/schemas/datePickerQuestion.schema.json +0 -52
  60. package/dist/schemas/dateQuestion.schema.json +0 -62
  61. package/dist/schemas/dateRangeAnswer.schema.json +0 -45
  62. package/dist/schemas/dateRangeQuestion.schema.json +0 -112
  63. package/dist/schemas/emailAnswer.schema.json +0 -34
  64. package/dist/schemas/emailQuestion.schema.json +0 -66
  65. package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
  66. package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
  67. package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
  68. package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
  69. package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
  70. package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
  71. package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
  72. package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
  73. package/dist/schemas/numberAnswer.schema.json +0 -34
  74. package/dist/schemas/numberQuestion.schema.json +0 -63
  75. package/dist/schemas/numberRangeAnswer.schema.json +0 -45
  76. package/dist/schemas/numberRangeQuestion.schema.json +0 -94
  77. package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
  78. package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
  79. package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
  80. package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
  81. package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
  82. package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
  83. package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
  84. package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
  85. package/dist/schemas/selectBoxAnswer.schema.json +0 -34
  86. package/dist/schemas/selectBoxQuestion.schema.json +0 -85
  87. package/dist/schemas/tableAnswer.schema.json +0 -519
  88. package/dist/schemas/tableQuestion.schema.json +0 -1183
  89. package/dist/schemas/textAnswer.schema.json +0 -34
  90. package/dist/schemas/textAreaAnswer.schema.json +0 -34
  91. package/dist/schemas/textAreaQuestion.schema.json +0 -70
  92. package/dist/schemas/textQuestion.schema.json +0 -62
  93. package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
  94. package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
  95. package/dist/schemas/urlAnswer.schema.json +0 -34
  96. package/dist/schemas/urlQuestion.schema.json +0 -62
  97. /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
@@ -1,473 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const question_1 = require("../question");
4
- const index_1 = require("../index");
5
- // Parse the Zod schema with no input to generate the default JSON schemas
6
- function questionFormatInfo(name) {
7
- if (name in index_1.QuestionSchemaMap) {
8
- const usage = question_1.QuestionFormatsUsage[name];
9
- const schema = index_1.QuestionSchemaMap[name];
10
- const parsedSchema = schema.parse({ type: name });
11
- return {
12
- type: name,
13
- title: usage === null || usage === void 0 ? void 0 : usage.title,
14
- usageDescription: usage === null || usage === void 0 ? void 0 : usage.usageDescription,
15
- defaultJSON: parsedSchema
16
- };
17
- }
18
- else {
19
- return null;
20
- }
21
- }
22
- describe('Get question format information', () => {
23
- it('for affiliationSearch question format', () => {
24
- const format = questionFormatInfo('affiliationSearch');
25
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('affiliationSearch');
26
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Affiliation Search');
27
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
28
- const expectedJSON = {
29
- type: 'affiliationSearch',
30
- attributes: {},
31
- meta: { schemaVersion: '1.0' },
32
- graphQL: {
33
- displayFields: [{
34
- label: "Institution",
35
- propertyName: "displayName",
36
- }],
37
- query: index_1.affiliationQuery,
38
- responseField: 'affiliations.items',
39
- variables: [{
40
- label: "Search for your institution",
41
- minLength: 3,
42
- name: "name",
43
- type: "string",
44
- }],
45
- answerField: 'uri'
46
- }
47
- };
48
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
49
- });
50
- it('for boolean question format', () => {
51
- const format = questionFormatInfo('boolean');
52
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('boolean');
53
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Yes/No Field');
54
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
55
- const expectedJSON = {
56
- type: 'boolean',
57
- attributes: { checked: false },
58
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
59
- };
60
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
61
- });
62
- it('for checkBoxes question format', () => {
63
- const format = questionFormatInfo('checkBoxes');
64
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('checkBoxes');
65
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Check Boxes');
66
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
67
- const expectedJSON = {
68
- type: 'checkBoxes',
69
- attributes: {},
70
- options: [{
71
- label: 'Option A',
72
- value: 'a',
73
- checked: false
74
- }],
75
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
76
- };
77
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
78
- });
79
- it('for currency question format', () => {
80
- const format = questionFormatInfo('currency');
81
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('currency');
82
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Currency Field');
83
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
84
- const expectedJSON = {
85
- type: 'currency',
86
- attributes: {
87
- denomination: 'USD',
88
- min: 0,
89
- step: 1
90
- },
91
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
92
- };
93
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
94
- });
95
- });
96
- it('for date question format', () => {
97
- const format = questionFormatInfo('date');
98
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('date');
99
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Date Field');
100
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
101
- const expectedJSON = {
102
- type: 'date',
103
- attributes: {
104
- step: 1
105
- },
106
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
107
- };
108
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
109
- });
110
- it('for dateRange question format', () => {
111
- const format = questionFormatInfo('dateRange');
112
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('dateRange');
113
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Date Range');
114
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
115
- const expectedJSON = {
116
- type: 'dateRange',
117
- attributes: {},
118
- columns: {
119
- start: {
120
- label: 'From',
121
- step: 1
122
- },
123
- end: {
124
- label: 'To',
125
- step: 1
126
- }
127
- },
128
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
129
- };
130
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
131
- });
132
- it('for email question format', () => {
133
- const format = questionFormatInfo('email');
134
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('email');
135
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Email Field');
136
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
137
- const expectedJSON = {
138
- type: 'email',
139
- attributes: {
140
- maxLength: 255,
141
- multiple: false,
142
- },
143
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
144
- };
145
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
146
- });
147
- it('for licenseSearch question format', () => {
148
- const format = questionFormatInfo('licenseSearch');
149
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('licenseSearch');
150
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('License Search');
151
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
152
- const expectedJSON = {
153
- type: 'licenseSearch',
154
- attributes: {},
155
- meta: { schemaVersion: '1.0' },
156
- graphQL: {
157
- displayFields: [
158
- {
159
- label: "Name",
160
- propertyName: "name",
161
- },
162
- {
163
- label: "Description",
164
- propertyName: "description",
165
- },
166
- {
167
- label: "Recommended",
168
- propertyName: "recommended",
169
- }
170
- ],
171
- query: index_1.licenseQuery,
172
- responseField: 'licenses.items',
173
- variables: [
174
- {
175
- label: "Search for a license",
176
- minLength: 3,
177
- name: "term",
178
- type: "string",
179
- },
180
- {
181
- label: "Pagination Options",
182
- name: "paginationOptions",
183
- type: "paginationOptions",
184
- }
185
- ],
186
- answerField: 'uri'
187
- }
188
- };
189
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
190
- });
191
- it('for metadataStandardSearch question format', () => {
192
- const format = questionFormatInfo('metadataStandardSearch');
193
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('metadataStandardSearch');
194
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Metadata Standard Search');
195
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
196
- const expectedJSON = {
197
- type: 'metadataStandardSearch',
198
- attributes: {},
199
- meta: { schemaVersion: '1.0' },
200
- graphQL: {
201
- displayFields: [
202
- {
203
- label: "Name",
204
- propertyName: "name",
205
- },
206
- {
207
- label: "Description",
208
- propertyName: "description",
209
- },
210
- {
211
- label: "Website",
212
- propertyName: "website",
213
- },
214
- {
215
- label: "Subject Areas",
216
- propertyName: "keywords",
217
- }
218
- ],
219
- query: index_1.metadataStandardQuery,
220
- responseField: 'metadataStandards.items',
221
- variables: [
222
- {
223
- label: "Search for a metadata standard",
224
- minLength: 3,
225
- name: "term",
226
- type: "string",
227
- },
228
- {
229
- label: "Subject Areas",
230
- name: "keywords",
231
- type: "string",
232
- minLength: 3,
233
- },
234
- {
235
- label: "Pagination Options",
236
- name: "paginationOptions",
237
- type: "paginationOptions",
238
- }
239
- ],
240
- answerField: 'uri'
241
- }
242
- };
243
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
244
- });
245
- it('for multiselectBox question format', () => {
246
- const format = questionFormatInfo('multiselectBox');
247
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('multiselectBox');
248
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Multi-select Box');
249
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
250
- const expectedJSON = {
251
- type: 'multiselectBox',
252
- attributes: {
253
- multiple: true,
254
- },
255
- options: [{
256
- label: 'Option A',
257
- value: 'a',
258
- selected: false
259
- }],
260
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
261
- };
262
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
263
- });
264
- it('for number question format', () => {
265
- const format = questionFormatInfo('number');
266
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('number');
267
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Number Field');
268
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
269
- const expectedJSON = {
270
- type: 'number',
271
- attributes: {
272
- min: 0,
273
- step: 1,
274
- },
275
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
276
- };
277
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
278
- });
279
- it('for numberRange format', () => {
280
- const format = questionFormatInfo('numberRange');
281
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('numberRange');
282
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Number Range');
283
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
284
- const expectedJSON = {
285
- type: 'numberRange',
286
- attributes: {},
287
- columns: {
288
- start: {
289
- label: 'From',
290
- min: 0,
291
- step: 1,
292
- },
293
- end: {
294
- label: 'To',
295
- min: 0,
296
- step: 1,
297
- }
298
- },
299
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
300
- };
301
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
302
- });
303
- it('for radioButtons question format', () => {
304
- const format = questionFormatInfo('radioButtons');
305
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('radioButtons');
306
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Radio Buttons');
307
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
308
- const expectedJSON = {
309
- type: 'radioButtons',
310
- attributes: {},
311
- options: [{
312
- label: 'Option A',
313
- value: 'a',
314
- selected: false
315
- }],
316
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
317
- };
318
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
319
- });
320
- it('for repositorySearch question format', () => {
321
- const format = questionFormatInfo('repositorySearch');
322
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('repositorySearch');
323
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Repository Search');
324
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
325
- const expectedJSON = {
326
- type: 'repositorySearch',
327
- attributes: {},
328
- meta: { schemaVersion: '1.0' },
329
- graphQL: {
330
- displayFields: [
331
- {
332
- label: "Name",
333
- propertyName: "name",
334
- },
335
- {
336
- label: "Description",
337
- propertyName: "description",
338
- },
339
- {
340
- label: "Website",
341
- propertyName: "website",
342
- },
343
- {
344
- label: "Subject Areas",
345
- propertyName: "keywords",
346
- }
347
- ],
348
- query: index_1.repositoryQuery,
349
- responseField: 'repositories.items',
350
- variables: [
351
- {
352
- label: "Search for a repository",
353
- minLength: 3,
354
- name: "term",
355
- type: "string",
356
- },
357
- {
358
- label: "Subject Areas",
359
- name: "keywords",
360
- type: "string",
361
- minLength: 3
362
- },
363
- {
364
- label: "Repository type",
365
- name: "repositoryType",
366
- type: "string",
367
- minLength: 3
368
- },
369
- {
370
- label: "Pagination Options",
371
- name: "paginationOptions",
372
- type: "paginationOptions",
373
- }
374
- ],
375
- answerField: 'uri'
376
- }
377
- };
378
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
379
- });
380
- it('for selectBox question format', () => {
381
- const format = questionFormatInfo('selectBox');
382
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('selectBox');
383
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Select Box');
384
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
385
- const expectedJSON = {
386
- type: 'selectBox',
387
- attributes: {
388
- multiple: false,
389
- },
390
- options: [{
391
- label: 'Option A',
392
- value: 'a',
393
- selected: false
394
- }],
395
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
396
- };
397
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
398
- });
399
- it('for table question format', () => {
400
- const format = questionFormatInfo('table');
401
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('table');
402
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Table');
403
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
404
- const expectedJSON = {
405
- type: 'table',
406
- attributes: {
407
- canAddRows: true,
408
- canRemoveRows: true,
409
- initialRows: 1
410
- },
411
- columns: [{
412
- heading: 'Column A',
413
- enabled: true,
414
- required: false,
415
- content: {
416
- type: 'textArea',
417
- attributes: {
418
- asRichText: true,
419
- cols: 20,
420
- rows: 2,
421
- },
422
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION }
423
- },
424
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION }
425
- }],
426
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
427
- };
428
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
429
- });
430
- it('for text question format', () => {
431
- const format = questionFormatInfo('text');
432
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('text');
433
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Text Field');
434
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
435
- const expectedJSON = {
436
- type: 'text',
437
- attributes: {
438
- maxLength: 255,
439
- },
440
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
441
- };
442
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
443
- });
444
- it('for textArea question format', () => {
445
- const format = questionFormatInfo('textArea');
446
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('textArea');
447
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Text Area');
448
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
449
- const expectedJSON = {
450
- type: 'textArea',
451
- attributes: {
452
- asRichText: true,
453
- cols: 20,
454
- rows: 2,
455
- },
456
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
457
- };
458
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
459
- });
460
- it('for url question format', () => {
461
- const format = questionFormatInfo('url');
462
- expect(format === null || format === void 0 ? void 0 : format.type).toEqual('url');
463
- expect(format === null || format === void 0 ? void 0 : format.title).toEqual('URL Field');
464
- expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
465
- const expectedJSON = {
466
- type: 'url',
467
- attributes: {
468
- maxLength: 255,
469
- },
470
- meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
471
- };
472
- expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
473
- });
@@ -1,45 +0,0 @@
1
- {
2
- "$ref": "#/definitions/AffiliationSearchAnswer",
3
- "definitions": {
4
- "AffiliationSearchAnswer": {
5
- "type": "object",
6
- "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": {}
21
- },
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": {}
36
- }
37
- },
38
- "required": [
39
- "type"
40
- ],
41
- "additionalProperties": false
42
- }
43
- },
44
- "$schema": "http://json-schema.org/draft-07/schema#"
45
- }
@@ -1,140 +0,0 @@
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
- "default": {}
26
- },
27
- "meta": {
28
- "type": "object",
29
- "properties": {
30
- "schemaVersion": {
31
- "type": "string",
32
- "default": "1.0"
33
- },
34
- "title": {
35
- "type": "string"
36
- },
37
- "usageDescription": {
38
- "type": "string"
39
- }
40
- },
41
- "additionalProperties": false,
42
- "default": {}
43
- },
44
- "graphQL": {
45
- "type": "object",
46
- "properties": {
47
- "displayFields": {
48
- "type": "array",
49
- "items": {
50
- "type": "object",
51
- "properties": {
52
- "propertyName": {
53
- "type": "string",
54
- "const": "displayName",
55
- "default": "displayName"
56
- },
57
- "label": {
58
- "type": "string",
59
- "default": "Institution"
60
- },
61
- "labelTranslationKey": {
62
- "type": "string",
63
- "default": "SignupPage.institution"
64
- }
65
- },
66
- "additionalProperties": false
67
- },
68
- "default": [
69
- {}
70
- ]
71
- },
72
- "localQueryId": {
73
- "type": "string"
74
- },
75
- "query": {
76
- "type": "string",
77
- "const": "query Affiliations($name: String!){ affiliations(name: $name) { totalCount nextCursor items { id displayName uri } } }",
78
- "default": "query Affiliations($name: String!){ affiliations(name: $name) { totalCount nextCursor items { id displayName uri } } }"
79
- },
80
- "responseField": {
81
- "type": "string",
82
- "const": "affiliations.items",
83
- "default": "affiliations.items"
84
- },
85
- "variables": {
86
- "type": "array",
87
- "items": {
88
- "type": "object",
89
- "properties": {
90
- "name": {
91
- "type": "string",
92
- "const": "name",
93
- "default": "name"
94
- },
95
- "type": {
96
- "type": "string",
97
- "default": "string"
98
- },
99
- "label": {
100
- "type": "string",
101
- "default": "Search for your institution"
102
- },
103
- "minLength": {
104
- "type": "number",
105
- "const": 3,
106
- "default": 3
107
- },
108
- "labelTranslationKey": {
109
- "type": "string",
110
- "default": "SignupPage.institutionHelp"
111
- }
112
- },
113
- "additionalProperties": false
114
- },
115
- "default": [
116
- {}
117
- ]
118
- },
119
- "queryId": {
120
- "type": "string",
121
- "default": "useAffiliationsQuery"
122
- },
123
- "answerField": {
124
- "type": "string",
125
- "const": "uri",
126
- "default": "uri"
127
- }
128
- },
129
- "additionalProperties": false,
130
- "default": {}
131
- }
132
- },
133
- "required": [
134
- "type"
135
- ],
136
- "additionalProperties": false
137
- }
138
- },
139
- "$schema": "http://json-schema.org/draft-07/schema#"
140
- }