@keynv/cli 0.1.0-rc.6 → 0.1.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +366 -136
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import 'crypto';
|
|
4
|
-
import { readFileSync, existsSync, mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
4
|
+
import { readFileSync, existsSync, statSync, mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
5
5
|
import { homedir } from 'os';
|
|
6
|
-
import { join, dirname } from 'path';
|
|
6
|
+
import { isAbsolute, resolve, join, dirname } from 'path';
|
|
7
7
|
import { Entry } from '@napi-rs/keyring';
|
|
8
8
|
import { styleText } from 'util';
|
|
9
9
|
import j2, { stdin, stdout } from 'process';
|
|
@@ -1056,7 +1056,7 @@ var require_lib = __commonJS({
|
|
|
1056
1056
|
var VERSION, AGENT;
|
|
1057
1057
|
var init_version = __esm({
|
|
1058
1058
|
"src/version.ts"() {
|
|
1059
|
-
VERSION = "0.1.0-rc.
|
|
1059
|
+
VERSION = "0.1.0-rc.7" ;
|
|
1060
1060
|
AGENT = `keynv-cli/${VERSION}`;
|
|
1061
1061
|
}
|
|
1062
1062
|
});
|
|
@@ -7060,14 +7060,14 @@ async function runSecretMenu(client, project, alias2) {
|
|
|
7060
7060
|
async function copyToClipboard(value) {
|
|
7061
7061
|
const platform = process.platform;
|
|
7062
7062
|
const cmd = platform === "darwin" ? ["pbcopy", []] : platform === "win32" ? ["clip", []] : ["xclip", ["-selection", "clipboard"]];
|
|
7063
|
-
return new Promise((
|
|
7063
|
+
return new Promise((resolve2) => {
|
|
7064
7064
|
try {
|
|
7065
7065
|
const child = spawn(cmd[0], cmd[1], { stdio: ["pipe", "ignore", "ignore"] });
|
|
7066
|
-
child.on("error", () =>
|
|
7067
|
-
child.on("exit", (code) =>
|
|
7066
|
+
child.on("error", () => resolve2(false));
|
|
7067
|
+
child.on("exit", (code) => resolve2(code === 0));
|
|
7068
7068
|
child.stdin.end(value);
|
|
7069
7069
|
} catch {
|
|
7070
|
-
|
|
7070
|
+
resolve2(false);
|
|
7071
7071
|
}
|
|
7072
7072
|
});
|
|
7073
7073
|
}
|
|
@@ -23813,7 +23813,7 @@ var require_named_placeholders = __commonJS({
|
|
|
23813
23813
|
}
|
|
23814
23814
|
return s;
|
|
23815
23815
|
}
|
|
23816
|
-
function
|
|
23816
|
+
function join8(tree) {
|
|
23817
23817
|
if (tree.length === 1) {
|
|
23818
23818
|
return tree;
|
|
23819
23819
|
}
|
|
@@ -23839,7 +23839,7 @@ var require_named_placeholders = __commonJS({
|
|
|
23839
23839
|
if (cache2 && (tree = cache2.get(query))) {
|
|
23840
23840
|
return toArrayParams(tree, paramsObj);
|
|
23841
23841
|
}
|
|
23842
|
-
tree =
|
|
23842
|
+
tree = join8(parse(query));
|
|
23843
23843
|
if (cache2) {
|
|
23844
23844
|
cache2.set(query, tree);
|
|
23845
23845
|
}
|
|
@@ -23995,11 +23995,11 @@ var require_connection = __commonJS({
|
|
|
23995
23995
|
const config = this.config;
|
|
23996
23996
|
tracePromise(
|
|
23997
23997
|
connectChannel,
|
|
23998
|
-
() => new Promise((
|
|
23998
|
+
() => new Promise((resolve2, reject) => {
|
|
23999
23999
|
let onConnect, onError;
|
|
24000
24000
|
onConnect = (param) => {
|
|
24001
24001
|
this.removeListener("error", onError);
|
|
24002
|
-
|
|
24002
|
+
resolve2(param);
|
|
24003
24003
|
};
|
|
24004
24004
|
onError = (err) => {
|
|
24005
24005
|
this.removeListener("connect", onConnect);
|
|
@@ -24424,9 +24424,9 @@ var require_connection = __commonJS({
|
|
|
24424
24424
|
} else if (shouldTrace(queryChannel)) {
|
|
24425
24425
|
tracePromise(
|
|
24426
24426
|
queryChannel,
|
|
24427
|
-
() => new Promise((
|
|
24427
|
+
() => new Promise((resolve2, reject) => {
|
|
24428
24428
|
cmdQuery.once("error", reject);
|
|
24429
|
-
cmdQuery.once("end", () =>
|
|
24429
|
+
cmdQuery.once("end", () => resolve2());
|
|
24430
24430
|
this.addCommand(cmdQuery);
|
|
24431
24431
|
}),
|
|
24432
24432
|
() => {
|
|
@@ -24573,12 +24573,12 @@ var require_connection = __commonJS({
|
|
|
24573
24573
|
} else if (shouldTrace(executeChannel)) {
|
|
24574
24574
|
tracePromise(
|
|
24575
24575
|
executeChannel,
|
|
24576
|
-
() => new Promise((
|
|
24576
|
+
() => new Promise((resolve2, reject) => {
|
|
24577
24577
|
prepareAndExecute((err) => {
|
|
24578
24578
|
executeCommand.emit("error", err);
|
|
24579
24579
|
});
|
|
24580
24580
|
executeCommand.once("error", reject);
|
|
24581
|
-
executeCommand.once("end", () =>
|
|
24581
|
+
executeCommand.once("end", () => resolve2());
|
|
24582
24582
|
}),
|
|
24583
24583
|
() => {
|
|
24584
24584
|
const server = getServerContext(this.config);
|
|
@@ -24843,13 +24843,13 @@ var require_capture_local_err = __commonJS({
|
|
|
24843
24843
|
var require_make_done_cb = __commonJS({
|
|
24844
24844
|
"../../node_modules/.pnpm/mysql2@3.22.3_@types+node@24.12.3/node_modules/mysql2/lib/promise/make_done_cb.js"(exports, module) {
|
|
24845
24845
|
var { applyCapturedStack } = require_capture_local_err();
|
|
24846
|
-
function makeDoneCb(
|
|
24846
|
+
function makeDoneCb(resolve2, reject, stackHolder) {
|
|
24847
24847
|
return function(err, rows, fields) {
|
|
24848
24848
|
if (err) {
|
|
24849
24849
|
applyCapturedStack(err, stackHolder);
|
|
24850
24850
|
reject(err);
|
|
24851
24851
|
} else {
|
|
24852
|
-
|
|
24852
|
+
resolve2([rows, fields]);
|
|
24853
24853
|
}
|
|
24854
24854
|
};
|
|
24855
24855
|
}
|
|
@@ -24872,8 +24872,8 @@ var require_prepared_statement_info = __commonJS({
|
|
|
24872
24872
|
const stackHolder = captureStackHolder(
|
|
24873
24873
|
_PromisePreparedStatementInfo.prototype.execute
|
|
24874
24874
|
);
|
|
24875
|
-
return new this.Promise((
|
|
24876
|
-
const done = makeDoneCb(
|
|
24875
|
+
return new this.Promise((resolve2, reject) => {
|
|
24876
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
24877
24877
|
if (parameters) {
|
|
24878
24878
|
s.execute(parameters, done);
|
|
24879
24879
|
} else {
|
|
@@ -24882,9 +24882,9 @@ var require_prepared_statement_info = __commonJS({
|
|
|
24882
24882
|
});
|
|
24883
24883
|
}
|
|
24884
24884
|
close() {
|
|
24885
|
-
return new this.Promise((
|
|
24885
|
+
return new this.Promise((resolve2) => {
|
|
24886
24886
|
this.statement.close();
|
|
24887
|
-
|
|
24887
|
+
resolve2();
|
|
24888
24888
|
});
|
|
24889
24889
|
}
|
|
24890
24890
|
};
|
|
@@ -24955,8 +24955,8 @@ var require_connection2 = __commonJS({
|
|
|
24955
24955
|
"Callback function is not available with promise clients."
|
|
24956
24956
|
);
|
|
24957
24957
|
}
|
|
24958
|
-
return new this.Promise((
|
|
24959
|
-
const done = makeDoneCb(
|
|
24958
|
+
return new this.Promise((resolve2, reject) => {
|
|
24959
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
24960
24960
|
if (params !== void 0) {
|
|
24961
24961
|
c2.query(query, params, done);
|
|
24962
24962
|
} else {
|
|
@@ -24972,8 +24972,8 @@ var require_connection2 = __commonJS({
|
|
|
24972
24972
|
"Callback function is not available with promise clients."
|
|
24973
24973
|
);
|
|
24974
24974
|
}
|
|
24975
|
-
return new this.Promise((
|
|
24976
|
-
const done = makeDoneCb(
|
|
24975
|
+
return new this.Promise((resolve2, reject) => {
|
|
24976
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
24977
24977
|
if (params !== void 0) {
|
|
24978
24978
|
c2.execute(query, params, done);
|
|
24979
24979
|
} else {
|
|
@@ -24982,8 +24982,8 @@ var require_connection2 = __commonJS({
|
|
|
24982
24982
|
});
|
|
24983
24983
|
}
|
|
24984
24984
|
end() {
|
|
24985
|
-
return new this.Promise((
|
|
24986
|
-
this.connection.end(
|
|
24985
|
+
return new this.Promise((resolve2) => {
|
|
24986
|
+
this.connection.end(resolve2);
|
|
24987
24987
|
});
|
|
24988
24988
|
}
|
|
24989
24989
|
async [Symbol.asyncDispose]() {
|
|
@@ -24996,16 +24996,16 @@ var require_connection2 = __commonJS({
|
|
|
24996
24996
|
const stackHolder = captureStackHolder(
|
|
24997
24997
|
_PromiseConnection.prototype.beginTransaction
|
|
24998
24998
|
);
|
|
24999
|
-
return new this.Promise((
|
|
25000
|
-
const done = makeDoneCb(
|
|
24999
|
+
return new this.Promise((resolve2, reject) => {
|
|
25000
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
25001
25001
|
c2.beginTransaction(done);
|
|
25002
25002
|
});
|
|
25003
25003
|
}
|
|
25004
25004
|
commit() {
|
|
25005
25005
|
const c2 = this.connection;
|
|
25006
25006
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.commit);
|
|
25007
|
-
return new this.Promise((
|
|
25008
|
-
const done = makeDoneCb(
|
|
25007
|
+
return new this.Promise((resolve2, reject) => {
|
|
25008
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
25009
25009
|
c2.commit(done);
|
|
25010
25010
|
});
|
|
25011
25011
|
}
|
|
@@ -25014,21 +25014,21 @@ var require_connection2 = __commonJS({
|
|
|
25014
25014
|
const stackHolder = captureStackHolder(
|
|
25015
25015
|
_PromiseConnection.prototype.rollback
|
|
25016
25016
|
);
|
|
25017
|
-
return new this.Promise((
|
|
25018
|
-
const done = makeDoneCb(
|
|
25017
|
+
return new this.Promise((resolve2, reject) => {
|
|
25018
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
25019
25019
|
c2.rollback(done);
|
|
25020
25020
|
});
|
|
25021
25021
|
}
|
|
25022
25022
|
ping() {
|
|
25023
25023
|
const c2 = this.connection;
|
|
25024
25024
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.ping);
|
|
25025
|
-
return new this.Promise((
|
|
25025
|
+
return new this.Promise((resolve2, reject) => {
|
|
25026
25026
|
c2.ping((err) => {
|
|
25027
25027
|
if (err) {
|
|
25028
25028
|
applyCapturedStack(err, stackHolder);
|
|
25029
25029
|
reject(err);
|
|
25030
25030
|
} else {
|
|
25031
|
-
|
|
25031
|
+
resolve2(true);
|
|
25032
25032
|
}
|
|
25033
25033
|
});
|
|
25034
25034
|
});
|
|
@@ -25036,13 +25036,13 @@ var require_connection2 = __commonJS({
|
|
|
25036
25036
|
reset() {
|
|
25037
25037
|
const c2 = this.connection;
|
|
25038
25038
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.reset);
|
|
25039
|
-
return new this.Promise((
|
|
25039
|
+
return new this.Promise((resolve2, reject) => {
|
|
25040
25040
|
c2.reset((err) => {
|
|
25041
25041
|
if (err) {
|
|
25042
25042
|
applyCapturedStack(err, stackHolder);
|
|
25043
25043
|
reject(err);
|
|
25044
25044
|
} else {
|
|
25045
|
-
|
|
25045
|
+
resolve2();
|
|
25046
25046
|
}
|
|
25047
25047
|
});
|
|
25048
25048
|
});
|
|
@@ -25050,13 +25050,13 @@ var require_connection2 = __commonJS({
|
|
|
25050
25050
|
connect() {
|
|
25051
25051
|
const c2 = this.connection;
|
|
25052
25052
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.connect);
|
|
25053
|
-
return new this.Promise((
|
|
25053
|
+
return new this.Promise((resolve2, reject) => {
|
|
25054
25054
|
c2.connect((err, param) => {
|
|
25055
25055
|
if (err) {
|
|
25056
25056
|
applyCapturedStack(err, stackHolder);
|
|
25057
25057
|
reject(err);
|
|
25058
25058
|
} else {
|
|
25059
|
-
|
|
25059
|
+
resolve2(param);
|
|
25060
25060
|
}
|
|
25061
25061
|
});
|
|
25062
25062
|
});
|
|
@@ -25065,7 +25065,7 @@ var require_connection2 = __commonJS({
|
|
|
25065
25065
|
const c2 = this.connection;
|
|
25066
25066
|
const promiseImpl = this.Promise;
|
|
25067
25067
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.prepare);
|
|
25068
|
-
return new this.Promise((
|
|
25068
|
+
return new this.Promise((resolve2, reject) => {
|
|
25069
25069
|
c2.prepare(options, (err, statement) => {
|
|
25070
25070
|
if (err) {
|
|
25071
25071
|
applyCapturedStack(err, stackHolder);
|
|
@@ -25075,7 +25075,7 @@ var require_connection2 = __commonJS({
|
|
|
25075
25075
|
statement,
|
|
25076
25076
|
promiseImpl
|
|
25077
25077
|
);
|
|
25078
|
-
|
|
25078
|
+
resolve2(wrappedStatement);
|
|
25079
25079
|
}
|
|
25080
25080
|
});
|
|
25081
25081
|
});
|
|
@@ -25085,13 +25085,13 @@ var require_connection2 = __commonJS({
|
|
|
25085
25085
|
const stackHolder = captureStackHolder(
|
|
25086
25086
|
_PromiseConnection.prototype.changeUser
|
|
25087
25087
|
);
|
|
25088
|
-
return new this.Promise((
|
|
25088
|
+
return new this.Promise((resolve2, reject) => {
|
|
25089
25089
|
c2.changeUser(options, (err) => {
|
|
25090
25090
|
if (err) {
|
|
25091
25091
|
applyCapturedStack(err, stackHolder);
|
|
25092
25092
|
reject(err);
|
|
25093
25093
|
} else {
|
|
25094
|
-
|
|
25094
|
+
resolve2();
|
|
25095
25095
|
}
|
|
25096
25096
|
});
|
|
25097
25097
|
});
|
|
@@ -25553,12 +25553,12 @@ var require_pool2 = __commonJS({
|
|
|
25553
25553
|
}
|
|
25554
25554
|
getConnection() {
|
|
25555
25555
|
const corePool = this.pool;
|
|
25556
|
-
return new this.Promise((
|
|
25556
|
+
return new this.Promise((resolve2, reject) => {
|
|
25557
25557
|
corePool.getConnection((err, coreConnection) => {
|
|
25558
25558
|
if (err) {
|
|
25559
25559
|
reject(err);
|
|
25560
25560
|
} else {
|
|
25561
|
-
|
|
25561
|
+
resolve2(new PromisePoolConnection(coreConnection, this.Promise));
|
|
25562
25562
|
}
|
|
25563
25563
|
});
|
|
25564
25564
|
});
|
|
@@ -25574,8 +25574,8 @@ var require_pool2 = __commonJS({
|
|
|
25574
25574
|
"Callback function is not available with promise clients."
|
|
25575
25575
|
);
|
|
25576
25576
|
}
|
|
25577
|
-
return new this.Promise((
|
|
25578
|
-
const done = makeDoneCb(
|
|
25577
|
+
return new this.Promise((resolve2, reject) => {
|
|
25578
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
25579
25579
|
if (args !== void 0) {
|
|
25580
25580
|
corePool.query(sql, args, done);
|
|
25581
25581
|
} else {
|
|
@@ -25591,8 +25591,8 @@ var require_pool2 = __commonJS({
|
|
|
25591
25591
|
"Callback function is not available with promise clients."
|
|
25592
25592
|
);
|
|
25593
25593
|
}
|
|
25594
|
-
return new this.Promise((
|
|
25595
|
-
const done = makeDoneCb(
|
|
25594
|
+
return new this.Promise((resolve2, reject) => {
|
|
25595
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
25596
25596
|
if (args) {
|
|
25597
25597
|
corePool.execute(sql, args, done);
|
|
25598
25598
|
} else {
|
|
@@ -25603,13 +25603,13 @@ var require_pool2 = __commonJS({
|
|
|
25603
25603
|
end() {
|
|
25604
25604
|
const corePool = this.pool;
|
|
25605
25605
|
const stackHolder = captureStackHolder(_PromisePool.prototype.end);
|
|
25606
|
-
return new this.Promise((
|
|
25606
|
+
return new this.Promise((resolve2, reject) => {
|
|
25607
25607
|
corePool.end((err) => {
|
|
25608
25608
|
if (err) {
|
|
25609
25609
|
applyCapturedStack(err, stackHolder);
|
|
25610
25610
|
reject(err);
|
|
25611
25611
|
} else {
|
|
25612
|
-
|
|
25612
|
+
resolve2();
|
|
25613
25613
|
}
|
|
25614
25614
|
});
|
|
25615
25615
|
});
|
|
@@ -26034,12 +26034,12 @@ var require_pool_cluster2 = __commonJS({
|
|
|
26034
26034
|
}
|
|
26035
26035
|
getConnection() {
|
|
26036
26036
|
const corePoolNamespace = this.poolNamespace;
|
|
26037
|
-
return new this.Promise((
|
|
26037
|
+
return new this.Promise((resolve2, reject) => {
|
|
26038
26038
|
corePoolNamespace.getConnection((err, coreConnection) => {
|
|
26039
26039
|
if (err) {
|
|
26040
26040
|
reject(err);
|
|
26041
26041
|
} else {
|
|
26042
|
-
|
|
26042
|
+
resolve2(new PromisePoolConnection(coreConnection, this.Promise));
|
|
26043
26043
|
}
|
|
26044
26044
|
});
|
|
26045
26045
|
});
|
|
@@ -26054,8 +26054,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
26054
26054
|
"Callback function is not available with promise clients."
|
|
26055
26055
|
);
|
|
26056
26056
|
}
|
|
26057
|
-
return new this.Promise((
|
|
26058
|
-
const done = makeDoneCb(
|
|
26057
|
+
return new this.Promise((resolve2, reject) => {
|
|
26058
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
26059
26059
|
corePoolNamespace.query(sql, values, done);
|
|
26060
26060
|
});
|
|
26061
26061
|
}
|
|
@@ -26069,8 +26069,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
26069
26069
|
"Callback function is not available with promise clients."
|
|
26070
26070
|
);
|
|
26071
26071
|
}
|
|
26072
|
-
return new this.Promise((
|
|
26073
|
-
const done = makeDoneCb(
|
|
26072
|
+
return new this.Promise((resolve2, reject) => {
|
|
26073
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
26074
26074
|
corePoolNamespace.execute(sql, values, done);
|
|
26075
26075
|
});
|
|
26076
26076
|
}
|
|
@@ -26108,9 +26108,9 @@ var require_promise = __commonJS({
|
|
|
26108
26108
|
"no Promise implementation available.Use promise-enabled node version or pass userland Promise implementation as parameter, for example: { Promise: require('bluebird') }"
|
|
26109
26109
|
);
|
|
26110
26110
|
}
|
|
26111
|
-
return new thePromise((
|
|
26111
|
+
return new thePromise((resolve2, reject) => {
|
|
26112
26112
|
coreConnection.once("connect", () => {
|
|
26113
|
-
|
|
26113
|
+
resolve2(new PromiseConnection(coreConnection, thePromise));
|
|
26114
26114
|
});
|
|
26115
26115
|
coreConnection.once("error", (err) => {
|
|
26116
26116
|
applyCapturedStack(err, stackHolder);
|
|
@@ -26137,7 +26137,7 @@ var require_promise = __commonJS({
|
|
|
26137
26137
|
}
|
|
26138
26138
|
getConnection(pattern, selector) {
|
|
26139
26139
|
const corePoolCluster = this.poolCluster;
|
|
26140
|
-
return new this.Promise((
|
|
26140
|
+
return new this.Promise((resolve2, reject) => {
|
|
26141
26141
|
corePoolCluster.getConnection(
|
|
26142
26142
|
pattern,
|
|
26143
26143
|
selector,
|
|
@@ -26145,7 +26145,7 @@ var require_promise = __commonJS({
|
|
|
26145
26145
|
if (err) {
|
|
26146
26146
|
reject(err);
|
|
26147
26147
|
} else {
|
|
26148
|
-
|
|
26148
|
+
resolve2(new PromisePoolConnection(coreConnection, this.Promise));
|
|
26149
26149
|
}
|
|
26150
26150
|
}
|
|
26151
26151
|
);
|
|
@@ -26159,8 +26159,8 @@ var require_promise = __commonJS({
|
|
|
26159
26159
|
"Callback function is not available with promise clients."
|
|
26160
26160
|
);
|
|
26161
26161
|
}
|
|
26162
|
-
return new this.Promise((
|
|
26163
|
-
const done = makeDoneCb(
|
|
26162
|
+
return new this.Promise((resolve2, reject) => {
|
|
26163
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
26164
26164
|
corePoolCluster.query(sql, args, done);
|
|
26165
26165
|
});
|
|
26166
26166
|
}
|
|
@@ -26174,8 +26174,8 @@ var require_promise = __commonJS({
|
|
|
26174
26174
|
"Callback function is not available with promise clients."
|
|
26175
26175
|
);
|
|
26176
26176
|
}
|
|
26177
|
-
return new this.Promise((
|
|
26178
|
-
const done = makeDoneCb(
|
|
26177
|
+
return new this.Promise((resolve2, reject) => {
|
|
26178
|
+
const done = makeDoneCb(resolve2, reject, stackHolder);
|
|
26179
26179
|
corePoolCluster.execute(sql, args, done);
|
|
26180
26180
|
});
|
|
26181
26181
|
}
|
|
@@ -26188,13 +26188,13 @@ var require_promise = __commonJS({
|
|
|
26188
26188
|
end() {
|
|
26189
26189
|
const corePoolCluster = this.poolCluster;
|
|
26190
26190
|
const stackHolder = captureStackHolder(_PromisePoolCluster.prototype.end);
|
|
26191
|
-
return new this.Promise((
|
|
26191
|
+
return new this.Promise((resolve2, reject) => {
|
|
26192
26192
|
corePoolCluster.end((err) => {
|
|
26193
26193
|
if (err) {
|
|
26194
26194
|
applyCapturedStack(err, stackHolder);
|
|
26195
26195
|
reject(err);
|
|
26196
26196
|
} else {
|
|
26197
|
-
|
|
26197
|
+
resolve2();
|
|
26198
26198
|
}
|
|
26199
26199
|
});
|
|
26200
26200
|
});
|
|
@@ -29269,7 +29269,7 @@ var require_dist = __commonJS({
|
|
|
29269
29269
|
function parse(stream, callback) {
|
|
29270
29270
|
const parser = new parser_1.Parser();
|
|
29271
29271
|
stream.on("data", (buffer) => parser.parse(buffer, callback));
|
|
29272
|
-
return new Promise((
|
|
29272
|
+
return new Promise((resolve2) => stream.on("end", () => resolve2()));
|
|
29273
29273
|
}
|
|
29274
29274
|
exports.parse = parse;
|
|
29275
29275
|
}
|
|
@@ -29994,12 +29994,12 @@ var require_client2 = __commonJS({
|
|
|
29994
29994
|
this._connect(callback);
|
|
29995
29995
|
return;
|
|
29996
29996
|
}
|
|
29997
|
-
return new this._Promise((
|
|
29997
|
+
return new this._Promise((resolve2, reject) => {
|
|
29998
29998
|
this._connect((error) => {
|
|
29999
29999
|
if (error) {
|
|
30000
30000
|
reject(error);
|
|
30001
30001
|
} else {
|
|
30002
|
-
|
|
30002
|
+
resolve2(this);
|
|
30003
30003
|
}
|
|
30004
30004
|
});
|
|
30005
30005
|
});
|
|
@@ -30345,8 +30345,8 @@ var require_client2 = __commonJS({
|
|
|
30345
30345
|
readTimeout = config.query_timeout || this.connectionParameters.query_timeout;
|
|
30346
30346
|
query = new Query2(config, values, callback);
|
|
30347
30347
|
if (!query.callback) {
|
|
30348
|
-
result = new this._Promise((
|
|
30349
|
-
query.callback = (err, res) => err ? reject(err) :
|
|
30348
|
+
result = new this._Promise((resolve2, reject) => {
|
|
30349
|
+
query.callback = (err, res) => err ? reject(err) : resolve2(res);
|
|
30350
30350
|
}).catch((err) => {
|
|
30351
30351
|
Error.captureStackTrace(err);
|
|
30352
30352
|
throw err;
|
|
@@ -30423,8 +30423,8 @@ var require_client2 = __commonJS({
|
|
|
30423
30423
|
if (cb) {
|
|
30424
30424
|
this.connection.once("end", cb);
|
|
30425
30425
|
} else {
|
|
30426
|
-
return new this._Promise((
|
|
30427
|
-
this.connection.once("end",
|
|
30426
|
+
return new this._Promise((resolve2) => {
|
|
30427
|
+
this.connection.once("end", resolve2);
|
|
30428
30428
|
});
|
|
30429
30429
|
}
|
|
30430
30430
|
}
|
|
@@ -30472,8 +30472,8 @@ var require_pg_pool = __commonJS({
|
|
|
30472
30472
|
const cb = function(err, client) {
|
|
30473
30473
|
err ? rej(err) : res(client);
|
|
30474
30474
|
};
|
|
30475
|
-
const result = new Promise2(function(
|
|
30476
|
-
res =
|
|
30475
|
+
const result = new Promise2(function(resolve2, reject) {
|
|
30476
|
+
res = resolve2;
|
|
30477
30477
|
rej = reject;
|
|
30478
30478
|
}).catch((err) => {
|
|
30479
30479
|
Error.captureStackTrace(err);
|
|
@@ -30534,7 +30534,7 @@ var require_pg_pool = __commonJS({
|
|
|
30534
30534
|
if (typeof Promise2.try === "function") {
|
|
30535
30535
|
return Promise2.try(f);
|
|
30536
30536
|
}
|
|
30537
|
-
return new Promise2((
|
|
30537
|
+
return new Promise2((resolve2) => resolve2(f()));
|
|
30538
30538
|
}
|
|
30539
30539
|
_isFull() {
|
|
30540
30540
|
return this._clients.length >= this.options.max;
|
|
@@ -30926,8 +30926,8 @@ var require_query4 = __commonJS({
|
|
|
30926
30926
|
NativeQuery.prototype._getPromise = function() {
|
|
30927
30927
|
if (this._promise) return this._promise;
|
|
30928
30928
|
this._promise = new Promise(
|
|
30929
|
-
function(
|
|
30930
|
-
this._once("end",
|
|
30929
|
+
function(resolve2, reject) {
|
|
30930
|
+
this._once("end", resolve2);
|
|
30931
30931
|
this._once("error", reject);
|
|
30932
30932
|
}.bind(this)
|
|
30933
30933
|
);
|
|
@@ -31104,12 +31104,12 @@ var require_client3 = __commonJS({
|
|
|
31104
31104
|
this._connect(callback);
|
|
31105
31105
|
return;
|
|
31106
31106
|
}
|
|
31107
|
-
return new this._Promise((
|
|
31107
|
+
return new this._Promise((resolve2, reject) => {
|
|
31108
31108
|
this._connect((error) => {
|
|
31109
31109
|
if (error) {
|
|
31110
31110
|
reject(error);
|
|
31111
31111
|
} else {
|
|
31112
|
-
|
|
31112
|
+
resolve2(this);
|
|
31113
31113
|
}
|
|
31114
31114
|
});
|
|
31115
31115
|
});
|
|
@@ -31133,8 +31133,8 @@ var require_client3 = __commonJS({
|
|
|
31133
31133
|
query = new NativeQuery(config, values, callback);
|
|
31134
31134
|
if (!query.callback) {
|
|
31135
31135
|
let resolveOut, rejectOut;
|
|
31136
|
-
result = new this._Promise((
|
|
31137
|
-
resolveOut =
|
|
31136
|
+
result = new this._Promise((resolve2, reject) => {
|
|
31137
|
+
resolveOut = resolve2;
|
|
31138
31138
|
rejectOut = reject;
|
|
31139
31139
|
}).catch((err) => {
|
|
31140
31140
|
Error.captureStackTrace(err);
|
|
@@ -31194,8 +31194,8 @@ var require_client3 = __commonJS({
|
|
|
31194
31194
|
}
|
|
31195
31195
|
let result;
|
|
31196
31196
|
if (!cb) {
|
|
31197
|
-
result = new this._Promise(function(
|
|
31198
|
-
cb = (err) => err ? reject(err) :
|
|
31197
|
+
result = new this._Promise(function(resolve2, reject) {
|
|
31198
|
+
cb = (err) => err ? reject(err) : resolve2();
|
|
31199
31199
|
});
|
|
31200
31200
|
}
|
|
31201
31201
|
this.native.end(function() {
|
|
@@ -36302,7 +36302,7 @@ var require_Command = __commonJS({
|
|
|
36302
36302
|
}
|
|
36303
36303
|
}
|
|
36304
36304
|
initPromise() {
|
|
36305
|
-
const promise = new Promise((
|
|
36305
|
+
const promise = new Promise((resolve2, reject) => {
|
|
36306
36306
|
if (!this.transformed) {
|
|
36307
36307
|
this.transformed = true;
|
|
36308
36308
|
const transformer = _Command._transformer.argument[this.name];
|
|
@@ -36311,7 +36311,7 @@ var require_Command = __commonJS({
|
|
|
36311
36311
|
}
|
|
36312
36312
|
this.stringifyArguments();
|
|
36313
36313
|
}
|
|
36314
|
-
this.resolve = this._convertValue(
|
|
36314
|
+
this.resolve = this._convertValue(resolve2);
|
|
36315
36315
|
this.reject = (err) => {
|
|
36316
36316
|
this._clearTimers();
|
|
36317
36317
|
if (this.errorStack) {
|
|
@@ -36344,11 +36344,11 @@ var require_Command = __commonJS({
|
|
|
36344
36344
|
/**
|
|
36345
36345
|
* Convert the value from buffer to the target encoding.
|
|
36346
36346
|
*/
|
|
36347
|
-
_convertValue(
|
|
36347
|
+
_convertValue(resolve2) {
|
|
36348
36348
|
return (value) => {
|
|
36349
36349
|
try {
|
|
36350
36350
|
this._clearTimers();
|
|
36351
|
-
|
|
36351
|
+
resolve2(this.transformReply(value));
|
|
36352
36352
|
this.isResolved = true;
|
|
36353
36353
|
} catch (err) {
|
|
36354
36354
|
this.reject(err);
|
|
@@ -36626,13 +36626,13 @@ var require_autoPipelining = __commonJS({
|
|
|
36626
36626
|
if (client.isCluster && !client.slots.length) {
|
|
36627
36627
|
if (client.status === "wait")
|
|
36628
36628
|
client.connect().catch(lodash_1.noop);
|
|
36629
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
36629
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve2, reject) {
|
|
36630
36630
|
client.delayUntilReady((err) => {
|
|
36631
36631
|
if (err) {
|
|
36632
36632
|
reject(err);
|
|
36633
36633
|
return;
|
|
36634
36634
|
}
|
|
36635
|
-
executeWithAutoPipelining(client, functionName, commandName, args, null).then(
|
|
36635
|
+
executeWithAutoPipelining(client, functionName, commandName, args, null).then(resolve2, reject);
|
|
36636
36636
|
});
|
|
36637
36637
|
}), callback);
|
|
36638
36638
|
}
|
|
@@ -36653,13 +36653,13 @@ var require_autoPipelining = __commonJS({
|
|
|
36653
36653
|
pipeline[exports.kExec] = true;
|
|
36654
36654
|
setImmediate(executeAutoPipeline, client, slotKey);
|
|
36655
36655
|
}
|
|
36656
|
-
const autoPipelinePromise = new Promise(function(
|
|
36656
|
+
const autoPipelinePromise = new Promise(function(resolve2, reject) {
|
|
36657
36657
|
pipeline[exports.kCallbacks].push(function(err, value) {
|
|
36658
36658
|
if (err) {
|
|
36659
36659
|
reject(err);
|
|
36660
36660
|
return;
|
|
36661
36661
|
}
|
|
36662
|
-
|
|
36662
|
+
resolve2(value);
|
|
36663
36663
|
});
|
|
36664
36664
|
if (functionName === "call") {
|
|
36665
36665
|
args.unshift(commandName);
|
|
@@ -36894,8 +36894,8 @@ var require_Pipeline = __commonJS({
|
|
|
36894
36894
|
this[name] = redis[name];
|
|
36895
36895
|
this[name + "Buffer"] = redis[name + "Buffer"];
|
|
36896
36896
|
});
|
|
36897
|
-
this.promise = new Promise((
|
|
36898
|
-
this.resolve =
|
|
36897
|
+
this.promise = new Promise((resolve2, reject) => {
|
|
36898
|
+
this.resolve = resolve2;
|
|
36899
36899
|
this.reject = reject;
|
|
36900
36900
|
});
|
|
36901
36901
|
const _this = this;
|
|
@@ -37195,13 +37195,13 @@ var require_transaction = __commonJS({
|
|
|
37195
37195
|
if (this.isCluster && !this.redis.slots.length) {
|
|
37196
37196
|
if (this.redis.status === "wait")
|
|
37197
37197
|
this.redis.connect().catch(utils_1.noop);
|
|
37198
|
-
return (0, standard_as_callback_1.default)(new Promise((
|
|
37198
|
+
return (0, standard_as_callback_1.default)(new Promise((resolve2, reject) => {
|
|
37199
37199
|
this.redis.delayUntilReady((err) => {
|
|
37200
37200
|
if (err) {
|
|
37201
37201
|
reject(err);
|
|
37202
37202
|
return;
|
|
37203
37203
|
}
|
|
37204
|
-
this.exec(pipeline).then(
|
|
37204
|
+
this.exec(pipeline).then(resolve2, reject);
|
|
37205
37205
|
});
|
|
37206
37206
|
}), callback);
|
|
37207
37207
|
}
|
|
@@ -38330,7 +38330,7 @@ var require_cluster = __commonJS({
|
|
|
38330
38330
|
* Connect to a cluster
|
|
38331
38331
|
*/
|
|
38332
38332
|
connect() {
|
|
38333
|
-
return new Promise((
|
|
38333
|
+
return new Promise((resolve2, reject) => {
|
|
38334
38334
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
38335
38335
|
reject(new Error("Redis is already connecting/connected"));
|
|
38336
38336
|
return;
|
|
@@ -38359,7 +38359,7 @@ var require_cluster = __commonJS({
|
|
|
38359
38359
|
this.retryAttempts = 0;
|
|
38360
38360
|
this.executeOfflineCommands();
|
|
38361
38361
|
this.resetNodesRefreshInterval();
|
|
38362
|
-
|
|
38362
|
+
resolve2();
|
|
38363
38363
|
};
|
|
38364
38364
|
let closeListener = void 0;
|
|
38365
38365
|
const refreshListener = () => {
|
|
@@ -38969,7 +38969,7 @@ var require_cluster = __commonJS({
|
|
|
38969
38969
|
});
|
|
38970
38970
|
}
|
|
38971
38971
|
resolveSrv(hostname) {
|
|
38972
|
-
return new Promise((
|
|
38972
|
+
return new Promise((resolve2, reject) => {
|
|
38973
38973
|
this.options.resolveSrv(hostname, (err, records) => {
|
|
38974
38974
|
if (err) {
|
|
38975
38975
|
return reject(err);
|
|
@@ -38983,7 +38983,7 @@ var require_cluster = __commonJS({
|
|
|
38983
38983
|
if (!group.records.length) {
|
|
38984
38984
|
sortedKeys.shift();
|
|
38985
38985
|
}
|
|
38986
|
-
self2.dnsLookup(record.name).then((host) =>
|
|
38986
|
+
self2.dnsLookup(record.name).then((host) => resolve2({
|
|
38987
38987
|
host,
|
|
38988
38988
|
port: record.port
|
|
38989
38989
|
}), tryFirstOne);
|
|
@@ -38993,14 +38993,14 @@ var require_cluster = __commonJS({
|
|
|
38993
38993
|
});
|
|
38994
38994
|
}
|
|
38995
38995
|
dnsLookup(hostname) {
|
|
38996
|
-
return new Promise((
|
|
38996
|
+
return new Promise((resolve2, reject) => {
|
|
38997
38997
|
this.options.dnsLookup(hostname, (err, address) => {
|
|
38998
38998
|
if (err) {
|
|
38999
38999
|
debug2("failed to resolve hostname %s to IP: %s", hostname, err.message);
|
|
39000
39000
|
reject(err);
|
|
39001
39001
|
} else {
|
|
39002
39002
|
debug2("resolved hostname %s to IP %s", hostname, address);
|
|
39003
|
-
|
|
39003
|
+
resolve2(address);
|
|
39004
39004
|
}
|
|
39005
39005
|
});
|
|
39006
39006
|
});
|
|
@@ -39155,7 +39155,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
39155
39155
|
if (options.tls) {
|
|
39156
39156
|
Object.assign(connectionOptions, options.tls);
|
|
39157
39157
|
}
|
|
39158
|
-
return new Promise((
|
|
39158
|
+
return new Promise((resolve2, reject) => {
|
|
39159
39159
|
process.nextTick(() => {
|
|
39160
39160
|
if (!this.connecting) {
|
|
39161
39161
|
reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
|
|
@@ -39174,7 +39174,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
39174
39174
|
this.stream.once("error", (err) => {
|
|
39175
39175
|
this.firstError = err;
|
|
39176
39176
|
});
|
|
39177
|
-
|
|
39177
|
+
resolve2(this.stream);
|
|
39178
39178
|
});
|
|
39179
39179
|
});
|
|
39180
39180
|
}
|
|
@@ -39330,7 +39330,7 @@ var require_SentinelConnector = __commonJS({
|
|
|
39330
39330
|
const error = new Error(errorMsg);
|
|
39331
39331
|
if (typeof retryDelay === "number") {
|
|
39332
39332
|
eventEmitter("error", error);
|
|
39333
|
-
await new Promise((
|
|
39333
|
+
await new Promise((resolve2) => setTimeout(resolve2, retryDelay));
|
|
39334
39334
|
return connectToNext();
|
|
39335
39335
|
} else {
|
|
39336
39336
|
throw error;
|
|
@@ -40647,7 +40647,7 @@ var require_Redis = __commonJS({
|
|
|
40647
40647
|
* if the connection fails, times out, or if Redis is already connecting/connected.
|
|
40648
40648
|
*/
|
|
40649
40649
|
connect(callback) {
|
|
40650
|
-
const promise = new Promise((
|
|
40650
|
+
const promise = new Promise((resolve2, reject) => {
|
|
40651
40651
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
40652
40652
|
reject(new Error("Redis is already connecting/connected"));
|
|
40653
40653
|
return;
|
|
@@ -40726,7 +40726,7 @@ var require_Redis = __commonJS({
|
|
|
40726
40726
|
}
|
|
40727
40727
|
const connectionReadyHandler = function() {
|
|
40728
40728
|
_this.removeListener("close", connectionCloseHandler);
|
|
40729
|
-
|
|
40729
|
+
resolve2();
|
|
40730
40730
|
};
|
|
40731
40731
|
var connectionCloseHandler = function() {
|
|
40732
40732
|
_this.removeListener("ready", connectionReadyHandler);
|
|
@@ -40820,10 +40820,10 @@ var require_Redis = __commonJS({
|
|
|
40820
40820
|
monitor: true,
|
|
40821
40821
|
lazyConnect: false
|
|
40822
40822
|
});
|
|
40823
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
40823
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve2, reject) {
|
|
40824
40824
|
monitorInstance.once("error", reject);
|
|
40825
40825
|
monitorInstance.once("monitoring", function() {
|
|
40826
|
-
|
|
40826
|
+
resolve2(monitorInstance);
|
|
40827
40827
|
});
|
|
40828
40828
|
}), callback);
|
|
40829
40829
|
}
|
|
@@ -43497,6 +43497,134 @@ var AuditVerifyCommand = class extends Command {
|
|
|
43497
43497
|
// src/commands/exec.ts
|
|
43498
43498
|
init_http();
|
|
43499
43499
|
|
|
43500
|
+
// src/exec/envFile.ts
|
|
43501
|
+
init_dist();
|
|
43502
|
+
var MAX_FILE_BYTES = 1e6;
|
|
43503
|
+
var KEY_RE2 = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
43504
|
+
var ENV_FILE_BASENAME = ".keynv.env";
|
|
43505
|
+
var EnvFileParseError = class extends Error {
|
|
43506
|
+
constructor(file, line, reason) {
|
|
43507
|
+
super(`${file}:${line}: ${reason}`);
|
|
43508
|
+
this.file = file;
|
|
43509
|
+
this.line = line;
|
|
43510
|
+
this.reason = reason;
|
|
43511
|
+
this.name = "EnvFileParseError";
|
|
43512
|
+
}
|
|
43513
|
+
file;
|
|
43514
|
+
line;
|
|
43515
|
+
reason;
|
|
43516
|
+
};
|
|
43517
|
+
var EnvFileNotFoundError = class extends Error {
|
|
43518
|
+
constructor(path) {
|
|
43519
|
+
super(`env file not found: ${path}`);
|
|
43520
|
+
this.path = path;
|
|
43521
|
+
this.name = "EnvFileNotFoundError";
|
|
43522
|
+
}
|
|
43523
|
+
path;
|
|
43524
|
+
};
|
|
43525
|
+
var EnvFileTooLargeError = class extends Error {
|
|
43526
|
+
constructor(path, bytes) {
|
|
43527
|
+
super(`env file ${path} is ${bytes} bytes (max ${MAX_FILE_BYTES})`);
|
|
43528
|
+
this.path = path;
|
|
43529
|
+
this.bytes = bytes;
|
|
43530
|
+
this.name = "EnvFileTooLargeError";
|
|
43531
|
+
}
|
|
43532
|
+
path;
|
|
43533
|
+
bytes;
|
|
43534
|
+
};
|
|
43535
|
+
function parseEnvFile(content, filename) {
|
|
43536
|
+
const normalized = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
43537
|
+
const lines = normalized.split(/\r?\n/);
|
|
43538
|
+
const entries = [];
|
|
43539
|
+
for (let i = 0; i < lines.length; i++) {
|
|
43540
|
+
const raw = lines[i] ?? "";
|
|
43541
|
+
const lineNo = i + 1;
|
|
43542
|
+
const trimmed = raw.trim();
|
|
43543
|
+
if (trimmed.length === 0) continue;
|
|
43544
|
+
if (trimmed.startsWith("#")) continue;
|
|
43545
|
+
let body = trimmed;
|
|
43546
|
+
if (body.startsWith("export ")) {
|
|
43547
|
+
body = body.slice("export ".length).trimStart();
|
|
43548
|
+
}
|
|
43549
|
+
const eq = body.indexOf("=");
|
|
43550
|
+
if (eq <= 0) {
|
|
43551
|
+
throw new EnvFileParseError(filename, lineNo, "expected 'KEY=value'");
|
|
43552
|
+
}
|
|
43553
|
+
const name = body.slice(0, eq).trim();
|
|
43554
|
+
if (!KEY_RE2.test(name)) {
|
|
43555
|
+
throw new EnvFileParseError(
|
|
43556
|
+
filename,
|
|
43557
|
+
lineNo,
|
|
43558
|
+
`invalid key '${name}' (must match /^[A-Za-z_][A-Za-z0-9_]*$/)`
|
|
43559
|
+
);
|
|
43560
|
+
}
|
|
43561
|
+
let valueRaw = body.slice(eq + 1);
|
|
43562
|
+
let value;
|
|
43563
|
+
const valueLeading = valueRaw.replace(/^\s+/, "");
|
|
43564
|
+
const firstCh = valueLeading.charAt(0);
|
|
43565
|
+
if (firstCh === '"' || firstCh === "'") {
|
|
43566
|
+
const close = valueLeading.lastIndexOf(firstCh);
|
|
43567
|
+
if (close === 0) {
|
|
43568
|
+
throw new EnvFileParseError(filename, lineNo, `unclosed ${firstCh} quote`);
|
|
43569
|
+
}
|
|
43570
|
+
const after = valueLeading.slice(close + 1).trim();
|
|
43571
|
+
if (after.length > 0) {
|
|
43572
|
+
throw new EnvFileParseError(
|
|
43573
|
+
filename,
|
|
43574
|
+
lineNo,
|
|
43575
|
+
`unexpected content after closing ${firstCh}`
|
|
43576
|
+
);
|
|
43577
|
+
}
|
|
43578
|
+
value = valueLeading.slice(1, close);
|
|
43579
|
+
} else {
|
|
43580
|
+
value = valueRaw.replace(/\s+$/, "");
|
|
43581
|
+
value = value.replace(/^\s+/, "");
|
|
43582
|
+
}
|
|
43583
|
+
entries.push({
|
|
43584
|
+
name,
|
|
43585
|
+
value,
|
|
43586
|
+
isAlias: parseAlias(value) !== null,
|
|
43587
|
+
line: lineNo
|
|
43588
|
+
});
|
|
43589
|
+
}
|
|
43590
|
+
return entries;
|
|
43591
|
+
}
|
|
43592
|
+
function findEnvFile(startDir) {
|
|
43593
|
+
let dir = resolve(startDir);
|
|
43594
|
+
for (let i = 0; i < 64; i++) {
|
|
43595
|
+
const candidate = join(dir, ENV_FILE_BASENAME);
|
|
43596
|
+
if (existsSync(candidate)) {
|
|
43597
|
+
try {
|
|
43598
|
+
if (statSync(candidate).isFile()) return candidate;
|
|
43599
|
+
} catch {
|
|
43600
|
+
}
|
|
43601
|
+
}
|
|
43602
|
+
const parent = dirname(dir);
|
|
43603
|
+
if (parent === dir) return null;
|
|
43604
|
+
dir = parent;
|
|
43605
|
+
}
|
|
43606
|
+
return null;
|
|
43607
|
+
}
|
|
43608
|
+
function loadEnvFile(opts) {
|
|
43609
|
+
if (opts.disabled) return null;
|
|
43610
|
+
const pickExplicit = opts.explicitPath ?? opts.envVarOverride;
|
|
43611
|
+
let path = null;
|
|
43612
|
+
if (pickExplicit !== void 0) {
|
|
43613
|
+
path = isAbsolute(pickExplicit) ? pickExplicit : resolve(opts.cwd, pickExplicit);
|
|
43614
|
+
if (!existsSync(path)) throw new EnvFileNotFoundError(path);
|
|
43615
|
+
} else {
|
|
43616
|
+
path = findEnvFile(opts.cwd);
|
|
43617
|
+
}
|
|
43618
|
+
if (path === null) return null;
|
|
43619
|
+
const stat = statSync(path);
|
|
43620
|
+
if (stat.size > MAX_FILE_BYTES) {
|
|
43621
|
+
throw new EnvFileTooLargeError(path, stat.size);
|
|
43622
|
+
}
|
|
43623
|
+
const content = readFileSync(path, "utf8");
|
|
43624
|
+
const entries = parseEnvFile(content, path);
|
|
43625
|
+
return { path, entries };
|
|
43626
|
+
}
|
|
43627
|
+
|
|
43500
43628
|
// src/exec/resolve.ts
|
|
43501
43629
|
init_dist();
|
|
43502
43630
|
async function resolveAllAliases(client, argv2, extraStrings = []) {
|
|
@@ -43856,14 +43984,14 @@ function spawnPrivileged(opts) {
|
|
|
43856
43984
|
}, opts.timeoutS * 1e3);
|
|
43857
43985
|
timer.unref();
|
|
43858
43986
|
}
|
|
43859
|
-
return new Promise((
|
|
43987
|
+
return new Promise((resolve2, reject) => {
|
|
43860
43988
|
child.on("error", (err) => {
|
|
43861
43989
|
if (timer) clearTimeout(timer);
|
|
43862
43990
|
reject(err);
|
|
43863
43991
|
});
|
|
43864
43992
|
child.on("close", (code, signal) => {
|
|
43865
43993
|
if (timer) clearTimeout(timer);
|
|
43866
|
-
|
|
43994
|
+
resolve2({
|
|
43867
43995
|
exitCode: code ?? 0,
|
|
43868
43996
|
signal,
|
|
43869
43997
|
durationMs: Date.now() - startedAt
|
|
@@ -43886,11 +44014,23 @@ the redactor before being copied to the calling process's stdout/stderr.
|
|
|
43886
44014
|
|
|
43887
44015
|
The subprocess does NOT inherit the caller's full environment; only
|
|
43888
44016
|
PATH/HOME/USER/SHELL/TERM/LANG/etc. plus anything passed through
|
|
43889
|
-
--via-env
|
|
43890
|
-
|
|
43891
|
-
|
|
44017
|
+
--via-env or via an auto-loaded ${ENV_FILE_BASENAME} file.
|
|
44018
|
+
|
|
44019
|
+
If a ${ENV_FILE_BASENAME} file is found in the current directory or any
|
|
44020
|
+
parent (walked git-style), every NAME=@alias entry is resolved and
|
|
44021
|
+
injected into the subprocess env. Plain NAME=value lines are passed
|
|
44022
|
+
through unchanged. The file is safe to commit because it carries
|
|
44023
|
+
references, not values. Use \`--no-env-file\` to opt out, \`--from PATH\`
|
|
44024
|
+
to load a specific file, or set KEYNV_ENV_FILE in the environment.
|
|
44025
|
+
|
|
44026
|
+
(Note: Node.js itself reserves \`--env-file\`, so the keynv flag is
|
|
44027
|
+
spelled \`--from\` to avoid the collision.)
|
|
43892
44028
|
`,
|
|
43893
44029
|
examples: [
|
|
44030
|
+
[
|
|
44031
|
+
"Auto-load .keynv.env from cwd or parents",
|
|
44032
|
+
"$0 exec -- next dev"
|
|
44033
|
+
],
|
|
43894
44034
|
[
|
|
43895
44035
|
"Run mysql with the alias substituted at fork-exec time",
|
|
43896
44036
|
"$0 exec -- mysql -p@billing.dev.db_pass -h db.example.com"
|
|
@@ -43898,7 +44038,8 @@ agent that wraps it).
|
|
|
43898
44038
|
[
|
|
43899
44039
|
"Inject env vars without showing them in argv",
|
|
43900
44040
|
"$0 exec --via-env DB_PASS=@billing.dev.db_pass -- node ./scripts/migrate.js"
|
|
43901
|
-
]
|
|
44041
|
+
],
|
|
44042
|
+
["Skip auto-discovery", "$0 exec --no-env-file -- npm test"]
|
|
43902
44043
|
]
|
|
43903
44044
|
});
|
|
43904
44045
|
viaEnv = options_exports.Array("--via-env", {
|
|
@@ -43908,7 +44049,15 @@ agent that wraps it).
|
|
|
43908
44049
|
description: "Disable the stdout/stderr redactor. Audit-flagged."
|
|
43909
44050
|
});
|
|
43910
44051
|
timeout = options_exports.String("--timeout", { description: "Kill subprocess after N seconds." });
|
|
43911
|
-
|
|
44052
|
+
envFile = options_exports.String("--from", {
|
|
44053
|
+
description: `Load env mappings from this file instead of auto-discovering ${ENV_FILE_BASENAME}. Errors if missing. (Node intercepts \`--env-file\` for itself, so we use \`--from\`.)`
|
|
44054
|
+
});
|
|
44055
|
+
noEnvFile = options_exports.Boolean("--no-env-file", false, {
|
|
44056
|
+
description: `Skip auto-loading ${ENV_FILE_BASENAME} (and ignore KEYNV_ENV_FILE).`
|
|
44057
|
+
});
|
|
44058
|
+
quiet = options_exports.Boolean("--quiet", false, {
|
|
44059
|
+
description: `Suppress the "loaded N vars from ${ENV_FILE_BASENAME}" status line.`
|
|
44060
|
+
});
|
|
43912
44061
|
rest = options_exports.Rest();
|
|
43913
44062
|
async execute() {
|
|
43914
44063
|
if (!this.rest || this.rest.length === 0) {
|
|
@@ -43928,6 +44077,25 @@ agent that wraps it).
|
|
|
43928
44077
|
this.context.stderr.write("keynv: not logged in. Run `keynv login` first.\n");
|
|
43929
44078
|
return 1;
|
|
43930
44079
|
}
|
|
44080
|
+
let envFileLoaded = null;
|
|
44081
|
+
try {
|
|
44082
|
+
const loaded = loadEnvFile({
|
|
44083
|
+
cwd: process.cwd(),
|
|
44084
|
+
disabled: this.noEnvFile,
|
|
44085
|
+
...this.envFile !== void 0 ? { explicitPath: this.envFile } : {},
|
|
44086
|
+
...process.env.KEYNV_ENV_FILE !== void 0 ? { envVarOverride: process.env.KEYNV_ENV_FILE } : {}
|
|
44087
|
+
});
|
|
44088
|
+
if (loaded) {
|
|
44089
|
+
envFileLoaded = loaded;
|
|
44090
|
+
}
|
|
44091
|
+
} catch (err) {
|
|
44092
|
+
if (err instanceof EnvFileNotFoundError || err instanceof EnvFileParseError || err instanceof EnvFileTooLargeError) {
|
|
44093
|
+
this.context.stderr.write(`keynv: ${err.message}
|
|
44094
|
+
`);
|
|
44095
|
+
return 2;
|
|
44096
|
+
}
|
|
44097
|
+
throw err;
|
|
44098
|
+
}
|
|
43931
44099
|
const viaEnvSpecs = [];
|
|
43932
44100
|
for (const spec of this.viaEnv ?? []) {
|
|
43933
44101
|
const eq = spec.indexOf("=");
|
|
@@ -43941,13 +44109,16 @@ agent that wraps it).
|
|
|
43941
44109
|
aliasLiteral: spec.slice(eq + 1)
|
|
43942
44110
|
});
|
|
43943
44111
|
}
|
|
44112
|
+
const extraAliasStrings = [];
|
|
44113
|
+
if (envFileLoaded) {
|
|
44114
|
+
for (const e2 of envFileLoaded.entries) {
|
|
44115
|
+
if (e2.isAlias) extraAliasStrings.push(e2.value);
|
|
44116
|
+
}
|
|
44117
|
+
}
|
|
44118
|
+
for (const s of viaEnvSpecs) extraAliasStrings.push(s.aliasLiteral);
|
|
43944
44119
|
let resolved;
|
|
43945
44120
|
try {
|
|
43946
|
-
resolved = await resolveAllAliases(
|
|
43947
|
-
client,
|
|
43948
|
-
[command, ...args],
|
|
43949
|
-
viaEnvSpecs.map((s) => s.aliasLiteral)
|
|
43950
|
-
);
|
|
44121
|
+
resolved = await resolveAllAliases(client, [command, ...args], extraAliasStrings);
|
|
43951
44122
|
} catch (err) {
|
|
43952
44123
|
const message = err instanceof Error ? err.message : String(err);
|
|
43953
44124
|
this.context.stderr.write(`keynv: ${message}
|
|
@@ -43957,6 +44128,25 @@ agent that wraps it).
|
|
|
43957
44128
|
const substArgs = args.map((a) => substitute(a, resolved));
|
|
43958
44129
|
const substCommand = substitute(command, resolved);
|
|
43959
44130
|
const injectedEnv = {};
|
|
44131
|
+
const fromEnvFile = /* @__PURE__ */ new Map();
|
|
44132
|
+
if (envFileLoaded) {
|
|
44133
|
+
for (const e2 of envFileLoaded.entries) {
|
|
44134
|
+
if (e2.isAlias) {
|
|
44135
|
+
const subst = substitute(e2.value, resolved);
|
|
44136
|
+
if (subst === e2.value) {
|
|
44137
|
+
this.context.stderr.write(
|
|
44138
|
+
`keynv: ${envFileLoaded.path}:${e2.line}: alias ${e2.value} did not resolve
|
|
44139
|
+
`
|
|
44140
|
+
);
|
|
44141
|
+
return 1;
|
|
44142
|
+
}
|
|
44143
|
+
injectedEnv[e2.name] = subst;
|
|
44144
|
+
} else {
|
|
44145
|
+
injectedEnv[e2.name] = e2.value;
|
|
44146
|
+
}
|
|
44147
|
+
fromEnvFile.set(e2.name, e2.line);
|
|
44148
|
+
}
|
|
44149
|
+
}
|
|
43960
44150
|
for (const spec of viaEnvSpecs) {
|
|
43961
44151
|
const value = substitute(spec.aliasLiteral, resolved);
|
|
43962
44152
|
if (value === spec.aliasLiteral) {
|
|
@@ -43966,8 +44156,23 @@ agent that wraps it).
|
|
|
43966
44156
|
);
|
|
43967
44157
|
return 1;
|
|
43968
44158
|
}
|
|
44159
|
+
const overriddenLine = fromEnvFile.get(spec.name);
|
|
44160
|
+
if (overriddenLine !== void 0 && envFileLoaded && !this.quiet) {
|
|
44161
|
+
this.context.stderr.write(
|
|
44162
|
+
`keynv: --via-env ${spec.name} overrides ${envFileLoaded.path}:${overriddenLine}
|
|
44163
|
+
`
|
|
44164
|
+
);
|
|
44165
|
+
}
|
|
43969
44166
|
injectedEnv[spec.name] = value;
|
|
43970
44167
|
}
|
|
44168
|
+
if (envFileLoaded && !this.quiet) {
|
|
44169
|
+
const total = envFileLoaded.entries.length;
|
|
44170
|
+
const aliasCount = envFileLoaded.entries.filter((e2) => e2.isAlias).length;
|
|
44171
|
+
this.context.stderr.write(
|
|
44172
|
+
`keynv: loaded ${total} var${total === 1 ? "" : "s"} from ${envFileLoaded.path} (${aliasCount} resolved from vault)
|
|
44173
|
+
`
|
|
44174
|
+
);
|
|
44175
|
+
}
|
|
43971
44176
|
const timeoutS = this.timeout ? Number.parseInt(this.timeout, 10) : void 0;
|
|
43972
44177
|
if (this.timeout && (timeoutS === void 0 || Number.isNaN(timeoutS))) {
|
|
43973
44178
|
this.context.stderr.write("keynv: invalid --timeout (expected integer seconds)\n");
|
|
@@ -44057,6 +44262,13 @@ var KEYNV_FILE_DENY_PATTERNS = [
|
|
|
44057
44262
|
".docker/config.json",
|
|
44058
44263
|
"**/.docker/config.json"
|
|
44059
44264
|
];
|
|
44265
|
+
var KEYNV_FILE_ALLOW_PATTERNS = [
|
|
44266
|
+
".keynv.env",
|
|
44267
|
+
"**/.keynv.env"
|
|
44268
|
+
];
|
|
44269
|
+
function gitignoreBlock() {
|
|
44270
|
+
return [...KEYNV_FILE_DENY_PATTERNS, ...KEYNV_FILE_ALLOW_PATTERNS.map((p2) => `!${p2}`)];
|
|
44271
|
+
}
|
|
44060
44272
|
var KEYNV_BEGIN = "# >>> keynv >>>";
|
|
44061
44273
|
var KEYNV_END = "# <<< keynv <<<";
|
|
44062
44274
|
function readJsonOrEmpty(path) {
|
|
@@ -44132,7 +44344,7 @@ var aider = {
|
|
|
44132
44344
|
summary: `[dry-run] would write ${path}`
|
|
44133
44345
|
};
|
|
44134
44346
|
}
|
|
44135
|
-
const changed = ensureKeynvBlock(path,
|
|
44347
|
+
const changed = ensureKeynvBlock(path, gitignoreBlock());
|
|
44136
44348
|
return {
|
|
44137
44349
|
agent: "aider",
|
|
44138
44350
|
applied: true,
|
|
@@ -44165,6 +44377,9 @@ var KEYNV_DENY_TAG = "__keynv_managed__";
|
|
|
44165
44377
|
function denyEntriesForReadTool() {
|
|
44166
44378
|
return KEYNV_FILE_DENY_PATTERNS.map((p2) => `Read(${p2})`);
|
|
44167
44379
|
}
|
|
44380
|
+
function allowEntriesForReadTool() {
|
|
44381
|
+
return KEYNV_FILE_ALLOW_PATTERNS.map((p2) => `Read(${p2})`);
|
|
44382
|
+
}
|
|
44168
44383
|
var claudeCode = {
|
|
44169
44384
|
name: "claude-code",
|
|
44170
44385
|
displayName: "Claude Code",
|
|
@@ -44177,7 +44392,9 @@ var claudeCode = {
|
|
|
44177
44392
|
const path = join(cwd, SETTINGS_PATH_REL);
|
|
44178
44393
|
const settings = readJsonOrEmpty(path);
|
|
44179
44394
|
const denyToAdd = denyEntriesForReadTool();
|
|
44395
|
+
const allowToAdd = allowEntriesForReadTool();
|
|
44180
44396
|
const existingDeny = new Set(settings.permissions?.deny ?? []);
|
|
44397
|
+
const existingAllow = new Set(settings.permissions?.allow ?? []);
|
|
44181
44398
|
const newlyAdded = [];
|
|
44182
44399
|
for (const entry2 of denyToAdd) {
|
|
44183
44400
|
if (!existingDeny.has(entry2)) {
|
|
@@ -44185,8 +44402,14 @@ var claudeCode = {
|
|
|
44185
44402
|
newlyAdded.push(entry2);
|
|
44186
44403
|
}
|
|
44187
44404
|
}
|
|
44405
|
+
for (const entry2 of allowToAdd) {
|
|
44406
|
+
if (!existingAllow.has(entry2)) {
|
|
44407
|
+
existingAllow.add(entry2);
|
|
44408
|
+
}
|
|
44409
|
+
}
|
|
44188
44410
|
settings.permissions = {
|
|
44189
44411
|
...settings.permissions,
|
|
44412
|
+
allow: [...existingAllow].sort((a, b2) => a.localeCompare(b2)),
|
|
44190
44413
|
deny: [...existingDeny].sort((a, b2) => a.localeCompare(b2))
|
|
44191
44414
|
};
|
|
44192
44415
|
settings.hooks = settings.hooks ?? {};
|
|
@@ -44201,6 +44424,7 @@ var claudeCode = {
|
|
|
44201
44424
|
}
|
|
44202
44425
|
settings[KEYNV_DENY_TAG] = {
|
|
44203
44426
|
deny_added: denyToAdd,
|
|
44427
|
+
allow_added: allowToAdd,
|
|
44204
44428
|
hook_added: true
|
|
44205
44429
|
};
|
|
44206
44430
|
const changes = [];
|
|
@@ -44253,6 +44477,12 @@ var claudeCode = {
|
|
|
44253
44477
|
if (permissions.deny.length === 0)
|
|
44254
44478
|
delete permissions.deny;
|
|
44255
44479
|
}
|
|
44480
|
+
if (tracker?.allow_added && permissions && Array.isArray(permissions.allow)) {
|
|
44481
|
+
const remove = new Set(tracker.allow_added);
|
|
44482
|
+
permissions.allow = permissions.allow.filter((entry2) => !remove.has(entry2));
|
|
44483
|
+
if (permissions.allow.length === 0)
|
|
44484
|
+
delete permissions.allow;
|
|
44485
|
+
}
|
|
44256
44486
|
const hooks = settings.hooks;
|
|
44257
44487
|
if (tracker?.hook_added && hooks && Array.isArray(hooks.PostToolUse)) {
|
|
44258
44488
|
const filtered = hooks.PostToolUse.filter((entry2) => !(entry2.hooks ?? []).some((h2) => h2.command?.includes("keynv redact-stream")));
|
|
@@ -44299,7 +44529,7 @@ var codexCli = {
|
|
|
44299
44529
|
summary: `[dry-run] would write ${CODEX_IGNORE_REL}`
|
|
44300
44530
|
};
|
|
44301
44531
|
}
|
|
44302
|
-
const changed = ensureKeynvBlock(path,
|
|
44532
|
+
const changed = ensureKeynvBlock(path, gitignoreBlock());
|
|
44303
44533
|
return {
|
|
44304
44534
|
agent: "codex",
|
|
44305
44535
|
applied: true,
|
|
@@ -44352,7 +44582,7 @@ var cursor = {
|
|
|
44352
44582
|
summary: `[dry-run] would write ${path}`
|
|
44353
44583
|
};
|
|
44354
44584
|
}
|
|
44355
|
-
const changed = ensureKeynvBlock(path,
|
|
44585
|
+
const changed = ensureKeynvBlock(path, gitignoreBlock());
|
|
44356
44586
|
return {
|
|
44357
44587
|
agent: "cursor",
|
|
44358
44588
|
applied: true,
|
|
@@ -44399,7 +44629,7 @@ var opencode = {
|
|
|
44399
44629
|
summary: `[dry-run] would write ${OPENCODE_IGNORE_REL}`
|
|
44400
44630
|
};
|
|
44401
44631
|
}
|
|
44402
|
-
const changed = ensureKeynvBlock(path,
|
|
44632
|
+
const changed = ensureKeynvBlock(path, gitignoreBlock());
|
|
44403
44633
|
return {
|
|
44404
44634
|
agent: "opencode",
|
|
44405
44635
|
applied: true,
|
|
@@ -44540,7 +44770,7 @@ async function promptHidden(prompt) {
|
|
|
44540
44770
|
process.stdin.setRawMode(true);
|
|
44541
44771
|
process.stdin.resume();
|
|
44542
44772
|
process.stdin.setEncoding("utf8");
|
|
44543
|
-
return new Promise((
|
|
44773
|
+
return new Promise((resolve2) => {
|
|
44544
44774
|
let buf = "";
|
|
44545
44775
|
const onData = (chunk) => {
|
|
44546
44776
|
for (const ch of chunk) {
|
|
@@ -44549,7 +44779,7 @@ async function promptHidden(prompt) {
|
|
|
44549
44779
|
process.stdin.pause();
|
|
44550
44780
|
process.stdin.removeListener("data", onData);
|
|
44551
44781
|
process.stdout.write("\n");
|
|
44552
|
-
|
|
44782
|
+
resolve2(buf);
|
|
44553
44783
|
return;
|
|
44554
44784
|
}
|
|
44555
44785
|
if (ch === "") {
|
|
@@ -44567,10 +44797,10 @@ async function promptHidden(prompt) {
|
|
|
44567
44797
|
}
|
|
44568
44798
|
async function promptLine(prompt) {
|
|
44569
44799
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
44570
|
-
return new Promise((
|
|
44800
|
+
return new Promise((resolve2) => {
|
|
44571
44801
|
rl.question(prompt, (answer) => {
|
|
44572
44802
|
rl.close();
|
|
44573
|
-
|
|
44803
|
+
resolve2(answer.trim());
|
|
44574
44804
|
});
|
|
44575
44805
|
});
|
|
44576
44806
|
}
|
|
@@ -44961,9 +45191,9 @@ streaming-mode limitation in @keynv/redactor).
|
|
|
44961
45191
|
`
|
|
44962
45192
|
});
|
|
44963
45193
|
async execute() {
|
|
44964
|
-
return new Promise((
|
|
45194
|
+
return new Promise((resolve2, reject) => {
|
|
44965
45195
|
const transform = createRedactStream();
|
|
44966
|
-
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () =>
|
|
45196
|
+
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () => resolve2(0));
|
|
44967
45197
|
this.context.stdin.on("error", reject);
|
|
44968
45198
|
});
|
|
44969
45199
|
}
|
|
@@ -45453,7 +45683,7 @@ var sshTester = {
|
|
|
45453
45683
|
async test(secret, target) {
|
|
45454
45684
|
const start = Date.now();
|
|
45455
45685
|
const { Client: Client2 } = await import('ssh2');
|
|
45456
|
-
return new Promise((
|
|
45686
|
+
return new Promise((resolve2) => {
|
|
45457
45687
|
const client = new Client2();
|
|
45458
45688
|
let settled = false;
|
|
45459
45689
|
const settle = (result) => {
|
|
@@ -45464,7 +45694,7 @@ var sshTester = {
|
|
|
45464
45694
|
client.end();
|
|
45465
45695
|
} catch {
|
|
45466
45696
|
}
|
|
45467
|
-
|
|
45697
|
+
resolve2(result);
|
|
45468
45698
|
};
|
|
45469
45699
|
client.once("ready", () => {
|
|
45470
45700
|
client.exec("true", (err, stream) => {
|
|
@@ -45530,12 +45760,12 @@ function sanitizeResult(result, secret) {
|
|
|
45530
45760
|
|
|
45531
45761
|
// ../../packages/testers/dist/run.js
|
|
45532
45762
|
function withTimeout(promise, ms) {
|
|
45533
|
-
return new Promise((
|
|
45763
|
+
return new Promise((resolve2, reject) => {
|
|
45534
45764
|
const t = setTimeout(() => reject(new Error(`tester timed out after ${ms}ms`)), ms);
|
|
45535
45765
|
t.unref();
|
|
45536
45766
|
promise.then((v2) => {
|
|
45537
45767
|
clearTimeout(t);
|
|
45538
|
-
|
|
45768
|
+
resolve2(v2);
|
|
45539
45769
|
}, (err) => {
|
|
45540
45770
|
clearTimeout(t);
|
|
45541
45771
|
reject(err);
|