@unbrowse/sdk 11.7.0 → 12.0.0-preview.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.
- package/README.md +60 -34
- package/dist/client.d.ts +122 -183
- package/dist/index.d.ts +4 -11
- package/dist/index.js +186 -6
- package/dist/mcp-install.d.ts +9 -0
- package/dist/types.d.ts +122 -0
- package/package.json +17 -32
- package/LICENSE +0 -21
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -503
- package/dist/client.js.map +0 -1
- package/dist/contracts.d.ts +0 -478
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -2
- package/dist/contracts.js.map +0 -1
- package/dist/errors.d.ts +0 -52
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -76
- package/dist/errors.js.map +0 -1
- package/dist/flex.d.ts +0 -254
- package/dist/flex.d.ts.map +0 -1
- package/dist/flex.js +0 -396
- package/dist/flex.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/runtime.d.ts +0 -78
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -339
- package/dist/runtime.js.map +0 -1
- package/dist/server-types.d.ts +0 -97
- package/dist/server-types.d.ts.map +0 -1
- package/dist/server-types.js +0 -2
- package/dist/server-types.js.map +0 -1
- package/dist/x402.d.ts +0 -75
- package/dist/x402.d.ts.map +0 -1
- package/dist/x402.js +0 -29
- package/dist/x402.js.map +0 -1
package/dist/x402.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,eAAe,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,CAAC,CAAC,CAKZ"}
|
package/dist/x402.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* x402 payment primitives — typed shapes the SDK and a wallet agree on.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the canonical x402 protocol shape (resource-URL flavor) so a generic
|
|
5
|
-
* x402 wallet client can sign these without an Unbrowse-specific adapter. The
|
|
6
|
-
* backend (`backend/src/middleware/x402-gate.ts:X402PaymentRequirementV2`) is
|
|
7
|
-
* the producer; this is the consumer-side declaration.
|
|
8
|
-
*
|
|
9
|
-
* IMPORTANT: this file MUST NOT import from `./client.js` — keep payment
|
|
10
|
-
* helpers tree-shakeable so callers who do not pay can drop the wallet code.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Settle a `PaymentRequiredError` with the given wallet and replay the
|
|
14
|
-
* request via `retry(paymentHeader)`. Picks the first acceptable
|
|
15
|
-
* requirement from `error.accepts`; the wallet decides whether to sign or
|
|
16
|
-
* reject. If `error.accepts` is empty, the original error propagates.
|
|
17
|
-
*
|
|
18
|
-
* Dep-light by design: no signing libs, no fetch deps — the wallet does
|
|
19
|
-
* the cryptography. The retry's failure (including a second 402)
|
|
20
|
-
* propagates unchanged.
|
|
21
|
-
*/
|
|
22
|
-
export async function payAndRetry(error, wallet, retry) {
|
|
23
|
-
const requirement = error.accepts?.[0];
|
|
24
|
-
if (!requirement)
|
|
25
|
-
throw error;
|
|
26
|
-
const paymentHeader = await wallet.signX402Payload(requirement);
|
|
27
|
-
return retry(paymentHeader);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=x402.js.map
|
package/dist/x402.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402.js","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA0DH;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAA2B,EAC3B,MAAkB,EAClB,KAA4C;IAE5C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,CAAC,WAAW;QAAE,MAAM,KAAK,CAAC;IAC9B,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAChE,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC"}
|