@open-norantec/utilities 2.0.5 → 2.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.
@@ -1,26 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorUtil = void 0;
4
- const uuid_util_class_1 = require("./uuid-util.class");
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import { UUIDUtil } from './uuid-util.class';
5
17
  function isZodError(error) {
6
18
  return typeof error === 'object' && error !== null && 'issues' in error && Array.isArray(error.issues);
7
19
  }
8
- class ResponseError extends Error {
9
- constructor(message, statusCode = 500, status = 500, code = 500) {
10
- super(message);
11
- this.statusCode = statusCode;
12
- this.status = status;
13
- this.code = code;
20
+ var ResponseError = (function (_super) {
21
+ __extends(ResponseError, _super);
22
+ function ResponseError(message, statusCode, status, code) {
23
+ if (statusCode === void 0) { statusCode = 500; }
24
+ if (status === void 0) { status = 500; }
25
+ if (code === void 0) { code = 500; }
26
+ var _this = _super.call(this, message) || this;
27
+ _this.statusCode = statusCode;
28
+ _this.status = status;
29
+ _this.code = code;
30
+ return _this;
14
31
  }
15
- }
16
- class ErrorUtil {
17
- static createResponseError(error, statusCode = 500) {
18
- return new ResponseError(error.message, statusCode, statusCode, statusCode);
32
+ return ResponseError;
33
+ }(Error));
34
+ var ErrorUtil = (function () {
35
+ function ErrorUtil() {
19
36
  }
20
- static formatError(error) {
21
- const id = uuid_util_class_1.UUIDUtil.generateV4();
22
- let message;
23
- let errorLogs = [];
37
+ ErrorUtil.createResponseError = function (error, statusCode) {
38
+ if (statusCode === void 0) { statusCode = 500; }
39
+ return new ResponseError(error.message, statusCode, statusCode, statusCode);
40
+ };
41
+ ErrorUtil.formatError = function (error) {
42
+ var id = UUIDUtil.generateV4();
43
+ var message;
44
+ var errorLogs = [];
24
45
  if (isZodError(error)) {
25
46
  message = JSON.stringify({
26
47
  message: 'Failed to validate your input data ({{context.trace}})',
@@ -32,7 +53,7 @@ class ErrorUtil {
32
53
  }
33
54
  else {
34
55
  message = JSON.stringify({
35
- message: `${error.message || 'An unknown error occurred'} ({{context.trace}})`,
56
+ message: "".concat(error.message || 'An unknown error occurred', " ({{context.trace}})"),
36
57
  context: {
37
58
  trace: id,
38
59
  },
@@ -40,11 +61,11 @@ class ErrorUtil {
40
61
  }
41
62
  errorLogs.push((error === null || error === void 0 ? void 0 : error.stack) || 'No stack trace available');
42
63
  return {
43
- id,
44
- message,
45
- logs: errorLogs.map((log) => `[AUTO_ERROR] [${id}] [${new Date().toISOString()}] ${log}`),
64
+ id: id,
65
+ message: message,
66
+ logs: errorLogs.map(function (log) { return "[AUTO_ERROR] [".concat(id, "] [").concat(new Date().toISOString(), "] ").concat(log); }),
46
67
  response: new Response(message, {
47
- status: (() => {
68
+ status: (function () {
48
69
  if (isZodError(error))
49
70
  return 400;
50
71
  if (error instanceof ResponseError)
@@ -54,6 +75,7 @@ class ErrorUtil {
54
75
  headers: { 'Content-Type': 'application/json' },
55
76
  }),
56
77
  };
57
- }
58
- }
59
- exports.ErrorUtil = ErrorUtil;
78
+ };
79
+ return ErrorUtil;
80
+ }());
81
+ export { ErrorUtil };
@@ -1,29 +1,7 @@
1
- import * as tsParser from '@typescript-eslint/parser';
2
- import * as stylistic from '@stylistic/eslint-plugin';
3
1
  export declare class ESLintUtil {
4
- static create({ ignores, project }: {
2
+ static create({ ignores, project, rules, }: {
5
3
  ignores?: string[];
6
4
  project?: string;
7
- }): {
8
- files: string[];
9
- languageOptions: {
10
- parser: typeof tsParser;
11
- parserOptions: {
12
- project: string;
13
- tsconfigRootDir: string;
14
- sourceType: string;
15
- };
16
- };
17
- ignores: string[];
18
- plugins: {
19
- '@typescript-eslint': {
20
- configs: Record<string, ClassicConfig.Config>;
21
- meta: FlatConfig.PluginMeta;
22
- rules: import("@typescript-eslint/eslint-plugin/rules").TypeScriptESLintRules;
23
- };
24
- '@stylistic': typeof stylistic;
25
- prettier: import("@eslint/core").Plugin;
26
- };
27
- rules: any;
28
- }[];
5
+ rules?: Record<string, any>;
6
+ }): Record<string, any>[];
29
7
  }
@@ -1,31 +1,43 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ESLintUtil = void 0;
4
- const tsParser = require("@typescript-eslint/parser");
5
- const tsPlugin = require("@typescript-eslint/eslint-plugin");
6
- const stylistic = require("@stylistic/eslint-plugin");
7
- const prettier = require("eslint-plugin-prettier");
8
- class ESLintUtil {
9
- static create({ ignores = [], project = './tsconfig.json' }) {
10
- var _a, _b, _c, _d;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as tsParser from '@typescript-eslint/parser';
13
+ import * as tsPlugin from '@typescript-eslint/eslint-plugin';
14
+ import * as stylistic from '@stylistic/eslint-plugin';
15
+ import * as prettier from 'eslint-plugin-prettier';
16
+ import * as _ from 'lodash';
17
+ var ESLintUtil = (function () {
18
+ function ESLintUtil() {
19
+ }
20
+ ESLintUtil.create = function (_a) {
21
+ var _b, _c, _d, _e;
22
+ var _f = _a.ignores, ignores = _f === void 0 ? [] : _f, _g = _a.project, project = _g === void 0 ? './tsconfig.json' : _g, rules = _a.rules;
11
23
  return [
12
24
  {
13
25
  files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mts', '**/*.cts', '**/*.mjs', '**/*.cjs'],
14
26
  languageOptions: {
15
27
  parser: tsParser,
16
28
  parserOptions: {
17
- project,
29
+ project: project,
18
30
  tsconfigRootDir: process.cwd(),
19
31
  sourceType: 'module',
20
32
  },
21
33
  },
22
- ignores,
34
+ ignores: ignores,
23
35
  plugins: {
24
36
  '@typescript-eslint': tsPlugin,
25
37
  '@stylistic': stylistic,
26
- prettier,
38
+ prettier: prettier,
27
39
  },
28
- rules: Object.assign(Object.assign(Object.assign({}, (_b = (_a = tsPlugin === null || tsPlugin === void 0 ? void 0 : tsPlugin.configs) === null || _a === void 0 ? void 0 : _a.recommended) === null || _b === void 0 ? void 0 : _b.rules), (_d = (_c = prettier === null || prettier === void 0 ? void 0 : prettier.configs) === null || _c === void 0 ? void 0 : _c.recommended) === null || _d === void 0 ? void 0 : _d.rules), { 'prettier/prettier': [
40
+ rules: _.merge(__assign(__assign(__assign({}, (_c = (_b = tsPlugin === null || tsPlugin === void 0 ? void 0 : tsPlugin.configs) === null || _b === void 0 ? void 0 : _b.recommended) === null || _c === void 0 ? void 0 : _c.rules), (_e = (_d = prettier === null || prettier === void 0 ? void 0 : prettier.configs) === null || _d === void 0 ? void 0 : _d.recommended) === null || _e === void 0 ? void 0 : _e.rules), { 'prettier/prettier': [
29
41
  'error',
30
42
  {
31
43
  singleQuote: true,
@@ -48,9 +60,10 @@ class ESLintUtil {
48
60
  requireLast: false,
49
61
  },
50
62
  },
51
- ], 'object-curly-newline': ['error', { multiline: true, consistent: true }] }),
63
+ ], 'object-curly-newline': ['error', { multiline: true, consistent: true }], 'multiline-ternary': 'off' }), rules || {}),
52
64
  },
53
65
  ];
54
- }
55
- }
56
- exports.ESLintUtil = ESLintUtil;
66
+ };
67
+ return ESLintUtil;
68
+ }());
69
+ export { ESLintUtil };
@@ -1,17 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HeaderUtil = void 0;
4
- const string_util_class_1 = require("./string-util.class");
5
- class HeaderUtil {
6
- static parse(headers) {
7
- const getValue = (name) => {
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ import { StringUtil } from './string-util.class';
18
+ var HeaderUtil = (function () {
19
+ function HeaderUtil() {
20
+ }
21
+ HeaderUtil.parse = function (headers) {
22
+ var getValue = function (name) {
8
23
  var _a;
9
- if (!headers || string_util_class_1.StringUtil.isFalsyString(name)) {
24
+ if (!headers || StringUtil.isFalsyString(name)) {
10
25
  return null;
11
26
  }
12
27
  try {
13
- return (_a = Object.entries(headers).find(([key]) => {
14
- if (string_util_class_1.StringUtil.isFalsyString(key) || key.toUpperCase() !== name.toUpperCase()) {
28
+ return (_a = Object.entries(headers).find(function (_a) {
29
+ var _b = __read(_a, 1), key = _b[0];
30
+ if (StringUtil.isFalsyString(key) || key.toUpperCase() !== name.toUpperCase()) {
15
31
  return false;
16
32
  }
17
33
  return true;
@@ -22,8 +38,9 @@ class HeaderUtil {
22
38
  }
23
39
  };
24
40
  return {
25
- getValue,
41
+ getValue: getValue,
26
42
  };
27
- }
28
- }
29
- exports.HeaderUtil = HeaderUtil;
43
+ };
44
+ return HeaderUtil;
45
+ }());
46
+ export { HeaderUtil };
package/dist/index.js CHANGED
@@ -1,31 +1,15 @@
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("./array-util.class"), exports);
18
- __exportStar(require("./attempt-util.class"), exports);
19
- __exportStar(require("./header-util.class"), exports);
20
- __exportStar(require("./json-util.class"), exports);
21
- __exportStar(require("./string-util.class"), exports);
22
- __exportStar(require("./user-agent-util.class"), exports);
23
- __exportStar(require("./enum-util.class"), exports);
24
- __exportStar(require("./log-util.class"), exports);
25
- __exportStar(require("./crypto-util.class"), exports);
26
- __exportStar(require("./date-util.class"), exports);
27
- __exportStar(require("./url-util.class"), exports);
28
- __exportStar(require("./error-util.class"), exports);
29
- __exportStar(require("./zod"), exports);
30
- __exportStar(require("./schemas"), exports);
31
- __exportStar(require("./enums"), exports);
1
+ export * from './array-util.class';
2
+ export * from './attempt-util.class';
3
+ export * from './header-util.class';
4
+ export * from './json-util.class';
5
+ export * from './string-util.class';
6
+ export * from './user-agent-util.class';
7
+ export * from './enum-util.class';
8
+ export * from './log-util.class';
9
+ export * from './crypto-util.class';
10
+ export * from './date-util.class';
11
+ export * from './url-util.class';
12
+ export * from './error-util.class';
13
+ export * from './zod';
14
+ export * from './schemas';
15
+ export * from './enums';
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JSONUtil = void 0;
4
- class JSONUtil {
5
- static parse(literal, onError) {
1
+ var JSONUtil = (function () {
2
+ function JSONUtil() {
3
+ }
4
+ JSONUtil.parse = function (literal, onError) {
6
5
  var _a;
7
6
  try {
8
7
  return JSON.parse(literal);
@@ -10,6 +9,7 @@ class JSONUtil {
10
9
  catch (e) {
11
10
  return (_a = onError === null || onError === void 0 ? void 0 : onError(e)) !== null && _a !== void 0 ? _a : null;
12
11
  }
13
- }
14
- }
15
- exports.JSONUtil = JSONUtil;
12
+ };
13
+ return JSONUtil;
14
+ }());
15
+ export { JSONUtil };
@@ -1,44 +1,43 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogUtil = void 0;
4
- const string_util_class_1 = require("./string-util.class");
5
- const colors_1 = require("colors");
6
- const LOG_LEVELS = ['debug', 'verbose', 'info', 'warn', 'error'];
7
- class LogUtil {
8
- constructor(defaultLogLevel = 'info') {
1
+ import { StringUtil } from './string-util.class';
2
+ import { cyan, gray, yellow, red } from 'colors';
3
+ var LOG_LEVELS = ['debug', 'verbose', 'info', 'warn', 'error'];
4
+ var LogUtil = (function () {
5
+ function LogUtil(defaultLogLevel) {
6
+ if (defaultLogLevel === void 0) { defaultLogLevel = 'info'; }
9
7
  this.defaultLogLevel = defaultLogLevel;
10
8
  }
11
- match(bottomLogLevel, logLevel) {
9
+ LogUtil.prototype.match = function (bottomLogLevel, logLevel) {
12
10
  if (bottomLogLevel === false)
13
11
  return false;
14
12
  if (bottomLogLevel === true)
15
13
  return true;
16
- return LOG_LEVELS.slice(LOG_LEVELS.findIndex((level) => level === bottomLogLevel)).includes(logLevel);
17
- }
18
- log(level, message) {
14
+ return LOG_LEVELS.slice(LOG_LEVELS.findIndex(function (level) { return level === bottomLogLevel; })).includes(logLevel);
15
+ };
16
+ LogUtil.prototype.log = function (level, message) {
19
17
  var _a, _b, _c, _d;
20
- const colorizer = (() => {
18
+ var colorizer = (function () {
21
19
  switch (level) {
22
20
  case 'debug':
23
- return colors_1.gray;
21
+ return gray;
24
22
  case 'verbose':
25
- return colors_1.cyan;
23
+ return cyan;
26
24
  case 'info':
27
- return (text) => text;
25
+ return function (text) { return text; };
28
26
  case 'warn':
29
- return colors_1.yellow;
27
+ return yellow;
30
28
  case 'error':
31
- return colors_1.red;
29
+ return red;
32
30
  default:
33
- return (text) => text;
31
+ return function (text) { return text; };
34
32
  }
35
33
  })();
36
34
  if (this.match(this.defaultLogLevel, level) === false)
37
35
  return;
38
- const finalExtraMessage = level === 'debug' || (this.defaultLogLevel === 'debug' && level === 'error')
36
+ var finalExtraMessage = level === 'debug' || (this.defaultLogLevel === 'debug' && level === 'error')
39
37
  ? (_d = (_c = (_b = (_a = (message instanceof Error ? message : new Error()).stack) === null || _a === void 0 ? void 0 : _a.split) === null || _b === void 0 ? void 0 : _b.call(_a, '\n')) === null || _c === void 0 ? void 0 : _c.slice(1)) === null || _d === void 0 ? void 0 : _d.join('\n')
40
38
  : '';
41
- console.log(colorizer(`[${new Date().toLocaleString()}] [${level.toUpperCase()}] ${message instanceof Error ? message.message : message}${string_util_class_1.StringUtil.isFalsyString(finalExtraMessage) ? '' : `\n${finalExtraMessage}`}`));
42
- }
43
- }
44
- exports.LogUtil = LogUtil;
39
+ console.log(colorizer("[".concat(new Date().toLocaleString(), "] [").concat(level.toUpperCase(), "] ").concat(message instanceof Error ? message.message : message).concat(StringUtil.isFalsyString(finalExtraMessage) ? '' : "\n".concat(finalExtraMessage))));
40
+ };
41
+ return LogUtil;
42
+ }());
43
+ export { LogUtil };
package/dist/schemas.js CHANGED
@@ -1,25 +1,22 @@
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 = {
1
+ import { DateUtil } from './date-util.class';
2
+ import { EnumUtil } from './enum-util.class';
3
+ import { Enums } from './enums';
4
+ import { z } from './zod';
5
+ var FIND_ONE_OPTIONS_OMIT_PARAMS = {
9
6
  limit: true,
10
7
  lastCursor: true,
11
8
  };
12
- var Schemas;
9
+ export var Schemas;
13
10
  (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({
11
+ Schemas.ID = z.uuid();
12
+ Schemas.ID_LIST = z.array(Schemas.ID).min(1);
13
+ Schemas.ID_LIST_OBJECT = z.object({
17
14
  idList: Schemas.ID_LIST,
18
15
  });
19
- Schemas.ID_OBJECT = zod_1.z.object({
16
+ Schemas.ID_OBJECT = z.object({
20
17
  id: Schemas.ID,
21
18
  });
22
- Schemas.JSON_STRING = zod_1.z.string().refine((value) => {
19
+ Schemas.JSON_STRING = z.string().refine(function (value) {
23
20
  try {
24
21
  JSON.parse(value);
25
22
  return true;
@@ -28,35 +25,35 @@ var Schemas;
28
25
  return false;
29
26
  }
30
27
  });
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({
28
+ Schemas.DATE_STRING = z.string().refine(function (value) { return DateUtil.isValidDateString(value); });
29
+ Schemas.TIME_RECORD = z.object({
33
30
  createdAt: Schemas.DATE_STRING.nullable().optional(),
34
31
  updatedAt: Schemas.DATE_STRING.nullable().optional(),
35
32
  });
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
33
+ Schemas.ORDER_ORIENTATION = EnumUtil.createEnumSchema(Enums.OrderOrientation);
34
+ Schemas.WHERE_CLAUSE_OP = EnumUtil.createEnumSchema(Enums.WhereClauseOp);
35
+ Schemas.LOG_LEVEL = EnumUtil.createEnumSchema(Enums.LogLevel);
36
+ Schemas.COMMON_RESULT = z
40
37
  .object({
41
- succeeded: zod_1.z.boolean(),
42
- content: zod_1.z.string().optional(),
38
+ succeeded: z.boolean(),
39
+ content: z.string().optional(),
43
40
  })
44
41
  .extend(Schemas.ID_OBJECT.partial().shape)
45
42
  .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(),
43
+ Schemas.WHERE_CLAUSE = z.discriminatedUnion('type', [
44
+ z.object({
45
+ field: z.string(),
49
46
  op: Schemas.WHERE_CLAUSE_OP,
50
- type: zod_1.z.literal('condition'),
47
+ type: z.literal('condition'),
51
48
  value: Schemas.JSON_STRING,
52
49
  }),
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'),
50
+ z.object({
51
+ literal: z.string().min(1),
52
+ params: z.array(z.any()).optional(),
53
+ type: z.literal('literal'),
57
54
  }),
58
55
  ]);
59
- Schemas.CONDITION_ONLY_WHERE_CLAUSE = Schemas.WHERE_CLAUSE.superRefine((value, context) => {
56
+ Schemas.CONDITION_ONLY_WHERE_CLAUSE = Schemas.WHERE_CLAUSE.superRefine(function (value, context) {
60
57
  if ((value === null || value === void 0 ? void 0 : value.type) === 'literal') {
61
58
  context.addIssue({
62
59
  code: 'custom',
@@ -64,49 +61,49 @@ var Schemas;
64
61
  });
65
62
  }
66
63
  });
67
- Schemas.ORDER_ITEM = zod_1.z.object({
68
- field: zod_1.z.string(),
64
+ Schemas.ORDER_ITEM = z.object({
65
+ field: z.string(),
69
66
  orientation: Schemas.ORDER_ORIENTATION,
70
67
  });
71
- Schemas.PAGINATION_OPTIONS = zod_1.z.object({
72
- cursorField: zod_1.z.string().default('id').optional(),
68
+ Schemas.PAGINATION_OPTIONS = z.object({
69
+ cursorField: z.string().default('id').optional(),
73
70
  cursorFieldOrderOrientation: Schemas.ORDER_ORIENTATION.default('DESC').optional(),
74
- lastCursor: zod_1.z.string().optional(),
75
- limit: zod_1.z.number().min(0).optional(),
76
- search: zod_1.z
71
+ lastCursor: z.string().optional(),
72
+ limit: z.number().min(0).optional(),
73
+ search: z
77
74
  .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).default(1).optional(),
75
+ fields: z.array(z.union([
76
+ z.string().min(1),
77
+ z.object({
78
+ field: z.string().min(1),
79
+ ratio: z.number().min(-1).max(1).default(1).optional(),
83
80
  }),
84
81
  ])),
85
- value: zod_1.z.string().min(1),
82
+ value: z.string().min(1),
86
83
  })
87
84
  .optional(),
88
- order: zod_1.z.array(Schemas.ORDER_ITEM).optional(),
89
- orderField: zod_1.z.string().default('createdAt').optional(),
85
+ order: z.array(Schemas.ORDER_ITEM).optional(),
86
+ orderField: z.string().default('createdAt').optional(),
90
87
  orderFieldOrderOrientation: Schemas.ORDER_ORIENTATION.default('DESC').optional(),
91
- where: zod_1.z.array(zod_1.z.array(Schemas.WHERE_CLAUSE).min(1)).optional(),
88
+ where: z.array(z.array(Schemas.WHERE_CLAUSE).min(1)).optional(),
92
89
  });
93
90
  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()]),
91
+ Schemas.PAGINATION_RESULT = z.object({
92
+ hasNext: z.boolean(),
93
+ nextCursor: z.union([z.string(), z.null()]),
94
+ previousCursor: z.union([z.string(), z.null()]),
98
95
  });
99
- Schemas.FILE = zod_1.z
96
+ Schemas.FILE = z
100
97
  .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(),
98
+ mimeType: z.string(),
99
+ name: z.string(),
100
+ progres: z.number().min(0).max(1),
101
+ size: z.number().min(0),
102
+ url: z.string(),
106
103
  })
107
104
  .extend(Schemas.TIME_RECORD.shape);
108
105
  Schemas.CONDITION_ONLY_PAGINATION_OPTIONS = Schemas.PAGINATION_OPTIONS.omit({
109
106
  where: true,
110
- }).extend({ where: zod_1.z.array(zod_1.z.array(Schemas.CONDITION_ONLY_WHERE_CLAUSE).min(1)).optional() });
107
+ }).extend({ where: z.array(z.array(Schemas.CONDITION_ONLY_WHERE_CLAUSE).min(1)).optional() });
111
108
  Schemas.CONDITION_ONLY_FIND_ONE_OPTIONS = Schemas.CONDITION_ONLY_PAGINATION_OPTIONS.omit(FIND_ONE_OPTIONS_OMIT_PARAMS);
112
- })(Schemas || (exports.Schemas = Schemas = {}));
109
+ })(Schemas || (Schemas = {}));