@prisma/orm-family-sql 8.0.0-rc.1-dev.44 → 8.0.0-rc.1-dev.46

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 (139) hide show
  1. package/dist/{aggregate-descriptor-registry-CTo0ry7h.mjs → aggregate-descriptor-registry-C7hel5O7.mjs} +2 -2
  2. package/dist/{aggregate-descriptor-registry-CTo0ry7h.mjs.map → aggregate-descriptor-registry-C7hel5O7.mjs.map} +1 -1
  3. package/dist/{ast-D8qqdDX_.d.mts → ast-HFcfQZr-.d.mts} +3 -3
  4. package/dist/{ast-D8qqdDX_.d.mts.map → ast-HFcfQZr-.d.mts.map} +1 -1
  5. package/dist/{ast-BJdOHZrL.mjs → ast-Lbl4VwqP.mjs} +2 -2
  6. package/dist/ast-Lbl4VwqP.mjs.map +1 -0
  7. package/dist/{authoring-type-constructors-Blqoa2Ua-CvHn00xx.mjs → authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs} +2 -2
  8. package/dist/{authoring-type-constructors-Blqoa2Ua-CvHn00xx.mjs.map → authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs.map} +1 -1
  9. package/dist/builder.d.mts +2 -2
  10. package/dist/builder__runtime.d.mts +6 -6
  11. package/dist/builder__runtime.mjs +20 -3
  12. package/dist/builder__runtime.mjs.map +1 -1
  13. package/dist/builder__types.d.mts +2 -2
  14. package/dist/{config-types-B6cQRwJw.mjs → config-types-gAm54C_v.mjs} +2 -2
  15. package/dist/{config-types-B6cQRwJw.mjs.map → config-types-gAm54C_v.mjs.map} +1 -1
  16. package/dist/{contract-builder-vdfvmuiO.mjs → contract-builder-D4a5dT7j.mjs} +2 -2
  17. package/dist/{contract-builder-vdfvmuiO.mjs.map → contract-builder-D4a5dT7j.mjs.map} +1 -1
  18. package/dist/contract-psl.mjs +1 -1
  19. package/dist/contract-psl__provider.mjs +2 -2
  20. package/dist/contract-psl__provider.mjs.map +1 -1
  21. package/dist/contract-ts.mjs +3 -3
  22. package/dist/contract-ts__config-types.mjs +1 -1
  23. package/dist/contract-ts__contract-builder.mjs +2 -2
  24. package/dist/contract.d.mts +1 -1
  25. package/dist/contract.mjs +1 -1
  26. package/dist/contract__foreign-key-materialization.d.mts +1 -1
  27. package/dist/contract__foreign-key-materialization.mjs +1 -1
  28. package/dist/{control-DAkNosoF.mjs → control-D3cB5YQp.mjs} +2 -2
  29. package/dist/{control-DAkNosoF.mjs.map → control-D3cB5YQp.mjs.map} +1 -1
  30. package/dist/{control-DssujEJW.d.mts → control-DTLJ1WtZ.d.mts} +6 -6
  31. package/dist/{control-DssujEJW.d.mts.map → control-DTLJ1WtZ.d.mts.map} +1 -1
  32. package/dist/{control-adapter-C99J7aEF-Vx9xXYOy.d.mts → control-adapter-C99J7aEF-B7eQd7vD.d.mts} +4 -4
  33. package/dist/{control-adapter-C99J7aEF-Vx9xXYOy.d.mts.map → control-adapter-C99J7aEF-B7eQd7vD.d.mts.map} +1 -1
  34. package/dist/control-adapter-MZJQiwcE.d.mts +1 -0
  35. package/dist/{db-C5jmOFPM-Cd-fni61.d.mts → db-D18PrXKW-DvTv4JFn.d.mts} +136 -8
  36. package/dist/db-D18PrXKW-DvTv4JFn.d.mts.map +1 -0
  37. package/dist/{ddl-types-BtT82FGO-Du_-9SlZ.d.mts → ddl-types-CXx4vPz6-BsgrnSUY.d.mts} +3 -3
  38. package/dist/{ddl-types-BtT82FGO-Du_-9SlZ.d.mts.map → ddl-types-CXx4vPz6-BsgrnSUY.d.mts.map} +1 -1
  39. package/dist/{derived-checks-DFMRmiAu-8jmha26I.mjs → derived-checks-DFMRmiAu-DGfB8aS4.mjs} +2 -2
  40. package/dist/{derived-checks-DFMRmiAu-8jmha26I.mjs.map → derived-checks-DFMRmiAu-DGfB8aS4.mjs.map} +1 -1
  41. package/dist/{diff-pl1Xal4J.d.mts → diff-DbTNVm2f.d.mts} +3 -3
  42. package/dist/{diff-pl1Xal4J.d.mts.map → diff-DbTNVm2f.d.mts.map} +1 -1
  43. package/dist/{expression-D30W-gkF.mjs → expression-CX5mTA-z.mjs} +54 -15
  44. package/dist/expression-CX5mTA-z.mjs.map +1 -0
  45. package/dist/{expression-Q_yaDQPb.d.mts → expression-FJK6Ar-d.d.mts} +96 -5
  46. package/dist/expression-FJK6Ar-d.d.mts.map +1 -0
  47. package/dist/family.d.mts +7 -7
  48. package/dist/family.mjs +2 -2
  49. package/dist/family__control-adapter.d.mts +2 -2
  50. package/dist/family__control.d.mts +2 -2
  51. package/dist/family__control.mjs +1 -1
  52. package/dist/family__diff.d.mts +2 -2
  53. package/dist/family__migration.d.mts +1 -1
  54. package/dist/family__pack.mjs +1 -1
  55. package/dist/family__psl-infer.mjs +1 -1
  56. package/dist/family__runtime.d.mts +1 -1
  57. package/dist/{foreign-key-materialization-DO9dvG7v.d.mts → foreign-key-materialization-CkvOzJWy.d.mts} +4 -4
  58. package/dist/{foreign-key-materialization-DO9dvG7v.d.mts.map → foreign-key-materialization-CkvOzJWy.d.mts.map} +1 -1
  59. package/dist/{foreign-key-materialization-DLOi1Ps0.mjs → foreign-key-materialization-Cu7-7LHl.mjs} +6 -5
  60. package/dist/foreign-key-materialization-Cu7-7LHl.mjs.map +1 -0
  61. package/dist/{index-DIHXLCbY.d.mts → index-C-vQOMY_.d.mts} +9 -9
  62. package/dist/{index-DIHXLCbY.d.mts.map → index-C-vQOMY_.d.mts.map} +1 -1
  63. package/dist/{interpreter-DaBA2fm--FFkq_gGd.mjs → interpreter-DyiUUAWh-DYdjIpiE.mjs} +5 -5
  64. package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +1 -0
  65. package/dist/lane-query-builder.d.mts +1 -1
  66. package/dist/middleware--TtoxUiW.d.mts +1 -0
  67. package/dist/{middleware-BS7u8VFR-DyUcAFid.d.mts → middleware-AhTz1BOW-th-Suxuf.d.mts} +3 -3
  68. package/dist/{middleware-BS7u8VFR-DyUcAFid.d.mts.map → middleware-AhTz1BOW-th-Suxuf.d.mts.map} +1 -1
  69. package/dist/{migration-CGlaINey.d.mts → migration-CjDRZNep.d.mts} +2 -2
  70. package/dist/{migration-CGlaINey.d.mts.map → migration-CjDRZNep.d.mts.map} +1 -1
  71. package/dist/orm-client.d.mts +7 -7
  72. package/dist/orm-client.mjs +2 -2
  73. package/dist/plan-BHLdb0Z7.d.mts +2 -0
  74. package/dist/{plan-BC_trt1i-In5gOKCT.d.mts → plan-CDxduYaN-pLIyyJaB.d.mts} +9 -8
  75. package/dist/plan-CDxduYaN-pLIyyJaB.d.mts.map +1 -0
  76. package/dist/{plan-CkpcgUaM.mjs → plan-Dh0LbYIv-Crx5-ThG.mjs} +8 -7
  77. package/dist/plan-Dh0LbYIv-Crx5-ThG.mjs.map +1 -0
  78. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs +22 -0
  79. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs.map +1 -0
  80. package/dist/{prepared-statement-z9bBbTph-BlzhaRTY.d.mts → prepared-statement-9QpkE6JG-C430V3MO.d.mts} +82 -17
  81. package/dist/prepared-statement-9QpkE6JG-C430V3MO.d.mts.map +1 -0
  82. package/dist/{psl-infer-YhbKkybN.mjs → psl-infer-Dk5kgKre.mjs} +2 -2
  83. package/dist/{psl-infer-YhbKkybN.mjs.map → psl-infer-Dk5kgKre.mjs.map} +1 -1
  84. package/dist/{query-lane-context-gwWUcacE-DdWNrc8q.d.mts → query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts} +3 -3
  85. package/dist/{query-lane-context-gwWUcacE-DdWNrc8q.d.mts.map → query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map} +1 -1
  86. package/dist/query-lane-context-XMvk7fmY.d.mts +1 -0
  87. package/dist/relational-core.d.mts +12 -12
  88. package/dist/relational-core.mjs +5 -5
  89. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  90. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  91. package/dist/relational-core__ast.d.mts +4 -4
  92. package/dist/relational-core__ast.mjs +3 -3
  93. package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
  94. package/dist/relational-core__contract-free.d.mts +2 -2
  95. package/dist/relational-core__contract-free.mjs +1 -1
  96. package/dist/relational-core__contract-free.mjs.map +1 -1
  97. package/dist/relational-core__expression.d.mts +2 -2
  98. package/dist/relational-core__expression.mjs +1 -1
  99. package/dist/relational-core__middleware.d.mts +2 -2
  100. package/dist/relational-core__plan.d.mts +3 -3
  101. package/dist/relational-core__plan.mjs +1 -1
  102. package/dist/relational-core__query-lane-context.d.mts +2 -2
  103. package/dist/relational-core__types.d.mts +3 -3
  104. package/dist/{runtime-cPrAp99G.d.mts → runtime-DpKF2Yu2.d.mts} +3 -3
  105. package/dist/{runtime-cPrAp99G.d.mts.map → runtime-DpKF2Yu2.d.mts.map} +1 -1
  106. package/dist/runtime.d.mts +5 -5
  107. package/dist/runtime.mjs +143 -16
  108. package/dist/runtime.mjs.map +1 -1
  109. package/dist/runtime__internal__prepared-query.d.mts +2 -2
  110. package/dist/runtime__internal__prepared-query.mjs +2 -2
  111. package/dist/{sql-execution-plan-D0ZTnszb-DnCRtfQO.d.mts → sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts} +5 -6
  112. package/dist/sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts.map +1 -0
  113. package/dist/types-B0msOnBM.d.mts +1 -0
  114. package/dist/{types-C9FZXc9Q-C6LM1k-O.d.mts → types-CyxGtOOh-BggSa6Fe.d.mts} +7 -18
  115. package/dist/{types-C9FZXc9Q-C6LM1k-O.d.mts.map → types-CyxGtOOh-BggSa6Fe.d.mts.map} +1 -1
  116. package/dist/{types-B7_v-z12-De5tf8LE.mjs → types-Dt4e_jC--COeP8xzN.mjs} +68 -28
  117. package/dist/{types-B7_v-z12-De5tf8LE.mjs.map → types-Dt4e_jC--COeP8xzN.mjs.map} +1 -1
  118. package/dist/{types-IqZMLrFC-B0YziCVx.d.mts → types-IqZMLrFC-DcH8v_u3.d.mts} +2 -2
  119. package/dist/{types-IqZMLrFC-B0YziCVx.d.mts.map → types-IqZMLrFC-DcH8v_u3.d.mts.map} +1 -1
  120. package/dist/{types-DH6Sqzxu-DfzaLX0o.d.mts → types-v3qxLLxo-DCeKv7yY.d.mts} +43 -22
  121. package/dist/{types-DH6Sqzxu-DfzaLX0o.d.mts.map → types-v3qxLLxo-DCeKv7yY.d.mts.map} +1 -1
  122. package/package.json +18 -18
  123. package/dist/ast-BJdOHZrL.mjs.map +0 -1
  124. package/dist/control-adapter-CLID4Q6Z.d.mts +0 -1
  125. package/dist/db-C5jmOFPM-Cd-fni61.d.mts.map +0 -1
  126. package/dist/expression-D30W-gkF.mjs.map +0 -1
  127. package/dist/expression-Q_yaDQPb.d.mts.map +0 -1
  128. package/dist/foreign-key-materialization-DLOi1Ps0.mjs.map +0 -1
  129. package/dist/interpreter-DaBA2fm--FFkq_gGd.mjs.map +0 -1
  130. package/dist/middleware-Cy_OqpBi.d.mts +0 -1
  131. package/dist/plan-BC_trt1i-In5gOKCT.d.mts.map +0 -1
  132. package/dist/plan-CkpcgUaM.mjs.map +0 -1
  133. package/dist/plan-DrOMooQt.d.mts +0 -2
  134. package/dist/prepared-query-BDLztUzY-CaDR0Rqc.mjs +0 -14
  135. package/dist/prepared-query-BDLztUzY-CaDR0Rqc.mjs.map +0 -1
  136. package/dist/prepared-statement-z9bBbTph-BlzhaRTY.d.mts.map +0 -1
  137. package/dist/query-lane-context-D62vkQhf.d.mts +0 -1
  138. package/dist/sql-execution-plan-D0ZTnszb-DnCRtfQO.d.mts.map +0 -1
  139. package/dist/types-0c4HyrXd.d.mts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
