-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp-lifecycle-service.ts
More file actions
64 lines (57 loc) · 2.32 KB
/
Copy pathapp-lifecycle-service.ts
File metadata and controls
64 lines (57 loc) · 2.32 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
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* IAppLifecycleService - App Marketplace Installation Contract
*
* Defines the interface for installing, upgrading, and uninstalling
* marketplace apps into tenant databases.
*
* An app installation:
* 1. Checks compatibility with the tenant environment
* 2. Applies schema changes (creates tables, indexes)
* 3. Seeds initial data
* 4. Registers metadata (objects, views, flows) in the tenant registry
*/
import type { AppManifest, AppCompatibilityCheck, AppInstallResult } from '../system/app-install.zod.js';
// ==========================================================================
// Service Interface
// ==========================================================================
export interface IAppLifecycleService {
/**
* Check whether an app is compatible with a tenant's environment.
* Validates kernel version, existing objects, dependencies, and quotas.
*
* @param tenantId - Target tenant
* @param manifest - App manifest to check
* @returns Compatibility check result
*/
checkCompatibility(tenantId: string, manifest: AppManifest): Promise<AppCompatibilityCheck>;
/**
* Install an app into a tenant's database.
* Applies schema changes, seeds data, and registers metadata.
*
* @param tenantId - Target tenant
* @param manifest - App manifest
* @param config - Optional configuration overrides
* @returns Installation result
*/
installApp(tenantId: string, manifest: AppManifest, config?: Record<string, unknown>): Promise<AppInstallResult>;
/**
* Uninstall an app from a tenant's database.
* Removes metadata registrations. Optionally drops tables.
*
* @param tenantId - Target tenant
* @param appId - App to uninstall
* @param dropTables - Whether to drop database tables (default: false)
* @returns Whether the uninstallation succeeded
*/
uninstallApp(tenantId: string, appId: string, dropTables?: boolean): Promise<{ success: boolean }>;
/**
* Upgrade an installed app to a new version.
* Applies schema migrations and updates metadata.
*
* @param tenantId - Target tenant
* @param manifest - New version app manifest
* @returns Installation result for the upgrade
*/
upgradeApp(tenantId: string, manifest: AppManifest): Promise<AppInstallResult>;
}