appos 0.6.0-0 → 0.7.0-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.
- package/dist/alert-BdX0Zt8k.js +103 -0
- package/dist/animated-check-CKu20goQ.js +68 -0
- package/dist/api/auth.d.mts +4 -0
- package/dist/api/auth.mjs +276 -0
- package/dist/api/cache.d.mts +3 -0
- package/dist/api/cache.mjs +28 -0
- package/dist/{exports/cli/index.d.mts → api/cli.d.mts} +8 -7
- package/dist/{exports/cli/index.mjs → api/cli.mjs} +46 -56
- package/dist/api/container.d.mts +6 -0
- package/dist/api/container.mjs +52 -0
- package/dist/api/database.d.mts +5 -0
- package/dist/api/database.mjs +8 -0
- package/dist/api/event.d.mts +6 -0
- package/dist/api/event.mjs +5 -0
- package/dist/api/instrumentation.d.mts +4 -0
- package/dist/api/instrumentation.mjs +11 -0
- package/dist/api/mailer.d.mts +6 -0
- package/dist/api/mailer.mjs +114 -0
- package/dist/api/observability.d.mts +4 -0
- package/dist/api/observability.mjs +79 -0
- package/dist/api/openapi.d.mts +6 -0
- package/dist/api/openapi.mjs +5 -0
- package/dist/api/server.d.mts +6 -0
- package/dist/api/server.mjs +8 -0
- package/dist/{exports/web/routes.d.mts → api/ssr.d.mts} +26 -11
- package/dist/{exports/web/routes.mjs → api/ssr.mjs} +24 -28
- package/dist/api/storage.d.mts +6 -0
- package/dist/{exports/api/index.mjs → api/storage.mjs} +77 -736
- package/dist/api/worker.d.mts +26 -0
- package/dist/api/worker.mjs +3 -0
- package/dist/api/workflow.d.mts +6 -0
- package/dist/api/workflow.mjs +7 -0
- package/dist/app-context-Cossa4Qc.mjs +3 -0
- package/dist/auth-BBivVOI9.mjs +26 -0
- package/dist/{exports/web/index.d.ts → auth-CmsO5ob5.d.ts} +6657 -9434
- package/dist/auth-D0zoZI7U.d.mts +5145 -0
- package/dist/auth-schema-OUnjUQlj.mjs +385 -0
- package/dist/badge-BFQXkO9d.js +49 -0
- package/dist/brand-C669gH_G.d.ts +88 -0
- package/dist/brand-CjbfdIEo.js +114 -0
- package/dist/button-CBH7xJ8q.js +81 -0
- package/dist/cache-jHw6mJPK.d.mts +75 -0
- package/dist/card-X792kQrC.js +154 -0
- package/dist/checkbox-e3A3glfd.js +33 -0
- package/dist/{exports/constants-BicCnEiJ.mjs → constants-DCwXUedR.mjs} +40 -6
- package/dist/container-xweZOaov.d.mts +2842 -0
- package/dist/context-9Yd81kh5.mjs +13 -0
- package/dist/context-La08hSVU.js +45 -0
- package/dist/database-Ca_pujXd.d.mts +102 -0
- package/dist/database-DSEtnffO.mjs +220 -0
- package/dist/{exports/storybook/index.d.ts → devtools/storybook.d.ts} +1 -1
- package/dist/{exports/storybook/index.js → devtools/storybook.js} +1 -1
- package/dist/devtools/test-mock.mjs +3 -0
- package/dist/{exports/tests/setup.mjs → devtools/test-setup.mjs} +1 -1
- package/dist/{exports/tests/api.d.mts → devtools/test.d.mts} +16 -6
- package/dist/{exports/tests/api.mjs → devtools/test.mjs} +30 -15
- package/dist/{exports/vite/index.d.mts → devtools/vite.d.mts} +65 -6
- package/dist/{exports/vite/index.mjs → devtools/vite.mjs} +157 -6
- package/dist/empty-BonqCObb.js +61 -0
- package/dist/env-C-0yH_Q3.mjs +26 -0
- package/dist/event-1yFQJHwn.mjs +236 -0
- package/dist/field-7rMKJCeh.js +115 -0
- package/dist/input-D9PbuBOa.js +27 -0
- package/dist/input-otp-zHrdocki.js +48 -0
- package/dist/{exports/instrumentation-Dqv_rRlR.mjs → instrumentation-DCouyaIn.mjs} +1 -1
- package/dist/label-C0h_-ojZ.js +26 -0
- package/dist/logger-rlLu_iK1.d.mts +20 -0
- package/dist/observability-Bd2pNUXs.d.mts +43 -0
- package/dist/openapi-DVd0_Ppp.mjs +467 -0
- package/dist/panel-Cy7DsMUA.mjs +57 -0
- package/dist/panel-D1XK_PR5.mjs +5 -0
- package/dist/redis-a5sw5J3L.mjs +41 -0
- package/dist/routes-BB8_4xq3.mjs +1123 -0
- package/dist/routes-Dv-T8LMT.mjs +4 -0
- package/dist/separator-DDbWY6ol.js +28 -0
- package/dist/server-CWYF5Oeg.mjs +1673 -0
- package/dist/spinner-CaEB5f1z.js +28 -0
- package/dist/textarea-CFblOAyj.js +25 -0
- package/dist/universal/auth.d.ts +139 -0
- package/dist/universal/auth.js +108 -0
- package/dist/universal/config.d.ts +47 -0
- package/dist/universal/config.js +128 -0
- package/dist/use-mobile-Dg2CI44J.js +19 -0
- package/dist/utils-4n921m5r.js +52 -0
- package/dist/utils-NKi1RiLK.d.ts +50 -0
- package/dist/web/auth.d.ts +4 -0
- package/dist/web/auth.js +88 -0
- package/dist/web/hooks.d.ts +4 -0
- package/dist/web/hooks.js +3 -0
- package/dist/web/i18n.d.ts +76 -0
- package/dist/web/i18n.js +58 -0
- package/dist/web/router.d.ts +3 -0
- package/dist/web/router.js +4 -0
- package/dist/web/ui/accordion.d.ts +79 -0
- package/dist/web/ui/accordion.js +112 -0
- package/dist/web/ui/alert-dialog.d.ts +200 -0
- package/dist/web/ui/alert-dialog.js +239 -0
- package/dist/web/ui/alert.d.ts +84 -0
- package/dist/web/ui/alert.js +4 -0
- package/dist/web/ui/animated-check.d.ts +38 -0
- package/dist/web/ui/animated-check.js +6 -0
- package/dist/web/ui/aspect-ratio.d.ts +26 -0
- package/dist/web/ui/aspect-ratio.js +28 -0
- package/dist/web/ui/auth.d.ts +4 -0
- package/dist/web/ui/auth.js +3432 -0
- package/dist/web/ui/avatar.d.ts +115 -0
- package/dist/web/ui/avatar.js +134 -0
- package/dist/web/ui/badge.d.ts +32 -0
- package/dist/web/ui/badge.js +4 -0
- package/dist/web/ui/brand.d.ts +3 -0
- package/dist/web/ui/brand.js +6 -0
- package/dist/web/ui/breadcrumb.d.ts +130 -0
- package/dist/web/ui/breadcrumb.js +166 -0
- package/dist/web/ui/button-group.d.ts +28 -0
- package/dist/web/ui/button-group.js +43 -0
- package/dist/web/ui/button.d.ts +83 -0
- package/dist/web/ui/button.js +6 -0
- package/dist/web/ui/calendar.d.ts +26 -0
- package/dist/web/ui/calendar.js +107 -0
- package/dist/web/ui/card.d.ts +134 -0
- package/dist/web/ui/card.js +4 -0
- package/dist/web/ui/carousel.d.ts +56 -0
- package/dist/web/ui/carousel.js +135 -0
- package/dist/web/ui/chart.d.ts +90 -0
- package/dist/web/ui/chart.js +142 -0
- package/dist/web/ui/checkbox.d.ts +22 -0
- package/dist/web/ui/checkbox.js +6 -0
- package/dist/web/ui/collapsible.d.ts +15 -0
- package/dist/web/ui/collapsible.js +27 -0
- package/dist/web/ui/command.d.ts +55 -0
- package/dist/web/ui/command.js +93 -0
- package/dist/web/ui/context-menu.d.ts +80 -0
- package/dist/web/ui/context-menu.js +133 -0
- package/dist/web/ui/dialog.d.ts +169 -0
- package/dist/web/ui/dialog.js +212 -0
- package/dist/web/ui/drawer.d.ts +44 -0
- package/dist/web/ui/drawer.js +80 -0
- package/dist/web/ui/dropdown-menu.d.ts +84 -0
- package/dist/web/ui/dropdown-menu.js +137 -0
- package/dist/web/ui/empty.d.ts +36 -0
- package/dist/web/ui/empty.js +4 -0
- package/dist/web/ui/error-page.d.ts +32 -0
- package/dist/web/ui/error-page.js +87 -0
- package/dist/web/ui/field.d.ts +67 -0
- package/dist/web/ui/field.js +8 -0
- package/dist/web/ui/hover-card.d.ts +20 -0
- package/dist/web/ui/hover-card.js +39 -0
- package/dist/web/ui/input-group.d.ts +45 -0
- package/dist/web/ui/input-group.js +81 -0
- package/dist/web/ui/input-otp.d.ts +28 -0
- package/dist/web/ui/input-otp.js +6 -0
- package/dist/web/ui/input.d.ts +22 -0
- package/dist/web/ui/input.js +4 -0
- package/dist/web/ui/item.d.ts +61 -0
- package/dist/web/ui/item.js +122 -0
- package/dist/web/ui/kbd.d.ts +14 -0
- package/dist/web/ui/kbd.js +21 -0
- package/dist/web/ui/label.d.ts +22 -0
- package/dist/web/ui/label.js +6 -0
- package/dist/web/ui/menubar.d.ts +80 -0
- package/dist/web/ui/menubar.js +136 -0
- package/dist/web/ui/navigation-menu.d.ts +46 -0
- package/dist/web/ui/navigation-menu.js +84 -0
- package/dist/web/ui/pagination.d.ts +131 -0
- package/dist/web/ui/pagination.js +171 -0
- package/dist/web/ui/popover.d.ts +33 -0
- package/dist/web/ui/popover.js +57 -0
- package/dist/web/ui/progress.d.ts +74 -0
- package/dist/web/ui/progress.js +93 -0
- package/dist/web/ui/radio-group.d.ts +15 -0
- package/dist/web/ui/radio-group.js +31 -0
- package/dist/web/ui/resizable.d.ts +20 -0
- package/dist/web/ui/resizable.js +31 -0
- package/dist/web/ui/scroll-area.d.ts +16 -0
- package/dist/web/ui/scroll-area.js +39 -0
- package/dist/web/ui/select.d.ts +167 -0
- package/dist/web/ui/select.js +211 -0
- package/dist/web/ui/separator.d.ts +23 -0
- package/dist/web/ui/separator.js +6 -0
- package/dist/web/ui/sheet.d.ts +42 -0
- package/dist/web/ui/sheet.js +91 -0
- package/dist/web/ui/sidebar.d.ts +160 -0
- package/dist/web/ui/sidebar.js +382 -0
- package/dist/web/ui/skeleton.d.ts +22 -0
- package/dist/web/ui/skeleton.js +26 -0
- package/dist/web/ui/slider.d.ts +26 -0
- package/dist/web/ui/slider.js +55 -0
- package/dist/web/ui/sonner.d.ts +9 -0
- package/dist/web/ui/sonner.js +33 -0
- package/dist/web/ui/spinner.d.ts +22 -0
- package/dist/web/ui/spinner.js +4 -0
- package/dist/web/ui/switch.d.ts +25 -0
- package/dist/web/ui/switch.js +34 -0
- package/dist/web/ui/table.d.ts +38 -0
- package/dist/web/ui/table.js +69 -0
- package/dist/web/ui/tabs.d.ts +84 -0
- package/dist/web/ui/tabs.js +103 -0
- package/dist/web/ui/textarea.d.ts +21 -0
- package/dist/web/ui/textarea.js +4 -0
- package/dist/web/ui/toggle-group.d.ts +28 -0
- package/dist/web/ui/toggle-group.js +55 -0
- package/dist/web/ui/toggle.d.ts +32 -0
- package/dist/web/ui/toggle.js +53 -0
- package/dist/web/ui/tooltip.d.ts +72 -0
- package/dist/web/ui/tooltip.js +91 -0
- package/dist/worker-D4L3BmuS.mjs +24 -0
- package/dist/{exports/send-email-CXxlkfFL.mjs → workflow-BUI7kC5c.mjs} +118 -765
- package/package.json +382 -90
- package/src/devtools/panel/index.ts +114 -0
- package/src/devtools/panel/modules/emails/compatibility.ts +289 -0
- package/src/devtools/panel/modules/emails/discovery.ts +242 -0
- package/src/devtools/panel/modules/emails/linter.ts +501 -0
- package/src/devtools/panel/modules/emails/render.ts +155 -0
- package/src/devtools/panel/modules/emails/routes.ts +502 -0
- package/src/devtools/panel/modules/emails/schema.ts +82 -0
- package/src/devtools/panel/modules/emails/spam-checker.ts +231 -0
- package/src/{storybook → devtools/storybook}/.storybook/main.ts +12 -4
- package/src/{storybook → devtools/storybook}/.storybook/manager.ts +1 -1
- package/src/{storybook → devtools/storybook}/.storybook/preview.tsx +7 -1
- package/src/{storybook → devtools/storybook}/docs/Introduction.mdx +3 -1
- package/src/{web/client/auth-paths.ts → universal/auth.ts} +54 -6
- package/src/universal/config.test.ts +473 -0
- package/src/universal/config.ts +205 -0
- package/src/universal/date.ts +1 -0
- package/src/universal/locales/en/ui.json +232 -0
- package/src/universal/locales/zh-CN/ui.json +232 -0
- package/src/universal/locales/zh-TW/ui.json +232 -0
- package/src/universal/toolkit.ts +1 -0
- package/src/universal/zod.ts +1 -0
- package/src/web/auth.ts +6 -0
- package/src/web/client/auth.ts +6 -11
- package/src/web/client/i18n.d.ts +2 -0
- package/src/web/client/i18n.ts +6 -1
- package/src/web/devtools/index.ts +1 -0
- package/src/web/devtools/modules/dashboard.tsx +151 -0
- package/src/web/devtools/modules/emails.tsx +1338 -0
- package/src/web/devtools/overlay.tsx +109 -0
- package/src/web/devtools/panel.tsx +353 -0
- package/src/web/font/index.ts +1 -3
- package/src/web/hooks.ts +4 -0
- package/src/web/i18n.ts +11 -0
- package/src/web/index.ts +1 -2
- package/src/web/router.ts +5 -0
- package/src/web/routes/auth/_layout.tsx +17 -15
- package/src/web/routes/auth/email-otp.tsx +2 -2
- package/src/web/routes/auth/forgot-password.tsx +1 -1
- package/src/web/routes/auth/login.tsx +3 -2
- package/src/web/routes/auth/phone-otp.tsx +2 -2
- package/src/web/routes/auth/reset-password.tsx +3 -7
- package/src/web/routes/auth/signup.tsx +2 -2
- package/src/web/routes/auth/utils.ts +21 -10
- package/src/web/routes/auth/verify-email.tsx +2 -2
- package/src/web/routes.ts +4 -9
- package/src/web/ui/alert-dialog.stories.tsx +2 -2
- package/src/web/ui/auth/auth-layout.stories.tsx +81 -72
- package/src/web/ui/auth/auth-layout.tsx +70 -138
- package/src/web/ui/auth/brand-content.stories.tsx +272 -0
- package/src/web/ui/auth/brand-content.tsx +431 -0
- package/src/web/ui/auth/context.tsx +2 -2
- package/src/web/ui/auth/hooks.ts +1 -1
- package/src/web/ui/auth/index.ts +24 -1
- package/src/web/ui/auth.ts +4 -0
- package/src/web/ui/checkbox.stories.tsx +2 -1
- package/src/web/ui/collapsible.stories.tsx +2 -2
- package/src/web/ui/command.stories.tsx +1 -1
- package/src/web/ui/context-menu.stories.tsx +1 -1
- package/src/web/ui/dialog.stories.tsx +4 -4
- package/src/web/ui/drawer.stories.tsx +4 -4
- package/src/web/ui/dropdown-menu.stories.tsx +2 -2
- package/src/web/ui/empty.stories.tsx +2 -2
- package/src/web/ui/error-page.stories.tsx +1 -1
- package/src/web/ui/error-page.tsx +1 -1
- package/src/web/ui/field.stories.tsx +5 -6
- package/src/web/ui/globals.css +2 -1
- package/src/web/ui/hover-card.stories.tsx +3 -5
- package/src/web/ui/input-group.stories.tsx +2 -2
- package/src/web/ui/input-otp.stories.tsx +1 -1
- package/src/web/ui/input.stories.tsx +2 -1
- package/src/web/ui/item.stories.tsx +3 -3
- package/src/web/ui/kbd.stories.tsx +1 -1
- package/src/web/ui/label.stories.tsx +4 -1
- package/src/web/ui/locales/en/devtools.json +102 -0
- package/src/web/ui/locales/zh-CN/devtools.json +102 -0
- package/src/web/ui/locales/zh-TW/devtools.json +102 -0
- package/src/web/ui/menubar.stories.tsx +1 -1
- package/src/web/ui/navigation-menu.stories.tsx +1 -1
- package/src/web/ui/navigation-menu.tsx +3 -3
- package/src/web/ui/pagination.stories.tsx +1 -1
- package/src/web/ui/popover.stories.tsx +4 -4
- package/src/web/ui/progress.stories.tsx +1 -1
- package/src/web/ui/radio-group.stories.tsx +3 -4
- package/src/web/ui/resizable.stories.tsx +1 -1
- package/src/web/ui/scroll-area.stories.tsx +2 -1
- package/src/web/ui/select.stories.tsx +1 -1
- package/src/web/ui/sheet.stories.tsx +4 -4
- package/src/web/ui/sidebar.stories.tsx +1 -1
- package/src/web/ui/sidebar.tsx +1 -1
- package/src/web/ui/skeleton.stories.tsx +1 -1
- package/src/web/ui/slider.stories.tsx +1 -1
- package/src/web/ui/sonner.stories.tsx +2 -1
- package/src/web/ui/spinner.stories.tsx +2 -1
- package/src/web/ui/switch.stories.tsx +2 -1
- package/src/web/ui/table.stories.tsx +3 -3
- package/src/web/ui/tabs.stories.tsx +5 -8
- package/src/web/ui/textarea.stories.tsx +3 -1
- package/src/web/ui/toggle.stories.tsx +1 -1
- package/src/web/ui/tooltip.stories.tsx +2 -2
- package/dist/exports/api/index.d.mts +0 -5
- package/dist/exports/api/orm-seed.d.mts +0 -1
- package/dist/exports/api/orm-seed.mjs +0 -3
- package/dist/exports/api/orm.d.mts +0 -3
- package/dist/exports/api/orm.mjs +0 -5
- package/dist/exports/api/workflows/index.d.mts +0 -74
- package/dist/exports/api/workflows/index.mjs +0 -4
- package/dist/exports/app-context-B1VJ9qnH.mjs +0 -3
- package/dist/exports/auth-BCOIpGDO.d.mts +0 -870
- package/dist/exports/index-Di4PdhuL.d.mts +0 -7174
- package/dist/exports/instrumentation.d.mts +0 -2
- package/dist/exports/instrumentation.mjs +0 -5
- package/dist/exports/mock-DLfalkIV.mjs +0 -9
- package/dist/exports/openapi-uisUTLq7.mjs +0 -1483
- package/dist/exports/orm-D-7F2n1J.d.mts +0 -10
- package/dist/exports/orm-DbH3_5aw.mjs +0 -36
- package/dist/exports/server-cD8Pckgj.mjs +0 -509
- package/dist/exports/ssr-BsfNjYlJ.mjs +0 -16
- package/dist/exports/tests/mock.mjs +0 -5
- package/dist/exports/tests/react.d.mts +0 -2
- package/dist/exports/tests/react.mjs +0 -5
- package/dist/exports/web/index.js +0 -8178
- package/dist/exports/web/ssr.d.mts +0 -20
- package/dist/exports/web/ssr.mjs +0 -3
- /package/dist/{exports/app-context-LF4QmPUC.mjs → app-context-CaxDuPj-.mjs} +0 -0
- /package/dist/{exports/chunk-DCbLExaX.mjs → chunk-BkPCcwIn.mjs} +0 -0
- /package/dist/{exports/tests/mock.d.mts → devtools/test-mock.d.mts} +0 -0
- /package/dist/{exports/tests/setup.d.mts → devtools/test-setup.d.mts} +0 -0
- /package/dist/{exports/instrumentation-CFIspF8-.d.mts → instrumentation-DhJYpza5.d.mts} +0 -0
- /package/dist/{exports/vendors → universal}/date.d.ts +0 -0
- /package/dist/{exports/vendors → universal}/date.js +0 -0
- /package/dist/{exports/vendors → universal}/toolkit.d.ts +0 -0
- /package/dist/{exports/vendors → universal}/toolkit.js +0 -0
- /package/dist/{exports/vendors → universal}/zod.d.ts +0 -0
- /package/dist/{exports/vendors → universal}/zod.js +0 -0
- /package/dist/{exports/vite-compat-CICObU9F.mjs → vite-compat-El4psBQm.mjs} +0 -0
- /package/dist/{exports/youch-handler-CHwX0Fou.mjs → youch-handler-D951Exws.mjs} +0 -0
- /package/src/{storybook → devtools/storybook}/components/ColorGrid.tsx +0 -0
- /package/src/{storybook → devtools/storybook}/components/IconGallery.tsx +0 -0
- /package/src/{storybook → devtools/storybook}/components/SpacingScale.tsx +0 -0
- /package/src/{storybook → devtools/storybook}/components/TypographyScale.tsx +0 -0
- /package/src/{storybook → devtools/storybook}/components/index.ts +0 -0
- /package/src/{storybook → devtools/storybook}/docs/foundations/Colors.mdx +0 -0
- /package/src/{storybook → devtools/storybook}/docs/foundations/Icons.mdx +0 -0
- /package/src/{storybook → devtools/storybook}/docs/foundations/Spacing.mdx +0 -0
- /package/src/{storybook → devtools/storybook}/docs/foundations/Typography.mdx +0 -0
- /package/src/{storybook → devtools/storybook}/index.ts +0 -0
- /package/src/{storybook → devtools/storybook}/shims/void-elements.js +0 -0
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import "../
|
|
6
|
-
import {
|
|
7
|
-
import "../
|
|
1
|
+
import "../auth-schema-OUnjUQlj.mjs";
|
|
2
|
+
import "../redis-a5sw5J3L.mjs";
|
|
3
|
+
import { a as COMMANDS_DIR, d as FILE_EXT, f as FIXTURES_DIR, m as MAIN_ENTRY, o as DATABASES_DIR, r as BUILD_DIR, t as APPOS_DIR, v as TEST_EXTENSIONS, x as version, y as WEB_DIR } from "../constants-DCwXUedR.mjs";
|
|
4
|
+
import { a as loadEvents } from "../event-1yFQJHwn.mjs";
|
|
5
|
+
import { i as loadWorkflows } from "../workflow-BUI7kC5c.mjs";
|
|
6
|
+
import { r as defineMigrationOpts } from "../database-DSEtnffO.mjs";
|
|
7
|
+
import { t as defineServer } from "../server-CWYF5Oeg.mjs";
|
|
8
|
+
import "../instrumentation-DCouyaIn.mjs";
|
|
9
|
+
import "../app-context-CaxDuPj-.mjs";
|
|
10
|
+
import "../openapi-DVd0_Ppp.mjs";
|
|
11
|
+
import "../context-9Yd81kh5.mjs";
|
|
12
|
+
import { t as defineWorker } from "../worker-D4L3BmuS.mjs";
|
|
8
13
|
import { createRequire } from "node:module";
|
|
9
14
|
import { z } from "zod";
|
|
10
15
|
import path, { dirname, join } from "node:path";
|
|
11
|
-
import { migrate } from "drizzle-orm/node-postgres/migrator";
|
|
12
16
|
import fs, { existsSync } from "node:fs";
|
|
13
|
-
import fs$1, { access, cp, glob, mkdir, readFile, readdir, rm } from "node:fs/promises";
|
|
14
17
|
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
15
|
-
import { spawn } from "node:child_process";
|
|
16
18
|
import colors from "picocolors";
|
|
19
|
+
import { spawn } from "node:child_process";
|
|
17
20
|
import * as p from "@clack/prompts";
|
|
21
|
+
import fs$1, { access, cp, glob, mkdir, readFile, readdir, rm } from "node:fs/promises";
|
|
18
22
|
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { migrate } from "drizzle-orm/node-postgres/migrator";
|
|
19
24
|
import * as repl from "node:repl";
|
|
20
25
|
|
|
21
|
-
//#region src/cli/context.ts
|
|
26
|
+
//#region src/api/cli/context.ts
|
|
22
27
|
/**
|
|
23
28
|
* Defines a command context instance with @clack/prompts output methods.
|
|
24
29
|
*
|
|
@@ -177,7 +182,7 @@ function defineCommandContext(args, opts, container) {
|
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
//#endregion
|
|
180
|
-
//#region src/cli/command.ts
|
|
185
|
+
//#region src/api/cli/command.ts
|
|
181
186
|
/**
|
|
182
187
|
* Define a CLI command with type-safe arguments and options.
|
|
183
188
|
*
|
|
@@ -219,7 +224,7 @@ function defineCommand(def) {
|
|
|
219
224
|
}
|
|
220
225
|
|
|
221
226
|
//#endregion
|
|
222
|
-
//#region src/cli/commands/build.ts
|
|
227
|
+
//#region src/api/cli/commands/build.ts
|
|
223
228
|
/**
|
|
224
229
|
* Build externals configuration.
|
|
225
230
|
*
|
|
@@ -242,6 +247,7 @@ const EXTERNALS = {
|
|
|
242
247
|
"@smithy/*"
|
|
243
248
|
],
|
|
244
249
|
esbuildOnly: [
|
|
250
|
+
"drizzle-kit",
|
|
245
251
|
"esbuild",
|
|
246
252
|
"@esbuild/*",
|
|
247
253
|
"lightningcss",
|
|
@@ -315,7 +321,7 @@ async function findBin(name) {
|
|
|
315
321
|
* Collect entry points for bundling.
|
|
316
322
|
*
|
|
317
323
|
* Algorithm:
|
|
318
|
-
* 1. Find main.ts entry point (production entry)
|
|
324
|
+
* 1. Find api/main.ts entry point (production entry)
|
|
319
325
|
* 2. Find all api/**\/*.ts files (routes, commands, events, workflows)
|
|
320
326
|
* 3. Exclude test files and database schema files (SQL only)
|
|
321
327
|
*/
|
|
@@ -441,7 +447,7 @@ var build_default = defineCommand({
|
|
|
441
447
|
} catch (error) {
|
|
442
448
|
ctx.fail(error instanceof Error ? error.message : String(error));
|
|
443
449
|
}
|
|
444
|
-
const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/storybook/.storybook");
|
|
450
|
+
const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/devtools/storybook/.storybook");
|
|
445
451
|
if (existsSync(configDir)) try {
|
|
446
452
|
await ctx.spinner("Building design system", async () => {
|
|
447
453
|
const storybookBin = await findBin("storybook");
|
|
@@ -493,7 +499,7 @@ var build_default = defineCommand({
|
|
|
493
499
|
});
|
|
494
500
|
|
|
495
501
|
//#endregion
|
|
496
|
-
//#region src/cli/commands/check.ts
|
|
502
|
+
//#region src/api/cli/commands/check.ts
|
|
497
503
|
var check_default = defineCommand({
|
|
498
504
|
description: "Run code checks (typegen + biome + tsc)",
|
|
499
505
|
devOnly: true,
|
|
@@ -518,7 +524,7 @@ var check_default = defineCommand({
|
|
|
518
524
|
});
|
|
519
525
|
|
|
520
526
|
//#endregion
|
|
521
|
-
//#region src/cli/commands/db/_utils.ts
|
|
527
|
+
//#region src/api/cli/commands/db/_utils.ts
|
|
522
528
|
/**
|
|
523
529
|
* Word list for generating random migration names (similar to drizzle-kit).
|
|
524
530
|
*/
|
|
@@ -1271,7 +1277,7 @@ async function runSeeds(opts) {
|
|
|
1271
1277
|
}
|
|
1272
1278
|
|
|
1273
1279
|
//#endregion
|
|
1274
|
-
//#region src/cli/commands/db/data/gen.ts
|
|
1280
|
+
//#region src/api/cli/commands/db/data/gen.ts
|
|
1275
1281
|
var gen_default$1 = defineCommand({
|
|
1276
1282
|
description: "Generate database data migrations",
|
|
1277
1283
|
devOnly: true,
|
|
@@ -1289,7 +1295,7 @@ var gen_default$1 = defineCommand({
|
|
|
1289
1295
|
});
|
|
1290
1296
|
|
|
1291
1297
|
//#endregion
|
|
1292
|
-
//#region src/cli/commands/db/data/migrate.ts
|
|
1298
|
+
//#region src/api/cli/commands/db/data/migrate.ts
|
|
1293
1299
|
var migrate_default$1 = defineCommand({
|
|
1294
1300
|
description: "Run pending database data migrations",
|
|
1295
1301
|
args: z.tuple([]),
|
|
@@ -1306,7 +1312,7 @@ var migrate_default$1 = defineCommand({
|
|
|
1306
1312
|
});
|
|
1307
1313
|
|
|
1308
1314
|
//#endregion
|
|
1309
|
-
//#region src/cli/commands/db/schema/gen.ts
|
|
1315
|
+
//#region src/api/cli/commands/db/schema/gen.ts
|
|
1310
1316
|
var gen_default = defineCommand({
|
|
1311
1317
|
description: "Generate database schema migrations from schema changes",
|
|
1312
1318
|
devOnly: true,
|
|
@@ -1324,7 +1330,7 @@ var gen_default = defineCommand({
|
|
|
1324
1330
|
});
|
|
1325
1331
|
|
|
1326
1332
|
//#endregion
|
|
1327
|
-
//#region src/cli/commands/db/schema/migrate.ts
|
|
1333
|
+
//#region src/api/cli/commands/db/schema/migrate.ts
|
|
1328
1334
|
var migrate_default = defineCommand({
|
|
1329
1335
|
description: "Run pending database schema migrations",
|
|
1330
1336
|
args: z.tuple([]),
|
|
@@ -1341,7 +1347,7 @@ var migrate_default = defineCommand({
|
|
|
1341
1347
|
});
|
|
1342
1348
|
|
|
1343
1349
|
//#endregion
|
|
1344
|
-
//#region src/cli/commands/db/seed.ts
|
|
1350
|
+
//#region src/api/cli/commands/db/seed.ts
|
|
1345
1351
|
var seed_default = defineCommand({
|
|
1346
1352
|
description: "Seed databases with initial data",
|
|
1347
1353
|
devOnly: true,
|
|
@@ -1354,7 +1360,7 @@ var seed_default = defineCommand({
|
|
|
1354
1360
|
});
|
|
1355
1361
|
|
|
1356
1362
|
//#endregion
|
|
1357
|
-
//#region src/cli/commands/down.ts
|
|
1363
|
+
//#region src/api/cli/commands/down.ts
|
|
1358
1364
|
var down_default = defineCommand({
|
|
1359
1365
|
description: "Teardown the infrastructure",
|
|
1360
1366
|
devOnly: true,
|
|
@@ -1379,7 +1385,7 @@ var down_default = defineCommand({
|
|
|
1379
1385
|
});
|
|
1380
1386
|
|
|
1381
1387
|
//#endregion
|
|
1382
|
-
//#region src/cli/commands/preview.ts
|
|
1388
|
+
//#region src/api/cli/commands/preview.ts
|
|
1383
1389
|
var preview_default = defineCommand({
|
|
1384
1390
|
description: "Preview the application",
|
|
1385
1391
|
devOnly: true,
|
|
@@ -1422,11 +1428,7 @@ var preview_default = defineCommand({
|
|
|
1422
1428
|
});
|
|
1423
1429
|
|
|
1424
1430
|
//#endregion
|
|
1425
|
-
//#region
|
|
1426
|
-
var version = "0.6.0-0";
|
|
1427
|
-
|
|
1428
|
-
//#endregion
|
|
1429
|
-
//#region src/cli/commands/repl.ts
|
|
1431
|
+
//#region src/api/cli/commands/repl.ts
|
|
1430
1432
|
const runtimeInfo$1 = `(AppOS v${version} | Node ${process.version})`;
|
|
1431
1433
|
var repl_default = defineCommand({
|
|
1432
1434
|
description: "Start an interactive REPL with container access",
|
|
@@ -1465,7 +1467,7 @@ var repl_default = defineCommand({
|
|
|
1465
1467
|
});
|
|
1466
1468
|
|
|
1467
1469
|
//#endregion
|
|
1468
|
-
//#region src/cli/commands/reset.ts
|
|
1470
|
+
//#region src/api/cli/commands/reset.ts
|
|
1469
1471
|
var reset_default = defineCommand({
|
|
1470
1472
|
description: "Reset the infrastructure",
|
|
1471
1473
|
devOnly: true,
|
|
@@ -1507,28 +1509,7 @@ var reset_default = defineCommand({
|
|
|
1507
1509
|
});
|
|
1508
1510
|
|
|
1509
1511
|
//#endregion
|
|
1510
|
-
//#region src/api/
|
|
1511
|
-
/**
|
|
1512
|
-
* Defines the DBOS workflow worker.
|
|
1513
|
-
*
|
|
1514
|
-
* DBOS is configured and workflows are registered in defineCli() via loadWorkflows().
|
|
1515
|
-
* This worker simply controls the DBOS lifecycle (start/close).
|
|
1516
|
-
*
|
|
1517
|
-
* @returns Worker instance with lifecycle methods
|
|
1518
|
-
*/
|
|
1519
|
-
function defineWorker() {
|
|
1520
|
-
return {
|
|
1521
|
-
async start() {
|
|
1522
|
-
await DBOS.launch();
|
|
1523
|
-
},
|
|
1524
|
-
async stop() {
|
|
1525
|
-
await DBOS.shutdown();
|
|
1526
|
-
}
|
|
1527
|
-
};
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
//#endregion
|
|
1531
|
-
//#region src/cli/commands/start.ts
|
|
1512
|
+
//#region src/api/cli/commands/start.ts
|
|
1532
1513
|
const runtimeInfo = `(AppOS v${version} | Node ${process.version})`;
|
|
1533
1514
|
var start_default = defineCommand({
|
|
1534
1515
|
description: "Start the HTTP server and/or DBOS workflow worker",
|
|
@@ -1585,7 +1566,7 @@ var start_default = defineCommand({
|
|
|
1585
1566
|
await server.start();
|
|
1586
1567
|
logger.info(`HTTP server ready at http://${server.host}:${server.port} ${runtimeInfo}`);
|
|
1587
1568
|
if (process.env.NODE_ENV !== "production") {
|
|
1588
|
-
const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/storybook/.storybook");
|
|
1569
|
+
const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/devtools/storybook/.storybook");
|
|
1589
1570
|
let binPath = "";
|
|
1590
1571
|
let dir = process.cwd();
|
|
1591
1572
|
while (dir !== "/") {
|
|
@@ -1639,7 +1620,7 @@ var start_default = defineCommand({
|
|
|
1639
1620
|
});
|
|
1640
1621
|
|
|
1641
1622
|
//#endregion
|
|
1642
|
-
//#region src/cli/commands/up.ts
|
|
1623
|
+
//#region src/api/cli/commands/up.ts
|
|
1643
1624
|
var up_default = defineCommand({
|
|
1644
1625
|
description: "Setup the infrastructure",
|
|
1645
1626
|
devOnly: true,
|
|
@@ -1670,7 +1651,7 @@ var up_default = defineCommand({
|
|
|
1670
1651
|
});
|
|
1671
1652
|
|
|
1672
1653
|
//#endregion
|
|
1673
|
-
//#region src/cli/cli.ts
|
|
1654
|
+
//#region src/api/cli/cli.ts
|
|
1674
1655
|
/**
|
|
1675
1656
|
* Built-in commands registry.
|
|
1676
1657
|
* These are statically imported to work in bundled builds.
|
|
@@ -2003,7 +1984,7 @@ async function defineCli(opts) {
|
|
|
2003
1984
|
}
|
|
2004
1985
|
|
|
2005
1986
|
//#endregion
|
|
2006
|
-
//#region src/cli/index.ts
|
|
1987
|
+
//#region src/api/cli/index.ts
|
|
2007
1988
|
/**
|
|
2008
1989
|
* Gets the GlobalLogger class from DBOS SDK's internal telemetry module.
|
|
2009
1990
|
*
|
|
@@ -2024,6 +2005,15 @@ const { GlobalLogger } = require(join(dirname(dirname(dirname(require.resolve("@
|
|
|
2024
2005
|
* @param container - The application container.
|
|
2025
2006
|
*/
|
|
2026
2007
|
async function bootstrap(container) {
|
|
2008
|
+
process.on("uncaughtException", (err) => {
|
|
2009
|
+
container.logger.error({ err }, "Uncaught exception");
|
|
2010
|
+
});
|
|
2011
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
2012
|
+
container.logger.error({
|
|
2013
|
+
reason,
|
|
2014
|
+
promise
|
|
2015
|
+
}, "Unhandled promise rejection");
|
|
2016
|
+
});
|
|
2027
2017
|
GlobalLogger.prototype.info = (logEntry, metadata) => {
|
|
2028
2018
|
if (typeof logEntry === "string") {
|
|
2029
2019
|
if (logEntry.startsWith("Initializing DBOS") || logEntry.startsWith("System Database URL:") || logEntry.startsWith("Executor ID:") || logEntry.startsWith("Application version:") || logEntry.startsWith("No workflows to recover from application") || logEntry.startsWith("DBOS launched!")) return;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../database-Ca_pujXd.mjs";
|
|
3
|
+
import "../auth-D0zoZI7U.mjs";
|
|
4
|
+
import "../cache-jHw6mJPK.mjs";
|
|
5
|
+
import { At as defineAppContext, Dt as AppContext, Et as isLocalDev, Ot as DefineAppContextOpts, a as defineAppContainer, i as WorkerConfig, kt as SessionData, n as Container, r as ServerConfig, t as AppContainer } from "../container-xweZOaov.mjs";
|
|
6
|
+
export { AppContainer, AppContext, Container, DefineAppContextOpts, ServerConfig, SessionData, WorkerConfig, defineAppContainer, defineAppContext, isLocalDev };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { t as defineAppContext } from "../app-context-CaxDuPj-.mjs";
|
|
2
|
+
import { t as isLocalDev } from "../env-C-0yH_Q3.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/api/container.ts
|
|
5
|
+
/**
|
|
6
|
+
* Defines an application container with type-safe validation and inference.
|
|
7
|
+
*
|
|
8
|
+
* This helper function ensures that:
|
|
9
|
+
* 1. All required base fields (config, cache, db) are provided
|
|
10
|
+
* 2. Custom fields are fully preserved in the inferred type
|
|
11
|
+
* 3. TypeScript provides autocomplete for all fields in commands/routes
|
|
12
|
+
*
|
|
13
|
+
* @template T - The container type extending AppContainer
|
|
14
|
+
* @param container - The container object with required and custom fields
|
|
15
|
+
* @returns The same container object with full type inference
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // In your api/main.ts file:
|
|
20
|
+
* export async function defineContainer() {
|
|
21
|
+
* const config = defineConfig(z.object({
|
|
22
|
+
* PORT: z.coerce.number().default(3000),
|
|
23
|
+
* EVENTS_DB_URL: z.string(),
|
|
24
|
+
* WORKER_DB_URL: z.string(),
|
|
25
|
+
* }));
|
|
26
|
+
* const logger = defineLogger({ level: config.LOG_LEVEL });
|
|
27
|
+
*
|
|
28
|
+
* return defineAppContainer({
|
|
29
|
+
* auth: defineAuth({ config }),
|
|
30
|
+
* cache: {},
|
|
31
|
+
* config,
|
|
32
|
+
* db: {},
|
|
33
|
+
* eventBus: defineEventBus({ dbUrl: config.EVENTS_DB_URL, logger }),
|
|
34
|
+
* i18n: await defineI18n({ ... }),
|
|
35
|
+
* logger,
|
|
36
|
+
* mailer: defineMailer({ ... }),
|
|
37
|
+
* server: {
|
|
38
|
+
* port: config.PORT,
|
|
39
|
+
* },
|
|
40
|
+
* worker: {
|
|
41
|
+
* dbUrl: config.WORKER_DB_URL,
|
|
42
|
+
* },
|
|
43
|
+
* });
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
function defineAppContainer(container) {
|
|
48
|
+
return container;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { defineAppContainer, defineAppContext, isLocalDev };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import { a as QualifiedTableNames, c as defineMigrationOpts, i as MigrationType, l as defineTestDatabase, n as DefineDatabaseOptions, o as dbChanges, r as DefineTestDatabaseOptions, s as defineDatabase, t as Database, u as migrationsSchema } from "../database-Ca_pujXd.mjs";
|
|
3
|
+
export * from "drizzle-orm";
|
|
4
|
+
export * from "drizzle-seed";
|
|
5
|
+
export { Database, DefineDatabaseOptions, DefineTestDatabaseOptions, MigrationType, QualifiedTableNames, dbChanges, defineDatabase, defineMigrationOpts, defineTestDatabase, migrationsSchema };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../constants-DCwXUedR.mjs";
|
|
2
|
+
import { a as migrationsSchema, i as defineTestDatabase, n as defineDatabase, r as defineMigrationOpts, t as dbChanges } from "../database-DSEtnffO.mjs";
|
|
3
|
+
|
|
4
|
+
export * from "drizzle-orm"
|
|
5
|
+
|
|
6
|
+
export * from "drizzle-seed"
|
|
7
|
+
|
|
8
|
+
export { dbChanges, defineDatabase, defineMigrationOpts, defineTestDatabase, migrationsSchema };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../database-Ca_pujXd.mjs";
|
|
3
|
+
import "../auth-D0zoZI7U.mjs";
|
|
4
|
+
import "../cache-jHw6mJPK.mjs";
|
|
5
|
+
import { Bt as loadEvents, Ft as EventContext, It as dbChangeInputSchema, Lt as dbChangesEvent, Mt as DefineEventBusOptions, Nt as Event, Pt as EventBus, Rt as defineEvent, jt as DbChangeInput, zt as defineEventBus } from "../container-xweZOaov.mjs";
|
|
6
|
+
export { DbChangeInput, DefineEventBusOptions, Event, EventBus, EventContext, dbChangeInputSchema, dbChangesEvent, defineEvent, defineEventBus, loadEvents };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../redis-a5sw5J3L.mjs";
|
|
2
|
+
import "../constants-DCwXUedR.mjs";
|
|
3
|
+
import { a as loadEvents, i as defineEventBus, n as dbChangesEvent, r as defineEvent, t as dbChangeInputSchema } from "../event-1yFQJHwn.mjs";
|
|
4
|
+
|
|
5
|
+
export { dbChangeInputSchema, dbChangesEvent, defineEvent, defineEventBus, loadEvents };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { n as __reExport } from "../chunk-BkPCcwIn.mjs";
|
|
2
|
+
import { t as instrumentation_exports$1 } from "../instrumentation-DCouyaIn.mjs";
|
|
3
|
+
|
|
4
|
+
export * from "@opentelemetry/api"
|
|
5
|
+
|
|
6
|
+
//#region src/api/instrumentation.ts
|
|
7
|
+
var instrumentation_exports = {};
|
|
8
|
+
__reExport(instrumentation_exports, instrumentation_exports$1);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../database-Ca_pujXd.mjs";
|
|
3
|
+
import "../auth-D0zoZI7U.mjs";
|
|
4
|
+
import "../cache-jHw6mJPK.mjs";
|
|
5
|
+
import { c as DefineMailerOptionsWithQueue, d as MailerPayload, f as MailerPayloadHtml, g as defineMailer, h as defineEmail, l as EmailComponent, m as MailerWithQueue, o as DefineEmailOptions, p as MailerPayloadReact, s as DefineMailerOptions, u as Mailer } from "../container-xweZOaov.mjs";
|
|
6
|
+
export { DefineEmailOptions, DefineMailerOptions, DefineMailerOptionsWithQueue, EmailComponent, Mailer, MailerPayload, MailerPayloadHtml, MailerPayloadReact, MailerWithQueue, defineEmail, defineMailer };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import "../auth-schema-OUnjUQlj.mjs";
|
|
2
|
+
import "../redis-a5sw5J3L.mjs";
|
|
3
|
+
import "../constants-DCwXUedR.mjs";
|
|
4
|
+
import "../event-1yFQJHwn.mjs";
|
|
5
|
+
import { a as sendEmail } from "../workflow-BUI7kC5c.mjs";
|
|
6
|
+
import { render } from "@react-email/render";
|
|
7
|
+
import { createTransport } from "nodemailer";
|
|
8
|
+
|
|
9
|
+
//#region src/api/mailer.ts
|
|
10
|
+
/**
|
|
11
|
+
* Defines a type-safe email template with runtime validation.
|
|
12
|
+
*
|
|
13
|
+
* Provides:
|
|
14
|
+
* - Type-safe props inferred from Zod schema
|
|
15
|
+
* - Runtime validation with safeParse (applies defaults, catches errors)
|
|
16
|
+
* - Schema attached to component for devtools preview generation
|
|
17
|
+
*
|
|
18
|
+
* @template TSchema - Zod object schema defining the email props.
|
|
19
|
+
* @param options - Email template options with schema and render function.
|
|
20
|
+
* @returns Email component with attached schema.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { defineEmail } from "appos/api/mailer";
|
|
25
|
+
* import type { TFunction } from "i18next";
|
|
26
|
+
* import { z } from "appos/universal/zod";
|
|
27
|
+
* import { Html, Text } from "@react-email/components";
|
|
28
|
+
*
|
|
29
|
+
* export default defineEmail({
|
|
30
|
+
* schema: z.object({
|
|
31
|
+
* t: z.custom<TFunction<"email">>(),
|
|
32
|
+
* name: z.string().default("there"),
|
|
33
|
+
* verificationUrl: z.url().optional(),
|
|
34
|
+
* }),
|
|
35
|
+
* render: ({ t, name, verificationUrl }) => (
|
|
36
|
+
* <Html>
|
|
37
|
+
* <Text>{t("email:welcome.greeting", { name })}</Text>
|
|
38
|
+
* </Html>
|
|
39
|
+
* ),
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Usage in route handler:
|
|
43
|
+
* const t = container.i18n.getFixedT(user.locale, "email");
|
|
44
|
+
* await container.mailer.send({
|
|
45
|
+
* to: user.email,
|
|
46
|
+
* subject: t("email:welcome.subject"),
|
|
47
|
+
* react: <WelcomeEmail t={t} name={user.name} />,
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function defineEmail(options) {
|
|
52
|
+
const component = (props) => {
|
|
53
|
+
const result = options.schema.safeParse(props);
|
|
54
|
+
if (!result.success) throw new Error(`[defineEmail] Invalid props: ${result.error.message}`);
|
|
55
|
+
return options.render(result.data);
|
|
56
|
+
};
|
|
57
|
+
component.schema = options.schema;
|
|
58
|
+
return component;
|
|
59
|
+
}
|
|
60
|
+
async function defineMailer(options) {
|
|
61
|
+
const { from, smtpUrl } = options;
|
|
62
|
+
const queue = "queue" in options ? options.queue : void 0;
|
|
63
|
+
const transport = createTransport({ url: smtpUrl });
|
|
64
|
+
return {
|
|
65
|
+
async send(payload) {
|
|
66
|
+
let html;
|
|
67
|
+
let text;
|
|
68
|
+
let mailOptions;
|
|
69
|
+
if ("react" in payload) {
|
|
70
|
+
[html, text] = await Promise.all([render(payload.react), render(payload.react, { plainText: true })]);
|
|
71
|
+
const { react: _, ...rest } = payload;
|
|
72
|
+
mailOptions = rest;
|
|
73
|
+
} else {
|
|
74
|
+
html = payload.html;
|
|
75
|
+
text = payload.text;
|
|
76
|
+
const { html: _, text: __, ...rest } = payload;
|
|
77
|
+
mailOptions = rest;
|
|
78
|
+
}
|
|
79
|
+
await transport.sendMail({
|
|
80
|
+
from: payload.from || from,
|
|
81
|
+
...mailOptions,
|
|
82
|
+
html,
|
|
83
|
+
text
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
async sendLater(payload, startOptions) {
|
|
87
|
+
let html;
|
|
88
|
+
let text;
|
|
89
|
+
let restPayload;
|
|
90
|
+
if ("react" in payload) {
|
|
91
|
+
[html, text] = await Promise.all([render(payload.react), render(payload.react, { plainText: true })]);
|
|
92
|
+
const { react: _, ...rest } = payload;
|
|
93
|
+
restPayload = rest;
|
|
94
|
+
} else {
|
|
95
|
+
html = payload.html;
|
|
96
|
+
text = payload.text;
|
|
97
|
+
const { html: _, text: __, ...rest } = payload;
|
|
98
|
+
restPayload = rest;
|
|
99
|
+
}
|
|
100
|
+
const workflowInput = {
|
|
101
|
+
...restPayload,
|
|
102
|
+
html,
|
|
103
|
+
text
|
|
104
|
+
};
|
|
105
|
+
return sendEmail.start(workflowInput, {
|
|
106
|
+
...startOptions,
|
|
107
|
+
queueName: queue?.name
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
export { defineEmail, defineMailer };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { n as Logger, r as defineLogger, t as DefineLoggerOptions } from "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../instrumentation-DhJYpza5.mjs";
|
|
3
|
+
import { n as withOtelSpan } from "../observability-Bd2pNUXs.mjs";
|
|
4
|
+
export { DefineLoggerOptions, Logger, defineLogger, withOtelSpan };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { t as instrumentation_exports } from "../instrumentation-DCouyaIn.mjs";
|
|
2
|
+
import pino from "pino";
|
|
3
|
+
import { getCallSites } from "node:util";
|
|
4
|
+
|
|
5
|
+
//#region src/api/logger.ts
|
|
6
|
+
/**
|
|
7
|
+
* Define the logger instance.
|
|
8
|
+
*
|
|
9
|
+
* @param opts - The options.
|
|
10
|
+
* @returns The logger.
|
|
11
|
+
*/
|
|
12
|
+
async function defineLogger(opts) {
|
|
13
|
+
const transports = [];
|
|
14
|
+
const commonOpts = {
|
|
15
|
+
level: opts.level || "info",
|
|
16
|
+
redact: opts.redact || [],
|
|
17
|
+
...transports.length > 0 && { transport: transports.length === 1 ? transports[0] : { targets: transports } }
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
return pino(commonOpts, process.env.NODE_ENV !== "production" && !process.env.VITEST ? (await import("pino-pretty")).default() : void 0);
|
|
21
|
+
} catch (_) {
|
|
22
|
+
return pino(commonOpts);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/api/otel.ts
|
|
28
|
+
/**
|
|
29
|
+
* Wraps an async function with an OpenTelemetry span for distributed tracing.
|
|
30
|
+
*
|
|
31
|
+
* Automatically handles span lifecycle (start/end), error recording, and context propagation.
|
|
32
|
+
* The span will appear as a child of the currently active span (if any).
|
|
33
|
+
*
|
|
34
|
+
* @param tracerName - Fully qualified module path (e.g., "api/routes/payouts", "packages/primitives/mailer")
|
|
35
|
+
* @param spanName - Operation name following {verb} {object} pattern (e.g., "fetch payouts", "send email")
|
|
36
|
+
* @param fn - The async function to execute within the span context. Receives span for custom attributes.
|
|
37
|
+
* @param attributes - Optional span attributes for high-cardinality data (IDs, counts, etc.).
|
|
38
|
+
* Use semantic conventions: https://opentelemetry.io/docs/specs/semconv/
|
|
39
|
+
* @returns Promise resolving to the function's return value.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Basic usage - simple business operation
|
|
43
|
+
* await withOtelSpan("api/routes/payouts", "fetch payouts", async () => {
|
|
44
|
+
* return await db.query.payouts.findMany();
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // With attributes and custom span data
|
|
49
|
+
* const payouts = await withOtelSpan(
|
|
50
|
+
* "api/routes/payouts",
|
|
51
|
+
* "fetch payouts",
|
|
52
|
+
* async (span) => {
|
|
53
|
+
* const results = await db.query.payouts.findMany();
|
|
54
|
+
* span.setAttribute("payouts.count", results.length);
|
|
55
|
+
* span.addEvent("cache.miss");
|
|
56
|
+
* return results;
|
|
57
|
+
* },
|
|
58
|
+
* { "payouts.limit": 100, "payouts.offset": 0 }
|
|
59
|
+
* );
|
|
60
|
+
*/
|
|
61
|
+
async function withOtelSpan(fn, attributes) {
|
|
62
|
+
const callSite = getCallSites()[1];
|
|
63
|
+
const tracerName = callSite.scriptName.replace(process.cwd(), "").replace("file:///", "");
|
|
64
|
+
const spanName = callSite.functionName;
|
|
65
|
+
const span = instrumentation_exports.trace.getTracer(tracerName.replace("build/", "")).startSpan(spanName, { attributes });
|
|
66
|
+
const ctx = instrumentation_exports.trace.setSpan(instrumentation_exports.context.active(), span);
|
|
67
|
+
try {
|
|
68
|
+
const result = await instrumentation_exports.context.with(ctx, () => fn(span));
|
|
69
|
+
span.end();
|
|
70
|
+
return result;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
span.recordException(error);
|
|
73
|
+
span.end();
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { defineLogger, withOtelSpan };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../database-Ca_pujXd.mjs";
|
|
3
|
+
import "../auth-D0zoZI7U.mjs";
|
|
4
|
+
import "../cache-jHw6mJPK.mjs";
|
|
5
|
+
import { $ as HandlerParams, Q as DefineOpenAPIReturn, X as DefineOpenAPIConfig, Z as DefineOpenAPIConfigInput, at as defineOpenAPI, ct as defineTypedResponses, dt as registerRoutes, et as OpenAPIMethodSpec, ft as scanAPIRoutes, it as ValidationErrorResponse, lt as generateOpenAPIDocument, nt as OpenAPIRegistration, ot as defineOpenAPIConfig, pt as writeOpenAPISpecs, rt as RouteModule, st as defineOpenAPIEndpoint, tt as OpenAPIObjectConfigV31, ut as loadAndRegisterAPIRoutes } from "../container-xweZOaov.mjs";
|
|
6
|
+
export { DefineOpenAPIConfig, DefineOpenAPIConfigInput, DefineOpenAPIReturn, HandlerParams, OpenAPIMethodSpec, OpenAPIObjectConfigV31, OpenAPIRegistration, RouteModule, ValidationErrorResponse, defineOpenAPI, defineOpenAPIConfig, defineOpenAPIEndpoint, defineTypedResponses, generateOpenAPIDocument, loadAndRegisterAPIRoutes, registerRoutes, scanAPIRoutes, writeOpenAPISpecs };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../constants-DCwXUedR.mjs";
|
|
2
|
+
import "../app-context-CaxDuPj-.mjs";
|
|
3
|
+
import { a as generateOpenAPIDocument, c as scanAPIRoutes, i as defineTypedResponses, l as writeOpenAPISpecs, n as defineOpenAPIConfig, o as loadAndRegisterAPIRoutes, r as defineOpenAPIEndpoint, s as registerRoutes, t as defineOpenAPI } from "../openapi-DVd0_Ppp.mjs";
|
|
4
|
+
|
|
5
|
+
export { defineOpenAPI, defineOpenAPIConfig, defineOpenAPIEndpoint, defineTypedResponses, generateOpenAPIDocument, loadAndRegisterAPIRoutes, registerRoutes, scanAPIRoutes, writeOpenAPISpecs };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../logger-rlLu_iK1.mjs";
|
|
2
|
+
import "../database-Ca_pujXd.mjs";
|
|
3
|
+
import "../auth-D0zoZI7U.mjs";
|
|
4
|
+
import "../cache-jHw6mJPK.mjs";
|
|
5
|
+
import { Ct as defaultI18nConfig, St as I18nInitOptions, Tt as i18n, _t as App, bt as ServerInstance, gt as loadMiddleware, ht as defineMiddleware, mt as Middleware, vt as DefineServerOptions, wt as defineI18n, xt as defineServer, yt as Server } from "../container-xweZOaov.mjs";
|
|
6
|
+
export { App, DefineServerOptions, I18nInitOptions, Middleware, Server, ServerInstance, defaultI18nConfig, defineI18n, defineMiddleware, defineServer, i18n, loadMiddleware };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../constants-DCwXUedR.mjs";
|
|
2
|
+
import { a as loadMiddleware, i as defineMiddleware, n as defaultI18nConfig, r as defineI18n, t as defineServer } from "../server-CWYF5Oeg.mjs";
|
|
3
|
+
import "../instrumentation-DCouyaIn.mjs";
|
|
4
|
+
import "../app-context-CaxDuPj-.mjs";
|
|
5
|
+
import "../openapi-DVd0_Ppp.mjs";
|
|
6
|
+
import "../context-9Yd81kh5.mjs";
|
|
7
|
+
|
|
8
|
+
export { defaultI18nConfig, defineI18n, defineMiddleware, defineServer, loadMiddleware };
|