@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
80 lines (79 loc) • 3.32 kB
JavaScript
"use strict";
/**
* Embedding Migration REST API Response Schemas
*
* PRD #384: Optional Local Embedding Service
* Schemas for the embedding migration endpoint (not exposed via MCP)
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmbeddingMigrationErrorSchema = exports.EmbeddingMigrationServiceUnavailableErrorSchema = exports.EmbeddingMigrationBadRequestErrorSchema = exports.EmbeddingMigrationResponseSchema = exports.EmbeddingMigrationDataSchema = exports.CollectionMigrationResultSchema = exports.EmbeddingMigrationRequestSchema = void 0;
const zod_1 = require("zod");
const common_1 = require("./common");
/**
* Embedding migration request body
*/
exports.EmbeddingMigrationRequestSchema = zod_1.z.object({
collection: zod_1.z
.string()
.optional()
.describe('Collection name to migrate. If omitted, migrates all collections.'),
});
/**
* Per-collection migration result
*/
exports.CollectionMigrationResultSchema = zod_1.z.object({
collection: zod_1.z.string().describe('Collection name'),
status: zod_1.z
.enum(['migrated', 'skipped', 'failed'])
.describe('Migration outcome'),
previousDimensions: zod_1.z.number().describe('Vector dimensions before migration'),
newDimensions: zod_1.z.number().describe('Vector dimensions after migration'),
total: zod_1.z.number().describe('Total points in the collection'),
processed: zod_1.z.number().describe('Points successfully re-embedded'),
failed: zod_1.z.number().describe('Points that failed to re-embed'),
error: zod_1.z.string().optional().describe('Error message if migration failed'),
});
/**
* Embedding migration response data
*/
exports.EmbeddingMigrationDataSchema = zod_1.z.object({
collections: zod_1.z
.array(exports.CollectionMigrationResultSchema)
.describe('Per-collection results'),
summary: zod_1.z.object({
totalCollections: zod_1.z.number().describe('Total collections processed'),
migrated: zod_1.z.number().describe('Collections successfully migrated'),
skipped: zod_1.z
.number()
.describe('Collections skipped (dimensions already match)'),
failed: zod_1.z.number().describe('Collections that failed to migrate'),
}),
});
/**
* Embedding migration success response
*/
exports.EmbeddingMigrationResponseSchema = (0, common_1.createSuccessResponseSchema)(exports.EmbeddingMigrationDataSchema);
/**
* Embedding migration error responses
*/
exports.EmbeddingMigrationBadRequestErrorSchema = common_1.ErrorResponseSchema.extend({
error: zod_1.z.object({
code: zod_1.z.literal('BAD_REQUEST'),
message: zod_1.z.string(),
details: zod_1.z.unknown().optional(),
}),
});
exports.EmbeddingMigrationServiceUnavailableErrorSchema = common_1.ErrorResponseSchema.extend({
error: zod_1.z.object({
code: zod_1.z.enum(['EMBEDDING_SERVICE_UNAVAILABLE', 'PLUGIN_UNAVAILABLE']),
message: zod_1.z.string(),
details: zod_1.z.unknown().optional(),
}),
});
exports.EmbeddingMigrationErrorSchema = common_1.ErrorResponseSchema.extend({
error: zod_1.z.object({
code: zod_1.z.literal('MIGRATION_ERROR'),
message: zod_1.z.string(),
details: zod_1.z.unknown().optional(),
}),
});