2
  import "./types-UcHa2cTe.mjs";
3
- import { f as SqlMigrationPlanOperation, w as SqlPlanTargetDetails } from "./types-IqZMLrFC-B0YziCVx.mjs";
3
+ import { f as SqlMigrationPlanOperation, w as SqlPlanTargetDetails } from "./types-IqZMLrFC-DcH8v_u3.mjs";
4
4
  import { Contract } from "@prisma/orm-framework/contract/types";
5
5
  import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
6
6
  //#region ../../../2-sql/9-family/dist/migration.d.mts
@@ -41,4 +41,4 @@ declare abstract class SqlMigration<TDetails extends SqlPlanTargetDetails, TTarg
41
41
  }
42
42
  //#endregion
43
43
  export { SqlMigration as t };
44
- //# sourceMappingURL=migration-CGlaINey.d.mts.map
44
+ //# sourceMappingURL=migration-CjDRZNep.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-CGlaINey.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/migration.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BuB,aAAa,iBAAiB,sBAAsB,mCAAmC,cAAc,SAAS,cAAc,SAAS,aAAa,YAAY,SAAS,cAAc,SAAS,qBAAqB,UAAU,0BAA0B,kBAAkB,WAAW,OAAO;;;;;;;;;;;MAW5S"}
1
+ {"version":3,"file":"migration-CjDRZNep.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/migration.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BuB,aAAa,iBAAiB,sBAAsB,mCAAmC,cAAc,SAAS,cAAc,SAAS,aAAa,YAAY,SAAS,cAAc,SAAS,qBAAqB,UAAU,0BAA0B,kBAAkB,WAAW,OAAO;;;;;;;;;;;MAW5S"}
@@ -2,13 +2,13 @@ import { r as StorageTable, t as StorageColumn } from "./storage-table-DSeWszOL-
2
2
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
3
3
  import { f as ExtractFieldOutputTypes, l as ExtractAggregateTypes, p as ExtractQueryOperationTypes, u as ExtractCodecTypes } from "./types-BDUG29Df-LE85dIXP.mjs";
4
4
  import "./types-UcHa2cTe.mjs";
5
- import { Pt as WhereArg, T as CodecRef$1, a as AndExpr, g as BinaryExpr, gt as OrderByItem, ht as OrExpr, pt as NullCheckExpr, r as AggregateFn, s as AnyExpression } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
6
- import "./ast-D8qqdDX_.mjs";
7
- import { a as Expression } from "./expression-Q_yaDQPb.mjs";
8
- import { r as ExecutionContext } from "./query-lane-context-gwWUcacE-DdWNrc8q.mjs";
9
- import "./query-lane-context-D62vkQhf.mjs";
10
- import { o as ComputeColumnJsType, y as RuntimeScope } from "./types-C9FZXc9Q-C6LM1k-O.mjs";
11
- import "./types-0c4HyrXd.mjs";
5
+ import { It as WhereArg, T as CodecRef$1, a as AndExpr, g as BinaryExpr, gt as OrderByItem, ht as OrExpr, pt as NullCheckExpr, r as AggregateFn, s as AnyExpression } from "./types-v3qxLLxo-DCeKv7yY.mjs";
6
+ import "./ast-HFcfQZr-.mjs";
7
+ import { o as Expression } from "./expression-FJK6Ar-d.mjs";
8
+ import { r as ExecutionContext } from "./query-lane-context-Qa-eddrE-kuZ8Z86-.mjs";
9
+ import "./query-lane-context-XMvk7fmY.mjs";
10
+ import { h as RuntimeScope, o as ComputeColumnJsType } from "./types-CyxGtOOh-BggSa6Fe.mjs";
11
+ import "./types-B0msOnBM.mjs";
12
12
  import { Contract } from "@prisma/orm-framework/contract/types";
13
13
  import { AnnotationValue, AsyncIterableResult, MetaBuilder, OperationKind } from "@prisma/orm-framework/components/runtime";
14
14
  import { SimplifyDeep } from "@prisma/orm-framework/utils/simplify-deep";
@@ -1,8 +1,8 @@
1
1
  import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
2
2
  import { i as isUniqueConstraintViolation } from "./dist-x6jvtkKM.mjs";
3
- import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isWhereExpr, V as isAggregateFn, _ as InsertAst, b as JsonArrayAggExpr, c as DeleteAst, f as EqColJoinOn, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst } from "./types-B7_v-z12-De5tf8LE.mjs";
3
+ import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isWhereExpr, V as isAggregateFn, _ as InsertAst, b as JsonArrayAggExpr, c as DeleteAst, f as EqColJoinOn, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst } from "./types-Dt4e_jC--COeP8xzN.mjs";
4
4
  import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
5
- import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-BJdOHZrL.mjs";
5
+ import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-Lbl4VwqP.mjs";
6
6
  import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-N0dhtKaH.mjs";
7
7
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
8
8
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -0,0 +1,2 @@
1
+ import "./plan-CDxduYaN-pLIyyJaB.mjs";
2
+ import "./sql-execution-plan--jKyLpe5-CMGhgO0M.mjs";
@@ -1,9 +1,9 @@
1
1
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
2
  import "./types-UcHa2cTe.mjs";
3
- import { m as AnyQueryAst } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
3
+ import { m as AnyQueryAst } from "./types-v3qxLLxo-DCeKv7yY.mjs";
4
4
  import { Contract } from "@prisma/orm-framework/contract/types";
5
5
  import { QueryPlan } from "@prisma/orm-framework/components/runtime";
6
- //#region ../../../2-sql/4-lanes/relational-core/dist/plan-BC_trt1i.d.mts
6
+ //#region ../../../2-sql/4-lanes/relational-core/dist/plan-CDxduYaN.d.mts
7
7
  //#region src/plan.d.ts
