qarpeo 0.1.34 → 0.2.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/README.md +114 -26
- package/dist/apps/cms.d.ts +4 -0
- package/dist/apps/comments.d.ts +4 -0
- package/dist/apps/payments.d.ts +4 -0
- package/dist/apps/store.d.ts +4 -0
- package/dist/chunks/auth-schema.mjs +169 -30
- package/dist/chunks/tools.mjs +1680 -0
- package/dist/cli/index.mjs +1256 -221
- package/dist/core/aliases.d.ts +5 -0
- package/dist/core/context.d.ts +10 -0
- package/dist/core/cross-drive.d.ts +2 -0
- package/dist/core/d1-migrate.d.ts +4 -0
- package/dist/core/devtools.d.ts +4 -0
- package/dist/core/nitro.d.ts +4 -0
- package/dist/core/schema.d.ts +4 -0
- package/dist/core/server-utils.d.ts +4 -0
- package/dist/core/wrangler.d.ts +4 -0
- package/dist/dev/wrangler.d.ts +1 -0
- package/dist/fate/index.d.ts +8 -8
- package/dist/features/agents.d.ts +4 -0
- package/dist/features/auth.d.ts +4 -0
- package/dist/features/bots.d.ts +4 -0
- package/dist/features/fate.d.ts +4 -0
- package/dist/features/mail.d.ts +4 -0
- package/dist/features/mcp.d.ts +4 -0
- package/dist/features/multitenant.d.ts +4 -0
- package/dist/features/notifications.d.ts +4 -0
- package/dist/features/realtime.d.ts +4 -0
- package/dist/module.d.ts +10 -2
- package/dist/module.mjs +6313 -5114
- package/dist/primitives/ai.d.ts +4 -0
- package/dist/primitives/analytics.d.ts +4 -0
- package/dist/primitives/blob.d.ts +4 -0
- package/dist/primitives/browser.d.ts +4 -0
- package/dist/primitives/cache.d.ts +4 -0
- package/dist/primitives/d1.d.ts +4 -0
- package/dist/primitives/do.d.ts +4 -0
- package/dist/primitives/email.d.ts +4 -0
- package/dist/primitives/hyperdrive.d.ts +4 -0
- package/dist/primitives/kv.d.ts +4 -0
- package/dist/primitives/queue.d.ts +4 -0
- package/dist/primitives/ratelimit.d.ts +4 -0
- package/dist/primitives/vectorize.d.ts +4 -0
- package/dist/primitives/workflows.d.ts +4 -0
- package/dist/runtime/ai.d.ts +3 -3
- package/dist/runtime/ai.mjs +8 -1
- package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
- package/dist/runtime/app/composables/ai.d.ts +56 -29
- package/dist/runtime/app/composables/analytics.d.ts +26 -106
- package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
- package/dist/runtime/app/composables/auth.d.ts +147 -51
- package/dist/runtime/app/composables/auth.mjs +0 -7
- package/dist/runtime/app/composables/chat.d.ts +38 -35
- package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
- package/dist/runtime/app/composables/cms.d.ts +57 -282
- package/dist/runtime/app/composables/cms.mjs +0 -35
- package/dist/runtime/app/composables/comments.d.ts +32 -5
- package/dist/runtime/app/composables/comments.mjs +29 -1
- package/dist/runtime/app/composables/docs-version.d.ts +25 -28
- package/dist/runtime/app/composables/impersonation.d.ts +22 -5
- package/dist/runtime/app/composables/organization.d.ts +38 -91
- package/dist/runtime/app/composables/passkey.d.ts +22 -6
- package/dist/runtime/app/composables/passwordless.d.ts +24 -7
- package/dist/runtime/app/composables/payments.d.ts +50 -34
- package/dist/runtime/app/composables/payments.mjs +1 -0
- package/dist/runtime/app/composables/sse.d.ts +76 -0
- package/dist/runtime/app/composables/sse.mjs +152 -0
- package/dist/runtime/app/composables/storage.d.ts +53 -65
- package/dist/runtime/app/composables/storage.mjs +17 -0
- package/dist/runtime/app/composables/store.d.ts +198 -0
- package/dist/runtime/app/composables/store.mjs +414 -0
- package/dist/runtime/app/composables/tenant.d.ts +31 -72
- package/dist/runtime/app/composables/turnstile.d.ts +16 -3
- package/dist/runtime/app/composables/two-factor.d.ts +23 -6
- package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
- package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
- package/dist/runtime/app/pages/devtools.vue +0 -7
- package/dist/runtime/auth.d.ts +9 -9
- package/dist/runtime/blob.d.ts +10 -1
- package/dist/runtime/blob.mjs +83 -0
- package/dist/runtime/cache.d.ts +48 -0
- package/dist/runtime/cache.mjs +92 -0
- package/dist/runtime/comments.d.ts +4 -0
- package/dist/runtime/comments.mjs +2 -0
- package/dist/runtime/db.d.ts +21 -1
- package/dist/runtime/db.mjs +54 -0
- package/dist/runtime/drizzle.d.ts +4 -2
- package/dist/runtime/drizzle.mjs +68 -1
- package/dist/runtime/durable-object.d.ts +2 -0
- package/dist/runtime/durable-object.mjs +2 -0
- package/dist/runtime/email.d.ts +1 -1
- package/dist/runtime/email.mjs +1 -1
- package/dist/runtime/kv.mjs +50 -1
- package/dist/runtime/mcp.d.ts +2 -0
- package/dist/runtime/mcp.mjs +2 -0
- package/dist/runtime/queue.d.ts +12 -2
- package/dist/runtime/queue.mjs +19 -1
- package/dist/runtime/ratelimit.d.ts +1 -0
- package/dist/runtime/ratelimit.mjs +7 -0
- package/dist/runtime/schema.d.ts +313 -0
- package/dist/runtime/schema.mjs +259 -0
- package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
- package/dist/runtime/server/db/cms-schema.mjs +69 -70
- package/dist/runtime/server/db/store-schema.d.ts +4344 -0
- package/dist/runtime/server/db/store-schema.mjs +266 -0
- package/dist/runtime/server/durable-objects/agent.mjs +35 -0
- package/dist/runtime/server/durable-objects/room.mjs +0 -1
- package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
- package/dist/runtime/server/plugins/comments.d.ts +7 -0
- package/dist/runtime/server/plugins/comments.mjs +7 -0
- package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
- package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
- package/dist/runtime/server/plugins/store.d.ts +7 -0
- package/dist/runtime/server/plugins/store.mjs +7 -0
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
- package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
- package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
- package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
- package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
- package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
- package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
- package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
- package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
- package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
- package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
- package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
- package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
- package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
- package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
- package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
- package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
- package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
- package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
- package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
- package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
- package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
- package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
- package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
- package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
- package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
- package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
- package/dist/runtime/server/utils/ai.d.ts +146 -21
- package/dist/runtime/server/utils/ai.mjs +406 -11
- package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
- package/dist/runtime/server/utils/audit.d.ts +5 -4
- package/dist/runtime/server/utils/audit.mjs +25 -14
- package/dist/runtime/server/utils/auth.d.ts +29 -12
- package/dist/runtime/server/utils/auth.mjs +88 -70
- package/dist/runtime/server/utils/bots.d.ts +20 -4
- package/dist/runtime/server/utils/bots.mjs +7 -3
- package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
- package/dist/runtime/server/utils/cache.d.ts +31 -10
- package/dist/runtime/server/utils/cache.mjs +130 -53
- package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
- package/dist/runtime/server/utils/cms/collections.mjs +143 -0
- package/dist/runtime/server/utils/cms/common.d.ts +9 -0
- package/dist/runtime/server/utils/cms/common.mjs +28 -0
- package/dist/runtime/server/utils/cms/git.mjs +2 -2
- package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
- package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
- package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
- package/dist/runtime/server/utils/cms/preview.mjs +50 -0
- package/dist/runtime/server/utils/cms/search.d.ts +1 -1
- package/dist/runtime/server/utils/cms/search.mjs +11 -7
- package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
- package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
- package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
- package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
- package/dist/runtime/server/utils/cms.d.ts +13 -249
- package/dist/runtime/server/utils/cms.mjs +108 -2350
- package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
- package/dist/runtime/server/utils/comments-filter.mjs +541 -0
- package/dist/runtime/server/utils/comments.d.ts +71 -0
- package/dist/runtime/server/utils/comments.mjs +137 -61
- package/dist/runtime/server/utils/config.d.ts +4 -3
- package/dist/runtime/server/utils/config.mjs +7 -6
- package/dist/runtime/server/utils/context.d.ts +14 -0
- package/dist/runtime/server/utils/context.mjs +2 -2
- package/dist/runtime/server/utils/crypto.d.ts +44 -5
- package/dist/runtime/server/utils/crypto.mjs +18 -0
- package/dist/runtime/server/utils/domains.mjs +9 -5
- package/dist/runtime/server/utils/drizzle.d.ts +35 -3
- package/dist/runtime/server/utils/drizzle.mjs +115 -6
- package/dist/runtime/server/utils/durable-object.d.ts +106 -0
- package/dist/runtime/server/utils/durable-object.mjs +628 -0
- package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
- package/dist/runtime/server/utils/email-inbound.mjs +76 -0
- package/dist/runtime/server/utils/impersonation.d.ts +32 -2
- package/dist/runtime/server/utils/impersonation.mjs +16 -13
- package/dist/runtime/server/utils/lock.d.ts +71 -0
- package/dist/runtime/server/utils/lock.mjs +139 -0
- package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
- package/dist/runtime/server/utils/mail.d.ts +30 -19
- package/dist/runtime/server/utils/mcp.d.ts +44 -0
- package/dist/runtime/server/utils/mcp.mjs +308 -0
- package/dist/runtime/server/utils/notifications.d.ts +72 -7
- package/dist/runtime/server/utils/notifications.mjs +67 -55
- package/dist/runtime/server/utils/oauth.d.ts +27 -4
- package/dist/runtime/server/utils/organization.d.ts +63 -7
- package/dist/runtime/server/utils/organization.mjs +26 -21
- package/dist/runtime/server/utils/passwordless.d.ts +62 -33
- package/dist/runtime/server/utils/payments.d.ts +51 -12
- package/dist/runtime/server/utils/payments.mjs +472 -282
- package/dist/runtime/server/utils/queue.d.ts +106 -13
- package/dist/runtime/server/utils/queue.mjs +313 -28
- package/dist/runtime/server/utils/rag.d.ts +42 -14
- package/dist/runtime/server/utils/rag.mjs +169 -4
- package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
- package/dist/runtime/server/utils/ratelimit.mjs +95 -14
- package/dist/runtime/server/utils/realtime.d.ts +68 -52
- package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
- package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
- package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
- package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
- package/dist/runtime/server/utils/session.d.ts +84 -10
- package/dist/runtime/server/utils/session.mjs +12 -10
- package/dist/runtime/server/utils/sse.d.ts +75 -0
- package/dist/runtime/server/utils/sse.mjs +147 -0
- package/dist/runtime/server/utils/sso.d.ts +1 -1
- package/dist/runtime/server/utils/storage.d.ts +53 -4
- package/dist/runtime/server/utils/storage.mjs +15 -11
- package/dist/runtime/server/utils/store-localization.d.ts +51 -0
- package/dist/runtime/server/utils/store-localization.mjs +417 -0
- package/dist/runtime/server/utils/store.d.ts +207 -0
- package/dist/runtime/server/utils/store.mjs +2227 -0
- package/dist/runtime/server/utils/table-names.d.ts +51 -0
- package/dist/runtime/server/utils/table-names.mjs +69 -0
- package/dist/runtime/server/utils/tenant.d.ts +26 -2
- package/dist/runtime/server/utils/tenant.mjs +16 -12
- package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
- package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
- package/dist/runtime/server/utils/totp.d.ts +45 -2
- package/dist/runtime/server/utils/tracker.d.ts +10 -11
- package/dist/runtime/server/utils/turnstile.d.ts +16 -1
- package/dist/runtime/server/utils/workflows.d.ts +92 -0
- package/dist/runtime/server/utils/workflows.mjs +299 -0
- package/dist/runtime/server.d.ts +8 -1
- package/dist/runtime/server.mjs +8 -5
- package/dist/runtime/service.d.ts +10 -10
- package/dist/runtime/storage.d.ts +1 -0
- package/dist/runtime/storage.mjs +1 -0
- package/dist/runtime/store.d.ts +4 -0
- package/dist/runtime/store.mjs +2 -0
- package/dist/runtime/test-utils.d.ts +11 -10
- package/dist/runtime/test-utils.mjs +64 -4
- package/dist/runtime/types/ai.d.ts +21 -2
- package/dist/runtime/types/d1.d.ts +17 -0
- package/dist/runtime/types/drizzle.d.ts +2 -2
- package/dist/runtime/types/durable-object.d.ts +62 -2
- package/dist/runtime/types/email.d.ts +46 -0
- package/dist/runtime/types/imports.d.ts +6 -1
- package/dist/runtime/types/index.d.ts +58 -0
- package/dist/runtime/types/index.mjs +3 -0
- package/dist/runtime/types/mcp.d.ts +83 -0
- package/dist/runtime/types/mcp.mjs +0 -0
- package/dist/runtime/types/queue.d.ts +36 -0
- package/dist/runtime/types/r2.d.ts +41 -0
- package/dist/runtime/types/store.d.ts +313 -0
- package/dist/runtime/types/store.mjs +0 -0
- package/dist/runtime/types/workflows.d.ts +98 -0
- package/dist/runtime/types/workflows.mjs +0 -0
- package/dist/runtime/workflows.d.ts +5 -0
- package/dist/runtime/workflows.mjs +2 -0
- package/dist/types/ai.d.ts +721 -0
- package/dist/types/cms.d.ts +710 -0
- package/dist/types.d.ts +430 -1292
- package/dist/utils/auth-schema.d.ts +3 -2
- package/dist/utils/bots.d.ts +20 -0
- package/dist/utils/comments-schema.d.ts +5 -4
- package/dist/utils/drizzle.d.ts +83 -3
- package/dist/utils/durable-objects.d.ts +10 -0
- package/dist/utils/email-inbound.d.ts +10 -0
- package/dist/utils/local-db.d.ts +1 -3
- package/dist/utils/mcp.d.ts +24 -0
- package/dist/utils/notifications-schema.d.ts +5 -4
- package/dist/utils/payments-schema.d.ts +4 -3
- package/dist/utils/store-schema.d.ts +14 -0
- package/dist/utils/table-names.d.ts +1 -0
- package/dist/utils/tenants-schema.d.ts +4 -3
- package/dist/utils/tools.d.ts +20 -0
- package/dist/utils/workflows.d.ts +8 -0
- package/package.json +34 -4
- package/dist/chunks/wrangler.mjs +0 -897
- package/dist/runtime/app/components/AuthRegister.vue +0 -306
- package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
- package/dist/runtime/app/components/AuthSignIn.vue +0 -298
- package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
- package/dist/runtime/app/components/CMSImage.vue +0 -47
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
- package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
- package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
- package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
- package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
- package/dist/runtime/app/components/Comments.vue +0 -411
- package/dist/runtime/app/components/FileUpload.vue +0 -200
- package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
- package/dist/runtime/app/components/NotificationBell.vue +0 -263
- package/dist/runtime/app/components/NotificationList.vue +0 -205
- package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
- package/dist/runtime/app/components/PricingGated.vue +0 -81
- package/dist/runtime/app/components/PricingTable.vue +0 -274
- package/dist/runtime/app/components/RealtimeChat.vue +0 -164
- package/dist/runtime/app/components/RealtimePresence.vue +0 -129
- package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
- package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
- package/dist/runtime/app/components/UserProfile.vue +0 -558
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RequestEvent } from "nuxt/server";
|
|
2
|
+
export interface TableResolveOptions {
|
|
3
|
+
prefix?: boolean | string;
|
|
4
|
+
tablePrefix?: boolean | string;
|
|
5
|
+
tables?: Record<string, string | undefined>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the database table prefix.
|
|
9
|
+
* Priority:
|
|
10
|
+
* 1. Explicit `explicitPrefix` argument (if provided as boolean or string)
|
|
11
|
+
* 2. `tablePrefix` or `prefix` from Qarpeo runtimeConfig (via `event` or global)
|
|
12
|
+
* 3. `process.env.QARPEO_TABLE_PREFIX`
|
|
13
|
+
*
|
|
14
|
+
* Rules:
|
|
15
|
+
* - `false`, `""`, or `undefined` -> `""` (no prefix, clean singular table name)
|
|
16
|
+
* - `true` -> `"qarpeo_"`
|
|
17
|
+
* - `"custom"` -> `"custom_"` (appends underscore if not present)
|
|
18
|
+
* - `"custom_"` -> `"custom_"`
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTablePrefix(event?: RequestEvent, explicitPrefix?: boolean | string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns configured granular table name overrides from runtime config or options.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getTableOverrides(event?: RequestEvent): Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a database table name given a base singular name and optional prefix/event/options.
|
|
27
|
+
*
|
|
28
|
+
* Resolution Order:
|
|
29
|
+
* 1. Granular table override (e.g. `tables.user` -> "profiles")
|
|
30
|
+
* 2. Prefix + baseName (e.g. `tablePrefix: "q_"` + "session" -> "q_session")
|
|
31
|
+
* 3. Clean singular baseName (default: "user", "comment", "customer")
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* resolveTableName("user") // "user"
|
|
36
|
+
* resolveTableName("user", "q_") // "q_user"
|
|
37
|
+
* resolveTableName("user", { tables: { user: "profiles" } }) // "profiles"
|
|
38
|
+
* resolveTableName("user", { tablePrefix: "q_", tables: { user: "profiles" } }) // "profiles"
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveTableName(baseName: string, prefixOrEventOrOptions?: boolean | string | RequestEvent | TableResolveOptions, event?: RequestEvent): string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves an index name given the resolved table name and index suffix.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* resolveIndexName("comment", "target") // "idx_comment_target"
|
|
48
|
+
* resolveIndexName("qarpeo_comment", "target") // "idx_qarpeo_comment_target"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveIndexName(tableName: string, suffix: string): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getQarpeoConfig } from "./config.mjs";
|
|
2
|
+
export function getTablePrefix(event, explicitPrefix) {
|
|
3
|
+
let prefix = explicitPrefix;
|
|
4
|
+
if (prefix === void 0) {
|
|
5
|
+
try {
|
|
6
|
+
const cfg = getQarpeoConfig(event);
|
|
7
|
+
if (cfg) {
|
|
8
|
+
prefix = cfg.tablePrefix ?? cfg.prefix;
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (prefix === void 0 && typeof process !== "undefined" && process?.env) {
|
|
14
|
+
const envVal = process.env.QARPEO_TABLE_PREFIX;
|
|
15
|
+
if (envVal === "1" || envVal === "true") {
|
|
16
|
+
prefix = true;
|
|
17
|
+
} else if (envVal && envVal !== "0" && envVal !== "false") {
|
|
18
|
+
prefix = envVal;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!prefix || prefix === false) return "";
|
|
22
|
+
if (prefix === true) return "qarpeo_";
|
|
23
|
+
return typeof prefix === "string" && prefix.endsWith("_") ? prefix : `${prefix}_`;
|
|
24
|
+
}
|
|
25
|
+
export function getTableOverrides(event) {
|
|
26
|
+
try {
|
|
27
|
+
const cfg = getQarpeoConfig(event);
|
|
28
|
+
if (cfg?.tables && typeof cfg.tables === "object") {
|
|
29
|
+
return cfg.tables;
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
if (typeof process !== "undefined" && process?.env?.QARPEO_TABLES) {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(process.env.QARPEO_TABLES);
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
function toCamelCase(str) {
|
|
42
|
+
return str.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
43
|
+
}
|
|
44
|
+
export function resolveTableName(baseName, prefixOrEventOrOptions, event) {
|
|
45
|
+
let explicitPrefix;
|
|
46
|
+
let tablesMap;
|
|
47
|
+
let effectiveEvent = event;
|
|
48
|
+
if (typeof prefixOrEventOrOptions === "object" && prefixOrEventOrOptions !== null && !("req" in prefixOrEventOrOptions && "res" in prefixOrEventOrOptions)) {
|
|
49
|
+
const opts = prefixOrEventOrOptions;
|
|
50
|
+
explicitPrefix = opts.tablePrefix ?? opts.prefix;
|
|
51
|
+
tablesMap = opts.tables;
|
|
52
|
+
} else if (typeof prefixOrEventOrOptions === "boolean" || typeof prefixOrEventOrOptions === "string") {
|
|
53
|
+
explicitPrefix = prefixOrEventOrOptions;
|
|
54
|
+
} else if (prefixOrEventOrOptions) {
|
|
55
|
+
effectiveEvent = prefixOrEventOrOptions;
|
|
56
|
+
}
|
|
57
|
+
const runtimeOverrides = getTableOverrides(effectiveEvent);
|
|
58
|
+
const mergedTables = { ...runtimeOverrides, ...tablesMap || {} };
|
|
59
|
+
const camelKey = toCamelCase(baseName);
|
|
60
|
+
const override = mergedTables[baseName] || mergedTables[camelKey];
|
|
61
|
+
if (override) {
|
|
62
|
+
return override;
|
|
63
|
+
}
|
|
64
|
+
const p = getTablePrefix(effectiveEvent, explicitPrefix);
|
|
65
|
+
return `${p}${baseName}`;
|
|
66
|
+
}
|
|
67
|
+
export function resolveIndexName(tableName, suffix) {
|
|
68
|
+
return `idx_${tableName}_${suffix}`;
|
|
69
|
+
}
|
|
@@ -14,7 +14,14 @@ import type { TenantRecord } from "../../../types";
|
|
|
14
14
|
export declare function extractHostname(event: RequestEvent): string;
|
|
15
15
|
/** Check if host is a subdomain of rootDomains and return the subdomain slug. */
|
|
16
16
|
export declare function extractSubdomain(host: string, rootDomains: string[]): string | null;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a tenant record by slug.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const tenant = await getTenantBySlug("acme", event)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
18
25
|
export declare function getTenantBySlug(slug: string, event?: RequestEvent): Promise<TenantRecord | null>;
|
|
19
26
|
/** Retrieve a tenant record by ID. */
|
|
20
27
|
export declare function getTenantById(id: string, event?: RequestEvent): Promise<TenantRecord | null>;
|
|
@@ -31,6 +38,11 @@ export declare function listTenants(event?: RequestEvent): Promise<TenantRecord[
|
|
|
31
38
|
* 2. Subdomain check against configured `rootDomains`
|
|
32
39
|
* 3. Custom domain edge cache (Cloudflare KV lookup: `domain:<host>`)
|
|
33
40
|
* 4. Direct database lookup (fallback)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const tenant = await resolveTenant(event)
|
|
45
|
+
* ```
|
|
34
46
|
*/
|
|
35
47
|
export declare function resolveTenant(event: RequestEvent): Promise<TenantRecord | null>;
|
|
36
48
|
/** Assign tenant to request context. */
|
|
@@ -38,7 +50,19 @@ export declare function setTenant(event: RequestEvent, tenant: TenantRecord): vo
|
|
|
38
50
|
/**
|
|
39
51
|
* Retrieve the resolved tenant for the current request context. Returns `null` if no tenant was
|
|
40
52
|
* matched.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const tenant = getTenant(event)
|
|
57
|
+
* ```
|
|
41
58
|
*/
|
|
42
59
|
export declare function getTenant(event: RequestEvent): TenantRecord | null;
|
|
43
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Retrieve the active tenant or throw a 404 HTTP error.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const tenant = useTenant(event)
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
44
68
|
export declare function useTenant(event: RequestEvent): TenantRecord;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { createError } from "nuxt/server";
|
|
2
2
|
import { getDomainCache, getMultitenantConfig, normalizeDomain } from "./domains.mjs";
|
|
3
|
+
import { resolveTableName } from "./table-names.mjs";
|
|
4
|
+
function tenantTbl(event) {
|
|
5
|
+
return resolveTableName("tenant", event);
|
|
6
|
+
}
|
|
3
7
|
const devTenantsStore = /* @__PURE__ */ new Map();
|
|
4
8
|
if (import.meta.dev) {
|
|
5
9
|
devTenantsStore.set("default", {
|
|
@@ -45,10 +49,10 @@ export function extractSubdomain(host, rootDomains) {
|
|
|
45
49
|
return null;
|
|
46
50
|
}
|
|
47
51
|
let tenantsMigrated = false;
|
|
48
|
-
async function ensureTenantsTableMigrated(db) {
|
|
52
|
+
async function ensureTenantsTableMigrated(db, event) {
|
|
49
53
|
if (tenantsMigrated || !db) return;
|
|
50
54
|
try {
|
|
51
|
-
await db.run(
|
|
55
|
+
await db.run(`ALTER TABLE ${tenantTbl(event)} ADD COLUMN organization_id TEXT`);
|
|
52
56
|
} catch {
|
|
53
57
|
}
|
|
54
58
|
tenantsMigrated = true;
|
|
@@ -61,8 +65,8 @@ export async function getTenantBySlug(slug, event) {
|
|
|
61
65
|
try {
|
|
62
66
|
const db = event?.context?.db;
|
|
63
67
|
if (db) {
|
|
64
|
-
await ensureTenantsTableMigrated(db);
|
|
65
|
-
const rows = await db.all(`SELECT * FROM
|
|
68
|
+
await ensureTenantsTableMigrated(db, event);
|
|
69
|
+
const rows = await db.all(`SELECT * FROM ${tenantTbl(event)} WHERE slug = ? LIMIT 1`, [cleanSlug]);
|
|
66
70
|
if (rows?.[0]) {
|
|
67
71
|
const row = rows[0];
|
|
68
72
|
const rec = {
|
|
@@ -92,8 +96,8 @@ export async function getTenantById(id, event) {
|
|
|
92
96
|
try {
|
|
93
97
|
const db = event?.context?.db;
|
|
94
98
|
if (db) {
|
|
95
|
-
await ensureTenantsTableMigrated(db);
|
|
96
|
-
const rows = await db.all(`SELECT * FROM
|
|
99
|
+
await ensureTenantsTableMigrated(db, event);
|
|
100
|
+
const rows = await db.all(`SELECT * FROM ${tenantTbl(event)} WHERE id = ? LIMIT 1`, [id]);
|
|
97
101
|
if (rows?.[0]) {
|
|
98
102
|
const row = rows[0];
|
|
99
103
|
const rec = {
|
|
@@ -124,8 +128,8 @@ export async function getTenantByOrganization(orgId, event) {
|
|
|
124
128
|
try {
|
|
125
129
|
const db = event?.context?.db;
|
|
126
130
|
if (db) {
|
|
127
|
-
await ensureTenantsTableMigrated(db);
|
|
128
|
-
const rows = await db.all(`SELECT * FROM
|
|
131
|
+
await ensureTenantsTableMigrated(db, event);
|
|
132
|
+
const rows = await db.all(`SELECT * FROM ${tenantTbl(event)} WHERE organization_id = ? LIMIT 1`, [
|
|
129
133
|
orgId
|
|
130
134
|
]);
|
|
131
135
|
if (rows?.[0]) {
|
|
@@ -155,9 +159,9 @@ export async function saveTenant(tenant, event) {
|
|
|
155
159
|
try {
|
|
156
160
|
const db = event?.context?.db;
|
|
157
161
|
if (db) {
|
|
158
|
-
await ensureTenantsTableMigrated(db);
|
|
162
|
+
await ensureTenantsTableMigrated(db, event);
|
|
159
163
|
await db.run(
|
|
160
|
-
`INSERT OR REPLACE INTO
|
|
164
|
+
`INSERT OR REPLACE INTO ${tenantTbl(event)}
|
|
161
165
|
(id, slug, name, plan, organization_id, custom_domain, logo_url, metadata_json, created_at, updated_at)
|
|
162
166
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
163
167
|
[
|
|
@@ -182,8 +186,8 @@ export async function listTenants(event) {
|
|
|
182
186
|
try {
|
|
183
187
|
const db = event?.context?.db;
|
|
184
188
|
if (db) {
|
|
185
|
-
await ensureTenantsTableMigrated(db);
|
|
186
|
-
const rows = await db.all(`SELECT * FROM
|
|
189
|
+
await ensureTenantsTableMigrated(db, event);
|
|
190
|
+
const rows = await db.all(`SELECT * FROM ${tenantTbl(event)} ORDER BY created_at DESC`);
|
|
187
191
|
if (rows && rows.length > 0) {
|
|
188
192
|
return rows.map((row) => ({
|
|
189
193
|
id: row.id,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import { timingSafeEqualString } from "./crypto";
|
|
2
2
|
export { timingSafeEqualString };
|
|
3
|
+
/**
|
|
4
|
+
* Generates a random Base32 secret for TOTP registration.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const secret = generateBase32Secret() // e.g. "JBSWY3DPEHPK3PXP"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
export declare function generateBase32Secret(length?: number): string;
|
|
4
12
|
export declare function base32ToBytes(base32: string): Uint8Array;
|
|
13
|
+
/**
|
|
14
|
+
* Generates the current 6-digit TOTP code for a secret.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const code = await generateTOTPCode(secret) // "123456"
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
5
21
|
export declare function generateTOTPCode(secret: string, timeStep?: number): Promise<string>;
|
|
6
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Validates a 6-digit TOTP code with +/- 1 step drift tolerance (90-second validity).
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const isValid = await verifyTOTPCode(secret, "123456")
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
7
30
|
export declare function verifyTOTPCode(secret: string, userCode: string, timeStep?: number): Promise<boolean>;
|
|
8
31
|
export declare function hashBackupCode(code: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Generates cleartext and hashed backup codes for account recovery.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { rawCodes, hashedCodes } = await generateBackupCodes(8)
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
9
40
|
export declare function generateBackupCodes(count?: number): Promise<{
|
|
10
41
|
rawCodes: string[];
|
|
11
42
|
hashedCodes: string[];
|
|
12
43
|
}>;
|
|
13
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Verifies a cleartext backup code against a list of SHA-256 hashed codes in constant time.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const { valid, matchingHash } = await verifyBackupCode("ABCD1234", storedHashes)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
14
52
|
export declare function verifyBackupCode(rawCode: string, hashedCodes: string[]): Promise<{
|
|
15
53
|
valid: boolean;
|
|
16
54
|
matchingHash?: string;
|
|
@@ -25,6 +63,11 @@ export declare function buildOTPAuthURL(options: {
|
|
|
25
63
|
* Generates the otpauth:// URL for a TOTP secret. The client is responsible for rendering the QR
|
|
26
64
|
* code from this URL (e.g. via qrcode-vue or a native QR renderer) — the server returns the URL
|
|
27
65
|
* rather than an SVG so authenticator apps always receive a clean, scannable code.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const url = generateTOTPUrl({ issuer: "My App", accountName: "user@example.com", secret })
|
|
70
|
+
* ```
|
|
28
71
|
*/
|
|
29
72
|
export declare function generateTOTPUrl(options: {
|
|
30
73
|
issuer: string;
|
|
@@ -53,20 +53,19 @@ export declare function trackPageview(event: RequestEvent, options?: TrackPagevi
|
|
|
53
53
|
* @param options Optional metadata and overrides
|
|
54
54
|
*/
|
|
55
55
|
export declare function trackEvent(event: RequestEvent, name: string, options?: TrackEventOptions): Promise<void>;
|
|
56
|
+
export interface UseTrackerReturn {
|
|
57
|
+
trackPageview: (options?: TrackPageviewOptions) => Promise<void>;
|
|
58
|
+
trackEvent: (name: string, options?: TrackEventOptions) => Promise<void>;
|
|
59
|
+
}
|
|
56
60
|
/**
|
|
57
61
|
* Returns a tracker instance bound to the current H3 event. Useful when you want to call
|
|
58
62
|
* `trackPageview` / `trackEvent` multiple times without passing the event every time.
|
|
59
63
|
*
|
|
60
64
|
* @example
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const tracker = useTracker(event)
|
|
67
|
+
* tracker.trackPageview()
|
|
68
|
+
* tracker.trackEvent("signup", { meta: { plan: "pro" } })
|
|
69
|
+
* ```
|
|
66
70
|
*/
|
|
67
|
-
export declare function useTracker(event: RequestEvent):
|
|
68
|
-
/** Track a pageview for the current request. */
|
|
69
|
-
trackPageview: (options?: TrackPageviewOptions) => Promise<void>;
|
|
70
|
-
/** Track a custom named event. */
|
|
71
|
-
trackEvent: (name: string, options?: TrackEventOptions) => Promise<void>;
|
|
72
|
-
};
|
|
71
|
+
export declare function useTracker(event: RequestEvent): UseTrackerReturn;
|
|
@@ -10,7 +10,22 @@ export interface TurnstileVerificationResult {
|
|
|
10
10
|
/**
|
|
11
11
|
* Validates a Cloudflare Turnstile token using Cloudflare's siteverify API. Reads secret key from
|
|
12
12
|
* NUXT_TURNSTILE_SECRET_KEY, TURNSTILE_SECRET_KEY, or qarpeo.auth.turnstile.secretKey.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const result = await verifyTurnstileToken(event, token)
|
|
17
|
+
* if (!result.success) {
|
|
18
|
+
* // verification failed
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
export declare function verifyTurnstileToken(event: RequestEvent, token?: string, remoteIp?: string): Promise<TurnstileVerificationResult>;
|
|
15
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Enforces Cloudflare Turnstile verification. Throws 403 Forbidden if invalid.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* await requireTurnstile(event)
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
16
31
|
export declare function requireTurnstile(event: RequestEvent, token?: string): Promise<void>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { CFEvent } from "../../types/index";
|
|
2
|
+
import type { WorkflowDefinition, WorkflowEvent, WorkflowStep, WorkflowClient, WorkflowInstanceStatus } from "../../types/workflows";
|
|
3
|
+
export type { WorkflowDefinition, WorkflowEvent, WorkflowStep, WorkflowStepConfig, WorkflowClient, WorkflowInstanceInfo, WorkflowInstanceStatus, WorkflowStepRetryConfig, WorkflowBackoff, } from "../../types/workflows";
|
|
4
|
+
interface StoredInstance<TOutput = any> {
|
|
5
|
+
id: string;
|
|
6
|
+
workflowName: string;
|
|
7
|
+
status: WorkflowInstanceStatus;
|
|
8
|
+
output?: TOutput;
|
|
9
|
+
error?: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
params?: any;
|
|
12
|
+
stepStates: Map<string, {
|
|
13
|
+
status: "complete" | "errored";
|
|
14
|
+
value?: any;
|
|
15
|
+
error?: any;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare function setWorkflowFastForward(enabled: boolean): void;
|
|
19
|
+
/**
|
|
20
|
+
* Parses human-readable duration strings into milliseconds.
|
|
21
|
+
*
|
|
22
|
+
* Supported formats:
|
|
23
|
+
* - `"500ms"`
|
|
24
|
+
* - `"5s"`, `"5 sec"`, `"5 seconds"`
|
|
25
|
+
* - `"2m"`, `"2 min"`, `"2 minutes"`
|
|
26
|
+
* - `"1h"`, `"1 hr"`, `"1 hours"`
|
|
27
|
+
* - `"3d"`, `"3 days"`
|
|
28
|
+
* - Number (treated as milliseconds)
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseDuration(duration: string | number): number;
|
|
31
|
+
export interface StepEngineOptions {
|
|
32
|
+
instance: StoredInstance;
|
|
33
|
+
fastForward?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a durable `WorkflowStep` execution engine.
|
|
37
|
+
* Records step executions and caches values to support replay semantics.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createStepEngine(options: StepEngineOptions): WorkflowStep;
|
|
40
|
+
/**
|
|
41
|
+
* Defines a durable Cloudflare Workflow with step replay, sleep, and automatic retries.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts [server/workflows/onboarding.ts]
|
|
45
|
+
* export default defineWorkflow({
|
|
46
|
+
* name: "onboarding",
|
|
47
|
+
* async run(event, step) {
|
|
48
|
+
* const user = await step.do("create-user", async () => {
|
|
49
|
+
* return await createUser(event.payload.email)
|
|
50
|
+
* })
|
|
51
|
+
*
|
|
52
|
+
* await step.sleep("wait-for-email", "1 day")
|
|
53
|
+
*
|
|
54
|
+
* await step.do("send-survey", {
|
|
55
|
+
* retries: { limit: 3, delay: "5 seconds", backoff: "exponential" }
|
|
56
|
+
* }, async () => {
|
|
57
|
+
* await sendSurveyEmail(user.id)
|
|
58
|
+
* })
|
|
59
|
+
* }
|
|
60
|
+
* })
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function defineWorkflow<TParams = any, TOutput = any>(defOrRun: WorkflowDefinition<TParams, TOutput> | ((event: WorkflowEvent<TParams>, step: WorkflowStep) => Promise<TOutput> | TOutput)): WorkflowDefinition<TParams, TOutput>;
|
|
64
|
+
/** Returns the raw Cloudflare Workflow binding from the active environment. */
|
|
65
|
+
export declare function getWorkflowBinding(bindingName: string, event?: CFEvent): any;
|
|
66
|
+
/**
|
|
67
|
+
* Resolves a typed `WorkflowClient` to trigger, query, pause, resume, or restart a workflow.
|
|
68
|
+
*
|
|
69
|
+
* @param name Workflow name or Cloudflare binding name
|
|
70
|
+
* @param event Optional CFEvent context
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const onboarding = useWorkflow("onboarding")
|
|
75
|
+
*
|
|
76
|
+
* // Trigger an instance
|
|
77
|
+
* const instance = await onboarding.create({
|
|
78
|
+
* id: "user-123-welcome",
|
|
79
|
+
* params: { email: "user@example.com" }
|
|
80
|
+
* })
|
|
81
|
+
*
|
|
82
|
+
* // Check status
|
|
83
|
+
* const status = await onboarding.status(instance.id)
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function useWorkflow<TParams = any, TOutput = any>(name: string, event?: CFEvent): WorkflowClient<TParams, TOutput>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a `WorkflowClient` for a workflow name or binding.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createWorkflowClient<TParams = any, TOutput = any>(name: string, event?: CFEvent): WorkflowClient<TParams, TOutput>;
|
|
91
|
+
/** Clear all stored workflow instances and registry definitions (for test teardown). */
|
|
92
|
+
export declare function clearWorkflowRegistry(): void;
|