@sixthsummit/ship-api 0.0.0-stage → 4.1.1
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/CHANGELOG.md +605 -0
- package/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +58 -2
- package/cli/commands/add.js +537 -0
- package/cli/commands/contract.js +2 -0
- package/cli/commands/create.js +250 -0
- package/cli/commands/dev.js +227 -0
- package/cli/commands/doctor.js +286 -0
- package/cli/commands/generate.js +937 -0
- package/cli/commands/graph.js +2 -0
- package/cli/commands/migrate-orm.js +1171 -0
- package/cli/commands/update.js +37 -0
- package/cli/ship-api.js +285 -0
- package/lib/app/auth/AuthProvider.d.ts +91 -0
- package/lib/app/auth/AuthProvider.d.ts.map +1 -0
- package/lib/app/auth/AuthProvider.js +13 -0
- package/lib/app/auth/AuthProvider.js.map +1 -0
- package/lib/app/auth/adapters/firebase.d.ts +79 -0
- package/lib/app/auth/adapters/firebase.d.ts.map +1 -0
- package/lib/app/auth/adapters/firebase.js +122 -0
- package/lib/app/auth/adapters/firebase.js.map +1 -0
- package/lib/app/auth/adapters/jwtCookie.d.ts +55 -0
- package/lib/app/auth/adapters/jwtCookie.d.ts.map +1 -0
- package/lib/app/auth/adapters/jwtCookie.js +120 -0
- package/lib/app/auth/adapters/jwtCookie.js.map +1 -0
- package/lib/app/auth/index.d.ts +8 -0
- package/lib/app/auth/index.d.ts.map +1 -0
- package/lib/app/auth/index.js +7 -0
- package/lib/app/auth/index.js.map +1 -0
- package/lib/app/auth/jwt/AuthFlow.d.ts +94 -0
- package/lib/app/auth/jwt/AuthFlow.d.ts.map +1 -0
- package/lib/app/auth/jwt/AuthFlow.js +127 -0
- package/lib/app/auth/jwt/AuthFlow.js.map +1 -0
- package/lib/app/auth/jwt/DrizzleRefreshTokenStore.d.ts +80 -0
- package/lib/app/auth/jwt/DrizzleRefreshTokenStore.d.ts.map +1 -0
- package/lib/app/auth/jwt/DrizzleRefreshTokenStore.js +134 -0
- package/lib/app/auth/jwt/DrizzleRefreshTokenStore.js.map +1 -0
- package/lib/app/auth/jwt/JwtSigner.d.ts +123 -0
- package/lib/app/auth/jwt/JwtSigner.d.ts.map +1 -0
- package/lib/app/auth/jwt/JwtSigner.js +118 -0
- package/lib/app/auth/jwt/JwtSigner.js.map +1 -0
- package/lib/app/auth/jwt/RefreshTokenStore.d.ts +97 -0
- package/lib/app/auth/jwt/RefreshTokenStore.d.ts.map +1 -0
- package/lib/app/auth/jwt/RefreshTokenStore.js +122 -0
- package/lib/app/auth/jwt/RefreshTokenStore.js.map +1 -0
- package/lib/app/auth/permissionDefinition.d.ts +20 -0
- package/lib/app/auth/permissionDefinition.d.ts.map +1 -0
- package/lib/app/auth/permissionDefinition.js +2 -0
- package/lib/app/auth/permissionDefinition.js.map +1 -0
- package/lib/app/context/RequestContext.d.ts +59 -0
- package/lib/app/context/RequestContext.d.ts.map +1 -0
- package/lib/app/context/RequestContext.js +25 -0
- package/lib/app/context/RequestContext.js.map +1 -0
- package/lib/app/db/QueryOptions.d.ts +82 -0
- package/lib/app/db/QueryOptions.d.ts.map +1 -0
- package/lib/app/db/QueryOptions.js +37 -0
- package/lib/app/db/QueryOptions.js.map +1 -0
- package/lib/app/db/baseFields.d.ts +60 -0
- package/lib/app/db/baseFields.d.ts.map +1 -0
- package/lib/app/db/baseFields.js +54 -0
- package/lib/app/db/baseFields.js.map +1 -0
- package/lib/app/db/buildWhere.d.ts +22 -0
- package/lib/app/db/buildWhere.d.ts.map +1 -0
- package/lib/app/db/buildWhere.js +75 -0
- package/lib/app/db/buildWhere.js.map +1 -0
- package/lib/app/db/client.d.ts +111 -0
- package/lib/app/db/client.d.ts.map +1 -0
- package/lib/app/db/client.js +99 -0
- package/lib/app/db/client.js.map +1 -0
- package/lib/app/db/tenantScoped.d.ts +59 -0
- package/lib/app/db/tenantScoped.d.ts.map +1 -0
- package/lib/app/db/tenantScoped.js +54 -0
- package/lib/app/db/tenantScoped.js.map +1 -0
- package/lib/app/db/transaction.d.ts +58 -0
- package/lib/app/db/transaction.d.ts.map +1 -0
- package/lib/app/db/transaction.js +106 -0
- package/lib/app/db/transaction.js.map +1 -0
- package/lib/app/health/HealthCheck.d.ts +121 -0
- package/lib/app/health/HealthCheck.d.ts.map +1 -0
- package/lib/app/health/HealthCheck.js +151 -0
- package/lib/app/health/HealthCheck.js.map +1 -0
- package/lib/app/health/redisHealthCheck.d.ts +14 -0
- package/lib/app/health/redisHealthCheck.d.ts.map +1 -0
- package/lib/app/health/redisHealthCheck.js +21 -0
- package/lib/app/health/redisHealthCheck.js.map +1 -0
- package/lib/app/lifecycle/Bootstrapper.d.ts +92 -0
- package/lib/app/lifecycle/Bootstrapper.d.ts.map +1 -0
- package/lib/app/lifecycle/Bootstrapper.js +99 -0
- package/lib/app/lifecycle/Bootstrapper.js.map +1 -0
- package/lib/app/registry/routes.d.ts +89 -0
- package/lib/app/registry/routes.d.ts.map +1 -0
- package/lib/app/registry/routes.js +72 -0
- package/lib/app/registry/routes.js.map +1 -0
- package/lib/app/services/DrizzleEntityService.d.ts +123 -0
- package/lib/app/services/DrizzleEntityService.d.ts.map +1 -0
- package/lib/app/services/DrizzleEntityService.js +342 -0
- package/lib/app/services/DrizzleEntityService.js.map +1 -0
- package/lib/app/services/RedisProvider.d.ts +52 -0
- package/lib/app/services/RedisProvider.d.ts.map +1 -0
- package/lib/app/services/RedisProvider.js +75 -0
- package/lib/app/services/RedisProvider.js.map +1 -0
- package/lib/app/services/cache/Cache.d.ts +70 -0
- package/lib/app/services/cache/Cache.d.ts.map +1 -0
- package/lib/app/services/cache/Cache.js +18 -0
- package/lib/app/services/cache/Cache.js.map +1 -0
- package/lib/app/services/cache/InMemoryCache.d.ts +35 -0
- package/lib/app/services/cache/InMemoryCache.d.ts.map +1 -0
- package/lib/app/services/cache/InMemoryCache.js +76 -0
- package/lib/app/services/cache/InMemoryCache.js.map +1 -0
- package/lib/app/services/cache/RedisCache.d.ts +99 -0
- package/lib/app/services/cache/RedisCache.d.ts.map +1 -0
- package/lib/app/services/cache/RedisCache.js +150 -0
- package/lib/app/services/cache/RedisCache.js.map +1 -0
- package/lib/app/services/cache/cached.d.ts +30 -0
- package/lib/app/services/cache/cached.d.ts.map +1 -0
- package/lib/app/services/cache/cached.js +38 -0
- package/lib/app/services/cache/cached.js.map +1 -0
- package/lib/app/services/cache/index.d.ts +5 -0
- package/lib/app/services/cache/index.d.ts.map +1 -0
- package/lib/app/services/cache/index.js +4 -0
- package/lib/app/services/cache/index.js.map +1 -0
- package/lib/app/services/cron/defineCron.d.ts +57 -0
- package/lib/app/services/cron/defineCron.d.ts.map +1 -0
- package/lib/app/services/cron/defineCron.js +15 -0
- package/lib/app/services/cron/defineCron.js.map +1 -0
- package/lib/app/services/cron/index.d.ts +2 -0
- package/lib/app/services/cron/index.d.ts.map +1 -0
- package/lib/app/services/cron/index.js +2 -0
- package/lib/app/services/cron/index.js.map +1 -0
- package/lib/app/services/hooks/LifecycleHooks.d.ts +61 -0
- package/lib/app/services/hooks/LifecycleHooks.d.ts.map +1 -0
- package/lib/app/services/hooks/LifecycleHooks.js +85 -0
- package/lib/app/services/hooks/LifecycleHooks.js.map +1 -0
- package/lib/app/services/jobs/JobsManager.d.ts +67 -0
- package/lib/app/services/jobs/JobsManager.d.ts.map +1 -0
- package/lib/app/services/jobs/JobsManager.js +121 -0
- package/lib/app/services/jobs/JobsManager.js.map +1 -0
- package/lib/app/services/jobs/bullBoard.d.ts +72 -0
- package/lib/app/services/jobs/bullBoard.d.ts.map +1 -0
- package/lib/app/services/jobs/bullBoard.js +96 -0
- package/lib/app/services/jobs/bullBoard.js.map +1 -0
- package/lib/app/services/jobs/defineJob.d.ts +81 -0
- package/lib/app/services/jobs/defineJob.d.ts.map +1 -0
- package/lib/app/services/jobs/defineJob.js +49 -0
- package/lib/app/services/jobs/defineJob.js.map +1 -0
- package/lib/app/services/jobs/index.d.ts +4 -0
- package/lib/app/services/jobs/index.d.ts.map +1 -0
- package/lib/app/services/jobs/index.js +4 -0
- package/lib/app/services/jobs/index.js.map +1 -0
- package/lib/app/services/rateLimit/InMemorySlidingWindowBackend.d.ts +23 -0
- package/lib/app/services/rateLimit/InMemorySlidingWindowBackend.d.ts.map +1 -0
- package/lib/app/services/rateLimit/InMemorySlidingWindowBackend.js +51 -0
- package/lib/app/services/rateLimit/InMemorySlidingWindowBackend.js.map +1 -0
- package/lib/app/services/rateLimit/RateLimitBackend.d.ts +41 -0
- package/lib/app/services/rateLimit/RateLimitBackend.d.ts.map +1 -0
- package/lib/app/services/rateLimit/RateLimitBackend.js +19 -0
- package/lib/app/services/rateLimit/RateLimitBackend.js.map +1 -0
- package/lib/app/services/rateLimit/RedisSlidingWindowBackend.d.ts +16 -0
- package/lib/app/services/rateLimit/RedisSlidingWindowBackend.d.ts.map +1 -0
- package/lib/app/services/rateLimit/RedisSlidingWindowBackend.js +80 -0
- package/lib/app/services/rateLimit/RedisSlidingWindowBackend.js.map +1 -0
- package/lib/app/services/rateLimit/index.d.ts +4 -0
- package/lib/app/services/rateLimit/index.d.ts.map +1 -0
- package/lib/app/services/rateLimit/index.js +3 -0
- package/lib/app/services/rateLimit/index.js.map +1 -0
- package/lib/app/services/storage/DiskStorageAdapter.d.ts +62 -0
- package/lib/app/services/storage/DiskStorageAdapter.d.ts.map +1 -0
- package/lib/app/services/storage/DiskStorageAdapter.js +295 -0
- package/lib/app/services/storage/DiskStorageAdapter.js.map +1 -0
- package/lib/app/services/storage/GCSStorageAdapter.d.ts +44 -0
- package/lib/app/services/storage/GCSStorageAdapter.d.ts.map +1 -0
- package/lib/app/services/storage/GCSStorageAdapter.js +133 -0
- package/lib/app/services/storage/GCSStorageAdapter.js.map +1 -0
- package/lib/app/services/storage/S3StorageAdapter.d.ts +57 -0
- package/lib/app/services/storage/S3StorageAdapter.d.ts.map +1 -0
- package/lib/app/services/storage/S3StorageAdapter.js +162 -0
- package/lib/app/services/storage/S3StorageAdapter.js.map +1 -0
- package/lib/app/services/storage/StorageService.d.ts +88 -0
- package/lib/app/services/storage/StorageService.d.ts.map +1 -0
- package/lib/app/services/storage/StorageService.js +18 -0
- package/lib/app/services/storage/StorageService.js.map +1 -0
- package/lib/app/services/storage/index.d.ts +5 -0
- package/lib/app/services/storage/index.d.ts.map +1 -0
- package/lib/app/services/storage/index.js +4 -0
- package/lib/app/services/storage/index.js.map +1 -0
- package/lib/app/utils/ContextValidators.d.ts +46 -0
- package/lib/app/utils/ContextValidators.d.ts.map +1 -0
- package/lib/app/utils/ContextValidators.js +81 -0
- package/lib/app/utils/ContextValidators.js.map +1 -0
- package/lib/app/utils/defineEnv.d.ts +80 -0
- package/lib/app/utils/defineEnv.d.ts.map +1 -0
- package/lib/app/utils/defineEnv.js +95 -0
- package/lib/app/utils/defineEnv.js.map +1 -0
- package/lib/client.d.ts +139 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +98 -0
- package/lib/client.js.map +1 -0
- package/lib/contract/application.d.ts +3 -0
- package/lib/contract/application.d.ts.map +1 -0
- package/lib/contract/application.js +2 -0
- package/lib/contract/application.js.map +1 -0
- package/lib/contract/client.d.ts +3 -0
- package/lib/contract/client.d.ts.map +1 -0
- package/lib/contract/client.js +3 -0
- package/lib/contract/client.js.map +1 -0
- package/lib/contract/index.d.ts +3 -0
- package/lib/contract/index.d.ts.map +1 -0
- package/lib/contract/index.js +3 -0
- package/lib/contract/index.js.map +1 -0
- package/lib/contract/manifest.d.ts +3 -0
- package/lib/contract/manifest.d.ts.map +1 -0
- package/lib/contract/manifest.js +2 -0
- package/lib/contract/manifest.js.map +1 -0
- package/lib/contract/openapi.d.ts +3 -0
- package/lib/contract/openapi.d.ts.map +1 -0
- package/lib/contract/openapi.js +3 -0
- package/lib/contract/openapi.js.map +1 -0
- package/lib/contract/project.d.ts +3 -0
- package/lib/contract/project.d.ts.map +1 -0
- package/lib/contract/project.js +3 -0
- package/lib/contract/project.js.map +1 -0
- package/lib/contract/schema.d.ts +3 -0
- package/lib/contract/schema.d.ts.map +1 -0
- package/lib/contract/schema.js +3 -0
- package/lib/contract/schema.js.map +1 -0
- package/lib/drizzle/index.d.ts +3 -0
- package/lib/drizzle/index.d.ts.map +1 -0
- package/lib/drizzle/index.js +3 -0
- package/lib/drizzle/index.js.map +1 -0
- package/lib/hono/auth.d.ts +6 -0
- package/lib/hono/auth.d.ts.map +1 -0
- package/lib/hono/auth.js +54 -0
- package/lib/hono/auth.js.map +1 -0
- package/lib/hono/index.d.ts +4 -0
- package/lib/hono/index.d.ts.map +1 -0
- package/lib/hono/index.js +4 -0
- package/lib/hono/index.js.map +1 -0
- package/lib/http/app/createApp.d.ts +132 -0
- package/lib/http/app/createApp.d.ts.map +1 -0
- package/lib/http/app/createApp.js +215 -0
- package/lib/http/app/createApp.js.map +1 -0
- package/lib/http/app/devRoutes.d.ts +31 -0
- package/lib/http/app/devRoutes.d.ts.map +1 -0
- package/lib/http/app/devRoutes.js +145 -0
- package/lib/http/app/devRoutes.js.map +1 -0
- package/lib/http/app/errors.d.ts +45 -0
- package/lib/http/app/errors.d.ts.map +1 -0
- package/lib/http/app/errors.js +93 -0
- package/lib/http/app/errors.js.map +1 -0
- package/lib/http/app/health.d.ts +66 -0
- package/lib/http/app/health.d.ts.map +1 -0
- package/lib/http/app/health.js +104 -0
- package/lib/http/app/health.js.map +1 -0
- package/lib/http/errors/AppError.d.ts +10 -0
- package/lib/http/errors/AppError.d.ts.map +1 -0
- package/lib/http/errors/AppError.js +19 -0
- package/lib/http/errors/AppError.js.map +1 -0
- package/lib/http/errors/AuthenticationError.d.ts +8 -0
- package/lib/http/errors/AuthenticationError.d.ts.map +1 -0
- package/lib/http/errors/AuthenticationError.js +10 -0
- package/lib/http/errors/AuthenticationError.js.map +1 -0
- package/lib/http/errors/AuthorizationError.d.ts +8 -0
- package/lib/http/errors/AuthorizationError.d.ts.map +1 -0
- package/lib/http/errors/AuthorizationError.js +10 -0
- package/lib/http/errors/AuthorizationError.js.map +1 -0
- package/lib/http/errors/BadRequestError.d.ts +8 -0
- package/lib/http/errors/BadRequestError.d.ts.map +1 -0
- package/lib/http/errors/BadRequestError.js +10 -0
- package/lib/http/errors/BadRequestError.js.map +1 -0
- package/lib/http/errors/ConflictError.d.ts +8 -0
- package/lib/http/errors/ConflictError.d.ts.map +1 -0
- package/lib/http/errors/ConflictError.js +10 -0
- package/lib/http/errors/ConflictError.js.map +1 -0
- package/lib/http/errors/InternalServerError.d.ts +8 -0
- package/lib/http/errors/InternalServerError.d.ts.map +1 -0
- package/lib/http/errors/InternalServerError.js +10 -0
- package/lib/http/errors/InternalServerError.js.map +1 -0
- package/lib/http/errors/NotFoundError.d.ts +8 -0
- package/lib/http/errors/NotFoundError.d.ts.map +1 -0
- package/lib/http/errors/NotFoundError.js +10 -0
- package/lib/http/errors/NotFoundError.js.map +1 -0
- package/lib/http/errors/RateLimitError.d.ts +13 -0
- package/lib/http/errors/RateLimitError.d.ts.map +1 -0
- package/lib/http/errors/RateLimitError.js +16 -0
- package/lib/http/errors/RateLimitError.js.map +1 -0
- package/lib/http/errors/ServiceUnavailableError.d.ts +8 -0
- package/lib/http/errors/ServiceUnavailableError.d.ts.map +1 -0
- package/lib/http/errors/ServiceUnavailableError.js +10 -0
- package/lib/http/errors/ServiceUnavailableError.js.map +1 -0
- package/lib/http/errors/ValidationError.d.ts +9 -0
- package/lib/http/errors/ValidationError.d.ts.map +1 -0
- package/lib/http/errors/ValidationError.js +12 -0
- package/lib/http/errors/ValidationError.js.map +1 -0
- package/lib/http/errors/index.d.ts +11 -0
- package/lib/http/errors/index.d.ts.map +1 -0
- package/lib/http/errors/index.js +12 -0
- package/lib/http/errors/index.js.map +1 -0
- package/lib/http/middleware/apiKey.d.ts +9 -0
- package/lib/http/middleware/apiKey.d.ts.map +1 -0
- package/lib/http/middleware/apiKey.js +71 -0
- package/lib/http/middleware/apiKey.js.map +1 -0
- package/lib/http/middleware/csrf.d.ts +63 -0
- package/lib/http/middleware/csrf.d.ts.map +1 -0
- package/lib/http/middleware/csrf.js +169 -0
- package/lib/http/middleware/csrf.js.map +1 -0
- package/lib/http/middleware/httpLogger.d.ts +39 -0
- package/lib/http/middleware/httpLogger.d.ts.map +1 -0
- package/lib/http/middleware/httpLogger.js +118 -0
- package/lib/http/middleware/httpLogger.js.map +1 -0
- package/lib/http/middleware/idempotency.d.ts +48 -0
- package/lib/http/middleware/idempotency.d.ts.map +1 -0
- package/lib/http/middleware/idempotency.js +180 -0
- package/lib/http/middleware/idempotency.js.map +1 -0
- package/lib/http/middleware/rateLimit.d.ts +105 -0
- package/lib/http/middleware/rateLimit.d.ts.map +1 -0
- package/lib/http/middleware/rateLimit.js +84 -0
- package/lib/http/middleware/rateLimit.js.map +1 -0
- package/lib/http/middleware/requireAuth.d.ts +58 -0
- package/lib/http/middleware/requireAuth.d.ts.map +1 -0
- package/lib/http/middleware/requireAuth.js +63 -0
- package/lib/http/middleware/requireAuth.js.map +1 -0
- package/lib/http/middleware/requirePermission.d.ts +23 -0
- package/lib/http/middleware/requirePermission.d.ts.map +1 -0
- package/lib/http/middleware/requirePermission.js +50 -0
- package/lib/http/middleware/requirePermission.js.map +1 -0
- package/lib/http/middleware/resolveTenant.d.ts +41 -0
- package/lib/http/middleware/resolveTenant.d.ts.map +1 -0
- package/lib/http/middleware/resolveTenant.js +17 -0
- package/lib/http/middleware/resolveTenant.js.map +1 -0
- package/lib/http/streaming/sse.d.ts +31 -0
- package/lib/http/streaming/sse.d.ts.map +1 -0
- package/lib/http/streaming/sse.js +11 -0
- package/lib/http/streaming/sse.js.map +1 -0
- package/lib/http/streaming/streamLLM.d.ts +94 -0
- package/lib/http/streaming/streamLLM.d.ts.map +1 -0
- package/lib/http/streaming/streamLLM.js +94 -0
- package/lib/http/streaming/streamLLM.js.map +1 -0
- package/lib/http/utils/authCookies.d.ts +74 -0
- package/lib/http/utils/authCookies.d.ts.map +1 -0
- package/lib/http/utils/authCookies.js +102 -0
- package/lib/http/utils/authCookies.js.map +1 -0
- package/lib/http/utils/clientIp.d.ts +85 -0
- package/lib/http/utils/clientIp.d.ts.map +1 -0
- package/lib/http/utils/clientIp.js +249 -0
- package/lib/http/utils/clientIp.js.map +1 -0
- package/lib/http/utils/index.d.ts +4 -0
- package/lib/http/utils/index.d.ts.map +1 -0
- package/lib/http/utils/index.js +5 -0
- package/lib/http/utils/index.js.map +1 -0
- package/lib/http/utils/metaTags.d.ts +49 -0
- package/lib/http/utils/metaTags.d.ts.map +1 -0
- package/lib/http/utils/metaTags.js +32 -0
- package/lib/http/utils/metaTags.js.map +1 -0
- package/lib/http/utils/publicSuffix.d.ts +34 -0
- package/lib/http/utils/publicSuffix.d.ts.map +1 -0
- package/lib/http/utils/publicSuffix.js +276 -0
- package/lib/http/utils/publicSuffix.js.map +1 -0
- package/lib/http/utils/uploads.d.ts +92 -0
- package/lib/http/utils/uploads.d.ts.map +1 -0
- package/lib/http/utils/uploads.js +126 -0
- package/lib/http/utils/uploads.js.map +1 -0
- package/lib/http/utils/validate.d.ts +41 -0
- package/lib/http/utils/validate.d.ts.map +1 -0
- package/lib/http/utils/validate.js +55 -0
- package/lib/http/utils/validate.js.map +1 -0
- package/lib/http/utils/webhooks.d.ts +63 -0
- package/lib/http/utils/webhooks.d.ts.map +1 -0
- package/lib/http/utils/webhooks.js +133 -0
- package/lib/http/utils/webhooks.js.map +1 -0
- package/lib/http/ws/auth.d.ts +46 -0
- package/lib/http/ws/auth.d.ts.map +1 -0
- package/lib/http/ws/auth.js +123 -0
- package/lib/http/ws/auth.js.map +1 -0
- package/lib/index.d.ts +80 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +61 -0
- package/lib/index.js.map +1 -0
- package/lib/kernel/index.d.ts +3 -0
- package/lib/kernel/index.d.ts.map +1 -0
- package/lib/kernel/index.js +3 -0
- package/lib/kernel/index.js.map +1 -0
- package/lib/libraries/.gitkeep +0 -0
- package/lib/libraries/ai/CHANGELOG.md +17 -0
- package/lib/libraries/ai/README.md +164 -0
- package/lib/libraries/ai/adapters/AnthropicAdapter.ts +382 -0
- package/lib/libraries/ai/adapters/LLMProvider.ts +76 -0
- package/lib/libraries/ai/adapters/OpenAIAdapter.ts +466 -0
- package/lib/libraries/ai/experimental/index.ts +20 -0
- package/lib/libraries/ai/index.ts +128 -0
- package/lib/libraries/ai/library.json +19 -0
- package/lib/libraries/ai/loop/agentLoop.ts +377 -0
- package/lib/libraries/ai/prompts/definePrompt.ts +0 -0
- package/lib/libraries/ai/rag/retrieveAndAnswer.ts +177 -0
- package/lib/libraries/ai/streaming/streamLLM.ts +94 -0
- package/lib/libraries/ai/structured/completeStructured.ts +143 -0
- package/lib/libraries/ai/tokens/Tokenizer.ts +216 -0
- package/lib/libraries/ai/tools/defineTool.ts +208 -0
- package/lib/libraries/ai/types.ts +260 -0
- package/lib/libraries/chunking/ChunkingService.ts +103 -0
- package/lib/libraries/chunking/README.md +104 -0
- package/lib/libraries/chunking/docs/api-reference.md +549 -0
- package/lib/libraries/chunking/docs/best-practices.md +321 -0
- package/lib/libraries/chunking/docs/code-organization.md +538 -0
- package/lib/libraries/chunking/docs/configuration.md +418 -0
- package/lib/libraries/chunking/docs/index.md +236 -0
- package/lib/libraries/chunking/docs/quick-start.md +298 -0
- package/lib/libraries/chunking/docs/strategies.md +407 -0
- package/lib/libraries/chunking/docs/summary.md +258 -0
- package/lib/libraries/chunking/docs/troubleshooting.md +527 -0
- package/lib/libraries/chunking/index.ts +17 -0
- package/lib/libraries/chunking/library.json +16 -0
- package/lib/libraries/chunking/strategies/ChunkingStrategy.ts +13 -0
- package/lib/libraries/chunking/strategies/FixedLengthChunkingStrategy.ts +88 -0
- package/lib/libraries/chunking/strategies/SemanticChunkingStrategy.ts +389 -0
- package/lib/libraries/chunking/strategies/SlidingWindowChunkingStrategy.ts +258 -0
- package/lib/libraries/chunking/types/index.ts +63 -0
- package/lib/libraries/email/EmailService.ts +591 -0
- package/lib/libraries/email/README.md +777 -0
- package/lib/libraries/email/TemplateRegistry.ts +148 -0
- package/lib/libraries/email/TemplateRenderer.ts +273 -0
- package/lib/libraries/email/index.ts +4 -0
- package/lib/libraries/email/initializeEmailService.ts +60 -0
- package/lib/libraries/email/library.json +12 -0
- package/lib/libraries/email/types/EmailAddress.ts +4 -0
- package/lib/libraries/email/types/EmailAttachment.ts +11 -0
- package/lib/libraries/email/types/EmailTag.ts +9 -0
- package/lib/libraries/email/types/EmailTemplate.ts +124 -0
- package/lib/libraries/email/types/SendBatchEmailsOptions.ts +9 -0
- package/lib/libraries/email/types/SendBatchEmailsResult.ts +9 -0
- package/lib/libraries/email/types/SendEmailOptions.ts +33 -0
- package/lib/libraries/email/types/SendEmailResult.ts +9 -0
- package/lib/libraries/email/types/index.ts +8 -0
- package/lib/libraries/weaviate/QueryBuilder.ts +292 -0
- package/lib/libraries/weaviate/README.md +284 -0
- package/lib/libraries/weaviate/Weaviate.ts +1419 -0
- package/lib/libraries/weaviate/WeaviateConfig.ts +268 -0
- package/lib/libraries/weaviate/docs/.gitkeep +1 -0
- package/lib/libraries/weaviate/docs/API_REFERENCE.md +1067 -0
- package/lib/libraries/weaviate/docs/CONFIGURATION.md +320 -0
- package/lib/libraries/weaviate/docs/ERROR_HANDLING.md +271 -0
- package/lib/libraries/weaviate/docs/MULTI_TENANCY.md +348 -0
- package/lib/libraries/weaviate/docs/PERFORMANCE.md +602 -0
- package/lib/libraries/weaviate/docs/PLUGIN_DEVELOPMENT.md +547 -0
- package/lib/libraries/weaviate/docs/QUICK_START.md +443 -0
- package/lib/libraries/weaviate/docs/README.md +269 -0
- package/lib/libraries/weaviate/docs/SCHEMA_GUIDE.md +630 -0
- package/lib/libraries/weaviate/docs/WEAVIATE_README.md +520 -0
- package/lib/libraries/weaviate/errors/WeaviateError.ts +92 -0
- package/lib/libraries/weaviate/errors/index.ts +1 -0
- package/lib/libraries/weaviate/index.ts +35 -0
- package/lib/libraries/weaviate/library.json +26 -0
- package/lib/libraries/weaviate/plugins/index.ts +2 -0
- package/lib/libraries/weaviate/schemas/SchemaRegistry.ts +284 -0
- package/lib/libraries/weaviate/schemas/index.ts +2 -0
- package/lib/libraries/weaviate/types/BM25SearchOptions.ts +9 -0
- package/lib/libraries/weaviate/types/ExtendedWeaviateClient.ts +7 -0
- package/lib/libraries/weaviate/types/HybridSearchOptions.ts +11 -0
- package/lib/libraries/weaviate/types/MultiTenancy.ts +81 -0
- package/lib/libraries/weaviate/types/Plugin.ts +17 -0
- package/lib/libraries/weaviate/types/SchemaConfig.ts +25 -0
- package/lib/libraries/weaviate/types/SearchMethod.ts +8 -0
- package/lib/libraries/weaviate/types/SearchOptions.ts +16 -0
- package/lib/libraries/weaviate/types/SearchRequest.ts +19 -0
- package/lib/libraries/weaviate/types/SearchResult.ts +16 -0
- package/lib/libraries/weaviate/types/SearchableField.ts +87 -0
- package/lib/libraries/weaviate/types/VectorIndexConfig.ts +19 -0
- package/lib/libraries/weaviate/types/VectorSearchOptions.ts +18 -0
- package/lib/libraries/weaviate/types/VectorizerConfig.ts +8 -0
- package/lib/libraries/weaviate/types/index.ts +29 -0
- package/lib/libraries/weaviate/utils/TenantContextManager.ts +94 -0
- package/lib/modules/accounts/index.ts +47 -0
- package/lib/modules/accounts/module.json +15 -0
- package/lib/modules/accounts/permissions.ts +33 -0
- package/lib/modules/accounts/routes.ts +200 -0
- package/lib/modules/accounts/schema.ts +219 -0
- package/lib/modules/accounts/services/AccountService.ts +44 -0
- package/lib/modules/accounts/validation/schemas.ts +70 -0
- package/lib/modules/oauth/adapters/GmailOAuthAdapter.ts +35 -0
- package/lib/modules/oauth/adapters/GoogleOAuthAdapter.ts +278 -0
- package/lib/modules/oauth/adapters/MicrosoftOAuthAdapter.ts +269 -0
- package/lib/modules/oauth/adapters/MockOAuthAdapter.ts +138 -0
- package/lib/modules/oauth/adapters/OAuthAdapter.ts +211 -0
- package/lib/modules/oauth/adapters/OAuthAdapterRegistry.ts +77 -0
- package/lib/modules/oauth/adapters/OutlookOAuthAdapter.ts +38 -0
- package/lib/modules/oauth/index.ts +79 -0
- package/lib/modules/oauth/module.json +23 -0
- package/lib/modules/oauth/permissions.ts +39 -0
- package/lib/modules/oauth/routes.ts +497 -0
- package/lib/modules/oauth/schema.ts +127 -0
- package/lib/modules/oauth/services/OAuthConnectionService.ts +147 -0
- package/lib/modules/oauth/state.ts +234 -0
- package/lib/modules/oauth/stateJtiCache.ts +85 -0
- package/lib/modules/oauth/verifyIdToken.ts +178 -0
- package/lib/modules/outbox/EventEmitter.ts +106 -0
- package/lib/modules/outbox/OutboxDrainer.ts +163 -0
- package/lib/modules/outbox/handlers/EventHandler.ts +115 -0
- package/lib/modules/outbox/index.ts +43 -0
- package/lib/modules/outbox/module.json +15 -0
- package/lib/modules/outbox/permissions.ts +36 -0
- package/lib/modules/outbox/routes.ts +219 -0
- package/lib/modules/outbox/schema.ts +207 -0
- package/lib/modules/outbox/services/OutboxEventService.ts +223 -0
- package/lib/observability/logger.d.ts +30 -0
- package/lib/observability/logger.d.ts.map +1 -0
- package/lib/observability/logger.js +110 -0
- package/lib/observability/logger.js.map +1 -0
- package/lib/observability/metrics.d.ts +3 -0
- package/lib/observability/metrics.d.ts.map +1 -0
- package/lib/observability/metrics.js +3 -0
- package/lib/observability/metrics.js.map +1 -0
- package/lib/observability/otel.d.ts +3 -0
- package/lib/observability/otel.d.ts.map +1 -0
- package/lib/observability/otel.js +3 -0
- package/lib/observability/otel.js.map +1 -0
- package/lib/observability/safeErrorFields.d.ts +14 -0
- package/lib/observability/safeErrorFields.d.ts.map +1 -0
- package/lib/observability/safeErrorFields.js +14 -0
- package/lib/observability/safeErrorFields.js.map +1 -0
- package/lib/observability/tracing.d.ts +3 -0
- package/lib/observability/tracing.d.ts.map +1 -0
- package/lib/observability/tracing.js +3 -0
- package/lib/observability/tracing.js.map +1 -0
- package/lib/package.json +4 -0
- package/lib/testing.d.ts +3 -0
- package/lib/testing.d.ts.map +1 -0
- package/lib/testing.js +3 -0
- package/lib/testing.js.map +1 -0
- package/package.json +193 -3
- package/templates/default/.claude/agents/qa-brief.md +106 -0
- package/templates/default/.claude/commands/sherpa-brief.md +23 -0
- package/templates/default/.cursor/rules/api.mdc +80 -0
- package/templates/default/.cursor/rules/commits.mdc +88 -0
- package/templates/default/.cursor/rules/security.mdc +92 -0
- package/templates/default/.cursor/rules/testing.mdc +123 -0
- package/templates/default/.cursor/rules/typescript.mdc +86 -0
- package/templates/default/.env.example +79 -0
- package/templates/default/.github/workflows/sherpa-brief.yml +180 -0
- package/templates/default/AGENTS.md +166 -0
- package/templates/default/CLAUDE.md +17 -0
- package/templates/default/README.md +97 -0
- package/templates/default/_gitignore +27 -0
- package/templates/default/docker-compose.yml +83 -0
- package/templates/default/drizzle.config.ts +34 -0
- package/templates/default/eslint.config.mjs +106 -0
- package/templates/default/package.json +57 -0
- package/templates/default/ship-api.config.ts +21 -0
- package/templates/default/src/client.ts +34 -0
- package/templates/default/src/config/modules.ts +23 -0
- package/templates/default/src/db/schema.ts +26 -0
- package/templates/default/src/environment.ts +81 -0
- package/templates/default/src/index.test.ts +53 -0
- package/templates/default/src/index.ts +11 -0
- package/templates/default/src/instrumentation.ts +13 -0
- package/templates/default/src/server.ts +90 -0
- package/templates/default/tsconfig.json +24 -0
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed client export — `@sixthsummit/ship-api/client`.
|
|
3
|
+
*
|
|
4
|
+
* The load-bearing subpath for the v4 cross-framework contract: schema
|
|
5
|
+
* changes propagate through TypeScript types end-to-end (Drizzle table →
|
|
6
|
+
* `drizzle-zod` schema → Hono route with `zValidator` → `c.req.valid()`
|
|
7
|
+
* → `hc<ShipApiClient>()` typed client) with **no codegen step**.
|
|
8
|
+
*
|
|
9
|
+
* Why a dedicated subpath: consumers (ShipAngular web, React Native +
|
|
10
|
+
* Expo mobile, internal microservices) only need `hono/client`'s tiny
|
|
11
|
+
* runtime — pulling the full framework barrel would drag in pino /
|
|
12
|
+
* BullMQ / OpenTelemetry / Drizzle / pg, which the client side neither
|
|
13
|
+
* needs nor can run (Hono client is universal; the framework runtime is
|
|
14
|
+
* Node-only). This file re-exports `hc` + the types `hc()` consumers
|
|
15
|
+
* actually use, so the dependency graph stays narrow.
|
|
16
|
+
*
|
|
17
|
+
* # Consumer pattern
|
|
18
|
+
*
|
|
19
|
+
* The consumer's app file pins the typed client by aliasing `typeof app`:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* // src/app.ts (server)
|
|
23
|
+
* import { createApp } from "@sixthsummit/ship-api";
|
|
24
|
+
* const app = createApp();
|
|
25
|
+
* // …register module routes…
|
|
26
|
+
* export type ShipApiClient = typeof app;
|
|
27
|
+
* export { app };
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The web / mobile / microservice consumer imports the type only — no
|
|
31
|
+
* runtime cost — and instantiates `hc<ShipApiClient>()`:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // src/api.ts (client)
|
|
35
|
+
* import { hc, type InferRequestType, type InferResponseType }
|
|
36
|
+
* from "@sixthsummit/ship-api/client";
|
|
37
|
+
* import type { ShipApiClient } from "@my-org/api/app";
|
|
38
|
+
*
|
|
39
|
+
* export const api = hc<ShipApiClient>(import.meta.env.VITE_API_BASE_URL, {
|
|
40
|
+
* init: { credentials: "include" }, // forward auth cookies
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const me = await api.me.$get();
|
|
44
|
+
* if (me.ok) {
|
|
45
|
+
* const account = await me.json(); // typed end-to-end
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* # Why not export a fixed `ShipApiClient` from the framework
|
|
50
|
+
*
|
|
51
|
+
* The framework registers no application routes itself — `createApp()`
|
|
52
|
+
* returns an empty `Hono<AppEnv>`; modules add the routes the consumer
|
|
53
|
+
* cares about. A framework-side `ShipApiClient` type would describe the
|
|
54
|
+
* framework's own routes (none), not the consumer's. The consumer aliases
|
|
55
|
+
* `typeof app` after their modules register, so the type reflects exactly
|
|
56
|
+
* the routes the consumer's app exposes.
|
|
57
|
+
*
|
|
58
|
+
* # Type-preservation note (sub-apps, mounted at root)
|
|
59
|
+
*
|
|
60
|
+
* Hono's RPC client typing flows through the chained return values of
|
|
61
|
+
* `app.METHOD(...)`. Each module builds its own bounded chain on a fresh
|
|
62
|
+
* `createModuleApp("name")` and the consumer mounts every module onto the
|
|
63
|
+
* root with `root.route("/", subApp)` — modules keep their **absolute**
|
|
64
|
+
* paths, so the client shape and the route registry are identical to a
|
|
65
|
+
* single flat app:
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* const root = createApp({ cors });
|
|
69
|
+
* registerErrorHandlers(root); // root owns cross-cutting concerns
|
|
70
|
+
* root.use("*", httpLogger());
|
|
71
|
+
* const app = root
|
|
72
|
+
* .route("/", buildAccountsApp({ service, provider }))
|
|
73
|
+
* .route("/", buildOAuthApp({ ... }));
|
|
74
|
+
* export type ShipApiClient = typeof app; // api.accounts.$get — flat shape
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Mounting each module as its own sub-app (rather than chaining every
|
|
78
|
+
* module's routes onto one app) keeps each TypeScript route-type
|
|
79
|
+
* instantiation bounded, so the typed client scales to many modules
|
|
80
|
+
* without `tsc` blowing its instantiation budget.
|
|
81
|
+
*
|
|
82
|
+
* Module route functions still return the chained app AND stay generic
|
|
83
|
+
* over Hono's schema parameter — `.get()`/`.post()` resolve on the
|
|
84
|
+
* parameter's declared type, so a plain `(app: Hono<AppEnv>)` signature
|
|
85
|
+
* widens an already-chained app and erases every previously registered
|
|
86
|
+
* route from the client type (as does `<T extends Hono<AppEnv>>`, which
|
|
87
|
+
* resolves the methods on the constraint):
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* export const meRoutes = <S extends Schema>(app: Hono<AppEnv, S>) =>
|
|
91
|
+
* app.get("/me", requireAuth(), handler);
|
|
92
|
+
* // returns Hono<AppEnv, S & {me route}> — types accumulate per module
|
|
93
|
+
*
|
|
94
|
+
* export const buildMeApp = () => meRoutes(createModuleApp("me"));
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export { type ApplyGlobalResponse, type ClientRequest, type ClientRequestOptions, type ClientResponse, DetailedError, type Fetch, hc, type InferRequestType, type InferResponseType, type PickResponseByStatusCode, parseResponse, } from "hono/client";
|
|
98
|
+
/**
|
|
99
|
+
* Optional helper alias — for consumers who want a single named type to
|
|
100
|
+
* pass around their codebase. Equivalent to `ReturnType<typeof hc<TApp>>`
|
|
101
|
+
* but without the generic instantiation noise.
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* import type { ShipApiClient as InferShipApiClient }
|
|
105
|
+
* from "@sixthsummit/ship-api/client";
|
|
106
|
+
* import type { ShipApiClient } from "@my-org/api/app";
|
|
107
|
+
*
|
|
108
|
+
* export type Api = InferShipApiClient<ShipApiClient>;
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* Type-only alias — costs zero bundle bytes.
|
|
112
|
+
*/
|
|
113
|
+
export type ShipApiClient<TApp extends import("hono").Hono<any, any, any>> = ReturnType<typeof import("hono/client").hc<TApp>>;
|
|
114
|
+
/**
|
|
115
|
+
* `hc()` client narrowed to **success-status** responses (200 | 201) only.
|
|
116
|
+
*
|
|
117
|
+
* ShipAPI shapes every error response centrally — `registerErrorHandlers(app)`
|
|
118
|
+
* turns the AppError taxonomy into a uniform JSON envelope, and the typed
|
|
119
|
+
* client's custom `fetch` handles non-2xx (401 refresh/retry) before your
|
|
120
|
+
* code sees the response. When errors are handled centrally like this, the
|
|
121
|
+
* client doesn't need each route's error-body union; narrowing to the success
|
|
122
|
+
* status simplifies callsite types (`await res.json()` is the 200 body, no
|
|
123
|
+
* `res.ok` discriminator needed) and trims the per-route type the client
|
|
124
|
+
* carries:
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* import { hc, type ShipApiSuccessClient } from "@sixthsummit/ship-api/client";
|
|
128
|
+
* import type { ShipApiClient as App } from "@my-org/api";
|
|
129
|
+
*
|
|
130
|
+
* // success-only — drops 4xx/5xx response shapes from the client type:
|
|
131
|
+
* const api: ShipApiSuccessClient<App> = hc(BASE_URL, { init: { credentials: "include" } });
|
|
132
|
+
* const account = await (await api.accounts[":id"].$get({ param: { id } })).json();
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* Reach for the plain `hc<App>()` form only on the rare route where you need
|
|
136
|
+
* to read a typed error body. Type-only alias — costs zero bundle bytes.
|
|
137
|
+
*/
|
|
138
|
+
export type ShipApiSuccessClient<TApp extends import("hono").Hono<any, any, any>> = ReturnType<typeof import("hono/client").hc<import("hono/client").PickResponseByStatusCode<TApp, 200 | 201>>>;
|
|
139
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,aAAa,EACb,KAAK,KAAK,EACV,EAAE,EACF,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,aAAa,GACd,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,OAAO,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CACrF,cAAc,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,CACtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,OAAO,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CAC5F,cAAc,aAAa,EAAE,EAAE,CAAC,OAAO,aAAa,EAAE,wBAAwB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CACjG,CAAC"}
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed client export — `@sixthsummit/ship-api/client`.
|
|
3
|
+
*
|
|
4
|
+
* The load-bearing subpath for the v4 cross-framework contract: schema
|
|
5
|
+
* changes propagate through TypeScript types end-to-end (Drizzle table →
|
|
6
|
+
* `drizzle-zod` schema → Hono route with `zValidator` → `c.req.valid()`
|
|
7
|
+
* → `hc<ShipApiClient>()` typed client) with **no codegen step**.
|
|
8
|
+
*
|
|
9
|
+
* Why a dedicated subpath: consumers (ShipAngular web, React Native +
|
|
10
|
+
* Expo mobile, internal microservices) only need `hono/client`'s tiny
|
|
11
|
+
* runtime — pulling the full framework barrel would drag in pino /
|
|
12
|
+
* BullMQ / OpenTelemetry / Drizzle / pg, which the client side neither
|
|
13
|
+
* needs nor can run (Hono client is universal; the framework runtime is
|
|
14
|
+
* Node-only). This file re-exports `hc` + the types `hc()` consumers
|
|
15
|
+
* actually use, so the dependency graph stays narrow.
|
|
16
|
+
*
|
|
17
|
+
* # Consumer pattern
|
|
18
|
+
*
|
|
19
|
+
* The consumer's app file pins the typed client by aliasing `typeof app`:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* // src/app.ts (server)
|
|
23
|
+
* import { createApp } from "@sixthsummit/ship-api";
|
|
24
|
+
* const app = createApp();
|
|
25
|
+
* // …register module routes…
|
|
26
|
+
* export type ShipApiClient = typeof app;
|
|
27
|
+
* export { app };
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The web / mobile / microservice consumer imports the type only — no
|
|
31
|
+
* runtime cost — and instantiates `hc<ShipApiClient>()`:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // src/api.ts (client)
|
|
35
|
+
* import { hc, type InferRequestType, type InferResponseType }
|
|
36
|
+
* from "@sixthsummit/ship-api/client";
|
|
37
|
+
* import type { ShipApiClient } from "@my-org/api/app";
|
|
38
|
+
*
|
|
39
|
+
* export const api = hc<ShipApiClient>(import.meta.env.VITE_API_BASE_URL, {
|
|
40
|
+
* init: { credentials: "include" }, // forward auth cookies
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const me = await api.me.$get();
|
|
44
|
+
* if (me.ok) {
|
|
45
|
+
* const account = await me.json(); // typed end-to-end
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* # Why not export a fixed `ShipApiClient` from the framework
|
|
50
|
+
*
|
|
51
|
+
* The framework registers no application routes itself — `createApp()`
|
|
52
|
+
* returns an empty `Hono<AppEnv>`; modules add the routes the consumer
|
|
53
|
+
* cares about. A framework-side `ShipApiClient` type would describe the
|
|
54
|
+
* framework's own routes (none), not the consumer's. The consumer aliases
|
|
55
|
+
* `typeof app` after their modules register, so the type reflects exactly
|
|
56
|
+
* the routes the consumer's app exposes.
|
|
57
|
+
*
|
|
58
|
+
* # Type-preservation note (sub-apps, mounted at root)
|
|
59
|
+
*
|
|
60
|
+
* Hono's RPC client typing flows through the chained return values of
|
|
61
|
+
* `app.METHOD(...)`. Each module builds its own bounded chain on a fresh
|
|
62
|
+
* `createModuleApp("name")` and the consumer mounts every module onto the
|
|
63
|
+
* root with `root.route("/", subApp)` — modules keep their **absolute**
|
|
64
|
+
* paths, so the client shape and the route registry are identical to a
|
|
65
|
+
* single flat app:
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* const root = createApp({ cors });
|
|
69
|
+
* registerErrorHandlers(root); // root owns cross-cutting concerns
|
|
70
|
+
* root.use("*", httpLogger());
|
|
71
|
+
* const app = root
|
|
72
|
+
* .route("/", buildAccountsApp({ service, provider }))
|
|
73
|
+
* .route("/", buildOAuthApp({ ... }));
|
|
74
|
+
* export type ShipApiClient = typeof app; // api.accounts.$get — flat shape
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Mounting each module as its own sub-app (rather than chaining every
|
|
78
|
+
* module's routes onto one app) keeps each TypeScript route-type
|
|
79
|
+
* instantiation bounded, so the typed client scales to many modules
|
|
80
|
+
* without `tsc` blowing its instantiation budget.
|
|
81
|
+
*
|
|
82
|
+
* Module route functions still return the chained app AND stay generic
|
|
83
|
+
* over Hono's schema parameter — `.get()`/`.post()` resolve on the
|
|
84
|
+
* parameter's declared type, so a plain `(app: Hono<AppEnv>)` signature
|
|
85
|
+
* widens an already-chained app and erases every previously registered
|
|
86
|
+
* route from the client type (as does `<T extends Hono<AppEnv>>`, which
|
|
87
|
+
* resolves the methods on the constraint):
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* export const meRoutes = <S extends Schema>(app: Hono<AppEnv, S>) =>
|
|
91
|
+
* app.get("/me", requireAuth(), handler);
|
|
92
|
+
* // returns Hono<AppEnv, S & {me route}> — types accumulate per module
|
|
93
|
+
*
|
|
94
|
+
* export const buildMeApp = () => meRoutes(createModuleApp("me"));
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export { DetailedError, hc, parseResponse, } from "hono/client";
|
|
98
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AAEH,OAAO,EAKL,aAAa,EAEb,EAAE,EAIF,aAAa,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/contract/application.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,mBAAmB,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/contract/application.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/contract/client.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/contract/client.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/contract/manifest.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,mBAAmB,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/contract/manifest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/contract/openapi.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/contract/openapi.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/contract/project.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/contract/project.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/contract/schema.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/contract/schema.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drizzle/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drizzle/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type HeaderCredential, type HonoAuthenticationOptions } from "@sixthsummit/ship-hono";
|
|
2
|
+
import type { AuthenticatedAccount, AuthProvider } from "../app/auth/AuthProvider.js";
|
|
3
|
+
export * from "@sixthsummit/ship-hono";
|
|
4
|
+
/** @deprecated Migration bridge for the monolithic v4 AuthProvider contract. */
|
|
5
|
+
export declare function honoAuthProvider<TAccount extends AuthenticatedAccount>(provider: AuthProvider<TAccount>): HonoAuthenticationOptions<HeaderCredential>;
|
|
6
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/hono/auth.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAE/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEtF,cAAc,wBAAwB,CAAC;AAEvC,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,oBAAoB,EACpE,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC/B,yBAAyB,CAAC,gBAAgB,CAAC,CAyC7C"}
|
package/lib/hono/auth.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineActorResolver, operationActor } from "@sixthsummit/ship-core";
|
|
2
|
+
import { requestHeadersCredential, } from "@sixthsummit/ship-hono";
|
|
3
|
+
export * from "@sixthsummit/ship-hono";
|
|
4
|
+
/** @deprecated Migration bridge for the monolithic v4 AuthProvider contract. */
|
|
5
|
+
export function honoAuthProvider(provider) {
|
|
6
|
+
const actors = defineActorResolver({
|
|
7
|
+
id: `v4.${normalizeResolverId(provider.name)}`,
|
|
8
|
+
resolve: async ({ credential, operation }) => {
|
|
9
|
+
try {
|
|
10
|
+
const verification = await provider.verify({ headers: credential ?? {} });
|
|
11
|
+
if (!verification.ok) {
|
|
12
|
+
if (verification.reason === "missing-token")
|
|
13
|
+
return Object.freeze({ ok: true });
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
ok: false,
|
|
16
|
+
reason: verification.reason === "provider-error"
|
|
17
|
+
? "unavailable"
|
|
18
|
+
: "invalid-credential",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const account = await provider.resolve(verification.claims);
|
|
22
|
+
if (account === null) {
|
|
23
|
+
return provider.onUnknownAccount === "next"
|
|
24
|
+
? Object.freeze({ ok: true })
|
|
25
|
+
: Object.freeze({ ok: false, reason: "forbidden" });
|
|
26
|
+
}
|
|
27
|
+
const granted = [];
|
|
28
|
+
if (operation.access.kind === "permissions" && account.hasPermission) {
|
|
29
|
+
for (const permission of operation.access.permissions) {
|
|
30
|
+
if (await account.hasPermission(permission))
|
|
31
|
+
granted.push(permission);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
ok: true,
|
|
36
|
+
actor: operationActor({ id: account.id, permissions: granted }),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return Object.freeze({ ok: false, reason: "unavailable" });
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return Object.freeze({ credentials: requestHeadersCredential(), actors });
|
|
45
|
+
}
|
|
46
|
+
function normalizeResolverId(value) {
|
|
47
|
+
const normalized = value
|
|
48
|
+
.trim()
|
|
49
|
+
.toLowerCase()
|
|
50
|
+
.replace(/[^a-z0-9-]+/gu, "-")
|
|
51
|
+
.replace(/^-+|-+$/gu, "");
|
|
52
|
+
return normalized.length > 0 && /^[a-z]/u.test(normalized) ? normalized : "provider";
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/hono/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAGL,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,cAAc,wBAAwB,CAAC;AAEvC,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAC9B,QAAgC;IAEhC,MAAM,MAAM,GAAG,mBAAmB,CAAmB;QACnD,EAAE,EAAE,MAAM,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9C,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC1E,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;oBACrB,IAAI,YAAY,CAAC,MAAM,KAAK,eAAe;wBAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAa,EAAE,CAAC,CAAC;oBACzF,OAAO,MAAM,CAAC,MAAM,CAAC;wBACnB,EAAE,EAAE,KAAc;wBAClB,MAAM,EACJ,YAAY,CAAC,MAAM,KAAK,gBAAgB;4BACtC,CAAC,CAAE,aAAuB;4BAC1B,CAAC,CAAE,oBAA8B;qBACtC,CAAC,CAAC;gBACL,CAAC;gBAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBAC5D,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;oBACrB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,MAAM;wBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAa,EAAE,CAAC;wBACtC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAc,EAAE,MAAM,EAAE,WAAoB,EAAE,CAAC,CAAC;gBAC1E,CAAC;gBAED,MAAM,OAAO,GAAa,EAAE,CAAC;gBAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;oBACrE,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;wBACtD,IAAI,MAAM,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC;4BAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACxE,CAAC;gBACH,CAAC;gBACD,OAAO,MAAM,CAAC,MAAM,CAAC;oBACnB,EAAE,EAAE,IAAa;oBACjB,KAAK,EAAE,cAAc,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;iBAChE,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAc,EAAE,MAAM,EAAE,aAAsB,EAAE,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,MAAM,UAAU,GAAG,KAAK;SACrB,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { type Context, type Env, Hono } from "hono";
|
|
2
|
+
import { type RouteRegistry } from "../../app/registry/routes.js";
|
|
3
|
+
import { type RegisterHealthRoutesOptions } from "./health.js";
|
|
4
|
+
/**
|
|
5
|
+
* The framework's standard `Hono.Env` shape — what `c.get(...)` is keyed by.
|
|
6
|
+
* Consumers extend this in their own `AppEnv` type if they want richer
|
|
7
|
+
* variables (e.g., a typed `db` set by an init middleware).
|
|
8
|
+
*/
|
|
9
|
+
export interface AppEnvVariables {
|
|
10
|
+
requestId?: string;
|
|
11
|
+
/** Authenticated account, set by `requireAuth`. Type is widened to keep the
|
|
12
|
+
* framework agnostic of the resolved account shape. */
|
|
13
|
+
user?: unknown;
|
|
14
|
+
/** Per-request scoped logger (child of the framework `logger`). */
|
|
15
|
+
logger?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface AppEnv extends Env {
|
|
18
|
+
Variables: AppEnvVariables;
|
|
19
|
+
}
|
|
20
|
+
export interface CorsOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Allowed origins. Accepts a single origin string, an explicit
|
|
23
|
+
* allowlist, or a per-request resolver that returns the matched
|
|
24
|
+
* origin (or `null`/`undefined` to deny).
|
|
25
|
+
*
|
|
26
|
+
* `"*"` (wildcard) is permitted **only** when `credentials !== true` —
|
|
27
|
+
* the wildcard + credentials combination is rejected by browsers
|
|
28
|
+
* per the CORS spec and is the single most common framework
|
|
29
|
+
* misconfig in production. We throw at config time so the failure
|
|
30
|
+
* mode is "boot error" not "subtle CSRF defense bypass at runtime."
|
|
31
|
+
*/
|
|
32
|
+
origin: string | readonly string[] | ((origin: string, c: Context) => string | null | undefined);
|
|
33
|
+
/** Methods allowed on cross-origin requests. */
|
|
34
|
+
allowMethods?: readonly string[];
|
|
35
|
+
/** Request headers permitted via the `Access-Control-Allow-Headers` response. */
|
|
36
|
+
allowHeaders?: readonly string[];
|
|
37
|
+
/** Response headers the browser exposes to client JS. */
|
|
38
|
+
exposeHeaders?: readonly string[];
|
|
39
|
+
/** Preflight cache duration in seconds (`Access-Control-Max-Age`). */
|
|
40
|
+
maxAge?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to allow credentials (cookies, Authorization headers). For
|
|
43
|
+
* cookie-auth flows in this framework — the default — this must be
|
|
44
|
+
* `true` *and* `origin` must be an explicit allowlist (not `"*"`).
|
|
45
|
+
*/
|
|
46
|
+
credentials?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface CreateAppOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Inject an alternative registry (tests). Defaults to the framework-wide
|
|
51
|
+
* `routeRegistry` singleton.
|
|
52
|
+
*/
|
|
53
|
+
registry?: RouteRegistry;
|
|
54
|
+
/**
|
|
55
|
+
* CORS configuration. When supplied, `hono/cors` is wired as global
|
|
56
|
+
* middleware ahead of any route registration. The framework rejects
|
|
57
|
+
* the wildcard + credentials combination at config time — that
|
|
58
|
+
* pairing is spec-invalid and silently bypasses CSRF defenses if
|
|
59
|
+
* the browser ever honors it (some non-browser HTTP clients do).
|
|
60
|
+
*
|
|
61
|
+
* For a typical multi-tenant SaaS:
|
|
62
|
+
* `cors: { origin: env.CORS_ORIGINS, credentials: true }`
|
|
63
|
+
* where `CORS_ORIGINS` is an env-driven `https://app.example.com,
|
|
64
|
+
* https://admin.example.com` allowlist.
|
|
65
|
+
*/
|
|
66
|
+
cors?: CorsOptions;
|
|
67
|
+
/**
|
|
68
|
+
* Health routes. By default `createApp` mounts unauthenticated
|
|
69
|
+
* `GET /livez` and `GET /readyz` (backed by the framework-wide
|
|
70
|
+
* `healthCheckRegistry`) before anything else is registered, so consumer
|
|
71
|
+
* middleware added afterwards — `requireAuth`, rate limiting, `httpLogger`
|
|
72
|
+
* — never runs for them. They are not added to the route registry.
|
|
73
|
+
*
|
|
74
|
+
* Pass an object to configure them (`prefix`, `readyzTimeoutMs`,
|
|
75
|
+
* `registry` — the same options as `registerHealthRoutes`), or `false` to
|
|
76
|
+
* mount nothing and wire them yourself. Default `{}` (mounted at root,
|
|
77
|
+
* 3-second per-check timeout).
|
|
78
|
+
*/
|
|
79
|
+
health?: false | RegisterHealthRoutesOptions;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* `Hono<AppEnv>` factory with route-method interception.
|
|
83
|
+
*
|
|
84
|
+
* Every `app.get/post/put/patch/delete` call is wrapped: the wrapper walks
|
|
85
|
+
* the passed handlers, reads any framework metadata tags, pushes a
|
|
86
|
+
* `RouteEntry` to the registry, then delegates to Hono's real method.
|
|
87
|
+
*
|
|
88
|
+
* User code looks identical to plain Hono — no `defineRoute` ceremony, no
|
|
89
|
+
* decorators, no codegen. The metadata is captured invisibly.
|
|
90
|
+
*
|
|
91
|
+
* Routes registered without `validate` / `requireAuth` are still captured —
|
|
92
|
+
* just schema-less / anonymous, which is *correct*: agents see exactly what's
|
|
93
|
+
* there, including unprotected endpoints (which the `ship-reviewer` agent
|
|
94
|
+
* can flag as convention violations).
|
|
95
|
+
*/
|
|
96
|
+
export declare function createApp(opts?: CreateAppOptions): Hono<AppEnv>;
|
|
97
|
+
export interface CreateModuleAppOptions {
|
|
98
|
+
/** Inject an alternative registry (tests). Defaults to the framework-wide
|
|
99
|
+
* `routeRegistry` singleton — the same one `createApp` populates. */
|
|
100
|
+
registry?: RouteRegistry;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* `Hono<AppEnv>` factory for a **module sub-app** — the building block of the
|
|
104
|
+
* v4 mount-at-root composition.
|
|
105
|
+
*
|
|
106
|
+
* A module's `defineXxxRoutes(createModuleApp("xxx"), deps)` builds its own
|
|
107
|
+
* bounded route chain on a fresh app, which the consumer mounts onto the root
|
|
108
|
+
* with `root.route("/", buildXxxApp(deps))`. Splitting each module into its
|
|
109
|
+
* own sub-app (rather than chaining every module's routes onto one app) keeps
|
|
110
|
+
* each TypeScript route-type instantiation bounded, so the `hc()` typed client
|
|
111
|
+
* scales to many modules without `tsc` blowing its instantiation budget.
|
|
112
|
+
*
|
|
113
|
+
* Identical to `createApp` except:
|
|
114
|
+
* - it wires **no CORS** and is not meant to be the server root (global
|
|
115
|
+
* cross-cutting middleware — `cors`, `httpLogger`, `registerErrorHandlers`
|
|
116
|
+
* — belong on the root app the sub-app is mounted onto, never here);
|
|
117
|
+
* - every captured `RouteEntry` is stamped with `module`, lighting up the
|
|
118
|
+
* Module column in `/dev/routes` and the `module` filter in `list_routes`;
|
|
119
|
+
* - `app.onError`, `app.notFound`, and global `app.use("*", …)` are
|
|
120
|
+
* **guarded** — they throw at dev time, because a sub-app error/not-found
|
|
121
|
+
* handler silently shadows the root's uniform AppError shape and global
|
|
122
|
+
* sub-app middleware breaks the root-wraps-everything ordering. (Per-route
|
|
123
|
+
* middleware — `requireAuth`/`requirePermission`/`validate` passed as route
|
|
124
|
+
* handlers — and **path-scoped** `app.use("/x/*", …)` are still allowed.)
|
|
125
|
+
*
|
|
126
|
+
* Because module sub-apps register their **absolute** paths (`/accounts`,
|
|
127
|
+
* `/accounts/:id`) and are mounted at the root (`route("/", …)`), the registry
|
|
128
|
+
* records the same absolute paths it always has — `execute_route`,
|
|
129
|
+
* `find_route_collisions`, and `/dev/routes` need no prefix math.
|
|
130
|
+
*/
|
|
131
|
+
export declare function createModuleApp(moduleName: string, opts?: CreateModuleAppOptions): Hono<AppEnv>;
|
|
132
|
+
//# sourceMappingURL=createApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../../../src/http/app/createApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,IAAI,EAA0B,MAAM,MAAM,CAAC;AAE5E,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AActC,OAAO,EAAE,KAAK,2BAA2B,EAAwB,MAAM,aAAa,CAAC;AAErF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;4DACwD;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,MAAO,SAAQ,GAAG;IACjC,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACjG,gDAAgD;IAChD,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iFAAiF;IACjF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,yDAAyD;IACzD,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,2BAA2B,CAAC;CAC9C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,gBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,CAsCnE;AAED,MAAM,WAAW,sBAAsB;IACrC;0EACsE;IACtE,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,sBAA2B,GAChC,IAAI,CAAC,MAAM,CAAC,CAMd"}
|