8
8
  /**
9
9
  * SQL query plan produced by lanes before lowering.
@@ -23,12 +23,13 @@ interface SqlQueryPlan<Row = unknown> extends QueryPlan<Row> {
23
23
  readonly params: readonly unknown[];
24
24
  }
25
25
  /**
26
- * Wraps an `AnyQueryAst` (typically a `RawSqlExpr` constructed package-internally
27
- * by an extension's migration factory) in a fully-populated `SqlQueryPlan`
28
- * whose `meta` is sourced from the supplied contract.
26
+ * Wraps an `AnyQueryAst` (typically a `RawQueryAst`, minted by a raw statement
27
+ * terminator or package-internally by an extension's migration factory) in a
28
+ * fully-populated `SqlQueryPlan` whose `meta` is sourced from the supplied
29
+ * contract.
29
30
  *
30
- * Centralising the envelope here means consumers (cipherstash migration
31
- * factories today; future raw-sql callers) cannot drift on `storageHash` /
31
+ * Centralising the envelope here means consumers (raw statement terminators,
32
+ * cipherstash migration factories) cannot drift on `storageHash` /
32
33
  * `target` / `targetFamily`, which would otherwise surface as a subtle
33
34
  * `assertContractMatches` failure inside `dataTransform`. `params` defaults
34
35
  * to `[]` because parameters embedded in the AST as `ParamRef`s are resolved
@@ -42,4 +43,4 @@ interface SqlQueryPlan<Row = unknown> extends QueryPlan<Row> {
42
43
  declare function planFromAst<Row = unknown>(ast: AnyQueryAst, contract: Contract<SqlStorage>, laneId?: string): SqlQueryPlan<Row>;
43
44
  //#endregion
44
45
  export { planFromAst as n, SqlQueryPlan as t };
45
- //# sourceMappingURL=plan-BC_trt1i-In5gOKCT.d.mts.map
46
+ //# sourceMappingURL=plan-CDxduYaN-pLIyyJaB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-CDxduYaN-pLIyyJaB.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/plan-CDxduYaN.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAkBU,aAAa,uBAAuB,UAAU;WAC7C,KAAK;WACL;;;;;;;;;;;;;;;;;;;;iBAoBM,YAAY,eAAe,KAAK,aAAa,UAAU,SAAS,aAAa,kBAAkB,aAAa"}
@@ -1,11 +1,12 @@
1
- //#region ../../../2-sql/4-lanes/relational-core/dist/exports/plan.mjs
1
+ //#region ../../../2-sql/4-lanes/relational-core/dist/plan-Dh0LbYIv.mjs
2
2
  /**
3
- * Wraps an `AnyQueryAst` (typically a `RawSqlExpr` constructed package-internally
4
- * by an extension's migration factory) in a fully-populated `SqlQueryPlan`
5
- * whose `meta` is sourced from the supplied contract.
3
+ * Wraps an `AnyQueryAst` (typically a `RawQueryAst`, minted by a raw statement
4
+ * terminator or package-internally by an extension's migration factory) in a
5
+ * fully-populated `SqlQueryPlan` whose `meta` is sourced from the supplied
6
+ * contract.
6
7
  *
7
- * Centralising the envelope here means consumers (cipherstash migration
8
- * factories today; future raw-sql callers) cannot drift on `storageHash` /
8
+ * Centralising the envelope here means consumers (raw statement terminators,
9
+ * cipherstash migration factories) cannot drift on `storageHash` /
9
10
  * `target` / `targetFamily`, which would otherwise surface as a subtle
10
11
  * `assertContractMatches` failure inside `dataTransform`. `params` defaults
11
12
  * to `[]` because parameters embedded in the AST as `ParamRef`s are resolved
@@ -31,4 +32,4 @@ function planFromAst(ast, contract, laneId = "raw") {
31
32
  //#endregion
32
33
  export { planFromAst as t };
33
34
 
34
- //# sourceMappingURL=plan-CkpcgUaM.mjs.map
35
+ //# sourceMappingURL=plan-Dh0LbYIv-Crx5-ThG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-Dh0LbYIv-Crx5-ThG.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/plan-Dh0LbYIv.mjs"],"sourcesContent":["//#region src/plan.ts\n/**\n* Wraps an `AnyQueryAst` (typically a `RawQueryAst`, minted by a raw statement\n* terminator or package-internally by an extension's migration factory) in a\n* fully-populated `SqlQueryPlan` whose `meta` is sourced from the supplied\n* contract.\n*\n* Centralising the envelope here means consumers (raw statement terminators,\n* cipherstash migration factories) cannot drift on `storageHash` /\n* `target` / `targetFamily`, which would otherwise surface as a subtle\n* `assertContractMatches` failure inside `dataTransform`. `params` defaults\n* to `[]` because parameters embedded in the AST as `ParamRef`s are resolved\n* at lowering time (`encodeParams` walks `plan.ast.collectParamRefs()`),\n* not at plan-construction time.\n*\n* The default `laneId` of `'raw'` reflects raw-SQL plans' standard lane tag;\n* callers (e.g. a future `sql-raw-factory`) may override to differentiate\n* the plan's provenance.\n*/\nfunction planFromAst(ast, contract, laneId = \"raw\") {\n\treturn {\n\t\tast,\n\t\tparams: [],\n\t\tmeta: {\n\t\t\ttarget: contract.target,\n\t\t\ttargetFamily: contract.targetFamily,\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\tlane: laneId\n\t\t}\n\t};\n}\n//#endregion\nexport { planFromAst as t };\n\n//# sourceMappingURL=plan-Dh0LbYIv.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,YAAY,KAAK,UAAU,SAAS,OAAO;CACnD,OAAO;EACN;EACA,QAAQ,CAAC;EACT,MAAM;GACL,QAAQ,SAAS;GACjB,cAAc,SAAS;GACvB,aAAa,SAAS,QAAQ;GAC9B,MAAM;EACP;CACD;AACD"}
@@ -0,0 +1,22 @@
1
+ import { invariant } from "@prisma/orm-framework/utils/assertions";
2
+ //#region ../../../2-sql/5-runtime/dist/prepared-query-BJr50wPm.mjs
3
+ const preparedStatementExecute = Symbol("preparedStatementExecute");
4
+ function isPreparedStatementExecuteTarget(target) {
5
+ return preparedStatementExecute in target;
6
+ }
7
+ function runPreparedExecute(target, statement, params, options) {
8
+ invariant(isPreparedStatementExecuteTarget(target), "RuntimeQueryable is missing the prepared statement execute bridge");
9
+ return target[preparedStatementExecute](statement, params, options);
10
+ }
11
+ const preparedStatementQuery = Symbol("preparedStatementQuery");
12
+ function isPreparedStatementQueryTarget(target) {
13
+ return preparedStatementQuery in target;
14
+ }
15
+ function runPreparedQuery(target, statement, params, options) {
16
+ invariant(isPreparedStatementQueryTarget(target), "RuntimeQueryable is missing the prepared statement query bridge");
17
+ return target[preparedStatementQuery](statement, params, options);
18
+ }
19
+ //#endregion
20
+ export { runPreparedQuery as i, preparedStatementQuery as n, runPreparedExecute as r, preparedStatementExecute as t };
21
+
22
+ //# sourceMappingURL=prepared-query-BJr50wPm-ChoqfJbX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepared-query-BJr50wPm-ChoqfJbX.mjs","names":[],"sources":["../../../../2-sql/5-runtime/dist/prepared-query-BJr50wPm.mjs"],"sourcesContent":["import { invariant } from \"@internal/utils/assertions\";\n//#region src/prepared/prepared-execute.ts\nconst preparedStatementExecute = Symbol(\"preparedStatementExecute\");\nfunction isPreparedStatementExecuteTarget(target) {\n\treturn preparedStatementExecute in target;\n}\nfunction runPreparedExecute(target, statement, params, options) {\n\tinvariant(isPreparedStatementExecuteTarget(target), \"RuntimeQueryable is missing the prepared statement execute bridge\");\n\treturn target[preparedStatementExecute](statement, params, options);\n}\n//#endregion\n//#region src/prepared/prepared-query.ts\nconst preparedStatementQuery = Symbol(\"preparedStatementQuery\");\nfunction isPreparedStatementQueryTarget(target) {\n\treturn preparedStatementQuery in target;\n}\nfunction runPreparedQuery(target, statement, params, options) {\n\tinvariant(isPreparedStatementQueryTarget(target), \"RuntimeQueryable is missing the prepared statement query bridge\");\n\treturn target[preparedStatementQuery](statement, params, options);\n}\n//#endregion\nexport { runPreparedExecute as i, runPreparedQuery as n, preparedStatementExecute as r, preparedStatementQuery as t };\n\n//# sourceMappingURL=prepared-query-BJr50wPm.mjs.map"],"mappings":";;AAEA,MAAM,2BAA2B,OAAO,0BAA0B;AAClE,SAAS,iCAAiC,QAAQ;CACjD,OAAO,4BAA4B;AACpC;AACA,SAAS,mBAAmB,QAAQ,WAAW,QAAQ,SAAS;CAC/D,UAAU,iCAAiC,MAAM,GAAG,mEAAmE;CACvH,OAAO,OAAO,yBAAyB,CAAC,WAAW,QAAQ,OAAO;AACnE;AAGA,MAAM,yBAAyB,OAAO,wBAAwB;AAC9D,SAAS,+BAA+B,QAAQ;CAC/C,OAAO,0BAA0B;AAClC;AACA,SAAS,iBAAiB,QAAQ,WAAW,QAAQ,SAAS;CAC7D,UAAU,+BAA+B,MAAM,GAAG,iEAAiE;CACnH,OAAO,OAAO,uBAAuB,CAAC,WAAW,QAAQ,OAAO;AACjE"}
@@ -1,24 +1,24 @@
1
1
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
2
  import "./types-UcHa2cTe.mjs";
3
3
  import { r as SqlOperationDescriptors } from "./index-C5I8D-MB.mjs";
4
- import { Et as SqlCodecCallContext, O as ContractCodecRegistry, T as CodecRef$1, lt as LoweredParam, m as AnyQueryAst, ut as LoweredStatement, x as Codec$1 } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
4
+ import { O as ContractCodecRegistry, Ot as SqlCodecCallContext, T as CodecRef$1, lt as LoweredParam, m as AnyQueryAst, ut as LoweredStatement, x as Codec$1 } from "./types-v3qxLLxo-DCeKv7yY.mjs";
5
5
  import { c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, r as SqlConnection } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
6
- import { o as MarkerReadResult, t as Adapter } from "./ast-D8qqdDX_.mjs";
7
- import { a as Expression, i as CodecValue, o as RawCodecInferer, r as CodecTypesBase } from "./expression-Q_yaDQPb.mjs";
8
- import { t as SqlExecutionPlan } from "./sql-execution-plan-D0ZTnszb-DnCRtfQO.mjs";
9
- import { t as SqlQueryPlan } from "./plan-BC_trt1i-In5gOKCT.mjs";
10
- import "./plan-DrOMooQt.mjs";
11
- import { r as ExecutionContext } from "./query-lane-context-gwWUcacE-DdWNrc8q.mjs";
12
- import "./query-lane-context-D62vkQhf.mjs";
13
- import { i as SqlParamRefMutator } from "./middleware-BS7u8VFR-DyUcAFid.mjs";
14
- import "./middleware-Cy_OqpBi.mjs";
15
- import { y as RuntimeScope } from "./types-C9FZXc9Q-C6LM1k-O.mjs";
16
- import "./types-0c4HyrXd.mjs";
6
+ import { o as MarkerReadResult, t as Adapter } from "./ast-HFcfQZr-.mjs";
7
+ import { t as SqlQueryPlan } from "./plan-CDxduYaN-pLIyyJaB.mjs";
8
+ import { a as CodecValue, i as CodecTypesBase, l as RawCodecInferer, o as Expression, t as AffectedCount } from "./expression-FJK6Ar-d.mjs";
9
+ import { t as SqlExecutionPlan } from "./sql-execution-plan--jKyLpe5-CMGhgO0M.mjs";
10
+ import "./plan-BHLdb0Z7.mjs";
11
+ import { r as ExecutionContext } from "./query-lane-context-Qa-eddrE-kuZ8Z86-.mjs";
12
+ import "./query-lane-context-XMvk7fmY.mjs";
13
+ import { i as SqlParamRefMutator } from "./middleware-AhTz1BOW-th-Suxuf.mjs";
14
+ import "./middleware--TtoxUiW.mjs";
15
+ import { h as RuntimeScope } from "./types-CyxGtOOh-BggSa6Fe.mjs";
16
+ import "./types-B0msOnBM.mjs";
17
17
  import { Contract, JsonValue, PlanMeta } from "@prisma/orm-framework/contract/types";
18
18
  import { AnyCodecDescriptor, CodecDescriptor } from "@prisma/orm-framework/components/codec";
19
19
  import { AfterExecuteResult, AfterQueryResult, AsyncIterableResult, ExecuteInterceptResult, ExecutionPlan, QueryInterceptResult, RuntimeCore, RuntimeExecuteOptions, RuntimeLog, RuntimeMiddleware, RuntimeMiddlewareContext } from "@prisma/orm-framework/components/runtime";
