@dmptool/types 1.1.3 → 1.2.1

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.
Files changed (76) hide show
  1. package/README.md +119 -47
  2. package/dist/answers/__tests__/answers.spec.js +27 -28
  3. package/dist/answers/__tests__/usage.spec.d.ts +1 -0
  4. package/dist/answers/__tests__/usage.spec.js +178 -0
  5. package/dist/answers/answer.d.ts +12 -15
  6. package/dist/answers/answer.js +3 -4
  7. package/dist/answers/dateAnswers.d.ts +30 -30
  8. package/dist/answers/dateAnswers.js +6 -5
  9. package/dist/answers/graphQLAnswers.d.ts +41 -26
  10. package/dist/answers/graphQLAnswers.js +7 -4
  11. package/dist/answers/index.d.ts +887 -1088
  12. package/dist/answers/index.js +2 -2
  13. package/dist/answers/numberAnswers.d.ts +41 -41
  14. package/dist/answers/numberAnswers.js +8 -8
  15. package/dist/answers/optionBasedAnswers.d.ts +55 -55
  16. package/dist/answers/optionBasedAnswers.js +10 -10
  17. package/dist/answers/tableAnswers.d.ts +880 -1778
  18. package/dist/answers/tableAnswers.js +12 -8
  19. package/dist/answers/textAnswers.d.ts +44 -44
  20. package/dist/answers/textAnswers.js +8 -8
  21. package/dist/questions/__tests__/graphQLQuestions.spec.js +1 -1
  22. package/dist/questions/__tests__/usage.spec.d.ts +8 -0
  23. package/dist/questions/__tests__/usage.spec.js +312 -0
  24. package/dist/questions/dateQuestions.d.ts +81 -82
  25. package/dist/questions/dateQuestions.js +12 -16
  26. package/dist/questions/graphQLQuestions.d.ts +142 -142
  27. package/dist/questions/graphQLQuestions.js +35 -30
  28. package/dist/questions/index.d.ts +1492 -1672
  29. package/dist/questions/index.js +2 -2
  30. package/dist/questions/numberQuestions.d.ts +97 -98
  31. package/dist/questions/numberQuestions.js +7 -19
  32. package/dist/questions/optionBasedQuestions.d.ts +163 -166
  33. package/dist/questions/optionBasedQuestions.js +20 -36
  34. package/dist/questions/question.d.ts +24 -48
  35. package/dist/questions/question.js +78 -17
  36. package/dist/questions/tableQuestions.d.ts +2215 -2227
  37. package/dist/questions/tableQuestions.js +6 -11
  38. package/dist/questions/textQuestions.d.ts +104 -104
  39. package/dist/questions/textQuestions.js +6 -23
  40. package/dist/schemas/affiliationSearchAnswer.schema.json +20 -12
  41. package/dist/schemas/affiliationSearchQuestion.schema.json +30 -36
  42. package/dist/schemas/anyAnswer.schema.json +235 -233
  43. package/dist/schemas/anyQuestion.schema.json +292 -493
  44. package/dist/schemas/anyTableColumnAnswer.schema.json +104 -106
  45. package/dist/schemas/anyTableColumnQuestion.schema.json +164 -325
  46. package/dist/schemas/booleanAnswer.schema.json +8 -11
  47. package/dist/schemas/booleanQuestion.schema.json +7 -10
  48. package/dist/schemas/checkboxesAnswer.schema.json +13 -14
  49. package/dist/schemas/checkboxesQuestion.schema.json +12 -13
  50. package/dist/schemas/currencyAnswer.schema.json +8 -11
  51. package/dist/schemas/currencyQuestion.schema.json +7 -10
  52. package/dist/schemas/dateAnswer.schema.json +8 -11
  53. package/dist/schemas/dateQuestion.schema.json +7 -10
  54. package/dist/schemas/dateRangeAnswer.schema.json +16 -21
  55. package/dist/schemas/dateRangeQuestion.schema.json +38 -20
  56. package/dist/schemas/emailAnswer.schema.json +8 -11
  57. package/dist/schemas/emailQuestion.schema.json +7 -10
  58. package/dist/schemas/multiselectBoxAnswer.schema.json +13 -14
  59. package/dist/schemas/multiselectBoxQuestion.schema.json +14 -14
  60. package/dist/schemas/numberAnswer.schema.json +8 -11
  61. package/dist/schemas/numberQuestion.schema.json +7 -10
  62. package/dist/schemas/numberRangeAnswer.schema.json +17 -22
  63. package/dist/schemas/numberRangeQuestion.schema.json +18 -19
  64. package/dist/schemas/radioButtonsAnswer.schema.json +8 -11
  65. package/dist/schemas/radioButtonsQuestion.schema.json +12 -13
  66. package/dist/schemas/selectBoxAnswer.schema.json +8 -11
  67. package/dist/schemas/selectBoxQuestion.schema.json +18 -15
  68. package/dist/schemas/tableAnswer.schema.json +343 -338
  69. package/dist/schemas/tableQuestion.schema.json +178 -352
  70. package/dist/schemas/textAnswer.schema.json +8 -11
  71. package/dist/schemas/textAreaAnswer.schema.json +8 -11
  72. package/dist/schemas/textAreaQuestion.schema.json +7 -10
  73. package/dist/schemas/textQuestion.schema.json +7 -10
  74. package/dist/schemas/urlAnswer.schema.json +8 -11
  75. package/dist/schemas/urlQuestion.schema.json +7 -10
  76. package/package.json +1 -1
