alepha 0.15.1 → 0.15.3
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 +68 -80
- package/dist/api/audits/index.d.ts +10 -33
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +10 -33
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +10 -3
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +10 -3
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +162 -155
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +10 -3
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +413 -0
- package/dist/api/keys/index.d.ts.map +1 -0
- package/dist/api/keys/index.js +476 -0
- package/dist/api/keys/index.js.map +1 -0
- package/dist/api/notifications/index.d.ts +10 -4
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +10 -4
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +43 -50
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +30 -37
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.d.ts +1081 -760
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +2539 -218
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +138 -132
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +12 -4
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/batch/index.d.ts +20 -40
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +31 -44
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +440 -8
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +1861 -12
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/core/index.d.ts +179 -7
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +213 -7
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +1 -0
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +4 -0
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +638 -5645
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2550 -368
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +203 -45
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +2060 -71
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +70 -40
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +34 -13
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +90 -40
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +70 -40
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts +15 -0
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +15 -0
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +323 -20
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +1857 -7
- package/dist/email/index.js.map +1 -1
- package/dist/fake/index.d.ts +90 -8
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +91 -20
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +11 -4
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +11 -4
- package/dist/lock/core/index.js.map +1 -1
- package/dist/logger/index.d.ts +17 -66
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +14 -63
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +10 -30
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +12 -35
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +3 -3
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +39 -20
- package/dist/orm/index.bun.js.map +1 -1
- package/dist/orm/index.d.ts +517 -540
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +58 -71
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +18 -10
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +14 -6
- package/dist/queue/core/index.js.map +1 -1
- package/dist/react/auth/index.browser.js +108 -0
- package/dist/react/auth/index.browser.js.map +1 -0
- package/dist/react/auth/index.d.ts +100 -0
- package/dist/react/auth/index.d.ts.map +1 -0
- package/dist/react/auth/index.js +145 -0
- package/dist/react/auth/index.js.map +1 -0
- package/dist/react/core/index.d.ts +469 -0
- package/dist/react/core/index.d.ts.map +1 -0
- package/dist/react/core/index.js +464 -0
- package/dist/react/core/index.js.map +1 -0
- package/dist/react/form/index.d.ts +232 -0
- package/dist/react/form/index.d.ts.map +1 -0
- package/dist/react/form/index.js +432 -0
- package/dist/react/form/index.js.map +1 -0
- package/dist/react/head/index.browser.js +423 -0
- package/dist/react/head/index.browser.js.map +1 -0
- package/dist/react/head/index.d.ts +288 -0
- package/dist/react/head/index.d.ts.map +1 -0
- package/dist/react/head/index.js +465 -0
- package/dist/react/head/index.js.map +1 -0
- package/dist/react/i18n/index.d.ts +175 -0
- package/dist/react/i18n/index.d.ts.map +1 -0
- package/dist/react/i18n/index.js +224 -0
- package/dist/react/i18n/index.js.map +1 -0
- package/dist/react/router/index.browser.js +1974 -0
- package/dist/react/router/index.browser.js.map +1 -0
- package/dist/react/router/index.d.ts +1956 -0
- package/dist/react/router/index.d.ts.map +1 -0
- package/dist/react/router/index.js +4722 -0
- package/dist/react/router/index.js.map +1 -0
- package/dist/react/websocket/index.d.ts +117 -0
- package/dist/react/websocket/index.d.ts.map +1 -0
- package/dist/react/websocket/index.js +107 -0
- package/dist/react/websocket/index.js.map +1 -0
- package/dist/redis/index.bun.js +4 -0
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +41 -44
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +16 -25
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +11 -2
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js +11 -2
- package/dist/retry/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +11 -2
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +11 -2
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +140 -49
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +164 -32
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +12 -7
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +12 -7
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +7 -22
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +7 -22
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts +10 -2
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/compress/index.js +10 -2
- package/dist/server/compress/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts +40 -16
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +7 -5
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.d.ts +124 -23
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +231 -14
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +13 -23
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +7 -21
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/health/index.d.ts +8 -2
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +8 -2
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/helmet/index.d.ts +11 -3
- package/dist/server/helmet/index.d.ts.map +1 -1
- package/dist/server/helmet/index.js +11 -3
- package/dist/server/helmet/index.js.map +1 -1
- package/dist/server/links/index.d.ts +11 -6
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +11 -6
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +10 -3
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +10 -3
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/multipart/index.d.ts +9 -3
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/multipart/index.js +9 -3
- package/dist/server/multipart/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +8 -2
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js +8 -2
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +30 -35
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +18 -55
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +137 -4
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js +1853 -5
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +309 -6
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +1854 -6
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +309 -7
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +1856 -7
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js +1218 -0
- package/dist/system/index.browser.js.map +1 -0
- package/dist/{file → system}/index.d.ts +343 -16
- package/dist/system/index.d.ts.map +1 -0
- package/dist/{file → system}/index.js +419 -22
- package/dist/system/index.js.map +1 -0
- package/dist/thread/index.d.ts +11 -2
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +11 -2
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.d.ts +12 -5
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +12 -5
- package/dist/topic/core/index.js.map +1 -1
- package/dist/vite/index.d.ts +5 -6272
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +23 -10
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.d.ts +12 -8
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +12 -8
- package/dist/websocket/index.js.map +1 -1
- package/package.json +82 -11
- package/src/api/audits/index.ts +10 -33
- package/src/api/files/__tests__/$bucket.spec.ts +1 -1
- package/src/api/files/controllers/AdminFileStatsController.spec.ts +1 -1
- package/src/api/files/controllers/FileController.spec.ts +1 -1
- package/src/api/files/index.ts +10 -3
- package/src/api/files/jobs/FileJobs.spec.ts +1 -1
- package/src/api/files/services/FileService.spec.ts +1 -1
- package/src/api/jobs/index.ts +10 -3
- package/src/api/keys/controllers/AdminApiKeyController.ts +75 -0
- package/src/api/keys/controllers/ApiKeyController.ts +103 -0
- package/src/api/keys/entities/apiKeyEntity.ts +41 -0
- package/src/api/keys/index.ts +49 -0
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +7 -0
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +17 -0
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +7 -0
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +11 -0
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +15 -0
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +5 -0
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +5 -0
- package/src/api/keys/services/ApiKeyService.spec.ts +553 -0
- package/src/api/keys/services/ApiKeyService.ts +306 -0
- package/src/api/logs/TODO.md +55 -0
- package/src/api/notifications/index.ts +10 -4
- package/src/api/parameters/index.ts +9 -30
- package/src/api/parameters/primitives/$config.ts +12 -4
- package/src/api/parameters/services/ConfigStore.ts +9 -3
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +1035 -0
- package/src/api/users/__tests__/ApiKeys.spec.ts +401 -0
- package/src/api/users/index.ts +14 -3
- package/src/api/users/primitives/$realm.ts +33 -5
- package/src/api/users/providers/RealmProvider.ts +1 -12
- package/src/api/users/services/SessionService.ts +1 -1
- package/src/api/verifications/controllers/VerificationController.ts +2 -0
- package/src/api/verifications/index.ts +10 -4
- package/src/batch/index.ts +9 -36
- package/src/batch/primitives/$batch.ts +0 -8
- package/src/batch/providers/BatchProvider.ts +29 -2
- package/src/bucket/__tests__/shared.ts +1 -1
- package/src/bucket/index.ts +13 -6
- package/src/bucket/primitives/$bucket.ts +1 -1
- package/src/bucket/providers/LocalFileStorageProvider.ts +1 -1
- package/src/bucket/providers/MemoryFileStorageProvider.ts +1 -1
- package/src/cache/core/__tests__/shared.ts +30 -0
- package/src/cache/core/index.ts +11 -6
- package/src/cache/core/primitives/$cache.spec.ts +5 -0
- package/src/cache/core/providers/CacheProvider.ts +17 -0
- package/src/cache/core/providers/MemoryCacheProvider.ts +300 -1
- package/src/cache/redis/__tests__/cache-redis.spec.ts +5 -0
- package/src/cache/redis/providers/RedisCacheProvider.ts +9 -0
- package/src/cli/apps/AlephaCli.ts +1 -14
- package/src/cli/apps/AlephaPackageBuilderCli.ts +10 -1
- package/src/cli/atoms/buildOptions.ts +99 -9
- package/src/cli/commands/build.ts +150 -37
- package/src/cli/commands/db.ts +22 -18
- package/src/cli/commands/deploy.ts +1 -1
- package/src/cli/commands/dev.ts +1 -20
- package/src/cli/commands/gen/env.ts +5 -2
- package/src/cli/commands/gen/openapi.ts +5 -2
- package/src/cli/commands/init.spec.ts +588 -0
- package/src/cli/commands/init.ts +115 -58
- package/src/cli/commands/lint.ts +7 -1
- package/src/cli/commands/typecheck.ts +11 -0
- package/src/cli/providers/AppEntryProvider.ts +1 -1
- package/src/cli/providers/ViteBuildProvider.ts +8 -50
- package/src/cli/providers/ViteDevServerProvider.ts +35 -16
- package/src/cli/services/AlephaCliUtils.ts +52 -121
- package/src/cli/services/PackageManagerUtils.ts +129 -11
- package/src/cli/services/ProjectScaffolder.spec.ts +97 -0
- package/src/cli/services/ProjectScaffolder.ts +148 -81
- package/src/cli/services/ViteUtils.ts +82 -0
- package/src/cli/{assets/claudeMd.ts → templates/agentMd.ts} +37 -24
- package/src/cli/templates/apiAppSecurityTs.ts +11 -0
- package/src/cli/templates/apiIndexTs.ts +30 -0
- package/src/cli/templates/gitignore.ts +39 -0
- package/src/cli/{assets → templates}/mainCss.ts +11 -2
- package/src/cli/templates/mainServerTs.ts +33 -0
- package/src/cli/templates/webAppRouterTs.ts +74 -0
- package/src/cli/templates/webHelloComponentTsx.ts +30 -0
- package/src/command/helpers/Runner.spec.ts +139 -0
- package/src/command/helpers/Runner.ts +7 -22
- package/src/command/index.ts +12 -4
- package/src/command/providers/CliProvider.spec.ts +1392 -0
- package/src/command/providers/CliProvider.ts +320 -47
- package/src/core/Alepha.ts +34 -27
- package/src/core/__tests__/Alepha-start.spec.ts +4 -4
- package/src/core/helpers/jsonSchemaToTypeBox.spec.ts +771 -0
- package/src/core/helpers/jsonSchemaToTypeBox.ts +62 -10
- package/src/core/index.shared.ts +1 -0
- package/src/core/index.ts +20 -0
- package/src/core/providers/EventManager.spec.ts +0 -71
- package/src/core/providers/EventManager.ts +3 -15
- package/src/core/providers/Json.ts +2 -14
- package/src/datetime/index.ts +15 -0
- package/src/email/index.ts +10 -5
- package/src/email/providers/LocalEmailProvider.spec.ts +1 -1
- package/src/email/providers/LocalEmailProvider.ts +1 -1
- package/src/fake/__tests__/keyName.example.ts +1 -1
- package/src/fake/__tests__/keyName.spec.ts +5 -5
- package/src/fake/index.ts +9 -6
- package/src/fake/providers/FakeProvider.spec.ts +258 -40
- package/src/fake/providers/FakeProvider.ts +133 -19
- package/src/lock/core/index.ts +11 -4
- package/src/logger/index.ts +17 -66
- package/src/mcp/index.ts +10 -27
- package/src/mcp/transports/SseMcpTransport.ts +0 -11
- package/src/orm/__tests__/PostgresProvider.spec.ts +2 -2
- package/src/orm/index.browser.ts +2 -2
- package/src/orm/index.bun.ts +5 -3
- package/src/orm/index.ts +23 -53
- package/src/orm/providers/drivers/BunSqliteProvider.ts +5 -1
- package/src/orm/providers/drivers/CloudflareD1Provider.ts +57 -30
- package/src/orm/providers/drivers/DatabaseProvider.ts +9 -1
- package/src/orm/providers/drivers/NodeSqliteProvider.ts +4 -1
- package/src/orm/services/Repository.ts +7 -3
- package/src/queue/core/index.ts +14 -6
- package/src/react/auth/__tests__/$auth.spec.ts +202 -0
- package/src/react/auth/hooks/useAuth.ts +32 -0
- package/src/react/auth/index.browser.ts +13 -0
- package/src/react/auth/index.shared.ts +2 -0
- package/src/react/auth/index.ts +48 -0
- package/src/react/auth/providers/ReactAuthProvider.ts +16 -0
- package/src/react/auth/services/ReactAuth.ts +135 -0
- package/src/react/core/__tests__/Router.spec.tsx +169 -0
- package/src/react/core/components/ClientOnly.tsx +49 -0
- package/src/react/core/components/ErrorBoundary.tsx +73 -0
- package/src/react/core/contexts/AlephaContext.ts +7 -0
- package/src/react/core/contexts/AlephaProvider.tsx +42 -0
- package/src/react/core/hooks/useAction.browser.spec.tsx +569 -0
- package/src/react/core/hooks/useAction.ts +480 -0
- package/src/react/core/hooks/useAlepha.ts +26 -0
- package/src/react/core/hooks/useClient.ts +17 -0
- package/src/react/core/hooks/useEvents.ts +51 -0
- package/src/react/core/hooks/useInject.ts +12 -0
- package/src/react/core/hooks/useStore.ts +52 -0
- package/src/react/core/index.ts +90 -0
- package/src/react/form/components/FormState.tsx +17 -0
- package/src/react/form/errors/FormValidationError.ts +18 -0
- package/src/react/form/hooks/useForm.browser.spec.tsx +366 -0
- package/src/react/form/hooks/useForm.ts +47 -0
- package/src/react/form/hooks/useFormState.ts +130 -0
- package/src/react/form/index.ts +44 -0
- package/src/react/form/services/FormModel.ts +614 -0
- package/src/react/head/helpers/SeoExpander.spec.ts +203 -0
- package/src/react/head/helpers/SeoExpander.ts +142 -0
- package/src/react/head/hooks/useHead.spec.tsx +288 -0
- package/src/react/head/hooks/useHead.ts +62 -0
- package/src/react/head/index.browser.ts +26 -0
- package/src/react/head/index.ts +44 -0
- package/src/react/head/interfaces/Head.ts +105 -0
- package/src/react/head/primitives/$head.ts +25 -0
- package/src/react/head/providers/BrowserHeadProvider.browser.spec.ts +196 -0
- package/src/react/head/providers/BrowserHeadProvider.ts +212 -0
- package/src/react/head/providers/HeadProvider.ts +168 -0
- package/src/react/head/providers/ServerHeadProvider.ts +31 -0
- package/src/react/i18n/__tests__/integration.spec.tsx +239 -0
- package/src/react/i18n/components/Localize.spec.tsx +357 -0
- package/src/react/i18n/components/Localize.tsx +35 -0
- package/src/react/i18n/hooks/useI18n.browser.spec.tsx +438 -0
- package/src/react/i18n/hooks/useI18n.ts +18 -0
- package/src/react/i18n/index.ts +41 -0
- package/src/react/i18n/primitives/$dictionary.ts +69 -0
- package/src/react/i18n/providers/I18nProvider.spec.ts +389 -0
- package/src/react/i18n/providers/I18nProvider.ts +278 -0
- package/src/react/router/__tests__/page-head-browser.browser.spec.ts +95 -0
- package/src/react/router/__tests__/page-head.spec.ts +48 -0
- package/src/react/router/__tests__/seo-head.spec.ts +125 -0
- package/src/react/router/atoms/ssrManifestAtom.ts +58 -0
- package/src/react/router/components/ErrorViewer.tsx +872 -0
- package/src/react/router/components/Link.tsx +23 -0
- package/src/react/router/components/NestedView.tsx +223 -0
- package/src/react/router/components/NotFound.tsx +30 -0
- package/src/react/router/constants/PAGE_PRELOAD_KEY.ts +6 -0
- package/src/react/router/contexts/RouterLayerContext.ts +12 -0
- package/src/react/router/errors/Redirection.ts +28 -0
- package/src/react/router/hooks/useActive.ts +52 -0
- package/src/react/router/hooks/useQueryParams.ts +63 -0
- package/src/react/router/hooks/useRouter.ts +20 -0
- package/src/react/router/hooks/useRouterState.ts +11 -0
- package/src/react/router/index.browser.ts +45 -0
- package/src/react/router/index.shared.ts +19 -0
- package/src/react/router/index.ts +146 -0
- package/src/react/router/primitives/$page.browser.spec.tsx +851 -0
- package/src/react/router/primitives/$page.spec.tsx +676 -0
- package/src/react/router/primitives/$page.ts +489 -0
- package/src/react/router/providers/ReactBrowserProvider.ts +312 -0
- package/src/react/router/providers/ReactBrowserRendererProvider.ts +25 -0
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +168 -0
- package/src/react/router/providers/ReactPageProvider.ts +726 -0
- package/src/react/router/providers/ReactPreloadProvider.spec.ts +142 -0
- package/src/react/router/providers/ReactPreloadProvider.ts +85 -0
- package/src/react/router/providers/ReactServerProvider.spec.tsx +316 -0
- package/src/react/router/providers/ReactServerProvider.ts +487 -0
- package/src/react/router/providers/ReactServerTemplateProvider.spec.ts +210 -0
- package/src/react/router/providers/ReactServerTemplateProvider.ts +542 -0
- package/src/react/router/providers/SSRManifestProvider.ts +334 -0
- package/src/react/router/services/ReactPageServerService.ts +48 -0
- package/src/react/router/services/ReactPageService.ts +27 -0
- package/src/react/router/services/ReactRouter.ts +262 -0
- package/src/react/websocket/hooks/useRoom.tsx +242 -0
- package/src/react/websocket/index.ts +7 -0
- package/src/redis/__tests__/redis.spec.ts +13 -0
- package/src/redis/index.ts +9 -25
- package/src/redis/providers/BunRedisProvider.ts +9 -0
- package/src/redis/providers/NodeRedisProvider.ts +8 -0
- package/src/redis/providers/RedisProvider.ts +16 -0
- package/src/retry/index.ts +11 -2
- package/src/router/index.ts +15 -0
- package/src/scheduler/index.ts +11 -2
- package/src/security/__tests__/BasicAuth.spec.ts +2 -0
- package/src/security/__tests__/ServerSecurityProvider.spec.ts +90 -5
- package/src/security/index.ts +15 -10
- package/src/security/interfaces/IssuerResolver.ts +27 -0
- package/src/security/primitives/$issuer.ts +55 -0
- package/src/security/providers/SecurityProvider.ts +179 -0
- package/src/security/providers/ServerBasicAuthProvider.ts +6 -2
- package/src/security/providers/ServerSecurityProvider.ts +63 -41
- package/src/server/auth/index.ts +12 -7
- package/src/server/cache/index.ts +7 -22
- package/src/server/compress/index.ts +10 -2
- package/src/server/cookies/index.ts +7 -5
- package/src/server/cookies/primitives/$cookie.ts +33 -11
- package/src/server/core/index.ts +16 -6
- package/src/server/core/interfaces/ServerRequest.ts +83 -1
- package/src/server/core/primitives/$action.spec.ts +1 -1
- package/src/server/core/primitives/$action.ts +8 -3
- package/src/server/core/providers/NodeHttpServerProvider.spec.ts +9 -3
- package/src/server/core/providers/NodeHttpServerProvider.ts +9 -3
- package/src/server/core/services/ServerRequestParser.spec.ts +520 -0
- package/src/server/core/services/ServerRequestParser.ts +306 -13
- package/src/server/cors/index.ts +7 -21
- package/src/server/cors/primitives/$cors.ts +6 -2
- package/src/server/health/index.ts +8 -2
- package/src/server/helmet/index.ts +11 -3
- package/src/server/links/index.ts +11 -6
- package/src/server/metrics/index.ts +10 -3
- package/src/server/multipart/index.ts +9 -3
- package/src/server/proxy/index.ts +8 -2
- package/src/server/rate-limit/index.ts +21 -25
- package/src/server/rate-limit/primitives/$rateLimit.ts +6 -2
- package/src/server/rate-limit/providers/ServerRateLimitProvider.spec.ts +38 -14
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +22 -56
- package/src/server/static/index.ts +8 -2
- package/src/server/static/providers/ServerStaticProvider.ts +1 -1
- package/src/server/swagger/index.ts +9 -4
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +1 -1
- package/src/sms/index.ts +9 -5
- package/src/sms/providers/LocalSmsProvider.spec.ts +1 -1
- package/src/sms/providers/LocalSmsProvider.ts +1 -1
- package/src/system/index.browser.ts +36 -0
- package/src/system/index.ts +62 -0
- package/src/system/index.workerd.ts +1 -0
- package/src/{file → system}/providers/FileSystemProvider.ts +24 -0
- package/src/{file → system}/providers/MemoryFileSystemProvider.ts +116 -3
- package/src/system/providers/MemoryShellProvider.ts +164 -0
- package/src/{file → system}/providers/NodeFileSystemProvider.spec.ts +2 -2
- package/src/{file → system}/providers/NodeFileSystemProvider.ts +47 -2
- package/src/system/providers/NodeShellProvider.ts +184 -0
- package/src/system/providers/ShellProvider.ts +74 -0
- package/src/{file → system}/services/FileDetector.spec.ts +2 -2
- package/src/thread/index.ts +11 -2
- package/src/topic/core/index.ts +12 -5
- package/src/vite/tasks/buildClient.ts +2 -7
- package/src/vite/tasks/buildServer.ts +19 -13
- package/src/vite/tasks/generateCloudflare.ts +10 -7
- package/src/vite/tasks/generateDocker.ts +4 -0
- package/src/websocket/index.ts +12 -8
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js.map +0 -1
- package/src/cli/assets/apiIndexTs.ts +0 -16
- package/src/cli/assets/mainServerTs.ts +0 -24
- package/src/cli/assets/webAppRouterTs.ts +0 -16
- package/src/cli/assets/webHelloComponentTsx.ts +0 -20
- package/src/cli/providers/ViteTemplateProvider.ts +0 -27
- package/src/file/index.ts +0 -43
- /package/src/cli/{assets → templates}/apiHelloControllerTs.ts +0 -0
- /package/src/cli/{assets → templates}/biomeJson.ts +0 -0
- /package/src/cli/{assets → templates}/dummySpecTs.ts +0 -0
- /package/src/cli/{assets → templates}/editorconfig.ts +0 -0
- /package/src/cli/{assets → templates}/mainBrowserTs.ts +0 -0
- /package/src/cli/{assets → templates}/tsconfigJson.ts +0 -0
- /package/src/cli/{assets → templates}/webIndexTs.ts +0 -0
- /package/src/{file → system}/errors/FileError.ts +0 -0
- /package/src/{file → system}/services/FileDetector.ts +0 -0
package/dist/datetime/index.d.ts
CHANGED
|
@@ -144,6 +144,21 @@ declare class IntervalPrimitive extends Primitive<IntervalPrimitiveOptions> {
|
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region ../../src/datetime/index.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* | type | quality | stability |
|
|
149
|
+
* |------|---------|-----------|
|
|
150
|
+
* | tooling | standard | stable |
|
|
151
|
+
*
|
|
152
|
+
* Date and time operations.
|
|
153
|
+
*
|
|
154
|
+
* **Features:**
|
|
155
|
+
* - Recurring interval definitions
|
|
156
|
+
* - Duration parsing (ISO 8601, human-readable)
|
|
157
|
+
* - Timezone support
|
|
158
|
+
* - Dayjs integration
|
|
159
|
+
*
|
|
160
|
+
* @module alepha.datetime
|
|
161
|
+
*/
|
|
147
162
|
declare const AlephaDateTime: alepha1.Service<alepha1.Module>;
|
|
148
163
|
//#endregion
|
|
149
164
|
export { $interval, AlephaDateTime, DateTime, DateTimeProvider, Duration, DurationLike, Interval, IntervalPrimitive, IntervalPrimitiveOptions, Timeout, dayjs, isDateTime };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/datetime/providers/DateTimeProvider.ts","../../src/datetime/primitives/$interval.ts","../../src/datetime/index.ts"],"mappings":";;;;;;;;;;;;KAmBY,QAAA,GAAW,QAAA,CAAS,KAAA;AAAA,KACpB,QAAA,GAAW,aAAA,CAAc,QAAA;AAAA,KACzB,YAAA,YAER,aAAA,CAAc,QAAA,YACL,cAAA;AAAA,cAEA,KAAA,SAAK,QAAA;AAAA,cACL,UAAA,GAAc,KAAA,cAAiB,KAAA,IAAS,QAAA;AAAA,cAIxC,gBAAA;EAAA,OACG,OAAA,EAAS,KAAA,CAAM,UAAA;EAAA,UAQnB,MAAA,EAAM,MAAA;EAAA,UACN,GAAA,EAAK,QAAA;EAAA,mBACI,QAAA,EAAU,OAAA;EAAA,mBACV,SAAA,EAAW,QAAA;;qBAQX,OAAA,EARmB,OAAA,CAQZ,aAAA;EAAA,mBAgBP,MAAA,EAhBO,OAAA,CAgBD,aAAA;EAelB,SAAA,CAAU,MAAA;EAIV,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,QAAA;EA/D1C;;;EAsEK,GAAA,CACL,IAAA,oBAAwB,IAAA,GAAO,KAAA,sBAC9B,QAAA;EAvEsB;AAE3B;;EA4ES,EAAA,CAAG,IAAA,oBAAwB,IAAA,GAAO,KAAA,sBAA2B,QAAA;EA5EpD;;AAClB;EAkFS,WAAA,CAAY,IAAA,GAAM,IAAA,YAAgB,QAAA;;;;EAOlC,GAAA,CAAA,GAAO,QAAA;EAzFqC;;;AAIrD;;EA8FS,YAAA,CAAA;EA7FsB;;;;;EAyGtB,SAAA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,MAAA;EAAA,UAEG,MAAA,CAAA;AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/datetime/providers/DateTimeProvider.ts","../../src/datetime/primitives/$interval.ts","../../src/datetime/index.ts"],"mappings":";;;;;;;;;;;;KAmBY,QAAA,GAAW,QAAA,CAAS,KAAA;AAAA,KACpB,QAAA,GAAW,aAAA,CAAc,QAAA;AAAA,KACzB,YAAA,YAER,aAAA,CAAc,QAAA,YACL,cAAA;AAAA,cAEA,KAAA,SAAK,QAAA;AAAA,cACL,UAAA,GAAc,KAAA,cAAiB,KAAA,IAAS,QAAA;AAAA,cAIxC,gBAAA;EAAA,OACG,OAAA,EAAS,KAAA,CAAM,UAAA;EAAA,UAQnB,MAAA,EAAM,MAAA;EAAA,UACN,GAAA,EAAK,QAAA;EAAA,mBACI,QAAA,EAAU,OAAA;EAAA,mBACV,SAAA,EAAW,QAAA;;qBAQX,OAAA,EARmB,OAAA,CAQZ,aAAA;EAAA,mBAgBP,MAAA,EAhBO,OAAA,CAgBD,aAAA;EAelB,SAAA,CAAU,MAAA;EAIV,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,QAAA;EA/D1C;;;EAsEK,GAAA,CACL,IAAA,oBAAwB,IAAA,GAAO,KAAA,sBAC9B,QAAA;EAvEsB;AAE3B;;EA4ES,EAAA,CAAG,IAAA,oBAAwB,IAAA,GAAO,KAAA,sBAA2B,QAAA;EA5EpD;;AAClB;EAkFS,WAAA,CAAY,IAAA,GAAM,IAAA,YAAgB,QAAA;;;;EAOlC,GAAA,CAAA,GAAO,QAAA;EAzFqC;;;AAIrD;;EA8FS,YAAA,CAAA;EA7FsB;;;;;EAyGtB,SAAA,CAAA;EA9F+B;;;;;EAAA,UA0G5B,cAAA,CAAA,GAAkB,QAAA;EA/CM;;;EA0D3B,QAAA,GACL,QAAA,EAAU,YAAA,EACV,IAAA,GAAO,cAAA,KACN,QAAA;EAYI,cAAA,CAAe,KAAA,YAAiB,KAAA,IAA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KIND] = IntervalPrimitive;
|
|
|
269
269
|
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region ../../src/datetime/index.ts
|
|
272
|
+
/**
|
|
273
|
+
* | type | quality | stability |
|
|
274
|
+
* |------|---------|-----------|
|
|
275
|
+
* | tooling | standard | stable |
|
|
276
|
+
*
|
|
277
|
+
* Date and time operations.
|
|
278
|
+
*
|
|
279
|
+
* **Features:**
|
|
280
|
+
* - Recurring interval definitions
|
|
281
|
+
* - Duration parsing (ISO 8601, human-readable)
|
|
282
|
+
* - Timezone support
|
|
283
|
+
* - Dayjs integration
|
|
284
|
+
*
|
|
285
|
+
* @module alepha.datetime
|
|
286
|
+
*/
|
|
272
287
|
const AlephaDateTime = $module({
|
|
273
288
|
name: "alepha.datetime",
|
|
274
289
|
primitives: [$interval],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/datetime/providers/DateTimeProvider.ts","../../src/datetime/primitives/$interval.ts","../../src/datetime/index.ts"],"sourcesContent":["import \"dayjs/plugin/relativeTime.js\";\nimport \"dayjs/plugin/duration.js\";\nimport \"dayjs/plugin/utc.js\";\nimport \"dayjs/plugin/timezone.js\";\nimport \"dayjs/plugin/localizedFormat.js\";\nimport \"dayjs/locale/ar.js\";\nimport \"dayjs/locale/fr.js\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport DayjsApi, {\n type Dayjs,\n type ManipulateType,\n type PluginFunc,\n} from \"dayjs\";\nimport dayjsDuration from \"dayjs/plugin/duration.js\";\nimport dayjsLocalizedFormat from \"dayjs/plugin/localizedFormat.js\";\nimport dayjsRelativeTime from \"dayjs/plugin/relativeTime.js\";\nimport dayjsTimezone from \"dayjs/plugin/timezone.js\";\nimport dayjsUtc from \"dayjs/plugin/utc.js\";\n\nexport type DateTime = DayjsApi.Dayjs;\nexport type Duration = dayjsDuration.Duration;\nexport type DurationLike =\n | number\n | dayjsDuration.Duration\n | [number, ManipulateType];\n\nexport const dayjs = DayjsApi;\nexport const isDateTime = (value: unknown): value is DateTime => {\n return dayjs.isDayjs(value);\n};\n\nexport class DateTimeProvider {\n public static PLUGINS: Array<PluginFunc<any>> = [\n dayjsDuration,\n dayjsRelativeTime,\n dayjsUtc,\n dayjsTimezone,\n dayjsLocalizedFormat,\n ];\n\n protected alepha = $inject(Alepha);\n protected ref: DateTime | null = null;\n protected readonly timeouts: Timeout[] = [];\n protected readonly intervals: Interval[] = [];\n\n constructor() {\n for (const plugin of DateTimeProvider.PLUGINS) {\n dayjs.extend(plugin);\n }\n }\n\n protected readonly onStart = $hook({\n on: \"start\",\n handler: async () => {\n // we start intervals now but first tick will be rejected as App is not ready yet\n await Promise.all(\n this.intervals.map(async (interval) => {\n if (interval.timer != null) {\n return;\n }\n await interval.run();\n interval.timer = setInterval(interval.run, interval.duration);\n }),\n );\n },\n });\n\n protected readonly onStop = $hook({\n on: \"stop\",\n handler: () => {\n for (const timeout of this.timeouts) {\n this.clearTimeout(timeout);\n }\n\n for (const interval of this.intervals) {\n clearInterval(interval.timer);\n interval.duration = 0;\n interval.timer = null;\n }\n },\n });\n\n public setLocale(locale: string): void {\n dayjs.locale(locale);\n }\n\n public isDateTime(value: unknown): value is DateTime {\n return dayjs.isDayjs(value);\n }\n\n /**\n * Create a new UTC DateTime instance.\n */\n public utc(\n date: string | number | Date | Dayjs | null | undefined,\n ): DateTime {\n return dayjs.utc(date);\n }\n\n /**\n * Create a new DateTime instance.\n */\n public of(date: string | number | Date | Dayjs | null | undefined): DateTime {\n return dayjs(date);\n }\n\n /**\n * Get the current date as a string.\n */\n public toISOString(date: Date | string | DateTime = this.now()): string {\n return this.of(date).toISOString();\n }\n\n /**\n * Get the current date.\n */\n public now(): DateTime {\n return this.getCurrentDate();\n }\n\n /**\n * Get the current date as a string.\n *\n * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.\n */\n public nowISOString(): string {\n if (this.ref) {\n return this.ref.toISOString();\n }\n return new Date().toISOString();\n }\n\n /**\n * Get the current date as milliseconds since epoch.\n *\n * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.\n */\n public nowMillis(): number {\n if (this.ref) {\n return this.ref.valueOf();\n }\n return Date.now();\n }\n\n /**\n * Get the current date as a string.\n *\n * @protected\n */\n protected getCurrentDate(): DateTime {\n if (this.ref) {\n return this.ref;\n }\n\n return dayjs();\n }\n\n /**\n * Create a new Duration instance.\n */\n public duration = (\n duration: DurationLike,\n unit?: ManipulateType,\n ): Duration => {\n if (Array.isArray(duration)) {\n return dayjs.duration(duration[0], duration[1]);\n }\n\n if (typeof duration === \"number\") {\n return dayjs.duration(duration, unit || \"milliseconds\");\n }\n\n return duration;\n };\n\n public isDurationLike(value: unknown): value is DurationLike {\n return dayjs.isDuration(this.duration(value as DurationLike));\n }\n\n // -------------------------------------------------------------------------------------------------------------------\n\n // Timer Management\n\n /**\n * Return a promise that resolves after the next tick.\n * It uses `setTimeout` with 0 ms delay.\n */\n public async tick(): Promise<void> {\n await new Promise((resolve) => setTimeout(resolve, 0));\n }\n\n /**\n * Wait for a certain duration.\n *\n * You can clear the timeout by using the `AbortSignal` API.\n * Aborted signal will resolve the promise immediately, it does not reject it.\n */\n public wait(\n duration: DurationLike,\n options: {\n signal?: AbortSignal;\n now?: number;\n } = {},\n ): Promise<void> {\n return new Promise((resolve) => {\n let clearTimeout: any;\n let callback: any;\n\n const timeout = this.createTimeout(\n () => {\n if (options.signal && clearTimeout) {\n options.signal.removeEventListener(\"abort\", callback);\n }\n resolve();\n },\n duration,\n options.now,\n );\n\n if (options.signal) {\n clearTimeout = () => this.clearTimeout(timeout);\n callback = () => {\n clearTimeout();\n resolve();\n };\n options.signal.addEventListener(\"abort\", callback);\n }\n });\n }\n\n public createInterval(\n run: () => unknown,\n duration: DurationLike,\n start = false,\n ): Interval {\n const interval: Interval = {\n run,\n duration: this.duration(duration).asMilliseconds(),\n };\n\n this.intervals.push(interval);\n\n if (start) {\n interval.timer = setInterval(interval.run, interval.duration);\n }\n\n return interval;\n }\n\n /**\n * Run a callback after a certain duration.\n */\n public createTimeout(\n callback: () => void,\n duration: DurationLike,\n now?: number,\n ): Timeout {\n if (this.ref && now) {\n const next = this.of(now).add(this.duration(duration));\n if (next < this.now()) {\n callback();\n }\n return {\n now,\n duration: 0,\n callback: () => {},\n clear: () => {},\n };\n }\n\n const timeout: Timeout = {\n now: now ?? this.now().valueOf(),\n duration: this.duration(duration).asMilliseconds(),\n callback,\n clear: () => this.clearTimeout(timeout),\n };\n\n timeout.timer = setTimeout(() => {\n timeout.callback();\n }, timeout.duration);\n\n this.timeouts.push(timeout);\n\n return timeout;\n }\n\n public clearTimeout(timeout: Timeout): void {\n clearTimeout(timeout.timer);\n timeout.duration = 0;\n timeout.timer = null;\n }\n\n public clearInterval(interval: Interval): void {\n clearInterval(interval.timer);\n interval.duration = 0;\n interval.timer = null;\n }\n\n /**\n * Run a function with a deadline.\n */\n public async deadline<T>(\n fn: (signal: AbortSignal) => Promise<T>,\n duration: DurationLike,\n ): Promise<T> {\n const abort = new AbortController();\n const timeout = this.createTimeout(() => abort.abort(), duration);\n try {\n return await fn(abort.signal);\n } finally {\n this.clearTimeout(timeout);\n }\n }\n\n // -------------------------------------------------------------------------------------------------------------------\n\n // Testing\n\n /**\n * Add time to the current date.\n */\n public async travel(\n duration: DurationLike,\n unit?: ManipulateType,\n ): Promise<void> {\n this.ref = this.ref || this.now();\n this.ref = this.ref.add(this.duration(duration, unit));\n const ms = this.duration(duration, unit).asMilliseconds();\n const now = Date.now();\n\n for (const timeout of this.timeouts) {\n if (!timeout.timer) {\n continue;\n }\n\n clearTimeout(timeout.timer);\n timeout.timer = null;\n\n const spent = now - timeout.now;\n timeout.duration = timeout.duration - spent - ms;\n\n if (timeout.duration <= 0) {\n timeout.callback();\n } else {\n timeout.timer = setTimeout(() => {\n timeout.callback();\n }, timeout.duration);\n }\n }\n\n for (const interval of this.intervals) {\n if (!interval.timer) {\n continue;\n }\n\n clearInterval(interval.timer);\n interval.timer = null;\n\n const repeat = Math.floor(ms / interval.duration);\n for (let i = 0; i < repeat; i++) {\n await interval.run();\n }\n }\n\n await this.tick();\n }\n\n /**\n * Stop the time.\n */\n public pause(): DateTime {\n this.ref = this.ref || this.now();\n return this.ref;\n }\n\n /**\n * Reset the reference date.\n */\n public reset(): void {\n this.ref = null;\n }\n}\n\nexport interface Interval {\n timer?: any;\n duration: number;\n run: () => unknown;\n}\n\nexport interface Timeout {\n now: number;\n timer?: any;\n duration: number;\n callback: () => void;\n clear: () => void;\n}\n","import { $inject, createPrimitive, KIND, Primitive } from \"alepha\";\nimport {\n DateTimeProvider,\n type DurationLike,\n} from \"../providers/DateTimeProvider.ts\";\n\n/**\n * Run a function periodically.\n * It uses the `setInterval` internally.\n * It starts by default when the context starts and stops when the context stops.\n */\nexport const $interval = (options: IntervalPrimitiveOptions) =>\n createPrimitive(IntervalPrimitive, options);\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface IntervalPrimitiveOptions {\n /**\n * The interval handler.\n */\n handler: () => unknown;\n\n /**\n * The interval duration.\n */\n duration: DurationLike;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport class IntervalPrimitive extends Primitive<IntervalPrimitiveOptions> {\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n\n public called = 0;\n\n protected onInit() {\n this.dateTimeProvider.createInterval(async () => {\n await this.options.handler();\n this.called += 1;\n }, this.options.duration);\n }\n}\n\n$interval[KIND] = IntervalPrimitive;\n","import { $module } from \"alepha\";\nimport { $interval } from \"./primitives/$interval.ts\";\nimport { DateTimeProvider } from \"./providers/DateTimeProvider.ts\";\n\nexport * from \"./primitives/$interval.ts\";\nexport * from \"./providers/DateTimeProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const AlephaDateTime = $module({\n name: \"alepha.datetime\",\n primitives: [$interval],\n services: [DateTimeProvider],\n});\n"],"mappings":";;;;;;;;;;;AA0BA,MAAa,QAAQ;AACrB,MAAa,c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tB,SAAQ,UAAU;OAElB,SAAQ,QAAQ,iBAAiB;AAC/B,YAAQ,UAAU;MACjB,QAAQ,SAAS;;AAIxB,OAAK,MAAM,YAAY,KAAK,WAAW;AACrC,OAAI,CAAC,SAAS,MACZ;AAGF,iBAAc,SAAS,MAAM;AAC7B,YAAS,QAAQ;GAEjB,MAAM,SAAS,KAAK,MAAM,KAAK,SAAS,SAAS;AACjD,QAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,IAC1B,OAAM,SAAS,KAAK;;AAIxB,QAAM,KAAK,MAAM;;;;;CAMnB,AAAO,QAAkB;AACvB,OAAK,MAAM,KAAK,OAAO,KAAK,KAAK;AACjC,SAAO,KAAK;;;;;CAMd,AAAO,QAAc;AACnB,OAAK,MAAM;;;;;;;;;;;AChXf,MAAa,aAAa,YACxB,gBAAgB,mBAAmB,QAAQ;AAkB7C,IAAa,oBAAb,cAAuC,UAAoC;CACzE,AAAmB,mBAAmB,QAAQ,iBAAiB;CAE/D,AAAO,SAAS;CAEhB,AAAU,SAAS;AACjB,OAAK,iBAAiB,eAAe,YAAY;AAC/C,SAAM,KAAK,QAAQ,SAAS;AAC5B,QAAK,UAAU;KACd,KAAK,QAAQ,SAAS;;;AAI7B,UAAU,QAAQ;;;;AClClB,MAAa,iBAAiB,QAAQ;CACpC,MAAM;CACN,YAAY,CAAC,UAAU;CACvB,UAAU,CAAC,iBAAiB;CAC7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/datetime/providers/DateTimeProvider.ts","../../src/datetime/primitives/$interval.ts","../../src/datetime/index.ts"],"sourcesContent":["import \"dayjs/plugin/relativeTime.js\";\nimport \"dayjs/plugin/duration.js\";\nimport \"dayjs/plugin/utc.js\";\nimport \"dayjs/plugin/timezone.js\";\nimport \"dayjs/plugin/localizedFormat.js\";\nimport \"dayjs/locale/ar.js\";\nimport \"dayjs/locale/fr.js\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport DayjsApi, {\n type Dayjs,\n type ManipulateType,\n type PluginFunc,\n} from \"dayjs\";\nimport dayjsDuration from \"dayjs/plugin/duration.js\";\nimport dayjsLocalizedFormat from \"dayjs/plugin/localizedFormat.js\";\nimport dayjsRelativeTime from \"dayjs/plugin/relativeTime.js\";\nimport dayjsTimezone from \"dayjs/plugin/timezone.js\";\nimport dayjsUtc from \"dayjs/plugin/utc.js\";\n\nexport type DateTime = DayjsApi.Dayjs;\nexport type Duration = dayjsDuration.Duration;\nexport type DurationLike =\n | number\n | dayjsDuration.Duration\n | [number, ManipulateType];\n\nexport const dayjs = DayjsApi;\nexport const isDateTime = (value: unknown): value is DateTime => {\n return dayjs.isDayjs(value);\n};\n\nexport class DateTimeProvider {\n public static PLUGINS: Array<PluginFunc<any>> = [\n dayjsDuration,\n dayjsRelativeTime,\n dayjsUtc,\n dayjsTimezone,\n dayjsLocalizedFormat,\n ];\n\n protected alepha = $inject(Alepha);\n protected ref: DateTime | null = null;\n protected readonly timeouts: Timeout[] = [];\n protected readonly intervals: Interval[] = [];\n\n constructor() {\n for (const plugin of DateTimeProvider.PLUGINS) {\n dayjs.extend(plugin);\n }\n }\n\n protected readonly onStart = $hook({\n on: \"start\",\n handler: async () => {\n // we start intervals now but first tick will be rejected as App is not ready yet\n await Promise.all(\n this.intervals.map(async (interval) => {\n if (interval.timer != null) {\n return;\n }\n await interval.run();\n interval.timer = setInterval(interval.run, interval.duration);\n }),\n );\n },\n });\n\n protected readonly onStop = $hook({\n on: \"stop\",\n handler: () => {\n for (const timeout of this.timeouts) {\n this.clearTimeout(timeout);\n }\n\n for (const interval of this.intervals) {\n clearInterval(interval.timer);\n interval.duration = 0;\n interval.timer = null;\n }\n },\n });\n\n public setLocale(locale: string): void {\n dayjs.locale(locale);\n }\n\n public isDateTime(value: unknown): value is DateTime {\n return dayjs.isDayjs(value);\n }\n\n /**\n * Create a new UTC DateTime instance.\n */\n public utc(\n date: string | number | Date | Dayjs | null | undefined,\n ): DateTime {\n return dayjs.utc(date);\n }\n\n /**\n * Create a new DateTime instance.\n */\n public of(date: string | number | Date | Dayjs | null | undefined): DateTime {\n return dayjs(date);\n }\n\n /**\n * Get the current date as a string.\n */\n public toISOString(date: Date | string | DateTime = this.now()): string {\n return this.of(date).toISOString();\n }\n\n /**\n * Get the current date.\n */\n public now(): DateTime {\n return this.getCurrentDate();\n }\n\n /**\n * Get the current date as a string.\n *\n * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.\n */\n public nowISOString(): string {\n if (this.ref) {\n return this.ref.toISOString();\n }\n return new Date().toISOString();\n }\n\n /**\n * Get the current date as milliseconds since epoch.\n *\n * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.\n */\n public nowMillis(): number {\n if (this.ref) {\n return this.ref.valueOf();\n }\n return Date.now();\n }\n\n /**\n * Get the current date as a string.\n *\n * @protected\n */\n protected getCurrentDate(): DateTime {\n if (this.ref) {\n return this.ref;\n }\n\n return dayjs();\n }\n\n /**\n * Create a new Duration instance.\n */\n public duration = (\n duration: DurationLike,\n unit?: ManipulateType,\n ): Duration => {\n if (Array.isArray(duration)) {\n return dayjs.duration(duration[0], duration[1]);\n }\n\n if (typeof duration === \"number\") {\n return dayjs.duration(duration, unit || \"milliseconds\");\n }\n\n return duration;\n };\n\n public isDurationLike(value: unknown): value is DurationLike {\n return dayjs.isDuration(this.duration(value as DurationLike));\n }\n\n // -------------------------------------------------------------------------------------------------------------------\n\n // Timer Management\n\n /**\n * Return a promise that resolves after the next tick.\n * It uses `setTimeout` with 0 ms delay.\n */\n public async tick(): Promise<void> {\n await new Promise((resolve) => setTimeout(resolve, 0));\n }\n\n /**\n * Wait for a certain duration.\n *\n * You can clear the timeout by using the `AbortSignal` API.\n * Aborted signal will resolve the promise immediately, it does not reject it.\n */\n public wait(\n duration: DurationLike,\n options: {\n signal?: AbortSignal;\n now?: number;\n } = {},\n ): Promise<void> {\n return new Promise((resolve) => {\n let clearTimeout: any;\n let callback: any;\n\n const timeout = this.createTimeout(\n () => {\n if (options.signal && clearTimeout) {\n options.signal.removeEventListener(\"abort\", callback);\n }\n resolve();\n },\n duration,\n options.now,\n );\n\n if (options.signal) {\n clearTimeout = () => this.clearTimeout(timeout);\n callback = () => {\n clearTimeout();\n resolve();\n };\n options.signal.addEventListener(\"abort\", callback);\n }\n });\n }\n\n public createInterval(\n run: () => unknown,\n duration: DurationLike,\n start = false,\n ): Interval {\n const interval: Interval = {\n run,\n duration: this.duration(duration).asMilliseconds(),\n };\n\n this.intervals.push(interval);\n\n if (start) {\n interval.timer = setInterval(interval.run, interval.duration);\n }\n\n return interval;\n }\n\n /**\n * Run a callback after a certain duration.\n */\n public createTimeout(\n callback: () => void,\n duration: DurationLike,\n now?: number,\n ): Timeout {\n if (this.ref && now) {\n const next = this.of(now).add(this.duration(duration));\n if (next < this.now()) {\n callback();\n }\n return {\n now,\n duration: 0,\n callback: () => {},\n clear: () => {},\n };\n }\n\n const timeout: Timeout = {\n now: now ?? this.now().valueOf(),\n duration: this.duration(duration).asMilliseconds(),\n callback,\n clear: () => this.clearTimeout(timeout),\n };\n\n timeout.timer = setTimeout(() => {\n timeout.callback();\n }, timeout.duration);\n\n this.timeouts.push(timeout);\n\n return timeout;\n }\n\n public clearTimeout(timeout: Timeout): void {\n clearTimeout(timeout.timer);\n timeout.duration = 0;\n timeout.timer = null;\n }\n\n public clearInterval(interval: Interval): void {\n clearInterval(interval.timer);\n interval.duration = 0;\n interval.timer = null;\n }\n\n /**\n * Run a function with a deadline.\n */\n public async deadline<T>(\n fn: (signal: AbortSignal) => Promise<T>,\n duration: DurationLike,\n ): Promise<T> {\n const abort = new AbortController();\n const timeout = this.createTimeout(() => abort.abort(), duration);\n try {\n return await fn(abort.signal);\n } finally {\n this.clearTimeout(timeout);\n }\n }\n\n // -------------------------------------------------------------------------------------------------------------------\n\n // Testing\n\n /**\n * Add time to the current date.\n */\n public async travel(\n duration: DurationLike,\n unit?: ManipulateType,\n ): Promise<void> {\n this.ref = this.ref || this.now();\n this.ref = this.ref.add(this.duration(duration, unit));\n const ms = this.duration(duration, unit).asMilliseconds();\n const now = Date.now();\n\n for (const timeout of this.timeouts) {\n if (!timeout.timer) {\n continue;\n }\n\n clearTimeout(timeout.timer);\n timeout.timer = null;\n\n const spent = now - timeout.now;\n timeout.duration = timeout.duration - spent - ms;\n\n if (timeout.duration <= 0) {\n timeout.callback();\n } else {\n timeout.timer = setTimeout(() => {\n timeout.callback();\n }, timeout.duration);\n }\n }\n\n for (const interval of this.intervals) {\n if (!interval.timer) {\n continue;\n }\n\n clearInterval(interval.timer);\n interval.timer = null;\n\n const repeat = Math.floor(ms / interval.duration);\n for (let i = 0; i < repeat; i++) {\n await interval.run();\n }\n }\n\n await this.tick();\n }\n\n /**\n * Stop the time.\n */\n public pause(): DateTime {\n this.ref = this.ref || this.now();\n return this.ref;\n }\n\n /**\n * Reset the reference date.\n */\n public reset(): void {\n this.ref = null;\n }\n}\n\nexport interface Interval {\n timer?: any;\n duration: number;\n run: () => unknown;\n}\n\nexport interface Timeout {\n now: number;\n timer?: any;\n duration: number;\n callback: () => void;\n clear: () => void;\n}\n","import { $inject, createPrimitive, KIND, Primitive } from \"alepha\";\nimport {\n DateTimeProvider,\n type DurationLike,\n} from \"../providers/DateTimeProvider.ts\";\n\n/**\n * Run a function periodically.\n * It uses the `setInterval` internally.\n * It starts by default when the context starts and stops when the context stops.\n */\nexport const $interval = (options: IntervalPrimitiveOptions) =>\n createPrimitive(IntervalPrimitive, options);\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface IntervalPrimitiveOptions {\n /**\n * The interval handler.\n */\n handler: () => unknown;\n\n /**\n * The interval duration.\n */\n duration: DurationLike;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport class IntervalPrimitive extends Primitive<IntervalPrimitiveOptions> {\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n\n public called = 0;\n\n protected onInit() {\n this.dateTimeProvider.createInterval(async () => {\n await this.options.handler();\n this.called += 1;\n }, this.options.duration);\n }\n}\n\n$interval[KIND] = IntervalPrimitive;\n","import { $module } from \"alepha\";\nimport { $interval } from \"./primitives/$interval.ts\";\nimport { DateTimeProvider } from \"./providers/DateTimeProvider.ts\";\n\nexport * from \"./primitives/$interval.ts\";\nexport * from \"./providers/DateTimeProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | type | quality | stability |\n * |------|---------|-----------|\n * | tooling | standard | stable |\n *\n * Date and time operations.\n *\n * **Features:**\n * - Recurring interval definitions\n * - Duration parsing (ISO 8601, human-readable)\n * - Timezone support\n * - Dayjs integration\n *\n * @module alepha.datetime\n */\nexport const AlephaDateTime = $module({\n name: \"alepha.datetime\",\n primitives: [$interval],\n services: [DateTimeProvider],\n});\n"],"mappings":";;;;;;;;;;;AA0BA,MAAa,QAAQ;AACrB,MAAa,cAAc,UAAsC;AAC/D,QAAO,MAAM,QAAQ,MAAM;;AAG7B,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,OAAc,UAAkC;EAC9C;EACA;EACA;EACA;EACA;EACD;CAED,AAAU,SAAS,QAAQ,OAAO;CAClC,AAAU,MAAuB;CACjC,AAAmB,WAAsB,EAAE;CAC3C,AAAmB,YAAwB,EAAE;CAE7C,cAAc;AACZ,OAAK,MAAM,UAAU,iBAAiB,QACpC,OAAM,OAAO,OAAO;;CAIxB,AAAmB,UAAU,MAAM;EACjC,IAAI;EACJ,SAAS,YAAY;AAEnB,SAAM,QAAQ,IACZ,KAAK,UAAU,IAAI,OAAO,aAAa;AACrC,QAAI,SAAS,SAAS,KACpB;AAEF,UAAM,SAAS,KAAK;AACpB,aAAS,QAAQ,YAAY,SAAS,KAAK,SAAS,SAAS;KAC7D,CACH;;EAEJ,CAAC;CAEF,AAAmB,SAAS,MAAM;EAChC,IAAI;EACJ,eAAe;AACb,QAAK,MAAM,WAAW,KAAK,SACzB,MAAK,aAAa,QAAQ;AAG5B,QAAK,MAAM,YAAY,KAAK,WAAW;AACrC,kBA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,SAAS;AAC5B,QAAK,UAAU;KACd,KAAK,QAAQ,SAAS;;;AAI7B,UAAU,QAAQ;;;;;;;;;;;;;;;;;;;ACnBlB,MAAa,iBAAiB,QAAQ;CACpC,MAAM;CACN,YAAY,CAAC,UAAU;CACvB,UAAU,CAAC,iBAAiB;CAC7B,CAAC"}
|
package/dist/email/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { InstantiableClass, KIND, Primitive, Static } from "alepha";
|
|
1
|
+
import * as alepha1 from "alepha";
|
|
2
|
+
import { FileLike, InstantiableClass, Json, KIND, Primitive, Static, StreamLike } from "alepha";
|
|
3
3
|
import * as alepha_logger0 from "alepha/logger";
|
|
4
|
-
import {
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
5
|
import { Transporter } from "nodemailer";
|
|
6
6
|
|
|
7
7
|
//#region ../../src/email/providers/EmailProvider.d.ts
|
|
@@ -66,12 +66,310 @@ declare class EmailPrimitive extends Primitive<EmailPrimitiveOptions> {
|
|
|
66
66
|
protected $provider(): EmailProvider;
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
|
+
//#region ../../src/system/providers/FileSystemProvider.d.ts
|
|
70
|
+
/**
|
|
71
|
+
* Options for creating a file from a URL
|
|
72
|
+
*/
|
|
73
|
+
interface CreateFileFromUrlOptions {
|
|
74
|
+
/**
|
|
75
|
+
* The URL to load the file from (file://, http://, or https://)
|
|
76
|
+
*/
|
|
77
|
+
url: string;
|
|
78
|
+
/**
|
|
79
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
80
|
+
*/
|
|
81
|
+
type?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
84
|
+
*/
|
|
85
|
+
name?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for creating a file from a path (URL with file:// scheme)
|
|
89
|
+
*/
|
|
90
|
+
interface CreateFileFromPathOptions {
|
|
91
|
+
/**
|
|
92
|
+
* The path to the file on the local filesystem
|
|
93
|
+
*/
|
|
94
|
+
path: string;
|
|
95
|
+
/**
|
|
96
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
97
|
+
*/
|
|
98
|
+
type?: string;
|
|
99
|
+
/**
|
|
100
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
101
|
+
*/
|
|
102
|
+
name?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Options for creating a file from a Buffer
|
|
106
|
+
*/
|
|
107
|
+
interface CreateFileFromBufferOptions {
|
|
108
|
+
/**
|
|
109
|
+
* The Buffer containing the file data
|
|
110
|
+
*/
|
|
111
|
+
buffer: Buffer;
|
|
112
|
+
/**
|
|
113
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
114
|
+
*/
|
|
115
|
+
type?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The name of the file (required for proper content type detection)
|
|
118
|
+
*/
|
|
119
|
+
name?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Options for creating a file from a stream
|
|
123
|
+
*/
|
|
124
|
+
interface CreateFileFromStreamOptions {
|
|
125
|
+
/**
|
|
126
|
+
* The readable stream containing the file data
|
|
127
|
+
*/
|
|
128
|
+
stream: StreamLike;
|
|
129
|
+
/**
|
|
130
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
131
|
+
*/
|
|
132
|
+
type?: string;
|
|
133
|
+
/**
|
|
134
|
+
* The name of the file (required for proper content type detection)
|
|
135
|
+
*/
|
|
136
|
+
name?: string;
|
|
137
|
+
/**
|
|
138
|
+
* The size of the file in bytes (optional)
|
|
139
|
+
*/
|
|
140
|
+
size?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Options for creating a file from text content
|
|
144
|
+
*/
|
|
145
|
+
interface CreateFileFromTextOptions {
|
|
146
|
+
/**
|
|
147
|
+
* The text content to create the file from
|
|
148
|
+
*/
|
|
149
|
+
text: string;
|
|
150
|
+
/**
|
|
151
|
+
* The MIME type of the file (default: text/plain)
|
|
152
|
+
*/
|
|
153
|
+
type?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The name of the file (default: "file.txt")
|
|
156
|
+
*/
|
|
157
|
+
name?: string;
|
|
158
|
+
}
|
|
159
|
+
interface CreateFileFromResponseOptions {
|
|
160
|
+
/**
|
|
161
|
+
* The Response object containing the file data
|
|
162
|
+
*/
|
|
163
|
+
response: Response;
|
|
164
|
+
/**
|
|
165
|
+
* Override the name (optional, uses filename from Content-Disposition header if not provided)
|
|
166
|
+
*/
|
|
167
|
+
name?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
170
|
+
*/
|
|
171
|
+
type?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Options for creating a file from a Web File object
|
|
175
|
+
*/
|
|
176
|
+
interface CreateFileFromWebFileOptions {
|
|
177
|
+
/**
|
|
178
|
+
* The Web File object
|
|
179
|
+
*/
|
|
180
|
+
file: File;
|
|
181
|
+
/**
|
|
182
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
183
|
+
*/
|
|
184
|
+
type?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Override the name (optional, uses file.name if not provided)
|
|
187
|
+
*/
|
|
188
|
+
name?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Override the size (optional, uses file.size if not provided)
|
|
191
|
+
*/
|
|
192
|
+
size?: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Options for creating a file from an ArrayBuffer
|
|
196
|
+
*/
|
|
197
|
+
interface CreateFileFromArrayBufferOptions {
|
|
198
|
+
/**
|
|
199
|
+
* The ArrayBuffer containing the file data
|
|
200
|
+
*/
|
|
201
|
+
arrayBuffer: ArrayBuffer;
|
|
202
|
+
/**
|
|
203
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
204
|
+
*/
|
|
205
|
+
type?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The name of the file (required for proper content type detection)
|
|
208
|
+
*/
|
|
209
|
+
name?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Union type for all createFile options
|
|
213
|
+
*/
|
|
214
|
+
type CreateFileOptions = CreateFileFromUrlOptions | CreateFileFromPathOptions | CreateFileFromBufferOptions | CreateFileFromStreamOptions | CreateFileFromTextOptions | CreateFileFromWebFileOptions | CreateFileFromResponseOptions | CreateFileFromArrayBufferOptions;
|
|
215
|
+
/**
|
|
216
|
+
* Options for rm (remove) operation
|
|
217
|
+
*/
|
|
218
|
+
interface RmOptions {
|
|
219
|
+
/**
|
|
220
|
+
* If true, removes directories and their contents recursively
|
|
221
|
+
*/
|
|
222
|
+
recursive?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* If true, no error will be thrown if the path does not exist
|
|
225
|
+
*/
|
|
226
|
+
force?: boolean;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Options for cp (copy) operation
|
|
230
|
+
*/
|
|
231
|
+
interface CpOptions {
|
|
232
|
+
/**
|
|
233
|
+
* If true, copy directories recursively
|
|
234
|
+
*/
|
|
235
|
+
recursive?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* If true, overwrite existing destination
|
|
238
|
+
*/
|
|
239
|
+
force?: boolean;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Options for mkdir operation
|
|
243
|
+
*/
|
|
244
|
+
interface MkdirOptions {
|
|
245
|
+
/**
|
|
246
|
+
* If true, creates parent directories as needed
|
|
247
|
+
*
|
|
248
|
+
* @default true
|
|
249
|
+
*/
|
|
250
|
+
recursive?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* If true, does not throw an error if the directory already exists
|
|
253
|
+
*
|
|
254
|
+
* @default true
|
|
255
|
+
*/
|
|
256
|
+
force?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* File mode (permission and sticky bits)
|
|
259
|
+
*/
|
|
260
|
+
mode?: number;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Options for ls (list) operation
|
|
264
|
+
*/
|
|
265
|
+
interface LsOptions {
|
|
266
|
+
/**
|
|
267
|
+
* If true, list contents of directories recursively
|
|
268
|
+
*/
|
|
269
|
+
recursive?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* If true, include hidden files (starting with .)
|
|
272
|
+
*/
|
|
273
|
+
hidden?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* FileSystem interface providing utilities for working with files.
|
|
277
|
+
*/
|
|
278
|
+
declare abstract class FileSystemProvider {
|
|
279
|
+
/**
|
|
280
|
+
* Joins multiple path segments into a single path.
|
|
281
|
+
*
|
|
282
|
+
* @param paths - The path segments to join
|
|
283
|
+
* @returns The joined path
|
|
284
|
+
*/
|
|
285
|
+
abstract join(...paths: string[]): string;
|
|
286
|
+
/**
|
|
287
|
+
* Creates a FileLike object from various sources.
|
|
288
|
+
*
|
|
289
|
+
* @param options - Options for creating the file
|
|
290
|
+
* @returns A FileLike object
|
|
291
|
+
*/
|
|
292
|
+
abstract createFile(options: CreateFileOptions): FileLike;
|
|
293
|
+
/**
|
|
294
|
+
* Removes a file or directory.
|
|
295
|
+
*
|
|
296
|
+
* @param path - The path to remove
|
|
297
|
+
* @param options - Remove options
|
|
298
|
+
*/
|
|
299
|
+
abstract rm(path: string, options?: RmOptions): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Copies a file or directory.
|
|
302
|
+
*
|
|
303
|
+
* @param src - Source path
|
|
304
|
+
* @param dest - Destination path
|
|
305
|
+
* @param options - Copy options
|
|
306
|
+
*/
|
|
307
|
+
abstract cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Moves/renames a file or directory.
|
|
310
|
+
*
|
|
311
|
+
* @param src - Source path
|
|
312
|
+
* @param dest - Destination path
|
|
313
|
+
*/
|
|
314
|
+
abstract mv(src: string, dest: string): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Creates a directory.
|
|
317
|
+
*
|
|
318
|
+
* @param path - The directory path to create
|
|
319
|
+
* @param options - Mkdir options
|
|
320
|
+
*/
|
|
321
|
+
abstract mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Lists files in a directory.
|
|
324
|
+
*
|
|
325
|
+
* @param path - The directory path to list
|
|
326
|
+
* @param options - List options
|
|
327
|
+
* @returns Array of filenames
|
|
328
|
+
*/
|
|
329
|
+
abstract ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
330
|
+
/**
|
|
331
|
+
* Checks if a file or directory exists.
|
|
332
|
+
*
|
|
333
|
+
* @param path - The path to check
|
|
334
|
+
* @returns True if the path exists, false otherwise
|
|
335
|
+
*/
|
|
336
|
+
abstract exists(path: string): Promise<boolean>;
|
|
337
|
+
/**
|
|
338
|
+
* Reads the content of a file.
|
|
339
|
+
*
|
|
340
|
+
* @param path - The file path to read
|
|
341
|
+
* @returns The file content as a Buffer
|
|
342
|
+
*/
|
|
343
|
+
abstract readFile(path: string): Promise<Buffer>;
|
|
344
|
+
/**
|
|
345
|
+
* Writes data to a file.
|
|
346
|
+
*
|
|
347
|
+
* @param path - The file path to write to
|
|
348
|
+
* @param data - The data to write (Buffer or string)
|
|
349
|
+
*/
|
|
350
|
+
abstract writeFile(path: string, data: Uint8Array | Buffer | string | FileLike): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Reads the content of a file as a string.
|
|
353
|
+
*
|
|
354
|
+
* @param path - The file path to read
|
|
355
|
+
* @returns The file content as a string
|
|
356
|
+
*/
|
|
357
|
+
abstract readTextFile(path: string): Promise<string>;
|
|
358
|
+
/**
|
|
359
|
+
* Reads the content of a file as JSON.
|
|
360
|
+
*
|
|
361
|
+
* @param path - The file path to read
|
|
362
|
+
* @returns The parsed JSON content
|
|
363
|
+
*/
|
|
364
|
+
abstract readJsonFile<T = unknown>(path: string): Promise<T>;
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
69
367
|
//#region ../../src/email/providers/LocalEmailProvider.d.ts
|
|
70
368
|
/**
|
|
71
369
|
* Local email provider configuration atom
|
|
72
370
|
*/
|
|
73
|
-
declare const localEmailOptions:
|
|
74
|
-
directory:
|
|
371
|
+
declare const localEmailOptions: alepha1.Atom<alepha1.TObject<{
|
|
372
|
+
directory: alepha1.TString;
|
|
75
373
|
}>, "alepha.email.local.options">;
|
|
76
374
|
type LocalEmailProviderOptions = Static<typeof localEmailOptions.schema>;
|
|
77
375
|
declare module "alepha" {
|
|
@@ -86,7 +384,7 @@ declare class LocalEmailProvider implements EmailProvider {
|
|
|
86
384
|
directory: string;
|
|
87
385
|
}>;
|
|
88
386
|
protected get directory(): string;
|
|
89
|
-
protected onStart:
|
|
387
|
+
protected onStart: alepha1.HookPrimitive<"start">;
|
|
90
388
|
send(options: EmailSendOptions): Promise<void>;
|
|
91
389
|
createEmailHtml(options: {
|
|
92
390
|
to: string;
|
|
@@ -117,12 +415,12 @@ declare class MemoryEmailProvider implements EmailProvider {
|
|
|
117
415
|
/**
|
|
118
416
|
* Nodemailer connection pooling and rate limiting options
|
|
119
417
|
*/
|
|
120
|
-
declare const nodemailerEmailOptions:
|
|
121
|
-
pool:
|
|
122
|
-
maxConnections:
|
|
123
|
-
maxMessages:
|
|
124
|
-
rateDelta:
|
|
125
|
-
rateLimit:
|
|
418
|
+
declare const nodemailerEmailOptions: alepha1.Atom<alepha1.TObject<{
|
|
419
|
+
pool: alepha1.TOptional<alepha1.TBoolean>;
|
|
420
|
+
maxConnections: alepha1.TOptional<alepha1.TNumber>;
|
|
421
|
+
maxMessages: alepha1.TOptional<alepha1.TNumber>;
|
|
422
|
+
rateDelta: alepha1.TOptional<alepha1.TNumber>;
|
|
423
|
+
rateLimit: alepha1.TOptional<alepha1.TNumber>;
|
|
126
424
|
}>, "alepha.email.nodemailer.options">;
|
|
127
425
|
type NodemailerEmailProviderOptions = Static<typeof nodemailerEmailOptions.schema>;
|
|
128
426
|
declare module "alepha" {
|
|
@@ -196,8 +494,8 @@ declare class NodemailerEmailProvider implements EmailProvider {
|
|
|
196
494
|
* Close the transporter connection.
|
|
197
495
|
*/
|
|
198
496
|
close(): void;
|
|
199
|
-
protected readonly onStart:
|
|
200
|
-
protected readonly onStop:
|
|
497
|
+
protected readonly onStart: alepha1.HookPrimitive<"start">;
|
|
498
|
+
protected readonly onStop: alepha1.HookPrimitive<"stop">;
|
|
201
499
|
}
|
|
202
500
|
//#endregion
|
|
203
501
|
//#region ../../src/email/index.d.ts
|
|
@@ -218,16 +516,21 @@ declare module "alepha" {
|
|
|
218
516
|
}
|
|
219
517
|
}
|
|
220
518
|
/**
|
|
221
|
-
*
|
|
519
|
+
* | type | quality | stability |
|
|
520
|
+
* |------|---------|-----------|
|
|
521
|
+
* | backend | rare | stable |
|
|
522
|
+
*
|
|
523
|
+
* Email delivery with template support.
|
|
222
524
|
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
525
|
+
* **Features:**
|
|
526
|
+
* - Send emails with templates
|
|
527
|
+
* - Multiple recipients
|
|
528
|
+
* - SMTP via Nodemailer
|
|
529
|
+
* - Local file provider for development
|
|
226
530
|
*
|
|
227
|
-
* @see {@link EmailProvider}
|
|
228
531
|
* @module alepha.email
|
|
229
532
|
*/
|
|
230
|
-
declare const AlephaEmail:
|
|
533
|
+
declare const AlephaEmail: alepha1.Service<alepha1.Module>;
|
|
231
534
|
//#endregion
|
|
232
535
|
export { $email, AlephaEmail, EmailError, EmailPrimitive, EmailPrimitiveOptions, EmailProvider, EmailRecord, EmailSendOptions, LocalEmailProvider, LocalEmailProviderOptions, MemoryEmailProvider, NodemailerEmailProvider, NodemailerEmailProviderOptions, localEmailOptions, nodemailerEmailOptions };
|
|
233
536
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/email/providers/EmailProvider.ts","../../src/email/errors/EmailError.ts","../../src/email/primitives/$email.ts","../../src/email/providers/LocalEmailProvider.ts","../../src/email/providers/MemoryEmailProvider.ts","../../src/email/providers/NodemailerEmailProvider.ts","../../src/email/index.ts"],"mappings":";;;;;;;;;;;;uBAKsB,aAAA;;AAAtB;;;;WAMkB,IAAA,CAAK,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA;AAAA,KAGvC,gBAAA;EACV,EAAA;EACA,OAAA;EACA,IAAA;AAAA;;;cCjBW,UAAA,SAAmB,KAAA;cAClB,OAAA,UAAiB,KAAA,GAAQ,KAAA;AAAA;;;cCW1B,MAAA;EAAA,WAAmB,qBAAA,GAAqB,cAAA;EAAA;;UAKpC,qBAAA;EACf,IAAA;EACA,QAAA,GAAW,iBAAA,CAAkB,aAAA;AAAA;;;;;;;AFL/B;;;;;;;;;;;;cE4Ba,cAAA,SAAuB,SAAA,CAAU,qBAAA;EAAA,mBACzB,QAAA,EAAQ,aAAA;EAAA,IAEhB,IAAA,CAAA;ED7CwB;;;ECoDtB,IAAA,CAAK,OAAA,EAAS,gBAAA,GAAmB,OAAA;EAAA,UAoBpC,SAAA,CAAA,GAAa,aAAA;AAAA;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/email/providers/EmailProvider.ts","../../src/email/errors/EmailError.ts","../../src/email/primitives/$email.ts","../../src/system/providers/FileSystemProvider.ts","../../src/email/providers/LocalEmailProvider.ts","../../src/email/providers/MemoryEmailProvider.ts","../../src/email/providers/NodemailerEmailProvider.ts","../../src/email/index.ts"],"mappings":";;;;;;;;;;;;uBAKsB,aAAA;;AAAtB;;;;WAMkB,IAAA,CAAK,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA;AAAA,KAGvC,gBAAA;EACV,EAAA;EACA,OAAA;EACA,IAAA;AAAA;;;cCjBW,UAAA,SAAmB,KAAA;cAClB,OAAA,UAAiB,KAAA,GAAQ,KAAA;AAAA;;;cCW1B,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