@broadcastingplatforms/sdk 0.0.0-dev.9cfcfc6

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.
Files changed (57) hide show
  1. package/dist/auth-CRWthQ_B.d.mts +1176 -0
  2. package/dist/auth-CRWthQ_B.d.ts +1176 -0
  3. package/dist/auth.d.mts +1 -0
  4. package/dist/auth.d.ts +1 -0
  5. package/dist/auth.js +456 -0
  6. package/dist/auth.mjs +433 -0
  7. package/dist/base-client-BmVTsKhL.d.mts +70 -0
  8. package/dist/base-client-Dk56EJj-.d.ts +70 -0
  9. package/dist/browser-client.d.mts +47 -0
  10. package/dist/browser-client.d.ts +47 -0
  11. package/dist/browser-client.js +1983 -0
  12. package/dist/browser-client.mjs +1952 -0
  13. package/dist/channels.d.mts +1 -0
  14. package/dist/channels.d.ts +1 -0
  15. package/dist/channels.js +78 -0
  16. package/dist/channels.mjs +55 -0
  17. package/dist/chat.d.mts +1 -0
  18. package/dist/chat.d.ts +1 -0
  19. package/dist/chat.js +105 -0
  20. package/dist/chat.mjs +80 -0
  21. package/dist/errors.d.mts +68 -0
  22. package/dist/errors.d.ts +68 -0
  23. package/dist/errors.js +151 -0
  24. package/dist/errors.mjs +127 -0
  25. package/dist/http.d.mts +1 -0
  26. package/dist/http.d.ts +1 -0
  27. package/dist/http.js +323 -0
  28. package/dist/http.mjs +298 -0
  29. package/dist/index.d.mts +7 -0
  30. package/dist/index.d.ts +7 -0
  31. package/dist/index.js +2072 -0
  32. package/dist/index.mjs +2025 -0
  33. package/dist/realtime.d.mts +9 -0
  34. package/dist/realtime.d.ts +9 -0
  35. package/dist/realtime.js +1050 -0
  36. package/dist/realtime.mjs +1021 -0
  37. package/dist/resource.d.mts +1 -0
  38. package/dist/resource.d.ts +1 -0
  39. package/dist/resource.js +52 -0
  40. package/dist/resource.mjs +27 -0
  41. package/dist/server-client.d.mts +60 -0
  42. package/dist/server-client.d.ts +60 -0
  43. package/dist/server-client.js +1984 -0
  44. package/dist/server-client.mjs +1954 -0
  45. package/dist/storage.d.mts +149 -0
  46. package/dist/storage.d.ts +149 -0
  47. package/dist/storage.js +243 -0
  48. package/dist/storage.mjs +211 -0
  49. package/dist/streams.d.mts +1 -0
  50. package/dist/streams.d.ts +1 -0
  51. package/dist/streams.js +267 -0
  52. package/dist/streams.mjs +242 -0
  53. package/dist/types.d.mts +1 -0
  54. package/dist/types.d.ts +1 -0
  55. package/dist/types.js +19 -0
  56. package/dist/types.mjs +1 -0
  57. package/package.json +139 -0
