@voltro/database 0.86.0 → 0.88.0

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 (172) hide show
  1. package/CHANGELOG.md +5484 -0
  2. package/THIRD-PARTY-NOTICES.md +2 -226
  3. package/dist/actorSnapshot.js +1 -2
  4. package/dist/arrayCodec.js +1 -2
  5. package/dist/branchExecute.js +1 -2
  6. package/dist/branching.js +1 -2
  7. package/dist/bulkInsertLimits.js +16 -12
  8. package/dist/cdcOffsetsTables.js +1 -2
  9. package/dist/changeEvent.js +1 -2
  10. package/dist/changeIdentity.js +1 -2
  11. package/dist/changeListenerCeiling.js +1 -2
  12. package/dist/columnReference.js +1 -2
  13. package/dist/columns.js +1 -2
  14. package/dist/committedChanges.js +1 -2
  15. package/dist/connectionIdentity.js +1 -2
  16. package/dist/coreTables.js +1 -2
  17. package/dist/coreTablesRegistry.js +1 -2
  18. package/dist/dataTransfers.js +3 -3
  19. package/dist/dbCause.js +1 -2
  20. package/dist/dbMetrics.js +1 -2
  21. package/dist/decimalComparison.js +1 -2
  22. package/dist/derivedRowId.js +1 -2
  23. package/dist/dialect.js +1 -2
  24. package/dist/enumRenames.js +1 -2
  25. package/dist/expiresMixin.js +1 -2
  26. package/dist/fieldEncryption.js +65 -43
  27. package/dist/frameworkTables.js +16 -4
  28. package/dist/ginIndex.js +1 -2
  29. package/dist/hybridSearch.js +1 -2
  30. package/dist/idGenerator.js +5 -6
  31. package/dist/identifierLimits.js +1 -2
  32. package/dist/index.d.ts +153 -22
  33. package/dist/index.js +78 -78
  34. package/dist/indexAudit.js +45 -44
  35. package/dist/indexStorage.js +1 -2
  36. package/dist/joinCompiler.js +1 -2
  37. package/dist/jsonEagerCompiler.js +1 -2
  38. package/dist/jsonPatch.js +1 -2
  39. package/dist/jsonPatchAssignments.js +1 -2
  40. package/dist/jsonPath.js +1 -2
  41. package/dist/localFirstMixin.js +1 -2
  42. package/dist/migrate.js +52 -33
  43. package/dist/migration.js +1 -2
  44. package/dist/migrations/appliedAtValue.js +1 -2
  45. package/dist/migrations/applier.js +400 -386
  46. package/dist/migrations/boot.js +2 -3
  47. package/dist/migrations/branchRehearsal.js +1 -2
  48. package/dist/migrations/columnEquivalence.js +1 -2
  49. package/dist/migrations/ddlError.js +1 -2
  50. package/dist/migrations/ddlStatements.js +8 -0
  51. package/dist/migrations/declaredSchema.js +2 -3
  52. package/dist/migrations/deployLedger.js +1 -2
  53. package/dist/migrations/fileBased.js +1 -2
  54. package/dist/migrations/fileContext.js +1 -2
  55. package/dist/migrations/fileDiscovery.js +146 -133
  56. package/dist/migrations/fileSkipProbes.js +1 -2
  57. package/dist/migrations/fingerprint.js +1 -2
  58. package/dist/migrations/fkCycles.js +1 -2
  59. package/dist/migrations/frameworkLiveTables.js +1 -2
  60. package/dist/migrations/idempotentDdl.js +1 -2
  61. package/dist/migrations/indexPredicate.js +1 -2
  62. package/dist/migrations/introspect.js +188 -187
  63. package/dist/migrations/ledgerRows.js +1 -2
  64. package/dist/migrations/lock.js +1 -2
  65. package/dist/migrations/migrationTableExists.js +1 -2
  66. package/dist/migrations/mssqlColumnDependencies.js +1 -2
  67. package/dist/migrations/mysqlEngine.js +1 -2
  68. package/dist/migrations/namespaceCharset.js +1 -2
  69. package/dist/migrations/planner.js +25 -16
  70. package/dist/migrations/postgresEnumCheck.js +5 -3
  71. package/dist/migrations/reactiveTriggerDrift.js +1 -2
  72. package/dist/migrations/reactiveTriggerName.js +1 -2
  73. package/dist/migrations/renameMssqlCheck.js +1 -2
  74. package/dist/migrations/restoreSnapshots.js +1 -2
  75. package/dist/migrations/resumeLedger.js +1 -2
  76. package/dist/migrations/rollingDeploy.js +1 -2
  77. package/dist/migrations/schemaOwner.js +1 -2
  78. package/dist/migrations/schemaOwnerTable.js +1 -2
  79. package/dist/migrations/softDropSnapshot.js +1 -2
  80. package/dist/migrations/sqlLimit.js +1 -2
  81. package/dist/migrations/sqliteCatalogName.js +12 -0
  82. package/dist/migrations/sqliteConstraintIdentity.js +1 -2
  83. package/dist/migrations/sqliteDecimalBoot.js +1 -2
  84. package/dist/migrations/sqliteDecimalPublication.js +1 -2
  85. package/dist/migrations/sqliteDecimalReview.js +1 -2
  86. package/dist/migrations/sqliteDecimalReviewStore.js +1 -2
  87. package/dist/migrations/sqliteDecimalReviewWitness.js +1 -2
  88. package/dist/migrations/sqliteDecimalSource.js +1 -2
  89. package/dist/migrations/sqliteDecimalStage.js +1 -2
  90. package/dist/migrations/sqliteForeignKeys.js +1 -2
  91. package/dist/migrations/sqliteMigrationBatch.js +1 -2
  92. package/dist/migrations/sqliteRetainedSource.js +1 -2
  93. package/dist/migrations/sqliteRowIdentity.js +1 -2
  94. package/dist/migrations/sqliteSchemaEpoch.js +1 -2
  95. package/dist/migrations/sqliteSnapshotGuard.js +1 -2
  96. package/dist/migrations/sqliteTableContents.js +1 -2
  97. package/dist/migrations/sqliteTableCopy.js +1 -2
  98. package/dist/migrations/sqliteTableSchema.js +1 -2
  99. package/dist/migrations/sqliteWitnessProtection.js +1 -2
  100. package/dist/migrations/squash.js +1 -2
  101. package/dist/migrations/storeCharset.js +1 -2
  102. package/dist/migrations/transactionCause.js +1 -2
  103. package/dist/migrations/undeclaredCharset.js +1 -2
  104. package/dist/migrations/uniqueActiveLowering.js +1 -2
  105. package/dist/mixins.js +1 -2
  106. package/dist/mssqlDecimalDistinct.js +1 -2
  107. package/dist/mssqlJsonValueCheck.js +1 -2
  108. package/dist/mssqlTextStorage.js +1 -2
  109. package/dist/namespace.js +1 -2
  110. package/dist/optimisticVersion.js +1 -2
  111. package/dist/pendingAttribution.js +1 -2
  112. package/dist/pluginRef.js +1 -2
  113. package/dist/predicate.js +28 -22
  114. package/dist/predicateCoercion.js +1 -2
  115. package/dist/projectedColumn.js +1 -2
  116. package/dist/queryBuilder.js +7 -2
  117. package/dist/rawSql.js +1 -2
  118. package/dist/relations.js +1 -2
  119. package/dist/relationsRegistry.js +1 -2
  120. package/dist/replaceInProgress.js +1 -2
  121. package/dist/requiredColumns.js +1 -2
  122. package/dist/residency.js +1 -2
  123. package/dist/retention.js +1 -2
  124. package/dist/rowDecoder.js +62 -13
  125. package/dist/rowKey.js +1 -2
  126. package/dist/rowSchema.js +1 -2
  127. package/dist/scopeKey.js +1 -2
  128. package/dist/seed.js +1 -2
  129. package/dist/snowflake.js +1 -2
  130. package/dist/sql.d.ts +2746 -3748
  131. package/dist/sql.js +15 -14
  132. package/dist/sqlCompiler.js +89 -73
  133. package/dist/sqlError.js +1 -2
  134. package/dist/sqlMutation.js +54 -0
  135. package/dist/sqlPoolCapacity.js +1 -2
  136. package/dist/sqliteDecimal.js +1 -2
  137. package/dist/sqliteDecimalAggregateSql.js +1 -2
  138. package/dist/sqliteDecimalColumnSql.js +1 -2
  139. package/dist/sqliteDecimalConversion.js +1 -2
  140. package/dist/sqliteDecimalCte.js +1 -2
  141. package/dist/sqliteDecimalEncodeSql.js +1 -2
  142. package/dist/sqliteDecimalOutputs.js +1 -2
  143. package/dist/sqliteDecimalPredicate.js +1 -2
  144. package/dist/sqliteDecimalQuery.js +1 -2
  145. package/dist/sqliteDecimalQueryPlan.js +1 -2
  146. package/dist/sqliteDecimalResultSql.js +1 -2
  147. package/dist/sqliteDecimalRowQuery.js +1 -2
  148. package/dist/sqliteDecimalSetQuery.js +1 -2
  149. package/dist/sqliteDecimalSource.js +1 -2
  150. package/dist/sqliteDecimalStorage.js +1 -2
  151. package/dist/sqliteDecimalSubquery.js +1 -2
  152. package/dist/sqliteDecimalWindowQuery.js +1 -2
  153. package/dist/sqliteValueCoercion.js +1 -2
  154. package/dist/stampId.js +1 -2
  155. package/dist/storeErrors.js +1 -2
  156. package/dist/storeRefusal.js +1 -2
  157. package/dist/stream.js +1 -2
  158. package/dist/subjectGraph.js +1 -2
  159. package/dist/table.js +1 -2
  160. package/dist/tableRegistry.js +1 -2
  161. package/dist/tenantSelection.js +1 -2
  162. package/dist/transactionOutcome.js +5 -3
  163. package/dist/transientContention.js +1 -2
  164. package/dist/typeId.js +50 -0
  165. package/dist/typedStore.js +2 -3
  166. package/dist/upsertUpdate.js +1 -2
  167. package/dist/vectorEmbedding.js +1 -2
  168. package/dist/view.js +1 -2
  169. package/dist/wire.js +1 -2
  170. package/dist/writeAttribution.js +1 -2
  171. package/dist/writeRecorder.js +22 -22
  172. package/package.json +3 -4
