@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/sql.js CHANGED
@@ -25,17 +25,18 @@ import { applyUndeclaredCharsetWork as ot, convergeUndeclaredCharset as st, desc
25
25
  import { describeOutcome as mt, destructiveScope as ht, fetchLastFingerprint as gt, ignoreTablesFromEnv as _t, recordUpToDate as vt, runPlannedMigrations as yt, unblockLossy as bt } from "./migrations/boot.js";
26
26
  import { failedExpectations as xt, makeFileMigrationContext as St, materialiseSnapshot as Ct } from "./migrations/fileContext.js";
27
27
  import { describeProbe as wt, permanentSkips as Tt, plannedCreations as Et, withSchemaProbeRecorder as Dt } from "./migrations/fileSkipProbes.js";
28
- import { FRAMEWORK_MIGRATION_EDITS as Ot, FileMigrationLedgerError as kt, acceptedBodyHashes as At, appliedFileMigrationIds as jt, appliedFileMigrations as Mt, fileMigrationStatus as Nt, migrationBodyHash as Pt, pendingFileMigrationIds as Ft, pendingFileMigrationSummary as It, rollbackFileBasedMigration as Lt, runFileBasedMigrations as Rt, walkMigrationFiles as zt } from "./migrations/fileDiscovery.js";
29
- import { previewMigrationSquash as Bt, squashMigrationPlans as Vt } from "./migrations/squash.js";
30
- import { assessRollingDeployGate as Ht, classifyRollingDeploySafety as Ut, createdTablesOf as Wt, rollingDeployUnsafeOps as Gt } from "./migrations/rollingDeploy.js";
31
- import { branchRehearsalExitCode as Kt, formatBranchRehearsal as qt, rehearseMigrationOnBranch as Jt, rehearsedOperation as Yt } from "./migrations/branchRehearsal.js";
32
- import { tenantNamespaceCharsetFindings as Xt } from "./migrations/namespaceCharset.js";
33
- import { checkSchemaOwner as Zt, foreignOwnerMessage as Qt, transferSchemaOwner as $t } from "./migrations/schemaOwner.js";
34
- import { isRawSqlFragment as en, sql as tn } from "./rawSql.js";
35
- import { readMigrationSnapshotCandidates as nn, restoreMigrationSnapshots as rn } from "./migrations/restoreSnapshots.js";
36
- import { readSqliteTableSchema as an } from "./migrations/sqliteTableSchema.js";
37
- import { forEachSqliteDecimalSourcePage as on, readSqliteDecimalSource as sn } from "./migrations/sqliteDecimalSource.js";
38
- import { sqliteDecimalDecisionIdentity as cn } from "./migrations/sqliteDecimalReview.js";
39
- import { prepareSqliteDecimalStage as ln } from "./migrations/sqliteDecimalStage.js";
40
- import { cleanupSqliteDecimalPublication as un, publishSqliteDecimalStage as dn, rollbackSqliteDecimalPublication as fn } from "./migrations/sqliteDecimalPublication.js";
41
- export { E as DEFAULT_CDC_CHANNEL, ge as DEPLOY_LEDGER_TABLE, e as FILE_MIGRATION_PATTERN, Ot as FRAMEWORK_MIGRATION_EDITS, kt as FileMigrationLedgerError, t as IrreversibleMigrationError, C as MIGRATION_ATOMICITY, h as MIGRATION_NEEDS_TWO_CONNECTIONS, n as MIGRATION_PHASES, re as MYSQL_CHARSETS, r as MigrationExpectationFailed, i as MigrationNeedsSqlClient, a as MigrationSkipped, D as REACTIVE_TRIGGER_PREFIX, o as RewriteUnstableError, Se as SCHEMA_OWNER_TABLE, ie as STORE_CHARSET_REMEDY, s as TransactionBrokenByBodyError, g as VOLTRO_MIGRATION_LOCK_KEY, _e as _voltroDeploysTable, At as acceptedBodyHashes, _ as acquireMigrationLock, Me as addColumnDdl, je as appliedAtValue, jt as appliedFileMigrationIds, Mt as appliedFileMigrations, Ne as appliedLedgerOperations, A as applyNamespacedSchema, Pe as applyPlan, j as applySchema, ot as applyUndeclaredCharsetWork, Ht as assessRollingDeployGate, Kt as branchRehearsalExitCode, ae as charsetColumnsOf, Zt as checkSchemaOwner, Ce as chunkTables, Ut as classifyRollingDeploySafety, un as cleanupSqliteDecimalPublication, Fe as clearResumeLedger, ve as closeDeploy, Ie as columnLevelChecksMysql, oe as columnTakesCharset, st as convergeUndeclaredCharset, Wt as createdTablesOf, de as declaredSnapshot, M as defaultArrayClause, N as defaultClause, P as defaultJsonClause, mt as describeOutcome, wt as describeProbe, se as describeStoreCharsetFinding, ct as describeUndeclaredCharsetWork, it as describesSchema, ht as destructiveScope, pe as detectReactiveTriggerDrift, w as dialectOf, Le as emitAddIndexMysql, Re as emitConvertCharsetMysql, ze as emitCreateTableMssql, Be as emitCreateTableMysql, Ve as emitCreateTablePg, He as emitCreateTableSqlite, Ue as emitDropColumnDdl, We as emitDropColumnDdlMysql, F as emitFrameworkBootstrapSql, I as emitNamespaceProvisionDdl, L as emitNamespacedSchemaSql, R as emitSchemaSql, Oe as engineFromVersion, Ge as ensureDeployLedgerTable, z as ensureFullTextIndexes, Ke as ensureLedgerTable, qe as ensurePlanLedgerTable, Je as ensurePluginMigrationsLedgerTable, Ye as ensureReplaceMarkerTable, Xe as ensureSchemaOwnerTable, B as enumRenameBlocks, V as enumTypeBlocks, H as extensionBlocks, ye as failDeploy, xt as failedExpectations, gt as fetchLastFingerprint, Nt as fileMigrationStatus, te as fingerprintSchema, v as fnv1a64, on as forEachSqliteDecimalSourcePage, Qt as foreignOwnerMessage, qt as formatBranchRehearsal, me as formatReactiveTriggerDrift, U as fullTextIndexSql, Ze as hasInterruptedMigration, _t as ignoreTablesFromEnv, we as introspectSchema, c as irreversible, l as irreversibleReason, Ae as isAlreadySatisfied, u as isFileMigration, at as isFileMigrationRow, ce as isMysqlCharset, en as isRawSqlFragment, W as isReRunSafeDdl, lt as isUndeclaredCharsetTable, ut as isUndeclaredCharsetWorkEmpty, De as limitClause, St as makeFileMigrationContext, Te as mapPgType, Ct as materialiseSnapshot, d as migration, T as migrationAtomicityFor, Pt as migrationBodyHash, y as migrationLockKeyForSchema, b as migrationLockNameForSchema, Qe as mysqlIndexPrefixFor, O as notifyFunctionName, G as numericIdSql, be as openDeploy, Ee as parseEnumCheck, Ft as pendingFileMigrationIds, It as pendingFileMigrationSummary, Tt as permanentSkips, he as planMigrations, f as plannableLiveTables, Et as plannedCreations, ln as prepareSqliteDecimalStage, Bt as previewMigrationSquash, K as provisionTenantNamespace, dn as publishSqliteDecimalStage, k as reactiveTriggerName, q as reactiveTriggerRepairSql, nn as readMigrationSnapshotCandidates, sn as readSqliteDecimalSource, an as readSqliteTableSchema, dt as readUndeclaredCharsetColumns, vt as recordUpToDate, p as registerSqlPoolCapacity, Q as registerSqliteMigrationBatch, Jt as rehearseMigrationOnBranch, Yt as rehearsedOperation, $e as renderColumnMysql, et as renderColumnPg, x as resolveMigrationLockSchema, ke as resolveMysqlEngine, rn as restoreMigrationSnapshots, Lt as rollbackFileBasedMigration, fn as rollbackSqliteDecimalPublication, Gt as rollingDeployUnsafeOps, Rt as runFileBasedMigrations, J as runFrameworkBootstrap, Y as runMigrate, tt as runMigrationOp, yt as runPlannedMigrations, nt as runSchemaOp, $ as runSqliteMigrationBatch, ne as shortFingerprint, fe as snapshotColumn, X as splitStatements, tn as sql, m as sqlPoolCapacity, Z as sqlType, cn as sqliteDecimalDecisionIdentity, ee as sqliteMigrationBatchStatements, Vt as squashMigrationPlans, le as stampDeclaredCharset, ue as storeCharsetFindings, Xt as tenantNamespaceCharsetFindings, $t as transferSchemaOwner, bt as unblockLossy, ft as undeclaredCharsetStatements, pt as undeclaredCharsetWork, xe as unfinishedDeploys, rt as verifySqliteDecimalStorage, zt as walkMigrationFiles, S as withMigrationLock, Dt as withSchemaProbeRecorder };
28
+ import { FRAMEWORK_MIGRATION_EDITS as Ot, FileMigrationLedgerError as kt, MigrationIdTooLongError as At, acceptedBodyHashes as jt, appliedFileMigrationIds as Mt, appliedFileMigrations as Nt, fileMigrationStatus as Pt, migrationBodyHash as Ft, pendingFileMigrationIds as It, pendingFileMigrationSummary as Lt, rollbackFileBasedMigration as Rt, runFileBasedMigrations as zt, unrecordableMigrationIds as Bt, walkMigrationFiles as Vt } from "./migrations/fileDiscovery.js";
29
+ import { previewMigrationSquash as Ht, squashMigrationPlans as Ut } from "./migrations/squash.js";
30
+ import { assessRollingDeployGate as Wt, classifyRollingDeploySafety as Gt, createdTablesOf as Kt, rollingDeployUnsafeOps as qt } from "./migrations/rollingDeploy.js";
31
+ import { branchRehearsalExitCode as Jt, formatBranchRehearsal as Yt, rehearseMigrationOnBranch as Xt, rehearsedOperation as Zt } from "./migrations/branchRehearsal.js";
32
+ import { tenantNamespaceCharsetFindings as Qt } from "./migrations/namespaceCharset.js";
33
+ import { checkSchemaOwner as $t, foreignOwnerMessage as en, transferSchemaOwner as tn } from "./migrations/schemaOwner.js";
34
+ import { isRawSqlFragment as nn, sql as rn } from "./rawSql.js";
35
+ import { readMigrationSnapshotCandidates as an, restoreMigrationSnapshots as on } from "./migrations/restoreSnapshots.js";
36
+ import { readSqliteTableSchema as sn } from "./migrations/sqliteTableSchema.js";
37
+ import { forEachSqliteDecimalSourcePage as cn, readSqliteDecimalSource as ln } from "./migrations/sqliteDecimalSource.js";
38
+ import { sqliteDecimalDecisionIdentity as un } from "./migrations/sqliteDecimalReview.js";
39
+ import { prepareSqliteDecimalStage as dn } from "./migrations/sqliteDecimalStage.js";
40
+ import { cleanupSqliteDecimalPublication as fn, publishSqliteDecimalStage as pn, rollbackSqliteDecimalPublication as mn } from "./migrations/sqliteDecimalPublication.js";
41
+ import { SqlMutationError as hn, executeSqlMutations as gn, prepareSqlMutation as _n, prepareSqlMutationGroup as vn } from "./sqlMutation.js";
42
+ export { E as DEFAULT_CDC_CHANNEL, ge as DEPLOY_LEDGER_TABLE, e as FILE_MIGRATION_PATTERN, Ot as FRAMEWORK_MIGRATION_EDITS, kt as FileMigrationLedgerError, t as IrreversibleMigrationError, C as MIGRATION_ATOMICITY, h as MIGRATION_NEEDS_TWO_CONNECTIONS, n as MIGRATION_PHASES, re as MYSQL_CHARSETS, r as MigrationExpectationFailed, At as MigrationIdTooLongError, i as MigrationNeedsSqlClient, a as MigrationSkipped, D as REACTIVE_TRIGGER_PREFIX, o as RewriteUnstableError, Se as SCHEMA_OWNER_TABLE, ie as STORE_CHARSET_REMEDY, hn as SqlMutationError, s as TransactionBrokenByBodyError, g as VOLTRO_MIGRATION_LOCK_KEY, _e as _voltroDeploysTable, jt as acceptedBodyHashes, _ as acquireMigrationLock, Me as addColumnDdl, je as appliedAtValue, Mt as appliedFileMigrationIds, Nt as appliedFileMigrations, Ne as appliedLedgerOperations, A as applyNamespacedSchema, Pe as applyPlan, j as applySchema, ot as applyUndeclaredCharsetWork, Wt as assessRollingDeployGate, Jt as branchRehearsalExitCode, ae as charsetColumnsOf, $t as checkSchemaOwner, Ce as chunkTables, Gt as classifyRollingDeploySafety, fn as cleanupSqliteDecimalPublication, Fe as clearResumeLedger, ve as closeDeploy, Ie as columnLevelChecksMysql, oe as columnTakesCharset, st as convergeUndeclaredCharset, Kt as createdTablesOf, de as declaredSnapshot, M as defaultArrayClause, N as defaultClause, P as defaultJsonClause, mt as describeOutcome, wt as describeProbe, se as describeStoreCharsetFinding, ct as describeUndeclaredCharsetWork, it as describesSchema, ht as destructiveScope, pe as detectReactiveTriggerDrift, w as dialectOf, Le as emitAddIndexMysql, Re as emitConvertCharsetMysql, ze as emitCreateTableMssql, Be as emitCreateTableMysql, Ve as emitCreateTablePg, He as emitCreateTableSqlite, Ue as emitDropColumnDdl, We as emitDropColumnDdlMysql, F as emitFrameworkBootstrapSql, I as emitNamespaceProvisionDdl, L as emitNamespacedSchemaSql, R as emitSchemaSql, Oe as engineFromVersion, Ge as ensureDeployLedgerTable, z as ensureFullTextIndexes, Ke as ensureLedgerTable, qe as ensurePlanLedgerTable, Je as ensurePluginMigrationsLedgerTable, Ye as ensureReplaceMarkerTable, Xe as ensureSchemaOwnerTable, B as enumRenameBlocks, V as enumTypeBlocks, gn as executeSqlMutations, H as extensionBlocks, ye as failDeploy, xt as failedExpectations, gt as fetchLastFingerprint, Pt as fileMigrationStatus, te as fingerprintSchema, v as fnv1a64, cn as forEachSqliteDecimalSourcePage, en as foreignOwnerMessage, Yt as formatBranchRehearsal, me as formatReactiveTriggerDrift, U as fullTextIndexSql, Ze as hasInterruptedMigration, _t as ignoreTablesFromEnv, we as introspectSchema, c as irreversible, l as irreversibleReason, Ae as isAlreadySatisfied, u as isFileMigration, at as isFileMigrationRow, ce as isMysqlCharset, nn as isRawSqlFragment, W as isReRunSafeDdl, lt as isUndeclaredCharsetTable, ut as isUndeclaredCharsetWorkEmpty, De as limitClause, St as makeFileMigrationContext, Te as mapPgType, Ct as materialiseSnapshot, d as migration, T as migrationAtomicityFor, Ft as migrationBodyHash, y as migrationLockKeyForSchema, b as migrationLockNameForSchema, Qe as mysqlIndexPrefixFor, O as notifyFunctionName, G as numericIdSql, be as openDeploy, Ee as parseEnumCheck, It as pendingFileMigrationIds, Lt as pendingFileMigrationSummary, Tt as permanentSkips, he as planMigrations, f as plannableLiveTables, Et as plannedCreations, _n as prepareSqlMutation, vn as prepareSqlMutationGroup, dn as prepareSqliteDecimalStage, Ht as previewMigrationSquash, K as provisionTenantNamespace, pn as publishSqliteDecimalStage, k as reactiveTriggerName, q as reactiveTriggerRepairSql, an as readMigrationSnapshotCandidates, ln as readSqliteDecimalSource, sn as readSqliteTableSchema, dt as readUndeclaredCharsetColumns, vt as recordUpToDate, p as registerSqlPoolCapacity, Q as registerSqliteMigrationBatch, Xt as rehearseMigrationOnBranch, Zt as rehearsedOperation, $e as renderColumnMysql, et as renderColumnPg, x as resolveMigrationLockSchema, ke as resolveMysqlEngine, on as restoreMigrationSnapshots, Rt as rollbackFileBasedMigration, mn as rollbackSqliteDecimalPublication, qt as rollingDeployUnsafeOps, zt as runFileBasedMigrations, J as runFrameworkBootstrap, Y as runMigrate, tt as runMigrationOp, yt as runPlannedMigrations, nt as runSchemaOp, $ as runSqliteMigrationBatch, ne as shortFingerprint, fe as snapshotColumn, X as splitStatements, rn as sql, m as sqlPoolCapacity, Z as sqlType, un as sqliteDecimalDecisionIdentity, ee as sqliteMigrationBatchStatements, Ut as squashMigrationPlans, le as stampDeclaredCharset, ue as storeCharsetFindings, Qt as tenantNamespaceCharsetFindings, tn as transferSchemaOwner, bt as unblockLossy, ft as undeclaredCharsetStatements, pt as undeclaredCharsetWork, xe as unfinishedDeploys, Bt as unrecordableMigrationIds, rt as verifySqliteDecimalStorage, Vt as walkMigrationFiles, S as withMigrationLock, Dt as withSchemaProbeRecorder };
@@ -11,21 +11,24 @@ import { coercePredicateValue as u } from "./predicateCoercion.js";
11
11
  import { mssqlDecimalDistinct as d } from "./mssqlDecimalDistinct.js";
12
12
  import { compileSqliteDecimalSourcePredicate as f } from "./sqliteDecimalSource.js";
13
13
  import { compileSqliteDecimalQuery as p } from "./sqliteDecimalQuery.js";
14
- //#region src/sqlCompiler.ts
14
+ // src/sqlCompiler.ts
15
15
  var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
16
16
  let { strings: n, values: r } = e, i = t.unsafe(n[0] ?? "");
17
17
  for (let e = 0; e < r.length; e++) i = t`${i}${r[e]}${t.unsafe(n[e + 1] ?? "")}`;
18
18
  return t`${i}`;
19
- }, g = (e) => e.replace(/[\\%_]/g, (e) => `\\${e}`), _ = (i, a, o = null, l, d = /* @__PURE__ */ new Set()) => {
20
- if ("not" in i) return a`NOT (${_(i.not, a, o, l, d)})`;
21
- if ("and" in i) return i.and.length === 0 ? a`TRUE` : a.and(i.and.map((e) => _(e, a, o, l, d)));
22
- if ("or" in i) return i.or.length === 0 ? a`FALSE` : a.or(i.or.map((e) => _(e, a, o, l, d)));
19
+ }, g = (e) => e.replace(/[\\%_]/g, (e) => `\\${e}`), _ = (e, t) => t.onDialectOrElse({
20
+ mssql: () => g(e).replace(/\[/g, "\\["),
21
+ orElse: () => g(e)
22
+ }), v = (i, a, o = null, l, d = /* @__PURE__ */ new Set()) => {
23
+ if ("not" in i) return a`NOT (${v(i.not, a, o, l, d)})`;
24
+ if ("and" in i) return i.and.length === 0 ? a`TRUE` : a.and(i.and.map((e) => v(e, a, o, l, d)));
25
+ if ("or" in i) return i.or.length === 0 ? a`FALSE` : a.or(i.or.map((e) => v(e, a, o, l, d)));
23
26
  if (i.op === "subquery-in" || i.op === "subquery-not-in") {
24
- let e = i, t = M(e.subquery, a, o, void 0, d);
27
+ let e = i, t = F(e.subquery, a, o, void 0, d);
25
28
  return e.op === "subquery-in" ? a`${a(e.column)} IN (${t})` : a`${a(e.column)} NOT IN (${t})`;
26
29
  }
27
30
  if (i.op === "exists" || i.op === "not-exists") {
28
- let e = i, t = M(e.subquery, a, o, void 0, d);
31
+ let e = i, t = F(e.subquery, a, o, void 0, d);
29
32
  return e.op === "exists" ? a`EXISTS (${t})` : a`NOT EXISTS (${t})`;
30
33
  }
31
34
  let f = i;
@@ -41,7 +44,7 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
41
44
  case "lte": return a`${r} <= ${t}`;
42
45
  }
43
46
  }
