@memberjunction/installer 0.0.1 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/InstallerEngine.d.ts +182 -0
- package/dist/InstallerEngine.d.ts.map +1 -0
- package/dist/InstallerEngine.js +571 -0
- package/dist/InstallerEngine.js.map +1 -0
- package/dist/adapters/FileSystemAdapter.d.ts +197 -0
- package/dist/adapters/FileSystemAdapter.d.ts.map +1 -0
- package/dist/adapters/FileSystemAdapter.js +355 -0
- package/dist/adapters/FileSystemAdapter.js.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts +197 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.js +348 -0
- package/dist/adapters/GitHubReleaseProvider.js.map +1 -0
- package/dist/adapters/ProcessRunner.d.ts +174 -0
- package/dist/adapters/ProcessRunner.d.ts.map +1 -0
- package/dist/adapters/ProcessRunner.js +264 -0
- package/dist/adapters/ProcessRunner.js.map +1 -0
- package/dist/adapters/SqlServerAdapter.d.ts +78 -0
- package/dist/adapters/SqlServerAdapter.d.ts.map +1 -0
- package/dist/adapters/SqlServerAdapter.js +120 -0
- package/dist/adapters/SqlServerAdapter.js.map +1 -0
- package/dist/errors/InstallerError.d.ts +92 -0
- package/dist/errors/InstallerError.d.ts.map +1 -0
- package/dist/errors/InstallerError.js +66 -0
- package/dist/errors/InstallerError.js.map +1 -0
- package/dist/events/InstallerEvents.d.ts +255 -0
- package/dist/events/InstallerEvents.d.ts.map +1 -0
- package/dist/events/InstallerEvents.js +96 -0
- package/dist/events/InstallerEvents.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/models/Diagnostics.d.ts +121 -0
- package/dist/models/Diagnostics.d.ts.map +1 -0
- package/dist/models/Diagnostics.js +75 -0
- package/dist/models/Diagnostics.js.map +1 -0
- package/dist/models/InstallConfig.d.ts +139 -0
- package/dist/models/InstallConfig.d.ts.map +1 -0
- package/dist/models/InstallConfig.js +207 -0
- package/dist/models/InstallConfig.js.map +1 -0
- package/dist/models/InstallPlan.d.ts +189 -0
- package/dist/models/InstallPlan.d.ts.map +1 -0
- package/dist/models/InstallPlan.js +117 -0
- package/dist/models/InstallPlan.js.map +1 -0
- package/dist/models/InstallState.d.ts +173 -0
- package/dist/models/InstallState.d.ts.map +1 -0
- package/dist/models/InstallState.js +203 -0
- package/dist/models/InstallState.js.map +1 -0
- package/dist/models/VersionInfo.d.ts +53 -0
- package/dist/models/VersionInfo.d.ts.map +1 -0
- package/dist/models/VersionInfo.js +2 -0
- package/dist/models/VersionInfo.js.map +1 -0
- package/dist/phases/CodeGenPhase.d.ts +364 -0
- package/dist/phases/CodeGenPhase.d.ts.map +1 -0
- package/dist/phases/CodeGenPhase.js +1086 -0
- package/dist/phases/CodeGenPhase.js.map +1 -0
- package/dist/phases/ConfigurePhase.d.ts +86 -0
- package/dist/phases/ConfigurePhase.d.ts.map +1 -0
- package/dist/phases/ConfigurePhase.js +439 -0
- package/dist/phases/ConfigurePhase.js.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts +82 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.js +284 -0
- package/dist/phases/DatabaseProvisionPhase.js.map +1 -0
- package/dist/phases/DependencyPhase.d.ts +88 -0
- package/dist/phases/DependencyPhase.d.ts.map +1 -0
- package/dist/phases/DependencyPhase.js +237 -0
- package/dist/phases/DependencyPhase.js.map +1 -0
- package/dist/phases/MigratePhase.d.ts +70 -0
- package/dist/phases/MigratePhase.d.ts.map +1 -0
- package/dist/phases/MigratePhase.js +96 -0
- package/dist/phases/MigratePhase.js.map +1 -0
- package/dist/phases/PlatformCompatPhase.d.ts +193 -0
- package/dist/phases/PlatformCompatPhase.d.ts.map +1 -0
- package/dist/phases/PlatformCompatPhase.js +587 -0
- package/dist/phases/PlatformCompatPhase.js.map +1 -0
- package/dist/phases/PreflightPhase.d.ts +119 -0
- package/dist/phases/PreflightPhase.d.ts.map +1 -0
- package/dist/phases/PreflightPhase.js +394 -0
- package/dist/phases/PreflightPhase.js.map +1 -0
- package/dist/phases/ScaffoldPhase.d.ts +99 -0
- package/dist/phases/ScaffoldPhase.d.ts.map +1 -0
- package/dist/phases/ScaffoldPhase.js +235 -0
- package/dist/phases/ScaffoldPhase.js.map +1 -0
- package/dist/phases/SmokeTestPhase.d.ts +111 -0
- package/dist/phases/SmokeTestPhase.d.ts.map +1 -0
- package/dist/phases/SmokeTestPhase.js +426 -0
- package/dist/phases/SmokeTestPhase.js.map +1 -0
- package/package.json +26 -7
- package/README.md +0 -45
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install plan model for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* An {@link InstallPlan} describes what the engine will do — which phases
|
|
5
|
+
* to run, which to skip, and what configuration to use. Plans are created
|
|
6
|
+
* by {@link InstallerEngine.CreatePlan} and can be inspected (dry-run)
|
|
7
|
+
* before execution via {@link InstallPlan.Summarize}.
|
|
8
|
+
*
|
|
9
|
+
* @module models/InstallPlan
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const engine = new InstallerEngine();
|
|
14
|
+
* const plan = await engine.CreatePlan({
|
|
15
|
+
* Tag: 'v5.1.0',
|
|
16
|
+
* Dir: '/path/to/install',
|
|
17
|
+
* SkipDB: true,
|
|
18
|
+
* Fast: true,
|
|
19
|
+
* });
|
|
20
|
+
* console.log(plan.Summarize());
|
|
21
|
+
* const result = await engine.Run(plan, { Yes: true });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import type { PhaseId } from '../errors/InstallerError.js';
|
|
25
|
+
import type { PartialInstallConfig } from './InstallConfig.js';
|
|
26
|
+
/**
|
|
27
|
+
* Metadata for a single phase within an install plan.
|
|
28
|
+
*
|
|
29
|
+
* @see InstallPlan.Phases — the ordered list of phase info objects.
|
|
30
|
+
*/
|
|
31
|
+
export interface PhaseInfo {
|
|
32
|
+
/** Phase identifier (e.g., `'preflight'`, `'scaffold'`). */
|
|
33
|
+
Id: PhaseId;
|
|
34
|
+
/** Human-readable description of what the phase does. */
|
|
35
|
+
Description: string;
|
|
36
|
+
/** Whether this phase will be skipped during execution. */
|
|
37
|
+
Skipped: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Input parameters for {@link InstallerEngine.CreatePlan}.
|
|
41
|
+
*
|
|
42
|
+
* Controls which version to install, where to install it, and which
|
|
43
|
+
* phases to skip. Missing fields are filled with defaults or prompted
|
|
44
|
+
* for interactively during execution.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const input: CreatePlanInput = {
|
|
49
|
+
* Tag: 'v5.1.0',
|
|
50
|
+
* Dir: './my-mj-install',
|
|
51
|
+
* SkipDB: true,
|
|
52
|
+
* Fast: true,
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export interface CreatePlanInput {
|
|
57
|
+
/** Release tag, e.g. `"v5.1.0"`. If omitted, version selection is interactive. */
|
|
58
|
+
Tag?: string;
|
|
59
|
+
/** Target directory for the install (absolute or relative). */
|
|
60
|
+
Dir: string;
|
|
61
|
+
/** Pre-filled configuration (fields not present will be prompted for). */
|
|
62
|
+
Config?: PartialInstallConfig;
|
|
63
|
+
/** Skip the database provisioning phase (`--skip-db`). */
|
|
64
|
+
SkipDB?: boolean;
|
|
65
|
+
/** Skip the smoke test phase (`--skip-start`). */
|
|
66
|
+
SkipStart?: boolean;
|
|
67
|
+
/** Skip the codegen phase (`--skip-codegen`). */
|
|
68
|
+
SkipCodeGen?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Fast mode: automatically skips the smoke test and optimizes post-codegen
|
|
71
|
+
* steps by quick-checking manifests before rebuilding (`--fast`).
|
|
72
|
+
*/
|
|
73
|
+
Fast?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Runtime options passed to {@link InstallerEngine.Run}.
|
|
77
|
+
*
|
|
78
|
+
* These options control execution behavior (non-interactive mode, verbosity,
|
|
79
|
+
* resume behavior) rather than what gets installed.
|
|
80
|
+
*/
|
|
81
|
+
export interface RunOptions {
|
|
82
|
+
/** Non-interactive mode — auto-answer prompts with defaults or config values. */
|
|
83
|
+
Yes?: boolean;
|
|
84
|
+
/** Show plan without executing (dry-run). */
|
|
85
|
+
DryRun?: boolean;
|
|
86
|
+
/** Enable verbose logging (emits `'verbose'` level log events). */
|
|
87
|
+
Verbose?: boolean;
|
|
88
|
+
/** Ignore existing checkpoint state file and start fresh (`--no-resume`). */
|
|
89
|
+
NoResume?: boolean;
|
|
90
|
+
/** Pre-filled configuration for auto-answering prompts in `--yes` mode. */
|
|
91
|
+
Config?: PartialInstallConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Path to a JSON config file with install settings.
|
|
94
|
+
* Values from the file override environment variables and defaults,
|
|
95
|
+
* but are overridden by {@link Config} (programmatic overrides).
|
|
96
|
+
*/
|
|
97
|
+
ConfigFile?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Fast mode: skip smoke test and optimize post-codegen steps by
|
|
100
|
+
* quick-checking manifests before running the full rebuild cycle.
|
|
101
|
+
*/
|
|
102
|
+
Fast?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Options for {@link InstallerEngine.Doctor}.
|
|
106
|
+
*/
|
|
107
|
+
export interface DoctorOptions {
|
|
108
|
+
/** Show detailed diagnostic output. */
|
|
109
|
+
Verbose?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Final result returned by {@link InstallerEngine.Run} after all phases
|
|
113
|
+
* have been executed (or after a failure stops execution).
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const result = await engine.Run(plan, { Yes: true });
|
|
118
|
+
* if (result.Success) {
|
|
119
|
+
* console.log(`Install completed in ${Math.round(result.DurationMs / 1000)}s`);
|
|
120
|
+
* } else {
|
|
121
|
+
* console.error(`Failed phases: ${result.PhasesFailed.join(', ')}`);
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export interface InstallResult {
|
|
126
|
+
/** Whether all phases completed successfully. */
|
|
127
|
+
Success: boolean;
|
|
128
|
+
/** Total elapsed time in milliseconds. */
|
|
129
|
+
DurationMs: number;
|
|
130
|
+
/** Non-fatal warnings collected across all phases. */
|
|
131
|
+
Warnings: string[];
|
|
132
|
+
/** Phase IDs that completed successfully (in execution order). */
|
|
133
|
+
PhasesCompleted: PhaseId[];
|
|
134
|
+
/** Phase IDs that failed (typically contains at most one entry, since execution stops on failure). */
|
|
135
|
+
PhasesFailed: PhaseId[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* An install plan that describes the full sequence of phases the engine
|
|
139
|
+
* will execute, including which phases to skip.
|
|
140
|
+
*
|
|
141
|
+
* Created by {@link InstallerEngine.CreatePlan} and passed to
|
|
142
|
+
* {@link InstallerEngine.Run} for execution. Can also be inspected
|
|
143
|
+
* via {@link Summarize} for dry-run display.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const plan = new InstallPlan('v5.1.0', '/path/to/install', config, new Set(['smoke_test']));
|
|
148
|
+
* console.log(plan.Summarize());
|
|
149
|
+
* // Install Plan
|
|
150
|
+
* // ────────────
|
|
151
|
+
* // Tag: v5.1.0
|
|
152
|
+
* // Directory: /path/to/install
|
|
153
|
+
* // ...
|
|
154
|
+
* // Phases:
|
|
155
|
+
* // preflight Check prerequisites (Node, npm, disk, ports, DB)
|
|
156
|
+
* // (skip) smoke_test Start services and run smoke tests
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare class InstallPlan {
|
|
160
|
+
/** Git tag of the version to install (e.g., `"v5.1.0"` or `"latest"`). */
|
|
161
|
+
Tag: string;
|
|
162
|
+
/** Absolute path to the target install directory. */
|
|
163
|
+
Dir: string;
|
|
164
|
+
/** Merged configuration (defaults + user-supplied + prompted values). */
|
|
165
|
+
Config: PartialInstallConfig;
|
|
166
|
+
/** Ordered list of phases with skip flags and descriptions. */
|
|
167
|
+
Phases: PhaseInfo[];
|
|
168
|
+
/** Timestamp when this plan was created. */
|
|
169
|
+
CreatedAt: Date;
|
|
170
|
+
/**
|
|
171
|
+
* Create a new install plan.
|
|
172
|
+
*
|
|
173
|
+
* @param tag - Git tag to install (e.g., `"v5.1.0"` or `"latest"`).
|
|
174
|
+
* @param dir - Target install directory.
|
|
175
|
+
* @param config - Merged configuration values.
|
|
176
|
+
* @param skipPhases - Set of phase IDs to skip during execution.
|
|
177
|
+
*/
|
|
178
|
+
constructor(tag: string, dir: string, config: PartialInstallConfig, skipPhases?: Set<PhaseId>);
|
|
179
|
+
/**
|
|
180
|
+
* Generate a human-readable summary of the install plan.
|
|
181
|
+
*
|
|
182
|
+
* Used for dry-run display and CLI output. Shows the tag, directory,
|
|
183
|
+
* creation timestamp, and each phase with its skip status.
|
|
184
|
+
*
|
|
185
|
+
* @returns Multi-line string suitable for terminal display.
|
|
186
|
+
*/
|
|
187
|
+
Summarize(): string;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=InstallPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallPlan.d.ts","sourceRoot":"","sources":["../../src/models/InstallPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4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ACnB,kEAAkE;IAClE,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,sGAAsG;IACtG,YAAY,EAAE,OAAO,EAAE,CAAC;CACzB;AAkBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAW;IACtB,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IAEZ,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IAEZ,yEAAyE;IACzE,MAAM,EAAE,oBAAoB,CAAC;IAE7B,+DAA+D;IAC/D,MAAM,EAAE,SAAS,EAAE,CAAC;IAEpB,4CAA4C;IAC5C,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;;;;OAOG;gBACS,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,UAAU,GAAE,GAAG,CAAC,OAAO,CAAa;IAyBxG;;;;;;;OAOG;IACH,SAAS,IAAI,MAAM;CAkBpB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install plan model for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* An {@link InstallPlan} describes what the engine will do — which phases
|
|
5
|
+
* to run, which to skip, and what configuration to use. Plans are created
|
|
6
|
+
* by {@link InstallerEngine.CreatePlan} and can be inspected (dry-run)
|
|
7
|
+
* before execution via {@link InstallPlan.Summarize}.
|
|
8
|
+
*
|
|
9
|
+
* @module models/InstallPlan
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const engine = new InstallerEngine();
|
|
14
|
+
* const plan = await engine.CreatePlan({
|
|
15
|
+
* Tag: 'v5.1.0',
|
|
16
|
+
* Dir: '/path/to/install',
|
|
17
|
+
* SkipDB: true,
|
|
18
|
+
* Fast: true,
|
|
19
|
+
* });
|
|
20
|
+
* console.log(plan.Summarize());
|
|
21
|
+
* const result = await engine.Run(plan, { Yes: true });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Human-readable descriptions for each installer phase.
|
|
26
|
+
* Used by {@link InstallPlan.Summarize} and the CLI progress display.
|
|
27
|
+
*/
|
|
28
|
+
const PhaseDescriptions = {
|
|
29
|
+
preflight: 'Check prerequisites (Node, npm, disk, ports, DB)',
|
|
30
|
+
scaffold: 'Download and extract release',
|
|
31
|
+
database: 'Generate and validate database scripts',
|
|
32
|
+
migrate: 'Run database migrations',
|
|
33
|
+
configure: 'Generate configuration files',
|
|
34
|
+
platform: 'Cross-platform compatibility checks',
|
|
35
|
+
dependencies: 'Install and build dependencies',
|
|
36
|
+
codegen: 'Run CodeGen and validate artifacts',
|
|
37
|
+
smoke_test: 'Start services and run smoke tests',
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* An install plan that describes the full sequence of phases the engine
|
|
41
|
+
* will execute, including which phases to skip.
|
|
42
|
+
*
|
|
43
|
+
* Created by {@link InstallerEngine.CreatePlan} and passed to
|
|
44
|
+
* {@link InstallerEngine.Run} for execution. Can also be inspected
|
|
45
|
+
* via {@link Summarize} for dry-run display.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const plan = new InstallPlan('v5.1.0', '/path/to/install', config, new Set(['smoke_test']));
|
|
50
|
+
* console.log(plan.Summarize());
|
|
51
|
+
* // Install Plan
|
|
52
|
+
* // ────────────
|
|
53
|
+
* // Tag: v5.1.0
|
|
54
|
+
* // Directory: /path/to/install
|
|
55
|
+
* // ...
|
|
56
|
+
* // Phases:
|
|
57
|
+
* // preflight Check prerequisites (Node, npm, disk, ports, DB)
|
|
58
|
+
* // (skip) smoke_test Start services and run smoke tests
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export class InstallPlan {
|
|
62
|
+
/**
|
|
63
|
+
* Create a new install plan.
|
|
64
|
+
*
|
|
65
|
+
* @param tag - Git tag to install (e.g., `"v5.1.0"` or `"latest"`).
|
|
66
|
+
* @param dir - Target install directory.
|
|
67
|
+
* @param config - Merged configuration values.
|
|
68
|
+
* @param skipPhases - Set of phase IDs to skip during execution.
|
|
69
|
+
*/
|
|
70
|
+
constructor(tag, dir, config, skipPhases = new Set()) {
|
|
71
|
+
this.Tag = tag;
|
|
72
|
+
this.Dir = dir;
|
|
73
|
+
this.Config = config;
|
|
74
|
+
this.CreatedAt = new Date();
|
|
75
|
+
const allPhases = [
|
|
76
|
+
'preflight',
|
|
77
|
+
'scaffold',
|
|
78
|
+
'configure',
|
|
79
|
+
'database',
|
|
80
|
+
'platform',
|
|
81
|
+
'dependencies',
|
|
82
|
+
'migrate',
|
|
83
|
+
'codegen',
|
|
84
|
+
'smoke_test',
|
|
85
|
+
];
|
|
86
|
+
this.Phases = allPhases.map((id) => ({
|
|
87
|
+
Id: id,
|
|
88
|
+
Description: PhaseDescriptions[id],
|
|
89
|
+
Skipped: skipPhases.has(id),
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate a human-readable summary of the install plan.
|
|
94
|
+
*
|
|
95
|
+
* Used for dry-run display and CLI output. Shows the tag, directory,
|
|
96
|
+
* creation timestamp, and each phase with its skip status.
|
|
97
|
+
*
|
|
98
|
+
* @returns Multi-line string suitable for terminal display.
|
|
99
|
+
*/
|
|
100
|
+
Summarize() {
|
|
101
|
+
const lines = [
|
|
102
|
+
`Install Plan`,
|
|
103
|
+
`────────────`,
|
|
104
|
+
` Tag: ${this.Tag}`,
|
|
105
|
+
` Directory: ${this.Dir}`,
|
|
106
|
+
` Created: ${this.CreatedAt.toISOString()}`,
|
|
107
|
+
``,
|
|
108
|
+
` Phases:`,
|
|
109
|
+
];
|
|
110
|
+
for (const phase of this.Phases) {
|
|
111
|
+
const status = phase.Skipped ? '(skip)' : ' ';
|
|
112
|
+
lines.push(` ${status} ${phase.Id.padEnd(14)} ${phase.Description}`);
|
|
113
|
+
}
|
|
114
|
+
return lines.join('\n');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=InstallPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallPlan.js","sourceRoot":"","sources":["../../src/models/InstallPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAyHH;;;GAGG;AACH,MAAM,iBAAiB,GAA4B;IACjD,SAAS,EAAE,kDAAkD;IAC7D,QAAQ,EAAE,8BAA8B;IACxC,QAAQ,EAAE,wCAAwC;IAClD,OAAO,EAAE,yBAAyB;IAClC,SAAS,EAAE,8BAA8B;IACzC,QAAQ,EAAE,qCAAqC;IAC/C,YAAY,EAAE,gCAAgC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,UAAU,EAAE,oCAAoC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,WAAW;IAgBtB;;;;;;;OAOG;IACH,YAAY,GAAW,EAAE,GAAW,EAAE,MAA4B,EAAE,aAA2B,IAAI,GAAG,EAAE;QACtG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAE5B,MAAM,SAAS,GAAc;YAC3B,WAAW;YACX,UAAU;YACV,WAAW;YACX,UAAU;YACV,UAAU;YACV,cAAc;YACd,SAAS;YACT,SAAS;YACT,YAAY;SACb,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACnC,EAAE,EAAE,EAAE;YACN,WAAW,EAAE,iBAAiB,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;SAC5B,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACH,SAAS;QACP,MAAM,KAAK,GAAa;YACtB,cAAc;YACd,cAAc;YACd,gBAAgB,IAAI,CAAC,GAAG,EAAE;YAC1B,gBAAgB,IAAI,CAAC,GAAG,EAAE;YAC1B,gBAAgB,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;YAC9C,EAAE;YACF,WAAW;SACZ,CAAC;QAEF,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;YAClD,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint state for the MJ installer, persisted to `.mj-install-state.json`.
|
|
3
|
+
*
|
|
4
|
+
* Enables resume of interrupted installs. After each phase completes (or fails),
|
|
5
|
+
* the engine calls {@link InstallState.Save} to write the current state to disk.
|
|
6
|
+
* On the next run, {@link InstallState.Load} reads the state file and
|
|
7
|
+
* {@link InstallerEngine.Run} skips already-completed phases.
|
|
8
|
+
*
|
|
9
|
+
* The state file is also used by the {@link ScaffoldPhase} to detect whether the
|
|
10
|
+
* target directory contains installer-owned artifacts (so it doesn't trigger the
|
|
11
|
+
* "directory is not empty" prompt for its own state file).
|
|
12
|
+
*
|
|
13
|
+
* @module models/InstallState
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Create fresh state
|
|
18
|
+
* const state = new InstallState('/path/to/install', 'v5.1.0');
|
|
19
|
+
* state.MarkCompleted('preflight');
|
|
20
|
+
* await state.Save();
|
|
21
|
+
*
|
|
22
|
+
* // Resume from existing state
|
|
23
|
+
* const resumed = await InstallState.Load('/path/to/install');
|
|
24
|
+
* if (resumed) {
|
|
25
|
+
* const nextPhase = resumed.FirstIncompletePhase(ALL_PHASES);
|
|
26
|
+
* console.log(`Resuming from: ${nextPhase}`);
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
import type { PhaseId } from '../errors/InstallerError.js';
|
|
31
|
+
/**
|
|
32
|
+
* Lifecycle status of a single installer phase.
|
|
33
|
+
*
|
|
34
|
+
* - `'pending'` — not yet started (default).
|
|
35
|
+
* - `'completed'` — finished successfully.
|
|
36
|
+
* - `'failed'` — terminated with an error.
|
|
37
|
+
* - `'skipped'` — excluded by plan flags (e.g., `--skip-db`, `--fast`).
|
|
38
|
+
*/
|
|
39
|
+
export type PhaseStatus = 'pending' | 'completed' | 'failed' | 'skipped';
|
|
40
|
+
/**
|
|
41
|
+
* Serialized state of a single installer phase within the checkpoint file.
|
|
42
|
+
*
|
|
43
|
+
* @see InstallStateData — the parent object that maps phase IDs to states.
|
|
44
|
+
*/
|
|
45
|
+
export interface PhaseState {
|
|
46
|
+
/** Current lifecycle status of the phase. */
|
|
47
|
+
Status: PhaseStatus;
|
|
48
|
+
/** ISO 8601 timestamp when the phase completed (present only if `Status === 'completed'`). */
|
|
49
|
+
CompletedAt?: string;
|
|
50
|
+
/** ISO 8601 timestamp when the phase failed (present only if `Status === 'failed'`). */
|
|
51
|
+
FailedAt?: string;
|
|
52
|
+
/** Error message from the phase failure (present only if `Status === 'failed'`). */
|
|
53
|
+
Error?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Serialized shape of the `.mj-install-state.json` checkpoint file.
|
|
57
|
+
* This is the on-disk JSON structure read by {@link InstallState.Load}
|
|
58
|
+
* and written by {@link InstallState.Save}.
|
|
59
|
+
*/
|
|
60
|
+
export interface InstallStateData {
|
|
61
|
+
/** Git tag of the version being installed (e.g., `"v5.1.0"`). */
|
|
62
|
+
Tag: string;
|
|
63
|
+
/** ISO 8601 timestamp when the install was started. */
|
|
64
|
+
StartedAt: string;
|
|
65
|
+
/** Per-phase status map. Phases not yet reached are absent (treated as `'pending'`). */
|
|
66
|
+
Phases: Partial<Record<PhaseId, PhaseState>>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checkpoint state manager for the MJ installer.
|
|
70
|
+
*
|
|
71
|
+
* Tracks per-phase completion status and persists it to a JSON file in
|
|
72
|
+
* the install target directory. The engine writes checkpoint state after
|
|
73
|
+
* each phase so that interrupted installs can be resumed from the last
|
|
74
|
+
* completed phase.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const state = new InstallState('/path/to/install', 'v5.1.0');
|
|
79
|
+
* state.MarkCompleted('preflight');
|
|
80
|
+
* state.MarkCompleted('scaffold');
|
|
81
|
+
* await state.Save();
|
|
82
|
+
*
|
|
83
|
+
* // Later, resume:
|
|
84
|
+
* const loaded = await InstallState.Load('/path/to/install');
|
|
85
|
+
* console.log(loaded?.GetPhaseStatus('preflight')); // 'completed'
|
|
86
|
+
* console.log(loaded?.GetPhaseStatus('configure')); // 'pending'
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare class InstallState {
|
|
90
|
+
/** Internal state data (serialized to JSON on Save). */
|
|
91
|
+
private data;
|
|
92
|
+
/** Absolute path to the `.mj-install-state.json` file. */
|
|
93
|
+
private filePath;
|
|
94
|
+
/**
|
|
95
|
+
* Create a new checkpoint state for a fresh install.
|
|
96
|
+
*
|
|
97
|
+
* @param dir - Target directory where the state file will be written.
|
|
98
|
+
* @param tag - Git tag of the version being installed (e.g., `"v5.1.0"`).
|
|
99
|
+
*/
|
|
100
|
+
constructor(dir: string, tag: string);
|
|
101
|
+
/** Git tag of the version being installed. */
|
|
102
|
+
get Tag(): string;
|
|
103
|
+
/** ISO 8601 timestamp when the install was started. */
|
|
104
|
+
get StartedAt(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Load checkpoint state from disk.
|
|
107
|
+
*
|
|
108
|
+
* @param dir - Directory containing the `.mj-install-state.json` file.
|
|
109
|
+
* @returns The loaded state, or `null` if the file doesn't exist or is malformed.
|
|
110
|
+
*/
|
|
111
|
+
static Load(dir: string): Promise<InstallState | null>;
|
|
112
|
+
/**
|
|
113
|
+
* Check whether a checkpoint state file exists at the given directory.
|
|
114
|
+
*
|
|
115
|
+
* @param dir - Directory to check.
|
|
116
|
+
* @returns `true` if `.mj-install-state.json` exists and is accessible.
|
|
117
|
+
*/
|
|
118
|
+
static Exists(dir: string): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Get the current status of a phase.
|
|
121
|
+
*
|
|
122
|
+
* @param phase - Phase identifier to query.
|
|
123
|
+
* @returns The phase's status, defaulting to `'pending'` if not yet recorded.
|
|
124
|
+
*/
|
|
125
|
+
GetPhaseStatus(phase: PhaseId): PhaseStatus;
|
|
126
|
+
/**
|
|
127
|
+
* Mark a phase as successfully completed.
|
|
128
|
+
*
|
|
129
|
+
* @param phase - Phase identifier to mark as completed.
|
|
130
|
+
*/
|
|
131
|
+
MarkCompleted(phase: PhaseId): void;
|
|
132
|
+
/**
|
|
133
|
+
* Mark a phase as failed with an error message.
|
|
134
|
+
*
|
|
135
|
+
* @param phase - Phase identifier to mark as failed.
|
|
136
|
+
* @param error - Error message describing the failure.
|
|
137
|
+
*/
|
|
138
|
+
MarkFailed(phase: PhaseId, error: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* Mark a phase as skipped (excluded by plan flags).
|
|
141
|
+
*
|
|
142
|
+
* @param phase - Phase identifier to mark as skipped.
|
|
143
|
+
*/
|
|
144
|
+
MarkSkipped(phase: PhaseId): void;
|
|
145
|
+
/**
|
|
146
|
+
* Find the first phase that is neither completed nor skipped.
|
|
147
|
+
* Used by the engine to determine the resume point after loading checkpoint state.
|
|
148
|
+
*
|
|
149
|
+
* @param orderedPhases - Ordered list of all phase identifiers.
|
|
150
|
+
* @returns The first incomplete phase ID, or `null` if all phases are done.
|
|
151
|
+
*/
|
|
152
|
+
FirstIncompletePhase(orderedPhases: PhaseId[]): PhaseId | null;
|
|
153
|
+
/**
|
|
154
|
+
* Persist the current state to disk as `.mj-install-state.json`.
|
|
155
|
+
* Called by the engine after each phase completes, fails, or is skipped.
|
|
156
|
+
*
|
|
157
|
+
* @throws Error if the file cannot be written (e.g., permission denied).
|
|
158
|
+
*/
|
|
159
|
+
Save(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Delete the checkpoint state file from disk.
|
|
162
|
+
* Silently succeeds if the file doesn't exist.
|
|
163
|
+
*/
|
|
164
|
+
Delete(): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Return a deep clone of the internal state data for serialization
|
|
167
|
+
* or inspection without exposing the mutable internal reference.
|
|
168
|
+
*
|
|
169
|
+
* @returns A deep copy of the {@link InstallStateData}.
|
|
170
|
+
*/
|
|
171
|
+
ToJSON(): InstallStateData;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=InstallState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallState.d.ts","sourceRoot":"","sources":["../../src/models/InstallState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,MAAM,EAAE,WAAW,CAAC;IACpB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MA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