mppx 0.21.1 → 0.21.2

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.
Files changed (130) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/Errors.d.ts +55 -0
  3. package/dist/Errors.js +48 -0
  4. package/dist/Html.d.ts +1 -1
  5. package/dist/Html.js +2 -2
  6. package/dist/Method.d.ts +1 -1
  7. package/dist/cli/cli.js +138 -138
  8. package/dist/cli/internal.js +1 -1
  9. package/dist/cli/plugins/evm.js +1 -1
  10. package/dist/cli/plugins/index.js +13 -13
  11. package/dist/cli/plugins/x402.js +1 -1
  12. package/dist/cli/utils.d.ts +2 -45
  13. package/dist/cli/utils.js +2 -79
  14. package/dist/cli/validate/index.js +5 -2
  15. package/dist/cli/validate/payment.d.ts +1 -1
  16. package/dist/cli/validate/payment.js +3 -3
  17. package/dist/cli/validate/print.d.ts +12 -0
  18. package/dist/cli/validate/print.js +35 -0
  19. package/dist/client/core.d.ts +6 -0
  20. package/dist/client/core.js +6 -0
  21. package/dist/client/index.d.ts +2 -8
  22. package/dist/client/index.js +2 -6
  23. package/dist/client/internal/protocols/Shared.js +1 -1
  24. package/dist/client/internal/protocols/X402.js +3 -3
  25. package/dist/evm/client/Charge.js +1 -1
  26. package/dist/evm/index.d.ts +1 -1
  27. package/dist/evm/server/Charge.js +1 -1
  28. package/dist/integrations/x402/Evm.js +1 -1
  29. package/dist/integrations/x402/Negotiator.js +1 -1
  30. package/dist/internal/AcceptPayment.js +1 -1
  31. package/dist/internal/CredentialExpiry.js +1 -1
  32. package/dist/{mcp/internal/Credential.d.ts → internal/McpCredential.d.ts} +2 -2
  33. package/dist/{mcp/internal/Credential.js → internal/McpCredential.js} +2 -2
  34. package/dist/{server/internal → internal}/challengeMeta.js +1 -1
  35. package/dist/{server/internal → internal}/html/config.d.ts +2 -2
  36. package/dist/internal/pc.d.ts +46 -0
  37. package/dist/internal/pc.js +80 -0
  38. package/dist/internal/version.d.ts +2 -2
  39. package/dist/internal/version.js +1 -1
  40. package/dist/{x402 → internal/x402}/Header.js +1 -1
  41. package/dist/{x402 → internal/x402}/Siwx.d.ts +2 -2
  42. package/dist/{x402 → internal/x402}/Siwx.js +2 -2
  43. package/dist/{x402 → internal/x402}/Types.d.ts +1 -1
  44. package/dist/{x402 → internal/x402}/Types.js +1 -1
  45. package/dist/mcp/server/index.d.ts +1 -1
  46. package/dist/mcp/server/index.js +1 -1
  47. package/dist/server/Mppx.d.ts +1 -1
  48. package/dist/server/Mppx.js +6 -6
  49. package/dist/server/Transport.d.ts +2 -2
  50. package/dist/server/Transport.js +4 -4
  51. package/dist/server/index.d.ts +1 -8
  52. package/dist/server/index.js +1 -8
  53. package/dist/{mcp/server/Transport.d.ts → server/internal/mcpSdk.d.ts} +2 -2
  54. package/dist/{mcp/server/Transport.js → server/internal/mcpSdk.js} +3 -3
  55. package/dist/stripe/server/Charge.d.ts +1 -1
  56. package/dist/stripe/server/internal/html.gen.js +1 -1
  57. package/dist/tempo/Methods.d.ts +3 -0
  58. package/dist/tempo/Methods.js +3 -1
  59. package/dist/tempo/client/Charge.js +1 -1
  60. package/dist/tempo/client/Methods.d.ts +3 -0
  61. package/dist/tempo/client/index.d.ts +3 -0
  62. package/dist/tempo/client/index.js +1 -0
  63. package/dist/tempo/internal/configurable-account.d.ts +26 -0
  64. package/dist/tempo/internal/configurable-account.js +77 -0
  65. package/dist/tempo/internal/signature.d.ts +15 -0
  66. package/dist/tempo/internal/signature.js +43 -0
  67. package/dist/tempo/server/Charge.d.ts +1 -1
  68. package/dist/tempo/server/Charge.js +1 -1
  69. package/dist/tempo/server/Methods.d.ts +139 -4
  70. package/dist/tempo/server/internal/html.gen.js +1 -1
  71. package/dist/tempo/session/client/ChannelOps.d.ts +29 -0
  72. package/dist/tempo/session/client/ChannelOps.js +108 -3
  73. package/dist/tempo/session/client/CredentialState.d.ts +6 -0
  74. package/dist/tempo/session/client/CredentialState.js +29 -4
  75. package/dist/tempo/session/client/Session.d.ts +3 -0
  76. package/dist/tempo/session/client/SessionManager.js +4 -0
  77. package/dist/tempo/session/precompile/Chain.d.ts +35 -1
  78. package/dist/tempo/session/precompile/Chain.js +52 -0
  79. package/dist/tempo/session/precompile/Voucher.d.ts +46 -5
  80. package/dist/tempo/session/precompile/Voucher.js +78 -29
  81. package/dist/tempo/session/precompile/escrow.abi.d.ts +79 -0
  82. package/dist/tempo/session/precompile/escrow.abi.js +38 -0
  83. package/dist/tempo/session/server/ChannelStore.d.ts +27 -0
  84. package/dist/tempo/session/server/ChannelStore.js +24 -3
  85. package/dist/tempo/session/server/CredentialVerification.d.ts +7 -1
  86. package/dist/tempo/session/server/CredentialVerification.js +91 -12
  87. package/dist/tempo/session/server/RequestState.d.ts +2 -0
  88. package/dist/tempo/session/server/RequestState.js +1 -0
  89. package/dist/tempo/session/server/Session.d.ts +11 -0
  90. package/dist/tempo/session/server/Session.js +10 -2
  91. package/dist/tempo/session/server/SponsorshipLimit.d.ts +11 -3
  92. package/dist/tempo/session/server/SponsorshipLimit.js +36 -4
  93. package/dist/tempo/subscription/KeyAuthorization.js +6 -2
  94. package/dist/{cli/validate → validation}/challenge.d.ts +1 -1
  95. package/dist/{cli/validate → validation}/challenge.js +4 -4
  96. package/dist/validation/core.d.ts +29 -2
  97. package/dist/validation/core.js +41 -10
  98. package/dist/{cli/validate → validation}/helpers.d.ts +0 -10
  99. package/dist/{cli/validate → validation}/helpers.js +1 -35
  100. package/dist/validation/index.d.ts +2 -2
  101. package/dist/validation/index.js +1 -1
  102. package/dist/x402/Assets.d.ts +1 -1
  103. package/dist/x402/client/Exact.d.ts +1 -1
  104. package/dist/x402/client/Exact.js +2 -2
  105. package/dist/x402/index.d.ts +4 -4
  106. package/dist/x402/index.js +4 -4
  107. package/dist/x402/internal/RouteBinding.d.ts +1 -1
  108. package/dist/x402/mcp.js +2 -2
  109. package/dist/x402/server/EvmCharge.d.ts +2 -2
  110. package/dist/x402/server/EvmCharge.js +4 -4
  111. package/dist/x402/server/Facilitator.d.ts +1 -1
  112. package/dist/x402/server/Facilitator.js +1 -1
  113. package/package.json +13 -1
  114. /package/dist/{server/internal → internal}/challengeMeta.d.ts +0 -0
  115. /package/dist/{server/internal → internal}/html/compose.main.gen.d.ts +0 -0
  116. /package/dist/{server/internal → internal}/html/compose.main.gen.js +0 -0
  117. /package/dist/{server/internal → internal}/html/config.js +0 -0
  118. /package/dist/{server/internal → internal}/html/constants.d.ts +0 -0
  119. /package/dist/{server/internal → internal}/html/constants.js +0 -0
  120. /package/dist/{server/internal → internal}/html/serviceWorker.client.d.ts +0 -0
  121. /package/dist/{server/internal → internal}/html/serviceWorker.client.js +0 -0
  122. /package/dist/{server/internal → internal}/html/serviceWorker.gen.d.ts +0 -0
  123. /package/dist/{server/internal → internal}/html/serviceWorker.gen.js +0 -0
  124. /package/dist/{x402/internal → internal/x402}/ChallengeBrand.d.ts +0 -0
  125. /package/dist/{x402/internal → internal/x402}/ChallengeBrand.js +0 -0
  126. /package/dist/{x402 → internal/x402}/Header.d.ts +0 -0
  127. /package/dist/{cli/validate → validation}/discovery.d.ts +0 -0
  128. /package/dist/{cli/validate → validation}/discovery.js +0 -0
  129. /package/dist/{cli/validate → validation}/messages.d.ts +0 -0
  130. /package/dist/{cli/validate → validation}/messages.js +0 -0