44
- let p = a(f.column), m = f.path, h = m !== void 0 && m.length > 0, v = () => a.onDialectOrElse({
47
+ let p = a(f.column), m = f.path, h = m !== void 0 && m.length > 0, g = () => a.onDialectOrElse({
45
48
  mysql: () => a.unsafe(c(f.column, m, "mysql")),
46
49
  mssql: () => a.unsafe(c(f.column, m, "mssql")),
47
50
  sqlite: () => a.unsafe(c(f.column, m, "sqlite")),
@@ -51,7 +54,7 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
51
54
  mssql: () => a.unsafe(c(f.column, m, "mssql", { numeric: !0 })),
52
55
  sqlite: () => a.unsafe(c(f.column, m, "sqlite", { numeric: !0 })),
53
56
  orElse: () => a.unsafe(c(f.column, m, "postgres", { numeric: !0 }))
54
- }), b = h ? v() : p, x = h ? y() : p, S = (e) => h && e != null ? String(e) : e, C = (e) => h ? Number(e) : e, w = h || l === void 0 ? void 0 : r(l)?.fields?.[f.column]?.type, T = (e) => {
57
+ }), b = h ? g() : p, x = h ? y() : p, S = (e) => h && e != null ? String(e) : e, C = (e) => h ? Number(e) : e, w = h || l === void 0 ? void 0 : r(l)?.fields?.[f.column]?.type, T = (e) => {
55
58
  let t = u(w, e);
56
59
  return t instanceof Date ? a.onDialectOrElse({
57
60
  sqlite: () => s(t),
@@ -59,8 +62,8 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
59
62
  }) : t;
60
63
  };
61
64
  switch (f.op) {
62
- case "eq": return a`${b} = ${S(T(f.value))}`;
63
- case "neq": return a`${b} <> ${S(T(f.value))}`;
65
+ case "eq": return f.value === null ? a`${b} IS NULL` : a`${b} = ${S(T(f.value))}`;
66
+ case "neq": return f.value === null ? a`${b} IS NOT NULL` : a`${b} <> ${S(T(f.value))}`;
64
67
  case "gt": return a`${x} > ${C(T(f.value))}`;
65
68
  case "gte": return a`${x} >= ${C(T(f.value))}`;
66
69
  case "lt": return a`${x} < ${C(T(f.value))}`;
@@ -74,16 +77,16 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
74
77
  return e.length === 0 ? a`TRUE` : a`${b} NOT IN ${a.in(h ? e.map((e) => S(e)) : e.map(T))}`;
75
78
  }
76
79
  case "contains": {
77
- let e = `%${g(typeof f.value == "string" ? f.value : String(f.value ?? ""))}%`;
80
+ let e = `%${_(typeof f.value == "string" ? f.value : String(f.value ?? ""), a)}%`;
78
81
  return a.onDialectOrElse({
79
82
  mysql: () => a`LOWER(${b}) LIKE LOWER(${e})`,
80
- mssql: () => a`LOWER(${b}) LIKE LOWER(${e})`,
83
+ mssql: () => a`LOWER(${b}) LIKE LOWER(${e}) ESCAPE '\\'`,
81
84
  sqlite: () => a`LOWER(${b}) LIKE LOWER(${e})`,
82
85
  orElse: () => a`${b} ILIKE ${e} ESCAPE '\\'`
83
86
  });
84
87
  }
85
88
  case "startsWith": {
86
- let e = `${g(typeof f.value == "string" ? f.value : String(f.value ?? ""))}%`;
89
+ let e = `${_(typeof f.value == "string" ? f.value : String(f.value ?? ""), a)}%`;
87
90
  return a.onDialectOrElse({
88
91
  mysql: () => a`${b} LIKE ${e}`,
89
92
  orElse: () => a`${b} LIKE ${e} ESCAPE '\\'`
@@ -131,79 +134,92 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
131
134
  });
132
135
  }
133
136
  }
