@prisma/orm-family-mongo 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1

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 (207) hide show
  1. package/README.md +1 -5
  2. package/dist/authoring-entity-types-UA5sY_Xm-DeYf_cYq.mjs +87 -0
  3. package/dist/authoring-entity-types-UA5sY_Xm-DeYf_cYq.mjs.map +1 -0
  4. package/dist/{canonicalization-hooks-DF3Z6sjO.mjs → canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs} +4 -3
  5. package/dist/canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs.map +1 -0
  6. package/dist/codec.d.mts +1 -1
  7. package/dist/codec.mjs +1 -1
  8. package/dist/{config-types-CFDf9ivE.mjs → config-types-DYTCUpAs.mjs} +5 -5
  9. package/dist/config-types-DYTCUpAs.mjs.map +1 -0
  10. package/dist/contract-builder-BHzQQk70.mjs +965 -0
  11. package/dist/contract-builder-BHzQQk70.mjs.map +1 -0
  12. package/dist/{contract-builder-DB8nguDE.d.mts → contract-builder-ClL-xMK2.d.mts} +271 -89
  13. package/dist/contract-builder-ClL-xMK2.d.mts.map +1 -0
  14. package/dist/contract-prisma6__provider.d.mts +35 -0
  15. package/dist/contract-prisma6__provider.d.mts.map +1 -0
  16. package/dist/contract-prisma6__provider.mjs +1202 -0
  17. package/dist/contract-prisma6__provider.mjs.map +1 -0
  18. package/dist/contract-psl.d.mts +152 -28
  19. package/dist/contract-psl.d.mts.map +1 -1
  20. package/dist/contract-psl.mjs +3 -2
  21. package/dist/contract-psl__provider.mjs +74 -44
  22. package/dist/contract-psl__provider.mjs.map +1 -1
  23. package/dist/contract-ts.d.mts +2 -2
  24. package/dist/contract-ts.mjs +2 -2
  25. package/dist/contract-ts__config-types.mjs +1 -1
  26. package/dist/contract-ts__contract-builder.d.mts +2 -2
  27. package/dist/contract-ts__contract-builder.mjs +1 -1
  28. package/dist/contract.d.mts +3 -3
  29. package/dist/contract.mjs +3 -3
  30. package/dist/contract__canonicalization-hooks.mjs +1 -1
  31. package/dist/contract__data-type.d.mts +37 -0
  32. package/dist/contract__data-type.d.mts.map +1 -0
  33. package/dist/contract__data-type.mjs +2 -0
  34. package/dist/contract__entity-kinds.d.mts +1 -1
  35. package/dist/contract__entity-kinds.mjs +1 -1
  36. package/dist/{control-C7-kthr1.d.mts → control-4pC8N2Rb.d.mts} +32 -19
  37. package/dist/control-4pC8N2Rb.d.mts.map +1 -0
  38. package/dist/{control-CClR5JMr.mjs → control-BQMBG11d.mjs} +19 -2
  39. package/dist/control-BQMBG11d.mjs.map +1 -0
  40. package/dist/{control-BbZQqmxo.mjs → control-B_pPN58L.mjs} +195 -87
  41. package/dist/control-B_pPN58L.mjs.map +1 -0
  42. package/dist/{control-Cj81sPbj.d.mts → control-CvQSMuxa.d.mts} +29 -6
  43. package/dist/control-CvQSMuxa.d.mts.map +1 -0
  44. package/dist/{control-adapter-Db5pT77b.d.mts → control-adapter-Bh_ZraGM--5JDb99k.d.mts} +48 -4
  45. package/dist/control-adapter-Bh_ZraGM--5JDb99k.d.mts.map +1 -0
  46. package/dist/control-adapter-CndDiTXW.d.mts +1 -0
  47. package/dist/dist-B8f-pfcT.mjs +1031 -0
  48. package/dist/dist-B8f-pfcT.mjs.map +1 -0
  49. package/dist/dist-Bgk36iLI.mjs +53 -0
  50. package/dist/dist-Bgk36iLI.mjs.map +1 -0
  51. package/dist/{dist-C7Ykq48Q.mjs → dist-CO2arS1K.mjs} +3 -1
  52. package/dist/dist-CO2arS1K.mjs.map +1 -0
  53. package/dist/{dist-Dyp05u64.mjs → dist-gmGbjhmk.mjs} +56 -32
  54. package/dist/dist-gmGbjhmk.mjs.map +1 -0
  55. package/dist/dist-xk_0xOR-.mjs +28 -0
  56. package/dist/dist-xk_0xOR-.mjs.map +1 -0
  57. package/dist/emitter.d.mts +2 -4
  58. package/dist/emitter.d.mts.map +1 -1
  59. package/dist/emitter.mjs +1 -1
  60. package/dist/{entity-kinds-B4KNTF8z-DPIuUuuB.mjs → entity-kinds-BQBtfVet-B-Px7NHp.mjs} +35 -18
  61. package/dist/entity-kinds-BQBtfVet-B-Px7NHp.mjs.map +1 -0
  62. package/dist/{execution-D5XyZ5XS.mjs → execution-CgP1Sdbr.mjs} +6 -3
  63. package/dist/execution-CgP1Sdbr.mjs.map +1 -0
  64. package/dist/{execution-CKnUiOfm.d.mts → execution-tPmN5pge.d.mts} +6 -2
  65. package/dist/execution-tPmN5pge.d.mts.map +1 -0
  66. package/dist/{exports-Bx-hlnZ3.mjs → exports-BAimNKOs.mjs} +31 -21
  67. package/dist/exports-BAimNKOs.mjs.map +1 -0
  68. package/dist/exports-BHQVApAg.mjs +86 -0
  69. package/dist/exports-BHQVApAg.mjs.map +1 -0
  70. package/dist/family.d.mts +11 -10
  71. package/dist/family.mjs +10 -9
  72. package/dist/family__control-adapter.d.mts +3 -2
  73. package/dist/family__control.d.mts +2 -2
  74. package/dist/family__control.mjs +3 -3
  75. package/dist/family__ir.d.mts +2 -2
  76. package/dist/family__ir.mjs +3 -3
  77. package/dist/family__migration.d.mts +1 -1
  78. package/dist/family__migration.mjs +1 -1
  79. package/dist/family__pack.d.mts +1 -1
  80. package/dist/family__pack.mjs +4 -2
  81. package/dist/family__pack.mjs.map +1 -1
  82. package/dist/family__runtime.d.mts +3 -3
  83. package/dist/family__runtime.mjs +3 -2
  84. package/dist/family__schema-verify.d.mts +1 -1
  85. package/dist/family__schema-verify.mjs +1 -1
  86. package/dist/{field-accessor-0oUt6RZC-B_Z30uAA.mjs → field-accessor-0oUt6RZC-CrJVzQiS.mjs} +2 -2
  87. package/dist/{field-accessor-0oUt6RZC-B_Z30uAA.mjs.map → field-accessor-0oUt6RZC-CrJVzQiS.mjs.map} +1 -1
  88. package/dist/{field-accessor-DHsAPiW3-BdYCspQC.d.mts → field-accessor-CmxCw9xP-C6jMngbK.d.mts} +35 -24
  89. package/dist/field-accessor-CmxCw9xP-C6jMngbK.d.mts.map +1 -0
  90. package/dist/index-9DDQlC5U.d.mts +87 -0
  91. package/dist/index-9DDQlC5U.d.mts.map +1 -0
  92. package/dist/{index-BR0ue13b.d.mts → index-BdXzdXGE.d.mts} +14 -8
  93. package/dist/index-BdXzdXGE.d.mts.map +1 -0
  94. package/dist/index-BhIiYIXu.d.mts +845 -0
  95. package/dist/index-BhIiYIXu.d.mts.map +1 -0
  96. package/dist/index-CQG5l2o9.d.mts +67 -0
  97. package/dist/index-CQG5l2o9.d.mts.map +1 -0
  98. package/dist/{index-DAOkcTCK.d.mts → index-FeVOOdZ0.d.mts} +9 -8
  99. package/dist/index-FeVOOdZ0.d.mts.map +1 -0
  100. package/dist/index-YY1SU_7o.d.mts +366 -0
  101. package/dist/index-YY1SU_7o.d.mts.map +1 -0
  102. package/dist/{index-DxoO-ywI.d.mts → index-rANtsIZG.d.mts} +9 -5
  103. package/dist/{index-DxoO-ywI.d.mts.map → index-rANtsIZG.d.mts.map} +1 -1
  104. package/dist/interpreter-BfHdPd7T-DGqi2_Um.mjs +2186 -0
  105. package/dist/interpreter-BfHdPd7T-DGqi2_Um.mjs.map +1 -0
  106. package/dist/{ir-CQrenTYt.d.mts → ir-BLC0t6_x.d.mts} +5 -27
  107. package/dist/ir-BLC0t6_x.d.mts.map +1 -0
  108. package/dist/{ir-Ch2aPr7a.mjs → ir-DGm0HXbP.mjs} +3 -8
  109. package/dist/ir-DGm0HXbP.mjs.map +1 -0
  110. package/dist/lowering.d.mts +1 -1
  111. package/dist/{migration-dcM7u4HG.mjs → migration-DnQ7_A_B.mjs} +4 -4
  112. package/dist/migration-DnQ7_A_B.mjs.map +1 -0
  113. package/dist/{migration-CNDQv5yB.d.mts → migration-YQVmgFU8.d.mts} +7 -7
  114. package/dist/{migration-CNDQv5yB.d.mts.map → migration-YQVmgFU8.d.mts.map} +1 -1
  115. package/dist/{mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs → mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs} +27 -8
  116. package/dist/mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs.map +1 -0
  117. package/dist/{mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts → mongo-contract-view-AnejqfrQ-Wj_ulq2L.d.mts} +3 -3
  118. package/dist/{mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts.map → mongo-contract-view-AnejqfrQ-Wj_ulq2L.d.mts.map} +1 -1
  119. package/dist/{mongo-contract-view-rcWzby6f-wRBCUnBt.mjs → mongo-contract-view-D5yu2LrY-DCAZYJ4q.mjs} +4 -4
  120. package/dist/{mongo-contract-view-rcWzby6f-wRBCUnBt.mjs.map → mongo-contract-view-D5yu2LrY-DCAZYJ4q.mjs.map} +1 -1
  121. package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs +53 -0
  122. package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs.map +1 -0
  123. package/dist/{mongo-value-set-tNn9-pun-dJYx_rVD.d.mts → mongo-value-set-DEd7WLCT-B2Ar2GkJ.d.mts} +20 -4
  124. package/dist/mongo-value-set-DEd7WLCT-B2Ar2GkJ.d.mts.map +1 -0
  125. package/dist/orm.d.mts +154 -96
  126. package/dist/orm.d.mts.map +1 -1
  127. package/dist/orm.mjs +670 -148
  128. package/dist/orm.mjs.map +1 -1
  129. package/dist/pack-qw77Jt2G.d.mts +58 -0
  130. package/dist/pack-qw77Jt2G.d.mts.map +1 -0
  131. package/dist/query-ast.d.mts +5 -5
  132. package/dist/query-ast.mjs +3 -3
  133. package/dist/query-ast__control.d.mts +4 -4
  134. package/dist/query-ast__control.mjs +2 -2
  135. package/dist/query-ast__execution.d.mts +2 -2
  136. package/dist/query-ast__execution.mjs +1 -1
  137. package/dist/query-builder.d.mts +4 -836
  138. package/dist/query-builder.mjs +2 -2
  139. package/dist/query-builder__contract-free.d.mts +6 -6
  140. package/dist/query-builder__contract-free.mjs +3 -3
  141. package/dist/{query-plan-C0-Yu8hf-DdilEdW6.d.mts → query-plan-3fs1HokF-CrNsr-Wx.d.mts} +10 -4
  142. package/dist/{query-plan-C0-Yu8hf-DdilEdW6.d.mts.map → query-plan-3fs1HokF-CrNsr-Wx.d.mts.map} +1 -1
  143. package/dist/runtime-B5fNQHQZ.mjs +16 -0
  144. package/dist/runtime-B5fNQHQZ.mjs.map +1 -0
  145. package/dist/runtime-yZA30qM2.d.mts +11 -0
  146. package/dist/runtime-yZA30qM2.d.mts.map +1 -0
  147. package/dist/runtime.d.mts +74 -87
  148. package/dist/runtime.d.mts.map +1 -1
  149. package/dist/runtime.mjs +133 -67
  150. package/dist/runtime.mjs.map +1 -1
  151. package/dist/schema-ir.d.mts +2 -2
  152. package/dist/schema-ir.mjs +2 -2
  153. package/dist/{schema-verify-DJGr28XW.d.mts → schema-verify-CVOG6EZx.d.mts} +5 -5
  154. package/dist/{schema-verify-DJGr28XW.d.mts.map → schema-verify-CVOG6EZx.d.mts.map} +1 -1
  155. package/dist/value.d.mts +2 -2
  156. package/dist/value.mjs +1 -1
  157. package/dist/{verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs → verify-mongo-schema-CeQP5N4k-CNOctppM.mjs} +9 -26
  158. package/dist/verify-mongo-schema-CeQP5N4k-CNOctppM.mjs.map +1 -0
  159. package/dist/wire.d.mts +3 -3
  160. package/dist/wire.mjs +14 -2
  161. package/dist/wire.mjs.map +1 -1
  162. package/package.json +24 -21
  163. package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs +0 -176
  164. package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs.map +0 -1
  165. package/dist/canonicalization-hooks-DF3Z6sjO.mjs.map +0 -1
  166. package/dist/config-types-CFDf9ivE.mjs.map +0 -1
  167. package/dist/contract-builder-BFq0gOMV.mjs +0 -634
  168. package/dist/contract-builder-BFq0gOMV.mjs.map +0 -1
  169. package/dist/contract-builder-DB8nguDE.d.mts.map +0 -1
  170. package/dist/control-BbZQqmxo.mjs.map +0 -1
  171. package/dist/control-C7-kthr1.d.mts.map +0 -1
  172. package/dist/control-CClR5JMr.mjs.map +0 -1
  173. package/dist/control-Cj81sPbj.d.mts.map +0 -1
  174. package/dist/control-adapter-Db5pT77b.d.mts.map +0 -1
  175. package/dist/dist-C7Ykq48Q.mjs.map +0 -1
  176. package/dist/dist-Czwqx_i3.mjs +0 -58
  177. package/dist/dist-Czwqx_i3.mjs.map +0 -1
  178. package/dist/dist-DHrEJnhK.mjs +0 -236
  179. package/dist/dist-DHrEJnhK.mjs.map +0 -1
  180. package/dist/dist-Dyp05u64.mjs.map +0 -1
  181. package/dist/entity-kinds-B4KNTF8z-DPIuUuuB.mjs.map +0 -1
  182. package/dist/execution-CKnUiOfm.d.mts.map +0 -1
  183. package/dist/execution-D5XyZ5XS.mjs.map +0 -1
  184. package/dist/exports-Bx-hlnZ3.mjs.map +0 -1
  185. package/dist/exports-C4RGBGzZ.mjs +0 -156
  186. package/dist/exports-C4RGBGzZ.mjs.map +0 -1
  187. package/dist/field-accessor-DHsAPiW3-BdYCspQC.d.mts.map +0 -1
  188. package/dist/index-BR0ue13b.d.mts.map +0 -1
  189. package/dist/index-Cd2zLiU6.d.mts +0 -128
  190. package/dist/index-Cd2zLiU6.d.mts.map +0 -1
  191. package/dist/index-DAOkcTCK.d.mts.map +0 -1
  192. package/dist/index-Dv2PNMiG.d.mts +0 -53
  193. package/dist/index-Dv2PNMiG.d.mts.map +0 -1
  194. package/dist/index-wKMm41HC.d.mts +0 -30
  195. package/dist/index-wKMm41HC.d.mts.map +0 -1
  196. package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs +0 -1091
  197. package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs.map +0 -1
  198. package/dist/ir-CQrenTYt.d.mts.map +0 -1
  199. package/dist/ir-Ch2aPr7a.mjs.map +0 -1
  200. package/dist/migration-dcM7u4HG.mjs.map +0 -1
  201. package/dist/mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs.map +0 -1
  202. package/dist/mongo-value-set-tNn9-pun-dJYx_rVD.d.mts.map +0 -1
  203. package/dist/pack-D9aLY50F.d.mts +0 -44
  204. package/dist/pack-D9aLY50F.d.mts.map +0 -1
  205. package/dist/query-builder.d.mts.map +0 -1
  206. package/dist/runtime-DPkRW4iu.d.mts +0 -1
  207. package/dist/verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"dist-Dyp05u64.mjs","names":["#contract","#state","#withStage","#writeTerminal","#writeMeta","#ctx","#modelName","#filters","#foldedFilter"],"sources":["../../../../2-mongo-family/5-query-builders/query-builder/dist/index.mjs"],"sourcesContent":["import { i as ormError, n as expr, r as resolveUpdaterResult, t as createFieldAccessor } from \"./field-accessor-0oUt6RZC.mjs\";\nimport { AggregateCommand, DeleteManyCommand, DeleteOneCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggAccumulator, MongoAggCond, MongoAggFieldRef, MongoAggLiteral, MongoAggOperator, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, MongoCountStage, MongoDensifyStage, MongoExistsExpr, MongoFacetStage, MongoFillStage, MongoGeoNearStage, MongoGraphLookupStage, MongoGroupStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoOutStage, MongoProjectStage, MongoRedactStage, MongoReplaceRootStage, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, MongoUnionWithStage, MongoUnwindStage, MongoVectorSearchStage, UpdateManyCommand, UpdateOneCommand, freezeMongoFieldShape, freezeMongoResultShape } from \"@internal/mongo-query-ast/execution\";\nimport { domainModelsAtDefaultNamespace } from \"@internal/contract/types\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/accumulator-helpers.ts\nfunction namedAccumulatorArgs(args) {\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(args)) if (val !== void 0) result[key] = val.node;\n\treturn result;\n}\nconst acc = {\n\tsum(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.sum(expr.node)\n\t\t};\n\t},\n\tavg(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.avg(expr.node)\n\t\t};\n\t},\n\tmin(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.min(expr.node)\n\t\t};\n\t},\n\tmax(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.max(expr.node)\n\t\t};\n\t},\n\tfirst(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.first(expr.node)\n\t\t};\n\t},\n\tlast(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.last(expr.node)\n\t\t};\n\t},\n\tpush(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.push(expr.node)\n\t\t};\n\t},\n\taddToSet(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.addToSet(expr.node)\n\t\t};\n\t},\n\tcount() {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.count()\n\t\t};\n\t},\n\tstdDevPop(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.stdDevPop(expr.node)\n\t\t};\n\t},\n\tstdDevSamp(expr) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.stdDevSamp(expr.node)\n\t\t};\n\t},\n\tfirstN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$firstN\", namedAccumulatorArgs(args))\n\t\t};\n\t},\n\tlastN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$lastN\", namedAccumulatorArgs(args))\n\t\t};\n\t},\n\tmaxN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$maxN\", namedAccumulatorArgs(args))\n\t\t};\n\t},\n\tminN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$minN\", namedAccumulatorArgs(args))\n\t\t};\n\t},\n\ttop(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$top\", {\n\t\t\t\toutput: args.output.node,\n\t\t\t\tsortBy: MongoAggLiteral.of(args.sortBy)\n\t\t\t})\n\t\t};\n\t},\n\tbottom(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$bottom\", {\n\t\t\t\toutput: args.output.node,\n\t\t\t\tsortBy: MongoAggLiteral.of(args.sortBy)\n\t\t\t})\n\t\t};\n\t},\n\ttopN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$topN\", {\n\t\t\t\toutput: args.output.node,\n\t\t\t\tsortBy: MongoAggLiteral.of(args.sortBy),\n\t\t\t\tn: args.n.node\n\t\t\t})\n\t\t};\n\t},\n\tbottomN(args) {\n\t\treturn {\n\t\t\t_field: void 0,\n\t\t\tnode: MongoAggAccumulator.of(\"$bottomN\", {\n\t\t\t\toutput: args.output.node,\n\t\t\t\tsortBy: MongoAggLiteral.of(args.sortBy),\n\t\t\t\tn: args.n.node\n\t\t\t})\n\t\t};\n\t}\n};\n//#endregion\n//#region src/lookup-builder.ts\n/**\n* Construct the `from` callable for `PipelineChain.lookup`. The contract\n* is captured so `from(name)` can resolve `roots[name]` to the foreign\n* model name at runtime, look up the foreign collection name from\n* `models[modelName].storage.collection`, and assemble a `LookupResult`\n* for the outer `lookup` to consume.\n*\n* The `Shape`/`Nested` generics are erased at runtime — they exist only\n* to type the local accessor inside the user's `on(...)` callback. The\n* contract value at runtime carries the real model lookup table.\n*/\nfunction createLookupFrom(contract) {\n\tconst callable = ((rootName) => {\n\t\tconst modelName = contract.roots[rootName]?.model;\n\t\tif (!modelName) throw ormError(\"ORM.MODEL_UNKNOWN\", `lookup() unknown root: \"${rootName}\". Valid roots: ${Object.keys(contract.roots).join(\", \")}`);\n\t\treturn createLookupBuilder({\n\t\t\trootName,\n\t\t\tmodelName,\n\t\t\tforeignCollection: domainModelsAtDefaultNamespace(contract.domain)[modelName]?.storage?.collection ?? rootName\n\t\t});\n\t});\n\treturn callable;\n}\nfunction createLookupBuilder(state) {\n\treturn { on(cb) {\n\t\tconst result = cb(createFieldAccessor(), createFieldAccessor());\n\t\tassertLeafExpression(result.local, \"local\");\n\t\tassertLeafExpression(result.foreign, \"foreign\");\n\t\treturn createLookupBuilderWithKey({\n\t\t\t...state,\n\t\t\tlocalField: result.local._path,\n\t\t\tforeignField: result.foreign._path\n\t\t});\n\t} };\n}\nfunction createLookupBuilderWithKey(state) {\n\treturn { as(name) {\n\t\treturn {\n\t\t\t_brand: \"mongo-query-builder/lookup-result@1\",\n\t\t\t_root: state.rootName,\n\t\t\t_model: state.modelName,\n\t\t\t_localField: state.localField,\n\t\t\t_foreignField: state.foreignField,\n\t\t\t_as: name\n\t\t};\n\t} };\n}\n/**\n* Defensive runtime guard catching the case where a user returns a\n* non-`LeafExpression` from the `on(...)` callback (e.g. by casting\n* around the type system, or threading a value in from outside the\n* callback). Compile-time gating via `LookupOnResult`'s `LeafExpression`\n* type already rejects `fn.<op>(…)` returns at the type level — this\n* guard is the runtime backstop matching the defensive style of\n* `deconstructFindAndModifyChain` in builder.ts.\n*/\nfunction assertLeafExpression(value, side) {\n\tif (!value || typeof value._path !== \"string\" || value._path.length === 0) throw ormError(\"ORM.ARGUMENT_INVALID\", `lookup().on() ${side} side must return a leaf field reference (e.g. \\`${side}.<field>\\`). Aggregation expressions and computed values are not supported.`);\n}\n/**\n* Extract the runtime metadata from a `LookupResult` for `PipelineChain\n* .lookup` to construct the `MongoLookupStage`. The internal fields are\n* intentionally underscore-prefixed and brand-checked here so user code\n* cannot synthesise a fake spec; this is the single ingress point.\n*/\nfunction extractLookupResult(result, contract) {\n\tif (result?._brand !== \"mongo-query-builder/lookup-result@1\") throw ormError(\"ORM.ARGUMENT_INVALID\", \"lookup() callback must return the result of `from(name).on(cb).as(name)`. Returning a hand-rolled options object is not supported.\");\n\treturn {\n\t\tforeignCollection: domainModelsAtDefaultNamespace(contract.domain)[result._model]?.storage?.collection ?? result._root,\n\t\tlocalField: result._localField,\n\t\tforeignField: result._foreignField,\n\t\tas: result._as,\n\t\tmodelName: result._model\n\t};\n}\n//#endregion\n//#region src/pipeline-result-shape.ts\nconst identityStageKinds = /* @__PURE__ */ new Set([\n\t\"match\",\n\t\"sort\",\n\t\"limit\",\n\t\"skip\",\n\t\"sample\",\n\t\"vectorSearch\"\n]);\nconst unknownShape = { kind: \"unknown\" };\nfunction fieldShapeAtPath(shape, path) {\n\tif (shape.kind !== \"document\" || path.includes(\".\")) return unknownShape;\n\treturn shape.fields[path] ?? unknownShape;\n}\nfunction shapeForExpr(currentShape, expr) {\n\tif (expr instanceof MongoAggFieldRef) return fieldShapeAtPath(currentShape, expr.path);\n\treturn unknownShape;\n}\nfunction resultShapeAfterProject(currentShape, stage) {\n\tif (currentShape.kind !== \"document\") return { kind: \"unknown\" };\n\tconst fields = {};\n\tfor (const [key, value] of Object.entries(stage.projection)) {\n\t\tif (value === 0) continue;\n\t\tif (value === 1) {\n\t\t\tfields[key] = currentShape.fields[key] ?? unknownShape;\n\t\t\tcontinue;\n\t\t}\n\t\tfields[key] = shapeForExpr(currentShape, value);\n\t}\n\tif (!Object.hasOwn(stage.projection, \"_id\") && currentShape.fields[\"_id\"]) fields[\"_id\"] = currentShape.fields[\"_id\"];\n\treturn freezeMongoResultShape({\n\t\tkind: \"document\",\n\t\tfields\n\t});\n}\nfunction resultShapeAfterAddFields(currentShape, stage) {\n\tif (currentShape.kind !== \"document\") return { kind: \"unknown\" };\n\tconst fields = { ...currentShape.fields };\n\tfor (const [key, expr] of Object.entries(stage.fields)) fields[key] = shapeForExpr(currentShape, expr);\n\treturn freezeMongoResultShape({\n\t\tkind: \"document\",\n\t\tfields\n\t});\n}\nfunction computePipelineResultShape(stages, startShape) {\n\tlet shape = startShape;\n\tfor (const stage of stages) {\n\t\tif (shape.kind === \"unknown\") return { kind: \"unknown\" };\n\t\tif (identityStageKinds.has(stage.kind)) continue;\n\t\tif (stage instanceof MongoProjectStage) {\n\t\t\tshape = resultShapeAfterProject(shape, stage);\n\t\t\tcontinue;\n\t\t}\n\t\tif (stage instanceof MongoAddFieldsStage) {\n\t\t\tshape = resultShapeAfterAddFields(shape, stage);\n\t\t\tcontinue;\n\t\t}\n\t\treturn { kind: \"unknown\" };\n\t}\n\treturn shape;\n}\n//#endregion\n//#region src/result-shape.ts\nfunction contractFieldToMongoFieldShape(field) {\n\tconst { type, nullable, many } = field;\n\tif (type.kind === \"valueObject\" || type.kind === \"union\") return Object.freeze({ kind: \"unknown\" });\n\tif (type.kind !== \"scalar\") return Object.freeze({ kind: \"unknown\" });\n\tif (field.dict === true) return Object.freeze({ kind: \"unknown\" });\n\tif (many === true) return freezeMongoFieldShape({\n\t\tkind: \"array\",\n\t\tnullable,\n\t\telement: {\n\t\t\tkind: \"leaf\",\n\t\t\tcodecId: type.codecId,\n\t\t\tnullable: false\n\t\t}\n\t});\n\treturn freezeMongoFieldShape({\n\t\tkind: \"leaf\",\n\t\tcodecId: type.codecId,\n\t\tnullable\n\t});\n}\nfunction contractModelToMongoResultShape(model, options) {\n\tconst fields = {};\n\tfor (const rel of options?.includeRelationNames ?? []) fields[rel] = Object.freeze({ kind: \"unknown\" });\n\tconst modelFields = model.fields;\n\tconst keys = options?.selection !== void 0 ? options.selection : Object.keys(modelFields);\n\tfor (const key of keys) {\n\t\tif (Object.hasOwn(fields, key)) continue;\n\t\tconst cf = modelFields[key];\n\t\tif (!cf) {\n\t\t\tfields[key] = Object.freeze({ kind: \"unknown\" });\n\t\t\tcontinue;\n\t\t}\n\t\tfields[key] = contractFieldToMongoFieldShape(cf);\n\t}\n\treturn freezeMongoResultShape({\n\t\tkind: \"document\",\n\t\tfields\n\t});\n}\n//#endregion\n//#region src/builder.ts\n/**\n* The pipeline state in the query-builder state machine.\n*\n* Reached from `CollectionHandle` or `FilteredCollection` after the first\n* pipeline-stage method call (or directly via `aggregate()` shortcuts). Holds\n* the accumulated `MongoPipelineStage[]` and exposes pipeline-stage methods,\n* the `merge`/`out` write terminals, and the `build`/`aggregate` read\n* terminals.\n*\n* Two phantom type parameters gate the conditional terminals:\n*\n* - `U extends UpdateEnabled` — when `'update-ok'`, the no-arg `updateMany()` /\n* `updateOne()` form is available (consume the chain as an\n* update-with-pipeline spec). Cleared by stages that produce content the\n* `update` AST cannot represent (e.g. `$group`, `$lookup`, `$limit`).\n* - `F extends FindAndModifyEnabled` — when `'fam-ok'`, the\n* `findOneAndUpdate(...)` / `findOneAndDelete(...)` terminals are\n* available. Cleared by stages incompatible with their wire-command slots\n* (`$limit`, `$group`, mutating stages, …).\n*\n* The marker semantics are encoded in the per-method return types — see the\n* marker table (and rationale per row) in\n* `docs/architecture docs/adrs/ADR 201 - State-machine pattern for typed DSL builders.md`.\n*/\nvar PipelineChain = class PipelineChain {\n\t#contract;\n\t#state;\n\tconstructor(contract, state) {\n\t\tthis.#contract = contract;\n\t\tthis.#state = state;\n\t}\n\t/**\n\t* Internal helper that appends a pipeline stage and branches into a new\n\t* state-type. The fifth type parameter `NewN` carries the nested-path\n\t* shape forward. It defaults to `Record<string, never>` so stages that\n\t* fundamentally rewrite the document (`$group`, `$project`,\n\t* `$replaceRoot`, …) automatically disable the callable form of\n\t* `FieldAccessor` downstream. Additive stages (`match`, `addFields`,\n\t* `sort`, `lookup`, …) explicitly re-thread the current `N`.\n\t*/\n\t#withStage(stage) {\n\t\treturn new PipelineChain(this.#contract, {\n\t\t\t...this.#state,\n\t\t\tstages: [...this.#state.stages, stage]\n\t\t});\n\t}\n\t#writeMeta() {\n\t\treturn {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#state.storageHash,\n\t\t\tlane: \"mongo-query\"\n\t\t};\n\t}\n\tmatch(filterOrFn) {\n\t\tconst filter = typeof filterOrFn === \"function\" ? filterOrFn(createFieldAccessor()) : filterOrFn;\n\t\treturn this.#withStage(new MongoMatchStage(filter));\n\t}\n\t/**\n\t* `$sort`. Clears `UpdateEnabled` (`update` has no per-document sort) but\n\t* preserves `FindAndModifyEnabled` (`findAndModify` has a `sort` slot).\n\t*/\n\tsort(spec) {\n\t\treturn this.#withStage(new MongoSortStage(spec));\n\t}\n\t/**\n\t* `$limit`. Clears both markers — `limit` is incompatible with the `update`\n\t* wire command, and `findAndModify` already implies single-document\n\t* semantics (so `.limit(...)` adds no meaning, only ambiguity).\n\t*/\n\tlimit(n) {\n\t\treturn this.#withStage(new MongoLimitStage(n));\n\t}\n\t/**\n\t* `$skip`. Clears both markers — MongoDB's `findAndModify` wire command\n\t* has no `skip` slot, so `deconstructFindAndModifyChain` rejects any\n\t* `$skip` at runtime; keeping the marker `fam-cleared` makes the type\n\t* system reflect the same constraint (see ADR 201 marker table).\n\t*/\n\tskip(n) {\n\t\treturn this.#withStage(new MongoSkipStage(n));\n\t}\n\tsample(n) {\n\t\treturn this.#withStage(new MongoSampleStage(n));\n\t}\n\t/**\n\t* `$addFields`. Preserves `UpdateEnabled` (representable as\n\t* update-with-pipeline `$set`); clears `FindAndModifyEnabled` (no analogue\n\t* in the find-and-modify wire commands). The nested-path shape `N` is\n\t* preserved — newly added flat fields are reachable via property access\n\t* (`f.newField`) but do not themselves carry nested structure.\n\t*/\n\taddFields(fn) {\n\t\tconst newFields = fn(createFieldAccessor());\n\t\tconst exprRecord = {};\n\t\tfor (const [key, typed] of Object.entries(newFields)) exprRecord[key] = typed.node;\n\t\treturn this.#withStage(new MongoAddFieldsStage(exprRecord));\n\t}\n\t/**\n\t* `$lookup`. Clears both markers — joins are not representable in either\n\t* the `update` or `findAndModify` wire commands. The original document's\n\t* nested-path shape `N` is preserved (the lookup adds a sidecar array\n\t* field; existing keys are untouched).\n\t*\n\t* The single callback receives a `from` callable that grounds the\n\t* foreign-root literal sequentially before the inner `on(...)`\n\t* callback is type-checked — see `lookup-builder.ts`. The resulting\n\t* `Shape` gains the `As` key as a `ModelArrayField<ModelName>` so\n\t* `ResolveRow` produces `Array<ForeignRow>` (with concrete leaf\n\t* types) instead of the legacy `unknown[]`.\n\t*/\n\tlookup(fn) {\n\t\tconst extracted = extractLookupResult(fn(createLookupFrom(this.#contract)), this.#contract);\n\t\treturn this.#withStage(new MongoLookupStage({\n\t\t\tfrom: extracted.foreignCollection,\n\t\t\tlocalField: extracted.localField,\n\t\t\tforeignField: extracted.foreignField,\n\t\t\tas: extracted.as\n\t\t}));\n\t}\n\tproject(...args) {\n\t\tif (args.length === 1 && typeof args[0] === \"function\") {\n\t\t\tconst fn = args[0];\n\t\t\tconst spec = fn(createFieldAccessor());\n\t\t\tconst projection = {};\n\t\t\tfor (const [key, val] of Object.entries(spec)) projection[key] = val === 1 ? 1 : val.node;\n\t\t\treturn this.#withStage(new MongoProjectStage(projection));\n\t\t}\n\t\tconst keys = args;\n\t\tconst projection = {};\n\t\tfor (const key of keys) projection[key] = 1;\n\t\treturn this.#withStage(new MongoProjectStage(projection));\n\t}\n\t/**\n\t* `$unwind`. Clears both markers — array unrolling produces multiple output\n\t* documents per input, incompatible with both single-document update and\n\t* find-and-modify wire commands. The original `N` is preserved: unwind\n\t* replaces the unwound array slot with its element but leaves the rest\n\t* of the document structurally intact.\n\t*/\n\tunwind(field, options) {\n\t\treturn this.#withStage(new MongoUnwindStage(`$${field}`, options?.preserveNullAndEmptyArrays ?? false));\n\t}\n\t/**\n\t* `$group`. Clears both markers — group output bears no relation to source\n\t* documents; neither `update` nor `findAndModify` can consume it. Nested\n\t* path shape is reset (the source document's path tree is gone).\n\t*/\n\tgroup(fn) {\n\t\tconst { _id: groupIdExpr, ...rest } = fn(createFieldAccessor());\n\t\tconst groupId = groupIdExpr === null ? null : groupIdExpr.node;\n\t\tconst accumulators = {};\n\t\tfor (const [key, typed] of Object.entries(rest)) {\n\t\t\tif (typed === null) throw ormError(\"ORM.ARGUMENT_INVALID\", `group() field \"${key}\" must not be null. Only _id can be null.`);\n\t\t\tif (typed.node.kind !== \"accumulator\") throw ormError(\"ORM.ARGUMENT_INVALID\", `group() field \"${key}\" must use an accumulator (e.g. acc.sum(), acc.count()). Got \"${typed.node.kind}\" expression.`);\n\t\t\taccumulators[key] = typed.node;\n\t\t}\n\t\treturn this.#withStage(new MongoGroupStage(groupId, accumulators));\n\t}\n\t/**\n\t* `$replaceRoot`. Preserves `UpdateEnabled` (representable as\n\t* update-with-pipeline `$replaceRoot`); clears `FindAndModifyEnabled`.\n\t* Nested path shape is reset — the replaced root has no relation to\n\t* the original document structure.\n\t*/\n\treplaceRoot(fn) {\n\t\tconst expr = fn(createFieldAccessor());\n\t\treturn this.#withStage(new MongoReplaceRootStage(expr.node));\n\t}\n\tcount(field) {\n\t\treturn this.#withStage(new MongoCountStage(field));\n\t}\n\tsortByCount(fn) {\n\t\tconst expr = fn(createFieldAccessor());\n\t\treturn this.#withStage(new MongoSortByCountStage(expr.node));\n\t}\n\t/**\n\t* `$redact`. Preserves `UpdateEnabled`; clears `FindAndModifyEnabled`.\n\t* Shape- and nested-path-preserving (the document tree is unchanged).\n\t*/\n\tredact(fn) {\n\t\tconst expr = fn(createFieldAccessor());\n\t\treturn this.#withStage(new MongoRedactStage(expr.node));\n\t}\n\t/**\n\t* `$out` write terminal. Materialises the pipeline output into\n\t* `collection` (optionally in `db`), replacing any prior contents. Unlike\n\t* the other pipeline-stage methods, this **terminates** the chain — it\n\t* returns a `MongoQueryPlan` rather than another `PipelineChain`, since\n\t* `$out` must be the final stage and there is nothing further to chain.\n\t*\n\t* Lane is `mongo-query` (matching all other terminals in this package) so\n\t* middleware can dispatch on intent without inspecting the command.\n\t*\n\t* The result row stream is empty (`unknown` row type) — the data lives\n\t* in the destination collection, not the response.\n\t*/\n\tout(collection, db) {\n\t\treturn this.#writeTerminal(new MongoOutStage(collection, db));\n\t}\n\t/**\n\t* `$merge` write terminal. Streams the pipeline output into the target\n\t* collection per the supplied merge semantics (`whenMatched` /\n\t* `whenNotMatched`). Like `out()`, terminates the chain — `$merge` must\n\t* be the final stage.\n\t*/\n\tmerge(options) {\n\t\treturn this.#writeTerminal(new MongoMergeStage(options));\n\t}\n\t#writeTerminal(stage) {\n\t\tconst pipeline = [...this.#state.stages, stage];\n\t\tconst command = new AggregateCommand(this.#state.collection, pipeline);\n\t\tconst meta = {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#state.storageHash,\n\t\t\tlane: \"mongo-query\"\n\t\t};\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta\n\t\t};\n\t}\n\tunionWith(collection, pipeline) {\n\t\treturn this.#withStage(new MongoUnionWithStage(collection, pipeline));\n\t}\n\tbucket(options) {\n\t\treturn this.#withStage(new MongoBucketStage(options));\n\t}\n\tbucketAuto(options) {\n\t\treturn this.#withStage(new MongoBucketAutoStage(options));\n\t}\n\tgeoNear(options) {\n\t\treturn this.#withStage(new MongoGeoNearStage(options));\n\t}\n\tfacet(facets) {\n\t\treturn this.#withStage(new MongoFacetStage(facets));\n\t}\n\tgraphLookup(options) {\n\t\treturn this.#withStage(new MongoGraphLookupStage(options));\n\t}\n\tsetWindowFields(options) {\n\t\treturn this.#withStage(new MongoSetWindowFieldsStage(options));\n\t}\n\tdensify(options) {\n\t\treturn this.#withStage(new MongoDensifyStage(options));\n\t}\n\tfill(options) {\n\t\treturn this.#withStage(new MongoFillStage(options));\n\t}\n\tsearch(config, index) {\n\t\treturn this.#withStage(new MongoSearchStage(config, index));\n\t}\n\tsearchMeta(config, index) {\n\t\treturn this.#withStage(new MongoSearchMetaStage(config, index));\n\t}\n\tvectorSearch(options) {\n\t\treturn this.#withStage(new MongoVectorSearchStage(options));\n\t}\n\tpipe(stage) {\n\t\treturn this.#withStage(stage);\n\t}\n\t/**\n\t* No-arg `updateMany()`: deconstruct the chain into leading `$match`\n\t* stages (folded into the filter) and remaining stages (which must all\n\t* be valid pipeline-update stages). Available only when `U = 'update-ok'`.\n\t*\n\t* The optional callback parameter exists for subclass-override\n\t* compatibility with `FilteredCollection.updateMany(updaterFn)` — TS's\n\t* strict override check requires the parent's parameter to accept at\n\t* least what the child's signature does. A runtime guard throws if a\n\t* callback is actually passed on a bare `PipelineChain`. Note that\n\t* because nothing in the public surface transitions `U` from\n\t* `'update-cleared'` (the initial state on `CollectionHandle` /\n\t* `FilteredCollection`) back to `'update-ok'`, the no-arg form is\n\t* reachable only via explicit type casts in internal tests — the\n\t* callback-form \"type hole\" is therefore not reachable from user\n\t* code. See `docs/architecture docs/adrs/ADR 201 - State-machine\n\t* pattern for typed DSL builders.md` for the marker-transition table.\n\t*/\n\tupdateMany(updaterFn) {\n\t\tif (updaterFn !== void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"updateMany() on a PipelineChain expects no arguments — the chain itself is the update pipeline. To update with an operator callback, call .updateMany(fn) on a FilteredCollection (i.e. after .match()).\");\n\t\tconst { filter, updatePipeline } = deconstructUpdateChain(this.#state.stages);\n\t\tconst command = new UpdateManyCommand(this.#state.collection, filter, updatePipeline);\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta: this.#writeMeta()\n\t\t};\n\t}\n\t/**\n\t* No-arg `updateOne()`: same as `updateMany()` but maps to a single-doc\n\t* update. Carries the same optional-callback/subclass-compat caveat\n\t* documented above — the callback form is reachable only via forced\n\t* casts in internal tests.\n\t*/\n\tupdateOne(updaterFn) {\n\t\tif (updaterFn !== void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"updateOne() on a PipelineChain expects no arguments — the chain itself is the update pipeline. To update with an operator callback, call .updateOne(fn) on a FilteredCollection (i.e. after .match()).\");\n\t\tconst { filter, updatePipeline } = deconstructUpdateChain(this.#state.stages);\n\t\tconst command = new UpdateOneCommand(this.#state.collection, filter, updatePipeline);\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta: this.#writeMeta()\n\t\t};\n\t}\n\t/**\n\t* Find a single document matching the accumulated pipeline (which must\n\t* consist solely of leading `$match` stages followed by at most one\n\t* `$sort`) and apply `updaterFn`. Available only when\n\t* `FindAndModifyEnabled` is `'fam-ok'` — stages that clear the marker\n\t* (including `$skip`, which MongoDB's `findAndModify` has no slot for)\n\t* make this method invisible at the type level.\n\t*\n\t* The pipeline stages are deconstructed into the wire command's `filter`\n\t* and `sort` slots. If any non-deconstructable stage is present, a\n\t* runtime error is thrown as a defensive check (the type system should\n\t* prevent this).\n\t*/\n\tfindOneAndUpdate(updaterFn, opts = {}) {\n\t\tconst { filter, sort } = deconstructFindAndModifyChain(this.#state.stages);\n\t\tconst update = resolveUpdaterResult(updaterFn(createFieldAccessor()));\n\t\tconst command = new FindOneAndUpdateCommand(this.#state.collection, filter, update, opts.upsert ?? false, sort, opts.returnDocument ?? \"after\");\n\t\tconst meta = {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#state.storageHash,\n\t\t\tlane: \"mongo-query\"\n\t\t};\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta\n\t\t};\n\t}\n\t/**\n\t* Find a single document matching the accumulated pipeline and delete it.\n\t* Same marker gating and deconstruction as `findOneAndUpdate`.\n\t*/\n\tfindOneAndDelete() {\n\t\tconst { filter, sort } = deconstructFindAndModifyChain(this.#state.stages);\n\t\tconst command = new FindOneAndDeleteCommand(this.#state.collection, filter, sort);\n\t\tconst meta = {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#state.storageHash,\n\t\t\tlane: \"mongo-query\"\n\t\t};\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta\n\t\t};\n\t}\n\t/**\n\t* Materialise the chain as a `MongoQueryPlan` wrapping an `AggregateCommand`.\n\t*/\n\tbuild() {\n\t\tconst command = new AggregateCommand(this.#state.collection, this.#state.stages);\n\t\tconst meta = {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#state.storageHash,\n\t\t\tlane: \"mongo-query\"\n\t\t};\n\t\tconst modelName = this.#state.modelName;\n\t\tconst contractNarrow = this.#contract;\n\t\tlet resultShape;\n\t\tif (modelName !== void 0) {\n\t\t\tconst model = castAs(domainModelsAtDefaultNamespace(contractNarrow.domain)[modelName]);\n\t\t\tresultShape = model ? computePipelineResultShape(this.#state.stages, contractModelToMongoResultShape(model)) : { kind: \"unknown\" };\n\t\t}\n\t\treturn {\n\t\t\tcollection: this.#state.collection,\n\t\t\tcommand,\n\t\t\tmeta,\n\t\t\t...ifDefined(\"resultShape\", resultShape)\n\t\t};\n\t}\n\t/**\n\t* Alias for `build()` — surfaces the read intent at the call site.\n\t*/\n\taggregate() {\n\t\treturn this.build();\n\t}\n};\n/**\n* Walk the accumulated pipeline stages and extract the `filter` and `sort`\n* slots for a `findOneAndUpdate` / `findOneAndDelete` wire command.\n*\n* The helper accepts exactly the canonical shape `match+ -> sort?` and\n* nothing else:\n*\n* - one or more `$match` stages (AND-folded into a single filter),\n* - optionally followed by a single `$sort` stage.\n*\n* Anything else — a `$sort` before `$match`, multiple `$sort` stages, a\n* `$skip` stage, or any non-`$match`/`$sort` stage — is rejected with a\n* clear error. The type system already prevents most of these at compile\n* time via the `FindAndModifyEnabled` marker, but the runtime check\n* guards the escape hatches (e.g. `.pipe(...)`) and future marker gaps.\n*\n* `$skip` is rejected outright because MongoDB's `findAndModify` command\n* has no skip slot; a silently-dropped skip is a latent correctness bug\n* waiting to happen. (A02 removed skip from the typed AST for the same\n* reason.)\n*/\nfunction deconstructFindAndModifyChain(stages) {\n\tconst matchFilters = [];\n\tlet sort;\n\tlet seenNonMatch = false;\n\tfor (const stage of stages) if (stage instanceof MongoMatchStage) {\n\t\tif (seenNonMatch) throw ormError(\"ORM.ARGUMENT_INVALID\", \"findOneAndUpdate/findOneAndDelete requires the canonical $match+ -> $sort? shape, but a $match stage was found after a $sort. Re-order the chain so every .match() call precedes the .sort() call.\");\n\t\tmatchFilters.push(stage.filter);\n\t} else if (stage instanceof MongoSortStage) {\n\t\tif (sort !== void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"findOneAndUpdate/findOneAndDelete accepts at most one $sort stage; drop the extra .sort() call or combine the keys into a single sort spec.\");\n\t\tsort = { ...stage.sort };\n\t\tseenNonMatch = true;\n\t} else if (stage instanceof MongoSkipStage) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", \"findOneAndUpdate/findOneAndDelete does not support .skip() — MongoDB findAndModify has no skip slot. Remove the .skip() call, or use .aggregate()/.build() if the chain needs skip semantics.\");\n\telse throw ormError(\"ORM.ARGUMENT_INVALID\", `findOneAndUpdate/findOneAndDelete requires the canonical \\$match+ -> \\$sort? shape, but encountered a '${stage.constructor.name}' stage. This is likely a bug — the type system should have prevented this chain.`);\n\tif (matchFilters.length === 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"findOneAndUpdate/findOneAndDelete requires at least one .match() call.\");\n\tconst first = matchFilters[0];\n\tif (first === void 0) throw new InternalError(\"Unreachable: matchFilters.length > 0 but first is undefined\");\n\treturn {\n\t\tfilter: matchFilters.length === 1 ? first : MongoAndExpr.of(matchFilters),\n\t\tsort\n\t};\n}\n/**\n* Walk the accumulated pipeline stages: leading `$match` stages become the\n* filter, remaining stages must all be valid `MongoUpdatePipelineStage`\n* members (currently `$addFields`, `$project`, `$replaceRoot`).\n*/\nfunction deconstructUpdateChain(stages) {\n\tconst matchFilters = [];\n\tlet boundary = 0;\n\tfor (const stage of stages) {\n\t\tif (!(stage instanceof MongoMatchStage)) break;\n\t\tmatchFilters.push(stage.filter);\n\t\tboundary++;\n\t}\n\tif (matchFilters.length === 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"No-arg updateMany/updateOne requires at least one .match() call.\");\n\tconst remaining = stages.slice(boundary);\n\tif (remaining.length === 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"No-arg updateMany/updateOne requires at least one pipeline-update stage (e.g. .addFields(), .project(), .replaceRoot()) after the .match() stages.\");\n\tconst updatePipeline = [];\n\tfor (const stage of remaining) if (stage instanceof MongoAddFieldsStage || stage instanceof MongoProjectStage || stage instanceof MongoReplaceRootStage) updatePipeline.push(stage);\n\telse throw ormError(\"ORM.ARGUMENT_INVALID\", `No-arg updateMany/updateOne: encountered non-update stage '${stage.constructor.name}' after the leading \\$match stages. Only \\$addFields/\\$set, \\$project/\\$unset, and \\$replaceRoot/\\$replaceWith stages are valid in an update pipeline.`);\n\tconst first = matchFilters[0];\n\tif (first === void 0) throw new InternalError(\"Unreachable: matchFilters.length > 0 but first is undefined\");\n\treturn {\n\t\tfilter: matchFilters.length === 1 ? first : MongoAndExpr.of(matchFilters),\n\t\tupdatePipeline\n\t};\n}\n//#endregion\n//#region src/expression-helpers.ts\nfunction numericExpr(op, args) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/double@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, args.map((a) => a.node))\n\t};\n}\nfunction numericUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/double@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction stringExpr(op, args) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/string@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, args.map((a) => a.node))\n\t};\n}\nfunction stringUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/string@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction booleanExpr(op, args) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/bool@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, args.map((a) => a.node))\n\t};\n}\nfunction booleanUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/bool@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction dateUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/date@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction arrayExpr(op, args) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/array@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, args.map((a) => a.node))\n\t};\n}\nfunction arrayUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: \"mongo/array@1\",\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction docUnaryExpr(op, arg) {\n\treturn {\n\t\t_field: {\n\t\t\tcodecId: arg._field.codecId,\n\t\t\tnullable: false\n\t\t},\n\t\tnode: MongoAggOperator.of(op, arg.node)\n\t};\n}\nfunction namedArgsExpr(op, args, _field) {\n\tconst nodeArgs = {};\n\tfor (const [key, val] of Object.entries(args)) if (val !== void 0) nodeArgs[key] = val.node;\n\treturn {\n\t\t_field,\n\t\tnode: MongoAggOperator.of(op, nodeArgs)\n\t};\n}\nconst NUMERIC = {\n\tcodecId: \"mongo/double@1\",\n\tnullable: false\n};\nconst STRING = {\n\tcodecId: \"mongo/string@1\",\n\tnullable: false\n};\nconst BOOLEAN = {\n\tcodecId: \"mongo/bool@1\",\n\tnullable: false\n};\nconst DATE = {\n\tcodecId: \"mongo/date@1\",\n\tnullable: false\n};\nconst ARRAY = {\n\tcodecId: \"mongo/array@1\",\n\tnullable: false\n};\nconst DOC = {\n\tcodecId: \"mongo/document@1\",\n\tnullable: false\n};\nfunction literal(value) {\n\treturn {\n\t\t_field: void 0,\n\t\tnode: MongoAggLiteral.of(value)\n\t};\n}\nconst fn = {\n\tadd(...args) {\n\t\treturn numericExpr(\"$add\", args);\n\t},\n\tsubtract(a, b) {\n\t\treturn numericExpr(\"$subtract\", [a, b]);\n\t},\n\tmultiply(...args) {\n\t\treturn numericExpr(\"$multiply\", args);\n\t},\n\tdivide(a, b) {\n\t\treturn numericExpr(\"$divide\", [a, b]);\n\t},\n\tconcat(...args) {\n\t\treturn stringExpr(\"$concat\", args);\n\t},\n\ttoLower(a) {\n\t\treturn stringUnaryExpr(\"$toLower\", a);\n\t},\n\ttoUpper(a) {\n\t\treturn stringUnaryExpr(\"$toUpper\", a);\n\t},\n\tsize(a) {\n\t\treturn numericUnaryExpr(\"$size\", a);\n\t},\n\tcond(condition, thenExpr, elseExpr) {\n\t\treturn {\n\t\t\t_field: thenExpr._field,\n\t\t\tnode: new MongoAggCond(condition, thenExpr.node, elseExpr.node)\n\t\t};\n\t},\n\tliteral,\n\tyear(a) {\n\t\treturn numericUnaryExpr(\"$year\", a);\n\t},\n\tmonth(a) {\n\t\treturn numericUnaryExpr(\"$month\", a);\n\t},\n\tdayOfMonth(a) {\n\t\treturn numericUnaryExpr(\"$dayOfMonth\", a);\n\t},\n\thour(a) {\n\t\treturn numericUnaryExpr(\"$hour\", a);\n\t},\n\tminute(a) {\n\t\treturn numericUnaryExpr(\"$minute\", a);\n\t},\n\tsecond(a) {\n\t\treturn numericUnaryExpr(\"$second\", a);\n\t},\n\tmillisecond(a) {\n\t\treturn numericUnaryExpr(\"$millisecond\", a);\n\t},\n\tdateToString(args) {\n\t\treturn namedArgsExpr(\"$dateToString\", args, STRING);\n\t},\n\tdateFromString(args) {\n\t\treturn namedArgsExpr(\"$dateFromString\", args, DATE);\n\t},\n\tdateDiff(args) {\n\t\treturn namedArgsExpr(\"$dateDiff\", args, NUMERIC);\n\t},\n\tdateAdd(args) {\n\t\treturn namedArgsExpr(\"$dateAdd\", args, DATE);\n\t},\n\tdateSubtract(args) {\n\t\treturn namedArgsExpr(\"$dateSubtract\", args, DATE);\n\t},\n\tdateTrunc(args) {\n\t\treturn namedArgsExpr(\"$dateTrunc\", args, DATE);\n\t},\n\tsubstr(str, start, length) {\n\t\treturn stringExpr(\"$substr\", [\n\t\t\tstr,\n\t\t\tstart,\n\t\t\tlength\n\t\t]);\n\t},\n\tsubstrBytes(str, start, count) {\n\t\treturn stringExpr(\"$substrBytes\", [\n\t\t\tstr,\n\t\t\tstart,\n\t\t\tcount\n\t\t]);\n\t},\n\ttrim(args) {\n\t\treturn namedArgsExpr(\"$trim\", args, STRING);\n\t},\n\tltrim(args) {\n\t\treturn namedArgsExpr(\"$ltrim\", args, STRING);\n\t},\n\trtrim(args) {\n\t\treturn namedArgsExpr(\"$rtrim\", args, STRING);\n\t},\n\tsplit(str, delimiter) {\n\t\treturn arrayExpr(\"$split\", [str, delimiter]);\n\t},\n\tstrLenCP(a) {\n\t\treturn numericUnaryExpr(\"$strLenCP\", a);\n\t},\n\tstrLenBytes(a) {\n\t\treturn numericUnaryExpr(\"$strLenBytes\", a);\n\t},\n\tregexMatch(args) {\n\t\treturn namedArgsExpr(\"$regexMatch\", args, BOOLEAN);\n\t},\n\tregexFind(args) {\n\t\treturn namedArgsExpr(\"$regexFind\", args, DOC);\n\t},\n\tregexFindAll(args) {\n\t\treturn namedArgsExpr(\"$regexFindAll\", args, ARRAY);\n\t},\n\treplaceOne(args) {\n\t\treturn namedArgsExpr(\"$replaceOne\", args, STRING);\n\t},\n\treplaceAll(args) {\n\t\treturn namedArgsExpr(\"$replaceAll\", args, STRING);\n\t},\n\tcmp(a, b) {\n\t\treturn numericExpr(\"$cmp\", [a, b]);\n\t},\n\teq(a, b) {\n\t\treturn booleanExpr(\"$eq\", [a, b]);\n\t},\n\tne(a, b) {\n\t\treturn booleanExpr(\"$ne\", [a, b]);\n\t},\n\tgt(a, b) {\n\t\treturn booleanExpr(\"$gt\", [a, b]);\n\t},\n\tgte(a, b) {\n\t\treturn booleanExpr(\"$gte\", [a, b]);\n\t},\n\tlt(a, b) {\n\t\treturn booleanExpr(\"$lt\", [a, b]);\n\t},\n\tlte(a, b) {\n\t\treturn booleanExpr(\"$lte\", [a, b]);\n\t},\n\tarrayElemAt(arr, idx) {\n\t\treturn {\n\t\t\t_field: {\n\t\t\t\tcodecId: DOC.codecId,\n\t\t\t\tnullable: true\n\t\t\t},\n\t\t\tnode: MongoAggOperator.of(\"$arrayElemAt\", [arr.node, idx.node])\n\t\t};\n\t},\n\tconcatArrays(...args) {\n\t\treturn arrayExpr(\"$concatArrays\", args);\n\t},\n\tfirstElem(a) {\n\t\treturn {\n\t\t\t_field: {\n\t\t\t\tcodecId: DOC.codecId,\n\t\t\t\tnullable: true\n\t\t\t},\n\t\t\tnode: MongoAggOperator.of(\"$first\", a.node)\n\t\t};\n\t},\n\tlastElem(a) {\n\t\treturn {\n\t\t\t_field: {\n\t\t\t\tcodecId: DOC.codecId,\n\t\t\t\tnullable: true\n\t\t\t},\n\t\t\tnode: MongoAggOperator.of(\"$last\", a.node)\n\t\t};\n\t},\n\tisIn(elem, arr) {\n\t\treturn booleanExpr(\"$in\", [elem, arr]);\n\t},\n\tindexOfArray(arr, value, ...rest) {\n\t\treturn numericExpr(\"$indexOfArray\", [\n\t\t\tarr,\n\t\t\tvalue,\n\t\t\t...rest\n\t\t]);\n\t},\n\tisArray(a) {\n\t\treturn booleanUnaryExpr(\"$isArray\", a);\n\t},\n\treverseArray(a) {\n\t\treturn arrayUnaryExpr(\"$reverseArray\", a);\n\t},\n\tslice(arr, ...rest) {\n\t\treturn arrayExpr(\"$slice\", [arr, ...rest]);\n\t},\n\tzip(args) {\n\t\tconst nodeArgs = { inputs: args.inputs.map((a) => a.node) };\n\t\tif (args.useLongestLength) nodeArgs[\"useLongestLength\"] = args.useLongestLength.node;\n\t\tif (args.defaults) nodeArgs[\"defaults\"] = args.defaults.node;\n\t\treturn {\n\t\t\t_field: ARRAY,\n\t\t\tnode: MongoAggOperator.of(\"$zip\", nodeArgs)\n\t\t};\n\t},\n\trange(start, end, step) {\n\t\treturn arrayExpr(\"$range\", [\n\t\t\tstart,\n\t\t\tend,\n\t\t\tstep\n\t\t]);\n\t},\n\tsetUnion(...args) {\n\t\treturn arrayExpr(\"$setUnion\", args);\n\t},\n\tsetIntersection(...args) {\n\t\treturn arrayExpr(\"$setIntersection\", args);\n\t},\n\tsetDifference(a, b) {\n\t\treturn arrayExpr(\"$setDifference\", [a, b]);\n\t},\n\tsetEquals(...args) {\n\t\treturn booleanExpr(\"$setEquals\", args);\n\t},\n\tsetIsSubset(a, b) {\n\t\treturn booleanExpr(\"$setIsSubset\", [a, b]);\n\t},\n\tanyElementTrue(a) {\n\t\treturn booleanUnaryExpr(\"$anyElementTrue\", a);\n\t},\n\tallElementsTrue(a) {\n\t\treturn booleanUnaryExpr(\"$allElementsTrue\", a);\n\t},\n\ttypeOf(a) {\n\t\treturn stringUnaryExpr(\"$type\", a);\n\t},\n\tconvert(args) {\n\t\treturn namedArgsExpr(\"$convert\", args, DOC);\n\t},\n\ttoInt(a) {\n\t\treturn numericUnaryExpr(\"$toInt\", a);\n\t},\n\ttoLong(a) {\n\t\treturn numericUnaryExpr(\"$toLong\", a);\n\t},\n\ttoDouble(a) {\n\t\treturn numericUnaryExpr(\"$toDouble\", a);\n\t},\n\ttoDecimal(a) {\n\t\treturn numericUnaryExpr(\"$toDecimal\", a);\n\t},\n\ttoString_(a) {\n\t\treturn stringUnaryExpr(\"$toString\", a);\n\t},\n\ttoObjectId(a) {\n\t\treturn docUnaryExpr(\"$toObjectId\", a);\n\t},\n\ttoBool(a) {\n\t\treturn booleanUnaryExpr(\"$toBool\", a);\n\t},\n\ttoDate(a) {\n\t\treturn dateUnaryExpr(\"$toDate\", a);\n\t},\n\tobjectToArray(a) {\n\t\treturn arrayUnaryExpr(\"$objectToArray\", a);\n\t},\n\tarrayToObject(a) {\n\t\treturn {\n\t\t\t_field: DOC,\n\t\t\tnode: MongoAggOperator.of(\"$arrayToObject\", a.node)\n\t\t};\n\t},\n\tgetField(args) {\n\t\treturn namedArgsExpr(\"$getField\", args, DOC);\n\t},\n\tsetField(args) {\n\t\treturn namedArgsExpr(\"$setField\", args, DOC);\n\t}\n};\n//#endregion\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/state-classes.ts\n/**\n* \"Match-all\" filter used by the unqualified-write terminals\n* (`updateAll`/`deleteAll`). The canonical representation is still\n* undecided — `MongoAndExpr` with an empty conjunction and a dedicated\n* `MongoMatchAllExpr` node are both candidates. For now we use\n* `_id $exists: true`, which is trivially true on every document and\n* avoids introducing a new AST node before the wider question is\n* resolved. Centralised so the eventual switch is a one-line change.\n*/\nfunction matchAllFilter() {\n\treturn MongoExistsExpr.exists(\"_id\");\n}\n/**\n* Resolve an updater callback into a `MongoUpdateSpec` (either the folded\n* operator object or a pipeline-stage array). Centralised so all write\n* terminals share the same fold / dispatch semantics.\n*/\nfunction resolveUpdaterCallback(updaterFn) {\n\treturn resolveUpdaterResult(updaterFn(createFieldAccessor()));\n}\n/**\n* Build the `PlanMeta` envelope shared by every write terminal in this\n* package. Lane is `mongo-query` (single lane for all query-builder terminals)\n* so middleware can dispatch on intent without inspecting the command.\n*/\nfunction writeMeta(storageHash) {\n\treturn {\n\t\ttarget: \"mongo\",\n\t\tstorageHash,\n\t\tlane: \"mongo-query\"\n\t};\n}\n/**\n* Root state of the query-builder state machine. Returned from\n* `mongoQuery(...).from(name)` and bound to a single collection.\n*\n* Inherits the entire pipeline-stage surface from `PipelineChain` (since an\n* empty `CollectionHandle` is observably an empty pipeline). Adds:\n*\n* - `match(...)` — overridden to transition to `FilteredCollection`, which\n* accumulates filters for eventual splatting into write/find-and-modify\n* wire commands.\n* - **Insert / unqualified-write methods** (M2): `insertOne`, `insertMany`,\n* `updateAll`, `deleteAll`. These live *only* here — the corresponding\n* methods are absent from `FilteredCollection`, so a caller cannot\n* accidentally produce an unqualified write by forgetting to `.match(...)`\n* later in the chain. Bodies land in M2.\n*/\nvar CollectionHandle = class extends PipelineChain {\n\t#ctx;\n\t#modelName;\n\tconstructor(ctx, modelName) {\n\t\tsuper(ctx.contract, {\n\t\t\tcollection: ctx.collection,\n\t\t\tstages: [],\n\t\t\tstorageHash: ctx.storageHash,\n\t\t\tmodelName\n\t\t});\n\t\tthis.#ctx = ctx;\n\t\tthis.#modelName = modelName;\n\t}\n\t/**\n\t* Bound model name. Exposed so type tests can assert the binding without\n\t* flipping into a pipeline. Not part of the public-API contract.\n\t*/\n\tget _modelName() {\n\t\treturn this.#modelName;\n\t}\n\tmatch(filterOrFn) {\n\t\tconst resolved = typeof filterOrFn === \"function\" ? filterOrFn(createFieldAccessor()) : filterOrFn;\n\t\treturn new FilteredCollection(this.#ctx, this.#modelName, [resolved]);\n\t}\n\t/**\n\t* Insert a single document. Document fields are passed straight through to\n\t* the wire `InsertOneCommand` — codec normalisation happens at the\n\t* adapter/driver boundary, identically to the SQL builder (see Open Item\n\t* #14 confirmation in the design conversation).\n\t*\n\t* Returns a `MongoQueryPlan<InsertOneResult>` whose row stream yields a\n\t* single result document with the server-assigned `insertedId`.\n\t*/\n\tinsertOne(document) {\n\t\tconst command = new InsertOneCommand(this.#ctx.collection, document);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Insert a batch of documents. Order is preserved in the returned\n\t* `insertedIds` array.\n\t*/\n\tinsertMany(documents) {\n\t\tif (documents.length === 0) throw ormError(\"ORM.MUTATION_DATA_MISSING\", \"insertMany() requires at least one document.\");\n\t\tconst command = new InsertManyCommand(this.#ctx.collection, documents);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Update *every* document in the collection. Lives only on\n\t* `CollectionHandle` — the corresponding method is intentionally absent\n\t* from `FilteredCollection` so a caller cannot accidentally produce an\n\t* unqualified write by forgetting to `.match(...)` first. Pair with\n\t* `.match(...).updateMany(...)` for the filtered case.\n\t*/\n\tupdateAll(updaterFn) {\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new UpdateManyCommand(this.#ctx.collection, matchAllFilter(), update);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Delete *every* document in the collection. See `updateAll` for the\n\t* rationale around the unqualified-write surface being limited to this\n\t* state class.\n\t*/\n\tdeleteAll() {\n\t\tconst command = new DeleteManyCommand(this.#ctx.collection, matchAllFilter());\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Insert-or-update the document matching `filterFn`. The filter is\n\t* mandatory (vs. `updateAll`'s tautological match) because an upsert\n\t* without a discriminating predicate would either match every existing\n\t* document or insert an indistinguishable new one.\n\t*\n\t* Maps to `UpdateOneCommand` with `upsert: true`. The driver inserts a\n\t* new document derived from the filter equality fields plus the update\n\t* spec when no match is found; otherwise updates the matched document.\n\t*/\n\tupsertOne(filterFn, updaterFn) {\n\t\tconst filter = filterFn(createFieldAccessor());\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new UpdateOneCommand(this.#ctx.collection, filter, update, true);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n};\n/**\n* State reached after one or more `.match(...)` calls on `CollectionHandle`.\n*\n* Inherits the pipeline-stage surface from `PipelineChain`, with the\n* accumulated filters baked in as a leading `$match` stage on the underlying\n* pipeline state. This means read-terminal output (`.aggregate()` /\n* `.build()`) and any subsequent pipeline-stage chain see the filtered\n* collection as input — the read story works through pure inheritance.\n*\n* Adds:\n*\n* - `match(...)` — pushes another `$match` stage *and* records the filter in\n* the accumulator, so the eventual write/find-and-modify terminal can\n* splat the AND-folded filter into the wire command's `filter` slot.\n* - **Filtered writes** (M2): `updateMany`, `updateOne`, `deleteMany`,\n* `deleteOne`, `upsertOne`. Stubbed in M1. (Upsert-many is an open\n* question in the spec — see TML-2267 — and is intentionally absent.)\n* - **Find-and-modify** (M3): `findOneAndUpdate`, `findOneAndDelete`.\n* Stubbed in M1.\n*\n* Notably *does not* expose `insertOne`/`insertMany`/`updateAll`/`deleteAll`\n* — those are insert or unqualified-write operations that are nonsense\n* after a filter has been applied.\n*/\nvar FilteredCollection = class FilteredCollection extends PipelineChain {\n\t#ctx;\n\t#modelName;\n\t#filters;\n\tconstructor(ctx, modelName, filters) {\n\t\tif (filters.length === 0) throw new InternalError(\"FilteredCollection requires at least one accumulated filter\");\n\t\tconst first = filters[0];\n\t\tif (first === void 0) throw new InternalError(\"FilteredCollection: unreachable empty-filters branch\");\n\t\tconst leading = filters.length === 1 ? first : foldAnd(filters);\n\t\tsuper(ctx.contract, {\n\t\t\tcollection: ctx.collection,\n\t\t\tstages: [new MongoMatchStage(leading)],\n\t\t\tstorageHash: ctx.storageHash,\n\t\t\tmodelName\n\t\t});\n\t\tthis.#ctx = ctx;\n\t\tthis.#modelName = modelName;\n\t\tthis.#filters = filters;\n\t}\n\tget _modelName() {\n\t\treturn this.#modelName;\n\t}\n\t/**\n\t* Accumulated filter list. Exposed for the M2/M3 write/find-and-modify\n\t* terminals to splat into wire-command `filter` slots; not part of the\n\t* public-API contract.\n\t*/\n\tget _filters() {\n\t\treturn this.#filters;\n\t}\n\tmatch(filterOrFn) {\n\t\tconst resolved = typeof filterOrFn === \"function\" ? filterOrFn(createFieldAccessor()) : filterOrFn;\n\t\treturn new FilteredCollection(this.#ctx, this.#modelName, [...this.#filters, resolved]);\n\t}\n\t/**\n\t* AND-fold the accumulated filters into a single `MongoFilterExpr` for\n\t* splatting into a write/find-and-modify wire command's `filter` slot.\n\t* Length-1 short-circuits to avoid a redundant `$and` wrapper.\n\t*/\n\t#foldedFilter() {\n\t\tconst first = this.#filters[0];\n\t\tif (first === void 0) throw new InternalError(\"FilteredCollection: invariant violated — empty filter accumulator\");\n\t\treturn this.#filters.length === 1 ? first : foldAnd(this.#filters);\n\t}\n\t/**\n\t* Update every matching document. `updaterFn` receives a `FieldAccessor`\n\t* and returns an array of `TypedUpdateOp` (e.g. `[f.amount.inc(1),\n\t* f.status.set('done')]`). Operators are folded into the wire-format\n\t* update spec by `foldUpdateOps`, which throws on operator+path\n\t* collisions.\n\t*/\n\tupdateMany(updaterFn) {\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new UpdateManyCommand(this.#ctx.collection, this.#foldedFilter(), update);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Update at most one matching document. The driver picks the document\n\t* (typically the first one matched by the underlying scan); no ordering\n\t* guarantee is implied — chain `.sort(...)` and use the M3\n\t* `.findOneAndUpdate(...)` terminal when ordering matters.\n\t*/\n\tupdateOne(updaterFn) {\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new UpdateOneCommand(this.#ctx.collection, this.#foldedFilter(), update);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Delete every matching document.\n\t*/\n\tdeleteMany() {\n\t\tconst command = new DeleteManyCommand(this.#ctx.collection, this.#foldedFilter());\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Delete at most one matching document. See the `updateOne` note about\n\t* driver-chosen victim selection.\n\t*/\n\tdeleteOne() {\n\t\tconst command = new DeleteOneCommand(this.#ctx.collection, this.#foldedFilter());\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Insert-or-update against the accumulated filter. Maps to\n\t* `UpdateOneCommand` with `upsert: true`. Equivalent to\n\t* `CollectionHandle.upsertOne(f => filter, updaterFn)` but reuses the\n\t* already-accumulated `.match(...)` filter chain.\n\t*/\n\tupsertOne(updaterFn) {\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new UpdateOneCommand(this.#ctx.collection, this.#foldedFilter(), update, true);\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Find a single matching document and apply `updaterFn` to it.\n\t*\n\t* `opts.upsert` (default `false`) toggles insert-on-miss behaviour.\n\t* `opts.returnDocument` (default `'after'`) controls whether the row\n\t* stream yields the document as it was before or after the update.\n\t*/\n\tfindOneAndUpdate(updaterFn, opts = {}) {\n\t\tconst update = resolveUpdaterCallback(updaterFn);\n\t\tconst command = new FindOneAndUpdateCommand(this.#ctx.collection, this.#foldedFilter(), update, opts.upsert ?? false, void 0, opts.returnDocument ?? \"after\");\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n\t/**\n\t* Find a single matching document and delete it. Returns the deleted\n\t* document via the row stream.\n\t*/\n\tfindOneAndDelete() {\n\t\tconst command = new FindOneAndDeleteCommand(this.#ctx.collection, this.#foldedFilter());\n\t\treturn {\n\t\t\tcollection: this.#ctx.collection,\n\t\t\tcommand,\n\t\t\tmeta: writeMeta(this.#ctx.storageHash)\n\t\t};\n\t}\n};\nfunction foldAnd(filters) {\n\treturn MongoAndExpr.of(filters);\n}\n/**\n* Narrow a `MongoContractWithTypeMaps`-shaped value down to its underlying\n* `MongoContract` view. `MongoContractWithTypeMaps<C, ...>` is defined as\n* `C & { readonly [phantom]?: TTypeMaps }`, so every contract we accept is\n* structurally a `MongoContract` — the phantom is type-only. This helper\n* centralises that narrowing so callers don't reach for `as unknown as\n* MongoContract` double-casts.\n*/\nfunction asMongoContract(contract) {\n\treturn contract;\n}\n/**\n* Construct a `CollectionHandle` from a validated contract + root name.\n* Used by `mongoQuery(...).from(name)` to enter the state machine.\n*/\nfunction createCollectionHandle(contract, rootName) {\n\tconst c = asMongoContract(contract);\n\tconst modelName = c.roots[rootName]?.model;\n\tif (!modelName) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown root: \"${rootName}\". Valid roots: ${Object.keys(c.roots).join(\", \")}`);\n\tconst model = domainModelsAtDefaultNamespace(c.domain)[modelName];\n\tif (!model) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Unknown model: \"${modelName}\" referenced by root \"${rootName}\".`);\n\tconst collectionName = model.storage.collection ?? rootName;\n\tif (!c.storage?.storageHash) throw contractError(\"CONTRACT.VALIDATION_FAILED\", \"Contract is missing storage.storageHash. Pass a validated contract to mongoQuery().\");\n\treturn new CollectionHandle({\n\t\tcontract,\n\t\tcollection: collectionName,\n\t\tstorageHash: String(c.storage.storageHash)\n\t}, modelName);\n}\n//#endregion\n//#region src/query.ts\nfunction mongoQuery(options) {\n\tconst contract = blindCast(options.contractJson);\n\treturn {\n\t\tfrom(rootName) {\n\t\t\treturn createCollectionHandle(contract, rootName);\n\t\t},\n\t\trawCommand(command) {\n\t\t\tconst storageHash = asMongoContract(contract).storage?.storageHash;\n\t\t\tif (!storageHash) throw contractError(\"CONTRACT.VALIDATION_FAILED\", \"Contract is missing storage.storageHash. Pass a validated contract to mongoQuery().\");\n\t\t\tconst meta = {\n\t\t\t\ttarget: \"mongo\",\n\t\t\t\tstorageHash: String(storageHash),\n\t\t\t\tlane: \"mongo-query\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tcollection: command.collection,\n\t\t\t\tcommand,\n\t\t\t\tmeta\n\t\t\t};\n\t\t}\n\t};\n}\n//#endregion\nexport { CollectionHandle, FilteredCollection, PipelineChain, acc, contractFieldToMongoFieldShape, contractModelToMongoResultShape, createFieldAccessor, expr, fn, mongoQuery };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;AAQA,SAAS,qBAAqB,MAAM;CACnC,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,IAAI,GAAG,IAAI,QAAQ,KAAK,GAAG,OAAO,OAAO,IAAI;CACrF,OAAO;AACR;AACA,MAAM,MAAM;CACX,IAAI,MAAM;EACT,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,IAAI,KAAK,IAAI;EACxC;CACD;CACA,IAAI,MAAM;EACT,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,IAAI,KAAK,IAAI;EACxC;CACD;CACA,IAAI,MAAM;EACT,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,IAAI,KAAK,IAAI;EACxC;CACD;CACA,IAAI,MAAM;EACT,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,IAAI,KAAK,IAAI;EACxC;CACD;CACA,MAAM,MAAM;EACX,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,MAAM,KAAK,IAAI;EAC1C;CACD;CACA,KAAK,MAAM;EACV,OAAO;GACN,QAAQ,KAAK;GACb,MAAM,oBAAoB,KAAK,KAAK,IAAI;EACzC;CACD;CACA,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AAKA,SAAS,uBAAuB,UAAU,UAAU;CACnD,MAAM,IAAI,gBAAgB,QAAQ;CAClC,MAAM,YAAY,EAAE,MAAM,SAAS,EAAE;CACrC,IAAI,CAAC,WAAW,MAAM,SAAS,qBAAqB,kBAAkB,SAAS,kBAAkB,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,IAAI,GAAG;CAClI,MAAM,QAAQ,+BAA+B,EAAE,MAAM,CAAC,CAAC;CACvD,IAAI,CAAC,OAAO,MAAM,cAAc,0BAA0B,mBAAmB,UAAU,wBAAwB,SAAS,GAAG;CAC3H,MAAM,iBAAiB,MAAM,QAAQ,cAAc;CACnD,IAAI,CAAC,EAAE,SAAS,aAAa,MAAM,cAAc,8BAA8B,qFAAqF;CACpK,OAAO,IAAI,iBAAiB;EAC3B;EACA,YAAY;EACZ,aAAa,OAAO,EAAE,QAAQ,WAAW;CAC1C,GAAG,SAAS;AACb;AAGA,SAAS,WAAW,SAAS;CAC5B,MAAM,WAAW,UAAU,QAAQ,YAAY;CAC/C,OAAO;EACN,KAAK,UAAU;GACd,OAAO,uBAAuB,UAAU,QAAQ;EACjD;EACA,WAAW,SAAS;GACnB,MAAM,cAAc,gBAAgB,QAAQ,CAAC,CAAC,SAAS;GACvD,IAAI,CAAC,aAAa,MAAM,cAAc,8BAA8B,qFAAqF;GACzJ,MAAM,OAAO;IACZ,QAAQ;IACR,aAAa,OAAO,WAAW;IAC/B,MAAM;GACP;GACA,OAAO;IACN,YAAY,QAAQ;IACpB;IACA;GACD;EACD;CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-kinds-B4KNTF8z-DPIuUuuB.mjs","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-contract/dist/entity-kinds-B4KNTF8z.mjs"],"sourcesContent":["import { CrossReferenceSchema } from \"@internal/contract/types\";\nimport { type } from \"arktype\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-schema.ts\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst ScalarFieldTypeSchema = type({\n\t\"+\": \"reject\",\n\tkind: \"'scalar'\",\n\tcodecId: \"string\",\n\t\"typeParams?\": \"Record<string, unknown>\"\n});\nconst ValueObjectFieldTypeSchema = type({\n\t\"+\": \"reject\",\n\tkind: \"'valueObject'\",\n\tname: \"string\"\n});\nconst UnionFieldTypeSchema = type({\n\t\"+\": \"reject\",\n\tkind: \"'union'\",\n\tmembers: ScalarFieldTypeSchema.or(ValueObjectFieldTypeSchema).array()\n});\nconst FieldTypeSchema = ScalarFieldTypeSchema.or(ValueObjectFieldTypeSchema).or(UnionFieldTypeSchema);\nconst DomainEnumRefSchema = type({\n\tplane: \"'domain'\",\n\tnamespaceId: \"string\",\n\tentityKind: \"'enum'\",\n\tentityName: \"string\",\n\t\"spaceId?\": \"string\"\n});\nconst ContractEnumSchema = type({\n\t\"+\": \"reject\",\n\tcodecId: \"string\",\n\tmembers: type({\n\t\tname: \"string\",\n\t\tvalue: \"string | number | boolean | null | unknown[] | Record<string, unknown>\"\n\t}).array().atLeastLength(1).readonly()\n});\nconst FieldSchema = type({\n\t\"+\": \"reject\",\n\ttype: FieldTypeSchema,\n\t\"nullable?\": \"boolean\",\n\t\"many?\": \"boolean\",\n\t\"dict?\": \"boolean\",\n\t\"valueSet?\": DomainEnumRefSchema\n}).pipe((field) => ({\n\t...field,\n\tnullable: field.nullable ?? false\n}));\nconst RelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | '1:N' | 'N:1'\",\n\t\"on?\": type({\n\t\t\"+\": \"reject\",\n\t\tlocalFields: \"string[]\",\n\t\ttargetFields: \"string[]\"\n\t})\n});\nconst StorageRelationEntrySchema = type({\n\t\"+\": \"reject\",\n\tfield: \"string\"\n});\nconst MongoJsonPrimitiveSchema = type.declare().type(\"string | number | boolean | null\");\nfunction isMongoJsonRecord(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\nfunction withUnseenReference(value, seen, visit) {\n\tif (seen.has(value)) return false;\n\tseen.add(value);\n\tconst result = visit();\n\tseen.delete(value);\n\treturn result;\n}\nfunction isMongoJsonObject(value, seen) {\n\treturn isMongoJsonRecord(value) && withUnseenReference(value, seen, () => Object.values(value).every((entry) => isMongoJsonValue(entry, seen)));\n}\nfunction isMongoJsonValue(value, seen = /* @__PURE__ */ new WeakSet()) {\n\tif (MongoJsonPrimitiveSchema.allows(value)) return true;\n\tif (Array.isArray(value)) return withUnseenReference(value, seen, () => value.every((entry) => isMongoJsonValue(entry, seen)));\n\treturn isMongoJsonObject(value, seen);\n}\nconst MongoJsonValueSchema = type(\"unknown\").narrow((value, ctx) => isMongoJsonValue(value) ? true : ctx.mustBe(\"a JSON-serializable MongoJsonValue\"));\nconst MongoJsonObjectSchema = type({ \"[string]\": \"unknown\" }).narrow((value, ctx) => isMongoJsonRecord(value) && Object.values(value).every((entry) => MongoJsonValueSchema.allows(entry)) ? true : ctx.mustBe(\"a JSON object with MongoJsonValue entries\"));\nconst NumberRecordSchema = type({ \"[string]\": \"number\" });\nconst IndexFieldsSchema = type({\n\t\"+\": \"reject\",\n\t\"[string]\": \"1 | -1 | \\\"text\\\" | \\\"2dsphere\\\" | \\\"2d\\\" | \\\"hashed\\\"\"\n}).narrow((fields, ctx) => Object.keys(fields).length > 0 ? true : ctx.mustBe(\"an index field map with at least one entry\"));\nconst CollationSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-collation-options'\",\n\tlocale: \"string\",\n\t\"caseLevel?\": \"boolean\",\n\t\"caseFirst?\": \"\\\"off\\\" | \\\"upper\\\" | \\\"lower\\\"\",\n\t\"strength?\": \"1 | 2 | 3 | 4 | 5\",\n\t\"numericOrdering?\": \"boolean\",\n\t\"alternate?\": \"\\\"non-ignorable\\\" | \\\"shifted\\\"\",\n\t\"maxVariable?\": \"\\\"punct\\\" | \\\"space\\\"\",\n\t\"backwards?\": \"boolean\",\n\t\"normalization?\": \"boolean\"\n});\nconst IndexOptionDefaultsSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-index-option-defaults'\",\n\t\"storageEngine?\": MongoJsonObjectSchema\n});\nconst TimeSeriesCollectionOptionsSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-time-series-collection-options'\",\n\ttimeField: \"string\",\n\t\"metaField?\": \"string\",\n\t\"granularity?\": \"\\\"seconds\\\" | \\\"minutes\\\" | \\\"hours\\\"\",\n\t\"bucketMaxSpanSeconds?\": \"number\",\n\t\"bucketRoundingSeconds?\": \"number\"\n});\nconst ClusteredCollectionOptionsSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-clustered-collection-options'\",\n\t\"name?\": \"string\",\n\tkey: type({\n\t\t\"+\": \"reject\",\n\t\t\"[string]\": \"1\"\n\t}).narrow((key, ctx) => Object.keys(key).length > 0 ? true : ctx.mustBe(\"a clustered index key map with at least one entry\")),\n\tunique: \"boolean\"\n});\nconst ChangeStreamPreAndPostImagesSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-change-stream-pre-and-post-images-options'\",\n\tenabled: \"boolean\"\n});\ntype({\n\t\"+\": \"reject\",\n\t\"capped?\": \"boolean\",\n\t\"size?\": \"number\",\n\t\"max?\": \"number\",\n\t\"storageEngine?\": MongoJsonObjectSchema,\n\t\"indexOptionDefaults?\": IndexOptionDefaultsSchema,\n\t\"collation?\": CollationSchema,\n\t\"timeseries?\": TimeSeriesCollectionOptionsSchema,\n\t\"clusteredIndex?\": ClusteredCollectionOptionsSchema,\n\t\"expireAfterSeconds?\": \"number\",\n\t\"changeStreamPreAndPostImages?\": ChangeStreamPreAndPostImagesSchema\n});\nconst ModelStorageSchema = type({\n\t\"+\": \"reject\",\n\t\"collection?\": \"string\",\n\t\"relations?\": type({ \"[string]\": StorageRelationEntrySchema })\n});\nconst DiscriminatorSchema = type({\n\t\"+\": \"reject\",\n\tfield: \"string\"\n});\nconst VariantEntrySchema = type({\n\t\"+\": \"reject\",\n\tvalue: \"string\"\n});\nconst ModelDefinitionSchema = type({\n\t\"+\": \"reject\",\n\tfields: type({ \"[string]\": FieldSchema }),\n\tstorage: ModelStorageSchema,\n\t\"relations?\": type({ \"[string]\": RelationSchema }),\n\t\"discriminator?\": DiscriminatorSchema,\n\t\"variants?\": type({ \"[string]\": VariantEntrySchema }),\n\t\"base?\": CrossReferenceSchema,\n\t\"owner?\": \"string\"\n});\ntype({\n\t\"+\": \"reject\",\n\tfields: IndexFieldsSchema,\n\t\"options?\": type({\n\t\t\"+\": \"reject\",\n\t\t\"kind?\": \"'mongo-index-options'\",\n\t\t\"unique?\": \"boolean\",\n\t\t\"name?\": \"string\",\n\t\t\"partialFilterExpression?\": MongoJsonObjectSchema,\n\t\t\"sparse?\": \"boolean\",\n\t\t\"expireAfterSeconds?\": \"number\",\n\t\t\"weights?\": NumberRecordSchema,\n\t\t\"default_language?\": \"string\",\n\t\t\"language_override?\": \"string\",\n\t\t\"textIndexVersion?\": \"number\",\n\t\t\"2dsphereIndexVersion?\": \"number\",\n\t\t\"bits?\": \"number\",\n\t\t\"min?\": \"number\",\n\t\t\"max?\": \"number\",\n\t\t\"bucketSize?\": \"number\",\n\t\t\"hidden?\": \"boolean\",\n\t\t\"collation?\": CollationSchema,\n\t\t\"wildcardProjection?\": type({\n\t\t\t\"+\": \"reject\",\n\t\t\t\"[string]\": \"0 | 1\"\n\t\t})\n\t})\n});\nconst MongoStorageIndexSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-index'\",\n\tkeys: type({\n\t\t\"+\": \"reject\",\n\t\tfield: \"string\",\n\t\tdirection: \"1 | -1 | \\\"text\\\" | \\\"2dsphere\\\" | \\\"2d\\\" | \\\"hashed\\\"\"\n\t}).array().atLeastLength(1),\n\t\"unique?\": \"boolean\",\n\t\"sparse?\": \"boolean\",\n\t\"expireAfterSeconds?\": \"number\",\n\t\"partialFilterExpression?\": \"Record<string, unknown>\",\n\t\"wildcardProjection?\": \"Record<string, 0 | 1>\",\n\t\"collation?\": \"Record<string, unknown>\",\n\t\"weights?\": \"Record<string, number>\",\n\t\"default_language?\": \"string\",\n\t\"language_override?\": \"string\"\n});\nconst MongoStorageValidatorSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-validator'\",\n\tjsonSchema: \"Record<string, unknown>\",\n\tvalidationLevel: \"'strict' | 'moderate'\",\n\tvalidationAction: \"'error' | 'warn'\"\n});\nconst MongoCollectionOptionsSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-collection-options'\",\n\t\"capped?\": type({\n\t\t\"+\": \"reject\",\n\t\tsize: \"number\",\n\t\t\"max?\": \"number\"\n\t}),\n\t\"storageEngine?\": MongoJsonObjectSchema,\n\t\"indexOptionDefaults?\": IndexOptionDefaultsSchema,\n\t\"timeseries?\": type({\n\t\t\"+\": \"reject\",\n\t\t\"kind?\": \"'mongo-time-series-collection-options'\",\n\t\ttimeField: \"string\",\n\t\t\"metaField?\": \"string\",\n\t\t\"granularity?\": \"'seconds' | 'minutes' | 'hours'\",\n\t\t\"bucketMaxSpanSeconds?\": \"number\",\n\t\t\"bucketRoundingSeconds?\": \"number\"\n\t}),\n\t\"collation?\": \"Record<string, unknown>\",\n\t\"expireAfterSeconds?\": \"number\",\n\t\"changeStreamPreAndPostImages?\": ChangeStreamPreAndPostImagesSchema,\n\t\"clusteredIndex?\": type({\n\t\t\"+\": \"reject\",\n\t\t\"name?\": \"string\"\n\t})\n});\nconst StorageCollectionSchema = type({\n\t\"+\": \"reject\",\n\t\"kind?\": \"'mongo-collection'\",\n\t\"indexes?\": MongoStorageIndexSchema.array(),\n\t\"validator?\": MongoStorageValidatorSchema,\n\t\"options?\": MongoCollectionOptionsSchema,\n\t\"control?\": ControlPolicySchema\n});\nconst StorageValueSetSchema = type({\n\t\"+\": \"reject\",\n\tkind: \"'valueSet'\",\n\tvalues: type(\"string | number | boolean | null | unknown[] | Record<string, unknown>\").array().readonly()\n});\nfunction collectionEntrySchema(fragments) {\n\tif (fragments === void 0 || fragments.size === 0) return StorageCollectionSchema;\n\treturn type(\"unknown\").narrow((entry, ctx) => {\n\t\tif (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) return ctx.mustBe(\"an object\");\n\t\tconst kind = entry.kind;\n\t\tif (typeof kind === \"string\") {\n\t\t\tconst fragment = fragments.get(kind);\n\t\t\tif (fragment !== void 0) {\n\t\t\t\tconst parsed = fragment(entry);\n\t\t\t\tif (parsed instanceof type.errors) return ctx.reject({ expected: parsed.summary });\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tconst parsed = StorageCollectionSchema(entry);\n\t\tif (parsed instanceof type.errors) return ctx.reject({ expected: parsed.summary });\n\t\treturn true;\n\t});\n}\n/**\n* Builds the per-namespace envelope schema for Mongo storage. Pack\n* contributions are keyed by the descriptor's `discriminator` and\n* validate each entry by matching the entry's `kind` field. Mongo today\n* has no pack contributions; the composition surface exists for symmetry\n* with SQL and as the substrate for future entity kinds.\n*\n* `'kind?': 'string'` because `kind` is non-enumerable on built\n* Mongo namespace IR classes and therefore absent from the wire shape; the\n* type-side narrowing is enforced by the IR class, not by this validator.\n*/\nfunction createMongoNamespaceEnvelopeSchema(fragments) {\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tid: \"string\",\n\t\t\"kind?\": \"string\",\n\t\tentries: type({\n\t\t\t\"collection?\": type({ \"[string]\": collectionEntrySchema(fragments) }),\n\t\t\t\"valueSet?\": type({ \"[string]\": StorageValueSetSchema })\n\t\t})\n\t}).narrow((ns, ctx) => {\n\t\tif (typeof ns !== \"object\" || ns === null || Array.isArray(ns)) return ctx.mustBe(\"an object\");\n\t\tif (Object.hasOwn(ns, \"collections\") || Object.hasOwn(ns, \"tables\")) return ctx.reject({ expected: \"namespace must use `entries: { collection? }`; flat `collections` / `tables` keys are no longer accepted\" });\n\t\treturn true;\n\t});\n}\n/**\n* Builds the full Mongo contract schema. The per-namespace entry\n* threading happens through {@link createMongoNamespaceEnvelopeSchema};\n* the rest of the envelope is family-shared.\n*/\nfunction createMongoContractSchema(fragments) {\n\tconst namespaceEnvelope = createMongoNamespaceEnvelopeSchema(fragments);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\ttargetFamily: \"'mongo'\",\n\t\t\"schemaVersion?\": \"string\",\n\t\t\"target?\": \"string\",\n\t\t\"storageHash?\": \"string\",\n\t\t\"profileHash?\": \"string\",\n\t\troots: type({ \"[string]\": CrossReferenceSchema }),\n\t\t\"capabilities?\": \"Record<string, unknown>\",\n\t\t\"extensions?\": \"Record<string, unknown>\",\n\t\t\"meta?\": \"Record<string, unknown>\",\n\t\t\"defaultControlPolicy?\": ControlPolicySchema,\n\t\t\"sources?\": \"Record<string, unknown>\",\n\t\t\"_generated?\": \"Record<string, unknown>\",\n\t\tdomain: type({ namespaces: type({ \"[string]\": type({\n\t\t\tmodels: type({ \"[string]\": ModelDefinitionSchema }),\n\t\t\t\"valueObjects?\": type({ \"[string]\": type({\n\t\t\t\t\"+\": \"reject\",\n\t\t\t\tfields: type({ \"[string]\": FieldSchema })\n\t\t\t}) }),\n\t\t\t\"enum?\": type({ \"[string]\": ContractEnumSchema })\n\t\t}) }) }),\n\t\tstorage: type({\n\t\t\t\"+\": \"reject\",\n\t\t\tnamespaces: type({ \"[string]\": namespaceEnvelope }),\n\t\t\t\"storageHash?\": \"string\"\n\t\t})\n\t});\n}\nconst MongoContractSchema = createMongoContractSchema();\n//#endregion\n//#region src/ir/mongo-change-stream-pre-and-post-images-options.ts\n/**\n* Change-stream pre-and-post-images collection option. Lifted from a\n* `type =` data shape to an AST class extending `IRNodeBase` per\n* FR18. Single-field shape; the class exists for AST-pattern\n* consistency (every nested data shape inside `MongoCollectionOptions`\n* is an AST node so the verifier can walk uniformly).\n*/\nvar MongoChangeStreamPreAndPostImagesOptions = class extends IRNodeBase {\n\tkind = \"mongo-change-stream-pre-and-post-images-options\";\n\tenabled;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.enabled = options.enabled;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-collation-options.ts\n/**\n* Mongo Contract IR leaf for collection / index collation options.\n*\n* Lifted from a `type =` data shape to an AST class extending\n* `IRNodeBase` per FR18 (\"Mongo's Contract IR is fully unified under\n* the AST-class pattern, layered family / target\"). Single concrete class\n* (no target subclass): collation options carry no target-specific\n* variation at this layer — both Atlas and self-hosted Mongo consume the\n* same option vocabulary.\n*\n* Undefined optional fields are not assigned, so `JSON.stringify` omits\n* them from the canonical JSON output (matches the pre-lift data shape's\n* round-trip behaviour, modulo the new `kind` discriminator).\n*/\nvar MongoCollationOptions = class extends IRNodeBase {\n\tkind = \"mongo-collation-options\";\n\tlocale;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.locale = options.locale;\n\t\tif (options.caseLevel !== void 0) this.caseLevel = options.caseLevel;\n\t\tif (options.caseFirst !== void 0) this.caseFirst = options.caseFirst;\n\t\tif (options.strength !== void 0) this.strength = options.strength;\n\t\tif (options.numericOrdering !== void 0) this.numericOrdering = options.numericOrdering;\n\t\tif (options.alternate !== void 0) this.alternate = options.alternate;\n\t\tif (options.maxVariable !== void 0) this.maxVariable = options.maxVariable;\n\t\tif (options.backwards !== void 0) this.backwards = options.backwards;\n\t\tif (options.normalization !== void 0) this.normalization = options.normalization;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-index-option-defaults.ts\n/**\n* Collection-level default index options (the `indexOptionDefaults`\n* collection-creation field on Mongo's `createCollection`). Lifted from\n* a `type =` data shape to an AST class extending `IRNodeBase` per\n* FR18 (Mongo Contract IR fully unified under the AST-class pattern).\n*\n* Carries `storageEngine` only — the underlying MongoDB option set is\n* intentionally narrow at this layer; per-engine richer option vocabularies\n* are out of scope for this project.\n*/\nvar MongoIndexOptionDefaults = class extends IRNodeBase {\n\tkind = \"mongo-index-option-defaults\";\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tif (options.storageEngine !== void 0) this.storageEngine = options.storageEngine;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-time-series-collection-options.ts\n/**\n* Time-series collection options. Lifted from a `type =` data shape to\n* an AST class extending `IRNodeBase` per FR18.\n*\n* MongoDB requires `timeField` for any time-series collection; the\n* constructor enforces presence by type signature (`timeField: string`\n* is required on the input).\n*/\nvar MongoTimeSeriesCollectionOptions = class extends IRNodeBase {\n\tkind = \"mongo-time-series-collection-options\";\n\ttimeField;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.timeField = options.timeField;\n\t\tif (options.metaField !== void 0) this.metaField = options.metaField;\n\t\tif (options.granularity !== void 0) this.granularity = options.granularity;\n\t\tif (options.bucketMaxSpanSeconds !== void 0) this.bucketMaxSpanSeconds = options.bucketMaxSpanSeconds;\n\t\tif (options.bucketRoundingSeconds !== void 0) this.bucketRoundingSeconds = options.bucketRoundingSeconds;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-collection-options.ts\n/**\n* Mongo Contract IR node for collection-level creation options (the\n* second argument to `db.createCollection(name, options)`). Lifted from\n* the pre-M2R2 `MongoStorageCollectionOptions` storage interface to a\n* class extending `IRNodeBase` per FR18.\n*\n* Single concrete family-layer class (no target subclass). The\n* constructor accepts the storage JSON envelope shape ({@link\n* MongoCollectionOptionsInput}) so the family-base hydration walker\n* can pass arktype-validated objects directly to `new`. Authoring\n* vocabulary is translated to this shape upstream in the contract-ts\n* builder.\n*\n* Nested IR sub-shapes (collation, timeseries, …) are normalised to\n* their respective IR class instances inside the constructor so\n* downstream walks see a uniform AST regardless of whether the input\n* was a JSON literal or an already-constructed class.\n*/\nvar MongoCollectionOptions = class extends IRNodeBase {\n\tkind = \"mongo-collection-options\";\n\tconstructor(input = {}) {\n\t\tsuper();\n\t\tif (input.capped !== void 0) this.capped = {\n\t\t\tsize: input.capped.size,\n\t\t\t...input.capped.max != null && { max: input.capped.max }\n\t\t};\n\t\tif (input.storageEngine !== void 0) this.storageEngine = input.storageEngine;\n\t\tif (input.indexOptionDefaults !== void 0) this.indexOptionDefaults = input.indexOptionDefaults instanceof MongoIndexOptionDefaults ? input.indexOptionDefaults : new MongoIndexOptionDefaults(input.indexOptionDefaults);\n\t\tif (input.collation !== void 0) this.collation = input.collation instanceof MongoCollationOptions ? input.collation : new MongoCollationOptions(input.collation);\n\t\tif (input.timeseries !== void 0) this.timeseries = input.timeseries instanceof MongoTimeSeriesCollectionOptions ? input.timeseries : new MongoTimeSeriesCollectionOptions(input.timeseries);\n\t\tif (input.clusteredIndex !== void 0) this.clusteredIndex = input.clusteredIndex.name !== void 0 ? { name: input.clusteredIndex.name } : {};\n\t\tif (input.expireAfterSeconds !== void 0) this.expireAfterSeconds = input.expireAfterSeconds;\n\t\tif (input.changeStreamPreAndPostImages !== void 0) this.changeStreamPreAndPostImages = input.changeStreamPreAndPostImages instanceof MongoChangeStreamPreAndPostImagesOptions ? input.changeStreamPreAndPostImages : new MongoChangeStreamPreAndPostImagesOptions(input.changeStreamPreAndPostImages);\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-index.ts\n/**\n* Mongo Contract IR node for a single collection index entry (one\n* element of `MongoCollection.indexes`). Lifted from the\n* pre-M2R2 `MongoStorageIndex` storage interface to a class extending\n* `IRNodeBase` per FR18.\n*\n* Single concrete family-layer class (no target subclass). The spec's\n* `MongoTargetIndex extends MongoIndex` pattern remains additive — a\n* future Mongo target with target-specific index extensions is free to\n* subclass; for the single Mongo target shipped today a concrete\n* family-layer class is enough and avoids a target-import layering\n* violation from the contract-ts builder.\n*/\nvar MongoIndex = class extends IRNodeBase {\n\tkind = \"mongo-index\";\n\tkeys;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.keys = input.keys;\n\t\tif (input.unique !== void 0) this.unique = input.unique;\n\t\tif (input.sparse !== void 0) this.sparse = input.sparse;\n\t\tif (input.expireAfterSeconds !== void 0) this.expireAfterSeconds = input.expireAfterSeconds;\n\t\tif (input.partialFilterExpression !== void 0) this.partialFilterExpression = input.partialFilterExpression;\n\t\tif (input.wildcardProjection !== void 0) this.wildcardProjection = input.wildcardProjection;\n\t\tif (input.collation !== void 0) this.collation = input.collation;\n\t\tif (input.weights !== void 0) this.weights = input.weights;\n\t\tif (input.default_language !== void 0) this.default_language = input.default_language;\n\t\tif (input.language_override !== void 0) this.language_override = input.language_override;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-validator.ts\n/**\n* Mongo Contract IR node for collection-level document validators (the\n* `validator` field on Mongo's `createCollection`). Lifted from the\n* pre-M2R2 `MongoStorageValidator` storage interface to a class extending\n* `IRNodeBase` per FR18.\n*\n* Concrete at the family layer (no target subclass). The spec's\n* abstract-family + target-concrete pattern (`MongoTargetValidator\n* extends MongoValidator`) becomes meaningful when a second Mongo target\n* introduces target-specific validator extensions (Atlas search rules,\n* DocumentDB-specific levels, …); for the single Mongo target shipped\n* today, a concrete family-layer class lets the PSL JSON-Schema deriver\n* and the contract-ts builder construct instances directly without a\n* target-import layering violation. Target subclassing remains additive\n* — a future `MongoTargetValidator extends MongoValidator` is an\n* additive change, not a breaking one.\n*/\nvar MongoValidator = class extends IRNodeBase {\n\tkind = \"mongo-validator\";\n\tjsonSchema;\n\tvalidationLevel;\n\tvalidationAction;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.jsonSchema = input.jsonSchema;\n\t\tthis.validationLevel = input.validationLevel;\n\t\tthis.validationAction = input.validationAction;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-collection.ts\n/**\n* Mongo Contract IR node for a single collection entry in a namespace's\n* `collections` map. Lifted from the pre-M2R2\n* `MongoStorageCollection` storage interface to a class extending\n* `IRNodeBase` per FR18.\n*\n* Concrete at the family layer (no target subclass). The spec's\n* `MongoTargetCollection extends MongoCollection` pattern remains\n* additive: a future Mongo target with target-specific extensions is\n* free to subclass without breaking the family-layer construction\n* sites.\n*\n* The unprefixed name `MongoCollection` is now the contract IR class.\n* Note that `@internal/mongo-orm` also exports a (different)\n* `MongoCollection<TContract, ModelName>` generic for the user-facing\n* ORM query builder; the two live in separate packages and are\n* resolved by import path. A source file that needs both should alias\n* one (e.g. `import { MongoCollection as MongoContractCollection }\n* from '@internal/mongo-contract'`).\n*/\nvar MongoCollection = class extends IRNodeBase {\n\tkind = \"mongo-collection\";\n\tconstructor(input = {}) {\n\t\tsuper();\n\t\tif (input.indexes !== void 0) this.indexes = input.indexes.map((idx) => idx instanceof MongoIndex ? idx : new MongoIndex(idx));\n\t\tif (input.validator !== void 0) this.validator = input.validator instanceof MongoValidator ? input.validator : new MongoValidator(input.validator);\n\t\tif (input.options !== void 0) this.options = input.options instanceof MongoCollectionOptions ? input.options : new MongoCollectionOptions(input.options);\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-value-set.ts\n/**\n* Mongo Contract IR node for a value-set entry in a namespace's `valueSet` map\n* (`entries.valueSet`). Same shape as SQL's `StorageValueSet`: the ordered set of permitted\n* codec-encoded values for a field restriction, with no `codecId` (the field that references it\n* holds the codec). The `kind` is enumerable so the JSON envelope carries the discriminator and the\n* hydration walker can dispatch on it. Value-sets are keyed by name in the parent namespace's\n* `valueSet: Record<string, MongoValueSet>` map, so the entry name is not on the class.\n*/\nvar MongoValueSet = class extends IRNodeBase {\n\tkind = \"valueSet\";\n\tvalues;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.values = Object.freeze([...input.values]);\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/entity-kinds.ts\nconst collectionEntityKind = {\n\tkind: \"collection\",\n\tschema: StorageCollectionSchema,\n\tconstruct: (input) => new MongoCollection(input)\n};\nconst valueSetEntityKind = {\n\tkind: \"valueSet\",\n\tschema: StorageValueSetSchema,\n\tconstruct: (input) => new MongoValueSet(input)\n};\n/**\n* Assembles the `kind → descriptor` registry for Mongo namespaces: the built-in\n* `collection` kind plus any target `packKinds`. This builds the lookup table —\n* it does not touch contract data. `hydrateNamespaceEntities` later consumes\n* this registry to turn a namespace's raw entries into IR instances. Throws on\n* a duplicate kind.\n*/\nfunction composeMongoEntityKinds(packKinds = []) {\n\tconst kinds = /* @__PURE__ */ new Map([[\"collection\", collectionEntityKind], [\"valueSet\", valueSetEntityKind]]);\n\tfor (const descriptor of packKinds) {\n\t\tif (kinds.has(descriptor.kind)) throw structuredError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `composeMongoEntityKinds: duplicate entity kind \"${descriptor.kind}\" — each kind may be registered only once`);\n\t\tkinds.set(descriptor.kind, descriptor);\n\t}\n\treturn kinds;\n}\n//#endregion\nexport { MongoCollection as a, MongoCollectionOptions as c, MongoCollationOptions as d, MongoChangeStreamPreAndPostImagesOptions as f, createMongoNamespaceEnvelopeSchema as g, createMongoContractSchema as h, MongoValueSet as i, MongoTimeSeriesCollectionOptions as l, StorageValueSetSchema as m, composeMongoEntityKinds as n, MongoValidator as o, MongoContractSchema as p, valueSetEntityKind as r, MongoIndex as s, collectionEntityKind as t, MongoIndexOptionDefaults as u };\n\n//# sourceMappingURL=entity-kinds-B4KNTF8z.mjs.map"],"mappings":";;;;;AAKA,MAAM,sBAAsB,KAAK,mDAAmD;AACpF,MAAM,wBAAwB,KAAK;CAClC,KAAK;CACL,MAAM;CACN,SAAS;CACT,eAAe;AAChB,CAAC;AACD,MAAM,6BAA6B,KAAK;CACvC,KAAK;CACL,MAAM;CACN,MAAM;AACP,CAAC;AACD,MAAM,uBAAuB,KAAK;CACjC,KAAK;CACL,MAAM;CACN,SAAS,sBAAsB,GAAG,0BAA0B,CAAC,CAAC,MAAM;AACrE,CAAC;AACD,MAAM,kBAAkB,sBAAsB,GAAG,0BAA0B,CAAC,CAAC,GAA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AQ,KAAK,QAAQ,eAAe,aAAa,MAAM,IAAI,WAAW,GAAG,CAAC;EAC7H,IAAI,MAAM,cAAc,KAAK,GAAG,KAAK,YAAY,MAAM,qBAAqB,iBAAiB,MAAM,YAAY,IAAI,eAAe,MAAM,SAAS;EACjJ,IAAI,MAAM,YAAY,KAAK,GAAG,KAAK,UAAU,MAAM,mBAAmB,yBAAyB,MAAM,UAAU,IAAI,uBAAuB,MAAM,OAAO;EACvJ,IAAI,MAAM,YAAY,KAAK,GAAG,KAAK,UAAU,MAAM;EACnD,WAAW,IAAI;CAChB;AACD;;;;;;;;;AAWA,IAAI,gBAAgB,cAAc,WAAW;CAC5C,OAAO;CACP;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,SAAS,OAAO,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC;EAC7C,WAAW,IAAI;CAChB;AACD;AAGA,MAAM,uBAAuB;CAC5B,MAAM;CACN,QAAQ;CACR,YAAY,UAAU,IAAI,gBAAgB,KAAK;AAChD;AACA,MAAM,qBAAqB;CAC1B,MAAM;CACN,QAAQ;CACR,YAAY,UAAU,IAAI,cAAc,KAAK;AAC9C;;;;;;;;AAQA,SAAS,wBAAwB,YAAY,CAAC,GAAG;CAChD,MAAM,wBAAwB,IAAI,IAAI,CAAC,CAAC,cAAc,oBAAoB,GAAG,CAAC,YAAY,kBAAkB,CAAC,CAAC;CAC9G,KAAK,MAAM,cAAc,WAAW;EACnC,IAAI,MAAM,IAAI,WAAW,IAAI,GAAG,MAAM,gBAAgB,sCAAsC,mDAAmD,WAAW,KAAK,0CAA0C;EACzM,MAAM,IAAI,WAAW,MAAM,UAAU;CACtC;CACA,OAAO;AACR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-CKnUiOfm.d.mts","names":[],"sources":["../../../../2-mongo-family/4-query/query-ast/dist/exports/execution.d.mts"],"mappings":";;;;;;;;;;;;UAWU;WACC;;UAED;WACC,aAAa;WACb;;;;;;;;UAQD;WACC;WACA;WACA;WACA;;;KAGN,kBAAkB;;KAElB,mBAAmB;;;;UAId;WACC;;;KAGN,kBAAkB;;KAElB,mBAAmB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-D5XyZ5XS.mjs","names":[],"sources":["../../../../2-mongo-family/4-query/query-ast/dist/exports/execution.mjs"],"sourcesContent":["import { a as MongoNotExpr, c as ormError, i as MongoFieldFilter, l as MongoAstNode, n as MongoExistsExpr, o as MongoOrExpr, r as MongoExprFilter, s as isMongoFilterExpr, t as MongoAndExpr } from \"../filter-expressions-Uo8ZdzwB.mjs\";\n//#region src/aggregation-expressions.ts\nfunction isExprArray(args) {\n\treturn Array.isArray(args);\n}\nfunction isRecordArgs(args) {\n\treturn !Array.isArray(args) && typeof args === \"object\" && !(\"accept\" in args);\n}\nfunction freezeRecordArgs(record) {\n\tconst frozen = {};\n\tfor (const [key, val] of Object.entries(record)) frozen[key] = Array.isArray(val) ? Object.freeze([...val]) : val;\n\treturn Object.freeze(frozen);\n}\nfunction rewriteRecordArgs(record, rewriter) {\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(record)) if (Array.isArray(val)) result[key] = val.map((v) => v.rewrite(rewriter));\n\telse result[key] = val.rewrite(rewriter);\n\treturn result;\n}\nvar MongoAggExprNode = class extends MongoAstNode {};\nvar MongoAggFieldRef = class MongoAggFieldRef extends MongoAggExprNode {\n\tkind = \"fieldRef\";\n\tpath;\n\tconstructor(path) {\n\t\tsuper();\n\t\tif (!path) throw ormError(\"ORM.ARGUMENT_INVALID\", \"Field path must not be empty\");\n\t\tthis.path = path;\n\t\tthis.freeze();\n\t}\n\tstatic of(path) {\n\t\treturn new MongoAggFieldRef(path);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.fieldRef(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn rewriter.fieldRef ? rewriter.fieldRef(this) : this;\n\t}\n};\nvar MongoAggLiteral = class MongoAggLiteral extends MongoAggExprNode {\n\tkind = \"literal\";\n\tvalue;\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t\tthis.freeze();\n\t}\n\tstatic of(value) {\n\t\treturn new MongoAggLiteral(value);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.literal(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn rewriter.literal ? rewriter.literal(this) : this;\n\t}\n};\nvar MongoAggOperator = class MongoAggOperator extends MongoAggExprNode {\n\tkind = \"operator\";\n\top;\n\targs;\n\tconstructor(op, args) {\n\t\tsuper();\n\t\tthis.op = op;\n\t\tif (Array.isArray(args)) this.args = Object.freeze([...args]);\n\t\telse if (isRecordArgs(args)) this.args = freezeRecordArgs(args);\n\t\telse this.args = args;\n\t\tthis.freeze();\n\t}\n\tstatic of(op, args) {\n\t\treturn new MongoAggOperator(op, args);\n\t}\n\tstatic add(...args) {\n\t\treturn new MongoAggOperator(\"$add\", args);\n\t}\n\tstatic subtract(left, right) {\n\t\treturn new MongoAggOperator(\"$subtract\", [left, right]);\n\t}\n\tstatic multiply(...args) {\n\t\treturn new MongoAggOperator(\"$multiply\", args);\n\t}\n\tstatic divide(dividend, divisor) {\n\t\treturn new MongoAggOperator(\"$divide\", [dividend, divisor]);\n\t}\n\tstatic concat(...args) {\n\t\treturn new MongoAggOperator(\"$concat\", args);\n\t}\n\tstatic toLower(expr) {\n\t\treturn new MongoAggOperator(\"$toLower\", expr);\n\t}\n\tstatic toUpper(expr) {\n\t\treturn new MongoAggOperator(\"$toUpper\", expr);\n\t}\n\tstatic size(expr) {\n\t\treturn new MongoAggOperator(\"$size\", expr);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.operator(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst { args } = this;\n\t\tlet rewrittenArgs;\n\t\tif (isExprArray(args)) rewrittenArgs = args.map((a) => a.rewrite(rewriter));\n\t\telse if (isRecordArgs(args)) rewrittenArgs = rewriteRecordArgs(args, rewriter);\n\t\telse rewrittenArgs = args.rewrite(rewriter);\n\t\tconst rebuilt = new MongoAggOperator(this.op, rewrittenArgs);\n\t\treturn rewriter.operator ? rewriter.operator(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggAccumulator = class MongoAggAccumulator extends MongoAggExprNode {\n\tkind = \"accumulator\";\n\top;\n\targ;\n\tconstructor(op, arg) {\n\t\tsuper();\n\t\tthis.op = op;\n\t\tif (arg !== null && isRecordArgs(arg)) this.arg = freezeRecordArgs(arg);\n\t\telse this.arg = arg;\n\t\tthis.freeze();\n\t}\n\tstatic of(op, arg) {\n\t\treturn new MongoAggAccumulator(op, arg);\n\t}\n\tstatic sum(expr) {\n\t\treturn new MongoAggAccumulator(\"$sum\", expr);\n\t}\n\tstatic avg(expr) {\n\t\treturn new MongoAggAccumulator(\"$avg\", expr);\n\t}\n\tstatic min(expr) {\n\t\treturn new MongoAggAccumulator(\"$min\", expr);\n\t}\n\tstatic max(expr) {\n\t\treturn new MongoAggAccumulator(\"$max\", expr);\n\t}\n\tstatic first(expr) {\n\t\treturn new MongoAggAccumulator(\"$first\", expr);\n\t}\n\tstatic last(expr) {\n\t\treturn new MongoAggAccumulator(\"$last\", expr);\n\t}\n\tstatic push(expr) {\n\t\treturn new MongoAggAccumulator(\"$push\", expr);\n\t}\n\tstatic addToSet(expr) {\n\t\treturn new MongoAggAccumulator(\"$addToSet\", expr);\n\t}\n\tstatic count() {\n\t\treturn new MongoAggAccumulator(\"$count\", null);\n\t}\n\tstatic stdDevPop(expr) {\n\t\treturn new MongoAggAccumulator(\"$stdDevPop\", expr);\n\t}\n\tstatic stdDevSamp(expr) {\n\t\treturn new MongoAggAccumulator(\"$stdDevSamp\", expr);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.accumulator(this);\n\t}\n\trewrite(rewriter) {\n\t\tlet rewrittenArg;\n\t\tif (this.arg === null) rewrittenArg = null;\n\t\telse if (isRecordArgs(this.arg)) rewrittenArg = rewriteRecordArgs(this.arg, rewriter);\n\t\telse rewrittenArg = this.arg.rewrite(rewriter);\n\t\tconst rebuilt = new MongoAggAccumulator(this.op, rewrittenArg);\n\t\treturn rewriter.accumulator ? rewriter.accumulator(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggCond = class MongoAggCond extends MongoAggExprNode {\n\tkind = \"cond\";\n\tcondition;\n\tthen_;\n\telse_;\n\tconstructor(condition, then_, else_) {\n\t\tsuper();\n\t\tthis.condition = condition;\n\t\tthis.then_ = then_;\n\t\tthis.else_ = else_;\n\t\tthis.freeze();\n\t}\n\tstatic of(condition, then_, else_) {\n\t\treturn new MongoAggCond(condition, then_, else_);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.cond(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggCond(this.condition.rewrite(rewriter), this.then_.rewrite(rewriter), this.else_.rewrite(rewriter));\n\t\treturn rewriter.cond ? rewriter.cond(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggSwitch = class MongoAggSwitch extends MongoAggExprNode {\n\tkind = \"switch\";\n\tbranches;\n\tdefault_;\n\tconstructor(branches, default_) {\n\t\tsuper();\n\t\tthis.branches = Object.freeze(branches.map((b) => Object.freeze({\n\t\t\tcase_: b.case_,\n\t\t\tthen_: b.then_\n\t\t})));\n\t\tthis.default_ = default_;\n\t\tthis.freeze();\n\t}\n\tstatic of(branches, default_) {\n\t\treturn new MongoAggSwitch(branches, default_);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.switch_(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggSwitch(this.branches.map((b) => ({\n\t\t\tcase_: b.case_.rewrite(rewriter),\n\t\t\tthen_: b.then_.rewrite(rewriter)\n\t\t})), this.default_.rewrite(rewriter));\n\t\treturn rewriter.switch_ ? rewriter.switch_(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggArrayFilter = class MongoAggArrayFilter extends MongoAggExprNode {\n\tkind = \"filter\";\n\tinput;\n\tcond;\n\tas;\n\tconstructor(input, cond, as) {\n\t\tsuper();\n\t\tthis.input = input;\n\t\tthis.cond = cond;\n\t\tthis.as = as;\n\t\tthis.freeze();\n\t}\n\tstatic of(input, cond, as) {\n\t\treturn new MongoAggArrayFilter(input, cond, as);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.filter(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggArrayFilter(this.input.rewrite(rewriter), this.cond.rewrite(rewriter), this.as);\n\t\treturn rewriter.filter ? rewriter.filter(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggMap = class MongoAggMap extends MongoAggExprNode {\n\tkind = \"map\";\n\tinput;\n\tin_;\n\tas;\n\tconstructor(input, in_, as) {\n\t\tsuper();\n\t\tthis.input = input;\n\t\tthis.in_ = in_;\n\t\tthis.as = as;\n\t\tthis.freeze();\n\t}\n\tstatic of(input, in_, as) {\n\t\treturn new MongoAggMap(input, in_, as);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.map(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggMap(this.input.rewrite(rewriter), this.in_.rewrite(rewriter), this.as);\n\t\treturn rewriter.map ? rewriter.map(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggReduce = class MongoAggReduce extends MongoAggExprNode {\n\tkind = \"reduce\";\n\tinput;\n\tinitialValue;\n\tin_;\n\tconstructor(input, initialValue, in_) {\n\t\tsuper();\n\t\tthis.input = input;\n\t\tthis.initialValue = initialValue;\n\t\tthis.in_ = in_;\n\t\tthis.freeze();\n\t}\n\tstatic of(input, initialValue, in_) {\n\t\treturn new MongoAggReduce(input, initialValue, in_);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.reduce(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggReduce(this.input.rewrite(rewriter), this.initialValue.rewrite(rewriter), this.in_.rewrite(rewriter));\n\t\treturn rewriter.reduce ? rewriter.reduce(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggLet = class MongoAggLet extends MongoAggExprNode {\n\tkind = \"let\";\n\tvars;\n\tin_;\n\tconstructor(vars, in_) {\n\t\tsuper();\n\t\tthis.vars = Object.freeze({ ...vars });\n\t\tthis.in_ = in_;\n\t\tthis.freeze();\n\t}\n\tstatic of(vars, in_) {\n\t\treturn new MongoAggLet(vars, in_);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.let_(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rewrittenVars = {};\n\t\tfor (const [key, val] of Object.entries(this.vars)) rewrittenVars[key] = val.rewrite(rewriter);\n\t\tconst rebuilt = new MongoAggLet(rewrittenVars, this.in_.rewrite(rewriter));\n\t\treturn rewriter.let_ ? rewriter.let_(rebuilt) : rebuilt;\n\t}\n};\nvar MongoAggMergeObjects = class MongoAggMergeObjects extends MongoAggExprNode {\n\tkind = \"mergeObjects\";\n\texprs;\n\tconstructor(exprs) {\n\t\tsuper();\n\t\tthis.exprs = Object.freeze([...exprs]);\n\t\tthis.freeze();\n\t}\n\tstatic of(exprs) {\n\t\treturn new MongoAggMergeObjects(exprs);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.mergeObjects(this);\n\t}\n\trewrite(rewriter) {\n\t\tconst rebuilt = new MongoAggMergeObjects(this.exprs.map((e) => e.rewrite(rewriter)));\n\t\treturn rewriter.mergeObjects ? rewriter.mergeObjects(rebuilt) : rebuilt;\n\t}\n};\n//#endregion\n//#region src/commands.ts\nvar InsertOneCommand = class extends MongoAstNode {\n\tkind = \"insertOne\";\n\tcollection;\n\tdocument;\n\tconstructor(collection, document) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.document = document;\n\t\tthis.freeze();\n\t}\n};\nvar UpdateOneCommand = class extends MongoAstNode {\n\tkind = \"updateOne\";\n\tcollection;\n\tfilter;\n\tupdate;\n\t/**\n\t* When true, the wire command becomes an upsert: if no document matches\n\t* `filter`, a new document is inserted, derived from the filter's\n\t* equality fields plus the update spec. Defaults to false.\n\t*/\n\tupsert;\n\tconstructor(collection, filter, update, upsert = false) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.upsert = upsert;\n\t\tthis.freeze();\n\t}\n};\nvar DeleteOneCommand = class extends MongoAstNode {\n\tkind = \"deleteOne\";\n\tcollection;\n\tfilter;\n\tconstructor(collection, filter) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.freeze();\n\t}\n};\nvar InsertManyCommand = class extends MongoAstNode {\n\tkind = \"insertMany\";\n\tcollection;\n\tdocuments;\n\tconstructor(collection, documents) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.documents = documents;\n\t\tthis.freeze();\n\t}\n};\nvar UpdateManyCommand = class extends MongoAstNode {\n\tkind = \"updateMany\";\n\tcollection;\n\tfilter;\n\tupdate;\n\t/**\n\t* Upsert flag — see `UpdateOneCommand.upsert`. For `updateMany`, Mongo\n\t* inserts at most one document when no match exists (driver-side\n\t* constraint).\n\t*/\n\tupsert;\n\tconstructor(collection, filter, update, upsert = false) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.upsert = upsert;\n\t\tthis.freeze();\n\t}\n};\nvar DeleteManyCommand = class extends MongoAstNode {\n\tkind = \"deleteMany\";\n\tcollection;\n\tfilter;\n\tconstructor(collection, filter) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.freeze();\n\t}\n};\nvar FindOneAndUpdateCommand = class extends MongoAstNode {\n\tkind = \"findOneAndUpdate\";\n\tcollection;\n\tfilter;\n\tupdate;\n\tupsert;\n\tsort;\n\treturnDocument;\n\tconstructor(collection, filter, update, upsert = false, sort, returnDocument = \"after\") {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.upsert = upsert;\n\t\tthis.sort = sort;\n\t\tthis.returnDocument = returnDocument;\n\t\tthis.freeze();\n\t}\n};\nvar FindOneAndDeleteCommand = class extends MongoAstNode {\n\tkind = \"findOneAndDelete\";\n\tcollection;\n\tfilter;\n\tsort;\n\tconstructor(collection, filter, sort) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.sort = sort;\n\t\tthis.freeze();\n\t}\n};\nvar AggregateCommand = class extends MongoAstNode {\n\tkind = \"aggregate\";\n\tcollection;\n\tpipeline;\n\tconstructor(collection, pipeline) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.pipeline = pipeline;\n\t\tthis.freeze();\n\t}\n};\n//#endregion\n//#region src/raw-commands.ts\nvar RawAggregateCommand = class extends MongoAstNode {\n\tkind = \"rawAggregate\";\n\tcollection;\n\tpipeline;\n\tconstructor(collection, pipeline) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.pipeline = pipeline;\n\t\tthis.freeze();\n\t}\n};\nvar RawInsertOneCommand = class extends MongoAstNode {\n\tkind = \"rawInsertOne\";\n\tcollection;\n\tdocument;\n\tconstructor(collection, document) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.document = document;\n\t\tthis.freeze();\n\t}\n};\nvar RawInsertManyCommand = class extends MongoAstNode {\n\tkind = \"rawInsertMany\";\n\tcollection;\n\tdocuments;\n\tconstructor(collection, documents) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.documents = documents;\n\t\tthis.freeze();\n\t}\n};\nvar RawUpdateOneCommand = class extends MongoAstNode {\n\tkind = \"rawUpdateOne\";\n\tcollection;\n\tfilter;\n\tupdate;\n\tconstructor(collection, filter, update) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.freeze();\n\t}\n};\nvar RawUpdateManyCommand = class extends MongoAstNode {\n\tkind = \"rawUpdateMany\";\n\tcollection;\n\tfilter;\n\tupdate;\n\tconstructor(collection, filter, update) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.freeze();\n\t}\n};\nvar RawDeleteOneCommand = class extends MongoAstNode {\n\tkind = \"rawDeleteOne\";\n\tcollection;\n\tfilter;\n\tconstructor(collection, filter) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.freeze();\n\t}\n};\nvar RawDeleteManyCommand = class extends MongoAstNode {\n\tkind = \"rawDeleteMany\";\n\tcollection;\n\tfilter;\n\tconstructor(collection, filter) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.freeze();\n\t}\n};\nvar RawFindOneAndUpdateCommand = class extends MongoAstNode {\n\tkind = \"rawFindOneAndUpdate\";\n\tcollection;\n\tfilter;\n\tupdate;\n\tupsert;\n\tsort;\n\t/**\n\t* When `undefined`, the option is omitted from the wire command and the\n\t* MongoDB driver applies its documented default (return the pre-image\n\t* document). Set explicitly to `'before'` or `'after'` to override.\n\t*/\n\treturnDocument;\n\tconstructor(collection, filter, update, upsert = false, sort, returnDocument) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.update = update;\n\t\tthis.upsert = upsert;\n\t\tthis.sort = sort;\n\t\tthis.returnDocument = returnDocument;\n\t\tthis.freeze();\n\t}\n};\nvar RawFindOneAndDeleteCommand = class extends MongoAstNode {\n\tkind = \"rawFindOneAndDelete\";\n\tcollection;\n\tfilter;\n\tsort;\n\tconstructor(collection, filter, sort) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.filter = filter;\n\t\tthis.sort = sort;\n\t\tthis.freeze();\n\t}\n};\n//#endregion\n//#region src/result-shape.ts\nfunction freezeMongoFieldShape(shape) {\n\tswitch (shape.kind) {\n\t\tcase \"unknown\": return Object.freeze({ kind: \"unknown\" });\n\t\tcase \"leaf\": return Object.freeze({\n\t\t\tkind: \"leaf\",\n\t\t\tcodecId: shape.codecId,\n\t\t\tnullable: shape.nullable\n\t\t});\n\t\tcase \"document\": {\n\t\t\tconst fields = {};\n\t\t\tfor (const [k, v] of Object.entries(shape.fields)) fields[k] = freezeMongoFieldShape(v);\n\t\t\treturn Object.freeze({\n\t\t\t\tkind: \"document\",\n\t\t\t\tnullable: shape.nullable,\n\t\t\t\tfields: Object.freeze(fields)\n\t\t\t});\n\t\t}\n\t\tcase \"array\": return Object.freeze({\n\t\t\tkind: \"array\",\n\t\t\tnullable: shape.nullable,\n\t\t\telement: freezeMongoFieldShape(shape.element)\n\t\t});\n\t\tdefault: return shape;\n\t}\n}\nfunction freezeMongoResultShape(shape) {\n\tif (shape.kind === \"unknown\") return Object.freeze({ kind: \"unknown\" });\n\tconst fields = {};\n\tfor (const [k, v] of Object.entries(shape.fields)) fields[k] = freezeMongoFieldShape(v);\n\treturn Object.freeze({\n\t\tkind: \"document\",\n\t\tfields: Object.freeze(fields)\n\t});\n}\n//#endregion\n//#region src/stages.ts\nfunction isAggExpr(value) {\n\treturn typeof value === \"object\" && value !== null && \"kind\" in value;\n}\nfunction isAggExprNode(value) {\n\treturn \"accept\" in value && typeof value.accept === \"function\";\n}\nfunction rewriteGroupId(groupId, rewriter) {\n\tif (groupId === null) return null;\n\tif (isAggExprNode(groupId)) return groupId.rewrite(rewriter);\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(groupId)) result[key] = val.rewrite(rewriter);\n\treturn result;\n}\nfunction rewriteExprRecord(fields, rewriter) {\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(fields)) result[key] = val.rewrite(rewriter);\n\treturn result;\n}\nfunction rewriteAccumulatorRecord(accumulators, rewriter) {\n\tconst result = {};\n\tfor (const [key, acc] of Object.entries(accumulators)) result[key] = acc.rewrite(rewriter);\n\treturn result;\n}\nvar MongoStageNode = class extends MongoAstNode {};\nvar MongoMatchStage = class MongoMatchStage extends MongoStageNode {\n\tkind = \"match\";\n\tfilter;\n\tconstructor(filter) {\n\t\tsuper();\n\t\tthis.filter = filter;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.match(this);\n\t}\n\trewrite(context) {\n\t\treturn new MongoMatchStage(this.filter.rewrite(context.filter ?? {}));\n\t}\n};\nvar MongoProjectStage = class MongoProjectStage extends MongoStageNode {\n\tkind = \"project\";\n\tprojection;\n\tconstructor(projection) {\n\t\tsuper();\n\t\tthis.projection = Object.freeze({ ...projection });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.project(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tlet hasExpr = false;\n\t\tfor (const val of Object.values(this.projection)) if (isAggExpr(val)) {\n\t\t\thasExpr = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!hasExpr) return this;\n\t\tconst newProjection = {};\n\t\tfor (const [key, val] of Object.entries(this.projection)) newProjection[key] = isAggExpr(val) ? val.rewrite(rewriter) : val;\n\t\treturn new MongoProjectStage(newProjection);\n\t}\n};\nvar MongoSortStage = class extends MongoStageNode {\n\tkind = \"sort\";\n\tsort;\n\tconstructor(sort) {\n\t\tsuper();\n\t\tthis.sort = Object.freeze({ ...sort });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.sort(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoLimitStage = class extends MongoStageNode {\n\tkind = \"limit\";\n\tlimit;\n\tconstructor(limit) {\n\t\tsuper();\n\t\tif (!Number.isInteger(limit) || limit < 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"limit must be a non-negative integer\");\n\t\tthis.limit = limit;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.limit(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoSkipStage = class extends MongoStageNode {\n\tkind = \"skip\";\n\tskip;\n\tconstructor(skip) {\n\t\tsuper();\n\t\tif (!Number.isInteger(skip) || skip < 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"skip must be a non-negative integer\");\n\t\tthis.skip = skip;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.skip(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoLookupStage = class MongoLookupStage extends MongoStageNode {\n\tkind = \"lookup\";\n\tfrom;\n\tlocalField;\n\tforeignField;\n\tas;\n\tpipeline;\n\tlet_;\n\tconstructor(options) {\n\t\tsuper();\n\t\tconst hasLocalField = options.localField !== void 0;\n\t\tconst hasForeignField = options.foreignField !== void 0;\n\t\tconst hasPipeline = !!options.pipeline;\n\t\tif (hasLocalField !== hasForeignField) throw ormError(\"ORM.ARGUMENT_INVALID\", \"MongoLookupStage requires both localField and foreignField together\");\n\t\tif (!hasLocalField && !hasPipeline) throw ormError(\"ORM.ARGUMENT_INVALID\", \"MongoLookupStage requires either equality fields (localField/foreignField) or a pipeline\");\n\t\tif (options.let_ && !hasPipeline) throw ormError(\"ORM.ARGUMENT_INVALID\", \"MongoLookupStage let_ requires a pipeline\");\n\t\tthis.from = options.from;\n\t\tthis.localField = options.localField;\n\t\tthis.foreignField = options.foreignField;\n\t\tthis.as = options.as;\n\t\tthis.pipeline = options.pipeline ? Object.freeze([...options.pipeline]) : void 0;\n\t\tthis.let_ = options.let_ ? Object.freeze({ ...options.let_ }) : void 0;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.lookup(this);\n\t}\n\trewrite(context) {\n\t\tif (!this.pipeline && !this.let_) return this;\n\t\tconst rewrittenLet = this.let_ && context.aggExpr ? rewriteExprRecord(this.let_, context.aggExpr) : this.let_;\n\t\tconst options = {\n\t\t\tfrom: this.from,\n\t\t\tas: this.as\n\t\t};\n\t\tif (this.localField !== void 0) options.localField = this.localField;\n\t\tif (this.foreignField !== void 0) options.foreignField = this.foreignField;\n\t\tif (this.pipeline) options.pipeline = this.pipeline.map((stage) => stage.rewrite(context));\n\t\tif (rewrittenLet) options.let_ = { ...rewrittenLet };\n\t\treturn new MongoLookupStage(options);\n\t}\n};\nvar MongoUnwindStage = class extends MongoStageNode {\n\tkind = \"unwind\";\n\tpath;\n\tpreserveNullAndEmptyArrays;\n\tincludeArrayIndex;\n\tconstructor(path, preserveNullAndEmptyArrays, includeArrayIndex) {\n\t\tsuper();\n\t\tthis.path = path;\n\t\tthis.preserveNullAndEmptyArrays = preserveNullAndEmptyArrays;\n\t\tthis.includeArrayIndex = includeArrayIndex;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.unwind(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoGroupStage = class MongoGroupStage extends MongoStageNode {\n\tkind = \"group\";\n\tgroupId;\n\taccumulators;\n\tconstructor(groupId, accumulators) {\n\t\tsuper();\n\t\tthis.groupId = groupId;\n\t\tthis.accumulators = Object.freeze({ ...accumulators });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.group(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tconst newAccumulators = {};\n\t\tfor (const [key, acc] of Object.entries(this.accumulators)) newAccumulators[key] = acc.rewrite(rewriter);\n\t\treturn new MongoGroupStage(rewriteGroupId(this.groupId, rewriter), newAccumulators);\n\t}\n};\nvar MongoAddFieldsStage = class MongoAddFieldsStage extends MongoStageNode {\n\tkind = \"addFields\";\n\tfields;\n\tconstructor(fields) {\n\t\tsuper();\n\t\tthis.fields = Object.freeze({ ...fields });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addFields(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\treturn new MongoAddFieldsStage(rewriteExprRecord(this.fields, rewriter));\n\t}\n};\nvar MongoReplaceRootStage = class MongoReplaceRootStage extends MongoStageNode {\n\tkind = \"replaceRoot\";\n\tnewRoot;\n\tconstructor(newRoot) {\n\t\tsuper();\n\t\tthis.newRoot = newRoot;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.replaceRoot(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\treturn new MongoReplaceRootStage(this.newRoot.rewrite(rewriter));\n\t}\n};\nvar MongoCountStage = class extends MongoStageNode {\n\tkind = \"count\";\n\tfield;\n\tconstructor(field) {\n\t\tsuper();\n\t\tthis.field = field;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.count(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoSortByCountStage = class MongoSortByCountStage extends MongoStageNode {\n\tkind = \"sortByCount\";\n\texpr;\n\tconstructor(expr) {\n\t\tsuper();\n\t\tthis.expr = expr;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.sortByCount(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\treturn new MongoSortByCountStage(this.expr.rewrite(rewriter));\n\t}\n};\nvar MongoSampleStage = class extends MongoStageNode {\n\tkind = \"sample\";\n\tsize;\n\tconstructor(size) {\n\t\tsuper();\n\t\tif (!Number.isInteger(size) || size < 0) throw ormError(\"ORM.ARGUMENT_INVALID\", \"size must be a non-negative integer\");\n\t\tthis.size = size;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.sample(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoRedactStage = class MongoRedactStage extends MongoStageNode {\n\tkind = \"redact\";\n\texpr;\n\tconstructor(expr) {\n\t\tsuper();\n\t\tthis.expr = expr;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.redact(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\treturn new MongoRedactStage(this.expr.rewrite(rewriter));\n\t}\n};\nvar MongoOutStage = class extends MongoStageNode {\n\tkind = \"out\";\n\tcollection;\n\tdb;\n\tconstructor(collection, db) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.db = db;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.out(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoUnionWithStage = class MongoUnionWithStage extends MongoStageNode {\n\tkind = \"unionWith\";\n\tcollection;\n\tpipeline;\n\tconstructor(collection, pipeline) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.pipeline = pipeline ? Object.freeze([...pipeline]) : void 0;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.unionWith(this);\n\t}\n\trewrite(context) {\n\t\tif (!this.pipeline) return this;\n\t\treturn new MongoUnionWithStage(this.collection, this.pipeline.map((stage) => stage.rewrite(context)));\n\t}\n};\nvar MongoBucketStage = class MongoBucketStage extends MongoStageNode {\n\tkind = \"bucket\";\n\tgroupBy;\n\tboundaries;\n\tdefault_;\n\toutput;\n\tconstructor(options) {\n\t\tsuper();\n\t\tif (options.boundaries.length < 2) throw ormError(\"ORM.ARGUMENT_INVALID\", \"boundaries must contain at least 2 values\");\n\t\tthis.groupBy = options.groupBy;\n\t\tthis.boundaries = Object.freeze([...options.boundaries]);\n\t\tthis.default_ = options.default_;\n\t\tthis.output = options.output ? Object.freeze({ ...options.output }) : void 0;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.bucket(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tconst opts = {\n\t\t\tgroupBy: this.groupBy.rewrite(rewriter),\n\t\t\tboundaries: this.boundaries\n\t\t};\n\t\tif (this.default_ !== void 0) opts.default_ = this.default_;\n\t\tif (this.output) opts.output = rewriteAccumulatorRecord(this.output, rewriter);\n\t\treturn new MongoBucketStage(opts);\n\t}\n};\nvar MongoBucketAutoStage = class MongoBucketAutoStage extends MongoStageNode {\n\tkind = \"bucketAuto\";\n\tgroupBy;\n\tbuckets;\n\toutput;\n\tgranularity;\n\tconstructor(options) {\n\t\tsuper();\n\t\tif (!Number.isInteger(options.buckets) || options.buckets < 1) throw ormError(\"ORM.ARGUMENT_INVALID\", \"buckets must be a positive integer\");\n\t\tthis.groupBy = options.groupBy;\n\t\tthis.buckets = options.buckets;\n\t\tthis.output = options.output ? Object.freeze({ ...options.output }) : void 0;\n\t\tthis.granularity = options.granularity;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.bucketAuto(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tconst opts = {\n\t\t\tgroupBy: this.groupBy.rewrite(rewriter),\n\t\t\tbuckets: this.buckets\n\t\t};\n\t\tif (this.output) opts.output = rewriteAccumulatorRecord(this.output, rewriter);\n\t\tif (this.granularity !== void 0) opts.granularity = this.granularity;\n\t\treturn new MongoBucketAutoStage(opts);\n\t}\n};\nvar MongoGeoNearStage = class MongoGeoNearStage extends MongoStageNode {\n\tkind = \"geoNear\";\n\tnear;\n\tdistanceField;\n\tspherical;\n\tmaxDistance;\n\tminDistance;\n\tquery;\n\tkey;\n\tdistanceMultiplier;\n\tincludeLocs;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.near = options.near;\n\t\tthis.distanceField = options.distanceField;\n\t\tthis.spherical = options.spherical;\n\t\tthis.maxDistance = options.maxDistance;\n\t\tthis.minDistance = options.minDistance;\n\t\tthis.query = options.query;\n\t\tthis.key = options.key;\n\t\tthis.distanceMultiplier = options.distanceMultiplier;\n\t\tthis.includeLocs = options.includeLocs;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.geoNear(this);\n\t}\n\trewrite(context) {\n\t\tif (!this.query || !context.filter) return this;\n\t\tconst opts = {\n\t\t\tnear: this.near,\n\t\t\tdistanceField: this.distanceField\n\t\t};\n\t\tif (this.spherical !== void 0) opts.spherical = this.spherical;\n\t\tif (this.maxDistance !== void 0) opts.maxDistance = this.maxDistance;\n\t\tif (this.minDistance !== void 0) opts.minDistance = this.minDistance;\n\t\topts.query = this.query.rewrite(context.filter);\n\t\tif (this.key !== void 0) opts.key = this.key;\n\t\tif (this.distanceMultiplier !== void 0) opts.distanceMultiplier = this.distanceMultiplier;\n\t\tif (this.includeLocs !== void 0) opts.includeLocs = this.includeLocs;\n\t\treturn new MongoGeoNearStage(opts);\n\t}\n};\nvar MongoFacetStage = class MongoFacetStage extends MongoStageNode {\n\tkind = \"facet\";\n\tfacets;\n\tconstructor(facets) {\n\t\tsuper();\n\t\tconst frozen = {};\n\t\tfor (const [key, pipeline] of Object.entries(facets)) frozen[key] = Object.freeze([...pipeline]);\n\t\tthis.facets = Object.freeze(frozen);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.facet(this);\n\t}\n\trewrite(context) {\n\t\tconst newFacets = {};\n\t\tfor (const [key, pipeline] of Object.entries(this.facets)) newFacets[key] = pipeline.map((stage) => stage.rewrite(context));\n\t\treturn new MongoFacetStage(newFacets);\n\t}\n};\nvar MongoGraphLookupStage = class MongoGraphLookupStage extends MongoStageNode {\n\tkind = \"graphLookup\";\n\tfrom;\n\tstartWith;\n\tconnectFromField;\n\tconnectToField;\n\tas;\n\tmaxDepth;\n\tdepthField;\n\trestrictSearchWithMatch;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.from = options.from;\n\t\tthis.startWith = options.startWith;\n\t\tthis.connectFromField = options.connectFromField;\n\t\tthis.connectToField = options.connectToField;\n\t\tthis.as = options.as;\n\t\tthis.maxDepth = options.maxDepth;\n\t\tthis.depthField = options.depthField;\n\t\tthis.restrictSearchWithMatch = options.restrictSearchWithMatch;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.graphLookup(this);\n\t}\n\trewrite(context) {\n\t\tconst rewrittenStartWith = context.aggExpr ? this.startWith.rewrite(context.aggExpr) : this.startWith;\n\t\tconst rewrittenMatch = this.restrictSearchWithMatch && context.filter ? this.restrictSearchWithMatch.rewrite(context.filter) : this.restrictSearchWithMatch;\n\t\tif (rewrittenStartWith === this.startWith && rewrittenMatch === this.restrictSearchWithMatch) return this;\n\t\tconst opts = {\n\t\t\tfrom: this.from,\n\t\t\tstartWith: rewrittenStartWith,\n\t\t\tconnectFromField: this.connectFromField,\n\t\t\tconnectToField: this.connectToField,\n\t\t\tas: this.as\n\t\t};\n\t\tif (this.maxDepth !== void 0) opts.maxDepth = this.maxDepth;\n\t\tif (this.depthField !== void 0) opts.depthField = this.depthField;\n\t\tif (rewrittenMatch) opts.restrictSearchWithMatch = rewrittenMatch;\n\t\treturn new MongoGraphLookupStage(opts);\n\t}\n};\nvar MongoMergeStage = class MongoMergeStage extends MongoStageNode {\n\tkind = \"merge\";\n\tinto;\n\ton;\n\twhenMatched;\n\twhenNotMatched;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.into = typeof options.into === \"string\" ? options.into : Object.freeze({ ...options.into });\n\t\tthis.on = options.on === void 0 ? void 0 : typeof options.on === \"string\" ? options.on : Object.freeze([...options.on]);\n\t\tthis.whenMatched = options.whenMatched === void 0 ? void 0 : typeof options.whenMatched === \"string\" ? options.whenMatched : Object.freeze([...options.whenMatched]);\n\t\tthis.whenNotMatched = options.whenNotMatched;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.merge(this);\n\t}\n\trewrite(context) {\n\t\tif (!Array.isArray(this.whenMatched)) return this;\n\t\tconst opts = { into: this.into };\n\t\tif (this.on !== void 0) opts.on = this.on;\n\t\topts.whenMatched = this.whenMatched.map((stage) => stage.rewrite(context));\n\t\tif (this.whenNotMatched !== void 0) opts.whenNotMatched = this.whenNotMatched;\n\t\treturn new MongoMergeStage(opts);\n\t}\n};\nvar MongoSetWindowFieldsStage = class MongoSetWindowFieldsStage extends MongoStageNode {\n\tkind = \"setWindowFields\";\n\tpartitionBy;\n\tsortBy;\n\toutput;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.partitionBy = options.partitionBy;\n\t\tthis.sortBy = options.sortBy ? Object.freeze({ ...options.sortBy }) : void 0;\n\t\tthis.output = Object.freeze({ ...options.output });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.setWindowFields(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tconst newOutput = {};\n\t\tfor (const [key, wf] of Object.entries(this.output)) newOutput[key] = {\n\t\t\t...wf,\n\t\t\toperator: wf.operator.rewrite(rewriter)\n\t\t};\n\t\tconst opts = { output: newOutput };\n\t\tif (this.partitionBy) opts.partitionBy = this.partitionBy.rewrite(rewriter);\n\t\tif (this.sortBy) opts.sortBy = { ...this.sortBy };\n\t\treturn new MongoSetWindowFieldsStage(opts);\n\t}\n};\nvar MongoDensifyStage = class extends MongoStageNode {\n\tkind = \"densify\";\n\tfield;\n\tpartitionByFields;\n\trange;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.field = options.field;\n\t\tthis.partitionByFields = options.partitionByFields ? Object.freeze([...options.partitionByFields]) : void 0;\n\t\tthis.range = Object.freeze({ ...options.range });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.densify(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoFillStage = class MongoFillStage extends MongoStageNode {\n\tkind = \"fill\";\n\tpartitionBy;\n\tpartitionByFields;\n\tsortBy;\n\toutput;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.partitionBy = options.partitionBy;\n\t\tthis.partitionByFields = options.partitionByFields ? Object.freeze([...options.partitionByFields]) : void 0;\n\t\tthis.sortBy = options.sortBy ? Object.freeze({ ...options.sortBy }) : void 0;\n\t\tthis.output = Object.freeze({ ...options.output });\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.fill(this);\n\t}\n\trewrite(context) {\n\t\tconst rewriter = context.aggExpr;\n\t\tif (!rewriter) return this;\n\t\tconst newOutput = {};\n\t\tfor (const [key, fo] of Object.entries(this.output)) newOutput[key] = fo.value ? {\n\t\t\t...fo,\n\t\t\tvalue: fo.value.rewrite(rewriter)\n\t\t} : fo;\n\t\tconst opts = { output: newOutput };\n\t\tif (this.partitionBy) opts.partitionBy = this.partitionBy.rewrite(rewriter);\n\t\tif (this.partitionByFields) opts.partitionByFields = [...this.partitionByFields];\n\t\tif (this.sortBy) opts.sortBy = { ...this.sortBy };\n\t\treturn new MongoFillStage(opts);\n\t}\n};\nvar MongoSearchStage = class extends MongoStageNode {\n\tkind = \"search\";\n\tindex;\n\tconfig;\n\tconstructor(config, index) {\n\t\tsuper();\n\t\tthis.config = Object.freeze({ ...config });\n\t\tthis.index = index;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.search(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoSearchMetaStage = class extends MongoStageNode {\n\tkind = \"searchMeta\";\n\tindex;\n\tconfig;\n\tconstructor(config, index) {\n\t\tsuper();\n\t\tthis.config = Object.freeze({ ...config });\n\t\tthis.index = index;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.searchMeta(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\nvar MongoVectorSearchStage = class extends MongoStageNode {\n\tkind = \"vectorSearch\";\n\tindex;\n\tpath;\n\tqueryVector;\n\tnumCandidates;\n\tlimit;\n\tfilter;\n\tconstructor(options) {\n\t\tsuper();\n\t\tif (!Number.isInteger(options.limit) || options.limit < 1) throw ormError(\"ORM.ARGUMENT_INVALID\", \"limit must be a positive integer\");\n\t\tif (!Number.isInteger(options.numCandidates) || options.numCandidates < options.limit) throw ormError(\"ORM.ARGUMENT_INVALID\", \"numCandidates must be an integer >= limit\");\n\t\tthis.index = options.index;\n\t\tthis.path = options.path;\n\t\tthis.queryVector = Object.freeze([...options.queryVector]);\n\t\tthis.numCandidates = options.numCandidates;\n\t\tthis.limit = options.limit;\n\t\tthis.filter = options.filter ? Object.freeze({ ...options.filter }) : void 0;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.vectorSearch(this);\n\t}\n\trewrite(_context) {\n\t\treturn this;\n\t}\n};\n//#endregion\nexport { AggregateCommand, DeleteManyCommand, DeleteOneCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggAccumulator, MongoAggArrayFilter, MongoAggCond, MongoAggFieldRef, MongoAggLet, MongoAggLiteral, MongoAggMap, MongoAggMergeObjects, MongoAggOperator, MongoAggReduce, MongoAggSwitch, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, MongoCountStage, MongoDensifyStage, MongoExistsExpr, MongoExprFilter, MongoFacetStage, MongoFieldFilter, MongoFillStage, MongoGeoNearStage, MongoGraphLookupStage, MongoGroupStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoNotExpr, MongoOrExpr, MongoOutStage, MongoProjectStage, MongoRedactStage, MongoReplaceRootStage, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, MongoUnionWithStage, MongoUnwindStage, MongoVectorSearchStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, UpdateOneCommand, freezeMongoFieldShape, freezeMongoResultShape, isExprArray, isMongoFilterExpr, isRecordArgs };\n\n//# sourceMappingURL=execution.mjs.map"],"mappings":";;AAEA,SAAS,YAAY,MAAM;CAC1B,OAAO,MAAM,QAAQ,IAAI;AAC1B;AACA,SAAS,aAAa,MAAM;CAC3B,OAAO,CAAC,MAAM,QAAQ,IAAI,KAAK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W,CAAC;EACzD,KAAK,gBAAgB,QAAQ;EAC7B,KAAK,QAAQ,QAAQ;EACrB,KAAK,SAAS,QAAQ,SAAS,OAAO,OAAO,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,KAAK;EAC3E,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,aAAa,IAAI;CACjC;CACA,QAAQ,UAAU;EACjB,OAAO;CACR;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"exports-Bx-hlnZ3.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/mongo-schema-ir/dist/exports/index.mjs"],"sourcesContent":["import { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\n//#region src/canonicalize.ts\nfunction canonicalize(obj) {\n\tif (obj === null) return \"null\";\n\tif (obj === void 0) return \"undefined\";\n\tif (typeof obj !== \"object\") return JSON.stringify(obj);\n\tif (Array.isArray(obj)) return `[${obj.map(canonicalize).join(\",\")}]`;\n\tconst record = obj;\n\treturn `{${Object.keys(record).sort().map((k) => `${JSON.stringify(k)}:${canonicalize(record[k])}`).join(\",\")}}`;\n}\n//#endregion\n//#region src/index-equivalence.ts\n/**\n* Key-order-sensitive structural comparison. For key-order-independent\n* comparison (e.g. lookup key construction), use {@link canonicalize}.\n*/\nfunction deepEqual(a, b) {\n\tif (a === b) return true;\n\tif (a === null || b === null) return false;\n\tif (a === void 0 || b === void 0) return false;\n\tif (typeof a !== typeof b) return false;\n\tif (Array.isArray(a)) {\n\t\tif (!Array.isArray(b)) return false;\n\t\tif (a.length !== b.length) return false;\n\t\tfor (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i])) return false;\n\t\treturn true;\n\t}\n\tif (typeof a === \"object\" && typeof b === \"object\") {\n\t\tconst aObj = a;\n\t\tconst bObj = b;\n\t\tconst aKeys = Object.keys(aObj);\n\t\tconst bKeys = Object.keys(bObj);\n\t\tif (aKeys.length !== bKeys.length) return false;\n\t\tfor (let i = 0; i < aKeys.length; i++) {\n\t\t\tif (aKeys[i] !== bKeys[i]) return false;\n\t\t\tconst key = aKeys[i];\n\t\t\tif (!deepEqual(aObj[key], bObj[key])) return false;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\nfunction indexesEquivalent(a, b) {\n\tif (a.keys.length !== b.keys.length) return false;\n\tfor (let i = 0; i < a.keys.length; i++) {\n\t\tconst aKey = a.keys[i];\n\t\tconst bKey = b.keys[i];\n\t\tif (!aKey || !bKey) return false;\n\t\tif (aKey.field !== bKey.field) return false;\n\t\tif (aKey.direction !== bKey.direction) return false;\n\t}\n\tif (a.unique !== b.unique) return false;\n\tif (a.sparse !== b.sparse) return false;\n\tif (a.expireAfterSeconds !== b.expireAfterSeconds) return false;\n\tif (canonicalize(a.partialFilterExpression) !== canonicalize(b.partialFilterExpression)) return false;\n\tif (canonicalize(a.wildcardProjection) !== canonicalize(b.wildcardProjection)) return false;\n\tif (canonicalize(a.collation) !== canonicalize(b.collation)) return false;\n\tif (canonicalize(a.weights) !== canonicalize(b.weights)) return false;\n\tif (a.default_language !== b.default_language) return false;\n\tif (a.language_override !== b.language_override) return false;\n\treturn true;\n}\n//#endregion\n//#region src/schema-node.ts\n/**\n* Every concrete Mongo schema-IR node also implements the framework's\n* `DiffableNode` interface, so a node can be carried as the `expected`/\n* `actual` payload of a `SchemaDiffIssue`. Mongo's own diff (`diffMongoSchemas`)\n* still hand-rolls its comparisons and never calls `isEqualTo`/`children` —\n* this conformance exists so an issue can carry the real collection/index/\n* validator/options node it concerns, not a coordinate string.\n*\n* Follow-up: `isEqualTo`/`children` are dead weight on every Mongo node\n* (nothing calls them). The honest fix is splitting `DiffableNode` into a\n* narrower \"issue payload\" bound (just `id`) that this class implements,\n* separate from the full walkable `DiffableNode` (`id` + `isEqualTo` +\n* `children`) the generic differ actually pairs and recurses over.\n*/\nvar MongoSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/schema-collection.ts\nvar MongoSchemaCollection = class extends MongoSchemaIRNode {\n\tnodeKind = \"collection\";\n\tid;\n\tname;\n\tindexes;\n\tvalidator;\n\toptions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.name;\n\t\tthis.name = options.name;\n\t\tthis.indexes = options.indexes ?? [];\n\t\tthis.validator = options.validator;\n\t\tthis.options = options.options;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collection(this);\n\t}\n};\n//#endregion\n//#region src/schema-collection-options.ts\nvar MongoSchemaCollectionOptions = class extends MongoSchemaIRNode {\n\tnodeKind = \"collectionOptions\";\n\t/** Fixed sentinel: at most one options node exists per collection. */\n\tid = \"options\";\n\tcapped;\n\ttimeseries;\n\tcollation;\n\tchangeStreamPreAndPostImages;\n\tclusteredIndex;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.capped = options.capped;\n\t\tthis.timeseries = options.timeseries;\n\t\tthis.collation = options.collation;\n\t\tthis.changeStreamPreAndPostImages = options.changeStreamPreAndPostImages;\n\t\tthis.clusteredIndex = options.clusteredIndex;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collectionOptions(this);\n\t}\n};\n//#endregion\n//#region src/schema-index.ts\nvar MongoSchemaIndex = class extends MongoSchemaIRNode {\n\tnodeKind = \"index\";\n\tid;\n\tkeys;\n\tunique;\n\tsparse;\n\texpireAfterSeconds;\n\tpartialFilterExpression;\n\twildcardProjection;\n\tcollation;\n\tweights;\n\tdefault_language;\n\tlanguage_override;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\t\tthis.keys = options.keys;\n\t\tthis.unique = options.unique ?? false;\n\t\tthis.sparse = options.sparse;\n\t\tthis.expireAfterSeconds = options.expireAfterSeconds;\n\t\tthis.partialFilterExpression = options.partialFilterExpression;\n\t\tthis.wildcardProjection = options.wildcardProjection;\n\t\tthis.collation = options.collation;\n\t\tthis.weights = options.weights;\n\t\tthis.default_language = options.default_language;\n\t\tthis.language_override = options.language_override;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.index(this);\n\t}\n};\n//#endregion\n//#region src/schema-ir.ts\nvar MongoSchemaIR = class extends MongoSchemaIRNode {\n\tnodeKind = \"schema\";\n\t/** Fixed sentinel: the schema is always the diff tree's single root. */\n\tid = \"schema\";\n\tcollections;\n\tcollectionNames;\n\t_byName;\n\tconstructor(collections) {\n\t\tsuper();\n\t\tconst sorted = [...collections].sort((a, b) => a.name.localeCompare(b.name));\n\t\tthis.collections = sorted;\n\t\tthis._byName = new Map(sorted.map((c) => [c.name, c]));\n\t\tthis.collectionNames = sorted.map((c) => c.name);\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.schema(this);\n\t}\n\tcollection(name) {\n\t\treturn this._byName.get(name);\n\t}\n};\n//#endregion\n//#region src/schema-validator.ts\nvar MongoSchemaValidator = class extends MongoSchemaIRNode {\n\tnodeKind = \"validator\";\n\t/** Fixed sentinel: at most one validator exists per collection. */\n\tid = \"validator\";\n\tjsonSchema;\n\tvalidationLevel;\n\tvalidationAction;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.jsonSchema = options.jsonSchema;\n\t\tthis.validationLevel = options.validationLevel;\n\t\tthis.validationAction = options.validationAction;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.validator(this);\n\t}\n};\n//#endregion\nexport { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexesEquivalent };\n\n//# sourceM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