@dmptool/types 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -29
- package/dist/answers/__tests__/answers.spec.d.ts +1 -0
- package/dist/answers/__tests__/answers.spec.js +127 -0
- package/dist/answers/answer.d.ts +25 -0
- package/dist/answers/answer.js +13 -0
- package/dist/answers/dateAnswers.d.ts +66 -0
- package/dist/answers/dateAnswers.js +16 -0
- package/dist/answers/graphQLAnswers.d.ts +51 -0
- package/dist/answers/graphQLAnswers.js +14 -0
- package/dist/answers/index.d.ts +880 -0
- package/dist/answers/index.js +48 -0
- package/dist/answers/optionBasedAnswers.d.ts +76 -0
- package/dist/answers/optionBasedAnswers.js +18 -0
- package/dist/answers/primitiveAnswers.d.ts +176 -0
- package/dist/answers/primitiveAnswers.js +34 -0
- package/dist/answers/tableAnswers.d.ts +876 -0
- package/dist/answers/tableAnswers.js +31 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -0
- package/dist/questions/__tests__/dateQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/dateQuestions.spec.js +149 -0
- package/dist/questions/__tests__/graphQLQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/graphQLQuestions.spec.js +87 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +152 -0
- package/dist/questions/__tests__/primitiveQuestions.spec.d.ts +1 -0
- package/dist/questions/__tests__/primitiveQuestions.spec.js +189 -0
- package/dist/{dateQuestions.js → questions/dateQuestions.js} +3 -3
- package/dist/{graphQLQuestions.js → questions/graphQLQuestions.js} +3 -3
- package/dist/{tableQuestions.d.ts → questions/index.d.ts} +97 -1650
- package/dist/questions/index.js +48 -0
- package/dist/{optionBasedQuestions.js → questions/optionBasedQuestions.js} +4 -4
- package/dist/{primitiveQuestions.d.ts → questions/primitiveQuestions.d.ts} +0 -27
- package/dist/{primitiveQuestions.js → questions/primitiveQuestions.js} +8 -35
- package/dist/questions/question.d.ts +29 -0
- package/dist/questions/question.js +32 -0
- package/dist/questions/tableQuestions.d.ts +2638 -0
- package/dist/{tableQuestions.js → questions/tableQuestions.js} +5 -22
- package/dist/schemas/anyAnswer.schema.json +195 -59
- package/dist/schemas/anyTableColumnAnswer.schema.json +336 -0
- package/dist/schemas/anyTableColumnQuestion.schema.json +637 -0
- package/dist/schemas/booleanAnswer.schema.json +15 -1
- package/dist/schemas/checkboxesAnswer.schema.json +15 -1
- package/dist/schemas/currencyAnswer.schema.json +15 -1
- package/dist/schemas/datePickerAnswer.schema.json +15 -1
- package/dist/schemas/dateRangeAnswer.schema.json +15 -1
- package/dist/schemas/emailAnswer.schema.json +15 -1
- package/dist/schemas/filteredSearchAnswer.schema.json +15 -1
- package/dist/schemas/numberAnswer.schema.json +15 -1
- package/dist/schemas/radioButtonsAnswer.schema.json +15 -1
- package/dist/schemas/selectBoxAnswer.schema.json +19 -2
- package/dist/schemas/tableAnswer.schema.json +91 -18
- package/dist/schemas/textAnswer.schema.json +15 -1
- package/dist/schemas/textAreaAnswer.schema.json +15 -1
- package/dist/schemas/typeaheadSearchAnswer.schema.json +15 -1
- package/dist/schemas/urlAnswer.schema.json +15 -1
- package/package.json +8 -1
- package/dist/answers.d.ts +0 -558
- package/dist/answers.js +0 -87
- /package/dist/{dateQuestions.d.ts → questions/dateQuestions.d.ts} +0 -0
- /package/dist/{graphQLQuestions.d.ts → questions/graphQLQuestions.d.ts} +0 -0
- /package/dist/{optionBasedQuestions.d.ts → questions/optionBasedQuestions.d.ts} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TableQuestion = exports.AnyTableColumnQuestion = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const primitiveQuestions_1 = require("./primitiveQuestions");
|
|
6
6
|
const dateQuestions_1 = require("./dateQuestions");
|
|
7
7
|
const optionBasedQuestions_1 = require("./optionBasedQuestions");
|
|
8
8
|
const graphQLQuestions_1 = require("./graphQLQuestions");
|
|
9
|
+
const question_1 = require("./question");
|
|
9
10
|
// Union types for all questions and answers (tables cannot be nested so no TableQuestion here!)
|
|
10
|
-
|
|
11
|
+
exports.AnyTableColumnQuestion = zod_1.z.discriminatedUnion('type', [
|
|
11
12
|
primitiveQuestions_1.BooleanQuestion,
|
|
12
13
|
optionBasedQuestions_1.CheckboxesQuestion,
|
|
13
14
|
primitiveQuestions_1.CurrencyQuestion,
|
|
@@ -24,9 +25,9 @@ const ColumnQuestions = zod_1.z.discriminatedUnion('type', [
|
|
|
24
25
|
primitiveQuestions_1.URLQuestion
|
|
25
26
|
]);
|
|
26
27
|
// Table question and answer
|
|
27
|
-
exports.TableQuestion =
|
|
28
|
+
exports.TableQuestion = question_1.Question.merge(zod_1.z.object({
|
|
28
29
|
type: zod_1.z.literal('table'), // The type of question
|
|
29
|
-
columns: zod_1.z.array(
|
|
30
|
+
columns: zod_1.z.array(exports.AnyTableColumnQuestion), // The columns of the table (note: tables cannot be nested)
|
|
30
31
|
attributes: zod_1.z.object({
|
|
31
32
|
canAddRows: zod_1.z.boolean().optional(), // Whether to allow adding rows (default is true)
|
|
32
33
|
canRemoveRows: zod_1.z.boolean().optional(), // Whether to allow removing rows (default is true)
|
|
@@ -35,21 +36,3 @@ exports.TableQuestion = primitiveQuestions_1.Question.merge(zod_1.z.object({
|
|
|
35
36
|
minRows: zod_1.z.number().optional() // The minimum number of rows (no default)
|
|
36
37
|
})
|
|
37
38
|
}));
|
|
38
|
-
// All of the possible questions
|
|
39
|
-
exports.AnyQuestion = zod_1.z.discriminatedUnion('type', [
|
|
40
|
-
primitiveQuestions_1.BooleanQuestion,
|
|
41
|
-
optionBasedQuestions_1.CheckboxesQuestion,
|
|
42
|
-
primitiveQuestions_1.CurrencyQuestion,
|
|
43
|
-
dateQuestions_1.DatePickerQuestion,
|
|
44
|
-
dateQuestions_1.DateRangeQuestion,
|
|
45
|
-
primitiveQuestions_1.EmailQuestion,
|
|
46
|
-
graphQLQuestions_1.FilteredSearchQuestion,
|
|
47
|
-
primitiveQuestions_1.NumberQuestion,
|
|
48
|
-
optionBasedQuestions_1.RadioButtonsQuestion,
|
|
49
|
-
optionBasedQuestions_1.SelectBoxQuestion,
|
|
50
|
-
exports.TableQuestion,
|
|
51
|
-
primitiveQuestions_1.TextAreaQuestion,
|
|
52
|
-
primitiveQuestions_1.TextQuestion,
|
|
53
|
-
graphQLQuestions_1.TypeaheadSearchQuestion,
|
|
54
|
-
primitiveQuestions_1.URLQuestion
|
|
55
|
-
]);
|
|
@@ -12,11 +12,25 @@
|
|
|
12
12
|
},
|
|
13
13
|
"answer": {
|
|
14
14
|
"type": "boolean"
|
|
15
|
+
},
|
|
16
|
+
"meta": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {
|
|
19
|
+
"schemaVersion": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"const": "1.0"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"schemaVersion"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false
|
|
15
28
|
}
|
|
16
29
|
},
|
|
17
30
|
"required": [
|
|
18
31
|
"type",
|
|
19
|
-
"answer"
|
|
32
|
+
"answer",
|
|
33
|
+
"meta"
|
|
20
34
|
],
|
|
21
35
|
"additionalProperties": false
|
|
22
36
|
},
|
|
@@ -32,11 +46,15 @@
|
|
|
32
46
|
"items": {
|
|
33
47
|
"type": "string"
|
|
34
48
|
}
|
|
49
|
+
},
|
|
50
|
+
"meta": {
|
|
51
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
35
52
|
}
|
|
36
53
|
},
|
|
37
54
|
"required": [
|
|
38
55
|
"type",
|
|
39
|
-
"answer"
|
|
56
|
+
"answer",
|
|
57
|
+
"meta"
|
|
40
58
|
],
|
|
41
59
|
"additionalProperties": false
|
|
42
60
|
},
|
|
@@ -49,11 +67,15 @@
|
|
|
49
67
|
},
|
|
50
68
|
"answer": {
|
|
51
69
|
"type": "number"
|
|
70
|
+
},
|
|
71
|
+
"meta": {
|
|
72
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
52
73
|
}
|
|
53
74
|
},
|
|
54
75
|
"required": [
|
|
55
76
|
"type",
|
|
56
|
-
"answer"
|
|
77
|
+
"answer",
|
|
78
|
+
"meta"
|
|
57
79
|
],
|
|
58
80
|
"additionalProperties": false
|
|
59
81
|
},
|
|
@@ -66,11 +88,15 @@
|
|
|
66
88
|
},
|
|
67
89
|
"answer": {
|
|
68
90
|
"type": "string"
|
|
91
|
+
},
|
|
92
|
+
"meta": {
|
|
93
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
69
94
|
}
|
|
70
95
|
},
|
|
71
96
|
"required": [
|
|
72
97
|
"type",
|
|
73
|
-
"answer"
|
|
98
|
+
"answer",
|
|
99
|
+
"meta"
|
|
74
100
|
],
|
|
75
101
|
"additionalProperties": false
|
|
76
102
|
},
|
|
@@ -96,11 +122,15 @@
|
|
|
96
122
|
"end"
|
|
97
123
|
],
|
|
98
124
|
"additionalProperties": false
|
|
125
|
+
},
|
|
126
|
+
"meta": {
|
|
127
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
99
128
|
}
|
|
100
129
|
},
|
|
101
130
|
"required": [
|
|
102
131
|
"type",
|
|
103
|
-
"answer"
|
|
132
|
+
"answer",
|
|
133
|
+
"meta"
|
|
104
134
|
],
|
|
105
135
|
"additionalProperties": false
|
|
106
136
|
},
|
|
@@ -113,11 +143,15 @@
|
|
|
113
143
|
},
|
|
114
144
|
"answer": {
|
|
115
145
|
"type": "string"
|
|
146
|
+
},
|
|
147
|
+
"meta": {
|
|
148
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
116
149
|
}
|
|
117
150
|
},
|
|
118
151
|
"required": [
|
|
119
152
|
"type",
|
|
120
|
-
"answer"
|
|
153
|
+
"answer",
|
|
154
|
+
"meta"
|
|
121
155
|
],
|
|
122
156
|
"additionalProperties": false
|
|
123
157
|
},
|
|
@@ -133,11 +167,15 @@
|
|
|
133
167
|
"items": {
|
|
134
168
|
"type": "string"
|
|
135
169
|
}
|
|
170
|
+
},
|
|
171
|
+
"meta": {
|
|
172
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
136
173
|
}
|
|
137
174
|
},
|
|
138
175
|
"required": [
|
|
139
176
|
"type",
|
|
140
|
-
"answer"
|
|
177
|
+
"answer",
|
|
178
|
+
"meta"
|
|
141
179
|
],
|
|
142
180
|
"additionalProperties": false
|
|
143
181
|
},
|
|
@@ -150,11 +188,15 @@
|
|
|
150
188
|
},
|
|
151
189
|
"answer": {
|
|
152
190
|
"type": "number"
|
|
191
|
+
},
|
|
192
|
+
"meta": {
|
|
193
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
153
194
|
}
|
|
154
195
|
},
|
|
155
196
|
"required": [
|
|
156
197
|
"type",
|
|
157
|
-
"answer"
|
|
198
|
+
"answer",
|
|
199
|
+
"meta"
|
|
158
200
|
],
|
|
159
201
|
"additionalProperties": false
|
|
160
202
|
},
|
|
@@ -167,11 +209,15 @@
|
|
|
167
209
|
},
|
|
168
210
|
"answer": {
|
|
169
211
|
"type": "string"
|
|
212
|
+
},
|
|
213
|
+
"meta": {
|
|
214
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
170
215
|
}
|
|
171
216
|
},
|
|
172
217
|
"required": [
|
|
173
218
|
"type",
|
|
174
|
-
"answer"
|
|
219
|
+
"answer",
|
|
220
|
+
"meta"
|
|
175
221
|
],
|
|
176
222
|
"additionalProperties": false
|
|
177
223
|
},
|
|
@@ -183,12 +229,19 @@
|
|
|
183
229
|
"const": "selectBox"
|
|
184
230
|
},
|
|
185
231
|
"answer": {
|
|
186
|
-
"type": "
|
|
232
|
+
"type": "array",
|
|
233
|
+
"items": {
|
|
234
|
+
"type": "string"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"meta": {
|
|
238
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
187
239
|
}
|
|
188
240
|
},
|
|
189
241
|
"required": [
|
|
190
242
|
"type",
|
|
191
|
-
"answer"
|
|
243
|
+
"answer",
|
|
244
|
+
"meta"
|
|
192
245
|
],
|
|
193
246
|
"additionalProperties": false
|
|
194
247
|
},
|
|
@@ -197,68 +250,151 @@
|
|
|
197
250
|
"properties": {
|
|
198
251
|
"type": {
|
|
199
252
|
"type": "string",
|
|
200
|
-
"const": "
|
|
253
|
+
"const": "table"
|
|
201
254
|
},
|
|
202
255
|
"answer": {
|
|
203
|
-
"type": "
|
|
256
|
+
"type": "array",
|
|
257
|
+
"items": {
|
|
258
|
+
"anyOf": [
|
|
259
|
+
{
|
|
260
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/1"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/2"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/3"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/4"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/5"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/6"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/7"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/8"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/9"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"type": "object",
|
|
291
|
+
"properties": {
|
|
292
|
+
"type": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"const": "text"
|
|
295
|
+
},
|
|
296
|
+
"answer": {
|
|
297
|
+
"type": "string"
|
|
298
|
+
},
|
|
299
|
+
"meta": {
|
|
300
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"required": [
|
|
304
|
+
"type",
|
|
305
|
+
"answer",
|
|
306
|
+
"meta"
|
|
307
|
+
],
|
|
308
|
+
"additionalProperties": false
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"type": "object",
|
|
312
|
+
"properties": {
|
|
313
|
+
"type": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"const": "textArea"
|
|
316
|
+
},
|
|
317
|
+
"answer": {
|
|
318
|
+
"type": "string"
|
|
319
|
+
},
|
|
320
|
+
"meta": {
|
|
321
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": [
|
|
325
|
+
"type",
|
|
326
|
+
"answer",
|
|
327
|
+
"meta"
|
|
328
|
+
],
|
|
329
|
+
"additionalProperties": false
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"type": "object",
|
|
333
|
+
"properties": {
|
|
334
|
+
"type": {
|
|
335
|
+
"type": "string",
|
|
336
|
+
"const": "typeaheadSearch"
|
|
337
|
+
},
|
|
338
|
+
"answer": {
|
|
339
|
+
"type": "string"
|
|
340
|
+
},
|
|
341
|
+
"meta": {
|
|
342
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"required": [
|
|
346
|
+
"type",
|
|
347
|
+
"answer",
|
|
348
|
+
"meta"
|
|
349
|
+
],
|
|
350
|
+
"additionalProperties": false
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"type": "object",
|
|
354
|
+
"properties": {
|
|
355
|
+
"type": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"const": "url"
|
|
358
|
+
},
|
|
359
|
+
"answer": {
|
|
360
|
+
"type": "string"
|
|
361
|
+
},
|
|
362
|
+
"meta": {
|
|
363
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"required": [
|
|
367
|
+
"type",
|
|
368
|
+
"answer",
|
|
369
|
+
"meta"
|
|
370
|
+
],
|
|
371
|
+
"additionalProperties": false
|
|
372
|
+
}
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"meta": {
|
|
377
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/0/properties/meta"
|
|
204
378
|
}
|
|
205
379
|
},
|
|
206
380
|
"required": [
|
|
207
381
|
"type",
|
|
208
|
-
"answer"
|
|
382
|
+
"answer",
|
|
383
|
+
"meta"
|
|
209
384
|
],
|
|
210
385
|
"additionalProperties": false
|
|
211
386
|
},
|
|
212
387
|
{
|
|
213
|
-
"
|
|
214
|
-
"properties": {
|
|
215
|
-
"type": {
|
|
216
|
-
"type": "string",
|
|
217
|
-
"const": "text"
|
|
218
|
-
},
|
|
219
|
-
"answer": {
|
|
220
|
-
"type": "string"
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
"required": [
|
|
224
|
-
"type",
|
|
225
|
-
"answer"
|
|
226
|
-
],
|
|
227
|
-
"additionalProperties": false
|
|
388
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/anyOf/10"
|
|
228
389
|
},
|
|
229
390
|
{
|
|
230
|
-
"
|
|
231
|
-
"properties": {
|
|
232
|
-
"type": {
|
|
233
|
-
"type": "string",
|
|
234
|
-
"const": "typeaheadSearch"
|
|
235
|
-
},
|
|
236
|
-
"answer": {
|
|
237
|
-
"type": "string"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
"required": [
|
|
241
|
-
"type",
|
|
242
|
-
"answer"
|
|
243
|
-
],
|
|
244
|
-
"additionalProperties": false
|
|
391
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/anyOf/11"
|
|
245
392
|
},
|
|
246
393
|
{
|
|
247
|
-
"
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
"const": "url"
|
|
252
|
-
},
|
|
253
|
-
"answer": {
|
|
254
|
-
"type": "string"
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
"required": [
|
|
258
|
-
"type",
|
|
259
|
-
"answer"
|
|
260
|
-
],
|
|
261
|
-
"additionalProperties": false
|
|
394
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/anyOf/12"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"$ref": "#/definitions/AnyAnswer/anyOf/10/properties/answer/items/anyOf/13"
|
|
262
398
|
}
|
|
263
399
|
]
|
|
264
400
|
}
|