@keynv/cli 0.1.0-rc.23 → 0.1.0-rc.24
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 +194 -154
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import * as nodePath from 'path';
|
|
4
|
-
import { relative, join, isAbsolute, resolve,
|
|
4
|
+
import { relative, join, isAbsolute, resolve, dirname, sep, basename } from 'path';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import { readFileSync, existsSync, writeFileSync, statSync, realpathSync, readdirSync, renameSync, mkdirSync, rmSync, constants as constants$1, lstatSync } from 'fs';
|
|
7
7
|
import { homedir, hostname, platform } from 'os';
|
|
@@ -1070,7 +1070,7 @@ var require_lib = __commonJS({
|
|
|
1070
1070
|
var VERSION, AGENT;
|
|
1071
1071
|
var init_version = __esm({
|
|
1072
1072
|
"src/version.ts"() {
|
|
1073
|
-
VERSION = "0.1.0-rc.
|
|
1073
|
+
VERSION = "0.1.0-rc.24" ;
|
|
1074
1074
|
AGENT = `keynv-cli/${VERSION}`;
|
|
1075
1075
|
}
|
|
1076
1076
|
});
|
|
@@ -1156,7 +1156,7 @@ function findAliasesInArgv(argv2) {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
return result;
|
|
1158
1158
|
}
|
|
1159
|
-
function replaceAliases(text,
|
|
1159
|
+
function replaceAliases(text, resolve6, opts = {}) {
|
|
1160
1160
|
if (typeof text !== "string" || text.length === 0)
|
|
1161
1161
|
return text;
|
|
1162
1162
|
const matches = findAliases(text, opts);
|
|
@@ -1167,7 +1167,7 @@ function replaceAliases(text, resolve4, opts = {}) {
|
|
|
1167
1167
|
const m = matches[i];
|
|
1168
1168
|
if (!m)
|
|
1169
1169
|
continue;
|
|
1170
|
-
const replacement =
|
|
1170
|
+
const replacement = resolve6(m);
|
|
1171
1171
|
if (parseAlias(replacement) !== null) {
|
|
1172
1172
|
throw new Error(`replaceAliases: resolved value for ${m.literal} is itself a valid alias (${replacement}). Circular or misconfigured resolution detected.`);
|
|
1173
1173
|
}
|
|
@@ -6223,12 +6223,12 @@ async function startRpcServer(registry) {
|
|
|
6223
6223
|
socket.on("error", () => {
|
|
6224
6224
|
});
|
|
6225
6225
|
});
|
|
6226
|
-
return new Promise((
|
|
6226
|
+
return new Promise((resolve6, reject) => {
|
|
6227
6227
|
server.once("error", reject);
|
|
6228
6228
|
server.listen(path, () => {
|
|
6229
6229
|
void chmodIfExists(path, 384).catch(() => {
|
|
6230
6230
|
});
|
|
6231
|
-
|
|
6231
|
+
resolve6({
|
|
6232
6232
|
socketPath: path,
|
|
6233
6233
|
close: () => new Promise((res) => {
|
|
6234
6234
|
server.close(() => res());
|
|
@@ -6290,7 +6290,7 @@ function handleLine(line, socket, registry) {
|
|
|
6290
6290
|
async function registerValueWithWatcher(value, timeoutMs = 200) {
|
|
6291
6291
|
if (value.length === 0) return null;
|
|
6292
6292
|
const path = socketPath();
|
|
6293
|
-
return new Promise((
|
|
6293
|
+
return new Promise((resolve6) => {
|
|
6294
6294
|
const socket = createConnection(path);
|
|
6295
6295
|
let buffer = "";
|
|
6296
6296
|
let settled = false;
|
|
@@ -6298,7 +6298,7 @@ async function registerValueWithWatcher(value, timeoutMs = 200) {
|
|
|
6298
6298
|
if (settled) return;
|
|
6299
6299
|
settled = true;
|
|
6300
6300
|
socket.destroy();
|
|
6301
|
-
|
|
6301
|
+
resolve6(result);
|
|
6302
6302
|
};
|
|
6303
6303
|
const timer = setTimeout(() => settle(null), timeoutMs);
|
|
6304
6304
|
socket.once("error", () => {
|
|
@@ -6626,20 +6626,30 @@ var init_collision = __esm({
|
|
|
6626
6626
|
KEY_RE3 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
6627
6627
|
}
|
|
6628
6628
|
});
|
|
6629
|
-
function findProjectRoot(startDir) {
|
|
6630
|
-
const
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
if (
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
}
|
|
6641
|
-
|
|
6642
|
-
|
|
6629
|
+
function findProjectRoot(startDir, boundaryDir = homedir()) {
|
|
6630
|
+
const start = resolve(startDir);
|
|
6631
|
+
const boundary = resolve(boundaryDir);
|
|
6632
|
+
let dir = start;
|
|
6633
|
+
for (let i = 0; i < 64; i++) {
|
|
6634
|
+
if (dir === boundary || isAncestorOf(dir, boundary)) break;
|
|
6635
|
+
const marker = markerAt(dir);
|
|
6636
|
+
if (marker) return buildRoot(dir, marker);
|
|
6637
|
+
const parent = dirname(dir);
|
|
6638
|
+
if (parent === dir) break;
|
|
6639
|
+
dir = parent;
|
|
6640
|
+
}
|
|
6641
|
+
return buildRoot(start, "current directory");
|
|
6642
|
+
}
|
|
6643
|
+
function markerAt(dir) {
|
|
6644
|
+
for (const marker of PROJECT_MARKERS) {
|
|
6645
|
+
if (existsSync(join(dir, marker))) return marker;
|
|
6646
|
+
}
|
|
6647
|
+
if (existsSync(join(dir, GIT_MARKER))) return GIT_MARKER;
|
|
6648
|
+
return null;
|
|
6649
|
+
}
|
|
6650
|
+
function isAncestorOf(ancestor, descendant) {
|
|
6651
|
+
const rel = relative(resolve(ancestor), resolve(descendant));
|
|
6652
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
6643
6653
|
}
|
|
6644
6654
|
function buildRoot(dir, marker) {
|
|
6645
6655
|
let suggestedName = basename(dir);
|
|
@@ -6671,6 +6681,7 @@ function buildRoot(dir, marker) {
|
|
|
6671
6681
|
function findEnvFilesRecursive(rootDir, opts = {}) {
|
|
6672
6682
|
const maxDepth = Math.max(1, opts.maxDepth ?? DEFAULT_MAX_DEPTH);
|
|
6673
6683
|
const ignore = opts.ignore ?? IGNORE_DIRS;
|
|
6684
|
+
const limit = Math.max(1, opts.limit ?? DEFAULT_MAX_RESULTS);
|
|
6674
6685
|
let rootReal;
|
|
6675
6686
|
try {
|
|
6676
6687
|
rootReal = realpathSync(rootDir);
|
|
@@ -6725,10 +6736,15 @@ function findEnvFilesRecursive(rootDir, opts = {}) {
|
|
|
6725
6736
|
relativeDir,
|
|
6726
6737
|
containingDir: dir
|
|
6727
6738
|
});
|
|
6739
|
+
if (hits.length >= limit) {
|
|
6740
|
+
queue.length = 0;
|
|
6741
|
+
break;
|
|
6742
|
+
}
|
|
6728
6743
|
continue;
|
|
6729
6744
|
}
|
|
6730
6745
|
if (isDir && depth + 1 < maxDepth) {
|
|
6731
6746
|
if (ignore.has(entry2.name)) continue;
|
|
6747
|
+
if (entry2.name.startsWith(".")) continue;
|
|
6732
6748
|
let realDir;
|
|
6733
6749
|
try {
|
|
6734
6750
|
realDir = realpathSync(full);
|
|
@@ -6776,10 +6792,9 @@ function suggestedEnvForSuffix(suffix) {
|
|
|
6776
6792
|
function hasExistingKeynvEnv(rootDir) {
|
|
6777
6793
|
return existsSync(join(rootDir, KEYNV_ENV_BASENAME));
|
|
6778
6794
|
}
|
|
6779
|
-
var PROJECT_MARKERS, GIT_MARKER, ENV_GLOB, ENV_EXAMPLE, KEYNV_ENV_BASENAME, KEYNV_ENV_EXCLUDE, IGNORE_DIRS, DEFAULT_MAX_DEPTH;
|
|
6795
|
+
var PROJECT_MARKERS, GIT_MARKER, ENV_GLOB, ENV_EXAMPLE, KEYNV_ENV_BASENAME, KEYNV_ENV_EXCLUDE, IGNORE_DIRS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_RESULTS;
|
|
6780
6796
|
var init_detect = __esm({
|
|
6781
6797
|
"src/init/detect.ts"() {
|
|
6782
|
-
init_fs();
|
|
6783
6798
|
PROJECT_MARKERS = [
|
|
6784
6799
|
"package.json",
|
|
6785
6800
|
"pyproject.toml",
|
|
@@ -6862,6 +6877,7 @@ var init_detect = __esm({
|
|
|
6862
6877
|
".fleet"
|
|
6863
6878
|
]);
|
|
6864
6879
|
DEFAULT_MAX_DEPTH = 5;
|
|
6880
|
+
DEFAULT_MAX_RESULTS = 100;
|
|
6865
6881
|
}
|
|
6866
6882
|
});
|
|
6867
6883
|
function shannonEntropyBits(s) {
|
|
@@ -9315,7 +9331,13 @@ async function runInitFlow(client, opts) {
|
|
|
9315
9331
|
if (root.packageJsonInvalid) {
|
|
9316
9332
|
R2.warn(`package.json at ${root.path} is not valid JSON \u2014 script wrapping will be skipped.`);
|
|
9317
9333
|
}
|
|
9318
|
-
const
|
|
9334
|
+
const atHome = resolve(root.path) === resolve(homedir());
|
|
9335
|
+
if (atHome) {
|
|
9336
|
+
R2.warn(
|
|
9337
|
+
"Running in your home directory \u2014 scanning only this folder, not the whole tree. cd into a project directory for a focused setup."
|
|
9338
|
+
);
|
|
9339
|
+
}
|
|
9340
|
+
const envFiles = findEnvFilesRecursive(root.path, atHome ? { maxDepth: 1 } : void 0);
|
|
9319
9341
|
const intoExisting = hasExistingKeynvEnv(root.path);
|
|
9320
9342
|
if (envFiles.length === 0 && !intoExisting) {
|
|
9321
9343
|
Se(
|
|
@@ -9334,22 +9356,40 @@ async function runInitFlow(client, opts) {
|
|
|
9334
9356
|
ye("Create your first secret with `keynv secret create`.");
|
|
9335
9357
|
return { exitCode: 0 };
|
|
9336
9358
|
}
|
|
9359
|
+
if (envFiles.length >= DEFAULT_MAX_RESULTS) {
|
|
9360
|
+
R2.warn(
|
|
9361
|
+
`Found ${envFiles.length}+ env files \u2014 that usually means keynv is running too high up the tree. Consider cd-ing into a specific project.`
|
|
9362
|
+
);
|
|
9363
|
+
}
|
|
9337
9364
|
Se(
|
|
9338
9365
|
[
|
|
9339
9366
|
`Project root: ${root.path}`,
|
|
9340
9367
|
`Marker: ${root.marker}`,
|
|
9341
|
-
envFiles.length
|
|
9342
|
-
${envFiles.map((f) => ` ${displayName(f)}`).join("\n")}` : "Found env files: (none)",
|
|
9368
|
+
envFiles.length === 0 ? "Found env files: (none)" : envFiles.length === 1 ? `Found env file: ${displayName(envFiles[0])}` : `Found ${envFiles.length} env files`,
|
|
9343
9369
|
intoExisting ? "Existing root .keynv.env detected \u2014 will merge new entries in." : ""
|
|
9344
9370
|
].filter(Boolean).join("\n"),
|
|
9345
9371
|
"Detected"
|
|
9346
9372
|
);
|
|
9373
|
+
let selectedFiles = envFiles;
|
|
9374
|
+
if (envFiles.length > 1) {
|
|
9375
|
+
const initialValues = envFiles.filter((f) => f.relativeDir === "").map((f) => f.path);
|
|
9376
|
+
const picked = unwrap(
|
|
9377
|
+
await ve({
|
|
9378
|
+
message: "Which env files do you want to import?",
|
|
9379
|
+
options: envFiles.map((f) => ({ value: f.path, label: displayName(f) })),
|
|
9380
|
+
initialValues,
|
|
9381
|
+
required: true
|
|
9382
|
+
})
|
|
9383
|
+
);
|
|
9384
|
+
const pickedSet = new Set(picked);
|
|
9385
|
+
selectedFiles = envFiles.filter((f) => pickedSet.has(f.path));
|
|
9386
|
+
}
|
|
9347
9387
|
const projectChoice = await pickOrCreateProject(client, root.suggestedName);
|
|
9348
9388
|
if (projectChoice === null) {
|
|
9349
9389
|
me("No project selected.");
|
|
9350
9390
|
return { exitCode: 130 };
|
|
9351
9391
|
}
|
|
9352
|
-
const fileMapping = await pickFileEnvMapping(
|
|
9392
|
+
const fileMapping = await pickFileEnvMapping(selectedFiles, projectChoice);
|
|
9353
9393
|
if (fileMapping === null) {
|
|
9354
9394
|
me("No env mapping selected.");
|
|
9355
9395
|
return { exitCode: 130 };
|
|
@@ -9461,7 +9501,7 @@ ${detail}`
|
|
|
9461
9501
|
for (const g of groups.values()) {
|
|
9462
9502
|
const dirs = [...new Set(g.sources.map((s) => s.source.relativeDir || "<root>"))];
|
|
9463
9503
|
if (dirs.length > 1) g.label = `${g.label} (shared by ${dirs.join(", ")})`;
|
|
9464
|
-
else if (
|
|
9504
|
+
else if (selectedFiles.some((f) => f.relativeDir !== "")) {
|
|
9465
9505
|
const only = dirs[0];
|
|
9466
9506
|
if (only && only !== "<root>") g.label = `${g.label} [${only}]`;
|
|
9467
9507
|
}
|
|
@@ -9638,7 +9678,7 @@ ${detail}`
|
|
|
9638
9678
|
);
|
|
9639
9679
|
}
|
|
9640
9680
|
}
|
|
9641
|
-
for (const f of
|
|
9681
|
+
for (const f of selectedFiles) {
|
|
9642
9682
|
const relSrc = relFromRoot(root.path, f.path);
|
|
9643
9683
|
try {
|
|
9644
9684
|
const { renamedTo } = backupEnvFile(f.path);
|
|
@@ -9881,7 +9921,7 @@ var init_tty = __esm({
|
|
|
9881
9921
|
}
|
|
9882
9922
|
});
|
|
9883
9923
|
function sleep(ms) {
|
|
9884
|
-
return new Promise((
|
|
9924
|
+
return new Promise((resolve6) => setTimeout(resolve6, ms));
|
|
9885
9925
|
}
|
|
9886
9926
|
async function errorMessage(res, fallback) {
|
|
9887
9927
|
const text = await res.text();
|
|
@@ -10145,16 +10185,16 @@ async function runSecretMenu(client, project, alias2) {
|
|
|
10145
10185
|
async function copyToClipboard(value) {
|
|
10146
10186
|
const platform4 = process.platform;
|
|
10147
10187
|
const cmd = platform4 === "darwin" ? ["pbcopy", []] : platform4 === "win32" ? ["clip", []] : ["xclip", ["-selection", "clipboard"]];
|
|
10148
|
-
return new Promise((
|
|
10188
|
+
return new Promise((resolve6) => {
|
|
10149
10189
|
try {
|
|
10150
10190
|
const child = spawn(cmd[0], cmd[1], {
|
|
10151
10191
|
stdio: ["pipe", "ignore", "ignore"]
|
|
10152
10192
|
});
|
|
10153
|
-
child.on("error", () =>
|
|
10154
|
-
child.on("exit", (code) =>
|
|
10193
|
+
child.on("error", () => resolve6(false));
|
|
10194
|
+
child.on("exit", (code) => resolve6(code === 0));
|
|
10155
10195
|
child.stdin.end(value);
|
|
10156
10196
|
} catch {
|
|
10157
|
-
|
|
10197
|
+
resolve6(false);
|
|
10158
10198
|
}
|
|
10159
10199
|
});
|
|
10160
10200
|
}
|
|
@@ -27082,11 +27122,11 @@ var require_connection = __commonJS({
|
|
|
27082
27122
|
const config = this.config;
|
|
27083
27123
|
tracePromise(
|
|
27084
27124
|
connectChannel,
|
|
27085
|
-
() => new Promise((
|
|
27125
|
+
() => new Promise((resolve6, reject) => {
|
|
27086
27126
|
let onConnect, onError;
|
|
27087
27127
|
onConnect = (param) => {
|
|
27088
27128
|
this.removeListener("error", onError);
|
|
27089
|
-
|
|
27129
|
+
resolve6(param);
|
|
27090
27130
|
};
|
|
27091
27131
|
onError = (err) => {
|
|
27092
27132
|
this.removeListener("connect", onConnect);
|
|
@@ -27511,9 +27551,9 @@ var require_connection = __commonJS({
|
|
|
27511
27551
|
} else if (shouldTrace(queryChannel)) {
|
|
27512
27552
|
tracePromise(
|
|
27513
27553
|
queryChannel,
|
|
27514
|
-
() => new Promise((
|
|
27554
|
+
() => new Promise((resolve6, reject) => {
|
|
27515
27555
|
cmdQuery.once("error", reject);
|
|
27516
|
-
cmdQuery.once("end", () =>
|
|
27556
|
+
cmdQuery.once("end", () => resolve6());
|
|
27517
27557
|
this.addCommand(cmdQuery);
|
|
27518
27558
|
}),
|
|
27519
27559
|
() => {
|
|
@@ -27660,12 +27700,12 @@ var require_connection = __commonJS({
|
|
|
27660
27700
|
} else if (shouldTrace(executeChannel)) {
|
|
27661
27701
|
tracePromise(
|
|
27662
27702
|
executeChannel,
|
|
27663
|
-
() => new Promise((
|
|
27703
|
+
() => new Promise((resolve6, reject) => {
|
|
27664
27704
|
prepareAndExecute((err) => {
|
|
27665
27705
|
executeCommand.emit("error", err);
|
|
27666
27706
|
});
|
|
27667
27707
|
executeCommand.once("error", reject);
|
|
27668
|
-
executeCommand.once("end", () =>
|
|
27708
|
+
executeCommand.once("end", () => resolve6());
|
|
27669
27709
|
}),
|
|
27670
27710
|
() => {
|
|
27671
27711
|
const server = getServerContext(this.config);
|
|
@@ -27930,13 +27970,13 @@ var require_capture_local_err = __commonJS({
|
|
|
27930
27970
|
var require_make_done_cb = __commonJS({
|
|
27931
27971
|
"../../node_modules/.pnpm/mysql2@3.22.3_@types+node@24.12.3/node_modules/mysql2/lib/promise/make_done_cb.js"(exports, module) {
|
|
27932
27972
|
var { applyCapturedStack } = require_capture_local_err();
|
|
27933
|
-
function makeDoneCb(
|
|
27973
|
+
function makeDoneCb(resolve6, reject, stackHolder) {
|
|
27934
27974
|
return function(err, rows, fields) {
|
|
27935
27975
|
if (err) {
|
|
27936
27976
|
applyCapturedStack(err, stackHolder);
|
|
27937
27977
|
reject(err);
|
|
27938
27978
|
} else {
|
|
27939
|
-
|
|
27979
|
+
resolve6([rows, fields]);
|
|
27940
27980
|
}
|
|
27941
27981
|
};
|
|
27942
27982
|
}
|
|
@@ -27959,8 +27999,8 @@ var require_prepared_statement_info = __commonJS({
|
|
|
27959
27999
|
const stackHolder = captureStackHolder(
|
|
27960
28000
|
_PromisePreparedStatementInfo.prototype.execute
|
|
27961
28001
|
);
|
|
27962
|
-
return new this.Promise((
|
|
27963
|
-
const done = makeDoneCb(
|
|
28002
|
+
return new this.Promise((resolve6, reject) => {
|
|
28003
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
27964
28004
|
if (parameters) {
|
|
27965
28005
|
s.execute(parameters, done);
|
|
27966
28006
|
} else {
|
|
@@ -27969,9 +28009,9 @@ var require_prepared_statement_info = __commonJS({
|
|
|
27969
28009
|
});
|
|
27970
28010
|
}
|
|
27971
28011
|
close() {
|
|
27972
|
-
return new this.Promise((
|
|
28012
|
+
return new this.Promise((resolve6) => {
|
|
27973
28013
|
this.statement.close();
|
|
27974
|
-
|
|
28014
|
+
resolve6();
|
|
27975
28015
|
});
|
|
27976
28016
|
}
|
|
27977
28017
|
};
|
|
@@ -28042,8 +28082,8 @@ var require_connection2 = __commonJS({
|
|
|
28042
28082
|
"Callback function is not available with promise clients."
|
|
28043
28083
|
);
|
|
28044
28084
|
}
|
|
28045
|
-
return new this.Promise((
|
|
28046
|
-
const done = makeDoneCb(
|
|
28085
|
+
return new this.Promise((resolve6, reject) => {
|
|
28086
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28047
28087
|
if (params !== void 0) {
|
|
28048
28088
|
c2.query(query, params, done);
|
|
28049
28089
|
} else {
|
|
@@ -28059,8 +28099,8 @@ var require_connection2 = __commonJS({
|
|
|
28059
28099
|
"Callback function is not available with promise clients."
|
|
28060
28100
|
);
|
|
28061
28101
|
}
|
|
28062
|
-
return new this.Promise((
|
|
28063
|
-
const done = makeDoneCb(
|
|
28102
|
+
return new this.Promise((resolve6, reject) => {
|
|
28103
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28064
28104
|
if (params !== void 0) {
|
|
28065
28105
|
c2.execute(query, params, done);
|
|
28066
28106
|
} else {
|
|
@@ -28069,8 +28109,8 @@ var require_connection2 = __commonJS({
|
|
|
28069
28109
|
});
|
|
28070
28110
|
}
|
|
28071
28111
|
end() {
|
|
28072
|
-
return new this.Promise((
|
|
28073
|
-
this.connection.end(
|
|
28112
|
+
return new this.Promise((resolve6) => {
|
|
28113
|
+
this.connection.end(resolve6);
|
|
28074
28114
|
});
|
|
28075
28115
|
}
|
|
28076
28116
|
async [Symbol.asyncDispose]() {
|
|
@@ -28083,16 +28123,16 @@ var require_connection2 = __commonJS({
|
|
|
28083
28123
|
const stackHolder = captureStackHolder(
|
|
28084
28124
|
_PromiseConnection.prototype.beginTransaction
|
|
28085
28125
|
);
|
|
28086
|
-
return new this.Promise((
|
|
28087
|
-
const done = makeDoneCb(
|
|
28126
|
+
return new this.Promise((resolve6, reject) => {
|
|
28127
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28088
28128
|
c2.beginTransaction(done);
|
|
28089
28129
|
});
|
|
28090
28130
|
}
|
|
28091
28131
|
commit() {
|
|
28092
28132
|
const c2 = this.connection;
|
|
28093
28133
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.commit);
|
|
28094
|
-
return new this.Promise((
|
|
28095
|
-
const done = makeDoneCb(
|
|
28134
|
+
return new this.Promise((resolve6, reject) => {
|
|
28135
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28096
28136
|
c2.commit(done);
|
|
28097
28137
|
});
|
|
28098
28138
|
}
|
|
@@ -28101,21 +28141,21 @@ var require_connection2 = __commonJS({
|
|
|
28101
28141
|
const stackHolder = captureStackHolder(
|
|
28102
28142
|
_PromiseConnection.prototype.rollback
|
|
28103
28143
|
);
|
|
28104
|
-
return new this.Promise((
|
|
28105
|
-
const done = makeDoneCb(
|
|
28144
|
+
return new this.Promise((resolve6, reject) => {
|
|
28145
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28106
28146
|
c2.rollback(done);
|
|
28107
28147
|
});
|
|
28108
28148
|
}
|
|
28109
28149
|
ping() {
|
|
28110
28150
|
const c2 = this.connection;
|
|
28111
28151
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.ping);
|
|
28112
|
-
return new this.Promise((
|
|
28152
|
+
return new this.Promise((resolve6, reject) => {
|
|
28113
28153
|
c2.ping((err) => {
|
|
28114
28154
|
if (err) {
|
|
28115
28155
|
applyCapturedStack(err, stackHolder);
|
|
28116
28156
|
reject(err);
|
|
28117
28157
|
} else {
|
|
28118
|
-
|
|
28158
|
+
resolve6(true);
|
|
28119
28159
|
}
|
|
28120
28160
|
});
|
|
28121
28161
|
});
|
|
@@ -28123,13 +28163,13 @@ var require_connection2 = __commonJS({
|
|
|
28123
28163
|
reset() {
|
|
28124
28164
|
const c2 = this.connection;
|
|
28125
28165
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.reset);
|
|
28126
|
-
return new this.Promise((
|
|
28166
|
+
return new this.Promise((resolve6, reject) => {
|
|
28127
28167
|
c2.reset((err) => {
|
|
28128
28168
|
if (err) {
|
|
28129
28169
|
applyCapturedStack(err, stackHolder);
|
|
28130
28170
|
reject(err);
|
|
28131
28171
|
} else {
|
|
28132
|
-
|
|
28172
|
+
resolve6();
|
|
28133
28173
|
}
|
|
28134
28174
|
});
|
|
28135
28175
|
});
|
|
@@ -28137,13 +28177,13 @@ var require_connection2 = __commonJS({
|
|
|
28137
28177
|
connect() {
|
|
28138
28178
|
const c2 = this.connection;
|
|
28139
28179
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.connect);
|
|
28140
|
-
return new this.Promise((
|
|
28180
|
+
return new this.Promise((resolve6, reject) => {
|
|
28141
28181
|
c2.connect((err, param) => {
|
|
28142
28182
|
if (err) {
|
|
28143
28183
|
applyCapturedStack(err, stackHolder);
|
|
28144
28184
|
reject(err);
|
|
28145
28185
|
} else {
|
|
28146
|
-
|
|
28186
|
+
resolve6(param);
|
|
28147
28187
|
}
|
|
28148
28188
|
});
|
|
28149
28189
|
});
|
|
@@ -28152,7 +28192,7 @@ var require_connection2 = __commonJS({
|
|
|
28152
28192
|
const c2 = this.connection;
|
|
28153
28193
|
const promiseImpl = this.Promise;
|
|
28154
28194
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.prepare);
|
|
28155
|
-
return new this.Promise((
|
|
28195
|
+
return new this.Promise((resolve6, reject) => {
|
|
28156
28196
|
c2.prepare(options, (err, statement) => {
|
|
28157
28197
|
if (err) {
|
|
28158
28198
|
applyCapturedStack(err, stackHolder);
|
|
@@ -28162,7 +28202,7 @@ var require_connection2 = __commonJS({
|
|
|
28162
28202
|
statement,
|
|
28163
28203
|
promiseImpl
|
|
28164
28204
|
);
|
|
28165
|
-
|
|
28205
|
+
resolve6(wrappedStatement);
|
|
28166
28206
|
}
|
|
28167
28207
|
});
|
|
28168
28208
|
});
|
|
@@ -28172,13 +28212,13 @@ var require_connection2 = __commonJS({
|
|
|
28172
28212
|
const stackHolder = captureStackHolder(
|
|
28173
28213
|
_PromiseConnection.prototype.changeUser
|
|
28174
28214
|
);
|
|
28175
|
-
return new this.Promise((
|
|
28215
|
+
return new this.Promise((resolve6, reject) => {
|
|
28176
28216
|
c2.changeUser(options, (err) => {
|
|
28177
28217
|
if (err) {
|
|
28178
28218
|
applyCapturedStack(err, stackHolder);
|
|
28179
28219
|
reject(err);
|
|
28180
28220
|
} else {
|
|
28181
|
-
|
|
28221
|
+
resolve6();
|
|
28182
28222
|
}
|
|
28183
28223
|
});
|
|
28184
28224
|
});
|
|
@@ -28640,12 +28680,12 @@ var require_pool2 = __commonJS({
|
|
|
28640
28680
|
}
|
|
28641
28681
|
getConnection() {
|
|
28642
28682
|
const corePool = this.pool;
|
|
28643
|
-
return new this.Promise((
|
|
28683
|
+
return new this.Promise((resolve6, reject) => {
|
|
28644
28684
|
corePool.getConnection((err, coreConnection) => {
|
|
28645
28685
|
if (err) {
|
|
28646
28686
|
reject(err);
|
|
28647
28687
|
} else {
|
|
28648
|
-
|
|
28688
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
28649
28689
|
}
|
|
28650
28690
|
});
|
|
28651
28691
|
});
|
|
@@ -28661,8 +28701,8 @@ var require_pool2 = __commonJS({
|
|
|
28661
28701
|
"Callback function is not available with promise clients."
|
|
28662
28702
|
);
|
|
28663
28703
|
}
|
|
28664
|
-
return new this.Promise((
|
|
28665
|
-
const done = makeDoneCb(
|
|
28704
|
+
return new this.Promise((resolve6, reject) => {
|
|
28705
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28666
28706
|
if (args !== void 0) {
|
|
28667
28707
|
corePool.query(sql, args, done);
|
|
28668
28708
|
} else {
|
|
@@ -28678,8 +28718,8 @@ var require_pool2 = __commonJS({
|
|
|
28678
28718
|
"Callback function is not available with promise clients."
|
|
28679
28719
|
);
|
|
28680
28720
|
}
|
|
28681
|
-
return new this.Promise((
|
|
28682
|
-
const done = makeDoneCb(
|
|
28721
|
+
return new this.Promise((resolve6, reject) => {
|
|
28722
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28683
28723
|
if (args) {
|
|
28684
28724
|
corePool.execute(sql, args, done);
|
|
28685
28725
|
} else {
|
|
@@ -28690,13 +28730,13 @@ var require_pool2 = __commonJS({
|
|
|
28690
28730
|
end() {
|
|
28691
28731
|
const corePool = this.pool;
|
|
28692
28732
|
const stackHolder = captureStackHolder(_PromisePool.prototype.end);
|
|
28693
|
-
return new this.Promise((
|
|
28733
|
+
return new this.Promise((resolve6, reject) => {
|
|
28694
28734
|
corePool.end((err) => {
|
|
28695
28735
|
if (err) {
|
|
28696
28736
|
applyCapturedStack(err, stackHolder);
|
|
28697
28737
|
reject(err);
|
|
28698
28738
|
} else {
|
|
28699
|
-
|
|
28739
|
+
resolve6();
|
|
28700
28740
|
}
|
|
28701
28741
|
});
|
|
28702
28742
|
});
|
|
@@ -29121,12 +29161,12 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29121
29161
|
}
|
|
29122
29162
|
getConnection() {
|
|
29123
29163
|
const corePoolNamespace = this.poolNamespace;
|
|
29124
|
-
return new this.Promise((
|
|
29164
|
+
return new this.Promise((resolve6, reject) => {
|
|
29125
29165
|
corePoolNamespace.getConnection((err, coreConnection) => {
|
|
29126
29166
|
if (err) {
|
|
29127
29167
|
reject(err);
|
|
29128
29168
|
} else {
|
|
29129
|
-
|
|
29169
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
29130
29170
|
}
|
|
29131
29171
|
});
|
|
29132
29172
|
});
|
|
@@ -29141,8 +29181,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29141
29181
|
"Callback function is not available with promise clients."
|
|
29142
29182
|
);
|
|
29143
29183
|
}
|
|
29144
|
-
return new this.Promise((
|
|
29145
|
-
const done = makeDoneCb(
|
|
29184
|
+
return new this.Promise((resolve6, reject) => {
|
|
29185
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29146
29186
|
corePoolNamespace.query(sql, values, done);
|
|
29147
29187
|
});
|
|
29148
29188
|
}
|
|
@@ -29156,8 +29196,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29156
29196
|
"Callback function is not available with promise clients."
|
|
29157
29197
|
);
|
|
29158
29198
|
}
|
|
29159
|
-
return new this.Promise((
|
|
29160
|
-
const done = makeDoneCb(
|
|
29199
|
+
return new this.Promise((resolve6, reject) => {
|
|
29200
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29161
29201
|
corePoolNamespace.execute(sql, values, done);
|
|
29162
29202
|
});
|
|
29163
29203
|
}
|
|
@@ -29195,9 +29235,9 @@ var require_promise = __commonJS({
|
|
|
29195
29235
|
"no Promise implementation available.Use promise-enabled node version or pass userland Promise implementation as parameter, for example: { Promise: require('bluebird') }"
|
|
29196
29236
|
);
|
|
29197
29237
|
}
|
|
29198
|
-
return new thePromise((
|
|
29238
|
+
return new thePromise((resolve6, reject) => {
|
|
29199
29239
|
coreConnection.once("connect", () => {
|
|
29200
|
-
|
|
29240
|
+
resolve6(new PromiseConnection(coreConnection, thePromise));
|
|
29201
29241
|
});
|
|
29202
29242
|
coreConnection.once("error", (err) => {
|
|
29203
29243
|
applyCapturedStack(err, stackHolder);
|
|
@@ -29224,7 +29264,7 @@ var require_promise = __commonJS({
|
|
|
29224
29264
|
}
|
|
29225
29265
|
getConnection(pattern, selector) {
|
|
29226
29266
|
const corePoolCluster = this.poolCluster;
|
|
29227
|
-
return new this.Promise((
|
|
29267
|
+
return new this.Promise((resolve6, reject) => {
|
|
29228
29268
|
corePoolCluster.getConnection(
|
|
29229
29269
|
pattern,
|
|
29230
29270
|
selector,
|
|
@@ -29232,7 +29272,7 @@ var require_promise = __commonJS({
|
|
|
29232
29272
|
if (err) {
|
|
29233
29273
|
reject(err);
|
|
29234
29274
|
} else {
|
|
29235
|
-
|
|
29275
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
29236
29276
|
}
|
|
29237
29277
|
}
|
|
29238
29278
|
);
|
|
@@ -29246,8 +29286,8 @@ var require_promise = __commonJS({
|
|
|
29246
29286
|
"Callback function is not available with promise clients."
|
|
29247
29287
|
);
|
|
29248
29288
|
}
|
|
29249
|
-
return new this.Promise((
|
|
29250
|
-
const done = makeDoneCb(
|
|
29289
|
+
return new this.Promise((resolve6, reject) => {
|
|
29290
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29251
29291
|
corePoolCluster.query(sql, args, done);
|
|
29252
29292
|
});
|
|
29253
29293
|
}
|
|
@@ -29261,8 +29301,8 @@ var require_promise = __commonJS({
|
|
|
29261
29301
|
"Callback function is not available with promise clients."
|
|
29262
29302
|
);
|
|
29263
29303
|
}
|
|
29264
|
-
return new this.Promise((
|
|
29265
|
-
const done = makeDoneCb(
|
|
29304
|
+
return new this.Promise((resolve6, reject) => {
|
|
29305
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29266
29306
|
corePoolCluster.execute(sql, args, done);
|
|
29267
29307
|
});
|
|
29268
29308
|
}
|
|
@@ -29275,13 +29315,13 @@ var require_promise = __commonJS({
|
|
|
29275
29315
|
end() {
|
|
29276
29316
|
const corePoolCluster = this.poolCluster;
|
|
29277
29317
|
const stackHolder = captureStackHolder(_PromisePoolCluster.prototype.end);
|
|
29278
|
-
return new this.Promise((
|
|
29318
|
+
return new this.Promise((resolve6, reject) => {
|
|
29279
29319
|
corePoolCluster.end((err) => {
|
|
29280
29320
|
if (err) {
|
|
29281
29321
|
applyCapturedStack(err, stackHolder);
|
|
29282
29322
|
reject(err);
|
|
29283
29323
|
} else {
|
|
29284
|
-
|
|
29324
|
+
resolve6();
|
|
29285
29325
|
}
|
|
29286
29326
|
});
|
|
29287
29327
|
});
|
|
@@ -32356,7 +32396,7 @@ var require_dist = __commonJS({
|
|
|
32356
32396
|
function parse(stream, callback) {
|
|
32357
32397
|
const parser = new parser_1.Parser();
|
|
32358
32398
|
stream.on("data", (buffer) => parser.parse(buffer, callback));
|
|
32359
|
-
return new Promise((
|
|
32399
|
+
return new Promise((resolve6) => stream.on("end", () => resolve6()));
|
|
32360
32400
|
}
|
|
32361
32401
|
exports.parse = parse;
|
|
32362
32402
|
}
|
|
@@ -33081,12 +33121,12 @@ var require_client2 = __commonJS({
|
|
|
33081
33121
|
this._connect(callback);
|
|
33082
33122
|
return;
|
|
33083
33123
|
}
|
|
33084
|
-
return new this._Promise((
|
|
33124
|
+
return new this._Promise((resolve6, reject) => {
|
|
33085
33125
|
this._connect((error) => {
|
|
33086
33126
|
if (error) {
|
|
33087
33127
|
reject(error);
|
|
33088
33128
|
} else {
|
|
33089
|
-
|
|
33129
|
+
resolve6(this);
|
|
33090
33130
|
}
|
|
33091
33131
|
});
|
|
33092
33132
|
});
|
|
@@ -33432,8 +33472,8 @@ var require_client2 = __commonJS({
|
|
|
33432
33472
|
readTimeout = config.query_timeout || this.connectionParameters.query_timeout;
|
|
33433
33473
|
query = new Query2(config, values, callback);
|
|
33434
33474
|
if (!query.callback) {
|
|
33435
|
-
result = new this._Promise((
|
|
33436
|
-
query.callback = (err, res) => err ? reject(err) :
|
|
33475
|
+
result = new this._Promise((resolve6, reject) => {
|
|
33476
|
+
query.callback = (err, res) => err ? reject(err) : resolve6(res);
|
|
33437
33477
|
}).catch((err) => {
|
|
33438
33478
|
Error.captureStackTrace(err);
|
|
33439
33479
|
throw err;
|
|
@@ -33510,8 +33550,8 @@ var require_client2 = __commonJS({
|
|
|
33510
33550
|
if (cb) {
|
|
33511
33551
|
this.connection.once("end", cb);
|
|
33512
33552
|
} else {
|
|
33513
|
-
return new this._Promise((
|
|
33514
|
-
this.connection.once("end",
|
|
33553
|
+
return new this._Promise((resolve6) => {
|
|
33554
|
+
this.connection.once("end", resolve6);
|
|
33515
33555
|
});
|
|
33516
33556
|
}
|
|
33517
33557
|
}
|
|
@@ -33559,8 +33599,8 @@ var require_pg_pool = __commonJS({
|
|
|
33559
33599
|
const cb = function(err, client) {
|
|
33560
33600
|
err ? rej(err) : res(client);
|
|
33561
33601
|
};
|
|
33562
|
-
const result = new Promise2(function(
|
|
33563
|
-
res =
|
|
33602
|
+
const result = new Promise2(function(resolve6, reject) {
|
|
33603
|
+
res = resolve6;
|
|
33564
33604
|
rej = reject;
|
|
33565
33605
|
}).catch((err) => {
|
|
33566
33606
|
Error.captureStackTrace(err);
|
|
@@ -33621,7 +33661,7 @@ var require_pg_pool = __commonJS({
|
|
|
33621
33661
|
if (typeof Promise2.try === "function") {
|
|
33622
33662
|
return Promise2.try(f);
|
|
33623
33663
|
}
|
|
33624
|
-
return new Promise2((
|
|
33664
|
+
return new Promise2((resolve6) => resolve6(f()));
|
|
33625
33665
|
}
|
|
33626
33666
|
_isFull() {
|
|
33627
33667
|
return this._clients.length >= this.options.max;
|
|
@@ -34013,8 +34053,8 @@ var require_query4 = __commonJS({
|
|
|
34013
34053
|
NativeQuery.prototype._getPromise = function() {
|
|
34014
34054
|
if (this._promise) return this._promise;
|
|
34015
34055
|
this._promise = new Promise(
|
|
34016
|
-
function(
|
|
34017
|
-
this._once("end",
|
|
34056
|
+
function(resolve6, reject) {
|
|
34057
|
+
this._once("end", resolve6);
|
|
34018
34058
|
this._once("error", reject);
|
|
34019
34059
|
}.bind(this)
|
|
34020
34060
|
);
|
|
@@ -34191,12 +34231,12 @@ var require_client3 = __commonJS({
|
|
|
34191
34231
|
this._connect(callback);
|
|
34192
34232
|
return;
|
|
34193
34233
|
}
|
|
34194
|
-
return new this._Promise((
|
|
34234
|
+
return new this._Promise((resolve6, reject) => {
|
|
34195
34235
|
this._connect((error) => {
|
|
34196
34236
|
if (error) {
|
|
34197
34237
|
reject(error);
|
|
34198
34238
|
} else {
|
|
34199
|
-
|
|
34239
|
+
resolve6(this);
|
|
34200
34240
|
}
|
|
34201
34241
|
});
|
|
34202
34242
|
});
|
|
@@ -34220,8 +34260,8 @@ var require_client3 = __commonJS({
|
|
|
34220
34260
|
query = new NativeQuery(config, values, callback);
|
|
34221
34261
|
if (!query.callback) {
|
|
34222
34262
|
let resolveOut, rejectOut;
|
|
34223
|
-
result = new this._Promise((
|
|
34224
|
-
resolveOut =
|
|
34263
|
+
result = new this._Promise((resolve6, reject) => {
|
|
34264
|
+
resolveOut = resolve6;
|
|
34225
34265
|
rejectOut = reject;
|
|
34226
34266
|
}).catch((err) => {
|
|
34227
34267
|
Error.captureStackTrace(err);
|
|
@@ -34281,8 +34321,8 @@ var require_client3 = __commonJS({
|
|
|
34281
34321
|
}
|
|
34282
34322
|
let result;
|
|
34283
34323
|
if (!cb) {
|
|
34284
|
-
result = new this._Promise(function(
|
|
34285
|
-
cb = (err) => err ? reject(err) :
|
|
34324
|
+
result = new this._Promise(function(resolve6, reject) {
|
|
34325
|
+
cb = (err) => err ? reject(err) : resolve6();
|
|
34286
34326
|
});
|
|
34287
34327
|
}
|
|
34288
34328
|
this.native.end(function() {
|
|
@@ -39389,7 +39429,7 @@ var require_Command = __commonJS({
|
|
|
39389
39429
|
}
|
|
39390
39430
|
}
|
|
39391
39431
|
initPromise() {
|
|
39392
|
-
const promise = new Promise((
|
|
39432
|
+
const promise = new Promise((resolve6, reject) => {
|
|
39393
39433
|
if (!this.transformed) {
|
|
39394
39434
|
this.transformed = true;
|
|
39395
39435
|
const transformer = _Command._transformer.argument[this.name];
|
|
@@ -39398,7 +39438,7 @@ var require_Command = __commonJS({
|
|
|
39398
39438
|
}
|
|
39399
39439
|
this.stringifyArguments();
|
|
39400
39440
|
}
|
|
39401
|
-
this.resolve = this._convertValue(
|
|
39441
|
+
this.resolve = this._convertValue(resolve6);
|
|
39402
39442
|
this.reject = (err) => {
|
|
39403
39443
|
this._clearTimers();
|
|
39404
39444
|
if (this.errorStack) {
|
|
@@ -39431,11 +39471,11 @@ var require_Command = __commonJS({
|
|
|
39431
39471
|
/**
|
|
39432
39472
|
* Convert the value from buffer to the target encoding.
|
|
39433
39473
|
*/
|
|
39434
|
-
_convertValue(
|
|
39474
|
+
_convertValue(resolve6) {
|
|
39435
39475
|
return (value) => {
|
|
39436
39476
|
try {
|
|
39437
39477
|
this._clearTimers();
|
|
39438
|
-
|
|
39478
|
+
resolve6(this.transformReply(value));
|
|
39439
39479
|
this.isResolved = true;
|
|
39440
39480
|
} catch (err) {
|
|
39441
39481
|
this.reject(err);
|
|
@@ -39713,13 +39753,13 @@ var require_autoPipelining = __commonJS({
|
|
|
39713
39753
|
if (client.isCluster && !client.slots.length) {
|
|
39714
39754
|
if (client.status === "wait")
|
|
39715
39755
|
client.connect().catch(lodash_1.noop);
|
|
39716
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
39756
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve6, reject) {
|
|
39717
39757
|
client.delayUntilReady((err) => {
|
|
39718
39758
|
if (err) {
|
|
39719
39759
|
reject(err);
|
|
39720
39760
|
return;
|
|
39721
39761
|
}
|
|
39722
|
-
executeWithAutoPipelining(client, functionName, commandName, args, null).then(
|
|
39762
|
+
executeWithAutoPipelining(client, functionName, commandName, args, null).then(resolve6, reject);
|
|
39723
39763
|
});
|
|
39724
39764
|
}), callback);
|
|
39725
39765
|
}
|
|
@@ -39740,13 +39780,13 @@ var require_autoPipelining = __commonJS({
|
|
|
39740
39780
|
pipeline[exports.kExec] = true;
|
|
39741
39781
|
setImmediate(executeAutoPipeline, client, slotKey);
|
|
39742
39782
|
}
|
|
39743
|
-
const autoPipelinePromise = new Promise(function(
|
|
39783
|
+
const autoPipelinePromise = new Promise(function(resolve6, reject) {
|
|
39744
39784
|
pipeline[exports.kCallbacks].push(function(err, value) {
|
|
39745
39785
|
if (err) {
|
|
39746
39786
|
reject(err);
|
|
39747
39787
|
return;
|
|
39748
39788
|
}
|
|
39749
|
-
|
|
39789
|
+
resolve6(value);
|
|
39750
39790
|
});
|
|
39751
39791
|
if (functionName === "call") {
|
|
39752
39792
|
args.unshift(commandName);
|
|
@@ -39981,8 +40021,8 @@ var require_Pipeline = __commonJS({
|
|
|
39981
40021
|
this[name] = redis[name];
|
|
39982
40022
|
this[name + "Buffer"] = redis[name + "Buffer"];
|
|
39983
40023
|
});
|
|
39984
|
-
this.promise = new Promise((
|
|
39985
|
-
this.resolve =
|
|
40024
|
+
this.promise = new Promise((resolve6, reject) => {
|
|
40025
|
+
this.resolve = resolve6;
|
|
39986
40026
|
this.reject = reject;
|
|
39987
40027
|
});
|
|
39988
40028
|
const _this = this;
|
|
@@ -40282,13 +40322,13 @@ var require_transaction = __commonJS({
|
|
|
40282
40322
|
if (this.isCluster && !this.redis.slots.length) {
|
|
40283
40323
|
if (this.redis.status === "wait")
|
|
40284
40324
|
this.redis.connect().catch(utils_1.noop);
|
|
40285
|
-
return (0, standard_as_callback_1.default)(new Promise((
|
|
40325
|
+
return (0, standard_as_callback_1.default)(new Promise((resolve6, reject) => {
|
|
40286
40326
|
this.redis.delayUntilReady((err) => {
|
|
40287
40327
|
if (err) {
|
|
40288
40328
|
reject(err);
|
|
40289
40329
|
return;
|
|
40290
40330
|
}
|
|
40291
|
-
this.exec(pipeline).then(
|
|
40331
|
+
this.exec(pipeline).then(resolve6, reject);
|
|
40292
40332
|
});
|
|
40293
40333
|
}), callback);
|
|
40294
40334
|
}
|
|
@@ -41417,7 +41457,7 @@ var require_cluster = __commonJS({
|
|
|
41417
41457
|
* Connect to a cluster
|
|
41418
41458
|
*/
|
|
41419
41459
|
connect() {
|
|
41420
|
-
return new Promise((
|
|
41460
|
+
return new Promise((resolve6, reject) => {
|
|
41421
41461
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
41422
41462
|
reject(new Error("Redis is already connecting/connected"));
|
|
41423
41463
|
return;
|
|
@@ -41446,7 +41486,7 @@ var require_cluster = __commonJS({
|
|
|
41446
41486
|
this.retryAttempts = 0;
|
|
41447
41487
|
this.executeOfflineCommands();
|
|
41448
41488
|
this.resetNodesRefreshInterval();
|
|
41449
|
-
|
|
41489
|
+
resolve6();
|
|
41450
41490
|
};
|
|
41451
41491
|
let closeListener = void 0;
|
|
41452
41492
|
const refreshListener = () => {
|
|
@@ -42056,7 +42096,7 @@ var require_cluster = __commonJS({
|
|
|
42056
42096
|
});
|
|
42057
42097
|
}
|
|
42058
42098
|
resolveSrv(hostname2) {
|
|
42059
|
-
return new Promise((
|
|
42099
|
+
return new Promise((resolve6, reject) => {
|
|
42060
42100
|
this.options.resolveSrv(hostname2, (err, records) => {
|
|
42061
42101
|
if (err) {
|
|
42062
42102
|
return reject(err);
|
|
@@ -42070,7 +42110,7 @@ var require_cluster = __commonJS({
|
|
|
42070
42110
|
if (!group.records.length) {
|
|
42071
42111
|
sortedKeys.shift();
|
|
42072
42112
|
}
|
|
42073
|
-
self2.dnsLookup(record.name).then((host) =>
|
|
42113
|
+
self2.dnsLookup(record.name).then((host) => resolve6({
|
|
42074
42114
|
host,
|
|
42075
42115
|
port: record.port
|
|
42076
42116
|
}), tryFirstOne);
|
|
@@ -42080,14 +42120,14 @@ var require_cluster = __commonJS({
|
|
|
42080
42120
|
});
|
|
42081
42121
|
}
|
|
42082
42122
|
dnsLookup(hostname2) {
|
|
42083
|
-
return new Promise((
|
|
42123
|
+
return new Promise((resolve6, reject) => {
|
|
42084
42124
|
this.options.dnsLookup(hostname2, (err, address) => {
|
|
42085
42125
|
if (err) {
|
|
42086
42126
|
debug2("failed to resolve hostname %s to IP: %s", hostname2, err.message);
|
|
42087
42127
|
reject(err);
|
|
42088
42128
|
} else {
|
|
42089
42129
|
debug2("resolved hostname %s to IP %s", hostname2, address);
|
|
42090
|
-
|
|
42130
|
+
resolve6(address);
|
|
42091
42131
|
}
|
|
42092
42132
|
});
|
|
42093
42133
|
});
|
|
@@ -42242,7 +42282,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
42242
42282
|
if (options.tls) {
|
|
42243
42283
|
Object.assign(connectionOptions, options.tls);
|
|
42244
42284
|
}
|
|
42245
|
-
return new Promise((
|
|
42285
|
+
return new Promise((resolve6, reject) => {
|
|
42246
42286
|
process.nextTick(() => {
|
|
42247
42287
|
if (!this.connecting) {
|
|
42248
42288
|
reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
|
|
@@ -42261,7 +42301,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
42261
42301
|
this.stream.once("error", (err) => {
|
|
42262
42302
|
this.firstError = err;
|
|
42263
42303
|
});
|
|
42264
|
-
|
|
42304
|
+
resolve6(this.stream);
|
|
42265
42305
|
});
|
|
42266
42306
|
});
|
|
42267
42307
|
}
|
|
@@ -42417,7 +42457,7 @@ var require_SentinelConnector = __commonJS({
|
|
|
42417
42457
|
const error = new Error(errorMsg);
|
|
42418
42458
|
if (typeof retryDelay === "number") {
|
|
42419
42459
|
eventEmitter("error", error);
|
|
42420
|
-
await new Promise((
|
|
42460
|
+
await new Promise((resolve6) => setTimeout(resolve6, retryDelay));
|
|
42421
42461
|
return connectToNext();
|
|
42422
42462
|
} else {
|
|
42423
42463
|
throw error;
|
|
@@ -43734,7 +43774,7 @@ var require_Redis = __commonJS({
|
|
|
43734
43774
|
* if the connection fails, times out, or if Redis is already connecting/connected.
|
|
43735
43775
|
*/
|
|
43736
43776
|
connect(callback) {
|
|
43737
|
-
const promise = new Promise((
|
|
43777
|
+
const promise = new Promise((resolve6, reject) => {
|
|
43738
43778
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
43739
43779
|
reject(new Error("Redis is already connecting/connected"));
|
|
43740
43780
|
return;
|
|
@@ -43813,7 +43853,7 @@ var require_Redis = __commonJS({
|
|
|
43813
43853
|
}
|
|
43814
43854
|
const connectionReadyHandler = function() {
|
|
43815
43855
|
_this.removeListener("close", connectionCloseHandler);
|
|
43816
|
-
|
|
43856
|
+
resolve6();
|
|
43817
43857
|
};
|
|
43818
43858
|
var connectionCloseHandler = function() {
|
|
43819
43859
|
_this.removeListener("ready", connectionReadyHandler);
|
|
@@ -43907,10 +43947,10 @@ var require_Redis = __commonJS({
|
|
|
43907
43947
|
monitor: true,
|
|
43908
43948
|
lazyConnect: false
|
|
43909
43949
|
});
|
|
43910
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
43950
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve6, reject) {
|
|
43911
43951
|
monitorInstance.once("error", reject);
|
|
43912
43952
|
monitorInstance.once("monitoring", function() {
|
|
43913
|
-
|
|
43953
|
+
resolve6(monitorInstance);
|
|
43914
43954
|
});
|
|
43915
43955
|
}), callback);
|
|
43916
43956
|
}
|
|
@@ -47884,7 +47924,7 @@ function resolverSocketPath() {
|
|
|
47884
47924
|
}
|
|
47885
47925
|
function resolveReferenceToken(token, timeoutMs = 5e3) {
|
|
47886
47926
|
const path = resolverSocketPath();
|
|
47887
|
-
return new Promise((
|
|
47927
|
+
return new Promise((resolve6) => {
|
|
47888
47928
|
const socket = createConnection(path);
|
|
47889
47929
|
let buffer = "";
|
|
47890
47930
|
let settled = false;
|
|
@@ -47892,7 +47932,7 @@ function resolveReferenceToken(token, timeoutMs = 5e3) {
|
|
|
47892
47932
|
if (settled) return;
|
|
47893
47933
|
settled = true;
|
|
47894
47934
|
socket.destroy();
|
|
47895
|
-
|
|
47935
|
+
resolve6(result);
|
|
47896
47936
|
};
|
|
47897
47937
|
const timer = setTimeout(
|
|
47898
47938
|
() => settle({ ok: false, error: "timed out waiting for keynv-mcp resolver" }),
|
|
@@ -48095,7 +48135,7 @@ function spawnPrivileged(opts) {
|
|
|
48095
48135
|
}, opts.timeoutS * 1e3);
|
|
48096
48136
|
timer.unref();
|
|
48097
48137
|
}
|
|
48098
|
-
return new Promise((
|
|
48138
|
+
return new Promise((resolve6, reject) => {
|
|
48099
48139
|
child.on("error", (err) => {
|
|
48100
48140
|
if (timer) clearTimeout(timer);
|
|
48101
48141
|
clearSensitiveReferences(env2, literals);
|
|
@@ -48104,7 +48144,7 @@ function spawnPrivileged(opts) {
|
|
|
48104
48144
|
child.on("close", (code, signal) => {
|
|
48105
48145
|
if (timer) clearTimeout(timer);
|
|
48106
48146
|
clearSensitiveReferences(env2, literals);
|
|
48107
|
-
|
|
48147
|
+
resolve6({
|
|
48108
48148
|
exitCode: code ?? 0,
|
|
48109
48149
|
signal,
|
|
48110
48150
|
durationMs: Date.now() - startedAt
|
|
@@ -49049,7 +49089,7 @@ async function promptHidden(prompt) {
|
|
|
49049
49089
|
process.stdin.setRawMode(true);
|
|
49050
49090
|
process.stdin.resume();
|
|
49051
49091
|
process.stdin.setEncoding("utf8");
|
|
49052
|
-
return new Promise((
|
|
49092
|
+
return new Promise((resolve6) => {
|
|
49053
49093
|
let buf = "";
|
|
49054
49094
|
const onData = (chunk) => {
|
|
49055
49095
|
for (const ch of chunk) {
|
|
@@ -49058,7 +49098,7 @@ async function promptHidden(prompt) {
|
|
|
49058
49098
|
process.stdin.pause();
|
|
49059
49099
|
process.stdin.removeListener("data", onData);
|
|
49060
49100
|
process.stdout.write("\n");
|
|
49061
|
-
|
|
49101
|
+
resolve6(buf);
|
|
49062
49102
|
return;
|
|
49063
49103
|
}
|
|
49064
49104
|
if (ch === "") {
|
|
@@ -49076,10 +49116,10 @@ async function promptHidden(prompt) {
|
|
|
49076
49116
|
}
|
|
49077
49117
|
async function promptLine(prompt) {
|
|
49078
49118
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
49079
|
-
return new Promise((
|
|
49119
|
+
return new Promise((resolve6) => {
|
|
49080
49120
|
rl.question(prompt, (answer) => {
|
|
49081
49121
|
rl.close();
|
|
49082
|
-
|
|
49122
|
+
resolve6(answer.trim());
|
|
49083
49123
|
});
|
|
49084
49124
|
});
|
|
49085
49125
|
}
|
|
@@ -49474,9 +49514,9 @@ here (see the streaming-mode limitation in the redactor package).
|
|
|
49474
49514
|
`
|
|
49475
49515
|
});
|
|
49476
49516
|
async execute() {
|
|
49477
|
-
return new Promise((
|
|
49517
|
+
return new Promise((resolve6, reject) => {
|
|
49478
49518
|
const transform = createRedactStream();
|
|
49479
|
-
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () =>
|
|
49519
|
+
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () => resolve6(0));
|
|
49480
49520
|
this.context.stdin.on("error", reject);
|
|
49481
49521
|
});
|
|
49482
49522
|
}
|
|
@@ -49738,11 +49778,11 @@ async function copyToClipboard2(value) {
|
|
|
49738
49778
|
);
|
|
49739
49779
|
}
|
|
49740
49780
|
function pipeToCommand(cmd, args, input) {
|
|
49741
|
-
return new Promise((
|
|
49781
|
+
return new Promise((resolve6, reject) => {
|
|
49742
49782
|
const child = spawn(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
49743
49783
|
child.on("error", reject);
|
|
49744
49784
|
child.on("close", (code) => {
|
|
49745
|
-
if (code === 0)
|
|
49785
|
+
if (code === 0) resolve6();
|
|
49746
49786
|
else reject(new Error(`${cmd} exited with code ${code}`));
|
|
49747
49787
|
});
|
|
49748
49788
|
child.stdin.on("error", reject);
|
|
@@ -50966,7 +51006,7 @@ var sshTester = {
|
|
|
50966
51006
|
}
|
|
50967
51007
|
const start = Date.now();
|
|
50968
51008
|
const { Client: Client2 } = await import('ssh2');
|
|
50969
|
-
return new Promise((
|
|
51009
|
+
return new Promise((resolve6) => {
|
|
50970
51010
|
const client = new Client2();
|
|
50971
51011
|
let settled = false;
|
|
50972
51012
|
const settle = (result) => {
|
|
@@ -50977,7 +51017,7 @@ var sshTester = {
|
|
|
50977
51017
|
client.end();
|
|
50978
51018
|
} catch {
|
|
50979
51019
|
}
|
|
50980
|
-
|
|
51020
|
+
resolve6(result);
|
|
50981
51021
|
};
|
|
50982
51022
|
client.once("ready", () => {
|
|
50983
51023
|
client.exec("true", (err, stream) => {
|
|
@@ -51062,12 +51102,12 @@ function sanitizeResult(result, secret) {
|
|
|
51062
51102
|
|
|
51063
51103
|
// ../../packages/testers/dist/run.js
|
|
51064
51104
|
function withTimeout(promise, ms) {
|
|
51065
|
-
return new Promise((
|
|
51105
|
+
return new Promise((resolve6, reject) => {
|
|
51066
51106
|
const t = setTimeout(() => reject(new Error(`tester timed out after ${ms}ms`)), ms);
|
|
51067
51107
|
t.unref();
|
|
51068
51108
|
promise.then((v2) => {
|
|
51069
51109
|
clearTimeout(t);
|
|
51070
|
-
|
|
51110
|
+
resolve6(v2);
|
|
51071
51111
|
}, (err) => {
|
|
51072
51112
|
clearTimeout(t);
|
|
51073
51113
|
reject(err);
|
|
@@ -51428,8 +51468,8 @@ async function runWatcher(options = {}) {
|
|
|
51428
51468
|
awaitWriteFinish: false,
|
|
51429
51469
|
...options.usePolling ? { usePolling: true, interval: 500 } : {}
|
|
51430
51470
|
});
|
|
51431
|
-
const readyPromise2 = new Promise((
|
|
51432
|
-
watcher.once("ready", () =>
|
|
51471
|
+
const readyPromise2 = new Promise((resolve6) => {
|
|
51472
|
+
watcher.once("ready", () => resolve6());
|
|
51433
51473
|
});
|
|
51434
51474
|
watcher.on("add", (path) => {
|
|
51435
51475
|
if (matchesExt(path)) filesWatched += 1;
|