@@ -1,29 +1,43 @@
1
1
  import { z } from "zod";
2
- export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
2
+ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
3
+ meta: z.ZodDefault<z.ZodObject<{
4
+ schemaVersion: z.ZodDefault<z.ZodString>;
5
+ title: z.ZodOptional<z.ZodString>;
6
+ usageDescription: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ schemaVersion: string;
9
+ title?: string | undefined;
10
+ usageDescription?: string | undefined;
11
+ }, {
12
+ schemaVersion?: string | undefined;
13
+ title?: string | undefined;
14
+ usageDescription?: string | undefined;
15
+ }>>;
16
+ } & {
3
17
  type: z.ZodLiteral<"filteredSearch">;
4
- graphQL: z.ZodObject<{
5
- displayFields: z.ZodArray<z.ZodObject<{
6
- propertyName: z.ZodString;
7
- label: z.ZodString;
18
+ graphQL: z.ZodDefault<z.ZodObject<{
19
+ displayFields: z.ZodDefault<z.ZodArray<z.ZodObject<{
20
+ propertyName: z.ZodDefault<z.ZodString>;
21
+ label: z.ZodDefault<z.ZodString>;
8
22
  labelTranslationKey: z.ZodOptional<z.ZodString>;
9
23
  }, "strip", z.ZodTypeAny, {
10
24
  label: string;
11
25
  propertyName: string;
12
26
  labelTranslationKey?: string | undefined;
13
27
  }, {
14
- label: string;
15
- propertyName: string;
28
+ label?: string | undefined;
16
29
  labelTranslationKey?: string | undefined;
17
- }>, "many">;
30
+ propertyName?: string | undefined;
31
+ }>, "many">>;
18
32
  localQueryId: z.ZodOptional<z.ZodString>;
19
33
  query: z.ZodOptional<z.ZodString>;
20
- responseField: z.ZodString;
21
- variables: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ responseField: z.ZodDefault<z.ZodString>;
35
+ variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
22
36
  minLength: z.ZodOptional<z.ZodNumber>;
23
37
  label: z.ZodOptional<z.ZodString>;
24
38
  labelTranslationKey: z.ZodOptional<z.ZodString>;
25
- name: z.ZodString;
26
- type: z.ZodString;
39
+ name: z.ZodDefault<z.ZodString>;
40
+ type: z.ZodDefault<z.ZodString>;
27
41
  defaultValue: z.ZodOptional<z.ZodString>;
28
42
  }, "strip", z.ZodTypeAny, {
29
43
  type: string;
@@ -33,11 +47,11 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
33
47
  minLength?: number | undefined;
34
48
  defaultValue?: string | undefined;
35
49
  }, {
36
- type: string;
37
- name: string;
50
+ type?: string | undefined;
38
51
  label?: string | undefined;
39
52
  labelTranslationKey?: string | undefined;
40
53
  minLength?: number | undefined;
54
+ name?: string | undefined;
41
55
  defaultValue?: string | undefined;
42
56
  }>, "many">>;
43
57
  }, "strip", z.ZodTypeAny, {
@@ -47,67 +61,64 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
47
61
  labelTranslationKey?: string | undefined;
48
62
  }[];
49
63
  responseField: string;
50
- localQueryId?: string | undefined;
51
- query?: string | undefined;
52
- variables?: {
64
+ variables: {
53
65
  type: string;
54
66
  name: string;
55
67
  label?: string | undefined;
56
68
  labelTranslationKey?: string | undefined;
57
69
  minLength?: number | undefined;
58
70
  defaultValue?: string | undefined;
59
- }[] | undefined;
71
+ }[];
72
+ localQueryId?: string | undefined;
73
+ query?: string | undefined;
60
74
  }, {
61
- displayFields: {
62
- label: string;
63
- propertyName: string;
75
+ displayFields?: {
76
+ label?: string | undefined;
64
77
  labelTranslationKey?: string | undefined;
65
- }[];
66
- responseField: string;
78
+ propertyName?: string | undefined;
79
+ }[] | undefined;
67
80
  localQueryId?: string | undefined;
68
81
  query?: string | undefined;
82
+ responseField?: string | undefined;
69
83
  variables?: {
70
- type: string;
71
- name: string;
84
+ type?: string | undefined;
72
85
  label?: string | undefined;
73
86
  labelTranslationKey?: string | undefined;
74
87
  minLength?: number | undefined;
88
+ name?: string | undefined;
75
89
  defaultValue?: string | undefined;
76
90
  }[] | undefined;
77
- }>;
78
- attributes: z.ZodOptional<z.ZodObject<{
91
+ }>>;
92
+ attributes: z.ZodDefault<z.ZodObject<{
79
93
  label: z.ZodOptional<z.ZodString>;
80
94
  help: z.ZodOptional<z.ZodString>;
81
95
  labelTranslationKey: z.ZodOptional<z.ZodString>;
82
96
  } & {
83
- multiple: z.ZodOptional<z.ZodBoolean>;
97
+ multiple: z.ZodDefault<z.ZodBoolean>;
84
98
  }, "strip", z.ZodTypeAny, {
99
+ multiple: boolean;
85
100
  label?: string | undefined;
86
101
  help?: string | undefined;
87
102
  labelTranslationKey?: string | undefined;
88
- multiple?: boolean | undefined;
89
103
  }, {
90
104
  label?: string | undefined;
91
105
  help?: string | undefined;
92
106
  labelTranslationKey?: string | undefined;
93
107
  multiple?: boolean | undefined;
94
108
  }>>;
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
- }>>;
109
109
  }, "strip", z.ZodTypeAny, {
110
110
  type: "filteredSearch";
111
+ attributes: {
112
+ multiple: boolean;
113
+ label?: string | undefined;
114
+ help?: string | undefined;
115
+ labelTranslationKey?: string | undefined;
116
+ };
117
+ meta: {
118
+ schemaVersion: string;
119
+ title?: string | undefined;
120
+ usageDescription?: string | undefined;
121
+ };
111
122
  graphQL: {
112
123
  displayFields: {
113
124
  label: string;
@@ -115,17 +126,19 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
115
126
  labelTranslationKey?: string | undefined;
116
127
  }[];
117
128
  responseField: string;
118
- localQueryId?: string | undefined;
119
- query?: string | undefined;
120
- variables?: {
129
+ variables: {
121
130
  type: string;
122
131
  name: string;
123
132
  label?: string | undefined;
124
133
  labelTranslationKey?: string | undefined;
125
134
  minLength?: number | undefined;
126
135
  defaultValue?: string | undefined;
127
- }[] | undefined;
136
+ }[];
137
+ localQueryId?: string | undefined;
138
+ query?: string | undefined;
128
139
  };
140
+ }, {
141
+ type: "filteredSearch";
129
142
  attributes?: {
130
143
  label?: string | undefined;
131
144
  help?: string | undefined;
@@ -133,44 +146,47 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
133
146
  multiple?: boolean | undefined;
134
147
  } | undefined;
135
148
  meta?: {
136
- schemaVersion: "1.0";
137
- title?: "Not yet implemented" | undefined;
149
+ schemaVersion?: string | undefined;
150
+ title?: string | undefined;
138
151
  usageDescription?: string | undefined;
139
152
  } | undefined;
140
- }, {
141
- type: "filteredSearch";
142
- graphQL: {
143
- displayFields: {
144
- label: string;
145
- propertyName: string;
153
+ graphQL?: {
154
+ displayFields?: {
155
+ label?: string | undefined;
146
156
  labelTranslationKey?: string | undefined;
147
- }[];
148
- responseField: string;
157
+ propertyName?: string | undefined;
158
+ }[] | undefined;
149
159
  localQueryId?: string | undefined;
150
160
  query?: string | undefined;
161
+ responseField?: string | undefined;
151
162
  variables?: {
152
- type: string;
153
- name: string;
163
+ type?: string | undefined;
154
164
  label?: string | undefined;
155
165
  labelTranslationKey?: string | undefined;
156
166
  minLength?: number | undefined;
167
+ name?: string | undefined;
157
168
  defaultValue?: string | undefined;
158
169
  }[] | undefined;
159
- };
160
- attributes?: {
161
- label?: string | undefined;
162
- help?: string | undefined;
163
- labelTranslationKey?: string | undefined;
164
- multiple?: boolean | undefined;
165
- } | undefined;
166
- meta?: {
167
- schemaVersion: "1.0";
168
- title?: "Not yet implemented" | undefined;
169
- usageDescription?: string | undefined;
170
170
  } | undefined;
171
171
  }>;
172
+ export declare const affiliationQuery: string;
172
173
  export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
173
- attributes: z.ZodOptional<z.ZodObject<{
174
+ meta: z.ZodDefault<z.ZodObject<{
175
+ schemaVersion: z.ZodDefault<z.ZodString>;
176
+ title: z.ZodOptional<z.ZodString>;
177
+ usageDescription: z.ZodOptional<z.ZodString>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ schemaVersion: string;
180
+ title?: string | undefined;
181
+ usageDescription?: string | undefined;
182
+ }, {
183
+ schemaVersion?: string | undefined;
184
+ title?: string | undefined;
185
+ usageDescription?: string | undefined;
186
+ }>>;
187
+ } & {
188
+ type: z.ZodLiteral<"affiliationSearch">;
189
+ attributes: z.ZodDefault<z.ZodObject<{
174
190
  label: z.ZodOptional<z.ZodString>;
175
191
  help: z.ZodOptional<z.ZodString>;
176
192
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -183,18 +199,16 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
183
199
  help?: string | undefined;
184
200
  labelTranslationKey?: string | undefined;
185
201
  }>>;
186
- } & {
187
- type: z.ZodLiteral<"affiliationSearch">;
188
- graphQL: z.ZodObject<{
202
+ graphQL: z.ZodDefault<z.ZodObject<{
189
203
  localQueryId: z.ZodOptional<z.ZodString>;
190
204
  } & {
191
- query: z.ZodLiteral<"query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}">;
205
+ query: z.ZodDefault<z.ZodLiteral<string>>;
192
206
  queryId: z.ZodOptional<z.ZodDefault<z.ZodString>>;
193
- variables: z.ZodArray<z.ZodObject<{
194
- name: z.ZodLiteral<"name">;
207
+ variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
208
+ name: z.ZodDefault<z.ZodLiteral<"name">>;
195
209
  type: z.ZodDefault<z.ZodString>;
196
210
  label: z.ZodDefault<z.ZodString>;
197
- minLength: z.ZodLiteral<3>;
211
+ minLength: z.ZodDefault<z.ZodLiteral<3>>;
198
212
  labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
199
213
  }, "strip", z.ZodTypeAny, {
200
214
  type: string;
@@ -203,15 +217,15 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
203
217
  name: "name";
204
218
  labelTranslationKey?: string | undefined;
205
219
  }, {
206
- minLength: 3;
207
- name: "name";
208
220
  type?: string | undefined;
209
221
  label?: string | undefined;
210
222
  labelTranslationKey?: string | undefined;
211
- }>, "many">;
212
- answerField: z.ZodLiteral<"uri">;
213
- displayFields: z.ZodArray<z.ZodObject<{
214
- propertyName: z.ZodLiteral<"displayName">;
223
+ minLength?: 3 | undefined;
224
+ name?: "name" | undefined;
225
+ }>, "many">>;
226
+ answerField: z.ZodDefault<z.ZodLiteral<"uri">>;
227
+ displayFields: z.ZodDefault<z.ZodArray<z.ZodObject<{
228
+ propertyName: z.ZodDefault<z.ZodLiteral<"displayName">>;
215
229
  label: z.ZodDefault<z.ZodString>;
216
230
  labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
217
231
  }, "strip", z.ZodTypeAny, {
@@ -219,18 +233,18 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
219
233
  propertyName: "displayName";
220
234
  labelTranslationKey?: string | undefined;
221
235
  }, {
222
- propertyName: "displayName";
223
236
  label?: string | undefined;
224
237
  labelTranslationKey?: string | undefined;
225
- }>, "many">;
226
- responseField: z.ZodLiteral<"affiliations.items">;
238
+ propertyName?: "displayName" | undefined;
239
+ }>, "many">>;
240
+ responseField: z.ZodDefault<z.ZodLiteral<"affiliations.items">>;
227
241
  }, "strip", z.ZodTypeAny, {
228
242
  displayFields: {
229
243
  label: string;
230
244
  propertyName: "displayName";
231
245
  labelTranslationKey?: string | undefined;
232
246
  }[];
233
- query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
247
+ query: string;
234
248
  responseField: "affiliations.items";
235
249
  variables: {
236
250
  type: string;
@@ -243,44 +257,35 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
243
257
  localQueryId?: string | undefined;
244
258
  queryId?: string | undefined;
245
259
  }, {
246
- displayFields: {
247
- propertyName: "displayName";
260
+ displayFields?: {
248
261
  label?: string | undefined;
249
262
  labelTranslationKey?: string | undefined;
250
- }[];
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";
263
+ propertyName?: "displayName" | undefined;
264
+ }[] | undefined;
265
+ localQueryId?: string | undefined;
266
+ query?: string | undefined;
267
+ responseField?: "affiliations.items" | undefined;
268
+ variables?: {
256
269
  type?: string | undefined;
257
270
  label?: string | undefined;
258
271
  labelTranslationKey?: string | undefined;
259
- }[];
260
- answerField: "uri";
261
- localQueryId?: string | undefined;
272
+ minLength?: 3 | undefined;
273
+ name?: "name" | undefined;
274
+ }[] | undefined;
262
275
  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;
277
- }>;
276
+ answerField?: "uri" | undefined;
277
+ }>>;
278
278
  }, "strip", z.ZodTypeAny, {
279
279
  type: "affiliationSearch";
280
+ attributes: {
281
+ label?: string | undefined;
282
+ help?: string | undefined;
283
+ labelTranslationKey?: string | undefined;
284
+ };
280
285
  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;
286
+ schemaVersion: string;
287
+ title?: string | undefined;
288
+ usageDescription?: string | undefined;
284
289
  };
