@mesub/node 0.1.4 → 0.1.6
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/README.md +20 -5
- package/dist/{chunk-43Q4PNF7.cjs → chunk-4M3ACBWX.cjs} +28 -2
- package/dist/chunk-4M3ACBWX.cjs.map +1 -0
- package/dist/{chunk-K6U6FPTA.cjs → chunk-5LDAYKUA.cjs} +7 -7
- package/dist/{chunk-K6U6FPTA.cjs.map → chunk-5LDAYKUA.cjs.map} +1 -1
- package/dist/{chunk-IAYUXSDD.cjs → chunk-5THDILDD.cjs} +16 -3
- package/dist/chunk-5THDILDD.cjs.map +1 -0
- package/dist/{chunk-PFI3Y32I.js → chunk-ANBU7BJU.js} +2 -2
- package/dist/{chunk-EPOLIEGY.js → chunk-EGGKTDHO.js} +2 -2
- package/dist/{chunk-IG4QRQSJ.js → chunk-QDBKSJ56.js} +16 -3
- package/dist/chunk-QDBKSJ56.js.map +1 -0
- package/dist/{chunk-JJWHMB2X.js → chunk-R4H46TSQ.js} +28 -2
- package/dist/chunk-R4H46TSQ.js.map +1 -0
- package/dist/{chunk-YCPYBU3R.cjs → chunk-TDRUSUBV.cjs} +4 -4
- package/dist/{chunk-YCPYBU3R.cjs.map → chunk-TDRUSUBV.cjs.map} +1 -1
- package/dist/{client-BZB6KIGd.d.cts → client-B2DttW-V.d.cts} +18 -2
- package/dist/{client-Q5QhXphp.d.ts → client-BHrc_yO3.d.ts} +18 -2
- package/dist/{errors-BN4ZWUfM.d.ts → errors-CTFJfJoF.d.ts} +1 -1
- package/dist/{errors-DcLfunS-.d.cts → errors-xk1hGCOf.d.cts} +1 -1
- package/dist/express.cjs +21 -21
- package/dist/express.d.cts +7 -7
- package/dist/express.d.ts +7 -7
- package/dist/express.js +3 -3
- package/dist/{guard-D4AB5HtN.d.cts → guard-CDC9mDWY.d.cts} +1 -1
- package/dist/{guard-CaXiHMVF.d.ts → guard-CrGTKKXV.d.ts} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/nest.cjs +13 -13
- package/dist/nest.d.cts +5 -5
- package/dist/nest.d.ts +5 -5
- package/dist/nest.js +2 -2
- package/dist/next.cjs +20 -20
- package/dist/next.d.cts +7 -7
- package/dist/next.d.ts +7 -7
- package/dist/next.js +3 -3
- package/dist/{routes-DT8EFWSl.d.cts → routes-BpOV9UAR.d.cts} +2 -2
- package/dist/{routes-KoaD1Xsk.d.ts → routes-DWhspa6s.d.ts} +2 -2
- package/dist/situations.cjs +2 -2
- package/dist/situations.d.cts +41 -1
- package/dist/situations.d.ts +41 -1
- package/dist/situations.js +1 -1
- package/dist/{subscriptions-B6Lin6i_.d.cts → subscriptions-Dy_BNyPE.d.cts} +6 -3
- package/dist/{subscriptions-B6Lin6i_.d.ts → subscriptions-Dy_BNyPE.d.ts} +6 -3
- package/dist/testing.cjs +19 -15
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +9 -6
- package/dist/testing.d.ts +9 -6
- package/dist/testing.js +5 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-43Q4PNF7.cjs.map +0 -1
- package/dist/chunk-IAYUXSDD.cjs.map +0 -1
- package/dist/chunk-IG4QRQSJ.js.map +0 -1
- package/dist/chunk-JJWHMB2X.js.map +0 -1
- /package/dist/{chunk-PFI3Y32I.js.map → chunk-ANBU7BJU.js.map} +0 -0
- /package/dist/{chunk-EPOLIEGY.js.map → chunk-EGGKTDHO.js.map} +0 -0
package/dist/testing.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { A as AccessAnswer, j as ServerSubscription, C as Customer, t as SubscriptionAttempt } from './subscriptions-
|
|
2
|
-
import { n as Plan, p as PlanToken, m as MesubOptions, M as Mesub,
|
|
1
|
+
import { A as AccessAnswer, j as ServerSubscription, C as Customer, t as SubscriptionAttempt } from './subscriptions-Dy_BNyPE.js';
|
|
2
|
+
import { n as Plan, p as PlanToken, m as MesubOptions, M as Mesub, X as WebhookEventType, j as EventType, l as MesubEvent } from './client-BHrc_yO3.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `@mesub/node/testing`: a fake Mesub, for a merchant's own tests. It answers
|
|
6
|
-
* what the SDK calls (`/v1/
|
|
7
|
-
* fresh transaction, its attempts and its cancel,
|
|
8
|
-
* `/v1/events`) from what the test sets, through a
|
|
9
|
-
* client: no network, no backend, no test framework of
|
|
6
|
+
* what the SDK calls (`/v1/project`, `/v1/access`, `/v1/plans`,
|
|
7
|
+
* `/v1/subscriptions`, its fresh transaction, its attempts and its cancel,
|
|
8
|
+
* resume and close, and `/v1/events`) from what the test sets, through a
|
|
9
|
+
* `fetch` handed to the client: no network, no backend, no test framework of
|
|
10
|
+
* its own.
|
|
10
11
|
*
|
|
11
12
|
* ```ts
|
|
12
13
|
* import { FakeMesub } from '@mesub/node/testing';
|
|
@@ -214,6 +215,8 @@ declare class FakeMesub {
|
|
|
214
215
|
readonly baseUrl: string;
|
|
215
216
|
readonly apiKey: string;
|
|
216
217
|
readonly webhookSecret: string;
|
|
218
|
+
/** What `project()` answers: the id of the project the key belongs to. */
|
|
219
|
+
readonly projectId = "proj_fake";
|
|
217
220
|
/** Every call received, oldest first. */
|
|
218
221
|
readonly requests: FakeRequest[];
|
|
219
222
|
/** Hand it to `new Mesub({ fetch })`, or use `client()`. */
|
package/dist/testing.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Mesub,
|
|
5
5
|
customerOf,
|
|
6
6
|
signedHeaders
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QDBKSJ56.js";
|
|
8
8
|
|
|
9
9
|
// src/testing.ts
|
|
10
10
|
var ACCESS_ATTEMPTS = 5;
|
|
@@ -108,6 +108,8 @@ var FakeMesub = class {
|
|
|
108
108
|
baseUrl;
|
|
109
109
|
apiKey;
|
|
110
110
|
webhookSecret;
|
|
111
|
+
/** What `project()` answers: the id of the project the key belongs to. */
|
|
112
|
+
projectId = "proj_fake";
|
|
111
113
|
/** Every call received, oldest first. */
|
|
112
114
|
requests = [];
|
|
113
115
|
/** Hand it to `new Mesub({ fetch })`, or use `client()`. */
|
|
@@ -579,6 +581,8 @@ var FakeMesub = class {
|
|
|
579
581
|
...retryAfter !== void 0 && { retryAfter }
|
|
580
582
|
});
|
|
581
583
|
}
|
|
584
|
+
if (method === "GET" && path === "/v1/project")
|
|
585
|
+
return Response.json({ id: this.projectId });
|
|
582
586
|
if (method === "GET" && path === "/v1/plans") {
|
|
583
587
|
return Response.json({ plans: this.#planList.map((plan) => this.#served(plan)) });
|
|
584
588
|
}
|