@dmptool/types 1.2.6 → 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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/dist/answers/__tests__/defaults.spec.js +216 -0
  3. package/dist/answers/answer.d.ts +29 -14
  4. package/dist/answers/answer.js +11 -5
  5. package/dist/answers/dateAnswers.d.ts +20 -47
  6. package/dist/answers/dateAnswers.js +20 -10
  7. package/dist/answers/graphQLAnswers.d.ts +48 -120
  8. package/dist/answers/graphQLAnswers.js +46 -21
  9. package/dist/answers/index.d.ts +155 -1439
  10. package/dist/answers/index.js +26 -1
  11. package/dist/answers/numberAnswers.d.ts +38 -92
  12. package/dist/answers/numberAnswers.js +38 -19
  13. package/dist/answers/optionBasedAnswers.d.ts +42 -87
  14. package/dist/answers/optionBasedAnswers.js +37 -21
  15. package/dist/answers/tableAnswers.d.ts +348 -3032
  16. package/dist/answers/tableAnswers.js +25 -61
  17. package/dist/answers/textAnswers.d.ts +32 -68
  18. package/dist/answers/textAnswers.js +30 -17
  19. package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
  20. package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
  21. package/dist/questions/__tests__/defaults.spec.js +668 -0
  22. package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
  23. package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
  24. package/dist/questions/__tests__/textQuestions.spec.js +32 -0
  25. package/dist/questions/dateQuestions.d.ts +45 -191
  26. package/dist/questions/dateQuestions.js +26 -23
  27. package/dist/questions/graphQLQuestions.d.ts +262 -556
  28. package/dist/questions/graphQLQuestions.js +225 -223
  29. package/dist/questions/index.d.ts +689 -7440
  30. package/dist/questions/index.js +26 -1
  31. package/dist/questions/numberQuestions.d.ts +85 -331
  32. package/dist/questions/numberQuestions.js +50 -36
  33. package/dist/questions/optionBasedQuestions.d.ts +83 -290
  34. package/dist/questions/optionBasedQuestions.js +58 -41
  35. package/dist/questions/question.d.ts +72 -35
  36. package/dist/questions/question.js +14 -5
  37. package/dist/questions/tableQuestions.d.ts +1977 -9646
  38. package/dist/questions/tableQuestions.js +184 -192
  39. package/dist/questions/textQuestions.d.ts +70 -226
  40. package/dist/questions/textQuestions.js +31 -31
  41. package/package.json +4 -5
  42. package/dist/answers/__tests__/usage.spec.js +0 -178
  43. package/dist/questions/__tests__/usage.spec.d.ts +0 -8
  44. package/dist/questions/__tests__/usage.spec.js +0 -473
  45. package/dist/schemas/affiliationSearchAnswer.schema.json +0 -45
  46. package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
  47. package/dist/schemas/anyAnswer.schema.json +0 -605
  48. package/dist/schemas/anyQuestion.schema.json +0 -2455
  49. package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
  50. package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
  51. package/dist/schemas/booleanAnswer.schema.json +0 -34
  52. package/dist/schemas/booleanQuestion.schema.json +0 -56
  53. package/dist/schemas/checkboxesAnswer.schema.json +0 -39
  54. package/dist/schemas/checkboxesQuestion.schema.json +0 -76
  55. package/dist/schemas/currencyAnswer.schema.json +0 -34
  56. package/dist/schemas/currencyQuestion.schema.json +0 -67
  57. package/dist/schemas/dateAnswer.schema.json +0 -34
  58. package/dist/schemas/datePickerAnswer.schema.json +0 -37
  59. package/dist/schemas/datePickerQuestion.schema.json +0 -52
  60. package/dist/schemas/dateQuestion.schema.json +0 -62
  61. package/dist/schemas/dateRangeAnswer.schema.json +0 -45
  62. package/dist/schemas/dateRangeQuestion.schema.json +0 -112
  63. package/dist/schemas/emailAnswer.schema.json +0 -34
  64. package/dist/schemas/emailQuestion.schema.json +0 -66
  65. package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
  66. package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
  67. package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
  68. package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
  69. package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
  70. package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
  71. package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
  72. package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
  73. package/dist/schemas/numberAnswer.schema.json +0 -34
  74. package/dist/schemas/numberQuestion.schema.json +0 -63
  75. package/dist/schemas/numberRangeAnswer.schema.json +0 -45
  76. package/dist/schemas/numberRangeQuestion.schema.json +0 -94
  77. package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
  78. package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
  79. package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
  80. package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
  81. package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
  82. package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
  83. package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
  84. package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
  85. package/dist/schemas/selectBoxAnswer.schema.json +0 -34
  86. package/dist/schemas/selectBoxQuestion.schema.json +0 -85
  87. package/dist/schemas/tableAnswer.schema.json +0 -519
  88. package/dist/schemas/tableQuestion.schema.json +0 -1183
  89. package/dist/schemas/textAnswer.schema.json +0 -34
  90. package/dist/schemas/textAreaAnswer.schema.json +0 -34
  91. package/dist/schemas/textAreaQuestion.schema.json +0 -70
  92. package/dist/schemas/textQuestion.schema.json +0 -62
  93. package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
  94. package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
  95. package/dist/schemas/urlAnswer.schema.json +0 -34
  96. package/dist/schemas/urlQuestion.schema.json +0 -62
  97. /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.QuestionSchemaMap = exports.AnyQuestionSchema = void 0;
