@dmptool/types 1.2.3 → 1.2.4

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 (42) hide show
  1. package/README.md +8 -0
  2. package/dist/answers/__tests__/answers.spec.js +122 -6
  3. package/dist/answers/answer.d.ts +3 -3
  4. package/dist/answers/graphQLAnswers.d.ts +120 -25
  5. package/dist/answers/graphQLAnswers.js +22 -5
  6. package/dist/answers/index.d.ts +399 -31
  7. package/dist/answers/index.js +8 -2
  8. package/dist/answers/numberAnswers.d.ts +40 -0
  9. package/dist/answers/numberAnswers.js +8 -1
  10. package/dist/answers/tableAnswers.d.ts +1688 -75
  11. package/dist/answers/tableAnswers.js +63 -2
  12. package/dist/questions/__tests__/graphQLQuestions.spec.js +177 -39
  13. package/dist/questions/__tests__/numberQuestions.spec.js +36 -0
  14. package/dist/questions/__tests__/tableQuestion.spec.js +145 -0
  15. package/dist/questions/__tests__/usage.spec.js +162 -1
  16. package/dist/questions/graphQLQuestions.d.ts +420 -60
  17. package/dist/questions/graphQLQuestions.js +257 -11
  18. package/dist/questions/index.d.ts +4849 -189
  19. package/dist/questions/index.js +9 -2
  20. package/dist/questions/numberQuestions.d.ts +105 -0
  21. package/dist/questions/numberQuestions.js +12 -1
  22. package/dist/questions/question.d.ts +4 -4
  23. package/dist/questions/question.js +25 -4
  24. package/dist/questions/tableQuestions.d.ts +5930 -679
  25. package/dist/questions/tableQuestions.js +175 -3
  26. package/dist/schemas/anyAnswer.schema.json +137 -17
  27. package/dist/schemas/anyQuestion.schema.json +829 -101
  28. package/dist/schemas/anyTableColumnAnswer.schema.json +116 -5
  29. package/dist/schemas/anyTableColumnQuestion.schema.json +326 -24
  30. package/dist/schemas/licenseSearchAnswer.schema.json +49 -0
  31. package/dist/schemas/licenseSearchQuestion.schema.json +164 -0
  32. package/dist/schemas/metadataStandardSearchAnswer.schema.json +49 -0
  33. package/dist/schemas/metadataStandardSearchQuestion.schema.json +174 -0
  34. package/dist/schemas/numberWithContextAnswer.schema.json +45 -0
  35. package/dist/schemas/numberWithContextQuestion.schema.json +84 -0
  36. package/dist/schemas/repositorySearchAnswer.schema.json +49 -0
  37. package/dist/schemas/repositorySearchQuestion.schema.json +180 -0
  38. package/dist/schemas/researchOutputTableAnswer.schema.json +519 -0
  39. package/dist/schemas/researchOutputTableQuestion.schema.json +1183 -0
  40. package/dist/schemas/tableAnswer.schema.json +116 -5
  41. package/dist/schemas/tableQuestion.schema.json +348 -24
  42. package/package.json +9 -5
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableQuestionSchema = exports.TableColumn = exports.AnyTableColumnQuestionSchema = void 0;
3
+ exports.ResearchOutputTableQuestionSchema = exports.ResearchOutputTableColumnPreferenceSchema = exports.TableQuestionSchema = exports.TableColumn = exports.AnyTableColumnQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const numberQuestions_1 = require("./numberQuestions");
6
6
  const textQuestions_1 = require("./textQuestions");
@@ -18,9 +18,12 @@ exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
18
18
  dateQuestions_1.DateQuestionSchema,
19
19
  dateQuestions_1.DateRangeQuestionSchema,
20
20
  textQuestions_1.EmailQuestionSchema,
21
- graphQLQuestions_1.FilteredSearchQuestionSchema,
21
+ graphQLQuestions_1.LicenseSearchQuestionSchema,
22
+ graphQLQuestions_1.MetadataStandardSearchQuestionSchema,
22
23
  numberQuestions_1.NumberQuestionSchema,
24
+ numberQuestions_1.NumberWithContextQuestionSchema,
23
25
  optionBasedQuestions_1.RadioButtonsQuestionSchema,
26
+ graphQLQuestions_1.RepositorySearchQuestionSchema,
24
27
  optionBasedQuestions_1.SelectBoxQuestionSchema,
