@miguelmorales13/nestkit 0.1.1 → 0.3.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 (57) hide show
  1. package/README.md +305 -1
  2. package/dist/auth/auth-user.entity.d.ts +8 -0
  3. package/dist/auth/auth-user.port.d.ts +16 -0
  4. package/dist/auth/auth.controller.d.ts +25 -0
  5. package/dist/auth/auth.dto.d.ts +13 -0
  6. package/dist/auth/auth.service.d.ts +24 -0
  7. package/dist/auth/authenticated-user.d.ts +7 -0
  8. package/dist/auth/current-tenant.decorator.d.ts +2 -0
  9. package/dist/auth/current-user.decorator.d.ts +1 -0
  10. package/dist/auth/hash.util.d.ts +2 -0
  11. package/dist/auth/index.cjs +265 -0
  12. package/dist/auth/index.d.ts +16 -0
  13. package/dist/auth/index.js +265 -0
  14. package/dist/auth/jwt-auth.guard.d.ts +5 -0
  15. package/dist/auth/require-tenant.guard.d.ts +9 -0
  16. package/dist/auth/roles.decorator.d.ts +3 -0
  17. package/dist/auth/roles.guard.d.ts +11 -0
  18. package/dist/auth/token.service.d.ts +7 -0
  19. package/dist/bootstrap/index.cjs +4 -3
  20. package/dist/bootstrap/index.js +3 -2
  21. package/dist/{chunk-4IDLJMQA.cjs → chunk-7FQQDWOZ.cjs} +6 -14
  22. package/dist/chunk-7SOM7EZP.cjs +1 -0
  23. package/dist/chunk-DQYAIQQ5.js +0 -0
  24. package/dist/{chunk-AR3EKJBR.cjs → chunk-FDNGAYTZ.cjs} +6 -6
  25. package/dist/{chunk-AUA4X3RE.cjs → chunk-O2ZMI3EK.cjs} +2 -2
  26. package/dist/{chunk-HGJX2GPE.js → chunk-ORWJ7LES.js} +1 -1
  27. package/dist/{chunk-EQXYK6AL.js → chunk-Q45IEPWU.js} +5 -13
  28. package/dist/chunk-R7BVS6CI.cjs +13 -0
  29. package/dist/{chunk-VPS5CLHT.js → chunk-RHNQGTAT.js} +1 -1
  30. package/dist/chunk-YFYHLYHN.js +13 -0
  31. package/dist/email/nodemailer/index.cjs +40 -0
  32. package/dist/email/nodemailer/index.d.ts +1 -0
  33. package/dist/email/nodemailer/index.js +40 -0
  34. package/dist/email/nodemailer/nodemailer.module.d.ts +4 -0
  35. package/dist/email/resend/index.cjs +31 -0
  36. package/dist/email/resend/index.d.ts +1 -0
  37. package/dist/email/resend/index.js +31 -0
  38. package/dist/email/resend/resend.module.d.ts +4 -0
  39. package/dist/errors/index.cjs +7 -4
  40. package/dist/errors/index.js +6 -3
  41. package/dist/index.cjs +17 -14
  42. package/dist/index.js +24 -21
  43. package/dist/stripe/index.cjs +78 -0
  44. package/dist/stripe/index.d.ts +3 -0
  45. package/dist/stripe/index.js +78 -0
  46. package/dist/stripe/stripe-webhook.controller.d.ts +20 -0
  47. package/dist/stripe/stripe.module.d.ts +4 -0
  48. package/dist/telegram/index.cjs +31 -0
  49. package/dist/telegram/index.d.ts +1 -0
  50. package/dist/telegram/index.js +31 -0
  51. package/dist/telegram/telegram.module.d.ts +8 -0
  52. package/dist/whatsapp/index.cjs +68 -0
  53. package/dist/whatsapp/index.d.ts +3 -0
  54. package/dist/whatsapp/index.js +68 -0
  55. package/dist/whatsapp/whatsapp-client.d.ts +21 -0
  56. package/dist/whatsapp/whatsapp.module.d.ts +4 -0
  57. package/package.json +74 -10
