@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,8 @@
|
|
|
1
|
+
export * from "./EmailAddress.js";
|
|
2
|
+
export * from "./EmailAttachment.js";
|
|
3
|
+
export * from "./EmailTag.js";
|
|
4
|
+
export * from "./EmailTemplate.js";
|
|
5
|
+
export * from "./SendBatchEmailsOptions.js";
|
|
6
|
+
export * from "./SendBatchEmailsResult.js";
|
|
7
|
+
export * from "./SendEmailOptions.js";
|
|
8
|
+
export * from "./SendEmailResult.js";
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BM25SearchOptions,
|
|
3
|
+
HybridSearchOptions,
|
|
4
|
+
SearchOptions,
|
|
5
|
+
VectorSearchOptions,
|
|
6
|
+
} from "./types/index.js";
|
|
7
|
+
|
|
8
|
+
export class QueryBuilder {
|
|
9
|
+
private options: SearchOptions = {};
|
|
10
|
+
|
|
11
|
+
constructor(_schemaName: string) {
|
|
12
|
+
this.options = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Set query limit
|
|
17
|
+
*/
|
|
18
|
+
limit(count: number): this {
|
|
19
|
+
this.options.limit = count;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Set query offset
|
|
25
|
+
*/
|
|
26
|
+
offset(count: number): this {
|
|
27
|
+
this.options.offset = count;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Add where clause
|
|
33
|
+
*/
|
|
34
|
+
where(condition: Record<string, any>): this {
|
|
35
|
+
this.options.where = condition;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Add field-based where clause
|
|
41
|
+
*/
|
|
42
|
+
whereField(field: string, operator: string, value: any): this {
|
|
43
|
+
this.options.where = {
|
|
44
|
+
path: [field],
|
|
45
|
+
operator,
|
|
46
|
+
valueString: typeof value === "string" ? value : String(value),
|
|
47
|
+
};
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Add multiple where conditions
|
|
53
|
+
*/
|
|
54
|
+
whereAnd(conditions: Array<{ field: string; operator: string; value: any }>): this {
|
|
55
|
+
if (conditions.length === 1) {
|
|
56
|
+
return this.whereField(conditions[0].field, conditions[0].operator, conditions[0].value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.options.where = {
|
|
60
|
+
operator: "And",
|
|
61
|
+
operands: conditions.map((cond) => ({
|
|
62
|
+
path: [cond.field],
|
|
63
|
+
operator: cond.operator,
|
|
64
|
+
valueString: typeof cond.value === "string" ? cond.value : String(cond.value),
|
|
65
|
+
})),
|
|
66
|
+
};
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Add OR where conditions
|
|
72
|
+
*/
|
|
73
|
+
whereOr(conditions: Array<{ field: string; operator: string; value: any }>): this {
|
|
74
|
+
this.options.where = {
|
|
75
|
+
operator: "Or",
|
|
76
|
+
operands: conditions.map((cond) => ({
|
|
77
|
+
path: [cond.field],
|
|
78
|
+
operator: cond.operator,
|
|
79
|
+
valueString: typeof cond.value === "string" ? cond.value : String(cond.value),
|
|
80
|
+
})),
|
|
81
|
+
};
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Add sort order
|
|
87
|
+
*/
|
|
88
|
+
sort(field: string, order: "asc" | "desc" = "asc"): this {
|
|
89
|
+
this.options.sort = [{ field, order }];
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Add multiple sort orders
|
|
95
|
+
*/
|
|
96
|
+
sortBy(sorts: Array<{ field: string; order: "asc" | "desc" }>): this {
|
|
97
|
+
this.options.sort = sorts;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Specify fields to return
|
|
103
|
+
*/
|
|
104
|
+
fields(fieldNames: string[]): this {
|
|
105
|
+
this.options.fields = fieldNames;
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Include vector in results
|
|
111
|
+
*/
|
|
112
|
+
includeVector(): this {
|
|
113
|
+
this.options.includeVector = true;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Include metadata in results
|
|
119
|
+
*/
|
|
120
|
+
includeMetadata(): this {
|
|
121
|
+
this.options.includeMetadata = true;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Build vector search options
|
|
127
|
+
*/
|
|
128
|
+
buildVectorSearch(
|
|
129
|
+
query: string,
|
|
130
|
+
options: {
|
|
131
|
+
concepts?: string[];
|
|
132
|
+
certainty?: number;
|
|
133
|
+
moveAwayFrom?: { concepts: string[]; force: number };
|
|
134
|
+
moveTo?: { concepts: string[]; force: number };
|
|
135
|
+
} = {},
|
|
136
|
+
): VectorSearchOptions {
|
|
137
|
+
return {
|
|
138
|
+
...this.options,
|
|
139
|
+
nearText: {
|
|
140
|
+
concepts: options.concepts || [query],
|
|
141
|
+
certainty: options.certainty,
|
|
142
|
+
moveAwayFrom: options.moveAwayFrom,
|
|
143
|
+
moveTo: options.moveTo,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Build BM25 search options
|
|
150
|
+
*/
|
|
151
|
+
buildBM25Search(
|
|
152
|
+
query: string,
|
|
153
|
+
options: {
|
|
154
|
+
properties?: string[];
|
|
155
|
+
boost?: number;
|
|
156
|
+
} = {},
|
|
157
|
+
): BM25SearchOptions {
|
|
158
|
+
return {
|
|
159
|
+
...this.options,
|
|
160
|
+
bm25: {
|
|
161
|
+
query,
|
|
162
|
+
properties: options.properties,
|
|
163
|
+
boost: options.boost,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Build hybrid search options
|
|
170
|
+
*/
|
|
171
|
+
buildHybridSearch(
|
|
172
|
+
query: string,
|
|
173
|
+
options: {
|
|
174
|
+
alpha?: number;
|
|
175
|
+
properties?: string[];
|
|
176
|
+
vector?: number[];
|
|
177
|
+
} = {},
|
|
178
|
+
): HybridSearchOptions {
|
|
179
|
+
return {
|
|
180
|
+
...this.options,
|
|
181
|
+
hybrid: {
|
|
182
|
+
query,
|
|
183
|
+
alpha: options.alpha || 0.5,
|
|
184
|
+
properties: options.properties,
|
|
185
|
+
vector: options.vector,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Build basic search options
|
|
192
|
+
*/
|
|
193
|
+
build(): SearchOptions {
|
|
194
|
+
return { ...this.options };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Reset builder
|
|
199
|
+
*/
|
|
200
|
+
reset(): this {
|
|
201
|
+
this.options = {};
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Clone builder
|
|
207
|
+
*/
|
|
208
|
+
clone(): QueryBuilder {
|
|
209
|
+
const cloned = new QueryBuilder("");
|
|
210
|
+
cloned.options = { ...this.options };
|
|
211
|
+
return cloned;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Factory function for creating query builders
|
|
217
|
+
*/
|
|
218
|
+
export function createQueryBuilder(schemaName: string): QueryBuilder {
|
|
219
|
+
return new QueryBuilder(schemaName);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Common query patterns
|
|
224
|
+
*/
|
|
225
|
+
export class QueryPatterns {
|
|
226
|
+
/**
|
|
227
|
+
* Search by date range
|
|
228
|
+
*/
|
|
229
|
+
static dateRange(field: string, startDate: Date, endDate: Date): QueryBuilder {
|
|
230
|
+
return createQueryBuilder("").whereAnd([
|
|
231
|
+
{ field, operator: "GreaterThanEqual", value: startDate.toISOString() },
|
|
232
|
+
{ field, operator: "LessThanEqual", value: endDate.toISOString() },
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Search by text contains
|
|
238
|
+
*/
|
|
239
|
+
static textContains(field: string, text: string): QueryBuilder {
|
|
240
|
+
return createQueryBuilder("").whereField(field, "Like", `*${text}*`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Search by exact match
|
|
245
|
+
*/
|
|
246
|
+
static exactMatch(field: string, value: any): QueryBuilder {
|
|
247
|
+
return createQueryBuilder("").whereField(field, "Equal", value);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Search by multiple values
|
|
252
|
+
*/
|
|
253
|
+
static inValues(field: string, values: any[]): QueryBuilder {
|
|
254
|
+
return createQueryBuilder("").where({
|
|
255
|
+
path: [field],
|
|
256
|
+
operator: "ContainsAny",
|
|
257
|
+
valueString: values.map((v) => String(v)),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Search by null/not null
|
|
263
|
+
*/
|
|
264
|
+
static isNull(field: string, isNull: boolean = true): QueryBuilder {
|
|
265
|
+
return createQueryBuilder("").where({
|
|
266
|
+
path: [field],
|
|
267
|
+
operator: "IsNull",
|
|
268
|
+
valueString: isNull,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Search by numeric range
|
|
274
|
+
*/
|
|
275
|
+
static numericRange(field: string, min?: number, max?: number): QueryBuilder {
|
|
276
|
+
const conditions: Array<{ field: string; operator: string; value: any }> = [];
|
|
277
|
+
|
|
278
|
+
if (min !== undefined) {
|
|
279
|
+
conditions.push({ field, operator: "GreaterThanEqual", value: min });
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (max !== undefined) {
|
|
283
|
+
conditions.push({ field, operator: "LessThanEqual", value: max });
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (conditions.length === 0) {
|
|
287
|
+
return createQueryBuilder("");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return createQueryBuilder("").whereAnd(conditions);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# `libraries/weaviate/` โ Weaviate vector search
|
|
2
|
+
|
|
3
|
+
A schema-driven framework around the Weaviate vector database with hybrid search, plugins, structured error handling, and an extensible architecture.
|
|
4
|
+
|
|
5
|
+
> **Install via**: `ship-api add -l weaviate`. Pulls in `weaviate-client`. Configure your Weaviate connection via env vars (see [`docs/CONFIGURATION.md`](./docs/CONFIGURATION.md)).
|
|
6
|
+
|
|
7
|
+
## ๐ Quick Start
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import Weaviate, { WeaviateConfigService } from "@sixthsummit/ship-api/libraries/weaviate";
|
|
11
|
+
import { schemas } from "./config/schemas";
|
|
12
|
+
|
|
13
|
+
// 1. Initialize Weaviate client
|
|
14
|
+
await WeaviateConfigService.initializeClient();
|
|
15
|
+
|
|
16
|
+
// 2. Create Weaviate instance (auto-initializes with default plugins)
|
|
17
|
+
const weaviate = new Weaviate();
|
|
18
|
+
|
|
19
|
+
// 3. Initialize schemas (once during app startup)
|
|
20
|
+
await weaviate.initializeSchemas(schemas);
|
|
21
|
+
|
|
22
|
+
// 4. Search with the new discriminated union pattern
|
|
23
|
+
const results = await weaviate.search("Person", {
|
|
24
|
+
method: "hybrid",
|
|
25
|
+
options: {
|
|
26
|
+
hybrid: { query: "engineer", alpha: 0.5 },
|
|
27
|
+
limit: 10,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// 5. Multi-tenant search
|
|
32
|
+
const tenantResults = await weaviate.searchWithTenant(
|
|
33
|
+
"Person",
|
|
34
|
+
{
|
|
35
|
+
method: "hybrid",
|
|
36
|
+
options: {
|
|
37
|
+
hybrid: { query: "engineer", alpha: 0.5 },
|
|
38
|
+
limit: 10,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
"acme-corp",
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## โจ What's New
|
|
46
|
+
|
|
47
|
+
### Recent Improvements
|
|
48
|
+
|
|
49
|
+
- โ
**Discriminated Union Search API** - Type-safe search requests
|
|
50
|
+
- โ
**Structured Error Handling** - `WeaviateError` with error codes
|
|
51
|
+
- โ
**Configurable Plugins** - Control plugin initialization via options
|
|
52
|
+
- โ
**Fail-Fast Validation** - Schema validation at registration time
|
|
53
|
+
- โ
**Tenant Name Validation** - Consistent validation with helpful error messages
|
|
54
|
+
- โ
**Simplified Architecture** - Merged `WeaviateService` into `Weaviate`
|
|
55
|
+
- โ
**Instance-Based Registry** - Pure instance pattern (no global state)
|
|
56
|
+
|
|
57
|
+
## ๐ Documentation
|
|
58
|
+
|
|
59
|
+
### Essential Guides
|
|
60
|
+
|
|
61
|
+
- ๐ **[Complete Documentation Hub](./docs/README.md)** - Central documentation index
|
|
62
|
+
- ๐ **[Quick Start Guide](./docs/QUICK_START.md)** - Get up and running in minutes
|
|
63
|
+
- ๐ **[API Reference](./docs/API_REFERENCE.md)** - Complete method documentation
|
|
64
|
+
- ๐๏ธ **[Schema Guide](./docs/SCHEMA_GUIDE.md)** - Creating and managing schemas
|
|
65
|
+
- โ๏ธ **[Configuration Guide](./docs/CONFIGURATION.md)** - Environment setup
|
|
66
|
+
- ๐ข **[Multi-Tenancy Guide](./docs/MULTI_TENANCY.md)** - Tenant isolation and management
|
|
67
|
+
- ๐ **[Plugin Development](./docs/PLUGIN_DEVELOPMENT.md)** - Creating custom plugins
|
|
68
|
+
- โก **[Performance Guide](./docs/PERFORMANCE.md)** - Optimization tips
|
|
69
|
+
|
|
70
|
+
### Technical Documentation
|
|
71
|
+
|
|
72
|
+
- ๐จ **[Error Handling](./docs/ERROR_HANDLING.md)** - Comprehensive error handling guide
|
|
73
|
+
- ๐ง **[Architecture Review](./docs/README.md)** - Design decisions and patterns
|
|
74
|
+
- ๐ **[Examples](./Weaviate.example.ts)** - Working code examples
|
|
75
|
+
|
|
76
|
+
## ๐ Key Features
|
|
77
|
+
|
|
78
|
+
### Core Functionality
|
|
79
|
+
|
|
80
|
+
- **๐ฏ Schema-Driven** - Define schemas in configuration files
|
|
81
|
+
- **โก Generic Operations** - Single methods work with any schema
|
|
82
|
+
- **๐ Hybrid Search** - Vector + BM25 search with configurable alpha
|
|
83
|
+
- **๐๏ธ Query Builder** - Fluent API for complex queries
|
|
84
|
+
- **๐ Plugin System** - Extensible with custom plugins
|
|
85
|
+
- **๐ค Smart Search** - Automatic method selection
|
|
86
|
+
- **๐ Universal Search** - Search across multiple schemas
|
|
87
|
+
- **๐ข Multi-Tenancy** - Built-in tenant isolation and management
|
|
88
|
+
- **๐จ Error Handling** - Structured errors with codes for programmatic handling
|
|
89
|
+
|
|
90
|
+
### Advanced Features
|
|
91
|
+
|
|
92
|
+
- **Type-Safe Search** - Discriminated unions for compile-time safety
|
|
93
|
+
- **Instance-Based Registry** - No global state, fully testable
|
|
94
|
+
- **Configurable Plugins** - Enable/disable default plugins or provide custom ones
|
|
95
|
+
- **Fail-Fast Validation** - Errors caught at registration, not runtime
|
|
96
|
+
- **Tenant Validation** - Automatic validation with helpful suggestions
|
|
97
|
+
- **Comprehensive Logging** - Contextual error messages for debugging
|
|
98
|
+
|
|
99
|
+
## ๐จ API Patterns
|
|
100
|
+
|
|
101
|
+
### Constructor Options
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// Default: Auto-initializes with default plugins
|
|
105
|
+
const weaviate = new Weaviate();
|
|
106
|
+
|
|
107
|
+
// Custom registry
|
|
108
|
+
const weaviate = new Weaviate({
|
|
109
|
+
registry: myCustomRegistry,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Custom plugins
|
|
113
|
+
const weaviate = new Weaviate({
|
|
114
|
+
plugins: [new MyPlugin()],
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Search Methods
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// Type-safe discriminated union pattern
|
|
122
|
+
const results = await weaviate.search("Person", {
|
|
123
|
+
method: "vector", // TypeScript narrows options based on method
|
|
124
|
+
options: {
|
|
125
|
+
nearText: { concepts: ["engineer"] },
|
|
126
|
+
limit: 10,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Convenience methods (simpler API)
|
|
131
|
+
await weaviate.vectorSearch("Person", ["engineer"]);
|
|
132
|
+
await weaviate.textSearch("Person", "John Smith");
|
|
133
|
+
await weaviate.hybridSearch("Person", "AI researcher");
|
|
134
|
+
await weaviate.smartSearch("Person", "software engineer");
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Error Handling
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { WeaviateError, WeaviateErrorCode } from "@sixthsummit/ship-api/libraries/weaviate";
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
await weaviate.createObject({ class: "Person", properties: { name: "John" } });
|
|
144
|
+
} catch (error) {
|
|
145
|
+
if (error instanceof WeaviateError) {
|
|
146
|
+
console.log(`Error ${error.code}: ${error.message}`);
|
|
147
|
+
|
|
148
|
+
if (error.is(WeaviateErrorCode.OBJECT_CREATION_ERROR)) {
|
|
149
|
+
// Handle creation errors specifically
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## ๐ Search Types
|
|
156
|
+
|
|
157
|
+
### Vector Search (Semantic)
|
|
158
|
+
|
|
159
|
+
Best for natural language queries where meaning matters more than exact matches.
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
await weaviate.vectorSearch("Person", ["machine learning expert"]);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### BM25 Search (Keyword)
|
|
166
|
+
|
|
167
|
+
Best for exact term matching and proper names.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
await weaviate.textSearch("Person", "John Smith");
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Hybrid Search (Recommended)
|
|
174
|
+
|
|
175
|
+
Combines both approaches for best overall results.
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
await weaviate.hybridSearch("Person", "AI researcher", { alpha: 0.5 });
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## ๐งช Testing
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Run all tests
|
|
185
|
+
npm test
|
|
186
|
+
|
|
187
|
+
# Run Weaviate tests only
|
|
188
|
+
npm test -- src/lib/weaviate/
|
|
189
|
+
|
|
190
|
+
# Run specific test file
|
|
191
|
+
npm test -- src/lib/weaviate/Weaviate.test.ts
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## ๐ฆ Package Structure
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
src/lib/weaviate/
|
|
198
|
+
โโโ Weaviate.ts # Main framework class
|
|
199
|
+
โโโ WeaviateConfig.ts # Connection management
|
|
200
|
+
โโโ QueryBuilder.ts # Fluent query API
|
|
201
|
+
โโโ SchemaRegistry.ts # Schema management
|
|
202
|
+
โโโ errors/ # Error classes and codes
|
|
203
|
+
โ โโโ WeaviateError.ts
|
|
204
|
+
โ โโโ index.ts
|
|
205
|
+
โโโ schemas/ # Schema system
|
|
206
|
+
โ โโโ SchemaRegistry.ts
|
|
207
|
+
โ โโโ index.ts
|
|
208
|
+
โโโ plugins/ # Plugin system
|
|
209
|
+
โ โโโ index.ts # Custom plugins can be added
|
|
210
|
+
โโโ types/ # TypeScript types
|
|
211
|
+
โ โโโ SearchRequest.ts
|
|
212
|
+
โ โโโ SchemaConfig.ts
|
|
213
|
+
โ โโโ ...
|
|
214
|
+
โโโ utils/ # Utilities
|
|
215
|
+
โ โโโ TenantContextManager.ts
|
|
216
|
+
โโโ docs/ # Documentation
|
|
217
|
+
โโโ README.md
|
|
218
|
+
โโโ API_REFERENCE.md
|
|
219
|
+
โโโ QUICK_START.md
|
|
220
|
+
โโโ ...
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## ๐ง Development
|
|
224
|
+
|
|
225
|
+
Built with TypeScript featuring:
|
|
226
|
+
|
|
227
|
+
- **Full Type Safety** - Discriminated unions and strict typing
|
|
228
|
+
- **Comprehensive Tests** - Full test coverage across all components
|
|
229
|
+
- **Plugin Architecture** - Extensible design for custom functionality
|
|
230
|
+
- **Schema Validation** - Fail-fast validation at registration time
|
|
231
|
+
- **Error Handling** - Structured errors with codes
|
|
232
|
+
- **Performance Optimizations** - Efficient batch operations and caching
|
|
233
|
+
|
|
234
|
+
## ๐ Examples
|
|
235
|
+
|
|
236
|
+
See [Weaviate.example.ts](./Weaviate.example.ts) for comprehensive examples including:
|
|
237
|
+
|
|
238
|
+
- Schema initialization
|
|
239
|
+
- All search methods
|
|
240
|
+
- Query builder usage
|
|
241
|
+
- Query patterns
|
|
242
|
+
- Universal search
|
|
243
|
+
- Custom schema registration
|
|
244
|
+
- CRUD operations
|
|
245
|
+
- Multi-tenancy
|
|
246
|
+
|
|
247
|
+
## ๐ค Contributing
|
|
248
|
+
|
|
249
|
+
When making changes:
|
|
250
|
+
|
|
251
|
+
1. Follow the established patterns
|
|
252
|
+
2. Add tests for new functionality
|
|
253
|
+
3. Update documentation
|
|
254
|
+
4. Run tests before committing
|
|
255
|
+
5. Use structured error handling with `WeaviateError`
|
|
256
|
+
|
|
257
|
+
## ๐ Performance Tips
|
|
258
|
+
|
|
259
|
+
1. Use **hybrid search** for general-purpose queries
|
|
260
|
+
2. Use **vector search** for semantic/conceptual queries
|
|
261
|
+
3. Use **BM25 search** for exact names and keywords
|
|
262
|
+
4. Batch operations when creating multiple objects
|
|
263
|
+
5. Use multi-tenancy for data isolation
|
|
264
|
+
6. Implement proper error handling for resilience
|
|
265
|
+
|
|
266
|
+
## ๐ Support
|
|
267
|
+
|
|
268
|
+
- **Documentation**: Start with [docs/README.md](./docs/README.md)
|
|
269
|
+
- **Examples**: See [Weaviate.example.ts](./Weaviate.example.ts)
|
|
270
|
+
- **API Reference**: Check [docs/API_REFERENCE.md](./docs/API_REFERENCE.md)
|
|
271
|
+
- **Error Handling**: Review [docs/ERROR_HANDLING.md](./docs/ERROR_HANDLING.md)
|
|
272
|
+
- **Architecture**: Review [docs/ARCHITECTURE_REVIEW.md](./docs/README.md) for design patterns
|
|
273
|
+
|
|
274
|
+
## ๐ License
|
|
275
|
+
|
|
276
|
+
Part of the SocialSweep API project.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
**Version**: 2.0.0 (Major refactoring with discriminated unions and structured errors)
|
|
281
|
+
|
|
282
|
+
**Last Updated**: 2025
|
|
283
|
+
|
|
284
|
+
**Status**: โ
Production Ready
|