import { Node } from 'contensis-delivery-api'; import { MigrateStatus } from './Migration'; import { ModelDependencies } from './ModelDependencies'; type ListOfIds = string[]; type ListOfEntryIds = string[]; type ListOfNodePaths = string[]; export type ResourcesToMigrate = { contentTypeIds: ListOfIds; componentIds: ListOfIds; entryIds: ListOfIds; nodes: Node[]; tagGroupIds: ListOfIds; }; export type DependencyStatus = { id?: string; diff?: string; entryId?: string; parentId?: string; status: MigrateStatus; error?: string; versionNo?: string; }; export type DependencyStatusByTarget = { [projectId: string]: DependencyStatus; }; export type ModelDependency = { dataFormat?: string; dependencyOf: ListOfIds; dependencies: ListOfIds; defaults: ListOfEntryIds; nodes: ListOfNodePaths; projects: DependencyStatusByTarget; }; export type AnalysedModels = { contentTypes: { [dependencyId: string]: ModelDependency; }; components: { [dependencyId: string]: ModelDependency; }; tagGroups: { [dependencyId: string]: { dependencyOf: ListOfIds; projects: DependencyStatusByTarget; }; }; defaults: { [entryId: string]: { entryTitle?: string; contentTypeId?: string; dependencyOf: ListOfIds; projects: DependencyStatusByTarget; }; }; nodes: { [nodePath: string]: { id?: string; dependencyOf: ListOfIds; projects: DependencyStatusByTarget; }; }; }; export type MigrateContentModel = { id: string; status?: MigrateStatus; diff?: string; projectIds?: ListOfIds; dependencyOf?: ModelDependencies['dependencyOf']; dependencies?: ModelDependencies['dependencies']; }; export type AnalysedModelsResult = { contentTypes: MigrateContentModel[]; components: MigrateContentModel[]; }; export type MigrateContentModelsResponse = { contentTypes: MigrateContentModelResponse[]; components: MigrateContentModelResponse[]; defaults: MigrateContentModelResponse[]; nodes: MigrateContentModelResponse[]; tagGroups: MigrateContentModelResponse[]; }; export type MigrateContentModelResponse = { id: string; status?: MigrateStatus; dependencyOf?: ListOfIds; dependencies?: ListOfIds; } & (T extends 'status' ? { diff?: [string, string][]; projectIds?: ListOfIds; entryTitle: string; contentTypeId: string; dataFormat: string; path: string; } : { diff?: string; }); export type MigrateModelsPreview = { status: { [id in MigrateStatus]: MigrateContentModelsResponse; }; projects: { [projectId: string]: MigrateContentModelsResponse<'project'>; }; } & AnalysedModels; export type DiffResponse = AnalysedModelsResult; export type MigrateModelsResult = { [projectId: string]: { contentTypes: MigrateModelsEntityResult; components: MigrateModelsEntityResult; defaults: MigrateModelsEntityResult; nodes: MigrateModelsEntityResult; tagGroups: MigrateModelsEntityResult; }; }; export type MigrateModelsEntityResult = { unchanged: string[]; created: string[]; updated: string[]; errors: [string, AppError][]; }; export {};