@miguelmorales13/nestkit 0.16.0 → 0.18.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.
Files changed (79) hide show
  1. package/README.md +152 -28
  2. package/dist/audit/index.cjs +12 -12
  3. package/dist/audit/index.js +2 -2
  4. package/dist/auth/index.cjs +12 -11
  5. package/dist/auth/index.js +5 -4
  6. package/dist/auth/oauth/http.d.ts +10 -3
  7. package/dist/auth/oauth/index.cjs +189 -30
  8. package/dist/auth/oauth/index.d.ts +6 -4
  9. package/dist/auth/oauth/index.js +169 -10
  10. package/dist/auth/oauth/magic-link.dto.d.ts +6 -0
  11. package/dist/auth/oauth/memory-magic-link.store.d.ts +19 -0
  12. package/dist/auth/oauth/oauth-auth.service.d.ts +46 -5
  13. package/dist/auth/oauth/oauth.controller.d.ts +5 -1
  14. package/dist/auth/oauth/oauth.options.d.ts +34 -1
  15. package/dist/auth/oauth/oauth.ports.d.ts +38 -0
  16. package/dist/bootstrap/index.cjs +8 -6
  17. package/dist/bootstrap/index.js +7 -5
  18. package/dist/{chunk-UWDHAZVE.cjs → chunk-3AUOOEQO.cjs} +2 -2
  19. package/dist/{chunk-C5DV4RAX.cjs → chunk-4HHZFOVC.cjs} +6 -6
  20. package/dist/{chunk-JV4EAOF2.js → chunk-4PFAKLT3.js} +1 -1
  21. package/dist/{chunk-47FXU74G.cjs → chunk-52IOOHNX.cjs} +2 -2
  22. package/dist/chunk-6RAPVLJM.js +212 -0
  23. package/dist/{chunk-KRC47OX6.js → chunk-A2DGK4ZL.js} +26 -3
  24. package/dist/chunk-APUFKA4K.cjs +212 -0
  25. package/dist/chunk-AXMW5JF7.cjs +83 -0
  26. package/dist/{chunk-DABTRWA6.js → chunk-DYHSOULW.js} +1 -1
  27. package/dist/{chunk-KP2ZHJSR.js → chunk-ETRUVZTJ.js} +8 -0
  28. package/dist/{chunk-4GT66KQS.cjs → chunk-FNUZGYUF.cjs} +4 -4
  29. package/dist/{chunk-FDNGAYTZ.cjs → chunk-HDFPSA2V.cjs} +6 -6
  30. package/dist/{chunk-U7QK24HL.cjs → chunk-HVHYZXBB.cjs} +2 -2
  31. package/dist/{chunk-LK3OINS7.js → chunk-IFNYRZP2.js} +1 -1
  32. package/dist/{chunk-MLOQDUBN.js → chunk-IKXSVEJ7.js} +2 -2
  33. package/dist/{chunk-YFYHLYHN.js → chunk-M3GQDRWR.js} +7 -1
  34. package/dist/{chunk-67B7IYAV.cjs → chunk-MSTXS3MU.cjs} +28 -5
  35. package/dist/chunk-PNK5WMPP.cjs +30 -0
  36. package/dist/chunk-Q5Y33L7B.cjs +19 -0
  37. package/dist/{chunk-EBPEMVZU.cjs → chunk-SDWHKPXI.cjs} +8 -0
  38. package/dist/{chunk-UIVBPNH4.js → chunk-UNEVXCFW.js} +4 -4
  39. package/dist/chunk-VVMRZEIW.js +30 -0
  40. package/dist/{chunk-XX5ROVSC.cjs → chunk-W2T2VFLC.cjs} +3 -3
  41. package/dist/chunk-X4PQJZ4G.js +83 -0
  42. package/dist/{chunk-ORWJ7LES.js → chunk-ZFIDAX7K.js} +1 -1
  43. package/dist/{chunk-XHW4CTBS.js → chunk-ZJMLEP5H.js} +1 -1
  44. package/dist/crud/index.cjs +4 -4
  45. package/dist/crud/index.js +3 -3
  46. package/dist/errors/app.exception.d.ts +9 -1
  47. package/dist/errors/common.exceptions.d.ts +6 -5
  48. package/dist/errors/global-exception.filter.d.ts +9 -0
  49. package/dist/errors/index.cjs +8 -5
  50. package/dist/errors/index.js +7 -4
  51. package/dist/i18n/i18n.interceptor.d.ts +16 -0
  52. package/dist/i18n/i18n.module.d.ts +49 -3
  53. package/dist/i18n/index.cjs +26 -2
  54. package/dist/i18n/index.d.ts +8 -0
  55. package/dist/i18n/index.js +25 -1
  56. package/dist/i18n/locale.d.ts +53 -0
  57. package/dist/i18n/message.d.ts +36 -0
  58. package/dist/i18n/nestjs-i18n.translator.d.ts +9 -0
  59. package/dist/i18n/runtime.d.ts +55 -0
  60. package/dist/i18n/translator.port.d.ts +29 -0
  61. package/dist/idempotency/index.cjs +6 -5
  62. package/dist/idempotency/index.js +3 -2
  63. package/dist/index.cjs +36 -14
  64. package/dist/index.js +41 -19
  65. package/dist/invoicing/index.cjs +14 -13
  66. package/dist/invoicing/index.js +3 -2
  67. package/dist/payments/index.cjs +15 -14
  68. package/dist/payments/index.js +3 -2
  69. package/dist/response/index.cjs +3 -3
  70. package/dist/response/index.js +2 -2
  71. package/dist/stripe/index.cjs +4 -3
  72. package/dist/stripe/index.js +3 -2
  73. package/dist/tracking/index.cjs +3 -3
  74. package/dist/tracking/index.js +2 -2
  75. package/dist/tracking/request-context.d.ts +10 -0
  76. package/package.json +1 -1
  77. package/dist/chunk-IYUUYCP5.js +0 -36
  78. package/dist/chunk-M3EL5O6T.cjs +0 -36
  79. package/dist/chunk-R7BVS6CI.cjs +0 -13
