pipework 0.8.1 → 0.8.4

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 (362) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/async/jobs/execute.d.ts +2 -0
  3. package/dist/async/jobs/execute.d.ts.map +1 -1
  4. package/dist/async/jobs/execute.js +17 -2
  5. package/dist/async/jobs/execute.js.map +1 -1
  6. package/dist/audit/query/cursor.d.ts +7 -0
  7. package/dist/audit/query/cursor.d.ts.map +1 -0
  8. package/dist/audit/query/cursor.js +25 -0
  9. package/dist/audit/query/cursor.js.map +1 -0
  10. package/dist/audit/query/index.d.ts +5 -0
  11. package/dist/audit/query/index.d.ts.map +1 -0
  12. package/dist/audit/query/index.js +3 -0
  13. package/dist/audit/query/index.js.map +1 -0
  14. package/dist/audit/query/query.d.ts +49 -0
  15. package/dist/audit/query/query.d.ts.map +1 -0
  16. package/dist/audit/query/query.js +119 -0
  17. package/dist/audit/query/query.js.map +1 -0
  18. package/dist/audit/schema/audit-record-fields.d.ts +15 -0
  19. package/dist/audit/schema/audit-record-fields.d.ts.map +1 -0
  20. package/dist/audit/schema/audit-record-fields.js +50 -0
  21. package/dist/audit/schema/audit-record-fields.js.map +1 -0
  22. package/dist/audit/schema/audit-record.d.ts +15 -0
  23. package/dist/audit/schema/audit-record.d.ts.map +1 -0
  24. package/dist/audit/schema/audit-record.js +12 -0
  25. package/dist/audit/schema/audit-record.js.map +1 -0
  26. package/dist/auth/tenant/scope.js +1 -1
  27. package/dist/auth/tenant/scope.js.map +1 -1
  28. package/dist/auth/tenant/scoped-db.d.ts.map +1 -1
  29. package/dist/auth/tenant/scoped-db.js +1 -2
  30. package/dist/auth/tenant/scoped-db.js.map +1 -1
  31. package/dist/cli/commands/check.d.ts +4 -0
  32. package/dist/cli/commands/check.d.ts.map +1 -1
  33. package/dist/cli/commands/check.js +187 -15
  34. package/dist/cli/commands/check.js.map +1 -1
  35. package/dist/cli/commands/codemod.d.ts +6 -0
  36. package/dist/cli/commands/codemod.d.ts.map +1 -0
  37. package/dist/cli/commands/codemod.js +63 -0
  38. package/dist/cli/commands/codemod.js.map +1 -0
  39. package/dist/cli/index.d.ts.map +1 -1
  40. package/dist/cli/index.js +9 -0
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/core/config/load.d.ts +23 -0
  43. package/dist/core/config/load.d.ts.map +1 -1
  44. package/dist/core/config/load.js +8 -0
  45. package/dist/core/config/load.js.map +1 -1
  46. package/dist/core/config/namespace.d.ts +19 -0
  47. package/dist/core/config/namespace.d.ts.map +1 -1
  48. package/dist/core/config/schema.d.ts +41 -0
  49. package/dist/core/config/schema.d.ts.map +1 -1
  50. package/dist/core/config/schema.js +27 -0
  51. package/dist/core/config/schema.js.map +1 -1
  52. package/dist/core/logging/logger.d.ts +3 -1
  53. package/dist/core/logging/logger.d.ts.map +1 -1
  54. package/dist/core/logging/logger.js +2 -2
  55. package/dist/core/logging/logger.js.map +1 -1
  56. package/dist/core/pipework.d.ts +2 -2
  57. package/dist/core/pipework.d.ts.map +1 -1
  58. package/dist/data/db/bulk-set.js +1 -1
  59. package/dist/data/db/bulk-set.js.map +1 -1
  60. package/dist/data/db/composed.js +1 -1
  61. package/dist/data/db/composed.js.map +1 -1
  62. package/dist/data/db/db.d.ts +10 -0
  63. package/dist/data/db/db.d.ts.map +1 -1
  64. package/dist/data/db/db.js +12 -0
  65. package/dist/data/db/db.js.map +1 -1
  66. package/dist/data/db/filter.d.ts +42 -43
  67. package/dist/data/db/filter.d.ts.map +1 -1
  68. package/dist/data/db/filter.js +7 -6
  69. package/dist/data/db/filter.js.map +1 -1
  70. package/dist/data/db/namespace.d.ts +90 -82
  71. package/dist/data/db/namespace.d.ts.map +1 -1
  72. package/dist/data/db/namespace.js +21 -5
  73. package/dist/data/db/namespace.js.map +1 -1
  74. package/dist/data/migrate/post-process.d.ts +2 -1
  75. package/dist/data/migrate/post-process.d.ts.map +1 -1
  76. package/dist/data/migrate/post-process.js +2 -1
  77. package/dist/data/migrate/post-process.js.map +1 -1
  78. package/dist/data/temporal/definition-queries.js +1 -1
  79. package/dist/data/temporal/definition-queries.js.map +1 -1
  80. package/dist/data/temporal/query.js +1 -1
  81. package/dist/data/temporal/query.js.map +1 -1
  82. package/dist/data/temporal/resolve.js +1 -1
  83. package/dist/data/temporal/resolve.js.map +1 -1
  84. package/dist/data/write/audit/actor.d.ts +3 -0
  85. package/dist/data/write/audit/actor.d.ts.map +1 -0
  86. package/dist/data/write/audit/actor.js +15 -0
  87. package/dist/data/write/audit/actor.js.map +1 -0
  88. package/dist/data/write/audit/audit-columns.d.ts +6 -0
  89. package/dist/data/write/audit/audit-columns.d.ts.map +1 -0
  90. package/dist/data/write/audit/audit-columns.js +15 -0
  91. package/dist/data/write/audit/audit-columns.js.map +1 -0
  92. package/dist/data/write/audit/audit-select.d.ts +28 -0
  93. package/dist/data/write/audit/audit-select.d.ts.map +1 -0
  94. package/dist/data/write/audit/audit-select.js +49 -0
  95. package/dist/data/write/audit/audit-select.js.map +1 -0
  96. package/dist/data/write/audit/cte-compile.d.ts +7 -0
  97. package/dist/data/write/audit/cte-compile.d.ts.map +1 -0
  98. package/dist/data/write/audit/cte-compile.js +23 -0
  99. package/dist/data/write/audit/cte-compile.js.map +1 -0
  100. package/dist/data/write/audit/final-select.d.ts +4 -0
  101. package/dist/data/write/audit/final-select.d.ts.map +1 -0
  102. package/dist/data/write/audit/final-select.js +28 -0
  103. package/dist/data/write/audit/final-select.js.map +1 -0
  104. package/dist/data/write/audit/primary-key.d.ts +7 -0
  105. package/dist/data/write/audit/primary-key.d.ts.map +1 -0
  106. package/dist/data/write/audit/primary-key.js +32 -0
  107. package/dist/data/write/audit/primary-key.js.map +1 -0
  108. package/dist/data/write/audit/projection.d.ts +11 -0
  109. package/dist/data/write/audit/projection.d.ts.map +1 -0
  110. package/dist/data/write/audit/projection.js +37 -0
  111. package/dist/data/write/audit/projection.js.map +1 -0
  112. package/dist/data/write/audit/read-touches.d.ts +10 -0
  113. package/dist/data/write/audit/read-touches.d.ts.map +1 -0
  114. package/dist/data/write/audit/read-touches.js +63 -0
  115. package/dist/data/write/audit/read-touches.js.map +1 -0
  116. package/dist/data/write/audit/verb-delete.d.ts +7 -0
  117. package/dist/data/write/audit/verb-delete.d.ts.map +1 -0
  118. package/dist/data/write/audit/verb-delete.js +53 -0
  119. package/dist/data/write/audit/verb-delete.js.map +1 -0
  120. package/dist/data/write/audit/verb-insert.d.ts +7 -0
  121. package/dist/data/write/audit/verb-insert.d.ts.map +1 -0
  122. package/dist/data/write/audit/verb-insert.js +28 -0
  123. package/dist/data/write/audit/verb-insert.js.map +1 -0
  124. package/dist/data/write/audit/verb-update.d.ts +7 -0
  125. package/dist/data/write/audit/verb-update.d.ts.map +1 -0
  126. package/dist/data/write/audit/verb-update.js +52 -0
  127. package/dist/data/write/audit/verb-update.js.map +1 -0
  128. package/dist/data/write/audit/verb-upsert.d.ts +7 -0
  129. package/dist/data/write/audit/verb-upsert.d.ts.map +1 -0
  130. package/dist/data/write/audit/verb-upsert.js +81 -0
  131. package/dist/data/write/audit/verb-upsert.js.map +1 -0
  132. package/dist/data/write/delete.d.ts +15 -0
  133. package/dist/data/write/delete.d.ts.map +1 -0
  134. package/dist/data/write/delete.js +25 -0
  135. package/dist/data/write/delete.js.map +1 -0
  136. package/dist/data/write/execute.d.ts +3 -0
  137. package/dist/data/write/execute.d.ts.map +1 -0
  138. package/dist/data/write/execute.js +162 -0
  139. package/dist/data/write/execute.js.map +1 -0
  140. package/dist/data/write/index.d.ts +6 -0
  141. package/dist/data/write/index.d.ts.map +1 -0
  142. package/dist/data/write/index.js +10 -0
  143. package/dist/data/write/index.js.map +1 -0
  144. package/dist/data/write/insert.d.ts +18 -0
  145. package/dist/data/write/insert.d.ts.map +1 -0
  146. package/dist/data/write/insert.js +29 -0
  147. package/dist/data/write/insert.js.map +1 -0
  148. package/dist/data/write/state.d.ts +29 -0
  149. package/dist/data/write/state.d.ts.map +1 -0
  150. package/dist/data/write/state.js +9 -0
  151. package/dist/data/write/state.js.map +1 -0
  152. package/dist/data/write/update.d.ts +17 -0
  153. package/dist/data/write/update.d.ts.map +1 -0
  154. package/dist/data/write/update.js +39 -0
  155. package/dist/data/write/update.js.map +1 -0
  156. package/dist/data/write/upsert.d.ts +21 -0
  157. package/dist/data/write/upsert.d.ts.map +1 -0
  158. package/dist/data/write/upsert.js +42 -0
  159. package/dist/data/write/upsert.js.map +1 -0
  160. package/dist/index.d.ts +3 -0
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +1 -0
  163. package/dist/index.js.map +1 -1
  164. package/dist/infra/audit/namespace.d.ts +3 -0
  165. package/dist/infra/audit/namespace.d.ts.map +1 -1
  166. package/dist/infra/audit/namespace.js +3 -0
  167. package/dist/infra/audit/namespace.js.map +1 -1
  168. package/dist/lint/config.d.ts +4 -2
  169. package/dist/lint/config.d.ts.map +1 -1
  170. package/dist/lint/config.js +9 -5
  171. package/dist/lint/config.js.map +1 -1
  172. package/dist/lint/index.d.ts +2 -1
  173. package/dist/lint/index.d.ts.map +1 -1
  174. package/dist/lint/index.js +1 -0
  175. package/dist/lint/index.js.map +1 -1
  176. package/dist/lint/resolver.d.ts +16 -0
  177. package/dist/lint/resolver.d.ts.map +1 -0
  178. package/dist/lint/resolver.js +61 -0
  179. package/dist/lint/resolver.js.map +1 -0
  180. package/dist/request/context/create.d.ts +4 -0
  181. package/dist/request/context/create.d.ts.map +1 -1
  182. package/dist/request/context/create.js +3 -0
  183. package/dist/request/context/create.js.map +1 -1
  184. package/dist/request/context/types.d.ts +3 -0
  185. package/dist/request/context/types.d.ts.map +1 -1
  186. package/dist/request/http/middleware.d.ts.map +1 -1
  187. package/dist/request/http/middleware.js +30 -0
  188. package/dist/request/http/middleware.js.map +1 -1
  189. package/dist/request/http/server.d.ts.map +1 -1
  190. package/dist/request/http/server.js +6 -1
  191. package/dist/request/http/server.js.map +1 -1
  192. package/dist/test/context.d.ts.map +1 -1
  193. package/dist/test/context.js +43 -2
  194. package/dist/test/context.js.map +1 -1
  195. package/dist/test/index.d.ts +1 -1
  196. package/dist/test/index.d.ts.map +1 -1
  197. package/dist/test/index.js +1 -1
  198. package/dist/test/index.js.map +1 -1
  199. package/dist/test/vitest-workspace.d.ts +15 -2
  200. package/dist/test/vitest-workspace.d.ts.map +1 -1
  201. package/dist/test/vitest-workspace.js +60 -7
  202. package/dist/test/vitest-workspace.js.map +1 -1
  203. package/dist/trace/cardinality/analyze.d.ts +26 -0
  204. package/dist/trace/cardinality/analyze.d.ts.map +1 -0
  205. package/dist/trace/cardinality/analyze.js +129 -0
  206. package/dist/trace/cardinality/analyze.js.map +1 -0
  207. package/dist/trace/cardinality/branch-context.d.ts +13 -0
  208. package/dist/trace/cardinality/branch-context.d.ts.map +1 -0
  209. package/dist/trace/cardinality/branch-context.js +182 -0
  210. package/dist/trace/cardinality/branch-context.js.map +1 -0
  211. package/dist/trace/cardinality/check.d.ts +4 -0
  212. package/dist/trace/cardinality/check.d.ts.map +1 -0
  213. package/dist/trace/cardinality/check.js +29 -0
  214. package/dist/trace/cardinality/check.js.map +1 -0
  215. package/dist/trace/cardinality/classify-edge.d.ts +31 -0
  216. package/dist/trace/cardinality/classify-edge.d.ts.map +1 -0
  217. package/dist/trace/cardinality/classify-edge.js +27 -0
  218. package/dist/trace/cardinality/classify-edge.js.map +1 -0
  219. package/dist/trace/cardinality/structural-max.d.ts +14 -0
  220. package/dist/trace/cardinality/structural-max.d.ts.map +1 -0
  221. package/dist/trace/cardinality/structural-max.js +83 -0
  222. package/dist/trace/cardinality/structural-max.js.map +1 -0
  223. package/dist/trace/check/coverage-check.d.ts +20 -0
  224. package/dist/trace/check/coverage-check.d.ts.map +1 -0
  225. package/dist/trace/check/coverage-check.js +146 -0
  226. package/dist/trace/check/coverage-check.js.map +1 -0
  227. package/dist/trace/check/flow-check.d.ts +13 -0
  228. package/dist/trace/check/flow-check.d.ts.map +1 -0
  229. package/dist/trace/check/flow-check.js +82 -0
  230. package/dist/trace/check/flow-check.js.map +1 -0
  231. package/dist/trace/check/flow-step-site.d.ts +62 -0
  232. package/dist/trace/check/flow-step-site.d.ts.map +1 -0
  233. package/dist/trace/check/flow-step-site.js +142 -0
  234. package/dist/trace/check/flow-step-site.js.map +1 -0
  235. package/dist/trace/check/io-pattern.d.ts +14 -0
  236. package/dist/trace/check/io-pattern.d.ts.map +1 -0
  237. package/dist/trace/check/io-pattern.js +113 -0
  238. package/dist/trace/check/io-pattern.js.map +1 -0
  239. package/dist/trace/codemod/add-cardinality.d.ts +38 -0
  240. package/dist/trace/codemod/add-cardinality.d.ts.map +1 -0
  241. package/dist/trace/codemod/add-cardinality.js +106 -0
  242. package/dist/trace/codemod/add-cardinality.js.map +1 -0
  243. package/dist/trace/codemod/run.d.ts +25 -0
  244. package/dist/trace/codemod/run.d.ts.map +1 -0
  245. package/dist/trace/codemod/run.js +47 -0
  246. package/dist/trace/codemod/run.js.map +1 -0
  247. package/dist/trace/entry/close-trace.d.ts +7 -0
  248. package/dist/trace/entry/close-trace.d.ts.map +1 -0
  249. package/dist/trace/entry/close-trace.js +54 -0
  250. package/dist/trace/entry/close-trace.js.map +1 -0
  251. package/dist/trace/entry/finalize-trace.d.ts +5 -0
  252. package/dist/trace/entry/finalize-trace.d.ts.map +1 -0
  253. package/dist/trace/entry/finalize-trace.js +23 -0
  254. package/dist/trace/entry/finalize-trace.js.map +1 -0
  255. package/dist/trace/entry/open-trace.d.ts +26 -0
  256. package/dist/trace/entry/open-trace.d.ts.map +1 -0
  257. package/dist/trace/entry/open-trace.js +75 -0
  258. package/dist/trace/entry/open-trace.js.map +1 -0
  259. package/dist/trace/entry/parent-trace.d.ts +4 -0
  260. package/dist/trace/entry/parent-trace.d.ts.map +1 -0
  261. package/dist/trace/entry/parent-trace.js +10 -0
  262. package/dist/trace/entry/parent-trace.js.map +1 -0
  263. package/dist/trace/entry/parse-traceparent.d.ts +8 -0
  264. package/dist/trace/entry/parse-traceparent.d.ts.map +1 -0
  265. package/dist/trace/entry/parse-traceparent.js +37 -0
  266. package/dist/trace/entry/parse-traceparent.js.map +1 -0
  267. package/dist/trace/entry/trace-context.d.ts +19 -0
  268. package/dist/trace/entry/trace-context.d.ts.map +1 -0
  269. package/dist/trace/entry/trace-context.js +5 -0
  270. package/dist/trace/entry/trace-context.js.map +1 -0
  271. package/dist/trace/entry/tracing-enabled.d.ts +4 -0
  272. package/dist/trace/entry/tracing-enabled.d.ts.map +1 -0
  273. package/dist/trace/entry/tracing-enabled.js +8 -0
  274. package/dist/trace/entry/tracing-enabled.js.map +1 -0
  275. package/dist/trace/partition/plan.d.ts +2 -0
  276. package/dist/trace/partition/plan.d.ts.map +1 -1
  277. package/dist/trace/partition/plan.js +8 -1
  278. package/dist/trace/partition/plan.js.map +1 -1
  279. package/dist/trace/partition/schedule.d.ts.map +1 -1
  280. package/dist/trace/partition/schedule.js +6 -4
  281. package/dist/trace/partition/schedule.js.map +1 -1
  282. package/dist/trace/partition/startup-hook.d.ts.map +1 -1
  283. package/dist/trace/partition/startup-hook.js +6 -2
  284. package/dist/trace/partition/startup-hook.js.map +1 -1
  285. package/dist/trace/partition/tables.d.ts +1 -1
  286. package/dist/trace/partition/tables.d.ts.map +1 -1
  287. package/dist/trace/partition/tables.js +13 -5
  288. package/dist/trace/partition/tables.js.map +1 -1
  289. package/dist/trace/runtime/expire-stale-traces.d.ts +10 -0
  290. package/dist/trace/runtime/expire-stale-traces.d.ts.map +1 -0
  291. package/dist/trace/runtime/expire-stale-traces.js +36 -0
  292. package/dist/trace/runtime/expire-stale-traces.js.map +1 -0
  293. package/dist/trace/runtime/flow-step.d.ts +6 -0
  294. package/dist/trace/runtime/flow-step.d.ts.map +1 -0
  295. package/dist/trace/runtime/flow-step.js +122 -0
  296. package/dist/trace/runtime/flow-step.js.map +1 -0
  297. package/dist/trace/runtime/flush-steps.d.ts +5 -0
  298. package/dist/trace/runtime/flush-steps.d.ts.map +1 -0
  299. package/dist/trace/runtime/flush-steps.js +23 -0
  300. package/dist/trace/runtime/flush-steps.js.map +1 -0
  301. package/dist/trace/runtime/step-buffer.d.ts +139 -0
  302. package/dist/trace/runtime/step-buffer.d.ts.map +1 -0
  303. package/dist/trace/runtime/step-buffer.js +140 -0
  304. package/dist/trace/runtime/step-buffer.js.map +1 -0
  305. package/dist/trace/runtime/step-error.d.ts +8 -0
  306. package/dist/trace/runtime/step-error.d.ts.map +1 -0
  307. package/dist/trace/runtime/step-error.js +13 -0
  308. package/dist/trace/runtime/step-error.js.map +1 -0
  309. package/dist/trace/runtime/step-meta.d.ts +48 -0
  310. package/dist/trace/runtime/step-meta.d.ts.map +1 -0
  311. package/dist/trace/runtime/step-meta.js +6 -0
  312. package/dist/trace/runtime/step-meta.js.map +1 -0
  313. package/dist/trace/runtime/thenable.d.ts +3 -0
  314. package/dist/trace/runtime/thenable.d.ts.map +1 -0
  315. package/dist/trace/runtime/thenable.js +12 -0
  316. package/dist/trace/runtime/thenable.js.map +1 -0
  317. package/dist/trace/runtime/truncate-trace.d.ts +5 -0
  318. package/dist/trace/runtime/truncate-trace.d.ts.map +1 -0
  319. package/dist/trace/runtime/truncate-trace.js +44 -0
  320. package/dist/trace/runtime/truncate-trace.js.map +1 -0
  321. package/dist/trace/schema/trace-fields.d.ts +1 -1
  322. package/dist/trace/schema/trace-retained.d.ts +1 -1
  323. package/dist/trace/schema/trace.d.ts +1 -1
  324. package/dist/trace/transformer/build-meta-literal.d.ts +3 -0
  325. package/dist/trace/transformer/build-meta-literal.d.ts.map +1 -0
  326. package/dist/trace/transformer/build-meta-literal.js +8 -0
  327. package/dist/trace/transformer/build-meta-literal.js.map +1 -0
  328. package/dist/trace/transformer/find-flow-step-sites.d.ts +24 -0
  329. package/dist/trace/transformer/find-flow-step-sites.d.ts.map +1 -0
  330. package/dist/trace/transformer/find-flow-step-sites.js +69 -0
  331. package/dist/trace/transformer/find-flow-step-sites.js.map +1 -0
  332. package/dist/trace/transformer/inject-flow-step-import.d.ts +3 -0
  333. package/dist/trace/transformer/inject-flow-step-import.d.ts.map +1 -0
  334. package/dist/trace/transformer/inject-flow-step-import.js +28 -0
  335. package/dist/trace/transformer/inject-flow-step-import.js.map +1 -0
  336. package/dist/trace/transformer/transform-error.d.ts +8 -0
  337. package/dist/trace/transformer/transform-error.d.ts.map +1 -0
  338. package/dist/trace/transformer/transform-error.js +5 -0
  339. package/dist/trace/transformer/transform-error.js.map +1 -0
  340. package/dist/trace/transformer/transform-flow-steps.d.ts +12 -0
  341. package/dist/trace/transformer/transform-flow-steps.d.ts.map +1 -0
  342. package/dist/trace/transformer/transform-flow-steps.js +85 -0
  343. package/dist/trace/transformer/transform-flow-steps.js.map +1 -0
  344. package/dist/trace/transformer/wrap-function-declaration.d.ts +3 -0
  345. package/dist/trace/transformer/wrap-function-declaration.d.ts.map +1 -0
  346. package/dist/trace/transformer/wrap-function-declaration.js +28 -0
  347. package/dist/trace/transformer/wrap-function-declaration.js.map +1 -0
  348. package/dist/trace/transformer/wrap-variable-declaration.d.ts +3 -0
  349. package/dist/trace/transformer/wrap-variable-declaration.d.ts.map +1 -0
  350. package/dist/trace/transformer/wrap-variable-declaration.js +30 -0
  351. package/dist/trace/transformer/wrap-variable-declaration.js.map +1 -0
  352. package/dist/workspace/dependency-graph.d.ts.map +1 -1
  353. package/dist/workspace/dependency-graph.js +2 -3
  354. package/dist/workspace/dependency-graph.js.map +1 -1
  355. package/dist/workspace/generate.d.ts.map +1 -1
  356. package/dist/workspace/generate.js +63 -10
  357. package/dist/workspace/generate.js.map +1 -1
  358. package/dist/workspace/module-package-name.d.ts +3 -0
  359. package/dist/workspace/module-package-name.d.ts.map +1 -0
  360. package/dist/workspace/module-package-name.js +5 -0
  361. package/dist/workspace/module-package-name.js.map +1 -0
  362. package/package.json +21 -6
