@dmptool/types 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +127 -29
  2. package/dist/answers/__tests__/answers.spec.d.ts +1 -0
  3. package/dist/answers/__tests__/answers.spec.js +127 -0
  4. package/dist/answers/answer.d.ts +25 -0
  5. package/dist/answers/answer.js +13 -0
  6. package/dist/answers/dateAnswers.d.ts +66 -0
  7. package/dist/answers/dateAnswers.js +16 -0
  8. package/dist/answers/graphQLAnswers.d.ts +51 -0
  9. package/dist/answers/graphQLAnswers.js +14 -0
  10. package/dist/answers/index.d.ts +880 -0
  11. package/dist/answers/index.js +48 -0
  12. package/dist/answers/optionBasedAnswers.d.ts +76 -0
  13. package/dist/answers/optionBasedAnswers.js +18 -0
  14. package/dist/answers/primitiveAnswers.d.ts +176 -0
  15. package/dist/answers/primitiveAnswers.js +34 -0
  16. package/dist/answers/tableAnswers.d.ts +876 -0
  17. package/dist/answers/tableAnswers.js +31 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +19 -0
  20. package/dist/questions/__tests__/dateQuestions.spec.d.ts +1 -0
  21. package/dist/questions/__tests__/dateQuestions.spec.js +149 -0
  22. package/dist/questions/__tests__/graphQLQuestions.spec.d.ts +1 -0
  23. package/dist/questions/__tests__/graphQLQuestions.spec.js +87 -0
  24. package/dist/questions/__tests__/optionBasedQuestions.spec.d.ts +1 -0
  25. package/dist/questions/__tests__/optionBasedQuestions.spec.js +152 -0
  26. package/dist/questions/__tests__/primitiveQuestions.spec.d.ts +1 -0
  27. package/dist/questions/__tests__/primitiveQuestions.spec.js +189 -0
  28. package/dist/{dateQuestions.js → questions/dateQuestions.js} +3 -3
  29. package/dist/{graphQLQuestions.js → questions/graphQLQuestions.js} +3 -3
  30. package/dist/{tableQuestions.d.ts → questions/index.d.ts} +97 -1650
  31. package/dist/questions/index.js +48 -0
  32. package/dist/{optionBasedQuestions.js → questions/optionBasedQuestions.js} +4 -4
  33. package/dist/{primitiveQuestions.d.ts → questions/primitiveQuestions.d.ts} +0 -27
  34. package/dist/{primitiveQuestions.js → questions/primitiveQuestions.js} +8 -35
  35. package/dist/questions/question.d.ts +29 -0
  36. package/dist/questions/question.js +32 -0
  37. package/dist/questions/tableQuestions.d.ts +2638 -0
  38. package/dist/{tableQuestions.js → questions/tableQuestions.js} +5 -22
  39. package/dist/schemas/anyAnswer.schema.json +195 -59
  40. package/dist/schemas/anyTableColumnAnswer.schema.json +336 -0
  41. package/dist/schemas/anyTableColumnQuestion.schema.json +637 -0
  42. package/dist/schemas/booleanAnswer.schema.json +15 -1
  43. package/dist/schemas/checkboxesAnswer.schema.json +15 -1
  44. package/dist/schemas/currencyAnswer.schema.json +15 -1
  45. package/dist/schemas/datePickerAnswer.schema.json +15 -1
  46. package/dist/schemas/dateRangeAnswer.schema.json +15 -1
  47. package/dist/schemas/emailAnswer.schema.json +15 -1
  48. package/dist/schemas/filteredSearchAnswer.schema.json +15 -1
  49. package/dist/schemas/numberAnswer.schema.json +15 -1
  50. package/dist/schemas/radioButtonsAnswer.schema.json +15 -1
  51. package/dist/schemas/selectBoxAnswer.schema.json +19 -2
  52. package/dist/schemas/tableAnswer.schema.json +91 -18
  53. package/dist/schemas/textAnswer.schema.json +15 -1
  54. package/dist/schemas/textAreaAnswer.schema.json +15 -1
  55. package/dist/schemas/typeaheadSearchAnswer.schema.json +15 -1
  56. package/dist/schemas/urlAnswer.schema.json +15 -1
  57. package/package.json +8 -1
  58. package/dist/answers.d.ts +0 -558
  59. package/dist/answers.js +0 -87
  60. /package/dist/{dateQuestions.d.ts → questions/dateQuestions.d.ts} +0 -0
  61. /package/dist/{graphQLQuestions.d.ts → questions/graphQLQuestions.d.ts} +0 -0
  62. /package/dist/{optionBasedQuestions.d.ts → questions/optionBasedQuestions.d.ts} +0 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.AnyAnswer = void 0;
