@dmptool/types 1.0.2 → 1.0.4

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 (34) hide show
  1. package/dist/answers/__tests__/answers.spec.js +32 -32
  2. package/dist/answers/answer.d.ts +5 -5
  3. package/dist/answers/answer.js +2 -2
  4. package/dist/answers/dateAnswers.d.ts +4 -4
  5. package/dist/answers/dateAnswers.js +3 -3
  6. package/dist/answers/graphQLAnswers.d.ts +4 -4
  7. package/dist/answers/graphQLAnswers.js +3 -3
  8. package/dist/answers/index.d.ts +4 -2
  9. package/dist/answers/index.js +35 -17
  10. package/dist/answers/optionBasedAnswers.d.ts +6 -6
  11. package/dist/answers/optionBasedAnswers.js +4 -4
  12. package/dist/answers/primitiveAnswers.d.ts +14 -14
  13. package/dist/answers/primitiveAnswers.js +8 -8
  14. package/dist/answers/tableAnswers.d.ts +4 -4
  15. package/dist/answers/tableAnswers.js +18 -18
  16. package/dist/questions/__tests__/dateQuestions.spec.js +6 -6
  17. package/dist/questions/__tests__/graphQLQuestions.spec.js +4 -4
  18. package/dist/questions/__tests__/optionBasedQuestions.spec.js +6 -6
  19. package/dist/questions/__tests__/primitiveQuestions.spec.js +14 -14
  20. package/dist/questions/dateQuestions.d.ts +4 -4
  21. package/dist/questions/dateQuestions.js +5 -5
  22. package/dist/questions/graphQLQuestions.d.ts +4 -4
  23. package/dist/questions/graphQLQuestions.js +3 -3
  24. package/dist/questions/index.d.ts +4 -2
  25. package/dist/questions/index.js +35 -17
  26. package/dist/questions/optionBasedQuestions.d.ts +6 -6
  27. package/dist/questions/optionBasedQuestions.js +11 -11
  28. package/dist/questions/primitiveQuestions.d.ts +14 -14
  29. package/dist/questions/primitiveQuestions.js +8 -8
  30. package/dist/questions/question.d.ts +6 -6
  31. package/dist/questions/question.js +2 -3
  32. package/dist/questions/tableQuestions.d.ts +4 -4
  33. package/dist/questions/tableQuestions.js +18 -18
  34. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.URLQuestion = exports.TextQuestion = exports.TextAreaQuestion = exports.EmailQuestion = exports.CurrencyQuestion = exports.NumberQuestion = exports.BooleanQuestion = void 0;
3
+ exports.URLQuestionSchema = exports.TextQuestionSchema = exports.TextAreaQuestionSchema = exports.EmailQuestionSchema = exports.CurrencyQuestionSchema = exports.NumberQuestionSchema = exports.BooleanQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  // A Yes/No True/False question and answer
7
- exports.BooleanQuestion = question_1.Question.merge(zod_1.z.object({
7
+ exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
8
8
  type: zod_1.z.literal('boolean'), // The type of question
9
9
  attributes: zod_1.z.object({
10
10
  checked: zod_1.z.boolean().optional() // If it is checked by default when rendered (default is false)
11
11
  })
12
12
  }));
13
13
  // A number question and answer
