@voltro/database 0.87.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 (170) hide show
  1. package/CHANGELOG.md +169 -6
  2. package/THIRD-PARTY-NOTICES.md +1 -1
  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 +1 -2
  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 +1 -2
  27. package/dist/frameworkTables.js +1 -2
  28. package/dist/ginIndex.js +1 -2
  29. package/dist/hybridSearch.js +1 -2
  30. package/dist/idGenerator.js +1 -2
  31. package/dist/identifierLimits.js +1 -2
  32. package/dist/index.d.ts +5 -7
  33. package/dist/index.js +1 -2
  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 +1 -2
  43. package/dist/migration.js +1 -2
  44. package/dist/migrations/appliedAtValue.js +1 -2
  45. package/dist/migrations/applier.js +1 -2
  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 +1 -2
  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 +1 -2
  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 +3 -4
  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 +3 -4
  70. package/dist/migrations/postgresEnumCheck.js +1 -2
  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 +1 -2
  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 +1 -2
  114. package/dist/predicateCoercion.js +1 -2
  115. package/dist/projectedColumn.js +1 -2
  116. package/dist/queryBuilder.js +1 -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 +1 -2
  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/sqlCompiler.js +1 -2
  131. package/dist/sqlError.js +1 -2
  132. package/dist/sqlMutation.js +1 -2
  133. package/dist/sqlPoolCapacity.js +1 -2
  134. package/dist/sqliteDecimal.js +1 -2
  135. package/dist/sqliteDecimalAggregateSql.js +1 -2
  136. package/dist/sqliteDecimalColumnSql.js +1 -2
  137. package/dist/sqliteDecimalConversion.js +1 -2
  138. package/dist/sqliteDecimalCte.js +1 -2
  139. package/dist/sqliteDecimalEncodeSql.js +1 -2
  140. package/dist/sqliteDecimalOutputs.js +1 -2
  141. package/dist/sqliteDecimalPredicate.js +1 -2
  142. package/dist/sqliteDecimalQuery.js +1 -2
  143. package/dist/sqliteDecimalQueryPlan.js +1 -2
  144. package/dist/sqliteDecimalResultSql.js +1 -2
  145. package/dist/sqliteDecimalRowQuery.js +1 -2
  146. package/dist/sqliteDecimalSetQuery.js +1 -2
  147. package/dist/sqliteDecimalSource.js +1 -2
  148. package/dist/sqliteDecimalStorage.js +1 -2
  149. package/dist/sqliteDecimalSubquery.js +1 -2
  150. package/dist/sqliteDecimalWindowQuery.js +1 -2
  151. package/dist/sqliteValueCoercion.js +1 -2
  152. package/dist/stampId.js +1 -2
  153. package/dist/storeErrors.js +1 -2
  154. package/dist/storeRefusal.js +1 -2
  155. package/dist/stream.js +1 -2
  156. package/dist/subjectGraph.js +1 -2
  157. package/dist/table.js +1 -2
  158. package/dist/tableRegistry.js +1 -2
  159. package/dist/tenantSelection.js +1 -2
  160. package/dist/transactionOutcome.js +1 -2
  161. package/dist/transientContention.js +1 -2
  162. package/dist/typeId.js +1 -2
  163. package/dist/typedStore.js +1 -2
  164. package/dist/upsertUpdate.js +1 -2
  165. package/dist/vectorEmbedding.js +1 -2
  166. package/dist/view.js +1 -2
  167. package/dist/wire.js +1 -2
  168. package/dist/writeAttribution.js +1 -2
  169. package/dist/writeRecorder.js +1 -2
  170. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- //#region src/identifierLimits.ts
1
+ // src/identifierLimits.ts
2
2
  var e = 63, t = 60, n = /* @__PURE__ */ new Set(), r = (e) => {
3
3
  n.add(e);
4
4
  }, i = () => {
@@ -28,5 +28,4 @@ var e = 63, t = 60, n = /* @__PURE__ */ new Set(), r = (e) => {
28
28
  }
29
29
  e.length > 60 && r(`typeid prefix '${e}' on table '${t.tableName}' is ${e.length} chars — close to the 63-byte limit. Generated ids will be even longer (prefix + '_' + 26).`);
30
30
  };
