@quereus/quereus 4.10.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (457) hide show
  1. package/dist/src/common/type-inference.d.ts +12 -6
  2. package/dist/src/common/type-inference.d.ts.map +1 -1
  3. package/dist/src/common/type-inference.js +12 -24
  4. package/dist/src/common/type-inference.js.map +1 -1
  5. package/dist/src/core/database-assertions.d.ts.map +1 -1
  6. package/dist/src/core/database-assertions.js +7 -5
  7. package/dist/src/core/database-assertions.js.map +1 -1
  8. package/dist/src/core/database-events.d.ts +4 -3
  9. package/dist/src/core/database-events.d.ts.map +1 -1
  10. package/dist/src/core/database-events.js +4 -3
  11. package/dist/src/core/database-events.js.map +1 -1
  12. package/dist/src/core/database-materialized-views-analysis.d.ts +1 -3
  13. package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
  14. package/dist/src/core/database-materialized-views-analysis.js +1 -11
  15. package/dist/src/core/database-materialized-views-analysis.js.map +1 -1
  16. package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
  17. package/dist/src/core/database-materialized-views-plan-builders.js +12 -10
  18. package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
  19. package/dist/src/core/database.d.ts.map +1 -1
  20. package/dist/src/core/database.js +13 -2
  21. package/dist/src/core/database.js.map +1 -1
  22. package/dist/src/core/derived-row-validator.d.ts.map +1 -1
  23. package/dist/src/core/derived-row-validator.js +14 -2
  24. package/dist/src/core/derived-row-validator.js.map +1 -1
  25. package/dist/src/core/param.d.ts +9 -0
  26. package/dist/src/core/param.d.ts.map +1 -1
  27. package/dist/src/core/param.js +21 -1
  28. package/dist/src/core/param.js.map +1 -1
  29. package/dist/src/core/statement.d.ts.map +1 -1
  30. package/dist/src/core/statement.js +38 -15
  31. package/dist/src/core/statement.js.map +1 -1
  32. package/dist/src/func/builtins/aggregate.d.ts.map +1 -1
  33. package/dist/src/func/builtins/aggregate.js +7 -2
  34. package/dist/src/func/builtins/aggregate.js.map +1 -1
  35. package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
  36. package/dist/src/func/builtins/builtin-window-functions.js +27 -11
  37. package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
  38. package/dist/src/func/builtins/datetime.d.ts.map +1 -1
  39. package/dist/src/func/builtins/datetime.js +8 -3
  40. package/dist/src/func/builtins/datetime.js.map +1 -1
  41. package/dist/src/func/builtins/explain.d.ts.map +1 -1
  42. package/dist/src/func/builtins/explain.js +9 -29
  43. package/dist/src/func/builtins/explain.js.map +1 -1
  44. package/dist/src/func/builtins/json-tvf.d.ts.map +1 -1
  45. package/dist/src/func/builtins/json-tvf.js +14 -7
  46. package/dist/src/func/builtins/json-tvf.js.map +1 -1
  47. package/dist/src/func/builtins/return-types.d.ts +29 -0
  48. package/dist/src/func/builtins/return-types.d.ts.map +1 -1
  49. package/dist/src/func/builtins/return-types.js +4 -1
  50. package/dist/src/func/builtins/return-types.js.map +1 -1
  51. package/dist/src/func/builtins/scalar.d.ts.map +1 -1
  52. package/dist/src/func/builtins/scalar.js +22 -67
  53. package/dist/src/func/builtins/scalar.js.map +1 -1
  54. package/dist/src/func/builtins/schema.d.ts.map +1 -1
  55. package/dist/src/func/builtins/schema.js +26 -16
  56. package/dist/src/func/builtins/schema.js.map +1 -1
  57. package/dist/src/index.d.ts +1 -1
  58. package/dist/src/index.d.ts.map +1 -1
  59. package/dist/src/index.js +6 -1
  60. package/dist/src/index.js.map +1 -1
  61. package/dist/src/parser/parser.d.ts.map +1 -1
  62. package/dist/src/parser/parser.js +5 -3
  63. package/dist/src/parser/parser.js.map +1 -1
  64. package/dist/src/parser/visitor.d.ts +16 -0
  65. package/dist/src/parser/visitor.d.ts.map +1 -1
  66. package/dist/src/parser/visitor.js +16 -0
  67. package/dist/src/parser/visitor.js.map +1 -1
  68. package/dist/src/planner/analysis/assertion-plan.d.ts +33 -0
  69. package/dist/src/planner/analysis/assertion-plan.d.ts.map +1 -0
  70. package/dist/src/planner/analysis/assertion-plan.js +39 -0
  71. package/dist/src/planner/analysis/assertion-plan.js.map +1 -0
  72. package/dist/src/planner/analysis/binary-operator-class.d.ts +55 -0
  73. package/dist/src/planner/analysis/binary-operator-class.d.ts.map +1 -0
  74. package/dist/src/planner/analysis/binary-operator-class.js +57 -0
  75. package/dist/src/planner/analysis/binary-operator-class.js.map +1 -0
  76. package/dist/src/planner/analysis/binding-extractor.d.ts +9 -3
  77. package/dist/src/planner/analysis/binding-extractor.d.ts.map +1 -1
  78. package/dist/src/planner/analysis/binding-extractor.js +11 -16
  79. package/dist/src/planner/analysis/binding-extractor.js.map +1 -1
  80. package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
  81. package/dist/src/planner/analysis/change-scope.js +19 -6
  82. package/dist/src/planner/analysis/change-scope.js.map +1 -1
  83. package/dist/src/planner/analysis/check-extraction.d.ts +1 -7
  84. package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
  85. package/dist/src/planner/analysis/check-extraction.js.map +1 -1
  86. package/dist/src/planner/analysis/comparison-collation.d.ts +17 -0
  87. package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
  88. package/dist/src/planner/analysis/comparison-collation.js +17 -5
  89. package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
  90. package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
  91. package/dist/src/planner/analysis/constraint-extractor.js +18 -18
  92. package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
  93. package/dist/src/planner/analysis/coverage-prover.d.ts +11 -7
  94. package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
  95. package/dist/src/planner/analysis/coverage-prover.js +11 -7
  96. package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
  97. package/dist/src/planner/analysis/equi-correlation.d.ts +1 -1
  98. package/dist/src/planner/analysis/equi-correlation.js +1 -1
  99. package/dist/src/planner/analysis/expression-fingerprint.d.ts.map +1 -1
  100. package/dist/src/planner/analysis/expression-fingerprint.js +0 -2
  101. package/dist/src/planner/analysis/expression-fingerprint.js.map +1 -1
  102. package/dist/src/planner/analysis/key-filter.d.ts.map +1 -1
  103. package/dist/src/planner/analysis/key-filter.js +2 -3
  104. package/dist/src/planner/analysis/key-filter.js.map +1 -1
  105. package/dist/src/planner/analysis/relation-key.d.ts +104 -0
  106. package/dist/src/planner/analysis/relation-key.d.ts.map +1 -0
  107. package/dist/src/planner/analysis/relation-key.js +121 -0
  108. package/dist/src/planner/analysis/relation-key.js.map +1 -0
  109. package/dist/src/planner/analysis/scalar-param-usage.d.ts.map +1 -1
  110. package/dist/src/planner/analysis/scalar-param-usage.js +12 -4
  111. package/dist/src/planner/analysis/scalar-param-usage.js.map +1 -1
  112. package/dist/src/planner/analysis/set-op-type-merge.d.ts +9 -3
  113. package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -1
  114. package/dist/src/planner/analysis/set-op-type-merge.js +22 -8
  115. package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -1
  116. package/dist/src/planner/building/alter-table.d.ts.map +1 -1
  117. package/dist/src/planner/building/alter-table.js +31 -23
  118. package/dist/src/planner/building/alter-table.js.map +1 -1
  119. package/dist/src/planner/building/analyze.d.ts.map +1 -1
  120. package/dist/src/planner/building/analyze.js +21 -0
  121. package/dist/src/planner/building/analyze.js.map +1 -1
  122. package/dist/src/planner/building/block.d.ts.map +1 -1
  123. package/dist/src/planner/building/block.js +222 -82
  124. package/dist/src/planner/building/block.js.map +1 -1
  125. package/dist/src/planner/building/constraint-builder.d.ts +3 -2
  126. package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
  127. package/dist/src/planner/building/constraint-builder.js +20 -27
  128. package/dist/src/planner/building/constraint-builder.js.map +1 -1
  129. package/dist/src/planner/building/delete.d.ts.map +1 -1
  130. package/dist/src/planner/building/delete.js +8 -25
  131. package/dist/src/planner/building/delete.js.map +1 -1
  132. package/dist/src/planner/building/expression.d.ts.map +1 -1
  133. package/dist/src/planner/building/expression.js +11 -3
  134. package/dist/src/planner/building/expression.js.map +1 -1
  135. package/dist/src/planner/building/foreign-key-builder.d.ts +19 -8
  136. package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
  137. package/dist/src/planner/building/foreign-key-builder.js +56 -37
  138. package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
  139. package/dist/src/planner/building/generated-column-scope.d.ts +58 -0
  140. package/dist/src/planner/building/generated-column-scope.d.ts.map +1 -0
  141. package/dist/src/planner/building/generated-column-scope.js +117 -0
  142. package/dist/src/planner/building/generated-column-scope.js.map +1 -0
  143. package/dist/src/planner/building/insert.d.ts.map +1 -1
  144. package/dist/src/planner/building/insert.js +36 -60
  145. package/dist/src/planner/building/insert.js.map +1 -1
  146. package/dist/src/planner/building/mutation-context.d.ts +63 -0
  147. package/dist/src/planner/building/mutation-context.d.ts.map +1 -0
  148. package/dist/src/planner/building/mutation-context.js +126 -0
  149. package/dist/src/planner/building/mutation-context.js.map +1 -0
  150. package/dist/src/planner/building/select-aggregates.d.ts +73 -132
  151. package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
  152. package/dist/src/planner/building/select-aggregates.js +405 -81
  153. package/dist/src/planner/building/select-aggregates.js.map +1 -1
  154. package/dist/src/planner/building/select-modifiers.d.ts +37 -8
  155. package/dist/src/planner/building/select-modifiers.d.ts.map +1 -1
  156. package/dist/src/planner/building/select-modifiers.js +8 -9
  157. package/dist/src/planner/building/select-modifiers.js.map +1 -1
  158. package/dist/src/planner/building/select-ordinal.d.ts +6 -0
  159. package/dist/src/planner/building/select-ordinal.d.ts.map +1 -1
  160. package/dist/src/planner/building/select-ordinal.js +1 -1
  161. package/dist/src/planner/building/select-ordinal.js.map +1 -1
  162. package/dist/src/planner/building/select-window.d.ts +2 -2
  163. package/dist/src/planner/building/select-window.d.ts.map +1 -1
  164. package/dist/src/planner/building/select-window.js +82 -101
  165. package/dist/src/planner/building/select-window.js.map +1 -1
  166. package/dist/src/planner/building/select.d.ts.map +1 -1
  167. package/dist/src/planner/building/select.js +78 -33
  168. package/dist/src/planner/building/select.js.map +1 -1
  169. package/dist/src/planner/building/update.d.ts.map +1 -1
  170. package/dist/src/planner/building/update.js +21 -32
  171. package/dist/src/planner/building/update.js.map +1 -1
  172. package/dist/src/planner/building/view-mutation-builder.d.ts.map +1 -1
  173. package/dist/src/planner/building/view-mutation-builder.js +329 -14
  174. package/dist/src/planner/building/view-mutation-builder.js.map +1 -1
  175. package/dist/src/planner/building/with.d.ts +6 -0
  176. package/dist/src/planner/building/with.d.ts.map +1 -1
  177. package/dist/src/planner/building/with.js +52 -3
  178. package/dist/src/planner/building/with.js.map +1 -1
  179. package/dist/src/planner/cache/correlation-detector.d.ts.map +1 -1
  180. package/dist/src/planner/cache/correlation-detector.js +44 -17
  181. package/dist/src/planner/cache/correlation-detector.js.map +1 -1
  182. package/dist/src/planner/framework/physical-utils.d.ts +6 -0
  183. package/dist/src/planner/framework/physical-utils.d.ts.map +1 -1
  184. package/dist/src/planner/framework/physical-utils.js +6 -0
  185. package/dist/src/planner/framework/physical-utils.js.map +1 -1
  186. package/dist/src/planner/mutation/lens-enforcement.d.ts +123 -0
  187. package/dist/src/planner/mutation/lens-enforcement.d.ts.map +1 -1
  188. package/dist/src/planner/mutation/lens-enforcement.js +362 -5
  189. package/dist/src/planner/mutation/lens-enforcement.js.map +1 -1
  190. package/dist/src/planner/mutation/mutation-diagnostic.d.ts +1 -1
  191. package/dist/src/planner/mutation/mutation-diagnostic.d.ts.map +1 -1
  192. package/dist/src/planner/mutation/mutation-diagnostic.js.map +1 -1
  193. package/dist/src/planner/nodes/alter-table-node.d.ts +15 -11
  194. package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
  195. package/dist/src/planner/nodes/alter-table-node.js +5 -0
  196. package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
  197. package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
  198. package/dist/src/planner/nodes/bloom-join-node.js +7 -0
  199. package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
  200. package/dist/src/planner/nodes/constraint-check-node.d.ts +16 -0
  201. package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
  202. package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
  203. package/dist/src/planner/nodes/plan-node-type.d.ts +1 -1
  204. package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
  205. package/dist/src/planner/nodes/plan-node-type.js +1 -1
  206. package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
  207. package/dist/src/planner/nodes/pragma.d.ts.map +1 -1
  208. package/dist/src/planner/nodes/pragma.js +5 -2
  209. package/dist/src/planner/nodes/pragma.js.map +1 -1
  210. package/dist/src/planner/nodes/reference.d.ts.map +1 -1
  211. package/dist/src/planner/nodes/reference.js +9 -1
  212. package/dist/src/planner/nodes/reference.js.map +1 -1
  213. package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
  214. package/dist/src/planner/nodes/scalar.js +117 -91
  215. package/dist/src/planner/nodes/scalar.js.map +1 -1
  216. package/dist/src/planner/nodes/sequence-node.d.ts +50 -0
  217. package/dist/src/planner/nodes/sequence-node.d.ts.map +1 -0
  218. package/dist/src/planner/nodes/sequence-node.js +96 -0
  219. package/dist/src/planner/nodes/sequence-node.js.map +1 -0
  220. package/dist/src/planner/nodes/values-node.d.ts +8 -0
  221. package/dist/src/planner/nodes/values-node.d.ts.map +1 -1
  222. package/dist/src/planner/nodes/values-node.js +29 -6
  223. package/dist/src/planner/nodes/values-node.js.map +1 -1
  224. package/dist/src/planner/nodes/view-mutation-node.d.ts +43 -1
  225. package/dist/src/planner/nodes/view-mutation-node.d.ts.map +1 -1
  226. package/dist/src/planner/nodes/view-mutation-node.js +27 -6
  227. package/dist/src/planner/nodes/view-mutation-node.js.map +1 -1
  228. package/dist/src/planner/nodes/window-node.d.ts +33 -4
  229. package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
  230. package/dist/src/planner/nodes/window-node.js +80 -36
  231. package/dist/src/planner/nodes/window-node.js.map +1 -1
  232. package/dist/src/planner/planning-context.d.ts +38 -1
  233. package/dist/src/planner/planning-context.d.ts.map +1 -1
  234. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -1
  235. package/dist/src/planner/rules/access/rule-key-set-seek.js +8 -3
  236. package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -1
  237. package/dist/src/planner/rules/join/rule-fanout-lookup-join.js +18 -12
  238. package/dist/src/planner/rules/join/rule-fanout-lookup-join.js.map +1 -1
  239. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +4 -3
  240. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
  241. package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -1
  242. package/dist/src/planner/rules/window/rule-monotonic-window.js +6 -0
  243. package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -1
  244. package/dist/src/planner/scopes/param.d.ts.map +1 -1
  245. package/dist/src/planner/scopes/param.js +10 -5
  246. package/dist/src/planner/scopes/param.js.map +1 -1
  247. package/dist/src/planner/util/ind-utils.d.ts +25 -8
  248. package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
  249. package/dist/src/planner/util/ind-utils.js +53 -10
  250. package/dist/src/planner/util/ind-utils.js.map +1 -1
  251. package/dist/src/planner/util/key-utils.d.ts +7 -7
  252. package/dist/src/planner/util/key-utils.js +9 -9
  253. package/dist/src/planner/util/key-utils.js.map +1 -1
  254. package/dist/src/runtime/delta-executor.d.ts.map +1 -1
  255. package/dist/src/runtime/delta-executor.js +7 -2
  256. package/dist/src/runtime/delta-executor.js.map +1 -1
  257. package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
  258. package/dist/src/runtime/emit/add-constraint.js +50 -15
  259. package/dist/src/runtime/emit/add-constraint.js.map +1 -1
  260. package/dist/src/runtime/emit/alter-schema-event.d.ts +2 -43
  261. package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -1
  262. package/dist/src/runtime/emit/alter-schema-event.js +2 -53
  263. package/dist/src/runtime/emit/alter-schema-event.js.map +1 -1
  264. package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
  265. package/dist/src/runtime/emit/alter-table.js +70 -26
  266. package/dist/src/runtime/emit/alter-table.js.map +1 -1
  267. package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
  268. package/dist/src/runtime/emit/analyze.js +7 -0
  269. package/dist/src/runtime/emit/analyze.js.map +1 -1
  270. package/dist/src/runtime/emit/assertion-rename-helpers.d.ts.map +1 -1
  271. package/dist/src/runtime/emit/assertion-rename-helpers.js +2 -3
  272. package/dist/src/runtime/emit/assertion-rename-helpers.js.map +1 -1
  273. package/dist/src/runtime/emit/binary.d.ts +5 -0
  274. package/dist/src/runtime/emit/binary.d.ts.map +1 -1
  275. package/dist/src/runtime/emit/binary.js +22 -22
  276. package/dist/src/runtime/emit/binary.js.map +1 -1
  277. package/dist/src/runtime/emit/block.d.ts.map +1 -1
  278. package/dist/src/runtime/emit/block.js +9 -3
  279. package/dist/src/runtime/emit/block.js.map +1 -1
  280. package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
  281. package/dist/src/runtime/emit/constraint-check.js +22 -13
  282. package/dist/src/runtime/emit/constraint-check.js.map +1 -1
  283. package/dist/src/runtime/emit/create-assertion.d.ts.map +1 -1
  284. package/dist/src/runtime/emit/create-assertion.js +71 -70
  285. package/dist/src/runtime/emit/create-assertion.js.map +1 -1
  286. package/dist/src/runtime/emit/create-index.d.ts.map +1 -1
  287. package/dist/src/runtime/emit/create-index.js +8 -3
  288. package/dist/src/runtime/emit/create-index.js.map +1 -1
  289. package/dist/src/runtime/emit/create-table.d.ts.map +1 -1
  290. package/dist/src/runtime/emit/create-table.js +20 -10
  291. package/dist/src/runtime/emit/create-table.js.map +1 -1
  292. package/dist/src/runtime/emit/create-view.d.ts.map +1 -1
  293. package/dist/src/runtime/emit/create-view.js +51 -44
  294. package/dist/src/runtime/emit/create-view.js.map +1 -1
  295. package/dist/src/runtime/emit/ddl-event-scope.d.ts +71 -0
  296. package/dist/src/runtime/emit/ddl-event-scope.d.ts.map +1 -0
  297. package/dist/src/runtime/emit/ddl-event-scope.js +80 -0
  298. package/dist/src/runtime/emit/ddl-event-scope.js.map +1 -0
  299. package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
  300. package/dist/src/runtime/emit/dml-executor.js +28 -24
  301. package/dist/src/runtime/emit/dml-executor.js.map +1 -1
  302. package/dist/src/runtime/emit/drop-assertion.d.ts.map +1 -1
  303. package/dist/src/runtime/emit/drop-assertion.js +23 -17
  304. package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
  305. package/dist/src/runtime/emit/drop-index.d.ts.map +1 -1
  306. package/dist/src/runtime/emit/drop-index.js +7 -2
  307. package/dist/src/runtime/emit/drop-index.js.map +1 -1
  308. package/dist/src/runtime/emit/drop-table.d.ts.map +1 -1
  309. package/dist/src/runtime/emit/drop-table.js +16 -10
  310. package/dist/src/runtime/emit/drop-table.js.map +1 -1
  311. package/dist/src/runtime/emit/drop-view.d.ts.map +1 -1
  312. package/dist/src/runtime/emit/drop-view.js +50 -43
  313. package/dist/src/runtime/emit/drop-view.js.map +1 -1
  314. package/dist/src/runtime/emit/insert.d.ts.map +1 -1
  315. package/dist/src/runtime/emit/insert.js +2 -1
  316. package/dist/src/runtime/emit/insert.js.map +1 -1
  317. package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
  318. package/dist/src/runtime/emit/materialized-view.js +87 -67
  319. package/dist/src/runtime/emit/materialized-view.js.map +1 -1
  320. package/dist/src/runtime/emit/schema-declarative.d.ts +8 -0
  321. package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
  322. package/dist/src/runtime/emit/schema-declarative.js +128 -25
  323. package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
  324. package/dist/src/runtime/emit/sequence.d.ts +17 -0
  325. package/dist/src/runtime/emit/sequence.d.ts.map +1 -0
  326. package/dist/src/runtime/emit/sequence.js +40 -0
  327. package/dist/src/runtime/emit/sequence.js.map +1 -0
  328. package/dist/src/runtime/emit/set-object-tags.d.ts.map +1 -1
  329. package/dist/src/runtime/emit/set-object-tags.js +40 -32
  330. package/dist/src/runtime/emit/set-object-tags.js.map +1 -1
  331. package/dist/src/runtime/emit/table-valued-function.d.ts.map +1 -1
  332. package/dist/src/runtime/emit/table-valued-function.js +3 -2
  333. package/dist/src/runtime/emit/table-valued-function.js.map +1 -1
  334. package/dist/src/runtime/emit/update.js +3 -3
  335. package/dist/src/runtime/emit/update.js.map +1 -1
  336. package/dist/src/runtime/emit/view-mutation.d.ts.map +1 -1
  337. package/dist/src/runtime/emit/view-mutation.js +45 -3
  338. package/dist/src/runtime/emit/view-mutation.js.map +1 -1
  339. package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
  340. package/dist/src/runtime/foreign-key-actions.js +9 -10
  341. package/dist/src/runtime/foreign-key-actions.js.map +1 -1
  342. package/dist/src/runtime/register.d.ts.map +1 -1
  343. package/dist/src/runtime/register.js +3 -2
  344. package/dist/src/runtime/register.js.map +1 -1
  345. package/dist/src/runtime/row-constraints.d.ts +14 -8
  346. package/dist/src/runtime/row-constraints.d.ts.map +1 -1
  347. package/dist/src/runtime/row-constraints.js +41 -15
  348. package/dist/src/runtime/row-constraints.js.map +1 -1
  349. package/dist/src/runtime/strict-representation.d.ts +11 -6
  350. package/dist/src/runtime/strict-representation.d.ts.map +1 -1
  351. package/dist/src/runtime/strict-representation.js +1 -44
  352. package/dist/src/runtime/strict-representation.js.map +1 -1
  353. package/dist/src/schema/assertion.d.ts +25 -2
  354. package/dist/src/schema/assertion.d.ts.map +1 -1
  355. package/dist/src/schema/assertion.js.map +1 -1
  356. package/dist/src/schema/catalog-rendering.d.ts +38 -0
  357. package/dist/src/schema/catalog-rendering.d.ts.map +1 -0
  358. package/dist/src/schema/catalog-rendering.js +171 -0
  359. package/dist/src/schema/catalog-rendering.js.map +1 -0
  360. package/dist/src/schema/catalog.d.ts +94 -5
  361. package/dist/src/schema/catalog.d.ts.map +1 -1
  362. package/dist/src/schema/catalog.js +159 -21
  363. package/dist/src/schema/catalog.js.map +1 -1
  364. package/dist/src/schema/column-source-resolver.d.ts +9 -5
  365. package/dist/src/schema/column-source-resolver.d.ts.map +1 -1
  366. package/dist/src/schema/column-source-resolver.js +9 -5
  367. package/dist/src/schema/column-source-resolver.js.map +1 -1
  368. package/dist/src/schema/constraint-builder.d.ts +23 -7
  369. package/dist/src/schema/constraint-builder.d.ts.map +1 -1
  370. package/dist/src/schema/constraint-builder.js +60 -16
  371. package/dist/src/schema/constraint-builder.js.map +1 -1
  372. package/dist/src/schema/declared-schema-manager.d.ts +50 -0
  373. package/dist/src/schema/declared-schema-manager.d.ts.map +1 -1
  374. package/dist/src/schema/declared-schema-manager.js +52 -0
  375. package/dist/src/schema/declared-schema-manager.js.map +1 -1
  376. package/dist/src/schema/expr-scope/frame.d.ts +65 -0
  377. package/dist/src/schema/expr-scope/frame.d.ts.map +1 -0
  378. package/dist/src/schema/expr-scope/frame.js +104 -0
  379. package/dist/src/schema/expr-scope/frame.js.map +1 -0
  380. package/dist/src/schema/expr-scope/walk.d.ts +40 -0
  381. package/dist/src/schema/expr-scope/walk.d.ts.map +1 -0
  382. package/dist/src/schema/expr-scope/walk.js +260 -0
  383. package/dist/src/schema/expr-scope/walk.js.map +1 -0
  384. package/dist/src/schema/generated-column-refs.d.ts +41 -0
  385. package/dist/src/schema/generated-column-refs.d.ts.map +1 -0
  386. package/dist/src/schema/generated-column-refs.js +124 -0
  387. package/dist/src/schema/generated-column-refs.js.map +1 -0
  388. package/dist/src/schema/lens-ack.d.ts.map +1 -1
  389. package/dist/src/schema/lens-ack.js +5 -2
  390. package/dist/src/schema/lens-ack.js.map +1 -1
  391. package/dist/src/schema/lens-compiler.d.ts.map +1 -1
  392. package/dist/src/schema/lens-compiler.js +9 -1
  393. package/dist/src/schema/lens-compiler.js.map +1 -1
  394. package/dist/src/schema/lens-prover.d.ts +7 -2
  395. package/dist/src/schema/lens-prover.d.ts.map +1 -1
  396. package/dist/src/schema/lens-prover.js +105 -11
  397. package/dist/src/schema/lens-prover.js.map +1 -1
  398. package/dist/src/schema/lens.d.ts +12 -0
  399. package/dist/src/schema/lens.d.ts.map +1 -1
  400. package/dist/src/schema/lens.js +10 -0
  401. package/dist/src/schema/lens.js.map +1 -1
  402. package/dist/src/schema/manager.d.ts +48 -1
  403. package/dist/src/schema/manager.d.ts.map +1 -1
  404. package/dist/src/schema/manager.js +168 -36
  405. package/dist/src/schema/manager.js.map +1 -1
  406. package/dist/src/schema/rename/self-qualifier-strip.d.ts +16 -10
  407. package/dist/src/schema/rename/self-qualifier-strip.d.ts.map +1 -1
  408. package/dist/src/schema/rename/self-qualifier-strip.js +30 -213
  409. package/dist/src/schema/rename/self-qualifier-strip.js.map +1 -1
  410. package/dist/src/schema/rename-rewriter.d.ts +4 -3
  411. package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
  412. package/dist/src/schema/rename-rewriter.js +4 -3
  413. package/dist/src/schema/rename-rewriter.js.map +1 -1
  414. package/dist/src/schema/schema-differ.d.ts +54 -6
  415. package/dist/src/schema/schema-differ.d.ts.map +1 -1
  416. package/dist/src/schema/schema-differ.js +108 -42
  417. package/dist/src/schema/schema-differ.js.map +1 -1
  418. package/dist/src/schema/schema-hasher.d.ts +12 -0
  419. package/dist/src/schema/schema-hasher.d.ts.map +1 -1
  420. package/dist/src/schema/schema-hasher.js +28 -10
  421. package/dist/src/schema/schema-hasher.js.map +1 -1
  422. package/dist/src/schema/table.d.ts +117 -19
  423. package/dist/src/schema/table.d.ts.map +1 -1
  424. package/dist/src/schema/table.js +213 -71
  425. package/dist/src/schema/table.js.map +1 -1
  426. package/dist/src/types/comparison-coercion.d.ts +5 -1
  427. package/dist/src/types/comparison-coercion.d.ts.map +1 -1
  428. package/dist/src/types/comparison-coercion.js +21 -5
  429. package/dist/src/types/comparison-coercion.js.map +1 -1
  430. package/dist/src/types/representation.d.ts +65 -0
  431. package/dist/src/types/representation.d.ts.map +1 -0
  432. package/dist/src/types/representation.js +63 -0
  433. package/dist/src/types/representation.js.map +1 -0
  434. package/dist/src/types/validation.d.ts +76 -22
  435. package/dist/src/types/validation.d.ts.map +1 -1
  436. package/dist/src/types/validation.js +110 -31
  437. package/dist/src/types/validation.js.map +1 -1
  438. package/dist/src/vtab/best-access-plan.d.ts +10 -0
  439. package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
  440. package/dist/src/vtab/best-access-plan.js +16 -0
  441. package/dist/src/vtab/best-access-plan.js.map +1 -1
  442. package/dist/src/vtab/capabilities.d.ts +72 -4
  443. package/dist/src/vtab/capabilities.d.ts.map +1 -1
  444. package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
  445. package/dist/src/vtab/memory/layer/manager.js +17 -13
  446. package/dist/src/vtab/memory/layer/manager.js.map +1 -1
  447. package/dist/src/vtab/module.d.ts +13 -7
  448. package/dist/src/vtab/module.d.ts.map +1 -1
  449. package/package.json +3 -3
  450. package/dist/src/planner/nodes/array-index-node.d.ts +0 -22
  451. package/dist/src/planner/nodes/array-index-node.d.ts.map +0 -1
  452. package/dist/src/planner/nodes/array-index-node.js +0 -41
  453. package/dist/src/planner/nodes/array-index-node.js.map +0 -1
  454. package/dist/src/runtime/emit/array-index.d.ts +0 -5
  455. package/dist/src/runtime/emit/array-index.d.ts.map +0 -1
  456. package/dist/src/runtime/emit/array-index.js +0 -22
  457. package/dist/src/runtime/emit/array-index.js.map +0 -1
