@dmptool/types 1.1.2 → 1.2.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.
Files changed (78) hide show
  1. package/README.md +119 -47
  2. package/dist/answers/__tests__/answers.spec.js +20 -28
  3. package/dist/answers/__tests__/usage.spec.d.ts +1 -0
  4. package/dist/answers/__tests__/usage.spec.js +175 -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 +25 -25
  10. package/dist/answers/graphQLAnswers.js +4 -4
  11. package/dist/answers/index.d.ts +860 -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 +811 -1772
  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 +6 -4
  22. package/dist/questions/__tests__/optionBasedQuestions.spec.js +4 -12
  23. package/dist/questions/__tests__/usage.spec.d.ts +8 -0
  24. package/dist/questions/__tests__/usage.spec.js +312 -0
  25. package/dist/questions/dateQuestions.d.ts +90 -101
  26. package/dist/questions/dateQuestions.js +15 -34
  27. package/dist/questions/graphQLQuestions.d.ts +176 -182
  28. package/dist/questions/graphQLQuestions.js +44 -45
  29. package/dist/questions/index.d.ts +1791 -2170
  30. package/dist/questions/index.js +2 -2
  31. package/dist/questions/numberQuestions.d.ts +126 -142
  32. package/dist/questions/numberQuestions.js +11 -45
  33. package/dist/questions/optionBasedQuestions.d.ts +197 -225
  34. package/dist/questions/optionBasedQuestions.js +24 -88
  35. package/dist/questions/question.d.ts +24 -56
  36. package/dist/questions/question.js +78 -18
  37. package/dist/questions/tableQuestions.d.ts +2637 -2930
  38. package/dist/questions/tableQuestions.js +9 -21
  39. package/dist/questions/textQuestions.d.ts +125 -145
  40. package/dist/questions/textQuestions.js +16 -57
  41. package/dist/schemas/affiliationSearchAnswer.schema.json +9 -12
  42. package/dist/schemas/affiliationSearchQuestion.schema.json +57 -50
  43. package/dist/schemas/anyAnswer.schema.json +228 -237
  44. package/dist/schemas/anyQuestion.schema.json +349 -517
  45. package/dist/schemas/anyTableColumnAnswer.schema.json +93 -106
  46. package/dist/schemas/anyTableColumnQuestion.schema.json +259 -382
  47. package/dist/schemas/booleanAnswer.schema.json +8 -11
  48. package/dist/schemas/booleanQuestion.schema.json +9 -15
  49. package/dist/schemas/checkboxesAnswer.schema.json +13 -14
  50. package/dist/schemas/checkboxesQuestion.schema.json +18 -24
  51. package/dist/schemas/currencyAnswer.schema.json +8 -11
  52. package/dist/schemas/currencyQuestion.schema.json +13 -17
  53. package/dist/schemas/dateAnswer.schema.json +8 -11
  54. package/dist/schemas/dateQuestion.schema.json +9 -15
  55. package/dist/schemas/dateRangeAnswer.schema.json +16 -21
  56. package/dist/schemas/dateRangeQuestion.schema.json +40 -21
  57. package/dist/schemas/emailAnswer.schema.json +8 -11
  58. package/dist/schemas/emailQuestion.schema.json +11 -16
  59. package/dist/schemas/filteredSearchQuestion.schema.json +0 -3
  60. package/dist/schemas/multiselectBoxAnswer.schema.json +13 -14
  61. package/dist/schemas/multiselectBoxQuestion.schema.json +20 -25
  62. package/dist/schemas/numberAnswer.schema.json +8 -11
  63. package/dist/schemas/numberQuestion.schema.json +11 -16
  64. package/dist/schemas/numberRangeAnswer.schema.json +17 -22
  65. package/dist/schemas/numberRangeQuestion.schema.json +22 -21
  66. package/dist/schemas/radioButtonsAnswer.schema.json +8 -11
  67. package/dist/schemas/radioButtonsQuestion.schema.json +18 -24
  68. package/dist/schemas/selectBoxAnswer.schema.json +8 -11
  69. package/dist/schemas/selectBoxQuestion.schema.json +20 -25
  70. package/dist/schemas/tableAnswer.schema.json +337 -343
  71. package/dist/schemas/tableQuestion.schema.json +279 -416
  72. package/dist/schemas/textAnswer.schema.json +8 -11
  73. package/dist/schemas/textAreaAnswer.schema.json +8 -11
  74. package/dist/schemas/textAreaQuestion.schema.json +13 -17
  75. package/dist/schemas/textQuestion.schema.json +9 -15
  76. package/dist/schemas/urlAnswer.schema.json +8 -11
  77. package/dist/schemas/urlQuestion.schema.json +9 -15
  78. 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,70 +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