285
290
  graphQL: {
286
291
  displayFields: {
@@ -288,7 +293,7 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
288
293
  propertyName: "displayName";
289
294
  labelTranslationKey?: string | undefined;
290
295
  }[];
291
- query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}";
296
+ query: string;
292
297
  responseField: "affiliations.items";
293
298
  variables: {
294
299
  type: string;
@@ -301,41 +306,36 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
301
306
  localQueryId?: string | undefined;
302
307
  queryId?: string | undefined;
303
308
  };
309
+ }, {
310
+ type: "affiliationSearch";
304
311
  attributes?: {
305
312
  label?: string | undefined;
306
313
  help?: string | undefined;
307
314
  labelTranslationKey?: string | undefined;
308
315
  } | undefined;
309
- }, {
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
- };
316
- graphQL: {
317
- displayFields: {
318
- propertyName: "displayName";
316
+ meta?: {
317
+ schemaVersion?: string | undefined;
318
+ title?: string | undefined;
319
+ usageDescription?: string | undefined;
320
+ } | undefined;
321
+ graphQL?: {
322
+ displayFields?: {
319
323
  label?: string | undefined;
320
324
  labelTranslationKey?: string | undefined;
321
- }[];
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";
325
+ propertyName?: "displayName" | undefined;
326
+ }[] | undefined;
327
+ localQueryId?: string | undefined;
328
+ query?: string | undefined;
329
+ responseField?: "affiliations.items" | undefined;
330
+ variables?: {
327
331
  type?: string | undefined;
328
332
  label?: string | undefined;
329
333
  labelTranslationKey?: string | undefined;
330
- }[];
331
- answerField: "uri";
332
- localQueryId?: string | undefined;
334
+ minLength?: 3 | undefined;
335
+ name?: "name" | undefined;
336
+ }[] | undefined;
333
337
  queryId?: string | undefined;
334
- };
335
- attributes?: {
336
- label?: string | undefined;
337
- help?: string | undefined;
338
- labelTranslationKey?: string | undefined;
338
+ answerField?: "uri" | undefined;
339
339
  } | undefined;
