easywork-common-lib 1.0.108 → 1.0.110

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 @@
1
+ export * from "./regex.constant";
@@ -0,0 +1,18 @@
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("./regex.constant"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
@@ -0,0 +1,6 @@
1
+ export declare const JWT_EXPIRY_REGEX: RegExp;
2
+ export declare const SENTRY_DSN_REGEX: RegExp;
3
+ export declare const RABBIT_MQ_URI_REGEX: RegExp;
4
+ export declare const REDIS_URI_REGEX: RegExp;
5
+ export declare const USERNAME_REGEX: RegExp;
6
+ export declare const PASSWORD_REGEX: RegExp;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PASSWORD_REGEX = exports.USERNAME_REGEX = exports.REDIS_URI_REGEX = exports.RABBIT_MQ_URI_REGEX = exports.SENTRY_DSN_REGEX = exports.JWT_EXPIRY_REGEX = void 0;
4
+ exports.JWT_EXPIRY_REGEX = /\b(\d+)\s*(ms|s|m|h|d)\b/;
5
+ exports.SENTRY_DSN_REGEX = /https:\/\/[\da-f]{32}@o\d+\.ingest\.sentry\.io\/\d+/;
6
+ exports.RABBIT_MQ_URI_REGEX = /^(amqps?):\/\/(?:[^:@]+:[^:@]+@)?[^/:?]+(?::\d+)?(?:\/[^/?]+)?(?:\?.*)?$/;
7
+ exports.REDIS_URI_REGEX = /^redis:\/\/(?:([^:@]+):([^:@]+)@)?([^/:]+)(?::(\d+))?(?:\/(\d+))?$/;
8
+ exports.USERNAME_REGEX = /^(?![\d._-])[\w-.]+$/;
9
+ exports.PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*\W).*$/;
10
+ //# sourceMappingURL=regex.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.constant.js","sourceRoot":"","sources":["../../../src/common/constants/regex.constant.ts"],"names":[],"mappings":";;;AACa,QAAA,gBAAgB,GAAG,0BAA0B,CAAC;AAC9C,QAAA,gBAAgB,GACzB,qDAAqD,CAAC;AAC7C,QAAA,mBAAmB,GAC5B,0EAA0E,CAAC;AAClE,QAAA,eAAe,GACxB,oEAAoE,CAAC;AAC5D,QAAA,cAAc,GAAG,sBAAsB,CAAC;AACxC,QAAA,cAAc,GAAG,4CAA4C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { INestApplication, ValidationPipeOptions } from "@nestjs/common";
2
+ export declare const AppUtils: {
3
+ validationPipeOptions(): ValidationPipeOptions;
4
+ gracefulShutdown(app: INestApplication, code: string): Promise<never>;
5
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppUtils = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const helpers_utils_1 = require("./helpers.utils");
6
+ const logger = new common_1.Logger("App:Utils");
7
+ exports.AppUtils = {
8
+ validationPipeOptions() {
9
+ return {
10
+ whitelist: true,
11
+ transform: true,
12
+ forbidUnknownValues: false,
13
+ validateCustomDecorators: true,
14
+ enableDebugMessages: helpers_utils_1.HelperService.isDev(),
15
+ };
16
+ },
17
+ async gracefulShutdown(app, code) {
18
+ setTimeout(() => process.exit(1), 5000);
19
+ logger.verbose(`Signal received with code ${code} ⚡.`);
20
+ logger.log("❗Closing http server with grace.");
21
+ try {
22
+ await app.close();
23
+ logger.log("✅ Http server closed.");
24
+ process.exit(0);
25
+ }
26
+ catch (error) {
27
+ logger.error(`❌ Http server closed with error: ${error}`);
28
+ process.exit(1);
29
+ }
30
+ },
31
+ };
32
+ //# sourceMappingURL=app.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.utils.js","sourceRoot":"","sources":["../../../src/common/helpers/app.utils.ts"],"names":[],"mappings":";;;AAAA,2CAAiF;AACjF,mDAAgD;AAEhD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,WAAW,CAAC,CAAC;AAE1B,QAAA,QAAQ,GAAG;IACpB,qBAAqB;QACjB,OAAO;YACH,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;YACf,mBAAmB,EAAE,KAAK;YAC1B,wBAAwB,EAAE,IAAI;YAC9B,mBAAmB,EAAE,6BAAa,CAAC,KAAK,EAAE;SAC7C,CAAA;IACL,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,GAAqB,EAAE,IAAY;QACtD,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,6BAA6B,IAAI,KAAK,CAAC,CAAC;QACvD,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAE/C,IAAI,CAAC;YACD,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,MAAM,CAAC,KAAK,CAAC,oCAAoC,KAAK,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;CAEJ,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare const HelperService: {
2
+ isDev(): boolean;
3
+ isProd(): boolean;
4
+ getAppRootDir(): string;
5
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HelperService = void 0;
7
+ const node_process_1 = __importDefault(require("node:process"));
8
+ const node_path_1 = require("node:path");
9
+ const node_fs_1 = require("node:fs");
10
+ exports.HelperService = {
11
+ isDev() {
12
+ return node_process_1.default.env.NODE_ENV?.startsWith("dev");
13
+ },
14
+ isProd() {
15
+ return node_process_1.default.env.NODE_ENV?.startsWith("prod");
16
+ },
17
+ getAppRootDir() {
18
+ let currentDirectory = __dirname;
19
+ while (!(0, node_fs_1.existsSync)((0, node_path_1.join)(currentDirectory, "resources")))
20
+ currentDirectory = (0, node_path_1.join)(currentDirectory, "..");
21
+ return node_process_1.default.env.NODE_ENV === "prod"
22
+ ? (0, node_path_1.join)(currentDirectory, "dist")
23
+ : currentDirectory;
24
+ },
25
+ };
26
+ //# sourceMappingURL=helpers.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.utils.js","sourceRoot":"","sources":["../../../src/common/helpers/helpers.utils.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAmC;AACnC,yCAAiC;AACjC,qCAAqC;AAExB,QAAA,aAAa,GAAG;IACzB,KAAK;QACD,OAAO,sBAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,MAAM;QACF,OAAO,sBAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,aAAa;QACT,IAAI,gBAAgB,GAAG,SAAS,CAAC;QAEjC,OAAO,CAAC,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;YACnD,gBAAgB,GAAG,IAAA,gBAAI,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAEpD,OAAO,sBAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;YAClC,CAAC,CAAC,IAAA,gBAAI,EAAC,gBAAgB,EAAE,MAAM,CAAC;YAChC,CAAC,CAAC,gBAAgB,CAAC;IAC3B,CAAC;CACJ,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./app.utils";
2
+ export * from "./helpers.utils";
@@ -0,0 +1,19 @@
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("./app.utils"), exports);
18
+ __exportStar(require("./helpers.utils"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC"}
@@ -1,3 +1,5 @@
1
1
  export * from "./enums";
2
2
  export * from "./database";
3
3
  export * from "./interceptors";
4
+ export * from "./helpers";
5
+ export * from "./constants";
@@ -17,4 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./enums"), exports);
18
18
  __exportStar(require("./database"), exports);
19
19
  __exportStar(require("./interceptors"), exports);
20
+ __exportStar(require("./helpers"), exports);
21
+ __exportStar(require("./constants"), exports);
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,iDAA+B;AAC/B,4CAA0B;AAC1B,8CAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easywork-common-lib",
3
- "version": "1.0.108",
3
+ "version": "1.0.110",
4
4
  "description": "Librería común de Easywork",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@rubiin/tsconfig": "^1.1.2",
33
+ "@types/node": "^20.12.12",
33
34
  "ts-loader": "^9.5.1",
34
35
  "typescript": "^5.4.5"
35
36
  }