@miguelmorales13/nestkit 0.1.0 → 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 (76) 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 +11 -0
  20. package/dist/bootstrap/index.js +3 -2
  21. package/dist/chunk-2REOCMUD.cjs +16 -0
  22. package/dist/chunk-3CLYZC3T.cjs +104 -0
  23. package/dist/chunk-7FQQDWOZ.cjs +73 -0
  24. package/dist/chunk-7SOM7EZP.cjs +1 -0
  25. package/dist/chunk-DQYAIQQ5.js +0 -0
  26. package/dist/chunk-FDNGAYTZ.cjs +39 -0
  27. package/dist/chunk-KVBQBT3D.cjs +1 -0
  28. package/dist/chunk-M3EL5O6T.cjs +36 -0
  29. package/dist/chunk-MR2IFCZE.cjs +1 -0
  30. package/dist/chunk-O2ZMI3EK.cjs +32 -0
  31. package/dist/{chunk-HGJX2GPE.js → chunk-ORWJ7LES.js} +1 -1
  32. package/dist/{chunk-EQXYK6AL.js → chunk-Q45IEPWU.js} +5 -13
  33. package/dist/chunk-QS2W5XCQ.cjs +12 -0
  34. package/dist/chunk-R7BVS6CI.cjs +13 -0
  35. package/dist/chunk-RF75KC63.cjs +50 -0
  36. package/dist/{chunk-KP7GRCZW.js → chunk-RHNQGTAT.js} +3 -3
  37. package/dist/chunk-SPTDXUED.cjs +39 -0
  38. package/dist/chunk-TJHRABML.cjs +29 -0
  39. package/dist/chunk-V2M75FN3.cjs +40 -0
  40. package/dist/chunk-YFYHLYHN.js +13 -0
  41. package/dist/chunk-ZA56XBCK.cjs +20 -0
  42. package/dist/crud/index.cjs +9 -0
  43. package/dist/database/mongo/index.cjs +1 -0
  44. package/dist/database/postgres/index.cjs +11 -0
  45. package/dist/database/supabase/index.cjs +11 -0
  46. package/dist/email/nodemailer/index.cjs +40 -0
  47. package/dist/email/nodemailer/index.d.ts +1 -0
  48. package/dist/email/nodemailer/index.js +40 -0
  49. package/dist/email/nodemailer/nodemailer.module.d.ts +4 -0
  50. package/dist/email/resend/index.cjs +31 -0
  51. package/dist/email/resend/index.d.ts +1 -0
  52. package/dist/email/resend/index.js +31 -0
  53. package/dist/email/resend/resend.module.d.ts +4 -0
  54. package/dist/entities/index.cjs +7 -0
  55. package/dist/errors/index.cjs +25 -0
  56. package/dist/errors/index.js +6 -3
  57. package/dist/i18n/index.cjs +9 -0
  58. package/dist/index.cjs +78 -0
  59. package/dist/index.js +26 -23
  60. package/dist/response/index.cjs +9 -0
  61. package/dist/stripe/index.cjs +78 -0
  62. package/dist/stripe/index.d.ts +3 -0
  63. package/dist/stripe/index.js +78 -0
  64. package/dist/stripe/stripe-webhook.controller.d.ts +20 -0
  65. package/dist/stripe/stripe.module.d.ts +4 -0
  66. package/dist/telegram/index.cjs +31 -0
  67. package/dist/telegram/index.d.ts +1 -0
  68. package/dist/telegram/index.js +31 -0
  69. package/dist/telegram/telegram.module.d.ts +8 -0
  70. package/dist/tracking/index.cjs +15 -0
  71. package/dist/whatsapp/index.cjs +68 -0
  72. package/dist/whatsapp/index.d.ts +3 -0
  73. package/dist/whatsapp/index.js +68 -0
  74. package/dist/whatsapp/whatsapp-client.d.ts +21 -0
  75. package/dist/whatsapp/whatsapp.module.d.ts +4 -0
  76. package/package.json +96 -21
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkQS2W5XCQcjs = require('../chunk-QS2W5XCQ.cjs');
4
+ require('../chunk-2REOCMUD.cjs');
5
+
6
+
7
+ exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto;
@@ -0,0 +1,25 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-7SOM7EZP.cjs');
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _chunkFDNGAYTZcjs = require('../chunk-FDNGAYTZ.cjs');
9
+
10
+
11
+ var _chunk7FQQDWOZcjs = require('../chunk-7FQQDWOZ.cjs');
12
+
13
+
14
+ var _chunkR7BVS6CIcjs = require('../chunk-R7BVS6CI.cjs');
15
+ require('../chunk-ZA56XBCK.cjs');
16
+ require('../chunk-2REOCMUD.cjs');
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
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 {
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkM3EL5O6Tcjs = require('../chunk-M3EL5O6T.cjs');
5
+ require('../chunk-2REOCMUD.cjs');
6
+
7
+
8
+
9
+ exports.I18nModule = _chunkM3EL5O6Tcjs.I18nModule; exports.translateOr = _chunkM3EL5O6Tcjs.translateOr;
package/dist/index.cjs ADDED
@@ -0,0 +1,78 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkV2M75FN3cjs = require('./chunk-V2M75FN3.cjs');
6
+ require('./chunk-KVBQBT3D.cjs');
7
+
8
+
9
+
10
+
11
+ var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
12
+
13
+
14
+
15
+
16
+ var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
17
+
18
+
19
+
20
+ var _chunk3CLYZC3Tcjs = require('./chunk-3CLYZC3T.cjs');
21
+
22
+
23
+ var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
24
+ require('./chunk-7SOM7EZP.cjs');
25
+
26
+
27
+
28
+
29
+
30
+
31
+ var _chunkFDNGAYTZcjs = require('./chunk-FDNGAYTZ.cjs');
32
+
33
+
34
+ var _chunkO2ZMI3EKcjs = require('./chunk-O2ZMI3EK.cjs');
35
+
36
+
37
+ var _chunk7FQQDWOZcjs = require('./chunk-7FQQDWOZ.cjs');
38
+
39
+
40
+ var _chunkR7BVS6CIcjs = require('./chunk-R7BVS6CI.cjs');
41
+
42
+
43
+
44
+ var _chunkM3EL5O6Tcjs = require('./chunk-M3EL5O6T.cjs');
45
+ require('./chunk-MR2IFCZE.cjs');
46
+
47
+
48
+ var _chunkTJHRABMLcjs = require('./chunk-TJHRABML.cjs');
49
+
50
+
51
+ var _chunkZA56XBCKcjs = require('./chunk-ZA56XBCK.cjs');
52
+ require('./chunk-2REOCMUD.cjs');
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
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,48 +1,51 @@
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-KP7GRCZW.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";
19
- import {
20
- I18nModule,
21
- translateOr
22
- } from "./chunk-IYUUYCP5.js";
23
21
  import {
24
22
  BaseResponseDto
25
23
  } from "./chunk-XX2HPTRU.js";
26
- import "./chunk-NAK4WDKS.js";
27
- import {
28
- ResponseInterceptor
29
- } from "./chunk-KDAA6GFF.js";
30
- import {
31
- REQUEST_ID_HEADER,
32
- RequestIdMiddleware,
33
- TrackingModule
34
- } from "./chunk-EYURGACO.js";
24
+ import "./chunk-DQYAIQQ5.js";
35
25
  import {
36
26
  ConflictAppException,
37
27
  ForbiddenAppException,
38
28
  NotFoundAppException,
39
29
  UnauthorizedAppException,
40
30
  ValidationAppException
41
- } from "./chunk-HGJX2GPE.js";
31
+ } from "./chunk-ORWJ7LES.js";
32
+ import {
33
+ applyNestKitDefaults
34
+ } from "./chunk-RHNQGTAT.js";
42
35
  import {
43
- AppException,
44
36
  GlobalExceptionFilter
45
- } from "./chunk-EQXYK6AL.js";
37
+ } from "./chunk-Q45IEPWU.js";
38
+ import {
39
+ AppException
40
+ } from "./chunk-YFYHLYHN.js";
41
+ import {
42
+ I18nModule,
43
+ translateOr
44
+ } from "./chunk-IYUUYCP5.js";
45
+ import "./chunk-NAK4WDKS.js";
46
+ import {
47
+ ResponseInterceptor
48
+ } from "./chunk-KDAA6GFF.js";
46
49
  import {
47
50
  RequestContext
48
51
  } from "./chunk-EBO6UKHL.js";
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-MR2IFCZE.cjs');
2
+
3
+
4
+ var _chunkTJHRABMLcjs = require('../chunk-TJHRABML.cjs');
5
+ require('../chunk-ZA56XBCK.cjs');
6
+ require('../chunk-2REOCMUD.cjs');
7
+
8
+
9
+ exports.ResponseInterceptor = _chunkTJHRABMLcjs.ResponseInterceptor;
@@ -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';
@@ -0,0 +1,78 @@
1
+ import {
2
+ UnauthorizedAppException
3
+ } from "../chunk-ORWJ7LES.js";
4
+ import "../chunk-YFYHLYHN.js";
5
+ import {
6
+ __decorateClass,
7
+ __decorateParam
8
+ } from "../chunk-4MGIQFAJ.js";
9
+
10
+ // src/stripe/stripe.module.ts
11
+ import { Module } from "@nestjs/common";
12
+ import Stripe from "stripe";
13
+ var STRIPE_CLIENT = /* @__PURE__ */ Symbol("STRIPE_CLIENT");
14
+ var StripeModule = class {
15
+ };
16
+ StripeModule = __decorateClass([
17
+ Module({
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 Stripe(secretKey, { apiVersion }) : new Stripe(secretKey);
28
+ }
29
+ }
30
+ ],
31
+ exports: [STRIPE_CLIENT]
32
+ })
33
+ ], StripeModule);
34
+
35
+ // src/stripe/stripe-webhook.controller.ts
36
+ import { Controller, Headers, Inject, Post, Req } from "@nestjs/common";
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 {
57
+ throw new UnauthorizedAppException("Invalid Stripe webhook signature", void 0, "INVALID_STRIPE_SIGNATURE");
58
+ }
59
+ await options.handlers[event.type]?.(event);
60
+ return { received: true };
61
+ }
62
+ };
63
+ __decorateClass([
64
+ Post(),
65
+ __decorateParam(0, Req()),
66
+ __decorateParam(1, Headers("stripe-signature"))
67
+ ], StripeWebhookControllerHost.prototype, "handleWebhook", 1);
68
+ StripeWebhookControllerHost = __decorateClass([
69
+ Controller(options.path ?? "stripe/webhook"),
70
+ __decorateParam(0, Inject(STRIPE_CLIENT))
71
+ ], StripeWebhookControllerHost);
72
+ return StripeWebhookControllerHost;
73
+ }
74
+ export {
75
+ STRIPE_CLIENT,
76
+ StripeModule,
77
+ createStripeWebhookController
78
+ };
@@ -0,0 +1,20 @@
1
+ import { type Type } from '@nestjs/common';
2
+ import type Stripe from 'stripe';
3
+ export interface CreateStripeWebhookControllerOptions {
4
+ /** Route prefix for the generated controller. Defaults to 'stripe/webhook'. */
5
+ path?: string;
6
+ /** Keyed by Stripe event type, e.g. 'checkout.session.completed'. Unhandled types are acked and ignored. */
7
+ handlers: Record<string, (event: Stripe.Event) => Promise<void> | void>;
8
+ }
9
+ /**
10
+ * Requires the Nest app to be created with
11
+ * `NestFactory.create(AppModule, { rawBody: true })` — Stripe signature
12
+ * verification needs the exact raw request bytes, which nestkit's
13
+ * `applyNestKitDefaults` (applied after app creation) cannot retroactively
14
+ * enable. See README.
15
+ */
16
+ export declare function createStripeWebhookController(options: CreateStripeWebhookControllerOptions): Type<{
17
+ handleWebhook(req: unknown, signature: string): Promise<{
18
+ received: true;
19
+ }>;
20
+ }>;
@@ -0,0 +1,4 @@
1
+ /** DI token for the Stripe client. Inject with `@Inject(STRIPE_CLIENT)`. */
2
+ export declare const STRIPE_CLIENT: unique symbol;
3
+ export declare class StripeModule {
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/telegram/telegram.module.ts
6
+ var _common = require('@nestjs/common');
7
+ var _telegraf = require('telegraf');
8
+ var TELEGRAM_BOT = /* @__PURE__ */ Symbol("TELEGRAM_BOT");
9
+ var TelegramModule = class {
10
+ };
11
+ TelegramModule = exports.TelegramModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
12
+ _common.Module.call(void 0, {
13
+ providers: [
14
+ {
15
+ provide: TELEGRAM_BOT,
16
+ useFactory: () => {
17
+ const token = process.env.TELEGRAM_BOT_TOKEN;
18
+ if (!token) {
19
+ throw new Error("TelegramModule: TELEGRAM_BOT_TOKEN environment variable is not set");
20
+ }
21
+ return new (0, _telegraf.Telegram)(token);
22
+ }
23
+ }
24
+ ],
25
+ exports: [TELEGRAM_BOT]
26
+ })
27
+ ], TelegramModule);
28
+
29
+
30
+
31
+ exports.TELEGRAM_BOT = TELEGRAM_BOT; exports.TelegramModule = TelegramModule;
@@ -0,0 +1 @@
1
+ export { TelegramModule, TELEGRAM_BOT } from './telegram.module.js';
@@ -0,0 +1,31 @@
1
+ import {
2
+ __decorateClass
3
+ } from "../chunk-4MGIQFAJ.js";
4
+
5
+ // src/telegram/telegram.module.ts
6
+ import { Module } from "@nestjs/common";
7
+ import { Telegram as TelegrafClient } from "telegraf";
8
+ var TELEGRAM_BOT = /* @__PURE__ */ Symbol("TELEGRAM_BOT");
9
+ var TelegramModule = class {
10
+ };
11
+ TelegramModule = __decorateClass([
12
+ Module({
13
+ providers: [
14
+ {
15
+ provide: TELEGRAM_BOT,
16
+ useFactory: () => {
17
+ const token = process.env.TELEGRAM_BOT_TOKEN;
18
+ if (!token) {
19
+ throw new Error("TelegramModule: TELEGRAM_BOT_TOKEN environment variable is not set");
20
+ }
21
+ return new TelegrafClient(token);
22
+ }
23
+ }
24
+ ],
25
+ exports: [TELEGRAM_BOT]
26
+ })
27
+ ], TelegramModule);
28
+ export {
29
+ TELEGRAM_BOT,
30
+ TelegramModule
31
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * DI token for the outbound Telegram Bot API client. Inject with
3
+ * `@Inject(TELEGRAM_BOT)`. Send-only — no polling, no webhook, no update
4
+ * handling, no full `Telegraf` bot instance.
5
+ */
6
+ export declare const TELEGRAM_BOT: unique symbol;
7
+ export declare class TelegramModule {
8
+ }