@tsed/stripe 7.0.0-alpha.2 → 7.0.0-beta.1
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.
- package/lib/{constants → cjs/constants}/index.js +0 -0
- package/lib/cjs/constants/index.js.map +1 -0
- package/lib/cjs/decorators/webhookEvent.js +20 -0
- package/lib/cjs/decorators/webhookEvent.js.map +1 -0
- package/lib/{domain → cjs/domain}/StripSettings.js +0 -0
- package/lib/cjs/domain/StripSettings.js.map +1 -0
- package/lib/{domain → cjs/domain}/index.js +1 -1
- package/lib/cjs/domain/index.js.map +1 -0
- package/lib/cjs/index.js +9 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/WebhookEventMiddleware.js +15 -13
- package/lib/cjs/middlewares/WebhookEventMiddleware.js.map +1 -0
- package/lib/{services → cjs/services}/StripeFactory.js +1 -1
- package/lib/cjs/services/StripeFactory.js.map +1 -0
- package/lib/esm/constants/index.js +3 -0
- package/lib/esm/constants/index.js.map +1 -0
- package/lib/esm/decorators/webhookEvent.js +16 -0
- package/lib/esm/decorators/webhookEvent.js.map +1 -0
- package/lib/esm/domain/StripSettings.js +2 -0
- package/lib/esm/domain/StripSettings.js.map +1 -0
- package/lib/esm/domain/index.js +2 -0
- package/lib/esm/domain/index.js.map +1 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/middlewares/WebhookEventMiddleware.js +46 -0
- package/lib/{middlewares → esm/middlewares}/WebhookEventMiddleware.js.map +1 -1
- package/lib/esm/services/StripeFactory.js +17 -0
- package/lib/esm/services/StripeFactory.js.map +1 -0
- package/lib/{constants → types/constants}/index.d.ts +0 -0
- package/lib/{decorators → types/decorators}/webhookEvent.d.ts +0 -0
- package/lib/{domain → types/domain}/StripSettings.d.ts +0 -0
- package/lib/{domain → types/domain}/index.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +0 -0
- package/lib/{middlewares → types/middlewares}/WebhookEventMiddleware.d.ts +0 -0
- package/lib/{services → types/services}/StripeFactory.d.ts +0 -0
- package/package.json +26 -21
- package/tsconfig.compile.esm.json +23 -0
- package/lib/constants/index.js.map +0 -1
- package/lib/decorators/webhookEvent.js +0 -20
- package/lib/decorators/webhookEvent.js.map +0 -1
- package/lib/domain/StripSettings.js.map +0 -1
- package/lib/domain/index.js.map +0 -1
- package/lib/index.js +0 -9
- package/lib/index.js.map +0 -1
- package/lib/services/StripeFactory.js.map +0 -1
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,wBAAwB,GAAG,yBAAyB,CAAC","sourcesContent":["export const STRIPE_WEBHOOK_EVENT = \"strip_webhook_event\";\nexport const STRIPE_WEBHOOK_SIGNATURE = \"strip_webhook_signature\";\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookEvent = void 0;
|
|
4
|
+
const common_1 = require("@tsed/common");
|
|
5
|
+
const core_1 = require("@tsed/core");
|
|
6
|
+
const schema_1 = require("@tsed/schema");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const WebhookEventMiddleware_1 = require("../middlewares/WebhookEventMiddleware");
|
|
9
|
+
/**
|
|
10
|
+
* Get the stripe webhook event.
|
|
11
|
+
*
|
|
12
|
+
* @decorator
|
|
13
|
+
* @operation
|
|
14
|
+
* @input
|
|
15
|
+
*/
|
|
16
|
+
function WebhookEvent(options) {
|
|
17
|
+
return (0, core_1.useDecorators)((0, core_1.useMethodDecorators)((0, schema_1.In)("body").Type(Object).Required().Description("The raw webhook payload"), (0, schema_1.In)("header").Name("stripe-signature").Type(String).Required().Description("The stripe webhook signature"), (0, core_1.StoreSet)(WebhookEventMiddleware_1.WebhookEventMiddleware, options), (0, common_1.UseBefore)(WebhookEventMiddleware_1.WebhookEventMiddleware)), (0, common_1.Context)(constants_1.STRIPE_WEBHOOK_EVENT));
|
|
18
|
+
}
|
|
19
|
+
exports.WebhookEvent = WebhookEvent;
|
|
20
|
+
//# sourceMappingURL=webhookEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookEvent.js","sourceRoot":"","sources":["../../../src/decorators/webhookEvent.ts"],"names":[],"mappings":";;;AAAA,yCAAgD;AAChD,qCAAwE;AACxE,yCAAgC;AAChC,4CAAkD;AAClD,kFAAkG;AAElG;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,OAAsC;IACjE,OAAO,IAAA,oBAAa,EAClB,IAAA,0BAAmB,EACjB,IAAA,WAAE,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,yBAAyB,CAAC,EACzE,IAAA,WAAE,EAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,8BAA8B,CAAC,EACzG,IAAA,eAAQ,EAAC,+CAAsB,EAAE,OAAO,CAAC,EACzC,IAAA,kBAAS,EAAC,+CAAsB,CAAC,CAClC,EACD,IAAA,gBAAO,EAAC,gCAAoB,CAAC,CAC9B,CAAC;AACJ,CAAC;AAVD,oCAUC","sourcesContent":["import {Context, UseBefore} from \"@tsed/common\";\nimport {StoreSet, useDecorators, useMethodDecorators} from \"@tsed/core\";\nimport {In} from \"@tsed/schema\";\nimport {STRIPE_WEBHOOK_EVENT} from \"../constants\";\nimport {WebhookEventMiddleware, WebhookEventOptions} from \"../middlewares/WebhookEventMiddleware\";\n\n/**\n * Get the stripe webhook event.\n *\n * @decorator\n * @operation\n * @input\n */\nexport function WebhookEvent(options?: Partial<WebhookEventOptions>) {\n return useDecorators(\n useMethodDecorators(\n In(\"body\").Type(Object).Required().Description(\"The raw webhook payload\"),\n In(\"header\").Name(\"stripe-signature\").Type(String).Required().Description(\"The stripe webhook signature\"),\n StoreSet(WebhookEventMiddleware, options),\n UseBefore(WebhookEventMiddleware)\n ),\n Context(STRIPE_WEBHOOK_EVENT)\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripSettings.js","sourceRoot":"","sources":["../../../src/domain/StripSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Stripe} from \"stripe\";\n\nexport interface StripeSettings extends Stripe.StripeConfig {\n /**\n * Stripe ApiKey\n */\n apiKey: string;\n /**\n * Webhooks settings\n */\n webhooks?: {\n /**\n * Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...').\n * You can get this [in your dashboard](https://dashboard.stripe.com/webhooks).\n */\n secret: string;\n /**\n * Seconds of tolerance on timestamps.\n */\n tolerance?: number;\n };\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n stripe: StripeSettings;\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./StripSettings"), exports);
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./StripSettings"), exports);
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":";;;AAAA,+DAAgC","sourcesContent":["export * from \"./StripSettings\";\n"]}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./constants"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./domain/index"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./decorators/webhookEvent"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./middlewares/WebhookEventMiddleware"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./services/StripeFactory"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAA4B;AAC5B,8DAA+B;AAC/B,yEAA0C;AAC1C,oFAAqD;AACrD,wEAAyC","sourcesContent":["export * from \"./constants\";\nexport * from \"./domain/index\";\nexport * from \"./decorators/webhookEvent\";\nexport * from \"./middlewares/WebhookEventMiddleware\";\nexport * from \"./services/StripeFactory\";\n"]}
|
|
@@ -26,22 +26,24 @@ let WebhookEventMiddleware = WebhookEventMiddleware_1 = class WebhookEventMiddle
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
common_1.Inject(),
|
|
31
|
-
tslib_1.__metadata("design:type", stripe_1.Stripe)
|
|
29
|
+
(0, tslib_1.__decorate)([
|
|
30
|
+
(0, common_1.Inject)(),
|
|
31
|
+
(0, tslib_1.__metadata)("design:type", stripe_1.Stripe)
|
|
32
32
|
], WebhookEventMiddleware.prototype, "stripe", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
common_1.Constant("stripe.webhooks"),
|
|
35
|
-
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
(0, tslib_1.__decorate)([
|
|
34
|
+
(0, common_1.Constant)("stripe.webhooks"),
|
|
35
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
36
36
|
], WebhookEventMiddleware.prototype, "webhooks", void 0);
|
|
37
|
-
tslib_1.__decorate([
|
|
38
|
-
tslib_1.__param(0, common_1.HeaderParams("stripe-signature")),
|
|
39
|
-
tslib_1.
|
|
40
|
-
tslib_1.
|
|
41
|
-
tslib_1.__metadata("design:
|
|
37
|
+
(0, tslib_1.__decorate)([
|
|
38
|
+
(0, tslib_1.__param)(0, (0, common_1.HeaderParams)("stripe-signature")),
|
|
39
|
+
(0, tslib_1.__param)(1, (0, common_1.RawBodyParams)()),
|
|
40
|
+
(0, tslib_1.__param)(2, (0, common_1.Context)()),
|
|
41
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
42
|
+
(0, tslib_1.__metadata)("design:paramtypes", [String, Buffer, Object]),
|
|
43
|
+
(0, tslib_1.__metadata)("design:returntype", Object)
|
|
42
44
|
], WebhookEventMiddleware.prototype, "use", null);
|
|
43
|
-
WebhookEventMiddleware = WebhookEventMiddleware_1 = tslib_1.__decorate([
|
|
44
|
-
common_1.Middleware()
|
|
45
|
+
WebhookEventMiddleware = WebhookEventMiddleware_1 = (0, tslib_1.__decorate)([
|
|
46
|
+
(0, common_1.Middleware)()
|
|
45
47
|
], WebhookEventMiddleware);
|
|
46
48
|
exports.WebhookEventMiddleware = WebhookEventMiddleware;
|
|
47
49
|
//# sourceMappingURL=WebhookEventMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/WebhookEventMiddleware.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmH;AACnH,iDAAiE;AACjE,mCAA8B;AAC9B,4CAA4E;AAC5E,qCAAmC;AAQnC,IAAa,sBAAsB,8BAAnC,MAAa,sBAAsB;IAOjC,GAAG,CAAmC,SAAiB,EAAmB,IAAY,EAAa,GAAY;QAC7G,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,GAAwB;YAC/C,GAAG,IAAI,CAAC,QAAQ;YAChB,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAsB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,gCAAmB,CAC3B,qHAAqH,CACtH,CAAC;SACH;QAED,IAAI;YACF,GAAG,CAAC,GAAG,CAAC,oCAAwB,EAAE,SAAS,CAAC,CAAC;YAC7C,GAAG,CAAC,GAAG,CAAC,gCAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;SACxG;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,uBAAU,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;SACnE;IACH,CAAC;CACF,CAAA;AAxBC;IADC,IAAA,eAAM,GAAE;2CACS,eAAM;sDAAC;AAGzB;IADC,IAAA,iBAAQ,EAAC,iBAAiB,CAAC;;wDACY;AAExC;IAAK,wBAAA,IAAA,qBAAY,EAAC,kBAAkB,CAAC,CAAA;IAAqB,wBAAA,IAAA,sBAAa,GAAE,CAAA;IAAgB,wBAAA,IAAA,gBAAO,GAAE,CAAA;;0DAAlB,MAAM;;iDAkBrF;AAzBU,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CA0BlC;AA1BY,wDAAsB","sourcesContent":["import {Constant, Context, HeaderParams, Inject, Middleware, MiddlewareMethods, RawBodyParams} from \"@tsed/common\";\nimport {BadRequest, InternalServerError} from \"@tsed/exceptions\";\nimport {Stripe} from \"stripe\";\nimport {STRIPE_WEBHOOK_EVENT, STRIPE_WEBHOOK_SIGNATURE} from \"../constants\";\nimport \"../services/StripeFactory\";\n\nexport interface WebhookEventOptions {\n secret: string;\n tolerance: number;\n}\n\n@Middleware()\nexport class WebhookEventMiddleware implements MiddlewareMethods {\n @Inject()\n protected stripe: Stripe;\n\n @Constant(\"stripe.webhooks\")\n protected webhooks: WebhookEventOptions;\n\n use(@HeaderParams(\"stripe-signature\") signature: string, @RawBodyParams() body: Buffer, @Context() ctx: Context): any {\n const {secret, tolerance}: WebhookEventOptions = {\n ...this.webhooks,\n ...ctx.endpoint.store.get(WebhookEventMiddleware)\n };\n\n if (!secret) {\n throw new InternalServerError(\n \"Missing Stripe webhooks secret key. You can get this in your dashboard. See: https://dashboard.stripe.com/webhooks.\"\n );\n }\n\n try {\n ctx.set(STRIPE_WEBHOOK_SIGNATURE, signature);\n ctx.set(STRIPE_WEBHOOK_EVENT, this.stripe.webhooks.constructEvent(body, signature, secret, tolerance));\n } catch (err) {\n throw new BadRequest(`Stripe webhook error: ${err.message}`, err);\n }\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const di_1 = require("@tsed/di");
|
|
4
4
|
const stripe_1 = require("stripe");
|
|
5
|
-
di_1.registerProvider({
|
|
5
|
+
(0, di_1.registerProvider)({
|
|
6
6
|
provide: stripe_1.Stripe,
|
|
7
7
|
deps: [di_1.Configuration],
|
|
8
8
|
useFactory(settings) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripeFactory.js","sourceRoot":"","sources":["../../../src/services/StripeFactory.ts"],"names":[],"mappings":";;AAAA,iCAAyD;AACzD,mCAA8B;AAG9B,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,eAAM;IACf,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,UAAU,CAAC,QAAuB;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAC,GAAG,QAAQ,CAAC,GAAG,CAAiB,QAAQ,EAAE,EAAS,CAAC,CAAC;QAEzF,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,eAAM,CAAC,MAAM,EAAE;gBACxB,GAAG,OAAO;gBACV,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {Configuration, registerProvider} from \"@tsed/di\";\nimport {Stripe} from \"stripe\";\nimport {StripeSettings} from \"../domain/StripSettings\";\n\nregisterProvider({\n provide: Stripe,\n deps: [Configuration],\n useFactory(settings: Configuration) {\n const {apiKey, webhooks, ...options} = settings.get<StripeSettings>(\"stripe\", {} as any);\n\n if (apiKey) {\n return new Stripe(apiKey, {\n ...options,\n typescript: true\n });\n }\n\n return {};\n }\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAyB,CAAC","sourcesContent":["export const STRIPE_WEBHOOK_EVENT = \"strip_webhook_event\";\nexport const STRIPE_WEBHOOK_SIGNATURE = \"strip_webhook_signature\";\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context, UseBefore } from "@tsed/common";
|
|
2
|
+
import { StoreSet, useDecorators, useMethodDecorators } from "@tsed/core";
|
|
3
|
+
import { In } from "@tsed/schema";
|
|
4
|
+
import { STRIPE_WEBHOOK_EVENT } from "../constants";
|
|
5
|
+
import { WebhookEventMiddleware } from "../middlewares/WebhookEventMiddleware";
|
|
6
|
+
/**
|
|
7
|
+
* Get the stripe webhook event.
|
|
8
|
+
*
|
|
9
|
+
* @decorator
|
|
10
|
+
* @operation
|
|
11
|
+
* @input
|
|
12
|
+
*/
|
|
13
|
+
export function WebhookEvent(options) {
|
|
14
|
+
return useDecorators(useMethodDecorators(In("body").Type(Object).Required().Description("The raw webhook payload"), In("header").Name("stripe-signature").Type(String).Required().Description("The stripe webhook signature"), StoreSet(WebhookEventMiddleware, options), UseBefore(WebhookEventMiddleware)), Context(STRIPE_WEBHOOK_EVENT));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=webhookEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookEvent.js","sourceRoot":"","sources":["../../../src/decorators/webhookEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,sBAAsB,EAAsB,MAAM,uCAAuC,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAAsC;IACjE,OAAO,aAAa,CAClB,mBAAmB,CACjB,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,yBAAyB,CAAC,EACzE,EAAE,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,8BAA8B,CAAC,EACzG,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC,EACzC,SAAS,CAAC,sBAAsB,CAAC,CAClC,EACD,OAAO,CAAC,oBAAoB,CAAC,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import {Context, UseBefore} from \"@tsed/common\";\nimport {StoreSet, useDecorators, useMethodDecorators} from \"@tsed/core\";\nimport {In} from \"@tsed/schema\";\nimport {STRIPE_WEBHOOK_EVENT} from \"../constants\";\nimport {WebhookEventMiddleware, WebhookEventOptions} from \"../middlewares/WebhookEventMiddleware\";\n\n/**\n * Get the stripe webhook event.\n *\n * @decorator\n * @operation\n * @input\n */\nexport function WebhookEvent(options?: Partial<WebhookEventOptions>) {\n return useDecorators(\n useMethodDecorators(\n In(\"body\").Type(Object).Required().Description(\"The raw webhook payload\"),\n In(\"header\").Name(\"stripe-signature\").Type(String).Required().Description(\"The stripe webhook signature\"),\n StoreSet(WebhookEventMiddleware, options),\n UseBefore(WebhookEventMiddleware)\n ),\n Context(STRIPE_WEBHOOK_EVENT)\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripSettings.js","sourceRoot":"","sources":["../../../src/domain/StripSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Stripe} from \"stripe\";\n\nexport interface StripeSettings extends Stripe.StripeConfig {\n /**\n * Stripe ApiKey\n */\n apiKey: string;\n /**\n * Webhooks settings\n */\n webhooks?: {\n /**\n * Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...').\n * You can get this [in your dashboard](https://dashboard.stripe.com/webhooks).\n */\n secret: string;\n /**\n * Seconds of tolerance on timestamps.\n */\n tolerance?: number;\n };\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n stripe: StripeSettings;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./StripSettings\";\n"]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./constants\";\nexport * from \"./domain/index\";\nexport * from \"./decorators/webhookEvent\";\nexport * from \"./middlewares/WebhookEventMiddleware\";\nexport * from \"./services/StripeFactory\";\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var WebhookEventMiddleware_1;
|
|
2
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
3
|
+
import { Constant, Context, HeaderParams, Inject, Middleware, RawBodyParams } from "@tsed/common";
|
|
4
|
+
import { BadRequest, InternalServerError } from "@tsed/exceptions";
|
|
5
|
+
import { Stripe } from "stripe";
|
|
6
|
+
import { STRIPE_WEBHOOK_EVENT, STRIPE_WEBHOOK_SIGNATURE } from "../constants";
|
|
7
|
+
import "../services/StripeFactory";
|
|
8
|
+
let WebhookEventMiddleware = WebhookEventMiddleware_1 = class WebhookEventMiddleware {
|
|
9
|
+
use(signature, body, ctx) {
|
|
10
|
+
const { secret, tolerance } = {
|
|
11
|
+
...this.webhooks,
|
|
12
|
+
...ctx.endpoint.store.get(WebhookEventMiddleware_1)
|
|
13
|
+
};
|
|
14
|
+
if (!secret) {
|
|
15
|
+
throw new InternalServerError("Missing Stripe webhooks secret key. You can get this in your dashboard. See: https://dashboard.stripe.com/webhooks.");
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
ctx.set(STRIPE_WEBHOOK_SIGNATURE, signature);
|
|
19
|
+
ctx.set(STRIPE_WEBHOOK_EVENT, this.stripe.webhooks.constructEvent(body, signature, secret, tolerance));
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
throw new BadRequest(`Stripe webhook error: ${err.message}`, err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
Inject(),
|
|
28
|
+
__metadata("design:type", Stripe)
|
|
29
|
+
], WebhookEventMiddleware.prototype, "stripe", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Constant("stripe.webhooks"),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], WebhookEventMiddleware.prototype, "webhooks", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
__param(0, HeaderParams("stripe-signature")),
|
|
36
|
+
__param(1, RawBodyParams()),
|
|
37
|
+
__param(2, Context()),
|
|
38
|
+
__metadata("design:type", Function),
|
|
39
|
+
__metadata("design:paramtypes", [String, Buffer, Object]),
|
|
40
|
+
__metadata("design:returntype", Object)
|
|
41
|
+
], WebhookEventMiddleware.prototype, "use", null);
|
|
42
|
+
WebhookEventMiddleware = WebhookEventMiddleware_1 = __decorate([
|
|
43
|
+
Middleware()
|
|
44
|
+
], WebhookEventMiddleware);
|
|
45
|
+
export { WebhookEventMiddleware };
|
|
46
|
+
//# sourceMappingURL=WebhookEventMiddleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/WebhookEventMiddleware.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAqB,aAAa,EAAC,MAAM,cAAc,CAAC;AACnH,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAC5E,OAAO,2BAA2B,CAAC;AAQnC,IAAa,sBAAsB,8BAAnC,MAAa,sBAAsB;IAOjC,GAAG,CAAmC,SAAiB,EAAmB,IAAY,EAAa,GAAY;QAC7G,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,GAAwB;YAC/C,GAAG,IAAI,CAAC,QAAQ;YAChB,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAsB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,mBAAmB,CAC3B,qHAAqH,CACtH,CAAC;SACH;QAED,IAAI;YACF,GAAG,CAAC,GAAG,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;YAC7C,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;SACxG;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,UAAU,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;SACnE;IACH,CAAC;CACF,CAAA;AAxBC;IADC,MAAM,EAAE;8BACS,MAAM;sDAAC;AAGzB;IADC,QAAQ,CAAC,iBAAiB,CAAC;;wDACY;AAExC;IAAK,WAAA,YAAY,CAAC,kBAAkB,CAAC,CAAA;IAAqB,WAAA,aAAa,EAAE,CAAA;IAAgB,WAAA,OAAO,EAAE,CAAA;;6CAAlB,MAAM;;iDAkBrF;AAzBU,sBAAsB;IADlC,UAAU,EAAE;GACA,sBAAsB,CA0BlC;SA1BY,sBAAsB","sourcesContent":["import {Constant, Context, HeaderParams, Inject, Middleware, MiddlewareMethods, RawBodyParams} from \"@tsed/common\";\nimport {BadRequest, InternalServerError} from \"@tsed/exceptions\";\nimport {Stripe} from \"stripe\";\nimport {STRIPE_WEBHOOK_EVENT, STRIPE_WEBHOOK_SIGNATURE} from \"../constants\";\nimport \"../services/StripeFactory\";\n\nexport interface WebhookEventOptions {\n secret: string;\n tolerance: number;\n}\n\n@Middleware()\nexport class WebhookEventMiddleware implements MiddlewareMethods {\n @Inject()\n protected stripe: Stripe;\n\n @Constant(\"stripe.webhooks\")\n protected webhooks: WebhookEventOptions;\n\n use(@HeaderParams(\"stripe-signature\") signature: string, @RawBodyParams() body: Buffer, @Context() ctx: Context): any {\n const {secret, tolerance}: WebhookEventOptions = {\n ...this.webhooks,\n ...ctx.endpoint.store.get(WebhookEventMiddleware)\n };\n\n if (!secret) {\n throw new InternalServerError(\n \"Missing Stripe webhooks secret key. You can get this in your dashboard. See: https://dashboard.stripe.com/webhooks.\"\n );\n }\n\n try {\n ctx.set(STRIPE_WEBHOOK_SIGNATURE, signature);\n ctx.set(STRIPE_WEBHOOK_EVENT, this.stripe.webhooks.constructEvent(body, signature, secret, tolerance));\n } catch (err) {\n throw new BadRequest(`Stripe webhook error: ${err.message}`, err);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Configuration, registerProvider } from "@tsed/di";
|
|
2
|
+
import { Stripe } from "stripe";
|
|
3
|
+
registerProvider({
|
|
4
|
+
provide: Stripe,
|
|
5
|
+
deps: [Configuration],
|
|
6
|
+
useFactory(settings) {
|
|
7
|
+
const { apiKey, webhooks, ...options } = settings.get("stripe", {});
|
|
8
|
+
if (apiKey) {
|
|
9
|
+
return new Stripe(apiKey, {
|
|
10
|
+
...options,
|
|
11
|
+
typescript: true
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=StripeFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripeFactory.js","sourceRoot":"","sources":["../../../src/services/StripeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,UAAU,CAAC;AACzD,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAG9B,gBAAgB,CAAC;IACf,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,CAAC,aAAa,CAAC;IACrB,UAAU,CAAC,QAAuB;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAC,GAAG,QAAQ,CAAC,GAAG,CAAiB,QAAQ,EAAE,EAAS,CAAC,CAAC;QAEzF,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE;gBACxB,GAAG,OAAO;gBACV,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {Configuration, registerProvider} from \"@tsed/di\";\nimport {Stripe} from \"stripe\";\nimport {StripeSettings} from \"../domain/StripSettings\";\n\nregisterProvider({\n provide: Stripe,\n deps: [Configuration],\n useFactory(settings: Configuration) {\n const {apiKey, webhooks, ...options} = settings.get<StripeSettings>(\"stripe\", {} as any);\n\n if (apiKey) {\n return new Stripe(apiKey, {\n ...options,\n typescript: true\n });\n }\n\n return {};\n }\n});\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/stripe",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.1",
|
|
4
4
|
"description": "Stripe package for Ts.ED framework",
|
|
5
|
-
"source": "./src/index.ts",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"typings": "./lib/index.d.ts",
|
|
8
5
|
"private": false,
|
|
9
6
|
"keywords": [
|
|
10
7
|
"Stripe",
|
|
@@ -15,29 +12,40 @@
|
|
|
15
12
|
"express",
|
|
16
13
|
"koa"
|
|
17
14
|
],
|
|
15
|
+
"source": "./src/index.ts",
|
|
16
|
+
"main": "./lib/cjs/index.js",
|
|
17
|
+
"typings": "./lib/types/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"types": "./lib/types/index.d.ts",
|
|
20
|
+
"import": "./lib/esm/index.js",
|
|
21
|
+
"require": "./lib/cjs/index.js",
|
|
22
|
+
"default": "./lib/esm/index.js"
|
|
23
|
+
},
|
|
18
24
|
"scripts": {
|
|
19
|
-
"build": "
|
|
25
|
+
"build": "yarn run build:esm && yarn run build:cjs",
|
|
26
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
27
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
28
|
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
21
29
|
},
|
|
22
30
|
"dependencies": {
|
|
23
31
|
"tslib": "2.2.0"
|
|
24
32
|
},
|
|
25
33
|
"devDependencies": {
|
|
26
|
-
"@tsed/common": "7.0.0-
|
|
27
|
-
"@tsed/core": "7.0.0-
|
|
28
|
-
"@tsed/di": "7.0.0-
|
|
29
|
-
"@tsed/json-mapper": "7.0.0-
|
|
30
|
-
"@tsed/openspec": "7.0.0-
|
|
31
|
-
"@tsed/schema": "7.0.0-
|
|
34
|
+
"@tsed/common": "7.0.0-beta.1",
|
|
35
|
+
"@tsed/core": "7.0.0-beta.1",
|
|
36
|
+
"@tsed/di": "7.0.0-beta.1",
|
|
37
|
+
"@tsed/json-mapper": "7.0.0-beta.1",
|
|
38
|
+
"@tsed/openspec": "7.0.0-beta.1",
|
|
39
|
+
"@tsed/schema": "7.0.0-beta.1",
|
|
32
40
|
"stripe": "^8.129.0"
|
|
33
41
|
},
|
|
34
42
|
"peerDependencies": {
|
|
35
|
-
"@tsed/common": "^7.0.0-
|
|
36
|
-
"@tsed/core": "^7.0.0-
|
|
37
|
-
"@tsed/di": "^7.0.0-
|
|
38
|
-
"@tsed/json-mapper": "^7.0.0-
|
|
39
|
-
"@tsed/openspec": "^7.0.0-
|
|
40
|
-
"@tsed/schema": "^7.0.0-
|
|
43
|
+
"@tsed/common": "^7.0.0-beta.1",
|
|
44
|
+
"@tsed/core": "^7.0.0-beta.1",
|
|
45
|
+
"@tsed/di": "^7.0.0-beta.1",
|
|
46
|
+
"@tsed/json-mapper": "^7.0.0-beta.1",
|
|
47
|
+
"@tsed/openspec": "^7.0.0-beta.1",
|
|
48
|
+
"@tsed/schema": "^7.0.0-beta.1",
|
|
41
49
|
"@types/body-parser": "^1.19.0",
|
|
42
50
|
"body-parser": "^1.19.0",
|
|
43
51
|
"stripe": "^8.129.0"
|
|
@@ -48,8 +56,5 @@
|
|
|
48
56
|
},
|
|
49
57
|
"homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/third-parties/stripe",
|
|
50
58
|
"author": "Romain Lenzotti",
|
|
51
|
-
"license": "MIT"
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"tag": "alpha"
|
|
54
|
-
}
|
|
59
|
+
"license": "MIT"
|
|
55
60
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"node_modules",
|
|
13
|
+
"test",
|
|
14
|
+
"lib",
|
|
15
|
+
"benchmark",
|
|
16
|
+
"coverage",
|
|
17
|
+
"spec",
|
|
18
|
+
"**/*.benchmark.ts",
|
|
19
|
+
"**/*.spec.ts",
|
|
20
|
+
"keys",
|
|
21
|
+
"jest.config.js"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,wBAAwB,GAAG,yBAAyB,CAAC","sourcesContent":["export const STRIPE_WEBHOOK_EVENT = \"strip_webhook_event\";\nexport const STRIPE_WEBHOOK_SIGNATURE = \"strip_webhook_signature\";\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookEvent = void 0;
|
|
4
|
-
const common_1 = require("@tsed/common");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
const schema_1 = require("@tsed/schema");
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const WebhookEventMiddleware_1 = require("../middlewares/WebhookEventMiddleware");
|
|
9
|
-
/**
|
|
10
|
-
* Get the stripe webhook event.
|
|
11
|
-
*
|
|
12
|
-
* @decorator
|
|
13
|
-
* @operation
|
|
14
|
-
* @input
|
|
15
|
-
*/
|
|
16
|
-
function WebhookEvent(options) {
|
|
17
|
-
return core_1.useDecorators(core_1.useMethodDecorators(schema_1.In("body").Type(Object).Required().Description("The raw webhook payload"), schema_1.In("header").Name("stripe-signature").Type(String).Required().Description("The stripe webhook signature"), core_1.StoreSet(WebhookEventMiddleware_1.WebhookEventMiddleware, options), common_1.UseBefore(WebhookEventMiddleware_1.WebhookEventMiddleware)), common_1.Context(constants_1.STRIPE_WEBHOOK_EVENT));
|
|
18
|
-
}
|
|
19
|
-
exports.WebhookEvent = WebhookEvent;
|
|
20
|
-
//# sourceMappingURL=webhookEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhookEvent.js","sourceRoot":"","sources":["../../src/decorators/webhookEvent.ts"],"names":[],"mappings":";;;AAAA,yCAAgD;AAChD,qCAAwE;AACxE,yCAAgC;AAChC,4CAAkD;AAClD,kFAAkG;AAElG;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,OAAsC;IACjE,OAAO,oBAAa,CAClB,0BAAmB,CACjB,WAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,yBAAyB,CAAC,EACzE,WAAE,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,8BAA8B,CAAC,EACzG,eAAQ,CAAC,+CAAsB,EAAE,OAAO,CAAC,EACzC,kBAAS,CAAC,+CAAsB,CAAC,CAClC,EACD,gBAAO,CAAC,gCAAoB,CAAC,CAC9B,CAAC;AACJ,CAAC;AAVD,oCAUC","sourcesContent":["import {Context, UseBefore} from \"@tsed/common\";\nimport {StoreSet, useDecorators, useMethodDecorators} from \"@tsed/core\";\nimport {In} from \"@tsed/schema\";\nimport {STRIPE_WEBHOOK_EVENT} from \"../constants\";\nimport {WebhookEventMiddleware, WebhookEventOptions} from \"../middlewares/WebhookEventMiddleware\";\n\n/**\n * Get the stripe webhook event.\n *\n * @decorator\n * @operation\n * @input\n */\nexport function WebhookEvent(options?: Partial<WebhookEventOptions>) {\n return useDecorators(\n useMethodDecorators(\n In(\"body\").Type(Object).Required().Description(\"The raw webhook payload\"),\n In(\"header\").Name(\"stripe-signature\").Type(String).Required().Description(\"The stripe webhook signature\"),\n StoreSet(WebhookEventMiddleware, options),\n UseBefore(WebhookEventMiddleware)\n ),\n Context(STRIPE_WEBHOOK_EVENT)\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StripSettings.js","sourceRoot":"","sources":["../../src/domain/StripSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Stripe} from \"stripe\";\n\nexport interface StripeSettings extends Stripe.StripeConfig {\n /**\n * Stripe ApiKey\n */\n apiKey: string;\n /**\n * Webhooks settings\n */\n webhooks?: {\n /**\n * Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...').\n * You can get this [in your dashboard](https://dashboard.stripe.com/webhooks).\n */\n secret: string;\n /**\n * Seconds of tolerance on timestamps.\n */\n tolerance?: number;\n };\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n stripe: StripeSettings;\n }\n }\n}\n"]}
|
package/lib/domain/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC","sourcesContent":["export * from \"./StripSettings\";\n"]}
|
package/lib/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./domain/index"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./decorators/webhookEvent"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./middlewares/WebhookEventMiddleware"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./services/StripeFactory"), exports);
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,yDAA+B;AAC/B,oEAA0C;AAC1C,+EAAqD;AACrD,mEAAyC","sourcesContent":["export * from \"./constants\";\nexport * from \"./domain/index\";\nexport * from \"./decorators/webhookEvent\";\nexport * from \"./middlewares/WebhookEventMiddleware\";\nexport * from \"./services/StripeFactory\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StripeFactory.js","sourceRoot":"","sources":["../../src/services/StripeFactory.ts"],"names":[],"mappings":";;AAAA,iCAAyD;AACzD,mCAA8B;AAG9B,qBAAgB,CAAC;IACf,OAAO,EAAE,eAAM;IACf,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,UAAU,CAAC,QAAuB;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAC,GAAG,QAAQ,CAAC,GAAG,CAAiB,QAAQ,EAAE,EAAS,CAAC,CAAC;QAEzF,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,eAAM,CAAC,MAAM,EAAE;gBACxB,GAAG,OAAO;gBACV,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {Configuration, registerProvider} from \"@tsed/di\";\nimport {Stripe} from \"stripe\";\nimport {StripeSettings} from \"../domain/StripSettings\";\n\nregisterProvider({\n provide: Stripe,\n deps: [Configuration],\n useFactory(settings: Configuration) {\n const {apiKey, webhooks, ...options} = settings.get<StripeSettings>(\"stripe\", {} as any);\n\n if (apiKey) {\n return new Stripe(apiKey, {\n ...options,\n typescript: true\n });\n }\n\n return {};\n }\n});\n"]}
|