@@ -5,8 +5,8 @@ import { advisoryLock } from './advisory-lock.js';
5
5
  import { serializable } from './serializable.js';
6
6
  import { bulkSet } from './bulk-set.js';
7
7
  import { values } from './values.js';
8
- import * as introspection from './generated/drizzle-orm/introspection.js';
9
- import * as relationOps from './generated/drizzle-orm/relation.js';
8
+ import { update, insert, remove, upsert } from '../write/index.js';
9
+ import { aliasedRelation, aliasedTable, aliasedTableColumn, getTableColumns, getTableName, getViewName, getViewSelectedFields, isTable, createMany, createOne, relations } from '../query/index.js';
10
10
  import { define, definitions } from '../domain/index.js';
11
11
  export type { DB, SQL, Table, Column, TransactionConfig } from './types.js';
12
12
  /** Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc. */
@@ -15,6 +15,86 @@ export { filter } from './filter.js';
15
15
  export { excluded } from './excluded.js';
16
16
  /** Database accessor — returns a Drizzle DB instance scoped to the current request/job/test context. Requires active AsyncLocalStorage context. */
17
17
  export declare const pipe: typeof getDb & {
18
+ /** Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc. */
19
+ filter: {
20
+ readonly and: typeof import("../query/index.js").and;
21
+ readonly arrayContained: typeof import("../query/index.js").arrayContained;
22
+ readonly arrayContains: typeof import("../query/index.js").arrayContains;
23
+ readonly arrayOverlaps: typeof import("../query/index.js").arrayOverlaps;
24
+ readonly asc: typeof import("../query/index.js").asc;
25
+ readonly between: typeof import("../query/index.js").between;
26
+ readonly desc: typeof import("../query/index.js").desc;
27
+ readonly eq: import("../query/index.js").BinaryOperator;
28
+ readonly exists: typeof import("../query/index.js").exists;
29
+ readonly gt: import("../query/index.js").BinaryOperator;
30
+ readonly gte: import("../query/index.js").BinaryOperator;
31
+ readonly ilike: typeof import("../query/index.js").ilike;
32
+ readonly inArray: typeof import("../query/index.js").inArray;
33
+ readonly is: typeof import("../query/entity.js").is;
34
+ readonly isNotNull: typeof import("../query/index.js").isNotNull;
35
+ readonly isNull: typeof import("../query/index.js").isNull;
36
+ readonly like: typeof import("../query/index.js").like;
37
+ readonly lt: import("../query/index.js").BinaryOperator;
38
+ readonly lte: import("../query/index.js").BinaryOperator;
39
+ readonly ne: import("../query/index.js").BinaryOperator;
40
+ readonly not: typeof import("../query/index.js").not;
41
+ readonly notBetween: typeof import("../query/index.js").notBetween;
42
+ readonly notExists: typeof import("../query/index.js").notExists;
43
+ readonly notIlike: typeof import("../query/index.js").notIlike;
44
+ readonly notInArray: typeof import("../query/index.js").notInArray;
45
+ readonly notLike: typeof import("../query/index.js").notLike;
46
+ readonly or: typeof import("../query/index.js").or;
47
+ readonly avg: typeof import("../query/index.js").avg;
48
+ readonly avgDistinct: typeof import("../query/index.js").avgDistinct;
49
+ readonly count: typeof import("../query/index.js").count;
50
+ readonly countDistinct: typeof import("../query/index.js").countDistinct;
51
+ readonly max: typeof import("../query/index.js").max;
52
+ readonly min: typeof import("../query/index.js").min;
53
+ readonly sum: typeof import("../query/index.js").sum;
54
+ readonly sumDistinct: typeof import("../query/index.js").sumDistinct;
55
+ readonly except: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
56
+ readonly exceptAll: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
57
+ readonly intersect: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
58
+ readonly intersectAll: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
59
+ readonly union: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
60
+ readonly unionAll: import("../query/pg-core/index.js").PgCreateSetOperatorFn;
61
+ readonly increment: typeof import("./expressions.js").increment;
62
+ readonly decrement: typeof import("./expressions.js").decrement;
63
+ readonly add: typeof import("./expressions.js").add;
64
+ readonly subtract: typeof import("./expressions.js").subtract;
65
+ readonly coalesce: typeof import("./expressions.js").coalesce;
66
+ readonly now: typeof import("./expressions.js").now;
67
+ readonly scalar: typeof import("./expressions.js").scalar;
68
+ readonly cast: typeof import("./expressions.js").cast;
69
+ readonly interval: typeof import("./expressions.js").interval;
70
+ readonly dateTrunc: typeof import("./expressions.js").dateTrunc;
71
+ readonly rowNumber: typeof import("./expressions.js").rowNumber;
72
+ readonly rank: typeof import("./expressions.js").rank;
73
+ readonly denseRank: typeof import("./expressions.js").denseRank;
74
+ readonly over: typeof import("./expressions.js").over;
75
+ readonly identifier: typeof import("./expressions.js").identifier;
76
+ readonly withRecursive: typeof import("./expressions.js").withRecursive;
77
+ readonly ago: typeof import("./composed.js").ago;
78
+ readonly castUuid: typeof import("./composed.js").castUuid;
79
+ readonly castJsonb: typeof import("./composed.js").castJsonb;
80
+ readonly castTimestamp: typeof import("./composed.js").castTimestamp;
81
+ readonly castBoolean: typeof import("./composed.js").castBoolean;
82
+ readonly castNumeric: typeof import("./composed.js").castNumeric;
83
+ readonly castInteger: typeof import("./composed.js").castInteger;
84
+ readonly castText: typeof import("./composed.js").castText;
85
+ readonly nextSequence: typeof import("./composed.js").nextSequence;
86
+ };
87
+ aliasedRelation: typeof aliasedRelation;
88
+ aliasedTable: typeof aliasedTable;
89
+ aliasedTableColumn: typeof aliasedTableColumn;
90
+ getTableColumns: typeof getTableColumns;
91
+ getTableName: typeof getTableName;
92
+ getViewName: typeof getViewName;
93
+ getViewSelectedFields: typeof getViewSelectedFields;
94
+ isTable: typeof isTable;
95
+ createMany: typeof createMany;
96
+ createOne: typeof createOne;
97
+ relations: typeof relations;
18
98
  /** Runs migrations for all configured databases. */
19
99
  migrate: typeof migrateAll;
20
100
  /** Runs migrations for a single named database. */
@@ -49,85 +129,13 @@ export declare const pipe: typeof getDb & {
49
129
  define: typeof define;
50
130
  /** Returns the global registry of all domain definitions. */
51
131
  definitions: typeof definitions;
52
- createMany: typeof relationOps.createMany;
53
- createOne: typeof relationOps.createOne;
54
- relations: typeof relationOps.relations;
55
- aliasedRelation: typeof introspection.aliasedRelation;
56
- aliasedTable: typeof introspection.aliasedTable;
57
- aliasedTableColumn: typeof introspection.aliasedTableColumn;
58
- getTableColumns: typeof introspection.getTableColumns;
59
- getTableName: typeof introspection.getTableName;
60
- getViewName: typeof introspection.getViewName;
61
- getViewSelectedFields: typeof introspection.getViewSelectedFields;
62
- isTable: typeof introspection.isTable;
63
- /** Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc. */
64
- filter: {
65
- readonly increment: typeof import("./expressions.js").increment;
66
- readonly decrement: typeof import("./expressions.js").decrement;
67
- readonly add: typeof import("./expressions.js").add;
68
- readonly subtract: typeof import("./expressions.js").subtract;
69
- readonly coalesce: typeof import("./expressions.js").coalesce;
70
- readonly now: typeof import("./expressions.js").now;
71
- readonly scalar: typeof import("./expressions.js").scalar;
72
- readonly cast: typeof import("./expressions.js").cast;
73
- readonly interval: typeof import("./expressions.js").interval;
74
- readonly dateTrunc: typeof import("./expressions.js").dateTrunc;
75
- readonly rowNumber: typeof import("./expressions.js").rowNumber;
76
- readonly rank: typeof import("./expressions.js").rank;
77
- readonly denseRank: typeof import("./expressions.js").denseRank;
78
- readonly over: typeof import("./expressions.js").over;
79
- readonly identifier: typeof import("./expressions.js").identifier;
80
- readonly withRecursive: typeof import("./expressions.js").withRecursive;
81
- readonly ago: typeof import("./composed.js").ago;
82
- readonly castUuid: typeof import("./composed.js").castUuid;
83
- readonly castJsonb: typeof import("./composed.js").castJsonb;
84
- readonly castTimestamp: typeof import("./composed.js").castTimestamp;
85
- readonly castBoolean: typeof import("./composed.js").castBoolean;
86
- readonly castNumeric: typeof import("./composed.js").castNumeric;
87
- readonly castInteger: typeof import("./composed.js").castInteger;
88
- readonly castText: typeof import("./composed.js").castText;
89
- readonly nextSequence: typeof import("./composed.js").nextSequence;
90
- readonly except: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
91
- readonly exceptAll: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
92
- readonly intersect: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
93
- readonly intersectAll: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
94
- readonly union: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
95
- readonly unionAll: import("./generated/pg-core/type.js").PgCreateSetOperatorFn;
96
- readonly avg: typeof import("../query/index.js").avg;
97
- readonly avgDistinct: typeof import("../query/index.js").avgDistinct;
98
- readonly count: typeof import("../query/index.js").count;
99
- readonly countDistinct: typeof import("../query/index.js").countDistinct;
100
- readonly max: typeof import("../query/index.js").max;
101
- readonly min: typeof import("../query/index.js").min;
102
- readonly sum: typeof import("../query/index.js").sum;
103
- readonly sumDistinct: typeof import("../query/index.js").sumDistinct;
104
- readonly and: typeof import("../query/index.js").and;
105
- readonly arrayContained: typeof import("../query/index.js").arrayContained;
106
- readonly arrayContains: typeof import("../query/index.js").arrayContains;
107
- readonly arrayOverlaps: typeof import("../query/index.js").arrayOverlaps;
108
- readonly asc: typeof import("../query/index.js").asc;
109
- readonly between: typeof import("../query/index.js").between;
110
- readonly desc: typeof import("../query/index.js").desc;
111
- readonly eq: import("../query/index.js").BinaryOperator;
112
- readonly exists: typeof import("../query/index.js").exists;
113
- readonly gt: import("../query/index.js").BinaryOperator;
114
- readonly gte: import("../query/index.js").BinaryOperator;
115
- readonly ilike: typeof import("../query/index.js").ilike;
116
- readonly inArray: typeof import("../query/index.js").inArray;
117
- readonly is: typeof import("../query/entity.js").is;
118
- readonly isNotNull: typeof import("../query/index.js").isNotNull;
119
- readonly isNull: typeof import("../query/index.js").isNull;
120
- readonly like: typeof import("../query/index.js").like;
121
- readonly lt: import("../query/index.js").BinaryOperator;
122
- readonly lte: import("../query/index.js").BinaryOperator;
123
- readonly ne: import("../query/index.js").BinaryOperator;
124
- readonly not: typeof import("../query/index.js").not;
125
- readonly notBetween: typeof import("../query/index.js").notBetween;
126
- readonly notExists: typeof import("../query/index.js").notExists;
127
- readonly notIlike: typeof import("../query/index.js").notIlike;
128
- readonly notInArray: typeof import("../query/index.js").notInArray;
129
- readonly notLike: typeof import("../query/index.js").notLike;
130
- readonly or: typeof import("../query/index.js").or;
131
- };
132
+ /** Pipework-owned UPDATE builder — the only consumer-facing way to update pipework-managed tables (Q8). */
133
+ update: typeof update;
134
+ /** Pipework-owned INSERT builder — the only consumer-facing way to insert into pipework-managed tables (Q8). */
135
+ insert: typeof insert;
136
+ /** Pipework-owned DELETE builder — the only consumer-facing way to delete from pipework-managed tables (Q8). */
137
+ delete: typeof remove;
138
+ /** Pipework-owned UPSERT builder — insert with conflict resolution (Q8). */
139
+ upsert: typeof upsert;
132
140
  };
133
141
  //# sourceMappingURL=namespace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/data/db/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,KAAK,aAAa,MAAM,0CAA0C,CAAA;AACzE,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;AAGlE,OAAO,EAAS,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAG/D,YAAY,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE3E,6EAA6E;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,6EAA6E;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,mJAAmJ;AACnJ,eAAO,MAAM,IAAI;IAUf,oDAAoD;;IAEpD,mDAAmD;;IAGnD,6EAA6E;;IAG7E,gFAAgF;;IAGhF,kHAAkH;;IAGlH,2GAA2G;;IAG3G,0GAA0G;;IAG1G,8EAA8E;;;;;;;;;;;;;;;;IAE9E,qFAAqF;;IAErF,6DAA6D;;;;;;;;;;;;;IAjC7D,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D,mDAAmD;;IAGnD,6EAA6E;;IAG7E,gFAAgF;;IAGhF,kHAAkH;;IAGlH,2GAA2G;;IAG3G,0GAA0G;;IAG1G,8EAA8E;;;;;;;;;;;;;;;;IAE9E,qFAAqF;;IAErF,6DAA6D;;IAG7D,2GAA2G;;IAE3G,gHAAgH;;IAEhH,gHAAgH;;IAEhH,4EAA4E;;CAE5E,CAAA"}
@@ -6,9 +6,8 @@ import { advisoryLock } from './advisory-lock.js';
6
6
  import { serializable } from './serializable.js';
7
7
  import { bulkSet } from './bulk-set.js';
8
8
  import { values } from './values.js';
9
- // Auto-generated re-export layers (scaffold-namespace tool)
10
- import * as introspection from './generated/drizzle-orm/introspection.js';
11
- import * as relationOps from './generated/drizzle-orm/relation.js';
9
+ import { update, insert, remove, upsert } from '../write/index.js';
10
+ import { aliasedRelation, aliasedTable, aliasedTableColumn, getTableColumns, getTableName, getViewName, getViewSelectedFields, isTable, createMany, createOne, relations } from '../query/index.js';
12
11
  // Domain definitions
13
12
  import { field, define, definitions } from '../domain/index.js';
14
13
  /** Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc. */
@@ -20,9 +19,18 @@ export const pipe = Object.assign(getDb, {
20
19
  /** Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc. */
21
20
  filter,
22
21
  // Introspection — aliasedTable, aliasedRelation, getTableColumns, getTableName, getViewName, etc.
23
- ...introspection,
22
+ aliasedRelation,
23
+ aliasedTable,
24
+ aliasedTableColumn,
25
+ getTableColumns,
26
+ getTableName,
27
+ getViewName,
28
+ getViewSelectedFields,
29
+ isTable,
24
30
  // Relations — relations(), createOne(), createMany()
25
- ...relationOps,
31
+ createMany,
32
+ createOne,
33
+ relations,
26
34
  /** Runs migrations for all configured databases. */
27
35
  migrate: migrateAll,
28
36
  /** Runs migrations for a single named database. */
@@ -43,5 +51,13 @@ export const pipe = Object.assign(getDb, {
43
51
  define,
44
52
  /** Returns the global registry of all domain definitions. */
45
53
  definitions,
54
+ /** Pipework-owned UPDATE builder — the only consumer-facing way to update pipework-managed tables (Q8). */
55
+ update,
56
+ /** Pipework-owned INSERT builder — the only consumer-facing way to insert into pipework-managed tables (Q8). */
57
+ insert,
58
+ /** Pipework-owned DELETE builder — the only consumer-facing way to delete from pipework-managed tables (Q8). */
59
+ delete: remove,
60
+ /** Pipework-owned UPSERT builder — insert with conflict resolution (Q8). */
61
+ upsert,
46
62
  });
47
63
  //# sourceMappingURL=namespace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/data/db/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,4DAA4D;AAC5D,OAAO,KAAK,aAAa,MAAM,0CAA0C,CAAA;AACzE,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;AAElE,qBAAqB;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAK/D,6EAA6E;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,6EAA6E;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,mJAAmJ;AACnJ,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;IACvC,6EAA6E;IAC7E,MAAM;IAEN,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AAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,6EAA6E;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,mJAAmJ;AACnJ,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;IACvC,6EAA6E;IAC7E,MAAM;IAEN,kGAAkG;IAClG,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,YAAY;IACZ,WAAW;IACX,qBAAqB;IACrB,OAAO;IAEP,qDAAqD;IACrD,UAAU;IACV,SAAS;IACT,SAAS;IAET,oDAAoD;IACpD,OAAO,EAAE,UAAU;IACnB,mDAAmD;IACnD,UAAU;IAEV,6EAA6E;IAC7E,QAAQ;IAER,gFAAgF;IAChF,YAAY;IAEZ,kHAAkH;IAClH,YAAY;IAEZ,2GAA2G;IAC3G,OAAO;IAEP,0GAA0G;IAC1G,MAAM;IAEN,8EAA8E;IAC9E,KAAK;IACL,qFAAqF;IACrF,MAAM;IACN,6DAA6D;IAC7D,WAAW;IAEX,2GAA2G;IAC3G,MAAM;IACN,gHAAgH;IAChH,MAAM;IACN,gHAAgH;IAChH,MAAM,EAAE,MAAM;IACd,4EAA4E;IAC5E,MAAM;CACP,CAAC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Transform unsafe drizzle-kit migration SQL into safe SQL.
2
+ * Transform unsafe migration SQL emitted by the diff/sql-emit pipeline into
3
+ * safe SQL.
3
4
  *
4
5
  * Two transforms are applied:
5
6
  * 1. `CREATE INDEX` → `CREATE INDEX CONCURRENTLY` (with `-- pipework:no-transaction` pragma)
@@ -1 +1 @@
1
- {"version":3,"file":"post-process.d.ts","sourceRoot":"","sources":["../../../src/data/migrate/post-process.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4DxD"}
1
+ {"version":3,"file":"post-process.d.ts","sourceRoot":"","sources":["../../../src/data/migrate/post-process.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4DxD"}
@@ -5,7 +5,8 @@ const ALTER_TABLE_NAME_RE = /\bALTER\s+TABLE\s+(?:ONLY\s+)?((?:"(?:[^"]+)"\.)*"(
5
5
  const ADD_CONSTRAINT_NAME_RE = /\bADD\s+CONSTRAINT\s+("(?:[^"]+)"|[^\s(]+)/i;
6
6
  const NO_TRANSACTION_PRAGMA = '-- pipework:no-transaction';
7
7
  /**
8
- * Transform unsafe drizzle-kit migration SQL into safe SQL.
8
+ * Transform unsafe migration SQL emitted by the diff/sql-emit pipeline into
9
+ * safe SQL.
9
10
  *
10
11
  * Two transforms are applied:
11
12
  * 1. `CREATE INDEX` → `CREATE INDEX CONCURRENTLY` (with `-- pipework:no-transaction` pragma)
@@ -1 +1 @@
1
- {"version":3,"file":"post-process.js","sourceRoot":"","sources":["../../../src/data/migrate/post-process.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,oDAAoD,CAAA;AAC5E,MAAM,eAAe,GAAG,mBAAmB,CAAA;AAC3C,MAAM,KAAK,GAAG,qEAAqE,CAAA;AACnF,MAAM,mBAAmB,GAAG,sFAAsF,CAAA;AAClH,MAAM,sBAAsB,GAAG,6CAA6C,CAAA;AAE5E,MAAM,qBAAqB,GAAG,4BAA4B,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAExC,MAAM,gBAAgB,GAAa,EAAE,CAAA;IACr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AC;QACH,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAED,IAAI,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IAE7C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,QAAQ,CAAA;IACpB,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC;YAC/C,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,GAAG,qBAAqB,KAAK,MAAM,EAAE,CAAA;IAC3C,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { atTime } from './query.js';
2
2
  import { revise } from './revise.js';
3
3
  import { TemporalIntegrityError } from './errors.js';
4
- import { and } from '../db/generated/drizzle-orm/operator.js';
4
+ import { and } from '../query/index.js';
5
5
  function requireEffectiveDated(definition, fnName) {
6
6
  if (!definition.$traits.includes('effectiveDated')) {
7
7
  throw new TemporalIntegrityError(`temporal.${fnName}() requires an effective-dated definition.\n\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"definition-queries.js","sourceRoot":"","sources":["../../../src/data/temporal/definition-queries.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,yCAAyC,CAAA;AAU7D,SAAS,qBAAqB,CAA8B,UAAiC,EAAE,MAAc;IAC3G,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,sBAA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AAC,UAAU,EAAE,iBAAiB,CAAC,CAAA;IAC5D,MAAM,aAAa,GAAkB;QACnC,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC/B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAA;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,EAAE,GAAG,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,MAAM,CAAC,aAAa,CAAC,CAAA;AAC9B,CAAC"}
1
+ {"version":3,"file":"definition-queries.js","sourceRoot":"","sources":["../../../src/data/temporal/definition-queries.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAUvC,SAAS,qBAAqB,CAA8B,UAAiC,EAAE,MAAc;IAC3G,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,sBAAsB,CAC9B,YAAY,MAAM,gDAAgD;YAClE,MAAM,UAAU,CAAC,KAAK,kDAAkD;YACxE,+CAA+C;YAC/C,oBAAoB,UAAU,CAAC,KAAK,gCAAgC,CACrE,CAAA;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,EAAM,EACN,UAAiC,EACjC,IAAU,EACV,KAAW;IAEX,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAA;IA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O,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,MAAM,CAAC,aAAa,CAAC,CAAA;AAC9B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { and, lte, gt, isNull, or } from '../db/generated/drizzle-orm/operator.js';
1
+ import { and, lte, gt, isNull, or } from '../query/index.js';
2
2
  export function atTime(table, asOf) {
3
3
  return and(lte(table.effectiveFrom, asOf), or(isNull(table.effectiveTo), gt(table.effectiveTo, asOf)));
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/data/temporal/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,yCAAyC,CAAA;AAQlF,MAAM,UAAU,MAAM,CAA+B,KAAQ,EAAE,IAAU;IACvE,OAAO,GAAG,CACR,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,EAC9B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAC1D,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAA+B,KAAQ;IAC5D,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,OAAO,CAA+B,KAAQ,EAAE,IAAU,EAAE,EAAQ;IAClF,OAAO,GAAG,CACR,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,EAC5B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAC1D,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/data/temporal/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAQ5D,MAAM,UAAU,MAAM,CAA+B,KAAQ,EAAE,IAAU;IACvE,OAAO,GAAG,CACR,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,EAC9B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAC1D,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAA+B,KAAQ;IAC5D,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,OAAO,CAA+B,KAAQ,EAAE,IAAU,EAAE,EAAQ;IAClF,OAAO,GAAG,CACR,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,EAC5B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAC1D,CAAA;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { getTableName } from '../db/generated/drizzle-orm/introspection.js';
1
+ import { getTableName } from '../query/index.js';
2
2
  import { TemporalIntegrityError } from './errors.js';
3
3
  export function resolveTableName(table) {
4
4
  return typeof table === 'string' ? table : getTableName(table);
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/data/temporal/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAwB,EAAE,KAAa;IAC3E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,sBAAsB,CAC9B,uCAAuC,KAAK,gCAAgC;YAC5E,6DAA6D,IAAI,CAAC,MAAM,GAAG,EAC3E,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAC9B,CAAA;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/data/temporal/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAwB,EAAE,KAAa;IAC3E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,sBAAsB,CAC9B,uCAAuC,KAAK,gCAAgC;YAC5E,6DAA6D,IAAI,CAAC,MAAM,GAAG,EAC3E,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAC9B,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Flow } from '../../../request/context/types.js';
2
+ export declare function resolveActorId(flow: Flow): string | null;
3
+ //# sourceMappingURL=actor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/actor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AAE7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAMxD"}
@@ -0,0 +1,15 @@
1
+ // Resolves the audit row's `actor_id` from the current `Flow.auth`. Audit
2
+ // lives downstream of auth, but it doesn't impose a brand — the audit row
3
+ // stores whatever the auth surface gave us as a free text. Mirrors the
4
+ // extraction the logging layer uses: `auth.userId` when present and string,
5
+ // null otherwise. Anything else (cron, worker without principal) → null.
6
+ export function resolveActorId(flow) {
7
+ const auth = flow.auth;
8
+ if (auth === null || typeof auth !== 'object')
9
+ return null;
10
+ if (!('userId' in auth))
11
+ return null;
12
+ const userId = auth.userId;
13
+ return typeof userId === 'string' ? userId : null;
14
+ }
15
+ //# sourceMappingURL=actor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor.js","sourceRoot":"","sources":["../../../../src/data/write/audit/actor.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,4EAA4E;AAC5E,yEAAyE;AAIzE,MAAM,UAAU,cAAc,CAAC,IAAU;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACtB,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1D,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,MAAM,MAAM,GAAI,IAA4B,CAAC,MAAM,CAAA;IACnD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { auditRecordFields } from '../../../audit/schema/audit-record-fields.js';
2
+ /** Field keys on `audit_record`, in declaration order — the SELECT projection's positional order. */
3
+ export declare const AUDIT_FIELD_KEYS: ReadonlyArray<keyof typeof auditRecordFields>;
4
+ /** Quoted column list, comma-separated — the `INSERT INTO audit_record (...)` parenthetical. */
5
+ export declare const AUDIT_COLUMNS_SQL: string;
6
+ //# sourceMappingURL=audit-columns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-columns.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/audit-columns.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAEhF,qGAAqG;AACrG,eAAO,MAAM,gBAAgB,EAAqC,aAAa,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE/G,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,QAEjB,CAAA"}
@@ -0,0 +1,15 @@
1
+ // The shared column list for `audit_record` INSERT statements. Compiled once
2
+ // at module load from `auditRecordFields` (the same registry the table is
3
+ // built from) so the column order baked into every CTE-form INSERT matches
4
+ // the table's declared order. Re-ordering or adding fields on
5
+ // `auditRecordFields` is enough — the audit CTE generator picks it up.
6
+ import { quoteIdentifier } from '../../db/identifiers.js';
7
+ import { camelToSnake } from '../../domain/naming.js';
8
+ import { auditRecordFields } from '../../../audit/schema/audit-record-fields.js';
9
+ /** Field keys on `audit_record`, in declaration order — the SELECT projection's positional order. */
10
+ export const AUDIT_FIELD_KEYS = Object.keys(auditRecordFields);
11
+ /** Quoted column list, comma-separated — the `INSERT INTO audit_record (...)` parenthetical. */
12
+ export const AUDIT_COLUMNS_SQL = AUDIT_FIELD_KEYS
13
+ .map(k => quoteIdentifier(camelToSnake(k), 'audit_record column'))
14
+ .join(', ');
15
+ //# sourceMappingURL=audit-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-columns.js","sourceRoot":"","sources":["../../../../src/data/write/audit/audit-columns.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,8DAA8D;AAC9D,uEAAuE;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAEhF,qGAAqG;AACrG,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAkD,CAAA;AAE/G,gGAAgG;AAChG,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB;KAC9C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;KACjE,IAAI,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import type { SQL } from '../../db/types.js';
2
+ import type { ActiveAuditStep } from '../../../trace/runtime/step-buffer.js';
3
+ /**
4
+ * Information about the active flow_step plus the actor/tenant the row is
5
+ * attributed to. The CTE compiler resolves these from the active `Flow` and
6
+ * passes them in — keeps the SQL composer free of context-store coupling.
7
+ */
8
+ export interface AuditSelectContext {
9
+ readonly step: ActiveAuditStep;
10
+ /** `auth?.userId`, or null when the trace ran without an authenticated principal. */
11
+ readonly actorId: string | null;
12
+ /** `flow.tenant`, or null when the entry was not tenant-scoped. */
13
+ readonly tenantId: string | null;
14
+ }
15
+ /**
16
+ * Composes the `audit_inserts` CTE body: one `SELECT` per `@touches` target,
17
+ * joined by `UNION ALL`, projecting onto the `audit_record` column order.
18
+ *
19
+ * The shape is positional — matches `AUDIT_COLUMNS_SQL` exactly:
20
+ * id, trace_day, trace_id, trace_step_id, tenant_id, actor_id,
21
+ * entity, verb, before, after, captured_inputs, occurred_at
22
+ *
23
+ * `from` is the verb's contributing FROM clause (e.g. `FROM updated u LEFT
24
+ * JOIN before b ON ...`), `before` / `after` are the per-row jsonb
25
+ * expressions to project (or `NULL::jsonb` when the half doesn't apply).
26
+ */
27
+ export declare function buildAuditInserts(ctx: AuditSelectContext, from: SQL, before: SQL, after: SQL): SQL;
28
+ //# sourceMappingURL=audit-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-select.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/audit-select.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AAE5E;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,GAAG,GACT,GAAG,CAwBL"}
@@ -0,0 +1,49 @@
1
+ // Builds the SELECT projection inside the `audit_inserts` CTE — one row per
2
+ // (affected-db-row × `@touches` target). The verb composers (insert / update
3
+ // / delete / upsert) supply the data-source clause (`FROM ...`) and the
4
+ // `before` / `after` jsonb expressions; everything else — the actor/tenant/
5
+ // trace fields, the entity/verb literals, the captured_inputs literal — is
6
+ // constant across rows and lives here.
7
+ //
8
+ // `@touches Entity:verb` is multi-target: a single write can carry several
9
+ // targets, and each one emits its own audit row per affected db row. We
10
+ // model that as `UNION ALL` over one SELECT per target, sharing the same
11
+ // FROM. (Postgres folds these into a single insert plan.) Empty targets is
12
+ // a programmer error — the executor short-circuits to the vanilla branch.
13
+ import { sql } from '../../db/sql.js';
14
+ /**
15
+ * Composes the `audit_inserts` CTE body: one `SELECT` per `@touches` target,
16
+ * joined by `UNION ALL`, projecting onto the `audit_record` column order.
17
+ *
18
+ * The shape is positional — matches `AUDIT_COLUMNS_SQL` exactly:
19
+ * id, trace_day, trace_id, trace_step_id, tenant_id, actor_id,
20
+ * entity, verb, before, after, captured_inputs, occurred_at
21
+ *
22
+ * `from` is the verb's contributing FROM clause (e.g. `FROM updated u LEFT
23
+ * JOIN before b ON ...`), `before` / `after` are the per-row jsonb
24
+ * expressions to project (or `NULL::jsonb` when the half doesn't apply).
25
+ */
26
+ export function buildAuditInserts(ctx, from, before, after) {
27
+ const capturedInputs = ctx.step.capturedInputs;
28
+ const capturedJson = capturedInputs === null
29
+ ? sql `NULL::jsonb`
30
+ : sql `${JSON.stringify(capturedInputs)}::jsonb`;
31
+ const selects = ctx.step.touches.map(t => sql `
32
+ SELECT
33
+ gen_random_uuid(),
34
+ ${ctx.step.traceDay}::date,
35
+ ${ctx.step.traceId}::uuid,
36
+ ${ctx.step.stepId}::uuid,
37
+ ${ctx.tenantId}::uuid,
38
+ ${ctx.actorId},
39
+ ${t.entity},
40
+ ${t.verb},
41
+ ${before},
42
+ ${after},
43
+ ${capturedJson},
44
+ now()
45
+ ${from}
46
+ `);
47
+ return sql.join(selects, sql ` UNION ALL `);
48
+ }
49
+ //# sourceMappingURL=audit-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-select.js","sourceRoot":"","sources":["../../../../src/data/write/audit/audit-select.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAiBrC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAuB,EACvB,IAAS,EACT,MAAW,EACX,KAAU;IAEV,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,cAAc,CAAA;IAC9C,MAAM,YAAY,GAAG,cAAc,KAAK,IAAI;QAC1C,CAAC,CAAC,GAAG,CAAA,aAAa;QAClB,CAAC,CAAC,GAAG,CAAA,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAA;IAEjD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAA;;;QAGvC,GAAG,CAAC,IAAI,CAAC,QAAQ;QACjB,GAAG,CAAC,IAAI,CAAC,OAAO;QAChB,GAAG,CAAC,IAAI,CAAC,MAAM;QACf,GAAG,CAAC,QAAQ;QACZ,GAAG,CAAC,OAAO;QACX,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,IAAI;QACN,MAAM;QACN,KAAK;QACL,YAAY;;MAEd,IAAI;GACP,CAAC,CAAA;IAEF,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAA,aAAa,CAAC,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { SQL } from '../../db/types.js';
2
+ import type { WriteState } from '../state.js';
3
+ import type { AuditSelectContext } from './audit-select.js';
4
+ type AnyDb = any;
5
+ export declare function compileAuditWrite(db: AnyDb, state: WriteState, ctx: AuditSelectContext): SQL;
6
+ export {};
7
+ //# sourceMappingURL=cte-compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cte-compile.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/cte-compile.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,KAAK,KAAK,GAAG,GAAG,CAAA;AAEhB,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,GAAG,GAAG,CAa5F"}
@@ -0,0 +1,23 @@
1
+ // Entry point for the write+audit CTE generator. Routes by `state.verb` to
2
+ // the per-verb composer. Empty `touches` is a programmer error — the caller
3
+ // (executor) is expected to fall through to the vanilla branch when the
4
+ // active step has no audit projection. We assert here so a regression in
5
+ // the executor surfaces immediately rather than producing an audit row
6
+ // with empty entity/verb.
7
+ import { compileInsertAudit } from './verb-insert.js';
8
+ import { compileUpdateAudit } from './verb-update.js';
9
+ import { compileDeleteAudit } from './verb-delete.js';
10
+ import { compileUpsertAudit } from './verb-upsert.js';
11
+ export function compileAuditWrite(db, state, ctx) {
12
+ if (ctx.step.touches.length === 0) {
13
+ throw new Error(`[pipework] compileAuditWrite called with empty touches on "${state.table.$name}". ` +
14
+ `Active step "${ctx.step.stepId}" has no @touches — the executor should have taken the vanilla DML branch.`);
15
+ }
16
+ switch (state.verb) {
17
+ case 'insert': return compileInsertAudit(db, state, ctx);
18
+ case 'update': return compileUpdateAudit(db, state, ctx);
19
+ case 'delete': return compileDeleteAudit(db, state, ctx);
20
+ case 'upsert': return compileUpsertAudit(db, state, ctx);
21
+ }
22
+ }
23
+ //# sourceMappingURL=cte-compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cte-compile.js","sourceRoot":"","sources":["../../../../src/data/write/audit/cte-compile.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,0BAA0B;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAQrD,MAAM,UAAU,iBAAiB,CAAC,EAAS,EAAE,KAAiB,EAAE,GAAuB;IACrF,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,8DAA8D,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK;YACpF,gBAAgB,GAAG,CAAC,IAAI,CAAC,MAAM,4EAA4E,CAC5G,CAAA;IACH,CAAC;IACD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,QAAQ,CAAC,CAAC,OAAO,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;QACxD,KAAK,QAAQ,CAAC,CAAC,OAAO,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;QACxD,KAAK,QAAQ,CAAC,CAAC,OAAO,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;QACxD,KAAK,QAAQ,CAAC,CAAC,OAAO,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SQL } from '../../db/types.js';
2
+ import type { WriteState } from '../state.js';
3
+ export declare function buildFinalSelect(state: WriteState, sourceCte: string): SQL;
4
+ //# sourceMappingURL=final-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"final-select.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/final-select.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,CAiB1E"}
@@ -0,0 +1,28 @@
1
+ // Builds the final SELECT of the CTE statement — the row(s) the caller sees.
2
+ // Mirrors the shape `vanilla DML` would have produced for the same `returning`:
3
+ // no `returning` → no rows; `returning('all')` → SELECT *; per-key projection
4
+ // → aliased column list. Reads from the verb's post-image CTE (`inserted` /
5
+ // `updated` / `deleted` / `upserted`).
6
+ import { sql } from '../../db/sql.js';
7
+ import { quoteIdentifier } from '../../db/identifiers.js';
8
+ import { camelToSnake } from '../../domain/naming.js';
9
+ export function buildFinalSelect(state, sourceCte) {
10
+ const source = quoteIdentifier(sourceCte, 'CTE alias');
11
+ const returning = state.returning ?? null;
12
+ if (returning === null) {
13
+ return sql.raw(`SELECT 1 FROM ${source} WHERE FALSE`);
14
+ }
15
+ if (returning === 'all') {
16
+ return sql.raw(`SELECT * FROM ${source}`);
17
+ }
18
+ const keys = Object.keys(returning);
19
+ if (keys.length === 0)
20
+ return sql.raw(`SELECT * FROM ${source}`);
21
+ const cols = keys.map(k => {
22
+ const physical = quoteIdentifier(camelToSnake(k), 'returning column');
23
+ const alias = quoteIdentifier(k, 'returning alias');
24
+ return `${source}.${physical} AS ${alias}`;
25
+ }).join(', ');
26
+ return sql.raw(`SELECT ${cols} FROM ${source}`);
27
+ }
28
+ //# sourceMappingURL=final-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"final-select.js","sourceRoot":"","sources":["../../../../src/data/write/audit/final-select.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,uCAAuC;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAIrD,MAAM,UAAU,gBAAgB,CAAC,KAAiB,EAAE,SAAiB;IACnE,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,IAAI,CAAA;IACzC,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,iBAAiB,MAAM,cAAc,CAAC,CAAA;IACvD,CAAC;IACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,GAAG,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAA;IAC3C,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAA;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACxB,MAAM,QAAQ,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAA;QACrE,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;QACnD,OAAO,GAAG,MAAM,IAAI,QAAQ,OAAO,KAAK,EAAE,CAAA;IAC5C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,MAAM,EAAE,CAAC,CAAA;AACjD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DefinedTable } from '../../domain/types.js';
2
+ /**
3
+ * Returns the primary-key field keys in declaration order. Throws when the
4
+ * table declares no primary key — the audit CTE needs one to pair rows.
5
+ */
6
+ export declare function primaryKeyFieldKeys(table: DefinedTable<any>): readonly string[];
7
+ //# sourceMappingURL=primary-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primary-key.d.ts","sourceRoot":"","sources":["../../../../src/data/write/audit/primary-key.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAA;AAEtE;;;GAGG;AACH,wBAAgB,mBAAmB,CAEjC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GACvB,SAAS,MAAM,EAAE,CAkBnB"}