package/dist/auth.mjs ADDED
@@ -0,0 +1,433 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // src/auth.ts
6
+ import { jwtDecode } from "jwt-decode";
7
+
8
+ // src/errors.ts
9
+ var SDKError = class extends Error {
10
+ /**
11
+ * Construct an SDKError. Signature is compatible with Error.
12
+ * You can pass in a message or an options object, as with the Error constructor.
13
+ * Additional fields (code, etc) may be added via the second argument.
14
+ */
15
+ constructor(message, details = {}) {
16
+ const resolvedMessage = message ?? (typeof details.message === "string" ? details.message : "Unknown error");
17
+ super(resolvedMessage);
18
+ /**
19
+ * Canonical SDK error code.
20
+ */
21
+ __publicField(this, "code");
22
+ /**
23
+ * HTTP status code if available.
24
+ */
25
+ __publicField(this, "statusCode");
26
+ /**
27
+ * End-user safe message.
28
+ */
29
+ __publicField(this, "userMessage");
30
+ /**
31
+ * Optional request metadata (null when unavailable).
32
+ */
33
+ __publicField(this, "request");
34
+ /**
35
+ * Optional response metadata (null when unavailable).
36
+ */
37
+ __publicField(this, "response");
38
+ Object.setPrototypeOf(this, new.target.prototype);
39
+ if (details && typeof details === "object") {
40
+ for (const [key, value] of Object.entries(details)) {
41
+ if (!["name", "message", "stack"].includes(key)) {
42
+ this[key] = value;
43
+ }
44
+ }
45
+ }
46
+ this.name = "SDKError";
47
+ this.code = details.code ?? "unknown_error";
48
+ this.statusCode = typeof details.statusCode === "number" ? details.statusCode : void 0;
49
+ this.userMessage = typeof details.userMessage === "string" ? details.userMessage : this.message;
50
+ this.request = details.request ?? null;
51
+ this.response = details.response ?? null;
52
+ }
53
+ /**
54
+ * Serialize the error into a plain object, preserving extra fields.
55
+ */
56
+ toJSON() {
57
+ const extras = { ...this };
58
+ delete extras.code;
59
+ delete extras.statusCode;
60
+ delete extras.message;
61
+ delete extras.userMessage;
62
+ delete extras.request;
63
+ delete extras.response;
64
+ delete extras.form;
65
+ delete extras.cause;
66
+ return {
67
+ ...extras,
68
+ code: this.code,
69
+ statusCode: this.statusCode,
70
+ message: this.message,
71
+ userMessage: this.userMessage,
72
+ request: this.request,
73
+ response: this.response
74
+ };
75
+ }
76
+ };
77
+ var STATUS_CODE_DEFAULTS = {
78
+ 401: {
79
+ code: "authentication_required",
80
+ message: "Authentication required",
81
+ userMessage: "Please log in to continue. Your session may have expired."
82
+ },
83
+ 403: {
84
+ code: "permission_denied",
85
+ message: "Permission denied",
86
+ userMessage: "You do not have permission to perform this action."
87
+ },
88
+ 404: {
89
+ code: "not_found",
90
+ message: "Resource not found",
91
+ userMessage: "The requested resource was not found."
92
+ },
93
+ 422: {
94
+ code: "validation_failed",
95
+ message: "Validation failed",
96
+ userMessage: "The provided information is invalid. Please check your input and try again."
97
+ },
98
+ 429: {
99
+ code: "rate_limited",
100
+ message: "Rate limit exceeded",
101
+ userMessage: "Too many requests. Please wait a moment and try again."
102
+ },
103
+ 500: {
104
+ code: "server_error",
105
+ message: "Internal server error",
106
+ userMessage: "Something went wrong on our end. Please try again later."
107
+ }
108
+ };
109
+ var DEFAULT_ERROR = {
110
+ code: "unknown_error",
111
+ userMessage: "An unexpected error occurred. Please try again."
112
+ };
113
+ function createSdkError(message, details = {}) {
114
+ const statusCode = details.response?.status;
115
+ const statusValues = statusCode && STATUS_CODE_DEFAULTS[statusCode] ? STATUS_CODE_DEFAULTS[statusCode] : DEFAULT_ERROR;
116
+ const enrichedDetails = {
117
+ ...details,
118
+ statusCode,
119
+ code: details.code ?? statusValues.code,
120
+ userMessage: details.userMessage ?? statusValues.userMessage,
121
+ request: details.request ?? null,
122
+ response: details.response ?? null
123
+ };
124
+ return new SDKError(message, enrichedDetails);
125
+ }
126
+
127
+ // src/storage.ts
128
+ var DEFAULT_AUTH_COOKIE_NAME = "auth_token";
129
+ var NoopStorageAdapter = class {
130
+ /**
131
+ * Read a stored value (always null).
132
+ */
133
+ get() {
134
+ return null;
135
+ }
136
+ /**
137
+ * Persist a stored value (no-op).
138
+ */
139
+ set() {
140
+ }
141
+ /**
142
+ * Delete a stored value (no-op).
143
+ */
144
+ delete() {
145
+ }
146
+ };
147
+
148
+ // src/auth.ts
149
+ var DEFAULT_REFRESH_THRESHOLD_SECONDS = 60;
150
+ var getTokenExpiry = (token) => {
151
+ try {
152
+ const payload = jwtDecode(token);
153
+ const exp = payload?.exp;
154
+ return typeof exp === "number" ? exp : null;
155
+ } catch (error) {
156
+ const message = error instanceof Error ? error.message : "Failed to decode token";
157
+ throw createSdkError(message);
158
+ }
159
+ };
160
+ var AuthClient = class {
161
+ /**
162
+ * Create a new auth client instance.
163
+ */
164
+ constructor(http, options = {}) {
165
+ __publicField(this, "http");
166
+ __publicField(this, "storage");
167
+ __publicField(this, "storageKey");
168
+ __publicField(this, "refreshEnabled");
169
+ __publicField(this, "refreshThresholdSeconds");
170
+ __publicField(this, "serviceKey");
171
+ __publicField(this, "currentSession", null);
172
+ __publicField(this, "stateListeners", /* @__PURE__ */ new Set());
173
+ __publicField(this, "restorePromise", null);
174
+ /**
175
+ * Track whether storage restoration has already been attempted.
176
+ */
177
+ __publicField(this, "restoreAttempted", false);
178
+ this.http = http;
179
+ this.storage = options.storage ?? new NoopStorageAdapter();
180
+ this.storageKey = options.storageKey ?? DEFAULT_AUTH_COOKIE_NAME;
181
+ this.refreshEnabled = options.autoRefresh ?? false;
182
+ this.refreshThresholdSeconds = options.refreshThresholdSeconds ?? DEFAULT_REFRESH_THRESHOLD_SECONDS;
183
+ this.serviceKey = options.serviceKey ?? null;
184
+ this.registerAuthHook();
185
+ }
186
+ /**
187
+ * Set the current bearer token, or clear it when null.
188
+ */
189
+ async setToken(token) {
190
+ if (!token) {
191
+ await this.storage.delete(this.storageKey);
192
+ this.currentSession = null;
193
+ this.emitState("SIGNED_OUT", null);
194
+ return null;
195
+ }
196
+ return this.applyToken(token, "SIGNED_IN");
197
+ }
198
+ /**
199
+ * Get the currently configured token (if any).
200
+ */
201
+ getToken() {
202
+ return this.currentSession ?? this.serviceKey ?? null;
203
+ }
204
+ /**
205
+ * Clear the current token and session.
206
+ */
207
+ async clearToken() {
208
+ await this.setToken(null);
209
+ }
210
+ /**
211
+ * Sign in using a JWT token.
212
+ */
213
+ async signInWithToken(token, options = {}) {
214
+ if (options.verifySession) {
215
+ this.assertTokenNotExpired(token);
216
+ }
217
+ return this.applyToken(token, "SIGNED_IN");
218
+ }
219
+ /**
220
+ * Sign in using email/password credentials.
221
+ */
222
+ async signIn(payload) {
223
+ const { data, request, response } = await this.http.requestWithMetadata(
224
+ "/v2/auth/login",
225
+ {
226
+ method: "POST",
227
+ body: JSON.stringify(payload)
228
+ }
229
+ );
230
+ const token = this.resolveTokenFromResponse(data, { request, response });
231
+ return this.applyToken(token, "SIGNED_IN");
232
+ }
233
+ /**
234
+ * Sign out the current user.
235
+ */
236
+ async signOut() {
237
+ try {
238
+ await this.http.request("/v2/auth/logout", { method: "POST" });
239
+ } finally {
240
+ await this.clearToken();
241
+ }
242
+ }
243
+ /**
244
+ * Get the current session, restoring from storage if needed.
245
+ */
246
+ async getSession() {
247
+ if (this.currentSession) {
248
+ return this.currentSession;
249
+ }
250
+ await this.restoreFromStorage();
251
+ return this.currentSession;
252
+ }
253
+ /**
254
+ * Refresh the current session token.
255
+ * Manual refresh is always available; automatic refresh is controlled
256
+ * by the `autoRefresh` option.
257
+ */
258
+ async refreshToken() {
259
+ if (this.isUsingServiceKey()) {
260
+ throw createSdkError("Token refresh is unavailable when using a service key");
261
+ }
262
+ try {
263
+ const { data, request, response } = await this.http.requestWithMetadata(
264
+ "/v2/auth/refresh",
265
+ { method: "POST" }
266
+ );
267
+ const token = this.resolveTokenFromResponse(data, { request, response });
268
+ return await this.applyToken(token, "TOKEN_REFRESHED");
269
+ } catch (error) {
270
+ await this.clearToken();
271
+ throw error;
272
+ }
273
+ }
274
+ /**
275
+ * Subscribe to auth state changes.
276
+ */
277
+ onAuthStateChange(callback) {
278
+ this.stateListeners.add(callback);
279
+ return () => {
280
+ this.stateListeners.delete(callback);
281
+ };
282
+ }
283
+ emitState(event, token) {
284
+ for (const listener of this.stateListeners) {
285
+ listener(event, token);
286
+ }
287
+ }
288
+ /**
289
+ * Register the auth header hook for outgoing HTTP requests.
290
+ */
291
+ registerAuthHook() {
292
+ this.http.onBeforeRequest(async (request) => {
293
+ if (!this.http.isSameOrigin(request.url)) {
294
+ return;
295
+ }
296
+ const token = await this.resolveRequestToken();
297
+ if (!token) {
298
+ return;
299
+ }
300
+ const headers = {
301
+ ...request.init.headers ?? {}
302
+ };
303
+ if (headers.Authorization || headers.authorization) {
304
+ return;
305
+ }
306
+ return {
307
+ ...request,
308
+ init: {
309
+ ...request.init,
310
+ headers: {
311
+ ...headers,
312
+ Authorization: `Bearer ${token}`
313
+ }
314
+ }
315
+ };
316
+ });
317
+ }
318
+ /**
319
+ * Resolve the bearer token to use for outgoing requests.
320
+ */
321
+ async resolveRequestToken() {
322
+ if (this.currentSession) {
323
+ return this.currentSession;
324
+ }
325
+ if (this.serviceKey) {
326
+ return this.serviceKey;
327
+ }
328
+ return await this.getSession();
329
+ }
330
+ /**
331
+ * Persist a token update and notify listeners.
332
+ */
333
+ async applyToken(token, event) {
334
+ await Promise.resolve(this.storage.set(this.storageKey, token));
335
+ this.currentSession = token;
336
+ this.emitState(event, token);
337
+ return token;
338
+ }
339
+ /**
340
+ * Restore a persisted token from storage when needed.
341
+ */
342
+ async restoreFromStorage() {
343
+ if (this.restorePromise) {
344
+ return this.restorePromise;
345
+ }
346
+ if (this.restoreAttempted) {
347
+ return;
348
+ }
349
+ if (this.serviceKey) {
350
+ this.restoreAttempted = true;
351
+ return;
352
+ }
353
+ this.restorePromise = (async () => {
354
+ const storedToken = await Promise.resolve(
355
+ this.storage.get(this.storageKey)
356
+ );
357
+ if (!storedToken) {
358
+ return;
359
+ }
360
+ let exp = null;
361
+ if (this.refreshEnabled) {
362
+ try {
363
+ exp = getTokenExpiry(storedToken);
364
+ } catch {
365
+ this.currentSession = null;
366
+ await Promise.resolve(this.storage.delete(this.storageKey));
367
+ return;
368
+ }
369
+ }
370
+ const hadSession = this.currentSession !== null;
371
+ this.currentSession = storedToken;
372
+ if (!hadSession) {
373
+ this.emitState("SIGNED_IN", storedToken);
374
+ }
375
+ if (this.refreshEnabled && exp !== null) {
376
+ const now = Math.floor(Date.now() / 1e3);
377
+ if (exp - now <= this.refreshThresholdSeconds) {
378
+ try {
379
+ await this.refreshToken();
380
+ } catch {
381
+ }
382
+ }
383
+ }
384
+ })();
385
+ try {
386
+ await this.restorePromise;
387
+ } finally {
388
+ this.restorePromise = null;
389
+ this.restoreAttempted = true;
390
+ }
391
+ }
392
+ /**
393
+ * Determine if the client is currently using the service key.
394
+ */
395
+ isUsingServiceKey() {
396
+ return !!this.serviceKey && !this.currentSession;
397
+ }
398
+ /**
399
+ * Resolve the auth token from a response payload and request metadata.
400
+ */
401
+ resolveTokenFromResponse(response, metadata) {
402
+ if (response.error || response.error_description) {
403
+ const message = response.error_description ?? response.error ?? "Authentication failed";
404
+ throw createSdkError(message, {
405
+ request: metadata.request,
406
+ response: metadata.response,
407
+ userMessage: message
408
+ });
409
+ }
410
+ const token = response.access_token ?? response.token;
411
+ if (!token) {
412
+ throw createSdkError("Missing access token in response", {
413
+ request: metadata.request,
414
+ response: metadata.response
415
+ });
416
+ }
417
+ return token;
418
+ }
419
+ assertTokenNotExpired(token) {
420
+ const exp = getTokenExpiry(token);
421
+ if (exp === null) {
422
+ return;
423
+ }
424
+ const now = Math.floor(Date.now() / 1e3);
425
+ if (exp < now) {
426
+ throw createSdkError("Token has expired");
427
+ }
428
+ }
429
+ };
430
+ export {
431
+ AuthClient
432
+ };
433
+ //# sourceMappingURL=auth.mjs.map
@@ -0,0 +1,70 @@
1
+ import { h as SdkClient, A as AuthClient, a as HttpClient, S as StreamsClient, C as ChannelsClient, g as ChatClient, b as AuthClientOptions, _ as RealtimeClientOverrides, z as StorageAdapter } from './auth-CRWthQ_B.mjs';
2
+
3
+ /**
4
+ * Shared SDK client base class for browser and server implementations.
5
+ */
6
+
7
+ /**
8
+ * Shared options for SDK client construction.
9
+ */
10
+ interface BaseClientOptions {
11
+ /**
12
+ * Auth configuration overrides for the client.
13
+ */
14
+ auth?: AuthClientOptions;
15
+ /**
16
+ * Default headers to apply to each request.
17
+ */
18
+ headers?: Record<string, string>;
19
+ /**
20
+ * Fetch implementation override (primarily for tests).
21
+ */
22
+ fetch?: typeof fetch;
23
+ /**
24
+ * Realtime configuration for the client.
25
+ */
26
+ realtime?: RealtimeClientOverrides;
27
+ /**
28
+ * Storage adapter resolved by the runtime client.
29
+ */
30
+ storage: StorageAdapter;
31
+ /**
32
+ * Optional service key override.
33
+ */
34
+ serviceKey?: string | null;
35
+ }
36
+ /**
37
+ * Base SDK client wrapper exposing shared HTTP and auth helpers.
38
+ */
39
+ declare abstract class BaseSdkClient implements SdkClient {
40
+ /**
41
+ * Auth client instance.
42
+ */
43
+ readonly auth: AuthClient;
44
+ /**
45
+ * HTTP client instance.
46
+ */
47
+ readonly http: HttpClient;
48
+ /**
49
+ * Realtime client instance.
50
+ */
51
+ readonly realtime: SdkClient["realtime"];
52
+ /**
53
+ * Streams namespace client.
54
+ */
55
+ readonly streams: StreamsClient;
56
+ /**
57
+ * Channels namespace client.
58
+ */
59
+ readonly channels: ChannelsClient;
60
+ /**
61
+ * Chat namespace client.
62
+ */
63
+ readonly chat: ChatClient;
64
+ /**
65
+ * Create a new SDK client base instance.
66
+ */
67
+ protected constructor(baseUrl: string, options: BaseClientOptions);
68
+ }
69
+
70
+ export { BaseSdkClient as B };
@@ -0,0 +1,70 @@
1
+ import { h as SdkClient, A as AuthClient, a as HttpClient, S as StreamsClient, C as ChannelsClient, g as ChatClient, b as AuthClientOptions, _ as RealtimeClientOverrides, z as StorageAdapter } from './auth-CRWthQ_B.js';
2
+
3
+ /**
4
+ * Shared SDK client base class for browser and server implementations.
5
+ */
6
+
7
+ /**
8
+ * Shared options for SDK client construction.
9
+ */
10
+ interface BaseClientOptions {
11
+ /**
12
+ * Auth configuration overrides for the client.
13
+ */
14
+ auth?: AuthClientOptions;
15
+ /**
16
+ * Default headers to apply to each request.
17
+ */
18
+ headers?: Record<string, string>;
19
+ /**
20
+ * Fetch implementation override (primarily for tests).
21
+ */
22
+ fetch?: typeof fetch;
23
+ /**
24
+ * Realtime configuration for the client.
25
+ */
26
+ realtime?: RealtimeClientOverrides;
27
+ /**
28
+ * Storage adapter resolved by the runtime client.
29
+ */
30
+ storage: StorageAdapter;
31
+ /**
32
+ * Optional service key override.
33
+ */
34
+ serviceKey?: string | null;
35
+ }
36
+ /**
37
+ * Base SDK client wrapper exposing shared HTTP and auth helpers.
38
+ */
39
+ declare abstract class BaseSdkClient implements SdkClient {
40
+ /**
41
+ * Auth client instance.
42
+ */
43
+ readonly auth: AuthClient;
44
+ /**
45
+ * HTTP client instance.
46
+ */
47
+ readonly http: HttpClient;
48
+ /**
49
+ * Realtime client instance.
50
+ */
51
+ readonly realtime: SdkClient["realtime"];
52
+ /**
53
+ * Streams namespace client.
54
+ */
55
+ readonly streams: StreamsClient;
56
+ /**
57
+ * Channels namespace client.
58
+ */
59
+ readonly channels: ChannelsClient;
60
+ /**
61
+ * Chat namespace client.
62
+ */
63
+ readonly chat: ChatClient;
64
+ /**
65
+ * Create a new SDK client base instance.
66
+ */
67
+ protected constructor(baseUrl: string, options: BaseClientOptions);
68
+ }
69
+
70
+ export { BaseSdkClient as B };
@@ -0,0 +1,47 @@
1
+ import { b as AuthClientOptions, _ as RealtimeClientOverrides, h as SdkClient } from './auth-CRWthQ_B.mjs';
2
+ import { B as BaseSdkClient } from './base-client-BmVTsKhL.mjs';
3
+
4
+ /**
5
+ * Browser client entrypoint for the SDK core package.
6
+ */
7
+
8
+ /**
9
+ * Options for creating a browser SDK client instance.
10
+ */
11
+ interface ClientFactoryOptions {
12
+ /**
13
+ * Auth configuration overrides for the client.
14
+ */
15
+ auth?: AuthClientOptions;
16
+ /**
17
+ * Default headers to apply to each request.
18
+ */
19
+ headers?: Record<string, string>;
20
+ /**
21
+ * Fetch implementation override (primarily for tests).
22
+ */
23
+ fetch?: typeof fetch;
24
+ /**
25
+ * Realtime configuration for the client (baseUrl/getToken are provided internally).
26
+ */
27
+ realtime?: RealtimeClientOverrides;
28
+ }
29
+ /**
30
+ * Browser SDK client wrapper exposing HTTP and auth helpers.
31
+ */
32
+ declare class BrowserClient extends BaseSdkClient implements SdkClient {
33
+ /**
34
+ * Create a browser client instance.
35
+ */
36
+ constructor(baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions);
37
+ }
38
+ /**
39
+ * Create a browser-oriented SDK client.
40
+ */
41
+ declare const createBrowserClient: (baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions) => SdkClient;
42
+ /**
43
+ * Create a browser-oriented SDK client (alias for `createBrowserClient`).
44
+ */
45
+ declare const createClient: (baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions) => SdkClient;
46
+
47
+ export { BrowserClient, type ClientFactoryOptions, createBrowserClient, createClient };
@@ -0,0 +1,47 @@
1
+ import { b as AuthClientOptions, _ as RealtimeClientOverrides, h as SdkClient } from './auth-CRWthQ_B.js';
2
+ import { B as BaseSdkClient } from './base-client-Dk56EJj-.js';
3
+
4
+ /**
5
+ * Browser client entrypoint for the SDK core package.
6
+ */
7
+
8
+ /**
9
+ * Options for creating a browser SDK client instance.
10
+ */
11
+ interface ClientFactoryOptions {
12
+ /**
13
+ * Auth configuration overrides for the client.
14
+ */
15
+ auth?: AuthClientOptions;
16
+ /**
17
+ * Default headers to apply to each request.
18
+ */
19
+ headers?: Record<string, string>;
20
+ /**
21
+ * Fetch implementation override (primarily for tests).
22
+ */
23
+ fetch?: typeof fetch;
24
+ /**
25
+ * Realtime configuration for the client (baseUrl/getToken are provided internally).
26
+ */
27
+ realtime?: RealtimeClientOverrides;
28
+ }
29
+ /**
30
+ * Browser SDK client wrapper exposing HTTP and auth helpers.
31
+ */
32
+ declare class BrowserClient extends BaseSdkClient implements SdkClient {
33
+ /**
34
+ * Create a browser client instance.
35
+ */
36
+ constructor(baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions);
37
+ }
38
+ /**
39
+ * Create a browser-oriented SDK client.
40
+ */
41
+ declare const createBrowserClient: (baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions) => SdkClient;
42
+ /**
43
+ * Create a browser-oriented SDK client (alias for `createBrowserClient`).
44
+ */
45
+ declare const createClient: (baseUrl: string, keyOverride?: string | null, options?: ClientFactoryOptions) => SdkClient;
46
+
47
+ export { BrowserClient, type ClientFactoryOptions, createBrowserClient, createClient };