{"version":3,"file":"schema-Dg8Da55W.mjs","names":[],"sources":["../src/api/handlers/schema.ts"],"sourcesContent":["/**\n * Schema/collection management handlers\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { invalidateCollectionCache } from \"../../object-cache/index.js\";\nimport {\n\tSchemaRegistry,\n\tSchemaError,\n\tinvalidateSchemaCache,\n\ttype Collection,\n\ttype Field,\n\ttype CreateCollectionInput,\n\ttype UpdateCollectionInput,\n\ttype CreateFieldInput,\n\ttype UpdateFieldInput,\n\ttype CollectionWithFields,\n} from \"../../schema/index.js\";\nimport type { ApiResult } from \"../types.js\";\n\nfunction invalidateFieldCaches(collectionSlug: string): void {\n\tinvalidateCollectionCache(collectionSlug);\n\tinvalidateSchemaCache(collectionSlug);\n}\n\nexport interface CollectionListResponse {\n\titems: Collection[];\n}\n\nexport interface CollectionResponse {\n\titem: Collection;\n}\n\nexport interface CollectionWithFieldsResponse {\n\titem: CollectionWithFields;\n}\n\nexport interface FieldListResponse {\n\titems: Field[];\n}\n\nexport interface FieldResponse {\n\titem: Field;\n}\n\n/**\n * List all collections\n */\nexport async function handleSchemaCollectionList(\n\tdb: Kysely<Database>,\n): Promise<ApiResult<CollectionListResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst items = await registry.listCollections();\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { items },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list collections\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get a collection by slug\n */\nexport async function handleSchemaCollectionGet(\n\tdb: Kysely<Database>,\n\tslug: string,\n\toptions?: { includeFields?: boolean },\n): Promise<ApiResult<CollectionResponse | CollectionWithFieldsResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\n\t\tif (options?.includeFields) {\n\t\t\tconst item = await registry.getCollectionWithFields(slug);\n\t\t\tif (!item) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tmessage: `Collection not found: ${slug}`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { item },\n\t\t\t};\n\t\t}\n\n\t\tconst item = await registry.getCollection(slug);\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection not found: ${slug}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get collection\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create a collection\n */\nexport async function handleSchemaCollectionCreate(\n\tdb: Kysely<Database>,\n\tinput: CreateCollectionInput,\n): Promise<ApiResult<CollectionResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.createCollection(input);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[emdash] Failed to create collection:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_CREATE_ERROR\",\n\t\t\t\tmessage: \"Failed to create collection\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Update a collection\n */\nexport async function handleSchemaCollectionUpdate(\n\tdb: Kysely<Database>,\n\tslug: string,\n\tinput: UpdateCollectionInput,\n): Promise<ApiResult<CollectionResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.updateCollection(slug, input);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_UPDATE_ERROR\",\n\t\t\t\tmessage: \"Failed to update collection\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Delete a collection\n */\nexport async function handleSchemaCollectionDelete(\n\tdb: Kysely<Database>,\n\tslug: string,\n\toptions?: { force?: boolean },\n): Promise<ApiResult<{ success: boolean }>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tawait registry.deleteCollection(slug, options);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { success: true },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_DELETE_ERROR\",\n\t\t\t\tmessage: \"Failed to delete collection\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * List fields for a collection\n */\nexport async function handleSchemaFieldList(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n): Promise<ApiResult<FieldListResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst collection = await registry.getCollection(collectionSlug);\n\n\t\tif (!collection) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection not found: ${collectionSlug}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst items = await registry.listFields(collection.id);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { items },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list fields\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get a field\n */\nexport async function handleSchemaFieldGet(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tfieldSlug: string,\n): Promise<ApiResult<FieldResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.getField(collectionSlug, fieldSlug);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Field not found: ${fieldSlug} in collection ${collectionSlug}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get field\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create a field\n */\nexport async function handleSchemaFieldCreate(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tinput: CreateFieldInput,\n): Promise<ApiResult<FieldResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.createField(collectionSlug, input);\n\n\t\t// Content snapshots embed field values; a column change invalidates them.\n\t\tinvalidateFieldCaches(collectionSlug);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_CREATE_ERROR\",\n\t\t\t\tmessage: \"Failed to create field\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Update a field\n */\nexport async function handleSchemaFieldUpdate(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tfieldSlug: string,\n\tinput: UpdateFieldInput,\n): Promise<ApiResult<FieldResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.updateField(collectionSlug, fieldSlug, input);\n\n\t\tinvalidateFieldCaches(collectionSlug);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_UPDATE_ERROR\",\n\t\t\t\tmessage: \"Failed to update field\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Delete a field\n */\nexport async function handleSchemaFieldDelete(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tfieldSlug: string,\n): Promise<ApiResult<{ success: boolean }>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tawait registry.deleteField(collectionSlug, fieldSlug);\n\n\t\tinvalidateFieldCaches(collectionSlug);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { success: true },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_DELETE_ERROR\",\n\t\t\t\tmessage: \"Failed to delete field\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Reorder collections in the admin sidebar\n */\nexport async function handleSchemaCollectionReorder(\n\tdb: Kysely<Database>,\n\tslugs: string[],\n): Promise<ApiResult<{ success: boolean }>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tawait registry.reorderCollections(slugs);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { success: true },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[emdash] Failed to reorder collections:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_COLLECTION_REORDER_ERROR\",\n\t\t\t\tmessage: \"Failed to reorder collections\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Reorder fields\n */\nexport async function handleSchemaFieldReorder(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tfieldSlugs: string[],\n): Promise<ApiResult<{ success: boolean }>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tawait registry.reorderFields(collectionSlug, fieldSlugs);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { success: true },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SCHEMA_FIELD_REORDER_ERROR\",\n\t\t\t\tmessage: \"Failed to reorder fields\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ============================================\n// Orphaned Table Discovery\n// ============================================\n\nexport interface OrphanedTable {\n\tslug: string;\n\ttableName: string;\n\trowCount: number;\n}\n\nexport interface OrphanedTableListResponse {\n\titems: OrphanedTable[];\n}\n\n/**\n * List orphaned content tables\n */\nexport async function handleOrphanedTableList(\n\tdb: Kysely<Database>,\n): Promise<ApiResult<OrphanedTableListResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst items = await registry.discoverOrphanedTables();\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { items },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[emdash] Failed to list orphaned tables:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"ORPHAN_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list orphaned tables\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Register an orphaned table as a collection\n */\nexport async function handleOrphanedTableRegister(\n\tdb: Kysely<Database>,\n\tslug: string,\n\toptions?: {\n\t\tlabel?: string;\n\t\tlabelSingular?: string;\n\t\tdescription?: string;\n\t},\n): Promise<ApiResult<CollectionResponse>> {\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst item = await registry.registerOrphanedTable(slug, options);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof SchemaError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: error.code,\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tdetails: error.details,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"ORPHAN_REGISTER_ERROR\",\n\t\t\t\tmessage: \"Failed to register orphaned table\",\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,sBAAsB,gBAA8B;AAC5D,2BAA0B,eAAe;AACzC,uBAAsB,eAAe;;;;;AA0BtC,eAAsB,2BACrB,IAC6C;AAC7C,KAAI;AAIH,SAAO;GACN,SAAS;GACT,MAAM,EAAE,OAJK,MADG,IAAI,eAAe,GAAG,CACV,iBAAiB,EAI9B;GACf;SACM;AACP,SAAO;GACN,SAAS;GACT,OAAO;IACN,MAAM;IACN,SAAS;IACT;GACD;;;;;;AAOH,eAAsB,0BACrB,IACA,MACA,SACwE;AACxE,KAAI;EACH,MAAM,WAAW,IAAI,eAAe,GAAG;AAEvC,MAAI,SAAS,eAAe;GAC3B,MAAM,OAAO,MAAM,SAAS,wBAAwB,KAAK;AACzD,OAAI,CAAC,KACJ,QAAO;IACN,SAAS;IACT,OAAO;KACN,MAAM;KACN,SAAS,yBAAyB;KAClC;IACD;AAEF,UAAO;IACN,SAAS;IACT,MAAM,EAAE,MAAM;IACd;;EAGF,MAAM,OAAO,MAAM,SAAS,cA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