@nathapp/nestjs-common 4.6.1 → 4.7.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.
package/README.md CHANGED
@@ -1,6 +1,34 @@
1
1
  # Common NestJs Library
2
2
  this is a NestJs Common Library, can be use on fastify and express
3
3
 
4
+ # Entry Points
5
+
6
+ The root entry point `@nathapp/nestjs-common` exports everything. Loading it also
7
+ loads `nestjs-i18n`, `class-validator`, `joi`, `@nestjs/config` and `@nestjs/core`,
8
+ which costs about 90ms on every fresh module registry (each Jest test file).
9
+
10
+ Code that only needs the light pieces can import a subpath instead. A subpath
11
+ exports the same classes and values as the root, so `instanceof` checks work
12
+ across both.
13
+
14
+ | Subpath | Exports | Heavy dependencies |
15
+ | --- | --- | --- |
16
+ | `@nathapp/nestjs-common/clock` | `CLOCK`, `IClock`, `SystemClock`, `ClockModule` | none |
17
+ | `@nathapp/nestjs-common/id-generator` | `ID_GENERATOR`, `IIdGenerator`, `UuidIdGenerator`, `IdGeneratorModule` | none |
18
+ | `@nathapp/nestjs-common/exception` | `AppException`, `AppExceptionArgs`, `CommonExceptionCode` and the exception subclasses (not the filters or `ExceptionModule`) | none |
19
+ | `@nathapp/nestjs-common/pagination` | `Page`, `PageOption`, `IPageOption`, `resolvePageOption` | `class-transformer` only |
20
+ | `@nathapp/nestjs-common/outbound-http` | `GuardedHttpClient`, `assertOutboundUrl`, `OutboundUrlBlockedError`, policy types | none |
21
+ | `@nathapp/nestjs-common/module` | `ConfigurableModuleClass`, `createClassTypeOrAsyncOptionsProvider` and related types | none |
22
+ | `@nathapp/nestjs-common/ip` | `getClientIp`, `configureTrustProxy`, trusted proxy presets | none |
23
+ | `@nathapp/nestjs-common/utils` | `loadPackage`, `isPackageInstalled`, `resolvePackagePath` | none |
24
+ | `@nathapp/nestjs-common/i18n` | `I18nCoreModule`, `I18nWrapper` | `nestjs-i18n` |
25
+
26
+ The subpaths resolve with every TypeScript `moduleResolution` mode, including the
27
+ default `node10` used with `module: CommonJS` (through `typesVersions`).
28
+
29
+ Deep imports into `dist` still resolve, but must include the file extension, for
30
+ example `@nathapp/nestjs-common/dist/clock/index.js`.
31
+
4
32
  # Environment Variables for Module Or Services
5
33
 
6
34
  1.) I18n - I18nCoreModule
@@ -13,6 +13,7 @@ exports.ServerSecurityConfigSchema = exports.SERVER_SECURITY_CFG = void 0;
13
13
  const config_1 = require("@nestjs/config");
14
14
  const common_1 = require("@nestjs/common");
15
15
  const class_validator_1 = require("class-validator");
16
+ const safe_regex2_1 = require("safe-regex2");
16
17
  const validate_util_1 = require("./utils/validate-util");
17
18
  const helmetLogger = new common_1.Logger('ServerSecurityConfig');
18
19
  exports.SERVER_SECURITY_CFG = 'SERVER_SECURITY_CONFIG';
@@ -49,27 +50,6 @@ __decorate([
49
50
  (0, class_validator_1.IsBooleanString)(),
50
51
  __metadata("design:type", String)
51
52
  ], ServerSecurityConfigSchema.prototype, "SERVER_CORS_CREDENTIALS", void 0);
