mppx 0.17.3 → 0.17.4
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/CHANGELOG.md +37 -0
- package/dist/Errors.d.ts +94 -0
- package/dist/Errors.js +83 -0
- package/dist/Store.d.ts +199 -11
- package/dist/Store.js +527 -48
- package/dist/cli/cli.js +141 -137
- package/dist/cli/internal.js +28 -6
- package/dist/cli/plugins/index.js +16 -12
- package/dist/cli/validate/challenge.d.ts +4 -0
- package/dist/cli/validate/challenge.js +9 -6
- package/dist/cloudflare/ChannelStore.d.ts +97 -0
- package/dist/cloudflare/ChannelStore.js +304 -0
- package/dist/cloudflare/Channels.d.ts +92 -0
- package/dist/cloudflare/Channels.js +325 -0
- package/dist/cloudflare/index.d.ts +5 -0
- package/dist/cloudflare/index.js +5 -0
- package/dist/internal/sse.js +32 -15
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/stripe/server/Methods.d.ts +2 -0
- package/dist/stripe/server/Methods.js +2 -1
- package/dist/stripe/server/internal/record-payment.d.ts +49 -0
- package/dist/stripe/server/internal/record-payment.js +75 -18
- package/dist/tempo/Methods.d.ts +8 -0
- package/dist/tempo/Methods.js +18 -2
- package/dist/tempo/client/Charge.d.ts +32 -1
- package/dist/tempo/client/Charge.js +201 -3
- package/dist/tempo/client/Methods.d.ts +16 -0
- package/dist/tempo/internal/fee-payer.d.ts +0 -25
- package/dist/tempo/internal/fee-payer.js +50 -3
- package/dist/tempo/internal/zone.d.ts +79 -0
- package/dist/tempo/internal/zone.js +133 -0
- package/dist/tempo/server/Charge.d.ts +7 -3
- package/dist/tempo/server/Charge.js +98 -4
- package/dist/tempo/server/Methods.d.ts +40 -0
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/server/ChannelStore.d.ts +5 -0
- package/dist/tempo/session/server/ChannelStore.js +2 -2
- package/dist/tempo/session/server/CredentialVerification.js +1 -1
- package/dist/validation/core.js +2 -0
- package/package.json +5 -1
|
@@ -301,6 +301,11 @@ export interface BaseState {
|
|
|
301
301
|
}> | undefined;
|
|
302
302
|
/** First block at which the close supervisor read this channel open on-chain. */
|
|
303
303
|
closeSupervisedFromBlock?: bigint | undefined;
|
|
304
|
+
/**
|
|
305
|
+
* The `closeRequestedAt` this server wrote as its own cooperative-close marker before
|
|
306
|
+
* broadcasting a close, to tell that marker from a payer's close request on-chain.
|
|
307
|
+
*/
|
|
308
|
+
pendingCloseAt?: bigint | undefined;
|
|
304
309
|
}
|
|
305
310
|
/** Expiring ownership claim for one server-scheduled settlement attempt. */
|
|
306
311
|
export type ScheduledSettlementLease = {
|
|
@@ -238,7 +238,7 @@ export function reconcileExpiredPendingClose(parameters) {
|
|
|
238
238
|
const expiresAt = current.closeRequestedAt + BigInt(pendingCloseValiditySeconds);
|
|
239
239
|
if (BigInt(now) <= expiresAt + BigInt(pendingCloseClockSkewSeconds))
|
|
240
240
|
return current;
|
|
241
|
-
return { ...current, closeRequestedAt: 0n };
|
|
241
|
+
return { ...current, closeRequestedAt: 0n, pendingCloseAt: undefined };
|
|
242
242
|
}
|
|
243
243
|
/** Marks local channel state as pending close and returns the bounded capture amount. */
|
|
244
244
|
export function markPendingClose(parameters) {
|
|
@@ -257,7 +257,7 @@ export function markPendingClose(parameters) {
|
|
|
257
257
|
});
|
|
258
258
|
return {
|
|
259
259
|
captureAmount,
|
|
260
|
-
state: { ...current, closeRequestedAt },
|
|
260
|
+
state: { ...current, closeRequestedAt, pendingCloseAt: closeRequestedAt },
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
263
|
/** Finalizes local channel state after a successful close transaction. */
|
|
@@ -957,7 +957,7 @@ async function handleCloseCredential(parameters) {
|
|
|
957
957
|
const closeFailed = !send.tracked.attempted || error instanceof VerificationFailedError;
|
|
958
958
|
if (pendingCloseMarked && closeFailed) {
|
|
959
959
|
await store.updateChannel(channelId, (current) => current && current.closeRequestedAt === pendingCloseStartedAt
|
|
960
|
-
? { ...current, closeRequestedAt: 0n }
|
|
960
|
+
? { ...current, closeRequestedAt: 0n, pendingCloseAt: undefined }
|
|
961
961
|
: current);
|
|
962
962
|
}
|
|
963
963
|
throw error;
|
package/dist/validation/core.js
CHANGED
|
@@ -61,6 +61,8 @@ export async function* validateStream(options) {
|
|
|
61
61
|
if (isMpp) {
|
|
62
62
|
const errorResults = await validateErrorHandling(baseUrl, endpoint, {
|
|
63
63
|
body: effectiveBody,
|
|
64
|
+
challenge: parsedChallenges?.[0],
|
|
65
|
+
extraHeaders: options.headers,
|
|
64
66
|
query: options.query,
|
|
65
67
|
});
|
|
66
68
|
yield { phase: 'errorHandling', endpoint, results: errorResults };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mppx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.4",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/wevm/mppx#readme",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"types": "./dist/client/node.d.ts",
|
|
36
36
|
"default": "./dist/client/node.js"
|
|
37
37
|
},
|
|
38
|
+
"./cloudflare": {
|
|
39
|
+
"types": "./dist/cloudflare/index.d.ts",
|
|
40
|
+
"default": "./dist/cloudflare/index.js"
|
|
41
|
+
},
|
|
38
42
|
"./identity": {
|
|
39
43
|
"types": "./dist/identity/index.d.ts",
|
|
40
44
|
"default": "./dist/identity/index.js"
|