@dmptool/types 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/answers/__tests__/answers.spec.js +27 -14
- package/dist/answers/__tests__/defaults.spec.js +2 -0
- package/dist/answers/index.d.ts +102 -0
- package/dist/answers/index.js +1 -0
- package/dist/answers/tableAnswers.d.ts +614 -136
- package/dist/answers/tableAnswers.js +43 -20
- package/dist/dmp/__tests__/commonStandard.spec.js +26 -22
- package/dist/dmp/__tests__/extensions.spec.js +21 -15
- package/dist/dmp/extension.d.ts +385 -92
- package/dist/dmp/extension.js +49 -103
- package/dist/dmp/index.d.ts +515 -2
- package/dist/dmp/index.js +11 -1
- package/dist/questions/__tests__/defaults.spec.js +20 -10
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +17 -12
- package/dist/questions/__tests__/tableQuestion.spec.js +5 -0
- package/dist/questions/index.d.ts +20 -7
- package/dist/questions/optionBasedQuestions.d.ts +8 -6
- package/dist/questions/optionBasedQuestions.js +21 -8
- package/dist/questions/tableQuestions.d.ts +54 -16
- package/dist/questions/tableQuestions.js +56 -19
- package/dist/schemas/anyAnswer.schema.json +514 -0
- package/dist/schemas/anyQuestion.schema.json +60 -35
- package/dist/schemas/anyTableColumnQuestion.schema.json +9 -10
- package/dist/schemas/checkboxesQuestion.schema.json +3 -0
- package/dist/schemas/dmpExtension.schema.json +636 -140
- package/dist/schemas/multiselectBoxQuestion.schema.json +3 -5
- package/dist/schemas/radioButtonsQuestion.schema.json +3 -5
- package/dist/schemas/researchOutputTableAnswer.schema.json +6047 -11983
- package/dist/schemas/selectBoxQuestion.schema.json +3 -5
- package/dist/schemas/tableQuestion.schema.json +9 -10
- package/package.json +1 -1
- package/schemas/anyAnswer.schema.json +514 -0
- package/schemas/anyQuestion.schema.json +60 -35
- package/schemas/anyTableColumnQuestion.schema.json +9 -10
- package/schemas/checkboxesQuestion.schema.json +3 -0
- package/schemas/dmpExtension.schema.json +636 -140
- package/schemas/multiselectBoxQuestion.schema.json +3 -5
- package/schemas/radioButtonsQuestion.schema.json +3 -5
- package/schemas/researchOutputTableAnswer.schema.json +6047 -11983
- package/schemas/selectBoxQuestion.schema.json +3 -5
- package/schemas/tableQuestion.schema.json +9 -10
|
@@ -138,46 +138,55 @@ const questions_1 = require("../../questions");
|
|
|
138
138
|
columns: [
|
|
139
139
|
{
|
|
140
140
|
type: 'text',
|
|
141
|
+
commonStandardId: 'title',
|
|
141
142
|
answer: 'This is a test',
|
|
142
143
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
143
144
|
},
|
|
144
145
|
{
|
|
145
146
|
type: 'textArea',
|
|
147
|
+
commonStandardId: 'description',
|
|
146
148
|
answer: 'This is a longer text answer',
|
|
147
149
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
148
150
|
},
|
|
149
151
|
{
|
|
150
152
|
type: 'selectBox',
|
|
153
|
+
commonStandardId: 'type',
|
|
151
154
|
answer: 'dataset',
|
|
152
155
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
153
156
|
},
|
|
154
157
|
{
|
|
155
158
|
type: 'checkBoxes',
|
|
159
|
+
commonStandardId: 'data_flags',
|
|
156
160
|
answer: ['sensitive'],
|
|
157
161
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
158
162
|
},
|
|
159
163
|
{
|
|
160
164
|
type: 'selectBox',
|
|
165
|
+
commonStandardId: 'data_access',
|
|
161
166
|
answer: 'open',
|
|
162
167
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
163
168
|
},
|
|
164
169
|
{
|
|
165
170
|
type: 'date',
|
|
171
|
+
commonStandardId: 'issued',
|
|
166
172
|
answer: '2025-11-13',
|
|
167
173
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
168
174
|
},
|
|
169
175
|
{
|
|
170
176
|
type: 'numberWithContext',
|
|
177
|
+
commonStandardId: 'byte_size',
|
|
171
178
|
answer: { value: 12345, context: 'gb' },
|
|
172
179
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
173
180
|
},
|
|
174
181
|
{
|
|
175
182
|
type: 'repositorySearch',
|
|
183
|
+
commonStandardId: 'host',
|
|
176
184
|
answer: [{ repositoryId: 'repo1', repositoryName: 'Repository One' }],
|
|
177
185
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
178
186
|
},
|
|
179
187
|
{
|
|
180
188
|
type: 'metadataStandardSearch',
|
|
189
|
+
commonStandardId: 'metadata',
|
|
181
190
|
answer: [
|
|
182
191
|
{ metadataStandardId: 'standard1', metadataStandardName: 'Standard One' },
|
|
183
192
|
{ metadataStandardId: 'standard2', metadataStandardName: 'Standard Two' }
|
|
@@ -186,6 +195,7 @@ const questions_1 = require("../../questions");
|
|
|
186
195
|
},
|
|
187
196
|
{
|
|
188
197
|
type: 'licenseSearch',
|
|
198
|
+
commonStandardId: 'license_ref',
|
|
189
199
|
answer: [{ licenseId: 'license1', licenseName: 'License One' }],
|
|
190
200
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
191
201
|
}
|
|
@@ -196,20 +206,23 @@ const questions_1 = require("../../questions");
|
|
|
196
206
|
(0, globals_1.expect)(() => tableAnswers_1.ResearchOutputTableAnswerSchema.parse(validData)).not.toThrow();
|
|
197
207
|
const invalidData = {
|
|
198
208
|
type: 'researchOutputTable',
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
columnHeadings: ['Title', 'Output Type'],
|
|
210
|
+
answer: [{
|
|
211
|
+
columns: [
|
|
212
|
+
{
|
|
213
|
+
type: 'text',
|
|
214
|
+
commonStandardId: 'title',
|
|
215
|
+
answer: 12345,
|
|
216
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
type: 'selectBox',
|
|
220
|
+
commonStandardId: 'type',
|
|
221
|
+
answer: 'dataset',
|
|
222
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
}],
|
|
213
226
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
214
227
|
};
|
|
215
228
|
(0, globals_1.expect)(() => tableAnswers_1.ResearchOutputTableAnswerSchema.parse(invalidData)).toThrow();
|
|
@@ -205,11 +205,13 @@ describe('Get question answer defaultJSON', () => {
|
|
|
205
205
|
columns: [
|
|
206
206
|
{
|
|
207
207
|
type: "text",
|
|
208
|
+
commonStandardId: 'title',
|
|
208
209
|
answer: "",
|
|
209
210
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
210
211
|
},
|
|
211
212
|
{
|
|
212
213
|
type: "selectBox",
|
|
214
|
+
commonStandardId: 'type',
|
|
213
215
|
answer: "",
|
|
214
216
|
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
215
217
|
}
|
package/dist/answers/index.d.ts
CHANGED
|
@@ -129,6 +129,108 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
129
129
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
130
130
|
}, z.core.$strip>;
|
|
131
131
|
comment: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<"researchOutputTable">;
|
|
134
|
+
columnHeadings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
135
|
+
answer: z.ZodArray<z.ZodObject<{
|
|
136
|
+
columns: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
137
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
138
|
+
type: z.ZodLiteral<"checkBoxes">;
|
|
139
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
140
|
+
meta: z.ZodObject<{
|
|
141
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
146
|
+
type: z.ZodLiteral<"date">;
|
|
147
|
+
answer: z.ZodDefault<z.ZodString>;
|
|
148
|
+
meta: z.ZodObject<{
|
|
149
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
type: z.ZodLiteral<"licenseSearch">;
|
|
155
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
156
|
+
licenseId: z.ZodDefault<z.ZodString>;
|
|
157
|
+
licenseName: z.ZodDefault<z.ZodString>;
|
|
158
|
+
}, z.core.$strip>>>;
|
|
159
|
+
meta: z.ZodObject<{
|
|
160
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
165
|
+
type: z.ZodLiteral<"metadataStandardSearch">;
|
|
166
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
167
|
+
metadataStandardId: z.ZodDefault<z.ZodString>;
|
|
168
|
+
metadataStandardName: z.ZodDefault<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
meta: z.ZodObject<{
|
|
171
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
176
|
+
type: z.ZodLiteral<"numberWithContext">;
|
|
177
|
+
answer: z.ZodObject<{
|
|
178
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
179
|
+
context: z.ZodDefault<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
meta: z.ZodObject<{
|
|
182
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
187
|
+
type: z.ZodLiteral<"radioButtons">;
|
|
188
|
+
answer: z.ZodDefault<z.ZodString>;
|
|
189
|
+
meta: z.ZodObject<{
|
|
190
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
194
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
195
|
+
type: z.ZodLiteral<"repositorySearch">;
|
|
196
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
197
|
+
repositoryId: z.ZodDefault<z.ZodString>;
|
|
198
|
+
repositoryName: z.ZodDefault<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>>>;
|
|
200
|
+
meta: z.ZodObject<{
|
|
201
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
206
|
+
type: z.ZodLiteral<"selectBox">;
|
|
207
|
+
answer: z.ZodDefault<z.ZodString>;
|
|
208
|
+
meta: z.ZodObject<{
|
|
209
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
214
|
+
type: z.ZodLiteral<"text">;
|
|
215
|
+
answer: z.ZodDefault<z.ZodString>;
|
|
216
|
+
meta: z.ZodObject<{
|
|
217
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
220
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
221
|
+
commonStandardId: z.ZodOptional<z.ZodString>;
|
|
222
|
+
type: z.ZodLiteral<"textArea">;
|
|
223
|
+
answer: z.ZodDefault<z.ZodString>;
|
|
224
|
+
meta: z.ZodObject<{
|
|
225
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
228
|
+
}, z.core.$strip>], "type">>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
meta: z.ZodObject<{
|
|
231
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
232
|
+
}, z.core.$strip>;
|
|
233
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
132
234
|
}, z.core.$strip>, z.ZodObject<{
|
|
133
235
|
type: z.ZodLiteral<"selectBox">;
|
|
134
236
|
answer: z.ZodDefault<z.ZodString>;
|
package/dist/answers/index.js
CHANGED
|
@@ -46,6 +46,7 @@ exports.AnyAnswerSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
46
46
|
numberAnswers_1.NumberRangeAnswerSchema,
|
|
47
47
|
optionBasedAnswers_1.RadioButtonsAnswerSchema,
|
|
48
48
|
graphQLAnswers_1.RepositorySearchAnswerSchema,
|
|
49
|
+
tableAnswers_1.ResearchOutputTableAnswerSchema,
|
|
49
50
|
optionBasedAnswers_1.SelectBoxAnswerSchema,
|
|
50
51
|
tableAnswers_1.TableAnswerSchema,
|
|
51
52
|
textAnswers_1.TextAnswerSchema,
|