package/dist/index.js CHANGED
@@ -2,81 +2,81 @@ import { ColumnBuilder as e, SELF_REFERENCE_TARGET as t, array as n, bigint as r
2
2
  import { pluginRef as P, pluginRefSpecOf as F } from "./pluginRef.js";
3
3
  import { columnRef as I, isColumnReference as L } from "./columnReference.js";
4
4
  import { authoredError as R, authoredMessageOf as z, causeBranches as B, classifyConstraintViolation as V, describeCharsetRefusal as H, describeDriverError as U, describeRowBindings as W, extractDbCause as G, isForeignKeyViolation as K, isQueryTimeout as q, wireSafeCause as J } from "./dbCause.js";
5
- import { compareDecimal as Y } from "./decimalComparison.js";
6
- import { MATCHES_NO_ROWS as X, and as Z, arrayContains as Q, arrayHas as $, arrayOverlaps as ee, collectSubqueries as te, contains as ne, eq as re, evaluatePredicate as ie, exists as ae, gt as oe, gte as se, inSet as ce, inSubquery as le, isNotNull as ue, isNull as de, jsonField as fe, lt as pe, lte as me, neq as he, not as ge, notExists as _e, notInSet as ve, notInSubquery as ye, or as be, preparePredicate as xe, spatialPredicate as Se, startsWith as Ce, walkLeaves as we } from "./predicate.js";
7
- import { resolveActorSnapshot as Te } from "./actorSnapshot.js";
8
- import { allEnumRenames as Ee, clearEnumRenames as De, declareEnumRename as Oe, getEnumRenames as ke } from "./enumRenames.js";
9
- import { deserializeArraysOnRead as Ae, serializeArraysForWrite as je } from "./arrayCodec.js";
10
- import { BOUND_ENCRYPTED_PREFIX as Me, ENCRYPTED_PREFIX as Ne, FieldDecryptionError as Pe, decodeFieldValue as Fe, decryptFieldsOnRead as Ie, encodeFieldValue as Le, encryptFieldsForWrite as Re, encryptFieldsForWriteBatch as ze, encryptedColumnsOf as Be, fieldBinding as Ve, isBoundCiphertext as He, isEncrypted as Ue, isFieldDecryptionError as We, isRawEncoding as Ge } from "./fieldEncryption.js";
11
- import { refuseWrite as Ke, storeRefusalOf as qe } from "./storeRefusal.js";
12
- import { MAX_IDENTIFIER_LENGTH as Je, WARN_IDENTIFIER_LENGTH as Ye, drainIdentifierWarnings as Xe, validateColumnName as Ze, validateIndexName as Qe, validateTableName as $e, validateTypeIdPrefix as et } from "./identifierLimits.js";
13
- import { generateSnowflake as tt, resetSnowflake as nt } from "./snowflake.js";
14
- import { deriveTypeIdPrefix as rt, generateId as it, resolveIdScheme as at } from "./idGenerator.js";
15
- import { defineMixin as ot, mixin as st, resolveMixinGraph as ct } from "./mixins.js";
16
- import { AUTO_FILLED_COLUMNS as lt, jsonIndex as ut, table as dt, vectorDistanceToOpclass as ft } from "./table.js";
17
- import { DEFAULT_ACQUIRE_TIMEOUT_MS as pt, isMysqlFamily as mt, isSqliteFamily as ht, quoteIdent as gt } from "./dialect.js";
18
- import { allRegisteredTables as _t, clearTableRegistry as vt, ensureTableRegistered as yt, getTable as bt, isTableReactive as xt, registerTable as St, requireTable as Ct, unregisterTable as wt } from "./tableRegistry.js";
19
- import { avg as Tt, avgOver as Et, column as Dt, count as Ot, countDistinct as kt, databaseHandle as At, denseRank as jt, except as Mt, intersect as Nt, lag as Pt, lead as Ft, max as It, min as Lt, orderClausesOf as Rt, paginateBy as zt, paginateById as Bt, queryFor as Vt, rank as Ht, resolveFullTextIndex as Ut, rowNumber as Wt, sum as Gt, sumOver as Kt, union as qt, unionAll as Jt } from "./queryBuilder.js";
20
- import { isView as Yt, queryForView as Xt, view as Zt, viewSql as Qt } from "./view.js";
21
- import { INITIAL_VERSION as $t, VersionConflict as en, planVersionedUpdate as tn, settleVersionedUpdate as nn, versionColumnOf as rn } from "./optimisticVersion.js";
22
- import { timestampMs as an, timestampMsOrNull as on } from "./wire.js";
23
- import { columnSchema as sn, rowSchema as cn } from "./rowSchema.js";
24
- import { inferForeignKey as ln, isEmptyRelationsSpec as un, isRelationsSpec as dn, many as fn, manyToMany as pn, one as mn, relations as hn, validateRelationConfig as gn } from "./relations.js";
25
- import { allRegisteredRelations as _n, clearRelationsRegistry as vn, getRelation as yn, getRelations as bn, registerDiscoveredRelations as xn, registerRelations as Sn, validateRegisteredRelations as Cn } from "./relationsRegistry.js";
26
- import { DEFAULT_SUBJECT_GRAPH_DEPTH as wn, deriveSubjectGraph as Tn, formatSubjectGraph as En } from "./subjectGraph.js";
27
- import { decodeRowsForTable as Dn, decodeRowsFromSchema as On, encodeRowForSchema as kn } from "./rowDecoder.js";
28
- import { upsertUpdatePatch as An, upsertUpdateValues as jn } from "./upsertUpdate.js";
29
- import { isCompositeRowKey as Mn, rowKeyColumns as Nn, rowKeyIdentity as Pn } from "./rowKey.js";
30
- import { jsonPatchAssignments as Fn } from "./jsonPatchAssignments.js";
31
- import { applyJsonPatch as In, compileJsonPatch as Ln, normalizeJsonPatchValue as Rn } from "./jsonPatch.js";
32
- import { EagerCardinalityError as zn, attachEagerLoads as Bn, hasEagerLoads as Vn, oneCardinalityMessage as Hn } from "./joinCompiler.js";
33
- import { coerceValueForSqlite as Un } from "./sqliteValueCoercion.js";
34
- import { TenantNamespaceInvalid as Wn, TenantNamespaceUnresolved as Gn, qualifyTable as Kn, resolveTenantNamespace as qn, sanitizeIdentifierFragment as Jn } from "./namespace.js";
35
- import { coercePredicateValue as Yn, coercePredicateValues as Xn } from "./predicateCoercion.js";
36
- import { compilePredicate as Zn, compileRawFragment as Qn, compileRowProjection as $n, compileSelect as er, escapeLike as tr } from "./sqlCompiler.js";
37
- import { coercePredicateForSqlite as nr, compileEagerJson as rr } from "./jsonEagerCompiler.js";
38
- import { registerCoreTables as ir, requireActors as ar, requireTenants as or } from "./coreTablesRegistry.js";
39
- import { actorsTable as sr } from "./coreTables.js";
40
- import { changeDelete as cr, changeInsert as lr, changeSoftDelete as ur, changeUpdate as dr, externalChangeEvent as fr } from "./changeEvent.js";
41
- import { committedChangeBatchOf as pr, emitCommittedChanges as mr } from "./committedChanges.js";
42
- import { CHANGE_CLAIM_TTL_ENV as hr, DEFAULT_CHANGE_CLAIM_TTL_HOURS as gr, OccurrenceCounter as _r, changeDigest as vr, composeChangeKey as yr, occurrenceWindowMs as br, parseChangeKey as xr } from "./changeIdentity.js";
43
- import { attributionFields as Sr, currentWriteAttribution as Cr, runWithWriteAttribution as wr, withCapturedAttribution as Tr } from "./writeAttribution.js";
44
- import { attributionKey as Er, beginLocalWrite as Dr, claimPendingAttribution as Or, clearPendingAttribution as kr, endLocalWrite as Ar, pendingAttributionCount as jr, registerPendingAttribution as Mr, resolveEchoAttribution as Nr } from "./pendingAttribution.js";
45
- import { ID_COLUMN_MAX_LENGTH as Pr, derivedRowId as Fr, derivedRowIdLength as Ir } from "./derivedRowId.js";
46
- import { clearWriteRecorders as Lr, recordsTable as Rr, registerWriteRecorder as zr, runWriteRecorders as Br, suspendWriteRecorders as Vr, suspendWriteRecordersEffect as Hr, unregisterWriteRecorder as Ur, writeRecordersSuspended as Wr } from "./writeRecorder.js";
47
- import { DEFAULT_EAGER_FALLBACK_WARN_INTERVAL_MS as Gr, dbMetricTagCacheSizeForTests as Kr, dbOperationsInFlight as qr, makeEagerFallbackReporter as Jr, observeDbOp as Yr, recordDbOp as Xr, resetDbMetricTagCacheForTests as Zr, resolveEagerFallbackWarnIntervalMs as Qr } from "./dbMetrics.js";
48
- import { SHARED_TRANSACTION_SERVICE as $r, TransactionAbortedError as ei, isTransactionAbortedError as ti, makeTransactionAbortTracker as ni, onTransaction as ri, runRetryingTransaction as ii, runSavepoint as ai, runStoreTransaction as oi, settleTransactionExit as si, transactionRetrySchedule as ci } from "./transactionOutcome.js";
49
- import { MSSQL_TRANSIENT_NUMBERS as li, MYSQL_TRANSIENT_CODES as ui, POSTGRES_TRANSIENT_STATES as di, SQLITE_TRANSIENT_CODES as fi, TURSO_TRANSIENT_MESSAGE as pi, isTransientContention as mi } from "./transientContention.js";
50
- import { VOLTRO_EXPIRES_MIXIN_ID as hi, expires as gi } from "./expiresMixin.js";
51
- import { VOLTRO_LOCAL_FIRST_MIXIN_ID as _i, isLocalFirst as vi, localFirst as yi, localFirstTables as bi } from "./localFirstMixin.js";
52
- import { TableStreamError as xi, streamTable as Si } from "./stream.js";
53
- import { hybridSearch as Ci } from "./hybridSearch.js";
54
- import { computeEmbedding as wi, vectorEmbedding as Ti } from "./vectorEmbedding.js";
55
- import { BranchNameInvalid as Ei, BranchTransitionInvalid as Di, branchNamespaceName as Oi, enforceBranchLimits as ki, isBranchNamespace as Ai, isNeonConnection as ji, nextBranchState as Mi, planBranch as Ni, planBranchProvision as Pi, planBranchTeardown as Fi, planBranchTeardownFor as Ii, planNeonBranchProvision as Li, planNeonBranchTeardown as Ri, resolveBranchMechanism as zi } from "./branching.js";
56
- import { admitBranch as Bi, makeNamespaceBranchExecutor as Vi, provisionBranch as Hi, teardownBranch as Ui } from "./branchExecute.js";
57
- import { TenantRegionUnavailable as Wi, TenantResidencyUnresolved as Gi, bindResidentStore as Ki, clearResidencyConfig as qi, getResidencyConfig as Ji, isRegionServable as Yi, provisionResidentTenant as Xi, residentPlacement as Zi, resolveTenantHome as Qi, setResidencyConfig as $i } from "./residency.js";
58
- import { auditAllTableIndexes as ea, auditTableIndexes as ta, formatIndexAuditIssue as na } from "./indexAudit.js";
59
- import { defineSeed as ra, fireSchemaChangeSeeds as ia, fireTenantCreateSeeds as aa, isSeedDefinition as oa, setSchemaChangeSeedHook as sa, setTenantCreateSeedHook as ca } from "./seed.js";
60
- import { defineMigration as la, isMigrationDefinition as ua } from "./migration.js";
61
- import { FILE_MIGRATION_PATTERN as da, IrreversibleMigrationError as fa, MIGRATION_PHASES as pa, MigrationExpectationFailed as ma, MigrationNeedsSqlClient as ha, MigrationSkipped as ga, RewriteUnstableError as _a, TransactionBrokenByBodyError as va, irreversible as ya, irreversibleReason as ba, isFileMigration as xa, migration as Sa } from "./migrations/fileBased.js";
62
- import { DEFAULT_SOFT_DROP_RETENTION_DAYS as Ca, FRAMEWORK_LIVE_TABLES as wa, STAGING_TABLE_PREFIX as Ta, agedSoftDropSnapshots as Ea, describeAgedSoftDropSnapshots as Da, isFrameworkOwnedLiveTable as Oa, isSoftDropSnapshotName as ka, isStagingTableName as Aa, softDropSnapshotStamp as ja } from "./migrations/frameworkLiveTables.js";
63
- import { sqlError as Ma } from "./sqlError.js";
64
- import { _voltroApiKeysTable as Na, _voltroDevicesTable as Pa, _voltroIdempotencyTable as Fa, _voltroKvTable as Ia, _voltroMigrationPlansTable as La, _voltroMigrationsTable as Ra, _voltroPluginMigrationsTable as za, _voltroReplicaObservationsTable as Ba, _voltroSchemaOwnerTable as Va, _voltroSeedsTable as Ha, _voltroTenantSelectionsTable as Ua, frameworkTables as Wa } from "./frameworkTables.js";
65
- import { TENANT_SELECTIONS_TABLE as Ga, deleteTenantSelection as Ka, readTenantSelection as qa, tenantSelectionId as Ja, writeTenantSelection as Ya } from "./tenantSelection.js";
66
- import { REPLACE_IN_PROGRESS_TABLE as Xa, STAGING_STALE_MINUTES as Za, _voltroReplaceInProgressTable as Qa, interruptedReplaceRefusal as $a, stagingLeftoverReport as eo, stagingLeftovers as to, stagingNamesOf as no, stagingStaleAfterMs as ro } from "./replaceInProgress.js";
67
- import { stampGeneratedId as io, stampGeneratedIds as ao } from "./stampId.js";
68
- import { BULK_INSERT_LIMITS as oo, bulkInsertLimitsFor as so, chunkRowsForInsert as co, columnsPerRow as lo } from "./bulkInsertLimits.js";
69
- import { missingConflictColumns as uo, missingRequiredColumns as fo } from "./requiredColumns.js";
70
- import { insertIgnoreRowOutcome as po, insertManyRows as mo, insertRow as ho, updateManyRow as go, upsertRow as _o, upsertRowOutcome as vo } from "./typedStore.js";
71
- import { CHANGE_LISTENER_CEILING as yo, raiseChangeListenerCeiling as bo } from "./changeListenerCeiling.js";
72
- import { isPrimaryKeyConflictError as xo, primaryKeyConflictError as So } from "./storeErrors.js";
73
- import { connectionIdentity as Co, normaliseTarget as wo, sameDatabase as To } from "./connectionIdentity.js";
74
- import { clearRetentions as Eo, listRetentionConflicts as Do, listRetentions as Oo, registerRetention as ko, retentionTtlMsFromEnv as Ao, sweepRetention as jo } from "./retention.js";
75
- import { CDC_OFFSETS_TABLE as Mo, _voltroCdcOffsetsTable as No, _voltroMssqlCdcOffsetsTable as Po } from "./cdcOffsetsTables.js";
76
- import { DATA_TRANSFERS_TABLE as Fo, _voltroDataTransfersTable as Io, describeTransferRun as Lo } from "./dataTransfers.js";
77
- import { SCOPE_KEY_MAX_LENGTH as Ro, scopeKeyOf as zo } from "./scopeKey.js";
78
- import { SqlClient as Bo } from "effect/sql";
79
- //#region src/index.ts
80
- var Vo = "postgres";
81
- //#endregion
82
- export { lt as AUTO_FILLED_COLUMNS, Me as BOUND_ENCRYPTED_PREFIX, oo as BULK_INSERT_LIMITS, Ei as BranchNameInvalid, Di as BranchTransitionInvalid, Mo as CDC_OFFSETS_TABLE, hr as CHANGE_CLAIM_TTL_ENV, yo as CHANGE_LISTENER_CEILING, e as ColumnBuilder, Fo as DATA_TRANSFERS_TABLE, pt as DEFAULT_ACQUIRE_TIMEOUT_MS, gr as DEFAULT_CHANGE_CLAIM_TTL_HOURS, Gr as DEFAULT_EAGER_FALLBACK_WARN_INTERVAL_MS, Ca as DEFAULT_SOFT_DROP_RETENTION_DAYS, wn as DEFAULT_SUBJECT_GRAPH_DEPTH, Ne as ENCRYPTED_PREFIX, Vo as ENGINE, zn as EagerCardinalityError, da as FILE_MIGRATION_PATTERN, wa as FRAMEWORK_LIVE_TABLES, Pe as FieldDecryptionError, Pr as ID_COLUMN_MAX_LENGTH, $t as INITIAL_VERSION, fa as IrreversibleMigrationError, X as MATCHES_NO_ROWS, Je as MAX_IDENTIFIER_LENGTH, pa as MIGRATION_PHASES, li as MSSQL_TRANSIENT_NUMBERS, ui as MYSQL_TRANSIENT_CODES, ma as MigrationExpectationFailed, ha as MigrationNeedsSqlClient, ga as MigrationSkipped, _r as OccurrenceCounter, di as POSTGRES_TRANSIENT_STATES, Xa as REPLACE_IN_PROGRESS_TABLE, _a as RewriteUnstableError, Ro as SCOPE_KEY_MAX_LENGTH, t as SELF_REFERENCE_TARGET, $r as SHARED_TRANSACTION_SERVICE, fi as SQLITE_TRANSIENT_CODES, Za as STAGING_STALE_MINUTES, Ta as STAGING_TABLE_PREFIX, Bo as SqlClient, Ga as TENANT_SELECTIONS_TABLE, pi as TURSO_TRANSIENT_MESSAGE, xi as TableStreamError, Wn as TenantNamespaceInvalid, Gn as TenantNamespaceUnresolved, Wi as TenantRegionUnavailable, Gi as TenantResidencyUnresolved, ei as TransactionAbortedError, va as TransactionBrokenByBodyError, hi as VOLTRO_EXPIRES_MIXIN_ID, _i as VOLTRO_LOCAL_FIRST_MIXIN_ID, en as VersionConflict, Ye as WARN_IDENTIFIER_LENGTH, Na as _voltroApiKeysTable, No as _voltroCdcOffsetsTable, Io as _voltroDataTransfersTable, Pa as _voltroDevicesTable, Fa as _voltroIdempotencyTable, Ia as _voltroKvTable, La as _voltroMigrationPlansTable, Ra as _voltroMigrationsTable, Po as _voltroMssqlCdcOffsetsTable, za as _voltroPluginMigrationsTable, Qa as _voltroReplaceInProgressTable, Ba as _voltroReplicaObservationsTable, Va as _voltroSchemaOwnerTable, Ha as _voltroSeedsTable, Ua as _voltroTenantSelectionsTable, sr as actorsTable, Bi as admitBranch, Ea as agedSoftDropSnapshots, Ee as allEnumRenames, _n as allRegisteredRelations, _t as allRegisteredTables, Z as and, In as applyJsonPatch, n as array, Q as arrayContains, $ as arrayHas, ee as arrayOverlaps, Bn as attachEagerLoads, Sr as attributionFields, Er as attributionKey, ea as auditAllTableIndexes, ta as auditTableIndexes, R as authoredError, z as authoredMessageOf, Tt as avg, Et as avgOver, Dr as beginLocalWrite, r as bigint, Ki as bindResidentStore, i as boolean, Oi as branchNamespaceName, so as bulkInsertLimitsFor, a as bytes, B as causeBranches, cr as changeDelete, vr as changeDigest, lr as changeInsert, ur as changeSoftDelete, dr as changeUpdate, co as chunkRowsForInsert, Or as claimPendingAttribution, V as classifyConstraintViolation, De as clearEnumRenames, kr as clearPendingAttribution, vn as clearRelationsRegistry, qi as clearResidencyConfig, Eo as clearRetentions, vt as clearTableRegistry, Lr as clearWriteRecorders, nr as coercePredicateForSqlite, Yn as coercePredicateValue, Xn as coercePredicateValues, Un as coerceValueForSqlite, te as collectSubqueries, Dt as column, I as columnRef, sn as columnSchema, lo as columnsPerRow, pr as committedChangeBatchOf, Y as compareDecimal, rr as compileEagerJson, Ln as compileJsonPatch, Zn as compilePredicate, Qn as compileRawFragment, $n as compileRowProjection, er as compileSelect, yr as composeChangeKey, wi as computeEmbedding, Co as connectionIdentity, ne as contains, Ot as count, kt as countDistinct, o as crdtCounter, s as crdtDoc, c as crdtManagedColumns, l as crdtManagedColumnsOf, u as crdtSealed, d as crdtText, Cr as currentWriteAttribution, At as databaseHandle, f as date, p as dbEnum, Kr as dbMetricTagCacheSizeForTests, qr as dbOperationsInFlight, m as decimal, Oe as declareEnumRename, Fe as decodeFieldValue, Dn as decodeRowsForTable, On as decodeRowsFromSchema, Ie as decryptFieldsOnRead, la as defineMigration, ot as defineMixin, ra as defineSeed, Ka as deleteTenantSelection, jt as denseRank, Tn as deriveSubjectGraph, rt as deriveTypeIdPrefix, Fr as derivedRowId, Ir as derivedRowIdLength, Da as describeAgedSoftDropSnapshots, H as describeCharsetRefusal, U as describeDriverError, W as describeRowBindings, Lo as describeTransferRun, Ae as deserializeArraysOnRead, Xe as drainIdentifierWarnings, h as dropped, mr as emitCommittedChanges, Le as encodeFieldValue, kn as encodeRowForSchema, Re as encryptFieldsForWrite, ze as encryptFieldsForWriteBatch, Be as encryptedColumnsOf, Ar as endLocalWrite, ki as enforceBranchLimits, yt as ensureTableRegistered, re as eq, tr as escapeLike, ie as evaluatePredicate, Mt as except, ae as exists, gi as expires, fr as externalChangeEvent, G as extractDbCause, Ve as fieldBinding, ia as fireSchemaChangeSeeds, aa as fireTenantCreateSeeds, na as formatIndexAuditIssue, En as formatSubjectGraph, Wa as frameworkTables, it as generateId, tt as generateSnowflake, g as geography, _ as geometry, ke as getEnumRenames, yn as getRelation, bn as getRelations, Ji as getResidencyConfig, bt as getTable, oe as gt, se as gte, Vn as hasEagerLoads, Ci as hybridSearch, v as id, ce as inSet, le as inSubquery, ln as inferForeignKey, po as insertIgnoreRowOutcome, mo as insertManyRows, ho as insertRow, y as integer, $a as interruptedReplaceRefusal, Nt as intersect, b as interval, ya as irreversible, ba as irreversibleReason, He as isBoundCiphertext, Ai as isBranchNamespace, L as isColumnReference, Mn as isCompositeRowKey, un as isEmptyRelationsSpec, Ue as isEncrypted, We as isFieldDecryptionError, xa as isFileMigration, K as isForeignKeyViolation, Oa as isFrameworkOwnedLiveTable, vi as isLocalFirst, ua as isMigrationDefinition, mt as isMysqlFamily, ji as isNeonConnection, ue as isNotNull, de as isNull, xo as isPrimaryKeyConflictError, q as isQueryTimeout, Ge as isRawEncoding, Yi as isRegionServable, dn as isRelationsSpec, oa as isSeedDefinition, ka as isSoftDropSnapshotName, ht as isSqliteFamily, Aa as isStagingTableName, xt as isTableReactive, ti as isTransactionAbortedError, mi as isTransientContention, Yt as isView, x as json, fe as jsonField, ut as jsonIndex, Fn as jsonPatchAssignments, Pt as lag, Ft as lead, Do as listRetentionConflicts, Oo as listRetentions, yi as localFirst, bi as localFirstTables, pe as lt, me as lte, Jr as makeEagerFallbackReporter, Vi as makeNamespaceBranchExecutor, ni as makeTransactionAbortTracker, fn as many, pn as manyToMany, S as materializeFields, It as max, Sa as migration, Lt as min, uo as missingConflictColumns, fo as missingRequiredColumns, st as mixin, he as neq, Mi as nextBranchState, wo as normaliseTarget, Rn as normalizeJsonPatchValue, ge as not, _e as notExists, ve as notInSet, ye as notInSubquery, C as numeric, Yr as observeDbOp, br as occurrenceWindowMs, ri as onTransaction, mn as one, Hn as oneCardinalityMessage, be as or, Rt as orderClausesOf, zt as paginateBy, Bt as paginateById, xr as parseChangeKey, jr as pendingAttributionCount, w as persistedColumns, Ni as planBranch, Pi as planBranchProvision, Fi as planBranchTeardown, Ii as planBranchTeardownFor, Li as planNeonBranchProvision, Ri as planNeonBranchTeardown, tn as planVersionedUpdate, P as pluginRef, F as pluginRefSpecOf, xe as preparePredicate, So as primaryKeyConflictError, Hi as provisionBranch, Xi as provisionResidentTenant, Kn as qualifyTable, Vt as queryFor, Xt as queryForView, gt as quoteIdent, bo as raiseChangeListenerCeiling, Ht as rank, T as raw, qa as readTenantSelection, E as readableByColumns, D as real, Xr as recordDbOp, Rr as recordsTable, O as reference, Ke as refuseWrite, ir as registerCoreTables, xn as registerDiscoveredRelations, Mr as registerPendingAttribution, Sn as registerRelations, ko as registerRetention, St as registerTable, zr as registerWriteRecorder, hn as relations, ar as requireActors, Ct as requireTable, or as requireTenants, Zr as resetDbMetricTagCacheForTests, nt as resetSnowflake, Zi as residentPlacement, Te as resolveActorSnapshot, zi as resolveBranchMechanism, Qr as resolveEagerFallbackWarnIntervalMs, Nr as resolveEchoAttribution, Ut as resolveFullTextIndex, at as resolveIdScheme, ct as resolveMixinGraph, Qi as resolveTenantHome, qn as resolveTenantNamespace, Ao as retentionTtlMsFromEnv, Nn as rowKeyColumns, Pn as rowKeyIdentity, Wt as rowNumber, cn as rowSchema, ii as runRetryingTransaction, ai as runSavepoint, oi as runStoreTransaction, wr as runWithWriteAttribution, Br as runWriteRecorders, To as sameDatabase, Jn as sanitizeIdentifierFragment, zo as scopeKeyOf, k as selfReference, je as serializeArraysForWrite, A as serverOnlyColumns, $i as setResidencyConfig, sa as setSchemaChangeSeedHook, ca as setTenantCreateSeedHook, si as settleTransactionExit, nn as settleVersionedUpdate, ja as softDropSnapshotStamp, Se as spatialPredicate, Ma as sqlError, eo as stagingLeftoverReport, to as stagingLeftovers, no as stagingNamesOf, ro as stagingStaleAfterMs, io as stampGeneratedId, ao as stampGeneratedIds, Ce as startsWith, qe as storeRefusalOf, Si as streamTable, Gt as sum, Kt as sumOver, Vr as suspendWriteRecorders, Hr as suspendWriteRecordersEffect, jo as sweepRetention, dt as table, Ui as teardownBranch, Ja as tenantSelectionId, j as text, M as timestamp, an as timestampMs, on as timestampMsOrNull, ci as transactionRetrySchedule, qt as union, Jt as unionAll, wt as unregisterTable, Ur as unregisterWriteRecorder, go as updateManyRow, _o as upsertRow, vo as upsertRowOutcome, An as upsertUpdatePatch, jn as upsertUpdateValues, Ze as validateColumnName, Qe as validateIndexName, Cn as validateRegisteredRelations, gn as validateRelationConfig, $e as validateTableName, et as validateTypeIdPrefix, N as vector, ft as vectorDistanceToOpclass, Ti as vectorEmbedding, rn as versionColumnOf, Zt as view, Qt as viewSql, we as walkLeaves, J as wireSafeCause, Tr as withCapturedAttribution, Wr as writeRecordersSuspended, Ya as writeTenantSelection };
5
+ import { compareDecimal as Y, decimalEqualityKey as X } from "./decimalComparison.js";
6
+ import { MATCHES_NO_ROWS as Z, and as Q, arrayContains as $, arrayHas as ee, arrayOverlaps as te, collectSubqueries as ne, contains as re, eq as ie, evaluatePredicate as ae, exists as oe, gt as se, gte as ce, inSet as le, inSubquery as ue, isNotNull as de, isNull as fe, jsonField as pe, lt as me, lte as he, neq as ge, not as _e, notExists as ve, notInSet as ye, notInSubquery as be, or as xe, preparePredicate as Se, spatialPredicate as Ce, startsWith as we, walkLeaves as Te } from "./predicate.js";
7
+ import { resolveActorSnapshot as Ee } from "./actorSnapshot.js";
8
+ import { allEnumRenames as De, clearEnumRenames as Oe, declareEnumRename as ke, getEnumRenames as Ae } from "./enumRenames.js";
9
+ import { deserializeArraysOnRead as je, serializeArraysForWrite as Me } from "./arrayCodec.js";
10
+ import { BOUND_ENCRYPTED_PREFIX as Ne, ENCRYPTED_PREFIX as Pe, FIELD_KEY_ID_PATTERN as Fe, FieldDecryptionError as Ie, ciphertextKeyId as Le, decodeFieldValue as Re, decryptFieldsOnRead as ze, encodeFieldValue as Be, encryptFieldsForWrite as Ve, encryptFieldsForWriteBatch as He, encryptedColumnsOf as Ue, fieldBinding as We, fieldBindingsOf as Ge, isBoundCiphertext as Ke, isEncrypted as qe, isFieldDecryptionError as Je, isRawEncoding as Ye, refuseIdChangeOfSealedRow as Xe } from "./fieldEncryption.js";
11
+ import { refuseWrite as Ze, storeRefusalOf as Qe } from "./storeRefusal.js";
12
+ import { MAX_IDENTIFIER_LENGTH as $e, WARN_IDENTIFIER_LENGTH as et, drainIdentifierWarnings as tt, validateColumnName as nt, validateIndexName as rt, validateTableName as it, validateTypeIdPrefix as at } from "./identifierLimits.js";
13
+ import { encodeTypeIdSuffix as ot, typeId as st, uuidV7Bytes as ct } from "./typeId.js";
14
+ import { generateSnowflake as lt, resetSnowflake as ut } from "./snowflake.js";
15
+ import { deriveTypeIdPrefix as dt, generateId as ft, resolveIdScheme as pt } from "./idGenerator.js";
16
+ import { defineMixin as mt, mixin as ht, resolveMixinGraph as gt } from "./mixins.js";
17
+ import { AUTO_FILLED_COLUMNS as _t, jsonIndex as vt, table as yt, vectorDistanceToOpclass as bt } from "./table.js";
18
+ import { DEFAULT_ACQUIRE_TIMEOUT_MS as xt, isMysqlFamily as St, isSqliteFamily as Ct, quoteIdent as wt } from "./dialect.js";
19
+ import { allRegisteredTables as Tt, clearTableRegistry as Et, ensureTableRegistered as Dt, getTable as Ot, isTableReactive as kt, registerTable as At, requireTable as jt, unregisterTable as Mt } from "./tableRegistry.js";
20
+ import { avg as Nt, avgOver as Pt, column as Ft, count as It, countDistinct as Lt, databaseHandle as Rt, denseRank as zt, except as Bt, intersect as Vt, lag as Ht, lead as Ut, max as Wt, min as Gt, orderClausesOf as Kt, paginateBy as qt, paginateById as Jt, queryFor as Yt, rank as Xt, resolveFullTextIndex as Zt, rowNumber as Qt, sum as $t, sumOver as en, union as tn, unionAll as nn } from "./queryBuilder.js";
21
+ import { isView as rn, queryForView as an, view as on, viewSql as sn } from "./view.js";
22
+ import { INITIAL_VERSION as cn, VersionConflict as ln, planVersionedUpdate as un, settleVersionedUpdate as dn, versionColumnOf as fn } from "./optimisticVersion.js";
23
+ import { timestampMs as pn, timestampMsOrNull as mn } from "./wire.js";
24
+ import { columnSchema as hn, rowSchema as gn } from "./rowSchema.js";
25
+ import { inferForeignKey as _n, isEmptyRelationsSpec as vn, isRelationsSpec as yn, many as bn, manyToMany as xn, one as Sn, relations as Cn, validateRelationConfig as wn } from "./relations.js";
26
+ import { allRegisteredRelations as Tn, clearRelationsRegistry as En, getRelation as Dn, getRelations as On, registerDiscoveredRelations as kn, registerRelations as An, validateRegisteredRelations as jn } from "./relationsRegistry.js";
27
+ import { DEFAULT_SUBJECT_GRAPH_DEPTH as Mn, deriveSubjectGraph as Nn, formatSubjectGraph as Pn } from "./subjectGraph.js";
28
+ import { decodeRowsForTable as Fn, decodeRowsFromSchema as In, decodeSelectRows as Ln, encodeRowForSchema as Rn } from "./rowDecoder.js";
29
+ import { upsertUpdatePatch as zn, upsertUpdateValues as Bn } from "./upsertUpdate.js";
30
+ import { isCompositeRowKey as Vn, rowKeyColumns as Hn, rowKeyIdentity as Un } from "./rowKey.js";
31
+ import { jsonPatchAssignments as Wn } from "./jsonPatchAssignments.js";
32
+ import { applyJsonPatch as Gn, compileJsonPatch as Kn, normalizeJsonPatchValue as qn } from "./jsonPatch.js";
33
+ import { EagerCardinalityError as Jn, attachEagerLoads as Yn, hasEagerLoads as Xn, oneCardinalityMessage as Zn } from "./joinCompiler.js";
34
+ import { coerceValueForSqlite as Qn } from "./sqliteValueCoercion.js";
35
+ import { TenantNamespaceInvalid as $n, TenantNamespaceUnresolved as er, qualifyTable as tr, resolveTenantNamespace as nr, sanitizeIdentifierFragment as rr } from "./namespace.js";
36
+ import { coercePredicateValue as ir, coercePredicateValues as ar } from "./predicateCoercion.js";
37
+ import { compilePredicate as or, compileRawFragment as sr, compileRowProjection as cr, compileSelect as lr, escapeLike as ur } from "./sqlCompiler.js";
38
+ import { coercePredicateForSqlite as dr, compileEagerJson as fr } from "./jsonEagerCompiler.js";
39
+ import { registerCoreTables as pr, requireActors as mr, requireTenants as hr } from "./coreTablesRegistry.js";
40
+ import { actorsTable as gr } from "./coreTables.js";
41
+ import { changeDelete as _r, changeInsert as vr, changeSoftDelete as yr, changeUpdate as br, externalChangeEvent as xr } from "./changeEvent.js";
42
+ import { committedChangeBatchOf as Sr, emitCommittedChanges as Cr } from "./committedChanges.js";
43
+ import { CHANGE_CLAIM_TTL_ENV as wr, DEFAULT_CHANGE_CLAIM_TTL_HOURS as Tr, OccurrenceCounter as Er, changeDigest as Dr, composeChangeKey as Or, occurrenceWindowMs as kr, parseChangeKey as Ar } from "./changeIdentity.js";
44
+ import { attributionFields as jr, currentWriteAttribution as Mr, runWithWriteAttribution as Nr, withCapturedAttribution as Pr } from "./writeAttribution.js";
45
+ import { attributionKey as Fr, beginLocalWrite as Ir, claimPendingAttribution as Lr, clearPendingAttribution as Rr, endLocalWrite as zr, pendingAttributionCount as Br, registerPendingAttribution as Vr, resolveEchoAttribution as Hr } from "./pendingAttribution.js";
46
+ import { ID_COLUMN_MAX_LENGTH as Ur, derivedRowId as Wr, derivedRowIdLength as Gr } from "./derivedRowId.js";
47
+ import { clearWriteRecorders as Kr, recordsTable as qr, registerWriteRecorder as Jr, runWriteRecorders as Yr, suspendWriteRecorders as Xr, suspendWriteRecordersEffect as Zr, unregisterWriteRecorder as Qr, writeImagesObserved as $r, writeRecordersSuspended as ei } from "./writeRecorder.js";
48
+ import { DEFAULT_EAGER_FALLBACK_WARN_INTERVAL_MS as ti, dbMetricTagCacheSizeForTests as ni, dbOperationsInFlight as ri, makeEagerFallbackReporter as ii, observeDbOp as ai, recordDbOp as oi, resetDbMetricTagCacheForTests as si, resolveEagerFallbackWarnIntervalMs as ci } from "./dbMetrics.js";
49
+ import { SHARED_TRANSACTION_SERVICE as li, TransactionAbortedError as ui, isTransactionAbortedError as di, makeTransactionAbortTracker as fi, onTransaction as pi, runRetryingTransaction as mi, runSavepoint as hi, runStoreTransaction as gi, settleTransactionExit as _i, transactionRetrySchedule as vi } from "./transactionOutcome.js";
50
+ import { MSSQL_TRANSIENT_NUMBERS as yi, MYSQL_TRANSIENT_CODES as bi, POSTGRES_TRANSIENT_STATES as xi, SQLITE_TRANSIENT_CODES as Si, TURSO_TRANSIENT_MESSAGE as Ci, isTransientContention as wi } from "./transientContention.js";
51
+ import { VOLTRO_EXPIRES_MIXIN_ID as Ti, expires as Ei } from "./expiresMixin.js";
52
+ import { VOLTRO_LOCAL_FIRST_MIXIN_ID as Di, isLocalFirst as Oi, localFirst as ki, localFirstTables as Ai } from "./localFirstMixin.js";
53
+ import { TableStreamError as ji, streamTable as Mi } from "./stream.js";
54
+ import { hybridSearch as Ni } from "./hybridSearch.js";
55
+ import { computeEmbedding as Pi, vectorEmbedding as Fi } from "./vectorEmbedding.js";
56
+ import { BranchNameInvalid as Ii, BranchTransitionInvalid as Li, branchNamespaceName as Ri, enforceBranchLimits as zi, isBranchNamespace as Bi, isNeonConnection as Vi, nextBranchState as Hi, planBranch as Ui, planBranchProvision as Wi, planBranchTeardown as Gi, planBranchTeardownFor as Ki, planNeonBranchProvision as qi, planNeonBranchTeardown as Ji, resolveBranchMechanism as Yi } from "./branching.js";
57
+ import { admitBranch as Xi, makeNamespaceBranchExecutor as Zi, provisionBranch as Qi, teardownBranch as $i } from "./branchExecute.js";
58
+ import { TenantRegionUnavailable as ea, TenantResidencyUnresolved as ta, bindResidentStore as na, clearResidencyConfig as ra, getResidencyConfig as ia, isRegionServable as aa, provisionResidentTenant as oa, residentPlacement as sa, resolveTenantHome as ca, setResidencyConfig as la } from "./residency.js";
59
+ import { auditAllTableIndexes as ua, auditTableIndexes as da, formatIndexAuditIssue as fa } from "./indexAudit.js";
60
+ import { defineSeed as pa, fireSchemaChangeSeeds as ma, fireTenantCreateSeeds as ha, isSeedDefinition as ga, setSchemaChangeSeedHook as _a, setTenantCreateSeedHook as va } from "./seed.js";
61
+ import { defineMigration as ya, isMigrationDefinition as ba } from "./migration.js";
62
+ import { FILE_MIGRATION_PATTERN as xa, IrreversibleMigrationError as Sa, MIGRATION_PHASES as Ca, MigrationExpectationFailed as wa, MigrationNeedsSqlClient as Ta, MigrationSkipped as Ea, RewriteUnstableError as Da, TransactionBrokenByBodyError as Oa, irreversible as ka, irreversibleReason as Aa, isFileMigration as ja, migration as Ma } from "./migrations/fileBased.js";
63
+ import { DEFAULT_SOFT_DROP_RETENTION_DAYS as Na, FRAMEWORK_LIVE_TABLES as Pa, STAGING_TABLE_PREFIX as Fa, agedSoftDropSnapshots as Ia, describeAgedSoftDropSnapshots as La, isFrameworkOwnedLiveTable as Ra, isSoftDropSnapshotName as za, isStagingTableName as Ba, softDropSnapshotStamp as Va } from "./migrations/frameworkLiveTables.js";
64
+ import { sqlError as Ha } from "./sqlError.js";
65
+ import { _voltroApiKeysTable as Ua, _voltroApiRoleWorkloadBucketsTable as Wa, _voltroDevicesTable as Ga, _voltroIdempotencyTable as Ka, _voltroKvTable as qa, _voltroMigrationPlansTable as Ja, _voltroMigrationsTable as Ya, _voltroPluginMigrationsTable as Xa, _voltroReplicaObservationsTable as Za, _voltroSchemaOwnerTable as Qa, _voltroSeedsTable as $a, _voltroTenantSelectionsTable as eo, frameworkTables as to } from "./frameworkTables.js";
66
+ import { TENANT_SELECTIONS_TABLE as no, deleteTenantSelection as ro, readTenantSelection as io, tenantSelectionId as ao, writeTenantSelection as oo } from "./tenantSelection.js";
67
+ import { REPLACE_IN_PROGRESS_TABLE as so, STAGING_STALE_MINUTES as co, _voltroReplaceInProgressTable as lo, interruptedReplaceRefusal as uo, stagingLeftoverReport as fo, stagingLeftovers as po, stagingNamesOf as mo, stagingStaleAfterMs as ho } from "./replaceInProgress.js";
68
+ import { stampGeneratedId as go, stampGeneratedIds as _o } from "./stampId.js";
69
+ import { BULK_INSERT_LIMITS as vo, bulkInsertLimitsFor as yo, chunkRowsForInsert as bo, columnsPerRow as xo } from "./bulkInsertLimits.js";
70
+ import { missingConflictColumns as So, missingRequiredColumns as Co } from "./requiredColumns.js";
71
+ import { insertIgnoreRowOutcome as wo, insertManyRows as To, insertRow as Eo, updateManyRow as Do, upsertRow as Oo, upsertRowOutcome as ko } from "./typedStore.js";
72
+ import { CHANGE_LISTENER_CEILING as Ao, raiseChangeListenerCeiling as jo } from "./changeListenerCeiling.js";
73
+ import { isPrimaryKeyConflictError as Mo, primaryKeyConflictError as No } from "./storeErrors.js";
74
+ import { connectionIdentity as Po, normaliseTarget as Fo, sameDatabase as Io } from "./connectionIdentity.js";
75
+ import { clearRetentions as Lo, listRetentionConflicts as Ro, listRetentions as zo, registerRetention as Bo, retentionTtlMsFromEnv as Vo, sweepRetention as Ho } from "./retention.js";
76
+ import { CDC_OFFSETS_TABLE as Uo, _voltroCdcOffsetsTable as Wo, _voltroMssqlCdcOffsetsTable as Go } from "./cdcOffsetsTables.js";
77
+ import { DATA_TRANSFERS_TABLE as Ko, _voltroDataTransfersTable as qo, describeTransferRun as Jo } from "./dataTransfers.js";
78
+ import { SCOPE_KEY_MAX_LENGTH as Yo, scopeKeyOf as Xo } from "./scopeKey.js";
79
+ import { SqlClient as Zo } from "effect/sql";
80
+ // src/index.ts
81
+ var Qo = "postgres";
82
+ export { _t as AUTO_FILLED_COLUMNS, Ne as BOUND_ENCRYPTED_PREFIX, vo as BULK_INSERT_LIMITS, Ii as BranchNameInvalid, Li as BranchTransitionInvalid, Uo as CDC_OFFSETS_TABLE, wr as CHANGE_CLAIM_TTL_ENV, Ao as CHANGE_LISTENER_CEILING, e as ColumnBuilder, Ko as DATA_TRANSFERS_TABLE, xt as DEFAULT_ACQUIRE_TIMEOUT_MS, Tr as DEFAULT_CHANGE_CLAIM_TTL_HOURS, ti as DEFAULT_EAGER_FALLBACK_WARN_INTERVAL_MS, Na as DEFAULT_SOFT_DROP_RETENTION_DAYS, Mn as DEFAULT_SUBJECT_GRAPH_DEPTH, Pe as ENCRYPTED_PREFIX, Qo as ENGINE, Jn as EagerCardinalityError, Fe as FIELD_KEY_ID_PATTERN, xa as FILE_MIGRATION_PATTERN, Pa as FRAMEWORK_LIVE_TABLES, Ie as FieldDecryptionError, Ur as ID_COLUMN_MAX_LENGTH, cn as INITIAL_VERSION, Sa as IrreversibleMigrationError, Z as MATCHES_NO_ROWS, $e as MAX_IDENTIFIER_LENGTH, Ca as MIGRATION_PHASES, yi as MSSQL_TRANSIENT_NUMBERS, bi as MYSQL_TRANSIENT_CODES, wa as MigrationExpectationFailed, Ta as MigrationNeedsSqlClient, Ea as MigrationSkipped, Er as OccurrenceCounter, xi as POSTGRES_TRANSIENT_STATES, so as REPLACE_IN_PROGRESS_TABLE, Da as RewriteUnstableError, Yo as SCOPE_KEY_MAX_LENGTH, t as SELF_REFERENCE_TARGET, li as SHARED_TRANSACTION_SERVICE, Si as SQLITE_TRANSIENT_CODES, co as STAGING_STALE_MINUTES, Fa as STAGING_TABLE_PREFIX, Zo as SqlClient, no as TENANT_SELECTIONS_TABLE, Ci as TURSO_TRANSIENT_MESSAGE, ji as TableStreamError, $n as TenantNamespaceInvalid, er as TenantNamespaceUnresolved, ea as TenantRegionUnavailable, ta as TenantResidencyUnresolved, ui as TransactionAbortedError, Oa as TransactionBrokenByBodyError, Ti as VOLTRO_EXPIRES_MIXIN_ID, Di as VOLTRO_LOCAL_FIRST_MIXIN_ID, ln as VersionConflict, et as WARN_IDENTIFIER_LENGTH, Ua as _voltroApiKeysTable, Wa as _voltroApiRoleWorkloadBucketsTable, Wo as _voltroCdcOffsetsTable, qo as _voltroDataTransfersTable, Ga as _voltroDevicesTable, Ka as _voltroIdempotencyTable, qa as _voltroKvTable, Ja as _voltroMigrationPlansTable, Ya as _voltroMigrationsTable, Go as _voltroMssqlCdcOffsetsTable, Xa as _voltroPluginMigrationsTable, lo as _voltroReplaceInProgressTable, Za as _voltroReplicaObservationsTable, Qa as _voltroSchemaOwnerTable, $a as _voltroSeedsTable, eo as _voltroTenantSelectionsTable, gr as actorsTable, Xi as admitBranch, Ia as agedSoftDropSnapshots, De as allEnumRenames, Tn as allRegisteredRelations, Tt as allRegisteredTables, Q as and, Gn as applyJsonPatch, n as array, $ as arrayContains, ee as arrayHas, te as arrayOverlaps, Yn as attachEagerLoads, jr as attributionFields, Fr as attributionKey, ua as auditAllTableIndexes, da as auditTableIndexes, R as authoredError, z as authoredMessageOf, Nt as avg, Pt as avgOver, Ir as beginLocalWrite, r as bigint, na as bindResidentStore, i as boolean, Ri as branchNamespaceName, yo as bulkInsertLimitsFor, a as bytes, B as causeBranches, _r as changeDelete, Dr as changeDigest, vr as changeInsert, yr as changeSoftDelete, br as changeUpdate, bo as chunkRowsForInsert, Le as ciphertextKeyId, Lr as claimPendingAttribution, V as classifyConstraintViolation, Oe as clearEnumRenames, Rr as clearPendingAttribution, En as clearRelationsRegistry, ra as clearResidencyConfig, Lo as clearRetentions, Et as clearTableRegistry, Kr as clearWriteRecorders, dr as coercePredicateForSqlite, ir as coercePredicateValue, ar as coercePredicateValues, Qn as coerceValueForSqlite, ne as collectSubqueries, Ft as column, I as columnRef, hn as columnSchema, xo as columnsPerRow, Sr as committedChangeBatchOf, Y as compareDecimal, fr as compileEagerJson, Kn as compileJsonPatch, or as compilePredicate, sr as compileRawFragment, cr as compileRowProjection, lr as compileSelect, Or as composeChangeKey, Pi as computeEmbedding, Po as connectionIdentity, re as contains, It as count, Lt as countDistinct, o as crdtCounter, s as crdtDoc, c as crdtManagedColumns, l as crdtManagedColumnsOf, u as crdtSealed, d as crdtText, Mr as currentWriteAttribution, Rt as databaseHandle, f as date, p as dbEnum, ni as dbMetricTagCacheSizeForTests, ri as dbOperationsInFlight, m as decimal, X as decimalEqualityKey, ke as declareEnumRename, Re as decodeFieldValue, Fn as decodeRowsForTable, In as decodeRowsFromSchema, Ln as decodeSelectRows, ze as decryptFieldsOnRead, ya as defineMigration, mt as defineMixin, pa as defineSeed, ro as deleteTenantSelection, zt as denseRank, Nn as deriveSubjectGraph, dt as deriveTypeIdPrefix, Wr as derivedRowId, Gr as derivedRowIdLength, La as describeAgedSoftDropSnapshots, H as describeCharsetRefusal, U as describeDriverError, W as describeRowBindings, Jo as describeTransferRun, je as deserializeArraysOnRead, tt as drainIdentifierWarnings, h as dropped, Cr as emitCommittedChanges, Be as encodeFieldValue, Rn as encodeRowForSchema, ot as encodeTypeIdSuffix, Ve as encryptFieldsForWrite, He as encryptFieldsForWriteBatch, Ue as encryptedColumnsOf, zr as endLocalWrite, zi as enforceBranchLimits, Dt as ensureTableRegistered, ie as eq, ur as escapeLike, ae as evaluatePredicate, Bt as except, oe as exists, Ei as expires, xr as externalChangeEvent, G as extractDbCause, We as fieldBinding, Ge as fieldBindingsOf, ma as fireSchemaChangeSeeds, ha as fireTenantCreateSeeds, fa as formatIndexAuditIssue, Pn as formatSubjectGraph, to as frameworkTables, ft as generateId, lt as generateSnowflake, g as geography, _ as geometry, Ae as getEnumRenames, Dn as getRelation, On as getRelations, ia as getResidencyConfig, Ot as getTable, se as gt, ce as gte, Xn as hasEagerLoads, Ni as hybridSearch, v as id, le as inSet, ue as inSubquery, _n as inferForeignKey, wo as insertIgnoreRowOutcome, To as insertManyRows, Eo as insertRow, y as integer, uo as interruptedReplaceRefusal, Vt as intersect, b as interval, ka as irreversible, Aa as irreversibleReason, Ke as isBoundCiphertext, Bi as isBranchNamespace, L as isColumnReference, Vn as isCompositeRowKey, vn as isEmptyRelationsSpec, qe as isEncrypted, Je as isFieldDecryptionError, ja as isFileMigration, K as isForeignKeyViolation, Ra as isFrameworkOwnedLiveTable, Oi as isLocalFirst, ba as isMigrationDefinition, St as isMysqlFamily, Vi as isNeonConnection, de as isNotNull, fe as isNull, Mo as isPrimaryKeyConflictError, q as isQueryTimeout, Ye as isRawEncoding, aa as isRegionServable, yn as isRelationsSpec, ga as isSeedDefinition, za as isSoftDropSnapshotName, Ct as isSqliteFamily, Ba as isStagingTableName, kt as isTableReactive, di as isTransactionAbortedError, wi as isTransientContention, rn as isView, x as json, pe as jsonField, vt as jsonIndex, Wn as jsonPatchAssignments, Ht as lag, Ut as lead, Ro as listRetentionConflicts, zo as listRetentions, ki as localFirst, Ai as localFirstTables, me as lt, he as lte, ii as makeEagerFallbackReporter, Zi as makeNamespaceBranchExecutor, fi as makeTransactionAbortTracker, bn as many, xn as manyToMany, S as materializeFields, Wt as max, Ma as migration, Gt as min, So as missingConflictColumns, Co as missingRequiredColumns, ht as mixin, ge as neq, Hi as nextBranchState, Fo as normaliseTarget, qn as normalizeJsonPatchValue, _e as not, ve as notExists, ye as notInSet, be as notInSubquery, C as numeric, ai as observeDbOp, kr as occurrenceWindowMs, pi as onTransaction, Sn as one, Zn as oneCardinalityMessage, xe as or, Kt as orderClausesOf, qt as paginateBy, Jt as paginateById, Ar as parseChangeKey, Br as pendingAttributionCount, w as persistedColumns, Ui as planBranch, Wi as planBranchProvision, Gi as planBranchTeardown, Ki as planBranchTeardownFor, qi as planNeonBranchProvision, Ji as planNeonBranchTeardown, un as planVersionedUpdate, P as pluginRef, F as pluginRefSpecOf, Se as preparePredicate, No as primaryKeyConflictError, Qi as provisionBranch, oa as provisionResidentTenant, tr as qualifyTable, Yt as queryFor, an as queryForView, wt as quoteIdent, jo as raiseChangeListenerCeiling, Xt as rank, T as raw, io as readTenantSelection, E as readableByColumns, D as real, oi as recordDbOp, qr as recordsTable, O as reference, Xe as refuseIdChangeOfSealedRow, Ze as refuseWrite, pr as registerCoreTables, kn as registerDiscoveredRelations, Vr as registerPendingAttribution, An as registerRelations, Bo as registerRetention, At as registerTable, Jr as registerWriteRecorder, Cn as relations, mr as requireActors, jt as requireTable, hr as requireTenants, si as resetDbMetricTagCacheForTests, ut as resetSnowflake, sa as residentPlacement, Ee as resolveActorSnapshot, Yi as resolveBranchMechanism, ci as resolveEagerFallbackWarnIntervalMs, Hr as resolveEchoAttribution, Zt as resolveFullTextIndex, pt as resolveIdScheme, gt as resolveMixinGraph, ca as resolveTenantHome, nr as resolveTenantNamespace, Vo as retentionTtlMsFromEnv, Hn as rowKeyColumns, Un as rowKeyIdentity, Qt as rowNumber, gn as rowSchema, mi as runRetryingTransaction, hi as runSavepoint, gi as runStoreTransaction, Nr as runWithWriteAttribution, Yr as runWriteRecorders, Io as sameDatabase, rr as sanitizeIdentifierFragment, Xo as scopeKeyOf, k as selfReference, Me as serializeArraysForWrite, A as serverOnlyColumns, la as setResidencyConfig, _a as setSchemaChangeSeedHook, va as setTenantCreateSeedHook, _i as settleTransactionExit, dn as settleVersionedUpdate, Va as softDropSnapshotStamp, Ce as spatialPredicate, Ha as sqlError, fo as stagingLeftoverReport, po as stagingLeftovers, mo as stagingNamesOf, ho as stagingStaleAfterMs, go as stampGeneratedId, _o as stampGeneratedIds, we as startsWith, Qe as storeRefusalOf, Mi as streamTable, $t as sum, en as sumOver, Xr as suspendWriteRecorders, Zr as suspendWriteRecordersEffect, Ho as sweepRetention, yt as table, $i as teardownBranch, ao as tenantSelectionId, j as text, M as timestamp, pn as timestampMs, mn as timestampMsOrNull, vi as transactionRetrySchedule, st as typeId, tn as union, nn as unionAll, Mt as unregisterTable, Qr as unregisterWriteRecorder, Do as updateManyRow, Oo as upsertRow, ko as upsertRowOutcome, zn as upsertUpdatePatch, Bn as upsertUpdateValues, ct as uuidV7Bytes, nt as validateColumnName, rt as validateIndexName, jn as validateRegisteredRelations, wn as validateRelationConfig, it as validateTableName, at as validateTypeIdPrefix, N as vector, bt as vectorDistanceToOpclass, Fi as vectorEmbedding, fn as versionColumnOf, on as view, sn as viewSql, Te as walkLeaves, J as wireSafeCause, Pr as withCapturedAttribution, $r as writeImagesObserved, ei as writeRecordersSuspended, oo as writeTenantSelection };
@@ -1,5 +1,5 @@
1
1
  import { ansi as e } from "@voltro/logger";
2
- //#region src/indexAudit.ts
2
+ // src/indexAudit.ts
3
3
  var t = (e) => {
4
4
  if (typeof e == "string") return e;
5
5
  if ("jsonPath" in e) {
@@ -7,55 +7,56 @@ var t = (e) => {
7
7
  return `(json:${t}->${n.join(".")}${r ? "::num" : ""})`;
8
8
  }
9
9
  return `(${e.expr})`;
10
- }, n = (e) => e.map(t), r = (e, n) => {
11
- if (e.length !== n.length) return !1;
12
- for (let r = 0; r < e.length; r++) if (t(e[r]) !== t(n[r])) return !1;
13
- return !0;
14
- }, i = (e, n) => {
15
- if (e.length >= n.length) return !1;
16
- for (let r = 0; r < e.length; r++) if (t(e[r]) !== t(n[r])) return !1;
17
- return !0;
18
- }, a = (e) => {
19
- let t = [], a = e.appliedIndexes, o = e.tableName;
20
- for (let e = 0; e < a.length; e++) {
21
- let s = a[e];
22
- for (let c = e + 1; c < a.length; c++) {
23
- let e = a[c];
24
- if (r(s.fields, e.fields)) {
25
- let [r, i] = s.name < e.name ? [s, e] : [e, s];
26
- t.push({
27
- kind: "duplicate-fields",
28
- table: o,
29
- redundant: r,
30
- coveredBy: i,
31
- message: `'${o}' has two indexes on the same fields [${n(s.fields).join(", ")}]: '${s.name}' and '${e.name}'. The B-tree engine builds both, costing write throughput + disk space for no read benefit. Drop '${r.name}' (or '${i.name}' if you prefer the other name). Applies to every supported dialect (Postgres / MySQL / MariaDB / MSSQL / SQLite).`
32
- });
33
- } else i(s.fields, e.fields) ? t.push({
34
- kind: "redundant-prefix",
35
- table: o,
36
- redundant: s,
37
- coveredBy: e,
38
- message: `'${o}' index '${s.name}' on [${n(s.fields).join(", ")}] is a leading prefix of '${e.name}' on [${n(e.fields).join(", ")}]. Every B-tree dialect we support (Postgres / MySQL / MariaDB / MSSQL / SQLite) can serve a [${n(s.fields).join(", ")}] query from '${e.name}' too via the leading-prefix rule, so '${s.name}' adds write cost without read benefit. Drop '${s.name}' — unless you specifically need a smaller index for cache locality on a write-heavy table (rare; profile first).`
39
- }) : i(e.fields, s.fields) && t.push({
40
- kind: "redundant-prefix",
41
- table: o,
42
- redundant: e,
43
- coveredBy: s,
44
- message: `'${o}' index '${e.name}' on [${n(e.fields).join(", ")}] is a leading prefix of '${s.name}' on [${n(s.fields).join(", ")}]. Every B-tree dialect we support (Postgres / MySQL / MariaDB / MSSQL / SQLite) can serve a [${n(e.fields).join(", ")}] query from '${s.name}' too via the leading-prefix rule, so '${e.name}' adds write cost without read benefit. Drop '${e.name}' — unless you specifically need a smaller index for cache locality on a write-heavy table (rare; profile first).`
10
+ }, n = (e) => e.map(t), r = {
11
+ btree: !0,
12
+ gist: !1,
13
+ gin: !1,
14
+ brin: !1,
15
+ hnsw: !1
16
+ }, i = (e) => typeof e == "string" ? JSON.stringify(["column", e]) : "jsonPath" in e ? JSON.stringify([
17
+ "json",
18
+ e.jsonPath.column,
19
+ e.jsonPath.path,
20
+ e.jsonPath.numeric ?? !1
21
+ ]) : JSON.stringify(["expression", e.expr]), a = (e, t) => {
22
+ if (!r[e.kind ?? "btree"] || !r[t.kind ?? "btree"] || e.fields.length === 0 || e.fields.length > t.fields.length || !e.fields.every((e, n) => i(e) === i(t.fields[n]))) return;
23
+ let n = e.where?.trim() || void 0, a = t.where?.trim() || void 0;
24
+ if ((a === void 0 || a === n) && (!e.unique || t.unique && e.fields.length === t.fields.length)) return e.fields.length === t.fields.length ? "duplicate-fields" : "redundant-prefix";
25
+ }, o = (e) => {
26
+ let t = [], r = e.appliedIndexes, i = e.tableName;
27
+ for (let e = 0; e < r.length; e++) {
28
+ let o = r[e];
29
+ for (let s = e + 1; s < r.length; s++) {
30
+ let e = r[s], c = a(o, e), l = a(e, o);
31
+ if (!c && !l) continue;
32
+ let [u, d, f] = c && (!l || o.name < e.name) ? [
33
+ o,
34
+ e,
35
+ c
36
+ ] : [
37
+ e,
38
+ o,
39
+ l
40
+ ], p = f === "duplicate-fields" ? `has two indexes on the same fields [${n(u.fields).join(", ")}]: '${o.name}' and '${e.name}'.` : `index '${u.name}' on [${n(u.fields).join(", ")}] is a leading prefix of '${d.name}' on [${n(d.fields).join(", ")}].`;
41
+ t.push({
42
+ kind: f,
43
+ table: i,
44
+ redundant: u,
45
+ coveredBy: d,
46
+ message: `'${i}' ${p} '${d.name}' covers its B-tree lookups without losing row coverage or uniqueness. Drop '${u.name}' unless profiling justifies the smaller index for cache locality. Applies to supported B-tree dialects (Postgres / MySQL / MariaDB / MSSQL / SQLite).`
45
47
  });
46
48
  }
47
49
  }
48
50
  return t;
49
- }, o = (e) => {
51
+ }, s = (e) => {
50
52
  let t = [];
51
- for (let n of e) t.push(...a(n));
53
+ for (let n of e) t.push(...o(n));
52
54
  return t;
53
- }, s = "\x1B[", c = `${s}38;2;245;158;11m`, l = `${s}38;2;16;185;129m`, u = (t, n) => `${t}${n}${e.reset}`, d = (e, t, n) => e ? typeof t == "function" ? t(n) : u(t, n) : n, f = (t, r = {}) => {
54
- let i = r.color ?? !0, a = r.indent ?? " ", o = (t) => d(i, e.dim, t.padEnd(11)), s = (t) => d(i, (t) => e.bold(e.brand(t)), t), u = (t) => d(i, e.brightRed24, t), f = (e) => d(i, l, e), p = (e) => d(i, c, e), m = (t) => d(i, e.dim, t), h = `${p("index audit")} ${m("·")} ${d(i, e.bold, t.kind)}`, g = t.redundant.fields.length, _ = n(t.coveredBy.fields.slice(g)), v = (e, t) => {
55
+ }, c = "\x1B[", l = `${c}38;2;245;158;11m`, u = `${c}38;2;16;185;129m`, d = (t, n) => `${t}${n}${e.reset}`, f = (e, t, n) => e ? typeof t == "function" ? t(n) : d(t, n) : n, p = (t, r = {}) => {
56
+ let i = r.color ?? !0, a = r.indent ?? " ", o = (t) => f(i, e.dim, t.padEnd(11)), s = (t) => f(i, (t) => e.bold(e.brand(t)), t), c = (t) => f(i, e.brightRed24, t), d = (e) => f(i, u, e), p = (e) => f(i, l, e), m = (t) => f(i, e.dim, t), h = `${p("index audit")} ${m("·")} ${f(i, e.bold, t.kind)}`, g = t.redundant.fields.length, _ = n(t.coveredBy.fields.slice(g)), v = (e, t) => {
55
57
  let n = e.slice(0, t), r = e.slice(t), i = [];
56
- return n.length > 0 && i.push(f(`[${n.join(", ")}]`)), r.length > 0 && i.push(p(`+ [${r.join(", ")}]`)), i.join(" ");
58
+ return n.length > 0 && i.push(d(`[${n.join(", ")}]`)), r.length > 0 && i.push(p(`+ [${r.join(", ")}]`)), i.join(" ");
57
59
  }, y = [];
58
- return y.push(h), y.push(""), y.push(`${o("table")}${s(t.table)}`), y.push(""), y.push(`${o("redundant")}${u(t.redundant.name)}`), y.push(`${o("")}${v(n(t.redundant.fields), g)}`), y.push(""), y.push(`${o("covered by")}${f(t.coveredBy.name)}`), y.push(`${o("")}${v(n(t.coveredBy.fields), g)}`), _.length > 0 && y.push(`${o("")}${m(`└ extra columns: ${_.join(", ")}`)}`), y.push(""), t.kind === "redundant-prefix" ? (y.push(`${o("why")}B-tree indexes serve queries that filter on a LEADING PREFIX of`), y.push(`${o("")}their column list. The wider index already covers every`), y.push(`${o("")}query the narrower one can serve.`), y.push(`${o("")}${m("Same rule on Postgres / MySQL / MariaDB / MSSQL / SQLite.")}`)) : (y.push(`${o("why")}Two indexes on the same columns under different names.`), y.push(`${o("")}The B-tree engine builds both — same coverage, double cost.`), y.push(`${o("")}${m("Same rule on Postgres / MySQL / MariaDB / MSSQL / SQLite.")}`)), y.push(""), y.push(`${o("cost")}Every ${s("INSERT")} / ${s("UPDATE")} / ${s("DELETE")} on this table writes`), y.push(`${o("")}to ${d(i, e.bold, "both")} B-trees. Pure write overhead, zero read benefit.`), y.push(""), y.push(`${o("fix")}Drop ${u(t.redundant.name)}`), y.push(`${o("")}${m("Keep only if profiling shows the smaller index gives a")}`), y.push(`${o("")}${m("measurable cache-locality boost on a write-heavy hot path.")}`), y.push(`${o("")}${m("Silence with VOLTRO_INDEX_AUDIT=off if intentional.")}`), y.map((e) => `${a}${e}`).join("\n");
60
+ return y.push(h), y.push(""), y.push(`${o("table")}${s(t.table)}`), y.push(""), y.push(`${o("redundant")}${c(t.redundant.name)}`), y.push(`${o("")}${v(n(t.redundant.fields), g)}`), y.push(""), y.push(`${o("covered by")}${d(t.coveredBy.name)}`), y.push(`${o("")}${v(n(t.coveredBy.fields), g)}`), _.length > 0 && y.push(`${o("")}${m(`└ extra columns: ${_.join(", ")}`)}`), y.push(""), t.kind === "redundant-prefix" ? (y.push(`${o("why")}B-tree indexes serve queries that filter on a LEADING PREFIX of`), y.push(`${o("")}their column list. The wider index already covers every`), y.push(`${o("")}query the narrower one can serve.`), y.push(`${o("")}${m("Same rule on Postgres / MySQL / MariaDB / MSSQL / SQLite.")}`)) : (y.push(`${o("why")}Two indexes on the same columns under different names.`), y.push(`${o("")}The B-tree engine builds both — same coverage, double cost.`), y.push(`${o("")}${m("Same rule on Postgres / MySQL / MariaDB / MSSQL / SQLite.")}`)), t.redundant.where && y.push(`${o("filter")}${t.redundant.where}`), y.push(`${o("")}Row coverage and uniqueness are preserved by the kept index.`), y.push(""), y.push(`${o("cost")}Matching ${s("INSERT")} / ${s("UPDATE")} / ${s("DELETE")} on this table writes`), y.push(`${o("")}to ${f(i, e.bold, "both")} B-trees. Pure write overhead, zero read benefit.`), y.push(""), y.push(`${o("fix")}Drop ${c(t.redundant.name)}`), y.push(`${o("")}${m("Keep only if profiling shows the smaller index gives a")}`), y.push(`${o("")}${m("measurable cache-locality boost on a write-heavy hot path.")}`), y.push(`${o("")}${m("Silence with VOLTRO_INDEX_AUDIT=off if intentional.")}`), y.map((e) => `${a}${e}`).join("\n");
59
61
  };
60
- //#endregion
61
- export { o as auditAllTableIndexes, a as auditTableIndexes, f as formatIndexAuditIssue };
62
+ export { s as auditAllTableIndexes, o as auditTableIndexes, p as formatIndexAuditIssue };
@@ -1,6 +1,6 @@
1
1
  import { resolveGinOpclass as e } from "./ginIndex.js";
2
2
  import { vectorDistanceToOpclass as t } from "./table.js";
3
- //#region src/indexStorage.ts
3
+ // src/indexStorage.ts
4
4
  var n = (e, n = "float32") => {
5
5
  let r = e?.hnsw, i = r?.m ?? 16, a = r?.efConstruction ?? 64;
6
6
  for (let [e, t] of Object.entries({
@@ -54,5 +54,4 @@ var n = (e, n = "float32") => {
54
54
  skip: !1
55
55
  };
56
56
  };
57
- //#endregion
58
57
  export { r as indexKindForDialect, i as indexStorageShape, a as pgIndexClauses, n as resolveHnswOptions };
@@ -3,7 +3,7 @@ import { authoredError as t } from "./dbCause.js";
3
3
  import { decimalEqualityKey as n } from "./decimalComparison.js";
4
4
  import { inferForeignKey as r, validateRelationConfig as i } from "./relations.js";
5
5
  import { getRelations as a } from "./relationsRegistry.js";
6
- //#region src/joinCompiler.ts
6
+ // src/joinCompiler.ts
7
7
  var o = class extends Error {
8
8
  _tag = "EagerCardinalityError";
9
9
  constructor(e) {
@@ -156,5 +156,4 @@ var o = class extends Error {
156
156
  for (let [e, n] of Object.entries(t)) e in r || (r[e] = n);
157
157
  });
158
158
  }, y = (e) => e.eager !== void 0 && Object.keys(e.eager).length > 0;
159
- //#endregion
160
159
  export { o as EagerCardinalityError, c as attachEagerLoads, y as hasEagerLoads, s as oneCardinalityMessage };
@@ -10,7 +10,7 @@ import { decodeCell as l } from "./rowDecoder.js";
10
10
  import { EagerCardinalityError as u, oneCardinalityMessage as d } from "./joinCompiler.js";
11
11
  import { coerceValueForSqlite as f } from "./sqliteValueCoercion.js";
12
12
  import { compilePredicate as p } from "./sqlCompiler.js";
13
- //#region src/jsonEagerCompiler.ts
13
+ // src/jsonEagerCompiler.ts
14
14
  var m = (e, t, n) => {
15
15
  if (e.eager === void 0) return null;
16
16
  let r = v(e.table, e.eager, e.sourceTable);
@@ -432,5 +432,4 @@ var m = (e, t, n) => {
432
432
  value: f(t.value)
433
433
  };
434
434
  };
435
- //#endregion
436
435
  export { $ as coercePredicateForSqlite, f as coerceValueForSqlite, m as compileEagerJson };
package/dist/jsonPatch.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/jsonPatch.ts
1
+ // src/jsonPatch.ts
2
2
  var e = (e) => typeof e == "object" && !!e && !Array.isArray(e), t = (e) => JSON.parse(JSON.stringify(e ?? null)), n = (n, r, i) => {
3
3
  let [a, ...o] = r.split("."), s = t(i), c = n[a], l = (t, n) => {
4
4
  if (n === o.length) return s;
@@ -74,5 +74,4 @@ var e = (e) => typeof e == "object" && !!e && !Array.isArray(e), t = (e) => JSON
74
74
  }
75
75
  return n`${n(s)} = ${b}`;
76
76
  };
77
- //#endregion
78
77
  export { n as applyJsonPatch, r as compileJsonPatch, t as normalizeJsonPatchValue };
@@ -1,6 +1,6 @@
1
1
  import { authoredError as e } from "./dbCause.js";
2
2
  import { rowKeyColumns as t } from "./rowKey.js";
3
- //#region src/jsonPatchAssignments.ts
3
+ // src/jsonPatchAssignments.ts
4
4
  var n = (n, r, i) => {
5
5
  let a = new Set(t(n).map(([e]) => e)), o = r.split(".")[0];
6
6
  return Object.fromEntries(Object.entries(i ?? {}).filter(([t, n]) => {
@@ -9,5 +9,4 @@ var n = (n, r, i) => {
9
9
  return !0;
10
10
  }));
11
11
  };
12
- //#endregion
13
12
  export { n as jsonPatchAssignments };
package/dist/jsonPath.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { quoteIdent as e } from "./dialect.js";
2
- //#region src/jsonPath.ts
2
+ // src/jsonPath.ts
3
3
  var t = /^[A-Za-z_][A-Za-z0-9_]*$/, n = (e) => "$" + e.map((e) => typeof e == "number" ? `[${e}]` : t.test(e) ? `.${e}` : `."${e.replace(/"/g, "\\\"")}"`).join(""), r = (e) => "{" + e.map((e) => {
4
4
  let t = String(e);
5
5
  return /^[A-Za-z0-9_]+$/.test(t) ? t : `"${t.replace(/(["\\])/g, "\\$1")}"`;
@@ -27,5 +27,4 @@ var t = /^[A-Za-z_][A-Za-z0-9_]*$/, n = (e) => "$" + e.map((e) => typeof e == "n
27
27
  }
28
28
  }
29
29
  };
30
- //#endregion
31
30
  export { i as jsonPathSql };
@@ -1,5 +1,5 @@
1
1
  import { defineMixin as e } from "./mixins.js";
2
- //#region src/localFirstMixin.ts
2
+ // src/localFirstMixin.ts
3
3
  var t = "voltro/localFirst", n = () => e({
4
4
  id: t,
5
5
  fields: {}
@@ -8,5 +8,4 @@ var t = "voltro/localFirst", n = () => e({
8
8
  for (let n of Object.values(e)) r(n) && t.push(n.tableName);
9
9
  return t;
10
10
  };
11
- //#endregion
12
11
  export { t as VOLTRO_LOCAL_FIRST_MIXIN_ID, r as isLocalFirst, n as localFirst, i as localFirstTables };