@dmptool/types 1.0.8 → 1.1.1

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 (60) hide show
  1. package/README.md +2 -0
  2. package/dist/answers/__tests__/answers.spec.js +18 -17
  3. package/dist/answers/index.d.ts +80 -55
  4. package/dist/answers/index.js +19 -17
  5. package/dist/answers/numberAnswers.d.ts +91 -0
  6. package/dist/answers/numberAnswers.js +21 -0
  7. package/dist/answers/optionBasedAnswers.d.ts +25 -0
  8. package/dist/answers/optionBasedAnswers.js +5 -1
  9. package/dist/answers/tableAnswers.d.ts +108 -108
  10. package/dist/answers/tableAnswers.js +9 -8
  11. package/dist/answers/textAnswers.d.ts +101 -0
  12. package/dist/answers/textAnswers.js +22 -0
  13. package/dist/questions/__tests__/dateQuestions.spec.js +20 -74
  14. package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -0
  15. package/dist/questions/__tests__/numberQuestions.spec.js +108 -0
  16. package/dist/questions/__tests__/optionBasedQuestions.spec.js +91 -54
  17. package/dist/questions/__tests__/tableQuestion.spec.js +2 -0
  18. package/dist/questions/__tests__/textQuestions.spec.d.ts +1 -0
  19. package/dist/questions/__tests__/textQuestions.spec.js +120 -0
  20. package/dist/questions/dateQuestions.d.ts +159 -178
  21. package/dist/questions/dateQuestions.js +9 -15
  22. package/dist/questions/graphQLQuestions.d.ts +67 -38
  23. package/dist/questions/graphQLQuestions.js +3 -2
  24. package/dist/questions/index.d.ts +1800 -1379
  25. package/dist/questions/index.js +22 -19
  26. package/dist/questions/numberQuestions.d.ts +292 -0
  27. package/dist/questions/numberQuestions.js +28 -0
  28. package/dist/questions/optionBasedQuestions.d.ts +186 -157
  29. package/dist/questions/optionBasedQuestions.js +17 -20
  30. package/dist/questions/question.d.ts +29 -11
  31. package/dist/questions/question.js +10 -4
  32. package/dist/questions/tableQuestions.d.ts +2395 -2048
  33. package/dist/questions/tableQuestions.js +12 -10
  34. package/dist/questions/textQuestions.d.ts +261 -0
  35. package/dist/questions/textQuestions.js +42 -0
  36. package/dist/schemas/anyQuestion.schema.json +269 -238
  37. package/dist/schemas/anyTableColumnQuestion.schema.json +207 -216
  38. package/dist/schemas/booleanQuestion.schema.json +17 -11
  39. package/dist/schemas/checkboxesQuestion.schema.json +24 -27
  40. package/dist/schemas/currencyQuestion.schema.json +23 -18
  41. package/dist/schemas/dateQuestion.schema.json +21 -16
  42. package/dist/schemas/dateRangeQuestion.schema.json +31 -56
  43. package/dist/schemas/emailQuestion.schema.json +24 -19
  44. package/dist/schemas/filteredSearchQuestion.schema.json +18 -13
  45. package/dist/schemas/numberQuestion.schema.json +21 -16
  46. package/dist/schemas/numberRangeQuestion.schema.json +31 -56
  47. package/dist/schemas/radioButtonsQuestion.schema.json +24 -27
  48. package/dist/schemas/selectBoxQuestion.schema.json +27 -36
  49. package/dist/schemas/tableQuestion.schema.json +233 -234
  50. package/dist/schemas/textAreaQuestion.schema.json +22 -16
  51. package/dist/schemas/textQuestion.schema.json +21 -16
  52. package/dist/schemas/typeaheadSearchQuestion.schema.json +15 -4
  53. package/dist/schemas/urlQuestion.schema.json +21 -16
  54. package/package.json +1 -1
  55. package/dist/answers/primitiveAnswers.d.ts +0 -216
  56. package/dist/answers/primitiveAnswers.js +0 -41
  57. package/dist/questions/__tests__/primitiveQuestions.spec.js +0 -281
  58. package/dist/questions/primitiveQuestions.d.ts +0 -555
  59. package/dist/questions/primitiveQuestions.js +0 -86
  60. /package/dist/questions/__tests__/{primitiveQuestions.spec.d.ts → numberQuestions.spec.d.ts} +0 -0
@@ -8,28 +8,18 @@
8
8
  "type": "string",
9
9
  "const": "textArea"
10
10
  },
