@preevy/compose-tunnel-agent
Advanced tools
Comparing version 0.0.10 to 0.0.15
@@ -1,2 +0,2 @@ | ||
export { checkConnection, formatPublicKey, parseKey, parseSshUrl, keyFingerprint, formatSshConnectionConfig } from './src/ssh'; | ||
export type { ConnectionCheckResult, SshConnectionConfig } from './src/ssh'; | ||
export { checkConnection, formatPublicKey, parseKey, parseSshUrl, keyFingerprint, formatSshConnectionConfig, ConnectionCheckResult, SshConnectionConfig, } from './src/ssh'; | ||
export { simpleEmitter, stateEmitter, SimpleEmitter, StateEmitter, EmitterConsumer, StateEmitterConsumer, } from './src/emitter'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatSshConnectionConfig = exports.keyFingerprint = exports.parseSshUrl = exports.parseKey = exports.formatPublicKey = exports.checkConnection = void 0; | ||
exports.stateEmitter = exports.simpleEmitter = exports.formatSshConnectionConfig = exports.keyFingerprint = exports.parseSshUrl = exports.parseKey = exports.formatPublicKey = exports.checkConnection = void 0; | ||
var ssh_1 = require("./src/ssh"); | ||
@@ -11,2 +11,5 @@ Object.defineProperty(exports, "checkConnection", { enumerable: true, get: function () { return ssh_1.checkConnection; } }); | ||
Object.defineProperty(exports, "formatSshConnectionConfig", { enumerable: true, get: function () { return ssh_1.formatSshConnectionConfig; } }); | ||
var emitter_1 = require("./src/emitter"); | ||
Object.defineProperty(exports, "simpleEmitter", { enumerable: true, get: function () { return emitter_1.simpleEmitter; } }); | ||
Object.defineProperty(exports, "stateEmitter", { enumerable: true, get: function () { return emitter_1.stateEmitter; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -20,4 +20,5 @@ "use strict"; | ||
const readDir = async (dir) => { | ||
var _a; | ||
try { | ||
return ((await fs_1.default.promises.readdir(dir, { withFileTypes: true })) ?? []) | ||
return ((_a = (await fs_1.default.promises.readdir(dir, { withFileTypes: true }))) !== null && _a !== void 0 ? _a : []) | ||
.filter(d => d.isFile()).map(f => f.name); | ||
@@ -37,2 +38,3 @@ } | ||
const sshConnectionConfigFromEnv = async () => { | ||
var _a; | ||
const sshUrl = (0, env_1.requiredEnv)('SSH_URL'); | ||
@@ -47,3 +49,3 @@ const parsed = (0, ssh_1.parseSshUrl)(sshUrl); | ||
clientPrivateKey, | ||
username: process.env.USER ?? 'foo', | ||
username: (_a = process.env.USER) !== null && _a !== void 0 ? _a : 'foo', | ||
knownServerPublicKeys, | ||
@@ -66,2 +68,3 @@ insecureSkipVerify: Boolean(process.env.INSECURE_SKIP_VERIFY), | ||
const main = async () => { | ||
var _a; | ||
const log = (0, pino_1.default)({ | ||
@@ -107,3 +110,3 @@ level: process.env.DEBUG || process.env.DOCKER_PROXY_DEBUG ? 'debug' : 'info', | ||
}) | ||
.listen(process.env.PORT ?? 3000, () => { | ||
.listen((_a = process.env.PORT) !== null && _a !== void 0 ? _a : 3000, () => { | ||
log.info(`listening on ${(0, node_util_1.inspect)(webServer.address())}`); | ||
@@ -110,0 +113,0 @@ }) |
@@ -57,3 +57,3 @@ "use strict"; | ||
stream.stdout.on('data', (data) => { | ||
log.debug('got data %j', data?.toString()); | ||
log.debug('got data %j', data === null || data === void 0 ? void 0 : data.toString()); | ||
buf = Buffer.concat([buf, data]); | ||
@@ -76,3 +76,3 @@ const obj = (0, json_1.tryParseJson)(buf.toString()); | ||
|| isTls; | ||
onHostKey?.(key, isVerified); | ||
onHostKey === null || onHostKey === void 0 ? void 0 : onHostKey(key, isVerified); | ||
return isVerified; | ||
@@ -84,3 +84,3 @@ }; | ||
reject(err); | ||
onError?.(err); | ||
onError === null || onError === void 0 ? void 0 : onError(err); | ||
}); | ||
@@ -87,0 +87,0 @@ ssh.connect({ |
@@ -41,3 +41,3 @@ "use strict"; | ||
}); | ||
ssh.on('close', () => onError?.(new Error('ssh connection closed'))); | ||
ssh.on('close', () => onError === null || onError === void 0 ? void 0 : onError(new Error('ssh connection closed'))); | ||
const existingForwards = new Map(); | ||
@@ -101,2 +101,3 @@ const forwardKey = (socketPath) => socketPath.replace(/^\//, ''); | ||
.reduce((res, { socketPath, url }) => { | ||
var _a, _b; | ||
const key = forwardKey(socketPath); | ||
@@ -108,7 +109,7 @@ const forward = existingForwards.get(key); | ||
const { service, port } = forward; | ||
((res[serviceKey(service)] ||= { | ||
((_b = (res[_a = serviceKey(service)] || (res[_a] = { | ||
service: service.name, | ||
project: service.project, | ||
ports: {}, | ||
}).ports[port] ||= []).push(url); | ||
})).ports)[port] || (_b[port] = [])).push(url); | ||
return res; | ||
@@ -115,0 +116,0 @@ }, {}); |
{ | ||
"name": "@preevy/compose-tunnel-agent", | ||
"version": "0.0.10", | ||
"version": "0.0.15", | ||
"description": "", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
"lodash": "^4.17.21", | ||
"p-limit": "3.1.0", | ||
"p-limit": "^3.1.0", | ||
"pino": "^8.11.0", | ||
@@ -28,3 +28,3 @@ "pino-pretty": "^9.4.0", | ||
"@types/shell-escape": "^0.2.1", | ||
"@types/ssh2": "^1.11.7", | ||
"@types/ssh2": "^1.11.8", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
@@ -31,0 +31,0 @@ "@typescript-eslint/parser": "^5.55.0", |
{ | ||
"compilerOptions": { | ||
"lib": [ | ||
"ES2022" | ||
"ES2019" | ||
], | ||
"module": "CommonJS", | ||
"target": "ES2022", | ||
"target": "ES2019", | ||
"moduleResolution": "node", | ||
@@ -9,0 +9,0 @@ "strict": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
132957
55
800
Updatedp-limit@^3.1.0