appos 0.3.5-0 → 0.3.6-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/bin/main.mjs +2 -2
  2. package/dist/exports/api/adapter-C2mMJKvG.mjs +1504 -0
  3. package/dist/exports/api/{auth-schema.mjs → auth-schema-CON4yFFY.mjs} +2 -3
  4. package/dist/exports/api/bun-sqlite-dialect-CPpPZa23.mjs +155 -0
  5. package/dist/exports/{cli/_virtual/rolldown_runtime.mjs → api/chunk-CyXqrcp_.mjs} +14 -1
  6. package/dist/exports/api/conditions-DjBAWfiK.mjs +116 -0
  7. package/dist/exports/api/dialect-CUUD24Ge.mjs +72 -0
  8. package/dist/exports/api/env-CwT3zhez.mjs +1 -0
  9. package/dist/exports/api/esm-_hkVMulx.mjs +15816 -0
  10. package/dist/exports/api/event-BHFSE6hY.mjs +20983 -0
  11. package/dist/exports/api/extract-blob-metadata-BMgUEPcW.mjs +4 -0
  12. package/dist/exports/api/extract-blob-metadata-_9RUEwoU.mjs +9818 -0
  13. package/dist/exports/api/generate-image-variant-DOIzj1wJ.mjs +4 -0
  14. package/dist/exports/api/generate-image-variant-DxOPoGAk.mjs +118 -0
  15. package/dist/exports/api/generate-preview-CvTFuq58.mjs +160 -0
  16. package/dist/exports/api/generate-preview-Dk3coswZ.mjs +4 -0
  17. package/dist/exports/api/index.d.mts +7347 -20
  18. package/dist/exports/api/index.mjs +146856 -18
  19. package/dist/exports/api/kysely-adapter-CmP2TbkS.mjs +296 -0
  20. package/dist/exports/api/memory-adapter-BzhRhLFK.mjs +212 -0
  21. package/dist/exports/api/node-sqlite-dialect-Bl5suBxl.mjs +155 -0
  22. package/dist/exports/api/orm-CMqufD21.mjs +153690 -0
  23. package/dist/exports/api/orm-DXqYuKvB.d.mts +11 -0
  24. package/dist/exports/api/orm.d.mts +2 -11
  25. package/dist/exports/api/orm.mjs +4 -42
  26. package/dist/exports/api/pdf-YxB2Hm1p.mjs +25822 -0
  27. package/dist/exports/api/purge-attachment-Cf6KH2Jv.mjs +34 -0
  28. package/dist/exports/api/purge-attachment-DIuil7ps.mjs +4 -0
  29. package/dist/exports/{cli/api/workflows/purge-audit-logs.mjs → api/purge-audit-logs-z6j_Pu47.mjs} +3 -3
  30. package/dist/exports/{cli/api/workflows/purge-unattached-blobs.mjs → api/purge-unattached-blobs-B0TfY5Hk.mjs} +1 -1
  31. package/dist/exports/api/react-BYhV5bYt.mjs +1131 -0
  32. package/dist/exports/api/server.node-DyVrQ6cz.mjs +19298 -0
  33. package/dist/exports/api/table-6bTIEqON.mjs +2636 -0
  34. package/dist/exports/api/{workflows/track-db-changes.mjs → track-db-changes-BysaV6nN.mjs} +14 -14
  35. package/dist/exports/api/{workflow.mjs → workflow-BuSWHcX-.mjs} +121 -10
  36. package/dist/exports/api/workflows/auth-schema-BFve3hgZ.mjs +2813 -0
  37. package/dist/exports/api/{_virtual/rolldown_runtime.mjs → workflows/chunk-B36mNPO4.mjs} +5 -1
  38. package/dist/exports/api/workflows/extract-blob-metadata-BcWKvY2K.mjs +9818 -0
  39. package/dist/exports/api/workflows/{generate-image-variant.mjs → generate-image-variant-BAFvL_zV.mjs} +20 -20
  40. package/dist/exports/{cli/api/workflows/generate-preview.mjs → api/workflows/generate-preview-BjlIVYYp.mjs} +6 -6
  41. package/dist/exports/api/workflows/index.d.mts +2011 -1
  42. package/dist/exports/api/workflows/index.mjs +2 -1
  43. package/dist/exports/api/workflows/pdf-DUB8zyIc.mjs +25822 -0
  44. package/dist/exports/{cli/api/workflows/purge-attachment.mjs → api/workflows/purge-attachment-k_sdxTPY.mjs} +3 -3
  45. package/dist/exports/api/workflows/{purge-audit-logs.mjs → purge-audit-logs-zCyWj4Mw.mjs} +12 -3
  46. package/dist/exports/api/workflows/{purge-unattached-blobs.mjs → purge-unattached-blobs-CdsuFAeW.mjs} +1 -1
  47. package/dist/exports/api/workflows/track-db-changes-CiKaI9gT.mjs +20943 -0
  48. package/dist/exports/api/workflows/track-db-changes-DEWQYryO.mjs +4 -0
  49. package/dist/exports/{cli/api/workflow.mjs → api/workflows/workflow-BjM2xCa6.mjs} +23 -3
  50. package/dist/exports/api/workflows/zod-Br0enFWK.mjs +12333 -0
  51. package/dist/exports/api/zod-CdrJdBtV.mjs +12571 -0
  52. package/dist/exports/cli/auth-schema-CNuOqPi-.mjs +2813 -0
  53. package/dist/exports/{api/workflows/_virtual/rolldown_runtime.mjs → cli/chunk-B36mNPO4.mjs} +5 -1
  54. package/dist/exports/cli/extract-blob-metadata-CV1Ke90d.mjs +9818 -0
  55. package/dist/exports/cli/{api/workflows/generate-image-variant.mjs → generate-image-variant-CM1BrVvZ.mjs} +20 -20
  56. package/dist/exports/{api/workflows/generate-preview.mjs → cli/generate-preview-DdHQ3ukz.mjs} +6 -6
  57. package/dist/exports/cli/index.d.mts +2142 -2
  58. package/dist/exports/cli/index.mjs +41 -1
  59. package/dist/exports/cli/pdf-CLUPEIdT.mjs +25822 -0
  60. package/dist/exports/{api/workflows/purge-attachment.mjs → cli/purge-attachment-Dc_J74dG.mjs} +3 -3
  61. package/dist/exports/cli/purge-audit-logs-DFhWh-Bx.mjs +56 -0
  62. package/dist/exports/cli/purge-unattached-blobs-C1MRlM_2.mjs +46 -0
  63. package/dist/exports/cli/track-db-changes-CfneOF2_.mjs +20943 -0
  64. package/dist/exports/{api/workflows/api/workflow.mjs → cli/workflow-DSbbXBMt.mjs} +23 -3
  65. package/dist/exports/cli/zod-7q0_Mtnn.mjs +12333 -0
  66. package/dist/exports/devtools/BaseTanStackRouterDevtoolsPanel-BBz1qLry-DUwdvyLv.js +2090 -0
  67. package/dist/exports/devtools/EIDV623S-B7f6114d.js +2497 -0
  68. package/dist/exports/devtools/FloatingTanStackRouterDevtools-DymJEvfG-BHuQHiRR.js +237 -0
  69. package/dist/exports/devtools/MIMHJGAX-Cb3wf11F.js +10903 -0
  70. package/dist/exports/devtools/Q7LWSL4U-BoEO3rNq.js +37 -0
  71. package/dist/exports/devtools/VLTTJS3N-CIyRc84e.js +44 -0
  72. package/dist/exports/devtools/index.js +1724 -3
  73. package/dist/exports/devtools/utils-YRTCpRgb.js +1670 -0
  74. package/dist/exports/tests/api.d.mts +7354 -5
  75. package/dist/exports/tests/api.mjs +79 -1
  76. package/dist/exports/tests/auth-schema-DUCJw-_2.mjs +1 -0
  77. package/dist/exports/tests/chunk-Cii4FAhs.mjs +1 -0
  78. package/dist/exports/tests/conditions-B0ffVJ5E.mjs +1 -0
  79. package/dist/exports/tests/constants-DHjjg05J.mjs +1 -0
  80. package/dist/exports/tests/dist-D6vgKv3t.mjs +7 -0
  81. package/dist/exports/tests/dist-EfrRkq5c.mjs +296 -0
  82. package/dist/exports/tests/extract-blob-metadata-Dv343Vcn.mjs +169 -0
  83. package/dist/exports/tests/generate-image-variant-cQc8q0kh.mjs +1 -0
  84. package/dist/exports/tests/generate-preview-HaTMd2hS.mjs +1 -0
  85. package/dist/exports/tests/magic-string.es-D6VRmdiF.mjs +14 -0
  86. package/dist/exports/tests/mock-BvkO5nlm.mjs +1 -0
  87. package/dist/exports/tests/mock.mjs +1 -1
  88. package/dist/exports/tests/pdf-BDsS3vjF.mjs +13 -0
  89. package/dist/exports/tests/purge-attachment-D4uOzHRi.mjs +1 -0
  90. package/dist/exports/tests/purge-audit-logs-DiPcc09d.mjs +1 -0
  91. package/dist/exports/tests/purge-unattached-blobs-CqW6tlIC.mjs +1 -0
  92. package/dist/exports/tests/react.mjs +6 -1
  93. package/dist/exports/tests/setup.d.mts +1 -1
  94. package/dist/exports/tests/setup.mjs +34 -1
  95. package/dist/exports/tests/table-CbU04119.mjs +1 -0
  96. package/dist/exports/tests/track-db-changes-Bd4W-P1q.mjs +1 -0
  97. package/dist/exports/tests/vi.2VT5v0um-Cme1b0Dl.mjs +348 -0
  98. package/dist/exports/tests/{api/workflow.mjs → workflow-DwZxTqdH.mjs} +1 -1
  99. package/dist/exports/tests/zod-DcpxsMPz.mjs +23 -0
  100. package/dist/exports/vendors/date.js +13236 -1
  101. package/dist/exports/vendors/toolkit.js +2206 -1
  102. package/dist/exports/vendors/zod.js +12344 -1
  103. package/dist/exports/vite/api-DGRU_RdM.mjs +27 -0
  104. package/dist/exports/vite/build-CxJAu2Bn.mjs +1 -0
  105. package/dist/exports/vite/build2-BMK0OFVt.mjs +16 -0
  106. package/dist/exports/vite/chunk-CxnlK1Zi.mjs +1 -0
  107. package/dist/exports/vite/chunk-PtveFMYu.mjs +1 -0
  108. package/dist/exports/vite/dist-Bxp8DqWh.mjs +114 -0
  109. package/dist/exports/vite/dist-CX51FKbX.mjs +1 -0
  110. package/dist/exports/vite/dist-DcyNr-KR.mjs +1 -0
  111. package/dist/exports/vite/dist-j3-Khlzt.mjs +1 -0
  112. package/dist/exports/vite/experimental-index-3KsfmUbz.mjs +1 -0
  113. package/dist/exports/vite/false-BNJbUKYT.mjs +1 -0
  114. package/dist/exports/vite/false-BvrPEDU6.mjs +1 -0
  115. package/dist/exports/vite/index.d.mts +1 -1
  116. package/dist/exports/vite/index.mjs +26 -1
  117. package/dist/exports/vite/internal-C5cVwRiK.mjs +1 -0
  118. package/dist/exports/vite/jiti-BjSPrFvg.mjs +9 -0
  119. package/dist/exports/vite/lexer-DQCqS3nf-C6xCDOEQ.mjs +3 -0
  120. package/dist/exports/vite/lib-CMv7Sfwa.mjs +1 -0
  121. package/dist/exports/vite/lib-D9TnS-7w.mjs +1 -0
  122. package/dist/exports/vite/lib-DuBRr9dH.mjs +382 -0
  123. package/dist/exports/vite/node-DI8AnY_i.mjs +437 -0
  124. package/dist/exports/vite/postcss-BtmDpj-c.mjs +32 -0
  125. package/dist/exports/vite/postcss-import-Bk_ZCd6c.mjs +5 -0
  126. package/dist/exports/vite/rolldown-build-CNW2eye_-CJNfyXdF.mjs +13 -0
  127. package/dist/exports/vitest/api-CPv6lnxG.mjs +27 -0
  128. package/dist/exports/vitest/build2-28i3OiJ3.mjs +16 -0
  129. package/dist/exports/vitest/chunk-_e2jlDPK.mjs +1 -0
  130. package/dist/exports/vitest/chunk-jwDkFoXW.mjs +1 -0
  131. package/dist/exports/vitest/config.mjs +77 -1
  132. package/dist/exports/vitest/dist-L-OpshPJ.mjs +114 -0
  133. package/dist/exports/vitest/index.mjs +348 -1
  134. package/dist/exports/vitest/jiti-eNGOyHIo.mjs +9 -0
  135. package/dist/exports/vitest/lexer-DQCqS3nf-TWLyIqlY.mjs +3 -0
  136. package/dist/exports/vitest/lib-C3G64csm.mjs +1 -0
  137. package/dist/exports/vitest/magic-string.es-CxM5Ubyl.mjs +14 -0
  138. package/dist/exports/vitest/module-runner-DsF4L04D.mjs +1 -0
  139. package/dist/exports/vitest/postcss-BxLp_Too.mjs +32 -0
  140. package/dist/exports/vitest/postcss-import-5pKj3f5q.mjs +5 -0
  141. package/dist/exports/web/browser-ponyfill-DxTJMXNq.js +443 -0
  142. package/dist/exports/web/chunk-DksrlJLg.js +49 -0
  143. package/dist/exports/web/index.d.ts +2546 -2
  144. package/dist/exports/web/index.js +9295 -6
  145. package/dist/exports/web/plugin-DqTFWG7p.js +250 -0
  146. package/package.json +1 -1
  147. package/dist/exports/api/app-context.d.mts +0 -115
  148. package/dist/exports/api/app-context.mjs +0 -24
  149. package/dist/exports/api/auth-schema.d.mts +0 -4248
  150. package/dist/exports/api/auth.d.mts +0 -402
  151. package/dist/exports/api/auth.mjs +0 -188
  152. package/dist/exports/api/cache.d.mts +0 -44
  153. package/dist/exports/api/cache.mjs +0 -28
  154. package/dist/exports/api/config.d.mts +0 -28
  155. package/dist/exports/api/config.mjs +0 -72
  156. package/dist/exports/api/constants.mjs +0 -92
  157. package/dist/exports/api/container.d.mts +0 -210
  158. package/dist/exports/api/container.mjs +0 -49
  159. package/dist/exports/api/database.d.mts +0 -101
  160. package/dist/exports/api/database.mjs +0 -219
  161. package/dist/exports/api/event.d.mts +0 -235
  162. package/dist/exports/api/event.mjs +0 -236
  163. package/dist/exports/api/i18n.d.mts +0 -34
  164. package/dist/exports/api/i18n.mjs +0 -45
  165. package/dist/exports/api/instrumentation.d.mts +0 -7
  166. package/dist/exports/api/instrumentation.mjs +0 -40
  167. package/dist/exports/api/logger.d.mts +0 -21
  168. package/dist/exports/api/logger.mjs +0 -26
  169. package/dist/exports/api/mailer.d.mts +0 -70
  170. package/dist/exports/api/mailer.mjs +0 -37
  171. package/dist/exports/api/middleware/request-logger.d.mts +0 -24
  172. package/dist/exports/api/middleware.d.mts +0 -39
  173. package/dist/exports/api/middleware.mjs +0 -73
  174. package/dist/exports/api/openapi.d.mts +0 -271
  175. package/dist/exports/api/openapi.mjs +0 -507
  176. package/dist/exports/api/otel.d.mts +0 -40
  177. package/dist/exports/api/otel.mjs +0 -56
  178. package/dist/exports/api/redis.d.mts +0 -34
  179. package/dist/exports/api/redis.mjs +0 -41
  180. package/dist/exports/api/storage-schema.d.mts +0 -707
  181. package/dist/exports/api/storage-schema.mjs +0 -72
  182. package/dist/exports/api/storage.d.mts +0 -506
  183. package/dist/exports/api/storage.mjs +0 -833
  184. package/dist/exports/api/web/auth.mjs +0 -17
  185. package/dist/exports/api/workflow.d.mts +0 -250
  186. package/dist/exports/api/workflows/api/auth-schema.mjs +0 -373
  187. package/dist/exports/api/workflows/api/auth.d.mts +0 -379
  188. package/dist/exports/api/workflows/api/cache.d.mts +0 -44
  189. package/dist/exports/api/workflows/api/config.d.mts +0 -18
  190. package/dist/exports/api/workflows/api/container.d.mts +0 -167
  191. package/dist/exports/api/workflows/api/database.d.mts +0 -47
  192. package/dist/exports/api/workflows/api/event.d.mts +0 -68
  193. package/dist/exports/api/workflows/api/event.mjs +0 -126
  194. package/dist/exports/api/workflows/api/logger.d.mts +0 -21
  195. package/dist/exports/api/workflows/api/mailer.d.mts +0 -70
  196. package/dist/exports/api/workflows/api/orm.d.mts +0 -13
  197. package/dist/exports/api/workflows/api/redis.mjs +0 -3
  198. package/dist/exports/api/workflows/api/storage-schema.d.mts +0 -699
  199. package/dist/exports/api/workflows/api/storage.d.mts +0 -396
  200. package/dist/exports/api/workflows/api/workflow.d.mts +0 -24
  201. package/dist/exports/api/workflows/constants.mjs +0 -23
  202. package/dist/exports/api/workflows/extract-blob-metadata.mjs +0 -132
  203. package/dist/exports/api/workflows/generate-image-variant.d.mts +0 -63
  204. package/dist/exports/api/workflows/track-db-changes.d.mts +0 -72
  205. package/dist/exports/cli/api/auth-schema.mjs +0 -373
  206. package/dist/exports/cli/api/auth.d.mts +0 -379
  207. package/dist/exports/cli/api/cache.d.mts +0 -44
  208. package/dist/exports/cli/api/config.d.mts +0 -18
  209. package/dist/exports/cli/api/container.d.mts +0 -167
  210. package/dist/exports/cli/api/database.d.mts +0 -47
  211. package/dist/exports/cli/api/event.d.mts +0 -68
  212. package/dist/exports/cli/api/event.mjs +0 -126
  213. package/dist/exports/cli/api/logger.d.mts +0 -21
  214. package/dist/exports/cli/api/mailer.d.mts +0 -70
  215. package/dist/exports/cli/api/orm.d.mts +0 -13
  216. package/dist/exports/cli/api/redis.mjs +0 -3
  217. package/dist/exports/cli/api/storage-schema.d.mts +0 -699
  218. package/dist/exports/cli/api/storage.d.mts +0 -396
  219. package/dist/exports/cli/api/workflow.d.mts +0 -2
  220. package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +0 -132
  221. package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +0 -63
  222. package/dist/exports/cli/api/workflows/track-db-changes.mjs +0 -110
  223. package/dist/exports/cli/command.d.mts +0 -56
  224. package/dist/exports/cli/command.mjs +0 -43
  225. package/dist/exports/cli/constants.mjs +0 -23
  226. package/dist/exports/cli/context.d.mts +0 -170
  227. package/dist/exports/tests/_virtual/rolldown_runtime.mjs +0 -1
  228. package/dist/exports/tests/api/app-context.d.mts +0 -115
  229. package/dist/exports/tests/api/app-context.mjs +0 -1
  230. package/dist/exports/tests/api/auth-schema.d.mts +0 -4248
  231. package/dist/exports/tests/api/auth-schema.mjs +0 -1
  232. package/dist/exports/tests/api/auth.d.mts +0 -402
  233. package/dist/exports/tests/api/cache.d.mts +0 -44
  234. package/dist/exports/tests/api/config.d.mts +0 -28
  235. package/dist/exports/tests/api/container.d.mts +0 -210
  236. package/dist/exports/tests/api/database.d.mts +0 -101
  237. package/dist/exports/tests/api/database.mjs +0 -1
  238. package/dist/exports/tests/api/event.d.mts +0 -235
  239. package/dist/exports/tests/api/event.mjs +0 -1
  240. package/dist/exports/tests/api/i18n.d.mts +0 -34
  241. package/dist/exports/tests/api/index.d.mts +0 -26
  242. package/dist/exports/tests/api/logger.d.mts +0 -21
  243. package/dist/exports/tests/api/mailer.d.mts +0 -70
  244. package/dist/exports/tests/api/middleware/error-handler.mjs +0 -1
  245. package/dist/exports/tests/api/middleware/health.mjs +0 -1
  246. package/dist/exports/tests/api/middleware/i18n.mjs +0 -1
  247. package/dist/exports/tests/api/middleware/request-logger.d.mts +0 -24
  248. package/dist/exports/tests/api/middleware/request-logger.mjs +0 -1
  249. package/dist/exports/tests/api/middleware/shutdown.mjs +0 -1
  250. package/dist/exports/tests/api/middleware/timeout.mjs +0 -1
  251. package/dist/exports/tests/api/middleware.d.mts +0 -39
  252. package/dist/exports/tests/api/middleware.mjs +0 -1
  253. package/dist/exports/tests/api/openapi.d.mts +0 -271
  254. package/dist/exports/tests/api/openapi.mjs +0 -1
  255. package/dist/exports/tests/api/orm.d.mts +0 -13
  256. package/dist/exports/tests/api/otel.d.mts +0 -40
  257. package/dist/exports/tests/api/redis.d.mts +0 -34
  258. package/dist/exports/tests/api/redis.mjs +0 -1
  259. package/dist/exports/tests/api/server.mjs +0 -1
  260. package/dist/exports/tests/api/storage-schema.d.mts +0 -707
  261. package/dist/exports/tests/api/storage.d.mts +0 -506
  262. package/dist/exports/tests/api/workflow.d.mts +0 -250
  263. package/dist/exports/tests/api/workflows/extract-blob-metadata.mjs +0 -1
  264. package/dist/exports/tests/api/workflows/generate-image-variant.d.mts +0 -63
  265. package/dist/exports/tests/api/workflows/generate-image-variant.mjs +0 -1
  266. package/dist/exports/tests/api/workflows/generate-preview.mjs +0 -1
  267. package/dist/exports/tests/api/workflows/purge-attachment.mjs +0 -1
  268. package/dist/exports/tests/api/workflows/purge-audit-logs.mjs +0 -1
  269. package/dist/exports/tests/api/workflows/purge-unattached-blobs.mjs +0 -1
  270. package/dist/exports/tests/api/workflows/track-db-changes.mjs +0 -1
  271. package/dist/exports/tests/constants.mjs +0 -1
  272. package/dist/exports/tests/instrumentation.d.mts +0 -7
  273. package/dist/exports/tests/instrumentation.mjs +0 -1
  274. package/dist/exports/web/api/auth.d.ts +0 -125
  275. package/dist/exports/web/api/database.d.ts +0 -4
  276. package/dist/exports/web/api/logger.d.ts +0 -1
  277. package/dist/exports/web/auth.d.ts +0 -2388
  278. package/dist/exports/web/auth.js +0 -75
  279. package/dist/exports/web/i18n.d.ts +0 -42
  280. package/dist/exports/web/i18n.js +0 -45
  281. /package/dist/exports/tests/{api/middleware/youch-handler.mjs → youch-handler-Ch5yf6im.mjs} +0 -0
