@delali/sirannon-db 0.3.6-next.77 → 0.3.6-next.78

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 (72) hide show
  1. package/dist/backup/index.d.ts +5 -5
  2. package/dist/backup/index.mjs +5 -3
  3. package/dist/backup-scheduler/index.d.ts +2 -2
  4. package/dist/backup-scheduler/index.mjs +2 -2
  5. package/dist/chunk-22TYGH7J.mjs +55 -0
  6. package/dist/{chunk-SB3MIFLG.mjs → chunk-2ZQOZFX7.mjs} +29 -6
  7. package/dist/{chunk-UIDQGPJY.mjs → chunk-4O7WYZHN.mjs} +38 -3
  8. package/dist/{chunk-ZFFUVYYE.mjs → chunk-5DKWHT6K.mjs} +109 -1
  9. package/dist/chunk-5O4J6LQQ.mjs +35 -0
  10. package/dist/{chunk-CZL4D3BM.mjs → chunk-6CABU54O.mjs} +2 -2
  11. package/dist/{chunk-JAQ2I4OT.mjs → chunk-A5ULJVK7.mjs} +11 -11
  12. package/dist/{chunk-RLBKZZ24.mjs → chunk-AC7TKWNH.mjs} +1 -0
  13. package/dist/chunk-BKO4SCEC.mjs +99 -0
  14. package/dist/{chunk-KOTBP4AW.mjs → chunk-C7E4H6UN.mjs} +24 -4
  15. package/dist/{chunk-G4AG3ESO.mjs → chunk-FBA7P4ZA.mjs} +114 -149
  16. package/dist/{chunk-DKML5425.mjs → chunk-GBVB6WSC.mjs} +2 -2
  17. package/dist/chunk-I4JY5QPA.mjs +51 -0
  18. package/dist/{chunk-L6EX6K27.mjs → chunk-MO4APBYG.mjs} +54 -13
  19. package/dist/{chunk-RPWBYASV.mjs → chunk-MTOQ6QIS.mjs} +1 -1
  20. package/dist/chunk-MX77PGEN.mjs +60 -0
  21. package/dist/{chunk-BTUD6XQO.mjs → chunk-N3MHZV3B.mjs} +11 -29
  22. package/dist/{chunk-UHUDPQFI.mjs → chunk-OJXV4L3N.mjs} +1 -3
  23. package/dist/chunk-QF7WF7RJ.mjs +34 -0
  24. package/dist/chunk-RLBV4YTB.mjs +22 -0
  25. package/dist/{chunk-ISDT4RBD.mjs → chunk-ULUZUBON.mjs} +1 -1
  26. package/dist/{chunk-AP4367HK.mjs → chunk-VGRAAQX3.mjs} +4 -4
  27. package/dist/chunk-W74HFQFD.mjs +153 -0
  28. package/dist/chunk-Y4SP7CRF.mjs +9 -0
  29. package/dist/{chunk-JFVEGN7J.mjs → chunk-ZAUHAJ4G.mjs} +2 -1
  30. package/dist/{chunk-DDIHBUEN.mjs → chunk-ZWW53O5P.mjs} +19 -7
  31. package/dist/client/index.d.ts +8 -8
  32. package/dist/client/topology.d.ts +4 -4
  33. package/dist/{client-base-Doaqwrx3.d.ts → client-base-DJZbSY55.d.ts} +2 -2
  34. package/dist/{client-streams-MKPE4MXW.mjs → client-streams-F7IG3PTU.mjs} +13 -16
  35. package/dist/core/index.d.ts +48 -12
  36. package/dist/core/index.mjs +1812 -107
  37. package/dist/core/writer-worker.mjs +28 -4
  38. package/dist/{database-fz-8CJBP.d.ts → database-BZ96ZzAx.d.ts} +411 -184
  39. package/dist/{database-backup-BwTNiBm2.d.ts → database-backup-BhM8yJ1A.d.ts} +32 -2
  40. package/dist/driver/better-sqlite3.d.ts +11 -1
  41. package/dist/driver/better-sqlite3.mjs +212 -23
  42. package/dist/driver/bun.d.ts +1 -1
  43. package/dist/driver/bun.mjs +15 -22
  44. package/dist/driver/expo.d.ts +1 -1
  45. package/dist/driver/expo.mjs +185 -16
  46. package/dist/driver/node.d.ts +1 -1
  47. package/dist/driver/node.mjs +15 -62
  48. package/dist/driver/wa-sqlite.d.ts +1 -1
  49. package/dist/driver/wa-sqlite.mjs +14 -153
  50. package/dist/{change-tracker-Dpo99EI-.d.ts → errors-DLMAGQFb.d.ts} +200 -2
  51. package/dist/file-migrations/index.d.ts +1 -1
  52. package/dist/peer-refusal-RR37UOLV.mjs +1 -0
  53. package/dist/{protocol-DZSYSv0S.d.ts → protocol-DE10taas.d.ts} +1 -1
  54. package/dist/replication/coordinator/etcd.mjs +1 -1
  55. package/dist/replication/index.d.ts +7 -7
  56. package/dist/replication/index.mjs +66 -9
  57. package/dist/{restore-options-CcMukOLO.d.ts → restore-options-B6HV_5XT.d.ts} +6 -1
  58. package/dist/server/index.d.ts +10 -10
  59. package/dist/server/index.mjs +506 -350
  60. package/dist/{server-options-B9CsAZp5.d.ts → server-options-Bhdlvehe.d.ts} +14 -1
  61. package/dist/{server-streams-SBYCHWWM.mjs → server-streams-Q2AZAW3N.mjs} +6 -30
  62. package/dist/{sirannon-D0CjDULa.d.ts → sirannon-Ba1o2HUQ.d.ts} +5 -5
  63. package/dist/transport/grpc.d.ts +15 -4
  64. package/dist/transport/grpc.mjs +34 -37
  65. package/dist/transport/memory.d.ts +4 -3
  66. package/dist/transport/memory.mjs +8 -26
  67. package/dist/{types-DTmi7pXp.d.ts → types-BWyv_N18.d.ts} +189 -1
  68. package/dist/{types-BlZ9GG1a.d.ts → types-CDnlkVRK.d.ts} +8 -2
  69. package/package.json +17 -9
  70. package/dist/chunk-DBN57KVR.mjs +0 -171
  71. package/dist/chunk-W67A4H2E.mjs +0 -23
  72. package/dist/chunk-YW7IKQ7T.mjs +0 -62
