@dmptool/types 1.1.0 → 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.
Files changed (58) hide show
  1. package/README.md +2 -0
  2. package/dist/answers/__tests__/answers.spec.js +13 -7
  3. package/dist/answers/answer.d.ts +3 -3
  4. package/dist/answers/graphQLAnswers.d.ts +2 -2
  5. package/dist/answers/graphQLAnswers.js +2 -2
  6. package/dist/answers/index.d.ts +111 -74
  7. package/dist/answers/index.js +4 -4
  8. package/dist/answers/numberAnswers.d.ts +0 -25
  9. package/dist/answers/numberAnswers.js +1 -5
  10. package/dist/answers/optionBasedAnswers.d.ts +52 -2
  11. package/dist/answers/optionBasedAnswers.js +9 -1
  12. package/dist/answers/tableAnswers.d.ts +304 -140
  13. package/dist/answers/tableAnswers.js +3 -2
  14. package/dist/questions/__tests__/graphQLQuestions.spec.js +7 -7
  15. package/dist/questions/__tests__/numberQuestions.spec.js +0 -48
  16. package/dist/questions/__tests__/optionBasedQuestions.spec.js +98 -1
  17. package/dist/questions/dateQuestions.d.ts +47 -16
  18. package/dist/questions/dateQuestions.js +25 -1
  19. package/dist/questions/graphQLQuestions.d.ts +59 -28
  20. package/dist/questions/graphQLQuestions.js +40 -3
  21. package/dist/questions/index.d.ts +1567 -689
  22. package/dist/questions/index.js +7 -4
  23. package/dist/questions/numberQuestions.d.ts +71 -76
  24. package/dist/questions/numberQuestions.js +37 -8
  25. package/dist/questions/optionBasedQuestions.d.ts +227 -23
  26. package/dist/questions/optionBasedQuestions.js +89 -5
  27. package/dist/questions/question.d.ts +51 -4
  28. package/dist/questions/question.js +14 -2
  29. package/dist/questions/tableQuestions.d.ts +1965 -1056
  30. package/dist/questions/tableQuestions.js +14 -2
  31. package/dist/questions/textQuestions.d.ts +100 -40
  32. package/dist/questions/textQuestions.js +45 -7
  33. package/dist/schemas/affiliationSearchAnswer.schema.json +37 -0
  34. package/dist/schemas/affiliationSearchQuestion.schema.json +133 -0
  35. package/dist/schemas/anyAnswer.schema.json +41 -23
  36. package/dist/schemas/anyQuestion.schema.json +563 -146
  37. package/dist/schemas/anyTableColumnAnswer.schema.json +35 -14
  38. package/dist/schemas/anyTableColumnQuestion.schema.json +398 -119
  39. package/dist/schemas/booleanQuestion.schema.json +12 -0
  40. package/dist/schemas/checkboxesQuestion.schema.json +12 -0
  41. package/dist/schemas/currencyQuestion.schema.json +12 -0
  42. package/dist/schemas/dateQuestion.schema.json +12 -0
  43. package/dist/schemas/dateRangeQuestion.schema.json +12 -0
  44. package/dist/schemas/emailQuestion.schema.json +12 -0
  45. package/dist/schemas/filteredSearchQuestion.schema.json +10 -0
  46. package/dist/schemas/multiselectBoxAnswer.schema.json +40 -0
  47. package/dist/schemas/multiselectBoxQuestion.schema.json +90 -0
  48. package/dist/schemas/numberQuestion.schema.json +12 -0
  49. package/dist/schemas/numberRangeQuestion.schema.json +12 -0
  50. package/dist/schemas/radioButtonsQuestion.schema.json +12 -0
  51. package/dist/schemas/selectBoxAnswer.schema.json +1 -4
  52. package/dist/schemas/selectBoxQuestion.schema.json +18 -1
  53. package/dist/schemas/tableAnswer.schema.json +35 -14
  54. package/dist/schemas/tableQuestion.schema.json +420 -120
  55. package/dist/schemas/textAreaQuestion.schema.json +15 -4
  56. package/dist/schemas/textQuestion.schema.json +12 -0
  57. package/dist/schemas/urlQuestion.schema.json +12 -0
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -76,6 +76,8 @@ Once added, you can then import the Types and Zod shemas like this:
76
76
  const boolQ: BooleanQuestionType = {
77
77
  type: "boolean",
78
78
  attributes: {
79
+ label: "Yes or No",
80
+ help: "Are you sure?",
79
81
  checked: true
80
82
  },
81
83
  meta: {
@@ -12,9 +12,9 @@ const questions_1 = require("../../questions");
12
12
  (0, globals_1.describe)('Answer Type Validations', () => {
13
13
  (0, globals_1.it)('should validate BooleanAnswer', () => {
14
14
  const validData = { type: 'boolean', answer: true, meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
15
- (0, globals_1.expect)(() => numberAnswers_1.BooleanAnswerSchema.parse(validData)).not.toThrow();
15
+ (0, globals_1.expect)(() => optionBasedAnswers_1.BooleanAnswerSchema.parse(validData)).not.toThrow();
16
16
  const invalidData = { type: 'boolean', answer: 'true' };
17
- (0, globals_1.expect)(() => numberAnswers_1.BooleanAnswerSchema.parse(invalidData)).toThrow();
17
+ (0, globals_1.expect)(() => optionBasedAnswers_1.BooleanAnswerSchema.parse(invalidData)).toThrow();
18
18
  });
19
19
  (0, globals_1.it)('should validate CheckboxesAnswer', () => {
20
20
  const validData = { type: 'checkBoxes', answer: ['option1', 'option2'], meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
@@ -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: ['option1'], meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION } };
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 TypeaheadSearchAnswer', () => {
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.TypeaheadSearchAnswerSchema.parse(validData)).not.toThrow();
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)(() => graphQLAnswers_1.TypeaheadSearchAnswerSchema.parse(invalidData)).toThrow();
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 } };
@@ -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", "typeaheadSearch", "url"]>;
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" | "typeaheadSearch" | "url";
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" | "typeaheadSearch" | "url";
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 TypeaheadSearchAnswerSchema: z.ZodObject<{
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 TypeaheadSearchAnswerType = z.infer<typeof TypeaheadSearchAnswerSchema>;
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.TypeaheadSearchAnswerSchema = exports.FilteredSearchAnswerSchema = void 0;
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.TypeaheadSearchAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
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
  }));
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { DateAnswerType, DateRangeAnswerType } from './dateAnswers';
3
- import { FilteredSearchAnswerType, TypeaheadSearchAnswerType } from './graphQLAnswers';
4
- import { CheckboxesAnswerType, RadioButtonsAnswerType, SelectBoxAnswerType } from './optionBasedAnswers';
5
- import { BooleanAnswerType, CurrencyAnswerType, NumberAnswerType, NumberRangeAnswerType } from './numberAnswers';
3
+ import { FilteredSearchAnswerType, AffiliationSearchAnswerType } from './graphQLAnswers';
4
+ import { BooleanAnswerType, CheckboxesAnswerType, RadioButtonsAnswerType, SelectBoxAnswerType, MultiselectBoxAnswerType } from './optionBasedAnswers';
5
+ import { CurrencyAnswerType, NumberAnswerType, NumberRangeAnswerType } from './numberAnswers';
6
6
  import { TableAnswerType } from './tableAnswers';
7
7
  import { EmailAnswerType, TextAnswerType, TextAreaAnswerType, URLAnswerType } from './textAnswers';
8
8
  import { QuestionTypesEnum } from '../questions';
@@ -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.ZodArray<z.ZodString, "many">;
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.ZodArray<z.ZodString, "many">;
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;
@@ -638,6 +661,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
638
661
  schemaVersion: "1.0";
639
662
  };
640
663
  answer: string;
664
+ } | {
665
+ type: "boolean";
666
+ meta: {
667
+ schemaVersion: "1.0";
668
+ };
669
+ answer: boolean;
641
670
  } | {
642
671
  type: "checkBoxes";
643
672
  meta: {
@@ -655,13 +684,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
655
684
  meta: {
656
685
  schemaVersion: "1.0";
657
686
  };
658
- answer: string[];
687
+ answer: string;
659
688
  } | {
660
- type: "boolean";
689
+ type: "multiselectBox";
661
690
  meta: {
662
691
  schemaVersion: "1.0";
663
692
  };
664
- answer: boolean;
693
+ answer: string[];
665
694
  } | {
666
695
  type: "currency";
667
696
  meta: {
@@ -728,6 +757,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
728
757
  schemaVersion: "1.0";
729
758
  };
730
759
  answer: string;
760
+ } | {
761
+ type: "boolean";
762
+ meta: {
763
+ schemaVersion: "1.0";
764
+ };
765
+ answer: boolean;
731
766
  } | {
732
767
  type: "checkBoxes";
733
768
  meta: {
@@ -745,13 +780,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
745
780
  meta: {
746
781
  schemaVersion: "1.0";
747
782
  };
748
- answer: string[];
783
+ answer: string;
749
784
  } | {
750
- type: "boolean";
785
+ type: "multiselectBox";
751
786
  meta: {
752
787
  schemaVersion: "1.0";
753
788
  };
754
- answer: boolean;
789
+ answer: string[];
755
790
  } | {
756
791
  type: "currency";
757
792
  meta: {
@@ -820,6 +855,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
820
855
  schemaVersion: "1.0";
821
856
  };
822
857
  answer: string;
858
+ } | {
859
+ type: "boolean";
860
+ meta: {
861
+ schemaVersion: "1.0";
862
+ };
863
+ answer: boolean;
823
864
  } | {
824
865
  type: "checkBoxes";
825
866
  meta: {
@@ -837,13 +878,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
837
878
  meta: {
838
879
  schemaVersion: "1.0";
839
880
  };
840
- answer: string[];
881
+ answer: string;
841
882
  } | {
842
- type: "boolean";
883
+ type: "multiselectBox";
843
884
  meta: {
844
885
  schemaVersion: "1.0";
845
886
  };
846
- answer: boolean;
887
+ answer: string[];
847
888
  } | {
848
889
  type: "currency";
849
890
  meta: {
@@ -912,6 +953,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
912
953
  schemaVersion: "1.0";
913
954
  };
914
955
  answer: string;
956
+ } | {
957
+ type: "boolean";
958
+ meta: {
959
+ schemaVersion: "1.0";
960
+ };
961
+ answer: boolean;
915
962
  } | {
916
963
  type: "checkBoxes";
917
964
  meta: {
@@ -929,13 +976,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
929
976
  meta: {
930
977
  schemaVersion: "1.0";
931
978
  };
932
- answer: string[];
979
+ answer: string;
933
980
  } | {
934
- type: "boolean";
981
+ type: "multiselectBox";
935
982
  meta: {
936
983
  schemaVersion: "1.0";
937
984
  };
938
- answer: boolean;
985
+ answer: string[];
939
986
  } | {
940
987
  type: "currency";
941
988
  meta: {
@@ -1010,6 +1057,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
1010
1057
  schemaVersion: "1.0";
1011
1058
  };
1012
1059
  answer: string;
1060
+ } | {
1061
+ type: "boolean";
1062
+ meta: {
1063
+ schemaVersion: "1.0";
1064
+ };
1065
+ answer: boolean;
1013
1066
  } | {
1014
1067
  type: "checkBoxes";
1015
1068
  meta: {
@@ -1027,13 +1080,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
1027
1080
  meta: {
1028
1081
  schemaVersion: "1.0";
1029
1082
  };
1030
- answer: string[];
1083
+ answer: string;
1031
1084
  } | {
1032
- type: "boolean";
1085
+ type: "multiselectBox";
1033
1086
  meta: {
1034
1087
  schemaVersion: "1.0";
1035
1088
  };
1036
- answer: boolean;
1089
+ answer: string[];
1037
1090
  } | {
1038
1091
  type: "currency";
1039
1092
  meta: {
@@ -1108,6 +1161,12 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
1108
1161
  schemaVersion: "1.0";
1109
1162
  };
1110
1163
  answer: string;
1164
+ } | {
1165
+ type: "boolean";
1166
+ meta: {
1167
+ schemaVersion: "1.0";
1168
+ };
1169
+ answer: boolean;
1111
1170
  } | {
1112
1171
  type: "checkBoxes";
1113
1172
  meta: {
@@ -1125,13 +1184,13 @@ export declare const AnyAnswerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
1125
1184
  meta: {
1126
1185
  schemaVersion: "1.0";
1127
1186
  };
1128
- answer: string[];
1187
+ answer: string;
1129
1188
  } | {
1130
- type: "boolean";
1189
+ type: "multiselectBox";
1131
1190
  meta: {
1132
1191
  schemaVersion: "1.0";
1133
1192
  };
1134
- answer: boolean;
1193
+ answer: string[];
1135
1194
  } | {
1136
1195
  type: "currency";
1137
1196
  meta: {
@@ -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
  }
@@ -32,7 +32,7 @@ __exportStar(require("./tableAnswers"), exports);
32
32
  __exportStar(require("./textAnswers"), exports);
33
33
  // Union of all possible answers
34
34
  exports.AnyAnswerSchema = zod_1.z.discriminatedUnion('type', [
35
- numberAnswers_1.BooleanAnswerSchema,
35
+ optionBasedAnswers_1.BooleanAnswerSchema,
36
36
  optionBasedAnswers_1.CheckboxesAnswerSchema,
37
37
  numberAnswers_1.CurrencyAnswerSchema,
38
38
  dateAnswers_1.DateAnswerSchema,
@@ -45,18 +45,19 @@ 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 = {
53
- boolean: numberAnswers_1.BooleanAnswerSchema,
52
+ affiliationSearch: graphQLAnswers_1.AffiliationSearchAnswerSchema,
53
+ boolean: optionBasedAnswers_1.BooleanAnswerSchema,
54
54
  checkBoxes: optionBasedAnswers_1.CheckboxesAnswerSchema,
55
55
  currency: numberAnswers_1.CurrencyAnswerSchema,
56
56
  date: dateAnswers_1.DateAnswerSchema,
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
  };
@@ -1,28 +1,4 @@
1
1
  import { z } from 'zod';
2
- export declare const BooleanAnswerSchema: z.ZodObject<{
3
- meta: z.ZodObject<{
4
- schemaVersion: z.ZodLiteral<"1.0">;
5
- }, "strip", z.ZodTypeAny, {
6
- schemaVersion: "1.0";
7
- }, {
8
- schemaVersion: "1.0";
9
- }>;
10
- } & {
11
- type: z.ZodLiteral<"boolean">;
12
- answer: z.ZodBoolean;
13
- }, "strip", z.ZodTypeAny, {
14
- type: "boolean";
15
- meta: {
16
- schemaVersion: "1.0";
17
- };
18
- answer: boolean;
19
- }, {
20
- type: "boolean";
21
- meta: {
22
- schemaVersion: "1.0";
23
- };
24
- answer: boolean;
25
- }>;
26
2
  export declare const CurrencyAnswerSchema: z.ZodObject<{
27
3
  meta: z.ZodObject<{
28
4
  schemaVersion: z.ZodLiteral<"1.0">;
@@ -110,7 +86,6 @@ export declare const NumberRangeAnswerSchema: z.ZodObject<{
110
86
  end: number;
111
87
  };
112
88
  }>;
113
- export type BooleanAnswerType = z.infer<typeof BooleanAnswerSchema>;
114
89
  export type CurrencyAnswerType = z.infer<typeof CurrencyAnswerSchema>;
115
90
  export type NumberAnswerType = z.infer<typeof NumberAnswerSchema>;
116
91
  export type NumberRangeAnswerType = z.infer<typeof NumberRangeAnswerSchema>;
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumberRangeAnswerSchema = exports.NumberAnswerSchema = exports.CurrencyAnswerSchema = exports.BooleanAnswerSchema = void 0;
3
+ exports.NumberRangeAnswerSchema = exports.NumberAnswerSchema = exports.CurrencyAnswerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const answer_1 = require("./answer");
6
6
  // Answers to Number Question Types
7
- exports.BooleanAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
8
- type: zod_1.z.literal('boolean'), // The type of answer
9
- answer: zod_1.z.boolean() // The answer to the question (true/false)
10
- }));
11
7
  exports.CurrencyAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
12
8
  type: zod_1.z.literal('currency'), // The type of answer
13
9
  answer: zod_1.z.number() // The answer to the question (number)
@@ -1,4 +1,28 @@
1
1
  import { z } from 'zod';
2
+ export declare const BooleanAnswerSchema: z.ZodObject<{
3
+ meta: z.ZodObject<{
4
+ schemaVersion: z.ZodLiteral<"1.0">;
5
+ }, "strip", z.ZodTypeAny, {
6
+ schemaVersion: "1.0";
7
+ }, {
8
+ schemaVersion: "1.0";
9
+ }>;
10
+ } & {
11
+ type: z.ZodLiteral<"boolean">;
12
+ answer: z.ZodBoolean;
13
+ }, "strip", z.ZodTypeAny, {
14
+ type: "boolean";
15
+ meta: {
16
+ schemaVersion: "1.0";
17
+ };
18
+ answer: boolean;
19
+ }, {
20
+ type: "boolean";
21
+ meta: {
22
+ schemaVersion: "1.0";
23
+ };
24
+ answer: boolean;
25
+ }>;
2
26
  export declare const CheckboxesAnswerSchema: z.ZodObject<{
3
27
  meta: z.ZodObject<{
4
28
  schemaVersion: z.ZodLiteral<"1.0">;
@@ -57,20 +81,46 @@ export declare const SelectBoxAnswerSchema: z.ZodObject<{
57
81
  }>;
58
82
  } & {
59
83
  type: z.ZodLiteral<"selectBox">;
60
- answer: z.ZodArray<z.ZodString, "many">;
84
+ answer: z.ZodString;
61
85
  }, "strip", z.ZodTypeAny, {
62
86
  type: "selectBox";
63
87
  meta: {
64
88
  schemaVersion: "1.0";
65
89
  };
66
- answer: string[];
90
+ answer: string;
67
91
  }, {
68
92
  type: "selectBox";
69
93
  meta: {
70
94
  schemaVersion: "1.0";
71
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
+ };
72
120
  answer: string[];
73
121
  }>;
122
+ export type BooleanAnswerType = z.infer<typeof BooleanAnswerSchema>;
74
123
  export type CheckboxesAnswerType = z.infer<typeof CheckboxesAnswerSchema>;
75
124
  export type RadioButtonsAnswerType = z.infer<typeof RadioButtonsAnswerSchema>;
76
125
  export type SelectBoxAnswerType = z.infer<typeof SelectBoxAnswerSchema>;
126
+ export type MultiselectBoxAnswerType = z.infer<typeof MultiselectBoxAnswerSchema>;