Update the @actions/cache package to the latest version (#390)
* Update the @actions/cache package to the latest version Signed-off-by: Sora Morimoto <sora@morimoto.io>
This commit is contained in:
parent
d29c1df198
commit
ab48bf6f67
5251
dist/restore/index.js
vendored
5251
dist/restore/index.js
vendored
@ -987,173 +987,173 @@ class ExecState extends events.EventEmitter {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const glob = __importStar(__webpack_require__(281));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const uuid_1 = __webpack_require__(898);
|
||||
const constants_1 = __webpack_require__(931);
|
||||
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
||||
function createTempDirectory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On Windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
const dest = path.join(tempDirectory, uuid_1.v4());
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.createTempDirectory = createTempDirectory;
|
||||
function getArchiveFileSizeIsBytes(filePath) {
|
||||
return fs.statSync(filePath).size;
|
||||
}
|
||||
exports.getArchiveFileSizeIsBytes = getArchiveFileSizeIsBytes;
|
||||
function resolvePaths(patterns) {
|
||||
var e_1, _a;
|
||||
var _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const paths = [];
|
||||
const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
||||
const globber = yield glob.create(patterns.join('\n'), {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
||||
const file = _d.value;
|
||||
const relativeFile = path.relative(workspace, file);
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
exports.resolvePaths = resolvePaths;
|
||||
function unlinkFile(filePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return util.promisify(fs.unlink)(filePath);
|
||||
});
|
||||
}
|
||||
exports.unlinkFile = unlinkFile;
|
||||
function getVersion(app) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Checking ${app} --version`);
|
||||
let versionOutput = '';
|
||||
try {
|
||||
yield exec.exec(`${app} --version`, [], {
|
||||
ignoreReturnCode: true,
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => (versionOutput += data.toString()),
|
||||
stderr: (data) => (versionOutput += data.toString())
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(err.message);
|
||||
}
|
||||
versionOutput = versionOutput.trim();
|
||||
core.debug(versionOutput);
|
||||
return versionOutput;
|
||||
});
|
||||
}
|
||||
// Use zstandard if possible to maximize cache performance
|
||||
function getCompressionMethod() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (process.platform === 'win32' && !(yield isGnuTarInstalled())) {
|
||||
// Disable zstd due to bug https://github.com/actions/cache/issues/301
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
const versionOutput = yield getVersion('zstd');
|
||||
const version = semver.clean(versionOutput);
|
||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
||||
// zstd is not installed
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
||||
// zstd is installed but using a version earlier than v1.3.2
|
||||
// v1.3.2 is required to use the `--long` options in zstd
|
||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||
}
|
||||
else {
|
||||
return constants_1.CompressionMethod.Zstd;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getCompressionMethod = getCompressionMethod;
|
||||
function getCacheFileName(compressionMethod) {
|
||||
return compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? constants_1.CacheFilename.Gzip
|
||||
: constants_1.CacheFilename.Zstd;
|
||||
}
|
||||
exports.getCacheFileName = getCacheFileName;
|
||||
function isGnuTarInstalled() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionOutput = yield getVersion('tar');
|
||||
return versionOutput.toLowerCase().includes('gnu tar');
|
||||
});
|
||||
}
|
||||
exports.isGnuTarInstalled = isGnuTarInstalled;
|
||||
function assertDefined(name, value) {
|
||||
if (value === undefined) {
|
||||
throw Error(`Expected ${name} but value was undefiend`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.assertDefined = assertDefined;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const glob = __importStar(__webpack_require__(281));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const uuid_1 = __webpack_require__(898);
|
||||
const constants_1 = __webpack_require__(931);
|
||||
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
||||
function createTempDirectory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On Windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
const dest = path.join(tempDirectory, uuid_1.v4());
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.createTempDirectory = createTempDirectory;
|
||||
function getArchiveFileSizeIsBytes(filePath) {
|
||||
return fs.statSync(filePath).size;
|
||||
}
|
||||
exports.getArchiveFileSizeIsBytes = getArchiveFileSizeIsBytes;
|
||||
function resolvePaths(patterns) {
|
||||
var e_1, _a;
|
||||
var _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const paths = [];
|
||||
const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
||||
const globber = yield glob.create(patterns.join('\n'), {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
||||
const file = _d.value;
|
||||
const relativeFile = path.relative(workspace, file);
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
exports.resolvePaths = resolvePaths;
|
||||
function unlinkFile(filePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return util.promisify(fs.unlink)(filePath);
|
||||
});
|
||||
}
|
||||
exports.unlinkFile = unlinkFile;
|
||||
function getVersion(app) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Checking ${app} --version`);
|
||||
let versionOutput = '';
|
||||
try {
|
||||
yield exec.exec(`${app} --version`, [], {
|
||||
ignoreReturnCode: true,
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => (versionOutput += data.toString()),
|
||||
stderr: (data) => (versionOutput += data.toString())
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(err.message);
|
||||
}
|
||||
versionOutput = versionOutput.trim();
|
||||
core.debug(versionOutput);
|
||||
return versionOutput;
|
||||
});
|
||||
}
|
||||
// Use zstandard if possible to maximize cache performance
|
||||
function getCompressionMethod() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (process.platform === 'win32' && !(yield isGnuTarInstalled())) {
|
||||
// Disable zstd due to bug https://github.com/actions/cache/issues/301
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
const versionOutput = yield getVersion('zstd');
|
||||
const version = semver.clean(versionOutput);
|
||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
||||
// zstd is not installed
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
||||
// zstd is installed but using a version earlier than v1.3.2
|
||||
// v1.3.2 is required to use the `--long` options in zstd
|
||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||
}
|
||||
else {
|
||||
return constants_1.CompressionMethod.Zstd;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getCompressionMethod = getCompressionMethod;
|
||||
function getCacheFileName(compressionMethod) {
|
||||
return compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? constants_1.CacheFilename.Gzip
|
||||
: constants_1.CacheFilename.Zstd;
|
||||
}
|
||||
exports.getCacheFileName = getCacheFileName;
|
||||
function isGnuTarInstalled() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionOutput = yield getVersion('tar');
|
||||
return versionOutput.toLowerCase().includes('gnu tar');
|
||||
});
|
||||
}
|
||||
exports.isGnuTarInstalled = isGnuTarInstalled;
|
||||
function assertDefined(name, value) {
|
||||
if (value === undefined) {
|
||||
throw Error(`Expected ${name} but value was undefiend`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.assertDefined = assertDefined;
|
||||
//# sourceMappingURL=cacheUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -1182,7 +1182,7 @@ eval("require")("encoding");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -1306,6 +1306,21 @@ exports.PropagationAPI = PropagationAPI;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 24:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = '00000000-0000-0000-0000-000000000000';
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 40:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
@ -2635,6 +2650,34 @@ function regExpEscape (s) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 104:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function version(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
return parseInt(uuid.substr(14, 1), 16);
|
||||
}
|
||||
|
||||
var _default = version;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 106:
|
||||
@ -2914,217 +2957,217 @@ exports.AbortSignal = AbortSignal;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const auth_1 = __webpack_require__(226);
|
||||
const crypto = __importStar(__webpack_require__(417));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const url_1 = __webpack_require__(835);
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const downloadUtils_1 = __webpack_require__(251);
|
||||
const options_1 = __webpack_require__(538);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const versionSalt = '1.0';
|
||||
function getCacheApiUrl(resource) {
|
||||
// Ideally we just use ACTIONS_CACHE_URL
|
||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
||||
'').replace('pipelines', 'artifactcache');
|
||||
if (!baseUrl) {
|
||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||
}
|
||||
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
||||
core.debug(`Resource Url: ${url}`);
|
||||
return url;
|
||||
}
|
||||
function createAcceptHeader(type, apiVersion) {
|
||||
return `${type};api-version=${apiVersion}`;
|
||||
}
|
||||
function getRequestOptions() {
|
||||
const requestOptions = {
|
||||
headers: {
|
||||
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
||||
}
|
||||
};
|
||||
return requestOptions;
|
||||
}
|
||||
function createHttpClient() {
|
||||
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
||||
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
||||
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
||||
}
|
||||
function getCacheVersion(paths, compressionMethod) {
|
||||
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? []
|
||||
: [compressionMethod]);
|
||||
// Add salt to cache version to support breaking changes in cache entry
|
||||
components.push(versionSalt);
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(components.join('|'))
|
||||
.digest('hex');
|
||||
}
|
||||
exports.getCacheVersion = getCacheVersion;
|
||||
function getCacheEntry(keys, paths, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
||||
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
||||
if (response.statusCode === 204) {
|
||||
return null;
|
||||
}
|
||||
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${response.statusCode}`);
|
||||
}
|
||||
const cacheResult = response.result;
|
||||
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
||||
if (!cacheDownloadUrl) {
|
||||
throw new Error('Cache not found.');
|
||||
}
|
||||
core.setSecret(cacheDownloadUrl);
|
||||
core.debug(`Cache Result:`);
|
||||
core.debug(JSON.stringify(cacheResult));
|
||||
return cacheResult;
|
||||
});
|
||||
}
|
||||
exports.getCacheEntry = getCacheEntry;
|
||||
function downloadCache(archiveLocation, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const archiveUrl = new url_1.URL(archiveLocation);
|
||||
const downloadOptions = options_1.getDownloadOptions(options);
|
||||
if (downloadOptions.useAzureSdk &&
|
||||
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
||||
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
||||
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
||||
}
|
||||
else {
|
||||
// Otherwise, download using the Actions http-client.
|
||||
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCache = downloadCache;
|
||||
// Reserve Cache
|
||||
function reserveCache(key, paths, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const reserveCacheRequest = {
|
||||
key,
|
||||
version
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
}));
|
||||
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
||||
});
|
||||
}
|
||||
exports.reserveCache = reserveCache;
|
||||
function getContentRange(start, end) {
|
||||
// Format: `bytes start-end/filesize
|
||||
// start and end are inclusive
|
||||
// filesize can be *
|
||||
// For a 200 byte chunk starting at byte 0:
|
||||
// Content-Range: bytes 0-199/*
|
||||
return `bytes ${start}-${end}/*`;
|
||||
}
|
||||
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Uploading chunk of size ${end -
|
||||
start +
|
||||
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
||||
const additionalHeaders = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Range': getContentRange(start, end)
|
||||
};
|
||||
yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function uploadFile(httpClient, cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Upload Chunks
|
||||
const fileSize = fs.statSync(archivePath).size;
|
||||
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
||||
const fd = fs.openSync(archivePath, 'r');
|
||||
const uploadOptions = options_1.getUploadOptions(options);
|
||||
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
||||
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
||||
const parallelUploads = [...new Array(concurrency).keys()];
|
||||
core.debug('Awaiting all uploads');
|
||||
let offset = 0;
|
||||
try {
|
||||
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||
while (offset < fileSize) {
|
||||
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
||||
const start = offset;
|
||||
const end = offset + chunkSize - 1;
|
||||
offset += maxChunkSize;
|
||||
yield uploadChunk(httpClient, resourceUrl, () => fs
|
||||
.createReadStream(archivePath, {
|
||||
fd,
|
||||
start,
|
||||
end,
|
||||
autoClose: false
|
||||
})
|
||||
.on('error', error => {
|
||||
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
||||
}), start, end);
|
||||
}
|
||||
})));
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
function commitCache(httpClient, cacheId, filesize) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commitCacheRequest = { size: filesize };
|
||||
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function saveCache(cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
core.debug('Upload cache');
|
||||
yield uploadFile(httpClient, cacheId, archivePath, options);
|
||||
// Commit Cache
|
||||
core.debug('Commiting cache');
|
||||
const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
||||
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
||||
}
|
||||
core.info('Cache saved successfully');
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const auth_1 = __webpack_require__(226);
|
||||
const crypto = __importStar(__webpack_require__(417));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const url_1 = __webpack_require__(835);
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const downloadUtils_1 = __webpack_require__(251);
|
||||
const options_1 = __webpack_require__(538);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const versionSalt = '1.0';
|
||||
function getCacheApiUrl(resource) {
|
||||
// Ideally we just use ACTIONS_CACHE_URL
|
||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
||||
'').replace('pipelines', 'artifactcache');
|
||||
if (!baseUrl) {
|
||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||
}
|
||||
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
||||
core.debug(`Resource Url: ${url}`);
|
||||
return url;
|
||||
}
|
||||
function createAcceptHeader(type, apiVersion) {
|
||||
return `${type};api-version=${apiVersion}`;
|
||||
}
|
||||
function getRequestOptions() {
|
||||
const requestOptions = {
|
||||
headers: {
|
||||
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
||||
}
|
||||
};
|
||||
return requestOptions;
|
||||
}
|
||||
function createHttpClient() {
|
||||
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
||||
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
||||
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
||||
}
|
||||
function getCacheVersion(paths, compressionMethod) {
|
||||
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? []
|
||||
: [compressionMethod]);
|
||||
// Add salt to cache version to support breaking changes in cache entry
|
||||
components.push(versionSalt);
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(components.join('|'))
|
||||
.digest('hex');
|
||||
}
|
||||
exports.getCacheVersion = getCacheVersion;
|
||||
function getCacheEntry(keys, paths, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
||||
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
||||
if (response.statusCode === 204) {
|
||||
return null;
|
||||
}
|
||||
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${response.statusCode}`);
|
||||
}
|
||||
const cacheResult = response.result;
|
||||
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
||||
if (!cacheDownloadUrl) {
|
||||
throw new Error('Cache not found.');
|
||||
}
|
||||
core.setSecret(cacheDownloadUrl);
|
||||
core.debug(`Cache Result:`);
|
||||
core.debug(JSON.stringify(cacheResult));
|
||||
return cacheResult;
|
||||
});
|
||||
}
|
||||
exports.getCacheEntry = getCacheEntry;
|
||||
function downloadCache(archiveLocation, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const archiveUrl = new url_1.URL(archiveLocation);
|
||||
const downloadOptions = options_1.getDownloadOptions(options);
|
||||
if (downloadOptions.useAzureSdk &&
|
||||
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
||||
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
||||
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
||||
}
|
||||
else {
|
||||
// Otherwise, download using the Actions http-client.
|
||||
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCache = downloadCache;
|
||||
// Reserve Cache
|
||||
function reserveCache(key, paths, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const reserveCacheRequest = {
|
||||
key,
|
||||
version
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
}));
|
||||
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
||||
});
|
||||
}
|
||||
exports.reserveCache = reserveCache;
|
||||
function getContentRange(start, end) {
|
||||
// Format: `bytes start-end/filesize
|
||||
// start and end are inclusive
|
||||
// filesize can be *
|
||||
// For a 200 byte chunk starting at byte 0:
|
||||
// Content-Range: bytes 0-199/*
|
||||
return `bytes ${start}-${end}/*`;
|
||||
}
|
||||
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Uploading chunk of size ${end -
|
||||
start +
|
||||
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
||||
const additionalHeaders = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Range': getContentRange(start, end)
|
||||
};
|
||||
yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function uploadFile(httpClient, cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Upload Chunks
|
||||
const fileSize = fs.statSync(archivePath).size;
|
||||
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
||||
const fd = fs.openSync(archivePath, 'r');
|
||||
const uploadOptions = options_1.getUploadOptions(options);
|
||||
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
||||
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
||||
const parallelUploads = [...new Array(concurrency).keys()];
|
||||
core.debug('Awaiting all uploads');
|
||||
let offset = 0;
|
||||
try {
|
||||
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||
while (offset < fileSize) {
|
||||
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
||||
const start = offset;
|
||||
const end = offset + chunkSize - 1;
|
||||
offset += maxChunkSize;
|
||||
yield uploadChunk(httpClient, resourceUrl, () => fs
|
||||
.createReadStream(archivePath, {
|
||||
fd,
|
||||
start,
|
||||
end,
|
||||
autoClose: false
|
||||
})
|
||||
.on('error', error => {
|
||||
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
||||
}), start, end);
|
||||
}
|
||||
})));
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
function commitCache(httpClient, cacheId, filesize) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commitCacheRequest = { size: filesize };
|
||||
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function saveCache(cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
core.debug('Upload cache');
|
||||
yield uploadFile(httpClient, cacheId, archivePath, options);
|
||||
// Commit Cache
|
||||
core.debug('Commiting cache');
|
||||
const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
||||
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
||||
}
|
||||
core.info('Cache saved successfully');
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
//# sourceMappingURL=cacheHttpClient.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -3486,44 +3529,33 @@ exports.debug = debug; // for test
|
||||
/***/ }),
|
||||
|
||||
/***/ 147:
|
||||
/***/ (function(module) {
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
// API
|
||||
module.exports = state;
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Creates initial state object
|
||||
* for iteration over list
|
||||
*
|
||||
* @param {array|object} list - list to iterate over
|
||||
* @param {function|null} sortMethod - function to use for keys sort,
|
||||
* or `null` to keep them as is
|
||||
* @returns {object} - initial state object
|
||||
*/
|
||||
function state(list, sortMethod)
|
||||
{
|
||||
var isNamedList = !Array.isArray(list)
|
||||
, initState =
|
||||
{
|
||||
index : 0,
|
||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||
jobs : {},
|
||||
results : isNamedList ? {} : [],
|
||||
size : isNamedList ? Object.keys(list).length : list.length
|
||||
|
||||
exports.fromCallback = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
|
||||
else {
|
||||
return new Promise((resolve, reject) => {
|
||||
arguments[arguments.length] = (err, res) => {
|
||||
if (err) return reject(err)
|
||||
resolve(res)
|
||||
}
|
||||
arguments.length++
|
||||
fn.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
;
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
if (sortMethod)
|
||||
{
|
||||
// sort array keys based on it's values
|
||||
// sort object's keys just on own merit
|
||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||
{
|
||||
return sortMethod(list[a], list[b]);
|
||||
});
|
||||
}
|
||||
|
||||
return initState;
|
||||
exports.fromPromise = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
const cb = arguments[arguments.length - 1]
|
||||
if (typeof cb !== 'function') return fn.apply(this, arguments)
|
||||
else fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
|
||||
@ -3821,7 +3853,7 @@ exports.default = void 0;
|
||||
|
||||
var _rng = _interopRequireDefault(__webpack_require__(733));
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -3914,7 +3946,7 @@ function v1(options, buf, offset) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf || (0, _bytesToUuid.default)(b);
|
||||
return buf || (0, _stringify.default)(b);
|
||||
}
|
||||
|
||||
var _default = v1;
|
||||
@ -3922,6 +3954,58 @@ exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 197:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parse(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
let v;
|
||||
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
||||
|
||||
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
||||
arr[1] = v >>> 16 & 0xff;
|
||||
arr[2] = v >>> 8 & 0xff;
|
||||
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
||||
|
||||
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
||||
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
||||
|
||||
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
||||
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
||||
|
||||
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
||||
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
||||
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
||||
|
||||
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
||||
arr[11] = v / 0x100000000 & 0xff;
|
||||
arr[12] = v >>> 24 & 0xff;
|
||||
arr[13] = v >>> 16 & 0xff;
|
||||
arr[14] = v >>> 8 & 0xff;
|
||||
arr[15] = v & 0xff;
|
||||
return arr;
|
||||
}
|
||||
|
||||
var _default = parse;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 210:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
@ -4095,6 +4179,21 @@ exports.isTokenCredential = isTokenCredential;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 238:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 241:
|
||||
@ -4109,19 +4208,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = _default;
|
||||
exports.URL = exports.DNS = void 0;
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
var _parse = _interopRequireDefault(__webpack_require__(197));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function uuidToBytes(uuid) {
|
||||
// Note: We assume we're being passed a valid uuid string
|
||||
const bytes = [];
|
||||
uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
|
||||
bytes.push(parseInt(hex, 16));
|
||||
});
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function stringToBytes(str) {
|
||||
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
||||
|
||||
@ -4146,19 +4238,20 @@ function _default(name, version, hashfunc) {
|
||||
}
|
||||
|
||||
if (typeof namespace === 'string') {
|
||||
namespace = uuidToBytes(namespace);
|
||||
namespace = (0, _parse.default)(namespace);
|
||||
}
|
||||
|
||||
if (!Array.isArray(value)) {
|
||||
throw TypeError('value must be an array of bytes');
|
||||
}
|
||||
|
||||
if (!Array.isArray(namespace) || namespace.length !== 16) {
|
||||
throw TypeError('namespace must be uuid string or an Array of 16 byte values');
|
||||
} // Per 4.3
|
||||
if (namespace.length !== 16) {
|
||||
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
||||
} // Compute hash of namespace and value, Per 4.3
|
||||
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
||||
// hashfunc([...namespace, ... value])`
|
||||
|
||||
|
||||
const bytes = hashfunc(namespace.concat(value));
|
||||
let bytes = new Uint8Array(16 + value.length);
|
||||
bytes.set(namespace);
|
||||
bytes.set(value, namespace.length);
|
||||
bytes = hashfunc(bytes);
|
||||
bytes[6] = bytes[6] & 0x0f | version;
|
||||
bytes[8] = bytes[8] & 0x3f | 0x80;
|
||||
|
||||
@ -4172,7 +4265,7 @@ function _default(name, version, hashfunc) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _bytesToUuid.default)(bytes);
|
||||
return (0, _stringify.default)(bytes);
|
||||
} // Function#name is not settable on some platforms (#270)
|
||||
|
||||
|
||||
@ -4233,237 +4326,1029 @@ exports.default = _default;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const storage_blob_1 = __webpack_require__(373);
|
||||
const buffer = __importStar(__webpack_require__(293));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const stream = __importStar(__webpack_require__(794));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
* @param response the HTTP response
|
||||
* @param output the writable stream
|
||||
*/
|
||||
function pipeResponseToStream(response, output) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
yield pipeline(response.message, output);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Class for tracking the download state and displaying stats.
|
||||
*/
|
||||
class DownloadProgress {
|
||||
constructor(contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
this.segmentIndex = 0;
|
||||
this.segmentSize = 0;
|
||||
this.segmentOffset = 0;
|
||||
this.receivedBytes = 0;
|
||||
this.displayedComplete = false;
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
/**
|
||||
* Progress to the next segment. Only call this method when the previous segment
|
||||
* is complete.
|
||||
*
|
||||
* @param segmentSize the length of the next segment
|
||||
*/
|
||||
nextSegment(segmentSize) {
|
||||
this.segmentOffset = this.segmentOffset + this.segmentSize;
|
||||
this.segmentIndex = this.segmentIndex + 1;
|
||||
this.segmentSize = segmentSize;
|
||||
this.receivedBytes = 0;
|
||||
core.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
|
||||
}
|
||||
/**
|
||||
* Sets the number of bytes received for the current segment.
|
||||
*
|
||||
* @param receivedBytes the number of bytes received
|
||||
*/
|
||||
setReceivedBytes(receivedBytes) {
|
||||
this.receivedBytes = receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns the total number of bytes transferred.
|
||||
*/
|
||||
getTransferredBytes() {
|
||||
return this.segmentOffset + this.receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns true if the download is complete.
|
||||
*/
|
||||
isDone() {
|
||||
return this.getTransferredBytes() === this.contentLength;
|
||||
}
|
||||
/**
|
||||
* Prints the current download stats. Once the download completes, this will print one
|
||||
* last line and then stop.
|
||||
*/
|
||||
display() {
|
||||
if (this.displayedComplete) {
|
||||
return;
|
||||
}
|
||||
const transferredBytes = this.segmentOffset + this.receivedBytes;
|
||||
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
|
||||
const elapsedTime = Date.now() - this.startTime;
|
||||
const downloadSpeed = (transferredBytes /
|
||||
(1024 * 1024) /
|
||||
(elapsedTime / 1000)).toFixed(1);
|
||||
core.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
|
||||
if (this.isDone()) {
|
||||
this.displayedComplete = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a function used to handle TransferProgressEvents.
|
||||
*/
|
||||
onProgress() {
|
||||
return (progress) => {
|
||||
this.setReceivedBytes(progress.loadedBytes);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Starts the timer that displays the stats.
|
||||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs = 1000) {
|
||||
const displayCallback = () => {
|
||||
this.display();
|
||||
if (!this.isDone()) {
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
};
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
/**
|
||||
* Stops the timer that displays the stats. As this typically indicates the download
|
||||
* is complete, this will display one last line, unless the last line has already
|
||||
* been written.
|
||||
*/
|
||||
stopDisplayTimer() {
|
||||
if (this.timeoutHandle) {
|
||||
clearTimeout(this.timeoutHandle);
|
||||
this.timeoutHandle = undefined;
|
||||
}
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
exports.DownloadProgress = DownloadProgress;
|
||||
/**
|
||||
* Download the cache using the Actions toolkit http-client
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
*/
|
||||
function downloadCacheHttpClient(archiveLocation, archivePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const writeStream = fs.createWriteStream(archivePath);
|
||||
const httpClient = new http_client_1.HttpClient('actions/cache');
|
||||
const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));
|
||||
// Abort download if no traffic received over the socket.
|
||||
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
|
||||
downloadResponse.message.destroy();
|
||||
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
|
||||
});
|
||||
yield pipeResponseToStream(downloadResponse, writeStream);
|
||||
// Validate download size.
|
||||
const contentLengthHeader = downloadResponse.message.headers['content-length'];
|
||||
if (contentLengthHeader) {
|
||||
const expectedLength = parseInt(contentLengthHeader);
|
||||
const actualLength = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
if (actualLength !== expectedLength) {
|
||||
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.debug('Unable to validate download, no Content-Length header');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheHttpClient = downloadCacheHttpClient;
|
||||
/**
|
||||
* Download the cache using the Azure Storage SDK. Only call this method if the
|
||||
* URL points to an Azure Storage endpoint.
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
* @param options the download options with the defaults set
|
||||
*/
|
||||
function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = new storage_blob_1.BlockBlobClient(archiveLocation, undefined, {
|
||||
retryOptions: {
|
||||
// Override the timeout used when downloading each 4 MB chunk
|
||||
// The default is 2 min / MB, which is way too slow
|
||||
tryTimeoutInMs: options.timeoutInMs
|
||||
}
|
||||
});
|
||||
const properties = yield client.getProperties();
|
||||
const contentLength = (_a = properties.contentLength) !== null && _a !== void 0 ? _a : -1;
|
||||
if (contentLength < 0) {
|
||||
// We should never hit this condition, but just in case fall back to downloading the
|
||||
// file as one large stream
|
||||
core.debug('Unable to determine content length, downloading file with http-client...');
|
||||
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
else {
|
||||
// Use downloadToBuffer for faster downloads, since internally it splits the
|
||||
// file into 4 MB chunks which can then be parallelized and retried independently
|
||||
//
|
||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||
// on 64-bit systems), split the download into multiple segments
|
||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
||||
const downloadProgress = new DownloadProgress(contentLength);
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
downloadProgress.stopDisplayTimer();
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const storage_blob_1 = __webpack_require__(373);
|
||||
const buffer = __importStar(__webpack_require__(293));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const stream = __importStar(__webpack_require__(794));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
* @param response the HTTP response
|
||||
* @param output the writable stream
|
||||
*/
|
||||
function pipeResponseToStream(response, output) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
yield pipeline(response.message, output);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Class for tracking the download state and displaying stats.
|
||||
*/
|
||||
class DownloadProgress {
|
||||
constructor(contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
this.segmentIndex = 0;
|
||||
this.segmentSize = 0;
|
||||
this.segmentOffset = 0;
|
||||
this.receivedBytes = 0;
|
||||
this.displayedComplete = false;
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
/**
|
||||
* Progress to the next segment. Only call this method when the previous segment
|
||||
* is complete.
|
||||
*
|
||||
* @param segmentSize the length of the next segment
|
||||
*/
|
||||
nextSegment(segmentSize) {
|
||||
this.segmentOffset = this.segmentOffset + this.segmentSize;
|
||||
this.segmentIndex = this.segmentIndex + 1;
|
||||
this.segmentSize = segmentSize;
|
||||
this.receivedBytes = 0;
|
||||
core.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
|
||||
}
|
||||
/**
|
||||
* Sets the number of bytes received for the current segment.
|
||||
*
|
||||
* @param receivedBytes the number of bytes received
|
||||
*/
|
||||
setReceivedBytes(receivedBytes) {
|
||||
this.receivedBytes = receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns the total number of bytes transferred.
|
||||
*/
|
||||
getTransferredBytes() {
|
||||
return this.segmentOffset + this.receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns true if the download is complete.
|
||||
*/
|
||||
isDone() {
|
||||
return this.getTransferredBytes() === this.contentLength;
|
||||
}
|
||||
/**
|
||||
* Prints the current download stats. Once the download completes, this will print one
|
||||
* last line and then stop.
|
||||
*/
|
||||
display() {
|
||||
if (this.displayedComplete) {
|
||||
return;
|
||||
}
|
||||
const transferredBytes = this.segmentOffset + this.receivedBytes;
|
||||
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
|
||||
const elapsedTime = Date.now() - this.startTime;
|
||||
const downloadSpeed = (transferredBytes /
|
||||
(1024 * 1024) /
|
||||
(elapsedTime / 1000)).toFixed(1);
|
||||
core.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
|
||||
if (this.isDone()) {
|
||||
this.displayedComplete = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a function used to handle TransferProgressEvents.
|
||||
*/
|
||||
onProgress() {
|
||||
return (progress) => {
|
||||
this.setReceivedBytes(progress.loadedBytes);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Starts the timer that displays the stats.
|
||||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs = 1000) {
|
||||
const displayCallback = () => {
|
||||
this.display();
|
||||
if (!this.isDone()) {
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
};
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
/**
|
||||
* Stops the timer that displays the stats. As this typically indicates the download
|
||||
* is complete, this will display one last line, unless the last line has already
|
||||
* been written.
|
||||
*/
|
||||
stopDisplayTimer() {
|
||||
if (this.timeoutHandle) {
|
||||
clearTimeout(this.timeoutHandle);
|
||||
this.timeoutHandle = undefined;
|
||||
}
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
exports.DownloadProgress = DownloadProgress;
|
||||
/**
|
||||
* Download the cache using the Actions toolkit http-client
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
*/
|
||||
function downloadCacheHttpClient(archiveLocation, archivePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const writeStream = fs.createWriteStream(archivePath);
|
||||
const httpClient = new http_client_1.HttpClient('actions/cache');
|
||||
const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));
|
||||
// Abort download if no traffic received over the socket.
|
||||
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
|
||||
downloadResponse.message.destroy();
|
||||
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
|
||||
});
|
||||
yield pipeResponseToStream(downloadResponse, writeStream);
|
||||
// Validate download size.
|
||||
const contentLengthHeader = downloadResponse.message.headers['content-length'];
|
||||
if (contentLengthHeader) {
|
||||
const expectedLength = parseInt(contentLengthHeader);
|
||||
const actualLength = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
if (actualLength !== expectedLength) {
|
||||
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.debug('Unable to validate download, no Content-Length header');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheHttpClient = downloadCacheHttpClient;
|
||||
/**
|
||||
* Download the cache using the Azure Storage SDK. Only call this method if the
|
||||
* URL points to an Azure Storage endpoint.
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
* @param options the download options with the defaults set
|
||||
*/
|
||||
function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = new storage_blob_1.BlockBlobClient(archiveLocation, undefined, {
|
||||
retryOptions: {
|
||||
// Override the timeout used when downloading each 4 MB chunk
|
||||
// The default is 2 min / MB, which is way too slow
|
||||
tryTimeoutInMs: options.timeoutInMs
|
||||
}
|
||||
});
|
||||
const properties = yield client.getProperties();
|
||||
const contentLength = (_a = properties.contentLength) !== null && _a !== void 0 ? _a : -1;
|
||||
if (contentLength < 0) {
|
||||
// We should never hit this condition, but just in case fall back to downloading the
|
||||
// file as one large stream
|
||||
core.debug('Unable to determine content length, downloading file with http-client...');
|
||||
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
else {
|
||||
// Use downloadToBuffer for faster downloads, since internally it splits the
|
||||
// file into 4 MB chunks which can then be parallelized and retried independently
|
||||
//
|
||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||
// on 64-bit systems), split the download into multiple segments
|
||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
||||
const downloadProgress = new DownloadProgress(contentLength);
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
downloadProgress.stopDisplayTimer();
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
//# sourceMappingURL=downloadUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 257:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() {
|
||||
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
ref1 = __webpack_require__(582), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
||||
|
||||
XMLElement = null;
|
||||
|
||||
XMLCData = null;
|
||||
|
||||
XMLComment = null;
|
||||
|
||||
XMLDeclaration = null;
|
||||
|
||||
XMLDocType = null;
|
||||
|
||||
XMLRaw = null;
|
||||
|
||||
XMLText = null;
|
||||
|
||||
XMLProcessingInstruction = null;
|
||||
|
||||
XMLDummy = null;
|
||||
|
||||
NodeType = null;
|
||||
|
||||
XMLNodeList = null;
|
||||
|
||||
XMLNamedNodeMap = null;
|
||||
|
||||
DocumentPosition = null;
|
||||
|
||||
module.exports = XMLNode = (function() {
|
||||
function XMLNode(parent1) {
|
||||
this.parent = parent1;
|
||||
if (this.parent) {
|
||||
this.options = this.parent.options;
|
||||
this.stringify = this.parent.stringify;
|
||||
}
|
||||
this.value = null;
|
||||
this.children = [];
|
||||
this.baseURI = null;
|
||||
if (!XMLElement) {
|
||||
XMLElement = __webpack_require__(796);
|
||||
XMLCData = __webpack_require__(657);
|
||||
XMLComment = __webpack_require__(919);
|
||||
XMLDeclaration = __webpack_require__(738);
|
||||
XMLDocType = __webpack_require__(735);
|
||||
XMLRaw = __webpack_require__(660);
|
||||
XMLText = __webpack_require__(708);
|
||||
XMLProcessingInstruction = __webpack_require__(491);
|
||||
XMLDummy = __webpack_require__(956);
|
||||
NodeType = __webpack_require__(683);
|
||||
XMLNodeList = __webpack_require__(265);
|
||||
XMLNamedNodeMap = __webpack_require__(451);
|
||||
DocumentPosition = __webpack_require__(65);
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
||||
get: function() {
|
||||
return this.name;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
||||
get: function() {
|
||||
return this.type;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
||||
get: function() {
|
||||
return this.value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
||||
get: function() {
|
||||
return this.parent;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
||||
get: function() {
|
||||
if (!this.childNodeList || !this.childNodeList.nodes) {
|
||||
this.childNodeList = new XMLNodeList(this.children);
|
||||
}
|
||||
return this.childNodeList;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
||||
get: function() {
|
||||
return this.children[0] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
||||
get: function() {
|
||||
return this.children[this.children.length - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i + 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
||||
get: function() {
|
||||
return this.document() || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'textContent', {
|
||||
get: function() {
|
||||
var child, j, len, ref2, str;
|
||||
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
||||
str = '';
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (child.textContent) {
|
||||
str += child.textContent;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
}
|
||||
});
|
||||
|
||||
XMLNode.prototype.setParent = function(parent) {
|
||||
var child, j, len, ref2, results;
|
||||
this.parent = parent;
|
||||
if (parent) {
|
||||
this.options = parent.options;
|
||||
this.stringify = parent.stringify;
|
||||
}
|
||||
ref2 = this.children;
|
||||
results = [];
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
results.push(child.setParent(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
XMLNode.prototype.element = function(name, attributes, text) {
|
||||
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
||||
lastChild = null;
|
||||
if (attributes === null && (text == null)) {
|
||||
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
||||
}
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
||||
}
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
if (Array.isArray(name)) {
|
||||
for (j = 0, len = name.length; j < len; j++) {
|
||||
item = name[j];
|
||||
lastChild = this.element(item);
|
||||
}
|
||||
} else if (isFunction(name)) {
|
||||
lastChild = this.element(name.apply());
|
||||
} else if (isObject(name)) {
|
||||
for (key in name) {
|
||||
if (!hasProp.call(name, key)) continue;
|
||||
val = name[key];
|
||||
if (isFunction(val)) {
|
||||
val = val.apply();
|
||||
}
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
||||
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (isObject(val) && isEmpty(val)) {
|
||||
lastChild = this.element(key);
|
||||
} else if (!this.options.keepNullNodes && (val == null)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
||||
for (k = 0, len1 = val.length; k < len1; k++) {
|
||||
item = val[k];
|
||||
childNode = {};
|
||||
childNode[key] = item;
|
||||
lastChild = this.element(childNode);
|
||||
}
|
||||
} else if (isObject(val)) {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.element(val);
|
||||
} else {
|
||||
lastChild = this.element(key);
|
||||
lastChild.element(val);
|
||||
}
|
||||
} else {
|
||||
lastChild = this.element(key, val);
|
||||
}
|
||||
}
|
||||
} else if (!this.options.keepNullNodes && text === null) {
|
||||
lastChild = this.dummy();
|
||||
} else {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.text(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
||||
lastChild = this.cdata(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
||||
lastChild = this.comment(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
||||
lastChild = this.raw(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
||||
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
||||
} else {
|
||||
lastChild = this.node(name, attributes, text);
|
||||
}
|
||||
}
|
||||
if (lastChild == null) {
|
||||
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
||||
}
|
||||
return lastChild;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
||||
var child, i, newChild, refChild, removed;
|
||||
if (name != null ? name.type : void 0) {
|
||||
newChild = name;
|
||||
refChild = attributes;
|
||||
newChild.setParent(this);
|
||||
if (refChild) {
|
||||
i = children.indexOf(refChild);
|
||||
removed = children.splice(i);
|
||||
children.push(newChild);
|
||||
Array.prototype.push.apply(children, removed);
|
||||
} else {
|
||||
children.push(newChild);
|
||||
}
|
||||
return newChild;
|
||||
} else {
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.remove = function() {
|
||||
var i, ref2;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot remove the root element. " + this.debugInfo());
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.node = function(name, attributes, text) {
|
||||
var child, ref2;
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
attributes || (attributes = {});
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
||||
}
|
||||
child = new XMLElement(this, name, attributes);
|
||||
if (text != null) {
|
||||
child.text(text);
|
||||
}
|
||||
this.children.push(child);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.text = function(value) {
|
||||
var child;
|
||||
if (isObject(value)) {
|
||||
this.element(value);
|
||||
}
|
||||
child = new XMLText(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentBefore = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentAfter = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.raw = function(value) {
|
||||
var child;
|
||||
child = new XMLRaw(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dummy = function() {
|
||||
var child;
|
||||
child = new XMLDummy(this);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instruction = function(target, value) {
|
||||
var insTarget, insValue, instruction, j, len;
|
||||
if (target != null) {
|
||||
target = getValue(target);
|
||||
}
|
||||
if (value != null) {
|
||||
value = getValue(value);
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (j = 0, len = target.length; j < len; j++) {
|
||||
insTarget = target[j];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
instruction = new XMLProcessingInstruction(this, target, value);
|
||||
this.children.push(instruction);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionBefore = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionAfter = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
||||
var doc, xmldec;
|
||||
doc = this.document();
|
||||
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
||||
if (doc.children.length === 0) {
|
||||
doc.children.unshift(xmldec);
|
||||
} else if (doc.children[0].type === NodeType.Declaration) {
|
||||
doc.children[0] = xmldec;
|
||||
} else {
|
||||
doc.children.unshift(xmldec);
|
||||
}
|
||||
return doc.root() || doc;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dtd = function(pubID, sysID) {
|
||||
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
||||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
ref2 = doc.children;
|
||||
for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
||||
child = ref2[i];
|
||||
if (child.type === NodeType.DocType) {
|
||||
doc.children[i] = doctype;
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
ref3 = doc.children;
|
||||
for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
||||
child = ref3[i];
|
||||
if (child.isRoot) {
|
||||
doc.children.splice(i, 0, doctype);
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
doc.children.push(doctype);
|
||||
return doctype;
|
||||
};
|
||||
|
||||
XMLNode.prototype.up = function() {
|
||||
if (this.isRoot) {
|
||||
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
||||
}
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.root = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node.rootObject;
|
||||
} else if (node.isRoot) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.document = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.end = function(options) {
|
||||
return this.document().end(options);
|
||||
};
|
||||
|
||||
XMLNode.prototype.prev = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i < 1) {
|
||||
throw new Error("Already at the first node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i - 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.next = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i === -1 || i === this.parent.children.length - 1) {
|
||||
throw new Error("Already at the last node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i + 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.importDocument = function(doc) {
|
||||
var clonedRoot;
|
||||
clonedRoot = doc.root().clone();
|
||||
clonedRoot.parent = this;
|
||||
clonedRoot.isRoot = false;
|
||||
this.children.push(clonedRoot);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.debugInfo = function(name) {
|
||||
var ref2, ref3;
|
||||
name = name || this.name;
|
||||
if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
||||
return "";
|
||||
} else if (name == null) {
|
||||
return "parent: <" + this.parent.name + ">";
|
||||
} else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
||||
return "node: <" + name + ">";
|
||||
} else {
|
||||
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.ele = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.nod = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.txt = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
||||
return this.declaration(version, encoding, standalone);
|
||||
};
|
||||
|
||||
XMLNode.prototype.e = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.n = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.t = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.d = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.c = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.r = function(value) {
|
||||
return this.raw(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.i = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.u = function() {
|
||||
return this.up();
|
||||
};
|
||||
|
||||
XMLNode.prototype.importXMLBuilder = function(doc) {
|
||||
return this.importDocument(doc);
|
||||
};
|
||||
|
||||
XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.removeChild = function(oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.appendChild = function(newChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasChildNodes = function() {
|
||||
return this.children.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cloneNode = function(deep) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.normalize = function() {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSupported = function(feature, version) {
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasAttributes = function() {
|
||||
return this.attribs.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.compareDocumentPosition = function(other) {
|
||||
var ref, res;
|
||||
ref = this;
|
||||
if (ref === other) {
|
||||
return 0;
|
||||
} else if (this.document() !== other.document()) {
|
||||
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
||||
if (Math.random() < 0.5) {
|
||||
res |= DocumentPosition.Preceding;
|
||||
} else {
|
||||
res |= DocumentPosition.Following;
|
||||
}
|
||||
return res;
|
||||
} else if (ref.isAncestor(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Preceding;
|
||||
} else if (ref.isDescendant(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Following;
|
||||
} else if (ref.isPreceding(other)) {
|
||||
return DocumentPosition.Preceding;
|
||||
} else {
|
||||
return DocumentPosition.Following;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSameNode = function(other) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isEqualNode = function(node) {
|
||||
var i, j, ref2;
|
||||
if (node.nodeType !== this.nodeType) {
|
||||
return false;
|
||||
}
|
||||
if (node.children.length !== this.children.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
||||
if (!this.children[i].isEqualNode(node.children[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.getFeature = function(feature, version) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.setUserData = function(key, data, handler) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.getUserData = function(key) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.contains = function(other) {
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
return other === this || this.isDescendant(other);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDescendant = function(node) {
|
||||
var child, isDescendantChild, j, len, ref2;
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (node === child) {
|
||||
return true;
|
||||
}
|
||||
isDescendantChild = child.isDescendant(node);
|
||||
if (isDescendantChild) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
XMLNode.prototype.isAncestor = function(node) {
|
||||
return node.isDescendant(this);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isPreceding = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos < thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isFollowing = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos > thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.treePosition = function(node) {
|
||||
var found, pos;
|
||||
pos = 0;
|
||||
found = false;
|
||||
this.foreachTreeNode(this.document(), function(childNode) {
|
||||
pos++;
|
||||
if (!found && childNode === node) {
|
||||
return found = true;
|
||||
}
|
||||
});
|
||||
if (found) {
|
||||
return pos;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.foreachTreeNode = function(node, func) {
|
||||
var child, j, len, ref2, res;
|
||||
node || (node = this.document());
|
||||
ref2 = node.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (res = func(child)) {
|
||||
return res;
|
||||
} else {
|
||||
res = this.foreachTreeNode(child, func);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return XMLNode;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 263:
|
||||
@ -7386,7 +8271,7 @@ var MatchKind;
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
const { fromCallback } = __webpack_require__(676);
|
||||
const { fromCallback } = __webpack_require__(147);
|
||||
const Store = __webpack_require__(338).Store;
|
||||
const permuteDomain = __webpack_require__(89).permuteDomain;
|
||||
const pathMatch = __webpack_require__(348).pathMatch;
|
||||
@ -27667,7 +28552,7 @@ const Store = __webpack_require__(338).Store;
|
||||
const MemoryCookieStore = __webpack_require__(332).MemoryCookieStore;
|
||||
const pathMatch = __webpack_require__(348).pathMatch;
|
||||
const VERSION = __webpack_require__(460);
|
||||
const { fromCallback } = __webpack_require__(676);
|
||||
const { fromCallback } = __webpack_require__(147);
|
||||
|
||||
// From RFC6265 S4.1.1
|
||||
// note that it excludes \x3B ";"
|
||||
@ -29321,290 +30206,290 @@ module.exports = require("crypto");
|
||||
/***/ 422:
|
||||
/***/ (function(module) {
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__createBinding = function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
};
|
||||
|
||||
__exportStar = function (m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
};
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__createBinding = function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
};
|
||||
|
||||
__exportStar = function (m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
};
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -30048,7 +30933,7 @@ var __createBinding;
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
var iterate = __webpack_require__(157)
|
||||
, initState = __webpack_require__(147)
|
||||
, initState = __webpack_require__(903)
|
||||
, terminator = __webpack_require__(939)
|
||||
;
|
||||
|
||||
@ -30197,129 +31082,130 @@ function escapeProperty(s) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exec_1 = __webpack_require__(986);
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs_1 = __webpack_require__(747);
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
function getTarPath(args, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (IS_WINDOWS) {
|
||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
|
||||
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
|
||||
// We only use zstandard compression on windows when gnu tar is installed due to
|
||||
// a bug with compressing large files with bsdtar + zstd
|
||||
args.push('--force-local');
|
||||
}
|
||||
else if (fs_1.existsSync(systemTar)) {
|
||||
return systemTar;
|
||||
}
|
||||
else if (yield utils.isGnuTarInstalled()) {
|
||||
args.push('--force-local');
|
||||
}
|
||||
}
|
||||
return yield io.which('tar', true);
|
||||
});
|
||||
}
|
||||
function execTar(args, compressionMethod, cwd) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd });
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getWorkingDirectory() {
|
||||
var _a;
|
||||
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
|
||||
}
|
||||
function extractTar(archivePath, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create directory to extract tar into
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
yield io.mkdirP(workingDirectory);
|
||||
// --d: Decompress.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-xf',
|
||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||
];
|
||||
yield execTar(args, compressionMethod);
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Write source directories to manifest.txt to avoid command length limits
|
||||
const manifestFilename = 'manifest.txt';
|
||||
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
||||
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-cf',
|
||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'--files-from',
|
||||
manifestFilename
|
||||
];
|
||||
yield execTar(args, compressionMethod, archiveFolder);
|
||||
});
|
||||
}
|
||||
exports.createTar = createTar;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exec_1 = __webpack_require__(986);
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs_1 = __webpack_require__(747);
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
function getTarPath(args, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (IS_WINDOWS) {
|
||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
|
||||
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
|
||||
// We only use zstandard compression on windows when gnu tar is installed due to
|
||||
// a bug with compressing large files with bsdtar + zstd
|
||||
args.push('--force-local');
|
||||
}
|
||||
else if (fs_1.existsSync(systemTar)) {
|
||||
return systemTar;
|
||||
}
|
||||
else if (yield utils.isGnuTarInstalled()) {
|
||||
args.push('--force-local');
|
||||
}
|
||||
}
|
||||
return yield io.which('tar', true);
|
||||
});
|
||||
}
|
||||
function execTar(args, compressionMethod, cwd) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd });
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getWorkingDirectory() {
|
||||
var _a;
|
||||
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
|
||||
}
|
||||
function extractTar(archivePath, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create directory to extract tar into
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
yield io.mkdirP(workingDirectory);
|
||||
// --d: Decompress.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-xf',
|
||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||
];
|
||||
yield execTar(args, compressionMethod);
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Write source directories to manifest.txt to avoid command length limits
|
||||
const manifestFilename = 'manifest.txt';
|
||||
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
||||
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
'--posix',
|
||||
...getCompressionProgram(),
|
||||
'-cf',
|
||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'--files-from',
|
||||
manifestFilename
|
||||
];
|
||||
yield execTar(args, compressionMethod, archiveFolder);
|
||||
});
|
||||
}
|
||||
exports.createTar = createTar;
|
||||
//# sourceMappingURL=tar.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -32449,7 +33335,7 @@ module.exports = '4.0.0'
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -33132,67 +34018,67 @@ module.exports = {"application/1d-interleaved-parityfec":{"source":"iana"},"appl
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
/**
|
||||
* Returns a copy of the upload options with defaults filled in.
|
||||
*
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
const result = {
|
||||
uploadConcurrency: 4,
|
||||
uploadChunkSize: 32 * 1024 * 1024
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.uploadConcurrency === 'number') {
|
||||
result.uploadConcurrency = copy.uploadConcurrency;
|
||||
}
|
||||
if (typeof copy.uploadChunkSize === 'number') {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
return result;
|
||||
}
|
||||
exports.getUploadOptions = getUploadOptions;
|
||||
/**
|
||||
* Returns a copy of the download options with defaults filled in.
|
||||
*
|
||||
* @param copy the original download options
|
||||
*/
|
||||
function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
result.useAzureSdk = copy.useAzureSdk;
|
||||
}
|
||||
if (typeof copy.downloadConcurrency === 'number') {
|
||||
result.downloadConcurrency = copy.downloadConcurrency;
|
||||
}
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
/**
|
||||
* Returns a copy of the upload options with defaults filled in.
|
||||
*
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
const result = {
|
||||
uploadConcurrency: 4,
|
||||
uploadChunkSize: 32 * 1024 * 1024
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.uploadConcurrency === 'number') {
|
||||
result.uploadConcurrency = copy.uploadConcurrency;
|
||||
}
|
||||
if (typeof copy.uploadChunkSize === 'number') {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
return result;
|
||||
}
|
||||
exports.getUploadOptions = getUploadOptions;
|
||||
/**
|
||||
* Returns a copy of the download options with defaults filled in.
|
||||
*
|
||||
* @param copy the original download options
|
||||
*/
|
||||
function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
result.useAzureSdk = copy.useAzureSdk;
|
||||
}
|
||||
if (typeof copy.downloadConcurrency === 'number') {
|
||||
result.downloadConcurrency = copy.downloadConcurrency;
|
||||
}
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
//# sourceMappingURL=options.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -34018,7 +34904,7 @@ CombinedStream.prototype._emitError = function(err) {
|
||||
|
||||
XMLDOMConfiguration = __webpack_require__(524);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -34542,6 +35428,36 @@ Object.defineProperty(exports, "v5", {
|
||||
return _v4.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NIL", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _nil.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _version.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "validate", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validate.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "stringify", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _stringify.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _v = _interopRequireDefault(__webpack_require__(173));
|
||||
|
||||
@ -34551,6 +35467,16 @@ var _v3 = _interopRequireDefault(__webpack_require__(606));
|
||||
|
||||
var _v4 = _interopRequireDefault(__webpack_require__(90));
|
||||
|
||||
var _nil = _interopRequireDefault(__webpack_require__(24));
|
||||
|
||||
var _version = _interopRequireDefault(__webpack_require__(104));
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
var _parse = _interopRequireDefault(__webpack_require__(197));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/***/ }),
|
||||
@ -34940,7 +35866,7 @@ exports.default = void 0;
|
||||
|
||||
var _rng = _interopRequireDefault(__webpack_require__(733));
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -34963,7 +35889,7 @@ function v4(options, buf, offset) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _bytesToUuid.default)(rnds);
|
||||
return (0, _stringify.default)(rnds);
|
||||
}
|
||||
|
||||
var _default = v4;
|
||||
@ -35231,7 +36157,7 @@ module.exports = require("net");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLCharacterData = (function(superClass) {
|
||||
extend(XMLCharacterData, superClass);
|
||||
@ -36934,7 +37860,7 @@ module.exports = require("net");
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLRaw = (function(superClass) {
|
||||
extend(XMLRaw, superClass);
|
||||
@ -36976,7 +37902,7 @@ module.exports = require("net");
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -37335,35 +38261,26 @@ function isUnixExecutable(stats) {
|
||||
/***/ }),
|
||||
|
||||
/***/ 676:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
exports.fromCallback = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
|
||||
else {
|
||||
return new Promise((resolve, reject) => {
|
||||
arguments[arguments.length] = (err, res) => {
|
||||
if (err) return reject(err)
|
||||
resolve(res)
|
||||
}
|
||||
arguments.length++
|
||||
fn.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
exports.fromPromise = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
const cb = arguments[arguments.length - 1]
|
||||
if (typeof cb !== 'function') return fn.apply(this, arguments)
|
||||
else fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
}, 'name', { value: fn.name })
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _regex = _interopRequireDefault(__webpack_require__(238));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function validate(uuid) {
|
||||
return typeof uuid === 'string' && _regex.default.test(uuid);
|
||||
}
|
||||
|
||||
var _default = validate;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -37401,152 +38318,152 @@ exports.fromPromise = function (fn) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const cacheHttpClient = __importStar(__webpack_require__(114));
|
||||
const tar_1 = __webpack_require__(434);
|
||||
class ValidationError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ValidationError';
|
||||
Object.setPrototypeOf(this, ValidationError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
||||
class ReserveCacheError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ReserveCacheError';
|
||||
Object.setPrototypeOf(this, ReserveCacheError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ReserveCacheError = ReserveCacheError;
|
||||
function checkPaths(paths) {
|
||||
if (!paths || paths.length === 0) {
|
||||
throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
|
||||
}
|
||||
}
|
||||
function checkKey(key) {
|
||||
if (key.length > 512) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot be larger than 512 characters.`);
|
||||
}
|
||||
const regex = /^[^,]*$/;
|
||||
if (!regex.test(key)) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param downloadOptions cache download options
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCache(paths, primaryKey, restoreKeys, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
restoreKeys = restoreKeys || [];
|
||||
const keys = [primaryKey, ...restoreKeys];
|
||||
core.debug('Resolved Keys:');
|
||||
core.debug(JSON.stringify(keys));
|
||||
if (keys.length > 10) {
|
||||
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
|
||||
}
|
||||
for (const key of keys) {
|
||||
checkKey(key);
|
||||
}
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
// path are needed to compute version
|
||||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
|
||||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
try {
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||
yield tar_1.extractTar(archivePath, compressionMethod);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
try {
|
||||
yield utils.unlinkFile(archivePath);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(`Failed to delete archive: ${error}`);
|
||||
}
|
||||
}
|
||||
return cacheEntry.cacheKey;
|
||||
});
|
||||
}
|
||||
exports.restoreCache = restoreCache;
|
||||
/**
|
||||
* Saves a list of files with the specified key
|
||||
*
|
||||
* @param paths a list of file paths to be cached
|
||||
* @param key an explicit key for restoring the cache
|
||||
* @param options cache upload options
|
||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
core.debug('Reserving Cache');
|
||||
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (cacheId === -1) {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug('Cache Paths:');
|
||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||
const archiveFolder = yield utils.createTempDirectory();
|
||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
|
||||
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.debug(`File Size: ${archiveFileSize}`);
|
||||
if (archiveFileSize > fileSizeLimit) {
|
||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`);
|
||||
}
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
return cacheId;
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const cacheHttpClient = __importStar(__webpack_require__(114));
|
||||
const tar_1 = __webpack_require__(434);
|
||||
class ValidationError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ValidationError';
|
||||
Object.setPrototypeOf(this, ValidationError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
||||
class ReserveCacheError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ReserveCacheError';
|
||||
Object.setPrototypeOf(this, ReserveCacheError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ReserveCacheError = ReserveCacheError;
|
||||
function checkPaths(paths) {
|
||||
if (!paths || paths.length === 0) {
|
||||
throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
|
||||
}
|
||||
}
|
||||
function checkKey(key) {
|
||||
if (key.length > 512) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot be larger than 512 characters.`);
|
||||
}
|
||||
const regex = /^[^,]*$/;
|
||||
if (!regex.test(key)) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param downloadOptions cache download options
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCache(paths, primaryKey, restoreKeys, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
restoreKeys = restoreKeys || [];
|
||||
const keys = [primaryKey, ...restoreKeys];
|
||||
core.debug('Resolved Keys:');
|
||||
core.debug(JSON.stringify(keys));
|
||||
if (keys.length > 10) {
|
||||
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
|
||||
}
|
||||
for (const key of keys) {
|
||||
checkKey(key);
|
||||
}
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
// path are needed to compute version
|
||||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
|
||||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
try {
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||
yield tar_1.extractTar(archivePath, compressionMethod);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
try {
|
||||
yield utils.unlinkFile(archivePath);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(`Failed to delete archive: ${error}`);
|
||||
}
|
||||
}
|
||||
return cacheEntry.cacheKey;
|
||||
});
|
||||
}
|
||||
exports.restoreCache = restoreCache;
|
||||
/**
|
||||
* Saves a list of files with the specified key
|
||||
*
|
||||
* @param paths a list of file paths to be cached
|
||||
* @param key an explicit key for restoring the cache
|
||||
* @param options cache upload options
|
||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
core.debug('Reserving Cache');
|
||||
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (cacheId === -1) {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug('Cache Paths:');
|
||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||
const archiveFolder = yield utils.createTempDirectory();
|
||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
|
||||
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.debug(`File Size: ${archiveFileSize}`);
|
||||
if (archiveFileSize > fileSizeLimit) {
|
||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`);
|
||||
}
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
return cacheId;
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
//# sourceMappingURL=cache.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -37767,7 +38684,7 @@ function rng() {
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -37960,7 +38877,7 @@ function rng() {
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -39913,7 +40830,7 @@ module.exports = require("stream");
|
||||
|
||||
ref = __webpack_require__(582), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -40216,7 +41133,7 @@ module.exports = require("stream");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -40331,1092 +41248,346 @@ module.exports = __webpack_require__(512)
|
||||
/***/ }),
|
||||
|
||||
/***/ 855:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() {
|
||||
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
"use strict";
|
||||
|
||||
ref1 = __webpack_require__(582), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
||||
|
||||
XMLElement = null;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
XMLCData = null;
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
XMLComment = null;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
XMLDeclaration = null;
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
const byteToHex = [];
|
||||
|
||||
XMLDocType = null;
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 0x100).toString(16).substr(1));
|
||||
}
|
||||
|
||||
XMLRaw = null;
|
||||
function stringify(arr, offset = 0) {
|
||||
// Note: Be careful editing this code! It's been tuned for performance
|
||||
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
||||
// of the following:
|
||||
// - One or more input array values don't map to a hex octet (leading to
|
||||
// "undefined" in the uuid)
|
||||
// - Invalid input values for the RFC `version` or `variant` fields
|
||||
|
||||
XMLText = null;
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Stringified UUID is invalid');
|
||||
}
|
||||
|
||||
XMLProcessingInstruction = null;
|
||||
|
||||
XMLDummy = null;
|
||||
|
||||
NodeType = null;
|
||||
|
||||
XMLNodeList = null;
|
||||
|
||||
XMLNamedNodeMap = null;
|
||||
|
||||
DocumentPosition = null;
|
||||
|
||||
module.exports = XMLNode = (function() {
|
||||
function XMLNode(parent1) {
|
||||
this.parent = parent1;
|
||||
if (this.parent) {
|
||||
this.options = this.parent.options;
|
||||
this.stringify = this.parent.stringify;
|
||||
}
|
||||
this.value = null;
|
||||
this.children = [];
|
||||
this.baseURI = null;
|
||||
if (!XMLElement) {
|
||||
XMLElement = __webpack_require__(796);
|
||||
XMLCData = __webpack_require__(657);
|
||||
XMLComment = __webpack_require__(919);
|
||||
XMLDeclaration = __webpack_require__(738);
|
||||
XMLDocType = __webpack_require__(735);
|
||||
XMLRaw = __webpack_require__(660);
|
||||
XMLText = __webpack_require__(708);
|
||||
XMLProcessingInstruction = __webpack_require__(491);
|
||||
XMLDummy = __webpack_require__(956);
|
||||
NodeType = __webpack_require__(683);
|
||||
XMLNodeList = __webpack_require__(265);
|
||||
XMLNamedNodeMap = __webpack_require__(451);
|
||||
DocumentPosition = __webpack_require__(65);
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
||||
get: function() {
|
||||
return this.name;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
||||
get: function() {
|
||||
return this.type;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
||||
get: function() {
|
||||
return this.value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
||||
get: function() {
|
||||
return this.parent;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
||||
get: function() {
|
||||
if (!this.childNodeList || !this.childNodeList.nodes) {
|
||||
this.childNodeList = new XMLNodeList(this.children);
|
||||
}
|
||||
return this.childNodeList;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
||||
get: function() {
|
||||
return this.children[0] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
||||
get: function() {
|
||||
return this.children[this.children.length - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i + 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
||||
get: function() {
|
||||
return this.document() || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'textContent', {
|
||||
get: function() {
|
||||
var child, j, len, ref2, str;
|
||||
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
||||
str = '';
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (child.textContent) {
|
||||
str += child.textContent;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
}
|
||||
});
|
||||
|
||||
XMLNode.prototype.setParent = function(parent) {
|
||||
var child, j, len, ref2, results;
|
||||
this.parent = parent;
|
||||
if (parent) {
|
||||
this.options = parent.options;
|
||||
this.stringify = parent.stringify;
|
||||
}
|
||||
ref2 = this.children;
|
||||
results = [];
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
results.push(child.setParent(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
XMLNode.prototype.element = function(name, attributes, text) {
|
||||
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
||||
lastChild = null;
|
||||
if (attributes === null && (text == null)) {
|
||||
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
||||
}
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
||||
}
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
if (Array.isArray(name)) {
|
||||
for (j = 0, len = name.length; j < len; j++) {
|
||||
item = name[j];
|
||||
lastChild = this.element(item);
|
||||
}
|
||||
} else if (isFunction(name)) {
|
||||
lastChild = this.element(name.apply());
|
||||
} else if (isObject(name)) {
|
||||
for (key in name) {
|
||||
if (!hasProp.call(name, key)) continue;
|
||||
val = name[key];
|
||||
if (isFunction(val)) {
|
||||
val = val.apply();
|
||||
}
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
||||
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (isObject(val) && isEmpty(val)) {
|
||||
lastChild = this.element(key);
|
||||
} else if (!this.options.keepNullNodes && (val == null)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
||||
for (k = 0, len1 = val.length; k < len1; k++) {
|
||||
item = val[k];
|
||||
childNode = {};
|
||||
childNode[key] = item;
|
||||
lastChild = this.element(childNode);
|
||||
}
|
||||
} else if (isObject(val)) {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.element(val);
|
||||
} else {
|
||||
lastChild = this.element(key);
|
||||
lastChild.element(val);
|
||||
}
|
||||
} else {
|
||||
lastChild = this.element(key, val);
|
||||
}
|
||||
}
|
||||
} else if (!this.options.keepNullNodes && text === null) {
|
||||
lastChild = this.dummy();
|
||||
} else {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.text(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
||||
lastChild = this.cdata(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
||||
lastChild = this.comment(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
||||
lastChild = this.raw(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
||||
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
||||
} else {
|
||||
lastChild = this.node(name, attributes, text);
|
||||
}
|
||||
}
|
||||
if (lastChild == null) {
|
||||
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
||||
}
|
||||
return lastChild;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
||||
var child, i, newChild, refChild, removed;
|
||||
if (name != null ? name.type : void 0) {
|
||||
newChild = name;
|
||||
refChild = attributes;
|
||||
newChild.setParent(this);
|
||||
if (refChild) {
|
||||
i = children.indexOf(refChild);
|
||||
removed = children.splice(i);
|
||||
children.push(newChild);
|
||||
Array.prototype.push.apply(children, removed);
|
||||
} else {
|
||||
children.push(newChild);
|
||||
}
|
||||
return newChild;
|
||||
} else {
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.remove = function() {
|
||||
var i, ref2;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot remove the root element. " + this.debugInfo());
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.node = function(name, attributes, text) {
|
||||
var child, ref2;
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
attributes || (attributes = {});
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
||||
}
|
||||
child = new XMLElement(this, name, attributes);
|
||||
if (text != null) {
|
||||
child.text(text);
|
||||
}
|
||||
this.children.push(child);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.text = function(value) {
|
||||
var child;
|
||||
if (isObject(value)) {
|
||||
this.element(value);
|
||||
}
|
||||
child = new XMLText(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentBefore = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentAfter = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.raw = function(value) {
|
||||
var child;
|
||||
child = new XMLRaw(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dummy = function() {
|
||||
var child;
|
||||
child = new XMLDummy(this);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instruction = function(target, value) {
|
||||
var insTarget, insValue, instruction, j, len;
|
||||
if (target != null) {
|
||||
target = getValue(target);
|
||||
}
|
||||
if (value != null) {
|
||||
value = getValue(value);
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (j = 0, len = target.length; j < len; j++) {
|
||||
insTarget = target[j];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
instruction = new XMLProcessingInstruction(this, target, value);
|
||||
this.children.push(instruction);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionBefore = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionAfter = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
||||
var doc, xmldec;
|
||||
doc = this.document();
|
||||
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
||||
if (doc.children.length === 0) {
|
||||
doc.children.unshift(xmldec);
|
||||
} else if (doc.children[0].type === NodeType.Declaration) {
|
||||
doc.children[0] = xmldec;
|
||||
} else {
|
||||
doc.children.unshift(xmldec);
|
||||
}
|
||||
return doc.root() || doc;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dtd = function(pubID, sysID) {
|
||||
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
||||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
ref2 = doc.children;
|
||||
for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
||||
child = ref2[i];
|
||||
if (child.type === NodeType.DocType) {
|
||||
doc.children[i] = doctype;
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
ref3 = doc.children;
|
||||
for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
||||
child = ref3[i];
|
||||
if (child.isRoot) {
|
||||
doc.children.splice(i, 0, doctype);
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
doc.children.push(doctype);
|
||||
return doctype;
|
||||
};
|
||||
|
||||
XMLNode.prototype.up = function() {
|
||||
if (this.isRoot) {
|
||||
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
||||
}
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.root = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node.rootObject;
|
||||
} else if (node.isRoot) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.document = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.end = function(options) {
|
||||
return this.document().end(options);
|
||||
};
|
||||
|
||||
XMLNode.prototype.prev = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i < 1) {
|
||||
throw new Error("Already at the first node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i - 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.next = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i === -1 || i === this.parent.children.length - 1) {
|
||||
throw new Error("Already at the last node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i + 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.importDocument = function(doc) {
|
||||
var clonedRoot;
|
||||
clonedRoot = doc.root().clone();
|
||||
clonedRoot.parent = this;
|
||||
clonedRoot.isRoot = false;
|
||||
this.children.push(clonedRoot);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.debugInfo = function(name) {
|
||||
var ref2, ref3;
|
||||
name = name || this.name;
|
||||
if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
||||
return "";
|
||||
} else if (name == null) {
|
||||
return "parent: <" + this.parent.name + ">";
|
||||
} else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
||||
return "node: <" + name + ">";
|
||||
} else {
|
||||
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.ele = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.nod = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.txt = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
||||
return this.declaration(version, encoding, standalone);
|
||||
};
|
||||
|
||||
XMLNode.prototype.e = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.n = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.t = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.d = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.c = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.r = function(value) {
|
||||
return this.raw(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.i = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.u = function() {
|
||||
return this.up();
|
||||
};
|
||||
|
||||
XMLNode.prototype.importXMLBuilder = function(doc) {
|
||||
return this.importDocument(doc);
|
||||
};
|
||||
|
||||
XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.removeChild = function(oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.appendChild = function(newChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasChildNodes = function() {
|
||||
return this.children.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cloneNode = function(deep) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.normalize = function() {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSupported = function(feature, version) {
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasAttributes = function() {
|
||||
return this.attribs.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.compareDocumentPosition = function(other) {
|
||||
var ref, res;
|
||||
ref = this;
|
||||
if (ref === other) {
|
||||
return 0;
|
||||
} else if (this.document() !== other.document()) {
|
||||
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
||||
if (Math.random() < 0.5) {
|
||||
res |= DocumentPosition.Preceding;
|
||||
} else {
|
||||
res |= DocumentPosition.Following;
|
||||
}
|
||||
return res;
|
||||
} else if (ref.isAncestor(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Preceding;
|
||||
} else if (ref.isDescendant(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Following;
|
||||
} else if (ref.isPreceding(other)) {
|
||||
return DocumentPosition.Preceding;
|
||||
} else {
|
||||
return DocumentPosition.Following;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSameNode = function(other) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isEqualNode = function(node) {
|
||||
var i, j, ref2;
|
||||
if (node.nodeType !== this.nodeType) {
|
||||
return false;
|
||||
}
|
||||
if (node.children.length !== this.children.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
||||
if (!this.children[i].isEqualNode(node.children[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.getFeature = function(feature, version) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.setUserData = function(key, data, handler) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.getUserData = function(key) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.contains = function(other) {
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
return other === this || this.isDescendant(other);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDescendant = function(node) {
|
||||
var child, isDescendantChild, j, len, ref2;
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (node === child) {
|
||||
return true;
|
||||
}
|
||||
isDescendantChild = child.isDescendant(node);
|
||||
if (isDescendantChild) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
XMLNode.prototype.isAncestor = function(node) {
|
||||
return node.isDescendant(this);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isPreceding = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos < thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isFollowing = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos > thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.treePosition = function(node) {
|
||||
var found, pos;
|
||||
pos = 0;
|
||||
found = false;
|
||||
this.foreachTreeNode(this.document(), function(childNode) {
|
||||
pos++;
|
||||
if (!found && childNode === node) {
|
||||
return found = true;
|
||||
}
|
||||
});
|
||||
if (found) {
|
||||
return pos;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.foreachTreeNode = function(node, func) {
|
||||
var child, j, len, ref2, res;
|
||||
node || (node = this.document());
|
||||
ref2 = node.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (res = func(child)) {
|
||||
return res;
|
||||
} else {
|
||||
res = this.foreachTreeNode(child, func);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return XMLNode;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
var _default = stringify;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 865:
|
||||
/***/ (function(module) {
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -41492,7 +41663,7 @@ exports.TraceAPI = TraceAPI;
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLAttribute = (function() {
|
||||
function XMLAttribute(parent, name, value) {
|
||||
@ -42464,7 +42635,7 @@ exports.PollerStoppedError = PollerStoppedError;
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
var iterate = __webpack_require__(157)
|
||||
, initState = __webpack_require__(147)
|
||||
, initState = __webpack_require__(903)
|
||||
, terminator = __webpack_require__(939)
|
||||
;
|
||||
|
||||
@ -42581,98 +42752,142 @@ module.exports = uuid;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
function isSuccessStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
exports.isSuccessStatusCode = isSuccessStatusCode;
|
||||
function isServerErrorStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return true;
|
||||
}
|
||||
return statusCode >= 500;
|
||||
}
|
||||
exports.isServerErrorStatusCode = isServerErrorStatusCode;
|
||||
function isRetryableStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
const retryableStatusCodes = [
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout
|
||||
];
|
||||
return retryableStatusCodes.includes(statusCode);
|
||||
}
|
||||
exports.isRetryableStatusCode = isRetryableStatusCode;
|
||||
function retry(name, method, getStatusCode, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let response = undefined;
|
||||
let statusCode = undefined;
|
||||
let isRetryable = false;
|
||||
let errorMessage = '';
|
||||
let attempt = 1;
|
||||
while (attempt <= maxAttempts) {
|
||||
try {
|
||||
response = yield method();
|
||||
statusCode = getStatusCode(response);
|
||||
if (!isServerErrorStatusCode(statusCode)) {
|
||||
return response;
|
||||
}
|
||||
isRetryable = isRetryableStatusCode(statusCode);
|
||||
errorMessage = `Cache service responded with ${statusCode}`;
|
||||
}
|
||||
catch (error) {
|
||||
isRetryable = true;
|
||||
errorMessage = error.message;
|
||||
}
|
||||
core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
||||
if (!isRetryable) {
|
||||
core.debug(`${name} - Error is not retryable`);
|
||||
break;
|
||||
}
|
||||
attempt++;
|
||||
}
|
||||
throw Error(`${name} failed: ${errorMessage}`);
|
||||
});
|
||||
}
|
||||
exports.retry = retry;
|
||||
function retryTypedResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryTypedResponse = retryTypedResponse;
|
||||
function retryHttpClientResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryHttpClientResponse = retryHttpClientResponse;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
function isSuccessStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
exports.isSuccessStatusCode = isSuccessStatusCode;
|
||||
function isServerErrorStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return true;
|
||||
}
|
||||
return statusCode >= 500;
|
||||
}
|
||||
exports.isServerErrorStatusCode = isServerErrorStatusCode;
|
||||
function isRetryableStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
const retryableStatusCodes = [
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout
|
||||
];
|
||||
return retryableStatusCodes.includes(statusCode);
|
||||
}
|
||||
exports.isRetryableStatusCode = isRetryableStatusCode;
|
||||
function retry(name, method, getStatusCode, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let response = undefined;
|
||||
let statusCode = undefined;
|
||||
let isRetryable = false;
|
||||
let errorMessage = '';
|
||||
let attempt = 1;
|
||||
while (attempt <= maxAttempts) {
|
||||
try {
|
||||
response = yield method();
|
||||
statusCode = getStatusCode(response);
|
||||
if (!isServerErrorStatusCode(statusCode)) {
|
||||
return response;
|
||||
}
|
||||
isRetryable = isRetryableStatusCode(statusCode);
|
||||
errorMessage = `Cache service responded with ${statusCode}`;
|
||||
}
|
||||
catch (error) {
|
||||
isRetryable = true;
|
||||
errorMessage = error.message;
|
||||
}
|
||||
core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
||||
if (!isRetryable) {
|
||||
core.debug(`${name} - Error is not retryable`);
|
||||
break;
|
||||
}
|
||||
attempt++;
|
||||
}
|
||||
throw Error(`${name} failed: ${errorMessage}`);
|
||||
});
|
||||
}
|
||||
exports.retry = retry;
|
||||
function retryTypedResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryTypedResponse = retryTypedResponse;
|
||||
function retryHttpClientResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryHttpClientResponse = retryHttpClientResponse;
|
||||
//# sourceMappingURL=requestUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 903:
|
||||
/***/ (function(module) {
|
||||
|
||||
// API
|
||||
module.exports = state;
|
||||
|
||||
/**
|
||||
* Creates initial state object
|
||||
* for iteration over list
|
||||
*
|
||||
* @param {array|object} list - list to iterate over
|
||||
* @param {function|null} sortMethod - function to use for keys sort,
|
||||
* or `null` to keep them as is
|
||||
* @returns {object} - initial state object
|
||||
*/
|
||||
function state(list, sortMethod)
|
||||
{
|
||||
var isNamedList = !Array.isArray(list)
|
||||
, initState =
|
||||
{
|
||||
index : 0,
|
||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||
jobs : {},
|
||||
results : isNamedList ? {} : [],
|
||||
size : isNamedList ? Object.keys(list).length : list.length
|
||||
}
|
||||
;
|
||||
|
||||
if (sortMethod)
|
||||
{
|
||||
// sort array keys based on it's values
|
||||
// sort object's keys just on own merit
|
||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||
{
|
||||
return sortMethod(list[a], list[b]);
|
||||
});
|
||||
}
|
||||
|
||||
return initState;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 919:
|
||||
@ -43248,25 +43463,25 @@ exports.setLogLevel = setLogLevel;
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var CacheFilename;
|
||||
(function (CacheFilename) {
|
||||
CacheFilename["Gzip"] = "cache.tgz";
|
||||
CacheFilename["Zstd"] = "cache.tzst";
|
||||
})(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {}));
|
||||
var CompressionMethod;
|
||||
(function (CompressionMethod) {
|
||||
CompressionMethod["Gzip"] = "gzip";
|
||||
// Long range mode was added to zstd in v1.3.2.
|
||||
// This enum is for earlier version of zstd that does not have --long support
|
||||
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
|
||||
CompressionMethod["Zstd"] = "zstd";
|
||||
})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
|
||||
// Socket timeout in milliseconds during download. If no traffic is received
|
||||
// over the socket during this period, the socket is destroyed and the download
|
||||
// is aborted.
|
||||
exports.SocketTimeout = 5000;
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var CacheFilename;
|
||||
(function (CacheFilename) {
|
||||
CacheFilename["Gzip"] = "cache.tgz";
|
||||
CacheFilename["Zstd"] = "cache.tzst";
|
||||
})(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {}));
|
||||
var CompressionMethod;
|
||||
(function (CompressionMethod) {
|
||||
CompressionMethod["Gzip"] = "gzip";
|
||||
// Long range mode was added to zstd in v1.3.2.
|
||||
// This enum is for earlier version of zstd that does not have --long support
|
||||
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
|
||||
CompressionMethod["Zstd"] = "zstd";
|
||||
})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
|
||||
// Socket timeout in milliseconds during download. If no traffic is received
|
||||
// over the socket during this period, the socket is destroyed and the download
|
||||
// is aborted.
|
||||
exports.SocketTimeout = 5000;
|
||||
//# sourceMappingURL=constants.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -43467,39 +43682,6 @@ function terminator(callback)
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 940:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
const byteToHex = [];
|
||||
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 0x100).toString(16).substr(1));
|
||||
}
|
||||
|
||||
function bytesToUuid(buf, offset_) {
|
||||
const offset = offset_ || 0; // Note: Be careful editing this code! It's been tuned for performance
|
||||
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||
|
||||
return (byteToHex[buf[offset + 0]] + byteToHex[buf[offset + 1]] + byteToHex[buf[offset + 2]] + byteToHex[buf[offset + 3]] + '-' + byteToHex[buf[offset + 4]] + byteToHex[buf[offset + 5]] + '-' + byteToHex[buf[offset + 6]] + byteToHex[buf[offset + 7]] + '-' + byteToHex[buf[offset + 8]] + byteToHex[buf[offset + 9]] + '-' + byteToHex[buf[offset + 10]] + byteToHex[buf[offset + 11]] + byteToHex[buf[offset + 12]] + byteToHex[buf[offset + 13]] + byteToHex[buf[offset + 14]] + byteToHex[buf[offset + 15]]).toLowerCase();
|
||||
}
|
||||
|
||||
var _default = bytesToUuid;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 950:
|
||||
@ -43577,7 +43759,7 @@ exports.checkBypass = checkBypass;
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -43937,7 +44119,7 @@ var tslib = __webpack_require__(865);
|
||||
var tough = __webpack_require__(393);
|
||||
var http = __webpack_require__(605);
|
||||
var https = __webpack_require__(211);
|
||||
__webpack_require__(454);
|
||||
var node_fetch = _interopDefault(__webpack_require__(454));
|
||||
var abortController = __webpack_require__(106);
|
||||
var FormData = _interopDefault(__webpack_require__(790));
|
||||
var util = __webpack_require__(669);
|
||||
@ -44124,7 +44306,7 @@ var Constants = {
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
coreHttpVersion: "1.1.4",
|
||||
coreHttpVersion: "1.1.5",
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
*
|
||||
@ -46431,11 +46613,6 @@ function isValidPort(port) {
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
var globalWithFetch = global;
|
||||
if (typeof globalWithFetch.fetch !== "function") {
|
||||
var fetch_1 = __webpack_require__(454).default;
|
||||
globalWithFetch.fetch = fetch_1;
|
||||
}
|
||||
function getCachedAgent(isHttps, agentCache) {
|
||||
return isHttps ? agentCache.httpsAgent : agentCache.httpAgent;
|
||||
}
|
||||
@ -46492,7 +46669,7 @@ var NodeFetchHttpClient = /** @class */ (function (_super) {
|
||||
NodeFetchHttpClient.prototype.fetch = function (input, init) {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 /*return*/, fetch(input, init)];
|
||||
return [2 /*return*/, node_fetch(input, init)];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
5251
dist/save/index.js
vendored
5251
dist/save/index.js
vendored
@ -987,173 +987,173 @@ class ExecState extends events.EventEmitter {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const glob = __importStar(__webpack_require__(281));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const uuid_1 = __webpack_require__(898);
|
||||
const constants_1 = __webpack_require__(931);
|
||||
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
||||
function createTempDirectory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On Windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
const dest = path.join(tempDirectory, uuid_1.v4());
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.createTempDirectory = createTempDirectory;
|
||||
function getArchiveFileSizeIsBytes(filePath) {
|
||||
return fs.statSync(filePath).size;
|
||||
}
|
||||
exports.getArchiveFileSizeIsBytes = getArchiveFileSizeIsBytes;
|
||||
function resolvePaths(patterns) {
|
||||
var e_1, _a;
|
||||
var _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const paths = [];
|
||||
const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
||||
const globber = yield glob.create(patterns.join('\n'), {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
||||
const file = _d.value;
|
||||
const relativeFile = path.relative(workspace, file);
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
exports.resolvePaths = resolvePaths;
|
||||
function unlinkFile(filePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return util.promisify(fs.unlink)(filePath);
|
||||
});
|
||||
}
|
||||
exports.unlinkFile = unlinkFile;
|
||||
function getVersion(app) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Checking ${app} --version`);
|
||||
let versionOutput = '';
|
||||
try {
|
||||
yield exec.exec(`${app} --version`, [], {
|
||||
ignoreReturnCode: true,
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => (versionOutput += data.toString()),
|
||||
stderr: (data) => (versionOutput += data.toString())
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(err.message);
|
||||
}
|
||||
versionOutput = versionOutput.trim();
|
||||
core.debug(versionOutput);
|
||||
return versionOutput;
|
||||
});
|
||||
}
|
||||
// Use zstandard if possible to maximize cache performance
|
||||
function getCompressionMethod() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (process.platform === 'win32' && !(yield isGnuTarInstalled())) {
|
||||
// Disable zstd due to bug https://github.com/actions/cache/issues/301
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
const versionOutput = yield getVersion('zstd');
|
||||
const version = semver.clean(versionOutput);
|
||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
||||
// zstd is not installed
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
||||
// zstd is installed but using a version earlier than v1.3.2
|
||||
// v1.3.2 is required to use the `--long` options in zstd
|
||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||
}
|
||||
else {
|
||||
return constants_1.CompressionMethod.Zstd;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getCompressionMethod = getCompressionMethod;
|
||||
function getCacheFileName(compressionMethod) {
|
||||
return compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? constants_1.CacheFilename.Gzip
|
||||
: constants_1.CacheFilename.Zstd;
|
||||
}
|
||||
exports.getCacheFileName = getCacheFileName;
|
||||
function isGnuTarInstalled() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionOutput = yield getVersion('tar');
|
||||
return versionOutput.toLowerCase().includes('gnu tar');
|
||||
});
|
||||
}
|
||||
exports.isGnuTarInstalled = isGnuTarInstalled;
|
||||
function assertDefined(name, value) {
|
||||
if (value === undefined) {
|
||||
throw Error(`Expected ${name} but value was undefiend`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.assertDefined = assertDefined;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const glob = __importStar(__webpack_require__(281));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const uuid_1 = __webpack_require__(898);
|
||||
const constants_1 = __webpack_require__(931);
|
||||
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
||||
function createTempDirectory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On Windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
const dest = path.join(tempDirectory, uuid_1.v4());
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.createTempDirectory = createTempDirectory;
|
||||
function getArchiveFileSizeIsBytes(filePath) {
|
||||
return fs.statSync(filePath).size;
|
||||
}
|
||||
exports.getArchiveFileSizeIsBytes = getArchiveFileSizeIsBytes;
|
||||
function resolvePaths(patterns) {
|
||||
var e_1, _a;
|
||||
var _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const paths = [];
|
||||
const workspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
||||
const globber = yield glob.create(patterns.join('\n'), {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
||||
const file = _d.value;
|
||||
const relativeFile = path.relative(workspace, file);
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
exports.resolvePaths = resolvePaths;
|
||||
function unlinkFile(filePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return util.promisify(fs.unlink)(filePath);
|
||||
});
|
||||
}
|
||||
exports.unlinkFile = unlinkFile;
|
||||
function getVersion(app) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Checking ${app} --version`);
|
||||
let versionOutput = '';
|
||||
try {
|
||||
yield exec.exec(`${app} --version`, [], {
|
||||
ignoreReturnCode: true,
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => (versionOutput += data.toString()),
|
||||
stderr: (data) => (versionOutput += data.toString())
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(err.message);
|
||||
}
|
||||
versionOutput = versionOutput.trim();
|
||||
core.debug(versionOutput);
|
||||
return versionOutput;
|
||||
});
|
||||
}
|
||||
// Use zstandard if possible to maximize cache performance
|
||||
function getCompressionMethod() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (process.platform === 'win32' && !(yield isGnuTarInstalled())) {
|
||||
// Disable zstd due to bug https://github.com/actions/cache/issues/301
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
const versionOutput = yield getVersion('zstd');
|
||||
const version = semver.clean(versionOutput);
|
||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
||||
// zstd is not installed
|
||||
return constants_1.CompressionMethod.Gzip;
|
||||
}
|
||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
||||
// zstd is installed but using a version earlier than v1.3.2
|
||||
// v1.3.2 is required to use the `--long` options in zstd
|
||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||
}
|
||||
else {
|
||||
return constants_1.CompressionMethod.Zstd;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getCompressionMethod = getCompressionMethod;
|
||||
function getCacheFileName(compressionMethod) {
|
||||
return compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? constants_1.CacheFilename.Gzip
|
||||
: constants_1.CacheFilename.Zstd;
|
||||
}
|
||||
exports.getCacheFileName = getCacheFileName;
|
||||
function isGnuTarInstalled() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionOutput = yield getVersion('tar');
|
||||
return versionOutput.toLowerCase().includes('gnu tar');
|
||||
});
|
||||
}
|
||||
exports.isGnuTarInstalled = isGnuTarInstalled;
|
||||
function assertDefined(name, value) {
|
||||
if (value === undefined) {
|
||||
throw Error(`Expected ${name} but value was undefiend`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.assertDefined = assertDefined;
|
||||
//# sourceMappingURL=cacheUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -1182,7 +1182,7 @@ eval("require")("encoding");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -1306,6 +1306,21 @@ exports.PropagationAPI = PropagationAPI;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 24:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = '00000000-0000-0000-0000-000000000000';
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 40:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
@ -2635,6 +2650,34 @@ function regExpEscape (s) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 104:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function version(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
return parseInt(uuid.substr(14, 1), 16);
|
||||
}
|
||||
|
||||
var _default = version;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 106:
|
||||
@ -2914,217 +2957,217 @@ exports.AbortSignal = AbortSignal;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const auth_1 = __webpack_require__(226);
|
||||
const crypto = __importStar(__webpack_require__(417));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const url_1 = __webpack_require__(835);
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const downloadUtils_1 = __webpack_require__(251);
|
||||
const options_1 = __webpack_require__(538);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const versionSalt = '1.0';
|
||||
function getCacheApiUrl(resource) {
|
||||
// Ideally we just use ACTIONS_CACHE_URL
|
||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
||||
'').replace('pipelines', 'artifactcache');
|
||||
if (!baseUrl) {
|
||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||
}
|
||||
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
||||
core.debug(`Resource Url: ${url}`);
|
||||
return url;
|
||||
}
|
||||
function createAcceptHeader(type, apiVersion) {
|
||||
return `${type};api-version=${apiVersion}`;
|
||||
}
|
||||
function getRequestOptions() {
|
||||
const requestOptions = {
|
||||
headers: {
|
||||
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
||||
}
|
||||
};
|
||||
return requestOptions;
|
||||
}
|
||||
function createHttpClient() {
|
||||
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
||||
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
||||
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
||||
}
|
||||
function getCacheVersion(paths, compressionMethod) {
|
||||
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? []
|
||||
: [compressionMethod]);
|
||||
// Add salt to cache version to support breaking changes in cache entry
|
||||
components.push(versionSalt);
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(components.join('|'))
|
||||
.digest('hex');
|
||||
}
|
||||
exports.getCacheVersion = getCacheVersion;
|
||||
function getCacheEntry(keys, paths, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
||||
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
||||
if (response.statusCode === 204) {
|
||||
return null;
|
||||
}
|
||||
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${response.statusCode}`);
|
||||
}
|
||||
const cacheResult = response.result;
|
||||
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
||||
if (!cacheDownloadUrl) {
|
||||
throw new Error('Cache not found.');
|
||||
}
|
||||
core.setSecret(cacheDownloadUrl);
|
||||
core.debug(`Cache Result:`);
|
||||
core.debug(JSON.stringify(cacheResult));
|
||||
return cacheResult;
|
||||
});
|
||||
}
|
||||
exports.getCacheEntry = getCacheEntry;
|
||||
function downloadCache(archiveLocation, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const archiveUrl = new url_1.URL(archiveLocation);
|
||||
const downloadOptions = options_1.getDownloadOptions(options);
|
||||
if (downloadOptions.useAzureSdk &&
|
||||
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
||||
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
||||
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
||||
}
|
||||
else {
|
||||
// Otherwise, download using the Actions http-client.
|
||||
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCache = downloadCache;
|
||||
// Reserve Cache
|
||||
function reserveCache(key, paths, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const reserveCacheRequest = {
|
||||
key,
|
||||
version
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
}));
|
||||
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
||||
});
|
||||
}
|
||||
exports.reserveCache = reserveCache;
|
||||
function getContentRange(start, end) {
|
||||
// Format: `bytes start-end/filesize
|
||||
// start and end are inclusive
|
||||
// filesize can be *
|
||||
// For a 200 byte chunk starting at byte 0:
|
||||
// Content-Range: bytes 0-199/*
|
||||
return `bytes ${start}-${end}/*`;
|
||||
}
|
||||
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Uploading chunk of size ${end -
|
||||
start +
|
||||
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
||||
const additionalHeaders = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Range': getContentRange(start, end)
|
||||
};
|
||||
yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function uploadFile(httpClient, cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Upload Chunks
|
||||
const fileSize = fs.statSync(archivePath).size;
|
||||
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
||||
const fd = fs.openSync(archivePath, 'r');
|
||||
const uploadOptions = options_1.getUploadOptions(options);
|
||||
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
||||
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
||||
const parallelUploads = [...new Array(concurrency).keys()];
|
||||
core.debug('Awaiting all uploads');
|
||||
let offset = 0;
|
||||
try {
|
||||
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||
while (offset < fileSize) {
|
||||
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
||||
const start = offset;
|
||||
const end = offset + chunkSize - 1;
|
||||
offset += maxChunkSize;
|
||||
yield uploadChunk(httpClient, resourceUrl, () => fs
|
||||
.createReadStream(archivePath, {
|
||||
fd,
|
||||
start,
|
||||
end,
|
||||
autoClose: false
|
||||
})
|
||||
.on('error', error => {
|
||||
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
||||
}), start, end);
|
||||
}
|
||||
})));
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
function commitCache(httpClient, cacheId, filesize) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commitCacheRequest = { size: filesize };
|
||||
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function saveCache(cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
core.debug('Upload cache');
|
||||
yield uploadFile(httpClient, cacheId, archivePath, options);
|
||||
// Commit Cache
|
||||
core.debug('Commiting cache');
|
||||
const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
||||
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
||||
}
|
||||
core.info('Cache saved successfully');
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const auth_1 = __webpack_require__(226);
|
||||
const crypto = __importStar(__webpack_require__(417));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const url_1 = __webpack_require__(835);
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const downloadUtils_1 = __webpack_require__(251);
|
||||
const options_1 = __webpack_require__(538);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const versionSalt = '1.0';
|
||||
function getCacheApiUrl(resource) {
|
||||
// Ideally we just use ACTIONS_CACHE_URL
|
||||
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
||||
process.env['ACTIONS_RUNTIME_URL'] ||
|
||||
'').replace('pipelines', 'artifactcache');
|
||||
if (!baseUrl) {
|
||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||
}
|
||||
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
||||
core.debug(`Resource Url: ${url}`);
|
||||
return url;
|
||||
}
|
||||
function createAcceptHeader(type, apiVersion) {
|
||||
return `${type};api-version=${apiVersion}`;
|
||||
}
|
||||
function getRequestOptions() {
|
||||
const requestOptions = {
|
||||
headers: {
|
||||
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
||||
}
|
||||
};
|
||||
return requestOptions;
|
||||
}
|
||||
function createHttpClient() {
|
||||
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
||||
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
||||
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
||||
}
|
||||
function getCacheVersion(paths, compressionMethod) {
|
||||
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
||||
? []
|
||||
: [compressionMethod]);
|
||||
// Add salt to cache version to support breaking changes in cache entry
|
||||
components.push(versionSalt);
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(components.join('|'))
|
||||
.digest('hex');
|
||||
}
|
||||
exports.getCacheVersion = getCacheVersion;
|
||||
function getCacheEntry(keys, paths, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
||||
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
||||
if (response.statusCode === 204) {
|
||||
return null;
|
||||
}
|
||||
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${response.statusCode}`);
|
||||
}
|
||||
const cacheResult = response.result;
|
||||
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
||||
if (!cacheDownloadUrl) {
|
||||
throw new Error('Cache not found.');
|
||||
}
|
||||
core.setSecret(cacheDownloadUrl);
|
||||
core.debug(`Cache Result:`);
|
||||
core.debug(JSON.stringify(cacheResult));
|
||||
return cacheResult;
|
||||
});
|
||||
}
|
||||
exports.getCacheEntry = getCacheEntry;
|
||||
function downloadCache(archiveLocation, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const archiveUrl = new url_1.URL(archiveLocation);
|
||||
const downloadOptions = options_1.getDownloadOptions(options);
|
||||
if (downloadOptions.useAzureSdk &&
|
||||
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
||||
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
||||
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
||||
}
|
||||
else {
|
||||
// Otherwise, download using the Actions http-client.
|
||||
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCache = downloadCache;
|
||||
// Reserve Cache
|
||||
function reserveCache(key, paths, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
||||
const reserveCacheRequest = {
|
||||
key,
|
||||
version
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
}));
|
||||
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
||||
});
|
||||
}
|
||||
exports.reserveCache = reserveCache;
|
||||
function getContentRange(start, end) {
|
||||
// Format: `bytes start-end/filesize
|
||||
// start and end are inclusive
|
||||
// filesize can be *
|
||||
// For a 200 byte chunk starting at byte 0:
|
||||
// Content-Range: bytes 0-199/*
|
||||
return `bytes ${start}-${end}/*`;
|
||||
}
|
||||
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Uploading chunk of size ${end -
|
||||
start +
|
||||
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
||||
const additionalHeaders = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Range': getContentRange(start, end)
|
||||
};
|
||||
yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function uploadFile(httpClient, cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Upload Chunks
|
||||
const fileSize = fs.statSync(archivePath).size;
|
||||
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
||||
const fd = fs.openSync(archivePath, 'r');
|
||||
const uploadOptions = options_1.getUploadOptions(options);
|
||||
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
||||
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
||||
const parallelUploads = [...new Array(concurrency).keys()];
|
||||
core.debug('Awaiting all uploads');
|
||||
let offset = 0;
|
||||
try {
|
||||
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||
while (offset < fileSize) {
|
||||
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
||||
const start = offset;
|
||||
const end = offset + chunkSize - 1;
|
||||
offset += maxChunkSize;
|
||||
yield uploadChunk(httpClient, resourceUrl, () => fs
|
||||
.createReadStream(archivePath, {
|
||||
fd,
|
||||
start,
|
||||
end,
|
||||
autoClose: false
|
||||
})
|
||||
.on('error', error => {
|
||||
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
||||
}), start, end);
|
||||
}
|
||||
})));
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
function commitCache(httpClient, cacheId, filesize) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commitCacheRequest = { size: filesize };
|
||||
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
||||
}));
|
||||
});
|
||||
}
|
||||
function saveCache(cacheId, archivePath, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const httpClient = createHttpClient();
|
||||
core.debug('Upload cache');
|
||||
yield uploadFile(httpClient, cacheId, archivePath, options);
|
||||
// Commit Cache
|
||||
core.debug('Commiting cache');
|
||||
const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
||||
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
||||
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
||||
}
|
||||
core.info('Cache saved successfully');
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
//# sourceMappingURL=cacheHttpClient.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -3486,44 +3529,33 @@ exports.debug = debug; // for test
|
||||
/***/ }),
|
||||
|
||||
/***/ 147:
|
||||
/***/ (function(module) {
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
// API
|
||||
module.exports = state;
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Creates initial state object
|
||||
* for iteration over list
|
||||
*
|
||||
* @param {array|object} list - list to iterate over
|
||||
* @param {function|null} sortMethod - function to use for keys sort,
|
||||
* or `null` to keep them as is
|
||||
* @returns {object} - initial state object
|
||||
*/
|
||||
function state(list, sortMethod)
|
||||
{
|
||||
var isNamedList = !Array.isArray(list)
|
||||
, initState =
|
||||
{
|
||||
index : 0,
|
||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||
jobs : {},
|
||||
results : isNamedList ? {} : [],
|
||||
size : isNamedList ? Object.keys(list).length : list.length
|
||||
|
||||
exports.fromCallback = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
|
||||
else {
|
||||
return new Promise((resolve, reject) => {
|
||||
arguments[arguments.length] = (err, res) => {
|
||||
if (err) return reject(err)
|
||||
resolve(res)
|
||||
}
|
||||
arguments.length++
|
||||
fn.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
;
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
if (sortMethod)
|
||||
{
|
||||
// sort array keys based on it's values
|
||||
// sort object's keys just on own merit
|
||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||
{
|
||||
return sortMethod(list[a], list[b]);
|
||||
});
|
||||
}
|
||||
|
||||
return initState;
|
||||
exports.fromPromise = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
const cb = arguments[arguments.length - 1]
|
||||
if (typeof cb !== 'function') return fn.apply(this, arguments)
|
||||
else fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
|
||||
@ -3821,7 +3853,7 @@ exports.default = void 0;
|
||||
|
||||
var _rng = _interopRequireDefault(__webpack_require__(733));
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -3914,7 +3946,7 @@ function v1(options, buf, offset) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf || (0, _bytesToUuid.default)(b);
|
||||
return buf || (0, _stringify.default)(b);
|
||||
}
|
||||
|
||||
var _default = v1;
|
||||
@ -3922,6 +3954,58 @@ exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 197:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parse(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
let v;
|
||||
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
||||
|
||||
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
||||
arr[1] = v >>> 16 & 0xff;
|
||||
arr[2] = v >>> 8 & 0xff;
|
||||
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
||||
|
||||
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
||||
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
||||
|
||||
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
||||
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
||||
|
||||
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
||||
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
||||
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
||||
|
||||
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
||||
arr[11] = v / 0x100000000 & 0xff;
|
||||
arr[12] = v >>> 24 & 0xff;
|
||||
arr[13] = v >>> 16 & 0xff;
|
||||
arr[14] = v >>> 8 & 0xff;
|
||||
arr[15] = v & 0xff;
|
||||
return arr;
|
||||
}
|
||||
|
||||
var _default = parse;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 210:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
@ -4095,6 +4179,21 @@ exports.isTokenCredential = isTokenCredential;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 238:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 241:
|
||||
@ -4109,19 +4208,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = _default;
|
||||
exports.URL = exports.DNS = void 0;
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
var _parse = _interopRequireDefault(__webpack_require__(197));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function uuidToBytes(uuid) {
|
||||
// Note: We assume we're being passed a valid uuid string
|
||||
const bytes = [];
|
||||
uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
|
||||
bytes.push(parseInt(hex, 16));
|
||||
});
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function stringToBytes(str) {
|
||||
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
||||
|
||||
@ -4146,19 +4238,20 @@ function _default(name, version, hashfunc) {
|
||||
}
|
||||
|
||||
if (typeof namespace === 'string') {
|
||||
namespace = uuidToBytes(namespace);
|
||||
namespace = (0, _parse.default)(namespace);
|
||||
}
|
||||
|
||||
if (!Array.isArray(value)) {
|
||||
throw TypeError('value must be an array of bytes');
|
||||
}
|
||||
|
||||
if (!Array.isArray(namespace) || namespace.length !== 16) {
|
||||
throw TypeError('namespace must be uuid string or an Array of 16 byte values');
|
||||
} // Per 4.3
|
||||
if (namespace.length !== 16) {
|
||||
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
||||
} // Compute hash of namespace and value, Per 4.3
|
||||
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
||||
// hashfunc([...namespace, ... value])`
|
||||
|
||||
|
||||
const bytes = hashfunc(namespace.concat(value));
|
||||
let bytes = new Uint8Array(16 + value.length);
|
||||
bytes.set(namespace);
|
||||
bytes.set(value, namespace.length);
|
||||
bytes = hashfunc(bytes);
|
||||
bytes[6] = bytes[6] & 0x0f | version;
|
||||
bytes[8] = bytes[8] & 0x3f | 0x80;
|
||||
|
||||
@ -4172,7 +4265,7 @@ function _default(name, version, hashfunc) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _bytesToUuid.default)(bytes);
|
||||
return (0, _stringify.default)(bytes);
|
||||
} // Function#name is not settable on some platforms (#270)
|
||||
|
||||
|
||||
@ -4233,237 +4326,1029 @@ exports.default = _default;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const storage_blob_1 = __webpack_require__(373);
|
||||
const buffer = __importStar(__webpack_require__(293));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const stream = __importStar(__webpack_require__(794));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
* @param response the HTTP response
|
||||
* @param output the writable stream
|
||||
*/
|
||||
function pipeResponseToStream(response, output) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
yield pipeline(response.message, output);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Class for tracking the download state and displaying stats.
|
||||
*/
|
||||
class DownloadProgress {
|
||||
constructor(contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
this.segmentIndex = 0;
|
||||
this.segmentSize = 0;
|
||||
this.segmentOffset = 0;
|
||||
this.receivedBytes = 0;
|
||||
this.displayedComplete = false;
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
/**
|
||||
* Progress to the next segment. Only call this method when the previous segment
|
||||
* is complete.
|
||||
*
|
||||
* @param segmentSize the length of the next segment
|
||||
*/
|
||||
nextSegment(segmentSize) {
|
||||
this.segmentOffset = this.segmentOffset + this.segmentSize;
|
||||
this.segmentIndex = this.segmentIndex + 1;
|
||||
this.segmentSize = segmentSize;
|
||||
this.receivedBytes = 0;
|
||||
core.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
|
||||
}
|
||||
/**
|
||||
* Sets the number of bytes received for the current segment.
|
||||
*
|
||||
* @param receivedBytes the number of bytes received
|
||||
*/
|
||||
setReceivedBytes(receivedBytes) {
|
||||
this.receivedBytes = receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns the total number of bytes transferred.
|
||||
*/
|
||||
getTransferredBytes() {
|
||||
return this.segmentOffset + this.receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns true if the download is complete.
|
||||
*/
|
||||
isDone() {
|
||||
return this.getTransferredBytes() === this.contentLength;
|
||||
}
|
||||
/**
|
||||
* Prints the current download stats. Once the download completes, this will print one
|
||||
* last line and then stop.
|
||||
*/
|
||||
display() {
|
||||
if (this.displayedComplete) {
|
||||
return;
|
||||
}
|
||||
const transferredBytes = this.segmentOffset + this.receivedBytes;
|
||||
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
|
||||
const elapsedTime = Date.now() - this.startTime;
|
||||
const downloadSpeed = (transferredBytes /
|
||||
(1024 * 1024) /
|
||||
(elapsedTime / 1000)).toFixed(1);
|
||||
core.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
|
||||
if (this.isDone()) {
|
||||
this.displayedComplete = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a function used to handle TransferProgressEvents.
|
||||
*/
|
||||
onProgress() {
|
||||
return (progress) => {
|
||||
this.setReceivedBytes(progress.loadedBytes);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Starts the timer that displays the stats.
|
||||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs = 1000) {
|
||||
const displayCallback = () => {
|
||||
this.display();
|
||||
if (!this.isDone()) {
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
};
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
/**
|
||||
* Stops the timer that displays the stats. As this typically indicates the download
|
||||
* is complete, this will display one last line, unless the last line has already
|
||||
* been written.
|
||||
*/
|
||||
stopDisplayTimer() {
|
||||
if (this.timeoutHandle) {
|
||||
clearTimeout(this.timeoutHandle);
|
||||
this.timeoutHandle = undefined;
|
||||
}
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
exports.DownloadProgress = DownloadProgress;
|
||||
/**
|
||||
* Download the cache using the Actions toolkit http-client
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
*/
|
||||
function downloadCacheHttpClient(archiveLocation, archivePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const writeStream = fs.createWriteStream(archivePath);
|
||||
const httpClient = new http_client_1.HttpClient('actions/cache');
|
||||
const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));
|
||||
// Abort download if no traffic received over the socket.
|
||||
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
|
||||
downloadResponse.message.destroy();
|
||||
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
|
||||
});
|
||||
yield pipeResponseToStream(downloadResponse, writeStream);
|
||||
// Validate download size.
|
||||
const contentLengthHeader = downloadResponse.message.headers['content-length'];
|
||||
if (contentLengthHeader) {
|
||||
const expectedLength = parseInt(contentLengthHeader);
|
||||
const actualLength = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
if (actualLength !== expectedLength) {
|
||||
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.debug('Unable to validate download, no Content-Length header');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheHttpClient = downloadCacheHttpClient;
|
||||
/**
|
||||
* Download the cache using the Azure Storage SDK. Only call this method if the
|
||||
* URL points to an Azure Storage endpoint.
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
* @param options the download options with the defaults set
|
||||
*/
|
||||
function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = new storage_blob_1.BlockBlobClient(archiveLocation, undefined, {
|
||||
retryOptions: {
|
||||
// Override the timeout used when downloading each 4 MB chunk
|
||||
// The default is 2 min / MB, which is way too slow
|
||||
tryTimeoutInMs: options.timeoutInMs
|
||||
}
|
||||
});
|
||||
const properties = yield client.getProperties();
|
||||
const contentLength = (_a = properties.contentLength) !== null && _a !== void 0 ? _a : -1;
|
||||
if (contentLength < 0) {
|
||||
// We should never hit this condition, but just in case fall back to downloading the
|
||||
// file as one large stream
|
||||
core.debug('Unable to determine content length, downloading file with http-client...');
|
||||
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
else {
|
||||
// Use downloadToBuffer for faster downloads, since internally it splits the
|
||||
// file into 4 MB chunks which can then be parallelized and retried independently
|
||||
//
|
||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||
// on 64-bit systems), split the download into multiple segments
|
||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
||||
const downloadProgress = new DownloadProgress(contentLength);
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
downloadProgress.stopDisplayTimer();
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
const storage_blob_1 = __webpack_require__(373);
|
||||
const buffer = __importStar(__webpack_require__(293));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const stream = __importStar(__webpack_require__(794));
|
||||
const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
* @param response the HTTP response
|
||||
* @param output the writable stream
|
||||
*/
|
||||
function pipeResponseToStream(response, output) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
yield pipeline(response.message, output);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Class for tracking the download state and displaying stats.
|
||||
*/
|
||||
class DownloadProgress {
|
||||
constructor(contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
this.segmentIndex = 0;
|
||||
this.segmentSize = 0;
|
||||
this.segmentOffset = 0;
|
||||
this.receivedBytes = 0;
|
||||
this.displayedComplete = false;
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
/**
|
||||
* Progress to the next segment. Only call this method when the previous segment
|
||||
* is complete.
|
||||
*
|
||||
* @param segmentSize the length of the next segment
|
||||
*/
|
||||
nextSegment(segmentSize) {
|
||||
this.segmentOffset = this.segmentOffset + this.segmentSize;
|
||||
this.segmentIndex = this.segmentIndex + 1;
|
||||
this.segmentSize = segmentSize;
|
||||
this.receivedBytes = 0;
|
||||
core.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
|
||||
}
|
||||
/**
|
||||
* Sets the number of bytes received for the current segment.
|
||||
*
|
||||
* @param receivedBytes the number of bytes received
|
||||
*/
|
||||
setReceivedBytes(receivedBytes) {
|
||||
this.receivedBytes = receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns the total number of bytes transferred.
|
||||
*/
|
||||
getTransferredBytes() {
|
||||
return this.segmentOffset + this.receivedBytes;
|
||||
}
|
||||
/**
|
||||
* Returns true if the download is complete.
|
||||
*/
|
||||
isDone() {
|
||||
return this.getTransferredBytes() === this.contentLength;
|
||||
}
|
||||
/**
|
||||
* Prints the current download stats. Once the download completes, this will print one
|
||||
* last line and then stop.
|
||||
*/
|
||||
display() {
|
||||
if (this.displayedComplete) {
|
||||
return;
|
||||
}
|
||||
const transferredBytes = this.segmentOffset + this.receivedBytes;
|
||||
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
|
||||
const elapsedTime = Date.now() - this.startTime;
|
||||
const downloadSpeed = (transferredBytes /
|
||||
(1024 * 1024) /
|
||||
(elapsedTime / 1000)).toFixed(1);
|
||||
core.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
|
||||
if (this.isDone()) {
|
||||
this.displayedComplete = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a function used to handle TransferProgressEvents.
|
||||
*/
|
||||
onProgress() {
|
||||
return (progress) => {
|
||||
this.setReceivedBytes(progress.loadedBytes);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Starts the timer that displays the stats.
|
||||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs = 1000) {
|
||||
const displayCallback = () => {
|
||||
this.display();
|
||||
if (!this.isDone()) {
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
};
|
||||
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||
}
|
||||
/**
|
||||
* Stops the timer that displays the stats. As this typically indicates the download
|
||||
* is complete, this will display one last line, unless the last line has already
|
||||
* been written.
|
||||
*/
|
||||
stopDisplayTimer() {
|
||||
if (this.timeoutHandle) {
|
||||
clearTimeout(this.timeoutHandle);
|
||||
this.timeoutHandle = undefined;
|
||||
}
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
exports.DownloadProgress = DownloadProgress;
|
||||
/**
|
||||
* Download the cache using the Actions toolkit http-client
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
*/
|
||||
function downloadCacheHttpClient(archiveLocation, archivePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const writeStream = fs.createWriteStream(archivePath);
|
||||
const httpClient = new http_client_1.HttpClient('actions/cache');
|
||||
const downloadResponse = yield requestUtils_1.retryHttpClientResponse('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));
|
||||
// Abort download if no traffic received over the socket.
|
||||
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
|
||||
downloadResponse.message.destroy();
|
||||
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
|
||||
});
|
||||
yield pipeResponseToStream(downloadResponse, writeStream);
|
||||
// Validate download size.
|
||||
const contentLengthHeader = downloadResponse.message.headers['content-length'];
|
||||
if (contentLengthHeader) {
|
||||
const expectedLength = parseInt(contentLengthHeader);
|
||||
const actualLength = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
if (actualLength !== expectedLength) {
|
||||
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.debug('Unable to validate download, no Content-Length header');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheHttpClient = downloadCacheHttpClient;
|
||||
/**
|
||||
* Download the cache using the Azure Storage SDK. Only call this method if the
|
||||
* URL points to an Azure Storage endpoint.
|
||||
*
|
||||
* @param archiveLocation the URL for the cache
|
||||
* @param archivePath the local path where the cache is saved
|
||||
* @param options the download options with the defaults set
|
||||
*/
|
||||
function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const client = new storage_blob_1.BlockBlobClient(archiveLocation, undefined, {
|
||||
retryOptions: {
|
||||
// Override the timeout used when downloading each 4 MB chunk
|
||||
// The default is 2 min / MB, which is way too slow
|
||||
tryTimeoutInMs: options.timeoutInMs
|
||||
}
|
||||
});
|
||||
const properties = yield client.getProperties();
|
||||
const contentLength = (_a = properties.contentLength) !== null && _a !== void 0 ? _a : -1;
|
||||
if (contentLength < 0) {
|
||||
// We should never hit this condition, but just in case fall back to downloading the
|
||||
// file as one large stream
|
||||
core.debug('Unable to determine content length, downloading file with http-client...');
|
||||
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
||||
}
|
||||
else {
|
||||
// Use downloadToBuffer for faster downloads, since internally it splits the
|
||||
// file into 4 MB chunks which can then be parallelized and retried independently
|
||||
//
|
||||
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
||||
// on 64-bit systems), split the download into multiple segments
|
||||
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
||||
const downloadProgress = new DownloadProgress(contentLength);
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
downloadProgress.stopDisplayTimer();
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
//# sourceMappingURL=downloadUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 257:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() {
|
||||
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
ref1 = __webpack_require__(582), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
||||
|
||||
XMLElement = null;
|
||||
|
||||
XMLCData = null;
|
||||
|
||||
XMLComment = null;
|
||||
|
||||
XMLDeclaration = null;
|
||||
|
||||
XMLDocType = null;
|
||||
|
||||
XMLRaw = null;
|
||||
|
||||
XMLText = null;
|
||||
|
||||
XMLProcessingInstruction = null;
|
||||
|
||||
XMLDummy = null;
|
||||
|
||||
NodeType = null;
|
||||
|
||||
XMLNodeList = null;
|
||||
|
||||
XMLNamedNodeMap = null;
|
||||
|
||||
DocumentPosition = null;
|
||||
|
||||
module.exports = XMLNode = (function() {
|
||||
function XMLNode(parent1) {
|
||||
this.parent = parent1;
|
||||
if (this.parent) {
|
||||
this.options = this.parent.options;
|
||||
this.stringify = this.parent.stringify;
|
||||
}
|
||||
this.value = null;
|
||||
this.children = [];
|
||||
this.baseURI = null;
|
||||
if (!XMLElement) {
|
||||
XMLElement = __webpack_require__(796);
|
||||
XMLCData = __webpack_require__(657);
|
||||
XMLComment = __webpack_require__(919);
|
||||
XMLDeclaration = __webpack_require__(738);
|
||||
XMLDocType = __webpack_require__(735);
|
||||
XMLRaw = __webpack_require__(660);
|
||||
XMLText = __webpack_require__(708);
|
||||
XMLProcessingInstruction = __webpack_require__(491);
|
||||
XMLDummy = __webpack_require__(956);
|
||||
NodeType = __webpack_require__(683);
|
||||
XMLNodeList = __webpack_require__(265);
|
||||
XMLNamedNodeMap = __webpack_require__(451);
|
||||
DocumentPosition = __webpack_require__(65);
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
||||
get: function() {
|
||||
return this.name;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
||||
get: function() {
|
||||
return this.type;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
||||
get: function() {
|
||||
return this.value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
||||
get: function() {
|
||||
return this.parent;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
||||
get: function() {
|
||||
if (!this.childNodeList || !this.childNodeList.nodes) {
|
||||
this.childNodeList = new XMLNodeList(this.children);
|
||||
}
|
||||
return this.childNodeList;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
||||
get: function() {
|
||||
return this.children[0] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
||||
get: function() {
|
||||
return this.children[this.children.length - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i + 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
||||
get: function() {
|
||||
return this.document() || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'textContent', {
|
||||
get: function() {
|
||||
var child, j, len, ref2, str;
|
||||
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
||||
str = '';
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (child.textContent) {
|
||||
str += child.textContent;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
}
|
||||
});
|
||||
|
||||
XMLNode.prototype.setParent = function(parent) {
|
||||
var child, j, len, ref2, results;
|
||||
this.parent = parent;
|
||||
if (parent) {
|
||||
this.options = parent.options;
|
||||
this.stringify = parent.stringify;
|
||||
}
|
||||
ref2 = this.children;
|
||||
results = [];
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
results.push(child.setParent(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
XMLNode.prototype.element = function(name, attributes, text) {
|
||||
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
||||
lastChild = null;
|
||||
if (attributes === null && (text == null)) {
|
||||
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
||||
}
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
||||
}
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
if (Array.isArray(name)) {
|
||||
for (j = 0, len = name.length; j < len; j++) {
|
||||
item = name[j];
|
||||
lastChild = this.element(item);
|
||||
}
|
||||
} else if (isFunction(name)) {
|
||||
lastChild = this.element(name.apply());
|
||||
} else if (isObject(name)) {
|
||||
for (key in name) {
|
||||
if (!hasProp.call(name, key)) continue;
|
||||
val = name[key];
|
||||
if (isFunction(val)) {
|
||||
val = val.apply();
|
||||
}
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
||||
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (isObject(val) && isEmpty(val)) {
|
||||
lastChild = this.element(key);
|
||||
} else if (!this.options.keepNullNodes && (val == null)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
||||
for (k = 0, len1 = val.length; k < len1; k++) {
|
||||
item = val[k];
|
||||
childNode = {};
|
||||
childNode[key] = item;
|
||||
lastChild = this.element(childNode);
|
||||
}
|
||||
} else if (isObject(val)) {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.element(val);
|
||||
} else {
|
||||
lastChild = this.element(key);
|
||||
lastChild.element(val);
|
||||
}
|
||||
} else {
|
||||
lastChild = this.element(key, val);
|
||||
}
|
||||
}
|
||||
} else if (!this.options.keepNullNodes && text === null) {
|
||||
lastChild = this.dummy();
|
||||
} else {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.text(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
||||
lastChild = this.cdata(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
||||
lastChild = this.comment(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
||||
lastChild = this.raw(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
||||
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
||||
} else {
|
||||
lastChild = this.node(name, attributes, text);
|
||||
}
|
||||
}
|
||||
if (lastChild == null) {
|
||||
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
||||
}
|
||||
return lastChild;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
||||
var child, i, newChild, refChild, removed;
|
||||
if (name != null ? name.type : void 0) {
|
||||
newChild = name;
|
||||
refChild = attributes;
|
||||
newChild.setParent(this);
|
||||
if (refChild) {
|
||||
i = children.indexOf(refChild);
|
||||
removed = children.splice(i);
|
||||
children.push(newChild);
|
||||
Array.prototype.push.apply(children, removed);
|
||||
} else {
|
||||
children.push(newChild);
|
||||
}
|
||||
return newChild;
|
||||
} else {
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.remove = function() {
|
||||
var i, ref2;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot remove the root element. " + this.debugInfo());
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.node = function(name, attributes, text) {
|
||||
var child, ref2;
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
attributes || (attributes = {});
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
||||
}
|
||||
child = new XMLElement(this, name, attributes);
|
||||
if (text != null) {
|
||||
child.text(text);
|
||||
}
|
||||
this.children.push(child);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.text = function(value) {
|
||||
var child;
|
||||
if (isObject(value)) {
|
||||
this.element(value);
|
||||
}
|
||||
child = new XMLText(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentBefore = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentAfter = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.raw = function(value) {
|
||||
var child;
|
||||
child = new XMLRaw(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dummy = function() {
|
||||
var child;
|
||||
child = new XMLDummy(this);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instruction = function(target, value) {
|
||||
var insTarget, insValue, instruction, j, len;
|
||||
if (target != null) {
|
||||
target = getValue(target);
|
||||
}
|
||||
if (value != null) {
|
||||
value = getValue(value);
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (j = 0, len = target.length; j < len; j++) {
|
||||
insTarget = target[j];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
instruction = new XMLProcessingInstruction(this, target, value);
|
||||
this.children.push(instruction);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionBefore = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionAfter = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
||||
var doc, xmldec;
|
||||
doc = this.document();
|
||||
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
||||
if (doc.children.length === 0) {
|
||||
doc.children.unshift(xmldec);
|
||||
} else if (doc.children[0].type === NodeType.Declaration) {
|
||||
doc.children[0] = xmldec;
|
||||
} else {
|
||||
doc.children.unshift(xmldec);
|
||||
}
|
||||
return doc.root() || doc;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dtd = function(pubID, sysID) {
|
||||
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
||||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
ref2 = doc.children;
|
||||
for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
||||
child = ref2[i];
|
||||
if (child.type === NodeType.DocType) {
|
||||
doc.children[i] = doctype;
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
ref3 = doc.children;
|
||||
for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
||||
child = ref3[i];
|
||||
if (child.isRoot) {
|
||||
doc.children.splice(i, 0, doctype);
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
doc.children.push(doctype);
|
||||
return doctype;
|
||||
};
|
||||
|
||||
XMLNode.prototype.up = function() {
|
||||
if (this.isRoot) {
|
||||
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
||||
}
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.root = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node.rootObject;
|
||||
} else if (node.isRoot) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.document = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.end = function(options) {
|
||||
return this.document().end(options);
|
||||
};
|
||||
|
||||
XMLNode.prototype.prev = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i < 1) {
|
||||
throw new Error("Already at the first node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i - 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.next = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i === -1 || i === this.parent.children.length - 1) {
|
||||
throw new Error("Already at the last node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i + 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.importDocument = function(doc) {
|
||||
var clonedRoot;
|
||||
clonedRoot = doc.root().clone();
|
||||
clonedRoot.parent = this;
|
||||
clonedRoot.isRoot = false;
|
||||
this.children.push(clonedRoot);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.debugInfo = function(name) {
|
||||
var ref2, ref3;
|
||||
name = name || this.name;
|
||||
if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
||||
return "";
|
||||
} else if (name == null) {
|
||||
return "parent: <" + this.parent.name + ">";
|
||||
} else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
||||
return "node: <" + name + ">";
|
||||
} else {
|
||||
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.ele = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.nod = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.txt = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
||||
return this.declaration(version, encoding, standalone);
|
||||
};
|
||||
|
||||
XMLNode.prototype.e = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.n = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.t = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.d = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.c = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.r = function(value) {
|
||||
return this.raw(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.i = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.u = function() {
|
||||
return this.up();
|
||||
};
|
||||
|
||||
XMLNode.prototype.importXMLBuilder = function(doc) {
|
||||
return this.importDocument(doc);
|
||||
};
|
||||
|
||||
XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.removeChild = function(oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.appendChild = function(newChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasChildNodes = function() {
|
||||
return this.children.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cloneNode = function(deep) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.normalize = function() {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSupported = function(feature, version) {
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasAttributes = function() {
|
||||
return this.attribs.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.compareDocumentPosition = function(other) {
|
||||
var ref, res;
|
||||
ref = this;
|
||||
if (ref === other) {
|
||||
return 0;
|
||||
} else if (this.document() !== other.document()) {
|
||||
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
||||
if (Math.random() < 0.5) {
|
||||
res |= DocumentPosition.Preceding;
|
||||
} else {
|
||||
res |= DocumentPosition.Following;
|
||||
}
|
||||
return res;
|
||||
} else if (ref.isAncestor(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Preceding;
|
||||
} else if (ref.isDescendant(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Following;
|
||||
} else if (ref.isPreceding(other)) {
|
||||
return DocumentPosition.Preceding;
|
||||
} else {
|
||||
return DocumentPosition.Following;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSameNode = function(other) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isEqualNode = function(node) {
|
||||
var i, j, ref2;
|
||||
if (node.nodeType !== this.nodeType) {
|
||||
return false;
|
||||
}
|
||||
if (node.children.length !== this.children.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
||||
if (!this.children[i].isEqualNode(node.children[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.getFeature = function(feature, version) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.setUserData = function(key, data, handler) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.getUserData = function(key) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.contains = function(other) {
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
return other === this || this.isDescendant(other);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDescendant = function(node) {
|
||||
var child, isDescendantChild, j, len, ref2;
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (node === child) {
|
||||
return true;
|
||||
}
|
||||
isDescendantChild = child.isDescendant(node);
|
||||
if (isDescendantChild) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
XMLNode.prototype.isAncestor = function(node) {
|
||||
return node.isDescendant(this);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isPreceding = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos < thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isFollowing = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos > thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.treePosition = function(node) {
|
||||
var found, pos;
|
||||
pos = 0;
|
||||
found = false;
|
||||
this.foreachTreeNode(this.document(), function(childNode) {
|
||||
pos++;
|
||||
if (!found && childNode === node) {
|
||||
return found = true;
|
||||
}
|
||||
});
|
||||
if (found) {
|
||||
return pos;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.foreachTreeNode = function(node, func) {
|
||||
var child, j, len, ref2, res;
|
||||
node || (node = this.document());
|
||||
ref2 = node.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (res = func(child)) {
|
||||
return res;
|
||||
} else {
|
||||
res = this.foreachTreeNode(child, func);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return XMLNode;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 263:
|
||||
@ -7386,7 +8271,7 @@ var MatchKind;
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
const { fromCallback } = __webpack_require__(676);
|
||||
const { fromCallback } = __webpack_require__(147);
|
||||
const Store = __webpack_require__(338).Store;
|
||||
const permuteDomain = __webpack_require__(89).permuteDomain;
|
||||
const pathMatch = __webpack_require__(348).pathMatch;
|
||||
@ -27667,7 +28552,7 @@ const Store = __webpack_require__(338).Store;
|
||||
const MemoryCookieStore = __webpack_require__(332).MemoryCookieStore;
|
||||
const pathMatch = __webpack_require__(348).pathMatch;
|
||||
const VERSION = __webpack_require__(460);
|
||||
const { fromCallback } = __webpack_require__(676);
|
||||
const { fromCallback } = __webpack_require__(147);
|
||||
|
||||
// From RFC6265 S4.1.1
|
||||
// note that it excludes \x3B ";"
|
||||
@ -29321,290 +30206,290 @@ module.exports = require("crypto");
|
||||
/***/ 422:
|
||||
/***/ (function(module) {
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__createBinding = function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
};
|
||||
|
||||
__exportStar = function (m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
};
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__createBinding = function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
};
|
||||
|
||||
__exportStar = function (m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
};
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -30048,7 +30933,7 @@ var __createBinding;
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
var iterate = __webpack_require__(157)
|
||||
, initState = __webpack_require__(147)
|
||||
, initState = __webpack_require__(903)
|
||||
, terminator = __webpack_require__(939)
|
||||
;
|
||||
|
||||
@ -30197,129 +31082,130 @@ function escapeProperty(s) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exec_1 = __webpack_require__(986);
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs_1 = __webpack_require__(747);
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
function getTarPath(args, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (IS_WINDOWS) {
|
||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
|
||||
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
|
||||
// We only use zstandard compression on windows when gnu tar is installed due to
|
||||
// a bug with compressing large files with bsdtar + zstd
|
||||
args.push('--force-local');
|
||||
}
|
||||
else if (fs_1.existsSync(systemTar)) {
|
||||
return systemTar;
|
||||
}
|
||||
else if (yield utils.isGnuTarInstalled()) {
|
||||
args.push('--force-local');
|
||||
}
|
||||
}
|
||||
return yield io.which('tar', true);
|
||||
});
|
||||
}
|
||||
function execTar(args, compressionMethod, cwd) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd });
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getWorkingDirectory() {
|
||||
var _a;
|
||||
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
|
||||
}
|
||||
function extractTar(archivePath, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create directory to extract tar into
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
yield io.mkdirP(workingDirectory);
|
||||
// --d: Decompress.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-xf',
|
||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||
];
|
||||
yield execTar(args, compressionMethod);
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Write source directories to manifest.txt to avoid command length limits
|
||||
const manifestFilename = 'manifest.txt';
|
||||
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
||||
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-cf',
|
||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'--files-from',
|
||||
manifestFilename
|
||||
];
|
||||
yield execTar(args, compressionMethod, archiveFolder);
|
||||
});
|
||||
}
|
||||
exports.createTar = createTar;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exec_1 = __webpack_require__(986);
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs_1 = __webpack_require__(747);
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
function getTarPath(args, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (IS_WINDOWS) {
|
||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
|
||||
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
|
||||
// We only use zstandard compression on windows when gnu tar is installed due to
|
||||
// a bug with compressing large files with bsdtar + zstd
|
||||
args.push('--force-local');
|
||||
}
|
||||
else if (fs_1.existsSync(systemTar)) {
|
||||
return systemTar;
|
||||
}
|
||||
else if (yield utils.isGnuTarInstalled()) {
|
||||
args.push('--force-local');
|
||||
}
|
||||
}
|
||||
return yield io.which('tar', true);
|
||||
});
|
||||
}
|
||||
function execTar(args, compressionMethod, cwd) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exec_1.exec(`"${yield getTarPath(args, compressionMethod)}"`, args, { cwd });
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Tar failed with error: ${error === null || error === void 0 ? void 0 : error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getWorkingDirectory() {
|
||||
var _a;
|
||||
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
|
||||
}
|
||||
function extractTar(archivePath, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create directory to extract tar into
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
yield io.mkdirP(workingDirectory);
|
||||
// --d: Decompress.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...getCompressionProgram(),
|
||||
'-xf',
|
||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||
];
|
||||
yield execTar(args, compressionMethod);
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Write source directories to manifest.txt to avoid command length limits
|
||||
const manifestFilename = 'manifest.txt';
|
||||
const cacheFileName = utils.getCacheFileName(compressionMethod);
|
||||
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
'--posix',
|
||||
...getCompressionProgram(),
|
||||
'-cf',
|
||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
'-C',
|
||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'--files-from',
|
||||
manifestFilename
|
||||
];
|
||||
yield execTar(args, compressionMethod, archiveFolder);
|
||||
});
|
||||
}
|
||||
exports.createTar = createTar;
|
||||
//# sourceMappingURL=tar.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -32449,7 +33335,7 @@ module.exports = '4.0.0'
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -33132,67 +34018,67 @@ module.exports = {"application/1d-interleaved-parityfec":{"source":"iana"},"appl
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
/**
|
||||
* Returns a copy of the upload options with defaults filled in.
|
||||
*
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
const result = {
|
||||
uploadConcurrency: 4,
|
||||
uploadChunkSize: 32 * 1024 * 1024
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.uploadConcurrency === 'number') {
|
||||
result.uploadConcurrency = copy.uploadConcurrency;
|
||||
}
|
||||
if (typeof copy.uploadChunkSize === 'number') {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
return result;
|
||||
}
|
||||
exports.getUploadOptions = getUploadOptions;
|
||||
/**
|
||||
* Returns a copy of the download options with defaults filled in.
|
||||
*
|
||||
* @param copy the original download options
|
||||
*/
|
||||
function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
result.useAzureSdk = copy.useAzureSdk;
|
||||
}
|
||||
if (typeof copy.downloadConcurrency === 'number') {
|
||||
result.downloadConcurrency = copy.downloadConcurrency;
|
||||
}
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
/**
|
||||
* Returns a copy of the upload options with defaults filled in.
|
||||
*
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
const result = {
|
||||
uploadConcurrency: 4,
|
||||
uploadChunkSize: 32 * 1024 * 1024
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.uploadConcurrency === 'number') {
|
||||
result.uploadConcurrency = copy.uploadConcurrency;
|
||||
}
|
||||
if (typeof copy.uploadChunkSize === 'number') {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
return result;
|
||||
}
|
||||
exports.getUploadOptions = getUploadOptions;
|
||||
/**
|
||||
* Returns a copy of the download options with defaults filled in.
|
||||
*
|
||||
* @param copy the original download options
|
||||
*/
|
||||
function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
result.useAzureSdk = copy.useAzureSdk;
|
||||
}
|
||||
if (typeof copy.downloadConcurrency === 'number') {
|
||||
result.downloadConcurrency = copy.downloadConcurrency;
|
||||
}
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
//# sourceMappingURL=options.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -34018,7 +34904,7 @@ CombinedStream.prototype._emitError = function(err) {
|
||||
|
||||
XMLDOMConfiguration = __webpack_require__(524);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -34542,6 +35428,36 @@ Object.defineProperty(exports, "v5", {
|
||||
return _v4.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NIL", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _nil.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _version.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "validate", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validate.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "stringify", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _stringify.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _v = _interopRequireDefault(__webpack_require__(173));
|
||||
|
||||
@ -34551,6 +35467,16 @@ var _v3 = _interopRequireDefault(__webpack_require__(606));
|
||||
|
||||
var _v4 = _interopRequireDefault(__webpack_require__(90));
|
||||
|
||||
var _nil = _interopRequireDefault(__webpack_require__(24));
|
||||
|
||||
var _version = _interopRequireDefault(__webpack_require__(104));
|
||||
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
var _parse = _interopRequireDefault(__webpack_require__(197));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/***/ }),
|
||||
@ -34940,7 +35866,7 @@ exports.default = void 0;
|
||||
|
||||
var _rng = _interopRequireDefault(__webpack_require__(733));
|
||||
|
||||
var _bytesToUuid = _interopRequireDefault(__webpack_require__(940));
|
||||
var _stringify = _interopRequireDefault(__webpack_require__(855));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -34963,7 +35889,7 @@ function v4(options, buf, offset) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _bytesToUuid.default)(rnds);
|
||||
return (0, _stringify.default)(rnds);
|
||||
}
|
||||
|
||||
var _default = v4;
|
||||
@ -35231,7 +36157,7 @@ module.exports = require("net");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLCharacterData = (function(superClass) {
|
||||
extend(XMLCharacterData, superClass);
|
||||
@ -36934,7 +37860,7 @@ module.exports = require("net");
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLRaw = (function(superClass) {
|
||||
extend(XMLRaw, superClass);
|
||||
@ -36976,7 +37902,7 @@ module.exports = require("net");
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -37335,35 +38261,26 @@ function isUnixExecutable(stats) {
|
||||
/***/ }),
|
||||
|
||||
/***/ 676:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
exports.fromCallback = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
|
||||
else {
|
||||
return new Promise((resolve, reject) => {
|
||||
arguments[arguments.length] = (err, res) => {
|
||||
if (err) return reject(err)
|
||||
resolve(res)
|
||||
}
|
||||
arguments.length++
|
||||
fn.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
exports.fromPromise = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
const cb = arguments[arguments.length - 1]
|
||||
if (typeof cb !== 'function') return fn.apply(this, arguments)
|
||||
else fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
}, 'name', { value: fn.name })
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _regex = _interopRequireDefault(__webpack_require__(238));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function validate(uuid) {
|
||||
return typeof uuid === 'string' && _regex.default.test(uuid);
|
||||
}
|
||||
|
||||
var _default = validate;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -37486,152 +38403,152 @@ exports.default = run;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const cacheHttpClient = __importStar(__webpack_require__(114));
|
||||
const tar_1 = __webpack_require__(434);
|
||||
class ValidationError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ValidationError';
|
||||
Object.setPrototypeOf(this, ValidationError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
||||
class ReserveCacheError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ReserveCacheError';
|
||||
Object.setPrototypeOf(this, ReserveCacheError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ReserveCacheError = ReserveCacheError;
|
||||
function checkPaths(paths) {
|
||||
if (!paths || paths.length === 0) {
|
||||
throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
|
||||
}
|
||||
}
|
||||
function checkKey(key) {
|
||||
if (key.length > 512) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot be larger than 512 characters.`);
|
||||
}
|
||||
const regex = /^[^,]*$/;
|
||||
if (!regex.test(key)) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param downloadOptions cache download options
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCache(paths, primaryKey, restoreKeys, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
restoreKeys = restoreKeys || [];
|
||||
const keys = [primaryKey, ...restoreKeys];
|
||||
core.debug('Resolved Keys:');
|
||||
core.debug(JSON.stringify(keys));
|
||||
if (keys.length > 10) {
|
||||
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
|
||||
}
|
||||
for (const key of keys) {
|
||||
checkKey(key);
|
||||
}
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
// path are needed to compute version
|
||||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
|
||||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
try {
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||
yield tar_1.extractTar(archivePath, compressionMethod);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
try {
|
||||
yield utils.unlinkFile(archivePath);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(`Failed to delete archive: ${error}`);
|
||||
}
|
||||
}
|
||||
return cacheEntry.cacheKey;
|
||||
});
|
||||
}
|
||||
exports.restoreCache = restoreCache;
|
||||
/**
|
||||
* Saves a list of files with the specified key
|
||||
*
|
||||
* @param paths a list of file paths to be cached
|
||||
* @param key an explicit key for restoring the cache
|
||||
* @param options cache upload options
|
||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
core.debug('Reserving Cache');
|
||||
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (cacheId === -1) {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug('Cache Paths:');
|
||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||
const archiveFolder = yield utils.createTempDirectory();
|
||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
|
||||
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.debug(`File Size: ${archiveFileSize}`);
|
||||
if (archiveFileSize > fileSizeLimit) {
|
||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`);
|
||||
}
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
return cacheId;
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const cacheHttpClient = __importStar(__webpack_require__(114));
|
||||
const tar_1 = __webpack_require__(434);
|
||||
class ValidationError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ValidationError';
|
||||
Object.setPrototypeOf(this, ValidationError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
||||
class ReserveCacheError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = 'ReserveCacheError';
|
||||
Object.setPrototypeOf(this, ReserveCacheError.prototype);
|
||||
}
|
||||
}
|
||||
exports.ReserveCacheError = ReserveCacheError;
|
||||
function checkPaths(paths) {
|
||||
if (!paths || paths.length === 0) {
|
||||
throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
|
||||
}
|
||||
}
|
||||
function checkKey(key) {
|
||||
if (key.length > 512) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot be larger than 512 characters.`);
|
||||
}
|
||||
const regex = /^[^,]*$/;
|
||||
if (!regex.test(key)) {
|
||||
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param downloadOptions cache download options
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCache(paths, primaryKey, restoreKeys, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
restoreKeys = restoreKeys || [];
|
||||
const keys = [primaryKey, ...restoreKeys];
|
||||
core.debug('Resolved Keys:');
|
||||
core.debug(JSON.stringify(keys));
|
||||
if (keys.length > 10) {
|
||||
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
|
||||
}
|
||||
for (const key of keys) {
|
||||
checkKey(key);
|
||||
}
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
// path are needed to compute version
|
||||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
|
||||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
try {
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||
yield tar_1.extractTar(archivePath, compressionMethod);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
try {
|
||||
yield utils.unlinkFile(archivePath);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(`Failed to delete archive: ${error}`);
|
||||
}
|
||||
}
|
||||
return cacheEntry.cacheKey;
|
||||
});
|
||||
}
|
||||
exports.restoreCache = restoreCache;
|
||||
/**
|
||||
* Saves a list of files with the specified key
|
||||
*
|
||||
* @param paths a list of file paths to be cached
|
||||
* @param key an explicit key for restoring the cache
|
||||
* @param options cache upload options
|
||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
core.debug('Reserving Cache');
|
||||
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
|
||||
compressionMethod
|
||||
});
|
||||
if (cacheId === -1) {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug('Cache Paths:');
|
||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||
const archiveFolder = yield utils.createTempDirectory();
|
||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
|
||||
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
|
||||
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
|
||||
core.debug(`File Size: ${archiveFileSize}`);
|
||||
if (archiveFileSize > fileSizeLimit) {
|
||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`);
|
||||
}
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
return cacheId;
|
||||
});
|
||||
}
|
||||
exports.saveCache = saveCache;
|
||||
//# sourceMappingURL=cache.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -37852,7 +38769,7 @@ function rng() {
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -38045,7 +38962,7 @@ function rng() {
|
||||
|
||||
isObject = __webpack_require__(582).isObject;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -39910,7 +40827,7 @@ module.exports = require("stream");
|
||||
|
||||
ref = __webpack_require__(582), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -40213,7 +41130,7 @@ module.exports = require("stream");
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -40328,1092 +41245,346 @@ module.exports = __webpack_require__(512)
|
||||
/***/ }),
|
||||
|
||||
/***/ 855:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() {
|
||||
var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
"use strict";
|
||||
|
||||
ref1 = __webpack_require__(582), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
||||
|
||||
XMLElement = null;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
XMLCData = null;
|
||||
var _validate = _interopRequireDefault(__webpack_require__(676));
|
||||
|
||||
XMLComment = null;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
XMLDeclaration = null;
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
const byteToHex = [];
|
||||
|
||||
XMLDocType = null;
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 0x100).toString(16).substr(1));
|
||||
}
|
||||
|
||||
XMLRaw = null;
|
||||
function stringify(arr, offset = 0) {
|
||||
// Note: Be careful editing this code! It's been tuned for performance
|
||||
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
||||
// of the following:
|
||||
// - One or more input array values don't map to a hex octet (leading to
|
||||
// "undefined" in the uuid)
|
||||
// - Invalid input values for the RFC `version` or `variant` fields
|
||||
|
||||
XMLText = null;
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Stringified UUID is invalid');
|
||||
}
|
||||
|
||||
XMLProcessingInstruction = null;
|
||||
|
||||
XMLDummy = null;
|
||||
|
||||
NodeType = null;
|
||||
|
||||
XMLNodeList = null;
|
||||
|
||||
XMLNamedNodeMap = null;
|
||||
|
||||
DocumentPosition = null;
|
||||
|
||||
module.exports = XMLNode = (function() {
|
||||
function XMLNode(parent1) {
|
||||
this.parent = parent1;
|
||||
if (this.parent) {
|
||||
this.options = this.parent.options;
|
||||
this.stringify = this.parent.stringify;
|
||||
}
|
||||
this.value = null;
|
||||
this.children = [];
|
||||
this.baseURI = null;
|
||||
if (!XMLElement) {
|
||||
XMLElement = __webpack_require__(796);
|
||||
XMLCData = __webpack_require__(657);
|
||||
XMLComment = __webpack_require__(919);
|
||||
XMLDeclaration = __webpack_require__(738);
|
||||
XMLDocType = __webpack_require__(735);
|
||||
XMLRaw = __webpack_require__(660);
|
||||
XMLText = __webpack_require__(708);
|
||||
XMLProcessingInstruction = __webpack_require__(491);
|
||||
XMLDummy = __webpack_require__(956);
|
||||
NodeType = __webpack_require__(683);
|
||||
XMLNodeList = __webpack_require__(265);
|
||||
XMLNamedNodeMap = __webpack_require__(451);
|
||||
DocumentPosition = __webpack_require__(65);
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
||||
get: function() {
|
||||
return this.name;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
||||
get: function() {
|
||||
return this.type;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
||||
get: function() {
|
||||
return this.value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
||||
get: function() {
|
||||
return this.parent;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
||||
get: function() {
|
||||
if (!this.childNodeList || !this.childNodeList.nodes) {
|
||||
this.childNodeList = new XMLNodeList(this.children);
|
||||
}
|
||||
return this.childNodeList;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
||||
get: function() {
|
||||
return this.children[0] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
||||
get: function() {
|
||||
return this.children[this.children.length - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i - 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
||||
get: function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
return this.parent.children[i + 1] || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
||||
get: function() {
|
||||
return this.document() || null;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(XMLNode.prototype, 'textContent', {
|
||||
get: function() {
|
||||
var child, j, len, ref2, str;
|
||||
if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
||||
str = '';
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (child.textContent) {
|
||||
str += child.textContent;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
}
|
||||
});
|
||||
|
||||
XMLNode.prototype.setParent = function(parent) {
|
||||
var child, j, len, ref2, results;
|
||||
this.parent = parent;
|
||||
if (parent) {
|
||||
this.options = parent.options;
|
||||
this.stringify = parent.stringify;
|
||||
}
|
||||
ref2 = this.children;
|
||||
results = [];
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
results.push(child.setParent(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
XMLNode.prototype.element = function(name, attributes, text) {
|
||||
var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
||||
lastChild = null;
|
||||
if (attributes === null && (text == null)) {
|
||||
ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
||||
}
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
||||
}
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
if (Array.isArray(name)) {
|
||||
for (j = 0, len = name.length; j < len; j++) {
|
||||
item = name[j];
|
||||
lastChild = this.element(item);
|
||||
}
|
||||
} else if (isFunction(name)) {
|
||||
lastChild = this.element(name.apply());
|
||||
} else if (isObject(name)) {
|
||||
for (key in name) {
|
||||
if (!hasProp.call(name, key)) continue;
|
||||
val = name[key];
|
||||
if (isFunction(val)) {
|
||||
val = val.apply();
|
||||
}
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
||||
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (isObject(val) && isEmpty(val)) {
|
||||
lastChild = this.element(key);
|
||||
} else if (!this.options.keepNullNodes && (val == null)) {
|
||||
lastChild = this.dummy();
|
||||
} else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
||||
for (k = 0, len1 = val.length; k < len1; k++) {
|
||||
item = val[k];
|
||||
childNode = {};
|
||||
childNode[key] = item;
|
||||
lastChild = this.element(childNode);
|
||||
}
|
||||
} else if (isObject(val)) {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.element(val);
|
||||
} else {
|
||||
lastChild = this.element(key);
|
||||
lastChild.element(val);
|
||||
}
|
||||
} else {
|
||||
lastChild = this.element(key, val);
|
||||
}
|
||||
}
|
||||
} else if (!this.options.keepNullNodes && text === null) {
|
||||
lastChild = this.dummy();
|
||||
} else {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.text(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
||||
lastChild = this.cdata(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
||||
lastChild = this.comment(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
||||
lastChild = this.raw(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
||||
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
||||
} else {
|
||||
lastChild = this.node(name, attributes, text);
|
||||
}
|
||||
}
|
||||
if (lastChild == null) {
|
||||
throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
||||
}
|
||||
return lastChild;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
||||
var child, i, newChild, refChild, removed;
|
||||
if (name != null ? name.type : void 0) {
|
||||
newChild = name;
|
||||
refChild = attributes;
|
||||
newChild.setParent(this);
|
||||
if (refChild) {
|
||||
i = children.indexOf(refChild);
|
||||
removed = children.splice(i);
|
||||
children.push(newChild);
|
||||
Array.prototype.push.apply(children, removed);
|
||||
} else {
|
||||
children.push(newChild);
|
||||
}
|
||||
return newChild;
|
||||
} else {
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.remove = function() {
|
||||
var i, ref2;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot remove the root element. " + this.debugInfo());
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.node = function(name, attributes, text) {
|
||||
var child, ref2;
|
||||
if (name != null) {
|
||||
name = getValue(name);
|
||||
}
|
||||
attributes || (attributes = {});
|
||||
attributes = getValue(attributes);
|
||||
if (!isObject(attributes)) {
|
||||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
||||
}
|
||||
child = new XMLElement(this, name, attributes);
|
||||
if (text != null) {
|
||||
child.text(text);
|
||||
}
|
||||
this.children.push(child);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.text = function(value) {
|
||||
var child;
|
||||
if (isObject(value)) {
|
||||
this.element(value);
|
||||
}
|
||||
child = new XMLText(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentBefore = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.commentAfter = function(value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.comment(value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.raw = function(value) {
|
||||
var child;
|
||||
child = new XMLRaw(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dummy = function() {
|
||||
var child;
|
||||
child = new XMLDummy(this);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instruction = function(target, value) {
|
||||
var insTarget, insValue, instruction, j, len;
|
||||
if (target != null) {
|
||||
target = getValue(target);
|
||||
}
|
||||
if (value != null) {
|
||||
value = getValue(value);
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (j = 0, len = target.length; j < len; j++) {
|
||||
insTarget = target[j];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
instruction = new XMLProcessingInstruction(this, target, value);
|
||||
this.children.push(instruction);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionBefore = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.instructionAfter = function(target, value) {
|
||||
var child, i, removed;
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.instruction(target, value);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
||||
var doc, xmldec;
|
||||
doc = this.document();
|
||||
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
||||
if (doc.children.length === 0) {
|
||||
doc.children.unshift(xmldec);
|
||||
} else if (doc.children[0].type === NodeType.Declaration) {
|
||||
doc.children[0] = xmldec;
|
||||
} else {
|
||||
doc.children.unshift(xmldec);
|
||||
}
|
||||
return doc.root() || doc;
|
||||
};
|
||||
|
||||
XMLNode.prototype.dtd = function(pubID, sysID) {
|
||||
var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
||||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
ref2 = doc.children;
|
||||
for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
||||
child = ref2[i];
|
||||
if (child.type === NodeType.DocType) {
|
||||
doc.children[i] = doctype;
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
ref3 = doc.children;
|
||||
for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
||||
child = ref3[i];
|
||||
if (child.isRoot) {
|
||||
doc.children.splice(i, 0, doctype);
|
||||
return doctype;
|
||||
}
|
||||
}
|
||||
doc.children.push(doctype);
|
||||
return doctype;
|
||||
};
|
||||
|
||||
XMLNode.prototype.up = function() {
|
||||
if (this.isRoot) {
|
||||
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
||||
}
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.root = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node.rootObject;
|
||||
} else if (node.isRoot) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.document = function() {
|
||||
var node;
|
||||
node = this;
|
||||
while (node) {
|
||||
if (node.type === NodeType.Document) {
|
||||
return node;
|
||||
} else {
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.end = function(options) {
|
||||
return this.document().end(options);
|
||||
};
|
||||
|
||||
XMLNode.prototype.prev = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i < 1) {
|
||||
throw new Error("Already at the first node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i - 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.next = function() {
|
||||
var i;
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i === -1 || i === this.parent.children.length - 1) {
|
||||
throw new Error("Already at the last node. " + this.debugInfo());
|
||||
}
|
||||
return this.parent.children[i + 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.importDocument = function(doc) {
|
||||
var clonedRoot;
|
||||
clonedRoot = doc.root().clone();
|
||||
clonedRoot.parent = this;
|
||||
clonedRoot.isRoot = false;
|
||||
this.children.push(clonedRoot);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.debugInfo = function(name) {
|
||||
var ref2, ref3;
|
||||
name = name || this.name;
|
||||
if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
||||
return "";
|
||||
} else if (name == null) {
|
||||
return "parent: <" + this.parent.name + ">";
|
||||
} else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
||||
return "node: <" + name + ">";
|
||||
} else {
|
||||
return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.ele = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.nod = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.txt = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
||||
return this.declaration(version, encoding, standalone);
|
||||
};
|
||||
|
||||
XMLNode.prototype.e = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.n = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.t = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.d = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.c = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.r = function(value) {
|
||||
return this.raw(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.i = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.u = function() {
|
||||
return this.up();
|
||||
};
|
||||
|
||||
XMLNode.prototype.importXMLBuilder = function(doc) {
|
||||
return this.importDocument(doc);
|
||||
};
|
||||
|
||||
XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.removeChild = function(oldChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.appendChild = function(newChild) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasChildNodes = function() {
|
||||
return this.children.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cloneNode = function(deep) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.normalize = function() {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSupported = function(feature, version) {
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.hasAttributes = function() {
|
||||
return this.attribs.length !== 0;
|
||||
};
|
||||
|
||||
XMLNode.prototype.compareDocumentPosition = function(other) {
|
||||
var ref, res;
|
||||
ref = this;
|
||||
if (ref === other) {
|
||||
return 0;
|
||||
} else if (this.document() !== other.document()) {
|
||||
res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
||||
if (Math.random() < 0.5) {
|
||||
res |= DocumentPosition.Preceding;
|
||||
} else {
|
||||
res |= DocumentPosition.Following;
|
||||
}
|
||||
return res;
|
||||
} else if (ref.isAncestor(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Preceding;
|
||||
} else if (ref.isDescendant(other)) {
|
||||
return DocumentPosition.Contains | DocumentPosition.Following;
|
||||
} else if (ref.isPreceding(other)) {
|
||||
return DocumentPosition.Preceding;
|
||||
} else {
|
||||
return DocumentPosition.Following;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isSameNode = function(other) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.isEqualNode = function(node) {
|
||||
var i, j, ref2;
|
||||
if (node.nodeType !== this.nodeType) {
|
||||
return false;
|
||||
}
|
||||
if (node.children.length !== this.children.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
||||
if (!this.children[i].isEqualNode(node.children[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
XMLNode.prototype.getFeature = function(feature, version) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.setUserData = function(key, data, handler) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.getUserData = function(key) {
|
||||
throw new Error("This DOM method is not implemented." + this.debugInfo());
|
||||
};
|
||||
|
||||
XMLNode.prototype.contains = function(other) {
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
return other === this || this.isDescendant(other);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isDescendant = function(node) {
|
||||
var child, isDescendantChild, j, len, ref2;
|
||||
ref2 = this.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (node === child) {
|
||||
return true;
|
||||
}
|
||||
isDescendantChild = child.isDescendant(node);
|
||||
if (isDescendantChild) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
XMLNode.prototype.isAncestor = function(node) {
|
||||
return node.isDescendant(this);
|
||||
};
|
||||
|
||||
XMLNode.prototype.isPreceding = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos < thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.isFollowing = function(node) {
|
||||
var nodePos, thisPos;
|
||||
nodePos = this.treePosition(node);
|
||||
thisPos = this.treePosition(this);
|
||||
if (nodePos === -1 || thisPos === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return nodePos > thisPos;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.treePosition = function(node) {
|
||||
var found, pos;
|
||||
pos = 0;
|
||||
found = false;
|
||||
this.foreachTreeNode(this.document(), function(childNode) {
|
||||
pos++;
|
||||
if (!found && childNode === node) {
|
||||
return found = true;
|
||||
}
|
||||
});
|
||||
if (found) {
|
||||
return pos;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
XMLNode.prototype.foreachTreeNode = function(node, func) {
|
||||
var child, j, len, ref2, res;
|
||||
node || (node = this.document());
|
||||
ref2 = node.children;
|
||||
for (j = 0, len = ref2.length; j < len; j++) {
|
||||
child = ref2[j];
|
||||
if (res = func(child)) {
|
||||
return res;
|
||||
} else {
|
||||
res = this.foreachTreeNode(child, func);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return XMLNode;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
var _default = stringify;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 865:
|
||||
/***/ (function(module) {
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if ( true && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -41489,7 +41660,7 @@ exports.TraceAPI = TraceAPI;
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
module.exports = XMLAttribute = (function() {
|
||||
function XMLAttribute(parent, name, value) {
|
||||
@ -42461,7 +42632,7 @@ exports.PollerStoppedError = PollerStoppedError;
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
var iterate = __webpack_require__(157)
|
||||
, initState = __webpack_require__(147)
|
||||
, initState = __webpack_require__(903)
|
||||
, terminator = __webpack_require__(939)
|
||||
;
|
||||
|
||||
@ -42578,98 +42749,142 @@ module.exports = uuid;
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
function isSuccessStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
exports.isSuccessStatusCode = isSuccessStatusCode;
|
||||
function isServerErrorStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return true;
|
||||
}
|
||||
return statusCode >= 500;
|
||||
}
|
||||
exports.isServerErrorStatusCode = isServerErrorStatusCode;
|
||||
function isRetryableStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
const retryableStatusCodes = [
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout
|
||||
];
|
||||
return retryableStatusCodes.includes(statusCode);
|
||||
}
|
||||
exports.isRetryableStatusCode = isRetryableStatusCode;
|
||||
function retry(name, method, getStatusCode, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let response = undefined;
|
||||
let statusCode = undefined;
|
||||
let isRetryable = false;
|
||||
let errorMessage = '';
|
||||
let attempt = 1;
|
||||
while (attempt <= maxAttempts) {
|
||||
try {
|
||||
response = yield method();
|
||||
statusCode = getStatusCode(response);
|
||||
if (!isServerErrorStatusCode(statusCode)) {
|
||||
return response;
|
||||
}
|
||||
isRetryable = isRetryableStatusCode(statusCode);
|
||||
errorMessage = `Cache service responded with ${statusCode}`;
|
||||
}
|
||||
catch (error) {
|
||||
isRetryable = true;
|
||||
errorMessage = error.message;
|
||||
}
|
||||
core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
||||
if (!isRetryable) {
|
||||
core.debug(`${name} - Error is not retryable`);
|
||||
break;
|
||||
}
|
||||
attempt++;
|
||||
}
|
||||
throw Error(`${name} failed: ${errorMessage}`);
|
||||
});
|
||||
}
|
||||
exports.retry = retry;
|
||||
function retryTypedResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryTypedResponse = retryTypedResponse;
|
||||
function retryHttpClientResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryHttpClientResponse = retryHttpClientResponse;
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const http_client_1 = __webpack_require__(539);
|
||||
function isSuccessStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
exports.isSuccessStatusCode = isSuccessStatusCode;
|
||||
function isServerErrorStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return true;
|
||||
}
|
||||
return statusCode >= 500;
|
||||
}
|
||||
exports.isServerErrorStatusCode = isServerErrorStatusCode;
|
||||
function isRetryableStatusCode(statusCode) {
|
||||
if (!statusCode) {
|
||||
return false;
|
||||
}
|
||||
const retryableStatusCodes = [
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout
|
||||
];
|
||||
return retryableStatusCodes.includes(statusCode);
|
||||
}
|
||||
exports.isRetryableStatusCode = isRetryableStatusCode;
|
||||
function retry(name, method, getStatusCode, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let response = undefined;
|
||||
let statusCode = undefined;
|
||||
let isRetryable = false;
|
||||
let errorMessage = '';
|
||||
let attempt = 1;
|
||||
while (attempt <= maxAttempts) {
|
||||
try {
|
||||
response = yield method();
|
||||
statusCode = getStatusCode(response);
|
||||
if (!isServerErrorStatusCode(statusCode)) {
|
||||
return response;
|
||||
}
|
||||
isRetryable = isRetryableStatusCode(statusCode);
|
||||
errorMessage = `Cache service responded with ${statusCode}`;
|
||||
}
|
||||
catch (error) {
|
||||
isRetryable = true;
|
||||
errorMessage = error.message;
|
||||
}
|
||||
core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
||||
if (!isRetryable) {
|
||||
core.debug(`${name} - Error is not retryable`);
|
||||
break;
|
||||
}
|
||||
attempt++;
|
||||
}
|
||||
throw Error(`${name} failed: ${errorMessage}`);
|
||||
});
|
||||
}
|
||||
exports.retry = retry;
|
||||
function retryTypedResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryTypedResponse = retryTypedResponse;
|
||||
function retryHttpClientResponse(name, method, maxAttempts = 2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts);
|
||||
});
|
||||
}
|
||||
exports.retryHttpClientResponse = retryHttpClientResponse;
|
||||
//# sourceMappingURL=requestUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 903:
|
||||
/***/ (function(module) {
|
||||
|
||||
// API
|
||||
module.exports = state;
|
||||
|
||||
/**
|
||||
* Creates initial state object
|
||||
* for iteration over list
|
||||
*
|
||||
* @param {array|object} list - list to iterate over
|
||||
* @param {function|null} sortMethod - function to use for keys sort,
|
||||
* or `null` to keep them as is
|
||||
* @returns {object} - initial state object
|
||||
*/
|
||||
function state(list, sortMethod)
|
||||
{
|
||||
var isNamedList = !Array.isArray(list)
|
||||
, initState =
|
||||
{
|
||||
index : 0,
|
||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||
jobs : {},
|
||||
results : isNamedList ? {} : [],
|
||||
size : isNamedList ? Object.keys(list).length : list.length
|
||||
}
|
||||
;
|
||||
|
||||
if (sortMethod)
|
||||
{
|
||||
// sort array keys based on it's values
|
||||
// sort object's keys just on own merit
|
||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||
{
|
||||
return sortMethod(list[a], list[b]);
|
||||
});
|
||||
}
|
||||
|
||||
return initState;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 919:
|
||||
@ -43245,25 +43460,25 @@ exports.setLogLevel = setLogLevel;
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var CacheFilename;
|
||||
(function (CacheFilename) {
|
||||
CacheFilename["Gzip"] = "cache.tgz";
|
||||
CacheFilename["Zstd"] = "cache.tzst";
|
||||
})(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {}));
|
||||
var CompressionMethod;
|
||||
(function (CompressionMethod) {
|
||||
CompressionMethod["Gzip"] = "gzip";
|
||||
// Long range mode was added to zstd in v1.3.2.
|
||||
// This enum is for earlier version of zstd that does not have --long support
|
||||
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
|
||||
CompressionMethod["Zstd"] = "zstd";
|
||||
})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
|
||||
// Socket timeout in milliseconds during download. If no traffic is received
|
||||
// over the socket during this period, the socket is destroyed and the download
|
||||
// is aborted.
|
||||
exports.SocketTimeout = 5000;
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var CacheFilename;
|
||||
(function (CacheFilename) {
|
||||
CacheFilename["Gzip"] = "cache.tgz";
|
||||
CacheFilename["Zstd"] = "cache.tzst";
|
||||
})(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {}));
|
||||
var CompressionMethod;
|
||||
(function (CompressionMethod) {
|
||||
CompressionMethod["Gzip"] = "gzip";
|
||||
// Long range mode was added to zstd in v1.3.2.
|
||||
// This enum is for earlier version of zstd that does not have --long support
|
||||
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
|
||||
CompressionMethod["Zstd"] = "zstd";
|
||||
})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
|
||||
// Socket timeout in milliseconds during download. If no traffic is received
|
||||
// over the socket during this period, the socket is destroyed and the download
|
||||
// is aborted.
|
||||
exports.SocketTimeout = 5000;
|
||||
//# sourceMappingURL=constants.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -43464,39 +43679,6 @@ function terminator(callback)
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 940:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
const byteToHex = [];
|
||||
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 0x100).toString(16).substr(1));
|
||||
}
|
||||
|
||||
function bytesToUuid(buf, offset_) {
|
||||
const offset = offset_ || 0; // Note: Be careful editing this code! It's been tuned for performance
|
||||
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||
|
||||
return (byteToHex[buf[offset + 0]] + byteToHex[buf[offset + 1]] + byteToHex[buf[offset + 2]] + byteToHex[buf[offset + 3]] + '-' + byteToHex[buf[offset + 4]] + byteToHex[buf[offset + 5]] + '-' + byteToHex[buf[offset + 6]] + byteToHex[buf[offset + 7]] + '-' + byteToHex[buf[offset + 8]] + byteToHex[buf[offset + 9]] + '-' + byteToHex[buf[offset + 10]] + byteToHex[buf[offset + 11]] + byteToHex[buf[offset + 12]] + byteToHex[buf[offset + 13]] + byteToHex[buf[offset + 14]] + byteToHex[buf[offset + 15]]).toLowerCase();
|
||||
}
|
||||
|
||||
var _default = bytesToUuid;
|
||||
exports.default = _default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 950:
|
||||
@ -43574,7 +43756,7 @@ exports.checkBypass = checkBypass;
|
||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
XMLNode = __webpack_require__(855);
|
||||
XMLNode = __webpack_require__(257);
|
||||
|
||||
NodeType = __webpack_require__(683);
|
||||
|
||||
@ -43934,7 +44116,7 @@ var tslib = __webpack_require__(865);
|
||||
var tough = __webpack_require__(393);
|
||||
var http = __webpack_require__(605);
|
||||
var https = __webpack_require__(211);
|
||||
__webpack_require__(454);
|
||||
var node_fetch = _interopDefault(__webpack_require__(454));
|
||||
var abortController = __webpack_require__(106);
|
||||
var FormData = _interopDefault(__webpack_require__(790));
|
||||
var util = __webpack_require__(669);
|
||||
@ -44121,7 +44303,7 @@ var Constants = {
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
coreHttpVersion: "1.1.4",
|
||||
coreHttpVersion: "1.1.5",
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
*
|
||||
@ -46428,11 +46610,6 @@ function isValidPort(port) {
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
var globalWithFetch = global;
|
||||
if (typeof globalWithFetch.fetch !== "function") {
|
||||
var fetch_1 = __webpack_require__(454).default;
|
||||
globalWithFetch.fetch = fetch_1;
|
||||
}
|
||||
function getCachedAgent(isHttps, agentCache) {
|
||||
return isHttps ? agentCache.httpsAgent : agentCache.httpAgent;
|
||||
}
|
||||
@ -46489,7 +46666,7 @@ var NodeFetchHttpClient = /** @class */ (function (_super) {
|
||||
NodeFetchHttpClient.prototype.fetch = function (input, init) {
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib.__generator(this, function (_a) {
|
||||
return [2 /*return*/, fetch(input, init)];
|
||||
return [2 /*return*/, node_fetch(input, init)];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
30
package-lock.json
generated
30
package-lock.json
generated
@ -5,9 +5,9 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/cache": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.1.tgz",
|
||||
"integrity": "sha512-QyMKGZTVB6bRBIMNEoW74LeqYtbY7cSaWNvaT1uqhzjredaW+vNFxv9XF/cyipzwZBVZgizOF2zpdVYnP0UVYg==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.2.tgz",
|
||||
"integrity": "sha512-CzAseaJ4cKmOI58EIWUb/LfeYdM7Y25s39OEMtWAhEPrPPzrbSEjGHCLaYjJ0V8C4iojo8vBYh5B3OIJ37EiJw==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.4",
|
||||
"@actions/exec": "^1.0.1",
|
||||
@ -87,9 +87,9 @@
|
||||
}
|
||||
},
|
||||
"@azure/core-http": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.1.4.tgz",
|
||||
"integrity": "sha512-81cNvyT51MfYBVIscPwC7Sl1n/xWimqho+R2eOQLw6Qqtfxs5dYlFWfLr9HbYX7QEXZdc5xdsyYTjvfJkjA7Hg==",
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.1.5.tgz",
|
||||
"integrity": "sha512-4nrA7SzfPxoyTF7hzmN6Zi2RJf57/ZE5rKTSb2oCOrzxKqTRNZrBm0mCDxTLktxsRN1xbNUTxFy5dm/Irb1RCQ==",
|
||||
"requires": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-auth": "^1.1.3",
|
||||
@ -134,9 +134,9 @@
|
||||
"integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.2.0.tgz",
|
||||
"integrity": "sha512-CYpGiFTUrmI6OBMkAdjSDM0k5h8SkkiTP4WAjQgDgNB1S3Ou9VBEvr6q0Kv2H1mMk7IWfxYGpMH5sd5AvcIV2Q=="
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
|
||||
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -178,9 +178,9 @@
|
||||
}
|
||||
},
|
||||
"@azure/ms-rest-js": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.0.7.tgz",
|
||||
"integrity": "sha512-rQpNxDhyOIyS4E+4sUCBMvjrtbNwB32wH06cC2SFoQM4TR29bIKaTlIC1tMe0K07w9c5tNk/2uUHs6/ld/Z3+A==",
|
||||
"version": "2.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.0.8.tgz",
|
||||
"integrity": "sha512-PO4pnYaF66IAB/RWbhrTprGyhOzDzsgcbT7z8k3O38JKlwifbrhW+8M0fzx0ScZnaacP8rZyBazYMUF9P12c0g==",
|
||||
"requires": {
|
||||
"@types/node-fetch": "^2.3.7",
|
||||
"@types/tunnel": "0.0.1",
|
||||
@ -2153,9 +2153,9 @@
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"events": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz",
|
||||
"integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg=="
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
|
||||
"integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg=="
|
||||
},
|
||||
"exec-sh": {
|
||||
"version": "0.3.4",
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"@actions/core": "^1.2.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@actions/cache": "^1.0.1"
|
||||
"@actions/cache": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.13",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user