@@ -1,8 +1,7 @@
1
1
  import type { ConstraintCheck } from '../planner/nodes/constraint-check-node.js';
2
2
  import type { RuntimeContext } from './types.js';
3
- import type { Row, OutputValue } from '../common/types.js';
3
+ import type { Row, SqlValue, OutputValue } from '../common/types.js';
4
4
  import type { RowConstraintSchema, TableSchema } from '../schema/table.js';
5
- import type { ColumnSchema } from '../schema/column.js';
6
5
  import type { RowDescriptor } from '../planner/nodes/plan-node.js';
7
6
  import { RowOpFlag } from '../schema/table.js';
8
7
  import { ConflictResolution } from '../common/constants.js';
@@ -37,18 +36,25 @@ export interface ConstraintMetadataEntry {
37
36
  kind: 'check' | 'fk-child' | 'fk-parent';
38
37
  /** For 'fk-parent' UPDATE checks: parent-table column indices the FK references. */
39
38
  referencedColumnIndices?: ReadonlyArray<number>;
39
+ /** Verbatim violation text carried from a synthesized {@link ConstraintCheck}
40
+ * (see {@link constraintViolationMessage}). */
41
+ violationMessage?: string;
42
+ /** Carried from {@link ConstraintCheck.messageValued}: the expression yields NULL when
43
+ * satisfied and the violation message when violated (see {@link constraintFailed}). */
44
+ messageValued?: boolean;
40
45
  }