@@ -27,16 +27,6 @@ export declare function check(label: string, detail?: string): CheckResult;
27
27
  export declare function fail(label: string, detail?: string, hint?: string): CheckResult;
28
28
  export declare function warn(label: string, detail?: string, hint?: string): CheckResult;
29
29
  export declare function skip(label: string, detail?: string, hint?: string): CheckResult;
30
- export declare function printCheck(result: CheckResult): void;
31
- export declare function printSection(title: string): void;
32
- export type Counts = {
33
- passed: number;
34
- failed: number;
35
- warnings: number;
36
- suggested: number;
37
- skipped: number;
38
- };
39
- export declare function printResults(results: CheckResult[], counts: Counts): void;
40
30
  /** Fetches a validation target without automatic payments or redirected probes. */
41
31
  export declare function fetchWithTimeout(url: RequestInfo | URL, init: RequestInit, timeoutMs?: number): Promise<Response>;
42
32
  export declare function formatBytes(bytes: number): string;
@@ -1,5 +1,4 @@
1
- import { identityOf, skipPayment, unwrapFetch } from '../../client/internal/Fetch.js';
2
- import { pc } from '../utils.js';
1
+ import { identityOf, skipPayment, unwrapFetch } from '../client/internal/Fetch.js';
3
2
  export function check(label, detail) {
4
3
  return detail ? { label, detail, severity: 'pass' } : { label, severity: 'pass' };
5
4
  }
