diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a6595f5..cce5bb79 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,4 +83,18 @@ jobs: server_task_id: ${{ steps.npm_tests.outputs.gha_selftest_server_task_id }} # see integration.test.ts - name: Echo success status from self-test - run: echo "Deployment succeeded = [${{ steps.self_test.outputs.completed_successfully }}]" + run: echo "Deployment succeeded = [${{ steps.self_test.outputs.task_state }}]" + + - name: GitHub Action self-test-2 + id: self_test_2 + uses: ./ + continue-on-error: true + env: + OCTOPUS_URL: ${{ env.SERVER_URL }} + OCTOPUS_API_KEY: ${{ env.ADMIN_API_KEY }} + OCTOPUS_SPACE: 'Default' + with: + server_task_id: 'ServerTasks-99999' + + - name: Echo success status from self-test-2 + run: echo "Deployment succeeded = [${{ steps.self_test_2.outputs.task_state }}]" diff --git a/README.md b/README.md index 1b1313e3..b5e683c0 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ steps: ## 📤 Outputs -| Name | Description | -| :----------------------- | :----------------------------------------------------------------- | -| `completed_successfully` | Boolean indicating whether the task completed successfully or not. | +| Name | Description | +| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `task_state` | The final [TaskState](https://github.com/OctopusDeploy/api-client.ts/blob/main/src/features/serverTasks/taskState.ts) (Canceled, Failed, Success, or TimedOut) returned from Octopus, or undefined if Octopus couldn't be contacted to retrieve the state | ## 🤝 Contributions diff --git a/__tests__/integration/integration.test.ts b/__tests__/integration/integration.test.ts index 363d2d9d..e639c36b 100644 --- a/__tests__/integration/integration.test.ts +++ b/__tests__/integration/integration.test.ts @@ -19,7 +19,8 @@ import { RunCondition, RunConditionForAction, SpaceRepository, - StartTrigger + StartTrigger, + TaskState } from '@octopusdeploy/api-client' import { randomBytes } from 'crypto' import { setOutput } from '@actions/core' @@ -225,9 +226,9 @@ describe('integration tests', () => { const space = (await spaceRepository.list({ partialName: spaceName })).Items[0] // The first release in the project, so it should always have 0.0.1 - expect(result).toBe(true) + expect(result).toBe(TaskState.Success) expect(output.getAllMessages()).toContain( - `[INFO] 🐙 waiting for task [${standardInputParameters.serverTaskId}](${standardInputParameters.server}/app#/${space.Id}/tasks/${standardInputParameters.serverTaskId}) in Octopus Deploy...` + `[INFO] 🐙 waiting for task ${standardInputParameters.server}/app#/${space.Id}/tasks/${standardInputParameters.serverTaskId} in Octopus Deploy...` ) // re-queue another deployment to the same environment, which the self test is going to wait for via localServerTaskId diff --git a/action.yml b/action.yml index 14cad429..90f58518 100644 --- a/action.yml +++ b/action.yml @@ -26,8 +26,8 @@ inputs: description: 'The name of a space within which this command will be executed. The space name is required, but you may also use the OCTOPUS_SPACE environment variable.' outputs: - completed_successfully: - description: 'Boolean indicating whether the task completed successfully or not.' + task_state: + description: 'The final TaskState (Canceled, Failed, Success, or TimedOut) returned from Octopus, or undefined if Octopus could not be contacted to retrieve the state. ' runs: using: 'node16' diff --git a/dist/index.js b/dist/index.js index fb740ebb..6fca057a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1766,17 +1766,17 @@ exports.checkBypass = checkBypass; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AdapterError = void 0; -var AdapterError = /** @class */ (function () { - function AdapterError(code, message) { - this.code = code; - this.message = message; - } - return AdapterError; -}()); -exports.AdapterError = AdapterError; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AdapterError = void 0; +var AdapterError = /** @class */ (function () { + function AdapterError(code, message) { + this.code = code; + this.message = message; + } + return AdapterError; +}()); +exports.AdapterError = AdapterError; /***/ }), @@ -1785,117 +1785,117 @@ exports.AdapterError = AdapterError; /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AxiosAdapter = void 0; -var axios_1 = __importDefault(__nccwpck_require__(6545)); -var adapter_1 = __nccwpck_require__(937); -var AxiosAdapter = /** @class */ (function () { - function AxiosAdapter() { - } - AxiosAdapter.prototype.execute = function (options) { - var _a, _b; - return __awaiter(this, void 0, void 0, function () { - function formatError(response) { - if (!response.data) { - return undefined; - } - var message = response.data.ErrorMessage; - if (response.data.Errors) { - var errors = response.data.Errors; - for (var i = 0; i < errors.length; i++) { - message += "\n".concat(errors[i]); - } - } - return message; - } - var config, userAgent, response, error_1; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - _c.trys.push([0, 2, , 3]); - config = { - httpsAgent: options.configuration.httpsAgent, - url: options.url, - method: options.method, - data: options.requestBody, - headers: { - "X-Octopus-ApiKey": (_a = options.configuration.apiKey) !== null && _a !== void 0 ? _a : "", - }, - responseType: "json", - }; - if (typeof XMLHttpRequest === "undefined") { - if (config.headers) { - userAgent = "ts-octopusdeploy"; - if (options.configuration.userAgentApp) { - userAgent = "".concat(userAgent, " ").concat(options.configuration.userAgentApp); - } - config.headers["User-Agent"] = userAgent; - } - } - return [4 /*yield*/, axios_1.default.request(config)]; - case 1: - response = _c.sent(); - return [2 /*return*/, { - data: response.data, - statusCode: response.status, - }]; - case 2: - error_1 = _c.sent(); - if (axios_1.default.isAxiosError(error_1) && error_1.response) { - throw new adapter_1.AdapterError(error_1.response.status, (_b = formatError(error_1.response)) !== null && _b !== void 0 ? _b : error_1.message); - } - else { - throw error_1; - } - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - return AxiosAdapter; -}()); -exports.AxiosAdapter = AxiosAdapter; + +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 __generator = (this && this.__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 }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AxiosAdapter = void 0; +var axios_1 = __importDefault(__nccwpck_require__(6545)); +var adapter_1 = __nccwpck_require__(937); +var AxiosAdapter = /** @class */ (function () { + function AxiosAdapter() { + } + AxiosAdapter.prototype.execute = function (options) { + var _a, _b; + return __awaiter(this, void 0, void 0, function () { + function formatError(response) { + if (!response.data) { + return undefined; + } + var message = response.data.ErrorMessage; + if (response.data.Errors) { + var errors = response.data.Errors; + for (var i = 0; i < errors.length; i++) { + message += "\n".concat(errors[i]); + } + } + return message; + } + var config, userAgent, response, error_1; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + _c.trys.push([0, 2, , 3]); + config = { + httpsAgent: options.configuration.httpsAgent, + url: options.url, + method: options.method, + data: options.requestBody, + headers: { + "X-Octopus-ApiKey": (_a = options.configuration.apiKey) !== null && _a !== void 0 ? _a : "", + }, + responseType: "json", + }; + if (typeof XMLHttpRequest === "undefined") { + if (config.headers) { + userAgent = "ts-octopusdeploy"; + if (options.configuration.userAgentApp) { + userAgent = "".concat(userAgent, " ").concat(options.configuration.userAgentApp); + } + config.headers["User-Agent"] = userAgent; + } + } + return [4 /*yield*/, axios_1.default.request(config)]; + case 1: + response = _c.sent(); + return [2 /*return*/, { + data: response.data, + statusCode: response.status, + }]; + case 2: + error_1 = _c.sent(); + if (axios_1.default.isAxiosError(error_1) && error_1.response) { + throw new adapter_1.AdapterError(error_1.response.status, (_b = formatError(error_1.response)) !== null && _b !== void 0 ? _b : error_1.message); + } + else { + throw error_1; + } + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + return AxiosAdapter; +}()); +exports.AxiosAdapter = AxiosAdapter; /***/ }), @@ -1904,130 +1904,130 @@ exports.AxiosAdapter = AxiosAdapter; /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var octopusError_1 = __nccwpck_require__(408); -var adapter_1 = __nccwpck_require__(937); -var axiosAdapter_1 = __nccwpck_require__(9018); -var ApiClient = /** @class */ (function () { - function ApiClient(options) { - var _this = this; - this.handleSuccess = function (response) { - if (_this.options.onResponseCallback) { - var details = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions - method: _this.options.method, - url: _this.options.url, - statusCode: response.statusCode, - }; - _this.options.onResponseCallback(details); - } - var responseText = ""; - if (_this.options.raw) { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - responseText = response.data; - } - else { - responseText = JSON.stringify(response.data); - if (responseText && responseText.length > 0) { - responseText = JSON.parse(responseText); - } - } - _this.options.success(responseText); - }; - this.handleError = function (requestError) { - var err = generateOctopusError(requestError); - if (_this.options.onErrorResponseCallback) { - var details = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions - method: _this.options.method, - url: _this.options.url, - statusCode: err.StatusCode, - errorMessage: err.ErrorMessage, - errors: err.Errors, - }; - _this.options.onErrorResponseCallback(details); - } - _this.options.error(err); - }; - this.options = options; - this.adapter = new axiosAdapter_1.AxiosAdapter(); - } - ApiClient.prototype.execute = function () { - return __awaiter(this, void 0, void 0, function () { - var response, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.adapter.execute(this.options)]; - case 1: - response = _a.sent(); - this.handleSuccess(response); - return [3 /*break*/, 3]; - case 2: - error_1 = _a.sent(); - if (error_1 instanceof adapter_1.AdapterError) { - this.handleError(error_1); - } - else if (error_1 instanceof Error) { - this.options.error(error_1); - } - else { - this.options.error(Error("An unknown error occurred: ".concat(error_1))); - } - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - return ApiClient; -}()); -exports["default"] = ApiClient; -var generateOctopusError = function (requestError) { - if (requestError.code) { - var code = requestError.code; - return new octopusError_1.OctopusError(code, requestError.message); - } - return new octopusError_1.OctopusError(0, requestError.message); -}; + +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var octopusError_1 = __nccwpck_require__(408); +var adapter_1 = __nccwpck_require__(937); +var axiosAdapter_1 = __nccwpck_require__(9018); +var ApiClient = /** @class */ (function () { + function ApiClient(options) { + var _this = this; + this.handleSuccess = function (response) { + if (_this.options.onResponseCallback) { + var details = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions + method: _this.options.method, + url: _this.options.url, + statusCode: response.statusCode, + }; + _this.options.onResponseCallback(details); + } + var responseText = ""; + if (_this.options.raw) { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + responseText = response.data; + } + else { + responseText = JSON.stringify(response.data); + if (responseText && responseText.length > 0) { + responseText = JSON.parse(responseText); + } + } + _this.options.success(responseText); + }; + this.handleError = function (requestError) { + var err = generateOctopusError(requestError); + if (_this.options.onErrorResponseCallback) { + var details = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions + method: _this.options.method, + url: _this.options.url, + statusCode: err.StatusCode, + errorMessage: err.ErrorMessage, + errors: err.Errors, + }; + _this.options.onErrorResponseCallback(details); + } + _this.options.error(err); + }; + this.options = options; + this.adapter = new axiosAdapter_1.AxiosAdapter(); + } + ApiClient.prototype.execute = function () { + return __awaiter(this, void 0, void 0, function () { + var response, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.adapter.execute(this.options)]; + case 1: + response = _a.sent(); + this.handleSuccess(response); + return [3 /*break*/, 3]; + case 2: + error_1 = _a.sent(); + if (error_1 instanceof adapter_1.AdapterError) { + this.handleError(error_1); + } + else if (error_1 instanceof Error) { + this.options.error(error_1); + } + else { + this.options.error(Error("An unknown error occurred: ".concat(error_1))); + } + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + return ApiClient; +}()); +exports["default"] = ApiClient; +var generateOctopusError = function (requestError) { + if (requestError.code) { + var code = requestError.code; + return new octopusError_1.OctopusError(code, requestError.message); + } + return new octopusError_1.OctopusError(0, requestError.message); +}; /***/ }), @@ -2036,10 +2036,10 @@ var generateOctopusError = function (requestError) { /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.apiLocation = void 0; -exports.apiLocation = "~/api"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.apiLocation = void 0; +exports.apiLocation = "~/api"; /***/ }), @@ -2048,100 +2048,100 @@ exports.apiLocation = "~/api"; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/init-declarations */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -var MAX_MEMORY = (Math.pow(1024, 2) * 1000) / 2; //1GB /2 (1 character in js is 2 bytes) -var Caching = /** @class */ (function () { - function Caching(options) { - this.cache = {}; - options = options || { - maxMemory: MAX_MEMORY, - }; - this.maxMemory = options.maxMemory; - this.dataVersionHeader = "X-Octopus-Data-Version"; - this.authorizationHashHeader = "X-Octopus-Authorization-Hash"; - } - Caching.prototype.clearAll = function () { - this.cache = {}; - }; - Caching.prototype.setHeaderAndGetValue = function (request, options) { - if (this.cache[options.url]) { - request.setRequestHeader(this.dataVersionHeader, this.cache[options.url].dataVersion); - request.setRequestHeader(this.authorizationHashHeader, this.cache[options.url].authorizationHash); - this.cache[options.url].lastAccessed = new Date(); - return this.cache[options.url].value; - } - }; - Caching.prototype.updateCache = function (request, options) { - try { - var dataVersion = request.getResponseHeader(this.dataVersionHeader); - var authorizationHash = request.getResponseHeader(this.authorizationHashHeader); - if (!!dataVersion && !!authorizationHash) { - var item = { - dataVersion: dataVersion, - authorizationHash: authorizationHash, - lastAccessed: new Date(), - value: request.responseText, - }; - var itemSize = this.itemSizeInMemory(options.url, item); - if (itemSize < this.maxMemory) { - this.cache[options.url] = item; - } - this.memoryPressureCleanup(); - } - else { - delete this.cache[options.url]; - } - } - catch (e) { - delete this.cache[options.url]; - } - }; - Caching.prototype.canUseCachedValue = function (request) { - return request.status === 304 && (request.responseText === "" || !request.responseText); - }; - Caching.prototype.memoryPressureCleanup = function () { - var currentMemory = this.roughSizeOfReleasableMemory(); - while (currentMemory >= this.maxMemory) { - this.removeOldest(); - var newMemoryLevel = this.roughSizeOfReleasableMemory(); - if (newMemoryLevel === currentMemory) { - // Just make sure we don't get stuck. - return; - } - currentMemory = newMemoryLevel; - } - }; - Caching.prototype.itemSizeInMemory = function (url, item) { - return url.length + item.value.length; - }; - Caching.prototype.removeOldest = function () { - var _this = this; - var oldestUrl; - var oldestResponded = -1; - var now = new Date(); - Object.keys(this.cache).forEach(function (url) { - var age = now.valueOf() - _this.cache[url].lastAccessed.valueOf(); - if (age > oldestResponded) { - oldestResponded = age; - oldestUrl = url; - } - }); - delete this.cache[oldestUrl]; - }; - Caching.prototype.roughSizeOfReleasableMemory = function () { - var _this = this; - return Object.keys(this.cache).reduce(function (total, url) { - var item = _this.cache[url]; - return total + _this.itemSizeInMemory(url, item); - }, 0); - }; - return Caching; -}()); -exports["default"] = Caching; + +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/init-declarations */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +var MAX_MEMORY = (Math.pow(1024, 2) * 1000) / 2; //1GB /2 (1 character in js is 2 bytes) +var Caching = /** @class */ (function () { + function Caching(options) { + this.cache = {}; + options = options || { + maxMemory: MAX_MEMORY, + }; + this.maxMemory = options.maxMemory; + this.dataVersionHeader = "X-Octopus-Data-Version"; + this.authorizationHashHeader = "X-Octopus-Authorization-Hash"; + } + Caching.prototype.clearAll = function () { + this.cache = {}; + }; + Caching.prototype.setHeaderAndGetValue = function (request, options) { + if (this.cache[options.url]) { + request.setRequestHeader(this.dataVersionHeader, this.cache[options.url].dataVersion); + request.setRequestHeader(this.authorizationHashHeader, this.cache[options.url].authorizationHash); + this.cache[options.url].lastAccessed = new Date(); + return this.cache[options.url].value; + } + }; + Caching.prototype.updateCache = function (request, options) { + try { + var dataVersion = request.getResponseHeader(this.dataVersionHeader); + var authorizationHash = request.getResponseHeader(this.authorizationHashHeader); + if (!!dataVersion && !!authorizationHash) { + var item = { + dataVersion: dataVersion, + authorizationHash: authorizationHash, + lastAccessed: new Date(), + value: request.responseText, + }; + var itemSize = this.itemSizeInMemory(options.url, item); + if (itemSize < this.maxMemory) { + this.cache[options.url] = item; + } + this.memoryPressureCleanup(); + } + else { + delete this.cache[options.url]; + } + } + catch (e) { + delete this.cache[options.url]; + } + }; + Caching.prototype.canUseCachedValue = function (request) { + return request.status === 304 && (request.responseText === "" || !request.responseText); + }; + Caching.prototype.memoryPressureCleanup = function () { + var currentMemory = this.roughSizeOfReleasableMemory(); + while (currentMemory >= this.maxMemory) { + this.removeOldest(); + var newMemoryLevel = this.roughSizeOfReleasableMemory(); + if (newMemoryLevel === currentMemory) { + // Just make sure we don't get stuck. + return; + } + currentMemory = newMemoryLevel; + } + }; + Caching.prototype.itemSizeInMemory = function (url, item) { + return url.length + item.value.length; + }; + Caching.prototype.removeOldest = function () { + var _this = this; + var oldestUrl; + var oldestResponded = -1; + var now = new Date(); + Object.keys(this.cache).forEach(function (url) { + var age = now.valueOf() - _this.cache[url].lastAccessed.valueOf(); + if (age > oldestResponded) { + oldestResponded = age; + oldestUrl = url; + } + }); + delete this.cache[oldestUrl]; + }; + Caching.prototype.roughSizeOfReleasableMemory = function () { + var _this = this; + return Object.keys(this.cache).reduce(function (total, url) { + var item = _this.cache[url]; + return total + _this.itemSizeInMemory(url, item); + }, 0); + }; + return Caching; +}()); +exports["default"] = Caching; /***/ }), @@ -2150,392 +2150,363 @@ exports["default"] = Caching; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Client = void 0; -var apiClient_1 = __importDefault(__nccwpck_require__(1542)); -var resolver_1 = __nccwpck_require__(8043); -var subscriptionRecord_1 = __nccwpck_require__(1547); -var spaceScopedOperation_1 = __nccwpck_require__(3667); -var spaceResolver_1 = __nccwpck_require__(2054); -var spaceScopedArgs_1 = __nccwpck_require__(5626); -var spaceScopedRequest_1 = __nccwpck_require__(3295); -var apiLocation_1 = __nccwpck_require__(7083); -// The Octopus Client implements the low-level semantics of the Octopus Deploy REST API -var Client = /** @class */ (function () { - function Client(resolver, configuration) { - var _this = this; - this.resolver = resolver; - this.configuration = configuration; - this.requestSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); - this.responseSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); - this.errorSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); - this.onRequestCallback = undefined; - this.onResponseCallback = undefined; - this.onErrorResponseCallback = undefined; - this.debug = function (message) { - _this.logger.debug && _this.logger.debug(message); - }; - this.info = function (message) { - _this.logger.info && _this.logger.info(message); - }; - this.warn = function (message) { - _this.logger.warn && _this.logger.warn(message); - }; - this.error = function (message, error) { - if (error === void 0) { error = undefined; } - _this.logger.error && _this.logger.error(message, error); - }; - this.subscribeToRequests = function (registrationName, callback) { - return _this.requestSubscriptions.subscribe(registrationName, callback); - }; - this.subscribeToResponses = function (registrationName, callback) { - return _this.responseSubscriptions.subscribe(registrationName, callback); - }; - this.subscribeToErrors = function (registrationName, callback) { - return _this.errorSubscriptions.subscribe(registrationName, callback); - }; - this.setOnRequestCallback = function (callback) { - _this.onRequestCallback = callback; - }; - this.setOnResponseCallback = function (callback) { - _this.onResponseCallback = callback; - }; - this.setOnErrorResponseCallback = function (callback) { - _this.onErrorResponseCallback = callback; - }; - this.resolve = function (path, uriTemplateParameters) { return _this.resolver.resolve(path, uriTemplateParameters); }; - this.configuration = configuration; - this.logger = configuration.logging || { - debug: function (message) { return null; }, - info: function (message) { return null; }, - warn: function (message) { return null; }, - error: function (message, err) { return null; }, - }; - this.resolver = resolver; - } - Client.create = function (configuration) { - return __awaiter(this, void 0, void 0, function () { - var resolver, client; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!configuration.instanceURL) { - throw new Error("The host is not specified"); - } - resolver = new resolver_1.Resolver(configuration.instanceURL); - client = new Client(resolver, configuration); - return [4 /*yield*/, client.getServerInformation()]; - case 1: - _a.sent(); - return [2 /*return*/, client]; - } - }); - }); - }; - Client.prototype.get = function (path, args) { - if (path === undefined) - throw new Error("path parameter was not"); - var url = this.resolveUrl(path, args); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return this.dispatchRequest("GET", url); - }; - Client.prototype.getRaw = function (path, args) { - var _this = this; - var url = this.resolve(path, args); - return new Promise(function (resolve, reject) { - new apiClient_1.default({ - configuration: _this.configuration, - url: url, - method: "GET", - error: function (e) { return reject(e); }, - raw: true, - success: function (data) { return resolve(data); }, - onRequestCallback: function (r) { return _this.onRequest(r); }, - onResponseCallback: function (r) { return _this.onResponse(r); }, - onErrorResponseCallback: function (r) { return _this.onErrorResponse(r); }, - }).execute(); - }); - }; - Client.prototype.onRequest = function (clientRequestDetails) { - var details = { - url: clientRequestDetails.url, - method: clientRequestDetails.method, - }; - if (this.onRequestCallback) { - this.onRequestCallback(details); - } - this.requestSubscriptions.notifyAll(details); - }; - Client.prototype.onResponse = function (clientResponseDetails) { - var details = { - url: clientResponseDetails.url, - method: clientResponseDetails.method, - statusCode: clientResponseDetails.statusCode, - }; - if (this.onResponseCallback) { - this.onResponseCallback(details); - } - this.responseSubscriptions.notifyAll(details); - }; - Client.prototype.onErrorResponse = function (clientErrorResponseDetails) { - var details = { - url: clientErrorResponseDetails.url, - method: clientErrorResponseDetails.method, - statusCode: clientErrorResponseDetails.statusCode, - errorMessage: clientErrorResponseDetails.errorMessage, - errors: clientErrorResponseDetails.errors, - }; - if (this.onErrorResponseCallback) { - this.onErrorResponseCallback(details); - } - this.errorSubscriptions.notifyAll(details); - }; - Client.prototype.doCreate = function (path, command, args) { - return __awaiter(this, void 0, void 0, function () { - var spaceId, spaceId, url; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(0, spaceScopedOperation_1.isSpaceScopedOperation)(command)) return [3 /*break*/, 2]; - return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, command.spaceName)]; - case 1: - spaceId = _a.sent(); - args = __assign({ spaceId: spaceId }, args); - command = __assign({ spaceId: spaceId }, command); - _a.label = 2; - case 2: - if (!(args && (0, spaceScopedArgs_1.isSpaceScopedArgs)(args))) return [3 /*break*/, 4]; - return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, args.spaceName)]; - case 3: - spaceId = _a.sent(); - args = __assign({ spaceId: spaceId }, args); - _a.label = 4; - case 4: - url = this.resolveUrl(path, args); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return [2 /*return*/, this.dispatchRequest("POST", url, command)]; - } - }); - }); - }; - Client.prototype.doUpdate = function (path, command, args) { - return __awaiter(this, void 0, void 0, function () { - var spaceId, url; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(0, spaceScopedOperation_1.isSpaceScopedOperation)(command)) return [3 /*break*/, 2]; - return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, command.spaceName)]; - case 1: - spaceId = _a.sent(); - args = __assign({ spaceId: spaceId }, args); - command = __assign({ spaceId: spaceId }, command); - _a.label = 2; - case 2: - url = this.resolveUrl(path, args); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return [2 /*return*/, this.dispatchRequest("PUT", url, command)]; - } - }); - }); - }; - Client.prototype.request = function (path, request) { - return __awaiter(this, void 0, void 0, function () { - var spaceId, url; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(0, spaceScopedRequest_1.isSpaceScopedRequest)(request)) return [3 /*break*/, 2]; - return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, request.spaceName)]; - case 1: - spaceId = _a.sent(); - request = __assign({ spaceId: spaceId }, request); - _a.label = 2; - case 2: - url = this.resolveUrl(path, request); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return [2 /*return*/, this.dispatchRequest("GET", url, null)]; - } - }); - }); - }; - Client.prototype.post = function (path, resource, args) { - var url = this.resolveUrl(path, args); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return this.dispatchRequest("POST", url, resource); - }; - Client.prototype.create = function (path, resource, args) { - var _this = this; - var url = this.resolve(path, args); - return new Promise(function (resolve, reject) { - _this.dispatchRequest("POST", url, resource).then(function (result) { - var _a; - var selfLink = (_a = result.Links) === null || _a === void 0 ? void 0 : _a.Self; - if (selfLink) { - var result2 = _this.get(selfLink); - resolve(result2); - return; - } - resolve(result); - }, reject); - }); - }; - Client.prototype.update = function (path, resource, args) { - var _this = this; - var url = this.resolve(path, args); - return new Promise(function (resolve, reject) { - _this.dispatchRequest("PUT", url, resource).then(function (result) { - var _a; - var selfLink = (_a = result.Links) === null || _a === void 0 ? void 0 : _a.Self; - if (selfLink) { - var result2 = _this.get(selfLink); - resolve(result2); - return; - } - resolve(result); - }, reject); - }); - }; - Client.prototype.del = function (path, resource, args) { - var url = this.resolve(path, args); - return this.dispatchRequest("DELETE", url, resource); - }; - Client.prototype.put = function (path, resource, args) { - var url = this.resolveUrl(path, args); - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return this.dispatchRequest("PUT", url, resource); - }; - Client.prototype.getServerInformation = function () { - return __awaiter(this, void 0, void 0, function () { - var _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!!this.serverInformation) return [3 /*break*/, 2]; - _a = this; - return [4 /*yield*/, this.tryGetServerInformation()]; - case 1: - _a.serverInformation = _b.sent(); - if (!this.serverInformation) { - throw new Error("The Octopus server information could not be retrieved. Please check the configured URL."); - } - _b.label = 2; - case 2: return [2 /*return*/, this.serverInformation]; - } - }); - }); - }; - Client.prototype.tryGetServerInformation = function () { - return __awaiter(this, void 0, void 0, function () { - var rootDocument; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.get(apiLocation_1.apiLocation)]; - case 1: - rootDocument = _a.sent(); - return [2 /*return*/, rootDocument - ? { - version: rootDocument.Version, - installationId: rootDocument.InstallationId, - } - : null]; - } - }); - }); - }; - Client.prototype.dispatchRequest = function (method, url, requestBody) { - var _this = this; - return new Promise(function (resolve, reject) { - new apiClient_1.default({ - configuration: _this.configuration, - error: function (e) { return reject(e); }, - method: method, - url: url, - requestBody: requestBody, - success: function (data) { return resolve(data); }, - onRequestCallback: function (r) { return _this.onRequest(r); }, - onResponseCallback: function (r) { return _this.onResponse(r); }, - onErrorResponseCallback: function (r) { return _this.onErrorResponse(r); }, - }).execute(); - }); - }; - Client.prototype.resolveUrl = function (path, args) { - return this.resolve(path, args); - }; - return Client; -}()); -exports.Client = Client; - - -/***/ }), - -/***/ 5966: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - - -/***/ }), + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +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 __generator = (this && this.__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 }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Client = void 0; +var apiClient_1 = __importDefault(__nccwpck_require__(1542)); +var resolver_1 = __nccwpck_require__(8043); +var subscriptionRecord_1 = __nccwpck_require__(1547); +var spaceScopedOperation_1 = __nccwpck_require__(3667); +var spaceResolver_1 = __nccwpck_require__(2054); +var spaceScopedArgs_1 = __nccwpck_require__(5626); +var spaceScopedRequest_1 = __nccwpck_require__(3295); +var apiLocation_1 = __nccwpck_require__(7083); +// The Octopus Client implements the low-level semantics of the Octopus Deploy REST API +var Client = /** @class */ (function () { + function Client(resolver, configuration) { + var _this = this; + this.resolver = resolver; + this.configuration = configuration; + this.requestSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); + this.responseSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); + this.errorSubscriptions = new subscriptionRecord_1.SubscriptionRecord(); + this.onRequestCallback = undefined; + this.onResponseCallback = undefined; + this.onErrorResponseCallback = undefined; + this.debug = function (message) { + _this.logger.debug && _this.logger.debug(message); + }; + this.info = function (message) { + _this.logger.info && _this.logger.info(message); + }; + this.warn = function (message) { + _this.logger.warn && _this.logger.warn(message); + }; + this.error = function (message, error) { + if (error === void 0) { error = undefined; } + _this.logger.error && _this.logger.error(message, error); + }; + this.subscribeToRequests = function (registrationName, callback) { + return _this.requestSubscriptions.subscribe(registrationName, callback); + }; + this.subscribeToResponses = function (registrationName, callback) { + return _this.responseSubscriptions.subscribe(registrationName, callback); + }; + this.subscribeToErrors = function (registrationName, callback) { + return _this.errorSubscriptions.subscribe(registrationName, callback); + }; + this.setOnRequestCallback = function (callback) { + _this.onRequestCallback = callback; + }; + this.setOnResponseCallback = function (callback) { + _this.onResponseCallback = callback; + }; + this.setOnErrorResponseCallback = function (callback) { + _this.onErrorResponseCallback = callback; + }; + this.resolve = function (path, uriTemplateParameters) { return _this.resolver.resolve(path, uriTemplateParameters); }; + this.configuration = configuration; + this.logger = configuration.logging || { + debug: function (message) { return null; }, + info: function (message) { return null; }, + warn: function (message) { return null; }, + error: function (message, err) { return null; }, + }; + this.resolver = resolver; + } + Client.create = function (configuration) { + return __awaiter(this, void 0, void 0, function () { + var resolver, client; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!configuration.instanceURL) { + throw new Error("The host is not specified"); + } + resolver = new resolver_1.Resolver(configuration.instanceURL); + client = new Client(resolver, configuration); + return [4 /*yield*/, client.getServerInformation()]; + case 1: + _a.sent(); + return [2 /*return*/, client]; + } + }); + }); + }; + Client.prototype.get = function (path, args) { + if (path === undefined) + throw new Error("path parameter was not"); + var url = this.resolveUrl(path, args); + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return this.dispatchRequest("GET", url); + }; + Client.prototype.getRaw = function (path, args) { + var _this = this; + var url = this.resolve(path, args); + return new Promise(function (resolve, reject) { + new apiClient_1.default({ + configuration: _this.configuration, + url: url, + method: "GET", + error: function (e) { return reject(e); }, + raw: true, + success: function (data) { return resolve(data); }, + onRequestCallback: function (r) { return _this.onRequest(r); }, + onResponseCallback: function (r) { return _this.onResponse(r); }, + onErrorResponseCallback: function (r) { return _this.onErrorResponse(r); }, + }).execute(); + }); + }; + Client.prototype.onRequest = function (clientRequestDetails) { + var details = { + url: clientRequestDetails.url, + method: clientRequestDetails.method, + }; + if (this.onRequestCallback) { + this.onRequestCallback(details); + } + this.requestSubscriptions.notifyAll(details); + }; + Client.prototype.onResponse = function (clientResponseDetails) { + var details = { + url: clientResponseDetails.url, + method: clientResponseDetails.method, + statusCode: clientResponseDetails.statusCode, + }; + if (this.onResponseCallback) { + this.onResponseCallback(details); + } + this.responseSubscriptions.notifyAll(details); + }; + Client.prototype.onErrorResponse = function (clientErrorResponseDetails) { + var details = { + url: clientErrorResponseDetails.url, + method: clientErrorResponseDetails.method, + statusCode: clientErrorResponseDetails.statusCode, + errorMessage: clientErrorResponseDetails.errorMessage, + errors: clientErrorResponseDetails.errors, + }; + if (this.onErrorResponseCallback) { + this.onErrorResponseCallback(details); + } + this.errorSubscriptions.notifyAll(details); + }; + Client.prototype.doCreate = function (path, command, args) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.doCommand("POST", path, command, args)]; + }); + }); + }; + Client.prototype.doUpdate = function (path, command, args) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.doCommand("PUT", path, command, args)]; + }); + }); + }; + Client.prototype.doCommand = function (verb, path, command, args) { + return __awaiter(this, void 0, void 0, function () { + var spaceId, spaceId, url; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(0, spaceScopedOperation_1.isSpaceScopedOperation)(command)) return [3 /*break*/, 2]; + return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, command.spaceName)]; + case 1: + spaceId = _a.sent(); + args = __assign({ spaceId: spaceId }, args); + command = __assign({ spaceId: spaceId }, command); + _a.label = 2; + case 2: + if (!(args && (0, spaceScopedArgs_1.isSpaceScopedArgs)(args))) return [3 /*break*/, 4]; + return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, args.spaceName)]; + case 3: + spaceId = _a.sent(); + args = __assign({ spaceId: spaceId }, args); + _a.label = 4; + case 4: + url = this.resolveUrl(path, args); + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return [2 /*return*/, this.dispatchRequest(verb, url, command)]; + } + }); + }); + }; + Client.prototype.request = function (path, request) { + return __awaiter(this, void 0, void 0, function () { + var spaceId, url; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(0, spaceScopedRequest_1.isSpaceScopedRequest)(request)) return [3 /*break*/, 2]; + return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, request.spaceName)]; + case 1: + spaceId = _a.sent(); + request = __assign({ spaceId: spaceId }, request); + _a.label = 2; + case 2: + url = this.resolveUrl(path, request); + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return [2 /*return*/, this.dispatchRequest("GET", url, null)]; + } + }); + }); + }; + Client.prototype.post = function (path, resource, args) { + var url = this.resolveUrl(path, args); + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return this.dispatchRequest("POST", url, resource); + }; + Client.prototype.del = function (path, args) { + return __awaiter(this, void 0, void 0, function () { + var spaceId, url; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(args && (0, spaceScopedArgs_1.isSpaceScopedArgs)(args))) return [3 /*break*/, 2]; + return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this, args.spaceName)]; + case 1: + spaceId = _a.sent(); + args = __assign({ spaceId: spaceId }, args); + _a.label = 2; + case 2: + url = this.resolve(path, args); + return [2 /*return*/, this.dispatchRequest("DELETE", url, undefined)]; + } + }); + }); + }; + Client.prototype.getServerInformation = function () { + return __awaiter(this, void 0, void 0, function () { + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!!this.serverInformation) return [3 /*break*/, 2]; + _a = this; + return [4 /*yield*/, this.tryGetServerInformation()]; + case 1: + _a.serverInformation = _b.sent(); + if (!this.serverInformation) { + throw new Error("The Octopus server information could not be retrieved. Please check the configured URL."); + } + _b.label = 2; + case 2: return [2 /*return*/, this.serverInformation]; + } + }); + }); + }; + Client.prototype.tryGetServerInformation = function () { + return __awaiter(this, void 0, void 0, function () { + var rootDocument; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.get(apiLocation_1.apiLocation)]; + case 1: + rootDocument = _a.sent(); + return [2 /*return*/, rootDocument + ? { + version: rootDocument.Version, + installationId: rootDocument.InstallationId, + } + : null]; + } + }); + }); + }; + Client.prototype.dispatchRequest = function (method, url, requestBody) { + var _this = this; + return new Promise(function (resolve, reject) { + new apiClient_1.default({ + configuration: _this.configuration, + error: function (e) { return reject(e); }, + method: method, + url: url, + requestBody: requestBody, + success: function (data) { return resolve(data); }, + onRequestCallback: function (r) { return _this.onRequest(r); }, + onResponseCallback: function (r) { return _this.onResponse(r); }, + onErrorResponseCallback: function (r) { return _this.onErrorResponse(r); }, + }).execute(); + }); + }; + Client.prototype.resolveUrl = function (path, args) { + return this.resolve(path, args); + }; + return Client; +}()); +exports.Client = Client; + + +/***/ }), + +/***/ 5966: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); + + +/***/ }), /***/ 2101: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2544,8 +2515,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2554,8 +2525,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2564,8 +2535,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2574,17 +2545,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var Environment = /** @class */ (function () { - function Environment() { - } - Environment.isInDevelopmentMode = function () { - return !process.env.NODE_ENV || process.env.NODE_ENV !== "production"; - }; - return Environment; -}()); -exports["default"] = Environment; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var Environment = /** @class */ (function () { + function Environment() { + } + Environment.isInDevelopmentMode = function () { + return !process.env.NODE_ENV || process.env.NODE_ENV !== "production"; + }; + return Environment; +}()); +exports["default"] = Environment; /***/ }), @@ -2593,8 +2564,8 @@ exports["default"] = Environment; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2603,120 +2574,81 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BasicRepository = void 0; -// Repositories provide a helpful abstraction around the Octopus Deploy API -var BasicRepository = /** @class */ (function () { - function BasicRepository(client, baseApiTemplate) { - var _this = this; - this.takeAll = 2147483647; - this.takeDefaultPageSize = 30; - this.notifySubscribersToDataModifications = function (resource) { - Object.keys(_this.subscribersToDataModifications).forEach(function (key) { return _this.subscribersToDataModifications[key](resource); }); - return resource; - }; - this.client = client; - this.baseApiTemplate = baseApiTemplate; - this.subscribersToDataModifications = {}; - } - BasicRepository.prototype.del = function (resource) { - var _this = this; - return this.client.del("".concat(this.baseApiTemplate, "/").concat(resource.Id)).then(function (d) { return _this.notifySubscribersToDataModifications(resource); }); - }; - BasicRepository.prototype.create = function (resource, args) { - return __awaiter(this, void 0, void 0, function () { - var _this = this; - return __generator(this, function (_a) { - return [2 /*return*/, this.client.doCreate(this.baseApiTemplate, resource, args).then(function (r) { return _this.notifySubscribersToDataModifications(r); })]; - }); - }); - }; - BasicRepository.prototype.get = function (id) { - return this.client.get(this.baseApiTemplate, { id: id }); - }; - BasicRepository.prototype.list = function (args) { - return this.client.get(this.baseApiTemplate, args); - }; - BasicRepository.prototype.modify = function (resource, args) { - var _this = this; - return this.client - .doUpdate(this.baseApiTemplate, resource, __assign({ id: resource.Id }, args)) - .then(function (r) { return _this.notifySubscribersToDataModifications(r); }); - }; - BasicRepository.prototype.save = function (resource) { - if (isNewResource(resource)) { - return this.create(resource); - } - else { - return this.modify(resource); - } - function isTruthy(value) { - return !!value; - } - function isNewResource(resource) { - return !("Id" in resource && isTruthy(resource.Id)); - } - }; - BasicRepository.prototype.subscribeToDataModifications = function (key, callback) { - this.subscribersToDataModifications[key] = callback; - }; - BasicRepository.prototype.unsubscribeFromDataModifications = function (key) { - delete this.subscribersToDataModifications[key]; - }; - BasicRepository.prototype.extend = function (arg1, arg2) { - return __assign(__assign({}, arg1), arg2); - }; - return BasicRepository; -}()); -exports.BasicRepository = BasicRepository; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BasicRepository = void 0; +// Repositories provide a helpful abstraction around the Octopus Deploy API +var BasicRepository = /** @class */ (function () { + function BasicRepository(client, baseApiPathTemplate, listParametersTemplate) { + var _this = this; + this.takeAll = 2147483647; + this.takeDefaultPageSize = 30; + this.notifySubscribersToDataModifications = function (resource) { + Object.keys(_this.subscribersToDataModifications).forEach(function (key) { return _this.subscribersToDataModifications[key](resource); }); + return resource; + }; + this.client = client; + this.baseApiPathTemplate = baseApiPathTemplate; + this.listParametersTemplate = listParametersTemplate; + this.subscribersToDataModifications = {}; + } + BasicRepository.prototype.del = function (resource) { + var _this = this; + return this.client.del("".concat(this.baseApiPathTemplate, "/").concat(resource.Id)).then(function (d) { return _this.notifySubscribersToDataModifications(resource); }); + }; + BasicRepository.prototype.create = function (resource, args) { + var _this = this; + return this.client.doCreate(this.baseApiPathTemplate, resource, args).then(function (r) { return _this.notifySubscribersToDataModifications(r); }); + }; + BasicRepository.prototype.get = function (id) { + return this.client.get("".concat(this.baseApiPathTemplate, "/").concat(id)); + }; + BasicRepository.prototype.list = function (args) { + return this.client.request("".concat(this.baseApiPathTemplate, "{?").concat(this.listParametersTemplate, "}"), args); + }; + BasicRepository.prototype.modify = function (resource, args) { + var _this = this; + return this.client + .doUpdate("".concat(this.baseApiPathTemplate, "/").concat(resource.Id), resource, args) + .then(function (r) { return _this.notifySubscribersToDataModifications(r); }); + }; + BasicRepository.prototype.save = function (resource) { + if (isNewResource(resource)) { + return this.create(resource); + } + else { + return this.modify(resource); + } + function isTruthy(value) { + return !!value; + } + function isNewResource(resource) { + return !("Id" in resource && isTruthy(resource.Id)); + } + }; + BasicRepository.prototype.subscribeToDataModifications = function (key, callback) { + this.subscribersToDataModifications[key] = callback; + }; + BasicRepository.prototype.unsubscribeFromDataModifications = function (key) { + delete this.subscribersToDataModifications[key]; + }; + BasicRepository.prototype.extend = function (arg1, arg2) { + return __assign(__assign({}, arg1), arg2); + }; + return BasicRepository; +}()); +exports.BasicRepository = BasicRepository; /***/ }), @@ -2725,89 +2657,110 @@ exports.BasicRepository = BasicRepository; /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BuildInformationRepository = void 0; -var overwriteMode_1 = __nccwpck_require__(7758); -var __1 = __nccwpck_require__(586); -var BuildInformationRepository = /** @class */ (function () { - function BuildInformationRepository(client, spaceName) { - this.client = client; - this.spaceName = spaceName; - } - BuildInformationRepository.prototype.push = function (buildInformation, overwriteMode) { - if (overwriteMode === void 0) { overwriteMode = overwriteMode_1.OverwriteMode.FailIfExists; } - return __awaiter(this, void 0, void 0, function () { - var tasks, _i, _a, pkg; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - tasks = []; - for (_i = 0, _a = buildInformation.Packages; _i < _a.length; _i++) { - pkg = _a[_i]; - tasks.push(this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/build-information{?overwriteMode}"), { - spaceName: buildInformation.spaceName, - PackageId: pkg.Id, - Version: pkg.Version, - OctopusBuildInformation: { - Branch: buildInformation.Branch, - BuildEnvironment: buildInformation.BuildEnvironment, - BuildNumber: buildInformation.BuildNumber, - BuildUrl: buildInformation.BuildUrl, - Commits: buildInformation.Commits.map(function (c) { return ({ Id: c.Id, Comment: c.Comment }); }), - VcsCommitNumber: buildInformation.VcsCommitNumber, - VcsRoot: buildInformation.VcsRoot, - VcsType: buildInformation.VcsType, - }, - }, { overwriteMode: overwriteMode })); - } - return [4 /*yield*/, Promise.all(tasks)]; - case 1: - _b.sent(); - return [2 /*return*/]; - } - }); - }); - }; - return BuildInformationRepository; -}()); -exports.BuildInformationRepository = BuildInformationRepository; + +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 __generator = (this && this.__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 }; + } +}; +var __values = (this && this.__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."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BuildInformationRepository = void 0; +var overwriteMode_1 = __nccwpck_require__(7758); +var __1 = __nccwpck_require__(586); +var BuildInformationRepository = /** @class */ (function () { + function BuildInformationRepository(client, spaceName) { + this.client = client; + this.spaceName = spaceName; + } + BuildInformationRepository.prototype.push = function (buildInformation, overwriteMode) { + if (overwriteMode === void 0) { overwriteMode = overwriteMode_1.OverwriteMode.FailIfExists; } + return __awaiter(this, void 0, void 0, function () { + var tasks, _a, _b, pkg; + var e_1, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + tasks = []; + try { + for (_a = __values(buildInformation.Packages), _b = _a.next(); !_b.done; _b = _a.next()) { + pkg = _b.value; + tasks.push(this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/build-information{?overwriteMode}"), { + spaceName: buildInformation.spaceName, + PackageId: pkg.Id, + Version: pkg.Version, + OctopusBuildInformation: { + Branch: buildInformation.Branch, + BuildEnvironment: buildInformation.BuildEnvironment, + BuildNumber: buildInformation.BuildNumber, + BuildUrl: buildInformation.BuildUrl, + Commits: buildInformation.Commits.map(function (c) { return ({ Id: c.Id, Comment: c.Comment }); }), + VcsCommitNumber: buildInformation.VcsCommitNumber, + VcsRoot: buildInformation.VcsRoot, + VcsType: buildInformation.VcsType, + }, + }, { overwriteMode: overwriteMode })); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } + } + return [4 /*yield*/, Promise.allSettled(tasks)]; + case 1: + _d.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return BuildInformationRepository; +}()); +exports.BuildInformationRepository = BuildInformationRepository; /***/ }), @@ -2816,25 +2769,25 @@ exports.BuildInformationRepository = BuildInformationRepository; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(460), exports); -__exportStar(__nccwpck_require__(8146), exports); -__exportStar(__nccwpck_require__(2697), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(460), exports); +__exportStar(__nccwpck_require__(8146), exports); +__exportStar(__nccwpck_require__(2697), exports); /***/ }), @@ -2843,8 +2796,8 @@ __exportStar(__nccwpck_require__(2697), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2853,17 +2806,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PackageIdentity = void 0; -var PackageIdentity = /** @class */ (function () { - function PackageIdentity(Id, Version) { - this.Id = Id; - this.Version = Version; - } - return PackageIdentity; -}()); -exports.PackageIdentity = PackageIdentity; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PackageIdentity = void 0; +var PackageIdentity = /** @class */ (function () { + function PackageIdentity(Id, Version) { + this.Id = Id; + this.Version = Version; + } + return PackageIdentity; +}()); +exports.PackageIdentity = PackageIdentity; /***/ }), @@ -2872,8 +2825,8 @@ exports.PackageIdentity = PackageIdentity; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2882,8 +2835,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2892,8 +2845,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -2902,63 +2855,63 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EnvironmentRepository = void 0; -var __1 = __nccwpck_require__(586); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var EnvironmentRepository = /** @class */ (function (_super) { - __extends(EnvironmentRepository, _super); - function EnvironmentRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/environments{/id}{?skip,take,ids,partialName}")) || this; - } - // getMetadata(environment: DeploymentEnvironment): Promise { - // return this.client.get('${spaceScopedRoutePrefix}/environments/{id}/metadata', { spaceId: environment.SpaceId, id: environment.Id }); - // } - EnvironmentRepository.prototype.sort = function (order) { - return this.client.doUpdate("".concat(__1.spaceScopedRoutePrefix, "/environments/sortorder"), order, { spaceName: this.spaceName }); - }; - EnvironmentRepository.prototype.summary = function (args) { - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/environments/summary{?ids,partialName,machinePartialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,hideEmptyEnvironments,shellNames,deploymentTargetTypes}"), __assign({ spaceName: this.spaceName }, args)); - }; - EnvironmentRepository.prototype.machines = function (environment, args) { - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/environments/{id}/machines{?skip,take,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,shellNames,deploymentTargetTypes}"), __assign({ spaceName: this.spaceName, id: environment.Id }, args)); - }; - EnvironmentRepository.prototype.variablesScopedOnlyToThisEnvironment = function (environment) { - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/environments/{id}/singlyScopedVariableDetails"), { - spaceName: this.spaceName, - id: environment.Id, - }); - }; - return EnvironmentRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.EnvironmentRepository = EnvironmentRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.EnvironmentRepository = void 0; +var __1 = __nccwpck_require__(586); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var EnvironmentRepository = /** @class */ (function (_super) { + __extends(EnvironmentRepository, _super); + function EnvironmentRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/environments"), "skip,take,ids,partialName") || this; + } + // getMetadata(environment: DeploymentEnvironment): Promise { + // return this.client.get('${spaceScopedRoutePrefix}/environments/{id}/metadata', { spaceId: environment.SpaceId, id: environment.Id }); + // } + EnvironmentRepository.prototype.sort = function (order) { + return this.client.doUpdate("".concat(this.baseApiPathTemplate, "/sortorder"), order, { spaceName: this.spaceName }); + }; + EnvironmentRepository.prototype.summary = function (args) { + return this.client.request("".concat(this.baseApiPathTemplate, "/summary{?ids,partialName,machinePartialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,hideEmptyEnvironments,shellNames,deploymentTargetTypes}"), __assign({ spaceName: this.spaceName }, args)); + }; + EnvironmentRepository.prototype.machines = function (environment, args) { + return this.client.request("".concat(this.baseApiPathTemplate, "/").concat(environment.Id, "/machines{?skip,take,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,shellNames,deploymentTargetTypes}"), __assign({ spaceName: this.spaceName }, args)); + }; + EnvironmentRepository.prototype.variablesScopedOnlyToThisEnvironment = function (environment) { + return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/environments/{id}/singlyScopedVariableDetails"), { + spaceName: this.spaceName, + id: environment.Id, + }); + }; + return EnvironmentRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.EnvironmentRepository = EnvironmentRepository; /***/ }), @@ -2967,24 +2920,24 @@ exports.EnvironmentRepository = EnvironmentRepository; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(2171), exports); -__exportStar(__nccwpck_require__(4520), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(2171), exports); +__exportStar(__nccwpck_require__(4520), exports); /***/ }), @@ -2993,8 +2946,8 @@ __exportStar(__nccwpck_require__(4520), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3003,8 +2956,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3013,8 +2966,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3023,8 +2976,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3033,45 +2986,45 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -/* eslint-disable @typescript-eslint/consistent-type-assertions */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getFeedTypeLabel = exports.isContainerImageRegistry = exports.containerRegistryFeedTypes = exports.isOctopusProjectFeed = exports.feedTypeSupportsExtraction = exports.feedTypeCanSearchEmpty = void 0; -var feedType_1 = __nccwpck_require__(2957); -var lodash_1 = __nccwpck_require__(250); -function feedTypeCanSearchEmpty(feed) { - return ![feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry, feedType_1.FeedType.Maven, feedType_1.FeedType.GitHub].includes(feed); -} -exports.feedTypeCanSearchEmpty = feedTypeCanSearchEmpty; -function feedTypeSupportsExtraction(feed) { - // Container images can not be extracted - return ![feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry].includes(feed); -} -exports.feedTypeSupportsExtraction = feedTypeSupportsExtraction; -function isOctopusProjectFeed(feed) { - return feed === "OctopusProject"; -} -exports.isOctopusProjectFeed = isOctopusProjectFeed; -function containerRegistryFeedTypes() { - return [feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry]; -} -exports.containerRegistryFeedTypes = containerRegistryFeedTypes; -function isContainerImageRegistry(feed) { - return containerRegistryFeedTypes().includes(feed); -} -exports.isContainerImageRegistry = isContainerImageRegistry; -var getFeedTypeLabel = function (feedType) { - var requiresContainerImageRegistryFeed = feedType && feedType.length >= 1 && (0, lodash_1.every)(feedType, function (f) { return isContainerImageRegistry(f); }); - var requiresHelmChartFeed = feedType && feedType.length === 1 && feedType[0] === feedType_1.FeedType.Helm; - if (requiresContainerImageRegistryFeed) { - return "Container Image Registry"; - } - if (requiresHelmChartFeed) { - return "Helm Chart Repository"; - } - return "Package"; -}; -exports.getFeedTypeLabel = getFeedTypeLabel; + +/* eslint-disable @typescript-eslint/consistent-type-assertions */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getFeedTypeLabel = exports.isContainerImageRegistry = exports.containerRegistryFeedTypes = exports.isOctopusProjectFeed = exports.feedTypeSupportsExtraction = exports.feedTypeCanSearchEmpty = void 0; +var feedType_1 = __nccwpck_require__(2957); +var lodash_1 = __nccwpck_require__(250); +function feedTypeCanSearchEmpty(feed) { + return ![feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry, feedType_1.FeedType.Maven, feedType_1.FeedType.GitHub].includes(feed); +} +exports.feedTypeCanSearchEmpty = feedTypeCanSearchEmpty; +function feedTypeSupportsExtraction(feed) { + // Container images can not be extracted + return ![feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry].includes(feed); +} +exports.feedTypeSupportsExtraction = feedTypeSupportsExtraction; +function isOctopusProjectFeed(feed) { + return feed === "OctopusProject"; +} +exports.isOctopusProjectFeed = isOctopusProjectFeed; +function containerRegistryFeedTypes() { + return [feedType_1.FeedType.Docker, feedType_1.FeedType.AwsElasticContainerRegistry]; +} +exports.containerRegistryFeedTypes = containerRegistryFeedTypes; +function isContainerImageRegistry(feed) { + return containerRegistryFeedTypes().includes(feed); +} +exports.isContainerImageRegistry = isContainerImageRegistry; +var getFeedTypeLabel = function (feedType) { + var requiresContainerImageRegistryFeed = feedType && feedType.length >= 1 && (0, lodash_1.every)(feedType, function (f) { return isContainerImageRegistry(f); }); + var requiresHelmChartFeed = feedType && feedType.length === 1 && feedType[0] === feedType_1.FeedType.Helm; + if (requiresContainerImageRegistryFeed) { + return "Container Image Registry"; + } + if (requiresHelmChartFeed) { + return "Helm Chart Repository"; + } + return "Package"; +}; +exports.getFeedTypeLabel = getFeedTypeLabel; /***/ }), @@ -3080,34 +3033,34 @@ exports.getFeedTypeLabel = getFeedTypeLabel; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.FeedRepository = void 0; -var __1 = __nccwpck_require__(586); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var FeedRepository = /** @class */ (function (_super) { - __extends(FeedRepository, _super); - function FeedRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/feeds{/id}{?skip,take,ids,partialName,feedType}")) || this; - } - return FeedRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.FeedRepository = FeedRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FeedRepository = void 0; +var __1 = __nccwpck_require__(586); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var FeedRepository = /** @class */ (function (_super) { + __extends(FeedRepository, _super); + function FeedRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/feeds"), "skip,take,ids,partialName,feedType") || this; + } + return FeedRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.FeedRepository = FeedRepository; /***/ }), @@ -3116,20 +3069,20 @@ exports.FeedRepository = FeedRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.FeedType = void 0; -var FeedType; -(function (FeedType) { - FeedType["AwsElasticContainerRegistry"] = "AwsElasticContainerRegistry"; - FeedType["BuiltIn"] = "BuiltIn"; - FeedType["Docker"] = "Docker"; - FeedType["GitHub"] = "GitHub"; - FeedType["Helm"] = "Helm"; - FeedType["Maven"] = "Maven"; - FeedType["Nuget"] = "NuGet"; - FeedType["OctopusProject"] = "OctopusProject"; -})(FeedType = exports.FeedType || (exports.FeedType = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FeedType = void 0; +var FeedType; +(function (FeedType) { + FeedType["AwsElasticContainerRegistry"] = "AwsElasticContainerRegistry"; + FeedType["BuiltIn"] = "BuiltIn"; + FeedType["Docker"] = "Docker"; + FeedType["GitHub"] = "GitHub"; + FeedType["Helm"] = "Helm"; + FeedType["Maven"] = "Maven"; + FeedType["Nuget"] = "NuGet"; + FeedType["OctopusProject"] = "OctopusProject"; +})(FeedType = exports.FeedType || (exports.FeedType = {})); /***/ }), @@ -3138,8 +3091,8 @@ var FeedType; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3148,8 +3101,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3158,34 +3111,34 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7587), exports); -__exportStar(__nccwpck_require__(283), exports); -__exportStar(__nccwpck_require__(996), exports); -__exportStar(__nccwpck_require__(6121), exports); -__exportStar(__nccwpck_require__(7423), exports); -__exportStar(__nccwpck_require__(2957), exports); -__exportStar(__nccwpck_require__(4023), exports); -__exportStar(__nccwpck_require__(6080), exports); -__exportStar(__nccwpck_require__(8150), exports); -__exportStar(__nccwpck_require__(5306), exports); -__exportStar(__nccwpck_require__(9759), exports); -__exportStar(__nccwpck_require__(6916), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7587), exports); +__exportStar(__nccwpck_require__(283), exports); +__exportStar(__nccwpck_require__(996), exports); +__exportStar(__nccwpck_require__(6121), exports); +__exportStar(__nccwpck_require__(7423), exports); +__exportStar(__nccwpck_require__(2957), exports); +__exportStar(__nccwpck_require__(4023), exports); +__exportStar(__nccwpck_require__(6080), exports); +__exportStar(__nccwpck_require__(8150), exports); +__exportStar(__nccwpck_require__(5306), exports); +__exportStar(__nccwpck_require__(9759), exports); +__exportStar(__nccwpck_require__(6916), exports); /***/ }), @@ -3194,8 +3147,8 @@ __exportStar(__nccwpck_require__(6916), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3204,8 +3157,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3214,8 +3167,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3224,8 +3177,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3234,25 +3187,25 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ControlType = void 0; -var ControlType; -(function (ControlType) { - ControlType["AmazonWebServicesAccount"] = "AmazonWebServicesAccount"; - ControlType["AzureAccount"] = "AzureAccount"; - ControlType["Certificate"] = "Certificate"; - ControlType["Checkbox"] = "Checkbox"; - ControlType["Custom"] = "Custom"; - ControlType["GoogleCloudAccount"] = "GoogleCloudAccount"; - ControlType["MultiLineText"] = "MultiLineText"; - ControlType["Package"] = "Package"; - ControlType["Select"] = "Select"; - ControlType["Sensitive"] = "Sensitive"; - ControlType["SingleLineText"] = "SingleLineText"; - ControlType["StepName"] = "StepName"; - ControlType["WorkerPool"] = "WorkerPool"; -})(ControlType = exports.ControlType || (exports.ControlType = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ControlType = void 0; +var ControlType; +(function (ControlType) { + ControlType["AmazonWebServicesAccount"] = "AmazonWebServicesAccount"; + ControlType["AzureAccount"] = "AzureAccount"; + ControlType["Certificate"] = "Certificate"; + ControlType["Checkbox"] = "Checkbox"; + ControlType["Custom"] = "Custom"; + ControlType["GoogleCloudAccount"] = "GoogleCloudAccount"; + ControlType["MultiLineText"] = "MultiLineText"; + ControlType["Package"] = "Package"; + ControlType["Select"] = "Select"; + ControlType["Sensitive"] = "Sensitive"; + ControlType["SingleLineText"] = "SingleLineText"; + ControlType["StepName"] = "StepName"; + ControlType["WorkerPool"] = "WorkerPool"; +})(ControlType = exports.ControlType || (exports.ControlType = {})); /***/ }), @@ -3261,22 +3214,22 @@ var ControlType; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ConnectivityCheckResponseMessageCategory = exports.PropertyApplicabilityMode = void 0; -var PropertyApplicabilityMode; -(function (PropertyApplicabilityMode) { - PropertyApplicabilityMode["ApplicableIfHasAnyValue"] = "ApplicableIfHasAnyValue"; - PropertyApplicabilityMode["ApplicableIfHasNoValue"] = "ApplicableIfHasNoValue"; - PropertyApplicabilityMode["ApplicableIfSpecificValue"] = "ApplicableIfSpecificValue"; - PropertyApplicabilityMode["ApplicableIfNotSpecificValue"] = "ApplicableIfNotSpecificValue"; -})(PropertyApplicabilityMode = exports.PropertyApplicabilityMode || (exports.PropertyApplicabilityMode = {})); -var ConnectivityCheckResponseMessageCategory; -(function (ConnectivityCheckResponseMessageCategory) { - ConnectivityCheckResponseMessageCategory["Info"] = "Info"; - ConnectivityCheckResponseMessageCategory["Warning"] = "Warning"; - ConnectivityCheckResponseMessageCategory["Error"] = "Error"; -})(ConnectivityCheckResponseMessageCategory = exports.ConnectivityCheckResponseMessageCategory || (exports.ConnectivityCheckResponseMessageCategory = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ConnectivityCheckResponseMessageCategory = exports.PropertyApplicabilityMode = void 0; +var PropertyApplicabilityMode; +(function (PropertyApplicabilityMode) { + PropertyApplicabilityMode["ApplicableIfHasAnyValue"] = "ApplicableIfHasAnyValue"; + PropertyApplicabilityMode["ApplicableIfHasNoValue"] = "ApplicableIfHasNoValue"; + PropertyApplicabilityMode["ApplicableIfSpecificValue"] = "ApplicableIfSpecificValue"; + PropertyApplicabilityMode["ApplicableIfNotSpecificValue"] = "ApplicableIfNotSpecificValue"; +})(PropertyApplicabilityMode = exports.PropertyApplicabilityMode || (exports.PropertyApplicabilityMode = {})); +var ConnectivityCheckResponseMessageCategory; +(function (ConnectivityCheckResponseMessageCategory) { + ConnectivityCheckResponseMessageCategory["Info"] = "Info"; + ConnectivityCheckResponseMessageCategory["Warning"] = "Warning"; + ConnectivityCheckResponseMessageCategory["Error"] = "Error"; +})(ConnectivityCheckResponseMessageCategory = exports.ConnectivityCheckResponseMessageCategory || (exports.ConnectivityCheckResponseMessageCategory = {})); /***/ }), @@ -3285,24 +3238,24 @@ var ConnectivityCheckResponseMessageCategory; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(1145), exports); -__exportStar(__nccwpck_require__(669), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(1145), exports); +__exportStar(__nccwpck_require__(669), exports); /***/ }), @@ -3311,42 +3264,42 @@ __exportStar(__nccwpck_require__(669), exports); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(8304), exports); -__exportStar(__nccwpck_require__(7206), exports); -__exportStar(__nccwpck_require__(599), exports); -__exportStar(__nccwpck_require__(4979), exports); -__exportStar(__nccwpck_require__(5207), exports); -__exportStar(__nccwpck_require__(1682), exports); -__exportStar(__nccwpck_require__(9659), exports); -__exportStar(__nccwpck_require__(6568), exports); -__exportStar(__nccwpck_require__(1163), exports); -__exportStar(__nccwpck_require__(9925), exports); -__exportStar(__nccwpck_require__(341), exports); -__exportStar(__nccwpck_require__(3217), exports); -__exportStar(__nccwpck_require__(621), exports); -__exportStar(__nccwpck_require__(2966), exports); -__exportStar(__nccwpck_require__(9296), exports); -__exportStar(__nccwpck_require__(8318), exports); -__exportStar(__nccwpck_require__(6459), exports); -__exportStar(__nccwpck_require__(7758), exports); -__exportStar(__nccwpck_require__(800), exports); -__exportStar(__nccwpck_require__(3496), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(8304), exports); +__exportStar(__nccwpck_require__(7206), exports); +__exportStar(__nccwpck_require__(599), exports); +__exportStar(__nccwpck_require__(4979), exports); +__exportStar(__nccwpck_require__(5207), exports); +__exportStar(__nccwpck_require__(1682), exports); +__exportStar(__nccwpck_require__(9659), exports); +__exportStar(__nccwpck_require__(6568), exports); +__exportStar(__nccwpck_require__(1163), exports); +__exportStar(__nccwpck_require__(9925), exports); +__exportStar(__nccwpck_require__(341), exports); +__exportStar(__nccwpck_require__(3217), exports); +__exportStar(__nccwpck_require__(621), exports); +__exportStar(__nccwpck_require__(2966), exports); +__exportStar(__nccwpck_require__(9296), exports); +__exportStar(__nccwpck_require__(8318), exports); +__exportStar(__nccwpck_require__(6459), exports); +__exportStar(__nccwpck_require__(7758), exports); +__exportStar(__nccwpck_require__(800), exports); +__exportStar(__nccwpck_require__(3496), exports); /***/ }), @@ -3355,26 +3308,26 @@ __exportStar(__nccwpck_require__(3496), exports); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(1703), exports); -__exportStar(__nccwpck_require__(6141), exports); -__exportStar(__nccwpck_require__(5101), exports); -__exportStar(__nccwpck_require__(9310), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(1703), exports); +__exportStar(__nccwpck_require__(6141), exports); +__exportStar(__nccwpck_require__(5101), exports); +__exportStar(__nccwpck_require__(9310), exports); /***/ }), @@ -3383,8 +3336,8 @@ __exportStar(__nccwpck_require__(9310), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3393,34 +3346,34 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.LifecycleRepository = void 0; -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var LifecycleRepository = /** @class */ (function (_super) { - __extends(LifecycleRepository, _super); - function LifecycleRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/lifecycles{/id}{?skip,take,ids,partialName}")) || this; - } - return LifecycleRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.LifecycleRepository = LifecycleRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LifecycleRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var LifecycleRepository = /** @class */ (function (_super) { + __extends(LifecycleRepository, _super); + function LifecycleRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/lifecycles"), "skip,take,ids,partialName") || this; + } + return LifecycleRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.LifecycleRepository = LifecycleRepository; /***/ }), @@ -3429,8 +3382,8 @@ exports.LifecycleRepository = LifecycleRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3439,14 +3392,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RetentionUnit = void 0; -var RetentionUnit; -(function (RetentionUnit) { - RetentionUnit["Days"] = "Days"; - RetentionUnit["Items"] = "Items"; -})(RetentionUnit = exports.RetentionUnit || (exports.RetentionUnit = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RetentionUnit = void 0; +var RetentionUnit; +(function (RetentionUnit) { + RetentionUnit["Days"] = "Days"; + RetentionUnit["Items"] = "Items"; +})(RetentionUnit = exports.RetentionUnit || (exports.RetentionUnit = {})); /***/ }), @@ -3455,15 +3408,15 @@ var RetentionUnit; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.OverwriteMode = void 0; -var OverwriteMode; -(function (OverwriteMode) { - OverwriteMode["FailIfExists"] = "FailIfExists"; - OverwriteMode["OverwriteExisting"] = "OverwriteExisting"; - OverwriteMode["IgnoreIfExists"] = "IgnoreIfExists"; -})(OverwriteMode = exports.OverwriteMode || (exports.OverwriteMode = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OverwriteMode = void 0; +var OverwriteMode; +(function (OverwriteMode) { + OverwriteMode["FailIfExists"] = "FailIfExists"; + OverwriteMode["OverwriteExisting"] = "OverwriteExisting"; + OverwriteMode["IgnoreIfExists"] = "IgnoreIfExists"; +})(OverwriteMode = exports.OverwriteMode || (exports.OverwriteMode = {})); /***/ }), @@ -3472,197 +3425,613 @@ var OverwriteMode; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(714), exports); -__exportStar(__nccwpck_require__(7857), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(3877), exports); +__exportStar(__nccwpck_require__(714), exports); +__exportStar(__nccwpck_require__(7857), exports); /***/ }), -/***/ 714: -/***/ ((__unused_webpack_module, exports) => { +/***/ 3877: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(8255), exports); +__exportStar(__nccwpck_require__(2778), exports); +__exportStar(__nccwpck_require__(3599), exports); /***/ }), -/***/ 7857: +/***/ 8255: +/***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NuGetPackageBuilder = void 0; +var zipUtils_1 = __nccwpck_require__(7273); +var fs_1 = __importDefault(__nccwpck_require__(7147)); +var os_1 = __importDefault(__nccwpck_require__(2037)); +var path_1 = __importDefault(__nccwpck_require__(1017)); +var NuGetPackageBuilder = /** @class */ (function () { + function NuGetPackageBuilder() { + } + NuGetPackageBuilder.prototype.pack = function (args) { + return __awaiter(this, void 0, void 0, function () { + var archiveFilename, tmpFolder, inputFilePatterns, nuspecFile; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + archiveFilename = "".concat(args.packageId, ".").concat(args.version, ".nupkg"); + tmpFolder = os_1.default.tmpdir(); + inputFilePatterns = args.inputFilePatterns; + if (args.nuspecArgs) { + nuspecFile = path_1.default.join(tmpFolder, "".concat(args.packageId, ".nuspec")); + fs_1.default.writeFileSync(nuspecFile, '\n'); + fs_1.default.appendFileSync(nuspecFile, '\n'); + fs_1.default.appendFileSync(nuspecFile, " \n"); + fs_1.default.appendFileSync(nuspecFile, " ".concat(args.packageId, "\n")); + fs_1.default.appendFileSync(nuspecFile, " ".concat(args.version, "\n")); + fs_1.default.appendFileSync(nuspecFile, " ".concat(args.nuspecArgs.description, "\n")); + fs_1.default.appendFileSync(nuspecFile, " ".concat(args.nuspecArgs.authors.join(","), "\n")); + if (args.nuspecArgs.releaseNotes) { + fs_1.default.appendFileSync(nuspecFile, " ".concat(args.nuspecArgs.releaseNotes, "\n")); + } + fs_1.default.appendFileSync(nuspecFile, " \n"); + fs_1.default.appendFileSync(nuspecFile, "\n"); + // include the nuspec into the package + inputFilePatterns.push(nuspecFile); + } + return [4 /*yield*/, (0, zipUtils_1.doZip)(inputFilePatterns, args.outputFolder, archiveFilename, args.logger, 8, args.overwrite)]; + case 1: + _a.sent(); + return [2 /*return*/, archiveFilename]; + } + }); + }); + }; + return NuGetPackageBuilder; +}()); +exports.NuGetPackageBuilder = NuGetPackageBuilder; + + +/***/ }), + +/***/ 2778: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); + + +/***/ }), + +/***/ 3599: +/***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ZipPackageBuilder = void 0; +var zipUtils_1 = __nccwpck_require__(7273); +var ZipPackageBuilder = /** @class */ (function () { + function ZipPackageBuilder() { + } + ZipPackageBuilder.prototype.pack = function (args) { + return __awaiter(this, void 0, void 0, function () { + var archiveFilename; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + archiveFilename = "".concat(args.packageId, ".").concat(args.version, ".zip"); + return [4 /*yield*/, (0, zipUtils_1.doZip)(args.inputFilePatterns, args.outputFolder, archiveFilename, args.logger, args.compressionLevel, args.overwrite)]; + case 1: + _a.sent(); + return [2 /*return*/, archiveFilename]; + } + }); + }); + }; + return ZipPackageBuilder; +}()); +exports.ZipPackageBuilder = ZipPackageBuilder; + + +/***/ }), + +/***/ 7273: +/***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; + } +}; +var __values = (this && this.__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."); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.doZip = void 0; +var adm_zip_1 = __importDefault(__nccwpck_require__(6761)); +var glob_1 = __nccwpck_require__(1957); +var path_1 = __importDefault(__nccwpck_require__(1017)); +var util_1 = __nccwpck_require__(3837); +var globp = (0, util_1.promisify)(glob_1.glob); +function doZip(inputFilePatterns, outputFolder, zipFilename, logger, compressionLevel, overwrite) { + var _a, _b, _c; + return __awaiter(this, void 0, void 0, function () { + var archivePath, zip, files, files_1, files_1_1, file; + var e_1, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + archivePath = path_1.default.resolve(outputFolder, zipFilename); + (_a = logger.info) === null || _a === void 0 ? void 0 : _a.call(logger, "Writing to package: ".concat(archivePath, "...")); + zip = new adm_zip_1.default(); + return [4 /*yield*/, expandGlobs(inputFilePatterns)]; + case 1: + files = _e.sent(); + try { + for (files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) { + file = files_1_1.value; + (_b = logger.debug) === null || _b === void 0 ? void 0 : _b.call(logger, "Adding file: ".concat(file, "...")); + zip.addLocalFile(file); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (files_1_1 && !files_1_1.done && (_d = files_1.return)) _d.call(files_1); + } + finally { if (e_1) throw e_1.error; } + } + if (compressionLevel) { + (_c = logger.info) === null || _c === void 0 ? void 0 : _c.call(logger, "Overriding compression level: ".concat(compressionLevel)); + } + setCompressionLevel(zip, compressionLevel || 8); + return [4 /*yield*/, zip.writeZipPromise(archivePath, { overwrite: overwrite })]; + case 2: + _e.sent(); + return [2 /*return*/]; + } + }); + }); +} +exports.doZip = doZip; +var setCompressionLevel = function (zip, level) { + var entries = zip.getEntries(); + for (var i = 0; i < entries.length; i++) { + var entry = entries[i]; + if (entry) { + entry.header.method = level; + } + } +}; +function expandGlobs(filePatterns) { + return __awaiter(this, void 0, void 0, function () { + var files, filePatterns_1, filePatterns_1_1, filePattern, _a, _b, fileName, filePaths, filePaths_1, filePaths_1_1, filePath, e_2_1, e_3_1; + var e_3, _c, e_2, _d, e_4, _e; + return __generator(this, function (_f) { + switch (_f.label) { + case 0: + files = []; + _f.label = 1; + case 1: + _f.trys.push([1, 13, 14, 15]); + filePatterns_1 = __values(filePatterns), filePatterns_1_1 = filePatterns_1.next(); + _f.label = 2; + case 2: + if (!!filePatterns_1_1.done) return [3 /*break*/, 12]; + filePattern = filePatterns_1_1.value; + _f.label = 3; + case 3: + _f.trys.push([3, 9, 10, 11]); + _a = (e_2 = void 0, __values(filePattern.split(","))), _b = _a.next(); + _f.label = 4; + case 4: + if (!!_b.done) return [3 /*break*/, 8]; + fileName = _b.value; + if (!glob_1.glob.hasMagic(fileName)) return [3 /*break*/, 6]; + return [4 /*yield*/, globp(fileName)]; + case 5: + filePaths = _f.sent(); + try { + for (filePaths_1 = (e_4 = void 0, __values(filePaths)), filePaths_1_1 = filePaths_1.next(); !filePaths_1_1.done; filePaths_1_1 = filePaths_1.next()) { + filePath = filePaths_1_1.value; + files.push(filePath); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (filePaths_1_1 && !filePaths_1_1.done && (_e = filePaths_1.return)) _e.call(filePaths_1); + } + finally { if (e_4) throw e_4.error; } + } + return [3 /*break*/, 7]; + case 6: + files.push(fileName); + _f.label = 7; + case 7: + _b = _a.next(); + return [3 /*break*/, 4]; + case 8: return [3 /*break*/, 11]; + case 9: + e_2_1 = _f.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 11]; + case 10: + try { + if (_b && !_b.done && (_d = _a.return)) _d.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 11: + filePatterns_1_1 = filePatterns_1.next(); + return [3 /*break*/, 2]; + case 12: return [3 /*break*/, 15]; + case 13: + e_3_1 = _f.sent(); + e_3 = { error: e_3_1 }; + return [3 /*break*/, 15]; + case 14: + try { + if (filePatterns_1_1 && !filePatterns_1_1.done && (_c = filePatterns_1.return)) _c.call(filePatterns_1); + } + finally { if (e_3) throw e_3.error; } + return [7 /*endfinally*/]; + case 15: return [2 /*return*/, files]; + } + }); + }); +} + + +/***/ }), + +/***/ 714: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); + + +/***/ }), + +/***/ 7857: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PackageRepository = void 0; -var fs_1 = __nccwpck_require__(7147); -var path_1 = __importDefault(__nccwpck_require__(1017)); -var form_data_1 = __importDefault(__nccwpck_require__(4334)); -var overwriteMode_1 = __nccwpck_require__(7758); -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -var spaceResolver_1 = __nccwpck_require__(2054); -var PackageRepository = /** @class */ (function () { - function PackageRepository(client, spaceName) { - this.client = client; - this.spaceName = spaceName; - } - PackageRepository.prototype.get = function (packageId) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!packageId) { - throw new Error("Package Id was not provided"); - } - return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages{/packageId}"), { - spaceName: this.spaceName, - packageId: packageId, - })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - PackageRepository.prototype.list = function (args) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages{/id}{?nuGetPackageId,filter,latest,skip,take,includeNotes}"), __assign({ spaceName: this.spaceName }, args))]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - PackageRepository.prototype.push = function (packages, overwriteMode) { - if (overwriteMode === void 0) { overwriteMode = overwriteMode_1.OverwriteMode.FailIfExists; } - return __awaiter(this, void 0, void 0, function () { - var spaceId, tasks, _i, packages_1, packagePath; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this.client, this.spaceName)]; - case 1: - spaceId = _a.sent(); - tasks = []; - for (_i = 0, packages_1 = packages; _i < packages_1.length; _i++) { - packagePath = packages_1[_i]; - tasks.push(this.packageUpload(spaceId, packagePath, overwriteMode)); - } - return [4 /*yield*/, Promise.all(tasks)]; - case 2: - _a.sent(); - this.client.info("Packages uploaded"); - return [2 /*return*/]; - } - }); - }); - }; - PackageRepository.prototype.packageUpload = function (spaceId, filePath, overwriteMode) { - return __awaiter(this, void 0, void 0, function () { - var fileName; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - fileName = path_1.default.basename(filePath); - this.client.info("Uploading package, ".concat(fileName, "...")); - return [4 /*yield*/, this.upload(spaceId, filePath, fileName, overwriteMode)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - PackageRepository.prototype.upload = function (spaceId, filePath, fileName, overwriteMode) { - return __awaiter(this, void 0, void 0, function () { - var fd, data; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - fd = new form_data_1.default(); - return [4 /*yield*/, fs_1.promises.readFile(filePath)]; - case 1: - data = _a.sent(); - fd.append("fileToUpload", data, fileName); - return [2 /*return*/, this.client.post("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages/raw{?overwriteMode}"), fd, { overwriteMode: overwriteMode, spaceId: spaceId })]; - } - }); - }); - }; - return PackageRepository; -}()); -exports.PackageRepository = PackageRepository; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +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 __generator = (this && this.__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 }; + } +}; +var __values = (this && this.__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."); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PackageRepository = void 0; +var fs_1 = __nccwpck_require__(7147); +var path_1 = __importDefault(__nccwpck_require__(1017)); +var form_data_1 = __importDefault(__nccwpck_require__(4334)); +var overwriteMode_1 = __nccwpck_require__(7758); +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var spaceResolver_1 = __nccwpck_require__(2054); +var PackageRepository = /** @class */ (function () { + function PackageRepository(client, spaceName) { + this.client = client; + this.spaceName = spaceName; + } + PackageRepository.prototype.get = function (packageId) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!packageId) { + throw new Error("Package Id was not provided"); + } + return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages{/packageId}"), { + spaceName: this.spaceName, + packageId: packageId, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + PackageRepository.prototype.list = function (args) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages{/id}{?nuGetPackageId,filter,latest,skip,take,includeNotes}"), __assign({ spaceName: this.spaceName }, args))]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + PackageRepository.prototype.push = function (packages, overwriteMode) { + if (overwriteMode === void 0) { overwriteMode = overwriteMode_1.OverwriteMode.FailIfExists; } + return __awaiter(this, void 0, void 0, function () { + var spaceId, tasks, packages_1, packages_1_1, packagePath; + var e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: return [4 /*yield*/, (0, spaceResolver_1.resolveSpaceId)(this.client, this.spaceName)]; + case 1: + spaceId = _b.sent(); + tasks = []; + try { + for (packages_1 = __values(packages), packages_1_1 = packages_1.next(); !packages_1_1.done; packages_1_1 = packages_1.next()) { + packagePath = packages_1_1.value; + tasks.push(this.packageUpload(spaceId, packagePath, overwriteMode)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (packages_1_1 && !packages_1_1.done && (_a = packages_1.return)) _a.call(packages_1); + } + finally { if (e_1) throw e_1.error; } + } + return [4 /*yield*/, Promise.allSettled(tasks)]; + case 2: + _b.sent(); + this.client.info("Packages uploaded"); + return [2 /*return*/]; + } + }); + }); + }; + PackageRepository.prototype.packageUpload = function (spaceId, filePath, overwriteMode) { + return __awaiter(this, void 0, void 0, function () { + var fileName; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + fileName = path_1.default.basename(filePath); + this.client.info("Uploading package, ".concat(fileName, "...")); + return [4 /*yield*/, this.upload(spaceId, filePath, fileName, overwriteMode)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + PackageRepository.prototype.upload = function (spaceId, filePath, fileName, overwriteMode) { + return __awaiter(this, void 0, void 0, function () { + var fd, data; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + fd = new form_data_1.default(); + return [4 /*yield*/, fs_1.promises.readFile(filePath)]; + case 1: + data = _a.sent(); + fd.append("fileToUpload", data, fileName); + return [2 /*return*/, this.client.post("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/packages/raw{?overwriteMode}"), fd, { overwriteMode: overwriteMode, spaceId: spaceId })]; + } + }); + }); + }; + return PackageRepository; +}()); +exports.PackageRepository = PackageRepository; /***/ }), @@ -3671,130 +4040,130 @@ exports.PackageRepository = PackageRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Permission = void 0; -//Enums can't be keys in a dictionary so we might need to convert this to a list of static strings -var Permission; -(function (Permission) { - Permission["None"] = "None"; - Permission["AccountCreate"] = "AccountCreate"; - Permission["AccountDelete"] = "AccountDelete"; - Permission["AccountEdit"] = "AccountEdit"; - Permission["AccountView"] = "AccountView"; - Permission["ActionTemplateCreate"] = "ActionTemplateCreate"; - Permission["ActionTemplateDelete"] = "ActionTemplateDelete"; - Permission["ActionTemplateEdit"] = "ActionTemplateEdit"; - Permission["ActionTemplateView"] = "ActionTemplateView"; - Permission["AdministerSystem"] = "AdministerSystem"; - Permission["ArtifactCreate"] = "ArtifactCreate"; - Permission["ArtifactDelete"] = "ArtifactDelete"; - Permission["ArtifactEdit"] = "ArtifactEdit"; - Permission["ArtifactView"] = "ArtifactView"; - Permission["BuildInformationAdminister"] = "BuildInformationAdminister"; - Permission["BuildInformationPush"] = "BuildInformationPush"; - Permission["BuiltInFeedAdminister"] = "BuiltInFeedAdminister"; - Permission["BuiltInFeedDownload"] = "BuiltInFeedDownload"; - Permission["BuiltInFeedPush"] = "BuiltInFeedPush"; - Permission["CertificateCreate"] = "CertificateCreate"; - Permission["CertificateDelete"] = "CertificateDelete"; - Permission["CertificateEdit"] = "CertificateEdit"; - Permission["CertificateView"] = "CertificateView"; - Permission["CertificateExportPrivateKey"] = "CertificateExportPrivateKey"; - Permission["ConfigureServer"] = "ConfigureServer"; - Permission["DefectReport"] = "DefectReport"; - Permission["DefectResolve"] = "DefectResolve"; - Permission["DeploymentCreate"] = "DeploymentCreate"; - Permission["DeploymentDelete"] = "DeploymentDelete"; - Permission["DeploymentView"] = "DeploymentView"; - Permission["EnvironmentCreate"] = "EnvironmentCreate"; - Permission["EnvironmentDelete"] = "EnvironmentDelete"; - Permission["EnvironmentEdit"] = "EnvironmentEdit"; - Permission["EnvironmentView"] = "EnvironmentView"; - Permission["EventView"] = "EventView"; - Permission["FeedEdit"] = "FeedEdit"; - Permission["FeedView"] = "FeedView"; - Permission["InterruptionSubmit"] = "InterruptionSubmit"; - Permission["InterruptionView"] = "InterruptionView"; - Permission["InterruptionViewSubmitResponsible"] = "InterruptionViewSubmitResponsible"; - Permission["LibraryVariableSetCreate"] = "LibraryVariableSetCreate"; - Permission["LibraryVariableSetDelete"] = "LibraryVariableSetDelete"; - Permission["LibraryVariableSetEdit"] = "LibraryVariableSetEdit"; - Permission["LibraryVariableSetView"] = "LibraryVariableSetView"; - Permission["LifecycleCreate"] = "LifecycleCreate"; - Permission["LifecycleDelete"] = "LifecycleDelete"; - Permission["LifecycleEdit"] = "LifecycleEdit"; - Permission["LifecycleView"] = "LifecycleView"; - Permission["ReleaseCreate"] = "ReleaseCreate"; - Permission["ReleaseView"] = "ReleaseView"; - Permission["ReleaseEdit"] = "ReleaseEdit"; - Permission["ReleaseDelete"] = "ReleaseDelete"; - Permission["MachineCreate"] = "MachineCreate"; - Permission["MachineEdit"] = "MachineEdit"; - Permission["MachineView"] = "MachineView"; - Permission["MachineDelete"] = "MachineDelete"; - Permission["MachinePolicyCreate"] = "MachinePolicyCreate"; - Permission["MachinePolicyDelete"] = "MachinePolicyDelete"; - Permission["MachinePolicyEdit"] = "MachinePolicyEdit"; - Permission["MachinePolicyView"] = "MachinePolicyView"; - Permission["ProjectGroupCreate"] = "ProjectGroupCreate"; - Permission["ProjectGroupDelete"] = "ProjectGroupDelete"; - Permission["ProjectGroupEdit"] = "ProjectGroupEdit"; - Permission["ProjectGroupView"] = "ProjectGroupView"; - Permission["TenantCreate"] = "TenantCreate"; - Permission["TenantDelete"] = "TenantDelete"; - Permission["TenantEdit"] = "TenantEdit"; - Permission["TenantView"] = "TenantView"; - Permission["TagSetCreate"] = "TagSetCreate"; - Permission["TagSetDelete"] = "TagSetDelete"; - Permission["TagSetEdit"] = "TagSetEdit"; - Permission["ProcessEdit"] = "ProcessEdit"; - Permission["ProcessView"] = "ProcessView"; - Permission["ProjectCreate"] = "ProjectCreate"; - Permission["ProjectDelete"] = "ProjectDelete"; - Permission["ProjectEdit"] = "ProjectEdit"; - Permission["ProjectView"] = "ProjectView"; - Permission["ProxyCreate"] = "ProxyCreate"; - Permission["ProxyDelete"] = "ProxyDelete"; - Permission["ProxyEdit"] = "ProxyEdit"; - Permission["ProxyView"] = "ProxyView"; - Permission["RunbookEdit"] = "RunbookEdit"; - Permission["RunbookView"] = "RunbookView"; - Permission["RunbookRunCreate"] = "RunbookRunCreate"; - Permission["RunbookRunEdit"] = "RunbookRunEdit"; - Permission["RunbookRunView"] = "RunbookRunView"; - Permission["SpaceCreate"] = "SpaceCreate"; - Permission["SpaceDelete"] = "SpaceDelete"; - Permission["SpaceEdit"] = "SpaceEdit"; - Permission["SpaceView"] = "SpaceView"; - Permission["SubscriptionCreate"] = "SubscriptionCreate"; - Permission["SubscriptionDelete"] = "SubscriptionDelete"; - Permission["SubscriptionEdit"] = "SubscriptionEdit"; - Permission["SubscriptionView"] = "SubscriptionView"; - Permission["TaskCancel"] = "TaskCancel"; - Permission["TaskCreate"] = "TaskCreate"; - Permission["TaskEdit"] = "TaskEdit"; - Permission["TaskView"] = "TaskView"; - Permission["TeamCreate"] = "TeamCreate"; - Permission["TeamDelete"] = "TeamDelete"; - Permission["TeamEdit"] = "TeamEdit"; - Permission["TeamView"] = "TeamView"; - Permission["TriggerCreate"] = "TriggerCreate"; - Permission["TriggerDelete"] = "TriggerDelete"; - Permission["TriggerEdit"] = "TriggerEdit"; - Permission["TriggerView"] = "TriggerView"; - Permission["UserEdit"] = "UserEdit"; - Permission["UserInvite"] = "UserInvite"; - Permission["UserView"] = "UserView"; - Permission["UserRoleEdit"] = "UserRoleEdit"; - Permission["UserRoleView"] = "UserRoleView"; - Permission["VariableEdit"] = "VariableEdit"; - Permission["VariableEditUnscoped"] = "VariableEditUnscoped"; - Permission["VariableView"] = "VariableView"; - Permission["VariableViewUnscoped"] = "VariableViewUnscoped"; - Permission["WorkerEdit"] = "WorkerEdit"; - Permission["WorkerView"] = "WorkerView"; -})(Permission = exports.Permission || (exports.Permission = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Permission = void 0; +//Enums can't be keys in a dictionary so we might need to convert this to a list of static strings +var Permission; +(function (Permission) { + Permission["None"] = "None"; + Permission["AccountCreate"] = "AccountCreate"; + Permission["AccountDelete"] = "AccountDelete"; + Permission["AccountEdit"] = "AccountEdit"; + Permission["AccountView"] = "AccountView"; + Permission["ActionTemplateCreate"] = "ActionTemplateCreate"; + Permission["ActionTemplateDelete"] = "ActionTemplateDelete"; + Permission["ActionTemplateEdit"] = "ActionTemplateEdit"; + Permission["ActionTemplateView"] = "ActionTemplateView"; + Permission["AdministerSystem"] = "AdministerSystem"; + Permission["ArtifactCreate"] = "ArtifactCreate"; + Permission["ArtifactDelete"] = "ArtifactDelete"; + Permission["ArtifactEdit"] = "ArtifactEdit"; + Permission["ArtifactView"] = "ArtifactView"; + Permission["BuildInformationAdminister"] = "BuildInformationAdminister"; + Permission["BuildInformationPush"] = "BuildInformationPush"; + Permission["BuiltInFeedAdminister"] = "BuiltInFeedAdminister"; + Permission["BuiltInFeedDownload"] = "BuiltInFeedDownload"; + Permission["BuiltInFeedPush"] = "BuiltInFeedPush"; + Permission["CertificateCreate"] = "CertificateCreate"; + Permission["CertificateDelete"] = "CertificateDelete"; + Permission["CertificateEdit"] = "CertificateEdit"; + Permission["CertificateView"] = "CertificateView"; + Permission["CertificateExportPrivateKey"] = "CertificateExportPrivateKey"; + Permission["ConfigureServer"] = "ConfigureServer"; + Permission["DefectReport"] = "DefectReport"; + Permission["DefectResolve"] = "DefectResolve"; + Permission["DeploymentCreate"] = "DeploymentCreate"; + Permission["DeploymentDelete"] = "DeploymentDelete"; + Permission["DeploymentView"] = "DeploymentView"; + Permission["EnvironmentCreate"] = "EnvironmentCreate"; + Permission["EnvironmentDelete"] = "EnvironmentDelete"; + Permission["EnvironmentEdit"] = "EnvironmentEdit"; + Permission["EnvironmentView"] = "EnvironmentView"; + Permission["EventView"] = "EventView"; + Permission["FeedEdit"] = "FeedEdit"; + Permission["FeedView"] = "FeedView"; + Permission["InterruptionSubmit"] = "InterruptionSubmit"; + Permission["InterruptionView"] = "InterruptionView"; + Permission["InterruptionViewSubmitResponsible"] = "InterruptionViewSubmitResponsible"; + Permission["LibraryVariableSetCreate"] = "LibraryVariableSetCreate"; + Permission["LibraryVariableSetDelete"] = "LibraryVariableSetDelete"; + Permission["LibraryVariableSetEdit"] = "LibraryVariableSetEdit"; + Permission["LibraryVariableSetView"] = "LibraryVariableSetView"; + Permission["LifecycleCreate"] = "LifecycleCreate"; + Permission["LifecycleDelete"] = "LifecycleDelete"; + Permission["LifecycleEdit"] = "LifecycleEdit"; + Permission["LifecycleView"] = "LifecycleView"; + Permission["ReleaseCreate"] = "ReleaseCreate"; + Permission["ReleaseView"] = "ReleaseView"; + Permission["ReleaseEdit"] = "ReleaseEdit"; + Permission["ReleaseDelete"] = "ReleaseDelete"; + Permission["MachineCreate"] = "MachineCreate"; + Permission["MachineEdit"] = "MachineEdit"; + Permission["MachineView"] = "MachineView"; + Permission["MachineDelete"] = "MachineDelete"; + Permission["MachinePolicyCreate"] = "MachinePolicyCreate"; + Permission["MachinePolicyDelete"] = "MachinePolicyDelete"; + Permission["MachinePolicyEdit"] = "MachinePolicyEdit"; + Permission["MachinePolicyView"] = "MachinePolicyView"; + Permission["ProjectGroupCreate"] = "ProjectGroupCreate"; + Permission["ProjectGroupDelete"] = "ProjectGroupDelete"; + Permission["ProjectGroupEdit"] = "ProjectGroupEdit"; + Permission["ProjectGroupView"] = "ProjectGroupView"; + Permission["TenantCreate"] = "TenantCreate"; + Permission["TenantDelete"] = "TenantDelete"; + Permission["TenantEdit"] = "TenantEdit"; + Permission["TenantView"] = "TenantView"; + Permission["TagSetCreate"] = "TagSetCreate"; + Permission["TagSetDelete"] = "TagSetDelete"; + Permission["TagSetEdit"] = "TagSetEdit"; + Permission["ProcessEdit"] = "ProcessEdit"; + Permission["ProcessView"] = "ProcessView"; + Permission["ProjectCreate"] = "ProjectCreate"; + Permission["ProjectDelete"] = "ProjectDelete"; + Permission["ProjectEdit"] = "ProjectEdit"; + Permission["ProjectView"] = "ProjectView"; + Permission["ProxyCreate"] = "ProxyCreate"; + Permission["ProxyDelete"] = "ProxyDelete"; + Permission["ProxyEdit"] = "ProxyEdit"; + Permission["ProxyView"] = "ProxyView"; + Permission["RunbookEdit"] = "RunbookEdit"; + Permission["RunbookView"] = "RunbookView"; + Permission["RunbookRunCreate"] = "RunbookRunCreate"; + Permission["RunbookRunEdit"] = "RunbookRunEdit"; + Permission["RunbookRunView"] = "RunbookRunView"; + Permission["SpaceCreate"] = "SpaceCreate"; + Permission["SpaceDelete"] = "SpaceDelete"; + Permission["SpaceEdit"] = "SpaceEdit"; + Permission["SpaceView"] = "SpaceView"; + Permission["SubscriptionCreate"] = "SubscriptionCreate"; + Permission["SubscriptionDelete"] = "SubscriptionDelete"; + Permission["SubscriptionEdit"] = "SubscriptionEdit"; + Permission["SubscriptionView"] = "SubscriptionView"; + Permission["TaskCancel"] = "TaskCancel"; + Permission["TaskCreate"] = "TaskCreate"; + Permission["TaskEdit"] = "TaskEdit"; + Permission["TaskView"] = "TaskView"; + Permission["TeamCreate"] = "TeamCreate"; + Permission["TeamDelete"] = "TeamDelete"; + Permission["TeamEdit"] = "TeamEdit"; + Permission["TeamView"] = "TeamView"; + Permission["TriggerCreate"] = "TriggerCreate"; + Permission["TriggerDelete"] = "TriggerDelete"; + Permission["TriggerEdit"] = "TriggerEdit"; + Permission["TriggerView"] = "TriggerView"; + Permission["UserEdit"] = "UserEdit"; + Permission["UserInvite"] = "UserInvite"; + Permission["UserView"] = "UserView"; + Permission["UserRoleEdit"] = "UserRoleEdit"; + Permission["UserRoleView"] = "UserRoleView"; + Permission["VariableEdit"] = "VariableEdit"; + Permission["VariableEditUnscoped"] = "VariableEditUnscoped"; + Permission["VariableView"] = "VariableView"; + Permission["VariableViewUnscoped"] = "VariableViewUnscoped"; + Permission["WorkerEdit"] = "WorkerEdit"; + Permission["WorkerView"] = "WorkerView"; +})(Permission = exports.Permission || (exports.Permission = {})); /***/ }), @@ -3803,24 +4172,24 @@ var Permission; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(4182), exports); -__exportStar(__nccwpck_require__(2930), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(4182), exports); +__exportStar(__nccwpck_require__(2930), exports); /***/ }), @@ -3829,8 +4198,8 @@ __exportStar(__nccwpck_require__(2930), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3839,34 +4208,34 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ProjectGroupRepository = void 0; -var __1 = __nccwpck_require__(586); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var ProjectGroupRepository = /** @class */ (function (_super) { - __extends(ProjectGroupRepository, _super); - function ProjectGroupRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/projectgroups{/id}{?skip,take,ids,partialName}")) || this; - } - return ProjectGroupRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.ProjectGroupRepository = ProjectGroupRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ProjectGroupRepository = void 0; +var __1 = __nccwpck_require__(586); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var ProjectGroupRepository = /** @class */ (function (_super) { + __extends(ProjectGroupRepository, _super); + function ProjectGroupRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/projectgroups"), "skip,take,ids,partialName") || this; + } + return ProjectGroupRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.ProjectGroupRepository = ProjectGroupRepository; /***/ }), @@ -3875,8 +4244,8 @@ exports.ProjectGroupRepository = ProjectGroupRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3885,8 +4254,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3895,8 +4264,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3905,8 +4274,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3915,8 +4284,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -3925,142 +4294,158 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.InitialisePrimaryPackageReference = exports.SetPrimaryPackageReference = exports.SetNamedPackageReference = exports.GetNamedPackageReferences = exports.IsNamedPackageReference = exports.GetPrimaryPackageReference = exports.HasManualInterventionResponsibleTeams = exports.PackageReferenceNamesMatch = exports.RemovePrimaryPackageReference = exports.IsPrimaryPackageReference = exports.IsDeployReleaseAction = void 0; -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -var _ = __importStar(__nccwpck_require__(250)); -var feeds_1 = __nccwpck_require__(4962); -var packageAcquisitionLocation_1 = __nccwpck_require__(7266); -var packageReference_1 = __nccwpck_require__(7708); -function parseCSV(val) { - if (!val || val === "") { - return []; - } - return val.split(","); -} -function IsDeployReleaseAction(action) { - return !!action.Properties["Octopus.Action.DeployRelease.ProjectId"]; -} -exports.IsDeployReleaseAction = IsDeployReleaseAction; -function IsPrimaryPackageReference(pkg) { - return !pkg.Name; -} -exports.IsPrimaryPackageReference = IsPrimaryPackageReference; -function RemovePrimaryPackageReference(packages) { - return _.filter(packages, function (pkg) { return !IsPrimaryPackageReference(pkg); }); -} -exports.RemovePrimaryPackageReference = RemovePrimaryPackageReference; -// Returns true if the names match, where null and empty string are equivalent -function PackageReferenceNamesMatch(nameA, nameB) { - if (!nameA) { - return !nameB; - } - return nameA === nameB; -} -exports.PackageReferenceNamesMatch = PackageReferenceNamesMatch; -function HasManualInterventionResponsibleTeams(action) { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return _.some(parseCSV(action.Properties["Octopus.Action.Manual.ResponsibleTeamIds"])); -} -exports.HasManualInterventionResponsibleTeams = HasManualInterventionResponsibleTeams; -function GetPrimaryPackageReference(packages) { - return packages === null || packages === void 0 ? void 0 : packages.find(function (pkg) { return IsPrimaryPackageReference(pkg); }); -} -exports.GetPrimaryPackageReference = GetPrimaryPackageReference; -function IsNamedPackageReference(pkg) { - return !!pkg.Name; -} -exports.IsNamedPackageReference = IsNamedPackageReference; -function GetNamedPackageReferences(packages) { - return RemovePrimaryPackageReference(packages); -} -exports.GetNamedPackageReferences = GetNamedPackageReferences; -function SetNamedPackageReference(name, updated, packages) { - return _.map(packages, function (pkg) { - if (!PackageReferenceNamesMatch(name, pkg.Name)) { - return pkg; - } - return __assign(__assign({}, pkg), updated); - }); -} -exports.SetNamedPackageReference = SetNamedPackageReference; -function SetPrimaryPackageReference(updated, packages) { - return _.map(packages, function (pkg) { - if (!IsPrimaryPackageReference(pkg)) { - return pkg; - } - return __assign(__assign({}, pkg), updated); - }); -} -exports.SetPrimaryPackageReference = SetPrimaryPackageReference; -function InitialisePrimaryPackageReference(packages, feeds, itemsKeyedBy) { - var primaryPackage = GetPrimaryPackageReference(packages); - if (primaryPackage) { - if (!primaryPackage.Properties.SelectionMode) { - primaryPackage.Properties.SelectionMode = packageReference_1.PackageSelectionMode.Immediate; - } - return __spreadArray([], packages, true); - } - var packagesWithoutDefault = RemovePrimaryPackageReference(packages); - var builtInFeed = feeds.find(function (f) { return f.FeedType === feeds_1.FeedType.BuiltIn; }); - var builtInFeedIdOrName = builtInFeed && builtInFeed[itemsKeyedBy]; - return __spreadArray([ - { - Id: null, - PackageId: null, - FeedId: builtInFeedIdOrName, - AcquisitionLocation: packageAcquisitionLocation_1.PackageAcquisitionLocation.Server, - Properties: { - SelectionMode: packageReference_1.PackageSelectionMode.Immediate, - }, - } - ], packagesWithoutDefault, true); -} -exports.InitialisePrimaryPackageReference = InitialisePrimaryPackageReference; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __read = (this && this.__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; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InitialisePrimaryPackageReference = exports.SetPrimaryPackageReference = exports.SetNamedPackageReference = exports.GetNamedPackageReferences = exports.IsNamedPackageReference = exports.GetPrimaryPackageReference = exports.HasManualInterventionResponsibleTeams = exports.PackageReferenceNamesMatch = exports.RemovePrimaryPackageReference = exports.IsPrimaryPackageReference = exports.IsDeployReleaseAction = void 0; +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +var _ = __importStar(__nccwpck_require__(250)); +var feeds_1 = __nccwpck_require__(4962); +var packageAcquisitionLocation_1 = __nccwpck_require__(7266); +var packageReference_1 = __nccwpck_require__(7708); +function parseCSV(val) { + if (!val || val === "") { + return []; + } + return val.split(","); +} +function IsDeployReleaseAction(action) { + return !!action.Properties["Octopus.Action.DeployRelease.ProjectId"]; +} +exports.IsDeployReleaseAction = IsDeployReleaseAction; +function IsPrimaryPackageReference(pkg) { + return !pkg.Name; +} +exports.IsPrimaryPackageReference = IsPrimaryPackageReference; +function RemovePrimaryPackageReference(packages) { + return _.filter(packages, function (pkg) { return !IsPrimaryPackageReference(pkg); }); +} +exports.RemovePrimaryPackageReference = RemovePrimaryPackageReference; +// Returns true if the names match, where null and empty string are equivalent +function PackageReferenceNamesMatch(nameA, nameB) { + if (!nameA) { + return !nameB; + } + return nameA === nameB; +} +exports.PackageReferenceNamesMatch = PackageReferenceNamesMatch; +function HasManualInterventionResponsibleTeams(action) { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return _.some(parseCSV(action.Properties["Octopus.Action.Manual.ResponsibleTeamIds"])); +} +exports.HasManualInterventionResponsibleTeams = HasManualInterventionResponsibleTeams; +function GetPrimaryPackageReference(packages) { + return packages === null || packages === void 0 ? void 0 : packages.find(function (pkg) { return IsPrimaryPackageReference(pkg); }); +} +exports.GetPrimaryPackageReference = GetPrimaryPackageReference; +function IsNamedPackageReference(pkg) { + return !!pkg.Name; +} +exports.IsNamedPackageReference = IsNamedPackageReference; +function GetNamedPackageReferences(packages) { + return RemovePrimaryPackageReference(packages); +} +exports.GetNamedPackageReferences = GetNamedPackageReferences; +function SetNamedPackageReference(name, updated, packages) { + return _.map(packages, function (pkg) { + if (!PackageReferenceNamesMatch(name, pkg.Name)) { + return pkg; + } + return __assign(__assign({}, pkg), updated); + }); +} +exports.SetNamedPackageReference = SetNamedPackageReference; +function SetPrimaryPackageReference(updated, packages) { + return _.map(packages, function (pkg) { + if (!IsPrimaryPackageReference(pkg)) { + return pkg; + } + return __assign(__assign({}, pkg), updated); + }); +} +exports.SetPrimaryPackageReference = SetPrimaryPackageReference; +function InitialisePrimaryPackageReference(packages, feeds, itemsKeyedBy) { + var primaryPackage = GetPrimaryPackageReference(packages); + if (primaryPackage) { + if (!primaryPackage.Properties.SelectionMode) { + primaryPackage.Properties.SelectionMode = packageReference_1.PackageSelectionMode.Immediate; + } + return __spreadArray([], __read(packages), false); + } + var packagesWithoutDefault = RemovePrimaryPackageReference(packages); + var builtInFeed = feeds.find(function (f) { return f.FeedType === feeds_1.FeedType.BuiltIn; }); + var builtInFeedIdOrName = builtInFeed && builtInFeed[itemsKeyedBy]; + return __spreadArray([ + { + Id: null, + PackageId: null, + FeedId: builtInFeedIdOrName, + AcquisitionLocation: packageAcquisitionLocation_1.PackageAcquisitionLocation.Server, + Properties: { + SelectionMode: packageReference_1.PackageSelectionMode.Immediate, + }, + } + ], __read(packagesWithoutDefault), false); +} +exports.InitialisePrimaryPackageReference = InitialisePrimaryPackageReference; /***/ }), @@ -4069,8 +4454,8 @@ exports.InitialisePrimaryPackageReference = InitialisePrimaryPackageReference; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4079,49 +4464,49 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.deploymentActionPackages = exports.displayName = void 0; -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -var _ = __importStar(__nccwpck_require__(250)); -function displayName(pkg) { - return !!pkg.PackageReference ? "".concat(pkg.DeploymentAction, "/").concat(pkg.PackageReference) : pkg.DeploymentAction; -} -exports.displayName = displayName; -function deploymentActionPackages(actions) { - return _.chain(actions) - .flatMap(function (action) { - return _.map(action.Packages, function (pkg) { return ({ - DeploymentAction: action.Name, - PackageReference: pkg.Name, - }); }); - }) - .value(); -} -exports.deploymentActionPackages = deploymentActionPackages; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.deploymentActionPackages = exports.displayName = void 0; +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +var _ = __importStar(__nccwpck_require__(250)); +function displayName(pkg) { + return !!pkg.PackageReference ? "".concat(pkg.DeploymentAction, "/").concat(pkg.PackageReference) : pkg.DeploymentAction; +} +exports.displayName = displayName; +function deploymentActionPackages(actions) { + return _.chain(actions) + .flatMap(function (action) { + return _.map(action.Packages, function (pkg) { return ({ + DeploymentAction: action.Name, + PackageReference: pkg.Name, + }); }); + }) + .value(); +} +exports.deploymentActionPackages = deploymentActionPackages; /***/ }), @@ -4130,20 +4515,20 @@ exports.deploymentActionPackages = deploymentActionPackages; /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isDeploymentProcess = void 0; -var utils_1 = __nccwpck_require__(7132); -var runbookProcess_1 = __nccwpck_require__(1379); -function isDeploymentProcess(resource) { - if (resource === null || resource === undefined) { - return false; - } - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - var converted = resource; - return !(0, runbookProcess_1.isRunbookProcess)(resource) && converted.Version !== undefined && (0, utils_1.typeSafeHasOwnProperty)(converted, "Version"); -} -exports.isDeploymentProcess = isDeploymentProcess; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDeploymentProcess = void 0; +var utils_1 = __nccwpck_require__(7132); +var runbookProcess_1 = __nccwpck_require__(1379); +function isDeploymentProcess(resource) { + if (resource === null || resource === undefined) { + return false; + } + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + var converted = resource; + return !(0, runbookProcess_1.isRunbookProcess)(resource) && converted.Version !== undefined && (0, utils_1.typeSafeHasOwnProperty)(converted, "Version"); +} +exports.isDeploymentProcess = isDeploymentProcess; /***/ }), @@ -4152,121 +4537,120 @@ exports.isDeploymentProcess = isDeploymentProcess; /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DeploymentProcessRepository = void 0; -var __1 = __nccwpck_require__(586); -var DeploymentProcessRepository = /** @class */ (function () { - function DeploymentProcessRepository(client, spaceName) { - this.client = client; - this.spaceName = spaceName; - } - DeploymentProcessRepository.prototype.get = function (project) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.client.get("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/deploymentprocesses"), { - spaceId: project.SpaceId, - projectId: project.Id, - })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - DeploymentProcessRepository.prototype.getByGitRef = function (project, gitRef) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.client.get("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/deploymentprocesses"), { - spaceId: project.SpaceId, - projectId: project.Id, - gitRef: gitRef, - })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - DeploymentProcessRepository.prototype.update = function (project, deploymentProcess) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.client.update("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/deploymentprocesses"), deploymentProcess, { - spaceId: deploymentProcess.SpaceId, - projectId: project.Id, - })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - DeploymentProcessRepository.prototype.updateByGitRef = function (project, deploymentProcess, gitRef) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.client.update("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/deploymentprocesses"), deploymentProcess, { - spaceId: deploymentProcess.SpaceId, - projectId: project.Id, - deploymentProcessId: deploymentProcess.Id, - gitRef: gitRef, - })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); - }; - return DeploymentProcessRepository; -}()); -exports.DeploymentProcessRepository = DeploymentProcessRepository; + +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DeploymentProcessRepository = void 0; +var __1 = __nccwpck_require__(586); +var DeploymentProcessRepository = /** @class */ (function () { + function DeploymentProcessRepository(client, spaceName) { + this.client = client; + this.spaceName = spaceName; + } + DeploymentProcessRepository.prototype.get = function (project) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/deploymentprocesses"), { + spaceName: this.spaceName, + projectId: project.Id, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + DeploymentProcessRepository.prototype.getByGitRef = function (project, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/deploymentprocesses"), { + spaceName: this.spaceName, + projectId: project.Id, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + DeploymentProcessRepository.prototype.update = function (project, deploymentProcess) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doUpdate("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/deploymentprocesses"), deploymentProcess, { + spaceName: this.spaceName, + projectId: project.Id, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + DeploymentProcessRepository.prototype.updateByGitRef = function (project, deploymentProcess, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doUpdate("".concat(__1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/deploymentprocesses"), deploymentProcess, { + spaceName: this.spaceName, + projectId: project.Id, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + return DeploymentProcessRepository; +}()); +exports.DeploymentProcessRepository = DeploymentProcessRepository; /***/ }), @@ -4275,15 +4659,15 @@ exports.DeploymentProcessRepository = DeploymentProcessRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.GuidedFailureMode = void 0; -var GuidedFailureMode; -(function (GuidedFailureMode) { - GuidedFailureMode["EnvironmentDefault"] = "EnvironmentDefault"; - GuidedFailureMode["Off"] = "Off"; - GuidedFailureMode["On"] = "On"; -})(GuidedFailureMode = exports.GuidedFailureMode || (exports.GuidedFailureMode = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GuidedFailureMode = void 0; +var GuidedFailureMode; +(function (GuidedFailureMode) { + GuidedFailureMode["EnvironmentDefault"] = "EnvironmentDefault"; + GuidedFailureMode["Off"] = "Off"; + GuidedFailureMode["On"] = "On"; +})(GuidedFailureMode = exports.GuidedFailureMode || (exports.GuidedFailureMode = {})); /***/ }), @@ -4292,27 +4676,27 @@ var GuidedFailureMode; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PackageRequirement = exports.RunCondition = exports.StartTrigger = void 0; -var StartTrigger; -(function (StartTrigger) { - StartTrigger["StartWithPrevious"] = "StartWithPrevious"; - StartTrigger["StartAfterPrevious"] = "StartAfterPrevious"; -})(StartTrigger = exports.StartTrigger || (exports.StartTrigger = {})); -var RunCondition; -(function (RunCondition) { - RunCondition["Success"] = "Success"; - RunCondition["Failure"] = "Failure"; - RunCondition["Always"] = "Always"; - RunCondition["Variable"] = "Variable"; -})(RunCondition = exports.RunCondition || (exports.RunCondition = {})); -var PackageRequirement; -(function (PackageRequirement) { - PackageRequirement["LetOctopusDecide"] = "LetOctopusDecide"; - PackageRequirement["BeforePackageAcquisition"] = "BeforePackageAcquisition"; - PackageRequirement["AfterPackageAcquisition"] = "AfterPackageAcquisition"; -})(PackageRequirement = exports.PackageRequirement || (exports.PackageRequirement = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PackageRequirement = exports.RunCondition = exports.StartTrigger = void 0; +var StartTrigger; +(function (StartTrigger) { + StartTrigger["StartWithPrevious"] = "StartWithPrevious"; + StartTrigger["StartAfterPrevious"] = "StartAfterPrevious"; +})(StartTrigger = exports.StartTrigger || (exports.StartTrigger = {})); +var RunCondition; +(function (RunCondition) { + RunCondition["Success"] = "Success"; + RunCondition["Failure"] = "Failure"; + RunCondition["Always"] = "Always"; + RunCondition["Variable"] = "Variable"; +})(RunCondition = exports.RunCondition || (exports.RunCondition = {})); +var PackageRequirement; +(function (PackageRequirement) { + PackageRequirement["LetOctopusDecide"] = "LetOctopusDecide"; + PackageRequirement["BeforePackageAcquisition"] = "BeforePackageAcquisition"; + PackageRequirement["AfterPackageAcquisition"] = "AfterPackageAcquisition"; +})(PackageRequirement = exports.PackageRequirement || (exports.PackageRequirement = {})); /***/ }), @@ -4321,36 +4705,36 @@ var PackageRequirement; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7974), exports); -__exportStar(__nccwpck_require__(1067), exports); -__exportStar(__nccwpck_require__(4143), exports); -__exportStar(__nccwpck_require__(5187), exports); -__exportStar(__nccwpck_require__(9075), exports); -__exportStar(__nccwpck_require__(6989), exports); -__exportStar(__nccwpck_require__(929), exports); -__exportStar(__nccwpck_require__(6259), exports); -__exportStar(__nccwpck_require__(3958), exports); -__exportStar(__nccwpck_require__(6676), exports); -__exportStar(__nccwpck_require__(5188), exports); -__exportStar(__nccwpck_require__(7266), exports); -__exportStar(__nccwpck_require__(7708), exports); -__exportStar(__nccwpck_require__(6057), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7974), exports); +__exportStar(__nccwpck_require__(1067), exports); +__exportStar(__nccwpck_require__(4143), exports); +__exportStar(__nccwpck_require__(5187), exports); +__exportStar(__nccwpck_require__(9075), exports); +__exportStar(__nccwpck_require__(6989), exports); +__exportStar(__nccwpck_require__(929), exports); +__exportStar(__nccwpck_require__(6259), exports); +__exportStar(__nccwpck_require__(3958), exports); +__exportStar(__nccwpck_require__(6676), exports); +__exportStar(__nccwpck_require__(5188), exports); +__exportStar(__nccwpck_require__(7266), exports); +__exportStar(__nccwpck_require__(7708), exports); +__exportStar(__nccwpck_require__(6057), exports); /***/ }), @@ -4359,15 +4743,15 @@ __exportStar(__nccwpck_require__(6057), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PackageAcquisitionLocation = void 0; -var PackageAcquisitionLocation; -(function (PackageAcquisitionLocation) { - PackageAcquisitionLocation["Server"] = "Server"; - PackageAcquisitionLocation["ExecutionTarget"] = "ExecutionTarget"; - PackageAcquisitionLocation["NotAcquired"] = "NotAcquired"; -})(PackageAcquisitionLocation = exports.PackageAcquisitionLocation || (exports.PackageAcquisitionLocation = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PackageAcquisitionLocation = void 0; +var PackageAcquisitionLocation; +(function (PackageAcquisitionLocation) { + PackageAcquisitionLocation["Server"] = "Server"; + PackageAcquisitionLocation["ExecutionTarget"] = "ExecutionTarget"; + PackageAcquisitionLocation["NotAcquired"] = "NotAcquired"; +})(PackageAcquisitionLocation = exports.PackageAcquisitionLocation || (exports.PackageAcquisitionLocation = {})); /***/ }), @@ -4376,14 +4760,14 @@ var PackageAcquisitionLocation; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PackageSelectionMode = void 0; -var PackageSelectionMode; -(function (PackageSelectionMode) { - PackageSelectionMode["Immediate"] = "immediate"; - PackageSelectionMode["Deferred"] = "deferred"; -})(PackageSelectionMode = exports.PackageSelectionMode || (exports.PackageSelectionMode = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PackageSelectionMode = void 0; +var PackageSelectionMode; +(function (PackageSelectionMode) { + PackageSelectionMode["Immediate"] = "immediate"; + PackageSelectionMode["Deferred"] = "deferred"; +})(PackageSelectionMode = exports.PackageSelectionMode || (exports.PackageSelectionMode = {})); /***/ }), @@ -4392,131 +4776,14 @@ var PackageSelectionMode; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RunConditionForAction = void 0; -var RunConditionForAction; -(function (RunConditionForAction) { - RunConditionForAction["Success"] = "Success"; - RunConditionForAction["Variable"] = "Variable"; -})(RunConditionForAction = exports.RunConditionForAction || (exports.RunConditionForAction = {})); - -/***/ }), - -/***/ 1334: -/***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ExecutionWaiter = void 0; -var serverTasks_1 = __nccwpck_require__(6568); -var ExecutionWaiter = /** @class */ (function () { - function ExecutionWaiter(client, spaceName) { - this.client = client; - this.spaceName = spaceName; - } - ExecutionWaiter.prototype.waitForExecutionsToComplete = function (serverTaskIds, statusCheckSleepCycle, timeout, pollingCallback) { - return __awaiter(this, void 0, void 0, function () { - var taskPromises, _i, serverTaskIds_1, taskId; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - taskPromises = []; - for (_i = 0, serverTaskIds_1 = serverTaskIds; _i < serverTaskIds_1.length; _i++) { - taskId = serverTaskIds_1[_i]; - taskPromises.push(this.waitForExecutionToComplete(taskId, statusCheckSleepCycle, timeout, pollingCallback)); - } - return [4 /*yield*/, Promise.allSettled(taskPromises)]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - ExecutionWaiter.prototype.waitForExecutionToComplete = function (serverTaskId, statusCheckSleepCycle, timeout, pollingCallback) { - return __awaiter(this, void 0, void 0, function () { - var sleep, stop, t, taskDetails, task; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - sleep = function (ms) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/, new Promise(function (r) { return setTimeout(r, ms); })]; - }); }); }; - stop = false; - t = setTimeout(function () { - stop = true; - }, timeout); - _a.label = 1; - case 1: - if (!!stop) return [3 /*break*/, 7]; - if (!pollingCallback) return [3 /*break*/, 3]; - return [4 /*yield*/, (0, serverTasks_1.serverTaskDetailsGet)(this.client, this.spaceName, serverTaskId)]; - case 2: - taskDetails = _a.sent(); - pollingCallback(taskDetails); - if (taskDetails.Task.IsCompleted) { - clearTimeout(t); - return [2 /*return*/, taskDetails.Task]; - } - return [3 /*break*/, 5]; - case 3: return [4 /*yield*/, (0, serverTasks_1.serverTaskGet)(this.client, this.spaceName, serverTaskId)]; - case 4: - task = _a.sent(); - if (task.IsCompleted) { - clearTimeout(t); - return [2 /*return*/, task]; - } - _a.label = 5; - case 5: return [4 /*yield*/, sleep(statusCheckSleepCycle)]; - case 6: - _a.sent(); - return [3 /*break*/, 1]; - case 7: return [2 /*return*/, null]; - } - }); - }); - }; - return ExecutionWaiter; -}()); -exports.ExecutionWaiter = ExecutionWaiter; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunConditionForAction = void 0; +var RunConditionForAction; +(function (RunConditionForAction) { + RunConditionForAction["Success"] = "Success"; + RunConditionForAction["Variable"] = "Variable"; +})(RunConditionForAction = exports.RunConditionForAction || (exports.RunConditionForAction = {})); /***/ }), @@ -4525,8 +4792,8 @@ exports.ExecutionWaiter = ExecutionWaiter; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4535,31 +4802,30 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7274), exports); -__exportStar(__nccwpck_require__(3820), exports); -__exportStar(__nccwpck_require__(5068), exports); -__exportStar(__nccwpck_require__(7397), exports); -__exportStar(__nccwpck_require__(1334), exports); -__exportStar(__nccwpck_require__(9259), exports); -__exportStar(__nccwpck_require__(7748), exports); -__exportStar(__nccwpck_require__(3041), exports); -__exportStar(__nccwpck_require__(5469), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7274), exports); +__exportStar(__nccwpck_require__(3820), exports); +__exportStar(__nccwpck_require__(5068), exports); +__exportStar(__nccwpck_require__(7397), exports); +__exportStar(__nccwpck_require__(9259), exports); +__exportStar(__nccwpck_require__(7748), exports); +__exportStar(__nccwpck_require__(3041), exports); +__exportStar(__nccwpck_require__(5469), exports); /***/ }), @@ -4568,53 +4834,53 @@ __exportStar(__nccwpck_require__(5469), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -/* eslint-disable @typescript-eslint/no-explicit-any */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getBranchNameFromRouteParameter = exports.getURISafeBranchName = exports.isVcsBranchResource = exports.NewProject = exports.HasVersionControlledPersistenceSettings = exports.IsUsingUsernamePasswordAuth = exports.AuthenticationType = exports.PersistenceSettingsType = void 0; -var PersistenceSettingsType; -(function (PersistenceSettingsType) { - PersistenceSettingsType["VersionControlled"] = "VersionControlled"; - PersistenceSettingsType["Database"] = "Database"; -})(PersistenceSettingsType = exports.PersistenceSettingsType || (exports.PersistenceSettingsType = {})); -var AuthenticationType; -(function (AuthenticationType) { - AuthenticationType["Anonymous"] = "Anonymous"; - AuthenticationType["UsernamePassword"] = "UsernamePassword"; -})(AuthenticationType = exports.AuthenticationType || (exports.AuthenticationType = {})); -function IsUsingUsernamePasswordAuth(T) { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return T.Type === AuthenticationType.UsernamePassword; -} -exports.IsUsingUsernamePasswordAuth = IsUsingUsernamePasswordAuth; -function HasVersionControlledPersistenceSettings(T) { - return T.Type === PersistenceSettingsType.VersionControlled; -} -exports.HasVersionControlledPersistenceSettings = HasVersionControlledPersistenceSettings; -function NewProject(name, projectGroup, lifecycle) { - return { - LifecycleId: lifecycle.Id, - Name: name, - ProjectGroupId: projectGroup.Id, - }; -} -exports.NewProject = NewProject; -function isVcsBranchResource(branch) { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return branch.Name !== undefined; -} -exports.isVcsBranchResource = isVcsBranchResource; -function getURISafeBranchName(branch) { - return encodeURIComponent(branch.Name); -} -exports.getURISafeBranchName = getURISafeBranchName; -function getBranchNameFromRouteParameter(routeParameter) { - if (routeParameter) { - return decodeURIComponent(routeParameter); - } - return undefined; -} -exports.getBranchNameFromRouteParameter = getBranchNameFromRouteParameter; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getBranchNameFromRouteParameter = exports.getURISafeBranchName = exports.isVcsBranchResource = exports.NewProject = exports.HasVersionControlledPersistenceSettings = exports.IsUsingUsernamePasswordAuth = exports.AuthenticationType = exports.PersistenceSettingsType = void 0; +var PersistenceSettingsType; +(function (PersistenceSettingsType) { + PersistenceSettingsType["VersionControlled"] = "VersionControlled"; + PersistenceSettingsType["Database"] = "Database"; +})(PersistenceSettingsType = exports.PersistenceSettingsType || (exports.PersistenceSettingsType = {})); +var AuthenticationType; +(function (AuthenticationType) { + AuthenticationType["Anonymous"] = "Anonymous"; + AuthenticationType["UsernamePassword"] = "UsernamePassword"; +})(AuthenticationType = exports.AuthenticationType || (exports.AuthenticationType = {})); +function IsUsingUsernamePasswordAuth(T) { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return T.Type === AuthenticationType.UsernamePassword; +} +exports.IsUsingUsernamePasswordAuth = IsUsingUsernamePasswordAuth; +function HasVersionControlledPersistenceSettings(T) { + return T.Type === PersistenceSettingsType.VersionControlled; +} +exports.HasVersionControlledPersistenceSettings = HasVersionControlledPersistenceSettings; +function NewProject(name, projectGroup, lifecycle) { + return { + LifecycleId: lifecycle.Id, + Name: name, + ProjectGroupId: projectGroup.Id, + }; +} +exports.NewProject = NewProject; +function isVcsBranchResource(branch) { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return branch.Name !== undefined; +} +exports.isVcsBranchResource = isVcsBranchResource; +function getURISafeBranchName(branch) { + return encodeURIComponent(branch.Name); +} +exports.getURISafeBranchName = getURISafeBranchName; +function getBranchNameFromRouteParameter(routeParameter) { + if (routeParameter) { + return decodeURIComponent(routeParameter); + } + return undefined; +} +exports.getBranchNameFromRouteParameter = getBranchNameFromRouteParameter; /***/ }), @@ -4623,34 +4889,34 @@ exports.getBranchNameFromRouteParameter = getBranchNameFromRouteParameter; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ProjectRepository = void 0; -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var __1 = __nccwpck_require__(586); -var ProjectRepository = /** @class */ (function (_super) { - __extends(ProjectRepository, _super); - function ProjectRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/projects{/id}{?skip,take,ids,partialName,clonedFromProjectId}")) || this; - } - return ProjectRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.ProjectRepository = ProjectRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ProjectRepository = void 0; +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var __1 = __nccwpck_require__(586); +var ProjectRepository = /** @class */ (function (_super) { + __extends(ProjectRepository, _super); + function ProjectRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/projects"), "skip,take,ids,partialName,clonedFromProjectId") || this; + } + return ProjectRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.ProjectRepository = ProjectRepository; /***/ }), @@ -4659,8 +4925,8 @@ exports.ProjectRepository = ProjectRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4669,8 +4935,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4679,8 +4945,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4689,8 +4955,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4699,8 +4965,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4709,126 +4975,126 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DeploymentRepository = void 0; -var __1 = __nccwpck_require__(586); -var DeploymentRepository = /** @class */ (function () { - function DeploymentRepository(client, spaceName) { - this.baseApiTemplate = "".concat(__1.spaceScopedRoutePrefix, "/deployments{/id}{?skip,take,ids,projects,environments,tenants,channels,taskState}"); - this.client = client; - this.spaceName = spaceName; - } - DeploymentRepository.prototype.get = function (id) { - return this.client.request(this.baseApiTemplate, { id: id, spaceName: this.spaceName }); - }; - DeploymentRepository.prototype.list = function (args) { - return this.client.request(this.baseApiTemplate, __assign({ spaceName: this.spaceName }, args)); - }; - DeploymentRepository.prototype.create = function (command) { - return __awaiter(this, void 0, void 0, function () { - var response, mappedTasks; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.client.debug("Deploying a release..."); - return [4 /*yield*/, this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/deployments/create/untenanted/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; - case 1: - response = _a.sent(); - if (response.DeploymentServerTasks.length == 0) { - throw new Error("No server task details returned"); - } - mappedTasks = response.DeploymentServerTasks.map(function (x) { - return { - DeploymentId: x.DeploymentId || x.deploymentId, - ServerTaskId: x.ServerTaskId || x.serverTaskId, - }; - }); - this.client.debug("Deployment(s) created successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); - return [2 /*return*/, { - DeploymentServerTasks: mappedTasks, - }]; - } - }); - }); - }; - DeploymentRepository.prototype.createTenanted = function (command) { - return __awaiter(this, void 0, void 0, function () { - var response, mappedTasks; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.client.debug("Deploying a tenanted release..."); - return [4 /*yield*/, this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/deployments/create/tenanted/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; - case 1: - response = _a.sent(); - if (response.DeploymentServerTasks.length == 0) { - throw new Error("No server task details returned"); - } - mappedTasks = response.DeploymentServerTasks.map(function (x) { - return { - DeploymentId: x.DeploymentId || x.deploymentId, - ServerTaskId: x.ServerTaskId || x.serverTaskId, - }; - }); - this.client.debug("Tenanted Deployment(s) created successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); - return [2 /*return*/, { - DeploymentServerTasks: mappedTasks, - }]; - } - }); - }); - }; - return DeploymentRepository; -}()); -exports.DeploymentRepository = DeploymentRepository; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DeploymentRepository = void 0; +var __1 = __nccwpck_require__(586); +var DeploymentRepository = /** @class */ (function () { + function DeploymentRepository(client, spaceName) { + this.baseApiPathTemplate = "".concat(__1.spaceScopedRoutePrefix, "/deployments"); + this.client = client; + this.spaceName = spaceName; + } + DeploymentRepository.prototype.get = function (id) { + return this.client.request("".concat(this.baseApiPathTemplate, "/").concat(id), { spaceName: this.spaceName }); + }; + DeploymentRepository.prototype.list = function (args) { + return this.client.request("".concat(this.baseApiPathTemplate, "{?skip,take,ids,projects,environments,tenants,channels,taskState}"), __assign({ spaceName: this.spaceName }, args)); + }; + DeploymentRepository.prototype.create = function (command) { + return __awaiter(this, void 0, void 0, function () { + var response, mappedTasks; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.client.debug("Deploying a release..."); + return [4 /*yield*/, this.client.doCreate("".concat(this.baseApiPathTemplate, "/create/untenanted/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; + case 1: + response = _a.sent(); + if (response.DeploymentServerTasks.length == 0) { + throw new Error("No server task details returned"); + } + mappedTasks = response.DeploymentServerTasks.map(function (x) { + return { + DeploymentId: x.DeploymentId || x.deploymentId, + ServerTaskId: x.ServerTaskId || x.serverTaskId, + }; + }); + this.client.debug("Deployment(s) created successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); + return [2 /*return*/, { + DeploymentServerTasks: mappedTasks, + }]; + } + }); + }); + }; + DeploymentRepository.prototype.createTenanted = function (command) { + return __awaiter(this, void 0, void 0, function () { + var response, mappedTasks; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.client.debug("Deploying a tenanted release..."); + return [4 /*yield*/, this.client.doCreate("".concat(this.baseApiPathTemplate, "/create/tenanted/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; + case 1: + response = _a.sent(); + if (response.DeploymentServerTasks.length == 0) { + throw new Error("No server task details returned"); + } + mappedTasks = response.DeploymentServerTasks.map(function (x) { + return { + DeploymentId: x.DeploymentId || x.deploymentId, + ServerTaskId: x.ServerTaskId || x.serverTaskId, + }; + }); + this.client.debug("Tenanted Deployment(s) created successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); + return [2 /*return*/, { + DeploymentServerTasks: mappedTasks, + }]; + } + }); + }); + }; + return DeploymentRepository; +}()); +exports.DeploymentRepository = DeploymentRepository; /***/ }), @@ -4837,8 +5103,8 @@ exports.DeploymentRepository = DeploymentRepository; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4847,27 +5113,27 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7), exports); -__exportStar(__nccwpck_require__(3565), exports); -__exportStar(__nccwpck_require__(9198), exports); -__exportStar(__nccwpck_require__(3227), exports); -__exportStar(__nccwpck_require__(5952), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7), exports); +__exportStar(__nccwpck_require__(3565), exports); +__exportStar(__nccwpck_require__(9198), exports); +__exportStar(__nccwpck_require__(3227), exports); +__exportStar(__nccwpck_require__(5952), exports); /***/ }), @@ -4876,27 +5142,27 @@ __exportStar(__nccwpck_require__(5952), exports); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(3921), exports); -__exportStar(__nccwpck_require__(7650), exports); -__exportStar(__nccwpck_require__(4213), exports); -__exportStar(__nccwpck_require__(7448), exports); -__exportStar(__nccwpck_require__(8566), exports); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(3921), exports); +__exportStar(__nccwpck_require__(7650), exports); +__exportStar(__nccwpck_require__(4213), exports); +__exportStar(__nccwpck_require__(7448), exports); +__exportStar(__nccwpck_require__(8566), exports); /***/ }), @@ -4905,8 +5171,8 @@ __exportStar(__nccwpck_require__(8566), exports); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -4915,82 +5181,81 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ReleaseRepository = void 0; -var __1 = __nccwpck_require__(586); -var ReleaseRepository = /** @class */ (function () { - function ReleaseRepository(client, spaceName) { - this.baseApiTemplate = "".concat(__1.spaceScopedRoutePrefix, "/releases{/id}{?skip,take,ids}"); - this.client = client; - this.spaceName = spaceName; - } - ReleaseRepository.prototype.create = function (command) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.client.debug("Creating a release..."); - return [4 /*yield*/, this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/releases/create/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; - case 1: - response = _a.sent(); - this.client.debug("Release created successfully."); - return [2 /*return*/, response]; - } - }); - }); - }; - return ReleaseRepository; -}()); -exports.ReleaseRepository = ReleaseRepository; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ReleaseRepository = void 0; +var __1 = __nccwpck_require__(586); +var ReleaseRepository = /** @class */ (function () { + function ReleaseRepository(client, spaceName) { + this.client = client; + this.spaceName = spaceName; + } + ReleaseRepository.prototype.create = function (command) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.client.debug("Creating a release..."); + return [4 /*yield*/, this.client.doCreate("".concat(__1.spaceScopedRoutePrefix, "/releases/create/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; + case 1: + response = _a.sent(); + this.client.debug("Release created successfully."); + return [2 /*return*/, response]; + } + }); + }); + }; + return ReleaseRepository; +}()); +exports.ReleaseRepository = ReleaseRepository; /***/ }), @@ -4999,37 +5264,31 @@ exports.ReleaseRepository = ReleaseRepository; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7890), exports); -__exportStar(__nccwpck_require__(6362), exports); -__exportStar(__nccwpck_require__(9664), exports); -__exportStar(__nccwpck_require__(9825), exports); -__exportStar(__nccwpck_require__(1379), exports); - - -/***/ }), - -/***/ 6362: -/***/ ((__unused_webpack_module, exports) => { -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7890), exports); +__exportStar(__nccwpck_require__(9664), exports); +__exportStar(__nccwpck_require__(9825), exports); +__exportStar(__nccwpck_require__(1379), exports); +__exportStar(__nccwpck_require__(4916), exports); +__exportStar(__nccwpck_require__(8920), exports); +__exportStar(__nccwpck_require__(3196), exports); +__exportStar(__nccwpck_require__(2938), exports); +__exportStar(__nccwpck_require__(7068), exports); /***/ }), @@ -5038,17 +5297,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.IsNonVcsRunbook = void 0; -// We have to use this type assertion instead of "IsVcsRunbook", because a VcsRunbook is structurally a NonVcsRunbookResource -// I.e. they share all the same properties. This causes typescript to fail to narrow the type. -// However, if you do it this way, then it works :shrug: -function IsNonVcsRunbook(runbook) { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return runbook.ProjectId !== undefined; -} -exports.IsNonVcsRunbook = IsNonVcsRunbook; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), @@ -5057,15 +5307,15 @@ exports.IsNonVcsRunbook = IsNonVcsRunbook; /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RunbookEnvironmentScope = void 0; -var RunbookEnvironmentScope; -(function (RunbookEnvironmentScope) { - RunbookEnvironmentScope["All"] = "All"; - RunbookEnvironmentScope["Specified"] = "Specified"; - RunbookEnvironmentScope["FromProjectLifecycles"] = "FromProjectLifecycles"; -})(RunbookEnvironmentScope = exports.RunbookEnvironmentScope || (exports.RunbookEnvironmentScope = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookEnvironmentScope = void 0; +var RunbookEnvironmentScope; +(function (RunbookEnvironmentScope) { + RunbookEnvironmentScope["All"] = "All"; + RunbookEnvironmentScope["Specified"] = "Specified"; + RunbookEnvironmentScope["FromProjectLifecycles"] = "FromProjectLifecycles"; +})(RunbookEnvironmentScope = exports.RunbookEnvironmentScope || (exports.RunbookEnvironmentScope = {})); /***/ }), @@ -5074,7015 +5324,13410 @@ var RunbookEnvironmentScope; /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.processResourcePermission = exports.isRunbookProcess = void 0; -var utils_1 = __nccwpck_require__(7132); -var permission_1 = __nccwpck_require__(800); -function isRunbookProcess(resource) { - if (resource === null || resource === undefined) { - return false; - } - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - var converted = resource; - return converted.RunbookId !== undefined && (0, utils_1.typeSafeHasOwnProperty)(converted, "RunbookId"); -} -exports.isRunbookProcess = isRunbookProcess; -function processResourcePermission(resource) { - var isRunbook = isRunbookProcess(resource); - return isRunbook ? permission_1.Permission.RunbookEdit : permission_1.Permission.ProcessEdit; -} -exports.processResourcePermission = processResourcePermission; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.processResourcePermission = exports.isRunbookProcess = void 0; +var utils_1 = __nccwpck_require__(7132); +var permission_1 = __nccwpck_require__(800); +function isRunbookProcess(resource) { + if (resource === null || resource === undefined) { + return false; + } + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + var converted = resource; + return converted.RunbookId !== undefined && (0, utils_1.typeSafeHasOwnProperty)(converted, "RunbookId"); +} +exports.isRunbookProcess = isRunbookProcess; +function processResourcePermission(resource) { + var isRunbook = isRunbookProcess(resource); + return isRunbook ? permission_1.Permission.RunbookEdit : permission_1.Permission.ProcessEdit; +} +exports.processResourcePermission = processResourcePermission; /***/ }), -/***/ 4010: -/***/ ((__unused_webpack_module, exports) => { +/***/ 4916: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookProcessRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var RunbookProcessRepository = /** @class */ (function () { + function RunbookProcessRepository(client, spaceName, project) { + this.client = client; + this.spaceName = spaceName; + this.projectId = project.Id; + } + RunbookProcessRepository.prototype.get = function (runbook) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/runbookProcesses{/id}"), { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbook.RunbookProcessId, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + RunbookProcessRepository.prototype.update = function (runbookProcess) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doUpdate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/runbookProcesses{/id}"), runbookProcess, { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbookProcess.Id, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + return RunbookProcessRepository; +}()); +exports.RunbookProcessRepository = RunbookProcessRepository; /***/ }), -/***/ 7890: +/***/ 8920: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(4010), exports); -__exportStar(__nccwpck_require__(2562), exports); -__exportStar(__nccwpck_require__(827), exports); -__exportStar(__nccwpck_require__(2493), exports); + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var RunbookRepository = /** @class */ (function (_super) { + __extends(RunbookRepository, _super); + function RunbookRepository(client, spaceName, project) { + return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/").concat(project.Id, "/runbooks"), "skip,take,ids,partialName") || this; + } + return RunbookRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.RunbookRepository = RunbookRepository; /***/ }), -/***/ 2562: +/***/ 3196: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 827: +/***/ 2938: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); + + +/***/ }), + +/***/ 7068: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RunbookRunRepository = void 0; -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -var RunbookRunRepository = /** @class */ (function () { - function RunbookRunRepository(client, spaceName) { - this.baseApiTemplate = "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/runbookRuns{/id}{?skip,take,ids,projects,environments,tenants,runbooks,taskState,partialName}"); - this.client = client; - this.spaceName = spaceName; - } - RunbookRunRepository.prototype.get = function (id) { - return this.client.request(this.baseApiTemplate, { id: id, spaceName: this.spaceName }); - }; - RunbookRunRepository.prototype.list = function (args) { - return this.client.request(this.baseApiTemplate, __assign({ spaceName: this.spaceName }, args)); - }; - RunbookRunRepository.prototype.create = function (command) { - return __awaiter(this, void 0, void 0, function () { - var response, mappedTasks; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.client.debug("Running a runbook..."); - return [4 /*yield*/, this.client.doCreate("runbook-runs/create/v1", __assign({ spaceIdOrName: command.spaceName }, command))]; - case 1: - response = _a.sent(); - if (response.RunbookRunServerTasks.length == 0) { - throw new Error("No server task details returned"); - } - mappedTasks = response.RunbookRunServerTasks.map(function (x) { - return { - RunbookRunId: x.RunbookRunId || x.runbookRunId, - ServerTaskId: x.ServerTaskId || x.serverTaskId, - }; - }); - this.client.debug("Runbook executed successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); - return [2 /*return*/, { - RunbookRunServerTasks: mappedTasks, - }]; - } - }); - }); - }; - return RunbookRunRepository; -}()); -exports.RunbookRunRepository = RunbookRunRepository; - - -/***/ }), -/***/ 2493: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookSnapshotRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var RunbookSnapshotRepository = /** @class */ (function () { + function RunbookSnapshotRepository(client, spaceName, project) { + this.client = client; + this.spaceName = spaceName; + this.projectId = project.Id; + } + RunbookSnapshotRepository.prototype.create = function (runbook, name, publish, notes) { + return __awaiter(this, void 0, void 0, function () { + var snapshot, response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + snapshot = { + ProjectId: this.projectId, + RunbookId: runbook.Id, + Name: name, + Notes: notes, + }; + return [4 /*yield*/, this.client.doCreate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/runbookSnapshots{?publish}"), snapshot, { + spaceName: this.spaceName, + projectId: this.projectId, + publish: publish ? "true" : undefined, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + return RunbookSnapshotRepository; +}()); +exports.RunbookSnapshotRepository = RunbookSnapshotRepository; /***/ }), -/***/ 5469: +/***/ 4010: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TenantedDeploymentMode = void 0; -var TenantedDeploymentMode; -(function (TenantedDeploymentMode) { - TenantedDeploymentMode["Untenanted"] = "Untenanted"; - TenantedDeploymentMode["TenantedOrUntenanted"] = "TenantedOrUntenanted"; - TenantedDeploymentMode["Tenanted"] = "Tenanted"; -})(TenantedDeploymentMode = exports.TenantedDeploymentMode || (exports.TenantedDeploymentMode = {})); - - -/***/ }), - -/***/ 1616: -/***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.serverTaskRawGet = exports.serverTaskDetailsGet = exports.serverTasksGet = exports.serverTaskGet = void 0; -var lodash_1 = __nccwpck_require__(250); -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -function serverTaskGet(client, spaceName, serverTaskId) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!serverTaskId) { - throw new Error("Server Task Id was not provided"); - } - return [4 /*yield*/, client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tasks/{serverTaskId}"), { spaceName: spaceName, serverTaskId: serverTaskId })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); -} -exports.serverTaskGet = serverTaskGet; -function serverTasksGet(client, spaceName, serverTaskIds) { - return __awaiter(this, void 0, void 0, function () { - var batchSize, idArrays, promises; - return __generator(this, function (_a) { - batchSize = 300; - idArrays = (0, lodash_1.chunk)(serverTaskIds, batchSize); - promises = idArrays.map(function (i, index) { - return client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tasks{?skip,take,ids,partialName}"), { - spaceName: spaceName, - ids: i, - skip: index * batchSize, - take: batchSize, - }); - }); - return [2 /*return*/, Promise.all(promises).then(function (result) { return (0, lodash_1.flatMap)(result, function (c) { return c.Items; }); })]; - }); - }); -} -exports.serverTasksGet = serverTasksGet; -function serverTaskDetailsGet(client, spaceName, serverTaskId) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!serverTaskId) { - throw new Error("Server Task Id was not provided"); - } - return [4 /*yield*/, client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tasks/{serverTaskId}/details"), { spaceName: spaceName, serverTaskId: serverTaskId })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); -} -exports.serverTaskDetailsGet = serverTaskDetailsGet; -function serverTaskRawGet(client, spaceName, serverTaskId) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!serverTaskId) { - throw new Error("Server Task Id was not provided"); - } - return [4 /*yield*/, client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tasks/{serverTaskId}/raw"), { spaceName: spaceName, serverTaskId: serverTaskId })]; - case 1: - response = _a.sent(); - return [2 /*return*/, response]; - } - }); - }); -} -exports.serverTaskRawGet = serverTaskRawGet; +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 6568: +/***/ 7890: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(1616), exports); -__exportStar(__nccwpck_require__(9144), exports); -__exportStar(__nccwpck_require__(4013), exports); -__exportStar(__nccwpck_require__(1038), exports); - - -/***/ }), -/***/ 4013: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(4010), exports); +__exportStar(__nccwpck_require__(2562), exports); +__exportStar(__nccwpck_require__(827), exports); +__exportStar(__nccwpck_require__(2493), exports); /***/ }), -/***/ 1038: +/***/ 2562: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ActivityLogEntryCategory = exports.ActivityStatus = void 0; -var ActivityStatus; -(function (ActivityStatus) { - ActivityStatus["Pending"] = "Pending"; - ActivityStatus["Running"] = "Running"; - ActivityStatus["Success"] = "Success"; - ActivityStatus["Failed"] = "Failed"; - ActivityStatus["Skipped"] = "Skipped"; - ActivityStatus["SuccessWithWarning"] = "SuccessWithWarning"; - ActivityStatus["Canceled"] = "Canceled"; -})(ActivityStatus = exports.ActivityStatus || (exports.ActivityStatus = {})); -var ActivityLogEntryCategory; -(function (ActivityLogEntryCategory) { - ActivityLogEntryCategory["Trace"] = "Trace"; - ActivityLogEntryCategory["Verbose"] = "Verbose"; - ActivityLogEntryCategory["Info"] = "Info"; - ActivityLogEntryCategory["Highlight"] = "Highlight"; - ActivityLogEntryCategory["Wait"] = "Wait"; - ActivityLogEntryCategory["Gap"] = "Gap"; - ActivityLogEntryCategory["Alert"] = "Alert"; - ActivityLogEntryCategory["Warning"] = "Warning"; - ActivityLogEntryCategory["Error"] = "Error"; - ActivityLogEntryCategory["Fatal"] = "Fatal"; - ActivityLogEntryCategory["Planned"] = "Planned"; - ActivityLogEntryCategory["Updated"] = "Updated"; - ActivityLogEntryCategory["Finished"] = "Finished"; - ActivityLogEntryCategory["Abandoned"] = "Abandoned"; -})(ActivityLogEntryCategory = exports.ActivityLogEntryCategory || (exports.ActivityLogEntryCategory = {})); - - -/***/ }), - -/***/ 9144: -/***/ ((__unused_webpack_module, exports) => { -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TaskState = void 0; -var TaskState; -(function (TaskState) { - TaskState["Canceled"] = "Canceled"; - TaskState["Cancelling"] = "Cancelling"; - TaskState["Executing"] = "Executing"; - TaskState["Failed"] = "Failed"; - TaskState["Queued"] = "Queued"; - TaskState["Success"] = "Success"; - TaskState["TimedOut"] = "TimedOut"; -})(TaskState = exports.TaskState || (exports.TaskState = {})); +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 3496: +/***/ 827: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SpaceScopedBasicRepository = void 0; -var basicRepository_1 = __nccwpck_require__(2966); -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -var SpaceScopedBasicRepository = /** @class */ (function (_super) { - __extends(SpaceScopedBasicRepository, _super); - function SpaceScopedBasicRepository(client, spaceName, baseApiTemplate) { - var _this = _super.call(this, client, baseApiTemplate) || this; - if (!baseApiTemplate.startsWith(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix)) { - throw new Error("Space scoped repositories must prefix their baseApiTemplate with `spaceScopedRoutePrefix`"); - } - _this.spaceName = spaceName; - return _this; - } - SpaceScopedBasicRepository.prototype.create = function (resource, args) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return _super.prototype.create.call(this, resource, __assign({ spaceName: this.spaceName }, args)); - }; - SpaceScopedBasicRepository.prototype.get = function (id) { - return this.client.request(this.baseApiTemplate, { id: id, spaceName: this.spaceName }); - }; - SpaceScopedBasicRepository.prototype.list = function (args) { - return this.client.request(this.baseApiTemplate, __assign({ spaceName: this.spaceName }, args)); - }; - SpaceScopedBasicRepository.prototype.modify = function (resource, args) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return _super.prototype.modify.call(this, resource, __assign({ spaceName: this.spaceName }, args)); - }; - return SpaceScopedBasicRepository; -}(basicRepository_1.BasicRepository)); -exports.SpaceScopedBasicRepository = SpaceScopedBasicRepository; + +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookRunRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var RunbookRunRepository = /** @class */ (function () { + function RunbookRunRepository(client, spaceName) { + this.baseApiPathTemplate = "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/runbookRuns"); + this.client = client; + this.spaceName = spaceName; + } + RunbookRunRepository.prototype.get = function (id) { + return this.client.request("".concat(this.baseApiPathTemplate, "/").concat(id), { spaceName: this.spaceName }); + }; + RunbookRunRepository.prototype.list = function (args) { + return this.client.request("".concat(this.baseApiPathTemplate, "{?skip,take,ids,projects,environments,tenants,runbooks,taskState,partialName}"), __assign({ spaceName: this.spaceName }, args)); + }; + RunbookRunRepository.prototype.create = function (command) { + return __awaiter(this, void 0, void 0, function () { + var response, mappedTasks; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.client.debug("Running a runbook..."); + return [4 /*yield*/, this.client.doCreate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/runbook-runs/create/v1"), __assign({ spaceIdOrName: command.spaceName }, command))]; + case 1: + response = _a.sent(); + if (response.RunbookRunServerTasks.length == 0) { + throw new Error("No server task details returned"); + } + mappedTasks = response.RunbookRunServerTasks.map(function (x) { + return { + RunbookRunId: x.RunbookRunId || x.runbookRunId, + ServerTaskId: x.ServerTaskId || x.serverTaskId, + }; + }); + this.client.debug("Runbook executed successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); + return [2 /*return*/, { + RunbookRunServerTasks: mappedTasks, + }]; + } + }); + }); + }; + return RunbookRunRepository; +}()); +exports.RunbookRunRepository = RunbookRunRepository; /***/ }), -/***/ 1163: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 2493: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7970), exports); -__exportStar(__nccwpck_require__(4778), exports); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 7970: +/***/ 5469: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TenantedDeploymentMode = void 0; +var TenantedDeploymentMode; +(function (TenantedDeploymentMode) { + TenantedDeploymentMode["Untenanted"] = "Untenanted"; + TenantedDeploymentMode["TenantedOrUntenanted"] = "TenantedOrUntenanted"; + TenantedDeploymentMode["Tenanted"] = "Tenanted"; +})(TenantedDeploymentMode = exports.TenantedDeploymentMode || (exports.TenantedDeploymentMode = {})); /***/ }), -/***/ 4778: +/***/ 6568: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SpaceRepository = void 0; -var __1 = __nccwpck_require__(586); -var basicRepository_1 = __nccwpck_require__(2966); -var SpaceRepository = /** @class */ (function (_super) { - __extends(SpaceRepository, _super); - function SpaceRepository(client) { - return _super.call(this, client, "".concat(__1.apiLocation, "/spaces{/id}{?skip,ids,take,partialName}")) || this; - } - return SpaceRepository; -}(basicRepository_1.BasicRepository)); -exports.SpaceRepository = SpaceRepository; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(4013), exports); +__exportStar(__nccwpck_require__(1038), exports); +__exportStar(__nccwpck_require__(1613), exports); +__exportStar(__nccwpck_require__(3797), exports); +__exportStar(__nccwpck_require__(9144), exports); /***/ }), -/***/ 9925: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 4013: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(7635), exports); -__exportStar(__nccwpck_require__(240), exports); -__exportStar(__nccwpck_require__(1970), exports); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 7635: +/***/ 1038: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ActivityLogEntryCategory = exports.ActivityStatus = void 0; +var ActivityStatus; +(function (ActivityStatus) { + ActivityStatus["Pending"] = "Pending"; + ActivityStatus["Running"] = "Running"; + ActivityStatus["Success"] = "Success"; + ActivityStatus["Failed"] = "Failed"; + ActivityStatus["Skipped"] = "Skipped"; + ActivityStatus["SuccessWithWarning"] = "SuccessWithWarning"; + ActivityStatus["Canceled"] = "Canceled"; +})(ActivityStatus = exports.ActivityStatus || (exports.ActivityStatus = {})); +var ActivityLogEntryCategory; +(function (ActivityLogEntryCategory) { + ActivityLogEntryCategory["Trace"] = "Trace"; + ActivityLogEntryCategory["Verbose"] = "Verbose"; + ActivityLogEntryCategory["Info"] = "Info"; + ActivityLogEntryCategory["Highlight"] = "Highlight"; + ActivityLogEntryCategory["Wait"] = "Wait"; + ActivityLogEntryCategory["Gap"] = "Gap"; + ActivityLogEntryCategory["Alert"] = "Alert"; + ActivityLogEntryCategory["Warning"] = "Warning"; + ActivityLogEntryCategory["Error"] = "Error"; + ActivityLogEntryCategory["Fatal"] = "Fatal"; + ActivityLogEntryCategory["Planned"] = "Planned"; + ActivityLogEntryCategory["Updated"] = "Updated"; + ActivityLogEntryCategory["Finished"] = "Finished"; + ActivityLogEntryCategory["Abandoned"] = "Abandoned"; +})(ActivityLogEntryCategory = exports.ActivityLogEntryCategory || (exports.ActivityLogEntryCategory = {})); /***/ }), -/***/ 240: -/***/ ((__unused_webpack_module, exports) => { +/***/ 1613: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +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 __generator = (this && this.__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 }; + } +}; +var __values = (this && this.__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."); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServerTaskWaiter = void 0; +var serverTasks_1 = __nccwpck_require__(6568); +var ServerTaskWaiter = /** @class */ (function () { + function ServerTaskWaiter(client, spaceName) { + this.client = client; + this.spaceName = spaceName; + } + ServerTaskWaiter.prototype.waitForServerTasksToComplete = function (serverTaskIds, statusCheckSleepCycle, timeout, pollingCallback) { + return __awaiter(this, void 0, void 0, function () { + var spaceServerTaskRepository, taskPromises, serverTaskIds_1, serverTaskIds_1_1, serverTaskId; + var e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + spaceServerTaskRepository = new serverTasks_1.SpaceServerTaskRepository(this.client, this.spaceName); + taskPromises = []; + try { + for (serverTaskIds_1 = __values(serverTaskIds), serverTaskIds_1_1 = serverTaskIds_1.next(); !serverTaskIds_1_1.done; serverTaskIds_1_1 = serverTaskIds_1.next()) { + serverTaskId = serverTaskIds_1_1.value; + taskPromises.push(this.waitForTask(spaceServerTaskRepository, serverTaskId, statusCheckSleepCycle, timeout, pollingCallback)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (serverTaskIds_1_1 && !serverTaskIds_1_1.done && (_a = serverTaskIds_1.return)) _a.call(serverTaskIds_1); + } + finally { if (e_1) throw e_1.error; } + } + return [4 /*yield*/, Promise.allSettled(taskPromises)]; + case 1: return [2 /*return*/, _b.sent()]; + } + }); + }); + }; + ServerTaskWaiter.prototype.waitForServerTaskToComplete = function (serverTaskId, statusCheckSleepCycle, timeout, pollingCallback) { + return __awaiter(this, void 0, void 0, function () { + var spaceServerTaskRepository; + return __generator(this, function (_a) { + spaceServerTaskRepository = new serverTasks_1.SpaceServerTaskRepository(this.client, this.spaceName); + return [2 /*return*/, this.waitForTask(spaceServerTaskRepository, serverTaskId, statusCheckSleepCycle, timeout, pollingCallback)]; + }); + }); + }; + ServerTaskWaiter.prototype.waitForTask = function (spaceServerTaskRepository, serverTaskId, statusCheckSleepCycle, timeout, pollingCallback) { + return __awaiter(this, void 0, void 0, function () { + var sleep, stop, t, taskDetails, task; + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + sleep = function (ms) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, new Promise(function (r) { return setTimeout(r, ms); })]; + }); }); }; + stop = false; + t = setTimeout(function () { + stop = true; + }, timeout); + _a.label = 1; + case 1: + if (!!stop) return [3 /*break*/, 10]; + _a.label = 2; + case 2: + _a.trys.push([2, , 7, 8]); + if (!pollingCallback) return [3 /*break*/, 4]; + return [4 /*yield*/, spaceServerTaskRepository.getDetails(serverTaskId)]; + case 3: + taskDetails = _a.sent(); + pollingCallback(taskDetails); + if (taskDetails.Task.IsCompleted) { + return [2 /*return*/, taskDetails.Task]; + } + return [3 /*break*/, 6]; + case 4: return [4 /*yield*/, spaceServerTaskRepository.getById(serverTaskId)]; + case 5: + task = _a.sent(); + if (task.IsCompleted) { + return [2 /*return*/, task]; + } + _a.label = 6; + case 6: return [3 /*break*/, 8]; + case 7: + clearTimeout(t); + return [7 /*endfinally*/]; + case 8: return [4 /*yield*/, sleep(statusCheckSleepCycle)]; + case 9: + _a.sent(); + return [3 /*break*/, 1]; + case 10: return [2 /*return*/, null]; + } + }); + }); + }; + return ServerTaskWaiter; +}()); +exports.ServerTaskWaiter = ServerTaskWaiter; /***/ }), -/***/ 1970: +/***/ 3797: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TagSetRepository = void 0; -var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var TagSetRepository = /** @class */ (function (_super) { - __extends(TagSetRepository, _super); - function TagSetRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tagsets{/id}{?skip,take,ids,partialName}")) || this; - } - TagSetRepository.prototype.sort = function (ids) { - return this.client.doUpdate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tagsets/sortorder"), ids, { spaceName: this.spaceName }); - }; - return TagSetRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.TagSetRepository = TagSetRepository; + +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 __generator = (this && this.__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 }; + } +}; +var __values = (this && this.__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."); +}; +var __read = (this && this.__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; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpaceServerTaskRepository = void 0; +var lodash_1 = __nccwpck_require__(250); +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var SpaceServerTaskRepository = /** @class */ (function () { + function SpaceServerTaskRepository(client, spaceName) { + this.baseApiPathTemplate = "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tasks"); + this.client = client; + this.spaceName = spaceName; + } + SpaceServerTaskRepository.prototype.getById = function (serverTaskId) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!serverTaskId) { + throw new Error("Server Task Id was not provided"); + } + return [4 /*yield*/, this.client.request("".concat(this.baseApiPathTemplate, "/").concat(serverTaskId), { spaceName: this.spaceName })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + SpaceServerTaskRepository.prototype.getByIds = function (serverTaskIds) { + return __awaiter(this, void 0, void 0, function () { + var batchSize, idArrays, promises, _a, _b, _c, index, ids; + var e_1, _d; + return __generator(this, function (_e) { + batchSize = 300; + idArrays = (0, lodash_1.chunk)(serverTaskIds, batchSize); + promises = []; + try { + for (_a = __values(idArrays.entries()), _b = _a.next(); !_b.done; _b = _a.next()) { + _c = __read(_b.value, 2), index = _c[0], ids = _c[1]; + promises.push(this.client.request("".concat(this.baseApiPathTemplate, "{?skip,take,ids,partialName}"), { + spaceName: this.spaceName, + ids: ids, + skip: index * batchSize, + take: batchSize, + })); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_b && !_b.done && (_d = _a.return)) _d.call(_a); + } + finally { if (e_1) throw e_1.error; } + } + return [2 /*return*/, Promise.allSettled(promises).then(function (result) { return (0, lodash_1.flatMap)(result, function (c) { return (c.status == "fulfilled" ? c.value.Items : []); }); })]; + }); + }); + }; + SpaceServerTaskRepository.prototype.getDetails = function (serverTaskId) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!serverTaskId) { + throw new Error("Server Task Id was not provided"); + } + return [4 /*yield*/, this.client.request("".concat(this.baseApiPathTemplate, "/").concat(serverTaskId, "/details"), { + spaceName: this.spaceName, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + SpaceServerTaskRepository.prototype.getRaw = function (serverTaskId) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!serverTaskId) { + throw new Error("Server Task Id was not provided"); + } + return [4 /*yield*/, this.client.request("".concat(this.baseApiPathTemplate, "/").concat(serverTaskId, "/raw"), { spaceName: this.spaceName })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + return SpaceServerTaskRepository; +}()); +exports.SpaceServerTaskRepository = SpaceServerTaskRepository; /***/ }), -/***/ 341: +/***/ 9144: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TaskState = void 0; +var TaskState; +(function (TaskState) { + TaskState["Canceled"] = "Canceled"; + TaskState["Cancelling"] = "Cancelling"; + TaskState["Executing"] = "Executing"; + TaskState["Failed"] = "Failed"; + TaskState["Queued"] = "Queued"; + TaskState["Success"] = "Success"; + TaskState["TimedOut"] = "TimedOut"; +})(TaskState = exports.TaskState || (exports.TaskState = {})); + + +/***/ }), + +/***/ 3496: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(5305), exports); -__exportStar(__nccwpck_require__(7026), exports); -__exportStar(__nccwpck_require__(7444), exports); -__exportStar(__nccwpck_require__(2830), exports); + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpaceScopedBasicRepository = void 0; +var basicRepository_1 = __nccwpck_require__(2966); +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var SpaceScopedBasicRepository = /** @class */ (function (_super) { + __extends(SpaceScopedBasicRepository, _super); + function SpaceScopedBasicRepository(client, spaceName, baseApiPathTemplate, listParametersTemplate) { + var _this = _super.call(this, client, baseApiPathTemplate, listParametersTemplate) || this; + if (!baseApiPathTemplate.startsWith(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix)) { + throw new Error("Space scoped repositories must prefix their baseApiTemplate with `spaceScopedRoutePrefix`"); + } + _this.spaceName = spaceName; + return _this; + } + SpaceScopedBasicRepository.prototype.del = function (resource) { + var _this = this; + return this.client + .del("".concat(this.baseApiPathTemplate, "/").concat(resource.Id), { spaceName: this.spaceName }) + .then(function (d) { return _this.notifySubscribersToDataModifications(resource); }); + }; + SpaceScopedBasicRepository.prototype.create = function (resource, args) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return _super.prototype.create.call(this, resource, __assign({ spaceName: this.spaceName }, args)); + }; + SpaceScopedBasicRepository.prototype.get = function (id) { + return this.client.request("".concat(this.baseApiPathTemplate, "/").concat(id), { spaceName: this.spaceName }); + }; + SpaceScopedBasicRepository.prototype.list = function (args) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return _super.prototype.list.call(this, __assign({ spaceName: this.spaceName }, args)); + }; + SpaceScopedBasicRepository.prototype.modify = function (resource, args) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return _super.prototype.modify.call(this, resource, __assign({ spaceName: this.spaceName }, args)); + }; + return SpaceScopedBasicRepository; +}(basicRepository_1.BasicRepository)); +exports.SpaceScopedBasicRepository = SpaceScopedBasicRepository; /***/ }), -/***/ 5305: -/***/ ((__unused_webpack_module, exports) => { +/***/ 1163: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7970), exports); +__exportStar(__nccwpck_require__(4778), exports); /***/ }), -/***/ 7026: +/***/ 7970: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 7444: +/***/ 4778: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TenantRepository = void 0; -var __1 = __nccwpck_require__(586); -var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); -var TenantRepository = /** @class */ (function (_super) { - __extends(TenantRepository, _super); - function TenantRepository(client, spaceName) { - return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/tenants{/id}{?skip,projectId,tags,take,ids,clone,partialName,clonedFromTenantId}")) || this; - } - TenantRepository.prototype.tagTest = function (tenantIds, tags) { - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/tag-test{?tenantIds,tags}"), { tenantIds: tenantIds, tags: tags }); - }; - TenantRepository.prototype.getVariables = function (tenant) { - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/{id}/variables")); - }; - TenantRepository.prototype.setVariables = function (tenant, variables) { - return this.client.doUpdate("".concat(__1.spaceScopedRoutePrefix, "/tenants/{id}/variables"), variables); - }; - TenantRepository.prototype.missingVariables = function (filterOptions, includeDetails) { - if (filterOptions === void 0) { filterOptions = {}; } - if (includeDetails === void 0) { includeDetails = false; } - var payload = { - environmentId: filterOptions.environmentId, - includeDetails: !!includeDetails, - projectId: filterOptions.projectId, - tenantId: filterOptions.tenantId, - }; - return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/variables-missing{?tenantId,projectId,environmentId,includeDetails}"), payload); - }; - return TenantRepository; -}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); -exports.TenantRepository = TenantRepository; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpaceRepository = void 0; +var __1 = __nccwpck_require__(586); +var basicRepository_1 = __nccwpck_require__(2966); +var SpaceRepository = /** @class */ (function (_super) { + __extends(SpaceRepository, _super); + function SpaceRepository(client) { + return _super.call(this, client, "".concat(__1.apiLocation, "/spaces"), "skip,ids,take,partialName") || this; + } + return SpaceRepository; +}(basicRepository_1.BasicRepository)); +exports.SpaceRepository = SpaceRepository; /***/ }), -/***/ 2830: -/***/ ((__unused_webpack_module, exports) => { +/***/ 9925: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(7635), exports); +__exportStar(__nccwpck_require__(240), exports); +__exportStar(__nccwpck_require__(1970), exports); /***/ }), -/***/ 41: +/***/ 7635: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 1321: +/***/ 240: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.IdentityType = void 0; -var IdentityType; -(function (IdentityType) { - IdentityType["Guest"] = "Guest"; - IdentityType["UsernamePassword"] = "UsernamePassword"; - IdentityType["ActiveDirectory"] = "ActiveDirectory"; - IdentityType["OAuth"] = "OAuth"; -})(IdentityType = exports.IdentityType || (exports.IdentityType = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 3217: +/***/ 1970: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(41), exports); -__exportStar(__nccwpck_require__(1321), exports); -__exportStar(__nccwpck_require__(4438), exports); -__exportStar(__nccwpck_require__(1380), exports); + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TagSetRepository = void 0; +var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var TagSetRepository = /** @class */ (function (_super) { + __extends(TagSetRepository, _super); + function TagSetRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tagsets"), "skip,take,ids,partialName") || this; + } + TagSetRepository.prototype.sort = function (ids) { + return this.client.doUpdate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/tagsets/sortorder"), ids, { spaceName: this.spaceName }); + }; + return TagSetRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.TagSetRepository = TagSetRepository; /***/ }), -/***/ 1380: +/***/ 341: /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.userGetCurrent = void 0; -var __1 = __nccwpck_require__(586); -function userGetCurrent(client) { - return __awaiter(this, void 0, void 0, function () { - var user; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, client.get("".concat(__1.apiLocation, "/users/me"))]; - case 1: - user = _a.sent(); - return [2 /*return*/, user]; - } - }); - }); -} -exports.userGetCurrent = userGetCurrent; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(5305), exports); +__exportStar(__nccwpck_require__(7026), exports); +__exportStar(__nccwpck_require__(7444), exports); +__exportStar(__nccwpck_require__(2830), exports); /***/ }), -/***/ 4438: +/***/ 5305: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -/***/ }), - -/***/ 621: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(9790), exports); +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 9790: +/***/ 7026: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSensitiveValue = exports.NewSensitiveValue = void 0; -function NewSensitiveValue(value, hint) { - return { - HasValue: true, - Hint: hint, - NewValue: value, - }; -} -exports.NewSensitiveValue = NewSensitiveValue; -function isSensitiveValue(value) { - if (typeof value === "string" || value === null) { - return false; - } - return Object.prototype.hasOwnProperty.call(value, "HasValue"); -} -exports.isSensitiveValue = isSensitiveValue; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 586: +/***/ 7444: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__nccwpck_require__(5024), exports); -__exportStar(__nccwpck_require__(1542), exports); -__exportStar(__nccwpck_require__(7083), exports); -__exportStar(__nccwpck_require__(3024), exports); -__exportStar(__nccwpck_require__(2399), exports); -__exportStar(__nccwpck_require__(5966), exports); -__exportStar(__nccwpck_require__(2101), exports); -__exportStar(__nccwpck_require__(7948), exports); -__exportStar(__nccwpck_require__(6397), exports); -__exportStar(__nccwpck_require__(5758), exports); -__exportStar(__nccwpck_require__(6050), exports); -__exportStar(__nccwpck_require__(661), exports); -__exportStar(__nccwpck_require__(5924), exports); -__exportStar(__nccwpck_require__(6447), exports); -__exportStar(__nccwpck_require__(5435), exports); -__exportStar(__nccwpck_require__(8043), exports); -__exportStar(__nccwpck_require__(2850), exports); -__exportStar(__nccwpck_require__(6742), exports); -__exportStar(__nccwpck_require__(2138), exports); -__exportStar(__nccwpck_require__(232), exports); -__exportStar(__nccwpck_require__(2054), exports); -__exportStar(__nccwpck_require__(5626), exports); -__exportStar(__nccwpck_require__(3667), exports); -__exportStar(__nccwpck_require__(3295), exports); -__exportStar(__nccwpck_require__(492), exports); -__exportStar(__nccwpck_require__(7218), exports); -__exportStar(__nccwpck_require__(1547), exports); -__exportStar(__nccwpck_require__(7132), exports); + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TenantRepository = void 0; +var __1 = __nccwpck_require__(586); +var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); +var TenantRepository = /** @class */ (function (_super) { + __extends(TenantRepository, _super); + function TenantRepository(client, spaceName) { + return _super.call(this, client, spaceName, "".concat(__1.spaceScopedRoutePrefix, "/tenants"), "skip,projectId,tags,take,ids,clone,partialName,clonedFromTenantId") || this; + } + TenantRepository.prototype.tagTest = function (tenantIds, tags) { + return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/tag-test{?tenantIds,tags}"), { tenantIds: tenantIds, tags: tags }); + }; + TenantRepository.prototype.getVariables = function (tenant) { + return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/{id}/variables")); + }; + TenantRepository.prototype.setVariables = function (tenant, variables) { + return this.client.doUpdate("".concat(__1.spaceScopedRoutePrefix, "/tenants/{id}/variables"), variables); + }; + TenantRepository.prototype.missingVariables = function (filterOptions, includeDetails) { + if (filterOptions === void 0) { filterOptions = {}; } + if (includeDetails === void 0) { includeDetails = false; } + var payload = { + environmentId: filterOptions.environmentId, + includeDetails: includeDetails, + projectId: filterOptions.projectId, + tenantId: filterOptions.tenantId, + }; + return this.client.request("".concat(__1.spaceScopedRoutePrefix, "/tenants/variables-missing{?tenantId,projectId,environmentId,includeDetails}"), payload); + }; + return TenantRepository; +}(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); +exports.TenantRepository = TenantRepository; /***/ }), -/***/ 5924: +/***/ 2830: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 6447: +/***/ 41: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 408: -/***/ (function(__unused_webpack_module, exports) { +/***/ 1321: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.OctopusError = void 0; -// Octopus prefix is used here as there is already a built-in type called Error -var OctopusError = /** @class */ (function (_super) { - __extends(OctopusError, _super); - function OctopusError(StatusCode, message) { - var _this = _super.call(this, message) || this; - _this.StatusCode = StatusCode; - _this.ErrorMessage = message; - _this.Errors = []; - Object.setPrototypeOf(_this, OctopusError.prototype); - return _this; - } - OctopusError.create = function (statusCode, response) { - var e = new OctopusError(statusCode); - var n = __assign(__assign({}, e), response); - Object.setPrototypeOf(n, OctopusError.prototype); - return n; - }; - return OctopusError; -}(Error)); -exports.OctopusError = OctopusError; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.IdentityType = void 0; +var IdentityType; +(function (IdentityType) { + IdentityType["Guest"] = "Guest"; + IdentityType["UsernamePassword"] = "UsernamePassword"; + IdentityType["ActiveDirectory"] = "ActiveDirectory"; + IdentityType["OAuth"] = "OAuth"; +})(IdentityType = exports.IdentityType || (exports.IdentityType = {})); /***/ }), -/***/ 5435: -/***/ ((__unused_webpack_module, exports) => { +/***/ 3217: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - - -/***/ }), - -/***/ 8043: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -"use strict"; - -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/consistent-type-assertions */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Resolver = void 0; -var URI = __nccwpck_require__(4190); -var URITemplate = __nccwpck_require__(3423); -var Resolver = /** @class */ (function () { - function Resolver(baseUri) { - this.baseUri = baseUri; - this.baseUri = this.baseUri.endsWith("/") ? this.baseUri : this.baseUri + "/"; - var lastIndexOfMandatorySegment = this.baseUri.lastIndexOf("/api/"); - if (lastIndexOfMandatorySegment >= 1) { - this.baseUri = this.baseUri.substring(0, lastIndexOfMandatorySegment); - } - else { - if (this.baseUri.endsWith("/api")) { - this.baseUri = this.baseUri.substring(0, -4); - } - } - this.baseUri = this.baseUri.endsWith("/") ? this.baseUri.substring(0, this.baseUri.length - 1) : this.baseUri; - var parsed = URI(this.baseUri); - this.rootUri = parsed.scheme() + "://" + parsed.authority(); - this.rootUri = this.rootUri.endsWith("/") ? this.rootUri.substring(0, this.rootUri.length - 1) : this.rootUri; - } - Resolver.prototype.resolve = function (path, uriTemplateParameters) { - if (!path) { - throw new Error("The link is not set to a value"); - } - if (path.startsWith("~/")) { - path = path.substring(1, path.length); - path = this.baseUri + path; - } - else { - path = this.rootUri + path; - } - var template = new URITemplate(path); - var result = template.expand(uriTemplateParameters || {}); - return result; - }; - return Resolver; -}()); -exports.Resolver = Resolver; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(41), exports); +__exportStar(__nccwpck_require__(1321), exports); +__exportStar(__nccwpck_require__(4438), exports); +__exportStar(__nccwpck_require__(1380), exports); /***/ }), -/***/ 2850: -/***/ ((__unused_webpack_module, exports) => { +/***/ 1380: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isResource = void 0; -function isResource(resource) { - return "Id" in resource; -} -exports.isResource = isResource; + +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.userGetCurrent = void 0; +var __1 = __nccwpck_require__(586); +function userGetCurrent(client) { + return __awaiter(this, void 0, void 0, function () { + var user; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, client.get("".concat(__1.apiLocation, "/users/me"))]; + case 1: + user = _a.sent(); + return [2 /*return*/, user]; + } + }); + }); +} +exports.userGetCurrent = userGetCurrent; /***/ }), -/***/ 6742: +/***/ 4438: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 2138: -/***/ ((__unused_webpack_module, exports) => { +/***/ 621: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(9790), exports); /***/ }), -/***/ 232: +/***/ 9790: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSensitiveValue = exports.NewSensitiveValue = void 0; +function NewSensitiveValue(value, hint) { + return { + HasValue: true, + Hint: hint, + NewValue: value, + }; +} +exports.NewSensitiveValue = NewSensitiveValue; +function isSensitiveValue(value) { + if (typeof value === "string" || value === null) { + return false; + } + return Object.prototype.hasOwnProperty.call(value, "HasValue"); +} +exports.isSensitiveValue = isSensitiveValue; /***/ }), -/***/ 2054: +/***/ 586: /***/ (function(__unused_webpack_module, exports, __nccwpck_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 __generator = (this && this.__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 }; - } -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.resolveSpaceId = void 0; -var apiLocation_1 = __nccwpck_require__(7083); -var knownSpaces = {}; -function resolveSpaceId(client, spaceName) { - return __awaiter(this, void 0, void 0, function () { - var spaces, spaceId; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (knownSpaces[spaceName]) { - return [2 /*return*/, knownSpaces[spaceName]]; - } - client.debug("Resolving space from name '".concat(spaceName, "'")); - return [4 /*yield*/, client.get("".concat(apiLocation_1.apiLocation, "/spaces"), { partialName: spaceName })]; - case 1: - spaces = _a.sent(); - spaceId = ""; - if (spaces.TotalResults === 0) { - client.error("No spaces exist with name '".concat(spaceName, "'")); - throw new Error("No spaces exist with name '".concat(spaceName, "'")); - } - spaces.Items.forEach(function (space) { - if (space.Name == spaceName) { - spaceId = space.Id; - knownSpaces[spaceName] = spaceId; - client.debug("Resolved space name '".concat(spaceName, "' to Id ").concat(spaceId)); - } - }); - if (spaceId === "") { - client.error("Unable to resolve space name '".concat(spaceName, "'")); - throw new Error("Unable to resolve space name '".concat(spaceName, "'")); - } - return [2 /*return*/, spaceId]; - } - }); - }); -} -exports.resolveSpaceId = resolveSpaceId; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(5024), exports); +__exportStar(__nccwpck_require__(1542), exports); +__exportStar(__nccwpck_require__(7083), exports); +__exportStar(__nccwpck_require__(3024), exports); +__exportStar(__nccwpck_require__(2399), exports); +__exportStar(__nccwpck_require__(5966), exports); +__exportStar(__nccwpck_require__(2101), exports); +__exportStar(__nccwpck_require__(7948), exports); +__exportStar(__nccwpck_require__(6397), exports); +__exportStar(__nccwpck_require__(5758), exports); +__exportStar(__nccwpck_require__(6050), exports); +__exportStar(__nccwpck_require__(661), exports); +__exportStar(__nccwpck_require__(5924), exports); +__exportStar(__nccwpck_require__(6447), exports); +__exportStar(__nccwpck_require__(5435), exports); +__exportStar(__nccwpck_require__(8043), exports); +__exportStar(__nccwpck_require__(2850), exports); +__exportStar(__nccwpck_require__(6742), exports); +__exportStar(__nccwpck_require__(2138), exports); +__exportStar(__nccwpck_require__(232), exports); +__exportStar(__nccwpck_require__(2054), exports); +__exportStar(__nccwpck_require__(5626), exports); +__exportStar(__nccwpck_require__(3667), exports); +__exportStar(__nccwpck_require__(3295), exports); +__exportStar(__nccwpck_require__(492), exports); +__exportStar(__nccwpck_require__(7218), exports); +__exportStar(__nccwpck_require__(1547), exports); +__exportStar(__nccwpck_require__(7132), exports); /***/ }), -/***/ 5626: +/***/ 5924: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSpaceScopedArgs = void 0; -function isSpaceScopedArgs(args) { - return "spaceName" in args; -} -exports.isSpaceScopedArgs = isSpaceScopedArgs; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 3667: +/***/ 6447: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSpaceScopedOperation = void 0; -function isSpaceScopedOperation(command) { - return "spaceName" in command; -} -exports.isSpaceScopedOperation = isSpaceScopedOperation; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 3295: -/***/ ((__unused_webpack_module, exports) => { +/***/ 408: +/***/ (function(__unused_webpack_module, exports) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSpaceScopedRequest = void 0; -function isSpaceScopedRequest(command) { - return "spaceName" in command; -} -exports.isSpaceScopedRequest = isSpaceScopedRequest; + +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __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; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OctopusError = void 0; +// Octopus prefix is used here as there is already a built-in type called Error +var OctopusError = /** @class */ (function (_super) { + __extends(OctopusError, _super); + function OctopusError(StatusCode, message) { + var _this = _super.call(this, message) || this; + _this.StatusCode = StatusCode; + _this.ErrorMessage = message; + _this.Errors = []; + Object.setPrototypeOf(_this, OctopusError.prototype); + return _this; + } + OctopusError.create = function (statusCode, response) { + var e = new OctopusError(statusCode); + var n = __assign(__assign({}, e), response); + Object.setPrototypeOf(n, OctopusError.prototype); + return n; + }; + return OctopusError; +}(Error)); +exports.OctopusError = OctopusError; /***/ }), -/***/ 492: +/***/ 5435: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSpaceScopedResource = void 0; -function isSpaceScopedResource(resource) { - return "SpaceId" in resource; -} -exports.isSpaceScopedResource = isSpaceScopedResource; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 7218: +/***/ 8043: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.spaceScopedRoutePrefix = void 0; -var apiLocation_1 = __nccwpck_require__(7083); -exports.spaceScopedRoutePrefix = "".concat(apiLocation_1.apiLocation, "/{spaceId}"); + +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/consistent-type-assertions */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Resolver = void 0; +var URI = __nccwpck_require__(4190); +var URITemplate = __nccwpck_require__(3423); +var Resolver = /** @class */ (function () { + function Resolver(baseUri) { + this.baseUri = baseUri; + this.baseUri = this.baseUri.endsWith("/") ? this.baseUri : this.baseUri + "/"; + var lastIndexOfMandatorySegment = this.baseUri.lastIndexOf("/api/"); + if (lastIndexOfMandatorySegment >= 1) { + this.baseUri = this.baseUri.substring(0, lastIndexOfMandatorySegment); + } + else { + if (this.baseUri.endsWith("/api")) { + this.baseUri = this.baseUri.substring(0, -4); + } + } + this.baseUri = this.baseUri.endsWith("/") ? this.baseUri.substring(0, this.baseUri.length - 1) : this.baseUri; + var parsed = URI(this.baseUri); + this.rootUri = parsed.scheme() + "://" + parsed.authority(); + this.rootUri = this.rootUri.endsWith("/") ? this.rootUri.substring(0, this.rootUri.length - 1) : this.rootUri; + } + Resolver.prototype.resolve = function (path, uriTemplateParameters) { + if (!path) { + throw new Error("The link is not set to a value"); + } + if (path.startsWith("~/")) { + path = path.substring(1, path.length); + path = this.baseUri + path; + } + else { + path = this.rootUri + path; + } + var template = new URITemplate(path); + var result = template.expand(uriTemplateParameters || {}); + return result; + }; + return Resolver; +}()); +exports.Resolver = Resolver; /***/ }), -/***/ 1547: +/***/ 2850: /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SubscriptionRecord = void 0; -var SubscriptionRecord = /** @class */ (function () { - function SubscriptionRecord() { - this.subscriptions = {}; - } - SubscriptionRecord.prototype.subscribe = function (registrationName, callback) { - var _this = this; - this.subscriptions[registrationName] = callback; - return function () { return _this.unsubscribe(registrationName); }; - }; - SubscriptionRecord.prototype.unsubscribe = function (registrationName) { - delete this.subscriptions[registrationName]; - }; - SubscriptionRecord.prototype.notify = function (predicate, data) { - var _this = this; - Object.keys(this.subscriptions) - .filter(predicate) - .forEach(function (key) { return _this.subscriptions[key](data); }); - }; - SubscriptionRecord.prototype.notifyAll = function (data) { - this.notify(function () { return true; }, data); - }; - SubscriptionRecord.prototype.notifySingle = function (registrationName, data) { - if (registrationName in this.subscriptions) { - this.subscriptions[registrationName](data); - } - }; - return SubscriptionRecord; -}()); -exports.SubscriptionRecord = SubscriptionRecord; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isResource = void 0; +function isResource(resource) { + return "Id" in resource; +} +exports.isResource = isResource; /***/ }), -/***/ 7132: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 6742: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isPropertyDefinedAndNotNull = exports.typeSafeHasOwnProperty = exports.ensureSuffix = exports.ensurePrefix = exports.determineServerEndpoint = exports.getResolver = exports.getServerEndpoint = exports.getQueryValue = void 0; -var lodash_1 = __nccwpck_require__(250); -var urijs_1 = __importDefault(__nccwpck_require__(4190)); -var resolver_1 = __nccwpck_require__(8043); -var getQueryValue = function (key, location) { - var result; - (0, urijs_1.default)(location).hasQuery(key, function (value) { - result = value; - }); - return result; -}; -exports.getQueryValue = getQueryValue; -var getServerEndpoint = function (location) { - if (location === void 0) { location = window.location; } - return (0, exports.getQueryValue)("octopus.server", location.href) || (0, exports.determineServerEndpoint)(location); -}; -exports.getServerEndpoint = getServerEndpoint; -var getResolver = function (base) { - var resolver = new resolver_1.Resolver(base); - return resolver.resolve.bind(resolver); -}; -exports.getResolver = getResolver; -var determineServerEndpoint = function (location) { - var endpoint = (0, exports.ensureSuffix)("//", "" + location.protocol) + location.host; - var path = (0, exports.ensurePrefix)("/", location.pathname); - if (path.length >= 1) { - var lastSegmentIndex = path.lastIndexOf("/"); - if (lastSegmentIndex >= 0) { - path = path.substring(0, lastSegmentIndex + 1); - } - } - endpoint = endpoint + path; - return endpoint; -}; -exports.determineServerEndpoint = determineServerEndpoint; -exports.ensurePrefix = (0, lodash_1.curry)(function (prefix, value) { return (!value.startsWith(prefix) ? "".concat(prefix).concat(value) : value); }); -exports.ensureSuffix = (0, lodash_1.curry)(function (suffix, value) { return (!value.endsWith(suffix) ? "".concat(value).concat(suffix) : value); }); -var typeSafeHasOwnProperty = function (target, key) { - return target.hasOwnProperty(key); -}; -exports.typeSafeHasOwnProperty = typeSafeHasOwnProperty; -var isPropertyDefinedAndNotNull = function (target, key) { - return (0, exports.typeSafeHasOwnProperty)(target, key) && target[key] !== null && target[key] !== undefined; -}; -exports.isPropertyDefinedAndNotNull = isPropertyDefinedAndNotNull; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 4812: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 2138: +/***/ ((__unused_webpack_module, exports) => { -module.exports = -{ - parallel : __nccwpck_require__(8210), - serial : __nccwpck_require__(445), - serialOrdered : __nccwpck_require__(3578) -}; +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 1700: -/***/ ((module) => { +/***/ 232: +/***/ ((__unused_webpack_module, exports) => { -// API -module.exports = abort; +"use strict"; -/** - * Aborts leftover active jobs - * - * @param {object} state - current state object - */ -function abort(state) -{ - Object.keys(state.jobs).forEach(clean.bind(state)); +Object.defineProperty(exports, "__esModule", ({ value: true })); - // reset leftover jobs - state.jobs = {}; -} -/** - * Cleans up leftover job by invoking abort function for the provided job id - * - * @this state - * @param {string|number} key - job id to abort - */ -function clean(key) -{ - if (typeof this.jobs[key] == 'function') - { - this.jobs[key](); - } -} +/***/ }), +/***/ 2054: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { -/***/ }), +"use strict"; -/***/ 2794: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +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 __generator = (this && this.__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 }; + } +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.resolveSpaceId = void 0; +var apiLocation_1 = __nccwpck_require__(7083); +var knownSpaces = {}; +function resolveSpaceId(client, spaceName) { + return __awaiter(this, void 0, void 0, function () { + var spaces, spaceId; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (knownSpaces[spaceName]) { + return [2 /*return*/, knownSpaces[spaceName]]; + } + client.debug("Resolving space from name '".concat(spaceName, "'")); + return [4 /*yield*/, client.get("".concat(apiLocation_1.apiLocation, "/spaces"), { partialName: spaceName })]; + case 1: + spaces = _a.sent(); + spaceId = ""; + if (spaces.TotalResults === 0) { + client.error("No spaces exist with name '".concat(spaceName, "'")); + throw new Error("No spaces exist with name '".concat(spaceName, "'")); + } + spaces.Items.forEach(function (space) { + if (space.Name == spaceName) { + spaceId = space.Id; + knownSpaces[spaceName] = spaceId; + client.debug("Resolved space name '".concat(spaceName, "' to Id ").concat(spaceId)); + } + }); + if (spaceId === "") { + client.error("Unable to resolve space name '".concat(spaceName, "'")); + throw new Error("Unable to resolve space name '".concat(spaceName, "'")); + } + return [2 /*return*/, spaceId]; + } + }); + }); +} +exports.resolveSpaceId = resolveSpaceId; -var defer = __nccwpck_require__(5295); -// API -module.exports = async; +/***/ }), -/** - * Runs provided callback asynchronously - * even if callback itself is not - * - * @param {function} callback - callback to invoke - * @returns {function} - augmented callback - */ -function async(callback) -{ - var isAsync = false; +/***/ 5626: +/***/ ((__unused_webpack_module, exports) => { - // check if async happened - defer(function() { isAsync = true; }); +"use strict"; - return function async_callback(err, result) - { - if (isAsync) - { - callback(err, result); - } - else - { - defer(function nextTick_callback() - { - callback(err, result); - }); - } - }; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSpaceScopedArgs = void 0; +function isSpaceScopedArgs(args) { + return "spaceName" in args; } +exports.isSpaceScopedArgs = isSpaceScopedArgs; /***/ }), -/***/ 5295: -/***/ ((module) => { - -module.exports = defer; +/***/ 3667: +/***/ ((__unused_webpack_module, exports) => { -/** - * Runs provided function on next iteration of the event loop - * - * @param {function} fn - function to run - */ -function defer(fn) -{ - var nextTick = typeof setImmediate == 'function' - ? setImmediate - : ( - typeof process == 'object' && typeof process.nextTick == 'function' - ? process.nextTick - : null - ); +"use strict"; - if (nextTick) - { - nextTick(fn); - } - else - { - setTimeout(fn, 0); - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSpaceScopedOperation = void 0; +function isSpaceScopedOperation(command) { + return "spaceName" in command; } +exports.isSpaceScopedOperation = isSpaceScopedOperation; /***/ }), -/***/ 9023: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 3295: +/***/ ((__unused_webpack_module, exports) => { -var async = __nccwpck_require__(2794) - , abort = __nccwpck_require__(1700) - ; +"use strict"; -// API -module.exports = iterate; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSpaceScopedRequest = void 0; +function isSpaceScopedRequest(command) { + return "spaceName" in command; +} +exports.isSpaceScopedRequest = isSpaceScopedRequest; -/** - * Iterates over each job object - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {object} state - current job status - * @param {function} callback - invoked when all elements processed - */ -function iterate(list, iterator, state, callback) -{ - // store current index - var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; - state.jobs[key] = runJob(iterator, key, list[key], function(error, output) - { - // don't repeat yourself - // skip secondary callbacks - if (!(key in state.jobs)) - { - return; - } +/***/ }), - // clean up jobs - delete state.jobs[key]; +/***/ 492: +/***/ ((__unused_webpack_module, exports) => { - if (error) - { - // don't process rest of the results - // stop still active jobs - // and reset the list - abort(state); - } - else - { - state.results[key] = output; - } +"use strict"; - // return salvaged results - callback(error, state.results); - }); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSpaceScopedResource = void 0; +function isSpaceScopedResource(resource) { + return "SpaceId" in resource; } +exports.isSpaceScopedResource = isSpaceScopedResource; -/** - * Runs iterator over provided job element - * - * @param {function} iterator - iterator to invoke - * @param {string|number} key - key/index of the element in the list of jobs - * @param {mixed} item - job description - * @param {function} callback - invoked after iterator is done with the job - * @returns {function|mixed} - job abort function or something else - */ -function runJob(iterator, key, item, callback) -{ - var aborter; - // allow shortcut if iterator expects only two arguments - if (iterator.length == 2) - { - aborter = iterator(item, async(callback)); - } - // otherwise go with full three arguments - else - { - aborter = iterator(item, key, async(callback)); - } +/***/ }), - return aborter; -} +/***/ 7218: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.spaceScopedRoutePrefix = void 0; +var apiLocation_1 = __nccwpck_require__(7083); +exports.spaceScopedRoutePrefix = "".concat(apiLocation_1.apiLocation, "/{spaceId}"); /***/ }), -/***/ 2474: -/***/ ((module) => { +/***/ 1547: +/***/ ((__unused_webpack_module, 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 - } - ; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SubscriptionRecord = void 0; +var SubscriptionRecord = /** @class */ (function () { + function SubscriptionRecord() { + this.subscriptions = {}; + } + SubscriptionRecord.prototype.subscribe = function (registrationName, callback) { + var _this = this; + this.subscriptions[registrationName] = callback; + return function () { return _this.unsubscribe(registrationName); }; + }; + SubscriptionRecord.prototype.unsubscribe = function (registrationName) { + delete this.subscriptions[registrationName]; + }; + SubscriptionRecord.prototype.notify = function (predicate, data) { + var _this = this; + Object.keys(this.subscriptions) + .filter(predicate) + .forEach(function (key) { return _this.subscriptions[key](data); }); + }; + SubscriptionRecord.prototype.notifyAll = function (data) { + this.notify(function () { return true; }, data); + }; + SubscriptionRecord.prototype.notifySingle = function (registrationName, data) { + if (registrationName in this.subscriptions) { + this.subscriptions[registrationName](data); + } + }; + return SubscriptionRecord; +}()); +exports.SubscriptionRecord = SubscriptionRecord; - 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; -} +/***/ }), + +/***/ 7132: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isPropertyDefinedAndNotNull = exports.typeSafeHasOwnProperty = exports.ensureSuffix = exports.ensurePrefix = exports.determineServerEndpoint = exports.getResolver = exports.getServerEndpoint = exports.getQueryValue = void 0; +var lodash_1 = __nccwpck_require__(250); +var urijs_1 = __importDefault(__nccwpck_require__(4190)); +var resolver_1 = __nccwpck_require__(8043); +var getQueryValue = function (key, location) { + var result; + (0, urijs_1.default)(location).hasQuery(key, function (value) { + result = value; + }); + return result; +}; +exports.getQueryValue = getQueryValue; +var getServerEndpoint = function (location) { + if (location === void 0) { location = window.location; } + return (0, exports.getQueryValue)("octopus.server", location.href) || (0, exports.determineServerEndpoint)(location); +}; +exports.getServerEndpoint = getServerEndpoint; +var getResolver = function (base) { + var resolver = new resolver_1.Resolver(base); + return resolver.resolve.bind(resolver); +}; +exports.getResolver = getResolver; +var determineServerEndpoint = function (location) { + var endpoint = (0, exports.ensureSuffix)("//", "" + location.protocol) + location.host; + var path = (0, exports.ensurePrefix)("/", location.pathname); + if (path.length >= 1) { + var lastSegmentIndex = path.lastIndexOf("/"); + if (lastSegmentIndex >= 0) { + path = path.substring(0, lastSegmentIndex + 1); + } + } + endpoint = endpoint + path; + return endpoint; +}; +exports.determineServerEndpoint = determineServerEndpoint; +exports.ensurePrefix = (0, lodash_1.curry)(function (prefix, value) { return (!value.startsWith(prefix) ? "".concat(prefix).concat(value) : value); }); +exports.ensureSuffix = (0, lodash_1.curry)(function (suffix, value) { return (!value.endsWith(suffix) ? "".concat(value).concat(suffix) : value); }); +var typeSafeHasOwnProperty = function (target, key) { + return target.hasOwnProperty(key); +}; +exports.typeSafeHasOwnProperty = typeSafeHasOwnProperty; +var isPropertyDefinedAndNotNull = function (target, key) { + return (0, exports.typeSafeHasOwnProperty)(target, key) && target[key] !== null && target[key] !== undefined; +}; +exports.isPropertyDefinedAndNotNull = isPropertyDefinedAndNotNull; /***/ }), -/***/ 7942: +/***/ 6761: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var abort = __nccwpck_require__(1700) - , async = __nccwpck_require__(2794) - ; +const Utils = __nccwpck_require__(5182); +const pth = __nccwpck_require__(1017); +const ZipEntry = __nccwpck_require__(4057); +const ZipFile = __nccwpck_require__(7744); + +const get_Bool = (val, def) => (typeof val === "boolean" ? val : def); +const get_Str = (val, def) => (typeof val === "string" ? val : def); + +const defaultOptions = { + // option "noSort" : if true it disables files sorting + noSort: false, + // read entries during load (initial loading may be slower) + readEntries: false, + // default method is none + method: Utils.Constants.NONE, + // file system + fs: null +}; -// API -module.exports = terminator; +module.exports = function (/**String*/ input, /** object */ options) { + let inBuffer = null; -/** - * Terminates jobs in the attached state context - * - * @this AsyncKitState# - * @param {function} callback - final callback to invoke after termination - */ -function terminator(callback) -{ - if (!Object.keys(this.jobs).length) - { - return; - } - - // fast forward iteration index - this.index = this.size; + // create object based default options, allowing them to be overwritten + const opts = Object.assign(Object.create(null), defaultOptions); - // abort jobs - abort(this); + // test input variable + if (input && "object" === typeof input) { + // if value is not buffer we accept it to be object with options + if (!(input instanceof Uint8Array)) { + Object.assign(opts, input); + input = opts.input ? opts.input : undefined; + if (opts.input) delete opts.input; + } - // send back results we have so far - async(callback)(null, this.results); -} + // if input is buffer + if (Buffer.isBuffer(input)) { + inBuffer = input; + opts.method = Utils.Constants.BUFFER; + input = undefined; + } + } + // assign options + Object.assign(opts, options); -/***/ }), + // instanciate utils filesystem + const filetools = new Utils(opts); -/***/ 8210: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // if input is file name we retrieve its content + if (input && "string" === typeof input) { + // load zip file + if (filetools.fs.existsSync(input)) { + opts.method = Utils.Constants.FILE; + opts.filename = input; + inBuffer = filetools.fs.readFileSync(input); + } else { + throw new Error(Utils.Errors.INVALID_FILENAME); + } + } -var iterate = __nccwpck_require__(9023) - , initState = __nccwpck_require__(2474) - , terminator = __nccwpck_require__(7942) - ; + // create variable + const _zip = new ZipFile(inBuffer, opts); -// Public API -module.exports = parallel; + const { canonical, sanitize } = Utils; -/** - * Runs iterator over provided array elements in parallel - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function parallel(list, iterator, callback) -{ - var state = initState(list); + function getEntry(/**Object*/ entry) { + if (entry && _zip) { + var item; + // If entry was given as a file name + if (typeof entry === "string") item = _zip.getEntry(entry); + // if entry was given as a ZipEntry object + if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined") item = _zip.getEntry(entry.entryName); - while (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, function(error, result) - { - if (error) - { - callback(error, result); - return; - } + if (item) { + return item; + } + } + return null; + } - // looks like it's the last one - if (Object.keys(state.jobs).length === 0) - { - callback(null, state.results); - return; - } - }); + function fixPath(zipPath) { + const { join, normalize, sep } = pth.posix; + // convert windows file separators and normalize + return join(".", normalize(sep + zipPath.split("\\").join(sep) + sep)); + } - state.index++; - } + return { + /** + * Extracts the given entry from the archive and returns the content as a Buffer object + * @param entry ZipEntry object or String with the full path of the entry + * + * @return Buffer or Null in case of error + */ + readFile: function (/**Object*/ entry, /*String, Buffer*/ pass) { + var item = getEntry(entry); + return (item && item.getData(pass)) || null; + }, - return terminator.bind(state, callback); -} + /** + * Asynchronous readFile + * @param entry ZipEntry object or String with the full path of the entry + * @param callback + * + * @return Buffer or Null in case of error + */ + readFileAsync: function (/**Object*/ entry, /**Function*/ callback) { + var item = getEntry(entry); + if (item) { + item.getDataAsync(callback); + } else { + callback(null, "getEntry failed for:" + entry); + } + }, + /** + * Extracts the given entry from the archive and returns the content as plain text in the given encoding + * @param entry ZipEntry object or String with the full path of the entry + * @param encoding Optional. If no encoding is specified utf8 is used + * + * @return String + */ + readAsText: function (/**Object*/ entry, /**String=*/ encoding) { + var item = getEntry(entry); + if (item) { + var data = item.getData(); + if (data && data.length) { + return data.toString(encoding || "utf8"); + } + } + return ""; + }, -/***/ }), + /** + * Asynchronous readAsText + * @param entry ZipEntry object or String with the full path of the entry + * @param callback + * @param encoding Optional. If no encoding is specified utf8 is used + * + * @return String + */ + readAsTextAsync: function (/**Object*/ entry, /**Function*/ callback, /**String=*/ encoding) { + var item = getEntry(entry); + if (item) { + item.getDataAsync(function (data, err) { + if (err) { + callback(data, err); + return; + } -/***/ 445: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (data && data.length) { + callback(data.toString(encoding || "utf8")); + } else { + callback(""); + } + }); + } else { + callback(""); + } + }, -var serialOrdered = __nccwpck_require__(3578); + /** + * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory + * + * @param entry + */ + deleteFile: function (/**Object*/ entry) { + // @TODO: test deleteFile + var item = getEntry(entry); + if (item) { + _zip.deleteEntry(item.entryName); + } + }, -// Public API -module.exports = serial; + /** + * Adds a comment to the zip. The zip must be rewritten after adding the comment. + * + * @param comment + */ + addZipComment: function (/**String*/ comment) { + // @TODO: test addZipComment + _zip.comment = comment; + }, -/** - * Runs iterator over provided array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serial(list, iterator, callback) -{ - return serialOrdered(list, iterator, null, callback); -} + /** + * Returns the zip comment + * + * @return String + */ + getZipComment: function () { + return _zip.comment || ""; + }, + /** + * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment + * The comment cannot exceed 65535 characters in length + * + * @param entry + * @param comment + */ + addZipEntryComment: function (/**Object*/ entry, /**String*/ comment) { + var item = getEntry(entry); + if (item) { + item.comment = comment; + } + }, -/***/ }), + /** + * Returns the comment of the specified entry + * + * @param entry + * @return String + */ + getZipEntryComment: function (/**Object*/ entry) { + var item = getEntry(entry); + if (item) { + return item.comment || ""; + } + return ""; + }, -/***/ 3578: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + /** + * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content + * + * @param entry + * @param content + */ + updateFile: function (/**Object*/ entry, /**Buffer*/ content) { + var item = getEntry(entry); + if (item) { + item.setData(content); + } + }, -var iterate = __nccwpck_require__(9023) - , initState = __nccwpck_require__(2474) - , terminator = __nccwpck_require__(7942) - ; + /** + * Adds a file from the disk to the archive + * + * @param localPath File to add to zip + * @param zipPath Optional path inside the zip + * @param zipName Optional name for the file + */ + addLocalFile: function (/**String*/ localPath, /**String=*/ zipPath, /**String=*/ zipName, /**String*/ comment) { + if (filetools.fs.existsSync(localPath)) { + // fix ZipPath + zipPath = zipPath ? fixPath(zipPath) : ""; -// Public API -module.exports = serialOrdered; -// sorting helpers -module.exports.ascending = ascending; -module.exports.descending = descending; + // p - local file name + var p = localPath.split("\\").join("/").split("/").pop(); -/** - * Runs iterator over provided sorted array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} sortMethod - custom sort function - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serialOrdered(list, iterator, sortMethod, callback) -{ - var state = initState(list, sortMethod); + // add file name into zippath + zipPath += zipName ? zipName : p; - iterate(list, iterator, state, function iteratorHandler(error, result) - { - if (error) - { - callback(error, result); - return; - } + // read file attributes + const _attr = filetools.fs.statSync(localPath); - state.index++; + // add file into zip file + this.addFile(zipPath, filetools.fs.readFileSync(localPath), comment, _attr); + } else { + throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); + } + }, - // are we there yet? - if (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, iteratorHandler); - return; - } + /** + * Adds a local directory and all its nested files and directories to the archive + * + * @param localPath + * @param zipPath optional path inside zip + * @param filter optional RegExp or Function if files match will + * be included. + */ + addLocalFolder: function (/**String*/ localPath, /**String=*/ zipPath, /**=RegExp|Function*/ filter) { + // Prepare filter + if (filter instanceof RegExp) { + // if filter is RegExp wrap it + filter = (function (rx) { + return function (filename) { + return rx.test(filename); + }; + })(filter); + } else if ("function" !== typeof filter) { + // if filter is not function we will replace it + filter = function () { + return true; + }; + } - // done here - callback(null, state.results); - }); + // fix ZipPath + zipPath = zipPath ? fixPath(zipPath) : ""; + + // normalize the path first + localPath = pth.normalize(localPath); + + if (filetools.fs.existsSync(localPath)) { + const items = filetools.findFiles(localPath); + const self = this; + + if (items.length) { + items.forEach(function (filepath) { + var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix + if (filter(p)) { + var stats = filetools.fs.statSync(filepath); + if (stats.isFile()) { + self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), "", stats); + } else { + self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats); + } + } + }); + } + } else { + throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); + } + }, - return terminator.bind(state, callback); -} + /** + * Asynchronous addLocalFile + * @param localPath + * @param callback + * @param zipPath optional path inside zip + * @param filter optional RegExp or Function if files match will + * be included. + */ + addLocalFolderAsync: function (/*String*/ localPath, /*Function*/ callback, /*String*/ zipPath, /*RegExp|Function*/ filter) { + if (filter instanceof RegExp) { + filter = (function (rx) { + return function (filename) { + return rx.test(filename); + }; + })(filter); + } else if ("function" !== typeof filter) { + filter = function () { + return true; + }; + } -/* - * -- Sort methods - */ + // fix ZipPath + zipPath = zipPath ? fixPath(zipPath) : ""; + + // normalize the path first + localPath = pth.normalize(localPath); + + var self = this; + filetools.fs.open(localPath, "r", function (err) { + if (err && err.code === "ENOENT") { + callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); + } else if (err) { + callback(undefined, err); + } else { + var items = filetools.findFiles(localPath); + var i = -1; + + var next = function () { + i += 1; + if (i < items.length) { + var filepath = items[i]; + var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix + p = p + .normalize("NFD") + .replace(/[\u0300-\u036f]/g, "") + .replace(/[^\x20-\x7E]/g, ""); // accent fix + if (filter(p)) { + filetools.fs.stat(filepath, function (er0, stats) { + if (er0) callback(undefined, er0); + if (stats.isFile()) { + filetools.fs.readFile(filepath, function (er1, data) { + if (er1) { + callback(undefined, er1); + } else { + self.addFile(zipPath + p, data, "", stats); + next(); + } + }); + } else { + self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats); + next(); + } + }); + } else { + next(); + } + } else { + callback(true, undefined); + } + }; -/** - * sort helper to sort array elements in ascending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function ascending(a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} + next(); + } + }); + }, -/** - * sort helper to sort array elements in descending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function descending(a, b) -{ - return -1 * ascending(a, b); -} + /** + * + * @param {string} localPath - path where files will be extracted + * @param {object} props - optional properties + * @param {string} props.zipPath - optional path inside zip + * @param {regexp, function} props.filter - RegExp or Function if files match will be included. + */ + addLocalFolderPromise: function (/*String*/ localPath, /* object */ props) { + return new Promise((resolve, reject) => { + const { filter, zipPath } = Object.assign({}, props); + this.addLocalFolderAsync( + localPath, + (done, err) => { + if (err) reject(err); + if (done) resolve(this); + }, + zipPath, + filter + ); + }); + }, + /** + * Allows you to create a entry (file or directory) in the zip file. + * If you want to create a directory the entryName must end in / and a null buffer should be provided. + * Comment and attributes are optional + * + * @param {string} entryName + * @param {Buffer | string} content - file content as buffer or utf8 coded string + * @param {string} comment - file comment + * @param {number | object} attr - number as unix file permissions, object as filesystem Stats object + */ + addFile: function (/**String*/ entryName, /**Buffer*/ content, /**String*/ comment, /**Number*/ attr) { + let entry = getEntry(entryName); + const update = entry != null; + + // prepare new entry + if (!update) { + entry = new ZipEntry(); + entry.entryName = entryName; + } + entry.comment = comment || ""; -/***/ }), + const isStat = "object" === typeof attr && attr instanceof filetools.fs.Stats; -/***/ 6545: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // last modification time from file stats + if (isStat) { + entry.header.time = attr.mtime; + } -module.exports = __nccwpck_require__(2618); + // Set file attribute + var fileattr = entry.isDirectory ? 0x10 : 0; // (MS-DOS directory flag) + + // extended attributes field for Unix + if (!Utils.isWin) { + // set file type either S_IFDIR / S_IFREG + let unix = entry.isDirectory ? 0x4000 : 0x8000; + + if (isStat) { + // File attributes from file stats + unix |= 0xfff & attr.mode; + } else if ("number" === typeof attr) { + // attr from given attr values + unix |= 0xfff & attr; + } else { + // Default values: + unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--) + } -/***/ }), + fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes + } -/***/ 8104: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + entry.attr = fileattr; -"use strict"; + entry.setData(content); + if (!update) _zip.setEntry(entry); + }, + /** + * Returns an array of ZipEntry objects representing the files and folders inside the archive + * + * @return Array + */ + getEntries: function () { + return _zip ? _zip.entries : []; + }, -var utils = __nccwpck_require__(328); -var settle = __nccwpck_require__(3211); -var buildFullPath = __nccwpck_require__(1934); -var buildURL = __nccwpck_require__(646); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var httpFollow = (__nccwpck_require__(7707).http); -var httpsFollow = (__nccwpck_require__(7707).https); -var url = __nccwpck_require__(7310); -var zlib = __nccwpck_require__(9796); -var VERSION = (__nccwpck_require__(4322).version); -var transitionalDefaults = __nccwpck_require__(936); -var AxiosError = __nccwpck_require__(2093); -var CanceledError = __nccwpck_require__(4098); + /** + * Returns a ZipEntry object representing the file or folder specified by ``name``. + * + * @param name + * @return ZipEntry + */ + getEntry: function (/**String*/ name) { + return getEntry(name); + }, -var isHttps = /https:?/; + getEntryCount: function () { + return _zip.getEntryCount(); + }, -var supportedProtocols = [ 'http:', 'https:', 'file:' ]; + forEach: function (callback) { + return _zip.forEach(callback); + }, -/** - * - * @param {http.ClientRequestArgs} options - * @param {AxiosProxyConfig} proxy - * @param {string} location - */ -function setProxy(options, proxy, location) { - options.hostname = proxy.host; - options.host = proxy.host; - options.port = proxy.port; - options.path = location; + /** + * Extracts the given entry to the given targetPath + * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted + * + * @param entry ZipEntry object or String with the full path of the entry + * @param targetPath Target folder where to write the file + * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder + * will be created in targetPath as well. Default is TRUE + * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. + * Default is FALSE + * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. + * Default is FALSE + * @param outFileName String If set will override the filename of the extracted file (Only works if the entry is a file) + * + * @return Boolean + */ + extractEntryTo: function ( + /**Object*/ entry, + /**String*/ targetPath, + /**Boolean*/ maintainEntryPath, + /**Boolean*/ overwrite, + /**Boolean*/ keepOriginalPermission, + /**String**/ outFileName + ) { + overwrite = get_Bool(overwrite, false); + keepOriginalPermission = get_Bool(keepOriginalPermission, false); + maintainEntryPath = get_Bool(maintainEntryPath, true); + outFileName = get_Str(outFileName, get_Str(keepOriginalPermission, undefined)); + + var item = getEntry(entry); + if (!item) { + throw new Error(Utils.Errors.NO_ENTRY); + } - // Basic proxy authorization - if (proxy.auth) { - var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); - options.headers['Proxy-Authorization'] = 'Basic ' + base64; - } + var entryName = canonical(item.entryName); - // If a proxy is used, any redirects must also pass through the proxy - options.beforeRedirect = function beforeRedirect(redirection) { - redirection.headers.host = redirection.host; - setProxy(redirection, proxy, redirection.href); - }; -} + var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName)); -/*eslint consistent-return:0*/ -module.exports = function httpAdapter(config) { - return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { - var onCanceled; - function done() { - if (config.cancelToken) { - config.cancelToken.unsubscribe(onCanceled); - } + if (item.isDirectory) { + var children = _zip.getEntryChildren(item); + children.forEach(function (child) { + if (child.isDirectory) return; + var content = child.getData(); + if (!content) { + throw new Error(Utils.Errors.CANT_EXTRACT_FILE); + } + var name = canonical(child.entryName); + var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name)); + // The reverse operation for attr depend on method addFile() + const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined; + filetools.writeFileTo(childName, content, overwrite, fileAttr); + }); + return true; + } - if (config.signal) { - config.signal.removeEventListener('abort', onCanceled); - } - } - var resolve = function resolve(value) { - done(); - resolvePromise(value); - }; - var rejected = false; - var reject = function reject(value) { - done(); - rejected = true; - rejectPromise(value); - }; - var data = config.data; - var headers = config.headers; - var headerNames = {}; + var content = item.getData(); + if (!content) throw new Error(Utils.Errors.CANT_EXTRACT_FILE); - Object.keys(headers).forEach(function storeLowerName(name) { - headerNames[name.toLowerCase()] = name; - }); + if (filetools.fs.existsSync(target) && !overwrite) { + throw new Error(Utils.Errors.CANT_OVERRIDE); + } + // The reverse operation for attr depend on method addFile() + const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; + filetools.writeFileTo(target, content, overwrite, fileAttr); - // Set User-Agent (required by some servers) - // See https://github.com/axios/axios/issues/69 - if ('user-agent' in headerNames) { - // User-Agent is specified; handle case where no UA header is desired - if (!headers[headerNames['user-agent']]) { - delete headers[headerNames['user-agent']]; - } - // Otherwise, use specified value - } else { - // Only set header if it hasn't been set in config - headers['User-Agent'] = 'axios/' + VERSION; - } + return true; + }, - // support for https://www.npmjs.com/package/form-data api - if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) { - Object.assign(headers, data.getHeaders()); - } else if (data && !utils.isStream(data)) { - if (Buffer.isBuffer(data)) { - // Nothing to do... - } else if (utils.isArrayBuffer(data)) { - data = Buffer.from(new Uint8Array(data)); - } else if (utils.isString(data)) { - data = Buffer.from(data, 'utf-8'); - } else { - return reject(new AxiosError( - 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', - AxiosError.ERR_BAD_REQUEST, - config - )); - } + /** + * Test the archive + * + */ + test: function (pass) { + if (!_zip) { + return false; + } - if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { - return reject(new AxiosError( - 'Request body larger than maxBodyLength limit', - AxiosError.ERR_BAD_REQUEST, - config - )); - } + for (var entry in _zip.entries) { + try { + if (entry.isDirectory) { + continue; + } + var content = _zip.entries[entry].getData(pass); + if (!content) { + return false; + } + } catch (err) { + return false; + } + } + return true; + }, - // Add Content-Length header if data exists - if (!headerNames['content-length']) { - headers['Content-Length'] = data.length; - } - } + /** + * Extracts the entire archive to the given location + * + * @param targetPath Target location + * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. + * Default is FALSE + * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. + * Default is FALSE + */ + extractAllTo: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /*String, Buffer*/ pass) { + overwrite = get_Bool(overwrite, false); + pass = get_Str(keepOriginalPermission, pass); + keepOriginalPermission = get_Bool(keepOriginalPermission, false); + if (!_zip) { + throw new Error(Utils.Errors.NO_ZIP); + } + _zip.entries.forEach(function (entry) { + var entryName = sanitize(targetPath, canonical(entry.entryName.toString())); + if (entry.isDirectory) { + filetools.makeDir(entryName); + return; + } + var content = entry.getData(pass); + if (!content) { + throw new Error(Utils.Errors.CANT_EXTRACT_FILE); + } + // The reverse operation for attr depend on method addFile() + const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; + filetools.writeFileTo(entryName, content, overwrite, fileAttr); + try { + filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time); + } catch (err) { + throw new Error(Utils.Errors.CANT_EXTRACT_FILE); + } + }); + }, - // HTTP basic authentication - var auth = undefined; - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password || ''; - auth = username + ':' + password; - } + /** + * Asynchronous extractAllTo + * + * @param targetPath Target location + * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. + * Default is FALSE + * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. + * Default is FALSE + * @param callback The callback will be executed when all entries are extracted successfully or any error is thrown. + */ + extractAllToAsync: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /**Function*/ callback) { + if (!callback) { + callback = function () {}; + } + overwrite = get_Bool(overwrite, false); + if (typeof keepOriginalPermission === "function" && !callback) callback = keepOriginalPermission; + keepOriginalPermission = get_Bool(keepOriginalPermission, false); + if (!_zip) { + callback(new Error(Utils.Errors.NO_ZIP)); + return; + } - // Parse url - var fullPath = buildFullPath(config.baseURL, config.url); - var parsed = url.parse(fullPath); - var protocol = parsed.protocol || supportedProtocols[0]; + targetPath = pth.resolve(targetPath); + // convert entryName to + const getPath = (entry) => sanitize(targetPath, pth.normalize(canonical(entry.entryName.toString()))); + const getError = (msg, file) => new Error(msg + ': "' + file + '"'); + + // separate directories from files + const dirEntries = []; + const fileEntries = new Set(); + _zip.entries.forEach((e) => { + if (e.isDirectory) { + dirEntries.push(e); + } else { + fileEntries.add(e); + } + }); - if (supportedProtocols.indexOf(protocol) === -1) { - return reject(new AxiosError( - 'Unsupported protocol ' + protocol, - AxiosError.ERR_BAD_REQUEST, - config - )); - } + // Create directory entries first synchronously + // this prevents race condition and assures folders are there before writing files + for (const entry of dirEntries) { + const dirPath = getPath(entry); + // The reverse operation for attr depend on method addFile() + const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; + try { + filetools.makeDir(dirPath); + if (dirAttr) filetools.fs.chmodSync(dirPath, dirAttr); + // in unix timestamp will change if files are later added to folder, but still + filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); + } catch (er) { + callback(getError("Unable to create folder", dirPath)); + } + } - if (!auth && parsed.auth) { - var urlAuth = parsed.auth.split(':'); - var urlUsername = urlAuth[0] || ''; - var urlPassword = urlAuth[1] || ''; - auth = urlUsername + ':' + urlPassword; - } + // callback wrapper, for some house keeping + const done = () => { + if (fileEntries.size === 0) { + callback(); + } + }; - if (auth && headerNames.authorization) { - delete headers[headerNames.authorization]; - } + // Extract file entries asynchronously + for (const entry of fileEntries.values()) { + const entryName = pth.normalize(canonical(entry.entryName.toString())); + const filePath = sanitize(targetPath, entryName); + entry.getDataAsync(function (content, err_1) { + if (err_1) { + callback(new Error(err_1)); + return; + } + if (!content) { + callback(new Error(Utils.Errors.CANT_EXTRACT_FILE)); + } else { + // The reverse operation for attr depend on method addFile() + const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; + filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function (succ) { + if (!succ) { + callback(getError("Unable to write file", filePath)); + return; + } + filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function (err_2) { + if (err_2) { + callback(getError("Unable to set times", filePath)); + return; + } + fileEntries.delete(entry); + // call the callback if it was last entry + done(); + }); + }); + } + }); + } + // call the callback if fileEntries was empty + done(); + }, - var isHttpsRequest = isHttps.test(protocol); - var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + /** + * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip + * + * @param targetFileName + * @param callback + */ + writeZip: function (/**String*/ targetFileName, /**Function*/ callback) { + if (arguments.length === 1) { + if (typeof targetFileName === "function") { + callback = targetFileName; + targetFileName = ""; + } + } - try { - buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''); - } catch (err) { - var customErr = new Error(err.message); - customErr.config = config; - customErr.url = config.url; - customErr.exists = true; - reject(customErr); - } + if (!targetFileName && opts.filename) { + targetFileName = opts.filename; + } + if (!targetFileName) return; - var options = { - path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), - method: config.method.toUpperCase(), - headers: headers, - agent: agent, - agents: { http: config.httpAgent, https: config.httpsAgent }, - auth: auth - }; + var zipData = _zip.compressToBuffer(); + if (zipData) { + var ok = filetools.writeFileTo(targetFileName, zipData, true); + if (typeof callback === "function") callback(!ok ? new Error("failed") : null, ""); + } + }, - if (config.socketPath) { - options.socketPath = config.socketPath; - } else { - options.hostname = parsed.hostname; - options.port = parsed.port; - } + writeZipPromise: function (/**String*/ targetFileName, /* object */ props) { + const { overwrite, perm } = Object.assign({ overwrite: true }, props); - var proxy = config.proxy; - if (!proxy && proxy !== false) { - var proxyEnv = protocol.slice(0, -1) + '_proxy'; - var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; - if (proxyUrl) { - var parsedProxyUrl = url.parse(proxyUrl); - var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; - var shouldProxy = true; + return new Promise((resolve, reject) => { + // find file name + if (!targetFileName && opts.filename) targetFileName = opts.filename; + if (!targetFileName) reject("ADM-ZIP: ZIP File Name Missing"); + + this.toBufferPromise().then((zipData) => { + const ret = (done) => (done ? resolve(done) : reject("ADM-ZIP: Wasn't able to write zip file")); + filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret); + }, reject); + }); + }, - if (noProxyEnv) { - var noProxy = noProxyEnv.split(',').map(function trim(s) { - return s.trim(); - }); + toBufferPromise: function () { + return new Promise((resolve, reject) => { + _zip.toAsyncBuffer(resolve, reject); + }); + }, - shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { - if (!proxyElement) { - return false; - } - if (proxyElement === '*') { - return true; - } - if (proxyElement[0] === '.' && - parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { - return true; + /** + * Returns the content of the entire zip file as a Buffer object + * + * @return Buffer + */ + toBuffer: function (/**Function=*/ onSuccess, /**Function=*/ onFail, /**Function=*/ onItemStart, /**Function=*/ onItemEnd) { + this.valueOf = 2; + if (typeof onSuccess === "function") { + _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd); + return null; } - - return parsed.hostname === proxyElement; - }); + return _zip.compressToBuffer(); } + }; +}; - if (shouldProxy) { - proxy = { - host: parsedProxyUrl.hostname, - port: parsedProxyUrl.port, - protocol: parsedProxyUrl.protocol - }; - - if (parsedProxyUrl.auth) { - var proxyUrlAuth = parsedProxyUrl.auth.split(':'); - proxy.auth = { - username: proxyUrlAuth[0], - password: proxyUrlAuth[1] - }; - } - } - } - } - if (proxy) { - options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); - setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); - } +/***/ }), - var transport; - var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); - if (config.transport) { - transport = config.transport; - } else if (config.maxRedirects === 0) { - transport = isHttpsProxy ? https : http; - } else { - if (config.maxRedirects) { - options.maxRedirects = config.maxRedirects; - } - if (config.beforeRedirect) { - options.beforeRedirect = config.beforeRedirect; - } - transport = isHttpsProxy ? httpsFollow : httpFollow; - } +/***/ 9032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (config.maxBodyLength > -1) { - options.maxBodyLength = config.maxBodyLength; - } +var Utils = __nccwpck_require__(5182), + Constants = Utils.Constants; - if (config.insecureHTTPParser) { - options.insecureHTTPParser = config.insecureHTTPParser; - } +/* The central directory file header */ +module.exports = function () { + var _verMade = 20, // v2.0 + _version = 10, // v1.0 + _flags = 0, + _method = 0, + _time = 0, + _crc = 0, + _compressedSize = 0, + _size = 0, + _fnameLen = 0, + _extraLen = 0, + _comLen = 0, + _diskStart = 0, + _inattr = 0, + _attr = 0, + _offset = 0; + + _verMade |= Utils.isWin ? 0x0a00 : 0x0300; + + // Set EFS flag since filename and comment fields are all by default encoded using UTF-8. + // Without it file names may be corrupted for other apps when file names use unicode chars + _flags |= Constants.FLG_EFS; + + var _dataHeader = {}; + + function setTime(val) { + val = new Date(val); + _time = + (((val.getFullYear() - 1980) & 0x7f) << 25) | // b09-16 years from 1980 + ((val.getMonth() + 1) << 21) | // b05-08 month + (val.getDate() << 16) | // b00-04 hour + // 2 bytes time + (val.getHours() << 11) | // b11-15 hour + (val.getMinutes() << 5) | // b05-10 minute + (val.getSeconds() >> 1); // b00-04 seconds divided by 2 + } + + setTime(+new Date()); - // Create the request - var req = transport.request(options, function handleResponse(res) { - if (req.aborted) return; + return { + get made() { + return _verMade; + }, + set made(val) { + _verMade = val; + }, - // uncompress the response body transparently if required - var stream = res; + get version() { + return _version; + }, + set version(val) { + _version = val; + }, - // return the last request in case of redirects - var lastRequest = res.req || req; + get flags() { + return _flags; + }, + set flags(val) { + _flags = val; + }, + get method() { + return _method; + }, + set method(val) { + switch (val) { + case Constants.STORED: + this.version = 10; + case Constants.DEFLATED: + default: + this.version = 20; + } + _method = val; + }, - // if no content, is HEAD request or decompress disabled we should not decompress - if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { - switch (res.headers['content-encoding']) { - /*eslint default-case:0*/ - case 'gzip': - case 'compress': - case 'deflate': - // add the unzipper to the body stream processing pipeline - stream = stream.pipe(zlib.createUnzip()); + get time() { + return new Date(((_time >> 25) & 0x7f) + 1980, ((_time >> 21) & 0x0f) - 1, (_time >> 16) & 0x1f, (_time >> 11) & 0x1f, (_time >> 5) & 0x3f, (_time & 0x1f) << 1); + }, + set time(val) { + setTime(val); + }, - // remove the content-encoding in order to not confuse downstream operations - delete res.headers['content-encoding']; - break; - } - } + get crc() { + return _crc; + }, + set crc(val) { + _crc = Math.max(0, val) >>> 0; + }, - var response = { - status: res.statusCode, - statusText: res.statusMessage, - headers: res.headers, - config: config, - request: lastRequest - }; + get compressedSize() { + return _compressedSize; + }, + set compressedSize(val) { + _compressedSize = Math.max(0, val) >>> 0; + }, - if (config.responseType === 'stream') { - response.data = stream; - settle(resolve, reject, response); - } else { - var responseBuffer = []; - var totalResponseBytes = 0; - stream.on('data', function handleStreamData(chunk) { - responseBuffer.push(chunk); - totalResponseBytes += chunk.length; + get size() { + return _size; + }, + set size(val) { + _size = Math.max(0, val) >>> 0; + }, - // make sure the content length is not over the maxContentLength if specified - if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { - // stream.destoy() emit aborted event before calling reject() on Node.js v16 - rejected = true; - stream.destroy(); - reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', - AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); - } - }); + get fileNameLength() { + return _fnameLen; + }, + set fileNameLength(val) { + _fnameLen = val; + }, - stream.on('aborted', function handlerStreamAborted() { - if (rejected) { - return; - } - stream.destroy(); - reject(new AxiosError( - 'maxContentLength size of ' + config.maxContentLength + ' exceeded', - AxiosError.ERR_BAD_RESPONSE, - config, - lastRequest - )); - }); + get extraLength() { + return _extraLen; + }, + set extraLength(val) { + _extraLen = val; + }, - stream.on('error', function handleStreamError(err) { - if (req.aborted) return; - reject(AxiosError.from(err, null, config, lastRequest)); - }); + get commentLength() { + return _comLen; + }, + set commentLength(val) { + _comLen = val; + }, - stream.on('end', function handleStreamEnd() { - try { - var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); - if (config.responseType !== 'arraybuffer') { - responseData = responseData.toString(config.responseEncoding); - if (!config.responseEncoding || config.responseEncoding === 'utf8') { - responseData = utils.stripBOM(responseData); - } - } - response.data = responseData; - } catch (err) { - reject(AxiosError.from(err, null, config, response.request, response)); - } - settle(resolve, reject, response); - }); - } - }); + get diskNumStart() { + return _diskStart; + }, + set diskNumStart(val) { + _diskStart = Math.max(0, val) >>> 0; + }, - // Handle errors - req.on('error', function handleRequestError(err) { - // @todo remove - // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; - reject(AxiosError.from(err, null, config, req)); - }); + get inAttr() { + return _inattr; + }, + set inAttr(val) { + _inattr = Math.max(0, val) >>> 0; + }, - // set tcp keep alive to prevent drop connection by peer - req.on('socket', function handleRequestSocket(socket) { - // default interval of sending ack packet is 1 minute - socket.setKeepAlive(true, 1000 * 60); - }); + get attr() { + return _attr; + }, + set attr(val) { + _attr = Math.max(0, val) >>> 0; + }, - // Handle request timeout - if (config.timeout) { - // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. - var timeout = parseInt(config.timeout, 10); + // get Unix file permissions + get fileAttr() { + return _attr ? (((_attr >>> 0) | 0) >> 16) & 0xfff : 0; + }, - if (isNaN(timeout)) { - reject(new AxiosError( - 'error trying to parse `config.timeout` to int', - AxiosError.ERR_BAD_OPTION_VALUE, - config, - req - )); + get offset() { + return _offset; + }, + set offset(val) { + _offset = Math.max(0, val) >>> 0; + }, - return; - } + get encripted() { + return (_flags & 1) === 1; + }, - // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. - // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. - // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. - // And then these socket which be hang up will devoring CPU little by little. - // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. - req.setTimeout(timeout, function handleRequestTimeout() { - req.abort(); - var transitional = config.transitional || transitionalDefaults; - reject(new AxiosError( - 'timeout of ' + timeout + 'ms exceeded', - transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, - config, - req - )); - }); - } + get entryHeaderSize() { + return Constants.CENHDR + _fnameLen + _extraLen + _comLen; + }, - if (config.cancelToken || config.signal) { - // Handle cancellation - // eslint-disable-next-line func-names - onCanceled = function(cancel) { - if (req.aborted) return; + get realDataOffset() { + return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; + }, - req.abort(); - reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel); - }; + get dataHeader() { + return _dataHeader; + }, - config.cancelToken && config.cancelToken.subscribe(onCanceled); - if (config.signal) { - config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); - } - } + loadDataHeaderFromBinary: function (/*Buffer*/ input) { + var data = input.slice(_offset, _offset + Constants.LOCHDR); + // 30 bytes and should start with "PK\003\004" + if (data.readUInt32LE(0) !== Constants.LOCSIG) { + throw new Error(Utils.Errors.INVALID_LOC); + } + _dataHeader = { + // version needed to extract + version: data.readUInt16LE(Constants.LOCVER), + // general purpose bit flag + flags: data.readUInt16LE(Constants.LOCFLG), + // compression method + method: data.readUInt16LE(Constants.LOCHOW), + // modification time (2 bytes time, 2 bytes date) + time: data.readUInt32LE(Constants.LOCTIM), + // uncompressed file crc-32 value + crc: data.readUInt32LE(Constants.LOCCRC), + // compressed size + compressedSize: data.readUInt32LE(Constants.LOCSIZ), + // uncompressed size + size: data.readUInt32LE(Constants.LOCLEN), + // filename length + fnameLen: data.readUInt16LE(Constants.LOCNAM), + // extra field length + extraLen: data.readUInt16LE(Constants.LOCEXT) + }; + }, + loadFromBinary: function (/*Buffer*/ data) { + // data should be 46 bytes and start with "PK 01 02" + if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { + throw new Error(Utils.Errors.INVALID_CEN); + } + // version made by + _verMade = data.readUInt16LE(Constants.CENVEM); + // version needed to extract + _version = data.readUInt16LE(Constants.CENVER); + // encrypt, decrypt flags + _flags = data.readUInt16LE(Constants.CENFLG); + // compression method + _method = data.readUInt16LE(Constants.CENHOW); + // modification time (2 bytes time, 2 bytes date) + _time = data.readUInt32LE(Constants.CENTIM); + // uncompressed file crc-32 value + _crc = data.readUInt32LE(Constants.CENCRC); + // compressed size + _compressedSize = data.readUInt32LE(Constants.CENSIZ); + // uncompressed size + _size = data.readUInt32LE(Constants.CENLEN); + // filename length + _fnameLen = data.readUInt16LE(Constants.CENNAM); + // extra field length + _extraLen = data.readUInt16LE(Constants.CENEXT); + // file comment length + _comLen = data.readUInt16LE(Constants.CENCOM); + // volume number start + _diskStart = data.readUInt16LE(Constants.CENDSK); + // internal file attributes + _inattr = data.readUInt16LE(Constants.CENATT); + // external file attributes + _attr = data.readUInt32LE(Constants.CENATX); + // LOC header offset + _offset = data.readUInt32LE(Constants.CENOFF); + }, - // Send the request - if (utils.isStream(data)) { - data.on('error', function handleStreamError(err) { - reject(AxiosError.from(err, config, null, req)); - }).pipe(req); - } else { - req.end(data); - } - }); + dataHeaderToBinary: function () { + // LOC header size (30 bytes) + var data = Buffer.alloc(Constants.LOCHDR); + // "PK\003\004" + data.writeUInt32LE(Constants.LOCSIG, 0); + // version needed to extract + data.writeUInt16LE(_version, Constants.LOCVER); + // general purpose bit flag + data.writeUInt16LE(_flags, Constants.LOCFLG); + // compression method + data.writeUInt16LE(_method, Constants.LOCHOW); + // modification time (2 bytes time, 2 bytes date) + data.writeUInt32LE(_time, Constants.LOCTIM); + // uncompressed file crc-32 value + data.writeUInt32LE(_crc, Constants.LOCCRC); + // compressed size + data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); + // uncompressed size + data.writeUInt32LE(_size, Constants.LOCLEN); + // filename length + data.writeUInt16LE(_fnameLen, Constants.LOCNAM); + // extra field length + data.writeUInt16LE(_extraLen, Constants.LOCEXT); + return data; + }, + + entryHeaderToBinary: function () { + // CEN header size (46 bytes) + var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen); + // "PK\001\002" + data.writeUInt32LE(Constants.CENSIG, 0); + // version made by + data.writeUInt16LE(_verMade, Constants.CENVEM); + // version needed to extract + data.writeUInt16LE(_version, Constants.CENVER); + // encrypt, decrypt flags + data.writeUInt16LE(_flags, Constants.CENFLG); + // compression method + data.writeUInt16LE(_method, Constants.CENHOW); + // modification time (2 bytes time, 2 bytes date) + data.writeUInt32LE(_time, Constants.CENTIM); + // uncompressed file crc-32 value + data.writeUInt32LE(_crc, Constants.CENCRC); + // compressed size + data.writeUInt32LE(_compressedSize, Constants.CENSIZ); + // uncompressed size + data.writeUInt32LE(_size, Constants.CENLEN); + // filename length + data.writeUInt16LE(_fnameLen, Constants.CENNAM); + // extra field length + data.writeUInt16LE(_extraLen, Constants.CENEXT); + // file comment length + data.writeUInt16LE(_comLen, Constants.CENCOM); + // volume number start + data.writeUInt16LE(_diskStart, Constants.CENDSK); + // internal file attributes + data.writeUInt16LE(_inattr, Constants.CENATT); + // external file attributes + data.writeUInt32LE(_attr, Constants.CENATX); + // LOC header offset + data.writeUInt32LE(_offset, Constants.CENOFF); + // fill all with + data.fill(0x00, Constants.CENHDR); + return data; + }, + + toJSON: function () { + const bytes = function (nr) { + return nr + " bytes"; + }; + + return { + made: _verMade, + version: _version, + flags: _flags, + method: Utils.methodToString(_method), + time: this.time, + crc: "0x" + _crc.toString(16).toUpperCase(), + compressedSize: bytes(_compressedSize), + size: bytes(_size), + fileNameLength: bytes(_fnameLen), + extraLength: bytes(_extraLen), + commentLength: bytes(_comLen), + diskNumStart: _diskStart, + inAttr: _inattr, + attr: _attr, + offset: _offset, + entryHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen) + }; + }, + + toString: function () { + return JSON.stringify(this.toJSON(), null, "\t"); + } + }; }; /***/ }), -/***/ 3454: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 4958: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -"use strict"; +exports.EntryHeader = __nccwpck_require__(9032); +exports.MainHeader = __nccwpck_require__(4408); -var utils = __nccwpck_require__(328); -var settle = __nccwpck_require__(3211); -var cookies = __nccwpck_require__(1545); -var buildURL = __nccwpck_require__(646); -var buildFullPath = __nccwpck_require__(1934); -var parseHeaders = __nccwpck_require__(6455); -var isURLSameOrigin = __nccwpck_require__(3608); -var transitionalDefaults = __nccwpck_require__(936); -var AxiosError = __nccwpck_require__(2093); -var CanceledError = __nccwpck_require__(4098); -var parseProtocol = __nccwpck_require__(6107); +/***/ }), -module.exports = function xhrAdapter(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - var requestData = config.data; - var requestHeaders = config.headers; - var responseType = config.responseType; - var onCanceled; - function done() { - if (config.cancelToken) { - config.cancelToken.unsubscribe(onCanceled); - } - - if (config.signal) { - config.signal.removeEventListener('abort', onCanceled); - } - } +/***/ 4408: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) { - delete requestHeaders['Content-Type']; // Let the browser set it - } +var Utils = __nccwpck_require__(5182), + Constants = Utils.Constants; - var request = new XMLHttpRequest(); +/* The entries in the end of central directory */ +module.exports = function () { + var _volumeEntries = 0, + _totalEntries = 0, + _size = 0, + _offset = 0, + _commentLength = 0; - // HTTP basic authentication - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); - } + return { + get diskEntries() { + return _volumeEntries; + }, + set diskEntries(/*Number*/ val) { + _volumeEntries = _totalEntries = val; + }, - var fullPath = buildFullPath(config.baseURL, config.url); + get totalEntries() { + return _totalEntries; + }, + set totalEntries(/*Number*/ val) { + _totalEntries = _volumeEntries = val; + }, - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + get size() { + return _size; + }, + set size(/*Number*/ val) { + _size = val; + }, - // Set the request timeout in MS - request.timeout = config.timeout; + get offset() { + return _offset; + }, + set offset(/*Number*/ val) { + _offset = val; + }, - function onloadend() { - if (!request) { - return; - } - // Prepare the response - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; - var responseData = !responseType || responseType === 'text' || responseType === 'json' ? - request.responseText : request.response; - var response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config: config, - request: request - }; + get commentLength() { + return _commentLength; + }, + set commentLength(/*Number*/ val) { + _commentLength = val; + }, - settle(function _resolve(value) { - resolve(value); - done(); - }, function _reject(err) { - reject(err); - done(); - }, response); + get mainHeaderSize() { + return Constants.ENDHDR + _commentLength; + }, - // Clean up request - request = null; - } + loadFromBinary: function (/*Buffer*/ data) { + // data should be 22 bytes and start with "PK 05 06" + // or be 56+ bytes and start with "PK 06 06" for Zip64 + if ( + (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) && + (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG) + ) { + throw new Error(Utils.Errors.INVALID_END); + } - if ('onloadend' in request) { - // Use onloadend if available - request.onloadend = onloadend; - } else { - // Listen for ready state to emulate onloadend - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } + if (data.readUInt32LE(0) === Constants.ENDSIG) { + // number of entries on this volume + _volumeEntries = data.readUInt16LE(Constants.ENDSUB); + // total number of entries + _totalEntries = data.readUInt16LE(Constants.ENDTOT); + // central directory size in bytes + _size = data.readUInt32LE(Constants.ENDSIZ); + // offset of first CEN header + _offset = data.readUInt32LE(Constants.ENDOFF); + // zip file comment length + _commentLength = data.readUInt16LE(Constants.ENDCOM); + } else { + // number of entries on this volume + _volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB); + // total number of entries + _totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT); + // central directory size in bytes + _size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZ); + // offset of first CEN header + _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF); + + _commentLength = 0; + } + }, - // The request errored out and we didn't get a response, this will be - // handled by onerror instead - // With one exception: request that using file: protocol, most browsers - // will return status as 0 even though it's a successful request - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { - return; - } - // readystate handler is calling before onerror or ontimeout handlers, - // so we should call onloadend on the next 'tick' - setTimeout(onloadend); - }; - } + toBinary: function () { + var b = Buffer.alloc(Constants.ENDHDR + _commentLength); + // "PK 05 06" signature + b.writeUInt32LE(Constants.ENDSIG, 0); + b.writeUInt32LE(0, 4); + // number of entries on this volume + b.writeUInt16LE(_volumeEntries, Constants.ENDSUB); + // total number of entries + b.writeUInt16LE(_totalEntries, Constants.ENDTOT); + // central directory size in bytes + b.writeUInt32LE(_size, Constants.ENDSIZ); + // offset of first CEN header + b.writeUInt32LE(_offset, Constants.ENDOFF); + // zip file comment length + b.writeUInt16LE(_commentLength, Constants.ENDCOM); + // fill comment memory with spaces so no garbage is left there + b.fill(" ", Constants.ENDHDR); + + return b; + }, - // Handle browser request cancellation (as opposed to a manual cancellation) - request.onabort = function handleAbort() { - if (!request) { - return; - } + toJSON: function () { + // creates 0x0000 style output + const offset = function (nr, len) { + let offs = nr.toString(16).toUpperCase(); + while (offs.length < len) offs = "0" + offs; + return "0x" + offs; + }; - reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); + return { + diskEntries: _volumeEntries, + totalEntries: _totalEntries, + size: _size + " bytes", + offset: offset(_offset, 4), + commentLength: _commentLength + }; + }, - // Clean up request - request = null; + toString: function () { + return JSON.stringify(this.toJSON(), null, "\t"); + } }; +}; - // Handle low level network errors - request.onerror = function handleError() { - // Real errors are hidden from us by the browser - // onerror should only fire if it's a network error - reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request)); - // Clean up request - request = null; - }; +/***/ }), - // Handle timeout - request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; - var transitional = config.transitional || transitionalDefaults; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(new AxiosError( - timeoutErrorMessage, - transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, - config, - request)); +/***/ 7686: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Clean up request - request = null; - }; +module.exports = function (/*Buffer*/ inbuf) { + var zlib = __nccwpck_require__(9796); - // Add xsrf header - // This is only done if running in a standard browser environment. - // Specifically not if we're in a web worker, or react-native. - if (utils.isStandardBrowserEnv()) { - // Add xsrf header - var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? - cookies.read(config.xsrfCookieName) : - undefined; + var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 }; - if (xsrfValue) { - requestHeaders[config.xsrfHeaderName] = xsrfValue; - } - } + return { + deflate: function () { + return zlib.deflateRawSync(inbuf, opts); + }, - // Add headers to the request - if ('setRequestHeader' in request) { - utils.forEach(requestHeaders, function setRequestHeader(val, key) { - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { - // Remove Content-Type if data is undefined - delete requestHeaders[key]; - } else { - // Otherwise add header to the request - request.setRequestHeader(key, val); + deflateAsync: function (/*Function*/ callback) { + var tmp = zlib.createDeflateRaw(opts), + parts = [], + total = 0; + tmp.on("data", function (data) { + parts.push(data); + total += data.length; + }); + tmp.on("end", function () { + var buf = Buffer.alloc(total), + written = 0; + buf.fill(0); + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + part.copy(buf, written); + written += part.length; + } + callback && callback(buf); + }); + tmp.end(inbuf); } - }); - } - - // Add withCredentials to request if needed - if (!utils.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; - } + }; +}; - // Add responseType to request if needed - if (responseType && responseType !== 'json') { - request.responseType = config.responseType; - } - // Handle progress if needed - if (typeof config.onDownloadProgress === 'function') { - request.addEventListener('progress', config.onDownloadProgress); - } +/***/ }), - // Not all browsers support upload events - if (typeof config.onUploadProgress === 'function' && request.upload) { - request.upload.addEventListener('progress', config.onUploadProgress); - } +/***/ 3928: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (config.cancelToken || config.signal) { - // Handle cancellation - // eslint-disable-next-line func-names - onCanceled = function(cancel) { - if (!request) { - return; - } - reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel); - request.abort(); - request = null; - }; +exports.Deflater = __nccwpck_require__(7686); +exports.Inflater = __nccwpck_require__(2153); +exports.ZipCrypto = __nccwpck_require__(3228); - config.cancelToken && config.cancelToken.subscribe(onCanceled); - if (config.signal) { - config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); - } - } - if (!requestData) { - requestData = null; - } +/***/ }), - var protocol = parseProtocol(fullPath); +/***/ 2153: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) { - reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); - return; - } +module.exports = function (/*Buffer*/ inbuf) { + var zlib = __nccwpck_require__(9796); + return { + inflate: function () { + return zlib.inflateRawSync(inbuf); + }, - // Send the request - request.send(requestData); - }); + inflateAsync: function (/*Function*/ callback) { + var tmp = zlib.createInflateRaw(), + parts = [], + total = 0; + tmp.on("data", function (data) { + parts.push(data); + total += data.length; + }); + tmp.on("end", function () { + var buf = Buffer.alloc(total), + written = 0; + buf.fill(0); + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + part.copy(buf, written); + written += part.length; + } + callback && callback(buf); + }); + tmp.end(inbuf); + } + }; }; /***/ }), -/***/ 2618: +/***/ 3228: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var bind = __nccwpck_require__(7065); -var Axios = __nccwpck_require__(8178); -var mergeConfig = __nccwpck_require__(4831); -var defaults = __nccwpck_require__(1626); +// node crypt, we use it for generate salt +// eslint-disable-next-line node/no-unsupported-features/node-builtins +const { randomFillSync } = __nccwpck_require__(6113); -/** - * Create an instance of Axios - * - * @param {Object} defaultConfig The default config for the instance - * @return {Axios} A new instance of Axios - */ -function createInstance(defaultConfig) { - var context = new Axios(defaultConfig); - var instance = bind(Axios.prototype.request, context); +// generate CRC32 lookup table +const crctable = new Uint32Array(256).map((t, crc) => { + for (let j = 0; j < 8; j++) { + if (0 !== (crc & 1)) { + crc = (crc >>> 1) ^ 0xedb88320; + } else { + crc >>>= 1; + } + } + return crc >>> 0; +}); - // Copy axios.prototype to instance - utils.extend(instance, Axios.prototype, context); +// C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits) +const uMul = (a, b) => Math.imul(a, b) >>> 0; - // Copy context to instance - utils.extend(instance, context); +// crc32 byte single update (actually same function is part of utils.crc32 function :) ) +const crc32update = (pCrc32, bval) => { + return crctable[(pCrc32 ^ bval) & 0xff] ^ (pCrc32 >>> 8); +}; - // Factory for creating new instances - instance.create = function create(instanceConfig) { - return createInstance(mergeConfig(defaultConfig, instanceConfig)); - }; +// function for generating salt for encrytion header +const genSalt = () => { + if ("function" === typeof randomFillSync) { + return randomFillSync(Buffer.alloc(12)); + } else { + // fallback if function is not defined + return genSalt.node(); + } +}; - return instance; -} +// salt generation with node random function (mainly as fallback) +genSalt.node = () => { + const salt = Buffer.alloc(12); + const len = salt.length; + for (let i = 0; i < len; i++) salt[i] = (Math.random() * 256) & 0xff; + return salt; +}; -// Create the default instance to be exported -var axios = createInstance(defaults); +// general config +const config = { + genSalt +}; -// Expose Axios class to allow class inheritance -axios.Axios = Axios; +// Class Initkeys handles same basic ops with keys +function Initkeys(pw) { + const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw); + this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]); + for (let i = 0; i < pass.length; i++) { + this.updateKeys(pass[i]); + } +} -// Expose Cancel & CancelToken -axios.CanceledError = __nccwpck_require__(4098); -axios.CancelToken = __nccwpck_require__(1587); -axios.isCancel = __nccwpck_require__(4057); -axios.VERSION = (__nccwpck_require__(4322).version); -axios.toFormData = __nccwpck_require__(470); +Initkeys.prototype.updateKeys = function (byteValue) { + const keys = this.keys; + keys[0] = crc32update(keys[0], byteValue); + keys[1] += keys[0] & 0xff; + keys[1] = uMul(keys[1], 134775813) + 1; + keys[2] = crc32update(keys[2], keys[1] >>> 24); + return byteValue; +}; -// Expose AxiosError class -axios.AxiosError = __nccwpck_require__(2093); +Initkeys.prototype.next = function () { + const k = (this.keys[2] | 2) >>> 0; // key + return (uMul(k, k ^ 1) >> 8) & 0xff; // decode +}; -// alias for CanceledError for backward compatibility -axios.Cancel = axios.CanceledError; +function make_decrypter(/*Buffer*/ pwd) { + // 1. Stage initialize key + const keys = new Initkeys(pwd); + + // return decrypter function + return function (/*Buffer*/ data) { + // result - we create new Buffer for results + const result = Buffer.alloc(data.length); + let pos = 0; + // process input data + for (let c of data) { + //c ^= keys.next(); + //result[pos++] = c; // decode & Save Value + result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte + } + return result; + }; +} -// Expose all/spread -axios.all = function all(promises) { - return Promise.all(promises); -}; -axios.spread = __nccwpck_require__(4850); +function make_encrypter(/*Buffer*/ pwd) { + // 1. Stage initialize key + const keys = new Initkeys(pwd); -// Expose isAxiosError -axios.isAxiosError = __nccwpck_require__(650); + // return encrypting function, result and pos is here so we dont have to merge buffers later + return function (/*Buffer*/ data, /*Buffer*/ result, /* Number */ pos = 0) { + // result - we create new Buffer for results + if (!result) result = Buffer.alloc(data.length); + // process input data + for (let c of data) { + const k = keys.next(); // save key byte + result[pos++] = c ^ k; // save val + keys.updateKeys(c); // update keys with decoded byte + } + return result; + }; +} -module.exports = axios; +function decrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd) { + if (!data || !Buffer.isBuffer(data) || data.length < 12) { + return Buffer.alloc(0); + } -// Allow use of default import syntax in TypeScript -module.exports["default"] = axios; + // 1. We Initialize and generate decrypting function + const decrypter = make_decrypter(pwd); + // 2. decrypt salt what is always 12 bytes and is a part of file content + const salt = decrypter(data.slice(0, 12)); -/***/ }), + // 3. does password meet expectations + if (salt[11] !== header.crc >>> 24) { + throw "ADM-ZIP: Wrong Password"; + } -/***/ 1587: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 4. decode content + return decrypter(data.slice(12)); +} -"use strict"; +// lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality +function _salter(data) { + if (Buffer.isBuffer(data) && data.length >= 12) { + // be aware - currently salting buffer data is modified + config.genSalt = function () { + return data.slice(0, 12); + }; + } else if (data === "node") { + // test salt generation with node random function + config.genSalt = genSalt.node; + } else { + // if value is not acceptable config gets reset. + config.genSalt = genSalt; + } +} +function encrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd, /*Boolean*/ oldlike = false) { + // 1. test data if data is not Buffer we make buffer from it + if (data == null) data = Buffer.alloc(0); + // if data is not buffer be make buffer from it + if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString()); -var CanceledError = __nccwpck_require__(4098); + // 2. We Initialize and generate encrypting function + const encrypter = make_encrypter(pwd); -/** - * A `CancelToken` is an object that can be used to request cancellation of an operation. - * - * @class - * @param {Function} executor The executor function. - */ -function CancelToken(executor) { - if (typeof executor !== 'function') { - throw new TypeError('executor must be a function.'); - } + // 3. generate salt (12-bytes of random data) + const salt = config.genSalt(); + salt[11] = (header.crc >>> 24) & 0xff; - var resolvePromise; + // old implementations (before PKZip 2.04g) used two byte check + if (oldlike) salt[10] = (header.crc >>> 16) & 0xff; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); + // 4. create output + const result = Buffer.alloc(data.length + 12); + encrypter(salt, result); - var token = this; + // finally encode content + return encrypter(data, result, 12); +} - // eslint-disable-next-line func-names - this.promise.then(function(cancel) { - if (!token._listeners) return; +module.exports = { decrypt, encrypt, _salter }; - var i; - var l = token._listeners.length; - for (i = 0; i < l; i++) { - token._listeners[i](cancel); - } - token._listeners = null; - }); +/***/ }), - // eslint-disable-next-line func-names - this.promise.then = function(onfulfilled) { - var _resolve; - // eslint-disable-next-line func-names - var promise = new Promise(function(resolve) { - token.subscribe(resolve); - _resolve = resolve; - }).then(onfulfilled); +/***/ 4522: +/***/ ((module) => { - promise.cancel = function reject() { - token.unsubscribe(_resolve); - }; +module.exports = { + /* The local file header */ + LOCHDR : 30, // LOC header size + LOCSIG : 0x04034b50, // "PK\003\004" + LOCVER : 4, // version needed to extract + LOCFLG : 6, // general purpose bit flag + LOCHOW : 8, // compression method + LOCTIM : 10, // modification time (2 bytes time, 2 bytes date) + LOCCRC : 14, // uncompressed file crc-32 value + LOCSIZ : 18, // compressed size + LOCLEN : 22, // uncompressed size + LOCNAM : 26, // filename length + LOCEXT : 28, // extra field length + + /* The Data descriptor */ + EXTSIG : 0x08074b50, // "PK\007\008" + EXTHDR : 16, // EXT header size + EXTCRC : 4, // uncompressed file crc-32 value + EXTSIZ : 8, // compressed size + EXTLEN : 12, // uncompressed size + + /* The central directory file header */ + CENHDR : 46, // CEN header size + CENSIG : 0x02014b50, // "PK\001\002" + CENVEM : 4, // version made by + CENVER : 6, // version needed to extract + CENFLG : 8, // encrypt, decrypt flags + CENHOW : 10, // compression method + CENTIM : 12, // modification time (2 bytes time, 2 bytes date) + CENCRC : 16, // uncompressed file crc-32 value + CENSIZ : 20, // compressed size + CENLEN : 24, // uncompressed size + CENNAM : 28, // filename length + CENEXT : 30, // extra field length + CENCOM : 32, // file comment length + CENDSK : 34, // volume number start + CENATT : 36, // internal file attributes + CENATX : 38, // external file attributes (host system dependent) + CENOFF : 42, // LOC header offset + + /* The entries in the end of central directory */ + ENDHDR : 22, // END header size + ENDSIG : 0x06054b50, // "PK\005\006" + ENDSUB : 8, // number of entries on this disk + ENDTOT : 10, // total number of entries + ENDSIZ : 12, // central directory size in bytes + ENDOFF : 16, // offset of first CEN header + ENDCOM : 20, // zip file comment length + + END64HDR : 20, // zip64 END header size + END64SIG : 0x07064b50, // zip64 Locator signature, "PK\006\007" + END64START : 4, // number of the disk with the start of the zip64 + END64OFF : 8, // relative offset of the zip64 end of central directory + END64NUMDISKS : 16, // total number of disks + + ZIP64SIG : 0x06064b50, // zip64 signature, "PK\006\006" + ZIP64HDR : 56, // zip64 record minimum size + ZIP64LEAD : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE + ZIP64SIZE : 4, // zip64 size of the central directory record + ZIP64VEM : 12, // zip64 version made by + ZIP64VER : 14, // zip64 version needed to extract + ZIP64DSK : 16, // zip64 number of this disk + ZIP64DSKDIR : 20, // number of the disk with the start of the record directory + ZIP64SUB : 24, // number of entries on this disk + ZIP64TOT : 32, // total number of entries + ZIP64SIZB : 40, // zip64 central directory size in bytes + ZIP64OFF : 48, // offset of start of central directory with respect to the starting disk number + ZIP64EXTRA : 56, // extensible data sector + + /* Compression methods */ + STORED : 0, // no compression + SHRUNK : 1, // shrunk + REDUCED1 : 2, // reduced with compression factor 1 + REDUCED2 : 3, // reduced with compression factor 2 + REDUCED3 : 4, // reduced with compression factor 3 + REDUCED4 : 5, // reduced with compression factor 4 + IMPLODED : 6, // imploded + // 7 reserved for Tokenizing compression algorithm + DEFLATED : 8, // deflated + ENHANCED_DEFLATED: 9, // enhanced deflated + PKWARE : 10,// PKWare DCL imploded + // 11 reserved by PKWARE + BZIP2 : 12, // compressed using BZIP2 + // 13 reserved by PKWARE + LZMA : 14, // LZMA + // 15-17 reserved by PKWARE + IBM_TERSE : 18, // compressed using IBM TERSE + IBM_LZ77 : 19, // IBM LZ77 z + AES_ENCRYPT : 99, // WinZIP AES encryption method + + /* General purpose bit flag */ + // values can obtained with expression 2**bitnr + FLG_ENC : 1, // Bit 0: encrypted file + FLG_COMP1 : 2, // Bit 1, compression option + FLG_COMP2 : 4, // Bit 2, compression option + FLG_DESC : 8, // Bit 3, data descriptor + FLG_ENH : 16, // Bit 4, enhanced deflating + FLG_PATCH : 32, // Bit 5, indicates that the file is compressed patched data. + FLG_STR : 64, // Bit 6, strong encryption (patented) + // Bits 7-10: Currently unused. + FLG_EFS : 2048, // Bit 11: Language encoding flag (EFS) + // Bit 12: Reserved by PKWARE for enhanced compression. + // Bit 13: encrypted the Central Directory (patented). + // Bits 14-15: Reserved by PKWARE. + FLG_MSK : 4096, // mask header values + + /* Load type */ + FILE : 2, + BUFFER : 1, + NONE : 0, + + /* 4.5 Extensible data fields */ + EF_ID : 0, + EF_SIZE : 2, + + /* Header IDs */ + ID_ZIP64 : 0x0001, + ID_AVINFO : 0x0007, + ID_PFS : 0x0008, + ID_OS2 : 0x0009, + ID_NTFS : 0x000a, + ID_OPENVMS : 0x000c, + ID_UNIX : 0x000d, + ID_FORK : 0x000e, + ID_PATCH : 0x000f, + ID_X509_PKCS7 : 0x0014, + ID_X509_CERTID_F : 0x0015, + ID_X509_CERTID_C : 0x0016, + ID_STRONGENC : 0x0017, + ID_RECORD_MGT : 0x0018, + ID_X509_PKCS7_RL : 0x0019, + ID_IBM1 : 0x0065, + ID_IBM2 : 0x0066, + ID_POSZIP : 0x4690, + + EF_ZIP64_OR_32 : 0xffffffff, + EF_ZIP64_OR_16 : 0xffff, + EF_ZIP64_SUNCOMP : 0, + EF_ZIP64_SCOMP : 8, + EF_ZIP64_RHO : 16, + EF_ZIP64_DSN : 24 +}; - return promise; - }; - executor(function cancel(message) { - if (token.reason) { - // Cancellation has already been requested - return; - } +/***/ }), - token.reason = new CanceledError(message); - resolvePromise(token.reason); - }); -} +/***/ 1255: +/***/ ((module) => { -/** - * Throws a `CanceledError` if cancellation has been requested. - */ -CancelToken.prototype.throwIfRequested = function throwIfRequested() { - if (this.reason) { - throw this.reason; - } +module.exports = { + /* Header error messages */ + INVALID_LOC: "Invalid LOC header (bad signature)", + INVALID_CEN: "Invalid CEN header (bad signature)", + INVALID_END: "Invalid END header (bad signature)", + + /* ZipEntry error messages*/ + NO_DATA: "Nothing to decompress", + BAD_CRC: "CRC32 checksum failed", + FILE_IN_THE_WAY: "There is a file in the way: %s", + UNKNOWN_METHOD: "Invalid/unsupported compression method", + + /* Inflater error messages */ + AVAIL_DATA: "inflate::Available inflate data did not terminate", + INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block", + TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes", + INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths", + INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length", + INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete", + INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths", + INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths", + INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement", + INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)", + + /* ADM-ZIP error messages */ + CANT_EXTRACT_FILE: "Could not extract the file", + CANT_OVERRIDE: "Target file already exists", + NO_ZIP: "No zip file was loaded", + NO_ENTRY: "Entry doesn't exist", + DIRECTORY_CONTENT_ERROR: "A directory cannot have content", + FILE_NOT_FOUND: "File not found: %s", + NOT_IMPLEMENTED: "Not implemented", + INVALID_FILENAME: "Invalid filename", + INVALID_FORMAT: "Invalid or unsupported zip format. No END header found" }; -/** - * Subscribe to the cancel signal - */ -CancelToken.prototype.subscribe = function subscribe(listener) { - if (this.reason) { - listener(this.reason); - return; - } +/***/ }), - if (this._listeners) { - this._listeners.push(listener); - } else { - this._listeners = [listener]; - } -}; +/***/ 8321: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -/** - * Unsubscribe from the cancel signal - */ +const fs = (__nccwpck_require__(2895).require)(); +const pth = __nccwpck_require__(1017); -CancelToken.prototype.unsubscribe = function unsubscribe(listener) { - if (!this._listeners) { - return; - } - var index = this._listeners.indexOf(listener); - if (index !== -1) { - this._listeners.splice(index, 1); - } -}; +fs.existsSync = fs.existsSync || pth.existsSync; -/** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ -CancelToken.source = function source() { - var cancel; - var token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token: token, - cancel: cancel - }; -}; +module.exports = function (/*String*/ path) { + var _path = path || "", + _obj = newAttr(), + _stat = null; -module.exports = CancelToken; + function newAttr() { + return { + directory: false, + readonly: false, + hidden: false, + executable: false, + mtime: 0, + atime: 0 + }; + } + if (_path && fs.existsSync(_path)) { + _stat = fs.statSync(_path); + _obj.directory = _stat.isDirectory(); + _obj.mtime = _stat.mtime; + _obj.atime = _stat.atime; + _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner + _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right + _obj.hidden = pth.basename(_path)[0] === "."; + } else { + console.warn("Invalid path: " + _path); + } -/***/ }), + return { + get directory() { + return _obj.directory; + }, -/***/ 4098: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get readOnly() { + return _obj.readonly; + }, -"use strict"; + get hidden() { + return _obj.hidden; + }, + get mtime() { + return _obj.mtime; + }, -var AxiosError = __nccwpck_require__(2093); -var utils = __nccwpck_require__(328); + get atime() { + return _obj.atime; + }, -/** - * A `CanceledError` is an object that is thrown when an operation is canceled. - * - * @class - * @param {string=} message The message. - */ -function CanceledError(message) { - // eslint-disable-next-line no-eq-null,eqeqeq - AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED); - this.name = 'CanceledError'; -} + get executable() { + return _obj.executable; + }, -utils.inherits(CanceledError, AxiosError, { - __CANCEL__: true -}); + decodeAttributes: function () {}, -module.exports = CanceledError; + encodeAttributes: function () {}, + toJSON: function () { + return { + path: _path, + isDirectory: _obj.directory, + isReadOnly: _obj.readonly, + isHidden: _obj.hidden, + isExecutable: _obj.executable, + mTime: _obj.mtime, + aTime: _obj.atime + }; + }, -/***/ }), + toString: function () { + return JSON.stringify(this.toJSON(), null, "\t"); + } + }; +}; -/***/ 4057: -/***/ ((module) => { -"use strict"; +/***/ }), +/***/ 2895: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -module.exports = function isCancel(value) { - return !!(value && value.__CANCEL__); +exports.require = function () { + if (typeof process === "object" && process.versions && process.versions["electron"]) { + try { + const originalFs = __nccwpck_require__(2941); + if (Object.keys(originalFs).length > 0) { + return originalFs; + } + } catch (e) {} + } + return __nccwpck_require__(7147); }; /***/ }), -/***/ 8178: +/***/ 5182: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +module.exports = __nccwpck_require__(1291); +module.exports.Constants = __nccwpck_require__(4522); +module.exports.Errors = __nccwpck_require__(1255); +module.exports.FileAttr = __nccwpck_require__(8321); -var utils = __nccwpck_require__(328); -var buildURL = __nccwpck_require__(646); -var InterceptorManager = __nccwpck_require__(3214); -var dispatchRequest = __nccwpck_require__(5062); -var mergeConfig = __nccwpck_require__(4831); -var buildFullPath = __nccwpck_require__(1934); -var validator = __nccwpck_require__(1632); +/***/ }), -var validators = validator.validators; -/** - * Create a new instance of Axios - * - * @param {Object} instanceConfig The default config for the instance - */ -function Axios(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager(), - response: new InterceptorManager() - }; -} +/***/ 1291: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -/** - * Dispatch a request - * - * @param {Object} config The config specific for this request (merged with this.defaults) - */ -Axios.prototype.request = function request(configOrUrl, config) { - /*eslint no-param-reassign:0*/ - // Allow for axios('example/url'[, config]) a la fetch API - if (typeof configOrUrl === 'string') { - config = config || {}; - config.url = configOrUrl; - } else { - config = configOrUrl || {}; - } +const fsystem = (__nccwpck_require__(2895).require)(); +const pth = __nccwpck_require__(1017); +const Constants = __nccwpck_require__(4522); +const isWin = typeof process === "object" && "win32" === process.platform; - config = mergeConfig(this.defaults, config); +const is_Obj = (obj) => obj && typeof obj === "object"; - // Set config.method - if (config.method) { - config.method = config.method.toLowerCase(); - } else if (this.defaults.method) { - config.method = this.defaults.method.toLowerCase(); - } else { - config.method = 'get'; - } +// generate CRC32 lookup table +const crcTable = new Uint32Array(256).map((t, c) => { + for (let k = 0; k < 8; k++) { + if ((c & 1) !== 0) { + c = 0xedb88320 ^ (c >>> 1); + } else { + c >>>= 1; + } + } + return c >>> 0; +}); - var transitional = config.transitional; +// UTILS functions - if (transitional !== undefined) { - validator.assertOptions(transitional, { - silentJSONParsing: validators.transitional(validators.boolean), - forcedJSONParsing: validators.transitional(validators.boolean), - clarifyTimeoutError: validators.transitional(validators.boolean) - }, false); - } +function Utils(opts) { + this.sep = pth.sep; + this.fs = fsystem; - // filter out skipped interceptors - var requestInterceptorChain = []; - var synchronousRequestInterceptors = true; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { - return; + if (is_Obj(opts)) { + // custom filesystem + if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") { + this.fs = opts.fs; + } } +} - synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; +module.exports = Utils; - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); - }); +// INSTANCED functions - var responseInterceptorChain = []; - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - }); +Utils.prototype.makeDir = function (/*String*/ folder) { + const self = this; - var promise; + // Sync - make directories tree + function mkdirSync(/*String*/ fpath) { + let resolvedPath = fpath.split(self.sep)[0]; + fpath.split(self.sep).forEach(function (name) { + if (!name || name.substr(-1, 1) === ":") return; + resolvedPath += self.sep + name; + var stat; + try { + stat = self.fs.statSync(resolvedPath); + } catch (e) { + self.fs.mkdirSync(resolvedPath); + } + if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath); + }); + } - if (!synchronousRequestInterceptors) { - var chain = [dispatchRequest, undefined]; + mkdirSync(folder); +}; - Array.prototype.unshift.apply(chain, requestInterceptorChain); - chain = chain.concat(responseInterceptorChain); +Utils.prototype.writeFileTo = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr) { + const self = this; + if (self.fs.existsSync(path)) { + if (!overwrite) return false; // cannot overwrite - promise = Promise.resolve(config); - while (chain.length) { - promise = promise.then(chain.shift(), chain.shift()); + var stat = self.fs.statSync(path); + if (stat.isDirectory()) { + return false; + } + } + var folder = pth.dirname(path); + if (!self.fs.existsSync(folder)) { + self.makeDir(folder); } - return promise; - } - - - var newConfig = config; - while (requestInterceptorChain.length) { - var onFulfilled = requestInterceptorChain.shift(); - var onRejected = requestInterceptorChain.shift(); + var fd; try { - newConfig = onFulfilled(newConfig); - } catch (error) { - onRejected(error); - break; + fd = self.fs.openSync(path, "w", 438); // 0666 + } catch (e) { + self.fs.chmodSync(path, 438); + fd = self.fs.openSync(path, "w", 438); } - } - - try { - promise = dispatchRequest(newConfig); - } catch (error) { - return Promise.reject(error); - } - - while (responseInterceptorChain.length) { - promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); - } - - return promise; -}; - -Axios.prototype.getUri = function getUri(config) { - config = mergeConfig(this.defaults, config); - var fullPath = buildFullPath(config.baseURL, config.url); - return buildURL(fullPath, config.params, config.paramsSerializer); + if (fd) { + try { + self.fs.writeSync(fd, content, 0, content.length, 0); + } finally { + self.fs.closeSync(fd); + } + } + self.fs.chmodSync(path, attr || 438); + return true; }; -// Provide aliases for supported request methods -utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: (config || {}).data - })); - }; -}); +Utils.prototype.writeFileToAsync = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr, /*Function*/ callback) { + if (typeof attr === "function") { + callback = attr; + attr = undefined; + } -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - /*eslint func-names:0*/ + const self = this; - function generateHTTPMethod(isForm) { - return function httpMethod(url, data, config) { - return this.request(mergeConfig(config || {}, { - method: method, - headers: isForm ? { - 'Content-Type': 'multipart/form-data' - } : {}, - url: url, - data: data - })); - }; - } + self.fs.exists(path, function (exist) { + if (exist && !overwrite) return callback(false); - Axios.prototype[method] = generateHTTPMethod(); + self.fs.stat(path, function (err, stat) { + if (exist && stat.isDirectory()) { + return callback(false); + } - Axios.prototype[method + 'Form'] = generateHTTPMethod(true); -}); + var folder = pth.dirname(path); + self.fs.exists(folder, function (exists) { + if (!exists) self.makeDir(folder); -module.exports = Axios; + self.fs.open(path, "w", 438, function (err, fd) { + if (err) { + self.fs.chmod(path, 438, function () { + self.fs.open(path, "w", 438, function (err, fd) { + self.fs.write(fd, content, 0, content.length, 0, function () { + self.fs.close(fd, function () { + self.fs.chmod(path, attr || 438, function () { + callback(true); + }); + }); + }); + }); + }); + } else if (fd) { + self.fs.write(fd, content, 0, content.length, 0, function () { + self.fs.close(fd, function () { + self.fs.chmod(path, attr || 438, function () { + callback(true); + }); + }); + }); + } else { + self.fs.chmod(path, attr || 438, function () { + callback(true); + }); + } + }); + }); + }); + }); +}; +Utils.prototype.findFiles = function (/*String*/ path) { + const self = this; -/***/ }), + function findSync(/*String*/ dir, /*RegExp*/ pattern, /*Boolean*/ recursive) { + if (typeof pattern === "boolean") { + recursive = pattern; + pattern = undefined; + } + let files = []; + self.fs.readdirSync(dir).forEach(function (file) { + var path = pth.join(dir, file); -/***/ 2093: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (self.fs.statSync(path).isDirectory() && recursive) files = files.concat(findSync(path, pattern, recursive)); -"use strict"; + if (!pattern || pattern.test(path)) { + files.push(pth.normalize(path) + (self.fs.statSync(path).isDirectory() ? self.sep : "")); + } + }); + return files; + } + return findSync(path, undefined, true); +}; -var utils = __nccwpck_require__(328); +Utils.prototype.getAttributes = function () {}; -/** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [config] The config. - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The created error. - */ -function AxiosError(message, code, config, request, response) { - Error.call(this); - this.message = message; - this.name = 'AxiosError'; - code && (this.code = code); - config && (this.config = config); - request && (this.request = request); - response && (this.response = response); -} +Utils.prototype.setAttributes = function () {}; -utils.inherits(AxiosError, Error, { - toJSON: function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: this.config, - code: this.code, - status: this.response && this.response.status ? this.response.status : null - }; - } -}); +// STATIC functions -var prototype = AxiosError.prototype; -var descriptors = {}; +// crc32 single update (it is part of crc32) +Utils.crc32update = function (crc, byte) { + return crcTable[(crc ^ byte) & 0xff] ^ (crc >>> 8); +}; -[ - 'ERR_BAD_OPTION_VALUE', - 'ERR_BAD_OPTION', - 'ECONNABORTED', - 'ETIMEDOUT', - 'ERR_NETWORK', - 'ERR_FR_TOO_MANY_REDIRECTS', - 'ERR_DEPRECATED', - 'ERR_BAD_RESPONSE', - 'ERR_BAD_REQUEST', - 'ERR_CANCELED' -// eslint-disable-next-line func-names -].forEach(function(code) { - descriptors[code] = {value: code}; -}); +Utils.crc32 = function (buf) { + if (typeof buf === "string") { + buf = Buffer.from(buf, "utf8"); + } + // Generate crcTable + if (!crcTable.length) genCRCTable(); -Object.defineProperties(AxiosError, descriptors); -Object.defineProperty(prototype, 'isAxiosError', {value: true}); + let len = buf.length; + let crc = ~0; + for (let off = 0; off < len; ) crc = Utils.crc32update(crc, buf[off++]); + // xor and cast as uint32 number + return ~crc >>> 0; +}; -// eslint-disable-next-line func-names -AxiosError.from = function(error, code, config, request, response, customProps) { - var axiosError = Object.create(prototype); +Utils.methodToString = function (/*Number*/ method) { + switch (method) { + case Constants.STORED: + return "STORED (" + method + ")"; + case Constants.DEFLATED: + return "DEFLATED (" + method + ")"; + default: + return "UNSUPPORTED (" + method + ")"; + } +}; - utils.toFlatObject(error, axiosError, function filter(obj) { - return obj !== Error.prototype; - }); +// removes ".." style path elements +Utils.canonical = function (/*string*/ path) { + if (!path) return ""; + // trick normalize think path is absolute + var safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/")); + return pth.join(".", safeSuffix); +}; - AxiosError.call(axiosError, error.message, code, config, request, response); +// make abolute paths taking prefix as root folder +Utils.sanitize = function (/*string*/ prefix, /*string*/ name) { + prefix = pth.resolve(pth.normalize(prefix)); + var parts = name.split("/"); + for (var i = 0, l = parts.length; i < l; i++) { + var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep))); + if (path.indexOf(prefix) === 0) { + return path; + } + } + return pth.normalize(pth.join(prefix, pth.basename(name))); +}; - axiosError.name = error.name; +// converts buffer, Uint8Array, string types to buffer +Utils.toBuffer = function toBuffer(/*buffer, Uint8Array, string*/ input) { + if (Buffer.isBuffer(input)) { + return input; + } else if (input instanceof Uint8Array) { + return Buffer.from(input); + } else { + // expect string all other values are invalid and return empty buffer + return typeof input === "string" ? Buffer.from(input, "utf8") : Buffer.alloc(0); + } +}; - customProps && Object.assign(axiosError, customProps); +Utils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) { + var slice = Buffer.from(buffer.slice(index, index + 8)); + slice.swap64(); - return axiosError; + return parseInt(`0x${slice.toString("hex")}`); }; -module.exports = AxiosError; +Utils.isWin = isWin; // Do we have windows system +Utils.crcTable = crcTable; /***/ }), -/***/ 3214: +/***/ 4057: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +var Utils = __nccwpck_require__(5182), + Headers = __nccwpck_require__(4958), + Constants = Utils.Constants, + Methods = __nccwpck_require__(3928); +module.exports = function (/*Buffer*/ input) { + var _entryHeader = new Headers.EntryHeader(), + _entryName = Buffer.alloc(0), + _comment = Buffer.alloc(0), + _isDirectory = false, + uncompressedData = null, + _extra = Buffer.alloc(0); -var utils = __nccwpck_require__(328); + function getCompressedDataFromZip() { + if (!input || !Buffer.isBuffer(input)) { + return Buffer.alloc(0); + } + _entryHeader.loadDataHeaderFromBinary(input); + return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize); + } -function InterceptorManager() { - this.handlers = []; -} + function crc32OK(data) { + // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written + if ((_entryHeader.flags & 0x8) !== 0x8) { + if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) { + return false; + } + } else { + // @TODO: load and check data descriptor header + // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure + // (optionally preceded by a 4-byte signature) immediately after the compressed data: + } + return true; + } -/** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ -InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { - this.handlers.push({ - fulfilled: fulfilled, - rejected: rejected, - synchronous: options ? options.synchronous : false, - runWhen: options ? options.runWhen : null - }); - return this.handlers.length - 1; -}; + function decompress(/*Boolean*/ async, /*Function*/ callback, /*String, Buffer*/ pass) { + if (typeof callback === "undefined" && typeof async === "string") { + pass = async; + async = void 0; + } + if (_isDirectory) { + if (async && callback) { + callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error. + } + return Buffer.alloc(0); + } -/** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - */ -InterceptorManager.prototype.eject = function eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } -}; + var compressedData = getCompressedDataFromZip(); -/** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - */ -InterceptorManager.prototype.forEach = function forEach(fn) { - utils.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); + if (compressedData.length === 0) { + // File is empty, nothing to decompress. + if (async && callback) callback(compressedData); + return compressedData; + } + + if (_entryHeader.encripted) { + if ("string" !== typeof pass && !Buffer.isBuffer(pass)) { + throw new Error("ADM-ZIP: Incompatible password parameter"); + } + compressedData = Methods.ZipCrypto.decrypt(compressedData, _entryHeader, pass); + } + + var data = Buffer.alloc(_entryHeader.size); + + switch (_entryHeader.method) { + case Utils.Constants.STORED: + compressedData.copy(data); + if (!crc32OK(data)) { + if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error + throw new Error(Utils.Errors.BAD_CRC); + } else { + //si added otherwise did not seem to return data. + if (async && callback) callback(data); + return data; + } + case Utils.Constants.DEFLATED: + var inflater = new Methods.Inflater(compressedData); + if (!async) { + const result = inflater.inflate(data); + result.copy(data, 0); + if (!crc32OK(data)) { + throw new Error(Utils.Errors.BAD_CRC + " " + _entryName.toString()); + } + return data; + } else { + inflater.inflateAsync(function (result) { + result.copy(result, 0); + if (callback) { + if (!crc32OK(result)) { + callback(result, Utils.Errors.BAD_CRC); //si added error + } else { + callback(result); + } + } + }); + } + break; + default: + if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); + throw new Error(Utils.Errors.UNKNOWN_METHOD); + } + } + + function compress(/*Boolean*/ async, /*Function*/ callback) { + if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) { + // no data set or the data wasn't changed to require recompression + if (async && callback) callback(getCompressedDataFromZip()); + return getCompressedDataFromZip(); + } + + if (uncompressedData.length && !_isDirectory) { + var compressedData; + // Local file header + switch (_entryHeader.method) { + case Utils.Constants.STORED: + _entryHeader.compressedSize = _entryHeader.size; + + compressedData = Buffer.alloc(uncompressedData.length); + uncompressedData.copy(compressedData); + + if (async && callback) callback(compressedData); + return compressedData; + default: + case Utils.Constants.DEFLATED: + var deflater = new Methods.Deflater(uncompressedData); + if (!async) { + var deflated = deflater.deflate(); + _entryHeader.compressedSize = deflated.length; + return deflated; + } else { + deflater.deflateAsync(function (data) { + compressedData = Buffer.alloc(data.length); + _entryHeader.compressedSize = data.length; + data.copy(compressedData); + callback && callback(compressedData); + }); + } + deflater = null; + break; + } + } else if (async && callback) { + callback(Buffer.alloc(0)); + } else { + return Buffer.alloc(0); + } } - }); -}; -module.exports = InterceptorManager; + function readUInt64LE(buffer, offset) { + return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset); + } + function parseExtra(data) { + var offset = 0; + var signature, size, part; + while (offset < data.length) { + signature = data.readUInt16LE(offset); + offset += 2; + size = data.readUInt16LE(offset); + offset += 2; + part = data.slice(offset, offset + size); + offset += size; + if (Constants.ID_ZIP64 === signature) { + parseZip64ExtendedInformation(part); + } + } + } -/***/ }), + //Override header field values with values from the ZIP64 extra field + function parseZip64ExtendedInformation(data) { + var size, compressedSize, offset, diskNumStart; -/***/ 1934: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (data.length >= Constants.EF_ZIP64_SCOMP) { + size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP); + if (_entryHeader.size === Constants.EF_ZIP64_OR_32) { + _entryHeader.size = size; + } + } + if (data.length >= Constants.EF_ZIP64_RHO) { + compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP); + if (_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) { + _entryHeader.compressedSize = compressedSize; + } + } + if (data.length >= Constants.EF_ZIP64_DSN) { + offset = readUInt64LE(data, Constants.EF_ZIP64_RHO); + if (_entryHeader.offset === Constants.EF_ZIP64_OR_32) { + _entryHeader.offset = offset; + } + } + if (data.length >= Constants.EF_ZIP64_DSN + 4) { + diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN); + if (_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) { + _entryHeader.diskNumStart = diskNumStart; + } + } + } -"use strict"; + return { + get entryName() { + return _entryName.toString(); + }, + get rawEntryName() { + return _entryName; + }, + set entryName(val) { + _entryName = Utils.toBuffer(val); + var lastChar = _entryName[_entryName.length - 1]; + _isDirectory = lastChar === 47 || lastChar === 92; + _entryHeader.fileNameLength = _entryName.length; + }, + get extra() { + return _extra; + }, + set extra(val) { + _extra = val; + _entryHeader.extraLength = val.length; + parseExtra(val); + }, -var isAbsoluteURL = __nccwpck_require__(1301); -var combineURLs = __nccwpck_require__(7189); + get comment() { + return _comment.toString(); + }, + set comment(val) { + _comment = Utils.toBuffer(val); + _entryHeader.commentLength = _comment.length; + }, -/** - * Creates a new URL by combining the baseURL with the requestedURL, - * only when the requestedURL is not already an absolute URL. - * If the requestURL is absolute, this function returns the requestedURL untouched. - * - * @param {string} baseURL The base URL - * @param {string} requestedURL Absolute or relative URL to combine - * @returns {string} The combined full path - */ -module.exports = function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); - } - return requestedURL; + get name() { + var n = _entryName.toString(); + return _isDirectory + ? n + .substr(n.length - 1) + .split("/") + .pop() + : n.split("/").pop(); + }, + get isDirectory() { + return _isDirectory; + }, + + getCompressedData: function () { + return compress(false, null); + }, + + getCompressedDataAsync: function (/*Function*/ callback) { + compress(true, callback); + }, + + setData: function (value) { + uncompressedData = Utils.toBuffer(value); + if (!_isDirectory && uncompressedData.length) { + _entryHeader.size = uncompressedData.length; + _entryHeader.method = Utils.Constants.DEFLATED; + _entryHeader.crc = Utils.crc32(value); + _entryHeader.changed = true; + } else { + // folders and blank files should be stored + _entryHeader.method = Utils.Constants.STORED; + } + }, + + getData: function (pass) { + if (_entryHeader.changed) { + return uncompressedData; + } else { + return decompress(false, null, pass); + } + }, + + getDataAsync: function (/*Function*/ callback, pass) { + if (_entryHeader.changed) { + callback(uncompressedData); + } else { + decompress(true, callback, pass); + } + }, + + set attr(attr) { + _entryHeader.attr = attr; + }, + get attr() { + return _entryHeader.attr; + }, + + set header(/*Buffer*/ data) { + _entryHeader.loadFromBinary(data); + }, + + get header() { + return _entryHeader; + }, + + packHeader: function () { + // 1. create header (buffer) + var header = _entryHeader.entryHeaderToBinary(); + var addpos = Utils.Constants.CENHDR; + // 2. add file name + _entryName.copy(header, addpos); + addpos += _entryName.length; + // 3. add extra data + if (_entryHeader.extraLength) { + _extra.copy(header, addpos); + addpos += _entryHeader.extraLength; + } + // 4. add file comment + if (_entryHeader.commentLength) { + _comment.copy(header, addpos); + } + return header; + }, + + toJSON: function () { + const bytes = function (nr) { + return "<" + ((nr && nr.length + " bytes buffer") || "null") + ">"; + }; + + return { + entryName: this.entryName, + name: this.name, + comment: this.comment, + isDirectory: this.isDirectory, + header: _entryHeader.toJSON(), + compressedData: bytes(input), + data: bytes(uncompressedData) + }; + }, + + toString: function () { + return JSON.stringify(this.toJSON(), null, "\t"); + } + }; }; /***/ }), -/***/ 5062: +/***/ 7744: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +const ZipEntry = __nccwpck_require__(4057); +const Headers = __nccwpck_require__(4958); +const Utils = __nccwpck_require__(5182); +module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) { + var entryList = [], + entryTable = {}, + _comment = Buffer.alloc(0), + mainHeader = new Headers.MainHeader(), + loadedEntries = false; -var utils = __nccwpck_require__(328); -var transformData = __nccwpck_require__(9812); -var isCancel = __nccwpck_require__(4057); -var defaults = __nccwpck_require__(1626); -var CanceledError = __nccwpck_require__(4098); + // assign options + const opts = Object.assign(Object.create(null), options); -/** - * Throws a `CanceledError` if cancellation has been requested. - */ -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } + const { noSort } = opts; - if (config.signal && config.signal.aborted) { - throw new CanceledError(); - } -} + if (inBuffer) { + // is a memory buffer + readMainHeader(opts.readEntries); + } else { + // none. is a new file + loadedEntries = true; + } -/** - * Dispatch a request to the server using the configured adapter. - * - * @param {object} config The config that is to be used for the request - * @returns {Promise} The Promise to be fulfilled - */ -module.exports = function dispatchRequest(config) { - throwIfCancellationRequested(config); + function iterateEntries(callback) { + const totalEntries = mainHeader.diskEntries; // total number of entries + let index = mainHeader.offset; // offset of first CEN header - // Ensure headers exist - config.headers = config.headers || {}; + for (let i = 0; i < totalEntries; i++) { + let tmp = index; + const entry = new ZipEntry(inBuffer); - // Transform request data - config.data = transformData.call( - config, - config.data, - config.headers, - config.transformRequest - ); + entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR)); + entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength)); - // Flatten headers - config.headers = utils.merge( - config.headers.common || {}, - config.headers[config.method] || {}, - config.headers - ); + index += entry.header.entryHeaderSize; - utils.forEach( - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], - function cleanHeaderConfig(method) { - delete config.headers[method]; + callback(entry); + } } - ); - var adapter = config.adapter || defaults.adapter; + function readEntries() { + loadedEntries = true; + entryTable = {}; + entryList = new Array(mainHeader.diskEntries); // total number of entries + var index = mainHeader.offset; // offset of first CEN header + for (var i = 0; i < entryList.length; i++) { + var tmp = index, + entry = new ZipEntry(inBuffer); + entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR)); - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); + entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength)); - // Transform response data - response.data = transformData.call( - config, - response.data, - response.headers, - config.transformResponse - ); + if (entry.header.extraLength) { + entry.extra = inBuffer.slice(tmp, (tmp += entry.header.extraLength)); + } - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); + if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength); - // Transform response data - if (reason && reason.response) { - reason.response.data = transformData.call( - config, - reason.response.data, - reason.response.headers, - config.transformResponse - ); - } + index += entry.header.entryHeaderSize; + + entryList[i] = entry; + entryTable[entry.entryName] = entry; + } } - return Promise.reject(reason); - }); -}; + function readMainHeader(/*Boolean*/ readNow) { + var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size + max = Math.max(0, i - 0xffff), // 0xFFFF is the max zip file comment length + n = max, + endStart = inBuffer.length, + endOffset = -1, // Start offset of the END header + commentEnd = 0; + for (i; i >= n; i--) { + if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P' + if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { + // "PK\005\006" + endOffset = i; + commentEnd = i; + endStart = i + Utils.Constants.ENDHDR; + // We already found a regular signature, let's look just a bit further to check if there's any zip64 signature + n = i - Utils.Constants.END64HDR; + continue; + } -/***/ }), + if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) { + // Found a zip64 signature, let's continue reading the whole zip64 record + n = max; + continue; + } -/***/ 4831: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) { + // Found the zip64 record, let's determine it's size + endOffset = i; + endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD; + break; + } + } -"use strict"; + if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT); + mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart)); + if (mainHeader.commentLength) { + _comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR); + } + if (readNow) readEntries(); + } -var utils = __nccwpck_require__(328); + function sortEntries() { + if (entryList.length > 1 && !noSort) { + entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); + } + } -/** - * Config-specific merge-function which creates a new config-object - * by merging two configuration objects together. - * - * @param {Object} config1 - * @param {Object} config2 - * @returns {Object} New object resulting from merging config2 to config1 - */ -module.exports = function mergeConfig(config1, config2) { - // eslint-disable-next-line no-param-reassign - config2 = config2 || {}; - var config = {}; + return { + /** + * Returns an array of ZipEntry objects existent in the current opened archive + * @return Array + */ + get entries() { + if (!loadedEntries) { + readEntries(); + } + return entryList; + }, - function getMergedValue(target, source) { - if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge(target, source); - } else if (utils.isPlainObject(source)) { - return utils.merge({}, source); - } else if (utils.isArray(source)) { - return source.slice(); - } - return source; - } + /** + * Archive comment + * @return {String} + */ + get comment() { + return _comment.toString(); + }, + set comment(val) { + _comment = Utils.toBuffer(val); + mainHeader.commentLength = _comment.length; + }, - // eslint-disable-next-line consistent-return - function mergeDeepProperties(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(config1[prop], config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - return getMergedValue(undefined, config1[prop]); - } - } + getEntryCount: function () { + if (!loadedEntries) { + return mainHeader.diskEntries; + } - // eslint-disable-next-line consistent-return - function valueFromConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(undefined, config2[prop]); - } - } + return entryList.length; + }, - // eslint-disable-next-line consistent-return - function defaultToConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(undefined, config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - return getMergedValue(undefined, config1[prop]); - } - } + forEach: function (callback) { + if (!loadedEntries) { + iterateEntries(callback); + return; + } - // eslint-disable-next-line consistent-return - function mergeDirectKeys(prop) { - if (prop in config2) { - return getMergedValue(config1[prop], config2[prop]); - } else if (prop in config1) { - return getMergedValue(undefined, config1[prop]); - } - } + entryList.forEach(callback); + }, - var mergeMap = { - 'url': valueFromConfig2, - 'method': valueFromConfig2, - 'data': valueFromConfig2, - 'baseURL': defaultToConfig2, - 'transformRequest': defaultToConfig2, - 'transformResponse': defaultToConfig2, - 'paramsSerializer': defaultToConfig2, - 'timeout': defaultToConfig2, - 'timeoutMessage': defaultToConfig2, - 'withCredentials': defaultToConfig2, - 'adapter': defaultToConfig2, - 'responseType': defaultToConfig2, - 'xsrfCookieName': defaultToConfig2, - 'xsrfHeaderName': defaultToConfig2, - 'onUploadProgress': defaultToConfig2, - 'onDownloadProgress': defaultToConfig2, - 'decompress': defaultToConfig2, - 'maxContentLength': defaultToConfig2, - 'maxBodyLength': defaultToConfig2, - 'beforeRedirect': defaultToConfig2, - 'transport': defaultToConfig2, - 'httpAgent': defaultToConfig2, - 'httpsAgent': defaultToConfig2, - 'cancelToken': defaultToConfig2, - 'socketPath': defaultToConfig2, - 'responseEncoding': defaultToConfig2, - 'validateStatus': mergeDirectKeys - }; - - utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { - var merge = mergeMap[prop] || mergeDeepProperties; - var configValue = merge(prop); - (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); - }); - - return config; -}; - - -/***/ }), + /** + * Returns a reference to the entry with the given name or null if entry is inexistent + * + * @param entryName + * @return ZipEntry + */ + getEntry: function (/*String*/ entryName) { + if (!loadedEntries) { + readEntries(); + } + return entryTable[entryName] || null; + }, -/***/ 3211: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + /** + * Adds the given entry to the entry list + * + * @param entry + */ + setEntry: function (/*ZipEntry*/ entry) { + if (!loadedEntries) { + readEntries(); + } + entryList.push(entry); + entryTable[entry.entryName] = entry; + mainHeader.totalEntries = entryList.length; + }, -"use strict"; + /** + * Removes the entry with the given name from the entry list. + * + * If the entry is a directory, then all nested files and directories will be removed + * @param entryName + */ + deleteEntry: function (/*String*/ entryName) { + if (!loadedEntries) { + readEntries(); + } + var entry = entryTable[entryName]; + if (entry && entry.isDirectory) { + var _self = this; + this.getEntryChildren(entry).forEach(function (child) { + if (child.entryName !== entryName) { + _self.deleteEntry(child.entryName); + } + }); + } + entryList.splice(entryList.indexOf(entry), 1); + delete entryTable[entryName]; + mainHeader.totalEntries = entryList.length; + }, + /** + * Iterates and returns all nested files and directories of the given entry + * + * @param entry + * @return Array + */ + getEntryChildren: function (/*ZipEntry*/ entry) { + if (!loadedEntries) { + readEntries(); + } + if (entry && entry.isDirectory) { + const list = []; + const name = entry.entryName; + const len = name.length; + + entryList.forEach(function (zipEntry) { + if (zipEntry.entryName.substr(0, len) === name) { + list.push(zipEntry); + } + }); + return list; + } + return []; + }, -var AxiosError = __nccwpck_require__(2093); + /** + * Returns the zip file + * + * @return Buffer + */ + compressToBuffer: function () { + if (!loadedEntries) { + readEntries(); + } + sortEntries(); + + const dataBlock = []; + const entryHeaders = []; + let totalSize = 0; + let dindex = 0; + + mainHeader.size = 0; + mainHeader.offset = 0; + + for (const entry of entryList) { + // compress data and set local and entry header accordingly. Reason why is called first + const compressedData = entry.getCompressedData(); + // 1. construct data header + entry.header.offset = dindex; + const dataHeader = entry.header.dataHeaderToBinary(); + const entryNameLen = entry.rawEntryName.length; + // 1.2. postheader - data after data header + const postHeader = Buffer.alloc(entryNameLen + entry.extra.length); + entry.rawEntryName.copy(postHeader, 0); + postHeader.copy(entry.extra, entryNameLen); + + // 2. offsets + const dataLength = dataHeader.length + postHeader.length + compressedData.length; + dindex += dataLength; + + // 3. store values in sequence + dataBlock.push(dataHeader); + dataBlock.push(postHeader); + dataBlock.push(compressedData); + + // 4. construct entry header + const entryHeader = entry.packHeader(); + entryHeaders.push(entryHeader); + // 5. update main header + mainHeader.size += entryHeader.length; + totalSize += dataLength + entryHeader.length; + } -/** - * Resolve or reject a Promise based on response status. - * - * @param {Function} resolve A function that resolves the promise. - * @param {Function} reject A function that rejects the promise. - * @param {object} response The response. - */ -module.exports = function settle(resolve, reject, response) { - var validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); - } else { - reject(new AxiosError( - 'Request failed with status code ' + response.status, - [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], - response.config, - response.request, - response - )); - } -}; + totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length + // point to end of data and beginning of central directory first record + mainHeader.offset = dindex; + dindex = 0; + const outBuffer = Buffer.alloc(totalSize); + // write data blocks + for (const content of dataBlock) { + content.copy(outBuffer, dindex); + dindex += content.length; + } -/***/ }), + // write central directory entries + for (const content of entryHeaders) { + content.copy(outBuffer, dindex); + dindex += content.length; + } -/***/ 9812: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // write main header + const mh = mainHeader.toBinary(); + if (_comment) { + _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment + } + mh.copy(outBuffer, dindex); -"use strict"; + return outBuffer; + }, + toAsyncBuffer: function (/*Function*/ onSuccess, /*Function*/ onFail, /*Function*/ onItemStart, /*Function*/ onItemEnd) { + try { + if (!loadedEntries) { + readEntries(); + } + sortEntries(); + + const dataBlock = []; + const entryHeaders = []; + let totalSize = 0; + let dindex = 0; + + mainHeader.size = 0; + mainHeader.offset = 0; + + const compress2Buffer = function (entryLists) { + if (entryLists.length) { + const entry = entryLists.pop(); + const name = entry.entryName + entry.extra.toString(); + if (onItemStart) onItemStart(name); + entry.getCompressedDataAsync(function (compressedData) { + if (onItemEnd) onItemEnd(name); + + entry.header.offset = dindex; + // data header + const dataHeader = entry.header.dataHeaderToBinary(); + const postHeader = Buffer.alloc(name.length, name); + const dataLength = dataHeader.length + postHeader.length + compressedData.length; + + dindex += dataLength; + + dataBlock.push(dataHeader); + dataBlock.push(postHeader); + dataBlock.push(compressedData); + + const entryHeader = entry.packHeader(); + entryHeaders.push(entryHeader); + mainHeader.size += entryHeader.length; + totalSize += dataLength + entryHeader.length; + + compress2Buffer(entryLists); + }); + } else { + totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length + // point to end of data and beginning of central directory first record + mainHeader.offset = dindex; + + dindex = 0; + const outBuffer = Buffer.alloc(totalSize); + dataBlock.forEach(function (content) { + content.copy(outBuffer, dindex); // write data blocks + dindex += content.length; + }); + entryHeaders.forEach(function (content) { + content.copy(outBuffer, dindex); // write central directory entries + dindex += content.length; + }); + + const mh = mainHeader.toBinary(); + if (_comment) { + _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment + } -var utils = __nccwpck_require__(328); -var defaults = __nccwpck_require__(1626); + mh.copy(outBuffer, dindex); // write main header -/** - * Transform the data for a request or a response - * - * @param {Object|String} data The data to be transformed - * @param {Array} headers The headers for the request or response - * @param {Array|Function} fns A single function or Array of functions - * @returns {*} The resulting transformed data - */ -module.exports = function transformData(data, headers, fns) { - var context = this || defaults; - /*eslint no-param-reassign:0*/ - utils.forEach(fns, function transform(fn) { - data = fn.call(context, data, headers); - }); + onSuccess(outBuffer); + } + }; - return data; + compress2Buffer(entryList); + } catch (e) { + onFail(e); + } + } + }; }; /***/ }), -/***/ 7024: +/***/ 4812: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// eslint-disable-next-line strict -module.exports = __nccwpck_require__(4334); +module.exports = +{ + parallel : __nccwpck_require__(8210), + serial : __nccwpck_require__(445), + serialOrdered : __nccwpck_require__(3578) +}; /***/ }), -/***/ 1626: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - +/***/ 1700: +/***/ ((module) => { -var utils = __nccwpck_require__(328); -var normalizeHeaderName = __nccwpck_require__(6240); -var AxiosError = __nccwpck_require__(2093); -var transitionalDefaults = __nccwpck_require__(936); -var toFormData = __nccwpck_require__(470); +// API +module.exports = abort; -var DEFAULT_CONTENT_TYPE = { - 'Content-Type': 'application/x-www-form-urlencoded' -}; +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); -function setContentTypeIfUnset(headers, value) { - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { - headers['Content-Type'] = value; - } + // reset leftover jobs + state.jobs = {}; } -function getDefaultAdapter() { - var adapter; - if (typeof XMLHttpRequest !== 'undefined') { - // For browsers use XHR adapter - adapter = __nccwpck_require__(3454); - } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { - // For node use HTTP adapter - adapter = __nccwpck_require__(8104); +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); } - return adapter; } -function stringifySafely(rawValue, parser, encoder) { - if (utils.isString(rawValue)) { - try { - (parser || JSON.parse)(rawValue); - return utils.trim(rawValue); - } catch (e) { - if (e.name !== 'SyntaxError') { - throw e; - } - } - } - return (encoder || JSON.stringify)(rawValue); -} +/***/ }), -var defaults = { +/***/ 2794: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - transitional: transitionalDefaults, +var defer = __nccwpck_require__(5295); - adapter: getDefaultAdapter(), +// API +module.exports = async; - transformRequest: [function transformRequest(data, headers) { - normalizeHeaderName(headers, 'Accept'); - normalizeHeaderName(headers, 'Content-Type'); +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; - if (utils.isFormData(data) || - utils.isArrayBuffer(data) || - utils.isBuffer(data) || - utils.isStream(data) || - utils.isFile(data) || - utils.isBlob(data) - ) { - return data; - } - if (utils.isArrayBufferView(data)) { - return data.buffer; + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); } - if (utils.isURLSearchParams(data)) { - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); - return data.toString(); + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); } + }; +} - var isObjectPayload = utils.isObject(data); - var contentType = headers && headers['Content-Type']; - var isFileList; +/***/ }), - if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) { - var _FormData = this.env && this.env.FormData; - return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData()); - } else if (isObjectPayload || contentType === 'application/json') { - setContentTypeIfUnset(headers, 'application/json'); - return stringifySafely(data); - } +/***/ 5295: +/***/ ((module) => { - return data; - }], +module.exports = defer; - transformResponse: [function transformResponse(data) { - var transitional = this.transitional || defaults.transitional; - var silentJSONParsing = transitional && transitional.silentJSONParsing; - var forcedJSONParsing = transitional && transitional.forcedJSONParsing; - var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); - if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { - try { - return JSON.parse(data); - } catch (e) { - if (strictJSONParsing) { - if (e.name === 'SyntaxError') { - throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); - } - throw e; - } - } - } + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} - return data; - }], - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, +/***/ }), - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', +/***/ 9023: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - maxContentLength: -1, - maxBodyLength: -1, +var async = __nccwpck_require__(2794) + , abort = __nccwpck_require__(1700) + ; - env: { - FormData: __nccwpck_require__(7024) - }, +// API +module.exports = iterate; - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - }, +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; - headers: { - common: { - 'Accept': 'application/json, text/plain, */*' + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; } - } -}; -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { - defaults.headers[method] = {}; -}); + // clean up jobs + delete state.jobs[key]; -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); -}); + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } -module.exports = defaults; + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} /***/ }), -/***/ 936: +/***/ 2474: /***/ ((module) => { -"use strict"; +// 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 + } + ; -module.exports = { - silentJSONParsing: true, - forcedJSONParsing: true, - clarifyTimeoutError: false -}; + 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; +} /***/ }), -/***/ 4322: -/***/ ((module) => { +/***/ 7942: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = { - "version": "0.27.2" -}; +var abort = __nccwpck_require__(1700) + , async = __nccwpck_require__(2794) + ; -/***/ }), +// API +module.exports = terminator; -/***/ 7065: -/***/ ((module) => { +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } -"use strict"; + // fast forward iteration index + this.index = this.size; + // abort jobs + abort(this); -module.exports = function bind(fn, thisArg) { - return function wrap() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - return fn.apply(thisArg, args); - }; -}; + // send back results we have so far + async(callback)(null, this.results); +} /***/ }), -/***/ 646: +/***/ 8210: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(2474) + , terminator = __nccwpck_require__(7942) + ; -var utils = __nccwpck_require__(328); - -function encode(val) { - return encodeURIComponent(val). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%20/g, '+'). - replace(/%5B/gi, '['). - replace(/%5D/gi, ']'); -} +// Public API +module.exports = parallel; /** - * Build a URL by appending params to the end + * Runs iterator over provided array elements in parallel * - * @param {string} url The base of the url (e.g., http://www.google.com) - * @param {object} [params] The params to be appended - * @returns {string} The formatted url + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator */ -module.exports = function buildURL(url, params, paramsSerializer) { - /*eslint no-param-reassign:0*/ - if (!params) { - return url; - } - - var serializedParams; - if (paramsSerializer) { - serializedParams = paramsSerializer(params); - } else if (utils.isURLSearchParams(params)) { - serializedParams = params.toString(); - } else { - var parts = []; +function parallel(list, iterator, callback) +{ + var state = initState(list); - utils.forEach(params, function serialize(val, key) { - if (val === null || typeof val === 'undefined') { + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); return; } - if (utils.isArray(val)) { - key = key + '[]'; - } else { - val = [val]; + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; } - - utils.forEach(val, function parseValue(v) { - if (utils.isDate(v)) { - v = v.toISOString(); - } else if (utils.isObject(v)) { - v = JSON.stringify(v); - } - parts.push(encode(key) + '=' + encode(v)); - }); }); - serializedParams = parts.join('&'); - } - - if (serializedParams) { - var hashmarkIndex = url.indexOf('#'); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } - - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + state.index++; } - return url; -}; + return terminator.bind(state, callback); +} /***/ }), -/***/ 7189: -/***/ ((module) => { +/***/ 445: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +var serialOrdered = __nccwpck_require__(3578); +// Public API +module.exports = serial; /** - * Creates a new URL by combining the specified URLs + * Runs iterator over provided array elements in series * - * @param {string} baseURL The base URL - * @param {string} relativeURL The relative URL - * @returns {string} The combined URL + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator */ -module.exports = function combineURLs(baseURL, relativeURL) { - return relativeURL - ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') - : baseURL; -}; +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} /***/ }), -/***/ 1545: +/***/ 3578: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -var utils = __nccwpck_require__(328); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs support document.cookie - (function standardBrowserEnv() { - return { - write: function write(name, value, expires, path, domain, secure) { - var cookie = []; - cookie.push(name + '=' + encodeURIComponent(value)); - - if (utils.isNumber(expires)) { - cookie.push('expires=' + new Date(expires).toGMTString()); - } - - if (utils.isString(path)) { - cookie.push('path=' + path); - } - - if (utils.isString(domain)) { - cookie.push('domain=' + domain); - } - - if (secure === true) { - cookie.push('secure'); - } +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(2474) + , terminator = __nccwpck_require__(7942) + ; - document.cookie = cookie.join('; '); - }, +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; - read: function read(name) { - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); - return (match ? decodeURIComponent(match[3]) : null); - }, +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); - remove: function remove(name) { - this.write(name, '', Date.now() - 86400000); - } - }; - })() : + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } - // Non standard browser env (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return { - write: function write() {}, - read: function read() { return null; }, - remove: function remove() {} - }; - })() -); + state.index++; + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } -/***/ }), + // done here + callback(null, state.results); + }); -/***/ 1301: -/***/ ((module) => { + return terminator.bind(state, callback); +} -"use strict"; +/* + * -- Sort methods + */ +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} /** - * Determines whether the specified URL is absolute + * sort helper to sort array elements in descending order * - * @param {string} url The URL to test - * @returns {boolean} True if the specified URL is absolute, otherwise false + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result */ -module.exports = function isAbsoluteURL(url) { - // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed - // by any combination of letters, digits, plus, period, or hyphen. - return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); -}; +function descending(a, b) +{ + return -1 * ascending(a, b); +} /***/ }), -/***/ 650: +/***/ 6545: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -var utils = __nccwpck_require__(328); - -/** - * Determines whether the payload is an error thrown by Axios - * - * @param {*} payload The value to test - * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false - */ -module.exports = function isAxiosError(payload) { - return utils.isObject(payload) && (payload.isAxiosError === true); -}; - +module.exports = __nccwpck_require__(2618); /***/ }), -/***/ 3608: +/***/ 8104: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; var utils = __nccwpck_require__(328); +var settle = __nccwpck_require__(3211); +var buildFullPath = __nccwpck_require__(1934); +var buildURL = __nccwpck_require__(646); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var httpFollow = (__nccwpck_require__(7707).http); +var httpsFollow = (__nccwpck_require__(7707).https); +var url = __nccwpck_require__(7310); +var zlib = __nccwpck_require__(9796); +var VERSION = (__nccwpck_require__(4322).version); +var transitionalDefaults = __nccwpck_require__(936); +var AxiosError = __nccwpck_require__(2093); +var CanceledError = __nccwpck_require__(4098); -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs have full support of the APIs needed to test - // whether the request URL is of the same origin as current location. - (function standardBrowserEnv() { - var msie = /(msie|trident)/i.test(navigator.userAgent); - var urlParsingNode = document.createElement('a'); - var originURL; - - /** - * Parse a URL to discover it's components - * - * @param {String} url The URL to be parsed - * @returns {Object} - */ - function resolveURL(url) { - var href = url; - - if (msie) { - // IE needs attribute set twice to normalize properties - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } +var isHttps = /https:?/; - urlParsingNode.setAttribute('href', href); +var supportedProtocols = [ 'http:', 'https:', 'file:' ]; - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') ? - urlParsingNode.pathname : - '/' + urlParsingNode.pathname - }; - } +/** + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} proxy + * @param {string} location + */ +function setProxy(options, proxy, location) { + options.hostname = proxy.host; + options.host = proxy.host; + options.port = proxy.port; + options.path = location; - originURL = resolveURL(window.location.href); + // Basic proxy authorization + if (proxy.auth) { + var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } - /** - * Determine if a URL shares the same origin as the current location - * - * @param {String} requestURL The URL to test - * @returns {boolean} True if URL shares the same origin, otherwise false - */ - return function isURLSameOrigin(requestURL) { - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; - return (parsed.protocol === originURL.protocol && - parsed.host === originURL.host); - }; - })() : + // If a proxy is used, any redirects must also pass through the proxy + options.beforeRedirect = function beforeRedirect(redirection) { + redirection.headers.host = redirection.host; + setProxy(redirection, proxy, redirection.href); + }; +} - // Non standard browser envs (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - })() -); +/*eslint consistent-return:0*/ +module.exports = function httpAdapter(config) { + return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { + var onCanceled; + function done() { + if (config.cancelToken) { + config.cancelToken.unsubscribe(onCanceled); + } + if (config.signal) { + config.signal.removeEventListener('abort', onCanceled); + } + } + var resolve = function resolve(value) { + done(); + resolvePromise(value); + }; + var rejected = false; + var reject = function reject(value) { + done(); + rejected = true; + rejectPromise(value); + }; + var data = config.data; + var headers = config.headers; + var headerNames = {}; -/***/ }), + Object.keys(headers).forEach(function storeLowerName(name) { + headerNames[name.toLowerCase()] = name; + }); -/***/ 6240: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + if ('user-agent' in headerNames) { + // User-Agent is specified; handle case where no UA header is desired + if (!headers[headerNames['user-agent']]) { + delete headers[headerNames['user-agent']]; + } + // Otherwise, use specified value + } else { + // Only set header if it hasn't been set in config + headers['User-Agent'] = 'axios/' + VERSION; + } -"use strict"; + // support for https://www.npmjs.com/package/form-data api + if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) { + Object.assign(headers, data.getHeaders()); + } else if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } -var utils = __nccwpck_require__(328); + // Add Content-Length header if data exists + if (!headerNames['content-length']) { + headers['Content-Length'] = data.length; + } + } -module.exports = function normalizeHeaderName(headers, normalizedName) { - utils.forEach(headers, function processHeader(value, name) { - if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { - headers[normalizedName] = value; - delete headers[name]; + // HTTP basic authentication + var auth = undefined; + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + auth = username + ':' + password; } - }); -}; + // Parse url + var fullPath = buildFullPath(config.baseURL, config.url); + var parsed = url.parse(fullPath); + var protocol = parsed.protocol || supportedProtocols[0]; -/***/ }), + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } -/***/ 6455: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!auth && parsed.auth) { + var urlAuth = parsed.auth.split(':'); + var urlUsername = urlAuth[0] || ''; + var urlPassword = urlAuth[1] || ''; + auth = urlUsername + ':' + urlPassword; + } -"use strict"; + if (auth && headerNames.authorization) { + delete headers[headerNames.authorization]; + } + var isHttpsRequest = isHttps.test(protocol); + var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; -var utils = __nccwpck_require__(328); + try { + buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''); + } catch (err) { + var customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + reject(customErr); + } -// Headers whose duplicates are ignored by node -// c.f. https://nodejs.org/api/http.html#http_message_headers -var ignoreDuplicateOf = [ - 'age', 'authorization', 'content-length', 'content-type', 'etag', - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', - 'last-modified', 'location', 'max-forwards', 'proxy-authorization', - 'referer', 'retry-after', 'user-agent' -]; + var options = { + path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), + method: config.method.toUpperCase(), + headers: headers, + agent: agent, + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth: auth + }; -/** - * Parse headers into an object - * - * ``` - * Date: Wed, 27 Aug 2014 08:58:49 GMT - * Content-Type: application/json - * Connection: keep-alive - * Transfer-Encoding: chunked - * ``` - * - * @param {String} headers Headers needing to be parsed - * @returns {Object} Headers parsed into an object - */ -module.exports = function parseHeaders(headers) { - var parsed = {}; - var key; - var val; - var i; + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + } - if (!headers) { return parsed; } + var proxy = config.proxy; + if (!proxy && proxy !== false) { + var proxyEnv = protocol.slice(0, -1) + '_proxy'; + var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; + if (proxyUrl) { + var parsedProxyUrl = url.parse(proxyUrl); + var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; + var shouldProxy = true; - utils.forEach(headers.split('\n'), function parser(line) { - i = line.indexOf(':'); - key = utils.trim(line.substr(0, i)).toLowerCase(); - val = utils.trim(line.substr(i + 1)); + if (noProxyEnv) { + var noProxy = noProxyEnv.split(',').map(function trim(s) { + return s.trim(); + }); - if (key) { - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { - return; - } - if (key === 'set-cookie') { - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); - } else { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - } - }); + shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { + if (!proxyElement) { + return false; + } + if (proxyElement === '*') { + return true; + } + if (proxyElement[0] === '.' && + parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { + return true; + } - return parsed; -}; + return parsed.hostname === proxyElement; + }); + } + if (shouldProxy) { + proxy = { + host: parsedProxyUrl.hostname, + port: parsedProxyUrl.port, + protocol: parsedProxyUrl.protocol + }; -/***/ }), + if (parsedProxyUrl.auth) { + var proxyUrlAuth = parsedProxyUrl.auth.split(':'); + proxy.auth = { + username: proxyUrlAuth[0], + password: proxyUrlAuth[1] + }; + } + } + } + } -/***/ 6107: -/***/ ((module) => { + if (proxy) { + options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); + setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } -"use strict"; + var transport; + var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsProxy ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirect = config.beforeRedirect; + } + transport = isHttpsProxy ? httpsFollow : httpFollow; + } + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } -module.exports = function parseProtocol(url) { - var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); - return match && match[1] || ''; -}; + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + // Create the request + var req = transport.request(options, function handleResponse(res) { + if (req.aborted) return; -/***/ }), + // uncompress the response body transparently if required + var stream = res; -/***/ 4850: -/***/ ((module) => { + // return the last request in case of redirects + var lastRequest = res.req || req; -"use strict"; + // if no content, is HEAD request or decompress disabled we should not decompress + if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { + switch (res.headers['content-encoding']) { + /*eslint default-case:0*/ + case 'gzip': + case 'compress': + case 'deflate': + // add the unzipper to the body stream processing pipeline + stream = stream.pipe(zlib.createUnzip()); -/** - * Syntactic sugar for invoking a function and expanding an array for arguments. - * - * Common use case would be to use `Function.prototype.apply`. - * - * ```js - * function f(x, y, z) {} - * var args = [1, 2, 3]; - * f.apply(null, args); - * ``` - * - * With `spread` this example can be re-written. - * - * ```js - * spread(function(x, y, z) {})([1, 2, 3]); - * ``` - * - * @param {Function} callback - * @returns {Function} - */ -module.exports = function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; -}; + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + } + } + var response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: res.headers, + config: config, + request: lastRequest + }; -/***/ }), + if (config.responseType === 'stream') { + response.data = stream; + settle(resolve, reject, response); + } else { + var responseBuffer = []; + var totalResponseBytes = 0; + stream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; -/***/ 470: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destoy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + stream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); -"use strict"; + stream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + stream.destroy(); + reject(new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + )); + }); + stream.on('error', function handleStreamError(err) { + if (req.aborted) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); -var utils = __nccwpck_require__(328); + stream.on('end', function handleStreamEnd() { + try { + var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (config.responseType !== 'arraybuffer') { + responseData = responseData.toString(config.responseEncoding); + if (!config.responseEncoding || config.responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + }); -/** - * Convert a data object to FormData - * @param {Object} obj - * @param {?Object} [formData] - * @returns {Object} - **/ + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); -function toFormData(obj, formData) { - // eslint-disable-next-line no-param-reassign - formData = formData || new FormData(); + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); - var stack = []; + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + var timeout = parseInt(config.timeout, 10); - function convertValue(value) { - if (value === null) return ''; + if (isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); - if (utils.isDate(value)) { - return value.toISOString(); - } + return; + } - if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { - return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devoring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + req.abort(); + var transitional = config.transitional || transitionalDefaults; + reject(new AxiosError( + 'timeout of ' + timeout + 'ms exceeded', + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + }); } - return value; - } - - function build(data, parentKey) { - if (utils.isPlainObject(data) || utils.isArray(data)) { - if (stack.indexOf(data) !== -1) { - throw Error('Circular reference detected in ' + parentKey); - } - - stack.push(data); + if (config.cancelToken || config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = function(cancel) { + if (req.aborted) return; - utils.forEach(data, function each(value, key) { - if (utils.isUndefined(value)) return; - var fullKey = parentKey ? parentKey + '.' + key : key; - var arr; + req.abort(); + reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel); + }; - if (value && !parentKey && typeof value === 'object') { - if (utils.endsWith(key, '{}')) { - // eslint-disable-next-line no-param-reassign - value = JSON.stringify(value); - } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) { - // eslint-disable-next-line func-names - arr.forEach(function(el) { - !utils.isUndefined(el) && formData.append(fullKey, convertValue(el)); - }); - return; - } - } + config.cancelToken && config.cancelToken.subscribe(onCanceled); + if (config.signal) { + config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); + } + } - build(value, fullKey); - }); - stack.pop(); + // Send the request + if (utils.isStream(data)) { + data.on('error', function handleStreamError(err) { + reject(AxiosError.from(err, config, null, req)); + }).pipe(req); } else { - formData.append(parentKey, convertValue(data)); + req.end(data); } - } - - build(obj); - - return formData; -} - -module.exports = toFormData; + }); +}; /***/ }), -/***/ 1632: +/***/ 3454: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var VERSION = (__nccwpck_require__(4322).version); +var utils = __nccwpck_require__(328); +var settle = __nccwpck_require__(3211); +var cookies = __nccwpck_require__(1545); +var buildURL = __nccwpck_require__(646); +var buildFullPath = __nccwpck_require__(1934); +var parseHeaders = __nccwpck_require__(6455); +var isURLSameOrigin = __nccwpck_require__(3608); +var transitionalDefaults = __nccwpck_require__(936); var AxiosError = __nccwpck_require__(2093); +var CanceledError = __nccwpck_require__(4098); +var parseProtocol = __nccwpck_require__(6107); -var validators = {}; +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + var responseType = config.responseType; + var onCanceled; + function done() { + if (config.cancelToken) { + config.cancelToken.unsubscribe(onCanceled); + } -// eslint-disable-next-line func-names -['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { - validators[type] = function validator(thing) { - return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; - }; -}); + if (config.signal) { + config.signal.removeEventListener('abort', onCanceled); + } + } -var deprecatedWarnings = {}; + if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) { + delete requestHeaders['Content-Type']; // Let the browser set it + } -/** - * Transitional option validator - * @param {function|boolean?} validator - set to false if the transitional option has been removed - * @param {string?} version - deprecated version / removed since version - * @param {string?} message - some message with additional info - * @returns {function} - */ -validators.transitional = function transitional(validator, version, message) { - function formatMessage(opt, desc) { - return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); - } + var request = new XMLHttpRequest(); - // eslint-disable-next-line func-names - return function(value, opt, opts) { - if (validator === false) { - throw new AxiosError( - formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), - AxiosError.ERR_DEPRECATED - ); + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } - if (version && !deprecatedWarnings[opt]) { - deprecatedWarnings[opt] = true; - // eslint-disable-next-line no-console - console.warn( - formatMessage( - opt, - ' has been deprecated since v' + version + ' and will be removed in the near future' - ) - ); - } + var fullPath = buildFullPath(config.baseURL, config.url); - return validator ? validator(value, opt, opts) : true; - }; -}; + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); -/** - * Assert object's properties type - * @param {object} options - * @param {object} schema - * @param {boolean?} allowUnknown - */ + // Set the request timeout in MS + request.timeout = config.timeout; -function assertOptions(options, schema, allowUnknown) { - if (typeof options !== 'object') { - throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); - } - var keys = Object.keys(options); - var i = keys.length; - while (i-- > 0) { - var opt = keys[i]; - var validator = schema[opt]; - if (validator) { - var value = options[opt]; - var result = value === undefined || validator(value, opt, options); - if (result !== true) { - throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + function onloadend() { + if (!request) { + return; } - continue; - } - if (allowUnknown !== true) { - throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); - } - } -} + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; -module.exports = { - assertOptions: assertOptions, - validators: validators -}; + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + // Clean up request + request = null; + } -/***/ }), + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } -/***/ 328: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } -"use strict"; + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); -var bind = __nccwpck_require__(7065); + // Clean up request + request = null; + }; -// utils is a library of generic helper functions non-specific to axios + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request)); -var toString = Object.prototype.toString; + // Clean up request + request = null; + }; -// eslint-disable-next-line func-names -var kindOf = (function(cache) { - // eslint-disable-next-line func-names - return function(thing) { - var str = toString.call(thing); - return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); - }; -})(Object.create(null)); + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + var transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + request)); -function kindOfTest(type) { - type = type.toLowerCase(); - return function isKindOf(thing) { - return kindOf(thing) === type; - }; -} + // Clean up request + request = null; + }; -/** - * Determine if a value is an Array - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Array, otherwise false - */ -function isArray(val) { - return Array.isArray(val); -} + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; -/** - * Determine if a value is undefined - * - * @param {Object} val The value to test - * @returns {boolean} True if the value is undefined, otherwise false - */ -function isUndefined(val) { - return typeof val === 'undefined'; -} + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } -/** - * Determine if a value is a Buffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Buffer, otherwise false - */ -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) - && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); -} + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } -/** - * Determine if a value is an ArrayBuffer - * - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is an ArrayBuffer, otherwise false - */ -var isArrayBuffer = kindOfTest('ArrayBuffer'); + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = config.responseType; + } -/** - * Determine if a value is a view on an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false - */ -function isArrayBufferView(val) { - var result; - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { - result = ArrayBuffer.isView(val); - } else { - result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); - } - return result; -} + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } -/** - * Determine if a value is a String - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a String, otherwise false - */ -function isString(val) { - return typeof val === 'string'; -} + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } -/** - * Determine if a value is a Number - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Number, otherwise false - */ -function isNumber(val) { - return typeof val === 'number'; -} + if (config.cancelToken || config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = function(cancel) { + if (!request) { + return; + } + reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel); + request.abort(); + request = null; + }; -/** - * Determine if a value is an Object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Object, otherwise false - */ -function isObject(val) { - return val !== null && typeof val === 'object'; -} + config.cancelToken && config.cancelToken.subscribe(onCanceled); + if (config.signal) { + config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); + } + } -/** - * Determine if a value is a plain Object - * - * @param {Object} val The value to test - * @return {boolean} True if value is a plain Object, otherwise false - */ -function isPlainObject(val) { - if (kindOf(val) !== 'object') { - return false; - } + if (!requestData) { + requestData = null; + } - var prototype = Object.getPrototypeOf(val); - return prototype === null || prototype === Object.prototype; -} + var protocol = parseProtocol(fullPath); -/** - * Determine if a value is a Date - * - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is a Date, otherwise false - */ -var isDate = kindOfTest('Date'); + if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } -/** - * Determine if a value is a File - * - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is a File, otherwise false - */ -var isFile = kindOfTest('File'); -/** - * Determine if a value is a Blob - * - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is a Blob, otherwise false - */ -var isBlob = kindOfTest('Blob'); + // Send the request + request.send(requestData); + }); +}; -/** - * Determine if a value is a FileList - * - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is a File, otherwise false - */ -var isFileList = kindOfTest('FileList'); -/** - * Determine if a value is a Function - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Function, otherwise false - */ -function isFunction(val) { - return toString.call(val) === '[object Function]'; -} +/***/ }), -/** - * Determine if a value is a Stream - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Stream, otherwise false - */ -function isStream(val) { - return isObject(val) && isFunction(val.pipe); -} +/***/ 2618: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -/** - * Determine if a value is a FormData - * - * @param {Object} thing The value to test - * @returns {boolean} True if value is an FormData, otherwise false - */ -function isFormData(thing) { - var pattern = '[object FormData]'; - return thing && ( - (typeof FormData === 'function' && thing instanceof FormData) || - toString.call(thing) === pattern || - (isFunction(thing.toString) && thing.toString() === pattern) - ); -} +"use strict"; -/** - * Determine if a value is a URLSearchParams object - * @function - * @param {Object} val The value to test - * @returns {boolean} True if value is a URLSearchParams object, otherwise false - */ -var isURLSearchParams = kindOfTest('URLSearchParams'); + +var utils = __nccwpck_require__(328); +var bind = __nccwpck_require__(7065); +var Axios = __nccwpck_require__(8178); +var mergeConfig = __nccwpck_require__(4831); +var defaults = __nccwpck_require__(1626); /** - * Trim excess whitespace off the beginning and end of a string + * Create an instance of Axios * - * @param {String} str The String to trim - * @returns {String} The String freed of excess whitespace + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios */ -function trim(str) { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); -} +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); -/** - * Determine if we're running in a standard browser environment - * - * This allows axios to run in a web worker, and react-native. - * Both environments support XMLHttpRequest, but not fully standard globals. - * - * web workers: - * typeof window -> undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - */ -function isStandardBrowserEnv() { - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || - navigator.product === 'NativeScript' || - navigator.product === 'NS')) { - return false; - } - return ( - typeof window !== 'undefined' && - typeof document !== 'undefined' - ); + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; } +// Create the default instance to be exported +var axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Expose Cancel & CancelToken +axios.CanceledError = __nccwpck_require__(4098); +axios.CancelToken = __nccwpck_require__(1587); +axios.isCancel = __nccwpck_require__(6719); +axios.VERSION = (__nccwpck_require__(4322).version); +axios.toFormData = __nccwpck_require__(470); + +// Expose AxiosError class +axios.AxiosError = __nccwpck_require__(2093); + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = __nccwpck_require__(4850); + +// Expose isAxiosError +axios.isAxiosError = __nccwpck_require__(650); + +module.exports = axios; + +// Allow use of default import syntax in TypeScript +module.exports["default"] = axios; + + +/***/ }), + +/***/ 1587: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var CanceledError = __nccwpck_require__(4098); + /** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. + * A `CancelToken` is an object that can be used to request cancellation of an operation. * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item + * @class + * @param {Function} executor The executor function. */ -function forEach(obj, fn) { - // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { - return; +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); } - // Force an array if not already something iterable - if (typeof obj !== 'object') { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } + var resolvePromise; - if (isArray(obj)) { - // Iterate over array values - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Iterate over object keys - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } -} + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * var result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (isPlainObject(result[key]) && isPlainObject(val)) { - result[key] = merge(result[key], val); - } else if (isPlainObject(val)) { - result[key] = merge({}, val); - } else if (isArray(val)) { - result[key] = val.slice(); - } else { - result[key] = val; + var token = this; + + // eslint-disable-next-line func-names + this.promise.then(function(cancel) { + if (!token._listeners) return; + + var i; + var l = token._listeners.length; + + for (i = 0; i < l; i++) { + token._listeners[i](cancel); } - } + token._listeners = null; + }); - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} + // eslint-disable-next-line func-names + this.promise.then = function(onfulfilled) { + var _resolve; + // eslint-disable-next-line func-names + var promise = new Promise(function(resolve) { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * @return {Object} The resulting value of object a - */ -function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === 'function') { - a[key] = bind(val, thisArg); - } else { - a[key] = val; + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; } + + token.reason = new CanceledError(message); + resolvePromise(token.reason); }); - return a; } /** - * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - * - * @param {string} content with BOM - * @return {string} content value without BOM + * Throws a `CanceledError` if cancellation has been requested. */ -function stripBOM(content) { - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; } - return content; -} +}; /** - * Inherit the prototype methods from one constructor into another - * @param {function} constructor - * @param {function} superConstructor - * @param {object} [props] - * @param {object} [descriptors] + * Subscribe to the cancel signal */ -function inherits(constructor, superConstructor, props, descriptors) { - constructor.prototype = Object.create(superConstructor.prototype, descriptors); - constructor.prototype.constructor = constructor; - props && Object.assign(constructor.prototype, props); -} +CancelToken.prototype.subscribe = function subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } +}; /** - * Resolve object with deep prototype chain to a flat object - * @param {Object} sourceObj source object - * @param {Object} [destObj] - * @param {Function} [filter] - * @returns {Object} + * Unsubscribe from the cancel signal */ -function toFlatObject(sourceObj, destObj, filter) { - var props; +CancelToken.prototype.unsubscribe = function unsubscribe(listener) { + if (!this._listeners) { + return; + } + var index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } +}; + +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; +}; + +module.exports = CancelToken; + + +/***/ }), + +/***/ 4098: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var AxiosError = __nccwpck_require__(2093); +var utils = __nccwpck_require__(328); + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ +function CanceledError(message) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED); + this.name = 'CanceledError'; +} + +utils.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +module.exports = CanceledError; + + +/***/ }), + +/***/ 6719: +/***/ ((module) => { + +"use strict"; + + +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); +}; + + +/***/ }), + +/***/ 8178: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); +var buildURL = __nccwpck_require__(646); +var InterceptorManager = __nccwpck_require__(3214); +var dispatchRequest = __nccwpck_require__(5062); +var mergeConfig = __nccwpck_require__(4831); +var buildFullPath = __nccwpck_require__(1934); +var validator = __nccwpck_require__(1632); + +var validators = validator.validators; +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; +} + +/** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ +Axios.prototype.request = function request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } + + var transitional = config.transitional; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + var promise; + + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest, undefined]; + + Array.prototype.unshift.apply(chain, requestInterceptorChain); + chain = chain.concat(responseInterceptorChain); + + promise = Promise.resolve(config); + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + + return promise; + } + + + var newConfig = config; + while (requestInterceptorChain.length) { + var onFulfilled = requestInterceptorChain.shift(); + var onRejected = requestInterceptorChain.shift(); + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected(error); + break; + } + } + + try { + promise = dispatchRequest(newConfig); + } catch (error) { + return Promise.reject(error); + } + + while (responseInterceptorChain.length) { + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); + } + + return promise; +}; + +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + var fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); +}; + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url: url, + data: data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +module.exports = Axios; + + +/***/ }), + +/***/ 2093: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +var prototype = AxiosError.prototype; +var descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED' +// eslint-disable-next-line func-names +].forEach(function(code) { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = function(error, code, config, request, response, customProps) { + var axiosError = Object.create(prototype); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +module.exports = AxiosError; + + +/***/ }), + +/***/ 3214: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +function InterceptorManager() { + this.handlers = []; +} + +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; +}; + +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } +}; + +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); +}; + +module.exports = InterceptorManager; + + +/***/ }), + +/***/ 1934: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var isAbsoluteURL = __nccwpck_require__(1301); +var combineURLs = __nccwpck_require__(7189); + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +}; + + +/***/ }), + +/***/ 5062: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); +var transformData = __nccwpck_require__(9812); +var isCancel = __nccwpck_require__(6719); +var defaults = __nccwpck_require__(1626); +var CanceledError = __nccwpck_require__(4098); + +/** + * Throws a `CanceledError` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); + + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData.call( + config, + config.data, + config.headers, + config.transformRequest + ); + + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + + var adapter = config.adapter || defaults.adapter; + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + + return Promise.reject(reason); + }); +}; + + +/***/ }), + +/***/ 4831: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(undefined, config1[prop]); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(undefined, config2[prop]); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(undefined, config1[prop]); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(prop) { + if (prop in config2) { + return getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + return getMergedValue(undefined, config1[prop]); + } + } + + var mergeMap = { + 'url': valueFromConfig2, + 'method': valueFromConfig2, + 'data': valueFromConfig2, + 'baseURL': defaultToConfig2, + 'transformRequest': defaultToConfig2, + 'transformResponse': defaultToConfig2, + 'paramsSerializer': defaultToConfig2, + 'timeout': defaultToConfig2, + 'timeoutMessage': defaultToConfig2, + 'withCredentials': defaultToConfig2, + 'adapter': defaultToConfig2, + 'responseType': defaultToConfig2, + 'xsrfCookieName': defaultToConfig2, + 'xsrfHeaderName': defaultToConfig2, + 'onUploadProgress': defaultToConfig2, + 'onDownloadProgress': defaultToConfig2, + 'decompress': defaultToConfig2, + 'maxContentLength': defaultToConfig2, + 'maxBodyLength': defaultToConfig2, + 'beforeRedirect': defaultToConfig2, + 'transport': defaultToConfig2, + 'httpAgent': defaultToConfig2, + 'httpsAgent': defaultToConfig2, + 'cancelToken': defaultToConfig2, + 'socketPath': defaultToConfig2, + 'responseEncoding': defaultToConfig2, + 'validateStatus': mergeDirectKeys + }; + + utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { + var merge = mergeMap[prop] || mergeDeepProperties; + var configValue = merge(prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +}; + + +/***/ }), + +/***/ 3211: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var AxiosError = __nccwpck_require__(2093); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +}; + + +/***/ }), + +/***/ 9812: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); +var defaults = __nccwpck_require__(1626); + +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + var context = this || defaults; + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn.call(context, data, headers); + }); + + return data; +}; + + +/***/ }), + +/***/ 7024: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// eslint-disable-next-line strict +module.exports = __nccwpck_require__(4334); + + +/***/ }), + +/***/ 1626: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); +var normalizeHeaderName = __nccwpck_require__(6240); +var AxiosError = __nccwpck_require__(2093); +var transitionalDefaults = __nccwpck_require__(936); +var toFormData = __nccwpck_require__(470); + +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; + +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } +} + +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __nccwpck_require__(3454); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = __nccwpck_require__(8104); + } + return adapter; +} + +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +var defaults = { + + transitional: transitionalDefaults, + + adapter: getDefaultAdapter(), + + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + + var isObjectPayload = utils.isObject(data); + var contentType = headers && headers['Content-Type']; + + var isFileList; + + if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) { + var _FormData = this.env && this.env.FormData; + return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData()); + } else if (isObjectPayload || contentType === 'application/json') { + setContentTypeIfUnset(headers, 'application/json'); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + var transitional = this.transitional || defaults.transitional; + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; + + if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: __nccwpck_require__(7024) + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*' + } + } +}; + +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); + +module.exports = defaults; + + +/***/ }), + +/***/ 936: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + + +/***/ }), + +/***/ 4322: +/***/ ((module) => { + +module.exports = { + "version": "0.27.2" +}; + +/***/ }), + +/***/ 7065: +/***/ ((module) => { + +"use strict"; + + +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; +}; + + +/***/ }), + +/***/ 646: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } + + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); + + serializedParams = parts.join('&'); + } + + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +}; + + +/***/ }), + +/***/ 7189: +/***/ ((module) => { + +"use strict"; + + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +}; + + +/***/ }), + +/***/ 1545: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); + + +/***/ }), + +/***/ 1301: +/***/ ((module) => { + +"use strict"; + + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +}; + + +/***/ }), + +/***/ 650: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +module.exports = function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); +}; + + +/***/ }), + +/***/ 3608: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); + + +/***/ }), + +/***/ 6240: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); +}; + + +/***/ }), + +/***/ 6455: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + + if (!headers) { return parsed; } + + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); + + return parsed; +}; + + +/***/ }), + +/***/ 6107: +/***/ ((module) => { + +"use strict"; + + +module.exports = function parseProtocol(url) { + var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +}; + + +/***/ }), + +/***/ 4850: +/***/ ((module) => { + +"use strict"; + + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +}; + + +/***/ }), + +/***/ 470: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +/** + * Convert a data object to FormData + * @param {Object} obj + * @param {?Object} [formData] + * @returns {Object} + **/ + +function toFormData(obj, formData) { + // eslint-disable-next-line no-param-reassign + formData = formData || new FormData(); + + var stack = []; + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + function build(data, parentKey) { + if (utils.isPlainObject(data) || utils.isArray(data)) { + if (stack.indexOf(data) !== -1) { + throw Error('Circular reference detected in ' + parentKey); + } + + stack.push(data); + + utils.forEach(data, function each(value, key) { + if (utils.isUndefined(value)) return; + var fullKey = parentKey ? parentKey + '.' + key : key; + var arr; + + if (value && !parentKey && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) { + // eslint-disable-next-line func-names + arr.forEach(function(el) { + !utils.isUndefined(el) && formData.append(fullKey, convertValue(el)); + }); + return; + } + } + + build(value, fullKey); + }); + + stack.pop(); + } else { + formData.append(parentKey, convertValue(data)); + } + } + + build(obj); + + return formData; +} + +module.exports = toFormData; + + +/***/ }), + +/***/ 1632: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var VERSION = (__nccwpck_require__(4322).version); +var AxiosError = __nccwpck_require__(2093); + +var validators = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +var deprecatedWarnings = {}; + +/** + * Transitional option validator + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return function(value, opt, opts) { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +module.exports = { + assertOptions: assertOptions, + validators: validators +}; + + +/***/ }), + +/***/ 328: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var bind = __nccwpck_require__(7065); + +// utils is a library of generic helper functions non-specific to axios + +var toString = Object.prototype.toString; + +// eslint-disable-next-line func-names +var kindOf = (function(cache) { + // eslint-disable-next-line func-names + return function(thing) { + var str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); + }; +})(Object.create(null)); + +function kindOfTest(type) { + type = type.toLowerCase(); + return function isKindOf(thing) { + return kindOf(thing) === type; + }; +} + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ +function isArray(val) { + return Array.isArray(val); +} + +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; +} + +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +var isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} + +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} + +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} + +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (kindOf(val) !== 'object') { + return false; + } + + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} + +/** + * Determine if a value is a Date + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +var isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +var isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +var isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +var isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; +} + +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} + +/** + * Determine if a value is a FormData + * + * @param {Object} thing The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(thing) { + var pattern = '[object FormData]'; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || + toString.call(thing) === pattern || + (isFunction(thing.toString) && thing.toString() === pattern) + ); +} + +/** + * Determine if a value is a URLSearchParams object + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +var isURLSearchParams = kindOfTest('URLSearchParams'); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); +} + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } +} + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + */ + +function inherits(constructor, superConstructor, props, descriptors) { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + props && Object.assign(constructor.prototype, props); +} + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function} [filter] + * @returns {Object} + */ + +function toFlatObject(sourceObj, destObj, filter) { + var props; var i; var prop; var merged = {}; - destObj = destObj || {}; + destObj = destObj || {}; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if (!merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = Object.getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +} + +/* + * determines whether a string ends with the characters of a specified string + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * @returns {boolean} + */ +function endsWith(str, searchString, position) { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + var lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +} + + +/** + * Returns new array from array like object + * @param {*} [thing] + * @returns {Array} + */ +function toArray(thing) { + if (!thing) return null; + var i = thing.length; + if (isUndefined(i)) return null; + var arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +} + +// eslint-disable-next-line func-names +var isTypedArray = (function(TypedArray) { + // eslint-disable-next-line func-names + return function(thing) { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array)); + +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM, + inherits: inherits, + toFlatObject: toFlatObject, + kindOf: kindOf, + kindOfTest: kindOfTest, + endsWith: endsWith, + toArray: toArray, + isTypedArray: isTypedArray, + isFileList: isFileList +}; + + +/***/ }), + +/***/ 9417: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 5443: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var util = __nccwpck_require__(3837); +var Stream = (__nccwpck_require__(2781).Stream); +var DelayedStream = __nccwpck_require__(8611); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + + if (this._insideLoop) { + this._pendingNext = true; + return; // defer call + } + + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } +}; + +CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; + + +/***/ }), + +/***/ 8222: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(6243)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 6243: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 8237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(8222); +} else { + module.exports = __nccwpck_require__(4874); +} + + +/***/ }), + +/***/ 4874: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(6224); +const util = __nccwpck_require__(3837); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(9318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(6243)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 8611: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = (__nccwpck_require__(2781).Stream); +var util = __nccwpck_require__(3837); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; + + +/***/ }), + +/***/ 1133: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = __nccwpck_require__(8237)("follow-redirects"); + } + catch (error) { /* */ } + if (typeof debug !== "function") { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; + + +/***/ }), + +/***/ 7707: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var url = __nccwpck_require__(7310); +var URL = url.URL; +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var Writable = (__nccwpck_require__(2781).Writable); +var assert = __nccwpck_require__(9491); +var debug = __nccwpck_require__(1133); + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError +); +// Error types with codes +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded" +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + abortRequest(this._currentRequest); + this.emit("abort"); +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (isFunction(data)) { + callback = data; + data = encoding = null; + } + else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + + // Destroys the socket on timeout + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Stops a timeout from triggering + function clearTimer() { + // Clear the timeout + if (self._timeout) { + clearTimeout(self._timeout); + self._timeout = null; + } + + // Clean up all attached listeners + self.removeListener("abort", clearTimer); + self.removeListener("error", clearTimer); + self.removeListener("response", clearTimer); + if (callback) { + self.removeListener("timeout", callback); + } + if (!self.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Attach callback if passed + if (callback) { + this.on("timeout", callback); + } + + // Start the timer if or when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + // Clean up on events + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new TypeError("Unsupported protocol " + protocol)); + return; + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request and set up its event handlers + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + + // RFC7230§5.3.1: When making a request directly to an origin server, […] + // a client MUST send only the absolute path […] as the request-target. + this._currentUrl = /^\//.test(this._options.path) ? + url.format(this._options) : + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path; + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + + // If the response is not a redirect; return it as-is + var location = response.headers.location; + if (!location || this._options.followRedirects === false || + statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + return; + } + + // The response is a redirect, so abort the current request + abortRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new TooManyRedirectsError()); + return; + } + + // Store the request headers if applicable + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host"), + }, this._options.headers); + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + + // If the redirect is relative, carry over the host of the last request + var currentUrlParts = url.parse(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : + url.format(Object.assign(currentUrlParts, { host: currentHost })); + + // Determine the URL of the redirection + var redirectUrl; + try { + redirectUrl = url.resolve(currentUrl, location); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + return; + } + + // Create the redirected request + debug("redirecting to", redirectUrl); + this._isRedirect = true; + var redirectUrlParts = url.parse(redirectUrl); + Object.assign(this._options, redirectUrlParts); - do { - props = Object.getOwnPropertyNames(sourceObj); - i = props.length; - while (i-- > 0) { - prop = props[i]; - if (!merged[prop]) { - destObj[prop] = sourceObj[prop]; - merged[prop] = true; + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if (redirectUrlParts.protocol !== currentUrlParts.protocol && + redirectUrlParts.protocol !== "https:" || + redirectUrlParts.host !== currentHost && + !isSubdomain(redirectUrlParts.host, currentHost)) { + removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode: statusCode, + }; + var requestDetails = { + url: currentUrl, + method: method, + headers: requestHeaders, + }; + try { + beforeRedirect(this._options, responseDetails, requestDetails); + } + catch (err) { + this.emit("error", err); + return; + } + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + try { + this._performRequest(); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + } +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters + if (isString(input)) { + var parsed; + try { + parsed = urlToOptions(new URL(input)); + } + catch (err) { + /* istanbul ignore next */ + parsed = url.parse(input); + } + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + input = parsed; + } + else if (URL && (input instanceof URL)) { + input = urlToOptions(input); + } + else { + callback = options; + options = input; + input = { protocol: protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; } + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); } - sourceObj = Object.getPrototypeOf(sourceObj); - } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); - return destObj; + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; } -/* - * determines whether a string ends with the characters of a specified string - * @param {String} str - * @param {String} searchString - * @param {Number} [position= 0] - * @returns {boolean} - */ -function endsWith(str, searchString, position) { - str = String(str); - if (position === undefined || position > str.length) { - position = str.length; +/* istanbul ignore next */ +function noop() { /* empty */ } + +// from https://github.com/nodejs/node/blob/master/lib/internal/url.js +function urlToOptions(urlObject) { + var options = { + protocol: urlObject.protocol, + hostname: urlObject.hostname.startsWith("[") ? + /* istanbul ignore next */ + urlObject.hostname.slice(1, -1) : + urlObject.hostname, + hash: urlObject.hash, + search: urlObject.search, + pathname: urlObject.pathname, + path: urlObject.pathname + urlObject.search, + href: urlObject.href, + }; + if (urlObject.port !== "") { + options.port = Number(urlObject.port); } - position -= searchString.length; - var lastIndex = str.indexOf(searchString, position); - return lastIndex !== -1 && lastIndex === position; + return options; } +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return (lastValue === null || typeof lastValue === "undefined") ? + undefined : String(lastValue).trim(); +} -/** - * Returns new array from array like object - * @param {*} [thing] - * @returns {Array} - */ -function toArray(thing) { - if (!thing) return null; - var i = thing.length; - if (isUndefined(i)) return null; - var arr = new Array(i); - while (i-- > 0) { - arr[i] = thing[i]; +function createErrorType(code, message, baseClass) { + // Create constructor + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; } - return arr; + + // Attach constructor and set default properties + CustomError.prototype = new (baseClass || Error)(); + CustomError.prototype.constructor = CustomError; + CustomError.prototype.name = "Error [" + code + "]"; + return CustomError; } -// eslint-disable-next-line func-names -var isTypedArray = (function(TypedArray) { - // eslint-disable-next-line func-names - return function(thing) { - return TypedArray && thing instanceof TypedArray; - }; -})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array)); +function abortRequest(request) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.abort(); +} -module.exports = { - isArray: isArray, - isArrayBuffer: isArrayBuffer, - isBuffer: isBuffer, - isFormData: isFormData, - isArrayBufferView: isArrayBufferView, - isString: isString, - isNumber: isNumber, - isObject: isObject, - isPlainObject: isPlainObject, - isUndefined: isUndefined, - isDate: isDate, - isFile: isFile, - isBlob: isBlob, - isFunction: isFunction, - isStream: isStream, - isURLSearchParams: isURLSearchParams, - isStandardBrowserEnv: isStandardBrowserEnv, - forEach: forEach, - merge: merge, - extend: extend, - trim: trim, - stripBOM: stripBOM, - inherits: inherits, - toFlatObject: toFlatObject, - kindOf: kindOf, - kindOfTest: kindOfTest, - endsWith: endsWith, - toArray: toArray, - isTypedArray: isTypedArray, - isFileList: isFileList -}; +function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); +} + +function isString(value) { + return typeof value === "string" || value instanceof String; +} + +function isFunction(value) { + return typeof value === "function"; +} + +function isBuffer(value) { + return typeof value === "object" && ("length" in value); +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; /***/ }), -/***/ 5443: +/***/ 4334: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +var CombinedStream = __nccwpck_require__(5443); var util = __nccwpck_require__(3837); +var path = __nccwpck_require__(1017); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var parseUrl = (__nccwpck_require__(7310).parse); +var fs = __nccwpck_require__(7147); var Stream = (__nccwpck_require__(2781).Stream); -var DelayedStream = __nccwpck_require__(8611); +var mime = __nccwpck_require__(3583); +var asynckit = __nccwpck_require__(4812); +var populate = __nccwpck_require__(7142); -module.exports = CombinedStream; -function CombinedStream() { - this.writable = false; - this.readable = true; - this.dataSize = 0; - this.maxDataSize = 2 * 1024 * 1024; - this.pauseStreams = true; +// Public API +module.exports = FormData; - this._released = false; - this._streams = []; - this._currentStream = null; - this._insideLoop = false; - this._pendingNext = false; -} -util.inherits(CombinedStream, Stream); +// make it a Stream +util.inherits(FormData, CombinedStream); -CombinedStream.create = function(options) { - var combinedStream = new this(); +/** + * Create readable "multipart/form-data" streams. + * Can be used to submit forms + * and file uploads to other web applications. + * + * @constructor + * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream + */ +function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(options); + } + + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + + CombinedStream.call(this); options = options || {}; for (var option in options) { - combinedStream[option] = options[option]; + this[option] = options[option]; } +} - return combinedStream; -}; +FormData.LINE_BREAK = '\r\n'; +FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; -CombinedStream.isStreamLike = function(stream) { - return (typeof stream !== 'function') - && (typeof stream !== 'string') - && (typeof stream !== 'boolean') - && (typeof stream !== 'number') - && (!Buffer.isBuffer(stream)); -}; +FormData.prototype.append = function(field, value, options) { -CombinedStream.prototype.append = function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); + options = options || {}; - if (isStreamLike) { - if (!(stream instanceof DelayedStream)) { - var newStream = DelayedStream.create(stream, { - maxDataSize: Infinity, - pauseStream: this.pauseStreams, - }); - stream.on('data', this._checkDataSize.bind(this)); - stream = newStream; - } + // allow filename as single option + if (typeof options == 'string') { + options = {filename: options}; + } - this._handleErrors(stream); + var append = CombinedStream.prototype.append.bind(this); - if (this.pauseStreams) { - stream.pause(); - } + // all that streamy business can't handle numbers + if (typeof value == 'number') { + value = '' + value; } - this._streams.push(stream); - return this; -}; + // https://github.com/felixge/node-form-data/issues/38 + if (util.isArray(value)) { + // Please convert your array into string + // the way web server expects it + this._error(new Error('Arrays are not supported.')); + return; + } -CombinedStream.prototype.pipe = function(dest, options) { - Stream.prototype.pipe.call(this, dest, options); - this.resume(); - return dest; + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + + append(header); + append(value); + append(footer); + + // pass along options.knownLength + this._trackLength(header, value, options); }; -CombinedStream.prototype._getNext = function() { - this._currentStream = null; +FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; - if (this._insideLoop) { - this._pendingNext = true; - return; // defer call + // used w/ getLengthSync(), when length is known. + // e.g. for streaming directly from a remote server, + // w/ a known file a size, and not wanting to wait for + // incoming file to finish to get its size. + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === 'string') { + valueLength = Buffer.byteLength(value); } - this._insideLoop = true; - try { - do { - this._pendingNext = false; - this._realGetNext(); - } while (this._pendingNext); - } finally { - this._insideLoop = false; + this._valueLength += valueLength; + + // @check why add CRLF? does this account for custom/multiple CRLFs? + this._overheadLength += + Buffer.byteLength(header) + + FormData.LINE_BREAK.length; + + // empty or either doesn't have path or not an http response or not a stream + if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) { + return; + } + + // no need to bother with the length + if (!options.knownLength) { + this._valuesToMeasure.push(value); } }; -CombinedStream.prototype._realGetNext = function() { - var stream = this._streams.shift(); +FormData.prototype._lengthRetriever = function(value, callback) { + if (value.hasOwnProperty('fd')) { - if (typeof stream == 'undefined') { - this.end(); - return; + // take read range into a account + // `end` = Infinity –> read file till the end + // + // TODO: Looks like there is bug in Node fs.createReadStream + // it doesn't respect `end` options without `start` options + // Fix it when node fixes it. + // https://github.com/joyent/node/issues/7819 + if (value.end != undefined && value.end != Infinity && value.start != undefined) { + + // when end specified + // no need to calculate range + // inclusive, starts with 0 + callback(null, value.end + 1 - (value.start ? value.start : 0)); + + // not that fast snoopy + } else { + // still need to fetch file size from fs + fs.stat(value.path, function(err, stat) { + + var fileSize; + + if (err) { + callback(err); + return; + } + + // update final size based on the range options + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + + // or http response + } else if (value.hasOwnProperty('httpVersion')) { + callback(null, +value.headers['content-length']); + + // or request stream http://github.com/mikeal/request + } else if (value.hasOwnProperty('httpModule')) { + // wait till response come back + value.on('response', function(response) { + value.pause(); + callback(null, +response.headers['content-length']); + }); + value.resume(); + + // something else + } else { + callback('Unknown stream'); } +}; - if (typeof stream !== 'function') { - this._pipeNext(stream); - return; +FormData.prototype._multiPartHeader = function(field, value, options) { + // custom header specified (as string)? + // it becomes responsible for boundary + // (e.g. to handle extra CRLFs on .NET servers) + if (typeof options.header == 'string') { + return options.header; } - var getStream = stream; - getStream(function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('data', this._checkDataSize.bind(this)); - this._handleErrors(stream); + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + + var contents = ''; + var headers = { + // add custom disposition as third element or keep it two elements if not + 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + 'Content-Type': [].concat(contentType || []) + }; + + // allow custom headers. + if (typeof options.header == 'object') { + populate(headers, options.header); + } + + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) continue; + header = headers[prop]; + + // skip nullish headers. + if (header == null) { + continue; } - this._pipeNext(stream); - }.bind(this)); -}; - -CombinedStream.prototype._pipeNext = function(stream) { - this._currentStream = stream; + // convert all headers to arrays. + if (!Array.isArray(header)) { + header = [header]; + } - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('end', this._getNext.bind(this)); - stream.pipe(this, {end: false}); - return; + // add non-empty headers. + if (header.length) { + contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; + } } - var value = stream; - this.write(value); - this._getNext(); + return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; }; -CombinedStream.prototype._handleErrors = function(stream) { - var self = this; - stream.on('error', function(err) { - self._emitError(err); - }); -}; +FormData.prototype._getContentDisposition = function(value, options) { -CombinedStream.prototype.write = function(data) { - this.emit('data', data); -}; + var filename + , contentDisposition + ; -CombinedStream.prototype.pause = function() { - if (!this.pauseStreams) { - return; + if (typeof options.filepath === 'string') { + // custom filepath for relative paths + filename = path.normalize(options.filepath).replace(/\\/g, '/'); + } else if (options.filename || value.name || value.path) { + // custom filename take precedence + // formidable and the browser add a name property + // fs- and request- streams have path property + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty('httpVersion')) { + // or try http response + filename = path.basename(value.client._httpMessage.path || ''); } - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); - this.emit('pause'); -}; - -CombinedStream.prototype.resume = function() { - if (!this._released) { - this._released = true; - this.writable = true; - this._getNext(); + if (filename) { + contentDisposition = 'filename="' + filename + '"'; } - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); - this.emit('resume'); -}; - -CombinedStream.prototype.end = function() { - this._reset(); - this.emit('end'); + return contentDisposition; }; -CombinedStream.prototype.destroy = function() { - this._reset(); - this.emit('close'); -}; +FormData.prototype._getContentType = function(value, options) { -CombinedStream.prototype._reset = function() { - this.writable = false; - this._streams = []; - this._currentStream = null; -}; + // use custom content-type above all + var contentType = options.contentType; -CombinedStream.prototype._checkDataSize = function() { - this._updateDataSize(); - if (this.dataSize <= this.maxDataSize) { - return; + // or try `name` from formidable, browser + if (!contentType && value.name) { + contentType = mime.lookup(value.name); } - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; - this._emitError(new Error(message)); -}; - -CombinedStream.prototype._updateDataSize = function() { - this.dataSize = 0; + // or try `path` from fs-, request- streams + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } - var self = this; - this._streams.forEach(function(stream) { - if (!stream.dataSize) { - return; - } + // or if it's http-reponse + if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { + contentType = value.headers['content-type']; + } - self.dataSize += stream.dataSize; - }); + // or guess it from the filepath or filename + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } - if (this._currentStream && this._currentStream.dataSize) { - this.dataSize += this._currentStream.dataSize; + // fallback to the default content type if `value` is not simple value + if (!contentType && typeof value == 'object') { + contentType = FormData.DEFAULT_CONTENT_TYPE; } -}; -CombinedStream.prototype._emitError = function(err) { - this._reset(); - this.emit('error', err); + return contentType; }; +FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; -/***/ }), - -/***/ 8222: -/***/ ((module, exports, __nccwpck_require__) => { + var lastPart = (this._streams.length === 0); + if (lastPart) { + footer += this._lastBoundary(); + } -/* eslint-env browser */ + next(footer); + }.bind(this); +}; -/** - * This is the web browser implementation of `debug()`. - */ +FormData.prototype._lastBoundary = function() { + return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; +}; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -exports.destroy = (() => { - let warned = false; +FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() + }; - return () => { - if (!warned) { - warned = true; - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } - }; -})(); + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } -/** - * Colors. - */ + return formHeaders; +}; -exports.colors = [ - '#0000CC', - '#0000FF', - '#0033CC', - '#0033FF', - '#0066CC', - '#0066FF', - '#0099CC', - '#0099FF', - '#00CC00', - '#00CC33', - '#00CC66', - '#00CC99', - '#00CCCC', - '#00CCFF', - '#3300CC', - '#3300FF', - '#3333CC', - '#3333FF', - '#3366CC', - '#3366FF', - '#3399CC', - '#3399FF', - '#33CC00', - '#33CC33', - '#33CC66', - '#33CC99', - '#33CCCC', - '#33CCFF', - '#6600CC', - '#6600FF', - '#6633CC', - '#6633FF', - '#66CC00', - '#66CC33', - '#9900CC', - '#9900FF', - '#9933CC', - '#9933FF', - '#99CC00', - '#99CC33', - '#CC0000', - '#CC0033', - '#CC0066', - '#CC0099', - '#CC00CC', - '#CC00FF', - '#CC3300', - '#CC3333', - '#CC3366', - '#CC3399', - '#CC33CC', - '#CC33FF', - '#CC6600', - '#CC6633', - '#CC9900', - '#CC9933', - '#CCCC00', - '#CCCC33', - '#FF0000', - '#FF0033', - '#FF0066', - '#FF0099', - '#FF00CC', - '#FF00FF', - '#FF3300', - '#FF3333', - '#FF3366', - '#FF3399', - '#FF33CC', - '#FF33FF', - '#FF6600', - '#FF6633', - '#FF9900', - '#FF9933', - '#FFCC00', - '#FFCC33' -]; +FormData.prototype.setBoundary = function(boundary) { + this._boundary = boundary; +}; -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ +FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } -// eslint-disable-next-line complexity -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } + return this._boundary; +}; - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } +FormData.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc( 0 ); + var boundary = this.getBoundary(); - // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // Is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // Double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); -} + // Create the form content. Add Line breaks to the end of data. + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== 'function') { -/** - * Colorize log arguments if enabled. - * - * @api public - */ + // Add content to the buffer. + if(Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); + }else { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); + } -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + - this.namespace + - (this.useColors ? ' %c' : ' ') + - args[0] + - (this.useColors ? '%c ' : ' ') + - '+' + module.exports.humanize(this.diff); + // Add break after content. + if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); + } + } + } - if (!this.useColors) { - return; - } + // Add the footer and return the Buffer object. + return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); +}; - const c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); +FormData.prototype._generateBoundary = function() { + // This generates a 50 character boundary similar to those used by Firefox. + // They are optimized for boyer-moore parsing. + var boundary = '--------------------------'; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } - // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, match => { - if (match === '%%') { - return; - } - index++; - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); + this._boundary = boundary; +}; - args.splice(lastC, 0, c); -} +// Note: getLengthSync DOESN'T calculate streams length +// As workaround one can calculate file size manually +// and add it as knownLength option +FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; -/** - * Invokes `console.debug()` when available. - * No-op when `console.debug` is not a "function". - * If `console.debug` is not available, falls back - * to `console.log`. - * - * @api public - */ -exports.log = console.debug || console.log || (() => {}); + // Don't get confused, there are 3 "internal" streams for each keyval pair + // so it basically checks if there is any value added to the form + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} + // https://github.com/form-data/form-data/issues/40 + if (!this.hasKnownLength()) { + // Some async length retrievers are present + // therefore synchronous length calculation is false. + // Please use getLength(callback) to get proper length + this._error(new Error('Cannot calculate proper length in synchronous way.')); + } -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ -function load() { - let r; - try { - r = exports.storage.getItem('debug'); - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } + return knownLength; +}; - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } +// Public API to check if length of added values is known +// https://github.com/form-data/form-data/issues/196 +// https://github.com/form-data/form-data/issues/262 +FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; - return r; -} + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ + return hasKnownLength; +}; -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} +FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; -module.exports = __nccwpck_require__(6243)(exports); + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } -const {formatters} = module.exports; + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } + values.forEach(function(length) { + knownLength += length; + }); + + cb(null, knownLength); + }); }; +FormData.prototype.submit = function(params, cb) { + var request + , options + , defaults = {method: 'post'} + ; -/***/ }), + // parse provided url if it's string + // or treat it as options object + if (typeof params == 'string') { -/***/ 6243: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + // use custom params + } else { -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ + options = populate(params, defaults); + // if no port provided use default one + if (!options.port) { + options.port = options.protocol == 'https:' ? 443 : 80; + } + } -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = __nccwpck_require__(900); - createDebug.destroy = destroy; + // put that good code in getHeaders to some use + options.headers = this.getHeaders(params.headers); - Object.keys(env).forEach(key => { - createDebug[key] = env[key]; - }); + // https if specified, fallback to http in any other case + if (options.protocol == 'https:') { + request = https.request(options); + } else { + request = http.request(options); + } - /** - * The currently active debug mode names, and names to skip. - */ + // get content length and fire away + this.getLength(function(err, length) { + if (err && err !== 'Unknown stream') { + this._error(err); + return; + } - createDebug.names = []; - createDebug.skips = []; + // add content length + if (length) { + request.setHeader('Content-Length', length); + } - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - createDebug.formatters = {}; + this.pipe(request); + if (cb) { + var onResponse; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - function selectColor(namespace) { - let hash = 0; + var callback = function (error, responce) { + request.removeListener('error', callback); + request.removeListener('response', onResponse); - for (let i = 0; i < namespace.length; i++) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } + return cb.call(this, error, responce); + }; - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; + onResponse = callback.bind(this, null); - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; + request.on('error', callback); + request.on('response', onResponse); + } + }.bind(this)); - function debug(...args) { - // Disabled? - if (!debug.enabled) { - return; - } + return request; +}; - const self = debug; +FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit('error', err); + } +}; - // Set `diff` timestamp - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; +FormData.prototype.toString = function () { + return '[object FormData]'; +}; - args[0] = createDebug.coerce(args[0]); - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } +/***/ }), - // Apply any `formatters` transformations - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return '%'; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === 'function') { - const val = args[index]; - match = formatter.call(self, val); +/***/ 7142: +/***/ ((module) => { - // Now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); +// populates missing values +module.exports = function(dst, src) { - // Apply env-specific formatting (colors, etc.) - createDebug.formatArgs.call(self, args); + Object.keys(src).forEach(function(prop) + { + dst[prop] = dst[prop] || src[prop]; + }); - const logFn = self.log || createDebug.log; - logFn.apply(self, args); - } + return dst; +}; - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - Object.defineProperty(debug, 'enabled', { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } +/***/ }), - return enabledCache; - }, - set: v => { - enableOverride = v; - } - }); +/***/ 6863: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Env-specific initialization logic for debug instances - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = __nccwpck_require__(7147) +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = __nccwpck_require__(1734) + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} - return debug; - } +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } - createDebug.names = []; - createDebug.skips = []; + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} - let i; - const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - const len = split.length; +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - } +/***/ }), - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) - ].join(','); - createDebug.enable(''); - return namespaces; - } +/***/ 1734: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var pathModule = __nccwpck_require__(1017); +var isWindows = process.platform === 'win32'; +var fs = __nccwpck_require__(7147); - let i; - let len; +// JavaScript implementation of realpath, ported from node pre-v6 - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; - return false; - } + return callback; - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - function toNamespace(regexp) { - return regexp.toString() - .substring(2, regexp.toString().length - 2) - .replace(/\.\*\?$/, '*'); - } + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} - /** - * XXX DO NOT USE. This is a temporary stub function. - * XXX It WILL be removed in the next major release. - */ - function destroy() { - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} - createDebug.enable(createDebug.load()); +var normalize = pathModule.normalize; - return createDebug; +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; } -module.exports = setup; +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } -/***/ }), + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } -/***/ 8237: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } -/** - * Detect Electron renderer / nwjs process, which is node, but we should - * treat as a browser. - */ + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = __nccwpck_require__(8222); -} else { - module.exports = __nccwpck_require__(4874); -} + if (cache) cache[original] = p; + return p; +}; -/***/ }), -/***/ 4874: -/***/ ((module, exports, __nccwpck_require__) => { +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } -/** - * Module dependencies. - */ + // make p is absolute + p = pathModule.resolve(p); -const tty = __nccwpck_require__(6224); -const util = __nccwpck_require__(3837); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } -/** - * This is the Node.js implementation of `debug()`. - */ + var original = p, + seenLinks = {}, + knownHard = {}; -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.destroy = util.deprecate( - () => {}, - 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' -); + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; -/** - * Colors. - */ + start(); -exports.colors = [6, 2, 3, 4, 5, 1]; + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = __nccwpck_require__(9318); + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 - ]; - } -} catch (error) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } - // Coerce string value into JS value - let val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } - obj[prop] = val; - return obj; -}, {}); + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; + + +/***/ }), + +/***/ 7625: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored -function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) } -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ +var fs = __nccwpck_require__(7147) +var path = __nccwpck_require__(1017) +var minimatch = __nccwpck_require__(6453) +var isAbsolute = (__nccwpck_require__(1017).isAbsolute) +var Minimatch = minimatch.Minimatch -function formatArgs(args) { - const {namespace: name, useColors} = this; +function alphasort (a, b) { + return a.localeCompare(b, 'en') +} - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; +function setupIgnores (self, options) { + self.ignore = options.ignore || [] - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } } -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } -function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } } -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + self.fs = options.fs || fs + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = path.resolve(cwd) + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + self.nomount = !!options.nomount + + if (process.platform === "win32") { + self.root = self.root.replace(/\\/g, "/") + self.cwd = self.cwd.replace(/\\/g, "/") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + } + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + // always treat \ in patterns as escapes, not path separators + options.allowWindowsEscape = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options } -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } -function load() { - return process.env.DEBUG; + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all } -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' -function init(debug) { - debug.inspectOpts = {}; + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m } -module.exports = __nccwpck_require__(6243)(exports); +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } -const {formatters} = module.exports; + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') -/** - * Map %o to `util.inspect()`, all on a single line. - */ + return abs +} -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .split('\n') - .map(str => str.trim()) - .join(' '); -}; -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} /***/ }), -/***/ 8611: +/***/ 1957: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var Stream = (__nccwpck_require__(2781).Stream); -var util = __nccwpck_require__(3837); +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var rp = __nccwpck_require__(6863) +var minimatch = __nccwpck_require__(6453) +var Minimatch = minimatch.Minimatch +var inherits = __nccwpck_require__(4124) +var EE = (__nccwpck_require__(2361).EventEmitter) +var path = __nccwpck_require__(1017) +var assert = __nccwpck_require__(9491) +var isAbsolute = (__nccwpck_require__(1017).isAbsolute) +var globSync = __nccwpck_require__(9010) +var common = __nccwpck_require__(7625) +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = __nccwpck_require__(2492) +var util = __nccwpck_require__(3837) +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = __nccwpck_require__(1223) + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} -module.exports = DelayedStream; -function DelayedStream() { - this.source = null; - this.dataSize = 0; - this.maxDataSize = 1024 * 1024; - this.pauseStream = true; +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync - this._maxDataSizeExceeded = false; - this._released = false; - this._bufferedEvents = []; +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin } -util.inherits(DelayedStream, Stream); -DelayedStream.create = function(source, options) { - var delayedStream = new this(); +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true - options = options || {}; - for (var option in options) { - delayedStream[option] = options[option]; + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true } - delayedStream.source = source; + return false +} - var realEmit = source.emit; - source.emit = function() { - delayedStream._handleEmit(arguments); - return realEmit.apply(source, arguments); - }; +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } - source.on('error', function() {}); - if (delayedStream.pauseStream) { - source.pause(); + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) } - return delayedStream; -}; + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) -Object.defineProperty(DelayedStream.prototype, 'readable', { - configurable: true, - enumerable: true, - get: function() { - return this.source.readable; + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) } -}); -DelayedStream.prototype.setEncoding = function() { - return this.source.setEncoding.apply(this.source, arguments); -}; + var self = this + this._processing = 0 -DelayedStream.prototype.resume = function() { - if (!this._released) { - this.release(); + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) } + sync = false - this.source.resume(); -}; + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} -DelayedStream.prototype.pause = function() { - this.source.pause(); -}; +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return -DelayedStream.prototype.release = function() { - this._released = true; + if (this.realpath && !this._didRealpath) + return this._realpath() - this._bufferedEvents.forEach(function(args) { - this.emit.apply(this, args); - }.bind(this)); - this._bufferedEvents = []; -}; + common.finish(this) + this.emit('end', this.found) +} -DelayedStream.prototype.pipe = function() { - var r = Stream.prototype.pipe.apply(this, arguments); - this.resume(); - return r; -}; +Glob.prototype._realpath = function () { + if (this._didRealpath) + return -DelayedStream.prototype._handleEmit = function(args) { - if (this._released) { - this.emit.apply(this, args); - return; + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') } +} - if (args[0] === 'data') { - this.dataSize += args[1].length; - this._checkIfMaxDataSizeExceeded(); +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } } +} - this._bufferedEvents.push(args); -}; +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} -DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { - if (this._maxDataSizeExceeded) { - return; - } +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} - if (this.dataSize <= this.maxDataSize) { - return; +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } } - this._maxDataSizeExceeded = true; - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' - this.emit('error', new Error(message)); -}; + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() -/***/ }), + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. -/***/ 1133: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) -var debug; + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } -module.exports = function () { - if (!debug) { - try { - /* eslint global-require: off */ - debug = __nccwpck_require__(8237)("follow-redirects"); + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) } - catch (error) { /* */ } - if (typeof debug !== "function") { - debug = function () { /* */ }; + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e } + this._process([e].concat(remain), index, inGlobStar, cb) } - debug.apply(null, arguments); -}; + cb() +} +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return -/***/ }), + if (isIgnored(this, e)) + return -/***/ 7707: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (this.paused) { + this._emitQueue.push([index, e]) + return + } -var url = __nccwpck_require__(7310); -var URL = url.URL; -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var Writable = (__nccwpck_require__(2781).Writable); -var assert = __nccwpck_require__(9491); -var debug = __nccwpck_require__(1133); + var abs = isAbsolute(e) ? e : this._makeAbs(e) -// Create handlers that pass events from native requests -var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; -var eventHandlers = Object.create(null); -events.forEach(function (event) { - eventHandlers[event] = function (arg1, arg2, arg3) { - this._redirectable.emit(event, arg1, arg2, arg3); - }; -}); + if (this.mark) + e = this._mark(e) -var InvalidUrlError = createErrorType( - "ERR_INVALID_URL", - "Invalid URL", - TypeError -); -// Error types with codes -var RedirectionError = createErrorType( - "ERR_FR_REDIRECTION_FAILURE", - "Redirected request failed" -); -var TooManyRedirectsError = createErrorType( - "ERR_FR_TOO_MANY_REDIRECTS", - "Maximum number of redirects exceeded" -); -var MaxBodyLengthExceededError = createErrorType( - "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", - "Request body larger than maxBodyLength limit" -); -var WriteAfterEndError = createErrorType( - "ERR_STREAM_WRITE_AFTER_END", - "write after end" -); + if (this.absolute) + e = abs -// An HTTP(S) request that can be redirected -function RedirectableRequest(options, responseCallback) { - // Initialize the request - Writable.call(this); - this._sanitizeOptions(options); - this._options = options; - this._ended = false; - this._ending = false; - this._redirectCount = 0; - this._redirects = []; - this._requestBodyLength = 0; - this._requestBodyBuffers = []; + if (this.matches[index][e]) + return - // Attach a callback if passed - if (responseCallback) { - this.on("response", responseCallback); + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return } - // React to responses of native requests - var self = this; - this._onNativeResponse = function (response) { - self._processResponse(response); - }; + this.matches[index][e] = true - // Perform the first request - this._performRequest(); + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) } -RedirectableRequest.prototype = Object.create(Writable.prototype); -RedirectableRequest.prototype.abort = function () { - abortRequest(this._currentRequest); - this.emit("abort"); -}; +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return -// Writes buffered data to the current native request -RedirectableRequest.prototype.write = function (data, encoding, callback) { - // Writing is not allowed if end has been called - if (this._ending) { - throw new WriteAfterEndError(); + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + self.fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) } +} - // Validate input and shift parameters if necessary - if (!isString(data) && !isBuffer(data)) { - throw new TypeError("data should be a string, Buffer or Uint8Array"); +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) } - if (isFunction(encoding)) { - callback = encoding; - encoding = null; + + var self = this + self.fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) } +} - // Ignore empty buffers, since writing them doesn't invoke the callback - // https://github.com/nodejs/node/issues/22066 - if (data.length === 0) { - if (callback) { - callback(); +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true } - return; - } - // Only write when we don't exceed the maximum body length - if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { - this._requestBodyLength += data.length; - this._requestBodyBuffers.push({ data: data, encoding: encoding }); - this._currentRequest.write(data, encoding, callback); - } - // Error when we exceed the maximum body length - else { - this.emit("error", new MaxBodyLengthExceededError()); - this.abort(); } -}; -// Ends the current native request -RedirectableRequest.prototype.end = function (data, encoding, callback) { - // Shift parameters if necessary - if (isFunction(data)) { - callback = data; - data = encoding = null; - } - else if (isFunction(encoding)) { - callback = encoding; - encoding = null; - } + this.cache[abs] = entries + return cb(null, entries) +} - // Write data if needed and end - if (!data) { - this._ended = this._ending = true; - this._currentRequest.end(null, null, callback); - } - else { - var self = this; - var currentRequest = this._currentRequest; - this.write(data, encoding, function () { - self._ended = true; - currentRequest.end(null, null, callback); - }); - this._ending = true; - } -}; +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} -// Sets a header value on the current native request -RedirectableRequest.prototype.setHeader = function (name, value) { - this._options.headers[name] = value; - this._currentRequest.setHeader(name, value); -}; +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -// Clears a header value on the current native request -RedirectableRequest.prototype.removeHeader = function (name) { - delete this._options.headers[name]; - this._currentRequest.removeHeader(name); -}; -// Global timeout for all underlying requests -RedirectableRequest.prototype.setTimeout = function (msecs, callback) { - var self = this; +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) - // Destroys the socket on timeout - function destroyOnTimeout(socket) { - socket.setTimeout(msecs); - socket.removeListener("timeout", socket.destroy); - socket.addListener("timeout", socket.destroy); - } + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() - // Sets up a timer to trigger a timeout event - function startTimer(socket) { - if (self._timeout) { - clearTimeout(self._timeout); - } - self._timeout = setTimeout(function () { - self.emit("timeout"); - clearTimer(); - }, msecs); - destroyOnTimeout(socket); + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) } - // Stops a timeout from triggering - function clearTimer() { - // Clear the timeout - if (self._timeout) { - clearTimeout(self._timeout); - self._timeout = null; - } + cb() +} - // Clean up all attached listeners - self.removeListener("abort", clearTimer); - self.removeListener("error", clearTimer); - self.removeListener("response", clearTimer); - if (callback) { - self.removeListener("timeout", callback); - } - if (!self.socket) { - self._currentRequest.removeListener("socket", startTimer); +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' } } - // Attach callback if passed - if (callback) { - this.on("timeout", callback); - } + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - // Start the timer if or when the socket is opened - if (this.socket) { - startTimer(this.socket); - } - else { - this._currentRequest.once("socket", startTimer); - } + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() - // Clean up on events - this.on("socket", destroyOnTimeout); - this.on("abort", clearTimer); - this.on("error", clearTimer); - this.on("response", clearTimer); + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] - return this; -}; + if (Array.isArray(c)) + c = 'DIR' -// Proxy all other public ClientRequest methods -[ - "flushHeaders", "getHeader", - "setNoDelay", "setSocketKeepAlive", -].forEach(function (method) { - RedirectableRequest.prototype[method] = function (a, b) { - return this._currentRequest[method](a, b); - }; -}); + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) -// Proxy all public ClientRequest properties -["aborted", "connection", "socket"].forEach(function (property) { - Object.defineProperty(RedirectableRequest.prototype, property, { - get: function () { return this._currentRequest[property]; }, - }); -}); + if (needDir && c === 'FILE') + return cb() -RedirectableRequest.prototype._sanitizeOptions = function (options) { - // Ensure headers are always present - if (!options.headers) { - options.headers = {}; + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. } - // Since http.request treats host as an alias of hostname, - // but the url module interprets host as hostname plus port, - // eliminate the host property to avoid confusion. - if (options.host) { - // Use hostname if set, because it has precedence - if (!options.hostname) { - options.hostname = options.host; + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + self.fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return self.fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) } - delete options.host; } +} - // Complete the URL object when necessary - if (!options.pathname && options.path) { - var searchPos = options.path.indexOf("?"); - if (searchPos < 0) { - options.pathname = options.path; - } - else { - options.pathname = options.path.substring(0, searchPos); - options.search = options.path.substring(searchPos); - } +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() } -}; + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat -// Executes the next native request (initial or redirect) -RedirectableRequest.prototype._performRequest = function () { - // Load the native protocol - var protocol = this._options.protocol; - var nativeProtocol = this._options.nativeProtocols[protocol]; - if (!nativeProtocol) { - this.emit("error", new TypeError("Unsupported protocol " + protocol)); - return; - } + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) - // If specified, use the agent corresponding to the protocol - // (HTTP and HTTPS use different types of agents) - if (this._options.agents) { - var scheme = protocol.slice(0, -1); - this._options.agent = this._options.agents[scheme]; - } + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c - // Create the native request and set up its event handlers - var request = this._currentRequest = - nativeProtocol.request(this._options, this._onNativeResponse); - request._redirectable = this; - for (var event of events) { - request.on(event, eventHandlers[event]); - } + if (needDir && c === 'FILE') + return cb() - // RFC7230§5.3.1: When making a request directly to an origin server, […] - // a client MUST send only the absolute path […] as the request-target. - this._currentUrl = /^\//.test(this._options.path) ? - url.format(this._options) : - // When making a request to a proxy, […] - // a client MUST send the target URI in absolute-form […]. - this._options.path; + return cb(null, c, stat) +} - // End a redirected request - // (The first request must be ended explicitly with RedirectableRequest#end) - if (this._isRedirect) { - // Write the request entity and end - var i = 0; - var self = this; - var buffers = this._requestBodyBuffers; - (function writeNext(error) { - // Only write if this request has not been redirected yet - /* istanbul ignore else */ - if (request === self._currentRequest) { - // Report any write errors - /* istanbul ignore if */ - if (error) { - self.emit("error", error); - } - // Write the next buffer if there are still left - else if (i < buffers.length) { - var buffer = buffers[i++]; - /* istanbul ignore else */ - if (!request.finished) { - request.write(buffer.data, buffer.encoding, writeNext); - } - } - // End the request if `end` has been called on us - else if (self._ended) { - request.end(); - } - } - }()); - } -}; -// Processes a response from the current native request -RedirectableRequest.prototype._processResponse = function (response) { - // Store the redirected response - var statusCode = response.statusCode; - if (this._options.trackRedirects) { - this._redirects.push({ - url: this._currentUrl, - headers: response.headers, - statusCode: statusCode, - }); - } +/***/ }), - // RFC7231§6.4: The 3xx (Redirection) class of status code indicates - // that further action needs to be taken by the user agent in order to - // fulfill the request. If a Location header field is provided, - // the user agent MAY automatically redirect its request to the URI - // referenced by the Location field value, - // even if the specific status code is not understood. +/***/ 1046: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // If the response is not a redirect; return it as-is - var location = response.headers.location; - if (!location || this._options.followRedirects === false || - statusCode < 300 || statusCode >= 400) { - response.responseUrl = this._currentUrl; - response.redirects = this._redirects; - this.emit("response", response); +var balanced = __nccwpck_require__(9417); - // Clean up - this._requestBodyBuffers = []; - return; - } +module.exports = expandTop; - // The response is a redirect, so abort the current request - abortRequest(this._currentRequest); - // Discard the remainder of the response to avoid waiting for data - response.destroy(); +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; - // RFC7231§6.4: A client SHOULD detect and intervene - // in cyclical redirections (i.e., "infinite" redirection loops). - if (++this._redirectCount > this._options.maxRedirects) { - this.emit("error", new TooManyRedirectsError()); - return; - } +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} - // Store the request headers if applicable - var requestHeaders; - var beforeRedirect = this._options.beforeRedirect; - if (beforeRedirect) { - requestHeaders = Object.assign({ - // The Host header was set by nativeProtocol.request - Host: response.req.getHeader("host"), - }, this._options.headers); - } +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} - // RFC7231§6.4: Automatic redirection needs to done with - // care for methods not known to be safe, […] - // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change - // the request method from POST to GET for the subsequent request. - var method = this._options.method; - if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || - // RFC7231§6.4.4: The 303 (See Other) status code indicates that - // the server is redirecting the user agent to a different resource […] - // A user agent can perform a retrieval request targeting that URI - // (a GET or HEAD request if using HTTP) […] - (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { - this._options.method = "GET"; - // Drop a possible entity and headers related to it - this._requestBodyBuffers = []; - removeMatchingHeaders(/^content-/i, this._options.headers); - } +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} - // Drop the Host header, as the redirect might lead to a different host - var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); - // If the redirect is relative, carry over the host of the last request - var currentUrlParts = url.parse(this._currentUrl); - var currentHost = currentHostHeader || currentUrlParts.host; - var currentUrl = /^\w+:/.test(location) ? this._currentUrl : - url.format(Object.assign(currentUrlParts, { host: currentHost })); +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; - // Determine the URL of the redirection - var redirectUrl; - try { - redirectUrl = url.resolve(currentUrl, location); - } - catch (cause) { - this.emit("error", new RedirectionError({ cause: cause })); - return; - } + var parts = []; + var m = balanced('{', '}', str); - // Create the redirected request - debug("redirecting to", redirectUrl); - this._isRedirect = true; - var redirectUrlParts = url.parse(redirectUrl); - Object.assign(this._options, redirectUrlParts); + if (!m) + return str.split(','); - // Drop confidential headers when redirecting to a less secure protocol - // or to a different domain that is not a superdomain - if (redirectUrlParts.protocol !== currentUrlParts.protocol && - redirectUrlParts.protocol !== "https:" || - redirectUrlParts.host !== currentHost && - !isSubdomain(redirectUrlParts.host, currentHost)) { - removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); - } + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); - // Evaluate the beforeRedirect callback - if (isFunction(beforeRedirect)) { - var responseDetails = { - headers: response.headers, - statusCode: statusCode, - }; - var requestDetails = { - url: currentUrl, - method: method, - headers: requestHeaders, - }; - try { - beforeRedirect(this._options, responseDetails, requestDetails); - } - catch (err) { - this.emit("error", err); - return; - } - this._sanitizeOptions(this._options); + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); } - // Perform the redirected request - try { - this._performRequest(); - } - catch (cause) { - this.emit("error", new RedirectionError({ cause: cause })); + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); } -}; -// Wraps the key/value object of protocols with redirect functionality -function wrap(protocols) { - // Default settings - var exports = { - maxRedirects: 21, - maxBodyLength: 10 * 1024 * 1024, - }; + return expand(escapeBraces(str), true).map(unescapeBraces); +} - // Wrap each protocol - var nativeProtocols = {}; - Object.keys(protocols).forEach(function (scheme) { - var protocol = scheme + ":"; - var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; - var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} - // Executes a request, following redirects - function request(input, options, callback) { - // Parse parameters - if (isString(input)) { - var parsed; - try { - parsed = urlToOptions(new URL(input)); - } - catch (err) { - /* istanbul ignore next */ - parsed = url.parse(input); - } - if (!isString(parsed.protocol)) { - throw new InvalidUrlError({ input }); +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); } - input = parsed; - } - else if (URL && (input instanceof URL)) { - input = urlToOptions(input); - } - else { - callback = options; - options = input; - input = { protocol: protocol }; } - if (isFunction(options)) { - callback = options; - options = null; + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; } + var pad = n.some(isPadded); - // Set defaults - options = Object.assign({ - maxRedirects: exports.maxRedirects, - maxBodyLength: exports.maxBodyLength, - }, input, options); - options.nativeProtocols = nativeProtocols; - if (!isString(options.host) && !isString(options.hostname)) { - options.hostname = "::1"; + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); } + } else { + N = []; - assert.equal(options.protocol, protocol, "protocol mismatch"); - debug("options", options); - return new RedirectableRequest(options, callback); + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } } - // Executes a GET request, following redirects - function get(input, options, callback) { - var wrappedRequest = wrappedProtocol.request(input, options, callback); - wrappedRequest.end(); - return wrappedRequest; + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } } + } - // Expose the properties on the wrapped protocol - Object.defineProperties(wrappedProtocol, { - request: { value: request, configurable: true, enumerable: true, writable: true }, - get: { value: get, configurable: true, enumerable: true, writable: true }, - }); - }); - return exports; + return expansions; } -/* istanbul ignore next */ -function noop() { /* empty */ } -// from https://github.com/nodejs/node/blob/master/lib/internal/url.js -function urlToOptions(urlObject) { - var options = { - protocol: urlObject.protocol, - hostname: urlObject.hostname.startsWith("[") ? - /* istanbul ignore next */ - urlObject.hostname.slice(1, -1) : - urlObject.hostname, - hash: urlObject.hash, - search: urlObject.search, - pathname: urlObject.pathname, - path: urlObject.pathname + urlObject.search, - href: urlObject.href, - }; - if (urlObject.port !== "") { - options.port = Number(urlObject.port); + +/***/ }), + +/***/ 3438: +/***/ ((module) => { + +const isWindows = typeof process === 'object' && + process && + process.platform === 'win32' +module.exports = isWindows ? { sep: '\\' } : { sep: '/' } + + +/***/ }), + +/***/ 6453: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const minimatch = module.exports = (p, pattern, options = {}) => { + assertValidPattern(pattern) + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false } - return options; + + return new Minimatch(pattern, options).match(p) } -function removeMatchingHeaders(regex, headers) { - var lastValue; - for (var header in headers) { - if (regex.test(header)) { - lastValue = headers[header]; - delete headers[header]; +module.exports = minimatch + +const path = __nccwpck_require__(3438) +minimatch.sep = path.sep + +const GLOBSTAR = Symbol('globstar **') +minimatch.GLOBSTAR = GLOBSTAR +const expand = __nccwpck_require__(1046) + +const plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +const qmark = '[^/]' + +// * => any number of characters +const star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// "abc" -> { a:true, b:true, c:true } +const charSet = s => s.split('').reduce((set, c) => { + set[c] = true + return set +}, {}) + +// characters that need to be escaped in RegExp. +const reSpecials = charSet('().*{}+?[]^$\\!') + +// characters that indicate we have to add the pattern start +const addPatternStartSet = charSet('[.(') + +// normalizes slashes. +const slashSplit = /\/+/ + +minimatch.filter = (pattern, options = {}) => + (p, i, list) => minimatch(p, pattern, options) + +const ext = (a, b = {}) => { + const t = {} + Object.keys(a).forEach(k => t[k] = a[k]) + Object.keys(b).forEach(k => t[k] = b[k]) + return t +} + +minimatch.defaults = def => { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + const orig = minimatch + + const m = (p, pattern, options) => orig(p, pattern, ext(def, options)) + m.Minimatch = class Minimatch extends orig.Minimatch { + constructor (pattern, options) { + super(pattern, ext(def, options)) } } - return (lastValue === null || typeof lastValue === "undefined") ? - undefined : String(lastValue).trim(); + m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch + m.filter = (pattern, options) => orig.filter(pattern, ext(def, options)) + m.defaults = options => orig.defaults(ext(def, options)) + m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options)) + m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options)) + m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options)) + + return m } -function createErrorType(code, message, baseClass) { - // Create constructor - function CustomError(properties) { - Error.captureStackTrace(this, this.constructor); - Object.assign(this, properties || {}); - this.code = code; - this.message = this.cause ? message + ": " + this.cause.message : message; + + + + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options) + +const braceExpand = (pattern, options = {}) => { + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] } - // Attach constructor and set default properties - CustomError.prototype = new (baseClass || Error)(); - CustomError.prototype.constructor = CustomError; - CustomError.prototype.name = "Error [" + code + "]"; - return CustomError; + return expand(pattern) } -function abortRequest(request) { - for (var event of events) { - request.removeListener(event, eventHandlers[event]); +const MAX_PATTERN_LENGTH = 1024 * 64 +const assertValidPattern = pattern => { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') } - request.on("error", noop); - request.abort(); -} -function isSubdomain(subdomain, domain) { - assert(isString(subdomain) && isString(domain)); - var dot = subdomain.length - domain.length - 1; - return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } } -function isString(value) { - return typeof value === "string" || value instanceof String; +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +const SUBPARSE = Symbol('subparse') + +minimatch.makeRe = (pattern, options) => + new Minimatch(pattern, options || {}).makeRe() + +minimatch.match = (list, pattern, options = {}) => { + const mm = new Minimatch(pattern, options) + list = list.filter(f => mm.match(f)) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list } -function isFunction(value) { - return typeof value === "function"; -} +// replace stuff like \* with * +const globUnescape = s => s.replace(/\\(.)/g, '$1') +const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -function isBuffer(value) { - return typeof value === "object" && ("length" in value); -} +class Minimatch { + constructor (pattern, options) { + assertValidPattern(pattern) -// Exports -module.exports = wrap({ http: http, https: https }); -module.exports.wrap = wrap; + if (!options) options = {} + this.options = options + this.set = [] + this.pattern = pattern + this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || + options.allowWindowsEscape === false + if (this.windowsPathsNoEscape) { + this.pattern = this.pattern.replace(/\\/g, '/') + } + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial -/***/ }), + // make the set of regexps etc. + this.make() + } -/***/ 4334: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + debug () {} -var CombinedStream = __nccwpck_require__(5443); -var util = __nccwpck_require__(3837); -var path = __nccwpck_require__(1017); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var parseUrl = (__nccwpck_require__(7310).parse); -var fs = __nccwpck_require__(7147); -var Stream = (__nccwpck_require__(2781).Stream); -var mime = __nccwpck_require__(3583); -var asynckit = __nccwpck_require__(4812); -var populate = __nccwpck_require__(7142); + make () { + const pattern = this.pattern + const options = this.options -// Public API -module.exports = FormData; + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } -// make it a Stream -util.inherits(FormData, CombinedStream); + // step 1: figure out negation, etc. + this.parseNegate() -/** - * Create readable "multipart/form-data" streams. - * Can be used to submit forms - * and file uploads to other web applications. - * - * @constructor - * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream - */ -function FormData(options) { - if (!(this instanceof FormData)) { - return new FormData(options); - } + // step 2: expand braces + let set = this.globSet = this.braceExpand() - this._overheadLength = 0; - this._valueLength = 0; - this._valuesToMeasure = []; + if (options.debug) this.debug = (...args) => console.error(...args) - CombinedStream.call(this); + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(s => s.split(slashSplit)) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map((s, si, set) => s.map(this.parse, this)) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(s => s.indexOf(false) === -1) + + this.debug(this.pattern, set) + + this.set = set + } + + parseNegate () { + if (this.options.nonegate) return + + const pattern = this.pattern + let negate = false + let negateOffset = 0 + + for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.slice(negateOffset) + this.negate = negate + } + + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + matchOne (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } - options = options || {}; - for (var option in options) { - this[option] = options[option]; - } -} + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] -FormData.LINE_BREAK = '\r\n'; -FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) -FormData.prototype.append = function(field, value, options) { + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } - options = options || {}; + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } - // allow filename as single option - if (typeof options == 'string') { - options = {filename: options}; - } + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } - var append = CombinedStream.prototype.append.bind(this); + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') + } + + braceExpand () { + return braceExpand(this.pattern, this.options) + } + + parse (pattern, isSub) { + assertValidPattern(pattern) + + const options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + let re = '' + let hasMagic = !!options.nocase + let escaping = false + // ? => one single character + const patternListStack = [] + const negativeLists = [] + let stateChar + let inClass = false + let reClassStart = -1 + let classStart = -1 + let cs + let pl + let sp + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + const patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + + const clearStateChar = () => { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + this.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping) { + /* istanbul ignore next - completely not allowed, even escaped. */ + if (c === '/') { + return false + } + + if (reSpecials[c]) { + re += '\\' + } + re += c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } - // all that streamy business can't handle numbers - if (typeof value == 'number') { - value = '' + value; - } + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + this.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } - // https://github.com/felixge/node-form-data/issues/38 - if (util.isArray(value)) { - // Please convert your array into string - // the way web server expects it - this._error(new Error('Arrays are not supported.')); - return; - } + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length) { + re += '\\|' + continue + } + + clearStateChar() + re += '|' + continue - var header = this._multiPartHeader(field, value, options); - var footer = this._multiPartFooter(); + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - append(header); - append(value); - append(footer); + if (inClass) { + re += '\\' + c + continue + } - // pass along options.knownLength - this._trackLength(header, value, options); -}; + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + continue + } -FormData.prototype._trackLength = function(header, value, options) { - var valueLength = 0; + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + sp = this.parse(cs, SUBPARSE) + re = re.substring(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } - // used w/ getLengthSync(), when length is known. - // e.g. for streaming directly from a remote server, - // w/ a known file a size, and not wanting to wait for - // incoming file to finish to get its size. - if (options.knownLength != null) { - valueLength += +options.knownLength; - } else if (Buffer.isBuffer(value)) { - valueLength = value.length; - } else if (typeof value === 'string') { - valueLength = Buffer.byteLength(value); - } + // finish up the class. + hasMagic = true + inClass = false + re += c + continue - this._valueLength += valueLength; + default: + // swallow any state char that wasn't consumed + clearStateChar() - // @check why add CRLF? does this account for custom/multiple CRLFs? - this._overheadLength += - Buffer.byteLength(header) + - FormData.LINE_BREAK.length; + if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\' + } - // empty or either doesn't have path or not an http response or not a stream - if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) { - return; - } + re += c + break + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.slice(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substring(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + let tail + tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => { + /* istanbul ignore else - should already be done */ + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + const t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + const addPatternStart = addPatternStartSet[re.charAt(0)] + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (let n = negativeLists.length - 1; n > -1; n--) { + const nl = negativeLists[n] + + const nlBefore = re.slice(0, nl.reStart) + const nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + let nlAfter = re.slice(nl.reEnd) + const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + const openParensBefore = nlBefore.split('(').length - 1 + let cleanAfter = nlAfter + for (let i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : '' + re = nlBefore + nlFirst + nlAfter + dollar + nlLast + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } - // no need to bother with the length - if (!options.knownLength) { - this._valuesToMeasure.push(value); + const flags = options.nocase ? 'i' : '' + try { + return Object.assign(new RegExp('^' + re + '$', flags), { + _glob: pattern, + _src: re, + }) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } } -}; - -FormData.prototype._lengthRetriever = function(value, callback) { - if (value.hasOwnProperty('fd')) { + makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - // take read range into a account - // `end` = Infinity –> read file till the end + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". // - // TODO: Looks like there is bug in Node fs.createReadStream - // it doesn't respect `end` options without `start` options - // Fix it when node fixes it. - // https://github.com/joyent/node/issues/7819 - if (value.end != undefined && value.end != Infinity && value.start != undefined) { + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + const set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + const options = this.options + + const twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + const flags = options.nocase ? 'i' : '' + + // coalesce globstars and regexpify non-globstar patterns + // if it's the only item, then we just do one twoStar + // if it's the first, and there are more, prepend (\/|twoStar\/)? to next + // if it's the last, append (\/twoStar|) to previous + // if it's in the middle, append (\/|\/twoStar\/) to previous + // then filter out GLOBSTAR symbols + let re = set.map(pattern => { + pattern = pattern.map(p => + typeof p === 'string' ? regExpEscape(p) + : p === GLOBSTAR ? GLOBSTAR + : p._src + ).reduce((set, p) => { + if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) { + set.push(p) + } + return set + }, []) + pattern.forEach((p, i) => { + if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) { + return + } + if (i === 0) { + if (pattern.length > 1) { + pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1] + } else { + pattern[i] = twoStar + } + } else if (i === pattern.length - 1) { + pattern[i-1] += '(?:\\\/|' + twoStar + ')?' + } else { + pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1] + pattern[i+1] = GLOBSTAR + } + }) + return pattern.filter(p => p !== GLOBSTAR).join('/') + }).join('|') - // when end specified - // no need to calculate range - // inclusive, starts with 0 - callback(null, value.end + 1 - (value.start ? value.start : 0)); + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' - // not that fast snoopy - } else { - // still need to fetch file size from fs - fs.stat(value.path, function(err, stat) { + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' - var fileSize; + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp + } - if (err) { - callback(err); - return; - } + match (f, partial = this.partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' - // update final size based on the range options - fileSize = stat.size - (value.start ? value.start : 0); - callback(null, fileSize); - }); + if (f === '/' && partial) return true + + const options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') } - // or http response - } else if (value.hasOwnProperty('httpVersion')) { - callback(null, +value.headers['content-length']); + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - // or request stream http://github.com/mikeal/request - } else if (value.hasOwnProperty('httpModule')) { - // wait till response come back - value.on('response', function(response) { - value.pause(); - callback(null, +response.headers['content-length']); - }); - value.resume(); + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - // something else - } else { - callback('Unknown stream'); + const set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + let filename + for (let i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (let i = 0; i < set.length; i++) { + const pattern = set[i] + let file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + const hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate } -}; -FormData.prototype._multiPartHeader = function(field, value, options) { - // custom header specified (as string)? - // it becomes responsible for boundary - // (e.g. to handle extra CRLFs on .NET servers) - if (typeof options.header == 'string') { - return options.header; + static defaults (def) { + return minimatch.defaults(def).Minimatch } +} - var contentDisposition = this._getContentDisposition(value, options); - var contentType = this._getContentType(value, options); +minimatch.Minimatch = Minimatch - var contents = ''; - var headers = { - // add custom disposition as third element or keep it two elements if not - 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), - // if no content type. allow it to be empty array - 'Content-Type': [].concat(contentType || []) - }; - // allow custom headers. - if (typeof options.header == 'object') { - populate(headers, options.header); - } +/***/ }), - var header; - for (var prop in headers) { - if (!headers.hasOwnProperty(prop)) continue; - header = headers[prop]; +/***/ 9010: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // skip nullish headers. - if (header == null) { - continue; - } +module.exports = globSync +globSync.GlobSync = GlobSync + +var rp = __nccwpck_require__(6863) +var minimatch = __nccwpck_require__(6453) +var Minimatch = minimatch.Minimatch +var Glob = (__nccwpck_require__(1957).Glob) +var util = __nccwpck_require__(3837) +var path = __nccwpck_require__(1017) +var assert = __nccwpck_require__(9491) +var isAbsolute = (__nccwpck_require__(1017).isAbsolute) +var common = __nccwpck_require__(7625) +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} - // convert all headers to arrays. - if (!Array.isArray(header)) { - header = [header]; - } +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') - // add non-empty headers. - if (header.length) { - contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; - } - } + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') - return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; -}; + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) -FormData.prototype._getContentDisposition = function(value, options) { + setopts(this, pattern, options) - var filename - , contentDisposition - ; + if (this.noprocess) + return this - if (typeof options.filepath === 'string') { - // custom filepath for relative paths - filename = path.normalize(options.filepath).replace(/\\/g, '/'); - } else if (options.filename || value.name || value.path) { - // custom filename take precedence - // formidable and the browser add a name property - // fs- and request- streams have path property - filename = path.basename(options.filename || value.name || value.path); - } else if (value.readable && value.hasOwnProperty('httpVersion')) { - // or try http response - filename = path.basename(value.client._httpMessage.path || ''); + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) } + this._finish() +} - if (filename) { - contentDisposition = 'filename="' + filename + '"'; +GlobSync.prototype._finish = function () { + assert.ok(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) } + common.finish(this) +} - return contentDisposition; -}; - -FormData.prototype._getContentType = function(value, options) { - // use custom content-type above all - var contentType = options.contentType; +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync) - // or try `name` from formidable, browser - if (!contentType && value.name) { - contentType = mime.lookup(value.name); + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ } + // now n is the index of the first one that is *not* a string. - // or try `path` from fs-, request- streams - if (!contentType && value.path) { - contentType = mime.lookup(value.path); - } + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return - // or if it's http-reponse - if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { - contentType = value.headers['content-type']; - } + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break - // or guess it from the filepath or filename - if (!contentType && (options.filepath || options.filename)) { - contentType = mime.lookup(options.filepath || options.filename); - } + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} - // fallback to the default content type if `value` is not simple value - if (!contentType && typeof value == 'object') { - contentType = FormData.DEFAULT_CONTENT_TYPE; - } - return contentType; -}; +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) -FormData.prototype._multiPartFooter = function() { - return function(next) { - var footer = FormData.LINE_BREAK; + // if the abs isn't a dir, then nothing can match! + if (!entries) + return - var lastPart = (this._streams.length === 0); - if (lastPart) { - footer += this._lastBoundary(); + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) } + } - next(footer); - }.bind(this); -}; + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return -FormData.prototype._lastBoundary = function() { - return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; -}; + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. -FormData.prototype.getHeaders = function(userHeaders) { - var header; - var formHeaders = { - 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() - }; + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) - for (header in userHeaders) { - if (userHeaders.hasOwnProperty(header)) { - formHeaders[header.toLowerCase()] = userHeaders[header]; + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) } + // This was the last one, and no stats were needed + return } - return formHeaders; -}; + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} -FormData.prototype.setBoundary = function(boundary) { - this._boundary = boundary; -}; -FormData.prototype.getBoundary = function() { - if (!this._boundary) { - this._generateBoundary(); +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs } - return this._boundary; -}; + if (this.matches[index][e]) + return -FormData.prototype.getBuffer = function() { - var dataBuffer = new Buffer.alloc( 0 ); - var boundary = this.getBoundary(); + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } - // Create the form content. Add Line breaks to the end of data. - for (var i = 0, len = this._streams.length; i < len; i++) { - if (typeof this._streams[i] !== 'function') { + this.matches[index][e] = true - // Add content to the buffer. - if(Buffer.isBuffer(this._streams[i])) { - dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); - }else { - dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); - } + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) - // Add break after content. - if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { - dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); - } + var entries + var lstat + var stat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null } } - // Add the footer and return the Buffer object. - return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); -}; + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym -FormData.prototype._generateBoundary = function() { - // This generates a 50 character boundary similar to those used by Firefox. - // They are optimized for boyer-moore parsing. - var boundary = '--------------------------'; - for (var i = 0; i < 24; i++) { - boundary += Math.floor(Math.random() * 10).toString(16); - } + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) - this._boundary = boundary; -}; + return entries +} -// Note: getLengthSync DOESN'T calculate streams length -// As workaround one can calculate file size manually -// and add it as knownLength option -FormData.prototype.getLengthSync = function() { - var knownLength = this._overheadLength + this._valueLength; +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries - // Don't get confused, there are 3 "internal" streams for each keyval pair - // so it basically checks if there is any value added to the form - if (this._streams.length) { - knownLength += this._lastBoundary().length; + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c } - // https://github.com/form-data/form-data/issues/40 - if (!this.hasKnownLength()) { - // Some async length retrievers are present - // therefore synchronous length calculation is false. - // Please use getLength(callback) to get proper length - this._error(new Error('Cannot calculate proper length in synchronous way.')); + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null } +} - return knownLength; -}; +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } -// Public API to check if length of added values is known -// https://github.com/form-data/form-data/issues/196 -// https://github.com/form-data/form-data/issues/262 -FormData.prototype.hasKnownLength = function() { - var hasKnownLength = true; + this.cache[abs] = entries - if (this._valuesToMeasure.length) { - hasKnownLength = false; + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break } +} - return hasKnownLength; -}; +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { -FormData.prototype.getLength = function(cb) { - var knownLength = this._overheadLength + this._valueLength; + var entries = this._readdir(abs, inGlobStar) - if (this._streams.length) { - knownLength += this._lastBoundary().length; - } + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return - if (!this._valuesToMeasure.length) { - process.nextTick(cb.bind(this, null, knownLength)); - return; - } + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) - asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { - if (err) { - cb(err); - return; - } + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) - values.forEach(function(length) { - knownLength += length; - }); + var len = entries.length + var isSym = this.symlinks[abs] - cb(null, knownLength); - }); -}; + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return -FormData.prototype.submit = function(params, cb) { - var request - , options - , defaults = {method: 'post'} - ; + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue - // parse provided url if it's string - // or treat it as options object - if (typeof params == 'string') { + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) - params = parseUrl(params); - options = populate({ - port: params.port, - path: params.pathname, - host: params.hostname, - protocol: params.protocol - }, defaults); + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} - // use custom params - } else { +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) - options = populate(params, defaults); - // if no port provided use default one - if (!options.port) { - options.port = options.protocol == 'https:' ? 443 : 80; + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' } } - // put that good code in getHeaders to some use - options.headers = this.getHeaders(params.headers); + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - // https if specified, fallback to http in any other case - if (options.protocol == 'https:') { - request = https.request(options); - } else { - request = http.request(options); - } + // Mark this as a match + this._emitMatch(index, prefix) +} - // get content length and fire away - this.getLength(function(err, length) { - if (err && err !== 'Unknown stream') { - this._error(err); - return; - } +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - // add content length - if (length) { - request.setHeader('Content-Length', length); - } + if (f.length > this.maxLength) + return false - this.pipe(request); - if (cb) { - var onResponse; + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] - var callback = function (error, responce) { - request.removeListener('error', callback); - request.removeListener('response', onResponse); + if (Array.isArray(c)) + c = 'DIR' - return cb.call(this, error, responce); - }; + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c - onResponse = callback.bind(this, null); + if (needDir && c === 'FILE') + return false - request.on('error', callback); - request.on('response', onResponse); - } - }.bind(this)); + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } - return request; -}; + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } -FormData.prototype._error = function(err) { - if (!this.error) { - this.error = err; - this.pause(); - this.emit('error', err); + if (lstat && lstat.isSymbolicLink()) { + try { + stat = this.fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } } -}; -FormData.prototype.toString = function () { - return '[object FormData]'; -}; + this.statCache[abs] = stat + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' -/***/ }), + this.cache[abs] = this.cache[abs] || c -/***/ 7142: -/***/ ((module) => { + if (needDir && c === 'FILE') + return false -// populates missing values -module.exports = function(dst, src) { + return c +} - Object.keys(src).forEach(function(prop) - { - dst[prop] = dst[prop] || src[prop]; - }); +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} - return dst; -}; +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} /***/ }), @@ -12101,6 +18746,117 @@ module.exports = (flag, argv = process.argv) => { }; +/***/ }), + +/***/ 2492: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var wrappy = __nccwpck_require__(2940) +var reqs = Object.create(null) +var once = __nccwpck_require__(1223) + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} + + +/***/ }), + +/***/ 4124: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +try { + var util = __nccwpck_require__(3837); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __nccwpck_require__(8544); +} + + +/***/ }), + +/***/ 8544: +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + /***/ }), /***/ 250: @@ -29702,6 +36458,55 @@ function plural(ms, msAbs, n, name) { } +/***/ }), + +/***/ 1223: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var wrappy = __nccwpck_require__(2940) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} + + /***/ }), /***/ 9318: @@ -34650,6 +41455,46 @@ function version(uuid) { var _default = version; exports["default"] = _default; +/***/ }), + +/***/ 2940: +/***/ ((module) => { + +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} + + /***/ }), /***/ 4636: @@ -34672,14 +41517,14 @@ const api_client_1 = __nccwpck_require__(586); function waitForTask(client, parameters) { return __awaiter(this, void 0, void 0, function* () { const spaceId = yield (0, api_client_1.resolveSpaceId)(client, parameters.space); - client.info(`🐙 waiting for task [${parameters.serverTaskId}](${parameters.server}/app#/${spaceId}/tasks/${parameters.serverTaskId}) in Octopus Deploy...`); - const waiter = new api_client_1.ExecutionWaiter(client, parameters.space); - const serverTask = yield waiter.waitForExecutionToComplete(parameters.serverTaskId, parameters.pollingInterval * 1000, parameters.timeout * 1000, (serverTaskDetails) => { + client.info(`🐙 waiting for task ${parameters.server}/app#/${spaceId}/tasks/${parameters.serverTaskId} in Octopus Deploy...`); + const waiter = new api_client_1.ServerTaskWaiter(client, parameters.space); + const serverTask = yield waiter.waitForServerTaskToComplete(parameters.serverTaskId, parameters.pollingInterval * 1000, parameters.timeout * 1000, (serverTaskDetails) => { if (parameters.hideProgress !== true) { client.info(`waiting for task ${serverTaskDetails.Task.Id}. Status: ${serverTaskDetails.Task.State}. Progress: ${serverTaskDetails.Progress.ProgressPercentage}%`); } }); - return (serverTask === null || serverTask === void 0 ? void 0 : serverTask.State) === api_client_1.TaskState.Success; + return serverTask === null || serverTask === void 0 ? void 0 : serverTask.State; }); } exports.waitForTask = waitForTask; @@ -34734,20 +41579,28 @@ const api_wrapper_1 = __nccwpck_require__(4636); logging: logger }; const client = yield api_client_1.Client.create(config); - const completedSuccessfully = yield (0, api_wrapper_1.waitForTask)(client, parameters); - (0, core_1.setOutput)('completed_successfully', completedSuccessfully); + const taskState = yield (0, api_wrapper_1.waitForTask)(client, parameters); + (0, core_1.setOutput)('task_state', taskState); const stepSummaryFile = process.env.GITHUB_STEP_SUMMARY; if (stepSummaryFile) { - (0, fs_1.writeFileSync)(stepSummaryFile, `🐙 Octopus Deploy task ${completedSuccessfully ? 'completed successfully' : 'did not complete successfully'}.`); + (0, fs_1.writeFileSync)(stepSummaryFile, `🐙 Octopus Deploy task ${taskState === api_client_1.TaskState.Success ? 'completed successfully' : 'did not complete successfully'}.`); } - if (!completedSuccessfully) { - (0, core_1.setFailed)('🐙 Octopus Deploy task did not complete successfully'); + if (taskState !== api_client_1.TaskState.Success) { + if (taskState) { + (0, core_1.setFailed)(`🐙 Octopus Deploy task did not complete successfully (state: ${taskState})`); + } + else { + (0, core_1.setFailed)('🐙 Could not determine Octopus Deploy task state'); + } } } catch (e) { if (e instanceof Error) { (0, core_1.setFailed)(e); } + else { + (0, core_1.setFailed)(`Unknown error: ${e}`); + } } }))(); @@ -34814,6 +41667,14 @@ function getInputParameters() { exports.getInputParameters = getInputParameters; +/***/ }), + +/***/ 2941: +/***/ ((module) => { + +module.exports = eval("require")("original-fs"); + + /***/ }), /***/ 9491: diff --git a/package-lock.json b/package-lock.json index 6279142f..97d6fbd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.0.0", + "@octopusdeploy/api-client": "^2.1.0", "tmp": "^0.2.1" }, "devDependencies": { @@ -1238,10 +1238,11 @@ } }, "node_modules/@octopusdeploy/api-client": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.0.0.tgz", - "integrity": "sha512-YbX4IIy5Ok3sJMFOJCcgZ2bxtlfVtk/EjGUqDXxrxirf0EckMInP4qBgHt7Tjh8bWJejWEH6jvJXIl1/pZibmQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.0.tgz", + "integrity": "sha512-6qabUJzMPMpkoCxS/j1AmTZS8sRXJk2ep+8d/axslGywxNAkYGLVxCkfAr3n93KvALGWn6oPjUk79wv/46trVw==", "dependencies": { + "adm-zip": "^0.5.9", "axios": "^0.27.2", "form-data": "^4.0.0", "glob": "^8.0.3", @@ -1685,6 +1686,14 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/adm-zip": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", + "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==", + "engines": { + "node": ">=6.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -7060,10 +7069,11 @@ } }, "@octopusdeploy/api-client": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.0.0.tgz", - "integrity": "sha512-YbX4IIy5Ok3sJMFOJCcgZ2bxtlfVtk/EjGUqDXxrxirf0EckMInP4qBgHt7Tjh8bWJejWEH6jvJXIl1/pZibmQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.0.tgz", + "integrity": "sha512-6qabUJzMPMpkoCxS/j1AmTZS8sRXJk2ep+8d/axslGywxNAkYGLVxCkfAr3n93KvALGWn6oPjUk79wv/46trVw==", "requires": { + "adm-zip": "^0.5.9", "axios": "^0.27.2", "form-data": "^4.0.0", "glob": "^8.0.3", @@ -7400,6 +7410,11 @@ "dev": true, "requires": {} }, + "adm-zip": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", + "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==" + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", diff --git a/package.json b/package.json index e5b57be1..215c25f9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.0.0", + "@octopusdeploy/api-client": "^2.1.0", "tmp": "^0.2.1" }, "description": "GitHub Action to Create a Release in Octopus Deploy", diff --git a/src/api-wrapper.ts b/src/api-wrapper.ts index 93ba928c..a2998ac3 100644 --- a/src/api-wrapper.ts +++ b/src/api-wrapper.ts @@ -6,10 +6,10 @@ export interface DeploymentResult { environmentName: string } -export async function waitForTask(client: Client, parameters: InputParameters): Promise { +export async function waitForTask(client: Client, parameters: InputParameters): Promise { const spaceId = await resolveSpaceId(client, parameters.space) client.info( - `🐙 waiting for task [${parameters.serverTaskId}](${parameters.server}/app#/${spaceId}/tasks/${parameters.serverTaskId}) in Octopus Deploy...` + `🐙 waiting for task ${parameters.server}/app#/${spaceId}/tasks/${parameters.serverTaskId} in Octopus Deploy...` ) const waiter = new ServerTaskWaiter(client, parameters.space) @@ -26,5 +26,5 @@ export async function waitForTask(client: Client, parameters: InputParameters): } ) - return serverTask?.State === TaskState.Success + return serverTask?.State } diff --git a/src/index.ts b/src/index.ts index 92057b06..5ea94f4a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { getInputParameters } from './input-parameters' import { debug, info, warning, error, setFailed, setOutput, isDebug } from '@actions/core' import { writeFileSync } from 'fs' -import { Client, ClientConfiguration, Logger } from '@octopusdeploy/api-client' +import { Client, ClientConfiguration, Logger, TaskState } from '@octopusdeploy/api-client' import { waitForTask } from './api-wrapper' // GitHub actions entrypoint @@ -35,20 +35,26 @@ import { waitForTask } from './api-wrapper' const client = await Client.create(config) - const completedSuccessfully = await waitForTask(client, parameters) + const taskState = await waitForTask(client, parameters) - setOutput('completed_successfully', completedSuccessfully) + setOutput('task_state', taskState) const stepSummaryFile = process.env.GITHUB_STEP_SUMMARY if (stepSummaryFile) { writeFileSync( stepSummaryFile, - `🐙 Octopus Deploy task ${completedSuccessfully ? 'completed successfully' : 'did not complete successfully'}.` + `🐙 Octopus Deploy task ${ + taskState === TaskState.Success ? 'completed successfully' : 'did not complete successfully' + }.` ) } - if (!completedSuccessfully) { - setFailed('🐙 Octopus Deploy task did not complete successfully') + if (taskState !== TaskState.Success) { + if (taskState) { + setFailed(`🐙 Octopus Deploy task did not complete successfully (state: ${taskState})`) + } else { + setFailed('🐙 Could not determine Octopus Deploy task state') + } } } catch (e: unknown) { if (e instanceof Error) {