@compose-market/sdk 0.8.0 → 0.8.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/.speakeasy/a2a.arazzo.yaml +1 -1
- package/.speakeasy/memory.arazzo.yaml +1 -1
- package/.speakeasy/tests.arazzo.yaml +1 -1
- package/generated/inference/esm/lib/config.d.ts +3 -3
- package/generated/inference/esm/lib/config.js +3 -3
- package/generated/inference/package.json +1 -1
- package/generated/inference/src/lib/config.ts +3 -3
- package/generated/manowar/esm/lib/config.d.ts +3 -3
- package/generated/manowar/esm/lib/config.js +3 -3
- package/generated/manowar/package.json +1 -1
- package/generated/manowar/src/lib/config.ts +3 -3
- package/generated/memory/esm/lib/config.d.ts +3 -3
- package/generated/memory/esm/lib/config.js +3 -3
- package/generated/memory/package.json +1 -1
- package/generated/memory/src/lib/config.ts +3 -3
- package/generated/x402/esm/lib/config.d.ts +3 -3
- package/generated/x402/esm/lib/config.js +3 -3
- package/generated/x402/package.json +1 -1
- package/generated/x402/src/lib/config.ts +3 -3
- package/package.json +4 -4
- package/specs/inference.openapi.yaml +1 -1
- package/specs/manowar.openapi.yaml +1 -1
- package/specs/memory.openapi.yaml +1 -1
- package/specs/x402.openapi.yaml +1 -1
- package/dist/errors.d.ts +0 -2
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -2
- package/dist/errors.js.map +0 -1
- package/dist/events.d.ts +0 -202
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -70
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts +0 -277
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -551
- package/dist/index.js.map +0 -1
- package/dist/resources/accounts.d.ts +0 -32
- package/dist/resources/accounts.d.ts.map +0 -1
- package/dist/resources/accounts.js +0 -128
- package/dist/resources/accounts.js.map +0 -1
- package/dist/resources/agent.d.ts +0 -58
- package/dist/resources/agent.d.ts.map +0 -1
- package/dist/resources/agent.js +0 -770
- package/dist/resources/agent.js.map +0 -1
- package/dist/resources/channels.d.ts +0 -24
- package/dist/resources/channels.d.ts.map +0 -1
- package/dist/resources/channels.js +0 -74
- package/dist/resources/channels.js.map +0 -1
- package/dist/resources/directory.d.ts +0 -43
- package/dist/resources/directory.d.ts.map +0 -1
- package/dist/resources/directory.js +0 -97
- package/dist/resources/directory.js.map +0 -1
- package/dist/resources/dispenser.d.ts +0 -25
- package/dist/resources/dispenser.d.ts.map +0 -1
- package/dist/resources/dispenser.js +0 -56
- package/dist/resources/dispenser.js.map +0 -1
- package/dist/resources/feedback.d.ts +0 -35
- package/dist/resources/feedback.d.ts.map +0 -1
- package/dist/resources/feedback.js +0 -127
- package/dist/resources/feedback.js.map +0 -1
- package/dist/resources/inference.d.ts +0 -206
- package/dist/resources/inference.d.ts.map +0 -1
- package/dist/resources/inference.js +0 -1046
- package/dist/resources/inference.js.map +0 -1
- package/dist/resources/instrumentation.d.ts +0 -29
- package/dist/resources/instrumentation.d.ts.map +0 -1
- package/dist/resources/instrumentation.js +0 -43
- package/dist/resources/instrumentation.js.map +0 -1
- package/dist/resources/keys.d.ts +0 -56
- package/dist/resources/keys.d.ts.map +0 -1
- package/dist/resources/keys.js +0 -186
- package/dist/resources/keys.js.map +0 -1
- package/dist/resources/local.d.ts +0 -56
- package/dist/resources/local.d.ts.map +0 -1
- package/dist/resources/local.js +0 -163
- package/dist/resources/local.js.map +0 -1
- package/dist/resources/memory.d.ts +0 -249
- package/dist/resources/memory.d.ts.map +0 -1
- package/dist/resources/memory.js +0 -217
- package/dist/resources/memory.js.map +0 -1
- package/dist/resources/models.d.ts +0 -45
- package/dist/resources/models.d.ts.map +0 -1
- package/dist/resources/models.js +0 -101
- package/dist/resources/models.js.map +0 -1
- package/dist/resources/permissions.d.ts +0 -23
- package/dist/resources/permissions.d.ts.map +0 -1
- package/dist/resources/permissions.js +0 -69
- package/dist/resources/permissions.js.map +0 -1
- package/dist/resources/receipts.d.ts +0 -23
- package/dist/resources/receipts.d.ts.map +0 -1
- package/dist/resources/receipts.js +0 -48
- package/dist/resources/receipts.js.map +0 -1
- package/dist/resources/session-events.d.ts +0 -51
- package/dist/resources/session-events.d.ts.map +0 -1
- package/dist/resources/session-events.js +0 -404
- package/dist/resources/session-events.js.map +0 -1
- package/dist/resources/settlement.d.ts +0 -21
- package/dist/resources/settlement.d.ts.map +0 -1
- package/dist/resources/settlement.js +0 -30
- package/dist/resources/settlement.js.map +0 -1
- package/dist/resources/system.d.ts +0 -9
- package/dist/resources/system.d.ts.map +0 -1
- package/dist/resources/system.js +0 -19
- package/dist/resources/system.js.map +0 -1
- package/dist/resources/webhooks.d.ts +0 -27
- package/dist/resources/webhooks.d.ts.map +0 -1
- package/dist/resources/webhooks.js +0 -78
- package/dist/resources/webhooks.js.map +0 -1
- package/dist/resources/workflow.d.ts +0 -49
- package/dist/resources/workflow.d.ts.map +0 -1
- package/dist/resources/workflow.js +0 -361
- package/dist/resources/workflow.js.map +0 -1
- package/dist/resources/x402.d.ts +0 -113
- package/dist/resources/x402.d.ts.map +0 -1
- package/dist/resources/x402.js +0 -231
- package/dist/resources/x402.js.map +0 -1
- package/dist/tools/index.d.ts +0 -55
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -51
- package/dist/tools/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -1857
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +0 -1
- package/dist/version.d.ts +0 -9
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -9
- package/dist/version.js.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@compose-market/sdk` — Official SDK for Compose Market.
|
|
3
|
-
*
|
|
4
|
-
* Exposes the canonical header contract (`Authorization: Bearer compose-<jwt>`,
|
|
5
|
-
* `x-session-user-address`, `x-chain-id`) that powers Compose's first-party
|
|
6
|
-
* apps (web/, mesh/) and lets any third-party integrator embed:
|
|
7
|
-
*
|
|
8
|
-
* - Compose Key lifecycle (create / list / get / revoke, session metadata)
|
|
9
|
-
* - Multi-provider model catalog (list / listAll / search / get / getParams)
|
|
10
|
-
* - Native inference (chat.completions, responses, embeddings, images,
|
|
11
|
-
* audio.speech, audio.transcriptions, videos) with SSE streaming,
|
|
12
|
-
* typed tool-call deltas and reasoning deltas, typed cost receipts, and
|
|
13
|
-
* live session-budget updates emitted on every response.
|
|
14
|
-
* - x402 facilitator access (supported / chains / verify / settle) and typed
|
|
15
|
-
* decoders for PAYMENT-REQUIRED, PAYMENT-RESPONSE, X-Receipt.
|
|
16
|
-
* - Agent-first runtime memory loop (`sdk.memory.context`,
|
|
17
|
-
* `sdk.memory.recordTurn`, `sdk.memory.remember`, `sdk.memory.loop`) for
|
|
18
|
-
* compact pre-turn recall, post-turn persistence, and durable facts.
|
|
19
|
-
* - SSE session events (`sdk.session.events`) for budget depletion and
|
|
20
|
-
* expiry notifications, dispatched on the typed event bus as well.
|
|
21
|
-
* - Webhook signature verification (HMAC-SHA256, Stripe-style header).
|
|
22
|
-
* - Feedback/reputation submission and summaries for x402 flows, endpoints,
|
|
23
|
-
* models, agents, and workflows without coupling feedback to settlement.
|
|
24
|
-
*
|
|
25
|
-
* Design:
|
|
26
|
-
* - The orchestration client uses platform `fetch`, WebCrypto, TextDecoder,
|
|
27
|
-
* and ReadableStream. Generated OpenAPI subpath clients use Speakeasy's
|
|
28
|
-
* Zod-backed runtime validation.
|
|
29
|
-
* - Identity is whatever the integrator already has. The SDK does NOT call a
|
|
30
|
-
* wallet, does NOT request signatures, does NOT run KYC. The end-user's
|
|
31
|
-
* wallet address — produced by whatever auth stack the integrator already
|
|
32
|
-
* uses — is trusted in the same exact way our first-party apps trust it —
|
|
33
|
-
* via the `x-session-user-address` header. The Compose Key JWT returned by
|
|
34
|
-
* `keys.create(...)` is the real cryptographic identity from that point on.
|
|
35
|
-
* - Every billable call returns a `Completion<T>` carrying the parsed
|
|
36
|
-
* body, the settlement receipt (if any), the request id, the live session
|
|
37
|
-
* budget snapshot, the session-invalid reason (if any), and the raw
|
|
38
|
-
* Response so integrators can read non-standard headers without parsing.
|
|
39
|
-
* - Persisted session tokens survive page reloads when a storage adapter is
|
|
40
|
-
* provided (browser `localStorage` is auto-detected).
|
|
41
|
-
*/
|
|
42
|
-
import { type FetchLike, type HttpClientOptions, type RetryPolicy } from "@compose-market/core/http";
|
|
43
|
-
import { KeysResource } from "./resources/keys.js";
|
|
44
|
-
import { ModelsResource } from "./resources/models.js";
|
|
45
|
-
import { InferenceResource } from "./resources/inference.js";
|
|
46
|
-
import { X402Resource } from "./resources/x402.js";
|
|
47
|
-
import { WebhooksResource } from "./resources/webhooks.js";
|
|
48
|
-
import { SessionEventsResource, type SessionEventsOptions } from "./resources/session-events.js";
|
|
49
|
-
import { AgentResource } from "./resources/agent.js";
|
|
50
|
-
import { WorkflowResource } from "./resources/workflow.js";
|
|
51
|
-
import { MemoryResource } from "./resources/memory.js";
|
|
52
|
-
import { FeedbackResource } from "./resources/feedback.js";
|
|
53
|
-
import { DirectoryResource } from "./resources/directory.js";
|
|
54
|
-
import { SystemResource } from "./resources/system.js";
|
|
55
|
-
import { LocalResource } from "./resources/local.js";
|
|
56
|
-
import { DispenserResource } from "./resources/dispenser.js";
|
|
57
|
-
import { SettlementResource } from "./resources/settlement.js";
|
|
58
|
-
import { PermissionsResource } from "./resources/permissions.js";
|
|
59
|
-
import { AccountsResource } from "./resources/accounts.js";
|
|
60
|
-
import { ChannelsResource } from "./resources/channels.js";
|
|
61
|
-
import { ReceiptsResource } from "./resources/receipts.js";
|
|
62
|
-
import { type EventBus, type EventListener } from "./events.js";
|
|
63
|
-
import { type Storage } from "@compose-market/core/storage";
|
|
64
|
-
import type { X402PaymentSigner } from "./types/index.js";
|
|
65
|
-
import type { CallOptions } from "./resources/inference.js";
|
|
66
|
-
export * from "./types/index.js";
|
|
67
|
-
export * from "./errors.js";
|
|
68
|
-
export type { APIPromise, HeaderBagInput, HttpClientOptions, RequestOptions, RetryPolicy, } from "@compose-market/core/http";
|
|
69
|
-
export type { CallOptions, Completion, ChatCompletionFinalResult, ResponsesStreamFinalResult, StreamIterator, InferenceContext, } from "./resources/inference.js";
|
|
70
|
-
export type { WebhookEvent, VerifyWebhookInput, } from "./resources/webhooks.js";
|
|
71
|
-
export type { BudgetEvent, EventBus, EventListener, EventMap, EventName, ReceiptEvent, SessionInvalidEvent, ToolCallLifecycleEvent, ChildAgentLifecycleEvent, AgentArtifactEvent, PlanProposalEvent, AgentStreamLifecycleEvent, WorkflowStreamLifecycleEvent, } from "./events.js";
|
|
72
|
-
export type { Storage } from "@compose-market/core/storage";
|
|
73
|
-
export type { SessionEventsOptions } from "./resources/session-events.js";
|
|
74
|
-
export type { AgentResource, RunEvent } from "./resources/agent.js";
|
|
75
|
-
export type { WorkflowEvent, WorkflowResource } from "./resources/workflow.js";
|
|
76
|
-
export type { MemoryResource } from "./resources/memory.js";
|
|
77
|
-
export type { FeedbackResource } from "./resources/feedback.js";
|
|
78
|
-
export type { DirectoryResource } from "./resources/directory.js";
|
|
79
|
-
export type { SystemResource } from "./resources/system.js";
|
|
80
|
-
export type { LocalResource } from "./resources/local.js";
|
|
81
|
-
export type { DispenserResource } from "./resources/dispenser.js";
|
|
82
|
-
export type { SettlementResource } from "./resources/settlement.js";
|
|
83
|
-
export type { PermissionsResource } from "./resources/permissions.js";
|
|
84
|
-
export type { AccountsResource } from "./resources/accounts.js";
|
|
85
|
-
export type { ChannelsResource } from "./resources/channels.js";
|
|
86
|
-
export type { ReceiptsResource, ReceiptListOptions } from "./resources/receipts.js";
|
|
87
|
-
export { decodeReceiptHeader, extractReceiptFromResponse, parseReceiptEvent } from "@compose-market/core/sse/receipt";
|
|
88
|
-
export { extractSessionBudgetFromResponse } from "@compose-market/core/sse/budget";
|
|
89
|
-
export { parseSSEStream, parse, format, named, done } from "@compose-market/core/transport";
|
|
90
|
-
export type { Frame, SSEFrame } from "@compose-market/core/transport";
|
|
91
|
-
export { create as createModelState, decode as decodeModelEvent, reduce as reduceModelState, } from "@compose-market/core/model";
|
|
92
|
-
export type { AssetKind, ModelAsset, ModelEvent, ModelState, ModelStatus, } from "@compose-market/core/model";
|
|
93
|
-
export { create as createActivityState, decode as decodeActivityEvent, reduce as reduceActivityState, } from "@compose-market/core/activity";
|
|
94
|
-
export type { ActivityEvent, ActivityKind, ActivityNode, ActivityState, ActivityStatus, ActivityTarget, } from "@compose-market/core/activity";
|
|
95
|
-
export { createPrivateKeyX402EvmSigner, createPrivateKeyX402EvmWallet, createX402EvmSigner, encodePaymentPayload, encodePaymentSignature, } from "./resources/x402.js";
|
|
96
|
-
export { createMemoryStorage } from "@compose-market/core/storage";
|
|
97
|
-
export * as tools from "./tools/index.js";
|
|
98
|
-
export type { ToolEvent, ToolEventKind, ToolEventDisplay, ModelToolEvent, ConnectorToolEvent, AgentToolEvent, SearchToolEvent, CatalogToolEvent } from "./tools/index.js";
|
|
99
|
-
export { parseToolEvent } from "./tools/index.js";
|
|
100
|
-
export { commands, msm } from "@compose-market/core";
|
|
101
|
-
export type { Command, ActionSource, NativeAction, ActionScope, GoalState, GoalStatus, GoalRunState, PlanState, PlanStatus, TaskRecord, TaskStatus, PlanRunState, ActionEvent, TaskObservation, GoalObservation, ActionResult } from "@compose-market/core/commands";
|
|
102
|
-
export type { Mode, Scope, Stage, Source, Signal, ActionKind, ObservationStatus, ToolState, RouteState, FlagState, Route, Classification, Budget, Action, Transition, Observation, Entry, Snapshot } from "@compose-market/core/msm";
|
|
103
|
-
/**
|
|
104
|
-
* Constructor options for `ComposeSDK`.
|
|
105
|
-
*/
|
|
106
|
-
export interface ComposeSDKOptions {
|
|
107
|
-
/** API base URL. Defaults to `https://api.compose.market`. */
|
|
108
|
-
baseUrl?: string;
|
|
109
|
-
/** Channels service URL. Defaults to `https://services.compose.market`. */
|
|
110
|
-
channelsUrl?: string;
|
|
111
|
-
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
112
|
-
fetch?: FetchLike;
|
|
113
|
-
/**
|
|
114
|
-
* End-user wallet address. Whatever identity stack you already use produced
|
|
115
|
-
* this address — pass it through. The SDK relays it exactly as our
|
|
116
|
-
* first-party apps do, and does not care how you obtained it.
|
|
117
|
-
*/
|
|
118
|
-
userAddress?: string;
|
|
119
|
-
/**
|
|
120
|
-
* Chain id. Must be one of the facilitator-configured chains. Call
|
|
121
|
-
* `sdk.x402.facilitator.chains()` to enumerate supported chains + USDC
|
|
122
|
-
* contracts at runtime.
|
|
123
|
-
*/
|
|
124
|
-
chainId?: number;
|
|
125
|
-
/**
|
|
126
|
-
* A previously-issued Compose Key JWT. The SDK stores this in-memory and
|
|
127
|
-
* attaches it as `Authorization: Bearer compose-<jwt>` on every call.
|
|
128
|
-
*
|
|
129
|
-
* When a `storage` adapter is present, the token is also persisted under
|
|
130
|
-
* the scoped key `<tokenScope>:<address>:<chainId>` so that it survives
|
|
131
|
-
* page reloads. If `key` is omitted at construction, the SDK
|
|
132
|
-
* attempts to hydrate from storage.
|
|
133
|
-
*/
|
|
134
|
-
key?: string;
|
|
135
|
-
/** Default timeout for each HTTP call, in milliseconds. Default 60_000. */
|
|
136
|
-
timeoutMs?: number;
|
|
137
|
-
/** Retry policy applied to transient errors (5xx, 429, network). */
|
|
138
|
-
retry?: Partial<RetryPolicy>;
|
|
139
|
-
/** Headers merged into every request. */
|
|
140
|
-
defaultHeaders?: Record<string, string>;
|
|
141
|
-
/**
|
|
142
|
-
* `User-Agent` suffix so Compose analytics can distinguish integrators.
|
|
143
|
-
* The base string is `@compose-market/sdk/<version>`.
|
|
144
|
-
*/
|
|
145
|
-
userAgent?: string;
|
|
146
|
-
/** Optional debug/logging hooks. */
|
|
147
|
-
logger?: HttpClientOptions["logger"];
|
|
148
|
-
/**
|
|
149
|
-
* Pluggable persistent storage. Auto-detects `globalThis.localStorage` on
|
|
150
|
-
* browsers/Workers. Pass an explicit adapter on Node/server runtimes if
|
|
151
|
-
* you want the session token to survive process restarts.
|
|
152
|
-
*/
|
|
153
|
-
storage?: Storage;
|
|
154
|
-
/**
|
|
155
|
-
* Namespace prefix for persisted tokens. The full key shape is
|
|
156
|
-
* `<tokenScope>:<lower-address>:<chainId>`. Defaults to
|
|
157
|
-
* `compose.sdk.token`. Bump this only if you need to invalidate every
|
|
158
|
-
* persisted token at once (e.g. after a breaking server auth change).
|
|
159
|
-
*/
|
|
160
|
-
tokenScope?: string;
|
|
161
|
-
/**
|
|
162
|
-
* Provider-agnostic x402 signer. The SDK calls this only after receiving a
|
|
163
|
-
* real PAYMENT-REQUIRED challenge, then retries the request with the
|
|
164
|
-
* returned PAYMENT-SIGNATURE. Integrators can back this with Thirdweb,
|
|
165
|
-
* Privy, Dynamic, a browser wallet, a server wallet, or any other signer.
|
|
166
|
-
*/
|
|
167
|
-
x402Signer?: X402PaymentSigner;
|
|
168
|
-
}
|
|
169
|
-
export declare class ComposeSDK {
|
|
170
|
-
/** The SDK version, sourced from package.json at build time. */
|
|
171
|
-
readonly version: string;
|
|
172
|
-
/** Resolved API base URL, trimmed of trailing slashes. */
|
|
173
|
-
readonly baseUrl: string;
|
|
174
|
-
/** Resolved channels service URL, trimmed of trailing slashes. */
|
|
175
|
-
readonly channelsUrl: string;
|
|
176
|
-
readonly keys: KeysResource;
|
|
177
|
-
readonly models: ModelsResource;
|
|
178
|
-
readonly inference: InferenceResource;
|
|
179
|
-
readonly x402: X402Resource;
|
|
180
|
-
readonly webhooks: WebhooksResource;
|
|
181
|
-
readonly session: SessionEventsNamespace;
|
|
182
|
-
readonly agent: AgentResource;
|
|
183
|
-
readonly workflow: WorkflowResource;
|
|
184
|
-
readonly memory: MemoryResource;
|
|
185
|
-
readonly feedback: FeedbackResource;
|
|
186
|
-
readonly directory: DirectoryResource;
|
|
187
|
-
readonly system: SystemResource;
|
|
188
|
-
readonly local: LocalResource;
|
|
189
|
-
readonly dispenser: DispenserResource;
|
|
190
|
-
readonly settlement: SettlementResource;
|
|
191
|
-
readonly permissions: PermissionsResource;
|
|
192
|
-
readonly accounts: AccountsResource;
|
|
193
|
-
readonly channels: ChannelsResource;
|
|
194
|
-
readonly receipts: ReceiptsResource;
|
|
195
|
-
readonly wallets: {
|
|
196
|
-
attach: (input: {
|
|
197
|
-
address: string;
|
|
198
|
-
chainId: number;
|
|
199
|
-
}) => void;
|
|
200
|
-
current: () => {
|
|
201
|
-
address: string | null;
|
|
202
|
-
chainId: number | null;
|
|
203
|
-
};
|
|
204
|
-
clear: () => void;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Typed, in-memory event bus. Listeners registered here receive:
|
|
208
|
-
* - `budget` — live `x-session-budget-*` snapshot on every billable call.
|
|
209
|
-
* - `sessionInvalid` — `x-session-invalid` header set by the server.
|
|
210
|
-
* - `sessionActive` — SSE `session-active` heartbeat from `/api/session/events`.
|
|
211
|
-
* - `sessionExpired` — SSE `session-expired` frame from `/api/session/events`.
|
|
212
|
-
* - `receipt` — settlement receipt on every billable response / stream.
|
|
213
|
-
*/
|
|
214
|
-
readonly events: EventBus;
|
|
215
|
-
private readonly http;
|
|
216
|
-
private readonly storage;
|
|
217
|
-
private readonly tokenScope;
|
|
218
|
-
private userAddress;
|
|
219
|
-
private chainId;
|
|
220
|
-
private key;
|
|
221
|
-
private readonly x402Signer;
|
|
222
|
-
private readonly rawFetch;
|
|
223
|
-
private readonly userAgent;
|
|
224
|
-
constructor(options?: ComposeSDKOptions);
|
|
225
|
-
private persistToken;
|
|
226
|
-
private deletePersistedToken;
|
|
227
|
-
/**
|
|
228
|
-
* Drop-in `fetch` wrapper that attaches the canonical Compose header
|
|
229
|
-
* contract (`Authorization`, `x-session-user-address`, `x-chain-id`,
|
|
230
|
-
* SDK client headers) on every request and emits `budget` / `sessionInvalid` /
|
|
231
|
-
* `receipt` events on every response via the SDK event bus.
|
|
232
|
-
*
|
|
233
|
-
* Use this when you need to hit a Compose endpoint that isn't covered
|
|
234
|
-
* by a typed resource yet (agent/workflow runtime endpoints, workspace
|
|
235
|
-
* indexing, custom api/ routes). The URL may be absolute or relative to
|
|
236
|
-
* the SDK's `baseUrl`.
|
|
237
|
-
*
|
|
238
|
-
* Non-Compose URLs (absolute URLs whose host differs from `baseUrl`) are
|
|
239
|
-
* still passed through so this method is safe as a general-purpose fetch
|
|
240
|
-
* replacement; the budget event extraction is a no-op when the response
|
|
241
|
-
* doesn't carry `x-session-budget-*` headers.
|
|
242
|
-
*/
|
|
243
|
-
fetch(input: RequestInfo | URL, init?: RequestInit & CallOptions): Promise<Response>;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Thin ergonomic wrapper around `SessionEventsResource` so callers write
|
|
247
|
-
* `sdk.session.events({ ... })` with wallet defaults inferred from the SDK
|
|
248
|
-
* instance.
|
|
249
|
-
*/
|
|
250
|
-
declare class SessionEventsNamespace {
|
|
251
|
-
private readonly resource;
|
|
252
|
-
private readonly getWalletMaybe;
|
|
253
|
-
constructor(resource: SessionEventsResource, getWalletMaybe: () => {
|
|
254
|
-
address: string | null;
|
|
255
|
-
chainId: number | null;
|
|
256
|
-
});
|
|
257
|
-
/**
|
|
258
|
-
* Subscribe to `/api/session/events`. Yields `SessionActiveEvent` and
|
|
259
|
-
* `SessionExpiredEvent` until the signal aborts or the server ends the
|
|
260
|
-
* stream. The same events are also emitted on `sdk.events`.
|
|
261
|
-
*
|
|
262
|
-
* When `userAddress` / `chainId` are omitted, the SDK's currently attached
|
|
263
|
-
* wallet context is used. Abort via an `AbortController.signal`.
|
|
264
|
-
*/
|
|
265
|
-
subscribe(opts?: Partial<SessionEventsOptions>): AsyncIterable<import("@compose-market/core").SessionEvent>;
|
|
266
|
-
/**
|
|
267
|
-
* Shortcut: register a listener on the `sessionActive` + `sessionExpired`
|
|
268
|
-
* events produced by a subscription. Returns a disposer that aborts the
|
|
269
|
-
* underlying stream AND removes the listeners.
|
|
270
|
-
*/
|
|
271
|
-
on(handlers: {
|
|
272
|
-
active?: EventListener<"sessionActive">;
|
|
273
|
-
expired?: EventListener<"sessionExpired">;
|
|
274
|
-
}, opts?: Partial<SessionEventsOptions>): () => void;
|
|
275
|
-
}
|
|
276
|
-
export default ComposeSDK;
|
|
277
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAKH,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE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