@dmptool/types 1.1.1 → 1.1.3
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/dist/answers/__tests__/answers.spec.js +11 -5
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +2 -2
- package/dist/answers/graphQLAnswers.js +2 -2
- package/dist/answers/index.d.ts +92 -55
- package/dist/answers/index.js +2 -2
- package/dist/answers/optionBasedAnswers.d.ts +27 -2
- package/dist/answers/optionBasedAnswers.js +5 -1
- package/dist/answers/tableAnswers.d.ts +268 -104
- package/dist/answers/tableAnswers.js +2 -1
- package/dist/questions/__tests__/graphQLQuestions.spec.js +13 -11
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +52 -13
- package/dist/questions/dateQuestions.d.ts +68 -47
- package/dist/questions/dateQuestions.js +15 -6
- package/dist/questions/graphQLQuestions.d.ts +121 -96
- package/dist/questions/graphQLQuestions.js +34 -3
- package/dist/questions/index.d.ts +1524 -1006
- package/dist/questions/index.js +4 -2
- package/dist/questions/numberQuestions.d.ts +107 -76
- package/dist/questions/numberQuestions.js +20 -7
- package/dist/questions/optionBasedQuestions.d.ts +202 -74
- package/dist/questions/optionBasedQuestions.js +41 -11
- package/dist/questions/question.d.ts +43 -4
- package/dist/questions/question.js +13 -2
- package/dist/questions/tableQuestions.d.ts +2056 -1428
- package/dist/questions/tableQuestions.js +9 -4
- package/dist/questions/textQuestions.d.ts +98 -58
- package/dist/questions/textQuestions.js +29 -15
- package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +146 -0
- package/dist/schemas/anyAnswer.schema.json +41 -23
- package/dist/schemas/anyQuestion.schema.json +525 -108
- package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
- package/dist/schemas/anyTableColumnQuestion.schema.json +396 -80
- package/dist/schemas/booleanQuestion.schema.json +11 -3
- package/dist/schemas/checkboxesQuestion.schema.json +14 -7
- package/dist/schemas/currencyQuestion.schema.json +14 -3
- package/dist/schemas/dateQuestion.schema.json +10 -1
- package/dist/schemas/dateRangeQuestion.schema.json +14 -1
- package/dist/schemas/emailQuestion.schema.json +12 -2
- package/dist/schemas/filteredSearchQuestion.schema.json +7 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +85 -0
- package/dist/schemas/numberQuestion.schema.json +12 -2
- package/dist/schemas/numberRangeQuestion.schema.json +16 -2
- package/dist/schemas/radioButtonsQuestion.schema.json +14 -7
- package/dist/schemas/selectBoxAnswer.schema.json +1 -4
- package/dist/schemas/selectBoxQuestion.schema.json +17 -8
- package/dist/schemas/tableAnswer.schema.json +35 -14
- package/dist/schemas/tableQuestion.schema.json +420 -84
- package/dist/schemas/textAreaQuestion.schema.json +16 -6
- package/dist/schemas/textQuestion.schema.json +10 -1
- package/dist/schemas/urlQuestion.schema.json +10 -1
- package/package.json +1 -1
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
3
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
4
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
schemaVersion: "1.0";
|
|
7
|
-
}, {
|
|
8
|
-
schemaVersion: "1.0";
|
|
9
|
-
}>>;
|
|
10
|
-
} & {
|
|
2
|
+
export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
|
|
11
3
|
type: z.ZodLiteral<"filteredSearch">;
|
|
12
4
|
graphQL: z.ZodObject<{
|
|
13
5
|
displayFields: z.ZodArray<z.ZodObject<{
|
|
@@ -100,6 +92,20 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
100
92
|
labelTranslationKey?: string | undefined;
|
|
101
93
|
multiple?: boolean | undefined;
|
|
102
94
|
}>>;
|
|
95
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
97
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
98
|
+
} & {
|
|
99
|
+
title: z.ZodOptional<z.ZodLiteral<"Not yet implemented">>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
schemaVersion: "1.0";
|
|
102
|
+
title?: "Not yet implemented" | undefined;
|
|
103
|
+
usageDescription?: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
schemaVersion: "1.0";
|
|
106
|
+
title?: "Not yet implemented" | undefined;
|
|
107
|
+
usageDescription?: string | undefined;
|
|
108
|
+
}>>;
|
|
103
109
|
}, "strip", z.ZodTypeAny, {
|
|
104
110
|
type: "filteredSearch";
|
|
105
111
|
graphQL: {
|
|
@@ -128,6 +134,8 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
128
134
|
} | undefined;
|
|
129
135
|
meta?: {
|
|
130
136
|
schemaVersion: "1.0";
|
|
137
|
+
title?: "Not yet implemented" | undefined;
|
|
138
|
+
usageDescription?: string | undefined;
|
|
131
139
|
} | undefined;
|
|
132
140
|
}, {
|
|
133
141
|
type: "filteredSearch";
|
|
@@ -157,9 +165,11 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
|
|
|
157
165
|
} | undefined;
|
|
158
166
|
meta?: {
|
|
159
167
|
schemaVersion: "1.0";
|
|
168
|
+
title?: "Not yet implemented" | undefined;
|
|
169
|
+
usageDescription?: string | undefined;
|
|
160
170
|
} | undefined;
|
|
161
171
|
}>;
|
|
162
|
-
export declare const
|
|
172
|
+
export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
|
|
163
173
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
164
174
|
label: z.ZodOptional<z.ZodString>;
|
|
165
175
|
help: z.ZodOptional<z.ZodString>;
|
|
@@ -173,145 +183,160 @@ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
|
|
|
173
183
|
help?: string | undefined;
|
|
174
184
|
labelTranslationKey?: string | undefined;
|
|
175
185
|
}>>;
|
|
176
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
177
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
178
|
-
}, "strip", z.ZodTypeAny, {
|
|
179
|
-
schemaVersion: "1.0";
|
|
180
|
-
}, {
|
|
181
|
-
schemaVersion: "1.0";
|
|
182
|
-
}>>;
|
|
183
186
|
} & {
|
|
184
|
-
type: z.ZodLiteral<"
|
|
187
|
+
type: z.ZodLiteral<"affiliationSearch">;
|
|
185
188
|
graphQL: z.ZodObject<{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
localQueryId: z.ZodOptional<z.ZodString>;
|
|
190
|
+
} & {
|
|
191
|
+
query: z.ZodLiteral<"query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}">;
|
|
192
|
+
queryId: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
193
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
194
|
+
name: z.ZodLiteral<"name">;
|
|
195
|
+
type: z.ZodDefault<z.ZodString>;
|
|
196
|
+
label: z.ZodDefault<z.ZodString>;
|
|
197
|
+
minLength: z.ZodLiteral<3>;
|
|
198
|
+
labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
190
199
|
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
type: string;
|
|
191
201
|
label: string;
|
|
192
|
-
|
|
202
|
+
minLength: 3;
|
|
203
|
+
name: "name";
|
|
193
204
|
labelTranslationKey?: string | undefined;
|
|
194
205
|
}, {
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
minLength: 3;
|
|
207
|
+
name: "name";
|
|
208
|
+
type?: string | undefined;
|
|
209
|
+
label?: string | undefined;
|
|
197
210
|
labelTranslationKey?: string | undefined;
|
|
198
211
|
}>, "many">;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
label: z.ZodOptional<z.ZodString>;
|
|
205
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
206
|
-
name: z.ZodString;
|
|
207
|
-
type: z.ZodString;
|
|
208
|
-
defaultValue: z.ZodOptional<z.ZodString>;
|
|
212
|
+
answerField: z.ZodLiteral<"uri">;
|
|
213
|
+
displayFields: z.ZodArray<z.ZodObject<{
|
|
214
|
+
propertyName: z.ZodLiteral<"displayName">;
|
|
215
|
+
label: z.ZodDefault<z.ZodString>;
|
|
216
|
+
labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
209
217
|
}, "strip", z.ZodTypeAny, {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
label?: string | undefined;
|
|
218
|
+
label: string;
|
|
219
|
+
propertyName: "displayName";
|
|
213
220
|
labelTranslationKey?: string | undefined;
|
|
214
|
-
minLength?: number | undefined;
|
|
215
|
-
defaultValue?: string | undefined;
|
|
216
221
|
}, {
|
|
217
|
-
|
|
218
|
-
name: string;
|
|
222
|
+
propertyName: "displayName";
|
|
219
223
|
label?: string | undefined;
|
|
220
224
|
labelTranslationKey?: string | undefined;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}>, "many">>;
|
|
225
|
+
}>, "many">;
|
|
226
|
+
responseField: z.ZodLiteral<"affiliations.items">;
|
|
224
227
|
}, "strip", z.ZodTypeAny, {
|
|
225
228
|
displayFields: {
|
|
226
229
|
label: string;
|
|
227
|
-
propertyName:
|
|
230
|
+
propertyName: "displayName";
|
|
228
231
|
labelTranslationKey?: string | undefined;
|
|
229
232
|
}[];
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
variables?: {
|
|
233
|
+
query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
|
|
234
|
+
responseField: "affiliations.items";
|
|
235
|
+
variables: {
|
|
234
236
|
type: string;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
label: string;
|
|
238
|
+
minLength: 3;
|
|
239
|
+
name: "name";
|
|
237
240
|
labelTranslationKey?: string | undefined;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
}[];
|
|
242
|
+
answerField: "uri";
|
|
243
|
+
localQueryId?: string | undefined;
|
|
244
|
+
queryId?: string | undefined;
|
|
241
245
|
}, {
|
|
242
246
|
displayFields: {
|
|
243
|
-
|
|
244
|
-
|
|
247
|
+
propertyName: "displayName";
|
|
248
|
+
label?: string | undefined;
|
|
245
249
|
labelTranslationKey?: string | undefined;
|
|
246
250
|
}[];
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
|
|
252
|
+
responseField: "affiliations.items";
|
|
253
|
+
variables: {
|
|
254
|
+
minLength: 3;
|
|
255
|
+
name: "name";
|
|
256
|
+
type?: string | undefined;
|
|
253
257
|
label?: string | undefined;
|
|
254
258
|
labelTranslationKey?: string | undefined;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
259
|
+
}[];
|
|
260
|
+
answerField: "uri";
|
|
261
|
+
localQueryId?: string | undefined;
|
|
262
|
+
queryId?: string | undefined;
|
|
263
|
+
}>;
|
|
264
|
+
meta: z.ZodObject<{
|
|
265
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
266
|
+
} & {
|
|
267
|
+
title: z.ZodOptional<z.ZodLiteral<"Affiliation Search">>;
|
|
268
|
+
usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require the user to select from a controlled list of institutions.">>;
|
|
269
|
+
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
schemaVersion: "1.0";
|
|
271
|
+
title?: "Affiliation Search" | undefined;
|
|
272
|
+
usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
|
|
273
|
+
}, {
|
|
274
|
+
schemaVersion: "1.0";
|
|
275
|
+
title?: "Affiliation Search" | undefined;
|
|
276
|
+
usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
|
|
258
277
|
}>;
|
|
259
278
|
}, "strip", z.ZodTypeAny, {
|
|
260
|
-
type: "
|
|
279
|
+
type: "affiliationSearch";
|
|
280
|
+
meta: {
|
|
281
|
+
schemaVersion: "1.0";
|
|
282
|
+
title?: "Affiliation Search" | undefined;
|
|
283
|
+
usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
|
|
284
|
+
};
|
|
261
285
|
graphQL: {
|
|
262
286
|
displayFields: {
|
|
263
287
|
label: string;
|
|
264
|
-
propertyName:
|
|
288
|
+
propertyName: "displayName";
|
|
265
289
|
labelTranslationKey?: string | undefined;
|
|
266
290
|
}[];
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
variables?: {
|
|
291
|
+
query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
|
|
292
|
+
responseField: "affiliations.items";
|
|
293
|
+
variables: {
|
|
271
294
|
type: string;
|
|
272
|
-
|
|
273
|
-
|
|
295
|
+
label: string;
|
|
296
|
+
minLength: 3;
|
|
297
|
+
name: "name";
|
|
274
298
|
labelTranslationKey?: string | undefined;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
299
|
+
}[];
|
|
300
|
+
answerField: "uri";
|
|
301
|
+
localQueryId?: string | undefined;
|
|
302
|
+
queryId?: string | undefined;
|
|
278
303
|
};
|
|
279
304
|
attributes?: {
|
|
280
305
|
label?: string | undefined;
|
|
281
306
|
help?: string | undefined;
|
|
282
307
|
labelTranslationKey?: string | undefined;
|
|
283
308
|
} | undefined;
|
|
284
|
-
meta?: {
|
|
285
|
-
schemaVersion: "1.0";
|
|
286
|
-
} | undefined;
|
|
287
309
|
}, {
|
|
288
|
-
type: "
|
|
310
|
+
type: "affiliationSearch";
|
|
311
|
+
meta: {
|
|
312
|
+
schemaVersion: "1.0";
|
|
313
|
+
title?: "Affiliation Search" | undefined;
|
|
314
|
+
usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
|
|
315
|
+
};
|
|
289
316
|
graphQL: {
|
|
290
317
|
displayFields: {
|
|
291
|
-
|
|
292
|
-
|
|
318
|
+
propertyName: "displayName";
|
|
319
|
+
label?: string | undefined;
|
|
293
320
|
labelTranslationKey?: string | undefined;
|
|
294
321
|
}[];
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
322
|
+
query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
|
|
323
|
+
responseField: "affiliations.items";
|
|
324
|
+
variables: {
|
|
325
|
+
minLength: 3;
|
|
326
|
+
name: "name";
|
|
327
|
+
type?: string | undefined;
|
|
301
328
|
label?: string | undefined;
|
|
302
329
|
labelTranslationKey?: string | undefined;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
330
|
+
}[];
|
|
331
|
+
answerField: "uri";
|
|
332
|
+
localQueryId?: string | undefined;
|
|
333
|
+
queryId?: string | undefined;
|
|
306
334
|
};
|
|
307
335
|
attributes?: {
|
|
308
336
|
label?: string | undefined;
|
|
309
337
|
help?: string | undefined;
|
|
310
338
|
labelTranslationKey?: string | undefined;
|
|
311
339
|
} | undefined;
|
|
312
|
-
meta?: {
|
|
313
|
-
schemaVersion: "1.0";
|
|
314
|
-
} | undefined;
|
|
315
340
|
}>;
|
|
316
341
|
export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestionSchema>;
|
|
317
|
-
export type
|
|
342
|
+
export type AffiliationSearchQuestionType = z.infer<typeof AffiliationSearchQuestionSchema>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AffiliationSearchQuestionSchema = exports.FilteredSearchQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
const BaseAttributes = question_1.QuestionSchema.shape.attributes;
|
|
7
|
+
const BaseMeta = question_1.QuestionSchema.shape.meta;
|
|
7
8
|
// An input variable for a GraphQL query
|
|
8
9
|
const GraphQLVariable = zod_1.z.object({
|
|
9
10
|
minLength: zod_1.z.number().optional(), // A min length for the variable before executing the query
|
|
@@ -28,15 +29,45 @@ const GraphQLQuery = zod_1.z.object({
|
|
|
28
29
|
variables: zod_1.z.array(GraphQLVariable).optional() // The variables for the query
|
|
29
30
|
});
|
|
30
31
|
// Filtered search question and answer
|
|
32
|
+
// TODO: This one is for future use to help build out the components of the
|
|
33
|
+
// Research Outputs Question Type (e.g. License selector, Repository selector, etc.)
|
|
31
34
|
exports.FilteredSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
32
35
|
type: zod_1.z.literal('filteredSearch'), // The type of question
|
|
33
36
|
graphQL: GraphQLQuery, // The GraphQL query options for the filtered search
|
|
34
37
|
attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
|
|
35
38
|
multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is true)
|
|
36
|
-
})).optional()
|
|
39
|
+
})).optional(),
|
|
40
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
41
|
+
title: zod_1.z.literal('Not yet implemented').optional(),
|
|
42
|
+
})).optional(),
|
|
37
43
|
}));
|
|
38
44
|
// Typeahead search question and answer
|
|
39
|
-
|
|
45
|
+
const TypeaheadSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
|
|
40
46
|
type: zod_1.z.literal('typeaheadSearch'), // The type of question
|
|
41
47
|
graphQL: GraphQLQuery, // The GraphQL query options for the typeahead search
|
|
42
48
|
}));
|
|
49
|
+
exports.AffiliationSearchQuestionSchema = TypeaheadSearchQuestionSchema.merge(zod_1.z.object({
|
|
50
|
+
type: zod_1.z.literal('affiliationSearch'),
|
|
51
|
+
graphQL: GraphQLQuery.merge(zod_1.z.object({
|
|
52
|
+
query: zod_1.z.literal('query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}'),
|
|
53
|
+
queryId: zod_1.z.string().default('useAffiliationsQuery').optional(),
|
|
54
|
+
variables: zod_1.z.array(zod_1.z.object({
|
|
55
|
+
name: zod_1.z.literal("name"),
|
|
56
|
+
type: zod_1.z.string().default("string"),
|
|
57
|
+
label: zod_1.z.string().default("Search for your institution"),
|
|
58
|
+
minLength: zod_1.z.literal(3),
|
|
59
|
+
labelTranslationKey: zod_1.z.string().default("SignupPage.institutionHelp").optional(),
|
|
60
|
+
})),
|
|
61
|
+
answerField: zod_1.z.literal('uri'),
|
|
62
|
+
displayFields: zod_1.z.array(zod_1.z.object({
|
|
63
|
+
propertyName: zod_1.z.literal("displayName"),
|
|
64
|
+
label: zod_1.z.string().default("Institution"),
|
|
65
|
+
labelTranslationKey: zod_1.z.string().default("SignupPage.institution").optional(),
|
|
66
|
+
})),
|
|
67
|
+
responseField: zod_1.z.literal("affiliations.items")
|
|
68
|
+
})),
|
|
69
|
+
meta: BaseMeta.unwrap().merge(zod_1.z.object({
|
|
70
|
+
title: zod_1.z.literal('Affiliation Search').optional(),
|
|
71
|
+
usageDescription: zod_1.z.literal('For questions that require the user to select from a controlled list of institutions.').optional(),
|
|
72
|
+
}))
|
|
73
|
+
}));
|