-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeploy-pipeline-service.ts
More file actions
87 lines (78 loc) · 2.8 KB
/
Copy pathdeploy-pipeline-service.ts
File metadata and controls
87 lines (78 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* IDeployPipelineService - Metadata-Driven Deployment Pipeline Contract
*
* Orchestrates the complete deployment lifecycle:
* 1. Validate bundle (Zod schema validation)
* 2. Plan deployment (introspect → diff → generate migrations)
* 3. Execute deployment (apply migrations → register metadata)
* 4. Rollback on failure
*
* Target: 2-5 second deployments for schema changes.
* No Docker builds, no CI/CD pipelines — just metadata push.
*/
import type {
DeployBundle,
DeployValidationResult,
MigrationPlan,
DeployStatus,
} from '../system/deploy-bundle.zod.js';
// ==========================================================================
// Types
// ==========================================================================
/**
* Deployment execution result.
*/
export interface DeployExecutionResult {
/** Unique deployment identifier */
deploymentId: string;
/** Final deployment status */
status: DeployStatus;
/** Total execution duration in milliseconds */
durationMs: number;
/** Number of DDL statements executed */
statementsExecuted: number;
/** Error message if deployment failed */
error?: string;
/** Timestamp of deployment completion (ISO 8601) */
completedAt: string;
}
// ==========================================================================
// Service Interface
// ==========================================================================
export interface IDeployPipelineService {
/**
* Validate a deploy bundle against Zod schemas.
* Checks object definitions, view configs, flow definitions, and permissions.
*
* @param bundle - Deploy bundle to validate
* @returns Validation result with issues list
*/
validateBundle(bundle: DeployBundle): DeployValidationResult;
/**
* Plan a deployment by introspecting the current schema and generating
* a migration plan for the diff.
*
* @param tenantId - Target tenant
* @param bundle - Deploy bundle to plan for
* @returns Migration plan with ordered DDL statements
*/
planDeployment(tenantId: string, bundle: DeployBundle): Promise<MigrationPlan>;
/**
* Execute a deployment plan against a tenant's database.
* Applies DDL statements and registers metadata changes.
*
* @param tenantId - Target tenant
* @param plan - Migration plan to execute
* @returns Execution result with deployment ID and status
*/
executeDeployment(tenantId: string, plan: MigrationPlan): Promise<DeployExecutionResult>;
/**
* Rollback a previous deployment.
* Executes reverse DDL statements and restores previous metadata state.
*
* @param tenantId - Target tenant
* @param deploymentId - Deployment to rollback
*/
rollbackDeployment(tenantId: string, deploymentId: string): Promise<void>;
}