11
- "meta": {
11
+ "attributes": {
12
12
  "type": "object",
13
13
  "properties": {
14
- "schemaVersion": {
15
- "type": "string",
16
- "const": "1.0"
14
+ "label": {
15
+ "type": "string"
16
+ },
17
+ "help": {
18
+ "type": "string"
17
19
  },
18
20
  "labelTranslationKey": {
19
21
  "type": "string"
20
22
  },
21
- "asRichText": {
22
- "type": "boolean"
23
- }
24
- },
25
- "required": [
26
- "schemaVersion"
27
- ],
28
- "additionalProperties": false
29
- },
30
- "attributes": {
31
- "type": "object",
32
- "properties": {
33
23
  "cols": {
34
24
  "type": "number"
35
25
  },
@@ -44,6 +34,22 @@
44
34
  }
45
35
  },
46
36
  "additionalProperties": false
37
+ },
38
+ "meta": {
39
+ "type": "object",
40
+ "properties": {
41
+ "schemaVersion": {
42
+ "type": "string",
43
+ "const": "1.0"
44
+ },
45
+ "asRichText": {
46
+ "type": "boolean"
47
+ }
48
+ },
49
+ "required": [
50
+ "schemaVersion"
51
+ ],
52
+ "additionalProperties": false
47
53
  }
48
54
  },
49
55
  "required": [
@@ -8,25 +8,18 @@
8
8
  "type": "string",
9
9
  "const": "text"
10
10
  },
11
- "meta": {
11
+ "attributes": {
12
12
  "type": "object",
13
13
  "properties": {
14
- "schemaVersion": {
15
- "type": "string",
16
- "const": "1.0"
14
+ "label": {
15
+ "type": "string"
16
+ },
17
+ "help": {
18
+ "type": "string"
17
19
  },
18
20
  "labelTranslationKey": {
19
21
  "type": "string"
20
- }
21
- },
22
- "required": [
23
- "schemaVersion"
24
- ],
25
- "additionalProperties": false
26
- },
27
- "attributes": {
28
- "type": "object",
29
- "properties": {
22
+ },
30
23
  "maxLength": {
31
24
  "type": "number"
32
25
  },
@@ -38,11 +31,23 @@
38
31
  }
39
32
  },
40
33
  "additionalProperties": false
34
+ },
35
+ "meta": {
36
+ "type": "object",
37
+ "properties": {
38
+ "schemaVersion": {
39
+ "type": "string",
40
+ "const": "1.0"
41
+ }
42
+ },
43
+ "required": [
44
+ "schemaVersion"
45
+ ],
46
+ "additionalProperties": false
41
47
  }
42
48
  },
43
49
  "required": [
44
- "type",
45
- "meta"
50
+ "type"
46
51
  ],
47
52
  "additionalProperties": false
48
53
  }
@@ -8,15 +8,27 @@
8
8
  "type": "string",
9
9
  "const": "typeaheadSearch"
10
10
  },
11
+ "attributes": {
12
+ "type": "object",
13
+ "properties": {
14
+ "label": {
15
+ "type": "string"
16
+ },
17
+ "help": {
18
+ "type": "string"
19
+ },
20
+ "labelTranslationKey": {
21
+ "type": "string"
22
+ }
23
+ },
24
+ "additionalProperties": false
25
+ },
11
26
  "meta": {
12
27
  "type": "object",
13
28
  "properties": {
14
29
  "schemaVersion": {
15
30
  "type": "string",
16
31
  "const": "1.0"
17
- },
18
- "labelTranslationKey": {
19
- "type": "string"
20
32
  }
21
33
  },
22
34
  "required": [
@@ -99,7 +111,6 @@
99
111
  },
100
112
  "required": [
101
113
  "type",
102
- "meta",
103
114
  "graphQL"
104
115
  ],
105
116
  "additionalProperties": false
@@ -8,25 +8,18 @@
8
8
  "type": "string",
9
9
  "const": "url"
10
10
  },
11
- "meta": {
11
+ "attributes": {
12
12
  "type": "object",
13
13
  "properties": {
14
- "schemaVersion": {
15
- "type": "string",
16
- "const": "1.0"
14
+ "label": {
15
+ "type": "string"
16
+ },
17
+ "help": {
18
+ "type": "string"
17
19
  },
18
20
  "labelTranslationKey": {
19
21
  "type": "string"
20
- }
21
- },
22
- "required": [
23
- "schemaVersion"
24
- ],
25
- "additionalProperties": false
26
- },
27
- "attributes": {
28
- "type": "object",
29
- "properties": {
22
+ },
30
23
  "maxLength": {
31
24
  "type": "number"
32
25
  },
@@ -38,11 +31,23 @@
38
31
  }
39
32
  },
40
33
  "additionalProperties": false
34
+ },
35
+ "meta": {
36
+ "type": "object",
37
+ "properties": {
38
+ "schemaVersion": {
39
+ "type": "string",
40
+ "const": "1.0"
41
+ }
42
+ },
43
+ "required": [
44
+ "schemaVersion"
45
+ ],
46
+ "additionalProperties": false
41
47
  }
42
48
  },
43
49
  "required": [
44
- "type",
45
- "meta"
50
+ "type"
46
51
  ],
47
52
  "additionalProperties": false
