@prisma/orm-family-sql 8.0.0-rc.14-dev.39 → 8.0.0-rc.14-dev.41

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 (95) hide show
  1. package/dist/{aggregate-descriptor-registry-B3RG0Zom.mjs → aggregate-descriptor-registry-B88lvGQB.mjs} +2 -2
  2. package/dist/{aggregate-descriptor-registry-B3RG0Zom.mjs.map → aggregate-descriptor-registry-B88lvGQB.mjs.map} +1 -1
  3. package/dist/{ast-B2W9tHy1.mjs → ast-DOubq2En.mjs} +2 -2
  4. package/dist/ast-DOubq2En.mjs.map +1 -0
  5. package/dist/{ast-DgUdnFtz.d.mts → ast-DWgP3Fnu.d.mts} +6 -4
  6. package/dist/{ast-DgUdnFtz.d.mts.map → ast-DWgP3Fnu.d.mts.map} +1 -1
  7. package/dist/builder.d.mts +2 -2
  8. package/dist/builder__runtime.d.mts +6 -6
  9. package/dist/builder__runtime.mjs +48 -3
  10. package/dist/builder__runtime.mjs.map +1 -1
  11. package/dist/builder__types.d.mts +2 -2
  12. package/dist/{control-qkDZstn6.d.mts → control-BThycYAG.d.mts} +6 -6
  13. package/dist/{control-qkDZstn6.d.mts.map → control-BThycYAG.d.mts.map} +1 -1
  14. package/dist/control-adapter-BUyIei4U.d.mts +1 -0
  15. package/dist/{control-adapter-CkFfBVei-N-jSb9WR.d.mts → control-adapter-CkFfBVei-D8yZvwK7.d.mts} +4 -4
  16. package/dist/{control-adapter-CkFfBVei-N-jSb9WR.d.mts.map → control-adapter-CkFfBVei-D8yZvwK7.d.mts.map} +1 -1
  17. package/dist/{db-DLjWu9-f-ldboYM8A.d.mts → db-CJxU3aL_-CMuiIKs5.d.mts} +60 -7
  18. package/dist/{db-DLjWu9-f-ldboYM8A.d.mts.map → db-CJxU3aL_-CMuiIKs5.d.mts.map} +1 -1
  19. package/dist/{ddl-types-CWIiJxsH-BixiHVIr.d.mts → ddl-types-BT_bz9ck-BjAW4tq0.d.mts} +3 -3
  20. package/dist/{ddl-types-CWIiJxsH-BixiHVIr.d.mts.map → ddl-types-BT_bz9ck-BjAW4tq0.d.mts.map} +1 -1
  21. package/dist/{diff-B1ThXQkW.d.mts → diff-CN8CxYDc.d.mts} +3 -3
  22. package/dist/{diff-B1ThXQkW.d.mts.map → diff-CN8CxYDc.d.mts.map} +1 -1
  23. package/dist/{expression-o74FOqh6.d.mts → expression-B-9RZQN9.d.mts} +3 -3
  24. package/dist/{expression-o74FOqh6.d.mts.map → expression-B-9RZQN9.d.mts.map} +1 -1
  25. package/dist/{expression-Bv8X6-Qg.mjs → expression-gmLQa4Ie.mjs} +2 -2
  26. package/dist/{expression-Bv8X6-Qg.mjs.map → expression-gmLQa4Ie.mjs.map} +1 -1
  27. package/dist/family.d.mts +6 -6
  28. package/dist/family__control-adapter.d.mts +2 -2
  29. package/dist/family__control.d.mts +2 -2
  30. package/dist/family__diff.d.mts +2 -2
  31. package/dist/family__migration.d.mts +1 -1
  32. package/dist/{index-DCKjTi7L.d.mts → index-NVxwovsn.d.mts} +9 -9
  33. package/dist/{index-DCKjTi7L.d.mts.map → index-NVxwovsn.d.mts.map} +1 -1
  34. package/dist/middleware-BAA8rimP.d.mts +1 -0
  35. package/dist/{middleware-BtMX6nSF-DM55ZeCo.d.mts → middleware-DAmCZlPN-B8QEPIUy.d.mts} +3 -3
  36. package/dist/{middleware-BtMX6nSF-DM55ZeCo.d.mts.map → middleware-DAmCZlPN-B8QEPIUy.d.mts.map} +1 -1
  37. package/dist/{middleware-CMr4CHNz-DHIUdxlm.mjs → middleware-yBAfiVWn-CzNCthJT.mjs} +3 -3
  38. package/dist/{middleware-CMr4CHNz-DHIUdxlm.mjs.map → middleware-yBAfiVWn-CzNCthJT.mjs.map} +1 -1
  39. package/dist/{migration-DV5extx2.d.mts → migration-K_EPNCmR.d.mts} +2 -2
  40. package/dist/{migration-DV5extx2.d.mts.map → migration-K_EPNCmR.d.mts.map} +1 -1
  41. package/dist/orm-client.d.mts +11 -11
  42. package/dist/orm-client.mjs +5 -4
  43. package/dist/orm-client.mjs.map +1 -1
  44. package/dist/{plan-BlQITcbP-B2q80evU.d.mts → plan-1wnpBALU-CkFF8oIz.d.mts} +3 -3
  45. package/dist/plan-1wnpBALU-CkFF8oIz.d.mts.map +1 -0
  46. package/dist/plan-BCQYGXrJ.d.mts +2 -0
  47. package/dist/{prepared-statement-YtgdlN7e-BryEFERH.d.mts → prepared-statement-YtgdlN7e-BJzjum7z.d.mts} +13 -13
  48. package/dist/{prepared-statement-YtgdlN7e-BryEFERH.d.mts.map → prepared-statement-YtgdlN7e-BJzjum7z.d.mts.map} +1 -1
  49. package/dist/query-lane-context-CEYIBLlG.d.mts +1 -0
  50. package/dist/{query-lane-context-OSV9X636-DFRkNeXq.d.mts → query-lane-context-Ft8I-pge-nABTUotc.d.mts} +3 -3
  51. package/dist/{query-lane-context-OSV9X636-DFRkNeXq.d.mts.map → query-lane-context-Ft8I-pge-nABTUotc.d.mts.map} +1 -1
  52. package/dist/relational-core.d.mts +12 -12
  53. package/dist/relational-core.mjs +6 -6
  54. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  55. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  56. package/dist/relational-core__ast.d.mts +4 -4
  57. package/dist/relational-core__ast.mjs +4 -4
  58. package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
  59. package/dist/relational-core__contract-free.d.mts +2 -2
  60. package/dist/relational-core__contract-free.mjs +1 -1
  61. package/dist/relational-core__contract-free.mjs.map +1 -1
  62. package/dist/relational-core__expression.d.mts +1 -1
  63. package/dist/relational-core__expression.mjs +1 -1
  64. package/dist/relational-core__middleware.d.mts +2 -2
  65. package/dist/relational-core__middleware.mjs +1 -1
  66. package/dist/relational-core__plan.d.mts +3 -3
  67. package/dist/relational-core__query-lane-context.d.mts +2 -2
  68. package/dist/relational-core__types.d.mts +2 -2
  69. package/dist/runtime.d.mts +4 -4
  70. package/dist/runtime.mjs +4 -4
  71. package/dist/runtime__internal__prepared-query.d.mts +1 -1
  72. package/dist/{sql-execution-plan-CV6K4o9N-B3EzlMwJ.d.mts → sql-execution-plan-CdlkkwtB-NuamyL5f.d.mts} +3 -3
  73. package/dist/sql-execution-plan-CdlkkwtB-NuamyL5f.d.mts.map +1 -0
  74. package/dist/{types-flbim7l7-BbzcJZpz.d.mts → types-0xZ8asKQ-tfwe3lxh.d.mts} +6 -6
  75. package/dist/{types-flbim7l7-BbzcJZpz.d.mts.map → types-0xZ8asKQ-tfwe3lxh.d.mts.map} +1 -1
  76. package/dist/{types-BLnsGaJf-m-qTW3ox.mjs → types-C9UR53Lv-BF-_alNk.mjs} +36 -3
  77. package/dist/types-C9UR53Lv-BF-_alNk.mjs.map +1 -0
  78. package/dist/{types-Dskga3R1-DeSwpS4A.d.mts → types-CqwI8eGx-AYan1yI4.d.mts} +25 -3
  79. package/dist/{types-Dskga3R1-DeSwpS4A.d.mts.map → types-CqwI8eGx-AYan1yI4.d.mts.map} +1 -1
  80. package/dist/{types-CvuS68sy-CIYfMFuu.d.mts → types-CvuS68sy-Cj3SvUKo.d.mts} +2 -2
  81. package/dist/{types-CvuS68sy-CIYfMFuu.d.mts.map → types-CvuS68sy-Cj3SvUKo.d.mts.map} +1 -1
  82. package/dist/types-DkRYdSXK.d.mts +1 -0
  83. package/dist/{util-DQQgv2j1-D6INZaRG.mjs → util-BBgcP3gI-XJBkxo1K.mjs} +12 -3
  84. package/dist/util-BBgcP3gI-XJBkxo1K.mjs.map +1 -0
  85. package/package.json +18 -18
  86. package/dist/ast-B2W9tHy1.mjs.map +0 -1
  87. package/dist/control-adapter-BoQobwpe.d.mts +0 -1
  88. package/dist/middleware-Bn2R6ocx.d.mts +0 -1
  89. package/dist/plan-BlQITcbP-B2q80evU.d.mts.map +0 -1
  90. package/dist/plan-D11FmUVM.d.mts +0 -2
  91. package/dist/query-lane-context-SRmvD9-J.d.mts +0 -1
  92. package/dist/sql-execution-plan-CV6K4o9N-B3EzlMwJ.d.mts.map +0 -1
  93. package/dist/types-BLnsGaJf-m-qTW3ox.mjs.map +0 -1
  94. package/dist/types-Bb6De1yt.d.mts +0 -1
  95. package/dist/util-DQQgv2j1-D6INZaRG.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { B as frozenCodecRef, V as isAggregateFn, z as aggregateFnNames } from "./types-BLnsGaJf-m-qTW3ox.mjs";