@@ -1,10 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkFDNGAYTZcjs = require('../chunk-FDNGAYTZ.cjs');
4
+ var _chunkHDFPSA2Vcjs = require('../chunk-HDFPSA2V.cjs');
5
5
 
6
6
 
7
- var _chunkR7BVS6CIcjs = require('../chunk-R7BVS6CI.cjs');
7
+ var _chunkQ5Y33L7Bcjs = require('../chunk-Q5Y33L7B.cjs');
8
+ require('../chunk-PNK5WMPP.cjs');
8
9
 
9
10
 
10
11
 
@@ -25,15 +26,15 @@ var _crypto = require('crypto');
25
26
  // src/payments/money.ts
26
27
  function assertCents(cents, field = "amountCents") {
27
28
  if (!Number.isInteger(cents)) {
28
- throw new (0, _chunkFDNGAYTZcjs.ValidationAppException)(`${field} must be an integer number of cents, got ${cents}`, {
29
+ throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(`${field} must be an integer number of cents, got ${cents}`, {
29
30
  [field]: cents
30
31
  });
31
32
  }
32
33
  if (cents < 0) {
33
- throw new (0, _chunkFDNGAYTZcjs.ValidationAppException)(`${field} must not be negative, got ${cents}`, { [field]: cents });
34
+ throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(`${field} must not be negative, got ${cents}`, { [field]: cents });
34
35
  }
35
36
  if (!Number.isSafeInteger(cents)) {
36
- throw new (0, _chunkFDNGAYTZcjs.ValidationAppException)(`${field} is out of safe integer range`, { [field]: cents });
37
+ throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(`${field} is out of safe integer range`, { [field]: cents });
37
38
  }
38
39
  }
39
40
  function centsToDecimalString(cents) {
@@ -45,7 +46,7 @@ function decimalToCents(value) {
45
46
  const text = typeof value === "number" ? value.toFixed(2) : value.trim();
46
47
  const match = /^(-?)(\d+)(?:\.(\d{1,2}))?$/.exec(text);
47
48
  if (!match) {
48
- throw new (0, _chunkFDNGAYTZcjs.ValidationAppException)(`Cannot read "${text}" as a decimal amount`, { value });
49
+ throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(`Cannot read "${text}" as a decimal amount`, { value });
49
50
  }
50
51
  const [, sign, whole, fraction = ""] = match;
51
52
  const cents = Number(whole) * 100 + Number(fraction.padEnd(2, "0"));
@@ -54,7 +55,7 @@ function decimalToCents(value) {
54
55
 
55
56
  // src/payments/provider-http.ts
56
57
 
57
- var TerminalPaymentProviderException = class extends _chunkR7BVS6CIcjs.AppException {
58
+ var TerminalPaymentProviderException = class extends _chunkQ5Y33L7Bcjs.AppException {
58
59
  constructor(provider, status, body, message) {
59
60
  super(
60
61
  "TERMINAL_PAYMENT_PROVIDER_ERROR",
@@ -64,7 +65,7 @@ var TerminalPaymentProviderException = class extends _chunkR7BVS6CIcjs.AppExcept
64
65
  );
65
66
  }
66
67
  };
67
- var UnsupportedByProviderException = class extends _chunkR7BVS6CIcjs.AppException {
68
+ var UnsupportedByProviderException = class extends _chunkQ5Y33L7Bcjs.AppException {
68
69
  constructor(provider, message) {
69
70
  super("TERMINAL_PAYMENT_UNSUPPORTED", message, _common.HttpStatus.BAD_REQUEST, { provider });
70
71
  }
@@ -122,7 +123,7 @@ function toStatus(status) {
122
123
  }
123
124
  function assertReference(reference) {
124
125
  if (!/^[A-Za-z0-9_-]{1,64}$/.test(reference)) {
125
- throw new (0, _chunkFDNGAYTZcjs.ValidationAppException)(
126
+ throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(
126
127
  "reference must be 1-64 characters of letters, digits, hyphens or underscores for Mercado Pago",
127
128
  { reference }
128
129
  );
@@ -348,7 +349,7 @@ var MercadoPagoTerminalPayments = class {
348
349
  const signature = header("x-signature");
349
350
  const requestId = header("x-request-id");
350
351
  if (!signature || !requestId) {
351
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Missing Mercado Pago webhook signature headers", void 0, "INVALID_WEBHOOK_SIGNATURE");
352
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Missing Mercado Pago webhook signature headers", void 0, "INVALID_WEBHOOK_SIGNATURE");
352
353
  }
353
354
  const parts = new Map(
354
355
  signature.split(",").map((part) => {
@@ -361,13 +362,13 @@ var MercadoPagoTerminalPayments = class {
361
362
  const body = request.body;
362
363
  const dataId = String(_nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'access', _10 => _10.query, 'optionalAccess', _11 => _11["data.id"]]), () => ( _optionalChain([body, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.id]))), () => ( "")));
363
364
  if (!ts || !received || !dataId) {
364
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Malformed Mercado Pago webhook signature", void 0, "INVALID_WEBHOOK_SIGNATURE");
365
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Malformed Mercado Pago webhook signature", void 0, "INVALID_WEBHOOK_SIGNATURE");
365
366
  }
366
367
  const manifest = `id:${dataId.toLowerCase()};request-id:${requestId};ts:${ts};`;
367
368
  const expected = _crypto.createHmac.call(void 0, "sha256", secret).update(manifest).digest();
368
369
  const provided = Buffer.from(received, "hex");
369
370
  if (provided.length !== expected.length || !_crypto.timingSafeEqual.call(void 0, provided, expected)) {
370
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Invalid Mercado Pago webhook signature", void 0, "INVALID_WEBHOOK_SIGNATURE");
371
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Invalid Mercado Pago webhook signature", void 0, "INVALID_WEBHOOK_SIGNATURE");
371
372
  }
372
373
  return { provider: PROVIDER, paymentId: dataId, action: _optionalChain([body, 'optionalAccess', _14 => _14.action]), raw: request.body };
373
374
  }
@@ -669,13 +670,13 @@ var ClipTerminalPayments = class {
669
670
  const a = Buffer.from(provided);
670
671
  const b = Buffer.from(expected);
671
672
  if (a.length !== b.length || !_crypto.timingSafeEqual.call(void 0, a, b)) {
672
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Invalid Clip webhook token", void 0, "INVALID_WEBHOOK_SIGNATURE");
673
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Invalid Clip webhook token", void 0, "INVALID_WEBHOOK_SIGNATURE");
673
674
  }
674
675
  }
675
676
  const body = request.body;
676
677
  const paymentId = _optionalChain([body, 'optionalAccess', _26 => _26.id]);
677
678
  if (!paymentId) {
678
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Clip webhook carried no payment id", void 0, "INVALID_WEBHOOK_PAYLOAD");
679
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Clip webhook carried no payment id", void 0, "INVALID_WEBHOOK_PAYLOAD");
679
680
  }
680
681
  return { provider: PROVIDER2, paymentId, action: _optionalChain([body, 'optionalAccess', _27 => _27.event_type]), raw: request.body };
681
682
  }
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  UnauthorizedAppException,
3
3
  ValidationAppException
4
- } from "../chunk-ORWJ7LES.js";
4
+ } from "../chunk-ZFIDAX7K.js";
5
5
  import {
6
6
  AppException
7
- } from "../chunk-YFYHLYHN.js";
7
+ } from "../chunk-M3GQDRWR.js";
8
+ import "../chunk-VVMRZEIW.js";
8
9
  import {
9
10
  __decorateClass,
10
11
  __decorateParam
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-H2EHN366.cjs');
2
2
 
3
3
 
4
- var _chunkUWDHAZVEcjs = require('../chunk-UWDHAZVE.cjs');
4
+ var _chunk3AUOOEQOcjs = require('../chunk-3AUOOEQO.cjs');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
  var _chunkY72D5L6Icjs = require('../chunk-Y72D5L6I.cjs');
10
- require('../chunk-EBPEMVZU.cjs');
10
+ require('../chunk-SDWHKPXI.cjs');
11
11
  require('../chunk-2REOCMUD.cjs');
12
12
 
13
13
 
14
14
 
15
15
 
16
16
 
17
- exports.ResponseInterceptor = _chunkUWDHAZVEcjs.ResponseInterceptor; exports.buildPageMeta = _chunkY72D5L6Icjs.buildPageMeta; exports.isPaginated = _chunkY72D5L6Icjs.isPaginated; exports.paginated = _chunkY72D5L6Icjs.paginated;
17
+ exports.ResponseInterceptor = _chunk3AUOOEQOcjs.ResponseInterceptor; exports.buildPageMeta = _chunkY72D5L6Icjs.buildPageMeta; exports.isPaginated = _chunkY72D5L6Icjs.isPaginated; exports.paginated = _chunkY72D5L6Icjs.paginated;
@@ -1,13 +1,13 @@
1
1
  import "../chunk-ODPSIFOB.js";
2
2
  import {
3
3
  ResponseInterceptor
4
- } from "../chunk-DABTRWA6.js";
4
+ } from "../chunk-DYHSOULW.js";
5
5
  import {
6
6
  buildPageMeta,
7
7
  isPaginated,
8
8
  paginated
9
9
  } from "../chunk-TCAMLNUZ.js";
10
- import "../chunk-KP2ZHJSR.js";
10
+ import "../chunk-ETRUVZTJ.js";
11
11
  import "../chunk-4MGIQFAJ.js";
12
12
  export {
13
13
  ResponseInterceptor,
@@ -1,7 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkFDNGAYTZcjs = require('../chunk-FDNGAYTZ.cjs');
4
- require('../chunk-R7BVS6CI.cjs');
3
+ var _chunkHDFPSA2Vcjs = require('../chunk-HDFPSA2V.cjs');
4
+ require('../chunk-Q5Y33L7B.cjs');
5
+ require('../chunk-PNK5WMPP.cjs');
5
6
 
6
7
 
7
8
 
@@ -54,7 +55,7 @@ function createStripeWebhookController(options) {
54
55
  try {
55
56
  event = this.stripe.webhooks.constructEvent(rawBody, signature, webhookSecret);
56
57
  } catch (e) {
57
- throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Invalid Stripe webhook signature", void 0, "INVALID_STRIPE_SIGNATURE");
58
+ throw new (0, _chunkHDFPSA2Vcjs.UnauthorizedAppException)("Invalid Stripe webhook signature", void 0, "INVALID_STRIPE_SIGNATURE");
58
59
  }
59
60
  await _optionalChain([options, 'access', _ => _.handlers, 'access', _2 => _2[event.type], 'optionalCall', _3 => _3(event)]);
60
61
  return { received: true };
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  UnauthorizedAppException
3
- } from "../chunk-ORWJ7LES.js";
4
- import "../chunk-YFYHLYHN.js";
3
+ } from "../chunk-ZFIDAX7K.js";
4
+ import "../chunk-M3GQDRWR.js";
5
+ import "../chunk-VVMRZEIW.js";
5
6
  import {
6
7
  __decorateClass,
7
8
  __decorateParam
@@ -2,14 +2,14 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkU7QK24HLcjs = require('../chunk-U7QK24HL.cjs');
5
+ var _chunkHVHYZXBBcjs = require('../chunk-HVHYZXBB.cjs');
6
6
 
7
7
 
8
- var _chunkEBPEMVZUcjs = require('../chunk-EBPEMVZU.cjs');
8
+ var _chunkSDWHKPXIcjs = require('../chunk-SDWHKPXI.cjs');
9
9
  require('../chunk-2REOCMUD.cjs');
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.REQUEST_ID_HEADER = _chunkU7QK24HLcjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkEBPEMVZUcjs.RequestContext; exports.RequestIdMiddleware = _chunkU7QK24HLcjs.RequestIdMiddleware; exports.TrackingModule = _chunkU7QK24HLcjs.TrackingModule;
15
+ exports.REQUEST_ID_HEADER = _chunkHVHYZXBBcjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkSDWHKPXIcjs.RequestContext; exports.RequestIdMiddleware = _chunkHVHYZXBBcjs.RequestIdMiddleware; exports.TrackingModule = _chunkHVHYZXBBcjs.TrackingModule;
@@ -2,10 +2,10 @@ import {
2
2
  REQUEST_ID_HEADER,
3
3
  RequestIdMiddleware,
4
4
  TrackingModule
5
- } from "../chunk-JV4EAOF2.js";
5
+ } from "../chunk-4PFAKLT3.js";
6
6
  import {
7
7
  RequestContext
8
- } from "../chunk-KP2ZHJSR.js";
8
+ } from "../chunk-ETRUVZTJ.js";
9
9
  import "../chunk-4MGIQFAJ.js";
10
10
  export {
11
11
  REQUEST_ID_HEADER,
@@ -12,6 +12,13 @@ export interface RequestContextStore {
12
12
  * sink, a repository) can still answer "who".
13
13
  */
14
14
  actor?: RequestActor;
15
+ /**
16
+ * Language the response should speak, once `I18nInterceptor` has resolved
17
+ * it from the request. Read through `RequestContext.getLang()` by the
18
+ * translation helpers, so a service never receives the language as an
19
+ * argument either.
20
+ */
21
+ lang?: string;
15
22
  }
16
23
  /**
17
24
  * Thin wrapper around AsyncLocalStorage so any layer (filters, interceptors,
@@ -33,4 +40,7 @@ export declare class RequestContext {
33
40
  */
34
41
  static setActor(actor: RequestActor): void;
35
42
  static getActor(): RequestActor | undefined;
43
+ /** Same contract as {@link setActor}: mutates the current store, no-op outside a request. */
44
+ static setLang(lang: string): void;
45
+ static getLang(): string | undefined;
36
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miguelmorales13/nestkit",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,36 +0,0 @@
1
- import {
2
- __decorateClass
3
- } from "./chunk-4MGIQFAJ.js";
4
-
5
- // src/i18n/i18n.module.ts
6
- import { Module } from "@nestjs/common";
7
- import { I18nModule as BaseI18nModule, I18nJsonLoader } from "nestjs-i18n";
8
- var I18nModule = class {
9
- static forRoot(options = {}) {
10
- return BaseI18nModule.forRoot({
11
- fallbackLanguage: options.fallbackLanguage ?? "es",
12
- loaderOptions: {
13
- path: options.path ?? "./i18n/",
14
- watch: true
15
- },
16
- loader: I18nJsonLoader
17
- });
18
- }
19
- };
20
- I18nModule = __decorateClass([
21
- Module({})
22
- ], I18nModule);
23
-
24
- // src/i18n/translate.helper.ts
25
- function translateOr(i18n, key, fallback, args) {
26
- try {
27
- return i18n.t(key, { args, defaultValue: fallback });
28
- } catch {
29
- return fallback;
30
- }
31
- }
32
-
33
- export {
34
- I18nModule,
35
- translateOr
36
- };
@@ -1,36 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunk2REOCMUDcjs = require('./chunk-2REOCMUD.cjs');
4
-
5
- // src/i18n/i18n.module.ts
6
- var _common = require('@nestjs/common');
7
- var _nestjsi18n = require('nestjs-i18n');
8
- var I18nModule = class {
9
- static forRoot(options = {}) {
10
- return _nestjsi18n.I18nModule.forRoot({
11
- fallbackLanguage: _nullishCoalesce(options.fallbackLanguage, () => ( "es")),
12
- loaderOptions: {
13
- path: _nullishCoalesce(options.path, () => ( "./i18n/")),
14
- watch: true
15
- },
16
- loader: _nestjsi18n.I18nJsonLoader
17
- });
18
- }
19
- };
20
- I18nModule = exports.I18nModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
21
- _common.Module.call(void 0, {})
22
- ], I18nModule);
23
-
24
- // src/i18n/translate.helper.ts
25
- function translateOr(i18n, key, fallback, args) {
26
- try {
27
- return i18n.t(key, { args, defaultValue: fallback });
28
- } catch (e) {
29
- return fallback;
30
- }
31
- }
32
-
33
-
34
-
35
-
36
- exports.I18nModule = I18nModule; exports.translateOr = translateOr;
@@ -1,13 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/errors/app.exception.ts
2
- var _common = require('@nestjs/common');
3
- var AppException = class extends _common.HttpException {
4
- constructor(code, message, status, details) {
5
- super({ code, message, details }, status);
6
- this.code = code;
7
- this.details = details;
8
- }
9
- };
10
-
11
-
12
-
13
- exports.AppException = AppException;