@@ -1,16 +1,17 @@
1
- export { B as BackupCapabilities, a as BackupChainLocation, b as BackupRestorePlan, c as BackupSafeToDeleteOptions, d as backupPiecesSafeToDelete, p as planBackupRestore } from '../database-backup-BwTNiBm2.js';
2
- import { J as SQLiteConnection, V as SynchronousLevel, S as SQLiteDriver, D as DatabaseOptions, W as LifecycleConfig, M as Migration, X as MigrationResult, Y as RollbackResult } from '../types-DTmi7pXp.js';
3
- export { A as AfterQueryHook, Z as AfterQueryHookContext, _ as AppliedMigrationEntry, h as BackupChain, i as BackupChainBase, j as BackupChainChange, k as BackupChainPosition, l as BackupChainRecord, n as BackupCycleError, o as BackupCycleOptions, p as BackupCycleStatus, B as BackupDestination, q as BackupFileReport, r as BackupGroupMembership, s as BackupGroupSource, t as BackupLogPosition, u as BackupNodePreference, v as BackupPiece, w as BackupProgress, g as BackupRunReport, P as BackupScheduleOptions, x as BackupSkip, y as BackupSkipReason, z as BackupToDestinationOptions, C as BackupVerifyResult, $ as BatchSummary, d as BeforeConnectHook, a0 as BeforePushHook, c as BeforeQueryHook, a1 as BeforeSnapshotHook, a2 as BeforeSubscribeHook, a3 as CDCMetrics, a4 as ClusterReadEndpointInfo, I as ClusterStatusInfo, a5 as ConnectionHookContext, a6 as ConnectionMetrics, a7 as Counted, E as DEFAULT_CHAIN_NAME, f as DatabaseCloseHook, a8 as DatabaseCopyRequest, a9 as DatabaseCopyStep, e as DatabaseOpenHook, Q as DriverCapabilities, aa as DriverWorkerEntry, ab as HookConfig, ac as MIGRATION_NAME_RE, b as MetricsCollector, ad as MetricsConfig, ae as MigrationBaseline, af as MigrationSource, ag as NODE_HEALTH_REASONS, ah as NODE_HEALTH_STATES, N as NodeHealth, ai as NodeHealthReason, aj as NodeHealthState, ak as OpenOptions, al as QueryHookContext, am as QueryMetrics, an as RunResult, ao as SQLiteStatement, a as SirannonOptions, T as Transaction, ap as WriterWorkerOptions, G as readBackupChains } from '../types-DTmi7pXp.js';
4
- import { B as BulkLoadDurability, a as BulkLoadResult, R as RequestContext } from '../server-options-B9CsAZp5.js';
5
- export { A as AppliedMigrationRow, b as AuthenticateHook, c as BulkLoadOptions, C as ClientOptions, d as ClusterStatusAuthorizer, e as CorsOptions, f as ReplicationStatusInfo, g as ServerExecutionTarget, h as ServerExecutionTargetResolver, S as ServerOptions, W as WSHandlerOptions } from '../server-options-B9CsAZp5.js';
6
- export { C as ChangeTracker, a as ChangeTrackerOptions } from '../change-tracker-Dpo99EI-.js';
7
- import { D as Database } from '../database-fz-8CJBP.js';
8
- export { B as BackupError, C as CDCError, b as ConnectionPool, c as ConnectionPoolError, d as ConnectionPoolOptions, e as DatabaseAlreadyExistsError, f as DatabaseBackups, g as DatabaseLifecycle, h as DatabaseNotFoundError, E as ExtensionError, F as ForbiddenSqlError, i as HookDeniedError, a as HookDispose, j as HookEvent, k as HookEventContextMap, l as HookHandler, H as HookRegistry, M as MaxDatabasesError, m as MigrationError, P as PushHookContext, Q as QueryError, R as ReadOnlyError, n as RequestDeniedError, S as SirannonError, o as SnapshotHookContext, p as SubscribeHookContext, T as TransactionError, W as WriteOverloadError } from '../database-fz-8CJBP.js';
1
+ export { B as BackupCapabilities, a as BackupChainLocation, b as BackupRestorePlan, c as BackupSafeToDeleteOptions, d as backupPiecesSafeToDelete, p as planBackupRestore } from '../database-backup-BhM8yJ1A.js';
2
+ import { L as SQLiteConnection, X as SynchronousLevel, S as SQLiteDriver, D as DatabaseOptions, Y as LifecycleConfig, M as Migration, Z as MigrationResult, _ as RollbackResult } from '../types-BWyv_N18.js';
3
+ export { A as AfterQueryHook, $ as AfterQueryHookContext, a0 as AppliedMigrationEntry, h as BackupChain, i as BackupChainBase, j as BackupChainChange, k as BackupChainPosition, l as BackupChainRecord, n as BackupCycleError, o as BackupCycleOptions, p as BackupCycleStatus, B as BackupDestination, q as BackupFileReport, r as BackupGroupMembership, s as BackupGroupSource, t as BackupLogPosition, u as BackupNodePreference, v as BackupPiece, w as BackupProgress, g as BackupRunReport, R as BackupScheduleOptions, x as BackupSkip, y as BackupSkipReason, z as BackupToDestinationOptions, C as BackupVerifyResult, a1 as BatchSummary, d as BeforeConnectHook, a2 as BeforePushHook, c as BeforeQueryHook, a3 as BeforeSnapshotHook, a4 as BeforeSubscribeHook, a5 as CDCMetrics, a6 as ClusterReadEndpointInfo, K as ClusterStatusInfo, a7 as ConnectionHookContext, a8 as ConnectionMetrics, a9 as Counted, F as DEFAULT_CHAIN_NAME, f as DatabaseCloseHook, aa as DatabaseCopyRequest, ab as DatabaseCopyStep, ac as DatabaseFileSystem, e as DatabaseOpenHook, V as DriverCapabilities, ad as DriverWorkerEntry, ae as EncryptionChange, af as EncryptionChangeStatus, J as EncryptionKey, E as EncryptionOptions, ag as EncryptionStatus, ah as HookConfig, ai as MIGRATION_NAME_RE, b as MetricsCollector, aj as MetricsConfig, ak as MigrationBaseline, al as MigrationSource, am as NODE_HEALTH_REASONS, an as NODE_HEALTH_STATES, N as NodeHealth, ao as NodeHealthReason, ap as NodeHealthState, aq as OpenOptions, ar as QueryHookContext, as as QueryMetrics, at as RunResult, au as SQLiteStatement, a as SirannonOptions, T as Transaction, av as WriterWorkerOptions, H as readBackupChains } from '../types-BWyv_N18.js';
4
+ import { B as BulkLoadDurability, a as BulkLoadResult, R as RequestContext } from '../server-options-Bhdlvehe.js';
5
+ export { A as AppliedMigrationRow, b as AuthenticateHook, c as BulkLoadOptions, C as ClientOptions, d as ClusterStatusAuthorizer, e as CorsOptions, f as ReplicationStatusInfo, g as ServerExecutionTarget, h as ServerExecutionTargetResolver, S as ServerOptions, W as WSHandlerOptions } from '../server-options-Bhdlvehe.js';
6
+ import { S as SirannonError } from '../errors-DLMAGQFb.js';
7
+ export { B as BackupError, a as CDCError, C as ChangeTracker, b as ChangeTrackerOptions, c as ConnectionPoolError, D as DatabaseAlreadyExistsError, d as DatabaseNotFoundError, E as ExtensionError, F as ForbiddenSqlError, H as HookDeniedError, M as MaxDatabasesError, e as MigrationError, Q as QueryError, R as ReadOnlyError, f as RequestDeniedError, T as TransactionError, W as WriteOverloadError } from '../errors-DLMAGQFb.js';
8
+ import { D as Database, C as ConnectionPool } from '../database-BZ96ZzAx.js';
9
+ export { c as ConnectionPoolOptions, d as DatabaseBackups, e as DatabaseEncryption, f as DatabaseLifecycle, a as HookDispose, g as HookEvent, h as HookEventContextMap, i as HookHandler, H as HookRegistry, P as PushHookContext, S as SnapshotHookContext, j as SubscribeHookContext } from '../database-BZ96ZzAx.js';
9
10
  export { a as LiveQuery, L as LiveQueryOptions, b as LiveQueryState, c as LiveUpdate, R as ResultOp } from '../types-CEJG0eFS.js';
