@tsed/stripe 7.79.4 → 7.80.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/esm/middlewares/WebhookEventMiddleware.js +1 -1
- package/lib/types-esm/constants/constants.d.ts +2 -0
- package/lib/types-esm/decorators/webhookEvent.d.ts +9 -0
- package/lib/types-esm/domain/StripeSettings.d.ts +28 -0
- package/lib/types-esm/index.d.ts +8 -0
- package/lib/types-esm/middlewares/WebhookEventMiddleware.d.ts +14 -0
- package/lib/types-esm/services/StripeFactory.d.ts +2 -0
- package/package.json +25 -21
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -20
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -48
|
@@ -6,7 +6,7 @@ import { Constant, Inject } from "@tsed/di";
|
|
|
6
6
|
import { BadRequest, InternalServerError } from "@tsed/exceptions";
|
|
7
7
|
import { Stripe } from "stripe";
|
|
8
8
|
import { STRIPE_WEBHOOK_EVENT, STRIPE_WEBHOOK_SIGNATURE } from "../constants/constants.js";
|
|
9
|
-
import "../services/StripeFactory
|
|
9
|
+
import "../services/StripeFactory";
|
|
10
10
|
let WebhookEventMiddleware = WebhookEventMiddleware_1 = class WebhookEventMiddleware {
|
|
11
11
|
stripe;
|
|
12
12
|
webhooks;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Stripe } from "stripe";
|
|
2
|
+
export interface StripeSettings extends Stripe.StripeConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Stripe ApiKey
|
|
5
|
+
*/
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/**
|
|
8
|
+
* Webhooks settings
|
|
9
|
+
*/
|
|
10
|
+
webhooks?: {
|
|
11
|
+
/**
|
|
12
|
+
* Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...').
|
|
13
|
+
* You can get this [in your dashboard](https://dashboard.stripe.com/webhooks).
|
|
14
|
+
*/
|
|
15
|
+
secret: string;
|
|
16
|
+
/**
|
|
17
|
+
* Seconds of tolerance on timestamps.
|
|
18
|
+
*/
|
|
19
|
+
tolerance?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
namespace TsED {
|
|
24
|
+
interface Configuration {
|
|
25
|
+
stripe: StripeSettings;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./constants/constants.js";
|
|
5
|
+
export * from "./decorators/webhookEvent.js";
|
|
6
|
+
export * from "./domain/StripeSettings.js";
|
|
7
|
+
export * from "./middlewares/WebhookEventMiddleware.js";
|
|
8
|
+
export * from "./services/StripeFactory.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Context } from "@tsed/platform-params";
|
|
3
|
+
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
4
|
+
import { Stripe } from "stripe";
|
|
5
|
+
import "../services/StripeFactory";
|
|
6
|
+
export interface WebhookEventOptions {
|
|
7
|
+
secret: string;
|
|
8
|
+
tolerance: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class WebhookEventMiddleware implements MiddlewareMethods {
|
|
11
|
+
protected stripe: Stripe;
|
|
12
|
+
protected webhooks: WebhookEventOptions;
|
|
13
|
+
use(signature: string, body: Buffer, ctx: Context): any;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/stripe",
|
|
3
|
-
"version": "7.79.4",
|
|
4
3
|
"description": "Stripe package for Ts.ED framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.1",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"Stripe",
|
|
7
8
|
"Ts.ED",
|
|
@@ -16,38 +17,41 @@
|
|
|
16
17
|
"module": "./lib/esm/index.js",
|
|
17
18
|
"typings": "./lib/types/index.d.ts",
|
|
18
19
|
"exports": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"import": "./lib/esm/index.js",
|
|
23
|
+
"default": "./lib/cjs/index.js"
|
|
24
|
+
}
|
|
23
25
|
},
|
|
24
26
|
"scripts": {
|
|
25
27
|
"build": "yarn barrels && yarn build:ts",
|
|
26
28
|
"barrels": "barrels",
|
|
27
|
-
"test": "
|
|
28
|
-
"build:ts": "tsc --build tsconfig.json
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
31
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
29
32
|
},
|
|
30
33
|
"dependencies": {
|
|
31
34
|
"tslib": "2.6.1"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
|
-
"@tsed/barrels": "7.
|
|
35
|
-
"@tsed/core": "7.
|
|
36
|
-
"@tsed/di": "7.
|
|
37
|
-
"@tsed/exceptions": "7.
|
|
38
|
-
"@tsed/platform-middlewares": "7.
|
|
39
|
-
"@tsed/platform-params": "7.
|
|
40
|
-
"@tsed/schema": "7.
|
|
41
|
-
"@tsed/typescript": "7.
|
|
37
|
+
"@tsed/barrels": "7.80.1",
|
|
38
|
+
"@tsed/core": "7.80.1",
|
|
39
|
+
"@tsed/di": "7.80.1",
|
|
40
|
+
"@tsed/exceptions": "7.80.1",
|
|
41
|
+
"@tsed/platform-middlewares": "7.80.1",
|
|
42
|
+
"@tsed/platform-params": "7.80.1",
|
|
43
|
+
"@tsed/schema": "7.80.1",
|
|
44
|
+
"@tsed/typescript": "7.80.1",
|
|
42
45
|
"eslint": "^8.57.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
46
|
+
"stripe": "^8.129.0",
|
|
47
|
+
"typescript": "4.9.5",
|
|
48
|
+
"vitest": "2.0.4"
|
|
45
49
|
},
|
|
46
50
|
"peerDependencies": {
|
|
47
|
-
"@tsed/exceptions": "7.
|
|
48
|
-
"@tsed/platform-middlewares": "7.
|
|
49
|
-
"@tsed/platform-params": "7.
|
|
50
|
-
"@tsed/schema": "7.
|
|
51
|
+
"@tsed/exceptions": "7.80.1",
|
|
52
|
+
"@tsed/platform-middlewares": "7.80.1",
|
|
53
|
+
"@tsed/platform-params": "7.80.1",
|
|
54
|
+
"@tsed/schema": "7.80.1",
|
|
51
55
|
"@types/body-parser": "^1.19.0",
|
|
52
56
|
"body-parser": "^1.19.0",
|
|
53
57
|
"stripe": "^9.16.0"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
const config = require("@tsed/jest-config");
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
...config,
|
|
7
|
-
roots: ["<rootDir>/src", "<rootDir>/test"],
|
|
8
|
-
moduleNameMapper: {
|
|
9
|
-
...config.moduleNameMapper,
|
|
10
|
-
"@tsed/stripe": "<rootDir>/src/index.ts"
|
|
11
|
-
},
|
|
12
|
-
coverageThreshold: {
|
|
13
|
-
global: {
|
|
14
|
-
statements: 0,
|
|
15
|
-
branches: 0,
|
|
16
|
-
functions: 0,
|
|
17
|
-
lines: 0
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types",
|
|
10
|
-
"composite": true,
|
|
11
|
-
"noEmit": false
|
|
12
|
-
},
|
|
13
|
-
"include": ["src", "src/**/*.json"],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"node_modules",
|
|
16
|
-
"test",
|
|
17
|
-
"lib",
|
|
18
|
-
"benchmark",
|
|
19
|
-
"coverage",
|
|
20
|
-
"spec",
|
|
21
|
-
"**/*.benchmark.ts",
|
|
22
|
-
"**/*.spec.ts",
|
|
23
|
-
"keys",
|
|
24
|
-
"jest.config.js",
|
|
25
|
-
"**/__mock__/**",
|
|
26
|
-
"webpack.config.js"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "../../specs/exceptions"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../platform/platform-middlewares"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../platform/platform-params"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../specs/schema"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../core"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../di"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|