@uipath/admin-tool 1.202.1 → 1.203.0-preview.180
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/THIRD-PARTY-NOTICES.md +31 -31
- package/dist/tool.js +1046 -2613
- package/package.json +3 -2
package/dist/tool.js
CHANGED
|
@@ -12866,2492 +12866,6 @@ var require_commander2 = __commonJS(function(exports) {
|
|
|
12866
12866
|
exports.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
12867
12867
|
});
|
|
12868
12868
|
|
|
12869
|
-
// ../../../node_modules/adm-zip/util/constants.js
|
|
12870
|
-
var require_constants = __commonJS(function(exports, module) {
|
|
12871
|
-
module.exports = {
|
|
12872
|
-
LOCHDR: 30,
|
|
12873
|
-
LOCSIG: 67324752,
|
|
12874
|
-
LOCVER: 4,
|
|
12875
|
-
LOCFLG: 6,
|
|
12876
|
-
LOCHOW: 8,
|
|
12877
|
-
LOCTIM: 10,
|
|
12878
|
-
LOCCRC: 14,
|
|
12879
|
-
LOCSIZ: 18,
|
|
12880
|
-
LOCLEN: 22,
|
|
12881
|
-
LOCNAM: 26,
|
|
12882
|
-
LOCEXT: 28,
|
|
12883
|
-
EXTSIG: 134695760,
|
|
12884
|
-
EXTHDR: 16,
|
|
12885
|
-
EXTCRC: 4,
|
|
12886
|
-
EXTSIZ: 8,
|
|
12887
|
-
EXTLEN: 12,
|
|
12888
|
-
CENHDR: 46,
|
|
12889
|
-
CENSIG: 33639248,
|
|
12890
|
-
CENVEM: 4,
|
|
12891
|
-
CENVER: 6,
|
|
12892
|
-
CENFLG: 8,
|
|
12893
|
-
CENHOW: 10,
|
|
12894
|
-
CENTIM: 12,
|
|
12895
|
-
CENCRC: 16,
|
|
12896
|
-
CENSIZ: 20,
|
|
12897
|
-
CENLEN: 24,
|
|
12898
|
-
CENNAM: 28,
|
|
12899
|
-
CENEXT: 30,
|
|
12900
|
-
CENCOM: 32,
|
|
12901
|
-
CENDSK: 34,
|
|
12902
|
-
CENATT: 36,
|
|
12903
|
-
CENATX: 38,
|
|
12904
|
-
CENOFF: 42,
|
|
12905
|
-
ENDHDR: 22,
|
|
12906
|
-
ENDSIG: 101010256,
|
|
12907
|
-
ENDSUB: 8,
|
|
12908
|
-
ENDTOT: 10,
|
|
12909
|
-
ENDSIZ: 12,
|
|
12910
|
-
ENDOFF: 16,
|
|
12911
|
-
ENDCOM: 20,
|
|
12912
|
-
END64HDR: 20,
|
|
12913
|
-
END64SIG: 117853008,
|
|
12914
|
-
END64START: 4,
|
|
12915
|
-
END64OFF: 8,
|
|
12916
|
-
END64NUMDISKS: 16,
|
|
12917
|
-
ZIP64SIG: 101075792,
|
|
12918
|
-
ZIP64HDR: 56,
|
|
12919
|
-
ZIP64LEAD: 12,
|
|
12920
|
-
ZIP64SIZE: 4,
|
|
12921
|
-
ZIP64VEM: 12,
|
|
12922
|
-
ZIP64VER: 14,
|
|
12923
|
-
ZIP64DSK: 16,
|
|
12924
|
-
ZIP64DSKDIR: 20,
|
|
12925
|
-
ZIP64SUB: 24,
|
|
12926
|
-
ZIP64TOT: 32,
|
|
12927
|
-
ZIP64SIZB: 40,
|
|
12928
|
-
ZIP64OFF: 48,
|
|
12929
|
-
ZIP64EXTRA: 56,
|
|
12930
|
-
STORED: 0,
|
|
12931
|
-
SHRUNK: 1,
|
|
12932
|
-
REDUCED1: 2,
|
|
12933
|
-
REDUCED2: 3,
|
|
12934
|
-
REDUCED3: 4,
|
|
12935
|
-
REDUCED4: 5,
|
|
12936
|
-
IMPLODED: 6,
|
|
12937
|
-
DEFLATED: 8,
|
|
12938
|
-
ENHANCED_DEFLATED: 9,
|
|
12939
|
-
PKWARE: 10,
|
|
12940
|
-
BZIP2: 12,
|
|
12941
|
-
LZMA: 14,
|
|
12942
|
-
IBM_TERSE: 18,
|
|
12943
|
-
IBM_LZ77: 19,
|
|
12944
|
-
AES_ENCRYPT: 99,
|
|
12945
|
-
FLG_ENC: 1,
|
|
12946
|
-
FLG_COMP1: 2,
|
|
12947
|
-
FLG_COMP2: 4,
|
|
12948
|
-
FLG_DESC: 8,
|
|
12949
|
-
FLG_ENH: 16,
|
|
12950
|
-
FLG_PATCH: 32,
|
|
12951
|
-
FLG_STR: 64,
|
|
12952
|
-
FLG_EFS: 2048,
|
|
12953
|
-
FLG_MSK: 4096,
|
|
12954
|
-
FILE: 2,
|
|
12955
|
-
BUFFER: 1,
|
|
12956
|
-
NONE: 0,
|
|
12957
|
-
EF_ID: 0,
|
|
12958
|
-
EF_SIZE: 2,
|
|
12959
|
-
ID_ZIP64: 1,
|
|
12960
|
-
ID_AVINFO: 7,
|
|
12961
|
-
ID_PFS: 8,
|
|
12962
|
-
ID_OS2: 9,
|
|
12963
|
-
ID_NTFS: 10,
|
|
12964
|
-
ID_OPENVMS: 12,
|
|
12965
|
-
ID_UNIX: 13,
|
|
12966
|
-
ID_FORK: 14,
|
|
12967
|
-
ID_PATCH: 15,
|
|
12968
|
-
ID_X509_PKCS7: 20,
|
|
12969
|
-
ID_X509_CERTID_F: 21,
|
|
12970
|
-
ID_X509_CERTID_C: 22,
|
|
12971
|
-
ID_STRONGENC: 23,
|
|
12972
|
-
ID_RECORD_MGT: 24,
|
|
12973
|
-
ID_X509_PKCS7_RL: 25,
|
|
12974
|
-
ID_IBM1: 101,
|
|
12975
|
-
ID_IBM2: 102,
|
|
12976
|
-
ID_POSZIP: 18064,
|
|
12977
|
-
EF_ZIP64_OR_32: 4294967295,
|
|
12978
|
-
EF_ZIP64_OR_16: 65535,
|
|
12979
|
-
EF_ZIP64_SUNCOMP: 0,
|
|
12980
|
-
EF_ZIP64_SCOMP: 8,
|
|
12981
|
-
EF_ZIP64_RHO: 16,
|
|
12982
|
-
EF_ZIP64_DSN: 24
|
|
12983
|
-
};
|
|
12984
|
-
});
|
|
12985
|
-
|
|
12986
|
-
// ../../../node_modules/adm-zip/util/errors.js
|
|
12987
|
-
var require_errors = __commonJS(function(exports) {
|
|
12988
|
-
var errors = {
|
|
12989
|
-
INVALID_LOC: "Invalid LOC header (bad signature)",
|
|
12990
|
-
INVALID_CEN: "Invalid CEN header (bad signature)",
|
|
12991
|
-
INVALID_END: "Invalid END header (bad signature)",
|
|
12992
|
-
DESCRIPTOR_NOT_EXIST: "No descriptor present",
|
|
12993
|
-
DESCRIPTOR_UNKNOWN: "Unknown descriptor format",
|
|
12994
|
-
DESCRIPTOR_FAULTY: "Descriptor data is malformed",
|
|
12995
|
-
NO_DATA: "Nothing to decompress",
|
|
12996
|
-
BAD_CRC: "CRC32 checksum failed {0}",
|
|
12997
|
-
MAX_OUTPUT_EXCEEDED: "Decompressed data exceeds the declared uncompressed size",
|
|
12998
|
-
FILE_IN_THE_WAY: "There is a file in the way: {0}",
|
|
12999
|
-
UNKNOWN_METHOD: "Invalid/unsupported compression method",
|
|
13000
|
-
AVAIL_DATA: "inflate::Available inflate data did not terminate",
|
|
13001
|
-
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
|
|
13002
|
-
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
|
|
13003
|
-
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
|
|
13004
|
-
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
|
|
13005
|
-
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
|
|
13006
|
-
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
|
|
13007
|
-
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
|
|
13008
|
-
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
|
|
13009
|
-
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
|
|
13010
|
-
CANT_EXTRACT_FILE: "Could not extract the file",
|
|
13011
|
-
CANT_OVERRIDE: "Target file already exists",
|
|
13012
|
-
DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
|
|
13013
|
-
NO_ZIP: "No zip file was loaded",
|
|
13014
|
-
NO_ENTRY: "Entry doesn't exist",
|
|
13015
|
-
DUPLICATE_ENTRY: "Duplicate entry name {0}",
|
|
13016
|
-
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
|
|
13017
|
-
FILE_NOT_FOUND: 'File not found: "{0}"',
|
|
13018
|
-
NOT_IMPLEMENTED: "Not implemented",
|
|
13019
|
-
INVALID_FILENAME: "Invalid filename",
|
|
13020
|
-
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
|
|
13021
|
-
ZIP64_VALUE_TOO_LARGE: "Zip64 value exceeds the maximum safe integer",
|
|
13022
|
-
INVALID_PASS_PARAM: "Incompatible password parameter",
|
|
13023
|
-
WRONG_PASSWORD: "Wrong Password",
|
|
13024
|
-
COMMENT_TOO_LONG: "Comment is too long",
|
|
13025
|
-
EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
|
|
13026
|
-
};
|
|
13027
|
-
function E(message) {
|
|
13028
|
-
return function(...args) {
|
|
13029
|
-
if (args.length) {
|
|
13030
|
-
message = message.replace(/\{(\d)\}/g, (_, n) => args[n] || "");
|
|
13031
|
-
}
|
|
13032
|
-
return new Error("ADM-ZIP: " + message);
|
|
13033
|
-
};
|
|
13034
|
-
}
|
|
13035
|
-
for (const msg of Object.keys(errors)) {
|
|
13036
|
-
exports[msg] = E(errors[msg]);
|
|
13037
|
-
}
|
|
13038
|
-
});
|
|
13039
|
-
|
|
13040
|
-
// ../../../node_modules/adm-zip/util/utils.js
|
|
13041
|
-
var require_utils = __commonJS(function(exports, module) {
|
|
13042
|
-
var fsystem = __require("fs");
|
|
13043
|
-
var pth = __require("path");
|
|
13044
|
-
var Constants = require_constants();
|
|
13045
|
-
var Errors = require_errors();
|
|
13046
|
-
var isWin = typeof process === "object" && process.platform === "win32";
|
|
13047
|
-
var is_Obj = (obj) => typeof obj === "object" && obj !== null;
|
|
13048
|
-
var crcTable = new Uint32Array(256).map((t, c) => {
|
|
13049
|
-
for (let k = 0;k < 8; k++) {
|
|
13050
|
-
if ((c & 1) !== 0) {
|
|
13051
|
-
c = 3988292384 ^ c >>> 1;
|
|
13052
|
-
} else {
|
|
13053
|
-
c >>>= 1;
|
|
13054
|
-
}
|
|
13055
|
-
}
|
|
13056
|
-
return c >>> 0;
|
|
13057
|
-
});
|
|
13058
|
-
function Utils(opts) {
|
|
13059
|
-
this.sep = pth.sep;
|
|
13060
|
-
this.fs = fsystem;
|
|
13061
|
-
if (is_Obj(opts)) {
|
|
13062
|
-
if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") {
|
|
13063
|
-
this.fs = opts.fs;
|
|
13064
|
-
}
|
|
13065
|
-
}
|
|
13066
|
-
}
|
|
13067
|
-
module.exports = Utils;
|
|
13068
|
-
Utils.prototype.makeDir = function(folder) {
|
|
13069
|
-
const self = this;
|
|
13070
|
-
function mkdirSync(fpath) {
|
|
13071
|
-
let resolvedPath = fpath.split(self.sep)[0];
|
|
13072
|
-
fpath.split(self.sep).forEach(function(name) {
|
|
13073
|
-
if (!name || name.substr(-1, 1) === ":")
|
|
13074
|
-
return;
|
|
13075
|
-
resolvedPath += self.sep + name;
|
|
13076
|
-
var stat4;
|
|
13077
|
-
try {
|
|
13078
|
-
stat4 = self.fs.statSync(resolvedPath);
|
|
13079
|
-
} catch (e) {
|
|
13080
|
-
if (e.message && e.message.startsWith("ENOENT")) {
|
|
13081
|
-
self.fs.mkdirSync(resolvedPath);
|
|
13082
|
-
} else {
|
|
13083
|
-
throw e;
|
|
13084
|
-
}
|
|
13085
|
-
}
|
|
13086
|
-
if (stat4 && stat4.isFile())
|
|
13087
|
-
throw Errors.FILE_IN_THE_WAY(`"${resolvedPath}"`);
|
|
13088
|
-
});
|
|
13089
|
-
}
|
|
13090
|
-
mkdirSync(folder);
|
|
13091
|
-
};
|
|
13092
|
-
Utils.prototype.writeFileTo = function(path5, content, overwrite, attr) {
|
|
13093
|
-
const self = this;
|
|
13094
|
-
if (self.fs.existsSync(path5)) {
|
|
13095
|
-
if (!overwrite)
|
|
13096
|
-
return false;
|
|
13097
|
-
var stat4 = self.fs.statSync(path5);
|
|
13098
|
-
if (stat4.isDirectory()) {
|
|
13099
|
-
return false;
|
|
13100
|
-
}
|
|
13101
|
-
}
|
|
13102
|
-
var folder = pth.dirname(path5);
|
|
13103
|
-
if (!self.fs.existsSync(folder)) {
|
|
13104
|
-
self.makeDir(folder);
|
|
13105
|
-
}
|
|
13106
|
-
var fd;
|
|
13107
|
-
try {
|
|
13108
|
-
fd = self.fs.openSync(path5, "w", 438);
|
|
13109
|
-
} catch (e) {
|
|
13110
|
-
self.fs.chmodSync(path5, 438);
|
|
13111
|
-
fd = self.fs.openSync(path5, "w", 438);
|
|
13112
|
-
}
|
|
13113
|
-
if (fd) {
|
|
13114
|
-
try {
|
|
13115
|
-
self.fs.writeSync(fd, content, 0, content.length, 0);
|
|
13116
|
-
} finally {
|
|
13117
|
-
self.fs.closeSync(fd);
|
|
13118
|
-
}
|
|
13119
|
-
}
|
|
13120
|
-
self.fs.chmodSync(path5, attr || 438);
|
|
13121
|
-
return true;
|
|
13122
|
-
};
|
|
13123
|
-
Utils.prototype.writeFileToAsync = function(path5, content, overwrite, attr, callback) {
|
|
13124
|
-
if (typeof attr === "function") {
|
|
13125
|
-
callback = attr;
|
|
13126
|
-
attr = undefined;
|
|
13127
|
-
}
|
|
13128
|
-
const self = this;
|
|
13129
|
-
self.fs.exists(path5, function(exist) {
|
|
13130
|
-
if (exist && !overwrite)
|
|
13131
|
-
return callback(false);
|
|
13132
|
-
self.fs.stat(path5, function(err, stat4) {
|
|
13133
|
-
if (exist && stat4 && stat4.isDirectory()) {
|
|
13134
|
-
return callback(false);
|
|
13135
|
-
}
|
|
13136
|
-
var folder = pth.dirname(path5);
|
|
13137
|
-
self.fs.exists(folder, function(exists) {
|
|
13138
|
-
if (!exists) {
|
|
13139
|
-
try {
|
|
13140
|
-
self.makeDir(folder);
|
|
13141
|
-
} catch (e) {
|
|
13142
|
-
return callback(false);
|
|
13143
|
-
}
|
|
13144
|
-
}
|
|
13145
|
-
const writeToFd = function(fd) {
|
|
13146
|
-
self.fs.write(fd, content, 0, content.length, 0, function(writeErr) {
|
|
13147
|
-
self.fs.close(fd, function() {
|
|
13148
|
-
if (writeErr)
|
|
13149
|
-
return callback(false);
|
|
13150
|
-
self.fs.chmod(path5, attr || 438, function() {
|
|
13151
|
-
callback(true);
|
|
13152
|
-
});
|
|
13153
|
-
});
|
|
13154
|
-
});
|
|
13155
|
-
};
|
|
13156
|
-
self.fs.open(path5, "w", 438, function(err2, fd) {
|
|
13157
|
-
if (err2) {
|
|
13158
|
-
self.fs.chmod(path5, 438, function() {
|
|
13159
|
-
self.fs.open(path5, "w", 438, function(retryErr, fd2) {
|
|
13160
|
-
if (retryErr || !fd2)
|
|
13161
|
-
return callback(false);
|
|
13162
|
-
writeToFd(fd2);
|
|
13163
|
-
});
|
|
13164
|
-
});
|
|
13165
|
-
} else if (fd) {
|
|
13166
|
-
writeToFd(fd);
|
|
13167
|
-
} else {
|
|
13168
|
-
callback(false);
|
|
13169
|
-
}
|
|
13170
|
-
});
|
|
13171
|
-
});
|
|
13172
|
-
});
|
|
13173
|
-
});
|
|
13174
|
-
};
|
|
13175
|
-
Utils.prototype.assertPathSafe = function(root, target) {
|
|
13176
|
-
const self = this;
|
|
13177
|
-
if (typeof self.fs.lstatSync !== "function")
|
|
13178
|
-
return;
|
|
13179
|
-
const resolvedRoot = pth.resolve(root);
|
|
13180
|
-
const resolvedTarget = pth.resolve(target);
|
|
13181
|
-
if (resolvedTarget === resolvedRoot)
|
|
13182
|
-
return;
|
|
13183
|
-
const rel = pth.relative(resolvedRoot, resolvedTarget);
|
|
13184
|
-
if (!rel || rel === ".." || rel.startsWith(".." + pth.sep) || pth.isAbsolute(rel))
|
|
13185
|
-
return;
|
|
13186
|
-
let cur = resolvedRoot;
|
|
13187
|
-
for (const part of rel.split(pth.sep)) {
|
|
13188
|
-
if (!part || part === ".")
|
|
13189
|
-
continue;
|
|
13190
|
-
cur = pth.join(cur, part);
|
|
13191
|
-
let stat4;
|
|
13192
|
-
try {
|
|
13193
|
-
stat4 = self.fs.lstatSync(cur);
|
|
13194
|
-
} catch (e) {
|
|
13195
|
-
break;
|
|
13196
|
-
}
|
|
13197
|
-
if (stat4.isSymbolicLink())
|
|
13198
|
-
throw Errors.FILE_IN_THE_WAY(`"${cur}"`);
|
|
13199
|
-
}
|
|
13200
|
-
};
|
|
13201
|
-
Utils.prototype.findFiles = function(path5) {
|
|
13202
|
-
const self = this;
|
|
13203
|
-
const canLstat = typeof self.fs.lstatSync === "function";
|
|
13204
|
-
const rootReal = self.fs.realpathSync(path5);
|
|
13205
|
-
function escapesRoot(p) {
|
|
13206
|
-
if (!canLstat)
|
|
13207
|
-
return false;
|
|
13208
|
-
if (!self.fs.lstatSync(p).isSymbolicLink())
|
|
13209
|
-
return false;
|
|
13210
|
-
let real;
|
|
13211
|
-
try {
|
|
13212
|
-
real = self.fs.realpathSync(p);
|
|
13213
|
-
} catch (e) {
|
|
13214
|
-
return true;
|
|
13215
|
-
}
|
|
13216
|
-
return !(real === rootReal || real.startsWith(rootReal + pth.sep));
|
|
13217
|
-
}
|
|
13218
|
-
function findSync(dir, pattern, recursive, visited) {
|
|
13219
|
-
if (typeof pattern === "boolean") {
|
|
13220
|
-
recursive = pattern;
|
|
13221
|
-
pattern = undefined;
|
|
13222
|
-
}
|
|
13223
|
-
let files = [];
|
|
13224
|
-
self.fs.readdirSync(dir).forEach(function(file) {
|
|
13225
|
-
const path7 = pth.join(dir, file);
|
|
13226
|
-
if (escapesRoot(path7))
|
|
13227
|
-
return;
|
|
13228
|
-
const stat4 = self.fs.statSync(path7);
|
|
13229
|
-
if (!pattern || pattern.test(path7)) {
|
|
13230
|
-
files.push(pth.normalize(path7) + (stat4.isDirectory() ? self.sep : ""));
|
|
13231
|
-
}
|
|
13232
|
-
if (stat4.isDirectory() && recursive) {
|
|
13233
|
-
const realDir = self.fs.realpathSync(path7);
|
|
13234
|
-
if (!visited.has(realDir)) {
|
|
13235
|
-
visited.add(realDir);
|
|
13236
|
-
files = files.concat(findSync(path7, pattern, recursive, visited));
|
|
13237
|
-
}
|
|
13238
|
-
}
|
|
13239
|
-
});
|
|
13240
|
-
return files;
|
|
13241
|
-
}
|
|
13242
|
-
return findSync(path5, undefined, true, new Set([rootReal]));
|
|
13243
|
-
};
|
|
13244
|
-
Utils.prototype.findFilesAsync = function(dir, cb) {
|
|
13245
|
-
const self = this;
|
|
13246
|
-
const results = [];
|
|
13247
|
-
let finished = false;
|
|
13248
|
-
const finish = function(err) {
|
|
13249
|
-
if (finished)
|
|
13250
|
-
return;
|
|
13251
|
-
finished = true;
|
|
13252
|
-
cb(err, err ? undefined : results);
|
|
13253
|
-
};
|
|
13254
|
-
const canLstat = typeof self.fs.lstat === "function";
|
|
13255
|
-
let rootReal = null;
|
|
13256
|
-
const escapesRoot = function(file, cb2) {
|
|
13257
|
-
if (!canLstat)
|
|
13258
|
-
return cb2(null, false);
|
|
13259
|
-
self.fs.lstat(file, function(err, lst) {
|
|
13260
|
-
if (err)
|
|
13261
|
-
return cb2(err);
|
|
13262
|
-
if (!lst || !lst.isSymbolicLink())
|
|
13263
|
-
return cb2(null, false);
|
|
13264
|
-
self.fs.realpath(file, function(err2, real) {
|
|
13265
|
-
if (err2)
|
|
13266
|
-
return cb2(null, true);
|
|
13267
|
-
cb2(null, !(real === rootReal || real.startsWith(rootReal + pth.sep)));
|
|
13268
|
-
});
|
|
13269
|
-
});
|
|
13270
|
-
};
|
|
13271
|
-
const walk = function(dir2, visited, done) {
|
|
13272
|
-
self.fs.readdir(dir2, function(err, list) {
|
|
13273
|
-
if (err)
|
|
13274
|
-
return done(err);
|
|
13275
|
-
let pending = list.length;
|
|
13276
|
-
if (!pending)
|
|
13277
|
-
return done();
|
|
13278
|
-
list.forEach(function(name) {
|
|
13279
|
-
const file = pth.join(dir2, name);
|
|
13280
|
-
escapesRoot(file, function(err2, escapes) {
|
|
13281
|
-
if (err2)
|
|
13282
|
-
return done(err2);
|
|
13283
|
-
if (escapes) {
|
|
13284
|
-
if (!--pending)
|
|
13285
|
-
done();
|
|
13286
|
-
return;
|
|
13287
|
-
}
|
|
13288
|
-
self.fs.stat(file, function(err3, stat4) {
|
|
13289
|
-
if (err3)
|
|
13290
|
-
return done(err3);
|
|
13291
|
-
if (!stat4) {
|
|
13292
|
-
if (!--pending)
|
|
13293
|
-
done();
|
|
13294
|
-
return;
|
|
13295
|
-
}
|
|
13296
|
-
results.push(pth.normalize(file) + (stat4.isDirectory() ? self.sep : ""));
|
|
13297
|
-
if (!stat4.isDirectory()) {
|
|
13298
|
-
if (!--pending)
|
|
13299
|
-
done();
|
|
13300
|
-
return;
|
|
13301
|
-
}
|
|
13302
|
-
self.fs.realpath(file, function(err4, realDir) {
|
|
13303
|
-
if (err4)
|
|
13304
|
-
return done(err4);
|
|
13305
|
-
if (visited.has(realDir)) {
|
|
13306
|
-
if (!--pending)
|
|
13307
|
-
done();
|
|
13308
|
-
return;
|
|
13309
|
-
}
|
|
13310
|
-
visited.add(realDir);
|
|
13311
|
-
walk(file, visited, function(err5) {
|
|
13312
|
-
if (err5)
|
|
13313
|
-
return done(err5);
|
|
13314
|
-
if (!--pending)
|
|
13315
|
-
done();
|
|
13316
|
-
});
|
|
13317
|
-
});
|
|
13318
|
-
});
|
|
13319
|
-
});
|
|
13320
|
-
});
|
|
13321
|
-
});
|
|
13322
|
-
};
|
|
13323
|
-
self.fs.realpath(dir, function(err, realDir) {
|
|
13324
|
-
if (err)
|
|
13325
|
-
return finish(err);
|
|
13326
|
-
rootReal = realDir;
|
|
13327
|
-
walk(dir, new Set([realDir]), finish);
|
|
13328
|
-
});
|
|
13329
|
-
};
|
|
13330
|
-
Utils.prototype.getAttributes = function() {};
|
|
13331
|
-
Utils.prototype.setAttributes = function() {};
|
|
13332
|
-
Utils.crc32update = function(crc, byte) {
|
|
13333
|
-
return crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
13334
|
-
};
|
|
13335
|
-
Utils.crc32 = function(buf) {
|
|
13336
|
-
if (typeof buf === "string") {
|
|
13337
|
-
buf = Buffer.from(buf, "utf8");
|
|
13338
|
-
}
|
|
13339
|
-
let len = buf.length;
|
|
13340
|
-
let crc = ~0;
|
|
13341
|
-
for (let off = 0;off < len; )
|
|
13342
|
-
crc = Utils.crc32update(crc, buf[off++]);
|
|
13343
|
-
return ~crc >>> 0;
|
|
13344
|
-
};
|
|
13345
|
-
Utils.methodToString = function(method) {
|
|
13346
|
-
switch (method) {
|
|
13347
|
-
case Constants.STORED:
|
|
13348
|
-
return "STORED (" + method + ")";
|
|
13349
|
-
case Constants.DEFLATED:
|
|
13350
|
-
return "DEFLATED (" + method + ")";
|
|
13351
|
-
default:
|
|
13352
|
-
return "UNSUPPORTED (" + method + ")";
|
|
13353
|
-
}
|
|
13354
|
-
};
|
|
13355
|
-
Utils.canonical = function(path5) {
|
|
13356
|
-
if (!path5)
|
|
13357
|
-
return "";
|
|
13358
|
-
const safeSuffix = pth.posix.normalize("/" + path5.split("\\").join("/"));
|
|
13359
|
-
return pth.join(".", safeSuffix);
|
|
13360
|
-
};
|
|
13361
|
-
Utils.zipnamefix = function(path5) {
|
|
13362
|
-
if (!path5)
|
|
13363
|
-
return "";
|
|
13364
|
-
const safeSuffix = pth.posix.normalize("/" + path5.split("\\").join("/"));
|
|
13365
|
-
return pth.posix.join(".", safeSuffix);
|
|
13366
|
-
};
|
|
13367
|
-
Utils.findLast = function(arr, callback) {
|
|
13368
|
-
if (!Array.isArray(arr))
|
|
13369
|
-
throw new TypeError("arr is not array");
|
|
13370
|
-
const len = arr.length >>> 0;
|
|
13371
|
-
for (let i = len - 1;i >= 0; i--) {
|
|
13372
|
-
if (callback(arr[i], i, arr)) {
|
|
13373
|
-
return arr[i];
|
|
13374
|
-
}
|
|
13375
|
-
}
|
|
13376
|
-
return;
|
|
13377
|
-
};
|
|
13378
|
-
Utils.sanitize = function(prefix, name) {
|
|
13379
|
-
prefix = pth.resolve(pth.normalize(prefix));
|
|
13380
|
-
var parts = name.split("/");
|
|
13381
|
-
for (var i = 0, l = parts.length;i < l; i++) {
|
|
13382
|
-
var path5 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
|
|
13383
|
-
if (path5 === prefix || path5.startsWith(prefix + pth.sep)) {
|
|
13384
|
-
return path5;
|
|
13385
|
-
}
|
|
13386
|
-
}
|
|
13387
|
-
return pth.normalize(pth.join(prefix, pth.basename(name)));
|
|
13388
|
-
};
|
|
13389
|
-
Utils.toBuffer = function toBuffer(input, encoder) {
|
|
13390
|
-
if (Buffer.isBuffer(input)) {
|
|
13391
|
-
return input;
|
|
13392
|
-
} else if (input instanceof Uint8Array) {
|
|
13393
|
-
return Buffer.from(input);
|
|
13394
|
-
} else {
|
|
13395
|
-
return typeof input === "string" ? encoder(input) : Buffer.alloc(0);
|
|
13396
|
-
}
|
|
13397
|
-
};
|
|
13398
|
-
Utils.readBigUInt64LE = function(buffer, index) {
|
|
13399
|
-
const lo = buffer.readUInt32LE(index);
|
|
13400
|
-
const hi = buffer.readUInt32LE(index + 4);
|
|
13401
|
-
const value = hi * 4294967296 + lo;
|
|
13402
|
-
if (value > Number.MAX_SAFE_INTEGER) {
|
|
13403
|
-
throw Errors.ZIP64_VALUE_TOO_LARGE();
|
|
13404
|
-
}
|
|
13405
|
-
return value;
|
|
13406
|
-
};
|
|
13407
|
-
Utils.writeBigUInt64LE = function(buffer, value, index) {
|
|
13408
|
-
const lo = value >>> 0;
|
|
13409
|
-
const hi = Math.floor(value / 4294967296) >>> 0;
|
|
13410
|
-
buffer.writeUInt32LE(lo, index);
|
|
13411
|
-
buffer.writeUInt32LE(hi, index + 4);
|
|
13412
|
-
};
|
|
13413
|
-
Utils.fromDOS2Date = function(val) {
|
|
13414
|
-
return new Date((val >> 25 & 127) + 1980, Math.max((val >> 21 & 15) - 1, 0), Math.max(val >> 16 & 31, 1), val >> 11 & 31, val >> 5 & 63, (val & 31) << 1);
|
|
13415
|
-
};
|
|
13416
|
-
Utils.fromDate2DOS = function(val) {
|
|
13417
|
-
let date = 0;
|
|
13418
|
-
let time = 0;
|
|
13419
|
-
if (val.getFullYear() > 1979) {
|
|
13420
|
-
date = (val.getFullYear() - 1980 & 127) << 9 | val.getMonth() + 1 << 5 | val.getDate();
|
|
13421
|
-
time = val.getHours() << 11 | val.getMinutes() << 5 | val.getSeconds() >> 1;
|
|
13422
|
-
}
|
|
13423
|
-
return date << 16 | time;
|
|
13424
|
-
};
|
|
13425
|
-
Utils.isWin = isWin;
|
|
13426
|
-
Utils.crcTable = crcTable;
|
|
13427
|
-
});
|
|
13428
|
-
|
|
13429
|
-
// ../../../node_modules/adm-zip/util/fattr.js
|
|
13430
|
-
var require_fattr = __commonJS(function(exports, module) {
|
|
13431
|
-
var pth = __require("path");
|
|
13432
|
-
module.exports = function(path5, { fs: fs14 }) {
|
|
13433
|
-
var _path = path5 || "", _obj = newAttr(), _stat = null;
|
|
13434
|
-
function newAttr() {
|
|
13435
|
-
return {
|
|
13436
|
-
directory: false,
|
|
13437
|
-
readonly: false,
|
|
13438
|
-
hidden: false,
|
|
13439
|
-
executable: false,
|
|
13440
|
-
mtime: 0,
|
|
13441
|
-
atime: 0
|
|
13442
|
-
};
|
|
13443
|
-
}
|
|
13444
|
-
if (_path && fs14.existsSync(_path)) {
|
|
13445
|
-
_stat = fs14.statSync(_path);
|
|
13446
|
-
_obj.directory = _stat.isDirectory();
|
|
13447
|
-
_obj.mtime = _stat.mtime;
|
|
13448
|
-
_obj.atime = _stat.atime;
|
|
13449
|
-
_obj.executable = (73 & _stat.mode) !== 0;
|
|
13450
|
-
_obj.readonly = (128 & _stat.mode) === 0;
|
|
13451
|
-
_obj.hidden = pth.basename(_path)[0] === ".";
|
|
13452
|
-
} else {
|
|
13453
|
-
console.warn("Invalid path: " + _path);
|
|
13454
|
-
}
|
|
13455
|
-
return {
|
|
13456
|
-
get directory() {
|
|
13457
|
-
return _obj.directory;
|
|
13458
|
-
},
|
|
13459
|
-
get readOnly() {
|
|
13460
|
-
return _obj.readonly;
|
|
13461
|
-
},
|
|
13462
|
-
get hidden() {
|
|
13463
|
-
return _obj.hidden;
|
|
13464
|
-
},
|
|
13465
|
-
get mtime() {
|
|
13466
|
-
return _obj.mtime;
|
|
13467
|
-
},
|
|
13468
|
-
get atime() {
|
|
13469
|
-
return _obj.atime;
|
|
13470
|
-
},
|
|
13471
|
-
get executable() {
|
|
13472
|
-
return _obj.executable;
|
|
13473
|
-
},
|
|
13474
|
-
decodeAttributes: function() {},
|
|
13475
|
-
encodeAttributes: function() {},
|
|
13476
|
-
toJSON: function() {
|
|
13477
|
-
return {
|
|
13478
|
-
path: _path,
|
|
13479
|
-
isDirectory: _obj.directory,
|
|
13480
|
-
isReadOnly: _obj.readonly,
|
|
13481
|
-
isHidden: _obj.hidden,
|
|
13482
|
-
isExecutable: _obj.executable,
|
|
13483
|
-
mTime: _obj.mtime,
|
|
13484
|
-
aTime: _obj.atime
|
|
13485
|
-
};
|
|
13486
|
-
},
|
|
13487
|
-
toString: function() {
|
|
13488
|
-
return JSON.stringify(this.toJSON(), null, "\t");
|
|
13489
|
-
}
|
|
13490
|
-
};
|
|
13491
|
-
};
|
|
13492
|
-
});
|
|
13493
|
-
|
|
13494
|
-
// ../../../node_modules/adm-zip/util/decoder.js
|
|
13495
|
-
var require_decoder = __commonJS(function(exports, module) {
|
|
13496
|
-
module.exports = {
|
|
13497
|
-
efs: true,
|
|
13498
|
-
encode: (data) => Buffer.from(data, "utf8"),
|
|
13499
|
-
decode: (data) => data.toString("utf8")
|
|
13500
|
-
};
|
|
13501
|
-
});
|
|
13502
|
-
|
|
13503
|
-
// ../../../node_modules/adm-zip/util/index.js
|
|
13504
|
-
var require_util = __commonJS(function(exports, module) {
|
|
13505
|
-
module.exports = require_utils();
|
|
13506
|
-
module.exports.Constants = require_constants();
|
|
13507
|
-
module.exports.Errors = require_errors();
|
|
13508
|
-
module.exports.FileAttr = require_fattr();
|
|
13509
|
-
module.exports.decoder = require_decoder();
|
|
13510
|
-
});
|
|
13511
|
-
|
|
13512
|
-
// ../../../node_modules/adm-zip/headers/entryHeader.js
|
|
13513
|
-
var require_entryHeader = __commonJS(function(exports, module) {
|
|
13514
|
-
var Utils = require_util();
|
|
13515
|
-
var Constants = Utils.Constants;
|
|
13516
|
-
module.exports = function() {
|
|
13517
|
-
var _verMade = 20, _version = 10, _flags = 0, _method = 0, _time = 0, _crc = 0, _compressedSize = 0, _size = 0, _fnameLen = 0, _extraLen = 0, _comLen = 0, _diskStart = 0, _inattr = 0, _attr = 0, _offset = 0;
|
|
13518
|
-
_verMade |= Utils.isWin ? 2560 : 768;
|
|
13519
|
-
_flags |= Constants.FLG_EFS;
|
|
13520
|
-
const _localHeader = {
|
|
13521
|
-
extraLen: 0
|
|
13522
|
-
};
|
|
13523
|
-
const uint32 = (val) => Math.max(0, val) >>> 0;
|
|
13524
|
-
const uint16 = (val) => Math.max(0, val) & 65535;
|
|
13525
|
-
const uint8 = (val) => Math.max(0, val) & 255;
|
|
13526
|
-
_time = Utils.fromDate2DOS(new Date);
|
|
13527
|
-
return {
|
|
13528
|
-
get made() {
|
|
13529
|
-
return _verMade;
|
|
13530
|
-
},
|
|
13531
|
-
set made(val) {
|
|
13532
|
-
_verMade = val;
|
|
13533
|
-
},
|
|
13534
|
-
get version() {
|
|
13535
|
-
return _version;
|
|
13536
|
-
},
|
|
13537
|
-
set version(val) {
|
|
13538
|
-
_version = val;
|
|
13539
|
-
},
|
|
13540
|
-
get flags() {
|
|
13541
|
-
return _flags;
|
|
13542
|
-
},
|
|
13543
|
-
set flags(val) {
|
|
13544
|
-
_flags = val;
|
|
13545
|
-
},
|
|
13546
|
-
get flags_efs() {
|
|
13547
|
-
return (_flags & Constants.FLG_EFS) > 0;
|
|
13548
|
-
},
|
|
13549
|
-
set flags_efs(val) {
|
|
13550
|
-
if (val) {
|
|
13551
|
-
_flags |= Constants.FLG_EFS;
|
|
13552
|
-
} else {
|
|
13553
|
-
_flags &= ~Constants.FLG_EFS;
|
|
13554
|
-
}
|
|
13555
|
-
},
|
|
13556
|
-
get flags_desc() {
|
|
13557
|
-
return (_flags & Constants.FLG_DESC) > 0;
|
|
13558
|
-
},
|
|
13559
|
-
set flags_desc(val) {
|
|
13560
|
-
if (val) {
|
|
13561
|
-
_flags |= Constants.FLG_DESC;
|
|
13562
|
-
} else {
|
|
13563
|
-
_flags &= ~Constants.FLG_DESC;
|
|
13564
|
-
}
|
|
13565
|
-
},
|
|
13566
|
-
get method() {
|
|
13567
|
-
return _method;
|
|
13568
|
-
},
|
|
13569
|
-
set method(val) {
|
|
13570
|
-
switch (val) {
|
|
13571
|
-
case Constants.STORED:
|
|
13572
|
-
this.version = 10;
|
|
13573
|
-
break;
|
|
13574
|
-
case Constants.DEFLATED:
|
|
13575
|
-
default:
|
|
13576
|
-
this.version = 20;
|
|
13577
|
-
}
|
|
13578
|
-
_method = val;
|
|
13579
|
-
},
|
|
13580
|
-
get time() {
|
|
13581
|
-
return Utils.fromDOS2Date(this.timeval);
|
|
13582
|
-
},
|
|
13583
|
-
set time(val) {
|
|
13584
|
-
val = new Date(val);
|
|
13585
|
-
this.timeval = Utils.fromDate2DOS(val);
|
|
13586
|
-
},
|
|
13587
|
-
get timeval() {
|
|
13588
|
-
return _time;
|
|
13589
|
-
},
|
|
13590
|
-
set timeval(val) {
|
|
13591
|
-
_time = uint32(val);
|
|
13592
|
-
},
|
|
13593
|
-
get timeHighByte() {
|
|
13594
|
-
return uint8(_time >>> 8);
|
|
13595
|
-
},
|
|
13596
|
-
get crc() {
|
|
13597
|
-
return _crc;
|
|
13598
|
-
},
|
|
13599
|
-
set crc(val) {
|
|
13600
|
-
_crc = uint32(val);
|
|
13601
|
-
},
|
|
13602
|
-
get compressedSize() {
|
|
13603
|
-
return _compressedSize;
|
|
13604
|
-
},
|
|
13605
|
-
set compressedSize(val) {
|
|
13606
|
-
_compressedSize = uint32(val);
|
|
13607
|
-
},
|
|
13608
|
-
get size() {
|
|
13609
|
-
return _size;
|
|
13610
|
-
},
|
|
13611
|
-
set size(val) {
|
|
13612
|
-
_size = uint32(val);
|
|
13613
|
-
},
|
|
13614
|
-
get fileNameLength() {
|
|
13615
|
-
return _fnameLen;
|
|
13616
|
-
},
|
|
13617
|
-
set fileNameLength(val) {
|
|
13618
|
-
_fnameLen = val;
|
|
13619
|
-
},
|
|
13620
|
-
get extraLength() {
|
|
13621
|
-
return _extraLen;
|
|
13622
|
-
},
|
|
13623
|
-
set extraLength(val) {
|
|
13624
|
-
_extraLen = val;
|
|
13625
|
-
},
|
|
13626
|
-
get extraLocalLength() {
|
|
13627
|
-
return _localHeader.extraLen;
|
|
13628
|
-
},
|
|
13629
|
-
set extraLocalLength(val) {
|
|
13630
|
-
_localHeader.extraLen = val;
|
|
13631
|
-
},
|
|
13632
|
-
get commentLength() {
|
|
13633
|
-
return _comLen;
|
|
13634
|
-
},
|
|
13635
|
-
set commentLength(val) {
|
|
13636
|
-
_comLen = val;
|
|
13637
|
-
},
|
|
13638
|
-
get diskNumStart() {
|
|
13639
|
-
return _diskStart;
|
|
13640
|
-
},
|
|
13641
|
-
set diskNumStart(val) {
|
|
13642
|
-
_diskStart = uint32(val);
|
|
13643
|
-
},
|
|
13644
|
-
get inAttr() {
|
|
13645
|
-
return _inattr;
|
|
13646
|
-
},
|
|
13647
|
-
set inAttr(val) {
|
|
13648
|
-
_inattr = uint32(val);
|
|
13649
|
-
},
|
|
13650
|
-
get attr() {
|
|
13651
|
-
return _attr;
|
|
13652
|
-
},
|
|
13653
|
-
set attr(val) {
|
|
13654
|
-
_attr = uint32(val);
|
|
13655
|
-
},
|
|
13656
|
-
get fileAttr() {
|
|
13657
|
-
return (_attr || 0) >> 16 & 511;
|
|
13658
|
-
},
|
|
13659
|
-
get offset() {
|
|
13660
|
-
return _offset;
|
|
13661
|
-
},
|
|
13662
|
-
set offset(val) {
|
|
13663
|
-
_offset = uint32(val);
|
|
13664
|
-
},
|
|
13665
|
-
get encrypted() {
|
|
13666
|
-
return (_flags & Constants.FLG_ENC) === Constants.FLG_ENC;
|
|
13667
|
-
},
|
|
13668
|
-
get centralHeaderSize() {
|
|
13669
|
-
return Constants.CENHDR + _fnameLen + _extraLen + _comLen;
|
|
13670
|
-
},
|
|
13671
|
-
get realDataOffset() {
|
|
13672
|
-
return _offset + Constants.LOCHDR + _localHeader.fnameLen + _localHeader.extraLen;
|
|
13673
|
-
},
|
|
13674
|
-
get localHeader() {
|
|
13675
|
-
return _localHeader;
|
|
13676
|
-
},
|
|
13677
|
-
loadLocalHeaderFromBinary: function(input) {
|
|
13678
|
-
if (_offset < 0 || _offset + Constants.LOCHDR > input.length) {
|
|
13679
|
-
throw Utils.Errors.INVALID_LOC();
|
|
13680
|
-
}
|
|
13681
|
-
var data = input.slice(_offset, _offset + Constants.LOCHDR);
|
|
13682
|
-
if (data.readUInt32LE(0) !== Constants.LOCSIG) {
|
|
13683
|
-
throw Utils.Errors.INVALID_LOC();
|
|
13684
|
-
}
|
|
13685
|
-
_localHeader.version = data.readUInt16LE(Constants.LOCVER);
|
|
13686
|
-
_localHeader.flags = data.readUInt16LE(Constants.LOCFLG);
|
|
13687
|
-
_localHeader.flags_desc = (_localHeader.flags & Constants.FLG_DESC) > 0;
|
|
13688
|
-
_localHeader.method = data.readUInt16LE(Constants.LOCHOW);
|
|
13689
|
-
_localHeader.time = data.readUInt32LE(Constants.LOCTIM);
|
|
13690
|
-
_localHeader.crc = data.readUInt32LE(Constants.LOCCRC);
|
|
13691
|
-
_localHeader.compressedSize = data.readUInt32LE(Constants.LOCSIZ);
|
|
13692
|
-
_localHeader.size = data.readUInt32LE(Constants.LOCLEN);
|
|
13693
|
-
_localHeader.fnameLen = data.readUInt16LE(Constants.LOCNAM);
|
|
13694
|
-
_localHeader.extraLen = data.readUInt16LE(Constants.LOCEXT);
|
|
13695
|
-
const extraStart = _offset + Constants.LOCHDR + _localHeader.fnameLen;
|
|
13696
|
-
const extraEnd = extraStart + _localHeader.extraLen;
|
|
13697
|
-
return input.slice(extraStart, extraEnd);
|
|
13698
|
-
},
|
|
13699
|
-
loadFromBinary: function(data) {
|
|
13700
|
-
if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {
|
|
13701
|
-
throw Utils.Errors.INVALID_CEN();
|
|
13702
|
-
}
|
|
13703
|
-
_verMade = data.readUInt16LE(Constants.CENVEM);
|
|
13704
|
-
_version = data.readUInt16LE(Constants.CENVER);
|
|
13705
|
-
_flags = data.readUInt16LE(Constants.CENFLG);
|
|
13706
|
-
_method = data.readUInt16LE(Constants.CENHOW);
|
|
13707
|
-
_time = data.readUInt32LE(Constants.CENTIM);
|
|
13708
|
-
_crc = data.readUInt32LE(Constants.CENCRC);
|
|
13709
|
-
_compressedSize = data.readUInt32LE(Constants.CENSIZ);
|
|
13710
|
-
_size = data.readUInt32LE(Constants.CENLEN);
|
|
13711
|
-
_fnameLen = data.readUInt16LE(Constants.CENNAM);
|
|
13712
|
-
_extraLen = data.readUInt16LE(Constants.CENEXT);
|
|
13713
|
-
_comLen = data.readUInt16LE(Constants.CENCOM);
|
|
13714
|
-
_diskStart = data.readUInt16LE(Constants.CENDSK);
|
|
13715
|
-
_inattr = data.readUInt16LE(Constants.CENATT);
|
|
13716
|
-
_attr = data.readUInt32LE(Constants.CENATX);
|
|
13717
|
-
_offset = data.readUInt32LE(Constants.CENOFF);
|
|
13718
|
-
},
|
|
13719
|
-
localHeaderToBinary: function() {
|
|
13720
|
-
var data = Buffer.alloc(Constants.LOCHDR);
|
|
13721
|
-
data.writeUInt32LE(Constants.LOCSIG, 0);
|
|
13722
|
-
data.writeUInt16LE(_version, Constants.LOCVER);
|
|
13723
|
-
data.writeUInt16LE(_flags & ~Constants.FLG_DESC, Constants.LOCFLG);
|
|
13724
|
-
data.writeUInt16LE(_method, Constants.LOCHOW);
|
|
13725
|
-
data.writeUInt32LE(_time, Constants.LOCTIM);
|
|
13726
|
-
data.writeUInt32LE(_crc, Constants.LOCCRC);
|
|
13727
|
-
data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);
|
|
13728
|
-
data.writeUInt32LE(_size, Constants.LOCLEN);
|
|
13729
|
-
data.writeUInt16LE(_fnameLen, Constants.LOCNAM);
|
|
13730
|
-
data.writeUInt16LE(_localHeader.extraLen, Constants.LOCEXT);
|
|
13731
|
-
return data;
|
|
13732
|
-
},
|
|
13733
|
-
centralHeaderToBinary: function() {
|
|
13734
|
-
var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);
|
|
13735
|
-
data.writeUInt32LE(Constants.CENSIG, 0);
|
|
13736
|
-
data.writeUInt16LE(_verMade, Constants.CENVEM);
|
|
13737
|
-
data.writeUInt16LE(_version, Constants.CENVER);
|
|
13738
|
-
data.writeUInt16LE(_flags & ~Constants.FLG_DESC, Constants.CENFLG);
|
|
13739
|
-
data.writeUInt16LE(_method, Constants.CENHOW);
|
|
13740
|
-
data.writeUInt32LE(_time, Constants.CENTIM);
|
|
13741
|
-
data.writeUInt32LE(_crc, Constants.CENCRC);
|
|
13742
|
-
data.writeUInt32LE(_compressedSize, Constants.CENSIZ);
|
|
13743
|
-
data.writeUInt32LE(_size, Constants.CENLEN);
|
|
13744
|
-
data.writeUInt16LE(_fnameLen, Constants.CENNAM);
|
|
13745
|
-
data.writeUInt16LE(_extraLen, Constants.CENEXT);
|
|
13746
|
-
data.writeUInt16LE(_comLen, Constants.CENCOM);
|
|
13747
|
-
data.writeUInt16LE(_diskStart, Constants.CENDSK);
|
|
13748
|
-
data.writeUInt16LE(_inattr, Constants.CENATT);
|
|
13749
|
-
data.writeUInt32LE(_attr, Constants.CENATX);
|
|
13750
|
-
data.writeUInt32LE(_offset, Constants.CENOFF);
|
|
13751
|
-
return data;
|
|
13752
|
-
},
|
|
13753
|
-
toJSON: function() {
|
|
13754
|
-
const bytes = function(nr) {
|
|
13755
|
-
return nr + " bytes";
|
|
13756
|
-
};
|
|
13757
|
-
return {
|
|
13758
|
-
made: _verMade,
|
|
13759
|
-
version: _version,
|
|
13760
|
-
flags: _flags,
|
|
13761
|
-
method: Utils.methodToString(_method),
|
|
13762
|
-
time: this.time,
|
|
13763
|
-
crc: "0x" + _crc.toString(16).toUpperCase(),
|
|
13764
|
-
compressedSize: bytes(_compressedSize),
|
|
13765
|
-
size: bytes(_size),
|
|
13766
|
-
fileNameLength: bytes(_fnameLen),
|
|
13767
|
-
extraLength: bytes(_extraLen),
|
|
13768
|
-
commentLength: bytes(_comLen),
|
|
13769
|
-
diskNumStart: _diskStart,
|
|
13770
|
-
inAttr: _inattr,
|
|
13771
|
-
attr: _attr,
|
|
13772
|
-
offset: _offset,
|
|
13773
|
-
centralHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen)
|
|
13774
|
-
};
|
|
13775
|
-
},
|
|
13776
|
-
toString: function() {
|
|
13777
|
-
return JSON.stringify(this.toJSON(), null, "\t");
|
|
13778
|
-
}
|
|
13779
|
-
};
|
|
13780
|
-
};
|
|
13781
|
-
});
|
|
13782
|
-
|
|
13783
|
-
// ../../../node_modules/adm-zip/headers/mainHeader.js
|
|
13784
|
-
var require_mainHeader = __commonJS(function(exports, module) {
|
|
13785
|
-
var Utils = require_util();
|
|
13786
|
-
var Constants = Utils.Constants;
|
|
13787
|
-
module.exports = function() {
|
|
13788
|
-
var _volumeEntries = 0, _totalEntries = 0, _size = 0, _offset = 0, _commentLength = 0;
|
|
13789
|
-
const needsZip64 = () => _volumeEntries > Constants.EF_ZIP64_OR_16 || _totalEntries > Constants.EF_ZIP64_OR_16 || _size > Constants.EF_ZIP64_OR_32 || _offset > Constants.EF_ZIP64_OR_32;
|
|
13790
|
-
return {
|
|
13791
|
-
get diskEntries() {
|
|
13792
|
-
return _volumeEntries;
|
|
13793
|
-
},
|
|
13794
|
-
set diskEntries(val) {
|
|
13795
|
-
_volumeEntries = _totalEntries = val;
|
|
13796
|
-
},
|
|
13797
|
-
get totalEntries() {
|
|
13798
|
-
return _totalEntries;
|
|
13799
|
-
},
|
|
13800
|
-
set totalEntries(val) {
|
|
13801
|
-
_totalEntries = _volumeEntries = val;
|
|
13802
|
-
},
|
|
13803
|
-
get size() {
|
|
13804
|
-
return _size;
|
|
13805
|
-
},
|
|
13806
|
-
set size(val) {
|
|
13807
|
-
_size = val;
|
|
13808
|
-
},
|
|
13809
|
-
get offset() {
|
|
13810
|
-
return _offset;
|
|
13811
|
-
},
|
|
13812
|
-
set offset(val) {
|
|
13813
|
-
_offset = val;
|
|
13814
|
-
},
|
|
13815
|
-
get commentLength() {
|
|
13816
|
-
return _commentLength;
|
|
13817
|
-
},
|
|
13818
|
-
set commentLength(val) {
|
|
13819
|
-
_commentLength = val;
|
|
13820
|
-
},
|
|
13821
|
-
get mainHeaderSize() {
|
|
13822
|
-
return (needsZip64() ? Constants.ZIP64HDR + Constants.END64HDR : 0) + Constants.ENDHDR + _commentLength;
|
|
13823
|
-
},
|
|
13824
|
-
loadFromBinary: function(data) {
|
|
13825
|
-
if ((data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) && (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)) {
|
|
13826
|
-
throw Utils.Errors.INVALID_END();
|
|
13827
|
-
}
|
|
13828
|
-
if (data.readUInt32LE(0) === Constants.ENDSIG) {
|
|
13829
|
-
_volumeEntries = data.readUInt16LE(Constants.ENDSUB);
|
|
13830
|
-
_totalEntries = data.readUInt16LE(Constants.ENDTOT);
|
|
13831
|
-
_size = data.readUInt32LE(Constants.ENDSIZ);
|
|
13832
|
-
_offset = data.readUInt32LE(Constants.ENDOFF);
|
|
13833
|
-
_commentLength = data.readUInt16LE(Constants.ENDCOM);
|
|
13834
|
-
} else {
|
|
13835
|
-
_volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB);
|
|
13836
|
-
_totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);
|
|
13837
|
-
_size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZB);
|
|
13838
|
-
_offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);
|
|
13839
|
-
_commentLength = 0;
|
|
13840
|
-
}
|
|
13841
|
-
},
|
|
13842
|
-
toBinary: function() {
|
|
13843
|
-
if (!needsZip64()) {
|
|
13844
|
-
var b = Buffer.alloc(Constants.ENDHDR + _commentLength);
|
|
13845
|
-
b.writeUInt32LE(Constants.ENDSIG, 0);
|
|
13846
|
-
b.writeUInt32LE(0, 4);
|
|
13847
|
-
b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
|
|
13848
|
-
b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
|
|
13849
|
-
b.writeUInt32LE(_size, Constants.ENDSIZ);
|
|
13850
|
-
b.writeUInt32LE(_offset, Constants.ENDOFF);
|
|
13851
|
-
b.writeUInt16LE(_commentLength, Constants.ENDCOM);
|
|
13852
|
-
b.fill(" ", Constants.ENDHDR);
|
|
13853
|
-
return b;
|
|
13854
|
-
}
|
|
13855
|
-
var b = Buffer.alloc(this.mainHeaderSize);
|
|
13856
|
-
let offset = 0;
|
|
13857
|
-
b.writeUInt32LE(Constants.ZIP64SIG, offset);
|
|
13858
|
-
Utils.writeBigUInt64LE(b, Constants.ZIP64HDR - Constants.ZIP64LEAD, offset + Constants.ZIP64SIZE);
|
|
13859
|
-
b.writeUInt16LE(45, offset + Constants.ZIP64VEM);
|
|
13860
|
-
b.writeUInt16LE(45, offset + Constants.ZIP64VER);
|
|
13861
|
-
b.writeUInt32LE(0, offset + Constants.ZIP64DSK);
|
|
13862
|
-
b.writeUInt32LE(0, offset + Constants.ZIP64DSKDIR);
|
|
13863
|
-
Utils.writeBigUInt64LE(b, _volumeEntries, offset + Constants.ZIP64SUB);
|
|
13864
|
-
Utils.writeBigUInt64LE(b, _totalEntries, offset + Constants.ZIP64TOT);
|
|
13865
|
-
Utils.writeBigUInt64LE(b, _size, offset + Constants.ZIP64SIZB);
|
|
13866
|
-
Utils.writeBigUInt64LE(b, _offset, offset + Constants.ZIP64OFF);
|
|
13867
|
-
const zip64EndOffset = _offset + _size;
|
|
13868
|
-
offset += Constants.ZIP64HDR;
|
|
13869
|
-
b.writeUInt32LE(Constants.END64SIG, offset);
|
|
13870
|
-
b.writeUInt32LE(0, offset + Constants.END64START);
|
|
13871
|
-
Utils.writeBigUInt64LE(b, zip64EndOffset, offset + Constants.END64OFF);
|
|
13872
|
-
b.writeUInt32LE(1, offset + Constants.END64NUMDISKS);
|
|
13873
|
-
offset += Constants.END64HDR;
|
|
13874
|
-
b.writeUInt32LE(Constants.ENDSIG, offset);
|
|
13875
|
-
b.writeUInt32LE(0, offset + 4);
|
|
13876
|
-
b.writeUInt16LE(Math.min(_volumeEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDSUB);
|
|
13877
|
-
b.writeUInt16LE(Math.min(_totalEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDTOT);
|
|
13878
|
-
b.writeUInt32LE(Math.min(_size, Constants.EF_ZIP64_OR_32), offset + Constants.ENDSIZ);
|
|
13879
|
-
b.writeUInt32LE(Math.min(_offset, Constants.EF_ZIP64_OR_32), offset + Constants.ENDOFF);
|
|
13880
|
-
b.writeUInt16LE(_commentLength, offset + Constants.ENDCOM);
|
|
13881
|
-
b.fill(" ", offset + Constants.ENDHDR);
|
|
13882
|
-
return b;
|
|
13883
|
-
},
|
|
13884
|
-
toJSON: function() {
|
|
13885
|
-
const offset = function(nr, len) {
|
|
13886
|
-
let offs = nr.toString(16).toUpperCase();
|
|
13887
|
-
while (offs.length < len)
|
|
13888
|
-
offs = "0" + offs;
|
|
13889
|
-
return "0x" + offs;
|
|
13890
|
-
};
|
|
13891
|
-
return {
|
|
13892
|
-
diskEntries: _volumeEntries,
|
|
13893
|
-
totalEntries: _totalEntries,
|
|
13894
|
-
size: _size + " bytes",
|
|
13895
|
-
offset: offset(_offset, 4),
|
|
13896
|
-
commentLength: _commentLength
|
|
13897
|
-
};
|
|
13898
|
-
},
|
|
13899
|
-
toString: function() {
|
|
13900
|
-
return JSON.stringify(this.toJSON(), null, "\t");
|
|
13901
|
-
}
|
|
13902
|
-
};
|
|
13903
|
-
};
|
|
13904
|
-
});
|
|
13905
|
-
|
|
13906
|
-
// ../../../node_modules/adm-zip/headers/index.js
|
|
13907
|
-
var require_headers = __commonJS(function(exports) {
|
|
13908
|
-
exports.EntryHeader = require_entryHeader();
|
|
13909
|
-
exports.MainHeader = require_mainHeader();
|
|
13910
|
-
});
|
|
13911
|
-
|
|
13912
|
-
// ../../../node_modules/adm-zip/methods/deflater.js
|
|
13913
|
-
var require_deflater = __commonJS(function(exports, module) {
|
|
13914
|
-
module.exports = function(inbuf) {
|
|
13915
|
-
var zlib = __require("zlib");
|
|
13916
|
-
var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
|
|
13917
|
-
return {
|
|
13918
|
-
deflate: function() {
|
|
13919
|
-
return zlib.deflateRawSync(inbuf, opts);
|
|
13920
|
-
},
|
|
13921
|
-
deflateAsync: function(callback) {
|
|
13922
|
-
var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0;
|
|
13923
|
-
tmp.on("data", function(data) {
|
|
13924
|
-
parts.push(data);
|
|
13925
|
-
total += data.length;
|
|
13926
|
-
});
|
|
13927
|
-
tmp.on("end", function() {
|
|
13928
|
-
var buf = Buffer.alloc(total), written = 0;
|
|
13929
|
-
buf.fill(0);
|
|
13930
|
-
for (var i = 0;i < parts.length; i++) {
|
|
13931
|
-
var part = parts[i];
|
|
13932
|
-
part.copy(buf, written);
|
|
13933
|
-
written += part.length;
|
|
13934
|
-
}
|
|
13935
|
-
callback && callback(buf);
|
|
13936
|
-
});
|
|
13937
|
-
tmp.end(inbuf);
|
|
13938
|
-
}
|
|
13939
|
-
};
|
|
13940
|
-
};
|
|
13941
|
-
});
|
|
13942
|
-
|
|
13943
|
-
// ../../../node_modules/adm-zip/methods/inflater.js
|
|
13944
|
-
var require_inflater = __commonJS(function(exports, module) {
|
|
13945
|
-
var version = +(process?.versions?.node ?? "").split(".")[0] || 0;
|
|
13946
|
-
var Errors = require_errors();
|
|
13947
|
-
module.exports = function(inbuf, expectedLength) {
|
|
13948
|
-
var zlib = __require("zlib");
|
|
13949
|
-
const maxOutputLength = expectedLength > 0 ? expectedLength : 1;
|
|
13950
|
-
const option = version >= 15 ? { maxOutputLength } : {};
|
|
13951
|
-
return {
|
|
13952
|
-
inflate: function() {
|
|
13953
|
-
return zlib.inflateRawSync(inbuf, option);
|
|
13954
|
-
},
|
|
13955
|
-
inflateAsync: function(callback) {
|
|
13956
|
-
var tmp = zlib.createInflateRaw(option), parts = [], total = 0, done = false;
|
|
13957
|
-
const fail = function(err) {
|
|
13958
|
-
if (done)
|
|
13959
|
-
return;
|
|
13960
|
-
done = true;
|
|
13961
|
-
tmp.destroy();
|
|
13962
|
-
callback && callback(Buffer.alloc(0), err);
|
|
13963
|
-
};
|
|
13964
|
-
tmp.on("error", function(err) {
|
|
13965
|
-
fail(err);
|
|
13966
|
-
});
|
|
13967
|
-
tmp.on("data", function(data) {
|
|
13968
|
-
if (done)
|
|
13969
|
-
return;
|
|
13970
|
-
total += data.length;
|
|
13971
|
-
if (total > maxOutputLength) {
|
|
13972
|
-
return fail(Errors.MAX_OUTPUT_EXCEEDED());
|
|
13973
|
-
}
|
|
13974
|
-
parts.push(data);
|
|
13975
|
-
});
|
|
13976
|
-
tmp.on("end", function() {
|
|
13977
|
-
if (done)
|
|
13978
|
-
return;
|
|
13979
|
-
done = true;
|
|
13980
|
-
var buf = Buffer.alloc(total), written = 0;
|
|
13981
|
-
buf.fill(0);
|
|
13982
|
-
for (var i = 0;i < parts.length; i++) {
|
|
13983
|
-
var part = parts[i];
|
|
13984
|
-
part.copy(buf, written);
|
|
13985
|
-
written += part.length;
|
|
13986
|
-
}
|
|
13987
|
-
callback && callback(buf);
|
|
13988
|
-
});
|
|
13989
|
-
tmp.end(inbuf);
|
|
13990
|
-
}
|
|
13991
|
-
};
|
|
13992
|
-
};
|
|
13993
|
-
});
|
|
13994
|
-
|
|
13995
|
-
// ../../../node_modules/adm-zip/methods/zipcrypto.js
|
|
13996
|
-
var require_zipcrypto = __commonJS(function(exports, module) {
|
|
13997
|
-
var { randomFillSync } = __require("crypto");
|
|
13998
|
-
var Errors = require_errors();
|
|
13999
|
-
var crctable = new Uint32Array(256).map((t, crc) => {
|
|
14000
|
-
for (let j = 0;j < 8; j++) {
|
|
14001
|
-
if ((crc & 1) !== 0) {
|
|
14002
|
-
crc = crc >>> 1 ^ 3988292384;
|
|
14003
|
-
} else {
|
|
14004
|
-
crc >>>= 1;
|
|
14005
|
-
}
|
|
14006
|
-
}
|
|
14007
|
-
return crc >>> 0;
|
|
14008
|
-
});
|
|
14009
|
-
var uMul = (a, b) => Math.imul(a, b) >>> 0;
|
|
14010
|
-
var crc32update = (pCrc32, bval) => {
|
|
14011
|
-
return crctable[(pCrc32 ^ bval) & 255] ^ pCrc32 >>> 8;
|
|
14012
|
-
};
|
|
14013
|
-
var genSalt = () => {
|
|
14014
|
-
if (typeof randomFillSync === "function") {
|
|
14015
|
-
return randomFillSync(Buffer.alloc(12));
|
|
14016
|
-
} else {
|
|
14017
|
-
return genSalt.node();
|
|
14018
|
-
}
|
|
14019
|
-
};
|
|
14020
|
-
genSalt.node = () => {
|
|
14021
|
-
const salt = Buffer.alloc(12);
|
|
14022
|
-
const len = salt.length;
|
|
14023
|
-
for (let i = 0;i < len; i++)
|
|
14024
|
-
salt[i] = Math.random() * 256 & 255;
|
|
14025
|
-
return salt;
|
|
14026
|
-
};
|
|
14027
|
-
var config = {
|
|
14028
|
-
genSalt
|
|
14029
|
-
};
|
|
14030
|
-
function Initkeys(pw) {
|
|
14031
|
-
const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);
|
|
14032
|
-
this.keys = new Uint32Array([305419896, 591751049, 878082192]);
|
|
14033
|
-
for (let i = 0;i < pass.length; i++) {
|
|
14034
|
-
this.updateKeys(pass[i]);
|
|
14035
|
-
}
|
|
14036
|
-
}
|
|
14037
|
-
Initkeys.prototype.updateKeys = function(byteValue) {
|
|
14038
|
-
const keys = this.keys;
|
|
14039
|
-
keys[0] = crc32update(keys[0], byteValue);
|
|
14040
|
-
keys[1] += keys[0] & 255;
|
|
14041
|
-
keys[1] = uMul(keys[1], 134775813) + 1;
|
|
14042
|
-
keys[2] = crc32update(keys[2], keys[1] >>> 24);
|
|
14043
|
-
return byteValue;
|
|
14044
|
-
};
|
|
14045
|
-
Initkeys.prototype.next = function() {
|
|
14046
|
-
const k = (this.keys[2] | 2) >>> 0;
|
|
14047
|
-
return uMul(k, k ^ 1) >> 8 & 255;
|
|
14048
|
-
};
|
|
14049
|
-
function make_decrypter(pwd) {
|
|
14050
|
-
const keys = new Initkeys(pwd);
|
|
14051
|
-
return function(data) {
|
|
14052
|
-
const result = Buffer.alloc(data.length);
|
|
14053
|
-
let pos = 0;
|
|
14054
|
-
for (let c of data) {
|
|
14055
|
-
result[pos++] = keys.updateKeys(c ^ keys.next());
|
|
14056
|
-
}
|
|
14057
|
-
return result;
|
|
14058
|
-
};
|
|
14059
|
-
}
|
|
14060
|
-
function make_encrypter(pwd) {
|
|
14061
|
-
const keys = new Initkeys(pwd);
|
|
14062
|
-
return function(data, result, pos = 0) {
|
|
14063
|
-
if (!result)
|
|
14064
|
-
result = Buffer.alloc(data.length);
|
|
14065
|
-
for (let c of data) {
|
|
14066
|
-
const k = keys.next();
|
|
14067
|
-
result[pos++] = c ^ k;
|
|
14068
|
-
keys.updateKeys(c);
|
|
14069
|
-
}
|
|
14070
|
-
return result;
|
|
14071
|
-
};
|
|
14072
|
-
}
|
|
14073
|
-
function decrypt(data, header, pwd) {
|
|
14074
|
-
if (!data || !Buffer.isBuffer(data) || data.length < 12) {
|
|
14075
|
-
return Buffer.alloc(0);
|
|
14076
|
-
}
|
|
14077
|
-
const decrypter = make_decrypter(pwd);
|
|
14078
|
-
const salt = decrypter(data.slice(0, 12));
|
|
14079
|
-
const verifyByte = (header.flags & 8) === 8 ? header.timeHighByte : header.crc >>> 24;
|
|
14080
|
-
if (salt[11] !== verifyByte) {
|
|
14081
|
-
throw Errors.WRONG_PASSWORD();
|
|
14082
|
-
}
|
|
14083
|
-
return decrypter(data.slice(12));
|
|
14084
|
-
}
|
|
14085
|
-
function _salter(data) {
|
|
14086
|
-
if (Buffer.isBuffer(data) && data.length >= 12) {
|
|
14087
|
-
config.genSalt = function() {
|
|
14088
|
-
return data.slice(0, 12);
|
|
14089
|
-
};
|
|
14090
|
-
} else if (data === "node") {
|
|
14091
|
-
config.genSalt = genSalt.node;
|
|
14092
|
-
} else {
|
|
14093
|
-
config.genSalt = genSalt;
|
|
14094
|
-
}
|
|
14095
|
-
}
|
|
14096
|
-
function encrypt(data, header, pwd, oldlike = false) {
|
|
14097
|
-
if (data == null)
|
|
14098
|
-
data = Buffer.alloc(0);
|
|
14099
|
-
if (!Buffer.isBuffer(data))
|
|
14100
|
-
data = Buffer.from(data.toString());
|
|
14101
|
-
const encrypter = make_encrypter(pwd);
|
|
14102
|
-
const salt = config.genSalt();
|
|
14103
|
-
salt[11] = header.crc >>> 24 & 255;
|
|
14104
|
-
if (oldlike)
|
|
14105
|
-
salt[10] = header.crc >>> 16 & 255;
|
|
14106
|
-
const result = Buffer.alloc(data.length + 12);
|
|
14107
|
-
encrypter(salt, result);
|
|
14108
|
-
return encrypter(data, result, 12);
|
|
14109
|
-
}
|
|
14110
|
-
module.exports = { decrypt, encrypt, _salter };
|
|
14111
|
-
});
|
|
14112
|
-
|
|
14113
|
-
// ../../../node_modules/adm-zip/methods/index.js
|
|
14114
|
-
var require_methods = __commonJS(function(exports) {
|
|
14115
|
-
exports.Deflater = require_deflater();
|
|
14116
|
-
exports.Inflater = require_inflater();
|
|
14117
|
-
exports.ZipCrypto = require_zipcrypto();
|
|
14118
|
-
});
|
|
14119
|
-
|
|
14120
|
-
// ../../../node_modules/adm-zip/zipEntry.js
|
|
14121
|
-
var require_zipEntry = __commonJS(function(exports, module) {
|
|
14122
|
-
var Utils = require_util();
|
|
14123
|
-
var Headers2 = require_headers();
|
|
14124
|
-
var Constants = Utils.Constants;
|
|
14125
|
-
var Methods = require_methods();
|
|
14126
|
-
module.exports = function(options, input) {
|
|
14127
|
-
var _centralHeader = new Headers2.EntryHeader, _entryName = Buffer.alloc(0), _comment = Buffer.alloc(0), _isDirectory = false, uncompressedData = null, _extra = Buffer.alloc(0), _extralocal = Buffer.alloc(0), _efs = true;
|
|
14128
|
-
const opts = options;
|
|
14129
|
-
const decoder = typeof opts.decoder === "object" ? opts.decoder : Utils.decoder;
|
|
14130
|
-
_efs = decoder.hasOwnProperty("efs") ? decoder.efs : false;
|
|
14131
|
-
function getCompressedDataFromZip() {
|
|
14132
|
-
if (!input || !(input instanceof Uint8Array)) {
|
|
14133
|
-
return Buffer.alloc(0);
|
|
14134
|
-
}
|
|
14135
|
-
_extralocal = _centralHeader.loadLocalHeaderFromBinary(input);
|
|
14136
|
-
const dataOffset = _centralHeader.realDataOffset;
|
|
14137
|
-
const dataEnd = dataOffset + _centralHeader.compressedSize;
|
|
14138
|
-
if (dataOffset < 0 || dataEnd < dataOffset || dataEnd > input.length) {
|
|
14139
|
-
throw Utils.Errors.INVALID_LOC();
|
|
14140
|
-
}
|
|
14141
|
-
return input.slice(dataOffset, dataEnd);
|
|
14142
|
-
}
|
|
14143
|
-
function crc32OK(data) {
|
|
14144
|
-
const expectedCrc = _centralHeader.flags_desc || _centralHeader.localHeader.flags_desc ? _centralHeader.crc : _centralHeader.localHeader.crc;
|
|
14145
|
-
return Utils.crc32(data) === expectedCrc;
|
|
14146
|
-
}
|
|
14147
|
-
function decompress(async, callback, pass) {
|
|
14148
|
-
if (typeof callback === "undefined" && typeof async === "string") {
|
|
14149
|
-
pass = async;
|
|
14150
|
-
async = undefined;
|
|
14151
|
-
}
|
|
14152
|
-
if (_isDirectory) {
|
|
14153
|
-
if (async && callback) {
|
|
14154
|
-
callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR());
|
|
14155
|
-
}
|
|
14156
|
-
return Buffer.alloc(0);
|
|
14157
|
-
}
|
|
14158
|
-
var compressedData;
|
|
14159
|
-
try {
|
|
14160
|
-
compressedData = getCompressedDataFromZip();
|
|
14161
|
-
if (compressedData.length === 0) {
|
|
14162
|
-
if (async && callback)
|
|
14163
|
-
callback(compressedData);
|
|
14164
|
-
return compressedData;
|
|
14165
|
-
}
|
|
14166
|
-
if (_centralHeader.encrypted) {
|
|
14167
|
-
if (typeof pass !== "string" && !Buffer.isBuffer(pass)) {
|
|
14168
|
-
throw Utils.Errors.INVALID_PASS_PARAM();
|
|
14169
|
-
}
|
|
14170
|
-
compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
|
|
14171
|
-
}
|
|
14172
|
-
} catch (err) {
|
|
14173
|
-
if (async && callback) {
|
|
14174
|
-
callback(Buffer.alloc(0), err);
|
|
14175
|
-
return Buffer.alloc(0);
|
|
14176
|
-
}
|
|
14177
|
-
throw err;
|
|
14178
|
-
}
|
|
14179
|
-
var data;
|
|
14180
|
-
switch (_centralHeader.method) {
|
|
14181
|
-
case Utils.Constants.STORED:
|
|
14182
|
-
data = Buffer.alloc(compressedData.length);
|
|
14183
|
-
compressedData.copy(data);
|
|
14184
|
-
if (!crc32OK(data)) {
|
|
14185
|
-
if (async && callback)
|
|
14186
|
-
callback(data, Utils.Errors.BAD_CRC());
|
|
14187
|
-
throw Utils.Errors.BAD_CRC();
|
|
14188
|
-
} else {
|
|
14189
|
-
if (async && callback)
|
|
14190
|
-
callback(data);
|
|
14191
|
-
return data;
|
|
14192
|
-
}
|
|
14193
|
-
case Utils.Constants.DEFLATED:
|
|
14194
|
-
var inflater = new Methods.Inflater(compressedData, _centralHeader.size);
|
|
14195
|
-
if (!async) {
|
|
14196
|
-
data = inflater.inflate();
|
|
14197
|
-
if (!crc32OK(data)) {
|
|
14198
|
-
throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`);
|
|
14199
|
-
}
|
|
14200
|
-
return data;
|
|
14201
|
-
} else {
|
|
14202
|
-
inflater.inflateAsync(function(result, err) {
|
|
14203
|
-
if (!callback)
|
|
14204
|
-
return;
|
|
14205
|
-
if (err) {
|
|
14206
|
-
callback(Buffer.alloc(0), err);
|
|
14207
|
-
} else if (!crc32OK(result)) {
|
|
14208
|
-
callback(result, Utils.Errors.BAD_CRC());
|
|
14209
|
-
} else {
|
|
14210
|
-
callback(result);
|
|
14211
|
-
}
|
|
14212
|
-
});
|
|
14213
|
-
}
|
|
14214
|
-
break;
|
|
14215
|
-
default:
|
|
14216
|
-
if (async && callback)
|
|
14217
|
-
callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD());
|
|
14218
|
-
throw Utils.Errors.UNKNOWN_METHOD();
|
|
14219
|
-
}
|
|
14220
|
-
}
|
|
14221
|
-
function compress(async, callback) {
|
|
14222
|
-
if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {
|
|
14223
|
-
if (async && callback)
|
|
14224
|
-
callback(getCompressedDataFromZip());
|
|
14225
|
-
return getCompressedDataFromZip();
|
|
14226
|
-
}
|
|
14227
|
-
if (uncompressedData.length && !_isDirectory) {
|
|
14228
|
-
var compressedData;
|
|
14229
|
-
switch (_centralHeader.method) {
|
|
14230
|
-
case Utils.Constants.STORED:
|
|
14231
|
-
_centralHeader.compressedSize = _centralHeader.size;
|
|
14232
|
-
compressedData = Buffer.alloc(uncompressedData.length);
|
|
14233
|
-
uncompressedData.copy(compressedData);
|
|
14234
|
-
if (async && callback)
|
|
14235
|
-
callback(compressedData);
|
|
14236
|
-
return compressedData;
|
|
14237
|
-
default:
|
|
14238
|
-
case Utils.Constants.DEFLATED:
|
|
14239
|
-
var deflater = new Methods.Deflater(uncompressedData);
|
|
14240
|
-
if (!async) {
|
|
14241
|
-
var deflated = deflater.deflate();
|
|
14242
|
-
_centralHeader.compressedSize = deflated.length;
|
|
14243
|
-
return deflated;
|
|
14244
|
-
} else {
|
|
14245
|
-
deflater.deflateAsync(function(data) {
|
|
14246
|
-
compressedData = Buffer.alloc(data.length);
|
|
14247
|
-
_centralHeader.compressedSize = data.length;
|
|
14248
|
-
data.copy(compressedData);
|
|
14249
|
-
callback && callback(compressedData);
|
|
14250
|
-
});
|
|
14251
|
-
}
|
|
14252
|
-
deflater = null;
|
|
14253
|
-
break;
|
|
14254
|
-
}
|
|
14255
|
-
} else if (async && callback) {
|
|
14256
|
-
callback(Buffer.alloc(0));
|
|
14257
|
-
} else {
|
|
14258
|
-
return Buffer.alloc(0);
|
|
14259
|
-
}
|
|
14260
|
-
}
|
|
14261
|
-
function readUInt64LE(buffer, offset) {
|
|
14262
|
-
return Utils.readBigUInt64LE(buffer, offset);
|
|
14263
|
-
}
|
|
14264
|
-
function parseExtra(data) {
|
|
14265
|
-
try {
|
|
14266
|
-
var offset = 0;
|
|
14267
|
-
var signature, size, part;
|
|
14268
|
-
while (offset + 4 < data.length) {
|
|
14269
|
-
signature = data.readUInt16LE(offset);
|
|
14270
|
-
offset += 2;
|
|
14271
|
-
size = data.readUInt16LE(offset);
|
|
14272
|
-
offset += 2;
|
|
14273
|
-
part = data.slice(offset, offset + size);
|
|
14274
|
-
offset += size;
|
|
14275
|
-
if (Constants.ID_ZIP64 === signature) {
|
|
14276
|
-
parseZip64ExtendedInformation(part);
|
|
14277
|
-
}
|
|
14278
|
-
}
|
|
14279
|
-
} catch (error) {
|
|
14280
|
-
throw Utils.Errors.EXTRA_FIELD_PARSE_ERROR();
|
|
14281
|
-
}
|
|
14282
|
-
}
|
|
14283
|
-
function parseZip64ExtendedInformation(data) {
|
|
14284
|
-
var size, compressedSize, offset, diskNumStart;
|
|
14285
|
-
if (data.length >= Constants.EF_ZIP64_SCOMP) {
|
|
14286
|
-
size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);
|
|
14287
|
-
if (_centralHeader.size === Constants.EF_ZIP64_OR_32) {
|
|
14288
|
-
_centralHeader.size = size;
|
|
14289
|
-
}
|
|
14290
|
-
}
|
|
14291
|
-
if (data.length >= Constants.EF_ZIP64_RHO) {
|
|
14292
|
-
compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);
|
|
14293
|
-
if (_centralHeader.compressedSize === Constants.EF_ZIP64_OR_32) {
|
|
14294
|
-
_centralHeader.compressedSize = compressedSize;
|
|
14295
|
-
}
|
|
14296
|
-
}
|
|
14297
|
-
if (data.length >= Constants.EF_ZIP64_DSN) {
|
|
14298
|
-
offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);
|
|
14299
|
-
if (_centralHeader.offset === Constants.EF_ZIP64_OR_32) {
|
|
14300
|
-
_centralHeader.offset = offset;
|
|
14301
|
-
}
|
|
14302
|
-
}
|
|
14303
|
-
if (data.length >= Constants.EF_ZIP64_DSN + 4) {
|
|
14304
|
-
diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);
|
|
14305
|
-
if (_centralHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {
|
|
14306
|
-
_centralHeader.diskNumStart = diskNumStart;
|
|
14307
|
-
}
|
|
14308
|
-
}
|
|
14309
|
-
}
|
|
14310
|
-
return {
|
|
14311
|
-
get entryName() {
|
|
14312
|
-
return decoder.decode(_entryName);
|
|
14313
|
-
},
|
|
14314
|
-
get rawEntryName() {
|
|
14315
|
-
return _entryName;
|
|
14316
|
-
},
|
|
14317
|
-
set entryName(val) {
|
|
14318
|
-
_entryName = Utils.toBuffer(val, decoder.encode);
|
|
14319
|
-
var lastChar = _entryName[_entryName.length - 1];
|
|
14320
|
-
_isDirectory = lastChar === 47 || lastChar === 92;
|
|
14321
|
-
_centralHeader.fileNameLength = _entryName.length;
|
|
14322
|
-
},
|
|
14323
|
-
get efs() {
|
|
14324
|
-
if (typeof _efs === "function") {
|
|
14325
|
-
return _efs(this.entryName);
|
|
14326
|
-
} else {
|
|
14327
|
-
return _efs;
|
|
14328
|
-
}
|
|
14329
|
-
},
|
|
14330
|
-
get extra() {
|
|
14331
|
-
return _extra;
|
|
14332
|
-
},
|
|
14333
|
-
set extra(val) {
|
|
14334
|
-
_extra = val;
|
|
14335
|
-
_centralHeader.extraLength = val.length;
|
|
14336
|
-
parseExtra(val);
|
|
14337
|
-
},
|
|
14338
|
-
get comment() {
|
|
14339
|
-
return decoder.decode(_comment);
|
|
14340
|
-
},
|
|
14341
|
-
set comment(val) {
|
|
14342
|
-
_comment = Utils.toBuffer(val, decoder.encode);
|
|
14343
|
-
_centralHeader.commentLength = _comment.length;
|
|
14344
|
-
if (_comment.length > 65535)
|
|
14345
|
-
throw Utils.Errors.COMMENT_TOO_LONG();
|
|
14346
|
-
},
|
|
14347
|
-
get name() {
|
|
14348
|
-
const n = decoder.decode(_entryName);
|
|
14349
|
-
return _isDirectory ? n.replace(/[/\\]$/, "").split("/").pop() : n.split("/").pop();
|
|
14350
|
-
},
|
|
14351
|
-
get isDirectory() {
|
|
14352
|
-
return _isDirectory;
|
|
14353
|
-
},
|
|
14354
|
-
getCompressedData: function() {
|
|
14355
|
-
return compress(false, null);
|
|
14356
|
-
},
|
|
14357
|
-
getCompressedDataAsync: function(callback) {
|
|
14358
|
-
compress(true, callback);
|
|
14359
|
-
},
|
|
14360
|
-
setData: function(value) {
|
|
14361
|
-
uncompressedData = Utils.toBuffer(value, Utils.decoder.encode);
|
|
14362
|
-
if (!_isDirectory && uncompressedData.length) {
|
|
14363
|
-
_centralHeader.size = uncompressedData.length;
|
|
14364
|
-
_centralHeader.method = Utils.Constants.DEFLATED;
|
|
14365
|
-
_centralHeader.crc = Utils.crc32(value);
|
|
14366
|
-
_centralHeader.changed = true;
|
|
14367
|
-
} else {
|
|
14368
|
-
_centralHeader.method = Utils.Constants.STORED;
|
|
14369
|
-
}
|
|
14370
|
-
},
|
|
14371
|
-
getData: function(pass) {
|
|
14372
|
-
if (_centralHeader.changed) {
|
|
14373
|
-
return uncompressedData;
|
|
14374
|
-
} else {
|
|
14375
|
-
return decompress(false, null, pass);
|
|
14376
|
-
}
|
|
14377
|
-
},
|
|
14378
|
-
getDataAsync: function(callback, pass) {
|
|
14379
|
-
if (_centralHeader.changed) {
|
|
14380
|
-
callback(uncompressedData);
|
|
14381
|
-
} else {
|
|
14382
|
-
decompress(true, callback, pass);
|
|
14383
|
-
}
|
|
14384
|
-
},
|
|
14385
|
-
set attr(attr) {
|
|
14386
|
-
_centralHeader.attr = attr;
|
|
14387
|
-
},
|
|
14388
|
-
get attr() {
|
|
14389
|
-
return _centralHeader.attr;
|
|
14390
|
-
},
|
|
14391
|
-
set header(data) {
|
|
14392
|
-
_centralHeader.loadFromBinary(data);
|
|
14393
|
-
},
|
|
14394
|
-
get header() {
|
|
14395
|
-
return _centralHeader;
|
|
14396
|
-
},
|
|
14397
|
-
packCentralHeader: function() {
|
|
14398
|
-
_centralHeader.flags_efs = this.efs;
|
|
14399
|
-
_centralHeader.extraLength = _extra.length;
|
|
14400
|
-
var header = _centralHeader.centralHeaderToBinary();
|
|
14401
|
-
var addpos = Utils.Constants.CENHDR;
|
|
14402
|
-
_entryName.copy(header, addpos);
|
|
14403
|
-
addpos += _entryName.length;
|
|
14404
|
-
_extra.copy(header, addpos);
|
|
14405
|
-
addpos += _centralHeader.extraLength;
|
|
14406
|
-
_comment.copy(header, addpos);
|
|
14407
|
-
return header;
|
|
14408
|
-
},
|
|
14409
|
-
packLocalHeader: function() {
|
|
14410
|
-
let addpos = 0;
|
|
14411
|
-
_centralHeader.flags_efs = this.efs;
|
|
14412
|
-
_centralHeader.extraLocalLength = _extralocal.length;
|
|
14413
|
-
const localHeaderBuf = _centralHeader.localHeaderToBinary();
|
|
14414
|
-
const localHeader = Buffer.alloc(localHeaderBuf.length + _entryName.length + _centralHeader.extraLocalLength);
|
|
14415
|
-
localHeaderBuf.copy(localHeader, addpos);
|
|
14416
|
-
addpos += localHeaderBuf.length;
|
|
14417
|
-
_entryName.copy(localHeader, addpos);
|
|
14418
|
-
addpos += _entryName.length;
|
|
14419
|
-
_extralocal.copy(localHeader, addpos);
|
|
14420
|
-
addpos += _extralocal.length;
|
|
14421
|
-
return localHeader;
|
|
14422
|
-
},
|
|
14423
|
-
toJSON: function() {
|
|
14424
|
-
const bytes = function(nr) {
|
|
14425
|
-
return "<" + (nr && nr.length + " bytes buffer" || "null") + ">";
|
|
14426
|
-
};
|
|
14427
|
-
return {
|
|
14428
|
-
entryName: this.entryName,
|
|
14429
|
-
name: this.name,
|
|
14430
|
-
comment: this.comment,
|
|
14431
|
-
isDirectory: this.isDirectory,
|
|
14432
|
-
header: _centralHeader.toJSON(),
|
|
14433
|
-
compressedData: bytes(input),
|
|
14434
|
-
data: bytes(uncompressedData)
|
|
14435
|
-
};
|
|
14436
|
-
},
|
|
14437
|
-
toString: function() {
|
|
14438
|
-
return JSON.stringify(this.toJSON(), null, "\t");
|
|
14439
|
-
}
|
|
14440
|
-
};
|
|
14441
|
-
};
|
|
14442
|
-
});
|
|
14443
|
-
|
|
14444
|
-
// ../../../node_modules/adm-zip/zipFile.js
|
|
14445
|
-
var require_zipFile = __commonJS(function(exports, module) {
|
|
14446
|
-
var ZipEntry = require_zipEntry();
|
|
14447
|
-
var Headers2 = require_headers();
|
|
14448
|
-
var Utils = require_util();
|
|
14449
|
-
module.exports = function(inBuffer, options) {
|
|
14450
|
-
var entryList = [], entryTable = Object.create(null), _comment = Buffer.alloc(0), mainHeader = new Headers2.MainHeader, loadedEntries = false;
|
|
14451
|
-
var password = null;
|
|
14452
|
-
const temporary = new Set;
|
|
14453
|
-
const opts = options;
|
|
14454
|
-
const { noSort, decoder } = opts;
|
|
14455
|
-
if (inBuffer) {
|
|
14456
|
-
readMainHeader(opts.readEntries);
|
|
14457
|
-
} else {
|
|
14458
|
-
loadedEntries = true;
|
|
14459
|
-
}
|
|
14460
|
-
function makeTemporaryFolders() {
|
|
14461
|
-
const foldersList = new Set;
|
|
14462
|
-
for (const elem of Object.keys(entryTable)) {
|
|
14463
|
-
const elements = elem.split("/");
|
|
14464
|
-
elements.pop();
|
|
14465
|
-
if (!elements.length)
|
|
14466
|
-
continue;
|
|
14467
|
-
for (let i = 0;i < elements.length; i++) {
|
|
14468
|
-
const sub = elements.slice(0, i + 1).join("/") + "/";
|
|
14469
|
-
foldersList.add(sub);
|
|
14470
|
-
}
|
|
14471
|
-
}
|
|
14472
|
-
for (const elem of foldersList) {
|
|
14473
|
-
if (!(elem in entryTable)) {
|
|
14474
|
-
const tempfolder = new ZipEntry(opts);
|
|
14475
|
-
tempfolder.entryName = elem;
|
|
14476
|
-
tempfolder.attr = 16;
|
|
14477
|
-
tempfolder.temporary = true;
|
|
14478
|
-
entryList.push(tempfolder);
|
|
14479
|
-
entryTable[tempfolder.entryName] = tempfolder;
|
|
14480
|
-
temporary.add(tempfolder);
|
|
14481
|
-
}
|
|
14482
|
-
}
|
|
14483
|
-
}
|
|
14484
|
-
function readEntries() {
|
|
14485
|
-
loadedEntries = true;
|
|
14486
|
-
entryTable = Object.create(null);
|
|
14487
|
-
if (mainHeader.diskEntries > (inBuffer.length - mainHeader.offset) / Utils.Constants.CENHDR) {
|
|
14488
|
-
throw Utils.Errors.DISK_ENTRY_TOO_LARGE();
|
|
14489
|
-
}
|
|
14490
|
-
entryList = new Array(mainHeader.diskEntries);
|
|
14491
|
-
var index = mainHeader.offset;
|
|
14492
|
-
for (var i = 0;i < entryList.length; i++) {
|
|
14493
|
-
var tmp = index, entry = new ZipEntry(opts, inBuffer);
|
|
14494
|
-
entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR);
|
|
14495
|
-
entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength);
|
|
14496
|
-
if (entry.header.extraLength) {
|
|
14497
|
-
entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength);
|
|
14498
|
-
}
|
|
14499
|
-
if (entry.header.commentLength)
|
|
14500
|
-
entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);
|
|
14501
|
-
index += entry.header.centralHeaderSize;
|
|
14502
|
-
if (entry.entryName in entryTable) {
|
|
14503
|
-
throw Utils.Errors.DUPLICATE_ENTRY(`"${entry.entryName}"`);
|
|
14504
|
-
}
|
|
14505
|
-
entryList[i] = entry;
|
|
14506
|
-
entryTable[entry.entryName] = entry;
|
|
14507
|
-
}
|
|
14508
|
-
temporary.clear();
|
|
14509
|
-
makeTemporaryFolders();
|
|
14510
|
-
}
|
|
14511
|
-
function readMainHeader(readNow) {
|
|
14512
|
-
var i = inBuffer.length - Utils.Constants.ENDHDR, max = Math.max(0, i - 65535), n = max, endStart = inBuffer.length, endOffset = -1, commentEnd = 0;
|
|
14513
|
-
const trailingSpace = typeof opts.trailingSpace === "boolean" ? opts.trailingSpace : false;
|
|
14514
|
-
if (trailingSpace)
|
|
14515
|
-
max = 0;
|
|
14516
|
-
for (i;i >= n; i--) {
|
|
14517
|
-
if (inBuffer[i] !== 80)
|
|
14518
|
-
continue;
|
|
14519
|
-
if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) {
|
|
14520
|
-
endOffset = i;
|
|
14521
|
-
commentEnd = i;
|
|
14522
|
-
endStart = i + Utils.Constants.ENDHDR;
|
|
14523
|
-
n = i - Utils.Constants.END64HDR;
|
|
14524
|
-
continue;
|
|
14525
|
-
}
|
|
14526
|
-
if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) {
|
|
14527
|
-
n = max;
|
|
14528
|
-
continue;
|
|
14529
|
-
}
|
|
14530
|
-
if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) {
|
|
14531
|
-
endOffset = i;
|
|
14532
|
-
endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD;
|
|
14533
|
-
break;
|
|
14534
|
-
}
|
|
14535
|
-
}
|
|
14536
|
-
if (endOffset == -1)
|
|
14537
|
-
throw Utils.Errors.INVALID_FORMAT();
|
|
14538
|
-
mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart));
|
|
14539
|
-
if (mainHeader.commentLength) {
|
|
14540
|
-
_comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR);
|
|
14541
|
-
}
|
|
14542
|
-
if (readNow)
|
|
14543
|
-
readEntries();
|
|
14544
|
-
}
|
|
14545
|
-
function sortEntries() {
|
|
14546
|
-
if (entryList.length > 1 && !noSort) {
|
|
14547
|
-
entryList = entryList.map((entry) => ({ entry, key: entry.entryName.toLowerCase() })).sort((a, b) => a.key.localeCompare(b.key)).map((pair) => pair.entry);
|
|
14548
|
-
}
|
|
14549
|
-
}
|
|
14550
|
-
return {
|
|
14551
|
-
get entries() {
|
|
14552
|
-
if (!loadedEntries) {
|
|
14553
|
-
readEntries();
|
|
14554
|
-
}
|
|
14555
|
-
return entryList.filter((e) => !temporary.has(e));
|
|
14556
|
-
},
|
|
14557
|
-
get comment() {
|
|
14558
|
-
return decoder.decode(_comment);
|
|
14559
|
-
},
|
|
14560
|
-
set comment(val) {
|
|
14561
|
-
_comment = Utils.toBuffer(val, decoder.encode);
|
|
14562
|
-
mainHeader.commentLength = _comment.length;
|
|
14563
|
-
},
|
|
14564
|
-
getEntryCount: function() {
|
|
14565
|
-
if (!loadedEntries) {
|
|
14566
|
-
return mainHeader.diskEntries;
|
|
14567
|
-
}
|
|
14568
|
-
return entryList.length;
|
|
14569
|
-
},
|
|
14570
|
-
forEach: function(callback) {
|
|
14571
|
-
this.entries.forEach(callback);
|
|
14572
|
-
},
|
|
14573
|
-
getEntry: function(entryName) {
|
|
14574
|
-
if (!loadedEntries) {
|
|
14575
|
-
readEntries();
|
|
14576
|
-
}
|
|
14577
|
-
return entryTable[entryName] || null;
|
|
14578
|
-
},
|
|
14579
|
-
setEntry: function(entry) {
|
|
14580
|
-
if (!loadedEntries) {
|
|
14581
|
-
readEntries();
|
|
14582
|
-
}
|
|
14583
|
-
entryList.push(entry);
|
|
14584
|
-
entryTable[entry.entryName] = entry;
|
|
14585
|
-
mainHeader.totalEntries = entryList.length;
|
|
14586
|
-
},
|
|
14587
|
-
deleteFile: function(entryName, withsubfolders = true) {
|
|
14588
|
-
if (!loadedEntries) {
|
|
14589
|
-
readEntries();
|
|
14590
|
-
}
|
|
14591
|
-
const entry = entryTable[entryName];
|
|
14592
|
-
const list = this.getEntryChildren(entry, withsubfolders).map((child) => child.entryName);
|
|
14593
|
-
list.forEach(this.deleteEntry);
|
|
14594
|
-
},
|
|
14595
|
-
deleteEntry: function(entryName) {
|
|
14596
|
-
if (!loadedEntries) {
|
|
14597
|
-
readEntries();
|
|
14598
|
-
}
|
|
14599
|
-
const entry = entryTable[entryName];
|
|
14600
|
-
const index = entryList.indexOf(entry);
|
|
14601
|
-
if (index >= 0) {
|
|
14602
|
-
entryList.splice(index, 1);
|
|
14603
|
-
delete entryTable[entryName];
|
|
14604
|
-
mainHeader.totalEntries = entryList.length;
|
|
14605
|
-
}
|
|
14606
|
-
},
|
|
14607
|
-
getEntryChildren: function(entry, subfolders = true) {
|
|
14608
|
-
if (!loadedEntries) {
|
|
14609
|
-
readEntries();
|
|
14610
|
-
}
|
|
14611
|
-
if (typeof entry === "object") {
|
|
14612
|
-
if (entry.isDirectory && subfolders) {
|
|
14613
|
-
const list = [];
|
|
14614
|
-
const name = entry.entryName;
|
|
14615
|
-
for (const zipEntry of entryList) {
|
|
14616
|
-
if (zipEntry.entryName.startsWith(name)) {
|
|
14617
|
-
list.push(zipEntry);
|
|
14618
|
-
}
|
|
14619
|
-
}
|
|
14620
|
-
return list;
|
|
14621
|
-
} else {
|
|
14622
|
-
return [entry];
|
|
14623
|
-
}
|
|
14624
|
-
}
|
|
14625
|
-
return [];
|
|
14626
|
-
},
|
|
14627
|
-
getChildCount: function(entry) {
|
|
14628
|
-
if (entry && entry.isDirectory) {
|
|
14629
|
-
const list = this.getEntryChildren(entry);
|
|
14630
|
-
return list.includes(entry) ? list.length - 1 : list.length;
|
|
14631
|
-
}
|
|
14632
|
-
return 0;
|
|
14633
|
-
},
|
|
14634
|
-
compressToBuffer: function() {
|
|
14635
|
-
if (!loadedEntries) {
|
|
14636
|
-
readEntries();
|
|
14637
|
-
}
|
|
14638
|
-
sortEntries();
|
|
14639
|
-
const dataBlock = [];
|
|
14640
|
-
const headerBlocks = [];
|
|
14641
|
-
let totalSize = 0;
|
|
14642
|
-
let dindex = 0;
|
|
14643
|
-
mainHeader.size = 0;
|
|
14644
|
-
mainHeader.offset = 0;
|
|
14645
|
-
let totalEntries = 0;
|
|
14646
|
-
for (const entry of this.entries) {
|
|
14647
|
-
const compressedData = entry.getCompressedData();
|
|
14648
|
-
entry.header.offset = dindex;
|
|
14649
|
-
const localHeader = entry.packLocalHeader();
|
|
14650
|
-
const dataLength = localHeader.length + compressedData.length;
|
|
14651
|
-
dindex += dataLength;
|
|
14652
|
-
dataBlock.push(localHeader);
|
|
14653
|
-
dataBlock.push(compressedData);
|
|
14654
|
-
const centralHeader = entry.packCentralHeader();
|
|
14655
|
-
headerBlocks.push(centralHeader);
|
|
14656
|
-
mainHeader.size += centralHeader.length;
|
|
14657
|
-
totalSize += dataLength + centralHeader.length;
|
|
14658
|
-
totalEntries++;
|
|
14659
|
-
}
|
|
14660
|
-
totalSize += mainHeader.mainHeaderSize;
|
|
14661
|
-
mainHeader.offset = dindex;
|
|
14662
|
-
mainHeader.totalEntries = totalEntries;
|
|
14663
|
-
dindex = 0;
|
|
14664
|
-
const outBuffer = Buffer.alloc(totalSize);
|
|
14665
|
-
for (const content of dataBlock) {
|
|
14666
|
-
content.copy(outBuffer, dindex);
|
|
14667
|
-
dindex += content.length;
|
|
14668
|
-
}
|
|
14669
|
-
for (const content of headerBlocks) {
|
|
14670
|
-
content.copy(outBuffer, dindex);
|
|
14671
|
-
dindex += content.length;
|
|
14672
|
-
}
|
|
14673
|
-
const mh = mainHeader.toBinary();
|
|
14674
|
-
if (_comment) {
|
|
14675
|
-
_comment.copy(mh, mh.length - _comment.length);
|
|
14676
|
-
}
|
|
14677
|
-
mh.copy(outBuffer, dindex);
|
|
14678
|
-
inBuffer = outBuffer;
|
|
14679
|
-
loadedEntries = false;
|
|
14680
|
-
return outBuffer;
|
|
14681
|
-
},
|
|
14682
|
-
toAsyncBuffer: function(onSuccess, onFail, onItemStart, onItemEnd) {
|
|
14683
|
-
try {
|
|
14684
|
-
if (!loadedEntries) {
|
|
14685
|
-
readEntries();
|
|
14686
|
-
}
|
|
14687
|
-
sortEntries();
|
|
14688
|
-
const dataBlock = [];
|
|
14689
|
-
const centralHeaders = [];
|
|
14690
|
-
let totalSize = 0;
|
|
14691
|
-
let dindex = 0;
|
|
14692
|
-
let totalEntries = 0;
|
|
14693
|
-
mainHeader.size = 0;
|
|
14694
|
-
mainHeader.offset = 0;
|
|
14695
|
-
const compress2Buffer = function(entryLists) {
|
|
14696
|
-
if (entryLists.length > 0) {
|
|
14697
|
-
const entry = entryLists.shift();
|
|
14698
|
-
const name = entry.entryName + entry.extra.toString();
|
|
14699
|
-
if (onItemStart)
|
|
14700
|
-
onItemStart(name);
|
|
14701
|
-
entry.getCompressedDataAsync(function(compressedData) {
|
|
14702
|
-
if (onItemEnd)
|
|
14703
|
-
onItemEnd(name);
|
|
14704
|
-
entry.header.offset = dindex;
|
|
14705
|
-
const localHeader = entry.packLocalHeader();
|
|
14706
|
-
const dataLength = localHeader.length + compressedData.length;
|
|
14707
|
-
dindex += dataLength;
|
|
14708
|
-
dataBlock.push(localHeader);
|
|
14709
|
-
dataBlock.push(compressedData);
|
|
14710
|
-
const centalHeader = entry.packCentralHeader();
|
|
14711
|
-
centralHeaders.push(centalHeader);
|
|
14712
|
-
mainHeader.size += centalHeader.length;
|
|
14713
|
-
totalSize += dataLength + centalHeader.length;
|
|
14714
|
-
totalEntries++;
|
|
14715
|
-
compress2Buffer(entryLists);
|
|
14716
|
-
});
|
|
14717
|
-
} else {
|
|
14718
|
-
totalSize += mainHeader.mainHeaderSize;
|
|
14719
|
-
mainHeader.offset = dindex;
|
|
14720
|
-
mainHeader.totalEntries = totalEntries;
|
|
14721
|
-
dindex = 0;
|
|
14722
|
-
const outBuffer = Buffer.alloc(totalSize);
|
|
14723
|
-
dataBlock.forEach(function(content) {
|
|
14724
|
-
content.copy(outBuffer, dindex);
|
|
14725
|
-
dindex += content.length;
|
|
14726
|
-
});
|
|
14727
|
-
centralHeaders.forEach(function(content) {
|
|
14728
|
-
content.copy(outBuffer, dindex);
|
|
14729
|
-
dindex += content.length;
|
|
14730
|
-
});
|
|
14731
|
-
const mh = mainHeader.toBinary();
|
|
14732
|
-
if (_comment) {
|
|
14733
|
-
_comment.copy(mh, mh.length - _comment.length);
|
|
14734
|
-
}
|
|
14735
|
-
mh.copy(outBuffer, dindex);
|
|
14736
|
-
inBuffer = outBuffer;
|
|
14737
|
-
loadedEntries = false;
|
|
14738
|
-
onSuccess(outBuffer);
|
|
14739
|
-
}
|
|
14740
|
-
};
|
|
14741
|
-
compress2Buffer(Array.from(this.entries));
|
|
14742
|
-
} catch (e) {
|
|
14743
|
-
onFail(e);
|
|
14744
|
-
}
|
|
14745
|
-
}
|
|
14746
|
-
};
|
|
14747
|
-
};
|
|
14748
|
-
});
|
|
14749
|
-
|
|
14750
|
-
// ../../../node_modules/adm-zip/adm-zip.js
|
|
14751
|
-
var require_adm_zip = __commonJS(function(exports, module) {
|
|
14752
|
-
var Utils = require_util();
|
|
14753
|
-
var pth = __require("path");
|
|
14754
|
-
var ZipEntry = require_zipEntry();
|
|
14755
|
-
var ZipFile = require_zipFile();
|
|
14756
|
-
var get_Bool = (...val) => Utils.findLast(val, (c) => typeof c === "boolean");
|
|
14757
|
-
var get_Str = (...val) => Utils.findLast(val, (c) => typeof c === "string");
|
|
14758
|
-
var get_Fun = (...val) => Utils.findLast(val, (c) => typeof c === "function");
|
|
14759
|
-
var defaultOptions = {
|
|
14760
|
-
noSort: false,
|
|
14761
|
-
readEntries: false,
|
|
14762
|
-
method: Utils.Constants.NONE,
|
|
14763
|
-
fs: null
|
|
14764
|
-
};
|
|
14765
|
-
module.exports = function(input, options) {
|
|
14766
|
-
let inBuffer = null;
|
|
14767
|
-
const opts = Object.assign(Object.create(null), defaultOptions);
|
|
14768
|
-
if (input && typeof input === "object") {
|
|
14769
|
-
if (!(input instanceof Uint8Array)) {
|
|
14770
|
-
Object.assign(opts, input);
|
|
14771
|
-
input = opts.input ? opts.input : undefined;
|
|
14772
|
-
if (opts.input)
|
|
14773
|
-
delete opts.input;
|
|
14774
|
-
}
|
|
14775
|
-
if (Buffer.isBuffer(input)) {
|
|
14776
|
-
inBuffer = input;
|
|
14777
|
-
opts.method = Utils.Constants.BUFFER;
|
|
14778
|
-
input = undefined;
|
|
14779
|
-
}
|
|
14780
|
-
}
|
|
14781
|
-
Object.assign(opts, options);
|
|
14782
|
-
const filetools = new Utils(opts);
|
|
14783
|
-
const applyDirAttributes = (dirEntries) => {
|
|
14784
|
-
dirEntries.filter((d) => d.attr).sort((a, b) => b.path.length - a.path.length).forEach((d) => filetools.fs.chmodSync(d.path, d.attr));
|
|
14785
|
-
};
|
|
14786
|
-
if (typeof opts.decoder !== "object" || typeof opts.decoder.encode !== "function" || typeof opts.decoder.decode !== "function") {
|
|
14787
|
-
opts.decoder = Utils.decoder;
|
|
14788
|
-
}
|
|
14789
|
-
if (input && typeof input === "string") {
|
|
14790
|
-
if (filetools.fs.existsSync(input)) {
|
|
14791
|
-
opts.method = Utils.Constants.FILE;
|
|
14792
|
-
opts.filename = input;
|
|
14793
|
-
inBuffer = filetools.fs.readFileSync(input);
|
|
14794
|
-
} else {
|
|
14795
|
-
throw Utils.Errors.INVALID_FILENAME();
|
|
14796
|
-
}
|
|
14797
|
-
}
|
|
14798
|
-
const _zip = new ZipFile(inBuffer, opts);
|
|
14799
|
-
const { canonical, sanitize, zipnamefix } = Utils;
|
|
14800
|
-
function getEntry(entry) {
|
|
14801
|
-
if (entry && _zip) {
|
|
14802
|
-
var item;
|
|
14803
|
-
if (typeof entry === "string")
|
|
14804
|
-
item = _zip.getEntry(pth.posix.normalize(entry));
|
|
14805
|
-
if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined")
|
|
14806
|
-
item = _zip.getEntry(entry.entryName);
|
|
14807
|
-
if (item) {
|
|
14808
|
-
return item;
|
|
14809
|
-
}
|
|
14810
|
-
}
|
|
14811
|
-
return null;
|
|
14812
|
-
}
|
|
14813
|
-
function fixPath(zipPath) {
|
|
14814
|
-
const { join: join4, normalize, sep } = pth.posix;
|
|
14815
|
-
return join4(pth.isAbsolute(zipPath) ? "/" : ".", normalize(sep + zipPath.split("\\").join(sep) + sep));
|
|
14816
|
-
}
|
|
14817
|
-
function filenameFilter(filterfn) {
|
|
14818
|
-
if (filterfn instanceof RegExp) {
|
|
14819
|
-
return function(rx) {
|
|
14820
|
-
return function(filename) {
|
|
14821
|
-
return rx.test(filename);
|
|
14822
|
-
};
|
|
14823
|
-
}(filterfn);
|
|
14824
|
-
} else if (typeof filterfn !== "function") {
|
|
14825
|
-
return () => true;
|
|
14826
|
-
}
|
|
14827
|
-
return filterfn;
|
|
14828
|
-
}
|
|
14829
|
-
const relativePath = (local, entry) => {
|
|
14830
|
-
let lastChar = entry.slice(-1);
|
|
14831
|
-
lastChar = lastChar === filetools.sep ? filetools.sep : "";
|
|
14832
|
-
return pth.relative(local, entry) + lastChar;
|
|
14833
|
-
};
|
|
14834
|
-
return {
|
|
14835
|
-
readFile: function(entry, pass) {
|
|
14836
|
-
var item = getEntry(entry);
|
|
14837
|
-
return item && item.getData(pass) || null;
|
|
14838
|
-
},
|
|
14839
|
-
childCount: function(entry) {
|
|
14840
|
-
const item = getEntry(entry);
|
|
14841
|
-
if (item) {
|
|
14842
|
-
return _zip.getChildCount(item);
|
|
14843
|
-
}
|
|
14844
|
-
},
|
|
14845
|
-
readFileAsync: function(entry, callback) {
|
|
14846
|
-
var item = getEntry(entry);
|
|
14847
|
-
if (item) {
|
|
14848
|
-
item.getDataAsync(callback);
|
|
14849
|
-
} else {
|
|
14850
|
-
callback(null, "getEntry failed for:" + entry);
|
|
14851
|
-
}
|
|
14852
|
-
},
|
|
14853
|
-
readAsText: function(entry, encoding) {
|
|
14854
|
-
var item = getEntry(entry);
|
|
14855
|
-
if (item) {
|
|
14856
|
-
var data = item.getData();
|
|
14857
|
-
if (data && data.length) {
|
|
14858
|
-
return data.toString(encoding || "utf8");
|
|
14859
|
-
}
|
|
14860
|
-
}
|
|
14861
|
-
return "";
|
|
14862
|
-
},
|
|
14863
|
-
readAsTextAsync: function(entry, callback, encoding) {
|
|
14864
|
-
var item = getEntry(entry);
|
|
14865
|
-
if (item) {
|
|
14866
|
-
item.getDataAsync(function(data, err) {
|
|
14867
|
-
if (err) {
|
|
14868
|
-
callback(data, err);
|
|
14869
|
-
return;
|
|
14870
|
-
}
|
|
14871
|
-
if (data && data.length) {
|
|
14872
|
-
callback(data.toString(encoding || "utf8"));
|
|
14873
|
-
} else {
|
|
14874
|
-
callback("");
|
|
14875
|
-
}
|
|
14876
|
-
});
|
|
14877
|
-
} else {
|
|
14878
|
-
callback("");
|
|
14879
|
-
}
|
|
14880
|
-
},
|
|
14881
|
-
deleteFile: function(entry, withsubfolders = true) {
|
|
14882
|
-
var item = getEntry(entry);
|
|
14883
|
-
if (item) {
|
|
14884
|
-
_zip.deleteFile(item.entryName, withsubfolders);
|
|
14885
|
-
}
|
|
14886
|
-
},
|
|
14887
|
-
deleteEntry: function(entry) {
|
|
14888
|
-
var item = getEntry(entry);
|
|
14889
|
-
if (item) {
|
|
14890
|
-
_zip.deleteEntry(item.entryName);
|
|
14891
|
-
}
|
|
14892
|
-
},
|
|
14893
|
-
addZipComment: function(comment) {
|
|
14894
|
-
_zip.comment = comment;
|
|
14895
|
-
},
|
|
14896
|
-
getZipComment: function() {
|
|
14897
|
-
return _zip.comment || "";
|
|
14898
|
-
},
|
|
14899
|
-
addZipEntryComment: function(entry, comment) {
|
|
14900
|
-
var item = getEntry(entry);
|
|
14901
|
-
if (item) {
|
|
14902
|
-
item.comment = comment;
|
|
14903
|
-
}
|
|
14904
|
-
},
|
|
14905
|
-
getZipEntryComment: function(entry) {
|
|
14906
|
-
var item = getEntry(entry);
|
|
14907
|
-
if (item) {
|
|
14908
|
-
return item.comment || "";
|
|
14909
|
-
}
|
|
14910
|
-
return "";
|
|
14911
|
-
},
|
|
14912
|
-
updateFile: function(entry, content) {
|
|
14913
|
-
var item = getEntry(entry);
|
|
14914
|
-
if (item) {
|
|
14915
|
-
item.setData(content);
|
|
14916
|
-
}
|
|
14917
|
-
},
|
|
14918
|
-
addLocalFile: function(localPath, zipPath, zipName, comment) {
|
|
14919
|
-
if (filetools.fs.existsSync(localPath)) {
|
|
14920
|
-
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
14921
|
-
const p = pth.win32.basename(pth.win32.normalize(localPath));
|
|
14922
|
-
zipPath += zipName ? zipName : p;
|
|
14923
|
-
const _attr = filetools.fs.statSync(localPath);
|
|
14924
|
-
const data = _attr.isFile() ? filetools.fs.readFileSync(localPath) : Buffer.alloc(0);
|
|
14925
|
-
if (_attr.isDirectory())
|
|
14926
|
-
zipPath += filetools.sep;
|
|
14927
|
-
this.addFile(zipPath, data, comment, _attr);
|
|
14928
|
-
} else {
|
|
14929
|
-
throw Utils.Errors.FILE_NOT_FOUND(localPath);
|
|
14930
|
-
}
|
|
14931
|
-
},
|
|
14932
|
-
addLocalFileAsync: function(options2, callback) {
|
|
14933
|
-
options2 = typeof options2 === "object" ? options2 : { localPath: options2 };
|
|
14934
|
-
const localPath = pth.resolve(options2.localPath);
|
|
14935
|
-
const { comment } = options2;
|
|
14936
|
-
let { zipPath, zipName } = options2;
|
|
14937
|
-
const self = this;
|
|
14938
|
-
filetools.fs.stat(localPath, function(err, stats) {
|
|
14939
|
-
if (err)
|
|
14940
|
-
return callback(err, false);
|
|
14941
|
-
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
14942
|
-
const p = pth.win32.basename(pth.win32.normalize(localPath));
|
|
14943
|
-
zipPath += zipName ? zipName : p;
|
|
14944
|
-
if (stats.isFile()) {
|
|
14945
|
-
filetools.fs.readFile(localPath, function(err2, data) {
|
|
14946
|
-
if (err2)
|
|
14947
|
-
return callback(err2, false);
|
|
14948
|
-
self.addFile(zipPath, data, comment, stats);
|
|
14949
|
-
return setImmediate(callback, undefined, true);
|
|
14950
|
-
});
|
|
14951
|
-
} else if (stats.isDirectory()) {
|
|
14952
|
-
zipPath += filetools.sep;
|
|
14953
|
-
self.addFile(zipPath, Buffer.alloc(0), comment, stats);
|
|
14954
|
-
return setImmediate(callback, undefined, true);
|
|
14955
|
-
}
|
|
14956
|
-
});
|
|
14957
|
-
},
|
|
14958
|
-
addLocalFolder: function(localPath, zipPath, filter) {
|
|
14959
|
-
filter = filenameFilter(filter);
|
|
14960
|
-
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
14961
|
-
localPath = pth.normalize(localPath);
|
|
14962
|
-
if (filetools.fs.existsSync(localPath)) {
|
|
14963
|
-
const items = filetools.findFiles(localPath);
|
|
14964
|
-
const self = this;
|
|
14965
|
-
if (items.length) {
|
|
14966
|
-
for (const filepath of items) {
|
|
14967
|
-
const p = pth.join(zipPath, relativePath(localPath, filepath));
|
|
14968
|
-
if (filter(p)) {
|
|
14969
|
-
self.addLocalFile(filepath, pth.dirname(p));
|
|
14970
|
-
}
|
|
14971
|
-
}
|
|
14972
|
-
}
|
|
14973
|
-
} else {
|
|
14974
|
-
throw Utils.Errors.FILE_NOT_FOUND(localPath);
|
|
14975
|
-
}
|
|
14976
|
-
},
|
|
14977
|
-
addLocalFolderAsync: function(localPath, callback, zipPath, filter) {
|
|
14978
|
-
filter = filenameFilter(filter);
|
|
14979
|
-
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
14980
|
-
localPath = pth.normalize(localPath);
|
|
14981
|
-
var self = this;
|
|
14982
|
-
filetools.fs.open(localPath, "r", function(err) {
|
|
14983
|
-
if (err && err.code === "ENOENT") {
|
|
14984
|
-
callback(undefined, Utils.Errors.FILE_NOT_FOUND(localPath));
|
|
14985
|
-
} else if (err) {
|
|
14986
|
-
callback(undefined, err);
|
|
14987
|
-
} else {
|
|
14988
|
-
var items = filetools.findFiles(localPath);
|
|
14989
|
-
var i = -1;
|
|
14990
|
-
var next = function() {
|
|
14991
|
-
i += 1;
|
|
14992
|
-
if (i < items.length) {
|
|
14993
|
-
var filepath = items[i];
|
|
14994
|
-
var p = relativePath(localPath, filepath).split("\\").join("/");
|
|
14995
|
-
p = p.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, "");
|
|
14996
|
-
if (filter(p)) {
|
|
14997
|
-
filetools.fs.stat(filepath, function(er0, stats) {
|
|
14998
|
-
if (er0)
|
|
14999
|
-
callback(undefined, er0);
|
|
15000
|
-
if (stats.isFile()) {
|
|
15001
|
-
filetools.fs.readFile(filepath, function(er1, data) {
|
|
15002
|
-
if (er1) {
|
|
15003
|
-
callback(undefined, er1);
|
|
15004
|
-
} else {
|
|
15005
|
-
self.addFile(zipPath + p, data, "", stats);
|
|
15006
|
-
next();
|
|
15007
|
-
}
|
|
15008
|
-
});
|
|
15009
|
-
} else {
|
|
15010
|
-
self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
|
|
15011
|
-
next();
|
|
15012
|
-
}
|
|
15013
|
-
});
|
|
15014
|
-
} else {
|
|
15015
|
-
process.nextTick(() => {
|
|
15016
|
-
next();
|
|
15017
|
-
});
|
|
15018
|
-
}
|
|
15019
|
-
} else {
|
|
15020
|
-
callback(true, undefined);
|
|
15021
|
-
}
|
|
15022
|
-
};
|
|
15023
|
-
next();
|
|
15024
|
-
}
|
|
15025
|
-
});
|
|
15026
|
-
},
|
|
15027
|
-
addLocalFolderAsync2: function(options2, callback) {
|
|
15028
|
-
const self = this;
|
|
15029
|
-
options2 = typeof options2 === "object" ? options2 : { localPath: options2 };
|
|
15030
|
-
const localPath = pth.resolve(options2.localPath);
|
|
15031
|
-
let { zipPath, filter, namefix } = options2;
|
|
15032
|
-
if (filter instanceof RegExp) {
|
|
15033
|
-
filter = function(rx) {
|
|
15034
|
-
return function(filename) {
|
|
15035
|
-
return rx.test(filename);
|
|
15036
|
-
};
|
|
15037
|
-
}(filter);
|
|
15038
|
-
} else if (typeof filter !== "function") {
|
|
15039
|
-
filter = function() {
|
|
15040
|
-
return true;
|
|
15041
|
-
};
|
|
15042
|
-
}
|
|
15043
|
-
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
15044
|
-
if (namefix === "latin1") {
|
|
15045
|
-
namefix = (str3) => str3.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, "");
|
|
15046
|
-
}
|
|
15047
|
-
if (typeof namefix !== "function")
|
|
15048
|
-
namefix = (str3) => str3;
|
|
15049
|
-
const relPathFix = (entry) => pth.join(zipPath, namefix(relativePath(localPath, entry)));
|
|
15050
|
-
const fileNameFix = (entry) => pth.win32.basename(pth.win32.normalize(namefix(entry)));
|
|
15051
|
-
filetools.fs.open(localPath, "r", function(err) {
|
|
15052
|
-
if (err && err.code === "ENOENT") {
|
|
15053
|
-
callback(Utils.Errors.FILE_NOT_FOUND(localPath), false);
|
|
15054
|
-
} else if (err) {
|
|
15055
|
-
callback(err, false);
|
|
15056
|
-
} else {
|
|
15057
|
-
filetools.findFilesAsync(localPath, function(err2, fileEntries) {
|
|
15058
|
-
if (err2)
|
|
15059
|
-
return callback(err2, false);
|
|
15060
|
-
fileEntries = fileEntries.filter((dir) => filter(relPathFix(dir)));
|
|
15061
|
-
if (!fileEntries.length)
|
|
15062
|
-
return callback(undefined, true);
|
|
15063
|
-
setImmediate(fileEntries.reverse().reduce(function(next, entry) {
|
|
15064
|
-
return function(err3, done) {
|
|
15065
|
-
if (err3 || done === false)
|
|
15066
|
-
return setImmediate(next, err3, false);
|
|
15067
|
-
self.addLocalFileAsync({
|
|
15068
|
-
localPath: entry,
|
|
15069
|
-
zipPath: pth.dirname(relPathFix(entry)),
|
|
15070
|
-
zipName: fileNameFix(entry)
|
|
15071
|
-
}, next);
|
|
15072
|
-
};
|
|
15073
|
-
}, callback));
|
|
15074
|
-
});
|
|
15075
|
-
}
|
|
15076
|
-
});
|
|
15077
|
-
},
|
|
15078
|
-
addLocalFolderPromise: function(localPath, props) {
|
|
15079
|
-
return new Promise((resolve4, reject) => {
|
|
15080
|
-
this.addLocalFolderAsync2(Object.assign({ localPath }, props), (err, done) => {
|
|
15081
|
-
if (err)
|
|
15082
|
-
return reject(err);
|
|
15083
|
-
if (done)
|
|
15084
|
-
resolve4(this);
|
|
15085
|
-
});
|
|
15086
|
-
});
|
|
15087
|
-
},
|
|
15088
|
-
addFile: function(entryName, content, comment, attr) {
|
|
15089
|
-
entryName = zipnamefix(entryName);
|
|
15090
|
-
let entry = getEntry(entryName);
|
|
15091
|
-
const update = entry != null;
|
|
15092
|
-
if (!update) {
|
|
15093
|
-
entry = new ZipEntry(opts);
|
|
15094
|
-
entry.entryName = entryName;
|
|
15095
|
-
}
|
|
15096
|
-
entry.comment = comment || "";
|
|
15097
|
-
const isStat = typeof attr === "object" && attr instanceof filetools.fs.Stats;
|
|
15098
|
-
if (isStat) {
|
|
15099
|
-
entry.header.time = attr.mtime;
|
|
15100
|
-
}
|
|
15101
|
-
var fileattr = entry.isDirectory ? 16 : 0;
|
|
15102
|
-
let unix = entry.isDirectory ? 16384 : 32768;
|
|
15103
|
-
if (isStat) {
|
|
15104
|
-
unix |= 4095 & attr.mode;
|
|
15105
|
-
} else if (typeof attr === "number") {
|
|
15106
|
-
unix |= 4095 & attr;
|
|
15107
|
-
} else {
|
|
15108
|
-
unix |= entry.isDirectory ? 493 : 420;
|
|
15109
|
-
}
|
|
15110
|
-
fileattr = (fileattr | unix << 16) >>> 0;
|
|
15111
|
-
entry.attr = fileattr;
|
|
15112
|
-
entry.setData(content);
|
|
15113
|
-
if (!update)
|
|
15114
|
-
_zip.setEntry(entry);
|
|
15115
|
-
return entry;
|
|
15116
|
-
},
|
|
15117
|
-
getEntries: function(password) {
|
|
15118
|
-
_zip.password = password;
|
|
15119
|
-
return _zip ? _zip.entries : [];
|
|
15120
|
-
},
|
|
15121
|
-
getEntry: function(name) {
|
|
15122
|
-
return getEntry(name);
|
|
15123
|
-
},
|
|
15124
|
-
getEntryCount: function() {
|
|
15125
|
-
return _zip.getEntryCount();
|
|
15126
|
-
},
|
|
15127
|
-
forEach: function(callback) {
|
|
15128
|
-
return _zip.forEach(callback);
|
|
15129
|
-
},
|
|
15130
|
-
extractEntryTo: function(entry, targetPath, maintainEntryPath, overwrite, keepOriginalPermission, outFileName) {
|
|
15131
|
-
overwrite = get_Bool(false, overwrite);
|
|
15132
|
-
keepOriginalPermission = get_Bool(false, keepOriginalPermission);
|
|
15133
|
-
maintainEntryPath = get_Bool(true, maintainEntryPath);
|
|
15134
|
-
outFileName = get_Str(keepOriginalPermission, outFileName);
|
|
15135
|
-
var item = getEntry(entry);
|
|
15136
|
-
if (!item) {
|
|
15137
|
-
throw Utils.Errors.NO_ENTRY();
|
|
15138
|
-
}
|
|
15139
|
-
var entryName = canonical(item.entryName);
|
|
15140
|
-
var target = sanitize(targetPath, outFileName && !item.isDirectory ? canonical(outFileName) : maintainEntryPath ? entryName : pth.basename(entryName));
|
|
15141
|
-
if (item.isDirectory) {
|
|
15142
|
-
var children = _zip.getEntryChildren(item);
|
|
15143
|
-
children.forEach(function(child) {
|
|
15144
|
-
if (child.isDirectory)
|
|
15145
|
-
return;
|
|
15146
|
-
var content2 = child.getData();
|
|
15147
|
-
if (!content2) {
|
|
15148
|
-
throw Utils.Errors.CANT_EXTRACT_FILE();
|
|
15149
|
-
}
|
|
15150
|
-
var name = canonical(maintainEntryPath ? child.entryName : child.entryName.substring(item.entryName.length));
|
|
15151
|
-
var childName = sanitize(targetPath, name);
|
|
15152
|
-
filetools.assertPathSafe(targetPath, childName);
|
|
15153
|
-
const fileAttr2 = keepOriginalPermission ? child.header.fileAttr : undefined;
|
|
15154
|
-
filetools.writeFileTo(childName, content2, overwrite, fileAttr2);
|
|
15155
|
-
});
|
|
15156
|
-
return true;
|
|
15157
|
-
}
|
|
15158
|
-
var content = item.getData(_zip.password);
|
|
15159
|
-
if (!content)
|
|
15160
|
-
throw Utils.Errors.CANT_EXTRACT_FILE();
|
|
15161
|
-
filetools.assertPathSafe(targetPath, target);
|
|
15162
|
-
if (filetools.fs.existsSync(target) && !overwrite) {
|
|
15163
|
-
throw Utils.Errors.CANT_OVERRIDE();
|
|
15164
|
-
}
|
|
15165
|
-
const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
|
|
15166
|
-
filetools.writeFileTo(target, content, overwrite, fileAttr);
|
|
15167
|
-
return true;
|
|
15168
|
-
},
|
|
15169
|
-
test: function(pass) {
|
|
15170
|
-
if (!_zip) {
|
|
15171
|
-
return false;
|
|
15172
|
-
}
|
|
15173
|
-
for (var entry of _zip.entries) {
|
|
15174
|
-
try {
|
|
15175
|
-
if (entry.isDirectory) {
|
|
15176
|
-
continue;
|
|
15177
|
-
}
|
|
15178
|
-
var content = entry.getData(pass);
|
|
15179
|
-
if (!content) {
|
|
15180
|
-
return false;
|
|
15181
|
-
}
|
|
15182
|
-
} catch (err) {
|
|
15183
|
-
return false;
|
|
15184
|
-
}
|
|
15185
|
-
}
|
|
15186
|
-
return true;
|
|
15187
|
-
},
|
|
15188
|
-
extractAllTo: function(targetPath, overwrite, keepOriginalPermission, pass) {
|
|
15189
|
-
keepOriginalPermission = get_Bool(false, keepOriginalPermission);
|
|
15190
|
-
pass = get_Str(keepOriginalPermission, pass);
|
|
15191
|
-
overwrite = get_Bool(false, overwrite);
|
|
15192
|
-
if (!_zip)
|
|
15193
|
-
throw Utils.Errors.NO_ZIP();
|
|
15194
|
-
const dirEntries = [];
|
|
15195
|
-
_zip.entries.forEach(function(entry) {
|
|
15196
|
-
var entryName = sanitize(targetPath, canonical(entry.entryName));
|
|
15197
|
-
filetools.assertPathSafe(targetPath, entryName);
|
|
15198
|
-
if (entry.isDirectory) {
|
|
15199
|
-
filetools.makeDir(entryName);
|
|
15200
|
-
if (keepOriginalPermission)
|
|
15201
|
-
dirEntries.push({ path: entryName, attr: entry.header.fileAttr });
|
|
15202
|
-
return;
|
|
15203
|
-
}
|
|
15204
|
-
var content = entry.getData(pass);
|
|
15205
|
-
if (!content) {
|
|
15206
|
-
throw Utils.Errors.CANT_EXTRACT_FILE();
|
|
15207
|
-
}
|
|
15208
|
-
const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
|
|
15209
|
-
filetools.writeFileTo(entryName, content, overwrite, fileAttr);
|
|
15210
|
-
try {
|
|
15211
|
-
filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time);
|
|
15212
|
-
} catch (err) {}
|
|
15213
|
-
});
|
|
15214
|
-
applyDirAttributes(dirEntries);
|
|
15215
|
-
},
|
|
15216
|
-
extractAllToAsync: function(targetPath, overwrite, keepOriginalPermission, callback) {
|
|
15217
|
-
callback = get_Fun(overwrite, keepOriginalPermission, callback);
|
|
15218
|
-
keepOriginalPermission = get_Bool(false, keepOriginalPermission);
|
|
15219
|
-
overwrite = get_Bool(false, overwrite);
|
|
15220
|
-
if (!callback) {
|
|
15221
|
-
return new Promise((resolve4, reject) => {
|
|
15222
|
-
this.extractAllToAsync(targetPath, overwrite, keepOriginalPermission, function(err) {
|
|
15223
|
-
if (err) {
|
|
15224
|
-
reject(err);
|
|
15225
|
-
} else {
|
|
15226
|
-
resolve4(this);
|
|
15227
|
-
}
|
|
15228
|
-
});
|
|
15229
|
-
});
|
|
15230
|
-
}
|
|
15231
|
-
if (!_zip) {
|
|
15232
|
-
callback(Utils.Errors.NO_ZIP());
|
|
15233
|
-
return;
|
|
15234
|
-
}
|
|
15235
|
-
targetPath = pth.resolve(targetPath);
|
|
15236
|
-
const getPath = (entry) => sanitize(targetPath, pth.normalize(canonical(entry.entryName)));
|
|
15237
|
-
const getError = (msg, file) => new Error(msg + ': "' + file + '"');
|
|
15238
|
-
const dirEntries = [];
|
|
15239
|
-
const fileEntries = [];
|
|
15240
|
-
_zip.entries.forEach((e) => {
|
|
15241
|
-
if (e.isDirectory) {
|
|
15242
|
-
dirEntries.push(e);
|
|
15243
|
-
} else {
|
|
15244
|
-
fileEntries.push(e);
|
|
15245
|
-
}
|
|
15246
|
-
});
|
|
15247
|
-
const deferredDirAttr = [];
|
|
15248
|
-
for (const entry of dirEntries) {
|
|
15249
|
-
const dirPath = getPath(entry);
|
|
15250
|
-
const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
|
|
15251
|
-
try {
|
|
15252
|
-
filetools.assertPathSafe(targetPath, dirPath);
|
|
15253
|
-
filetools.makeDir(dirPath);
|
|
15254
|
-
} catch (er) {
|
|
15255
|
-
callback(getError("Unable to create folder", dirPath));
|
|
15256
|
-
continue;
|
|
15257
|
-
}
|
|
15258
|
-
if (dirAttr)
|
|
15259
|
-
deferredDirAttr.push({ path: dirPath, attr: dirAttr });
|
|
15260
|
-
try {
|
|
15261
|
-
filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time);
|
|
15262
|
-
} catch (er) {}
|
|
15263
|
-
}
|
|
15264
|
-
const done = (err) => {
|
|
15265
|
-
if (!err) {
|
|
15266
|
-
try {
|
|
15267
|
-
applyDirAttributes(deferredDirAttr);
|
|
15268
|
-
} catch (er) {
|
|
15269
|
-
return callback(getError("Unable to set folder permissions", er.path || ""));
|
|
15270
|
-
}
|
|
15271
|
-
}
|
|
15272
|
-
callback(err);
|
|
15273
|
-
};
|
|
15274
|
-
fileEntries.reverse().reduce(function(next, entry) {
|
|
15275
|
-
return function(err) {
|
|
15276
|
-
if (err) {
|
|
15277
|
-
next(err);
|
|
15278
|
-
} else {
|
|
15279
|
-
const entryName = pth.normalize(canonical(entry.entryName));
|
|
15280
|
-
const filePath = sanitize(targetPath, entryName);
|
|
15281
|
-
try {
|
|
15282
|
-
filetools.assertPathSafe(targetPath, filePath);
|
|
15283
|
-
} catch (er) {
|
|
15284
|
-
return next(er);
|
|
15285
|
-
}
|
|
15286
|
-
entry.getDataAsync(function(content, err_1) {
|
|
15287
|
-
if (err_1) {
|
|
15288
|
-
next(err_1);
|
|
15289
|
-
} else if (!content) {
|
|
15290
|
-
next(Utils.Errors.CANT_EXTRACT_FILE());
|
|
15291
|
-
} else {
|
|
15292
|
-
const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
|
|
15293
|
-
filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function(succ) {
|
|
15294
|
-
if (!succ) {
|
|
15295
|
-
return next(getError("Unable to write file", filePath));
|
|
15296
|
-
}
|
|
15297
|
-
filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function() {
|
|
15298
|
-
next();
|
|
15299
|
-
});
|
|
15300
|
-
});
|
|
15301
|
-
}
|
|
15302
|
-
});
|
|
15303
|
-
}
|
|
15304
|
-
};
|
|
15305
|
-
}, done)();
|
|
15306
|
-
},
|
|
15307
|
-
writeZip: function(targetFileName, callback) {
|
|
15308
|
-
if (arguments.length === 1) {
|
|
15309
|
-
if (typeof targetFileName === "function") {
|
|
15310
|
-
callback = targetFileName;
|
|
15311
|
-
targetFileName = "";
|
|
15312
|
-
}
|
|
15313
|
-
}
|
|
15314
|
-
if (!targetFileName && opts.filename) {
|
|
15315
|
-
targetFileName = opts.filename;
|
|
15316
|
-
}
|
|
15317
|
-
if (!targetFileName)
|
|
15318
|
-
return;
|
|
15319
|
-
var zipData = _zip.compressToBuffer();
|
|
15320
|
-
if (zipData) {
|
|
15321
|
-
var ok = filetools.writeFileTo(targetFileName, zipData, true);
|
|
15322
|
-
if (typeof callback === "function")
|
|
15323
|
-
callback(!ok ? new Error("failed") : null, "");
|
|
15324
|
-
}
|
|
15325
|
-
},
|
|
15326
|
-
writeZipPromise: function(targetFileName, props) {
|
|
15327
|
-
const { overwrite, perm } = Object.assign({ overwrite: true }, props);
|
|
15328
|
-
return new Promise((resolve4, reject) => {
|
|
15329
|
-
if (!targetFileName && opts.filename)
|
|
15330
|
-
targetFileName = opts.filename;
|
|
15331
|
-
if (!targetFileName)
|
|
15332
|
-
reject("ADM-ZIP: ZIP File Name Missing");
|
|
15333
|
-
this.toBufferPromise().then((zipData) => {
|
|
15334
|
-
const ret = (done) => done ? resolve4(done) : reject("ADM-ZIP: Wasn't able to write zip file");
|
|
15335
|
-
filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret);
|
|
15336
|
-
}, reject);
|
|
15337
|
-
});
|
|
15338
|
-
},
|
|
15339
|
-
toBufferPromise: function() {
|
|
15340
|
-
return new Promise((resolve4, reject) => {
|
|
15341
|
-
_zip.toAsyncBuffer(resolve4, reject);
|
|
15342
|
-
});
|
|
15343
|
-
},
|
|
15344
|
-
toBuffer: function(onSuccess, onFail, onItemStart, onItemEnd) {
|
|
15345
|
-
if (typeof onSuccess === "function") {
|
|
15346
|
-
_zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd);
|
|
15347
|
-
return null;
|
|
15348
|
-
}
|
|
15349
|
-
return _zip.compressToBuffer();
|
|
15350
|
-
}
|
|
15351
|
-
};
|
|
15352
|
-
};
|
|
15353
|
-
});
|
|
15354
|
-
|
|
15355
12869
|
// ../vpngateway-commands/dist/index.js
|
|
15356
12870
|
init_index_1de529jm();
|
|
15357
12871
|
import { createRequire as createRequire3 } from "node:module";
|
|
@@ -18731,8 +16245,9 @@ class VoidApiResponse {
|
|
|
18731
16245
|
}
|
|
18732
16246
|
var package_default = {
|
|
18733
16247
|
name: "@uipath/admin-vpngateway-sdk",
|
|
16248
|
+
author: "UiPath",
|
|
18734
16249
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
18735
|
-
version: "1.
|
|
16250
|
+
version: "1.203.0",
|
|
18736
16251
|
description: "SDK for the UiPath Hypervisor VPN Gateway management APIs.",
|
|
18737
16252
|
repository: {
|
|
18738
16253
|
type: "git",
|
|
@@ -20167,16 +17682,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
|
|
|
20167
17682
|
errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
|
|
20168
17683
|
};
|
|
20169
17684
|
};
|
|
20170
|
-
var
|
|
20171
|
-
const fs72 = getFileSystem();
|
|
20172
|
-
const absolutePath = fs72.path.isAbsolute(envPath) ? envPath : fs72.path.join(fs72.env.cwd(), envPath);
|
|
20173
|
-
if (!await fs72.exists(absolutePath)) {
|
|
20174
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
20175
|
-
}
|
|
20176
|
-
const content = await fs72.readFile(absolutePath, "utf-8");
|
|
20177
|
-
if (content === null) {
|
|
20178
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
20179
|
-
}
|
|
17685
|
+
var parseEnvContent = (content) => {
|
|
20180
17686
|
const env = {};
|
|
20181
17687
|
for (const line of content.split(`
|
|
20182
17688
|
`)) {
|
|
@@ -20197,6 +17703,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
20197
17703
|
}
|
|
20198
17704
|
return env;
|
|
20199
17705
|
};
|
|
17706
|
+
var loadEnvFileAsync = async ({ envPath }) => {
|
|
17707
|
+
const fs72 = getFileSystem();
|
|
17708
|
+
const absolutePath = fs72.path.isAbsolute(envPath) ? envPath : fs72.path.join(fs72.env.cwd(), envPath);
|
|
17709
|
+
if (!await fs72.exists(absolutePath)) {
|
|
17710
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
17711
|
+
}
|
|
17712
|
+
const content = await fs72.readFile(absolutePath, "utf-8");
|
|
17713
|
+
if (content === null) {
|
|
17714
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
17715
|
+
}
|
|
17716
|
+
return parseEnvContent(content);
|
|
17717
|
+
};
|
|
20200
17718
|
var saveEnvFileAsync = async ({
|
|
20201
17719
|
envPath,
|
|
20202
17720
|
data,
|
|
@@ -20703,6 +18221,7 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
20703
18221
|
function errorMessage(error) {
|
|
20704
18222
|
return error instanceof Error ? error.message : String(error);
|
|
20705
18223
|
}
|
|
18224
|
+
init_src();
|
|
20706
18225
|
init_constants();
|
|
20707
18226
|
init_src();
|
|
20708
18227
|
init_constants();
|
|
@@ -21244,7 +18763,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
21244
18763
|
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
21245
18764
|
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
21246
18765
|
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
21247
|
-
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
18766
|
+
var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
21248
18767
|
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
21249
18768
|
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
21250
18769
|
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -21291,7 +18810,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
|
21291
18810
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
21292
18811
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
21293
18812
|
].join("|"), "g");
|
|
21294
|
-
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
18813
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
21295
18814
|
var COLLAPSED_BODY = "{…}";
|
|
21296
18815
|
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
21297
18816
|
var MAX_BODY_NESTING = 8;
|
|
@@ -21306,10 +18825,13 @@ function collapseJsonBodies(text) {
|
|
|
21306
18825
|
}
|
|
21307
18826
|
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
21308
18827
|
}
|
|
21309
|
-
var TRAILING_PROSE_PUNCT =
|
|
18828
|
+
var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
|
|
21310
18829
|
function peelTrailingPunctuation(match) {
|
|
21311
|
-
|
|
21312
|
-
|
|
18830
|
+
let end = match.length;
|
|
18831
|
+
while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
|
|
18832
|
+
end -= 1;
|
|
18833
|
+
}
|
|
18834
|
+
return [match.slice(0, end), match.slice(end)];
|
|
21313
18835
|
}
|
|
21314
18836
|
function redactUrl(raw) {
|
|
21315
18837
|
try {
|
|
@@ -21608,6 +19130,22 @@ function parseHttpStatusFromMessage(message) {
|
|
|
21608
19130
|
const status = Number(match[1]);
|
|
21609
19131
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
21610
19132
|
}
|
|
19133
|
+
function findHttpStatusInGraph(error) {
|
|
19134
|
+
for (const node of walkErrorGraph(error)) {
|
|
19135
|
+
const response = node.response;
|
|
19136
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
19137
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
19138
|
+
return explicit;
|
|
19139
|
+
}
|
|
19140
|
+
if (typeof node.message === "string") {
|
|
19141
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
19142
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
19143
|
+
return parsed;
|
|
19144
|
+
}
|
|
19145
|
+
}
|
|
19146
|
+
}
|
|
19147
|
+
return;
|
|
19148
|
+
}
|
|
21611
19149
|
function isHtmlDocument(body) {
|
|
21612
19150
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
21613
19151
|
}
|
|
@@ -21721,7 +19259,8 @@ async function extractErrorDetails(error, options) {
|
|
|
21721
19259
|
}
|
|
21722
19260
|
let message;
|
|
21723
19261
|
let result = "Failure";
|
|
21724
|
-
const
|
|
19262
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
19263
|
+
const classification = classifyError(classificationStatus, error);
|
|
21725
19264
|
let retry = classification.retry;
|
|
21726
19265
|
if (status === 401) {
|
|
21727
19266
|
message = DEFAULT_401;
|
|
@@ -21797,8 +19336,8 @@ async function extractErrorDetails(error, options) {
|
|
|
21797
19336
|
details = describeThrownValue(error);
|
|
21798
19337
|
}
|
|
21799
19338
|
const context = {};
|
|
21800
|
-
if (
|
|
21801
|
-
context.httpStatus =
|
|
19339
|
+
if (classificationStatus) {
|
|
19340
|
+
context.httpStatus = classificationStatus;
|
|
21802
19341
|
}
|
|
21803
19342
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
21804
19343
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -22340,7 +19879,8 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
22340
19879
|
}
|
|
22341
19880
|
const [error, output] = catchError2(() => execFileSync22("reg", ["query", keyPath, "/v", valueName], {
|
|
22342
19881
|
encoding: "utf-8",
|
|
22343
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
19882
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
19883
|
+
windowsHide: true
|
|
22344
19884
|
}));
|
|
22345
19885
|
if (error) {
|
|
22346
19886
|
return "";
|
|
@@ -22998,28 +20538,32 @@ function isPlainRecord(value) {
|
|
|
22998
20538
|
const prototype = Object.getPrototypeOf(value);
|
|
22999
20539
|
return prototype === Object.prototype || prototype === null;
|
|
23000
20540
|
}
|
|
23001
|
-
function
|
|
20541
|
+
function splitPagedEnvelope(value) {
|
|
23002
20542
|
if (Array.isArray(value) || !isPlainRecord(value))
|
|
23003
20543
|
return null;
|
|
23004
|
-
const entries = Object.
|
|
20544
|
+
const entries = Object.entries(value);
|
|
23005
20545
|
if (entries.length === 0)
|
|
23006
20546
|
return null;
|
|
23007
|
-
let
|
|
23008
|
-
|
|
23009
|
-
for (const entry of entries) {
|
|
20547
|
+
let found = null;
|
|
20548
|
+
const meta = Object.create(null);
|
|
20549
|
+
for (const [key, entry] of entries) {
|
|
23010
20550
|
if (Array.isArray(entry)) {
|
|
23011
|
-
if (
|
|
20551
|
+
if (found !== null)
|
|
23012
20552
|
return null;
|
|
23013
|
-
|
|
20553
|
+
found = { key, rows: entry };
|
|
23014
20554
|
} else if (entry !== null && typeof entry === "object") {
|
|
23015
20555
|
return null;
|
|
23016
20556
|
} else {
|
|
23017
|
-
|
|
20557
|
+
meta[key] = entry;
|
|
23018
20558
|
}
|
|
23019
20559
|
}
|
|
23020
|
-
if (
|
|
20560
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
23021
20561
|
return null;
|
|
23022
|
-
return
|
|
20562
|
+
return { ...found, meta };
|
|
20563
|
+
}
|
|
20564
|
+
function extractPagedRows(value) {
|
|
20565
|
+
const paged = splitPagedEnvelope(value);
|
|
20566
|
+
return paged === null ? null : paged.rows;
|
|
23023
20567
|
}
|
|
23024
20568
|
function toLowerCamelCaseKey(key) {
|
|
23025
20569
|
if (!key)
|
|
@@ -23123,6 +20667,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
23123
20667
|
}
|
|
23124
20668
|
break;
|
|
23125
20669
|
}
|
|
20670
|
+
case "markdown":
|
|
20671
|
+
logFn(renderMarkdown(data));
|
|
20672
|
+
break;
|
|
23126
20673
|
default: {
|
|
23127
20674
|
const hasData = "Data" in data && data.Data != null;
|
|
23128
20675
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
@@ -23147,6 +20694,10 @@ function logOutput(data, format = "json", tableRowStyle) {
|
|
|
23147
20694
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
23148
20695
|
`), needsAsciiSafeJson(sink), styleFn);
|
|
23149
20696
|
}
|
|
20697
|
+
var PLUMBING_KEYS = new Set(["code", "log"]);
|
|
20698
|
+
function isPlumbingKey(key) {
|
|
20699
|
+
return PLUMBING_KEYS.has(key.toLowerCase());
|
|
20700
|
+
}
|
|
23150
20701
|
function cellToString(val) {
|
|
23151
20702
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
23152
20703
|
}
|
|
@@ -23162,7 +20713,7 @@ function wrapText(text, width) {
|
|
|
23162
20713
|
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
23163
20714
|
if (data.length === 0)
|
|
23164
20715
|
return;
|
|
23165
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
20716
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
23166
20717
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
23167
20718
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
23168
20719
|
logFn(header);
|
|
@@ -23184,7 +20735,7 @@ function isNonEmptyPlainObject(value) {
|
|
|
23184
20735
|
}
|
|
23185
20736
|
var NESTED_INDENT = " ";
|
|
23186
20737
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
23187
|
-
const keys = Object.keys(data).filter((key) => !
|
|
20738
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
|
|
23188
20739
|
if (keys.length === 0)
|
|
23189
20740
|
return;
|
|
23190
20741
|
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
@@ -23215,7 +20766,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
23215
20766
|
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
23216
20767
|
if (data.length === 0)
|
|
23217
20768
|
return;
|
|
23218
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
20769
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
23219
20770
|
if (keys.length === 0)
|
|
23220
20771
|
return;
|
|
23221
20772
|
if (!process.stdout.isTTY) {
|
|
@@ -23289,6 +20840,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
23289
20840
|
logFn(`Log: ${externalLogValue}`);
|
|
23290
20841
|
}
|
|
23291
20842
|
}
|
|
20843
|
+
var MARKDOWN_MAX_CELL = 200;
|
|
20844
|
+
var MARKDOWN_MAX_DEPTH = 3;
|
|
20845
|
+
function markdownHeading(depth) {
|
|
20846
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
20847
|
+
}
|
|
20848
|
+
var BACKTICK_RUN = /`+/g;
|
|
20849
|
+
function fencedBlock(text) {
|
|
20850
|
+
const first = text.trimStart()[0];
|
|
20851
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
20852
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
|
|
20853
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
20854
|
+
return `${fence}${language}
|
|
20855
|
+
${text}
|
|
20856
|
+
${fence}`;
|
|
20857
|
+
}
|
|
20858
|
+
function collapseNewlineRuns(text) {
|
|
20859
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
20860
|
+
`) ? " " : part).join("");
|
|
20861
|
+
}
|
|
20862
|
+
function markdownCell(value) {
|
|
20863
|
+
const text = value instanceof Date ? value.toISOString() : cellToString(value);
|
|
20864
|
+
return collapseNewlineRuns(text).replace(/\|/g, "\\|");
|
|
20865
|
+
}
|
|
20866
|
+
function markdownLabel(key) {
|
|
20867
|
+
return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
|
|
20868
|
+
}
|
|
20869
|
+
function withoutPlumbing(record) {
|
|
20870
|
+
const kept = Object.create(null);
|
|
20871
|
+
for (const [key, value] of Object.entries(record)) {
|
|
20872
|
+
if (!isPlumbingKey(key))
|
|
20873
|
+
kept[key] = value;
|
|
20874
|
+
}
|
|
20875
|
+
return kept;
|
|
20876
|
+
}
|
|
20877
|
+
function rowsWithoutPlumbing(rows) {
|
|
20878
|
+
return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
|
|
20879
|
+
}
|
|
20880
|
+
function markdownTable(rows) {
|
|
20881
|
+
const columns = [];
|
|
20882
|
+
const seen = new Set;
|
|
20883
|
+
for (const row of rows) {
|
|
20884
|
+
for (const key of Object.keys(row)) {
|
|
20885
|
+
if (!seen.has(key)) {
|
|
20886
|
+
seen.add(key);
|
|
20887
|
+
columns.push(key);
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20890
|
+
}
|
|
20891
|
+
if (columns.length === 0)
|
|
20892
|
+
return null;
|
|
20893
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
|
|
20894
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
|
|
20895
|
+
return null;
|
|
20896
|
+
}
|
|
20897
|
+
return [
|
|
20898
|
+
`| ${columns.map(markdownLabel).join(" | ")} |`,
|
|
20899
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
20900
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
20901
|
+
].join(`
|
|
20902
|
+
`);
|
|
20903
|
+
}
|
|
20904
|
+
function extractMessageSequence(rows) {
|
|
20905
|
+
const messages = [];
|
|
20906
|
+
for (const row of rows) {
|
|
20907
|
+
const message = extractSingleMessage(row);
|
|
20908
|
+
if (message === null)
|
|
20909
|
+
return null;
|
|
20910
|
+
messages.push(message);
|
|
20911
|
+
}
|
|
20912
|
+
return messages.join(`
|
|
20913
|
+
|
|
20914
|
+
`);
|
|
20915
|
+
}
|
|
20916
|
+
function markdownRows(rows, depth) {
|
|
20917
|
+
if (rows.length === 0)
|
|
20918
|
+
return "(none)";
|
|
20919
|
+
if (!isPlainObjectArray(rows)) {
|
|
20920
|
+
return rows.map((item) => `- ${markdownCell(item)}`).join(`
|
|
20921
|
+
`);
|
|
20922
|
+
}
|
|
20923
|
+
const prose = extractMessageSequence(rows);
|
|
20924
|
+
if (prose !== null)
|
|
20925
|
+
return prose;
|
|
20926
|
+
const table = markdownTable(rows);
|
|
20927
|
+
if (table !== null)
|
|
20928
|
+
return table;
|
|
20929
|
+
if (depth >= MARKDOWN_MAX_DEPTH) {
|
|
20930
|
+
return fencedBlock(JSON.stringify(rows, null, 2));
|
|
20931
|
+
}
|
|
20932
|
+
return rows.map((row, index) => [
|
|
20933
|
+
`${markdownHeading(depth)} ${index + 1}`,
|
|
20934
|
+
markdownObject(row, depth + 1)
|
|
20935
|
+
].join(`
|
|
20936
|
+
|
|
20937
|
+
`)).join(`
|
|
20938
|
+
|
|
20939
|
+
`);
|
|
20940
|
+
}
|
|
20941
|
+
function markdownObject(obj, depth) {
|
|
20942
|
+
const scalars = [];
|
|
20943
|
+
const blocks = [];
|
|
20944
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
20945
|
+
if (value === undefined)
|
|
20946
|
+
continue;
|
|
20947
|
+
const label = markdownLabel(key);
|
|
20948
|
+
if (Array.isArray(value)) {
|
|
20949
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
20950
|
+
|
|
20951
|
+
${markdownRows(value, depth + 1)}`);
|
|
20952
|
+
} else if (isNonEmptyPlainObject(value)) {
|
|
20953
|
+
const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
|
|
20954
|
+
if (nested !== "") {
|
|
20955
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
20956
|
+
|
|
20957
|
+
${nested}`);
|
|
20958
|
+
}
|
|
20959
|
+
} else if (typeof value === "string" && value.includes(`
|
|
20960
|
+
`)) {
|
|
20961
|
+
blocks.push(`**${label}:**
|
|
20962
|
+
|
|
20963
|
+
${fencedBlock(value)}`);
|
|
20964
|
+
} else {
|
|
20965
|
+
scalars.push(`**${label}:** ${markdownCell(value)}`);
|
|
20966
|
+
}
|
|
20967
|
+
}
|
|
20968
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
20969
|
+
`)] : [];
|
|
20970
|
+
sections.push(...blocks);
|
|
20971
|
+
return sections.join(`
|
|
20972
|
+
|
|
20973
|
+
`);
|
|
20974
|
+
}
|
|
20975
|
+
function extractSingleMessage(payload) {
|
|
20976
|
+
if (!isPlainRecord(payload))
|
|
20977
|
+
return null;
|
|
20978
|
+
const keys = Object.keys(payload);
|
|
20979
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
20980
|
+
return null;
|
|
20981
|
+
const value = payload[keys[0]];
|
|
20982
|
+
return typeof value === "string" ? value : null;
|
|
20983
|
+
}
|
|
20984
|
+
function markdownPayload(payload) {
|
|
20985
|
+
const message = extractSingleMessage(payload);
|
|
20986
|
+
if (message !== null)
|
|
20987
|
+
return message;
|
|
20988
|
+
if (Array.isArray(payload)) {
|
|
20989
|
+
return markdownRows(rowsWithoutPlumbing(payload), 0);
|
|
20990
|
+
}
|
|
20991
|
+
const visible = withoutPlumbing(payload);
|
|
20992
|
+
const paged = splitPagedEnvelope(visible);
|
|
20993
|
+
if (paged !== null) {
|
|
20994
|
+
const meta = markdownObject(paged.meta, 0);
|
|
20995
|
+
const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
|
|
20996
|
+
|
|
20997
|
+
${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
|
|
20998
|
+
return meta === "" ? rows : `${meta}
|
|
20999
|
+
|
|
21000
|
+
${rows}`;
|
|
21001
|
+
}
|
|
21002
|
+
return markdownObject(visible, 0);
|
|
21003
|
+
}
|
|
21004
|
+
function isPaginationWorthShowing(value) {
|
|
21005
|
+
if (typeof value !== "object" || value === null)
|
|
21006
|
+
return false;
|
|
21007
|
+
const page = value;
|
|
21008
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
21009
|
+
}
|
|
21010
|
+
function markdownEnvelopeNotes(data) {
|
|
21011
|
+
const envelope = data;
|
|
21012
|
+
const notes = [];
|
|
21013
|
+
const warning = envelope.Warning;
|
|
21014
|
+
if (typeof warning === "string" && warning !== "") {
|
|
21015
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
21016
|
+
}
|
|
21017
|
+
const instructions = envelope.Instructions;
|
|
21018
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
21019
|
+
notes.push(`> ${instructions}`);
|
|
21020
|
+
}
|
|
21021
|
+
const pagination = envelope.Pagination;
|
|
21022
|
+
if (isPaginationWorthShowing(pagination)) {
|
|
21023
|
+
const body = markdownObject(pagination, 1);
|
|
21024
|
+
if (body !== "") {
|
|
21025
|
+
notes.push(`${markdownHeading(0)} Pagination
|
|
21026
|
+
|
|
21027
|
+
${body}`);
|
|
21028
|
+
}
|
|
21029
|
+
}
|
|
21030
|
+
const log = envelope.Log;
|
|
21031
|
+
if (typeof log === "string" && log !== "") {
|
|
21032
|
+
notes.push(`**Log:** ${log}`);
|
|
21033
|
+
}
|
|
21034
|
+
return notes;
|
|
21035
|
+
}
|
|
21036
|
+
function renderMarkdown(data) {
|
|
21037
|
+
if (data.Result !== RESULTS.Success) {
|
|
21038
|
+
const failure = data;
|
|
21039
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
21040
|
+
if (failure.Data != null) {
|
|
21041
|
+
sections.push(markdownPayload(failure.Data));
|
|
21042
|
+
}
|
|
21043
|
+
if (failure.Instructions) {
|
|
21044
|
+
sections.push(`> ${failure.Instructions}`);
|
|
21045
|
+
}
|
|
21046
|
+
return sections.filter((section) => section !== "").join(`
|
|
21047
|
+
|
|
21048
|
+
`);
|
|
21049
|
+
}
|
|
21050
|
+
if (!("Data" in data) || data.Data == null) {
|
|
21051
|
+
return markdownObject(withoutPlumbing(data), 0);
|
|
21052
|
+
}
|
|
21053
|
+
return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
|
|
21054
|
+
|
|
21055
|
+
`);
|
|
21056
|
+
}
|
|
23292
21057
|
function toYaml(data) {
|
|
23293
21058
|
const codec = getYamlCodec();
|
|
23294
21059
|
if (!codec) {
|
|
@@ -25455,8 +23220,9 @@ var registerCommands = async (program2) => {
|
|
|
25455
23220
|
// ../apms-tool/package.json
|
|
25456
23221
|
var package_default2 = {
|
|
25457
23222
|
name: "@uipath/apms-tool",
|
|
23223
|
+
author: "UiPath",
|
|
25458
23224
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
25459
|
-
version: "1.
|
|
23225
|
+
version: "1.203.0-preview.180",
|
|
25460
23226
|
description: "CLI plugin for the UiPath Access Policy Management Service.",
|
|
25461
23227
|
private: false,
|
|
25462
23228
|
repository: {
|
|
@@ -25863,8 +23629,9 @@ class VoidApiResponse2 {
|
|
|
25863
23629
|
// ../apms-sdk/package.json
|
|
25864
23630
|
var package_default3 = {
|
|
25865
23631
|
name: "@uipath/apms-sdk",
|
|
23632
|
+
author: "UiPath",
|
|
25866
23633
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
25867
|
-
version: "1.
|
|
23634
|
+
version: "1.203.0",
|
|
25868
23635
|
description: "SDK for the UiPath Access Policy Management Service API.",
|
|
25869
23636
|
repository: {
|
|
25870
23637
|
type: "git",
|
|
@@ -27630,16 +25397,7 @@ var resolveEnvFilePathAsync2 = async (envFilePath = DEFAULT_ENV_FILENAME2, opts)
|
|
|
27630
25397
|
errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
|
|
27631
25398
|
};
|
|
27632
25399
|
};
|
|
27633
|
-
var
|
|
27634
|
-
const fs14 = getFileSystem3();
|
|
27635
|
-
const absolutePath = fs14.path.isAbsolute(envPath) ? envPath : fs14.path.join(fs14.env.cwd(), envPath);
|
|
27636
|
-
if (!await fs14.exists(absolutePath)) {
|
|
27637
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
27638
|
-
}
|
|
27639
|
-
const content = await fs14.readFile(absolutePath, "utf-8");
|
|
27640
|
-
if (content === null) {
|
|
27641
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
27642
|
-
}
|
|
25400
|
+
var parseEnvContent2 = (content) => {
|
|
27643
25401
|
const env = {};
|
|
27644
25402
|
for (const line of content.split(`
|
|
27645
25403
|
`)) {
|
|
@@ -27660,6 +25418,18 @@ var loadEnvFileAsync2 = async ({ envPath }) => {
|
|
|
27660
25418
|
}
|
|
27661
25419
|
return env;
|
|
27662
25420
|
};
|
|
25421
|
+
var loadEnvFileAsync2 = async ({ envPath }) => {
|
|
25422
|
+
const fs14 = getFileSystem3();
|
|
25423
|
+
const absolutePath = fs14.path.isAbsolute(envPath) ? envPath : fs14.path.join(fs14.env.cwd(), envPath);
|
|
25424
|
+
if (!await fs14.exists(absolutePath)) {
|
|
25425
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
25426
|
+
}
|
|
25427
|
+
const content = await fs14.readFile(absolutePath, "utf-8");
|
|
25428
|
+
if (content === null) {
|
|
25429
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
25430
|
+
}
|
|
25431
|
+
return parseEnvContent2(content);
|
|
25432
|
+
};
|
|
27663
25433
|
var saveEnvFileAsync2 = async ({
|
|
27664
25434
|
envPath,
|
|
27665
25435
|
data,
|
|
@@ -28200,6 +25970,8 @@ var getAuthContext = async (options = {}) => {
|
|
|
28200
25970
|
tenantName
|
|
28201
25971
|
};
|
|
28202
25972
|
};
|
|
25973
|
+
// ../../auth/src/authProfileDetails.ts
|
|
25974
|
+
init_src2();
|
|
28203
25975
|
// ../../auth/src/index.ts
|
|
28204
25976
|
init_constants2();
|
|
28205
25977
|
|
|
@@ -28516,7 +26288,7 @@ var UUID_PATTERN2 = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{
|
|
|
28516
26288
|
var EMAIL_PATTERN2 = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
28517
26289
|
var JWT_PATTERN2 = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
28518
26290
|
var LONG_TOKEN_PATTERN2 = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
28519
|
-
var PADDED_BASE64_PATTERN2 = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
26291
|
+
var PADDED_BASE64_PATTERN2 = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
28520
26292
|
var BASE64_WITH_PLUS_PATTERN2 = /[A-Za-z0-9+/]{40,}/g;
|
|
28521
26293
|
var USER_HOME_PATTERN2 = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
28522
26294
|
var UNC_PATH_PATTERN2 = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -28563,7 +26335,7 @@ var QUOTED_LITERAL_PATTERN2 = new RegExp([
|
|
|
28563
26335
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
28564
26336
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN2}}?"(?![A-Za-z0-9])`
|
|
28565
26337
|
].join("|"), "g");
|
|
28566
|
-
var JSON_BODY_PATTERN2 = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
26338
|
+
var JSON_BODY_PATTERN2 = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
28567
26339
|
var COLLAPSED_BODY2 = "{…}";
|
|
28568
26340
|
var COLLAPSED_BODY_MARKER2 = "\x01body\x01";
|
|
28569
26341
|
var MAX_BODY_NESTING2 = 8;
|
|
@@ -28578,10 +26350,13 @@ function collapseJsonBodies2(text) {
|
|
|
28578
26350
|
}
|
|
28579
26351
|
return out.split(COLLAPSED_BODY_MARKER2).join(COLLAPSED_BODY2);
|
|
28580
26352
|
}
|
|
28581
|
-
var TRAILING_PROSE_PUNCT2 =
|
|
26353
|
+
var TRAILING_PROSE_PUNCT2 = `.,;:!?)]}>'"`;
|
|
28582
26354
|
function peelTrailingPunctuation2(match) {
|
|
28583
|
-
|
|
28584
|
-
|
|
26355
|
+
let end = match.length;
|
|
26356
|
+
while (end > 0 && TRAILING_PROSE_PUNCT2.includes(match[end - 1])) {
|
|
26357
|
+
end -= 1;
|
|
26358
|
+
}
|
|
26359
|
+
return [match.slice(0, end), match.slice(end)];
|
|
28585
26360
|
}
|
|
28586
26361
|
function redactUrl2(raw) {
|
|
28587
26362
|
try {
|
|
@@ -28884,6 +26659,22 @@ function parseHttpStatusFromMessage3(message) {
|
|
|
28884
26659
|
const status = Number(match[1]);
|
|
28885
26660
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
28886
26661
|
}
|
|
26662
|
+
function findHttpStatusInGraph2(error) {
|
|
26663
|
+
for (const node of walkErrorGraph2(error)) {
|
|
26664
|
+
const response = node.response;
|
|
26665
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
26666
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
26667
|
+
return explicit;
|
|
26668
|
+
}
|
|
26669
|
+
if (typeof node.message === "string") {
|
|
26670
|
+
const parsed = parseHttpStatusFromMessage3(node.message);
|
|
26671
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
26672
|
+
return parsed;
|
|
26673
|
+
}
|
|
26674
|
+
}
|
|
26675
|
+
}
|
|
26676
|
+
return;
|
|
26677
|
+
}
|
|
28887
26678
|
function isHtmlDocument2(body) {
|
|
28888
26679
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
28889
26680
|
}
|
|
@@ -28997,7 +26788,8 @@ async function extractErrorDetails2(error, options) {
|
|
|
28997
26788
|
}
|
|
28998
26789
|
let message;
|
|
28999
26790
|
let result = "Failure";
|
|
29000
|
-
const
|
|
26791
|
+
const classificationStatus = status ?? findHttpStatusInGraph2(error);
|
|
26792
|
+
const classification = classifyError3(classificationStatus, error);
|
|
29001
26793
|
let retry = classification.retry;
|
|
29002
26794
|
if (status === 401) {
|
|
29003
26795
|
message = DEFAULT_4012;
|
|
@@ -29073,8 +26865,8 @@ async function extractErrorDetails2(error, options) {
|
|
|
29073
26865
|
details = describeThrownValue2(error);
|
|
29074
26866
|
}
|
|
29075
26867
|
const context = {};
|
|
29076
|
-
if (
|
|
29077
|
-
context.httpStatus =
|
|
26868
|
+
if (classificationStatus) {
|
|
26869
|
+
context.httpStatus = classificationStatus;
|
|
29078
26870
|
}
|
|
29079
26871
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
29080
26872
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -29642,7 +27434,8 @@ function readRegistryValue2(keyPath, valueName) {
|
|
|
29642
27434
|
}
|
|
29643
27435
|
const [error, output] = catchError5(() => execFileSync4("reg", ["query", keyPath, "/v", valueName], {
|
|
29644
27436
|
encoding: "utf-8",
|
|
29645
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
27437
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
27438
|
+
windowsHide: true
|
|
29646
27439
|
}));
|
|
29647
27440
|
if (error) {
|
|
29648
27441
|
return "";
|
|
@@ -30132,6 +27925,7 @@ class TelemetryService2 {
|
|
|
30132
27925
|
}
|
|
30133
27926
|
}
|
|
30134
27927
|
// ../../common/src/timings.ts
|
|
27928
|
+
init_src2();
|
|
30135
27929
|
var TIMINGS_ENV_VAR2 = "UIP_TIMINGS";
|
|
30136
27930
|
function createStorage5() {
|
|
30137
27931
|
const [error, mod] = catchError5(() => __require("node:async_hooks"));
|
|
@@ -30319,28 +28113,32 @@ function isPlainRecord2(value) {
|
|
|
30319
28113
|
const prototype = Object.getPrototypeOf(value);
|
|
30320
28114
|
return prototype === Object.prototype || prototype === null;
|
|
30321
28115
|
}
|
|
30322
|
-
function
|
|
28116
|
+
function splitPagedEnvelope2(value) {
|
|
30323
28117
|
if (Array.isArray(value) || !isPlainRecord2(value))
|
|
30324
28118
|
return null;
|
|
30325
|
-
const entries = Object.
|
|
28119
|
+
const entries = Object.entries(value);
|
|
30326
28120
|
if (entries.length === 0)
|
|
30327
28121
|
return null;
|
|
30328
|
-
let
|
|
30329
|
-
|
|
30330
|
-
for (const entry of entries) {
|
|
28122
|
+
let found = null;
|
|
28123
|
+
const meta = Object.create(null);
|
|
28124
|
+
for (const [key, entry] of entries) {
|
|
30331
28125
|
if (Array.isArray(entry)) {
|
|
30332
|
-
if (
|
|
28126
|
+
if (found !== null)
|
|
30333
28127
|
return null;
|
|
30334
|
-
|
|
28128
|
+
found = { key, rows: entry };
|
|
30335
28129
|
} else if (entry !== null && typeof entry === "object") {
|
|
30336
28130
|
return null;
|
|
30337
28131
|
} else {
|
|
30338
|
-
|
|
28132
|
+
meta[key] = entry;
|
|
30339
28133
|
}
|
|
30340
28134
|
}
|
|
30341
|
-
if (
|
|
28135
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
30342
28136
|
return null;
|
|
30343
|
-
return
|
|
28137
|
+
return { ...found, meta };
|
|
28138
|
+
}
|
|
28139
|
+
function extractPagedRows2(value) {
|
|
28140
|
+
const paged = splitPagedEnvelope2(value);
|
|
28141
|
+
return paged === null ? null : paged.rows;
|
|
30344
28142
|
}
|
|
30345
28143
|
function toLowerCamelCaseKey2(key) {
|
|
30346
28144
|
if (!key)
|
|
@@ -30444,6 +28242,9 @@ function printOutput2(data, format = "json", logFn, asciiSafe = false, tableRowS
|
|
|
30444
28242
|
}
|
|
30445
28243
|
break;
|
|
30446
28244
|
}
|
|
28245
|
+
case "markdown":
|
|
28246
|
+
logFn(renderMarkdown2(data));
|
|
28247
|
+
break;
|
|
30447
28248
|
default: {
|
|
30448
28249
|
const hasData = "Data" in data && data.Data != null;
|
|
30449
28250
|
const pagedRows = hasData ? extractPagedRows2(data.Data) : null;
|
|
@@ -30468,6 +28269,10 @@ function logOutput2(data, format = "json", tableRowStyle) {
|
|
|
30468
28269
|
printOutput2(data, format, (msg) => sink.writeOut(`${msg}
|
|
30469
28270
|
`), needsAsciiSafeJson2(sink), styleFn);
|
|
30470
28271
|
}
|
|
28272
|
+
var PLUMBING_KEYS2 = new Set(["code", "log"]);
|
|
28273
|
+
function isPlumbingKey2(key) {
|
|
28274
|
+
return PLUMBING_KEYS2.has(key.toLowerCase());
|
|
28275
|
+
}
|
|
30471
28276
|
function cellToString2(val) {
|
|
30472
28277
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
30473
28278
|
}
|
|
@@ -30483,7 +28288,7 @@ function wrapText2(text, width) {
|
|
|
30483
28288
|
function printTable2(data, logFn, externalLogValue, tableRowStyle) {
|
|
30484
28289
|
if (data.length === 0)
|
|
30485
28290
|
return;
|
|
30486
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
28291
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey2(key));
|
|
30487
28292
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString2(item[key]).length)));
|
|
30488
28293
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
30489
28294
|
logFn(header);
|
|
@@ -30505,7 +28310,7 @@ function isNonEmptyPlainObject2(value) {
|
|
|
30505
28310
|
}
|
|
30506
28311
|
var NESTED_INDENT2 = " ";
|
|
30507
28312
|
function printVerticalTable2(data, logFn = console.log, externalLogValue) {
|
|
30508
|
-
const keys = Object.keys(data).filter((key) => !
|
|
28313
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey2(key));
|
|
30509
28314
|
if (keys.length === 0)
|
|
30510
28315
|
return;
|
|
30511
28316
|
const isBlockValue = (value) => isPlainObjectArray2(value) || isNonEmptyPlainObject2(value);
|
|
@@ -30536,7 +28341,7 @@ function printVerticalTable2(data, logFn = console.log, externalLogValue) {
|
|
|
30536
28341
|
function printResizableTable2(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
30537
28342
|
if (data.length === 0)
|
|
30538
28343
|
return;
|
|
30539
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
28344
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey2(key));
|
|
30540
28345
|
if (keys.length === 0)
|
|
30541
28346
|
return;
|
|
30542
28347
|
if (!process.stdout.isTTY) {
|
|
@@ -30610,6 +28415,220 @@ function printResizableTable2(data, logFn = console.log, externalLogValue, avail
|
|
|
30610
28415
|
logFn(`Log: ${externalLogValue}`);
|
|
30611
28416
|
}
|
|
30612
28417
|
}
|
|
28418
|
+
var MARKDOWN_MAX_CELL2 = 200;
|
|
28419
|
+
var MARKDOWN_MAX_DEPTH2 = 3;
|
|
28420
|
+
function markdownHeading2(depth) {
|
|
28421
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
28422
|
+
}
|
|
28423
|
+
var BACKTICK_RUN2 = /`+/g;
|
|
28424
|
+
function fencedBlock2(text) {
|
|
28425
|
+
const first = text.trimStart()[0];
|
|
28426
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
28427
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN2), (match) => match[0].length));
|
|
28428
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
28429
|
+
return `${fence}${language}
|
|
28430
|
+
${text}
|
|
28431
|
+
${fence}`;
|
|
28432
|
+
}
|
|
28433
|
+
function collapseNewlineRuns2(text) {
|
|
28434
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
28435
|
+
`) ? " " : part).join("");
|
|
28436
|
+
}
|
|
28437
|
+
function markdownCell2(value) {
|
|
28438
|
+
const text = value instanceof Date ? value.toISOString() : cellToString2(value);
|
|
28439
|
+
return collapseNewlineRuns2(text).replace(/\|/g, "\\|");
|
|
28440
|
+
}
|
|
28441
|
+
function markdownLabel2(key) {
|
|
28442
|
+
return collapseNewlineRuns2(key).replace(/[\\`*|]/g, "\\$&");
|
|
28443
|
+
}
|
|
28444
|
+
function withoutPlumbing2(record) {
|
|
28445
|
+
const kept = Object.create(null);
|
|
28446
|
+
for (const [key, value] of Object.entries(record)) {
|
|
28447
|
+
if (!isPlumbingKey2(key))
|
|
28448
|
+
kept[key] = value;
|
|
28449
|
+
}
|
|
28450
|
+
return kept;
|
|
28451
|
+
}
|
|
28452
|
+
function rowsWithoutPlumbing2(rows) {
|
|
28453
|
+
return rows.map((row) => isPlainRecord2(row) ? withoutPlumbing2(row) : row);
|
|
28454
|
+
}
|
|
28455
|
+
function markdownTable2(rows) {
|
|
28456
|
+
const columns = [];
|
|
28457
|
+
const seen = new Set;
|
|
28458
|
+
for (const row of rows) {
|
|
28459
|
+
for (const key of Object.keys(row)) {
|
|
28460
|
+
if (!seen.has(key)) {
|
|
28461
|
+
seen.add(key);
|
|
28462
|
+
columns.push(key);
|
|
28463
|
+
}
|
|
28464
|
+
}
|
|
28465
|
+
}
|
|
28466
|
+
if (columns.length === 0)
|
|
28467
|
+
return null;
|
|
28468
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell2(row[key])));
|
|
28469
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL2))) {
|
|
28470
|
+
return null;
|
|
28471
|
+
}
|
|
28472
|
+
return [
|
|
28473
|
+
`| ${columns.map(markdownLabel2).join(" | ")} |`,
|
|
28474
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
28475
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
28476
|
+
].join(`
|
|
28477
|
+
`);
|
|
28478
|
+
}
|
|
28479
|
+
function extractMessageSequence2(rows) {
|
|
28480
|
+
const messages = [];
|
|
28481
|
+
for (const row of rows) {
|
|
28482
|
+
const message = extractSingleMessage2(row);
|
|
28483
|
+
if (message === null)
|
|
28484
|
+
return null;
|
|
28485
|
+
messages.push(message);
|
|
28486
|
+
}
|
|
28487
|
+
return messages.join(`
|
|
28488
|
+
|
|
28489
|
+
`);
|
|
28490
|
+
}
|
|
28491
|
+
function markdownRows2(rows, depth) {
|
|
28492
|
+
if (rows.length === 0)
|
|
28493
|
+
return "(none)";
|
|
28494
|
+
if (!isPlainObjectArray2(rows)) {
|
|
28495
|
+
return rows.map((item) => `- ${markdownCell2(item)}`).join(`
|
|
28496
|
+
`);
|
|
28497
|
+
}
|
|
28498
|
+
const prose = extractMessageSequence2(rows);
|
|
28499
|
+
if (prose !== null)
|
|
28500
|
+
return prose;
|
|
28501
|
+
const table = markdownTable2(rows);
|
|
28502
|
+
if (table !== null)
|
|
28503
|
+
return table;
|
|
28504
|
+
if (depth >= MARKDOWN_MAX_DEPTH2) {
|
|
28505
|
+
return fencedBlock2(JSON.stringify(rows, null, 2));
|
|
28506
|
+
}
|
|
28507
|
+
return rows.map((row, index) => [
|
|
28508
|
+
`${markdownHeading2(depth)} ${index + 1}`,
|
|
28509
|
+
markdownObject2(row, depth + 1)
|
|
28510
|
+
].join(`
|
|
28511
|
+
|
|
28512
|
+
`)).join(`
|
|
28513
|
+
|
|
28514
|
+
`);
|
|
28515
|
+
}
|
|
28516
|
+
function markdownObject2(obj, depth) {
|
|
28517
|
+
const scalars = [];
|
|
28518
|
+
const blocks = [];
|
|
28519
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
28520
|
+
if (value === undefined)
|
|
28521
|
+
continue;
|
|
28522
|
+
const label = markdownLabel2(key);
|
|
28523
|
+
if (Array.isArray(value)) {
|
|
28524
|
+
blocks.push(`${markdownHeading2(depth)} ${label}
|
|
28525
|
+
|
|
28526
|
+
${markdownRows2(value, depth + 1)}`);
|
|
28527
|
+
} else if (isNonEmptyPlainObject2(value)) {
|
|
28528
|
+
const nested = depth < MARKDOWN_MAX_DEPTH2 ? markdownObject2(value, depth + 1) : fencedBlock2(JSON.stringify(value, null, 2));
|
|
28529
|
+
if (nested !== "") {
|
|
28530
|
+
blocks.push(`${markdownHeading2(depth)} ${label}
|
|
28531
|
+
|
|
28532
|
+
${nested}`);
|
|
28533
|
+
}
|
|
28534
|
+
} else if (typeof value === "string" && value.includes(`
|
|
28535
|
+
`)) {
|
|
28536
|
+
blocks.push(`**${label}:**
|
|
28537
|
+
|
|
28538
|
+
${fencedBlock2(value)}`);
|
|
28539
|
+
} else {
|
|
28540
|
+
scalars.push(`**${label}:** ${markdownCell2(value)}`);
|
|
28541
|
+
}
|
|
28542
|
+
}
|
|
28543
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
28544
|
+
`)] : [];
|
|
28545
|
+
sections.push(...blocks);
|
|
28546
|
+
return sections.join(`
|
|
28547
|
+
|
|
28548
|
+
`);
|
|
28549
|
+
}
|
|
28550
|
+
function extractSingleMessage2(payload) {
|
|
28551
|
+
if (!isPlainRecord2(payload))
|
|
28552
|
+
return null;
|
|
28553
|
+
const keys = Object.keys(payload);
|
|
28554
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
28555
|
+
return null;
|
|
28556
|
+
const value = payload[keys[0]];
|
|
28557
|
+
return typeof value === "string" ? value : null;
|
|
28558
|
+
}
|
|
28559
|
+
function markdownPayload2(payload) {
|
|
28560
|
+
const message = extractSingleMessage2(payload);
|
|
28561
|
+
if (message !== null)
|
|
28562
|
+
return message;
|
|
28563
|
+
if (Array.isArray(payload)) {
|
|
28564
|
+
return markdownRows2(rowsWithoutPlumbing2(payload), 0);
|
|
28565
|
+
}
|
|
28566
|
+
const visible = withoutPlumbing2(payload);
|
|
28567
|
+
const paged = splitPagedEnvelope2(visible);
|
|
28568
|
+
if (paged !== null) {
|
|
28569
|
+
const meta = markdownObject2(paged.meta, 0);
|
|
28570
|
+
const rows = `${markdownHeading2(0)} ${markdownLabel2(paged.key)}
|
|
28571
|
+
|
|
28572
|
+
${markdownRows2(rowsWithoutPlumbing2(paged.rows), 1)}`;
|
|
28573
|
+
return meta === "" ? rows : `${meta}
|
|
28574
|
+
|
|
28575
|
+
${rows}`;
|
|
28576
|
+
}
|
|
28577
|
+
return markdownObject2(visible, 0);
|
|
28578
|
+
}
|
|
28579
|
+
function isPaginationWorthShowing2(value) {
|
|
28580
|
+
if (typeof value !== "object" || value === null)
|
|
28581
|
+
return false;
|
|
28582
|
+
const page = value;
|
|
28583
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
28584
|
+
}
|
|
28585
|
+
function markdownEnvelopeNotes2(data) {
|
|
28586
|
+
const envelope = data;
|
|
28587
|
+
const notes = [];
|
|
28588
|
+
const warning = envelope.Warning;
|
|
28589
|
+
if (typeof warning === "string" && warning !== "") {
|
|
28590
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
28591
|
+
}
|
|
28592
|
+
const instructions = envelope.Instructions;
|
|
28593
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
28594
|
+
notes.push(`> ${instructions}`);
|
|
28595
|
+
}
|
|
28596
|
+
const pagination = envelope.Pagination;
|
|
28597
|
+
if (isPaginationWorthShowing2(pagination)) {
|
|
28598
|
+
const body = markdownObject2(pagination, 1);
|
|
28599
|
+
if (body !== "") {
|
|
28600
|
+
notes.push(`${markdownHeading2(0)} Pagination
|
|
28601
|
+
|
|
28602
|
+
${body}`);
|
|
28603
|
+
}
|
|
28604
|
+
}
|
|
28605
|
+
const log = envelope.Log;
|
|
28606
|
+
if (typeof log === "string" && log !== "") {
|
|
28607
|
+
notes.push(`**Log:** ${log}`);
|
|
28608
|
+
}
|
|
28609
|
+
return notes;
|
|
28610
|
+
}
|
|
28611
|
+
function renderMarkdown2(data) {
|
|
28612
|
+
if (data.Result !== RESULTS2.Success) {
|
|
28613
|
+
const failure = data;
|
|
28614
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
28615
|
+
if (failure.Data != null) {
|
|
28616
|
+
sections.push(markdownPayload2(failure.Data));
|
|
28617
|
+
}
|
|
28618
|
+
if (failure.Instructions) {
|
|
28619
|
+
sections.push(`> ${failure.Instructions}`);
|
|
28620
|
+
}
|
|
28621
|
+
return sections.filter((section) => section !== "").join(`
|
|
28622
|
+
|
|
28623
|
+
`);
|
|
28624
|
+
}
|
|
28625
|
+
if (!("Data" in data) || data.Data == null) {
|
|
28626
|
+
return markdownObject2(withoutPlumbing2(data), 0);
|
|
28627
|
+
}
|
|
28628
|
+
return [markdownPayload2(data.Data), ...markdownEnvelopeNotes2(data)].filter((section) => section !== "").join(`
|
|
28629
|
+
|
|
28630
|
+
`);
|
|
28631
|
+
}
|
|
30613
28632
|
function toYaml2(data) {
|
|
30614
28633
|
const codec = getYamlCodec2();
|
|
30615
28634
|
if (!codec) {
|
|
@@ -33008,8 +31027,9 @@ class VoidApiResponse3 {
|
|
|
33008
31027
|
// ../audit-sdk/package.json
|
|
33009
31028
|
var package_default4 = {
|
|
33010
31029
|
name: "@uipath/audit-sdk",
|
|
31030
|
+
author: "UiPath",
|
|
33011
31031
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
33012
|
-
version: "1.
|
|
31032
|
+
version: "1.203.0",
|
|
33013
31033
|
description: "SDK for the UiPath Audit Service — query audit event sources, list events, and download long-term-store exports.",
|
|
33014
31034
|
repository: {
|
|
33015
31035
|
type: "git",
|
|
@@ -33329,7 +31349,417 @@ init_src2();
|
|
|
33329
31349
|
|
|
33330
31350
|
// ../audit-commands/src/utils/chunked-export.ts
|
|
33331
31351
|
import { Buffer as Buffer4 } from "node:buffer";
|
|
33332
|
-
|
|
31352
|
+
|
|
31353
|
+
// ../../../node_modules/fflate/esm/index.mjs
|
|
31354
|
+
import { createRequire as createRequire4 } from "module";
|
|
31355
|
+
var require2 = createRequire4("/");
|
|
31356
|
+
var _a;
|
|
31357
|
+
var Worker;
|
|
31358
|
+
var isMarkedAsUntransferable;
|
|
31359
|
+
try {
|
|
31360
|
+
_a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
|
|
31361
|
+
} catch (e) {}
|
|
31362
|
+
var u8 = Uint8Array;
|
|
31363
|
+
var u16 = Uint16Array;
|
|
31364
|
+
var i32 = Int32Array;
|
|
31365
|
+
var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]);
|
|
31366
|
+
var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]);
|
|
31367
|
+
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
31368
|
+
var freb = function(eb, start) {
|
|
31369
|
+
var b = new u16(31);
|
|
31370
|
+
for (var i = 0;i < 31; ++i) {
|
|
31371
|
+
b[i] = start += 1 << eb[i - 1];
|
|
31372
|
+
}
|
|
31373
|
+
var r = new i32(b[30]);
|
|
31374
|
+
for (var i = 1;i < 30; ++i) {
|
|
31375
|
+
for (var j = b[i];j < b[i + 1]; ++j) {
|
|
31376
|
+
r[j] = j - b[i] << 5 | i;
|
|
31377
|
+
}
|
|
31378
|
+
}
|
|
31379
|
+
return { b, r };
|
|
31380
|
+
};
|
|
31381
|
+
var _a = freb(fleb, 2);
|
|
31382
|
+
var fl = _a.b;
|
|
31383
|
+
var revfl = _a.r;
|
|
31384
|
+
fl[28] = 258, revfl[258] = 28;
|
|
31385
|
+
var _b = freb(fdeb, 0);
|
|
31386
|
+
var fd = _b.b;
|
|
31387
|
+
var revfd = _b.r;
|
|
31388
|
+
var rev = new u16(32768);
|
|
31389
|
+
for (i = 0;i < 32768; ++i) {
|
|
31390
|
+
x = (i & 43690) >> 1 | (i & 21845) << 1;
|
|
31391
|
+
x = (x & 52428) >> 2 | (x & 13107) << 2;
|
|
31392
|
+
x = (x & 61680) >> 4 | (x & 3855) << 4;
|
|
31393
|
+
rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
|
|
31394
|
+
}
|
|
31395
|
+
var x;
|
|
31396
|
+
var i;
|
|
31397
|
+
var hMap = function(cd, mb, r) {
|
|
31398
|
+
var s = cd.length;
|
|
31399
|
+
var i2 = 0;
|
|
31400
|
+
var l = new u16(mb);
|
|
31401
|
+
for (;i2 < s; ++i2) {
|
|
31402
|
+
if (cd[i2])
|
|
31403
|
+
++l[cd[i2] - 1];
|
|
31404
|
+
}
|
|
31405
|
+
var le = new u16(mb);
|
|
31406
|
+
for (i2 = 1;i2 < mb; ++i2) {
|
|
31407
|
+
le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
|
|
31408
|
+
}
|
|
31409
|
+
var co;
|
|
31410
|
+
if (r) {
|
|
31411
|
+
co = new u16(1 << mb);
|
|
31412
|
+
var rvb = 15 - mb;
|
|
31413
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
31414
|
+
if (cd[i2]) {
|
|
31415
|
+
var sv = i2 << 4 | cd[i2];
|
|
31416
|
+
var r_1 = mb - cd[i2];
|
|
31417
|
+
var v = le[cd[i2] - 1]++ << r_1;
|
|
31418
|
+
for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
|
|
31419
|
+
co[rev[v] >> rvb] = sv;
|
|
31420
|
+
}
|
|
31421
|
+
}
|
|
31422
|
+
}
|
|
31423
|
+
} else {
|
|
31424
|
+
co = new u16(s);
|
|
31425
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
31426
|
+
if (cd[i2]) {
|
|
31427
|
+
co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
|
|
31428
|
+
}
|
|
31429
|
+
}
|
|
31430
|
+
}
|
|
31431
|
+
return co;
|
|
31432
|
+
};
|
|
31433
|
+
var flt = new u8(288);
|
|
31434
|
+
for (i = 0;i < 144; ++i)
|
|
31435
|
+
flt[i] = 8;
|
|
31436
|
+
var i;
|
|
31437
|
+
for (i = 144;i < 256; ++i)
|
|
31438
|
+
flt[i] = 9;
|
|
31439
|
+
var i;
|
|
31440
|
+
for (i = 256;i < 280; ++i)
|
|
31441
|
+
flt[i] = 7;
|
|
31442
|
+
var i;
|
|
31443
|
+
for (i = 280;i < 288; ++i)
|
|
31444
|
+
flt[i] = 8;
|
|
31445
|
+
var i;
|
|
31446
|
+
var fdt = new u8(32);
|
|
31447
|
+
for (i = 0;i < 32; ++i)
|
|
31448
|
+
fdt[i] = 5;
|
|
31449
|
+
var i;
|
|
31450
|
+
var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
|
|
31451
|
+
var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
|
|
31452
|
+
var max = function(a) {
|
|
31453
|
+
var m = a[0];
|
|
31454
|
+
for (var i2 = 1;i2 < a.length; ++i2) {
|
|
31455
|
+
if (a[i2] > m)
|
|
31456
|
+
m = a[i2];
|
|
31457
|
+
}
|
|
31458
|
+
return m;
|
|
31459
|
+
};
|
|
31460
|
+
var bits = function(d, p, m) {
|
|
31461
|
+
var o = p / 8 | 0;
|
|
31462
|
+
return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
|
|
31463
|
+
};
|
|
31464
|
+
var bits16 = function(d, p) {
|
|
31465
|
+
var o = p / 8 | 0;
|
|
31466
|
+
return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
|
|
31467
|
+
};
|
|
31468
|
+
var shft = function(p) {
|
|
31469
|
+
return (p + 7) / 8 | 0;
|
|
31470
|
+
};
|
|
31471
|
+
var slc = function(v, s, e) {
|
|
31472
|
+
if (s == null || s < 0)
|
|
31473
|
+
s = 0;
|
|
31474
|
+
if (e == null || e > v.length)
|
|
31475
|
+
e = v.length;
|
|
31476
|
+
return new u8(v.subarray(s, e));
|
|
31477
|
+
};
|
|
31478
|
+
var ec = [
|
|
31479
|
+
"unexpected EOF",
|
|
31480
|
+
"invalid block type",
|
|
31481
|
+
"invalid length/literal",
|
|
31482
|
+
"invalid distance",
|
|
31483
|
+
"stream finished",
|
|
31484
|
+
"no stream handler",
|
|
31485
|
+
,
|
|
31486
|
+
"no callback",
|
|
31487
|
+
"invalid UTF-8 data",
|
|
31488
|
+
"extra field too long",
|
|
31489
|
+
"date not in range 1980-2099",
|
|
31490
|
+
"filename too long",
|
|
31491
|
+
"stream finishing",
|
|
31492
|
+
"invalid zip data"
|
|
31493
|
+
];
|
|
31494
|
+
var err = function(ind, msg, nt) {
|
|
31495
|
+
var e = new Error(msg || ec[ind]);
|
|
31496
|
+
e.code = ind;
|
|
31497
|
+
if (Error.captureStackTrace)
|
|
31498
|
+
Error.captureStackTrace(e, err);
|
|
31499
|
+
if (!nt)
|
|
31500
|
+
throw e;
|
|
31501
|
+
return e;
|
|
31502
|
+
};
|
|
31503
|
+
var inflt = function(dat, st, buf, dict) {
|
|
31504
|
+
var sl = dat.length, dl = dict ? dict.length : 0;
|
|
31505
|
+
if (!sl || st.f && !st.l)
|
|
31506
|
+
return buf || new u8(0);
|
|
31507
|
+
var noBuf = !buf;
|
|
31508
|
+
var resize = noBuf || st.i != 2;
|
|
31509
|
+
var noSt = st.i;
|
|
31510
|
+
if (noBuf)
|
|
31511
|
+
buf = new u8(sl * 3);
|
|
31512
|
+
var cbuf = function(l2) {
|
|
31513
|
+
var bl = buf.length;
|
|
31514
|
+
if (l2 > bl) {
|
|
31515
|
+
var nbuf = new u8(Math.max(bl * 2, l2));
|
|
31516
|
+
nbuf.set(buf);
|
|
31517
|
+
buf = nbuf;
|
|
31518
|
+
}
|
|
31519
|
+
};
|
|
31520
|
+
var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
|
|
31521
|
+
var tbts = sl * 8;
|
|
31522
|
+
do {
|
|
31523
|
+
if (!lm) {
|
|
31524
|
+
final = bits(dat, pos, 1);
|
|
31525
|
+
var type3 = bits(dat, pos + 1, 3);
|
|
31526
|
+
pos += 3;
|
|
31527
|
+
if (!type3) {
|
|
31528
|
+
var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
|
|
31529
|
+
if (t > sl) {
|
|
31530
|
+
if (noSt)
|
|
31531
|
+
err(0);
|
|
31532
|
+
break;
|
|
31533
|
+
}
|
|
31534
|
+
if (resize)
|
|
31535
|
+
cbuf(bt + l);
|
|
31536
|
+
buf.set(dat.subarray(s, t), bt);
|
|
31537
|
+
st.b = bt += l, st.p = pos = t * 8, st.f = final;
|
|
31538
|
+
continue;
|
|
31539
|
+
} else if (type3 == 1)
|
|
31540
|
+
lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
|
|
31541
|
+
else if (type3 == 2) {
|
|
31542
|
+
var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
|
|
31543
|
+
var tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
31544
|
+
pos += 14;
|
|
31545
|
+
var ldt = new u8(tl);
|
|
31546
|
+
var clt = new u8(19);
|
|
31547
|
+
for (var i2 = 0;i2 < hcLen; ++i2) {
|
|
31548
|
+
clt[clim[i2]] = bits(dat, pos + i2 * 3, 7);
|
|
31549
|
+
}
|
|
31550
|
+
pos += hcLen * 3;
|
|
31551
|
+
var clb = max(clt), clbmsk = (1 << clb) - 1;
|
|
31552
|
+
var clm = hMap(clt, clb, 1);
|
|
31553
|
+
for (var i2 = 0;i2 < tl; ) {
|
|
31554
|
+
var r = clm[bits(dat, pos, clbmsk)];
|
|
31555
|
+
pos += r & 15;
|
|
31556
|
+
var s = r >> 4;
|
|
31557
|
+
if (s < 16) {
|
|
31558
|
+
ldt[i2++] = s;
|
|
31559
|
+
} else {
|
|
31560
|
+
var c = 0, n = 0;
|
|
31561
|
+
if (s == 16)
|
|
31562
|
+
n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i2 - 1];
|
|
31563
|
+
else if (s == 17)
|
|
31564
|
+
n = 3 + bits(dat, pos, 7), pos += 3;
|
|
31565
|
+
else if (s == 18)
|
|
31566
|
+
n = 11 + bits(dat, pos, 127), pos += 7;
|
|
31567
|
+
while (n--)
|
|
31568
|
+
ldt[i2++] = c;
|
|
31569
|
+
}
|
|
31570
|
+
}
|
|
31571
|
+
var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
|
|
31572
|
+
lbt = max(lt);
|
|
31573
|
+
dbt = max(dt);
|
|
31574
|
+
lm = hMap(lt, lbt, 1);
|
|
31575
|
+
dm = hMap(dt, dbt, 1);
|
|
31576
|
+
} else
|
|
31577
|
+
err(1);
|
|
31578
|
+
if (pos > tbts) {
|
|
31579
|
+
if (noSt)
|
|
31580
|
+
err(0);
|
|
31581
|
+
break;
|
|
31582
|
+
}
|
|
31583
|
+
}
|
|
31584
|
+
if (resize)
|
|
31585
|
+
cbuf(bt + 131072);
|
|
31586
|
+
var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
|
|
31587
|
+
var lpos = pos;
|
|
31588
|
+
for (;; lpos = pos) {
|
|
31589
|
+
var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
|
|
31590
|
+
pos += c & 15;
|
|
31591
|
+
if (pos > tbts) {
|
|
31592
|
+
if (noSt)
|
|
31593
|
+
err(0);
|
|
31594
|
+
break;
|
|
31595
|
+
}
|
|
31596
|
+
if (!c)
|
|
31597
|
+
err(2);
|
|
31598
|
+
if (sym < 256)
|
|
31599
|
+
buf[bt++] = sym;
|
|
31600
|
+
else if (sym == 256) {
|
|
31601
|
+
lpos = pos, lm = null;
|
|
31602
|
+
break;
|
|
31603
|
+
} else {
|
|
31604
|
+
var add = sym - 254;
|
|
31605
|
+
if (sym > 264) {
|
|
31606
|
+
var i2 = sym - 257, b = fleb[i2];
|
|
31607
|
+
add = bits(dat, pos, (1 << b) - 1) + fl[i2];
|
|
31608
|
+
pos += b;
|
|
31609
|
+
}
|
|
31610
|
+
var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
|
|
31611
|
+
if (!d)
|
|
31612
|
+
err(3);
|
|
31613
|
+
pos += d & 15;
|
|
31614
|
+
var dt = fd[dsym];
|
|
31615
|
+
if (dsym > 3) {
|
|
31616
|
+
var b = fdeb[dsym];
|
|
31617
|
+
dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
|
|
31618
|
+
}
|
|
31619
|
+
if (pos > tbts) {
|
|
31620
|
+
if (noSt)
|
|
31621
|
+
err(0);
|
|
31622
|
+
break;
|
|
31623
|
+
}
|
|
31624
|
+
if (resize)
|
|
31625
|
+
cbuf(bt + 131072);
|
|
31626
|
+
var end = bt + add;
|
|
31627
|
+
if (bt < dt) {
|
|
31628
|
+
var shift = dl - dt, dend = Math.min(dt, end);
|
|
31629
|
+
if (shift + bt < 0)
|
|
31630
|
+
err(3);
|
|
31631
|
+
for (;bt < dend; ++bt)
|
|
31632
|
+
buf[bt] = dict[shift + bt];
|
|
31633
|
+
}
|
|
31634
|
+
for (;bt < end; ++bt)
|
|
31635
|
+
buf[bt] = buf[bt - dt];
|
|
31636
|
+
}
|
|
31637
|
+
}
|
|
31638
|
+
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
31639
|
+
if (lm)
|
|
31640
|
+
final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
31641
|
+
} while (!final);
|
|
31642
|
+
return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
|
|
31643
|
+
};
|
|
31644
|
+
var et = /* @__PURE__ */ new u8(0);
|
|
31645
|
+
var b2 = function(d, b) {
|
|
31646
|
+
return d[b] | d[b + 1] << 8;
|
|
31647
|
+
};
|
|
31648
|
+
var b4 = function(d, b) {
|
|
31649
|
+
return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
|
|
31650
|
+
};
|
|
31651
|
+
var b8 = function(d, b) {
|
|
31652
|
+
return b4(d, b) + b4(d, b + 4) * 4294967296;
|
|
31653
|
+
};
|
|
31654
|
+
function inflateSync(data, opts) {
|
|
31655
|
+
return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
|
|
31656
|
+
}
|
|
31657
|
+
var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
|
|
31658
|
+
var tds = 0;
|
|
31659
|
+
try {
|
|
31660
|
+
td.decode(et, { stream: true });
|
|
31661
|
+
tds = 1;
|
|
31662
|
+
} catch (e) {}
|
|
31663
|
+
var dutf8 = function(d) {
|
|
31664
|
+
for (var r = "", i2 = 0;; ) {
|
|
31665
|
+
var c = d[i2++];
|
|
31666
|
+
var eb = (c > 127) + (c > 223) + (c > 239);
|
|
31667
|
+
if (i2 + eb > d.length)
|
|
31668
|
+
return { s: r, r: slc(d, i2 - 1) };
|
|
31669
|
+
if (!eb)
|
|
31670
|
+
r += String.fromCharCode(c);
|
|
31671
|
+
else if (eb == 3) {
|
|
31672
|
+
c = ((c & 15) << 18 | (d[i2++] & 63) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
|
|
31673
|
+
} else if (eb & 1)
|
|
31674
|
+
r += String.fromCharCode((c & 31) << 6 | d[i2++] & 63);
|
|
31675
|
+
else
|
|
31676
|
+
r += String.fromCharCode((c & 15) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63);
|
|
31677
|
+
}
|
|
31678
|
+
};
|
|
31679
|
+
function strFromU8(dat, latin1) {
|
|
31680
|
+
if (latin1) {
|
|
31681
|
+
var r = "";
|
|
31682
|
+
for (var i2 = 0;i2 < dat.length; i2 += 16384)
|
|
31683
|
+
r += String.fromCharCode.apply(null, dat.subarray(i2, i2 + 16384));
|
|
31684
|
+
return r;
|
|
31685
|
+
} else if (td) {
|
|
31686
|
+
return td.decode(dat);
|
|
31687
|
+
} else {
|
|
31688
|
+
var _a2 = dutf8(dat), s = _a2.s, r = _a2.r;
|
|
31689
|
+
if (r.length)
|
|
31690
|
+
err(8);
|
|
31691
|
+
return s;
|
|
31692
|
+
}
|
|
31693
|
+
}
|
|
31694
|
+
var slzh = function(d, b) {
|
|
31695
|
+
return b + 30 + b2(d, b + 26) + b2(d, b + 28);
|
|
31696
|
+
};
|
|
31697
|
+
var zh = function(d, b, z) {
|
|
31698
|
+
var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
|
|
31699
|
+
var _a2 = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
|
|
31700
|
+
return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
|
|
31701
|
+
};
|
|
31702
|
+
var z64hs = function(d, b, l, z, sc, su, off) {
|
|
31703
|
+
var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
|
|
31704
|
+
var nf = nsc + nsu + noff;
|
|
31705
|
+
if (z && nf) {
|
|
31706
|
+
for (;b + 4 < e; b += 4 + b2(d, b + 2)) {
|
|
31707
|
+
if (b2(d, b) == 1) {
|
|
31708
|
+
return [
|
|
31709
|
+
nsc ? b8(d, b + 4 + 8 * nsu) : sc,
|
|
31710
|
+
nsu ? b8(d, b + 4) : su,
|
|
31711
|
+
noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
|
|
31712
|
+
1
|
|
31713
|
+
];
|
|
31714
|
+
}
|
|
31715
|
+
}
|
|
31716
|
+
if (z < 2)
|
|
31717
|
+
err(13);
|
|
31718
|
+
}
|
|
31719
|
+
return [sc, su, off, 0];
|
|
31720
|
+
};
|
|
31721
|
+
function unzipSync(data, opts) {
|
|
31722
|
+
var files = {};
|
|
31723
|
+
var e = data.length - 22;
|
|
31724
|
+
for (;b4(data, e) != 101010256; --e) {
|
|
31725
|
+
if (!e || data.length - e > 65558)
|
|
31726
|
+
err(13);
|
|
31727
|
+
}
|
|
31728
|
+
var c = b2(data, e + 8);
|
|
31729
|
+
if (!c)
|
|
31730
|
+
return {};
|
|
31731
|
+
var o = b4(data, e + 16);
|
|
31732
|
+
var z = b4(data, e - 20) == 117853008;
|
|
31733
|
+
if (z) {
|
|
31734
|
+
var ze = b4(data, e - 12);
|
|
31735
|
+
z = b4(data, ze) == 101075792;
|
|
31736
|
+
if (z) {
|
|
31737
|
+
c = b4(data, ze + 32);
|
|
31738
|
+
o = b4(data, ze + 48);
|
|
31739
|
+
}
|
|
31740
|
+
}
|
|
31741
|
+
var fltr = opts && opts.filter;
|
|
31742
|
+
for (var i2 = 0;i2 < c; ++i2) {
|
|
31743
|
+
var _a2 = zh(data, o, z), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
|
|
31744
|
+
o = no;
|
|
31745
|
+
if (!fltr || fltr({
|
|
31746
|
+
name: fn,
|
|
31747
|
+
size: sc,
|
|
31748
|
+
originalSize: su,
|
|
31749
|
+
compression: c_2
|
|
31750
|
+
})) {
|
|
31751
|
+
if (!c_2)
|
|
31752
|
+
files[fn] = slc(data, b, b + sc);
|
|
31753
|
+
else if (c_2 == 8)
|
|
31754
|
+
files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });
|
|
31755
|
+
else
|
|
31756
|
+
err(14, "unknown compression type " + c_2);
|
|
31757
|
+
}
|
|
31758
|
+
}
|
|
31759
|
+
return files;
|
|
31760
|
+
}
|
|
31761
|
+
|
|
31762
|
+
// ../audit-commands/src/utils/chunked-export.ts
|
|
33333
31763
|
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
33334
31764
|
function startOfUtcDay(d) {
|
|
33335
31765
|
return new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), 0, 0, 0, 0));
|
|
@@ -33373,41 +31803,38 @@ async function forEachExportEntry(api, from, to, onEntry) {
|
|
|
33373
31803
|
from: chunkFrom,
|
|
33374
31804
|
to: chunkTo
|
|
33375
31805
|
});
|
|
33376
|
-
} catch (
|
|
33377
|
-
if (
|
|
33378
|
-
const body = await
|
|
33379
|
-
throw new Error(`Audit export failed for ${isoDay} (HTTP ${
|
|
31806
|
+
} catch (err2) {
|
|
31807
|
+
if (err2 instanceof ResponseError3) {
|
|
31808
|
+
const body = await err2.response.text().catch(() => "");
|
|
31809
|
+
throw new Error(`Audit export failed for ${isoDay} (HTTP ${err2.response.status}): ${body.slice(0, 500)}`);
|
|
33380
31810
|
}
|
|
33381
|
-
throw new Error(`Audit export failed for ${isoDay}: ${
|
|
31811
|
+
throw new Error(`Audit export failed for ${isoDay}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
33382
31812
|
}
|
|
33383
31813
|
const dayBuffer = Buffer4.from(await response.raw.arrayBuffer());
|
|
33384
31814
|
if (dayBuffer.byteLength === 0)
|
|
33385
31815
|
continue;
|
|
33386
31816
|
let dayHadEntries = false;
|
|
33387
|
-
const
|
|
33388
|
-
|
|
33389
|
-
if (entry.isDirectory)
|
|
31817
|
+
for (const [entryName, entryData] of Object.entries(unzipSync(new Uint8Array(dayBuffer)))) {
|
|
31818
|
+
if (entryName.endsWith("/"))
|
|
33390
31819
|
continue;
|
|
33391
|
-
|
|
33392
|
-
|
|
33393
|
-
const
|
|
33394
|
-
|
|
33395
|
-
for (const innerEntry of nested.getEntries()) {
|
|
33396
|
-
if (innerEntry.isDirectory)
|
|
31820
|
+
if (/\.zip$/i.test(entryName)) {
|
|
31821
|
+
const outerBase = basenameNoExt(entryName);
|
|
31822
|
+
for (const [innerName, innerData] of Object.entries(unzipSync(entryData))) {
|
|
31823
|
+
if (innerName.endsWith("/"))
|
|
33397
31824
|
continue;
|
|
33398
|
-
const innerBase = basenameNoExt(
|
|
31825
|
+
const innerBase = basenameNoExt(innerName);
|
|
33399
31826
|
onEntry({
|
|
33400
31827
|
isoDay,
|
|
33401
31828
|
preferredName: `${innerBase}_${outerBase}.txt`,
|
|
33402
|
-
data:
|
|
31829
|
+
data: Buffer4.from(innerData)
|
|
33403
31830
|
});
|
|
33404
31831
|
dayHadEntries = true;
|
|
33405
31832
|
}
|
|
33406
31833
|
} else {
|
|
33407
31834
|
onEntry({
|
|
33408
31835
|
isoDay,
|
|
33409
|
-
preferredName: basename4(
|
|
33410
|
-
data: entryData
|
|
31836
|
+
preferredName: basename4(entryName),
|
|
31837
|
+
data: Buffer4.from(entryData)
|
|
33411
31838
|
});
|
|
33412
31839
|
dayHadEntries = true;
|
|
33413
31840
|
}
|
|
@@ -33486,8 +31913,8 @@ function parseDailyEvents(data, isoDay, fileName) {
|
|
|
33486
31913
|
let parsed;
|
|
33487
31914
|
try {
|
|
33488
31915
|
parsed = JSON.parse(text);
|
|
33489
|
-
} catch (
|
|
33490
|
-
throw new Error(`Audit export for ${isoDay} returned a file (${fileName}) that is not valid JSON: ${
|
|
31916
|
+
} catch (err2) {
|
|
31917
|
+
throw new Error(`Audit export for ${isoDay} returned a file (${fileName}) that is not valid JSON: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
33491
31918
|
}
|
|
33492
31919
|
if (Array.isArray(parsed))
|
|
33493
31920
|
return parsed;
|
|
@@ -34212,8 +32639,9 @@ class VoidApiResponse4 {
|
|
|
34212
32639
|
// ../authz-sdk/package.json
|
|
34213
32640
|
var package_default5 = {
|
|
34214
32641
|
name: "@uipath/authz-sdk",
|
|
32642
|
+
author: "UiPath",
|
|
34215
32643
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
34216
|
-
version: "1.
|
|
32644
|
+
version: "1.203.0",
|
|
34217
32645
|
description: "SDK for the UiPath Authorization Service API.",
|
|
34218
32646
|
repository: {
|
|
34219
32647
|
type: "git",
|
|
@@ -35071,8 +33499,9 @@ class TextApiResponse {
|
|
|
35071
33499
|
// ../identity-sdk/package.json
|
|
35072
33500
|
var package_default6 = {
|
|
35073
33501
|
name: "@uipath/identity-sdk",
|
|
33502
|
+
author: "UiPath",
|
|
35074
33503
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
35075
|
-
version: "1.
|
|
33504
|
+
version: "1.203.0",
|
|
35076
33505
|
repository: {
|
|
35077
33506
|
type: "git",
|
|
35078
33507
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -37697,11 +36126,11 @@ async function loadJsonFile2(file, typeLabel) {
|
|
|
37697
36126
|
}
|
|
37698
36127
|
return [null, parsed];
|
|
37699
36128
|
}
|
|
37700
|
-
var emitLoadError2 = (
|
|
36129
|
+
var emitLoadError2 = (err2) => {
|
|
37701
36130
|
OutputFormatter2.error({
|
|
37702
36131
|
Result: RESULTS2.Failure,
|
|
37703
|
-
Message:
|
|
37704
|
-
Instructions:
|
|
36132
|
+
Message: err2.message,
|
|
36133
|
+
Instructions: err2.instructions
|
|
37705
36134
|
});
|
|
37706
36135
|
processContext2.exit(1);
|
|
37707
36136
|
};
|
|
@@ -37818,7 +36247,7 @@ var ROLE_AUTHORING_HINTS = {
|
|
|
37818
36247
|
var SERVICE_OPTION_HINT = `Known services: ${KNOWN_SERVICES.join(", ")} (free-form — other names accepted).`;
|
|
37819
36248
|
var inferRoleService = (role) => {
|
|
37820
36249
|
const raw = role;
|
|
37821
|
-
const namespaces = raw?.actionDetails?.map((a) => a.namespace?.toLowerCase()).filter((
|
|
36250
|
+
const namespaces = raw?.actionDetails?.map((a) => a.namespace?.toLowerCase()).filter((x2) => x2 !== undefined && x2.length > 0) ?? [];
|
|
37822
36251
|
const nonAuthz = Array.from(new Set(namespaces.filter((ns) => ns !== "authz")));
|
|
37823
36252
|
if (nonAuthz.length === 1)
|
|
37824
36253
|
return nonAuthz[0];
|
|
@@ -38600,11 +37029,11 @@ var registerPermissionsCommands = (authz) => {
|
|
|
38600
37029
|
"documentunderstanding` lists DU's Project-scope permissions."
|
|
38601
37030
|
].join(`
|
|
38602
37031
|
`)).option("--service <service>", "Owning service (e.g. apps, documentunderstanding). Combines with --scope, or used alone sets the scope from the service registry.").addOption(new Option2("--scope <type>", "Filter by role shape: Organization, TenantGlobal, Tenant, or Project (case-insensitive). Optional when --service is provided (the registry infers the scope).").argParser(canonicalizeRoleAuthoringScope)).examples(LIST_EXAMPLES4)).trackedAction(processContext2, async (options) => {
|
|
38603
|
-
const [
|
|
37032
|
+
const [err2, client] = await catchError5(createPapClient(ActionApi, {
|
|
38604
37033
|
loginValidity: options.loginValidity
|
|
38605
37034
|
}));
|
|
38606
|
-
if (
|
|
38607
|
-
await emitFailure2(
|
|
37035
|
+
if (err2) {
|
|
37036
|
+
await emitFailure2(err2, LOGIN_INSTRUCTIONS5);
|
|
38608
37037
|
return;
|
|
38609
37038
|
}
|
|
38610
37039
|
const filter = shapePermissionsListFilter({
|
|
@@ -38767,11 +37196,11 @@ var DELETE_EXAMPLES6 = [
|
|
|
38767
37196
|
}
|
|
38768
37197
|
];
|
|
38769
37198
|
async function getApi3(options) {
|
|
38770
|
-
const [
|
|
37199
|
+
const [err2, client] = await catchError5(createPapClient(RoleAssignmentApi, {
|
|
38771
37200
|
loginValidity: options.loginValidity
|
|
38772
37201
|
}));
|
|
38773
|
-
if (
|
|
38774
|
-
await emitFailure2(
|
|
37202
|
+
if (err2) {
|
|
37203
|
+
await emitFailure2(err2, LOGIN_INSTRUCTIONS5);
|
|
38775
37204
|
return null;
|
|
38776
37205
|
}
|
|
38777
37206
|
return client;
|
|
@@ -39205,9 +37634,9 @@ var DELETE_EXAMPLES7 = [
|
|
|
39205
37634
|
}
|
|
39206
37635
|
];
|
|
39207
37636
|
async function getApi4(options) {
|
|
39208
|
-
const [
|
|
39209
|
-
if (
|
|
39210
|
-
await emitFailure2(
|
|
37637
|
+
const [err2, client] = await catchError5(createPapClient(RoleApi, { loginValidity: options.loginValidity }));
|
|
37638
|
+
if (err2) {
|
|
37639
|
+
await emitFailure2(err2, LOGIN_INSTRUCTIONS5);
|
|
39211
37640
|
return null;
|
|
39212
37641
|
}
|
|
39213
37642
|
return client;
|
|
@@ -42677,8 +41106,9 @@ function querystringSingleKey8(key, value, keyPrefix = "") {
|
|
|
42677
41106
|
// ../oms-sdk/package.json
|
|
42678
41107
|
var package_default7 = {
|
|
42679
41108
|
name: "@uipath/oms-sdk",
|
|
41109
|
+
author: "UiPath",
|
|
42680
41110
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
42681
|
-
version: "1.
|
|
41111
|
+
version: "1.203.0",
|
|
42682
41112
|
description: "SDK for the UiPath Organization Management Service API.",
|
|
42683
41113
|
repository: {
|
|
42684
41114
|
type: "git",
|
|
@@ -47183,11 +45613,11 @@ async function loadJsonFile3(file, typeLabel) {
|
|
|
47183
45613
|
}
|
|
47184
45614
|
return [null, parsed];
|
|
47185
45615
|
}
|
|
47186
|
-
var emitLoadError3 = (
|
|
45616
|
+
var emitLoadError3 = (err2) => {
|
|
47187
45617
|
OutputFormatter2.error({
|
|
47188
45618
|
Result: RESULTS2.Failure,
|
|
47189
|
-
Message:
|
|
47190
|
-
Instructions:
|
|
45619
|
+
Message: err2.message,
|
|
45620
|
+
Instructions: err2.instructions
|
|
47191
45621
|
});
|
|
47192
45622
|
processContext2.exit(1);
|
|
47193
45623
|
};
|
|
@@ -47334,11 +45764,11 @@ var SVC_AVAILABLE_EXAMPLES = [
|
|
|
47334
45764
|
}
|
|
47335
45765
|
];
|
|
47336
45766
|
async function getOrgApi(options) {
|
|
47337
|
-
const [
|
|
45767
|
+
const [err2, client] = await catchError5(createV1Client(exports_src.OrganizationApi, {
|
|
47338
45768
|
loginValidity: options.loginValidity
|
|
47339
45769
|
}));
|
|
47340
|
-
if (
|
|
47341
|
-
await emitFailure3(
|
|
45770
|
+
if (err2) {
|
|
45771
|
+
await emitFailure3(err2, LOGIN_INSTRUCTIONS6);
|
|
47342
45772
|
return null;
|
|
47343
45773
|
}
|
|
47344
45774
|
return client;
|
|
@@ -47733,41 +46163,41 @@ var TSVC_DISABLE_EXAMPLES = [
|
|
|
47733
46163
|
}
|
|
47734
46164
|
];
|
|
47735
46165
|
async function getTenantApi(options) {
|
|
47736
|
-
const [
|
|
46166
|
+
const [err2, client] = await catchError5(createV1Client(exports_src.TenantApi, {
|
|
47737
46167
|
loginValidity: options.loginValidity
|
|
47738
46168
|
}));
|
|
47739
|
-
if (
|
|
47740
|
-
await emitFailure3(
|
|
46169
|
+
if (err2) {
|
|
46170
|
+
await emitFailure3(err2, LOGIN_INSTRUCTIONS6);
|
|
47741
46171
|
return null;
|
|
47742
46172
|
}
|
|
47743
46173
|
return client;
|
|
47744
46174
|
}
|
|
47745
46175
|
async function getTenantApiV2(options) {
|
|
47746
|
-
const [
|
|
46176
|
+
const [err2, client] = await catchError5(createV2Client(exports_src2.TenantApi, {
|
|
47747
46177
|
loginValidity: options.loginValidity
|
|
47748
46178
|
}));
|
|
47749
|
-
if (
|
|
47750
|
-
await emitFailure3(
|
|
46179
|
+
if (err2) {
|
|
46180
|
+
await emitFailure3(err2, LOGIN_INSTRUCTIONS6);
|
|
47751
46181
|
return null;
|
|
47752
46182
|
}
|
|
47753
46183
|
return client;
|
|
47754
46184
|
}
|
|
47755
46185
|
async function getOrgApi2(options) {
|
|
47756
|
-
const [
|
|
46186
|
+
const [err2, client] = await catchError5(createV1Client(exports_src.OrganizationApi, {
|
|
47757
46187
|
loginValidity: options.loginValidity
|
|
47758
46188
|
}));
|
|
47759
|
-
if (
|
|
47760
|
-
await emitFailure3(
|
|
46189
|
+
if (err2) {
|
|
46190
|
+
await emitFailure3(err2, LOGIN_INSTRUCTIONS6);
|
|
47761
46191
|
return null;
|
|
47762
46192
|
}
|
|
47763
46193
|
return client;
|
|
47764
46194
|
}
|
|
47765
46195
|
async function getTenantServiceApi(options) {
|
|
47766
|
-
const [
|
|
46196
|
+
const [err2, client] = await catchError5(createV1Client(exports_src.TenantServiceApi, {
|
|
47767
46197
|
loginValidity: options.loginValidity
|
|
47768
46198
|
}));
|
|
47769
|
-
if (
|
|
47770
|
-
await emitFailure3(
|
|
46199
|
+
if (err2) {
|
|
46200
|
+
await emitFailure3(err2, LOGIN_INSTRUCTIONS6);
|
|
47771
46201
|
return null;
|
|
47772
46202
|
}
|
|
47773
46203
|
return client;
|
|
@@ -48343,8 +46773,9 @@ var registerCommands6 = async (program3) => {
|
|
|
48343
46773
|
// ../resourcecatalog-tool/package.json
|
|
48344
46774
|
var package_default8 = {
|
|
48345
46775
|
name: "@uipath/resourcecatalog-tool",
|
|
46776
|
+
author: "UiPath",
|
|
48346
46777
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
48347
|
-
version: "1.
|
|
46778
|
+
version: "1.203.0-preview.180",
|
|
48348
46779
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
48349
46780
|
private: false,
|
|
48350
46781
|
repository: {
|
|
@@ -48638,8 +47069,9 @@ class VoidApiResponse8 {
|
|
|
48638
47069
|
// ../resourcecatalog-sdk/package.json
|
|
48639
47070
|
var package_default9 = {
|
|
48640
47071
|
name: "@uipath/resourcecatalog-sdk",
|
|
47072
|
+
author: "UiPath",
|
|
48641
47073
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
48642
|
-
version: "1.
|
|
47074
|
+
version: "1.203.0",
|
|
48643
47075
|
description: "SDK for the UiPath Resource Catalog Service API.",
|
|
48644
47076
|
repository: {
|
|
48645
47077
|
type: "git",
|
|
@@ -50291,8 +48723,9 @@ var registerCommands7 = async (program3) => {
|
|
|
50291
48723
|
// package.json
|
|
50292
48724
|
var package_default10 = {
|
|
50293
48725
|
name: "@uipath/admin-tool",
|
|
48726
|
+
author: "UiPath",
|
|
50294
48727
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
50295
|
-
version: "1.
|
|
48728
|
+
version: "1.203.0-preview.180",
|
|
50296
48729
|
description: "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
|
|
50297
48730
|
private: false,
|
|
50298
48731
|
repository: {
|
|
@@ -50357,4 +48790,4 @@ export {
|
|
|
50357
48790
|
registerCommands8 as registerCommands
|
|
50358
48791
|
};
|
|
50359
48792
|
|
|
50360
|
-
//# debugId=
|
|
48793
|
+
//# debugId=F72464E33539632764756E2164756E21
|