@dvina/sdk 4.1.59 → 4.1.66

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 (89) hide show
  1. package/dist/_generated_documents-VM6RSSXR.js +1 -0
  2. package/dist/adapters/angular/index.d.ts +2 -2
  3. package/dist/adapters/angular/index.js +1 -159
  4. package/dist/adapters/react/index.js +1 -49
  5. package/dist/billing/index.js +1 -5
  6. package/dist/chunk-5E7LX4YQ.js +1 -0
  7. package/dist/chunk-D2L26FRK.js +5 -0
  8. package/dist/chunk-EK7ODJWE.js +1 -0
  9. package/dist/chunk-G34ETQUN.js +1 -0
  10. package/dist/chunk-H3TI6B7T.js +1 -0
  11. package/dist/chunk-IIQ3WGOJ.js +1 -0
  12. package/dist/chunk-IO56LXKJ.js +1 -0
  13. package/dist/chunk-SJ6Q5IDB.js +31 -0
  14. package/dist/{client-D309vpHA.d.ts → client-CEoJfTM9.d.ts} +2 -257
  15. package/dist/{index-fFR5so7x.d.ts → index-BzmzBgTh.d.ts} +1 -1
  16. package/dist/index.d.ts +7 -134
  17. package/dist/index.js +1 -10
  18. package/dist/inference/index.js +1 -5
  19. package/dist/package.json +12 -48
  20. package/dist/pagination/index.d.ts +2 -2
  21. package/dist/pagination/index.js +1 -5
  22. package/dist/{sync-engine-BIaOIpU3.d.ts → sync-engine-Bh0UcTVd.d.ts} +13 -0
  23. package/package.json +13 -49
  24. package/dist/_generated_documents-GHGFCEAV.js +0 -4
  25. package/dist/_generated_documents-GHGFCEAV.js.map +0 -1
  26. package/dist/_generated_documents-Z5MUI5BE.cjs +0 -2777
  27. package/dist/_generated_documents-Z5MUI5BE.cjs.map +0 -1
  28. package/dist/adapters/angular/index.cjs +0 -163
  29. package/dist/adapters/angular/index.cjs.map +0 -1
  30. package/dist/adapters/angular/index.d.cts +0 -254
  31. package/dist/adapters/angular/index.js.map +0 -1
  32. package/dist/adapters/react/index.cjs +0 -51
  33. package/dist/adapters/react/index.cjs.map +0 -1
  34. package/dist/adapters/react/index.d.cts +0 -62
  35. package/dist/adapters/react/index.js.map +0 -1
  36. package/dist/billing/index.cjs +0 -26
  37. package/dist/billing/index.cjs.map +0 -1
  38. package/dist/billing/index.d.cts +0 -328
  39. package/dist/billing/index.js.map +0 -1
  40. package/dist/chunk-2J5WONKO.cjs +0 -1608
  41. package/dist/chunk-2J5WONKO.cjs.map +0 -1
  42. package/dist/chunk-342BFYZZ.cjs +0 -98
  43. package/dist/chunk-342BFYZZ.cjs.map +0 -1
  44. package/dist/chunk-5WRI5ZAA.js +0 -29
  45. package/dist/chunk-5WRI5ZAA.js.map +0 -1
  46. package/dist/chunk-7XBJ77RJ.js +0 -103
  47. package/dist/chunk-7XBJ77RJ.js.map +0 -1
  48. package/dist/chunk-AE5KAIKK.js +0 -24
  49. package/dist/chunk-AE5KAIKK.js.map +0 -1
  50. package/dist/chunk-COFT5ZYL.js +0 -23777
  51. package/dist/chunk-COFT5ZYL.js.map +0 -1
  52. package/dist/chunk-DZUJEN5N.cjs +0 -32
  53. package/dist/chunk-DZUJEN5N.cjs.map +0 -1
  54. package/dist/chunk-FOKGSMXS.cjs +0 -27
  55. package/dist/chunk-FOKGSMXS.cjs.map +0 -1
  56. package/dist/chunk-HHBDJ65K.cjs +0 -24198
  57. package/dist/chunk-HHBDJ65K.cjs.map +0 -1
  58. package/dist/chunk-KEM6SUTS.js +0 -92
  59. package/dist/chunk-KEM6SUTS.js.map +0 -1
  60. package/dist/chunk-KSVHC4YE.cjs +0 -1841
  61. package/dist/chunk-KSVHC4YE.cjs.map +0 -1
  62. package/dist/chunk-KV5SP7RP.cjs +0 -114
  63. package/dist/chunk-KV5SP7RP.cjs.map +0 -1
  64. package/dist/chunk-NH4SMZCW.js +0 -1148
  65. package/dist/chunk-NH4SMZCW.js.map +0 -1
  66. package/dist/chunk-PDM2KR7T.js +0 -392
  67. package/dist/chunk-PDM2KR7T.js.map +0 -1
  68. package/dist/chunk-UELAE75E.cjs +0 -408
  69. package/dist/chunk-UELAE75E.cjs.map +0 -1
  70. package/dist/chunk-WX7EFPHT.js +0 -1600
  71. package/dist/chunk-WX7EFPHT.js.map +0 -1
  72. package/dist/client-BRIS6DdR.d.cts +0 -8159
  73. package/dist/client-Bb2gD6Iz.d.cts +0 -488
  74. package/dist/error-CsVoUTY8.d.cts +0 -95
  75. package/dist/index-D_Z25Pa1.d.cts +0 -79
  76. package/dist/index.cjs +0 -2039
  77. package/dist/index.cjs.map +0 -1
  78. package/dist/index.d.cts +0 -3823
  79. package/dist/index.js.map +0 -1
  80. package/dist/inference/index.cjs +0 -70
  81. package/dist/inference/index.cjs.map +0 -1
  82. package/dist/inference/index.d.cts +0 -80
  83. package/dist/inference/index.js.map +0 -1
  84. package/dist/pagination/index.cjs +0 -34
  85. package/dist/pagination/index.cjs.map +0 -1
  86. package/dist/pagination/index.d.cts +0 -6
  87. package/dist/pagination/index.js.map +0 -1
  88. package/dist/sync-engine-gpxyhQBl.d.cts +0 -478
  89. package/dist/types-Chg8ASmf.d.cts +0 -116