10
11
  import { B as BaselineFileOption } from '../baseline-Co3iIsN_.js';
11
12
  import { P as Params, E as ExecuteResult } from '../query-types-5B02ixH0.js';
12
13
  export { C as ChangeEvent, b as ChangeOperation, Q as QueryOptions, R as ReadConcern, a as ReadConcernLevel, S as Subscription, c as SubscriptionBuilder, d as SubscriptionOptions, W as WriteConcern, e as WriteConcernLevel } from '../query-types-5B02ixH0.js';
13
- export { S as Sirannon } from '../sirannon-D0CjDULa.js';
14
+ export { S as Sirannon } from '../sirannon-Ba1o2HUQ.js';
14
15
  export { D as DatabaseOperations, b as OperationArguments, O as OperationRef, a as OperationRegistry, c as OperationStatement, R as ReadOperation, W as WriteOperation, o as operationName, d as operationRef } from '../operation-registry-CGhNT-Sn.js';
15
16
  import '../types-BG31TtrQ.js';
16
17
 
@@ -122,6 +123,29 @@ declare function synchronousPragmaValue(level: SynchronousLevel | undefined): st
122
123
  */
123
124
  declare function isSynchronousLevel(value: unknown): value is SynchronousLevel;
124
125
 
126
+ /**
127
+ * The codes of the errors that an encrypted database raises.
128
+ *
129
+ * @public
130
+ */
131
+ type EncryptionErrorCode = 'ENCRYPTION_UNSUPPORTED' | 'INVALID_ENCRYPTION_KEY' | 'ENCRYPTION_KEY_UNAVAILABLE' | 'ENCRYPTION_KEY_MISSING' | 'ENCRYPTION_KEY_REJECTED' | 'DATABASE_NOT_ENCRYPTED' | 'ENCRYPTED_PAGE_CORRUPT' | 'ENCRYPTION_REQUIRED' | 'ENCRYPTION_CHANGE_IN_PROGRESS' | 'ENCRYPTION_CHANGE_ABORTED';
132
+ /**
133
+ * Thrown when a database cannot be encrypted, opened under its key, or given a new key. The message never contains a
134
+ * key.
135
+ *
136
+ * @public
137
+ */
138
+ declare class EncryptionError extends SirannonError {
139
+ /**
140
+ * Returns an error with an encryption code, and the failure that caused it when there is one.
141
+ *
142
+ * @param message - What failed, written without the key.
143
+ * @param code - The machine-readable code.
144
+ * @param cause - The failure that caused this error, such as the error that a key function threw.
145
+ */
146
+ constructor(message: string, code: EncryptionErrorCode, cause?: unknown);
147
+ }
148
+
125
149
  /**
126
150
  * The registry supplies these functions so that the lifecycle manager can open, close, count, and look up its databases.
127
151
  *
@@ -300,15 +324,27 @@ declare class MigrationRunner {
300
324
  /**
301
325
  * Executes a read on one connection and returns the rows with their values decoded.
302
326
  *
327
+ * @param conn - The connection that executes the read.
328
+ * @param sql - The statement to execute.
329
+ * @param params - The values to bind to the statement, named or positional.
330
+ * @param leasedFrom - The pool that leased `conn` through {@link ConnectionPool.leaseReader}, which gets the lease
331
+ * back once the read settles.
332
+ * @returns The rows with their values decoded.
303
333
  * @internal
304
334
  */
