mppx 0.21.3 → 0.22.0
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 +26 -0
- package/dist/BodyDigest.d.ts +3 -3
- package/dist/BodyDigest.js +5 -3
- package/dist/Challenge.js +12 -2
- package/dist/Credential.js +9 -1
- package/dist/Errors.d.ts +62 -8
- package/dist/Errors.js +57 -6
- package/dist/Store.d.ts +7 -4
- package/dist/Store.js +18 -8
- package/dist/cli/cli.js +135 -135
- package/dist/cli/internal.js +1 -1
- package/dist/cli/plugins/index.js +12 -12
- package/dist/client/Budget.d.ts +49 -0
- package/dist/client/Budget.js +101 -0
- package/dist/client/Mppx.d.ts +8 -3
- package/dist/client/Mppx.js +55 -13
- package/dist/client/Spend.d.ts +134 -0
- package/dist/client/Spend.js +58 -0
- package/dist/client/core.d.ts +2 -0
- package/dist/client/core.js +2 -0
- package/dist/client/internal/Fetch.d.ts +23 -3
- package/dist/client/internal/Fetch.js +155 -37
- package/dist/client/internal/FundsMoved.d.ts +9 -0
- package/dist/client/internal/FundsMoved.js +18 -0
- package/dist/client/internal/SpendGate.d.ts +136 -0
- package/dist/client/internal/SpendGate.js +608 -0
- package/dist/client/internal/SpendHooks.d.ts +42 -0
- package/dist/client/internal/SpendHooks.js +36 -0
- package/dist/client/internal/protocols/Mcp.d.ts +9 -0
- package/dist/client/internal/protocols/Mcp.js +27 -0
- package/dist/client/internal/protocols/Mpp.js +20 -3
- package/dist/client/internal/protocols/Shared.js +29 -3
- package/dist/evm/client/Charge.js +20 -8
- package/dist/extensions/identity/erc8004/server/index.d.ts +7 -1
- package/dist/extensions/identity/erc8004/server/index.js +13 -1
- package/dist/extensions/identity/link/client/index.js +57 -5
- package/dist/identity/Client.d.ts +7 -3
- package/dist/identity/Client.js +178 -13
- package/dist/identity/Types.d.ts +2 -1
- package/dist/integrations/x402/Negotiator.js +4 -1
- package/dist/integrations/x402/Solana.d.ts +75 -0
- package/dist/integrations/x402/Solana.js +143 -0
- package/dist/internal/challengeMeta.d.ts +17 -2
- package/dist/internal/challengeMeta.js +35 -7
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/mcp/client/McpClient.d.ts +6 -1
- package/dist/mcp/client/McpClient.js +48 -10
- package/dist/middlewares/express.d.ts +1 -1
- package/dist/server/Mppx.d.ts +12 -1
- package/dist/server/Mppx.js +58 -6
- package/dist/server/Request.d.ts +1 -1
- package/dist/server/Transport.js +46 -2
- package/dist/server/internal/host.js +5 -2
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/client/Charge.js +81 -17
- package/dist/tempo/server/Charge.d.ts +7 -1
- package/dist/tempo/server/Charge.js +98 -12
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/SessionManager.js +3 -0
- package/dist/x402/server/EvmCharge.js +3 -0
- package/package.json +1 -1
|
@@ -110,6 +110,9 @@ export function sessionManager(parameters) {
|
|
|
110
110
|
sessionOrigin = origin;
|
|
111
111
|
return origin;
|
|
112
112
|
}
|
|
113
|
+
// Spending options accept only charges, so a fetch that sets them cannot pay for sessions.
|
|
114
|
+
if (Fetch.spendConfigOf(config.fetch))
|
|
115
|
+
throw new TypeError('SessionManager: the fetch sets spending options (maxPayment, authorize, funders or tokens), which accept only charges. Pass a fetch without them.');
|
|
113
116
|
const inheritedIdentity = Fetch.identityOf(config.fetch);
|
|
114
117
|
const rawFetch = Fetch.unwrapFetch(config.fetch);
|
|
115
118
|
config.fetch = async (input, init) => {
|
|
@@ -163,6 +163,9 @@ export function createPath(config) {
|
|
|
163
163
|
respondChallenge(options, response) {
|
|
164
164
|
if (!response)
|
|
165
165
|
throw new Error('x402 path requires a base challenge response.');
|
|
166
|
+
// A rejection without a Challenge (403, or 400 for more than one credential) gets no offer.
|
|
167
|
+
if (!response.headers.has('WWW-Authenticate'))
|
|
168
|
+
return response;
|
|
166
169
|
const headers = new Headers(response.headers);
|
|
167
170
|
const request = options.challenge.request;
|
|
168
171
|
headers.set(x402_Types.paymentRequiredHeader, x402_Header.encodePaymentRequired({
|