@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.
Files changed (41) hide show
  1. package/dist/answers/__tests__/answers.spec.js +27 -14
  2. package/dist/answers/__tests__/defaults.spec.js +2 -0
  3. package/dist/answers/index.d.ts +102 -0
  4. package/dist/answers/index.js +1 -0
  5. package/dist/answers/tableAnswers.d.ts +614 -136
  6. package/dist/answers/tableAnswers.js +43 -20
  7. package/dist/dmp/__tests__/commonStandard.spec.js +26 -22
  8. package/dist/dmp/__tests__/extensions.spec.js +21 -15
  9. package/dist/dmp/extension.d.ts +385 -92
  10. package/dist/dmp/extension.js +49 -103
  11. package/dist/dmp/index.d.ts +515 -2
  12. package/dist/dmp/index.js +11 -1
  13. package/dist/questions/__tests__/defaults.spec.js +20 -10
  14. package/dist/questions/__tests__/optionBasedQuestions.spec.js +17 -12
  15. package/dist/questions/__tests__/tableQuestion.spec.js +5 -0
  16. package/dist/questions/index.d.ts +20 -7
  17. package/dist/questions/optionBasedQuestions.d.ts +8 -6
  18. package/dist/questions/optionBasedQuestions.js +21 -8
  19. package/dist/questions/tableQuestions.d.ts +54 -16
  20. package/dist/questions/tableQuestions.js +56 -19
  21. package/dist/schemas/anyAnswer.schema.json +514 -0
  22. package/dist/schemas/anyQuestion.schema.json +60 -35
  23. package/dist/schemas/anyTableColumnQuestion.schema.json +9 -10
  24. package/dist/schemas/checkboxesQuestion.schema.json +3 -0
  25. package/dist/schemas/dmpExtension.schema.json +636 -140
  26. package/dist/schemas/multiselectBoxQuestion.schema.json +3 -5
  27. package/dist/schemas/radioButtonsQuestion.schema.json +3 -5
  28. package/dist/schemas/researchOutputTableAnswer.schema.json +6047 -11983
  29. package/dist/schemas/selectBoxQuestion.schema.json +3 -5
  30. package/dist/schemas/tableQuestion.schema.json +9 -10
  31. package/package.json +1 -1
  32. package/schemas/anyAnswer.schema.json +514 -0
  33. package/schemas/anyQuestion.schema.json +60 -35
  34. package/schemas/anyTableColumnQuestion.schema.json +9 -10
  35. package/schemas/checkboxesQuestion.schema.json +3 -0
  36. package/schemas/dmpExtension.schema.json +636 -140
  37. package/schemas/multiselectBoxQuestion.schema.json +3 -5
  38. package/schemas/radioButtonsQuestion.schema.json +3 -5
  39. package/schemas/researchOutputTableAnswer.schema.json +6047 -11983
  40. package/schemas/selectBoxQuestion.schema.json +3 -5
  41. package/schemas/tableQuestion.schema.json +9 -10
@@ -20,133 +20,79 @@ const researchFacilityTypes = [
20
20
  'observatory',
21
21
  'other',
22
22
  ];
