@routedock/routedock 0.1.1 → 0.2.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/LICENSE +21 -0
- package/README.md +281 -19
- package/dist/MppSessionHandler-B4TyD7Xg.d.cts +121 -0
- package/dist/MppSessionHandler-CLB5SzgN.d.ts +121 -0
- package/dist/ProviderRegistry-BJ9oJLVz.d.cts +142 -0
- package/dist/ProviderRegistry-C50nyhaF.d.ts +142 -0
- package/dist/RouteDockClient-B1roCa8h.d.cts +455 -0
- package/dist/RouteDockClient-BbkqjhMG.d.ts +455 -0
- package/dist/SessionReconciler-Dscw43F3.d.ts +125 -0
- package/dist/SessionReconciler-bi0z2qtN.d.cts +125 -0
- package/dist/SessionStore-BpK8vv0L.d.cts +111 -0
- package/dist/SessionStore-DvkZv8-E.d.ts +111 -0
- package/dist/client.cjs +2419 -202
- package/dist/client.d.cts +50 -81
- package/dist/client.d.ts +50 -81
- package/dist/client.js +2373 -203
- package/dist/index.cjs +3080 -298
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +3026 -298
- package/dist/provider/fastify.cjs +882 -0
- package/dist/provider/fastify.d.cts +35 -0
- package/dist/provider/fastify.d.ts +35 -0
- package/dist/provider/fastify.js +880 -0
- package/dist/provider/hono.cjs +948 -0
- package/dist/provider/hono.d.cts +99 -0
- package/dist/provider/hono.d.ts +99 -0
- package/dist/provider/hono.js +938 -0
- package/dist/provider.cjs +827 -97
- package/dist/provider.d.cts +32 -25
- package/dist/provider.d.ts +32 -25
- package/dist/provider.js +810 -99
- package/dist/react.cjs +2641 -0
- package/dist/react.d.cts +107 -0
- package/dist/react.d.ts +107 -0
- package/dist/react.js +2634 -0
- package/dist/routedockMiddleware-BlDsHuPl.d.ts +59 -0
- package/dist/routedockMiddleware-D97A5ptQ.d.cts +59 -0
- package/dist/schema.cjs +364 -0
- package/dist/schema.d.cts +3 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.js +359 -0
- package/dist/sign-CUf3rhTx.d.cts +53 -0
- package/dist/sign-Dpj2Mp7k.d.ts +53 -0
- package/dist/testing.cjs +57 -0
- package/dist/testing.d.cts +95 -0
- package/dist/testing.d.ts +95 -0
- package/dist/testing.js +54 -0
- package/dist/types-DmhmfLzP.d.cts +410 -0
- package/dist/types-DmhmfLzP.d.ts +410 -0
- package/package.json +143 -23
- package/PUBLISH_CHECKLIST.md +0 -70
- package/dist/SessionStore-CCVO0PHM.d.cts +0 -152
- package/dist/SessionStore-CCVO0PHM.d.ts +0 -152
- package/dist/routedockMiddleware-B7WTB3LT.d.cts +0 -53
- package/dist/routedockMiddleware-DRgdrycG.d.ts +0 -53
- package/src/client/ModeRouter.ts +0 -104
- package/src/client/MppChargeClient.ts +0 -44
- package/src/client/MppSessionClient.ts +0 -144
- package/src/client/RouteDockClient.ts +0 -124
- package/src/client/index.ts +0 -8
- package/src/client/x402Client.ts +0 -84
- package/src/index.ts +0 -9
- package/src/provider/MppChargeHandler.ts +0 -90
- package/src/provider/MppSessionHandler.ts +0 -157
- package/src/provider/index.ts +0 -7
- package/src/provider/routedockMiddleware.ts +0 -154
- package/src/provider/x402Handler.ts +0 -164
- package/src/schemas/routedock.schema.json +0 -159
- package/src/store/SessionStore.ts +0 -90
- package/src/tests/smoke.test.ts +0 -228
- package/src/types.ts +0 -165
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -15
package/dist/provider.d.cts
CHANGED
|
@@ -1,46 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { R as RouteDockMiddlewareOptions, r as routedock } from './routedockMiddleware-
|
|
1
|
+
import { R as RouteDockManifest } from './types-DmhmfLzP.cjs';
|
|
2
|
+
export { D as DEFAULT_MAX_SESSION_DURATION_MS, a as DisputeStatus, E as EndpointDescriptor, b as EstimateCostResult, P as PaymentMode, c as PaymentResult, d as PreflightResult, e as PricingConfig, S as SLAConfig, f as SessionCloseFailedPayload, g as SessionCloseResult, h as SessionEvent, i as SessionEventPayloadMap, j as SessionHandle, k as SessionOptions, l as SessionPricingConfig, m as SessionState, n as SessionStats, o as SessionTimeoutPayload, p as StreamOptions, V as VaultMode } from './types-DmhmfLzP.cjs';
|
|
3
|
+
export { R as RouteDockMiddlewareOptions, r as routedock } from './routedockMiddleware-D97A5ptQ.cjs';
|
|
4
4
|
import { RequestHandler } from 'express';
|
|
5
|
+
import { S as SeenTxStore } from './MppSessionHandler-B4TyD7Xg.cjs';
|
|
6
|
+
export { C as ChannelStore, I as InMemorySeenTxStore, b as InMemorySeenTxStoreOptions, M as MppSessionHandlerOptions, c as OrphanReason, O as OrphanedSessionInfo, a as SettlementRecord, V as VoucherStoreValue, d as createMppSessionHandler, i as isVoucherStoreValue, p as paymentIdempotencyKey } from './MppSessionHandler-B4TyD7Xg.cjs';
|
|
7
|
+
import { S as SessionStore } from './SessionStore-BpK8vv0L.cjs';
|
|
8
|
+
export { R as RouteDockChannelStateError, a as RouteDockClientVersionError, b as RouteDockDisputeError, c as RouteDockError, f as RouteDockFacilitatorError, g as RouteDockManifestError, j as RouteDockNetworkError, k as RouteDockNoSupportedModeError, l as RouteDockPolicyRejectError, m as RouteDockPolicyRejectedError, n as RouteDockRefundWindowError, o as RouteDockSessionError, p as RouteDockSignatureError, q as RouteDockTrustlineError, r as RouteDockVoucherMonotonicityError, s as SupabaseSessionStore } from './SessionStore-BpK8vv0L.cjs';
|
|
9
|
+
export { R as ReconciliationStats, a as RegisterProviderOptions, S as SessionReconcilerOptions, b as SupabaseSeenTxStore, d as decimalToStroops, r as reconcileAbandonedSessions, c as registerProvider, e as runStartupReconciliation } from './SessionReconciler-bi0z2qtN.cjs';
|
|
10
|
+
import 'mppx';
|
|
5
11
|
import '@supabase/supabase-js';
|
|
12
|
+
import '@stellar/stellar-sdk';
|
|
6
13
|
|
|
7
|
-
type Network$
|
|
14
|
+
type Network$1 = 'testnet' | 'mainnet';
|
|
8
15
|
interface X402HandlerOptions {
|
|
9
16
|
payeeSecretKey: string;
|
|
10
|
-
network: Network$
|
|
17
|
+
network: Network$1;
|
|
11
18
|
amount: string;
|
|
12
19
|
assetContract: string;
|
|
13
20
|
facilitatorApiKey?: string;
|
|
14
21
|
manifest: RouteDockManifest;
|
|
15
|
-
onSettled?: (txHash: string, amount: string, mode: string) => Promise<void>;
|
|
22
|
+
onSettled?: (txHash: string, amount: string, mode: string, payer: string | null) => Promise<void>;
|
|
23
|
+
onCallbackError?: (err: unknown, cb: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Idempotency store guarding against duplicate settlement when an agent
|
|
26
|
+
* retries the same signed payment. Defaults to a per-handler in-memory store.
|
|
27
|
+
*/
|
|
28
|
+
seenTxStore?: SeenTxStore;
|
|
16
29
|
}
|
|
17
30
|
declare function createX402Handler(opts: X402HandlerOptions): RequestHandler;
|
|
18
31
|
|
|
19
|
-
type Network
|
|
32
|
+
type Network = 'testnet' | 'mainnet';
|
|
20
33
|
interface MppChargeHandlerOptions {
|
|
21
34
|
payeeSecretKey: string;
|
|
22
|
-
network: Network
|
|
35
|
+
network: Network;
|
|
23
36
|
amount: string;
|
|
24
37
|
assetContract: string;
|
|
25
38
|
manifest: RouteDockManifest;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Ignored. Charge mode opens no channel, so there is nothing for a session store to hold.
|
|
41
|
+
*/
|
|
26
42
|
store?: SessionStore;
|
|
27
|
-
onSettled?: (txHash: string, amount: string, mode: string) => Promise<void>;
|
|
43
|
+
onSettled?: (txHash: string, amount: string, mode: string, payer: string | null) => Promise<void>;
|
|
44
|
+
onCallbackError?: (err: unknown, cb: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Idempotency store guarding against duplicate settlement when an agent
|
|
47
|
+
* retries the same signed charge. Defaults to a per-handler in-memory store.
|
|
48
|
+
*/
|
|
49
|
+
seenTxStore?: SeenTxStore;
|
|
28
50
|
}
|
|
29
51
|
declare function createMppChargeHandler(opts: MppChargeHandlerOptions): RequestHandler;
|
|
30
52
|
|
|
31
|
-
type
|
|
32
|
-
interface MppSessionHandlerOptions {
|
|
33
|
-
payeeSecretKey: string;
|
|
34
|
-
network: Network;
|
|
35
|
-
channelContract: string;
|
|
36
|
-
rate: string;
|
|
37
|
-
assetContract: string;
|
|
38
|
-
manifest: RouteDockManifest;
|
|
39
|
-
commitmentPublicKey: string;
|
|
40
|
-
onSettled?: (txHash: string, totalPaid: string, mode: string) => Promise<void>;
|
|
41
|
-
onSessionOpen?: (channelId: string) => Promise<void>;
|
|
42
|
-
onVoucher?: (voucherIndex: number, cumulativeAmount: string) => Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
declare function createMppSessionHandler(opts: MppSessionHandlerOptions): RequestHandler;
|
|
45
|
-
|
|
46
|
-
export { type MppChargeHandlerOptions, type MppSessionHandlerOptions, RouteDockManifest, SessionStore, type X402HandlerOptions, createMppChargeHandler, createMppSessionHandler, createX402Handler };
|
|
53
|
+
export { type MppChargeHandlerOptions, RouteDockManifest, SeenTxStore, SessionStore, type X402HandlerOptions, createMppChargeHandler, createX402Handler };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,46 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { R as RouteDockMiddlewareOptions, r as routedock } from './routedockMiddleware-
|
|
1
|
+
import { R as RouteDockManifest } from './types-DmhmfLzP.js';
|
|
2
|
+
export { D as DEFAULT_MAX_SESSION_DURATION_MS, a as DisputeStatus, E as EndpointDescriptor, b as EstimateCostResult, P as PaymentMode, c as PaymentResult, d as PreflightResult, e as PricingConfig, S as SLAConfig, f as SessionCloseFailedPayload, g as SessionCloseResult, h as SessionEvent, i as SessionEventPayloadMap, j as SessionHandle, k as SessionOptions, l as SessionPricingConfig, m as SessionState, n as SessionStats, o as SessionTimeoutPayload, p as StreamOptions, V as VaultMode } from './types-DmhmfLzP.js';
|
|
3
|
+
export { R as RouteDockMiddlewareOptions, r as routedock } from './routedockMiddleware-BlDsHuPl.js';
|
|
4
4
|
import { RequestHandler } from 'express';
|
|
5
|
+
import { S as SeenTxStore } from './MppSessionHandler-CLB5SzgN.js';
|
|
6
|
+
export { C as ChannelStore, I as InMemorySeenTxStore, b as InMemorySeenTxStoreOptions, M as MppSessionHandlerOptions, c as OrphanReason, O as OrphanedSessionInfo, a as SettlementRecord, V as VoucherStoreValue, d as createMppSessionHandler, i as isVoucherStoreValue, p as paymentIdempotencyKey } from './MppSessionHandler-CLB5SzgN.js';
|
|
7
|
+
import { S as SessionStore } from './SessionStore-DvkZv8-E.js';
|
|
8
|
+
export { R as RouteDockChannelStateError, a as RouteDockClientVersionError, b as RouteDockDisputeError, c as RouteDockError, f as RouteDockFacilitatorError, g as RouteDockManifestError, j as RouteDockNetworkError, k as RouteDockNoSupportedModeError, l as RouteDockPolicyRejectError, m as RouteDockPolicyRejectedError, n as RouteDockRefundWindowError, o as RouteDockSessionError, p as RouteDockSignatureError, q as RouteDockTrustlineError, r as RouteDockVoucherMonotonicityError, s as SupabaseSessionStore } from './SessionStore-DvkZv8-E.js';
|
|
9
|
+
export { R as ReconciliationStats, a as RegisterProviderOptions, S as SessionReconcilerOptions, b as SupabaseSeenTxStore, d as decimalToStroops, r as reconcileAbandonedSessions, c as registerProvider, e as runStartupReconciliation } from './SessionReconciler-Dscw43F3.js';
|
|
10
|
+
import 'mppx';
|
|
5
11
|
import '@supabase/supabase-js';
|
|
12
|
+
import '@stellar/stellar-sdk';
|
|
6
13
|
|
|
7
|
-
type Network$
|
|
14
|
+
type Network$1 = 'testnet' | 'mainnet';
|
|
8
15
|
interface X402HandlerOptions {
|
|
9
16
|
payeeSecretKey: string;
|
|
10
|
-
network: Network$
|
|
17
|
+
network: Network$1;
|
|
11
18
|
amount: string;
|
|
12
19
|
assetContract: string;
|
|
13
20
|
facilitatorApiKey?: string;
|
|
14
21
|
manifest: RouteDockManifest;
|
|
15
|
-
onSettled?: (txHash: string, amount: string, mode: string) => Promise<void>;
|
|
22
|
+
onSettled?: (txHash: string, amount: string, mode: string, payer: string | null) => Promise<void>;
|
|
23
|
+
onCallbackError?: (err: unknown, cb: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Idempotency store guarding against duplicate settlement when an agent
|
|
26
|
+
* retries the same signed payment. Defaults to a per-handler in-memory store.
|
|
27
|
+
*/
|
|
28
|
+
seenTxStore?: SeenTxStore;
|
|
16
29
|
}
|
|
17
30
|
declare function createX402Handler(opts: X402HandlerOptions): RequestHandler;
|
|
18
31
|
|
|
19
|
-
type Network
|
|
32
|
+
type Network = 'testnet' | 'mainnet';
|
|
20
33
|
interface MppChargeHandlerOptions {
|
|
21
34
|
payeeSecretKey: string;
|
|
22
|
-
network: Network
|
|
35
|
+
network: Network;
|
|
23
36
|
amount: string;
|
|
24
37
|
assetContract: string;
|
|
25
38
|
manifest: RouteDockManifest;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Ignored. Charge mode opens no channel, so there is nothing for a session store to hold.
|
|
41
|
+
*/
|
|
26
42
|
store?: SessionStore;
|
|
27
|
-
onSettled?: (txHash: string, amount: string, mode: string) => Promise<void>;
|
|
43
|
+
onSettled?: (txHash: string, amount: string, mode: string, payer: string | null) => Promise<void>;
|
|
44
|
+
onCallbackError?: (err: unknown, cb: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Idempotency store guarding against duplicate settlement when an agent
|
|
47
|
+
* retries the same signed charge. Defaults to a per-handler in-memory store.
|
|
48
|
+
*/
|
|
49
|
+
seenTxStore?: SeenTxStore;
|
|
28
50
|
}
|
|
29
51
|
declare function createMppChargeHandler(opts: MppChargeHandlerOptions): RequestHandler;
|
|
30
52
|
|
|
31
|
-
type
|
|
32
|
-
interface MppSessionHandlerOptions {
|
|
33
|
-
payeeSecretKey: string;
|
|
34
|
-
network: Network;
|
|
35
|
-
channelContract: string;
|
|
36
|
-
rate: string;
|
|
37
|
-
assetContract: string;
|
|
38
|
-
manifest: RouteDockManifest;
|
|
39
|
-
commitmentPublicKey: string;
|
|
40
|
-
onSettled?: (txHash: string, totalPaid: string, mode: string) => Promise<void>;
|
|
41
|
-
onSessionOpen?: (channelId: string) => Promise<void>;
|
|
42
|
-
onVoucher?: (voucherIndex: number, cumulativeAmount: string) => Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
declare function createMppSessionHandler(opts: MppSessionHandlerOptions): RequestHandler;
|
|
45
|
-
|
|
46
|
-
export { type MppChargeHandlerOptions, type MppSessionHandlerOptions, RouteDockManifest, SessionStore, type X402HandlerOptions, createMppChargeHandler, createMppSessionHandler, createX402Handler };
|
|
53
|
+
export { type MppChargeHandlerOptions, RouteDockManifest, SeenTxStore, SessionStore, type X402HandlerOptions, createMppChargeHandler, createX402Handler };
|