1
+ import { B as aggregateFnNames, H as isAggregateFn, V as frozenCodecRef } from "./types-C9UR53Lv-BF-_alNk.mjs";
2
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { aggregateDescriptorKey, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, settleAggregateOverloads } from "@prisma/orm-framework/components/components";
@@ -123,4 +123,4 @@ function describeCandidate(value) {
123
123
  //#endregion
124
124
  export { isSqlAggregateDescriptor as n, buildSqlAggregateDescriptorRegistry as t };
125
125
 
126
- //# sourceMappingURL=aggregate-descriptor-registry-B3RG0Zom.mjs.map
126
+ //# sourceMappingURL=aggregate-descriptor-registry-B88lvGQB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-descriptor-registry-B3RG0Zom.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/aggregate-descriptor-registry.mjs"],"sourcesContent":["import { B as isAggregateFn, q as frozenCodecRef, z as aggregateFnNames } from \"../types-BLnsGaJf.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { aggregateDescriptorKey, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, settleAggregateOverloads } from \"@internal/framework-components/components\";\n//#region src/aggregate-descriptor.ts\n/** Structural validation of a contributed SQL aggregate descriptor: the declarative shape plus a callable lowering hook where one is declared. */\nfunction isSqlAggregateDescriptor(value) {\n\tif (!isAggregateDescriptor(value)) return false;\n\treturn !(\"lower\" in value) || value.lower === void 0 || typeof value.lower === \"function\";\n}\n//#endregion\n//#region src/aggregate-descriptor-registry.ts\nfunction namedOutputRef(output, input) {\n\treturn frozenCodecRef({\n\t\tcodecId: output.codecId,\n\t\t...ifDefined(\"typeParams\", output.typeParams?.(input))\n\t});\n}\n/** The descriptor's own answer for a result set carrying no row, carried into resolution unchanged. */\nfunction resultNullability(descriptor) {\n\treturn descriptor.nullable ? { nullable: true } : {\n\t\tnullable: false,\n\t\temptyResultJson: descriptor.emptyResultJson\n\t};\n}\n/**\n* Validate every contributed aggregate descriptor and settle its matches against the composed codec set.\n*\n* Validation covers the descriptor's own shape, the lowering rule — an operation outside the closed SQL aggregate alphabet must carry a `lower` hook, there being no plain `AggregateExpr` form for it — a second claim on one `(operation, input)` pair, and two trait descriptors that both claim a registered codec for one operation — the last of which only a composed stack can detect, which is why it is settled here rather than at contribution.\n*/\nfunction buildSqlAggregateDescriptorRegistry(descriptors, codecDescriptors) {\n\tconst validated = [];\n\tconst claimedKeys = /* @__PURE__ */ new Set();\n\tfor (const candidate of descriptors) {\n\t\tif (!isSqlAggregateDescriptor(candidate)) throw structuredError(\"RUNTIME.AGGREGATE_DESCRIPTOR_INVALID\", `Contributed value ${describeCandidate(candidate)} is not a valid SQL aggregate descriptor.`, {\n\t\t\twhy: \"Aggregate resolution reads a declared operation, input match, result codec, and nullability — plus, for a non-nullable result, the empty-result value; a lowering hook, where present, must be callable.\",\n\t\t\tfix: \"Declare `operation`, `input` (`none` / `any` / `codec` / `trait`), `output` (`self` / `codec`), and `nullable` on the descriptor, adding `emptyResultJson` where `nullable` is false.\",\n\t\t\tmeta: { descriptor: describeCandidate(candidate) }\n\t\t});\n\t\tconst key = aggregateDescriptorKey(candidate);\n\t\tif (!isAggregateFn(candidate.operation) && candidate.lower === void 0) throw structuredError(\"RUNTIME.AGGREGATE_LOWERING_MISSING\", `Aggregate descriptor '${key}' declares operation '${candidate.operation}', which is outside the SQL aggregate alphabet (${[...aggregateFnNames].join(\", \")}) and carries no lowering hook.`, {\n\t\t\twhy: \"An operation in the alphabet lowers to a plain aggregate call; renderers know no other operation, so any other name must build its expression through a `lower` hook from existing nodes.\",\n\t\t\tfix: \"Declare a `lower` hook on the descriptor, or use an operation name from the SQL aggregate alphabet.\",\n\t\t\tmeta: {\n\t\t\t\toperation: candidate.operation,\n\t\t\t\tkey\n\t\t\t}\n\t\t});\n\t\tif (claimedKeys.has(key)) throw structuredError(\"RUNTIME.DUPLICATE_AGGREGATE_DESCRIPTOR\", `Duplicate aggregate descriptor for '${key}'.`, {\n\t\t\twhy: \"Each operation/input pair resolves to exactly one result codec, so exactly one component may claim it.\",\n\t\t\tfix: \"Remove the duplicate target, adapter, or extension contribution.\",\n\t\t\tmeta: { key }\n\t\t});\n\t\tclaimedKeys.add(key);\n\t\tvalidated.push(candidate);\n\t}\n\tconst settled = settleAggregateOverloads(validated, codecDescriptors.values());\n\tconst ambiguity = settled.ambiguities[0];\n\tif (ambiguity !== void 0) throw structuredError(\"RUNTIME.AMBIGUOUS_AGGREGATE_DESCRIPTOR\", `Ambiguous aggregate descriptors for '${ambiguity.operation}' over codec '${ambiguity.codecId}': traits ${ambiguity.traits.join(\", \")} all claim it.`, {\n\t\twhy: \"A codec advertising several claimed traits leaves the result codec undetermined.\",\n\t\tfix: `Contribute an exact descriptor for '${ambiguity.operation}' over '${ambiguity.codecId}', or narrow the overlapping trait contributions.`,\n\t\tmeta: {\n\t\t\toperation: ambiguity.operation,\n\t\t\tcodecId: ambiguity.codecId,\n\t\t\ttraits: ambiguity.traits\n\t\t}\n\t});\n\tfor (const descriptor of validated) {\n\t\tconst outputCodecId = descriptor.output.kind === \"codec\" ? descriptor.output.codecId : descriptor.input.kind === \"codec\" ? descriptor.input.codecId : void 0;\n\t\tif (outputCodecId !== void 0 && codecDescriptors.descriptorFor(outputCodecId) === void 0) {\n\t\t\tconst key = aggregateDescriptorKey(descriptor);\n\t\t\tthrow structuredError(\"RUNTIME.AGGREGATE_OUTPUT_CODEC_MISSING\", `Aggregate descriptor '${key}' names result codec '${outputCodecId}', which the composed stack does not register.`, {\n\t\t\t\twhy: \"A resolved aggregate decodes its result through the declared codec; a codec the stack does not compose cannot decode anything.\",\n\t\t\t\tfix: \"Register the codec on the composed stack, or declare a result codec the stack composes.\",\n\t\t\t\tmeta: {\n\t\t\t\t\toperation: descriptor.operation,\n\t\t\t\t\tkey,\n\t\t\t\t\toutputCodecId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tconst tables = /* @__PURE__ */ new Map();\n\tfor (const [operation, entry] of settled.operations) tables.set(operation, {\n\t\twithoutInput: resolveWithoutInput(operation, entry.noInput) ?? resolveWithoutInput(operation, entry.anyInput),\n\t\tbyCodecId: entry.byCodecId,\n\t\tanyInput: entry.anyInput\n\t});\n\treturn {\n\t\tresolve(operation, input) {\n\t\t\tconst table = tables.get(operation);\n\t\t\tif (table === void 0) return void 0;\n\t\t\tif (input === void 0) return table.withoutInput;\n\t\t\tconst descriptor = table.byCodecId.get(input.codecId) ?? table.anyInput;\n\t\t\tif (descriptor === void 0) return void 0;\n\t\t\treturn {\n\t\t\t\toperation,\n\t\t\t\toutput: descriptor.output.kind === \"self\" ? frozenCodecRef(input) : namedOutputRef(descriptor.output, input),\n\t\t\t\t...resultNullability(descriptor),\n\t\t\t\tlower: descriptor.lower\n\t\t\t};\n\t\t},\n\t\t*values() {\n\t\t\tyield* validated;\n\t\t}\n\t};\n}\n/**\n* Resolve the overload that answers a call carrying no input. Both kinds that qualify name their result codec outright, there being no input codec to reuse.\n*/\nfunction resolveWithoutInput(operation, descriptor) {\n\tif (descriptor === void 0) return void 0;\n\tif (!isNoInputAggregateDescriptor(descriptor) && !isAnyInputAggregateDescriptor(descriptor)) return;\n\treturn {\n\t\toperation,\n\t\toutput: namedOutputRef(descriptor.output, void 0),\n\t\t...resultNullability(descriptor),\n\t\tlower: descriptor.lower\n\t};\n}\nfunction describeCandidate(value) {\n\tif (typeof value === \"object\" && value !== null && \"operation\" in value) return `'${String(value.operation)}'`;\n\treturn `of type ${typeof value}`;\n}\n//#endregion\nexport { buildSqlAggregateDescriptorRegistry, isSqlAggregateDescriptor };\n\n//# sourceMappingURL=aggregate-descriptor-registry.mjs.map"],"mappings":";;;;;;AAMA,SAAS,yBAAyB,OAAO;CACxC,IAAI,CAAC,sBAAsB,KAAK,GAAG,OAAO;CAC1C,OAAO,EAAE,WAAW,UAAU,MAAM,UAAU,KAAK,KAAK,OAAO,MAAM,UAAU;AAChF;AAGA,SAAS,eAAe,QAAQ,OAAO;CACtC,OAAO,eAAe;EACrB,SAAS,OAAO;EAChB,GAAG,UAAU,cAAc,OAAO,aAAa,KAAK,CAAC;CACtD,CAAC;AACF;;AAEA,SAAS,kBAAkB,YAAY;CACtC,OAAO,WAAW,WAAW,EAAE,UAAU,KAAK,IAAI;EACjD,UAAU;EACV,iBAAiB,WAAW;CAC7B;AACD;;;;;;AAMA,SAAS,oCAAoC,aAAa,kBAAkB;CAC3E,MAAM,YAAY,CAAC;CACnB,MAAM,8BAA8B,IAAI,IAAI;CAC5C,KAAK,MAAM,aAAa,aAAa;EACpC,IAAI,CAAC,yBAAyB,SAAS,GAAG,MAAM,gBAAgB,wCAAwC,qBAAqB,kBAAkB,SAAS,EAAE,4CAA4C;GACrM,KAAK;GACL,KAAK;GACL,MAAM,EAAE,YAAY,kBAAkB,SAAS,EAAE;EAClD,CAAC;EACD,MAAM,MAAM,uBAAuB,SAAS;EAC5C,IAAI,CAAC,cAAc,UAAU,SAAS,KAAK,UAAU,UAAU,KAAK,GAAG,MAAM,gBAAgB,sCAAsC,yBAAyB,IAAI,wBAAwB,UAAU,UAAU,kDAAkD,CAAC,GAAG,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,kCAAkC;GAChU,KAAK;GACL,KAAK;GACL,MAAM;IACL,WAAW,UAAU;IACrB;GACD;EACD,CAAC;EACD,IAAI,YAAY,IAAI,GAAG,GAAG,MAAM,gBAAgB,0CAA0C,uCAA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ClC,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;GACnC,MAAM,aAAa,MAAM,UAAU,IAAI,MAAM,OAAO,KAAK,MAAM;GAC/D,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK;GACvC,OAAO;IACN;IACA,QAAQ,WAAW,OAAO,SAAS,SAAS,eAAe,KAAK,IAAI,eAAe,WAAW,QAAQ,KAAK;IAC3G,GAAG,kBAAkB,UAAU;IAC/B,OAAO,WAAW;GACnB;EACD;EACA,CAAC,SAAS;GACT,OAAO;EACR;CACD;AACD;;;;AAIA,SAAS,oBAAoB,WAAW,YAAY;CACnD,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK;CACvC,IAAI,CAAC,6BAA6B,UAAU,KAAK,CAAC,8BAA8B,UAAU,GAAG;CAC7F,OAAO;EACN;EACA,QAAQ,eAAe,WAAW,QAAQ,KAAK,CAAC;EAChD,GAAG,kBAAkB,UAAU;EAC/B,OAAO,WAAW;CACnB;AACD;AACA,SAAS,kBAAkB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe,OAAO,OAAO,IAAI,OAAO,MAAM,SAAS,EAAE;CAC5G,OAAO,WAAW,OAAO;AAC1B"}
1
+ {"version":3,"file":"aggregate-descriptor-registry-B88lvGQB.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/aggregate-descriptor-registry.mjs"],"sourcesContent":["import { B as aggregateFnNames, J as frozenCodecRef, V as isAggregateFn } from \"../types-C9UR53Lv.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { aggregateDescriptorKey, isAggregateDescriptor, isAnyInputAggregateDescriptor, isNoInputAggregateDescriptor, settleAggregateOverloads } from \"@internal/framework-components/components\";\n//#region src/aggregate-descriptor.ts\n/** Structural validation of a contributed SQL aggregate descriptor: the declarative shape plus a callable lowering hook where one is declared. */\nfunction isSqlAggregateDescriptor(value) {\n\tif (!isAggregateDescriptor(value)) return false;\n\treturn !(\"lower\" in value) || value.lower === void 0 || typeof value.lower === \"function\";\n}\n//#endregion\n//#region src/aggregate-descriptor-registry.ts\nfunction namedOutputRef(output, input) {\n\treturn frozenCodecRef({\n\t\tcodecId: output.codecId,\n\t\t...ifDefined(\"typeParams\", output.typeParams?.(input))\n\t});\n}\n/** The descriptor's own answer for a result set carrying no row, carried into resolution unchanged. */\nfunction resultNullability(descriptor) {\n\treturn descriptor.nullable ? { nullable: true } : {\n\t\tnullable: false,\n\t\temptyResultJson: descriptor.emptyResultJson\n\t};\n}\n/**\n* Validate every contributed aggregate descriptor and settle its matches against the composed codec set.\n*\n* Validation covers the descriptor's own shape, the lowering rule — an operation outside the closed SQL aggregate alphabet must carry a `lower` hook, there being no plain `AggregateExpr` form for it — a second claim on one `(operation, input)` pair, and two trait descriptors that both claim a registered codec for one operation — the last of which only a composed stack can detect, which is why it is settled here rather than at contribution.\n*/\nfunction buildSqlAggregateDescriptorRegistry(descriptors, codecDescriptors) {\n\tconst validated = [];\n\tconst claimedKeys = /* @__PURE__ */ new Set();\n\tfor (const candidate of descriptors) {\n\t\tif (!isSqlAggregateDescriptor(candidate)) throw structuredError(\"RUNTIME.AGGREGATE_DESCRIPTOR_INVALID\", `Contributed value ${describeCandidate(candidate)} is not a valid SQL aggregate descriptor.`, {\n\t\t\twhy: \"Aggregate resolution reads a declared operation, input match, result codec, and nullability — plus, for a non-nullable result, the empty-result value; a lowering hook, where present, must be callable.\",\n\t\t\tfix: \"Declare `operation`, `input` (`none` / `any` / `codec` / `trait`), `output` (`self` / `codec`), and `nullable` on the descriptor, adding `emptyResultJson` where `nullable` is false.\",\n\t\t\tmeta: { descriptor: describeCandidate(candidate) }\n\t\t});\n\t\tconst key = aggregateDescriptorKey(candidate);\n\t\tif (!isAggregateFn(candidate.operation) && candidate.lower === void 0) throw structuredError(\"RUNTIME.AGGREGATE_LOWERING_MISSING\", `Aggregate descriptor '${key}' declares operation '${candidate.operation}', which is outside the SQL aggregate alphabet (${[...aggregateFnNames].join(\", \")}) and carries no lowering hook.`, {\n\t\t\twhy: \"An operation in the alphabet lowers to a plain aggregate call; renderers know no other operation, so any other name must build its expression through a `lower` hook from existing nodes.\",\n\t\t\tfix: \"Declare a `lower` hook on the descriptor, or use an operation name from the SQL aggregate alphabet.\",\n\t\t\tmeta: {\n\t\t\t\toperation: candidate.operation,\n\t\t\t\tkey\n\t\t\t}\n\t\t});\n\t\tif (claimedKeys.has(key)) throw structuredError(\"RUNTIME.DUPLICATE_AGGREGATE_DESCRIPTOR\", `Duplicate aggregate descriptor for '${key}'.`, {\n\t\t\twhy: \"Each operation/input pair resolves to exactly one result codec, so exactly one component may claim it.\",\n\t\t\tfix: \"Remove the duplicate target, adapter, or extension contribution.\",\n\t\t\tmeta: { key }\n\t\t});\n\t\tclaimedKeys.add(key);\n\t\tvalidated.push(candidate);\n\t}\n\tconst settled = settleAggregateOverloads(validated, codecDescriptors.values());\n\tconst ambiguity = settled.ambiguities[0];\n\tif (ambiguity !== void 0) throw structuredError(\"RUNTIME.AMBIGUOUS_AGGREGATE_DESCRIPTOR\", `Ambiguous aggregate descriptors for '${ambiguity.operation}' over codec '${ambiguity.codecId}': traits ${ambiguity.traits.join(\", \")} all claim it.`, {\n\t\twhy: \"A codec advertising several claimed traits leaves the result codec undetermined.\",\n\t\tfix: `Contribute an exact descriptor for '${ambiguity.operation}' over '${ambiguity.codecId}', or narrow the overlapping trait contributions.`,\n\t\tmeta: {\n\t\t\toperation: ambiguity.operation,\n\t\t\tcodecId: ambiguity.codecId,\n\t\t\ttraits: ambiguity.traits\n\t\t}\n\t});\n\tfor (const descriptor of validated) {\n\t\tconst outputCodecId = descriptor.output.kind === \"codec\" ? descriptor.output.codecId : descriptor.input.kind === \"codec\" ? descriptor.input.codecId : void 0;\n\t\tif (outputCodecId !== void 0 && codecDescriptors.descriptorFor(outputCodecId) === void 0) {\n\t\t\tconst key = aggregateDescriptorKey(descriptor);\n\t\t\tthrow structuredError(\"RUNTIME.AGGREGATE_OUTPUT_CODEC_MISSING\", `Aggregate descriptor '${key}' names result codec '${outputCodecId}', which the composed stack does not register.`, {\n\t\t\t\twhy: \"A resolved aggregate decodes its result through the declared codec; a codec the stack does not compose cannot decode anything.\",\n\t\t\t\tfix: \"Register the codec on the composed stack, or declare a result codec the stack composes.\",\n\t\t\t\tmeta: {\n\t\t\t\t\toperation: descriptor.operation,\n\t\t\t\t\tkey,\n\t\t\t\t\toutputCodecId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tconst tables = /* @__PURE__ */ new Map();\n\tfor (const [operation, entry] of settled.operations) tables.set(operation, {\n\t\twithoutInput: resolveWithoutInput(operation, entry.noInput) ?? resolveWithoutInput(operation, entry.anyInput),\n\t\tbyCodecId: entry.byCodecId,\n\t\tanyInput: entry.anyInput\n\t});\n\treturn {\n\t\tresolve(operation, input) {\n\t\t\tconst table = tables.get(operation);\n\t\t\tif (table === void 0) return void 0;\n\t\t\tif (input === void 0) return table.withoutInput;\n\t\t\tconst descriptor = table.byCodecId.get(input.codecId) ?? table.anyInput;\n\t\t\tif (descriptor === void 0) return void 0;\n\t\t\treturn {\n\t\t\t\toperation,\n\t\t\t\toutput: descriptor.output.kind === \"self\" ? frozenCodecRef(input) : namedOutputRef(descriptor.output, input),\n\t\t\t\t...resultNullability(descriptor),\n\t\t\t\tlower: descriptor.lower\n\t\t\t};\n\t\t},\n\t\t*values() {\n\t\t\tyield* validated;\n\t\t}\n\t};\n}\n/**\n* Resolve the overload that answers a call carrying no input. Both kinds that qualify name their result codec outright, there being no input codec to reuse.\n*/\nfunction resolveWithoutInput(operation, descriptor) {\n\tif (descriptor === void 0) return void 0;\n\tif (!isNoInputAggregateDescriptor(descriptor) && !isAnyInputAggregateDescriptor(descriptor)) return;\n\treturn {\n\t\toperation,\n\t\toutput: namedOutputRef(descriptor.output, void 0),\n\t\t...resultNullability(descriptor),\n\t\tlower: descriptor.lower\n\t};\n}\nfunction describeCandidate(value) {\n\tif (typeof value === \"object\" && value !== null && \"operation\" in value) return `'${String(value.operation)}'`;\n\treturn `of type ${typeof value}`;\n}\n//#endregion\nexport { buildSqlAggregateDescriptorRegistry, isSqlAggregateDescriptor };\n\n//# sourceMappingURL=aggregate-descriptor-registry.mjs.map"],"mappings":";;;;;;AAMA,SAAS,yBAAyB,OAAO;CACxC,IAAI,CAAC,sBAAsB,KAAK,GAAG,OAAO;CAC1C,OAAO,EAAE,WAAW,UAAU,MAAM,UAAU,KAAK,KAAK,OAAO,MAAM,UAAU;AAChF;AAGA,SAAS,eAAe,QAAQ,OAAO;CACtC,OAAO,eAAe;EACrB,SAAS,OAAO;EAChB,GAAG,UAAU,cAAc,OAAO,aAAa,KAAK,CAAC;CACtD,CAAC;AACF;;AAEA,SAAS,kBAAkB,YAAY;CACtC,OAAO,WAAW,WAAW,EAAE,UAAU,KAAK,IAAI;EACjD,UAAU;EACV,iBAAiB,WAAW;CAC7B;AACD;;;;;;AAMA,SAAS,oCAAoC,aAAa,kBAAkB;CAC3E,MAAM,YAAY,CAAC;CACnB,MAAM,8BAA8B,IAAI,IAAI;CAC5C,KAAK,MAAM,aAAa,aAAa;EACpC,IAAI,CAAC,yBAAyB,SAAS,GAAG,MAAM,gBAAgB,wCAAwC,qBAAqB,kBAAkB,SAAS,EAAE,4CAA4C;GACrM,KAAK;GACL,KAAK;GACL,MAAM,EAAE,YAAY,kBAAkB,SAAS,EAAE;EAClD,CAAC;EACD,MAAM,MAAM,uBAAuB,SAAS;EAC5C,IAAI,CAAC,cAAc,UAAU,SAAS,KAAK,UAAU,UAAU,KAAK,GAAG,MAAM,gBAAgB,sCAAsC,yBAAyB,IAAI,wBAAwB,UAAU,UAAU,kDAAkD,CAAC,GAAG,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,kCAAkC;GAChU,KAAK;GACL,KAAK;GACL,MAAM;IACL,WAAW,UAAU;IACrB;GACD;EACD,CAAC;EACD,IAAI,YAAY,IAAI,GAAG,GAAG,MAAM,gBAAgB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OAAO,KAAK;GAClC,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;GACnC,MAAM,aAAa,MAAM,UAAU,IAAI,MAAM,OAAO,KAAK,MAAM;GAC/D,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK;GACvC,OAAO;IACN;IACA,QAAQ,WAAW,OAAO,SAAS,SAAS,eAAe,KAAK,IAAI,eAAe,WAAW,QAAQ,KAAK;IAC3G,GAAG,kBAAkB,UAAU;IAC/B,OAAO,WAAW;GACnB;EACD;EACA,CAAC,SAAS;GACT,OAAO;EACR;CACD;AACD;;;;AAIA,SAAS,oBAAoB,WAAW,YAAY;CACnD,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK;CACvC,IAAI,CAAC,6BAA6B,UAAU,KAAK,CAAC,8BAA8B,UAAU,GAAG;CAC7F,OAAO;EACN;EACA,QAAQ,eAAe,WAAW,QAAQ,KAAK,CAAC;EAChD,GAAG,kBAAkB,UAAU;EAC/B,OAAO,WAAW;CACnB;AACD;AACA,SAAS,kBAAkB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe,OAAO,OAAO,IAAI,OAAO,MAAM,SAAS,EAAE;CAC5G,OAAO,WAAW,OAAO;AAC1B"}
@@ -1,4 +1,4 @@
1
- import { B as frozenCodecRef } from "./types-BLnsGaJf-m-qTW3ox.mjs";
1
+ import { V as frozenCodecRef } from "./types-C9UR53Lv-BF-_alNk.mjs";
2
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  import { CodecDescriptorTemplateImpl, CodecImpl, SAFE_INTEGER_RANGE, codecForRef, column, decodeJsonFloat, decodeJsonInteger, decodeJsonString, encodeJsonFloat } from "@prisma/orm-framework/components/codec";
4
4
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -307,4 +307,4 @@ const sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(pa
307
307
  //#endregion
308
308
  export { sqlIntColumn as A, sqlVarcharDescriptor as B, sqlCharDescriptor as C, sqlFloatDecode as D, sqlFloatColumn as E, sqlTextDecode as F, sqlVarcharRenderOutputType as H, sqlTextDescriptor as I, sqlTextEncode as L, sqlIntDescriptor as M, sqlIntEncode as N, sqlFloatDescriptor as O, sqlTextColumn as P, sqlVarcharColumn as R, sqlCharDecode as S, sqlCharRenderOutputType as T, sqlVarcharEncode as V, SqlVarcharCodec as _, SQL_FLOAT_CODEC_ID as a, encodeLiteralDefault as b, SQL_VARCHAR_CODEC_ID as c, SqlFloatCodec as d, SqlFloatDescriptor as f, SqlTextDescriptor as g, SqlTextCodec as h, SQL_CHAR_CODEC_ID as i, sqlIntDecode as j, sqlFloatEncode as k, SqlCharCodec as l, SqlIntDescriptor as m, JsonDocumentProjection as n, SQL_INT_CODEC_ID as o, SqlIntCodec as p, NativeJsonValueProjection as r, SQL_TEXT_CODEC_ID as s, CodecJsonValueProjection as t, SqlCharDescriptor as u, SqlVarcharDescriptor as v, sqlCharEncode as w, sqlCharColumn as x, encodeListLiteralDefault as y, sqlVarcharDecode as z };
309
309
 
310
- //# sourceMappingURL=ast-B2W9tHy1.mjs.map
310
+ //# sourceMappingURL=ast-DOubq2En.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-DOubq2En.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.mjs"],"sourcesContent":["import { A as ParamRef, B as aggregateFnNames, C as LiteralExpr, D as OperationExpr, E as NullCheckExpr, F as SelectAst, G as isWhereExpr, H as isOrderByDirection, I as SubqueryExpr, J as frozenCodecRef, K as queryAstKinds, L as TableSource, M as ProjectionItem, N as RawExpr, O as OrExpr, P as RawQueryAst, R as UpdateAst, S as ListExpression, T as NotExpr, U as isOrderByNulls, V as isAggregateFn, W as isQueryAst, _ as InsertAst, a as CastExpr, b as JsonArrayAggExpr, c as DeleteAst, d as DoUpdateSetConflictAction, f as EqColJoinOn, g as IdentifierRef, h as FunctionSource, i as CaseExpr, j as PreparedParamRef, k as OrderByItem, l as DerivedTableSource, m as FunctionCallExpr, n as AndExpr, o as ColumnRef, p as ExistsExpr, q as whereExprKinds, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, u as DoNothingConflictAction, v as InsertOnConflict, w as LockingClause, x as JsonObjectExpr, y as JoinAst, z as WindowFuncExpr } from \"../types-C9UR53Lv.mjs\";\nimport { a as DdlColumn, c as ForeignKeyConstraint, d as PrimaryKeyConstraint, f as UniqueConstraint, i as CheckExpressionConstraint, l as FunctionColumnDefault, n as opaqueSql, o as DdlColumnDefault, p as isDdlNode, r as renderOpaqueSql, s as DdlNode, t as OpaqueSql, u as LiteralColumnDefault } from \"../opaque-sql-BWxbqe5a.mjs\";\nimport { n as compact, r as isAggregateProjection, t as collectOrderedParamRefs } from \"../util-BBgcP3gI.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { CodecDescriptorTemplateImpl, CodecImpl, SAFE_INTEGER_RANGE, codecForRef, column, decodeJsonFloat, decodeJsonInteger, decodeJsonString, encodeJsonFloat } from \"@internal/framework-components/codec\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { withoutTrailing } from \"@internal/utils/text\";\n//#region src/ast/ddl-default.ts\n/**\n* Reads a column's literal default with the column's codec, built with its type parameters, and encodes it for the DDL renderer to inline. `undefined` when no codec descriptor has the column's codec id, so the renderer inlines the value as written.\n*\n* A `Date` is the one authored value JSON has no notation for, so it is encoded as it is. A `null` the codec refuses is SQL NULL, because SQL NULL has no stored form of its own; a codec that reads `null` (a JSON codec) makes it the JSON value null. Any other value the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column.\n*/\nasync function encodeLiteralDefault(codecLookup, codecRef, value, where) {\n\tconst codec = codecForRef(codecLookup, codecRef);\n\tif (codec === void 0) return void 0;\n\tif (value instanceof Date) return {\n\t\tkind: \"wire\",\n\t\twire: await codec.encode(value, {})\n\t};\n\treturn encodeWithCodec(codec, value, (cause) => refusedDefault(where, codecRef.codecId, value, void 0, cause));\n}\n/**\n* Reads and encodes each element of a list column's literal default with the column's codec, as {@link encodeLiteralDefault} does a single value, so a `null` element the codec refuses is SQL NULL. `undefined` when no codec descriptor has the column's codec id. An element the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column and the element's 1-based position.\n*/\nasync function encodeListLiteralDefault(codecLookup, codecRef, elements, where) {\n\tconst codec = codecForRef(codecLookup, codecRef);\n\tif (codec === void 0) return void 0;\n\treturn Promise.all(elements.map((element, index) => encodeWithCodec(codec, element, (cause) => refusedDefault(where, codecRef.codecId, element, index + 1, cause))));\n}\nasync function encodeWithCodec(codec, value, refused) {\n\tlet decoded;\n\ttry {\n\t\tdecoded = codec.decodeJson(value);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\tif (value === null) return { kind: \"sql-null\" };\n\t\tthrow refused(error);\n\t}\n\treturn {\n\t\tkind: \"wire\",\n\t\twire: await codec.encode(decoded, {})\n\t};\n}\nfunction refusedDefault(where, codecId, value, elementPosition, cause) {\n\tconst reason = cause instanceof Error ? cause.message : String(cause);\n\tconst subject = elementPosition === void 0 ? \"default\" : `default (element ${elementPosition})`;\n\treturn structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a ${subject} its codec ${codecId} refuses: ${reason}`, {\n\t\twhy: \"A contract.json that an earlier version emitted, or a migration.ts it planned, can hold a default that this version's codec refuses, and so can either file after a hand edit.\",\n\t\tfix: \"If contract.json holds the default, emit the contract again with this version, and correct the default in the contract source if emit refuses it. If a migration.ts sets it, correct it in that file.\",\n\t\tcause,\n\t\tmeta: {\n\t\t\ttable: where.table,\n\t\t\tcolumn: where.column,\n\t\t\tcodecId,\n\t\t\tvalue,\n\t\t\t...ifDefined(\"elementPosition\", elementPosition),\n\t\t\treason: \"codec-refused-default\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/ast/json-value-projection.ts\nvar JsonValueProjection = class {\n\tvalue;\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n\tfold(folder) {\n\t\treturn this.value.fold(folder);\n\t}\n\tcollectColumnRefs() {\n\t\treturn this.value.collectColumnRefs();\n\t}\n\tcollectParamRefs() {\n\t\treturn this.value.collectParamRefs();\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\nvar CodecJsonValueProjection = class CodecJsonValueProjection extends JsonValueProjection {\n\tkind = \"codec\";\n\tcodec;\n\tconstructor(value, codec) {\n\t\tsuper(value);\n\t\tthis.codec = frozenCodecRef(codec);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.codec(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new CodecJsonValueProjection(this.value.rewrite(rewriter), this.codec);\n\t}\n};\nvar NativeJsonValueProjection = class NativeJsonValueProjection extends JsonValueProjection {\n\tkind = \"native\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.native(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new NativeJsonValueProjection(this.value.rewrite(rewriter));\n\t}\n};\nvar JsonDocumentProjection = class JsonDocumentProjection extends JsonValueProjection {\n\tkind = \"document\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.document(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new JsonDocumentProjection(this.value.rewrite(rewriter));\n\t}\n};\n//#endregion\n//#region src/ast/sql-codec-helpers.ts\n/**\n* Shared encode/decode/render constants and codec id literals for the five SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`).\n*\n* The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n*/\nconst SQL_CHAR_CODEC_ID = \"sql/char@1\";\nconst SQL_VARCHAR_CODEC_ID = \"sql/varchar@1\";\nconst SQL_INT_CODEC_ID = \"sql/int@1\";\nconst SQL_FLOAT_CODEC_ID = \"sql/float@1\";\nconst SQL_TEXT_CODEC_ID = \"sql/text@1\";\nconst sqlCharEncode = (value) => value;\n/** A `character` value as the database returns it, without the spaces that pad it to its length. Only spaces pad it, so a trailing tab or newline is part of the value. */\nconst sqlCharDecode = (wire) => withoutTrailing(wire, \" \");\nconst sqlCharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_CHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Char<${length}>`;\n};\nconst sqlVarcharEncode = (value) => value;\nconst sqlVarcharDecode = (wire) => wire;\nconst sqlVarcharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_VARCHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Varchar<${length}>`;\n};\nconst sqlIntEncode = (value) => value;\nconst sqlIntDecode = (wire) => wire;\nconst sqlFloatEncode = (value) => value;\nconst sqlFloatDecode = (wire) => wire;\nconst sqlTextEncode = (value) => value;\nconst sqlTextDecode = (wire) => wire;\n//#endregion\n//#region src/ast/sql-codecs.ts\nvar SqlTextCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlTextEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlTextDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlTextDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlTextCodec(this);\n\t}\n};\nconst sqlTextDescriptor = new SqlTextDescriptor();\nconst sqlTextColumn = () => column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, void 0);\nvar SqlIntCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlIntEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlIntDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonInteger(this.id, json, SAFE_INTEGER_RANGE);\n\t}\n};\nvar SqlIntDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_INT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlIntCodec(this);\n\t}\n};\nconst sqlIntDescriptor = new SqlIntDescriptor();\nconst sqlIntColumn = () => column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, void 0);\nvar SqlFloatCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlFloatEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlFloatDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn encodeJsonFloat(value);\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonFloat(this.id, json);\n\t}\n};\nvar SqlFloatDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_FLOAT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlFloatCodec(this);\n\t}\n};\nconst sqlFloatDescriptor = new SqlFloatDescriptor();\nconst sqlFloatColumn = () => column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, void 0);\nvar SqlCharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlCharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlCharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlCharDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_CHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\tparamsSchema = void 0;\n\trenderOutputType(params) {\n\t\treturn sqlCharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlCharCodec(this);\n\t}\n};\nconst sqlCharDescriptor = new SqlCharDescriptor();\nconst sqlCharColumn = (params = {}) => column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params);\nvar SqlVarcharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlVarcharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlVarcharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlVarcharDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_VARCHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\tparamsSchema = void 0;\n\trenderOutputType(params) {\n\t\treturn sqlVarcharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlVarcharCodec(this);\n\t}\n};\nconst sqlVarcharDescriptor = new SqlVarcharDescriptor();\nconst sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params);\n//#endregion\nexport { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, LockingClause, NativeJsonValueProjection, NotExpr, NullCheckExpr, OpaqueSql, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, collectOrderedParamRefs, compact, encodeListLiteralDefault, encodeLiteralDefault, frozenCodecRef, isAggregateFn, isAggregateProjection, isDdlNode, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, opaqueSql, queryAstKinds, renderOpaqueSql, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };\n\n//# sourceMappingURL=ast.mjs.map"],"mappings":";;;;;;;;;;;;AAcA,eAAe,qBAAqB,aAAa,UAAU,OAAO,OAAO;CACxE,MAAM,QAAQ,YAAY,aAAa,QAAQ;CAC/C,IAAI,UAAU,KAAK,GAAG,OAAO,KAAK;CAClC,IAAI,iBAAiB,MAAM,OAAO;EACjC,MAAM;EACN,MAAM,MAAM,MAAM,OAAO,OAAO,CAAC,CAAC;CACnC;CACA,OAAO,gBAAgB,OAAO,QAAQ,UAAU,eAAe,OAAO,SAAS,SAAS,OAAO,KAAK,GAAG,KAAK,CAAC;AAC9G;;;;AAIA,eAAe,yBAAyB,aAAa,UAAU,UAAU,OAAO;CAC/E,MAAM,QAAQ,YAAY,aAAa,QAAQ;CAC/C,IAAI,UAAU,KAAK,GAAG,OAAO,KAAK;CAClC,OAAO,QAAQ,IAAI,SAAS,KAAK,SAAS,UAAU,gBAAgB,OAAO,UAAU,UAAU,eAAe,OAAO,SAAS,SAAS,SAAS,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC;AACpK;AACA,eAAe,gBAAgB,OAAO,OAAO,SAAS;CACrD,IAAI;CACJ,IAAI;EACH,UAAU,MAAM,WAAW,KAAK;CACjC,SAAS,OAAO;EACf,IAAI,gBAAgB,KAAK,GAAG,MAAM;EAClC,IAAI,UAAU,MAAM,OAAO,EAAE,MAAM,WAAW;EAC9C,MAAM,QAAQ,KAAK;CACpB;CACA,OAAO;EACN,MAAM;EACN,MAAM,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC;CACrC;AACD;AACA,SAAS,eAAe,OAAO,SAAS,OAAO,iBAAiB,OAAO;CACtE,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACpE,MAAM,UAAU,oBAAoB,KAAK,IAAI,YAA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e,KAAK;CACpB,iBAAiB,QAAQ;EACxB,OAAO,2BAA2B,MAAM;CACzC;CACA,QAAQ,SAAS;EAChB,aAAa,IAAI,gBAAgB,IAAI;CACtC;AACD;AACA,MAAM,uBAAuB,IAAI,qBAAqB;AACtD,MAAM,oBAAoB,SAAS,CAAC,MAAM,OAAO,qBAAqB,QAAQ,MAAM,GAAG,qBAAqB,SAAS,MAAM"}
@@ -1,6 +1,6 @@
1
- import { E as CodecRef$1, dt as LoweredStatement, h as AnyQueryAst, m as AnyParamRef } from "./types-Dskga3R1-DeSwpS4A.mjs";
1
+ import { E as CodecRef$1, Et as ProjectionItem, h as AnyQueryAst, ht as LoweredStatement, m as AnyParamRef } from "./types-CqwI8eGx-AYan1yI4.mjs";
2
2
  import { c as SqlQueryable } from "./driver-types-DRsYeq3j-X_D6hNMZ.mjs";
3
- import "./ddl-types-CWIiJxsH-BixiHVIr.mjs";
3
+ import "./ddl-types-BT_bz9ck-BjAW4tq0.mjs";
4
4
  import { CodecCallContext, CodecDescriptorTemplateImpl, CodecImpl, CodecInstanceContext, CodecLookupWithDescriptors } from "@prisma/orm-framework/components/codec";
5
5
  import { ColumnDefaultLiteralInputValue, ContractMarkerRecord, JsonValue } from "@prisma/orm-framework/contract/types";
6
6
  //#region ../../../2-sql/4-lanes/relational-core/dist/exports/ast.d.mts
@@ -185,6 +185,8 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
185
185
  * because it needs one params entry per occurrence in the SQL.
186
186
  */
187
187
  declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<AnyParamRef>;
188
+ /** Whether a projection item's top-level expression is an aggregate, `json_agg` or window function. Nested expressions are not inspected. */
189
+ declare function isAggregateProjection(item: ProjectionItem): boolean;
188
190
  //#endregion
189
- export { sqlCharDescriptor as A, sqlIntEncode as B, SqlVarcharDescriptor as C, encodeLiteralDefault as D, encodeListLiteralDefault as E, sqlFloatDescriptor as F, sqlVarcharColumn as G, sqlTextDecode as H, sqlFloatEncode as I, sqlVarcharEncode as J, sqlVarcharDecode as K, sqlIntColumn as L, sqlCharRenderOutputType as M, sqlFloatColumn as N, sqlCharColumn as O, sqlFloatDecode as P, sqlIntDecode as R, SqlVarcharCodec as S, compact as T, sqlTextDescriptor as U, sqlTextColumn as V, sqlTextEncode as W, sqlVarcharRenderOutputType as Y, SqlFloatDescriptor as _, LiteralDefaultColumn as a, SqlTextCodec as b, MarkerReadResult as c, SQL_INT_CODEC_ID as d, SQL_TEXT_CODEC_ID as f, SqlFloatCodec as g, SqlCharDescriptor as h, EncodedLiteralDefault as i, sqlCharEncode as j, sqlCharDecode as k, SQL_CHAR_CODEC_ID as l, SqlCharCodec as m, AdapterProfile as n, Lowerer as o, SQL_VARCHAR_CODEC_ID as p, sqlVarcharDescriptor as q, AdapterTarget as r, LowererContext as s, Adapter as t, SQL_FLOAT_CODEC_ID as u, SqlIntCodec as v, collectOrderedParamRefs as w, SqlTextDescriptor as x, SqlIntDescriptor as y, sqlIntDescriptor as z };
190
- //# sourceMappingURL=ast-DgUdnFtz.d.mts.map
191
+ export { sqlCharDecode as A, sqlIntDescriptor as B, SqlVarcharDescriptor as C, encodeLiteralDefault as D, encodeListLiteralDefault as E, sqlFloatDecode as F, sqlTextEncode as G, sqlTextColumn as H, sqlFloatDescriptor as I, sqlVarcharDescriptor as J, sqlVarcharColumn as K, sqlFloatEncode as L, sqlCharEncode as M, sqlCharRenderOutputType as N, isAggregateProjection as O, sqlFloatColumn as P, sqlIntColumn as R, SqlVarcharCodec as S, compact as T, sqlTextDecode as U, sqlIntEncode as V, sqlTextDescriptor as W, sqlVarcharRenderOutputType as X, sqlVarcharEncode as Y, SqlFloatDescriptor as _, LiteralDefaultColumn as a, SqlTextCodec as b, MarkerReadResult as c, SQL_INT_CODEC_ID as d, SQL_TEXT_CODEC_ID as f, SqlFloatCodec as g, SqlCharDescriptor as h, EncodedLiteralDefault as i, sqlCharDescriptor as j, sqlCharColumn as k, SQL_CHAR_CODEC_ID as l, SqlCharCodec as m, AdapterProfile as n, Lowerer as o, SQL_VARCHAR_CODEC_ID as p, sqlVarcharDecode as q, AdapterTarget as r, LowererContext as s, Adapter as t, SQL_FLOAT_CODEC_ID as u, SqlIntCodec as v, collectOrderedParamRefs as w, SqlTextDescriptor as x, SqlIntDescriptor as y, sqlIntDecode as z };
192
+ //# sourceMappingURL=ast-DWgP3Fnu.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast-DgUdnFtz.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.d.mts"],"mappings":";;;;;;;KAMK;;;;;;;KAOA;WACM;WACA,QAAQ;;WAER;;WAEA;;UAED,eAAe,gBAAgB,gBAAgB;WAC9C;WACA,QAAQ;WACR,cAAc;;;;EAIvB,WAAW,WAAW,eAAe,QAAQ;;UAErC,eAAe;WACd,UAAU;WACV;;KAEN,QAAQ,eAAe,qBAAqB,QAAQ,qBAAqB,KAAK,KAAK,SAAS,eAAe,eAAe;;;;UAIrH,QAAQ,eAAe,qBAAqB,QAAQ;WACnD,SAAS;EAClB,MAAM,KAAK,KAAK,SAAS,eAAe,aAAa;;;;;KAKlD;WACM;;WAEA;WACA;;;UAGD;WACC;WACA;;;;;;;iBAOM,qBAAqB,aAAa,KAAK,8CAA8C,UAAU,YAAU,OAAO,gCAAgC,OAAO,uBAAuB,QAAQ;;;;iBAItL,yBAAyB,aAAa,KAAK,8CAA8C,UAAU,YAAU,mBAAmB,aAAa,OAAO,uBAAuB,iBAAiB;;;;;;;;cAQ/L;cACA;cACA;cACA;cACA;cACA,gBAAgB;;cAEhB,gBAAgB;cAChB,0BAA0B;WAC7B;;cAEG,mBAAmB;cACnB,mBAAmB;cACnB,6BAA6B;WAChC;;cAEG,eAAe;cACf,eAAe;cACf,iBAAiB;cACjB,iBAAiB;cACjB,gBAAgB;cAChB,gBAAgB;;;KAGzB;WACM;;cAEG,qBAAqB,iBAAiB;EAClD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,c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ACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,yBAAyB;WAC5B;WACA;WACA;EACT,YAAY,KAAK,yBAAyB;;cAE9B,kBAAkB;cAClB,mEAAmE,WAAW;cAC9E,sBAAsB,iBAAiB;EACnD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,2BAA2B;WAC9B;WACA;WACA;EACT,YAAY,KAAK,yBAAyB;;cAE9B,oBAAoB;cACpB,qEAAqE,WAAW;cAChF,qBAAqB,iBAAiB;EAClD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,0BAA0B,4BAA4B;WACzD;WACA;WACA;EACT,iBAAiB,QAAQ;EACzB,QAAQ,SAAS,gBAAgB,KAAK,yBAAyB;;cAEnD,mBAAmB;cACnB,gBAAgB,SAAS,gEAAgE,WAAW,cAAc;cAClH,wBAAwB,iBAAiB;EACrD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,6BAA6B,4BAA4B;WAC5D;WACA;WACA;EACT,iBAAiB,QAAQ;EACzB,QAAQ,SAAS,gBAAgB,KAAK,yBAAyB;;cAEnD,sBAAsB;cACtB,mBAAmB,SAAS,gEAAgE,WAAW,iBAAiB;;;iBAGrH,QAAQ,UAAU,yBAAyB,GAAG,IAAI;;;;;;;;;;;iBAWlD,wBAAwB,KAAK,cAAc,cAAc;;iBAEzD,sBAAsB,MAAM"}
@@ -1,3 +1,3 @@
1
- import { o as Expression, x as ScopeField } from "./expression-o74FOqh6.mjs";
2
- import { T as WhereFilter, _ as SelectQuery, a as DeleteQuery, c as GatedMethod, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy } from "./db-DLjWu9-f-ldboYM8A.mjs";
1
+ import { o as Expression, x as ScopeField } from "./expression-B-9RZQN9.mjs";
2
+ import { T as WhereFilter, _ as SelectQuery, a as DeleteQuery, c as GatedMethod, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy } from "./db-CJxU3aL_-CMuiIKs5.mjs";
3
3
  export type { AggregateFunctions, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, QueryContext, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableProxy, UpdateQuery, WhereFilter };
@@ -1,12 +1,12 @@
1
1
  import { l as SqlStorage } from "./sql-storage-DSnnRQAf-DaHPnley.mjs";
2
2
  import "./types-DkOYK86-.mjs";
3
3
  import { i as SqlOperationEntry } from "./index-qOLTnfYz.mjs";
4
- import { c as AnyExpression } from "./types-Dskga3R1-DeSwpS4A.mjs";
5
- import "./ast-DgUdnFtz.mjs";
6
- import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-o74FOqh6.mjs";
7
- import { S as TableProxyContract, f as QueryContext, g as Scope, i as Db, o as FieldProxy, p as RawLane, s as Functions, t as AggregateFunctions } from "./db-DLjWu9-f-ldboYM8A.mjs";
8
- import { a as SqlAggregateDescriptorRegistry, n as ExecutionContext } from "./query-lane-context-OSV9X636-DFRkNeXq.mjs";
9
- import "./query-lane-context-SRmvD9-J.mjs";
4
+ import { c as AnyExpression } from "./types-CqwI8eGx-AYan1yI4.mjs";
5
+ import "./ast-DWgP3Fnu.mjs";
6
+ import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-B-9RZQN9.mjs";
7
+ import { S as TableProxyContract, f as QueryContext, g as Scope, i as Db, o as FieldProxy, p as RawLane, s as Functions, t as AggregateFunctions } from "./db-CJxU3aL_-CMuiIKs5.mjs";
8
+ import { a as SqlAggregateDescriptorRegistry, n as ExecutionContext } from "./query-lane-context-Ft8I-pge-nABTUotc.mjs";
9
+ import "./query-lane-context-CEYIBLlG.mjs";
10
10
  import { Contract } from "@prisma/orm-framework/contract/types";
11
11
  //#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.d.mts
12
12
  //#region src/runtime/expression-impl.d.ts
@@ -1,6 +1,6 @@
1
- import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, H as isOrderByDirection, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, _ as InsertAst, c as DeleteAst, g as IdentifierRef, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, t as AggregateExpr, y as JoinAst } from "./types-BLnsGaJf-m-qTW3ox.mjs";
2
- import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
3
- import { i as isExpression, n as codecOf, o as toExpr, r as createRawSql } from "./expression-Bv8X6-Qg.mjs";
1
+ import { A as ParamRef, C as LiteralExpr, E as NullCheckExpr, F as SelectAst, H as isAggregateFn, I as SubqueryExpr, L as TableSource, M as ProjectionItem, O as OrExpr, R as UpdateAst, S as ListExpression, U as isOrderByDirection, W as isOrderByNulls, _ as InsertAst, c as DeleteAst, g as IdentifierRef, k as OrderByItem, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, t as AggregateExpr, w as LockingClause, y as JoinAst } from "./types-C9UR53Lv-BF-_alNk.mjs";
2
+ import { r as isAggregateProjection, t as collectOrderedParamRefs } from "./util-BBgcP3gI-XJBkxo1K.mjs";
3
+ import { i as isExpression, n as codecOf, o as toExpr, r as createRawSql } from "./expression-gmLQa4Ie.mjs";
4
4
  import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-DoGFktu5.mjs";