340
340
  }>;
341
341
  export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestionSchema>;
@@ -1,73 +1,78 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AffiliationSearchQuestionSchema = exports.FilteredSearchQuestionSchema = void 0;
3
+ exports.AffiliationSearchQuestionSchema = exports.affiliationQuery = 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;
8
7
  // An input variable for a GraphQL query
9
8
  const GraphQLVariable = zod_1.z.object({
10
9
  minLength: zod_1.z.number().optional(), // A min length for the variable before executing the query
11
10
  label: zod_1.z.string().optional(), // The label for the variable (default to the name)
12
11
  labelTranslationKey: zod_1.z.string().optional(), // The translation key for the label (DMP Tool only)
13
- name: zod_1.z.string(), // MUST match the input variable name in the query
14
- type: zod_1.z.string(), // The type of the variable (default is string)
12
+ name: zod_1.z.string().default('search'), // MUST match the input variable name in the query
13
+ type: zod_1.z.string().default('string'), // The type of the variable (default is string)
15
14
  defaultValue: zod_1.z.string().optional() // The default value for the variable (no default)
16
15
  });
17
16
  // A property from a GraphQL query response that will be displayed to the user
18
17
  const GraphQLDisplayField = zod_1.z.object({
19
- propertyName: zod_1.z.string(), // MUST match a property name in the query response
20
- label: zod_1.z.string(), // The label for the field
18
+ propertyName: zod_1.z.string().default('id'), // MUST match a property name in the query response
19
+ label: zod_1.z.string().default('Id'), // The label for the field
21
20
  labelTranslationKey: zod_1.z.string().optional() // The translation key for the label (DMP Tool only)
22
21
  });
