@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,284 @@
|
|
|
1
|
+
import Logger from "@sixthsummit/ship-api/app/utils/Logger";
|
|
2
|
+
import type { Plugin, SchemaConfig, SearchMethod } from "../types/index.js";
|
|
3
|
+
|
|
4
|
+
export default class SchemaRegistry {
|
|
5
|
+
private static instance: SchemaRegistry;
|
|
6
|
+
private schemas: Map<string, SchemaConfig> = new Map();
|
|
7
|
+
private plugins: Map<string, Plugin> = new Map();
|
|
8
|
+
private searchMethods: Map<string, SearchMethod> = new Map();
|
|
9
|
+
|
|
10
|
+
constructor(schemas: SchemaConfig[] = []) {
|
|
11
|
+
this.registerDefaultSearchMethods();
|
|
12
|
+
|
|
13
|
+
// Register provided schemas
|
|
14
|
+
schemas.forEach((schema) => {
|
|
15
|
+
this.registerSchema(schema);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Initialize the static registry with schemas
|
|
21
|
+
*/
|
|
22
|
+
static initialize(schemas: SchemaConfig[]): void {
|
|
23
|
+
SchemaRegistry.instance = new SchemaRegistry(schemas);
|
|
24
|
+
Logger.log(`Static SchemaRegistry initialized with ${schemas.length} schemas`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the static registry instance
|
|
29
|
+
*/
|
|
30
|
+
static getInstance(): SchemaRegistry {
|
|
31
|
+
if (!SchemaRegistry.instance) {
|
|
32
|
+
throw new Error("SchemaRegistry not initialized. Call SchemaRegistry.initialize() first.");
|
|
33
|
+
}
|
|
34
|
+
return SchemaRegistry.instance;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Check if the registry is initialized
|
|
39
|
+
*/
|
|
40
|
+
static isInitialized(): boolean {
|
|
41
|
+
return SchemaRegistry.instance !== undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Register a schema configuration
|
|
46
|
+
* Validates the schema before registration (fail-fast principle)
|
|
47
|
+
*/
|
|
48
|
+
registerSchema(schema: SchemaConfig): void {
|
|
49
|
+
// Validate schema before registration
|
|
50
|
+
const validation = this.validateSchema(schema);
|
|
51
|
+
if (!validation.valid) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Schema validation failed for '${schema.name}': ${validation.errors.join(", ")}`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.schemas.set(schema.name, schema);
|
|
58
|
+
Logger.log(`Schema registered: ${schema.name}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Register multiple schemas
|
|
63
|
+
*/
|
|
64
|
+
registerSchemas(schemas: Record<string, SchemaConfig>): void {
|
|
65
|
+
Object.values(schemas).forEach((schema) => {
|
|
66
|
+
this.registerSchema(schema);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get a schema by name
|
|
72
|
+
*/
|
|
73
|
+
getSchema(name: string): SchemaConfig | undefined {
|
|
74
|
+
return this.schemas.get(name);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get all registered schemas
|
|
79
|
+
*/
|
|
80
|
+
getAllSchemas(): SchemaConfig[] {
|
|
81
|
+
return Array.from(this.schemas.values());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check if a schema exists
|
|
86
|
+
*/
|
|
87
|
+
hasSchema(name: string): boolean {
|
|
88
|
+
return this.schemas.has(name);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get schema names
|
|
93
|
+
*/
|
|
94
|
+
getSchemaNames(): string[] {
|
|
95
|
+
return Array.from(this.schemas.keys());
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Register a plugin
|
|
100
|
+
*/
|
|
101
|
+
registerPlugin(plugin: Plugin): void {
|
|
102
|
+
this.plugins.set(plugin.name, plugin);
|
|
103
|
+
Logger.log(`Plugin registered: ${plugin.name} v${plugin.version}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get a plugin by name
|
|
108
|
+
*/
|
|
109
|
+
getPlugin(name: string): Plugin | undefined {
|
|
110
|
+
return this.plugins.get(name);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get plugins for a schema
|
|
115
|
+
*/
|
|
116
|
+
getSchemaPlugins(schemaName: string): Plugin[] {
|
|
117
|
+
const schema = this.getSchema(schemaName);
|
|
118
|
+
if (!schema?.plugins) return [];
|
|
119
|
+
|
|
120
|
+
return schema.plugins
|
|
121
|
+
.map((pluginName) => this.getPlugin(pluginName))
|
|
122
|
+
.filter(Boolean) as Plugin[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Register a search method
|
|
127
|
+
*/
|
|
128
|
+
registerSearchMethod(method: SearchMethod): void {
|
|
129
|
+
this.searchMethods.set(method.name, method);
|
|
130
|
+
Logger.log(`Search method registered: ${method.name}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get a search method by name
|
|
135
|
+
*/
|
|
136
|
+
getSearchMethod(name: string): SearchMethod | undefined {
|
|
137
|
+
return this.searchMethods.get(name);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get all search methods
|
|
142
|
+
*/
|
|
143
|
+
getAllSearchMethods(): SearchMethod[] {
|
|
144
|
+
return Array.from(this.searchMethods.values());
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get searchable fields for a schema
|
|
149
|
+
*/
|
|
150
|
+
getSearchableFields(schemaName: string): string[] {
|
|
151
|
+
const schema = this.getSchema(schemaName);
|
|
152
|
+
return schema?.searchableFields || [];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get filterable fields for a schema
|
|
157
|
+
*/
|
|
158
|
+
getFilterableFields(schemaName: string): string[] {
|
|
159
|
+
const schema = this.getSchema(schemaName);
|
|
160
|
+
return schema?.filterableFields || [];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Get sortable fields for a schema
|
|
165
|
+
*/
|
|
166
|
+
getSortableFields(schemaName: string): string[] {
|
|
167
|
+
const schema = this.getSchema(schemaName);
|
|
168
|
+
return schema?.sortableFields || [];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Validate a schema configuration
|
|
173
|
+
*/
|
|
174
|
+
validateSchema(schema: SchemaConfig): { valid: boolean; errors: string[] } {
|
|
175
|
+
const errors: string[] = [];
|
|
176
|
+
|
|
177
|
+
if (!schema.name) {
|
|
178
|
+
errors.push("Schema name is required");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!schema.properties || schema.properties.length === 0) {
|
|
182
|
+
errors.push("Schema must have at least one property");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (schema.vectorizer && schema.vectorizer !== "none" && !schema.vectorizer.name) {
|
|
186
|
+
errors.push("Vectorizer name is required if vectorizer is specified");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Validate properties
|
|
190
|
+
schema.properties?.forEach((prop, index) => {
|
|
191
|
+
if (!prop.name) {
|
|
192
|
+
errors.push(`Property ${index} must have a name`);
|
|
193
|
+
}
|
|
194
|
+
if (!prop.dataType || prop.dataType.length === 0) {
|
|
195
|
+
errors.push(`Property ${prop.name} must have at least one data type`);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
valid: errors.length === 0,
|
|
201
|
+
errors,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Get schema statistics
|
|
207
|
+
*/
|
|
208
|
+
getStats(): {
|
|
209
|
+
totalSchemas: number;
|
|
210
|
+
totalPlugins: number;
|
|
211
|
+
totalSearchMethods: number;
|
|
212
|
+
schemasByCategory: Record<string, number>;
|
|
213
|
+
} {
|
|
214
|
+
const schemas = this.getAllSchemas();
|
|
215
|
+
const schemasByCategory = schemas.reduce(
|
|
216
|
+
(acc, schema) => {
|
|
217
|
+
const category = schema.metadata?.category || "unknown";
|
|
218
|
+
acc[category] = (acc[category] || 0) + 1;
|
|
219
|
+
return acc;
|
|
220
|
+
},
|
|
221
|
+
{} as Record<string, number>,
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
totalSchemas: this.schemas.size,
|
|
226
|
+
totalPlugins: this.plugins.size,
|
|
227
|
+
totalSearchMethods: this.searchMethods.size,
|
|
228
|
+
schemasByCategory,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Register default search methods
|
|
234
|
+
*/
|
|
235
|
+
private registerDefaultSearchMethods(): void {
|
|
236
|
+
// Vector search method
|
|
237
|
+
this.registerSearchMethod({
|
|
238
|
+
name: "vector",
|
|
239
|
+
description: "Vector-based semantic search",
|
|
240
|
+
supportedOptions: [
|
|
241
|
+
"nearText",
|
|
242
|
+
"nearVector",
|
|
243
|
+
"nearObject",
|
|
244
|
+
"where",
|
|
245
|
+
"limit",
|
|
246
|
+
"offset",
|
|
247
|
+
"sort",
|
|
248
|
+
],
|
|
249
|
+
execute: async () => {
|
|
250
|
+
throw new Error("Vector search method must be implemented by the service");
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// BM25 search method
|
|
255
|
+
this.registerSearchMethod({
|
|
256
|
+
name: "bm25",
|
|
257
|
+
description: "BM25 keyword-based search",
|
|
258
|
+
supportedOptions: ["bm25", "where", "limit", "offset", "sort"],
|
|
259
|
+
execute: async () => {
|
|
260
|
+
throw new Error("BM25 search method must be implemented by the service");
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Hybrid search method
|
|
265
|
+
this.registerSearchMethod({
|
|
266
|
+
name: "hybrid",
|
|
267
|
+
description: "Hybrid search combining vector and BM25",
|
|
268
|
+
supportedOptions: ["hybrid", "where", "limit", "offset", "sort"],
|
|
269
|
+
execute: async () => {
|
|
270
|
+
throw new Error("Hybrid search method must be implemented by the service");
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Clear all registrations
|
|
277
|
+
*/
|
|
278
|
+
clear(): void {
|
|
279
|
+
this.schemas.clear();
|
|
280
|
+
this.plugins.clear();
|
|
281
|
+
this.searchMethods.clear();
|
|
282
|
+
Logger.log("Schema registry cleared");
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SearchOptions } from "./SearchOptions.js";
|
|
2
|
+
|
|
3
|
+
export interface HybridSearchOptions extends SearchOptions {
|
|
4
|
+
hybrid?: {
|
|
5
|
+
query: string;
|
|
6
|
+
alpha?: number; // 0 = pure BM25, 1 = pure vector
|
|
7
|
+
properties?: string[];
|
|
8
|
+
vector?: number[];
|
|
9
|
+
fusionType?: "RelativeScore" | "Ranked"; // How to combine BM25 + vector scores (Weaviate values)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-tenancy configuration for Weaviate collections
|
|
3
|
+
*/
|
|
4
|
+
export interface MultiTenancyConfig {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
autoTenantCreation?: boolean;
|
|
7
|
+
autoTenantActivation?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Weaviate v3 tenant activity status values
|
|
12
|
+
*/
|
|
13
|
+
export type TenantActivityStatus =
|
|
14
|
+
| "HOT"
|
|
15
|
+
| "COLD"
|
|
16
|
+
| "FROZEN"
|
|
17
|
+
| "INACTIVE"
|
|
18
|
+
| "OFFLOADED"
|
|
19
|
+
| "OFFLOADING"
|
|
20
|
+
| "ONLOADING";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Tenant information
|
|
24
|
+
*/
|
|
25
|
+
export interface Tenant {
|
|
26
|
+
name: string;
|
|
27
|
+
activityStatus: TenantActivityStatus;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
updatedAt?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tenant creation options
|
|
34
|
+
*/
|
|
35
|
+
export interface CreateTenantOptions {
|
|
36
|
+
name: string;
|
|
37
|
+
activityStatus?: "HOT" | "COLD" | "FROZEN";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Tenant update options
|
|
42
|
+
*/
|
|
43
|
+
export interface UpdateTenantOptions {
|
|
44
|
+
activityStatus?: "HOT" | "COLD" | "FROZEN";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Tenant context for operations
|
|
49
|
+
*/
|
|
50
|
+
export interface TenantContext {
|
|
51
|
+
tenant: string;
|
|
52
|
+
activityStatus?: "HOT" | "COLD" | "FROZEN";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Multi-tenant search options
|
|
57
|
+
*/
|
|
58
|
+
export interface MultiTenantSearchOptions {
|
|
59
|
+
tenant?: string;
|
|
60
|
+
tenants?: string[];
|
|
61
|
+
includeInactive?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Tenant statistics
|
|
66
|
+
*/
|
|
67
|
+
export interface TenantStats {
|
|
68
|
+
totalTenants: number;
|
|
69
|
+
activeTenants: number;
|
|
70
|
+
inactiveTenants: number;
|
|
71
|
+
coldTenants: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Tenant management result
|
|
76
|
+
*/
|
|
77
|
+
export interface TenantManagementResult {
|
|
78
|
+
success: boolean;
|
|
79
|
+
tenant?: Tenant;
|
|
80
|
+
error?: string;
|
|
81
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SearchResult } from "./SearchResult.js";
|
|
2
|
+
|
|
3
|
+
export interface Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
description: string;
|
|
7
|
+
hooks: {
|
|
8
|
+
beforeSearch?: (className: string, options: any) => any;
|
|
9
|
+
afterSearch?: (className: string, result: SearchResult) => SearchResult;
|
|
10
|
+
beforeCreate?: (className: string, data: any) => any;
|
|
11
|
+
afterCreate?: (className: string, result: any) => any;
|
|
12
|
+
beforeUpdate?: (className: string, id: string, data: any) => any;
|
|
13
|
+
afterUpdate?: (className: string, result: any) => any;
|
|
14
|
+
beforeDelete?: (className: string, id: string) => any;
|
|
15
|
+
afterDelete?: (className: string, result: any) => any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MultiTenancyConfig } from "./MultiTenancy.js";
|
|
2
|
+
import type { SearchableField } from "./SearchableField.js";
|
|
3
|
+
import type { VectorIndexConfig } from "./VectorIndexConfig.js";
|
|
4
|
+
import type { Vectorizer } from "./VectorizerConfig.js";
|
|
5
|
+
|
|
6
|
+
export interface SchemaConfig {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
vectorizer?: Vectorizer;
|
|
10
|
+
vectorIndexConfig?: VectorIndexConfig;
|
|
11
|
+
properties: SearchableField[];
|
|
12
|
+
searchableFields?: string[]; // Fields to include in search by default
|
|
13
|
+
filterableFields?: string[]; // Fields that can be used in where clauses
|
|
14
|
+
sortableFields?: string[]; // Fields that can be used for sorting
|
|
15
|
+
relationships?: {
|
|
16
|
+
[fieldName: string]: {
|
|
17
|
+
targetClass: string;
|
|
18
|
+
type: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
|
|
19
|
+
required?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
plugins?: string[]; // Custom plugin names to apply
|
|
23
|
+
metadata?: Record<string, any>; // Additional metadata
|
|
24
|
+
multiTenancy?: MultiTenancyConfig; // Multi-tenancy configuration
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TenantContext } from "./MultiTenancy.js";
|
|
2
|
+
|
|
3
|
+
export interface SearchOptions {
|
|
4
|
+
query?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
where?: Record<string, any>;
|
|
8
|
+
sort?: Array<{
|
|
9
|
+
field: string;
|
|
10
|
+
order: "asc" | "desc";
|
|
11
|
+
}>;
|
|
12
|
+
fields?: string[]; // Specific fields to return
|
|
13
|
+
includeVector?: boolean;
|
|
14
|
+
includeMetadata?: boolean;
|
|
15
|
+
tenant?: TenantContext; // Tenant context for multi-tenant operations
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BM25SearchOptions, HybridSearchOptions, VectorSearchOptions } from "./index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Discriminated union for search requests
|
|
5
|
+
* This provides better type safety than method overloads
|
|
6
|
+
*/
|
|
7
|
+
export type SearchRequest =
|
|
8
|
+
| {
|
|
9
|
+
method: "vector";
|
|
10
|
+
options: VectorSearchOptions;
|
|
11
|
+
}
|
|
12
|
+
| {
|
|
13
|
+
method: "bm25";
|
|
14
|
+
options: BM25SearchOptions;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
method: "hybrid";
|
|
18
|
+
options: HybridSearchOptions;
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SearchResult<T = any> {
|
|
2
|
+
objects: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
properties: T;
|
|
5
|
+
vector?: number[];
|
|
6
|
+
certainty?: number;
|
|
7
|
+
distance?: number;
|
|
8
|
+
score?: number;
|
|
9
|
+
metadata?: {
|
|
10
|
+
explainScore?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
total?: number;
|
|
15
|
+
took?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration interface for Weaviate searchable fields
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* // High-priority search field
|
|
7
|
+
* {
|
|
8
|
+
* name: "fullName",
|
|
9
|
+
* dataType: ["string"],
|
|
10
|
+
* description: "Full name of the person",
|
|
11
|
+
* indexInverted: true,
|
|
12
|
+
* indexSearchable: true,
|
|
13
|
+
* weight: 2.0,
|
|
14
|
+
* boost: 1.5
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* // Filter-only field
|
|
18
|
+
* {
|
|
19
|
+
* name: "city",
|
|
20
|
+
* dataType: ["string"],
|
|
21
|
+
* description: "City of residence",
|
|
22
|
+
* indexInverted: true,
|
|
23
|
+
* indexFilterable: true,
|
|
24
|
+
* weight: 0.5
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface SearchableField {
|
|
29
|
+
/** The name of the field in the Weaviate schema */
|
|
30
|
+
name: string;
|
|
31
|
+
|
|
32
|
+
/** Array of data types that this field can contain (e.g., ['string', 'text']) */
|
|
33
|
+
dataType: string[];
|
|
34
|
+
|
|
35
|
+
/** Optional human-readable description of what this field represents */
|
|
36
|
+
description?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether to create an inverted index for this field (enables full-text search)
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
indexInverted?: boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Whether this field can be used in filter operations (WHERE clauses)
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
indexFilterable?: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Whether this field is included in search operations and can be searched against
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
indexSearchable?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Weight for BM25 scoring algorithm - higher values make this field more important in text search relevance
|
|
58
|
+
* @default 1.0
|
|
59
|
+
* @example
|
|
60
|
+
* - 2.0: High importance (names, titles)
|
|
61
|
+
* - 1.5: Medium-high importance (normalized names)
|
|
62
|
+
* - 1.0: Normal importance (descriptions, bios)
|
|
63
|
+
* - 0.5: Low importance (metadata, locations)
|
|
64
|
+
* - 0.3: Very low importance (codes, IDs)
|
|
65
|
+
*/
|
|
66
|
+
weight?: number;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Boost factor for vector search - multiplies the similarity score for this field in vector-based searches
|
|
70
|
+
* @default 1.0
|
|
71
|
+
* @example
|
|
72
|
+
* - 1.5: High vector search boost (primary search fields)
|
|
73
|
+
* - 1.2: Medium vector search boost (secondary fields)
|
|
74
|
+
* - 1.0: No boost (default)
|
|
75
|
+
*/
|
|
76
|
+
boost?: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Tokenization method for text fields in Weaviate
|
|
80
|
+
* @example
|
|
81
|
+
* - "field": Tokenize the entire field as a single token
|
|
82
|
+
* - "word": Tokenize by words (default)
|
|
83
|
+
* - "lowercase": Convert to lowercase before tokenization
|
|
84
|
+
* - "whitespace": Split on whitespace
|
|
85
|
+
*/
|
|
86
|
+
tokenization?: "field" | "word" | "lowercase" | "whitespace";
|
|
87
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface VectorIndexConfig {
|
|
2
|
+
distance?: "cosine" | "dot" | "l2-squared" | "hamming" | "manhattan";
|
|
3
|
+
ef?: number;
|
|
4
|
+
efConstruction?: number;
|
|
5
|
+
maxConnections?: number;
|
|
6
|
+
efSearch?: number;
|
|
7
|
+
skip?: boolean;
|
|
8
|
+
cleanupIntervalSeconds?: number;
|
|
9
|
+
pq?: {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
segments?: number;
|
|
12
|
+
centroids?: number;
|
|
13
|
+
trainingLimit?: number;
|
|
14
|
+
encoder?: {
|
|
15
|
+
type?: string;
|
|
16
|
+
distribution?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SearchOptions } from "./SearchOptions.js";
|
|
2
|
+
|
|
3
|
+
export interface VectorSearchOptions extends SearchOptions {
|
|
4
|
+
nearText?: {
|
|
5
|
+
concepts: string[];
|
|
6
|
+
certainty?: number;
|
|
7
|
+
moveAwayFrom?: { concepts: string[]; force: number };
|
|
8
|
+
moveTo?: { concepts: string[]; force: number };
|
|
9
|
+
};
|
|
10
|
+
nearVector?: {
|
|
11
|
+
vector: number[];
|
|
12
|
+
certainty?: number;
|
|
13
|
+
};
|
|
14
|
+
nearObject?: {
|
|
15
|
+
id: string;
|
|
16
|
+
certainty?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Schema-related types
|
|
2
|
+
|
|
3
|
+
export type { BM25SearchOptions } from "./BM25SearchOptions.js";
|
|
4
|
+
export type { ExtendedWeaviateClient } from "./ExtendedWeaviateClient.js";
|
|
5
|
+
export type { HybridSearchOptions } from "./HybridSearchOptions.js";
|
|
6
|
+
// Multi-tenancy types
|
|
7
|
+
export type {
|
|
8
|
+
CreateTenantOptions,
|
|
9
|
+
MultiTenancyConfig,
|
|
10
|
+
MultiTenantSearchOptions,
|
|
11
|
+
Tenant,
|
|
12
|
+
TenantActivityStatus,
|
|
13
|
+
TenantContext,
|
|
14
|
+
TenantManagementResult,
|
|
15
|
+
TenantStats,
|
|
16
|
+
UpdateTenantOptions,
|
|
17
|
+
} from "./MultiTenancy.js";
|
|
18
|
+
// Plugin types
|
|
19
|
+
export type { Plugin } from "./Plugin.js";
|
|
20
|
+
export type { SchemaConfig } from "./SchemaConfig.js";
|
|
21
|
+
export type { SearchableField } from "./SearchableField.js";
|
|
22
|
+
export type { SearchMethod } from "./SearchMethod.js";
|
|
23
|
+
// Search-related types
|
|
24
|
+
export type { SearchOptions } from "./SearchOptions.js";
|
|
25
|
+
export type { SearchRequest } from "./SearchRequest.js";
|
|
26
|
+
export type { SearchResult } from "./SearchResult.js";
|
|
27
|
+
export type { VectorIndexConfig } from "./VectorIndexConfig.js";
|
|
28
|
+
export type { Vectorizer, VectorizerConfig } from "./VectorizerConfig.js";
|
|
29
|
+
export type { VectorSearchOptions } from "./VectorSearchOptions.js";
|