@dmptool/types 1.1.1 → 1.1.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/dist/answers/__tests__/answers.spec.js +11 -5
- package/dist/answers/answer.d.ts +3 -3
- package/dist/answers/graphQLAnswers.d.ts +2 -2
- package/dist/answers/graphQLAnswers.js +2 -2
- package/dist/answers/index.d.ts +92 -55
- package/dist/answers/index.js +2 -2
- package/dist/answers/optionBasedAnswers.d.ts +27 -2
- package/dist/answers/optionBasedAnswers.js +5 -1
- package/dist/answers/tableAnswers.d.ts +268 -104
- package/dist/answers/tableAnswers.js +2 -1
- package/dist/questions/__tests__/graphQLQuestions.spec.js +7 -7
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +48 -1
- package/dist/questions/dateQuestions.d.ts +47 -16
- package/dist/questions/dateQuestions.js +25 -1
- package/dist/questions/graphQLQuestions.d.ts +59 -28
- package/dist/questions/graphQLQuestions.js +40 -3
- package/dist/questions/index.d.ts +1363 -646
- package/dist/questions/index.js +4 -2
- package/dist/questions/numberQuestions.d.ts +71 -25
- package/dist/questions/numberQuestions.js +36 -1
- package/dist/questions/optionBasedQuestions.d.ts +197 -44
- package/dist/questions/optionBasedQuestions.js +84 -6
- package/dist/questions/question.d.ts +51 -4
- package/dist/questions/question.js +14 -2
- package/dist/questions/tableQuestions.d.ts +1841 -932
- package/dist/questions/tableQuestions.js +13 -1
- package/dist/questions/textQuestions.d.ts +100 -40
- package/dist/questions/textQuestions.js +45 -7
- package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
- package/dist/schemas/affiliationSearchQuestion.schema.json +133 -0
- package/dist/schemas/anyAnswer.schema.json +41 -23
- package/dist/schemas/anyQuestion.schema.json +533 -149
- package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
- package/dist/schemas/anyTableColumnQuestion.schema.json +397 -119
- package/dist/schemas/booleanQuestion.schema.json +13 -2
- package/dist/schemas/checkboxesQuestion.schema.json +12 -0
- package/dist/schemas/currencyQuestion.schema.json +12 -0
- package/dist/schemas/dateQuestion.schema.json +12 -0
- package/dist/schemas/dateRangeQuestion.schema.json +12 -0
- package/dist/schemas/emailQuestion.schema.json +12 -0
- package/dist/schemas/filteredSearchQuestion.schema.json +10 -0
- package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
- package/dist/schemas/multiselectBoxQuestion.schema.json +90 -0
- package/dist/schemas/numberQuestion.schema.json +12 -0
- package/dist/schemas/numberRangeQuestion.schema.json +12 -0
- package/dist/schemas/radioButtonsQuestion.schema.json +12 -0
- package/dist/schemas/selectBoxAnswer.schema.json +1 -4
- package/dist/schemas/selectBoxQuestion.schema.json +18 -1
- package/dist/schemas/tableAnswer.schema.json +35 -14
- package/dist/schemas/tableQuestion.schema.json +419 -120
- package/dist/schemas/textAreaQuestion.schema.json +15 -4
- package/dist/schemas/textQuestion.schema.json +12 -0
- package/dist/schemas/urlQuestion.schema.json +12 -0
- package/package.json +1 -1
|
@@ -87,11 +87,17 @@ const questions_1 = require("../../questions");
|
|
|
87
87
|
(0, globals_1.expect)(() => optionBasedAnswers_1.RadioButtonsAnswerSchema.parse(invalidData)).toThrow();
|
|
88
88
|
});
|
|
89
89
|
(0, globals_1.it)('should validate SelectBoxAnswer', () => {
|
|
90
|
-
const validData = { type: 'selectBox', answer:
|
|
90
|
+
const validData = { type: 'selectBox', answer: 'option1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
91
91
|
(0, globals_1.expect)(() => optionBasedAnswers_1.SelectBoxAnswerSchema.parse(validData)).not.toThrow();
|
|
92
|
-
const invalidData = { type: 'selectBox', answer: 'option1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
92
|
+
const invalidData = { type: 'selectBox', answer: ['option1'], meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
93
93
|
(0, globals_1.expect)(() => optionBasedAnswers_1.SelectBoxAnswerSchema.parse(invalidData)).toThrow();
|
|
94
94
|
});
|
|
95
|
+
(0, globals_1.it)('should validate MultiselectBoxAnswer', () => {
|
|
96
|
+
const validData = { type: 'multiselectBox', answer: ['option1'], meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
97
|
+
(0, globals_1.expect)(() => optionBasedAnswers_1.MultiselectBoxAnswerSchema.parse(validData)).not.toThrow();
|
|
98
|
+
const invalidData = { type: 'multiselectBox', answer: 'option1', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
99
|
+
(0, globals_1.expect)(() => optionBasedAnswers_1.MultiselectBoxAnswerSchema.parse(invalidData)).toThrow();
|
|
100
|
+
});
|
|
95
101
|
(0, globals_1.it)('should validate TextAnswer', () => {
|
|
96
102
|
const validData = { type: 'text', answer: 'Some text', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
97
103
|
(0, globals_1.expect)(() => textAnswers_1.TextAnswerSchema.parse(validData)).not.toThrow();
|
|
@@ -104,11 +110,11 @@ const questions_1 = require("../../questions");
|
|
|
104
110
|
const invalidData = { type: 'textArea', answer: 12345, meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
105
111
|
(0, globals_1.expect)(() => textAnswers_1.TextAreaAnswerSchema.parse(invalidData)).toThrow();
|
|
106
112
|
});
|
|
107
|
-
(0, globals_1.it)('should validate
|
|
113
|
+
(0, globals_1.it)('should validate AffiliationSearchAnswer', () => {
|
|
108
114
|
const validData = { type: 'typeaheadSearch', answer: 'Search term', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
109
|
-
(0, globals_1.expect)(() => graphQLAnswers_1.
|
|
115
|
+
(0, globals_1.expect)(() => graphQLAnswers_1.AffiliationSearchAnswerSchema.parse(validData)).not.toThrow();
|
|
110
116
|
const invalidData = { type: 'typeaheadSearch', answer: 12345, meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
|
111
|
-
(0, globals_1.expect)(() =>
|
|
117
|
+
(0, globals_1.expect)(() => questions_1.AffiliationSearchQuestionSchema.parse(invalidData)).toThrow();
|
|
112
118
|
});
|
|
113
119
|
(0, globals_1.it)('should validate URLAnswer', () => {
|
|
114
120
|
const validData = { type: 'url', answer: 'https://example.com', meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
|
package/dist/answers/answer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const AnswerSchema: z.ZodObject<{
|
|
3
|
-
type: z.ZodEnum<["boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "
|
|
3
|
+
type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "filteredSearch", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
|
|
4
4
|
answer: z.ZodString;
|
|
5
5
|
meta: z.ZodObject<{
|
|
6
6
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
@@ -10,13 +10,13 @@ export declare const AnswerSchema: z.ZodObject<{
|
|
|
10
10
|
schemaVersion: "1.0";
|
|
11
11
|
}>;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "
|
|
13
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
14
14
|
meta: {
|
|
15
15
|
schemaVersion: "1.0";
|
|
16
16
|
};
|
|
17
17
|
answer: string;
|
|
18
18
|
}, {
|
|
19
|
-
type: "number" | "boolean" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "
|
|
19
|
+
type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "filteredSearch" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
|
|
20
20
|
meta: {
|
|
21
21
|
schemaVersion: "1.0";
|
|
22
22
|
};
|
|
@@ -23,7 +23,7 @@ export declare const FilteredSearchAnswerSchema: z.ZodObject<{
|
|
|
23
23
|
};
|
|
24
24
|
answer: string[];
|
|
25
25
|
}>;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const AffiliationSearchAnswerSchema: z.ZodObject<{
|
|
27
27
|
meta: z.ZodObject<{
|
|
28
28
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
29
29
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -48,4 +48,4 @@ export declare const TypeaheadSearchAnswerSchema: z.ZodObject<{
|
|
|
48
48
|
answer: string;
|
|
49
49
|
}>;
|
|
50
50
|
export type FilteredSearchAnswerType = z.infer<typeof FilteredSearchAnswerSchema>;
|
|
51
|
-
export type
|
|
51
|
+
export type AffiliationSearchAnswerType = z.infer<typeof AffiliationSearchAnswerSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AffiliationSearchAnswerSchema = exports.FilteredSearchAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
6
|
// Answers to GraphQL Question Types
|
|
@@ -8,7 +8,7 @@ exports.FilteredSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object(
|
|
|
8
8
|
type: zod_1.z.literal('filteredSearch'), // The type of answer
|
|
9
9
|
answer: zod_1.z.array(zod_1.z.string()) // The answer to the filtered search (array of strings)
|
|
10
10
|
}));
|
|
11
|
-
exports.
|
|
11
|
+
exports.AffiliationSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
12
12
|
type: zod_1.z.literal('typeaheadSearch'), // The type of answer
|
|
13
13
|
answer: zod_1.z.string() // The answer to the typeahead search (string)
|
|
14
14
|
}));
|
package/dist/answers/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { DateAnswerType, DateRangeAnswerType } from './dateAnswers';
|
|
3
|
-
import { FilteredSearchAnswerType,
|
|
4
|
-
import { BooleanAnswerType, CheckboxesAnswerType, RadioButtonsAnswerType, SelectBoxAnswerType } from './optionBasedAnswers';
|
|
3
|
+
import { FilteredSearchAnswerType, AffiliationSearchAnswerType } from './graphQLAnswers';
|
|
4
|
+
import { BooleanAnswerType, CheckboxesAnswerType, RadioButtonsAnswerType, SelectBoxAnswerType, MultiselectBoxAnswerType } from './optionBasedAnswers';
|
|
5
5
|
import { CurrencyAnswerType, NumberAnswerType, NumberRangeAnswerType } from './numberAnswers';
|
|
6
6
|
import { TableAnswerType } from './tableAnswers';
|
|
7
7
|
import { EmailAnswerType, TextAnswerType, TextAreaAnswerType, URLAnswerType } from './textAnswers';
|
|
@@ -245,19 +245,19 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
245
245
|
}>;
|
|
246
246
|
} & {
|
|
247
247
|
type: z.ZodLiteral<"selectBox">;
|
|
248
|
-
answer: z.
|
|
248
|
+
answer: z.ZodString;
|
|
249
249
|
}, "strip", z.ZodTypeAny, {
|
|
250
250
|
type: "selectBox";
|
|
251
251
|
meta: {
|
|
252
252
|
schemaVersion: "1.0";
|
|
253
253
|
};
|
|
254
|
-
answer: string
|
|
254
|
+
answer: string;
|
|
255
255
|
}, {
|
|
256
256
|
type: "selectBox";
|
|
257
257
|
meta: {
|
|
258
258
|
schemaVersion: "1.0";
|
|
259
259
|
};
|
|
260
|
-
answer: string
|
|
260
|
+
answer: string;
|
|
261
261
|
}>, z.ZodObject<{
|
|
262
262
|
meta: z.ZodObject<{
|
|
263
263
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
@@ -279,6 +279,29 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
279
279
|
}, {
|
|
280
280
|
schemaVersion: "1.0";
|
|
281
281
|
}>;
|
|
282
|
+
} & {
|
|
283
|
+
type: z.ZodLiteral<"typeaheadSearch">;
|
|
284
|
+
answer: z.ZodString;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
type: "typeaheadSearch";
|
|
287
|
+
meta: {
|
|
288
|
+
schemaVersion: "1.0";
|
|
289
|
+
};
|
|
290
|
+
answer: string;
|
|
291
|
+
}, {
|
|
292
|
+
type: "typeaheadSearch";
|
|
293
|
+
meta: {
|
|
294
|
+
schemaVersion: "1.0";
|
|
295
|
+
};
|
|
296
|
+
answer: string;
|
|
297
|
+
}>, z.ZodObject<{
|
|
298
|
+
meta: z.ZodObject<{
|
|
299
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
300
|
+
}, "strip", z.ZodTypeAny, {
|
|
301
|
+
schemaVersion: "1.0";
|
|
302
|
+
}, {
|
|
303
|
+
schemaVersion: "1.0";
|
|
304
|
+
}>;
|
|
282
305
|
} & {
|
|
283
306
|
type: z.ZodLiteral<"boolean">;
|
|
284
307
|
answer: z.ZodBoolean;
|
|
@@ -455,6 +478,29 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
455
478
|
}, {
|
|
456
479
|
schemaVersion: "1.0";
|
|
457
480
|
}>;
|
|
481
|
+
} & {
|
|
482
|
+
type: z.ZodLiteral<"multiselectBox">;
|
|
483
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
484
|
+
}, "strip", z.ZodTypeAny, {
|
|
485
|
+
type: "multiselectBox";
|
|
486
|
+
meta: {
|
|
487
|
+
schemaVersion: "1.0";
|
|
488
|
+
};
|
|
489
|
+
answer: string[];
|
|
490
|
+
}, {
|
|
491
|
+
type: "multiselectBox";
|
|
492
|
+
meta: {
|
|
493
|
+
schemaVersion: "1.0";
|
|
494
|
+
};
|
|
495
|
+
answer: string[];
|
|
496
|
+
}>, z.ZodObject<{
|
|
497
|
+
meta: z.ZodObject<{
|
|
498
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
499
|
+
}, "strip", z.ZodTypeAny, {
|
|
500
|
+
schemaVersion: "1.0";
|
|
501
|
+
}, {
|
|
502
|
+
schemaVersion: "1.0";
|
|
503
|
+
}>;
|
|
458
504
|
} & {
|
|
459
505
|
type: z.ZodLiteral<"number">;
|
|
460
506
|
answer: z.ZodNumber;
|
|
@@ -503,19 +549,19 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
503
549
|
}>;
|
|
504
550
|
} & {
|
|
505
551
|
type: z.ZodLiteral<"selectBox">;
|
|
506
|
-
answer: z.
|
|
552
|
+
answer: z.ZodString;
|
|
507
553
|
}, "strip", z.ZodTypeAny, {
|
|
508
554
|
type: "selectBox";
|
|
509
555
|
meta: {
|
|
510
556
|
schemaVersion: "1.0";
|
|
511
557
|
};
|
|
512
|
-
answer: string
|
|
558
|
+
answer: string;
|
|
513
559
|
}, {
|
|
514
560
|
type: "selectBox";
|
|
515
561
|
meta: {
|
|
516
562
|
schemaVersion: "1.0";
|
|
517
563
|
};
|
|
518
|
-
answer: string
|
|
564
|
+
answer: string;
|
|
519
565
|
}>, z.ZodObject<{
|
|
520
566
|
meta: z.ZodObject<{
|
|
521
567
|
schemaVersion: z.ZodLiteral<"1.0">;
|
|
@@ -570,29 +616,6 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
570
616
|
}, {
|
|
571
617
|
schemaVersion: "1.0";
|
|
572
618
|
}>;
|
|
573
|
-
} & {
|
|
574
|
-
type: z.ZodLiteral<"typeaheadSearch">;
|
|
575
|
-
answer: z.ZodString;
|
|
576
|
-
}, "strip", z.ZodTypeAny, {
|
|
577
|
-
type: "typeaheadSearch";
|
|
578
|
-
meta: {
|
|
579
|
-
schemaVersion: "1.0";
|
|
580
|
-
};
|
|
581
|
-
answer: string;
|
|
582
|
-
}, {
|
|
583
|
-
type: "typeaheadSearch";
|
|
584
|
-
meta: {
|
|
585
|
-
schemaVersion: "1.0";
|
|
586
|
-
};
|
|
587
|
-
answer: string;
|
|
588
|
-
}>, z.ZodObject<{
|
|
589
|
-
meta: z.ZodObject<{
|
|
590
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
591
|
-
}, "strip", z.ZodTypeAny, {
|
|
592
|
-
schemaVersion: "1.0";
|
|
593
|
-
}, {
|
|
594
|
-
schemaVersion: "1.0";
|
|
595
|
-
}>;
|
|
596
619
|
} & {
|
|
597
620
|
type: z.ZodLiteral<"url">;
|
|
598
621
|
answer: z.ZodString;
|
|
@@ -661,6 +684,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
661
684
|
meta: {
|
|
662
685
|
schemaVersion: "1.0";
|
|
663
686
|
};
|
|
687
|
+
answer: string;
|
|
688
|
+
} | {
|
|
689
|
+
type: "multiselectBox";
|
|
690
|
+
meta: {
|
|
691
|
+
schemaVersion: "1.0";
|
|
692
|
+
};
|
|
664
693
|
answer: string[];
|
|
665
694
|
} | {
|
|
666
695
|
type: "currency";
|
|
@@ -751,6 +780,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
751
780
|
meta: {
|
|
752
781
|
schemaVersion: "1.0";
|
|
753
782
|
};
|
|
783
|
+
answer: string;
|
|
784
|
+
} | {
|
|
785
|
+
type: "multiselectBox";
|
|
786
|
+
meta: {
|
|
787
|
+
schemaVersion: "1.0";
|
|
788
|
+
};
|
|
754
789
|
answer: string[];
|
|
755
790
|
} | {
|
|
756
791
|
type: "currency";
|
|
@@ -843,6 +878,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
843
878
|
meta: {
|
|
844
879
|
schemaVersion: "1.0";
|
|
845
880
|
};
|
|
881
|
+
answer: string;
|
|
882
|
+
} | {
|
|
883
|
+
type: "multiselectBox";
|
|
884
|
+
meta: {
|
|
885
|
+
schemaVersion: "1.0";
|
|
886
|
+
};
|
|
846
887
|
answer: string[];
|
|
847
888
|
} | {
|
|
848
889
|
type: "currency";
|
|
@@ -935,6 +976,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
935
976
|
meta: {
|
|
936
977
|
schemaVersion: "1.0";
|
|
937
978
|
};
|
|
979
|
+
answer: string;
|
|
980
|
+
} | {
|
|
981
|
+
type: "multiselectBox";
|
|
982
|
+
meta: {
|
|
983
|
+
schemaVersion: "1.0";
|
|
984
|
+
};
|
|
938
985
|
answer: string[];
|
|
939
986
|
} | {
|
|
940
987
|
type: "currency";
|
|
@@ -1033,6 +1080,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
1033
1080
|
meta: {
|
|
1034
1081
|
schemaVersion: "1.0";
|
|
1035
1082
|
};
|
|
1083
|
+
answer: string;
|
|
1084
|
+
} | {
|
|
1085
|
+
type: "multiselectBox";
|
|
1086
|
+
meta: {
|
|
1087
|
+
schemaVersion: "1.0";
|
|
1088
|
+
};
|
|
1036
1089
|
answer: string[];
|
|
1037
1090
|
} | {
|
|
1038
1091
|
type: "currency";
|
|
@@ -1131,6 +1184,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
1131
1184
|
meta: {
|
|
1132
1185
|
schemaVersion: "1.0";
|
|
1133
1186
|
};
|
|
1187
|
+
answer: string;
|
|
1188
|
+
} | {
|
|
1189
|
+
type: "multiselectBox";
|
|
1190
|
+
meta: {
|
|
1191
|
+
schemaVersion: "1.0";
|
|
1192
|
+
};
|
|
1134
1193
|
answer: string[];
|
|
1135
1194
|
} | {
|
|
1136
1195
|
type: "currency";
|
|
@@ -1225,29 +1284,6 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
1225
1284
|
}, {
|
|
1226
1285
|
schemaVersion: "1.0";
|
|
1227
1286
|
}>;
|
|
1228
|
-
} & {
|
|
1229
|
-
type: z.ZodLiteral<"typeaheadSearch">;
|
|
1230
|
-
answer: z.ZodString;
|
|
1231
|
-
}, "strip", z.ZodTypeAny, {
|
|
1232
|
-
type: "typeaheadSearch";
|
|
1233
|
-
meta: {
|
|
1234
|
-
schemaVersion: "1.0";
|
|
1235
|
-
};
|
|
1236
|
-
answer: string;
|
|
1237
|
-
}, {
|
|
1238
|
-
type: "typeaheadSearch";
|
|
1239
|
-
meta: {
|
|
1240
|
-
schemaVersion: "1.0";
|
|
1241
|
-
};
|
|
1242
|
-
answer: string;
|
|
1243
|
-
}>, z.ZodObject<{
|
|
1244
|
-
meta: z.ZodObject<{
|
|
1245
|
-
schemaVersion: z.ZodLiteral<"1.0">;
|
|
1246
|
-
}, "strip", z.ZodTypeAny, {
|
|
1247
|
-
schemaVersion: "1.0";
|
|
1248
|
-
}, {
|
|
1249
|
-
schemaVersion: "1.0";
|
|
1250
|
-
}>;
|
|
1251
1287
|
} & {
|
|
1252
1288
|
type: z.ZodLiteral<"url">;
|
|
1253
1289
|
answer: z.ZodString;
|
|
@@ -1267,6 +1303,7 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
1267
1303
|
export declare const AnswerSchemaMap: Record<z.infer<typeof QuestionTypesEnum>, z.ZodTypeAny>;
|
|
1268
1304
|
export type AnyAnswerType = z.infer<typeof AnyAnswerSchema>;
|
|
1269
1305
|
export interface AnswerTypeMap {
|
|
1306
|
+
affiliationSearch: AffiliationSearchAnswerType;
|
|
1270
1307
|
boolean: BooleanAnswerType;
|
|
1271
1308
|
checkBoxes: CheckboxesAnswerType;
|
|
1272
1309
|
currency: CurrencyAnswerType;
|
|
@@ -1274,6 +1311,7 @@ export interface AnswerTypeMap {
|
|
|
1274
1311
|
dateRange: DateRangeAnswerType;
|
|
1275
1312
|
email: EmailAnswerType;
|
|
1276
1313
|
filteredSearch: FilteredSearchAnswerType;
|
|
1314
|
+
multiselectBox: MultiselectBoxAnswerType;
|
|
1277
1315
|
number: NumberAnswerType;
|
|
1278
1316
|
numberRange: NumberRangeAnswerType;
|
|
1279
1317
|
radioButtons: RadioButtonsAnswerType;
|
|
@@ -1281,6 +1319,5 @@ export interface AnswerTypeMap {
|
|
|
1281
1319
|
table: TableAnswerType;
|
|
1282
1320
|
text: TextAnswerType;
|
|
1283
1321
|
textArea: TextAreaAnswerType;
|
|
1284
|
-
typeaheadSearch: TypeaheadSearchAnswerType;
|
|
1285
1322
|
url: URLAnswerType;
|
|
1286
1323
|
}
|
package/dist/answers/index.js
CHANGED
|
@@ -45,11 +45,11 @@ exports.AnyAnswerSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
45
45
|
tableAnswers_1.TableAnswerSchema,
|
|
46
46
|
textAnswers_1.TextAnswerSchema,
|
|
47
47
|
textAnswers_1.TextAreaAnswerSchema,
|
|
48
|
-
graphQLAnswers_1.TypeaheadSearchAnswerSchema,
|
|
49
48
|
textAnswers_1.URLAnswerSchema
|
|
50
49
|
]);
|
|
51
50
|
// Export a mapping between question types and their corresponding answer schemas
|
|
52
51
|
exports.AnswerSchemaMap = {
|
|
52
|
+
affiliationSearch: graphQLAnswers_1.AffiliationSearchAnswerSchema,
|
|
53
53
|
boolean: optionBasedAnswers_1.BooleanAnswerSchema,
|
|
54
54
|
checkBoxes: optionBasedAnswers_1.CheckboxesAnswerSchema,
|
|
55
55
|
currency: numberAnswers_1.CurrencyAnswerSchema,
|
|
@@ -57,6 +57,7 @@ exports.AnswerSchemaMap = {
|
|
|
57
57
|
dateRange: dateAnswers_1.DateRangeAnswerSchema,
|
|
58
58
|
email: textAnswers_1.EmailAnswerSchema,
|
|
59
59
|
filteredSearch: graphQLAnswers_1.FilteredSearchAnswerSchema,
|
|
60
|
+
multiselectBox: optionBasedAnswers_1.MultiselectBoxAnswerSchema,
|
|
60
61
|
number: numberAnswers_1.NumberAnswerSchema,
|
|
61
62
|
numberRange: numberAnswers_1.NumberRangeAnswerSchema,
|
|
62
63
|
radioButtons: optionBasedAnswers_1.RadioButtonsAnswerSchema,
|
|
@@ -64,6 +65,5 @@ exports.AnswerSchemaMap = {
|
|
|
64
65
|
table: tableAnswers_1.TableAnswerSchema,
|
|
65
66
|
text: textAnswers_1.TextAnswerSchema,
|
|
66
67
|
textArea: textAnswers_1.TextAreaAnswerSchema,
|
|
67
|
-
typeaheadSearch: graphQLAnswers_1.TypeaheadSearchAnswerSchema,
|
|
68
68
|
url: textAnswers_1.URLAnswerSchema
|
|
69
69
|
};
|
|
@@ -81,21 +81,46 @@ export declare const SelectBoxAnswerSchema: z.ZodObject<{
|
|
|
81
81
|
}>;
|
|
82
82
|
} & {
|
|
83
83
|
type: z.ZodLiteral<"selectBox">;
|
|
84
|
-
answer: z.
|
|
84
|
+
answer: z.ZodString;
|
|
85
85
|
}, "strip", z.ZodTypeAny, {
|
|
86
86
|
type: "selectBox";
|
|
87
87
|
meta: {
|
|
88
88
|
schemaVersion: "1.0";
|
|
89
89
|
};
|
|
90
|
-
answer: string
|
|
90
|
+
answer: string;
|
|
91
91
|
}, {
|
|
92
92
|
type: "selectBox";
|
|
93
93
|
meta: {
|
|
94
94
|
schemaVersion: "1.0";
|
|
95
95
|
};
|
|
96
|
+
answer: string;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const MultiselectBoxAnswerSchema: z.ZodObject<{
|
|
99
|
+
meta: z.ZodObject<{
|
|
100
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
schemaVersion: "1.0";
|
|
103
|
+
}, {
|
|
104
|
+
schemaVersion: "1.0";
|
|
105
|
+
}>;
|
|
106
|
+
} & {
|
|
107
|
+
type: z.ZodLiteral<"multiselectBox">;
|
|
108
|
+
answer: z.ZodArray<z.ZodString, "many">;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
type: "multiselectBox";
|
|
111
|
+
meta: {
|
|
112
|
+
schemaVersion: "1.0";
|
|
113
|
+
};
|
|
114
|
+
answer: string[];
|
|
115
|
+
}, {
|
|
116
|
+
type: "multiselectBox";
|
|
117
|
+
meta: {
|
|
118
|
+
schemaVersion: "1.0";
|
|
119
|
+
};
|
|
96
120
|
answer: string[];
|
|
97
121
|
}>;
|
|
98
122
|
export type BooleanAnswerType = z.infer<typeof BooleanAnswerSchema>;
|
|
99
123
|
export type CheckboxesAnswerType = z.infer<typeof CheckboxesAnswerSchema>;
|
|
100
124
|
export type RadioButtonsAnswerType = z.infer<typeof RadioButtonsAnswerSchema>;
|
|
101
125
|
export type SelectBoxAnswerType = z.infer<typeof SelectBoxAnswerSchema>;
|
|
126
|
+
export type MultiselectBoxAnswerType = z.infer<typeof MultiselectBoxAnswerSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectBoxAnswerSchema = exports.RadioButtonsAnswerSchema = exports.CheckboxesAnswerSchema = exports.BooleanAnswerSchema = void 0;
|
|
3
|
+
exports.MultiselectBoxAnswerSchema = exports.SelectBoxAnswerSchema = exports.RadioButtonsAnswerSchema = exports.CheckboxesAnswerSchema = exports.BooleanAnswerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const answer_1 = require("./answer");
|
|
6
6
|
// Answers to Option Based Question Types
|
|
@@ -18,5 +18,9 @@ exports.RadioButtonsAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
|
18
18
|
}));
|
|
19
19
|
exports.SelectBoxAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
20
20
|
type: zod_1.z.literal('selectBox'), // The type of answer
|
|
21
|
+
answer: zod_1.z.string() // The answer to the question (string)
|
|
22
|
+
}));
|
|
23
|
+
exports.MultiselectBoxAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
|
|
24
|
+
type: zod_1.z.literal('multiselectBox'), // The type of answer
|
|
21
25
|
answer: zod_1.z.array(zod_1.z.string()) // The answer to the question (array of strings)
|
|
22
26
|
}));
|