17
+ exports.AnyQuestionJSONSchema = exports.QuestionDefaultMap = exports.QuestionSchemaMap = exports.AnyQuestionSchema = void 0;
18
18
  const zod_1 = require("zod");
19
19
  const numberQuestions_1 = require("./numberQuestions");
20
20
  const textQuestions_1 = require("./textQuestions");
@@ -77,3 +77,28 @@ exports.QuestionSchemaMap = {
77
77
  url: textQuestions_1.URLQuestionSchema
78
78
  };
79
79
  ;
80
+ // Export a mapping between the Types and their corresponding default structures
81
+ exports.QuestionDefaultMap = {
82
+ affiliationSearch: graphQLQuestions_1.DefaultAffiliationSearchQuestion,
83
+ boolean: graphQLQuestions_1.DefaultAffiliationSearchQuestion,
84
+ checkBoxes: optionBasedQuestions_1.DefaultCheckboxesQuestion,
85
+ currency: numberQuestions_1.DefaultCurrencyQuestion,
86
+ date: dateQuestions_1.DefaultDateQuestion,
87
+ dateRange: dateQuestions_1.DefaultDateRangeQuestion,
88
+ email: textQuestions_1.DefaultEmailQuestion,
89
+ licenseSearch: graphQLQuestions_1.DefaultLicenseSearchQuestion,
90
+ metadataStandardSearch: graphQLQuestions_1.DefaultMetadataStandardSearchQuestion,
91
+ multiselectBox: optionBasedQuestions_1.DefaultMultiselectBoxQuestion,
92
+ number: numberQuestions_1.DefaultNumberQuestion,
93
+ numberRange: numberQuestions_1.DefaultNumberRangeQuestion,
94
+ numberWithContext: numberQuestions_1.DefaultNumberWithContextQuestion,
95
+ radioButtons: optionBasedQuestions_1.DefaultRadioButtonsQuestion,
96
+ repositorySearch: graphQLQuestions_1.DefaultRepositorySearchQuestion,
97
+ researchOutputTable: tableQuestions_1.DefaultResearchOutputTableQuestion,
98
+ selectBox: optionBasedQuestions_1.DefaultSelectBoxQuestion,
99
+ table: tableQuestions_1.DefaultResearchOutputTableQuestion,
100
+ text: textQuestions_1.DefaultTextQuestion,
101
+ textArea: textQuestions_1.DefaultTextAreaQuestion,
102
+ url: textQuestions_1.DefaultURLQuestion,
103
+ };
104
+ exports.AnyQuestionJSONSchema = zod_1.z.toJSONSchema(exports.AnyQuestionSchema);
@@ -1,263 +1,121 @@
1
1
  import { z } from "zod";
