@connxio/cli 0.1.1 → 0.1.3
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.mjs +1301 -141
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { execFile, spawn } from "node:child_process";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import fs from "node:fs";
|
|
4
|
+
import path, { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import fs, { createWriteStream } from "node:fs";
|
|
6
6
|
import process$1, { env, stdin, stdout } from "node:process";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { format, promisify } from "node:util";
|
|
9
|
-
import os, { homedir } from "node:os";
|
|
9
|
+
import os, { homedir, tmpdir } from "node:os";
|
|
10
10
|
import os$1 from "os";
|
|
11
11
|
import path$1 from "path";
|
|
12
12
|
import tty from "node:tty";
|
|
13
13
|
import { createInterface } from "node:readline/promises";
|
|
14
|
-
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
14
|
+
import { mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
15
|
+
import { randomUUID } from "node:crypto";
|
|
15
16
|
//#region \0rolldown/runtime.js
|
|
16
17
|
var __create = Object.create;
|
|
17
18
|
var __defProp = Object.defineProperty;
|
|
@@ -1050,17 +1051,17 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1050
1051
|
//#endregion
|
|
1051
1052
|
//#region node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js
|
|
1052
1053
|
var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1053
|
-
const EventEmitter = __require("node:events").EventEmitter;
|
|
1054
|
+
const EventEmitter$1 = __require("node:events").EventEmitter;
|
|
1054
1055
|
const childProcess = __require("node:child_process");
|
|
1055
1056
|
const path$9 = __require("node:path");
|
|
1056
|
-
const fs$
|
|
1057
|
+
const fs$9 = __require("node:fs");
|
|
1057
1058
|
const process$3 = __require("node:process");
|
|
1058
1059
|
const { Argument, humanReadableArgName } = require_argument();
|
|
1059
1060
|
const { CommanderError } = require_error();
|
|
1060
1061
|
const { Help, stripColor } = require_help();
|
|
1061
1062
|
const { Option, DualOptions } = require_option();
|
|
1062
1063
|
const { suggestSimilar } = require_suggestSimilar();
|
|
1063
|
-
var Command = class Command extends EventEmitter {
|
|
1064
|
+
var Command = class Command extends EventEmitter$1 {
|
|
1064
1065
|
/**
|
|
1065
1066
|
* Initialize a new `Command`.
|
|
1066
1067
|
*
|
|
@@ -1949,7 +1950,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1949
1950
|
* @param {string} subcommandName
|
|
1950
1951
|
*/
|
|
1951
1952
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1952
|
-
if (fs$
|
|
1953
|
+
if (fs$9.existsSync(executableFile)) return;
|
|
1953
1954
|
const executableMissing = `'${executableFile}' does not exist
|
|
1954
1955
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
1955
1956
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -1973,9 +1974,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1973
1974
|
];
|
|
1974
1975
|
function findFile(baseDir, baseName) {
|
|
1975
1976
|
const localBin = path$9.resolve(baseDir, baseName);
|
|
1976
|
-
if (fs$
|
|
1977
|
+
if (fs$9.existsSync(localBin)) return localBin;
|
|
1977
1978
|
if (sourceExt.includes(path$9.extname(baseName))) return void 0;
|
|
1978
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
1979
|
+
const foundExt = sourceExt.find((ext) => fs$9.existsSync(`${localBin}${ext}`));
|
|
1979
1980
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1980
1981
|
}
|
|
1981
1982
|
this._checkForMissingMandatoryOptions();
|
|
@@ -1985,7 +1986,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1985
1986
|
if (this._scriptPath) {
|
|
1986
1987
|
let resolvedScriptPath;
|
|
1987
1988
|
try {
|
|
1988
|
-
resolvedScriptPath = fs$
|
|
1989
|
+
resolvedScriptPath = fs$9.realpathSync(this._scriptPath);
|
|
1989
1990
|
} catch {
|
|
1990
1991
|
resolvedScriptPath = this._scriptPath;
|
|
1991
1992
|
}
|
|
@@ -3407,11 +3408,11 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3407
3408
|
//#endregion
|
|
3408
3409
|
//#region node_modules/.pnpm/xdg-basedir@5.1.0/node_modules/xdg-basedir/index.js
|
|
3409
3410
|
var import_graceful_fs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3410
|
-
var fs$
|
|
3411
|
+
var fs$8 = __require("fs");
|
|
3411
3412
|
var polyfills = require_polyfills$1();
|
|
3412
3413
|
var legacy = require_legacy_streams$1();
|
|
3413
3414
|
var clone = require_clone$1();
|
|
3414
|
-
var util$
|
|
3415
|
+
var util$3 = __require("util");
|
|
3415
3416
|
/* istanbul ignore next - node 0.x polyfill */
|
|
3416
3417
|
var gracefulQueue;
|
|
3417
3418
|
var previousSymbol;
|
|
@@ -3430,42 +3431,42 @@ var import_graceful_fs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(
|
|
|
3430
3431
|
} });
|
|
3431
3432
|
}
|
|
3432
3433
|
var debug = noop;
|
|
3433
|
-
if (util$
|
|
3434
|
+
if (util$3.debuglog) debug = util$3.debuglog("gfs4");
|
|
3434
3435
|
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
3435
|
-
var m = util$
|
|
3436
|
+
var m = util$3.format.apply(util$3, arguments);
|
|
3436
3437
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
3437
3438
|
console.error(m);
|
|
3438
3439
|
};
|
|
3439
|
-
if (!fs$
|
|
3440
|
-
publishQueue(fs$
|
|
3441
|
-
fs$
|
|
3440
|
+
if (!fs$8[gracefulQueue]) {
|
|
3441
|
+
publishQueue(fs$8, global[gracefulQueue] || []);
|
|
3442
|
+
fs$8.close = (function(fs$close) {
|
|
3442
3443
|
function close(fd, cb) {
|
|
3443
|
-
return fs$close.call(fs$
|
|
3444
|
+
return fs$close.call(fs$8, fd, function(err) {
|
|
3444
3445
|
if (!err) resetQueue();
|
|
3445
3446
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
3446
3447
|
});
|
|
3447
3448
|
}
|
|
3448
3449
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
3449
3450
|
return close;
|
|
3450
|
-
})(fs$
|
|
3451
|
-
fs$
|
|
3451
|
+
})(fs$8.close);
|
|
3452
|
+
fs$8.closeSync = (function(fs$closeSync) {
|
|
3452
3453
|
function closeSync(fd) {
|
|
3453
|
-
fs$closeSync.apply(fs$
|
|
3454
|
+
fs$closeSync.apply(fs$8, arguments);
|
|
3454
3455
|
resetQueue();
|
|
3455
3456
|
}
|
|
3456
3457
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
3457
3458
|
return closeSync;
|
|
3458
|
-
})(fs$
|
|
3459
|
+
})(fs$8.closeSync);
|
|
3459
3460
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
3460
|
-
debug(fs$
|
|
3461
|
-
__require("assert").equal(fs$
|
|
3461
|
+
debug(fs$8[gracefulQueue]);
|
|
3462
|
+
__require("assert").equal(fs$8[gracefulQueue].length, 0);
|
|
3462
3463
|
});
|
|
3463
3464
|
}
|
|
3464
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
3465
|
-
module.exports = patch(clone(fs$
|
|
3466
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
3467
|
-
module.exports = patch(fs$
|
|
3468
|
-
fs$
|
|
3465
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$8[gracefulQueue]);
|
|
3466
|
+
module.exports = patch(clone(fs$8));
|
|
3467
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$8.__patched) {
|
|
3468
|
+
module.exports = patch(fs$8);
|
|
3469
|
+
fs$8.__patched = true;
|
|
3469
3470
|
}
|
|
3470
3471
|
function patch(fs) {
|
|
3471
3472
|
polyfills(fs);
|
|
@@ -3720,23 +3721,23 @@ var import_graceful_fs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(
|
|
|
3720
3721
|
}
|
|
3721
3722
|
function enqueue(elem) {
|
|
3722
3723
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
3723
|
-
fs$
|
|
3724
|
+
fs$8[gracefulQueue].push(elem);
|
|
3724
3725
|
retry();
|
|
3725
3726
|
}
|
|
3726
3727
|
var retryTimer;
|
|
3727
3728
|
function resetQueue() {
|
|
3728
3729
|
var now = Date.now();
|
|
3729
|
-
for (var i = 0; i < fs$
|
|
3730
|
-
fs$
|
|
3731
|
-
fs$
|
|
3730
|
+
for (var i = 0; i < fs$8[gracefulQueue].length; ++i) if (fs$8[gracefulQueue][i].length > 2) {
|
|
3731
|
+
fs$8[gracefulQueue][i][3] = now;
|
|
3732
|
+
fs$8[gracefulQueue][i][4] = now;
|
|
3732
3733
|
}
|
|
3733
3734
|
retry();
|
|
3734
3735
|
}
|
|
3735
3736
|
function retry() {
|
|
3736
3737
|
clearTimeout(retryTimer);
|
|
3737
3738
|
retryTimer = void 0;
|
|
3738
|
-
if (fs$
|
|
3739
|
-
var elem = fs$
|
|
3739
|
+
if (fs$8[gracefulQueue].length === 0) return;
|
|
3740
|
+
var elem = fs$8[gracefulQueue].shift();
|
|
3740
3741
|
var fn = elem[0];
|
|
3741
3742
|
var args = elem[1];
|
|
3742
3743
|
var err = elem[2];
|
|
@@ -3755,7 +3756,7 @@ var import_graceful_fs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(
|
|
|
3755
3756
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
3756
3757
|
debug("RETRY", fn.name, args);
|
|
3757
3758
|
fn.apply(null, args.concat([startTime]));
|
|
3758
|
-
} else fs$
|
|
3759
|
+
} else fs$8[gracefulQueue].push(elem);
|
|
3759
3760
|
}
|
|
3760
3761
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
3761
3762
|
}
|
|
@@ -6066,7 +6067,7 @@ var require_strip_json_comments = /* @__PURE__ */ __commonJSMin(((exports, modul
|
|
|
6066
6067
|
//#endregion
|
|
6067
6068
|
//#region node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
|
|
6068
6069
|
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6069
|
-
var fs$
|
|
6070
|
+
var fs$6 = __require("fs");
|
|
6070
6071
|
var ini = require_ini$1();
|
|
6071
6072
|
var path$8 = __require("path");
|
|
6072
6073
|
var stripJsonComments = require_strip_json_comments();
|
|
@@ -6081,7 +6082,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6081
6082
|
for (var i in args) if ("string" !== typeof args[i]) return;
|
|
6082
6083
|
var file = path$8.join.apply(null, args);
|
|
6083
6084
|
try {
|
|
6084
|
-
return fs$
|
|
6085
|
+
return fs$6.readFileSync(file, "utf-8");
|
|
6085
6086
|
} catch (err) {
|
|
6086
6087
|
return;
|
|
6087
6088
|
}
|
|
@@ -6113,7 +6114,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6113
6114
|
function find(start, rel) {
|
|
6114
6115
|
var file = path$8.join(start, rel);
|
|
6115
6116
|
try {
|
|
6116
|
-
fs$
|
|
6117
|
+
fs$6.statSync(file);
|
|
6117
6118
|
return file;
|
|
6118
6119
|
} catch (err) {
|
|
6119
6120
|
if (path$8.dirname(start) !== start) return find(path$8.dirname(start), rel);
|
|
@@ -6394,7 +6395,7 @@ var require_minimist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6394
6395
|
//#region node_modules/.pnpm/registry-url@6.0.1/node_modules/registry-url/index.js
|
|
6395
6396
|
var import_rc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6396
6397
|
var cc = require_utils$1();
|
|
6397
|
-
var join = __require("path").join;
|
|
6398
|
+
var join$1 = __require("path").join;
|
|
6398
6399
|
var deepExtend = require_deep_extend();
|
|
6399
6400
|
var etc = "/etc";
|
|
6400
6401
|
var win = process.platform === "win32";
|
|
@@ -6415,12 +6416,12 @@ var import_rc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports
|
|
|
6415
6416
|
configFiles.push(file);
|
|
6416
6417
|
}
|
|
6417
6418
|
}
|
|
6418
|
-
if (!win) [join(etc, name, "config"), join(etc, name + "rc")].forEach(addConfigFile);
|
|
6419
|
+
if (!win) [join$1(etc, name, "config"), join$1(etc, name + "rc")].forEach(addConfigFile);
|
|
6419
6420
|
if (home) [
|
|
6420
|
-
join(home, ".config", name, "config"),
|
|
6421
|
-
join(home, ".config", name),
|
|
6422
|
-
join(home, "." + name, "config"),
|
|
6423
|
-
join(home, "." + name + "rc")
|
|
6421
|
+
join$1(home, ".config", name, "config"),
|
|
6422
|
+
join$1(home, ".config", name),
|
|
6423
|
+
join$1(home, "." + name, "config"),
|
|
6424
|
+
join$1(home, "." + name + "rc")
|
|
6424
6425
|
].forEach(addConfigFile);
|
|
6425
6426
|
addConfigFile(cc.find("." + name + "rc"));
|
|
6426
6427
|
if (env.config) addConfigFile(env.config);
|
|
@@ -6801,11 +6802,11 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6801
6802
|
//#endregion
|
|
6802
6803
|
//#region node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
|
|
6803
6804
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6804
|
-
var fs$
|
|
6805
|
+
var fs$5 = __require("fs");
|
|
6805
6806
|
var polyfills = require_polyfills();
|
|
6806
6807
|
var legacy = require_legacy_streams();
|
|
6807
6808
|
var clone = require_clone();
|
|
6808
|
-
var util$
|
|
6809
|
+
var util$2 = __require("util");
|
|
6809
6810
|
/* istanbul ignore next - node 0.x polyfill */
|
|
6810
6811
|
var gracefulQueue;
|
|
6811
6812
|
var previousSymbol;
|
|
@@ -6824,42 +6825,42 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6824
6825
|
} });
|
|
6825
6826
|
}
|
|
6826
6827
|
var debug = noop;
|
|
6827
|
-
if (util$
|
|
6828
|
+
if (util$2.debuglog) debug = util$2.debuglog("gfs4");
|
|
6828
6829
|
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
6829
|
-
var m = util$
|
|
6830
|
+
var m = util$2.format.apply(util$2, arguments);
|
|
6830
6831
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
6831
6832
|
console.error(m);
|
|
6832
6833
|
};
|
|
6833
|
-
if (!fs$
|
|
6834
|
-
publishQueue(fs$
|
|
6835
|
-
fs$
|
|
6834
|
+
if (!fs$5[gracefulQueue]) {
|
|
6835
|
+
publishQueue(fs$5, global[gracefulQueue] || []);
|
|
6836
|
+
fs$5.close = (function(fs$close) {
|
|
6836
6837
|
function close(fd, cb) {
|
|
6837
|
-
return fs$close.call(fs$
|
|
6838
|
+
return fs$close.call(fs$5, fd, function(err) {
|
|
6838
6839
|
if (!err) resetQueue();
|
|
6839
6840
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
6840
6841
|
});
|
|
6841
6842
|
}
|
|
6842
6843
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
6843
6844
|
return close;
|
|
6844
|
-
})(fs$
|
|
6845
|
-
fs$
|
|
6845
|
+
})(fs$5.close);
|
|
6846
|
+
fs$5.closeSync = (function(fs$closeSync) {
|
|
6846
6847
|
function closeSync(fd) {
|
|
6847
|
-
fs$closeSync.apply(fs$
|
|
6848
|
+
fs$closeSync.apply(fs$5, arguments);
|
|
6848
6849
|
resetQueue();
|
|
6849
6850
|
}
|
|
6850
6851
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
6851
6852
|
return closeSync;
|
|
6852
|
-
})(fs$
|
|
6853
|
+
})(fs$5.closeSync);
|
|
6853
6854
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
6854
|
-
debug(fs$
|
|
6855
|
-
__require("assert").equal(fs$
|
|
6855
|
+
debug(fs$5[gracefulQueue]);
|
|
6856
|
+
__require("assert").equal(fs$5[gracefulQueue].length, 0);
|
|
6856
6857
|
});
|
|
6857
6858
|
}
|
|
6858
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
6859
|
-
module.exports = patch(clone(fs$
|
|
6860
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
6861
|
-
module.exports = patch(fs$
|
|
6862
|
-
fs$
|
|
6859
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$5[gracefulQueue]);
|
|
6860
|
+
module.exports = patch(clone(fs$5));
|
|
6861
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$5.__patched) {
|
|
6862
|
+
module.exports = patch(fs$5);
|
|
6863
|
+
fs$5.__patched = true;
|
|
6863
6864
|
}
|
|
6864
6865
|
function patch(fs) {
|
|
6865
6866
|
polyfills(fs);
|
|
@@ -7114,23 +7115,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7114
7115
|
}
|
|
7115
7116
|
function enqueue(elem) {
|
|
7116
7117
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
7117
|
-
fs$
|
|
7118
|
+
fs$5[gracefulQueue].push(elem);
|
|
7118
7119
|
retry();
|
|
7119
7120
|
}
|
|
7120
7121
|
var retryTimer;
|
|
7121
7122
|
function resetQueue() {
|
|
7122
7123
|
var now = Date.now();
|
|
7123
|
-
for (var i = 0; i < fs$
|
|
7124
|
-
fs$
|
|
7125
|
-
fs$
|
|
7124
|
+
for (var i = 0; i < fs$5[gracefulQueue].length; ++i) if (fs$5[gracefulQueue][i].length > 2) {
|
|
7125
|
+
fs$5[gracefulQueue][i][3] = now;
|
|
7126
|
+
fs$5[gracefulQueue][i][4] = now;
|
|
7126
7127
|
}
|
|
7127
7128
|
retry();
|
|
7128
7129
|
}
|
|
7129
7130
|
function retry() {
|
|
7130
7131
|
clearTimeout(retryTimer);
|
|
7131
7132
|
retryTimer = void 0;
|
|
7132
|
-
if (fs$
|
|
7133
|
-
var elem = fs$
|
|
7133
|
+
if (fs$5[gracefulQueue].length === 0) return;
|
|
7134
|
+
var elem = fs$5[gracefulQueue].shift();
|
|
7134
7135
|
var fn = elem[0];
|
|
7135
7136
|
var args = elem[1];
|
|
7136
7137
|
var err = elem[2];
|
|
@@ -7149,7 +7150,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7149
7150
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
7150
7151
|
debug("RETRY", fn.name, args);
|
|
7151
7152
|
fn.apply(null, args.concat([startTime]));
|
|
7152
|
-
} else fs$
|
|
7153
|
+
} else fs$5[gracefulQueue].push(elem);
|
|
7153
7154
|
}
|
|
7154
7155
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
7155
7156
|
}
|
|
@@ -7177,7 +7178,7 @@ var require_ca_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7177
7178
|
}));
|
|
7178
7179
|
//#endregion
|
|
7179
7180
|
//#region node_modules/.pnpm/@pnpm+network.ca-file@1.0.2/node_modules/@pnpm/network.ca-file/dist/index.js
|
|
7180
|
-
var require_dist$
|
|
7181
|
+
var require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7181
7182
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
7182
7183
|
if (k2 === void 0) k2 = k;
|
|
7183
7184
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -7282,7 +7283,7 @@ var require_proto_list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7282
7283
|
//#endregion
|
|
7283
7284
|
//#region node_modules/.pnpm/config-chain@1.1.13/node_modules/config-chain/index.js
|
|
7284
7285
|
var require_config_chain = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7285
|
-
var ProtoList = require_proto_list(), path$7 = __require("path"), fs$
|
|
7286
|
+
var ProtoList = require_proto_list(), path$7 = __require("path"), fs$4 = __require("fs"), ini$1 = require_ini$1(), EE = __require("events").EventEmitter, url$1 = __require("url"), http = __require("http");
|
|
7286
7287
|
var exports = module.exports = function() {
|
|
7287
7288
|
var args = [].slice.call(arguments), conf = new ConfigChain();
|
|
7288
7289
|
while (args.length) {
|
|
@@ -7296,7 +7297,7 @@ var require_config_chain = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7296
7297
|
function find(start, rel) {
|
|
7297
7298
|
var file = path$7.join(start, rel);
|
|
7298
7299
|
try {
|
|
7299
|
-
fs$
|
|
7300
|
+
fs$4.statSync(file);
|
|
7300
7301
|
return file;
|
|
7301
7302
|
} catch (err) {
|
|
7302
7303
|
if (path$7.dirname(start) !== start) return find(path$7.dirname(start), rel);
|
|
@@ -7326,7 +7327,7 @@ var require_config_chain = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7326
7327
|
var file = path$7.join.apply(null, args);
|
|
7327
7328
|
var content;
|
|
7328
7329
|
try {
|
|
7329
|
-
content = fs$
|
|
7330
|
+
content = fs$4.readFileSync(file, "utf-8");
|
|
7330
7331
|
} catch (err) {
|
|
7331
7332
|
return;
|
|
7332
7333
|
}
|
|
@@ -7399,7 +7400,7 @@ var require_config_chain = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7399
7400
|
if (target.type === "json") data = JSON.stringify(data);
|
|
7400
7401
|
else data = ini$1.stringify(data);
|
|
7401
7402
|
this._saving++;
|
|
7402
|
-
fs$
|
|
7403
|
+
fs$4.writeFile(target.path, data, "utf8", function(er) {
|
|
7403
7404
|
this._saving--;
|
|
7404
7405
|
if (er) if (cb) return cb(er);
|
|
7405
7406
|
else return this.emit("error", er);
|
|
@@ -7419,7 +7420,7 @@ var require_config_chain = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7419
7420
|
};
|
|
7420
7421
|
this.push(marker);
|
|
7421
7422
|
this._await();
|
|
7422
|
-
fs$
|
|
7423
|
+
fs$4.readFile(file, "utf8", function(er, data) {
|
|
7423
7424
|
if (er) this.emit("error", er);
|
|
7424
7425
|
this.addString(data, file, type, marker);
|
|
7425
7426
|
}.bind(this));
|
|
@@ -7535,7 +7536,7 @@ var require_env_replace = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7535
7536
|
}));
|
|
7536
7537
|
//#endregion
|
|
7537
7538
|
//#region node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/index.js
|
|
7538
|
-
var require_dist$
|
|
7539
|
+
var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7539
7540
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7540
7541
|
exports.envReplace = void 0;
|
|
7541
7542
|
var env_replace_1 = require_env_replace();
|
|
@@ -7549,9 +7550,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7549
7550
|
//#endregion
|
|
7550
7551
|
//#region node_modules/.pnpm/@pnpm+npm-conf@3.0.2/node_modules/@pnpm/npm-conf/lib/util.js
|
|
7551
7552
|
var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7552
|
-
const fs$
|
|
7553
|
+
const fs$3 = __require("fs");
|
|
7553
7554
|
const path$6 = __require("path");
|
|
7554
|
-
const { envReplace } = require_dist$
|
|
7555
|
+
const { envReplace } = require_dist$2();
|
|
7555
7556
|
const parseKey = (key) => {
|
|
7556
7557
|
if (typeof key !== "string") return key;
|
|
7557
7558
|
return envReplace(key, process.env);
|
|
@@ -7597,7 +7598,7 @@ var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7597
7598
|
const find = (name, original) => {
|
|
7598
7599
|
if (name === "/" || process.platform === "win32" && /^[a-zA-Z]:(\\|\/)?$/.test(name)) return original;
|
|
7599
7600
|
try {
|
|
7600
|
-
const files = fs$
|
|
7601
|
+
const files = fs$3.readdirSync(name);
|
|
7601
7602
|
if (files.includes("node_modules") || files.includes("package.json") || files.includes("package.json5") || files.includes("package.yaml") || files.includes("pnpm-workspace.yaml")) return name;
|
|
7602
7603
|
const dirname = path$6.dirname(name);
|
|
7603
7604
|
if (dirname === name) return original;
|
|
@@ -7805,8 +7806,8 @@ var require_types$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7805
7806
|
//#endregion
|
|
7806
7807
|
//#region node_modules/.pnpm/@pnpm+npm-conf@3.0.2/node_modules/@pnpm/npm-conf/lib/conf.js
|
|
7807
7808
|
var require_conf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7808
|
-
const { readCAFileSync } = require_dist$
|
|
7809
|
-
const fs$
|
|
7809
|
+
const { readCAFileSync } = require_dist$3();
|
|
7810
|
+
const fs$2 = __require("fs");
|
|
7810
7811
|
const path$4 = __require("path");
|
|
7811
7812
|
const { ConfigChain } = require_config_chain();
|
|
7812
7813
|
const envKeyToSetting = require_envKeyToSetting();
|
|
@@ -7839,7 +7840,7 @@ var require_conf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7839
7840
|
this.push(marker);
|
|
7840
7841
|
this._await();
|
|
7841
7842
|
try {
|
|
7842
|
-
const contents = fs$
|
|
7843
|
+
const contents = fs$2.readFileSync(file, "utf8");
|
|
7843
7844
|
this.addString(contents, file, "ini", marker);
|
|
7844
7845
|
} catch (error) {
|
|
7845
7846
|
if (error.code === "ENOENT") this.add({}, marker);
|
|
@@ -7910,7 +7911,7 @@ var require_conf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7910
7911
|
}
|
|
7911
7912
|
const prefix = path$4.resolve(this.get("prefix"));
|
|
7912
7913
|
try {
|
|
7913
|
-
defConf.user = fs$
|
|
7914
|
+
defConf.user = fs$2.statSync(prefix).uid;
|
|
7914
7915
|
} catch (error) {
|
|
7915
7916
|
if (error.code === "ENOENT") return;
|
|
7916
7917
|
throw error;
|
|
@@ -11221,7 +11222,7 @@ function updateNotifier(options) {
|
|
|
11221
11222
|
//#endregion
|
|
11222
11223
|
//#region packages/cli/package.json
|
|
11223
11224
|
var name = "@connxio/cli";
|
|
11224
|
-
var version$1 = "0.1.
|
|
11225
|
+
var version$1 = "0.1.3";
|
|
11225
11226
|
var package_default = {
|
|
11226
11227
|
name,
|
|
11227
11228
|
version: version$1,
|
|
@@ -11244,15 +11245,19 @@ var package_default = {
|
|
|
11244
11245
|
type: "module",
|
|
11245
11246
|
types: "./dist/index.d.mts",
|
|
11246
11247
|
exports: { ".": "./dist/index.mjs" },
|
|
11248
|
+
publishConfig: { "access": "public" },
|
|
11247
11249
|
dependencies: {
|
|
11248
11250
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
11249
11251
|
"commander": "^14.0.3",
|
|
11250
11252
|
"update-notifier": "^7.3.1",
|
|
11253
|
+
"yazl": "^3.3.1",
|
|
11251
11254
|
"zod": "^4.4.3"
|
|
11252
11255
|
},
|
|
11253
|
-
devDependencies: {
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
+
devDependencies: {
|
|
11257
|
+
"@types/update-notifier": "^6.0.8",
|
|
11258
|
+
"@types/yazl": "^2.4.5"
|
|
11259
|
+
},
|
|
11260
|
+
engines: { "node": ">=20" }
|
|
11256
11261
|
};
|
|
11257
11262
|
//#endregion
|
|
11258
11263
|
//#region packages/cli/src/connxio/config.ts
|
|
@@ -11285,7 +11290,7 @@ async function writeConfig(config) {
|
|
|
11285
11290
|
await rename(temporaryPath, configPath);
|
|
11286
11291
|
}
|
|
11287
11292
|
function parseConfig(value) {
|
|
11288
|
-
if (!isRecord$
|
|
11293
|
+
if (!isRecord$4(value)) throw new Error(`Invalid Connxio config at ${getConfigPath()}: expected an object.`);
|
|
11289
11294
|
const contextsValue = value.contexts;
|
|
11290
11295
|
const contexts = Array.isArray(contextsValue) ? contextsValue.map(parseContext) : [];
|
|
11291
11296
|
const defaultContext = typeof value.defaultContext === "string" ? value.defaultContext : void 0;
|
|
@@ -11297,7 +11302,7 @@ function parseConfig(value) {
|
|
|
11297
11302
|
};
|
|
11298
11303
|
}
|
|
11299
11304
|
function parseOAuth(value) {
|
|
11300
|
-
if (!isRecord$
|
|
11305
|
+
if (!isRecord$4(value)) throw new Error(`Invalid Connxio config at ${getConfigPath()}: oauth must be an object.`);
|
|
11301
11306
|
if (typeof value.clientId !== "string" || typeof value.clientSecretRef !== "string" || value.tokenUrl !== void 0 && typeof value.tokenUrl !== "string") throw new Error(`Invalid Connxio config at ${getConfigPath()}: oauth fields must be strings.`);
|
|
11302
11307
|
return {
|
|
11303
11308
|
clientId: value.clientId,
|
|
@@ -11307,7 +11312,7 @@ function parseOAuth(value) {
|
|
|
11307
11312
|
};
|
|
11308
11313
|
}
|
|
11309
11314
|
function parseContext(value) {
|
|
11310
|
-
if (!isRecord$
|
|
11315
|
+
if (!isRecord$4(value)) throw new Error(`Invalid Connxio config at ${getConfigPath()}: context must be an object.`);
|
|
11311
11316
|
if (typeof value.apiKeyRef !== "string" || typeof value.baseUrl !== "string" || typeof value.companyId !== "string" || typeof value.companyName !== "string" || typeof value.id !== "string" || typeof value.name !== "string" || typeof value.subscriptionId !== "string" || typeof value.subscriptionName !== "string") throw new Error(`Invalid Connxio config at ${getConfigPath()}: context fields must be strings.`);
|
|
11312
11317
|
return {
|
|
11313
11318
|
apiKeyRef: value.apiKeyRef,
|
|
@@ -11320,7 +11325,7 @@ function parseContext(value) {
|
|
|
11320
11325
|
subscriptionName: value.subscriptionName
|
|
11321
11326
|
};
|
|
11322
11327
|
}
|
|
11323
|
-
function isRecord$
|
|
11328
|
+
function isRecord$4(value) {
|
|
11324
11329
|
return typeof value === "object" && value !== null;
|
|
11325
11330
|
}
|
|
11326
11331
|
function isNodeError$1(error) {
|
|
@@ -11403,7 +11408,7 @@ async function writeCredentialFile(store) {
|
|
|
11403
11408
|
await rename(temporaryPath, credentialPath);
|
|
11404
11409
|
}
|
|
11405
11410
|
function isCredentialFile(value) {
|
|
11406
|
-
if (!isRecord$
|
|
11411
|
+
if (!isRecord$3(value) || !isStringRecord(value.apiKeys)) return false;
|
|
11407
11412
|
const oauthClientSecrets = value.oauthClientSecrets === void 0 ? {} : value.oauthClientSecrets;
|
|
11408
11413
|
if (!isStringRecord(oauthClientSecrets)) return false;
|
|
11409
11414
|
value.oauthClientSecrets = oauthClientSecrets;
|
|
@@ -11415,11 +11420,11 @@ function emptyCredentialFile() {
|
|
|
11415
11420
|
oauthClientSecrets: {}
|
|
11416
11421
|
};
|
|
11417
11422
|
}
|
|
11418
|
-
function isRecord$
|
|
11423
|
+
function isRecord$3(value) {
|
|
11419
11424
|
return typeof value === "object" && value !== null;
|
|
11420
11425
|
}
|
|
11421
11426
|
function isStringRecord(value) {
|
|
11422
|
-
return isRecord$
|
|
11427
|
+
return isRecord$3(value) && Object.values(value).every((item) => typeof item === "string");
|
|
11423
11428
|
}
|
|
11424
11429
|
function isNodeError(error) {
|
|
11425
11430
|
return error instanceof Error && "code" in error;
|
|
@@ -11564,14 +11569,14 @@ function normalizeTokenUrl(value) {
|
|
|
11564
11569
|
}
|
|
11565
11570
|
}
|
|
11566
11571
|
function parseTokenResponse(value) {
|
|
11567
|
-
if (!isRecord$
|
|
11572
|
+
if (!isRecord$2(value) || typeof value.access_token !== "string") throw new Error("Connxio OAuth token response did not include an access token.");
|
|
11568
11573
|
const expiresIn = typeof value.expires_in === "number" ? value.expires_in : 3600;
|
|
11569
11574
|
return {
|
|
11570
11575
|
expiresAt: Date.now() + expiresIn * 1e3,
|
|
11571
11576
|
token: value.access_token
|
|
11572
11577
|
};
|
|
11573
11578
|
}
|
|
11574
|
-
function isRecord$
|
|
11579
|
+
function isRecord$2(value) {
|
|
11575
11580
|
return typeof value === "object" && value !== null;
|
|
11576
11581
|
}
|
|
11577
11582
|
function formatError$3(error) {
|
|
@@ -11724,7 +11729,7 @@ function isHttpDebugEnabled() {
|
|
|
11724
11729
|
return value === "1" || value === "true" || value === "yes";
|
|
11725
11730
|
}
|
|
11726
11731
|
function parseSubscription(value) {
|
|
11727
|
-
if (!isRecord(value)) throw new Error("Connxio subscriptions response contained an invalid subscription.");
|
|
11732
|
+
if (!isRecord$1(value)) throw new Error("Connxio subscriptions response contained an invalid subscription.");
|
|
11728
11733
|
if (typeof value.active !== "boolean" || typeof value.companyId !== "string" || typeof value.companyName !== "string" || typeof value.id !== "string" || typeof value.name !== "string") throw new Error("Connxio subscriptions response contained an invalid subscription.");
|
|
11729
11734
|
return {
|
|
11730
11735
|
active: value.active,
|
|
@@ -11739,7 +11744,7 @@ function buildRequestUrl(baseUrl, requestPath) {
|
|
|
11739
11744
|
const normalizedPath = requestPath.startsWith("/") ? requestPath.slice(1) : requestPath;
|
|
11740
11745
|
return new URL(normalizedPath, normalizedBaseUrl);
|
|
11741
11746
|
}
|
|
11742
|
-
function isRecord(value) {
|
|
11747
|
+
function isRecord$1(value) {
|
|
11743
11748
|
return typeof value === "object" && value !== null;
|
|
11744
11749
|
}
|
|
11745
11750
|
function formatError$2(error) {
|
|
@@ -11827,7 +11832,7 @@ async function setDefaultContext(id) {
|
|
|
11827
11832
|
}
|
|
11828
11833
|
//#endregion
|
|
11829
11834
|
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/util.js
|
|
11830
|
-
var util;
|
|
11835
|
+
var util$1;
|
|
11831
11836
|
(function(util) {
|
|
11832
11837
|
util.assertEqual = (_) => {};
|
|
11833
11838
|
function assertIs(_arg) {}
|
|
@@ -11869,7 +11874,7 @@ var util;
|
|
|
11869
11874
|
if (typeof value === "bigint") return value.toString();
|
|
11870
11875
|
return value;
|
|
11871
11876
|
};
|
|
11872
|
-
})(util || (util = {}));
|
|
11877
|
+
})(util$1 || (util$1 = {}));
|
|
11873
11878
|
var objectUtil;
|
|
11874
11879
|
(function(objectUtil) {
|
|
11875
11880
|
objectUtil.mergeShapes = (first, second) => {
|
|
@@ -11879,7 +11884,7 @@ var objectUtil;
|
|
|
11879
11884
|
};
|
|
11880
11885
|
};
|
|
11881
11886
|
})(objectUtil || (objectUtil = {}));
|
|
11882
|
-
const ZodParsedType = util.arrayToEnum([
|
|
11887
|
+
const ZodParsedType = util$1.arrayToEnum([
|
|
11883
11888
|
"string",
|
|
11884
11889
|
"nan",
|
|
11885
11890
|
"number",
|
|
@@ -11923,7 +11928,7 @@ const getParsedType = (data) => {
|
|
|
11923
11928
|
};
|
|
11924
11929
|
//#endregion
|
|
11925
11930
|
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/ZodError.js
|
|
11926
|
-
const ZodIssueCode = util.arrayToEnum([
|
|
11931
|
+
const ZodIssueCode = util$1.arrayToEnum([
|
|
11927
11932
|
"invalid_type",
|
|
11928
11933
|
"invalid_literal",
|
|
11929
11934
|
"custom",
|
|
@@ -11995,7 +12000,7 @@ var ZodError = class ZodError extends Error {
|
|
|
11995
12000
|
return this.message;
|
|
11996
12001
|
}
|
|
11997
12002
|
get message() {
|
|
11998
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
12003
|
+
return JSON.stringify(this.issues, util$1.jsonStringifyReplacer, 2);
|
|
11999
12004
|
}
|
|
12000
12005
|
get isEmpty() {
|
|
12001
12006
|
return this.issues.length === 0;
|
|
@@ -12030,19 +12035,19 @@ const errorMap = (issue, _ctx) => {
|
|
|
12030
12035
|
else message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
12031
12036
|
break;
|
|
12032
12037
|
case ZodIssueCode.invalid_literal:
|
|
12033
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
12038
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$1.jsonStringifyReplacer)}`;
|
|
12034
12039
|
break;
|
|
12035
12040
|
case ZodIssueCode.unrecognized_keys:
|
|
12036
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
12041
|
+
message = `Unrecognized key(s) in object: ${util$1.joinValues(issue.keys, ", ")}`;
|
|
12037
12042
|
break;
|
|
12038
12043
|
case ZodIssueCode.invalid_union:
|
|
12039
12044
|
message = `Invalid input`;
|
|
12040
12045
|
break;
|
|
12041
12046
|
case ZodIssueCode.invalid_union_discriminator:
|
|
12042
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
12047
|
+
message = `Invalid discriminator value. Expected ${util$1.joinValues(issue.options)}`;
|
|
12043
12048
|
break;
|
|
12044
12049
|
case ZodIssueCode.invalid_enum_value:
|
|
12045
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
12050
|
+
message = `Invalid enum value. Expected ${util$1.joinValues(issue.options)}, received '${issue.received}'`;
|
|
12046
12051
|
break;
|
|
12047
12052
|
case ZodIssueCode.invalid_arguments:
|
|
12048
12053
|
message = `Invalid function arguments`;
|
|
@@ -12059,7 +12064,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
12059
12064
|
if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
12060
12065
|
} else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
12061
12066
|
else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
12062
|
-
else util.assertNever(issue.validation);
|
|
12067
|
+
else util$1.assertNever(issue.validation);
|
|
12063
12068
|
else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
|
|
12064
12069
|
else message = "Invalid";
|
|
12065
12070
|
break;
|
|
@@ -12093,7 +12098,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
12093
12098
|
break;
|
|
12094
12099
|
default:
|
|
12095
12100
|
message = _ctx.defaultError;
|
|
12096
|
-
util.assertNever(issue);
|
|
12101
|
+
util$1.assertNever(issue);
|
|
12097
12102
|
}
|
|
12098
12103
|
return { message };
|
|
12099
12104
|
};
|
|
@@ -12888,7 +12893,7 @@ var ZodString$1 = class ZodString$1 extends ZodType$1 {
|
|
|
12888
12893
|
});
|
|
12889
12894
|
status.dirty();
|
|
12890
12895
|
}
|
|
12891
|
-
} else util.assertNever(check);
|
|
12896
|
+
} else util$1.assertNever(check);
|
|
12892
12897
|
return {
|
|
12893
12898
|
status: status.value,
|
|
12894
12899
|
value: input.data
|
|
@@ -13197,7 +13202,7 @@ var ZodNumber$1 = class ZodNumber$1 extends ZodType$1 {
|
|
|
13197
13202
|
let ctx = void 0;
|
|
13198
13203
|
const status = new ParseStatus();
|
|
13199
13204
|
for (const check of this._def.checks) if (check.kind === "int") {
|
|
13200
|
-
if (!util.isInteger(input.data)) {
|
|
13205
|
+
if (!util$1.isInteger(input.data)) {
|
|
13201
13206
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
13202
13207
|
addIssueToContext(ctx, {
|
|
13203
13208
|
code: ZodIssueCode.invalid_type,
|
|
@@ -13252,7 +13257,7 @@ var ZodNumber$1 = class ZodNumber$1 extends ZodType$1 {
|
|
|
13252
13257
|
});
|
|
13253
13258
|
status.dirty();
|
|
13254
13259
|
}
|
|
13255
|
-
} else util.assertNever(check);
|
|
13260
|
+
} else util$1.assertNever(check);
|
|
13256
13261
|
return {
|
|
13257
13262
|
status: status.value,
|
|
13258
13263
|
value: input.data
|
|
@@ -13366,7 +13371,7 @@ var ZodNumber$1 = class ZodNumber$1 extends ZodType$1 {
|
|
|
13366
13371
|
return max;
|
|
13367
13372
|
}
|
|
13368
13373
|
get isInt() {
|
|
13369
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
13374
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util$1.isInteger(ch.value));
|
|
13370
13375
|
}
|
|
13371
13376
|
get isFinite() {
|
|
13372
13377
|
let max = null;
|
|
@@ -13437,7 +13442,7 @@ var ZodBigInt = class ZodBigInt extends ZodType$1 {
|
|
|
13437
13442
|
});
|
|
13438
13443
|
status.dirty();
|
|
13439
13444
|
}
|
|
13440
|
-
} else util.assertNever(check);
|
|
13445
|
+
} else util$1.assertNever(check);
|
|
13441
13446
|
return {
|
|
13442
13447
|
status: status.value,
|
|
13443
13448
|
value: input.data
|
|
@@ -13609,7 +13614,7 @@ var ZodDate = class ZodDate extends ZodType$1 {
|
|
|
13609
13614
|
});
|
|
13610
13615
|
status.dirty();
|
|
13611
13616
|
}
|
|
13612
|
-
} else util.assertNever(check);
|
|
13617
|
+
} else util$1.assertNever(check);
|
|
13613
13618
|
return {
|
|
13614
13619
|
status: status.value,
|
|
13615
13620
|
value: new Date(input.data.getTime())
|
|
@@ -13930,7 +13935,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
13930
13935
|
_getCached() {
|
|
13931
13936
|
if (this._cached !== null) return this._cached;
|
|
13932
13937
|
const shape = this._def.shape();
|
|
13933
|
-
const keys = util.objectKeys(shape);
|
|
13938
|
+
const keys = util$1.objectKeys(shape);
|
|
13934
13939
|
this._cached = {
|
|
13935
13940
|
shape,
|
|
13936
13941
|
keys
|
|
@@ -14081,7 +14086,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
14081
14086
|
}
|
|
14082
14087
|
pick(mask) {
|
|
14083
14088
|
const shape = {};
|
|
14084
|
-
for (const key of util.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
|
|
14089
|
+
for (const key of util$1.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
|
|
14085
14090
|
return new ZodObject$1({
|
|
14086
14091
|
...this._def,
|
|
14087
14092
|
shape: () => shape
|
|
@@ -14089,7 +14094,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
14089
14094
|
}
|
|
14090
14095
|
omit(mask) {
|
|
14091
14096
|
const shape = {};
|
|
14092
|
-
for (const key of util.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
|
|
14097
|
+
for (const key of util$1.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
|
|
14093
14098
|
return new ZodObject$1({
|
|
14094
14099
|
...this._def,
|
|
14095
14100
|
shape: () => shape
|
|
@@ -14103,7 +14108,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
14103
14108
|
}
|
|
14104
14109
|
partial(mask) {
|
|
14105
14110
|
const newShape = {};
|
|
14106
|
-
for (const key of util.objectKeys(this.shape)) {
|
|
14111
|
+
for (const key of util$1.objectKeys(this.shape)) {
|
|
14107
14112
|
const fieldSchema = this.shape[key];
|
|
14108
14113
|
if (mask && !mask[key]) newShape[key] = fieldSchema;
|
|
14109
14114
|
else newShape[key] = fieldSchema.optional();
|
|
@@ -14115,7 +14120,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
14115
14120
|
}
|
|
14116
14121
|
required(mask) {
|
|
14117
14122
|
const newShape = {};
|
|
14118
|
-
for (const key of util.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
|
|
14123
|
+
for (const key of util$1.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
|
|
14119
14124
|
else {
|
|
14120
14125
|
let newField = this.shape[key];
|
|
14121
14126
|
while (newField instanceof ZodOptional$1) newField = newField._def.innerType;
|
|
@@ -14127,7 +14132,7 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
14127
14132
|
});
|
|
14128
14133
|
}
|
|
14129
14134
|
keyof() {
|
|
14130
|
-
return createZodEnum(util.objectKeys(this.shape));
|
|
14135
|
+
return createZodEnum(util$1.objectKeys(this.shape));
|
|
14131
14136
|
}
|
|
14132
14137
|
};
|
|
14133
14138
|
ZodObject$1.create = (shape, params) => {
|
|
@@ -14244,7 +14249,7 @@ const getDiscriminator = (type) => {
|
|
|
14244
14249
|
else if (type instanceof ZodEffects) return getDiscriminator(type.innerType());
|
|
14245
14250
|
else if (type instanceof ZodLiteral$1) return [type.value];
|
|
14246
14251
|
else if (type instanceof ZodEnum$1) return type.options;
|
|
14247
|
-
else if (type instanceof ZodNativeEnum) return util.objectValues(type.enum);
|
|
14252
|
+
else if (type instanceof ZodNativeEnum) return util$1.objectValues(type.enum);
|
|
14248
14253
|
else if (type instanceof ZodDefault$1) return getDiscriminator(type._def.innerType);
|
|
14249
14254
|
else if (type instanceof ZodUndefined) return [void 0];
|
|
14250
14255
|
else if (type instanceof ZodNull$1) return [null];
|
|
@@ -14332,8 +14337,8 @@ function mergeValues$1(a, b) {
|
|
|
14332
14337
|
data: a
|
|
14333
14338
|
};
|
|
14334
14339
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
14335
|
-
const bKeys = util.objectKeys(b);
|
|
14336
|
-
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
14340
|
+
const bKeys = util$1.objectKeys(b);
|
|
14341
|
+
const sharedKeys = util$1.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
14337
14342
|
const newObj = {
|
|
14338
14343
|
...a,
|
|
14339
14344
|
...b
|
|
@@ -14838,7 +14843,7 @@ var ZodEnum$1 = class ZodEnum$1 extends ZodType$1 {
|
|
|
14838
14843
|
const ctx = this._getOrReturnCtx(input);
|
|
14839
14844
|
const expectedValues = this._def.values;
|
|
14840
14845
|
addIssueToContext(ctx, {
|
|
14841
|
-
expected: util.joinValues(expectedValues),
|
|
14846
|
+
expected: util$1.joinValues(expectedValues),
|
|
14842
14847
|
received: ctx.parsedType,
|
|
14843
14848
|
code: ZodIssueCode.invalid_type
|
|
14844
14849
|
});
|
|
@@ -14891,20 +14896,20 @@ var ZodEnum$1 = class ZodEnum$1 extends ZodType$1 {
|
|
|
14891
14896
|
ZodEnum$1.create = createZodEnum;
|
|
14892
14897
|
var ZodNativeEnum = class extends ZodType$1 {
|
|
14893
14898
|
_parse(input) {
|
|
14894
|
-
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
14899
|
+
const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
|
|
14895
14900
|
const ctx = this._getOrReturnCtx(input);
|
|
14896
14901
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
14897
|
-
const expectedValues = util.objectValues(nativeEnumValues);
|
|
14902
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
14898
14903
|
addIssueToContext(ctx, {
|
|
14899
|
-
expected: util.joinValues(expectedValues),
|
|
14904
|
+
expected: util$1.joinValues(expectedValues),
|
|
14900
14905
|
received: ctx.parsedType,
|
|
14901
14906
|
code: ZodIssueCode.invalid_type
|
|
14902
14907
|
});
|
|
14903
14908
|
return INVALID;
|
|
14904
14909
|
}
|
|
14905
|
-
if (!this._cache) this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
14910
|
+
if (!this._cache) this._cache = new Set(util$1.getValidEnumValues(this._def.values));
|
|
14906
14911
|
if (!this._cache.has(input.data)) {
|
|
14907
|
-
const expectedValues = util.objectValues(nativeEnumValues);
|
|
14912
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
14908
14913
|
addIssueToContext(ctx, {
|
|
14909
14914
|
received: ctx.data,
|
|
14910
14915
|
code: ZodIssueCode.invalid_enum_value,
|
|
@@ -15061,7 +15066,7 @@ var ZodEffects = class extends ZodType$1 {
|
|
|
15061
15066
|
value: result
|
|
15062
15067
|
}));
|
|
15063
15068
|
});
|
|
15064
|
-
util.assertNever(effect);
|
|
15069
|
+
util$1.assertNever(effect);
|
|
15065
15070
|
}
|
|
15066
15071
|
};
|
|
15067
15072
|
ZodEffects.create = (schema, effect, params) => {
|
|
@@ -30110,7 +30115,7 @@ var require_limit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
30110
30115
|
}));
|
|
30111
30116
|
//#endregion
|
|
30112
30117
|
//#region node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.20.0/node_modules/ajv-formats/dist/index.js
|
|
30113
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30118
|
+
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30114
30119
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30115
30120
|
const formats_1 = require_formats();
|
|
30116
30121
|
const limit_1 = require_limit();
|
|
@@ -30145,7 +30150,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30145
30150
|
//#endregion
|
|
30146
30151
|
//#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
30147
30152
|
var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
|
|
30148
|
-
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
30153
|
+
var import_dist = /* @__PURE__ */ __toESM(require_dist$1(), 1);
|
|
30149
30154
|
function createDefaultAjvInstance() {
|
|
30150
30155
|
const ajv = new import_ajv.default({
|
|
30151
30156
|
strict: false,
|
|
@@ -31723,6 +31728,1136 @@ function registerCliTools(server) {
|
|
|
31723
31728
|
}));
|
|
31724
31729
|
}
|
|
31725
31730
|
//#endregion
|
|
31731
|
+
//#region node_modules/.pnpm/buffer-crc32@1.0.0/node_modules/buffer-crc32/dist/index.cjs
|
|
31732
|
+
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31733
|
+
function getDefaultExportFromCjs(x) {
|
|
31734
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
31735
|
+
}
|
|
31736
|
+
const CRC_TABLE = new Int32Array([
|
|
31737
|
+
0,
|
|
31738
|
+
1996959894,
|
|
31739
|
+
3993919788,
|
|
31740
|
+
2567524794,
|
|
31741
|
+
124634137,
|
|
31742
|
+
1886057615,
|
|
31743
|
+
3915621685,
|
|
31744
|
+
2657392035,
|
|
31745
|
+
249268274,
|
|
31746
|
+
2044508324,
|
|
31747
|
+
3772115230,
|
|
31748
|
+
2547177864,
|
|
31749
|
+
162941995,
|
|
31750
|
+
2125561021,
|
|
31751
|
+
3887607047,
|
|
31752
|
+
2428444049,
|
|
31753
|
+
498536548,
|
|
31754
|
+
1789927666,
|
|
31755
|
+
4089016648,
|
|
31756
|
+
2227061214,
|
|
31757
|
+
450548861,
|
|
31758
|
+
1843258603,
|
|
31759
|
+
4107580753,
|
|
31760
|
+
2211677639,
|
|
31761
|
+
325883990,
|
|
31762
|
+
1684777152,
|
|
31763
|
+
4251122042,
|
|
31764
|
+
2321926636,
|
|
31765
|
+
335633487,
|
|
31766
|
+
1661365465,
|
|
31767
|
+
4195302755,
|
|
31768
|
+
2366115317,
|
|
31769
|
+
997073096,
|
|
31770
|
+
1281953886,
|
|
31771
|
+
3579855332,
|
|
31772
|
+
2724688242,
|
|
31773
|
+
1006888145,
|
|
31774
|
+
1258607687,
|
|
31775
|
+
3524101629,
|
|
31776
|
+
2768942443,
|
|
31777
|
+
901097722,
|
|
31778
|
+
1119000684,
|
|
31779
|
+
3686517206,
|
|
31780
|
+
2898065728,
|
|
31781
|
+
853044451,
|
|
31782
|
+
1172266101,
|
|
31783
|
+
3705015759,
|
|
31784
|
+
2882616665,
|
|
31785
|
+
651767980,
|
|
31786
|
+
1373503546,
|
|
31787
|
+
3369554304,
|
|
31788
|
+
3218104598,
|
|
31789
|
+
565507253,
|
|
31790
|
+
1454621731,
|
|
31791
|
+
3485111705,
|
|
31792
|
+
3099436303,
|
|
31793
|
+
671266974,
|
|
31794
|
+
1594198024,
|
|
31795
|
+
3322730930,
|
|
31796
|
+
2970347812,
|
|
31797
|
+
795835527,
|
|
31798
|
+
1483230225,
|
|
31799
|
+
3244367275,
|
|
31800
|
+
3060149565,
|
|
31801
|
+
1994146192,
|
|
31802
|
+
31158534,
|
|
31803
|
+
2563907772,
|
|
31804
|
+
4023717930,
|
|
31805
|
+
1907459465,
|
|
31806
|
+
112637215,
|
|
31807
|
+
2680153253,
|
|
31808
|
+
3904427059,
|
|
31809
|
+
2013776290,
|
|
31810
|
+
251722036,
|
|
31811
|
+
2517215374,
|
|
31812
|
+
3775830040,
|
|
31813
|
+
2137656763,
|
|
31814
|
+
141376813,
|
|
31815
|
+
2439277719,
|
|
31816
|
+
3865271297,
|
|
31817
|
+
1802195444,
|
|
31818
|
+
476864866,
|
|
31819
|
+
2238001368,
|
|
31820
|
+
4066508878,
|
|
31821
|
+
1812370925,
|
|
31822
|
+
453092731,
|
|
31823
|
+
2181625025,
|
|
31824
|
+
4111451223,
|
|
31825
|
+
1706088902,
|
|
31826
|
+
314042704,
|
|
31827
|
+
2344532202,
|
|
31828
|
+
4240017532,
|
|
31829
|
+
1658658271,
|
|
31830
|
+
366619977,
|
|
31831
|
+
2362670323,
|
|
31832
|
+
4224994405,
|
|
31833
|
+
1303535960,
|
|
31834
|
+
984961486,
|
|
31835
|
+
2747007092,
|
|
31836
|
+
3569037538,
|
|
31837
|
+
1256170817,
|
|
31838
|
+
1037604311,
|
|
31839
|
+
2765210733,
|
|
31840
|
+
3554079995,
|
|
31841
|
+
1131014506,
|
|
31842
|
+
879679996,
|
|
31843
|
+
2909243462,
|
|
31844
|
+
3663771856,
|
|
31845
|
+
1141124467,
|
|
31846
|
+
855842277,
|
|
31847
|
+
2852801631,
|
|
31848
|
+
3708648649,
|
|
31849
|
+
1342533948,
|
|
31850
|
+
654459306,
|
|
31851
|
+
3188396048,
|
|
31852
|
+
3373015174,
|
|
31853
|
+
1466479909,
|
|
31854
|
+
544179635,
|
|
31855
|
+
3110523913,
|
|
31856
|
+
3462522015,
|
|
31857
|
+
1591671054,
|
|
31858
|
+
702138776,
|
|
31859
|
+
2966460450,
|
|
31860
|
+
3352799412,
|
|
31861
|
+
1504918807,
|
|
31862
|
+
783551873,
|
|
31863
|
+
3082640443,
|
|
31864
|
+
3233442989,
|
|
31865
|
+
3988292384,
|
|
31866
|
+
2596254646,
|
|
31867
|
+
62317068,
|
|
31868
|
+
1957810842,
|
|
31869
|
+
3939845945,
|
|
31870
|
+
2647816111,
|
|
31871
|
+
81470997,
|
|
31872
|
+
1943803523,
|
|
31873
|
+
3814918930,
|
|
31874
|
+
2489596804,
|
|
31875
|
+
225274430,
|
|
31876
|
+
2053790376,
|
|
31877
|
+
3826175755,
|
|
31878
|
+
2466906013,
|
|
31879
|
+
167816743,
|
|
31880
|
+
2097651377,
|
|
31881
|
+
4027552580,
|
|
31882
|
+
2265490386,
|
|
31883
|
+
503444072,
|
|
31884
|
+
1762050814,
|
|
31885
|
+
4150417245,
|
|
31886
|
+
2154129355,
|
|
31887
|
+
426522225,
|
|
31888
|
+
1852507879,
|
|
31889
|
+
4275313526,
|
|
31890
|
+
2312317920,
|
|
31891
|
+
282753626,
|
|
31892
|
+
1742555852,
|
|
31893
|
+
4189708143,
|
|
31894
|
+
2394877945,
|
|
31895
|
+
397917763,
|
|
31896
|
+
1622183637,
|
|
31897
|
+
3604390888,
|
|
31898
|
+
2714866558,
|
|
31899
|
+
953729732,
|
|
31900
|
+
1340076626,
|
|
31901
|
+
3518719985,
|
|
31902
|
+
2797360999,
|
|
31903
|
+
1068828381,
|
|
31904
|
+
1219638859,
|
|
31905
|
+
3624741850,
|
|
31906
|
+
2936675148,
|
|
31907
|
+
906185462,
|
|
31908
|
+
1090812512,
|
|
31909
|
+
3747672003,
|
|
31910
|
+
2825379669,
|
|
31911
|
+
829329135,
|
|
31912
|
+
1181335161,
|
|
31913
|
+
3412177804,
|
|
31914
|
+
3160834842,
|
|
31915
|
+
628085408,
|
|
31916
|
+
1382605366,
|
|
31917
|
+
3423369109,
|
|
31918
|
+
3138078467,
|
|
31919
|
+
570562233,
|
|
31920
|
+
1426400815,
|
|
31921
|
+
3317316542,
|
|
31922
|
+
2998733608,
|
|
31923
|
+
733239954,
|
|
31924
|
+
1555261956,
|
|
31925
|
+
3268935591,
|
|
31926
|
+
3050360625,
|
|
31927
|
+
752459403,
|
|
31928
|
+
1541320221,
|
|
31929
|
+
2607071920,
|
|
31930
|
+
3965973030,
|
|
31931
|
+
1969922972,
|
|
31932
|
+
40735498,
|
|
31933
|
+
2617837225,
|
|
31934
|
+
3943577151,
|
|
31935
|
+
1913087877,
|
|
31936
|
+
83908371,
|
|
31937
|
+
2512341634,
|
|
31938
|
+
3803740692,
|
|
31939
|
+
2075208622,
|
|
31940
|
+
213261112,
|
|
31941
|
+
2463272603,
|
|
31942
|
+
3855990285,
|
|
31943
|
+
2094854071,
|
|
31944
|
+
198958881,
|
|
31945
|
+
2262029012,
|
|
31946
|
+
4057260610,
|
|
31947
|
+
1759359992,
|
|
31948
|
+
534414190,
|
|
31949
|
+
2176718541,
|
|
31950
|
+
4139329115,
|
|
31951
|
+
1873836001,
|
|
31952
|
+
414664567,
|
|
31953
|
+
2282248934,
|
|
31954
|
+
4279200368,
|
|
31955
|
+
1711684554,
|
|
31956
|
+
285281116,
|
|
31957
|
+
2405801727,
|
|
31958
|
+
4167216745,
|
|
31959
|
+
1634467795,
|
|
31960
|
+
376229701,
|
|
31961
|
+
2685067896,
|
|
31962
|
+
3608007406,
|
|
31963
|
+
1308918612,
|
|
31964
|
+
956543938,
|
|
31965
|
+
2808555105,
|
|
31966
|
+
3495958263,
|
|
31967
|
+
1231636301,
|
|
31968
|
+
1047427035,
|
|
31969
|
+
2932959818,
|
|
31970
|
+
3654703836,
|
|
31971
|
+
1088359270,
|
|
31972
|
+
936918e3,
|
|
31973
|
+
2847714899,
|
|
31974
|
+
3736837829,
|
|
31975
|
+
1202900863,
|
|
31976
|
+
817233897,
|
|
31977
|
+
3183342108,
|
|
31978
|
+
3401237130,
|
|
31979
|
+
1404277552,
|
|
31980
|
+
615818150,
|
|
31981
|
+
3134207493,
|
|
31982
|
+
3453421203,
|
|
31983
|
+
1423857449,
|
|
31984
|
+
601450431,
|
|
31985
|
+
3009837614,
|
|
31986
|
+
3294710456,
|
|
31987
|
+
1567103746,
|
|
31988
|
+
711928724,
|
|
31989
|
+
3020668471,
|
|
31990
|
+
3272380065,
|
|
31991
|
+
1510334235,
|
|
31992
|
+
755167117
|
|
31993
|
+
]);
|
|
31994
|
+
function ensureBuffer(input) {
|
|
31995
|
+
if (Buffer.isBuffer(input)) return input;
|
|
31996
|
+
if (typeof input === "number") return Buffer.alloc(input);
|
|
31997
|
+
else if (typeof input === "string") return Buffer.from(input);
|
|
31998
|
+
else throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
31999
|
+
}
|
|
32000
|
+
function bufferizeInt(num) {
|
|
32001
|
+
const tmp = ensureBuffer(4);
|
|
32002
|
+
tmp.writeInt32BE(num, 0);
|
|
32003
|
+
return tmp;
|
|
32004
|
+
}
|
|
32005
|
+
function _crc32(buf, previous) {
|
|
32006
|
+
buf = ensureBuffer(buf);
|
|
32007
|
+
if (Buffer.isBuffer(previous)) previous = previous.readUInt32BE(0);
|
|
32008
|
+
let crc = ~~previous ^ -1;
|
|
32009
|
+
for (var n = 0; n < buf.length; n++) crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
32010
|
+
return crc ^ -1;
|
|
32011
|
+
}
|
|
32012
|
+
function crc32() {
|
|
32013
|
+
return bufferizeInt(_crc32.apply(null, arguments));
|
|
32014
|
+
}
|
|
32015
|
+
crc32.signed = function() {
|
|
32016
|
+
return _crc32.apply(null, arguments);
|
|
32017
|
+
};
|
|
32018
|
+
crc32.unsigned = function() {
|
|
32019
|
+
return _crc32.apply(null, arguments) >>> 0;
|
|
32020
|
+
};
|
|
32021
|
+
module.exports = /* @__PURE__ */ getDefaultExportFromCjs(crc32);
|
|
32022
|
+
}));
|
|
32023
|
+
//#endregion
|
|
32024
|
+
//#region packages/cli/src/connxio/code-components.ts
|
|
32025
|
+
var import_yazl = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
32026
|
+
var fs$1 = __require("fs");
|
|
32027
|
+
var Transform = __require("stream").Transform;
|
|
32028
|
+
var PassThrough = __require("stream").PassThrough;
|
|
32029
|
+
var zlib = __require("zlib");
|
|
32030
|
+
var util = __require("util");
|
|
32031
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
32032
|
+
var errorMonitor = __require("events").errorMonitor;
|
|
32033
|
+
var crc32 = require_dist();
|
|
32034
|
+
exports.ZipFile = ZipFile;
|
|
32035
|
+
util.inherits(ZipFile, EventEmitter);
|
|
32036
|
+
function ZipFile() {
|
|
32037
|
+
this.outputStream = new PassThrough();
|
|
32038
|
+
this.entries = [];
|
|
32039
|
+
this.outputStreamCursor = 0;
|
|
32040
|
+
this.ended = false;
|
|
32041
|
+
this.allDone = false;
|
|
32042
|
+
this.forceZip64Eocd = false;
|
|
32043
|
+
this.errored = false;
|
|
32044
|
+
this.on(errorMonitor, function() {
|
|
32045
|
+
this.errored = true;
|
|
32046
|
+
});
|
|
32047
|
+
}
|
|
32048
|
+
ZipFile.prototype.addFile = function(realPath, metadataPath, options) {
|
|
32049
|
+
var self = this;
|
|
32050
|
+
metadataPath = validateMetadataPath(metadataPath, false);
|
|
32051
|
+
if (options == null) options = {};
|
|
32052
|
+
if (shouldIgnoreAdding(self)) return;
|
|
32053
|
+
var entry = new Entry(metadataPath, false, options);
|
|
32054
|
+
self.entries.push(entry);
|
|
32055
|
+
fs$1.stat(realPath, function(err, stats) {
|
|
32056
|
+
if (err) return self.emit("error", err);
|
|
32057
|
+
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
32058
|
+
entry.uncompressedSize = stats.size;
|
|
32059
|
+
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
32060
|
+
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
32061
|
+
entry.setFileDataPumpFunction(function() {
|
|
32062
|
+
var readStream = fs$1.createReadStream(realPath);
|
|
32063
|
+
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
32064
|
+
readStream.on("error", function(err) {
|
|
32065
|
+
self.emit("error", err);
|
|
32066
|
+
});
|
|
32067
|
+
pumpFileDataReadStream(self, entry, readStream);
|
|
32068
|
+
});
|
|
32069
|
+
pumpEntries(self);
|
|
32070
|
+
});
|
|
32071
|
+
};
|
|
32072
|
+
ZipFile.prototype.addReadStream = function(readStream, metadataPath, options) {
|
|
32073
|
+
this.addReadStreamLazy(metadataPath, options, function(cb) {
|
|
32074
|
+
cb(null, readStream);
|
|
32075
|
+
});
|
|
32076
|
+
};
|
|
32077
|
+
ZipFile.prototype.addReadStreamLazy = function(metadataPath, options, getReadStreamFunction) {
|
|
32078
|
+
var self = this;
|
|
32079
|
+
if (typeof options === "function") {
|
|
32080
|
+
getReadStreamFunction = options;
|
|
32081
|
+
options = null;
|
|
32082
|
+
}
|
|
32083
|
+
if (options == null) options = {};
|
|
32084
|
+
metadataPath = validateMetadataPath(metadataPath, false);
|
|
32085
|
+
if (shouldIgnoreAdding(self)) return;
|
|
32086
|
+
var entry = new Entry(metadataPath, false, options);
|
|
32087
|
+
self.entries.push(entry);
|
|
32088
|
+
entry.setFileDataPumpFunction(function() {
|
|
32089
|
+
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
32090
|
+
getReadStreamFunction(function(err, readStream) {
|
|
32091
|
+
if (err) return self.emit("error", err);
|
|
32092
|
+
pumpFileDataReadStream(self, entry, readStream);
|
|
32093
|
+
});
|
|
32094
|
+
});
|
|
32095
|
+
pumpEntries(self);
|
|
32096
|
+
};
|
|
32097
|
+
ZipFile.prototype.addBuffer = function(buffer, metadataPath, options) {
|
|
32098
|
+
var self = this;
|
|
32099
|
+
metadataPath = validateMetadataPath(metadataPath, false);
|
|
32100
|
+
if (buffer.length > 1073741823) throw new Error("buffer too large: " + buffer.length + " > 1073741823");
|
|
32101
|
+
if (options == null) options = {};
|
|
32102
|
+
if (options.size != null) throw new Error("options.size not allowed");
|
|
32103
|
+
if (shouldIgnoreAdding(self)) return;
|
|
32104
|
+
var entry = new Entry(metadataPath, false, options);
|
|
32105
|
+
entry.uncompressedSize = buffer.length;
|
|
32106
|
+
entry.crc32 = crc32.unsigned(buffer);
|
|
32107
|
+
entry.crcAndFileSizeKnown = true;
|
|
32108
|
+
self.entries.push(entry);
|
|
32109
|
+
if (entry.compressionLevel === 0) setCompressedBuffer(buffer);
|
|
32110
|
+
else zlib.deflateRaw(buffer, { level: entry.compressionLevel }, function(err, compressedBuffer) {
|
|
32111
|
+
setCompressedBuffer(compressedBuffer);
|
|
32112
|
+
});
|
|
32113
|
+
function setCompressedBuffer(compressedBuffer) {
|
|
32114
|
+
entry.compressedSize = compressedBuffer.length;
|
|
32115
|
+
entry.setFileDataPumpFunction(function() {
|
|
32116
|
+
writeToOutputStream(self, compressedBuffer);
|
|
32117
|
+
writeToOutputStream(self, entry.getDataDescriptor());
|
|
32118
|
+
entry.state = Entry.FILE_DATA_DONE;
|
|
32119
|
+
setImmediate(function() {
|
|
32120
|
+
pumpEntries(self);
|
|
32121
|
+
});
|
|
32122
|
+
});
|
|
32123
|
+
pumpEntries(self);
|
|
32124
|
+
}
|
|
32125
|
+
};
|
|
32126
|
+
ZipFile.prototype.addEmptyDirectory = function(metadataPath, options) {
|
|
32127
|
+
var self = this;
|
|
32128
|
+
metadataPath = validateMetadataPath(metadataPath, true);
|
|
32129
|
+
if (options == null) options = {};
|
|
32130
|
+
if (options.size != null) throw new Error("options.size not allowed");
|
|
32131
|
+
if (options.compress != null) throw new Error("options.compress not allowed");
|
|
32132
|
+
if (options.compressionLevel != null) throw new Error("options.compressionLevel not allowed");
|
|
32133
|
+
if (shouldIgnoreAdding(self)) return;
|
|
32134
|
+
var entry = new Entry(metadataPath, true, options);
|
|
32135
|
+
self.entries.push(entry);
|
|
32136
|
+
entry.setFileDataPumpFunction(function() {
|
|
32137
|
+
writeToOutputStream(self, entry.getDataDescriptor());
|
|
32138
|
+
entry.state = Entry.FILE_DATA_DONE;
|
|
32139
|
+
pumpEntries(self);
|
|
32140
|
+
});
|
|
32141
|
+
pumpEntries(self);
|
|
32142
|
+
};
|
|
32143
|
+
var eocdrSignatureBuffer = bufferFrom([
|
|
32144
|
+
80,
|
|
32145
|
+
75,
|
|
32146
|
+
5,
|
|
32147
|
+
6
|
|
32148
|
+
]);
|
|
32149
|
+
ZipFile.prototype.end = function(options, calculatedTotalSizeCallback) {
|
|
32150
|
+
if (typeof options === "function") {
|
|
32151
|
+
calculatedTotalSizeCallback = options;
|
|
32152
|
+
options = null;
|
|
32153
|
+
}
|
|
32154
|
+
if (options == null) options = {};
|
|
32155
|
+
if (this.ended) return;
|
|
32156
|
+
this.ended = true;
|
|
32157
|
+
if (this.errored) return;
|
|
32158
|
+
this.calculatedTotalSizeCallback = calculatedTotalSizeCallback;
|
|
32159
|
+
this.forceZip64Eocd = !!options.forceZip64Format;
|
|
32160
|
+
if (options.comment) {
|
|
32161
|
+
if (typeof options.comment === "string") this.comment = encodeCp437(options.comment);
|
|
32162
|
+
else this.comment = options.comment;
|
|
32163
|
+
if (this.comment.length > 65535) throw new Error("comment is too large");
|
|
32164
|
+
if (bufferIncludes(this.comment, eocdrSignatureBuffer)) throw new Error("comment contains end of central directory record signature");
|
|
32165
|
+
} else this.comment = EMPTY_BUFFER;
|
|
32166
|
+
pumpEntries(this);
|
|
32167
|
+
};
|
|
32168
|
+
function writeToOutputStream(self, buffer) {
|
|
32169
|
+
self.outputStream.write(buffer);
|
|
32170
|
+
self.outputStreamCursor += buffer.length;
|
|
32171
|
+
}
|
|
32172
|
+
function pumpFileDataReadStream(self, entry, readStream) {
|
|
32173
|
+
var crc32Watcher = new Crc32Watcher();
|
|
32174
|
+
var uncompressedSizeCounter = new ByteCounter();
|
|
32175
|
+
var compressor = entry.compressionLevel !== 0 ? new zlib.DeflateRaw({ level: entry.compressionLevel }) : new PassThrough();
|
|
32176
|
+
var compressedSizeCounter = new ByteCounter();
|
|
32177
|
+
readStream.pipe(crc32Watcher).pipe(uncompressedSizeCounter).pipe(compressor).pipe(compressedSizeCounter).pipe(self.outputStream, { end: false });
|
|
32178
|
+
compressedSizeCounter.on("end", function() {
|
|
32179
|
+
entry.crc32 = crc32Watcher.crc32;
|
|
32180
|
+
if (entry.uncompressedSize == null) entry.uncompressedSize = uncompressedSizeCounter.byteCount;
|
|
32181
|
+
else if (entry.uncompressedSize !== uncompressedSizeCounter.byteCount) return self.emit("error", /* @__PURE__ */ new Error("file data stream has unexpected number of bytes"));
|
|
32182
|
+
entry.compressedSize = compressedSizeCounter.byteCount;
|
|
32183
|
+
self.outputStreamCursor += entry.compressedSize;
|
|
32184
|
+
writeToOutputStream(self, entry.getDataDescriptor());
|
|
32185
|
+
entry.state = Entry.FILE_DATA_DONE;
|
|
32186
|
+
pumpEntries(self);
|
|
32187
|
+
});
|
|
32188
|
+
}
|
|
32189
|
+
function determineCompressionLevel(options) {
|
|
32190
|
+
if (options.compress != null && options.compressionLevel != null) {
|
|
32191
|
+
if (!!options.compress !== !!options.compressionLevel) throw new Error("conflicting settings for compress and compressionLevel");
|
|
32192
|
+
}
|
|
32193
|
+
if (options.compressionLevel != null) return options.compressionLevel;
|
|
32194
|
+
if (options.compress === false) return 0;
|
|
32195
|
+
return 6;
|
|
32196
|
+
}
|
|
32197
|
+
function pumpEntries(self) {
|
|
32198
|
+
if (self.allDone || self.errored) return;
|
|
32199
|
+
if (self.ended && self.calculatedTotalSizeCallback != null) {
|
|
32200
|
+
var calculatedTotalSize = calculateTotalSize(self);
|
|
32201
|
+
if (calculatedTotalSize != null) {
|
|
32202
|
+
self.calculatedTotalSizeCallback(calculatedTotalSize);
|
|
32203
|
+
self.calculatedTotalSizeCallback = null;
|
|
32204
|
+
}
|
|
32205
|
+
}
|
|
32206
|
+
var entry = getFirstNotDoneEntry();
|
|
32207
|
+
function getFirstNotDoneEntry() {
|
|
32208
|
+
for (var i = 0; i < self.entries.length; i++) {
|
|
32209
|
+
var entry = self.entries[i];
|
|
32210
|
+
if (entry.state < Entry.FILE_DATA_DONE) return entry;
|
|
32211
|
+
}
|
|
32212
|
+
return null;
|
|
32213
|
+
}
|
|
32214
|
+
if (entry != null) {
|
|
32215
|
+
if (entry.state < Entry.READY_TO_PUMP_FILE_DATA) return;
|
|
32216
|
+
if (entry.state === Entry.FILE_DATA_IN_PROGRESS) return;
|
|
32217
|
+
entry.relativeOffsetOfLocalHeader = self.outputStreamCursor;
|
|
32218
|
+
writeToOutputStream(self, entry.getLocalFileHeader());
|
|
32219
|
+
entry.doFileDataPump();
|
|
32220
|
+
} else if (self.ended) {
|
|
32221
|
+
self.offsetOfStartOfCentralDirectory = self.outputStreamCursor;
|
|
32222
|
+
self.entries.forEach(function(entry) {
|
|
32223
|
+
writeToOutputStream(self, entry.getCentralDirectoryRecord());
|
|
32224
|
+
});
|
|
32225
|
+
writeToOutputStream(self, getEndOfCentralDirectoryRecord(self));
|
|
32226
|
+
self.outputStream.end();
|
|
32227
|
+
self.allDone = true;
|
|
32228
|
+
}
|
|
32229
|
+
}
|
|
32230
|
+
function calculateTotalSize(self) {
|
|
32231
|
+
var pretendOutputCursor = 0;
|
|
32232
|
+
var centralDirectorySize = 0;
|
|
32233
|
+
for (var i = 0; i < self.entries.length; i++) {
|
|
32234
|
+
var entry = self.entries[i];
|
|
32235
|
+
if (entry.compressionLevel !== 0) return -1;
|
|
32236
|
+
if (entry.state >= Entry.READY_TO_PUMP_FILE_DATA) {
|
|
32237
|
+
if (entry.uncompressedSize == null) return -1;
|
|
32238
|
+
} else if (entry.uncompressedSize == null) return null;
|
|
32239
|
+
entry.relativeOffsetOfLocalHeader = pretendOutputCursor;
|
|
32240
|
+
var useZip64Format = entry.useZip64Format();
|
|
32241
|
+
pretendOutputCursor += LOCAL_FILE_HEADER_FIXED_SIZE + entry.utf8FileName.length;
|
|
32242
|
+
pretendOutputCursor += entry.uncompressedSize;
|
|
32243
|
+
if (!entry.crcAndFileSizeKnown) if (useZip64Format) pretendOutputCursor += ZIP64_DATA_DESCRIPTOR_SIZE;
|
|
32244
|
+
else pretendOutputCursor += DATA_DESCRIPTOR_SIZE;
|
|
32245
|
+
centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length + entry.fileComment.length;
|
|
32246
|
+
if (!entry.forceDosTimestamp) centralDirectorySize += INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE;
|
|
32247
|
+
if (useZip64Format) centralDirectorySize += ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE;
|
|
32248
|
+
}
|
|
32249
|
+
var endOfCentralDirectorySize = 0;
|
|
32250
|
+
if (self.forceZip64Eocd || self.entries.length >= 65535 || centralDirectorySize >= 65535 || pretendOutputCursor >= 4294967295) endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
|
|
32251
|
+
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length;
|
|
32252
|
+
return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
|
|
32253
|
+
}
|
|
32254
|
+
function shouldIgnoreAdding(self) {
|
|
32255
|
+
if (self.ended) throw new Error("cannot add entries after calling end()");
|
|
32256
|
+
if (self.errored) return true;
|
|
32257
|
+
return false;
|
|
32258
|
+
}
|
|
32259
|
+
var ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 56;
|
|
32260
|
+
var ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE = 20;
|
|
32261
|
+
var END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 22;
|
|
32262
|
+
function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe) {
|
|
32263
|
+
var needZip64Format = false;
|
|
32264
|
+
var normalEntriesLength = self.entries.length;
|
|
32265
|
+
if (self.forceZip64Eocd || self.entries.length >= 65535) {
|
|
32266
|
+
normalEntriesLength = 65535;
|
|
32267
|
+
needZip64Format = true;
|
|
32268
|
+
}
|
|
32269
|
+
var sizeOfCentralDirectory = self.outputStreamCursor - self.offsetOfStartOfCentralDirectory;
|
|
32270
|
+
var normalSizeOfCentralDirectory = sizeOfCentralDirectory;
|
|
32271
|
+
if (self.forceZip64Eocd || sizeOfCentralDirectory >= 4294967295) {
|
|
32272
|
+
normalSizeOfCentralDirectory = 4294967295;
|
|
32273
|
+
needZip64Format = true;
|
|
32274
|
+
}
|
|
32275
|
+
var normalOffsetOfStartOfCentralDirectory = self.offsetOfStartOfCentralDirectory;
|
|
32276
|
+
if (self.forceZip64Eocd || self.offsetOfStartOfCentralDirectory >= 4294967295) {
|
|
32277
|
+
normalOffsetOfStartOfCentralDirectory = 4294967295;
|
|
32278
|
+
needZip64Format = true;
|
|
32279
|
+
}
|
|
32280
|
+
if (actuallyJustTellMeHowLongItWouldBe) if (needZip64Format) return ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE + END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
|
|
32281
|
+
else return END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
|
|
32282
|
+
var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length);
|
|
32283
|
+
eocdrBuffer.writeUInt32LE(101010256, 0);
|
|
32284
|
+
eocdrBuffer.writeUInt16LE(0, 4);
|
|
32285
|
+
eocdrBuffer.writeUInt16LE(0, 6);
|
|
32286
|
+
eocdrBuffer.writeUInt16LE(normalEntriesLength, 8);
|
|
32287
|
+
eocdrBuffer.writeUInt16LE(normalEntriesLength, 10);
|
|
32288
|
+
eocdrBuffer.writeUInt32LE(normalSizeOfCentralDirectory, 12);
|
|
32289
|
+
eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
|
|
32290
|
+
eocdrBuffer.writeUInt16LE(self.comment.length, 20);
|
|
32291
|
+
self.comment.copy(eocdrBuffer, 22);
|
|
32292
|
+
if (!needZip64Format) return eocdrBuffer;
|
|
32293
|
+
var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
|
|
32294
|
+
zip64EocdrBuffer.writeUInt32LE(101075792, 0);
|
|
32295
|
+
writeUInt64LE(zip64EocdrBuffer, ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE - 12, 4);
|
|
32296
|
+
zip64EocdrBuffer.writeUInt16LE(VERSION_MADE_BY, 12);
|
|
32297
|
+
zip64EocdrBuffer.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_ZIP64, 14);
|
|
32298
|
+
zip64EocdrBuffer.writeUInt32LE(0, 16);
|
|
32299
|
+
zip64EocdrBuffer.writeUInt32LE(0, 20);
|
|
32300
|
+
writeUInt64LE(zip64EocdrBuffer, self.entries.length, 24);
|
|
32301
|
+
writeUInt64LE(zip64EocdrBuffer, self.entries.length, 32);
|
|
32302
|
+
writeUInt64LE(zip64EocdrBuffer, sizeOfCentralDirectory, 40);
|
|
32303
|
+
writeUInt64LE(zip64EocdrBuffer, self.offsetOfStartOfCentralDirectory, 48);
|
|
32304
|
+
var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
|
|
32305
|
+
zip64EocdlBuffer.writeUInt32LE(117853008, 0);
|
|
32306
|
+
zip64EocdlBuffer.writeUInt32LE(0, 4);
|
|
32307
|
+
writeUInt64LE(zip64EocdlBuffer, self.outputStreamCursor, 8);
|
|
32308
|
+
zip64EocdlBuffer.writeUInt32LE(1, 16);
|
|
32309
|
+
return Buffer.concat([
|
|
32310
|
+
zip64EocdrBuffer,
|
|
32311
|
+
zip64EocdlBuffer,
|
|
32312
|
+
eocdrBuffer
|
|
32313
|
+
]);
|
|
32314
|
+
}
|
|
32315
|
+
function validateMetadataPath(metadataPath, isDirectory) {
|
|
32316
|
+
if (metadataPath === "") throw new Error("empty metadataPath");
|
|
32317
|
+
metadataPath = metadataPath.replace(/\\/g, "/");
|
|
32318
|
+
if (/^[a-zA-Z]:/.test(metadataPath) || /^\//.test(metadataPath)) throw new Error("absolute path: " + metadataPath);
|
|
32319
|
+
if (metadataPath.split("/").indexOf("..") !== -1) throw new Error("invalid relative path: " + metadataPath);
|
|
32320
|
+
var looksLikeDirectory = /\/$/.test(metadataPath);
|
|
32321
|
+
if (isDirectory) {
|
|
32322
|
+
if (!looksLikeDirectory) metadataPath += "/";
|
|
32323
|
+
} else if (looksLikeDirectory) throw new Error("file path cannot end with '/': " + metadataPath);
|
|
32324
|
+
return metadataPath;
|
|
32325
|
+
}
|
|
32326
|
+
var EMPTY_BUFFER = bufferAlloc(0);
|
|
32327
|
+
function Entry(metadataPath, isDirectory, options) {
|
|
32328
|
+
this.utf8FileName = bufferFrom(metadataPath);
|
|
32329
|
+
if (this.utf8FileName.length > 65535) throw new Error("utf8 file name too long. " + utf8FileName.length + " > 65535");
|
|
32330
|
+
this.isDirectory = isDirectory;
|
|
32331
|
+
this.state = Entry.WAITING_FOR_METADATA;
|
|
32332
|
+
this.setLastModDate(options.mtime != null ? options.mtime : /* @__PURE__ */ new Date());
|
|
32333
|
+
this.forceDosTimestamp = !!options.forceDosTimestamp;
|
|
32334
|
+
if (options.mode != null) this.setFileAttributesMode(options.mode);
|
|
32335
|
+
else this.setFileAttributesMode(isDirectory ? 16893 : 33204);
|
|
32336
|
+
if (isDirectory) {
|
|
32337
|
+
this.crcAndFileSizeKnown = true;
|
|
32338
|
+
this.crc32 = 0;
|
|
32339
|
+
this.uncompressedSize = 0;
|
|
32340
|
+
this.compressedSize = 0;
|
|
32341
|
+
} else {
|
|
32342
|
+
this.crcAndFileSizeKnown = false;
|
|
32343
|
+
this.crc32 = null;
|
|
32344
|
+
this.uncompressedSize = null;
|
|
32345
|
+
this.compressedSize = null;
|
|
32346
|
+
if (options.size != null) this.uncompressedSize = options.size;
|
|
32347
|
+
}
|
|
32348
|
+
if (isDirectory) this.compressionLevel = 0;
|
|
32349
|
+
else this.compressionLevel = determineCompressionLevel(options);
|
|
32350
|
+
this.forceZip64Format = !!options.forceZip64Format;
|
|
32351
|
+
if (options.fileComment) {
|
|
32352
|
+
if (typeof options.fileComment === "string") this.fileComment = bufferFrom(options.fileComment, "utf-8");
|
|
32353
|
+
else this.fileComment = options.fileComment;
|
|
32354
|
+
if (this.fileComment.length > 65535) throw new Error("fileComment is too large");
|
|
32355
|
+
} else this.fileComment = EMPTY_BUFFER;
|
|
32356
|
+
}
|
|
32357
|
+
Entry.WAITING_FOR_METADATA = 0;
|
|
32358
|
+
Entry.READY_TO_PUMP_FILE_DATA = 1;
|
|
32359
|
+
Entry.FILE_DATA_IN_PROGRESS = 2;
|
|
32360
|
+
Entry.FILE_DATA_DONE = 3;
|
|
32361
|
+
Entry.prototype.setLastModDate = function(date) {
|
|
32362
|
+
this.mtime = date;
|
|
32363
|
+
var dosDateTime = dateToDosDateTime(date);
|
|
32364
|
+
this.lastModFileTime = dosDateTime.time;
|
|
32365
|
+
this.lastModFileDate = dosDateTime.date;
|
|
32366
|
+
};
|
|
32367
|
+
Entry.prototype.setFileAttributesMode = function(mode) {
|
|
32368
|
+
if ((mode & 65535) !== mode) throw new Error("invalid mode. expected: 0 <= " + mode + " <= 65535");
|
|
32369
|
+
this.externalFileAttributes = mode << 16 >>> 0;
|
|
32370
|
+
};
|
|
32371
|
+
Entry.prototype.setFileDataPumpFunction = function(doFileDataPump) {
|
|
32372
|
+
this.doFileDataPump = doFileDataPump;
|
|
32373
|
+
this.state = Entry.READY_TO_PUMP_FILE_DATA;
|
|
32374
|
+
};
|
|
32375
|
+
Entry.prototype.useZip64Format = function() {
|
|
32376
|
+
return this.forceZip64Format || this.uncompressedSize != null && this.uncompressedSize > 4294967294 || this.compressedSize != null && this.compressedSize > 4294967294 || this.relativeOffsetOfLocalHeader != null && this.relativeOffsetOfLocalHeader > 4294967294;
|
|
32377
|
+
};
|
|
32378
|
+
var LOCAL_FILE_HEADER_FIXED_SIZE = 30;
|
|
32379
|
+
var VERSION_NEEDED_TO_EXTRACT_UTF8 = 20;
|
|
32380
|
+
var VERSION_NEEDED_TO_EXTRACT_ZIP64 = 45;
|
|
32381
|
+
var VERSION_MADE_BY = 831;
|
|
32382
|
+
var FILE_NAME_IS_UTF8 = 2048;
|
|
32383
|
+
var UNKNOWN_CRC32_AND_FILE_SIZES = 8;
|
|
32384
|
+
Entry.prototype.getLocalFileHeader = function() {
|
|
32385
|
+
var crc32 = 0;
|
|
32386
|
+
var compressedSize = 0;
|
|
32387
|
+
var uncompressedSize = 0;
|
|
32388
|
+
if (this.crcAndFileSizeKnown) {
|
|
32389
|
+
crc32 = this.crc32;
|
|
32390
|
+
compressedSize = this.compressedSize;
|
|
32391
|
+
uncompressedSize = this.uncompressedSize;
|
|
32392
|
+
}
|
|
32393
|
+
var fixedSizeStuff = bufferAlloc(LOCAL_FILE_HEADER_FIXED_SIZE);
|
|
32394
|
+
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
|
32395
|
+
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
|
32396
|
+
fixedSizeStuff.writeUInt32LE(67324752, 0);
|
|
32397
|
+
fixedSizeStuff.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_UTF8, 4);
|
|
32398
|
+
fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 6);
|
|
32399
|
+
fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 8);
|
|
32400
|
+
fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 10);
|
|
32401
|
+
fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 12);
|
|
32402
|
+
fixedSizeStuff.writeUInt32LE(crc32, 14);
|
|
32403
|
+
fixedSizeStuff.writeUInt32LE(compressedSize, 18);
|
|
32404
|
+
fixedSizeStuff.writeUInt32LE(uncompressedSize, 22);
|
|
32405
|
+
fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 26);
|
|
32406
|
+
fixedSizeStuff.writeUInt16LE(0, 28);
|
|
32407
|
+
return Buffer.concat([fixedSizeStuff, this.utf8FileName]);
|
|
32408
|
+
};
|
|
32409
|
+
var DATA_DESCRIPTOR_SIZE = 16;
|
|
32410
|
+
var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
|
|
32411
|
+
Entry.prototype.getDataDescriptor = function() {
|
|
32412
|
+
if (this.crcAndFileSizeKnown) return EMPTY_BUFFER;
|
|
32413
|
+
if (!this.useZip64Format()) {
|
|
32414
|
+
var buffer = bufferAlloc(DATA_DESCRIPTOR_SIZE);
|
|
32415
|
+
buffer.writeUInt32LE(134695760, 0);
|
|
32416
|
+
buffer.writeUInt32LE(this.crc32, 4);
|
|
32417
|
+
buffer.writeUInt32LE(this.compressedSize, 8);
|
|
32418
|
+
buffer.writeUInt32LE(this.uncompressedSize, 12);
|
|
32419
|
+
return buffer;
|
|
32420
|
+
} else {
|
|
32421
|
+
var buffer = bufferAlloc(ZIP64_DATA_DESCRIPTOR_SIZE);
|
|
32422
|
+
buffer.writeUInt32LE(134695760, 0);
|
|
32423
|
+
buffer.writeUInt32LE(this.crc32, 4);
|
|
32424
|
+
writeUInt64LE(buffer, this.compressedSize, 8);
|
|
32425
|
+
writeUInt64LE(buffer, this.uncompressedSize, 16);
|
|
32426
|
+
return buffer;
|
|
32427
|
+
}
|
|
32428
|
+
};
|
|
32429
|
+
var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46;
|
|
32430
|
+
var INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE = 9;
|
|
32431
|
+
var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28;
|
|
32432
|
+
Entry.prototype.getCentralDirectoryRecord = function() {
|
|
32433
|
+
var fixedSizeStuff = bufferAlloc(CENTRAL_DIRECTORY_RECORD_FIXED_SIZE);
|
|
32434
|
+
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
|
32435
|
+
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
|
32436
|
+
var izutefBuffer = EMPTY_BUFFER;
|
|
32437
|
+
if (!this.forceDosTimestamp) {
|
|
32438
|
+
izutefBuffer = bufferAlloc(INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE);
|
|
32439
|
+
izutefBuffer.writeUInt16LE(21589, 0);
|
|
32440
|
+
izutefBuffer.writeUInt16LE(INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE - 4, 2);
|
|
32441
|
+
izutefBuffer.writeUInt8(3, 4);
|
|
32442
|
+
var timestamp = Math.floor(this.mtime.getTime() / 1e3);
|
|
32443
|
+
if (timestamp < -2147483648) timestamp = -2147483648;
|
|
32444
|
+
if (timestamp > 2147483647) timestamp = 2147483647;
|
|
32445
|
+
izutefBuffer.writeUInt32LE(timestamp, 5);
|
|
32446
|
+
}
|
|
32447
|
+
var normalCompressedSize = this.compressedSize;
|
|
32448
|
+
var normalUncompressedSize = this.uncompressedSize;
|
|
32449
|
+
var normalRelativeOffsetOfLocalHeader = this.relativeOffsetOfLocalHeader;
|
|
32450
|
+
var versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8;
|
|
32451
|
+
var zeiefBuffer = EMPTY_BUFFER;
|
|
32452
|
+
if (this.useZip64Format()) {
|
|
32453
|
+
normalCompressedSize = 4294967295;
|
|
32454
|
+
normalUncompressedSize = 4294967295;
|
|
32455
|
+
normalRelativeOffsetOfLocalHeader = 4294967295;
|
|
32456
|
+
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64;
|
|
32457
|
+
zeiefBuffer = bufferAlloc(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE);
|
|
32458
|
+
zeiefBuffer.writeUInt16LE(1, 0);
|
|
32459
|
+
zeiefBuffer.writeUInt16LE(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE - 4, 2);
|
|
32460
|
+
writeUInt64LE(zeiefBuffer, this.uncompressedSize, 4);
|
|
32461
|
+
writeUInt64LE(zeiefBuffer, this.compressedSize, 12);
|
|
32462
|
+
writeUInt64LE(zeiefBuffer, this.relativeOffsetOfLocalHeader, 20);
|
|
32463
|
+
}
|
|
32464
|
+
fixedSizeStuff.writeUInt32LE(33639248, 0);
|
|
32465
|
+
fixedSizeStuff.writeUInt16LE(VERSION_MADE_BY, 4);
|
|
32466
|
+
fixedSizeStuff.writeUInt16LE(versionNeededToExtract, 6);
|
|
32467
|
+
fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 8);
|
|
32468
|
+
fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 10);
|
|
32469
|
+
fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 12);
|
|
32470
|
+
fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 14);
|
|
32471
|
+
fixedSizeStuff.writeUInt32LE(this.crc32, 16);
|
|
32472
|
+
fixedSizeStuff.writeUInt32LE(normalCompressedSize, 20);
|
|
32473
|
+
fixedSizeStuff.writeUInt32LE(normalUncompressedSize, 24);
|
|
32474
|
+
fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 28);
|
|
32475
|
+
fixedSizeStuff.writeUInt16LE(izutefBuffer.length + zeiefBuffer.length, 30);
|
|
32476
|
+
fixedSizeStuff.writeUInt16LE(this.fileComment.length, 32);
|
|
32477
|
+
fixedSizeStuff.writeUInt16LE(0, 34);
|
|
32478
|
+
fixedSizeStuff.writeUInt16LE(0, 36);
|
|
32479
|
+
fixedSizeStuff.writeUInt32LE(this.externalFileAttributes, 38);
|
|
32480
|
+
fixedSizeStuff.writeUInt32LE(normalRelativeOffsetOfLocalHeader, 42);
|
|
32481
|
+
return Buffer.concat([
|
|
32482
|
+
fixedSizeStuff,
|
|
32483
|
+
this.utf8FileName,
|
|
32484
|
+
izutefBuffer,
|
|
32485
|
+
zeiefBuffer,
|
|
32486
|
+
this.fileComment
|
|
32487
|
+
]);
|
|
32488
|
+
};
|
|
32489
|
+
Entry.prototype.getCompressionMethod = function() {
|
|
32490
|
+
return this.compressionLevel === 0 ? 0 : 8;
|
|
32491
|
+
};
|
|
32492
|
+
var minDosDate = new Date(1980, 0, 1);
|
|
32493
|
+
var maxDosDate = new Date(2107, 11, 31, 23, 59, 58);
|
|
32494
|
+
function dateToDosDateTime(jsDate) {
|
|
32495
|
+
if (jsDate < minDosDate) jsDate = minDosDate;
|
|
32496
|
+
else if (jsDate > maxDosDate) jsDate = maxDosDate;
|
|
32497
|
+
var date = 0;
|
|
32498
|
+
date |= jsDate.getDate() & 31;
|
|
32499
|
+
date |= (jsDate.getMonth() + 1 & 15) << 5;
|
|
32500
|
+
date |= (jsDate.getFullYear() - 1980 & 127) << 9;
|
|
32501
|
+
var time = 0;
|
|
32502
|
+
time |= Math.floor(jsDate.getSeconds() / 2);
|
|
32503
|
+
time |= (jsDate.getMinutes() & 63) << 5;
|
|
32504
|
+
time |= (jsDate.getHours() & 31) << 11;
|
|
32505
|
+
return {
|
|
32506
|
+
date,
|
|
32507
|
+
time
|
|
32508
|
+
};
|
|
32509
|
+
}
|
|
32510
|
+
function writeUInt64LE(buffer, n, offset) {
|
|
32511
|
+
var high = Math.floor(n / 4294967296);
|
|
32512
|
+
var low = n % 4294967296;
|
|
32513
|
+
buffer.writeUInt32LE(low, offset);
|
|
32514
|
+
buffer.writeUInt32LE(high, offset + 4);
|
|
32515
|
+
}
|
|
32516
|
+
util.inherits(ByteCounter, Transform);
|
|
32517
|
+
function ByteCounter(options) {
|
|
32518
|
+
Transform.call(this, options);
|
|
32519
|
+
this.byteCount = 0;
|
|
32520
|
+
}
|
|
32521
|
+
ByteCounter.prototype._transform = function(chunk, encoding, cb) {
|
|
32522
|
+
this.byteCount += chunk.length;
|
|
32523
|
+
cb(null, chunk);
|
|
32524
|
+
};
|
|
32525
|
+
util.inherits(Crc32Watcher, Transform);
|
|
32526
|
+
function Crc32Watcher(options) {
|
|
32527
|
+
Transform.call(this, options);
|
|
32528
|
+
this.crc32 = 0;
|
|
32529
|
+
}
|
|
32530
|
+
Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
|
|
32531
|
+
this.crc32 = crc32.unsigned(chunk, this.crc32);
|
|
32532
|
+
cb(null, chunk);
|
|
32533
|
+
};
|
|
32534
|
+
var cp437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0";
|
|
32535
|
+
if (cp437.length !== 256) throw new Error("assertion failure");
|
|
32536
|
+
var reverseCp437 = null;
|
|
32537
|
+
function encodeCp437(string) {
|
|
32538
|
+
if (/^[\x20-\x7e]*$/.test(string)) return bufferFrom(string, "utf-8");
|
|
32539
|
+
if (reverseCp437 == null) {
|
|
32540
|
+
reverseCp437 = {};
|
|
32541
|
+
for (var i = 0; i < cp437.length; i++) reverseCp437[cp437[i]] = i;
|
|
32542
|
+
}
|
|
32543
|
+
var result = bufferAlloc(string.length);
|
|
32544
|
+
for (var i = 0; i < string.length; i++) {
|
|
32545
|
+
var b = reverseCp437[string[i]];
|
|
32546
|
+
if (b == null) throw new Error("character not encodable in CP437: " + JSON.stringify(string[i]));
|
|
32547
|
+
result[i] = b;
|
|
32548
|
+
}
|
|
32549
|
+
return result;
|
|
32550
|
+
}
|
|
32551
|
+
function bufferAlloc(size) {
|
|
32552
|
+
bufferAlloc = modern;
|
|
32553
|
+
try {
|
|
32554
|
+
return bufferAlloc(size);
|
|
32555
|
+
} catch (e) {
|
|
32556
|
+
bufferAlloc = legacy;
|
|
32557
|
+
return bufferAlloc(size);
|
|
32558
|
+
}
|
|
32559
|
+
function modern(size) {
|
|
32560
|
+
return Buffer.allocUnsafe(size);
|
|
32561
|
+
}
|
|
32562
|
+
function legacy(size) {
|
|
32563
|
+
return new Buffer(size);
|
|
32564
|
+
}
|
|
32565
|
+
}
|
|
32566
|
+
function bufferFrom(something, encoding) {
|
|
32567
|
+
bufferFrom = modern;
|
|
32568
|
+
try {
|
|
32569
|
+
return bufferFrom(something, encoding);
|
|
32570
|
+
} catch (e) {
|
|
32571
|
+
bufferFrom = legacy;
|
|
32572
|
+
return bufferFrom(something, encoding);
|
|
32573
|
+
}
|
|
32574
|
+
function modern(something, encoding) {
|
|
32575
|
+
return Buffer.from(something, encoding);
|
|
32576
|
+
}
|
|
32577
|
+
function legacy(something, encoding) {
|
|
32578
|
+
return new Buffer(something, encoding);
|
|
32579
|
+
}
|
|
32580
|
+
}
|
|
32581
|
+
function bufferIncludes(buffer, content) {
|
|
32582
|
+
bufferIncludes = modern;
|
|
32583
|
+
try {
|
|
32584
|
+
return bufferIncludes(buffer, content);
|
|
32585
|
+
} catch (e) {
|
|
32586
|
+
bufferIncludes = legacy;
|
|
32587
|
+
return bufferIncludes(buffer, content);
|
|
32588
|
+
}
|
|
32589
|
+
function modern(buffer, content) {
|
|
32590
|
+
return buffer.includes(content);
|
|
32591
|
+
}
|
|
32592
|
+
function legacy(buffer, content) {
|
|
32593
|
+
for (var i = 0; i <= buffer.length - content.length; i++) for (var j = 0;; j++) {
|
|
32594
|
+
if (j === content.length) return true;
|
|
32595
|
+
if (buffer[i + j] !== content[j]) break;
|
|
32596
|
+
}
|
|
32597
|
+
return false;
|
|
32598
|
+
}
|
|
32599
|
+
}
|
|
32600
|
+
})))();
|
|
32601
|
+
const DEFAULT_COMPONENT_TYPE = "Map";
|
|
32602
|
+
const ZIP_TEMP_DIR_PREFIX = "connxio-code-component-";
|
|
32603
|
+
async function uploadCodeComponent(client, input) {
|
|
32604
|
+
const name = input.name.trim();
|
|
32605
|
+
if (!name) throw new Error("Code component name cannot be empty.");
|
|
32606
|
+
const requestedVersion = normalizeOptionalString(input.version);
|
|
32607
|
+
const requestedType = normalizeOptionalString(input.type);
|
|
32608
|
+
const sourceFilePath = resolveLocalPath(input.filePath);
|
|
32609
|
+
const sourceFileType = await getUploadFileType(sourceFilePath);
|
|
32610
|
+
const existingComponent = await findCodeComponentByName(client, name);
|
|
32611
|
+
const previousVersion = existingComponent ? await getLatestComponentVersion(client, existingComponent) : null;
|
|
32612
|
+
const resolvedVersion = requestedVersion ?? incrementVersion(previousVersion ?? "1.0.0", !previousVersion);
|
|
32613
|
+
const componentId = existingComponent?.id ?? randomUUID();
|
|
32614
|
+
const componentType = requestedType ?? existingComponent?.type ?? DEFAULT_COMPONENT_TYPE;
|
|
32615
|
+
const warnings = collectFileTypeWarnings(existingComponent, sourceFileType, input.autoZip);
|
|
32616
|
+
let uploadFilePath = sourceFilePath;
|
|
32617
|
+
let tempDirectoryPath;
|
|
32618
|
+
const autoZipped = sourceFileType === "dll" && shouldAutoZip(existingComponent, sourceFileType, input.autoZip);
|
|
32619
|
+
try {
|
|
32620
|
+
if (autoZipped) {
|
|
32621
|
+
const archive = await createUploadArchive(sourceFilePath);
|
|
32622
|
+
uploadFilePath = archive.filePath;
|
|
32623
|
+
tempDirectoryPath = archive.tempDirectoryPath;
|
|
32624
|
+
}
|
|
32625
|
+
const uploadBuffer = await readFile(uploadFilePath);
|
|
32626
|
+
const uploadedFilename = basename(uploadFilePath);
|
|
32627
|
+
const uploadedFileType = getFileTypeFromExtension(uploadFilePath);
|
|
32628
|
+
return {
|
|
32629
|
+
apiResult: await client.put("/v2/codecomponents", { body: {
|
|
32630
|
+
componentOriginalFilename: uploadedFilename,
|
|
32631
|
+
id: componentId,
|
|
32632
|
+
mappingDll: uploadBuffer.toString("base64"),
|
|
32633
|
+
name,
|
|
32634
|
+
type: componentType,
|
|
32635
|
+
version: resolvedVersion
|
|
32636
|
+
} }),
|
|
32637
|
+
autoZipped,
|
|
32638
|
+
componentId,
|
|
32639
|
+
name,
|
|
32640
|
+
previousVersion,
|
|
32641
|
+
resolvedVersion,
|
|
32642
|
+
sourceFilePath,
|
|
32643
|
+
uploadedFilePath: uploadFilePath,
|
|
32644
|
+
uploadedFilename,
|
|
32645
|
+
uploadedFileType,
|
|
32646
|
+
warnings
|
|
32647
|
+
};
|
|
32648
|
+
} finally {
|
|
32649
|
+
if (tempDirectoryPath) await rm(tempDirectoryPath, {
|
|
32650
|
+
force: true,
|
|
32651
|
+
recursive: true
|
|
32652
|
+
});
|
|
32653
|
+
}
|
|
32654
|
+
}
|
|
32655
|
+
async function updateComponentInIntegration(client, input) {
|
|
32656
|
+
const integrationId = input.integrationId.trim();
|
|
32657
|
+
const componentName = input.componentName.trim();
|
|
32658
|
+
const oldVersion = input.oldVersion.trim();
|
|
32659
|
+
const newVersion = input.newVersion.trim();
|
|
32660
|
+
if (!integrationId) throw new Error("Integration id cannot be empty.");
|
|
32661
|
+
if (!componentName) throw new Error("Code component name cannot be empty.");
|
|
32662
|
+
if (!oldVersion || !newVersion) throw new Error("Both oldVersion and newVersion are required.");
|
|
32663
|
+
const integration = await client.get(`/v2/integrations/${encodeURIComponent(integrationId)}`);
|
|
32664
|
+
if (!isRecord(integration)) throw new Error(`Integration ${integrationId} was not found.`);
|
|
32665
|
+
const existingComponent = await findCodeComponentByName(client, componentName);
|
|
32666
|
+
const nextIntegration = JSON.parse(JSON.stringify(integration));
|
|
32667
|
+
if (!replaceComponentVersion(nextIntegration, [existingComponent?.id, componentName].filter((value) => Boolean(value)), oldVersion, newVersion, existingComponent?.sasUri ? { newSasUri: existingComponent.sasUri } : {})) return {
|
|
32668
|
+
componentId: existingComponent?.id ?? null,
|
|
32669
|
+
componentName,
|
|
32670
|
+
integrationId,
|
|
32671
|
+
result: null,
|
|
32672
|
+
updated: false
|
|
32673
|
+
};
|
|
32674
|
+
const result = await client.put(`/v2/integrations/${encodeURIComponent(integrationId)}`, { body: nextIntegration });
|
|
32675
|
+
return {
|
|
32676
|
+
componentId: existingComponent?.id ?? null,
|
|
32677
|
+
componentName,
|
|
32678
|
+
integrationId,
|
|
32679
|
+
result,
|
|
32680
|
+
updated: true
|
|
32681
|
+
};
|
|
32682
|
+
}
|
|
32683
|
+
function normalizeOptionalString(value) {
|
|
32684
|
+
const normalized = value?.trim();
|
|
32685
|
+
return normalized ? normalized : void 0;
|
|
32686
|
+
}
|
|
32687
|
+
function resolveLocalPath(filePath) {
|
|
32688
|
+
const normalized = filePath.trim();
|
|
32689
|
+
if (!normalized) throw new Error("filePath cannot be empty.");
|
|
32690
|
+
return isAbsolute(normalized) ? normalized : resolve(normalized);
|
|
32691
|
+
}
|
|
32692
|
+
async function getUploadFileType(filePath) {
|
|
32693
|
+
let fileStats;
|
|
32694
|
+
try {
|
|
32695
|
+
fileStats = await stat(filePath);
|
|
32696
|
+
} catch (error) {
|
|
32697
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32698
|
+
throw new Error(`Code component file not found: ${filePath}. ${message}`);
|
|
32699
|
+
}
|
|
32700
|
+
if (!fileStats.isFile()) throw new Error(`Code component path is not a file: ${filePath}`);
|
|
32701
|
+
return getFileTypeFromExtension(filePath);
|
|
32702
|
+
}
|
|
32703
|
+
function getFileTypeFromExtension(filePath) {
|
|
32704
|
+
const extension = extname(filePath).toLowerCase();
|
|
32705
|
+
if (extension === ".dll") return "dll";
|
|
32706
|
+
if (extension === ".zip") return "zip";
|
|
32707
|
+
throw new Error(`Unsupported code component file type: ${filePath}. Only .dll and .zip are supported.`);
|
|
32708
|
+
}
|
|
32709
|
+
async function findCodeComponentByName(client, name) {
|
|
32710
|
+
const codeComponents = await client.get("/v2/codecomponents");
|
|
32711
|
+
if (!Array.isArray(codeComponents)) throw new Error("Connxio code components response was not an array.");
|
|
32712
|
+
const normalizedName = name.toLowerCase();
|
|
32713
|
+
return codeComponents.map(parseCodeComponentRecord).find((component) => component?.name.toLowerCase() === normalizedName);
|
|
32714
|
+
}
|
|
32715
|
+
async function getLatestComponentVersion(client, component) {
|
|
32716
|
+
const versionsResponse = await client.get(`/v2/codecomponents/${encodeURIComponent(component.id)}/versions`);
|
|
32717
|
+
const versionCandidates = Array.isArray(versionsResponse) ? versionsResponse.map(readVersionValue).filter((version) => version !== void 0) : [];
|
|
32718
|
+
if (component.version) versionCandidates.push(component.version);
|
|
32719
|
+
return pickLatestVersion(versionCandidates) ?? null;
|
|
32720
|
+
}
|
|
32721
|
+
function readVersionValue(value) {
|
|
32722
|
+
if (typeof value === "string") return value;
|
|
32723
|
+
if (!isRecord(value)) return;
|
|
32724
|
+
if (typeof value.version === "string") return value.version;
|
|
32725
|
+
if (typeof value.Version === "string") return value.Version;
|
|
32726
|
+
}
|
|
32727
|
+
function pickLatestVersion(versions) {
|
|
32728
|
+
if (versions.length === 0) return;
|
|
32729
|
+
const parsedVersions = versions.map((version) => ({
|
|
32730
|
+
parsed: parseVersion(version),
|
|
32731
|
+
version
|
|
32732
|
+
})).filter((item) => item.parsed !== void 0);
|
|
32733
|
+
if (parsedVersions.length === 0) return versions[0];
|
|
32734
|
+
parsedVersions.sort((left, right) => compareVersionParts(right.parsed, left.parsed));
|
|
32735
|
+
return parsedVersions[0]?.version;
|
|
32736
|
+
}
|
|
32737
|
+
function incrementVersion(version, isInitialVersion = false) {
|
|
32738
|
+
if (isInitialVersion) return version;
|
|
32739
|
+
const parts = version.split(".");
|
|
32740
|
+
while (parts.length < 3) parts.push("0");
|
|
32741
|
+
const patch = Number.parseInt(parts[2] ?? "0", 10);
|
|
32742
|
+
parts[2] = Number.isNaN(patch) ? "1" : String(patch + 1);
|
|
32743
|
+
return parts.join(".");
|
|
32744
|
+
}
|
|
32745
|
+
function parseVersion(version) {
|
|
32746
|
+
const parts = version.split(".").map((part) => Number.parseInt(part, 10));
|
|
32747
|
+
if (parts.some((part) => Number.isNaN(part))) return;
|
|
32748
|
+
return parts;
|
|
32749
|
+
}
|
|
32750
|
+
function compareVersionParts(left, right) {
|
|
32751
|
+
const length = Math.max(left.length, right.length);
|
|
32752
|
+
for (let index = 0; index < length; index += 1) {
|
|
32753
|
+
const leftValue = left[index] ?? 0;
|
|
32754
|
+
const rightValue = right[index] ?? 0;
|
|
32755
|
+
if (leftValue !== rightValue) return leftValue - rightValue;
|
|
32756
|
+
}
|
|
32757
|
+
return 0;
|
|
32758
|
+
}
|
|
32759
|
+
function shouldAutoZip(existingComponent, sourceFileType, autoZip) {
|
|
32760
|
+
if (sourceFileType === "zip") return false;
|
|
32761
|
+
if (autoZip !== void 0) return autoZip;
|
|
32762
|
+
return extname(existingComponent?.componentOriginalFilename ?? "").toLowerCase() === ".zip";
|
|
32763
|
+
}
|
|
32764
|
+
function collectFileTypeWarnings(existingComponent, sourceFileType, autoZip) {
|
|
32765
|
+
if (!existingComponent?.componentOriginalFilename) return [];
|
|
32766
|
+
const existingFileType = extname(existingComponent.componentOriginalFilename).toLowerCase();
|
|
32767
|
+
if (!existingFileType || existingFileType === `.${sourceFileType}`) return [];
|
|
32768
|
+
if (existingFileType === ".zip" && sourceFileType === "dll" && autoZip !== false) return [];
|
|
32769
|
+
return [`Existing component ${existingComponent.name} was last uploaded as ${existingComponent.componentOriginalFilename}.`];
|
|
32770
|
+
}
|
|
32771
|
+
async function createUploadArchive(sourceFilePath) {
|
|
32772
|
+
const sourceDirectoryPath = dirname(sourceFilePath);
|
|
32773
|
+
const tempDirectoryPath = await mkdtemp(join(tmpdir(), ZIP_TEMP_DIR_PREFIX));
|
|
32774
|
+
const filePath = join(tempDirectoryPath, `${basename(sourceFilePath, extname(sourceFilePath))}.zip`);
|
|
32775
|
+
const zipFile = new import_yazl.ZipFile();
|
|
32776
|
+
const output = createWriteStream(filePath);
|
|
32777
|
+
zipFile.outputStream.pipe(output);
|
|
32778
|
+
await addDirectoryToZip(zipFile, sourceDirectoryPath, sourceDirectoryPath);
|
|
32779
|
+
const archiveComplete = new Promise((resolveArchive, rejectArchive) => {
|
|
32780
|
+
output.on("close", () => resolveArchive());
|
|
32781
|
+
output.on("error", rejectArchive);
|
|
32782
|
+
zipFile.outputStream.on("error", rejectArchive);
|
|
32783
|
+
});
|
|
32784
|
+
zipFile.end();
|
|
32785
|
+
await archiveComplete;
|
|
32786
|
+
return {
|
|
32787
|
+
filePath,
|
|
32788
|
+
tempDirectoryPath
|
|
32789
|
+
};
|
|
32790
|
+
}
|
|
32791
|
+
async function addDirectoryToZip(zipFile, rootDirectoryPath, currentDirectoryPath) {
|
|
32792
|
+
const entries = await readdir(currentDirectoryPath, { withFileTypes: true });
|
|
32793
|
+
for (const entry of entries) {
|
|
32794
|
+
const absolutePath = join(currentDirectoryPath, entry.name);
|
|
32795
|
+
if (entry.isDirectory()) {
|
|
32796
|
+
await addDirectoryToZip(zipFile, rootDirectoryPath, absolutePath);
|
|
32797
|
+
continue;
|
|
32798
|
+
}
|
|
32799
|
+
if (!entry.isFile()) continue;
|
|
32800
|
+
const relativePath = relative(rootDirectoryPath, absolutePath).split(sep).join("/");
|
|
32801
|
+
zipFile.addFile(absolutePath, relativePath);
|
|
32802
|
+
}
|
|
32803
|
+
}
|
|
32804
|
+
function parseCodeComponentRecord(value) {
|
|
32805
|
+
if (!isRecord(value) || typeof value.id !== "string" || typeof value.name !== "string") return;
|
|
32806
|
+
return {
|
|
32807
|
+
componentOriginalFilename: typeof value.componentOriginalFilename === "string" ? value.componentOriginalFilename : null,
|
|
32808
|
+
id: value.id,
|
|
32809
|
+
name: value.name,
|
|
32810
|
+
sasUri: typeof value.sasUri === "string" ? value.sasUri : null,
|
|
32811
|
+
type: typeof value.type === "string" ? value.type : null,
|
|
32812
|
+
version: readVersionValue(value) ?? null
|
|
32813
|
+
};
|
|
32814
|
+
}
|
|
32815
|
+
function replaceComponentVersion(value, matchTerms, oldVersion, newVersion, options) {
|
|
32816
|
+
if (!isRecord(value) && !Array.isArray(value)) return false;
|
|
32817
|
+
if (Array.isArray(value)) {
|
|
32818
|
+
let changed = false;
|
|
32819
|
+
for (const item of value) if (replaceComponentVersion(item, matchTerms, oldVersion, newVersion, options)) changed = true;
|
|
32820
|
+
return changed;
|
|
32821
|
+
}
|
|
32822
|
+
const record = value;
|
|
32823
|
+
const referencesComponent = Object.values(record).some((entry) => typeof entry === "string" && matchTerms.some((term) => entry.includes(term)));
|
|
32824
|
+
let changed = false;
|
|
32825
|
+
if (referencesComponent) for (const [key, entry] of Object.entries(record)) {
|
|
32826
|
+
if (typeof entry !== "string") continue;
|
|
32827
|
+
const lowerKey = key.toLowerCase();
|
|
32828
|
+
if (lowerKey.includes("version") && entry === oldVersion) {
|
|
32829
|
+
record[key] = newVersion;
|
|
32830
|
+
changed = true;
|
|
32831
|
+
continue;
|
|
32832
|
+
}
|
|
32833
|
+
if (options.newSasUri && lowerKey.includes("sasuri") && entry.includes(oldVersion)) {
|
|
32834
|
+
record[key] = options.newSasUri;
|
|
32835
|
+
changed = true;
|
|
32836
|
+
}
|
|
32837
|
+
}
|
|
32838
|
+
for (const [key, entry] of Object.entries(record)) {
|
|
32839
|
+
if (typeof entry === "string" && looksLikeJson(entry)) {
|
|
32840
|
+
try {
|
|
32841
|
+
const parsed = JSON.parse(entry);
|
|
32842
|
+
if (replaceComponentVersion(parsed, matchTerms, oldVersion, newVersion, options)) {
|
|
32843
|
+
record[key] = JSON.stringify(parsed);
|
|
32844
|
+
changed = true;
|
|
32845
|
+
}
|
|
32846
|
+
} catch {}
|
|
32847
|
+
continue;
|
|
32848
|
+
}
|
|
32849
|
+
if (replaceComponentVersion(entry, matchTerms, oldVersion, newVersion, options)) changed = true;
|
|
32850
|
+
}
|
|
32851
|
+
return changed;
|
|
32852
|
+
}
|
|
32853
|
+
function looksLikeJson(value) {
|
|
32854
|
+
const trimmed = value.trimStart();
|
|
32855
|
+
return trimmed.startsWith("{") || trimmed.startsWith("[");
|
|
32856
|
+
}
|
|
32857
|
+
function isRecord(value) {
|
|
32858
|
+
return typeof value === "object" && value !== null;
|
|
32859
|
+
}
|
|
32860
|
+
//#endregion
|
|
31726
32861
|
//#region packages/cli/src/mcp/tools/code-components.ts
|
|
31727
32862
|
function registerCodeComponentTools(server) {
|
|
31728
32863
|
server.registerTool("list_code_components", {
|
|
@@ -31743,13 +32878,23 @@ function registerCodeComponentTools(server) {
|
|
|
31743
32878
|
id: string().describe("Code component id.")
|
|
31744
32879
|
}
|
|
31745
32880
|
}, async ({ contextId, id }) => withToolErrors(async () => ({ versions: await (await getClient(contextId)).get(`/v2/codecomponents/${encodeURIComponent(id)}/versions`) })));
|
|
31746
|
-
server.registerTool("
|
|
31747
|
-
description: "
|
|
32881
|
+
server.registerTool("upload_code_component", {
|
|
32882
|
+
description: "Upload a local .dll or .zip file as a Connxio code component. Requires contextId.",
|
|
31748
32883
|
inputSchema: {
|
|
32884
|
+
autoZip: boolean().optional().describe("Whether to zip the containing directory when uploading a .dll. Defaults to true when the existing component was previously uploaded as a .zip."),
|
|
31749
32885
|
contextId: contextIdSchema,
|
|
31750
|
-
|
|
31751
|
-
|
|
31752
|
-
|
|
32886
|
+
filePath: string().describe("Absolute or relative path to a local .dll or .zip file."),
|
|
32887
|
+
name: string().describe("Code component display name."),
|
|
32888
|
+
type: string().optional().describe("Optional code component type. Defaults to the existing type or Map."),
|
|
32889
|
+
version: string().optional().describe("Optional version. When omitted, the latest version is looked up and the patch version is incremented.")
|
|
32890
|
+
}
|
|
32891
|
+
}, async ({ autoZip, contextId, filePath, name, type, version }) => withToolErrors(async () => ({ upload: await uploadCodeComponent(await getClient(contextId), {
|
|
32892
|
+
autoZip,
|
|
32893
|
+
filePath,
|
|
32894
|
+
name,
|
|
32895
|
+
type,
|
|
32896
|
+
version
|
|
32897
|
+
}) })));
|
|
31753
32898
|
server.registerTool("deprecate_code_component", {
|
|
31754
32899
|
description: "Deprecate a Connxio code component by id. Requires contextId.",
|
|
31755
32900
|
inputSchema: {
|
|
@@ -31758,6 +32903,21 @@ function registerCodeComponentTools(server) {
|
|
|
31758
32903
|
version: string().optional().describe("Optional version to deprecate.")
|
|
31759
32904
|
}
|
|
31760
32905
|
}, async ({ contextId, id, version }) => withToolErrors(async () => ({ result: await (await getClient(contextId)).put(`/v2/codecomponents/${encodeURIComponent(id)}/deprecate`, { query: { version } }) })));
|
|
32906
|
+
server.registerTool("update_component_in_integration", {
|
|
32907
|
+
description: "Update the version of a code component used inside an integration. Requires contextId.",
|
|
32908
|
+
inputSchema: {
|
|
32909
|
+
componentName: string().describe("Code component display name to update."),
|
|
32910
|
+
contextId: contextIdSchema,
|
|
32911
|
+
integrationId: string().describe("Integration id."),
|
|
32912
|
+
newVersion: string().describe("New code component version to set."),
|
|
32913
|
+
oldVersion: string().describe("Current code component version to replace.")
|
|
32914
|
+
}
|
|
32915
|
+
}, async ({ componentName, contextId, integrationId, newVersion, oldVersion }) => withToolErrors(async () => ({ update: await updateComponentInIntegration(await getClient(contextId), {
|
|
32916
|
+
componentName,
|
|
32917
|
+
integrationId,
|
|
32918
|
+
newVersion,
|
|
32919
|
+
oldVersion
|
|
32920
|
+
}) })));
|
|
31761
32921
|
server.registerTool("rename_code_component", {
|
|
31762
32922
|
description: "Update a Connxio code component name by id. Requires contextId.",
|
|
31763
32923
|
inputSchema: {
|