@dmptool/types 1.2.2 → 1.2.4
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 +8 -0
- package/dist/answers/__tests__/answers.spec.js +122 -6
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +120 -25
- package/dist/answers/graphQLAnswers.js +22 -5
- package/dist/answers/index.d.ts +498 -31
- package/dist/answers/index.js +11 -2
- package/dist/answers/numberAnswers.d.ts +40 -0
- package/dist/answers/numberAnswers.js +8 -1
- package/dist/answers/tableAnswers.d.ts +1688 -75
- package/dist/answers/tableAnswers.js +63 -2
- package/dist/questions/__tests__/graphQLQuestions.spec.js +177 -39
- package/dist/questions/__tests__/numberQuestions.spec.js +36 -0
- package/dist/questions/__tests__/tableQuestion.spec.js +145 -0
- package/dist/questions/__tests__/usage.spec.js +162 -1
- package/dist/questions/graphQLQuestions.d.ts +420 -60
- package/dist/questions/graphQLQuestions.js +257 -11
- package/dist/questions/index.d.ts +4849 -189
- package/dist/questions/index.js +9 -2
- package/dist/questions/numberQuestions.d.ts +105 -0
- package/dist/questions/numberQuestions.js +12 -1
- package/dist/questions/question.d.ts +4 -4
- package/dist/questions/question.js +25 -4
- package/dist/questions/tableQuestions.d.ts +5930 -679
- package/dist/questions/tableQuestions.js +175 -3
- package/dist/schemas/anyAnswer.schema.json +226 -69
- package/dist/schemas/anyQuestion.schema.json +829 -101
- package/dist/schemas/anyTableColumnAnswer.schema.json +116 -5
- package/dist/schemas/anyTableColumnQuestion.schema.json +326 -24
- package/dist/schemas/licenseSearchAnswer.schema.json +49 -0
- package/dist/schemas/licenseSearchQuestion.schema.json +164 -0
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +49 -0
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +174 -0
- package/dist/schemas/numberWithContextAnswer.schema.json +45 -0
- package/dist/schemas/numberWithContextQuestion.schema.json +84 -0
- package/dist/schemas/repositorySearchAnswer.schema.json +49 -0
- package/dist/schemas/repositorySearchQuestion.schema.json +180 -0
- package/dist/schemas/researchOutputTableAnswer.schema.json +519 -0
- package/dist/schemas/researchOutputTableQuestion.schema.json +1183 -0
- package/dist/schemas/tableAnswer.schema.json +116 -5
- package/dist/schemas/tableQuestion.schema.json +348 -24
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -24,10 +24,14 @@ The available question schemas/types are:
|
|
|
24
24
|
- `DateQuestion` A date field. Supports `YYYY-MM-DD` format.
|
|
25
25
|
- `DateRangeQuestion` A series of 2 date fields. Meant to capture "From" and "To" or "Start" and "End" dates.
|
|
26
26
|
- `EmailQuestion` An email address. Supports multiple emails that are comma separated.
|
|
27
|
+
- `LicenseSearch` A GraphQL enabled question to search for relevant Licenses
|
|
28
|
+
- `MetadataStandardSearch` A GraphQL enabled question to search for relevant Metadata Standards
|
|
27
29
|
- `MultiselectBoxQuestion` A select box that allows for multiple selections
|
|
28
30
|
- `NumberQuestion` A numeric field. Supports both integers and floats.
|
|
29
31
|
- `NumberRangeQuestion` A series of 2 number fields. Meant to capture "From" and "To" or "Min" and "Max" numbers.
|
|
30
32
|
- `RadioButtonsQuestion` A question type that supports an array of `option` objects. The user may "select" a single option.
|
|
33
|
+
- `RepositorySearch` A GraphQL enabled question to search for relevant Repositories
|
|
34
|
+
- `ResearchOutputsTable` A table/collection of questions to allow for users to define title, description, repositories, license, etc. for multiple research outputs.
|
|
31
35
|
- `SelectBoxQuestion` A drop down select box that supports an array of `option` objects. A `multiple` flag can be set to allow multi-select.
|
|
32
36
|
- `TableQuestion` A table question type. Each column in the table can be any one of the `AnyTableColumnQuestion` types.
|
|
33
37
|
- `TextQuestion` A simple text field
|
|
@@ -48,10 +52,14 @@ The available answer schemas/types are:
|
|
|
48
52
|
- `DateAnswer` A date field. Supports `YYYY-MM-DD` format.
|
|
49
53
|
- `DateRangeAnswer` A series of 2 date fields. Meant to capture "From" and "To" or "Start" and "End" dates.
|
|
50
54
|
- `EmailAnswer` An email address. Supports multiple emails that are comma separated.
|
|
55
|
+
- `LicenseSearch` A license name and URL identifier
|
|
56
|
+
- `MetadataStandardSearch` An array of names and URL identifiers for metadata standards
|
|
51
57
|
- `MultiselectAnswer` An array of `option` objects each containing the value of a selected entry.
|
|
52
58
|
- `NumberAnswer` A numeric field. Supports both integers and floats.
|
|
53
59
|
- `DateRangeAnswer` A series of 2 numbers. Meant to capture "From" and "To" or "Start" and "End".
|
|
54
60
|
- `RadioButtonsAnswer` A answer type that supports an array of `option` objects. The user may "select" a single option.
|
|
61
|
+
- `RepositorySearch` An array of names and URL identifiers for a repositories
|
|
62
|
+
- `ResearchOutputsTable` A table/collection of answers to allow for users to define title, description, repositories, license, etc. for multiple research outputs.
|
|
55
63
|
- `SelectBoxAnswer` The value the user selected.
|
|
56
64
|
- `TableAnswer` A table answer type. Each column in the table can be any one of the `AnyTableColumnAnswer` types.
|
|
57
65
|
- `TextAnswer` A simple text field
|
|
@@ -54,12 +54,6 @@ const questions_1 = require("../../questions");
|
|
|
54
54
|
const invalidData = { type: 'email', answer: 12345 };
|
|
55
55
|
(0, globals_1.expect)(() => textAnswers_1.EmailAnswerSchema.parse(invalidData)).toThrow();
|
|
56
56
|
});
|
|
57
|
-
(0, globals_1.it)('should validate FilteredSearchAnswer', () => {
|
|
58
|
-
const validData = { type: 'filteredSearch', answer: ['item1', 'item2'], meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
59
|
-
(0, globals_1.expect)(() => graphQLAnswers_1.FilteredSearchAnswerSchema.parse(validData)).not.toThrow();
|
|
60
|
-
const invalidData = { type: 'filteredSearch', answer: 'item1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
61
|
-
(0, globals_1.expect)(() => graphQLAnswers_1.FilteredSearchAnswerSchema.parse(invalidData)).toThrow();
|
|
62
|
-
});
|
|
63
57
|
(0, globals_1.it)('should validate NumberAnswer', () => {
|
|
64
58
|
const validData = { type: 'number', answer: 42, meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
65
59
|
(0, globals_1.expect)(() => numberAnswers_1.NumberAnswerSchema.parse(validData)).not.toThrow();
|
|
@@ -98,6 +92,128 @@ const questions_1 = require("../../questions");
|
|
|
98
92
|
const invalidData = { type: 'multiselectBox', answer: 'option1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
99
93
|
(0, globals_1.expect)(() => optionBasedAnswers_1.MultiselectBoxAnswerSchema.parse(invalidData)).toThrow();
|
|
100
94
|
});
|
|
95
|
+
(0, globals_1.it)('should validate LicenseSearchAnswerSchema', () => {
|
|
96
|
+
const validData = {
|
|
97
|
+
type: 'licenseSearch',
|
|
98
|
+
answer: [
|
|
99
|
+
{ licenseId: 'license1', licenseName: 'License One' },
|
|
100
|
+
{ licenseId: 'license2', licenseName: 'License Two' }
|
|
101
|
+
],
|
|
102
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
103
|
+
};
|
|
104
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.LicenseSearchAnswerSchema.parse(validData)).not.toThrow();
|
|
105
|
+
const invalidData = { type: 'licenseSearch', answer: 'license1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
106
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.LicenseSearchAnswerSchema.parse(invalidData)).toThrow();
|
|
107
|
+
});
|
|
108
|
+
(0, globals_1.it)('should validate MetadataStandardSearchAnswerSchema', () => {
|
|
109
|
+
const validData = {
|
|
110
|
+
type: 'metadataStandardSearch',
|
|
111
|
+
answer: [
|
|
112
|
+
{ metadataStandardId: 'standard1', metadataStandardName: 'Standard Two' },
|
|
113
|
+
{ metadataStandardId: 'standard2', metadataStandardName: 'Standard Two' }
|
|
114
|
+
],
|
|
115
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
116
|
+
};
|
|
117
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.MetadataStandardSearchAnswerSchema.parse(validData)).not.toThrow();
|
|
118
|
+
const invalidData = { type: 'metadataStandardSearch', answer: 'standard1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
119
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.MetadataStandardSearchAnswerSchema.parse(invalidData)).toThrow();
|
|
120
|
+
});
|
|
121
|
+
(0, globals_1.it)('should validate RepositorySearchAnswerSchema', () => {
|
|
122
|
+
const validData = {
|
|
123
|
+
type: 'repositorySearch',
|
|
124
|
+
answer: [
|
|
125
|
+
{ repositoryId: 'repo1', repositoryName: 'Repository One' },
|
|
126
|
+
{ repositoryId: 'repo2', repositoryName: 'Repository Two' }
|
|
127
|
+
],
|
|
128
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
129
|
+
};
|
|
130
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.RepositorySearchAnswerSchema.parse(validData)).not.toThrow();
|
|
131
|
+
const invalidData = { type: 'repositorySearch', answer: 'repo1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
132
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.RepositorySearchAnswerSchema.parse(invalidData)).toThrow();
|
|
133
|
+
});
|
|
134
|
+
(0, globals_1.it)('should validate ResearchOutputTableAnswerSchema', () => {
|
|
135
|
+
const validData = {
|
|
136
|
+
type: 'researchOutputTable',
|
|
137
|
+
answer: [{
|
|
138
|
+
columns: [
|
|
139
|
+
{
|
|
140
|
+
type: 'text',
|
|
141
|
+
answer: 'This is a test',
|
|
142
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: 'textArea',
|
|
146
|
+
answer: 'This is a longer text answer',
|
|
147
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'selectBox',
|
|
151
|
+
answer: 'dataset',
|
|
152
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: 'checkBoxes',
|
|
156
|
+
answer: ['sensitive'],
|
|
157
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
type: 'selectBox',
|
|
161
|
+
answer: 'open',
|
|
162
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'date',
|
|
166
|
+
answer: '2025-11-13',
|
|
167
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'numberWithContext',
|
|
171
|
+
answer: { value: 12345, context: 'gb' },
|
|
172
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
type: 'repositorySearch',
|
|
176
|
+
answer: [{ repositoryId: 'repo1', repositoryName: 'Repository One' }],
|
|
177
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'metadataStandardSearch',
|
|
181
|
+
answer: [
|
|
182
|
+
{ metadataStandardId: 'standard1', metadataStandardName: 'Standard One' },
|
|
183
|
+
{ metadataStandardId: 'standard2', metadataStandardName: 'Standard Two' }
|
|
184
|
+
],
|
|
185
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'licenseSearch',
|
|
189
|
+
answer: [{ licenseId: 'license1', licenseName: 'License One' }],
|
|
190
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
}],
|
|
194
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
195
|
+
};
|
|
196
|
+
(0, globals_1.expect)(() => tableAnswers_1.ResearchOutputTableAnswerSchema.parse(validData)).not.toThrow();
|
|
197
|
+
const invalidData = {
|
|
198
|
+
type: 'researchOutputTable',
|
|
199
|
+
answer: {
|
|
200
|
+
columns: [
|
|
201
|
+
{
|
|
202
|
+
type: 'text',
|
|
203
|
+
answer: 12345,
|
|
204
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
type: 'selectBox',
|
|
208
|
+
answer: 'dataset',
|
|
209
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION }
|
|
214
|
+
};
|
|
215
|
+
(0, globals_1.expect)(() => tableAnswers_1.ResearchOutputTableAnswerSchema.parse(invalidData)).toThrow();
|
|
216
|
+
});
|
|
101
217
|
(0, globals_1.it)('should validate TextAnswer', () => {
|
|
102
218
|
const validData = { type: 'text', answer: 'Some text', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
103
219
|
(0, globals_1.expect)(() => textAnswers_1.TextAnswerSchema.parse(validData)).not.toThrow();
|
package/dist/answers/answer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const AnswerSchema: z.ZodObject<{
|
|
3
|
-
type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
|
|
3
|
+
type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "licenseSearch", "metadataStandardSearch", "multiselectBox", "number", "numberRange", "numberWithContext", "radioButtons", "repositorySearch", "researchOutputTable", "selectBox", "table", "text", "textArea", "url"]>;
|
|
4
4
|
meta: z.ZodDefault<z.ZodObject<{
|
|
5
5
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -9,12 +9,12 @@ export declare const AnswerSchema: z.ZodObject<{
|
|
|
9
9
|
schemaVersion?: string | undefined;
|
|
10
10
|
}>>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
12
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
13
13
|
meta: {
|
|
14
14
|
schemaVersion: string;
|
|
15
15
|
};
|
|
16
16
|
}, {
|
|
17
|
-
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
17
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
18
18
|
meta?: {
|
|
19
19
|
schemaVersion?: string | undefined;
|
|
20
20
|
} | undefined;
|
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const FilteredSearchAnswerSchema: 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
|
-
type: z.ZodLiteral<"filteredSearch">;
|
|
12
|
-
answer: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
type: "filteredSearch";
|
|
15
|
-
meta: {
|
|
16
|
-
schemaVersion: string;
|
|
17
|
-
};
|
|
18
|
-
answer: string[];
|
|
19
|
-
}, {
|
|
20
|
-
type: "filteredSearch";
|
|
21
|
-
meta?: {
|
|
22
|
-
schemaVersion?: string | undefined;
|
|
23
|
-
} | undefined;
|
|
24
|
-
answer?: string[] | undefined;
|
|
25
|
-
}>;
|
|
26
2
|
export declare const AffiliationSearchAnswerSchema: z.ZodObject<{
|
|
27
3
|
meta: z.ZodDefault<z.ZodObject<{
|
|
28
4
|
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
@@ -62,5 +38,124 @@ export declare const AffiliationSearchAnswerSchema: z.ZodObject<{
|
|
|
62
38
|
affiliationName?: string | undefined;
|
|
63
39
|
} | undefined;
|
|
64
40
|
}>;
|
|
65
|
-
export
|
|
41
|
+
export declare const LicenseSearchAnswerSchema: z.ZodObject<{
|
|
42
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
43
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
schemaVersion: string;
|
|
46
|
+
}, {
|
|
47
|
+
schemaVersion?: string | undefined;
|
|
48
|
+
}>>;
|
|
49
|
+
} & {
|
|
50
|
+
type: z.ZodLiteral<"licenseSearch">;
|
|
51
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
52
|
+
licenseId: z.ZodDefault<z.ZodString>;
|
|
53
|
+
licenseName: z.ZodDefault<z.ZodString>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
licenseId: string;
|
|
56
|
+
licenseName: string;
|
|
57
|
+
}, {
|
|
58
|
+
licenseId?: string | undefined;
|
|
59
|
+
licenseName?: string | undefined;
|
|
60
|
+
}>>, "many">>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
type: "licenseSearch";
|
|
63
|
+
meta: {
|
|
64
|
+
schemaVersion: string;
|
|
65
|
+
};
|
|
66
|
+
answer: {
|
|
67
|
+
licenseId: string;
|
|
68
|
+
licenseName: string;
|
|
69
|
+
}[];
|
|
70
|
+
}, {
|
|
71
|
+
type: "licenseSearch";
|
|
72
|
+
meta?: {
|
|
73
|
+
schemaVersion?: string | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
answer?: ({
|
|
76
|
+
licenseId?: string | undefined;
|
|
77
|
+
licenseName?: string | undefined;
|
|
78
|
+
} | undefined)[] | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export declare const MetadataStandardSearchAnswerSchema: z.ZodObject<{
|
|
81
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
82
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
schemaVersion: string;
|
|
85
|
+
}, {
|
|
86
|
+
schemaVersion?: string | undefined;
|
|
87
|
+
}>>;
|
|
88
|
+
} & {
|
|
89
|
+
type: z.ZodLiteral<"metadataStandardSearch">;
|
|
90
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
91
|
+
metadataStandardId: z.ZodDefault<z.ZodString>;
|
|
92
|
+
metadataStandardName: z.ZodDefault<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
metadataStandardId: string;
|
|
95
|
+
metadataStandardName: string;
|
|
96
|
+
}, {
|
|
97
|
+
metadataStandardId?: string | undefined;
|
|
98
|
+
metadataStandardName?: string | undefined;
|
|
99
|
+
}>>, "many">>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
type: "metadataStandardSearch";
|
|
102
|
+
meta: {
|
|
103
|
+
schemaVersion: string;
|
|
104
|
+
};
|
|
105
|
+
answer: {
|
|
106
|
+
metadataStandardId: string;
|
|
107
|
+
metadataStandardName: string;
|
|
108
|
+
}[];
|
|
109
|
+
}, {
|
|
110
|
+
type: "metadataStandardSearch";
|
|
111
|
+
meta?: {
|
|
112
|
+
schemaVersion?: string | undefined;
|
|
113
|
+
} | undefined;
|
|
114
|
+
answer?: ({
|
|
115
|
+
metadataStandardId?: string | undefined;
|
|
116
|
+
metadataStandardName?: string | undefined;
|
|
117
|
+
} | undefined)[] | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
export declare const RepositorySearchAnswerSchema: z.ZodObject<{
|
|
120
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
121
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
schemaVersion: string;
|
|
124
|
+
}, {
|
|
125
|
+
schemaVersion?: string | undefined;
|
|
126
|
+
}>>;
|
|
127
|
+
} & {
|
|
128
|
+
type: z.ZodLiteral<"repositorySearch">;
|
|
129
|
+
answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
130
|
+
repositoryId: z.ZodDefault<z.ZodString>;
|
|
131
|
+
repositoryName: z.ZodDefault<z.ZodString>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
repositoryId: string;
|
|
134
|
+
repositoryName: string;
|
|
135
|
+
}, {
|
|
136
|
+
repositoryId?: string | undefined;
|
|
137
|
+
repositoryName?: string | undefined;
|
|
138
|
+
}>>, "many">>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
type: "repositorySearch";
|
|
141
|
+
meta: {
|
|
142
|
+
schemaVersion: string;
|
|
143
|
+
};
|
|
144
|
+
answer: {
|
|
145
|
+
repositoryId: string;
|
|
146
|
+
repositoryName: string;
|
|
147
|
+
}[];
|
|
148
|
+
}, {
|
|
149
|
+
type: "repositorySearch";
|
|
150
|
+
meta?: {
|
|
151
|
+
schemaVersion?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
answer?: ({
|
|
154
|
+
repositoryId?: string | undefined;
|
|
155
|
+
repositoryName?: string | undefined;
|
|
156
|
+
} | undefined)[] | undefined;
|
|
157
|
+
}>;
|
|
66
158
|
export type AffiliationSearchAnswerType = z.infer<typeof AffiliationSearchAnswerSchema>;
|
|
159
|
+
export type LicenseSearchAnswerType = z.infer<typeof LicenseSearchAnswerSchema>;
|
|
160
|
+
export type MetadataStandardSearchAnswerType = z.infer<typeof MetadataStandardSearchAnswerSchema>;
|
|
161
|
+
export type RepositorySearchAnswerType = z.infer<typeof RepositorySearchAnswerSchema>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RepositorySearchAnswerSchema = exports.MetadataStandardSearchAnswerSchema = exports.LicenseSearchAnswerSchema = exports.AffiliationSearchAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
6
|
// Answers to GraphQL Question Types
|
|
7
|
-
exports.FilteredSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
8
|
-
type: zod_1.z.literal('filteredSearch'),
|
|
9
|
-
answer: zod_1.z.array(zod_1.z.string()).default(['']) // The answer to the filtered search
|
|
10
|
-
}));
|
|
11
7
|
exports.AffiliationSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
12
8
|
type: zod_1.z.literal('affiliationSearch'),
|
|
13
9
|
answer: zod_1.z.object({
|
|
@@ -15,3 +11,24 @@ exports.AffiliationSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.obje
|
|
|
15
11
|
affiliationName: zod_1.z.string().default('') // The name of the affiliation
|
|
16
12
|
}).default({})
|
|
17
13
|
}));
|
|
14
|
+
exports.LicenseSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
15
|
+
type: zod_1.z.literal('licenseSearch'),
|
|
16
|
+
answer: zod_1.z.array(zod_1.z.object({
|
|
17
|
+
licenseId: zod_1.z.string().default(''), // The unique id of the license
|
|
18
|
+
licenseName: zod_1.z.string().default('') // The name of the license
|
|
19
|
+
}).default({})).default([])
|
|
20
|
+
}));
|
|
21
|
+
exports.MetadataStandardSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
22
|
+
type: zod_1.z.literal('metadataStandardSearch'),
|
|
23
|
+
answer: zod_1.z.array(zod_1.z.object({
|
|
24
|
+
metadataStandardId: zod_1.z.string().default(''), // The unique id of the metadata standard
|
|
25
|
+
metadataStandardName: zod_1.z.string().default('') // The name of the metadata standard
|
|
26
|
+
}).default({})).default([])
|
|
27
|
+
}));
|
|
28
|
+
exports.RepositorySearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
29
|
+
type: zod_1.z.literal('repositorySearch'),
|
|
30
|
+
answer: zod_1.z.array(zod_1.z.object({
|
|
31
|
+
repositoryId: zod_1.z.string().default(''), // The unique id of the repository
|
|
32
|
+
repositoryName: zod_1.z.string().default('') // The name of the repository
|
|
33
|
+
}).default({})).default([])
|
|
34
|
+
}));
|