31
- //#endregion
32
31
  export { e as MAX_IDENTIFIER_LENGTH, t as WARN_IDENTIFIER_LENGTH, i as drainIdentifierWarnings, c as validateColumnName, l as validateIndexName, s as validateTableName, u as validateTypeIdPrefix };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Duration } from 'effect/Duration';
4
4
  import { Effect } from 'effect';
5
5
  import { Exit } from 'effect';
6
6
  import { Layer } from 'effect';
7
+ import { NonEmptyReadonlyArray } from 'effect/Array';
7
8
  import { Schedule } from 'effect';
8
9
  import { Schema } from 'effect';
9
10
  import { SqlClient } from 'effect/sql';
@@ -240,12 +241,9 @@ export declare interface AuditActor {
240
241
  export declare const auditAllTableIndexes: (tables: ReadonlyArray<Table<string, Record<string, ColumnDefinition<unknown>>, boolean, string>>) => ReadonlyArray<IndexAuditIssue>;
241
242
 
242
243
  /**
243
- * Find all index-overlap issues on a single table. Pure function; no
244
- * side effects. Returns an empty array when the schema is clean.
245
- *
246
- * Pair deduplication: each (a, b) collision is reported ONCE, never
247
- * (a, b) AND (b, a). For `duplicate-fields` we keep the lexicographic
248
- * lower name as `redundant` so the message is stable across re-runs.
244
+ * Find index-overlap issues on a single table. Each pair is reported once.
245
+ * When coverage holds in both directions, the lower name is redundant for
246
+ * stable output. Otherwise only the proven direction may recommend a drop.
249
247
  */
250
248
  export declare const auditTableIndexes: (table: Table<string, Record<string, ColumnDefinition<unknown>>, boolean, string>) => ReadonlyArray<IndexAuditIssue>;
251
249
 
@@ -904,7 +902,7 @@ export declare const changeUpdate: (table: string, before: Row, after: Row, meta
904
902
  *
905
903
  * `undefined` limits (an unknown dialect) → one group, unchanged behaviour.
906
904
  */
907
- export declare const chunkRowsForInsert: <T extends Record<string, unknown>>(rows: ReadonlyArray<T>, limits: BulkInsertLimits | undefined) => ReadonlyArray<ReadonlyArray<T>>;
905
+ export declare const chunkRowsForInsert: <T extends Record<string, unknown>>(rows: ReadonlyArray<T>, limits: BulkInsertLimits | undefined) => ReadonlyArray<NonEmptyReadonlyArray<T>>;
908
906
 
909
907
  /**
910
908
  * The id of the key a ciphertext names, read off the value without any key —
package/dist/index.js CHANGED
@@ -77,7 +77,6 @@ import { CDC_OFFSETS_TABLE as Uo, _voltroCdcOffsetsTable as Wo, _voltroMssqlCdcO
77
77
  import { DATA_TRANSFERS_TABLE as Ko, _voltroDataTransfersTable as qo, describeTransferRun as Jo } from "./dataTransfers.js";
78
78
  import { SCOPE_KEY_MAX_LENGTH as Yo, scopeKeyOf as Xo } from "./scopeKey.js";
79
79
  import { SqlClient as Zo } from "effect/sql";
80
- //#region src/index.ts
80
+ // src/index.ts
81
81
  var Qo = "postgres";
82
- //#endregion
83
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 };
package/dist/migrate.js CHANGED
@@ -19,7 +19,7 @@ import { mssqlTextStorageLength as ie } from "./mssqlTextStorage.js";
19
19
  import { Effect as C, Schedule as w } from "effect";
20
20
  import { SqlClient as T } from "effect/sql";
21
21
  import { createLogger as ae } from "@voltro/logger";
22
- //#region src/migrate.ts
22
+ // src/migrate.ts
23
23
  var E = ae({ scope: "voltro:migrate" }), D = (e) => {
24
24
  E.warn(e.replace(/^\[voltro:migrate\]\s*/, ""));
