@dmptool/types 1.2.6 → 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/README.md +1 -1
- package/dist/answers/__tests__/defaults.spec.js +216 -0
- package/dist/answers/answer.d.ts +29 -14
- package/dist/answers/answer.js +11 -5
- package/dist/answers/dateAnswers.d.ts +20 -47
- package/dist/answers/dateAnswers.js +20 -10
- package/dist/answers/graphQLAnswers.d.ts +48 -120
- package/dist/answers/graphQLAnswers.js +46 -21
- package/dist/answers/index.d.ts +155 -1439
- package/dist/answers/index.js +26 -1
- package/dist/answers/numberAnswers.d.ts +38 -92
- package/dist/answers/numberAnswers.js +38 -19
- package/dist/answers/optionBasedAnswers.d.ts +42 -87
- package/dist/answers/optionBasedAnswers.js +37 -21
- package/dist/answers/tableAnswers.d.ts +348 -3032
- package/dist/answers/tableAnswers.js +25 -61
- package/dist/answers/textAnswers.d.ts +32 -68
- package/dist/answers/textAnswers.js +30 -17
- 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/__tests__/dateQuestions.spec.js +3 -0
- package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
- package/dist/questions/__tests__/defaults.spec.js +668 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
- package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
- package/dist/questions/__tests__/textQuestions.spec.js +32 -0
- package/dist/questions/dateQuestions.d.ts +45 -191
- package/dist/questions/dateQuestions.js +26 -23
- package/dist/questions/graphQLQuestions.d.ts +262 -556
- package/dist/questions/graphQLQuestions.js +225 -223
- package/dist/questions/index.d.ts +670 -7441
- package/dist/questions/index.js +26 -1
- package/dist/questions/numberQuestions.d.ts +85 -331
- package/dist/questions/numberQuestions.js +50 -36
- package/dist/questions/optionBasedQuestions.d.ts +83 -290
- package/dist/questions/optionBasedQuestions.js +58 -41
- package/dist/questions/question.d.ts +72 -35
- package/dist/questions/question.js +14 -5
- package/dist/questions/tableQuestions.d.ts +2228 -9599
- package/dist/questions/tableQuestions.js +185 -192
- package/dist/questions/textQuestions.d.ts +70 -226
- package/dist/questions/textQuestions.js +31 -31
- package/dist/schemas/affiliationSearchAnswer.schema.json +35 -33
- package/dist/schemas/affiliationSearchQuestion.schema.json +124 -122
- package/dist/schemas/anyAnswer.schema.json +1229 -408
- package/dist/schemas/anyQuestion.schema.json +4312 -2023
- package/dist/schemas/anyTableColumnAnswer.schema.json +535 -314
- package/dist/schemas/anyTableColumnQuestion.schema.json +1309 -874
- package/dist/schemas/booleanAnswer.schema.json +22 -23
- package/dist/schemas/booleanQuestion.schema.json +39 -43
- package/dist/schemas/checkboxesAnswer.schema.json +27 -28
- package/dist/schemas/checkboxesQuestion.schema.json +63 -62
- package/dist/schemas/currencyAnswer.schema.json +22 -23
- package/dist/schemas/currencyQuestion.schema.json +57 -54
- package/dist/schemas/dateAnswer.schema.json +22 -23
- package/dist/schemas/dateQuestion.schema.json +50 -49
- package/dist/schemas/dateRangeAnswer.schema.json +35 -33
- package/dist/schemas/dateRangeQuestion.schema.json +87 -78
- package/dist/schemas/dmp.schema.json +2070 -0
- package/dist/schemas/dmpExtension.schema.json +1874 -0
- package/dist/schemas/emailAnswer.schema.json +22 -23
- package/dist/schemas/emailQuestion.schema.json +55 -53
- package/dist/schemas/licenseSearchAnswer.schema.json +40 -38
- package/dist/schemas/licenseSearchQuestion.schema.json +122 -146
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +40 -38
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +123 -156
- package/dist/schemas/multiselectBoxAnswer.schema.json +27 -28
- package/dist/schemas/multiselectBoxQuestion.schema.json +70 -71
- package/dist/schemas/numberAnswer.schema.json +22 -23
- package/dist/schemas/numberQuestion.schema.json +52 -50
- package/dist/schemas/numberRangeAnswer.schema.json +35 -33
- package/dist/schemas/numberRangeQuestion.schema.json +91 -60
- package/dist/schemas/numberWithContextAnswer.schema.json +35 -33
- package/dist/schemas/numberWithContextQuestion.schema.json +81 -70
- package/dist/schemas/radioButtonsAnswer.schema.json +22 -23
- package/dist/schemas/radioButtonsQuestion.schema.json +63 -62
- package/dist/schemas/repositorySearchAnswer.schema.json +40 -38
- package/dist/schemas/repositorySearchQuestion.schema.json +122 -162
- package/dist/schemas/researchOutputTableAnswer.schema.json +16622 -411
- package/dist/schemas/researchOutputTableQuestion.schema.json +114 -1157
- package/dist/schemas/selectBoxAnswer.schema.json +22 -23
- package/dist/schemas/selectBoxQuestion.schema.json +70 -71
- package/dist/schemas/tableAnswer.schema.json +581 -360
- package/dist/schemas/tableQuestion.schema.json +1388 -942
- package/dist/schemas/textAnswer.schema.json +22 -23
- package/dist/schemas/textAreaAnswer.schema.json +22 -23
- package/dist/schemas/textAreaQuestion.schema.json +65 -57
- package/dist/schemas/textQuestion.schema.json +50 -49
- package/dist/schemas/urlAnswer.schema.json +22 -23
- package/dist/schemas/urlQuestion.schema.json +50 -49
- package/package.json +6 -4
- package/dist/answers/__tests__/usage.spec.js +0 -178
- package/dist/questions/__tests__/usage.spec.d.ts +0 -8
- package/dist/questions/__tests__/usage.spec.js +0 -473
- /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResearchOutputTableAnswerSchema = exports.
|
|
3
|
+
exports.AnyTableColumnAnswerJSONSchema = exports.ResearchOutputTableAnswerJSONSchema = exports.TableAnswerJSONSchema = exports.DefaultResearchOutputTableAnswer = exports.ResearchOutputTableAnswerSchema = exports.DefaultTableAnswer = exports.TableAnswerSchema = exports.AnyTableColumnAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
6
|
const optionBasedAnswers_1 = require("./optionBasedAnswers");
|
|
@@ -30,76 +30,40 @@ exports.AnyTableColumnAnswerSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
30
30
|
textAnswers_1.TextAreaAnswerSchema,
|
|
31
31
|
textAnswers_1.URLAnswerSchema
|
|
32
32
|
]);
|
|
33
|
-
|
|
33
|
+
const TableRowAnswerSchema = zod_1.z.object({
|
|
34
34
|
columns: zod_1.z.array(exports.AnyTableColumnAnswerSchema) // The answers for each column in the row
|
|
35
35
|
});
|
|
36
|
+
const DefaultTableRowAnswer = TableRowAnswerSchema.parse({
|
|
37
|
+
columns: [textAnswers_1.DefaultTextAreaAnswer]
|
|
38
|
+
});
|
|
36
39
|
// Answers to Table Question Types
|
|
37
|
-
exports.TableAnswerSchema = answer_1.AnswerSchema.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type: zod_1.z.literal('researchOutputTable'),
|
|
50
|
-
columnHeadings: zod_1.z.array(zod_1.z.string()).default(['Title', 'Output Type']),
|
|
51
|
-
answer: zod_1.z.array(exports.TableRowAnswerSchema).default([{
|
|
40
|
+
exports.TableAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('table'), columnHeadings: zod_1.z.array(zod_1.z.string()).default(['Column A']), answer: zod_1.z.array(TableRowAnswerSchema) }));
|
|
41
|
+
exports.DefaultTableAnswer = exports.TableAnswerSchema.parse({
|
|
42
|
+
type: 'table',
|
|
43
|
+
columnHeadings: ['Column A'],
|
|
44
|
+
answer: [DefaultTableRowAnswer],
|
|
45
|
+
meta: questions_1.DefaultMeta
|
|
46
|
+
});
|
|
47
|
+
exports.ResearchOutputTableAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, exports.TableAnswerSchema.shape), { type: zod_1.z.literal('researchOutputTable'), columnHeadings: zod_1.z.array(zod_1.z.string()).default(['Title', 'Type']) }));
|
|
48
|
+
exports.DefaultResearchOutputTableAnswer = exports.ResearchOutputTableAnswerSchema.parse({
|
|
49
|
+
type: 'researchOutputTable',
|
|
50
|
+
columnHeadings: ['Title', 'Type'],
|
|
51
|
+
answer: [{
|
|
52
52
|
columns: [
|
|
53
53
|
{
|
|
54
54
|
type: 'text',
|
|
55
55
|
answer: '',
|
|
56
|
-
meta:
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: 'textArea',
|
|
60
|
-
answer: '',
|
|
61
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: 'selectBox',
|
|
65
|
-
answer: '',
|
|
66
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: 'checkBoxes',
|
|
70
|
-
answer: [],
|
|
71
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
56
|
+
meta: questions_1.DefaultMeta
|
|
72
57
|
},
|
|
73
58
|
{
|
|
74
59
|
type: 'selectBox',
|
|
75
60
|
answer: '',
|
|
76
|
-
meta:
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
type: 'date',
|
|
80
|
-
answer: '',
|
|
81
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
type: 'numberWithContext',
|
|
85
|
-
answer: { value: undefined, context: '' },
|
|
86
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'repositorySearch',
|
|
90
|
-
answer: [],
|
|
91
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: 'metadataStandardSearch',
|
|
95
|
-
answer: [],
|
|
96
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
type: 'licenseSearch',
|
|
100
|
-
answer: [],
|
|
101
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
61
|
+
meta: questions_1.DefaultMeta
|
|
102
62
|
}
|
|
103
63
|
]
|
|
104
|
-
}]
|
|
105
|
-
|
|
64
|
+
}],
|
|
65
|
+
meta: questions_1.DefaultMeta
|
|
66
|
+
});
|
|
67
|
+
exports.TableAnswerJSONSchema = zod_1.z.toJSONSchema(exports.TableAnswerSchema);
|
|
68
|
+
exports.ResearchOutputTableAnswerJSONSchema = zod_1.z.toJSONSchema(exports.ResearchOutputTableAnswerSchema);
|
|
69
|
+
exports.AnyTableColumnAnswerJSONSchema = zod_1.z.toJSONSchema(exports.AnyTableColumnAnswerSchema);
|
|
@@ -1,101 +1,65 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const EmailAnswerSchema: z.ZodObject<{
|
|
3
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
4
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
schemaVersion: string;
|
|
7
|
-
}, {
|
|
8
|
-
schemaVersion?: string | undefined;
|
|
9
|
-
}>>;
|
|
10
|
-
} & {
|
|
11
3
|
type: z.ZodLiteral<"email">;
|
|
12
4
|
answer: z.ZodDefault<z.ZodString>;
|
|
13
|
-
|
|
5
|
+
meta: z.ZodObject<{
|
|
6
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const DefaultEmailAnswer: {
|
|
14
10
|
type: "email";
|
|
11
|
+
answer: string;
|
|
15
12
|
meta: {
|
|
16
13
|
schemaVersion: string;
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
}, {
|
|
20
|
-
type: "email";
|
|
21
|
-
meta?: {
|
|
22
|
-
schemaVersion?: string | undefined;
|
|
23
|
-
} | undefined;
|
|
24
|
-
answer?: string | undefined;
|
|
25
|
-
}>;
|
|
15
|
+
};
|
|
26
16
|
export declare const TextAnswerSchema: z.ZodObject<{
|
|
27
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
28
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
schemaVersion: string;
|
|
31
|
-
}, {
|
|
32
|
-
schemaVersion?: string | undefined;
|
|
33
|
-
}>>;
|
|
34
|
-
} & {
|
|
35
17
|
type: z.ZodLiteral<"text">;
|
|
36
18
|
answer: z.ZodDefault<z.ZodString>;
|
|
37
|
-
|
|
19
|
+
meta: z.ZodObject<{
|
|
20
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const DefaultTextAnswer: {
|
|
38
24
|
type: "text";
|
|
25
|
+
answer: string;
|
|
39
26
|
meta: {
|
|
40
27
|
schemaVersion: string;
|
|
41
28
|
};
|
|
42
|
-
|
|
43
|
-
}, {
|
|
44
|
-
type: "text";
|
|
45
|
-
meta?: {
|
|
46
|
-
schemaVersion?: string | undefined;
|
|
47
|
-
} | undefined;
|
|
48
|
-
answer?: string | undefined;
|
|
49
|
-
}>;
|
|
29
|
+
};
|
|
50
30
|
export declare const TextAreaAnswerSchema: z.ZodObject<{
|
|
51
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
52
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
schemaVersion: string;
|
|
55
|
-
}, {
|
|
56
|
-
schemaVersion?: string | undefined;
|
|
57
|
-
}>>;
|
|
58
|
-
} & {
|
|
59
31
|
type: z.ZodLiteral<"textArea">;
|
|
60
32
|
answer: z.ZodDefault<z.ZodString>;
|
|
61
|
-
|
|
33
|
+
meta: z.ZodObject<{
|
|
34
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const DefaultTextAreaAnswer: {
|
|
62
38
|
type: "textArea";
|
|
39
|
+
answer: string;
|
|
63
40
|
meta: {
|
|
64
41
|
schemaVersion: string;
|
|
65
42
|
};
|
|
66
|
-
|
|
67
|
-
}, {
|
|
68
|
-
type: "textArea";
|
|
69
|
-
meta?: {
|
|
70
|
-
schemaVersion?: string | undefined;
|
|
71
|
-
} | undefined;
|
|
72
|
-
answer?: string | undefined;
|
|
73
|
-
}>;
|
|
43
|
+
};
|
|
74
44
|
export declare const URLAnswerSchema: z.ZodObject<{
|
|
75
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
76
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
77
|
-
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
schemaVersion: string;
|
|
79
|
-
}, {
|
|
80
|
-
schemaVersion?: string | undefined;
|
|
81
|
-
}>>;
|
|
82
|
-
} & {
|
|
83
45
|
type: z.ZodLiteral<"url">;
|
|
84
46
|
answer: z.ZodDefault<z.ZodString>;
|
|
85
|
-
|
|
47
|
+
meta: z.ZodObject<{
|
|
48
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const DefaultURLAnswer: {
|
|
86
52
|
type: "url";
|
|
53
|
+
answer: string;
|
|
87
54
|
meta: {
|
|
88
55
|
schemaVersion: string;
|
|
89
56
|
};
|
|
90
|
-
|
|
91
|
-
}, {
|
|
92
|
-
type: "url";
|
|
93
|
-
meta?: {
|
|
94
|
-
schemaVersion?: string | undefined;
|
|
95
|
-
} | undefined;
|
|
96
|
-
answer?: string | undefined;
|
|
97
|
-
}>;
|
|
57
|
+
};
|
|
98
58
|
export type EmailAnswerType = z.infer<typeof EmailAnswerSchema>;
|
|
99
59
|
export type TextAnswerType = z.infer<typeof TextAnswerSchema>;
|
|
100
60
|
export type TextAreaAnswerType = z.infer<typeof TextAreaAnswerSchema>;
|
|
101
61
|
export type URLAnswerType = z.infer<typeof URLAnswerSchema>;
|
|
62
|
+
export declare const EmailAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
63
|
+
export declare const TextAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
64
|
+
export declare const TextAreaAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
65
|
+
export declare const URLAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.URLAnswerSchema = exports.TextAreaAnswerSchema = exports.TextAnswerSchema = exports.EmailAnswerSchema = void 0;
|
|
3
|
+
exports.URLAnswerJSONSchema = exports.TextAreaAnswerJSONSchema = exports.TextAnswerJSONSchema = exports.EmailAnswerJSONSchema = exports.DefaultURLAnswer = exports.URLAnswerSchema = exports.DefaultTextAreaAnswer = exports.TextAreaAnswerSchema = exports.DefaultTextAnswer = exports.TextAnswerSchema = exports.DefaultEmailAnswer = exports.EmailAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
|
+
const questions_1 = require("../questions");
|
|
6
7
|
// Answers to Text Based Question Types
|
|
7
|
-
exports.EmailAnswerSchema = answer_1.AnswerSchema.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
exports.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
exports.EmailAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('email'), answer: zod_1.z.string().default('') }));
|
|
9
|
+
exports.DefaultEmailAnswer = exports.EmailAnswerSchema.parse({
|
|
10
|
+
type: 'email',
|
|
11
|
+
answer: '',
|
|
12
|
+
meta: questions_1.DefaultMeta
|
|
13
|
+
});
|
|
14
|
+
exports.TextAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('text'), answer: zod_1.z.string().default('') }));
|
|
15
|
+
exports.DefaultTextAnswer = exports.TextAnswerSchema.parse({
|
|
16
|
+
type: 'text',
|
|
17
|
+
answer: '',
|
|
18
|
+
meta: questions_1.DefaultMeta
|
|
19
|
+
});
|
|
20
|
+
exports.TextAreaAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('textArea'), answer: zod_1.z.string().default('') }));
|
|
21
|
+
exports.DefaultTextAreaAnswer = exports.TextAreaAnswerSchema.parse({
|
|
22
|
+
type: 'textArea',
|
|
23
|
+
answer: '',
|
|
24
|
+
meta: questions_1.DefaultMeta
|
|
25
|
+
});
|
|
26
|
+
exports.URLAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('url'), answer: zod_1.z.string().default('') }));
|
|
27
|
+
exports.DefaultURLAnswer = exports.URLAnswerSchema.parse({
|
|
28
|
+
type: 'url',
|
|
29
|
+
answer: '',
|
|
30
|
+
meta: questions_1.DefaultMeta
|
|
31
|
+
});
|
|
32
|
+
exports.EmailAnswerJSONSchema = zod_1.z.toJSONSchema(exports.EmailAnswerSchema);
|
|
33
|
+
exports.TextAnswerJSONSchema = zod_1.z.toJSONSchema(exports.TextAnswerSchema);
|
|
34
|
+
exports.TextAreaAnswerJSONSchema = zod_1.z.toJSONSchema(exports.TextAreaAnswerSchema);
|
|
35
|
+
exports.URLAnswerJSONSchema = zod_1.z.toJSONSchema(exports.URLAnswerSchema);
|
|
@@ -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
|
+
});
|