20
20
  import { ExecutionStack, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
21
- //#region ../../../2-sql/5-runtime/dist/prepared-statement-z9bBbTph.d.mts
21
+ //#region ../../../2-sql/5-runtime/dist/prepared-statement-9QpkE6JG.d.mts
22
22
  //#region src/codecs/encoding.d.ts
23
23
  interface ParamMetadata {
24
24
  readonly codec: CodecRef$1 | undefined;
@@ -130,6 +130,13 @@ interface DecodeContext {
130
130
  readonly columnRefs: ReadonlyMap<string, ColumnRef>;
131
131
  readonly includeAliases: ReadonlySet<string>;
132
132
  readonly manyAliases: ReadonlySet<string>;
133
+ /**
134
+ * Where {@link DecodeContext.aliases} came from, which decides how a row
135
+ * that lacks one of them reads: a projection the builder wrote is the
136
+ * runtime's own doing, while a row spec is the author's declaration about a
137
+ * statement the runtime never inspected.
138
+ */
139
+ readonly aliasSource: 'projection' | 'row-spec';
133
140
  }
134
141
  //#endregion
135
142
  //#region src/prepared/types.d.ts
@@ -160,6 +167,43 @@ interface PreparedStatement<Params, Row> {
160
167
  readonly _row?: Row;
161
168
  query(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
162
169
  }
170
+ /**
171
+ * A prepared statement whose plan declares statement statistics rather than
172
+ * rows. It carries the same lowered statement and bind slots as its
173
+ * row-streaming sibling and differs in one way: it is consumed by executing
174
+ * it, which resolves the statistics the statement reports.
175
+ */
176
+ interface PreparedExecution<Params> {
177
+ readonly sql: string;
178
+ readonly ast: AnyQueryAst;
179
+ readonly meta: PlanMeta;
180
+ readonly slots: readonly LoweredParam[];
181
+ readonly _params?: Params;
182
+ execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
183
+ }
184
+ /**
185
+ * The prepared handle a plan earns, keyed on the result the plan declares:
186
+ * statistics prepare into a {@link PreparedExecution}, rows into a
187
+ * {@link PreparedStatement}. The two faces share no consumption method, so a
188
+ * handle cannot be read the wrong way round.
189
+ *
190
+ * The key is `AffectedCount`'s brand rather than the statistics shape, so a
191
+ * row spec free to declare a column named `affectedRows` cannot select the
192
+ * execution face by coincidence. This is the same fact `prepare()` reads at
193
+ * runtime from the AST's declared result — one decision, stated twice.
194
+ *
195
+ * `never` is answered first because it satisfies every `extends`: a builder
196
+ * state that projects nothing types its rows as `never`, and such a plan
197
+ * declares rows in its AST, so it earns the statement face the runtime builds
198
+ * for it.
199
+ */
200
+ type PreparedFor<Params, Row> = [Row] extends [never] ? PreparedStatement<Params, Row> : [Row] extends [AffectedCount] ? PreparedExecution<Params> : PreparedStatement<Params, Row>;
201
+ //#endregion
202
+ //#region src/prepared/prepared-execute.d.ts
203
+ declare const preparedStatementExecute: unique symbol;
204
+ interface PreparedStatementExecuteTarget extends RuntimeQueryable {
205
+ [preparedStatementExecute]<Params>(statement: PreparedExecution<Params>, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
206
+ }
163
207
  //#endregion
164
208
  //#region src/prepared/prepared-query.d.ts
165
209
  declare const preparedStatementQuery: unique symbol;
@@ -313,7 +357,7 @@ interface Runtime extends RuntimeQueryable {
313
357
  * `RUNTIME.PREPARE_UNUSED_PARAM` if any declared name is unreferenced
314
358
  * by the callback's plan.
315
359
  */
316
- prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
360
+ prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedFor<ParamsFromDeclaration<D, CT>, Row>>;
317
361
  }
318
362
  interface RuntimeConnection extends RuntimeQueryable {
319
363
  transaction(): Promise<RuntimeTransaction>;
@@ -406,6 +450,7 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
406
450
  }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
407
451
  execute(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
408
452
  [preparedStatementQuery]<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
453
+ [preparedStatementExecute]<Params>(ps: PreparedExecution<Params>, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
409
454
  /**
410
455
  * Returns the raw driver connection. The connection is a `SqlQueryable` — SQL
411
456
  * issued on it runs below the middleware/codec/telemetry pipeline. It carries
@@ -423,9 +468,11 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
423
468
  protected queryAgainstQueryable<Row>(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
424
469
  /** Execute statistics against a caller-supplied queryable through the shared preparation pipeline. */
425
470
  protected executeStatisticsAgainstQueryable(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
426
- prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
471
+ prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedFor<ParamsFromDeclaration<D, CT>, Row>>;
427
472
  /** Query prepared rows against a caller-supplied queryable through the full pipeline. */
428
473
  protected runPreparedQueryAgainstQueryable<P, Row>(ps: PreparedStatementImpl<P, Row>, userParams: unknown, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
474
+ /** Execute a prepared statement's statistics against a caller-supplied queryable through the full pipeline. */
475
+ protected runPreparedExecuteAgainstQueryable<P>(ps: PreparedExecutionImpl<P>, userParams: unknown, queryable: SqlQueryable, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
429
476
  connection(): Promise<RuntimeConnection>;
430
477
  private wrapTransaction;
431
478
  telemetry(): RuntimeTelemetryEvent | null;
@@ -459,6 +506,24 @@ declare class PreparedStatementImpl<Params, Row> implements PreparedStatement<Pa
459
506
  constructor(internals: PreparedStatementInternals);
460
507
  query(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
461
508
  }
509
+ /**
510
+ * The statistics-reporting sibling of {@link PreparedStatementImpl}. A plan
511
+ * declaring an affected-row count prepares into one of these, which carries
512
+ * the same lowered statement and bind slots and is consumed by executing it.
513
+ *
514
+ * The two classes are separate so the consumption a plan did not declare is
515
+ * absent from the value, not merely from its type.
516
+ */
517
+ declare class PreparedExecutionImpl<Params> implements PreparedExecution<Params>, PreparedStatementInternals {
518
+ readonly sql: string;
519
+ readonly ast: AnyQueryAst;
520
+ readonly meta: PlanMeta;
521
+ readonly slots: readonly LoweredParam[];
522
+ readonly decodeContext: DecodeContext;
523
+ readonly paramMetadata: readonly ParamMetadata[];
524
+ constructor(internals: PreparedStatementInternals);
525
+ execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
526
+ }
462
527
  //#endregion
463
- export { SqlRuntimeDriverInstance as A, deriveParamMetadata as B, SqlExecutionStack as C, SqlRuntimeAdapterDescriptor as D, SqlMiddlewareContext as E, TelemetryOutcome as F, preparedStatementQuery as H, TransactionContext as I, VerifyMarkerOption as L, SqlRuntimeExtensionInstance as M, SqlRuntimeTargetDescriptor as N, SqlRuntimeAdapterInstance as O, SqlStaticContributions as P, createExecutionContext as R, RuntimeTransaction as S, SqlMiddleware as T, withTransaction as U, encodeParamsWithMetadata as V, RuntimeFamilyAdapter as _, DeclaredNullable as a, RuntimeQueryable as b, ParamSpec as c, PreparedStatement as d, PreparedStatementImpl as f, RuntimeConnection as g, Runtime as h, DeclaredCodecId as i, SqlRuntimeExtensionDescriptor as j, SqlRuntimeBase as k, ParamsFromDeclaration as l, PreparedStatementQueryTarget as m, ConnectionProvider as n, GeneratorStability as o, PreparedStatementInternals as p, Declaration as r, MarkerReader as s, BindSiteParams as t, PrepareCallback as u, RuntimeMutationDefaultGenerator as v, SqlExecutionStackWithDriver as w, RuntimeTelemetryEvent as x, RuntimeParameterizedCodecDescriptor as y, createSqlExecutionStack as z };
464
- //# sourceMappingURL=prepared-statement-z9bBbTph-BlzhaRTY.d.mts.map
528
+ export { SqlMiddlewareContext as A, TransactionContext as B, RuntimeParameterizedCodecDescriptor as C, SqlExecutionStack as D, RuntimeTransaction as E, SqlRuntimeExtensionDescriptor as F, encodeParamsWithMetadata as G, createExecutionContext as H, SqlRuntimeExtensionInstance as I, withTransaction as J, preparedStatementExecute as K, SqlRuntimeTargetDescriptor as L, SqlRuntimeAdapterInstance as M, SqlRuntimeBase as N, SqlExecutionStackWithDriver as O, SqlRuntimeDriverInstance as P, SqlStaticContributions as R, RuntimeMutationDefaultGenerator as S, RuntimeTelemetryEvent as T, createSqlExecutionStack as U, VerifyMarkerOption as V, deriveParamMetadata as W, PreparedStatementInternals as _, DeclaredNullable as a, RuntimeConnection as b, ParamSpec as c, PreparedExecution as d, PreparedExecutionImpl as f, PreparedStatementImpl as g, PreparedStatementExecuteTarget as h, DeclaredCodecId as i, SqlRuntimeAdapterDescriptor as j, SqlMiddleware as k, ParamsFromDeclaration as l, PreparedStatement as m, ConnectionProvider as n, GeneratorStability as o, PreparedFor as p, preparedStatementQuery as q, Declaration as r, MarkerReader as s, BindSiteParams as t, PrepareCallback as u, PreparedStatementQueryTarget as v, RuntimeQueryable as w, RuntimeFamilyAdapter as x, Runtime as y, TelemetryOutcome as z };
529
+ //# sourceMappingURL=prepared-statement-9QpkE6JG-C430V3MO.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepared-statement-9QpkE6JG-C430V3MO.d.mts","names":[],"sources":["../../../../2-sql/5-runtime/dist/prepared-statement-9QpkE6JG.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UAaU;WACC,OAAO;WACP;;iBAEM,oBAAoB,KAAK,uBAAuB;iBAChD,yBAAyB,4BAA4B,mBAAmB,iBAAiB,KAAK,qBAAqB,iBAAiB,wBAAwB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BAAqB,WAAW,cAAc,UAAU,wBAAwB,QAAQ;EACtK,cAAc,QAAQ;UACd;EACR,aAAa;EACb,SAAS;UACD;UACA;UACA;;;UAGA;EACR,cAAc,QAAQ;;iBAEP,gBAAgB,GAAG,SAAS,oBAAoB,KAAK,IAAI,uBAAuB,YAAY,KAAK,QAAQ;;;UAGhH;WACC;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;;cAErB,sBAAsB,QAAQ,gBAAgB,kBAAkB,QAAQ,MAAM;WACjF;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;EACjC,YAAY,WAAW;EACvB,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ,UAAU,wBAAwB,oBAAoB;;;;;;;;;;cAU1F,sBAAsB,mBAAmB,kBAAkB,SAAS;WACvE;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;EACjC,YAAY,WAAW;EACvB,QAAQ,QAAQ,kBAAkB,QAAQ,QAAQ,UAAU,wBAAwB,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { n as isBackedByColumnKeys, t as backingIndexColumnKeys } from "./foreign-key-materialization-DLOi1Ps0.mjs";
1
+ import { n as isBackedByColumnKeys, t as backingIndexColumnKeys } from "./foreign-key-materialization-Cu7-7LHl.mjs";
2
2
  import pluralizeLib from "pluralize";
3
3
  //#region ../../../2-sql/9-family/dist/psl-infer.mjs
4
4
  const DEFAULT_FUNCTION_ATTRIBUTES = {
@@ -359,4 +359,4 @@ function addRelationField(map, tableName, field) {
359
359
  //#endregion
360
360
  export { mapDefault as a, toEnumMemberName as c, toModelName as d, inferRelations as i, toEnumName as l, deriveBackRelationFieldName as n, parseRawDefault as o, deriveRelationFieldName as r, pluralize as s, buildChildRelationField as t, toFieldName as u };
361
361
 
362
- //# sourceMappingURL=psl-infer-YhbKkybN.mjs.map
362
+ //# sourceMappingURL=psl-infer-Dk5kgKre.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"psl-infer-YhbKkybN.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.mjs"],"sourcesContent":["import pluralizeLib from \"pluralize\";\nimport { backingIndexColumnKeys, isBackedByColumnKeys } from \"@internal/sql-contract/foreign-key-materialization\";\n//#region src/core/psl-contract-infer/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return { attribute: `@default(${formatLiteralValue(columnDefault.value)})` };\n\t\tcase \"function\": {\n\t\t\tconst attribute = options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? options?.fallbackFunctionAttribute?.(columnDefault.expression);\n\t\t\treturn attribute ? { attribute } : { comment: `// Raw default: ${columnDefault.expression.replace(/[\\r\\n]+/g, \" \")}` };\n\t\t}\n\t}\n}\nfunction formatLiteralValue(value) {\n\tif (value === null) return \"null\";\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\tcase \"number\": return String(value);\n\t\tcase \"string\": return quoteString(value);\n\t\tdefault: return quoteString(JSON.stringify(value));\n\t}\n}\nfunction quoteString(str) {\n\treturn `\"${escapeString(str)}\"`;\n}\nfunction escapeString(str) {\n\treturn JSON.stringify(str).slice(1, -1);\n}\n//#endregion\n//#region src/core/psl-contract-infer/name-transforms.ts\nconst PSL_RESERVED_WORDS = /* @__PURE__ */ new Set([\n\t\"model\",\n\t\"enum\",\n\t\"types\",\n\t\"type\",\n\t\"generator\",\n\t\"datasource\"\n]);\nconst IDENTIFIER_PART_PATTERN = /[A-Za-z0-9]+/g;\nfunction hasSeparators(input) {\n\treturn /[^A-Za-z0-9]/.test(input);\n}\nfunction extractIdentifierParts(input) {\n\treturn input.match(IDENTIFIER_PART_PATTERN) ?? [];\n}\nfunction createSyntheticIdentifier(input) {\n\tlet hash = 2166136261;\n\tfor (const char of input) {\n\t\thash ^= char.codePointAt(0) ?? 0;\n\t\thash = Math.imul(hash, 16777619);\n\t}\n\treturn `x${(hash >>> 0).toString(16)}`;\n}\nfunction sanitizeIdentifierCharacters(input) {\n\tconst sanitized = input.replace(/[^\\w]/g, \"\");\n\treturn sanitized.length > 0 ? sanitized : createSyntheticIdentifier(input);\n}\nfunction capitalize(word) {\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}\nfunction snakeToPascalCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return capitalize(sanitizeIdentifierCharacters(input));\n\treturn parts.map(capitalize).join(\"\");\n}\nfunction snakeToCamelCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return sanitizeIdentifierCharacters(input);\n\tconst [firstPart = input, ...rest] = parts;\n\treturn firstPart.charAt(0).toLowerCase() + firstPart.slice(1) + rest.map(capitalize).join(\"\");\n}\nfunction needsEscaping(name) {\n\treturn PSL_RESERVED_WORDS.has(name.toLowerCase()) || /^\\d/.test(name);\n}\nfunction escapeName(name) {\n\treturn `_${name}`;\n}\nfunction escapeIfNeeded(name) {\n\treturn needsEscaping(name) ? escapeName(name) : name;\n}\nfunction toModelName(tableName) {\n\tlet name;\n\tif (hasSeparators(tableName)) name = snakeToPascalCase(tableName);\n\telse name = tableName.charAt(0).toUpperCase() + tableName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: tableName\n\t};\n\tif (name !== tableName) return {\n\t\tname,\n\t\tmap: tableName\n\t};\n\treturn { name };\n}\nfunction toFieldName(columnName) {\n\tlet name;\n\tif (hasSeparators(columnName)) name = snakeToCamelCase(columnName);\n\telse name = columnName.charAt(0).toLowerCase() + columnName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: columnName\n\t};\n\tif (name !== columnName) return {\n\t\tname,\n\t\tmap: columnName\n\t};\n\treturn { name };\n}\nfunction toEnumName(pgTypeName) {\n\tlet name;\n\tif (hasSeparators(pgTypeName)) name = snakeToPascalCase(pgTypeName);\n\telse name = pgTypeName.charAt(0).toUpperCase() + pgTypeName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: pgTypeName\n\t};\n\tif (name !== pgTypeName) return {\n\t\tname,\n\t\tmap: pgTypeName\n\t};\n\treturn { name };\n}\nconst VALID_IDENTIFIER_PATTERN = /^[A-Za-z_]\\w*$/;\n/**\n* PSL member name for a native-enum value. The value itself always prints\n* explicitly (`member = \"value\"`), so the returned name never needs a map:\n* a value that already is a valid, non-reserved identifier is kept verbatim\n* (case included); anything else is camelCased/escaped like a field name.\n*/\nfunction toEnumMemberName(value) {\n\tif (VALID_IDENTIFIER_PATTERN.test(value) && !needsEscaping(value)) return value;\n\treturn escapeIfNeeded(snakeToCamelCase(value));\n}\nfunction pluralize(word) {\n\treturn pluralizeLib.plural(word);\n}\nfunction deriveRelationFieldName(fkColumns, referencedTableName) {\n\tif (fkColumns.length === 1) {\n\t\tconst [col = referencedTableName] = fkColumns;\n\t\tconst stripped = col.replace(/_id$/i, \"\").replace(/Id$/, \"\");\n\t\tif (stripped.length > 0 && stripped !== col) return escapeIfNeeded(snakeToCamelCase(stripped));\n\t\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n\t}\n\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n}\nfunction deriveBackRelationFieldName(childModelName, isOneToOne) {\n\tconst base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);\n\treturn isOneToOne ? base : pluralize(base);\n}\n//#endregion\n//#region src/core/psl-contract-infer/raw-default-parser.ts\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\nconst NUMERIC_PATTERN = /^-?\\d+(\\.\\d+)?$/;\nconst JSON_CAST_SUFFIX = /::jsonb?$/i;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:\"[^\"]+\"|[\\w\\s]+)(?:\\(\\d+\\))?)?$/;\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\nfunction parseRawDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed) || UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tif (NUMERIC_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: Number(trimmed)\n\t};\n\tconst stringMatch = trimmed.match(STRING_LITERAL_PATTERN);\n\tif (stringMatch?.[1] !== void 0) {\n\t\tconst unescaped = stringMatch[1].replace(/''/g, \"'\");\n\t\tif (normalizedType === \"json\" || normalizedType === \"jsonb\") {\n\t\t\tif (JSON_CAST_SUFFIX.test(trimmed)) return {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: trimmed\n\t\t\t};\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"literal\",\n\t\t\t\t\tvalue: JSON.parse(unescaped)\n\t\t\t\t};\n\t\t\t} catch {}\n\t\t}\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: unescaped\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n//#endregion\n//#region src/core/psl-contract-infer/relation-inference.ts\nconst DEFAULT_ON_DELETE = \"noAction\";\nconst DEFAULT_ON_UPDATE = \"noAction\";\nconst REFERENTIAL_ACTION_PSL = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction inferRelations(tables, modelNameMap) {\n\tconst relationsByTable = /* @__PURE__ */ new Map();\n\tconst fkCountByPair = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst pairKey = `${table.name}→${fk.referencedTable}`;\n\t\tfkCountByPair.set(pairKey, (fkCountByPair.get(pairKey) ?? 0) + 1);\n\t}\n\tconst usedFieldNames = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tfor (const col of Object.values(table.columns)) names.add(col.name);\n\t\tusedFieldNames.set(table.name, names);\n\t}\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst childTableName = table.name;\n\t\tconst parentTableName = fk.referencedTable;\n\t\tconst childUsed = usedFieldNames.get(childTableName);\n\t\tconst childModelName = modelNameMap.get(childTableName) ?? childTableName;\n\t\tconst parentModelName = modelNameMap.get(parentTableName) ?? parentTableName;\n\t\tconst pairKey = `${childTableName}→${parentTableName}`;\n\t\tconst isSelfRelation = childTableName === parentTableName;\n\t\tconst needsRelationName = fkCountByPair.get(pairKey) > 1 || isSelfRelation;\n\t\tconst isOneToOne = detectOneToOne(fk, table);\n\t\tconst childRelFieldName = resolveUniqueFieldName(deriveRelationFieldName(fk.columns, parentTableName), childUsed, parentModelName);\n\t\tconst relationName = needsRelationName ? deriveRelationName(fk, childRelFieldName, parentModelName, isSelfRelation) : void 0;\n\t\taddRelationField(relationsByTable, childTableName, buildChildRelationField(childRelFieldName, parentModelName, fk, fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false), relationName, table));\n\t\tchildUsed.add(childRelFieldName);\n\t\tconst parentUsed = usedFieldNames.get(parentTableName) ?? /* @__PURE__ */ new Set();\n\t\tusedFieldNames.set(parentTableName, parentUsed);\n\t\tconst backRelFieldName = resolveUniqueFieldName(deriveBackRelationFieldName(childModelName, isOneToOne), parentUsed, childModelName);\n\t\taddRelationField(relationsByTable, parentTableName, {\n\t\t\tfieldName: backRelFieldName,\n\t\t\ttypeName: childModelName,\n\t\t\toptional: isOneToOne,\n\t\t\tlist: !isOneToOne,\n\t\t\trelationName\n\t\t});\n\t\tparentUsed.add(backRelFieldName);\n\t}\n\treturn { relationsByTable };\n}\nfunction detectOneToOne(fk, table) {\n\tconst fkCols = [...fk.columns].sort();\n\tif (table.primaryKey) {\n\t\tconst pkCols = [...table.primaryKey.columns].sort();\n\t\tif (pkCols.length === fkCols.length && pkCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const unique of table.uniques) {\n\t\tconst uniqueCols = [...unique.columns].sort();\n\t\tif (uniqueCols.length === fkCols.length && uniqueCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const index of table.indexes) {\n\t\tif (!index.unique || index.partial || index.columns === void 0) continue;\n\t\tconst indexCols = [...index.columns].sort();\n\t\tif (indexCols.length === fkCols.length && indexCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\treturn false;\n}\nfunction deriveRelationName(fk, childRelationFieldName, parentModelName, isSelfRelation) {\n\tif (fk.name) return fk.name;\n\tif (isSelfRelation) return `${childRelationFieldName.charAt(0).toUpperCase() + childRelationFieldName.slice(1)}${pluralize(parentModelName)}`;\n\treturn fk.columns.join(\"_\");\n}\n/**\n* Builds the child-side {@link RelationField} for a single foreign key:\n* `typeName` is the parent model name, `fields`/`references` are the FK's raw\n* columns, and `onDelete`/`onUpdate` are normalized to their PSL spelling.\n* Exported so a caller resolving a foreign key against a model outside\n* `tables` (e.g. a cross-space reference into another contract) can reuse the\n* same normalization instead of duplicating it.\n*\n* `hostTable` is the table the FK is declared on (i.e. `table`, not the\n* referenced parent) — its own indexes/uniques/primary key are what a\n* backing index for this FK would be. When none of them exactly match the\n* FK's source columns (in order), `index: false` is stamped so the emitted\n* `@relation` opts out of the framework's default derived backing-index\n* expectation, matching what `db verify` will find live. Passing the table\n* is optional so existing single-FK callers (e.g. cross-space resolution\n* before a host table reference is threaded through) can omit it and keep\n* the framework default.\n*/\nfunction buildChildRelationField(fieldName, parentModelName, fk, optional, relationName, hostTable) {\n\tconst onDelete = fk.onDelete && fk.onDelete !== DEFAULT_ON_DELETE ? fk.onDelete : void 0;\n\tconst onUpdate = fk.onUpdate && fk.onUpdate !== DEFAULT_ON_UPDATE ? fk.onUpdate : void 0;\n\tconst index = hostTable && !isBackedByColumnKeys(fk.columns, backingIndexColumnKeys({\n\t\tindexes: hostTable.indexes.filter((i) => i.where === void 0),\n\t\tuniques: hostTable.uniques,\n\t\tprimaryKey: hostTable.primaryKey\n\t})) ? false : void 0;\n\treturn {\n\t\tfieldName,\n\t\ttypeName: parentModelName,\n\t\treferencedTableName: fk.referencedTable,\n\t\toptional,\n\t\tlist: false,\n\t\trelationName,\n\t\tfkName: fk.name,\n\t\tfields: fk.columns,\n\t\treferences: fk.referencedColumns,\n\t\tonDelete: onDelete ? REFERENTIAL_ACTION_PSL[onDelete] : void 0,\n\t\tonUpdate: onUpdate ? REFERENTIAL_ACTION_PSL[onUpdate] : void 0,\n\t\tindex\n\t};\n}\nfunction resolveUniqueFieldName(desired, usedNames, fallbackSuffix) {\n\tif (!usedNames.has(desired)) return desired;\n\tconst withSuffix = `${desired}${fallbackSuffix}`;\n\tif (!usedNames.has(withSuffix)) return withSuffix;\n\tlet counter = 2;\n\twhile (usedNames.has(`${desired}${counter}`)) counter++;\n\treturn `${desired}${counter}`;\n}\nfunction addRelationField(map, tableName, field) {\n\tconst existing = map.get(tableName);\n\tif (existing) existing.push(field);\n\telse map.set(tableName, [field]);\n}\n//#endregion\nexport { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };\n\n//# sourceMappingURL=psl-infer.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B;CACnC,mBAAmB;CACnB,SAAS;AACV;AACA,SAAS,WAAW,eAAe,SAAS;CAC3C,QAAQ,cAAc,MAAtB;EACC,KAAK,WAAW,OAAO,EAAE,WAAW,YAAY,mBAAmB,cAAc,KAAK,EAAE,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UAAU;CACvB,CAAC,CAAC,IAAI,QAAQ,KAAK;CACnB,OAAO;EACN;EACA,UAAU;EACV,qBAAqB,GAAG;EACxB;EACA,MAAM;EACN;EACA,QAAQ,GAAG;EACX,QAAQ,GAAG;EACX,YAAY,GAAG;EACf,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D;CACD;AACD;AACA,SAAS,uBAAuB,SAAS,WAAW,gBAAgB;CACnE,IAAI,CAAC,UAAU,IAAI,OAAO,GAAG,OAAO;CACpC,MAAM,aAAa,GAAG,UAAU;CAChC,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,OAAO;CACvC,IAAI,UAAU;CACd,OAAO,UAAU,IAAI,GAAG,UAAU,SAAS,GAAG;CAC9C,OAAO,GAAG,UAAU;AACrB;AACA,SAAS,iBAAiB,KAAK,WAAW,OAAO;CAChD,MAAM,WAAW,IAAI,IAAI,SAAS;CAClC,IAAI,UAAU,SAAS,KAAK,KAAK;MAC5B,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC;AAChC"}
1
+ {"version":3,"file":"psl-infer-Dk5kgKre.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.mjs"],"sourcesContent":["import pluralizeLib from \"pluralize\";\nimport { backingIndexColumnKeys, isBackedByColumnKeys } from \"@internal/sql-contract/foreign-key-materialization\";\n//#region src/core/psl-contract-infer/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return { attribute: `@default(${formatLiteralValue(columnDefault.value)})` };\n\t\tcase \"function\": {\n\t\t\tconst attribute = options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? options?.fallbackFunctionAttribute?.(columnDefault.expression);\n\t\t\treturn attribute ? { attribute } : { comment: `// Raw default: ${columnDefault.expression.replace(/[\\r\\n]+/g, \" \")}` };\n\t\t}\n\t}\n}\nfunction formatLiteralValue(value) {\n\tif (value === null) return \"null\";\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\tcase \"number\": return String(value);\n\t\tcase \"string\": return quoteString(value);\n\t\tdefault: return quoteString(JSON.stringify(value));\n\t}\n}\nfunction quoteString(str) {\n\treturn `\"${escapeString(str)}\"`;\n}\nfunction escapeString(str) {\n\treturn JSON.stringify(str).slice(1, -1);\n}\n//#endregion\n//#region src/core/psl-contract-infer/name-transforms.ts\nconst PSL_RESERVED_WORDS = /* @__PURE__ */ new Set([\n\t\"model\",\n\t\"enum\",\n\t\"types\",\n\t\"type\",\n\t\"generator\",\n\t\"datasource\"\n]);\nconst IDENTIFIER_PART_PATTERN = /[A-Za-z0-9]+/g;\nfunction hasSeparators(input) {\n\treturn /[^A-Za-z0-9]/.test(input);\n}\nfunction extractIdentifierParts(input) {\n\treturn input.match(IDENTIFIER_PART_PATTERN) ?? [];\n}\nfunction createSyntheticIdentifier(input) {\n\tlet hash = 2166136261;\n\tfor (const char of input) {\n\t\thash ^= char.codePointAt(0) ?? 0;\n\t\thash = Math.imul(hash, 16777619);\n\t}\n\treturn `x${(hash >>> 0).toString(16)}`;\n}\nfunction sanitizeIdentifierCharacters(input) {\n\tconst sanitized = input.replace(/[^\\w]/g, \"\");\n\treturn sanitized.length > 0 ? sanitized : createSyntheticIdentifier(input);\n}\nfunction capitalize(word) {\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}\nfunction snakeToPascalCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return capitalize(sanitizeIdentifierCharacters(input));\n\treturn parts.map(capitalize).join(\"\");\n}\nfunction snakeToCamelCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return sanitizeIdentifierCharacters(input);\n\tconst [firstPart = input, ...rest] = parts;\n\treturn firstPart.charAt(0).toLowerCase() + firstPart.slice(1) + rest.map(capitalize).join(\"\");\n}\nfunction needsEscaping(name) {\n\treturn PSL_RESERVED_WORDS.has(name.toLowerCase()) || /^\\d/.test(name);\n}\nfunction escapeName(name) {\n\treturn `_${name}`;\n}\nfunction escapeIfNeeded(name) {\n\treturn needsEscaping(name) ? escapeName(name) : name;\n}\nfunction toModelName(tableName) {\n\tlet name;\n\tif (hasSeparators(tableName)) name = snakeToPascalCase(tableName);\n\telse name = tableName.charAt(0).toUpperCase() + tableName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: tableName\n\t};\n\tif (name !== tableName) return {\n\t\tname,\n\t\tmap: tableName\n\t};\n\treturn { name };\n}\nfunction toFieldName(columnName) {\n\tlet name;\n\tif (hasSeparators(columnName)) name = snakeToCamelCase(columnName);\n\telse name = columnName.charAt(0).toLowerCase() + columnName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: columnName\n\t};\n\tif (name !== columnName) return {\n\t\tname,\n\t\tmap: columnName\n\t};\n\treturn { name };\n}\nfunction toEnumName(pgTypeName) {\n\tlet name;\n\tif (hasSeparators(pgTypeName)) name = snakeToPascalCase(pgTypeName);\n\telse name = pgTypeName.charAt(0).toUpperCase() + pgTypeName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: pgTypeName\n\t};\n\tif (name !== pgTypeName) return {\n\t\tname,\n\t\tmap: pgTypeName\n\t};\n\treturn { name };\n}\nconst VALID_IDENTIFIER_PATTERN = /^[A-Za-z_]\\w*$/;\n/**\n* PSL member name for a native-enum value. The value itself always prints\n* explicitly (`member = \"value\"`), so the returned name never needs a map:\n* a value that already is a valid, non-reserved identifier is kept verbatim\n* (case included); anything else is camelCased/escaped like a field name.\n*/\nfunction toEnumMemberName(value) {\n\tif (VALID_IDENTIFIER_PATTERN.test(value) && !needsEscaping(value)) return value;\n\treturn escapeIfNeeded(snakeToCamelCase(value));\n}\nfunction pluralize(word) {\n\treturn pluralizeLib.plural(word);\n}\nfunction deriveRelationFieldName(fkColumns, referencedTableName) {\n\tif (fkColumns.length === 1) {\n\t\tconst [col = referencedTableName] = fkColumns;\n\t\tconst stripped = col.replace(/_id$/i, \"\").replace(/Id$/, \"\");\n\t\tif (stripped.length > 0 && stripped !== col) return escapeIfNeeded(snakeToCamelCase(stripped));\n\t\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n\t}\n\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n}\nfunction deriveBackRelationFieldName(childModelName, isOneToOne) {\n\tconst base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);\n\treturn isOneToOne ? base : pluralize(base);\n}\n//#endregion\n//#region src/core/psl-contract-infer/raw-default-parser.ts\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\nconst NUMERIC_PATTERN = /^-?\\d+(\\.\\d+)?$/;\nconst JSON_CAST_SUFFIX = /::jsonb?$/i;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:\"[^\"]+\"|[\\w\\s]+)(?:\\(\\d+\\))?)?$/;\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\nfunction parseRawDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed) || UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tif (NUMERIC_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: Number(trimmed)\n\t};\n\tconst stringMatch = trimmed.match(STRING_LITERAL_PATTERN);\n\tif (stringMatch?.[1] !== void 0) {\n\t\tconst unescaped = stringMatch[1].replace(/''/g, \"'\");\n\t\tif (normalizedType === \"json\" || normalizedType === \"jsonb\") {\n\t\t\tif (JSON_CAST_SUFFIX.test(trimmed)) return {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: trimmed\n\t\t\t};\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"literal\",\n\t\t\t\t\tvalue: JSON.parse(unescaped)\n\t\t\t\t};\n\t\t\t} catch {}\n\t\t}\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: unescaped\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n//#endregion\n//#region src/core/psl-contract-infer/relation-inference.ts\nconst DEFAULT_ON_DELETE = \"noAction\";\nconst DEFAULT_ON_UPDATE = \"noAction\";\nconst REFERENTIAL_ACTION_PSL = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction inferRelations(tables, modelNameMap) {\n\tconst relationsByTable = /* @__PURE__ */ new Map();\n\tconst fkCountByPair = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst pairKey = `${table.name}→${fk.referencedTable}`;\n\t\tfkCountByPair.set(pairKey, (fkCountByPair.get(pairKey) ?? 0) + 1);\n\t}\n\tconst usedFieldNames = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tfor (const col of Object.values(table.columns)) names.add(col.name);\n\t\tusedFieldNames.set(table.name, names);\n\t}\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst childTableName = table.name;\n\t\tconst parentTableName = fk.referencedTable;\n\t\tconst childUsed = usedFieldNames.get(childTableName);\n\t\tconst childModelName = modelNameMap.get(childTableName) ?? childTableName;\n\t\tconst parentModelName = modelNameMap.get(parentTableName) ?? parentTableName;\n\t\tconst pairKey = `${childTableName}→${parentTableName}`;\n\t\tconst isSelfRelation = childTableName === parentTableName;\n\t\tconst needsRelationName = fkCountByPair.get(pairKey) > 1 || isSelfRelation;\n\t\tconst isOneToOne = detectOneToOne(fk, table);\n\t\tconst childRelFieldName = resolveUniqueFieldName(deriveRelationFieldName(fk.columns, parentTableName), childUsed, parentModelName);\n\t\tconst relationName = needsRelationName ? deriveRelationName(fk, childRelFieldName, parentModelName, isSelfRelation) : void 0;\n\t\taddRelationField(relationsByTable, childTableName, buildChildRelationField(childRelFieldName, parentModelName, fk, fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false), relationName, table));\n\t\tchildUsed.add(childRelFieldName);\n\t\tconst parentUsed = usedFieldNames.get(parentTableName) ?? /* @__PURE__ */ new Set();\n\t\tusedFieldNames.set(parentTableName, parentUsed);\n\t\tconst backRelFieldName = resolveUniqueFieldName(deriveBackRelationFieldName(childModelName, isOneToOne), parentUsed, childModelName);\n\t\taddRelationField(relationsByTable, parentTableName, {\n\t\t\tfieldName: backRelFieldName,\n\t\t\ttypeName: childModelName,\n\t\t\toptional: isOneToOne,\n\t\t\tlist: !isOneToOne,\n\t\t\trelationName\n\t\t});\n\t\tparentUsed.add(backRelFieldName);\n\t}\n\treturn { relationsByTable };\n}\nfunction detectOneToOne(fk, table) {\n\tconst fkCols = [...fk.columns].sort();\n\tif (table.primaryKey) {\n\t\tconst pkCols = [...table.primaryKey.columns].sort();\n\t\tif (pkCols.length === fkCols.length && pkCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const unique of table.uniques) {\n\t\tconst uniqueCols = [...unique.columns].sort();\n\t\tif (uniqueCols.length === fkCols.length && uniqueCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const index of table.indexes) {\n\t\tif (!index.unique || index.partial || index.columns === void 0) continue;\n\t\tconst indexCols = [...index.columns].sort();\n\t\tif (indexCols.length === fkCols.length && indexCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\treturn false;\n}\nfunction deriveRelationName(fk, childRelationFieldName, parentModelName, isSelfRelation) {\n\tif (fk.name) return fk.name;\n\tif (isSelfRelation) return `${childRelationFieldName.charAt(0).toUpperCase() + childRelationFieldName.slice(1)}${pluralize(parentModelName)}`;\n\treturn fk.columns.join(\"_\");\n}\n/**\n* Builds the child-side {@link RelationField} for a single foreign key:\n* `typeName` is the parent model name, `fields`/`references` are the FK's raw\n* columns, and `onDelete`/`onUpdate` are normalized to their PSL spelling.\n* Exported so a caller resolving a foreign key against a model outside\n* `tables` (e.g. a cross-space reference into another contract) can reuse the\n* same normalization instead of duplicating it.\n*\n* `hostTable` is the table the FK is declared on (i.e. `table`, not the\n* referenced parent) — its own indexes/uniques/primary key are what a\n* backing index for this FK would be. When none of them exactly match the\n* FK's source columns (in order), `index: false` is stamped so the emitted\n* `@relation` opts out of the framework's default derived backing-index\n* expectation, matching what `db verify` will find live. Passing the table\n* is optional so existing single-FK callers (e.g. cross-space resolution\n* before a host table reference is threaded through) can omit it and keep\n* the framework default.\n*/\nfunction buildChildRelationField(fieldName, parentModelName, fk, optional, relationName, hostTable) {\n\tconst onDelete = fk.onDelete && fk.onDelete !== DEFAULT_ON_DELETE ? fk.onDelete : void 0;\n\tconst onUpdate = fk.onUpdate && fk.onUpdate !== DEFAULT_ON_UPDATE ? fk.onUpdate : void 0;\n\tconst index = hostTable && !isBackedByColumnKeys(fk.columns, backingIndexColumnKeys({\n\t\tindexes: hostTable.indexes.filter((i) => i.where === void 0),\n\t\tuniques: hostTable.uniques,\n\t\tprimaryKey: hostTable.primaryKey\n\t})) ? false : void 0;\n\treturn {\n\t\tfieldName,\n\t\ttypeName: parentModelName,\n\t\treferencedTableName: fk.referencedTable,\n\t\toptional,\n\t\tlist: false,\n\t\trelationName,\n\t\tfkName: fk.name,\n\t\tfields: fk.columns,\n\t\treferences: fk.referencedColumns,\n\t\tonDelete: onDelete ? REFERENTIAL_ACTION_PSL[onDelete] : void 0,\n\t\tonUpdate: onUpdate ? REFERENTIAL_ACTION_PSL[onUpdate] : void 0,\n\t\tindex\n\t};\n}\nfunction resolveUniqueFieldName(desired, usedNames, fallbackSuffix) {\n\tif (!usedNames.has(desired)) return desired;\n\tconst withSuffix = `${desired}${fallbackSuffix}`;\n\tif (!usedNames.has(withSuffix)) return withSuffix;\n\tlet counter = 2;\n\twhile (usedNames.has(`${desired}${counter}`)) counter++;\n\treturn `${desired}${counter}`;\n}\nfunction addRelationField(map, tableName, field) {\n\tconst existing = map.get(tableName);\n\tif (existing) existing.push(field);\n\telse map.set(tableName, [field]);\n}\n//#endregion\nexport { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };\n\n//# sourceMappingURL=psl-infer.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B;CACnC,mBAAmB;CACnB,SAAS;AACV;AACA,SAAS,WAAW,eAAe,SAAS;CAC3C,QAAQ,cAAc,MAAtB;EACC,KAAK,WAAW,OAAO,EAAE,WAAW,YAAY,mBAAmB,cAAc,KAAK,EAAE,GAAG;EAC3F,KAAK,YAAY;GAChB,MAAM,YAAY,SAAS,qBAAqB,cAAc,eAAe,4BAA4B,cAAc,eAAe,SAAS,4BAA4B,cAAc,UAAU;GACnM,OAAO,YAAY,EAAE,UAAU,IAAI,EAAE,SAAS,mBAAmB,cAAc,WAAW,QAAQ,YAAY,GAAG,IAAI;EACtH;CACD;AACD;AACA,SAAS,mBAAmB,OAAO;CAClC,IAAI,UAAU,MAAM,OAAO;CAC3B,QAAQ,OAAO,OAAf;EACC,KAAK;EACL,KAAK,UAAU,OAAO,OAAO,KAAK;EAClC,KAAK,UAAU,OAAO,YAAY,KAAK;EACvC,SAAS,OAAO,YAAY,KAAK,UAAU,KAAK,CAAC;CAClD;AACD;AACA,SAAS,YAAY,KAAK;CACzB,OAAO,IAAI,aAAa,GAAG,EAAE;AAC9B;AACA,SAAS,aAAa,KAAK;CAC1B,OAAO,KAAK,UAAU,GA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AAM,WAAW,IAAI,IAAI,SAAS;CAClC,IAAI,UAAU,SAAS,KAAK,KAAK;MAC5B,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC;AAChC"}
@@ -1,11 +1,11 @@
1
1
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
2
  import "./types-UcHa2cTe.mjs";
3
3
  import { a as SqlOperationRegistry } from "./index-C5I8D-MB.mjs";
4
- import { O as ContractCodecRegistry, s as AnyExpression } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
4
+ import { O as ContractCodecRegistry, s as AnyExpression } from "./types-v3qxLLxo-DCeKv7yY.mjs";
5
5
  import { Contract } from "@prisma/orm-framework/contract/types";
6
6
  import { AggregateDescriptor, AggregateResultNullability } from "@prisma/orm-framework/components/components";
7
7
  import { CodecDescriptor, CodecRef } from "@prisma/orm-framework/components/codec";
8
- //#region ../../../2-sql/4-lanes/relational-core/dist/query-lane-context-gwWUcacE.d.mts
8
+ //#region ../../../2-sql/4-lanes/relational-core/dist/query-lane-context-Qa-eddrE.d.mts
9
9
  //#region src/aggregate-descriptor.d.ts
10
10
  /**
11
11
  * What a lowering hook is handed: the expression being aggregated (absent for operations that consume no value) and the codec of that expression.
@@ -148,4 +148,4 @@ interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<Sql
148
148
  }
149
149
  //#endregion
150
150
  export { MutationDefaultsOptions as a, SqlAggregateDescriptorRegistry as c, TypeHelperRegistry as d, isSqlAggregateDescriptor as f, MutationDefaultsOp as i, SqlAggregateLowering as l, CodecDescriptorRegistry as n, ResolvedSqlAggregate as o, ExecutionContext as r, SqlAggregateDescriptor as s, AppliedMutationDefault as t, SqlAggregateLoweringContext as u };
151
- //# sourceMappingURL=query-lane-context-gwWUcacE-DdWNrc8q.d.mts.map
151
+ //# sourceMappingURL=query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-lane-context-gwWUcacE-DdWNrc8q.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/query-lane-context-gwWUcacE.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC,MAAM;WACN,YAAY;;;;;;;KAOlB,wBAAwB,SAAS,gCAAgC;;;;;;;;KAQjE,yBAAyB;WACnB,QAAQ;;;iBAGF,yBAAyB,iBAAiB,SAAS;;;;;;UAM1D;;;;EAIR,cAAc,kBAAkB;;;;;;;;;;;;;;EAchC,kBAAkB,qBAAqB,eAAe,iBAAiB;;;;EAIvE,UAAU,iBAAiB;;;;EAI3B,aAAa,8BAA8B;;;;;;;KAOxC,uBAAuB;WACjB;WACA,QAAQ;WACR,OAAO;;;;;;;UAOR;;;;;;EAMR,QAAQ,mBAAmB,QAAQ,WAAW;;EAE9C,UAAU,iBAAiB;;;;;KAKxB,qBAAqB;KACrB;KACA;WACM;WACA;;KAEN;WACM,IAAI;WACJ;;;;;;;;WAQA;WACA,QAAQ;;;;;WAKR,oBAAoB;;;;;;;UAOrB,iBAAiB,kBAAkB,SAAS,cAAc,SAAS;WAClE,UAAU;;;;WAIV,gBAAgB;;;;WAIhB,kBAAkB;;;;WAIlB,sBAAsB;WACtB,iBAAiB;;;;WAIjB,OAAO;;;;EAIhB,sBAAsB,SAAS,0BAA0B,cAAc"}
1
+ {"version":3,"file":"query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/query-lane-context-Qa-eddrE.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC,MAAM;WACN,YAAY;;;;;;;KAOlB,wBAAwB,SAAS,gCAAgC;;;;;;;;KAQjE,yBAAyB;WACnB,QAAQ;;;iBAGF,yBAAyB,iBAAiB,SAAS;;;;;;UAM1D;;;;EAIR,cAAc,kBAAkB;;;;;;;;;;;;;;EAchC,kBAAkB,qBAAqB,eAAe,iBAAiB;;;;EAIvE,UAAU,iBAAiB;;;;EAI3B,aAAa,8BAA8B;;;;;;;KAOxC,uBAAuB;WACjB;WACA,QAAQ;WACR,OAAO;;;;;;;UAOR;;;;;;EAMR,QAAQ,mBAAmB,QAAQ,WAAW;;EAE9C,UAAU,iBAAiB;;;;;KAKxB,qBAAqB;KACrB;KACA;WACM;WACA;;KAEN;WACM,IAAI;WACJ;;;;;;;;WAQA;WACA,QAAQ;;;;;WAKR,oBAAoB;;;;;;;UAOrB,iBAAiB,kBAAkB,SAAS,cAAc,SAAS;WAClE,UAAU;;;;WAIV,gBAAgB;;;;WAIhB,kBAAkB;;;;WAIlB,sBAAsB;WACtB,iBAAiB;;;;WAIjB,OAAO;;;;EAIhB,sBAAsB,SAAS,0BAA0B,cAAc"}
@@ -0,0 +1 @@
1
+ import "./query-lane-context-Qa-eddrE-kuZ8Z86-.mjs";
@@ -1,13 +1,13 @@
1
- import { $ as JoinAst, A as DeleteAst, At as TableRef, B as ExistsExpr, Bt as isQueryAst, C as CodecDescriptor$1, Ct as RawSqlLiteral, D as ColumnRef, Dt as SqlCodecInstanceContext, E as CodecTrait$1, Et as SqlCodecCallContext, F as DescriptorCodecTraits, Ft as WindowFn, G as ExtractCodecTypes, H as ExpressionFolder, Ht as queryAstKinds, I as Direction, It as WindowFuncExpr, J as FunctionSourceAlias, K as FunctionCallExpr, L as DoNothingConflictAction, Lt as aggregateFnNames, M as DescriptorCodecId, Mt as ToWhereExpr, N as DescriptorCodecInput, Nt as UpdateAst, O as ContractCodecRegistry, Ot as SqlColumnRef, P as DescriptorCodecJson, Pt as WhereArg, Q as InsertValue, R as DoUpdateSetConflictAction, Rt as frozenCodecRef, S as CodecCallContext$1, St as RawSqlExpr, T as CodecRef$1, Tt as SelectAstOptions, U as ExpressionRewriter, Ut as whereExprKinds, V as ExprVisitor, Vt as isWhereExpr, W as ExpressionSource, X as InsertAst, Y as IdentifierRef, Z as InsertOnConflict, _ as BinaryOp, _t as ParamRef, a as AndExpr, at as JsonValueProjectionVisitor, b as CastExpr, bt as ProjectionItem, c as AnyFromSource, ct as LiteralExpr, d as AnyJsonValueProjection, dt as NativeJsonValueProjection, et as JoinOnExpr, f as AnyOperationArg, ft as NotExpr, g as BinaryExpr, gt as OrderByItem, h as AstRewriter, ht as OrExpr, i as AggregateOpFn, it as JsonObjectExpr, j as DerivedTableSource, jt as TableSource, k as DefaultValueExpr, kt as SubqueryExpr, l as AnyInsertOnConflictAction, lt as LoweredParam, m as AnyQueryAst, mt as OperationExpr, n as AggregateExpr, nt as JsonDocumentProjection, o as AnyCodecDescriptor, ot as LimitOffsetValue, p as AnyParamRef, pt as NullCheckExpr, q as FunctionSource, r as AggregateFn, rt as JsonObjectEntry, s as AnyExpression, st as ListExpression, t as AggregateCountFn, tt as JsonArrayAggExpr, u as AnyInsertValue, ut as LoweredStatement, v as CaseBranch, vt as PreparedParamRef, w as CodecJsonValueProjection, wt as SelectAst, x as Codec$1, xt as RawExpr, y as CaseExpr, yt as ProjectionExpr, z as EqColJoinOn, zt as isAggregateFn } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
1
+ import { $ as JoinAst, A as DeleteAst, At as SqlColumnRef, B as ExistsExpr, Bt as frozenCodecRef, C as CodecDescriptor$1, Ct as RawQueryColumn, D as ColumnRef, Dt as SelectAstOptions, E as CodecTrait$1, Et as SelectAst, F as DescriptorCodecTraits, Ft as UpdateAst, G as ExtractCodecTypes, Gt as whereExprKinds, H as ExpressionFolder, Ht as isQueryAst, I as Direction, It as WhereArg, J as FunctionSourceAlias, K as FunctionCallExpr, L as DoNothingConflictAction, Lt as WindowFn, M as DescriptorCodecId, Mt as TableRef, N as DescriptorCodecInput, Nt as TableSource, O as ContractCodecRegistry, Ot as SqlCodecCallContext, P as DescriptorCodecJson, Pt as ToWhereExpr, Q as InsertValue, R as DoUpdateSetConflictAction, Rt as WindowFuncExpr, S as CodecCallContext$1, St as RawQueryAst, T as CodecRef$1, Tt as RawSqlLiteral, U as ExpressionRewriter, Ut as isWhereExpr, V as ExprVisitor, Vt as isAggregateFn, W as ExpressionSource, Wt as queryAstKinds, X as InsertAst, Y as IdentifierRef, Z as InsertOnConflict, _ as BinaryOp, _t as ParamRef, a as AndExpr, at as JsonValueProjectionVisitor, b as CastExpr, bt as ProjectionItem, c as AnyFromSource, ct as LiteralExpr, d as AnyJsonValueProjection, dt as NativeJsonValueProjection, et as JoinOnExpr, f as AnyOperationArg, ft as NotExpr, g as BinaryExpr, gt as OrderByItem, h as AstRewriter, ht as OrExpr, i as AggregateOpFn, it as JsonObjectExpr, j as DerivedTableSource, jt as SubqueryExpr, k as DefaultValueExpr, kt as SqlCodecInstanceContext, l as AnyInsertOnConflictAction, lt as LoweredParam, m as AnyQueryAst, mt as OperationExpr, n as AggregateExpr, nt as JsonDocumentProjection, o as AnyCodecDescriptor, ot as LimitOffsetValue, p as AnyParamRef, pt as NullCheckExpr, q as FunctionSource, r as AggregateFn, rt as JsonObjectEntry, s as AnyExpression, st as ListExpression, t as AggregateCountFn, tt as JsonArrayAggExpr, u as AnyInsertValue, ut as LoweredStatement, v as CaseBranch, vt as PreparedParamRef, w as CodecJsonValueProjection, wt as RawQueryResult, x as Codec$1, xt as RawExpr, y as CaseExpr, yt as ProjectionExpr, z as EqColJoinOn, zt as aggregateFnNames } from "./types-v3qxLLxo-DCeKv7yY.mjs";
2
2
  import { a as SqlDriverState, c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, n as PreparedStatementHandle, o as SqlExecuteRequest, r as SqlConnection, s as SqlExplainResult, t as PreparedExecuteRequest, u as SqlTransaction } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
3
- import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "./ddl-types-BtT82FGO-Du_-9SlZ.mjs";
4
- import { $ as sqlVarcharColumn, A as sqlCharEncode, B as sqlIntDescriptor, C as SqlVarcharCodec, D as sqlCharColumn, E as compact, F as sqlFloatDescriptor, G as sqlTextEncode, H as sqlTextColumn, I as sqlFloatEncode, J as sqlTimestampDecodeJson, K as sqlTimestampColumn, L as sqlFloatEncodeJson, M as sqlFloatColumn, N as sqlFloatDecode, O as sqlCharDecode, P as sqlFloatDecodeJson, Q as sqlTimestampRenderOutputType, R as sqlIntColumn, S as SqlTimestampDescriptor, T as collectOrderedParamRefs, U as sqlTextDecode, V as sqlIntEncode, W as sqlTextDescriptor, X as sqlTimestampEncode, Y as sqlTimestampDescriptor, Z as sqlTimestampEncodeJson, _ as SqlIntCodec, a as LowererContext, b as SqlTextDescriptor, c as SQL_FLOAT_CODEC_ID, d as SQL_TIMESTAMP_CODEC_ID, et as sqlVarcharDecode, f as SQL_VARCHAR_CODEC_ID, g as SqlFloatDescriptor, h as SqlFloatCodec, i as Lowerer, j as sqlCharRenderOutputType, k as sqlCharDescriptor, l as SQL_INT_CODEC_ID, m as SqlCharDescriptor, n as AdapterProfile, nt as sqlVarcharEncode, o as MarkerReadResult, p as SqlCharCodec, q as sqlTimestampDecode, r as AdapterTarget, rt as sqlVarcharRenderOutputType, s as SQL_CHAR_CODEC_ID, t as Adapter, tt as sqlVarcharDescriptor, u as SQL_TEXT_CODEC_ID, v as SqlIntDescriptor, w as SqlVarcharDescriptor, x as SqlTimestampCodec, y as SqlTextCodec, z as sqlIntDecode } from "./ast-D8qqdDX_.mjs";
5
- import { a as Expression, c as RawSqlTag, d as TraitExpression, f as buildOperation, g as toExpr, h as param, i as CodecValue, l as ScalarListExpression, m as createRawSql, n as CodecExpression, o as RawCodecInferer, p as codecOf, r as CodecTypesBase, s as RawSqlBuilder, t as BuildOperationSpec, u as ScopeField } from "./expression-Q_yaDQPb.mjs";
6
- import { t as SqlExecutionPlan } from "./sql-execution-plan-D0ZTnszb-DnCRtfQO.mjs";
7
- import { n as planFromAst, t as SqlQueryPlan } from "./plan-BC_trt1i-In5gOKCT.mjs";
8
- import "./plan-DrOMooQt.mjs";
9
- import { a as MutationDefaultsOptions, c as SqlAggregateDescriptorRegistry, d as TypeHelperRegistry, i as MutationDefaultsOp, n as CodecDescriptorRegistry, o as ResolvedSqlAggregate, r as ExecutionContext, t as AppliedMutationDefault } from "./query-lane-context-gwWUcacE-DdWNrc8q.mjs";
10
- import "./query-lane-context-D62vkQhf.mjs";
11
- import { a as SqlParamRefMutatorInternal, i as SqlParamRefMutator, n as ParamRefEntryUnion, o as createSqlParamRefMutator, r as ParamRefHandle, t as ParamRefEntry } from "./middleware-BS7u8VFR-DyUcAFid.mjs";
12
- import { C as TableDef, E as TablesOf, S as SqlPlan, T as TableMetadata, _ as RawTemplateFactory, a as ColumnsOf, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnResolutionContract, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as ComputeColumnJsType, p as OperationTypes, r as CodecTypes, s as Expr, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableKey, x as SqlOrmPlan, y as RuntimeScope } from "./types-C9FZXc9Q-C6LM1k-O.mjs";
13
- export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, CodecTypes, CodecTypesBase, CodecValue, ColumnRef, ColumnResolutionContract, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, META, MarkerReadResult, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, type ParamRefEntry, type ParamRefEntryUnion, type ParamRefHandle, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawCodecInferer, RawExpr, RawFactory, RawFunctionOptions, RawSqlBuilder, RawSqlExpr, RawSqlLiteral, RawSqlTag, RawTemplateFactory, RawTemplateOptions, ResolvedSqlAggregate, type RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScalarListExpression, ScopeField, SelectAst, SelectAstOptions, SqlAggregateDescriptorRegistry, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, type SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, type SqlOrmPlan, type SqlParamRefMutator, type SqlParamRefMutatorInternal, SqlPlan, SqlQueryPlan, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, buildOperation, codecOf, collectOrderedParamRefs, compact, createRawSql, createSqlParamRefMutator, frozenCodecRef, isAggregateFn, isDdlNode, isQueryAst, isWhereExpr, param, planFromAst, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };
3
+ import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "./ddl-types-CXx4vPz6-BsgrnSUY.mjs";
4
+ import { $ as sqlVarcharColumn, A as sqlCharEncode, B as sqlIntDescriptor, C as SqlVarcharCodec, D as sqlCharColumn, E as compact, F as sqlFloatDescriptor, G as sqlTextEncode, H as sqlTextColumn, I as sqlFloatEncode, J as sqlTimestampDecodeJson, K as sqlTimestampColumn, L as sqlFloatEncodeJson, M as sqlFloatColumn, N as sqlFloatDecode, O as sqlCharDecode, P as sqlFloatDecodeJson, Q as sqlTimestampRenderOutputType, R as sqlIntColumn, S as SqlTimestampDescriptor, T as collectOrderedParamRefs, U as sqlTextDecode, V as sqlIntEncode, W as sqlTextDescriptor, X as sqlTimestampEncode, Y as sqlTimestampDescriptor, Z as sqlTimestampEncodeJson, _ as SqlIntCodec, a as LowererContext, b as SqlTextDescriptor, c as SQL_FLOAT_CODEC_ID, d as SQL_TIMESTAMP_CODEC_ID, et as sqlVarcharDecode, f as SQL_VARCHAR_CODEC_ID, g as SqlFloatDescriptor, h as SqlFloatCodec, i as Lowerer, j as sqlCharRenderOutputType, k as sqlCharDescriptor, l as SQL_INT_CODEC_ID, m as SqlCharDescriptor, n as AdapterProfile, nt as sqlVarcharEncode, o as MarkerReadResult, p as SqlCharCodec, q as sqlTimestampDecode, r as AdapterTarget, rt as sqlVarcharRenderOutputType, s as SQL_CHAR_CODEC_ID, t as Adapter, tt as sqlVarcharDescriptor, u as SQL_TEXT_CODEC_ID, v as SqlIntDescriptor, w as SqlVarcharDescriptor, x as SqlTimestampCodec, y as SqlTextCodec, z as sqlIntDecode } from "./ast-HFcfQZr-.mjs";
5
+ import { n as planFromAst, t as SqlQueryPlan } from "./plan-CDxduYaN-pLIyyJaB.mjs";
6
+ import { C as buildOperation, D as toExpr, E as param, S as TraitExpression, T as createRawSql, _ as RawSqlStatementBuilder, a as CodecValue, b as ScalarListExpression, c as RawAffectedCountQuery, d as RawRow, f as RawRowQuery, g as RawSqlInterpolation, h as RawSqlBuilder, i as CodecTypesBase, l as RawCodecInferer, m as RawRowSpecEntry, n as BuildOperationSpec, o as Expression, p as RawRowSpec, r as CodecExpression, s as NoReservedRowColumn, t as AffectedCount, u as RawPlanContext, v as RawSqlStatementTag, w as codecOf, x as ScopeField, y as RawSqlTag } from "./expression-FJK6Ar-d.mjs";
7
+ import { t as SqlExecutionPlan } from "./sql-execution-plan--jKyLpe5-CMGhgO0M.mjs";
8
+ import "./plan-BHLdb0Z7.mjs";
9
+ import { a as MutationDefaultsOptions, c as SqlAggregateDescriptorRegistry, d as TypeHelperRegistry, i as MutationDefaultsOp, n as CodecDescriptorRegistry, o as ResolvedSqlAggregate, r as ExecutionContext, t as AppliedMutationDefault } from "./query-lane-context-Qa-eddrE-kuZ8Z86-.mjs";
10
+ import "./query-lane-context-XMvk7fmY.mjs";
11
+ import { a as SqlParamRefMutatorInternal, i as SqlParamRefMutator, n as ParamRefEntryUnion, o as createSqlParamRefMutator, r as ParamRefHandle, t as ParamRefEntry } from "./middleware-AhTz1BOW-th-Suxuf.mjs";
12
+ import { S as TablesOf, _ as SqlOrmPlan, a as ColumnsOf, b as TableKey, c as META, d as ModelMetadata, f as OperationTypeSignature, g as SqlBuilderOptions, h as RuntimeScope, i as ColumnResolutionContract, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as ComputeColumnJsType, p as OperationTypes, r as CodecTypes, s as Expr, t as BuildOptions, u as ModelDef, v as SqlPlan, x as TableMetadata, y as TableDef } from "./types-CyxGtOOh-BggSa6Fe.mjs";
13
+ export { Adapter, AdapterProfile, AdapterTarget, AffectedCount, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, CodecTypes, CodecTypesBase, CodecValue, ColumnRef, ColumnResolutionContract, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, META, MarkerReadResult, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NativeJsonValueProjection, NoReservedRowColumn, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, type ParamRefEntry, type ParamRefEntryUnion, type ParamRefHandle, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawAffectedCountQuery, RawCodecInferer, RawExpr, RawPlanContext, RawQueryAst, RawQueryColumn, RawQueryResult, RawRow, RawRowQuery, RawRowSpec, RawRowSpecEntry, RawSqlBuilder, RawSqlInterpolation, RawSqlLiteral, RawSqlStatementBuilder, RawSqlStatementTag, RawSqlTag, ResolvedSqlAggregate, type RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScalarListExpression, ScopeField, SelectAst, SelectAstOptions, SqlAggregateDescriptorRegistry, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, type SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, type SqlOrmPlan, type SqlParamRefMutator, type SqlParamRefMutatorInternal, SqlPlan, SqlQueryPlan, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, buildOperation, codecOf, collectOrderedParamRefs, compact, createRawSql, createSqlParamRefMutator, frozenCodecRef, isAggregateFn, isDdlNode, isQueryAst, isWhereExpr, param, planFromAst, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };