@memberjunction/installer 0.0.1 → 5.5.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,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error class for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* Every error carries the phase it occurred in, a machine-readable code,
|
|
5
|
+
* a human-readable message, and a suggested fix the frontend can display.
|
|
6
|
+
* This structured approach lets frontends (CLI, VSCode, Docker) render
|
|
7
|
+
* actionable error messages with remediation steps.
|
|
8
|
+
*
|
|
9
|
+
* @module errors/InstallerError
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* throw new InstallerError(
|
|
14
|
+
* 'preflight',
|
|
15
|
+
* 'NODE_VERSION',
|
|
16
|
+
* 'Node.js v16 found, but >= 22 is required.',
|
|
17
|
+
* 'Download Node.js 22 LTS from https://nodejs.org'
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Discriminated union of all installer phase identifiers.
|
|
23
|
+
*
|
|
24
|
+
* Each value corresponds to one of the nine ordered phases executed by
|
|
25
|
+
* {@link InstallerEngine.Run}. The identifier is used in error reporting,
|
|
26
|
+
* checkpoint state, event payloads, and plan generation.
|
|
27
|
+
*
|
|
28
|
+
* Phase execution order:
|
|
29
|
+
* 1. `preflight` — prerequisite checks
|
|
30
|
+
* 2. `scaffold` — download and extract release
|
|
31
|
+
* 3. `configure` — generate configuration files
|
|
32
|
+
* 4. `database` — SQL Server provisioning scripts
|
|
33
|
+
* 5. `platform` — cross-platform compatibility fixes
|
|
34
|
+
* 6. `dependencies` — npm install + build
|
|
35
|
+
* 7. `migrate` — database migrations
|
|
36
|
+
* 8. `codegen` — code generation + manifest rebuild
|
|
37
|
+
* 9. `smoke_test` — service startup verification
|
|
38
|
+
*/
|
|
39
|
+
export type PhaseId = 'preflight' | 'scaffold' | 'database' | 'migrate' | 'configure' | 'platform' | 'dependencies' | 'codegen' | 'smoke_test';
|
|
40
|
+
/**
|
|
41
|
+
* Structured error thrown by installer phases when a recoverable or
|
|
42
|
+
* terminal failure occurs.
|
|
43
|
+
*
|
|
44
|
+
* Unlike a generic `Error`, `InstallerError` carries machine-readable
|
|
45
|
+
* metadata that frontends use to render actionable diagnostics:
|
|
46
|
+
*
|
|
47
|
+
* - {@link Phase} identifies which phase failed (for checkpoint/resume).
|
|
48
|
+
* - {@link Code} is a stable, machine-readable error code for programmatic handling.
|
|
49
|
+
* - {@link SuggestedFix} is a human-readable remediation step displayed to the user.
|
|
50
|
+
*
|
|
51
|
+
* The engine catches `InstallerError` during phase execution, records it in
|
|
52
|
+
* the checkpoint state file, and emits it via the `error` event channel.
|
|
53
|
+
*
|
|
54
|
+
* @extends Error
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* try {
|
|
59
|
+
* await phase.Run(context);
|
|
60
|
+
* } catch (err) {
|
|
61
|
+
* if (err instanceof InstallerError) {
|
|
62
|
+
* console.error(`[${err.Phase}] ${err.Code}: ${err.message}`);
|
|
63
|
+
* console.error(`Fix: ${err.SuggestedFix}`);
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class InstallerError extends Error {
|
|
69
|
+
/** The installer phase where this error originated. */
|
|
70
|
+
Phase: PhaseId;
|
|
71
|
+
/**
|
|
72
|
+
* Machine-readable error code (e.g., `'NODE_VERSION'`, `'DOWNLOAD_FAILED'`).
|
|
73
|
+
* Stable across versions — safe for programmatic error handling.
|
|
74
|
+
*/
|
|
75
|
+
Code: string;
|
|
76
|
+
/**
|
|
77
|
+
* Human-readable remediation step displayed to the user.
|
|
78
|
+
* Should be a concrete, actionable instruction (e.g., a command to run
|
|
79
|
+
* or a URL to visit).
|
|
80
|
+
*/
|
|
81
|
+
SuggestedFix: string;
|
|
82
|
+
/**
|
|
83
|
+
* Create a new InstallerError.
|
|
84
|
+
*
|
|
85
|
+
* @param phase - The phase where the error occurred.
|
|
86
|
+
* @param code - Machine-readable error code (e.g., `'NPM_INSTALL_FAILED'`).
|
|
87
|
+
* @param message - Human-readable error description.
|
|
88
|
+
* @param suggestedFix - Actionable remediation step for the user.
|
|
89
|
+
*/
|
|
90
|
+
constructor(phase: PhaseId, code: string, message: string, suggestedFix: string);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=InstallerError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallerError.d.ts","sourceRoot":"","sources":["../../src/errors/InstallerError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,OAAO,GACf,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,UAAU,GACV,cAAc,GACd,SAAS,GACT,YAAY,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,uDAAuD;IACvD,KAAK,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;gBACS,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAOhF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error class for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* Every error carries the phase it occurred in, a machine-readable code,
|
|
5
|
+
* a human-readable message, and a suggested fix the frontend can display.
|
|
6
|
+
* This structured approach lets frontends (CLI, VSCode, Docker) render
|
|
7
|
+
* actionable error messages with remediation steps.
|
|
8
|
+
*
|
|
9
|
+
* @module errors/InstallerError
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* throw new InstallerError(
|
|
14
|
+
* 'preflight',
|
|
15
|
+
* 'NODE_VERSION',
|
|
16
|
+
* 'Node.js v16 found, but >= 22 is required.',
|
|
17
|
+
* 'Download Node.js 22 LTS from https://nodejs.org'
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Structured error thrown by installer phases when a recoverable or
|
|
23
|
+
* terminal failure occurs.
|
|
24
|
+
*
|
|
25
|
+
* Unlike a generic `Error`, `InstallerError` carries machine-readable
|
|
26
|
+
* metadata that frontends use to render actionable diagnostics:
|
|
27
|
+
*
|
|
28
|
+
* - {@link Phase} identifies which phase failed (for checkpoint/resume).
|
|
29
|
+
* - {@link Code} is a stable, machine-readable error code for programmatic handling.
|
|
30
|
+
* - {@link SuggestedFix} is a human-readable remediation step displayed to the user.
|
|
31
|
+
*
|
|
32
|
+
* The engine catches `InstallerError` during phase execution, records it in
|
|
33
|
+
* the checkpoint state file, and emits it via the `error` event channel.
|
|
34
|
+
*
|
|
35
|
+
* @extends Error
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* try {
|
|
40
|
+
* await phase.Run(context);
|
|
41
|
+
* } catch (err) {
|
|
42
|
+
* if (err instanceof InstallerError) {
|
|
43
|
+
* console.error(`[${err.Phase}] ${err.Code}: ${err.message}`);
|
|
44
|
+
* console.error(`Fix: ${err.SuggestedFix}`);
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export class InstallerError extends Error {
|
|
50
|
+
/**
|
|
51
|
+
* Create a new InstallerError.
|
|
52
|
+
*
|
|
53
|
+
* @param phase - The phase where the error occurred.
|
|
54
|
+
* @param code - Machine-readable error code (e.g., `'NPM_INSTALL_FAILED'`).
|
|
55
|
+
* @param message - Human-readable error description.
|
|
56
|
+
* @param suggestedFix - Actionable remediation step for the user.
|
|
57
|
+
*/
|
|
58
|
+
constructor(phase, code, message, suggestedFix) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'InstallerError';
|
|
61
|
+
this.Phase = phase;
|
|
62
|
+
this.Code = code;
|
|
63
|
+
this.SuggestedFix = suggestedFix;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=InstallerError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallerError.js","sourceRoot":"","sources":["../../src/errors/InstallerError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA+BH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAiBvC;;;;;;;OAOG;IACH,YAAY,KAAc,EAAE,IAAY,EAAE,OAAe,EAAE,YAAoB;QAC7E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event API contract for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* The engine communicates **exclusively through events** — it never writes
|
|
5
|
+
* to stdout or stderr directly. This decoupled architecture allows any
|
|
6
|
+
* frontend (CLI, VSCode extension, Docker/CI, test harness) to subscribe
|
|
7
|
+
* to the same event stream and render output in its own way.
|
|
8
|
+
*
|
|
9
|
+
* Eight event types form the complete communication surface:
|
|
10
|
+
*
|
|
11
|
+
* | Event | Purpose | When emitted |
|
|
12
|
+
* |-------|---------|--------------|
|
|
13
|
+
* | `phase:start` | Phase lifecycle | Before each phase begins |
|
|
14
|
+
* | `phase:end` | Phase lifecycle | After each phase completes, fails, or is skipped |
|
|
15
|
+
* | `step:progress` | Granular progress | During phase execution (streaming output) |
|
|
16
|
+
* | `log` | Informational | Success messages, verbose diagnostics |
|
|
17
|
+
* | `warn` | Non-blocking issues | Warnings that don't stop the install |
|
|
18
|
+
* | `error` | Terminal failures | When a phase throws an {@link InstallerError} |
|
|
19
|
+
* | `prompt` | User interaction | When the engine needs user input |
|
|
20
|
+
* | `diagnostic` | Health checks | During preflight and `mj doctor` |
|
|
21
|
+
*
|
|
22
|
+
* @module events/InstallerEvents
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const engine = new InstallerEngine();
|
|
27
|
+
* engine.On('phase:start', (e) => console.log(`Starting ${e.Phase}...`));
|
|
28
|
+
* engine.On('phase:end', (e) => console.log(`${e.Phase}: ${e.Status} (${e.DurationMs}ms)`));
|
|
29
|
+
* engine.On('error', (e) => console.error(`${e.Error.Code}: ${e.Error.message}`));
|
|
30
|
+
* engine.On('prompt', (e) => e.Resolve(readline.question(e.Message)));
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { InstallerError, type PhaseId } from '../errors/InstallerError.js';
|
|
34
|
+
/**
|
|
35
|
+
* Discriminated union of all installer event type strings.
|
|
36
|
+
* Used as the event name when subscribing via {@link InstallerEventEmitter.On}.
|
|
37
|
+
*/
|
|
38
|
+
export type InstallerEventType = 'phase:start' | 'phase:end' | 'step:progress' | 'log' | 'warn' | 'error' | 'prompt' | 'diagnostic';
|
|
39
|
+
/**
|
|
40
|
+
* Emitted when an installer phase begins execution.
|
|
41
|
+
* Frontends typically render this as a section header or spinner start.
|
|
42
|
+
*/
|
|
43
|
+
export interface PhaseStartEvent {
|
|
44
|
+
/** Event type discriminator. */
|
|
45
|
+
Type: 'phase:start';
|
|
46
|
+
/** Identifier of the phase that is starting. */
|
|
47
|
+
Phase: PhaseId;
|
|
48
|
+
/** Human-readable description of the phase (e.g., `"Check prerequisites"`). */
|
|
49
|
+
Description: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Emitted when an installer phase finishes (successfully, with failure, or skipped).
|
|
53
|
+
* Frontends typically render this as a checkmark, X, or skip indicator with duration.
|
|
54
|
+
*/
|
|
55
|
+
export interface PhaseEndEvent {
|
|
56
|
+
/** Event type discriminator. */
|
|
57
|
+
Type: 'phase:end';
|
|
58
|
+
/** Identifier of the phase that ended. */
|
|
59
|
+
Phase: PhaseId;
|
|
60
|
+
/** Outcome of the phase. */
|
|
61
|
+
Status: 'completed' | 'failed' | 'skipped';
|
|
62
|
+
/** Wall-clock time the phase took, in milliseconds. */
|
|
63
|
+
DurationMs: number;
|
|
64
|
+
/** The error that caused the failure (present only when `Status === 'failed'`). */
|
|
65
|
+
Error?: InstallerError;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Emitted during phase execution to report granular progress.
|
|
69
|
+
* Used for streaming command output, download percentages, and step-level messages.
|
|
70
|
+
*
|
|
71
|
+
* Frontends with verbose mode enabled show these; default mode may suppress them.
|
|
72
|
+
*/
|
|
73
|
+
export interface StepProgressEvent {
|
|
74
|
+
/** Event type discriminator. */
|
|
75
|
+
Type: 'step:progress';
|
|
76
|
+
/** Phase that is reporting progress. */
|
|
77
|
+
Phase: PhaseId;
|
|
78
|
+
/** Human-readable progress message (e.g., a line of npm output). */
|
|
79
|
+
Message: string;
|
|
80
|
+
/** Download or build percentage (0–100), if deterministic progress is known. */
|
|
81
|
+
Percent?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Emitted for informational messages at two verbosity levels.
|
|
85
|
+
*
|
|
86
|
+
* - `'info'` — always shown (e.g., "npm install completed successfully").
|
|
87
|
+
* - `'verbose'` — only shown when `--verbose` is active (e.g., stderr lines).
|
|
88
|
+
*/
|
|
89
|
+
export interface LogEvent {
|
|
90
|
+
/** Event type discriminator. */
|
|
91
|
+
Type: 'log';
|
|
92
|
+
/** Verbosity level of this log message. */
|
|
93
|
+
Level: 'info' | 'verbose';
|
|
94
|
+
/** The log message text. */
|
|
95
|
+
Message: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Emitted for non-blocking warnings that should be reviewed but don't stop the install.
|
|
99
|
+
* Frontends typically render these with a yellow `⚠` indicator.
|
|
100
|
+
*/
|
|
101
|
+
export interface WarnEvent {
|
|
102
|
+
/** Event type discriminator. */
|
|
103
|
+
Type: 'warn';
|
|
104
|
+
/** Warning message text. */
|
|
105
|
+
Message: string;
|
|
106
|
+
/** Phase that emitted the warning (if applicable). */
|
|
107
|
+
Phase?: PhaseId;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Emitted when a phase fails with an {@link InstallerError}.
|
|
111
|
+
* This is a terminal event — the engine stops execution after emitting this.
|
|
112
|
+
*/
|
|
113
|
+
export interface ErrorEvent {
|
|
114
|
+
/** Event type discriminator. */
|
|
115
|
+
Type: 'error';
|
|
116
|
+
/** The structured error with phase, code, message, and suggested fix. */
|
|
117
|
+
Error: InstallerError;
|
|
118
|
+
/** Phase where the error occurred. */
|
|
119
|
+
Phase: PhaseId;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Emitted when the engine needs user input during interactive mode.
|
|
123
|
+
*
|
|
124
|
+
* The frontend must call {@link Resolve} with the user's answer to unblock
|
|
125
|
+
* the engine. In `--yes` mode, prompts are auto-resolved with defaults
|
|
126
|
+
* and this event is not emitted.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* engine.On('prompt', (e) => {
|
|
131
|
+
* if (e.PromptType === 'select') {
|
|
132
|
+
* // Show choices to user and resolve with selected value
|
|
133
|
+
* const choice = showSelectDialog(e.Message, e.Choices!);
|
|
134
|
+
* e.Resolve(choice);
|
|
135
|
+
* } else {
|
|
136
|
+
* e.Resolve(readline.question(e.Message));
|
|
137
|
+
* }
|
|
138
|
+
* });
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export interface PromptEvent {
|
|
142
|
+
/** Event type discriminator. */
|
|
143
|
+
Type: 'prompt';
|
|
144
|
+
/** Unique identifier for this prompt (e.g., `'db-host'`, `'version-select'`). */
|
|
145
|
+
PromptId: string;
|
|
146
|
+
/** Type of input expected from the user. */
|
|
147
|
+
PromptType: 'input' | 'confirm' | 'select';
|
|
148
|
+
/** Question or instruction to display to the user. */
|
|
149
|
+
Message: string;
|
|
150
|
+
/** Available choices (present only for `'select'` prompts). */
|
|
151
|
+
Choices?: {
|
|
152
|
+
Label: string;
|
|
153
|
+
Value: string;
|
|
154
|
+
}[];
|
|
155
|
+
/** Default value to use if the user presses Enter without input. */
|
|
156
|
+
Default?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Callback that the frontend must invoke with the user's answer.
|
|
159
|
+
* Calling this unblocks the engine to continue execution.
|
|
160
|
+
*/
|
|
161
|
+
Resolve: (answer: string) => void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Emitted during preflight and `mj doctor` for individual health checks.
|
|
165
|
+
* Frontends render these as a diagnostic report with pass/fail/warn/info indicators.
|
|
166
|
+
*
|
|
167
|
+
* @see Diagnostics — the aggregated result model for all diagnostic checks.
|
|
168
|
+
*/
|
|
169
|
+
export interface DiagnosticEvent {
|
|
170
|
+
/** Event type discriminator. */
|
|
171
|
+
Type: 'diagnostic';
|
|
172
|
+
/** Short name of the check (e.g., `"Node.js version"`, `"SQL Server connectivity"`). */
|
|
173
|
+
Check: string;
|
|
174
|
+
/** Outcome of this diagnostic check. */
|
|
175
|
+
Status: 'pass' | 'fail' | 'warn' | 'info';
|
|
176
|
+
/** Detailed result message. */
|
|
177
|
+
Message: string;
|
|
178
|
+
/** Actionable fix suggestion (present for `'fail'` and `'warn'` statuses). */
|
|
179
|
+
SuggestedFix?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Discriminated union of all installer event payload types.
|
|
183
|
+
* The `Type` field acts as the discriminator for narrowing in event handlers.
|
|
184
|
+
*/
|
|
185
|
+
export type InstallerEvent = PhaseStartEvent | PhaseEndEvent | StepProgressEvent | LogEvent | WarnEvent | ErrorEvent | PromptEvent | DiagnosticEvent;
|
|
186
|
+
/**
|
|
187
|
+
* Generic event handler that accepts any {@link InstallerEvent}.
|
|
188
|
+
* Useful for catch-all logging or forwarding.
|
|
189
|
+
*/
|
|
190
|
+
export type InstallerEventHandler = (event: InstallerEvent) => void;
|
|
191
|
+
/**
|
|
192
|
+
* Maps event type strings to their typed argument tuples.
|
|
193
|
+
* Used by {@link InstallerEventEmitter} to provide compile-time type safety
|
|
194
|
+
* for event subscription and emission.
|
|
195
|
+
*/
|
|
196
|
+
export interface InstallerEventMap {
|
|
197
|
+
'phase:start': [PhaseStartEvent];
|
|
198
|
+
'phase:end': [PhaseEndEvent];
|
|
199
|
+
'step:progress': [StepProgressEvent];
|
|
200
|
+
'log': [LogEvent];
|
|
201
|
+
'warn': [WarnEvent];
|
|
202
|
+
'error': [ErrorEvent];
|
|
203
|
+
'prompt': [PromptEvent];
|
|
204
|
+
'diagnostic': [DiagnosticEvent];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Type-safe wrapper around Node.js {@link EventEmitter} for installer events.
|
|
208
|
+
*
|
|
209
|
+
* Provides compile-time enforcement that event names and handler signatures
|
|
210
|
+
* match the {@link InstallerEventMap}. The engine creates one emitter instance
|
|
211
|
+
* and exposes {@link InstallerEngine.On} / {@link InstallerEngine.Off} for
|
|
212
|
+
* frontend subscription.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* const emitter = new InstallerEventEmitter();
|
|
217
|
+
* emitter.On('log', (e) => {
|
|
218
|
+
* if (e.Level === 'info') console.log(e.Message);
|
|
219
|
+
* });
|
|
220
|
+
* emitter.Emit('log', { Type: 'log', Level: 'info', Message: 'Hello' });
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare class InstallerEventEmitter {
|
|
224
|
+
/** Underlying Node.js EventEmitter instance. */
|
|
225
|
+
private emitter;
|
|
226
|
+
/**
|
|
227
|
+
* Subscribe to an installer event.
|
|
228
|
+
*
|
|
229
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
230
|
+
* @param event - Event name to subscribe to.
|
|
231
|
+
* @param handler - Callback invoked when the event is emitted.
|
|
232
|
+
*/
|
|
233
|
+
On<K extends keyof InstallerEventMap>(event: K, handler: (...args: InstallerEventMap[K]) => void): void;
|
|
234
|
+
/**
|
|
235
|
+
* Unsubscribe from an installer event.
|
|
236
|
+
*
|
|
237
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
238
|
+
* @param event - Event name to unsubscribe from.
|
|
239
|
+
* @param handler - The exact handler reference that was passed to {@link On}.
|
|
240
|
+
*/
|
|
241
|
+
Off<K extends keyof InstallerEventMap>(event: K, handler: (...args: InstallerEventMap[K]) => void): void;
|
|
242
|
+
/**
|
|
243
|
+
* Emit an installer event to all subscribed handlers.
|
|
244
|
+
*
|
|
245
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
246
|
+
* @param event - Event name to emit.
|
|
247
|
+
* @param args - Event payload matching the event type.
|
|
248
|
+
*/
|
|
249
|
+
Emit<K extends keyof InstallerEventMap>(event: K, ...args: InstallerEventMap[K]): void;
|
|
250
|
+
/**
|
|
251
|
+
* Remove all event listeners. Called during engine cleanup.
|
|
252
|
+
*/
|
|
253
|
+
RemoveAllListeners(): void;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=InstallerEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallerEvents.d.ts","sourceRoot":"","sources":["../../src/events/InstallerEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAM3E;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,WAAW,GACX,eAAe,GACf,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,YAAY,CAAC;AAMjB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,gDAAgD;IAChD,KAAK,EAAE,OAAO,CAAC;IACf,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,0CAA0C;IAC1C,KAAK,EAAE,OAAO,CAAC;IACf,4BAA4B;IAC5B,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3C,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;CACl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AMG;IACH,IAAI,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI;IAItF;;OAEG;IACH,kBAAkB,IAAI,IAAI;CAG3B"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event API contract for the MJ installer engine.
|
|
3
|
+
*
|
|
4
|
+
* The engine communicates **exclusively through events** — it never writes
|
|
5
|
+
* to stdout or stderr directly. This decoupled architecture allows any
|
|
6
|
+
* frontend (CLI, VSCode extension, Docker/CI, test harness) to subscribe
|
|
7
|
+
* to the same event stream and render output in its own way.
|
|
8
|
+
*
|
|
9
|
+
* Eight event types form the complete communication surface:
|
|
10
|
+
*
|
|
11
|
+
* | Event | Purpose | When emitted |
|
|
12
|
+
* |-------|---------|--------------|
|
|
13
|
+
* | `phase:start` | Phase lifecycle | Before each phase begins |
|
|
14
|
+
* | `phase:end` | Phase lifecycle | After each phase completes, fails, or is skipped |
|
|
15
|
+
* | `step:progress` | Granular progress | During phase execution (streaming output) |
|
|
16
|
+
* | `log` | Informational | Success messages, verbose diagnostics |
|
|
17
|
+
* | `warn` | Non-blocking issues | Warnings that don't stop the install |
|
|
18
|
+
* | `error` | Terminal failures | When a phase throws an {@link InstallerError} |
|
|
19
|
+
* | `prompt` | User interaction | When the engine needs user input |
|
|
20
|
+
* | `diagnostic` | Health checks | During preflight and `mj doctor` |
|
|
21
|
+
*
|
|
22
|
+
* @module events/InstallerEvents
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const engine = new InstallerEngine();
|
|
27
|
+
* engine.On('phase:start', (e) => console.log(`Starting ${e.Phase}...`));
|
|
28
|
+
* engine.On('phase:end', (e) => console.log(`${e.Phase}: ${e.Status} (${e.DurationMs}ms)`));
|
|
29
|
+
* engine.On('error', (e) => console.error(`${e.Error.Code}: ${e.Error.message}`));
|
|
30
|
+
* engine.On('prompt', (e) => e.Resolve(readline.question(e.Message)));
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { EventEmitter } from 'node:events';
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Typed emitter wrapper
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
/**
|
|
38
|
+
* Type-safe wrapper around Node.js {@link EventEmitter} for installer events.
|
|
39
|
+
*
|
|
40
|
+
* Provides compile-time enforcement that event names and handler signatures
|
|
41
|
+
* match the {@link InstallerEventMap}. The engine creates one emitter instance
|
|
42
|
+
* and exposes {@link InstallerEngine.On} / {@link InstallerEngine.Off} for
|
|
43
|
+
* frontend subscription.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const emitter = new InstallerEventEmitter();
|
|
48
|
+
* emitter.On('log', (e) => {
|
|
49
|
+
* if (e.Level === 'info') console.log(e.Message);
|
|
50
|
+
* });
|
|
51
|
+
* emitter.Emit('log', { Type: 'log', Level: 'info', Message: 'Hello' });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export class InstallerEventEmitter {
|
|
55
|
+
constructor() {
|
|
56
|
+
/** Underlying Node.js EventEmitter instance. */
|
|
57
|
+
this.emitter = new EventEmitter();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Subscribe to an installer event.
|
|
61
|
+
*
|
|
62
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
63
|
+
* @param event - Event name to subscribe to.
|
|
64
|
+
* @param handler - Callback invoked when the event is emitted.
|
|
65
|
+
*/
|
|
66
|
+
On(event, handler) {
|
|
67
|
+
this.emitter.on(event, handler);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Unsubscribe from an installer event.
|
|
71
|
+
*
|
|
72
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
73
|
+
* @param event - Event name to unsubscribe from.
|
|
74
|
+
* @param handler - The exact handler reference that was passed to {@link On}.
|
|
75
|
+
*/
|
|
76
|
+
Off(event, handler) {
|
|
77
|
+
this.emitter.off(event, handler);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Emit an installer event to all subscribed handlers.
|
|
81
|
+
*
|
|
82
|
+
* @typeParam K - Event type key from {@link InstallerEventMap}.
|
|
83
|
+
* @param event - Event name to emit.
|
|
84
|
+
* @param args - Event payload matching the event type.
|
|
85
|
+
*/
|
|
86
|
+
Emit(event, ...args) {
|
|
87
|
+
this.emitter.emit(event, ...args);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Remove all event listeners. Called during engine cleanup.
|
|
91
|
+
*/
|
|
92
|
+
RemoveAllListeners() {
|
|
93
|
+
this.emitter.removeAllListeners();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=InstallerEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallerEvents.js","sourceRoot":"","sources":["../../src/events/InstallerEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoN3C,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,qBAAqB;IAAlC;QACE,gDAAgD;QACxC,YAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAyCvC,CAAC;IAvCC;;;;;;OAMG;IACH,EAAE,CAAoC,KAAQ,EAAE,OAAgD;QAC9F,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAuC,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAoC,KAAQ,EAAE,OAAgD;QAC/F,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAuC,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAoC,KAAQ,EAAE,GAAG,IAA0B;QAC7E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IACpC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@memberjunction/installer` — Public API surface.
|
|
3
|
+
*
|
|
4
|
+
* Headless, event-driven installer engine for MemberJunction. This barrel
|
|
5
|
+
* module re-exports every public type needed by consumer packages:
|
|
6
|
+
*
|
|
7
|
+
* | Category | Key exports |
|
|
8
|
+
* |------------|------------------------------------------------------------------|
|
|
9
|
+
* | Engine | {@link InstallerEngine} |
|
|
10
|
+
* | Events | {@link InstallerEventEmitter}, event payload types |
|
|
11
|
+
* | Errors | {@link InstallerError}, {@link PhaseId} |
|
|
12
|
+
* | Models | {@link InstallPlan}, {@link InstallState}, {@link Diagnostics} |
|
|
13
|
+
* | Adapters | {@link GitHubReleaseProvider}, {@link FileSystemAdapter}, etc. |
|
|
14
|
+
* | Phases | All 9 phase classes with their context/result types |
|
|
15
|
+
*
|
|
16
|
+
* **Primary consumers**:
|
|
17
|
+
* - `@memberjunction/cli` — the `mj install` and `mj doctor` commands.
|
|
18
|
+
* - VSCode MemberJunction extension (planned).
|
|
19
|
+
* - Docker/CI automation scripts.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { InstallerEngine } from '@memberjunction/installer';
|
|
24
|
+
*
|
|
25
|
+
* const engine = new InstallerEngine();
|
|
26
|
+
* engine.On('phase:start', (e) => console.log(`Starting ${e.Phase}...`));
|
|
27
|
+
* engine.On('error', (e) => console.error(e.Error.message));
|
|
28
|
+
*
|
|
29
|
+
* const plan = await engine.CreatePlan({ Dir: '/app', Tag: 'latest' });
|
|
30
|
+
* const result = await engine.Run(plan, { Yes: true });
|
|
31
|
+
* console.log(result.Success ? 'Install complete!' : 'Install failed.');
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @module @memberjunction/installer
|
|
35
|
+
* @see InstallerEngine — the main entry point for programmatic installs.
|
|
36
|
+
* @see InstallerEventEmitter — the typed event system for progress reporting.
|
|
37
|
+
*/
|
|
38
|
+
export { InstallerEngine } from './InstallerEngine.js';
|
|
39
|
+
export { InstallerEventEmitter, type InstallerEventType, type InstallerEvent, type InstallerEventHandler, type InstallerEventMap, type PhaseStartEvent, type PhaseEndEvent, type StepProgressEvent, type LogEvent, type WarnEvent, type ErrorEvent, type PromptEvent, type DiagnosticEvent, } from './events/InstallerEvents.js';
|
|
40
|
+
export { InstallerError, type PhaseId } from './errors/InstallerError.js';
|
|
41
|
+
export type { VersionInfo } from './models/VersionInfo.js';
|
|
42
|
+
export { type InstallConfig, type PartialInstallConfig, InstallConfigDefaults, resolveFromEnvironment, loadConfigFile, mergeConfigs, } from './models/InstallConfig.js';
|
|
43
|
+
export { InstallPlan, type CreatePlanInput, type RunOptions, type DoctorOptions, type InstallResult, type PhaseInfo, } from './models/InstallPlan.js';
|
|
44
|
+
export { InstallState, type InstallStateData, type PhaseState, type PhaseStatus, } from './models/InstallState.js';
|
|
45
|
+
export { Diagnostics, type DiagnosticCheck, type DiagnosticStatus, type EnvironmentInfo, type LastInstallInfo, } from './models/Diagnostics.js';
|
|
46
|
+
export { GitHubReleaseProvider } from './adapters/GitHubReleaseProvider.js';
|
|
47
|
+
export { FileSystemAdapter } from './adapters/FileSystemAdapter.js';
|
|
48
|
+
export { ProcessRunner, type ProcessResult, type ProcessOptions } from './adapters/ProcessRunner.js';
|
|
49
|
+
export { SqlServerAdapter, type SqlConnectivityResult } from './adapters/SqlServerAdapter.js';
|
|
50
|
+
export { PreflightPhase, type PreflightContext, type PreflightResult } from './phases/PreflightPhase.js';
|
|
51
|
+
export { ScaffoldPhase, type ScaffoldContext, type ScaffoldResult } from './phases/ScaffoldPhase.js';
|
|
52
|
+
export { ConfigurePhase, type ConfigureContext, type ConfigureResult } from './phases/ConfigurePhase.js';
|
|
53
|
+
export { DatabaseProvisionPhase, type DatabaseProvisionContext, type DatabaseProvisionResult } from './phases/DatabaseProvisionPhase.js';
|
|
54
|
+
export { MigratePhase, type MigrateContext, type MigrateResult } from './phases/MigratePhase.js';
|
|
55
|
+
export { PlatformCompatPhase, type PlatformCompatContext, type PlatformCompatResult } from './phases/PlatformCompatPhase.js';
|
|
56
|
+
export { DependencyPhase, type DependencyContext, type DependencyResult } from './phases/DependencyPhase.js';
|
|
57
|
+
export { CodeGenPhase, type CodeGenContext, type CodeGenResult, type KnownIssuePatch, type KnownIssueDiagnostic } from './phases/CodeGenPhase.js';
|
|
58
|
+
export { SmokeTestPhase, type SmokeTestContext, type SmokeTestResult } from './phases/SmokeTestPhase.js';
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EACL,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAG1E,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,C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AmB,EAAE,KAAK,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC7H,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAClJ,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@memberjunction/installer` — Public API surface.
|
|
3
|
+
*
|
|
4
|
+
* Headless, event-driven installer engine for MemberJunction. This barrel
|
|
5
|
+
* module re-exports every public type needed by consumer packages:
|
|
6
|
+
*
|
|
7
|
+
* | Category | Key exports |
|
|
8
|
+
* |------------|------------------------------------------------------------------|
|
|
9
|
+
* | Engine | {@link InstallerEngine} |
|
|
10
|
+
* | Events | {@link InstallerEventEmitter}, event payload types |
|
|
11
|
+
* | Errors | {@link InstallerError}, {@link PhaseId} |
|
|
12
|
+
* | Models | {@link InstallPlan}, {@link InstallState}, {@link Diagnostics} |
|
|
13
|
+
* | Adapters | {@link GitHubReleaseProvider}, {@link FileSystemAdapter}, etc. |
|
|
14
|
+
* | Phases | All 9 phase classes with their context/result types |
|
|
15
|
+
*
|
|
16
|
+
* **Primary consumers**:
|
|
17
|
+
* - `@memberjunction/cli` — the `mj install` and `mj doctor` commands.
|
|
18
|
+
* - VSCode MemberJunction extension (planned).
|
|
19
|
+
* - Docker/CI automation scripts.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { InstallerEngine } from '@memberjunction/installer';
|
|
24
|
+
*
|
|
25
|
+
* const engine = new InstallerEngine();
|
|
26
|
+
* engine.On('phase:start', (e) => console.log(`Starting ${e.Phase}...`));
|
|
27
|
+
* engine.On('error', (e) => console.error(e.Error.message));
|
|
28
|
+
*
|
|
29
|
+
* const plan = await engine.CreatePlan({ Dir: '/app', Tag: 'latest' });
|
|
30
|
+
* const result = await engine.Run(plan, { Yes: true });
|
|
31
|
+
* console.log(result.Success ? 'Install complete!' : 'Install failed.');
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @module @memberjunction/installer
|
|
35
|
+
* @see InstallerEngine — the main entry point for programmatic installs.
|
|
36
|
+
* @see InstallerEventEmitter — the typed event system for progress reporting.
|
|
37
|
+
*/
|
|
38
|
+
// Engine
|
|
39
|
+
export { InstallerEngine } from './InstallerEngine.js';
|
|
40
|
+
// Events
|
|
41
|
+
export { InstallerEventEmitter, } from './events/InstallerEvents.js';
|
|
42
|
+
// Errors
|
|
43
|
+
export { InstallerError } from './errors/InstallerError.js';
|
|
44
|
+
export { InstallConfigDefaults, resolveFromEnvironment, loadConfigFile, mergeConfigs, } from './models/InstallConfig.js';
|
|
45
|
+
export { InstallPlan, } from './models/InstallPlan.js';
|
|
46
|
+
export { InstallState, } from './models/InstallState.js';
|
|
47
|
+
export { Diagnostics, } from './models/Diagnostics.js';
|
|
48
|
+
// Adapters (exported for testing and extension use)
|
|
49
|
+
export { GitHubReleaseProvider } from './adapters/GitHubReleaseProvider.js';
|
|
50
|
+
export { FileSystemAdapter } from './adapters/FileSystemAdapter.js';
|
|
51
|
+
export { ProcessRunner } from './adapters/ProcessRunner.js';
|
|
52
|
+
export { SqlServerAdapter } from './adapters/SqlServerAdapter.js';
|
|
53
|
+
// Phases (exported for testing and direct use)
|
|
54
|
+
export { PreflightPhase } from './phases/PreflightPhase.js';
|
|
55
|
+
export { ScaffoldPhase } from './phases/ScaffoldPhase.js';
|
|
56
|
+
export { ConfigurePhase } from './phases/ConfigurePhase.js';
|
|
57
|
+
export { DatabaseProvisionPhase } from './phases/DatabaseProvisionPhase.js';
|
|
58
|
+
export { MigratePhase } from './phases/MigratePhase.js';
|
|
59
|
+
export { PlatformCompatPhase } from './phases/PlatformCompatPhase.js';
|
|
60
|
+
export { DependencyPhase } from './phases/DependencyPhase.js';
|
|
61
|
+
export { CodeGenPhase } from './phases/CodeGenPhase.js';
|
|
62
|
+
export { SmokeTestPhase } from './phases/SmokeTestPhase.js';
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,SAAS;AACT,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,SAAS;AACT,OAAO,EACL,qBAAqB,GAatB,MAAM,6BAA6B,CAAC;AAErC,SAAS;AACT,OAAO,EAAE,cAAc,EAAgB,MAAM,4BAA4B,CAAC;AAI1E,OAAO,EAGL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,WAAW,GAMZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,GAIb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,WAAW,GAKZ,MAAM,yBAAyB,CAAC;AAEjC,oDAAoD;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAA2C,MAAM,6BAA6B,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAA8B,MAAM,gCAAgC,CAAC;AAE9F,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAA+C,MAAM,4BAA4B,CAAC;AACzG,OAAO,EAAE,aAAa,EAA6C,MAAM,2BAA2B,CAAC;AACrG,OAAO,EAAE,cAAc,EAA+C,MAAM,4BAA4B,CAAC;A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