@zukhruf/docker 0.0.0-stage → 0.3.34
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 -0
- package/README.md +902 -2
- package/dist/api-version.d.ts +7 -0
- package/dist/api-version.d.ts.map +1 -0
- package/dist/api-version.js +22 -0
- package/dist/api-version.js.map +1 -0
- package/dist/container-process.d.ts +35 -0
- package/dist/container-process.d.ts.map +1 -0
- package/dist/container-process.js +91 -0
- package/dist/container-process.js.map +1 -0
- package/dist/containers.d.ts +160 -0
- package/dist/containers.d.ts.map +1 -0
- package/dist/containers.js +700 -0
- package/dist/containers.js.map +1 -0
- package/dist/context-store.d.ts +22 -0
- package/dist/context-store.d.ts.map +1 -0
- package/dist/context-store.js +128 -0
- package/dist/context-store.js.map +1 -0
- package/dist/docker.d.ts +57 -0
- package/dist/docker.d.ts.map +1 -0
- package/dist/docker.js +96 -0
- package/dist/docker.js.map +1 -0
- package/dist/engine-api.d.ts +390 -0
- package/dist/engine-api.d.ts.map +1 -0
- package/dist/engine-api.js +4 -0
- package/dist/engine-api.js.map +1 -0
- package/dist/engine-client.d.ts +74 -0
- package/dist/engine-client.d.ts.map +1 -0
- package/dist/engine-client.js +253 -0
- package/dist/engine-client.js.map +1 -0
- package/dist/errors.d.ts +133 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +214 -0
- package/dist/errors.js.map +1 -0
- package/dist/host.d.ts +13 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +22 -0
- package/dist/host.js.map +1 -0
- package/dist/images.d.ts +40 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +173 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/multiplexed-stream.d.ts +11 -0
- package/dist/multiplexed-stream.d.ts.map +1 -0
- package/dist/multiplexed-stream.js +81 -0
- package/dist/multiplexed-stream.js.map +1 -0
- package/dist/ndjson.d.ts +7 -0
- package/dist/ndjson.d.ts.map +1 -0
- package/dist/ndjson.js +21 -0
- package/dist/ndjson.js.map +1 -0
- package/dist/networks.d.ts +46 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +170 -0
- package/dist/networks.js.map +1 -0
- package/dist/options.d.ts +7 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -0
- package/dist/output.d.ts +18 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +21 -0
- package/dist/output.js.map +1 -0
- package/dist/progress.d.ts +9 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +20 -0
- package/dist/progress.js.map +1 -0
- package/dist/ssh-connection.d.ts +23 -0
- package/dist/ssh-connection.d.ts.map +1 -0
- package/dist/ssh-connection.js +225 -0
- package/dist/ssh-connection.js.map +1 -0
- package/dist/tar-reader.d.ts +22 -0
- package/dist/tar-reader.d.ts.map +1 -0
- package/dist/tar-reader.js +163 -0
- package/dist/tar-reader.js.map +1 -0
- package/dist/tar-writer.d.ts +16 -0
- package/dist/tar-writer.d.ts.map +1 -0
- package/dist/tar-writer.js +114 -0
- package/dist/tar-writer.js.map +1 -0
- package/dist/transport.d.ts +29 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +56 -0
- package/dist/transport.js.map +1 -0
- package/dist/volumes.d.ts +41 -0
- package/dist/volumes.d.ts.map +1 -0
- package/dist/volumes.js +119 -0
- package/dist/volumes.js.map +1 -0
- package/package.json +43 -4
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { setMaxListeners } from 'node:events';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { pipeline } from 'node:stream/promises';
|
|
4
|
+
import { ConnectionFailedError, DockerEngineError, DockerError, } from "./errors.js";
|
|
5
|
+
import { SshExitError } from "./ssh-connection.js";
|
|
6
|
+
/** The socket errors that mean the engine did not accept the connection. ENOENT is also an absent `ssh`. */
|
|
7
|
+
const CONNECTION_FAILURES = new Set([
|
|
8
|
+
'ENOENT',
|
|
9
|
+
'ECONNREFUSED',
|
|
10
|
+
'EPIPE',
|
|
11
|
+
'ECONNRESET',
|
|
12
|
+
]);
|
|
13
|
+
function errorCode(error) {
|
|
14
|
+
return error instanceof Error &&
|
|
15
|
+
'code' in error &&
|
|
16
|
+
typeof error.code === 'string'
|
|
17
|
+
? error.code
|
|
18
|
+
: undefined;
|
|
19
|
+
}
|
|
20
|
+
function search(query) {
|
|
21
|
+
const parameters = new URLSearchParams();
|
|
22
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
23
|
+
if (value === undefined)
|
|
24
|
+
continue;
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
for (const each of value)
|
|
27
|
+
parameters.append(key, each);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
parameters.set(key, typeof value === 'object' ? JSON.stringify(value) : String(value));
|
|
31
|
+
}
|
|
32
|
+
const text = parameters.toString();
|
|
33
|
+
return text ? `?${text}` : '';
|
|
34
|
+
}
|
|
35
|
+
/** The message of an error answer of the engine: {"message": "..."}, or the text itself. */
|
|
36
|
+
function engineMessage(response) {
|
|
37
|
+
const text = response.body.toString('utf8');
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(text);
|
|
40
|
+
const message = Reflect.get(Object(parsed), 'message');
|
|
41
|
+
if (typeof message === 'string')
|
|
42
|
+
return message;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// The answer is not JSON: its text is the message.
|
|
46
|
+
}
|
|
47
|
+
return text.trim();
|
|
48
|
+
}
|
|
49
|
+
/** True for a 2xx status. */
|
|
50
|
+
export function isSuccess(response) {
|
|
51
|
+
return response.status >= 200 && response.status <= 299;
|
|
52
|
+
}
|
|
53
|
+
/** The JSON body of an answer. */
|
|
54
|
+
export function parseBody(response) {
|
|
55
|
+
const body = JSON.parse(response.body.toString('utf8'));
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
async function readAll(response) {
|
|
59
|
+
const chunks = [];
|
|
60
|
+
for await (const chunk of response)
|
|
61
|
+
chunks.push(Buffer.from(chunk));
|
|
62
|
+
return Buffer.concat(chunks);
|
|
63
|
+
}
|
|
64
|
+
/** Sends requests of the Engine API to one engine. */
|
|
65
|
+
export class EngineClient {
|
|
66
|
+
#host;
|
|
67
|
+
#transport;
|
|
68
|
+
#apiVersion;
|
|
69
|
+
/**
|
|
70
|
+
* The bodies of streamed answers and the hijacked connections that are
|
|
71
|
+
* open. After an upgrade, the agent of the transport no longer has the
|
|
72
|
+
* socket, so only this set lets close() reach it.
|
|
73
|
+
*/
|
|
74
|
+
#streams;
|
|
75
|
+
/** Aborts when close() starts. Its reason is the DockerError of the disposal. */
|
|
76
|
+
#disposal;
|
|
77
|
+
constructor(host, transport, apiVersion, streams = new Set(), disposal = new AbortController()) {
|
|
78
|
+
this.#host = host;
|
|
79
|
+
this.#transport = transport;
|
|
80
|
+
this.#apiVersion = apiVersion;
|
|
81
|
+
this.#streams = streams;
|
|
82
|
+
this.#disposal = disposal;
|
|
83
|
+
// Each request in flight listens to the disposal, so many concurrent requests are not a leak.
|
|
84
|
+
setMaxListeners(0, disposal.signal);
|
|
85
|
+
}
|
|
86
|
+
/** The same engine and connections, with the API version in the path of each request. */
|
|
87
|
+
versioned(apiVersion) {
|
|
88
|
+
return new EngineClient(this.#host, this.#transport, apiVersion, this.#streams, this.#disposal);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Closes each connection, and resolves when each one is closed. A request
|
|
92
|
+
* in flight, a request that starts after close() started, and an iteration
|
|
93
|
+
* of a stream that is open reject with a DockerError that says that the
|
|
94
|
+
* client was disposed.
|
|
95
|
+
*/
|
|
96
|
+
async close() {
|
|
97
|
+
const error = new DockerError('The client was disposed, so it closed this connection to the engine.');
|
|
98
|
+
this.#disposal.abort(error);
|
|
99
|
+
for (const stream of this.#streams)
|
|
100
|
+
stream.destroy(error);
|
|
101
|
+
this.#streams.clear();
|
|
102
|
+
await this.#transport.close();
|
|
103
|
+
}
|
|
104
|
+
#hold(stream) {
|
|
105
|
+
this.#streams.add(stream);
|
|
106
|
+
stream.once('close', () => this.#streams.delete(stream));
|
|
107
|
+
}
|
|
108
|
+
/** Sends a request. A status that is not 2xx rejects with DockerEngineError. */
|
|
109
|
+
async request(method, path, options = {}) {
|
|
110
|
+
const response = await this.exchange(method, path, options);
|
|
111
|
+
if (!isSuccess(response))
|
|
112
|
+
throw this.error(response, method, path);
|
|
113
|
+
return response;
|
|
114
|
+
}
|
|
115
|
+
/** Sends a request and gives its JSON body. */
|
|
116
|
+
async json(method, path, options = {}) {
|
|
117
|
+
return parseBody(await this.request(method, path, options));
|
|
118
|
+
}
|
|
119
|
+
/** Sends a request and gives the answer with each status. */
|
|
120
|
+
async exchange(method, path, options = {}) {
|
|
121
|
+
const { response } = await this.#open(method, path, options);
|
|
122
|
+
return {
|
|
123
|
+
status: response.statusCode ?? 0,
|
|
124
|
+
headers: response.headers,
|
|
125
|
+
body: await readAll(response),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Sends a request and gives the body of a 2xx answer as it comes. An abort
|
|
130
|
+
* of the signal rejects the read of the body with its reason. Each other
|
|
131
|
+
* status rejects with DockerEngineError.
|
|
132
|
+
*/
|
|
133
|
+
async stream(method, path, options = {}) {
|
|
134
|
+
const { response } = await this.#open(method, path, options);
|
|
135
|
+
const status = response.statusCode ?? 0;
|
|
136
|
+
if (status >= 200 && status <= 299) {
|
|
137
|
+
this.#hold(response);
|
|
138
|
+
return response;
|
|
139
|
+
}
|
|
140
|
+
const body = await readAll(response);
|
|
141
|
+
throw this.error({ status, headers: response.headers, body }, method, path);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Sends a request that the engine upgrades to a hijacked connection, for an
|
|
145
|
+
* attach and for the start of an exec. An answer without an upgrade
|
|
146
|
+
* rejects with DockerEngineError.
|
|
147
|
+
*/
|
|
148
|
+
async hijack(method, path, options = {}) {
|
|
149
|
+
const { response, upgrade } = await this.#open(method, path, {
|
|
150
|
+
...options,
|
|
151
|
+
headers: { ...options.headers, Connection: 'Upgrade', Upgrade: 'tcp' },
|
|
152
|
+
}, true);
|
|
153
|
+
if (upgrade === undefined) {
|
|
154
|
+
const body = await readAll(response);
|
|
155
|
+
throw this.error({ status: response.statusCode ?? 0, headers: response.headers, body }, method, path);
|
|
156
|
+
}
|
|
157
|
+
const { socket, head } = upgrade;
|
|
158
|
+
this.#hold(socket);
|
|
159
|
+
const transport = this.#transport;
|
|
160
|
+
return {
|
|
161
|
+
socket,
|
|
162
|
+
head,
|
|
163
|
+
contentType: response.headers['content-type'] ?? '',
|
|
164
|
+
endInput: () => transport.endInput(socket),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** The DockerEngineError of an answer that is not 2xx. */
|
|
168
|
+
error(response, method, path) {
|
|
169
|
+
return new DockerEngineError(engineMessage(response), {
|
|
170
|
+
status: response.status,
|
|
171
|
+
request: { method, path },
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async #open(method, path, { query, body, content, headers, signal }, upgrades = false) {
|
|
175
|
+
signal?.throwIfAborted();
|
|
176
|
+
const disposal = this.#disposal.signal;
|
|
177
|
+
disposal.throwIfAborted();
|
|
178
|
+
const prefix = this.#apiVersion === undefined ? '' : `/v${this.#apiVersion}`;
|
|
179
|
+
const payload = body === undefined
|
|
180
|
+
? content?.data
|
|
181
|
+
: new TextEncoder().encode(JSON.stringify(body));
|
|
182
|
+
const contentType = body === undefined ? content?.type : 'application/json';
|
|
183
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
184
|
+
const request = this.#transport.request({
|
|
185
|
+
method,
|
|
186
|
+
path: `${prefix}${path}${search(query)}`,
|
|
187
|
+
headers: {
|
|
188
|
+
...headers,
|
|
189
|
+
...(contentType === undefined ? {} : { 'Content-Type': contentType }),
|
|
190
|
+
...(payload instanceof Uint8Array
|
|
191
|
+
? { 'Content-Length': payload.byteLength }
|
|
192
|
+
: {}),
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
const responses = [];
|
|
196
|
+
const abort = () => {
|
|
197
|
+
reject(signal?.reason);
|
|
198
|
+
request.destroy();
|
|
199
|
+
for (const response of responses)
|
|
200
|
+
response.destroy(signal?.reason);
|
|
201
|
+
};
|
|
202
|
+
// The disposal ends the exchange as an abort of the signal does, with the DockerError of the disposal.
|
|
203
|
+
const dispose = () => {
|
|
204
|
+
reject(disposal.reason);
|
|
205
|
+
request.destroy();
|
|
206
|
+
for (const response of responses)
|
|
207
|
+
response.destroy(disposal.reason);
|
|
208
|
+
};
|
|
209
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
210
|
+
disposal.addEventListener('abort', dispose, { once: true });
|
|
211
|
+
const release = () => {
|
|
212
|
+
signal?.removeEventListener('abort', abort);
|
|
213
|
+
disposal.removeEventListener('abort', dispose);
|
|
214
|
+
};
|
|
215
|
+
request.on('error', (error) => {
|
|
216
|
+
// An error after the answer started is not a connection failure.
|
|
217
|
+
reject(responses.length === 0 &&
|
|
218
|
+
(error instanceof SshExitError ||
|
|
219
|
+
CONNECTION_FAILURES.has(errorCode(error) ?? ''))
|
|
220
|
+
? new ConnectionFailedError(this.#host, { cause: error })
|
|
221
|
+
: error);
|
|
222
|
+
});
|
|
223
|
+
request.on('response', (response) => {
|
|
224
|
+
responses.push(response);
|
|
225
|
+
response.once('close', release);
|
|
226
|
+
resolve({ response });
|
|
227
|
+
});
|
|
228
|
+
if (upgrades) {
|
|
229
|
+
// The caller owns the socket after the upgrade, and its signal too.
|
|
230
|
+
request.on('upgrade', (response, socket, head) => {
|
|
231
|
+
release();
|
|
232
|
+
resolve({ response, upgrade: { socket, head } });
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (payload === undefined || payload instanceof Uint8Array) {
|
|
236
|
+
request.end(payload);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
// A body that comes as a stream goes with chunked encoding, at the pace of the connection.
|
|
240
|
+
pipeline(Readable.from(payload), request).catch((error) => {
|
|
241
|
+
request.destroy(error instanceof Error ? error : undefined);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
return await promise;
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
release();
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=engine-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-client.js","sourceRoot":"","sources":["../src/engine-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA2CnD,4GAA4G;AAC5G,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,cAAc;IACd,OAAO;IACP,YAAY;CACb,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK;QAC3B,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,CAAC,KAAK,CAAC,IAAI;QACZ,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,KAAwB;IACtC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAA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C;YACb,oEAAoE;YACpE,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;gBAC/C,OAAO,EAAE,CAAC;gBACV,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,YAAY,UAAU,EAAE,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,2FAA2F;YAC3F,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACjE,OAAO,CAAC,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,CAAC;YACV,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** The base of every error of the package. */
|
|
2
|
+
export declare class DockerError extends Error {
|
|
3
|
+
constructor(message: string, options?: ErrorOptions);
|
|
4
|
+
}
|
|
5
|
+
/** The engine did not accept the connection: its socket does not exist, or it refuses the connection. */
|
|
6
|
+
export declare class ConnectionFailedError extends DockerError {
|
|
7
|
+
readonly host: string;
|
|
8
|
+
constructor(host: string, options?: ErrorOptions);
|
|
9
|
+
}
|
|
10
|
+
/** The host is not unix://, npipe:// or ssh://. */
|
|
11
|
+
export declare class UnsupportedHostError extends DockerError {
|
|
12
|
+
readonly host: string;
|
|
13
|
+
constructor(host: string);
|
|
14
|
+
}
|
|
15
|
+
/** The context store does not have the context. */
|
|
16
|
+
export declare class ContextNotFoundError extends DockerError {
|
|
17
|
+
readonly context: string;
|
|
18
|
+
constructor(context: string, options?: ErrorOptions);
|
|
19
|
+
}
|
|
20
|
+
/** The highest API version of the engine is lower than the lowest one that the package supports. */
|
|
21
|
+
export declare class UnsupportedEngineError extends DockerError {
|
|
22
|
+
readonly host: string;
|
|
23
|
+
/** The highest API version of the engine. */
|
|
24
|
+
readonly engineVersion: string;
|
|
25
|
+
/** The lowest API version that the package supports. */
|
|
26
|
+
readonly minimumVersion: string;
|
|
27
|
+
constructor(host: string, engineVersion: string, minimumVersion: string);
|
|
28
|
+
}
|
|
29
|
+
/** The method and the path of a request of the Engine API, without the API version and the query. */
|
|
30
|
+
export interface EngineRequest {
|
|
31
|
+
readonly method: string;
|
|
32
|
+
readonly path: string;
|
|
33
|
+
}
|
|
34
|
+
/** The answer that is an error: its status and the request that got it. A DockerEngineError is one too. */
|
|
35
|
+
export interface EngineAnswer {
|
|
36
|
+
/** The HTTP status; undefined for an error in the progress of a pull, a push or a load. */
|
|
37
|
+
readonly status: number | undefined;
|
|
38
|
+
readonly request: EngineRequest;
|
|
39
|
+
}
|
|
40
|
+
/** The base of every answer of the engine that is an error. Its message is the message of the engine. */
|
|
41
|
+
export declare class DockerEngineError extends DockerError {
|
|
42
|
+
/** The HTTP status; undefined for an error in the progress of a pull, a push or a load. */
|
|
43
|
+
readonly status: number | undefined;
|
|
44
|
+
/** The request that got the error. */
|
|
45
|
+
readonly request: EngineRequest;
|
|
46
|
+
constructor(message: string, answer: EngineAnswer, options?: ErrorOptions);
|
|
47
|
+
}
|
|
48
|
+
/** A request about a container got 404. */
|
|
49
|
+
export declare class ContainerNotFoundError extends DockerEngineError {
|
|
50
|
+
readonly container: string;
|
|
51
|
+
constructor(message: string, answer: EngineAnswer, container: string, options?: ErrorOptions);
|
|
52
|
+
}
|
|
53
|
+
/** An exec or a kill got 409, or an attach found the container exited or paused. */
|
|
54
|
+
export declare class ContainerNotRunningError extends DockerEngineError {
|
|
55
|
+
readonly container: string;
|
|
56
|
+
/** From an inspect after the 409: 'created', 'exited', 'paused', 'restarting', 'removing' or 'dead'. */
|
|
57
|
+
readonly state: string;
|
|
58
|
+
constructor(message: string, answer: EngineAnswer, container: string, state: string, options?: ErrorOptions);
|
|
59
|
+
}
|
|
60
|
+
/** A create of a container, network or volume found the name taken. */
|
|
61
|
+
export declare class NameConflictError extends DockerEngineError {
|
|
62
|
+
readonly kind: 'container' | 'network' | 'volume';
|
|
63
|
+
/** The name that another resource has. Not `name`: that is the name of the error class. */
|
|
64
|
+
readonly takenName: string;
|
|
65
|
+
constructor(message: string, answer: EngineAnswer, kind: 'container' | 'network' | 'volume', takenName: string, options?: ErrorOptions);
|
|
66
|
+
}
|
|
67
|
+
/** A removal without `force` got 409, and an inspect showed that the container runs. */
|
|
68
|
+
export declare class ContainerRunningError extends DockerEngineError {
|
|
69
|
+
readonly container: string;
|
|
70
|
+
constructor(message: string, answer: EngineAnswer, container: string, options?: ErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
/** A create got 404 and the image is not on the engine, a pull got 404, or a push found no image of the reference on the engine. */
|
|
73
|
+
export declare class ImageNotFoundError extends DockerEngineError {
|
|
74
|
+
readonly image: string;
|
|
75
|
+
constructor(message: string, answer: EngineAnswer, image: string, options?: ErrorOptions);
|
|
76
|
+
}
|
|
77
|
+
/** A start got 404 while the container exists, and a lookup of its networks found one missing; or a request about a network got 404. */
|
|
78
|
+
export declare class NetworkNotFoundError extends DockerEngineError {
|
|
79
|
+
readonly network: string;
|
|
80
|
+
constructor(message: string, answer: EngineAnswer, network: string, options?: ErrorOptions);
|
|
81
|
+
}
|
|
82
|
+
/** A request about a volume got 404. */
|
|
83
|
+
export declare class VolumeNotFoundError extends DockerEngineError {
|
|
84
|
+
readonly volume: string;
|
|
85
|
+
constructor(message: string, answer: EngineAnswer, volume: string, options?: ErrorOptions);
|
|
86
|
+
}
|
|
87
|
+
/** A volume removal got 409: a container uses the volume. */
|
|
88
|
+
export declare class VolumeInUseError extends DockerEngineError {
|
|
89
|
+
readonly volume: string;
|
|
90
|
+
constructor(message: string, answer: EngineAnswer, volume: string, options?: ErrorOptions);
|
|
91
|
+
}
|
|
92
|
+
/** A network removal got 403 while containers are connected. */
|
|
93
|
+
export declare class NetworkInUseError extends DockerEngineError {
|
|
94
|
+
readonly network: string;
|
|
95
|
+
/** The IDs of the connected containers, from an inspect after the 403. */
|
|
96
|
+
readonly containers: string[];
|
|
97
|
+
constructor(message: string, answer: EngineAnswer, network: string, containers: string[], options?: ErrorOptions);
|
|
98
|
+
}
|
|
99
|
+
/** An image removal got 409. */
|
|
100
|
+
export declare class ImageInUseError extends DockerEngineError {
|
|
101
|
+
readonly image: string;
|
|
102
|
+
constructor(message: string, answer: EngineAnswer, image: string, options?: ErrorOptions);
|
|
103
|
+
}
|
|
104
|
+
/** A create or a start refused a bind mount whose source does not exist on the host of the engine. */
|
|
105
|
+
export declare class BindSourceNotFoundError extends DockerEngineError {
|
|
106
|
+
/** The path on the host of the engine. */
|
|
107
|
+
readonly source: string;
|
|
108
|
+
constructor(message: string, answer: EngineAnswer, source: string, options?: ErrorOptions);
|
|
109
|
+
}
|
|
110
|
+
/** A file request got 404, and the container exists. */
|
|
111
|
+
export declare class PathNotFoundError extends DockerEngineError {
|
|
112
|
+
readonly container: string;
|
|
113
|
+
/** The path in the container. */
|
|
114
|
+
readonly path: string;
|
|
115
|
+
constructor(message: string, answer: EngineAnswer, container: string, path: string, options?: ErrorOptions);
|
|
116
|
+
}
|
|
117
|
+
/** readFile() found a directory, a link or another kind of entry. */
|
|
118
|
+
export declare class NotAFileError extends DockerEngineError {
|
|
119
|
+
readonly container: string;
|
|
120
|
+
/** The path in the container. */
|
|
121
|
+
readonly path: string;
|
|
122
|
+
/** The kind of the entry: 'directory', 'symlink', 'link' or 'other'. */
|
|
123
|
+
readonly kind: 'directory' | 'symlink' | 'link' | 'other';
|
|
124
|
+
constructor(message: string, answer: EngineAnswer, container: string, path: string, kind: 'directory' | 'symlink' | 'link' | 'other', options?: ErrorOptions);
|
|
125
|
+
}
|
|
126
|
+
/** The engine refused an extraction, and an inspect showed that the directory is on a read-only root filesystem or in a read-only mount. */
|
|
127
|
+
export declare class ReadOnlyPathError extends DockerEngineError {
|
|
128
|
+
readonly container: string;
|
|
129
|
+
/** The path in the container. */
|
|
130
|
+
readonly path: string;
|
|
131
|
+
constructor(message: string, answer: EngineAnswer, container: string, path: string, options?: ErrorOptions);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,yGAAyG;AACzG,qBAAa,qBAAsB,SAAQ,WAAW;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKjD;AAED,mDAAmD;AACnD,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAOzB;AAED,mDAAmD;AACnD,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAQpD;AAED,oGAAoG;AACpG,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B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AAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;gBAGxD,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,EAChD,OAAO,CAAC,EAAE,YAAY;CAQzB;AAED,4IAA4I;AAC5I,qBAAa,iBAAkB,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAGpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY;CAOzB"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/** The base of every error of the package. */
|
|
2
|
+
export class DockerError extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = 'DockerError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** The engine did not accept the connection: its socket does not exist, or it refuses the connection. */
|
|
9
|
+
export class ConnectionFailedError extends DockerError {
|
|
10
|
+
host;
|
|
11
|
+
constructor(host, options) {
|
|
12
|
+
super(`Cannot connect to the engine at ${host}.`, options);
|
|
13
|
+
this.name = 'ConnectionFailedError';
|
|
14
|
+
this.host = host;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** The host is not unix://, npipe:// or ssh://. */
|
|
18
|
+
export class UnsupportedHostError extends DockerError {
|
|
19
|
+
host;
|
|
20
|
+
constructor(host) {
|
|
21
|
+
super(`The host ${JSON.stringify(host)} is not supported: use a unix://, npipe:// or ssh:// host.`);
|
|
22
|
+
this.name = 'UnsupportedHostError';
|
|
23
|
+
this.host = host;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** The context store does not have the context. */
|
|
27
|
+
export class ContextNotFoundError extends DockerError {
|
|
28
|
+
context;
|
|
29
|
+
constructor(context, options) {
|
|
30
|
+
super(`The context store does not have the context ${JSON.stringify(context)}.`, options);
|
|
31
|
+
this.name = 'ContextNotFoundError';
|
|
32
|
+
this.context = context;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** The highest API version of the engine is lower than the lowest one that the package supports. */
|
|
36
|
+
export class UnsupportedEngineError extends DockerError {
|
|
37
|
+
host;
|
|
38
|
+
/** The highest API version of the engine. */
|
|
39
|
+
engineVersion;
|
|
40
|
+
/** The lowest API version that the package supports. */
|
|
41
|
+
minimumVersion;
|
|
42
|
+
constructor(host, engineVersion, minimumVersion) {
|
|
43
|
+
super(`The engine at ${host} has API version ${engineVersion}, but the package needs ${minimumVersion} or higher. Update Docker.`);
|
|
44
|
+
this.name = 'UnsupportedEngineError';
|
|
45
|
+
this.host = host;
|
|
46
|
+
this.engineVersion = engineVersion;
|
|
47
|
+
this.minimumVersion = minimumVersion;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The base of every answer of the engine that is an error. Its message is the message of the engine. */
|
|
51
|
+
export class DockerEngineError extends DockerError {
|
|
52
|
+
/** The HTTP status; undefined for an error in the progress of a pull, a push or a load. */
|
|
53
|
+
status;
|
|
54
|
+
/** The request that got the error. */
|
|
55
|
+
request;
|
|
56
|
+
constructor(message, answer, options) {
|
|
57
|
+
super(message, options);
|
|
58
|
+
this.name = 'DockerEngineError';
|
|
59
|
+
this.status = answer.status;
|
|
60
|
+
this.request = Object.freeze({
|
|
61
|
+
method: answer.request.method,
|
|
62
|
+
path: answer.request.path,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** A request about a container got 404. */
|
|
67
|
+
export class ContainerNotFoundError extends DockerEngineError {
|
|
68
|
+
container;
|
|
69
|
+
constructor(message, answer, container, options) {
|
|
70
|
+
super(message, answer, options);
|
|
71
|
+
this.name = 'ContainerNotFoundError';
|
|
72
|
+
this.container = container;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** An exec or a kill got 409, or an attach found the container exited or paused. */
|
|
76
|
+
export class ContainerNotRunningError extends DockerEngineError {
|
|
77
|
+
container;
|
|
78
|
+
/** From an inspect after the 409: 'created', 'exited', 'paused', 'restarting', 'removing' or 'dead'. */
|
|
79
|
+
state;
|
|
80
|
+
constructor(message, answer, container, state, options) {
|
|
81
|
+
super(message, answer, options);
|
|
82
|
+
this.name = 'ContainerNotRunningError';
|
|
83
|
+
this.container = container;
|
|
84
|
+
this.state = state;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** A create of a container, network or volume found the name taken. */
|
|
88
|
+
export class NameConflictError extends DockerEngineError {
|
|
89
|
+
kind;
|
|
90
|
+
/** The name that another resource has. Not `name`: that is the name of the error class. */
|
|
91
|
+
takenName;
|
|
92
|
+
constructor(message, answer, kind, takenName, options) {
|
|
93
|
+
super(message, answer, options);
|
|
94
|
+
this.name = 'NameConflictError';
|
|
95
|
+
this.kind = kind;
|
|
96
|
+
this.takenName = takenName;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** A removal without `force` got 409, and an inspect showed that the container runs. */
|
|
100
|
+
export class ContainerRunningError extends DockerEngineError {
|
|
101
|
+
container;
|
|
102
|
+
constructor(message, answer, container, options) {
|
|
103
|
+
super(message, answer, options);
|
|
104
|
+
this.name = 'ContainerRunningError';
|
|
105
|
+
this.container = container;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** A create got 404 and the image is not on the engine, a pull got 404, or a push found no image of the reference on the engine. */
|
|
109
|
+
export class ImageNotFoundError extends DockerEngineError {
|
|
110
|
+
image;
|
|
111
|
+
constructor(message, answer, image, options) {
|
|
112
|
+
super(message, answer, options);
|
|
113
|
+
this.name = 'ImageNotFoundError';
|
|
114
|
+
this.image = image;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** A start got 404 while the container exists, and a lookup of its networks found one missing; or a request about a network got 404. */
|
|
118
|
+
export class NetworkNotFoundError extends DockerEngineError {
|
|
119
|
+
network;
|
|
120
|
+
constructor(message, answer, network, options) {
|
|
121
|
+
super(message, answer, options);
|
|
122
|
+
this.name = 'NetworkNotFoundError';
|
|
123
|
+
this.network = network;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** A request about a volume got 404. */
|
|
127
|
+
export class VolumeNotFoundError extends DockerEngineError {
|
|
128
|
+
volume;
|
|
129
|
+
constructor(message, answer, volume, options) {
|
|
130
|
+
super(message, answer, options);
|
|
131
|
+
this.name = 'VolumeNotFoundError';
|
|
132
|
+
this.volume = volume;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** A volume removal got 409: a container uses the volume. */
|
|
136
|
+
export class VolumeInUseError extends DockerEngineError {
|
|
137
|
+
volume;
|
|
138
|
+
constructor(message, answer, volume, options) {
|
|
139
|
+
super(message, answer, options);
|
|
140
|
+
this.name = 'VolumeInUseError';
|
|
141
|
+
this.volume = volume;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** A network removal got 403 while containers are connected. */
|
|
145
|
+
export class NetworkInUseError extends DockerEngineError {
|
|
146
|
+
network;
|
|
147
|
+
/** The IDs of the connected containers, from an inspect after the 403. */
|
|
148
|
+
containers;
|
|
149
|
+
constructor(message, answer, network, containers, options) {
|
|
150
|
+
super(message, answer, options);
|
|
151
|
+
this.name = 'NetworkInUseError';
|
|
152
|
+
this.network = network;
|
|
153
|
+
this.containers = containers;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/** An image removal got 409. */
|
|
157
|
+
export class ImageInUseError extends DockerEngineError {
|
|
158
|
+
image;
|
|
159
|
+
constructor(message, answer, image, options) {
|
|
160
|
+
super(message, answer, options);
|
|
161
|
+
this.name = 'ImageInUseError';
|
|
162
|
+
this.image = image;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** A create or a start refused a bind mount whose source does not exist on the host of the engine. */
|
|
166
|
+
export class BindSourceNotFoundError extends DockerEngineError {
|
|
167
|
+
/** The path on the host of the engine. */
|
|
168
|
+
source;
|
|
169
|
+
constructor(message, answer, source, options) {
|
|
170
|
+
super(message, answer, options);
|
|
171
|
+
this.name = 'BindSourceNotFoundError';
|
|
172
|
+
this.source = source;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/** A file request got 404, and the container exists. */
|
|
176
|
+
export class PathNotFoundError extends DockerEngineError {
|
|
177
|
+
container;
|
|
178
|
+
/** The path in the container. */
|
|
179
|
+
path;
|
|
180
|
+
constructor(message, answer, container, path, options) {
|
|
181
|
+
super(message, answer, options);
|
|
182
|
+
this.name = 'PathNotFoundError';
|
|
183
|
+
this.container = container;
|
|
184
|
+
this.path = path;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/** readFile() found a directory, a link or another kind of entry. */
|
|
188
|
+
export class NotAFileError extends DockerEngineError {
|
|
189
|
+
container;
|
|
190
|
+
/** The path in the container. */
|
|
191
|
+
path;
|
|
192
|
+
/** The kind of the entry: 'directory', 'symlink', 'link' or 'other'. */
|
|
193
|
+
kind;
|
|
194
|
+
constructor(message, answer, container, path, kind, options) {
|
|
195
|
+
super(message, answer, options);
|
|
196
|
+
this.name = 'NotAFileError';
|
|
197
|
+
this.container = container;
|
|
198
|
+
this.path = path;
|
|
199
|
+
this.kind = kind;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** The engine refused an extraction, and an inspect showed that the directory is on a read-only root filesystem or in a read-only mount. */
|
|
203
|
+
export class ReadOnlyPathError extends DockerEngineError {
|
|
204
|
+
container;
|
|
205
|
+
/** The path in the container. */
|
|
206
|
+
path;
|
|
207
|
+
constructor(message, answer, container, path, options) {
|
|
208
|
+
super(message, answer, options);
|
|
209
|
+
this.name = 'ReadOnlyPathError';
|
|
210
|
+
this.container = container;
|
|
211
|
+
this.path = path;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,yGAAyG;AACzG,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IAC3C,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,mCAAmC,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,mDAAmD;AACnD,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAC1C,IAAI,CAAS;IAEtB,YAAY,IAAY;QACtB,KAAK,CACH,YAAY,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,4DAA4D,CAC7F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,mDAAmD;AACnD,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAC1C,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CACH,+CAA+C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EACzE,OAAO,CACR,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB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ACzC,SAAS,CAAS;IAC3B,iCAAiC;IACxB,IAAI,CAAS;IACtB,wEAAwE;IAC/D,IAAI,CAA6C;IAE1D,YACE,OAAe,EACf,MAAoB,EACpB,SAAiB,EACjB,IAAY,EACZ,IAAgD,EAChD,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,4IAA4I;AAC5I,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAC7C,SAAS,CAAS;IAC3B,iCAAiC;IACxB,IAAI,CAAS;IAEtB,YACE,OAAe,EACf,MAAoB,EACpB,SAAiB,EACjB,IAAY,EACZ,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A host, parsed by its kind. */
|
|
2
|
+
export type ParsedHost = {
|
|
3
|
+
kind: 'unix' | 'npipe';
|
|
4
|
+
host: string;
|
|
5
|
+
socketPath: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'ssh';
|
|
8
|
+
host: string;
|
|
9
|
+
url: URL;
|
|
10
|
+
};
|
|
11
|
+
/** Parses a unix://, npipe:// or ssh:// host. Each other host is an UnsupportedHostError. */
|
|
12
|
+
export declare function parseHost(host: string): ParsedHost;
|
|
13
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAE5C,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAalD"}
|