305
- declare function query<T = Record<string, unknown>>(conn: SQLiteConnection, sql: string, params?: Params): Promise<T[]>;
335
+ declare function query<T = Record<string, unknown>>(conn: SQLiteConnection, sql: string, params?: Params, leasedFrom?: ConnectionPool): Promise<T[]>;
306
336
  /**
307
337
  * Executes a read on one connection and returns the first row, or undefined when the read returns none.
308
338
  *
339
+ * @param conn - The connection that executes the read.
340
+ * @param sql - The statement to execute.
341
+ * @param params - The values to bind to the statement, named or positional.
342
+ * @param leasedFrom - The pool that leased `conn` through {@link ConnectionPool.leaseReader}, which gets the lease
343
+ * back once the read settles.
344
+ * @returns The first row, or undefined when the read returns none.
309
345
  * @internal
310
346
  */
311
- declare function queryOne<T = Record<string, unknown>>(conn: SQLiteConnection, sql: string, params?: Params): Promise<T | undefined>;
347
+ declare function queryOne<T = Record<string, unknown>>(conn: SQLiteConnection, sql: string, params?: Params, leasedFrom?: ConnectionPool): Promise<T | undefined>;
312
348
  /**
313
349
  * Executes one write on a connection and returns the change count and the row id of the last inserted row.
314
350
  *
@@ -377,4 +413,4 @@ declare function readBearerToken(ctx: RequestContext): string | undefined;
377
413
  */
