@dmptool/types 1.0.4 → 1.0.6

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.
@@ -189,13 +189,13 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
189
189
  selected?: boolean | undefined;
190
190
  };
191
191
  }>, "many">;
192
- attributes: z.ZodObject<{
192
+ attributes: z.ZodOptional<z.ZodObject<{
193
193
  multiple: z.ZodOptional<z.ZodBoolean>;
194
194
  }, "strip", z.ZodTypeAny, {
195
195
  multiple?: boolean | undefined;
196
196
  }, {
197
197
  multiple?: boolean | undefined;
198
- }>;
198
+ }>>;
199
199
  }, "strip", z.ZodTypeAny, {
200
200
  type: "selectBox";
201
201
  options: {
@@ -210,9 +210,9 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
210
210
  schemaVersion: "1.0";
211
211
  labelTranslationKey?: string | undefined;
212
212
  };
213
- attributes: {
213
+ attributes?: {
214
214
  multiple?: boolean | undefined;
215
- };
215
+ } | undefined;
216
216
  }, {
217
217
  type: "selectBox";
218
218
  options: {
@@ -227,9 +227,9 @@ export declare const SelectBoxQuestionSchema: z.ZodObject<{
227
227
  schemaVersion: "1.0";
228
228
  labelTranslationKey?: string | undefined;
229
229
  };
230
- attributes: {
230
+ attributes?: {
231
231
  multiple?: boolean | undefined;
232
- };
232
+ } | undefined;
233
233
  }>;
234
234
  export type CheckboxesQuestionType = z.infer<typeof CheckboxesQuestionSchema>;
235
235
  export type RadioButtonsQuestionType = z.infer<typeof RadioButtonsQuestionSchema>;
@@ -40,5 +40,5 @@ exports.SelectBoxQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object
40
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
+ }).optional(),
44
44
  }));
@@ -12,31 +12,31 @@ export declare const BooleanQuestionSchema: z.ZodObject<{
12
12
  }>;
13
13
  } & {
14
14
  type: z.ZodLiteral<"boolean">;
15
- attributes: z.ZodObject<{
15
+ attributes: z.ZodOptional<z.ZodObject<{
16
16
  checked: z.ZodOptional<z.ZodBoolean>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  checked?: boolean | undefined;
19
19
  }, {
20
20
  checked?: boolean | undefined;
21
- }>;
21
+ }>>;
22
22
  }, "strip", z.ZodTypeAny, {
23
23
  type: "boolean";
24
24
  meta: {
25
25
  schemaVersion: "1.0";
26
26
  labelTranslationKey?: string | undefined;
27
27
  };
28
- attributes: {
28
+ attributes?: {
29
29
  checked?: boolean | undefined;
30
- };
30
+ } | undefined;
31
31
  }, {
32
32
  type: "boolean";
33
33
  meta: {
34
34
  schemaVersion: "1.0";
35
35
  labelTranslationKey?: string | undefined;
36
36
  };
37
- attributes: {
37
+ attributes?: {
38
38
  checked?: boolean | undefined;
39
- };
39
+ } | undefined;
40
40
  }>;
