@axinom/mosaic-db-common 0.57.0 → 0.58.0-rc.3

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 (393) hide show
  1. package/README.md +9 -3
  2. package/dist/cjs/auth/authentication-subject.d.ts.map +1 -0
  3. package/dist/cjs/auth/authentication-subject.js.map +1 -0
  4. package/dist/{auth → cjs/auth}/helpers.d.ts +2 -2
  5. package/dist/cjs/auth/helpers.d.ts.map +1 -0
  6. package/dist/cjs/auth/helpers.js +58 -0
  7. package/dist/cjs/auth/helpers.js.map +1 -0
  8. package/dist/cjs/auth/index.d.ts +3 -0
  9. package/dist/cjs/auth/index.d.ts.map +1 -0
  10. package/dist/{auth → cjs/auth}/index.js +2 -2
  11. package/dist/cjs/auth/index.js.map +1 -0
  12. package/dist/{cli → cjs/cli}/commands/generate-define-func-migration.d.ts +1 -1
  13. package/dist/cjs/cli/commands/generate-define-func-migration.d.ts.map +1 -0
  14. package/dist/{cli → cjs/cli}/commands/generate-define-func-migration.js +6 -5
  15. package/dist/cjs/cli/commands/generate-define-func-migration.js.map +1 -0
  16. package/dist/{cli → cjs/cli}/commands/generate-vscode-sql-snippets.d.ts +1 -1
  17. package/dist/cjs/cli/commands/generate-vscode-sql-snippets.d.ts.map +1 -0
  18. package/dist/{cli → cjs/cli}/commands/generate-vscode-sql-snippets.js +35 -71
  19. package/dist/cjs/cli/commands/generate-vscode-sql-snippets.js.map +1 -0
  20. package/dist/cjs/cli/commands/index.d.ts +3 -0
  21. package/dist/cjs/cli/commands/index.d.ts.map +1 -0
  22. package/dist/{cli → cjs/cli}/commands/index.js +2 -2
  23. package/dist/cjs/cli/commands/index.js.map +1 -0
  24. package/dist/cjs/cli/commands/utils.d.ts.map +1 -0
  25. package/dist/cjs/cli/commands/utils.js.map +1 -0
  26. package/dist/{cli → cjs/cli}/index.d.ts +1 -1
  27. package/dist/cjs/cli/index.d.ts.map +1 -0
  28. package/dist/{cli → cjs/cli}/index.js +3 -3
  29. package/dist/cjs/cli/index.js.map +1 -0
  30. package/dist/cjs/common/find-up.d.ts +2 -0
  31. package/dist/cjs/common/find-up.d.ts.map +1 -0
  32. package/dist/cjs/common/find-up.js +18 -0
  33. package/dist/cjs/common/find-up.js.map +1 -0
  34. package/dist/cjs/common/index.d.ts +2 -0
  35. package/dist/cjs/common/index.d.ts.map +1 -0
  36. package/dist/{common → cjs/common}/index.js +1 -1
  37. package/dist/cjs/common/index.js.map +1 -0
  38. package/dist/cjs/common/package-root.d.ts +2 -0
  39. package/dist/cjs/common/package-root.d.ts.map +1 -0
  40. package/dist/cjs/common/package-root.js +46 -0
  41. package/dist/cjs/common/package-root.js.map +1 -0
  42. package/dist/{common → cjs/common}/types.d.ts +1 -1
  43. package/dist/cjs/common/types.d.ts.map +1 -0
  44. package/dist/{common → cjs/common}/types.js.map +1 -1
  45. package/dist/cjs/constants/index.d.ts +2 -0
  46. package/dist/cjs/constants/index.d.ts.map +1 -0
  47. package/dist/cjs/constants/index.js +18 -0
  48. package/dist/cjs/constants/index.js.map +1 -0
  49. package/dist/cjs/constants/pg-auth-settings-keys.d.ts.map +1 -0
  50. package/dist/cjs/constants/pg-auth-settings-keys.js.map +1 -0
  51. package/dist/cjs/index.d.ts +11 -0
  52. package/dist/cjs/index.d.ts.map +1 -0
  53. package/dist/cjs/index.js +27 -0
  54. package/dist/cjs/index.js.map +1 -0
  55. package/dist/cjs/messaging/index.d.ts +2 -0
  56. package/dist/cjs/messaging/index.d.ts.map +1 -0
  57. package/dist/{messaging → cjs/messaging}/index.js +1 -1
  58. package/dist/cjs/messaging/index.js.map +1 -0
  59. package/dist/{messaging → cjs/messaging}/messaging-counter.d.ts +1 -1
  60. package/dist/cjs/messaging/messaging-counter.d.ts.map +1 -0
  61. package/dist/cjs/messaging/messaging-counter.js.map +1 -0
  62. package/dist/cjs/middleware/index.d.ts +2 -0
  63. package/dist/cjs/middleware/index.d.ts.map +1 -0
  64. package/dist/{constants → cjs/middleware}/index.js +1 -1
  65. package/dist/cjs/middleware/index.js.map +1 -0
  66. package/dist/{middleware → cjs/middleware}/pg-pool.middleware.d.ts +3 -3
  67. package/dist/cjs/middleware/pg-pool.middleware.d.ts.map +1 -0
  68. package/dist/{middleware → cjs/middleware}/pg-pool.middleware.js +13 -3
  69. package/dist/cjs/middleware/pg-pool.middleware.js.map +1 -0
  70. package/dist/{migrations → cjs/migrations}/compare-migration-hashes-helpers.d.ts +2 -2
  71. package/dist/cjs/migrations/compare-migration-hashes-helpers.d.ts.map +1 -0
  72. package/dist/cjs/migrations/compare-migration-hashes-helpers.js +149 -0
  73. package/dist/cjs/migrations/compare-migration-hashes-helpers.js.map +1 -0
  74. package/dist/{migrations → cjs/migrations}/compare-migration-hashes.d.ts +2 -2
  75. package/dist/cjs/migrations/compare-migration-hashes.d.ts.map +1 -0
  76. package/dist/{migrations → cjs/migrations}/compare-migration-hashes.js +4 -4
  77. package/dist/cjs/migrations/compare-migration-hashes.js.map +1 -0
  78. package/dist/{migrations → cjs/migrations}/create-migrations-logger.d.ts +1 -1
  79. package/dist/cjs/migrations/create-migrations-logger.d.ts.map +1 -0
  80. package/dist/{migrations → cjs/migrations}/create-migrations-logger.js +8 -5
  81. package/dist/cjs/migrations/create-migrations-logger.js.map +1 -0
  82. package/dist/cjs/migrations/index.d.ts +5 -0
  83. package/dist/cjs/migrations/index.d.ts.map +1 -0
  84. package/dist/cjs/migrations/index.js +21 -0
  85. package/dist/cjs/migrations/index.js.map +1 -0
  86. package/dist/cjs/migrations/types.d.ts.map +1 -0
  87. package/dist/cjs/migrations/types.js.map +1 -0
  88. package/dist/cjs/migrations/utils.d.ts +70 -0
  89. package/dist/cjs/migrations/utils.d.ts.map +1 -0
  90. package/dist/cjs/migrations/utils.js +121 -0
  91. package/dist/cjs/migrations/utils.js.map +1 -0
  92. package/dist/cjs/monitoring/index.d.ts +2 -0
  93. package/dist/cjs/monitoring/index.d.ts.map +1 -0
  94. package/dist/{middleware → cjs/monitoring}/index.js +1 -1
  95. package/dist/cjs/monitoring/index.js.map +1 -0
  96. package/dist/{monitoring → cjs/monitoring}/postgres-metrics.d.ts +3 -3
  97. package/dist/cjs/monitoring/postgres-metrics.d.ts.map +1 -0
  98. package/dist/cjs/monitoring/postgres-metrics.js.map +1 -0
  99. package/dist/cjs/package.json +1 -0
  100. package/dist/{replication → cjs/replication}/create-logical-replication-service.d.ts +2 -2
  101. package/dist/cjs/replication/create-logical-replication-service.d.ts.map +1 -0
  102. package/dist/{replication → cjs/replication}/create-logical-replication-service.js +6 -4
  103. package/dist/cjs/replication/create-logical-replication-service.js.map +1 -0
  104. package/dist/{replication → cjs/replication}/ensure-replication-slot-and-publication-exist.d.ts +3 -3
  105. package/dist/cjs/replication/ensure-replication-slot-and-publication-exist.d.ts.map +1 -0
  106. package/dist/{replication → cjs/replication}/ensure-replication-slot-and-publication-exist.js +2 -2
  107. package/dist/cjs/replication/ensure-replication-slot-and-publication-exist.js.map +1 -0
  108. package/dist/cjs/replication/index.d.ts +3 -0
  109. package/dist/cjs/replication/index.d.ts.map +1 -0
  110. package/dist/{replication → cjs/replication}/index.js +2 -2
  111. package/dist/cjs/replication/index.js.map +1 -0
  112. package/dist/cjs/zapatos/index.d.ts +4 -0
  113. package/dist/cjs/zapatos/index.d.ts.map +1 -0
  114. package/dist/cjs/zapatos/index.js +20 -0
  115. package/dist/cjs/zapatos/index.js.map +1 -0
  116. package/dist/{zapatos → cjs/zapatos}/transaction-with-context.d.ts +2 -2
  117. package/dist/cjs/zapatos/transaction-with-context.d.ts.map +1 -0
  118. package/dist/cjs/zapatos/transaction-with-context.js.map +1 -0
  119. package/dist/cjs/zapatos/transform-custom-type.d.ts.map +1 -0
  120. package/dist/cjs/zapatos/transform-custom-type.js.map +1 -0
  121. package/dist/{zapatos → cjs/zapatos}/update-helpers.d.ts +1 -1
  122. package/dist/cjs/zapatos/update-helpers.d.ts.map +1 -0
  123. package/dist/cjs/zapatos/update-helpers.js.map +1 -0
  124. package/dist/esm/auth/authentication-subject.d.ts +44 -0
  125. package/dist/esm/auth/authentication-subject.d.ts.map +1 -0
  126. package/dist/esm/auth/authentication-subject.js +3 -0
  127. package/dist/esm/auth/authentication-subject.js.map +1 -0
  128. package/dist/esm/auth/helpers.d.ts +44 -0
  129. package/dist/esm/auth/helpers.d.ts.map +1 -0
  130. package/dist/esm/auth/helpers.js +53 -0
  131. package/dist/esm/auth/helpers.js.map +1 -0
  132. package/dist/esm/auth/index.d.ts +3 -0
  133. package/dist/esm/auth/index.d.ts.map +1 -0
  134. package/dist/esm/auth/index.js +3 -0
  135. package/dist/esm/auth/index.js.map +1 -0
  136. package/dist/esm/cli/commands/generate-define-func-migration.d.ts +14 -0
  137. package/dist/esm/cli/commands/generate-define-func-migration.d.ts.map +1 -0
  138. package/dist/esm/cli/commands/generate-define-func-migration.js +70 -0
  139. package/dist/esm/cli/commands/generate-define-func-migration.js.map +1 -0
  140. package/dist/esm/cli/commands/generate-vscode-sql-snippets.d.ts +14 -0
  141. package/dist/esm/cli/commands/generate-vscode-sql-snippets.d.ts.map +1 -0
  142. package/dist/esm/cli/commands/generate-vscode-sql-snippets.js +176 -0
  143. package/dist/esm/cli/commands/generate-vscode-sql-snippets.js.map +1 -0
  144. package/dist/esm/cli/commands/index.d.ts +3 -0
  145. package/dist/esm/cli/commands/index.d.ts.map +1 -0
  146. package/dist/esm/cli/commands/index.js +3 -0
  147. package/dist/esm/cli/commands/index.js.map +1 -0
  148. package/dist/esm/cli/commands/utils.d.ts +13 -0
  149. package/dist/esm/cli/commands/utils.d.ts.map +1 -0
  150. package/dist/esm/cli/commands/utils.js +20 -0
  151. package/dist/esm/cli/commands/utils.js.map +1 -0
  152. package/dist/esm/cli/index.d.ts +3 -0
  153. package/dist/esm/cli/index.d.ts.map +1 -0
  154. package/dist/esm/cli/index.js +7 -0
  155. package/dist/esm/cli/index.js.map +1 -0
  156. package/dist/esm/common/find-up.d.ts +2 -0
  157. package/dist/esm/common/find-up.d.ts.map +1 -0
  158. package/dist/esm/common/find-up.js +14 -0
  159. package/dist/esm/common/find-up.js.map +1 -0
  160. package/dist/esm/common/index.d.ts +2 -0
  161. package/dist/esm/common/index.d.ts.map +1 -0
  162. package/dist/esm/common/index.js +2 -0
  163. package/dist/esm/common/index.js.map +1 -0
  164. package/dist/esm/common/package-root.d.ts +2 -0
  165. package/dist/esm/common/package-root.d.ts.map +1 -0
  166. package/dist/esm/common/package-root.js +42 -0
  167. package/dist/esm/common/package-root.js.map +1 -0
  168. package/dist/esm/common/types.d.ts +52 -0
  169. package/dist/esm/common/types.d.ts.map +1 -0
  170. package/dist/esm/common/types.js +2 -0
  171. package/dist/{migrations → esm/common}/types.js.map +1 -1
  172. package/dist/esm/constants/index.d.ts +2 -0
  173. package/dist/esm/constants/index.d.ts.map +1 -0
  174. package/dist/esm/constants/index.js +2 -0
  175. package/dist/esm/constants/index.js.map +1 -0
  176. package/dist/esm/constants/pg-auth-settings-keys.d.ts +32 -0
  177. package/dist/esm/constants/pg-auth-settings-keys.d.ts.map +1 -0
  178. package/dist/esm/constants/pg-auth-settings-keys.js +32 -0
  179. package/dist/esm/constants/pg-auth-settings-keys.js.map +1 -0
  180. package/dist/esm/index.d.ts +11 -0
  181. package/dist/esm/index.d.ts.map +1 -0
  182. package/dist/esm/index.js +11 -0
  183. package/dist/esm/index.js.map +1 -0
  184. package/dist/esm/messaging/index.d.ts +2 -0
  185. package/dist/esm/messaging/index.d.ts.map +1 -0
  186. package/dist/esm/messaging/index.js +2 -0
  187. package/dist/esm/messaging/index.js.map +1 -0
  188. package/dist/esm/messaging/messaging-counter.d.ts +91 -0
  189. package/dist/esm/messaging/messaging-counter.d.ts.map +1 -0
  190. package/dist/esm/messaging/messaging-counter.js +129 -0
  191. package/dist/esm/messaging/messaging-counter.js.map +1 -0
  192. package/dist/esm/middleware/index.d.ts +2 -0
  193. package/dist/esm/middleware/index.d.ts.map +1 -0
  194. package/dist/esm/middleware/index.js +2 -0
  195. package/dist/esm/middleware/index.js.map +1 -0
  196. package/dist/esm/middleware/pg-pool.middleware.d.ts +99 -0
  197. package/dist/esm/middleware/pg-pool.middleware.d.ts.map +1 -0
  198. package/dist/esm/middleware/pg-pool.middleware.js +152 -0
  199. package/dist/esm/middleware/pg-pool.middleware.js.map +1 -0
  200. package/dist/esm/migrations/compare-migration-hashes-helpers.d.ts +14 -0
  201. package/dist/esm/migrations/compare-migration-hashes-helpers.d.ts.map +1 -0
  202. package/dist/{migrations → esm/migrations}/compare-migration-hashes-helpers.js +15 -18
  203. package/dist/esm/migrations/compare-migration-hashes-helpers.js.map +1 -0
  204. package/dist/esm/migrations/compare-migration-hashes.d.ts +17 -0
  205. package/dist/esm/migrations/compare-migration-hashes.d.ts.map +1 -0
  206. package/dist/esm/migrations/compare-migration-hashes.js +52 -0
  207. package/dist/esm/migrations/compare-migration-hashes.js.map +1 -0
  208. package/dist/esm/migrations/create-migrations-logger.d.ts +4 -0
  209. package/dist/esm/migrations/create-migrations-logger.d.ts.map +1 -0
  210. package/dist/esm/migrations/create-migrations-logger.js +35 -0
  211. package/dist/esm/migrations/create-migrations-logger.js.map +1 -0
  212. package/dist/esm/migrations/index.d.ts +5 -0
  213. package/dist/esm/migrations/index.d.ts.map +1 -0
  214. package/dist/esm/migrations/index.js +5 -0
  215. package/dist/esm/migrations/index.js.map +1 -0
  216. package/dist/esm/migrations/types.d.ts +17 -0
  217. package/dist/esm/migrations/types.d.ts.map +1 -0
  218. package/dist/esm/migrations/types.js +2 -0
  219. package/dist/esm/migrations/types.js.map +1 -0
  220. package/dist/esm/migrations/utils.d.ts +70 -0
  221. package/dist/esm/migrations/utils.d.ts.map +1 -0
  222. package/dist/esm/migrations/utils.js +113 -0
  223. package/dist/esm/migrations/utils.js.map +1 -0
  224. package/dist/esm/monitoring/index.d.ts +2 -0
  225. package/dist/esm/monitoring/index.d.ts.map +1 -0
  226. package/dist/esm/monitoring/index.js +2 -0
  227. package/dist/esm/monitoring/index.js.map +1 -0
  228. package/dist/esm/monitoring/postgres-metrics.d.ts +15 -0
  229. package/dist/esm/monitoring/postgres-metrics.d.ts.map +1 -0
  230. package/dist/esm/monitoring/postgres-metrics.js +39 -0
  231. package/dist/esm/monitoring/postgres-metrics.js.map +1 -0
  232. package/dist/esm/package.json +1 -0
  233. package/dist/esm/replication/create-logical-replication-service.d.ts +79 -0
  234. package/dist/esm/replication/create-logical-replication-service.d.ts.map +1 -0
  235. package/dist/esm/replication/create-logical-replication-service.js +145 -0
  236. package/dist/esm/replication/create-logical-replication-service.js.map +1 -0
  237. package/dist/esm/replication/ensure-replication-slot-and-publication-exist.d.ts +64 -0
  238. package/dist/esm/replication/ensure-replication-slot-and-publication-exist.d.ts.map +1 -0
  239. package/dist/esm/replication/ensure-replication-slot-and-publication-exist.js +50 -0
  240. package/dist/esm/replication/ensure-replication-slot-and-publication-exist.js.map +1 -0
  241. package/dist/esm/replication/index.d.ts +3 -0
  242. package/dist/esm/replication/index.d.ts.map +1 -0
  243. package/dist/esm/replication/index.js +3 -0
  244. package/dist/esm/replication/index.js.map +1 -0
  245. package/dist/esm/zapatos/index.d.ts +4 -0
  246. package/dist/esm/zapatos/index.d.ts.map +1 -0
  247. package/dist/esm/zapatos/index.js +4 -0
  248. package/dist/esm/zapatos/index.js.map +1 -0
  249. package/dist/esm/zapatos/transaction-with-context.d.ts +22 -0
  250. package/dist/esm/zapatos/transaction-with-context.d.ts.map +1 -0
  251. package/dist/esm/zapatos/transaction-with-context.js +36 -0
  252. package/dist/esm/zapatos/transaction-with-context.js.map +1 -0
  253. package/dist/esm/zapatos/transform-custom-type.d.ts +5 -0
  254. package/dist/esm/zapatos/transform-custom-type.d.ts.map +1 -0
  255. package/dist/esm/zapatos/transform-custom-type.js +8 -0
  256. package/dist/esm/zapatos/transform-custom-type.js.map +1 -0
  257. package/dist/esm/zapatos/update-helpers.d.ts +36 -0
  258. package/dist/esm/zapatos/update-helpers.d.ts.map +1 -0
  259. package/dist/esm/zapatos/update-helpers.js +39 -0
  260. package/dist/esm/zapatos/update-helpers.js.map +1 -0
  261. package/package.json +29 -9
  262. package/src/auth/helpers.spec.ts +3 -3
  263. package/src/auth/helpers.ts +4 -4
  264. package/src/auth/index.ts +2 -2
  265. package/src/cli/commands/commands.spec.ts +93 -0
  266. package/src/cli/commands/generate-define-func-migration.ts +9 -4
  267. package/src/cli/commands/generate-vscode-sql-snippets.ts +19 -21
  268. package/src/cli/commands/index.ts +2 -2
  269. package/src/cli/index.ts +2 -2
  270. package/src/common/find-up.ts +20 -0
  271. package/src/common/index.ts +1 -1
  272. package/src/common/package-root.ts +68 -0
  273. package/src/common/types.ts +1 -1
  274. package/src/constants/index.ts +1 -1
  275. package/src/index.ts +10 -10
  276. package/src/messaging/index.ts +1 -1
  277. package/src/messaging/messaging-counter.ts +8 -2
  278. package/src/middleware/index.ts +1 -1
  279. package/src/middleware/pg-pool.middleware.ts +10 -4
  280. package/src/migrations/compare-migration-hashes-helpers.ts +11 -3
  281. package/src/migrations/compare-migration-hashes.spec.ts +12 -3
  282. package/src/migrations/compare-migration-hashes.ts +6 -3
  283. package/src/migrations/create-migrations-logger.ts +10 -10
  284. package/src/migrations/index.ts +4 -4
  285. package/src/migrations/utils.spec.ts +31 -0
  286. package/src/migrations/utils.ts +91 -44
  287. package/src/monitoring/index.ts +1 -1
  288. package/src/monitoring/postgres-metrics.ts +3 -3
  289. package/src/replication/create-logical-replication-service.spec.ts +3 -3
  290. package/src/replication/create-logical-replication-service.ts +3 -3
  291. package/src/replication/ensure-replication-slot-and-publication-exist.spec.ts +3 -3
  292. package/src/replication/ensure-replication-slot-and-publication-exist.ts +4 -4
  293. package/src/replication/index.ts +2 -2
  294. package/src/zapatos/index.ts +3 -3
  295. package/src/zapatos/transaction-with-context.ts +4 -4
  296. package/src/zapatos/transform-custom-type.spec.ts +1 -1
  297. package/src/zapatos/update-helpers.spec.ts +1 -1
  298. package/src/zapatos/update-helpers.ts +1 -1
  299. package/dist/auth/authentication-subject.d.ts.map +0 -1
  300. package/dist/auth/authentication-subject.js.map +0 -1
  301. package/dist/auth/helpers.d.ts.map +0 -1
  302. package/dist/auth/helpers.js +0 -47
  303. package/dist/auth/helpers.js.map +0 -1
  304. package/dist/auth/index.d.ts +0 -3
  305. package/dist/auth/index.d.ts.map +0 -1
  306. package/dist/auth/index.js.map +0 -1
  307. package/dist/cli/commands/generate-define-func-migration.d.ts.map +0 -1
  308. package/dist/cli/commands/generate-define-func-migration.js.map +0 -1
  309. package/dist/cli/commands/generate-vscode-sql-snippets.d.ts.map +0 -1
  310. package/dist/cli/commands/generate-vscode-sql-snippets.js.map +0 -1
  311. package/dist/cli/commands/index.d.ts +0 -3
  312. package/dist/cli/commands/index.d.ts.map +0 -1
  313. package/dist/cli/commands/index.js.map +0 -1
  314. package/dist/cli/commands/utils.d.ts.map +0 -1
  315. package/dist/cli/commands/utils.js.map +0 -1
  316. package/dist/cli/index.d.ts.map +0 -1
  317. package/dist/cli/index.js.map +0 -1
  318. package/dist/common/index.d.ts +0 -2
  319. package/dist/common/index.d.ts.map +0 -1
  320. package/dist/common/index.js.map +0 -1
  321. package/dist/common/types.d.ts.map +0 -1
  322. package/dist/constants/index.d.ts +0 -2
  323. package/dist/constants/index.d.ts.map +0 -1
  324. package/dist/constants/index.js.map +0 -1
  325. package/dist/constants/pg-auth-settings-keys.d.ts.map +0 -1
  326. package/dist/constants/pg-auth-settings-keys.js.map +0 -1
  327. package/dist/index.d.ts +0 -11
  328. package/dist/index.d.ts.map +0 -1
  329. package/dist/index.js +0 -27
  330. package/dist/index.js.map +0 -1
  331. package/dist/messaging/index.d.ts +0 -2
  332. package/dist/messaging/index.d.ts.map +0 -1
  333. package/dist/messaging/index.js.map +0 -1
  334. package/dist/messaging/messaging-counter.d.ts.map +0 -1
  335. package/dist/messaging/messaging-counter.js.map +0 -1
  336. package/dist/middleware/index.d.ts +0 -2
  337. package/dist/middleware/index.d.ts.map +0 -1
  338. package/dist/middleware/index.js.map +0 -1
  339. package/dist/middleware/pg-pool.middleware.d.ts.map +0 -1
  340. package/dist/middleware/pg-pool.middleware.js.map +0 -1
  341. package/dist/migrations/compare-migration-hashes-helpers.d.ts.map +0 -1
  342. package/dist/migrations/compare-migration-hashes-helpers.js.map +0 -1
  343. package/dist/migrations/compare-migration-hashes.d.ts.map +0 -1
  344. package/dist/migrations/compare-migration-hashes.js.map +0 -1
  345. package/dist/migrations/create-migrations-logger.d.ts.map +0 -1
  346. package/dist/migrations/create-migrations-logger.js.map +0 -1
  347. package/dist/migrations/index.d.ts +0 -5
  348. package/dist/migrations/index.d.ts.map +0 -1
  349. package/dist/migrations/index.js +0 -21
  350. package/dist/migrations/index.js.map +0 -1
  351. package/dist/migrations/types.d.ts.map +0 -1
  352. package/dist/migrations/utils.d.ts +0 -38
  353. package/dist/migrations/utils.d.ts.map +0 -1
  354. package/dist/migrations/utils.js +0 -111
  355. package/dist/migrations/utils.js.map +0 -1
  356. package/dist/monitoring/index.d.ts +0 -2
  357. package/dist/monitoring/index.d.ts.map +0 -1
  358. package/dist/monitoring/index.js +0 -18
  359. package/dist/monitoring/index.js.map +0 -1
  360. package/dist/monitoring/postgres-metrics.d.ts.map +0 -1
  361. package/dist/monitoring/postgres-metrics.js.map +0 -1
  362. package/dist/replication/create-logical-replication-service.d.ts.map +0 -1
  363. package/dist/replication/create-logical-replication-service.js.map +0 -1
  364. package/dist/replication/ensure-replication-slot-and-publication-exist.d.ts.map +0 -1
  365. package/dist/replication/ensure-replication-slot-and-publication-exist.js.map +0 -1
  366. package/dist/replication/index.d.ts +0 -3
  367. package/dist/replication/index.d.ts.map +0 -1
  368. package/dist/replication/index.js.map +0 -1
  369. package/dist/zapatos/index.d.ts +0 -4
  370. package/dist/zapatos/index.d.ts.map +0 -1
  371. package/dist/zapatos/index.js +0 -20
  372. package/dist/zapatos/index.js.map +0 -1
  373. package/dist/zapatos/transaction-with-context.d.ts.map +0 -1
  374. package/dist/zapatos/transaction-with-context.js.map +0 -1
  375. package/dist/zapatos/transform-custom-type.d.ts.map +0 -1
  376. package/dist/zapatos/transform-custom-type.js.map +0 -1
  377. package/dist/zapatos/update-helpers.d.ts.map +0 -1
  378. package/dist/zapatos/update-helpers.js.map +0 -1
  379. /package/dist/{auth → cjs/auth}/authentication-subject.d.ts +0 -0
  380. /package/dist/{auth → cjs/auth}/authentication-subject.js +0 -0
  381. /package/dist/{cli → cjs/cli}/commands/utils.d.ts +0 -0
  382. /package/dist/{cli → cjs/cli}/commands/utils.js +0 -0
  383. /package/dist/{common → cjs/common}/types.js +0 -0
  384. /package/dist/{constants → cjs/constants}/pg-auth-settings-keys.d.ts +0 -0
  385. /package/dist/{constants → cjs/constants}/pg-auth-settings-keys.js +0 -0
  386. /package/dist/{messaging → cjs/messaging}/messaging-counter.js +0 -0
  387. /package/dist/{migrations → cjs/migrations}/types.d.ts +0 -0
  388. /package/dist/{migrations → cjs/migrations}/types.js +0 -0
  389. /package/dist/{monitoring → cjs/monitoring}/postgres-metrics.js +0 -0
  390. /package/dist/{zapatos → cjs/zapatos}/transaction-with-context.js +0 -0
  391. /package/dist/{zapatos → cjs/zapatos}/transform-custom-type.d.ts +0 -0
  392. /package/dist/{zapatos → cjs/zapatos}/transform-custom-type.js +0 -0
  393. /package/dist/{zapatos → cjs/zapatos}/update-helpers.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg-auth-settings-keys.js","sourceRoot":"","sources":["../../../src/constants/pg-auth-settings-keys.ts"],"names":[],"mappings":";;;AAAA,8FAA8F;AACjF,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AACnE,mGAAmG;AACtF,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACjE,4FAA4F;AAC/E,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,iGAAiG;AACpF,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,sGAAsG;AACzF,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D;;;GAGG;AACU,QAAA,2BAA2B,GAAG,sBAAsB,CAAC;AACrD,QAAA,gCAAgC,GAAG,2BAA2B,CAAC;AAC/D,QAAA,mCAAmC,GAAG,kBAAkB,CAAC;AACzD,QAAA,kCAAkC,GAAG,yBAAyB,CAAC;AAC/D,QAAA,2BAA2B,GAAG,kBAAkB,CAAC;AAE9D,uEAAuE;AAC1D,QAAA,yBAAyB,GAAG,WAAW,CAAC;AAErD,oDAAoD;AACvC,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAE7C,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AAEhD,kGAAkG;AACrF,QAAA,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D,qGAAqG;AACxF,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,0GAA0G;AAC7F,QAAA,sBAAsB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './auth/index.js';