25
25
  }, O = (e, t) => {
@@ -640,5 +640,4 @@ BEGIN
640
640
  yield* b(i, Q(i, t, n, r.retryFilter), { schema: r.lockSchema }).pipe(C.orDie);
641
641
  }).pipe(C.provide(t)));
642
642
  };
643
- //#endregion
644
643
  export { x as DEFAULT_CDC_CHANNEL, $ as applyNamespacedSchema, ye as applySchema, A as defaultArrayClause, k as defaultClause, j as defaultJsonClause, ve as emitFrameworkBootstrapSql, ge as emitNamespaceProvisionDdl, _e as emitNamespacedSchemaSql, X as emitSchemaSql, xe as ensureFullTextIndexes, Y as enumRenameBlocks, J as enumTypeBlocks, W as extensionBlocks, z as fullTextIndexSql, Se as isReRunSafeDdl, M as numericIdSql, Oe as provisionTenantNamespace, fe as reactiveTriggerRepairSql, ke as runFrameworkBootstrap, De as runMigrate, Ee as splitStatements, O as sqlType };
package/dist/migration.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/migration.ts
1
+ // src/migration.ts
2
2
  var e = (e, { apply: t, undo: n }) => ({
3
3
  name: e,
4
4
  apply: t,
@@ -14,5 +14,4 @@ var e = (e, { apply: t, undo: n }) => ({
14
14
  steps: n
15
15
  };
16
16
  }, n = (e) => typeof e == "object" && !!e && "__migration" in e && e.__migration === !0;
17
- //#endregion
18
17
  export { t as defineMigration, n as isMigrationDefinition };
@@ -1,8 +1,7 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/migrations/appliedAtValue.ts
2
+ // src/migrations/appliedAtValue.ts
3
3
  var t = (t, n) => t.onDialectOrElse({
4
4
  mysql: () => e.succeed(n.replace("T", " ").replace("Z", "")),
5
5
  orElse: () => e.succeed(n)
6
6
  });
7
- //#endregion
8
7
  export { t as appliedAtValue };
@@ -29,7 +29,7 @@ import { Effect as j } from "effect";
29
29
  import { isDeepStrictEqual as Ee } from "node:util";
30
30
  import { createHash as De, randomUUID as Oe } from "node:crypto";
31
31
  import { SqlClient as ke } from "effect/sql";
32
- //#region src/migrations/applier.ts
32
+ // src/migrations/applier.ts
33
33
  var Ae = (e, t) => `${t}(${e.precision ?? 38}, ${e.scale ?? 0})`, je = (e) => e.type === "text" && (e.hasDefault && e.defaultValue !== void 0 || e.oneOf !== void 0 && e.oneOf.length > 0), M = (e, t) => {
34
34
  let n = e.type === "text" && e.maxLength !== void 0;
35
35
  if (e.sqliteDecimalEncoding === void 0 && !n && !je(e) && !e.spatial && e.type !== "vector" && e.type !== "array" && e.type !== "enum") return;
@@ -1096,5 +1096,4 @@ EXEC sp_executesql @drop;`, Vt = (e) => `ALTER TABLE ${P(e.table)} DROP INDEX ${
1096
1096
  });
1097
1097
  }
1098
1098
  }, Dn = (e, t, n) => yn(e, t, { declared: n });
1099
- //#endregion
1100
1099
  export { Xt as addColumnDdl, gn as appliedLedgerOperations, Cn as applyPlan, _n as clearResumeLedger, Ue as columnLevelChecksMysql, bt as emitAddIndexMysql, tt as emitConvertCharsetMysql, ft as emitCreateTableMssql, nt as emitCreateTableMysql, Je as emitCreateTablePg, G as emitCreateTableSqlite, F as emitDropColumnDdl, Ie as emitDropColumnDdlMysql, ln as ensureDeployLedgerTable, an as ensureLedgerTable, on as ensurePlanLedgerTable, cn as ensurePluginMigrationsLedgerTable, un as ensureReplaceMarkerTable, sn as ensureSchemaOwnerTable, fn as hasInterruptedMigration, ht as mysqlIndexPrefixFor, Qe as renderColumnMysql, qe as renderColumnPg, Dn as runMigrationOp, En as runSchemaOp };