48
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/types",
3
- "version": "1.0.8",
3
+ "version": "1.1.1",
4
4
  "description": "TypeScript types for DMPTool",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,216 +0,0 @@
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
- export declare const CurrencyAnswerSchema: 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 EmailAnswerSchema: 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 NumberAnswerSchema: 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 NumberRangeAnswerSchema: 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<"numberRange">;
108
- answer: z.ZodObject<{
109
- start: z.ZodNumber;
110
- end: z.ZodNumber;
111
- }, "strip", z.ZodTypeAny, {
112
- start: number;
113
- end: number;
114
- }, {
115
- start: number;
116
- end: number;
117
- }>;
118
- }, "strip", z.ZodTypeAny, {
119
- type: "numberRange";
120
- meta: {
121
- schemaVersion: "1.0";
122
- };
123
- answer: {
124
- start: number;
125
- end: number;
126
- };
127
- }, {
128
- type: "numberRange";
129
- meta: {
130
- schemaVersion: "1.0";
131
- };
132
- answer: {
133
- start: number;
134
- end: number;
135
- };
136
- }>;
137
- export declare const TextAnswerSchema: z.ZodObject<{
138
- meta: z.ZodObject<{
139
- schemaVersion: z.ZodLiteral<"1.0">;
140
- }, "strip", z.ZodTypeAny, {
141
- schemaVersion: "1.0";
142
- }, {
143
- schemaVersion: "1.0";
144
- }>;
145
- } & {
146
- type: z.ZodLiteral<"text">;
147
- answer: z.ZodString;
148
- }, "strip", z.ZodTypeAny, {
149
- type: "text";
150
- meta: {
151
- schemaVersion: "1.0";
152
- };
153
- answer: string;
154
- }, {
155
- type: "text";
156
- meta: {
157
- schemaVersion: "1.0";
158
- };
159
- answer: string;
160
- }>;
161
- export declare const TextAreaAnswerSchema: z.ZodObject<{
162
- meta: z.ZodObject<{
163
- schemaVersion: z.ZodLiteral<"1.0">;
164
- }, "strip", z.ZodTypeAny, {
165
- schemaVersion: "1.0";
166
- }, {
167
- schemaVersion: "1.0";
168
- }>;
169
- } & {
170
- type: z.ZodLiteral<"textArea">;
171
- answer: z.ZodString;
172
- }, "strip", z.ZodTypeAny, {
173
- type: "textArea";
174
- meta: {
175
- schemaVersion: "1.0";
176
- };
177
- answer: string;
178
- }, {
179
- type: "textArea";
180
- meta: {
181
- schemaVersion: "1.0";
182
- };
183
- answer: string;
184
- }>;
185
- export declare const URLAnswerSchema: z.ZodObject<{
186
- meta: z.ZodObject<{
187
- schemaVersion: z.ZodLiteral<"1.0">;
188
- }, "strip", z.ZodTypeAny, {
189
- schemaVersion: "1.0";
190
- }, {
191
- schemaVersion: "1.0";
192
- }>;
193
- } & {
194
- type: z.ZodLiteral<"url">;
195
- answer: z.ZodString;
196
- }, "strip", z.ZodTypeAny, {
197
- type: "url";
198
- meta: {
199
- schemaVersion: "1.0";
200
- };
201
- answer: string;
202
- }, {
203
- type: "url";
204
- meta: {
205
- schemaVersion: "1.0";
206
- };
207
- answer: string;
208
- }>;
209
- export type BooleanAnswerType = z.infer<typeof BooleanAnswerSchema>;
210
- export type CurrencyAnswerType = z.infer<typeof CurrencyAnswerSchema>;
211
- export type EmailAnswerType = z.infer<typeof EmailAnswerSchema>;
212
- export type NumberAnswerType = z.infer<typeof NumberAnswerSchema>;
213
- export type NumberRangeAnswerType = z.infer<typeof NumberRangeAnswerSchema>;
214
- export type TextAnswerType = z.infer<typeof TextAnswerSchema>;
215
- export type TextAreaAnswerType = z.infer<typeof TextAreaAnswerSchema>;
216
- export type URLAnswerType = z.infer<typeof URLAnswerSchema>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.URLAnswerSchema = exports.TextAreaAnswerSchema = exports.TextAnswerSchema = exports.NumberRangeAnswerSchema = exports.NumberAnswerSchema = exports.EmailAnswerSchema = exports.CurrencyAnswerSchema = exports.BooleanAnswerSchema = void 0;
4
- const zod_1 = require("zod");
5
- const answer_1 = require("./answer");
6
- // Answers to Primitive 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
- exports.CurrencyAnswerSchema = answer_1.AnswerSchema.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.EmailAnswerSchema = answer_1.AnswerSchema.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.NumberAnswerSchema = answer_1.AnswerSchema.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.NumberRangeAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
24
- type: zod_1.z.literal('numberRange'), // The type of answer
25
- answer: zod_1.z.object({
26
- start: zod_1.z.number(), // The start number (number)
27
- end: zod_1.z.number() // The end number (number)
28
- })
29
- }));
30
- exports.TextAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
31
- type: zod_1.z.literal('text'), // The type of answer
32
- answer: zod_1.z.string() // The answer to the question (string)
33
- }));
34
- exports.TextAreaAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
35
- type: zod_1.z.literal('textArea'), // The type of answer
36
- answer: zod_1.z.string() // The answer to the question (string)
37
- }));
38
- exports.URLAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
39
- type: zod_1.z.literal('url'), // The type of answer
40
- answer: zod_1.z.string() // The answer to the question (string)
41
- }));