23
- // Relation types are derived from the DataCite schema
24
- const relationTypes = [
25
- "is_cited_by",
26
- "cites",
27
- "is_supplement_to",
28
- "is_supplemented_by",
29
- "is_continued_by",
30
- "continues",
31
- "is_described_by",
32
- "describes",
33
- "has_metadata",
34
- "is_metadata_for",
35
- "has_version",
36
- "is_version_of",
37
- "is_new_version_of",
38
- "is_previous_version_of",
39
- "is_part_of",
40
- "has_part",
41
- "is_published_in",
42
- "is_referenced_by",
43
- "references",
44
- "is_documented_by",
45
- "documents",
46
- "is_compiled_by",
47
- "compiles",
48
- "is_variant_form_of",
49
- "is_original_form_of",
50
- "is_identical_to",
51
- "is_reviewed_by",
52
- "reviews",
53
- "is_derived_from",
54
- "is_source_of",
55
- "is_required_by",
56
- "requires",
57
- "obsoletes",
58
- "is_obsoleted_by",
59
- "is_collected_by",
60
- "collects",
61
- "is_translation_of",
62
- "has_translation"
23
+ // The possible statuses of a DMP
24
+ const statusTypes = [
25
+ 'archived',
26
+ 'draft',
27
+ 'complete',
63
28
  ];
64
- // Work types are derived from the DataCite schema
65
- const workTypes = [
66
- "audiovisual",
67
- "book",
68
- "book_chapter",
69
- "collection",
70
- "computational_notebook",
71
- "conference_paper",
72
- "conference_proceeding",
73
- "data_paper",
74
- "dataset",
75
- "dissertation",
76
- "event",
77
- "image",
78
- "instrument",
79
- "interactive_resource",
80
- "journal",
81
- "journal_article",
82
- "model",
83
- "output_management_plan",
84
- "peer_review",
85
- "physical_object",
86
- "preprint",
87
- "project",
88
- "report",
89
- "service",
90
- "software",
91
- "sound",
92
- "standard",
93
- "study_registration",
94
- "text",
95
- "workflow",
96
- "other"
29
+ const identifierTypes = [
30
+ 'ark',
31
+ 'doi',
32
+ 'handle',
33
+ 'ror',
34
+ 'url',
35
+ 'other',
97
36
  ];
98
37
  const ResearchDomainSchema = zod_1.z.object({
99
38
  // The human-readable name for the research domain
100
39
  name: zod_1.z.string(),
101
40
  // The identifier for the research domain
102
41
  research_domain_identifier: zod_1.z.object({
103
- identifier: zod_1.z.string().optional(),
104
- type: zod_1.z.enum(['ark', 'doi', 'handle', 'url', 'other']).default('url')
105
- }),
106
- });
107
- const RelatedIdentifierSchema = zod_1.z.object({
108
- // The description of how the DMP is related to the work (e.g. the DMP "cites" the work)
109
- descriptor: zod_1.z.enum(relationTypes).default('cites'),
110
- // The identifier of the work
111
- identifier: zod_1.z.string(),
112
- // The type of identifier
113
- type: zod_1.z.enum(['ark', 'doi', 'handle', 'url']).default('url'),
114
- // The type of the work
115
- work_type: zod_1.z.enum(workTypes).default('dataset'),
42
+ identifier: zod_1.z.string(),
43
+ type: zod_1.z.enum(identifierTypes)
44
+ }).optional(),
116
45
  });
117
46
  const ResearchFacilitySchema = zod_1.z.object({
118
47
  // The human-readable name of the research facility
119
48
  name: zod_1.z.string(),
120
49
  // The facility type
121
- type: zod_1.z.enum(researchFacilityTypes).default('other'),
50
+ type: zod_1.z.enum(researchFacilityTypes),
122
51
  // The identifier for the research facility
123
52
  research_facility_identifier: zod_1.z.object({
124
53
  identifier: zod_1.z.string(),
125
- type: zod_1.z.enum(['ark', 'doi', 'handle', 'url', 'other']).default('url')
126
- }),
54
+ type: zod_1.z.enum(identifierTypes)
55
+ }).optional(),
127
56
  });
128
57
  const FundingOpportunitySchema = zod_1.z.object({
129
58
  // The id of the project this opportunity maps to
130
59
  project_id: zod_1.z.object({
131
60
  identifier: zod_1.z.string(),
132
- type: zod_1.z.enum(['ark', 'doi', 'handle', 'url', 'other']).default('other')
61
+ type: zod_1.z.enum(identifierTypes)
133
62
  }),
134
63
  // The id of the funding this opportunity maps to within the project
135
64
  funder_id: zod_1.z.object({
136
65
  identifier: zod_1.z.string(),
137
- type: zod_1.z.enum(['ror', 'url', 'other']).default('ror')
66
+ type: zod_1.z.enum(identifierTypes)
138
67
  }),
139
68
  // The opportunity id
140
69
  opportunity_identifier: zod_1.z.object({
141
70
  identifier: zod_1.z.string(),
142
- type: zod_1.z.enum(['ark', 'doi', 'handle', 'url', 'other']).default('url')
71
+ type: zod_1.z.enum(identifierTypes)
72
+ })
73
+ });
74
+ const FundingProjectNumberSchema = zod_1.z.object({
75
+ // The id of the project this opportunity maps to
76
+ project_id: zod_1.z.object({
77
+ identifier: zod_1.z.string(),
78
+ type: zod_1.z.enum(identifierTypes)
79
+ }),
80
+ // The id of the funding this opportunity maps to within the project
81
+ funder_id: zod_1.z.object({
82
+ identifier: zod_1.z.string(),
83
+ type: zod_1.z.enum(identifierTypes)
84
+ }),
85
+ // The funder's identifier for this project
86
+ project_identifier: zod_1.z.object({
87
+ identifier: zod_1.z.string(),
88
+ type: zod_1.z.enum(identifierTypes)
143
89
  })
144
90
  });