52
- function isCatastrophicRegex(regex) {
53
- if (regex.source.length > 256)
54
- return true;
55
- const budgetMs = 25;
56
- const start = Date.now();
57
- for (const len of [8, 16, 24, 32, 40]) {
58
- if (Date.now() - start > budgetMs)
59
- return true;
60
- regex.lastIndex = 0;
61
- const t0 = Date.now();
62
- try {
63
- regex.test('a'.repeat(len));
64
- }
65
- catch (_a) {
66
- return true;
67
- }
68
- if (Date.now() - t0 > budgetMs || Date.now() - start > budgetMs)
69
- return true;
70
- }
71
- return false;
72
- }
73
53
  exports.default = (0, config_1.registerAs)(exports.SERVER_SECURITY_CFG, () => {
74
54
  (0, validate_util_1.validateUtil)(process.env, ServerSecurityConfigSchema);
75
55
  const origins = process.env.SERVER_CORS_ORIGIN || '';
@@ -103,9 +83,9 @@ exports.default = (0, config_1.registerAs)(exports.SERVER_SECURITY_CFG, () => {
103
83
  }
104
84
  try {
105
85
  const regex = new RegExp(match[1], match[2]);
106
- if (isCatastrophicRegex(regex)) {
86
+ if (regex.source.length > 256 || !(0, safe_regex2_1.safeRegex)(regex)) {
107
87
  helmetLogger.warn(`Unsafe CORS origin regex: ${value} — skipping. ` +
108
- 'The pattern exhibits catastrophic backtracking (ReDoS risk) on the probe ladder.');
88
+ 'Patterns must be at most 256 characters and pass the static regex safety check.');
109
89
  return null;
110
90
  }
111
91
  return regex;
@@ -1 +1 @@
1
- {"version":3,"file":"server-security.config.js","sourceRoot":"","sources":["../../lib/config/server-security.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,qDAAwE;AACxE,yDAAqD;AAErD,MAAM,YAAY,GAAG,IAAI,eAAM,CAAC,sBAAsB,CAAC,CAAC;AAE3C,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AA2C5D,MAAa,0BAA0B;CAwBtC;AAxBD,gEAwBC;AArBC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;qEACS;AAI3B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;mEACO;AAIzB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sEACe;AAI5B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uEACgB;AAI7B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uEACgB;AAI7B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;2EACe;AAgBnC,SAAS,mBAAmB,CAAC,KAAa;IACxC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QACtC,IAA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CAAC;gBACd,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA4B,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE9D,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QAE/B,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;KAChC,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"server-security.config.js","sourceRoot":"","sources":["../../lib/config/server-security.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,qDAAwE;AACxE,6CAAwC;AACxC,yDAAqD;AAErD,MAAM,YAAY,GAAG,IAAI,eAAM,CAAC,sBAAsB,CAAC,CAAC;AAE3C,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AA2C5D,MAAa,0BAA0B;CAwBtC;AAxBD,gEAwBC;AArBC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;qEACS;AAI3B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;mEACO;AAIzB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sEACe;AAI5B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uEACgB;AAI7B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uEACgB;AAI7B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,iCAAe,GAAE;;2EACe;AAOnC,kBAAe,IAAA,mBAAU,EAAC,2BAAmB,EAAE,GAA0B,EAAE;IAEzE,IAAA,4BAAY,EAAC,OAAO,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC;IACrD,MAAM,OAAO,GACX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,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7C,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAA,uBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;wBACnD,YAAY,CAAC,IAAI,CACf,6BAA6B,KAAK,eAAe;4BACjD,iFAAiF,CAClF,CAAC;wBACF,OAAO,IAAI,CAAC;oBACd,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,YAAY,CAAC,IAAI,CAAC,8BAA8B,KAAK,uBAAuB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC1H,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA4B,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE9D,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QAE/B,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;KAChC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { CommonExceptionCode } from "./app-exception-code.enum";
2
+ export { AppException, type AppExceptionArgs } from "./app.exception";
3
+ export { HttpMicroServiceException } from "./micro-service.exception";
4
+ export { UsernameNotFoundException } from "./user-not-found.exception";
5
+ export { AuthException, CaptchaException, ForbiddenAppException, InternalAppException, NotFoundAppException, ThrottleAppException, TwoFactorInvalidException, TwoFactorRequiredException, ValidationAppException, } from "./exceptions";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationAppException = exports.TwoFactorRequiredException = exports.TwoFactorInvalidException = exports.ThrottleAppException = exports.NotFoundAppException = exports.InternalAppException = exports.ForbiddenAppException = exports.CaptchaException = exports.AuthException = exports.UsernameNotFoundException = exports.HttpMicroServiceException = exports.AppException = exports.CommonExceptionCode = void 0;
4
+ var app_exception_code_enum_1 = require("./app-exception-code.enum");
5
+ Object.defineProperty(exports, "CommonExceptionCode", { enumerable: true, get: function () { return app_exception_code_enum_1.CommonExceptionCode; } });
6
+ var app_exception_1 = require("./app.exception");
7
+ Object.defineProperty(exports, "AppException", { enumerable: true, get: function () { return app_exception_1.AppException; } });
8
+ var micro_service_exception_1 = require("./micro-service.exception");
9
+ Object.defineProperty(exports, "HttpMicroServiceException", { enumerable: true, get: function () { return micro_service_exception_1.HttpMicroServiceException; } });
10
+ var user_not_found_exception_1 = require("./user-not-found.exception");
11
+ Object.defineProperty(exports, "UsernameNotFoundException", { enumerable: true, get: function () { return user_not_found_exception_1.UsernameNotFoundException; } });
12
+ var exceptions_1 = require("./exceptions");
13
+ Object.defineProperty(exports, "AuthException", { enumerable: true, get: function () { return exceptions_1.AuthException; } });
14
+ Object.defineProperty(exports, "CaptchaException", { enumerable: true, get: function () { return exceptions_1.CaptchaException; } });
15
+ Object.defineProperty(exports, "ForbiddenAppException", { enumerable: true, get: function () { return exceptions_1.ForbiddenAppException; } });
16
+ Object.defineProperty(exports, "InternalAppException", { enumerable: true, get: function () { return exceptions_1.InternalAppException; } });
17
+ Object.defineProperty(exports, "NotFoundAppException", { enumerable: true, get: function () { return exceptions_1.NotFoundAppException; } });
18
+ Object.defineProperty(exports, "ThrottleAppException", { enumerable: true, get: function () { return exceptions_1.ThrottleAppException; } });
19
+ Object.defineProperty(exports, "TwoFactorInvalidException", { enumerable: true, get: function () { return exceptions_1.TwoFactorInvalidException; } });
20
+ Object.defineProperty(exports, "TwoFactorRequiredException", { enumerable: true, get: function () { return exceptions_1.TwoFactorRequiredException; } });
21
+ Object.defineProperty(exports, "ValidationAppException", { enumerable: true, get: function () { return exceptions_1.ValidationAppException; } });
22
+ //# sourceMappingURL=classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.js","sourceRoot":"","sources":["../../lib/exception/classes.ts"],"names":[],"mappings":";;;AAOA,qEAAgE;AAAvD,8HAAA,mBAAmB,OAAA;AAC5B,iDAAsE;AAA7D,6GAAA,YAAY,OAAA;AACrB,qEAAsE;AAA7D,oIAAA,yBAAyB,OAAA;AAClC,uEAAuE;AAA9D,qIAAA,yBAAyB,OAAA;AAClC,2CAUsB;AATpB,2GAAA,aAAa,OAAA;AACb,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AACrB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,uHAAA,yBAAyB,OAAA;AACzB,wHAAA,0BAA0B,OAAA;AAC1B,oHAAA,sBAAsB,OAAA"}
@@ -1,13 +1,8 @@
1
- import { CommonExceptionCode } from "./app-exception-code.enum";
2
- import { AppException, AppExceptionArgs } from "./app.exception";
3
- import { DefaultI18nValidationExceptionFilter, defaultResponseFormatter } from "./default-i18n-validation-exception.filter";
4
- import { GlobalExceptionsFilter } from "./global-exception.filter";
5
- import { I18nValidationExceptionFilter, type I18nValidationExceptionFilterOptions } from "./i18n-validation-exception.filter";
6
- import { HttpMicroServiceException } from "./micro-service.exception";
7
- import { UsernameNotFoundException } from "./user-not-found.exception";
8
- import { AuthException, CaptchaException, ForbiddenAppException, InternalAppException, NotFoundAppException, ThrottleAppException, TwoFactorInvalidException, TwoFactorRequiredException, ValidationAppException } from "./exceptions";
9
- import { ExceptionModule } from "./exception.module";
10
- import { EXCEPTION_HANDLERS } from "./exception.constants";
11
- import { resolveRequestLanguage } from "./request-language.util";
12
- export { AppException, AppExceptionArgs, GlobalExceptionsFilter, UsernameNotFoundException, CommonExceptionCode, HttpMicroServiceException, defaultResponseFormatter, DefaultI18nValidationExceptionFilter, type I18nValidationExceptionFilterOptions, I18nValidationExceptionFilter, CaptchaException, TwoFactorRequiredException, TwoFactorInvalidException, AuthException, ForbiddenAppException, NotFoundAppException, ValidationAppException, ThrottleAppException, InternalAppException, ExceptionModule, EXCEPTION_HANDLERS, resolveRequestLanguage, };
1
+ export * from "./classes";
2
+ export { DefaultI18nValidationExceptionFilter, defaultResponseFormatter } from "./default-i18n-validation-exception.filter";
3
+ export { GlobalExceptionsFilter } from "./global-exception.filter";
4
+ export { I18nValidationExceptionFilter, type I18nValidationExceptionFilterOptions } from "./i18n-validation-exception.filter";
5
+ export { ExceptionModule } from "./exception.module";
6
+ export { EXCEPTION_HANDLERS } from "./exception.constants";
7
+ export { resolveRequestLanguage } from "./request-language.util";
13
8
  export type { ExceptionHandler, ExceptionContext, ExceptionResult } from "./handler";
@@ -1,35 +1,32 @@
1
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveRequestLanguage = exports.EXCEPTION_HANDLERS = exports.ExceptionModule = exports.InternalAppException = exports.ThrottleAppException = exports.ValidationAppException = exports.NotFoundAppException = exports.ForbiddenAppException = exports.AuthException = exports.TwoFactorInvalidException = exports.TwoFactorRequiredException = exports.CaptchaException = exports.I18nValidationExceptionFilter = exports.DefaultI18nValidationExceptionFilter = exports.defaultResponseFormatter = exports.HttpMicroServiceException = exports.CommonExceptionCode = exports.UsernameNotFoundException = exports.GlobalExceptionsFilter = exports.AppException = void 0;
4
- const app_exception_code_enum_1 = require("./app-exception-code.enum");
5
- Object.defineProperty(exports, "CommonExceptionCode", { enumerable: true, get: function () { return app_exception_code_enum_1.CommonExceptionCode; } });
6
- const app_exception_1 = require("./app.exception");
7
- Object.defineProperty(exports, "AppException", { enumerable: true, get: function () { return app_exception_1.AppException; } });
8
- const default_i18n_validation_exception_filter_1 = require("./default-i18n-validation-exception.filter");
17
+ exports.resolveRequestLanguage = exports.EXCEPTION_HANDLERS = exports.ExceptionModule = exports.I18nValidationExceptionFilter = exports.GlobalExceptionsFilter = exports.defaultResponseFormatter = exports.DefaultI18nValidationExceptionFilter = void 0;
18
+ __exportStar(require("./classes"), exports);
19
+ var default_i18n_validation_exception_filter_1 = require("./default-i18n-validation-exception.filter");
9
20
  Object.defineProperty(exports, "DefaultI18nValidationExceptionFilter", { enumerable: true, get: function () { return default_i18n_validation_exception_filter_1.DefaultI18nValidationExceptionFilter; } });
10
21
  Object.defineProperty(exports, "defaultResponseFormatter", { enumerable: true, get: function () { return default_i18n_validation_exception_filter_1.defaultResponseFormatter; } });
11
- const global_exception_filter_1 = require("./global-exception.filter");
22
+ var global_exception_filter_1 = require("./global-exception.filter");
12
23
  Object.defineProperty(exports, "GlobalExceptionsFilter", { enumerable: true, get: function () { return global_exception_filter_1.GlobalExceptionsFilter; } });
13
- const i18n_validation_exception_filter_1 = require("./i18n-validation-exception.filter");
24
+ var i18n_validation_exception_filter_1 = require("./i18n-validation-exception.filter");
14
25
  Object.defineProperty(exports, "I18nValidationExceptionFilter", { enumerable: true, get: function () { return i18n_validation_exception_filter_1.I18nValidationExceptionFilter; } });
15
- const micro_service_exception_1 = require("./micro-service.exception");
16
- Object.defineProperty(exports, "HttpMicroServiceException", { enumerable: true, get: function () { return micro_service_exception_1.HttpMicroServiceException; } });
17
- const user_not_found_exception_1 = require("./user-not-found.exception");
18
- Object.defineProperty(exports, "UsernameNotFoundException", { enumerable: true, get: function () { return user_not_found_exception_1.UsernameNotFoundException; } });
19
- const exceptions_1 = require("./exceptions");
20
- Object.defineProperty(exports, "AuthException", { enumerable: true, get: function () { return exceptions_1.AuthException; } });
21
- Object.defineProperty(exports, "CaptchaException", { enumerable: true, get: function () { return exceptions_1.CaptchaException; } });
22
- Object.defineProperty(exports, "ForbiddenAppException", { enumerable: true, get: function () { return exceptions_1.ForbiddenAppException; } });
23
- Object.defineProperty(exports, "InternalAppException", { enumerable: true, get: function () { return exceptions_1.InternalAppException; } });
24
- Object.defineProperty(exports, "NotFoundAppException", { enumerable: true, get: function () { return exceptions_1.NotFoundAppException; } });
25
- Object.defineProperty(exports, "ThrottleAppException", { enumerable: true, get: function () { return exceptions_1.ThrottleAppException; } });
26
- Object.defineProperty(exports, "TwoFactorInvalidException", { enumerable: true, get: function () { return exceptions_1.TwoFactorInvalidException; } });
27
- Object.defineProperty(exports, "TwoFactorRequiredException", { enumerable: true, get: function () { return exceptions_1.TwoFactorRequiredException; } });
28
- Object.defineProperty(exports, "ValidationAppException", { enumerable: true, get: function () { return exceptions_1.ValidationAppException; } });
29
- const exception_module_1 = require("./exception.module");
26
+ var exception_module_1 = require("./exception.module");
30
27
  Object.defineProperty(exports, "ExceptionModule", { enumerable: true, get: function () { return exception_module_1.ExceptionModule; } });
31
- const exception_constants_1 = require("./exception.constants");
28
+ var exception_constants_1 = require("./exception.constants");
32
29
  Object.defineProperty(exports, "EXCEPTION_HANDLERS", { enumerable: true, get: function () { return exception_constants_1.EXCEPTION_HANDLERS; } });
33
- const request_language_util_1 = require("./request-language.util");
30
+ var request_language_util_1 = require("./request-language.util");
34
31
  Object.defineProperty(exports, "resolveRequestLanguage", { enumerable: true, get: function () { return request_language_util_1.resolveRequestLanguage; } });
35
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/exception/index.ts"],"names":[],"mappings":";;;AAAA,uEAAgE;AA2B9D,o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athapp/nestjs-common",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "description": "NestJs Common Library",
5
5
  "scripts": {
6
6
  "clean": "rimraf dist/ .turbo/",
@@ -28,6 +28,81 @@
28
28
  },
29
29
  "types": "dist/index.d.ts",
30
30
  "main": "dist/index.js",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./clock": {
37
+ "types": "./dist/clock/index.d.ts",
38
+ "default": "./dist/clock/index.js"
39
+ },
40
+ "./exception": {
41
+ "types": "./dist/exception/classes.d.ts",
42
+ "default": "./dist/exception/classes.js"
43
+ },
44
+ "./i18n": {
45
+ "types": "./dist/i18n/index.d.ts",
46
+ "default": "./dist/i18n/index.js"
47
+ },
48
+ "./id-generator": {
49
+ "types": "./dist/id-generator/index.d.ts",
50
+ "default": "./dist/id-generator/index.js"
51
+ },
52
+ "./ip": {
53
+ "types": "./dist/ip/index.d.ts",
54
+ "default": "./dist/ip/index.js"
55
+ },
56
+ "./module": {
57
+ "types": "./dist/module/index.d.ts",
58
+ "default": "./dist/module/index.js"
59
+ },
60
+ "./outbound-http": {
61
+ "types": "./dist/outbound-http/index.d.ts",
62
+ "default": "./dist/outbound-http/index.js"
63
+ },
64
+ "./pagination": {
65
+ "types": "./dist/pagination/index.d.ts",
66
+ "default": "./dist/pagination/index.js"
67
+ },
68
+ "./utils": {
69
+ "types": "./dist/utils/index.d.ts",
70
+ "default": "./dist/utils/index.js"
71
+ },
72
+ "./package.json": "./package.json",
73
+ "./dist/*": "./dist/*"
74
+ },
75
+ "typesVersions": {
76
+ "*": {
77
+ "clock": [
78
+ "dist/clock/index.d.ts"
79
+ ],
80
+ "exception": [
81
+ "dist/exception/classes.d.ts"
82
+ ],
83
+ "i18n": [
84
+ "dist/i18n/index.d.ts"
85
+ ],
86
+ "id-generator": [
87
+ "dist/id-generator/index.d.ts"
88
+ ],
89
+ "ip": [
90
+ "dist/ip/index.d.ts"
91
+ ],
92
+ "module": [
93
+ "dist/module/index.d.ts"
94
+ ],
95
+ "outbound-http": [
96
+ "dist/outbound-http/index.d.ts"
97
+ ],
98
+ "pagination": [
99
+ "dist/pagination/index.d.ts"
100
+ ],
101
+ "utils": [
102
+ "dist/utils/index.d.ts"
103
+ ]
104
+ }
105
+ },
31
106
  "directories": {
32
107
  "lib": "lib"
33
108
  },
@@ -39,7 +114,8 @@
39
114
  "joi": "^17.13.9",
40
115
  "nestjs-i18n": "^10.5.1",
41
116
  "reflect-metadata": "^0.2.2",
42
- "rxjs": "^7.8.0"
117
+ "rxjs": "^7.8.0",
118
+ "safe-regex2": "^5.0.0"
43
119
  },
44
120
  "peerDependencies": {
45
121
  "@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",