25
28
  textQuestions_1.TextAreaQuestionSchema,
26
29
  textQuestions_1.TextQuestionSchema,
@@ -28,9 +31,15 @@ exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
28
31
  ]);
29
32
  exports.TableColumn = zod_1.z.object({
30
33
  heading: zod_1.z.string().default('Column A'), // The heading of the column
34
+ required: zod_1.z.boolean().default(false), // Whether the column is required
35
+ enabled: zod_1.z.boolean().default(true), // Whether the column is enabled
31
36
  content: exports.AnyTableColumnQuestionSchema.default({ type: 'textArea' }), // The question for the column
37
+ meta: zod_1.z.object({
38
+ schemaVersion: zod_1.z.string().default(question_1.CURRENT_SCHEMA_VERSION), // The schema version
39
+ labelTranslationKey: zod_1.z.string().optional(),
40
+ }).default({})
32
41
  });
33
- // Table question and answer
42
+ // Table question
34
43
  exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
35
44
  type: zod_1.z.literal('table'),
36
45
  columns: zod_1.z.array(exports.TableColumn).default([{}]), // The columns of the table
@@ -42,3 +51,166 @@ exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
42
51
  minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
43
52
  })).default({})
44
53
  }));
54
+ exports.ResearchOutputTableColumnPreferenceSchema = zod_1.z.object({
55
+ label: zod_1.z.string().default(''), // The label of the preference option
56
+ value: zod_1.z.string().default('') // The value of the preference option
57
+ });
58
+ const ResearchOutputTitleColumnSchema = exports.TableColumn.extend({
59
+ heading: zod_1.z.string().default('Title'),
60
+ required: zod_1.z.literal(true),
61
+ content: textQuestions_1.TextQuestionSchema.extend({
62
+ attributes: zod_1.z.object({
63
+ help: zod_1.z.string().default('Enter the title of this research output'),
64
+ labelTranslationKey: zod_1.z.string().default('researchOutput.title.heading')
65
+ }).default({})
66
+ }).default({ type: 'text' })
67
+ });
68
+ const ResearchOutputDescriptionColumnSchema = exports.TableColumn.extend({
69
+ heading: zod_1.z.string().default('Description'),
70
+ content: textQuestions_1.TextAreaQuestionSchema.extend({
71
+ attributes: zod_1.z.object({
72
+ help: zod_1.z.string().default('Provide a brief description of this research output'),
73
+ labelTranslationKey: zod_1.z.string().default('researchOutput.description.heading')
74
+ }).default({})
75
+ }).default({ type: 'textArea' })
76
+ });
77
+ const ResearchOutputOutputTypeColumnSchema = exports.TableColumn.extend({
78
+ heading: zod_1.z.string().default('Output Type'),
79
+ required: zod_1.z.literal(true),
80
+ content: optionBasedQuestions_1.SelectBoxQuestionSchema.extend({
81
+ attributes: zod_1.z.object({
82
+ multiple: zod_1.z.literal(false),
83
+ help: zod_1.z.string().default('Select the type that best describes this research output'),
84
+ labelTranslationKey: zod_1.z.string().default('researchOutput.outputType.heading')
85
+ }).default({ multiple: false }),
86
+ }).default({ type: 'selectBox' })
87
+ });
88
+ const ResearchOutputDataFlagsColumnSchema = exports.TableColumn.extend({
89
+ heading: zod_1.z.string().default('Data Flags'),
90
+ enabled: zod_1.z.boolean().default(false),
91
+ content: optionBasedQuestions_1.CheckboxesQuestionSchema.extend({
92
+ attributes: zod_1.z.object({
93
+ help: zod_1.z.string().default('Select any data flags that apply to this research output'),
94
+ labelTranslationKey: zod_1.z.string().default('researchOutput.dataFlags.heading')
95
+ }).default({}),
96
+ options: zod_1.z.array(zod_1.z.object({
97
+ label: zod_1.z.string(),
98
+ value: zod_1.z.string()
99
+ })).default([
100
+ { label: 'May contain sensitive data?', value: 'sensitive' },
101
+ { label: 'May contain personally identifiable information?', value: 'personal' },
102
+ ])
103
+ }).default({ type: 'checkBoxes' })
104
+ });
105
+ const ResearchOutputAccessLevelColumnSchema = exports.TableColumn.extend({
106
+ heading: zod_1.z.string().default('Initial Access Level'),
107
+ enabled: zod_1.z.boolean().default(false),
108
+ content: optionBasedQuestions_1.SelectBoxQuestionSchema.extend({
109
+ attributes: zod_1.z.object({
110
+ multiple: zod_1.z.literal(false),
111
+ help: zod_1.z.string().default('The initial access level for the research output'),
112
+ labelTranslationKey: zod_1.z.string().default('researchOutput.accessLevel.heading')
113
+ }).default({ multiple: false }),
114
+ options: zod_1.z.array(zod_1.z.object({
115
+ label: zod_1.z.string(),
116
+ value: zod_1.z.string()
117
+ })).default([
118
+ { label: 'Unrestricted Access', value: 'open' },
119
+ { label: 'Controlled Access', value: 'restricted' },
120
+ { label: 'Other', value: 'closed' },
121
+ ])
122
+ }).default({ type: 'selectBox' })
123
+ });
124
+ const ResearchOutputReleaseDateColumnSchema = exports.TableColumn.extend({
125
+ heading: zod_1.z.string().default('Anticipated Release Date'),
126
+ enabled: zod_1.z.boolean().default(false),
127
+ content: dateQuestions_1.DateQuestionSchema.extend({
128
+ attributes: zod_1.z.object({
129
+ help: zod_1.z.string().default('The anticipated release date for the research output'),
130
+ labelTranslationKey: zod_1.z.string().default('researchOutput.releaseDate.heading')
131
+ }).default({})
132
+ }).default({ type: 'date' })
133
+ });
134
+ const ResearchOutputByteSizeColumnSchema = exports.TableColumn.extend({
135
+ heading: zod_1.z.string().default('Byte Size'),
136
+ enabled: zod_1.z.boolean().default(false),
137
+ content: numberQuestions_1.NumberWithContextQuestionSchema.extend({
138
+ attributes: zod_1.z.object({
139
+ min: zod_1.z.number().default(0),
140
+ help: zod_1.z.string().default('The size of the research output in bytes'),
141
+ labelTranslationKey: zod_1.z.string().default('researchOutput.byteSize.heading'),
142
+ context: zod_1.z.array(zod_1.z.object({
143
+ label: zod_1.z.string().default('MB (megabytes)'),
144
+ value: zod_1.z.string().default('mb')
145
+ })).default([
146
+ { label: 'bytes', value: 'bytes' },
147
+ { label: 'KB (kilobytes)', value: 'kb' },
148
+ { label: 'MB (megabytes)', value: 'mb' },
149
+ { label: 'GB (gigabytes)', value: 'gb' },
150
+ { label: 'TB (terabytes)', value: 'tb' },
151
+ { label: 'PB (petabytes)', value: 'pb' }
152
+ ])
153
+ }).default({})
154
+ }).default({ type: 'numberWithContext' })
155
+ });
156
+ const ResearchOutputRepositoryColumnSchema = exports.TableColumn.extend({
157
+ heading: zod_1.z.string().default('Repository'),
158
+ enabled: zod_1.z.boolean().default(false),
159
+ content: graphQLQuestions_1.RepositorySearchQuestionSchema.default({ type: 'repositorySearch' }),
160
+ preferences: zod_1.z.array(exports.ResearchOutputTableColumnPreferenceSchema).default([]),
161
+ attributes: zod_1.z.object({
162
+ help: zod_1.z.string().default('Select repositor(ies) you would prefer users to deposit in'),
163
+ labelTranslationKey: zod_1.z.string().default('researchOutput.repository.heading')
164
+ }).default({})
165
+ });
166
+ const ResearchOutputMetadataStandardColumnSchema = exports.TableColumn.extend({
167
+ heading: zod_1.z.string().default('Metadata Standard'),
168
+ enabled: zod_1.z.boolean().default(false),
169
+ content: graphQLQuestions_1.MetadataStandardSearchQuestionSchema.default({ type: 'metadataStandardSearch' }),
170
+ preferences: zod_1.z.array(exports.ResearchOutputTableColumnPreferenceSchema).default([]),
171
+ attributes: zod_1.z.object({
172
+ help: zod_1.z.string().default('Select metadata standard(s) you would prefer users to use'),
173
+ labelTranslationKey: zod_1.z.string().default('researchOutput.metadataStandard.heading')
174
+ }).default({})
175
+ });
176
+ const ResearchOutputLicenseColumnSchema = exports.TableColumn.extend({
177
+ heading: zod_1.z.string().default('License'),
178
+ enabled: zod_1.z.boolean().default(false),
179
+ content: graphQLQuestions_1.LicenseSearchQuestionSchema.default({ type: 'licenseSearch' }),
180
+ preferences: zod_1.z.array(exports.ResearchOutputTableColumnPreferenceSchema).default([]),
181
+ attributes: zod_1.z.object({
182
+ help: zod_1.z.string().default('Select license(s) you would prefer users to apply to the research output'),
183
+ labelTranslationKey: zod_1.z.string().default('researchOutput.license.heading')
184
+ }).default({})
185
+ });
186
+ const defaultTitleColumn = ResearchOutputTitleColumnSchema.parse({
187
+ required: true,
188
+ content: { type: 'text' }
189
+ });
190
+ const defaultDescriptionColumn = ResearchOutputDescriptionColumnSchema.parse({});
191
+ const defaultOutputTypeColumn = ResearchOutputOutputTypeColumnSchema.parse({
192
+ required: true,
193
+ content: { type: 'selectBox' }
194
+ });
195
+ const defaultDataFlagsColumn = ResearchOutputDataFlagsColumnSchema.parse({});
196
+ const defaultAccessLevelColumn = ResearchOutputAccessLevelColumnSchema.parse({});
197
+ const defaultReleaseDateColumn = ResearchOutputReleaseDateColumnSchema.parse({});
198
+ const defaultByteSizeColumn = ResearchOutputByteSizeColumnSchema.parse({});
199
+ const defaultRepositoryColumn = ResearchOutputRepositoryColumnSchema.parse({});
200
+ const defaultMetadataStandardColumn = ResearchOutputMetadataStandardColumnSchema.parse({});
201
+ const defaultLicenseColumn = ResearchOutputLicenseColumnSchema.parse({});
202
+ exports.ResearchOutputTableQuestionSchema = exports.TableQuestionSchema.merge(zod_1.z.object({
203
+ type: zod_1.z.literal('researchOutputTable'),
204
+ columns: zod_1.z.array(exports.TableColumn).default([
205
+ defaultTitleColumn,
206
+ defaultDescriptionColumn,
207
+ defaultOutputTypeColumn,
208
+ defaultDataFlagsColumn,
209
+ defaultAccessLevelColumn,
210
+ defaultReleaseDateColumn,
211
+ defaultByteSizeColumn,
212
+ defaultRepositoryColumn,
213
+ defaultMetadataStandardColumn,
214
+ defaultLicenseColumn
215
+ ]),
216
+ }));
@@ -178,6 +178,76 @@
178
178
  ],
