@mondart/nestjs-common-module-core 3.2.3 → 3.2.4

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 +1 @@
1
- {"version":3,"file":"success-response.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/response/success-response.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG;IAEvD,IAAI,EAAE,QAAQ,CAAC;IAGf,QAAQ,EAAE,QAAQ,CAAC;IAGnB,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe,CAC1B,QAAQ,EACR,QAAQ,GAAG,GAAG,CACd,SAAQ,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAE7C,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,MAAa,EACtB,MAAM,SAAM,EACZ,QAAQ,GAAE,QAAe;CAoB5B"}
1
+ {"version":3,"file":"success-response.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/response/success-response.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG;IAEvD,IAAI,EAAE,QAAQ,CAAC;IAGf,QAAQ,EAAE,QAAQ,CAAC;IAGnB,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe,CAC1B,QAAQ,EACR,QAAQ,GAAG,GAAG,CACd,SAAQ,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAE7C,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,MAAa,EACtB,MAAM,SAAM,EACZ,QAAQ,GAAE,QAAe;CAc5B"}
@@ -35,20 +35,11 @@ __decorate([
35
35
  class SuccessResponse extends BaseSuccessResponse {
36
36
  constructor(data, message = null, status = 200, metadata = null) {
37
37
  super();
38
- const messageKey = helpers_1.I18nMessageHelper.extractKey(message);
38
+ const translated = helpers_1.SuccessResponseTranslationHelper.translate(message, metadata);
39
39
  this.data = data;
40
- this.message = helpers_1.I18nMessageHelper.translate(message);
40
+ this.message = translated.message;
41
41
  this.status = status;
42
- this.metadata = messageKey
43
- ? {
44
- ...(metadata &&
45
- typeof metadata === 'object' &&
46
- !Array.isArray(metadata)
47
- ? metadata
48
- : {}),
49
- messageKey,
50
- }
51
- : metadata;
42
+ this.metadata = translated.metadata;
52
43
  }
53
44
  }
54
45
  exports.SuccessResponse = SuccessResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"success-response.dto.js","sourceRoot":"","sources":["../../../src/dto/response/success-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,uCAA6C;AAC7C,2CAAkD;AAElD,MAAa,mBAAmB;CAY/B;AAZD,kDAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACf;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACX;AAGnB;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAc,CAAC,UAAU,EAAE,CAAC;;oDAClD;AAGhB;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;;mDAC7B;AAGjB,MAAa,eAGX,SAAQ,mBAAuC;IAC/C,YACE,IAAc,EACd,UAAkB,IAAI,EACtB,MAAM,GAAG,GAAG,EACZ,WAAqB,IAAI;QAEzB,KAAK,EAAE,CAAC;QAER,MAAM,UAAU,GAAG,2BAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,2BAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,UAAU;YACxB,CAAC,CAAE;gBACC,GAAG,CAAC,QAAQ;oBACZ,OAAO,QAAQ,KAAK,QAAQ;oBAC5B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACtB,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,EAAE,CAAC;gBACP,UAAU;aACE;YAChB,CAAC,CAAC,QAAQ,CAAC;IACf,CAAC;CACF;AA5BD,0CA4BC"}
1
+ {"version":3,"file":"success-response.dto.js","sourceRoot":"","sources":["../../../src/dto/response/success-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,uCAA6C;AAC7C,2CAAiE;AAEjE,MAAa,mBAAmB;CAY/B;AAZD,kDAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACf;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACX;AAGnB;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAc,CAAC,UAAU,EAAE,CAAC;;oDAClD;AAGhB;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;;mDAC7B;AAGjB,MAAa,eAGX,SAAQ,mBAAuC;IAC/C,YACE,IAAc,EACd,UAAkB,IAAI,EACtB,MAAM,GAAG,GAAG,EACZ,WAAqB,IAAI;QAEzB,KAAK,EAAE,CAAC;QAER,MAAM,UAAU,GAAG,0CAAgC,CAAC,SAAS,CAC3D,OAAO,EACP,QAAQ,CACT,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACtC,CAAC;CACF;AAtBD,0CAsBC"}
@@ -12,5 +12,6 @@ export * from './phone.helper';
12
12
  export * from './ram-usage.helper';
13
13
  export * from './rxjs-catch-error.helper';
14
14
  export * from './rxjs-timeout-custom-callback.helper';
15
+ export * from './success-response-translation.helper';
15
16
  export * from './yup.helper';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,cAAc,CAAC"}
@@ -28,5 +28,6 @@ __exportStar(require("./phone.helper"), exports);
28
28
  __exportStar(require("./ram-usage.helper"), exports);
29
29
  __exportStar(require("./rxjs-catch-error.helper"), exports);
30
30
  __exportStar(require("./rxjs-timeout-custom-callback.helper"), exports);
31
+ __exportStar(require("./success-response-translation.helper"), exports);
31
32
  __exportStar(require("./yup.helper"), exports);
32
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,mDAAiC;AACjC,gDAA8B;AAC9B,wDAAsC;AACtC,6DAA2C;AAC3C,kDAAgC;AAChC,6DAA2C;AAC3C,iDAA+B;AAC/B,qDAAmC;AACnC,4DAA0C;AAC1C,wEAAsD;AACtD,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,mDAAiC;AACjC,gDAA8B;AAC9B,wDAAsC;AACtC,6DAA2C;AAC3C,kDAAgC;AAChC,6DAA2C;AAC3C,iDAA+B;AAC/B,qDAAmC;AACnC,4DAA0C;AAC1C,wEAAsD;AACtD,wEAAsD;AACtD,+CAA6B"}
@@ -0,0 +1,6 @@
1
+ import { I18nContext } from 'nestjs-i18n';
2
+ import { TranslatedSuccessResponseMetadata } from '../interfaces';
3
+ export declare class SuccessResponseTranslationHelper {
4
+ static translate<T, M extends string | undefined>(message: M, metadata: T, i18n?: I18nContext): TranslatedSuccessResponseMetadata<T, M>;
5
+ }
6
+ //# sourceMappingURL=success-response-translation.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-response-translation.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/success-response-translation.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAGlE,qBAAa,gCAAgC;IAC3C,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,SAAS,EAC9C,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,CAAC,EACX,IAAI,GAAE,WAAmC,GACxC,iCAAiC,CAAC,CAAC,EAAE,CAAC,CAAC;CAiB3C"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuccessResponseTranslationHelper = void 0;
4
+ const nestjs_i18n_1 = require("nestjs-i18n");
5
+ const i18n_message_helper_1 = require("./i18n-message.helper");
6
+ class SuccessResponseTranslationHelper {
7
+ static translate(message, metadata, i18n = nestjs_i18n_1.I18nContext.current()) {
8
+ const messageKey = i18n_message_helper_1.I18nMessageHelper.extractKey(message);
9
+ return {
10
+ message: i18n_message_helper_1.I18nMessageHelper.translate(message, i18n),
11
+ metadata: messageKey
12
+ ? {
13
+ ...(metadata &&
14
+ typeof metadata === 'object' &&
15
+ !Array.isArray(metadata)
16
+ ? metadata
17
+ : {}),
18
+ messageKey,
19
+ }
20
+ : metadata,
21
+ };
22
+ }
23
+ }
24
+ exports.SuccessResponseTranslationHelper = SuccessResponseTranslationHelper;
25
+ //# sourceMappingURL=success-response-translation.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-response-translation.helper.js","sourceRoot":"","sources":["../../src/helpers/success-response-translation.helper.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,+DAA0D;AAE1D,MAAa,gCAAgC;IAC3C,MAAM,CAAC,SAAS,CACd,OAAU,EACV,QAAW,EACX,OAAoB,yBAAW,CAAC,OAAO,EAAE;QAEzC,MAAM,UAAU,GAAG,uCAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO;YACL,OAAO,EAAE,uCAAiB,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAM;YACxD,QAAQ,EAAE,UAAU;gBAClB,CAAC,CAAE;oBACC,GAAG,CAAC,QAAQ;wBACZ,OAAO,QAAQ,KAAK,QAAQ;wBAC5B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;wBACtB,CAAC,CAAC,QAAQ;wBACV,CAAC,CAAC,EAAE,CAAC;oBACP,UAAU;iBACL;gBACT,CAAC,CAAC,QAAQ;SACb,CAAC;IACJ,CAAC;CACF;AAtBD,4EAsBC"}
@@ -6,4 +6,5 @@ export * from './kafka-event-metadata.interface';
6
6
  export * from './kafka-success-response.interface';
7
7
  export * from './pagination-query';
8
8
  export * from './generate-cache-key-params.interface';
9
+ export * from './translated-success-response-metadata.interface';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC"}
@@ -22,4 +22,5 @@ __exportStar(require("./kafka-event-metadata.interface"), exports);
22
22
  __exportStar(require("./kafka-success-response.interface"), exports);
23
23
  __exportStar(require("./pagination-query"), exports);
24
24
  __exportStar(require("./generate-cache-key-params.interface"), exports);
25
+ __exportStar(require("./translated-success-response-metadata.interface"), exports);
25
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0EAAwD;AACxD,wDAAsC;AACtC,uDAAqC;AACrC,oEAAkD;AAClD,mEAAiD;AACjD,qEAAmD;AACnD,qDAAmC;AACnC,wEAAsD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0EAAwD;AACxD,wDAAsC;AACtC,uDAAqC;AACrC,oEAAkD;AAClD,mEAAiD;AACjD,qEAAmD;AACnD,qDAAmC;AACnC,wEAAsD;AACtD,mFAAiE"}
@@ -0,0 +1,5 @@
1
+ export interface TranslatedSuccessResponseMetadata<T, M extends string | undefined = string> {
2
+ message: M;
3
+ metadata: T;
4
+ }
5
+ //# sourceMappingURL=translated-success-response-metadata.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translated-success-response-metadata.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/translated-success-response-metadata.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iCAAiC,CAChD,CAAC,EACD,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM;IAErC,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,CAAC,CAAC;CACb"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=translated-success-response-metadata.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translated-success-response-metadata.interface.js","sourceRoot":"","sources":["../../src/interfaces/translated-success-response-metadata.interface.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondart/nestjs-common-module-core",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Core utilities, DTOs, decorators, entities, filters, validators and helpers for NestJS.",
5
5
  "author": {
6
6
  "name": "Mondart"