41
46
  export interface NotNullDefaultRuntime {
42
47
  columnIndex: number;
43
48
  evaluator: (ctx: RuntimeContext) => OutputValue;
44
49
  /**
45
- * Set when the DEFAULT expression's static type is not the column's declared
46
- * type: the substituted value must then be converted before it is written
47
- * into the (already-converted) NEW section — the same static-type rule the
48
- * DML emitters applied to the rest of the row, which the substitution
49
- * bypasses by injecting a value after that pass.
50
+ * Converts the substituted value before it is written into the (already-converted)
51
+ * NEW section — the substitution injects a value AFTER the DML emitters' conversion
52
+ * pass, so it takes that pass's decision from the same helper
53
+ * ({@link import('../types/validation.js').buildCellCoercion}): convert unless the
54
+ * DEFAULT expression's static type IS the column's type AND the value already
55
+ * inhabits it. Unset only when there is provably nothing to do.
50
56
  */
51
- coerceColumn?: ColumnSchema;
57
+ coerce?: (value: SqlValue) => SqlValue;
52
58
  }
53
59
  /**
54
60
  * Result of evaluating constraints for a single row.
@@ -1 +1 @@
1
- {"version":3,"file":"row-constraints.d.ts","sourceRoot":"","sources":["../../../src/runtime/row-constraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAY,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,mB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AAsB,CAC3C,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,kBAAkB,EACzB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,uBAAuB,EAAE,EACnC,UAAU,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,cAAc,KAAK,WAAW,CAAC,EACvD,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,eAAe,EAAE,qBAAqB,EAAE,EACxC,UAAU,EAAE,GAAG,GAAG,SAAS,EAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
@@ -3,7 +3,6 @@ import { RowOpFlag } from '../schema/table.js';
3
3
  import { ConflictResolution } from '../common/constants.js';
4
4
  import { expressionToString } from '../emit/ast-stringify.js';
5
5
  import { sqlValueIdentical, isTruthy } from '../util/comparison.js';
6
- import { validateAndParse } from '../types/validation.js';
7
6
  /**
8
7
  * The violation message for a failing constraint — single source of truth for the
9
8
  * immediate (row-time) and deferred (commit-time) paths, which must report a row
@@ -13,11 +12,36 @@ import { validateAndParse } from '../types/validation.js';
13
12
  * "CHECK constraint failed" prefix for backward compatibility with existing
14
13
  * assertions; downstream consumers identify FK by name. The expression text is
15
14
  * appended as a hint only when short enough to stay readable.
15
+ *
16
+ * A synthesized check may override the whole text via `violationMessage` — the
17
+ * expression hint is engine-authored there, so quoting it back at the user
18
+ * explains nothing (see the absent-parent branch of `buildChildSideFKChecks`).
19
+ * Overrides keep the shared prefix themselves.
20
+ *
21
+ * A **message-valued** constraint (see {@link ConstraintMetadataEntry.messageValued})
22
+ * computed its own message as its evaluation result — `value` is that result,
23
+ * reported verbatim. The synthesizer bakes the per-rule text (each carrying the
24
+ * appropriate class prefix) into the expression, so nothing is derived here.
16
25
  */
