@miguelmorales13/nestkit 0.16.0 → 0.19.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 (91) hide show
  1. package/README.md +212 -61
  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-JV4EAOF2.js → chunk-4PFAKLT3.js} +1 -1
  20. package/dist/{chunk-47FXU74G.cjs → chunk-52IOOHNX.cjs} +2 -2
  21. package/dist/chunk-6RAPVLJM.js +212 -0
  22. package/dist/{chunk-KRC47OX6.js → chunk-A2DGK4ZL.js} +26 -3
  23. package/dist/chunk-APUFKA4K.cjs +212 -0
  24. package/dist/chunk-AXMW5JF7.cjs +83 -0
  25. package/dist/{chunk-DABTRWA6.js → chunk-DYHSOULW.js} +1 -1
  26. package/dist/{chunk-KP2ZHJSR.js → chunk-ETRUVZTJ.js} +8 -0
  27. package/dist/{chunk-C5DV4RAX.cjs → chunk-FH5UNWWW.cjs} +6 -6
  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-YFYHLYHN.js → chunk-M3GQDRWR.js} +7 -1
  33. package/dist/{chunk-67B7IYAV.cjs → chunk-MSTXS3MU.cjs} +28 -5
  34. package/dist/chunk-PNK5WMPP.cjs +30 -0
  35. package/dist/chunk-Q5Y33L7B.cjs +19 -0
  36. package/dist/{chunk-EBPEMVZU.cjs → chunk-SDWHKPXI.cjs} +8 -0
  37. package/dist/{chunk-MLOQDUBN.js → chunk-TUNDBBQF.js} +4 -4
  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/email/adapters/brevo.email.d.ts +22 -0
  47. package/dist/email/adapters/memory.email.d.ts +14 -0
  48. package/dist/email/adapters/message.d.ts +13 -0
  49. package/dist/email/adapters/resend.email.d.ts +28 -0
  50. package/dist/email/adapters/smtp.email.d.ts +22 -0
  51. package/dist/email/address.d.ts +15 -0
  52. package/dist/email/email.module.d.ts +37 -0
  53. package/dist/email/email.options.d.ts +39 -0
  54. package/dist/email/email.port.d.ts +62 -0
  55. package/dist/email/index.cjs +314 -0
  56. package/dist/email/index.d.ts +12 -0
  57. package/dist/email/index.js +314 -0
  58. package/dist/errors/app.exception.d.ts +9 -1
  59. package/dist/errors/common.exceptions.d.ts +6 -5
  60. package/dist/errors/global-exception.filter.d.ts +9 -0
  61. package/dist/errors/index.cjs +8 -5
  62. package/dist/errors/index.js +9 -6
  63. package/dist/i18n/i18n.interceptor.d.ts +16 -0
  64. package/dist/i18n/i18n.module.d.ts +49 -3
  65. package/dist/i18n/index.cjs +26 -2
  66. package/dist/i18n/index.d.ts +8 -0
  67. package/dist/i18n/index.js +25 -1
  68. package/dist/i18n/locale.d.ts +53 -0
  69. package/dist/i18n/message.d.ts +36 -0
  70. package/dist/i18n/nestjs-i18n.translator.d.ts +9 -0
  71. package/dist/i18n/runtime.d.ts +55 -0
  72. package/dist/i18n/translator.port.d.ts +29 -0
  73. package/dist/idempotency/index.cjs +6 -5
  74. package/dist/idempotency/index.js +3 -2
  75. package/dist/index.cjs +38 -16
  76. package/dist/index.js +47 -25
  77. package/dist/invoicing/index.cjs +14 -13
  78. package/dist/invoicing/index.js +3 -2
  79. package/dist/payments/index.cjs +15 -14
  80. package/dist/payments/index.js +3 -2
  81. package/dist/response/index.cjs +3 -3
  82. package/dist/response/index.js +2 -2
  83. package/dist/stripe/index.cjs +4 -3
  84. package/dist/stripe/index.js +3 -2
  85. package/dist/tracking/index.cjs +3 -3
  86. package/dist/tracking/index.js +2 -2
  87. package/dist/tracking/request-context.d.ts +10 -0
  88. package/package.json +6 -1
  89. package/dist/chunk-IYUUYCP5.js +0 -36
  90. package/dist/chunk-M3EL5O6T.cjs +0 -36
  91. package/dist/chunk-R7BVS6CI.cjs +0 -13
@@ -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.19.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -91,6 +91,11 @@
91
91
  "import": "./dist/auth/oauth/index.js",
92
92
  "require": "./dist/auth/oauth/index.cjs"
93
93
  },
94
+ "./email": {
95
+ "types": "./dist/email/index.d.ts",
96
+ "import": "./dist/email/index.js",
97
+ "require": "./dist/email/index.cjs"
98
+ },
94
99
  "./email/resend": {
95
100
  "types": "./dist/email/resend/index.d.ts",
96
101
  "import": "./dist/email/resend/index.js",
@@ -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;