@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,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InstallerEngine — the core orchestrator for MemberJunction installs.
|
|
3
|
+
*
|
|
4
|
+
* This class is **headless and event-driven**. It never writes to stdout directly.
|
|
5
|
+
* Frontends (CLI, VSCode extension, Docker/CI) subscribe to typed events to
|
|
6
|
+
* render progress, handle interactive prompts, and display diagnostics.
|
|
7
|
+
*
|
|
8
|
+
* **Architecture**:
|
|
9
|
+
* - 9 ordered phases executed sequentially: preflight → scaffold → configure →
|
|
10
|
+
* database → platform → dependencies → migrate → codegen → smoke_test.
|
|
11
|
+
* - Checkpoint/resume via `.mj-install-state.json` — if a phase fails, the user
|
|
12
|
+
* can re-run `mj install` and it resumes from the last incomplete phase.
|
|
13
|
+
* - Each phase is a standalone class with its own context/result types, making
|
|
14
|
+
* them independently testable and composable.
|
|
15
|
+
*
|
|
16
|
+
* **Public API**:
|
|
17
|
+
* - {@link InstallerEngine.On | On}/{@link InstallerEngine.Off | Off} — subscribe/unsubscribe to events.
|
|
18
|
+
* - {@link InstallerEngine.ListVersions | ListVersions} — fetch available MJ releases from GitHub.
|
|
19
|
+
* - {@link InstallerEngine.CreatePlan | CreatePlan} — build an install plan (dry-run safe).
|
|
20
|
+
* - {@link InstallerEngine.Run | Run} — execute a plan, emitting events throughout.
|
|
21
|
+
* - {@link InstallerEngine.Doctor | Doctor} — run diagnostics on an existing install.
|
|
22
|
+
* - {@link InstallerEngine.Resume | Resume} — resume from a checkpoint state file.
|
|
23
|
+
*
|
|
24
|
+
* @module InstallerEngine
|
|
25
|
+
* @see InstallerEventEmitter — the typed event system used for all communication.
|
|
26
|
+
* @see InstallPlan — the plan object returned by {@link InstallerEngine.CreatePlan}.
|
|
27
|
+
* @see InstallState — checkpoint/resume persistence.
|
|
28
|
+
* @see InstallerError — structured errors thrown by phases.
|
|
29
|
+
*/
|
|
30
|
+
import { type InstallerEventMap } from './events/InstallerEvents.js';
|
|
31
|
+
import { InstallPlan, type CreatePlanInput, type RunOptions, type DoctorOptions, type InstallResult } from './models/InstallPlan.js';
|
|
32
|
+
import type { VersionInfo } from './models/VersionInfo.js';
|
|
33
|
+
import type { Diagnostics } from './models/Diagnostics.js';
|
|
34
|
+
/**
|
|
35
|
+
* Core orchestrator for MemberJunction installs.
|
|
36
|
+
*
|
|
37
|
+
* Headless and event-driven — never writes to stdout. Frontends subscribe to
|
|
38
|
+
* typed events via {@link InstallerEngine.On} to render progress, handle prompts,
|
|
39
|
+
* and display diagnostics. Supports checkpoint/resume for long-running installs.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const engine = new InstallerEngine();
|
|
44
|
+
*
|
|
45
|
+
* // Subscribe to events
|
|
46
|
+
* engine.On('phase:start', (e) => console.log(`Phase: ${e.Phase}`));
|
|
47
|
+
* engine.On('step:progress', (e) => console.log(` ${e.Message}`));
|
|
48
|
+
* engine.On('error', (e) => console.error(e.Error.message));
|
|
49
|
+
*
|
|
50
|
+
* // Create and execute a plan
|
|
51
|
+
* const plan = await engine.CreatePlan({ Dir: '/app', Tag: 'v5.1.0' });
|
|
52
|
+
* const result = await engine.Run(plan, { Verbose: true, Yes: true });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare class InstallerEngine {
|
|
56
|
+
private emitter;
|
|
57
|
+
private github;
|
|
58
|
+
private preflight;
|
|
59
|
+
private scaffold;
|
|
60
|
+
private configure;
|
|
61
|
+
private databaseProvision;
|
|
62
|
+
private migrate;
|
|
63
|
+
private platformCompat;
|
|
64
|
+
private dependency;
|
|
65
|
+
private codeGen;
|
|
66
|
+
private smokeTest;
|
|
67
|
+
/**
|
|
68
|
+
* Resolved config accumulator — populated incrementally by the configure phase,
|
|
69
|
+
* then consumed by all subsequent phases (database, migrate, smoke test, etc.).
|
|
70
|
+
*/
|
|
71
|
+
private resolvedConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to installer events.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam K - The event name (e.g., `'phase:start'`, `'step:progress'`, `'error'`).
|
|
76
|
+
* @param event - The event to listen for.
|
|
77
|
+
* @param handler - Callback invoked with the event payload.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* engine.On('phase:end', (e) => {
|
|
82
|
+
* console.log(`${e.Phase} ${e.Status} in ${e.DurationMs}ms`);
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
On<K extends keyof InstallerEventMap>(event: K, handler: (...args: InstallerEventMap[K]) => void): void;
|
|
87
|
+
/**
|
|
88
|
+
* Unsubscribe from installer events.
|
|
89
|
+
*
|
|
90
|
+
* @typeParam K - The event name.
|
|
91
|
+
* @param event - The event to stop listening for.
|
|
92
|
+
* @param handler - The same handler reference passed to {@link On}.
|
|
93
|
+
*/
|
|
94
|
+
Off<K extends keyof InstallerEventMap>(event: K, handler: (...args: InstallerEventMap[K]) => void): void;
|
|
95
|
+
/**
|
|
96
|
+
* List available MemberJunction release versions from GitHub.
|
|
97
|
+
*
|
|
98
|
+
* Fetches releases from the MemberJunction GitHub repository using the
|
|
99
|
+
* unauthenticated REST API (60 requests/hour rate limit).
|
|
100
|
+
*
|
|
101
|
+
* @param includePrerelease - Whether to include pre-release tags (default: `false`).
|
|
102
|
+
* @returns Array of available versions sorted by publish date (newest first).
|
|
103
|
+
*/
|
|
104
|
+
ListVersions(includePrerelease?: boolean): Promise<VersionInfo[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Build an install plan (dry-run friendly — no side effects).
|
|
107
|
+
*
|
|
108
|
+
* The plan describes which phases will run, which will be skipped, and
|
|
109
|
+
* with what configuration. It can be inspected before execution (e.g.,
|
|
110
|
+
* with `plan.Summarize()`) or passed directly to {@link Run}.
|
|
111
|
+
*
|
|
112
|
+
* @param input - Plan inputs including target directory, tag, skip flags, and config overrides.
|
|
113
|
+
* @returns A new {@link InstallPlan} ready for execution or inspection.
|
|
114
|
+
*/
|
|
115
|
+
CreatePlan(input: CreatePlanInput): Promise<InstallPlan>;
|
|
116
|
+
/**
|
|
117
|
+
* Execute an install plan, emitting events throughout.
|
|
118
|
+
*
|
|
119
|
+
* Iterates through plan phases in order. Supports checkpoint/resume — if a
|
|
120
|
+
* previous install left a `.mj-install-state.json`, completed phases are
|
|
121
|
+
* skipped automatically. Pass `NoResume: true` in options to force a fresh start.
|
|
122
|
+
*
|
|
123
|
+
* Stops on the first phase failure and returns partial results. The state file
|
|
124
|
+
* is updated after each phase, so re-running resumes from the failed phase.
|
|
125
|
+
*
|
|
126
|
+
* @param plan - The install plan from {@link CreatePlan}.
|
|
127
|
+
* @param options - Runtime options (verbose, yes, fast, no-resume, config overrides).
|
|
128
|
+
* @returns Install result with success status, duration, warnings, and phase lists.
|
|
129
|
+
*/
|
|
130
|
+
Run(plan: InstallPlan, options?: RunOptions): Promise<InstallResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Run diagnostics on an existing or target install directory.
|
|
133
|
+
*
|
|
134
|
+
* Performs preflight checks (Node version, disk space, SQL connectivity, etc.)
|
|
135
|
+
* and known-issue detection. Does **not** modify any files. Results are
|
|
136
|
+
* returned as a {@link Diagnostics} object and also emitted as `diagnostic` events.
|
|
137
|
+
*
|
|
138
|
+
* @param targetDir - Absolute path to the directory to diagnose.
|
|
139
|
+
* @param options - Optional doctor options (currently reserved for future use).
|
|
140
|
+
* @returns Diagnostics with environment info, check results, and last install info.
|
|
141
|
+
*/
|
|
142
|
+
Doctor(targetDir: string, options?: DoctorOptions): Promise<Diagnostics>;
|
|
143
|
+
/**
|
|
144
|
+
* Resume a previously interrupted install from a checkpoint state file.
|
|
145
|
+
*
|
|
146
|
+
* Loads the `.mj-install-state.json` from the given directory, reconstructs
|
|
147
|
+
* a plan from the saved tag, and calls {@link Run} with resume enabled.
|
|
148
|
+
*
|
|
149
|
+
* @param stateFileDir - Directory containing the `.mj-install-state.json` file.
|
|
150
|
+
* @param options - Runtime options forwarded to {@link Run}.
|
|
151
|
+
* @returns Install result from the resumed execution.
|
|
152
|
+
* @throws {InstallerError} With code `NO_STATE_FILE` if no checkpoint exists.
|
|
153
|
+
*/
|
|
154
|
+
Resume(stateFileDir: string, options?: RunOptions): Promise<InstallResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Dispatch a single phase to its corresponding execute method.
|
|
157
|
+
*
|
|
158
|
+
* @param phaseId - Which phase to execute.
|
|
159
|
+
* @param plan - The current install plan.
|
|
160
|
+
* @param config - Resolved config (may include overrides from options).
|
|
161
|
+
* @param yes - Non-interactive mode — skips all user prompts.
|
|
162
|
+
* @param fast - Fast mode — enables optimistic skipping in codegen.
|
|
163
|
+
* @returns Phase-specific result containing any warnings to bubble up.
|
|
164
|
+
*/
|
|
165
|
+
private executePhase;
|
|
166
|
+
private executePreflight;
|
|
167
|
+
private executeScaffold;
|
|
168
|
+
private executeConfigure;
|
|
169
|
+
private executeDatabase;
|
|
170
|
+
private executeMigrate;
|
|
171
|
+
private executePlatform;
|
|
172
|
+
private executeDependencies;
|
|
173
|
+
private executeCodeGen;
|
|
174
|
+
private executeSmokeTest;
|
|
175
|
+
/**
|
|
176
|
+
* Detect the current operating system from `process.platform`.
|
|
177
|
+
*
|
|
178
|
+
* @returns Normalized OS identifier used by {@link PlatformCompatPhase}.
|
|
179
|
+
*/
|
|
180
|
+
private detectOS;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=InstallerEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallerEngine.d.ts","sourceRoot":"","sources":["../src/InstallerEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAY5F,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGrI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsB3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,SAAS,CAAwB;IAEzC;;;OAGG;IACH,OAAO,CAAC,cAAc,CAA4B;IAMlD;;;;;;;;;;;;;OAaG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAIvG;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAIxG;;;;;;;;OAQG;IACG,YAAY,CAAC,iBAAiB,GAAE,OAAe,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI9E;;;;;;;;;OASG;IACG,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAqB9D;;;;;;;;;;;;;OAaG;IACG,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAqL1E;;;;;;;;;;OAUG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC;IA2C9E;;;;;;;;;;OAUG;IACG,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBhF;;;;;;;;;OASG;YACW,YAAY;YA6BZ,gBAAgB;YA0BhB,eAAe;YAuBf,gBAAgB;YAkBhB,eAAe;YAmBf,cAAc;YAUd,eAAe;YAef,mBAAmB;YASnB,cAAc;YAed,gBAAgB;IAsB9B;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAQjB"}
|