23
22
  // A GraphQL query object
24
23
  const GraphQLQuery = zod_1.z.object({
25
- displayFields: zod_1.z.array(GraphQLDisplayField), // The fields to display from the query response
24
+ displayFields: zod_1.z.array(GraphQLDisplayField).default([{}]), // The fields to display from the query response
26
25
  localQueryId: zod_1.z.string().optional(), // The ID of the query (required if no query)
27
26
  query: zod_1.z.string().optional(), // The GraphQL query to execute (required if no localQueryId)
28
- responseField: zod_1.z.string(), // How to get at the location of displayFields in the response
29
- variables: zod_1.z.array(GraphQLVariable).optional() // The variables for the query
27
+ responseField: zod_1.z.string().default('query.items'), // How to get at the location of displayFields in the response
28
+ variables: zod_1.z.array(GraphQLVariable).default([{}]) // The variables for the query
30
29
  });
31
30
  // Filtered search question and answer
32
31
  // TODO: This one is for future use to help build out the components of the
33
32
  // Research Outputs Question Type (e.g. License selector, Repository selector, etc.)
34
33
  exports.FilteredSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
35
- type: zod_1.z.literal('filteredSearch'), // The type of question
36
- graphQL: GraphQLQuery, // The GraphQL query options for the filtered search
37
- attributes: BaseAttributes.unwrap().merge(zod_1.z.object({
38
- multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is true)
39
- })).optional(),
40
- meta: BaseMeta.unwrap().merge(zod_1.z.object({
41
- title: zod_1.z.literal('Not yet implemented').optional(),
42
- })).optional(),
34
+ type: zod_1.z.literal('filteredSearch'),
35
+ graphQL: GraphQLQuery.default({}), // The GraphQL query options for the search
36
+ attributes: BaseAttributes.merge(zod_1.z.object({
37
+ multiple: zod_1.z.boolean().default(true) // Whether to allow multiple selections
38
+ })).default({})
43
39
  }));
