apipost-cli 2.0.1 → 2.0.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.js +173 -763
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -680617,623 +680617,6 @@ exports.minify_sync = minify_sync;
|
|
|
680617
680617
|
}));
|
|
680618
680618
|
|
|
680619
680619
|
|
|
680620
|
-
/***/ }),
|
|
680621
|
-
|
|
680622
|
-
/***/ 863730:
|
|
680623
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680624
|
-
|
|
680625
|
-
"use strict";
|
|
680626
|
-
|
|
680627
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680628
|
-
exports.version = exports.validate = exports.v7 = exports.v6ToV1 = exports.v6 = exports.v5 = exports.v4 = exports.v3 = exports.v1ToV6 = exports.v1 = exports.stringify = exports.parse = exports.NIL = exports.MAX = void 0;
|
|
680629
|
-
var max_js_1 = __nccwpck_require__(444838);
|
|
680630
|
-
Object.defineProperty(exports, "MAX", ({ enumerable: true, get: function () { return max_js_1.default; } }));
|
|
680631
|
-
var nil_js_1 = __nccwpck_require__(334578);
|
|
680632
|
-
Object.defineProperty(exports, "NIL", ({ enumerable: true, get: function () { return nil_js_1.default; } }));
|
|
680633
|
-
var parse_js_1 = __nccwpck_require__(862526);
|
|
680634
|
-
Object.defineProperty(exports, "parse", ({ enumerable: true, get: function () { return parse_js_1.default; } }));
|
|
680635
|
-
var stringify_js_1 = __nccwpck_require__(422428);
|
|
680636
|
-
Object.defineProperty(exports, "stringify", ({ enumerable: true, get: function () { return stringify_js_1.default; } }));
|
|
680637
|
-
var v1_js_1 = __nccwpck_require__(356904);
|
|
680638
|
-
Object.defineProperty(exports, "v1", ({ enumerable: true, get: function () { return v1_js_1.default; } }));
|
|
680639
|
-
var v1ToV6_js_1 = __nccwpck_require__(990728);
|
|
680640
|
-
Object.defineProperty(exports, "v1ToV6", ({ enumerable: true, get: function () { return v1ToV6_js_1.default; } }));
|
|
680641
|
-
var v3_js_1 = __nccwpck_require__(206261);
|
|
680642
|
-
Object.defineProperty(exports, "v3", ({ enumerable: true, get: function () { return v3_js_1.default; } }));
|
|
680643
|
-
var v4_js_1 = __nccwpck_require__(759079);
|
|
680644
|
-
Object.defineProperty(exports, "v4", ({ enumerable: true, get: function () { return v4_js_1.default; } }));
|
|
680645
|
-
var v5_js_1 = __nccwpck_require__(519985);
|
|
680646
|
-
Object.defineProperty(exports, "v5", ({ enumerable: true, get: function () { return v5_js_1.default; } }));
|
|
680647
|
-
var v6_js_1 = __nccwpck_require__(821952);
|
|
680648
|
-
Object.defineProperty(exports, "v6", ({ enumerable: true, get: function () { return v6_js_1.default; } }));
|
|
680649
|
-
var v6ToV1_js_1 = __nccwpck_require__(597112);
|
|
680650
|
-
Object.defineProperty(exports, "v6ToV1", ({ enumerable: true, get: function () { return v6ToV1_js_1.default; } }));
|
|
680651
|
-
var v7_js_1 = __nccwpck_require__(103598);
|
|
680652
|
-
Object.defineProperty(exports, "v7", ({ enumerable: true, get: function () { return v7_js_1.default; } }));
|
|
680653
|
-
var validate_js_1 = __nccwpck_require__(983053);
|
|
680654
|
-
Object.defineProperty(exports, "validate", ({ enumerable: true, get: function () { return validate_js_1.default; } }));
|
|
680655
|
-
var version_js_1 = __nccwpck_require__(894384);
|
|
680656
|
-
Object.defineProperty(exports, "version", ({ enumerable: true, get: function () { return version_js_1.default; } }));
|
|
680657
|
-
|
|
680658
|
-
|
|
680659
|
-
/***/ }),
|
|
680660
|
-
|
|
680661
|
-
/***/ 444838:
|
|
680662
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
680663
|
-
|
|
680664
|
-
"use strict";
|
|
680665
|
-
|
|
680666
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680667
|
-
exports["default"] = 'ffffffff-ffff-ffff-ffff-ffffffffffff';
|
|
680668
|
-
|
|
680669
|
-
|
|
680670
|
-
/***/ }),
|
|
680671
|
-
|
|
680672
|
-
/***/ 113905:
|
|
680673
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680674
|
-
|
|
680675
|
-
"use strict";
|
|
680676
|
-
|
|
680677
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680678
|
-
const crypto_1 = __nccwpck_require__(706113);
|
|
680679
|
-
function md5(bytes) {
|
|
680680
|
-
if (Array.isArray(bytes)) {
|
|
680681
|
-
bytes = Buffer.from(bytes);
|
|
680682
|
-
}
|
|
680683
|
-
else if (typeof bytes === 'string') {
|
|
680684
|
-
bytes = Buffer.from(bytes, 'utf8');
|
|
680685
|
-
}
|
|
680686
|
-
return (0, crypto_1.createHash)('md5').update(bytes).digest();
|
|
680687
|
-
}
|
|
680688
|
-
exports["default"] = md5;
|
|
680689
|
-
|
|
680690
|
-
|
|
680691
|
-
/***/ }),
|
|
680692
|
-
|
|
680693
|
-
/***/ 176622:
|
|
680694
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680695
|
-
|
|
680696
|
-
"use strict";
|
|
680697
|
-
|
|
680698
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680699
|
-
const crypto_1 = __nccwpck_require__(706113);
|
|
680700
|
-
exports["default"] = { randomUUID: crypto_1.randomUUID };
|
|
680701
|
-
|
|
680702
|
-
|
|
680703
|
-
/***/ }),
|
|
680704
|
-
|
|
680705
|
-
/***/ 334578:
|
|
680706
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
680707
|
-
|
|
680708
|
-
"use strict";
|
|
680709
|
-
|
|
680710
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680711
|
-
exports["default"] = '00000000-0000-0000-0000-000000000000';
|
|
680712
|
-
|
|
680713
|
-
|
|
680714
|
-
/***/ }),
|
|
680715
|
-
|
|
680716
|
-
/***/ 862526:
|
|
680717
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680718
|
-
|
|
680719
|
-
"use strict";
|
|
680720
|
-
|
|
680721
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680722
|
-
const validate_js_1 = __nccwpck_require__(983053);
|
|
680723
|
-
function parse(uuid) {
|
|
680724
|
-
if (!(0, validate_js_1.default)(uuid)) {
|
|
680725
|
-
throw TypeError('Invalid UUID');
|
|
680726
|
-
}
|
|
680727
|
-
let v;
|
|
680728
|
-
return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 0xff, ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff, (v / 0x100000000) & 0xff, (v >>> 24) & 0xff, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff);
|
|
680729
|
-
}
|
|
680730
|
-
exports["default"] = parse;
|
|
680731
|
-
|
|
680732
|
-
|
|
680733
|
-
/***/ }),
|
|
680734
|
-
|
|
680735
|
-
/***/ 229556:
|
|
680736
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
680737
|
-
|
|
680738
|
-
"use strict";
|
|
680739
|
-
|
|
680740
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680741
|
-
exports["default"] = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
680742
|
-
|
|
680743
|
-
|
|
680744
|
-
/***/ }),
|
|
680745
|
-
|
|
680746
|
-
/***/ 618186:
|
|
680747
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680748
|
-
|
|
680749
|
-
"use strict";
|
|
680750
|
-
|
|
680751
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680752
|
-
const crypto_1 = __nccwpck_require__(706113);
|
|
680753
|
-
const rnds8Pool = new Uint8Array(256);
|
|
680754
|
-
let poolPtr = rnds8Pool.length;
|
|
680755
|
-
function rng() {
|
|
680756
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
680757
|
-
(0, crypto_1.randomFillSync)(rnds8Pool);
|
|
680758
|
-
poolPtr = 0;
|
|
680759
|
-
}
|
|
680760
|
-
return rnds8Pool.slice(poolPtr, (poolPtr += 16));
|
|
680761
|
-
}
|
|
680762
|
-
exports["default"] = rng;
|
|
680763
|
-
|
|
680764
|
-
|
|
680765
|
-
/***/ }),
|
|
680766
|
-
|
|
680767
|
-
/***/ 298850:
|
|
680768
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680769
|
-
|
|
680770
|
-
"use strict";
|
|
680771
|
-
|
|
680772
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680773
|
-
const crypto_1 = __nccwpck_require__(706113);
|
|
680774
|
-
function sha1(bytes) {
|
|
680775
|
-
if (Array.isArray(bytes)) {
|
|
680776
|
-
bytes = Buffer.from(bytes);
|
|
680777
|
-
}
|
|
680778
|
-
else if (typeof bytes === 'string') {
|
|
680779
|
-
bytes = Buffer.from(bytes, 'utf8');
|
|
680780
|
-
}
|
|
680781
|
-
return (0, crypto_1.createHash)('sha1').update(bytes).digest();
|
|
680782
|
-
}
|
|
680783
|
-
exports["default"] = sha1;
|
|
680784
|
-
|
|
680785
|
-
|
|
680786
|
-
/***/ }),
|
|
680787
|
-
|
|
680788
|
-
/***/ 422428:
|
|
680789
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680790
|
-
|
|
680791
|
-
"use strict";
|
|
680792
|
-
|
|
680793
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680794
|
-
exports.unsafeStringify = void 0;
|
|
680795
|
-
const validate_js_1 = __nccwpck_require__(983053);
|
|
680796
|
-
const byteToHex = [];
|
|
680797
|
-
for (let i = 0; i < 256; ++i) {
|
|
680798
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
680799
|
-
}
|
|
680800
|
-
function unsafeStringify(arr, offset = 0) {
|
|
680801
|
-
return (byteToHex[arr[offset + 0]] +
|
|
680802
|
-
byteToHex[arr[offset + 1]] +
|
|
680803
|
-
byteToHex[arr[offset + 2]] +
|
|
680804
|
-
byteToHex[arr[offset + 3]] +
|
|
680805
|
-
'-' +
|
|
680806
|
-
byteToHex[arr[offset + 4]] +
|
|
680807
|
-
byteToHex[arr[offset + 5]] +
|
|
680808
|
-
'-' +
|
|
680809
|
-
byteToHex[arr[offset + 6]] +
|
|
680810
|
-
byteToHex[arr[offset + 7]] +
|
|
680811
|
-
'-' +
|
|
680812
|
-
byteToHex[arr[offset + 8]] +
|
|
680813
|
-
byteToHex[arr[offset + 9]] +
|
|
680814
|
-
'-' +
|
|
680815
|
-
byteToHex[arr[offset + 10]] +
|
|
680816
|
-
byteToHex[arr[offset + 11]] +
|
|
680817
|
-
byteToHex[arr[offset + 12]] +
|
|
680818
|
-
byteToHex[arr[offset + 13]] +
|
|
680819
|
-
byteToHex[arr[offset + 14]] +
|
|
680820
|
-
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
680821
|
-
}
|
|
680822
|
-
exports.unsafeStringify = unsafeStringify;
|
|
680823
|
-
function stringify(arr, offset = 0) {
|
|
680824
|
-
const uuid = unsafeStringify(arr, offset);
|
|
680825
|
-
if (!(0, validate_js_1.default)(uuid)) {
|
|
680826
|
-
throw TypeError('Stringified UUID is invalid');
|
|
680827
|
-
}
|
|
680828
|
-
return uuid;
|
|
680829
|
-
}
|
|
680830
|
-
exports["default"] = stringify;
|
|
680831
|
-
|
|
680832
|
-
|
|
680833
|
-
/***/ }),
|
|
680834
|
-
|
|
680835
|
-
/***/ 356904:
|
|
680836
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680837
|
-
|
|
680838
|
-
"use strict";
|
|
680839
|
-
|
|
680840
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680841
|
-
exports.updateV1State = void 0;
|
|
680842
|
-
const rng_js_1 = __nccwpck_require__(618186);
|
|
680843
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
680844
|
-
const _state = {};
|
|
680845
|
-
function v1(options, buf, offset) {
|
|
680846
|
-
let bytes;
|
|
680847
|
-
const isV6 = options?._v6 ?? false;
|
|
680848
|
-
if (options) {
|
|
680849
|
-
const optionsKeys = Object.keys(options);
|
|
680850
|
-
if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {
|
|
680851
|
-
options = undefined;
|
|
680852
|
-
}
|
|
680853
|
-
}
|
|
680854
|
-
if (options) {
|
|
680855
|
-
bytes = v1Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
|
|
680856
|
-
}
|
|
680857
|
-
else {
|
|
680858
|
-
const now = Date.now();
|
|
680859
|
-
const rnds = (0, rng_js_1.default)();
|
|
680860
|
-
updateV1State(_state, now, rnds);
|
|
680861
|
-
bytes = v1Bytes(rnds, _state.msecs, _state.nsecs, isV6 ? undefined : _state.clockseq, isV6 ? undefined : _state.node, buf, offset);
|
|
680862
|
-
}
|
|
680863
|
-
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
|
|
680864
|
-
}
|
|
680865
|
-
function updateV1State(state, now, rnds) {
|
|
680866
|
-
state.msecs ??= -Infinity;
|
|
680867
|
-
state.nsecs ??= 0;
|
|
680868
|
-
if (now === state.msecs) {
|
|
680869
|
-
state.nsecs++;
|
|
680870
|
-
if (state.nsecs >= 10000) {
|
|
680871
|
-
state.node = undefined;
|
|
680872
|
-
state.nsecs = 0;
|
|
680873
|
-
}
|
|
680874
|
-
}
|
|
680875
|
-
else if (now > state.msecs) {
|
|
680876
|
-
state.nsecs = 0;
|
|
680877
|
-
}
|
|
680878
|
-
else if (now < state.msecs) {
|
|
680879
|
-
state.node = undefined;
|
|
680880
|
-
}
|
|
680881
|
-
if (!state.node) {
|
|
680882
|
-
state.node = rnds.slice(10, 16);
|
|
680883
|
-
state.node[0] |= 0x01;
|
|
680884
|
-
state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
680885
|
-
}
|
|
680886
|
-
state.msecs = now;
|
|
680887
|
-
return state;
|
|
680888
|
-
}
|
|
680889
|
-
exports.updateV1State = updateV1State;
|
|
680890
|
-
function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
|
|
680891
|
-
if (rnds.length < 16) {
|
|
680892
|
-
throw new Error('Random bytes length must be >= 16');
|
|
680893
|
-
}
|
|
680894
|
-
if (!buf) {
|
|
680895
|
-
buf = new Uint8Array(16);
|
|
680896
|
-
offset = 0;
|
|
680897
|
-
}
|
|
680898
|
-
else {
|
|
680899
|
-
if (offset < 0 || offset + 16 > buf.length) {
|
|
680900
|
-
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
680901
|
-
}
|
|
680902
|
-
}
|
|
680903
|
-
msecs ??= Date.now();
|
|
680904
|
-
nsecs ??= 0;
|
|
680905
|
-
clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
680906
|
-
node ??= rnds.slice(10, 16);
|
|
680907
|
-
msecs += 12219292800000;
|
|
680908
|
-
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
680909
|
-
buf[offset++] = (tl >>> 24) & 0xff;
|
|
680910
|
-
buf[offset++] = (tl >>> 16) & 0xff;
|
|
680911
|
-
buf[offset++] = (tl >>> 8) & 0xff;
|
|
680912
|
-
buf[offset++] = tl & 0xff;
|
|
680913
|
-
const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;
|
|
680914
|
-
buf[offset++] = (tmh >>> 8) & 0xff;
|
|
680915
|
-
buf[offset++] = tmh & 0xff;
|
|
680916
|
-
buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
|
|
680917
|
-
buf[offset++] = (tmh >>> 16) & 0xff;
|
|
680918
|
-
buf[offset++] = (clockseq >>> 8) | 0x80;
|
|
680919
|
-
buf[offset++] = clockseq & 0xff;
|
|
680920
|
-
for (let n = 0; n < 6; ++n) {
|
|
680921
|
-
buf[offset++] = node[n];
|
|
680922
|
-
}
|
|
680923
|
-
return buf;
|
|
680924
|
-
}
|
|
680925
|
-
exports["default"] = v1;
|
|
680926
|
-
|
|
680927
|
-
|
|
680928
|
-
/***/ }),
|
|
680929
|
-
|
|
680930
|
-
/***/ 990728:
|
|
680931
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680932
|
-
|
|
680933
|
-
"use strict";
|
|
680934
|
-
|
|
680935
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680936
|
-
const parse_js_1 = __nccwpck_require__(862526);
|
|
680937
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
680938
|
-
function v1ToV6(uuid) {
|
|
680939
|
-
const v1Bytes = typeof uuid === 'string' ? (0, parse_js_1.default)(uuid) : uuid;
|
|
680940
|
-
const v6Bytes = _v1ToV6(v1Bytes);
|
|
680941
|
-
return typeof uuid === 'string' ? (0, stringify_js_1.unsafeStringify)(v6Bytes) : v6Bytes;
|
|
680942
|
-
}
|
|
680943
|
-
exports["default"] = v1ToV6;
|
|
680944
|
-
function _v1ToV6(v1Bytes) {
|
|
680945
|
-
return Uint8Array.of(((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f), ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4), ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4), ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4), ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4), ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4), 0x60 | (v1Bytes[2] & 0x0f), v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
|
|
680946
|
-
}
|
|
680947
|
-
|
|
680948
|
-
|
|
680949
|
-
/***/ }),
|
|
680950
|
-
|
|
680951
|
-
/***/ 206261:
|
|
680952
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680953
|
-
|
|
680954
|
-
"use strict";
|
|
680955
|
-
|
|
680956
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680957
|
-
exports.URL = exports.DNS = void 0;
|
|
680958
|
-
const md5_js_1 = __nccwpck_require__(113905);
|
|
680959
|
-
const v35_js_1 = __nccwpck_require__(213042);
|
|
680960
|
-
var v35_js_2 = __nccwpck_require__(213042);
|
|
680961
|
-
Object.defineProperty(exports, "DNS", ({ enumerable: true, get: function () { return v35_js_2.DNS; } }));
|
|
680962
|
-
Object.defineProperty(exports, "URL", ({ enumerable: true, get: function () { return v35_js_2.URL; } }));
|
|
680963
|
-
function v3(value, namespace, buf, offset) {
|
|
680964
|
-
return (0, v35_js_1.default)(0x30, md5_js_1.default, value, namespace, buf, offset);
|
|
680965
|
-
}
|
|
680966
|
-
v3.DNS = v35_js_1.DNS;
|
|
680967
|
-
v3.URL = v35_js_1.URL;
|
|
680968
|
-
exports["default"] = v3;
|
|
680969
|
-
|
|
680970
|
-
|
|
680971
|
-
/***/ }),
|
|
680972
|
-
|
|
680973
|
-
/***/ 213042:
|
|
680974
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
680975
|
-
|
|
680976
|
-
"use strict";
|
|
680977
|
-
|
|
680978
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680979
|
-
exports.URL = exports.DNS = exports.stringToBytes = void 0;
|
|
680980
|
-
const parse_js_1 = __nccwpck_require__(862526);
|
|
680981
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
680982
|
-
function stringToBytes(str) {
|
|
680983
|
-
str = unescape(encodeURIComponent(str));
|
|
680984
|
-
const bytes = new Uint8Array(str.length);
|
|
680985
|
-
for (let i = 0; i < str.length; ++i) {
|
|
680986
|
-
bytes[i] = str.charCodeAt(i);
|
|
680987
|
-
}
|
|
680988
|
-
return bytes;
|
|
680989
|
-
}
|
|
680990
|
-
exports.stringToBytes = stringToBytes;
|
|
680991
|
-
exports.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
680992
|
-
exports.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
680993
|
-
function v35(version, hash, value, namespace, buf, offset) {
|
|
680994
|
-
const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;
|
|
680995
|
-
const namespaceBytes = typeof namespace === 'string' ? (0, parse_js_1.default)(namespace) : namespace;
|
|
680996
|
-
if (typeof namespace === 'string') {
|
|
680997
|
-
namespace = (0, parse_js_1.default)(namespace);
|
|
680998
|
-
}
|
|
680999
|
-
if (namespace?.length !== 16) {
|
|
681000
|
-
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
681001
|
-
}
|
|
681002
|
-
let bytes = new Uint8Array(16 + valueBytes.length);
|
|
681003
|
-
bytes.set(namespaceBytes);
|
|
681004
|
-
bytes.set(valueBytes, namespaceBytes.length);
|
|
681005
|
-
bytes = hash(bytes);
|
|
681006
|
-
bytes[6] = (bytes[6] & 0x0f) | version;
|
|
681007
|
-
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
681008
|
-
if (buf) {
|
|
681009
|
-
offset = offset || 0;
|
|
681010
|
-
for (let i = 0; i < 16; ++i) {
|
|
681011
|
-
buf[offset + i] = bytes[i];
|
|
681012
|
-
}
|
|
681013
|
-
return buf;
|
|
681014
|
-
}
|
|
681015
|
-
return (0, stringify_js_1.unsafeStringify)(bytes);
|
|
681016
|
-
}
|
|
681017
|
-
exports["default"] = v35;
|
|
681018
|
-
|
|
681019
|
-
|
|
681020
|
-
/***/ }),
|
|
681021
|
-
|
|
681022
|
-
/***/ 759079:
|
|
681023
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681024
|
-
|
|
681025
|
-
"use strict";
|
|
681026
|
-
|
|
681027
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681028
|
-
const native_js_1 = __nccwpck_require__(176622);
|
|
681029
|
-
const rng_js_1 = __nccwpck_require__(618186);
|
|
681030
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
681031
|
-
function v4(options, buf, offset) {
|
|
681032
|
-
if (native_js_1.default.randomUUID && !buf && !options) {
|
|
681033
|
-
return native_js_1.default.randomUUID();
|
|
681034
|
-
}
|
|
681035
|
-
options = options || {};
|
|
681036
|
-
const rnds = options.random ?? options.rng?.() ?? (0, rng_js_1.default)();
|
|
681037
|
-
if (rnds.length < 16) {
|
|
681038
|
-
throw new Error('Random bytes length must be >= 16');
|
|
681039
|
-
}
|
|
681040
|
-
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
681041
|
-
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
681042
|
-
if (buf) {
|
|
681043
|
-
offset = offset || 0;
|
|
681044
|
-
if (offset < 0 || offset + 16 > buf.length) {
|
|
681045
|
-
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
681046
|
-
}
|
|
681047
|
-
for (let i = 0; i < 16; ++i) {
|
|
681048
|
-
buf[offset + i] = rnds[i];
|
|
681049
|
-
}
|
|
681050
|
-
return buf;
|
|
681051
|
-
}
|
|
681052
|
-
return (0, stringify_js_1.unsafeStringify)(rnds);
|
|
681053
|
-
}
|
|
681054
|
-
exports["default"] = v4;
|
|
681055
|
-
|
|
681056
|
-
|
|
681057
|
-
/***/ }),
|
|
681058
|
-
|
|
681059
|
-
/***/ 519985:
|
|
681060
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681061
|
-
|
|
681062
|
-
"use strict";
|
|
681063
|
-
|
|
681064
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681065
|
-
exports.URL = exports.DNS = void 0;
|
|
681066
|
-
const sha1_js_1 = __nccwpck_require__(298850);
|
|
681067
|
-
const v35_js_1 = __nccwpck_require__(213042);
|
|
681068
|
-
var v35_js_2 = __nccwpck_require__(213042);
|
|
681069
|
-
Object.defineProperty(exports, "DNS", ({ enumerable: true, get: function () { return v35_js_2.DNS; } }));
|
|
681070
|
-
Object.defineProperty(exports, "URL", ({ enumerable: true, get: function () { return v35_js_2.URL; } }));
|
|
681071
|
-
function v5(value, namespace, buf, offset) {
|
|
681072
|
-
return (0, v35_js_1.default)(0x50, sha1_js_1.default, value, namespace, buf, offset);
|
|
681073
|
-
}
|
|
681074
|
-
v5.DNS = v35_js_1.DNS;
|
|
681075
|
-
v5.URL = v35_js_1.URL;
|
|
681076
|
-
exports["default"] = v5;
|
|
681077
|
-
|
|
681078
|
-
|
|
681079
|
-
/***/ }),
|
|
681080
|
-
|
|
681081
|
-
/***/ 821952:
|
|
681082
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681083
|
-
|
|
681084
|
-
"use strict";
|
|
681085
|
-
|
|
681086
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681087
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
681088
|
-
const v1_js_1 = __nccwpck_require__(356904);
|
|
681089
|
-
const v1ToV6_js_1 = __nccwpck_require__(990728);
|
|
681090
|
-
function v6(options, buf, offset) {
|
|
681091
|
-
options ??= {};
|
|
681092
|
-
offset ??= 0;
|
|
681093
|
-
let bytes = (0, v1_js_1.default)({ ...options, _v6: true }, new Uint8Array(16));
|
|
681094
|
-
bytes = (0, v1ToV6_js_1.default)(bytes);
|
|
681095
|
-
if (buf) {
|
|
681096
|
-
for (let i = 0; i < 16; i++) {
|
|
681097
|
-
buf[offset + i] = bytes[i];
|
|
681098
|
-
}
|
|
681099
|
-
return buf;
|
|
681100
|
-
}
|
|
681101
|
-
return (0, stringify_js_1.unsafeStringify)(bytes);
|
|
681102
|
-
}
|
|
681103
|
-
exports["default"] = v6;
|
|
681104
|
-
|
|
681105
|
-
|
|
681106
|
-
/***/ }),
|
|
681107
|
-
|
|
681108
|
-
/***/ 597112:
|
|
681109
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681110
|
-
|
|
681111
|
-
"use strict";
|
|
681112
|
-
|
|
681113
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681114
|
-
const parse_js_1 = __nccwpck_require__(862526);
|
|
681115
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
681116
|
-
function v6ToV1(uuid) {
|
|
681117
|
-
const v6Bytes = typeof uuid === 'string' ? (0, parse_js_1.default)(uuid) : uuid;
|
|
681118
|
-
const v1Bytes = _v6ToV1(v6Bytes);
|
|
681119
|
-
return typeof uuid === 'string' ? (0, stringify_js_1.unsafeStringify)(v1Bytes) : v1Bytes;
|
|
681120
|
-
}
|
|
681121
|
-
exports["default"] = v6ToV1;
|
|
681122
|
-
function _v6ToV1(v6Bytes) {
|
|
681123
|
-
return Uint8Array.of(((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f), ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4), ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f), v6Bytes[7], ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4), ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4), 0x10 | ((v6Bytes[0] & 0xf0) >> 4), ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4), v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
|
|
681124
|
-
}
|
|
681125
|
-
|
|
681126
|
-
|
|
681127
|
-
/***/ }),
|
|
681128
|
-
|
|
681129
|
-
/***/ 103598:
|
|
681130
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681131
|
-
|
|
681132
|
-
"use strict";
|
|
681133
|
-
|
|
681134
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681135
|
-
exports.updateV7State = void 0;
|
|
681136
|
-
const rng_js_1 = __nccwpck_require__(618186);
|
|
681137
|
-
const stringify_js_1 = __nccwpck_require__(422428);
|
|
681138
|
-
const _state = {};
|
|
681139
|
-
function v7(options, buf, offset) {
|
|
681140
|
-
let bytes;
|
|
681141
|
-
if (options) {
|
|
681142
|
-
bytes = v7Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.seq, buf, offset);
|
|
681143
|
-
}
|
|
681144
|
-
else {
|
|
681145
|
-
const now = Date.now();
|
|
681146
|
-
const rnds = (0, rng_js_1.default)();
|
|
681147
|
-
updateV7State(_state, now, rnds);
|
|
681148
|
-
bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
|
|
681149
|
-
}
|
|
681150
|
-
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
|
|
681151
|
-
}
|
|
681152
|
-
function updateV7State(state, now, rnds) {
|
|
681153
|
-
state.msecs ??= -Infinity;
|
|
681154
|
-
state.seq ??= 0;
|
|
681155
|
-
if (now > state.msecs) {
|
|
681156
|
-
state.seq = (rnds[6] << 23) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
681157
|
-
state.msecs = now;
|
|
681158
|
-
}
|
|
681159
|
-
else {
|
|
681160
|
-
state.seq = (state.seq + 1) | 0;
|
|
681161
|
-
if (state.seq === 0) {
|
|
681162
|
-
state.msecs++;
|
|
681163
|
-
}
|
|
681164
|
-
}
|
|
681165
|
-
return state;
|
|
681166
|
-
}
|
|
681167
|
-
exports.updateV7State = updateV7State;
|
|
681168
|
-
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
681169
|
-
if (rnds.length < 16) {
|
|
681170
|
-
throw new Error('Random bytes length must be >= 16');
|
|
681171
|
-
}
|
|
681172
|
-
if (!buf) {
|
|
681173
|
-
buf = new Uint8Array(16);
|
|
681174
|
-
offset = 0;
|
|
681175
|
-
}
|
|
681176
|
-
else {
|
|
681177
|
-
if (offset < 0 || offset + 16 > buf.length) {
|
|
681178
|
-
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
681179
|
-
}
|
|
681180
|
-
}
|
|
681181
|
-
msecs ??= Date.now();
|
|
681182
|
-
seq ??= ((rnds[6] * 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
681183
|
-
buf[offset++] = (msecs / 0x10000000000) & 0xff;
|
|
681184
|
-
buf[offset++] = (msecs / 0x100000000) & 0xff;
|
|
681185
|
-
buf[offset++] = (msecs / 0x1000000) & 0xff;
|
|
681186
|
-
buf[offset++] = (msecs / 0x10000) & 0xff;
|
|
681187
|
-
buf[offset++] = (msecs / 0x100) & 0xff;
|
|
681188
|
-
buf[offset++] = msecs & 0xff;
|
|
681189
|
-
buf[offset++] = 0x70 | ((seq >>> 28) & 0x0f);
|
|
681190
|
-
buf[offset++] = (seq >>> 20) & 0xff;
|
|
681191
|
-
buf[offset++] = 0x80 | ((seq >>> 14) & 0x3f);
|
|
681192
|
-
buf[offset++] = (seq >>> 6) & 0xff;
|
|
681193
|
-
buf[offset++] = ((seq << 2) & 0xff) | (rnds[10] & 0x03);
|
|
681194
|
-
buf[offset++] = rnds[11];
|
|
681195
|
-
buf[offset++] = rnds[12];
|
|
681196
|
-
buf[offset++] = rnds[13];
|
|
681197
|
-
buf[offset++] = rnds[14];
|
|
681198
|
-
buf[offset++] = rnds[15];
|
|
681199
|
-
return buf;
|
|
681200
|
-
}
|
|
681201
|
-
exports["default"] = v7;
|
|
681202
|
-
|
|
681203
|
-
|
|
681204
|
-
/***/ }),
|
|
681205
|
-
|
|
681206
|
-
/***/ 983053:
|
|
681207
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681208
|
-
|
|
681209
|
-
"use strict";
|
|
681210
|
-
|
|
681211
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681212
|
-
const regex_js_1 = __nccwpck_require__(229556);
|
|
681213
|
-
function validate(uuid) {
|
|
681214
|
-
return typeof uuid === 'string' && regex_js_1.default.test(uuid);
|
|
681215
|
-
}
|
|
681216
|
-
exports["default"] = validate;
|
|
681217
|
-
|
|
681218
|
-
|
|
681219
|
-
/***/ }),
|
|
681220
|
-
|
|
681221
|
-
/***/ 894384:
|
|
681222
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
681223
|
-
|
|
681224
|
-
"use strict";
|
|
681225
|
-
|
|
681226
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
681227
|
-
const validate_js_1 = __nccwpck_require__(983053);
|
|
681228
|
-
function version(uuid) {
|
|
681229
|
-
if (!(0, validate_js_1.default)(uuid)) {
|
|
681230
|
-
throw TypeError('Invalid UUID');
|
|
681231
|
-
}
|
|
681232
|
-
return parseInt(uuid.slice(14, 15), 16);
|
|
681233
|
-
}
|
|
681234
|
-
exports["default"] = version;
|
|
681235
|
-
|
|
681236
|
-
|
|
681237
680620
|
/***/ }),
|
|
681238
680621
|
|
|
681239
680622
|
/***/ 611965:
|
|
@@ -831161,6 +830544,7 @@ const { Command } = __nccwpck_require__(214379),
|
|
|
831161
830544
|
os = __nccwpck_require__(822037),
|
|
831162
830545
|
path = __nccwpck_require__(371017),
|
|
831163
830546
|
_ = __nccwpck_require__(690250),
|
|
830547
|
+
crypto = __nccwpck_require__(706113),
|
|
831164
830548
|
cliProgress = __nccwpck_require__(117348),
|
|
831165
830549
|
{ run } = __nccwpck_require__(248657),
|
|
831166
830550
|
fetch = (...args) => __nccwpck_require__.e(/* import() */ 841).then(__nccwpck_require__.bind(__nccwpck_require__, 722841)).then(({ default: fetch }) => fetch(...args)),
|
|
@@ -831197,6 +830581,171 @@ const { Command } = __nccwpck_require__(214379),
|
|
|
831197
830581
|
webHook: ''
|
|
831198
830582
|
}
|
|
831199
830583
|
|
|
830584
|
+
/// pip start
|
|
830585
|
+
/**
|
|
830586
|
+
* Generates a unique file name compatible with Linux/Unix systems.
|
|
830587
|
+
* @param {string} baseDir - The directory path where the file should be created.
|
|
830588
|
+
* @param {string} prefix - The file name prefix. Defaults to "socket_".
|
|
830589
|
+
* @param {string} extension - The file extension. Defaults to ".sock".
|
|
830590
|
+
* @returns {string} - The full path of the unique file.
|
|
830591
|
+
*/
|
|
830592
|
+
const generateLinuxUniqueFileName = (baseDir, prefix = "socket_", extension = ".sock") => {
|
|
830593
|
+
const randomId = crypto.randomUUID();
|
|
830594
|
+
const fileName = `${prefix}${randomId}${extension}`;
|
|
830595
|
+
return path.join(baseDir, fileName);
|
|
830596
|
+
}
|
|
830597
|
+
|
|
830598
|
+
/**
|
|
830599
|
+
* Generates a unique IPC communication path depending on the OS.
|
|
830600
|
+
* @returns {string} - A unique communication path (pipe for Windows, file path for others).
|
|
830601
|
+
*/
|
|
830602
|
+
const generateUniqueFileName = () => {
|
|
830603
|
+
if (os.platform() === 'win32') {
|
|
830604
|
+
// Use named pipes on Windows
|
|
830605
|
+
const randomId = crypto.randomUUID();
|
|
830606
|
+
return `\\\\.\\pipe\\myapp-${randomId}`;
|
|
830607
|
+
} else {
|
|
830608
|
+
// Use file-based sockets on non-Windows systems
|
|
830609
|
+
return generateLinuxUniqueFileName(os.tmpdir());
|
|
830610
|
+
}
|
|
830611
|
+
}
|
|
830612
|
+
|
|
830613
|
+
const pipeServerStart = () => {
|
|
830614
|
+
const net = __nccwpck_require__(241808);
|
|
830615
|
+
const fs = __nccwpck_require__(657147);
|
|
830616
|
+
const os = __nccwpck_require__(822037);
|
|
830617
|
+
const path = __nccwpck_require__(371017);
|
|
830618
|
+
const mainProcessSocketPath = generateUniqueFileName();
|
|
830619
|
+
|
|
830620
|
+
// Store the socket path in the environment variable for external access
|
|
830621
|
+
const base64ELECTRON_PIPE = Buffer.from(mainProcessSocketPath, "utf-8").toString("base64");
|
|
830622
|
+
_.set(global, 'ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
830623
|
+
_.set(global, 'env.ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
830624
|
+
_.set(process, 'env.ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
830625
|
+
|
|
830626
|
+
try {
|
|
830627
|
+
// Check if the socket file already exists and remove it, if necessary
|
|
830628
|
+
if (os.platform() !== "win32") {
|
|
830629
|
+
if (fs.existsSync(mainProcessSocketPath)) {
|
|
830630
|
+
fs.unlinkSync(mainProcessSocketPath);
|
|
830631
|
+
}
|
|
830632
|
+
}
|
|
830633
|
+
} catch (err) {
|
|
830634
|
+
console.warn(`Failed to check or delete existing socket file: ${err.message}`);
|
|
830635
|
+
}
|
|
830636
|
+
|
|
830637
|
+
const { DatabaseQuery } = __nccwpck_require__(546985);
|
|
830638
|
+
|
|
830639
|
+
// 如果套接字文件已存在,删除它
|
|
830640
|
+
if (fs.existsSync(mainProcessSocketPath)) {
|
|
830641
|
+
fs.unlinkSync(mainProcessSocketPath);
|
|
830642
|
+
}
|
|
830643
|
+
|
|
830644
|
+
const server = net.createServer((socket) => {
|
|
830645
|
+
socket.on('data', async (stream) => {
|
|
830646
|
+
const { action, data } = JSON.parse(String(Buffer.from(stream)));
|
|
830647
|
+
try {
|
|
830648
|
+
switch (action) {
|
|
830649
|
+
case 'queryDatabase':
|
|
830650
|
+
const { dbconfig, query } = data;
|
|
830651
|
+
const result = await DatabaseQuery(dbconfig, query);
|
|
830652
|
+
socket.write(JSON.stringify(result) + "\n\n");
|
|
830653
|
+
break;
|
|
830654
|
+
case 'execute':
|
|
830655
|
+
const { execSync } = __nccwpck_require__(532081);
|
|
830656
|
+
const ext = file.split('.').pop().toLowerCase();
|
|
830657
|
+
|
|
830658
|
+
let { file, args, option } = data;
|
|
830659
|
+
if (!_.isArray(args)) {
|
|
830660
|
+
args = [];
|
|
830661
|
+
}
|
|
830662
|
+
let command;
|
|
830663
|
+
try {
|
|
830664
|
+
switch (ext) {
|
|
830665
|
+
case 'jar':
|
|
830666
|
+
const jarPath = __nccwpck_require__.ab + "jar-main-1.0-SNAPSHOT.jar";
|
|
830667
|
+
const { className, method } = option || {};
|
|
830668
|
+
if (_.isObject(option)) {
|
|
830669
|
+
if (_.isString(className) && _.isString(method)) {
|
|
830670
|
+
let para = new Buffer(JSON.stringify({ methodName: method, args: args })).toString("base64");
|
|
830671
|
+
command = `java -jar ${jarPath} ${file} ${className} '${para}'`;
|
|
830672
|
+
}
|
|
830673
|
+
} else {
|
|
830674
|
+
command = `java -jar ${file} ${_.join(_.map(args, JSON.stringify), " ")}`;
|
|
830675
|
+
}
|
|
830676
|
+
|
|
830677
|
+
break;
|
|
830678
|
+
case 'php':
|
|
830679
|
+
command = `php -f ${file} ${args.join(' ')}`;
|
|
830680
|
+
break;
|
|
830681
|
+
case 'js':
|
|
830682
|
+
command = `node ${file} ${args.join(' ')}`;
|
|
830683
|
+
break;
|
|
830684
|
+
case 'py':
|
|
830685
|
+
command = `python ${file} ${args.join(' ')}`;
|
|
830686
|
+
break;
|
|
830687
|
+
case 'py3':
|
|
830688
|
+
command = `python3 ${file} ${args.join(' ')}`;
|
|
830689
|
+
break;
|
|
830690
|
+
case 'bsh':
|
|
830691
|
+
command = `bsh ${file} ${args.join(' ')}`;
|
|
830692
|
+
break;
|
|
830693
|
+
case 'go':
|
|
830694
|
+
command = `go run ${file} ${args.join(' ')}`;
|
|
830695
|
+
break;
|
|
830696
|
+
case 'sh':
|
|
830697
|
+
command = `sh ${file} ${args.join(' ')}`;
|
|
830698
|
+
break;
|
|
830699
|
+
case 'rb':
|
|
830700
|
+
case 'ruby':
|
|
830701
|
+
command = `ruby ${file} ${args.join(' ')}`;
|
|
830702
|
+
break;
|
|
830703
|
+
case 'lua':
|
|
830704
|
+
command = `lua ${file} ${args.join(' ')}`;
|
|
830705
|
+
break;
|
|
830706
|
+
case 'rs':
|
|
830707
|
+
command = `rustc ${file} && ./${file.replace(/\.rs$/, '')} ${args.join(' ')}`;
|
|
830708
|
+
break;
|
|
830709
|
+
case 'bat':
|
|
830710
|
+
command = `${file} ${args.join(' ')}`;
|
|
830711
|
+
break;
|
|
830712
|
+
case 'ps1':
|
|
830713
|
+
command = `powershell -File ${file} ${args.join(' ')}`;
|
|
830714
|
+
break;
|
|
830715
|
+
default:
|
|
830716
|
+
throw new Error(`Unsupported file suffixes <${ext}>`);
|
|
830717
|
+
}
|
|
830718
|
+
|
|
830719
|
+
const isWindows = process.platform === 'win32';
|
|
830720
|
+
const options = _.assign(isWindows ? { encoding: 'cp936' } : { encoding: 'utf8' }, option);
|
|
830721
|
+
|
|
830722
|
+
console.log(command, options, 1111111)
|
|
830723
|
+
const output = execSync(command, options);
|
|
830724
|
+
socket.write(JSON.stringify({
|
|
830725
|
+
err: 'success',
|
|
830726
|
+
result: String(output)
|
|
830727
|
+
}) + "\n\n");
|
|
830728
|
+
} catch (e) {
|
|
830729
|
+
socket.write(JSON.stringify({
|
|
830730
|
+
err: 'error',
|
|
830731
|
+
result: String(e)
|
|
830732
|
+
}) + "\n\n");
|
|
830733
|
+
}
|
|
830734
|
+
break;
|
|
830735
|
+
}
|
|
830736
|
+
|
|
830737
|
+
} catch (e) {
|
|
830738
|
+
socket.write(JSON.stringify(e));
|
|
830739
|
+
}
|
|
830740
|
+
|
|
830741
|
+
});
|
|
830742
|
+
});
|
|
830743
|
+
|
|
830744
|
+
server.listen(mainProcessSocketPath, () => {
|
|
830745
|
+
// console.log(`服务器已启动,监听路径 ${mainProcessSocketPath}`);
|
|
830746
|
+
});
|
|
830747
|
+
};
|
|
830748
|
+
|
|
831200
830749
|
const parseCommandString = async (url, options) => {
|
|
831201
830750
|
let runnerEvent = {};
|
|
831202
830751
|
let errStr = '';
|
|
@@ -831281,155 +830830,16 @@ const parseCommandString = async (url, options) => {
|
|
|
831281
830830
|
|
|
831282
830831
|
const { option, test_events } = runnerEvent;
|
|
831283
830832
|
|
|
831284
|
-
|
|
831285
|
-
|
|
831286
|
-
|
|
831287
|
-
|
|
831288
|
-
|
|
831289
|
-
const fileName = `${prefix}${randomId}${extension}`;
|
|
831290
|
-
return path.join(baseDir, fileName);
|
|
831291
|
-
}
|
|
831292
|
-
|
|
831293
|
-
const net = __nccwpck_require__(241808);
|
|
831294
|
-
const fs = __nccwpck_require__(657147);
|
|
831295
|
-
const os = __nccwpck_require__(822037);
|
|
831296
|
-
const path = __nccwpck_require__(371017);
|
|
831297
|
-
const mainProcessSocketPath = generateLinuxUniqueFileName(os.tmpdir());
|
|
831298
|
-
|
|
831299
|
-
// Store the socket path in the environment variable for external access
|
|
831300
|
-
const base64ELECTRON_PIPE = Buffer.from(mainProcessSocketPath, "utf-8").toString("base64");
|
|
831301
|
-
_.set(global, 'ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
831302
|
-
_.set(global, 'env.ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
831303
|
-
_.set(process, 'env.ELECTRON_PIPE', base64ELECTRON_PIPE);
|
|
831304
|
-
|
|
831305
|
-
try {
|
|
831306
|
-
// Check if the socket file already exists and remove it, if necessary
|
|
831307
|
-
if (os.platform() !== "win32") {
|
|
831308
|
-
if (fs.existsSync(mainProcessSocketPath)) {
|
|
831309
|
-
fs.unlinkSync(mainProcessSocketPath);
|
|
831310
|
-
}
|
|
831311
|
-
}
|
|
831312
|
-
} catch (err) {
|
|
831313
|
-
console.warn(`Failed to check or delete existing socket file: ${err.message}`);
|
|
831314
|
-
}
|
|
831315
|
-
|
|
831316
|
-
const { DatabaseQuery } = __nccwpck_require__(546985);
|
|
831317
|
-
|
|
831318
|
-
// 如果套接字文件已存在,删除它
|
|
831319
|
-
if (fs.existsSync(mainProcessSocketPath)) {
|
|
831320
|
-
fs.unlinkSync(mainProcessSocketPath);
|
|
831321
|
-
}
|
|
831322
|
-
|
|
831323
|
-
const server = net.createServer((socket) => {
|
|
831324
|
-
socket.on('data', async (stream) => {
|
|
831325
|
-
const { action, data } = JSON.parse(String(Buffer.from(stream)));
|
|
831326
|
-
try {
|
|
831327
|
-
switch (action) {
|
|
831328
|
-
case 'queryDatabase':
|
|
831329
|
-
const { dbconfig, query } = data;
|
|
831330
|
-
const result = await DatabaseQuery(dbconfig, query);
|
|
831331
|
-
socket.write(JSON.stringify(result) + "\n\n");
|
|
831332
|
-
break;
|
|
831333
|
-
case 'execute':
|
|
831334
|
-
const { execSync } = __nccwpck_require__(532081);
|
|
831335
|
-
const ext = file.split('.').pop().toLowerCase();
|
|
831336
|
-
|
|
831337
|
-
let { file, args, option } = data;
|
|
831338
|
-
if (!_.isArray(args)) {
|
|
831339
|
-
args = [];
|
|
831340
|
-
}
|
|
831341
|
-
let command;
|
|
831342
|
-
try {
|
|
831343
|
-
switch (ext) {
|
|
831344
|
-
case 'jar':
|
|
831345
|
-
const jarPath = __nccwpck_require__.ab + "jar-main-1.0-SNAPSHOT.jar";
|
|
831346
|
-
const { className, method } = option || {};
|
|
831347
|
-
if (_.isObject(option)) {
|
|
831348
|
-
if (_.isString(className) && _.isString(method)) {
|
|
831349
|
-
let para = new Buffer(JSON.stringify({ methodName: method, args: args })).toString("base64");
|
|
831350
|
-
command = `java -jar ${jarPath} ${file} ${className} '${para}'`;
|
|
831351
|
-
}
|
|
831352
|
-
} else {
|
|
831353
|
-
command = `java -jar ${file} ${_.join(_.map(args, JSON.stringify), " ")}`;
|
|
831354
|
-
}
|
|
831355
|
-
|
|
831356
|
-
break;
|
|
831357
|
-
case 'php':
|
|
831358
|
-
command = `php -f ${file} ${args.join(' ')}`;
|
|
831359
|
-
break;
|
|
831360
|
-
case 'js':
|
|
831361
|
-
command = `node ${file} ${args.join(' ')}`;
|
|
831362
|
-
break;
|
|
831363
|
-
case 'py':
|
|
831364
|
-
command = `python ${file} ${args.join(' ')}`;
|
|
831365
|
-
break;
|
|
831366
|
-
case 'py3':
|
|
831367
|
-
command = `python3 ${file} ${args.join(' ')}`;
|
|
831368
|
-
break;
|
|
831369
|
-
case 'bsh':
|
|
831370
|
-
command = `bsh ${file} ${args.join(' ')}`;
|
|
831371
|
-
break;
|
|
831372
|
-
case 'go':
|
|
831373
|
-
command = `go run ${file} ${args.join(' ')}`;
|
|
831374
|
-
break;
|
|
831375
|
-
case 'sh':
|
|
831376
|
-
command = `sh ${file} ${args.join(' ')}`;
|
|
831377
|
-
break;
|
|
831378
|
-
case 'rb':
|
|
831379
|
-
case 'ruby':
|
|
831380
|
-
command = `ruby ${file} ${args.join(' ')}`;
|
|
831381
|
-
break;
|
|
831382
|
-
case 'lua':
|
|
831383
|
-
command = `lua ${file} ${args.join(' ')}`;
|
|
831384
|
-
break;
|
|
831385
|
-
case 'rs':
|
|
831386
|
-
command = `rustc ${file} && ./${file.replace(/\.rs$/, '')} ${args.join(' ')}`;
|
|
831387
|
-
break;
|
|
831388
|
-
case 'bat':
|
|
831389
|
-
command = `${file} ${args.join(' ')}`;
|
|
831390
|
-
break;
|
|
831391
|
-
case 'ps1':
|
|
831392
|
-
command = `powershell -File ${file} ${args.join(' ')}`;
|
|
831393
|
-
break;
|
|
831394
|
-
default:
|
|
831395
|
-
throw new Error(`Unsupported file suffixes <${ext}>`);
|
|
831396
|
-
}
|
|
831397
|
-
|
|
831398
|
-
const isWindows = process.platform === 'win32';
|
|
831399
|
-
const options = _.assign(isWindows ? { encoding: 'cp936' } : { encoding: 'utf8' }, option);
|
|
831400
|
-
|
|
831401
|
-
console.log(command, options, 1111111)
|
|
831402
|
-
const output = execSync(command, options);
|
|
831403
|
-
socket.write(JSON.stringify({
|
|
831404
|
-
err: 'success',
|
|
831405
|
-
result: String(output)
|
|
831406
|
-
}) + "\n\n");
|
|
831407
|
-
} catch (e) {
|
|
831408
|
-
socket.write(JSON.stringify({
|
|
831409
|
-
err: 'error',
|
|
831410
|
-
result: String(e)
|
|
831411
|
-
}) + "\n\n");
|
|
831412
|
-
}
|
|
831413
|
-
break;
|
|
831414
|
-
}
|
|
831415
|
-
|
|
831416
|
-
} catch (e) {
|
|
831417
|
-
socket.write(JSON.stringify(e));
|
|
831418
|
-
}
|
|
831419
|
-
|
|
831420
|
-
});
|
|
831421
|
-
});
|
|
831422
|
-
|
|
831423
|
-
server.listen(mainProcessSocketPath, () => {
|
|
831424
|
-
// console.log(`服务器已启动,监听路径 ${mainProcessSocketPath}`);
|
|
831425
|
-
});
|
|
831426
|
-
})();
|
|
831427
|
-
|
|
830833
|
+
// pipeServer start
|
|
830834
|
+
try {
|
|
830835
|
+
pipeServerStart();
|
|
830836
|
+
} catch (e) { }
|
|
830837
|
+
|
|
831428
830838
|
// 设置用户指定选项
|
|
831429
830839
|
await setUserOption(options, option, cliOption);
|
|
831430
830840
|
await run(test_events, option, emitRuntimeEvent);
|
|
831431
|
-
// const myRuntime = new RunnerRuntime(option, test_events);
|
|
831432
|
-
// await myRuntime.run(emitRuntimeEvent);
|
|
830841
|
+
// const myRuntime = new RunnerRuntime(option, test_events);
|
|
830842
|
+
// await myRuntime.run(emitRuntimeEvent);
|
|
831433
830843
|
} else {
|
|
831434
830844
|
console.error(`The file returned by the following URL is not in standard format."(${url})`, runnerEvent);
|
|
831435
830845
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apipost-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Apipost 命令行运行工具。适合Apipost8及以上版本。",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"license": "UNLICENSED",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@vercel/ncc": "^0.38.1",
|
|
24
|
+
"apipost-inside-tools": "^0.1.98",
|
|
24
25
|
"art-template": "^4.13.4",
|
|
25
26
|
"cli-progress": "^3.12.0",
|
|
26
27
|
"cli-table3": "^0.6.5",
|
|
@@ -32,11 +33,12 @@
|
|
|
32
33
|
"lodash": "^4.17.21",
|
|
33
34
|
"node-fetch": "^3.3.2",
|
|
34
35
|
"runner-runtime": "^1.0.82",
|
|
35
|
-
"
|
|
36
|
+
"crypto": "^1.0.1",
|
|
36
37
|
"uuid": "^11.1.0"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"apipost-inside-tools": "^0.1.98",
|
|
41
|
+
"crypto": "^1.0.1",
|
|
40
42
|
"database-query": "^1.1.12",
|
|
41
43
|
"uuid": "^11.1.0"
|
|
42
44
|
}
|