@@ -1,30 +1,30 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk4IDLJMQAcjs = require('./chunk-4IDLJMQA.cjs');
3
+ var _chunkR7BVS6CIcjs = require('./chunk-R7BVS6CI.cjs');
4
4
 
5
5
  // src/errors/common.exceptions.ts
6
6
  var _common = require('@nestjs/common');
7
- var NotFoundAppException = class extends _chunk4IDLJMQAcjs.AppException {
7
+ var NotFoundAppException = class extends _chunkR7BVS6CIcjs.AppException {
8
8
  constructor(message = "Resource not found", details, code = "NOT_FOUND") {
9
9
  super(code, message, _common.HttpStatus.NOT_FOUND, details);
10
10
  }
11
11
  };
12
- var ConflictAppException = class extends _chunk4IDLJMQAcjs.AppException {
12
+ var ConflictAppException = class extends _chunkR7BVS6CIcjs.AppException {
13
13
  constructor(message = "Conflict", details, code = "CONFLICT") {
14
14
  super(code, message, _common.HttpStatus.CONFLICT, details);
15
15
  }
16
16
  };
17
- var ValidationAppException = class extends _chunk4IDLJMQAcjs.AppException {
17
+ var ValidationAppException = class extends _chunkR7BVS6CIcjs.AppException {
18
18
  constructor(message = "Validation failed", details, code = "VALIDATION_ERROR") {
19
19
  super(code, message, _common.HttpStatus.BAD_REQUEST, details);
20
20
  }
21
21
  };
22
- var UnauthorizedAppException = class extends _chunk4IDLJMQAcjs.AppException {
22
+ var UnauthorizedAppException = class extends _chunkR7BVS6CIcjs.AppException {
23
23
  constructor(message = "Unauthorized", details, code = "UNAUTHORIZED") {
24
24
  super(code, message, _common.HttpStatus.UNAUTHORIZED, details);
25
25
  }
26
26
  };
27
- var ForbiddenAppException = class extends _chunk4IDLJMQAcjs.AppException {
27
+ var ForbiddenAppException = class extends _chunkR7BVS6CIcjs.AppException {
28
28
  constructor(message = "Forbidden", details, code = "FORBIDDEN") {
29
29
  super(code, message, _common.HttpStatus.FORBIDDEN, details);
30
30
  }
@@ -1,6 +1,6 @@
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 _chunk4IDLJMQAcjs = require('./chunk-4IDLJMQA.cjs');
3
+ var _chunk7FQQDWOZcjs = require('./chunk-7FQQDWOZ.cjs');
4
4
 
5
5
 
6
6
  var _chunkTJHRABMLcjs = require('./chunk-TJHRABML.cjs');
@@ -17,7 +17,7 @@ function applyNestKitDefaults(app, options = {}) {
17
17
  app.useGlobalPipes(
18
18
  new (0, _common.ValidationPipe)({ whitelist: true, transform: true, ...options.validation })
19
19
  );
20
- app.useGlobalFilters(new (0, _chunk4IDLJMQAcjs.GlobalExceptionFilter)());
20
+ app.useGlobalFilters(new (0, _chunk7FQQDWOZcjs.GlobalExceptionFilter)());
21
21
  app.useGlobalInterceptors(new (0, _chunkTJHRABMLcjs.ResponseInterceptor)());
22
22
  if (options.swagger !== false) {
23
23
  const swaggerOptions = _nullishCoalesce(options.swagger, () => ( { title: "API" }));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AppException
3
- } from "./chunk-EQXYK6AL.js";
3
+ } from "./chunk-YFYHLYHN.js";
4
4
 
5
5
  // src/errors/common.exceptions.ts
6
6
  import { HttpStatus } from "@nestjs/common";
@@ -1,3 +1,6 @@
1
+ import {
2
+ AppException
3
+ } from "./chunk-YFYHLYHN.js";
1
4
  import {
2
5
  RequestContext
3
6
  } from "./chunk-EBO6UKHL.js";
@@ -5,20 +8,10 @@ import {
5
8
  __decorateClass
6
9
  } from "./chunk-4MGIQFAJ.js";
7
10
 
8
- // src/errors/app.exception.ts
9
- import { HttpException } from "@nestjs/common";
10
- var AppException = class extends HttpException {
11
- constructor(code, message, status, details) {
12
- super({ code, message, details }, status);
13
- this.code = code;
14
- this.details = details;
15
- }
16
- };
17
-
18
11
  // src/errors/global-exception.filter.ts
19
12
  import {
20
13
  Catch,
21
- HttpException as HttpException2,
14
+ HttpException,
22
15
  HttpStatus,
23
16
  Logger
24
17
  } from "@nestjs/common";
@@ -54,7 +47,7 @@ var GlobalExceptionFilter = class {
54
47
  details: exception.details
55
48
  };
56
49
  }
57
- if (exception instanceof HttpException2) {
50
+ if (exception instanceof HttpException) {
58
51
  const status = exception.getStatus();
59
52
  const payload = exception.getResponse();
60
53
  const rawMessage = typeof payload === "string" ? payload : payload.message ?? exception.message;
@@ -76,6 +69,5 @@ GlobalExceptionFilter = __decorateClass([
76
69
  ], GlobalExceptionFilter);
77
70
 
78
71
  export {
79
- AppException,
80
72
  GlobalExceptionFilter
81
73
  };
@@ -0,0 +1,13 @@
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;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GlobalExceptionFilter
3
- } from "./chunk-EQXYK6AL.js";
3
+ } from "./chunk-Q45IEPWU.js";
4
4
  import {
5
5
  ResponseInterceptor
6
6
  } from "./chunk-KDAA6GFF.js";
@@ -0,0 +1,13 @@
1
+ // src/errors/app.exception.ts
2
+ import { HttpException } from "@nestjs/common";
3
+ var AppException = class extends 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
+ export {
12
+ AppException
13
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunk2REOCMUDcjs = require('../../chunk-2REOCMUD.cjs');
4
+
5
+ // src/email/nodemailer/nodemailer.module.ts
6
+ var _common = require('@nestjs/common');
7
+ var _nodemailer = require('nodemailer'); var _nodemailer2 = _interopRequireDefault(_nodemailer);
8
+ var NODEMAILER_TRANSPORT = /* @__PURE__ */ Symbol("NODEMAILER_TRANSPORT");
9
+ function requireEnv(name) {
10
+ const value = process.env[name];
11
+ if (!value) {
12
+ throw new Error(`NodemailerModule: ${name} environment variable is not set`);
13
+ }
14
+ return value;
15
+ }
16
+ var NodemailerModule = class {
17
+ };
18
+ NodemailerModule = exports.NodemailerModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
19
+ _common.Module.call(void 0, {
20
+ providers: [
21
+ {
22
+ provide: NODEMAILER_TRANSPORT,
23
+ useFactory: () => _nodemailer2.default.createTransport({
24
+ host: requireEnv("SMTP_HOST"),
25
+ port: Number(requireEnv("SMTP_PORT")),
26
+ secure: process.env.SMTP_SECURE === "true",
27
+ auth: {
28
+ user: requireEnv("SMTP_USER"),
29
+ pass: requireEnv("SMTP_PASSWORD")
30
+ }
31
+ })
32
+ }
33
+ ],
34
+ exports: [NODEMAILER_TRANSPORT]
35
+ })
36
+ ], NodemailerModule);
37
+
38
+
39
+
40
+ exports.NODEMAILER_TRANSPORT = NODEMAILER_TRANSPORT; exports.NodemailerModule = NodemailerModule;
@@ -0,0 +1 @@
1
+ export { NodemailerModule, NODEMAILER_TRANSPORT } from './nodemailer.module.js';
@@ -0,0 +1,40 @@
1
+ import {
2
+ __decorateClass
3
+ } from "../../chunk-4MGIQFAJ.js";
4
+
5
+ // src/email/nodemailer/nodemailer.module.ts
6
+ import { Module } from "@nestjs/common";
7
+ import nodemailer from "nodemailer";
8
+ var NODEMAILER_TRANSPORT = /* @__PURE__ */ Symbol("NODEMAILER_TRANSPORT");
9
+ function requireEnv(name) {
10
+ const value = process.env[name];
11
+ if (!value) {
12
+ throw new Error(`NodemailerModule: ${name} environment variable is not set`);
13
+ }
14
+ return value;
15
+ }
16
+ var NodemailerModule = class {
17
+ };
18
+ NodemailerModule = __decorateClass([
19
+ Module({
20
+ providers: [
21
+ {
22
+ provide: NODEMAILER_TRANSPORT,
23
+ useFactory: () => nodemailer.createTransport({
24
+ host: requireEnv("SMTP_HOST"),
25
+ port: Number(requireEnv("SMTP_PORT")),
26
+ secure: process.env.SMTP_SECURE === "true",
27
+ auth: {
28
+ user: requireEnv("SMTP_USER"),
29
+ pass: requireEnv("SMTP_PASSWORD")
30
+ }
31
+ })
32
+ }
33
+ ],
34
+ exports: [NODEMAILER_TRANSPORT]
35
+ })
36
+ ], NodemailerModule);
37
+ export {
38
+ NODEMAILER_TRANSPORT,
39
+ NodemailerModule
40
+ };
@@ -0,0 +1,4 @@
1
+ /** DI token for the Nodemailer SMTP transport. Inject with `@Inject(NODEMAILER_TRANSPORT)`. */
2
+ export declare const NODEMAILER_TRANSPORT: unique symbol;
3
+ export declare class NodemailerModule {
4
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk2REOCMUDcjs = require('../../chunk-2REOCMUD.cjs');
4
+
5
+ // src/email/resend/resend.module.ts
6
+ var _common = require('@nestjs/common');
7
+ var _resend = require('resend');
8
+ var RESEND_CLIENT = /* @__PURE__ */ Symbol("RESEND_CLIENT");
9
+ var ResendModule = class {
10
+ };
11
+ ResendModule = exports.ResendModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
12
+ _common.Module.call(void 0, {
13
+ providers: [
14
+ {
15
+ provide: RESEND_CLIENT,
16
+ useFactory: () => {
17
+ const apiKey = process.env.RESEND_API_KEY;
18
+ if (!apiKey) {
19
+ throw new Error("ResendModule: RESEND_API_KEY environment variable is not set");
20
+ }
21
+ return new (0, _resend.Resend)(apiKey);
22
+ }
23
+ }
24
+ ],
25
+ exports: [RESEND_CLIENT]
26
+ })
27
+ ], ResendModule);
28
+
29
+
30
+
31
+ exports.RESEND_CLIENT = RESEND_CLIENT; exports.ResendModule = ResendModule;
@@ -0,0 +1 @@
1
+ export { ResendModule, RESEND_CLIENT } from './resend.module.js';
@@ -0,0 +1,31 @@
1
+ import {
2
+ __decorateClass
3
+ } from "../../chunk-4MGIQFAJ.js";
4
+
5
+ // src/email/resend/resend.module.ts
6
+ import { Module } from "@nestjs/common";
7
+ import { Resend } from "resend";
8
+ var RESEND_CLIENT = /* @__PURE__ */ Symbol("RESEND_CLIENT");
9
+ var ResendModule = class {
10
+ };
11
+ ResendModule = __decorateClass([
12
+ Module({
13
+ providers: [
14
+ {
15
+ provide: RESEND_CLIENT,
16
+ useFactory: () => {
17
+ const apiKey = process.env.RESEND_API_KEY;
18
+ if (!apiKey) {
19
+ throw new Error("ResendModule: RESEND_API_KEY environment variable is not set");
20
+ }
21
+ return new Resend(apiKey);
22
+ }
23
+ }
24
+ ],
25
+ exports: [RESEND_CLIENT]
26
+ })
27
+ ], ResendModule);
28
+ export {
29
+ RESEND_CLIENT,
30
+ ResendModule
31
+ };
@@ -0,0 +1,4 @@
1
+ /** DI token for the Resend email client. Inject with `@Inject(RESEND_CLIENT)`. */
2
+ export declare const RESEND_CLIENT: unique symbol;
3
+ export declare class ResendModule {
4
+ }
@@ -1,14 +1,17 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-7SOM7EZP.cjs');
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
- var _chunkAR3EKJBRcjs = require('../chunk-AR3EKJBR.cjs');
8
7
 
8
+ var _chunkFDNGAYTZcjs = require('../chunk-FDNGAYTZ.cjs');
9
9
 
10
10
 
11
- var _chunk4IDLJMQAcjs = require('../chunk-4IDLJMQA.cjs');
11
+ var _chunk7FQQDWOZcjs = require('../chunk-7FQQDWOZ.cjs');
12
+
13
+
14
+ var _chunkR7BVS6CIcjs = require('../chunk-R7BVS6CI.cjs');
12
15
  require('../chunk-ZA56XBCK.cjs');
13
16
  require('../chunk-2REOCMUD.cjs');
14
17
 
@@ -19,4 +22,4 @@ require('../chunk-2REOCMUD.cjs');
19
22
 
20
23
 
21
24
 
22
- exports.AppException = _chunk4IDLJMQAcjs.AppException; exports.ConflictAppException = _chunkAR3EKJBRcjs.ConflictAppException; exports.ForbiddenAppException = _chunkAR3EKJBRcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunk4IDLJMQAcjs.GlobalExceptionFilter; exports.NotFoundAppException = _chunkAR3EKJBRcjs.NotFoundAppException; exports.UnauthorizedAppException = _chunkAR3EKJBRcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkAR3EKJBRcjs.ValidationAppException;
25
+ exports.AppException = _chunkR7BVS6CIcjs.AppException; exports.ConflictAppException = _chunkFDNGAYTZcjs.ConflictAppException; exports.ForbiddenAppException = _chunkFDNGAYTZcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunk7FQQDWOZcjs.GlobalExceptionFilter; exports.NotFoundAppException = _chunkFDNGAYTZcjs.NotFoundAppException; exports.UnauthorizedAppException = _chunkFDNGAYTZcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkFDNGAYTZcjs.ValidationAppException;
@@ -1,14 +1,17 @@
1
+ import "../chunk-DQYAIQQ5.js";
1
2
  import {
2
3
  ConflictAppException,
3
4
  ForbiddenAppException,
4
5
  NotFoundAppException,
5
6
  UnauthorizedAppException,
6
7
  ValidationAppException
7
- } from "../chunk-HGJX2GPE.js";
8
+ } from "../chunk-ORWJ7LES.js";
8
9
  import {
9
- AppException,
10
10
  GlobalExceptionFilter
11
- } from "../chunk-EQXYK6AL.js";
11
+ } from "../chunk-Q45IEPWU.js";
12
+ import {
13
+ AppException
14
+ } from "../chunk-YFYHLYHN.js";
12
15
  import "../chunk-EBO6UKHL.js";
13
16
  import "../chunk-4MGIQFAJ.js";
14
17
  export {
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-KVBQBT3D.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
5
-
6
- var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
5
+ var _chunkV2M75FN3cjs = require('./chunk-V2M75FN3.cjs');
6
+ require('./chunk-KVBQBT3D.cjs');
7
7
 
8
8
 
9
9
 
@@ -11,41 +11,44 @@ var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
11
11
  var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
12
12
 
13
13
 
14
- var _chunkAUA4X3REcjs = require('./chunk-AUA4X3RE.cjs');
15
14
 
16
15
 
16
+ var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
17
17
 
18
- var _chunk3CLYZC3Tcjs = require('./chunk-3CLYZC3T.cjs');
19
18
 
20
19
 
20
+ var _chunk3CLYZC3Tcjs = require('./chunk-3CLYZC3T.cjs');
21
21
 
22
22
 
23
+ var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
24
+ require('./chunk-7SOM7EZP.cjs');
23
25
 
24
26
 
25
- var _chunkAR3EKJBRcjs = require('./chunk-AR3EKJBR.cjs');
26
27
 
27
28
 
28
29
 
29
- var _chunk4IDLJMQAcjs = require('./chunk-4IDLJMQA.cjs');
30
30
 
31
+ var _chunkFDNGAYTZcjs = require('./chunk-FDNGAYTZ.cjs');
31
32
 
32
- var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
33
- require('./chunk-MR2IFCZE.cjs');
34
33
 
34
+ var _chunkO2ZMI3EKcjs = require('./chunk-O2ZMI3EK.cjs');
35
35
 
36
- var _chunkTJHRABMLcjs = require('./chunk-TJHRABML.cjs');
37
36
 
37
+ var _chunk7FQQDWOZcjs = require('./chunk-7FQQDWOZ.cjs');
38
38
 
39
39
 
40
+ var _chunkR7BVS6CIcjs = require('./chunk-R7BVS6CI.cjs');
40
41
 
41
- var _chunkV2M75FN3cjs = require('./chunk-V2M75FN3.cjs');
42
42
 
43
43
 
44
- var _chunkZA56XBCKcjs = require('./chunk-ZA56XBCK.cjs');
44
+ var _chunkM3EL5O6Tcjs = require('./chunk-M3EL5O6T.cjs');
45
+ require('./chunk-MR2IFCZE.cjs');
45
46
 
46
47
 
48
+ var _chunkTJHRABMLcjs = require('./chunk-TJHRABML.cjs');
47
49
 
48
- var _chunkM3EL5O6Tcjs = require('./chunk-M3EL5O6T.cjs');
50
+
51
+ var _chunkZA56XBCKcjs = require('./chunk-ZA56XBCK.cjs');
49
52
  require('./chunk-2REOCMUD.cjs');
50
53
 
51
54
 
@@ -72,4 +75,4 @@ require('./chunk-2REOCMUD.cjs');
72
75
 
73
76
 
74
77
 
75
- exports.AppException = _chunk4IDLJMQAcjs.AppException; exports.BaseCrudService = _chunk3CLYZC3Tcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkAR3EKJBRcjs.ConflictAppException; exports.ForbiddenAppException = _chunkAR3EKJBRcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunk4IDLJMQAcjs.GlobalExceptionFilter; exports.I18nModule = _chunkM3EL5O6Tcjs.I18nModule; exports.NotFoundAppException = _chunkAR3EKJBRcjs.NotFoundAppException; exports.PG_POOL = _chunkRF75KC63cjs.PG_POOL; exports.PgModule = _chunkRF75KC63cjs.PgModule; exports.REQUEST_ID_HEADER = _chunkV2M75FN3cjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkZA56XBCKcjs.RequestContext; exports.RequestIdMiddleware = _chunkV2M75FN3cjs.RequestIdMiddleware; exports.ResponseInterceptor = _chunkTJHRABMLcjs.ResponseInterceptor; exports.SUPABASE_ANON_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_ANON_CLIENT; exports.SUPABASE_SERVICE_ROLE_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_SERVICE_ROLE_CLIENT; exports.SupabaseModule = _chunkSPTDXUEDcjs.SupabaseModule; exports.TrackingModule = _chunkV2M75FN3cjs.TrackingModule; exports.UnauthorizedAppException = _chunkAR3EKJBRcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkAR3EKJBRcjs.ValidationAppException; exports.applyNestKitDefaults = _chunkAUA4X3REcjs.applyNestKitDefaults; exports.createCrudController = _chunk3CLYZC3Tcjs.createCrudController; exports.translateOr = _chunkM3EL5O6Tcjs.translateOr; exports.withTenantScope = _chunkRF75KC63cjs.withTenantScope;
78
+ exports.AppException = _chunkR7BVS6CIcjs.AppException; exports.BaseCrudService = _chunk3CLYZC3Tcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkFDNGAYTZcjs.ConflictAppException; exports.ForbiddenAppException = _chunkFDNGAYTZcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunk7FQQDWOZcjs.GlobalExceptionFilter; exports.I18nModule = _chunkM3EL5O6Tcjs.I18nModule; exports.NotFoundAppException = _chunkFDNGAYTZcjs.NotFoundAppException; exports.PG_POOL = _chunkRF75KC63cjs.PG_POOL; exports.PgModule = _chunkRF75KC63cjs.PgModule; exports.REQUEST_ID_HEADER = _chunkV2M75FN3cjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkZA56XBCKcjs.RequestContext; exports.RequestIdMiddleware = _chunkV2M75FN3cjs.RequestIdMiddleware; exports.ResponseInterceptor = _chunkTJHRABMLcjs.ResponseInterceptor; exports.SUPABASE_ANON_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_ANON_CLIENT; exports.SUPABASE_SERVICE_ROLE_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_SERVICE_ROLE_CLIENT; exports.SupabaseModule = _chunkSPTDXUEDcjs.SupabaseModule; exports.TrackingModule = _chunkV2M75FN3cjs.TrackingModule; exports.UnauthorizedAppException = _chunkFDNGAYTZcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkFDNGAYTZcjs.ValidationAppException; exports.applyNestKitDefaults = _chunkO2ZMI3EKcjs.applyNestKitDefaults; exports.createCrudController = _chunk3CLYZC3Tcjs.createCrudController; exports.translateOr = _chunkM3EL5O6Tcjs.translateOr; exports.withTenantScope = _chunkRF75KC63cjs.withTenantScope;
package/dist/index.js CHANGED
@@ -1,51 +1,54 @@
1
- import "./chunk-EPVKCBPT.js";
2
1
  import {
3
- PG_POOL,
4
- PgModule,
5
- withTenantScope
6
- } from "./chunk-VKOPDDCC.js";
2
+ REQUEST_ID_HEADER,
3
+ RequestIdMiddleware,
4
+ TrackingModule
5
+ } from "./chunk-EYURGACO.js";
6
+ import "./chunk-EPVKCBPT.js";
7
7
  import {
8
8
  SUPABASE_ANON_CLIENT,
9
9
  SUPABASE_SERVICE_ROLE_CLIENT,
10
10
  SupabaseModule
11
11
  } from "./chunk-PA24P76K.js";
12
12
  import {
13
- applyNestKitDefaults
14
- } from "./chunk-VPS5CLHT.js";
13
+ PG_POOL,
14
+ PgModule,
15
+ withTenantScope
16
+ } from "./chunk-VKOPDDCC.js";
15
17
  import {
16
18
  BaseCrudService,
17
19
  createCrudController
18
20
  } from "./chunk-JOVBJDJ2.js";
