@spine-event-engine/client-web 2.0.0-snapshot.10

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.
@@ -0,0 +1,228 @@
1
+ /*
2
+ * Copyright 2026, CodeMatters. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
+ * in compliance with the License. You may obtain a copy of the License at
6
+ *
7
+ * https://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
+ * or implied. See the License for the specific language governing permissions and limitations under
12
+ * the License.
13
+ */
14
+ /**
15
+ * Browser-managed cookie or memory-only bearer session resource.
16
+ */
17
+ export class BrowserSession {
18
+ #fetch;
19
+ #maxRequestMs;
20
+ #credentials;
21
+ #controllers = new Set();
22
+ #bearer;
23
+ #closed = false;
24
+ #context;
25
+ #reauthenticationGeneration = 0;
26
+ constructor(credentials, bearer, options) {
27
+ this.#credentials = credentials;
28
+ this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
29
+ if (typeof this.#fetch !== "function")
30
+ throw new TypeError("Browser session requires a fetch implementation.");
31
+ this.#maxRequestMs = BrowserSessionValues.requestDeadline(options.maxRequestMs);
32
+ this.#bearer = bearer;
33
+ }
34
+ /**
35
+ * Gets the browser Fetch credential mode selected by this immutable session.
36
+ * @returns Returns the selected credential mode.
37
+ */
38
+ get credentials() {
39
+ return this.#credentials;
40
+ }
41
+ /**
42
+ * Creates a browser-managed cookie session. Cookies never enter JavaScript metadata.
43
+ * @param options Configures fetch and the request deadline.
44
+ * @returns Returns the new cookie session.
45
+ */
46
+ static cookie(options = {}) {
47
+ return new BrowserSession("include", undefined, options);
48
+ }
49
+ /**
50
+ * Creates a memory-only bearer session. The token is never persisted by this resource.
51
+ * @param options Supplies the bearer token and session configuration.
52
+ * @returns Returns the new bearer session.
53
+ */
54
+ static bearer(options) {
55
+ return new BrowserSession("omit", BrowserSessionValues.requiredToken(options.token), options);
56
+ }
57
+ /**
58
+ * Gets the latest application gateway facts, which are informational and never credentials.
59
+ * @returns Returns a copied context, if one is available.
60
+ */
61
+ get context() {
62
+ return this.#context === undefined
63
+ ? undefined
64
+ : BrowserSessionValues.copyContext(this.#context);
65
+ }
66
+ /**
67
+ * Creates metadata for one request without exposing cookie values.
68
+ * @returns Returns the request metadata.
69
+ */
70
+ requestMetadata() {
71
+ const headers = new Headers();
72
+ if (this.#bearer !== undefined)
73
+ headers.set("authorization", `Bearer ${this.#bearer}`);
74
+ return headers;
75
+ }
76
+ /**
77
+ * Updates the memory-only bearer value.
78
+ * @param token Supplies the new bearer token.
79
+ */
80
+ replaceBearer(token) {
81
+ this.#assertOpen();
82
+ if (this.#credentials !== "omit")
83
+ throw new TypeError("Cookie sessions do not accept bearer tokens.");
84
+ this.#bearer = BrowserSessionValues.requiredToken(token);
85
+ }
86
+ /**
87
+ * Removes the memory-only bearer value. Cookie sessions remain browser-managed.
88
+ */
89
+ clearBearer() {
90
+ this.#bearer = undefined;
91
+ }
92
+ /**
93
+ * Executes an application-owned HTTP request with session transport behavior and
94
+ * a finite deadline. It does not implement a provider sign-in flow.
95
+ * @param input Supplies the request URL or request object.
96
+ * @param init Supplies optional request initialization.
97
+ * @returns Resolves to the HTTP response.
98
+ */
99
+ async fetch(input, init = {}) {
100
+ const bearer = this.#bearer;
101
+ return this.#run(init.signal ?? undefined, async (signal) => {
102
+ const headers = new Headers(init.headers);
103
+ if (bearer === undefined)
104
+ headers.delete("authorization");
105
+ else
106
+ headers.set("authorization", `Bearer ${bearer}`);
107
+ try {
108
+ return await this.#fetch(input, {
109
+ ...init,
110
+ credentials: this.#credentials,
111
+ headers,
112
+ signal,
113
+ });
114
+ }
115
+ catch (error) {
116
+ throw BrowserSessionValues.redactedError(error, bearer);
117
+ }
118
+ });
119
+ }
120
+ /**
121
+ * Updates informational context before a reconnect without treating it as credentials.
122
+ * @param onContext Resolves the latest application context.
123
+ * @param options Supplies optional cancellation.
124
+ * @returns Completes after the latest context is retained.
125
+ */
126
+ async reauthenticate(onContext, options = {}) {
127
+ if (typeof onContext !== "function")
128
+ throw new TypeError("Browser reauthentication adapter is required.");
129
+ const generation = ++this.#reauthenticationGeneration;
130
+ const context = await this.#run(options.signal, (signal) => onContext({ signal }));
131
+ if (generation !== this.#reauthenticationGeneration || this.#closed)
132
+ return;
133
+ this.#context = context === undefined ? undefined : BrowserSessionValues.freezeContext(context);
134
+ }
135
+ /**
136
+ * Closes session-owned HTTP or reauthentication work and clears memory-only credentials.
137
+ * @returns Completes after cancellation is requested.
138
+ */
139
+ close() {
140
+ if (this.#closed)
141
+ return Promise.resolve();
142
+ this.#closed = true;
143
+ this.#bearer = undefined;
144
+ this.#context = undefined;
145
+ for (const controller of this.#controllers)
146
+ controller.abort(new Error("Browser session is closed."));
147
+ return Promise.resolve();
148
+ }
149
+ async #run(signal, work) {
150
+ this.#assertOpen();
151
+ if (signal?.aborted)
152
+ throw signal.reason;
153
+ const controller = new AbortController();
154
+ const abort = () => {
155
+ controller.abort(signal?.reason);
156
+ };
157
+ const timeout = setTimeout(() => {
158
+ controller.abort(new Error("Browser session request timed out."));
159
+ }, this.#maxRequestMs);
160
+ signal?.addEventListener("abort", abort, { once: true });
161
+ this.#controllers.add(controller);
162
+ try {
163
+ const operation = work(controller.signal);
164
+ void operation.catch(() => undefined);
165
+ const aborted = Promise.withResolvers();
166
+ const rejectAbort = () => {
167
+ aborted.reject(controller.signal.reason ?? new Error("Browser session request aborted."));
168
+ };
169
+ controller.signal.addEventListener("abort", rejectAbort, { once: true });
170
+ const result = await Promise.race([operation, aborted.promise]).finally(() => {
171
+ controller.signal.removeEventListener("abort", rejectAbort);
172
+ });
173
+ this.#assertOpen();
174
+ return result;
175
+ }
176
+ finally {
177
+ clearTimeout(timeout);
178
+ this.#controllers.delete(controller);
179
+ signal?.removeEventListener("abort", abort);
180
+ }
181
+ }
182
+ #assertOpen() {
183
+ if (this.#closed)
184
+ throw new Error("Browser session is closed.");
185
+ }
186
+ }
187
+ const BrowserSessionValues = Object.freeze({
188
+ requestDeadline(value) {
189
+ const deadline = value ?? 10_000;
190
+ if (!Number.isSafeInteger(deadline) || deadline <= 0 || deadline > 60_000)
191
+ throw new RangeError("Browser session request deadline must be a positive safe integer at most 60000.");
192
+ return deadline;
193
+ },
194
+ requiredToken(value) {
195
+ if (typeof value !== "string" || value.length === 0 || value.length > 16_384)
196
+ throw new TypeError("Browser bearer token must be a non-empty string of at most 16384 characters.");
197
+ return value;
198
+ },
199
+ freezeContext(value) {
200
+ if (value.actor !== undefined &&
201
+ (typeof value.actor !== "string" || value.actor.length === 0 || value.actor.length > 4_096))
202
+ throw new TypeError("Browser session actor must be a non-empty string of at most 4096 characters.");
203
+ if (value.tenant !== undefined &&
204
+ (typeof value.tenant !== "string" || value.tenant.length === 0 || value.tenant.length > 4_096))
205
+ throw new TypeError("Browser session tenant must be a non-empty string of at most 4096 characters.");
206
+ if (value.expiresAt !== undefined &&
207
+ (!(value.expiresAt instanceof Date) || !Number.isFinite(value.expiresAt.getTime())))
208
+ throw new TypeError("Browser session expiry must be a valid Date.");
209
+ return Object.freeze({
210
+ ...(value.actor === undefined ? {} : { actor: value.actor }),
211
+ ...(value.tenant === undefined ? {} : { tenant: value.tenant }),
212
+ ...(value.expiresAt === undefined ? {} : { expiresAt: new Date(value.expiresAt) }),
213
+ });
214
+ },
215
+ copyContext(value) {
216
+ return Object.freeze({
217
+ ...(value.actor === undefined ? {} : { actor: value.actor }),
218
+ ...(value.tenant === undefined ? {} : { tenant: value.tenant }),
219
+ ...(value.expiresAt === undefined ? {} : { expiresAt: new Date(value.expiresAt) }),
220
+ });
221
+ },
222
+ redactedError(error, bearer) {
223
+ const source = error instanceof Error ? error.message : String(error);
224
+ const message = bearer === undefined ? source : source.replaceAll(bearer, "[REDACTED]");
225
+ return new Error(message);
226
+ },
227
+ });
228
+ //# sourceMappingURL=browser-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-session.js","sourceRoot":"","sources":["../../src/client/browser-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8DH;;GAEG;AACH,MAAM,OAAO,cAAc;IAChB,MAAM,CAA0B;IAChC,aAAa,CAAS;IACtB,YAAY,CAAqB;IACjC,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;IACnD,OAAO,CAAqB;IAC5B,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,CAAoC;IAC5C,2BAA2B,GAAG,CAAC,CAAC;IAEhC,YACE,WAA+B,EAC/B,MAA0B,EAC1B,OAA8B;QAE9B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjE,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU;YACnC,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,GAAG,oBAAoB,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAChF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,UAAiC,EAAE;QAC/C,OAAO,IAAI,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,OAAoC;QAChD,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAChG,CAAC;IAED;;;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KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YAC5D,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/D,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;SACnF,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,KAAc,EAAE,MAA0B;QACtD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACxF,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,394 @@
1
+ import { type Message, type MessageShape } from "@bufbuild/protobuf";
2
+ import type { GenMessage } from "@bufbuild/protobuf/codegenv2";
3
+ import { type Transport } from "@connectrpc/connect";
4
+ import { type TenantId, type ZoneId } from "@spine-event-engine/proto";
5
+ import { type Query, type QueryResponse, type SubscriptionUpdate, type Topic } from "@spine-event-engine/proto/client";
6
+ /**
7
+ * A valid application-level command outcome.
8
+ */
9
+ export type ClientOutcome = Readonly<{
10
+ /**
11
+ * Identifies a successful command.
12
+ */
13
+ readonly kind: "ok";
14
+ }> | Readonly<{
15
+ /**
16
+ * Identifies a command that produced an application error.
17
+ */
18
+ readonly kind: "error";
19
+ /**
20
+ * Carries the application error message.
21
+ */
22
+ readonly error: Message;
23
+ }> | Readonly<{
24
+ /**
25
+ * Identifies a command rejected by application rules.
26
+ */
27
+ readonly kind: "rejection";
28
+ /**
29
+ * Carries the rejection message.
30
+ */
31
+ readonly rejection: Message;
32
+ }>;
33
+ /**
34
+ * Options shared by client operations.
35
+ */
36
+ export interface ClientOperationOptions {
37
+ /**
38
+ * Cancels the operation when aborted.
39
+ */
40
+ readonly signal?: AbortSignal;
41
+ }
42
+ /**
43
+ * Immutable context selected when a client is created.
44
+ */
45
+ export interface ClientOptions {
46
+ /**
47
+ * Selects the tenant for all client requests.
48
+ */
49
+ readonly tenant?: string | TenantId;
50
+ /**
51
+ * Selects the time zone for all client requests.
52
+ */
53
+ readonly zoneId?: string | ZoneId;
54
+ /**
55
+ * Configures runtime behavior for created subscriptions.
56
+ */
57
+ readonly subscriptions?: SubscriptionRuntimeOptions;
58
+ /**
59
+ * Updates application credentials before one reconnect attempt.
60
+ * @param signal Cancels the refresh when the reconnect attempt ends.
61
+ * @returns Completes after the application refresh ends.
62
+ */
63
+ readonly onReauthenticateBeforeReconnect?: (signal: AbortSignal) => Promise<void>;
64
+ }
65
+ /**
66
+ * Bounded queues, retry policy, and scheduling for subscription recovery.
67
+ */
68
+ export interface SubscriptionRuntimeOptions {
69
+ /**
70
+ * Limits queued updates by count.
71
+ */
72
+ readonly updateBufferCapacity?: number;
73
+ /**
74
+ * Limits queued updates by serialized byte size.
75
+ */
76
+ readonly updateBufferByteCapacity?: number;
77
+ /**
78
+ * Limits queued lifecycle notices by count.
79
+ */
80
+ readonly lifecycleBufferCapacity?: number;
81
+ /**
82
+ * Configures bounded reconnect retries.
83
+ */
84
+ readonly retryPolicy?: SubscriptionRetryPolicy;
85
+ /**
86
+ * Supplies clock and wait behavior for retries.
87
+ */
88
+ readonly scheduler?: SubscriptionScheduler;
89
+ }
90
+ /**
91
+ * Finite retry settings for retries after the initial subscription attempt.
92
+ */
93
+ export interface SubscriptionRetryPolicy {
94
+ /**
95
+ * Limits retry attempts after the initial connection.
96
+ */
97
+ readonly maxAttempts: number;
98
+ /**
99
+ * Limits one recovery episode in milliseconds. A stream that remains
100
+ * connected for at least this duration starts a fresh episode on its next
101
+ * failure.
102
+ */
103
+ readonly maxElapsedMs: number;
104
+ /**
105
+ * Calculates the delay before a retry.
106
+ * @param attempt Identifies the retry attempt starting at one.
107
+ * @returns Returns the delay in milliseconds.
108
+ */
109
+ delayMs(attempt: number): number;
110
+ }
111
+ /**
112
+ * Clock and abortable-wait seam used by deterministic reconnect scheduling.
113
+ */
114
+ export interface SubscriptionScheduler {
115
+ /**
116
+ * Returns the current scheduler time in milliseconds.
117
+ * @returns Returns the current time.
118
+ */
119
+ now(): number;
120
+ /**
121
+ * Waits for a retry delay unless cancelled.
122
+ * @param delayMs Supplies the delay in milliseconds.
123
+ * @param signal Cancels the wait.
124
+ * @returns Completes when the delay ends or rejects on cancellation.
125
+ */
126
+ wait(delayMs: number, signal: AbortSignal): Promise<void>;
127
+ }
128
+ /**
129
+ * An event subscription does not perform authoritative state recovery.
130
+ */
131
+ export interface EventSubscriptionOptions extends ClientOperationOptions {
132
+ /**
133
+ * Identifies this as an event subscription.
134
+ */
135
+ readonly kind: "event";
136
+ }
137
+ /**
138
+ * An entity subscription supplies the query used for later authoritative recovery.
139
+ */
140
+ export interface EntitySubscriptionOptions extends ClientOperationOptions {
141
+ /**
142
+ * Identifies this as an entity subscription.
143
+ */
144
+ readonly kind: "entity";
145
+ /**
146
+ * Builds the query used after a possible update gap.
147
+ * @returns Returns the authoritative entity query.
148
+ */
149
+ readonly authoritativeQuery: () => Query | {
150
+ build(): Query;
151
+ };
152
+ }
153
+ /**
154
+ * Explicit kind and recovery information required to create a subscription.
155
+ */
156
+ export type CreateSubscriptionOptions = EventSubscriptionOptions | EntitySubscriptionOptions;
157
+ /**
158
+ * A delivered raw wire update or an authoritative entity recovery result.
159
+ */
160
+ export type SubscriptionDelivery = Readonly<{
161
+ /**
162
+ * Identifies a live subscription update.
163
+ */
164
+ readonly kind: "update";
165
+ /**
166
+ * Carries the live update.
167
+ */
168
+ readonly update: SubscriptionUpdate;
169
+ }> | Readonly<{
170
+ /**
171
+ * Identifies an authoritative recovery response.
172
+ */
173
+ readonly kind: "resynchronization";
174
+ /**
175
+ * Carries the recovered query response.
176
+ */
177
+ readonly response: QueryResponse;
178
+ }>;
179
+ /**
180
+ * A lifecycle state emitted independently for one logical subscription.
181
+ */
182
+ export type SubscriptionLifecycleState = "connecting" | "connected" | "resynchronizing" | "gapPossible" | "failed" | "closed";
183
+ /**
184
+ * Describes one lifecycle transition for a logical subscription.
185
+ */
186
+ export type SubscriptionLifecycle =
187
+ /**
188
+ * A generation is starting; `attempt` counts retries after its initial attempt.
189
+ */
190
+ Readonly<{
191
+ /**
192
+ * Identifies initial connection.
193
+ */
194
+ readonly state: "connecting";
195
+ /**
196
+ * Identifies this logical subscription generation.
197
+ */
198
+ readonly generation: number;
199
+ /**
200
+ * Counts retries after the initial attempt.
201
+ */
202
+ readonly attempt: number;
203
+ }>
204
+ /**
205
+ * A non-terminal lifecycle transition, identified by its generation.
206
+ */
207
+ | Readonly<{
208
+ /**
209
+ * Identifies a non-terminal lifecycle transition.
210
+ */
211
+ readonly state: "connected" | "resynchronizing" | "gapPossible";
212
+ /**
213
+ * Identifies this logical subscription generation.
214
+ */
215
+ readonly generation: number;
216
+ }>
217
+ /**
218
+ * A terminal cancellation for a generation.
219
+ */
220
+ | Readonly<{
221
+ /**
222
+ * Identifies normal lifecycle closure.
223
+ */ readonly state: "closed";
224
+ /**
225
+ * Identifies this logical subscription generation.
226
+ */ readonly generation: number;
227
+ }>
228
+ /**
229
+ * A terminal failure for a generation, carrying its exact failure object.
230
+ */
231
+ | Readonly<{
232
+ /**
233
+ * Identifies terminal lifecycle failure.
234
+ */ readonly state: "failed";
235
+ /**
236
+ * Identifies this logical subscription generation.
237
+ */ readonly generation: number;
238
+ /**
239
+ * Carries the terminal failure.
240
+ */ readonly error: Error;
241
+ }>;
242
+ /**
243
+ * Returns fresh application-owned request metadata synchronously for one outbound call.
244
+ * @returns Returns headers for the outbound call.
245
+ */
246
+ export type OnRequestMetadata = () => HeadersInit;
247
+ /**
248
+ * Browser factory options, including an optional per-call metadata supplier.
249
+ */
250
+ export interface BrowserClientOptions extends ClientOptions {
251
+ /**
252
+ * Supplies request metadata for each browser transport call.
253
+ */
254
+ readonly onRequestMetadata?: OnRequestMetadata;
255
+ /**
256
+ * Browser Fetch credential mode for this explicit protocol transport.
257
+ */
258
+ readonly credentials?: RequestCredentials;
259
+ }
260
+ /**
261
+ * Transport and request-ID source injected by an application or platform adapter.
262
+ */
263
+ export interface ClientTransport {
264
+ /**
265
+ * Carries the Connect transport used for RPC calls.
266
+ */
267
+ readonly transport: Transport;
268
+ /**
269
+ * Creates a non-empty identifier for each outbound command.
270
+ * @returns Returns the new request identifier.
271
+ */
272
+ createRequestId(): string;
273
+ /**
274
+ * Closes a platform transport owned by this client after work settles.
275
+ */
276
+ close?(): void;
277
+ }
278
+ /**
279
+ * A manually activated protocol subscription.
280
+ */
281
+ export interface Subscription {
282
+ /**
283
+ * Raw updates and authoritative entity recovery results for one consumer.
284
+ */
285
+ readonly updates: AsyncIterable<SubscriptionDelivery>;
286
+ /**
287
+ * Independent lifecycle notices for one consumer.
288
+ */
289
+ readonly lifecycle: AsyncIterable<SubscriptionLifecycle>;
290
+ /**
291
+ * Starts the remote subscription and makes its updates available for iteration.
292
+ * @param options Supplies cancellation options for activation.
293
+ * @returns Completes after remote activation ends.
294
+ */
295
+ activate(options?: ClientOperationOptions): Promise<void>;
296
+ /**
297
+ * Cancels local iteration and performs one bounded remote cancellation.
298
+ * @returns Completes after remote cancellation ends.
299
+ */
300
+ cancel(): Promise<void>;
301
+ }
302
+ /**
303
+ * Thrown for a service response that violates the frozen wire contract.
304
+ */
305
+ export declare class ClientProtocolError extends Error {
306
+ /**
307
+ * Creates an error for an invalid wire response.
308
+ * @param message Explains the protocol violation.
309
+ */
310
+ constructor(message: string);
311
+ }
312
+ /**
313
+ * Browser-safe Spine client whose transport and ID source are supplied by the caller.
314
+ */
315
+ export declare class Client {
316
+ #private;
317
+ /**
318
+ * Creates a browser client from a supplied transport and immutable options.
319
+ *
320
+ * @param source Supplies the browser-safe transport and request-ID source.
321
+ * @param options Supplies optional tenant, zone, reconnect, and subscription settings.
322
+ */
323
+ protected constructor(source: ClientTransport, options: ClientOptions);
324
+ /**
325
+ * Creates a client from an injected transport and request-ID source.
326
+ * @param source Supplies the transport and request-ID source.
327
+ * @param options Supplies immutable client options.
328
+ * @returns Returns the created client.
329
+ */
330
+ static usingTransport(source: ClientTransport, options?: ClientOptions): Client;
331
+ /**
332
+ * Creates a browser client that always uses the gRPC-Web protocol.
333
+ * @param baseUrl Supplies the gateway base URL.
334
+ * @param options Supplies browser client options.
335
+ * @returns Returns the created client.
336
+ */
337
+ static forGrpcWeb(baseUrl: string, options?: BrowserClientOptions): Client;
338
+ /**
339
+ * Creates a browser client that always uses binary Connect (`application/proto`).
340
+ *
341
+ * The selected gateway must permit binary Connect, including packed `Any` command
342
+ * and query values. Selection is explicit: this method never probes or falls back.
343
+ * @param baseUrl Supplies the gateway base URL.
344
+ * @param options Supplies browser client options.
345
+ * @returns Returns the created client.
346
+ */
347
+ static forConnect(baseUrl: string, options?: BrowserClientOptions): Client;
348
+ /**
349
+ * Creates an immutable request scope for the guest actor.
350
+ * @returns Returns the guest request scope.
351
+ */
352
+ asGuest(): ClientRequest;
353
+ /**
354
+ * Creates an immutable request scope for one actor.
355
+ * @param user Identifies the actor for requests in the scope.
356
+ * @returns Returns the actor request scope.
357
+ */
358
+ onBehalfOf(user: string): ClientRequest;
359
+ /**
360
+ * Closes the client by requesting open-work cancellation, awaiting subscription cleanup, and closing its transport.
361
+ * @returns Completes after subscription cleanup and transport closure.
362
+ */
363
+ close(): Promise<void>;
364
+ }
365
+ /**
366
+ * Immutable actor scope for one client lifecycle owner.
367
+ */
368
+ export interface ClientRequest {
369
+ /**
370
+ * Posts a command and returns its validated application-level outcome.
371
+ * @param schema Supplies the command message schema.
372
+ * @param message Supplies the command message.
373
+ * @param options Supplies cancellation options.
374
+ * @returns Returns the validated command outcome.
375
+ */
376
+ post<Schema extends GenMessage<Message>>(schema: Schema, message: MessageShape<Schema>, options?: ClientOperationOptions): Promise<ClientOutcome>;
377
+ /**
378
+ * Sends a query after applying this scope's immutable actor context.
379
+ * @param query Supplies a query or its builder.
380
+ * @param options Supplies cancellation options.
381
+ * @returns Returns the query response.
382
+ */
383
+ send(query: Query | {
384
+ build(): Query;
385
+ }, options?: ClientOperationOptions): Promise<QueryResponse>;
386
+ /**
387
+ * Creates an inactive topic subscription owned by this client lifecycle.
388
+ * @param topic Supplies the subscription topic.
389
+ * @param options Supplies the subscription kind and recovery options.
390
+ * @returns Returns the inactive subscription.
391
+ */
392
+ createSubscription(topic: Topic, options: CreateSubscriptionOptions): Promise<Subscription>;
393
+ }
394
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAcA,OAAO,EAA2B,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrF,OAAO,EASL,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EASL,KAAK,KAAK,EACV,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACX,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,CAAC;IAGP;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC,GACF,QAAQ,CAAC;IAGP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