@dmptool/types 1.0.1 → 1.0.3

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 (52) hide show
  1. package/README.md +96 -29
  2. package/dist/answers/__tests__/answers.spec.js +65 -60
  3. package/dist/answers/answer.d.ts +15 -2
  4. package/dist/answers/answer.js +5 -2
  5. package/dist/answers/dateAnswers.d.ts +31 -4
  6. package/dist/answers/dateAnswers.js +3 -3
  7. package/dist/answers/graphQLAnswers.d.ts +32 -4
  8. package/dist/answers/graphQLAnswers.js +3 -3
  9. package/dist/answers/index.d.ts +524 -36
  10. package/dist/answers/index.js +17 -17
  11. package/dist/answers/optionBasedAnswers.d.ts +51 -9
  12. package/dist/answers/optionBasedAnswers.js +5 -5
  13. package/dist/answers/primitiveAnswers.d.ts +112 -14
  14. package/dist/answers/primitiveAnswers.js +8 -8
  15. package/dist/answers/tableAnswers.d.ts +525 -37
  16. package/dist/answers/tableAnswers.js +18 -18
  17. package/dist/questions/__tests__/dateQuestions.spec.js +6 -6
  18. package/dist/questions/__tests__/graphQLQuestions.spec.js +4 -4
  19. package/dist/questions/__tests__/optionBasedQuestions.spec.js +6 -6
  20. package/dist/questions/__tests__/primitiveQuestions.spec.js +14 -14
  21. package/dist/questions/dateQuestions.d.ts +4 -4
  22. package/dist/questions/dateQuestions.js +5 -5
  23. package/dist/questions/graphQLQuestions.d.ts +4 -4
  24. package/dist/questions/graphQLQuestions.js +3 -3
  25. package/dist/questions/index.d.ts +2 -2
  26. package/dist/questions/index.js +17 -17
  27. package/dist/questions/optionBasedQuestions.d.ts +6 -6
  28. package/dist/questions/optionBasedQuestions.js +11 -11
  29. package/dist/questions/primitiveQuestions.d.ts +14 -14
  30. package/dist/questions/primitiveQuestions.js +8 -8
  31. package/dist/questions/question.d.ts +2 -2
  32. package/dist/questions/question.js +2 -2
  33. package/dist/questions/tableQuestions.d.ts +4 -4
  34. package/dist/questions/tableQuestions.js +18 -18
  35. package/dist/schemas/anyAnswer.schema.json +89 -16
  36. package/dist/schemas/anyTableColumnAnswer.schema.json +84 -15
  37. package/dist/schemas/booleanAnswer.schema.json +15 -1
  38. package/dist/schemas/checkboxesAnswer.schema.json +15 -1
  39. package/dist/schemas/currencyAnswer.schema.json +15 -1
  40. package/dist/schemas/datePickerAnswer.schema.json +15 -1
  41. package/dist/schemas/dateRangeAnswer.schema.json +15 -1
  42. package/dist/schemas/emailAnswer.schema.json +15 -1
  43. package/dist/schemas/filteredSearchAnswer.schema.json +15 -1
  44. package/dist/schemas/numberAnswer.schema.json +15 -1
  45. package/dist/schemas/radioButtonsAnswer.schema.json +15 -1
  46. package/dist/schemas/selectBoxAnswer.schema.json +19 -2
  47. package/dist/schemas/tableAnswer.schema.json +89 -16
  48. package/dist/schemas/textAnswer.schema.json +15 -1
  49. package/dist/schemas/textAreaAnswer.schema.json +15 -1
  50. package/dist/schemas/typeaheadSearchAnswer.schema.json +15 -1
  51. package/dist/schemas/urlAnswer.schema.json +15 -1
  52. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableAnswer = exports.AnyTableColumnAnswer = void 0;
3
+ exports.TableAnswerSchema = exports.AnyTableColumnAnswerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const answer_1 = require("./answer");
6
6
  const optionBasedAnswers_1 = require("./optionBasedAnswers");
@@ -8,24 +8,24 @@ const dateAnswers_1 = require("./dateAnswers");
8
8
  const graphQLAnswers_1 = require("./graphQLAnswers");
9
9
  const primitiveAnswers_1 = require("./primitiveAnswers");
10
10
  // Answers to Table Column Question Types (note that TableAnswer is not included here because we don't allow nested tables)