@@ -1,488 +0,0 @@
1
- /**
2
- * A single part of a multi-modal message content array.
3
- */
4
- interface ContentPart {
5
- type: 'text' | 'image_url';
6
- text?: string;
7
- image_url?: {
8
- url: string;
9
- };
10
- }
11
- /**
12
- * A tool call requested by the assistant.
13
- */
14
- interface ToolCall {
15
- id: string;
16
- type: 'function';
17
- function: {
18
- name: string;
19
- arguments: string;
20
- };
21
- }
22
- /**
23
- * A tool definition that can be passed to the model.
24
- */
25
- interface Tool {
26
- type: 'function';
27
- function: {
28
- name: string;
29
- description?: string;
30
- parameters?: Record<string, unknown>;
31
- };
32
- }
33
- /**
34
- * Tool choice configuration.
35
- * - `'auto'`: model decides whether to call a tool
36
- * - `'none'`: model never calls a tool
37
- * - `'required'`: model must call a tool
38
- * - `{ type: 'function'; function: { name } }`: model must call the specified tool
39
- */
40
- type ToolChoice = 'auto' | 'none' | 'required' | {
41
- type: 'function';
42
- function: {
43
- name: string;
44
- };
45
- };
46
- /**
47
- * A single message in a chat conversation.
48
- */
49
- interface ChatMessage {
50
- role: 'system' | 'user' | 'assistant' | 'tool';
51
- content: string | ContentPart[];
52
- name?: string;
53
- tool_calls?: ToolCall[];
54
- tool_call_id?: string;
55
- }
56
- /**
57
- * Request body for POST /chat/completions (non-streaming).
58
- */
59
- interface ChatCompletionRequest {
60
- model: string;
61
- messages: ChatMessage[];
62
- temperature?: number;
63
- max_completion_tokens?: number;
64
- stream?: false;
65
- tools?: Tool[];
66
- tool_choice?: ToolChoice;
67
- }
68
- /**
69
- * Request body for POST /chat/completions (streaming).
70
- */
71
- interface ChatCompletionStreamRequest {
72
- model: string;
73
- messages: ChatMessage[];
74
- temperature?: number;
75
- max_completion_tokens?: number;
76
- stream: true;
77
- tools?: Tool[];
78
- tool_choice?: ToolChoice;
79
- }
80
- /**
81
- * Request body for POST /responses (non-streaming).
82
- */
83
- interface ResponsesRequest {
84
- model: string;
85
- input: string | unknown[];
86
- stream?: false;
87
- instructions?: string;
88
- temperature?: number;
89
- max_output_tokens?: number;
90
- tools?: unknown[];
91
- tool_choice?: unknown;
92
- reasoning?: {
93
- effort?: string;
94
- summary?: string;
95
- };
96
- text?: {
97
- format?: unknown;
98
- };
99
- include?: string[];
100
- [key: string]: unknown;
101
- }
102
- /**
103
- * Request body for POST /responses (streaming).
104
- */
105
- interface ResponsesStreamRequest {
106
- model: string;
107
- input: string | unknown[];
108
- stream: true;
109
- instructions?: string;
110
- temperature?: number;
111
- max_output_tokens?: number;
112
- tools?: unknown[];
113
- tool_choice?: unknown;
114
- reasoning?: {
115
- effort?: string;
116
- summary?: string;
117
- };
118
- text?: {
119
- format?: unknown;
120
- };
121
- include?: string[];
122
- [key: string]: unknown;
123
- }
124
- /**
125
- * Token usage statistics returned by the API.
126
- */
127
- interface Usage {
128
- prompt_tokens: number;
129
- completion_tokens: number;
130
- total_tokens: number;
131
- }
132
- /**
133
- * A single choice in a non-streaming chat completion response.
134
- */
135
- interface ChatCompletionChoice {
136
- index: number;
137
- message: {
138
- role: string;
139
- content: string | null;
140
- tool_calls?: ToolCall[];
141
- };
142
- finish_reason: string;
143
- }
144
- /**
145
- * Non-streaming chat completion response (OpenAI-compatible).
146
- */
147
- interface ChatCompletionResponse {
148
- id: string;
149
- object: 'chat.completion';
150
- created: number;
151
- model: string;
152
- choices: ChatCompletionChoice[];
153
- usage: Usage;
154
- }
155
- /**
156
- * A delta object within a streaming chunk.
157
- */
158
- interface StreamDelta {
159
- role?: string;
160
- content?: string;
161
- tool_calls?: unknown[];
162
- }
163
- /**
164
- * A single choice in a streaming chat completion chunk.
165
- */
166
- interface StreamChunkChoice {
167
- index: number;
168
- delta: StreamDelta;
169
- finish_reason: string | null;
170
- }
171
- /**
172
- * A single SSE chunk during streaming chat completion.
173
- */
174
- interface ChatCompletionChunk {
175
- id: string;
176
- object: 'chat.completion.chunk';
177
- created: number;
178
- model: string;
179
- choices: StreamChunkChoice[];
180
- usage?: Usage;
181
- }
182
- /**
183
- * A model object returned by the models endpoint.
184
- */
185
- interface ModelCost {
186
- input: number;
187
- output: number;
188
- cache_read?: number;
189
- cache_write?: number;
190
- context_over_200k?: {
191
- input: number;
192
- output: number;
193
- cache_read?: number;
194
- cache_write?: number;
195
- };
196
- }
197
- interface ModelLimit {
198
- context: number;
199
- input?: number;
200
- output: number;
201
- }
202
- interface ModelModalities {
203
- input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>;
204
- output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>;
205
- }
206
- interface Model {
207
- id: string;
208
- object: 'model';
209
- created: number;
210
- owned_by: string;
211
- name?: string;
212
- family?: string;
213
- release_date?: string;
214
- attachment?: boolean;
215
- reasoning?: boolean;
216
- temperature?: boolean;
217
- tool_call?: boolean;
218
- interleaved?: true | {
219
- field: 'reasoning_content' | 'reasoning_details';
220
- };
221
- cost?: ModelCost;
222
- limit?: ModelLimit;
223
- modalities?: ModelModalities;
224
- experimental?: boolean;
225
- status?: 'alpha' | 'beta' | 'deprecated';
226
- options?: Record<string, unknown>;
227
- headers?: Record<string, string>;
228
- provider?: {
229
- npm: string;
230
- };
231
- variants?: Record<string, Record<string, unknown>>;
232
- }
233
- /**
234
- * Response from GET /models.
235
- */
236
- interface ModelListResponse {
237
- object: 'list';
238
- data: Model[];
239
- }
240
- /**
241
- * OpenAI-compatible error response body from the inference API.
242
- */
243
- interface InferenceErrorResponse {
244
- error: {
245
- message: string;
246
- type: string;
247
- code: string;
248
- };
249
- }
250
- /**
251
- * Response from GET /health.
252
- */
253
- interface HealthResponse {
254
- status: 'ok';
255
- models: number;
256
- openaiHost: string;
257
- anthropicHost: string;
258
- apiVersion: string;
259
- timestamp: number;
260
- }
261
- /**
262
- * Options for creating an inference client.
263
- */
264
- interface InferenceClientOptions {
265
- /** Base URL for the inference API (e.g. 'https://api.dvina.ai/inference/v1'). */
266
- baseUrl: string;
267
- /**
268
- * Static auth token. Use for scripts, CLI tools, and tests.
269
- * Mutually exclusive with `getToken`.
270
- */
271
- token?: string;
272
- /**
273
- * Async callback that returns an auth token.
274
- * When called with `{ forceRefresh: true }`, the callback must bypass any
275
- * cache and obtain a brand-new token.
276
- * Mutually exclusive with `token`.
277
- */
278
- getToken?: (options?: {
279
- forceRefresh?: boolean;
280
- }) => Promise<string>;
281
- /** Custom headers to include in every request. */
282
- headers?: Record<string, string>;
283
- /**
284
- * Request timeout in milliseconds. Default: 120000 (2 minutes).
285
- */
286
- timeout?: number;
287
- }
288
-
289
- /**
290
- * Parse a Server-Sent Events response body into an async iterable of typed chunks.
291
- *
292
- * Handles:
293
- * - Chunked network reads (buffer splitting across `data:` boundaries)
294
- * - `\r\n` and `\n` line endings
295
- * - `data: [DONE]` termination signal
296
- * - Mid-stream errors (yields what it can, then throws)
297
- *
298
- * @param body - A ReadableStream<Uint8Array> from a fetch response
299
- * @returns An async iterable of parsed SSE data objects
300
- */
301
- declare function parseSSEStream<T = ChatCompletionChunk>(body: ReadableStream<Uint8Array>): AsyncGenerator<T, void, undefined>;
302
- /**
303
- * A chat completion stream that also aggregates the full response for convenience.
304
- *
305
- * Implements `AsyncIterable<ChatCompletionChunk>` for chunk-by-chunk processing,
306
- * and provides helper methods to extract the final assembled text and usage.
307
- *
308
- * @example
309
- * ```typescript
310
- * const stream = await client.chat.completions.stream({ ... });
311
- *
312
- * // Option 1: Iterate chunk by chunk
313
- * for await (const chunk of stream) {
314
- * process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
315
- * }
316
- *
317
- * // Option 2: Get aggregated result after iteration
318
- * const text = stream.getText();
319
- * const usage = stream.getUsage();
320
- * ```
321
- */
322
- declare class ChatCompletionStream implements AsyncIterable<ChatCompletionChunk> {
323
- private readonly _chunks;
324
- private readonly _source;
325
- private _consumed;
326
- constructor(source: AsyncGenerator<ChatCompletionChunk, void, undefined>);
327
- [Symbol.asyncIterator](): AsyncIterator<ChatCompletionChunk>;
328
- /**
329
- * Concatenate all content deltas into a single string.
330
- * Must be called after the stream has been fully consumed.
331
- */
332
- getText(): string;
333
- /**
334
- * Get the token usage from the final chunk (if the server included it).
335
- * Must be called after the stream has been fully consumed.
336
- */
337
- getUsage(): {
338
- prompt_tokens: number;
339
- completion_tokens: number;
340
- total_tokens: number;
341
- } | undefined;
342
- /**
343
- * Get the collected chunks array.
344
- * Must be called after the stream has been fully consumed.
345
- */
346
- getChunks(): readonly ChatCompletionChunk[];
347
- }
348
-
349
- /**
350
- * Namespaced chat completions API.
351
- *
352
- * @example
353
- * ```typescript
354
- * // Non-streaming
355
- * const response = await sdk.inference.chat.completions.create({
356
- * model: 'claude-sonnet-4-6',
357
- * messages: [{ role: 'user', content: 'Hello!' }],
358
- * });
359
- *
360
- * // Streaming
361
- * const stream = await sdk.inference.chat.completions.stream({
362
- * model: 'claude-sonnet-4-6',
363
- * messages: [{ role: 'user', content: 'Hello!' }],
364
- * });
365
- * for await (const chunk of stream) {
366
- * process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
367
- * }
368
- * ```
369
- */
370
- interface ChatCompletions {
371
- /** Create a non-streaming chat completion. */
372
- create(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
373
- /** Create a streaming chat completion. Returns an async iterable of chunks. */
374
- stream(request: Omit<ChatCompletionStreamRequest, 'stream'>): Promise<ChatCompletionStream>;
375
- }
376
- interface Chat {
377
- completions: ChatCompletions;
378
- }
379
- /**
380
- * Namespaced responses API.
381
- *
382
- * @example
383
- * ```typescript
384
- * // Non-streaming
385
- * const response = await sdk.inference.responses.create({
386
- * model: 'gpt-5.2',
387
- * input: 'Hello!',
388
- * });
389
- *
390
- * // Streaming
391
- * const stream = await sdk.inference.responses.stream({
392
- * model: 'gpt-5.2',
393
- * input: 'Hello!',
394
- * });
395
- * for await (const event of stream) {
396
- * console.log(event);
397
- * }
398
- * ```
399
- */
400
- interface Responses {
401
- /** Create a non-streaming response. */
402
- create(request: ResponsesRequest): Promise<unknown>;
403
- /** Create a streaming response. Returns a raw async iterable of SSE events. */
404
- stream(request: Omit<ResponsesStreamRequest, 'stream'>): Promise<AsyncIterable<unknown>>;
405
- }
406
- /**
407
- * Namespaced models API.
408
- */
409
- interface Models {
410
- /** List all available models. */
411
- list(): Promise<ModelListResponse>;
412
- /** Get a single model by ID. */
413
- get(modelId: string): Promise<Model>;
414
- }
415
- /**
416
- * The Dvina Inference client.
417
- *
418
- * Provides a typed interface to the `/inference/v1` REST API with full
419
- * SSE streaming support. Follows the OpenAI client naming conventions
420
- * (`sdk.inference.chat.completions`, `sdk.inference.responses`, `sdk.inference.models`).
421
- *
422
- * @example
423
- * ```typescript
424
- * const sdk = new DvinaSdk({ token: 'your-jwt-token' });
425
- *
426
- * // Chat completion
427
- * const response = await sdk.inference.chat.completions.create({
428
- * model: 'claude-sonnet-4-6',
429
- * messages: [{ role: 'user', content: 'Hello!' }],
430
- * });
431
- *
432
- * // Streaming
433
- * const stream = await sdk.inference.chat.completions.stream({
434
- * model: 'claude-sonnet-4-6',
435
- * messages: [{ role: 'user', content: 'Tell me a story' }],
436
- * });
437
- * for await (const chunk of stream) {
438
- * process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
439
- * }
440
- * ```
441
- */
442
- interface InferenceClient {
443
- chat: Chat;
444
- responses: Responses;
445
- models: Models;
446
- /** Check the health of the inference API. */
447
- health(): Promise<HealthResponse>;
448
- }
449
- /**
450
- * Create an inference client using pre-resolved baseUrl and getToken from the SDK.
451
- * This is the internal factory called by `createDvinaClient` — it does NOT resolve
452
- * token/options itself, it receives them from the parent SDK client.
453
- *
454
- * @internal
455
- */
456
- declare function createInferenceClientInternal(baseUrl: string, getToken: (options?: {
457
- forceRefresh?: boolean;
458
- }) => Promise<string>, options?: {
459
- headers?: Record<string, string>;
460
- timeout?: number;
461
- }): InferenceClient;
462
- /**
463
- * Create a standalone Dvina Inference client.
464
- *
465
- * Use this when you need inference without the full GraphQL SDK.
466
- * For most cases, prefer `sdk.inference` which shares auth with the SDK.
467
- *
468
- * @param options - Client configuration (base URL, auth, headers, timeout)
469
- * @returns A fully configured inference client
470
- *
471
- * @example
472
- * ```typescript
473
- * import { createInferenceClient } from '@dvina/sdk/inference';
474
- *
475
- * const client = createInferenceClient({
476
- * baseUrl: 'https://api.dvina.ai/inference/v1',
477
- * token: 'your-jwt-token',
478
- * });
479
- *
480
- * const response = await client.chat.completions.create({
481
- * model: 'claude-sonnet-4-6',
482
- * messages: [{ role: 'user', content: 'Hello!' }],
483
- * });
484
- * ```
485
- */
486
- declare function createInferenceClient(options: InferenceClientOptions): InferenceClient;
487
-
488
- export { type Chat as C, type HealthResponse as H, type InferenceClient as I, type Model as M, type Responses as R, type StreamChunkChoice as S, type Tool as T, type Usage as U, type ChatCompletionChoice as a, type ChatCompletionChunk as b, type ChatCompletionRequest as c, type ChatCompletionResponse as d, ChatCompletionStream as e, type ChatCompletionStreamRequest as f, type ChatCompletions as g, type ChatMessage as h, type ContentPart as i, type InferenceClientOptions as j, type InferenceErrorResponse as k, type ModelListResponse as l, type Models as m, type ResponsesRequest as n, type ResponsesStreamRequest as o, type StreamDelta as p, type ToolCall as q, type ToolChoice as r, createInferenceClient as s, createInferenceClientInternal as t, parseSSEStream as u };
@@ -1,95 +0,0 @@
1
- /**
2
- * Base error class for all Dvina SDK errors.
3
- */
4
- declare class DvinaError extends Error {
5
- /** The original error, if any */
6
- readonly cause?: Error;
7
- constructor(message: string, cause?: Error);
8
- }
9
- /**
10
- * Error thrown when the GraphQL response contains errors.
11
- */
12
- declare class DvinaGraphQLError extends DvinaError {
13
- /** The raw GraphQL errors array */
14
- readonly errors: readonly GraphQLErrorEntry[];
15
- /** The query that caused the error (for debugging) */
16
- readonly query?: string;
17
- /** The variables that were passed */
18
- readonly variables?: Record<string, unknown>;
19
- constructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>);
20
- }
21
- /**
22
- * Error thrown on network failures (connection refused, timeout, etc.)
23
- */
24
- declare class DvinaNetworkError extends DvinaError {
25
- /** HTTP status code, if available */
26
- readonly status?: number;
27
- constructor(message: string, status?: number, cause?: Error);
28
- }
29
- /**
30
- * Error thrown when authentication fails (401/403).
31
- */
32
- declare class DvinaAuthenticationError extends DvinaError {
33
- /** The token that was used when the auth error occurred (for stale-token detection). */
34
- readonly failedToken?: string;
35
- constructor(message?: string, failedTokenOrCause?: string | Error, cause?: Error);
36
- }
37
- /**
38
- * Known GraphQL error codes returned by the Dvina API in `extensions.code`.
39
- * Used for programmatic matching in SDK error detection.
40
- */
41
- declare const GRAPHQL_ERROR_CODES: {
42
- readonly SESSION_TOKEN_LIMIT_REACHED: "SESSION_TOKEN_LIMIT_REACHED";
43
- readonly STORAGE_LIMIT_REACHED: "STORAGE_LIMIT_REACHED";
44
- readonly DEEP_ANALYSIS_LIMIT_EXCEEDED: "DEEP_ANALYSIS_LIMIT_EXCEEDED";
45
- readonly PLAN_DETAIL_RESTRICTION: "PLAN_DETAIL_RESTRICTION";
46
- readonly RESOURCE_NOT_FOUND: "RESOURCE_NOT_FOUND";
47
- };
48
- /**
49
- * Base class for plan/billing restriction errors.
50
- * Thrown when the workspace exceeds a plan limit (storage, capabilities, deep analysis).
51
- *
52
- * Consumers can `catch (e) { if (e instanceof DvinaPlanRestrictionError) showUpgradeDialog(); }`
53
- */
54
- declare class DvinaPlanRestrictionError extends DvinaGraphQLError {
55
- /** The specific restriction code (e.g. 'PLAN_DETAIL_RESTRICTION') */
56
- readonly restrictionCode: string;
57
- constructor(errors: readonly GraphQLErrorEntry[], restrictionCode: string, query?: string, variables?: Record<string, unknown>);
58
- }
59
- /**
60
- * Error thrown when the chat session token limit is reached (SESSION_TOKEN_LIMIT_REACHED).
61
- * Distinct from inference quota — this is a per-session GraphQL limit.
62
- */
63
- declare class DvinaTokenLimitError extends DvinaGraphQLError {
64
- constructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>);
65
- }
66
- /**
67
- * Error thrown when a requested resource is not found (RESOURCE_NOT_FOUND).
68
- */
69
- declare class DvinaNotFoundError extends DvinaGraphQLError {
70
- constructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>);
71
- }
72
- /**
73
- * Extract the first extension code from a list of GraphQL errors (normalized to uppercase).
74
- * Returns `undefined` if no code is present.
75
- */
76
- declare function extractErrorCode(errors: readonly GraphQLErrorEntry[]): string | undefined;
77
- /**
78
- * Create the appropriate `DvinaGraphQLError` subclass for the given errors,
79
- * or return a generic `DvinaGraphQLError` if no specific match is found.
80
- */
81
- declare function createGraphQLError(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>): DvinaGraphQLError;
82
- /**
83
- * Shape of a single GraphQL error in the response.
84
- */
85
- interface GraphQLErrorEntry {
86
- message: string;
87
- locations?: readonly {
88
- line: number;
89
- column: number;
90
- }[];
91
- path?: readonly (string | number)[];
92
- extensions?: Record<string, unknown>;
93
- }
94
-
95
- export { DvinaError as D, GRAPHQL_ERROR_CODES as G, DvinaAuthenticationError as a, DvinaGraphQLError as b, DvinaNetworkError as c, DvinaNotFoundError as d, DvinaPlanRestrictionError as e, DvinaTokenLimitError as f, type GraphQLErrorEntry as g, createGraphQLError as h, extractErrorCode as i };
@@ -1,79 +0,0 @@
1
- import { b as DvinaRequest, c as DvinaSubscribe, P as PageInfoData, C as ConnectionVariables, F as FetchOptions } from './types-Chg8ASmf.cjs';
2
- import { S as SyncEngine } from './sync-engine-gpxyhQBl.cjs';
3
-
4
- /**
5
- * Base class that holds the transport functions.
6
- * Every generated model, connection, query, and the root SDK class extend this.
7
- *
8
- * Operation classes use `_syncEngine` for queries/mutations/watch.
9
- * Subscription classes use `_subscribe` for WebSocket streaming.
10
- * Model classes use `_request` for compatibility (lazy fetch).
11
- */
12
- declare class Request {
13
- protected _request: DvinaRequest;
14
- protected _syncEngine?: SyncEngine;
15
- protected _subscribe?: DvinaSubscribe;
16
- protected _baseUrl?: string;
17
- constructor(request: DvinaRequest, syncEngine?: SyncEngine, subscribe?: DvinaSubscribe, baseUrl?: string);
18
- }
19
-
20
- /**
21
- * Default connection variables when paginating.
22
- * Ensures `first` or `last` is set when a cursor is provided.
23
- */
24
- declare function defaultConnection<V extends ConnectionVariables>(variables: V): V;
25
- /**
26
- * PageInfo model following the Relay spec.
27
- */
28
- declare class PageInfo {
29
- hasNextPage: boolean;
30
- hasPreviousPage: boolean;
31
- startCursor?: string | null;
32
- endCursor?: string | null;
33
- constructor(data: PageInfoData);
34
- }
35
- /**
36
- * Abstract base class for connection types.
37
- * Holds nodes and page info, used for type checking.
38
- */
39
- declare abstract class AbstractConnection<Node> extends Request {
40
- pageInfo: PageInfo;
41
- nodes: Node[];
42
- totalCount?: number;
43
- constructor(request: DvinaRequest);
44
- }
45
- /**
46
- * Concrete connection class with pagination helpers.
47
- * Generated connection subclasses extend this.
48
- *
49
- * The `_fetch` closure is created by the query class and allows re-fetching
50
- * with different pagination variables.
51
- */
52
- declare class Connection<Node> extends AbstractConnection<Node> {
53
- private _fetch;
54
- constructor(request: DvinaRequest, fetch: (variables?: ConnectionVariables, options?: FetchOptions) => Promise<Connection<Node> | undefined>, nodes: Node[], pageInfo: PageInfo, totalCount?: number);
55
- /**
56
- * Fetch the next page and append nodes.
57
- * Mutates this connection instance in place (nodes are appended, pageInfo updated).
58
- */
59
- fetchNext(options?: FetchOptions): Promise<this>;
60
- /**
61
- * Fetch the previous page and prepend nodes.
62
- * Mutates this connection instance in place (nodes are prepended, pageInfo updated).
63
- */
64
- fetchPrevious(options?: FetchOptions): Promise<this>;
65
- }
66
-
67
- /**
68
- * Extract all nodes from a connection.
69
- */
70
- declare function extractNodes<T>(connection: Connection<T>): T[];
71
- /**
72
- * Merge two connections into a new connection. Appends the second connection's
73
- * nodes after the first's. Uses the second connection's end cursor and hasNextPage.
74
- *
75
- * Neither input connection is modified.
76
- */
77
- declare function mergeConnections<T>(first: Connection<T>, second: Connection<T>): Connection<T>;
78
-
79
- export { AbstractConnection as A, Connection as C, PageInfo as P, Request as R, defaultConnection as d, extractNodes as e, mergeConnections as m };