@routedock/routedock 0.2.0 → 0.3.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/README.md +305 -0
- package/dist/MppSessionHandler-1EL8QBAn.d.cts +215 -0
- package/dist/MppSessionHandler-Bq4S-JTE.d.ts +215 -0
- package/dist/{ProviderRegistry-C50nyhaF.d.ts → ProviderRegistry-CA_TdREG.d.ts} +2 -2
- package/dist/{ProviderRegistry-BJ9oJLVz.d.cts → ProviderRegistry-D-0rqK0N.d.cts} +2 -2
- package/dist/{RouteDockClient-B1roCa8h.d.cts → RouteDockClient-Bh86bVly.d.ts} +23 -9
- package/dist/{RouteDockClient-BbkqjhMG.d.ts → RouteDockClient-go9aopfF.d.cts} +23 -9
- package/dist/{SessionReconciler-Dscw43F3.d.ts → SessionReconciler-Bw-PoBVl.d.ts} +14 -5
- package/dist/{SessionReconciler-bi0z2qtN.d.cts → SessionReconciler-Cz2nuOlJ.d.cts} +14 -5
- package/dist/{SessionStore-DvkZv8-E.d.ts → SessionStore-B4-Hi4H8.d.cts} +34 -2
- package/dist/{SessionStore-BpK8vv0L.d.cts → SessionStore-BaYiegP0.d.ts} +34 -2
- package/dist/client.cjs +429 -117
- package/dist/client.d.cts +9 -8
- package/dist/client.d.ts +9 -8
- package/dist/client.js +421 -119
- package/dist/index.cjs +652 -220
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +643 -221
- package/dist/{types-DmhmfLzP.d.cts → logger-D8_Q2ytp.d.cts} +58 -1
- package/dist/{types-DmhmfLzP.d.ts → logger-D8_Q2ytp.d.ts} +58 -1
- package/dist/provider/fastify.cjs +306 -89
- package/dist/provider/fastify.d.cts +9 -4
- package/dist/provider/fastify.d.ts +9 -4
- package/dist/provider/fastify.js +305 -88
- package/dist/provider/hono.cjs +286 -82
- package/dist/provider/hono.d.cts +9 -7
- package/dist/provider/hono.d.ts +9 -7
- package/dist/provider/hono.js +282 -78
- package/dist/provider.cjs +326 -98
- package/dist/provider.d.cts +14 -10
- package/dist/provider.d.ts +14 -10
- package/dist/provider.js +318 -98
- package/dist/react.cjs +407 -117
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +408 -118
- package/dist/{routedockMiddleware-BlDsHuPl.d.ts → routedockMiddleware-57gUaEMf.d.ts} +9 -4
- package/dist/{routedockMiddleware-D97A5ptQ.d.cts → routedockMiddleware-DlyLrxp7.d.cts} +9 -4
- package/dist/schema.cjs +40 -0
- package/dist/schema.js +40 -0
- package/dist/{sign-Dpj2Mp7k.d.ts → sign-AKH67sft.d.cts} +1 -1
- package/dist/{sign-CUf3rhTx.d.cts → sign-BEq-OsSq.d.ts} +1 -1
- package/dist/testing.cjs +6 -4
- package/dist/testing.d.cts +32 -13
- package/dist/testing.d.ts +32 -13
- package/dist/testing.js +6 -4
- package/package.json +2 -2
- package/dist/MppSessionHandler-B4TyD7Xg.d.cts +0 -121
- package/dist/MppSessionHandler-CLB5SzgN.d.ts +0 -121
|
@@ -8,6 +8,17 @@ import { Store } from 'mppx';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
type PaymentMode = 'x402' | 'mpp-charge' | 'mpp-session' | 'mpp-session-ws';
|
|
11
|
+
/** Payment asset configuration with optional mode/endpoint scoping */
|
|
12
|
+
interface AssetConfig {
|
|
13
|
+
/** Asset ticker symbol, e.g. "USDC" or "XLM" */
|
|
14
|
+
asset: string;
|
|
15
|
+
/** Stellar Asset Contract (SAC) address for this payment asset */
|
|
16
|
+
asset_contract: string;
|
|
17
|
+
/** Optional: restrict this asset to specific payment modes. If omitted, available for all modes. */
|
|
18
|
+
modes?: PaymentMode[];
|
|
19
|
+
/** Optional: restrict this asset to specific endpoints (by name). If omitted, available for all endpoints. */
|
|
20
|
+
endpoints?: string[];
|
|
21
|
+
}
|
|
11
22
|
/**
|
|
12
23
|
* Agent custody mode — declared in routedock.json when provider accepts ZK vault payers.
|
|
13
24
|
* `nulth` = Nulth proof-authorized account (the ZK-account primitive; formerly "covenant-zk").
|
|
@@ -105,6 +116,12 @@ interface RouteDockManifest {
|
|
|
105
116
|
asset: string;
|
|
106
117
|
/** Stellar Asset Contract (SAC) address for the payment asset */
|
|
107
118
|
asset_contract: string;
|
|
119
|
+
/**
|
|
120
|
+
* Payment assets accepted by this provider. Each asset can be scoped to specific
|
|
121
|
+
* modes and endpoints. When present, assets[0] must match the root-level
|
|
122
|
+
* asset and asset_contract.
|
|
123
|
+
*/
|
|
124
|
+
assets?: AssetConfig[];
|
|
108
125
|
/**
|
|
109
126
|
* Stellar address (G...) that receives payments. Used as the default
|
|
110
127
|
* recipient for all modes. Individual per-request modes (x402, mpp-charge)
|
|
@@ -407,4 +424,44 @@ interface SessionState {
|
|
|
407
424
|
/** Dispute status of a channel */
|
|
408
425
|
type DisputeStatus = 'open' | 'in-refund-window' | 'refundable' | 'settled';
|
|
409
426
|
|
|
410
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Structured logging hook shared by the client and provider adapters.
|
|
429
|
+
*
|
|
430
|
+
* The SDK used to write straight to `console` in a couple of dozen error
|
|
431
|
+
* paths, which is unusable on structured-logging runtimes (Cloudflare Workers,
|
|
432
|
+
* Datadog, …) and untestable without spying on `console`. Every internal
|
|
433
|
+
* diagnostic now goes through a {@link RouteDockLogger}, so a consumer can
|
|
434
|
+
* silence it, redirect it, or attach correlation fields.
|
|
435
|
+
*
|
|
436
|
+
* The default implementation is console-backed, so behaviour is unchanged when
|
|
437
|
+
* no logger is supplied.
|
|
438
|
+
*/
|
|
439
|
+
/** Severity of a log line. */
|
|
440
|
+
type RouteDockLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
441
|
+
/**
|
|
442
|
+
* Structured context attached to a log line, typically `{ error: err }`. Sinks
|
|
443
|
+
* receive the values unresolved, so a serialising sink must project non-JSON
|
|
444
|
+
* values such as `Error` itself.
|
|
445
|
+
*/
|
|
446
|
+
type RouteDockLogFields = Record<string, unknown>;
|
|
447
|
+
/**
|
|
448
|
+
* Consumer-supplied log sink.
|
|
449
|
+
*
|
|
450
|
+
* `fields` carries the structured payload (the error, the channel id, …) that
|
|
451
|
+
* a bare string would drop at the boundary.
|
|
452
|
+
*/
|
|
453
|
+
type RouteDockLogger = (level: RouteDockLogLevel, message: string, fields?: RouteDockLogFields) => void;
|
|
454
|
+
/**
|
|
455
|
+
* Default logger that forwards to the console at the matching level. Field
|
|
456
|
+
* values are spread as additional console arguments so `console.error(msg, err)`
|
|
457
|
+
* spies (and existing log shippers) keep seeing the raw error object.
|
|
458
|
+
*/
|
|
459
|
+
declare function createConsoleLogger(): RouteDockLogger;
|
|
460
|
+
/** Shared console-backed logger — the default when none is configured. */
|
|
461
|
+
declare const consoleLogger: RouteDockLogger;
|
|
462
|
+
/** Logger that discards every line. */
|
|
463
|
+
declare const noopLogger: RouteDockLogger;
|
|
464
|
+
/** Resolve an optional logger to a concrete sink, defaulting to `fallback`. */
|
|
465
|
+
declare function resolveLogger(logger: RouteDockLogger | undefined, fallback?: RouteDockLogger): RouteDockLogger;
|
|
466
|
+
|
|
467
|
+
export { type AssetConfig as A, DEFAULT_MAX_SESSION_DURATION_MS as D, type EndpointDescriptor as E, type PaymentMode as P, type RouteDockLogFields as R, type SLAConfig as S, type VaultMode as V, type DisputeStatus as a, type EstimateCostResult as b, type PaymentResult as c, type PreflightResult as d, type PricingConfig as e, type RouteDockLogLevel as f, type RouteDockLogger as g, type RouteDockManifest as h, type SessionCloseFailedPayload as i, type SessionCloseResult as j, type SessionEvent as k, type SessionEventPayloadMap as l, type SessionHandle as m, type SessionOptions as n, type SessionPricingConfig as o, type SessionState as p, type SessionStats as q, type SessionTimeoutPayload as r, type StreamOptions as s, consoleLogger as t, createConsoleLogger as u, noopLogger as v, resolveLogger as w };
|
|
@@ -8,6 +8,17 @@ import { Store } from 'mppx';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
type PaymentMode = 'x402' | 'mpp-charge' | 'mpp-session' | 'mpp-session-ws';
|
|
11
|
+
/** Payment asset configuration with optional mode/endpoint scoping */
|
|
12
|
+
interface AssetConfig {
|
|
13
|
+
/** Asset ticker symbol, e.g. "USDC" or "XLM" */
|
|
14
|
+
asset: string;
|
|
15
|
+
/** Stellar Asset Contract (SAC) address for this payment asset */
|
|
16
|
+
asset_contract: string;
|
|
17
|
+
/** Optional: restrict this asset to specific payment modes. If omitted, available for all modes. */
|
|
18
|
+
modes?: PaymentMode[];
|
|
19
|
+
/** Optional: restrict this asset to specific endpoints (by name). If omitted, available for all endpoints. */
|
|
20
|
+
endpoints?: string[];
|
|
21
|
+
}
|
|
11
22
|
/**
|
|
12
23
|
* Agent custody mode — declared in routedock.json when provider accepts ZK vault payers.
|
|
13
24
|
* `nulth` = Nulth proof-authorized account (the ZK-account primitive; formerly "covenant-zk").
|
|
@@ -105,6 +116,12 @@ interface RouteDockManifest {
|
|
|
105
116
|
asset: string;
|
|
106
117
|
/** Stellar Asset Contract (SAC) address for the payment asset */
|
|
107
118
|
asset_contract: string;
|
|
119
|
+
/**
|
|
120
|
+
* Payment assets accepted by this provider. Each asset can be scoped to specific
|
|
121
|
+
* modes and endpoints. When present, assets[0] must match the root-level
|
|
122
|
+
* asset and asset_contract.
|
|
123
|
+
*/
|
|
124
|
+
assets?: AssetConfig[];
|
|
108
125
|
/**
|
|
109
126
|
* Stellar address (G...) that receives payments. Used as the default
|
|
110
127
|
* recipient for all modes. Individual per-request modes (x402, mpp-charge)
|
|
@@ -407,4 +424,44 @@ interface SessionState {
|
|
|
407
424
|
/** Dispute status of a channel */
|
|
408
425
|
type DisputeStatus = 'open' | 'in-refund-window' | 'refundable' | 'settled';
|
|
409
426
|
|
|
410
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Structured logging hook shared by the client and provider adapters.
|
|
429
|
+
*
|
|
430
|
+
* The SDK used to write straight to `console` in a couple of dozen error
|
|
431
|
+
* paths, which is unusable on structured-logging runtimes (Cloudflare Workers,
|
|
432
|
+
* Datadog, …) and untestable without spying on `console`. Every internal
|
|
433
|
+
* diagnostic now goes through a {@link RouteDockLogger}, so a consumer can
|
|
434
|
+
* silence it, redirect it, or attach correlation fields.
|
|
435
|
+
*
|
|
436
|
+
* The default implementation is console-backed, so behaviour is unchanged when
|
|
437
|
+
* no logger is supplied.
|
|
438
|
+
*/
|
|
439
|
+
/** Severity of a log line. */
|
|
440
|
+
type RouteDockLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
441
|
+
/**
|
|
442
|
+
* Structured context attached to a log line, typically `{ error: err }`. Sinks
|
|
443
|
+
* receive the values unresolved, so a serialising sink must project non-JSON
|
|
444
|
+
* values such as `Error` itself.
|
|
445
|
+
*/
|
|
446
|
+
type RouteDockLogFields = Record<string, unknown>;
|
|
447
|
+
/**
|
|
448
|
+
* Consumer-supplied log sink.
|
|
449
|
+
*
|
|
450
|
+
* `fields` carries the structured payload (the error, the channel id, …) that
|
|
451
|
+
* a bare string would drop at the boundary.
|
|
452
|
+
*/
|
|
453
|
+
type RouteDockLogger = (level: RouteDockLogLevel, message: string, fields?: RouteDockLogFields) => void;
|
|
454
|
+
/**
|
|
455
|
+
* Default logger that forwards to the console at the matching level. Field
|
|
456
|
+
* values are spread as additional console arguments so `console.error(msg, err)`
|
|
457
|
+
* spies (and existing log shippers) keep seeing the raw error object.
|
|
458
|
+
*/
|
|
459
|
+
declare function createConsoleLogger(): RouteDockLogger;
|
|
460
|
+
/** Shared console-backed logger — the default when none is configured. */
|
|
461
|
+
declare const consoleLogger: RouteDockLogger;
|
|
462
|
+
/** Logger that discards every line. */
|
|
463
|
+
declare const noopLogger: RouteDockLogger;
|
|
464
|
+
/** Resolve an optional logger to a concrete sink, defaulting to `fallback`. */
|
|
465
|
+
declare function resolveLogger(logger: RouteDockLogger | undefined, fallback?: RouteDockLogger): RouteDockLogger;
|
|
466
|
+
|
|
467
|
+
export { type AssetConfig as A, DEFAULT_MAX_SESSION_DURATION_MS as D, type EndpointDescriptor as E, type PaymentMode as P, type RouteDockLogFields as R, type SLAConfig as S, type VaultMode as V, type DisputeStatus as a, type EstimateCostResult as b, type PaymentResult as c, type PreflightResult as d, type PricingConfig as e, type RouteDockLogLevel as f, type RouteDockLogger as g, type RouteDockManifest as h, type SessionCloseFailedPayload as i, type SessionCloseResult as j, type SessionEvent as k, type SessionEventPayloadMap as l, type SessionHandle as m, type SessionOptions as n, type SessionPricingConfig as o, type SessionState as p, type SessionStats as q, type SessionTimeoutPayload as r, type StreamOptions as s, consoleLogger as t, createConsoleLogger as u, noopLogger as v, resolveLogger as w };
|