11
- exports.AnyTableColumnAnswer = zod_1.z.discriminatedUnion('type', [
12
- primitiveAnswers_1.BooleanAnswer,
13
- optionBasedAnswers_1.CheckboxesAnswer,
14
- primitiveAnswers_1.CurrencyAnswer,
15
- dateAnswers_1.DatePickerAnswer,
16
- dateAnswers_1.DateRangeAnswer,
17
- primitiveAnswers_1.EmailAnswer,
18
- graphQLAnswers_1.FilteredSearchAnswer,
19
- primitiveAnswers_1.NumberAnswer,
20
- optionBasedAnswers_1.RadioButtonsAnswer,
21
- optionBasedAnswers_1.SelectBoxAnswer,
22
- primitiveAnswers_1.TextAnswer,
23
- primitiveAnswers_1.TextAreaAnswer,
24
- graphQLAnswers_1.TypeaheadSearchAnswer,
25
- primitiveAnswers_1.URLAnswer
11
+ exports.AnyTableColumnAnswerSchema = zod_1.z.discriminatedUnion('type', [
12
+ primitiveAnswers_1.BooleanAnswerSchema,
13
+ optionBasedAnswers_1.CheckboxesAnswerSchema,
14
+ primitiveAnswers_1.CurrencyAnswerSchema,
15
+ dateAnswers_1.DatePickerAnswerSchema,
16
+ dateAnswers_1.DateRangeAnswerSchema,
17
+ primitiveAnswers_1.EmailAnswerSchema,
18
+ graphQLAnswers_1.FilteredSearchAnswerSchema,
19
+ primitiveAnswers_1.NumberAnswerSchema,
20
+ optionBasedAnswers_1.RadioButtonsAnswerSchema,
21
+ optionBasedAnswers_1.SelectBoxAnswerSchema,
22
+ primitiveAnswers_1.TextAnswerSchema,
23
+ primitiveAnswers_1.TextAreaAnswerSchema,
24
+ graphQLAnswers_1.TypeaheadSearchAnswerSchema,
25
+ primitiveAnswers_1.URLAnswerSchema
26
26
  ]);
27
27
  // Answers to Table Question Types
28
- exports.TableAnswer = answer_1.Answer.merge(zod_1.z.object({
28
+ exports.TableAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
29
29
  type: zod_1.z.literal('table'), // The type of answer
30
- answer: zod_1.z.array(exports.AnyTableColumnAnswer) // The answer to the question (array of answers)
30
+ answer: zod_1.z.array(exports.AnyTableColumnAnswerSchema) // The answer to the question (array of answers)
31
31
  }));
@@ -14,7 +14,7 @@ describe("DatePickerQuestion", () => {
14
14
  schemaVersion: "1.0"
15
15
  }
16
16
  };
17
- expect(() => dateQuestions_1.DatePickerQuestion.parse(validDatePicker)).not.toThrow();
17
+ expect(() => dateQuestions_1.DatePickerQuestionSchema.parse(validDatePicker)).not.toThrow();
18
18
  });
19
19
  it("should throw an error for an invalid DatePickerQuestion object", () => {
20
20
  const invalidDatePicker = {
@@ -28,7 +28,7 @@ describe("DatePickerQuestion", () => {
28
28
  schemaVersion: "1.0"
29
29
  }
30
30
  };
31
- expect(() => dateQuestions_1.DatePickerQuestion.parse(invalidDatePicker)).toThrow();
31
+ expect(() => dateQuestions_1.DatePickerQuestionSchema.parse(invalidDatePicker)).toThrow();
32
32
  });
33
33
  it("should allow optional attributes in DatePickerQuestion", () => {
34
34
  const validDatePicker = {
@@ -38,7 +38,7 @@ describe("DatePickerQuestion", () => {
38
38
  schemaVersion: "1.0"
39
39
  }
40
40
  };
41
- expect(() => dateQuestions_1.DatePickerQuestion.parse(validDatePicker)).not.toThrow();
41
+ expect(() => dateQuestions_1.DatePickerQuestionSchema.parse(validDatePicker)).not.toThrow();
42
42
  });
43
43
  });
44
44
  describe("DateRangeQuestion", () => {
@@ -75,7 +75,7 @@ describe("DateRangeQuestion", () => {
75
75
  schemaVersion: "1.0"
76
76
  }
77
77
  };
78
- expect(() => dateQuestions_1.DateRangeQuestion.parse(validDateRange)).not.toThrow();
78
+ expect(() => dateQuestions_1.DateRangeQuestionSchema.parse(validDateRange)).not.toThrow();
79
79
  });
80
80
  it("should throw an error for an invalid DateRangeQuestion object", () => {
81
81
  const invalidDateRange = {
@@ -110,7 +110,7 @@ describe("DateRangeQuestion", () => {
110
110
  schemaVersion: "1.0"
111
111
  }
112
112
  };
113
- expect(() => dateQuestions_1.DateRangeQuestion.parse(invalidDateRange)).toThrow();
113
+ expect(() => dateQuestions_1.DateRangeQuestionSchema.parse(invalidDateRange)).toThrow();
114
114
  });
115
115
  it("should require labels for start and end date pickers", () => {
116
116
  const invalidDateRange = {
@@ -144,6 +144,6 @@ describe("DateRangeQuestion", () => {
144
144
  schemaVersion: "1.0"
145
145
  }
146
146
  };
147
- expect(() => dateQuestions_1.DateRangeQuestion.parse(invalidDateRange)).toThrow();
147
+ expect(() => dateQuestions_1.DateRangeQuestionSchema.parse(invalidDateRange)).toThrow();
148
148
  });
149
149
  });
@@ -25,7 +25,7 @@ const graphQLQuestions_1 = require("../graphQLQuestions");
25
25
  schemaVersion: "1.0"
26
26
  }
27
27
  };
28
- (0, globals_1.expect)(() => graphQLQuestions_1.FilteredSearchQuestion.parse(validData)).not.toThrow();
28
+ (0, globals_1.expect)(() => graphQLQuestions_1.FilteredSearchQuestionSchema.parse(validData)).not.toThrow();
29
29
  });
30
30
  (0, globals_1.it)("should throw an error for an invalid FilteredSearchQuestion object", () => {
31
31
  const invalidData = {
@@ -46,7 +46,7 @@ const graphQLQuestions_1 = require("../graphQLQuestions");
46
46
  schemaVersion: "1.0"
47
47
  }
48
48
  };
49
- (0, globals_1.expect)(() => graphQLQuestions_1.FilteredSearchQuestion.parse(invalidData)).toThrow();
49
+ (0, globals_1.expect)(() => graphQLQuestions_1.FilteredSearchQuestionSchema.parse(invalidData)).toThrow();
50
50
  });
51
51
  });
52
52
  (0, globals_1.describe)("TypeaheadSearchQuestion schema", () => {
@@ -67,7 +67,7 @@ const graphQLQuestions_1 = require("../graphQLQuestions");
67
67
  schemaVersion: "1.0"
68
68
  }
69
69
  };
70
- (0, globals_1.expect)(() => graphQLQuestions_1.TypeaheadSearchQuestion.parse(validData)).not.toThrow();
70
+ (0, globals_1.expect)(() => graphQLQuestions_1.TypeaheadSearchQuestionSchema.parse(validData)).not.toThrow();
71
71
  });
72
72
  (0, globals_1.it)("should throw an error for an invalid TypeaheadSearchQuestion object", () => {
73
73
  const invalidData = {
@@ -82,6 +82,6 @@ const graphQLQuestions_1 = require("../graphQLQuestions");
82
82
  ],
83
83
  },
84
84
  };
85
- (0, globals_1.expect)(() => graphQLQuestions_1.TypeaheadSearchQuestion.parse(invalidData)).toThrow();
85
+ (0, globals_1.expect)(() => graphQLQuestions_1.TypeaheadSearchQuestionSchema.parse(invalidData)).toThrow();
86
86
  });
87
87
  });
@@ -27,7 +27,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
27
27
  schemaVersion: "1.0"
28
28
  }
29
29
  };
30
- (0, globals_1.expect)(() => optionBasedQuestions_1.CheckboxesQuestion.parse(validCheckboxesQuestion)).not.toThrow();
30
+ (0, globals_1.expect)(() => optionBasedQuestions_1.CheckboxesQuestionSchema.parse(validCheckboxesQuestion)).not.toThrow();
31
31
  });
32
32
  (0, globals_1.it)("should throw an error for an invalid CheckboxesQuestion object", () => {
33
33
  const invalidCheckboxesQuestion = {
@@ -46,7 +46,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
46
46
  schemaVersion: "1.0"
47
47
  }
48
48
  };
49
- (0, globals_1.expect)(() => optionBasedQuestions_1.CheckboxesQuestion.parse(invalidCheckboxesQuestion)).toThrow();
49
+ (0, globals_1.expect)(() => optionBasedQuestions_1.CheckboxesQuestionSchema.parse(invalidCheckboxesQuestion)).toThrow();
50
50
  });
51
51
  });
52
52
  (0, globals_1.describe)("RadioButtonsQuestion", () => {
@@ -74,7 +74,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
74
74
  schemaVersion: "1.0"
75
75
  }
76
76
  };
77
- (0, globals_1.expect)(() => optionBasedQuestions_1.RadioButtonsQuestion.parse(validRadioButtonsQuestion)).not.toThrow();
77
+ (0, globals_1.expect)(() => optionBasedQuestions_1.RadioButtonsQuestionSchema.parse(validRadioButtonsQuestion)).not.toThrow();
78
78
  });
79
79
  (0, globals_1.it)("should throw an error for an invalid RadioButtonsQuestion object", () => {
80
80
  const invalidRadioButtonsQuestion = {
@@ -93,7 +93,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
93
93
  schemaVersion: "1.0"
94
94
  }
95
95
  };
96
- (0, globals_1.expect)(() => optionBasedQuestions_1.RadioButtonsQuestion.parse(invalidRadioButtonsQuestion)).toThrow();
96
+ (0, globals_1.expect)(() => optionBasedQuestions_1.RadioButtonsQuestionSchema.parse(invalidRadioButtonsQuestion)).toThrow();
97
97
  });
98
98
  });
99
99
  (0, globals_1.describe)("SelectBoxQuestion", () => {
@@ -124,7 +124,7 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
124
124
  schemaVersion: "1.0"
125
125
  }
126
126
  };
127
- (0, globals_1.expect)(() => optionBasedQuestions_1.SelectBoxQuestion.parse(validSelectBoxQuestion)).not.toThrow();
127
+ (0, globals_1.expect)(() => optionBasedQuestions_1.SelectBoxQuestionSchema.parse(validSelectBoxQuestion)).not.toThrow();
128
128
  });
