@dmptool/types 2.0.0 → 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.
- package/dist/dmp/__tests__/commonStandard.spec.d.ts +1 -0
- package/dist/dmp/__tests__/commonStandard.spec.js +210 -0
- package/dist/dmp/__tests__/extensions.spec.d.ts +1 -0
- package/dist/dmp/__tests__/extensions.spec.js +99 -0
- package/dist/dmp/extension.d.ts +1006 -0
- package/dist/dmp/extension.js +234 -0
- package/dist/dmp/index.d.ts +9 -0
- package/dist/dmp/index.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/questions/index.d.ts +2 -22
- package/dist/questions/tableQuestions.d.ts +323 -25
- package/dist/questions/tableQuestions.js +3 -2
- package/dist/schemas/affiliationSearchAnswer.schema.json +47 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +142 -0
- package/dist/schemas/anyAnswer.schema.json +1426 -0
- package/dist/schemas/anyQuestion.schema.json +4744 -0
- package/dist/schemas/anyTableColumnAnswer.schema.json +687 -0
- package/dist/schemas/anyTableColumnQuestion.schema.json +1527 -0
- package/dist/schemas/booleanAnswer.schema.json +33 -0
- package/dist/schemas/booleanQuestion.schema.json +52 -0
- package/dist/schemas/checkboxesAnswer.schema.json +38 -0
- package/dist/schemas/checkboxesQuestion.schema.json +77 -0
- package/dist/schemas/currencyAnswer.schema.json +33 -0
- package/dist/schemas/currencyQuestion.schema.json +70 -0
- package/dist/schemas/dateAnswer.schema.json +33 -0
- package/dist/schemas/datePickerAnswer.schema.json +37 -0
- package/dist/schemas/datePickerQuestion.schema.json +52 -0
- package/dist/schemas/dateQuestion.schema.json +63 -0
- package/dist/schemas/dateRangeAnswer.schema.json +47 -0
- package/dist/schemas/dateRangeQuestion.schema.json +121 -0
- package/dist/schemas/dmp.schema.json +2070 -0
- package/dist/schemas/dmpExtension.schema.json +1874 -0
- package/dist/schemas/emailAnswer.schema.json +33 -0
- package/dist/schemas/emailQuestion.schema.json +68 -0
- package/dist/schemas/filteredSearchAnswer.schema.json +40 -0
- package/dist/schemas/filteredSearchQuestion.schema.json +130 -0
- package/dist/schemas/licenseSearchAnswer.schema.json +51 -0
- package/dist/schemas/licenseSearchQuestion.schema.json +140 -0
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +51 -0
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +141 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +38 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +84 -0
- package/dist/schemas/numberAnswer.schema.json +33 -0
- package/dist/schemas/numberQuestion.schema.json +65 -0
- package/dist/schemas/numberRangeAnswer.schema.json +47 -0
- package/dist/schemas/numberRangeQuestion.schema.json +125 -0
- package/dist/schemas/numberWithContextAnswer.schema.json +47 -0
- package/dist/schemas/numberWithContextQuestion.schema.json +95 -0
- package/dist/schemas/radioButtonsAnswer.schema.json +33 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +77 -0
- package/dist/schemas/repositorySearchAnswer.schema.json +51 -0
- package/dist/schemas/repositorySearchQuestion.schema.json +140 -0
- package/dist/schemas/researchOutputTableAnswer.schema.json +16730 -0
- package/dist/schemas/researchOutputTableQuestion.schema.json +140 -0
- package/dist/schemas/selectBoxAnswer.schema.json +33 -0
- package/dist/schemas/selectBoxQuestion.schema.json +84 -0
- package/dist/schemas/tableAnswer.schema.json +740 -0
- package/dist/schemas/tableQuestion.schema.json +1629 -0
- package/dist/schemas/textAnswer.schema.json +33 -0
- package/dist/schemas/textAreaAnswer.schema.json +33 -0
- package/dist/schemas/textAreaQuestion.schema.json +78 -0
- package/dist/schemas/textQuestion.schema.json +63 -0
- package/dist/schemas/typeaheadSearchAnswer.schema.json +37 -0
- package/dist/schemas/typeaheadSearchQuestion.schema.json +120 -0
- package/dist/schemas/urlAnswer.schema.json +33 -0
- package/dist/schemas/urlQuestion.schema.json +63 -0
- package/package.json +5 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const jsonschema_1 = require("jsonschema");
|
|
8
|
+
const SCHEMA_PATH = './schemas/dmp.schema.json';
|
|
9
|
+
describe('validate the RDA common standard', () => {
|
|
10
|
+
it('validates a minimal DMP', async () => {
|
|
11
|
+
const validator = new jsonschema_1.Validator();
|
|
12
|
+
const schema = await fs_1.default.readFileSync(SCHEMA_PATH, 'utf8');
|
|
13
|
+
const dmp = {
|
|
14
|
+
dmp: {
|
|
15
|
+
title: 'Test DMP',
|
|
16
|
+
dmp_id: {
|
|
17
|
+
identifier: '123456789',
|
|
18
|
+
type: 'other'
|
|
19
|
+
},
|
|
20
|
+
created: '2021-01-01 03:11:23Z',
|
|
21
|
+
modified: '2021-01-01 02:23:11Z',
|
|
22
|
+
ethical_issues_exist: 'unknown',
|
|
23
|
+
language: 'eng',
|
|
24
|
+
contact: {
|
|
25
|
+
name: 'Test Contact',
|
|
26
|
+
mbox: 'tester@example.com',
|
|
27
|
+
contact_id: {
|
|
28
|
+
identifier: '123456789',
|
|
29
|
+
type: 'other'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
dataset: [{
|
|
33
|
+
title: 'Test Dataset',
|
|
34
|
+
dataset_id: {
|
|
35
|
+
identifier: '123',
|
|
36
|
+
type: 'other'
|
|
37
|
+
},
|
|
38
|
+
personal_data: 'unknown',
|
|
39
|
+
sensitive_data: 'no',
|
|
40
|
+
}]
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const result = validator.validate(dmp, JSON.parse(schema));
|
|
44
|
+
// If there were errors, print them out so we can see why
|
|
45
|
+
if (result.errors.length > 0)
|
|
46
|
+
console.log(result.errors);
|
|
47
|
+
expect(result.errors.length).toBe(0);
|
|
48
|
+
});
|
|
49
|
+
it('validates a full DMP', async () => {
|
|
50
|
+
const validator = new jsonschema_1.Validator();
|
|
51
|
+
const schema = await fs_1.default.readFileSync(SCHEMA_PATH, 'utf8');
|
|
52
|
+
const dmp = {
|
|
53
|
+
dmp: {
|
|
54
|
+
title: 'Test DMP',
|
|
55
|
+
description: 'This is a test DMP',
|
|
56
|
+
dmp_id: {
|
|
57
|
+
identifier: '123456789',
|
|
58
|
+
type: 'other'
|
|
59
|
+
},
|
|
60
|
+
created: '2021-01-01 03:11:23Z',
|
|
61
|
+
modified: '2021-01-01 02:23:11Z',
|
|
62
|
+
ethical_issues_exist: 'yes',
|
|
63
|
+
ethical_issues_description: 'This DMP contains ethical issues',
|
|
64
|
+
ethical_issues_report: 'https://example.com/ethical-issues-report',
|
|
65
|
+
language: 'eng',
|
|
66
|
+
contact: {
|
|
67
|
+
name: 'Test Contact',
|
|
68
|
+
mbox: 'tester@example.com',
|
|
69
|
+
contact_id: {
|
|
70
|
+
identifier: 'https://orcid.org/0000-0000-0000-0000',
|
|
71
|
+
type: 'orcid'
|
|
72
|
+
},
|
|
73
|
+
affiliation: [{
|
|
74
|
+
name: 'Test University',
|
|
75
|
+
affiliation_id: {
|
|
76
|
+
identifier: 'https://ror.org/01234567890',
|
|
77
|
+
type: 'ror'
|
|
78
|
+
}
|
|
79
|
+
}],
|
|
80
|
+
},
|
|
81
|
+
contributor: [{
|
|
82
|
+
name: 'Test Contact',
|
|
83
|
+
contributor_id: {
|
|
84
|
+
identifier: 'https://orcid.org/0000-0000-0000-0000',
|
|
85
|
+
type: 'orcid'
|
|
86
|
+
},
|
|
87
|
+
affiliation: [{
|
|
88
|
+
name: 'Test University',
|
|
89
|
+
affiliation_id: {
|
|
90
|
+
identifier: 'https://ror.org/01234567890',
|
|
91
|
+
type: 'ror'
|
|
92
|
+
}
|
|
93
|
+
}],
|
|
94
|
+
role: ['https://example.com/roles/investigation', 'https://example.com/roles/other']
|
|
95
|
+
}],
|
|
96
|
+
cost: [{
|
|
97
|
+
title: 'Budget Cost',
|
|
98
|
+
description: 'Description of budget costs',
|
|
99
|
+
value: 1234.56,
|
|
100
|
+
currency_code: 'USD'
|
|
101
|
+
}],
|
|
102
|
+
dataset: [{
|
|
103
|
+
title: 'Test Dataset',
|
|
104
|
+
type: 'dataset',
|
|
105
|
+
description: 'This is a test dataset',
|
|
106
|
+
dataset_id: {
|
|
107
|
+
identifier: '123',
|
|
108
|
+
type: 'other'
|
|
109
|
+
},
|
|
110
|
+
personal_data: 'unknown',
|
|
111
|
+
sensitive_data: 'no',
|
|
112
|
+
data_quality_assurance: ['Statement about data quality assurance'],
|
|
113
|
+
is_reused: false,
|
|
114
|
+
issued: '2026-01-03',
|
|
115
|
+
keyword: ['test', 'dataset'],
|
|
116
|
+
language: 'eng',
|
|
117
|
+
metadata: [{
|
|
118
|
+
description: 'Description of metadata',
|
|
119
|
+
language: 'eng',
|
|
120
|
+
metadata_standard_id: {
|
|
121
|
+
identifier: 'https://example.com/metadata-standards/123',
|
|
122
|
+
type: 'url'
|
|
123
|
+
}
|
|
124
|
+
}],
|
|
125
|
+
preservation_statement: 'Statement about preservation',
|
|
126
|
+
security_and_privacy: [{
|
|
127
|
+
title: 'Security and Privacy Statement',
|
|
128
|
+
description: 'Description of security and privacy statement'
|
|
129
|
+
}],
|
|
130
|
+
alternate_identifier: [{
|
|
131
|
+
identifier: 'https://example.com/dataset/123',
|
|
132
|
+
type: 'url'
|
|
133
|
+
}],
|
|
134
|
+
technical_resource: [{
|
|
135
|
+
name: 'Test Server',
|
|
136
|
+
description: 'This is a test server',
|
|
137
|
+
technical_resource_id: [{
|
|
138
|
+
identifier: 'https://example.com/server/123',
|
|
139
|
+
type: 'url'
|
|
140
|
+
}],
|
|
141
|
+
}],
|
|
142
|
+
distribution: [{
|
|
143
|
+
title: 'Test Distribution',
|
|
144
|
+
description: 'This is a test distribution',
|
|
145
|
+
access_url: 'https://example.com/dataset/123/distribution/123456789',
|
|
146
|
+
download_url: 'https://example.com/dataset/123/distribution/123456789/download',
|
|
147
|
+
byte_size: 123456789,
|
|
148
|
+
format: ['application/zip'],
|
|
149
|
+
data_access: 'open',
|
|
150
|
+
issued: '2026-01-03',
|
|
151
|
+
license: [{
|
|
152
|
+
license_ref: 'https://spdx.org/licenses/CC-BY-4.0.html',
|
|
153
|
+
start_date: '2026-01-03'
|
|
154
|
+
}],
|
|
155
|
+
host: {
|
|
156
|
+
title: 'Test Host',
|
|
157
|
+
description: 'This is a test host',
|
|
158
|
+
url: 'https://example.com/host/123',
|
|
159
|
+
host_id: [{
|
|
160
|
+
identifier: 'https://re3data.org/2784y97245792756789',
|
|
161
|
+
type: 'url'
|
|
162
|
+
}],
|
|
163
|
+
availability: '99.99',
|
|
164
|
+
backup_frequency: 'weekly',
|
|
165
|
+
backup_type: 'tapes',
|
|
166
|
+
certified_with: 'coretrustseal',
|
|
167
|
+
geo_location: 'US',
|
|
168
|
+
pid_system: ['doi', 'ark'],
|
|
169
|
+
storage_type: 'LTO-8 tape',
|
|
170
|
+
support_versioning: 'yes'
|
|
171
|
+
}
|
|
172
|
+
}]
|
|
173
|
+
}],
|
|
174
|
+
related_identifier: [{
|
|
175
|
+
identifier: 'https://doi.org/10.1234/dmp.123456789',
|
|
176
|
+
relation_type: 'cites',
|
|
177
|
+
resource_type: 'dataset',
|
|
178
|
+
type: 'doi'
|
|
179
|
+
}],
|
|
180
|
+
alternate_identifier: [{
|
|
181
|
+
identifier: 'https://example.com/dmp/123456789',
|
|
182
|
+
type: 'url'
|
|
183
|
+
}],
|
|
184
|
+
},
|
|
185
|
+
project: [{
|
|
186
|
+
title: 'Test Project',
|
|
187
|
+
description: 'This is a test project',
|
|
188
|
+
project_id: {
|
|
189
|
+
identifier: '123456789',
|
|
190
|
+
type: 'other'
|
|
191
|
+
},
|
|
192
|
+
start: '2025-01-01',
|
|
193
|
+
end: '2028-01-31',
|
|
194
|
+
funding: [{
|
|
195
|
+
name: 'Funder Organization',
|
|
196
|
+
funding_status: 'planned',
|
|
197
|
+
funder_id: {
|
|
198
|
+
identifier: 'https://ror.org/0987654321',
|
|
199
|
+
type: 'ror'
|
|
200
|
+
}
|
|
201
|
+
}]
|
|
202
|
+
}]
|
|
203
|
+
};
|
|
204
|
+
const result = validator.validate(dmp, JSON.parse(schema));
|
|
205
|
+
// If there were errors, print them out so we can see why
|
|
206
|
+
if (result.errors.length > 0)
|
|
207
|
+
console.log(result.errors);
|
|
208
|
+
expect(result.errors.length).toBe(0);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const globals_1 = require("@jest/globals");
|
|
4
|
+
const extension_1 = require("../extension");
|
|
5
|
+
describe('extensions', () => {
|
|
6
|
+
it('validates a minimal DMP Tool extension', () => {
|
|
7
|
+
const expected = {
|
|
8
|
+
provenance: 'your-application',
|
|
9
|
+
privacy: 'private',
|
|
10
|
+
featured: 'no',
|
|
11
|
+
};
|
|
12
|
+
(0, globals_1.expect)(extension_1.DefaultExtensionSchema).toEqual(expected);
|
|
13
|
+
});
|
|
14
|
+
it('validates a full DMP Tool extension', () => {
|
|
15
|
+
const validData = {
|
|
16
|
+
provenance: 'your-application',
|
|
17
|
+
privacy: 'private',
|
|
18
|
+
featured: 'no',
|
|
19
|
+
registered: '2026-01-01T10:32:45Z',
|
|
20
|
+
research_domain: {
|
|
21
|
+
name: 'biology',
|
|
22
|
+
research_domain_identifier: {
|
|
23
|
+
identifier: 'https://example.com/01234567',
|
|
24
|
+
type: 'url'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
related_identifier: [{
|
|
28
|
+
identifier: 'https://doi.org/10.1234/dmp.123456789',
|
|
29
|
+
descriptor: 'cites',
|
|
30
|
+
work_type: 'dataset',
|
|
31
|
+
type: 'doi'
|
|
32
|
+
}],
|
|
33
|
+
research_facility: [{
|
|
34
|
+
name: 'Super telescope',
|
|
35
|
+
type: 'observatory',
|
|
36
|
+
research_facility_identifier: {
|
|
37
|
+
identifier: 'https://example.com/01234567',
|
|
38
|
+
type: 'url'
|
|
39
|
+
}
|
|
40
|
+
}],
|
|
41
|
+
funding_opportunity: [{
|
|
42
|
+
project_id: {
|
|
43
|
+
identifier: '123456789',
|
|
44
|
+
type: 'other'
|
|
45
|
+
},
|
|
46
|
+
funder_id: {
|
|
47
|
+
identifier: 'https://ror.org/0987654321',
|
|
48
|
+
type: 'ror'
|
|
49
|
+
},
|
|
50
|
+
opportunity_identifier: {
|
|
51
|
+
identifier: 'https://example.com/01234567',
|
|
52
|
+
type: 'url'
|
|
53
|
+
}
|
|
54
|
+
}],
|
|
55
|
+
version: [{
|
|
56
|
+
access_url: 'https://example.com/dmp/123456789?version=2026-01-01T10:32:45Z',
|
|
57
|
+
version_date: '2026-01-01T10:32:45Z',
|
|
58
|
+
}],
|
|
59
|
+
narrative: {
|
|
60
|
+
download_urls: {
|
|
61
|
+
csv: 'https://example.com/dmp/123456789/narrative.csv',
|
|
62
|
+
docx: 'https://example.com/dmp/123456789/narrative.docx',
|
|
63
|
+
html: 'https://example.com/dmp/123456789/narrative.html',
|
|
64
|
+
pdf: 'https://example.com/dmp/123456789/narrative.pdf',
|
|
65
|
+
txt: 'https://example.com/dmp/123456789/narrative.txt',
|
|
66
|
+
},
|
|
67
|
+
template: {
|
|
68
|
+
id: 1234567,
|
|
69
|
+
title: 'Narrative Template',
|
|
70
|
+
description: 'This is a test template for a DMP narrative',
|
|
71
|
+
version: 'v1',
|
|
72
|
+
section: [{
|
|
73
|
+
id: 9876,
|
|
74
|
+
title: 'Section one',
|
|
75
|
+
description: 'The first section of the narrative',
|
|
76
|
+
order: 1,
|
|
77
|
+
question: [{
|
|
78
|
+
id: 1234,
|
|
79
|
+
text: 'What is the purpose of this DMP?',
|
|
80
|
+
order: 1,
|
|
81
|
+
answer: {
|
|
82
|
+
id: 543,
|
|
83
|
+
json: {
|
|
84
|
+
type: 'repositorySearch',
|
|
85
|
+
answer: [{
|
|
86
|
+
repositoryId: 'https://example.com/repository/123456789',
|
|
87
|
+
repositoryName: 'Example Repository',
|
|
88
|
+
}],
|
|
89
|
+
meta: { schemaVersion: '1.0' }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
}]
|
|
93
|
+
}]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
(0, globals_1.expect)(() => extension_1.ExtensionSchema.parse(validData)).not.toThrow();
|
|
98
|
+
});
|
|
99
|
+
});
|