378
414
  declare function readSubprotocolCredential(ctx: RequestContext, prefix: string): string | undefined;
379
415
 
380
- export { BaselineFileOption, BulkLoadDurability, BulkLoadResult, DEFAULT_SYNCHRONOUS, Database, DatabaseOptions, ExecuteResult, type LifecycleCallbacks, LifecycleConfig, LifecycleManager, MIGRATION_FILENAME_PATTERN, Migration, MigrationResult, MigrationRunner, type MigrationsFromFilesOptions, Params, type ParsedMigrationFilename, RequestContext, RollbackResult, SQLiteConnection, SQLiteDriver, SynchronousLevel, type TenantResolverOptions, createTenantResolver, defineDriver, execute, executeBatch, isBulkLoadDurability, isSynchronousLevel, migrationsFromFiles, parseMigrationFilename, query, queryOne, readBearerToken, readHeader, readSubprotocolCredential, runBulkLoad, sanitizeTenantId, synchronousPragmaValue, tenantPath, toSubprotocolCredential };
416
+ export { BaselineFileOption, BulkLoadDurability, BulkLoadResult, ConnectionPool, DEFAULT_SYNCHRONOUS, Database, DatabaseOptions, EncryptionError, type EncryptionErrorCode, ExecuteResult, type LifecycleCallbacks, LifecycleConfig, LifecycleManager, MIGRATION_FILENAME_PATTERN, Migration, MigrationResult, MigrationRunner, type MigrationsFromFilesOptions, Params, type ParsedMigrationFilename, RequestContext, RollbackResult, SQLiteConnection, SQLiteDriver, SirannonError, SynchronousLevel, type TenantResolverOptions, createTenantResolver, defineDriver, execute, executeBatch, isBulkLoadDurability, isSynchronousLevel, migrationsFromFiles, parseMigrationFilename, query, queryOne, readBearerToken, readHeader, readSubprotocolCredential, runBulkLoad, sanitizeTenantId, synchronousPragmaValue, tenantPath, toSubprotocolCredential };