134
- }, v = (e, t) => {
137
+ }, y = (e, t) => {
135
138
  let n = [];
136
139
  return e.partitionBy && e.partitionBy.length > 0 && n.push(t`PARTITION BY ${t.join(", ", !1)(e.partitionBy.map((e) => t`${t(e)}`))}`), e.orderBy && e.orderBy.length > 0 && n.push(t`ORDER BY ${t.join(", ", !1)(e.orderBy.map((e) => e.direction === "desc" ? t`${t(e.column)} DESC` : t`${t(e.column)} ASC`))}`), n.length === 0 ? t`` : n.length === 1 ? n[0] : n.reduce((e, n, r) => r === 0 ? n : t`${e} ${n}`);
137
- }, y = (e, t) => t.join(", ", !1)(e.map((e) => {
140
+ }, b = /* @__PURE__ */ new Set([
141
+ "sum",
142
+ "min",
143
+ "max",
144
+ "window-sum-over",
145
+ "window-lag",
146
+ "window-lead"
147
+ ]), x = (e, t, n = () => void 0) => t.join(", ", !1)(e.map((e) => {
148
+ let r = S(e, t);
149
+ return t`${e.column !== void 0 && b.has(e.op) && n(e.column)?.type === "decimal" ? t.onDialectOrElse({
150
+ mssql: () => t`CONVERT(varchar(80), ${r})`,
151
+ orElse: () => r
152
+ }) : r} AS ${t(e.alias)}`;
153
+ })), S = (e, t) => {
138
154
  let r = e.column === void 0 ? t.unsafe("*") : t`${t(e.column)}`;
139
155
  if (e.op.startsWith("window-")) {
140
- let i = v(e.window ?? {}, t);
156
+ let i = y(e.window ?? {}, t);
141
157
  switch (e.op) {
142
- case "window-row-number": return t`ROW_NUMBER() OVER (${i}) AS ${t(e.alias)}`;
143
- case "window-rank": return t`RANK() OVER (${i}) AS ${t(e.alias)}`;
144
- case "window-dense-rank": return t`DENSE_RANK() OVER (${i}) AS ${t(e.alias)}`;
145
- case "window-lag": return t`LAG(${r}, ${t.unsafe(String(e.offset ?? 1))}) OVER (${i}) AS ${t(e.alias)}`;
146
- case "window-lead": return t`LEAD(${r}, ${t.unsafe(String(e.offset ?? 1))}) OVER (${i}) AS ${t(e.alias)}`;
147
- case "window-sum-over": return t`SUM(${r}) OVER (${i}) AS ${t(e.alias)}`;
148
- case "window-avg-over": return t`AVG(${r}) OVER (${i}) AS ${t(e.alias)}`;
158
+ case "window-row-number": return t`ROW_NUMBER() OVER (${i})`;
159
+ case "window-rank": return t`RANK() OVER (${i})`;
160
+ case "window-dense-rank": return t`DENSE_RANK() OVER (${i})`;
161
+ case "window-lag": return t`LAG(${r}, ${t.unsafe(String(e.offset ?? 1))}) OVER (${i})`;
162
+ case "window-lead": return t`LEAD(${r}, ${t.unsafe(String(e.offset ?? 1))}) OVER (${i})`;
163
+ case "window-sum-over": return t`SUM(${r}) OVER (${i})`;
164
+ case "window-avg-over": return t`AVG(${r}) OVER (${i})`;
149
165
  default: throw n(`compileAggregateProjection: unknown window op '${e.op}'`);
150
166
  }
151
167
  }
152
168
  switch (e.op) {
153
- case "count": return t`COUNT(${r}) AS ${t(e.alias)}`;
154
- case "count-distinct": return t`COUNT(DISTINCT ${r}) AS ${t(e.alias)}`;
155
- case "sum": return t`SUM(${r}) AS ${t(e.alias)}`;
156
- case "avg": return t`AVG(${r}) AS ${t(e.alias)}`;
157
- case "min": return t`MIN(${r}) AS ${t(e.alias)}`;
158
- case "max": return t`MAX(${r}) AS ${t(e.alias)}`;
169
+ case "count": return t`COUNT(${r})`;
170
+ case "count-distinct": return t`COUNT(DISTINCT ${r})`;
171
+ case "sum": return t`SUM(${r})`;
172
+ case "avg": return t`AVG(${r})`;
173
+ case "min": return t`MIN(${r})`;
174
+ case "max": return t`MAX(${r})`;
159
175
  case "column":
160
176
  if (e.column === void 0) throw n(`compileAggregateProjection: 'column' projection requires a column name (alias '${e.alias}')`);
161
- return t`${t(e.column)} AS ${t(e.alias)}`;
177
+ return t`${t(e.column)}`;
162
178
  default: throw n(`compileAggregateProjection: unknown op '${e.op}'`);
163
179
  }
164
- })), b = (e) => `[${e.join(",")}]`, x = (e, t) => {
180
+ }, C = (e) => `[${e.join(",")}]`, w = (e, t) => {
165
181
  if (e.queryVector === void 0) return null;
166
- let n = t(e.column), r = b(e.queryVector), i = e.distance === "cosine" ? "<=>" : e.distance === "l2" ? "<->" : "<#>", a = e.distance === "cosine" ? "VEC_DISTANCE_COSINE" : "VEC_DISTANCE_EUCLIDEAN";
182
+ let n = t(e.column), r = C(e.queryVector), i = e.distance === "cosine" ? "<=>" : e.distance === "l2" ? "<->" : "<#>", a = e.distance === "cosine" ? "VEC_DISTANCE_COSINE" : "VEC_DISTANCE_EUCLIDEAN";
167
183
  return t.onDialectOrElse({
168
184
  mysql: () => t`${t.unsafe(a)}(${n}, ${r})`,
169
185
  mssql: () => t`NULL`,
170
186
  sqlite: () => t`NULL`,
171
187
  orElse: () => t`${n} ${t.unsafe(i)} ${r}::vector`
172
188
  });
173
- }, S = (e, t) => {
189
+ }, T = (e, t) => {
174
190
  let n = t.unsafe(e.useGeography ? "::geography" : "::geometry");
175
191
  return t`ST_Distance(${t(e.column)}${n}, ${e.geom}${n})`;
176
- }, C = (e, t) => t`${t(e.column)} <-> ${e.geom}::geometry`, w = (e, t) => t`${t(`${e.indexName}_tsv`)}`, T = (e, t) => `${t}_${e.indexName}_fts`, E = (e) => e.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((e) => e !== ""), D = (e) => {
192
+ }, E = (e, t) => t`${t(e.column)} <-> ${e.geom}::geometry`, D = (e, t) => t`${t(`${e.indexName}_tsv`)}`, O = (e, t) => `${t}_${e.indexName}_fts`, k = (e) => e.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((e) => e !== ""), A = (e) => {
177
193
  if (e.prefix !== !0) return;
178
- let t = E(e.query);
194
+ let t = k(e.query);
179
195
  if (t.length !== 0) return {
180
196
  pg: t.map((e) => `${e}:*`).join(" & "),
181
197
  mysql: t.map((e) => `+${e}*`).join(" "),
182
198
  sqlite: t.map((e) => `"${e}"*`).join(" ")
183
199
  };
184
- }, O = (e, t, n) => {
185
- let r = n.join(", ", !1)(e.columns.map((e) => n`${n(e)}`)), i = `%${g(e.query)}%`, a = D(e), o = () => n.or(e.columns.map((e) => n`LOWER(${n(e)}) LIKE LOWER(${i}) ESCAPE '\\'`));
200
+ }, j = (e, t, n) => {
201
+ let r = n.join(", ", !1)(e.columns.map((e) => n`${n(e)}`)), i = `%${_(e.query, n)}%`, a = A(e), o = () => n.or(e.columns.map((e) => n`LOWER(${n(e)}) LIKE LOWER(${i}) ESCAPE '\\'`));
186
202
  return e.fallback === "like" ? o() : n.onDialectOrElse({
187
203
  mysql: () => a === void 0 ? n`MATCH(${r}) AGAINST(${e.query} IN NATURAL LANGUAGE MODE)` : n`MATCH(${r}) AGAINST(${a.mysql} IN BOOLEAN MODE)`,
188
204
  sqlite: () => {
189
- let r = n(T(e, t));
205
+ let r = n(O(e, t));
190
206
  return n`${n("id")} IN (SELECT ${n("row_id")} FROM ${r} WHERE ${r} MATCH ${a?.sqlite ?? e.query})`;
191
207
  },
192
208
  mssql: o,
193
- orElse: () => a === void 0 ? n`${w(e, n)} @@ plainto_tsquery(${e.config ?? "english"}, ${e.query})` : n`${w(e, n)} @@ to_tsquery(${e.config ?? "english"}, ${a.pg})`
209
+ orElse: () => a === void 0 ? n`${D(e, n)} @@ plainto_tsquery(${e.config ?? "english"}, ${e.query})` : n`${D(e, n)} @@ to_tsquery(${e.config ?? "english"}, ${a.pg})`
194
210
  });
195
- }, k = (e, t, n) => {
196
- let r = `%${g(e.query)}%`, i = D(e), a = () => e.columns.map((e) => n`(CASE WHEN LOWER(${n(e)}) LIKE LOWER(${r}) ESCAPE '\\' THEN 1 ELSE 0 END)`).reduce((e, t, r) => r === 0 ? t : n`${e} + ${t}`);
211
+ }, M = (e, t, n) => {
212
+ let r = `%${_(e.query, n)}%`, i = A(e), a = () => e.columns.map((e) => n`(CASE WHEN LOWER(${n(e)}) LIKE LOWER(${r}) ESCAPE '\\' THEN 1 ELSE 0 END)`).reduce((e, t, r) => r === 0 ? t : n`${e} + ${t}`);
197
213
  return e.fallback === "like" ? a() : n.onDialectOrElse({
198
214
  mysql: () => i === void 0 ? n`MATCH(${n.join(", ", !1)(e.columns.map((e) => n`${n(e)}`))}) AGAINST(${e.query} IN NATURAL LANGUAGE MODE)` : n`MATCH(${n.join(", ", !1)(e.columns.map((e) => n`${n(e)}`))}) AGAINST(${i.mysql} IN BOOLEAN MODE)`,
199
215
  sqlite: () => {
200
- let r = n(T(e, t));
216
+ let r = n(O(e, t));
201
217
  return n`COALESCE((SELECT -bm25(${r}) FROM ${r} WHERE ${r} MATCH ${i?.sqlite ?? e.query} AND ${r}.${n("row_id")} = ${n("id")}), 0)`;
202
218
  },
203
219
  mssql: a,
204
- orElse: () => i === void 0 ? n`ts_rank(${w(e, n)}, plainto_tsquery(${e.config ?? "english"}, ${e.query}))` : n`ts_rank(${w(e, n)}, to_tsquery(${e.config ?? "english"}, ${i.pg}))`
220
+ orElse: () => i === void 0 ? n`ts_rank(${D(e, n)}, plainto_tsquery(${e.config ?? "english"}, ${e.query}))` : n`ts_rank(${D(e, n)}, to_tsquery(${e.config ?? "english"}, ${i.pg}))`
205
221
  });
206
- }, A = (e, t, n, r, i = !1) => {
222
+ }, N = (e, t, n, r, i = !1) => {
207
223
  let a = (e) => t(r && !e.includes(".") ? `${r}.${e}` : e), o = () => n?.length ? t.join(", ", !1)(n.map((e) => t`${a(e)}`)) : r ? t`${t(r)}.*` : t`*`, s = i && t.onDialectOrElse({
208
224
  mssql: () => !0,
209
225
  orElse: () => !1
@@ -213,23 +229,23 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
213
229
  mssql: () => s && Object.values(e).some((e) => e.type === "decimal") ? t.join(", ", !1)((n?.length ? n : Object.keys(e)).map((n) => e[n]?.type === "decimal" ? t`CONVERT(varchar(80), ${a(n)}) AS ${t(n)}` : t`${a(n)}`)) : o(),
214
230
  orElse: o
215
231
  });
216
- }, j = (e, t, n) => A(r(e)?.fields, t, n), M = (e, t, o = null, s, c = /* @__PURE__ */ new Set(), u = !1) => {
217
- let d = a(e), f = /* @__PURE__ */ new Set([...c, ...(e.ctes ?? []).map((e) => m(e.name))]), p = (e) => f.has(m(e)) ? e : l(o, e), h = (e.ctes ?? []).map((e) => t`${t(e.name)} AS (${M(e.descriptor, t, o, e.recursive && t.onDialectOrElse({
232
+ }, P = (e, t, n) => N(r(e)?.fields, t, n), F = (e, t, o = null, s, c = /* @__PURE__ */ new Set(), u = !1) => {
233
+ let d = a(e), f = /* @__PURE__ */ new Set([...c, ...(e.ctes ?? []).map((e) => m(e.name))]), p = (e) => f.has(m(e)) ? e : l(o, e), h = (e.ctes ?? []).map((e) => t`${t(e.name)} AS (${F(e.descriptor, t, o, e.recursive && t.onDialectOrElse({
218
234
  sqlite: () => !0,
219
235
  orElse: () => !1
220
- }) ? e.name : void 0, f)})`), g = (e.ctes ?? []).some((e) => e.recursive === !0), v = h.length > 0 ? t`WITH ${t.unsafe(g ? "RECURSIVE " : "")}${t.join(", ", !1)(h)} ` : t``;
236
+ }) ? e.name : void 0, f)})`), g = (e.ctes ?? []).some((e) => e.recursive === !0), _ = h.length > 0 ? t`WITH ${t.unsafe(g ? "RECURSIVE " : "")}${t.join(", ", !1)(h)} ` : t``;
221
237
  if (e.setOp && e.setOp.queries.length >= 2) {
222
238
  let r = e.setOp.kind === "union" ? "UNION" : e.setOp.kind === "union-all" ? "UNION ALL" : e.setOp.kind === "intersect" ? "INTERSECT" : "EXCEPT", a = t.onDialectOrElse({
223
239
  sqlite: () => !0,
224
240
  orElse: () => !1
225
241
  }), c = e.setOp.queries.map((e) => {
226
- if (!a) return t`(${M(e, t, o, void 0, f)})`;
242
+ if (!a) return t`(${F(e, t, o, void 0, f)})`;
227
243
  if (s !== void 0) {
228
- if (!(i(e).length > 0 || e.take !== void 0 || e.skip !== void 0 || e.setOp !== void 0 || (e.ctes?.length ?? 0) > 0)) return M(e, t, o, void 0, f);
244
+ if (!(i(e).length > 0 || e.take !== void 0 || e.skip !== void 0 || e.setOp !== void 0 || (e.ctes?.length ?? 0) > 0)) return F(e, t, o, void 0, f);
229
245
  let r = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), a = (e) => r(e) === r(s);
230
246
  if (a(e.table) || e.joins?.some((e) => a(e.table))) throw n("Recursive SQLite terms cannot use branch-local ordering, pagination or nested compounds; apply ordering and pagination to the recursive compound or its outer query");
231
247
  }
232
- return t`SELECT * FROM (${M(e, t, o, void 0, f)})`;
248
+ return t`SELECT * FROM (${F(e, t, o, void 0, f)})`;
233
249
  }).reduce((e, n, i) => i === 0 ? n : t`${e} ${t.unsafe(r)} ${n}`), l = [];
234
250
  if (i(e).length > 0 && l.push(t` ORDER BY ${t.join(", ", !1)(i(e).map((e) => e.direction === "desc" ? t`${t(e.column)} DESC` : t`${t(e.column)} ASC`))}`), e.take !== void 0) {
235
251
  if (!Number.isInteger(e.take) || e.take < 0) throw n(`compileSelect: invalid take ${e.take}`);
@@ -239,9 +255,9 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
239
255
  if (a && e.take === void 0 && l.push(t` LIMIT -1`), !Number.isInteger(e.skip) || e.skip < 0) throw n(`compileSelect: invalid skip ${e.skip}`);
240
256
  l.push(t` OFFSET ${t.unsafe(String(e.skip))}`);
241
257
  }
242
- return t`${v}${c}${l.reduce((e, n) => t`${e}${n}`, t``)}`;
258
+ return t`${_}${c}${l.reduce((e, n) => t`${e}${n}`, t``)}`;
243
259
  }