- defaultJSON: z.ZodOptional<z.ZodString>;
99
- } & {
100
- title: z.ZodOptional<z.ZodLiteral<"Not yet implemented">>;
101
- }, "strip", z.ZodTypeAny, {
102
- schemaVersion: "1.0";
103
- title?: "Not yet implemented" | undefined;
104
- usageDescription?: string | undefined;
105
- defaultJSON?: string | undefined;
106
- }, {
107
- schemaVersion: "1.0";
108
- title?: "Not yet implemented" | undefined;
109
- usageDescription?: string | undefined;
110
- defaultJSON?: string | undefined;
111
- }>>;
112
109
  }, "strip", z.ZodTypeAny, {
113
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
+ };
114
122
  graphQL: {
115
123
  displayFields: {
116
124
  label: string;
@@ -118,17 +126,19 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
118
126
  labelTranslationKey?: string | undefined;
119
127
  }[];
120
128
  responseField: string;
121
- localQueryId?: string | undefined;
122
- query?: string | undefined;
123
- variables?: {
129
+ variables: {
124
130
  type: string;
125
131
  name: string;
126
132
  label?: string | undefined;
127
133
  labelTranslationKey?: string | undefined;
128
134
  minLength?: number | undefined;
129
135
  defaultValue?: string | undefined;
130
- }[] | undefined;
136
+ }[];
137
+ localQueryId?: string | undefined;
138
+ query?: string | undefined;
131
139
  };
