@dvina/sdk 4.1.111 → 4.1.173
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 +37 -134
- package/dist/_generated_documents-6WGCKLGZ.js +1 -0
- package/dist/_generated_sdk-7_X86mtI.d.ts +17341 -0
- package/dist/adapters/react/index.d.ts +36 -24
- package/dist/adapters/react/index.js +1 -1
- package/dist/ai/index.d.ts +570 -0
- package/dist/ai/index.js +3 -0
- package/dist/billing/index.d.ts +43 -15
- package/dist/billing/index.js +1 -1
- package/dist/chunk-32KGDH2Q.js +1 -0
- package/dist/chunk-37LLNIGO.js +1 -0
- package/dist/chunk-OCM5W3JH.js +1 -0
- package/dist/chunk-W764PDVJ.js +31 -0
- package/dist/chunk-Z2ADTQ64.js +1 -0
- package/dist/{sync-engine-DYHreGOv.d.ts → connection-ClMdDUce.d.ts} +223 -11
- package/dist/{error-CsVoUTY8.d.ts → error-Bk0Jmuzd.d.ts} +11 -3
- package/dist/index.d.ts +24 -3523
- package/dist/index.js +4 -1
- package/dist/package.json +8 -13
- package/dist/pagination/index.d.ts +18 -4
- package/dist/pagination/index.js +1 -1
- package/dist/{types-Chg8ASmf.d.ts → types-BfiQdtra.d.ts} +1 -9
- package/package.json +26 -21
- package/dist/_generated_documents-HFKWCKIO.js +0 -1
- package/dist/adapters/angular/index.d.ts +0 -254
- package/dist/adapters/angular/index.js +0 -1
- package/dist/chunk-2EXM4BMP.js +0 -1
- package/dist/chunk-5E7LX4YQ.js +0 -1
- package/dist/chunk-G34ETQUN.js +0 -1
- package/dist/chunk-H3TI6B7T.js +0 -1
- package/dist/chunk-IIQ3WGOJ.js +0 -1
- package/dist/chunk-V5FAQENQ.js +0 -5
- package/dist/chunk-YUQTEBYO.js +0 -31
- package/dist/client-Bb2gD6Iz.d.ts +0 -488
- package/dist/client-OupfxAUq.d.ts +0 -7949
- package/dist/index-DoGg4ya_.d.ts +0 -79
- package/dist/inference/index.d.ts +0 -80
- package/dist/inference/index.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { D as DvinaQueryRef, M as MutationOptions, c as DvinaRequest, P as PageInfoData, C as ConnectionVariables, F as FetchOptions } from './types-BfiQdtra.js';
|
|
1
2
|
import { DocumentNode } from 'graphql';
|
|
2
3
|
import * as dexie from 'dexie';
|
|
3
4
|
import { Dexie, Table } from 'dexie';
|
|
4
|
-
import {
|
|
5
|
-
import { a as DvinaQueryRef, M as MutationOptions } from './types-Chg8ASmf.js';
|
|
5
|
+
import { b as DvinaError, D as DvinaAuthenticationError, a as DvinaForbiddenError, d as DvinaNetworkError } from './error-Bk0Jmuzd.js';
|
|
6
6
|
|
|
7
7
|
/** Cached result metadata for a specific query + variables combination */
|
|
8
8
|
interface QueryResultEntry {
|
|
@@ -73,6 +73,9 @@ interface EntityRecord {
|
|
|
73
73
|
declare class DvinaDatabase {
|
|
74
74
|
db: Dexie;
|
|
75
75
|
private readonly _dbName;
|
|
76
|
+
private _heartbeat;
|
|
77
|
+
readonly workspaceId: string;
|
|
78
|
+
readonly userId: string;
|
|
76
79
|
/**
|
|
77
80
|
* Resolves when the schema-hash check is complete.
|
|
78
81
|
* Consumers that depend on a consistent schema should await this before
|
|
@@ -81,6 +84,20 @@ declare class DvinaDatabase {
|
|
|
81
84
|
*/
|
|
82
85
|
readonly ready: Promise<void>;
|
|
83
86
|
constructor(workspaceId: string, userId: string);
|
|
87
|
+
/**
|
|
88
|
+
* Records this version's database in the registry (first, so it is never taken for a stray one), opens it, and
|
|
89
|
+
* then removes the workspace+user's stale versions without waiting for that. A long-open tab keeps telling the
|
|
90
|
+
* registry it is in use.
|
|
91
|
+
*/
|
|
92
|
+
private _open;
|
|
93
|
+
private _register;
|
|
94
|
+
/**
|
|
95
|
+
* A Dexie instance for this database. When another tab removes it (a sign-out there, or a version opened there
|
|
96
|
+
* long after this one), this tab closes its connection at once, so the removal is never blocked, and moves to a
|
|
97
|
+
* fresh, empty database of the same name: its reads keep working, from the network, and the app is told so it
|
|
98
|
+
* can offer a reload.
|
|
99
|
+
*/
|
|
100
|
+
private _createDexie;
|
|
84
101
|
/**
|
|
85
102
|
* Verify that the stored schema hash matches the current codegen hash.
|
|
86
103
|
* If the hashes differ the database is deleted and recreated so that
|
|
@@ -105,6 +122,10 @@ declare class DvinaDatabase {
|
|
|
105
122
|
getLastSyncId(): Promise<string>;
|
|
106
123
|
/** Persist the last processed sync event ID. */
|
|
107
124
|
setLastSyncId(syncId: string): Promise<void>;
|
|
125
|
+
/** When the store was last known to be current (ms since epoch), or null if it never was on this device. */
|
|
126
|
+
getLiveAt(): Promise<number | null>;
|
|
127
|
+
/** Persist when the store was last known to be current. */
|
|
128
|
+
setLiveAt(liveAt: number): Promise<void>;
|
|
108
129
|
/** Get the last applied remote cache epoch, or 0 if none. */
|
|
109
130
|
getCacheEpoch(): Promise<number>;
|
|
110
131
|
/** Persist the last applied remote cache epoch. */
|
|
@@ -132,6 +153,12 @@ declare function closeDatabase(token: string): void;
|
|
|
132
153
|
* Use with caution — this wipes all cached data for the workspace+user.
|
|
133
154
|
*/
|
|
134
155
|
declare function deleteDatabase(token: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Remove everything the user keeps on this device: their databases in every workspace and of every SDK version, and
|
|
158
|
+
* their registry entries. Call on sign-out and account deletion, so nothing of theirs is left for the next person on
|
|
159
|
+
* a shared device. Never throws.
|
|
160
|
+
*/
|
|
161
|
+
declare function deleteUserLocalData(userId: string): Promise<void>;
|
|
135
162
|
|
|
136
163
|
interface HttpTransportOptions {
|
|
137
164
|
/** Full GraphQL HTTP endpoint URL (e.g. 'https://api.dvina.ai/graphql') */
|
|
@@ -160,9 +187,13 @@ interface HttpTransportOptions {
|
|
|
160
187
|
*/
|
|
161
188
|
onError?: (error: DvinaError) => void;
|
|
162
189
|
}
|
|
190
|
+
/** How one request reports: `reportErrors: false` keeps its failure from `onError` (a failed sign-in still goes). */
|
|
191
|
+
interface HttpRequestOptions {
|
|
192
|
+
reportErrors?: boolean;
|
|
193
|
+
}
|
|
163
194
|
interface HttpTransport {
|
|
164
195
|
/** Execute a GraphQL query or mutation */
|
|
165
|
-
request: <T>(document: DocumentNode, variables?: Record<string, unknown
|
|
196
|
+
request: <T>(document: DocumentNode, variables?: Record<string, unknown>, options?: HttpRequestOptions) => Promise<T>;
|
|
166
197
|
}
|
|
167
198
|
/**
|
|
168
199
|
* Create a fetch-based GraphQL HTTP transport with:
|
|
@@ -194,12 +225,18 @@ interface SseSyncEvent {
|
|
|
194
225
|
payload: Record<string, unknown> | null;
|
|
195
226
|
}
|
|
196
227
|
interface SseQueryEvent {
|
|
197
|
-
|
|
228
|
+
/**
|
|
229
|
+
* `add`/`remove`: an entity entered or left the subscription's set; `resync`: read the list again; `count`: how many
|
|
230
|
+
* the set holds now (`totalCount`), which the server sends after its adds and removes settle and after a catch-up.
|
|
231
|
+
*/
|
|
232
|
+
type: 'add' | 'remove' | 'resync' | 'count';
|
|
198
233
|
subscriptionId: string;
|
|
199
234
|
entityId?: string;
|
|
200
235
|
entityType: string;
|
|
236
|
+
totalCount?: number;
|
|
201
237
|
}
|
|
202
|
-
|
|
238
|
+
declare const REALTIME_EVENT_TOPICS: readonly ["active-chats", "desktop-device-presence", "mcp-auth", "token-usage-status", "user-notification"];
|
|
239
|
+
type RealtimeEventTopic = (typeof REALTIME_EVENT_TOPICS)[number];
|
|
203
240
|
interface SseRealtimeEvent {
|
|
204
241
|
topic: RealtimeEventTopic;
|
|
205
242
|
type: string;
|
|
@@ -236,12 +273,20 @@ interface SseTransportOptions {
|
|
|
236
273
|
onCursor?: (syncId: string) => void;
|
|
237
274
|
/** Called when the server signals that the sync gap is unrecoverable and a full resync is needed */
|
|
238
275
|
onFullResync?: () => void;
|
|
276
|
+
/**
|
|
277
|
+
* Called once a connection has caught up: the missed events before it are applied, and every later event is live.
|
|
278
|
+
* A server too old to send it never calls it.
|
|
279
|
+
*/
|
|
280
|
+
onSynced?: () => void;
|
|
239
281
|
/** Called after a reconnect successfully re-registers active subscriptions */
|
|
240
282
|
onReconnect?: () => void;
|
|
241
283
|
/** Called on connection state changes */
|
|
242
284
|
onStateChange?: (state: 'connecting' | 'connected' | 'disconnected') => void;
|
|
243
|
-
/**
|
|
244
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Called when auth recovery fails permanently, when the API refuses the stream (403), and when the token is
|
|
287
|
+
* another cell's (421 WRONG_CELL: a DvinaNetworkError with status 421; the stream keeps retrying meanwhile).
|
|
288
|
+
*/
|
|
289
|
+
onError?: (error: DvinaAuthenticationError | DvinaForbiddenError | DvinaNetworkError) => void;
|
|
245
290
|
}
|
|
246
291
|
interface SseTransport {
|
|
247
292
|
/** Start the SSE connection */
|
|
@@ -263,6 +308,63 @@ interface SseTransport {
|
|
|
263
308
|
}
|
|
264
309
|
declare function createSseTransport(options: SseTransportOptions): SseTransport;
|
|
265
310
|
|
|
311
|
+
/**
|
|
312
|
+
* Whether the local store is current: `live` once the delta-sync stream has caught up (the server's `synced`, after
|
|
313
|
+
* the missed events are applied) and no full resync is running; `syncing` while it connects, catches up or resyncs;
|
|
314
|
+
* `disconnected` while the stream is down. `liveAt` is when the store was last known to be current: now, while it is
|
|
315
|
+
* live; the moment it stopped being live, afterwards (kept on the device, so an app opened offline still knows).
|
|
316
|
+
*/
|
|
317
|
+
type SyncState = 'live' | 'syncing' | 'disconnected';
|
|
318
|
+
interface SyncStatus {
|
|
319
|
+
state: SyncState;
|
|
320
|
+
liveAt: number | null;
|
|
321
|
+
}
|
|
322
|
+
interface SyncStatusSource {
|
|
323
|
+
get(): SyncStatus;
|
|
324
|
+
subscribe(listener: () => void): () => void;
|
|
325
|
+
}
|
|
326
|
+
interface SyncStatusStoreOptions {
|
|
327
|
+
saveLiveAt: (liveAt: number) => Promise<void>;
|
|
328
|
+
now?: () => number;
|
|
329
|
+
fallbackAfterMs?: number;
|
|
330
|
+
}
|
|
331
|
+
/** Follows the stream's state and the server's `synced` into a status the app can show; see SyncStatus. */
|
|
332
|
+
declare class SyncStatusStore implements SyncStatusSource {
|
|
333
|
+
private readonly _options;
|
|
334
|
+
private _status;
|
|
335
|
+
private _connected;
|
|
336
|
+
private _syncedSinceConnect;
|
|
337
|
+
private _resyncing;
|
|
338
|
+
/** Whether the API said its stream marks `synced`: then it is waited for, with no fallback. */
|
|
339
|
+
private _serverMarksSynced;
|
|
340
|
+
private _fallbackTimer;
|
|
341
|
+
private _saveTimer;
|
|
342
|
+
private readonly _listeners;
|
|
343
|
+
private readonly _now;
|
|
344
|
+
constructor(_options: SyncStatusStoreOptions);
|
|
345
|
+
get(): SyncStatus;
|
|
346
|
+
subscribe(listener: () => void): () => void;
|
|
347
|
+
/** The moment kept from an earlier session; a later moment of this one wins. */
|
|
348
|
+
restoreLiveAt(liveAt: number | null): void;
|
|
349
|
+
transportState(state: 'connecting' | 'connected' | 'disconnected'): void;
|
|
350
|
+
/** The server's `synced`: everything before it is applied. */
|
|
351
|
+
synced(): void;
|
|
352
|
+
/** What the API's policy says: whether its stream marks `synced` (an older API does not). */
|
|
353
|
+
serverMarksSynced(marks: boolean): void;
|
|
354
|
+
resyncStarted(): void;
|
|
355
|
+
resyncFinished(): void;
|
|
356
|
+
/** Stops keeping the moment while live (the session is over). */
|
|
357
|
+
dispose(): void;
|
|
358
|
+
/** Applies a candidate state; it is live only when connected, caught up and not resyncing. */
|
|
359
|
+
private _update;
|
|
360
|
+
private _startFallback;
|
|
361
|
+
private _stopFallback;
|
|
362
|
+
private _startSaving;
|
|
363
|
+
private _stopSaving;
|
|
364
|
+
private _save;
|
|
365
|
+
private _set;
|
|
366
|
+
}
|
|
367
|
+
|
|
266
368
|
/**
|
|
267
369
|
* Convention-based cache rules generated by codegen.
|
|
268
370
|
* These tell the SyncEngine how to update the local store after a mutation.
|
|
@@ -304,6 +406,8 @@ interface SyncEngineOptions {
|
|
|
304
406
|
httpTransport: HttpTransport;
|
|
305
407
|
/** Optional SSE transport for delta sync (browser-only) */
|
|
306
408
|
sseTransport?: SseTransport;
|
|
409
|
+
/** Where the engine reports whether the store is current; one is made when not given. */
|
|
410
|
+
syncStatus?: SyncStatusStore;
|
|
307
411
|
}
|
|
308
412
|
interface WatchedRelationMetadata {
|
|
309
413
|
fieldName: string;
|
|
@@ -337,6 +441,9 @@ declare class SyncEngine {
|
|
|
337
441
|
private _cache;
|
|
338
442
|
private _queryExecutor;
|
|
339
443
|
private _mutationExecutor;
|
|
444
|
+
private _syncStatus;
|
|
445
|
+
/** Whether the local store is current (live), and since when it is not (see SyncStatus). */
|
|
446
|
+
get syncStatus(): SyncStatusSource;
|
|
340
447
|
/**
|
|
341
448
|
* Maps subscriptionId → queryKey for routing server-driven query events
|
|
342
449
|
* to the correct cache entry. Populated by watch() when a subscription
|
|
@@ -345,10 +452,28 @@ declare class SyncEngine {
|
|
|
345
452
|
private _subscriptionToQueryKey;
|
|
346
453
|
/** Active subscription metadata used for targeted revalidation fallback. */
|
|
347
454
|
private _subscriptionToQuery;
|
|
455
|
+
/**
|
|
456
|
+
* The one server subscription each watched query holds, with how many watches share it: the same query
|
|
457
|
+
* watched in many places registers once, so a client does not run into the server's per-user limit.
|
|
458
|
+
*/
|
|
459
|
+
private _serverSubscriptions;
|
|
348
460
|
/** Last per-query revalidation timestamp to avoid refetch storms. */
|
|
349
461
|
private _lastRevalidatedAt;
|
|
350
462
|
/** Retry timers for recovery refetches that failed and need another attempt. */
|
|
351
463
|
private _revalidationRetryTimers;
|
|
464
|
+
/**
|
|
465
|
+
* Failures in a row of a query's revalidation, while it is being tried again (revalidation-retry): its first failure
|
|
466
|
+
* is reported (`onError`), the tries after it are not. Gone once it succeeds, fails for good, or the connection
|
|
467
|
+
* comes back (handleTransportReconnect).
|
|
468
|
+
*/
|
|
469
|
+
private _revalidationFailures;
|
|
470
|
+
/** Tries that came due while the page was hidden: run once it is shown. */
|
|
471
|
+
private _revalidationsAwaitingVisibility;
|
|
472
|
+
private _visibilityListener;
|
|
473
|
+
/** The jitter's source (revalidationRetryDelay); a test fixes it. */
|
|
474
|
+
private _random;
|
|
475
|
+
/** A page being read again after an `add` it cannot place: `true` once another `add` asks for one more reading. */
|
|
476
|
+
private _placementReads;
|
|
352
477
|
/**
|
|
353
478
|
* Last mutation/sync touch timestamp by entity type.
|
|
354
479
|
* Used to detect stale cached query results on watch re-entry.
|
|
@@ -362,9 +487,12 @@ declare class SyncEngine {
|
|
|
362
487
|
*/
|
|
363
488
|
startSync(): Promise<void>;
|
|
364
489
|
/**
|
|
365
|
-
* Stop the SSE delta sync connection.
|
|
490
|
+
* Stop the SSE delta sync connection. Failed revalidations stop being tried with it (the SDK being destroyed, a
|
|
491
|
+
* workspace switch, a full resync that reads every list again): their timers, the tries held for a hidden page and
|
|
492
|
+
* the page's listener go.
|
|
366
493
|
*/
|
|
367
494
|
stopSync(): void;
|
|
495
|
+
private _stopRevalidationRetries;
|
|
368
496
|
/**
|
|
369
497
|
* Handle a full-resync signal from the server.
|
|
370
498
|
*
|
|
@@ -376,6 +504,8 @@ declare class SyncEngine {
|
|
|
376
504
|
/**
|
|
377
505
|
* Ordinary transport reconnects should recover from the sync cursor and
|
|
378
506
|
* server-side subscription state without eagerly refetching every active query.
|
|
507
|
+
* Only the queries whose revalidation was failing are read again, as from their first try: the connection (or a
|
|
508
|
+
* lifecycle hint, which reconnects it) may be what they were waiting for.
|
|
379
509
|
*/
|
|
380
510
|
handleTransportReconnect(): Promise<void>;
|
|
381
511
|
/**
|
|
@@ -417,6 +547,10 @@ declare class SyncEngine {
|
|
|
417
547
|
* @param subscriptionDescriptor - Optional server-driven subscription metadata for filtered queries.
|
|
418
548
|
*/
|
|
419
549
|
watch<T>(document: DocumentNode, variables: Record<string, unknown> | undefined, operationName: string, buildResult: (db: DvinaDatabase) => Promise<T> | T, subscriptionDescriptor?: SubscriptionDescriptor, relationMetadata?: WatchedRelationMetadata[]): DvinaQueryRef<T>;
|
|
550
|
+
/** Registers the query's server subscription, or shares the one it already has; returns its id. */
|
|
551
|
+
private _retainServerSubscription;
|
|
552
|
+
/** Unsubscribes the query on the server once the last watch sharing its subscription is gone. */
|
|
553
|
+
private _releaseServerSubscription;
|
|
420
554
|
private _subscribeWithQuerySyncId;
|
|
421
555
|
/**
|
|
422
556
|
* Execute a mutation with optional optimistic update and automatic cache rule.
|
|
@@ -452,13 +586,28 @@ declare class SyncEngine {
|
|
|
452
586
|
*/
|
|
453
587
|
clearAll(): Promise<void>;
|
|
454
588
|
/**
|
|
455
|
-
* Process a server-driven query event (query-add / query-remove).
|
|
589
|
+
* Process a server-driven query event (query-add / query-remove / query-resync / query-count).
|
|
456
590
|
*
|
|
457
591
|
* The server evaluates Prisma filters on create/update/upsert events and sends targeted
|
|
458
592
|
* events to subscriptions that match. This method routes the event to the
|
|
459
593
|
* correct query result cache entry using the subscriptionId → queryKey map.
|
|
594
|
+
* The list's totalCount is the server's: `count` sets it, and adds and removes move only the list's entities.
|
|
460
595
|
*/
|
|
461
596
|
processQueryEvent(event: SseQueryEvent): Promise<void>;
|
|
597
|
+
/**
|
|
598
|
+
* Puts an entity the server says now matches a subscription into its cached page. First only where it belongs
|
|
599
|
+
* first (a newest-first list it heads); in any other order (by name, by kind, oldest first, an old item that
|
|
600
|
+
* changed) the page is read again, so the list never shows it on top of an order it does not belong to. One the
|
|
601
|
+
* page already lists (a reconnect's catch-up names every changed entity that matches) stays where it is: its row
|
|
602
|
+
* is already written, and the page is read again only when its order key moved it past a neighbour.
|
|
603
|
+
*/
|
|
604
|
+
private _placeAddedEntity;
|
|
605
|
+
/**
|
|
606
|
+
* Reads a page again for `add` events it cannot place: one reading at a time per page, and one more after it when
|
|
607
|
+
* further events came while it ran (the first may have been answered before their changes), so a burst (a
|
|
608
|
+
* reconnect's catch-up) costs two requests, not one each.
|
|
609
|
+
*/
|
|
610
|
+
private _rereadForPlacement;
|
|
462
611
|
/**
|
|
463
612
|
* Handle an upsert sync event: normalize the payload and write to Dexie.
|
|
464
613
|
*
|
|
@@ -472,10 +621,12 @@ declare class SyncEngine {
|
|
|
472
621
|
private _revalidateSubscriptions;
|
|
473
622
|
private _revalidateSubscriptionQuery;
|
|
474
623
|
private _scheduleRevalidationRetry;
|
|
624
|
+
/** A try that came due: run now, or once the page is shown again when it is hidden. */
|
|
625
|
+
private _runRevalidationRetry;
|
|
626
|
+
private _listenForVisibility;
|
|
475
627
|
private _clearRevalidationRetry;
|
|
476
628
|
private _getActiveSubscriptionByQueryKey;
|
|
477
629
|
private _hasActiveSubscriptionForQueryKey;
|
|
478
|
-
private _hasOtherActiveSubscriptionForQueryKey;
|
|
479
630
|
private _getActiveSubscriptionsForEntityType;
|
|
480
631
|
private _materializeWatchedRelations;
|
|
481
632
|
private _resolveStoredRelationFallback;
|
|
@@ -489,4 +640,65 @@ declare class SyncEngine {
|
|
|
489
640
|
private _processSyncDelete;
|
|
490
641
|
}
|
|
491
642
|
|
|
492
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Base class that holds the transport functions.
|
|
645
|
+
* Every generated model, connection, query, and the root SDK class extend this.
|
|
646
|
+
*
|
|
647
|
+
* Operation classes use `_syncEngine` for queries/mutations/watch.
|
|
648
|
+
* Model classes use `_request` for compatibility (lazy fetch).
|
|
649
|
+
*/
|
|
650
|
+
declare class Request {
|
|
651
|
+
protected _request: DvinaRequest;
|
|
652
|
+
protected _syncEngine?: SyncEngine;
|
|
653
|
+
protected _baseUrl?: string;
|
|
654
|
+
constructor(request: DvinaRequest, syncEngine?: SyncEngine, baseUrl?: string);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Default connection variables when paginating.
|
|
659
|
+
* Ensures `first` or `last` is set when a cursor is provided.
|
|
660
|
+
*/
|
|
661
|
+
declare function defaultConnection<V extends ConnectionVariables>(variables: V): V;
|
|
662
|
+
/**
|
|
663
|
+
* PageInfo model following the Relay spec.
|
|
664
|
+
*/
|
|
665
|
+
declare class PageInfo {
|
|
666
|
+
hasNextPage: boolean;
|
|
667
|
+
hasPreviousPage: boolean;
|
|
668
|
+
startCursor?: string | null;
|
|
669
|
+
endCursor?: string | null;
|
|
670
|
+
constructor(data: PageInfoData);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Abstract base class for connection types.
|
|
674
|
+
* Holds nodes and page info, used for type checking.
|
|
675
|
+
*/
|
|
676
|
+
declare abstract class AbstractConnection<Node> extends Request {
|
|
677
|
+
pageInfo: PageInfo;
|
|
678
|
+
nodes: Node[];
|
|
679
|
+
totalCount?: number;
|
|
680
|
+
constructor(request: DvinaRequest);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Concrete connection class with pagination helpers.
|
|
684
|
+
* Generated connection subclasses extend this.
|
|
685
|
+
*
|
|
686
|
+
* The `_fetch` closure is created by the query class and allows re-fetching
|
|
687
|
+
* with different pagination variables.
|
|
688
|
+
*/
|
|
689
|
+
declare class Connection<Node> extends AbstractConnection<Node> {
|
|
690
|
+
private _fetch;
|
|
691
|
+
constructor(request: DvinaRequest, fetch: (variables?: ConnectionVariables, options?: FetchOptions) => Promise<Connection<Node> | undefined>, nodes: Node[], pageInfo: PageInfo, totalCount?: number);
|
|
692
|
+
/**
|
|
693
|
+
* Fetch the next page and append nodes.
|
|
694
|
+
* Mutates this connection instance in place (nodes are appended, pageInfo updated).
|
|
695
|
+
*/
|
|
696
|
+
fetchNext(options?: FetchOptions): Promise<this>;
|
|
697
|
+
/**
|
|
698
|
+
* Fetch the previous page and prepend nodes.
|
|
699
|
+
* Mutates this connection instance in place (nodes are prepended, pageInfo updated).
|
|
700
|
+
*/
|
|
701
|
+
fetchPrevious(options?: FetchOptions): Promise<this>;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
export { AbstractConnection as A, type CacheRule as C, DvinaDatabase as D, PageInfo as P, type RealtimeEventTopic as R, type SseRealtimeEvent as S, SyncEngine as a, type CacheRuleCreate as b, createHttpTransport as c, type CacheRuleDelete as d, type CacheRuleUpdate as e, Connection as f, Request as g, type SseQueryEvent as h, type SseSyncEvent as i, type SseTransport as j, type SseTransportOptions as k, type SubscriptionDescriptor as l, type SyncState as m, type SyncStatus as n, type SyncStatusSource as o, closeDatabase as p, createSseTransport as q, defaultConnection as r, deleteDatabase as s, deleteUserLocalData as t, getOrCreateDatabase as u };
|
|
@@ -27,13 +27,21 @@ declare class DvinaNetworkError extends DvinaError {
|
|
|
27
27
|
constructor(message: string, status?: number, cause?: Error);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Error thrown when authentication fails (401
|
|
30
|
+
* Error thrown when authentication fails (401).
|
|
31
31
|
*/
|
|
32
32
|
declare class DvinaAuthenticationError extends DvinaError {
|
|
33
33
|
/** The token that was used when the auth error occurred (for stale-token detection). */
|
|
34
34
|
readonly failedToken?: string;
|
|
35
35
|
constructor(message?: string, failedTokenOrCause?: string | Error, cause?: Error);
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Error thrown when the API knows the caller but refuses the request (403), e.g. a workspace they were removed
|
|
39
|
+
* from. Not a failed sign-in: no token refresh helps, and the session stays.
|
|
40
|
+
*/
|
|
41
|
+
declare class DvinaForbiddenError extends DvinaError {
|
|
42
|
+
readonly status = 403;
|
|
43
|
+
constructor(message?: string, cause?: Error);
|
|
44
|
+
}
|
|
37
45
|
/**
|
|
38
46
|
* Known GraphQL error codes returned by the Dvina API in `extensions.code`.
|
|
39
47
|
* Used for programmatic matching in SDK error detection.
|
|
@@ -58,7 +66,7 @@ declare class DvinaPlanRestrictionError extends DvinaGraphQLError {
|
|
|
58
66
|
}
|
|
59
67
|
/**
|
|
60
68
|
* Error thrown when the chat session token limit is reached (SESSION_TOKEN_LIMIT_REACHED).
|
|
61
|
-
*
|
|
69
|
+
* A per-session GraphQL limit.
|
|
62
70
|
*/
|
|
63
71
|
declare class DvinaTokenLimitError extends DvinaGraphQLError {
|
|
64
72
|
constructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>);
|
|
@@ -92,4 +100,4 @@ interface GraphQLErrorEntry {
|
|
|
92
100
|
extensions?: Record<string, unknown>;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
export {
|
|
103
|
+
export { DvinaAuthenticationError as D, GRAPHQL_ERROR_CODES as G, DvinaForbiddenError as a, DvinaError as b, DvinaGraphQLError as c, DvinaNetworkError as d, DvinaNotFoundError as e, DvinaPlanRestrictionError as f, DvinaTokenLimitError as g, type GraphQLErrorEntry as h, createGraphQLError as i, extractErrorCode as j };
|