@@ -13,7 +13,7 @@ import { verifySqliteDecimalStorage as g } from "./sqliteDecimalBoot.js";
13
13
  import { describesSchema as _ } from "./ledgerRows.js";
14
14
  import { convergeUndeclaredCharset as v, describeUndeclaredCharsetWork as y, isUndeclaredCharsetWorkEmpty as b, readUndeclaredCharsetColumns as x, undeclaredCharsetWork as S } from "./undeclaredCharset.js";
15
15
  import { Effect as C } from "effect";
16
- //#region src/migrations/boot.ts
16
+ // src/migrations/boot.ts
17
17
  var w = (e) => e.operations.filter((e) => e.blocked).map((e) => ` - ${e.op.kind} ${"table" in e.op ? `[${e.op.table}]` : ""}: ${e.reason ?? "<no reason>"}\n fix: ${e.blocked?.fix ?? "<no fix>"}`).join("\n"), T = (e) => e`
18
18
  SELECT fingerprint
19
19
  FROM _voltro_migration_plans
@@ -170,7 +170,7 @@ var w = (e) => e.operations.filter((e) => e.blocked).map((e) => ` - ${e.op.kind
170
170
  case "up-to-date": return `auto-migrate: schema up to date (${t}, fingerprint=${o(e.fingerprint)})`;
171
171
  case "applied": {
172
172
  let t = e.plan.summary;
173
- return `auto-migrate: applied ${e.applied.appliedOps} op(s) in ${e.applied.durationMs}ms [safe=${t.safe} needs-default=${t.needsDefault} needs-backfill=${t.needsBackfill} rename=${t.needsRenameAnnotation} lossy=${t.lossy}] fingerprint=${o(e.applied.fingerprint)}`;
173
+ return `auto-migrate: applied ${e.applied.appliedOps} op(s) in ${e.applied.durationMs}ms [safe=${t.safe} needs-default=${t.needsDefault} needs-backfill=${t.needsBackfill} rename=${t.needsRenameAnnotation} lossy=${t.lossy}] fingerprint=${o(e.applied.fingerprint)} (planner pass; excludes framework bootstrap and file migrations)`;
174
174
  }
175
175
  case "prod-mismatch": return `auto-migrate: SCHEMA FINGERPRINT MISMATCH — declared=${o(e.expected)}` + (e.actual ? ` live=${o(e.actual)}` : " live=<no _voltro_migration_plans row>") + ". Run `voltro db apply --plan plan.json` from the deploy pipeline before serving.";
176
176
  case "refused-blocked": {
@@ -192,5 +192,4 @@ var w = (e) => e.operations.filter((e) => e.blocked).map((e) => ` - ${e.op.kind
192
192
  }
193
193
  }
194
194
  };
195
- //#endregion
196
195
  export { R as describeOutcome, M as destructiveScope, T as fetchLastFingerprint, j as ignoreTablesFromEnv, E as recordUpToDate, L as runPlannedMigrations, P as unblockLossy };
@@ -1,5 +1,5 @@
1
1
  import { unblockLossy as e } from "./boot.js";
2
- //#region src/migrations/branchRehearsal.ts
2
+ // src/migrations/branchRehearsal.ts
3
3
  var t = (e) => {
4
4
  let t = e.table;
5
5
  if (typeof t == "string") return t;
@@ -118,5 +118,4 @@ var t = (e) => {
118
118
  }
119
119
  return t.push(e.tornDown ? ` branch ${e.branchId} torn down.` : ` branch ${e.branchId} KEPT — drop it when you are done.`), t.join("\n");
120
120
  };
121
- //#endregion
122
121
  export { a as branchRehearsalExitCode, s as formatBranchRehearsal, i as rehearseMigrationOnBranch, n as rehearsedOperation };
@@ -2,7 +2,7 @@ import { indexStorageShape as e } from "../indexStorage.js";
2
2
  import { mssqlTextStorageLength as t } from "../mssqlTextStorage.js";
3
3
  import { sqlType as n } from "../migrate.js";
4
4
  import { normalizeIndexPredicate as r } from "./indexPredicate.js";
5
- //#region src/migrations/columnEquivalence.ts
5
+ // src/migrations/columnEquivalence.ts
6
6
  var i = (e, t) => t.name === "id" && e.primaryKey?.length === 1 && e.primaryKey[0] === "id", a = /* @__PURE__ */ new Set(["integer", "bigint"]), o = (e) => a.has(e) ? "numeric" : "text", s = (e) => e.idScheme?.kind === "numeric" ? "numeric" : "text", c = (e) => e.idStorage ?? (b(e) ? "numeric" : "text"), l = (e) => e.idScheme ? s(e) : c(e), u = (e) => e.type === "text" || e.type === "id" && l(e) === "text", d = (e, t) => t && (e.type === "text" || e.type === "id") ? {
7
7
  ...e,
8
8
  type: "id",
@@ -81,5 +81,4 @@ var i = (e, t) => t.name === "id" && e.primaryKey?.length === 1 && e.primaryKey[
81
81
  return;
82
82
  }
83
83
  };
84
- //#endregion
85
84
  export { d as canonicalIdColumn, _ as canonicalJson, y as comparableDefault, g as comparableIndex, m as comparableSpatial, s as declaredIdStorage, p as hasComparableType, o as idStorageOfType, b as isPgSequenceDefault, i as isSolePrimaryKeyId, u as isTextStorage, c as liveIdStorage, x as normRef, v as normalizeDefault, S as renderedTextWidth, l as resolvedIdStorage, f as sameIdSpelling, h as sameSpatial };
@@ -1,4 +1,4 @@
1
- //#region src/migrations/ddlError.ts
1
+ // src/migrations/ddlError.ts
2
2
  var e = [
3
3
  "sqlMessage",
4
4
  "code",
@@ -59,5 +59,4 @@ var e = [
59
59
  let u = r(c("code"));
60
60
  return u !== void 0 && l.push("", u), l.push(""), l.join("\n");
61
61
  }, r = (e) => e === "3F000" ? "remedy: the connection's search_path names a schema that does not exist. Voltro sets it from DB_SCHEMA — create the schema (`CREATE SCHEMA \"<name>\"`) or unset DB_SCHEMA to use the connection default. Voltro creates TABLES, never the schema itself: that is a namespace decision, and inventing one from a typo is how a migration lands somewhere nobody is looking." : void 0;
62
- //#endregion
63
62
  export { n as formatDdlError };
@@ -1,9 +1,8 @@
1
1
  import { splitStatements as e } from "../migrate.js";
2
- //#region src/migrations/ddlStatements.ts
2
+ // src/migrations/ddlStatements.ts
3
3
  var t = (t, n) => {
4
4
  if (t !== "postgres") return [n];
5
5
  let r = e(n);
6
6
  return r.length <= 1 ? [n] : r;
7
7
  };
8
- //#endregion
9
8
  export { t as ddlStatementsFor };
@@ -6,7 +6,7 @@ import { indexKindForDialect as a, indexStorageShape as o, resolveHnswOptions as
6
6
  import { lowerUniqueActive as c } from "./uniqueActiveLowering.js";
7
7
  import { renderedTextWidth as l } from "./columnEquivalence.js";
8
8
  import { stampDeclaredCharset as u } from "./storeCharset.js";
9
- //#region src/migrations/declaredSchema.ts
9
+ // src/migrations/declaredSchema.ts
10
10
  var d = (e, i, a) => {
11
11
  let o = i.references ? {
12
12
  table: i.references().tableName,
@@ -141,7 +141,7 @@ var d = (e, i, a) => {
141
141
  return {
142
142
  ...e,
143
143
  columns: e.columns.map((e) => {
144
- if (n === "mssql" && !e.generatedAs && (e.type === "json" || e.type === "array") && (e = {
144
+ if (n !== "mssql" || e.generatedAs || e.type !== "json" && e.type !== "array" || (e = {
145
145
  ...e,
146
146
  jsonValidation: e.type === "json" ? "value" : "container"
147
147
  }), t(n)) {
@@ -158,5 +158,4 @@ var d = (e, i, a) => {
158
158
  })
159
159
  };
160
160
  };
161
- //#endregion
162
161
  export { h as declaredSnapshot, d as snapshotColumn };
@@ -1,7 +1,7 @@
1
1
  import { id as e, text as t } from "../columns.js";
2
2
  import { table as n } from "../table.js";
3
3
  import { Effect as r } from "effect";
4
- //#region src/migrations/deployLedger.ts
4
+ // src/migrations/deployLedger.ts
5
5
  var i = "_voltro_deploys", a = n(i, {
6
6
  id: e({ prefix: "dpl" }),
7
7
  status: t(),
@@ -15,5 +15,4 @@ var i = "_voltro_deploys", a = n(i, {
15
15
  ...e,
16
16
  startedAt: String(e.startedAt)
17
17
  }))), r.catch(() => r.succeed([])));
18
- //#endregion
19
18
  export { i as DEPLOY_LEDGER_TABLE, a as _voltroDeploysTable, s as closeDeploy, c as failDeploy, o as openDeploy, l as unfinishedDeploys };
@@ -1,5 +1,5 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/migrations/fileBased.ts
2
+ // src/migrations/fileBased.ts
3
3
  var t = ["before-schema", "after-schema"], n = (e) => {
4
4
  if (!e.id || e.id.length === 0) throw Error("migration: `id` is required + must be non-empty");
5
5
  if (!e.up || !e.down) throw Error(`migration ${e.id}: both \`up\` and \`down\` must be functions`);
@@ -53,5 +53,4 @@ var t = ["before-schema", "after-schema"], n = (e) => {
53
53
  super(`rewrite of ${e} did not stabilise after ${t.passes} pass(es): ${t.rewritten} rewritten, ${t.contended} contended on the last pass. Check for concurrent writes and guard values that cannot round-trip exactly before raising maxPasses.`), this.table = e, this.report = t, this.name = "RewriteUnstableError";
54
54
  }
55
55
  }, f = /^\d{8}_\d{6}_[a-z0-9_]+\.ts$/, p = (e) => typeof e == "object" && !!e && "id" in e && "up" in e && "down" in e && typeof e.id == "string" && typeof e.up == "function" && typeof e.down == "function";
56
- //#endregion
57
56
  export { f as FILE_MIGRATION_PATTERN, i as IrreversibleMigrationError, t as MIGRATION_PHASES, c as MigrationExpectationFailed, u as MigrationNeedsSqlClient, s as MigrationSkipped, d as RewriteUnstableError, l as TransactionBrokenByBodyError, a as irreversible, o as irreversibleReason, p as isFileMigration, n as migration };
@@ -12,7 +12,7 @@ import { introspectSchema as h } from "./introspect.js";
12
12
  import { runMigrationOp as g, runSchemaOp as _ } from "./applier.js";
13
13
  import { unblockLossy as v } from "./boot.js";
14
14
  import { Effect as y } from "effect";
15
- //#region src/migrations/fileContext.ts
15
+ // src/migrations/fileContext.ts
16
16
  var b = (t) => typeof t.__definition == "function" ? e({ c: t }).c : t, x = (e) => {
17
17
  if (typeof e != "string") return e;
18
18
  let t = e.trim().replace(/::[a-zA-Z0-9_ "]+$/, "").trim();
@@ -478,5 +478,4 @@ var b = (t) => typeof t.__definition == "function" ? e({ c: t }).c : t, x = (e)
478
478
  for (let { description: n, check: r } of e) (yield* j(r())) || t.push(n);
479
479
  return t;
480
480
  });
481
- //#endregion
482
481
  export { U as failedExpectations, H as makeFileMigrationContext, C as materialiseSnapshot };
@@ -16,7 +16,7 @@ import { createLogger as T } from "@voltro/logger";
16
16
  import { promises as E } from "node:fs";
17
17
  import { join as D } from "node:path";
18
18
  import { pathToFileURL as O } from "node:url";
19
- //#region src/migrations/fileDiscovery.ts
19
+ // src/migrations/fileDiscovery.ts
20
20
  var k = T({ scope: "voltro:migrate" }), A = (e) => C("sha256").update(e).digest("hex").slice(0, 16), j = [{
21
21
  codemod: "0.78.0/01_file-migration-phase",
22
22
  inverse: (e) => {
@@ -328,5 +328,4 @@ var k = T({ scope: "voltro:migrate" }), A = (e) => C("sha256").update(e).digest(
328
328
  };
329
329
  }), (e) => e.release.pipe(S.orDie)) : yield* S.fail(new a(t.id, i));
330
330
  });
331
- //#endregion
332
331
  export { i as FILE_MIGRATION_PATTERN, j as FRAMEWORK_MIGRATION_EDITS, U as FileMigrationLedgerError, K as MigrationIdTooLongError, M as acceptedBodyHashes, R as appliedFileMigrationIds, z as appliedFileMigrations, te as fileMigrationStatus, A as migrationBodyHash, Q as pendingFileMigrationIds, ee as pendingFileMigrationSummary, re as rollbackFileBasedMigration, ne as runFileBasedMigrations, G as unrecordableMigrationIds, P as walkMigrationFiles };
@@ -1,5 +1,5 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/migrations/fileSkipProbes.ts
2
+ // src/migrations/fileSkipProbes.ts
3
3
  var t = (e) => e.kind === "table" ? e.table : `${e.table}.${e.name}`, n = (e, n) => e.kind === n.kind && e.table === n.table && t(e) === t(n), r = (e) => JSON.stringify([
4
4
  e.kind,
5
5
  e.table,
@@ -113,5 +113,4 @@ var t = (e) => e.kind === "table" ? e.table : `${e.table}.${e.name}`, n = (e, n)
113
113
  }];
114
114
  });
115
115
  };
116
- //#endregion
117
116
  export { t as describeProbe, s as permanentSkips, o as plannedCreations, a as withSchemaProbeRecorder };
@@ -1,7 +1,7 @@
1
1
  import { isSoftDropSnapshotName as e } from "./frameworkLiveTables.js";
2
2
  import { canonicalIdColumn as t, comparableDefault as n, comparableIndex as r, comparableSpatial as i, isPgSequenceDefault as a, isSolePrimaryKeyId as o, normRef as s } from "./columnEquivalence.js";
3
3
  import { createHash as c } from "node:crypto";
4
- //#region src/migrations/fingerprint.ts
4
+ // src/migrations/fingerprint.ts
5
5
  var l = (e) => {
6
6
  if (e == null) return e;
7
7
  if (Array.isArray(e)) return e.map(l);
@@ -42,5 +42,4 @@ var l = (e) => {
42
42
  let t = { tables: m(e.tables) }, n = JSON.stringify(l(t));
43
43
  return c("sha256").update(n).digest("hex");
44
44
  }, g = (e) => e.slice(0, 16);
45
- //#endregion
46
45
  export { h as fingerprintSchema, g as shortFingerprint };
@@ -1,4 +1,4 @@
1
- //#region src/migrations/fkCycles.ts
1
+ // src/migrations/fkCycles.ts
2
2
  var e = (e, t) => `${e}::${t}`, t = (t, n) => {
3
3
  let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = (t) => {
4
4
  r.add(t);
@@ -9,5 +9,4 @@ var e = (e, t) => `${e}::${t}`, t = (t, n) => {
9
9
  for (let e of [...t].sort()) i.has(e) || o(e);
10
10
  return a;
11
11
  };
12
- //#endregion
13
12
  export { t as findCyclicFkBackEdges, e as fkEdgeKey };
@@ -1,4 +1,4 @@
1
- //#region src/migrations/frameworkLiveTables.ts
1
+ // src/migrations/frameworkLiveTables.ts
2
2
  var e = /* @__PURE__ */ new Set(["voltro_isr_cache"]), t = (t) => e.has(t) || t.startsWith("_voltro_") || t.startsWith("_cloud_") || t.startsWith("cluster_") || t.startsWith("__turso_internal_"), n = "_voltro_staging_", r = (e) => e.startsWith(n), i = /__dropped_\d{14}$/, a = (e) => i.test(e), o = 7, s = (e) => {
3
3
  let t = /__dropped_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/.exec(e);
4
4
  if (t === null) return;
@@ -21,5 +21,4 @@ var e = /* @__PURE__ */ new Set(["voltro_isr_cache"]), t = (t) => e.has(t) || t.
21
21
  let n = e.reduce((e, t) => e.ageDays >= t.ageDays ? e : t), r = (/* @__PURE__ */ new Date(Date.now() - t * 864e5)).toISOString().slice(0, 10);
22
22
  return `${e.length} soft-drop snapshot(s) older than ${t} day(s) still hold the dropped data (oldest: ${n.name}, ${n.ageDays}d) — ${e.map((e) => e.name).join(", ")}. Restore with \`voltro db restore-snapshot\` or reclaim with \`voltro db gc-snapshots --before ${r}\`; the window is \`database.softDropRetentionDays\` in app.config.`;
23
23
  }, u = (e, n) => e.filter((e) => !t(e.name) || n.has(e.name));
24
- //#endregion
25
24
  export { o as DEFAULT_SOFT_DROP_RETENTION_DAYS, e as FRAMEWORK_LIVE_TABLES, n as STAGING_TABLE_PREFIX, c as agedSoftDropSnapshots, l as describeAgedSoftDropSnapshots, t as isFrameworkOwnedLiveTable, a as isSoftDropSnapshotName, r as isStagingTableName, u as plannableLiveTables, s as softDropSnapshotStamp };
@@ -1,4 +1,4 @@
1
- //#region src/migrations/idempotentDdl.ts
1
+ // src/migrations/idempotentDdl.ts
2
2
  var e = (e) => {
3
3
  let t = e;
4
4
  for (let e = 0; e < 6 && typeof t == "object" && t; e++) {
@@ -33,5 +33,4 @@ var e = (e) => {
33
33
  why: "mysql/mariadb ADD CONSTRAINT has no IF NOT EXISTS; 1826 is exactly \"already there\"",
34
34
  errno: [1826]
35
35
  };
36
- //#endregion
37
36
  export { i as MYSQL_COLUMN_OR_INDEX_ABSENT, o as MYSQL_CONSTRAINT_ABSENT, s as MYSQL_FOREIGN_KEY_EXISTS, r as MYSQL_INDEX_EXISTS, a as SQLITE_COLUMN_ABSENT, n as isAlreadySatisfied };
@@ -1,4 +1,4 @@
1
- //#region src/migrations/indexPredicate.ts
1
+ // src/migrations/indexPredicate.ts
2
2
  var e = /'(?:''|[^'])*'|"(?:""|[^"])*"|\[(?:\]\]|[^\]])*\]|`(?:``|[^`])*`|[A-Za-z_][A-Za-z_0-9$]*|\d+(?:\.\d+)?|::|<>|!=|<=|>=|\|\||[^\s]/g, t = (t) => {
3
3
  let n = 0;
4
4
  for (let r of t.matchAll(e)) if (r[0] === "(" && n++, r[0] === ")" && n--, n === 0 && r[0].toLowerCase() === "where") return t.slice(r.index + r[0].length).trim().replace(/;$/, "").trim();
@@ -46,5 +46,4 @@ var e = /'(?:''|[^'])*'|"(?:""|[^"])*"|\[(?:\]\]|[^\]])*\]|`(?:``|[^`])*`|[A-Za-
46
46
  };
47
47
  return JSON.stringify(o(a));
48
48
  };
49
- //#endregion
50
49
  export { t as extractIndexPredicate, n as normalizeIndexPredicate };