ninedeploy 0.10.6 → 0.16.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/LICENSE +21 -21
- package/README.md +1 -0
- package/dist/client.d.ts +34 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +81 -22
- package/dist/client.js.map +1 -1
- package/dist/commands/backupPolicy.d.ts +29 -0
- package/dist/commands/backupPolicy.d.ts.map +1 -0
- package/dist/commands/backupPolicy.js +111 -0
- package/dist/commands/backupPolicy.js.map +1 -0
- package/dist/commands/certificates.d.ts +18 -7
- package/dist/commands/certificates.d.ts.map +1 -1
- package/dist/commands/certificates.js +121 -1
- package/dist/commands/certificates.js.map +1 -1
- package/dist/commands/databaseAccess.d.ts +37 -0
- package/dist/commands/databaseAccess.d.ts.map +1 -0
- package/dist/commands/databaseAccess.js +306 -0
- package/dist/commands/databaseAccess.js.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +28 -7
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/githubApps.d.ts +40 -0
- package/dist/commands/githubApps.d.ts.map +1 -0
- package/dist/commands/githubApps.js +278 -0
- package/dist/commands/githubApps.js.map +1 -0
- package/dist/commands/housekeeping.d.ts +7 -0
- package/dist/commands/housekeeping.d.ts.map +1 -1
- package/dist/commands/housekeeping.js +16 -0
- package/dist/commands/housekeeping.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +17 -2
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/manage.d.ts +26 -10
- package/dist/commands/manage.d.ts.map +1 -1
- package/dist/commands/manage.js +219 -65
- package/dist/commands/manage.js.map +1 -1
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/manifest.js +9 -1
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/misc.d.ts +4 -2
- package/dist/commands/misc.d.ts.map +1 -1
- package/dist/commands/misc.js +25 -11
- package/dist/commands/misc.js.map +1 -1
- package/dist/commands/multiNode.d.ts +55 -0
- package/dist/commands/multiNode.d.ts.map +1 -0
- package/dist/commands/multiNode.js +438 -0
- package/dist/commands/multiNode.js.map +1 -0
- package/dist/commands/notifications.d.ts +1 -1
- package/dist/commands/operations.d.ts +89 -0
- package/dist/commands/operations.d.ts.map +1 -0
- package/dist/commands/operations.js +468 -0
- package/dist/commands/operations.js.map +1 -0
- package/dist/commands/panelBackup.d.ts +28 -0
- package/dist/commands/panelBackup.d.ts.map +1 -0
- package/dist/commands/panelBackup.js +153 -0
- package/dist/commands/panelBackup.js.map +1 -0
- package/dist/commands/plugins.d.ts +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +7 -3
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/proxyConfig.d.ts +16 -0
- package/dist/commands/proxyConfig.d.ts.map +1 -0
- package/dist/commands/proxyConfig.js +122 -0
- package/dist/commands/proxyConfig.js.map +1 -0
- package/dist/commands/secretProviders.d.ts +59 -0
- package/dist/commands/secretProviders.d.ts.map +1 -0
- package/dist/commands/secretProviders.js +212 -0
- package/dist/commands/secretProviders.js.map +1 -0
- package/dist/commands/services.d.ts.map +1 -1
- package/dist/commands/services.js +3 -5
- package/dist/commands/services.js.map +1 -1
- package/dist/commands/setup.d.ts +3 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +19 -3
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/sources.d.ts +10 -3
- package/dist/commands/sources.d.ts.map +1 -1
- package/dist/commands/sources.js +116 -18
- package/dist/commands/sources.js.map +1 -1
- package/dist/commands/templates.d.ts.map +1 -1
- package/dist/commands/templates.js +8 -1
- package/dist/commands/templates.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +427 -23
- package/dist/index.js.map +1 -1
- package/dist/lib/format.d.ts.map +1 -1
- package/dist/lib/format.js +5 -4
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/panelBackupFile.d.ts +3 -0
- package/dist/lib/panelBackupFile.d.ts.map +1 -0
- package/dist/lib/panelBackupFile.js +71 -0
- package/dist/lib/panelBackupFile.js.map +1 -0
- package/dist/lib/serverRunner.d.ts +6 -0
- package/dist/lib/serverRunner.d.ts.map +1 -1
- package/dist/lib/serverRunner.js +18 -3
- package/dist/lib/serverRunner.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +9 -2
- package/dist/prompts.js.map +1 -1
- package/package.json +6 -5
- package/src/client.ts +137 -0
- package/src/commands/backupPolicy.ts +123 -0
- package/src/commands/branding.ts +83 -0
- package/src/commands/buildCache.ts +72 -0
- package/src/commands/certificates.ts +208 -0
- package/src/commands/communityTemplates.ts +97 -0
- package/src/commands/configCenter.ts +71 -0
- package/src/commands/configPresets.ts +215 -0
- package/src/commands/databaseAccess.ts +333 -0
- package/src/commands/demo.ts +22 -0
- package/src/commands/deploy.ts +284 -0
- package/src/commands/doctor.ts +170 -0
- package/src/commands/domains.ts +170 -0
- package/src/commands/egress.ts +135 -0
- package/src/commands/emailTemplates.ts +112 -0
- package/src/commands/firewall.ts +82 -0
- package/src/commands/githubApps.ts +292 -0
- package/src/commands/housekeeping.ts +106 -0
- package/src/commands/login.ts +58 -0
- package/src/commands/logs.ts +91 -0
- package/src/commands/manage.ts +714 -0
- package/src/commands/manifest.ts +314 -0
- package/src/commands/metrics.ts +69 -0
- package/src/commands/misc.ts +307 -0
- package/src/commands/multiNode.ts +442 -0
- package/src/commands/notifications.ts +174 -0
- package/src/commands/operations.ts +519 -0
- package/src/commands/panelBackup.ts +167 -0
- package/src/commands/pgbouncer.ts +65 -0
- package/src/commands/plugins.ts +123 -0
- package/src/commands/proxyConfig.ts +117 -0
- package/src/commands/secretProviders.ts +228 -0
- package/src/commands/server.ts +126 -0
- package/src/commands/services.ts +249 -0
- package/src/commands/setup.ts +94 -0
- package/src/commands/sources.ts +317 -0
- package/src/commands/sso.ts +106 -0
- package/src/commands/templates.ts +158 -0
- package/src/commands/token.ts +66 -0
- package/src/commands/webhooks.ts +93 -0
- package/src/commands/workspaces.ts +63 -0
- package/src/config.ts +53 -0
- package/src/index.ts +1273 -0
- package/src/lib/format.ts +182 -0
- package/src/lib/panelBackupFile.ts +67 -0
- package/src/lib/serverRunner.ts +223 -0
- package/src/prompts.ts +238 -0
package/src/prompts.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Line framing for stdin: a chunk may carry SEVERAL lines (a paste, or piped
|
|
5
|
+
* input in CI) and a line may be split across chunks. Complete lines queue in
|
|
6
|
+
* `lineBuffer` in FIFO order; the incomplete tail stays in `pendingTail` until
|
|
7
|
+
* its newline arrives or stdin ends. prompt()/promptHidden() pull from the
|
|
8
|
+
* queue, so a pasted block answers successive prompts in order instead of
|
|
9
|
+
* collapsing into one value with embedded newlines (r024).
|
|
10
|
+
*
|
|
11
|
+
* Exactly ONE 'data' listener is wired per stdin stream: chunks route to the
|
|
12
|
+
* active hidden prompt (raw keystrokes) or to the line framer — never both,
|
|
13
|
+
* or a pasted line would be delivered twice. When `process.stdin` itself is
|
|
14
|
+
* swapped (test suites install a fresh fake per case), the listeners and the
|
|
15
|
+
* stream-lifecycle state are re-armed on the next call.
|
|
16
|
+
*/
|
|
17
|
+
let lineBuffer: string[] = [];
|
|
18
|
+
let pendingTail = '';
|
|
19
|
+
let eof = false;
|
|
20
|
+
let wiredStdin: unknown = null;
|
|
21
|
+
/** The exact handler references `attach()` registered on the current stdin. */
|
|
22
|
+
let wiredData: ((chunk: string) => void) | null = null;
|
|
23
|
+
let wiredEnd: (() => void) | null = null;
|
|
24
|
+
|
|
25
|
+
interface LineWaiter {
|
|
26
|
+
deliver: (line: string) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const lineWaiters: LineWaiter[] = [];
|
|
30
|
+
/** At most one hidden prompt at a time; it consumes live keystrokes. */
|
|
31
|
+
let hiddenWaiter: ((chunk: string) => boolean | void) | null = null;
|
|
32
|
+
/** EOF handler while a hidden prompt is active (resolves what was typed). */
|
|
33
|
+
let hiddenOnEnd: (() => void) | null = null;
|
|
34
|
+
|
|
35
|
+
function handleData(chunk: string): void {
|
|
36
|
+
pendingTail += chunk;
|
|
37
|
+
const lines = pendingTail.split(/\r?\n/);
|
|
38
|
+
pendingTail = lines.pop() ?? '';
|
|
39
|
+
lineBuffer.push(...lines);
|
|
40
|
+
flushLineWaiters();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleEnd(): void {
|
|
44
|
+
eof = true;
|
|
45
|
+
// A final line without its newline (piped input that omits it) still counts.
|
|
46
|
+
if (pendingTail !== '') {
|
|
47
|
+
lineBuffer.push(pendingTail);
|
|
48
|
+
pendingTail = '';
|
|
49
|
+
}
|
|
50
|
+
flushLineWaiters();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function flushLineWaiters(): void {
|
|
54
|
+
while (lineWaiters.length > 0 && (lineBuffer.length > 0 || eof)) {
|
|
55
|
+
const waiter = lineWaiters.shift()!;
|
|
56
|
+
waiter.deliver(lineBuffer.length > 0 ? lineBuffer.shift()! : '');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function detach(oldStdin: NodeJS.ReadStream): void {
|
|
61
|
+
// Remove the same function references `attach()` registered — removing
|
|
62
|
+
// different closures would be a silent no-op and leave live listeners on a
|
|
63
|
+
// swapped-out stream.
|
|
64
|
+
if (wiredData) oldStdin.removeListener('data', wiredData);
|
|
65
|
+
if (wiredEnd) oldStdin.removeListener('end', wiredEnd);
|
|
66
|
+
wiredData = null;
|
|
67
|
+
wiredEnd = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Wire the framer onto the CURRENT process.stdin. Re-arms when the stream
|
|
72
|
+
* object changes (fresh fake per test case); a no-op otherwise, so the real
|
|
73
|
+
* runtime keeps its queue and listeners across successive prompts.
|
|
74
|
+
*/
|
|
75
|
+
function attach(): void {
|
|
76
|
+
const stdin = process.stdin;
|
|
77
|
+
if (wiredStdin === stdin) return;
|
|
78
|
+
if (wiredStdin) detach(wiredStdin as NodeJS.ReadStream);
|
|
79
|
+
wiredStdin = stdin;
|
|
80
|
+
// A different stream object is a fresh lifecycle.
|
|
81
|
+
lineBuffer = [];
|
|
82
|
+
pendingTail = '';
|
|
83
|
+
eof = false;
|
|
84
|
+
hiddenWaiter = null;
|
|
85
|
+
hiddenOnEnd = null;
|
|
86
|
+
stdin.setEncoding('utf8');
|
|
87
|
+
let skipLeadingLf = false;
|
|
88
|
+
wiredData = (chunk: string) => {
|
|
89
|
+
if (skipLeadingLf && chunk.length > 0) {
|
|
90
|
+
skipLeadingLf = false;
|
|
91
|
+
if (chunk.startsWith('\n')) chunk = chunk.slice(1);
|
|
92
|
+
}
|
|
93
|
+
if (hiddenWaiter) skipLeadingLf = hiddenWaiter(chunk) === true;
|
|
94
|
+
else handleData(chunk);
|
|
95
|
+
};
|
|
96
|
+
wiredEnd = () => {
|
|
97
|
+
if (hiddenOnEnd) hiddenOnEnd();
|
|
98
|
+
else handleEnd();
|
|
99
|
+
};
|
|
100
|
+
stdin.on('data', wiredData);
|
|
101
|
+
stdin.once('end', wiredEnd);
|
|
102
|
+
stdin.resume();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Shift one buffered line, or null when the queue is empty. */
|
|
106
|
+
function takeLine(): string | null {
|
|
107
|
+
return lineBuffer.length > 0 ? lineBuffer.shift()! : null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Read a single line from stdin with normal echo. Honors an optional default. */
|
|
111
|
+
export function prompt(message: string, defaultValue?: string): Promise<string> {
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
attach();
|
|
114
|
+
process.stdin.resume();
|
|
115
|
+
const deliver = (line: string): void => {
|
|
116
|
+
const t = line.trim();
|
|
117
|
+
resolve(t.length ? t : (defaultValue ?? ''));
|
|
118
|
+
};
|
|
119
|
+
const buffered = takeLine();
|
|
120
|
+
if (buffered !== null) {
|
|
121
|
+
deliver(buffered);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (eof) {
|
|
125
|
+
deliver('');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
lineWaiters.push({ deliver });
|
|
129
|
+
process.stdout.write(defaultValue ? `${message} [${defaultValue}]: ` : `${message}: `);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Read a single line from stdin without echoing (for passwords / secrets). */
|
|
134
|
+
export function promptHidden(message: string): Promise<string> {
|
|
135
|
+
return new Promise((resolve) => {
|
|
136
|
+
attach();
|
|
137
|
+
process.stdin.resume();
|
|
138
|
+
// A line already framed by a paste/piped write satisfies the prompt
|
|
139
|
+
// without entering raw mode. Stars preserve the historical echo.
|
|
140
|
+
const buffered = takeLine();
|
|
141
|
+
if (buffered !== null) {
|
|
142
|
+
process.stdout.write(`${'*'.repeat(buffered.length)}\n`);
|
|
143
|
+
resolve(buffered);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (eof) {
|
|
147
|
+
process.stdout.write('\n');
|
|
148
|
+
resolve('');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const stdin = process.stdin;
|
|
152
|
+
const isTTY = typeof stdin.setRawMode === 'function';
|
|
153
|
+
let data = '';
|
|
154
|
+
const cleanup = (): void => {
|
|
155
|
+
if (isTTY) stdin.setRawMode(false);
|
|
156
|
+
stdin.pause();
|
|
157
|
+
hiddenWaiter = null;
|
|
158
|
+
hiddenOnEnd = null;
|
|
159
|
+
};
|
|
160
|
+
// Escape-sequence decoding state, carried across chunks: terminal control
|
|
161
|
+
// keys (arrows, Home, F1…) arrive as e.g. \x1b[A or \x1bOP — without
|
|
162
|
+
// decoding them, the printable bytes of the sequence would leak into the
|
|
163
|
+
// stored value.
|
|
164
|
+
let escaped = false;
|
|
165
|
+
let inCsi = false;
|
|
166
|
+
hiddenWaiter = (chunk: string) => {
|
|
167
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
168
|
+
const code = chunk.charCodeAt(i);
|
|
169
|
+
if (escaped) {
|
|
170
|
+
escaped = false;
|
|
171
|
+
if (code >= 32 && code <= 126) {
|
|
172
|
+
// '[' opens a CSI sequence; any other printable byte opens a
|
|
173
|
+
// two-byte SS3-style sequence (function keys). Swallow the whole
|
|
174
|
+
// sequence. A control byte instead means the bare Escape key was
|
|
175
|
+
// pressed — fall through so Enter/Ctrl-C still work.
|
|
176
|
+
if (code === 91) inCsi = true;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (inCsi) {
|
|
181
|
+
// CSI sequences end with a final byte in 0x40–0x7E.
|
|
182
|
+
if (code >= 64 && code <= 126) inCsi = false;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (code === 27) {
|
|
186
|
+
escaped = true;
|
|
187
|
+
} else if (code === 13 || code === 10) {
|
|
188
|
+
// Enter — deliver the hidden value; the rest of the chunk is the
|
|
189
|
+
// paste tail and must feed the line queue, not vanish (r024). A CRLF
|
|
190
|
+
// paste leaves a leading \n on that tail, which the framer would
|
|
191
|
+
// split into a spurious empty first line and shift every later
|
|
192
|
+
// answer — strip it here.
|
|
193
|
+
let rest = chunk.slice(i + 1);
|
|
194
|
+
if (code === 13 && rest.charCodeAt(0) === 10) rest = rest.slice(1);
|
|
195
|
+
cleanup();
|
|
196
|
+
process.stdout.write('\n');
|
|
197
|
+
resolve(data);
|
|
198
|
+
if (rest !== '') handleData(rest);
|
|
199
|
+
// Carry a split CRLF across chunks without queuing an empty answer.
|
|
200
|
+
return code === 13 && i === chunk.length - 1;
|
|
201
|
+
} else if (code === 3) {
|
|
202
|
+
// Ctrl-C: standard "interrupted" exit code (130 = 128 + SIGINT);
|
|
203
|
+
// cleanup first so raw mode is restored before exiting.
|
|
204
|
+
cleanup();
|
|
205
|
+
process.stdout.write('\n');
|
|
206
|
+
process.exit(130);
|
|
207
|
+
} else if (code === 127 || code === 8) {
|
|
208
|
+
// Backspace
|
|
209
|
+
if (data.length > 0) {
|
|
210
|
+
data = data.slice(0, -1);
|
|
211
|
+
process.stdout.write('\b \b');
|
|
212
|
+
}
|
|
213
|
+
} else if (code >= 32 && code !== 127) {
|
|
214
|
+
data += chunk[i]!;
|
|
215
|
+
process.stdout.write('*');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
hiddenOnEnd = (): void => {
|
|
220
|
+
// EOF (piped stdin): resolve with whatever was typed so far.
|
|
221
|
+
const typed = data;
|
|
222
|
+
const tail = pendingTail;
|
|
223
|
+
pendingTail = '';
|
|
224
|
+
cleanup();
|
|
225
|
+
eof = true;
|
|
226
|
+
if (typed !== '') {
|
|
227
|
+
process.stdout.write(`${'*'.repeat(typed.length)}\n`);
|
|
228
|
+
resolve(typed);
|
|
229
|
+
} else {
|
|
230
|
+
process.stdout.write('\n');
|
|
231
|
+
resolve('');
|
|
232
|
+
}
|
|
233
|
+
if (tail !== '') handleData(tail);
|
|
234
|
+
};
|
|
235
|
+
process.stdout.write(`${message}: `);
|
|
236
|
+
if (isTTY) stdin.setRawMode(true);
|
|
237
|
+
});
|
|
238
|
+
}
|