@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,443 @@
|
|
|
1
|
+
# Weaviate - Quick Start Guide
|
|
2
|
+
|
|
3
|
+
Get up and running with the Weaviate Vector Search Framework in minutes!
|
|
4
|
+
|
|
5
|
+
## ๐ Basic Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import Weaviate, { WeaviateConfigService, WeaviateError, WeaviateErrorCode } from "./lib/weaviate";
|
|
9
|
+
import { schemas } from "./config/schemas";
|
|
10
|
+
|
|
11
|
+
// 1. Initialize Weaviate client (once at app startup)
|
|
12
|
+
await WeaviateConfigService.initializeClient();
|
|
13
|
+
|
|
14
|
+
// 2. Create Weaviate instance
|
|
15
|
+
const weaviate = new Weaviate();
|
|
16
|
+
|
|
17
|
+
// 3. Initialize schemas (once at app startup)
|
|
18
|
+
await weaviate.initializeSchemas(schemas);
|
|
19
|
+
|
|
20
|
+
// 4. Search with the new discriminated union pattern
|
|
21
|
+
const people = await weaviate.search("Person", {
|
|
22
|
+
method: "hybrid",
|
|
23
|
+
options: {
|
|
24
|
+
hybrid: { query: "software engineer", alpha: 0.5 },
|
|
25
|
+
limit: 10
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// 5. Use convenience methods for simpler syntax
|
|
30
|
+
const results = await weaviate.hybridSearch("Person", "AI researcher");
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## ๐๏ธ Constructor & Configuration
|
|
34
|
+
|
|
35
|
+
### Default Initialization
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Auto-initializes with default plugins
|
|
39
|
+
const weaviate = new Weaviate();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Custom Configuration
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { WeaviateOptions } from "./lib/weaviate";
|
|
46
|
+
|
|
47
|
+
// With custom registry
|
|
48
|
+
const weaviate = new Weaviate({
|
|
49
|
+
registry: myCustomRegistry
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// With custom plugins
|
|
53
|
+
const weaviate = new Weaviate({
|
|
54
|
+
plugins: [new MyCustomPlugin()]
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## ๐ Search Methods
|
|
59
|
+
|
|
60
|
+
### Type-Safe Search (Recommended)
|
|
61
|
+
|
|
62
|
+
The new discriminated union pattern provides compile-time type safety:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Vector search - TypeScript knows options must include nearText
|
|
66
|
+
const vectorResults = await weaviate.search("Person", {
|
|
67
|
+
method: "vector",
|
|
68
|
+
options: {
|
|
69
|
+
nearText: { concepts: ["engineer"], certainty: 0.7 },
|
|
70
|
+
limit: 10
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// BM25 search - TypeScript knows options must include bm25
|
|
75
|
+
const keywordResults = await weaviate.search("Person", {
|
|
76
|
+
method: "bm25",
|
|
77
|
+
options: {
|
|
78
|
+
bm25: { query: "John Smith" },
|
|
79
|
+
limit: 10
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Hybrid search - TypeScript knows options must include hybrid
|
|
84
|
+
const hybridResults = await weaviate.search("Person", {
|
|
85
|
+
method: "hybrid",
|
|
86
|
+
options: {
|
|
87
|
+
hybrid: { query: "AI expert", alpha: 0.5 },
|
|
88
|
+
limit: 10
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Convenience Methods (Simpler)
|
|
94
|
+
|
|
95
|
+
For common use cases, use convenience methods:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Vector search with concepts
|
|
99
|
+
await weaviate.vectorSearch("Person", ["machine learning expert"]);
|
|
100
|
+
|
|
101
|
+
// BM25 keyword search
|
|
102
|
+
await weaviate.textSearch("Person", "John Smith");
|
|
103
|
+
|
|
104
|
+
// Hybrid search
|
|
105
|
+
await weaviate.hybridSearch("Person", "AI researcher", { alpha: 0.5 });
|
|
106
|
+
|
|
107
|
+
// Smart search (auto-selects method)
|
|
108
|
+
await weaviate.smartSearch("Person", "software engineer");
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## ๐จ Error Handling
|
|
112
|
+
|
|
113
|
+
All operations now throw structured `WeaviateError` instances:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { WeaviateError, WeaviateErrorCode } from "./lib/weaviate";
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
await weaviate.createObject({
|
|
120
|
+
class: "Person",
|
|
121
|
+
properties: { name: "John Doe", email: "john@example.com" }
|
|
122
|
+
});
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (error instanceof WeaviateError) {
|
|
125
|
+
console.log(`Error Code: ${error.code}`);
|
|
126
|
+
console.log(`Message: ${error.message}`);
|
|
127
|
+
console.log(`Details:`, error.details);
|
|
128
|
+
|
|
129
|
+
// Handle specific error types
|
|
130
|
+
if (error.is(WeaviateErrorCode.OBJECT_CREATION_ERROR)) {
|
|
131
|
+
// Retry logic
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See [Error Handling Guide](./ERROR_HANDLING.md) for complete documentation.
|
|
138
|
+
|
|
139
|
+
## ๐ง Query Builder
|
|
140
|
+
|
|
141
|
+
Build complex queries with a fluent API:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { QueryPatterns } from "./lib/weaviate";
|
|
145
|
+
|
|
146
|
+
// Fluent query building
|
|
147
|
+
const query = weaviate
|
|
148
|
+
.queryBuilder("Person")
|
|
149
|
+
.limit(10)
|
|
150
|
+
.whereField("city", "Equal", "San Francisco")
|
|
151
|
+
.sort("createdAt", "desc");
|
|
152
|
+
|
|
153
|
+
const results = await weaviate.search(
|
|
154
|
+
"Person",
|
|
155
|
+
{
|
|
156
|
+
method: "hybrid",
|
|
157
|
+
options: query.buildHybridSearch("engineer", { alpha: 0.5 })
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Pre-built patterns
|
|
162
|
+
const dateQuery = QueryPatterns.dateRange("createdAt", startDate, endDate);
|
|
163
|
+
const textQuery = QueryPatterns.textContains("headline", "senior");
|
|
164
|
+
const inQuery = QueryPatterns.inValues("city", ["SF", "NY", "LA"]);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## ๐ Universal Search
|
|
168
|
+
|
|
169
|
+
Search across multiple schemas simultaneously:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const allResults = await weaviate.searchAll(
|
|
173
|
+
["Person", "Organization", "Conversation"],
|
|
174
|
+
{
|
|
175
|
+
method: "hybrid",
|
|
176
|
+
options: {
|
|
177
|
+
hybrid: { query: "AI", alpha: 0.6 },
|
|
178
|
+
limit: 5
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
// Returns: { Person: SearchResult, Organization: SearchResult, Conversation: SearchResult }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## ๐ข Multi-Tenancy
|
|
187
|
+
|
|
188
|
+
### Setup Multi-Tenant Schema
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
const schema = {
|
|
192
|
+
name: "UserDocuments",
|
|
193
|
+
description: "User-specific documents",
|
|
194
|
+
multiTenancy: {
|
|
195
|
+
enabled: true,
|
|
196
|
+
autoTenantCreation: true,
|
|
197
|
+
autoTenantActivation: true,
|
|
198
|
+
},
|
|
199
|
+
properties: [
|
|
200
|
+
{ name: "title", dataType: ["string"] },
|
|
201
|
+
{ name: "content", dataType: ["text"] }
|
|
202
|
+
]
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
await weaviate.initializeSchemas([schema]);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Create and Manage Tenants
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// Create tenant (validates name automatically)
|
|
212
|
+
await weaviate.createTenant("UserDocuments", {
|
|
213
|
+
name: "acme-corp", // Must be lowercase alphanumeric with hyphens
|
|
214
|
+
activityStatus: "HOT"
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// List tenants
|
|
218
|
+
const tenants = await weaviate.listTenants("UserDocuments");
|
|
219
|
+
|
|
220
|
+
// Get tenant stats
|
|
221
|
+
const stats = await weaviate.getTenantStats("UserDocuments");
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Tenant-Aware Search
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
// Search within specific tenant
|
|
228
|
+
const results = await weaviate.searchWithTenant(
|
|
229
|
+
"UserDocuments",
|
|
230
|
+
{
|
|
231
|
+
method: "hybrid",
|
|
232
|
+
options: {
|
|
233
|
+
hybrid: { query: "machine learning", alpha: 0.5 },
|
|
234
|
+
limit: 10
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"acme-corp"
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
// Smart search with tenant
|
|
241
|
+
const smartResults = await weaviate.smartSearchWithTenant(
|
|
242
|
+
"UserDocuments",
|
|
243
|
+
"AI expert",
|
|
244
|
+
"acme-corp"
|
|
245
|
+
);
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
See [Multi-Tenancy Guide](./MULTI_TENANCY.md) for comprehensive documentation.
|
|
249
|
+
|
|
250
|
+
## ๐ Search Method Comparison
|
|
251
|
+
|
|
252
|
+
| Method | Speed | Accuracy | Best For | Alpha Value |
|
|
253
|
+
|--------|-------|----------|----------|-------------|
|
|
254
|
+
| **Vector** | Medium | High (semantic) | Natural language queries | N/A |
|
|
255
|
+
| **BM25** | Fast | High (keyword) | Exact term matching | N/A |
|
|
256
|
+
| **Hybrid** | Medium | **Highest** | General purpose โจ | 0.0 - 1.0 |
|
|
257
|
+
|
|
258
|
+
### Alpha Parameter (Hybrid Search)
|
|
259
|
+
|
|
260
|
+
- `0.0` = Pure BM25 (keyword-only)
|
|
261
|
+
- `0.5` = Balanced (default, recommended)
|
|
262
|
+
- `1.0` = Pure vector (semantic-only)
|
|
263
|
+
|
|
264
|
+
## ๐ Built-In Plugins
|
|
265
|
+
|
|
266
|
+
The plugin system allows you to enhance your data during operations. Custom plugins can be registered during initialization:
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
// Register custom plugins
|
|
270
|
+
const weaviate = new Weaviate({
|
|
271
|
+
plugins: [new MyCustomPlugin()]
|
|
272
|
+
});
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
See [Plugin Development Guide](./PLUGIN_DEVELOPMENT.md) for creating custom plugins.
|
|
276
|
+
|
|
277
|
+
## ๐พ CRUD Operations
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// Create object
|
|
281
|
+
const id = await weaviate.createObject({
|
|
282
|
+
class: "Person",
|
|
283
|
+
properties: {
|
|
284
|
+
fullName: "John Doe",
|
|
285
|
+
email: "john@example.com"
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Create batch
|
|
290
|
+
const ids = await weaviate.createObjectsBatch([
|
|
291
|
+
{ class: "Person", properties: { fullName: "Alice" } },
|
|
292
|
+
{ class: "Person", properties: { fullName: "Bob" } }
|
|
293
|
+
]);
|
|
294
|
+
|
|
295
|
+
// Get object
|
|
296
|
+
const person = await weaviate.getObject("Person", id);
|
|
297
|
+
|
|
298
|
+
// Update object
|
|
299
|
+
await weaviate.updateObject("Person", id, {
|
|
300
|
+
email: "newemail@example.com"
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// Delete object
|
|
304
|
+
await weaviate.deleteObject("Person", id);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## ๐งช Testing Your Integration
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
import { describe, it, expect } from "vitest";
|
|
311
|
+
|
|
312
|
+
describe("Weaviate Integration", () => {
|
|
313
|
+
it("should search for people", async () => {
|
|
314
|
+
const results = await weaviate.search("Person", {
|
|
315
|
+
method: "hybrid",
|
|
316
|
+
options: {
|
|
317
|
+
hybrid: { query: "engineer" },
|
|
318
|
+
limit: 10
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
expect(results.objects).toBeDefined();
|
|
323
|
+
expect(results.total).toBeGreaterThan(0);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it("should handle errors", async () => {
|
|
327
|
+
await expect(
|
|
328
|
+
weaviate.search("NonExistent", {
|
|
329
|
+
method: "vector",
|
|
330
|
+
options: { nearText: { concepts: ["test"] } }
|
|
331
|
+
})
|
|
332
|
+
).rejects.toThrow(WeaviateError);
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## ๐ Performance Tips
|
|
338
|
+
|
|
339
|
+
1. **Use Hybrid Search** for best overall results
|
|
340
|
+
2. **Batch Operations** when creating multiple objects
|
|
341
|
+
3. **Limit Results** to what you actually need
|
|
342
|
+
4. **Index Strategically** - not all fields need to be searchable
|
|
343
|
+
5. **Use Multi-Tenancy** for natural data isolation
|
|
344
|
+
6. **Implement Error Handling** for resilient applications
|
|
345
|
+
|
|
346
|
+
## โ
Common Patterns
|
|
347
|
+
|
|
348
|
+
### Pattern 1: Initialize Once
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
// In your app initialization file
|
|
352
|
+
let weaviate: Weaviate;
|
|
353
|
+
|
|
354
|
+
export async function initializeWeaviate() {
|
|
355
|
+
await WeaviateConfigService.initializeClient();
|
|
356
|
+
weaviate = new Weaviate();
|
|
357
|
+
await weaviate.initializeSchemas(schemas);
|
|
358
|
+
return weaviate;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function getWeaviate() {
|
|
362
|
+
if (!weaviate) {
|
|
363
|
+
throw new Error("Weaviate not initialized");
|
|
364
|
+
}
|
|
365
|
+
return weaviate;
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Pattern 2: Error Handling Wrapper
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
async function safeSearch<T>(params: SearchParams): Promise<SearchResult<T> | null> {
|
|
373
|
+
try {
|
|
374
|
+
return await weaviate.search(params.schema, params.request);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
if (error instanceof WeaviateError) {
|
|
377
|
+
logger.error(`Search failed: ${error.code}`, error.details);
|
|
378
|
+
}
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Pattern 3: Tenant-Scoped Service
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
class TenantService {
|
|
388
|
+
constructor(
|
|
389
|
+
private weaviate: Weaviate,
|
|
390
|
+
private tenantId: string
|
|
391
|
+
) {}
|
|
392
|
+
|
|
393
|
+
async search(schema: string, query: string) {
|
|
394
|
+
return this.weaviate.searchWithTenant(
|
|
395
|
+
schema,
|
|
396
|
+
{
|
|
397
|
+
method: "hybrid",
|
|
398
|
+
options: { hybrid: { query }, limit: 10 }
|
|
399
|
+
},
|
|
400
|
+
this.tenantId
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## ๐ Next Steps
|
|
407
|
+
|
|
408
|
+
1. **Explore Examples**: See [Weaviate.example.ts](../Weaviate.example.ts) for comprehensive examples
|
|
409
|
+
2. **Read API Reference**: Check [API_REFERENCE.md](./API_REFERENCE.md) for all methods
|
|
410
|
+
3. **Schema Guide**: Learn schema patterns in [SCHEMA_GUIDE.md](./SCHEMA_GUIDE.md)
|
|
411
|
+
4. **Error Handling**: Master errors in [ERROR_HANDLING.md](./ERROR_HANDLING.md)
|
|
412
|
+
5. **Performance**: Optimize with [PERFORMANCE.md](./PERFORMANCE.md)
|
|
413
|
+
|
|
414
|
+
## ๐ Troubleshooting
|
|
415
|
+
|
|
416
|
+
### "Schema not found in registry"
|
|
417
|
+
```typescript
|
|
418
|
+
// Make sure schema is initialized before searching
|
|
419
|
+
await weaviate.initializeSchemas([yourSchema]);
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### "Invalid tenant name"
|
|
423
|
+
```typescript
|
|
424
|
+
// Tenant names must be lowercase alphanumeric with hyphens
|
|
425
|
+
// โ
Good: "acme-corp", "tenant-123"
|
|
426
|
+
// โ Bad: "Acme Corp", "tenant_123"
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### TypeScript errors with search
|
|
430
|
+
```typescript
|
|
431
|
+
// Make sure method and options match
|
|
432
|
+
// โ
Correct:
|
|
433
|
+
{ method: "hybrid", options: { hybrid: { query: "test" } } }
|
|
434
|
+
|
|
435
|
+
// โ Incorrect:
|
|
436
|
+
{ method: "hybrid", options: { nearText: { concepts: ["test"] } } }
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
**Ready to get started?** Copy the basic usage example and start searching! ๐
|
|
442
|
+
|
|
443
|
+
For more advanced usage, check out the [complete documentation](./README.md).
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Weaviate Documentation Hub
|
|
2
|
+
|
|
3
|
+
Welcome to the comprehensive documentation for the Weaviate Vector Search Framework!
|
|
4
|
+
|
|
5
|
+
## ๐ Documentation Structure
|
|
6
|
+
|
|
7
|
+
### ๐ Getting Started
|
|
8
|
+
|
|
9
|
+
Perfect for newcomers to the framework:
|
|
10
|
+
|
|
11
|
+
1. **[Quick Start Guide](./QUICK_START.md)** - Get up and running in 5 minutes
|
|
12
|
+
2. **[Configuration Guide](./CONFIGURATION.md)** - Environment setup and initialization
|
|
13
|
+
3. **[Complete Framework Guide](./WEAVIATE_README.md)** - In-depth framework documentation
|
|
14
|
+
|
|
15
|
+
### ๐ Core Documentation
|
|
16
|
+
|
|
17
|
+
Essential references for daily use:
|
|
18
|
+
|
|
19
|
+
- **[API Reference](./API_REFERENCE.md)** - Complete method documentation with examples
|
|
20
|
+
- **[Schema Guide](./SCHEMA_GUIDE.md)** - Creating and managing schemas
|
|
21
|
+
- **[Multi-Tenancy Guide](./MULTI_TENANCY.md)** - Tenant isolation and management
|
|
22
|
+
- **[Plugin Development](./PLUGIN_DEVELOPMENT.md)** - Creating custom plugins
|
|
23
|
+
- **[Performance Guide](./PERFORMANCE.md)** - Optimization tips and best practices
|
|
24
|
+
|
|
25
|
+
### ๐ง Technical Guides
|
|
26
|
+
|
|
27
|
+
Advanced topics and patterns:
|
|
28
|
+
|
|
29
|
+
- **[Error Handling](./ERROR_HANDLING.md)** - Comprehensive error handling with `WeaviateError`
|
|
30
|
+
- **[Working Examples](../Weaviate.example.ts)** - Comprehensive code examples
|
|
31
|
+
|
|
32
|
+
## ๐ฏ Quick Navigation
|
|
33
|
+
|
|
34
|
+
### For First-Time Users
|
|
35
|
+
|
|
36
|
+
1. Start with this **README** for an overview
|
|
37
|
+
2. Follow **[Quick Start](./QUICK_START.md)** to build your first integration
|
|
38
|
+
3. Review **[Working Examples](../Weaviate.example.ts)** for common patterns
|
|
39
|
+
4. Check **[API Reference](./API_REFERENCE.md)** when you need specific methods
|
|
40
|
+
|
|
41
|
+
### For Experienced Users
|
|
42
|
+
|
|
43
|
+
1. **[API Reference](./API_REFERENCE.md)** - Quick method lookup
|
|
44
|
+
2. **[Schema Guide](./SCHEMA_GUIDE.md)** - Advanced schema patterns
|
|
45
|
+
3. **[Plugin Development](./PLUGIN_DEVELOPMENT.md)** - Extending functionality
|
|
46
|
+
4. **[Performance Guide](./PERFORMANCE.md)** - Optimization techniques
|
|
47
|
+
|
|
48
|
+
### For Technical Leads
|
|
49
|
+
|
|
50
|
+
1. **[Complete Framework Guide](./WEAVIATE_README.md)** - Full feature documentation
|
|
51
|
+
2. **[Performance Guide](./PERFORMANCE.md)** - Optimization strategies
|
|
52
|
+
3. **[Error Handling](./ERROR_HANDLING.md)** - Error handling patterns
|
|
53
|
+
|
|
54
|
+
## ๐ Search This Documentation
|
|
55
|
+
|
|
56
|
+
### By Topic
|
|
57
|
+
|
|
58
|
+
**Search Operations**
|
|
59
|
+
- [API Reference - Search Methods](./API_REFERENCE.md#search-methods)
|
|
60
|
+
- [Quick Start - Basic Search](./QUICK_START.md)
|
|
61
|
+
- [Performance - Search Optimization](./PERFORMANCE.md)
|
|
62
|
+
|
|
63
|
+
**Schema Management**
|
|
64
|
+
- [Schema Guide](./SCHEMA_GUIDE.md)
|
|
65
|
+
- [API Reference - Schema Operations](./API_REFERENCE.md#schema-operations)
|
|
66
|
+
|
|
67
|
+
**Error Handling**
|
|
68
|
+
- [Error Handling Guide](./ERROR_HANDLING.md)
|
|
69
|
+
- [API Reference - WeaviateError](./API_REFERENCE.md)
|
|
70
|
+
|
|
71
|
+
**Multi-Tenancy**
|
|
72
|
+
- [Multi-Tenancy Guide](./MULTI_TENANCY.md)
|
|
73
|
+
- [API Reference - Tenant Methods](./API_REFERENCE.md#multi-tenancy)
|
|
74
|
+
|
|
75
|
+
**Plugins**
|
|
76
|
+
- [Plugin Development](./PLUGIN_DEVELOPMENT.md)
|
|
77
|
+
- [Built-in Plugins](./WEAVIATE_README.md#plugins)
|
|
78
|
+
|
|
79
|
+
## ๐ฆ Framework Components
|
|
80
|
+
|
|
81
|
+
### Core Classes
|
|
82
|
+
|
|
83
|
+
- **`Weaviate`** - Main framework class ([API Reference](./API_REFERENCE.md))
|
|
84
|
+
- **`WeaviateConfigService`** - Connection management ([Configuration](./CONFIGURATION.md))
|
|
85
|
+
- **`SchemaRegistry`** - Schema management ([Schema Guide](./SCHEMA_GUIDE.md))
|
|
86
|
+
- **`QueryBuilder`** - Fluent query API ([API Reference](./API_REFERENCE.md#query-builder))
|
|
87
|
+
|
|
88
|
+
### Error Handling
|
|
89
|
+
|
|
90
|
+
- **`WeaviateError`** - Structured error class ([Error Handling](./ERROR_HANDLING.md))
|
|
91
|
+
- **`WeaviateErrorCode`** - Error code enum ([Error Handling](./ERROR_HANDLING.md))
|
|
92
|
+
|
|
93
|
+
### Types
|
|
94
|
+
|
|
95
|
+
- **`SearchRequest`** - Discriminated union for search ([API Reference](./API_REFERENCE.md))
|
|
96
|
+
- **`SchemaConfig`** - Schema configuration ([Schema Guide](./SCHEMA_GUIDE.md))
|
|
97
|
+
- **`Plugin`** - Plugin interface ([Plugin Development](./PLUGIN_DEVELOPMENT.md))
|
|
98
|
+
|
|
99
|
+
### Utilities
|
|
100
|
+
|
|
101
|
+
- **`TenantContextManager`** - Tenant validation ([Multi-Tenancy](./MULTI_TENANCY.md))
|
|
102
|
+
- **`QueryPatterns`** - Common query patterns ([API Reference](./API_REFERENCE.md#query-patterns))
|
|
103
|
+
|
|
104
|
+
## ๐จ Common Use Cases
|
|
105
|
+
|
|
106
|
+
### 1. Basic Search
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const results = await weaviate.search("Person", {
|
|
110
|
+
method: "hybrid",
|
|
111
|
+
options: {
|
|
112
|
+
hybrid: { query: "engineer" },
|
|
113
|
+
limit: 10
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
๐ See: [Quick Start](./QUICK_START.md), [API Reference - Search](./API_REFERENCE.md#search-methods)
|
|
119
|
+
|
|
120
|
+
### 2. Multi-Tenant Search
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const results = await weaviate.searchWithTenant("Person", {
|
|
124
|
+
method: "hybrid",
|
|
125
|
+
options: { hybrid: { query: "engineer" } }
|
|
126
|
+
}, "tenant-123");
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
๐ See: [Multi-Tenancy Guide](./MULTI_TENANCY.md)
|
|
130
|
+
|
|
131
|
+
### 3. Custom Schema
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
const schema: SchemaConfig = {
|
|
135
|
+
name: "Product",
|
|
136
|
+
description: "Product catalog",
|
|
137
|
+
properties: [
|
|
138
|
+
{ name: "name", dataType: ["string"] },
|
|
139
|
+
{ name: "price", dataType: ["number"] }
|
|
140
|
+
]
|
|
141
|
+
};
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
๐ See: [Schema Guide](./SCHEMA_GUIDE.md)
|
|
145
|
+
|
|
146
|
+
### 4. Error Handling
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
try {
|
|
150
|
+
await weaviate.createObject({ ... });
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (error instanceof WeaviateError) {
|
|
153
|
+
console.log(`Error ${error.code}: ${error.message}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
๐ See: [Error Handling](./ERROR_HANDLING.md)
|
|
159
|
+
|
|
160
|
+
### 5. Custom Plugin
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
class MyPlugin implements Plugin {
|
|
164
|
+
name = "my-plugin";
|
|
165
|
+
version = "1.0.0";
|
|
166
|
+
hooks = {
|
|
167
|
+
beforeSearch: (schema, options) => {
|
|
168
|
+
// Custom logic
|
|
169
|
+
return options;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
๐ See: [Plugin Development](./PLUGIN_DEVELOPMENT.md)
|
|
176
|
+
|
|
177
|
+
## ๐จ Error Codes Reference
|
|
178
|
+
|
|
179
|
+
Quick reference for common error codes:
|
|
180
|
+
|
|
181
|
+
| Code | Description | Guide |
|
|
182
|
+
|------|-------------|-------|
|
|
183
|
+
| `SEARCH_ERROR` | Search operation failed | [Error Handling](./ERROR_HANDLING.md) |
|
|
184
|
+
| `OBJECT_CREATION_ERROR` | Failed to create object | [Error Handling](./ERROR_HANDLING.md) |
|
|
185
|
+
| `SCHEMA_VALIDATION_ERROR` | Schema validation failed | [Schema Guide](./SCHEMA_GUIDE.md) |
|
|
186
|
+
| `TENANT_VALIDATION_ERROR` | Invalid tenant name | [Multi-Tenancy](./MULTI_TENANCY.md) |
|
|
187
|
+
|
|
188
|
+
See complete list in [Error Handling Guide](./ERROR_HANDLING.md#error-codes).
|
|
189
|
+
|
|
190
|
+
## ๐ Performance Comparison
|
|
191
|
+
|
|
192
|
+
| Method | Speed | Accuracy | Best For |
|
|
193
|
+
|--------|-------|----------|----------|
|
|
194
|
+
| Vector | Medium | High (semantic) | Natural language |
|
|
195
|
+
| BM25 | Fast | High (keyword) | Exact matches |
|
|
196
|
+
| Hybrid | Medium | **Highest** | General purpose โจ |
|
|
197
|
+
|
|
198
|
+
๐ See: [Performance Guide](./PERFORMANCE.md)
|
|
199
|
+
|
|
200
|
+
## ๐งช Testing
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Run all tests
|
|
204
|
+
npm test
|
|
205
|
+
|
|
206
|
+
# Run Weaviate tests only
|
|
207
|
+
npm test -- src/lib/weaviate/
|
|
208
|
+
|
|
209
|
+
# Run with coverage
|
|
210
|
+
npm test -- --coverage
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Current test coverage: **Comprehensive test suite** โ
|
|
214
|
+
|
|
215
|
+
## ๐ Recent Updates
|
|
216
|
+
|
|
217
|
+
### Version 2.0.0 - Major Improvements
|
|
218
|
+
|
|
219
|
+
- โ
Discriminated union search API
|
|
220
|
+
- โ
Structured error handling with `WeaviateError`
|
|
221
|
+
- โ
Configurable plugin initialization
|
|
222
|
+
- โ
Fail-fast schema validation
|
|
223
|
+
- โ
Tenant name validation
|
|
224
|
+
- โ
Simplified architecture
|
|
225
|
+
- โ
Pure instance-based registry pattern
|
|
226
|
+
- โ
Removed unused default plugins
|
|
227
|
+
|
|
228
|
+
## ๐ค Contributing
|
|
229
|
+
|
|
230
|
+
When contributing to the framework:
|
|
231
|
+
|
|
232
|
+
1. Follow established patterns and conventions
|
|
233
|
+
2. Add comprehensive tests for new functionality
|
|
234
|
+
3. Update relevant documentation
|
|
235
|
+
4. Use structured error handling with proper error codes
|
|
236
|
+
5. Ensure all tests pass before submitting
|
|
237
|
+
|
|
238
|
+
## ๐ก Tips and Best Practices
|
|
239
|
+
|
|
240
|
+
1. **Use hybrid search** for general-purpose queries (best accuracy)
|
|
241
|
+
2. **Implement error handling** for all async operations
|
|
242
|
+
3. **Validate schemas** at registration time (fail-fast)
|
|
243
|
+
4. **Use plugins** to extend functionality without modifying core
|
|
244
|
+
5. **Enable multi-tenancy** for data isolation requirements
|
|
245
|
+
6. **Batch operations** when creating multiple objects
|
|
246
|
+
7. **Check error codes** for programmatic error handling
|
|
247
|
+
|
|
248
|
+
## ๐ External Resources
|
|
249
|
+
|
|
250
|
+
- [Weaviate Official Documentation](https://weaviate.io/developers/weaviate)
|
|
251
|
+
- [Vector Search Concepts](https://weaviate.io/developers/weaviate/concepts)
|
|
252
|
+
- [BM25 Algorithm](https://en.wikipedia.org/wiki/Okapi_BM25)
|
|
253
|
+
|
|
254
|
+
## ๐ Support
|
|
255
|
+
|
|
256
|
+
- **Bug Reports**: Check documentation for known patterns
|
|
257
|
+
- **Feature Requests**: Review existing patterns in documentation
|
|
258
|
+
- **Questions**: Start with [Quick Start Guide](./QUICK_START.md)
|
|
259
|
+
- **Examples**: See [Weaviate.example.ts](../Weaviate.example.ts)
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
**Framework Version**: 2.0.0
|
|
264
|
+
|
|
265
|
+
**Documentation Last Updated**: 2025
|
|
266
|
+
|
|
267
|
+
**Status**: โ
Production Ready
|
|
268
|
+
|
|
269
|
+
**Next Steps**: Start with [Quick Start Guide](./QUICK_START.md) โ
|