140
+ }, {
141
+ type: "filteredSearch";
132
142
  attributes?: {
133
143
  label?: string | undefined;
134
144
  help?: string | undefined;
@@ -136,46 +146,47 @@ export declare const FilteredSearchQuestionSchema: z.ZodObject<{} & {
136
146
  multiple?: boolean | undefined;
137
147
  } | undefined;
138
148
  meta?: {
139
- schemaVersion: "1.0";
140
- title?: "Not yet implemented" | undefined;
149
+ schemaVersion?: string | undefined;
150
+ title?: string | undefined;
141
151
  usageDescription?: string | undefined;
142
- defaultJSON?: string | undefined;
143
152
  } | undefined;
144
- }, {
145
- type: "filteredSearch";
146
- graphQL: {
147
- displayFields: {
148
- label: string;
149
- propertyName: string;
153
+ graphQL?: {
154
+ displayFields?: {
155
+ label?: string | undefined;
150
156
  labelTranslationKey?: string | undefined;
151
- }[];
152
- responseField: string;
157
+ propertyName?: string | undefined;
158
+ }[] | undefined;
153
159
  localQueryId?: string | undefined;
154
160
  query?: string | undefined;
161
+ responseField?: string | undefined;
155
162
  variables?: {
156
- type: string;
157
- name: string;
163
+ type?: string | undefined;
158
164
  label?: string | undefined;
159
165
  labelTranslationKey?: string | undefined;
160
166
  minLength?: number | undefined;
167
+ name?: string | undefined;
161
168
  defaultValue?: string | undefined;
162
169
  }[] | undefined;
163
- };
164
- attributes?: {
165
- label?: string | undefined;
166
- help?: string | undefined;
167
- labelTranslationKey?: string | undefined;
168
- multiple?: boolean | undefined;
169
- } | undefined;
170
- meta?: {
171
- schemaVersion: "1.0";
172
- title?: "Not yet implemented" | undefined;
173
- usageDescription?: string | undefined;
174
- defaultJSON?: string | undefined;
175
170
  } | undefined;
176
171
  }>;
172
+ export declare const affiliationQuery = "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}";
177
173
  export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
178
- 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<{
179
190
  label: z.ZodOptional<z.ZodString>;
180
191
  help: z.ZodOptional<z.ZodString>;
181
192
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -188,160 +199,143 @@ export declare const AffiliationSearchQuestionSchema: z.ZodObject<{
188
199
  help?: string | undefined;
189
200
  labelTranslationKey?: string | undefined;
190
201
  }>>;
191
- graphQL: z.ZodObject<{
192
- displayFields: z.ZodArray<z.ZodObject<{
193
- propertyName: z.ZodString;
194
- label: z.ZodString;
195
- labelTranslationKey: z.ZodOptional<z.ZodString>;
202
+ graphQL: z.ZodDefault<z.ZodObject<{
203
+ localQueryId: z.ZodOptional<z.ZodString>;
204
+ } & {
205
+ query: z.ZodDefault<z.ZodLiteral<"\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}">>;
206
+ queryId: z.ZodOptional<z.ZodDefault<z.ZodString>>;
207
+ variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
208
+ name: z.ZodDefault<z.ZodLiteral<"name">>;
209
+ type: z.ZodDefault<z.ZodString>;
210
+ label: z.ZodDefault<z.ZodString>;
211
+ minLength: z.ZodDefault<z.ZodLiteral<3>>;
212
+ labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
196
213
  }, "strip", z.ZodTypeAny, {
214
+ type: string;
197
215
  label: string;
198
- propertyName: string;
216
+ minLength: 3;
217
+ name: "name";
199
218
  labelTranslationKey?: string | undefined;
200
219
  }, {
201
- label: string;
202
- propertyName: string;
220
+ type?: string | undefined;
221
+ label?: string | undefined;
203
222
  labelTranslationKey?: string | undefined;
204
- }>, "many">;
205
- localQueryId: z.ZodOptional<z.ZodString>;
206
- query: z.ZodOptional<z.ZodString>;
207
- responseField: z.ZodString;
208
- variables: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
- minLength: z.ZodOptional<z.ZodNumber>;
210
- label: z.ZodOptional<z.ZodString>;
211
- labelTranslationKey: z.ZodOptional<z.ZodString>;
212
- name: z.ZodString;
213
- type: z.ZodString;
214
- defaultValue: z.ZodOptional<z.ZodString>;
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">>;
229
+ label: z.ZodDefault<z.ZodString>;
230
+ labelTranslationKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
215
231
  }, "strip", z.ZodTypeAny, {
216
- type: string;
217
- name: string;
218
- label?: string | undefined;
232
+ label: string;
233
+ propertyName: "displayName";
219
234
  labelTranslationKey?: string | undefined;
220
- minLength?: number | undefined;
221
- defaultValue?: string | undefined;
222
235
  }, {
223
- type: string;
224
- name: string;
225
236
  label?: string | undefined;
226
237
  labelTranslationKey?: string | undefined;
227
- minLength?: number | undefined;
228
- defaultValue?: string | undefined;
238
+ propertyName?: "displayName" | undefined;
229
239
  }>, "many">>;
240
+ responseField: z.ZodDefault<z.ZodLiteral<"affiliations.items">>;
230
241
  }, "strip", z.ZodTypeAny, {
231
242
  displayFields: {
232
243
  label: string;
233
- propertyName: string;
244
+ propertyName: "displayName";
234
245
  labelTranslationKey?: string | undefined;
235
246
  }[];
236
- responseField: string;
237
- localQueryId?: string | undefined;
238
- query?: string | undefined;
239
- variables?: {
247
+ query: "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}";
248
+ responseField: "affiliations.items";
249
+ variables: {
240
250
  type: string;
241
- name: string;
242
- label?: string | undefined;
243
- labelTranslationKey?: string | undefined;
244
- minLength?: number | undefined;
245
- defaultValue?: string | undefined;
246
- }[] | undefined;
247
- }, {
248
- displayFields: {
249
251
  label: string;
250
- propertyName: string;
252
+ minLength: 3;
253
+ name: "name";
251
254
  labelTranslationKey?: string | undefined;
252
255
  }[];
253
- responseField: string;
256
+ answerField: "uri";
254
257
  localQueryId?: string | undefined;
255
- query?: string | undefined;
258
+ queryId?: string | undefined;
259
+ }, {
260
+ displayFields?: {
261
+ label?: string | undefined;
262
+ labelTranslationKey?: string | undefined;
263
+ propertyName?: "displayName" | undefined;
264
+ }[] | undefined;
265
+ localQueryId?: string | undefined;
266
+ query?: "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}" | undefined;
267
+ responseField?: "affiliations.items" | undefined;
256
268
  variables?: {
257
- type: string;
258
- name: string;
269
+ type?: string | undefined;
259
270
  label?: string | undefined;
260
271
  labelTranslationKey?: string | undefined;
261
- minLength?: number | undefined;
262
- defaultValue?: string | undefined;
272
+ minLength?: 3 | undefined;
273
+ name?: "name" | undefined;
263
274
  }[] | undefined;
264
- }>;
265
- } & {
266
- type: z.ZodLiteral<"affiliationSearch">;
267
- meta: z.ZodObject<{
268
- schemaVersion: z.ZodLiteral<"1.0">;
269
- } & {
270
- title: z.ZodOptional<z.ZodLiteral<"Affiliation Search">>;
271
- usageDescription: z.ZodOptional<z.ZodLiteral<"For questions that require the user to select from a controlled list of institutions.">>;
272
- defaultJSON: z.ZodOptional<z.ZodLiteral<string>>;
273
- }, "strip", z.ZodTypeAny, {
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
- defaultJSON?: string | undefined;
278
- }, {
279
- schemaVersion: "1.0";
280
- title?: "Affiliation Search" | undefined;
281
- usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
282
- defaultJSON?: string | undefined;
283
- }>;
275
+ queryId?: string | undefined;
276
+ answerField?: "uri" | undefined;
277
+ }>>;
284
278
  }, "strip", z.ZodTypeAny, {
285
279
  type: "affiliationSearch";
280
+ attributes: {
281
+ label?: string | undefined;
282
+ help?: string | undefined;
283
+ labelTranslationKey?: string | undefined;
284
+ };
286
285
  meta: {
287
- schemaVersion: "1.0";
288
- title?: "Affiliation Search" | undefined;
289
- usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
290
- defaultJSON?: string | undefined;
286
+ schemaVersion: string;
287
+ title?: string | undefined;
288
+ usageDescription?: string | undefined;
291
289
  };
292
290
  graphQL: {
293
291
  displayFields: {
294
292
  label: string;
295
- propertyName: string;
293
+ propertyName: "displayName";
296
294
  labelTranslationKey?: string | undefined;
297
295
  }[];
298
- responseField: string;
299
- localQueryId?: string | undefined;
300
- query?: string | undefined;
301
- variables?: {
296
+ query: "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}";
297
+ responseField: "affiliations.items";
298
+ variables: {
302
299
  type: string;
303
- name: string;
304
- label?: string | undefined;
300
+ label: string;
301
+ minLength: 3;
302
+ name: "name";
305
303
  labelTranslationKey?: string | undefined;
306
- minLength?: number | undefined;
307
- defaultValue?: string | undefined;
308
- }[] | undefined;
304
+ }[];
305
+ answerField: "uri";
306
+ localQueryId?: string | undefined;
307
+ queryId?: string | undefined;
309
308
  };
309
+ }, {
310
+ type: "affiliationSearch";
310
311
  attributes?: {
311
312
  label?: string | undefined;
312
313
  help?: string | undefined;
313
314
  labelTranslationKey?: string | undefined;
314
315
  } | undefined;
315
- }, {
316
- type: "affiliationSearch";
317
- meta: {
318
- schemaVersion: "1.0";
319
- title?: "Affiliation Search" | undefined;
320
- usageDescription?: "For questions that require the user to select from a controlled list of institutions." | undefined;
321
- defaultJSON?: string | undefined;
322
- };
323
- graphQL: {
324
- displayFields: {
325
- label: string;
326
- propertyName: string;
316
+ meta?: {
317
+ schemaVersion?: string | undefined;
318
+ title?: string | undefined;
319
+ usageDescription?: string | undefined;
320
+ } | undefined;
321
+ graphQL?: {
322
+ displayFields?: {
323
+ label?: string | undefined;
327
324
  labelTranslationKey?: string | undefined;
328
- }[];
329
- responseField: string;
325
+ propertyName?: "displayName" | undefined;
326
+ }[] | undefined;
330
327
  localQueryId?: string | undefined;
331
- query?: string | undefined;
328
+ query?: "\nquery Affiliations($name: String!){\n affiliations(name: $name) {\n totalCount\n nextCursor\n items {\n id\n displayName\n uri\n }\n }\n}" | undefined;
329
+ responseField?: "affiliations.items" | undefined;
332
330
  variables?: {
333
- type: string;
334
- name: string;
331
+ type?: string | undefined;
335
332
  label?: string | undefined;
336
333
  labelTranslationKey?: string | undefined;
337
- minLength?: number | undefined;
338
- defaultValue?: string | undefined;
334
+ minLength?: 3 | undefined;
335
+ name?: "name" | undefined;
339
336
  }[] | undefined;
340
- };
341
- attributes?: {
342
- label?: string | undefined;
343
- help?: string | undefined;
344
- labelTranslationKey?: string | undefined;
337
+ queryId?: string | undefined;
338
+ answerField?: "uri" | undefined;
345
339
  } | undefined;
346
340
  }>;
347
341
  export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestionSchema>;
@@ -1,79 +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
  }));