14
- exports.NumberQuestion = question_1.Question.merge(zod_1.z.object({
14
+ exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
15
15
  type: zod_1.z.literal('number'), // The type of question
16
16
  attributes: zod_1.z.object({
17
17
  max: zod_1.z.number().optional(), // The maximum value (no default)
@@ -20,14 +20,14 @@ exports.NumberQuestion = question_1.Question.merge(zod_1.z.object({
20
20
  })
21
21
  }));
22
22
  // Currency question and answer
23
- exports.CurrencyQuestion = exports.NumberQuestion.merge(zod_1.z.object({
23
+ exports.CurrencyQuestionSchema = exports.NumberQuestionSchema.merge(zod_1.z.object({
24
24
  type: zod_1.z.literal('currency'), // The type of question
25
25
  meta: zod_1.z.object({
26
26
  denomination: zod_1.z.string().optional() // The currency denomination (default is USD)
27
27
  })
28
28
  }));
29
29
  // Email question and answer
30
- exports.EmailQuestion = question_1.Question.merge(zod_1.z.object({
30
+ exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
31
31
  type: zod_1.z.literal('email'), // The type of question
32
32
  attributes: zod_1.z.object({
33
33
  maxLength: zod_1.z.number().optional(), // The maximum length of the email (no default)
@@ -37,7 +37,7 @@ exports.EmailQuestion = question_1.Question.merge(zod_1.z.object({
37
37
  })
38
38
  }));
39
39
  // Text area question and answer
40
- exports.TextAreaQuestion = question_1.Question.merge(zod_1.z.object({
40
+ exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
41
41
  type: zod_1.z.literal('textArea'), // The type of question
42
42
  attributes: zod_1.z.object({
43
43
  cols: zod_1.z.number().optional(), // The number of columns (default is 20)
@@ -50,7 +50,7 @@ exports.TextAreaQuestion = question_1.Question.merge(zod_1.z.object({
50
50
  })
51
51
  }));
52
52
  // Text question and answer
53
- exports.TextQuestion = question_1.Question.merge(zod_1.z.object({
53
+ exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
54
54
  type: zod_1.z.literal('text'), // The type of question
55
55
  attributes: zod_1.z.object({
56
56
  maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
@@ -59,7 +59,7 @@ exports.TextQuestion = question_1.Question.merge(zod_1.z.object({
59
59
  }),
60
60
  }));
61
61
  // URL question and answer
62
- exports.URLQuestion = question_1.Question.merge(zod_1.z.object({
62
+ exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
63
63
  type: zod_1.z.literal('url'), // The type of question
64
64
  attributes: zod_1.z.object({
65
65
  maxLength: zod_1.z.number().optional(), // The maximum length of the URL (no default)
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const CURRENT_SCHEMA_VERSION = "1.0";
3
- export declare const QuestionTypesEnum: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "option", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
4
- export declare const Question: z.ZodObject<{
5
- type: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "option", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
3
+ export declare const QuestionTypesEnum: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
4
+ export declare const QuestionSchema: z.ZodObject<{
5
+ type: z.ZodEnum<["boolean", "checkBoxes", "currency", "datePicker", "dateRange", "email", "filteredSearch", "number", "radioButtons", "selectBox", "table", "text", "textArea", "typeaheadSearch", "url"]>;
6
6
  meta: z.ZodObject<{
7
7
  schemaVersion: z.ZodLiteral<"1.0">;
8
8
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -14,16 +14,16 @@ export declare const Question: z.ZodObject<{
14
14
  labelTranslationKey?: string | undefined;
15
15
  }>;
16
16
  }, "strip", z.ZodTypeAny, {
17
- type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "option" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
17
+ type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
18
18
  meta: {
19
19
  schemaVersion: "1.0";
20
20
  labelTranslationKey?: string | undefined;
21
21
  };
22
22
  }, {
23
- type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "option" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
23
+ type: "number" | "boolean" | "checkBoxes" | "currency" | "datePicker" | "dateRange" | "email" | "filteredSearch" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "typeaheadSearch" | "url";
24
24
  meta: {
25
25
  schemaVersion: "1.0";
26
26
  labelTranslationKey?: string | undefined;
27
27
  };
28
28
  }>;
29
- export type QuestionType = z.infer<typeof Question>;
29
+ export type QuestionType = z.infer<typeof QuestionSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Question = exports.QuestionTypesEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
3
+ exports.QuestionSchema = exports.QuestionTypesEnum = exports.CURRENT_SCHEMA_VERSION = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.CURRENT_SCHEMA_VERSION = '1.0'; // The current schema version
6
6
  // The type of question
@@ -13,7 +13,6 @@ exports.QuestionTypesEnum = zod_1.z.enum([
13
13
  'email',
14
14
  'filteredSearch',
15
15
  'number',
16
- 'option',
17
16
  'radioButtons',
18
17
  'selectBox',
19
18
  'table',
@@ -23,7 +22,7 @@ exports.QuestionTypesEnum = zod_1.z.enum([
23
22
  'url'
24
23
  ]);
25
24
  // Base abstract type for all questions
26
- exports.Question = zod_1.z.object({
25
+ exports.QuestionSchema = zod_1.z.object({
27
26
  type: exports.QuestionTypesEnum, // The type of question
28
27
  meta: zod_1.z.object({
29
28
  schemaVersion: zod_1.z.literal(exports.CURRENT_SCHEMA_VERSION), // The schema version (default is CURRENT_SCHEMA_VERSION)
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const AnyTableColumnQuestion: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2
+ export declare const AnyTableColumnQuestionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3
3
  meta: z.ZodObject<{
4
4
  schemaVersion: z.ZodLiteral<"1.0">;
5
5
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -1076,7 +1076,7 @@ export declare const AnyTableColumnQuestion: z.ZodDiscriminatedUnion<"type", [z.
1076
1076
  pattern?: string | undefined;
1077
1077
  };
1078
1078
  }>]>;
1079
- export declare const TableQuestion: z.ZodObject<{
1079
+ export declare const TableQuestionSchema: z.ZodObject<{
1080
1080
  meta: z.ZodObject<{
1081
1081
  schemaVersion: z.ZodLiteral<"1.0">;
1082
1082
  labelTranslationKey: z.ZodOptional<z.ZodString>;
@@ -2634,5 +2634,5 @@ export declare const TableQuestion: z.ZodObject<{
2634
2634
  };
2635
2635
  })[];
2636
2636
  }>;
2637
- export type TableQuestionType = z.infer<typeof TableQuestion>;
2638
- export type AnyTableColumnQuestionType = z.infer<typeof AnyTableColumnQuestion>;
2637
+ export type TableQuestionType = z.infer<typeof TableQuestionSchema>;
2638
+ export type AnyTableColumnQuestionType = z.infer<typeof AnyTableColumnQuestionSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableQuestion = exports.AnyTableColumnQuestion = void 0;
3
+ exports.TableQuestionSchema = exports.AnyTableColumnQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const primitiveQuestions_1 = require("./primitiveQuestions");
6
6
  const dateQuestions_1 = require("./dateQuestions");
@@ -8,26 +8,26 @@ const optionBasedQuestions_1 = require("./optionBasedQuestions");
8
8
  const graphQLQuestions_1 = require("./graphQLQuestions");
9
9
  const question_1 = require("./question");
10
10
  // Union types for all questions and answers (tables cannot be nested so no TableQuestion here!)
11
- exports.AnyTableColumnQuestion = zod_1.z.discriminatedUnion('type', [
12
- primitiveQuestions_1.BooleanQuestion,
13
- optionBasedQuestions_1.CheckboxesQuestion,
14
- primitiveQuestions_1.CurrencyQuestion,
15
- dateQuestions_1.DatePickerQuestion,
16
- dateQuestions_1.DateRangeQuestion,
17
- primitiveQuestions_1.EmailQuestion,
18
- graphQLQuestions_1.FilteredSearchQuestion,
19
- primitiveQuestions_1.NumberQuestion,
20
- optionBasedQuestions_1.RadioButtonsQuestion,
21
- optionBasedQuestions_1.SelectBoxQuestion,
22
- primitiveQuestions_1.TextAreaQuestion,
23
- primitiveQuestions_1.TextQuestion,
24
- graphQLQuestions_1.TypeaheadSearchQuestion,
25
- primitiveQuestions_1.URLQuestion
11
+ exports.AnyTableColumnQuestionSchema = zod_1.z.discriminatedUnion('type', [
12
+ primitiveQuestions_1.BooleanQuestionSchema,
13
+ optionBasedQuestions_1.CheckboxesQuestionSchema,
14
+ primitiveQuestions_1.CurrencyQuestionSchema,
15
+ dateQuestions_1.DatePickerQuestionSchema,
16
+ dateQuestions_1.DateRangeQuestionSchema,
17
+ primitiveQuestions_1.EmailQuestionSchema,
18
+ graphQLQuestions_1.FilteredSearchQuestionSchema,
19
+ primitiveQuestions_1.NumberQuestionSchema,
20
+ optionBasedQuestions_1.RadioButtonsQuestionSchema,
21
+ optionBasedQuestions_1.SelectBoxQuestionSchema,
22
+ primitiveQuestions_1.TextAreaQuestionSchema,
23
+ primitiveQuestions_1.TextQuestionSchema,
24
+ graphQLQuestions_1.TypeaheadSearchQuestionSchema,
25
+ primitiveQuestions_1.URLQuestionSchema
26
26
  ]);
27
27
  // Table question and answer
28
- exports.TableQuestion = question_1.Question.merge(zod_1.z.object({
28
+ exports.TableQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
29
29
  type: zod_1.z.literal('table'), // The type of question
30
- columns: zod_1.z.array(exports.AnyTableColumnQuestion), // The columns of the table (note: tables cannot be nested)
30
+ columns: zod_1.z.array(exports.AnyTableColumnQuestionSchema), // The columns of the table (note: tables cannot be nested)
31
31
  attributes: zod_1.z.object({
32
32
  canAddRows: zod_1.z.boolean().optional(), // Whether to allow adding rows (default is true)
33
33
  canRemoveRows: zod_1.z.boolean().optional(), // Whether to allow removing rows (default is true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/types",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "TypeScript types for DMPTool",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",