@routedock/routedock 0.2.0 → 0.3.1
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-BJ9oJLVz.d.cts → ProviderRegistry-CyZ5eryO.d.cts} +2 -2
- package/dist/{ProviderRegistry-C50nyhaF.d.ts → ProviderRegistry-w4_hkI_1.d.ts} +2 -2
- package/dist/{RouteDockClient-BbkqjhMG.d.ts → RouteDockClient-CXvWXix5.d.cts} +25 -9
- package/dist/{RouteDockClient-B1roCa8h.d.cts → RouteDockClient-CjM2VyOd.d.ts} +25 -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 +432 -125
- package/dist/client.d.cts +9 -8
- package/dist/client.d.ts +9 -8
- package/dist/client.js +424 -127
- package/dist/index.cjs +655 -228
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +646 -229
- 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 +410 -125
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +411 -126
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { h as RouteDockManifest, P as PaymentMode, A as AssetConfig, p as SessionState } from './logger-D8_Q2ytp.js';
|
|
1
2
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
import { m as SessionState } from './types-DmhmfLzP.cjs';
|
|
3
3
|
|
|
4
4
|
/** Stable error codes for programmatic handling. */
|
|
5
5
|
type RouteDockErrorCode = 'MANIFEST' | 'MANIFEST_TIMEOUT' | 'MANIFEST_SUNSET' | 'NO_SUPPORTED_MODE' | 'FACILITATOR' | 'NETWORK' | 'SIGNATURE' | 'VOUCHER_MONOTONICITY' | 'POLICY_REJECT' | 'CHANNEL_STATE' | 'DISPUTE' | 'REFUND_WINDOW' | 'CLIENT_VERSION_TOO_OLD' | 'TRUSTLINE';
|
|
@@ -90,6 +90,38 @@ declare function parseRetryAfterMs(response: Response): number | undefined;
|
|
|
90
90
|
declare function httpStatusToError(message: string, status: number, response?: Response): RouteDockError;
|
|
91
91
|
/** Wrap a low-level fetch failure; preserves existing RouteDockErrors. */
|
|
92
92
|
declare function wrapFetchError(err: unknown, context: string): RouteDockError;
|
|
93
|
+
/**
|
|
94
|
+
* Wrap an mppx failure; differentiates network transport errors from signing/credential errors.
|
|
95
|
+
* Real transport failures (fetch TypeError, AbortError, TimeoutError) are wrapped as retryable
|
|
96
|
+
* RouteDockNetworkError, while signing and challenge failures are wrapped as non-retryable
|
|
97
|
+
* RouteDockSignatureError.
|
|
98
|
+
*/
|
|
99
|
+
declare function wrapMppError(err: unknown, context: string): RouteDockError;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Normalizes a manifest to always have an assets array.
|
|
103
|
+
* Handles backward compatibility with root asset/asset_contract fields.
|
|
104
|
+
*/
|
|
105
|
+
declare function normalizeManifestAssets(manifest: RouteDockManifest): AssetConfig[];
|
|
106
|
+
/**
|
|
107
|
+
* Finds eligible assets for a given mode and optional endpoint.
|
|
108
|
+
* Returns all assets that match the criteria.
|
|
109
|
+
*/
|
|
110
|
+
declare function getEligibleAssets(manifest: RouteDockManifest, mode: PaymentMode, endpoint?: string): AssetConfig[];
|
|
111
|
+
/**
|
|
112
|
+
* Resolves the asset contract for a mode and optional endpoint.
|
|
113
|
+
* Honors manifest.assets when defined; falls back to explicitContract or root asset_contract.
|
|
114
|
+
*/
|
|
115
|
+
declare function resolveAssetContract(manifest: RouteDockManifest, mode: PaymentMode, endpoint?: string, explicitContract?: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Selects a single asset for payment, given a mode and optional endpoint.
|
|
118
|
+
* Returns the first eligible asset, or throws if none are available.
|
|
119
|
+
*/
|
|
120
|
+
declare function selectAsset(manifest: RouteDockManifest, mode: PaymentMode, endpoint?: string): AssetConfig;
|
|
121
|
+
/**
|
|
122
|
+
* Checks if a specific asset (by ticker or contract address) is eligible for a mode/endpoint.
|
|
123
|
+
*/
|
|
124
|
+
declare function isAssetEligible(manifest: RouteDockManifest, assetIdentifier: string, mode: PaymentMode, endpoint?: string): boolean;
|
|
93
125
|
|
|
94
126
|
interface SessionStore {
|
|
95
127
|
get(channelId: string): Promise<SessionState | null>;
|
|
@@ -108,4 +140,4 @@ declare class SupabaseSessionStore implements SessionStore {
|
|
|
108
140
|
close(channelId: string): Promise<void>;
|
|
109
141
|
}
|
|
110
142
|
|
|
111
|
-
export { RouteDockChannelStateError as R, type SessionStore as S, RouteDockClientVersionError as a, RouteDockDisputeError as b, RouteDockError as c, type RouteDockErrorCode as d, type RouteDockErrorOptions as e, RouteDockFacilitatorError as f, RouteDockManifestError as g, RouteDockManifestSunsetError as h, RouteDockManifestTimeoutError as i, RouteDockNetworkError as j, RouteDockNoSupportedModeError as k, RouteDockPolicyRejectError as l, RouteDockPolicyRejectedError as m, RouteDockRefundWindowError as n, RouteDockSessionError as o, RouteDockSignatureError as p, RouteDockTrustlineError as q, RouteDockVoucherMonotonicityError as r, SupabaseSessionStore as s,
|
|
143
|
+
export { wrapFetchError as A, wrapMppError as B, RouteDockChannelStateError as R, type SessionStore as S, RouteDockClientVersionError as a, RouteDockDisputeError as b, RouteDockError as c, type RouteDockErrorCode as d, type RouteDockErrorOptions as e, RouteDockFacilitatorError as f, RouteDockManifestError as g, RouteDockManifestSunsetError as h, RouteDockManifestTimeoutError as i, RouteDockNetworkError as j, RouteDockNoSupportedModeError as k, RouteDockPolicyRejectError as l, RouteDockPolicyRejectedError as m, RouteDockRefundWindowError as n, RouteDockSessionError as o, RouteDockSignatureError as p, RouteDockTrustlineError as q, RouteDockVoucherMonotonicityError as r, SupabaseSessionStore as s, getEligibleAssets as t, httpStatusToError as u, isAssetEligible as v, normalizeManifestAssets as w, parseRetryAfterMs as x, resolveAssetContract as y, selectAsset as z };
|