@dmptool/types 1.2.5 → 2.0.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/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 +680 -8090
- 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 +2029 -10357
- package/dist/questions/tableQuestions.js +197 -190
- package/dist/questions/textQuestions.d.ts +70 -226
- package/dist/questions/textQuestions.js +31 -31
- package/package.json +3 -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/schemas/affiliationSearchAnswer.schema.json +0 -45
- package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
- package/dist/schemas/anyAnswer.schema.json +0 -605
- package/dist/schemas/anyQuestion.schema.json +0 -1737
- package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
- package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
- package/dist/schemas/booleanAnswer.schema.json +0 -34
- package/dist/schemas/booleanQuestion.schema.json +0 -56
- package/dist/schemas/checkboxesAnswer.schema.json +0 -39
- package/dist/schemas/checkboxesQuestion.schema.json +0 -76
- package/dist/schemas/currencyAnswer.schema.json +0 -34
- package/dist/schemas/currencyQuestion.schema.json +0 -67
- package/dist/schemas/dateAnswer.schema.json +0 -34
- package/dist/schemas/datePickerAnswer.schema.json +0 -37
- package/dist/schemas/datePickerQuestion.schema.json +0 -52
- package/dist/schemas/dateQuestion.schema.json +0 -62
- package/dist/schemas/dateRangeAnswer.schema.json +0 -45
- package/dist/schemas/dateRangeQuestion.schema.json +0 -112
- package/dist/schemas/emailAnswer.schema.json +0 -34
- package/dist/schemas/emailQuestion.schema.json +0 -66
- package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
- package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
- package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
- package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
- package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
- package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
- package/dist/schemas/numberAnswer.schema.json +0 -34
- package/dist/schemas/numberQuestion.schema.json +0 -63
- package/dist/schemas/numberRangeAnswer.schema.json +0 -45
- package/dist/schemas/numberRangeQuestion.schema.json +0 -94
- package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
- package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
- package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
- package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
- package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
- package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
- package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
- package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
- package/dist/schemas/selectBoxAnswer.schema.json +0 -34
- package/dist/schemas/selectBoxQuestion.schema.json +0 -85
- package/dist/schemas/tableAnswer.schema.json +0 -519
- package/dist/schemas/tableQuestion.schema.json +0 -1183
- package/dist/schemas/textAnswer.schema.json +0 -34
- package/dist/schemas/textAreaAnswer.schema.json +0 -34
- package/dist/schemas/textAreaQuestion.schema.json +0 -70
- package/dist/schemas/textQuestion.schema.json +0 -62
- package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
- package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
- package/dist/schemas/urlAnswer.schema.json +0 -34
- package/dist/schemas/urlQuestion.schema.json +0 -62
- /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LicenseSearchQuestionSchema = exports.licenseQuery = exports.MetadataStandardSearchQuestionSchema = exports.metadataStandardQuery = exports.RepositorySearchQuestionSchema = exports.repositoryQuery = exports.AffiliationSearchQuestionSchema = exports.affiliationQuery = void 0;
|
|
3
|
+
exports.LicenseSearchQuestionJSONSchema = exports.MetadataStandardSearchQuestionJSONSchema = exports.RepositorySearchQuestionJSONSchema = exports.AffiliationSearchQuestionJSONSchema = exports.DefaultLicenseSearchQuestion = exports.LicenseSearchQuestionSchema = exports.DefaultLicenseGraphQLQuery = exports.LicenseGraphQLQuery = exports.licenseQuery = exports.DefaultMetadataStandardSearchQuestion = exports.MetadataStandardSearchQuestionSchema = exports.DefaultMetadataStandardGraphQLQuery = exports.MetadataStandardGraphQLQuery = exports.metadataStandardQuery = exports.DefaultRepositorySearchQuestion = exports.RepositorySearchQuestionSchema = exports.DefaultRepositoryGraphQLQuery = exports.repositoryQuery = exports.DefaultAffiliationSearchQuestion = exports.AffiliationSearchQuestionSchema = exports.affiliationQuery = exports.DefaultTypeaheadSearchQuestion = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
|
-
const
|
|
7
|
-
const paginationOptions = zod_1.z.object({
|
|
6
|
+
const PaginationOption = zod_1.z.object({
|
|
8
7
|
type: zod_1.z.enum(['OFFSET', 'CURSOR']).default('OFFSET'), // Type of pagination to use
|
|
9
8
|
limit: zod_1.z.number().default(10), // Number of items per page
|
|
10
9
|
offset: zod_1.z.number().optional().default(0), // Offset for pagination (if using offset-based pagination)
|
|
@@ -12,6 +11,7 @@ const paginationOptions = zod_1.z.object({
|
|
|
12
11
|
sortField: zod_1.z.string().default('name'), // Field to sort by
|
|
13
12
|
sortOrder: zod_1.z.enum(['ASC', 'DESC']).default('ASC'), // Sort order
|
|
14
13
|
});
|
|
14
|
+
const DefaultPaginationOption = PaginationOption.parse({});
|
|
15
15
|
// An input variable for a GraphQL query
|
|
16
16
|
const GraphQLVariable = zod_1.z.object({
|
|
17
17
|
minLength: zod_1.z.number().optional(), // A min length for the variable before executing the query
|
|
@@ -21,18 +21,14 @@ const GraphQLVariable = zod_1.z.object({
|
|
|
21
21
|
type: zod_1.z.string().default('string'), // The type of the variable (default is string)
|
|
22
22
|
defaultValue: zod_1.z.string().optional() // The default value for the variable (no default)
|
|
23
23
|
});
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cursor: undefined,
|
|
33
|
-
sortField: 'name',
|
|
34
|
-
sortOrder: 'ASC',
|
|
35
|
-
})
|
|
24
|
+
const DefaultGraphQLVariable = GraphQLVariable.parse({});
|
|
25
|
+
const GraphQLPaginationVariables = zod_1.z.object(Object.assign(Object.assign({}, GraphQLVariable.shape), { name: zod_1.z.enum(['paginationOptions']).default('paginationOptions'), type: zod_1.z.enum(['CURSOR', 'OFFSET']).default('OFFSET'), label: zod_1.z.string().default('Pagination Options'), labelTranslationKey: zod_1.z.string().optional(), options: PaginationOption }));
|
|
26
|
+
const DefaultGraphQLPaginationVariables = GraphQLPaginationVariables.parse({
|
|
27
|
+
name: 'paginationOptions',
|
|
28
|
+
type: 'OFFSET',
|
|
29
|
+
label: 'Pagination Options',
|
|
30
|
+
labelTranslationKey: 'PaginationOptions.label',
|
|
31
|
+
options: DefaultPaginationOption
|
|
36
32
|
});
|
|
37
33
|
// A property from a GraphQL query response that will be displayed to the user
|
|
38
34
|
const GraphQLDisplayField = zod_1.z.object({
|
|
@@ -40,19 +36,28 @@ const GraphQLDisplayField = zod_1.z.object({
|
|
|
40
36
|
label: zod_1.z.string().default('Id'), // The label for the field
|
|
41
37
|
labelTranslationKey: zod_1.z.string().optional() // The translation key for the label (DMP Tool only)
|
|
42
38
|
});
|
|
39
|
+
const DefaultGraphQLDisplayField = GraphQLDisplayField.parse({});
|
|
43
40
|
// A GraphQL query object
|
|
44
41
|
const GraphQLQuery = zod_1.z.object({
|
|
45
|
-
displayFields: zod_1.z.array(GraphQLDisplayField)
|
|
42
|
+
displayFields: zod_1.z.array(GraphQLDisplayField), // The fields to display from the query response
|
|
46
43
|
localQueryId: zod_1.z.string().optional(), // The ID of the query (required if no query)
|
|
47
44
|
query: zod_1.z.string().optional(), // The GraphQL query to execute (required if no localQueryId)
|
|
48
45
|
responseField: zod_1.z.string().default('query.items'), // How to get at the location of displayFields in the response
|
|
49
|
-
variables: zod_1.z.array(GraphQLVariable)
|
|
46
|
+
variables: zod_1.z.array(GraphQLVariable) // The variables for the query
|
|
47
|
+
});
|
|
48
|
+
const DefaultGraphQLQuery = GraphQLQuery.parse({
|
|
49
|
+
displayFields: [DefaultGraphQLDisplayField],
|
|
50
|
+
responseField: 'query.items',
|
|
51
|
+
variables: [DefaultGraphQLVariable]
|
|
50
52
|
});
|
|
51
53
|
// Typeahead search question and answer
|
|
52
|
-
const TypeaheadSearchQuestionSchema = question_1.QuestionSchema.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const TypeaheadSearchQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('typeaheadSearch'), graphQL: GraphQLQuery }));
|
|
55
|
+
exports.DefaultTypeaheadSearchQuestion = TypeaheadSearchQuestionSchema.parse({
|
|
56
|
+
type: 'typeaheadSearch',
|
|
57
|
+
attributes: question_1.DefaultAttributes,
|
|
58
|
+
meta: question_1.DefaultMeta,
|
|
59
|
+
graphQL: DefaultGraphQLQuery,
|
|
60
|
+
});
|
|
56
61
|
exports.affiliationQuery = '' +
|
|
57
62
|
'query Affiliations($name: String!){ ' +
|
|
58
63
|
'affiliations(name: $name) { ' +
|
|
@@ -65,28 +70,33 @@ exports.affiliationQuery = '' +
|
|
|
65
70
|
'} ' +
|
|
66
71
|
'} ' +
|
|
67
72
|
'}';
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
const DefaultAffiliationSearchNameVariable = GraphQLVariable.parse({
|
|
74
|
+
name: 'name',
|
|
75
|
+
type: 'string',
|
|
76
|
+
label: 'Search for your institution',
|
|
77
|
+
minLength: 3,
|
|
78
|
+
labelTranslationKey: 'SignupPage.institutionHelp',
|
|
79
|
+
});
|
|
80
|
+
const DefaultAffiliationSearchNameDisplayField = GraphQLDisplayField.parse({
|
|
81
|
+
propertyName: 'displayName',
|
|
82
|
+
label: 'Institution',
|
|
83
|
+
labelTranslationKey: 'SignupPage.institution',
|
|
84
|
+
});
|
|
85
|
+
const AffiliationGraphQLQuery = zod_1.z.object(Object.assign(Object.assign({}, GraphQLQuery.shape), { query: zod_1.z.literal(exports.affiliationQuery), queryId: zod_1.z.string().default('useAffiliationsQuery').optional(), variables: zod_1.z.array(GraphQLVariable), answerField: zod_1.z.literal('uri').default('uri'), responseField: zod_1.z.literal("affiliations.items").default('affiliations.items'), displayFields: zod_1.z.array(GraphQLDisplayField) }));
|
|
86
|
+
const DefaultAffiliationGraphQLQuery = AffiliationGraphQLQuery.parse({
|
|
87
|
+
query: exports.affiliationQuery,
|
|
88
|
+
variables: [DefaultAffiliationSearchNameVariable],
|
|
89
|
+
answerField: 'uri',
|
|
90
|
+
responseField: 'affiliations.items',
|
|
91
|
+
displayFields: [DefaultAffiliationSearchNameDisplayField]
|
|
92
|
+
});
|
|
93
|
+
exports.AffiliationSearchQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, TypeaheadSearchQuestionSchema.shape), { type: zod_1.z.literal('affiliationSearch'), graphQL: AffiliationGraphQLQuery }));
|
|
94
|
+
exports.DefaultAffiliationSearchQuestion = exports.AffiliationSearchQuestionSchema.parse({
|
|
95
|
+
type: 'affiliationSearch',
|
|
96
|
+
attributes: question_1.DefaultAttributes,
|
|
97
|
+
meta: question_1.DefaultMeta,
|
|
98
|
+
graphQL: DefaultAffiliationGraphQLQuery,
|
|
99
|
+
});
|
|
90
100
|
exports.repositoryQuery = '' +
|
|
91
101
|
'query Repositories($term: String, $keywords: [String!], $repositoryType: String, $paginationOptions: PaginationOptions){ ' +
|
|
92
102
|
'repositories(term: $term, keywords: $keywords, repositoryType: $repositoryType, paginationOptions: $paginationOptions) { ' +
|
|
@@ -107,78 +117,72 @@ exports.repositoryQuery = '' +
|
|
|
107
117
|
'} ' +
|
|
108
118
|
'} ' +
|
|
109
119
|
'}';
|
|
110
|
-
const
|
|
111
|
-
name:
|
|
112
|
-
type:
|
|
113
|
-
label:
|
|
114
|
-
minLength:
|
|
115
|
-
labelTranslationKey:
|
|
116
|
-
});
|
|
117
|
-
const
|
|
118
|
-
name:
|
|
119
|
-
type:
|
|
120
|
-
label:
|
|
121
|
-
minLength:
|
|
122
|
-
labelTranslationKey:
|
|
123
|
-
});
|
|
124
|
-
const
|
|
125
|
-
name:
|
|
126
|
-
type:
|
|
127
|
-
label:
|
|
128
|
-
minLength:
|
|
129
|
-
labelTranslationKey:
|
|
130
|
-
});
|
|
131
|
-
const
|
|
132
|
-
propertyName:
|
|
133
|
-
label:
|
|
134
|
-
labelTranslationKey:
|
|
135
|
-
});
|
|
136
|
-
const
|
|
137
|
-
propertyName:
|
|
138
|
-
label:
|
|
139
|
-
labelTranslationKey:
|
|
140
|
-
});
|
|
141
|
-
const
|
|
142
|
-
propertyName:
|
|
143
|
-
label:
|
|
144
|
-
labelTranslationKey:
|
|
145
|
-
});
|
|
146
|
-
const
|
|
147
|
-
propertyName:
|
|
148
|
-
label:
|
|
149
|
-
labelTranslationKey:
|
|
150
|
-
});
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
defaultRepositorySearchWebsite,
|
|
177
|
-
defaultRepositorySearchKeywords,
|
|
178
|
-
]),
|
|
179
|
-
responseField: zod_1.z.literal("repositories.items").default('repositories.items'),
|
|
180
|
-
})).default({}),
|
|
181
|
-
}));
|
|
120
|
+
const DefaultRepositorySearchTermVariable = GraphQLVariable.parse({
|
|
121
|
+
name: 'term',
|
|
122
|
+
type: 'string',
|
|
123
|
+
label: 'Search for a repository',
|
|
124
|
+
minLength: 3,
|
|
125
|
+
labelTranslationKey: 'RepositorySearch.term'
|
|
126
|
+
});
|
|
127
|
+
const DefaultRepositorySearchRepositoryTypeVariable = GraphQLVariable.parse({
|
|
128
|
+
name: 'repositoryType',
|
|
129
|
+
type: 'string',
|
|
130
|
+
label: 'Repository type',
|
|
131
|
+
minLength: 3,
|
|
132
|
+
labelTranslationKey: 'RepositorySearch.repositoryType'
|
|
133
|
+
});
|
|
134
|
+
const DefaultRepositorySearchKeywordsVariable = GraphQLVariable.parse({
|
|
135
|
+
name: 'keywords',
|
|
136
|
+
type: 'string',
|
|
137
|
+
label: 'Subject Areas',
|
|
138
|
+
minLength: 3,
|
|
139
|
+
labelTranslationKey: 'RepositorySearch.keywords'
|
|
140
|
+
});
|
|
141
|
+
const DefaultRepositorySearchNameDisplayField = GraphQLDisplayField.parse({
|
|
142
|
+
propertyName: 'name',
|
|
143
|
+
label: 'Name',
|
|
144
|
+
labelTranslationKey: 'RepositorySearch.name'
|
|
145
|
+
});
|
|
146
|
+
const DefaultRepositorySearchDescriptionDisplayField = GraphQLDisplayField.parse({
|
|
147
|
+
propertyName: 'description',
|
|
148
|
+
label: 'Description',
|
|
149
|
+
labelTranslationKey: 'RepositorySearch.description'
|
|
150
|
+
});
|
|
151
|
+
const DefaultRepositorySearchWebsiteDisplayField = GraphQLDisplayField.parse({
|
|
152
|
+
propertyName: 'website',
|
|
153
|
+
label: 'Website',
|
|
154
|
+
labelTranslationKey: 'RepositorySearch.website'
|
|
155
|
+
});
|
|
156
|
+
const DefaultRepositorySearchKeywordsDisplayField = GraphQLDisplayField.parse({
|
|
157
|
+
propertyName: 'keywords',
|
|
158
|
+
label: 'Subject Areas',
|
|
159
|
+
labelTranslationKey: 'RepositorySearch.keywords'
|
|
160
|
+
});
|
|
161
|
+
const RepositoryGraphQLQuery = zod_1.z.object(Object.assign(Object.assign({}, GraphQLQuery.shape), { query: zod_1.z.literal(exports.repositoryQuery), queryId: zod_1.z.string().default('useRepositoriesQuery').optional(), variables: zod_1.z.array(GraphQLVariable), answerField: zod_1.z.literal('uri'), displayFields: zod_1.z.array(GraphQLDisplayField), responseField: zod_1.z.literal("repositories.items") }));
|
|
162
|
+
exports.DefaultRepositoryGraphQLQuery = RepositoryGraphQLQuery.parse({
|
|
163
|
+
query: exports.repositoryQuery,
|
|
164
|
+
variables: [
|
|
165
|
+
DefaultRepositorySearchTermVariable,
|
|
166
|
+
DefaultRepositorySearchKeywordsVariable,
|
|
167
|
+
DefaultRepositorySearchRepositoryTypeVariable,
|
|
168
|
+
DefaultGraphQLPaginationVariables
|
|
169
|
+
],
|
|
170
|
+
responseField: 'repositories.items',
|
|
171
|
+
answerField: 'uri',
|
|
172
|
+
displayFields: [
|
|
173
|
+
DefaultRepositorySearchNameDisplayField,
|
|
174
|
+
DefaultRepositorySearchDescriptionDisplayField,
|
|
175
|
+
DefaultRepositorySearchWebsiteDisplayField,
|
|
176
|
+
DefaultRepositorySearchKeywordsDisplayField
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
exports.RepositorySearchQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, TypeaheadSearchQuestionSchema.shape), { type: zod_1.z.literal('repositorySearch'), graphQL: RepositoryGraphQLQuery }));
|
|
180
|
+
exports.DefaultRepositorySearchQuestion = exports.RepositorySearchQuestionSchema.parse({
|
|
181
|
+
type: 'repositorySearch',
|
|
182
|
+
attributes: question_1.DefaultAttributes,
|
|
183
|
+
meta: question_1.DefaultMeta,
|
|
184
|
+
graphQL: exports.DefaultRepositoryGraphQLQuery
|
|
185
|
+
});
|
|
182
186
|
exports.metadataStandardQuery = '' +
|
|
183
187
|
'query MetadataStandards($term: String, $keywords: [String!], $paginationOptions: PaginationOptions){ ' +
|
|
184
188
|
'metadataStandards(term: $term, keywords: $keywords, paginationOptions: $paginationOptions) { ' +
|
|
@@ -197,68 +201,64 @@ exports.metadataStandardQuery = '' +
|
|
|
197
201
|
'} ' +
|
|
198
202
|
'} ' +
|
|
199
203
|
'}';
|
|
200
|
-
const
|
|
201
|
-
name:
|
|
202
|
-
type:
|
|
203
|
-
label:
|
|
204
|
-
minLength:
|
|
205
|
-
labelTranslationKey:
|
|
206
|
-
});
|
|
207
|
-
const
|
|
208
|
-
name:
|
|
209
|
-
type:
|
|
210
|
-
label:
|
|
211
|
-
minLength:
|
|
212
|
-
labelTranslationKey:
|
|
213
|
-
});
|
|
214
|
-
const
|
|
215
|
-
propertyName:
|
|
216
|
-
label:
|
|
217
|
-
labelTranslationKey:
|
|
218
|
-
});
|
|
219
|
-
const
|
|
220
|
-
propertyName:
|
|
221
|
-
label:
|
|
222
|
-
labelTranslationKey:
|
|
223
|
-
});
|
|
224
|
-
const
|
|
225
|
-
propertyName:
|
|
226
|
-
label:
|
|
227
|
-
labelTranslationKey:
|
|
228
|
-
});
|
|
229
|
-
const
|
|
230
|
-
propertyName:
|
|
231
|
-
label:
|
|
232
|
-
labelTranslationKey:
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
]),
|
|
259
|
-
responseField: zod_1.z.literal("metadataStandards.items").default('metadataStandards.items'),
|
|
260
|
-
})).default({}),
|
|
261
|
-
}));
|
|
204
|
+
const DefaultMetadataStandardSearchTermVariable = GraphQLVariable.parse({
|
|
205
|
+
name: 'term',
|
|
206
|
+
type: 'string',
|
|
207
|
+
label: 'Search for a metadata standard',
|
|
208
|
+
minLength: 3,
|
|
209
|
+
labelTranslationKey: 'MetadataStandardSearch.term'
|
|
210
|
+
});
|
|
211
|
+
const DefaultMetadataStandardKeywordsAreasVariable = GraphQLVariable.parse({
|
|
212
|
+
name: 'keywords',
|
|
213
|
+
type: 'string',
|
|
214
|
+
label: 'Subject Areas',
|
|
215
|
+
minLength: 3,
|
|
216
|
+
labelTranslationKey: 'MetadataStandardSearch.keywords'
|
|
217
|
+
});
|
|
218
|
+
const DefaultMetadataStandardNameDisplayField = GraphQLDisplayField.parse({
|
|
219
|
+
propertyName: 'name',
|
|
220
|
+
label: 'Name',
|
|
221
|
+
labelTranslationKey: 'MetadataStandardSearch.name'
|
|
222
|
+
});
|
|
223
|
+
const DefaultMetadataStandardDescriptionDisplayField = GraphQLDisplayField.parse({
|
|
224
|
+
propertyName: 'description',
|
|
225
|
+
label: 'Description',
|
|
226
|
+
labelTranslationKey: 'MetadataStandardSearch.description'
|
|
227
|
+
});
|
|
228
|
+
const DefaultMetadataStandardWebsiteDisplayField = GraphQLDisplayField.parse({
|
|
229
|
+
propertyName: 'website',
|
|
230
|
+
label: 'Website',
|
|
231
|
+
labelTranslationKey: 'MetadataStandardSearch.website'
|
|
232
|
+
});
|
|
233
|
+
const DefaultMetadataStandardKeywordsDisplayField = GraphQLDisplayField.parse({
|
|
234
|
+
propertyName: 'keywords',
|
|
235
|
+
label: 'Subject Areas',
|
|
236
|
+
labelTranslationKey: 'MetadataStandardSearch.keywords'
|
|
237
|
+
});
|
|
238
|
+
exports.MetadataStandardGraphQLQuery = zod_1.z.object(Object.assign(Object.assign({}, GraphQLQuery.shape), { query: zod_1.z.literal(exports.metadataStandardQuery), queryId: zod_1.z.string().default('useMetadataStandardsQuery').optional(), variables: zod_1.z.array(GraphQLVariable), answerField: zod_1.z.literal('uri').default('uri'), displayFields: zod_1.z.array(GraphQLDisplayField), responseField: zod_1.z.literal("metadataStandards.items") }));
|
|
239
|
+
exports.DefaultMetadataStandardGraphQLQuery = exports.MetadataStandardGraphQLQuery.parse({
|
|
240
|
+
query: exports.metadataStandardQuery,
|
|
241
|
+
variables: [
|
|
242
|
+
DefaultMetadataStandardSearchTermVariable,
|
|
243
|
+
DefaultMetadataStandardKeywordsAreasVariable,
|
|
244
|
+
DefaultGraphQLPaginationVariables
|
|
245
|
+
],
|
|
246
|
+
responseField: 'metadataStandards.items',
|
|
247
|
+
answerField: 'uri',
|
|
248
|
+
displayFields: [
|
|
249
|
+
DefaultMetadataStandardNameDisplayField,
|
|
250
|
+
DefaultMetadataStandardDescriptionDisplayField,
|
|
251
|
+
DefaultMetadataStandardWebsiteDisplayField,
|
|
252
|
+
DefaultMetadataStandardKeywordsDisplayField
|
|
253
|
+
]
|
|
254
|
+
});
|
|
255
|
+
exports.MetadataStandardSearchQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, TypeaheadSearchQuestionSchema.shape), { type: zod_1.z.literal('metadataStandardSearch'), graphQL: exports.MetadataStandardGraphQLQuery }));
|
|
256
|
+
exports.DefaultMetadataStandardSearchQuestion = exports.MetadataStandardSearchQuestionSchema.parse({
|
|
257
|
+
type: 'metadataStandardSearch',
|
|
258
|
+
attributes: question_1.DefaultAttributes,
|
|
259
|
+
meta: question_1.DefaultMeta,
|
|
260
|
+
graphQL: exports.DefaultMetadataStandardGraphQLQuery,
|
|
261
|
+
});
|
|
262
262
|
exports.licenseQuery = '' +
|
|
263
263
|
'query Licenses($term: String, $paginationOptions: PaginationOptions){ ' +
|
|
264
264
|
'license(term: $term, paginationOptions: $paginationOptions) { ' +
|
|
@@ -276,49 +276,51 @@ exports.licenseQuery = '' +
|
|
|
276
276
|
'} ' +
|
|
277
277
|
'} ' +
|
|
278
278
|
'}';
|
|
279
|
-
const
|
|
280
|
-
name:
|
|
281
|
-
type:
|
|
282
|
-
label:
|
|
283
|
-
minLength:
|
|
284
|
-
labelTranslationKey:
|
|
285
|
-
});
|
|
286
|
-
const
|
|
287
|
-
propertyName:
|
|
288
|
-
label:
|
|
289
|
-
labelTranslationKey:
|
|
290
|
-
});
|
|
291
|
-
const
|
|
292
|
-
propertyName:
|
|
293
|
-
label:
|
|
294
|
-
labelTranslationKey:
|
|
295
|
-
});
|
|
296
|
-
const
|
|
297
|
-
propertyName:
|
|
298
|
-
label:
|
|
299
|
-
labelTranslationKey:
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
279
|
+
const DefaultLicenseSearchTermVariable = GraphQLVariable.parse({
|
|
280
|
+
name: 'term',
|
|
281
|
+
type: 'string',
|
|
282
|
+
label: 'Search for a license',
|
|
283
|
+
minLength: 3,
|
|
284
|
+
labelTranslationKey: 'LicenseSearch.term'
|
|
285
|
+
});
|
|
286
|
+
const DefaultLicenseNameDisplayField = GraphQLDisplayField.parse({
|
|
287
|
+
propertyName: 'name',
|
|
288
|
+
label: 'Name',
|
|
289
|
+
labelTranslationKey: 'LicenseSearch.name'
|
|
290
|
+
});
|
|
291
|
+
const DefaultLicenseDescriptionDisplayField = GraphQLDisplayField.parse({
|
|
292
|
+
propertyName: 'description',
|
|
293
|
+
label: 'Description',
|
|
294
|
+
labelTranslationKey: 'LicenseSearch.description'
|
|
295
|
+
});
|
|
296
|
+
const DefaultLicenseRecommendedDisplayField = GraphQLDisplayField.parse({
|
|
297
|
+
propertyName: 'recommended',
|
|
298
|
+
label: 'Recommended',
|
|
299
|
+
labelTranslationKey: 'LicenseSearch.recommended'
|
|
300
|
+
});
|
|
301
|
+
exports.LicenseGraphQLQuery = zod_1.z.object(Object.assign(Object.assign({}, GraphQLQuery.shape), { query: zod_1.z.literal(exports.licenseQuery), queryId: zod_1.z.string().default('useLicensesQuery').optional(), variables: zod_1.z.array(GraphQLVariable), answerField: zod_1.z.literal('uri'), displayFields: zod_1.z.array(GraphQLDisplayField), responseField: zod_1.z.literal("licenses.items") }));
|
|
302
|
+
exports.DefaultLicenseGraphQLQuery = exports.LicenseGraphQLQuery.parse({
|
|
303
|
+
query: exports.licenseQuery,
|
|
304
|
+
variables: [
|
|
305
|
+
DefaultLicenseSearchTermVariable,
|
|
306
|
+
DefaultGraphQLPaginationVariables
|
|
307
|
+
],
|
|
308
|
+
responseField: 'licenses.items',
|
|
309
|
+
answerField: 'uri',
|
|
310
|
+
displayFields: [
|
|
311
|
+
DefaultLicenseNameDisplayField,
|
|
312
|
+
DefaultLicenseDescriptionDisplayField,
|
|
313
|
+
DefaultLicenseRecommendedDisplayField
|
|
314
|
+
]
|
|
315
|
+
});
|
|
316
|
+
exports.LicenseSearchQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, TypeaheadSearchQuestionSchema.shape), { type: zod_1.z.literal('licenseSearch'), graphQL: exports.LicenseGraphQLQuery }));
|
|
317
|
+
exports.DefaultLicenseSearchQuestion = exports.LicenseSearchQuestionSchema.parse({
|
|
318
|
+
type: 'licenseSearch',
|
|
319
|
+
attributes: question_1.DefaultAttributes,
|
|
320
|
+
meta: question_1.DefaultMeta,
|
|
321
|
+
graphQL: exports.DefaultLicenseGraphQLQuery,
|
|
322
|
+
});
|
|
323
|
+
exports.AffiliationSearchQuestionJSONSchema = zod_1.z.toJSONSchema(exports.AffiliationSearchQuestionSchema);
|
|
324
|
+
exports.RepositorySearchQuestionJSONSchema = zod_1.z.toJSONSchema(exports.RepositorySearchQuestionSchema);
|
|
325
|
+
exports.MetadataStandardSearchQuestionJSONSchema = zod_1.z.toJSONSchema(exports.MetadataStandardSearchQuestionSchema);
|
|
326
|
+
exports.LicenseSearchQuestionJSONSchema = zod_1.z.toJSONSchema(exports.LicenseSearchQuestionSchema);
|