145
91
  const VersionSchema = zod_1.z.object({
146
92
  // URL to fetch the historical version of the DMP
147
93
  access_url: zod_1.z.string(),
148
94
  // The date of the version
149
- version_date: zod_1.z.iso.datetime(),
95
+ version: zod_1.z.iso.datetime(),
150
96
  });
151
97
  const NarrativeAnswerSchema = zod_1.z.object({
152
98
  id: zod_1.z.number(),
@@ -193,41 +139,41 @@ const DefaultNarrativeTemplate = NarrativeTemplateSchema.parse({
193
139
  title: 'Undefined template',
194
140
  section: [DefaultSection]
195
141
  });
196
- // URLs to fetch the narrative as a document other than JSON
197
- const NarrativeURLsSchema = zod_1.z.object({
198
- csv: zod_1.z.string().optional(),
199
- docx: zod_1.z.string().optional(),
200
- html: zod_1.z.string().optional(),
201
- pdf: zod_1.z.string().optional(),
202
- });
203
142
  const NarrativeSchema = zod_1.z.object({
204
- download_urls: NarrativeURLsSchema.optional(),
143
+ download_url: zod_1.z.string().optional(),
205
144
  template: NarrativeTemplateSchema.optional(),
206
145
  });
207
146
  exports.DefaultNarrative = NarrativeSchema.parse({
208
147
  template: DefaultNarrativeTemplate
209
148
  });
210
149
  exports.ExtensionSchema = zod_1.z.object({
150
+ // TODO: Would eventually be nice to set this to the RDA_COMMON_STANDARD_VERSION
151
+ // when Zod's toJSONSchema allows it
152
+ rda_schema_version: zod_1.z.string().default("1.2"),
211
153
  // The name of the system that owns this record
212
154
  provenance: zod_1.z.string(),
155
+ // The current status of the DMP
156
+ status: zod_1.z.enum(statusTypes).default('draft'),
213
157
  // The visibility setting for the DMP
214
158
  privacy: zod_1.z.enum(visibilityTypes).default('private'),
215
159
  // Whether the DMP is featured on the public plans page of the DMP Tool website
216
160
  featured: zod_1.z.enum(['yes', 'no']).default('no'),
217
161
  // The date the DMP Id was registered as a DOI with EZID/DataCite
218
162
  registered: zod_1.z.iso.datetime().optional(),
163
+ // The date the DMP's DOI was tomb-stoned
164
+ tombstoned: zod_1.z.iso.datetime().optional(),
219
165
  // The narrative content of the DMP expressed as a JSON object
220
166
  narrative: NarrativeSchema.optional(),
221
167
  // The research domain of the project/DMP
222
168
  research_domain: ResearchDomainSchema.optional(),
223
- // Other works related to the DMP
224
- related_identifier: zod_1.z.array(RelatedIdentifierSchema).optional(),
225
169
  // Research facilities used to collect or process data
226
170
  research_facility: zod_1.z.array(ResearchFacilitySchema).optional(),
227
171
  // Historical versions of the DMP
228
172
  version: zod_1.z.array(VersionSchema).optional(),
229
173
  // Funding opportunity / call for grant submissions related to the funding
230
174
  funding_opportunity: zod_1.z.array(FundingOpportunitySchema).optional(),
175
+ // Funding project number (defined by the funder)
176
+ funding_project: zod_1.z.array(FundingProjectNumberSchema).optional(),
231
177
  });
232
178
  exports.DefaultExtensionSchema = exports.ExtensionSchema.parse({
233
179
  provenance: 'your-application',