@open-norantec/utilities 2.1.1 → 2.1.3

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,47 +1,26 @@
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';
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");
17
5
  function isZodError(error) {
18
6
  return typeof error === 'object' && error !== null && 'issues' in error && Array.isArray(error.issues);
19
7
  }
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;
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;
31
14
  }
32
- return ResponseError;
33
- }(Error));
34
- var ErrorUtil = (function () {
35
- function ErrorUtil() {
36
- }
37
- ErrorUtil.createResponseError = function (error, statusCode) {
38
- if (statusCode === void 0) { statusCode = 500; }
15
+ }
16
+ class ErrorUtil {
17
+ static createResponseError(error, statusCode = 500) {
39
18
  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 = [];
19
+ }
20
+ static formatError(error) {
21
+ const id = uuid_util_class_1.UUIDUtil.generateV4();
22
+ let message;
23
+ let errorLogs = [];
45
24
  if (isZodError(error)) {
46
25
  message = JSON.stringify({
47
26
  message: 'Failed to validate your input data ({{context.trace}})',
@@ -53,7 +32,7 @@ var ErrorUtil = (function () {
53
32
  }
54
33
  else {
55
34
  message = JSON.stringify({
56
- message: "".concat(error.message || 'An unknown error occurred', " ({{context.trace}})"),
35
+ message: `${error.message || 'An unknown error occurred'} ({{context.trace}})`,
57
36
  context: {
58
37
  trace: id,
59
38
  },
@@ -61,11 +40,11 @@ var ErrorUtil = (function () {
61
40
  }
62
41
  errorLogs.push((error === null || error === void 0 ? void 0 : error.stack) || 'No stack trace available');
63
42
  return {
64
- id: id,
65
- message: message,
66
- logs: errorLogs.map(function (log) { return "[AUTO_ERROR] [".concat(id, "] [").concat(new Date().toISOString(), "] ").concat(log); }),
43
+ id,
44
+ message,
45
+ logs: errorLogs.map((log) => `[AUTO_ERROR] [${id}] [${new Date().toISOString()}] ${log}`),
67
46
  response: new Response(message, {
68
- status: (function () {
47
+ status: (() => {
69
48
  if (isZodError(error))
70
49
  return 400;
71
50
  if (error instanceof ResponseError)
@@ -75,7 +54,6 @@ var ErrorUtil = (function () {
75
54
  headers: { 'Content-Type': 'application/json' },
76
55
  }),
77
56
  };
78
- };
79
- return ErrorUtil;
80
- }());
81
- export { ErrorUtil };
57
+ }
58
+ }
59
+ exports.ErrorUtil = ErrorUtil;
@@ -1,43 +1,65 @@
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() {
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]; } };
19
7
  }
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;
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ESLintUtil = void 0;
37
+ const tsParser = __importStar(require("@typescript-eslint/parser"));
38
+ const tsPlugin = __importStar(require("@typescript-eslint/eslint-plugin"));
39
+ const stylistic = __importStar(require("@stylistic/eslint-plugin"));
40
+ const prettier = __importStar(require("eslint-plugin-prettier"));
41
+ const _ = __importStar(require("lodash"));
42
+ class ESLintUtil {
43
+ static create({ ignores = [], project = './tsconfig.json', rules, }) {
44
+ var _a, _b, _c, _d;
23
45
  return [
24
46
  {
25
47
  files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mts', '**/*.cts', '**/*.mjs', '**/*.cjs'],
26
48
  languageOptions: {
27
49
  parser: tsParser,
28
50
  parserOptions: {
29
- project: project,
51
+ project,
30
52
  tsconfigRootDir: process.cwd(),
31
53
  sourceType: 'module',
32
54
  },
33
55
  },
34
- ignores: ignores,
56
+ ignores,
35
57
  plugins: {
36
58
  '@typescript-eslint': tsPlugin,
37
59
  '@stylistic': stylistic,
38
- prettier: prettier,
60
+ prettier,
39
61
  },
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': [
62
+ rules: _.merge(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': [
41
63
  'error',
42
64
  {
43
65
  singleQuote: true,
@@ -63,7 +85,6 @@ var ESLintUtil = (function () {
63
85
  ], 'object-curly-newline': ['error', { multiline: true, consistent: true }], 'multiline-ternary': 'off' }), rules || {}),
64
86
  },
65
87
  ];
66
- };
67
- return ESLintUtil;
68
- }());
69
- export { ESLintUtil };
88
+ }
89
+ }
90
+ exports.ESLintUtil = ESLintUtil;
@@ -1,33 +1,17 @@
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) {
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) => {
23
8
  var _a;
24
- if (!headers || StringUtil.isFalsyString(name)) {
9
+ if (!headers || string_util_class_1.StringUtil.isFalsyString(name)) {
25
10
  return null;
26
11
  }
27
12
  try {
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()) {
13
+ return (_a = Object.entries(headers).find(([key]) => {
14
+ if (string_util_class_1.StringUtil.isFalsyString(key) || key.toUpperCase() !== name.toUpperCase()) {
31
15
  return false;
32
16
  }
33
17
  return true;
@@ -38,9 +22,8 @@ var HeaderUtil = (function () {
38
22
  }
39
23
  };
40
24
  return {
41
- getValue: getValue,
25
+ getValue,
42
26
  };
43
- };
44
- return HeaderUtil;
45
- }());
46
- export { HeaderUtil };
27
+ }
28
+ }
29
+ exports.HeaderUtil = HeaderUtil;
package/dist/index.js CHANGED
@@ -1,15 +1,31 @@
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
+ "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,7 +1,8 @@
1
- var JSONUtil = (function () {
2
- function JSONUtil() {
3
- }
4
- JSONUtil.parse = function (literal, onError) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSONUtil = void 0;
4
+ class JSONUtil {
5
+ static parse(literal, onError) {
5
6
  var _a;
6
7
  try {
7
8
  return JSON.parse(literal);
@@ -9,7 +10,6 @@ var JSONUtil = (function () {
9
10
  catch (e) {
10
11
  return (_a = onError === null || onError === void 0 ? void 0 : onError(e)) !== null && _a !== void 0 ? _a : null;
11
12
  }
12
- };
13
- return JSONUtil;
14
- }());
15
- export { JSONUtil };
13
+ }
14
+ }
15
+ exports.JSONUtil = JSONUtil;
@@ -1,43 +1,44 @@
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'; }
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') {
7
9
  this.defaultLogLevel = defaultLogLevel;
8
10
  }
9
- LogUtil.prototype.match = function (bottomLogLevel, logLevel) {
11
+ match(bottomLogLevel, logLevel) {
10
12
  if (bottomLogLevel === false)
11
13
  return false;
12
14
  if (bottomLogLevel === true)
13
15
  return true;
14
- return LOG_LEVELS.slice(LOG_LEVELS.findIndex(function (level) { return level === bottomLogLevel; })).includes(logLevel);
15
- };
16
- LogUtil.prototype.log = function (level, message) {
16
+ return LOG_LEVELS.slice(LOG_LEVELS.findIndex((level) => level === bottomLogLevel)).includes(logLevel);
17
+ }
18
+ log(level, message) {
17
19
  var _a, _b, _c, _d;
18
- var colorizer = (function () {
20
+ const colorizer = (() => {
19
21
  switch (level) {
20
22
  case 'debug':
21
- return gray;
23
+ return colors_1.gray;
22
24
  case 'verbose':
23
- return cyan;
25
+ return colors_1.cyan;
24
26
  case 'info':
25
- return function (text) { return text; };
27
+ return (text) => text;
26
28
  case 'warn':
27
- return yellow;
29
+ return colors_1.yellow;
28
30
  case 'error':
29
- return red;
31
+ return colors_1.red;
30
32
  default:
31
- return function (text) { return text; };
33
+ return (text) => text;
32
34
  }
33
35
  })();
34
36
  if (this.match(this.defaultLogLevel, level) === false)
35
37
  return;
36
- var finalExtraMessage = level === 'debug' || (this.defaultLogLevel === 'debug' && level === 'error')
38
+ const finalExtraMessage = level === 'debug' || (this.defaultLogLevel === 'debug' && level === 'error')
37
39
  ? (_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')
38
40
  : '';
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 };
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;
package/dist/schemas.js CHANGED
@@ -1,22 +1,25 @@
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 = {
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 = {
6
9
  limit: true,
7
10
  lastCursor: true,
8
11
  };
9
- export var Schemas;
12
+ var Schemas;
10
13
  (function (Schemas) {
11
- Schemas.ID = z.uuid();
12
- Schemas.ID_LIST = z.array(Schemas.ID).min(1);
13
- Schemas.ID_LIST_OBJECT = z.object({
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({
14
17
  idList: Schemas.ID_LIST,
15
18
  });
16
- Schemas.ID_OBJECT = z.object({
19
+ Schemas.ID_OBJECT = zod_1.z.object({
17
20
  id: Schemas.ID,
18
21
  });
19
- Schemas.JSON_STRING = z.string().refine(function (value) {
22
+ Schemas.JSON_STRING = zod_1.z.string().refine((value) => {
20
23
  try {
21
24
  JSON.parse(value);
22
25
  return true;
@@ -25,35 +28,35 @@ export var Schemas;
25
28
  return false;
26
29
  }
27
30
  });
28
- Schemas.DATE_STRING = z.string().refine(function (value) { return DateUtil.isValidDateString(value); });
29
- Schemas.TIME_RECORD = z.object({
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({
30
33
  createdAt: Schemas.DATE_STRING.nullable().optional(),
31
34
  updatedAt: Schemas.DATE_STRING.nullable().optional(),
32
35
  });
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
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
37
40
  .object({
38
- succeeded: z.boolean(),
39
- content: z.string().optional(),
41
+ succeeded: zod_1.z.boolean(),
42
+ content: zod_1.z.string().optional(),
40
43
  })
41
44
  .extend(Schemas.ID_OBJECT.partial().shape)
42
45
  .extend(Schemas.TIME_RECORD.shape);
43
- Schemas.WHERE_CLAUSE = z.discriminatedUnion('type', [
44
- z.object({
45
- field: z.string(),
46
+ Schemas.WHERE_CLAUSE = zod_1.z.discriminatedUnion('type', [
47
+ zod_1.z.object({
48
+ field: zod_1.z.string(),
46
49
  op: Schemas.WHERE_CLAUSE_OP,
47
- type: z.literal('condition'),
50
+ type: zod_1.z.literal('condition'),
48
51
  value: Schemas.JSON_STRING,
49
52
  }),
50
- z.object({
51
- literal: z.string().min(1),
52
- params: z.array(z.any()).optional(),
53
- type: z.literal('literal'),
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'),
54
57
  }),
55
58
  ]);
56
- Schemas.CONDITION_ONLY_WHERE_CLAUSE = Schemas.WHERE_CLAUSE.superRefine(function (value, context) {
59
+ Schemas.CONDITION_ONLY_WHERE_CLAUSE = Schemas.WHERE_CLAUSE.superRefine((value, context) => {
57
60
  if ((value === null || value === void 0 ? void 0 : value.type) === 'literal') {
58
61
  context.addIssue({
59
62
  code: 'custom',
@@ -61,49 +64,49 @@ export var Schemas;
61
64
  });
62
65
  }
63
66
  });
64
- Schemas.ORDER_ITEM = z.object({
65
- field: z.string(),
67
+ Schemas.ORDER_ITEM = zod_1.z.object({
68
+ field: zod_1.z.string(),
66
69
  orientation: Schemas.ORDER_ORIENTATION,
67
70
  });
68
- Schemas.PAGINATION_OPTIONS = z.object({
69
- cursorField: z.string().default('id').optional(),
71
+ Schemas.PAGINATION_OPTIONS = zod_1.z.object({
72
+ cursorField: zod_1.z.string().default('id').optional(),
70
73
  cursorFieldOrderOrientation: Schemas.ORDER_ORIENTATION.default('DESC').optional(),
71
- lastCursor: z.string().optional(),
72
- limit: z.number().min(0).optional(),
73
- search: z
74
+ lastCursor: zod_1.z.string().optional(),
75
+ limit: zod_1.z.number().min(0).optional(),
76
+ search: zod_1.z
74
77
  .object({
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(),
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(),
80
83
  }),
81
84
  ])),
82
- value: z.string().min(1),
85
+ value: zod_1.z.string().min(1),
83
86
  })
84
87
  .optional(),
85
- order: z.array(Schemas.ORDER_ITEM).optional(),
86
- orderField: z.string().default('createdAt').optional(),
88
+ order: zod_1.z.array(Schemas.ORDER_ITEM).optional(),
89
+ orderField: zod_1.z.string().default('createdAt').optional(),
87
90
  orderFieldOrderOrientation: Schemas.ORDER_ORIENTATION.default('DESC').optional(),
88
- where: z.array(z.array(Schemas.WHERE_CLAUSE).min(1)).optional(),
91
+ where: zod_1.z.array(zod_1.z.array(Schemas.WHERE_CLAUSE).min(1)).optional(),
89
92
  });
90
93
  Schemas.FIND_ONE_OPTIONS = Schemas.PAGINATION_OPTIONS.omit(FIND_ONE_OPTIONS_OMIT_PARAMS);
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()]),
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()]),
95
98
  });
96
- Schemas.FILE = z
99
+ Schemas.FILE = zod_1.z
97
100
  .object({
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(),
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(),
103
106
  })
104
107
  .extend(Schemas.TIME_RECORD.shape);
105
108
  Schemas.CONDITION_ONLY_PAGINATION_OPTIONS = Schemas.PAGINATION_OPTIONS.omit({
106
109
  where: true,
107
- }).extend({ where: z.array(z.array(Schemas.CONDITION_ONLY_WHERE_CLAUSE).min(1)).optional() });
110
+ }).extend({ where: zod_1.z.array(zod_1.z.array(Schemas.CONDITION_ONLY_WHERE_CLAUSE).min(1)).optional() });
108
111
  Schemas.CONDITION_ONLY_FIND_ONE_OPTIONS = Schemas.CONDITION_ONLY_PAGINATION_OPTIONS.omit(FIND_ONE_OPTIONS_OMIT_PARAMS);
109
- })(Schemas || (Schemas = {}));
112
+ })(Schemas || (exports.Schemas = Schemas = {}));