44
40
  // Typeahead search question and answer
45
41
  const TypeaheadSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
46
42
  type: zod_1.z.literal('typeaheadSearch'), // The type of question
47
43
  graphQL: GraphQLQuery, // The GraphQL query options for the typeahead search
48
44
  }));
45
+ exports.affiliationQuery = '' +
46
+ 'query Affiliations($name: String!){' +
47
+ 'affiliations(name: $name) {' +
48
+ 'totalCount' +
49
+ 'nextCursor' +
50
+ 'items {' +
51
+ 'id' +
52
+ 'displayName' +
53
+ 'uri' +
54
+ '}' +
55
+ '}' +
56
+ '}';
49
57
  exports.AffiliationSearchQuestionSchema = TypeaheadSearchQuestionSchema.merge(zod_1.z.object({
50
58
  type: zod_1.z.literal('affiliationSearch'),
59
+ attributes: BaseAttributes.default({}),
51
60
  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}}}'),
61
+ query: zod_1.z.literal(exports.affiliationQuery).default(exports.affiliationQuery),
53
62
  queryId: zod_1.z.string().default('useAffiliationsQuery').optional(),
54
63
  variables: zod_1.z.array(zod_1.z.object({
55
- name: zod_1.z.literal("name"),
64
+ name: zod_1.z.literal("name").default('name'),
56
65
  type: zod_1.z.string().default("string"),
57
66
  label: zod_1.z.string().default("Search for your institution"),
58
- minLength: zod_1.z.literal(3),
67
+ minLength: zod_1.z.literal(3).default(3),
59
68
  labelTranslationKey: zod_1.z.string().default("SignupPage.institutionHelp").optional(),
60
- })),
61
- answerField: zod_1.z.literal('uri'),
69
+ })).default([{}]),
70
+ answerField: zod_1.z.literal('uri').default('uri'),
62
71
  displayFields: zod_1.z.array(zod_1.z.object({
63
- propertyName: zod_1.z.literal("displayName"),
72
+ propertyName: zod_1.z.literal("displayName").default('displayName'),
64
73
  label: zod_1.z.string().default("Institution"),
65
74
  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
- }))
75
+ })).default([{}]),
76
+ responseField: zod_1.z.literal("affiliations.items").default('affiliations.items'),
77
+ })).default({}),
73
78
  }));