179
179
  "additionalProperties": false
180
180
  },
181
+ {
182
+ "type": "object",
183
+ "properties": {
184
+ "type": {
185
+ "type": "string",
186
+ "const": "licenseSearch"
187
+ },
188
+ "meta": {
189
+ "$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
190
+ },
191
+ "answer": {
192
+ "type": "array",
193
+ "items": {
194
+ "type": "object",
195
+ "properties": {
196
+ "licenseId": {
197
+ "type": "string",
198
+ "default": ""
199
+ },
200
+ "licenseName": {
201
+ "type": "string",
202
+ "default": ""
203
+ }
204
+ },
205
+ "additionalProperties": false,
206
+ "default": {}
207
+ },
208
+ "default": []
209
+ }
210
+ },
211
+ "required": [
212
+ "type"
213
+ ],
214
+ "additionalProperties": false
215
+ },
216
+ {
217
+ "type": "object",
218
+ "properties": {
219
+ "type": {
220
+ "type": "string",
221
+ "const": "metadataStandardSearch"
222
+ },
223
+ "meta": {
224
+ "$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
225
+ },
226
+ "answer": {
227
+ "type": "array",
228
+ "items": {
229
+ "type": "object",
230
+ "properties": {
231
+ "metadataStandardId": {
232
+ "type": "string",
233
+ "default": ""
234
+ },
235
+ "metadataStandardName": {
236
+ "type": "string",
237
+ "default": ""
238
+ }
239
+ },
240
+ "additionalProperties": false,
241
+ "default": {}
242
+ },
243
+ "default": []
244
+ }
245
+ },
246
+ "required": [
247
+ "type"
248
+ ],
249
+ "additionalProperties": false
250
+ },
181
251
  {
182
252
  "type": "object",
183
253
  "properties": {
@@ -274,6 +344,41 @@
274
344
  ],
275
345
  "additionalProperties": false
276
346
  },