18
+ const zod_1 = require("zod");
19
+ const dateAnswers_1 = require("./dateAnswers");
20
+ const graphQLAnswers_1 = require("./graphQLAnswers");
21
+ const optionBasedAnswers_1 = require("./optionBasedAnswers");
22
+ const primitiveAnswers_1 = require("./primitiveAnswers");
23
+ const tableAnswers_1 = require("./tableAnswers");
24
+ // reexport everything
25
+ __exportStar(require("./answer"), exports);
26
+ __exportStar(require("./dateAnswers"), exports);
27
+ __exportStar(require("./graphQLAnswers"), exports);
28
+ __exportStar(require("./optionBasedAnswers"), exports);
29
+ __exportStar(require("./primitiveAnswers"), exports);
30
+ __exportStar(require("./tableAnswers"), exports);
31
+ // Union of all possible answers
32
+ exports.AnyAnswer = zod_1.z.discriminatedUnion('type', [
33
+ primitiveAnswers_1.BooleanAnswer,
34
+ optionBasedAnswers_1.CheckboxesAnswer,
35
+ primitiveAnswers_1.CurrencyAnswer,
36
+ dateAnswers_1.DatePickerAnswer,
37
+ dateAnswers_1.DateRangeAnswer,
38
+ primitiveAnswers_1.EmailAnswer,
39
+ graphQLAnswers_1.FilteredSearchAnswer,
40
+ primitiveAnswers_1.NumberAnswer,
41
+ optionBasedAnswers_1.RadioButtonsAnswer,
42
+ optionBasedAnswers_1.SelectBoxAnswer,
43
+ tableAnswers_1.TableAnswer,
44
+ primitiveAnswers_1.TextAnswer,
45
+ primitiveAnswers_1.TextAreaAnswer,
46
+ graphQLAnswers_1.TypeaheadSearchAnswer,
47
+ primitiveAnswers_1.URLAnswer
48
+ ]);
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ export declare const CheckboxesAnswer: 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<"checkBoxes">;
12
+ answer: z.ZodArray<z.ZodString, "many">;
13
+ }, "strip", z.ZodTypeAny, {
14
+ type: "checkBoxes";
15
+ meta: {
16
+ schemaVersion: "1.0";
17
+ };
18
+ answer: string[];
19
+ }, {
20
+ type: "checkBoxes";
21
+ meta: {
22
+ schemaVersion: "1.0";
23
+ };
24
+ answer: string[];
25
+ }>;
26
+ export declare const RadioButtonsAnswer: z.ZodObject<{
27
+ meta: z.ZodObject<{
28
+ schemaVersion: z.ZodLiteral<"1.0">;
29
+ }, "strip", z.ZodTypeAny, {
30
+ schemaVersion: "1.0";
31
+ }, {
32
+ schemaVersion: "1.0";
33
+ }>;
34
+ } & {
35
+ type: z.ZodLiteral<"radioButtons">;
36
+ answer: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: "radioButtons";
39
+ meta: {
40
+ schemaVersion: "1.0";
41
+ };
42
+ answer: string;
43
+ }, {
44
+ type: "radioButtons";
45
+ meta: {
46
+ schemaVersion: "1.0";
47
+ };
48
+ answer: string;
49
+ }>;
50
+ export declare const SelectBoxAnswer: z.ZodObject<{
51
+ meta: z.ZodObject<{
52
+ schemaVersion: z.ZodLiteral<"1.0">;
53
+ }, "strip", z.ZodTypeAny, {
54
+ schemaVersion: "1.0";
55
+ }, {
56
+ schemaVersion: "1.0";
57
+ }>;
58
+ } & {
59
+ type: z.ZodLiteral<"selectBox">;
60
+ answer: z.ZodArray<z.ZodString, "many">;
61
+ }, "strip", z.ZodTypeAny, {
62
+ type: "selectBox";
63
+ meta: {
64
+ schemaVersion: "1.0";
65
+ };
66
+ answer: string[];
67
+ }, {
68
+ type: "selectBox";
69
+ meta: {
70
+ schemaVersion: "1.0";
71
+ };
72
+ answer: string[];
73
+ }>;
74
+ export type CheckboxesAnswerType = z.infer<typeof CheckboxesAnswer>;
75
+ export type RadioButtonsAnswerType = z.infer<typeof RadioButtonsAnswer>;
76
+ export type SelectBoxAnswerType = z.infer<typeof SelectBoxAnswer>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectBoxAnswer = exports.RadioButtonsAnswer = exports.CheckboxesAnswer = void 0;
4
+ const zod_1 = require("zod");
5
+ const answer_1 = require("./answer");
6
+ // Answers to Option Based Question Types
7
+ exports.CheckboxesAnswer = answer_1.Answer.merge(zod_1.z.object({
8
+ type: zod_1.z.literal('checkBoxes'), // The type of answer
9
+ answer: zod_1.z.array(zod_1.z.string()) // The answer to the question (array of strings)
10
+ }));
11
+ exports.RadioButtonsAnswer = answer_1.Answer.merge(zod_1.z.object({
12
+ type: zod_1.z.literal('radioButtons'), // The type of answer
13
+ answer: zod_1.z.string() // The answer to the question (string)
14
+ }));
15
+ exports.SelectBoxAnswer = answer_1.Answer.merge(zod_1.z.object({
16
+ type: zod_1.z.literal('selectBox'), // The type of answer
17
+ answer: zod_1.z.array(zod_1.z.string()) // The answer to the question (array of strings)
18
+ }));
@@ -0,0 +1,176 @@
1
+ import { z } from 'zod';
2
+ export declare const BooleanAnswer: 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
+ export declare const CurrencyAnswer: z.ZodObject<{
27
+ meta: z.ZodObject<{
28
+ schemaVersion: z.ZodLiteral<"1.0">;
29
+ }, "strip", z.ZodTypeAny, {
30
+ schemaVersion: "1.0";
31
+ }, {
32
+ schemaVersion: "1.0";
33
+ }>;
34
+ } & {
35
+ type: z.ZodLiteral<"currency">;
36
+ answer: z.ZodNumber;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: "currency";
39
+ meta: {
40
+ schemaVersion: "1.0";
41
+ };
42
+ answer: number;
43
+ }, {
44
+ type: "currency";
45
+ meta: {
46
+ schemaVersion: "1.0";
47
+ };
48
+ answer: number;
49
+ }>;
50
+ export declare const EmailAnswer: z.ZodObject<{
51
+ meta: z.ZodObject<{
52
+ schemaVersion: z.ZodLiteral<"1.0">;
53
+ }, "strip", z.ZodTypeAny, {
54
+ schemaVersion: "1.0";
55
+ }, {
56
+ schemaVersion: "1.0";
57
+ }>;
58
+ } & {
59
+ type: z.ZodLiteral<"email">;
60
+ answer: z.ZodString;
61
+ }, "strip", z.ZodTypeAny, {
62
+ type: "email";
63
+ meta: {
64
+ schemaVersion: "1.0";
65
+ };
66
+ answer: string;
67
+ }, {
68
+ type: "email";
69
+ meta: {
70
+ schemaVersion: "1.0";
71
+ };
72
+ answer: string;
73
+ }>;
74
+ export declare const NumberAnswer: z.ZodObject<{
75
+ meta: z.ZodObject<{
76
+ schemaVersion: z.ZodLiteral<"1.0">;
77
+ }, "strip", z.ZodTypeAny, {
78
+ schemaVersion: "1.0";
79
+ }, {
80
+ schemaVersion: "1.0";
81
+ }>;
82
+ } & {
83
+ type: z.ZodLiteral<"number">;
84
+ answer: z.ZodNumber;
85
+ }, "strip", z.ZodTypeAny, {
86
+ type: "number";
87
+ meta: {
88
+ schemaVersion: "1.0";
89
+ };
90
+ answer: number;
91
+ }, {
92
+ type: "number";
93
+ meta: {
94
+ schemaVersion: "1.0";
95
+ };
96
+ answer: number;
97
+ }>;
98
+ export declare const TextAnswer: 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<"text">;
108
+ answer: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ type: "text";
111
+ meta: {
112
+ schemaVersion: "1.0";
113
+ };
114
+ answer: string;
115
+ }, {
116
+ type: "text";
117
+ meta: {
118
+ schemaVersion: "1.0";
119
+ };
120
+ answer: string;
121
+ }>;
122
+ export declare const TextAreaAnswer: z.ZodObject<{
123
+ meta: z.ZodObject<{
124
+ schemaVersion: z.ZodLiteral<"1.0">;
125
+ }, "strip", z.ZodTypeAny, {
126
+ schemaVersion: "1.0";
127
+ }, {
128
+ schemaVersion: "1.0";
129
+ }>;
130
+ } & {
131
+ type: z.ZodLiteral<"textArea">;
132
+ answer: z.ZodString;
133
+ }, "strip", z.ZodTypeAny, {
134
+ type: "textArea";
135
+ meta: {
136
+ schemaVersion: "1.0";
137
+ };
138
+ answer: string;
139
+ }, {
140
+ type: "textArea";
141
+ meta: {
142
+ schemaVersion: "1.0";
143
+ };
144
+ answer: string;
145
+ }>;
146
+ export declare const URLAnswer: z.ZodObject<{
147
+ meta: z.ZodObject<{
148
+ schemaVersion: z.ZodLiteral<"1.0">;
149
+ }, "strip", z.ZodTypeAny, {
150
+ schemaVersion: "1.0";
151
+ }, {
152
+ schemaVersion: "1.0";
153
+ }>;
154
+ } & {
155
+ type: z.ZodLiteral<"url">;
156
+ answer: z.ZodString;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: "url";
159
+ meta: {
160
+ schemaVersion: "1.0";
161
+ };
162
+ answer: string;
163
+ }, {
164
+ type: "url";
165
+ meta: {
166
+ schemaVersion: "1.0";
167
+ };
168
+ answer: string;
169
+ }>;
170
+ export type BooleanAnswerType = z.infer<typeof BooleanAnswer>;
171
+ export type CurrencyAnswerType = z.infer<typeof CurrencyAnswer>;
172
+ export type EmailAnswerType = z.infer<typeof EmailAnswer>;
173
+ export type NumberAnswerType = z.infer<typeof NumberAnswer>;
174
+ export type TextAnswerType = z.infer<typeof TextAnswer>;
175
+ export type TextAreaAnswerType = z.infer<typeof TextAreaAnswer>;
176
+ export type URLAnswerType = z.infer<typeof URLAnswer>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URLAnswer = exports.TextAreaAnswer = exports.TextAnswer = exports.NumberAnswer = exports.EmailAnswer = exports.CurrencyAnswer = exports.BooleanAnswer = void 0;
4
+ const zod_1 = require("zod");
5
+ const answer_1 = require("./answer");
6
+ // Answers to Primitive Question Types
7
+ exports.BooleanAnswer = answer_1.Answer.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
+ exports.CurrencyAnswer = answer_1.Answer.merge(zod_1.z.object({
12
+ type: zod_1.z.literal('currency'), // The type of answer
13
+ answer: zod_1.z.number() // The answer to the question (number)
14
+ }));
15
+ exports.EmailAnswer = answer_1.Answer.merge(zod_1.z.object({
16
+ type: zod_1.z.literal('email'), // The type of question
17
+ answer: zod_1.z.string() // The answer to the question (string)
18
+ }));
19
+ exports.NumberAnswer = answer_1.Answer.merge(zod_1.z.object({
20
+ type: zod_1.z.literal('number'), // The type of answer
21
+ answer: zod_1.z.number() // The answer to the question (number)
22
+ }));
23
+ exports.TextAnswer = answer_1.Answer.merge(zod_1.z.object({
24
+ type: zod_1.z.literal('text'), // The type of answer
25
+ answer: zod_1.z.string() // The answer to the question (string)
26
+ }));
27
+ exports.TextAreaAnswer = answer_1.Answer.merge(zod_1.z.object({
28
+ type: zod_1.z.literal('textArea'), // The type of answer
29
+ answer: zod_1.z.string() // The answer to the question (string)
30
+ }));
31
+ exports.URLAnswer = answer_1.Answer.merge(zod_1.z.object({
32
+ type: zod_1.z.literal('url'), // The type of answer
33
+ answer: zod_1.z.string() // The answer to the question (string)
34
+ }));