get-db9 0.6.0 → 0.6.1

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 CHANGED
@@ -34,9 +34,9 @@ const db = await instantDatabase({
34
34
  Full typed client for the API — databases, SQL, file storage, tokens, migrations, and more.
35
35
 
36
36
  ```typescript
37
- import { createDb9Client } from 'get-db9/client';
37
+ import { createDb9Client } from 'get-db9';
38
38
 
39
- // No token needed. Automatically anonymous-registers and saves credentials.
39
+ // Uses the credential store if present, or auto-registers an anonymous session.
40
40
  const client = createDb9Client();
41
41
 
42
42
  // Create a database
@@ -68,7 +68,7 @@ high-level API for file operations.
68
68
  > and pass it via the `WebSocket` option.
69
69
 
70
70
  ```typescript
71
- import { createDb9Client } from 'get-db9/client';
71
+ import { createDb9Client } from 'get-db9';
72
72
  import WebSocket from 'ws'; // Node 18–20 only
73
73
 
74
74
  const client = createDb9Client({ WebSocket: WebSocket as any });
@@ -146,6 +146,14 @@ const tokens = await client.tokens.list();
146
146
  await client.tokens.revoke(token.id);
147
147
  ```
148
148
 
149
+ ## Anonymous + Claim
150
+
151
+ If no credentials are available, the SDK auto-registers an anonymous session on the first authenticated call and stores `token`, `is_anonymous`, `anonymous_id`, and `anonymous_secret` in the configured credential store (`~/.db9/credentials` by default).
152
+
153
+ - Run `db9 claim` (or `db9 claim --id-token <AUTH0_ID_TOKEN>`) to upgrade that account to
154
+ a verified Auth0 identity.
155
+ - After claim, continue using the stored token or create named API tokens for CI/CD and agents.
156
+
149
157
  ## Database Credentials
150
158
 
151
159
  Retrieve stored admin credentials without resetting the password:
@@ -161,42 +169,6 @@ console.log(creds.admin_password); // current password
161
169
  console.log(creds.connection_string); // full connection string
162
170
  ```
163
171
 
164
- ## Device Authorization (CLI flow)
165
-
166
- Authorize a CLI or device using the OAuth device code flow:
167
-
168
- ```typescript
169
- const client = createDb9Client();
170
-
171
- // 1. Start device code flow
172
- const code = await client.deviceAuth.createDeviceCode();
173
- console.log(`Visit: ${code.verification_uri}`);
174
- console.log(`Code: ${code.user_code}`);
175
-
176
- // 2. Poll for authorization (user approves in browser)
177
- const poll = async () => {
178
- while (true) {
179
- const result = await client.deviceAuth.pollDeviceToken({
180
- device_code: code.device_code,
181
- });
182
- if ('token' in result) {
183
- return result; // { token, expires_at }
184
- }
185
- if (result.error === 'access_denied') {
186
- throw new Error('User denied authorization');
187
- }
188
- if (result.error === 'expired_token') {
189
- throw new Error('Device code expired');
190
- }
191
- // authorization_pending — wait and retry
192
- await new Promise((r) => setTimeout(r, code.interval * 1000));
193
- }
194
- };
195
-
196
- const auth = await poll();
197
- console.log(auth.token);
198
- ```
199
-
200
172
  ## SQL Error Handling
201
173
 
202
174
  SQL results include structured error details when queries fail:
@@ -253,7 +225,7 @@ if (result.error) {
253
225
  ```typescript
254
226
  import { createDb9Client } from 'get-db9';
255
227
 
256
- // No token needed! Auto-registers anonymously
228
+ // Loads existing credentials or auto-registers an anonymous session
257
229
  const client = createDb9Client();
258
230
  const db = await client.databases.create({ name: 'myapp' });
259
231
  ```
@@ -261,7 +233,14 @@ const db = await client.databases.create({ name: 'myapp' });
261
233
  ## Error Handling
262
234
 
263
235
  ```typescript
264
- import { Db9Error, Db9AuthError, Db9NotFoundError } from 'get-db9';
236
+ import {
237
+ createDb9Client,
238
+ Db9Error,
239
+ Db9AuthError,
240
+ Db9NotFoundError,
241
+ } from 'get-db9';
242
+
243
+ const client = createDb9Client();
265
244
 
266
245
  try {
267
246
  await client.databases.get('nonexistent');
@@ -276,7 +255,7 @@ try {
276
255
  }
277
256
  ```
278
257
 
279
- > **Note:** 401 errors are automatically retried with a fresh token for anonymous sessions. You typically won't see `Db9AuthError` unless the refresh itself fails.
258
+ > **Note:** If you rely on `instanceof`, import `createDb9Client` and the error classes from the same entrypoint: `get-db9`.
280
259
 
281
260
  ## Credential Storage
282
261
 
@@ -301,14 +280,7 @@ const memStore = new MemoryCredentialStore();
301
280
 
302
281
  | Method | Description |
303
282
  |--------|-------------|
304
- | `register(req)` | Create account with email/password |
305
- | `login(req)` | Login and get bearer token |
306
283
  | `me()` | Get current user profile |
307
- | `anonymousRegister()` | Register anonymously (auto-called) |
308
- | `anonymousRefresh(req)` | Refresh anonymous token |
309
- | `getAnonymousSecret()` | Retrieve anonymous secret for token refresh |
310
- | `ensureAnonymousSecret()` | Ensure anonymous secret is saved to credential store |
311
- | `claim(req)` | Claim anonymous account with email/password |
312
284
 
313
285
  ### `client.tokens`
314
286
 
@@ -358,14 +330,6 @@ All methods auto-resolve database credentials and connect via WebSocket.
358
330
  | `remove(dbId, path, opts?)` | Remove file or directory (`{ recursive?: boolean }`) |
359
331
  | `rename(dbId, old, new)` | Rename (move) a file or directory |
360
332
 
361
- ### `client.deviceAuth`
362
-
363
- | Method | Description |
364
- |--------|-------------|
365
- | `createDeviceCode()` | Start OAuth device code flow |
366
- | `pollDeviceToken(req)` | Poll for token after user authorizes |
367
- | `verifyDevice(req)` | Submit device verification with email/password |
368
-
369
333
  ## Requirements
370
334
 
371
335
  - Node.js >= 18 (native fetch)
@@ -22,9 +22,6 @@ interface HttpClient {
22
22
  /** Credential fields stored in `~/.db9/credentials` (TOML). */
23
23
  interface Credentials {
24
24
  token: string;
25
- is_anonymous?: boolean;
26
- anonymous_id?: string;
27
- anonymous_secret?: string;
28
25
  }
29
26
  /** Async credential persistence abstraction. */
30
27
  interface CredentialStore {
@@ -107,6 +104,12 @@ interface FsConnectOptions {
107
104
  type Fs9FileEntry = FileInfo;
108
105
  /** @deprecated Use `FsListOptions` instead. */
109
106
  type Fs9ListOptions = FsListOptions;
107
+ /** Server response when ready to accept streaming binary frames. */
108
+ interface StreamWriteReady {
109
+ ready: boolean;
110
+ stream_id: number;
111
+ chunk_size: number;
112
+ }
110
113
 
111
114
  /**
112
115
  * WebSocket client for the fs9 filesystem protocol.
@@ -114,15 +117,17 @@ type Fs9ListOptions = FsListOptions;
114
117
  * Mirrors db9-cli/src/fssh/client.rs — each public method maps to a single
115
118
  * request–response round-trip over a JSON text WebSocket.
116
119
  *
117
- * The client is environment-agnostic: pass any W3C-compatible WebSocket
118
- * constructor (native `WebSocket` in browsers/Deno/Bun/Node 21+, or the
119
- * `ws` npm package for Node 18–20).
120
+ * For files >= 1 MB, writeFile() automatically switches to streaming mode
121
+ * using binary WebSocket frames to bypass the 2 MB JSON frame limit and
122
+ * eliminate base64 encoding overhead.
123
+ *
124
+ * Node-only: requires the `ws` package or Node 21+ native WebSocket.
120
125
  */
121
126
 
122
- /** Minimal W3C WebSocket interface we depend on. */
127
+ /** Minimal WebSocket interface we depend on (compatible with `ws` package). */
123
128
  interface WebSocketLike {
124
129
  readonly readyState: number;
125
- send(data: string): void;
130
+ send(data: string | Buffer | Uint8Array): void;
126
131
  close(code?: number, reason?: string): void;
127
132
  onopen: ((ev: unknown) => void) | null;
128
133
  onclose: ((ev: unknown) => void) | null;
@@ -171,7 +176,12 @@ declare class FsClient {
171
176
  mkdir(path: string, recursive?: boolean): Promise<void>;
172
177
  /** Read an entire file, returning raw bytes. */
173
178
  readFile(path: string): Promise<Uint8Array>;
174
- /** Write (overwrite) a file. Returns bytes written. */
179
+ /**
180
+ * Write (overwrite) a file. Returns bytes written.
181
+ *
182
+ * Automatically uses streaming mode for files >= 1 MB to avoid base64
183
+ * overhead and bypass the 2 MB JSON frame limit.
184
+ */
175
185
  writeFile(path: string, data: Uint8Array | ArrayBuffer | string): Promise<number>;
176
186
  /** Append to a file. Returns bytes written. */
177
187
  appendFile(path: string, data: Uint8Array | ArrayBuffer | string): Promise<number>;
@@ -181,6 +191,19 @@ declare class FsClient {
181
191
  rename(oldPath: string, newPath: string): Promise<void>;
182
192
  /** Gracefully close the WebSocket connection. */
183
193
  close(): Promise<void>;
194
+ /**
195
+ * Write a file using streaming mode (binary frames, no base64).
196
+ *
197
+ * Protocol:
198
+ * 1. Send streaming write request with file size
199
+ * 2. Receive ready response with stream_id and chunk_size
200
+ * 3. Send binary frames: [8-byte stream_id BE][chunk_data]
201
+ * 4. Send stream end with checksum
202
+ * 5. Receive final write confirmation
203
+ */
204
+ private writeFileStreaming;
205
+ /** Best-effort abort of an in-progress stream so the server can clean up. */
206
+ private tryAbortStream;
184
207
  private sendAndRecv;
185
208
  private expectOk;
186
209
  private errorMessage;
@@ -373,14 +396,6 @@ interface TenantObservabilityResponse {
373
396
  summary: ObservabilitySummary;
374
397
  samples: QuerySample[];
375
398
  }
376
- interface RegisterRequest {
377
- email: string;
378
- password: string;
379
- }
380
- interface LoginRequest {
381
- email: string;
382
- password: string;
383
- }
384
399
  interface CreateDatabaseRequest {
385
400
  name: string;
386
401
  region?: string;
@@ -401,14 +416,6 @@ interface MigrationApplyRequest {
401
416
  interface BranchRequest {
402
417
  name: string;
403
418
  }
404
- interface ClaimRequest {
405
- email: string;
406
- password: string;
407
- }
408
- interface AnonymousRefreshRequest {
409
- anonymous_id: string;
410
- anonymous_secret: string;
411
- }
412
419
  interface CreateUserRequest {
413
420
  username: string;
414
421
  password: string;
@@ -423,34 +430,11 @@ interface CustomerResponse {
423
430
  created_at: string;
424
431
  status: string;
425
432
  }
426
- interface LoginResponse {
427
- token: string;
428
- expires_at: string;
429
- }
430
- interface AnonymousRegisterResponse {
431
- token: string;
432
- expires_at: string;
433
- is_anonymous: boolean;
434
- anonymous_id: string;
435
- anonymous_secret: string;
436
- }
437
- interface AnonymousRefreshResponse {
438
- token: string;
439
- expires_at: string;
440
- }
441
- interface AnonymousSecretResponse {
442
- anonymous_id: string;
443
- anonymous_secret: string;
444
- }
445
- interface ClaimResponse {
446
- id: string;
447
- email: string;
448
- claimed: boolean;
449
- }
450
433
  interface DatabaseResponse {
451
434
  id: string;
452
435
  name: string;
453
436
  state: string;
437
+ parent_database_id?: string;
454
438
  region?: string;
455
439
  endpoints?: Endpoint[];
456
440
  admin_user?: string;
@@ -526,28 +510,6 @@ interface Fs9EventOptions {
526
510
  path?: string;
527
511
  type?: string;
528
512
  }
529
- interface DeviceCodeResponse {
530
- device_code: string;
531
- user_code: string;
532
- verification_uri: string;
533
- expires_in: number;
534
- interval: number;
535
- }
536
- interface DeviceTokenRequest {
537
- device_code: string;
538
- }
539
- interface DeviceTokenResponse {
540
- token: string;
541
- expires_at: string;
542
- }
543
- interface DeviceTokenErrorResponse {
544
- error: 'authorization_pending' | 'expired_token' | 'access_denied';
545
- }
546
- interface DeviceVerifyRequest {
547
- user_code: string;
548
- email: string;
549
- password: string;
550
- }
551
513
  type TenantState = 'CREATING' | 'ACTIVE' | 'DISABLING' | 'DISABLED' | 'CREATE_FAILED';
552
514
 
553
515
  interface Db9ClientOptions {
@@ -565,14 +527,7 @@ interface Db9ClientOptions {
565
527
  }
566
528
  declare function createDb9Client(options?: Db9ClientOptions): {
567
529
  auth: {
568
- register: (req: RegisterRequest) => Promise<CustomerResponse>;
569
- login: (req: LoginRequest) => Promise<LoginResponse>;
570
- anonymousRegister: () => Promise<AnonymousRegisterResponse>;
571
- anonymousRefresh: (req: AnonymousRefreshRequest) => Promise<AnonymousRefreshResponse>;
572
530
  me: () => Promise<CustomerResponse>;
573
- getAnonymousSecret: () => Promise<AnonymousSecretResponse>;
574
- claim: (req: ClaimRequest) => Promise<ClaimResponse>;
575
- ensureAnonymousSecret: () => Promise<void>;
576
531
  };
577
532
  tokens: {
578
533
  list: () => Promise<TokenResponse[]>;
@@ -629,15 +584,7 @@ declare function createDb9Client(options?: Db9ClientOptions): {
629
584
  /** Rename (move) a file or directory. */
630
585
  rename: (dbId: string, oldPath: string, newPath: string) => Promise<void>;
631
586
  };
632
- deviceAuth: {
633
- /** Start device code flow. Returns codes for user to authorize. */
634
- createDeviceCode: () => Promise<DeviceCodeResponse>;
635
- /** Poll for device token after user authorizes. Returns token or error status. */
636
- pollDeviceToken: (req: DeviceTokenRequest) => Promise<DeviceTokenResponse | DeviceTokenErrorResponse>;
637
- /** Submit device verification with user credentials. */
638
- verifyDevice: (req: DeviceVerifyRequest) => Promise<MessageResponse>;
639
- };
640
587
  };
641
588
  type Db9Client = ReturnType<typeof createDb9Client>;
642
589
 
643
- export { type FsWsError as $, type AdminCreateUserRequest as A, type BatchCreateRequest as B, type CredentialStore as C, type DatabaseResponse as D, type Db9Client as E, type FetchFn as F, type Db9ClientOptions as G, type DeviceCodeResponse as H, type DeviceTokenErrorResponse as I, type DeviceTokenRequest as J, type DeviceTokenResponse as K, type DeviceVerifyRequest as L, type DumpRequest as M, type DumpResponse as N, type Endpoint as O, FileCredentialStore as P, type FileInfo as Q, type Fs9EventEntry as R, type Fs9EventOptions as S, type Fs9FileEntry as T, type Fs9ListOptions as U, type FsAuthInfo as V, FsClient as W, type FsConnectOptions as X, FsError as Y, type FsListOptions as Z, type FsRemoveOptions as _, type AnonymousRefreshRequest as a, type FsWsRequest as a0, type FsWsResponse as a1, type HealthResponse as a2, type HttpClient as a3, type HttpClientOptions as a4, type ListTenantsParams as a5, type LoginRequest as a6, type LoginResponse as a7, MemoryCredentialStore as a8, type MessageResponse as a9, type WebSocketLike as aA, createDb9Client as aB, defaultCredentialStore as aC, type MigrationApplyRequest as aa, type MigrationApplyResponse as ab, type MigrationMetadata as ac, type ObservabilitySummary as ad, type PasswordResetResponse as ae, type QuerySample as af, type RegisterRequest as ag, type SchemaResponse as ah, type SqlErrorDetail as ai, type SqlExecuteRequest as aj, type SqlQueryRequest as ak, type SqlQueryResponse as al, type SqlResult as am, type TableMetadata as an, type TenantConnectRequest as ao, type TenantConnectResponse as ap, type TenantListResponse as aq, type TenantObservabilityResponse as ar, type TenantResponse as as, type TenantState as at, type TenantUpdateRequest as au, type TokenResponse as av, type UserCreateResponse as aw, type UserResponse as ax, type ViewMetadata as ay, type WebSocketConstructor as az, type AnonymousRefreshResponse as b, type AnonymousRegisterResponse as c, type AnonymousSecretResponse as d, type AuditLogParams as e, type AuditLogResponse as f, type BatchCreateResponse as g, type BatchDeleteRequest as h, type BatchDeleteResponse as i, type BatchItemError as j, type BatchUpdateRequest as k, type BatchUpdateResponse as l, type BranchRequest as m, type ClaimRequest as n, type ClaimResponse as o, type ColumnInfo as p, type ColumnMetadata as q, type CreateDatabaseRequest as r, type CreateTenantRequest as s, type CreateTenantResponse as t, type CreateTokenRequest as u, type CreateTokenResponse as v, type CreateUserRequest as w, type Credentials as x, type CustomerPasswordResetResponse as y, type CustomerResponse as z };
590
+ export { type MigrationMetadata as $, type AdminCreateUserRequest as A, type BatchCreateRequest as B, type CredentialStore as C, type DatabaseResponse as D, type Endpoint as E, type FetchFn as F, type Fs9EventEntry as G, type Fs9EventOptions as H, type Fs9FileEntry as I, type Fs9ListOptions as J, type FsAuthInfo as K, FsClient as L, type FsConnectOptions as M, FsError as N, type FsListOptions as O, type FsRemoveOptions as P, type FsWsError as Q, type FsWsRequest as R, type FsWsResponse as S, type HealthResponse as T, type HttpClient as U, type HttpClientOptions as V, type ListTenantsParams as W, MemoryCredentialStore as X, type MessageResponse as Y, type MigrationApplyRequest as Z, type MigrationApplyResponse as _, type AuditLogParams as a, type ObservabilitySummary as a0, type PasswordResetResponse as a1, type QuerySample as a2, type SchemaResponse as a3, type SqlErrorDetail as a4, type SqlExecuteRequest as a5, type SqlQueryRequest as a6, type SqlQueryResponse as a7, type SqlResult as a8, type StreamWriteReady as a9, type TableMetadata as aa, type TenantConnectRequest as ab, type TenantConnectResponse as ac, type TenantListResponse as ad, type TenantObservabilityResponse as ae, type TenantResponse as af, type TenantState as ag, type TenantUpdateRequest as ah, type TokenResponse as ai, type UserCreateResponse as aj, type UserResponse as ak, type ViewMetadata as al, type WebSocketConstructor as am, type WebSocketLike as an, createDb9Client as ao, defaultCredentialStore as ap, type AuditLogResponse as b, type BatchCreateResponse as c, type BatchDeleteRequest as d, type BatchDeleteResponse as e, type BatchItemError as f, type BatchUpdateRequest as g, type BatchUpdateResponse as h, type BranchRequest as i, type ColumnInfo as j, type ColumnMetadata as k, type CreateDatabaseRequest as l, type CreateTenantRequest as m, type CreateTenantResponse as n, type CreateTokenRequest as o, type CreateTokenResponse as p, type CreateUserRequest as q, type Credentials as r, type CustomerPasswordResetResponse as s, type CustomerResponse as t, type Db9Client as u, type Db9ClientOptions as v, type DumpRequest as w, type DumpResponse as x, FileCredentialStore as y, type FileInfo as z };
@@ -22,9 +22,6 @@ interface HttpClient {
22
22
  /** Credential fields stored in `~/.db9/credentials` (TOML). */
23
23
  interface Credentials {
24
24
  token: string;
25
- is_anonymous?: boolean;
26
- anonymous_id?: string;
27
- anonymous_secret?: string;
28
25
  }
29
26
  /** Async credential persistence abstraction. */
30
27
  interface CredentialStore {
@@ -107,6 +104,12 @@ interface FsConnectOptions {
107
104
  type Fs9FileEntry = FileInfo;
108
105
  /** @deprecated Use `FsListOptions` instead. */
109
106
  type Fs9ListOptions = FsListOptions;
107
+ /** Server response when ready to accept streaming binary frames. */
108
+ interface StreamWriteReady {
109
+ ready: boolean;
110
+ stream_id: number;
111
+ chunk_size: number;
112
+ }
110
113
 
111
114
  /**
112
115
  * WebSocket client for the fs9 filesystem protocol.
@@ -114,15 +117,17 @@ type Fs9ListOptions = FsListOptions;
114
117
  * Mirrors db9-cli/src/fssh/client.rs — each public method maps to a single
115
118
  * request–response round-trip over a JSON text WebSocket.
116
119
  *
117
- * The client is environment-agnostic: pass any W3C-compatible WebSocket
118
- * constructor (native `WebSocket` in browsers/Deno/Bun/Node 21+, or the
119
- * `ws` npm package for Node 18–20).
120
+ * For files >= 1 MB, writeFile() automatically switches to streaming mode
121
+ * using binary WebSocket frames to bypass the 2 MB JSON frame limit and
122
+ * eliminate base64 encoding overhead.
123
+ *
124
+ * Node-only: requires the `ws` package or Node 21+ native WebSocket.
120
125
  */
121
126
 
122
- /** Minimal W3C WebSocket interface we depend on. */
127
+ /** Minimal WebSocket interface we depend on (compatible with `ws` package). */
123
128
  interface WebSocketLike {
124
129
  readonly readyState: number;
125
- send(data: string): void;
130
+ send(data: string | Buffer | Uint8Array): void;
126
131
  close(code?: number, reason?: string): void;
127
132
  onopen: ((ev: unknown) => void) | null;
128
133
  onclose: ((ev: unknown) => void) | null;
@@ -171,7 +176,12 @@ declare class FsClient {
171
176
  mkdir(path: string, recursive?: boolean): Promise<void>;
172
177
  /** Read an entire file, returning raw bytes. */
173
178
  readFile(path: string): Promise<Uint8Array>;
174
- /** Write (overwrite) a file. Returns bytes written. */
179
+ /**
180
+ * Write (overwrite) a file. Returns bytes written.
181
+ *
182
+ * Automatically uses streaming mode for files >= 1 MB to avoid base64
183
+ * overhead and bypass the 2 MB JSON frame limit.
184
+ */
175
185
  writeFile(path: string, data: Uint8Array | ArrayBuffer | string): Promise<number>;
176
186
  /** Append to a file. Returns bytes written. */
177
187
  appendFile(path: string, data: Uint8Array | ArrayBuffer | string): Promise<number>;
@@ -181,6 +191,19 @@ declare class FsClient {
181
191
  rename(oldPath: string, newPath: string): Promise<void>;
182
192
  /** Gracefully close the WebSocket connection. */
183
193
  close(): Promise<void>;
194
+ /**
195
+ * Write a file using streaming mode (binary frames, no base64).
196
+ *
197
+ * Protocol:
198
+ * 1. Send streaming write request with file size
199
+ * 2. Receive ready response with stream_id and chunk_size
200
+ * 3. Send binary frames: [8-byte stream_id BE][chunk_data]
201
+ * 4. Send stream end with checksum
202
+ * 5. Receive final write confirmation
203
+ */
204
+ private writeFileStreaming;
205
+ /** Best-effort abort of an in-progress stream so the server can clean up. */
206
+ private tryAbortStream;
184
207
  private sendAndRecv;
185
208
  private expectOk;
186
209
  private errorMessage;
@@ -373,14 +396,6 @@ interface TenantObservabilityResponse {
373
396
  summary: ObservabilitySummary;
374
397
  samples: QuerySample[];
375
398
  }
376
- interface RegisterRequest {
377
- email: string;
378
- password: string;
379
- }
380
- interface LoginRequest {
381
- email: string;
382
- password: string;
383
- }
384
399
  interface CreateDatabaseRequest {
385
400
  name: string;
386
401
  region?: string;
@@ -401,14 +416,6 @@ interface MigrationApplyRequest {
401
416
  interface BranchRequest {
402
417
  name: string;
403
418
  }
404
- interface ClaimRequest {
405
- email: string;
406
- password: string;
407
- }
408
- interface AnonymousRefreshRequest {
409
- anonymous_id: string;
410
- anonymous_secret: string;
411
- }
412
419
  interface CreateUserRequest {
413
420
  username: string;
414
421
  password: string;
@@ -423,34 +430,11 @@ interface CustomerResponse {
423
430
  created_at: string;
424
431
  status: string;
425
432
  }
426
- interface LoginResponse {
427
- token: string;
428
- expires_at: string;
429
- }
430
- interface AnonymousRegisterResponse {
431
- token: string;
432
- expires_at: string;
433
- is_anonymous: boolean;
434
- anonymous_id: string;
435
- anonymous_secret: string;
436
- }
437
- interface AnonymousRefreshResponse {
438
- token: string;
439
- expires_at: string;
440
- }
441
- interface AnonymousSecretResponse {
442
- anonymous_id: string;
443
- anonymous_secret: string;
444
- }
445
- interface ClaimResponse {
446
- id: string;
447
- email: string;
448
- claimed: boolean;
449
- }
450
433
  interface DatabaseResponse {
451
434
  id: string;
452
435
  name: string;
453
436
  state: string;
437
+ parent_database_id?: string;
454
438
  region?: string;
455
439
  endpoints?: Endpoint[];
456
440
  admin_user?: string;
@@ -526,28 +510,6 @@ interface Fs9EventOptions {
526
510
  path?: string;
527
511
  type?: string;
528
512
  }
529
- interface DeviceCodeResponse {
530
- device_code: string;
531
- user_code: string;
532
- verification_uri: string;
533
- expires_in: number;
534
- interval: number;
535
- }
536
- interface DeviceTokenRequest {
537
- device_code: string;
538
- }
539
- interface DeviceTokenResponse {
540
- token: string;
541
- expires_at: string;
542
- }
543
- interface DeviceTokenErrorResponse {
544
- error: 'authorization_pending' | 'expired_token' | 'access_denied';
545
- }
546
- interface DeviceVerifyRequest {
547
- user_code: string;
548
- email: string;
549
- password: string;
550
- }
551
513
  type TenantState = 'CREATING' | 'ACTIVE' | 'DISABLING' | 'DISABLED' | 'CREATE_FAILED';
552
514
 
553
515
  interface Db9ClientOptions {
@@ -565,14 +527,7 @@ interface Db9ClientOptions {
565
527
  }
566
528
  declare function createDb9Client(options?: Db9ClientOptions): {
567
529
  auth: {
568
- register: (req: RegisterRequest) => Promise<CustomerResponse>;
569
- login: (req: LoginRequest) => Promise<LoginResponse>;
570
- anonymousRegister: () => Promise<AnonymousRegisterResponse>;
571
- anonymousRefresh: (req: AnonymousRefreshRequest) => Promise<AnonymousRefreshResponse>;
572
530
  me: () => Promise<CustomerResponse>;
573
- getAnonymousSecret: () => Promise<AnonymousSecretResponse>;
574
- claim: (req: ClaimRequest) => Promise<ClaimResponse>;
575
- ensureAnonymousSecret: () => Promise<void>;
576
531
  };
577
532
  tokens: {
578
533
  list: () => Promise<TokenResponse[]>;
@@ -629,15 +584,7 @@ declare function createDb9Client(options?: Db9ClientOptions): {
629
584
  /** Rename (move) a file or directory. */
630
585
  rename: (dbId: string, oldPath: string, newPath: string) => Promise<void>;
631
586
  };
632
- deviceAuth: {
633
- /** Start device code flow. Returns codes for user to authorize. */
634
- createDeviceCode: () => Promise<DeviceCodeResponse>;
635
- /** Poll for device token after user authorizes. Returns token or error status. */
636
- pollDeviceToken: (req: DeviceTokenRequest) => Promise<DeviceTokenResponse | DeviceTokenErrorResponse>;
637
- /** Submit device verification with user credentials. */
638
- verifyDevice: (req: DeviceVerifyRequest) => Promise<MessageResponse>;
639
- };
640
587
  };
641
588
  type Db9Client = ReturnType<typeof createDb9Client>;
642
589
 
643
- export { type FsWsError as $, type AdminCreateUserRequest as A, type BatchCreateRequest as B, type CredentialStore as C, type DatabaseResponse as D, type Db9Client as E, type FetchFn as F, type Db9ClientOptions as G, type DeviceCodeResponse as H, type DeviceTokenErrorResponse as I, type DeviceTokenRequest as J, type DeviceTokenResponse as K, type DeviceVerifyRequest as L, type DumpRequest as M, type DumpResponse as N, type Endpoint as O, FileCredentialStore as P, type FileInfo as Q, type Fs9EventEntry as R, type Fs9EventOptions as S, type Fs9FileEntry as T, type Fs9ListOptions as U, type FsAuthInfo as V, FsClient as W, type FsConnectOptions as X, FsError as Y, type FsListOptions as Z, type FsRemoveOptions as _, type AnonymousRefreshRequest as a, type FsWsRequest as a0, type FsWsResponse as a1, type HealthResponse as a2, type HttpClient as a3, type HttpClientOptions as a4, type ListTenantsParams as a5, type LoginRequest as a6, type LoginResponse as a7, MemoryCredentialStore as a8, type MessageResponse as a9, type WebSocketLike as aA, createDb9Client as aB, defaultCredentialStore as aC, type MigrationApplyRequest as aa, type MigrationApplyResponse as ab, type MigrationMetadata as ac, type ObservabilitySummary as ad, type PasswordResetResponse as ae, type QuerySample as af, type RegisterRequest as ag, type SchemaResponse as ah, type SqlErrorDetail as ai, type SqlExecuteRequest as aj, type SqlQueryRequest as ak, type SqlQueryResponse as al, type SqlResult as am, type TableMetadata as an, type TenantConnectRequest as ao, type TenantConnectResponse as ap, type TenantListResponse as aq, type TenantObservabilityResponse as ar, type TenantResponse as as, type TenantState as at, type TenantUpdateRequest as au, type TokenResponse as av, type UserCreateResponse as aw, type UserResponse as ax, type ViewMetadata as ay, type WebSocketConstructor as az, type AnonymousRefreshResponse as b, type AnonymousRegisterResponse as c, type AnonymousSecretResponse as d, type AuditLogParams as e, type AuditLogResponse as f, type BatchCreateResponse as g, type BatchDeleteRequest as h, type BatchDeleteResponse as i, type BatchItemError as j, type BatchUpdateRequest as k, type BatchUpdateResponse as l, type BranchRequest as m, type ClaimRequest as n, type ClaimResponse as o, type ColumnInfo as p, type ColumnMetadata as q, type CreateDatabaseRequest as r, type CreateTenantRequest as s, type CreateTenantResponse as t, type CreateTokenRequest as u, type CreateTokenResponse as v, type CreateUserRequest as w, type Credentials as x, type CustomerPasswordResetResponse as y, type CustomerResponse as z };
590
+ export { type MigrationMetadata as $, type AdminCreateUserRequest as A, type BatchCreateRequest as B, type CredentialStore as C, type DatabaseResponse as D, type Endpoint as E, type FetchFn as F, type Fs9EventEntry as G, type Fs9EventOptions as H, type Fs9FileEntry as I, type Fs9ListOptions as J, type FsAuthInfo as K, FsClient as L, type FsConnectOptions as M, FsError as N, type FsListOptions as O, type FsRemoveOptions as P, type FsWsError as Q, type FsWsRequest as R, type FsWsResponse as S, type HealthResponse as T, type HttpClient as U, type HttpClientOptions as V, type ListTenantsParams as W, MemoryCredentialStore as X, type MessageResponse as Y, type MigrationApplyRequest as Z, type MigrationApplyResponse as _, type AuditLogParams as a, type ObservabilitySummary as a0, type PasswordResetResponse as a1, type QuerySample as a2, type SchemaResponse as a3, type SqlErrorDetail as a4, type SqlExecuteRequest as a5, type SqlQueryRequest as a6, type SqlQueryResponse as a7, type SqlResult as a8, type StreamWriteReady as a9, type TableMetadata as aa, type TenantConnectRequest as ab, type TenantConnectResponse as ac, type TenantListResponse as ad, type TenantObservabilityResponse as ae, type TenantResponse as af, type TenantState as ag, type TenantUpdateRequest as ah, type TokenResponse as ai, type UserCreateResponse as aj, type UserResponse as ak, type ViewMetadata as al, type WebSocketConstructor as am, type WebSocketLike as an, createDb9Client as ao, defaultCredentialStore as ap, type AuditLogResponse as b, type BatchCreateResponse as c, type BatchDeleteRequest as d, type BatchDeleteResponse as e, type BatchItemError as f, type BatchUpdateRequest as g, type BatchUpdateResponse as h, type BranchRequest as i, type ColumnInfo as j, type ColumnMetadata as k, type CreateDatabaseRequest as l, type CreateTenantRequest as m, type CreateTenantResponse as n, type CreateTokenRequest as o, type CreateTokenResponse as p, type CreateUserRequest as q, type Credentials as r, type CustomerPasswordResetResponse as s, type CustomerResponse as t, type Db9Client as u, type Db9ClientOptions as v, type DumpRequest as w, type DumpResponse as x, FileCredentialStore as y, type FileInfo as z };