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,17 +0,0 @@
1
- import "@better-auth/passkey/client";
2
- import "@better-auth/sso/client";
3
- import "better-auth/client/plugins";
4
- import "better-auth/react";
5
-
6
- //#region src/web/auth.ts
7
- /**
8
- * Default base path for auth routes.
9
- */
10
- const AUTH_BASE_PATH = "/auth";
11
- /**
12
- * Default base URL (empty - same origin).
13
- */
14
- const AUTH_BASE_URL = "";
15
-
16
- //#endregion
17
- export { AUTH_BASE_PATH, AUTH_BASE_URL };
@@ -1,250 +0,0 @@
1
- import { Container } from "./container.mjs";
2
- import { z } from "zod";
3
- import { DBOS } from "@dbos-inc/dbos-sdk";
4
-
5
- //#region src/api/workflow.d.ts
6
-
7
- /**
8
- * Context available to workflow functions.
9
- */
10
- interface WorkflowContext<TInput = unknown> {
11
- /**
12
- * The application container with access to db, mailer, logger, etc.
13
- */
14
- container: Container;
15
- /**
16
- * The validated input passed to this workflow.
17
- */
18
- input: TInput;
19
- /**
20
- * Execute a checkpointed step within the workflow.
21
- * Steps are retried on failure and their results are durably stored.
22
- *
23
- * @param name - Unique name for this step within the workflow
24
- * @param fn - The step function to execute
25
- * @returns The result of the step function
26
- */
27
- step<T>(name: string, fn: () => Promise<T>): Promise<T>;
28
- /**
29
- * The unique ID of this workflow execution.
30
- */
31
- workflowId: string;
32
- }
33
- /**
34
- * Context available to scheduled workflow functions.
35
- */
36
- interface ScheduledWorkflowContext {
37
- /**
38
- * The application container with access to db, mailer, logger, etc.
39
- */
40
- container: Container;
41
- /**
42
- * The time this workflow execution was scheduled for.
43
- */
44
- scheduledTime: Date;
45
- /**
46
- * Execute a checkpointed step within the workflow.
47
- * Steps are retried on failure and their results are durably stored.
48
- *
49
- * @param name - Unique name for this step within the workflow
50
- * @param fn - The step function to execute
51
- * @returns The result of the step function
52
- */
53
- step<T>(name: string, fn: () => Promise<T>): Promise<T>;
54
- /**
55
- * The unique ID of this workflow execution.
56
- */
57
- workflowId: string;
58
- }
59
- /**
60
- * Handle to a running or completed workflow.
61
- */
62
- interface WorkflowHandle<TOutput> {
63
- /**
64
- * Get the current status of the workflow.
65
- */
66
- getStatus(): Promise<unknown>;
67
- /**
68
- * Wait for the workflow to complete and return its result.
69
- */
70
- getResult(): Promise<TOutput>;
71
- /**
72
- * The unique ID of this workflow execution.
73
- */
74
- workflowId: string;
75
- }
76
- /**
77
- * Options for defining a workflow.
78
- */
79
- interface DefineWorkflowOptions<TInput extends z.ZodType, TOutput> {
80
- /**
81
- * Optional configuration for the workflow.
82
- */
83
- config?: {
84
- /**
85
- * Maximum number of times to attempt recovery after failure.
86
- */
87
- maxRecoveryAttempts?: number;
88
- };
89
- /**
90
- * Zod schema for validating workflow input.
91
- */
92
- input: TInput;
93
- /**
94
- * The workflow function to execute.
95
- *
96
- * @param ctx - Workflow context with container, input, and step helper
97
- * @returns The workflow result
98
- */
99
- run: (ctx: WorkflowContext<z.infer<TInput>>) => Promise<TOutput>;
100
- }
101
- /**
102
- * Defines a durable workflow that can be triggered with type-safe input.
103
- *
104
- * Workflows are:
105
- * - Durable: Automatically resume after crashes or restarts
106
- * - Type-safe: Input and output types are inferred from the schema
107
- * - Container-aware: Access to db, mailer, logger via ctx.container
108
- *
109
- * @example
110
- * ```typescript
111
- * // api/workflows/send-welcome-email.ts
112
- * export default defineWorkflow({
113
- * input: z.object({
114
- * userId: z.string(),
115
- * email: z.string().email(),
116
- * }),
117
- * async run(ctx) {
118
- * const user = await ctx.container.db.primary.query.users.findFirst({
119
- * where: eq(users.id, ctx.input.userId),
120
- * });
121
- *
122
- * await ctx.container.mailer.send({
123
- * to: ctx.input.email,
124
- * subject: "Welcome!",
125
- * });
126
- *
127
- * return { sent: true };
128
- * },
129
- * });
130
- *
131
- * // Triggering from a route:
132
- * import sendWelcomeEmail from "#api/workflows/send-welcome-email.ts";
133
- * const handle = await sendWelcomeEmail.start({ userId: "123", email: "..." });
134
- * ```
135
- */
136
- declare function defineWorkflow<TInput extends z.ZodType, TOutput>(options: DefineWorkflowOptions<TInput, TOutput>): {
137
- /**
138
- * The Zod schema for validating input.
139
- */
140
- inputSchema: TInput;
141
- /**
142
- * The workflow name (set during registration from filename).
143
- */
144
- readonly name: string | null;
145
- /**
146
- * Register this workflow with DBOS. Called by the workflow loader.
147
- *
148
- * @param c - The application container
149
- * @param name - The workflow name (derived from filename)
150
- * @param dbos - The DBOS instance to use for registration
151
- */
152
- register(c: Container, name: string, dbos: typeof DBOS): void;
153
- /**
154
- * Start this workflow with the given input.
155
- *
156
- * @param input - Input matching the workflow's input schema
157
- * @returns A handle to track and retrieve the workflow result
158
- */
159
- start(input: z.infer<TInput>): Promise<WorkflowHandle<TOutput>>;
160
- };
161
- /**
162
- * Options for defining a scheduled workflow.
163
- */
164
- interface DefineScheduledWorkflowOptions {
165
- /**
166
- * Cron expression for when to run the workflow.
167
- * Supports 5-spot (minute hour day month weekday) or
168
- * 6-spot (second minute hour day month weekday) format.
169
- *
170
- * Examples:
171
- * - "0 9 * * *" - Every day at 9am
172
- * - "0,30 * * * *" - Every 30 minutes
173
- * - "0 0 * * * *" - Every hour (6-spot with seconds)
174
- */
175
- crontab: string;
176
- /**
177
- * The workflow function to execute on schedule.
178
- *
179
- * @param ctx - Workflow context with container, scheduledTime, and step helper
180
- */
181
- run: (ctx: ScheduledWorkflowContext) => Promise<void>;
182
- }
183
- /**
184
- * Defines a scheduled workflow that runs on a cron schedule.
185
- *
186
- * @example
187
- * ```typescript
188
- * // api/workflows/daily-report.ts
189
- * export default defineScheduledWorkflow({
190
- * crontab: "0 9 * * *", // 9am daily
191
- * async run(ctx) {
192
- * const stats = await ctx.container.db.primary.query.stats.findMany();
193
- * await ctx.container.mailer.send({
194
- * to: "team@company.com",
195
- * subject: `Daily Report - ${ctx.scheduledTime.toDateString()}`,
196
- * });
197
- * },
198
- * });
199
- * ```
200
- */
201
- declare function defineScheduledWorkflow(options: DefineScheduledWorkflowOptions): {
202
- /**
203
- * The cron expression for this workflow.
204
- */
205
- crontab: string;
206
- /**
207
- * The workflow name (set during registration from filename).
208
- */
209
- readonly name: string | null;
210
- /**
211
- * Register this workflow with DBOS. Called by the workflow loader.
212
- *
213
- * @param c - The application container
214
- * @param name - The workflow name (derived from filename)
215
- * @param dbos - The DBOS instance to use for registration
216
- */
217
- register(c: Container, name: string, dbos: typeof DBOS): void;
218
- };
219
- /**
220
- * Options for loading workflows.
221
- */
222
- interface LoadWorkflowsOptions {
223
- /**
224
- * The application container.
225
- */
226
- container: Container;
227
- /**
228
- * The DBOS instance to use for registration.
229
- */
230
- dbos: typeof DBOS;
231
- /**
232
- * Optional custom workflows directory path.
233
- */
234
- workflowsDir?: string;
235
- }
236
- /**
237
- * Auto-discovers and registers all workflows.
238
- *
239
- * Algorithm:
240
- * 1. Register built-in workflows (extractBlobMetadata, generateImageVariant, etc.)
241
- * 2. Register scheduled workflows (purgeAuditLogs, purgeUnattachedBlobs)
242
- * 3. Glob all .ts files in the directory (excluding test files)
243
- * 4. Import each module's default export
244
- * 5. If it has a register method, call register(container, name, dbos)
245
- *
246
- * @param opts - Load workflows options
247
- */
248
- declare function loadWorkflows(opts: LoadWorkflowsOptions): Promise<void>;
249
- //#endregion
250
- export { ScheduledWorkflowContext, WorkflowContext, WorkflowHandle, defineScheduledWorkflow, defineWorkflow, loadWorkflows };
@@ -1,373 +0,0 @@
1
- import { sql } from "drizzle-orm";
2
- import { pgTable } from "drizzle-orm/pg-core";
3
-
4
- //#region src/api/auth-schema.ts
5
- /**
6
- * Defines the authentication schema for the application.
7
- *
8
- * @returns An object containing the schema and relations for the authentication tables.
9
- */
10
- function defineAuthSchema() {
11
- const accounts = pgTable("accounts", (t) => ({
12
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
13
- accessToken: t.text("access_token"),
14
- accessTokenExpiresAt: t.timestamp("access_token_expires_at", {
15
- mode: "string",
16
- withTimezone: true
17
- }),
18
- accountId: t.text("account_id").notNull(),
19
- createdAt: t.timestamp("created_at", {
20
- mode: "string",
21
- withTimezone: true
22
- }).default(sql`NOW()`).notNull(),
23
- idToken: t.text("id_token"),
24
- providerId: t.text("provider_id").notNull(),
25
- password: t.text("password"),
26
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
27
- refreshToken: t.text("refresh_token"),
28
- refreshTokenExpiresAt: t.timestamp("refresh_token_expires_at", {
29
- mode: "string",
30
- withTimezone: true
31
- }),
32
- scope: t.text("scope"),
33
- updatedAt: t.timestamp("updated_at", {
34
- mode: "string",
35
- withTimezone: true
36
- }).default(sql`NOW()`).notNull()
37
- }), (t) => []);
38
- const apiKeys = pgTable("api_keys", (t) => ({
39
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
40
- name: t.text("name"),
41
- enabled: t.boolean("enabled").default(true),
42
- expiresAt: t.timestamp("expires_at", {
43
- mode: "string",
44
- withTimezone: true
45
- }),
46
- key: t.text("key").notNull(),
47
- lastRefillAt: t.timestamp("last_refill_at", {
48
- mode: "string",
49
- withTimezone: true
50
- }),
51
- lastRequest: t.timestamp("last_request", {
52
- mode: "string",
53
- withTimezone: true
54
- }),
55
- lastUsedAt: t.timestamp("last_used_at", {
56
- mode: "string",
57
- withTimezone: true
58
- }),
59
- metadata: t.text("metadata"),
60
- permissions: t.text("permissions"),
61
- prefix: t.text("prefix"),
62
- rateLimitEnabled: t.boolean("rate_limit_enabled").default(true),
63
- rateLimitTimeWindow: t.integer("rate_limit_time_window").default(864e5),
64
- rateLimitMax: t.integer("rate_limit_max").default(10),
65
- refillInterval: t.integer("refill_interval"),
66
- refillAmount: t.integer("refill_amount"),
67
- requestCount: t.integer("request_count"),
68
- remaining: t.integer("remaining"),
69
- start: t.text("start"),
70
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
71
- createdAt: t.timestamp("created_at", {
72
- mode: "string",
73
- withTimezone: true
74
- }).default(sql`NOW()`).notNull(),
75
- updatedAt: t.timestamp("updated_at", {
76
- mode: "string",
77
- withTimezone: true
78
- }).default(sql`NOW()`).notNull()
79
- }), (t) => []);
80
- const invitations = pgTable("invitations", (t) => ({
81
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
82
- email: t.text("email").notNull(),
83
- expiresAt: t.timestamp("expires_at", {
84
- mode: "string",
85
- withTimezone: true
86
- }).notNull(),
87
- inviterId: t.text("inviter_id").notNull().references(() => users.id, { onDelete: "cascade" }),
88
- organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
89
- role: t.text("role"),
90
- status: t.text("status").default("pending").notNull(),
91
- teamId: t.text("team_id"),
92
- createdAt: t.timestamp("created_at", {
93
- mode: "string",
94
- withTimezone: true
95
- }).default(sql`NOW()`).notNull(),
96
- updatedAt: t.timestamp("updated_at", {
97
- mode: "string",
98
- withTimezone: true
99
- }).default(sql`NOW()`).notNull()
100
- }), (t) => []);
101
- const members = pgTable("members", (t) => ({
102
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
103
- organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
104
- role: t.text("role").default("member").notNull(),
105
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
106
- createdAt: t.timestamp("created_at", {
107
- mode: "string",
108
- withTimezone: true
109
- }).default(sql`NOW()`).notNull()
110
- }), (t) => []);
111
- const organizations = pgTable("organizations", (t) => ({
112
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
113
- name: t.text("name").notNull(),
114
- slug: t.text("slug").unique(),
115
- logo: t.text("logo"),
116
- createdAt: t.timestamp("created_at", {
117
- mode: "string",
118
- withTimezone: true
119
- }).default(sql`NOW()`).notNull(),
120
- updatedAt: t.timestamp("updated_at", {
121
- mode: "string",
122
- withTimezone: true
123
- }).default(sql`NOW()`).notNull(),
124
- metadata: t.text("metadata")
125
- }), (t) => []);
126
- const sessions = pgTable("sessions", (t) => ({
127
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
128
- activeOrganizationId: t.text("active_organization_id").references(() => organizations.id, { onDelete: "set null" }),
129
- activeTeamId: t.text("active_team_id"),
130
- createdAt: t.timestamp("created_at", {
131
- mode: "string",
132
- withTimezone: true
133
- }).default(sql`NOW()`).notNull(),
134
- expiresAt: t.timestamp("expires_at", {
135
- mode: "string",
136
- withTimezone: true
137
- }).notNull(),
138
- impersonatedBy: t.text("impersonated_by").references(() => users.id, { onDelete: "set null" }),
139
- ipAddress: t.text("ip_address"),
140
- token: t.text("token").notNull().unique(),
141
- updatedAt: t.timestamp("updated_at", {
142
- mode: "string",
143
- withTimezone: true
144
- }).default(sql`NOW()`).notNull(),
145
- userAgent: t.text("user_agent"),
146
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
147
- }), (t) => []);
148
- const ssoProviders = pgTable("sso_providers", (t) => ({
149
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
150
- domain: t.text("domain").notNull(),
151
- issuer: t.text("issuer").notNull(),
152
- oidcConfig: t.text("oidc_config"),
153
- organizationId: t.text("organization_id").references(() => organizations.id, { onDelete: "cascade" }),
154
- providerId: t.text("provider_id").notNull().unique(),
155
- samlConfig: t.text("saml_config"),
156
- userId: t.text("user_id").references(() => users.id, { onDelete: "cascade" })
157
- }), (t) => []);
158
- const users = pgTable("users", (t) => ({
159
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
160
- banExpires: t.timestamp("ban_expires", {
161
- mode: "string",
162
- withTimezone: true
163
- }),
164
- banReason: t.text("ban_reason"),
165
- banned: t.boolean("banned").default(false),
166
- createdAt: t.timestamp("created_at", {
167
- mode: "string",
168
- withTimezone: true
169
- }).default(sql`NOW()`).notNull(),
170
- displayUsername: t.text("display_username"),
171
- email: t.text("email").notNull().unique(),
172
- emailVerified: t.boolean("email_verified").default(false).notNull(),
173
- image: t.text("image"),
174
- isAnonymous: t.boolean("is_anonymous"),
175
- lastLoginMethod: t.text("last_login_method"),
176
- name: t.text("name").notNull(),
177
- phoneNumber: t.text("phone_number").unique(),
178
- phoneNumberVerified: t.boolean("phone_number_verified"),
179
- role: t.text("role"),
180
- twoFactorEnabled: t.boolean("two_factor_enabled").default(false),
181
- updatedAt: t.timestamp("updated_at", {
182
- mode: "string",
183
- withTimezone: true
184
- }).default(sql`NOW()`).notNull(),
185
- username: t.text("username").unique()
186
- }), (t) => []);
187
- const teams = pgTable("teams", (t) => ({
188
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
189
- name: t.text("name").notNull(),
190
- organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
191
- createdAt: t.timestamp("created_at", {
192
- mode: "string",
193
- withTimezone: true
194
- }).default(sql`NOW()`).notNull(),
195
- updatedAt: t.timestamp("updated_at", {
196
- mode: "string",
197
- withTimezone: true
198
- }).default(sql`NOW()`).notNull()
199
- }), (t) => []);
200
- const teamMembers = pgTable("team_members", (t) => ({
201
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
202
- teamId: t.text("team_id").notNull().references(() => teams.id, { onDelete: "cascade" }),
203
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
204
- createdAt: t.timestamp("created_at", {
205
- mode: "string",
206
- withTimezone: true
207
- }).default(sql`NOW()`).notNull()
208
- }), (t) => []);
209
- const twoFactors = pgTable("two_factors", (t) => ({
210
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
211
- secret: t.text("secret").notNull(),
212
- backupCodes: t.text("backup_codes").notNull(),
213
- userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
214
- }), (t) => []);
215
- const verifications = pgTable("verifications", (t) => ({
216
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
217
- createdAt: t.timestamp("created_at", {
218
- mode: "string",
219
- withTimezone: true
220
- }).default(sql`NOW()`).notNull(),
221
- expiresAt: t.timestamp("expires_at", {
222
- mode: "string",
223
- withTimezone: true
224
- }).notNull(),
225
- identifier: t.text("identifier").notNull(),
226
- updatedAt: t.timestamp("updated_at", {
227
- mode: "string",
228
- withTimezone: true
229
- }).default(sql`NOW()`).notNull(),
230
- value: t.text("value").notNull()
231
- }), (t) => []);
232
- return {
233
- tables: {
234
- accounts,
235
- apiKeys,
236
- auditLogs: pgTable("audit_logs", (t) => ({
237
- id: t.text("id").primaryKey().default(sql`uuidv7()`),
238
- tableName: t.text("table_name"),
239
- action: t.text("action").notNull(),
240
- customAction: t.text("custom_action"),
241
- oldData: t.jsonb("old_data"),
242
- newData: t.jsonb("new_data"),
243
- metadata: t.jsonb("metadata"),
244
- organizationId: t.text("organization_id").references(() => organizations.id, { onDelete: "set null" }),
245
- userId: t.text("user_id").references(() => users.id, { onDelete: "set null" }),
246
- sessionId: t.text("session_id").references(() => sessions.id, { onDelete: "set null" }),
247
- requestId: t.text("request_id"),
248
- createdAt: t.timestamp("created_at", {
249
- mode: "string",
250
- withTimezone: true
251
- }).default(sql`NOW()`).notNull()
252
- }), (t) => []),
253
- invitations,
254
- members,
255
- organizations,
256
- sessions,
257
- ssoProviders,
258
- teams,
259
- teamMembers,
260
- twoFactors,
261
- users,
262
- verifications
263
- },
264
- relations: (r) => ({
265
- users: {
266
- sessions: r.many.sessions({
267
- from: r.users.id,
268
- to: r.sessions.userId
269
- }),
270
- accounts: r.many.accounts({
271
- from: r.users.id,
272
- to: r.accounts.userId
273
- }),
274
- apiKeys: r.many.apiKeys({
275
- from: r.users.id,
276
- to: r.apiKeys.userId
277
- }),
278
- memberships: r.many.members({
279
- from: r.users.id,
280
- to: r.members.userId
281
- }),
282
- invitations: r.many.invitations({
283
- from: r.users.id,
284
- to: r.invitations.inviterId
285
- }),
286
- ssoProvider: r.one.ssoProviders({
287
- from: r.users.id,
288
- to: r.ssoProviders.userId
289
- }),
290
- twoFactor: r.one.twoFactors({
291
- from: r.users.id,
292
- to: r.twoFactors.userId
293
- })
294
- },
295
- sessions: { user: r.one.users({
296
- from: r.sessions.userId,
297
- to: r.users.id
298
- }) },
299
- accounts: { user: r.one.users({
300
- from: r.accounts.userId,
301
- to: r.users.id
302
- }) },
303
- apiKeys: { user: r.one.users({
304
- from: r.apiKeys.userId,
305
- to: r.users.id
306
- }) },
307
- organizations: {
308
- members: r.many.members({
309
- from: r.organizations.id,
310
- to: r.members.organizationId
311
- }),
312
- invitations: r.many.invitations({
313
- from: r.organizations.id,
314
- to: r.invitations.organizationId
315
- }),
316
- teams: r.many.teams({
317
- from: r.organizations.id,
318
- to: r.teams.organizationId
319
- })
320
- },
321
- members: {
322
- organization: r.one.organizations({
323
- from: r.members.organizationId,
324
- to: r.organizations.id
325
- }),
326
- user: r.one.users({
327
- from: r.members.userId,
328
- to: r.users.id
329
- })
330
- },
331
- invitations: {
332
- organization: r.one.organizations({
333
- from: r.invitations.organizationId,
334
- to: r.organizations.id
335
- }),
336
- inviter: r.one.users({
337
- from: r.invitations.inviterId,
338
- to: r.users.id
339
- })
340
- },
341
- teams: { organization: r.one.organizations({
342
- from: r.teams.organizationId,
343
- to: r.organizations.id
344
- }) },
345
- ssoProviders: { user: r.one.users({
346
- from: r.ssoProviders.userId,
347
- to: r.users.id
348
- }) },
349
- verifications: {},
350
- twoFactors: { user: r.one.users({
351
- from: r.twoFactors.userId,
352
- to: r.users.id
353
- }) },
354
- auditLogs: {
355
- organization: r.one.organizations({
356
- from: r.auditLogs.organizationId,
357
- to: r.organizations.id
358
- }),
359
- user: r.one.users({
360
- from: r.auditLogs.userId,
361
- to: r.users.id
362
- }),
363
- session: r.one.sessions({
364
- from: r.auditLogs.sessionId,
365
- to: r.sessions.id
366
- })
367
- }
368
- })
369
- };
370
- }
371
-
372
- //#endregion
373
- export { defineAuthSchema };