347
+ {
348
+ "type": "object",
349
+ "properties": {
350
+ "type": {
351
+ "type": "string",
352
+ "const": "repositorySearch"
353
+ },
354
+ "meta": {
355
+ "$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
356
+ },
357
+ "answer": {
358
+ "type": "array",
359
+ "items": {
360
+ "type": "object",
361
+ "properties": {
362
+ "repositoryId": {
363
+ "type": "string",
364
+ "default": ""
365
+ },
366
+ "repositoryName": {
367
+ "type": "string",
368
+ "default": ""
369
+ }
370
+ },
371
+ "additionalProperties": false,
372
+ "default": {}
373
+ },
374
+ "default": []
375
+ }
376
+ },
377
+ "required": [
378
+ "type"
379
+ ],
380
+ "additionalProperties": false
381
+ },
277
382
  {
278
383
  "type": "object",
279
384
  "properties": {
@@ -343,42 +448,57 @@
343
448
  {
344
449
  "$ref": "#/definitions/AnyAnswer/anyOf/6"
345
450
  },
451
+ {
452
+ "$ref": "#/definitions/AnyAnswer/anyOf/7"
453
+ },
454
+ {
455
+ "$ref": "#/definitions/AnyAnswer/anyOf/8"
456
+ },
457
+ {
458
+ "$ref": "#/definitions/AnyAnswer/anyOf/9"
459
+ },
460
+ {
461
+ "$ref": "#/definitions/AnyAnswer/anyOf/10"
462
+ },
346
463
  {
347
464
  "type": "object",
348
465
  "properties": {
349
466
  "type": {
350
467
  "type": "string",
351
- "const": "filteredSearch"
468
+ "const": "numberWithContext"
352
469
  },
353
470
  "meta": {
354
471
  "$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
355
472
  },
356
473
  "answer": {
357
- "type": "array",
358
- "items": {
359
- "type": "string"
474
+ "type": "object",
475
+ "properties": {
476
+ "value": {
477
+ "type": "number",
478
+ "default": 0
479
+ },
480
+ "context": {
481
+ "type": "string",
482
+ "default": ""
483
+ }
360
484
  },
361
- "default": [
362
- ""
363
- ]
485
+ "additionalProperties": false
364
486
  }
365
487
  },
366
488
  "required": [
367
- "type"
489
+ "type",
490
+ "answer"
368
491
  ],
369
492
  "additionalProperties": false
370
493
  },
371
494
  {
372
- "$ref": "#/definitions/AnyAnswer/anyOf/7"
495
+ "$ref": "#/definitions/AnyAnswer/anyOf/12"
373
496
  },
374
497
  {
375
- "$ref": "#/definitions/AnyAnswer/anyOf/8"
376
- },
377
- {
378
- "$ref": "#/definitions/AnyAnswer/anyOf/10"
498
+ "$ref": "#/definitions/AnyAnswer/anyOf/13"
379
499
  },
380
500
  {
381
- "$ref": "#/definitions/AnyAnswer/anyOf/11"
501
+ "$ref": "#/definitions/AnyAnswer/anyOf/14"
382
502
  },
383
503
  {
384
504
  "type": "object",
@@ -470,13 +590,13 @@
470
590
  "additionalProperties": false
471
591
  },
472
592
  {
473
- "$ref": "#/definitions/AnyAnswer/anyOf/12/properties/answer/items/properties/columns/items/anyOf/12"
593
+ "$ref": "#/definitions/AnyAnswer/anyOf/15/properties/answer/items/properties/columns/items/anyOf/15"
474
594
  },
475
595
  {
476
- "$ref": "#/definitions/AnyAnswer/anyOf/12/properties/answer/items/properties/columns/items/anyOf/13"
596
+ "$ref": "#/definitions/AnyAnswer/anyOf/15/properties/answer/items/properties/columns/items/anyOf/16"
477
597
  },
478
598
  {
479
- "$ref": "#/definitions/AnyAnswer/anyOf/12/properties/answer/items/properties/columns/items/anyOf/14"
599
+ "$ref": "#/definitions/AnyAnswer/anyOf/15/properties/answer/items/properties/columns/items/anyOf/17"
480
600
  }
481
601
  ]
482
602
  }