17
- function constraintViolationMessage(metadata) {
26
+ function constraintViolationMessage(metadata, value) {
27
+ if (metadata.messageValued && value !== null && value !== undefined)
28
+ return String(value);
29
+ if (metadata.violationMessage)
30
+ return metadata.violationMessage;
18
31
  const exprHint = metadata.constraintExpr.length <= 60 ? ` (${metadata.constraintExpr})` : '';
19
32
  return `CHECK constraint failed: ${metadata.constraintName}${exprHint}`;
20
33
  }
34
+ /**
35
+ * Whether an evaluated constraint value is a violation. An ordinary CHECK
36
+ * passes if truthy or NULL (shared isTruthy semantics); a message-valued
37
+ * constraint inverts the test — it evaluates to NULL when satisfied and to the
38
+ * (non-NULL) violation message when violated.
39
+ */
40
+ function constraintFailed(metadata, result) {
41
+ return metadata.messageValued
42
+ ? result !== null && result !== undefined
43
+ : result !== null && !isTruthy(result);
44
+ }
21
45
  /**
22
46
  * Resolve the effective conflict action for a single failure.
23
47
  *
@@ -65,6 +89,8 @@ export function buildConstraintMetadata(checks, tableSchema, flatRowDescriptor,
65
89
  contextDescriptor,
66
90
  kind: check.kind ?? 'check',
67
91
  referencedColumnIndices: check.referencedColumnIndices,
92
+ violationMessage: check.violationMessage,
93
+ messageValued: check.messageValued,
68
94
  }));
69
95
  }
70
96
  /**
@@ -139,12 +165,11 @@ async function checkNotNullConstraints(rctx, scope, tableSchema, flatRow, stmtOR
139
165
  // DEFAULT itself is NULL — substitution does not satisfy NOT NULL.
140
166
  throw new ConstraintError(message);
141
167
  }
142
- if (defaultEntry.coerceColumn) {
168
+ if (defaultEntry.coerce) {
143
169
  // The substituted value is injected AFTER the emitters' conversion
144
- // pass, so convert it here by the same static-type rule. Conversion
145
- // itself can produce NULL (JSON's text 'null'), which still violates
146
- // NOT NULL.
147
- defaultValue = validateAndParse(defaultValue, defaultEntry.coerceColumn.logicalType, defaultEntry.coerceColumn.name);
170
+ // pass, so convert it here by the same rule. Conversion itself can
171
+ // produce NULL (JSON's text 'null'), which still violates NOT NULL.
172
+ defaultValue = defaultEntry.coerce(defaultValue);
148
173
  if (defaultValue === null) {
149
174
  throw new ConstraintError(message);
150
175
  }
@@ -202,17 +227,19 @@ async function checkCheckConstraints(rctx, scope, tableSchema, constraintMetadat
202
227
  // attributed message as the immediate path below, instead of the queue's
203
228
  // generic name-only fallback — matches the pattern derived-row-validator.ts
204
229
  // already uses for maintained tables. The wrapper always throws before
205
- // returning falsy, so the queue's own generic message never fires here.
230
+ // returning a failing value, so the queue's own generic message never fires
231
+ // here (a message-valued pass IS NULL, which the queue treats as a pass).
206
232
  // Only ABORT reaches this branch (see mustEvaluateNow), so throwing is the
207
233
  // whole of the deferred failure contract — no IGNORE/REPLACE leg needed.
208
- const message = constraintViolationMessage(metadata);
234
+ // The message is computed at evaluation time: a message-valued constraint's
235
+ // message IS its evaluated value, unknowable before commit.
209
236
  const deferredEvaluator = async (dctx) => {
210
237
  const rawResult = evaluator(dctx);
211
238
  const result = (rawResult instanceof Promise ? await rawResult : rawResult);
212
- if (result !== null && !isTruthy(result)) {
213
- throw new ConstraintError(message);
239
+ if (constraintFailed(metadata, result)) {
240
+ throw new ConstraintError(constraintViolationMessage(metadata, result));
214
241
  }
215
- return result;
242
+ return result ?? null;
216
243
  };
217
244
  rctx.db._queueDeferredConstraintRow(metadata.baseTable, metadata.constraintName, flatRow, metadata.flatRowDescriptor, deferredEvaluator, activeConnectionId, contextRow, metadata.contextDescriptor);
218
245
  continue;
@@ -220,9 +247,8 @@ async function checkCheckConstraints(rctx, scope, tableSchema, constraintMetadat
220
247
  // Resolve without a per-row microtask hop (see runtime/async-util.ts).
221
248
  const rawResult = evaluator(rctx);
222
249
  const result = (rawResult instanceof Promise ? await rawResult : rawResult);
223
- // CHECK passes if truthy or NULL; fails otherwise (shared isTruthy semantics).
224
- if (result !== null && !isTruthy(result)) {
225
- const baseMessage = constraintViolationMessage(metadata);
250
+ if (constraintFailed(metadata, result)) {
251
+ const baseMessage = constraintViolationMessage(metadata, result);
226
252
  if (effectiveAction === ConflictResolution.IGNORE) {
227
253
  return { skip: true };
228
254
  }
@@ -1 +1 @@
1
- {"version":3,"file":"row-constraints.js","sourceRoot":"","sources":["../../../src/runtime/row-constraints.ts"],"names":[],"mappings":"A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QAClC,MAAM,MAAM,GAAG,CAAC,SAAS,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,CAAa,CAAC;QAExF,IAAI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAEjE,IAAI,eAAe,KAAK,kBAAkB,CAAC,MAAM,EAAE,CAAC;gBACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YACvB,CAAC;YAED,uEAAuE;YACvE,iFAAiF;YACjF,IAAI,eAAe,KAAK,kBAAkB,CAAC,OAAO,EAAE,CAAC;gBACpD,MAAM,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;YACxC,CAAC;YAED,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { QuereusError } from '../common/errors.js';
2
- import { type DeepReadonly, type Row, type SqlValue } from '../common/types.js';
3
- import { type LogicalType } from '../types/logical-type.js';
2
+ import { type Row, type SqlValue } from '../common/types.js';
3
+ import { type DeclaredType } from '../types/representation.js';
4
4
  /**
5
5
  * Off-by-default physical-representation assertions (`QUEREUS_REPR_STRICT`).
6
6
  *
@@ -30,6 +30,12 @@ import { type LogicalType } from '../types/logical-type.js';
30
30
  * `null` is always admissible: nullability is `not null` constraint enforcement's
31
31
  * job and lives elsewhere.
32
32
  *
33
+ * R2's predicate itself lives one layer down, in `types/representation.ts`
34
+ * ({@link conformsToType}), because the DML write path needs the same answer: its
35
+ * static-type skip is guarded by "does the value actually inhabit the column's type"
36
+ * (see `buildCellCoercion` in `types/validation.ts`). This checker and that guard must
37
+ * never come to disagree about what conforms, so there is one definition.
38
+ *
33
39
  * **No capability flag.** A `representationFidelity` declaration on
34
40
  * `VirtualTableModule` was considered and rejected — nothing would BEHAVE differently
35
41
  * based on it, since the engine tolerates both numeric forms everywhere and will
@@ -41,11 +47,10 @@ import { type LogicalType } from '../types/logical-type.js';
41
47
  * nothing is built at emit time on this module's behalf.
42
48
  */
43
49
  /**
44
- * A declared type as this checker reads it. Only `name` and `physicalType` are
45
- * consulted, and the parameter is `DeepReadonly` so both a raw `LogicalType` (column
46
- * schema) and the frozen one a `ScalarType` carries are accepted without a cast.
50
+ * A declared type as this checker reads it. Defined alongside the R2 predicate in
51
+ * `types/representation.ts` and re-exported here for the checker's existing importers.
47
52
  */
48
- export type DeclaredType = DeepReadonly<LogicalType>;
53
+ export type { DeclaredType };
49
54
  /** A violation of R1/R2. Distinct class so a seam inside a re-wrapping `catch`
50
55
  * (the vtab scan) can rethrow it unchanged instead of burying it in a generic
51
56
  * "error during query" message. */
@@ -1 +1 @@
1
- {"version":3,"file":"strict-representation.d.ts","sourceRoot":"","sources":["../../../src/runtime/strict-representation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,YAAY,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAErD;;oCAEoC;AACpC,qBAAa,mBAAoB,SAAQ,YAAY;gBACxC,OAAO,EAAE,MAAM;CAK3B;AAiGD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAA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WN"}
@@ -1,6 +1,7 @@
1
1
  import { QuereusError } from '../common/errors.js';
2
2
  import { StatusCode } from '../common/types.js';
3
3
  import { PhysicalType } from '../types/logical-type.js';
4
+ import { conformsToType } from '../types/representation.js';
4
5
  import { isCanonicalNumeric } from '../util/numeric-canonical.js';
5
6
  import { valueToText } from '../util/value-text.js';
6
7
  /** A violation of R1/R2. Distinct class so a seam inside a re-wrapping `catch`
@@ -61,50 +62,6 @@ function admissibleForms(type) {
61
62
  default: return 'any value in canonical form';
62
63
  }
63
64
  }
64
- /**
65
- * R2 for one non-null value that has already passed R1.
66
- *
67
- * Keyed on `physicalType` rather than the type's identity so plugin-registered types
68
- * are covered too. Two arms need the type NAME as well:
69
- *
70
- * - **NUMERIC** shares REAL's `physicalType` (see the NOTE on `NUMERIC_TYPE` in
71
- * `types/builtin-types.ts`) but its value space includes `bigint`.
72
- * NOTE: matched by NAME, not by identity against the `NUMERIC_TYPE` singleton the way
73
- * `isSeekKeySpaceNumeric` matches, because the surrounding switch is deliberately keyed
74
- * on `physicalType` so plugin-registered types are covered. The cost is that a
75
- * plugin-registered REAL-physical type *named* `NUMERIC` would silently inherit
76
- * bigint admission. No such type exists in tree; if one is ever registered, give
77
- * `LogicalType` an explicit "admits bigint" property and switch on that instead.
78
- * - **`ANY`/NULL** (`PhysicalType.NULL`) impose no R2 constraint at all — R1 already
79
- * passed, and an `ANY` position may legitimately hold any storage class.
80
- *
81
- * TIMESTAMP needs no special case: it declares `physicalType` INTEGER because it IS an
82
- * integer instant, so it takes INTEGER's rule. The string temporals (DATE / TIME /
83
- * DATETIME / TIMESPAN) declare TEXT and take TEXT's — R2 must not demand a `Temporal`
84
- * object for them.
85
- */
86
- function conformsToType(value, type) {
87
- switch (type.physicalType) {
88
- case PhysicalType.INTEGER:
89
- return typeof value === 'bigint' || (typeof value === 'number' && Number.isSafeInteger(value));
90
- case PhysicalType.REAL:
91
- return typeof value === 'number' || (typeof value === 'bigint' && type.name === 'NUMERIC');
92
- case PhysicalType.TEXT:
93
- return typeof value === 'string';
94
- case PhysicalType.BLOB:
95
- return value instanceof Uint8Array;
96
- case PhysicalType.BOOLEAN:
97
- return typeof value === 'boolean';
98
- case PhysicalType.OBJECT:
99
- // Mirrors JSON_TYPE.validate: a native object/array (a blob is not one), or a
100
- // JSON scalar — a JSON string scalar is physically a plain `string`.
101
- return (typeof value === 'object' && !(value instanceof Uint8Array))
102
- || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
103
- default:
104
- // PhysicalType.NULL (ANY / NULL) and any unrecognized plugin code: R1 only.
105
- return true;
106
- }
107
- }
108
65
  const DOC_POINTER = 'See docs/types.md § Physical representation.';
109
66
  /**
110
67
  * R1 for one value: no `bigint` may hold a safe-range integer. Needs no declared type,
@@ -1 +1 @@
1
- {"version":3,"file":"strict-representation.js","sourceRoot":"","sources":["../../../src/runtime/strict-representation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAA8C,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAoB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAiDpD;;oCAEoC;AACpC,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IACpD,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;CACD;AAED,iFAAiF;AACjF,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAAC,KAAe;IACnC,IAAI,IAAY,CAAC;IACjB,I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AAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -3,7 +3,15 @@ import type { Database } from '../core/database.js';
3
3
  import type { Schema } from './schema.js';
4
4
  import { type ObjectReach } from './object-dependency-closure.js';
5
5
  export interface AssertionDependentTable {
6
- /** Instance-unique table reference key, e.g. schema.table#nodeId */
6
+ /**
7
+ * Instance-unique table reference key, e.g. `schema.table#nodeId`.
8
+ *
9
+ * Meaningful ONLY within one recorded list, where it tells two references to
10
+ * the same table apart (a self-join records two entries). The embedded node id
11
+ * comes from a process-wide counter over whichever plan produced the list, so
12
+ * it will never equal the key the commit-time evaluator computes for the same
13
+ * table — do not build a lookup that compares the two.
14
+ */
7
15
  relationKey: string;
8
16
  /** Base table identifier, e.g. schema.table */
9
17
  base: string;
@@ -19,7 +27,22 @@ export interface IntegrityAssertionSchema {
19
27
  deferrable: boolean;
20
28
  /** If true, initially deferred. Currently informational. */
21
29
  initiallyDeferred: boolean;
22
- /** Base tables referenced; filled during assertion preparation/creation. */
30
+ /**
31
+ * Base-table references in the body — informational only; it feeds
32
+ * `assertion_info().dependent_tables` and enforcement never reads it (the
33
+ * commit-time evaluator derives its own set when it compiles the body, from
34
+ * the same `planAssertionBodyForAnalysis` + `collectTableReferences` pair — see
35
+ * `planner/analysis/relation-key.ts`).
36
+ *
37
+ * NOTE: recorded once at CREATE, and after that only string-re-keyed by the
38
+ * `ALTER TABLE … RENAME` propagation — no other schema change re-derives it.
39
+ * It can therefore go stale where the body's plan shape depends on something
40
+ * other than the table names in its text (a view in the body redefined over
41
+ * different tables is the reachable case). Harmless while nothing but
42
+ * introspection reads it; the day a consumer needs it to be live, re-derive it
43
+ * on the schema-change events the evaluator already invalidates its cache on
44
+ * rather than adding another remap.
45
+ */
23
46
  dependentTables?: AssertionDependentTable[];
24
47
  /**
25
48
  * Original CHECK expression AST. Populated when the assertion is created
@@ -1 +1 @@
1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AAC,SAAS,CAAC,IAAI,GAAG;QAC7B,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC;AACrD,CAAC;AAQD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,SAAS,CAAC,CAAC,+BAA+B,CAC/C,EAAY,EACZ,cAAsB;IAEtB,MAAM,SAAS,GAAG,0BAA0B,CAAC,EAAE,CAAC,CAAC;IACjD,KAAK,MAAM,KAAK,IAAI,yBAAyB,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC;QACnE,yEAAyE;QACzE,2EAA2E;QAC3E,qEAAqE;QACrE,oEAAoE;QACpE,6DAA6D;QAC7D,yEAAyE;QACzE,8EAA8E;QAC9E,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;IACnF,CAAC;AACF,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { SchemaCatalog } from './catalog.js';
2
+ /**
3
+ * Canonical text rendering of a {@link SchemaCatalog}, for the `apply schema`
4
+ * applied-state snapshot (see `docs/schema.md` § Applied-state snapshot).
5
+ *
6
+ * The rendering exists to answer exactly one question: *is this catalog, field
7
+ * for field, the one that was in place at the end of the last successful,
8
+ * no-op `apply schema`?* Two catalogs that render to the same string must be
9
+ * indistinguishable to `computeSchemaDiff`. It is deliberately NOT a
10
+ * hash — an exact string compare is both cheaper (measured 0.003–0.008 ms vs
11
+ * 1.46 ms to FNV-1a hash 119 KB of rendered text) and carries no hash-collision
12
+ * risk.
13
+ *
14
+ * NOTE: the *encoding* is not provably injective, though. Fields and items are
15
+ * separated by literal spaces / tabs / newlines, and a leaf value can contain
16
+ * any of them — a tag value or a DEFAULT holding a raw newline reaches the
17
+ * output verbatim (via `sqlValueToLiteral` / `expressionToString`, and via the
18
+ * `ddl` text that embeds the same literal). So a value crafted to imitate the
19
+ * rendering of a *different* catalog item makes two distinct catalogs render
20
+ * alike, and an out-of-band change between exactly those two catalogs would be
21
+ * skipped. It takes deliberately hostile tag/DEFAULT text to build one, so it is
22
+ * left open; the fix that retires the class is a uniquely-decodable encoding
23
+ * (JSON-frame each part instead of joining on separators — measured ~+0.25 ms on
24
+ * the 308.8 KB rendering of `bench/apply-schema-unchanged.mjs 30`, against a
25
+ * 1.50 ms fast-pathed apply). See `tickets/backlog/debt-catalog-rendering-injective-encoding`.
26
+ *
27
+ * It is also NOT the schema *version* hash. `computeSchemaHash` strips tags
28
+ * before hashing, because tags must not affect versioning; the differ, by
29
+ * contrast, DOES diff tags and emits `SET TAGS` steps for them. So this
30
+ * rendering is tags-inclusive and the two must never be conflated.
31
+ *
32
+ * Every arm destructures **every** field of its catalog interface and hands the
33
+ * rest to {@link assertEveryFieldConsidered}, so a new field on any catalog
34
+ * interface fails the build here until someone decides whether it belongs in
35
+ * the comparison.
36
+ */
37
+ export declare function renderCatalogForComparison(catalog: SchemaCatalog): string;
38
+ //# sourceMappingURL=catalog-rendering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-rendering.d.ts","sourceRoot":"","sources":["../../../src/schema/catalog-rendering.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAA6D,MAAM,cAAc,CAAC;AAE7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAYzE"}
@@ -0,0 +1,171 @@
1
+ import { expressionToString } from '../emit/ast-stringify.js';
2
+ import { sqlValueToLiteral } from '../util/sql-literal.js';
3
+ /**
4
+ * Canonical text rendering of a {@link SchemaCatalog}, for the `apply schema`
5
+ * applied-state snapshot (see `docs/schema.md` § Applied-state snapshot).
6
+ *
7
+ * The rendering exists to answer exactly one question: *is this catalog, field
8
+ * for field, the one that was in place at the end of the last successful,
9
+ * no-op `apply schema`?* Two catalogs that render to the same string must be
10
+ * indistinguishable to `computeSchemaDiff`. It is deliberately NOT a
11
+ * hash — an exact string compare is both cheaper (measured 0.003–0.008 ms vs
12
+ * 1.46 ms to FNV-1a hash 119 KB of rendered text) and carries no hash-collision
13
+ * risk.
14
+ *
15
+ * NOTE: the *encoding* is not provably injective, though. Fields and items are
16
+ * separated by literal spaces / tabs / newlines, and a leaf value can contain
17
+ * any of them — a tag value or a DEFAULT holding a raw newline reaches the
18
+ * output verbatim (via `sqlValueToLiteral` / `expressionToString`, and via the
19
+ * `ddl` text that embeds the same literal). So a value crafted to imitate the
20
+ * rendering of a *different* catalog item makes two distinct catalogs render
21
+ * alike, and an out-of-band change between exactly those two catalogs would be
22
+ * skipped. It takes deliberately hostile tag/DEFAULT text to build one, so it is
23
+ * left open; the fix that retires the class is a uniquely-decodable encoding
24
+ * (JSON-frame each part instead of joining on separators — measured ~+0.25 ms on
25
+ * the 308.8 KB rendering of `bench/apply-schema-unchanged.mjs 30`, against a
26
+ * 1.50 ms fast-pathed apply). See `tickets/backlog/debt-catalog-rendering-injective-encoding`.
27
+ *
28
+ * It is also NOT the schema *version* hash. `computeSchemaHash` strips tags
29
+ * before hashing, because tags must not affect versioning; the differ, by
30
+ * contrast, DOES diff tags and emits `SET TAGS` steps for them. So this
31
+ * rendering is tags-inclusive and the two must never be conflated.
32
+ *
33
+ * Every arm destructures **every** field of its catalog interface and hands the
34
+ * rest to {@link assertEveryFieldConsidered}, so a new field on any catalog
35
+ * interface fails the build here until someone decides whether it belongs in
36
+ * the comparison.
37
+ */
38
+ export function renderCatalogForComparison(catalog) {
39
+ const { schemaName, tables, views, indexes, assertions, ...rest } = catalog;
40
+ assertEveryFieldConsidered(rest);
41
+ return [
42
+ // Lowercased: the snapshot is keyed by lowercased schema name, so
43
+ // `apply schema MyApp` and `apply schema myapp` must render alike.
44
+ `schema ${schemaName.toLowerCase()}`,
45
+ ...sortedRenderings(tables, renderTable),
46
+ ...sortedRenderings(views, renderView),
47
+ ...sortedRenderings(indexes, renderIndex),
48
+ ...sortedRenderings(assertions, renderAssertion),
49
+ ].join('\n');
50
+ }
51
+ /**
52
+ * Compile error if a catalog interface grows a field this renderer does not
53
+ * consider. The rest object of an exhaustive destructure is `{}`, which is
54
+ * assignable to `Record<string, never>`; one left-over field of any other type
55
+ * is not.
56
+ */
57
+ function assertEveryFieldConsidered(_leftover) { }
58
+ /**
59
+ * Renders every item and sorts the RESULTS, so a drop+recreate that only changes
60
+ * the live `Map` insertion order produces no spurious mismatch. Sorting the
61
+ * rendered strings (rather than the items by name) also keeps two objects that
62
+ * legitimately share a name — an index name is unique per *table*, not per
63
+ * schema — in a stable order without needing a composite sort key.
64
+ */
65
+ function sortedRenderings(items, render) {
66
+ return items.map(render).sort();
67
+ }
68
+ function renderTable(t) {
69
+ const { name, ddl, columns, primaryKey, referencedTables, tags, namedConstraints, maintained, ...rest } = t;
70
+ assertEveryFieldConsidered(rest);
71
+ return [
72
+ `table ${name}`,
73
+ // `ddl` is deliberately redundant with the structured fields below: it costs
74
+ // nothing extra (it is already computed by `collectSchemaCatalog`) and removes
75
+ // any need to argue about what `generateTableDDL` does or does not render.
76
+ `\tddl ${ddl}`,
77
+ // Column ORDER is behavioural — never sorted.
78
+ ...columns.map(c => `\t${renderColumn(c)}`),
79
+ `\tpk ${primaryKey.map(pk => `${pk.columnName} ${pk.desc ? 'desc' : 'asc'}`).join(', ')}`,
80
+ // Sorted: only feeds the differ's drop ORDERING, which is inert on an empty diff.
81
+ `\trefs ${[...referencedTables].sort().join(', ')}`,
82
+ `\ttags ${renderTags(tags)}`,
83
+ // Sorted: the differ keys named constraints by name, so their order carries no meaning.
84
+ ...sortedRenderings(namedConstraints, renderNamedConstraint).map(s => `\t${s}`),
85
+ `\tmaintained ${maintained ? renderMaintained(maintained) : '-'}`,
86
+ ].join('\n');
87
+ }
88
+ function renderColumn(c) {
89
+ const { name, type, notNull, primaryKey, defaultValue, collation, tags, ...rest } = c;
90
+ assertEveryFieldConsidered(rest);
91
+ return `column ${name} ${type} ${notNull ? 'not null' : 'null'} ${primaryKey ? 'pk' : '-'}`
92
+ // `defaultValue` is an `AST.Expression`; rendered with the same
93
+ // `expressionToString` the catalog itself uses for DEFAULT text. Measured at
94
+ // 0.140 ms of a 0.871 ms whole-catalog render on the 112.7 KB / 54-table ×
95
+ // 38-column declaration of `bench/apply-schema-unchanged.mjs` (median of 15),
96
+ // against the 4.35 ms `computeSchemaDiff` the whole render replaces — so
97
+ // keeping it costs nothing worth trading for leaning on `ddl` alone.
98
+ + ` default ${defaultValue ? expressionToString(defaultValue) : '-'}`
99
+ + ` collate ${collation} tags ${renderTags(tags)}`;
100
+ }
101
+ function renderNamedConstraint(c) {
102
+ const { name, tags, definition, ...rest } = c;
103
+ assertEveryFieldConsidered(rest);
104
+ return `constraint ${name} ${definition} tags ${renderTags(tags)}`;
105
+ }
106
+ function renderMaintained(m) {
107
+ // `select` (the live derivation body AST) is deliberately NOT rendered: the
108
+ // differ compares `bodyHash` first and only walks the AST when that comparison
109
+ // FAILS, to tolerate rename artifacts (schema-differ.ts § maintained-table
110
+ // compare). This rendering only ever fires the fast path when every hash
111
+ // matches, so the AST-tolerant path is unreachable and the hash fully
112
+ // determines the outcome.
113
+ const { bodyHash, backingModuleName, backingModuleArgs, select: _select, ...rest } = m;
114
+ assertEveryFieldConsidered(rest);
115
+ return `body ${bodyHash} module ${backingModuleName ?? '-'} args ${renderTags(backingModuleArgs)}`;
116
+ }
117
+ function renderView(v) {
118
+ // `select` omitted for the same reason as `CatalogTable.maintained.select`:
119
+ // the differ consults it only when `definition` already differs.
120
+ const { name, ddl, definition, tags, select: _select, ...rest } = v;
121
+ assertEveryFieldConsidered(rest);
122
+ return `view ${name}\n\tddl ${ddl}\n\tdef ${definition}\n\ttags ${renderTags(tags)}`;
123
+ }
124
+ function renderIndex(x) {
125
+ const { name, tableName, ddl, definition, tags, implicit, ...rest } = x;
126
+ assertEveryFieldConsidered(rest);
127
+ return `index ${name} on ${tableName}${implicit ? ' implicit' : ''}\n\tddl ${ddl}\n\tdef ${definition}\n\ttags ${renderTags(tags)}`;
128
+ }
129
+ function renderAssertion(a) {
130
+ // `check` omitted for the same reason as `CatalogView.select`.
131
+ const { name, ddl, definition, check: _check, ...rest } = a;
132
+ assertEveryFieldConsidered(rest);
133
+ return `assertion ${name}\n\tddl ${ddl}\n\tdef ${definition}`;
134
+ }
135
+ /**
136
+ * Order-independent rendering of a tag set. Keys are sorted and an empty set
137
+ * renders as an absent one, matching the differ's own tag comparison
138
+ * (`tagsDrifted`, which stable-stringifies both sides).
139
+ *
140
+ * The rename-hint keys (`quereus.id` / `quereus.previous_name`) that the differ
141
+ * excludes from drift comparison ARE rendered here. A hint-only change therefore
142
+ * costs one extra full reconcile — the safe direction, and cheaper than keeping
143
+ * a second copy of the differ's exclusion list in sync.
144
+ */
145
+ function renderTags(tags) {
146
+ if (!tags)
147
+ return '-';
148
+ const keys = Object.keys(tags).sort();
149
+ if (keys.length === 0)
150
+ return '-';
151
+ return `(${keys.map(k => `${JSON.stringify(k)}=${renderTagValue(tags[k])}`).join(', ')})`;
152
+ }
153
+ /**
154
+ * A tag value as a SQL literal, prefixed with a one-character type tag.
155
+ *
156
+ * The prefix is what makes the encoding injective: `sqlValueToLiteral` renders a
157
+ * JSON value as its quoted JSON text, which is byte-identical to what it renders
158
+ * for a *string* holding that same text. Without the discriminator, a tag flipping
159
+ * between `{"a":1}` and `'{"a":1}'` would render unchanged and be skipped.
160
+ */
161
+ function renderTagValue(v) {
162
+ const kind = v === null ? 'n' :
163
+ typeof v === 'string' ? 's' :
164
+ typeof v === 'number' ? 'f' :
165
+ typeof v === 'bigint' ? 'i' :
166
+ typeof v === 'boolean' ? 'b' :
167
+ v instanceof Uint8Array ? 'x' :
168
+ 'j';
169
+ return kind + sqlValueToLiteral(v);
170
+ }
171
+ //# sourceMappingURL=catalog-rendering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-rendering.js","sourceRoot":"","sources":["../../../src/schema/catalog-rendering.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAsB;IAChE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC5E,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO;QACN,kEAAkE;QAClE,mEAAmE;QACnE,UAAU,UAAU,CAAC,WAAW,EAAE,EAAE;QACpC,GAAG,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC;QACxC,GAAG,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC;QACtC,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC;QACzC,GAAG,gBAAgB,CAAC,UAAU,EAAE,eAAe,CAAC;KAChD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAS,0BAA0B,CAAC,SAAgC,IAAgC,CAAC;AAErG;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAI,KAAmB,EAAE,MAA2B;IAC5E,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,WAAW,CAAC,CAAe;IACnC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,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