41
41
  export declare const NumberQuestionSchema: z.ZodObject<{
42
42
  meta: z.ZodObject<{
@@ -51,7 +51,7 @@ export declare const NumberQuestionSchema: z.ZodObject<{
51
51
  }>;
52
52
  } & {
53
53
  type: z.ZodLiteral<"number">;
54
- attributes: z.ZodObject<{
54
+ attributes: z.ZodOptional<z.ZodObject<{
55
55
  max: z.ZodOptional<z.ZodNumber>;
56
56
  min: z.ZodOptional<z.ZodNumber>;
57
57
  step: z.ZodOptional<z.ZodNumber>;
@@ -63,32 +63,32 @@ export declare const NumberQuestionSchema: z.ZodObject<{
63
63
  max?: number | undefined;
64
64
  min?: number | undefined;
65
65
  step?: number | undefined;
66
- }>;
66
+ }>>;
67
67
  }, "strip", z.ZodTypeAny, {
68
68
  type: "number";
69
69
  meta: {
70
70
  schemaVersion: "1.0";
71
71
  labelTranslationKey?: string | undefined;
72
72
  };
73
- attributes: {
73
+ attributes?: {
74
74
  max?: number | undefined;
75
75
  min?: number | undefined;
76
76
  step?: number | undefined;
77
- };
77
+ } | undefined;
78
78
  }, {
79
79
  type: "number";
80
80
  meta: {
81
81
  schemaVersion: "1.0";
82
82
  labelTranslationKey?: string | undefined;
83
83
  };
84
- attributes: {
84
+ attributes?: {
85
85
  max?: number | undefined;
86
86
  min?: number | undefined;
87
87
  step?: number | undefined;
88
- };
88
+ } | undefined;
89
89
  }>;
90
90
  export declare const CurrencyQuestionSchema: z.ZodObject<{
91
- attributes: z.ZodObject<{
91
+ attributes: z.ZodOptional<z.ZodObject<{
92
92
  max: z.ZodOptional<z.ZodNumber>;
93
93
  min: z.ZodOptional<z.ZodNumber>;
94
94
  step: z.ZodOptional<z.ZodNumber>;
@@ -100,36 +100,47 @@ export declare const CurrencyQuestionSchema: z.ZodObject<{
100
100
  max?: number | undefined;
101
101
  min?: number | undefined;
102
102
  step?: number | undefined;
103
- }>;
103
+ }>>;
104
104
  } & {
105
105
  type: z.ZodLiteral<"currency">;
106
106
  meta: z.ZodObject<{
107
+ schemaVersion: z.ZodLiteral<"1.0">;
108
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
109
+ } & {
107
110
  denomination: z.ZodOptional<z.ZodString>;
108
111
  }, "strip", z.ZodTypeAny, {
112
+ schemaVersion: "1.0";
113
+ labelTranslationKey?: string | undefined;
109
114
  denomination?: string | undefined;
110
115
  }, {
116
+ schemaVersion: "1.0";
117
+ labelTranslationKey?: string | undefined;
111
118
  denomination?: string | undefined;
112
119
  }>;
113
120
  }, "strip", z.ZodTypeAny, {
114
121
  type: "currency";
115
122
  meta: {
123
+ schemaVersion: "1.0";
124
+ labelTranslationKey?: string | undefined;
116
125
  denomination?: string | undefined;
117
126
  };
118
- attributes: {
127
+ attributes?: {
119
128
  max?: number | undefined;
120
129
  min?: number | undefined;
121
130
  step?: number | undefined;
122
- };
131
+ } | undefined;
123
132
  }, {
124
133
  type: "currency";
125
134
  meta: {
135
+ schemaVersion: "1.0";
136
+ labelTranslationKey?: string | undefined;
126
137
  denomination?: string | undefined;
127
138
  };
128
- attributes: {
139
+ attributes?: {
129
140
  max?: number | undefined;
130
141
  min?: number | undefined;
131
142
  step?: number | undefined;
132
- };
143
+ } | undefined;
133
144
  }>;
134
145
  export declare const EmailQuestionSchema: z.ZodObject<{
135
146
  meta: z.ZodObject<{
@@ -144,7 +155,7 @@ export declare const EmailQuestionSchema: z.ZodObject<{
144
155
  }>;
145
156
  } & {
146
157
  type: z.ZodLiteral<"email">;
147
- attributes: z.ZodObject<{
158
+ attributes: z.ZodOptional<z.ZodObject<{
148
159
  maxLength: z.ZodOptional<z.ZodNumber>;
149
160
  minLength: z.ZodOptional<z.ZodNumber>;
150
161
  multiple: z.ZodOptional<z.ZodBoolean>;
@@ -159,35 +170,35 @@ export declare const EmailQuestionSchema: z.ZodObject<{
159
170
  minLength?: number | undefined;
160
171
  multiple?: boolean | undefined;
161
172
  pattern?: string | undefined;
162
- }>;
173
+ }>>;
163
174
  }, "strip", z.ZodTypeAny, {
164
175
  type: "email";
165
176
  meta: {
166
177
  schemaVersion: "1.0";
167
178
  labelTranslationKey?: string | undefined;
168
179
  };
169
- attributes: {
180
+ attributes?: {
170
181
  maxLength?: number | undefined;
171
182
  minLength?: number | undefined;
172
183
  multiple?: boolean | undefined;
173
184
  pattern?: string | undefined;
174
- };
185
+ } | undefined;
175
186
  }, {
176
187
  type: "email";
177
188
  meta: {
178
189
  schemaVersion: "1.0";
179
190
  labelTranslationKey?: string | undefined;
180
191
  };
181
- attributes: {
192
+ attributes?: {
182
193
  maxLength?: number | undefined;
183
194
  minLength?: number | undefined;
184
195
  multiple?: boolean | undefined;
185
196
  pattern?: string | undefined;
186
- };
197
+ } | undefined;
187
198
  }>;
188
199
  export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
189
200
  type: z.ZodLiteral<"textArea">;
190
- attributes: z.ZodObject<{
201
+ attributes: z.ZodOptional<z.ZodObject<{
191
202
  cols: z.ZodOptional<z.ZodNumber>;
192
203
  maxLength: z.ZodOptional<z.ZodNumber>;
193
204
  minLength: z.ZodOptional<z.ZodNumber>;
@@ -202,36 +213,47 @@ export declare const TextAreaQuestionSchema: z.ZodObject<{} & {
202
213
  minLength?: number | undefined;
203
214
  cols?: number | undefined;
204
215
  rows?: number | undefined;
205
- }>;
216
+ }>>;
206
217
  meta: z.ZodObject<{
218
+ schemaVersion: z.ZodLiteral<"1.0">;
219
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
220
+ } & {
207
221
  asRichText: z.ZodOptional<z.ZodBoolean>;
208
222
  }, "strip", z.ZodTypeAny, {
223
+ schemaVersion: "1.0";
224
+ labelTranslationKey?: string | undefined;
209
225
  asRichText?: boolean | undefined;
210
226
  }, {
227
+ schemaVersion: "1.0";
228
+ labelTranslationKey?: string | undefined;
211
229
  asRichText?: boolean | undefined;
212
230
  }>;
213
231
  }, "strip", z.ZodTypeAny, {
214
232
  type: "textArea";
215
233
  meta: {
234
+ schemaVersion: "1.0";
235
+ labelTranslationKey?: string | undefined;
216
236
  asRichText?: boolean | undefined;
217
237
  };
218
- attributes: {
238
+ attributes?: {
219
239
  maxLength?: number | undefined;
220
240
  minLength?: number | undefined;
221
241
  cols?: number | undefined;
222
242
  rows?: number | undefined;
223
- };
243
+ } | undefined;
224
244
  }, {
225
245
  type: "textArea";
226
246
  meta: {
247
+ schemaVersion: "1.0";
248
+ labelTranslationKey?: string | undefined;
227
249
  asRichText?: boolean | undefined;
228
250
  };
229
- attributes: {
251
+ attributes?: {
230
252
  maxLength?: number | undefined;
231
253
  minLength?: number | undefined;
232
254
  cols?: number | undefined;
233
255
  rows?: number | undefined;
234
- };
256
+ } | undefined;
235
257
  }>;
236
258
  export declare const TextQuestionSchema: z.ZodObject<{
237
259
  meta: z.ZodObject<{
@@ -246,7 +268,7 @@ export declare const TextQuestionSchema: z.ZodObject<{
246
268
  }>;
247
269
  } & {
248
270
  type: z.ZodLiteral<"text">;
249
- attributes: z.ZodObject<{
271
+ attributes: z.ZodOptional<z.ZodObject<{
250
272
  maxLength: z.ZodOptional<z.ZodNumber>;
251
273
  minLength: z.ZodOptional<z.ZodNumber>;
252
274
  pattern: z.ZodOptional<z.ZodString>;
@@ -258,29 +280,29 @@ export declare const TextQuestionSchema: z.ZodObject<{
258
280
  maxLength?: number | undefined;
259
281
  minLength?: number | undefined;
260
282
  pattern?: string | undefined;
261
- }>;
283
+ }>>;
262
284
  }, "strip", z.ZodTypeAny, {
263
285
  type: "text";
264
286
  meta: {
265
287
  schemaVersion: "1.0";
266
288
  labelTranslationKey?: string | undefined;
267
289
  };
268
- attributes: {
290
+ attributes?: {
269
291
  maxLength?: number | undefined;
270
292
  minLength?: number | undefined;
271
293
  pattern?: string | undefined;
272
- };
294
+ } | undefined;
273
295
  }, {
274
296
  type: "text";
275
297
  meta: {
276
298
  schemaVersion: "1.0";
277
299
  labelTranslationKey?: string | undefined;
278
300
  };
279
- attributes: {
301
+ attributes?: {
280
302
  maxLength?: number | undefined;
281
303
  minLength?: number | undefined;
282
304
  pattern?: string | undefined;
283
- };
305
+ } | undefined;
284
306
  }>;
285
307
  export declare const URLQuestionSchema: z.ZodObject<{
286
308
  meta: z.ZodObject<{
@@ -295,7 +317,7 @@ export declare const URLQuestionSchema: z.ZodObject<{
295
317
  }>;
296
318
  } & {
297
319
  type: z.ZodLiteral<"url">;
298
- attributes: z.ZodObject<{
320
+ attributes: z.ZodOptional<z.ZodObject<{
299
321
  maxLength: z.ZodOptional<z.ZodNumber>;
300
322
  minLength: z.ZodOptional<z.ZodNumber>;
301
323
  pattern: z.ZodOptional<z.ZodString>;
@@ -307,29 +329,29 @@ export declare const URLQuestionSchema: z.ZodObject<{
307
329
  maxLength?: number | undefined;
308
330
  minLength?: number | undefined;
309
331
  pattern?: string | undefined;
310
- }>;
332
+ }>>;
311
333
  }, "strip", z.ZodTypeAny, {
312
334
  type: "url";
313
335
  meta: {
314
336
  schemaVersion: "1.0";
315
337
  labelTranslationKey?: string | undefined;
316
338
  };
317
- attributes: {
339
+ attributes?: {
318
340
  maxLength?: number | undefined;
319
341
  minLength?: number | undefined;
320
342
  pattern?: string | undefined;
321
- };
343
+ } | undefined;
322
344
  }, {
323
345
  type: "url";
324
346
  meta: {
325
347
  schemaVersion: "1.0";
326
348
  labelTranslationKey?: string | undefined;
327
349
  };
328
- attributes: {
350
+ attributes?: {
329
351
  maxLength?: number | undefined;
330
352
  minLength?: number | undefined;
331
353
  pattern?: string | undefined;
332
- };
354
+ } | undefined;
333
355
  }>;
334
356
  export type BooleanQuestionType = z.infer<typeof BooleanQuestionSchema>;
335
357
  export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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
+ const BaseMeta = question_1.QuestionSchema.shape.meta;
6
7
  // A Yes/No True/False question and answer
7
8
  exports.BooleanQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
8
9
  type: zod_1.z.literal('boolean'), // The type of question
9
10
  attributes: zod_1.z.object({
10
11
  checked: zod_1.z.boolean().optional() // If it is checked by default when rendered (default is false)
11
- })
12
+ }).optional(),
12
13
  }));
13
14
  // A number question and answer
14
15
  exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
@@ -17,12 +18,12 @@ exports.NumberQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
17
18
  max: zod_1.z.number().optional(), // The maximum value (no default)
18
19
  min: zod_1.z.number().optional(), // The minimum value (default is 0)
19
20
  step: zod_1.z.number().optional() // The step value (use 0.01 or similar for float)
20
- })
21
+ }).optional(),
21
22
  }));