2
+ export * from './cli/index.js';
3
+ export * from './common/index.js';
4
+ export * from './constants/index.js';
5
+ export * from './messaging/index.js';
6
+ export * from './middleware/index.js';
7
+ export * from './migrations/index.js';
8
+ export * from './monitoring/index.js';
9
+ export * from './replication/index.js';
10
+ export * from './zapatos/index.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth/index.js"), exports);
18
+ __exportStar(require("./cli/index.js"), exports);
19
+ __exportStar(require("./common/index.js"), exports);
20
+ __exportStar(require("./constants/index.js"), exports);
21
+ __exportStar(require("./messaging/index.js"), exports);
22
+ __exportStar(require("./middleware/index.js"), exports);
23
+ __exportStar(require("./migrations/index.js"), exports);
24
+ __exportStar(require("./monitoring/index.js"), exports);
25
+ __exportStar(require("./replication/index.js"), exports);
26
+ __exportStar(require("./zapatos/index.js"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC;AAClC,uDAAqC;AACrC,uDAAqC;AACrC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,yDAAuC;AACvC,qDAAmC"}
@@ -0,0 +1,2 @@
1
+ export * from './messaging-counter.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./messaging-counter"), exports);
17
+ __exportStar(require("./messaging-counter.js"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/messaging/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
@@ -1,4 +1,4 @@
1
- import { OwnerPgPool } from '../common/types';
1
+ import type { OwnerPgPool } from '../common/types.js';
2
2
  export interface NextRedeliveriesFunction {
3
3
  (error: Error | undefined | null, redeliveries?: number): void;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging-counter.d.ts","sourceRoot":"","sources":["../../../src/messaging/messaging-counter.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAyCtD,MAAM,WAAW,wBAAwB;IACvC,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChE;AAED;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAC1C,WAAW,WAAW,KACrB,OAAO,CAAC,IAAI,CAQd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,WAAW,WACjC;IACtB,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;CAiB1E,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging-counter.js","sourceRoot":"","sources":["../../../src/messaging/messaging-counter.ts"],"names":[],"mappings":";;;AAAA,mCAMoB;AAGpB,MAAM,sBAAsB,GAAG,KAAK,EAClC,GAAW,EACX,SAAsB,EACL,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AAE,SAAS,CAAC,CAAC,IAAI,CACzC,CAAC,OAAe,EAAE,EAAE;oBAClB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACtB,CAAC,EACD,CAAC,GAAU,EAAE,EAAE;oBACb,IAAI,GAAG,EAAE,CAAC;wBACR,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;oBACnB,CAAC;gBACH,CAAC,CACF,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,oBAAoB,wBAmB/B"}
@@ -0,0 +1,2 @@
1
+ export * from './pg-pool.middleware.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./pg-auth-settings-keys"), exports);
17
+ __exportStar(require("./pg-pool.middleware.js"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
@@ -1,6 +1,6 @@
1
- import { Application, Express } from 'express';
2
- import { PoolConfig } from 'pg';
3
- import { DbLogger, DbShutdownActions, EnvOwnerPgPool, LabelledPgPool, LoginPgPool, OwnerPgPool } from '../common';
1
+ import type { Application, Express } from 'express';
2
+ import type { PoolConfig } from 'pg';
3
+ import type { DbLogger, DbShutdownActions, EnvOwnerPgPool, LabelledPgPool, LoginPgPool, OwnerPgPool } from '../common/index.js';
4
4
  /**
5
5
  * Creates a PostgreSQL Pool for a given connection string, and returns it.
6
6
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg-pool.middleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/pg-pool.middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAO5B;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,EAC3C,kBAAkB,MAAM,EACxB,WAAW,CAAC,EACZ,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,cAAc,CAAC,CAAC,CAyBlB,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,GAAG,WAAW,KAAG,WAE3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,WAAW,EAChB,WAAW,WAAW,KACrB,IAEF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,OAAO,GAAG,WAAW,KACzB,cAEF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,WAAW,EAChB,cAAc,cAAc,KAC3B,IAEF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,GAAG,WAAW,KAAG,WAE3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,WAAW,EAChB,WAAW,WAAW,KACrB,IAEF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,OAAO,GAAG,WAAW,EAC1B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,WASF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,KAAK,OAAO,GAAG,WAAW,EAC1B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,cASF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,OAAO,GAAG,WAAW,EAC1B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,WASF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,WAQF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,cAQF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,MAAM,EACxB,QAAQ,QAAQ,EAChB,iBAAiB,iBAAiB,EAClC,aAAa,UAAU,KACtB,WAQF,CAAC"}
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.createLoginPgPool = exports.createEnvOwnerPgPool = exports.createOwnerPgPool = exports.setupLoginPgPool = exports.setupEnvOwnerPgPool = exports.setupOwnerPgPool = exports.setLoginPgPool = exports.getLoginPgPool = exports.setEnvOwnerPgPool = exports.getEnvOwnerPgPool = exports.setOwnerPgPool = exports.getOwnerPgPool = exports.createPgPool = void 0;
4
- const pg_1 = require("pg");
7
+ const pg_1 = __importDefault(require("pg"));
8
+ // pg is a TypeScript-compiled CJS package. Node.js native ESM does not honour
9
+ // the __esModule sentinel, so the named Pool import fails at runtime. Use the
10
+ // default import and destructure instead (Pattern 8).
11
+ const { Pool } = pg_1.default;
5
12
  /**
6
13
  * Creates a PostgreSQL Pool for a given connection string, and returns it.
7
14
  *
@@ -13,8 +20,11 @@ const pg_1 = require("pg");
13
20
  * @returns
14
21
  */
15
22
  const createPgPool = (connectionString, poolLabel, logger, shutdownActions, poolConfig) => {
16
- const config = Object.assign({ connectionString }, poolConfig);
17
- const pgPool = new pg_1.Pool(config);
23
+ const config = {
24
+ connectionString,
25
+ ...poolConfig,
26
+ };
27
+ const pgPool = new Pool(config);
18
28
  pgPool.label = poolLabel;
19
29
  // If a pg pool error happens and triggers the exit of node process (e.g postgres server stopped while postgraphile service is running) -
20
30
  // it is possible for it to not be caught using this handler, because node process will close faster.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg-pool.middleware.js","sourceRoot":"","sources":["../../../src/middleware/pg-pool.middleware.ts"],"names":[],"mappings":";;;;;;AAGA,4CAAoB;AAUpB,8EAA8E;AAC9E,8EAA8E;AAC9E,sDAAsD;AACtD,MAAM,EAAE,IAAI,EAAE,GAAG,YAAE,CAAC;AAEpB;;;;;;;;;GASG;AACI,MAAM,YAAY,GAAG,CAC1B,gBAAwB,EACxB,SAAY,EACZ,MAAgB,EAChB,eAAkC,EAClC,UAAuB,EACJ,EAAE;IACrB,MAAM,MAAM,GAAe;QACzB,gBAAgB;QAChB,GAAG,UAAU;KACd,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAsB,CAAC;IACrD,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC;IAEzB,yIAAyI;IACzI,qGAAqG;IACrG,gFAAgF;IAChF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACzB,MAAM,CAAC,KAAK,CACV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;AACnB,CAAC,CAAC;AAfW,QAAA,gBAAgB,oBAe3B;AAEF;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,CAC/B,gBAAwB,EACxB,MAAgB,EAChB,eAAkC,EAClC,UAAuB,EACV,EAAE;IACf,OAAO,IAAA,oBAAY,EACjB,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,eAAe,EACf,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B;AAEF;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,CAClC,gBAAwB,EACxB,MAAgB,EAChB,eAAkC,EAClC,UAAuB,EACP,EAAE;IAClB,OAAO,IAAA,oBAAY,EACjB,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,eAAe,EACf,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B;AAEF;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,CAC/B,gBAAwB,EACxB,MAAgB,EAChB,eAAkC,EAClC,UAAuB,EACV,EAAE;IACf,OAAO,IAAA,oBAAY,EACjB,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,eAAe,EACf,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B"}
@@ -1,5 +1,5 @@
1
- import { Settings } from 'graphile-migrate';
2
- import { CompareMigrationHashesErrorCallback, MigrationRecord } from './types';
1
+ import type { Settings } from 'graphile-migrate';
2
+ import type { CompareMigrationHashesErrorCallback, MigrationRecord } from './types.js';
3
3
  /**
4
4
  * Finds path to `migrations` folder, based on passed Settings.
5
5
  * 'graphile-migrate' package parses all settings into internal ParsedSettings interface.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-migration-hashes-helpers.d.ts","sourceRoot":"","sources":["../../../src/migrations/compare-migration-hashes-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EACV,mCAAmC,EACnC,eAAe,EAChB,MAAM,YAAY,CAAC;AAapB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,QAAQ,KAAG,MAEtD,CAAC;AAiEF,wBAAsB,uBAAuB,CAC3C,mBAAmB,EAAE,MAAM,EAC3B,aAAa,EAAE,mCAAmC,GACjD,OAAO,CAAC,eAAe,EAAE,CAAC,CAqB5B;AAED,wBAAsB,0BAA0B,CAC9C,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAC3C,cAAc,EAAE,mCAAmC,GAClD,OAAO,CAAC,eAAe,EAAE,CAAC,CAwB5B"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getMigrationsPath = void 0;
40
+ exports.getFileMigrationRecords = getFileMigrationRecords;
41
+ exports.getMigrationHistoryRecords = getMigrationHistoryRecords;
42
+ const fs = __importStar(require("fs"));
43
+ const path_1 = require("path");
44
+ const pg_1 = __importDefault(require("pg"));
45
+ // pg is a TypeScript-compiled CJS package. Node.js native ESM does not honour
46
+ // the __esModule sentinel, so the named Pool import fails at runtime. Use the
47
+ // default import and destructure instead (Pattern 8).
48
+ const { Pool } = pg_1.default;
49
+ /**
50
+ * Regex to determine if the committed migration file name is correct.
51
+ * Source 'graphile-migrate' package: https://github.com/graphile/migrate/blob/main/src/current.ts#L8
52
+ */
53
+ const VALID_FILE_REGEX = /^([0-9]+)(-[-_a-zA-Z0-9]*)?\.sql$/;
54
+ /**
55
+ * Finds path to `migrations` folder, based on passed Settings.
56
+ * 'graphile-migrate' package parses all settings into internal ParsedSettings interface.
57
+ * Settings Parser function is not exported, logic to determine path to folder was copied from the library source code.
58
+ * Source, function `parseSettings`: https://github.com/graphile/migrate/blob/main/src/settings.ts#L172
59
+ * @param settings - migration configuration object.
60
+ * @returns string representing path to `migrations` directory.
61
+ */
62
+ const getMigrationsPath = (settings) => {
63
+ return settings.migrationsFolder ?? (0, path_1.join)(process.cwd(), 'migrations');
64
+ };
65
+ exports.getMigrationsPath = getMigrationsPath;
66
+ /**
67
+ * Extracts migration headers from committed migration file.
68
+ * Code for header extraction taken from 'graphile-migrate' package.
69
+ * Source, function `parseMigrationText`:https://github.com/graphile/migrate/blob/main/src/migration.ts#L202
70
+ */
71
+ const extractMigrationRecord = async (migrationFilePath, migrationNumber) => {
72
+ const contents = await fs.promises.readFile(migrationFilePath, 'utf8');
73
+ const lines = contents.split('\n');
74
+ const headers = {};
75
+ for (const line of lines) {
76
+ // Headers always start with a capital letter
77
+ const matches = /^--! ([A-Z][a-zA-Z0-9_]*)(?::(.*))?$/.exec(line);
78
+ if (!matches) {
79
+ // Not headers any more
80
+ break;
81
+ }
82
+ const [, key, value = null] = matches;
83
+ if (key in headers) {
84
+ throw new Error(`Invalid migration '${migrationFilePath}': header '${key}' is specified more than once`);
85
+ }
86
+ headers[key] = value ? value.trim() : value;
87
+ }
88
+ // --! Previous:
89
+ const previousHashRaw = headers['Previous'];
90
+ if (!previousHashRaw) {
91
+ throw new Error(`Invalid committed migration '${migrationFilePath}': no 'Previous' comment`);
92
+ }
93
+ const previousHash = previousHashRaw && previousHashRaw !== '-' ? previousHashRaw : null;
94
+ // --! Hash:
95
+ const hash = headers['Hash'];
96
+ if (!hash) {
97
+ throw new Error(`Invalid committed migration '${migrationFilePath}': no 'Hash' comment`);
98
+ }
99
+ return {
100
+ previousHash: previousHash,
101
+ hash: hash,
102
+ filename: migrationNumber + '.sql',
103
+ fullFilename: (0, path_1.parse)(migrationFilePath).base,
104
+ source: 'file',
105
+ };
106
+ };
107
+ /**
108
+ * Helper to check if passed string is a valid migration filename
109
+ * @param filename - name of migration file
110
+ */
111
+ const isMigrationFilename = (filename) => VALID_FILE_REGEX.exec(filename);
112
+ async function getFileMigrationRecords(migrationsDirectory, errorCallback) {
113
+ const committedMigrationsFolder = (0, path_1.join)(migrationsDirectory, 'committed');
114
+ if (!fs.existsSync(committedMigrationsFolder)) {
115
+ errorCallback(`Directory '${committedMigrationsFolder}' was not found.`);
116
+ return [];
117
+ }
118
+ //all files from `committedMigrationsFolder`
119
+ const migrationFiles = await fs.promises.readdir(committedMigrationsFolder);
120
+ //
121
+ //retrieve all migration files from `migration/committed` folder
122
+ return Promise.all(migrationFiles
123
+ .map(isMigrationFilename)
124
+ .filter((matches) => !!matches)
125
+ .map(async (matches) => {
126
+ const [realFilename, migrationNumberString] = matches;
127
+ const fullPath = (0, path_1.join)(committedMigrationsFolder, realFilename);
128
+ return extractMigrationRecord(fullPath, migrationNumberString);
129
+ }));
130
+ }
131
+ async function getMigrationHistoryRecords(connectionString, _errorCallback) {
132
+ if (!connectionString) {
133
+ throw new Error('Database connection string is not set up.');
134
+ }
135
+ const pgPool = new Pool({
136
+ connectionString: connectionString,
137
+ });
138
+ const pgClient = await pgPool.connect();
139
+ const { rows: [{ migrationsTableExists }], } = await pgClient.query(`SELECT EXISTS (SELECT FROM pg_tables WHERE schemaname = 'graphile_migrate' AND tablename = 'migrations') as "migrationsTableExists"`);
140
+ if (!migrationsTableExists) {
141
+ //This table does not exist yet. It will be generated when the migration ran for the first time.
142
+ return [];
143
+ }
144
+ const { rows } = await pgClient.query(`select filename, previous_hash as "previousHash", hash, 'database' as "source" from graphile_migrate.migrations`);
145
+ pgClient.release();
146
+ pgPool.end();
147
+ return rows;
148
+ }
149
+ //# sourceMappingURL=compare-migration-hashes-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-migration-hashes-helpers.js","sourceRoot":"","sources":["../../../src/migrations/compare-migration-hashes-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,0DAwBC;AAED,gEA2BC;AApJD,uCAAyB;AAEzB,+BAAmC;AACnC,4CAAoB;AAMpB,8EAA8E;AAC9E,8EAA8E;AAC9E,sDAAsD;AACtD,MAAM,EAAE,IAAI,EAAE,GAAG,YAAE,CAAC;AAEpB;;;GAGG;AACH,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAE7D;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,QAAkB,EAAU,EAAE;IAC9D,OAAO,QAAQ,CAAC,gBAAgB,IAAI,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,KAAK,EAClC,iBAAyB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,gBAA2C,EAC3C,cAAmD;IAEnD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC;QACtB,gBAAgB,EAAE,gBAAgB;KACnC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACxC,MAAM,EACJ,IAAI,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC,GAClC,GAAG,MAAM,QAAQ,CAAC,KAAK,CACtB,sIAAsI,CACvI,CAAC;IACF,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,gGAAgG;QAChG,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,CACnC,iHAAiH,CAClH,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,MAAM,CAAC,GAAG,EAAE,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Settings } from 'graphile-migrate';
2
- import { CompareMigrationHashesErrorCallback } from './types';
1
+ import type { Settings } from 'graphile-migrate';
2
+ import type { CompareMigrationHashesErrorCallback } from './types.js';
3
3
  /**
4
4
  * Compares hashes from migration files with migration records from the database.
5
5
  * Execution order:
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-migration-hashes.d.ts","sourceRoot":"","sources":["../../../src/migrations/compare-migration-hashes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD,OAAO,KAAK,EACV,mCAAmC,EAEpC,MAAM,YAAY,CAAC;AAapB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,QAAQ,EAClB,gBAAgB,mCAAmC,KAClD,OAAO,CAAC,IAAI,CAgDd,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.compareMigrationHashes = void 0;
4
- const compare_migration_hashes_helpers_1 = require("./compare-migration-hashes-helpers");
4
+ const compare_migration_hashes_helpers_js_1 = require("./compare-migration-hashes-helpers.js");
5
5
  /**
6
6
  * @param message Default Error handler for migration history comparison.
7
7
  * @param mismatchedRecords
@@ -23,11 +23,11 @@ const defaultErrorCallback = (message, _mismatchedRecords) => {
23
23
  * previous hash) in file migration.
24
24
  */
25
25
  const compareMigrationHashes = async (settings, errorCallback) => {
26
- errorCallback = errorCallback !== null && errorCallback !== void 0 ? errorCallback : defaultErrorCallback;
26
+ errorCallback = errorCallback ?? defaultErrorCallback;
27
27
  //retrieve 'committed' migrations
28
- const fileMigrationRecords = await (0, compare_migration_hashes_helpers_1.getFileMigrationRecords)((0, compare_migration_hashes_helpers_1.getMigrationsPath)(settings), errorCallback);
28
+ const fileMigrationRecords = await (0, compare_migration_hashes_helpers_js_1.getFileMigrationRecords)((0, compare_migration_hashes_helpers_js_1.getMigrationsPath)(settings), errorCallback);
29
29
  //retrieve all migrations from `database`
30
- const dbMigrationRecords = await (0, compare_migration_hashes_helpers_1.getMigrationHistoryRecords)(settings.connectionString, errorCallback);
30
+ const dbMigrationRecords = await (0, compare_migration_hashes_helpers_js_1.getMigrationHistoryRecords)(settings.connectionString, errorCallback);
31
31
  // database has more records, than files committed
32
32
  // also covers case, if db has records, but committed folder is empty
33
33
  if (dbMigrationRecords.length > fileMigrationRecords.length) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-migration-hashes.js","sourceRoot":"","sources":["../../../src/migrations/compare-migration-hashes.ts"],"names":[],"mappings":";;;AACA,+FAI+C;AAM/C;;;GAGG;AACH,MAAM,oBAAoB,GAAwC,CAChE,OAAe,EACf,kBAAsC,EAChC,EAAE;IACR,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC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C;QAC3B,aAAa,CACX,wFAAwF,EACxF,eAAe,CAChB,CAAC;QACF,OAAO;IACT,CAAC;AACH,CAAC,CAAC;AAnDW,QAAA,sBAAsB,0BAmDjC"}
@@ -1,4 +1,4 @@
1
1
  import { Logger as MigrateLogger } from 'graphile-migrate';
2
- import { DbLogger } from '../common';
2
+ import type { DbLogger } from '../common/index.js';
3
3
  export declare const createMigrationsLogger: (logger: DbLogger) => MigrateLogger;
4
4
  //# sourceMappingURL=create-migrations-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-migrations-logger.d.ts","sourceRoot":"","sources":["../../../src/migrations/create-migrations-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAqBnD,eAAO,MAAM,sBAAsB,GAAI,QAAQ,QAAQ,KAAG,aAsBzD,CAAC"}
@@ -14,17 +14,20 @@ const removeAnsiCodes = (value) => {
14
14
  };
15
15
  const createMigrationsLogger = (logger) => {
16
16
  const logFactory = () => {
17
+ // LogLevel is a const enum from @graphile/logger — cannot be used in case
18
+ // expressions under verbatimModuleSyntax (Pattern 10). Use string literals
19
+ // instead: 'error' | 'warning' | 'info' | 'debug'.
17
20
  return (level, message, meta) => {
18
21
  switch (level) {
19
- case "error" /* LogLevel.ERROR */:
20
- (meta === null || meta === void 0 ? void 0 : meta.error)
21
- ? logger.error(meta === null || meta === void 0 ? void 0 : meta.error, removeAnsiCodes(message))
22
+ case 'error':
23
+ meta?.error
24
+ ? logger.error(meta?.error, removeAnsiCodes(message))
22
25
  : logger.error(removeAnsiCodes(message));
23
26
  break;
24
- case "warning" /* LogLevel.WARNING */:
27
+ case 'warning':
25
28
  logger.warn(message);
26
29
  break;
27
- case "info" /* LogLevel.INFO */:
30
+ case 'info':
28
31
  default:
29
32
  logger.log(message);
30
33
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-migrations-logger.js","sourceRoot":"","sources":["../../../src/migrations/create-migrations-logger.ts"],"names":[],"mappings":";;;AACA,uDAA2D;AAO3D,MAAM,SAAS,GAAG,IAAI,MAAM,CAC1B;IACE,6FAA6F;IAC7F,0DAA0D;CAC3D,CAAC,IAAI,CAAC,GAAG,CAAC,EACX,GAAG,CACJ,CAAC;AAEF,MAAM,eAAe,GAAG,CAAI,KAAQ,EAAc,EAAE;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC;AAEK,MAAM,sBAAsB,GAAG,CAAC,MAAgB,EAAiB,EAAE;IACxE,MAAM,UAAU,GAAgD,GAAG,EAAE;QACnE,0EAA0E;QAC1E,2EAA2E;QAC3E,mDAAmD;QACnD,OAAO,CAAC,KAAa,EAAE,OAAe,EAAE,IAAqB,EAAQ,EAAE;YACrE,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,OAAO;oBACV,IAAI,EAAE,KAAK;wBACT,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;wBACrD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC3C,MAAM;gBACR,KAAK,SAAS;oBACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACrB,MAAM;gBACR,KAAK,MAAM,CAAC;gBACZ;oBACE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,yBAAa,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC,CAAC;AAtBW,QAAA,sBAAsB,0BAsBjC"}
@@ -0,0 +1,5 @@
1
+ export * from './compare-migration-hashes.js';
2
+ export * from './create-migrations-logger.js';
3
+ export * from './types.js';
4
+ export * from './utils.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./compare-migration-hashes.js"), exports);
18
+ __exportStar(require("./create-migrations-logger.js"), exports);
19
+ __exportStar(require("./types.js"), exports);
20
+ __exportStar(require("./utils.js"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,gEAA8C;AAC9C,6CAA2B;AAC3B,6CAA2B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/migrations/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/migrations/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import type { Settings } from 'graphile-migrate';
2
+ import type { DbLogger } from '../common/index.js';
3
+ /**
4
+ * Executes all .sql files located in a specified directory.
5
+ *
6
+ * @param settings - graphile-migrate settings object
7
+ * @param dirPath - relative path from the root of a project to a folder with sql scripts in it, e.g. 'migrations/after-reset'
8
+ */
9
+ export declare const runSqlScripts: (settings: Settings, dirPath: string, logger: DbLogger) => Promise<void>;
10
+ /**
11
+ * Executes a `migrations/current.sql` located in the root of the project using graphile-migrate `run` command
12
+ *
13
+ * @param settings - graphile-migrate settings object
14
+ */
15
+ export declare const runCurrentSql: (settings: Settings, logger: DbLogger) => Promise<void>;
16
+ /**
17
+ * Retrieves an array of relative string paths to before-migration SQL scripts,
18
+ * consumed by graphile-migrate settings. Scripts contain helper functions added
19
+ * to the `ax_utils` and `ax_define` schemas.
20
+ *
21
+ * @param migrationsFolder - Absolute path to the consuming project's
22
+ * `migrations` folder. Defaults to `<cwd>/migrations`.
23
+ * @param beforeMigrationScriptsPath - Absolute path to this package's
24
+ * `migrations/before-migration` directory. Optional override for callers that
25
+ * want to resolve the package assets themselves.
26
+ *
27
+ * When omitted, the package root is resolved internally in both the CJS and
28
+ * ESM builds and the bundled `migrations/before-migration` directory is used.
29
+ *
30
+ * Callers that need the explicit path can use
31
+ * {@link getDbCommonBeforeMigrationPath}:
32
+ * ```ts
33
+ * import { getBeforeMigrationScripts, getDbCommonBeforeMigrationPath } from '@axinom/mosaic-db-common';
34
+ *
35
+ * await getBeforeMigrationScripts(
36
+ * migrationsFolder,
37
+ * getDbCommonBeforeMigrationPath(import.meta.url),
38
+ * );
39
+ * ```
40
+ */
41
+ export declare const getBeforeMigrationScripts: (migrationsFolder?: string, beforeMigrationScriptsPath?: string) => Promise<string[]>;
42
+ /**
43
+ * Resolves the absolute path to this package's `migrations/before-migration`
44
+ * directory from a caller module location.
45
+ *
46
+ * This helper remains useful when the caller needs to pass the path to another
47
+ * API explicitly. {@link getBeforeMigrationScripts} can resolve the same path
48
+ * internally in both CJS and ESM runtimes when the second argument is omitted.
49
+ *
50
+ * Pass `import.meta.url` from the calling ESM module. Internally uses
51
+ * `createRequire` to locate the installed package root via CJS resolution,
52
+ * which works correctly from both ESM and CJS contexts.
53
+ *
54
+ * @param callerUrl - The `import.meta.url` of the calling ESM module (or
55
+ * `pathToFileURL(__filename).href` from a CJS module when the caller wants to
56
+ * resolve this package's asset path explicitly).
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * import { getBeforeMigrationScripts, getDbCommonBeforeMigrationPath } from '@axinom/mosaic-db-common';
61
+ *
62
+ * await getBeforeMigrationScripts(
63
+ * migrationsFolder,
64
+ * getDbCommonBeforeMigrationPath(import.meta.url),
65
+ * );
66
+ * ```
67
+ */
68
+ export declare const getDbCommonBeforeMigrationPath: (callerUrl: string) => string;
69
+ export declare const getGraphileBuildPgWatchFixturesPath: () => string;
70
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/migrations/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,QAAQ,EAClB,SAAS,MAAM,EACf,QAAQ,QAAQ,KACf,OAAO,CAAC,IAAI,CAYd,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,QAAQ,EAClB,QAAQ,QAAQ,KACf,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB,GACpC,mBAAmB,MAAM,EACzB,6BAA6B,MAAM,KAClC,OAAO,CAAC,MAAM,EAAE,CAYlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,8BAA8B,GAAI,WAAW,MAAM,KAAG,MAOhE,CAAC;AAkBJ,eAAO,MAAM,mCAAmC,QAAO,MAetD,CAAC"}