5
5
  import { assertAnnotationsApplicable } from "@prisma/orm-framework/components/runtime";
6
6
  //#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs
@@ -396,6 +396,7 @@ function emptyState(from, scope) {
396
396
  offset: void 0,
397
397
  distinct: void 0,
398
398
  distinctOn: void 0,
399
+ locking: void 0,
399
400
  scope,
400
401
  rowFields: {},
401
402
  annotations: /* @__PURE__ */ new Map()
@@ -412,7 +413,27 @@ function combineWhereExprs(exprs) {
412
413
  if (exprs.length === 1) return exprs[0];
413
414
  return AndExpr.of(exprs);
414
415
  }
416
+ function lockConflictOf(state) {
417
+ const conflicts = {
418
+ distinct: state.distinct !== void 0,
419
+ distinctOn: state.distinctOn !== void 0 && state.distinctOn.length > 0,
420
+ groupBy: state.groupBy.length > 0,
421
+ having: state.having !== void 0
422
+ };
423
+ return Object.entries(conflicts).find(([, present]) => present)?.[0];
424
+ }
425
+ function assertLockable(state) {
426
+ if (state.locking === void 0) return;
427
+ const conflict = lockConflictOf(state);
428
+ if (conflict !== void 0) throw structuredError("ORM.LOCK_INCOMPATIBLE", `A locking clause cannot be combined with ${conflict}`, { meta: { conflict } });
429
+ const item = state.projections.find(isAggregateProjection);
430
+ if (item !== void 0) throw structuredError("ORM.LOCK_INCOMPATIBLE", `A locking clause cannot be combined with an aggregate or window function in the projection (column "${item.alias}")`, { meta: { conflict: "aggregate" } });
431
+ }
432
+ function assertNotLocked(state) {
433
+ if (state.locking !== void 0) throw structuredError("ORM.LOCK_INCOMPATIBLE", "A locked select cannot be used as a subquery", { meta: { conflict: "subquery" } });
434
+ }
415
435
  function buildSelectAst(state) {
436
+ assertLockable(state);
416
437
  const where = combineWhereExprs(state.where);
417
438
  return new SelectAst({
418
439
  from: state.from,
@@ -426,6 +447,7 @@ function buildSelectAst(state) {
426
447
  having: state.having,
427
448
  limit: state.limit,
428
449
  offset: state.offset,
450
+ locking: state.locking,
429
451
  selectAllIntent: void 0
430
452
  });
431
453
  }
@@ -655,6 +677,7 @@ var QueryBase = class extends BuilderBase {
655
677
  return new GroupedQueryImpl(cloneState(this.state, { groupBy: [...this.state.groupBy, ...exprs] }), this.ctx);
656
678
  }
657
679
  as(alias) {
680
+ assertNotLocked(this.state);
658
681
  const ast = buildSelectAst(this.state);
659
682
  const derivedSource = DerivedTableSource.as(alias, ast);
660
683
  const scope = {
@@ -670,6 +693,7 @@ var QueryBase = class extends BuilderBase {
670
693
  return this.state.rowFields;
671
694
  }
672
695
  buildAst() {
696
+ assertNotLocked(this.state);
673
697
  return buildSelectAst(this.state);
674
698
  }
675
699
  build() {
@@ -698,7 +722,28 @@ var SelectQueryImpl = class SelectQueryImpl extends QueryBase {
698
722
  const item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, false);
699
723
  return this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));
700
724
  }
725
+ forUpdate = this._gate({ sql: { forUpdate: true } }, "forUpdate", (options) => this.lock("forUpdate", options));
726
+ forNoKeyUpdate = this._gate({ postgres: { forNoKeyUpdate: true } }, "forNoKeyUpdate", (options) => this.lock("forNoKeyUpdate", options));
727
+ forShare = this._gate({ sql: { forShare: true } }, "forShare", (options) => this.lock("forShare", options));
728
+ forKeyShare = this._gate({ postgres: { forKeyShare: true } }, "forKeyShare", (options) => this.lock("forKeyShare", options));
729
+ lock(strength, options) {
730
+ const of = options?.of !== void 0 && options.of.length > 0 ? options.of : void 0;
731
+ if (of !== void 0) assertCapability(this.ctx, { sql: { lockOf: true } }, strength);
732
+ const waitPolicy = lockWaitPolicyOf(strength, options);
733
+ if (waitPolicy === "nowait") assertCapability(this.ctx, { sql: { lockNowait: true } }, strength);
734
+ if (waitPolicy === "skipLocked") assertCapability(this.ctx, { sql: { lockSkipLocked: true } }, strength);
735
+ const clause = LockingClause.of(strength, {
736
+ ...ifDefined("of", of),
737
+ ...ifDefined("waitPolicy", waitPolicy)
738
+ });
739
+ return this.clone(cloneState(this.state, { locking: [...this.state.locking ?? [], clause] }));
740
+ }
701
741
  };
742
+ function lockWaitPolicyOf(methodName, options) {
743
+ if (options?.nowait && options.skipLocked) throw structuredError("ORM.ARGUMENT_INVALID", `${methodName}() takes nowait or skipLocked, not both`, { meta: { method: methodName } });
744
+ if (options?.nowait) return "nowait";
745
+ if (options?.skipLocked) return "skipLocked";
746
+ }
702
747
  var GroupedQueryImpl = class GroupedQueryImpl extends QueryBase {
703
748
  clone(state) {
704
749
  return new GroupedQueryImpl(state, this.ctx);