@@ -25,39 +24,6 @@ export function skip(label, detail, hint) {
25
24
  r.hint = hint;
26
25
  return r;
27
26
  }
28
- const SEVERITY_ICONS = {
29
- pass: pc.green('✓'),
30
- fail: pc.red('✗'),
31
- warn: pc.yellow('⚠'),
32
- suggested: pc.cyan('◇'),
33
- skip: pc.dim('○'),
34
- };
35
- export function printCheck(result) {
36
- const icon = SEVERITY_ICONS[result.severity];
37
- const text = result.detail ? `${result.label} (${result.detail})` : result.label;
38
- console.log(` ${icon} ${text}`);
39
- if (result.hint && result.severity !== 'pass') {
40
- console.log(pc.dim(` → ${result.hint}`));
41
- }
42
- }
43
- export function printSection(title) {
44
- console.log(`\n${pc.bold(title)}`);
45
- }
46
- export function printResults(results, counts) {
47
- for (const result of results) {
48
- printCheck(result);
49
- if (result.severity === 'pass')
50
- counts.passed++;
51
- else if (result.severity === 'fail')
52
- counts.failed++;
53
- else if (result.severity === 'warn')
54
- counts.warnings++;
55
- else if (result.severity === 'suggested')
56
- counts.suggested++;
57
- else if (result.severity === 'skip')
58
- counts.skipped++;
59
- }
60
- }
61
27
  /** Fetches a validation target without automatic payments or redirected probes. */
62
28
  export async function fetchWithTimeout(url, init, timeoutMs = 15_000) {
63
29
  const controller = new AbortController();
@@ -1,3 +1,3 @@
1
- export { buildUrl, validate, validateStream } from './core.js';
2
- export type { CheckResult, DiscoveryResult, EndpointSpec, EndpointValidationResult, PathParameter, ValidateEvent, ValidateOptions, ValidateResult, } from './core.js';
1
+ export { buildUrl, paymentSuccessLabel, validate, validateStream } from './core.js';
2
+ export type { CheckResult, DiscoveryResult, EndpointSpec, EndpointValidationResult, PathParameter, PaymentValidation, PaymentValidator, ValidateEvent, ValidateOptions, ValidateResult, } from './core.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { buildUrl, validate, validateStream } from './core.js';
1
+ export { buildUrl, paymentSuccessLabel, validate, validateStream } from './core.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Token } from 'viem/tokens';
2
2
  import * as Currency_ from '../Currency.js';
3
- import type { Asset, EvmNetwork, ExactTransfer } from './Types.js';
3
+ import type { Asset, EvmNetwork, ExactTransfer } from '../internal/x402/Types.js';
4
4
  declare const knownAsset: unique symbol;
5
5
  /**
6
6
  * Known x402 asset metadata: a token resolved to one chain, as `ousd(4217)` is, with the
@@ -1,7 +1,7 @@
1
1
  import type { Account } from 'viem';
2
2
  import type * as Challenge from '../../Challenge.js';
3
+ import * as Types from '../../internal/x402/Types.js';
3
4
  import * as Assets from '../Assets.js';
4
- import * as Types from '../Types.js';
5
5
  /**
6
6
  * Creates an x402 exact `PAYMENT-SIGNATURE` credential.
7
7
  */
@@ -1,8 +1,8 @@
1
1
  import { getAddress, parseUnits } from 'viem';
2
+ import * as Header from '../../internal/x402/Header.js';
3
+ import * as Types from '../../internal/x402/Types.js';
2
4
  import * as Assets from '../Assets.js';
3
- import * as Header from '../Header.js';
4
5
  import * as RouteBinding from '../internal/RouteBinding.js';
5
- import * as Types from '../Types.js';
6
6
  /**
7
7
  * Creates an x402 exact `PAYMENT-SIGNATURE` credential.
8
8
  */
@@ -1,8 +1,8 @@
1
1
  /** @deprecated Use `assets` instead. */
2
2
  export * as Assets from './Assets.js';
3
- export * as Header from './Header.js';
4
- export * as Siwx from './Siwx.js';
5
- export * as Types from './Types.js';
3
+ export * as Header from '../internal/x402/Header.js';
4
+ export * as Siwx from '../internal/x402/Siwx.js';
5
+ export * as Types from '../internal/x402/Types.js';
6
6
  export * as assets from './Assets.js';
7
- export * from './Types.js';
7
+ export * from '../internal/x402/Types.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
1
  /** @deprecated Use `assets` instead. */
2
2
  export * as Assets from './Assets.js';
3
- export * as Header from './Header.js';
4
- export * as Siwx from './Siwx.js';
5
- export * as Types from './Types.js';
3
+ export * as Header from '../internal/x402/Header.js';
4
+ export * as Siwx from '../internal/x402/Siwx.js';
5
+ export * as Types from '../internal/x402/Types.js';
6
6
  export * as assets from './Assets.js';
7
- export * from './Types.js';
7
+ export * from '../internal/x402/Types.js';
8
8
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type * as Types from '../Types.js';
1
+ import type * as Types from '../../internal/x402/Types.js';
2
2
  /** Computes the route-bound EIP-3009 nonce for an x402 exact payment. */
3
3
  export declare function nonce(parameters: {
4
4
  accepted: Types.PaymentRequirements;
package/dist/x402/mcp.js CHANGED
@@ -4,10 +4,10 @@ import { createPaymentWrapper, MCP_PAYMENT_META_KEY, } from '@x402/mcp';
4
4
  import * as Challenge from '../Challenge.js';
5
5
  import * as Errors from '../Errors.js';
6
6
  import * as Negotiator from '../integrations/x402/Negotiator.js';
7
+ import * as McpCredential from '../internal/McpCredential.js';
8
+ import { paymentRequiredHeader } from '../internal/x402/Types.js';
7
9
  import * as Mcp from '../Mcp.js';
8
- import * as McpCredential from '../mcp/internal/Credential.js';
9
10
  import * as Receipt from '../Receipt.js';
10
- import { paymentRequiredHeader } from './Types.js';
11
11
  /**
12
12
  * Creates an MCP tool wrapper that accepts both MPP and x402 payment metadata.
13
13
  *
@@ -1,8 +1,8 @@
1
1
  import type * as Credential from '../../Credential.js';
2
2
  import * as Types from '../../evm/Types.js';
3
+ import * as Siwx from '../../internal/x402/Siwx.js';
4
+ import * as x402_Types from '../../internal/x402/Types.js';
3
5
  import * as ServerTransport from '../../server/Transport.js';
4
- import * as Siwx from '../Siwx.js';
5
- import * as x402_Types from '../Types.js';
6
6
  export type Options = {
7
7
  /**
8
8
  * Extra fields added to every x402 payment requirement's `extra`, for facilitators that read
@@ -6,13 +6,13 @@ import * as Challenge from '../../Challenge.js';
6
6
  import * as Credential_ from '../../Credential.js';
7
7
  import { VerificationFailedError } from '../../Errors.js';
8
8
  import * as Types from '../../evm/Types.js';
9
+ import * as ChallengeMeta from '../../internal/challengeMeta.js';
10
+ import * as x402_Header from '../../internal/x402/Header.js';
11
+ import * as Siwx from '../../internal/x402/Siwx.js';
12
+ import * as x402_Types from '../../internal/x402/Types.js';
9
13
  import * as PaymentRequest from '../../PaymentRequest.js';
10
- import * as ChallengeMeta from '../../server/internal/challengeMeta.js';
11
14
  import * as Scope from '../../server/internal/scope.js';
12
- import * as x402_Header from '../Header.js';
13
15
  import * as x402_RouteBinding from '../internal/RouteBinding.js';
14
- import * as Siwx from '../Siwx.js';
15
- import * as x402_Types from '../Types.js';
16
16
  import * as x402_Facilitator from './Facilitator.js';
17
17
  const pendingX402Credential = Symbol('mppx.evm.pendingX402Credential');
18
18
  const x402Credential = Symbol('mppx.evm.x402Credential');
@@ -1,4 +1,4 @@
1
- import * as Types from '../Types.js';
1
+ import * as Types from '../../internal/x402/Types.js';
2
2
  /** Headers to send with facilitator requests: a flat record, or one keyed by path. */
3
3
  export type FacilitatorHeaders = Types.FacilitatorHeaders;
4
4
  export type HttpOptions = {
@@ -1,6 +1,6 @@
1
1
  import { getAddress } from 'viem';
2
2
  import { FacilitatorResponseError } from '../../Errors.js';
3
- import * as Types from '../Types.js';
3
+ import * as Types from '../../internal/x402/Types.js';
4
4
  const mppxFetchWrapper = Symbol.for('mppx.fetch.wrapper');
5
5
  /**
6
6
  * Resolves an x402 facilitator URL, `{ url, headers }` config or client into a
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mppx",
3
3
  "type": "module",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "main": "./dist/index.js",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/wevm/mppx#readme",
@@ -31,6 +31,10 @@
31
31
  "types": "./dist/client/index.d.ts",
32
32
  "default": "./dist/client/index.js"
33
33
  },
34
+ "./client/core": {
35
+ "types": "./dist/client/core.d.ts",
36
+ "default": "./dist/client/core.js"
37
+ },
34
38
  "./client/node": {
35
39
  "types": "./dist/client/node.d.ts",
36
40
  "default": "./dist/client/node.js"
@@ -131,6 +135,14 @@
131
135
  "types": "./dist/tempo/index.d.ts",
132
136
  "default": "./dist/tempo/index.js"
133
137
  },
138
+ "./tempo/client": {
139
+ "types": "./dist/tempo/client/index.d.ts",
140
+ "default": "./dist/tempo/client/index.js"
141
+ },
142
+ "./tempo/server": {
143
+ "types": "./dist/tempo/server/index.d.ts",
144
+ "default": "./dist/tempo/server/index.js"
145
+ },
134
146
  "./extensions/identity": {
135
147
  "types": "./dist/extensions/identity/index.d.ts",
136
148
  "default": "./dist/extensions/identity/index.js"
File without changes
File without changes
File without changes
File without changes