2
2
  export declare const CurrencyQuestionSchema: 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
- } & {
17
3
  type: z.ZodLiteral<"currency">;
18
- attributes: z.ZodDefault<z.ZodObject<{
19
- label: z.ZodOptional<z.ZodString>;
20
- help: z.ZodOptional<z.ZodString>;
21
- labelTranslationKey: z.ZodOptional<z.ZodString>;
22
- } & {
4
+ attributes: z.ZodObject<{
5
+ denomination: z.ZodDefault<z.ZodString>;
23
6
  max: z.ZodOptional<z.ZodNumber>;
24
7
  min: z.ZodDefault<z.ZodNumber>;
25
8
  step: z.ZodDefault<z.ZodNumber>;
26
- } & {
27
- denomination: z.ZodDefault<z.ZodString>;
28
- }, "strip", z.ZodTypeAny, {
29
- min: number;
30
- step: number;
31
- denomination: string;
32
- label?: string | undefined;
33
- help?: string | undefined;
34
- labelTranslationKey?: string | undefined;
35
- max?: number | undefined;
36
- }, {
37
- label?: string | undefined;
38
- help?: string | undefined;
39
- labelTranslationKey?: string | undefined;
40
- max?: number | undefined;
41
- min?: number | undefined;
42
- step?: number | undefined;
43
- denomination?: string | undefined;
44
- }>>;
45
- }, "strip", z.ZodTypeAny, {
9
+ label: z.ZodOptional<z.ZodString>;
10
+ help: z.ZodOptional<z.ZodString>;
11
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ meta: z.ZodObject<{
14
+ schemaVersion: z.ZodDefault<z.ZodString>;
15
+ title: z.ZodOptional<z.ZodString>;
16
+ usageDescription: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>;
19
+ export declare const DefaultCurrencyQuestion: {
46
20
  type: "currency";
47
21
  attributes: {
22
+ denomination: string;
48
23
  min: number;
49
24
  step: number;
50
- denomination: string;
25
+ max?: number | undefined;
51
26
  label?: string | undefined;
52
27
  help?: string | undefined;
53
28
  labelTranslationKey?: string | undefined;
54
- max?: number | undefined;
55
29
  };
56
30
  meta: {
57
31
  schemaVersion: string;
58
32
  title?: string | undefined;
59
33
  usageDescription?: string | undefined;
60
34
  };
61
- }, {
62
- type: "currency";
63
- attributes?: {
64
- label?: string | undefined;
65
- help?: string | undefined;
66
- labelTranslationKey?: string | undefined;
67
- max?: number | undefined;
68
- min?: number | undefined;
69
- step?: number | undefined;
70
- denomination?: string | undefined;
71
- } | undefined;
72
- meta?: {
73
- schemaVersion?: string | undefined;
74
- title?: string | undefined;
75
- usageDescription?: string | undefined;
76
- } | undefined;
77
- }>;
35
+ };
78
36
  export declare const NumberQuestionSchema: z.ZodObject<{
79
- meta: z.ZodDefault<z.ZodObject<{
80
- schemaVersion: z.ZodDefault<z.ZodString>;
81
- title: z.ZodOptional<z.ZodString>;
82
- usageDescription: z.ZodOptional<z.ZodString>;
83
- }, "strip", z.ZodTypeAny, {
84
- schemaVersion: string;
85
- title?: string | undefined;
86
- usageDescription?: string | undefined;
87
- }, {
88
- schemaVersion?: string | undefined;
89
- title?: string | undefined;
90
- usageDescription?: string | undefined;
91
- }>>;
92
- } & {
93
37
  type: z.ZodLiteral<"number">;
94
- attributes: z.ZodDefault<z.ZodObject<{
95
- label: z.ZodOptional<z.ZodString>;
96
- help: z.ZodOptional<z.ZodString>;
97
- labelTranslationKey: z.ZodOptional<z.ZodString>;
98
- } & {
38
+ attributes: z.ZodObject<{
99
39
  max: z.ZodOptional<z.ZodNumber>;
100
40
  min: z.ZodDefault<z.ZodNumber>;
101
41
  step: z.ZodDefault<z.ZodNumber>;
102
- }, "strip", z.ZodTypeAny, {
103
- min: number;
104
- step: number;
105
- label?: string | undefined;
106
- help?: string | undefined;
107
- labelTranslationKey?: string | undefined;
108
- max?: number | undefined;
109
- }, {
110
- label?: string | undefined;
111
- help?: string | undefined;
112
- labelTranslationKey?: string | undefined;
113
- max?: number | undefined;
114
- min?: number | undefined;
115
- step?: number | undefined;
116
- }>>;
117
- }, "strip", z.ZodTypeAny, {
42
+ label: z.ZodOptional<z.ZodString>;
43
+ help: z.ZodOptional<z.ZodString>;
44
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ meta: z.ZodObject<{
47
+ schemaVersion: z.ZodDefault<z.ZodString>;
48
+ title: z.ZodOptional<z.ZodString>;
49
+ usageDescription: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>;
52
+ export declare const DefaultNumberQuestion: {
118
53
  type: "number";
119
54
  attributes: {
120
55
  min: number;
121
56
  step: number;
57
+ max?: number | undefined;
122
58
  label?: string | undefined;
123
59
  help?: string | undefined;
124
60
  labelTranslationKey?: string | undefined;
125
- max?: number | undefined;
126
61
  };
127
62
  meta: {
128
63
  schemaVersion: string;
129
64
  title?: string | undefined;
130
65
  usageDescription?: string | undefined;
131
66
  };
132
- }, {
133
- type: "number";
134
- attributes?: {
135
- label?: string | undefined;
136
- help?: string | undefined;
137
- labelTranslationKey?: string | undefined;
138
- max?: number | undefined;
139
- min?: number | undefined;
140
- step?: number | undefined;
141
- } | undefined;
142
- meta?: {
143
- schemaVersion?: string | undefined;
144
- title?: string | undefined;
145
- usageDescription?: string | undefined;
146
- } | undefined;
147
- }>;
67
+ };
148
68
  export declare const NumberRangeQuestionSchema: z.ZodObject<{
149
- meta: z.ZodDefault<z.ZodObject<{
150
- schemaVersion: z.ZodDefault<z.ZodString>;
151
- title: z.ZodOptional<z.ZodString>;
152
- usageDescription: z.ZodOptional<z.ZodString>;
153
- }, "strip", z.ZodTypeAny, {
154
- schemaVersion: string;
155
- title?: string | undefined;
156
- usageDescription?: string | undefined;
157
- }, {
158
- schemaVersion?: string | undefined;
159
- title?: string | undefined;
160
- usageDescription?: string | undefined;
161
- }>>;
162
- } & {
163
69
  type: z.ZodLiteral<"numberRange">;
164
- attributes: z.ZodDefault<z.ZodObject<{
165
- label: z.ZodOptional<z.ZodString>;
166
- help: z.ZodOptional<z.ZodString>;
167
- labelTranslationKey: z.ZodOptional<z.ZodString>;
168
- }, "strip", z.ZodTypeAny, {
169
- label?: string | undefined;
170
- help?: string | undefined;
171
- labelTranslationKey?: string | undefined;
172
- }, {
173
- label?: string | undefined;
174
- help?: string | undefined;
175
- labelTranslationKey?: string | undefined;
176
- }>>;
177
- columns: z.ZodDefault<z.ZodObject<{
178
- start: z.ZodDefault<z.ZodObject<{
179
- label: z.ZodOptional<z.ZodString>;
180
- help: z.ZodOptional<z.ZodString>;
70
+ columns: z.ZodObject<{
71
+ start: z.ZodObject<{
72
+ label: z.ZodDefault<z.ZodString>;
181
73
  labelTranslationKey: z.ZodOptional<z.ZodString>;
182
- } & {
183
74
  max: z.ZodOptional<z.ZodNumber>;
184
75
  min: z.ZodDefault<z.ZodNumber>;
185
76
  step: z.ZodDefault<z.ZodNumber>;
186
- }, "strip", z.ZodTypeAny, {
187
- min: number;
188
- step: number;
189
- label?: string | undefined;
190
- help?: string | undefined;
191
- labelTranslationKey?: string | undefined;
192
- max?: number | undefined;
193
- }, {
194
- label?: string | undefined;
195
- help?: string | undefined;
196
- labelTranslationKey?: string | undefined;
197
- max?: number | undefined;
198
- min?: number | undefined;
199
- step?: number | undefined;
200
- }>>;
201
- end: z.ZodDefault<z.ZodObject<{
202
- label: z.ZodOptional<z.ZodString>;
203
77
  help: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ end: z.ZodObject<{
80
+ label: z.ZodDefault<z.ZodString>;
204
81
  labelTranslationKey: z.ZodOptional<z.ZodString>;
205
- } & {
206
82
  max: z.ZodOptional<z.ZodNumber>;
207
83
  min: z.ZodDefault<z.ZodNumber>;
208
84
  step: z.ZodDefault<z.ZodNumber>;
209
- }, "strip", z.ZodTypeAny, {
210
- min: number;
211
- step: number;
212
- label?: string | undefined;
213
- help?: string | undefined;
214
- labelTranslationKey?: string | undefined;
215
- max?: number | undefined;
216
- }, {
217
- label?: string | undefined;
218
- help?: string | undefined;
219
- labelTranslationKey?: string | undefined;
220
- max?: number | undefined;
221
- min?: number | undefined;
222
- step?: number | undefined;
223
- }>>;
224
- }, "strip", z.ZodTypeAny, {
85
+ help: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
88
+ attributes: z.ZodObject<{
89
+ label: z.ZodOptional<z.ZodString>;
90
+ help: z.ZodOptional<z.ZodString>;
91
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>;
93
+ meta: z.ZodObject<{
94
+ schemaVersion: z.ZodDefault<z.ZodString>;
95
+ title: z.ZodOptional<z.ZodString>;
96
+ usageDescription: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ }, z.core.$strip>;
99
+ export declare const DefaultNumberRangeQuestion: {
100
+ type: "numberRange";
101
+ columns: {
225
102
  start: {
103
+ label: string;
226
104
  min: number;
227
105
  step: number;
228
- label?: string | undefined;
229
- help?: string | undefined;
230
106
  labelTranslationKey?: string | undefined;
231
107
  max?: number | undefined;
108
+ help?: string | undefined;
232
109
  };
233
110
  end: {
111
+ label: string;
234
112
  min: number;
235
113
  step: number;
236
- label?: string | undefined;
237
- help?: string | undefined;
238
- labelTranslationKey?: string | undefined;
239
- max?: number | undefined;
240
- };
241
- }, {
242
- start?: {
243
- label?: string | undefined;
244
- help?: string | undefined;
245
114
  labelTranslationKey?: string | undefined;
246
115
  max?: number | undefined;
247
- min?: number | undefined;
248
- step?: number | undefined;
249
- } | undefined;
250
- end?: {
251
- label?: string | undefined;
252
116
  help?: string | undefined;
253
- labelTranslationKey?: string | undefined;
254
- max?: number | undefined;
255
- min?: number | undefined;
256
- step?: number | undefined;
257
- } | undefined;
258
- }>>;
259
- }, "strip", z.ZodTypeAny, {
260
- type: "numberRange";
117
+ };
118
+ };
261
119
  attributes: {
262
120
  label?: string | undefined;
263
121
  help?: string | undefined;
@@ -268,160 +126,56 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
268
126
  title?: string | undefined;
269
127
  usageDescription?: string | undefined;
270
128
  };
271
- columns: {
272
- start: {
273
- min: number;
274
- step: number;
275
- label?: string | undefined;
276
- help?: string | undefined;
277
- labelTranslationKey?: string | undefined;
278
- max?: number | undefined;
279
- };
280
- end: {
281
- min: number;
282
- step: number;
283
- label?: string | undefined;
284
- help?: string | undefined;
285
- labelTranslationKey?: string | undefined;
286
- max?: number | undefined;
287
- };
288
- };
289
- }, {
290
- type: "numberRange";
291
- attributes?: {
292
- label?: string | undefined;
293
- help?: string | undefined;
294
- labelTranslationKey?: string | undefined;
295
- } | undefined;
296
- meta?: {
297
- schemaVersion?: string | undefined;
298
- title?: string | undefined;
299
- usageDescription?: string | undefined;
300
- } | undefined;
301
- columns?: {
302
- start?: {
303
- label?: string | undefined;
304
- help?: string | undefined;
305
- labelTranslationKey?: string | undefined;
306
- max?: number | undefined;
307
- min?: number | undefined;
308
- step?: number | undefined;
309
- } | undefined;
310
- end?: {
311
- label?: string | undefined;
312
- help?: string | undefined;
313
- labelTranslationKey?: string | undefined;
314
- max?: number | undefined;
315
- min?: number | undefined;
316
- step?: number | undefined;
317
- } | undefined;
318
- } | undefined;
319
- }>;
129
+ };
320
130
  export declare const NumberWithContextQuestionSchema: z.ZodObject<{
321
- meta: z.ZodDefault<z.ZodObject<{
322
- schemaVersion: z.ZodDefault<z.ZodString>;
323
- title: z.ZodOptional<z.ZodString>;
324
- usageDescription: z.ZodOptional<z.ZodString>;
325
- }, "strip", z.ZodTypeAny, {
326
- schemaVersion: string;
327
- title?: string | undefined;
328
- usageDescription?: string | undefined;
329
- }, {
330
- schemaVersion?: string | undefined;
331
- title?: string | undefined;
332
- usageDescription?: string | undefined;
333
- }>>;
334
- } & {
335
131
  type: z.ZodLiteral<"numberWithContext">;
336
- attributes: z.ZodDefault<z.ZodObject<{
337
- label: z.ZodOptional<z.ZodString>;
338
- help: z.ZodOptional<z.ZodString>;
339
- labelTranslationKey: z.ZodOptional<z.ZodString>;
340
- } & {
341
- max: z.ZodOptional<z.ZodNumber>;
342
- min: z.ZodDefault<z.ZodNumber>;
343
- step: z.ZodDefault<z.ZodNumber>;
344
- } & {
345
- context: z.ZodDefault<z.ZodArray<z.ZodObject<{
132
+ attributes: z.ZodObject<{
133
+ context: z.ZodArray<z.ZodObject<{
346
134
  label: z.ZodDefault<z.ZodString>;
347
135
  labelTranslationKey: z.ZodOptional<z.ZodString>;
348
136
  value: z.ZodDefault<z.ZodString>;
349
- }, "strip", z.ZodTypeAny, {
350
- value: string;
351
- label: string;
352
- labelTranslationKey?: string | undefined;
353
- }, {
354
- value?: string | undefined;
355
- label?: string | undefined;
356
- labelTranslationKey?: string | undefined;
357
- }>, "many">>;
358
- }, "strip", z.ZodTypeAny, {
359
- context: {
360
- value: string;
361
- label: string;
362
- labelTranslationKey?: string | undefined;
363
- }[];
364
- min: number;
365
- step: number;
366
- label?: string | undefined;
367
- help?: string | undefined;
368
- labelTranslationKey?: string | undefined;
369
- max?: number | undefined;
370
- }, {
371
- label?: string | undefined;
372
- help?: string | undefined;
373
- labelTranslationKey?: string | undefined;
374
- context?: {
375
- value?: string | undefined;
376
- label?: string | undefined;
377
- labelTranslationKey?: string | undefined;
378
- }[] | undefined;
379
- max?: number | undefined;
380
- min?: number | undefined;
381
- step?: number | undefined;
382
- }>>;
383
- }, "strip", z.ZodTypeAny, {
137
+ selected: z.ZodDefault<z.ZodBoolean>;
138
+ }, z.core.$strip>>;
139
+ max: z.ZodOptional<z.ZodNumber>;
140
+ min: z.ZodDefault<z.ZodNumber>;
141
+ step: z.ZodDefault<z.ZodNumber>;
142
+ label: z.ZodOptional<z.ZodString>;
143
+ help: z.ZodOptional<z.ZodString>;
144
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>;
146
+ meta: z.ZodObject<{
147
+ schemaVersion: z.ZodDefault<z.ZodString>;
148
+ title: z.ZodOptional<z.ZodString>;
149
+ usageDescription: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strip>;
151
+ }, z.core.$strip>;
152
+ export declare const DefaultNumberWithContextQuestion: {
384
153
  type: "numberWithContext";
385
154
  attributes: {
386
155
  context: {
387
- value: string;
388
156
  label: string;
157
+ value: string;
158
+ selected: boolean;
389
159
  labelTranslationKey?: string | undefined;
390
160
  }[];
391
161
  min: number;
392
162
  step: number;
163
+ max?: number | undefined;
393
164
  label?: string | undefined;
394
165
  help?: string | undefined;
395
166
  labelTranslationKey?: string | undefined;
396
- max?: number | undefined;
397
167
  };
398
168
  meta: {
399
169
  schemaVersion: string;
400
170
  title?: string | undefined;
401
171
  usageDescription?: string | undefined;
402
172
  };
403
- }, {
404
- type: "numberWithContext";
405
- attributes?: {
406
- label?: string | undefined;
407
- help?: string | undefined;
408
- labelTranslationKey?: string | undefined;
409
- context?: {
410
- value?: string | undefined;
411
- label?: string | undefined;
412
- labelTranslationKey?: string | undefined;
413
- }[] | undefined;
414
- max?: number | undefined;
415
- min?: number | undefined;
416
- step?: number | undefined;
417
- } | undefined;
418
- meta?: {
419
- schemaVersion?: string | undefined;
420
- title?: string | undefined;
421
- usageDescription?: string | undefined;
422
- } | undefined;
423
- }>;
173
+ };
424
174
  export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
425
175
  export type NumberQuestionType = z.infer<typeof NumberQuestionSchema>;
426
176
  export type NumberRangeQuestionType = z.infer<typeof NumberRangeQuestionSchema>;
427
177
  export type NumberWithContextQuestionType = z.infer<typeof NumberWithContextQuestionSchema>;
178
+ export declare const CurrencyQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
179
+ export declare const NumberQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
180
+ export declare const NumberRangeQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
181
+ export declare const NumberWithContextQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
@@ -1,40 +1,54 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumberWithContextQuestionSchema = exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.CurrencyQuestionSchema = void 0;
3
+ exports.NumberWithContextQuestionJSONSchema = exports.NumberRangeQuestionJSONSchema = exports.NumberQuestionJSONSchema = exports.CurrencyQuestionJSONSchema = exports.DefaultNumberWithContextQuestion = exports.NumberWithContextQuestionSchema = exports.DefaultNumberRangeQuestion = exports.NumberRangeQuestionSchema = exports.DefaultNumberQuestion = exports.NumberQuestionSchema = exports.DefaultCurrencyQuestion = exports.CurrencyQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
- const BaseAttributes = question_1.QuestionSchema.shape.attributes;
7
- const NumberAttributesSchema = BaseAttributes.merge(zod_1.z.object({
8
- max: zod_1.z.number().optional(),
9
- min: zod_1.z.number().default(0),
10
- step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
11
- }));
12
- exports.CurrencyQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
13
- type: zod_1.z.literal('currency'),
14
- attributes: NumberAttributesSchema.merge(zod_1.z.object({
15
- denomination: zod_1.z.string().default('USD')
16
- })).default({})
17
- }));
18
- exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
19
- type: zod_1.z.literal('number'),
20
- attributes: NumberAttributesSchema.default({})
21
- }));
22
- exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
23
- type: zod_1.z.literal('numberRange'),
24
- attributes: BaseAttributes.default({}),
25
- columns: zod_1.z.object({
26
- start: NumberAttributesSchema.default({ label: 'From' }),
27
- end: NumberAttributesSchema.default({ label: 'To' }),
28
- }).default({})
29
- }));
30
- exports.NumberWithContextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
31
- type: zod_1.z.literal('numberWithContext'),
32
- attributes: NumberAttributesSchema.merge(zod_1.z.object({
33
- // Additional context or description for the number input (e.g. units, explanation, etc.)
34
- context: zod_1.z.array(zod_1.z.object({
35
- label: zod_1.z.string().default(''),
36
- labelTranslationKey: zod_1.z.string().optional(),
37
- value: zod_1.z.string().default('')
38
- })).default([])
39
- })).default({})
40
- }));
6
+ const NumberAttributesSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { max: zod_1.z.number().optional(), min: zod_1.z.number().default(0), step: zod_1.z.number().default(1) // For floats, use a decimal with the level of precision: 0.01
7
+ }));
8
+ const DefaultNumberAttributes = NumberAttributesSchema.parse({});
9
+ exports.CurrencyQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('currency'), attributes: zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), { denomination: zod_1.z.string().default('USD') })) }));
10
+ exports.DefaultCurrencyQuestion = exports.CurrencyQuestionSchema.parse({
11
+ type: 'currency',
12
+ attributes: DefaultNumberAttributes,
13
+ meta: question_1.DefaultMeta
14
+ });
15
+ exports.NumberQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('number'), attributes: NumberAttributesSchema }));
16
+ exports.DefaultNumberQuestion = exports.NumberQuestionSchema.parse({
17
+ type: 'number',
18
+ attributes: DefaultNumberAttributes,
19
+ meta: question_1.DefaultMeta
20
+ });
21
+ const NumberRangeStartColumnSchema = zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), { label: zod_1.z.string().default('From'), labelTranslationKey: zod_1.z.string().optional() }));
22
+ const NumberRangeEndColumnSchema = zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), { label: zod_1.z.string().default('To'), labelTranslationKey: zod_1.z.string().optional() }));
23
+ exports.NumberRangeQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('numberRange'), columns: zod_1.z.object({
24
+ start: NumberRangeStartColumnSchema,
25
+ end: NumberRangeEndColumnSchema
26
+ }) }));
27
+ exports.DefaultNumberRangeQuestion = exports.NumberRangeQuestionSchema.parse({
28
+ type: 'numberRange',
29
+ attributes: question_1.BaseAttributesSchema.parse({}),
30
+ meta: question_1.DefaultMeta,
31
+ columns: {
32
+ start: NumberRangeStartColumnSchema.parse({}),
33
+ end: NumberRangeEndColumnSchema.parse({})
34
+ }
35
+ });
36
+ const NumberWithContextAttributesSchema = zod_1.z.object(Object.assign(Object.assign({}, NumberAttributesSchema.shape), {
37
+ // Additional context or description for the number input (e.g. units, explanation, etc.)
38
+ context: zod_1.z.array(zod_1.z.object({
39
+ label: zod_1.z.string().default(''),
40
+ labelTranslationKey: zod_1.z.string().optional(),
41
+ value: zod_1.z.string().default(''),
42
+ selected: zod_1.z.boolean().default(false)
43
+ })) }));
44
+ const DefaultNumberWithContextAttributes = NumberWithContextAttributesSchema.parse(Object.assign(Object.assign({}, exports.DefaultNumberQuestion.attributes), { context: [] }));
45
+ exports.NumberWithContextQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('numberWithContext'), attributes: NumberWithContextAttributesSchema }));
46
+ exports.DefaultNumberWithContextQuestion = exports.NumberWithContextQuestionSchema.parse({
47
+ type: 'numberWithContext',
48
+ attributes: DefaultNumberWithContextAttributes,
49
+ meta: question_1.DefaultMeta
50
+ });
51
+ exports.CurrencyQuestionJSONSchema = zod_1.z.toJSONSchema(exports.CurrencyQuestionSchema);
52
+ exports.NumberQuestionJSONSchema = zod_1.z.toJSONSchema(exports.NumberQuestionSchema);
53
+ exports.NumberRangeQuestionJSONSchema = zod_1.z.toJSONSchema(exports.NumberRangeQuestionSchema);
54
+ exports.NumberWithContextQuestionJSONSchema = zod_1.z.toJSONSchema(exports.NumberWithContextQuestionSchema);