244
- let b = e.annClause === void 0 ? null : x(e.annClause, t);
260
+ let y = e.annClause === void 0 ? null : w(e.annClause, t);
245
261
  e.spatialClause !== void 0 && t.onDialectOrElse({
246
262
  mysql: () => {
247
263
  throw n("@voltro/plugin-postgis: spatial distance / KNN ordering is postgres-only");
@@ -254,7 +270,7 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
254
270
  },
255
271
  orElse: () => t``
256
272
  });
257
- let w = e.spatialClause?.projectAs === void 0 ? null : S(e.spatialClause, t), T = e.aggregations && e.aggregations.length > 0 ? y(e.aggregations, t) : e.joinedProjection && e.joinedProjection.length > 0 ? t.join(", ", !1)(e.joinedProjection.map((e) => {
273
+ let b = e.spatialClause?.projectAs === void 0 ? null : T(e.spatialClause, t), S = e.aggregations && e.aggregations.length > 0 ? x(e.aggregations, t, d) : e.joinedProjection && e.joinedProjection.length > 0 ? t.join(", ", !1)(e.joinedProjection.map((e) => {
258
274
  let n = t`${t(e.source)}`, r = d(e.source);
259
275
  return t`${u && r?.type === "decimal" ? t.onDialectOrElse({
260
276
  mssql: () => t`CONVERT(varchar(80), ${n})`,
@@ -263,30 +279,31 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
263
279
  sqlite: () => t`CAST(${n} AS TEXT)`,
264
280
  orElse: () => n
265
281
  }) : n} AS ${t(e.outputKey)}`;
266
- })) : A((e.sourceTable?.tableName === e.table ? e.sourceTable : r(e.table))?.fields, t, e.projection, (e.joins?.length ?? 0) > 0 ? e.alias ?? e.table : void 0, u), E = (e.aggregations && e.aggregations.length > 0) === !0, D = b !== null && !E ? t`${T}, ${b} AS ${t("distance")}` : T, j = e.fullTextSearch, N = j?.rank !== void 0 && !E ? k(j, e.table, t) : null, P = N !== null && j?.rank !== void 0 ? t`${D}, ${N} AS ${t(j.rank.alias)}` : D, F = w !== null && !E && e.spatialClause?.projectAs !== void 0 ? t`${P}, ${w} AS ${t(e.spatialClause.projectAs)}` : P, I = e.distinctOn && e.distinctOn.length > 0 ? t.onDialectOrElse({
282
+ })) : N((e.sourceTable?.tableName === e.table ? e.sourceTable : r(e.table))?.fields, t, e.projection, (e.joins?.length ?? 0) > 0 ? e.alias ?? e.table : void 0, u), C = (e.aggregations && e.aggregations.length > 0) === !0, D = y !== null && !C ? t`${S}, ${y} AS ${t("distance")}` : S, O = e.fullTextSearch, k = O?.rank !== void 0 && !C ? M(O, e.table, t) : null, A = k !== null && O?.rank !== void 0 ? t`${D}, ${k} AS ${t(O.rank.alias)}` : D, P = b !== null && !C && e.spatialClause?.projectAs !== void 0 ? t`${A}, ${b} AS ${t(e.spatialClause.projectAs)}` : A, I = e.distinctOn && e.distinctOn.length > 0 ? t.onDialectOrElse({
267
283
  orElse: () => t`DISTINCT ON (${t.join(", ", !1)(e.distinctOn.map((e) => t`${t(e)}`))}) `,
268
284
  mysql: () => t`DISTINCT `,
269
285
  mssql: () => t`DISTINCT `,
270
286
  sqlite: () => t`DISTINCT `
271
- }) : e.distinct ? t`DISTINCT ` : t``, L = e.lock === "update", R = L ? t.onDialectOrElse({
272
- mssql: () => t` WITH (UPDLOCK, ROWLOCK)`,
287
+ }) : e.distinct ? t`DISTINCT ` : t``, L = e.lock !== void 0, R = L ? t.onDialectOrElse({
288
+ mssql: () => e.lock === "share" ? t` WITH (HOLDLOCK, ROWLOCK)` : t` WITH (UPDLOCK, ROWLOCK)`,
273
289
  orElse: () => t``
274
290
  }) : t``, z = L ? t.onDialectOrElse({
275
291
  mssql: () => t``,
276
292
  sqlite: () => t``,
277
- orElse: () => t` FOR UPDATE`
293
+ mysql: () => e.lock === "share" ? t` LOCK IN SHARE MODE` : t` FOR UPDATE`,
294
+ orElse: () => e.lock === "share" ? t` FOR SHARE` : t` FOR UPDATE`
278
295
  }) : t``, B = e.alias === void 0 ? t`${t(p(e.table))}${R}` : t`${t(p(e.table))} AS ${t(e.alias)}${R}`, V = (e.joins ?? []).map((e) => {
279
296
  let n = e.kind === "inner" ? "INNER" : "LEFT";
280
- return t` ${t.unsafe(n)} JOIN ${t(p(e.table))} AS ${t(e.alias)} ON ${_(e.on, t, o, void 0, f)}`;
281
- }), H = V.length > 0 ? V.reduce((e, n) => t`${e}${n}`, B) : B, U = j === void 0 ? null : O(j, e.table, t), W = [e.predicate ? _(e.predicate, t, o, e.table, f) : null, U].filter((e) => e !== null), G = W.length > 0 ? t` WHERE ${t.and(W)}` : t``, K = e.groupBy && e.groupBy.length > 0 ? t` GROUP BY ${t.join(", ", !1)(e.groupBy.map((e) => t`${t(e)}`))}` : t``, q = e.having ? t` HAVING ${_(e.having, t, o, e.table, f)}` : t``, J = e.skip !== void 0, Y = [];
282
- b !== null && Y.push(t`${b} ASC`), e.spatialClause?.order !== void 0 && Y.push(e.spatialClause.order === "desc" ? t`${C(e.spatialClause, t)} DESC` : t`${C(e.spatialClause, t)} ASC`), N !== null && j?.rank?.order === !0 && Y.push(t`${N} DESC`);
297
+ return t` ${t.unsafe(n)} JOIN ${t(p(e.table))} AS ${t(e.alias)} ON ${v(e.on, t, o, void 0, f)}`;
298
+ }), H = V.length > 0 ? V.reduce((e, n) => t`${e}${n}`, B) : B, U = O === void 0 ? null : j(O, e.table, t), W = [e.predicate ? v(e.predicate, t, o, e.table, f) : null, U].filter((e) => e !== null), G = W.length > 0 ? t` WHERE ${t.and(W)}` : t``, K = e.groupBy && e.groupBy.length > 0 ? t` GROUP BY ${t.join(", ", !1)(e.groupBy.map((e) => t`${t(e)}`))}` : t``, q = e.having ? t` HAVING ${v(e.having, t, o, e.table, f)}` : t``, J = e.skip !== void 0, Y = [];
299
+ y !== null && Y.push(t`${y} ASC`), e.spatialClause?.order !== void 0 && Y.push(e.spatialClause.order === "desc" ? t`${E(e.spatialClause, t)} DESC` : t`${E(e.spatialClause, t)} ASC`), k !== null && O?.rank?.order === !0 && Y.push(t`${k} DESC`);
283
300
  let X = i(e), Z = X.length >= 8 && (e.joinedProjection?.length ?? 0) >= 8 ? /* @__PURE__ */ new Map() : void 0;