129
129
  (0, globals_1.it)("should throw an error for an invalid SelectBoxQuestion object", () => {
130
130
  const invalidSelectBoxQuestion = {
@@ -147,6 +147,6 @@ const optionBasedQuestions_1 = require("../optionBasedQuestions");
147
147
  schemaVersion: "1.0"
148
148
  }
149
149
  };
150
- (0, globals_1.expect)(() => optionBasedQuestions_1.SelectBoxQuestion.parse(invalidSelectBoxQuestion)).toThrow();
150
+ (0, globals_1.expect)(() => optionBasedQuestions_1.SelectBoxQuestionSchema.parse(invalidSelectBoxQuestion)).toThrow();
151
151
  });
152
152
  });
@@ -12,7 +12,7 @@ describe("Primitive Questions Zod Schemas", () => {
12
12
  checked: true,
13
13
  },
14
14
  };
15
- expect(() => primitiveQuestions_1.BooleanQuestion.parse(validBooleanQuestion)).not.toThrow();
15
+ expect(() => primitiveQuestions_1.BooleanQuestionSchema.parse(validBooleanQuestion)).not.toThrow();
16
16
  });
17
17
  it("should invalidate an invalid BooleanQuestion", () => {
18
18
  const invalidBooleanQuestion = {
@@ -24,7 +24,7 @@ describe("Primitive Questions Zod Schemas", () => {
24
24
  checked: "true", // Invalid type
25
25
  },
26
26
  };
27
- expect(() => primitiveQuestions_1.BooleanQuestion.parse(invalidBooleanQuestion)).toThrow();
27
+ expect(() => primitiveQuestions_1.BooleanQuestionSchema.parse(invalidBooleanQuestion)).toThrow();
28
28
  });
29
29
  it("should validate a valid CurrencyQuestion", () => {
30
30
  const validCurrencyQuestion = {
@@ -39,7 +39,7 @@ describe("Primitive Questions Zod Schemas", () => {
39
39
  step: 0.01,
40
40
  },
41
41
  };
42
- expect(() => primitiveQuestions_1.CurrencyQuestion.parse(validCurrencyQuestion)).not.toThrow();
42
+ expect(() => primitiveQuestions_1.CurrencyQuestionSchema.parse(validCurrencyQuestion)).not.toThrow();
43
43
  });
44
44
  it("should invalidate an invalid CurrencyQuestion", () => {
45
45
  const invalidCurrencyQuestion = {
@@ -51,7 +51,7 @@ describe("Primitive Questions Zod Schemas", () => {
51
51
  max: "100", // Invalid type
52
52
  },
53
53
  };
54
- expect(() => primitiveQuestions_1.CurrencyQuestion.parse(invalidCurrencyQuestion)).toThrow();
54
+ expect(() => primitiveQuestions_1.CurrencyQuestionSchema.parse(invalidCurrencyQuestion)).toThrow();
55
55
  });
56
56
  it("should validate a valid EmailQuestion", () => {
57
57
  const validEmailQuestion = {
@@ -66,7 +66,7 @@ describe("Primitive Questions Zod Schemas", () => {
66
66
  pattern: "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
67
67
  },
68
68
  };
69
- expect(() => primitiveQuestions_1.EmailQuestion.parse(validEmailQuestion)).not.toThrow();
69
+ expect(() => primitiveQuestions_1.EmailQuestionSchema.parse(validEmailQuestion)).not.toThrow();
70
70
  });
71
71
  it("should invalidate an invalid EmailQuestion", () => {
72
72
  const invalidEmailQuestion = {
@@ -78,7 +78,7 @@ describe("Primitive Questions Zod Schemas", () => {
78
78
  maxLength: "50", // Invalid type
79
79
  },
80
80
  };
81
- expect(() => primitiveQuestions_1.EmailQuestion.parse(invalidEmailQuestion)).toThrow();
81
+ expect(() => primitiveQuestions_1.EmailQuestionSchema.parse(invalidEmailQuestion)).toThrow();
82
82
  });
83
83
  it("should validate a valid NumberQuestion", () => {
84
84
  const validNumberQuestion = {
@@ -92,7 +92,7 @@ describe("Primitive Questions Zod Schemas", () => {
92
92
  step: 1,
93
93
  },
94
94
  };
95
- expect(() => primitiveQuestions_1.NumberQuestion.parse(validNumberQuestion)).not.toThrow();
95
+ expect(() => primitiveQuestions_1.NumberQuestionSchema.parse(validNumberQuestion)).not.toThrow();
96
96
  });
97
97
  it("should invalidate an invalid NumberQuestion", () => {
98
98
  const invalidNumberQuestion = {
@@ -104,7 +104,7 @@ describe("Primitive Questions Zod Schemas", () => {
104
104
  step: "1", // Invalid type
105
105
  },
106
106
  };
107
- expect(() => primitiveQuestions_1.NumberQuestion.parse(invalidNumberQuestion)).toThrow();
107
+ expect(() => primitiveQuestions_1.NumberQuestionSchema.parse(invalidNumberQuestion)).toThrow();
108
108
  });
109
109
  it("should validate a valid TextAreaQuestion", () => {
110
110
  const validTextAreaQuestion = {
@@ -120,7 +120,7 @@ describe("Primitive Questions Zod Schemas", () => {
120
120
  minLength: 10,
121
121
  },
122
122
  };
123
- expect(() => primitiveQuestions_1.TextAreaQuestion.parse(validTextAreaQuestion)).not.toThrow();
123
+ expect(() => primitiveQuestions_1.TextAreaQuestionSchema.parse(validTextAreaQuestion)).not.toThrow();
124
124
  });
125
125
  it("should invalidate an invalid TextAreaQuestion", () => {
126
126
  const invalidTextAreaQuestion = {
@@ -132,7 +132,7 @@ describe("Primitive Questions Zod Schemas", () => {
132
132
  cols: "30", // Invalid type
133
133
  },
134
134
  };
135
- expect(() => primitiveQuestions_1.TextAreaQuestion.parse(invalidTextAreaQuestion)).toThrow();
135
+ expect(() => primitiveQuestions_1.TextAreaQuestionSchema.parse(invalidTextAreaQuestion)).toThrow();
136
136
  });
137
137
  it("should validate a valid TextQuestion", () => {
138
138
  const validTextQuestion = {
@@ -146,7 +146,7 @@ describe("Primitive Questions Zod Schemas", () => {
146
146
  pattern: "^[a-zA-Z]+$",
147
147
  },
148
148
  };
149
- expect(() => primitiveQuestions_1.TextQuestion.parse(validTextQuestion)).not.toThrow();
149
+ expect(() => primitiveQuestions_1.TextQuestionSchema.parse(validTextQuestion)).not.toThrow();
150
150
  });
151
151
  it("should invalidate an invalid TextQuestion", () => {
152
152
  const invalidTextQuestion = {
@@ -158,7 +158,7 @@ describe("Primitive Questions Zod Schemas", () => {
158
158
  maxLength: "100", // Invalid type
159
159
  },
160
160
  };
161
- expect(() => primitiveQuestions_1.TextQuestion.parse(invalidTextQuestion)).toThrow();
161
+ expect(() => primitiveQuestions_1.TextQuestionSchema.parse(invalidTextQuestion)).toThrow();
162
162
  });
163
163
  it("should validate a valid URLQuestion", () => {
164
164
  const validURLQuestion = {
@@ -172,7 +172,7 @@ describe("Primitive Questions Zod Schemas", () => {
172
172
  pattern: "https?://.+",
173
173
  },
174
174
  };
175
- expect(() => primitiveQuestions_1.URLQuestion.parse(validURLQuestion)).not.toThrow();
175
+ expect(() => primitiveQuestions_1.URLQuestionSchema.parse(validURLQuestion)).not.toThrow();
176
176
  });
177
177
  it("should invalidate an invalid URLQuestion", () => {
178
178
  const invalidURLQuestion = {
@@ -184,6 +184,6 @@ describe("Primitive Questions Zod Schemas", () => {
184
184
  maxLength: "200", // Invalid type
185
185
  },
186
186
  };
187
- expect(() => primitiveQuestions_1.URLQuestion.parse(invalidURLQuestion)).toThrow();
187
+ expect(() => primitiveQuestions_1.URLQuestionSchema.parse(invalidURLQuestion)).toThrow();
188
188
  });
189
189
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const DatePickerQuestion: z.ZodObject<{
2
+ export declare const DatePickerQuestionSchema: z.ZodObject<{
3
3
  meta: z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
5
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -48,7 +48,7 @@ export declare const DatePickerQuestion: z.ZodObject<{
48
48
  step?: number | undefined;
49
49
  };
50
50
  }>;
51
- export declare const DateRangeQuestion: z.ZodObject<{
51
+ export declare const DateRangeQuestionSchema: z.ZodObject<{
52
52
  meta: z.ZodObject<{
53
53
  schemaVersion: z.ZodLiteral<"1.0">;
54
54
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -240,5 +240,5 @@ export declare const DateRangeQuestion: z.ZodObject<{
240
240
  };
241
241
  };
242
242
  }>;
243
- export type DatePickerQuestionType = z.infer<typeof DatePickerQuestion>;
244
- export type DateRangeQuestionType = z.infer<typeof DateRangeQuestion>;
243
+ export type DatePickerQuestionType = z.infer<typeof DatePickerQuestionSchema>;
244
+ export type DateRangeQuestionType = z.infer<typeof DateRangeQuestionSchema>;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateRangeQuestion = exports.DatePickerQuestion = void 0;
3
+ exports.DateRangeQuestionSchema = exports.DatePickerQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  // Date picker question and answer
7
- exports.DatePickerQuestion = question_1.Question.merge(zod_1.z.object({
7
+ exports.DatePickerQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
8
8
  type: zod_1.z.literal('datePicker'), // The type of question
9
9
  attributes: zod_1.z.object({
10
10
  max: zod_1.z.string().optional(), // The maximum date (no default)
@@ -13,15 +13,15 @@ exports.DatePickerQuestion = question_1.Question.merge(zod_1.z.object({
13
13
  })
14
14
  }));
15
15
  // Date range question and answer
16
- exports.DateRangeQuestion = question_1.Question.merge(zod_1.z.object({
16
+ exports.DateRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
17
17
  type: zod_1.z.literal('dateRange'), // The type of question
18
18
  columns: zod_1.z.object({
19
- start: exports.DatePickerQuestion.merge(zod_1.z.object({
19
+ start: exports.DatePickerQuestionSchema.merge(zod_1.z.object({
20
20
  attributes: zod_1.z.object({
21
21
  label: zod_1.z.string() // The label for the start date picker
22
22
  })
23
23
  })),
24
- end: exports.DatePickerQuestion.merge(zod_1.z.object({
24
+ end: exports.DatePickerQuestionSchema.merge(zod_1.z.object({
25
25
  attributes: zod_1.z.object({
26
26
  label: zod_1.z.string() // The label for the end date picker
27
27
  })
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const FilteredSearchQuestion: z.ZodObject<{
2
+ export declare const FilteredSearchQuestionSchema: z.ZodObject<{
3
3
  meta: z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
5
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -148,7 +148,7 @@ export declare const FilteredSearchQuestion: z.ZodObject<{
148
148
  query?: string | undefined;
149
149
  };
150
150
  }>;
151
- export declare const TypeaheadSearchQuestion: z.ZodObject<{
151
+ export declare const TypeaheadSearchQuestionSchema: z.ZodObject<{
152
152
  meta: z.ZodObject<{
153
153
  schemaVersion: z.ZodLiteral<"1.0">;
154
154
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -284,5 +284,5 @@ export declare const TypeaheadSearchQuestion: z.ZodObject<{
284
284
  query?: string | undefined;
285
285
  };
286
286
  }>;
287
- export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestion>;
288
- export type TypeaheadSearchQuestionType = z.infer<typeof TypeaheadSearchQuestion>;
287
+ export type FilteredSearchQuestionType = z.infer<typeof FilteredSearchQuestionSchema>;
288
+ export type TypeaheadSearchQuestionType = z.infer<typeof TypeaheadSearchQuestionSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeaheadSearchQuestion = exports.FilteredSearchQuestion = void 0;
3
+ exports.TypeaheadSearchQuestionSchema = exports.FilteredSearchQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  // An input variable for a GraphQL query
@@ -27,7 +27,7 @@ const GraphQLQuery = zod_1.z.object({
27
27
  variables: zod_1.z.array(GraphQLVariable) // The variables for the query
28
28
  });
29
29
  // Filtered search question and answer
30
- exports.FilteredSearchQuestion = question_1.Question.merge(zod_1.z.object({
30
+ exports.FilteredSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
31
31
  type: zod_1.z.literal('filteredSearch'), // The type of question
32
32
  graphQL: GraphQLQuery, // The GraphQL query options for the filtered search
33
33
  attributes: zod_1.z.object({
@@ -35,7 +35,7 @@ exports.FilteredSearchQuestion = question_1.Question.merge(zod_1.z.object({
35
35
  })
36
36
  }));
37
37
  // Typeahead search question and answer
38
- exports.TypeaheadSearchQuestion = question_1.Question.merge(zod_1.z.object({
38
+ exports.TypeaheadSearchQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
39
39
  type: zod_1.z.literal('typeaheadSearch'), // The type of question
40
40
  graphQL: GraphQLQuery, // The GraphQL query options for the typeahead search
41
41
  }));
@@ -5,7 +5,7 @@ export * from './graphQLQuestions';
5
5
  export * from './optionBasedQuestions';
6
6
  export * from './primitiveQuestions';
7
7
  export * from './tableQuestions';
8
- export declare const AnyQuestion: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
8
+ export declare const AnyQuestionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
9
9
  meta: z.ZodObject<{
10
10
  schemaVersion: z.ZodLiteral<"1.0">;
11
11
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -2639,4 +2639,4 @@ export declare const AnyQuestion: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2639
2639
  pattern?: string | undefined;
2640
2640
  };
2641
2641
  }>]>;
2642
- export type AnyQuestionType = z.infer<typeof AnyQuestion>;
2642
+ export type AnyQuestionType = z.infer<typeof AnyQuestionSchema>;
@@ -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.AnyQuestion = void 0;
17
+ exports.AnyQuestionSchema = void 0;
18
18
  const zod_1 = require("zod");
19
19
  const primitiveQuestions_1 = require("./primitiveQuestions");
20
20
  const dateQuestions_1 = require("./dateQuestions");
@@ -29,20 +29,20 @@ __exportStar(require("./optionBasedQuestions"), exports);
29
29
  __exportStar(require("./primitiveQuestions"), exports);
30
30
  __exportStar(require("./tableQuestions"), exports);
31
31
  // All of the possible questions
32
- exports.AnyQuestion = zod_1.z.discriminatedUnion('type', [
33
- primitiveQuestions_1.BooleanQuestion,
34
- optionBasedQuestions_1.CheckboxesQuestion,
35
- primitiveQuestions_1.CurrencyQuestion,
36
- dateQuestions_1.DatePickerQuestion,
37
- dateQuestions_1.DateRangeQuestion,
38
- primitiveQuestions_1.EmailQuestion,
39
- graphQLQuestions_1.FilteredSearchQuestion,
40
- primitiveQuestions_1.NumberQuestion,
41
- optionBasedQuestions_1.RadioButtonsQuestion,
42
- optionBasedQuestions_1.SelectBoxQuestion,
43
- tableQuestions_1.TableQuestion,
44
- primitiveQuestions_1.TextAreaQuestion,
45
- primitiveQuestions_1.TextQuestion,
46
- graphQLQuestions_1.TypeaheadSearchQuestion,
47
- primitiveQuestions_1.URLQuestion
32
+ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
33
+ primitiveQuestions_1.BooleanQuestionSchema,
34
+ optionBasedQuestions_1.CheckboxesQuestionSchema,
35
+ primitiveQuestions_1.CurrencyQuestionSchema,
36
+ dateQuestions_1.DatePickerQuestionSchema,
37
+ dateQuestions_1.DateRangeQuestionSchema,
38
+ primitiveQuestions_1.EmailQuestionSchema,
39
+ graphQLQuestions_1.FilteredSearchQuestionSchema,
40
+ primitiveQuestions_1.NumberQuestionSchema,
41
+ optionBasedQuestions_1.RadioButtonsQuestionSchema,
42
+ optionBasedQuestions_1.SelectBoxQuestionSchema,
43
+ tableQuestions_1.TableQuestionSchema,
44
+ primitiveQuestions_1.TextAreaQuestionSchema,
45
+ primitiveQuestions_1.TextQuestionSchema,
46
+ graphQLQuestions_1.TypeaheadSearchQuestionSchema,
47
+ primitiveQuestions_1.URLQuestionSchema
48
48
  ]);
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const CheckboxesQuestion: z.ZodObject<{
2
+ export declare const CheckboxesQuestionSchema: z.ZodObject<{
3
3
  meta: z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
5
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -72,7 +72,7 @@ export declare const CheckboxesQuestion: z.ZodObject<{
72
72
  labelTranslationKey?: string | undefined;
73
73
  };
74
74
  }>;
75
- export declare const RadioButtonsQuestion: z.ZodObject<{
75
+ export declare const RadioButtonsQuestionSchema: z.ZodObject<{
76
76
  meta: z.ZodObject<{
77
77
  schemaVersion: z.ZodLiteral<"1.0">;
78
78
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -145,7 +145,7 @@ export declare const RadioButtonsQuestion: z.ZodObject<{
145
145
  labelTranslationKey?: string | undefined;
146
146
  };
147
147
  }>;
148
- export declare const SelectBoxQuestion: z.ZodObject<{
148
+ export declare const SelectBoxQuestionSchema: z.ZodObject<{
149
149
  meta: z.ZodObject<{
150
150
  schemaVersion: z.ZodLiteral<"1.0">;
151
151
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -231,6 +231,6 @@ export declare const SelectBoxQuestion: z.ZodObject<{
231
231
  multiple?: boolean | undefined;
232
232
  };
233
233
  }>;
234
- export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestion>;
235
- export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestion>;
236
- export type SelectBoxQuestionType = z.infer<typeof SelectBoxQuestion>;
234
+ export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
235
+ export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
236
+ export type SelectBoxQuestionType = z.infer<typeof SelectBoxQuestionSchema>;
@@ -1,43 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectBoxQuestion = exports.RadioButtonsQuestion = exports.CheckboxesQuestion = void 0;
3
+ exports.SelectBoxQuestionSchema = exports.RadioButtonsQuestionSchema = exports.CheckboxesQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  // A select box, radio buttons, or checkboxes option
7
- const Option = zod_1.z.object({
7
+ const OptionSchema = zod_1.z.object({
8
8
  type: zod_1.z.literal('option'), // The type of option
9
9
  attributes: zod_1.z.object({
10
10
  label: zod_1.z.string(), // The label of the option
11
11
  value: zod_1.z.string(), // The value of the option
12
12
  }),
13
13
  });
14
- const BaseOptionAttributes = Option.shape.attributes;
15
- const CheckedOption = zod_1.z.object({
14
+ const BaseOptionAttributes = OptionSchema.shape.attributes;
15
+ const CheckedOptionSchema = zod_1.z.object({
16
16
  type: zod_1.z.literal('option'),
17
17
  attributes: BaseOptionAttributes.extend({
18
18
  checked: zod_1.z.boolean().optional(),
19
19
  }),
20
20
  });
21
- const SelectedOption = zod_1.z.object({
21
+ const SelectedOptionSchema = zod_1.z.object({
22
22
  type: zod_1.z.literal('option'),
23
23
  attributes: BaseOptionAttributes.extend({
24
24
  selected: zod_1.z.boolean().optional(),
25
25
  }),
26
26
  });
27
27
  // Check boxes question and answer
28
- exports.CheckboxesQuestion = question_1.Question.merge(zod_1.z.object({
28
+ exports.CheckboxesQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
29
29
  type: zod_1.z.literal('checkBoxes'), // The type of question
30
- options: zod_1.z.array(CheckedOption)
30
+ options: zod_1.z.array(CheckedOptionSchema)
31
31
  }));
32
32
  // Radio buttons question and answer
33
- exports.RadioButtonsQuestion = question_1.Question.merge(zod_1.z.object({
33
+ exports.RadioButtonsQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
34
34
  type: zod_1.z.literal('radioButtons'), // The type of question
35
- options: zod_1.z.array(SelectedOption)
35
+ options: zod_1.z.array(SelectedOptionSchema)
36
36
  }));
37
37
  // Select box question and answer
38
- exports.SelectBoxQuestion = question_1.Question.merge(zod_1.z.object({
38
+ exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
39
39
  type: zod_1.z.literal('selectBox'), // The type of question
40
- options: zod_1.z.array(SelectedOption),
40
+ options: zod_1.z.array(SelectedOptionSchema),
41
41
  attributes: zod_1.z.object({
42
42
  multiple: zod_1.z.boolean().optional() // Whether to allow multiple selections (default is false)
43
43
  })
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const BooleanQuestion: z.ZodObject<{
2
+ export declare const BooleanQuestionSchema: z.ZodObject<{
3
3
  meta: z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
5
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -38,7 +38,7 @@ export declare const BooleanQuestion: z.ZodObject<{
38
38
  checked?: boolean | undefined;
39
39
  };
40
40
  }>;
41
- export declare const NumberQuestion: z.ZodObject<{
41
+ export declare const NumberQuestionSchema: z.ZodObject<{
42
42
  meta: z.ZodObject<{
43
43
  schemaVersion: z.ZodLiteral<"1.0">;
44
44
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -87,7 +87,7 @@ export declare const NumberQuestion: z.ZodObject<{
87
87
  step?: number | undefined;
88
88
  };
89
89
  }>;
90
- export declare const CurrencyQuestion: z.ZodObject<{
90
+ export declare const CurrencyQuestionSchema: z.ZodObject<{
91
91
  attributes: z.ZodObject<{
92
92
  max: z.ZodOptional<z.ZodNumber>;
93
93
  min: z.ZodOptional<z.ZodNumber>;
@@ -131,7 +131,7 @@ export declare const CurrencyQuestion: z.ZodObject<{
131
131
  step?: number | undefined;
132
132
  };
133
133
  }>;
134
- export declare const EmailQuestion: z.ZodObject<{
134
+ export declare const EmailQuestionSchema: z.ZodObject<{
135
135
  meta: z.ZodObject<{
136
136
  schemaVersion: z.ZodLiteral<"1.0">;
137
137
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -185,7 +185,7 @@ export declare const EmailQuestion: z.ZodObject<{
185
185
  pattern?: string | undefined;
186
186
  };
187
187
  }>;
188
- export declare const TextAreaQuestion: z.ZodObject<{} & {
188
+ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
189
189
  type: z.ZodLiteral<"textArea">;
190
190
  attributes: z.ZodObject<{
191
191
  cols: z.ZodOptional<z.ZodNumber>;
@@ -233,7 +233,7 @@ export declare const TextAreaQuestion: z.ZodObject<{} & {
233
233
  rows?: number | undefined;
234
234
  };
235
235
  }>;
236
- export declare const TextQuestion: z.ZodObject<{
236
+ export declare const TextQuestionSchema: z.ZodObject<{
237
237
  meta: z.ZodObject<{
238
238
  schemaVersion: z.ZodLiteral<"1.0">;
239
239
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -282,7 +282,7 @@ export declare const TextQuestion: z.ZodObject<{
282
282
  pattern?: string | undefined;
283
283
  };
284
284
  }>;
285
- export declare const URLQuestion: z.ZodObject<{
285
+ export declare const URLQuestionSchema: z.ZodObject<{
286
286
  meta: z.ZodObject<{
287
287
  schemaVersion: z.ZodLiteral<"1.0">;
288
288
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -331,10 +331,10 @@ export declare const URLQuestion: z.ZodObject<{
331
331
  pattern?: string | undefined;
332
332
  };
333
333
  }>;
334
- export type BooleanQuestionType = z.infer<typeof BooleanQuestion>;
335
- export type CurrencyQuestionType = z.infer<typeof CurrencyQuestion>;
336
- export type EmailQuestionType = z.infer<typeof EmailQuestion>;
337
- export type NumberQuestionType = z.infer<typeof NumberQuestion>;
338
- export type TextAreaQuestionType = z.infer<typeof TextAreaQuestion>;
339
- export type TextQuestionType = z.infer<typeof TextQuestion>;
340
- export type URLQuestionType = z.infer<typeof URLQuestion>;
334
+ export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
335
+ export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
336
+ export type EmailQuestionType = z.infer<typeof EmailQuestionSchema>;
337
+ export type NumberQuestionType = z.infer<typeof NumberQuestionSchema>;
338
+ export type TextAreaQuestionType = z.infer<typeof TextAreaQuestionSchema>;
339
+ export type TextQuestionType = z.infer<typeof TextQuestionSchema>;
340
+ export type URLQuestionType = z.infer<typeof URLQuestionSchema>;