@open-norantec/utilities 1.0.1-alpha.9 → 2.0.0-alpha.0

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.
@@ -0,0 +1,498 @@
1
+ import { z } from './zod';
2
+ export declare namespace Schemas {
3
+ const ID: z.ZodUUID;
4
+ const ID_LIST: z.ZodArray<z.ZodUUID>;
5
+ const ID_LIST_OBJECT: z.ZodObject<{
6
+ idList: z.ZodArray<z.ZodUUID>;
7
+ }, z.core.$strip>;
8
+ const ID_OBJECT: z.ZodObject<{
9
+ id: z.ZodUUID;
10
+ }, z.core.$strip>;
11
+ const JSON_STRING: z.ZodString;
12
+ const DATE_STRING: z.ZodString;
13
+ const TIME_RECORD: z.ZodObject<{
14
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ }, z.core.$strip>;
17
+ const ORDER_ORIENTATION: z.ZodEnum<{
18
+ ASC: "ASC";
19
+ DESC: "DESC";
20
+ }>;
21
+ const WHERE_CLAUSE_OP: z.ZodEnum<{
22
+ values: "values";
23
+ adjacent: "adjacent";
24
+ any: "any";
25
+ between: "between";
26
+ col: "col";
27
+ contained: "contained";
28
+ contains: "contains";
29
+ endsWith: "endsWith";
30
+ eq: "eq";
31
+ gt: "gt";
32
+ gte: "gte";
33
+ iLike: "iLike";
34
+ in: "in";
35
+ iRegexp: "iRegexp";
36
+ is: "is";
37
+ like: "like";
38
+ lt: "lt";
39
+ lte: "lte";
40
+ match: "match";
41
+ ne: "ne";
42
+ noExtendLeft: "noExtendLeft";
43
+ noExtendRight: "noExtendRight";
44
+ not: "not";
45
+ notBetween: "notBetween";
46
+ notILike: "notILike";
47
+ notIn: "notIn";
48
+ notIRegexp: "notIRegexp";
49
+ notLike: "notLike";
50
+ notRegexp: "notRegexp";
51
+ overlap: "overlap";
52
+ placeholder: "placeholder";
53
+ regexp: "regexp";
54
+ startsWith: "startsWith";
55
+ strictLeft: "strictLeft";
56
+ strictRight: "strictRight";
57
+ substring: "substring";
58
+ }>;
59
+ const LOG_LEVEL: z.ZodEnum<{
60
+ error: "error";
61
+ warn: "warn";
62
+ info: "info";
63
+ verbose: "verbose";
64
+ debug: "debug";
65
+ }>;
66
+ const COMMON_RESULT: z.ZodObject<{
67
+ succeeded: z.ZodBoolean;
68
+ content: z.ZodOptional<z.ZodString>;
69
+ id: z.ZodOptional<z.ZodUUID>;
70
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ }, z.core.$strip>;
73
+ const WHERE_CLAUSE: z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ field: z.ZodString;
75
+ op: z.ZodEnum<{
76
+ values: "values";
77
+ adjacent: "adjacent";
78
+ any: "any";
79
+ between: "between";
80
+ col: "col";
81
+ contained: "contained";
82
+ contains: "contains";
83
+ endsWith: "endsWith";
84
+ eq: "eq";
85
+ gt: "gt";
86
+ gte: "gte";
87
+ iLike: "iLike";
88
+ in: "in";
89
+ iRegexp: "iRegexp";
90
+ is: "is";
91
+ like: "like";
92
+ lt: "lt";
93
+ lte: "lte";
94
+ match: "match";
95
+ ne: "ne";
96
+ noExtendLeft: "noExtendLeft";
97
+ noExtendRight: "noExtendRight";
98
+ not: "not";
99
+ notBetween: "notBetween";
100
+ notILike: "notILike";
101
+ notIn: "notIn";
102
+ notIRegexp: "notIRegexp";
103
+ notLike: "notLike";
104
+ notRegexp: "notRegexp";
105
+ overlap: "overlap";
106
+ placeholder: "placeholder";
107
+ regexp: "regexp";
108
+ startsWith: "startsWith";
109
+ strictLeft: "strictLeft";
110
+ strictRight: "strictRight";
111
+ substring: "substring";
112
+ }>;
113
+ type: z.ZodLiteral<"condition">;
114
+ value: z.ZodString;
115
+ }, z.core.$strip>, z.ZodObject<{
116
+ literal: z.ZodString;
117
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
118
+ type: z.ZodLiteral<"literal">;
119
+ }, z.core.$strip>], "type">;
120
+ const CONDITION_ONLY_WHERE_CLAUSE: z.ZodDiscriminatedUnion<[z.ZodObject<{
121
+ field: z.ZodString;
122
+ op: z.ZodEnum<{
123
+ values: "values";
124
+ adjacent: "adjacent";
125
+ any: "any";
126
+ between: "between";
127
+ col: "col";
128
+ contained: "contained";
129
+ contains: "contains";
130
+ endsWith: "endsWith";
131
+ eq: "eq";
132
+ gt: "gt";
133
+ gte: "gte";
134
+ iLike: "iLike";
135
+ in: "in";
136
+ iRegexp: "iRegexp";
137
+ is: "is";
138
+ like: "like";
139
+ lt: "lt";
140
+ lte: "lte";
141
+ match: "match";
142
+ ne: "ne";
143
+ noExtendLeft: "noExtendLeft";
144
+ noExtendRight: "noExtendRight";
145
+ not: "not";
146
+ notBetween: "notBetween";
147
+ notILike: "notILike";
148
+ notIn: "notIn";
149
+ notIRegexp: "notIRegexp";
150
+ notLike: "notLike";
151
+ notRegexp: "notRegexp";
152
+ overlap: "overlap";
153
+ placeholder: "placeholder";
154
+ regexp: "regexp";
155
+ startsWith: "startsWith";
156
+ strictLeft: "strictLeft";
157
+ strictRight: "strictRight";
158
+ substring: "substring";
159
+ }>;
160
+ type: z.ZodLiteral<"condition">;
161
+ value: z.ZodString;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ literal: z.ZodString;
164
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
165
+ type: z.ZodLiteral<"literal">;
166
+ }, z.core.$strip>], "type">;
167
+ const ORDER_ITEM: z.ZodObject<{
168
+ field: z.ZodString;
169
+ orientation: z.ZodEnum<{
170
+ ASC: "ASC";
171
+ DESC: "DESC";
172
+ }>;
173
+ }, z.core.$strip>;
174
+ const PAGINATION_OPTIONS: z.ZodObject<{
175
+ cursorField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
176
+ cursorFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
177
+ ASC: "ASC";
178
+ DESC: "DESC";
179
+ }>>, z.ZodUndefined]>;
180
+ lastCursor: z.ZodOptional<z.ZodString>;
181
+ limit: z.ZodOptional<z.ZodNumber>;
182
+ search: z.ZodOptional<z.ZodObject<{
183
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
184
+ field: z.ZodString;
185
+ ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
186
+ }, z.core.$strip>]>>;
187
+ value: z.ZodString;
188
+ }, z.core.$strip>>;
189
+ order: z.ZodOptional<z.ZodArray<z.ZodObject<{
190
+ field: z.ZodString;
191
+ orientation: z.ZodEnum<{
192
+ ASC: "ASC";
193
+ DESC: "DESC";
194
+ }>;
195
+ }, z.core.$strip>>>;
196
+ orderField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
197
+ orderFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
198
+ ASC: "ASC";
199
+ DESC: "DESC";
200
+ }>>, z.ZodUndefined]>;
201
+ where: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
202
+ field: z.ZodString;
203
+ op: z.ZodEnum<{
204
+ values: "values";
205
+ adjacent: "adjacent";
206
+ any: "any";
207
+ between: "between";
208
+ col: "col";
209
+ contained: "contained";
210
+ contains: "contains";
211
+ endsWith: "endsWith";
212
+ eq: "eq";
213
+ gt: "gt";
214
+ gte: "gte";
215
+ iLike: "iLike";
216
+ in: "in";
217
+ iRegexp: "iRegexp";
218
+ is: "is";
219
+ like: "like";
220
+ lt: "lt";
221
+ lte: "lte";
222
+ match: "match";
223
+ ne: "ne";
224
+ noExtendLeft: "noExtendLeft";
225
+ noExtendRight: "noExtendRight";
226
+ not: "not";
227
+ notBetween: "notBetween";
228
+ notILike: "notILike";
229
+ notIn: "notIn";
230
+ notIRegexp: "notIRegexp";
231
+ notLike: "notLike";
232
+ notRegexp: "notRegexp";
233
+ overlap: "overlap";
234
+ placeholder: "placeholder";
235
+ regexp: "regexp";
236
+ startsWith: "startsWith";
237
+ strictLeft: "strictLeft";
238
+ strictRight: "strictRight";
239
+ substring: "substring";
240
+ }>;
241
+ type: z.ZodLiteral<"condition">;
242
+ value: z.ZodString;
243
+ }, z.core.$strip>, z.ZodObject<{
244
+ literal: z.ZodString;
245
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
246
+ type: z.ZodLiteral<"literal">;
247
+ }, z.core.$strip>], "type">>>>;
248
+ }, z.core.$strip>;
249
+ const FIND_ONE_OPTIONS: z.ZodObject<{
250
+ search: z.ZodOptional<z.ZodObject<{
251
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
252
+ field: z.ZodString;
253
+ ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
254
+ }, z.core.$strip>]>>;
255
+ value: z.ZodString;
256
+ }, z.core.$strip>>;
257
+ cursorField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
258
+ cursorFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
259
+ ASC: "ASC";
260
+ DESC: "DESC";
261
+ }>>, z.ZodUndefined]>;
262
+ order: z.ZodOptional<z.ZodArray<z.ZodObject<{
263
+ field: z.ZodString;
264
+ orientation: z.ZodEnum<{
265
+ ASC: "ASC";
266
+ DESC: "DESC";
267
+ }>;
268
+ }, z.core.$strip>>>;
269
+ orderField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
270
+ orderFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
271
+ ASC: "ASC";
272
+ DESC: "DESC";
273
+ }>>, z.ZodUndefined]>;
274
+ where: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
275
+ field: z.ZodString;
276
+ op: z.ZodEnum<{
277
+ values: "values";
278
+ adjacent: "adjacent";
279
+ any: "any";
280
+ between: "between";
281
+ col: "col";
282
+ contained: "contained";
283
+ contains: "contains";
284
+ endsWith: "endsWith";
285
+ eq: "eq";
286
+ gt: "gt";
287
+ gte: "gte";
288
+ iLike: "iLike";
289
+ in: "in";
290
+ iRegexp: "iRegexp";
291
+ is: "is";
292
+ like: "like";
293
+ lt: "lt";
294
+ lte: "lte";
295
+ match: "match";
296
+ ne: "ne";
297
+ noExtendLeft: "noExtendLeft";
298
+ noExtendRight: "noExtendRight";
299
+ not: "not";
300
+ notBetween: "notBetween";
301
+ notILike: "notILike";
302
+ notIn: "notIn";
303
+ notIRegexp: "notIRegexp";
304
+ notLike: "notLike";
305
+ notRegexp: "notRegexp";
306
+ overlap: "overlap";
307
+ placeholder: "placeholder";
308
+ regexp: "regexp";
309
+ startsWith: "startsWith";
310
+ strictLeft: "strictLeft";
311
+ strictRight: "strictRight";
312
+ substring: "substring";
313
+ }>;
314
+ type: z.ZodLiteral<"condition">;
315
+ value: z.ZodString;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ literal: z.ZodString;
318
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
319
+ type: z.ZodLiteral<"literal">;
320
+ }, z.core.$strip>], "type">>>>;
321
+ }, z.core.$strip>;
322
+ const PAGINATION_RESULT: z.ZodObject<{
323
+ hasNext: z.ZodBoolean;
324
+ nextCursor: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
325
+ previousCursor: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
326
+ }, z.core.$strip>;
327
+ const FILE: z.ZodObject<{
328
+ mimeType: z.ZodString;
329
+ name: z.ZodString;
330
+ progres: z.ZodNumber;
331
+ size: z.ZodNumber;
332
+ url: z.ZodString;
333
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ }, z.core.$strip>;
336
+ const CONDITION_ONLY_PAGINATION_OPTIONS: z.ZodObject<{
337
+ search: z.ZodOptional<z.ZodObject<{
338
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
339
+ field: z.ZodString;
340
+ ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
341
+ }, z.core.$strip>]>>;
342
+ value: z.ZodString;
343
+ }, z.core.$strip>>;
344
+ cursorField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
345
+ cursorFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
346
+ ASC: "ASC";
347
+ DESC: "DESC";
348
+ }>>, z.ZodUndefined]>;
349
+ lastCursor: z.ZodOptional<z.ZodString>;
350
+ limit: z.ZodOptional<z.ZodNumber>;
351
+ order: z.ZodOptional<z.ZodArray<z.ZodObject<{
352
+ field: z.ZodString;
353
+ orientation: z.ZodEnum<{
354
+ ASC: "ASC";
355
+ DESC: "DESC";
356
+ }>;
357
+ }, z.core.$strip>>>;
358
+ orderField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
359
+ orderFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
360
+ ASC: "ASC";
361
+ DESC: "DESC";
362
+ }>>, z.ZodUndefined]>;
363
+ where: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
364
+ field: z.ZodString;
365
+ op: z.ZodEnum<{
366
+ values: "values";
367
+ adjacent: "adjacent";
368
+ any: "any";
369
+ between: "between";
370
+ col: "col";
371
+ contained: "contained";
372
+ contains: "contains";
373
+ endsWith: "endsWith";
374
+ eq: "eq";
375
+ gt: "gt";
376
+ gte: "gte";
377
+ iLike: "iLike";
378
+ in: "in";
379
+ iRegexp: "iRegexp";
380
+ is: "is";
381
+ like: "like";
382
+ lt: "lt";
383
+ lte: "lte";
384
+ match: "match";
385
+ ne: "ne";
386
+ noExtendLeft: "noExtendLeft";
387
+ noExtendRight: "noExtendRight";
388
+ not: "not";
389
+ notBetween: "notBetween";
390
+ notILike: "notILike";
391
+ notIn: "notIn";
392
+ notIRegexp: "notIRegexp";
393
+ notLike: "notLike";
394
+ notRegexp: "notRegexp";
395
+ overlap: "overlap";
396
+ placeholder: "placeholder";
397
+ regexp: "regexp";
398
+ startsWith: "startsWith";
399
+ strictLeft: "strictLeft";
400
+ strictRight: "strictRight";
401
+ substring: "substring";
402
+ }>;
403
+ type: z.ZodLiteral<"condition">;
404
+ value: z.ZodString;
405
+ }, z.core.$strip>, z.ZodObject<{
406
+ literal: z.ZodString;
407
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
408
+ type: z.ZodLiteral<"literal">;
409
+ }, z.core.$strip>], "type">>>>;
410
+ }, z.core.$strip>;
411
+ const CONDITION_ONLY_FIND_ONE_OPTIONS: z.ZodObject<{
412
+ search: z.ZodOptional<z.ZodObject<{
413
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
414
+ field: z.ZodString;
415
+ ratio: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
416
+ }, z.core.$strip>]>>;
417
+ value: z.ZodString;
418
+ }, z.core.$strip>>;
419
+ cursorField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
420
+ cursorFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
421
+ ASC: "ASC";
422
+ DESC: "DESC";
423
+ }>>, z.ZodUndefined]>;
424
+ order: z.ZodOptional<z.ZodArray<z.ZodObject<{
425
+ field: z.ZodString;
426
+ orientation: z.ZodEnum<{
427
+ ASC: "ASC";
428
+ DESC: "DESC";
429
+ }>;
430
+ }, z.core.$strip>>>;
431
+ orderField: z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUndefined]>;
432
+ orderFieldOrderOrientation: z.ZodUnion<readonly [z.ZodDefault<z.ZodEnum<{
433
+ ASC: "ASC";
434
+ DESC: "DESC";
435
+ }>>, z.ZodUndefined]>;
436
+ where: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
437
+ field: z.ZodString;
438
+ op: z.ZodEnum<{
439
+ values: "values";
440
+ adjacent: "adjacent";
441
+ any: "any";
442
+ between: "between";
443
+ col: "col";
444
+ contained: "contained";
445
+ contains: "contains";
446
+ endsWith: "endsWith";
447
+ eq: "eq";
448
+ gt: "gt";
449
+ gte: "gte";
450
+ iLike: "iLike";
451
+ in: "in";
452
+ iRegexp: "iRegexp";
453
+ is: "is";
454
+ like: "like";
455
+ lt: "lt";
456
+ lte: "lte";
457
+ match: "match";
458
+ ne: "ne";
459
+ noExtendLeft: "noExtendLeft";
460
+ noExtendRight: "noExtendRight";
461
+ not: "not";
462
+ notBetween: "notBetween";
463
+ notILike: "notILike";
464
+ notIn: "notIn";
465
+ notIRegexp: "notIRegexp";
466
+ notLike: "notLike";
467
+ notRegexp: "notRegexp";
468
+ overlap: "overlap";
469
+ placeholder: "placeholder";
470
+ regexp: "regexp";
471
+ startsWith: "startsWith";
472
+ strictLeft: "strictLeft";
473
+ strictRight: "strictRight";
474
+ substring: "substring";
475
+ }>;
476
+ type: z.ZodLiteral<"condition">;
477
+ value: z.ZodString;
478
+ }, z.core.$strip>, z.ZodObject<{
479
+ literal: z.ZodString;
480
+ params: z.ZodOptional<z.ZodArray<z.ZodAny>>;
481
+ type: z.ZodLiteral<"literal">;
482
+ }, z.core.$strip>], "type">>>>;
483
+ }, z.core.$strip>;
484
+ }
485
+ export declare namespace SchemaTypes {
486
+ type CommonResult = z.output<typeof Schemas.COMMON_RESULT>;
487
+ type File = z.infer<typeof Schemas.FILE>;
488
+ type FindOneOptions = z.infer<typeof Schemas.FIND_ONE_OPTIONS>;
489
+ type IDObject = z.infer<typeof Schemas.ID_OBJECT>;
490
+ type LogLevel = z.infer<typeof Schemas.LOG_LEVEL>;
491
+ type OrderItem = z.infer<typeof Schemas.ORDER_ITEM>;
492
+ type OrderOrientation = z.infer<typeof Schemas.ORDER_ORIENTATION>;
493
+ type PaginationOptions = z.infer<typeof Schemas.PAGINATION_OPTIONS>;
494
+ type PaginationResult = z.infer<typeof Schemas.PAGINATION_RESULT>;
495
+ type TimeRecord = z.infer<typeof Schemas.TIME_RECORD>;
496
+ type WhereClause = z.infer<typeof Schemas.WHERE_CLAUSE>;
497
+ type WhereClauseOp = z.infer<typeof Schemas.WHERE_CLAUSE_OP>;
498
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Schemas = void 0;
4
+ const date_util_class_1 = require("./date-util.class");
5
+ const enum_util_class_1 = require("./enum-util.class");
6
+ const enums_1 = require("./enums");
7
+ const zod_1 = require("./zod");
8
+ const FIND_ONE_OPTIONS_OMIT_PARAMS = {
9
+ limit: true,
10
+ lastCursor: true,
11
+ };
12
+ var Schemas;
13
+ (function (Schemas) {
14
+ Schemas.ID = zod_1.z.uuid();
15
+ Schemas.ID_LIST = zod_1.z.array(Schemas.ID).min(1);
16
+ Schemas.ID_LIST_OBJECT = zod_1.z.object({
17
+ idList: Schemas.ID_LIST,
18
+ });
19
+ Schemas.ID_OBJECT = zod_1.z.object({
20
+ id: Schemas.ID,
21
+ });
22
+ Schemas.JSON_STRING = zod_1.z.string().refine((value) => {
23
+ try {
24
+ JSON.parse(value);
25
+ return true;
26
+ }
27
+ catch (_a) {
28
+ return false;
29
+ }
30
+ });
31
+ Schemas.DATE_STRING = zod_1.z.string().refine((value) => date_util_class_1.DateUtil.isValidDateString(value));
32
+ Schemas.TIME_RECORD = zod_1.z.object({
33
+ createdAt: Schemas.DATE_STRING.nullable().optional(),
34
+ updatedAt: Schemas.DATE_STRING.nullable().optional(),
35
+ });
36
+ Schemas.ORDER_ORIENTATION = enum_util_class_1.EnumUtil.createEnumSchema(enums_1.Enums.OrderOrientation);
37
+ Schemas.WHERE_CLAUSE_OP = enum_util_class_1.EnumUtil.createEnumSchema(enums_1.Enums.WhereClauseOp);
38
+ Schemas.LOG_LEVEL = enum_util_class_1.EnumUtil.createEnumSchema(enums_1.Enums.LogLevel);
39
+ Schemas.COMMON_RESULT = zod_1.z
40
+ .object({
41
+ succeeded: zod_1.z.boolean(),
42
+ content: zod_1.z.string().optional(),
43
+ })
44
+ .extend(Schemas.ID_OBJECT.partial().shape)
45
+ .extend(Schemas.TIME_RECORD.shape);
46
+ Schemas.WHERE_CLAUSE = zod_1.z.discriminatedUnion('type', [
47
+ zod_1.z.object({
48
+ field: zod_1.z.string(),
49
+ op: Schemas.WHERE_CLAUSE_OP,
50
+ type: zod_1.z.literal('condition'),
51
+ value: Schemas.JSON_STRING,
52
+ }),
53
+ zod_1.z.object({
54
+ literal: zod_1.z.string().min(1),
55
+ params: zod_1.z.array(zod_1.z.any()).optional(),
56
+ type: zod_1.z.literal('literal'),
57
+ }),
58
+ ]);
59
+ Schemas.CONDITION_ONLY_WHERE_CLAUSE = Schemas.WHERE_CLAUSE.superRefine((value, context) => {
60
+ if ((value === null || value === void 0 ? void 0 : value.type) === 'literal') {
61
+ context.addIssue({
62
+ code: 'custom',
63
+ message: 'Literal where clause item is strictly forbidden for safety reasons',
64
+ });
65
+ }
66
+ });
67
+ Schemas.ORDER_ITEM = zod_1.z.object({
68
+ field: zod_1.z.string(),
69
+ orientation: Schemas.ORDER_ORIENTATION,
70
+ });
71
+ Schemas.PAGINATION_OPTIONS = zod_1.z.object({
72
+ cursorField: zod_1.z.union([zod_1.z.string().optional().default('id'), zod_1.z.undefined()]),
73
+ cursorFieldOrderOrientation: zod_1.z.union([Schemas.ORDER_ORIENTATION.default('DESC'), zod_1.z.undefined()]),
74
+ lastCursor: zod_1.z.string().optional(),
75
+ limit: zod_1.z.number().min(0).optional(),
76
+ search: zod_1.z
77
+ .object({
78
+ fields: zod_1.z.array(zod_1.z.union([
79
+ zod_1.z.string().min(1),
80
+ zod_1.z.object({
81
+ field: zod_1.z.string().min(1),
82
+ ratio: zod_1.z.number().min(-1).max(1).optional().default(1),
83
+ }),
84
+ ])),
85
+ value: zod_1.z.string().min(1),
86
+ })
87
+ .optional(),
88
+ order: zod_1.z.array(Schemas.ORDER_ITEM).optional(),
89
+ orderField: zod_1.z.union([zod_1.z.string().optional().default('createdAt'), zod_1.z.undefined()]),
90
+ orderFieldOrderOrientation: zod_1.z.union([Schemas.ORDER_ORIENTATION.default('DESC'), zod_1.z.undefined()]),
91
+ where: zod_1.z.array(zod_1.z.array(Schemas.WHERE_CLAUSE).min(1)).optional(),
92
+ });
93
+ Schemas.FIND_ONE_OPTIONS = Schemas.PAGINATION_OPTIONS.omit(FIND_ONE_OPTIONS_OMIT_PARAMS);
94
+ Schemas.PAGINATION_RESULT = zod_1.z.object({
95
+ hasNext: zod_1.z.boolean(),
96
+ nextCursor: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
97
+ previousCursor: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
98
+ });
99
+ Schemas.FILE = zod_1.z
100
+ .object({
101
+ mimeType: zod_1.z.string(),
102
+ name: zod_1.z.string(),
103
+ progres: zod_1.z.number().min(0).max(1),
104
+ size: zod_1.z.number().min(0),
105
+ url: zod_1.z.string(),
106
+ })
107
+ .extend(Schemas.TIME_RECORD.shape);
108
+ Schemas.CONDITION_ONLY_PAGINATION_OPTIONS = Schemas.PAGINATION_OPTIONS.omit({
109
+ where: true,
110
+ }).extend({ where: zod_1.z.array(zod_1.z.array(Schemas.CONDITION_ONLY_WHERE_CLAUSE).min(1)).optional() });
111
+ Schemas.CONDITION_ONLY_FIND_ONE_OPTIONS = Schemas.CONDITION_ONLY_PAGINATION_OPTIONS.omit(FIND_ONE_OPTIONS_OMIT_PARAMS);
112
+ })(Schemas || (exports.Schemas = Schemas = {}));
113
+ console.log(Schemas.COMMON_RESULT.toJSONSchema());
package/dist/zod.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from 'zod';
package/dist/zod.js ADDED
@@ -0,0 +1,17 @@
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
+ __exportStar(require("zod"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/utilities",
3
- "version": "1.0.1-alpha.9",
3
+ "version": "2.0.0-alpha.0",
4
4
  "description": "NoranTec Utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -30,23 +30,24 @@
30
30
  },
31
31
  "homepage": "https://github.com/norantec/utilities#readme",
32
32
  "devDependencies": {
33
- "@stylistic/eslint-plugin": "^2.12.1",
34
33
  "@types/colors": "^1.1.3",
35
34
  "@types/node": "18.11.18",
36
- "@typescript-eslint/eslint-plugin": "^8.0.0",
37
- "@typescript-eslint/parser": "^8.0.0",
38
35
  "cross-env": "^7.0.3",
39
- "eslint": "^8.0.0",
40
- "eslint-config-prettier": "^9.0.0",
41
- "eslint-plugin-prettier": "^5.0.0",
42
- "prettier": "^3.0.0",
36
+ "eslint": "^10.3.0",
43
37
  "rimraf": "^6.0.1",
44
38
  "ts-node": "^10.0.0",
45
39
  "type-fest": "^4.37.0",
46
40
  "typescript": "~5.1.3"
47
41
  },
48
42
  "dependencies": {
43
+ "@stylistic/eslint-plugin": "5.10.0",
44
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
45
+ "@typescript-eslint/parser": "^8.0.0",
49
46
  "colors": "^1.4.0",
50
- "zod": "^3.25.67"
47
+ "eslint-config-prettier": "^10.0.0",
48
+ "eslint-plugin-prettier": "^5.0.0",
49
+ "prettier": "^3.0.0",
50
+ "uuid": "^11.1.0",
51
+ "zod": "^4.4.3"
51
52
  }
52
53
  }