@@ -1,3 +1,2143 @@
1
- import { CommandContext } from "./context.mjs";
2
- import { Command, defineCommand } from "./command.mjs";
1
+ import { n as __export, r as __reExport } from "./chunk-B36mNPO4.mjs";
2
+ import { z } from "zod";
3
+ import { CorsOptions } from "cors";
4
+ import { Options } from "express-rate-limit";
5
+ import { HelmetOptions } from "helmet";
6
+ import { i18n } from "i18next";
7
+ import { betterAuth } from "better-auth";
8
+ import { Role, createAccessControl } from "better-auth/plugins/access";
9
+ import * as drizzle_orm2 from "drizzle-orm";
10
+ import { AnyRelations, EmptyRelations, ExtractTablesWithRelations } from "drizzle-orm";
11
+ import * as drizzle_orm_node_postgres0 from "drizzle-orm/node-postgres";
12
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
13
+ import * as pg0 from "pg";
14
+ import pg, { Pool } from "pg";
15
+ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
16
+ import { index, isPgEnum, isPgMaterializedView, isPgSchema, isPgSequence, isPgView, numeric, parsePgArray, parsePgNestedArray, pgEnum, pgMaterializedView, pgPolicy, pgRole, pgSchema, pgSequence, pgTable, pgTableCreator, pgView, serial, smallint, smallserial, sparsevec, unique, uniqueIndex, uniqueKeyName, withReplicas } from "drizzle-orm/pg-core";
17
+ import pino, { LoggerOptions } from "pino";
18
+ import * as _keyv_redis0 from "@keyv/redis";
19
+ import { KeyvRedisOptions } from "@keyv/redis";
20
+ import Mail from "nodemailer/lib/mailer/index.ts";
21
+ import { JSX } from "react";
22
+ import { DriveManager } from "flydrive";
23
+ import { FSDriverOptions } from "flydrive/drivers/fs/types";
24
+ import { S3DriverOptions } from "flydrive/drivers/s3/types";
25
+ import "@dbos-inc/dbos-sdk";
26
+ import * as p from "@clack/prompts";
27
+
28
+ //#region src/api/logger.d.ts
29
+ /**
30
+ * Extended logger options with OpenTelemetry support.
31
+ */
32
+ interface DefineLoggerOptions extends LoggerOptions {}
33
+ /**
34
+ * The logger instance type.
35
+ */
36
+ type Logger = Awaited<ReturnType<typeof defineLogger>>;
37
+ /**
38
+ * Define the logger instance.
39
+ *
40
+ * @param opts - The options.
41
+ * @returns The logger.
42
+ */
43
+ declare function defineLogger(opts: DefineLoggerOptions): Promise<pino.Logger<never, boolean>>;
44
+ //#endregion
45
+ //#region src/api/database.d.ts
46
+ type PoolConfig = pg.PoolConfig;
47
+ /**
48
+ * Extract qualified table names from db object.
49
+ */
50
+ type QualifiedTableNames<TDb> = { [K in keyof TDb]: TDb[K] extends {
51
+ _: {
52
+ fullSchema: infer S;
53
+ };
54
+ } ? `${K & string}.${keyof S & string}` : never }[keyof TDb];
55
+ /**
56
+ * Options for defining the database.
57
+ */
58
+ interface DefineDatabaseOptions<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations> {
59
+ logger: Logger;
60
+ poolConfig: PoolConfig;
61
+ relations?: TRelations;
62
+ schema?: TSchema;
63
+ }
64
+ /**
65
+ * The database type.
66
+ */
67
+ type Database = Awaited<ReturnType<typeof defineDatabase>>;
68
+ /**
69
+ * Define the database with the provided options.
70
+ *
71
+ * Algorithm:
72
+ * 1. Create a connection pool with sensible defaults
73
+ * 2. Initialize drizzle ORM with schema and relations
74
+ *
75
+ * @param opts The options for defining the database, including pool configuration, relations, and schema.
76
+ * @template TSchema The schema type for the database.
77
+ * @template TRelations The relations type for the database.
78
+ * @returns The defined database instance.
79
+ */
80
+ declare function defineDatabase<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations>(opts: DefineDatabaseOptions<TSchema, TRelations>): Promise<drizzle_orm_node_postgres0.NodePgDatabase<TSchema, TRelations> & {
81
+ $client: pg0.Pool;
82
+ }>;
83
+ //#endregion
84
+ //#region src/api/auth.d.ts
85
+ /**
86
+ * Type for access controller created via createAccessControl().
87
+ * Used for RBAC on both server and client.
88
+ */
89
+ type AccessController = ReturnType<typeof createAccessControl>;
90
+ /**
91
+ * Type for roles created via ac.newRole().
92
+ * Uses Role type from better-auth for compatibility.
93
+ */
94
+ type AccessControlRoles = Record<string, Role>;
95
+ /**
96
+ * Type-safe audit log options for defineAuth().
97
+ * Generic over db object to provide autocomplete for excludeTables.
98
+ *
99
+ * @template TDb - Database record type for table name inference
100
+ */
101
+ type AuditLogOptions<TDb> = {
102
+ /**
103
+ * Tables to exclude from audit logging.
104
+ */
105
+ excludeTables?: QualifiedTableNames<TDb>[];
106
+ /**
107
+ * Cron expression for purge schedule.
108
+ *
109
+ * @default "0 0 * * *"
110
+ */
111
+ purgeCron?: string;
112
+ /**
113
+ * Retention period in days. Audit logs older than this are auto-deleted.
114
+ * @default 90
115
+ */
116
+ retentionDays?: number;
117
+ };
118
+ /**
119
+ * Neutral auth configuration - shared between server and client.
120
+ * Contains ONLY fields that affect both sides (UI + server features).
121
+ *
122
+ * PRESENCE-BASED CONFIG: If a key exists, it's enabled. No redundant `enabled` fields.
123
+ * Server-only fields (appName, session) are passed via DefineAuthOptions.
124
+ */
125
+ interface AuthConfig {
126
+ /**
127
+ * Base URL where auth server is hosted.
128
+ *
129
+ * @default "" (same origin - client uses relative URLs)
130
+ * @example "http://localhost:8000" for cross-origin
131
+ */
132
+ baseURL?: string;
133
+ /**
134
+ * Base path for auth routes.
135
+ *
136
+ * @default "/auth"
137
+ */
138
+ basePath?: string;
139
+ /** Authentication methods - if defined, it's enabled */
140
+ methods?: {
141
+ /** Email/password auth. If defined, enabled. */
142
+ emailPassword?: {
143
+ requireEmailVerification?: boolean;
144
+ minPasswordLength?: number;
145
+ maxPasswordLength?: number;
146
+ };
147
+ /** Magic link auth. If defined, enabled. */
148
+ magicLink?: {
149
+ expiresIn?: number;
150
+ };
151
+ /** Passkey auth. If defined (even as empty object), enabled. */
152
+ passkey?: Record<string, never>;
153
+ /** Phone OTP auth. If defined, enabled. */
154
+ phoneOtp?: {
155
+ otpLength?: number;
156
+ expiresIn?: number;
157
+ };
158
+ /** Email OTP auth. If defined, enabled. */
159
+ emailOtp?: {
160
+ otpLength?: number;
161
+ expiresIn?: number;
162
+ };
163
+ };
164
+ /** OAuth providers - true = enabled, undefined/false = disabled */
165
+ oauth?: {
166
+ google?: boolean;
167
+ github?: boolean;
168
+ apple?: boolean;
169
+ facebook?: boolean;
170
+ };
171
+ /** Plugins - if defined, it's enabled */
172
+ plugins?: {
173
+ /** Admin plugin. If defined, enabled. Includes RBAC for both server and client. */
174
+ admin?: {
175
+ defaultRole?: string;
176
+ adminRoles?: string[];
177
+ /** Access controller created via createAccessControl() - shared between server and client */
178
+ ac: AccessController;
179
+ /** Role definitions created via ac.newRole() - shared between server and client */
180
+ roles: AccessControlRoles;
181
+ };
182
+ /** API key plugin. If defined, enabled. */
183
+ apiKey?: {
184
+ defaultPrefix?: string;
185
+ defaultKeyLength?: number;
186
+ rateLimit?: {
187
+ maxRequests?: number;
188
+ timeWindow?: number;
189
+ };
190
+ };
191
+ /** Two-factor plugin. If defined, enabled. Sub-features also presence-based. */
192
+ twoFactor?: {
193
+ issuer?: string;
194
+ totp?: {
195
+ digits?: 6 | 8;
196
+ period?: number;
197
+ };
198
+ otp?: boolean;
199
+ backupCodes?: {
200
+ amount?: number;
201
+ length?: number;
202
+ };
203
+ };
204
+ /** Multi-session plugin. If defined, enabled. */
205
+ multiSession?: {
206
+ maximumSessions?: number;
207
+ };
208
+ /** Username plugin. If defined, enabled. */
209
+ username?: {
210
+ minUsernameLength?: number;
211
+ maxUsernameLength?: number;
212
+ };
213
+ /** Anonymous auth plugin. If defined, enabled. */
214
+ anonymous?: {
215
+ emailDomainName?: string;
216
+ };
217
+ /** SSO plugin. If defined, enabled. Import from @better-auth/sso */
218
+ sso?: {
219
+ providersLimit?: number;
220
+ trustEmailVerified?: boolean;
221
+ domainVerification?: boolean;
222
+ };
223
+ };
224
+ }
225
+ /** Base hook types for reference */
226
+ type EmailHook = (params: {
227
+ email: string;
228
+ url: string;
229
+ token: string;
230
+ }) => Promise<void>;
231
+ type OtpHook = (params: {
232
+ email: string;
233
+ otp: string;
234
+ }) => Promise<void>;
235
+ type PhoneOtpHook = (params: {
236
+ phoneNumber: string;
237
+ otp: string;
238
+ }) => Promise<void>;
239
+ /**
240
+ * Conditionally required hooks based on config.
241
+ * Uses PRESENCE-BASED detection - if key exists, hook is REQUIRED.
242
+ */
243
+ type RequiredHooks<T extends AuthConfig> = (T["methods"] extends {
244
+ emailPassword: {
245
+ requireEmailVerification: true;
246
+ };
247
+ } ? {
248
+ sendVerificationEmail: EmailHook;
249
+ } : {
250
+ sendVerificationEmail?: EmailHook;
251
+ }) & (T["methods"] extends {
252
+ emailPassword: object;
253
+ } ? {
254
+ sendResetPasswordEmail: EmailHook;
255
+ } : {
256
+ sendResetPasswordEmail?: EmailHook;
257
+ }) & (T["methods"] extends {
258
+ magicLink: object;
259
+ } ? {
260
+ sendMagicLink: EmailHook;
261
+ } : {
262
+ sendMagicLink?: EmailHook;
263
+ }) & (T["methods"] extends {
264
+ emailOtp: object;
265
+ } ? {
266
+ sendEmailOTP: OtpHook;
267
+ } : {
268
+ sendEmailOTP?: OtpHook;
269
+ }) & (T["methods"] extends {
270
+ phoneOtp: object;
271
+ } ? {
272
+ sendPhoneOTP: PhoneOtpHook;
273
+ } : {
274
+ sendPhoneOTP?: PhoneOtpHook;
275
+ }) & (T["plugins"] extends {
276
+ twoFactor: {
277
+ otp: true;
278
+ };
279
+ } ? {
280
+ send2FAOTP: OtpHook;
281
+ } : {
282
+ send2FAOTP?: OtpHook;
283
+ });
284
+ /**
285
+ * Conditionally required OAuth credentials based on config.
286
+ * If an OAuth provider is enabled in config, its credentials are REQUIRED.
287
+ */
288
+ type RequiredOAuth<T extends AuthConfig> = (T["oauth"] extends {
289
+ google: true;
290
+ } ? {
291
+ google: {
292
+ clientId: string;
293
+ clientSecret: string;
294
+ };
295
+ } : {
296
+ google?: {
297
+ clientId: string;
298
+ clientSecret: string;
299
+ };
300
+ }) & (T["oauth"] extends {
301
+ github: true;
302
+ } ? {
303
+ github: {
304
+ clientId: string;
305
+ clientSecret: string;
306
+ };
307
+ } : {
308
+ github?: {
309
+ clientId: string;
310
+ clientSecret: string;
311
+ };
312
+ }) & (T["oauth"] extends {
313
+ apple: true;
314
+ } ? {
315
+ apple: {
316
+ clientId: string;
317
+ clientSecret: string;
318
+ };
319
+ } : {
320
+ apple?: {
321
+ clientId: string;
322
+ clientSecret: string;
323
+ };
324
+ }) & (T["oauth"] extends {
325
+ facebook: true;
326
+ } ? {
327
+ facebook: {
328
+ clientId: string;
329
+ clientSecret: string;
330
+ };
331
+ } : {
332
+ facebook?: {
333
+ clientId: string;
334
+ clientSecret: string;
335
+ };
336
+ });
337
+ /** Check if any OAuth provider is enabled */
338
+ type HasOAuthEnabled<T extends AuthConfig> = T["oauth"] extends {
339
+ google: true;
340
+ } | {
341
+ github: true;
342
+ } | {
343
+ apple: true;
344
+ } | {
345
+ facebook: true;
346
+ } ? true : false;
347
+ /** Check if passkey is enabled */
348
+ type HasPasskeyEnabled<T extends AuthConfig> = T["methods"] extends {
349
+ passkey: object;
350
+ } ? true : false;
351
+ /**
352
+ * Server-only session configuration.
353
+ */
354
+ interface AuthSessionConfig {
355
+ /**
356
+ * Session duration in seconds.
357
+ *
358
+ * @default 604800 (7 days)
359
+ */
360
+ expiresIn?: number;
361
+ /**
362
+ * How often to update session in seconds.
363
+ *
364
+ * @default 86400 (1 day)
365
+ */
366
+ updateAge?: number;
367
+ /**
368
+ * Session freshness in seconds for sensitive ops.
369
+ *
370
+ * @default 86400 (1 day)
371
+ */
372
+ freshAge?: number;
373
+ }
374
+ /**
375
+ * Server-only passkey configuration (required if passkey is enabled).
376
+ */
377
+ interface AuthPasskeyConfig {
378
+ /**
379
+ * Relying Party ID - domain for passkey (e.g., "example.com" or "localhost").
380
+ */
381
+ rpID: string;
382
+ /**
383
+ * Origin URL for passkey verification (e.g., "http://localhost:8000").
384
+ */
385
+ origin: string;
386
+ }
387
+ /**
388
+ * Fully type-safe options for defineAuth().
389
+ *
390
+ * Server-only fields:
391
+ * - `appName` - Application name for passkey rpName, TOTP issuer, emails
392
+ * - `auditLog` - Audit logging configuration
393
+ * - `session` - Session duration and freshness settings
394
+ *
395
+ * Conditional requirements:
396
+ * - If config has `oauth.google: true`, then `oauth.google` credentials are REQUIRED
397
+ * - If config has `methods.magicLink` defined, then `hooks.sendMagicLink` is REQUIRED
398
+ *
399
+ * @template T - Auth config type
400
+ * @template TDb - Database record type for type-safe excludeTables
401
+ */
402
+ type DefineAuthOptions<T extends AuthConfig, TDb = unknown> = {
403
+ /**
404
+ * The application name.
405
+ */
406
+ appName: string;
407
+ /**
408
+ * Audit logging configuration (server-only). Use qualified table names: "dbName.tableName".
409
+ */
410
+ auditLog?: AuditLogOptions<TDb>;
411
+ /**
412
+ * The neutral auth configuration.
413
+ */
414
+ config: T;
415
+ /**
416
+ * Full db object (container.db) for type inference.
417
+ */
418
+ db: TDb;
419
+ /**
420
+ * Primary database for Better Auth storage.
421
+ */
422
+ database: Database;
423
+ /**
424
+ * Hooks for email sending and OTP delivery.
425
+ */
426
+ hooks: RequiredHooks<T>;
427
+ /**
428
+ * Secret key for signing tokens and cookies.
429
+ */
430
+ secret: string;
431
+ /**
432
+ * Session configuration.
433
+ */
434
+ session?: AuthSessionConfig;
435
+ } & (HasOAuthEnabled<T> extends true ? {
436
+ oauth: RequiredOAuth<T>;
437
+ } : {
438
+ oauth?: RequiredOAuth<T>;
439
+ }) & (HasPasskeyEnabled<T> extends true ? {
440
+ passkey: AuthPasskeyConfig;
441
+ } : {
442
+ passkey?: AuthPasskeyConfig;
443
+ });
444
+ /**
445
+ * Defines Better Auth instance from neutral config + server dependencies.
446
+ */
447
+ declare function defineAuth<T extends AuthConfig, TDb extends Record<"primary", Database> & Record<string, Database> = Record<"primary", Database> & Record<string, Database>>(opts: DefineAuthOptions<T, TDb>): ReturnType<typeof betterAuth> & {
448
+ auditLog?: AuditLogOptions<TDb>;
449
+ shouldAudit(tableName: QualifiedTableNames<TDb>): boolean;
450
+ };
451
+ /**
452
+ * The auth instance type.
453
+ */
454
+ type Auth<TDb extends Record<"primary", Database> & Record<string, Database> = Record<"primary", Database> & Record<string, Database>> = ReturnType<typeof defineAuth<AuthConfig, TDb>>;
455
+ //#endregion
456
+ //#region src/api/cache.d.ts
457
+ /**
458
+ * The cache instance type.
459
+ */
460
+ type Cache = ReturnType<typeof defineCache>;
461
+ /**
462
+ * Options for defining the cache.
463
+ */
464
+ type DefineCacheOptions = {
465
+ /**
466
+ * Redis URL(s). Single or comma-separated for cluster.
467
+ */
468
+ url: string;
469
+ /**
470
+ * The logger instance.
471
+ */
472
+ logger: Logger;
473
+ /**
474
+ * The Keyv Redis options.
475
+ */
476
+ options?: KeyvRedisOptions;
477
+ };
478
+ /**
479
+ * Define the cache instance using shared Redis client.
480
+ * Connection is lazy - only connects when first cache operation is performed.
481
+ *
482
+ * Algorithm:
483
+ * 1. Create Redis client using defineRedisClient() (lazy connection)
484
+ * 2. Pass client to createKeyv() - connection happens on first use
485
+ *
486
+ * @param opts - The options for defining the cache.
487
+ * @returns The cache instance.
488
+ */
489
+ declare function defineCache({
490
+ url,
491
+ logger,
492
+ options
493
+ }: DefineCacheOptions): _keyv_redis0.Keyv<any>;
494
+ //#endregion
495
+ //#region src/api/config.d.ts
496
+ /**
497
+ * The config base schema.
498
+ */
499
+ declare const baseSchema: z.ZodObject<{
500
+ APP_NAME: z.ZodDefault<z.ZodString>;
501
+ APP_DESC: z.ZodDefault<z.ZodString>;
502
+ APP_VERSION: z.ZodDefault<z.ZodString>;
503
+ }, z.core.$strip>;
504
+ /**
505
+ * The configuration type inferred from the merged schema.
506
+ */
507
+ type Config<T extends z.ZodRawShape = {}> = z.infer<ReturnType<typeof baseSchema.extend<T>>>;
508
+ //#endregion
509
+ //#region src/api/event.d.ts
510
+ /**
511
+ * Options for defining an event bus.
512
+ */
513
+ interface DefineEventBusOptions {
514
+ /**
515
+ * Redis URL for pub/sub.
516
+ */
517
+ dbUrl: string;
518
+ /**
519
+ * Logger instance for error reporting.
520
+ */
521
+ logger: Logger;
522
+ }
523
+ /**
524
+ * The event bus type for container.
525
+ */
526
+ type EventBus = ReturnType<typeof defineEventBus>;
527
+ /**
528
+ * Defines the event bus for pub/sub messaging.
529
+ * Uses Redis for cross-server communication.
530
+ *
531
+ * Algorithm:
532
+ * 1. Create lazy Redis publisher client
533
+ * 2. Create lazy Redis subscriber client
534
+ * 3. Manage subscriptions via callback registry
535
+ * 4. Provide publish/subscribe/close methods
536
+ *
537
+ * @param opts - Event bus configuration
538
+ * @returns Event bus instance
539
+ */
540
+ declare function defineEventBus(opts: DefineEventBusOptions): {
541
+ /**
542
+ * Publish a message to a channel.
543
+ * Auto-connects on first call if not already connected.
544
+ *
545
+ * @param channel - Channel name
546
+ * @param message - Message payload (will be JSON stringified)
547
+ */
548
+ publish(channel: string, message: unknown): Promise<void>;
549
+ /**
550
+ * Subscribe to a channel. Returns unsubscribe function.
551
+ * Uses single connection with callback management.
552
+ *
553
+ * @param channel - Channel name
554
+ * @param callback - Callback for received messages
555
+ * @returns Unsubscribe function
556
+ */
557
+ subscribe(channel: string, callback: (message: unknown) => void): Promise<() => void>;
558
+ /**
559
+ * Check if a channel has any subscribers.
560
+ *
561
+ * @param channel - Channel name
562
+ * @returns true if channel has subscribers
563
+ */
564
+ hasSubscribers(channel: string): boolean;
565
+ /**
566
+ * Close the Redis connections.
567
+ */
568
+ close(): Promise<void>;
569
+ };
570
+ //#endregion
571
+ //#region src/api/mailer.d.ts
572
+ /**
573
+ * The mailer type.
574
+ */
575
+ type Mailer = ReturnType<typeof defineMailer>;
576
+ /**
577
+ * The mailer payload type with React component.
578
+ */
579
+ type MailerPayloadReact = Omit<Mail.Options, "from" | "html" | "text"> & {
580
+ /**
581
+ * The email address to send the email from.
582
+ */
583
+ from?: string;
584
+ /**
585
+ * The React component to render as the email body.
586
+ */
587
+ react: JSX.Element;
588
+ };
589
+ /**
590
+ * The mailer payload type with direct HTML and text.
591
+ */
592
+ type MailerPayloadHtml = Omit<Mail.Options, "from"> & {
593
+ /**
594
+ * The email address to send the email from.
595
+ */
596
+ from?: string;
597
+ /**
598
+ * The HTML content of the email.
599
+ */
600
+ html: string;
601
+ /**
602
+ * The plain text content of the email.
603
+ */
604
+ text: string;
605
+ };
606
+ /**
607
+ * The mailer payload type - supports either React component or direct HTML+text.
608
+ */
609
+ type MailerPayload = MailerPayloadReact | MailerPayloadHtml;
610
+ /**
611
+ * Define the options for the mailer.
612
+ */
613
+ interface DefineMailerOptions {
614
+ /**
615
+ * The default email address to use as the sender.
616
+ */
617
+ from: string;
618
+ /**
619
+ * The SMTP URL to use for sending emails.
620
+ */
621
+ smtpUrl: string;
622
+ }
623
+ /**
624
+ * Define the mailer.
625
+ *
626
+ * @param env - The environment variables.
627
+ * @returns The mailer.
628
+ */
629
+ declare function defineMailer({
630
+ from,
631
+ smtpUrl
632
+ }: DefineMailerOptions): {
633
+ send(payload: MailerPayload): Promise<void>;
634
+ };
635
+ declare namespace orm_d_exports {
636
+ export { index, isPgEnum, isPgMaterializedView, isPgSchema, isPgSequence, isPgView, numeric, parsePgArray, parsePgNestedArray, pgEnum, pgMaterializedView, pgPolicy, pgRole, pgSchema, pgSequence, pgTable, pgTableCreator, pgView, serial, smallint, smallserial, sparsevec, unique, uniqueIndex, uniqueKeyName, withReplicas };
637
+ }
638
+ import * as import_drizzle_orm from "drizzle-orm";
639
+ import * as import_drizzle_seed from "drizzle-seed";
640
+ //#endregion
641
+ //#region src/api/storage-schema.d.ts
642
+ /**
643
+ * Defines the storage schema for file attachments and blob management.
644
+ *
645
+ * @returns An object containing the schema and relations for the storage tables.
646
+ */
647
+ declare function defineStorageSchema(): {
648
+ tables: {
649
+ storageBlobs: drizzle_orm_pg_core0.PgTableWithColumns<{
650
+ name: "storage_blobs";
651
+ schema: undefined;
652
+ columns: {
653
+ id: drizzle_orm_pg_core0.PgColumn<{
654
+ name: string;
655
+ tableName: "storage_blobs";
656
+ dataType: "string";
657
+ data: string;
658
+ driverParam: string;
659
+ notNull: true;
660
+ hasDefault: true;
661
+ isPrimaryKey: true;
662
+ isAutoincrement: false;
663
+ hasRuntimeDefault: false;
664
+ enumValues: [string, ...string[]];
665
+ baseColumn: never;
666
+ identity: undefined;
667
+ generated: undefined;
668
+ }, {}>;
669
+ key: drizzle_orm_pg_core0.PgColumn<{
670
+ name: string;
671
+ tableName: "storage_blobs";
672
+ dataType: "string";
673
+ data: string;
674
+ driverParam: string;
675
+ notNull: true;
676
+ hasDefault: false;
677
+ isPrimaryKey: false;
678
+ isAutoincrement: false;
679
+ hasRuntimeDefault: false;
680
+ enumValues: [string, ...string[]];
681
+ baseColumn: never;
682
+ identity: undefined;
683
+ generated: undefined;
684
+ }, {}>;
685
+ filename: drizzle_orm_pg_core0.PgColumn<{
686
+ name: string;
687
+ tableName: "storage_blobs";
688
+ dataType: "string";
689
+ data: string;
690
+ driverParam: string;
691
+ notNull: true;
692
+ hasDefault: false;
693
+ isPrimaryKey: false;
694
+ isAutoincrement: false;
695
+ hasRuntimeDefault: false;
696
+ enumValues: [string, ...string[]];
697
+ baseColumn: never;
698
+ identity: undefined;
699
+ generated: undefined;
700
+ }, {}>;
701
+ contentType: drizzle_orm_pg_core0.PgColumn<{
702
+ name: string;
703
+ tableName: "storage_blobs";
704
+ dataType: "string";
705
+ data: string;
706
+ driverParam: string;
707
+ notNull: false;
708
+ hasDefault: false;
709
+ isPrimaryKey: false;
710
+ isAutoincrement: false;
711
+ hasRuntimeDefault: false;
712
+ enumValues: [string, ...string[]];
713
+ baseColumn: never;
714
+ identity: undefined;
715
+ generated: undefined;
716
+ }, {}>;
717
+ metadata: drizzle_orm_pg_core0.PgColumn<{
718
+ name: string;
719
+ tableName: "storage_blobs";
720
+ dataType: "object json";
721
+ data: unknown;
722
+ driverParam: unknown;
723
+ notNull: false;
724
+ hasDefault: false;
725
+ isPrimaryKey: false;
726
+ isAutoincrement: false;
727
+ hasRuntimeDefault: false;
728
+ enumValues: undefined;
729
+ baseColumn: never;
730
+ identity: undefined;
731
+ generated: undefined;
732
+ }, {}>;
733
+ serviceName: drizzle_orm_pg_core0.PgColumn<{
734
+ name: string;
735
+ tableName: "storage_blobs";
736
+ dataType: "string";
737
+ data: string;
738
+ driverParam: string;
739
+ notNull: true;
740
+ hasDefault: true;
741
+ isPrimaryKey: false;
742
+ isAutoincrement: false;
743
+ hasRuntimeDefault: false;
744
+ enumValues: [string, ...string[]];
745
+ baseColumn: never;
746
+ identity: undefined;
747
+ generated: undefined;
748
+ }, {}>;
749
+ byteSize: drizzle_orm_pg_core0.PgColumn<{
750
+ name: string;
751
+ tableName: "storage_blobs";
752
+ dataType: "number int53";
753
+ data: number;
754
+ driverParam: string | number;
755
+ notNull: true;
756
+ hasDefault: false;
757
+ isPrimaryKey: false;
758
+ isAutoincrement: false;
759
+ hasRuntimeDefault: false;
760
+ enumValues: undefined;
761
+ baseColumn: never;
762
+ identity: undefined;
763
+ generated: undefined;
764
+ }, {}>;
765
+ checksum: drizzle_orm_pg_core0.PgColumn<{
766
+ name: string;
767
+ tableName: "storage_blobs";
768
+ dataType: "string";
769
+ data: string;
770
+ driverParam: string;
771
+ notNull: false;
772
+ hasDefault: false;
773
+ isPrimaryKey: false;
774
+ isAutoincrement: false;
775
+ hasRuntimeDefault: false;
776
+ enumValues: [string, ...string[]];
777
+ baseColumn: never;
778
+ identity: undefined;
779
+ generated: undefined;
780
+ }, {}>;
781
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
782
+ name: string;
783
+ tableName: "storage_blobs";
784
+ dataType: "string timestamp";
785
+ data: string;
786
+ driverParam: string;
787
+ notNull: true;
788
+ hasDefault: true;
789
+ isPrimaryKey: false;
790
+ isAutoincrement: false;
791
+ hasRuntimeDefault: false;
792
+ enumValues: undefined;
793
+ baseColumn: never;
794
+ identity: undefined;
795
+ generated: undefined;
796
+ }, {}>;
797
+ };
798
+ dialect: "pg";
799
+ }>;
800
+ storageAttachments: drizzle_orm_pg_core0.PgTableWithColumns<{
801
+ name: "storage_attachments";
802
+ schema: undefined;
803
+ columns: {
804
+ id: drizzle_orm_pg_core0.PgColumn<{
805
+ name: string;
806
+ tableName: "storage_attachments";
807
+ dataType: "string";
808
+ data: string;
809
+ driverParam: string;
810
+ notNull: true;
811
+ hasDefault: true;
812
+ isPrimaryKey: true;
813
+ isAutoincrement: false;
814
+ hasRuntimeDefault: false;
815
+ enumValues: [string, ...string[]];
816
+ baseColumn: never;
817
+ identity: undefined;
818
+ generated: undefined;
819
+ }, {}>;
820
+ name: drizzle_orm_pg_core0.PgColumn<{
821
+ name: string;
822
+ tableName: "storage_attachments";
823
+ dataType: "string";
824
+ data: string;
825
+ driverParam: string;
826
+ notNull: true;
827
+ hasDefault: false;
828
+ isPrimaryKey: false;
829
+ isAutoincrement: false;
830
+ hasRuntimeDefault: false;
831
+ enumValues: [string, ...string[]];
832
+ baseColumn: never;
833
+ identity: undefined;
834
+ generated: undefined;
835
+ }, {}>;
836
+ recordType: drizzle_orm_pg_core0.PgColumn<{
837
+ name: string;
838
+ tableName: "storage_attachments";
839
+ dataType: "string";
840
+ data: string;
841
+ driverParam: string;
842
+ notNull: true;
843
+ hasDefault: false;
844
+ isPrimaryKey: false;
845
+ isAutoincrement: false;
846
+ hasRuntimeDefault: false;
847
+ enumValues: [string, ...string[]];
848
+ baseColumn: never;
849
+ identity: undefined;
850
+ generated: undefined;
851
+ }, {}>;
852
+ recordId: drizzle_orm_pg_core0.PgColumn<{
853
+ name: string;
854
+ tableName: "storage_attachments";
855
+ dataType: "string";
856
+ data: string;
857
+ driverParam: string;
858
+ notNull: true;
859
+ hasDefault: false;
860
+ isPrimaryKey: false;
861
+ isAutoincrement: false;
862
+ hasRuntimeDefault: false;
863
+ enumValues: [string, ...string[]];
864
+ baseColumn: never;
865
+ identity: undefined;
866
+ generated: undefined;
867
+ }, {}>;
868
+ blobId: drizzle_orm_pg_core0.PgColumn<{
869
+ name: string;
870
+ tableName: "storage_attachments";
871
+ dataType: "string";
872
+ data: string;
873
+ driverParam: string;
874
+ notNull: true;
875
+ hasDefault: false;
876
+ isPrimaryKey: false;
877
+ isAutoincrement: false;
878
+ hasRuntimeDefault: false;
879
+ enumValues: [string, ...string[]];
880
+ baseColumn: never;
881
+ identity: undefined;
882
+ generated: undefined;
883
+ }, {}>;
884
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
885
+ name: string;
886
+ tableName: "storage_attachments";
887
+ dataType: "string timestamp";
888
+ data: string;
889
+ driverParam: string;
890
+ notNull: true;
891
+ hasDefault: true;
892
+ isPrimaryKey: false;
893
+ isAutoincrement: false;
894
+ hasRuntimeDefault: false;
895
+ enumValues: undefined;
896
+ baseColumn: never;
897
+ identity: undefined;
898
+ generated: undefined;
899
+ }, {}>;
900
+ };
901
+ dialect: "pg";
902
+ }>;
903
+ storageVariantRecords: drizzle_orm_pg_core0.PgTableWithColumns<{
904
+ name: "storage_variant_records";
905
+ schema: undefined;
906
+ columns: {
907
+ id: drizzle_orm_pg_core0.PgColumn<{
908
+ name: string;
909
+ tableName: "storage_variant_records";
910
+ dataType: "string";
911
+ data: string;
912
+ driverParam: string;
913
+ notNull: true;
914
+ hasDefault: true;
915
+ isPrimaryKey: true;
916
+ isAutoincrement: false;
917
+ hasRuntimeDefault: false;
918
+ enumValues: [string, ...string[]];
919
+ baseColumn: never;
920
+ identity: undefined;
921
+ generated: undefined;
922
+ }, {}>;
923
+ blobId: drizzle_orm_pg_core0.PgColumn<{
924
+ name: string;
925
+ tableName: "storage_variant_records";
926
+ dataType: "string";
927
+ data: string;
928
+ driverParam: string;
929
+ notNull: true;
930
+ hasDefault: false;
931
+ isPrimaryKey: false;
932
+ isAutoincrement: false;
933
+ hasRuntimeDefault: false;
934
+ enumValues: [string, ...string[]];
935
+ baseColumn: never;
936
+ identity: undefined;
937
+ generated: undefined;
938
+ }, {}>;
939
+ variationDigest: drizzle_orm_pg_core0.PgColumn<{
940
+ name: string;
941
+ tableName: "storage_variant_records";
942
+ dataType: "string";
943
+ data: string;
944
+ driverParam: string;
945
+ notNull: true;
946
+ hasDefault: false;
947
+ isPrimaryKey: false;
948
+ isAutoincrement: false;
949
+ hasRuntimeDefault: false;
950
+ enumValues: [string, ...string[]];
951
+ baseColumn: never;
952
+ identity: undefined;
953
+ generated: undefined;
954
+ }, {}>;
955
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
956
+ name: string;
957
+ tableName: "storage_variant_records";
958
+ dataType: "string timestamp";
959
+ data: string;
960
+ driverParam: string;
961
+ notNull: true;
962
+ hasDefault: true;
963
+ isPrimaryKey: false;
964
+ isAutoincrement: false;
965
+ hasRuntimeDefault: false;
966
+ enumValues: undefined;
967
+ baseColumn: never;
968
+ identity: undefined;
969
+ generated: undefined;
970
+ }, {}>;
971
+ };
972
+ dialect: "pg";
973
+ }>;
974
+ };
975
+ relations: (r: orm_d_exports.RelationsBuilder<{
976
+ storageBlobs: drizzle_orm_pg_core0.PgTableWithColumns<{
977
+ name: "storage_blobs";
978
+ schema: undefined;
979
+ columns: {
980
+ id: drizzle_orm_pg_core0.PgColumn<{
981
+ name: string;
982
+ tableName: "storage_blobs";
983
+ dataType: "string";
984
+ data: string;
985
+ driverParam: string;
986
+ notNull: true;
987
+ hasDefault: true;
988
+ isPrimaryKey: true;
989
+ isAutoincrement: false;
990
+ hasRuntimeDefault: false;
991
+ enumValues: [string, ...string[]];
992
+ baseColumn: never;
993
+ identity: undefined;
994
+ generated: undefined;
995
+ }, {}>;
996
+ key: drizzle_orm_pg_core0.PgColumn<{
997
+ name: string;
998
+ tableName: "storage_blobs";
999
+ dataType: "string";
1000
+ data: string;
1001
+ driverParam: string;
1002
+ notNull: true;
1003
+ hasDefault: false;
1004
+ isPrimaryKey: false;
1005
+ isAutoincrement: false;
1006
+ hasRuntimeDefault: false;
1007
+ enumValues: [string, ...string[]];
1008
+ baseColumn: never;
1009
+ identity: undefined;
1010
+ generated: undefined;
1011
+ }, {}>;
1012
+ filename: drizzle_orm_pg_core0.PgColumn<{
1013
+ name: string;
1014
+ tableName: "storage_blobs";
1015
+ dataType: "string";
1016
+ data: string;
1017
+ driverParam: string;
1018
+ notNull: true;
1019
+ hasDefault: false;
1020
+ isPrimaryKey: false;
1021
+ isAutoincrement: false;
1022
+ hasRuntimeDefault: false;
1023
+ enumValues: [string, ...string[]];
1024
+ baseColumn: never;
1025
+ identity: undefined;
1026
+ generated: undefined;
1027
+ }, {}>;
1028
+ contentType: drizzle_orm_pg_core0.PgColumn<{
1029
+ name: string;
1030
+ tableName: "storage_blobs";
1031
+ dataType: "string";
1032
+ data: string;
1033
+ driverParam: string;
1034
+ notNull: false;
1035
+ hasDefault: false;
1036
+ isPrimaryKey: false;
1037
+ isAutoincrement: false;
1038
+ hasRuntimeDefault: false;
1039
+ enumValues: [string, ...string[]];
1040
+ baseColumn: never;
1041
+ identity: undefined;
1042
+ generated: undefined;
1043
+ }, {}>;
1044
+ metadata: drizzle_orm_pg_core0.PgColumn<{
1045
+ name: string;
1046
+ tableName: "storage_blobs";
1047
+ dataType: "object json";
1048
+ data: unknown;
1049
+ driverParam: unknown;
1050
+ notNull: false;
1051
+ hasDefault: false;
1052
+ isPrimaryKey: false;
1053
+ isAutoincrement: false;
1054
+ hasRuntimeDefault: false;
1055
+ enumValues: undefined;
1056
+ baseColumn: never;
1057
+ identity: undefined;
1058
+ generated: undefined;
1059
+ }, {}>;
1060
+ serviceName: drizzle_orm_pg_core0.PgColumn<{
1061
+ name: string;
1062
+ tableName: "storage_blobs";
1063
+ dataType: "string";
1064
+ data: string;
1065
+ driverParam: string;
1066
+ notNull: true;
1067
+ hasDefault: true;
1068
+ isPrimaryKey: false;
1069
+ isAutoincrement: false;
1070
+ hasRuntimeDefault: false;
1071
+ enumValues: [string, ...string[]];
1072
+ baseColumn: never;
1073
+ identity: undefined;
1074
+ generated: undefined;
1075
+ }, {}>;
1076
+ byteSize: drizzle_orm_pg_core0.PgColumn<{
1077
+ name: string;
1078
+ tableName: "storage_blobs";
1079
+ dataType: "number int53";
1080
+ data: number;
1081
+ driverParam: string | number;
1082
+ notNull: true;
1083
+ hasDefault: false;
1084
+ isPrimaryKey: false;
1085
+ isAutoincrement: false;
1086
+ hasRuntimeDefault: false;
1087
+ enumValues: undefined;
1088
+ baseColumn: never;
1089
+ identity: undefined;
1090
+ generated: undefined;
1091
+ }, {}>;
1092
+ checksum: drizzle_orm_pg_core0.PgColumn<{
1093
+ name: string;
1094
+ tableName: "storage_blobs";
1095
+ dataType: "string";
1096
+ data: string;
1097
+ driverParam: string;
1098
+ notNull: false;
1099
+ hasDefault: false;
1100
+ isPrimaryKey: false;
1101
+ isAutoincrement: false;
1102
+ hasRuntimeDefault: false;
1103
+ enumValues: [string, ...string[]];
1104
+ baseColumn: never;
1105
+ identity: undefined;
1106
+ generated: undefined;
1107
+ }, {}>;
1108
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
1109
+ name: string;
1110
+ tableName: "storage_blobs";
1111
+ dataType: "string timestamp";
1112
+ data: string;
1113
+ driverParam: string;
1114
+ notNull: true;
1115
+ hasDefault: true;
1116
+ isPrimaryKey: false;
1117
+ isAutoincrement: false;
1118
+ hasRuntimeDefault: false;
1119
+ enumValues: undefined;
1120
+ baseColumn: never;
1121
+ identity: undefined;
1122
+ generated: undefined;
1123
+ }, {}>;
1124
+ };
1125
+ dialect: "pg";
1126
+ }>;
1127
+ storageAttachments: drizzle_orm_pg_core0.PgTableWithColumns<{
1128
+ name: "storage_attachments";
1129
+ schema: undefined;
1130
+ columns: {
1131
+ id: drizzle_orm_pg_core0.PgColumn<{
1132
+ name: string;
1133
+ tableName: "storage_attachments";
1134
+ dataType: "string";
1135
+ data: string;
1136
+ driverParam: string;
1137
+ notNull: true;
1138
+ hasDefault: true;
1139
+ isPrimaryKey: true;
1140
+ isAutoincrement: false;
1141
+ hasRuntimeDefault: false;
1142
+ enumValues: [string, ...string[]];
1143
+ baseColumn: never;
1144
+ identity: undefined;
1145
+ generated: undefined;
1146
+ }, {}>;
1147
+ name: drizzle_orm_pg_core0.PgColumn<{
1148
+ name: string;
1149
+ tableName: "storage_attachments";
1150
+ dataType: "string";
1151
+ data: string;
1152
+ driverParam: string;
1153
+ notNull: true;
1154
+ hasDefault: false;
1155
+ isPrimaryKey: false;
1156
+ isAutoincrement: false;
1157
+ hasRuntimeDefault: false;
1158
+ enumValues: [string, ...string[]];
1159
+ baseColumn: never;
1160
+ identity: undefined;
1161
+ generated: undefined;
1162
+ }, {}>;
1163
+ recordType: drizzle_orm_pg_core0.PgColumn<{
1164
+ name: string;
1165
+ tableName: "storage_attachments";
1166
+ dataType: "string";
1167
+ data: string;
1168
+ driverParam: string;
1169
+ notNull: true;
1170
+ hasDefault: false;
1171
+ isPrimaryKey: false;
1172
+ isAutoincrement: false;
1173
+ hasRuntimeDefault: false;
1174
+ enumValues: [string, ...string[]];
1175
+ baseColumn: never;
1176
+ identity: undefined;
1177
+ generated: undefined;
1178
+ }, {}>;
1179
+ recordId: drizzle_orm_pg_core0.PgColumn<{
1180
+ name: string;
1181
+ tableName: "storage_attachments";
1182
+ dataType: "string";
1183
+ data: string;
1184
+ driverParam: string;
1185
+ notNull: true;
1186
+ hasDefault: false;
1187
+ isPrimaryKey: false;
1188
+ isAutoincrement: false;
1189
+ hasRuntimeDefault: false;
1190
+ enumValues: [string, ...string[]];
1191
+ baseColumn: never;
1192
+ identity: undefined;
1193
+ generated: undefined;
1194
+ }, {}>;
1195
+ blobId: drizzle_orm_pg_core0.PgColumn<{
1196
+ name: string;
1197
+ tableName: "storage_attachments";
1198
+ dataType: "string";
1199
+ data: string;
1200
+ driverParam: string;
1201
+ notNull: true;
1202
+ hasDefault: false;
1203
+ isPrimaryKey: false;
1204
+ isAutoincrement: false;
1205
+ hasRuntimeDefault: false;
1206
+ enumValues: [string, ...string[]];
1207
+ baseColumn: never;
1208
+ identity: undefined;
1209
+ generated: undefined;
1210
+ }, {}>;
1211
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
1212
+ name: string;
1213
+ tableName: "storage_attachments";
1214
+ dataType: "string timestamp";
1215
+ data: string;
1216
+ driverParam: string;
1217
+ notNull: true;
1218
+ hasDefault: true;
1219
+ isPrimaryKey: false;
1220
+ isAutoincrement: false;
1221
+ hasRuntimeDefault: false;
1222
+ enumValues: undefined;
1223
+ baseColumn: never;
1224
+ identity: undefined;
1225
+ generated: undefined;
1226
+ }, {}>;
1227
+ };
1228
+ dialect: "pg";
1229
+ }>;
1230
+ storageVariantRecords: drizzle_orm_pg_core0.PgTableWithColumns<{
1231
+ name: "storage_variant_records";
1232
+ schema: undefined;
1233
+ columns: {
1234
+ id: drizzle_orm_pg_core0.PgColumn<{
1235
+ name: string;
1236
+ tableName: "storage_variant_records";
1237
+ dataType: "string";
1238
+ data: string;
1239
+ driverParam: string;
1240
+ notNull: true;
1241
+ hasDefault: true;
1242
+ isPrimaryKey: true;
1243
+ isAutoincrement: false;
1244
+ hasRuntimeDefault: false;
1245
+ enumValues: [string, ...string[]];
1246
+ baseColumn: never;
1247
+ identity: undefined;
1248
+ generated: undefined;
1249
+ }, {}>;
1250
+ blobId: drizzle_orm_pg_core0.PgColumn<{
1251
+ name: string;
1252
+ tableName: "storage_variant_records";
1253
+ dataType: "string";
1254
+ data: string;
1255
+ driverParam: string;
1256
+ notNull: true;
1257
+ hasDefault: false;
1258
+ isPrimaryKey: false;
1259
+ isAutoincrement: false;
1260
+ hasRuntimeDefault: false;
1261
+ enumValues: [string, ...string[]];
1262
+ baseColumn: never;
1263
+ identity: undefined;
1264
+ generated: undefined;
1265
+ }, {}>;
1266
+ variationDigest: drizzle_orm_pg_core0.PgColumn<{
1267
+ name: string;
1268
+ tableName: "storage_variant_records";
1269
+ dataType: "string";
1270
+ data: string;
1271
+ driverParam: string;
1272
+ notNull: true;
1273
+ hasDefault: false;
1274
+ isPrimaryKey: false;
1275
+ isAutoincrement: false;
1276
+ hasRuntimeDefault: false;
1277
+ enumValues: [string, ...string[]];
1278
+ baseColumn: never;
1279
+ identity: undefined;
1280
+ generated: undefined;
1281
+ }, {}>;
1282
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
1283
+ name: string;
1284
+ tableName: "storage_variant_records";
1285
+ dataType: "string timestamp";
1286
+ data: string;
1287
+ driverParam: string;
1288
+ notNull: true;
1289
+ hasDefault: true;
1290
+ isPrimaryKey: false;
1291
+ isAutoincrement: false;
1292
+ hasRuntimeDefault: false;
1293
+ enumValues: undefined;
1294
+ baseColumn: never;
1295
+ identity: undefined;
1296
+ generated: undefined;
1297
+ }, {}>;
1298
+ };
1299
+ dialect: "pg";
1300
+ }>;
1301
+ }>) => {
1302
+ storageBlobs: {
1303
+ attachments: drizzle_orm2.Many<"storageAttachments">;
1304
+ variantRecords: drizzle_orm2.Many<"storageVariantRecords">;
1305
+ };
1306
+ storageAttachments: {
1307
+ blob: drizzle_orm2.One<"storageBlobs", true>;
1308
+ };
1309
+ storageVariantRecords: {
1310
+ blob: drizzle_orm2.One<"storageBlobs", true>;
1311
+ };
1312
+ };
1313
+ };
1314
+ /**
1315
+ * Create a schema instance for type inference and exports.
1316
+ */
1317
+ type StorageSchema = ReturnType<typeof defineStorageSchema>;
1318
+ /**
1319
+ * Type for storage tables.
1320
+ */
1321
+ type StorageTables = StorageSchema["tables"];
1322
+ /**
1323
+ * Type for storage relations.
1324
+ */
1325
+ type StorageRelations = ReturnType<StorageSchema["relations"]>;
1326
+ type StorageBlob = StorageTables["storageBlobs"]["$inferSelect"];
1327
+ /**
1328
+ * Type for the storage relations config (result of defineRelations).
1329
+ * Computed at type-level without runtime call.
1330
+ */
1331
+ type StorageRelationsConfig = ExtractTablesWithRelations<StorageRelations, StorageTables>;
1332
+ //#endregion
1333
+ //#region src/api/workflows/generate-image-variant.d.ts
1334
+ /**
1335
+ * Image transformations schema.
1336
+ * Supports resize, rotate, flip, flop, sharpen, blur, grayscale, format conversion.
1337
+ */
1338
+ declare const transformationsSchema: z.ZodObject<{
1339
+ resize: z.ZodOptional<z.ZodObject<{
1340
+ width: z.ZodOptional<z.ZodNumber>;
1341
+ height: z.ZodOptional<z.ZodNumber>;
1342
+ fit: z.ZodOptional<z.ZodEnum<{
1343
+ fill: "fill";
1344
+ cover: "cover";
1345
+ contain: "contain";
1346
+ inside: "inside";
1347
+ outside: "outside";
1348
+ }>>;
1349
+ position: z.ZodOptional<z.ZodEnum<{
1350
+ left: "left";
1351
+ right: "right";
1352
+ top: "top";
1353
+ "right top": "right top";
1354
+ "right bottom": "right bottom";
1355
+ bottom: "bottom";
1356
+ "left bottom": "left bottom";
1357
+ "left top": "left top";
1358
+ centre: "centre";
1359
+ }>>;
1360
+ kernel: z.ZodOptional<z.ZodEnum<{
1361
+ nearest: "nearest";
1362
+ linear: "linear";
1363
+ cubic: "cubic";
1364
+ mitchell: "mitchell";
1365
+ lanczos2: "lanczos2";
1366
+ lanczos3: "lanczos3";
1367
+ }>>;
1368
+ }, z.core.$strip>>;
1369
+ rotate: z.ZodOptional<z.ZodNumber>;
1370
+ flip: z.ZodOptional<z.ZodBoolean>;
1371
+ flop: z.ZodOptional<z.ZodBoolean>;
1372
+ sharpen: z.ZodOptional<z.ZodBoolean>;
1373
+ blur: z.ZodOptional<z.ZodNumber>;
1374
+ grayscale: z.ZodOptional<z.ZodBoolean>;
1375
+ format: z.ZodOptional<z.ZodEnum<{
1376
+ jpeg: "jpeg";
1377
+ png: "png";
1378
+ webp: "webp";
1379
+ avif: "avif";
1380
+ gif: "gif";
1381
+ }>>;
1382
+ quality: z.ZodOptional<z.ZodNumber>;
1383
+ preview: z.ZodOptional<z.ZodLiteral<true>>;
1384
+ }, z.core.$strip>;
1385
+ /**
1386
+ * Types for image transformations.
1387
+ */
1388
+ type ImageTransformations = z.infer<typeof transformationsSchema>;
1389
+ //#endregion
1390
+ //#region src/api/storage.d.ts
1391
+ /**
1392
+ * Database type with storage schema and relations.
1393
+ */
1394
+ type DatabaseWithStorage = NodePgDatabase<StorageTables, StorageRelationsConfig> & {
1395
+ $client: Pool;
1396
+ };
1397
+ /**
1398
+ * Type of the storage service instance.
1399
+ */
1400
+ type Storage<TDisks extends Record<string, FSDriverOptions | S3DriverOptions> = Record<string, FSDriverOptions | S3DriverOptions>, TTableNames extends string = string, TAttachments extends Partial<Record<TTableNames, readonly string[]>> = Record<never, never>> = StorageService<Extract<keyof TDisks, string>, TTableNames, TAttachments>;
1401
+ /**
1402
+ * Helper type to extract attachment name for a specific table.
1403
+ */
1404
+ type AttachmentName<TAttachments extends Partial<Record<string, readonly string[]>>, TTable extends string> = TTable extends keyof TAttachments ? TAttachments[TTable] extends readonly (infer N)[] ? N : string : string;
1405
+ /**
1406
+ * Storage service for blob operations.
1407
+ *
1408
+ * This service uses a dual-drive architecture when configured:
1409
+ * - `drive`: For actual file operations (upload, delete, read) using internal endpoints
1410
+ * - `signedUrlDrive`: For generating browser-accessible signed URLs with public endpoints
1411
+ *
1412
+ * This allows containers to use fast internal network for operations while
1413
+ * generating URLs that work in end-user browsers.
1414
+ *
1415
+ * @template TDiskNames - Union of disk names (e.g., "private" | "public")
1416
+ * @template TTableNames - Union of table names for type-safe attachment methods
1417
+ * @template TAttachments - Mapping of table names to valid attachment names
1418
+ */
1419
+ declare class StorageService<TDiskNames extends string = string, TTableNames extends string = string, TAttachments extends Partial<Record<TTableNames, readonly string[]>> = Record<never, never>> {
1420
+ /**
1421
+ * The drive manager for file operations.
1422
+ */
1423
+ readonly drive: DriveManager<any>;
1424
+ /**
1425
+ * The database instance with storage schema and relations.
1426
+ */
1427
+ readonly db: DatabaseWithStorage;
1428
+ /**
1429
+ * The default disk name.
1430
+ */
1431
+ readonly defaultDisk: TDiskNames;
1432
+ /**
1433
+ * Cron expression for unattached blob purge schedule.
1434
+ *
1435
+ * @default "0 0 * * *"
1436
+ */
1437
+ readonly purgeCron?: string;
1438
+ /**
1439
+ * Secret key for signing blob IDs.
1440
+ */
1441
+ readonly secret?: string;
1442
+ /**
1443
+ * Drive manager for generating signed URLs (public endpoint).
1444
+ */
1445
+ readonly signedUrlDrive: DriveManager<any>;
1446
+ constructor(drive: DriveManager<any>, db: DatabaseWithStorage, defaultDisk: TDiskNames, signedUrlDrive: DriveManager<any>, purgeCron?: string, secret?: string);
1447
+ /**
1448
+ * Create a blob record and upload file.
1449
+ */
1450
+ createBlob(file: Buffer | Uint8Array, options: {
1451
+ filename: string;
1452
+ contentType?: string;
1453
+ metadata?: Record<string, any>;
1454
+ serviceName?: TDiskNames;
1455
+ prefix?: string;
1456
+ }): Promise<StorageBlob>;
1457
+ /**
1458
+ * Get blob by ID.
1459
+ */
1460
+ getBlob(id: string): Promise<StorageBlob | null>;
1461
+ /**
1462
+ * Download blob content.
1463
+ */
1464
+ downloadBlob(id: string): Promise<Buffer | null>;
1465
+ /**
1466
+ * Delete blob and its content.
1467
+ */
1468
+ deleteBlob(id: string): Promise<boolean>;
1469
+ /**
1470
+ * Get signed URL for blob. If blob is on public service, returns permanent
1471
+ * URL instead.
1472
+ */
1473
+ getSignedUrl(id: string, options?: {
1474
+ expiresIn?: number;
1475
+ disposition?: "inline" | "attachment";
1476
+ filename?: string;
1477
+ }): Promise<string | null>;
1478
+ /**
1479
+ * Get permanent public URL (no expiration).
1480
+ * Works for blobs on public storage service.
1481
+ */
1482
+ getPublicUrl(id: string): Promise<string | null>;
1483
+ /**
1484
+ * Create attachment between a record and blob.
1485
+ *
1486
+ * @param recordType - The table name (e.g., 'users')
1487
+ * @param recordId - The record ID
1488
+ * @param blobId - The blob ID to attach
1489
+ * @param name - The attachment name (e.g., 'avatar')
1490
+ * @param replaceExisting - If true, replaces existing attachment with same name (for one-to-one)
1491
+ */
1492
+ createAttachment(recordType: string, recordId: string, blobId: string, name: string, replaceExisting?: boolean): Promise<{
1493
+ id: string;
1494
+ createdAt: string;
1495
+ name: string;
1496
+ recordType: string;
1497
+ recordId: string;
1498
+ blobId: string;
1499
+ }>;
1500
+ /**
1501
+ * Get attachments for a record with their associated blobs.
1502
+ */
1503
+ getAttachments(recordType: string, recordId: string, name?: string): Promise<{
1504
+ id: string;
1505
+ createdAt: string;
1506
+ name: string;
1507
+ recordType: string;
1508
+ recordId: string;
1509
+ blobId: string;
1510
+ blob: {
1511
+ id: string;
1512
+ key: string;
1513
+ filename: string;
1514
+ contentType: string | null;
1515
+ metadata: unknown;
1516
+ serviceName: string;
1517
+ byteSize: number;
1518
+ checksum: string | null;
1519
+ createdAt: string;
1520
+ } | null;
1521
+ }[]>;
1522
+ /**
1523
+ * Get attachments by their IDs with associated blobs.
1524
+ *
1525
+ * @param attachmentIds - Array of attachment IDs to fetch.
1526
+ */
1527
+ getAttachmentsByIds(attachmentIds: string[]): Promise<{
1528
+ id: string;
1529
+ createdAt: string;
1530
+ name: string;
1531
+ recordType: string;
1532
+ recordId: string;
1533
+ blobId: string;
1534
+ blob: {
1535
+ id: string;
1536
+ key: string;
1537
+ filename: string;
1538
+ contentType: string | null;
1539
+ metadata: unknown;
1540
+ serviceName: string;
1541
+ byteSize: number;
1542
+ checksum: string | null;
1543
+ createdAt: string;
1544
+ } | null;
1545
+ }[]>;
1546
+ /**
1547
+ * Delete a single attachment by ID.
1548
+ */
1549
+ deleteAttachment(attachmentId: string): Promise<boolean>;
1550
+ /**
1551
+ * Delete attachments for a record (without deleting the blobs).
1552
+ */
1553
+ deleteAttachments(recordType: string, recordId: string, name?: string): Promise<number>;
1554
+ /**
1555
+ * Get direct upload credentials (for S3). Also creates a pending blob record
1556
+ * that will be finalized after upload.
1557
+ */
1558
+ getDirectUploadUrl(options: {
1559
+ contentType?: string;
1560
+ expiresIn?: number;
1561
+ filename: string;
1562
+ metadata?: Record<string, any>;
1563
+ serviceName?: TDiskNames;
1564
+ }): Promise<{
1565
+ blobId: string;
1566
+ headers?: Record<string, string>;
1567
+ key: string;
1568
+ url: string;
1569
+ } | null>;
1570
+ /**
1571
+ * Finalize a direct upload by updating blob metadata. Call this after the
1572
+ * client has uploaded to S3.
1573
+ */
1574
+ finalizeDirectUpload(blobId: string, actualSize: number): Promise<void>;
1575
+ /**
1576
+ * Update blob metadata (for automatic extraction).
1577
+ */
1578
+ updateBlobMetadata(blobId: string, metadata: Record<string, any>): Promise<void>;
1579
+ /**
1580
+ * Get existing variant or return null.
1581
+ */
1582
+ getVariant(blobId: string, transformations: ImageTransformations): Promise<StorageBlob | null>;
1583
+ /**
1584
+ * Create variant blob and record.
1585
+ */
1586
+ createVariant(blobId: string, transformations: ImageTransformations, variantBuffer: Buffer): Promise<StorageBlob>;
1587
+ /**
1588
+ * Get blobs that have no attachments (orphaned). Useful for cleanup jobs.
1589
+ */
1590
+ getUnattachedBlobs(options?: {
1591
+ olderThan?: string;
1592
+ limit?: number;
1593
+ }): Promise<StorageBlob[]>;
1594
+ /**
1595
+ * Get pending blobs that were never finalized (stuck direct uploads).
1596
+ */
1597
+ getPendingBlobs(olderThan?: string): Promise<StorageBlob[]>;
1598
+ /**
1599
+ * Purge unattached blobs.
1600
+ */
1601
+ purgeUnattached(olderThan?: string): Promise<number>;
1602
+ /**
1603
+ * Create a signed, tamper-proof reference to a blob.
1604
+ * Use findSigned() to resolve back to blob.
1605
+ *
1606
+ * Algorithm:
1607
+ * 1. Create payload with blobId and expiration timestamp
1608
+ * 2. JSON stringify and base64url encode the payload
1609
+ * 3. Create HMAC-SHA256 signature of the encoded payload
1610
+ * 4. Return payload.signature format
1611
+ */
1612
+ signedId(blobId: string, expiresIn?: number): string;
1613
+ /**
1614
+ * Find blob by signed ID. Returns null if invalid or expired.
1615
+ * Uses constant-time comparison to prevent timing attacks.
1616
+ *
1617
+ * Algorithm:
1618
+ * 1. Split signed ID into payload and signature
1619
+ * 2. Decode and recompute expected signature
1620
+ * 3. Use timingSafeEqual for constant-time comparison
1621
+ * 4. Check expiration timestamp
1622
+ * 5. Return blob if valid, null otherwise
1623
+ */
1624
+ findSigned(signedId: string): Promise<StorageBlob | null>;
1625
+ /**
1626
+ * Get a single attachment handle (one-to-one relationship).
1627
+ * Similar to Rails' `has_one_attached :avatar`.
1628
+ *
1629
+ * Algorithm:
1630
+ * Returns an object with methods to manage a single attachment:
1631
+ * - attach(): Replace existing attachment with new blob
1632
+ * - get(): Get attached blob or null
1633
+ * - url(): Get signed URL
1634
+ * - variant(): Get/generate image variant
1635
+ * - purge(): Delete attachment and blob
1636
+ *
1637
+ * @template TTable - The table name (must be in TTableNames)
1638
+ */
1639
+ one<TTable extends TTableNames>(recordType: TTable, recordId: string, name: AttachmentName<TAttachments, TTable>): {
1640
+ /**
1641
+ * Attach a blob to this record (replaces existing).
1642
+ * Auto-triggers extractBlobMetadata workflow.
1643
+ */
1644
+ attach(blobId: string): Promise<{
1645
+ id: string;
1646
+ createdAt: string;
1647
+ name: string;
1648
+ recordType: string;
1649
+ recordId: string;
1650
+ blobId: string;
1651
+ }>;
1652
+ /** Get the attached blob or null. */
1653
+ get(): Promise<StorageBlob | null>;
1654
+ /** Check if a blob is attached. */
1655
+ attached(): Promise<boolean>;
1656
+ /** Get signed URL or null. */
1657
+ url(options?: {
1658
+ expiresIn?: number;
1659
+ disposition?: "inline" | "attachment";
1660
+ }): Promise<string | null>;
1661
+ /** Get permanent public URL or null. */
1662
+ publicUrl(): Promise<string | null>;
1663
+ /** Get blob metadata or null. */
1664
+ metadata(): Promise<Record<string, unknown> | null>;
1665
+ /** Check if metadata has been extracted. */
1666
+ analyzed(): Promise<boolean>;
1667
+ /** Check if blob supports preview/variant generation. */
1668
+ representable(): Promise<boolean>;
1669
+ /**
1670
+ * Get variant URL. Auto-enqueues generation if not ready.
1671
+ * Returns URL if variant exists, null if generating.
1672
+ */
1673
+ variant(transformations: ImageTransformations, expiresIn?: number): Promise<string | null>;
1674
+ /**
1675
+ * Get preview URL. Auto-enqueues generation if not ready.
1676
+ * Returns URL if preview exists, null if generating.
1677
+ */
1678
+ preview(expiresIn?: number, timeInSeconds?: number): Promise<string | null>;
1679
+ /** Detach blob from record (keeps blob for reuse). */
1680
+ detach(): Promise<boolean>;
1681
+ /** Delete attachment AND blob immediately. */
1682
+ purge(): Promise<boolean>;
1683
+ /** Enqueue attachment and blob deletion in background. */
1684
+ purgeLater(): Promise<boolean>;
1685
+ /** Download blob content as Buffer. */
1686
+ download(): Promise<Buffer | null>;
1687
+ /** Download to temp file, run callback, auto-cleanup. */
1688
+ open<T>(callback: (filePath: string) => Promise<T> | T): Promise<T | null>;
1689
+ /**
1690
+ * Smart representation - variant for images, preview for videos/PDFs.
1691
+ * Auto-enqueues generation if not ready.
1692
+ */
1693
+ representation(transformations: ImageTransformations, expiresIn?: number): Promise<string | null>;
1694
+ /** Get blob's byte size. */
1695
+ byteSize(): Promise<number | null>;
1696
+ /** Get blob's content type. */
1697
+ contentType(): Promise<string | null>;
1698
+ /** Get blob's filename. */
1699
+ filename(): Promise<string | null>;
1700
+ /** Get signed, tamper-proof ID for the blob. */
1701
+ signedId(expiresIn?: number): Promise<string | null>;
1702
+ };
1703
+ /**
1704
+ * Get a multiple attachment handle (one-to-many relationship).
1705
+ * Similar to Rails' `has_many_attached :images`.
1706
+ *
1707
+ * Algorithm:
1708
+ * Returns an object with methods to manage multiple attachments:
1709
+ * - attach(): Add blobs (doesn't replace existing)
1710
+ * - list(): Get all attached blobs
1711
+ * - urls(): Get signed URLs for all
1712
+ * - variants(): Get/generate variants for all
1713
+ * - purge(): Delete all or specific attachment
1714
+ *
1715
+ * @template TTable - The table name (must be in TTableNames)
1716
+ */
1717
+ many<TTable extends TTableNames>(recordType: TTable, recordId: string, name: AttachmentName<TAttachments, TTable>): {
1718
+ /**
1719
+ * Attach one or more blobs (adds to existing, doesn't replace).
1720
+ * Auto-triggers extractBlobMetadata for each blob.
1721
+ */
1722
+ attach(blobIds: string | string[]): Promise<{
1723
+ id: string;
1724
+ createdAt: string;
1725
+ name: string;
1726
+ recordType: string;
1727
+ recordId: string;
1728
+ blobId: string;
1729
+ }[]>;
1730
+ /** Get all attached blobs. */
1731
+ list(): Promise<StorageBlob[]>;
1732
+ /** Count attached blobs. */
1733
+ count(): Promise<number>;
1734
+ /** Get signed URLs for all blobs. */
1735
+ urls(options?: {
1736
+ expiresIn?: number;
1737
+ }): Promise<string[]>;
1738
+ /** Get public URLs for all blobs. */
1739
+ publicUrls(): Promise<(string | null)[]>;
1740
+ /** Get metadata for all blobs. */
1741
+ metadata(): Promise<(Record<string, unknown> | null)[]>;
1742
+ /** Check which blobs have been analyzed. */
1743
+ analyzed(): Promise<boolean[]>;
1744
+ /** Check which blobs support preview/variants. */
1745
+ representable(): Promise<boolean[]>;
1746
+ /** Get variant URLs for all blobs. Auto-enqueues if not ready. */
1747
+ variants(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>;
1748
+ /** Get preview URLs for all blobs. Auto-enqueues if not ready. */
1749
+ previews(expiresIn?: number, timeInSeconds?: number): Promise<(string | null)[]>;
1750
+ /** Detach specific blob or all blobs (keeps blobs for reuse). */
1751
+ detach(blobId?: string): Promise<number>;
1752
+ /** Delete specific or all attachments AND blobs immediately. */
1753
+ purge(blobId?: string): Promise<number>;
1754
+ /** Enqueue specific or all attachments for background deletion. */
1755
+ purgeLater(blobId?: string): Promise<number>;
1756
+ /** Download all blobs as Buffers. */
1757
+ download(): Promise<Buffer[]>;
1758
+ /** Download each blob to temp file, run callback for each. */
1759
+ open<T>(callback: (filePath: string, blob: StorageBlob) => Promise<T> | T): Promise<T[]>;
1760
+ /**
1761
+ * Smart representations - variant for images, preview for videos/PDFs.
1762
+ * Auto-enqueues generation if not ready.
1763
+ */
1764
+ representations(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>;
1765
+ /** Get byte sizes for all blobs. */
1766
+ byteSizes(): Promise<number[]>;
1767
+ /** Get content types for all blobs. */
1768
+ contentTypes(): Promise<(string | null)[]>;
1769
+ /** Get filenames for all blobs. */
1770
+ filenames(): Promise<string[]>;
1771
+ /** Get signed IDs for all blobs. */
1772
+ signedIds(expiresIn?: number): Promise<string[]>;
1773
+ };
1774
+ }
1775
+ //#endregion
1776
+ //#region src/api/container.d.ts
1777
+ /**
1778
+ * Server configuration for the HTTP server.
1779
+ */
1780
+ interface ServerConfig {
1781
+ /**
1782
+ * The host address the server will bind to.
1783
+ *
1784
+ * @default "0.0.0.0"
1785
+ */
1786
+ host?: string;
1787
+ /**
1788
+ * The port number the server will listen on.
1789
+ */
1790
+ port: number;
1791
+ /**
1792
+ * Request timeout in milliseconds. Requests exceeding this duration
1793
+ * will receive a 408 Request Timeout response.
1794
+ *
1795
+ * @default 30000
1796
+ */
1797
+ timeout?: number;
1798
+ /**
1799
+ * Maximum request body size for JSON and URL-encoded payloads.
1800
+ * Supports bytes.js format strings (e.g., "1mb", "500kb", "10mb").
1801
+ *
1802
+ * @default "1mb"
1803
+ */
1804
+ bodyLimit?: string;
1805
+ /**
1806
+ * The path for the health check endpoint.
1807
+ *
1808
+ * @default "/health"
1809
+ */
1810
+ healthPath?: string;
1811
+ /**
1812
+ * CORS configuration. Omit or set to undefined to disable.
1813
+ *
1814
+ * @example
1815
+ * cors: { origin: "https://example.com", credentials: true }
1816
+ */
1817
+ cors?: CorsOptions;
1818
+ /**
1819
+ * Security headers configuration (via helmet). Omit or set to undefined to disable.
1820
+ * Recommended for production deployments.
1821
+ *
1822
+ * @example
1823
+ * helmet: { contentSecurityPolicy: false } // Enable with CSP disabled
1824
+ * helmet: {} // Enable with all defaults
1825
+ */
1826
+ helmet?: HelmetOptions;
1827
+ /**
1828
+ * Rate limiting configuration. Array of express-rate-limit options.
1829
+ * Each config is applied as a separate middleware - use `skip` function for path-specific limits.
1830
+ * Redis store is automatically configured if `redisUrl` is provided.
1831
+ *
1832
+ * @example
1833
+ * // Global rate limit
1834
+ * rateLimit: [{ windowMs: 60000, limit: 100 }]
1835
+ *
1836
+ * @example
1837
+ * // Path-specific rate limits
1838
+ * rateLimit: [
1839
+ * { windowMs: 900000, limit: 5, skip: (req) => !req.path.startsWith("/api/auth") },
1840
+ * { windowMs: 60000, limit: 100 }, // Default for all other routes
1841
+ * ]
1842
+ */
1843
+ rateLimit?: Options[];
1844
+ /**
1845
+ * Redis URL for rate limiting store (for multi-instance deployments).
1846
+ * Server auto-connects and cleans up on shutdown.
1847
+ * If omitted, uses in-memory store (not suitable for production clusters).
1848
+ *
1849
+ * @example
1850
+ * redisUrl: "redis://localhost:6379"
1851
+ */
1852
+ redisUrl?: string;
1853
+ }
1854
+ /**
1855
+ * Worker configuration for the DBOS workflow worker.
1856
+ */
1857
+ interface WorkerConfig {
1858
+ /**
1859
+ * The system database URL for DBOS.
1860
+ */
1861
+ dbUrl: string;
1862
+ }
1863
+ /**
1864
+ * The base application container type that holds required services like
1865
+ * config, databases, and caches.
1866
+ */
1867
+ interface AppContainer<TDb extends Record<"primary", Database> & Record<string, Database> = Record<"primary", Database> & Record<string, Database>> {
1868
+ /**
1869
+ * The application auth configuration.
1870
+ */
1871
+ auth: Auth<TDb>;
1872
+ /**
1873
+ * A map of caches available in the application.
1874
+ */
1875
+ cache: Record<string, Cache>;
1876
+ /**
1877
+ * The application configuration.
1878
+ */
1879
+ config: Config;
1880
+ /**
1881
+ * A map of databases available in the application.
1882
+ */
1883
+ db: TDb;
1884
+ /**
1885
+ * The i18n instance for internationalization.
1886
+ */
1887
+ i18n: i18n;
1888
+ /**
1889
+ * The logger instance for logging messages.
1890
+ */
1891
+ logger: Logger;
1892
+ /**
1893
+ * The event bus for in-memory and Redis pub/sub messaging.
1894
+ */
1895
+ eventBus: EventBus;
1896
+ /**
1897
+ * The mailer instance for sending emails.
1898
+ */
1899
+ mailer: Mailer;
1900
+ /**
1901
+ * Server configuration for the HTTP server.
1902
+ */
1903
+ server: ServerConfig;
1904
+ /**
1905
+ * A map of storage services available in the application.
1906
+ */
1907
+ storage: Record<"primary", Storage> & Record<string, Storage>;
1908
+ /**
1909
+ * Worker configuration for the DBOS workflow worker.
1910
+ */
1911
+ worker: WorkerConfig;
1912
+ }
1913
+ /**
1914
+ * Global namespace for user container augmentation.
1915
+ * Users can extend Container interface in their container.ts file.
1916
+ */
1917
+ declare global {
1918
+ namespace AppOS {
1919
+ interface Container {}
1920
+ }
1921
+ }
1922
+ /**
1923
+ * The container type used throughout the application.
1924
+ * Merges base AppContainer with user's custom Container augmentations.
1925
+ */
1926
+ type Container = AppContainer & AppOS.Container;
1927
+ //#endregion
1928
+ //#region src/cli/context.d.ts
1929
+ /**
1930
+ * Command context providing beautiful output, prompts, and utilities.
1931
+ * Uses @clack/prompts for consistent, professional CLI formatting.
1932
+ *
1933
+ * @template C - Container type (defaults to base Container)
1934
+ * @template A - Arguments type inferred from command's Zod args schema
1935
+ * @template O - Options type inferred from command's Zod opts schema
1936
+ */
1937
+ interface CommandContext<C extends Container = Container, A = readonly unknown[], O = Record<string, unknown>> {
1938
+ /**
1939
+ * The parsed command-line arguments.
1940
+ * Type is inferred from the command's Zod args schema.
1941
+ */
1942
+ readonly args: A;
1943
+ /**
1944
+ * Prompts the user for single-line text input.
1945
+ * @see https://www.clack.cc for prompt options
1946
+ */
1947
+ ask: typeof p.text;
1948
+ /**
1949
+ * Displays a cancellation message and exits the process with code 0.
1950
+ * @param message - Optional cancellation message (defaults to "Cancelled")
1951
+ */
1952
+ cancel(message?: string): never;
1953
+ /**
1954
+ * Prompts the user for dropdown selection from a list of options.
1955
+ * @see https://www.clack.cc for prompt options
1956
+ */
1957
+ choice: typeof p.select;
1958
+ /**
1959
+ * Releases all container resources including database connections and cache clients.
1960
+ * Must be called before the command exits to prevent resource leaks.
1961
+ */
1962
+ cleanup(): Promise<void>;
1963
+ /**
1964
+ * Displays a dimmed comment line for secondary information.
1965
+ * @param message - The comment text to display
1966
+ */
1967
+ comment(message: string): void;
1968
+ /**
1969
+ * Prompts the user for yes/no confirmation.
1970
+ * @see https://www.clack.cc for prompt options
1971
+ */
1972
+ confirm: typeof p.confirm;
1973
+ /**
1974
+ * The dependency injection container providing access to services.
1975
+ * Includes database connections, cache clients, logger, mailer, and configuration.
1976
+ */
1977
+ readonly container: C;
1978
+ /**
1979
+ * Displays an error message with the error symbol.
1980
+ * @param message - The error message to display
1981
+ */
1982
+ error(message: string): void;
1983
+ /**
1984
+ * Executes a shell command asynchronously.
1985
+ * @param command - The command to execute
1986
+ * @param args - Array of command arguments
1987
+ * @throws Error if the command exits with a non-zero code
1988
+ */
1989
+ exec(command: string, args: string[]): Promise<void>;
1990
+ /**
1991
+ * Displays an error message and terminates the process with exit code 1.
1992
+ * @param message - The error message to display before exiting
1993
+ */
1994
+ fail(message: string): never;
1995
+ /**
1996
+ * Groups multiple prompts together for sequential execution.
1997
+ * @see https://www.clack.cc for group options
1998
+ */
1999
+ group: typeof p.group;
2000
+ /**
2001
+ * Displays an informational message with the info symbol.
2002
+ * @param message - The info message to display
2003
+ */
2004
+ info(message: string): void;
2005
+ /**
2006
+ * Displays the command intro header.
2007
+ * @param title - The command name or title to display
2008
+ */
2009
+ intro(title: string): void;
2010
+ /**
2011
+ * Checks if a prompt result indicates user cancellation (Ctrl+C).
2012
+ * @param value - The prompt result to check
2013
+ * @returns True if the user cancelled the prompt
2014
+ */
2015
+ isCancel: typeof p.isCancel;
2016
+ /**
2017
+ * Displays a plain text line.
2018
+ * @param message - The text to display
2019
+ */
2020
+ line(message: string): void;
2021
+ /**
2022
+ * Prompts the user to select multiple options from a list.
2023
+ * @see https://www.clack.cc for multiselect options
2024
+ */
2025
+ multiselect: typeof p.multiselect;
2026
+ /**
2027
+ * Displays a formatted note box with optional title.
2028
+ * @param message - The note content
2029
+ * @param title - Optional title for the note
2030
+ */
2031
+ note(message: string, title?: string): void;
2032
+ /**
2033
+ * The parsed command-line options.
2034
+ * Type is inferred from the command's Zod opts schema.
2035
+ */
2036
+ readonly opts: O;
2037
+ /**
2038
+ * Displays the command outro footer.
2039
+ * @param message - Optional completion message (defaults to "Done")
2040
+ */
2041
+ outro(message?: string): void;
2042
+ /**
2043
+ * Prompts the user for password input with hidden characters.
2044
+ * @see https://www.clack.cc for prompt options
2045
+ */
2046
+ secret: typeof p.password;
2047
+ /**
2048
+ * Executes an async function while displaying an animated spinner.
2049
+ * Use for long-running operations like starting containers.
2050
+ * @template T - Return type of the task function
2051
+ * @param message - Message to display while spinning
2052
+ * @param fn - Async function to execute
2053
+ * @returns The result of the task function
2054
+ */
2055
+ spinner<T>(message: string, fn: () => Promise<T>): Promise<T>;
2056
+ /**
2057
+ * Displays a step message indicating progress.
2058
+ * @param message - The step description
2059
+ */
2060
+ step(message: string): void;
2061
+ /**
2062
+ * Displays a success message with the success symbol.
2063
+ * @param message - The success message to display
2064
+ */
2065
+ success(message: string): void;
2066
+ /**
2067
+ * Displays data in a formatted note box as a table.
2068
+ * @param headers - Array of column header strings
2069
+ * @param rows - 2D array of cell values
2070
+ */
2071
+ table(headers: string[], rows: string[][]): void;
2072
+ /**
2073
+ * Executes an async function and displays the result with timing.
2074
+ * @template T - Return type of the task function
2075
+ * @param name - Display name for the task
2076
+ * @param fn - Async function to execute
2077
+ * @returns The result of the task function
2078
+ */
2079
+ task<T>(name: string, fn: () => Promise<T>): Promise<T>;
2080
+ /**
2081
+ * Displays a task status line without executing any function.
2082
+ * @param name - Display name for the task
2083
+ * @param status - Status text to display
2084
+ */
2085
+ taskStatus(name: string, status: string): void;
2086
+ /**
2087
+ * Displays a warning message with the warning symbol.
2088
+ * @param message - The warning message to display
2089
+ */
2090
+ warn(message: string): void;
2091
+ }
2092
+ //#endregion
2093
+ //#region src/cli/command.d.ts
2094
+ /**
2095
+ * The command interface.
2096
+ */
2097
+ interface Command<C extends Container, A = readonly unknown[], O = Record<string, unknown>> {
2098
+ aliases: string[];
2099
+ description: string;
2100
+ devOnly: boolean;
2101
+ args: z.ZodTuple<readonly [z.ZodTypeAny, ...z.ZodTypeAny[]], z.ZodTypeAny | null> | z.ZodArray<z.ZodTypeAny>;
2102
+ opts: z.ZodObject<z.ZodRawShape>;
2103
+ run: (ctx: CommandContext<C, A, O>) => Promise<void>;
2104
+ }
2105
+ /**
2106
+ * Define a CLI command with type-safe arguments and options.
2107
+ *
2108
+ * The command name is automatically derived from the filename relative to the commands directory:
2109
+ * - `<APPOS_DIR>/<COMMANDS_DIR>/db/push.ts` → `db:push`
2110
+ * - `<APPOS_DIR>/<COMMANDS_DIR>/dev.ts` → `dev`
2111
+ *
2112
+ * Where:
2113
+ * - `APPOS_DIR` defaults to "appos" (see constants.ts)
2114
+ * - `COMMANDS_DIR` defaults to "commands" (see constants.ts)
2115
+ *
2116
+ * @example
2117
+ * ```typescript
2118
+ * // appos/commands/db/migrate.ts
2119
+ * import { defineCommand } from "appos/cli";
2120
+ * import { z } from "appos/zod";
2121
+ *
2122
+ * export default defineCommand({
2123
+ * description: "Run database migrations",
2124
+ * args: z.tuple([]),
2125
+ * opts: z.object({
2126
+ * dry: z.boolean().default(false)
2127
+ * }),
2128
+ * async run(args, opts, container) {
2129
+ * await container.db.primary.migrate({ dryRun: opts.dry });
2130
+ * }
2131
+ * });
2132
+ * ```
2133
+ */
2134
+ declare function defineCommand<C extends Container = Container, ASchema extends z.ZodSchema<unknown> | undefined = undefined, OSchema extends z.ZodSchema<unknown> | undefined = undefined>(def: {
2135
+ aliases?: string[];
2136
+ description: string;
2137
+ devOnly?: boolean;
2138
+ args: ASchema;
2139
+ opts: OSchema;
2140
+ run: (ctx: CommandContext<C, ASchema extends z.ZodSchema<infer A> ? A : readonly unknown[], OSchema extends z.ZodSchema<infer O> ? O : Record<string, unknown>>) => Promise<void>;
2141
+ }): Command<C, ASchema extends z.ZodSchema<infer A> ? A : readonly unknown[], OSchema extends z.ZodSchema<infer O> ? O : Record<string, unknown>>;
2142
+ //#endregion
3
2143
  export { type Command, type CommandContext, defineCommand };