@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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MiddlewareHandler } from "hono";
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* Drop-in replacement for `@hono/zod-validator`'s `zValidator(...)` that
|
|
5
|
+
* additionally tags the returned middleware so `createApp`'s route-method
|
|
6
|
+
* interceptors can capture the schema in the route registry.
|
|
7
|
+
*
|
|
8
|
+
* Same call shape as `zValidator`:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { validate } from "@sixthsummit/ship-api/http/utils/validate";
|
|
12
|
+
*
|
|
13
|
+
* app.post(
|
|
14
|
+
* '/accounts',
|
|
15
|
+
* requireAuth(),
|
|
16
|
+
* requirePermission('accounts:create'),
|
|
17
|
+
* validate('json', createAccountSchema),
|
|
18
|
+
* async (c) => {
|
|
19
|
+
* const body = c.req.valid('json'); // typed via z.infer
|
|
20
|
+
* ...
|
|
21
|
+
* },
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The function is generic over the validation target and the Zod schema so
|
|
26
|
+
* the typed middleware return flows through Hono's chain and `c.req.valid()`
|
|
27
|
+
* is fully typed downstream — matching `zValidator`'s native behavior.
|
|
28
|
+
*
|
|
29
|
+
* Validation errors throw `ValidationError` (preserving the framework's
|
|
30
|
+
* AppError taxonomy) so `app.onError(...)` produces the same response shape
|
|
31
|
+
* the v3 stack used. The first issue's `path` joins to a dotted name to
|
|
32
|
+
* match v3's `ValidationMiddleware` error message format.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validate<Target extends "json" | "query" | "param" | "header", T extends ZodType>(target: Target, schema: T, meta?: {
|
|
35
|
+
description?: string;
|
|
36
|
+
example?: unknown;
|
|
37
|
+
}): MiddlewareHandler<import("hono").Env, string, {
|
|
38
|
+
in: (undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) ? true : false) extends true ? { [K in Target]?: ([T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never] extends [import("hono").ValidationTargets[K]] ? import("hono").ValidationTargets[K] & (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, undefined>] extends [never] ? {} : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, undefined>] extends [object] ? undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) ? ((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) & undefined) | (((Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) & undefined> extends infer T_3 ? { [K_4 in keyof T_3]: ([Exclude<T_3[K_4], undefined>] extends [string] ? [string & Exclude<T_3[K_4], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_3[K_4], undefined>>] ? false : true : false) extends true ? T_3[K_4] : ([unknown] extends [T_3[K_4]] ? false : undefined extends T_3[K_4] ? true : false) extends true ? T_3[K_4] : Target_1 extends "form" ? T$1 | T$1[] : Target_1 extends "query" ? string | string[] : Target_1 extends "param" ? string : Target_1 extends "header" ? string : Target_1 extends "cookie" ? string : unknown; } : never) extends infer T_2 ? { [K_3 in keyof T_2]: T_2[K_3]; } : never) extends infer T_1 ? { [K_2 in keyof T_1]: T_1[K_2]; } : never) : (((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) extends infer T_6 ? { [K_7 in keyof T_6]: ([Exclude<T_6[K_7], undefined>] extends [string] ? [string & Exclude<T_6[K_7], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_6[K_7], undefined>>] ? false : true : false) extends true ? T_6[K_7] : ([unknown] extends [T_6[K_7]] ? false : undefined extends T_6[K_7] ? true : false) extends true ? T_6[K_7] : Target_1 extends "form" ? T$1 | T$1[] : Target_1 extends "query" ? string | string[] : Target_1 extends "param" ? string : Target_1 extends "header" ? string : Target_1 extends "cookie" ? string : unknown; } : never) extends infer T_5 ? { [K_6 in keyof T_5]: T_5[K_6]; } : never) extends infer T_4 ? { [K_5 in keyof T_4]: T_4[K_5]; } : never : {}) | undefined; } : { [K_1 in Target]: [T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never] extends [import("hono").ValidationTargets[K_1]] ? import("hono").ValidationTargets[K_1] & (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, undefined>] extends [never] ? {} : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, undefined>] extends [object] ? undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) ? ((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) & undefined) | (((Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never, (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) & undefined> extends infer T_3 ? { [K_5 in keyof T_3]: ([Exclude<T_3[K_5], undefined>] extends [string] ? [string & Exclude<T_3[K_5], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_3[K_5], undefined>>] ? false : true : false) extends true ? T_3[K_5] : ([unknown] extends [T_3[K_5]] ? false : undefined extends T_3[K_5] ? true : false) extends true ? T_3[K_5] : Target_1 extends "form" ? T$1 | T$1[] : Target_1 extends "query" ? string | string[] : Target_1 extends "param" ? string : Target_1 extends "header" ? string : Target_1 extends "cookie" ? string : unknown; } : never) extends infer T_2 ? { [K_4 in keyof T_2]: T_2[K_4]; } : never) extends infer T_1 ? { [K_3 in keyof T_1]: T_1[K_3]; } : never) : (((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod/v4/core").input<T> : never) extends infer T_6 ? { [K_8 in keyof T_6]: ([Exclude<T_6[K_8], undefined>] extends [string] ? [string & Exclude<T_6[K_8], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_6[K_8], undefined>>] ? false : true : false) extends true ? T_6[K_8] : ([unknown] extends [T_6[K_8]] ? false : undefined extends T_6[K_8] ? true : false) extends true ? T_6[K_8] : Target_1 extends "form" ? T$1 | T$1[] : Target_1 extends "query" ? string | string[] : Target_1 extends "param" ? string : Target_1 extends "header" ? string : Target_1 extends "cookie" ? string : unknown; } : never) extends infer T_5 ? { [K_7 in keyof T_5]: T_5[K_7]; } : never) extends infer T_4 ? { [K_6 in keyof T_4]: T_4[K_6]; } : never : {}; };
|
|
39
|
+
out: { [K_2 in Target]: T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").output<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<T> : never; };
|
|
40
|
+
}, never>;
|
|
41
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/http/utils/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,KAAK,CAAC;AAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,MAAM,SAAS,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAC,SAAS,OAAO,EAC9F,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE;;;UAsBnD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { zValidator as honoZodValidator } from "@hono/zod-validator";
|
|
2
|
+
import { ValidationError } from "../errors/ValidationError.js";
|
|
3
|
+
import { SCHEMA_META, setMetaTag } from "./metaTags.js";
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in replacement for `@hono/zod-validator`'s `zValidator(...)` that
|
|
6
|
+
* additionally tags the returned middleware so `createApp`'s route-method
|
|
7
|
+
* interceptors can capture the schema in the route registry.
|
|
8
|
+
*
|
|
9
|
+
* Same call shape as `zValidator`:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { validate } from "@sixthsummit/ship-api/http/utils/validate";
|
|
13
|
+
*
|
|
14
|
+
* app.post(
|
|
15
|
+
* '/accounts',
|
|
16
|
+
* requireAuth(),
|
|
17
|
+
* requirePermission('accounts:create'),
|
|
18
|
+
* validate('json', createAccountSchema),
|
|
19
|
+
* async (c) => {
|
|
20
|
+
* const body = c.req.valid('json'); // typed via z.infer
|
|
21
|
+
* ...
|
|
22
|
+
* },
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The function is generic over the validation target and the Zod schema so
|
|
27
|
+
* the typed middleware return flows through Hono's chain and `c.req.valid()`
|
|
28
|
+
* is fully typed downstream — matching `zValidator`'s native behavior.
|
|
29
|
+
*
|
|
30
|
+
* Validation errors throw `ValidationError` (preserving the framework's
|
|
31
|
+
* AppError taxonomy) so `app.onError(...)` produces the same response shape
|
|
32
|
+
* the v3 stack used. The first issue's `path` joins to a dotted name to
|
|
33
|
+
* match v3's `ValidationMiddleware` error message format.
|
|
34
|
+
*/
|
|
35
|
+
export function validate(target, schema, meta) {
|
|
36
|
+
const middleware = honoZodValidator(target, schema, ((result) => {
|
|
37
|
+
if (!result.success) {
|
|
38
|
+
const first = result.error.issues[0];
|
|
39
|
+
const path = first?.path?.length ? first.path.join(".") : target;
|
|
40
|
+
const message = first?.message ?? "Invalid request";
|
|
41
|
+
throw new ValidationError(`${path}: ${message}`);
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
const tag = {
|
|
45
|
+
target,
|
|
46
|
+
schema,
|
|
47
|
+
description: meta?.description,
|
|
48
|
+
example: meta?.example,
|
|
49
|
+
};
|
|
50
|
+
// Cast for the side effect — setMetaTag accepts the bare MiddlewareHandler
|
|
51
|
+
// shape; the typed return below keeps zValidator's full generics.
|
|
52
|
+
setMetaTag(middleware, SCHEMA_META, tag);
|
|
53
|
+
return middleware;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/http/utils/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAmB,UAAU,EAAE,MAAM,eAAe,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,MAAS,EACT,IAAkD;IAElD,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,MAAuB,EAAE,EAAE;QAC/E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACjE,MAAM,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,iBAAiB,CAAC;YACpD,MAAM,IAAI,eAAe,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAU,CAAC,CAAC;IAEb,MAAM,GAAG,GAAe;QACtB,MAAM;QACN,MAAM;QACN,WAAW,EAAE,IAAI,EAAE,WAAW;QAC9B,OAAO,EAAE,IAAI,EAAE,OAAO;KACvB,CAAC;IACF,2EAA2E;IAC3E,kEAAkE;IAClE,UAAU,CAAC,UAA+B,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IAE9D,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* `parseWebhook(c, { provider, secret })` — verify a webhook signature and
|
|
4
|
+
* return the parsed payload + raw body.
|
|
5
|
+
*
|
|
6
|
+
* Replaces ad-hoc Express `express.raw()` patterns. Reads
|
|
7
|
+
* `await c.req.text()` to preserve the *exact* bytes the sender signed —
|
|
8
|
+
* Hono caches the body so subsequent calls work too.
|
|
9
|
+
*
|
|
10
|
+
* Built-in providers: `stripe`, `github`, `slack`. For others, pass a
|
|
11
|
+
* custom `WebhookVerifier`. Twilio's URL+form-fields scheme requires the
|
|
12
|
+
* full request URL plus form-encoding context; out-of-scope for v4.0 — a
|
|
13
|
+
* v4.x adapter lands when first needed.
|
|
14
|
+
*
|
|
15
|
+
* Replay protection (where the provider exposes a timestamp): rejects
|
|
16
|
+
* requests where the timestamp is more than ~5 minutes off from now.
|
|
17
|
+
*
|
|
18
|
+
* On signature mismatch, throws `AuthenticationError` (mapped by
|
|
19
|
+
* `registerErrorHandlers` to 401).
|
|
20
|
+
*/
|
|
21
|
+
export interface WebhookVerifyArgs {
|
|
22
|
+
rawBody: string;
|
|
23
|
+
headers: Readonly<Record<string, string | undefined>>;
|
|
24
|
+
secret: string;
|
|
25
|
+
/** Current epoch ms; injected for deterministic tests. */
|
|
26
|
+
now?: number;
|
|
27
|
+
}
|
|
28
|
+
export type WebhookVerifyResult = {
|
|
29
|
+
ok: true;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
export interface WebhookVerifier {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
verify(args: WebhookVerifyArgs): WebhookVerifyResult;
|
|
37
|
+
}
|
|
38
|
+
export declare const stripeVerifier: WebhookVerifier;
|
|
39
|
+
export declare const githubVerifier: WebhookVerifier;
|
|
40
|
+
export declare const slackVerifier: WebhookVerifier;
|
|
41
|
+
declare const BUILT_IN_VERIFIERS: Record<string, WebhookVerifier>;
|
|
42
|
+
export type BuiltInProvider = keyof typeof BUILT_IN_VERIFIERS;
|
|
43
|
+
export interface ParseWebhookOptions {
|
|
44
|
+
/** Built-in provider name OR a custom WebhookVerifier. */
|
|
45
|
+
provider: BuiltInProvider | WebhookVerifier;
|
|
46
|
+
secret: string;
|
|
47
|
+
/**
|
|
48
|
+
* Parse the verified body. Default `JSON.parse`. Returns the raw text
|
|
49
|
+
* unparsed if `parse: false`.
|
|
50
|
+
*/
|
|
51
|
+
parse?: ((rawBody: string) => unknown) | false;
|
|
52
|
+
}
|
|
53
|
+
export interface ParseWebhookResult<T = unknown> {
|
|
54
|
+
rawBody: string;
|
|
55
|
+
payload: T;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Verify the webhook signature, then return raw body + parsed payload.
|
|
59
|
+
* Throws `AuthenticationError` on signature mismatch.
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseWebhook<T = unknown>(c: Context, opts: ParseWebhookOptions): Promise<ParseWebhookResult<T>>;
|
|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C,GAAG,KAAK,CAAC;CAChD;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,CAAC;CACZ;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAoChC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { AuthenticationError } from "../errors/AuthenticationError.js";
|
|
3
|
+
import { BadRequestError } from "../errors/BadRequestError.js";
|
|
4
|
+
const REPLAY_WINDOW_MS = 5 * 60 * 1000;
|
|
5
|
+
function safeEqualHex(a, b) {
|
|
6
|
+
const aBuf = Buffer.from(a, "hex");
|
|
7
|
+
const bBuf = Buffer.from(b, "hex");
|
|
8
|
+
if (aBuf.length !== bBuf.length || aBuf.length === 0) {
|
|
9
|
+
timingSafeEqual(aBuf, aBuf);
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return timingSafeEqual(aBuf, bBuf);
|
|
13
|
+
}
|
|
14
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
15
|
+
// Stripe — `Stripe-Signature: t=<ts>,v1=<sig>[,v0=<sig>]`
|
|
16
|
+
// sig = HMAC-SHA256(<ts>.<rawBody>) using endpoint secret
|
|
17
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
18
|
+
export const stripeVerifier = {
|
|
19
|
+
name: "stripe",
|
|
20
|
+
verify({ rawBody, headers, secret, now = Date.now() }) {
|
|
21
|
+
const sigHeader = headers["stripe-signature"];
|
|
22
|
+
if (!sigHeader)
|
|
23
|
+
return { ok: false, reason: "Missing Stripe-Signature header" };
|
|
24
|
+
const parts = Object.fromEntries(sigHeader.split(",").map((p) => {
|
|
25
|
+
const [k, v] = p.split("=");
|
|
26
|
+
return [k?.trim(), v?.trim()];
|
|
27
|
+
}));
|
|
28
|
+
const ts = parts.t;
|
|
29
|
+
const v1 = parts.v1;
|
|
30
|
+
if (!ts || !v1)
|
|
31
|
+
return { ok: false, reason: "Stripe signature missing t / v1" };
|
|
32
|
+
const tsMs = Number.parseInt(ts, 10) * 1000;
|
|
33
|
+
if (!Number.isFinite(tsMs) || Math.abs(now - tsMs) > REPLAY_WINDOW_MS) {
|
|
34
|
+
return { ok: false, reason: "Stripe signature timestamp outside tolerance" };
|
|
35
|
+
}
|
|
36
|
+
const expected = createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
|
|
37
|
+
if (!safeEqualHex(expected, v1)) {
|
|
38
|
+
return { ok: false, reason: "Stripe signature mismatch" };
|
|
39
|
+
}
|
|
40
|
+
return { ok: true };
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
44
|
+
// GitHub — `X-Hub-Signature-256: sha256=<hex>`
|
|
45
|
+
// sig = HMAC-SHA256(rawBody) using webhook secret
|
|
46
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
47
|
+
export const githubVerifier = {
|
|
48
|
+
name: "github",
|
|
49
|
+
verify({ rawBody, headers, secret }) {
|
|
50
|
+
const header = headers["x-hub-signature-256"];
|
|
51
|
+
if (!header)
|
|
52
|
+
return { ok: false, reason: "Missing X-Hub-Signature-256 header" };
|
|
53
|
+
if (!header.startsWith("sha256=")) {
|
|
54
|
+
return { ok: false, reason: "X-Hub-Signature-256 not in 'sha256=<hex>' form" };
|
|
55
|
+
}
|
|
56
|
+
const presented = header.slice("sha256=".length);
|
|
57
|
+
const expected = createHmac("sha256", secret).update(rawBody).digest("hex");
|
|
58
|
+
if (!safeEqualHex(expected, presented)) {
|
|
59
|
+
return { ok: false, reason: "GitHub signature mismatch" };
|
|
60
|
+
}
|
|
61
|
+
return { ok: true };
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
65
|
+
// Slack — `X-Slack-Signature: v0=<hex>`, `X-Slack-Request-Timestamp: <ts>`
|
|
66
|
+
// sig = HMAC-SHA256(`v0:${ts}:${rawBody}`) using signing secret
|
|
67
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
68
|
+
export const slackVerifier = {
|
|
69
|
+
name: "slack",
|
|
70
|
+
verify({ rawBody, headers, secret, now = Date.now() }) {
|
|
71
|
+
const sig = headers["x-slack-signature"];
|
|
72
|
+
const ts = headers["x-slack-request-timestamp"];
|
|
73
|
+
if (!sig)
|
|
74
|
+
return { ok: false, reason: "Missing X-Slack-Signature header" };
|
|
75
|
+
if (!ts)
|
|
76
|
+
return { ok: false, reason: "Missing X-Slack-Request-Timestamp header" };
|
|
77
|
+
if (!sig.startsWith("v0=")) {
|
|
78
|
+
return { ok: false, reason: "X-Slack-Signature not in 'v0=<hex>' form" };
|
|
79
|
+
}
|
|
80
|
+
const tsMs = Number.parseInt(ts, 10) * 1000;
|
|
81
|
+
if (!Number.isFinite(tsMs) || Math.abs(now - tsMs) > REPLAY_WINDOW_MS) {
|
|
82
|
+
return { ok: false, reason: "Slack signature timestamp outside tolerance" };
|
|
83
|
+
}
|
|
84
|
+
const presented = sig.slice("v0=".length);
|
|
85
|
+
const expected = createHmac("sha256", secret).update(`v0:${ts}:${rawBody}`).digest("hex");
|
|
86
|
+
if (!safeEqualHex(expected, presented)) {
|
|
87
|
+
return { ok: false, reason: "Slack signature mismatch" };
|
|
88
|
+
}
|
|
89
|
+
return { ok: true };
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const BUILT_IN_VERIFIERS = {
|
|
93
|
+
stripe: stripeVerifier,
|
|
94
|
+
github: githubVerifier,
|
|
95
|
+
slack: slackVerifier,
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Verify the webhook signature, then return raw body + parsed payload.
|
|
99
|
+
* Throws `AuthenticationError` on signature mismatch.
|
|
100
|
+
*/
|
|
101
|
+
export async function parseWebhook(c, opts) {
|
|
102
|
+
const verifier = typeof opts.provider === "string" ? BUILT_IN_VERIFIERS[opts.provider] : opts.provider;
|
|
103
|
+
if (!verifier) {
|
|
104
|
+
throw new Error(`parseWebhook: unknown provider "${opts.provider}"`);
|
|
105
|
+
}
|
|
106
|
+
const rawBody = await c.req.text();
|
|
107
|
+
const headers = {};
|
|
108
|
+
c.req.raw.headers.forEach((value, key) => {
|
|
109
|
+
headers[key.toLowerCase()] = value;
|
|
110
|
+
});
|
|
111
|
+
const result = verifier.verify({ rawBody, headers, secret: opts.secret });
|
|
112
|
+
if (!result.ok) {
|
|
113
|
+
throw new AuthenticationError(`Webhook signature invalid: ${result.reason}`);
|
|
114
|
+
}
|
|
115
|
+
// F18: catch parse failures *after* the signature passes so a
|
|
116
|
+
// bad body surfaces as 400 (BadRequestError) rather than the
|
|
117
|
+
// unhandled 500 that would otherwise leak via the framework
|
|
118
|
+
// error pipeline. There's no oracle here — the signature still
|
|
119
|
+
// had to verify for control to reach this point.
|
|
120
|
+
const parser = opts.parse === false ? null : (opts.parse ?? JSON.parse);
|
|
121
|
+
if (!parser) {
|
|
122
|
+
return { rawBody, payload: rawBody };
|
|
123
|
+
}
|
|
124
|
+
let payload;
|
|
125
|
+
try {
|
|
126
|
+
payload = parser(rawBody);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
throw new BadRequestError(`Webhook payload is not valid JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
130
|
+
}
|
|
131
|
+
return { rawBody, payload };
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../src/http/utils/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE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YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACzF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AuthenticatedAccount, AuthProvider } from "../../app/auth/AuthProvider.js";
|
|
2
|
+
export interface WsAuthExtractResult {
|
|
3
|
+
/** All subprotocols the client presented, in order. */
|
|
4
|
+
protocols: string[];
|
|
5
|
+
/** The bearer token (without the `bearer.` prefix), if present. */
|
|
6
|
+
bearerToken: string | null;
|
|
7
|
+
/** First non-bearer subprotocol — what the server should echo back. */
|
|
8
|
+
selectedSubprotocol: string | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse the `Sec-WebSocket-Protocol` header value into the framework's
|
|
12
|
+
* subprotocol-auth shape.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractWsAuth(headerValue: string | string[] | undefined): WsAuthExtractResult;
|
|
15
|
+
export interface AuthenticateWsUpgradeArgs<TAccount extends AuthenticatedAccount = AuthenticatedAccount> {
|
|
16
|
+
/** All upgrade-request headers, lower-cased keys. */
|
|
17
|
+
headers: Readonly<Record<string, string | undefined>>;
|
|
18
|
+
provider: AuthProvider<TAccount>;
|
|
19
|
+
/**
|
|
20
|
+
* If `true`, missing-token connections are admitted (account=null).
|
|
21
|
+
* Present-but-bad tokens still reject — same semantics as `requireAuth`.
|
|
22
|
+
*/
|
|
23
|
+
optional?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type AuthenticateWsUpgradeResult<TAccount extends AuthenticatedAccount = AuthenticatedAccount> = {
|
|
26
|
+
ok: true;
|
|
27
|
+
/** Resolved Account, or `null` when `optional: true` and no token was supplied. */
|
|
28
|
+
account: TAccount | null;
|
|
29
|
+
/** First non-bearer subprotocol — the server echoes this. */
|
|
30
|
+
selectedSubprotocol: string | null;
|
|
31
|
+
/** Verified claims (when ok). */
|
|
32
|
+
claims: import("../../app/auth/AuthProvider.js").AuthClaims | null;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
/** 401 (auth failure) or 403 (account not registered). */
|
|
36
|
+
status: 401 | 403;
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Run the AuthProvider chain against a WebSocket upgrade request. Pure —
|
|
41
|
+
* does not touch the underlying socket. The caller is responsible for
|
|
42
|
+
* accepting (with `Sec-WebSocket-Protocol: <selectedSubprotocol>`) or
|
|
43
|
+
* rejecting (with `status`) based on the returned verdict.
|
|
44
|
+
*/
|
|
45
|
+
export declare function authenticateWsUpgrade<TAccount extends AuthenticatedAccount = AuthenticatedAccount>(args: AuthenticateWsUpgradeArgs<TAccount>): Promise<AuthenticateWsUpgradeResult<TAccount>>;
|
|
46
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/http/ws/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EAEb,MAAM,gCAAgC,CAAC;AA0CxC,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,uEAAuE;IACvE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,mBAAmB,CA6B7F;AAED,MAAM,WAAW,yBAAyB,CACxC,QAAQ,SAAS,oBAAoB,GAAG,oBAAoB;IAE5D,qDAAqD;IACrD,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACtD,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,2BAA2B,CACrC,QAAQ,SAAS,oBAAoB,GAAG,oBAAoB,IAE1D;IACE,EAAE,EAAE,IAAI,CAAC;IACT,mFAAmF;IACnF,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,6DAA6D;IAC7D,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iCAAiC;IACjC,MAAM,EAAE,OAAO,gCAAgC,EAAE,UAAU,GAAG,IAAI,CAAC;CACpE,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,0DAA0D;IAC1D,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,SAAS,oBAAoB,GAAG,oBAAoB,EAC5D,IAAI,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAoD3F"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket subprotocol-header authentication — the locked v4 default.
|
|
3
|
+
*
|
|
4
|
+
* Clients open with two subprotocols: a versioning marker (e.g.
|
|
5
|
+
* `ship-api.v1`) and a credential (`bearer.<token>`):
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* new WebSocket(url, ["ship-api.v1", `bearer.${token}`]);
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* The server parses the `Sec-WebSocket-Protocol` header during the upgrade
|
|
12
|
+
* handshake (BEFORE the connection is established), runs the configured
|
|
13
|
+
* `AuthProvider` chain, attaches the resolved Account to `ws.data`, and
|
|
14
|
+
* responds with `Sec-WebSocket-Protocol: ship-api.v1` to confirm. Failed
|
|
15
|
+
* auth rejects the upgrade with 401 — there's no "connected but
|
|
16
|
+
* unauthenticated" intermediate state.
|
|
17
|
+
*
|
|
18
|
+
* Why subprotocol over alternatives — documented in
|
|
19
|
+
* `.cursor/rules/security.mdc`:
|
|
20
|
+
* - URL token (`?token=...`): leaks into server / proxy / browser logs.
|
|
21
|
+
* - Cookie auth: same-origin web only; breaks RN+Expo and any future
|
|
22
|
+
* cross-origin client.
|
|
23
|
+
* - First-message handshake: introduces an authenticated-but-resourceful
|
|
24
|
+
* window before auth completes; footgun.
|
|
25
|
+
* - Subprotocol header: proper Authorization-header semantics, no
|
|
26
|
+
* leakage, no intermediate state, supported by every WS client
|
|
27
|
+
* (including React Native's). Adopted.
|
|
28
|
+
*
|
|
29
|
+
* **Operator note**: some load balancers and proxies log the
|
|
30
|
+
* `Sec-WebSocket-Protocol` header. Firebase ID tokens are short-lived
|
|
31
|
+
* (~1 h) which bounds the leakage window, but operators should configure
|
|
32
|
+
* proxies to redact this header where possible.
|
|
33
|
+
*
|
|
34
|
+
* This file is the auth-extraction primitive — testable in isolation.
|
|
35
|
+
* The full `upgradeWebSocket` integration with `@hono/node-ws` lives in
|
|
36
|
+
* `wsAdapter.ts` (v4.x; lands when there's a concrete consumer).
|
|
37
|
+
*/
|
|
38
|
+
const BEARER_PREFIX = "bearer.";
|
|
39
|
+
/**
|
|
40
|
+
* Parse the `Sec-WebSocket-Protocol` header value into the framework's
|
|
41
|
+
* subprotocol-auth shape.
|
|
42
|
+
*/
|
|
43
|
+
export function extractWsAuth(headerValue) {
|
|
44
|
+
const raw = Array.isArray(headerValue) ? headerValue.join(",") : (headerValue ?? "");
|
|
45
|
+
const protocols = raw
|
|
46
|
+
.split(",")
|
|
47
|
+
.map((p) => p.trim())
|
|
48
|
+
.filter(Boolean);
|
|
49
|
+
let bearerToken = null;
|
|
50
|
+
let selectedSubprotocol = null;
|
|
51
|
+
for (const proto of protocols) {
|
|
52
|
+
// Case-insensitive prefix detection. F21: slice from the literal
|
|
53
|
+
// prefix length; this is safe because every case variant of
|
|
54
|
+
// `bearer.` is exactly the same ASCII length (7), so the
|
|
55
|
+
// case-folded match position equals the original-string slice
|
|
56
|
+
// index. A future prefix change to anything non-ASCII (or any
|
|
57
|
+
// case-folding that changes string length) would break this
|
|
58
|
+
// invariant and require switching to a regex-based extractor.
|
|
59
|
+
if (proto.toLowerCase().startsWith(BEARER_PREFIX)) {
|
|
60
|
+
// Use the FIRST bearer subprotocol; ignore subsequent ones.
|
|
61
|
+
if (bearerToken === null) {
|
|
62
|
+
bearerToken = proto.slice(BEARER_PREFIX.length);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (selectedSubprotocol === null) {
|
|
66
|
+
selectedSubprotocol = proto;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { protocols, bearerToken, selectedSubprotocol };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Run the AuthProvider chain against a WebSocket upgrade request. Pure —
|
|
73
|
+
* does not touch the underlying socket. The caller is responsible for
|
|
74
|
+
* accepting (with `Sec-WebSocket-Protocol: <selectedSubprotocol>`) or
|
|
75
|
+
* rejecting (with `status`) based on the returned verdict.
|
|
76
|
+
*/
|
|
77
|
+
export async function authenticateWsUpgrade(args) {
|
|
78
|
+
const { bearerToken, selectedSubprotocol } = extractWsAuth(args.headers["sec-websocket-protocol"]);
|
|
79
|
+
if (!bearerToken) {
|
|
80
|
+
if (args.optional) {
|
|
81
|
+
return { ok: true, account: null, selectedSubprotocol, claims: null };
|
|
82
|
+
}
|
|
83
|
+
return { ok: false, status: 401, reason: "Missing bearer.<token> subprotocol" };
|
|
84
|
+
}
|
|
85
|
+
const ctx = {
|
|
86
|
+
headers: args.headers,
|
|
87
|
+
rawCredential: bearerToken,
|
|
88
|
+
};
|
|
89
|
+
const verifyResult = await args.provider.verify(ctx);
|
|
90
|
+
if (!verifyResult.ok) {
|
|
91
|
+
if (verifyResult.reason === "missing-token" && args.optional) {
|
|
92
|
+
return { ok: true, account: null, selectedSubprotocol, claims: null };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
status: 401,
|
|
97
|
+
reason: verifyResult.message ?? `Authentication failed (${verifyResult.reason})`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const account = await args.provider.resolve(verifyResult.claims);
|
|
101
|
+
if (account === null) {
|
|
102
|
+
if (args.provider.onUnknownAccount === "next") {
|
|
103
|
+
return {
|
|
104
|
+
ok: true,
|
|
105
|
+
account: null,
|
|
106
|
+
selectedSubprotocol,
|
|
107
|
+
claims: verifyResult.claims,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
ok: false,
|
|
112
|
+
status: 403,
|
|
113
|
+
reason: "No account registered for this credential",
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
ok: true,
|
|
118
|
+
account,
|
|
119
|
+
selectedSubprotocol,
|
|
120
|
+
claims: verifyResult.claims,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/http/ws/auth.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,aAAa,GAAG,SAAS,CAAC;AAWhC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,WAA0C;IACtE,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACrF,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EA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summit/ship-api` — public API barrel for ShipAPI v4.
|
|
3
|
+
*
|
|
4
|
+
* This is the canonical entry point for consumer apps. The framework
|
|
5
|
+
* exports a curated, semver-stable surface here; deep-path imports
|
|
6
|
+
* (`@sixthsummit/ship-api/http/middleware/...`) are still available
|
|
7
|
+
* but NOT covered by semver — they're for internal cross-module use
|
|
8
|
+
* and advanced consumers who need primitives the barrel doesn't yet
|
|
9
|
+
* surface.
|
|
10
|
+
*
|
|
11
|
+
* The `@sixthsummit/ship-api/client` subpath remains a separate
|
|
12
|
+
* lightweight bundle for typed-client consumers (web / mobile) that
|
|
13
|
+
* shouldn't pull in the framework's runtime deps. Import from there:
|
|
14
|
+
*
|
|
15
|
+
* import { hc } from "@sixthsummit/ship-api/client";
|
|
16
|
+
* import type { ShipApiClient } from "@my-org/api";
|
|
17
|
+
*/
|
|
18
|
+
export type { AccessGraphNode, ActorResolution, ActorResolutionFailure, ActorResolutionFailureReason, ActorResolutionRequest, ActorResolutionResult, ActorResolver, ActorResolverDefinition, AnyModule, AnyOperation, AnyProvider, ApplicationDefinition, ApplicationDiagnostic, ApplicationDiagnosticCode, ApplicationExecutor, ApplicationGraph, ApplicationModuleMap, ApplicationOperationMap, ApplicationProviderMap, AuthenticatedAccess, CompiledApplication, DependencyBindings, DependencyGraphNode, DependencyProviderValue, DependencyToken, EffectDependencyToken, EffectGraphNode, ExplicitOperationResponse, FrameworkOperationFailure, InferOperationInput, InferOperationOutputs, InferOperationRawInput, InferSchemaInput, InferSchemaOutput, LegacyOperationActor, ModuleDefinition, ModuleDiagnosticCode, ModuleGraphNode, NormalizedActorResolution, Operation, OperationAccess, OperationActor, OperationActorInput, OperationContext, OperationContextForAccess, OperationDefinition, OperationDefinitionDiagnosticCode, OperationErrorDefinition, OperationErrorDetails, OperationErrorDetailsInput, OperationErrorGraphNode, OperationErrorPayload, OperationExecutionDiagnosticCode, OperationExecutionResult, OperationFailureOptions, OperationFailureResult, OperationGraphNode, OperationHandler, OperationHandlerArguments, OperationHandlerResult, OperationId, OperationIdentity, OperationInputSchemas, OperationOutputSchemas, OperationOutputStatus, OperationRawInput, OperationResponse, OperationRunOptions, OperationSuccessResult, OperationTransactionMode, OperationTransport, OperationTransportMetadata, OperationTransportMetadataPrimitive, OperationTransportMetadataValue, OptionalIdentityAccess, OutputSchemaGraphNode, PermissionAccess, Provider, ProviderDefinition, ProviderDiagnosticCode, ProviderFactoryArguments, ProviderGraphNode, ProviderLifetime, PublicAccess, ResolveDependencyBindings, RuntimeSchema, SchemaGraphNode, SchemaIssue, SchemaResult, ShipModule, TenantBypass, TenantBypassAuditEvent, TenantBypassAuditSink, TenantBypassAuthority, TenantBypassRequest, TenantCapabilityErrorCode, TenantIdentifier, TenantScope, TenantScopeAuthority, TenantScopeRequest, TransportGraphNode, UnitOfWork, UnitOfWorkDependencyToken, ValidationIssue, } from "./kernel/index.js";
|
|
19
|
+
export { ApplicationCompilationError, anyPermission, authenticatedAccess, checkOperationAccess, compileApp, createExecutor, createTenantBypassAuthority, createTenantScopeAuthority, defineActorResolver, defineApp, defineModule, defineOperation, defineProvider, dependency, effectDependency, InvalidModuleDefinitionError, InvalidOperationDefinitionError, InvalidProviderDefinitionError, isActorResolution, isActorResolver, isEffectDependencyToken, isExplicitOperationResponse, isOperationActor, isOperationIdentity, isTenantBypass, isTenantScope, isUnitOfWork, isUnitOfWorkDependencyToken, normalizeActorResolution, normalizeOperationActor, OperationExecutionError, OperationFailure, operationActor, operationError, operationFailure, operationIdentity, optionalIdentityAccess, permission, permissionSnapshot, publicAccess, respond, TenantCapabilityError, unitOfWorkDependency, valueProvider, } from "./kernel/index.js";
|
|
20
|
+
export type { PermissionDefinition } from "./app/auth/permissionDefinition.js";
|
|
21
|
+
export type { CreateHonoAdapterOptions, HeaderCredential, HonoAdapterDiagnosticCode, HonoAuthenticationOptions, HonoCredentialAdapter, HonoUnexpectedErrorContext, HttpJsonBodyPolicy, HttpMethod, HttpMultipartBodyOptions, HttpMultipartBodyPolicy, HttpRawBodyOptions, HttpRawBodyPolicy, HttpRequestBodyPolicy, HttpResponseMode, HttpTransport, HttpTransportOptions, ShipHttpErrorEnvelope, } from "./hono/index.js";
|
|
22
|
+
export { createHonoAdapter, defineHonoCredentialAdapter, HonoAdapterError, honoAuthProvider, http, InvalidHttpTransportError, isHonoCredentialAdapter, isHttpTransport, requestHeadersCredential, } from "./hono/index.js";
|
|
23
|
+
export type { AppEnv, AppEnvVariables, CorsOptions, CreateAppOptions, CreateModuleAppOptions, } from "./http/app/createApp.js";
|
|
24
|
+
export { createApp, createModuleApp } from "./http/app/createApp.js";
|
|
25
|
+
export type { ErrorResponseShape, RegisterErrorHandlersOptions } from "./http/app/errors.js";
|
|
26
|
+
export { registerErrorHandlers } from "./http/app/errors.js";
|
|
27
|
+
export type { ApiKeyOptions } from "./http/middleware/apiKey.js";
|
|
28
|
+
export { apiKey } from "./http/middleware/apiKey.js";
|
|
29
|
+
export type { CsrfOptions } from "./http/middleware/csrf.js";
|
|
30
|
+
export { csrf } from "./http/middleware/csrf.js";
|
|
31
|
+
export type { HttpLoggerOptions } from "./http/middleware/httpLogger.js";
|
|
32
|
+
export { httpLogger } from "./http/middleware/httpLogger.js";
|
|
33
|
+
export type { IdempotencyOptions } from "./http/middleware/idempotency.js";
|
|
34
|
+
export { idempotency } from "./http/middleware/idempotency.js";
|
|
35
|
+
export type { RateLimitOptions } from "./http/middleware/rateLimit.js";
|
|
36
|
+
export { rateLimit } from "./http/middleware/rateLimit.js";
|
|
37
|
+
export type { RequireAuthOptions } from "./http/middleware/requireAuth.js";
|
|
38
|
+
export { AUTH_CONTEXT_KEYS, requireAuth } from "./http/middleware/requireAuth.js";
|
|
39
|
+
export { requirePermission } from "./http/middleware/requirePermission.js";
|
|
40
|
+
export type { ResolveTenantOptions } from "./http/middleware/resolveTenant.js";
|
|
41
|
+
export { resolveTenant } from "./http/middleware/resolveTenant.js";
|
|
42
|
+
export type { StreamSSEOptions } from "./http/streaming/sse.js";
|
|
43
|
+
export { streamSSE } from "./http/streaming/sse.js";
|
|
44
|
+
export { streamLLM } from "./http/streaming/streamLLM.js";
|
|
45
|
+
export { parseUpload } from "./http/utils/uploads.js";
|
|
46
|
+
export { validate } from "./http/utils/validate.js";
|
|
47
|
+
export { parseWebhook } from "./http/utils/webhooks.js";
|
|
48
|
+
export { AppError, AuthenticationError, AuthorizationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, RateLimitError, ServiceUnavailableError, ValidationError, } from "./http/errors/index.js";
|
|
49
|
+
export type { AccountResolver, AuthClaims, AuthenticatedAccount, AuthProvider, AuthVerifyResult, } from "./app/auth/AuthProvider.js";
|
|
50
|
+
export { FirebaseAuthProvider, firebaseAuth } from "./app/auth/adapters/firebase.js";
|
|
51
|
+
export type { RequestContext } from "./app/context/RequestContext.js";
|
|
52
|
+
export { getRequestContext } from "./app/context/RequestContext.js";
|
|
53
|
+
export type { BaseFields } from "./app/db/baseFields.js";
|
|
54
|
+
export { baseFields, baseFieldsTimestampsOnly } from "./app/db/baseFields.js";
|
|
55
|
+
export type { ColumnFilter, OrderClause, QueryOperator, QueryOptions, } from "./app/db/QueryOptions.js";
|
|
56
|
+
export { isQueryOperator, QUERY_OPERATORS } from "./app/db/QueryOptions.js";
|
|
57
|
+
export type { TenantScoped } from "./app/db/tenantScoped.js";
|
|
58
|
+
export { tenantScoped } from "./app/db/tenantScoped.js";
|
|
59
|
+
export type { ShipTx, WithTransactionOptions } from "./app/db/transaction.js";
|
|
60
|
+
export { RollbackError, withTransaction } from "./app/db/transaction.js";
|
|
61
|
+
export { DrizzleEntityService } from "./app/services/DrizzleEntityService.js";
|
|
62
|
+
export type { LifecycleHookContext, LifecycleHooks, QueryFilter, } from "./app/services/hooks/LifecycleHooks.js";
|
|
63
|
+
export { composeHooks } from "./app/services/hooks/LifecycleHooks.js";
|
|
64
|
+
export type { Cache, CacheSetOptions, InMemoryCacheOptions } from "./app/services/cache/index.js";
|
|
65
|
+
export { cached, InMemoryCache, RedisCache } from "./app/services/cache/index.js";
|
|
66
|
+
export { RedisProvider } from "./app/services/RedisProvider.js";
|
|
67
|
+
export type { JobDefinition, JobDefinitionOptions, JobHandler, JobHandlerContext, JobsManagerOptions, WorkerMode, } from "./app/services/jobs/index.js";
|
|
68
|
+
export { defineJob, JobRegistry, JobsManager, jobRegistry } from "./app/services/jobs/index.js";
|
|
69
|
+
export type { DefineCronArgs } from "./app/services/cron/index.js";
|
|
70
|
+
export { CRON_QUEUE, defineCron } from "./app/services/cron/index.js";
|
|
71
|
+
export type { AddHealthCheckOptions, HealthCheck, HealthCheckFailure, HealthCheckResult, RunAllOptions, RunAllResult, } from "./app/health/HealthCheck.js";
|
|
72
|
+
export { HealthCheckRegistry, healthCheckRegistry } from "./app/health/HealthCheck.js";
|
|
73
|
+
export { redisHealthCheck } from "./app/health/redisHealthCheck.js";
|
|
74
|
+
export type { ReadyzBody, ReadyzCheck, RegisterHealthRoutesOptions, } from "./http/app/health.js";
|
|
75
|
+
export { hasHealthRoutes, registerHealthRoutes } from "./http/app/health.js";
|
|
76
|
+
export type { RouteEntry } from "./app/registry/routes.js";
|
|
77
|
+
export { routeRegistry } from "./app/registry/routes.js";
|
|
78
|
+
export type { DefineEnvOptions, EnvSafeParseResult, EnvSchema, EnvSchemaError, EnvSchemaIssue, } from "./app/utils/defineEnv.js";
|
|
79
|
+
export { defineEnv } from "./app/utils/defineEnv.js";
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,YAAY,EACV,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB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