@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,35 +1,84 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const CURRENT_SCHEMA_VERSION = "1.0";
|
|
3
|
-
export declare const QuestionFormatsEnum: z.ZodEnum<
|
|
3
|
+
export declare const QuestionFormatsEnum: z.ZodEnum<{
|
|
4
|
+
number: "number";
|
|
5
|
+
boolean: "boolean";
|
|
6
|
+
affiliationSearch: "affiliationSearch";
|
|
7
|
+
checkBoxes: "checkBoxes";
|
|
8
|
+
currency: "currency";
|
|
9
|
+
date: "date";
|
|
10
|
+
dateRange: "dateRange";
|
|
11
|
+
email: "email";
|
|
12
|
+
licenseSearch: "licenseSearch";
|
|
13
|
+
metadataStandardSearch: "metadataStandardSearch";
|
|
14
|
+
multiselectBox: "multiselectBox";
|
|
15
|
+
numberRange: "numberRange";
|
|
16
|
+
numberWithContext: "numberWithContext";
|
|
17
|
+
radioButtons: "radioButtons";
|
|
18
|
+
repositorySearch: "repositorySearch";
|
|
19
|
+
researchOutputTable: "researchOutputTable";
|
|
20
|
+
selectBox: "selectBox";
|
|
21
|
+
table: "table";
|
|
22
|
+
text: "text";
|
|
23
|
+
textArea: "textArea";
|
|
24
|
+
url: "url";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const BaseMetaSchema: z.ZodObject<{
|
|
27
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
28
|
+
title: z.ZodOptional<z.ZodString>;
|
|
29
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const DefaultMeta: {
|
|
32
|
+
schemaVersion: string;
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
usageDescription?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
export declare const BaseAttributesSchema: z.ZodObject<{
|
|
37
|
+
label: z.ZodOptional<z.ZodString>;
|
|
38
|
+
help: z.ZodOptional<z.ZodString>;
|
|
39
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export declare const DefaultAttributes: {
|
|
42
|
+
label?: string | undefined;
|
|
43
|
+
help?: string | undefined;
|
|
44
|
+
labelTranslationKey?: string | undefined;
|
|
45
|
+
};
|
|
4
46
|
export declare const QuestionSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<
|
|
47
|
+
type: z.ZodEnum<{
|
|
48
|
+
number: "number";
|
|
49
|
+
boolean: "boolean";
|
|
50
|
+
affiliationSearch: "affiliationSearch";
|
|
51
|
+
checkBoxes: "checkBoxes";
|
|
52
|
+
currency: "currency";
|
|
53
|
+
date: "date";
|
|
54
|
+
dateRange: "dateRange";
|
|
55
|
+
email: "email";
|
|
56
|
+
licenseSearch: "licenseSearch";
|
|
57
|
+
metadataStandardSearch: "metadataStandardSearch";
|
|
58
|
+
multiselectBox: "multiselectBox";
|
|
59
|
+
numberRange: "numberRange";
|
|
60
|
+
numberWithContext: "numberWithContext";
|
|
61
|
+
radioButtons: "radioButtons";
|
|
62
|
+
repositorySearch: "repositorySearch";
|
|
63
|
+
researchOutputTable: "researchOutputTable";
|
|
64
|
+
selectBox: "selectBox";
|
|
65
|
+
table: "table";
|
|
66
|
+
text: "text";
|
|
67
|
+
textArea: "textArea";
|
|
68
|
+
url: "url";
|
|
69
|
+
}>;
|
|
6
70
|
attributes: z.ZodObject<{
|
|
7
71
|
label: z.ZodOptional<z.ZodString>;
|
|
8
72
|
help: z.ZodOptional<z.ZodString>;
|
|
9
73
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
help?: string | undefined;
|
|
13
|
-
labelTranslationKey?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
label?: string | undefined;
|
|
16
|
-
help?: string | undefined;
|
|
17
|
-
labelTranslationKey?: string | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
meta: z.ZodObject<{
|
|
20
76
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
21
77
|
title: z.ZodOptional<z.ZodString>;
|
|
22
78
|
usageDescription: z.ZodOptional<z.ZodString>;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
usageDescription?: string | undefined;
|
|
27
|
-
}, {
|
|
28
|
-
schemaVersion?: string | undefined;
|
|
29
|
-
title?: string | undefined;
|
|
30
|
-
usageDescription?: string | undefined;
|
|
31
|
-
}>>;
|
|
32
|
-
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const DefaultQuestionSchema: {
|
|
33
82
|
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
34
83
|
attributes: {
|
|
35
84
|
label?: string | undefined;
|
|
@@ -41,19 +90,7 @@ export declare const QuestionSchema: z.ZodObject<{
|
|
|
41
90
|
title?: string | undefined;
|
|
42
91
|
usageDescription?: string | undefined;
|
|
43
92
|
};
|
|
44
|
-
}
|
|
45
|
-
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
46
|
-
attributes: {
|
|
47
|
-
label?: string | undefined;
|
|
48
|
-
help?: string | undefined;
|
|
49
|
-
labelTranslationKey?: string | undefined;
|
|
50
|
-
};
|
|
51
|
-
meta?: {
|
|
52
|
-
schemaVersion?: string | undefined;
|
|
53
|
-
title?: string | undefined;
|
|
54
|
-
usageDescription?: string | undefined;
|
|
55
|
-
} | undefined;
|
|
56
|
-
}>;
|
|
93
|
+
};
|
|
57
94
|
export type QuestionType = z.infer<typeof QuestionFormatsEnum>;
|
|
58
95
|
export interface QuestionFormatsUsageInterface {
|
|
59
96
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestionFormatsUsage = exports.QuestionSchema = exports.QuestionFormatsEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
|
|
3
|
+
exports.QuestionFormatsUsage = exports.DefaultQuestionSchema = exports.QuestionSchema = exports.DefaultAttributes = exports.BaseAttributesSchema = exports.DefaultMeta = exports.BaseMetaSchema = exports.QuestionFormatsEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.CURRENT_SCHEMA_VERSION = '1.0'; // The current schema version
|
|
6
6
|
// The available question formats
|
|
@@ -27,21 +27,30 @@ exports.QuestionFormatsEnum = zod_1.z.enum([
|
|
|
27
27
|
'textArea',
|
|
28
28
|
'url'
|
|
29
29
|
]);
|
|
30
|
-
|
|
30
|
+
exports.BaseMetaSchema = zod_1.z.object({
|
|
31
31
|
schemaVersion: zod_1.z.string().default(exports.CURRENT_SCHEMA_VERSION), // The schema version
|
|
32
32
|
title: zod_1.z.string().optional(), // The title of the question type
|
|
33
33
|
usageDescription: zod_1.z.string().optional(), // A description of when to use the question type
|
|
34
34
|
});
|
|
35
|
-
|
|
35
|
+
// Calling Zod's `parse` on a schema creates an object that uses all the defaults defined,
|
|
36
|
+
// so, for example with this schema we get `{ schemaVersion: "1.0" }`
|
|
37
|
+
exports.DefaultMeta = exports.BaseMetaSchema.parse({});
|
|
38
|
+
exports.BaseAttributesSchema = zod_1.z.object({
|
|
36
39
|
label: zod_1.z.string().optional(), // UI label for the field
|
|
37
40
|
help: zod_1.z.string().optional(), // Help/tooltip text for the field
|
|
38
41
|
labelTranslationKey: zod_1.z.string().optional() // The local translation key for the label
|
|
39
42
|
});
|
|
43
|
+
exports.DefaultAttributes = exports.BaseAttributesSchema.parse({});
|
|
40
44
|
// Base abstract type for all questions
|
|
41
45
|
exports.QuestionSchema = zod_1.z.object({
|
|
42
46
|
type: exports.QuestionFormatsEnum, // The type of question
|
|
43
|
-
attributes:
|
|
44
|
-
meta:
|
|
47
|
+
attributes: exports.BaseAttributesSchema, // Field attributes
|
|
48
|
+
meta: exports.BaseMetaSchema, // Information for the field
|
|
49
|
+
});
|
|
50
|
+
exports.DefaultQuestionSchema = exports.QuestionSchema.parse({
|
|
51
|
+
type: 'textArea',
|
|
52
|
+
attributes: exports.DefaultAttributes,
|
|
53
|
+
meta: exports.DefaultMeta
|
|
45
54
|
});
|
|
46
55
|
exports.QuestionFormatsUsage = {
|
|
47
56
|
affiliationSearch: {
|