21
+ import {
22
+ BaseResponseDto
23
+ } from "./chunk-XX2HPTRU.js";
24
+ import "./chunk-DQYAIQQ5.js";
19
25
  import {
20
26
  ConflictAppException,
21
27
  ForbiddenAppException,
22
28
  NotFoundAppException,
23
29
  UnauthorizedAppException,
24
30
  ValidationAppException
25
- } from "./chunk-HGJX2GPE.js";
31
+ } from "./chunk-ORWJ7LES.js";
32
+ import {
33
+ applyNestKitDefaults
34
+ } from "./chunk-RHNQGTAT.js";
26
35
  import {
27
- AppException,
28
36
  GlobalExceptionFilter
29
- } from "./chunk-EQXYK6AL.js";
37
+ } from "./chunk-Q45IEPWU.js";
30
38
  import {
31
- BaseResponseDto
32
- } from "./chunk-XX2HPTRU.js";
39
+ AppException
40
+ } from "./chunk-YFYHLYHN.js";
41
+ import {
42
+ I18nModule,
43
+ translateOr
44
+ } from "./chunk-IYUUYCP5.js";
33
45
  import "./chunk-NAK4WDKS.js";
34
46
  import {
35
47
  ResponseInterceptor
36
48
  } from "./chunk-KDAA6GFF.js";
