@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.
Files changed (90) hide show
  1. package/dist/InstallerEngine.d.ts +182 -0
  2. package/dist/InstallerEngine.d.ts.map +1 -0
  3. package/dist/InstallerEngine.js +571 -0
  4. package/dist/InstallerEngine.js.map +1 -0
  5. package/dist/adapters/FileSystemAdapter.d.ts +197 -0
  6. package/dist/adapters/FileSystemAdapter.d.ts.map +1 -0
  7. package/dist/adapters/FileSystemAdapter.js +355 -0
  8. package/dist/adapters/FileSystemAdapter.js.map +1 -0
  9. package/dist/adapters/GitHubReleaseProvider.d.ts +197 -0
  10. package/dist/adapters/GitHubReleaseProvider.d.ts.map +1 -0
  11. package/dist/adapters/GitHubReleaseProvider.js +348 -0
  12. package/dist/adapters/GitHubReleaseProvider.js.map +1 -0
  13. package/dist/adapters/ProcessRunner.d.ts +174 -0
  14. package/dist/adapters/ProcessRunner.d.ts.map +1 -0
  15. package/dist/adapters/ProcessRunner.js +264 -0
  16. package/dist/adapters/ProcessRunner.js.map +1 -0
  17. package/dist/adapters/SqlServerAdapter.d.ts +78 -0
  18. package/dist/adapters/SqlServerAdapter.d.ts.map +1 -0
  19. package/dist/adapters/SqlServerAdapter.js +120 -0
  20. package/dist/adapters/SqlServerAdapter.js.map +1 -0
  21. package/dist/errors/InstallerError.d.ts +92 -0
  22. package/dist/errors/InstallerError.d.ts.map +1 -0
  23. package/dist/errors/InstallerError.js +66 -0
  24. package/dist/errors/InstallerError.js.map +1 -0
  25. package/dist/events/InstallerEvents.d.ts +255 -0
  26. package/dist/events/InstallerEvents.d.ts.map +1 -0
  27. package/dist/events/InstallerEvents.js +96 -0
  28. package/dist/events/InstallerEvents.js.map +1 -0
  29. package/dist/index.d.ts +59 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +63 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/models/Diagnostics.d.ts +121 -0
  34. package/dist/models/Diagnostics.d.ts.map +1 -0
  35. package/dist/models/Diagnostics.js +75 -0
  36. package/dist/models/Diagnostics.js.map +1 -0
  37. package/dist/models/InstallConfig.d.ts +139 -0
  38. package/dist/models/InstallConfig.d.ts.map +1 -0
  39. package/dist/models/InstallConfig.js +207 -0
  40. package/dist/models/InstallConfig.js.map +1 -0
  41. package/dist/models/InstallPlan.d.ts +189 -0
  42. package/dist/models/InstallPlan.d.ts.map +1 -0
  43. package/dist/models/InstallPlan.js +117 -0
  44. package/dist/models/InstallPlan.js.map +1 -0
  45. package/dist/models/InstallState.d.ts +173 -0
  46. package/dist/models/InstallState.d.ts.map +1 -0
  47. package/dist/models/InstallState.js +203 -0
  48. package/dist/models/InstallState.js.map +1 -0
  49. package/dist/models/VersionInfo.d.ts +53 -0
  50. package/dist/models/VersionInfo.d.ts.map +1 -0
  51. package/dist/models/VersionInfo.js +2 -0
  52. package/dist/models/VersionInfo.js.map +1 -0
  53. package/dist/phases/CodeGenPhase.d.ts +364 -0
  54. package/dist/phases/CodeGenPhase.d.ts.map +1 -0
  55. package/dist/phases/CodeGenPhase.js +1086 -0
  56. package/dist/phases/CodeGenPhase.js.map +1 -0
  57. package/dist/phases/ConfigurePhase.d.ts +86 -0
  58. package/dist/phases/ConfigurePhase.d.ts.map +1 -0
  59. package/dist/phases/ConfigurePhase.js +439 -0
  60. package/dist/phases/ConfigurePhase.js.map +1 -0
  61. package/dist/phases/DatabaseProvisionPhase.d.ts +82 -0
  62. package/dist/phases/DatabaseProvisionPhase.d.ts.map +1 -0
  63. package/dist/phases/DatabaseProvisionPhase.js +284 -0
  64. package/dist/phases/DatabaseProvisionPhase.js.map +1 -0
  65. package/dist/phases/DependencyPhase.d.ts +88 -0
  66. package/dist/phases/DependencyPhase.d.ts.map +1 -0
  67. package/dist/phases/DependencyPhase.js +237 -0
  68. package/dist/phases/DependencyPhase.js.map +1 -0
  69. package/dist/phases/MigratePhase.d.ts +70 -0
  70. package/dist/phases/MigratePhase.d.ts.map +1 -0
  71. package/dist/phases/MigratePhase.js +96 -0
  72. package/dist/phases/MigratePhase.js.map +1 -0
  73. package/dist/phases/PlatformCompatPhase.d.ts +193 -0
  74. package/dist/phases/PlatformCompatPhase.d.ts.map +1 -0
  75. package/dist/phases/PlatformCompatPhase.js +587 -0
  76. package/dist/phases/PlatformCompatPhase.js.map +1 -0
  77. package/dist/phases/PreflightPhase.d.ts +119 -0
  78. package/dist/phases/PreflightPhase.d.ts.map +1 -0
  79. package/dist/phases/PreflightPhase.js +394 -0
  80. package/dist/phases/PreflightPhase.js.map +1 -0
  81. package/dist/phases/ScaffoldPhase.d.ts +99 -0
  82. package/dist/phases/ScaffoldPhase.d.ts.map +1 -0
  83. package/dist/phases/ScaffoldPhase.js +235 -0
  84. package/dist/phases/ScaffoldPhase.js.map +1 -0
  85. package/dist/phases/SmokeTestPhase.d.ts +111 -0
  86. package/dist/phases/SmokeTestPhase.d.ts.map +1 -0
  87. package/dist/phases/SmokeTestPhase.js +426 -0
  88. package/dist/phases/SmokeTestPhase.js.map +1 -0
  89. package/package.json +26 -7
  90. package/README.md +0 -45
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Adapter for spawning child processes and capturing output.
3
+ *
4
+ * Used by installer phases that run external tools (`npm`, `npx mj codegen`,
5
+ * `npx turbo build`, etc.). Handles cross-platform differences:
6
+ *
7
+ * - **Windows**: Spawns with `shell: true` so that `.cmd` shims (npm, npx)
8
+ * are resolved correctly. Uses `taskkill /F /T` for process tree cleanup.
9
+ * - **Unix**: Spawns without shell. Uses process group kill (`kill -SIGTERM -pid`)
10
+ * with a 5-second SIGKILL fallback.
11
+ *
12
+ * @module adapters/ProcessRunner
13
+ * @see DependencyPhase — uses Run for `npm install` and `npm run build`.
14
+ * @see CodeGenPhase — uses Run for `npx mj codegen` and `npx turbo build`.
15
+ * @see SmokeTestPhase — uses Run for service startup and killByPort for cleanup.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const runner = new ProcessRunner();
20
+ * const result = await runner.Run('npm', ['install'], {
21
+ * Cwd: '/path/to/repo',
22
+ * TimeoutMs: 600_000,
23
+ * OnStdout: (line) => console.log(line),
24
+ * });
25
+ * if (result.ExitCode !== 0) console.error(result.Stderr);
26
+ * ```
27
+ */
28
+ /**
29
+ * Result of a child process execution.
30
+ *
31
+ * @see ProcessRunner.Run — returns this after the process exits or times out.
32
+ */
33
+ export interface ProcessResult {
34
+ /** Process exit code (`0` = success). Set to `1` on spawn errors. */
35
+ ExitCode: number;
36
+ /** Accumulated stdout output from the process. */
37
+ Stdout: string;
38
+ /** Accumulated stderr output from the process. */
39
+ Stderr: string;
40
+ /** Whether the process was killed due to exceeding {@link ProcessOptions.TimeoutMs}. */
41
+ TimedOut: boolean;
42
+ }
43
+ /**
44
+ * Options for configuring child process execution.
45
+ *
46
+ * @see ProcessRunner.Run
47
+ */
48
+ export interface ProcessOptions {
49
+ /** Working directory for the child process (defaults to `process.cwd()`). */
50
+ Cwd?: string;
51
+ /** Additional environment variables (merged with `process.env`). */
52
+ Env?: Record<string, string>;
53
+ /** Maximum execution time in milliseconds. Process tree is killed on timeout. */
54
+ TimeoutMs?: number;
55
+ /**
56
+ * Streaming callback invoked with each line of stdout.
57
+ * Used by phases to emit `step:progress` events for real-time output.
58
+ */
59
+ OnStdout?: (line: string) => void;
60
+ /**
61
+ * Streaming callback invoked with each line of stderr.
62
+ * Used by phases to emit verbose log events for diagnostic output.
63
+ */
64
+ OnStderr?: (line: string) => void;
65
+ }
66
+ /**
67
+ * Cross-platform child process runner with streaming output, timeout support,
68
+ * and process tree cleanup.
69
+ *
70
+ * Key behaviors:
71
+ * - On Windows, spawns with `shell: true` to resolve `.cmd` shims.
72
+ * - Supports configurable timeouts with full process tree kill on expiry.
73
+ * - Streams stdout/stderr line-by-line via callbacks for real-time progress.
74
+ * - Provides {@link killByPort} for port-based process cleanup (used by smoke test).
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const runner = new ProcessRunner();
79
+ *
80
+ * // Simple command
81
+ * const version = await runner.RunSimple('node', ['--version']);
82
+ *
83
+ * // Long-running command with streaming and timeout
84
+ * const result = await runner.Run('npm', ['run', 'build'], {
85
+ * Cwd: '/path/to/repo',
86
+ * TimeoutMs: 1_800_000,
87
+ * OnStdout: (line) => emitter.Emit('step:progress', { ... }),
88
+ * });
89
+ * ```
90
+ */
91
+ export declare class ProcessRunner {
92
+ /**
93
+ * Spawn a child process and return the full result after it exits.
94
+ *
95
+ * The process is spawned with `shell: true` on Windows (for `.cmd` shim
96
+ * resolution) and `shell: false` on Unix. Stdout and stderr are accumulated
97
+ * in memory and optionally streamed line-by-line via callbacks.
98
+ *
99
+ * If {@link ProcessOptions.TimeoutMs} is set and the process exceeds it,
100
+ * the entire process tree is killed and `{ TimedOut: true }` is returned.
101
+ *
102
+ * @param command - The command to execute (e.g., `'npm'`, `'npx'`).
103
+ * @param args - Command arguments (e.g., `['install', '--legacy-peer-deps']`).
104
+ * @param options - Execution options (cwd, env, timeout, streaming callbacks).
105
+ * @returns The process result with exit code, output, and timeout status.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const result = await runner.Run('npx', ['mj', 'codegen'], {
110
+ * Cwd: dir,
111
+ * TimeoutMs: 600_000,
112
+ * OnStdout: (line) => console.log(line),
113
+ * });
114
+ * ```
115
+ */
116
+ Run(command: string, args: string[], options?: ProcessOptions): Promise<ProcessResult>;
117
+ /**
118
+ * Run a command and return just the trimmed stdout.
119
+ *
120
+ * Convenience wrapper around {@link Run} for simple commands where you only
121
+ * need the output text. Throws an `Error` if the process exits with a
122
+ * non-zero code.
123
+ *
124
+ * @param command - The command to execute.
125
+ * @param args - Command arguments.
126
+ * @param cwd - Optional working directory.
127
+ * @returns Trimmed stdout output.
128
+ * @throws Error if the process exits with a non-zero exit code.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const npmVersion = await runner.RunSimple('npm', ['--version']);
133
+ * // "10.9.0"
134
+ * ```
135
+ */
136
+ RunSimple(command: string, args: string[], cwd?: string): Promise<string>;
137
+ /**
138
+ * Check whether a command exists on the system PATH.
139
+ *
140
+ * Uses `where` on Windows or `which` on Unix to locate the executable.
141
+ *
142
+ * @param command - The command name to look up (e.g., `'npm'`, `'git'`).
143
+ * @returns `true` if the command is found, `false` otherwise.
144
+ */
145
+ CommandExists(command: string): Promise<boolean>;
146
+ /**
147
+ * Kill a process and its entire process tree.
148
+ *
149
+ * On Windows, `child.kill()` with `shell: true` only terminates the
150
+ * top-level `cmd.exe` shell, leaving turbo/node grandchild processes
151
+ * running as orphans. This method uses `taskkill /F /T /PID` on Windows
152
+ * and process group signals (`SIGTERM` then `SIGKILL`) on Unix to ensure
153
+ * the full process tree is terminated.
154
+ *
155
+ * @param pid - Process ID of the root process to kill. No-op if `undefined`.
156
+ */
157
+ killTree(pid: number | undefined): void;
158
+ /**
159
+ * Kill all processes listening on a given TCP port.
160
+ *
161
+ * Used by {@link SmokeTestPhase} to clean up MJAPI and Explorer service
162
+ * processes after smoke test health checks complete. Without port-based
163
+ * cleanup, turbo/node grandchild processes survive parent shell termination
164
+ * and block future starts with `EADDRINUSE`.
165
+ *
166
+ * - **Windows**: Uses `netstat -ano` to find listening PIDs, then
167
+ * `taskkill /F /T` to kill each process tree.
168
+ * - **Unix**: Uses `lsof -ti:<port> | xargs kill -9`.
169
+ *
170
+ * @param port - TCP port number to scan for listening processes.
171
+ */
172
+ killByPort(port: number): void;
173
+ }
174
+ //# sourceMappingURL=ProcessRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessRunner.d.ts","sourceRoot":"","sources":["../../src/adapters/ProcessRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyE5F;;;;;;;;;;;;;;;;;;OAkBG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ/E;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWtD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAgBvC;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CA4B/B"}
@@ -0,0 +1,264 @@
1
+ /**
2
+ * Adapter for spawning child processes and capturing output.
3
+ *
4
+ * Used by installer phases that run external tools (`npm`, `npx mj codegen`,
5
+ * `npx turbo build`, etc.). Handles cross-platform differences:
6
+ *
7
+ * - **Windows**: Spawns with `shell: true` so that `.cmd` shims (npm, npx)
8
+ * are resolved correctly. Uses `taskkill /F /T` for process tree cleanup.
9
+ * - **Unix**: Spawns without shell. Uses process group kill (`kill -SIGTERM -pid`)
10
+ * with a 5-second SIGKILL fallback.
11
+ *
12
+ * @module adapters/ProcessRunner
13
+ * @see DependencyPhase — uses Run for `npm install` and `npm run build`.
14
+ * @see CodeGenPhase — uses Run for `npx mj codegen` and `npx turbo build`.
15
+ * @see SmokeTestPhase — uses Run for service startup and killByPort for cleanup.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const runner = new ProcessRunner();
20
+ * const result = await runner.Run('npm', ['install'], {
21
+ * Cwd: '/path/to/repo',
22
+ * TimeoutMs: 600_000,
23
+ * OnStdout: (line) => console.log(line),
24
+ * });
25
+ * if (result.ExitCode !== 0) console.error(result.Stderr);
26
+ * ```
27
+ */
28
+ import { spawn, execSync } from 'node:child_process';
29
+ /**
30
+ * Cross-platform child process runner with streaming output, timeout support,
31
+ * and process tree cleanup.
32
+ *
33
+ * Key behaviors:
34
+ * - On Windows, spawns with `shell: true` to resolve `.cmd` shims.
35
+ * - Supports configurable timeouts with full process tree kill on expiry.
36
+ * - Streams stdout/stderr line-by-line via callbacks for real-time progress.
37
+ * - Provides {@link killByPort} for port-based process cleanup (used by smoke test).
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const runner = new ProcessRunner();
42
+ *
43
+ * // Simple command
44
+ * const version = await runner.RunSimple('node', ['--version']);
45
+ *
46
+ * // Long-running command with streaming and timeout
47
+ * const result = await runner.Run('npm', ['run', 'build'], {
48
+ * Cwd: '/path/to/repo',
49
+ * TimeoutMs: 1_800_000,
50
+ * OnStdout: (line) => emitter.Emit('step:progress', { ... }),
51
+ * });
52
+ * ```
53
+ */
54
+ export class ProcessRunner {
55
+ /**
56
+ * Spawn a child process and return the full result after it exits.
57
+ *
58
+ * The process is spawned with `shell: true` on Windows (for `.cmd` shim
59
+ * resolution) and `shell: false` on Unix. Stdout and stderr are accumulated
60
+ * in memory and optionally streamed line-by-line via callbacks.
61
+ *
62
+ * If {@link ProcessOptions.TimeoutMs} is set and the process exceeds it,
63
+ * the entire process tree is killed and `{ TimedOut: true }` is returned.
64
+ *
65
+ * @param command - The command to execute (e.g., `'npm'`, `'npx'`).
66
+ * @param args - Command arguments (e.g., `['install', '--legacy-peer-deps']`).
67
+ * @param options - Execution options (cwd, env, timeout, streaming callbacks).
68
+ * @returns The process result with exit code, output, and timeout status.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const result = await runner.Run('npx', ['mj', 'codegen'], {
73
+ * Cwd: dir,
74
+ * TimeoutMs: 600_000,
75
+ * OnStdout: (line) => console.log(line),
76
+ * });
77
+ * ```
78
+ */
79
+ async Run(command, args, options) {
80
+ return new Promise((resolve) => {
81
+ const isWindows = process.platform === 'win32';
82
+ const shell = isWindows ? true : false;
83
+ const child = spawn(command, args, {
84
+ cwd: options?.Cwd ?? process.cwd(),
85
+ env: { ...process.env, ...options?.Env },
86
+ shell,
87
+ stdio: ['ignore', 'pipe', 'pipe'],
88
+ windowsHide: true,
89
+ });
90
+ let stdout = '';
91
+ let stderr = '';
92
+ let timedOut = false;
93
+ let timeoutHandle;
94
+ if (options?.TimeoutMs) {
95
+ timeoutHandle = setTimeout(() => {
96
+ timedOut = true;
97
+ this.killTree(child.pid);
98
+ }, options.TimeoutMs);
99
+ }
100
+ child.stdout.on('data', (data) => {
101
+ const text = data.toString();
102
+ stdout += text;
103
+ if (options?.OnStdout) {
104
+ const lines = text.split('\n').filter((l) => l.length > 0);
105
+ for (const line of lines) {
106
+ options.OnStdout(line);
107
+ }
108
+ }
109
+ });
110
+ child.stderr.on('data', (data) => {
111
+ const text = data.toString();
112
+ stderr += text;
113
+ if (options?.OnStderr) {
114
+ const lines = text.split('\n').filter((l) => l.length > 0);
115
+ for (const line of lines) {
116
+ options.OnStderr(line);
117
+ }
118
+ }
119
+ });
120
+ child.on('close', (code) => {
121
+ if (timeoutHandle) {
122
+ clearTimeout(timeoutHandle);
123
+ }
124
+ resolve({
125
+ ExitCode: code ?? 1,
126
+ Stdout: stdout,
127
+ Stderr: stderr,
128
+ TimedOut: timedOut,
129
+ });
130
+ });
131
+ child.on('error', (err) => {
132
+ if (timeoutHandle) {
133
+ clearTimeout(timeoutHandle);
134
+ }
135
+ resolve({
136
+ ExitCode: 1,
137
+ Stdout: stdout,
138
+ Stderr: err.message,
139
+ TimedOut: false,
140
+ });
141
+ });
142
+ });
143
+ }
144
+ /**
145
+ * Run a command and return just the trimmed stdout.
146
+ *
147
+ * Convenience wrapper around {@link Run} for simple commands where you only
148
+ * need the output text. Throws an `Error` if the process exits with a
149
+ * non-zero code.
150
+ *
151
+ * @param command - The command to execute.
152
+ * @param args - Command arguments.
153
+ * @param cwd - Optional working directory.
154
+ * @returns Trimmed stdout output.
155
+ * @throws Error if the process exits with a non-zero exit code.
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const npmVersion = await runner.RunSimple('npm', ['--version']);
160
+ * // "10.9.0"
161
+ * ```
162
+ */
163
+ async RunSimple(command, args, cwd) {
164
+ const result = await this.Run(command, args, { Cwd: cwd });
165
+ if (result.ExitCode !== 0) {
166
+ throw new Error(`Command "${command} ${args.join(' ')}" failed (exit ${result.ExitCode}): ${result.Stderr}`);
167
+ }
168
+ return result.Stdout.trim();
169
+ }
170
+ /**
171
+ * Check whether a command exists on the system PATH.
172
+ *
173
+ * Uses `where` on Windows or `which` on Unix to locate the executable.
174
+ *
175
+ * @param command - The command name to look up (e.g., `'npm'`, `'git'`).
176
+ * @returns `true` if the command is found, `false` otherwise.
177
+ */
178
+ async CommandExists(command) {
179
+ try {
180
+ const isWindows = process.platform === 'win32';
181
+ const checkCmd = isWindows ? 'where' : 'which';
182
+ const result = await this.Run(checkCmd, [command]);
183
+ return result.ExitCode === 0;
184
+ }
185
+ catch {
186
+ return false;
187
+ }
188
+ }
189
+ /**
190
+ * Kill a process and its entire process tree.
191
+ *
192
+ * On Windows, `child.kill()` with `shell: true` only terminates the
193
+ * top-level `cmd.exe` shell, leaving turbo/node grandchild processes
194
+ * running as orphans. This method uses `taskkill /F /T /PID` on Windows
195
+ * and process group signals (`SIGTERM` then `SIGKILL`) on Unix to ensure
196
+ * the full process tree is terminated.
197
+ *
198
+ * @param pid - Process ID of the root process to kill. No-op if `undefined`.
199
+ */
200
+ killTree(pid) {
201
+ if (!pid)
202
+ return;
203
+ try {
204
+ if (process.platform === 'win32') {
205
+ execSync(`taskkill /F /T /PID ${pid}`, { stdio: 'ignore' });
206
+ }
207
+ else {
208
+ process.kill(-pid, 'SIGTERM');
209
+ setTimeout(() => {
210
+ try {
211
+ process.kill(-pid, 'SIGKILL');
212
+ }
213
+ catch { /* already dead */ }
214
+ }, 5000);
215
+ }
216
+ }
217
+ catch {
218
+ // Process may have already exited
219
+ }
220
+ }
221
+ /**
222
+ * Kill all processes listening on a given TCP port.
223
+ *
224
+ * Used by {@link SmokeTestPhase} to clean up MJAPI and Explorer service
225
+ * processes after smoke test health checks complete. Without port-based
226
+ * cleanup, turbo/node grandchild processes survive parent shell termination
227
+ * and block future starts with `EADDRINUSE`.
228
+ *
229
+ * - **Windows**: Uses `netstat -ano` to find listening PIDs, then
230
+ * `taskkill /F /T` to kill each process tree.
231
+ * - **Unix**: Uses `lsof -ti:<port> | xargs kill -9`.
232
+ *
233
+ * @param port - TCP port number to scan for listening processes.
234
+ */
235
+ killByPort(port) {
236
+ try {
237
+ if (process.platform === 'win32') {
238
+ // Find PIDs listening on this port and kill their process trees
239
+ const output = execSync(`netstat -ano | findstr ":${port}" | findstr "LISTENING"`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] });
240
+ const pids = new Set();
241
+ for (const line of output.split('\n')) {
242
+ const parts = line.trim().split(/\s+/);
243
+ const pid = parts[parts.length - 1];
244
+ if (pid && /^\d+$/.test(pid) && pid !== '0') {
245
+ pids.add(pid);
246
+ }
247
+ }
248
+ for (const pid of pids) {
249
+ try {
250
+ execSync(`taskkill /F /T /PID ${pid}`, { stdio: 'ignore' });
251
+ }
252
+ catch { /* already dead */ }
253
+ }
254
+ }
255
+ else {
256
+ execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null || true`, { stdio: 'ignore' });
257
+ }
258
+ }
259
+ catch {
260
+ // No process on this port, or already killed
261
+ }
262
+ }
263
+ }
264
+ //# sourceMappingURL=ProcessRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessRunner.js","sourceRoot":"","sources":["../../src/adapters/ProcessRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AA0CrD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,GAAG,CAAC,OAAe,EAAE,IAAc,EAAE,OAAwB;QACjE,OAAO,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,EAAE;YAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;YAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YAEvC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;gBACjC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;gBAClC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;gBACxC,KAAK;gBACL,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;gBACjC,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,MAAM,G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AAK,OAAO,EAAE,CAAC;gBACjC,gEAAgE;gBAChE,MAAM,MAAM,GAAG,QAAQ,CACrB,4BAA4B,IAAI,yBAAyB,EACzD,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CACzD,CAAC;gBACF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;gBAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACvC,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBACpC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;wBAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBAChB,CAAC;gBACH,CAAC;gBACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;oBACvB,IAAI,CAAC;wBACH,QAAQ,CAAC,uBAAuB,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;oBAC9D,CAAC;oBAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,YAAY,IAAI,sCAAsC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,6CAA6C;QAC/C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Adapter for SQL Server connectivity checks.
3
+ *
4
+ * Uses raw TCP sockets (no SQL driver dependency) for the preflight
5
+ * connectivity test. This keeps the installer's dependency footprint small —
6
+ * a full SQL driver (`tedious`, `mssql`) is not needed just to verify
7
+ * that a server is accepting connections.
8
+ *
9
+ * Future phases that need actual SQL queries (e.g., user creation) will
10
+ * use `@memberjunction/sqlserver-dataprovider` instead.
11
+ *
12
+ * @module adapters/SqlServerAdapter
13
+ * @see PreflightPhase — uses this adapter for the SQL connectivity check.
14
+ * @see DatabaseProvisionPhase — uses this adapter for post-script validation.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const sql = new SqlServerAdapter();
19
+ * const result = await sql.CheckConnectivity('localhost', 1433);
20
+ * if (result.Reachable) {
21
+ * console.log(`Connected in ${result.LatencyMs}ms`);
22
+ * } else {
23
+ * console.error(result.ErrorMessage);
24
+ * }
25
+ * ```
26
+ */
27
+ /**
28
+ * Result of a TCP connectivity check to a SQL Server instance.
29
+ *
30
+ * @see SqlServerAdapter.CheckConnectivity
31
+ */
32
+ export interface SqlConnectivityResult {
33
+ /** Whether the TCP connection was established successfully. */
34
+ Reachable: boolean;
35
+ /** Human-readable error description (present only when `Reachable` is `false`). */
36
+ ErrorMessage?: string;
37
+ /** Round-trip time in milliseconds from connection attempt to result. */
38
+ LatencyMs: number;
39
+ }
40
+ /**
41
+ * Lightweight adapter for testing SQL Server connectivity via raw TCP sockets.
42
+ *
43
+ * Does **not** perform SQL authentication or execute queries — only verifies
44
+ * that the host:port is accepting TCP connections. This is sufficient for
45
+ * preflight checks and post-provisioning validation.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const adapter = new SqlServerAdapter();
50
+ * const result = await adapter.CheckConnectivity('db.example.com', 1433, 10000);
51
+ * console.log(result.Reachable ? 'OK' : result.ErrorMessage);
52
+ * ```
53
+ */
54
+ export declare class SqlServerAdapter {
55
+ /**
56
+ * Test TCP connectivity to a SQL Server instance.
57
+ *
58
+ * Opens a raw TCP socket to the specified host and port. If the connection
59
+ * is established within the timeout, returns `{ Reachable: true }`. Otherwise
60
+ * returns a structured error with a human-readable message tailored to common
61
+ * failure modes (ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET).
62
+ *
63
+ * @param host - SQL Server hostname or IP address.
64
+ * @param port - SQL Server TCP port (typically `1433`).
65
+ * @param timeoutMs - Maximum time to wait for the connection, in milliseconds (default: `5000`).
66
+ * @returns Connectivity result with reachability status, optional error, and latency.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const result = await adapter.CheckConnectivity('localhost', 1433);
71
+ * if (!result.Reachable) {
72
+ * console.error(`SQL Server unreachable: ${result.ErrorMessage}`);
73
+ * }
74
+ * ```
75
+ */
76
+ CheckConnectivity(host: string, port: number, timeoutMs?: number): Promise<SqlConnectivityResult>;
77
+ }
78
+ //# sourceMappingURL=SqlServerAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlServerAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/SqlServerAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAwC9G"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Adapter for SQL Server connectivity checks.
3
+ *
4
+ * Uses raw TCP sockets (no SQL driver dependency) for the preflight
5
+ * connectivity test. This keeps the installer's dependency footprint small —
6
+ * a full SQL driver (`tedious`, `mssql`) is not needed just to verify
7
+ * that a server is accepting connections.
8
+ *
9
+ * Future phases that need actual SQL queries (e.g., user creation) will
10
+ * use `@memberjunction/sqlserver-dataprovider` instead.
11
+ *
12
+ * @module adapters/SqlServerAdapter
13
+ * @see PreflightPhase — uses this adapter for the SQL connectivity check.
14
+ * @see DatabaseProvisionPhase — uses this adapter for post-script validation.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const sql = new SqlServerAdapter();
19
+ * const result = await sql.CheckConnectivity('localhost', 1433);
20
+ * if (result.Reachable) {
21
+ * console.log(`Connected in ${result.LatencyMs}ms`);
22
+ * } else {
23
+ * console.error(result.ErrorMessage);
24
+ * }
25
+ * ```
26
+ */
27
+ import net from 'node:net';
28
+ /**
29
+ * Lightweight adapter for testing SQL Server connectivity via raw TCP sockets.
30
+ *
31
+ * Does **not** perform SQL authentication or execute queries — only verifies
32
+ * that the host:port is accepting TCP connections. This is sufficient for
33
+ * preflight checks and post-provisioning validation.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const adapter = new SqlServerAdapter();
38
+ * const result = await adapter.CheckConnectivity('db.example.com', 1433, 10000);
39
+ * console.log(result.Reachable ? 'OK' : result.ErrorMessage);
40
+ * ```
41
+ */
42
+ export class SqlServerAdapter {
43
+ /**
44
+ * Test TCP connectivity to a SQL Server instance.
45
+ *
46
+ * Opens a raw TCP socket to the specified host and port. If the connection
47
+ * is established within the timeout, returns `{ Reachable: true }`. Otherwise
48
+ * returns a structured error with a human-readable message tailored to common
49
+ * failure modes (ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET).
50
+ *
51
+ * @param host - SQL Server hostname or IP address.
52
+ * @param port - SQL Server TCP port (typically `1433`).
53
+ * @param timeoutMs - Maximum time to wait for the connection, in milliseconds (default: `5000`).
54
+ * @returns Connectivity result with reachability status, optional error, and latency.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const result = await adapter.CheckConnectivity('localhost', 1433);
59
+ * if (!result.Reachable) {
60
+ * console.error(`SQL Server unreachable: ${result.ErrorMessage}`);
61
+ * }
62
+ * ```
63
+ */
64
+ async CheckConnectivity(host, port, timeoutMs = 5000) {
65
+ const start = Date.now();
66
+ return new Promise((resolve) => {
67
+ const socket = new net.Socket();
68
+ const cleanup = () => {
69
+ socket.removeAllListeners();
70
+ socket.destroy();
71
+ };
72
+ socket.setTimeout(timeoutMs);
73
+ socket.on('connect', () => {
74
+ const latency = Date.now() - start;
75
+ cleanup();
76
+ resolve({ Reachable: true, LatencyMs: latency });
77
+ });
78
+ socket.on('timeout', () => {
79
+ cleanup();
80
+ resolve({
81
+ Reachable: false,
82
+ ErrorMessage: `Connection timed out after ${timeoutMs}ms`,
83
+ LatencyMs: Date.now() - start,
84
+ });
85
+ });
86
+ socket.on('error', (err) => {
87
+ cleanup();
88
+ resolve({
89
+ Reachable: false,
90
+ ErrorMessage: formatConnectionError(err, host, port),
91
+ LatencyMs: Date.now() - start,
92
+ });
93
+ });
94
+ socket.connect(port, host);
95
+ });
96
+ }
97
+ }
98
+ /**
99
+ * Map common TCP socket error codes to human-readable diagnostic messages.
100
+ *
101
+ * @param err - The Node.js socket error with an `errno` code.
102
+ * @param host - The hostname that was being connected to.
103
+ * @param port - The port that was being connected to.
104
+ * @returns A user-friendly error message with diagnostic hints.
105
+ */
106
+ function formatConnectionError(err, host, port) {
107
+ switch (err.code) {
108
+ case 'ECONNREFUSED':
109
+ return `Connection refused at ${host}:${port}. Is SQL Server running?`;
110
+ case 'ENOTFOUND':
111
+ return `Host "${host}" not found. Check the hostname.`;
112
+ case 'ETIMEDOUT':
113
+ return `Connection to ${host}:${port} timed out. Check firewall rules.`;
114
+ case 'ECONNRESET':
115
+ return `Connection to ${host}:${port} was reset. SQL Server may be starting up.`;
116
+ default:
117
+ return `${err.code ?? 'Unknown error'}: ${err.message}`;
118
+ }
119
+ }
120
+ //# sourceMappingURL=SqlServerAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlServerAdapter.js","sourceRoot":"","sources":["../../src/adapters/SqlServerAdapter.ts"],"names":[],"mappings":"AAAA;;;;;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