alepha 0.19.1 → 0.19.2
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/LICENSE +1 -1
- package/README.md +6 -9
- package/dist/api/audits/index.d.ts +378 -346
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/files/index.d.ts +216 -184
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/jobs/index.d.ts +528 -496
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +3 -3
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +207 -207
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/notifications/index.d.ts +152 -152
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/organizations/index.browser.js +48 -0
- package/dist/api/organizations/index.browser.js.map +1 -0
- package/dist/api/organizations/index.d.ts +516 -0
- package/dist/api/organizations/index.d.ts.map +1 -0
- package/dist/api/organizations/index.js +202 -0
- package/dist/api/organizations/index.js.map +1 -0
- package/dist/api/parameters/index.d.ts +391 -358
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +5 -1
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.browser.js +7 -5
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +978 -913
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +160 -112
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +135 -135
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +2 -2
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/batch/index.d.ts +6 -6
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/billing/index.d.ts +1048 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +713 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/bin/index.js +0 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +10 -10
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +2 -2
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/core/index.d.ts +9 -9
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +2 -2
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js +2 -2
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/redis/index.d.ts +6 -6
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/config/index.d.ts +12 -2
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/config/index.js +4 -0
- package/dist/cli/config/index.js.map +1 -1
- package/dist/cli/core/index.d.ts +183 -140
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +279 -89
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +45 -0
- package/dist/cli/devtools/index.d.ts.map +1 -0
- package/dist/cli/devtools/index.js +170 -0
- package/dist/cli/devtools/index.js.map +1 -0
- package/dist/cli/platform/index.d.ts +383 -492
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +42 -511
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +196 -0
- package/dist/cli/vendor/index.d.ts.map +1 -0
- package/dist/cli/vendor/index.js +384 -0
- package/dist/cli/vendor/index.js.map +1 -0
- package/dist/command/index.d.ts +18 -18
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +2 -2
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +4 -4
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +10 -10
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +4 -4
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +4 -4
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.d.ts +7 -7
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/datetime/index.d.ts +4 -4
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/email/brevo/index.d.ts +4 -4
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/core/index.d.ts +15 -11
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js +12 -35
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/smtp/index.d.ts +12 -12
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +7 -4
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +4 -8
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +55 -889
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +13 -13
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +2 -2
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +4 -4
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +16 -15
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +5 -2
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +11 -11
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +11 -1
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +53 -16
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +95 -51
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +55 -14
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +18 -17
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/queue/core/index.d.ts +14 -14
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +2 -2
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js +2 -2
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +4 -4
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js +2 -2
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.d.ts +9 -9
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/core/index.d.ts +6 -6
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +5 -4
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +4 -4
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/head/index.d.ts +4 -4
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/i18n/index.d.ts +9 -9
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/intro/index.d.ts +2 -2
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js +1 -1
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +4 -5
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +215 -215
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +6 -7
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +2 -2
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +2 -4
- package/dist/react/testing/index.js.map +1 -1
- package/dist/redis/index.d.ts +19 -19
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/retry/index.d.ts +4 -4
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +13 -13
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +2 -2
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +2 -2
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js +1 -1
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +47 -47
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +9 -12
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +170 -169
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +16 -2
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts +7 -7
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/core/index.d.ts +76 -76
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +23 -17
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +13 -13
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +2 -2
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +9 -9
- package/dist/server/etag/index.d.ts.map +1 -1
- package/dist/server/health/index.d.ts +20 -20
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/links/index.browser.js +2 -2
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +66 -66
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +4 -4
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +7 -7
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/proxy/index.d.ts +5 -5
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.d.ts +12 -12
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +2 -2
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +5 -5
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/swagger/index.d.ts +7 -7
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +2 -2
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +11 -7
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +9 -15
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.d.ts +4 -4
- package/dist/system/index.d.ts.map +1 -1
- package/dist/topic/core/index.d.ts +6 -6
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/redis/index.d.ts +7 -7
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js +2 -2
- package/dist/topic/redis/index.js.map +1 -1
- package/dist/websocket/index.d.ts +36 -36
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +2 -2
- package/dist/websocket/index.js.map +1 -1
- package/package.json +36 -14
- package/src/api/jobs/{services → __tests__}/JobService.spec.ts +1 -1
- package/src/api/jobs/providers/JobProvider.ts +3 -3
- package/src/api/keys/{services → __tests__}/ApiKeyService.spec.ts +1 -1
- package/src/api/organizations/__tests__/OrganizationService.spec.ts +193 -0
- package/src/api/organizations/controllers/AdminOrganizationController.ts +103 -0
- package/src/api/organizations/entities/organizations.ts +20 -0
- package/src/api/organizations/index.browser.ts +10 -0
- package/src/api/organizations/index.ts +31 -0
- package/src/api/organizations/schemas/createOrganizationSchema.ts +10 -0
- package/src/api/organizations/schemas/organizationQuerySchema.ts +10 -0
- package/src/api/organizations/schemas/organizationResourceSchema.ts +6 -0
- package/src/api/organizations/schemas/updateOrganizationSchema.ts +7 -0
- package/src/api/organizations/services/OrganizationService.ts +75 -0
- package/src/api/parameters/services/ParameterProvider.ts +6 -1
- package/src/api/users/{services → __tests__}/SessionService.spec.ts +67 -0
- package/src/api/users/{jobs → __tests__}/UserJobs.spec.ts +1 -1
- package/src/api/users/entities/users.ts +9 -3
- package/src/api/users/index.ts +23 -4
- package/src/api/users/primitives/$realm.ts +6 -4
- package/src/api/users/providers/RealmProvider.ts +1 -1
- package/src/api/users/services/RegistrationService.ts +1 -1
- package/src/api/users/services/SessionService.ts +92 -5
- package/src/api/users/services/UserService.ts +1 -1
- package/src/api/verifications/{jobs → __tests__}/VerificationJobs.spec.ts +4 -2
- package/src/api/verifications/parameters/VerificationParameters.ts +2 -2
- package/src/billing/__tests__/BillingService.spec.ts +136 -0
- package/src/billing/__tests__/PaymentMethodService.spec.ts +78 -0
- package/src/billing/controllers/AdminBillingController.ts +149 -0
- package/src/billing/controllers/BillingController.ts +108 -0
- package/src/billing/entities/paymentIntents.ts +34 -0
- package/src/billing/entities/paymentMethods.ts +24 -0
- package/src/billing/entities/refunds.ts +22 -0
- package/src/billing/errors/BillingError.ts +5 -0
- package/src/billing/index.ts +76 -0
- package/src/billing/providers/BillingProvider.ts +79 -0
- package/src/billing/providers/MemoryBillingProvider.ts +139 -0
- package/src/billing/schemas/intentSchemas.ts +60 -0
- package/src/billing/schemas/paymentMethodSchemas.ts +13 -0
- package/src/billing/schemas/refundSchemas.ts +6 -0
- package/src/billing/services/BillingService.ts +325 -0
- package/src/billing/services/PaymentMethodService.ts +82 -0
- package/src/bin/index.ts +0 -2
- package/src/bucket/providers/LocalFileStorageProvider.ts +2 -2
- package/src/cache/core/{primitives → __tests__}/$cache.middleware.spec.ts +1 -1
- package/src/cache/core/{providers → __tests__}/MemoryCacheProvider.spec.ts +1 -1
- package/src/cache/core/primitives/$cache.ts +2 -2
- package/src/cache/redis/providers/RedisCacheProvider.ts +2 -2
- package/src/cli/config/defineConfig.ts +20 -0
- package/src/cli/core/{services → __tests__}/ProjectScaffolder.spec.ts +1 -1
- package/src/cli/core/{commands/gen → __tests__}/changelog.spec.ts +1 -1
- package/src/cli/core/{commands → __tests__}/init.spec.ts +2 -8
- package/src/cli/core/atoms/devOptions.ts +0 -5
- package/src/cli/core/commands/build.ts +2 -2
- package/src/cli/core/commands/dev.ts +165 -30
- package/src/cli/core/commands/gen/changelog.ts +2 -2
- package/src/cli/core/commands/init.ts +2 -7
- package/src/cli/core/commands/verify.ts +0 -1
- package/src/cli/core/providers/AppEntryProvider.ts +2 -2
- package/src/cli/core/providers/ViteDevServerProvider.ts +54 -66
- package/src/cli/core/services/PackageManagerUtils.ts +8 -3
- package/src/cli/core/services/ProjectScaffolder.ts +18 -18
- package/src/cli/core/tasks/BuildClientTask.ts +8 -0
- package/src/cli/core/tasks/BuildServerTask.ts +17 -4
- package/src/cli/core/templates/alephaConfigTs.ts +0 -6
- package/src/cli/core/templates/webAdminDashboardTsx.ts +17 -0
- package/src/cli/core/templates/webAppRouterTs.ts +85 -2
- package/src/cli/devtools/atoms/devtoolsOptions.ts +26 -0
- package/src/cli/devtools/index.ts +194 -0
- package/src/cli/platform/{adapters → __tests__}/CloudflareAdapter.spec.ts +2 -2
- package/src/cli/platform/{providers → __tests__}/GitHubSecretStore.spec.ts +1 -1
- package/src/cli/platform/{services → __tests__}/NamingService.spec.ts +1 -1
- package/src/cli/platform/{providers → __tests__}/PlatformCacheProvider.spec.ts +1 -1
- package/src/cli/platform/{services → __tests__}/PlatformInspector.spec.ts +1 -1
- package/src/cli/platform/{services → __tests__}/PlatformOrchestrator.spec.ts +3 -3
- package/src/cli/platform/{services → __tests__}/SecretFilterService.spec.ts +1 -1
- package/src/cli/platform/{commands → __tests__}/SecretsCommand.spec.ts +1 -1
- package/src/cli/platform/{adapters → __tests__}/VercelAdapter.spec.ts +2 -2
- package/src/cli/platform/atoms/platformOptions.ts +2 -10
- package/src/cli/platform/commands/SecretsCommand.ts +2 -2
- package/src/cli/platform/commands/platform.ts +2 -11
- package/src/cli/platform/index.ts +34 -11
- package/src/cli/platform/services/PlatformInspector.ts +2 -2
- package/src/cli/platform/services/PlatformOrchestrator.ts +0 -9
- package/src/cli/vendor/__tests__/VendorService.spec.ts +407 -0
- package/src/cli/vendor/atoms/vendorOptions.ts +41 -0
- package/src/cli/vendor/commands/VendorCommand.ts +204 -0
- package/src/cli/vendor/index.ts +43 -0
- package/src/cli/vendor/services/VendorService.ts +338 -0
- package/src/command/{providers → __tests__}/CliProvider.spec.ts +1 -1
- package/src/command/{helpers → __tests__}/EnvUtils.spec.ts +1 -1
- package/src/command/providers/CliProvider.ts +2 -2
- package/src/core/{primitives → __tests__}/$atom.spec.ts +2 -2
- package/src/core/{primitives → __tests__}/$memoize.spec.ts +1 -1
- package/src/core/{primitives → __tests__}/$mode.spec.ts +1 -1
- package/src/core/{primitives → __tests__}/$pipeline.spec.ts +1 -1
- package/src/core/{primitives → __tests__}/$scope.spec.ts +2 -2
- package/src/core/{providers → __tests__}/KeylessJsonSchemaCodec.spec.ts +1 -1
- package/src/core/{providers → __tests__}/SchemaValidator.spec.ts +1 -1
- package/src/core/{helpers → __tests__}/jsonSchemaToTypeBox.spec.ts +1 -1
- package/src/core/index.shared.ts +1 -1
- package/src/core/primitives/{$use.ts → $state.ts} +4 -4
- package/src/crypto/{providers → __tests__}/BrowserCryptoProvider.browser.spec.ts +1 -1
- package/src/crypto/{providers → __tests__}/CryptoProvider.spec.ts +1 -1
- package/src/datetime/{primitives → __tests__}/$debounce.spec.ts +1 -1
- package/src/datetime/{primitives → __tests__}/$throttle.spec.ts +1 -1
- package/src/datetime/{primitives → __tests__}/$timeout.spec.ts +1 -1
- package/src/email/brevo/{providers → __tests__}/BrevoEmailProvider.spec.ts +1 -1
- package/src/email/core/{providers → __tests__}/LocalEmailProvider.spec.ts +39 -150
- package/src/email/core/providers/LocalEmailProvider.ts +13 -51
- package/src/email/smtp/providers/NodemailerEmailProvider.ts +2 -2
- package/src/lock/core/{primitives → __tests__}/$lock.middleware.spec.ts +1 -1
- package/src/lock/core/primitives/$lock.ts +2 -2
- package/src/logger/index.ts +10 -4
- package/src/mcp/transports/SseMcpTransport.ts +2 -2
- package/src/orm/__tests__/ModelBuilder-tests.ts +53 -0
- package/src/orm/__tests__/ModelBuilder.spec.ts +80 -0
- package/src/orm/__tests__/organization-tests.ts +200 -0
- package/src/orm/__tests__/organization.spec.ts +103 -0
- package/src/orm/core/{providers/drivers → __tests__}/BunSqliteProvider.bun.spec.ts +5 -2
- package/src/orm/core/constants/PG_SYMBOLS.ts +2 -0
- package/src/orm/core/index.shared.ts +1 -0
- package/src/orm/core/primitives/$entity.ts +31 -0
- package/src/orm/core/providers/DatabaseTypeProvider.ts +11 -0
- package/src/orm/core/providers/DrizzleKitProvider.ts +1 -1
- package/src/orm/core/providers/drivers/BunSqliteProvider.ts +2 -2
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +3 -3
- package/src/orm/core/services/ModelBuilder.ts +11 -0
- package/src/orm/core/services/QueryManager.ts +16 -2
- package/src/orm/core/services/Repository.ts +70 -10
- package/src/orm/postgres/{providers → __tests__}/BunPostgresProvider.bun.spec.ts +1 -1
- package/src/queue/core/providers/WorkerProvider.ts +2 -2
- package/src/queue/redis/providers/RedisQueueProvider.ts +2 -2
- package/src/react/core/{hooks → __tests__}/useAction.browser.spec.tsx +1 -1
- package/src/react/core/hooks/useAction.ts +7 -6
- package/src/react/head/{providers → __tests__}/BrowserHeadProvider.browser.spec.ts +1 -1
- package/src/react/head/{helpers → __tests__}/SeoExpander.spec.ts +1 -1
- package/src/react/i18n/{providers → __tests__}/I18nProvider.spec.ts +1 -1
- package/src/react/i18n/{hooks → __tests__}/useI18n.browser.spec.tsx +1 -1
- package/src/react/intro/components/GettingStartedDevtoolsSlide.tsx +1 -1
- package/src/react/router/{providers → __tests__}/ReactBrowserProvider.browser.spec.ts +1 -1
- package/src/react/router/providers/ReactBrowserProvider.ts +2 -2
- package/src/react/router/providers/ReactPageProvider.ts +2 -2
- package/src/react/router/providers/ReactServerProvider.ts +3 -3
- package/src/redis/{providers → __tests__}/BunRedisProvider.bun.spec.ts +4 -4
- package/src/retry/{primitives → __tests__}/$retry.middleware.spec.ts +1 -1
- package/src/router/{TemplatedPathParser.spec.ts → __tests__/TemplatedPathParser.spec.ts} +1 -1
- package/src/scheduler/primitives/$scheduler.ts +2 -2
- package/src/security/{primitives → __tests__}/$secure-browser.spec.ts +1 -1
- package/src/security/{primitives → __tests__}/$secure.spec.ts +1 -1
- package/src/security/primitives/$issuer.ts +1 -1
- package/src/security/providers/JwtProvider.ts +6 -10
- package/src/security/providers/SecurityProvider.ts +6 -11
- package/src/security/schemas/userAccountInfoSchema.ts +3 -3
- package/src/server/auth/providers/ServerAuthProvider.ts +24 -2
- package/src/server/cookies/{services → __tests__}/CookieParser.spec.ts +1 -1
- package/src/server/core/{primitives → __tests__}/$circuit.spec.ts +1 -1
- package/src/server/core/{providers → __tests__}/NodeHttpServerProvider.spec.ts +1 -1
- package/src/server/core/{providers → __tests__}/ServerBodyParserProvider.spec.ts +31 -1
- package/src/server/core/{providers → __tests__}/ServerCompressProvider.spec.ts +1 -1
- package/src/server/core/{providers → __tests__}/ServerHelmetProvider.spec.ts +4 -1
- package/src/server/core/{providers → __tests__}/ServerMultipartProvider.spec.ts +1 -1
- package/src/server/core/{services → __tests__}/ServerRequestParser.spec.ts +1 -1
- package/src/server/core/primitives/$action.ts +2 -2
- package/src/server/core/primitives/$sse.ts +2 -2
- package/src/server/core/providers/ServerBodyParserProvider.ts +21 -12
- package/src/server/core/providers/ServerCompressProvider.ts +2 -2
- package/src/server/core/providers/ServerHelmetProvider.ts +2 -2
- package/src/server/core/providers/ServerMultipartProvider.ts +2 -2
- package/src/server/core/providers/ServerRouterProvider.ts +1 -5
- package/src/server/cors/{primitives → __tests__}/$cors.spec.ts +1 -1
- package/src/server/cors/providers/ServerCorsProvider.ts +2 -2
- package/src/server/links/{services → __tests__}/BatchCollector.spec.ts +1 -1
- package/src/server/links/providers/LinkProvider.ts +2 -2
- package/src/server/links/providers/RemotePrimitiveProvider.ts +2 -2
- package/src/server/links/providers/ServerLinksProvider.ts +2 -2
- package/src/server/rate-limit/{primitives → __tests__}/$rateLimit.spec.ts +1 -1
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +2 -2
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +2 -2
- package/src/sms/{providers → __tests__}/LocalSmsProvider.spec.ts +35 -29
- package/src/sms/providers/LocalSmsProvider.ts +13 -24
- package/src/system/{providers → __tests__}/MemoryFileSystemProvider.spec.ts +1 -1
- package/src/system/{providers → __tests__}/MemoryShellProvider.spec.ts +1 -1
- package/src/topic/redis/providers/RedisTopicProvider.ts +2 -2
- package/src/websocket/{services → __tests__}/RoomManager.spec.ts +1 -1
- package/src/websocket/providers/NodeWebSocketServerProvider.ts +2 -2
- package/tsconfig.base.json +1 -0
- package/src/cli/platform/adapters/DockerAdapter.spec.ts +0 -378
- package/src/cli/platform/adapters/DockerAdapter.ts +0 -417
- package/src/cli/platform/services/DockerComposeGenerator.spec.ts +0 -490
- package/src/cli/platform/services/DockerComposeGenerator.ts +0 -353
- package/src/cli/platform/services/DockerSshService.spec.ts +0 -47
- package/src/cli/platform/services/DockerSshService.ts +0 -61
- /package/src/api/audits/{primitives → __tests__}/$audit.spec.ts +0 -0
- /package/src/api/audits/{services → __tests__}/AuditService.spec.ts +0 -0
- /package/src/api/files/{controllers → __tests__}/AdminFileStatsController.spec.ts +0 -0
- /package/src/api/files/{controllers → __tests__}/FileController.spec.ts +0 -0
- /package/src/api/files/{jobs → __tests__}/FileJobs.spec.ts +0 -0
- /package/src/api/files/{services → __tests__}/FileService.spec.ts +0 -0
- /package/src/api/jobs/{primitives → __tests__}/$job-middleware.spec.ts +0 -0
- /package/src/api/parameters/{primitives → __tests__}/$parameter.spec.ts +0 -0
- /package/src/api/users/{primitives → __tests__}/$realm.spec.ts +0 -0
- /package/src/api/users/{controllers → __tests__}/AdminIdentityController.spec.ts +0 -0
- /package/src/api/users/{controllers → __tests__}/AdminSessionController.spec.ts +0 -0
- /package/src/api/users/{controllers → __tests__}/AdminUserController.spec.ts +0 -0
- /package/src/api/users/{services → __tests__}/CredentialService.spec.ts +0 -0
- /package/src/api/users/{providers → __tests__}/RealmProvider.spec.ts +0 -0
- /package/src/api/users/{services → __tests__}/RegistrationService.spec.ts +0 -0
- /package/src/batch/{primitives → __tests__}/$batch.spec.ts +0 -0
- /package/src/batch/{providers → __tests__}/BatchProvider.spec.ts +0 -0
- /package/src/bucket/{primitives → __tests__}/$bucket.spec.ts +0 -0
- /package/src/bucket/{providers → __tests__}/FileStorageProvider.spec.ts +0 -0
- /package/src/bucket/{providers → __tests__}/LocalFileStorageProvider.spec.ts +0 -0
- /package/src/bucket/{providers → __tests__}/MemoryFileStorageProvider.spec.ts +0 -0
- /package/src/cache/core/{primitives → __tests__}/$cache.spec.ts +0 -0
- /package/src/cache/redis/{providers → __tests__}/RedisCacheProvider.spec.ts +0 -0
- /package/src/command/{primitives → __tests__}/$command.spec.ts +0 -0
- /package/src/command/{helpers → __tests__}/Asker.spec.ts +0 -0
- /package/src/command/{helpers → __tests__}/Runner.spec.ts +0 -0
- /package/src/core/{primitives → __tests__}/$context.spec.ts +0 -0
- /package/src/core/{primitives → __tests__}/$env.spec.ts +0 -0
- /package/src/core/{primitives → __tests__}/$hook.spec.ts +0 -0
- /package/src/core/{primitives → __tests__}/$inject.spec.ts +0 -0
- /package/src/core/{primitives → __tests__}/$module.spec.ts +0 -0
- /package/src/core/{providers → __tests__}/CodecManager.spec.ts +0 -0
- /package/src/core/{providers → __tests__}/EventManager.spec.ts +0 -0
- /package/src/core/{providers → __tests__}/StateManager.spec.ts +0 -0
- /package/src/core/{providers → __tests__}/TypeProvider.spec.ts +0 -0
- /package/src/datetime/{primitives → __tests__}/$interval.spec.ts +0 -0
- /package/src/datetime/{providers → __tests__}/DateTimeProvider.spec.ts +0 -0
- /package/src/email/core/{primitives → __tests__}/$email.spec.ts +0 -0
- /package/src/fake/{providers → __tests__}/FakeProvider.spec.ts +0 -0
- /package/src/lock/core/{providers → __tests__}/MemoryLockProvider.spec.ts +0 -0
- /package/src/lock/redis/{providers → __tests__}/RedisLockProvider.spec.ts +0 -0
- /package/src/logger/{primitives → __tests__}/$logger.spec.ts +0 -0
- /package/src/logger/{services → __tests__}/Logger.spec.ts +0 -0
- /package/src/mcp/{primitives → __tests__}/$prompt.spec.ts +0 -0
- /package/src/mcp/{primitives → __tests__}/$resource.spec.ts +0 -0
- /package/src/mcp/{primitives → __tests__}/$tool.spec.ts +0 -0
- /package/src/mcp/{providers → __tests__}/McpServerProvider.spec.ts +0 -0
- /package/src/mcp/{helpers → __tests__}/jsonrpc.spec.ts +0 -0
- /package/src/orm/core/{helpers → __tests__}/parseQueryString.spec.ts +0 -0
- /package/src/queue/core/{primitives → __tests__}/$consumer.spec.ts +0 -0
- /package/src/queue/core/{providers → __tests__}/MemoryQueueProvider.spec.ts +0 -0
- /package/src/queue/core/{providers → __tests__}/WorkerProvider.spec.ts +0 -0
- /package/src/queue/redis/{providers → __tests__}/RedisQueueProvider.spec.ts +0 -0
- /package/src/react/form/{hooks → __tests__}/useForm.browser.spec.tsx +0 -0
- /package/src/react/head/{hooks → __tests__}/useHead.spec.tsx +0 -0
- /package/src/react/i18n/{components → __tests__}/Localize.spec.tsx +0 -0
- /package/src/react/router/{primitives → __tests__}/$page.browser.spec.tsx +0 -0
- /package/src/react/router/{primitives → __tests__}/$page.middleware.spec.tsx +0 -0
- /package/src/react/router/{primitives → __tests__}/$page.spec.tsx +0 -0
- /package/src/react/router/{providers → __tests__}/ReactPreloadProvider.spec.ts +0 -0
- /package/src/react/router/{providers → __tests__}/ReactServerProvider.spec.tsx +0 -0
- /package/src/react/router/{providers → __tests__}/ReactServerTemplateProvider.spec.ts +0 -0
- /package/src/retry/{primitives → __tests__}/$retry.spec.ts +0 -0
- /package/src/retry/{providers → __tests__}/RetryProvider.spec.ts +0 -0
- /package/src/router/{providers → __tests__}/RouterProvider.spec.ts +0 -0
- /package/src/security/{primitives → __tests__}/$issuer.spec.ts +0 -0
- /package/src/security/{primitives → __tests__}/$permission.spec.ts +0 -0
- /package/src/security/{primitives → __tests__}/$role.spec.ts +0 -0
- /package/src/security/{primitives → __tests__}/$serviceAccount.spec.ts +0 -0
- /package/src/security/{providers → __tests__}/SecurityProvider.spec.ts +0 -0
- /package/src/server/cookies/{providers → __tests__}/ServerCookiesProvider.spec.ts +0 -0
- /package/src/server/core/{primitives → __tests__}/$action.spec.ts +0 -0
- /package/src/server/core/{primitives → __tests__}/$middleware.spec.ts +0 -0
- /package/src/server/core/{primitives → __tests__}/$route.spec.ts +0 -0
- /package/src/server/core/{primitives → __tests__}/$sse.spec.ts +0 -0
- /package/src/server/core/{providers → __tests__}/BunHttpServerProvider.bun.spec.ts +0 -0
- /package/src/server/core/{services → __tests__}/HttpClient.spec.ts +0 -0
- /package/src/server/core/{providers → __tests__}/ServerLoggerProvider.spec.ts +0 -0
- /package/src/server/core/{services → __tests__}/UserAgentParser.spec.ts +0 -0
- /package/src/server/cors/{providers → __tests__}/ServerCorsProvider.spec.ts +0 -0
- /package/src/server/etag/{providers → __tests__}/ServerEtagProvider.spec.ts +0 -0
- /package/src/server/health/{providers → __tests__}/ServerHealthProvider.spec.ts +0 -0
- /package/src/server/links/{primitives → __tests__}/$remote.spec.ts +0 -0
- /package/src/server/links/{services → __tests__}/BatchEndpoint.spec.ts +0 -0
- /package/src/server/links/{providers → __tests__}/LinkProvider.spec.ts +0 -0
- /package/src/server/links/{providers → __tests__}/ServerLinksProvider.spec.ts +0 -0
- /package/src/server/metrics/{providers → __tests__}/ServerMetricsProvider.spec.ts +0 -0
- /package/src/server/proxy/{primitives → __tests__}/$proxy.spec.ts +0 -0
- /package/src/server/rate-limit/{providers → __tests__}/ServerRateLimitProvider.spec.ts +0 -0
- /package/src/server/static/{primitives → __tests__}/$serve.spec.ts +0 -0
- /package/src/server/swagger/{primitives → __tests__}/$swagger.spec.ts +0 -0
- /package/src/sms/{primitives → __tests__}/$sms.spec.ts +0 -0
- /package/src/sms/{providers → __tests__}/MemorySmsProvider.spec.ts +0 -0
- /package/src/system/{services → __tests__}/FileDetector.spec.ts +0 -0
- /package/src/system/{providers → __tests__}/NodeFileSystemProvider.spec.ts +0 -0
- /package/src/topic/core/{primitives → __tests__}/$subscriber.spec.ts +0 -0
- /package/src/topic/core/{providers → __tests__}/MemoryTopicProvider.spec.ts +0 -0
- /package/src/topic/redis/{providers → __tests__}/RedisTopicProvider.spec.ts +0 -0
- /package/src/websocket/{primitives → __tests__}/$channel.spec.ts +0 -0
|
@@ -0,0 +1,1048 @@
|
|
|
1
|
+
import * as _$alepha from "alepha";
|
|
2
|
+
import { Alepha, AlephaError, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
3
|
+
import * as _$alepha_server0 from "alepha/server";
|
|
4
|
+
import * as _$alepha_orm0 from "alepha/orm";
|
|
5
|
+
import * as _$alepha_api_jobs0 from "alepha/api/jobs";
|
|
6
|
+
import { DateTimeProvider } from "alepha/datetime";
|
|
7
|
+
import * as _$alepha_logger0 from "alepha/logger";
|
|
8
|
+
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
|
|
9
|
+
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
10
|
+
//#region ../../src/orm/core/schemas/insertSchema.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Transforms a TObject schema for insert operations.
|
|
13
|
+
* All default properties at the root level are made optional.
|
|
14
|
+
* Generated columns are excluded entirely.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* Before: { name: string; age: number(default=0); fullName: generated }
|
|
18
|
+
* After: { name: string; age?: number; }
|
|
19
|
+
*/
|
|
20
|
+
type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
|
|
21
|
+
[PG_GENERATED]: any;
|
|
22
|
+
} ? never : K]: T["properties"][K] extends {
|
|
23
|
+
[PG_DEFAULT]: any;
|
|
24
|
+
} | {
|
|
25
|
+
"~optional": true;
|
|
26
|
+
} ? TOptional<T["properties"][K]> : T["properties"][K] }>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region ../../src/orm/core/schemas/updateSchema.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* Transforms a TObject schema for update operations.
|
|
31
|
+
* All optional properties at the root level are made nullable (i.e., `T | null`).
|
|
32
|
+
* Generated columns are excluded entirely.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* Before: { name?: string; age: number; fullName: generated }
|
|
36
|
+
* After: { name?: string | null; age: number; }
|
|
37
|
+
*/
|
|
38
|
+
type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
|
|
39
|
+
[PG_GENERATED]: any;
|
|
40
|
+
} ? never : K]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ../../src/orm/core/primitives/$entity.d.ts
|
|
43
|
+
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
44
|
+
/**
|
|
45
|
+
* The database table name that will be created for this entity.
|
|
46
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* TypeBox schema defining the table structure and column types.
|
|
51
|
+
*/
|
|
52
|
+
schema: T;
|
|
53
|
+
/**
|
|
54
|
+
* Database indexes to create for query optimization.
|
|
55
|
+
*/
|
|
56
|
+
indexes?: (Keys | {
|
|
57
|
+
/**
|
|
58
|
+
* Single column to index.
|
|
59
|
+
*/
|
|
60
|
+
column: Keys;
|
|
61
|
+
/**
|
|
62
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
63
|
+
*/
|
|
64
|
+
unique?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
67
|
+
*/
|
|
68
|
+
name?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Partial index condition. Only rows matching this SQL expression are indexed.
|
|
71
|
+
*/
|
|
72
|
+
where?: SQL;
|
|
73
|
+
} | {
|
|
74
|
+
/**
|
|
75
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
76
|
+
*/
|
|
77
|
+
columns: Keys[];
|
|
78
|
+
/**
|
|
79
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
80
|
+
*/
|
|
81
|
+
unique?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
84
|
+
*/
|
|
85
|
+
name?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Partial index condition. Only rows matching this SQL expression are indexed.
|
|
88
|
+
*/
|
|
89
|
+
where?: SQL;
|
|
90
|
+
} | {
|
|
91
|
+
/**
|
|
92
|
+
* SQL expressions for expression-based indexes.
|
|
93
|
+
*
|
|
94
|
+
* Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
|
|
95
|
+
* Columns and expressions can be mixed together.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* // Case-insensitive unique username per realm
|
|
100
|
+
* indexes: [{
|
|
101
|
+
* expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
|
|
102
|
+
* unique: true,
|
|
103
|
+
* name: "users_realm_username_lower_idx",
|
|
104
|
+
* }]
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
|
|
108
|
+
/**
|
|
109
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
110
|
+
*/
|
|
111
|
+
unique?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
114
|
+
*/
|
|
115
|
+
name: string;
|
|
116
|
+
/**
|
|
117
|
+
* Partial index condition. Only rows matching this SQL expression are indexed.
|
|
118
|
+
*/
|
|
119
|
+
where?: SQL;
|
|
120
|
+
})[];
|
|
121
|
+
/**
|
|
122
|
+
* Foreign key constraints to maintain referential integrity.
|
|
123
|
+
*/
|
|
124
|
+
foreignKeys?: Array<{
|
|
125
|
+
/**
|
|
126
|
+
* Optional name for the foreign key constraint.
|
|
127
|
+
*/
|
|
128
|
+
name?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Local columns that reference the foreign table.
|
|
131
|
+
*/
|
|
132
|
+
columns: Array<keyof Static<T>>;
|
|
133
|
+
/**
|
|
134
|
+
* Referenced columns in the foreign table.
|
|
135
|
+
* Must be EntityColumn references from other entities.
|
|
136
|
+
*/
|
|
137
|
+
foreignColumns: Array<() => EntityColumn<any>>;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Additional table constraints for data validation.
|
|
141
|
+
*
|
|
142
|
+
* Constraints enforce business rules at the database level, providing
|
|
143
|
+
* an additional layer of data integrity beyond application validation.
|
|
144
|
+
*
|
|
145
|
+
* **Constraint Types**:
|
|
146
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
147
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* constraints: [
|
|
152
|
+
* {
|
|
153
|
+
* name: "unique_user_email",
|
|
154
|
+
* columns: ["email"],
|
|
155
|
+
* unique: true
|
|
156
|
+
* },
|
|
157
|
+
* {
|
|
158
|
+
* name: "valid_age_range",
|
|
159
|
+
* columns: ["age"],
|
|
160
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
161
|
+
* },
|
|
162
|
+
* {
|
|
163
|
+
* name: "unique_user_username_per_tenant",
|
|
164
|
+
* columns: ["tenantId", "username"],
|
|
165
|
+
* unique: true
|
|
166
|
+
* }
|
|
167
|
+
* ]
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
constraints?: Array<{
|
|
171
|
+
/**
|
|
172
|
+
* Columns involved in this constraint.
|
|
173
|
+
*/
|
|
174
|
+
columns: Array<keyof Static<T>>;
|
|
175
|
+
/**
|
|
176
|
+
* Optional name for the constraint.
|
|
177
|
+
*/
|
|
178
|
+
name?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Whether this is a unique constraint.
|
|
181
|
+
*/
|
|
182
|
+
unique?: boolean | {};
|
|
183
|
+
/**
|
|
184
|
+
* SQL expression for check constraint validation.
|
|
185
|
+
*/
|
|
186
|
+
check?: SQL;
|
|
187
|
+
}>;
|
|
188
|
+
/**
|
|
189
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
190
|
+
*/
|
|
191
|
+
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
192
|
+
}
|
|
193
|
+
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
194
|
+
readonly options: EntityPrimitiveOptions<T>;
|
|
195
|
+
constructor(options: EntityPrimitiveOptions<T>);
|
|
196
|
+
alias(alias: string): this;
|
|
197
|
+
get cols(): EntityColumns<T>;
|
|
198
|
+
get name(): string;
|
|
199
|
+
get schema(): T;
|
|
200
|
+
get insertSchema(): TObjectInsert<T>;
|
|
201
|
+
get updateSchema(): TObjectUpdate<T>;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Convert a schema to columns.
|
|
205
|
+
*/
|
|
206
|
+
type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
|
|
207
|
+
type EntityColumn<T extends TObject> = {
|
|
208
|
+
name: string;
|
|
209
|
+
entity: EntityPrimitive<T>;
|
|
210
|
+
};
|
|
211
|
+
type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
|
|
214
|
+
declare const PG_DEFAULT: unique symbol;
|
|
215
|
+
declare const PG_PRIMARY_KEY: unique symbol;
|
|
216
|
+
declare const PG_CREATED_AT: unique symbol;
|
|
217
|
+
declare const PG_UPDATED_AT: unique symbol;
|
|
218
|
+
declare const PG_DELETED_AT: unique symbol;
|
|
219
|
+
declare const PG_VERSION: unique symbol;
|
|
220
|
+
declare const PG_IDENTITY: unique symbol;
|
|
221
|
+
declare const PG_ENUM: unique symbol;
|
|
222
|
+
declare const PG_REF: unique symbol;
|
|
223
|
+
declare const PG_GENERATED: unique symbol;
|
|
224
|
+
declare const PG_ORGANIZATION: unique symbol;
|
|
225
|
+
/**
|
|
226
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
227
|
+
*/
|
|
228
|
+
declare const PG_SERIAL: unique symbol;
|
|
229
|
+
type PgSymbols = {
|
|
230
|
+
[PG_DEFAULT]: {};
|
|
231
|
+
[PG_PRIMARY_KEY]: {};
|
|
232
|
+
[PG_CREATED_AT]: {};
|
|
233
|
+
[PG_UPDATED_AT]: {};
|
|
234
|
+
[PG_DELETED_AT]: {};
|
|
235
|
+
[PG_VERSION]: {};
|
|
236
|
+
[PG_IDENTITY]: PgIdentityOptions;
|
|
237
|
+
[PG_REF]: PgRefOptions;
|
|
238
|
+
[PG_ENUM]: PgEnumOptions;
|
|
239
|
+
[PG_GENERATED]: PgGeneratedOptions;
|
|
240
|
+
[PG_ORGANIZATION]: {};
|
|
241
|
+
/**
|
|
242
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
243
|
+
*/
|
|
244
|
+
[PG_SERIAL]: {};
|
|
245
|
+
};
|
|
246
|
+
type PgSymbolKeys = keyof PgSymbols;
|
|
247
|
+
type PgIdentityOptions = {
|
|
248
|
+
mode: "always" | "byDefault";
|
|
249
|
+
} & PgSequenceOptions & {
|
|
250
|
+
name?: string;
|
|
251
|
+
};
|
|
252
|
+
interface PgEnumOptions {
|
|
253
|
+
name?: string;
|
|
254
|
+
description?: string;
|
|
255
|
+
}
|
|
256
|
+
interface PgGeneratedOptions {
|
|
257
|
+
/**
|
|
258
|
+
* SQL expression for the generated column.
|
|
259
|
+
*/
|
|
260
|
+
expression: SQL;
|
|
261
|
+
/**
|
|
262
|
+
* Storage mode for the generated column.
|
|
263
|
+
* - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
|
|
264
|
+
* - `"virtual"` — value is computed on read (default for SQLite).
|
|
265
|
+
*/
|
|
266
|
+
mode?: "stored" | "virtual";
|
|
267
|
+
}
|
|
268
|
+
interface PgRefOptions {
|
|
269
|
+
ref: () => {
|
|
270
|
+
name: string;
|
|
271
|
+
entity: EntityPrimitive;
|
|
272
|
+
};
|
|
273
|
+
actions?: {
|
|
274
|
+
onUpdate?: UpdateDeleteAction;
|
|
275
|
+
onDelete?: UpdateDeleteAction;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region ../../src/orm/core/helpers/pgAttr.d.ts
|
|
280
|
+
/**
|
|
281
|
+
* Type representation.
|
|
282
|
+
*/
|
|
283
|
+
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* Base database environment schema.
|
|
288
|
+
*
|
|
289
|
+
* Defines the `DATABASE_URL` connection string used by all ORM providers
|
|
290
|
+
* to determine the database driver and connection target.
|
|
291
|
+
*
|
|
292
|
+
* Supported URL formats:
|
|
293
|
+
* - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
|
|
294
|
+
* - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
|
|
295
|
+
* - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
|
|
296
|
+
* - `d1://BINDING_NAME` — Cloudflare D1
|
|
297
|
+
* - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
|
|
298
|
+
*/
|
|
299
|
+
declare const databaseEnvSchema: _$alepha.TObject<{
|
|
300
|
+
DATABASE_URL: _$alepha.TOptional<_$alepha.TString>;
|
|
301
|
+
/**
|
|
302
|
+
* Enable or disable push-based schema synchronization (drizzle-kit push).
|
|
303
|
+
*
|
|
304
|
+
* Defaults to `true` in development and test, `false` in production.
|
|
305
|
+
* Set to `false` in development to skip automatic schema sync
|
|
306
|
+
* (e.g. when managing migrations manually).
|
|
307
|
+
*/
|
|
308
|
+
DATABASE_SYNC: _$alepha.TOptional<_$alepha.TBoolean>;
|
|
309
|
+
}>;
|
|
310
|
+
declare module "alepha" {
|
|
311
|
+
interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
|
|
312
|
+
} //# sourceMappingURL=databaseEnvSchema.d.ts.map
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region ../../src/billing/entities/paymentIntents.d.ts
|
|
315
|
+
declare const paymentIntents: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
|
|
316
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
317
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
318
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
319
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
320
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
321
|
+
amount: _$alepha.TInteger;
|
|
322
|
+
currency: _$alepha.TString;
|
|
323
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
324
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
325
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
326
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
327
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
328
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
329
|
+
}>>;
|
|
330
|
+
type PaymentIntentEntity = Static<typeof paymentIntents.schema>;
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region ../../src/billing/entities/refunds.d.ts
|
|
333
|
+
declare const refunds: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
|
|
334
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
335
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
336
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
337
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
338
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
339
|
+
intentId: _$alepha.TString;
|
|
340
|
+
amount: _$alepha.TInteger;
|
|
341
|
+
currency: _$alepha.TString;
|
|
342
|
+
status: _$alepha.TUnsafe<"processing" | "failed" | "pending" | "completed">;
|
|
343
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
344
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
345
|
+
}>>;
|
|
346
|
+
type RefundEntity = Static<typeof refunds.schema>;
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region ../../src/billing/providers/BillingProvider.d.ts
|
|
349
|
+
interface CreateSessionResult {
|
|
350
|
+
url: string;
|
|
351
|
+
providerRef: string;
|
|
352
|
+
}
|
|
353
|
+
interface RefundResult {
|
|
354
|
+
providerRef: string;
|
|
355
|
+
}
|
|
356
|
+
interface WebhookEvent {
|
|
357
|
+
providerRef: string;
|
|
358
|
+
status: string;
|
|
359
|
+
raw: unknown;
|
|
360
|
+
}
|
|
361
|
+
interface CreatePaymentMethodResult {
|
|
362
|
+
providerRef: string;
|
|
363
|
+
type: string;
|
|
364
|
+
brand?: string;
|
|
365
|
+
last4?: string;
|
|
366
|
+
expMonth?: number;
|
|
367
|
+
expYear?: number;
|
|
368
|
+
}
|
|
369
|
+
declare abstract class BillingProvider {
|
|
370
|
+
/**
|
|
371
|
+
* Create a checkout session with the PSP.
|
|
372
|
+
* Returns a URL to redirect the user to, and the PSP's reference ID.
|
|
373
|
+
*/
|
|
374
|
+
abstract createSession(intent: PaymentIntentEntity, options: {
|
|
375
|
+
returnUrl: string;
|
|
376
|
+
authorize?: boolean;
|
|
377
|
+
}): Promise<CreateSessionResult>;
|
|
378
|
+
/**
|
|
379
|
+
* Capture a previously authorized payment.
|
|
380
|
+
* Amount can differ from the original authorization (partial capture).
|
|
381
|
+
*/
|
|
382
|
+
abstract capturePayment(providerRef: string, amount: number): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Void/cancel a previously authorized payment before capture.
|
|
385
|
+
*/
|
|
386
|
+
abstract voidPayment(providerRef: string): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Refund a captured payment (partial or full).
|
|
389
|
+
*/
|
|
390
|
+
abstract refundPayment(providerRef: string, amount: number): Promise<RefundResult>;
|
|
391
|
+
/**
|
|
392
|
+
* Parse an incoming PSP webhook request into a normalized event.
|
|
393
|
+
*/
|
|
394
|
+
abstract parseWebhook(request: Request): Promise<WebhookEvent>;
|
|
395
|
+
/**
|
|
396
|
+
* Store a payment method token with the PSP.
|
|
397
|
+
*/
|
|
398
|
+
abstract createPaymentMethod(userId: string, token: string): Promise<CreatePaymentMethodResult>;
|
|
399
|
+
/**
|
|
400
|
+
* Delete a stored payment method from the PSP.
|
|
401
|
+
*/
|
|
402
|
+
abstract deletePaymentMethod(providerRef: string): Promise<void>;
|
|
403
|
+
/**
|
|
404
|
+
* Expire/cancel a checkout session on the PSP side.
|
|
405
|
+
* Called during stale session cleanup.
|
|
406
|
+
*/
|
|
407
|
+
abstract expireSession(providerRef: string): Promise<void>;
|
|
408
|
+
}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region ../../src/billing/services/BillingService.d.ts
|
|
411
|
+
declare class BillingService {
|
|
412
|
+
protected readonly alepha: Alepha;
|
|
413
|
+
protected readonly log: _$alepha_logger0.Logger;
|
|
414
|
+
protected readonly dateTime: DateTimeProvider;
|
|
415
|
+
protected readonly provider: BillingProvider;
|
|
416
|
+
protected readonly intentRepo: _$alepha_orm0.Repository<_$alepha.TObject<{
|
|
417
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
418
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
419
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
420
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
421
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
422
|
+
amount: _$alepha.TInteger;
|
|
423
|
+
currency: _$alepha.TString;
|
|
424
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
425
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
426
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
427
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
428
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
429
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
430
|
+
}>>;
|
|
431
|
+
protected readonly refundRepo: _$alepha_orm0.Repository<_$alepha.TObject<{
|
|
432
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
433
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
434
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
435
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
436
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
437
|
+
intentId: _$alepha.TString;
|
|
438
|
+
amount: _$alepha.TInteger;
|
|
439
|
+
currency: _$alepha.TString;
|
|
440
|
+
status: _$alepha.TUnsafe<"processing" | "failed" | "pending" | "completed">;
|
|
441
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
442
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
443
|
+
}>>;
|
|
444
|
+
/**
|
|
445
|
+
* Expires stale payment intents that have been in "processing" status
|
|
446
|
+
* for more than 30 minutes. Runs every 15 minutes.
|
|
447
|
+
*/
|
|
448
|
+
protected readonly expireStaleIntents: _$alepha_api_jobs0.JobPrimitive<_$alepha.TSchema>;
|
|
449
|
+
/**
|
|
450
|
+
* Create a new payment intent in "created" status.
|
|
451
|
+
*/
|
|
452
|
+
createIntent(amount: number, currency: string, metadata?: unknown, options?: {
|
|
453
|
+
paymentMethodId?: string;
|
|
454
|
+
userId?: string;
|
|
455
|
+
}): Promise<PaymentIntentEntity>;
|
|
456
|
+
/**
|
|
457
|
+
* Create a checkout session with the payment provider and
|
|
458
|
+
* transition the intent to "processing".
|
|
459
|
+
*/
|
|
460
|
+
createSession(intentId: string, returnUrl: string, authorize?: boolean): Promise<{
|
|
461
|
+
url: string;
|
|
462
|
+
intentId: string;
|
|
463
|
+
}>;
|
|
464
|
+
/**
|
|
465
|
+
* Handle an incoming webhook from the payment provider.
|
|
466
|
+
*/
|
|
467
|
+
handleWebhook(request: Request): Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* Process a webhook event by updating the intent status and emitting
|
|
470
|
+
* the corresponding billing event.
|
|
471
|
+
*/
|
|
472
|
+
handleWebhookEvent(intentId: string, status: string, raw?: unknown): Promise<void>;
|
|
473
|
+
/**
|
|
474
|
+
* Capture a previously authorized payment. Optionally specify a different
|
|
475
|
+
* amount for partial capture.
|
|
476
|
+
*/
|
|
477
|
+
capture(intentId: string, finalAmount?: number): Promise<PaymentIntentEntity>;
|
|
478
|
+
/**
|
|
479
|
+
* Void a previously authorized payment before capture.
|
|
480
|
+
*/
|
|
481
|
+
void(intentId: string): Promise<PaymentIntentEntity>;
|
|
482
|
+
/**
|
|
483
|
+
* Refund a captured payment (partial or full).
|
|
484
|
+
*/
|
|
485
|
+
refund(intentId: string, amount: number, reason?: string): Promise<RefundEntity>;
|
|
486
|
+
/**
|
|
487
|
+
* Record a cash or offline payment directly as captured,
|
|
488
|
+
* bypassing the checkout flow.
|
|
489
|
+
*/
|
|
490
|
+
recordCashPayment(amount: number, currency: string, metadata?: unknown): Promise<PaymentIntentEntity>;
|
|
491
|
+
/**
|
|
492
|
+
* Cancel a payment intent that has not yet entered processing.
|
|
493
|
+
*/
|
|
494
|
+
cancel(intentId: string): Promise<PaymentIntentEntity>;
|
|
495
|
+
/**
|
|
496
|
+
* Get a payment intent by ID. Throws NotFoundError if not found.
|
|
497
|
+
*/
|
|
498
|
+
getIntent(intentId: string): Promise<PaymentIntentEntity>;
|
|
499
|
+
/**
|
|
500
|
+
* Find payment intents with optional filters and pagination.
|
|
501
|
+
*/
|
|
502
|
+
findIntents(query: {
|
|
503
|
+
status?: string;
|
|
504
|
+
userId?: string;
|
|
505
|
+
sort?: string;
|
|
506
|
+
size?: number;
|
|
507
|
+
page?: number;
|
|
508
|
+
}): Promise<_$alepha.Page<_$alepha_orm0.PgStatic<_$alepha.TObject<{
|
|
509
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
510
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
511
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
512
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
513
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
514
|
+
amount: _$alepha.TInteger;
|
|
515
|
+
currency: _$alepha.TString;
|
|
516
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
517
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
518
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
519
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
520
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
521
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
522
|
+
}>, _$alepha_orm0.PgRelationMap<_$alepha.TObject<{
|
|
523
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
524
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
525
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
526
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
527
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
528
|
+
amount: _$alepha.TInteger;
|
|
529
|
+
currency: _$alepha.TString;
|
|
530
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
531
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
532
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
533
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
534
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
535
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
536
|
+
}>>>>>;
|
|
537
|
+
protected assertStatus(intent: PaymentIntentEntity, expected: PaymentIntentEntity["status"], operation: string): void;
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region ../../src/billing/controllers/AdminBillingController.d.ts
|
|
541
|
+
declare class AdminBillingController {
|
|
542
|
+
protected readonly url = "/admin/billing";
|
|
543
|
+
protected readonly group = "admin:billing";
|
|
544
|
+
protected readonly billing: BillingService;
|
|
545
|
+
/**
|
|
546
|
+
* List payment intents with pagination and filtering.
|
|
547
|
+
*/
|
|
548
|
+
readonly listIntents: _$alepha_server0.ActionPrimitiveFn<{
|
|
549
|
+
query: _$alepha.TObject<{
|
|
550
|
+
page: _$alepha.TOptional<_$alepha.TInteger>;
|
|
551
|
+
size: _$alepha.TOptional<_$alepha.TInteger>;
|
|
552
|
+
sort: _$alepha.TOptional<_$alepha.TString>;
|
|
553
|
+
status: _$alepha.TOptional<_$alepha.TString>;
|
|
554
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
555
|
+
}>;
|
|
556
|
+
response: _$alepha.TPage<_$alepha.TObject<{
|
|
557
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
558
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
559
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
560
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
561
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
562
|
+
amount: _$alepha.TInteger;
|
|
563
|
+
currency: _$alepha.TString;
|
|
564
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
565
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
566
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
567
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
568
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
569
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
570
|
+
}>>;
|
|
571
|
+
}>;
|
|
572
|
+
/**
|
|
573
|
+
* Get a payment intent by ID.
|
|
574
|
+
*/
|
|
575
|
+
readonly getIntent: _$alepha_server0.ActionPrimitiveFn<{
|
|
576
|
+
params: _$alepha.TObject<{
|
|
577
|
+
id: _$alepha.TString;
|
|
578
|
+
}>;
|
|
579
|
+
response: _$alepha.TObject<{
|
|
580
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
581
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
582
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
583
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
584
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
585
|
+
amount: _$alepha.TInteger;
|
|
586
|
+
currency: _$alepha.TString;
|
|
587
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
588
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
589
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
590
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
591
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
592
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
593
|
+
}>;
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Capture an authorized intent.
|
|
597
|
+
*/
|
|
598
|
+
readonly captureIntent: _$alepha_server0.ActionPrimitiveFn<{
|
|
599
|
+
params: _$alepha.TObject<{
|
|
600
|
+
id: _$alepha.TString;
|
|
601
|
+
}>;
|
|
602
|
+
body: _$alepha.TObject<{
|
|
603
|
+
amount: _$alepha.TOptional<_$alepha.TInteger>;
|
|
604
|
+
}>;
|
|
605
|
+
response: _$alepha.TObject<{
|
|
606
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
607
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
608
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
609
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
610
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
611
|
+
amount: _$alepha.TInteger;
|
|
612
|
+
currency: _$alepha.TString;
|
|
613
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
614
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
615
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
616
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
617
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
618
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
619
|
+
}>;
|
|
620
|
+
}>;
|
|
621
|
+
/**
|
|
622
|
+
* Void an authorized intent.
|
|
623
|
+
*/
|
|
624
|
+
readonly voidIntent: _$alepha_server0.ActionPrimitiveFn<{
|
|
625
|
+
params: _$alepha.TObject<{
|
|
626
|
+
id: _$alepha.TString;
|
|
627
|
+
}>;
|
|
628
|
+
response: _$alepha.TObject<{
|
|
629
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
630
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
631
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
632
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
633
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
634
|
+
amount: _$alepha.TInteger;
|
|
635
|
+
currency: _$alepha.TString;
|
|
636
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
637
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
638
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
639
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
640
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
641
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
642
|
+
}>;
|
|
643
|
+
}>;
|
|
644
|
+
/**
|
|
645
|
+
* Refund a captured intent.
|
|
646
|
+
*/
|
|
647
|
+
readonly refundIntent: _$alepha_server0.ActionPrimitiveFn<{
|
|
648
|
+
params: _$alepha.TObject<{
|
|
649
|
+
id: _$alepha.TString;
|
|
650
|
+
}>;
|
|
651
|
+
body: _$alepha.TObject<{
|
|
652
|
+
amount: _$alepha.TInteger;
|
|
653
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
654
|
+
}>;
|
|
655
|
+
response: _$alepha.TObject<{
|
|
656
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
657
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
658
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
659
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
660
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
661
|
+
intentId: _$alepha.TString;
|
|
662
|
+
amount: _$alepha.TInteger;
|
|
663
|
+
currency: _$alepha.TString;
|
|
664
|
+
status: _$alepha.TUnsafe<"processing" | "failed" | "pending" | "completed">;
|
|
665
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
666
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
667
|
+
}>;
|
|
668
|
+
}>;
|
|
669
|
+
/**
|
|
670
|
+
* Cancel a created intent.
|
|
671
|
+
*/
|
|
672
|
+
readonly cancelIntent: _$alepha_server0.ActionPrimitiveFn<{
|
|
673
|
+
params: _$alepha.TObject<{
|
|
674
|
+
id: _$alepha.TString;
|
|
675
|
+
}>;
|
|
676
|
+
response: _$alepha.TObject<{
|
|
677
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
678
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
679
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
680
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
681
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
682
|
+
amount: _$alepha.TInteger;
|
|
683
|
+
currency: _$alepha.TString;
|
|
684
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
685
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
686
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
687
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
688
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
689
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
690
|
+
}>;
|
|
691
|
+
}>;
|
|
692
|
+
/**
|
|
693
|
+
* Record a cash payment.
|
|
694
|
+
*/
|
|
695
|
+
readonly recordCash: _$alepha_server0.ActionPrimitiveFn<{
|
|
696
|
+
body: _$alepha.TObject<{
|
|
697
|
+
amount: _$alepha.TInteger;
|
|
698
|
+
currency: _$alepha.TString;
|
|
699
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
700
|
+
}>;
|
|
701
|
+
response: _$alepha.TObject<{
|
|
702
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
703
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
704
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
705
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
706
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
707
|
+
amount: _$alepha.TInteger;
|
|
708
|
+
currency: _$alepha.TString;
|
|
709
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
710
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
711
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
712
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
713
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
714
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
715
|
+
}>;
|
|
716
|
+
}>;
|
|
717
|
+
/**
|
|
718
|
+
* PSP webhook endpoint (not under /admin, no auth — verified by provider).
|
|
719
|
+
*/
|
|
720
|
+
readonly webhook: _$alepha_server0.ActionPrimitiveFn<{
|
|
721
|
+
response: _$alepha.TObject<{
|
|
722
|
+
ok: _$alepha.TBoolean;
|
|
723
|
+
id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
|
|
724
|
+
count: _$alepha.TOptional<_$alepha.TNumber>;
|
|
725
|
+
}>;
|
|
726
|
+
}>;
|
|
727
|
+
}
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region ../../src/billing/entities/paymentMethods.d.ts
|
|
730
|
+
declare const paymentMethods: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
|
|
731
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
732
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
733
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
734
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
735
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
736
|
+
userId: _$alepha.TString;
|
|
737
|
+
type: _$alepha.TString;
|
|
738
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
739
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
740
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
741
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
742
|
+
isDefault: _$alepha.TBoolean;
|
|
743
|
+
providerRef: _$alepha.TString;
|
|
744
|
+
}>>;
|
|
745
|
+
type PaymentMethodEntity = Static<typeof paymentMethods.schema>;
|
|
746
|
+
//#endregion
|
|
747
|
+
//#region ../../src/billing/services/PaymentMethodService.d.ts
|
|
748
|
+
declare class PaymentMethodService {
|
|
749
|
+
protected readonly log: _$alepha_logger0.Logger;
|
|
750
|
+
protected readonly provider: BillingProvider;
|
|
751
|
+
protected readonly methodRepo: _$alepha_orm0.Repository<_$alepha.TObject<{
|
|
752
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
753
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
754
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
755
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
756
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
757
|
+
userId: _$alepha.TString;
|
|
758
|
+
type: _$alepha.TString;
|
|
759
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
760
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
761
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
762
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
763
|
+
isDefault: _$alepha.TBoolean;
|
|
764
|
+
providerRef: _$alepha.TString;
|
|
765
|
+
}>>;
|
|
766
|
+
addPaymentMethod(userId: string, organizationId: string, token: string): Promise<PaymentMethodEntity>;
|
|
767
|
+
listPaymentMethods(userId: string): Promise<PaymentMethodEntity[]>;
|
|
768
|
+
removePaymentMethod(methodId: string, userId: string): Promise<void>;
|
|
769
|
+
setDefault(methodId: string, userId: string): Promise<PaymentMethodEntity>;
|
|
770
|
+
}
|
|
771
|
+
//#endregion
|
|
772
|
+
//#region ../../src/billing/controllers/BillingController.d.ts
|
|
773
|
+
declare class BillingController {
|
|
774
|
+
protected readonly url = "/billing";
|
|
775
|
+
protected readonly group = "billing";
|
|
776
|
+
protected readonly billing: BillingService;
|
|
777
|
+
protected readonly paymentMethods: PaymentMethodService;
|
|
778
|
+
/**
|
|
779
|
+
* List the current user's saved payment methods.
|
|
780
|
+
*/
|
|
781
|
+
readonly listPaymentMethods: _$alepha_server0.ActionPrimitiveFn<{
|
|
782
|
+
response: _$alepha.TArray<_$alepha.TObject<{
|
|
783
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
784
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
785
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
786
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
787
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
788
|
+
userId: _$alepha.TString;
|
|
789
|
+
type: _$alepha.TString;
|
|
790
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
791
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
792
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
793
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
794
|
+
isDefault: _$alepha.TBoolean;
|
|
795
|
+
providerRef: _$alepha.TString;
|
|
796
|
+
}>>;
|
|
797
|
+
}>;
|
|
798
|
+
/**
|
|
799
|
+
* Add a new payment method.
|
|
800
|
+
*/
|
|
801
|
+
readonly addPaymentMethod: _$alepha_server0.ActionPrimitiveFn<{
|
|
802
|
+
body: _$alepha.TObject<{
|
|
803
|
+
token: _$alepha.TString;
|
|
804
|
+
}>;
|
|
805
|
+
response: _$alepha.TObject<{
|
|
806
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
807
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
808
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
809
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
810
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
811
|
+
userId: _$alepha.TString;
|
|
812
|
+
type: _$alepha.TString;
|
|
813
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
814
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
815
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
816
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
817
|
+
isDefault: _$alepha.TBoolean;
|
|
818
|
+
providerRef: _$alepha.TString;
|
|
819
|
+
}>;
|
|
820
|
+
}>;
|
|
821
|
+
/**
|
|
822
|
+
* Remove a payment method.
|
|
823
|
+
*/
|
|
824
|
+
readonly removePaymentMethod: _$alepha_server0.ActionPrimitiveFn<{
|
|
825
|
+
params: _$alepha.TObject<{
|
|
826
|
+
id: _$alepha.TString;
|
|
827
|
+
}>;
|
|
828
|
+
response: _$alepha.TObject<{
|
|
829
|
+
ok: _$alepha.TBoolean;
|
|
830
|
+
id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
|
|
831
|
+
count: _$alepha.TOptional<_$alepha.TNumber>;
|
|
832
|
+
}>;
|
|
833
|
+
}>;
|
|
834
|
+
/**
|
|
835
|
+
* Set a payment method as default.
|
|
836
|
+
*/
|
|
837
|
+
readonly setDefaultPaymentMethod: _$alepha_server0.ActionPrimitiveFn<{
|
|
838
|
+
params: _$alepha.TObject<{
|
|
839
|
+
id: _$alepha.TString;
|
|
840
|
+
}>;
|
|
841
|
+
response: _$alepha.TObject<{
|
|
842
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
843
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
844
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
845
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
846
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
847
|
+
userId: _$alepha.TString;
|
|
848
|
+
type: _$alepha.TString;
|
|
849
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
850
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
851
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
852
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
853
|
+
isDefault: _$alepha.TBoolean;
|
|
854
|
+
providerRef: _$alepha.TString;
|
|
855
|
+
}>;
|
|
856
|
+
}>;
|
|
857
|
+
/**
|
|
858
|
+
* Create a checkout session.
|
|
859
|
+
*/
|
|
860
|
+
readonly createCheckout: _$alepha_server0.ActionPrimitiveFn<{
|
|
861
|
+
body: _$alepha.TObject<{
|
|
862
|
+
intentId: _$alepha.TString;
|
|
863
|
+
returnUrl: _$alepha.TString;
|
|
864
|
+
authorize: _$alepha.TOptional<_$alepha.TBoolean>;
|
|
865
|
+
}>;
|
|
866
|
+
response: _$alepha.TObject<{
|
|
867
|
+
url: _$alepha.TString;
|
|
868
|
+
intentId: _$alepha.TString;
|
|
869
|
+
}>;
|
|
870
|
+
}>;
|
|
871
|
+
}
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region ../../src/billing/errors/BillingError.d.ts
|
|
874
|
+
declare class BillingError extends AlephaError {
|
|
875
|
+
readonly status = 400;
|
|
876
|
+
}
|
|
877
|
+
//#endregion
|
|
878
|
+
//#region ../../src/billing/providers/MemoryBillingProvider.d.ts
|
|
879
|
+
interface MemoryCharge {
|
|
880
|
+
providerRef: string;
|
|
881
|
+
amount: number;
|
|
882
|
+
status: string;
|
|
883
|
+
}
|
|
884
|
+
interface MemoryRefund {
|
|
885
|
+
providerRef: string;
|
|
886
|
+
chargeRef: string;
|
|
887
|
+
amount: number;
|
|
888
|
+
}
|
|
889
|
+
declare class MemoryBillingProvider implements BillingProvider {
|
|
890
|
+
protected readonly charges: Map<string, MemoryCharge>;
|
|
891
|
+
protected readonly refundRecords: Map<string, MemoryRefund>;
|
|
892
|
+
protected readonly methods: Map<string, CreatePaymentMethodResult>;
|
|
893
|
+
protected readonly expiredSessions: Set<string>;
|
|
894
|
+
createSession(intent: PaymentIntentEntity, options: {
|
|
895
|
+
returnUrl: string;
|
|
896
|
+
authorize?: boolean;
|
|
897
|
+
}): Promise<CreateSessionResult>;
|
|
898
|
+
capturePayment(providerRef: string, amount: number): Promise<void>;
|
|
899
|
+
voidPayment(providerRef: string): Promise<void>;
|
|
900
|
+
refundPayment(providerRef: string, amount: number): Promise<RefundResult>;
|
|
901
|
+
parseWebhook(request: Request): Promise<WebhookEvent>;
|
|
902
|
+
createPaymentMethod(userId: string, token: string): Promise<CreatePaymentMethodResult>;
|
|
903
|
+
deletePaymentMethod(providerRef: string): Promise<void>;
|
|
904
|
+
expireSession(providerRef: string): Promise<void>;
|
|
905
|
+
wasCharged(providerRef: string): boolean;
|
|
906
|
+
wasRefunded(providerRef: string): boolean;
|
|
907
|
+
wasExpired(providerRef: string): boolean;
|
|
908
|
+
getCharges(): MemoryCharge[];
|
|
909
|
+
getRefunds(): MemoryRefund[];
|
|
910
|
+
}
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region ../../src/billing/schemas/intentSchemas.d.ts
|
|
913
|
+
declare const createIntentSchema: _$alepha.TObject<{
|
|
914
|
+
amount: _$alepha.TInteger;
|
|
915
|
+
currency: _$alepha.TString;
|
|
916
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
917
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
918
|
+
}>;
|
|
919
|
+
type CreateIntent = Static<typeof createIntentSchema>;
|
|
920
|
+
declare const createCheckoutSchema: _$alepha.TObject<{
|
|
921
|
+
intentId: _$alepha.TString;
|
|
922
|
+
returnUrl: _$alepha.TString;
|
|
923
|
+
authorize: _$alepha.TOptional<_$alepha.TBoolean>;
|
|
924
|
+
}>;
|
|
925
|
+
type CreateCheckout = Static<typeof createCheckoutSchema>;
|
|
926
|
+
declare const checkoutResponseSchema: _$alepha.TObject<{
|
|
927
|
+
url: _$alepha.TString;
|
|
928
|
+
intentId: _$alepha.TString;
|
|
929
|
+
}>;
|
|
930
|
+
type CheckoutResponse = Static<typeof checkoutResponseSchema>;
|
|
931
|
+
declare const captureIntentSchema: _$alepha.TObject<{
|
|
932
|
+
amount: _$alepha.TOptional<_$alepha.TInteger>;
|
|
933
|
+
}>;
|
|
934
|
+
type CaptureIntent = Static<typeof captureIntentSchema>;
|
|
935
|
+
declare const refundIntentSchema: _$alepha.TObject<{
|
|
936
|
+
amount: _$alepha.TInteger;
|
|
937
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
938
|
+
}>;
|
|
939
|
+
type RefundIntent = Static<typeof refundIntentSchema>;
|
|
940
|
+
declare const recordCashSchema: _$alepha.TObject<{
|
|
941
|
+
amount: _$alepha.TInteger;
|
|
942
|
+
currency: _$alepha.TString;
|
|
943
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
944
|
+
}>;
|
|
945
|
+
type RecordCash = Static<typeof recordCashSchema>;
|
|
946
|
+
declare const intentQuerySchema: _$alepha.TObject<{
|
|
947
|
+
page: _$alepha.TOptional<_$alepha.TInteger>;
|
|
948
|
+
size: _$alepha.TOptional<_$alepha.TInteger>;
|
|
949
|
+
sort: _$alepha.TOptional<_$alepha.TString>;
|
|
950
|
+
status: _$alepha.TOptional<_$alepha.TString>;
|
|
951
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
952
|
+
}>;
|
|
953
|
+
type IntentQuery = Static<typeof intentQuerySchema>;
|
|
954
|
+
declare const intentResourceSchema: _$alepha.TObject<{
|
|
955
|
+
id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
956
|
+
version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
957
|
+
createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
958
|
+
updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
|
|
959
|
+
organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
|
|
960
|
+
amount: _$alepha.TInteger;
|
|
961
|
+
currency: _$alepha.TString;
|
|
962
|
+
status: _$alepha.TUnsafe<"created" | "processing" | "authorized" | "captured" | "voided" | "failed" | "cancelled" | "refunded" | "expired">;
|
|
963
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
964
|
+
providerRaw: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
965
|
+
metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
|
|
966
|
+
paymentMethodId: _$alepha.TOptional<_$alepha.TString>;
|
|
967
|
+
userId: _$alepha.TOptional<_$alepha.TString>;
|
|
968
|
+
}>;
|
|
969
|
+
type IntentResource = Static<typeof intentResourceSchema>;
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region ../../src/billing/schemas/paymentMethodSchemas.d.ts
|
|
972
|
+
declare const addPaymentMethodSchema: _$alepha.TObject<{
|
|
973
|
+
token: _$alepha.TString;
|
|
974
|
+
}>;
|
|
975
|
+
type AddPaymentMethod = Static<typeof addPaymentMethodSchema>;
|
|
976
|
+
declare const paymentMethodResourceSchema: _$alepha.TObject<{
|
|
977
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
978
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
979
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
980
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
981
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
982
|
+
userId: _$alepha.TString;
|
|
983
|
+
type: _$alepha.TString;
|
|
984
|
+
brand: _$alepha.TOptional<_$alepha.TString>;
|
|
985
|
+
last4: _$alepha.TOptional<_$alepha.TString>;
|
|
986
|
+
expMonth: _$alepha.TOptional<_$alepha.TInteger>;
|
|
987
|
+
expYear: _$alepha.TOptional<_$alepha.TInteger>;
|
|
988
|
+
isDefault: _$alepha.TBoolean;
|
|
989
|
+
providerRef: _$alepha.TString;
|
|
990
|
+
}>;
|
|
991
|
+
type PaymentMethodResource = Static<typeof paymentMethodResourceSchema>;
|
|
992
|
+
//#endregion
|
|
993
|
+
//#region ../../src/billing/schemas/refundSchemas.d.ts
|
|
994
|
+
declare const refundResourceSchema: _$alepha.TObject<{
|
|
995
|
+
id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
996
|
+
version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
997
|
+
createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
998
|
+
updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
999
|
+
organizationId: PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof PG_ORGANIZATION>;
|
|
1000
|
+
intentId: _$alepha.TString;
|
|
1001
|
+
amount: _$alepha.TInteger;
|
|
1002
|
+
currency: _$alepha.TString;
|
|
1003
|
+
status: _$alepha.TUnsafe<"processing" | "failed" | "pending" | "completed">;
|
|
1004
|
+
reason: _$alepha.TOptional<_$alepha.TString>;
|
|
1005
|
+
providerRef: _$alepha.TOptional<_$alepha.TString>;
|
|
1006
|
+
}>;
|
|
1007
|
+
type RefundResource = Static<typeof refundResourceSchema>;
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region ../../src/billing/index.d.ts
|
|
1010
|
+
declare module "alepha" {
|
|
1011
|
+
interface Hooks {
|
|
1012
|
+
"billing:authorized": {
|
|
1013
|
+
intentId: string;
|
|
1014
|
+
amount: number;
|
|
1015
|
+
currency: string;
|
|
1016
|
+
metadata?: unknown;
|
|
1017
|
+
};
|
|
1018
|
+
"billing:captured": {
|
|
1019
|
+
intentId: string;
|
|
1020
|
+
amount: number;
|
|
1021
|
+
currency: string;
|
|
1022
|
+
metadata?: unknown;
|
|
1023
|
+
};
|
|
1024
|
+
"billing:failed": {
|
|
1025
|
+
intentId: string;
|
|
1026
|
+
amount: number;
|
|
1027
|
+
currency: string;
|
|
1028
|
+
metadata?: unknown;
|
|
1029
|
+
};
|
|
1030
|
+
"billing:voided": {
|
|
1031
|
+
intentId: string;
|
|
1032
|
+
amount: number;
|
|
1033
|
+
currency: string;
|
|
1034
|
+
metadata?: unknown;
|
|
1035
|
+
};
|
|
1036
|
+
"billing:refunded": {
|
|
1037
|
+
intentId: string;
|
|
1038
|
+
refundId: string;
|
|
1039
|
+
amount: number;
|
|
1040
|
+
currency: string;
|
|
1041
|
+
metadata?: unknown;
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
declare const AlephaBilling: _$alepha.Service<_$alepha.Module>;
|
|
1046
|
+
//#endregion
|
|
1047
|
+
export { AddPaymentMethod, AdminBillingController, AlephaBilling, BillingController, BillingError, BillingProvider, BillingService, CaptureIntent, CheckoutResponse, CreateCheckout, CreateIntent, CreatePaymentMethodResult, CreateSessionResult, IntentQuery, IntentResource, MemoryBillingProvider, PaymentIntentEntity, PaymentMethodEntity, PaymentMethodResource, PaymentMethodService, RecordCash, RefundEntity, RefundIntent, RefundResource, RefundResult, WebhookEvent, addPaymentMethodSchema, captureIntentSchema, checkoutResponseSchema, createCheckoutSchema, createIntentSchema, intentQuerySchema, intentResourceSchema, paymentIntents, paymentMethodResourceSchema, paymentMethods, recordCashSchema, refundIntentSchema, refundResourceSchema, refunds };
|
|
1048
|
+
//# sourceMappingURL=index.d.ts.map
|