284
301
  if (Z) for (let t of e.joinedProjection ?? []) Z.has(t.outputKey) || Z.set(t.outputKey, t.source);
285
302
  for (let n of X) {
286
- let r = (Z === void 0 ? e.joinedProjection?.find((e) => e.outputKey === n.column)?.source : Z.get(n.column)) ?? n.column, i = u && !E && d(r)?.type === "decimal" ? t.onDialectOrElse({
303
+ let r = (Z === void 0 ? e.joinedProjection?.find((e) => e.outputKey === n.column)?.source : Z.get(n.column)) ?? n.column, i = u && !C && d(r)?.type === "decimal" ? t.onDialectOrElse({
287
304
  mssql: () => t`${t(r.includes(".") ? r : `${e.alias ?? e.table}.${r}`)}`,
288
305
  orElse: () => t`${t(n.column)}`
289
- }) : !E && d(r)?.type === "bigint" ? t.onDialectOrElse({
306
+ }) : !C && d(r)?.type === "bigint" ? t.onDialectOrElse({
290
307
  sqlite: () => t`${t(r.includes(".") ? r : `${e.alias ?? e.table}.${r}`)}`,
291
308
  orElse: () => t`${t(n.column)}`
292
309
  }) : t`${t(n.column)}`;
@@ -302,7 +319,7 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
302
319
  return t.onDialectOrElse({
303
320
  mssql: () => {
304
321
  let n = e.take !== void 0 && !J ? t`TOP ${$(e.take)} ` : t``, r = J ? t` OFFSET ${$(e.skip)} ROWS FETCH NEXT ${$(e.take ?? 2 ** 53 - 1)} ROWS ONLY` : t``;
305
- return t`${v}SELECT ${n}${I}${F} FROM ${H}${G}${K}${q}${Q}${r}`;
322
+ return t`${_}SELECT ${n}${I}${P} FROM ${H}${G}${K}${q}${Q}${r}`;
306
323
  },
307
324
  orElse: () => {
308
325
  let n = e.take === void 0 ? J ? t.onDialectOrElse({
@@ -310,16 +327,16 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
310
327
  mysql: () => t` LIMIT 18446744073709551615`,
311
328
  orElse: () => t``
312
329
  }) : t`` : t` LIMIT ${$(e.take)}`, r = J ? t` OFFSET ${$(e.skip)}` : t``;
313
- return t`${v}SELECT ${I}${F} FROM ${H}${G}${K}${q}${Q}${n}${r}${z}`;
330
+ return t`${_}SELECT ${I}${P} FROM ${H}${G}${K}${q}${Q}${n}${r}${z}`;
314
331
  }
315
332
  });
316
- }, N = (e, t, n = null) => t.onDialectOrElse({
333
+ }, I = (e, t, n = null) => t.onDialectOrElse({
317
334
  sqlite: () => !0,
318
335
  orElse: () => !1
319
- }) && o(e) ? t`${p(e, t, { materialized: !1 }, n)}` : M(t.onDialectOrElse({
336
+ }) && o(e) ? t`${p(e, t, { materialized: !1 }, n)}` : F(t.onDialectOrElse({
320
337
  mssql: () => d(e) ?? e,
321
338
  orElse: () => e
322
- }), t, n, void 0, /* @__PURE__ */ new Set(), !0), P = (e, t, n = null, r) => {
339
+ }), t, n, void 0, /* @__PURE__ */ new Set(), !0), L = (e, t, n = null, r) => {
323
340
  if (r !== void 0 && t.onDialectOrElse({
324
341
  sqlite: () => !0,
325
342
  orElse: () => !1
@@ -333,11 +350,10 @@ var m = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), h = (e, t) => {
333
350
  skip: void 0
334
351
  };
335
352
  if (o(i)) return f(i, t, {
336
- compile: (e) => N(e, t, n),
353
+ compile: (e) => I(e, t, n),
337
354
  resultScale: void 0
338
355
  }, e);
339
356
  }
340
- return _(e, t, n, r);
341
- }, F = (e, t, n = null, r) => _(e, t, n, r);
342
- //#endregion
343
- export { P as compilePredicate, h as compileRawFragment, j as compileRowProjection, N as compileSelect, F as compileStoragePredicate, g as escapeLike };
357
+ return v(e, t, n, r);
358
+ }, R = (e, t, n = null, r) => v(e, t, n, r);
359
+ export { L as compilePredicate, h as compileRawFragment, P as compileRowProjection, I as compileSelect, R as compileStoragePredicate, g as escapeLike };
package/dist/sqlError.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { SqlError as e, UnknownError as t } from "effect/sql/SqlError";
2
- //#region src/sqlError.ts
2
+ // src/sqlError.ts
3
3
  var n = (n, r) => new e({ reason: new t({
4
4
  cause: r ?? Error(n),
5
5
  message: n
6
6
  }) });
7
- //#endregion
8
7
  export { n as sqlError };
@@ -0,0 +1,54 @@
1
+ // src/sqlMutation.ts
2
+ var e = class extends Error {
3
+ code;
4
+ constructor(e) {
5
+ super("Prepared SQL mutation refused: " + e), this.code = e, this.name = "SqlMutationError";
6
+ }
7
+ }, t = /* @__PURE__ */ new WeakMap(), n = (n, r, i = []) => {
8
+ if (!n || typeof n.transactional != "function" || typeof r != "function") throw new e("invalid_unit");
9
+ let a = Object.freeze(Object.create(null)), o = /* @__PURE__ */ new Set([a]);
10
+ for (let t of i) for (let n of t.handles) {
11
+ if (o.has(n)) throw new e("invalid_unit");
12
+ o.add(n);
13
+ }
14
+ if (o.size > 64) throw new e("limit_exceeded");
15
+ return t.set(a, Object.freeze({
16
+ store: n,
17
+ accept: r,
18
+ handles: o
19
+ })), a;
20
+ }, r = (e, t) => n(e, t), i = (n, r) => {
21
+ if (!Array.isArray(r) || r.length === 0) throw new e("invalid_unit");
22
+ if (r.length > 64) throw new e("limit_exceeded");
23
+ let i = Object.getOwnPropertyDescriptors(r);
24
+ if (Reflect.ownKeys(i).length !== r.length + 1) throw new e("invalid_unit");
25
+ let a = /* @__PURE__ */ new Set(), o = [];
26
+ for (let s = 0; s < r.length; s++) {
27
+ let r = i[String(s)];
28
+ if (!r || !("value" in r) || !r.enumerable) throw new e("invalid_unit");
29
+ let c = r.value;
30
+ if (!c || typeof c != "object") throw new e("invalid_unit");
31
+ let l = t.get(c);
32
+ if (!l) throw new e("invalid_unit");
33
+ if (l.store !== n) throw new e("store_mismatch");
34
+ for (let t of l.handles) {
35
+ if (a.has(t)) throw new e("invalid_unit");
36
+ a.add(t);
37
+ }
38
+ if (a.size > 64) throw new e("limit_exceeded");
39
+ o.push(l);
40
+ }
41
+ return Object.freeze(o);
42
+ }, a = async (e, t) => {
43
+ let n = [];
44
+ for (let r of t) n.push(await r.accept(e));
45
+ return Object.freeze(n);
46
+ }, o = (t, r, o) => {
47
+ let s = i(t, r);
48
+ if (typeof o != "function") throw new e("invalid_unit");
49
+ return n(t, async (e) => o(e, await a(e, s)), s);
50
+ }, s = async (e, t) => {
51
+ let n = i(e, t);
52
+ return e.transactional(async (e) => await a(e, n));
53
+ };
54
+ export { e as SqlMutationError, s as executeSqlMutations, r as prepareSqlMutation, o as prepareSqlMutationGroup };
@@ -1,4 +1,4 @@
1
- //#region src/sqlPoolCapacity.ts
1
+ // src/sqlPoolCapacity.ts
2
2
  var e = /* @__PURE__ */ new WeakMap(), t = (t, n) => {
3
3
  n !== void 0 && Number.isInteger(n) && n > 0 && e.set(t, n);
4
4
  }, n = (t) => {
@@ -8,5 +8,4 @@ var e = /* @__PURE__ */ new WeakMap(), t = (t, n) => {
8
8
  let r = t.config.maxConnections;
9
9
  return typeof r == "number" && Number.isInteger(r) && r > 0 ? r : void 0;
10
10
  };
11
- //#endregion
12
11
  export { t as registerSqlPoolCapacity, n as sqlPoolCapacity };
@@ -1,4 +1,4 @@
1
- //#region src/sqliteDecimal.ts
1
+ // src/sqliteDecimal.ts
2
2
  var e = ({ precision: e, scale: t }) => {
3
3
  if (!Number.isSafeInteger(e) || e <= 0 || !Number.isSafeInteger(t) || t < 0 || t > e) throw RangeError("Invalid fixed-point decimal precision or scale");
4
4
  return 10n ** BigInt(e);
@@ -18,5 +18,4 @@ var e = ({ precision: e, scale: t }) => {
18
18
  let a = (i < 0n ? -i : i).toString().padStart(n.scale + 1, "0"), o = n.scale === 0 ? a : a.slice(0, -n.scale) + "." + a.slice(-n.scale);
19
19
  return (i < 0n ? "-" : "") + o;
20
20
  };
21
- //#endregion
22
21
  export { n as decodeSqliteDecimal, t as encodeSqliteDecimal };
@@ -1,4 +1,4 @@
1
- //#region src/sqliteDecimalAggregateSql.ts
1
+ // src/sqliteDecimalAggregateSql.ts
2
2
  var e = (e, t, n) => {
3
3
  let r = n ? t : `SELECT * FROM (${t}) LIMIT -1 OFFSET 0`;
4
4
  return `${e} AS${n ? " MATERIALIZED" : ""} (${r})`;
@@ -57,5 +57,4 @@ var e = (e, t, n) => {
57
57
  }
58
58
  return `${_.length ? `WITH ${_.join(",\n")} ` : ""}SELECT ${f}CASE WHEN count='0' THEN NULL WHEN ltrim(result,'0')='' THEN '0' ELSE sign||ltrim(result,'0') END AS units,count FROM ${y(`decimal_avg_round${T}`)}`;
59
59
  };
60
- //#endregion
61
60
  export { n as compileSqliteDecimalAvg, t as compileSqliteDecimalSum };
@@ -1,5 +1,5 @@
1
1
  import { encodeSqliteDecimal as e } from "./sqliteDecimal.js";
2
- //#region src/sqliteDecimalColumnSql.ts
2
+ // src/sqliteDecimalColumnSql.ts
3
3
  var t = {
4
4
  eq: "=",
5
5
  neq: "<>",
@@ -104,5 +104,4 @@ var t = {
104
104
  values: new Map(o.map(({ column: e, plan: t }) => [e.name, t.value]))
105
105
  };
106
106
  };
107
- //#endregion
108
107
  export { n as compileSqliteDecimalColumnComparison, r as compileSqliteDecimalColumnValue, a as compileSqliteDecimalDecodedRows };
@@ -1,5 +1,5 @@
1
1
  import { decodeSqliteDecimal as e, encodeSqliteDecimal as t } from "./sqliteDecimal.js";
2
- //#region src/sqliteDecimalConversion.ts
2
+ // src/sqliteDecimalConversion.ts
3
3
  var n = (n, r) => {
4
4
  if (t("0", r), n.kind === "sortable-v1" && t("0", n.shape), n.value === null) return null;
5
5
  if (n.kind === "sortable-v1") return t(e(n.value, n.shape), r);
@@ -11,5 +11,4 @@ var n = (n, r) => {
11
11
  if (typeof n.value != "string") throw TypeError("Decimal text conversion requires an exact string source");
12
12
  return t(n.value, r);
13
13
  };
14
- //#endregion
15
14
  export { n as convertSqliteDecimalValue };
@@ -1,7 +1,7 @@
1
1
  import { decimal as e, text as t } from "./columns.js";
2
2
  import { sqliteDecimalOutputs as n } from "./sqliteDecimalOutputs.js";
3
3
  import { compileSqliteDecimalEncodedSource as r } from "./sqliteDecimalEncodeSql.js";
4
- //#region src/sqliteDecimalCte.ts
4
+ // src/sqliteDecimalCte.ts
5
5
  var i = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), a = (e) => {
6
6
  let t = /* @__PURE__ */ new Set(), n = (e) => {
7
7
  "and" in e ? e.and.forEach(n) : "or" in e ? e.or.forEach(n) : "not" in e ? n(e.not) : "subquery" in e && r(e.subquery);
@@ -150,5 +150,4 @@ var i = (e) => e.replace(/[A-Z]/g, (e) => e.toLowerCase()), a = (e) => {
150
150
  }).compile(), g = p.length ? t`WITH ${t.join(", ", !1)([...s, t.unsafe(p.join(","), h)])} ${t.unsafe(m)}` : t`WITH ${t.join(", ", !1)(s)} SELECT * FROM (${t.unsafe(m, h)})`;
151
151
  return t.unsafe(...g.compile());
152
152
  };
153
- //#endregion
154
153
  export { c as compileSqliteDecimalCtes, s as resolveSqliteDecimalSources };
@@ -1,5 +1,5 @@
1
1
  import { encodeSqliteDecimal as e } from "./sqliteDecimal.js";
2
- //#region src/sqliteDecimalEncodeSql.ts
2
+ // src/sqliteDecimalEncodeSql.ts
3
3
  var t = (t, n, r = [], i) => {
4
4
  e("0", n);
5
5
  let a = /* @__PURE__ */ new Set([
@@ -28,5 +28,4 @@ var t = (t, n, r = [], i) => {
28
28
  let p = `typeof(value)<>'text' OR instr(value,char(0))<>0 OR unsigned GLOB '*[^0-9.]*' OR instr(fraction,'.')<>0 OR length(integer_part)+length(fraction)=0 OR length(magnitude)>${n.precision} OR substr(fraction,${n.scale + 1}) GLOB '*[1-9]*'`;
29
29
  return `(${i ? "" : `WITH ${u.join(",")} `}SELECT ${r.map((e) => `"${e}",`).join("")}CASE WHEN value IS NULL THEN NULL WHEN ${p} THEN abs(-9223372036854775808) WHEN negative AND magnitude<>'0' THEN 'D0'||complement||CAST(10-CAST(substr(trimmed,-1) AS INTEGER) AS TEXT)||substr(padded,length(trimmed)+1) ELSE 'D1'||padded END AS value FROM ${d("complement")})`;
30
30
  };
31
- //#endregion
32
31
  export { t as compileSqliteDecimalEncodedSource };
@@ -2,7 +2,7 @@ import { integer as e } from "./columns.js";
2
2
  import { getTable as t } from "./tableRegistry.js";
3
3
  import { isSqliteDecimalEncodedColumn as n } from "./sqliteDecimalStorage.js";
4
4
  import { projectedColumn as r } from "./projectedColumn.js";
5
- //#region src/sqliteDecimalOutputs.ts
5
+ // src/sqliteDecimalOutputs.ts
6
6
  var i = (a, o) => {
7
7
  if (a.setOp) {
8
8
  let e = a.setOp.queries.map((e) => i(e, o));
@@ -70,5 +70,4 @@ var i = (a, o) => {
70
70
  };
71
71
  });
72
72
  };
73
- //#endregion
74
73
  export { i as sqliteDecimalOutputs };
@@ -1,6 +1,6 @@
1
1
  import { encodeSqliteDecimal as e } from "./sqliteDecimal.js";
2
2
  import { sqliteDecimalResultKey as t } from "./sqliteDecimalResultSql.js";
3
- //#region src/sqliteDecimalPredicate.ts
3
+ // src/sqliteDecimalPredicate.ts
4
4
  var n = (n, r, i) => {
5
5
  if (e("0", r), n.path?.length) throw Error("Decimal JSON-path predicates are unsupported");
6
6
  if (n.op === "isNull" || n.op === "isNotNull") return n;
@@ -62,5 +62,4 @@ var n = (n, r, i) => {
62
62
  value: c(f)
63
63
  };
64
64
  };
65
- //#endregion
66
65
  export { n as lowerSqliteDecimalPredicate };
@@ -12,7 +12,7 @@ import { compileSqliteDecimalRowQuery as p } from "./sqliteDecimalRowQuery.js";
12
12
  import { compileSqliteDecimalAvg as m, compileSqliteDecimalSum as ee } from "./sqliteDecimalAggregateSql.js";
13
13
  import { compileSqliteDecimalWindowQuery as h } from "./sqliteDecimalWindowQuery.js";
14
14
  import { compilePredicate as g } from "./sqlCompiler.js";
15
- //#region src/sqliteDecimalQuery.ts
15
+ // src/sqliteDecimalQuery.ts
16
16
  var _ = (a, o, v, y, b, x) => {
17
17
  if (!o.onDialectOrElse({
18
18
  sqlite: () => !0,
@@ -179,5 +179,4 @@ var _ = (a, o, v, y, b, x) => {
179
179
  let i = a(e, n.resultScale), s = new Set((i.ctes ?? []).map((e) => e.name));
180
180
  return _(i, t, n, (e) => s.has(e) ? e : o(r, e));
181
181
  };
182
- //#endregion
183
182
  export { v as compileSqliteDecimalQuery };