49
- const defaultAffiliationSearchJSON = {
50
- type: 'affiliationSearch',
51
- attributes: Object.assign({}, question_1.defaultAttributes),
52
- meta: Object.assign({}, question_1.defaultMeta),
53
- graphQL: {
54
- query: "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}",
55
- queryId: "useAffiliationsQuery",
56
- variables: [{
57
- name: "term",
58
- type: "string",
59
- label: "Search for your institution",
60
- minLength: 3,
61
- labelTranslationKey: "SignupPage.institutionHelp"
62
- }],
63
- answerField: "uri",
64
- displayFields: [{
65
- label: "Institution",
66
- propertyName: "displayName",
67
- labelTranslationKey: "SignupPage.institution"
68
- }],
69
- responseField: "affiliations.items"
70
- },
71
- };
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
+ }`;
72
57
  exports.AffiliationSearchQuestionSchema = TypeaheadSearchQuestionSchema.merge(zod_1.z.object({
73
58
  type: zod_1.z.literal('affiliationSearch'),
74
- meta: BaseMeta.unwrap().merge(zod_1.z.object({
75
- title: zod_1.z.literal('Affiliation Search').optional(),
76
- usageDescription: zod_1.z.literal('For questions that require the user to select from a controlled list of institutions.').optional(),
77
- defaultJSON: zod_1.z.literal(JSON.stringify(defaultAffiliationSearchJSON)).optional(),
78
- }))
59
+ attributes: BaseAttributes.default({}),
60
+ graphQL: GraphQLQuery.merge(zod_1.z.object({
61
+ query: zod_1.z.literal(exports.affiliationQuery).default(exports.affiliationQuery),
62
+ queryId: zod_1.z.string().default('useAffiliationsQuery').optional(),
63
+ variables: zod_1.z.array(zod_1.z.object({
64
+ name: zod_1.z.literal("name").default('name'),
65
+ type: zod_1.z.string().default("string"),
66
+ label: zod_1.z.string().default("Search for your institution"),
67
+ minLength: zod_1.z.literal(3).default(3),
68
+ labelTranslationKey: zod_1.z.string().default("SignupPage.institutionHelp").optional(),
69
+ })).default([{}]),
70
+ answerField: zod_1.z.literal('uri').default('uri'),
71
+ displayFields: zod_1.z.array(zod_1.z.object({
72
+ propertyName: zod_1.z.literal("displayName").default('displayName'),
73
+ label: zod_1.z.string().default("Institution"),
74
+ labelTranslationKey: zod_1.z.string().default("SignupPage.institution").optional(),
75
+ })).default([{}]),
76
+ responseField: zod_1.z.literal("affiliations.items").default('affiliations.items'),
77
+ })).default({}),
79
78
  }));