stage 4-2
This commit is contained in:
@@ -2153,6 +2153,141 @@ export async function fetchSiteProgress(blueprintId: number): Promise<SiteProgre
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${blueprintId}/progress/`);
|
||||
}
|
||||
|
||||
// Stage 4: Sync Health API
|
||||
export interface SyncStatus {
|
||||
site_id: number;
|
||||
integrations: Array<{
|
||||
id: number;
|
||||
platform: string;
|
||||
status: string;
|
||||
last_sync_at: string | null;
|
||||
sync_enabled: boolean;
|
||||
is_healthy: boolean;
|
||||
error: string | null;
|
||||
mismatch_count: number;
|
||||
}>;
|
||||
overall_status: 'healthy' | 'warning' | 'error';
|
||||
last_sync_at: string | null;
|
||||
}
|
||||
|
||||
export interface SyncMismatches {
|
||||
taxonomies: {
|
||||
missing_in_wordpress: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
external_reference?: string;
|
||||
}>;
|
||||
missing_in_igny8: Array<{
|
||||
name: string;
|
||||
slug: string;
|
||||
type: string;
|
||||
external_reference: string;
|
||||
}>;
|
||||
mismatched: Array<any>;
|
||||
};
|
||||
products: {
|
||||
missing_in_wordpress: Array<any>;
|
||||
missing_in_igny8: Array<any>;
|
||||
};
|
||||
posts: {
|
||||
missing_in_wordpress: Array<any>;
|
||||
missing_in_igny8: Array<any>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SyncLog {
|
||||
integration_id: number;
|
||||
platform: string;
|
||||
timestamp: string;
|
||||
status: string;
|
||||
error: string | null;
|
||||
duration: number | null;
|
||||
items_processed: number | null;
|
||||
}
|
||||
|
||||
export async function fetchSyncStatus(siteId: number): Promise<SyncStatus> {
|
||||
return fetchAPI(`/v1/integration/integrations/sites/${siteId}/sync/status/`);
|
||||
}
|
||||
|
||||
export async function runSync(
|
||||
siteId: number,
|
||||
direction: 'both' | 'to_external' | 'from_external' = 'both',
|
||||
contentTypes?: string[]
|
||||
): Promise<{ site_id: number; sync_results: any[]; total_integrations: number }> {
|
||||
return fetchAPI(`/v1/integration/integrations/sites/${siteId}/sync/run/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ direction, content_types: contentTypes }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchSyncMismatches(siteId: number): Promise<SyncMismatches> {
|
||||
return fetchAPI(`/v1/integration/integrations/sites/${siteId}/sync/mismatches/`);
|
||||
}
|
||||
|
||||
export async function fetchSyncLogs(
|
||||
siteId: number,
|
||||
limit: number = 100,
|
||||
integrationId?: number
|
||||
): Promise<{ site_id: number; logs: SyncLog[]; count: number }> {
|
||||
const params = new URLSearchParams();
|
||||
params.append('limit', limit.toString());
|
||||
if (integrationId) params.append('integration_id', integrationId.toString());
|
||||
|
||||
return fetchAPI(`/v1/integration/integrations/sites/${siteId}/sync/logs/?${params.toString()}`);
|
||||
}
|
||||
|
||||
// Stage 4: Deployment Readiness API
|
||||
export interface DeploymentReadiness {
|
||||
ready: boolean;
|
||||
checks: {
|
||||
cluster_coverage: boolean;
|
||||
content_validation: boolean;
|
||||
sync_status: boolean;
|
||||
taxonomy_completeness: boolean;
|
||||
};
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
details: {
|
||||
cluster_coverage: {
|
||||
ready: boolean;
|
||||
total_clusters: number;
|
||||
covered_clusters: number;
|
||||
incomplete_clusters: Array<any>;
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
content_validation: {
|
||||
ready: boolean;
|
||||
total_content: number;
|
||||
valid_content: number;
|
||||
invalid_content: Array<any>;
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
sync_status: {
|
||||
ready: boolean;
|
||||
has_integration: boolean;
|
||||
sync_status: string | null;
|
||||
mismatch_count: number;
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
taxonomy_completeness: {
|
||||
ready: boolean;
|
||||
total_taxonomies: number;
|
||||
required_taxonomies: string[];
|
||||
missing_taxonomies: string[];
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchDeploymentReadiness(blueprintId: number): Promise<DeploymentReadiness> {
|
||||
return fetchAPI(`/v1/publisher/blueprints/${blueprintId}/readiness/`);
|
||||
}
|
||||
|
||||
export async function createSiteBlueprint(data: Partial<SiteBlueprint>): Promise<SiteBlueprint> {
|
||||
return fetchAPI('/v1/site-builder/blueprints/', {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user