22
23
  // Currency question and answer
23
24
  exports.CurrencyQuestionSchema = exports.NumberQuestionSchema.merge(zod_1.z.object({
24
25
  type: zod_1.z.literal('currency'), // The type of question
25
- meta: zod_1.z.object({
26
+ meta: BaseMeta.extend({
26
27
  denomination: zod_1.z.string().optional() // The currency denomination (default is USD)
27
28
  })
28
29
  }));
@@ -34,7 +35,7 @@ exports.EmailQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
34
35
  minLength: zod_1.z.number().optional(), // The minimum length of the email (no default)
35
36
  multiple: zod_1.z.boolean().optional(), // Allow multiple emails (default is false; comma separated)
36
37
  pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
37
- })
38
+ }).optional(),
38
39
  }));
39
40
  // Text area question and answer
40
41
  exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
@@ -44,8 +45,8 @@ exports.TextAreaQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object(
44
45
  maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
45
46
  minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
46
47
  rows: zod_1.z.number().optional() // The number of rows (default is 2)
47
- }),
48
- meta: zod_1.z.object({
48
+ }).optional(),
49
+ meta: BaseMeta.extend({
49
50
  asRichText: zod_1.z.boolean().optional() // Whether to use rich text (default is false)
50
51
  })
51
52
  }));
@@ -56,7 +57,7 @@ exports.TextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
56
57
  maxLength: zod_1.z.number().optional(), // The maximum length of the text (no default)
57
58
  minLength: zod_1.z.number().optional(), // The minimum length of the text (no default)
58
59
  pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
59
- }),
60
+ }).optional(),
60
61
  }));
61
62
  // URL question and answer
62
63
  exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
@@ -65,5 +66,5 @@ exports.URLQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
65
66
  maxLength: zod_1.z.number().optional(), // The maximum length of the URL (no default)
66
67
  minLength: zod_1.z.number().optional(), // The minimum length of the URL (no default)
67
68
  pattern: zod_1.z.string().optional() // The regex pattern to match (no default)
68
- })
69
+ }).optional(),
69
70
  }));