mppx 0.17.0 → 0.17.3
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 +45 -0
- package/dist/BodyDigest.js +13 -1
- package/dist/Method.d.ts +5 -0
- package/dist/Store.d.ts +225 -0
- package/dist/Store.js +358 -0
- package/dist/cli/cli.js +136 -135
- package/dist/cli/plugins/index.js +12 -11
- package/dist/cli/sessions/Manager.js +12 -1
- package/dist/cli/sessions/store.js +7 -1
- package/dist/cli/utils.d.ts +2 -0
- package/dist/cli/utils.js +6 -0
- package/dist/cli/validate/helpers.d.ts +1 -1
- package/dist/cli/validate/helpers.js +14 -2
- package/dist/client/Mppx.d.ts +1 -1
- package/dist/client/Mppx.js +18 -6
- package/dist/client/internal/Fetch.d.ts +3 -1
- package/dist/client/internal/Fetch.js +68 -3
- package/dist/client/internal/MethodResponse.d.ts +8 -0
- package/dist/client/internal/MethodResponse.js +9 -0
- package/dist/client/internal/ProofRealm.d.ts +3 -3
- package/dist/client/internal/ProofRealm.js +4 -4
- package/dist/client/internal/protocols/Mcp.d.ts +4 -0
- package/dist/client/internal/protocols/Mcp.js +27 -14
- package/dist/identity/Client.js +7 -1
- package/dist/internal/AcceptPayment.d.ts +12 -2
- package/dist/internal/AcceptPayment.js +12 -3
- package/dist/internal/sse.d.ts +21 -0
- package/dist/internal/sse.js +65 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/mcp/client/McpClient.d.ts +2 -2
- package/dist/mcp/client/McpClient.js +6 -3
- package/dist/proxy/Proxy.d.ts +17 -0
- package/dist/proxy/Proxy.js +116 -3
- package/dist/proxy/internal/Replay.d.ts +105 -0
- package/dist/proxy/internal/Replay.js +257 -0
- package/dist/server/Mppx.d.ts +2 -0
- package/dist/server/Mppx.js +7 -5
- package/dist/server/Transport.js +1 -1
- package/dist/server/internal/html/config.d.ts +7 -1
- package/dist/server/internal/html/config.js +4 -0
- package/dist/stripe/internal/types.d.ts +82 -6
- package/dist/stripe/server/Charge.js +1 -2
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/client/Charge.d.ts +9 -0
- package/dist/tempo/client/Charge.js +13 -9
- package/dist/tempo/client/Methods.d.ts +2 -0
- package/dist/tempo/internal/fee-payer.d.ts +85 -10
- package/dist/tempo/internal/fee-payer.js +183 -19
- package/dist/tempo/legacy/session/Chain.js +2 -0
- package/dist/tempo/server/Charge.js +6 -3
- package/dist/tempo/server/Subscription.js +1 -0
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/server/internal/transport.d.ts +6 -0
- package/dist/tempo/server/internal/transport.js +21 -21
- package/dist/tempo/session/client/ChannelOps.d.ts +2 -0
- package/dist/tempo/session/client/ChannelStore.d.ts +2 -0
- package/dist/tempo/session/client/ChannelStore.js +5 -0
- package/dist/tempo/session/client/CredentialState.js +2 -0
- package/dist/tempo/session/client/Session.d.ts +37 -2
- package/dist/tempo/session/client/Session.js +111 -7
- package/dist/tempo/session/client/SessionManager.d.ts +2 -1
- package/dist/tempo/session/client/SessionManager.js +60 -9
- package/dist/tempo/session/client/Transports.d.ts +4 -0
- package/dist/tempo/session/client/Transports.js +35 -3
- package/dist/tempo/session/precompile/Chain.js +1 -0
- package/dist/tempo/session/precompile/Voucher.js +20 -7
- package/dist/tempo/session/server/ChannelStore.d.ts +9 -0
- package/dist/tempo/session/server/ChannelStore.js +8 -1
- package/dist/tempo/session/server/MeteredStream.d.ts +4 -0
- package/dist/tempo/session/server/MeteredStream.js +6 -1
- package/dist/tempo/session/server/Session.d.ts +2 -1
- package/dist/tempo/session/server/Session.js +2 -1
- package/dist/tempo/session/server/Settlement.d.ts +4 -2
- package/dist/tempo/session/server/Settlement.js +2 -2
- package/dist/tempo/session/server/Sse.d.ts +59 -0
- package/dist/tempo/session/server/Sse.js +175 -10
- package/dist/tempo/session/server/Ws.js +29 -12
- package/dist/zod.d.ts +2 -1
- package/dist/zod.js +1 -1
- package/package.json +1 -3
- package/dist/stripe/server/internal/html/types.d.ts +0 -2
- package/dist/stripe/server/internal/html/types.js +0 -2
|
@@ -40,7 +40,32 @@ export async function serve(options) {
|
|
|
40
40
|
runtime.closed = true;
|
|
41
41
|
abortController.abort();
|
|
42
42
|
unsubscribe();
|
|
43
|
-
await
|
|
43
|
+
await closeSocket(code, reason);
|
|
44
|
+
};
|
|
45
|
+
const closeSocket = async (code, reason) => {
|
|
46
|
+
try {
|
|
47
|
+
await socket.close(code, reason);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Some adapters reject a close even after the session has stopped.
|
|
51
|
+
// Retry without application data and contain both sync and async errors.
|
|
52
|
+
try {
|
|
53
|
+
await socket.close();
|
|
54
|
+
}
|
|
55
|
+
catch { }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const rejectAndClose = (message, status, code) => {
|
|
59
|
+
runtime.closed = true;
|
|
60
|
+
abortController.abort();
|
|
61
|
+
unsubscribe();
|
|
62
|
+
// Queue the small final diagnostic synchronously before close changes socket state.
|
|
63
|
+
// Do not wait for an adapter's send promise: a stalled peer must still be closed.
|
|
64
|
+
try {
|
|
65
|
+
void Promise.resolve(socket.send(formatErrorMessage({ message, status }))).catch(() => { });
|
|
66
|
+
}
|
|
67
|
+
catch { }
|
|
68
|
+
void closeSocket(code, message);
|
|
44
69
|
};
|
|
45
70
|
const sendCloseReady = async () => {
|
|
46
71
|
if (runtime.closeReadySent || !runtime.streamContext || runtime.closed)
|
|
@@ -129,7 +154,7 @@ export async function serve(options) {
|
|
|
129
154
|
message: authorizationResult.message,
|
|
130
155
|
status: authorizationResult.responseStatus,
|
|
131
156
|
}));
|
|
132
|
-
await close(1008,
|
|
157
|
+
await close(1008, 'payment authorization rejected');
|
|
133
158
|
return;
|
|
134
159
|
}
|
|
135
160
|
const { receipt } = authorizationResult;
|
|
@@ -169,11 +194,7 @@ export async function serve(options) {
|
|
|
169
194
|
return;
|
|
170
195
|
const messageBytes = frameByteLength(payload);
|
|
171
196
|
if (messageBytes !== null && messageBytes > maxIncomingMessageBytes) {
|
|
172
|
-
|
|
173
|
-
abortController.abort();
|
|
174
|
-
unsubscribe();
|
|
175
|
-
void send(socket, formatErrorMessage({ message: 'payment message is too large', status: 413 })).catch(() => { });
|
|
176
|
-
void Promise.resolve(socket.close(1009, 'payment message is too large')).catch(() => { });
|
|
197
|
+
rejectAndClose('payment message is too large', 413, 1009);
|
|
177
198
|
return;
|
|
178
199
|
}
|
|
179
200
|
const raw = toText(payload);
|
|
@@ -194,11 +215,7 @@ export async function serve(options) {
|
|
|
194
215
|
if (!work)
|
|
195
216
|
return;
|
|
196
217
|
if (runtime.queuedActions >= maxQueuedPaymentMessages) {
|
|
197
|
-
|
|
198
|
-
message: 'too many queued payment messages',
|
|
199
|
-
status: 429,
|
|
200
|
-
})).catch(() => { });
|
|
201
|
-
void close(1008, 'too many queued payment messages');
|
|
218
|
+
rejectAndClose('too many queued payment messages', 429, 1008);
|
|
202
219
|
return;
|
|
203
220
|
}
|
|
204
221
|
runtime.queuedActions++;
|
package/dist/zod.d.ts
CHANGED
package/dist/zod.js
CHANGED
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.3",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/wevm/mppx#readme",
|
|
@@ -206,8 +206,6 @@
|
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
"dependencies": {
|
|
209
|
-
"@stripe/stripe-js": "9.17.0",
|
|
210
|
-
"eventsource-parser": "4.1.1",
|
|
211
209
|
"ox": "0.14.45",
|
|
212
210
|
"structured-headers": "2.1.0",
|
|
213
211
|
"zod": "^4.6.7"
|