37
- import {
38
- REQUEST_ID_HEADER,
39
- RequestIdMiddleware,
40
- TrackingModule
41
- } from "./chunk-EYURGACO.js";
42
49
  import {
43
50
  RequestContext
44
51
  } from "./chunk-EBO6UKHL.js";
45
- import {
46
- I18nModule,
47
- translateOr
48
- } from "./chunk-IYUUYCP5.js";
49
52
  import "./chunk-4MGIQFAJ.js";
50
53
  export {
51
54
  AppException,
@@ -0,0 +1,78 @@
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
+
3
+ var _chunkFDNGAYTZcjs = require('../chunk-FDNGAYTZ.cjs');
4
+ require('../chunk-R7BVS6CI.cjs');
5
+
6
+
7
+
8
+ var _chunk2REOCMUDcjs = require('../chunk-2REOCMUD.cjs');
9
+
10
+ // src/stripe/stripe.module.ts
11
+ var _common = require('@nestjs/common');
12
+ var _stripe = require('stripe'); var _stripe2 = _interopRequireDefault(_stripe);
13
+ var STRIPE_CLIENT = /* @__PURE__ */ Symbol("STRIPE_CLIENT");
14
+ var StripeModule = class {
15
+ };
16
+ StripeModule = exports.StripeModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
17
+ _common.Module.call(void 0, {
18
+ providers: [
19
+ {
20
+ provide: STRIPE_CLIENT,
21
+ useFactory: () => {
22
+ const secretKey = process.env.STRIPE_SECRET_KEY;
23
+ if (!secretKey) {
24
+ throw new Error("StripeModule: STRIPE_SECRET_KEY environment variable is not set");
25
+ }
26
+ const apiVersion = process.env.STRIPE_API_VERSION;
27
+ return apiVersion ? new (0, _stripe2.default)(secretKey, { apiVersion }) : new (0, _stripe2.default)(secretKey);
28
+ }
29
+ }
30
+ ],
31
+ exports: [STRIPE_CLIENT]
32
+ })
33
+ ], StripeModule);
34
+
35
+ // src/stripe/stripe-webhook.controller.ts
36
+
37
+ function createStripeWebhookController(options) {
38
+ let StripeWebhookControllerHost = class {
39
+ constructor(stripe) {
40
+ this.stripe = stripe;
41
+ }
42
+ async handleWebhook(req, signature) {
43
+ const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
44
+ if (!webhookSecret) {
45
+ throw new Error("StripeWebhookController: STRIPE_WEBHOOK_SECRET environment variable is not set");
46
+ }
47
+ const rawBody = req.rawBody;
48
+ if (!rawBody) {
49
+ throw new Error(
50
+ "StripeWebhookController: request.rawBody is undefined \u2014 create the Nest app with `NestFactory.create(AppModule, { rawBody: true })` (see README)."
51
+ );
52
+ }
53
+ let event;
54
+ try {
55
+ event = this.stripe.webhooks.constructEvent(rawBody, signature, webhookSecret);
56
+ } catch (e) {
57
+ throw new (0, _chunkFDNGAYTZcjs.UnauthorizedAppException)("Invalid Stripe webhook signature", void 0, "INVALID_STRIPE_SIGNATURE");
58
+ }
59
+ await _optionalChain([options, 'access', _ => _.handlers, 'access', _2 => _2[event.type], 'optionalCall', _3 => _3(event)]);
60
+ return { received: true };
61
+ }
62
+ };
63
+ _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
64
+ _common.Post.call(void 0, ),
65
+ _chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Req.call(void 0, )),
66
+ _chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Headers.call(void 0, "stripe-signature"))
67
+ ], StripeWebhookControllerHost.prototype, "handleWebhook", 1);
68
+ StripeWebhookControllerHost = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
69
+ _common.Controller.call(void 0, _nullishCoalesce(options.path, () => ( "stripe/webhook"))),
70
+ _chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Inject.call(void 0, STRIPE_CLIENT))
71
+ ], StripeWebhookControllerHost);
72
+ return StripeWebhookControllerHost;
73
+ }
74
+
75
+
76
+
77
+
78
+ exports.STRIPE_CLIENT = STRIPE_CLIENT; exports.StripeModule = StripeModule; exports.createStripeWebhookController = createStripeWebhookController;
@@ -0,0 +1,3 @@
1
+ export { StripeModule, STRIPE_CLIENT } from './stripe.module.js';
2
+ export { createStripeWebhookController } from './stripe-webhook.controller.js';
3
+ export type { CreateStripeWebhookControllerOptions } from './stripe-webhook.controller.js';