diff --git a/.github/workflows/__rubocop-multi-language.yml b/.github/workflows/__rubocop-multi-language.yml index 5c42c71bb..b7f476057 100644 --- a/.github/workflows/__rubocop-multi-language.yml +++ b/.github/workflows/__rubocop-multi-language.yml @@ -56,7 +56,7 @@ jobs: use-all-platform-bundle: 'false' setup-kotlin: 'true' - name: Set up Ruby - uses: ruby/setup-ruby@90be1154f987f4dc0fe0dd0feedac9e473aa4ba8 # v1.286.0 + uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0 with: ruby-version: 2.6 - name: Install Code Scanning integration diff --git a/CHANGELOG.md b/CHANGELOG.md index cd3ad7c17..dbe851921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs. +## 3.32.3 - 13 Feb 2026 + +- Added experimental support for testing connections to [private package registries](https://docs.github.com/en/code-security/how-tos/secure-at-scale/configure-organization-security/manage-usage-and-access/giving-org-access-private-registries). This feature is not currently enabled for any analysis. In the future, it may be enabled by default for Default Setup. [#3466](https://github.com/github/codeql-action/pull/3466) + ## 3.32.2 - 05 Feb 2026 - Update default CodeQL bundle version to [2.24.1](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.24.1). [#3460](https://github.com/github/codeql-action/pull/3460) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index c2ee15261..49b48ad65 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -160928,6 +160929,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -161695,6 +161702,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/analyze-action.js b/lib/analyze-action.js index d53219543..c806e362b 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -106638,6 +106639,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -107763,6 +107770,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -108000,7 +108012,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 3d0185d5a..3fb8640b7 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -103129,6 +103130,10 @@ function getWorkflowRunAttempt() { function isSelfHostedRunner() { return process.env.RUNNER_ENVIRONMENT === "self-hosted"; } +var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer"; +function isCCR() { + return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false; +} function prettyPrintInvocation(cmd, args) { return [cmd, ...args].map((x) => x.includes(" ") ? `'${x}'` : x).join(" "); } @@ -103299,6 +103304,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -104096,6 +104107,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -104333,7 +104349,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 73abdedd0..ec0e2e051 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -164144,6 +164145,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -165089,6 +165096,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -165326,7 +165338,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/lib/init-action.js b/lib/init-action.js index 4d99b3055..c6a508c76 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -103985,6 +103986,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -105296,6 +105303,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -105533,7 +105545,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 4821c49ec..735f81bdb 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -103307,6 +103308,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -104087,6 +104094,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 2416ab825..30b761731 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -103246,6 +103247,10 @@ function isSelfHostedRunner() { function isDynamicWorkflow() { return getWorkflowEventName() === "dynamic"; } +var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer"; +function isCCR() { + return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false; +} function prettyPrintInvocation(cmd, args) { return [cmd, ...args].map((x) => x.includes(" ") ? `'${x}'` : x).join(" "); } @@ -103416,6 +103421,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -103997,6 +104008,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -104234,7 +104250,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index 1424bbf5e..3d2907390 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -160811,6 +160812,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -161101,6 +161108,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 39d60274f..740778f70 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -204,7 +204,7 @@ var require_file_command = __commonJS({ exports2.issueFileCommand = issueFileCommand; exports2.prepareKeyValueMessage = prepareKeyValueMessage; var crypto2 = __importStar2(require("crypto")); - var fs = __importStar2(require("fs")); + var fs2 = __importStar2(require("fs")); var os2 = __importStar2(require("os")); var utils_1 = require_utils(); function issueFileCommand(command, message) { @@ -212,10 +212,10 @@ var require_file_command = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs.existsSync(filePath)) { + if (!fs2.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os2.EOL}`, { + fs2.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os2.EOL}`, { encoding: "utf8" }); } @@ -321,7 +321,7 @@ var require_tunnel = __commonJS({ var net = require("net"); var tls = require("tls"); var http = require("http"); - var https = require("https"); + var https2 = require("https"); var events = require("events"); var assert = require("assert"); var util = require("util"); @@ -343,12 +343,12 @@ var require_tunnel = __commonJS({ } function httpOverHttps(options) { var agent = new TunnelingAgent(options); - agent.request = https.request; + agent.request = https2.request; return agent; } function httpsOverHttps(options) { var agent = new TunnelingAgent(options); - agent.request = https.request; + agent.request = https2.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; @@ -1337,14 +1337,14 @@ var require_util = __commonJS({ } const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80; let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`; - let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; + let path4 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; if (origin[origin.length - 1] === "/") { origin = origin.slice(0, origin.length - 1); } - if (path3 && path3[0] !== "/") { - path3 = `/${path3}`; + if (path4 && path4[0] !== "/") { + path4 = `/${path4}`; } - return new URL(`${origin}${path3}`); + return new URL(`${origin}${path4}`); } if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) { throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`."); @@ -1646,10 +1646,10 @@ var require_util = __commonJS({ } obj[kListeners] = null; } - function errorRequest2(client, request2, err) { + function errorRequest2(client, request3, err) { try { - request2.onError(err); - assert(request2.aborted); + request3.onError(err); + assert(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -1795,39 +1795,39 @@ var require_diagnostics = __commonJS({ }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("sending request to %s %s/%s", method, origin, path3); + debuglog("sending request to %s %s/%s", method, origin, path4); }); diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => { const { - request: { method, path: path3, origin }, + request: { method, path: path4, origin }, response: { statusCode } } = evt; debuglog( "received response to %s %s/%s - HTTP %d", method, origin, - path3, + path4, statusCode ); }); diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("trailers received from %s %s/%s", method, origin, path3); + debuglog("trailers received from %s %s/%s", method, origin, path4); }); diagnosticsChannel.channel("undici:request:error").subscribe((evt) => { const { - request: { method, path: path3, origin }, + request: { method, path: path4, origin }, error: error3 } = evt; debuglog( "request to %s %s/%s errored - %s", method, origin, - path3, + path4, error3.message ); }); @@ -1876,9 +1876,9 @@ var require_diagnostics = __commonJS({ }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("sending request to %s %s/%s", method, origin, path3); + debuglog("sending request to %s %s/%s", method, origin, path4); }); } diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => { @@ -1941,7 +1941,7 @@ var require_request = __commonJS({ var kHandler = /* @__PURE__ */ Symbol("handler"); var Request = class { constructor(origin, { - path: path3, + path: path4, method, body, headers, @@ -1956,11 +1956,11 @@ var require_request = __commonJS({ expectContinue, servername }, handler2) { - if (typeof path3 !== "string") { + if (typeof path4 !== "string") { throw new InvalidArgumentError("path must be a string"); - } else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") { + } else if (path4[0] !== "/" && !(path4.startsWith("http://") || path4.startsWith("https://")) && method !== "CONNECT") { throw new InvalidArgumentError("path must be an absolute URL or start with a slash"); - } else if (invalidPathRegex.test(path3)) { + } else if (invalidPathRegex.test(path4)) { throw new InvalidArgumentError("invalid request path"); } if (typeof method !== "string") { @@ -2023,7 +2023,7 @@ var require_request = __commonJS({ this.completed = false; this.aborted = false; this.upgrade = upgrade || null; - this.path = query ? buildURL(path3, query) : path3; + this.path = query ? buildURL(path4, query) : path4; this.origin = origin; this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent; this.blocking = blocking == null ? false : blocking; @@ -2164,7 +2164,7 @@ var require_request = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request3, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -2203,19 +2203,19 @@ var require_request = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request3.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && headerName === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request3.contentType === null && headerName === "content-type") { + request3.contentType = val; + request3.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -2224,12 +2224,12 @@ var require_request = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request3.headers.push(key, val); } } module2.exports = Request; @@ -4303,11 +4303,11 @@ var require_util2 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -4331,7 +4331,7 @@ var require_util2 = __commonJS({ function isValidHeaderValue(potentialValue) { return (potentialValue[0] === " " || potentialValue[0] === " " || potentialValue[potentialValue.length - 1] === " " || potentialValue[potentialValue.length - 1] === " " || potentialValue.includes("\n") || potentialValue.includes("\r") || potentialValue.includes("\0")) === false; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy", true) ?? "").split(","); let policy = ""; @@ -4345,7 +4345,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -4362,33 +4362,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request3.responseTainting === "cors" || request3.mode === "websocket") { + request3.headersList.append("origin", serializedOrigin, true); + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request3.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp2, crossOriginIsolatedCapability) { @@ -4442,26 +4442,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request3.referrer instanceof URL) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request3, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request3.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -4472,7 +4472,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4633,7 +4633,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -6163,11 +6163,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } - request2.onResponseStarted(); + request3.onResponseStarted(); } onHeaderField(buf) { const len = this.headers.length; @@ -6212,9 +6212,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); + assert(request3.upgrade || request3.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -6231,7 +6231,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -6242,8 +6242,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert(!this.upgrade); @@ -6252,23 +6252,23 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD. - request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -6299,11 +6299,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -6320,8 +6320,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -6334,7 +6334,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -6348,8 +6348,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); this.statusCode = null; this.statusText = ""; this.bytesRead = 0; @@ -6361,11 +6361,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -6452,13 +6452,13 @@ var require_client_h1 = __commonJS({ assert(client2[kPending] === 0); const requests = client2[kQueue].splice(client2[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client2, request2, err); + const request3 = requests[i]; + util.errorRequest(client2, request3, err); } } else if (client2[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client2[kQueue][client2[kRunningIdx]]; + const request3 = client2[kQueue][client2[kRunningIdx]]; client2[kQueue][client2[kRunningIdx]++] = null; - util.errorRequest(client2, request2, err); + util.errorRequest(client2, request3, err); } client2[kPendingIdx] = client2[kRunningIdx]; assert(client2[kRunning] === 0); @@ -6488,18 +6488,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request3) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request3) { + if (client[kRunning] > 0 && !request3.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body) || util.isFormDataLike(request3.body))) { return true; } } @@ -6525,8 +6525,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request3 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -6535,21 +6535,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path: path3, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request3) { + const { method, path: path4, host, upgrade, blocking, reset } = request3; + let { body, headers, contentLength } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request3.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request3.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -6558,33 +6558,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -6602,7 +6602,7 @@ var require_client_h1 = __commonJS({ if (blocking) { socket[kBlocking] = true; } - let header = `${method} ${path3} HTTP/1.1\r + let header = `${method} ${path4} HTTP/1.1\r `; if (typeof host === "string") { header += `host: ${host}\r @@ -6635,31 +6635,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request3, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -6725,7 +6725,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -6745,18 +6745,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(body); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -6769,9 +6769,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(buffer); + request3.onRequestSent(); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -6779,7 +6779,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -6798,7 +6798,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -6816,9 +6816,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -6828,7 +6828,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -6847,7 +6847,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -6867,7 +6867,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -6878,8 +6878,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -7019,8 +7019,8 @@ var require_client_h2 = __commonJS({ assert(client2[kPending] === 0); const requests = client2[kQueue].splice(client2[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client2, request2, err); + const request3 = requests[i]; + util.errorRequest(client2, request3, err); } } }); @@ -7114,9 +7114,9 @@ var require_client_h2 = __commonJS({ } util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -7126,12 +7126,12 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { + function writeH2(client, request3) { const session = client[kHTTP2Session]; - const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; + let { body } = request3; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -7155,11 +7155,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); if (stream != null) { util.destroy(stream, err); } @@ -7168,23 +7168,23 @@ var require_client_h2 = __commonJS({ client[kResume](); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -7195,7 +7195,7 @@ var require_client_h2 = __commonJS({ }); return true; } - headers[HTTP2_HEADER_PATH] = path3; + headers[HTTP2_HEADER_PATH] = path4; headers[HTTP2_HEADER_SCHEME] = "https"; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { @@ -7210,14 +7210,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -7242,25 +7242,25 @@ var require_client_h2 = __commonJS({ ++session[kOpenStreams]; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request3.onResponseStarted(); + if (request3.aborted) { const err = new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); util.destroy(stream, err); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); }); stream.once("end", () => { if (stream.state?.state == null || stream.state.state < 6) { - request2.onComplete([]); + request3.onComplete([]); } if (session[kOpenStreams] === 0) { session.unref(); @@ -7290,7 +7290,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -7301,7 +7301,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -7313,7 +7313,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -7324,7 +7324,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -7338,7 +7338,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, contentLength ); } else if (util.isIterable(body)) { @@ -7347,7 +7347,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -7357,7 +7357,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -7365,18 +7365,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request3.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (error3) { abort(error3); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request3, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -7387,7 +7387,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -7397,10 +7397,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -7411,8 +7411,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -7421,7 +7421,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -7446,13 +7446,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -7548,9 +7548,9 @@ var require_redirect_handler = __commonJS({ return this.handler.onHeaders(statusCode, headers, resume, statusText); } const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))); - const path3 = search ? `${pathname}${search}` : pathname; + const path4 = search ? `${pathname}${search}` : pathname; this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin); - this.opts.path = path3; + this.opts.path = path4; this.opts.origin = origin; this.opts.maxRedirections = 0; this.opts.query = null; @@ -7898,10 +7898,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request3 = new Request(origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -7925,8 +7925,8 @@ var require_client = __commonJS({ return new Promise((resolve2) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request3 = requests[i]; + util.errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7951,8 +7951,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } assert(client[kSize] === 0); } @@ -8055,8 +8055,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request3, err); } } else { onError(client, err); @@ -8113,12 +8113,12 @@ var require_client = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request3.servername; client[kHTTPContext]?.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -8134,10 +8134,10 @@ var require_client = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request3)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request3.aborted && client[kHTTPContext].write(request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -8784,10 +8784,10 @@ var require_proxy_agent = __commonJS({ }; const { origin, - path: path3 = "/", + path: path4 = "/", headers = {} } = opts; - opts.path = origin + path3; + opts.path = origin + path4; if (!("host" in headers) && !("Host" in headers)) { const { host } = new URL2(origin); headers.host = host; @@ -9933,10 +9933,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve2, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve2(data); }); }); @@ -9951,7 +9951,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module2.exports = request2; + module2.exports = request3; module2.exports.RequestHandler = RequestHandler; } }); @@ -10708,20 +10708,20 @@ var require_mock_utils = __commonJS({ } return true; } - function safeUrl(path3) { - if (typeof path3 !== "string") { - return path3; + function safeUrl(path4) { + if (typeof path4 !== "string") { + return path4; } - const pathSegments = path3.split("?"); + const pathSegments = path4.split("?"); if (pathSegments.length !== 2) { - return path3; + return path4; } const qp = new URLSearchParams(pathSegments.pop()); qp.sort(); return [...pathSegments, qp.toString()].join("?"); } - function matchKey(mockDispatch2, { path: path3, method, body, headers }) { - const pathMatch = matchValue(mockDispatch2.path, path3); + function matchKey(mockDispatch2, { path: path4, method, body, headers }) { + const pathMatch = matchValue(mockDispatch2.path, path4); const methodMatch = matchValue(mockDispatch2.method, method); const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true; const headersMatch = matchHeaders(mockDispatch2, headers); @@ -10743,7 +10743,7 @@ var require_mock_utils = __commonJS({ function getMockDispatch(mockDispatches, key) { const basePath = key.query ? buildURL(key.path, key.query) : key.path; const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath; - let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3 }) => matchValue(safeUrl(path3), resolvedPath)); + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath)); if (matchedMockDispatches.length === 0) { throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); } @@ -10781,9 +10781,9 @@ var require_mock_utils = __commonJS({ } } function buildKey(opts) { - const { path: path3, method, body, headers, query } = opts; + const { path: path4, method, body, headers, query } = opts; return { - path: path3, + path: path4, method, body, headers, @@ -11246,10 +11246,10 @@ var require_pending_interceptors_formatter = __commonJS({ } format(pendingInterceptors) { const withPrettyHeaders = pendingInterceptors.map( - ({ method, path: path3, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + ({ method, path: path4, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ Method: method, Origin: origin, - Path: path3, + Path: path4, "Status code": statusCode, Persistent: persist ? PERSISTENT : NOT_PERSISTENT, Invocations: timesInvoked, @@ -12858,7 +12858,7 @@ var require_request2 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -12875,18 +12875,18 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { this[kDispatcher] = init.dispatcher || input[kDispatcher]; assert(input instanceof _Request); - request2 = input[kState]; + request3 = input[kState]; signal = input[kSignal]; } const origin = environmentSettingsObject.settingsObject.origin; let window2 = "client"; - if (request2.window?.constructor?.name === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window2 = request2.window; + if (request3.window?.constructor?.name === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window2 = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window2}' must be null`); @@ -12894,66 +12894,66 @@ var require_request2 = __commonJS({ if ("window" in init) { window2 = "no-window"; } - request2 = makeRequest({ + request3 = makeRequest({ // URL request’s URL. // undici implementation note: this is set as the first item in request's urlList in makeRequest // method request’s method. - method: request2.method, + method: request3.method, // header list A copy of request’s header list. // undici implementation note: headersList is cloned in makeRequest - headersList: request2.headersList, + headersList: request3.headersList, // unsafe-request flag Set. - unsafeRequest: request2.unsafeRequest, + unsafeRequest: request3.unsafeRequest, // client This’s relevant settings object. client: environmentSettingsObject.settingsObject, // window window. window: window2, // priority request’s priority. - priority: request2.priority, + priority: request3.priority, // origin request’s origin. The propagation of the origin is only significant for navigation requests // being handled by a service worker. In this scenario a request can have an origin that is different // from the current client. - origin: request2.origin, + origin: request3.origin, // referrer request’s referrer. - referrer: request2.referrer, + referrer: request3.referrer, // referrer policy request’s referrer policy. - referrerPolicy: request2.referrerPolicy, + referrerPolicy: request3.referrerPolicy, // mode request’s mode. - mode: request2.mode, + mode: request3.mode, // credentials mode request’s credentials mode. - credentials: request2.credentials, + credentials: request3.credentials, // cache mode request’s cache mode. - cache: request2.cache, + cache: request3.cache, // redirect mode request’s redirect mode. - redirect: request2.redirect, + redirect: request3.redirect, // integrity metadata request’s integrity metadata. - integrity: request2.integrity, + integrity: request3.integrity, // keepalive request’s keepalive. - keepalive: request2.keepalive, + keepalive: request3.keepalive, // reload-navigation flag request’s reload-navigation flag. - reloadNavigation: request2.reloadNavigation, + reloadNavigation: request3.reloadNavigation, // history-navigation flag request’s history-navigation flag. - historyNavigation: request2.historyNavigation, + historyNavigation: request3.historyNavigation, // URL list A clone of request’s URL list. - urlList: [...request2.urlList] + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12962,14 +12962,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12984,33 +12984,33 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request3.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -13020,9 +13020,9 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request3.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request3.method === "patch") { process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.", { code: "UNDICI-FETCH-patch" }); @@ -13032,7 +13032,7 @@ var require_request2 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request3; const ac = new AbortController(); this[kSignal] = ac.signal; if (signal != null) { @@ -13060,12 +13060,12 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - setHeadersList(this[kHeaders], request2.headersList); + setHeadersList(this[kHeaders], request3.headersList); setHeadersGuard(this[kHeaders], "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this[kHeaders], "request-no-cors"); @@ -13084,14 +13084,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof _Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this[kHeaders]).contains("content-type", true)) { @@ -13103,12 +13103,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -13337,21 +13337,21 @@ var require_request2 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(newRequest, request3.body); } return newRequest; } function fromInnerRequest(innerRequest, signal, guard) { - const request2 = new Request(kConstruct); - request2[kState] = innerRequest; - request2[kSignal] = signal; - request2[kHeaders] = new Headers(kConstruct); - setHeadersList(request2[kHeaders], innerRequest.headersList); - setHeadersGuard(request2[kHeaders], guard); - return request2; + const request3 = new Request(kConstruct); + request3[kState] = innerRequest; + request3[kSignal] = signal; + request3[kHeaders] = new Headers(kConstruct); + setHeadersList(request3[kHeaders], innerRequest.headersList); + setHeadersGuard(request3[kHeaders], guard); + return request3; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -13593,14 +13593,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request3 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (globalObject?.constructor?.name === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -13612,7 +13612,7 @@ var require_fetch = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject?.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request3, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -13620,7 +13620,7 @@ var require_fetch = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -13632,7 +13632,7 @@ var require_fetch = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: requestObject[kDispatcher] @@ -13673,12 +13673,12 @@ var require_fetch = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error3) { + function abortFetch(p, request3, responseObject, error3) { if (p) { p.reject(error3); } - if (request2.body != null && isReadable(request2.body?.stream)) { - request2.body.stream.cancel(error3).catch((err) => { + if (request3.body != null && isReadable(request3.body?.stream)) { + request3.body.stream.cancel(error3).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13699,7 +13699,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13712,9 +13712,9 @@ var require_fetch = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13722,7 +13722,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13732,32 +13732,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = request2.client?.globalObject?.constructor?.name === "Window" ? request2.client : "no-window"; + assert(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = request3.client?.globalObject?.constructor?.name === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request3.origin === "client") { + request3.origin = request3.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request3.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request3.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request3.headersList.contains("accept-language", true)) { + request3.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13765,50 +13765,50 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if ( // - request’s current URL’s origin is same origin with request’s origin, // and request’s response tainting is "basic" - sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || // request’s current URL’s scheme is "data" + sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || // request’s current URL’s scheme is "data" currentURL.protocol === "data:" || // - request’s mode is "navigate" or "websocket" - (request2.mode === "navigate" || request2.mode === "websocket") + (request3.mode === "navigate" || request3.mode === "websocket") ) { - request2.responseTainting = "basic"; + request3.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request3.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13816,13 +13816,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13830,26 +13830,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13865,8 +13865,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13875,19 +13875,19 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blob)) { + if (request3.method !== "GET" || !isBlobLike(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type2 = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request3.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -13895,7 +13895,7 @@ var require_fetch = __commonJS({ response.headersList.set("content-type", type2, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request3.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13926,7 +13926,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -14015,41 +14015,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -14059,13 +14059,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -14076,63 +14076,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization", true); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie", true); + request3.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -14209,7 +14209,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -14221,7 +14221,7 @@ var require_fetch = __commonJS({ // response’s status is 421 response.status === 421 && // isNewConnectionFetch is false !isNewConnectionFetch && // request’s body is null, or request’s body is non-null and request’s body’s source is non-null - (request2.body == null || request2.body.source != null) + (request3.body == null || request3.body.source != null) ) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); @@ -14251,21 +14251,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { if (isCancelled(fetchParams)) { return; @@ -14293,7 +14293,7 @@ var require_fetch = __commonJS({ }; requestBody = (async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -14403,17 +14403,17 @@ var require_fetch = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve2, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: agent.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -14444,8 +14444,8 @@ var require_fetch = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request3.redirect === "follow" && redirectStatusSet.has(status); + if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { const contentEncoding = headersList.get("content-encoding", true); const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : []; const maxContentEncodings = 5; @@ -15428,31 +15428,31 @@ var require_cache = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request3, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request3, options); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, _Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -15462,19 +15462,19 @@ var require_cache = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request3 of requests) { + if (request3 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request3 = webidl.converters.RequestInfo(request3); + if (typeof request3 === "string") { continue; } - const r = request2[kState]; + const r = request3[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -15483,8 +15483,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request3 of requests) { + const r = new Request(request3)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -15561,17 +15561,17 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, _Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request3 instanceof Request) { + innerRequest = request3[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request3)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -15642,21 +15642,21 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request3 === "string"); + r = new Request(request3)[kState]; } const operations = []; const operation = { @@ -15688,25 +15688,25 @@ var require_cache = __commonJS({ * @param {import('../../types/cache').CacheQueryOptions} options * @returns {Promise} */ - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -15718,9 +15718,9 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = fromInnerRequest( - request3, + request4, new AbortController().signal, "immutable" ); @@ -15838,9 +15838,9 @@ var require_cache = __commonJS({ * @param {import('../../types/cache').CacheQueryOptions | undefined} options * @returns {boolean} */ - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options?.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15856,7 +15856,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15864,20 +15864,20 @@ var require_cache = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request3, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -15966,21 +15966,21 @@ var require_cachestorage = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, _CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -16130,9 +16130,9 @@ var require_util6 = __commonJS({ } } } - function validateCookiePath(path3) { - for (let i = 0; i < path3.length; ++i) { - const code = path3.charCodeAt(i); + function validateCookiePath(path4) { + for (let i = 0; i < path4.length; ++i) { + const code = path4.charCodeAt(i); if (code < 32 || // exclude CTLs (0-31) code === 127 || // DEL code === 59) { @@ -17122,7 +17122,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -17134,18 +17134,18 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto2.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request3.headersList.append("sec-websocket-key", keyValue); + request3.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request3.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate); + request3.headersList.append("sec-websocket-extensions", permessageDeflate); const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -17182,7 +17182,7 @@ var require_connection = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request3.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; @@ -18726,11 +18726,11 @@ var require_undici = __commonJS({ if (typeof opts.path !== "string") { throw new InvalidArgumentError("invalid opts.path"); } - let path3 = opts.path; + let path4 = opts.path; if (!opts.path.startsWith("/")) { - path3 = `/${path3}`; + path4 = `/${path4}`; } - url = new URL(util.parseOrigin(url).origin + path3); + url = new URL(util.parseOrigin(url).origin + path4); } else { if (!opts) { opts = typeof url === "object" ? url : {}; @@ -18874,7 +18874,7 @@ var require_lib = __commonJS({ exports2.getProxyUrl = getProxyUrl; exports2.isHttps = isHttps; var http = __importStar2(require("http")); - var https = __importStar2(require("https")); + var https2 = __importStar2(require("https")); var pm = __importStar2(require_proxy()); var tunnel = __importStar2(require_tunnel2()); var undici_1 = require_undici(); @@ -19263,7 +19263,7 @@ var require_lib = __commonJS({ const info6 = {}; info6.parsedUrl = requestUrl; const usingSsl = info6.parsedUrl.protocol === "https:"; - info6.httpModule = usingSsl ? https : http; + info6.httpModule = usingSsl ? https2 : http; const defaultPort = usingSsl ? 443 : 80; info6.options = {}; info6.options.host = info6.parsedUrl.hostname; @@ -19386,7 +19386,7 @@ var require_lib = __commonJS({ } if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; - agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + agent = usingSsl ? new https2.Agent(options) : new http.Agent(options); this._agent = agent; } if (usingSsl && this._ignoreSslError) { @@ -20033,7 +20033,7 @@ var require_path_utils = __commonJS({ exports2.toPosixPath = toPosixPath; exports2.toWin32Path = toWin32Path; exports2.toPlatformPath = toPlatformPath; - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); function toPosixPath(pth) { return pth.replace(/[\\]/g, "/"); } @@ -20041,7 +20041,7 @@ var require_path_utils = __commonJS({ return pth.replace(/[/]/g, "\\"); } function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path3.sep); + return pth.replace(/[/\\]/g, path4.sep); } } }); @@ -20123,13 +20123,13 @@ var require_io_util = __commonJS({ exports2.isRooted = isRooted; exports2.tryGetExecutablePath = tryGetExecutablePath; exports2.getCmdPath = getCmdPath; - var fs = __importStar2(require("fs")); - var path3 = __importStar2(require("path")); - _a = fs.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; + var fs2 = __importStar2(require("fs")); + var path4 = __importStar2(require("path")); + _a = fs2.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; exports2.IS_WINDOWS = process.platform === "win32"; function readlink(fsPath) { return __awaiter2(this, void 0, void 0, function* () { - const result = yield fs.promises.readlink(fsPath); + const result = yield fs2.promises.readlink(fsPath); if (exports2.IS_WINDOWS && !result.endsWith("\\")) { return `${result}\\`; } @@ -20137,7 +20137,7 @@ var require_io_util = __commonJS({ }); } exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs.constants.O_RDONLY; + exports2.READONLY = fs2.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -20179,7 +20179,7 @@ var require_io_util = __commonJS({ } if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { - const upperExt = path3.extname(filePath).toUpperCase(); + const upperExt = path4.extname(filePath).toUpperCase(); if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { return filePath; } @@ -20203,11 +20203,11 @@ var require_io_util = __commonJS({ if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { try { - const directory = path3.dirname(filePath); - const upperName = path3.basename(filePath).toUpperCase(); + const directory = path4.dirname(filePath); + const upperName = path4.basename(filePath).toUpperCase(); for (const actualName of yield (0, exports2.readdir)(directory)) { if (upperName === actualName.toUpperCase()) { - filePath = path3.join(directory, actualName); + filePath = path4.join(directory, actualName); break; } } @@ -20319,7 +20319,7 @@ var require_io = __commonJS({ exports2.which = which4; exports2.findInPath = findInPath; var assert_1 = require("assert"); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var ioUtil = __importStar2(require_io_util()); function cp(source_1, dest_1) { return __awaiter2(this, arguments, void 0, function* (source, dest, options = {}) { @@ -20328,7 +20328,7 @@ var require_io = __commonJS({ if (destStat && destStat.isFile() && !force) { return; } - const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path3.join(dest, path3.basename(source)) : dest; + const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path4.join(dest, path4.basename(source)) : dest; if (!(yield ioUtil.exists(source))) { throw new Error(`no such file or directory: ${source}`); } @@ -20340,7 +20340,7 @@ var require_io = __commonJS({ yield cpDirRecursive(source, newDest, 0, force); } } else { - if (path3.relative(source, newDest) === "") { + if (path4.relative(source, newDest) === "") { throw new Error(`'${newDest}' and '${source}' are the same file`); } yield copyFile2(source, newDest, force); @@ -20352,7 +20352,7 @@ var require_io = __commonJS({ if (yield ioUtil.exists(dest)) { let destExists = true; if (yield ioUtil.isDirectory(dest)) { - dest = path3.join(dest, path3.basename(source)); + dest = path4.join(dest, path4.basename(source)); destExists = yield ioUtil.exists(dest); } if (destExists) { @@ -20363,7 +20363,7 @@ var require_io = __commonJS({ } } } - yield mkdirP(path3.dirname(dest)); + yield mkdirP(path4.dirname(dest)); yield ioUtil.rename(source, dest); }); } @@ -20422,7 +20422,7 @@ var require_io = __commonJS({ } const extensions = []; if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { - for (const extension of process.env["PATHEXT"].split(path3.delimiter)) { + for (const extension of process.env["PATHEXT"].split(path4.delimiter)) { if (extension) { extensions.push(extension); } @@ -20435,12 +20435,12 @@ var require_io = __commonJS({ } return []; } - if (tool.includes(path3.sep)) { + if (tool.includes(path4.sep)) { return []; } const directories = []; if (process.env.PATH) { - for (const p of process.env.PATH.split(path3.delimiter)) { + for (const p of process.env.PATH.split(path4.delimiter)) { if (p) { directories.push(p); } @@ -20448,7 +20448,7 @@ var require_io = __commonJS({ } const matches = []; for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(path3.join(directory, tool), extensions); + const filePath = yield ioUtil.tryGetExecutablePath(path4.join(directory, tool), extensions); if (filePath) { matches.push(filePath); } @@ -20578,7 +20578,7 @@ var require_toolrunner = __commonJS({ var os2 = __importStar2(require("os")); var events = __importStar2(require("events")); var child = __importStar2(require("child_process")); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var io4 = __importStar2(require_io()); var ioUtil = __importStar2(require_io_util()); var timers_1 = require("timers"); @@ -20793,7 +20793,7 @@ var require_toolrunner = __commonJS({ exec() { return __awaiter2(this, void 0, void 0, function* () { if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { - this.toolPath = path3.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + this.toolPath = path4.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); } this.toolPath = yield io4.which(this.toolPath, true); return new Promise((resolve2, reject) => __awaiter2(this, void 0, void 0, function* () { @@ -21346,7 +21346,7 @@ var require_core = __commonJS({ var file_command_1 = require_file_command(); var utils_1 = require_utils(); var os2 = __importStar2(require("os")); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var oidc_utils_1 = require_oidc_utils(); var ExitCode; (function(ExitCode2) { @@ -21372,7 +21372,7 @@ var require_core = __commonJS({ } else { (0, command_1.issueCommand)("add-path", {}, inputPath); } - process.env["PATH"] = `${inputPath}${path3.delimiter}${process.env["PATH"]}`; + process.env["PATH"] = `${inputPath}${path4.delimiter}${process.env["PATH"]}`; } function getInput2(name, options) { const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || ""; @@ -39293,8 +39293,8 @@ var require_context = __commonJS({ if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) { this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: "utf8" })); } else { - const path3 = process.env.GITHUB_EVENT_PATH; - process.stdout.write(`GITHUB_EVENT_PATH ${path3} does not exist${os_1.EOL}`); + const path4 = process.env.GITHUB_EVENT_PATH; + process.stdout.write(`GITHUB_EVENT_PATH ${path4} does not exist${os_1.EOL}`); } } this.eventName = process.env.GITHUB_EVENT_NAME; @@ -40119,14 +40119,14 @@ var require_util10 = __commonJS({ } const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80; let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`; - let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; + let path4 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; if (origin[origin.length - 1] === "/") { origin = origin.slice(0, origin.length - 1); } - if (path3 && path3[0] !== "/") { - path3 = `/${path3}`; + if (path4 && path4[0] !== "/") { + path4 = `/${path4}`; } - return new URL(`${origin}${path3}`); + return new URL(`${origin}${path4}`); } if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) { throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`."); @@ -40428,10 +40428,10 @@ var require_util10 = __commonJS({ } obj[kListeners] = null; } - function errorRequest2(client, request2, err) { + function errorRequest2(client, request3, err) { try { - request2.onError(err); - assert(request2.aborted); + request3.onError(err); + assert(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -40577,39 +40577,39 @@ var require_diagnostics2 = __commonJS({ }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("sending request to %s %s/%s", method, origin, path3); + debuglog("sending request to %s %s/%s", method, origin, path4); }); diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => { const { - request: { method, path: path3, origin }, + request: { method, path: path4, origin }, response: { statusCode } } = evt; debuglog( "received response to %s %s/%s - HTTP %d", method, origin, - path3, + path4, statusCode ); }); diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("trailers received from %s %s/%s", method, origin, path3); + debuglog("trailers received from %s %s/%s", method, origin, path4); }); diagnosticsChannel.channel("undici:request:error").subscribe((evt) => { const { - request: { method, path: path3, origin }, + request: { method, path: path4, origin }, error: error3 } = evt; debuglog( "request to %s %s/%s errored - %s", method, origin, - path3, + path4, error3.message ); }); @@ -40658,9 +40658,9 @@ var require_diagnostics2 = __commonJS({ }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { const { - request: { method, path: path3, origin } + request: { method, path: path4, origin } } = evt; - debuglog("sending request to %s %s/%s", method, origin, path3); + debuglog("sending request to %s %s/%s", method, origin, path4); }); } diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => { @@ -40723,7 +40723,7 @@ var require_request3 = __commonJS({ var kHandler = /* @__PURE__ */ Symbol("handler"); var Request = class { constructor(origin, { - path: path3, + path: path4, method, body, headers, @@ -40738,11 +40738,11 @@ var require_request3 = __commonJS({ expectContinue, servername }, handler2) { - if (typeof path3 !== "string") { + if (typeof path4 !== "string") { throw new InvalidArgumentError("path must be a string"); - } else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") { + } else if (path4[0] !== "/" && !(path4.startsWith("http://") || path4.startsWith("https://")) && method !== "CONNECT") { throw new InvalidArgumentError("path must be an absolute URL or start with a slash"); - } else if (invalidPathRegex.test(path3)) { + } else if (invalidPathRegex.test(path4)) { throw new InvalidArgumentError("invalid request path"); } if (typeof method !== "string") { @@ -40805,7 +40805,7 @@ var require_request3 = __commonJS({ this.completed = false; this.aborted = false; this.upgrade = upgrade || null; - this.path = query ? buildURL(path3, query) : path3; + this.path = query ? buildURL(path4, query) : path4; this.origin = origin; this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent; this.blocking = blocking == null ? false : blocking; @@ -40946,7 +40946,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request3, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -40985,19 +40985,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request3.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && headerName === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request3.contentType === null && headerName === "content-type") { + request3.contentType = val; + request3.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -41006,12 +41006,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request3.headers.push(key, val); } } module2.exports = Request; @@ -43085,11 +43085,11 @@ var require_util11 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -43113,7 +43113,7 @@ var require_util11 = __commonJS({ function isValidHeaderValue(potentialValue) { return (potentialValue[0] === " " || potentialValue[0] === " " || potentialValue[potentialValue.length - 1] === " " || potentialValue[potentialValue.length - 1] === " " || potentialValue.includes("\n") || potentialValue.includes("\r") || potentialValue.includes("\0")) === false; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy", true) ?? "").split(","); let policy = ""; @@ -43127,7 +43127,7 @@ var require_util11 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -43144,33 +43144,33 @@ var require_util11 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request3.responseTainting === "cors" || request3.mode === "websocket") { + request3.headersList.append("origin", serializedOrigin, true); + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request3.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp2, crossOriginIsolatedCapability) { @@ -43224,26 +43224,26 @@ var require_util11 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request3.referrer instanceof URL) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request3, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request3.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -43254,7 +43254,7 @@ var require_util11 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -43415,7 +43415,7 @@ var require_util11 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -44945,11 +44945,11 @@ var require_client_h12 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } - request2.onResponseStarted(); + request3.onResponseStarted(); } onHeaderField(buf) { const len = this.headers.length; @@ -44994,9 +44994,9 @@ var require_client_h12 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); + assert(request3.upgrade || request3.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -45013,7 +45013,7 @@ var require_client_h12 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -45024,8 +45024,8 @@ var require_client_h12 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert(!this.upgrade); @@ -45034,23 +45034,23 @@ var require_client_h12 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD. - request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -45081,11 +45081,11 @@ var require_client_h12 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -45102,8 +45102,8 @@ var require_client_h12 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -45116,7 +45116,7 @@ var require_client_h12 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -45130,8 +45130,8 @@ var require_client_h12 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); this.statusCode = null; this.statusText = ""; this.bytesRead = 0; @@ -45143,11 +45143,11 @@ var require_client_h12 = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -45234,13 +45234,13 @@ var require_client_h12 = __commonJS({ assert(client2[kPending] === 0); const requests = client2[kQueue].splice(client2[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client2, request2, err); + const request3 = requests[i]; + util.errorRequest(client2, request3, err); } } else if (client2[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client2[kQueue][client2[kRunningIdx]]; + const request3 = client2[kQueue][client2[kRunningIdx]]; client2[kQueue][client2[kRunningIdx]++] = null; - util.errorRequest(client2, request2, err); + util.errorRequest(client2, request3, err); } client2[kPendingIdx] = client2[kRunningIdx]; assert(client2[kRunning] === 0); @@ -45270,18 +45270,18 @@ var require_client_h12 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request3) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request3) { + if (client[kRunning] > 0 && !request3.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body) || util.isFormDataLike(request3.body))) { return true; } } @@ -45307,8 +45307,8 @@ var require_client_h12 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request3 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -45317,21 +45317,21 @@ var require_client_h12 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path: path3, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request3) { + const { method, path: path4, host, upgrade, blocking, reset } = request3; + let { body, headers, contentLength } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request3.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request3.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -45340,33 +45340,33 @@ var require_client_h12 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -45384,7 +45384,7 @@ var require_client_h12 = __commonJS({ if (blocking) { socket[kBlocking] = true; } - let header = `${method} ${path3} HTTP/1.1\r + let header = `${method} ${path4} HTTP/1.1\r `; if (typeof host === "string") { header += `host: ${host}\r @@ -45417,31 +45417,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request3, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -45507,7 +45507,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -45527,18 +45527,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(body); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -45551,9 +45551,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(buffer); + request3.onRequestSent(); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -45561,7 +45561,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -45580,7 +45580,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -45598,9 +45598,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -45610,7 +45610,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -45629,7 +45629,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -45649,7 +45649,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -45660,8 +45660,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -45801,8 +45801,8 @@ var require_client_h22 = __commonJS({ assert(client2[kPending] === 0); const requests = client2[kQueue].splice(client2[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client2, request2, err); + const request3 = requests[i]; + util.errorRequest(client2, request3, err); } } }); @@ -45896,9 +45896,9 @@ var require_client_h22 = __commonJS({ } util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -45908,12 +45908,12 @@ var require_client_h22 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { + function writeH2(client, request3) { const session = client[kHTTP2Session]; - const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; + let { body } = request3; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -45937,11 +45937,11 @@ var require_client_h22 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); if (stream != null) { util.destroy(stream, err); } @@ -45950,23 +45950,23 @@ var require_client_h22 = __commonJS({ client[kResume](); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -45977,7 +45977,7 @@ var require_client_h22 = __commonJS({ }); return true; } - headers[HTTP2_HEADER_PATH] = path3; + headers[HTTP2_HEADER_PATH] = path4; headers[HTTP2_HEADER_SCHEME] = "https"; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { @@ -45992,14 +45992,14 @@ var require_client_h22 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -46024,25 +46024,25 @@ var require_client_h22 = __commonJS({ ++session[kOpenStreams]; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request3.onResponseStarted(); + if (request3.aborted) { const err = new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); util.destroy(stream, err); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); }); stream.once("end", () => { if (stream.state?.state == null || stream.state.state < 6) { - request2.onComplete([]); + request3.onComplete([]); } if (session[kOpenStreams] === 0) { session.unref(); @@ -46072,7 +46072,7 @@ var require_client_h22 = __commonJS({ stream, null, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -46083,7 +46083,7 @@ var require_client_h22 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -46095,7 +46095,7 @@ var require_client_h22 = __commonJS({ stream, body.stream(), client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -46106,7 +46106,7 @@ var require_client_h22 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -46120,7 +46120,7 @@ var require_client_h22 = __commonJS({ stream, body, client, - request2, + request3, contentLength ); } else if (util.isIterable(body)) { @@ -46129,7 +46129,7 @@ var require_client_h22 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -46139,7 +46139,7 @@ var require_client_h22 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -46147,18 +46147,18 @@ var require_client_h22 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request3.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (error3) { abort(error3); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request3, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -46169,7 +46169,7 @@ var require_client_h22 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -46179,10 +46179,10 @@ var require_client_h22 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -46193,8 +46193,8 @@ var require_client_h22 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -46203,7 +46203,7 @@ var require_client_h22 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -46228,13 +46228,13 @@ var require_client_h22 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -46330,9 +46330,9 @@ var require_redirect_handler2 = __commonJS({ return this.handler.onHeaders(statusCode, headers, resume, statusText); } const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))); - const path3 = search ? `${pathname}${search}` : pathname; + const path4 = search ? `${pathname}${search}` : pathname; this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin); - this.opts.path = path3; + this.opts.path = path4; this.opts.origin = origin; this.opts.maxRedirections = 0; this.opts.query = null; @@ -46680,10 +46680,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request3 = new Request(origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -46707,8 +46707,8 @@ var require_client2 = __commonJS({ return new Promise((resolve2) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request3 = requests[i]; + util.errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -46733,8 +46733,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } assert(client[kSize] === 0); } @@ -46837,8 +46837,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request3, err); } } else { onError(client, err); @@ -46895,12 +46895,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request3.servername; client[kHTTPContext]?.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -46916,10 +46916,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request3)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request3.aborted && client[kHTTPContext].write(request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -47566,10 +47566,10 @@ var require_proxy_agent2 = __commonJS({ }; const { origin, - path: path3 = "/", + path: path4 = "/", headers = {} } = opts; - opts.path = origin + path3; + opts.path = origin + path4; if (!("host" in headers) && !("Host" in headers)) { const { host } = new URL2(origin); headers.host = host; @@ -48715,10 +48715,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve2, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve2(data); }); }); @@ -48733,7 +48733,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module2.exports = request2; + module2.exports = request3; module2.exports.RequestHandler = RequestHandler; } }); @@ -49490,20 +49490,20 @@ var require_mock_utils2 = __commonJS({ } return true; } - function safeUrl(path3) { - if (typeof path3 !== "string") { - return path3; + function safeUrl(path4) { + if (typeof path4 !== "string") { + return path4; } - const pathSegments = path3.split("?"); + const pathSegments = path4.split("?"); if (pathSegments.length !== 2) { - return path3; + return path4; } const qp = new URLSearchParams(pathSegments.pop()); qp.sort(); return [...pathSegments, qp.toString()].join("?"); } - function matchKey(mockDispatch2, { path: path3, method, body, headers }) { - const pathMatch = matchValue(mockDispatch2.path, path3); + function matchKey(mockDispatch2, { path: path4, method, body, headers }) { + const pathMatch = matchValue(mockDispatch2.path, path4); const methodMatch = matchValue(mockDispatch2.method, method); const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true; const headersMatch = matchHeaders(mockDispatch2, headers); @@ -49525,7 +49525,7 @@ var require_mock_utils2 = __commonJS({ function getMockDispatch(mockDispatches, key) { const basePath = key.query ? buildURL(key.path, key.query) : key.path; const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath; - let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3 }) => matchValue(safeUrl(path3), resolvedPath)); + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath)); if (matchedMockDispatches.length === 0) { throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); } @@ -49563,9 +49563,9 @@ var require_mock_utils2 = __commonJS({ } } function buildKey(opts) { - const { path: path3, method, body, headers, query } = opts; + const { path: path4, method, body, headers, query } = opts; return { - path: path3, + path: path4, method, body, headers, @@ -50028,10 +50028,10 @@ var require_pending_interceptors_formatter2 = __commonJS({ } format(pendingInterceptors) { const withPrettyHeaders = pendingInterceptors.map( - ({ method, path: path3, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + ({ method, path: path4, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ Method: method, Origin: origin, - Path: path3, + Path: path4, "Status code": statusCode, Persistent: persist ? PERSISTENT : NOT_PERSISTENT, Invocations: timesInvoked, @@ -51640,7 +51640,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -51657,18 +51657,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { this[kDispatcher] = init.dispatcher || input[kDispatcher]; assert(input instanceof _Request); - request2 = input[kState]; + request3 = input[kState]; signal = input[kSignal]; } const origin = environmentSettingsObject.settingsObject.origin; let window2 = "client"; - if (request2.window?.constructor?.name === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window2 = request2.window; + if (request3.window?.constructor?.name === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window2 = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window2}' must be null`); @@ -51676,66 +51676,66 @@ var require_request4 = __commonJS({ if ("window" in init) { window2 = "no-window"; } - request2 = makeRequest({ + request3 = makeRequest({ // URL request’s URL. // undici implementation note: this is set as the first item in request's urlList in makeRequest // method request’s method. - method: request2.method, + method: request3.method, // header list A copy of request’s header list. // undici implementation note: headersList is cloned in makeRequest - headersList: request2.headersList, + headersList: request3.headersList, // unsafe-request flag Set. - unsafeRequest: request2.unsafeRequest, + unsafeRequest: request3.unsafeRequest, // client This’s relevant settings object. client: environmentSettingsObject.settingsObject, // window window. window: window2, // priority request’s priority. - priority: request2.priority, + priority: request3.priority, // origin request’s origin. The propagation of the origin is only significant for navigation requests // being handled by a service worker. In this scenario a request can have an origin that is different // from the current client. - origin: request2.origin, + origin: request3.origin, // referrer request’s referrer. - referrer: request2.referrer, + referrer: request3.referrer, // referrer policy request’s referrer policy. - referrerPolicy: request2.referrerPolicy, + referrerPolicy: request3.referrerPolicy, // mode request’s mode. - mode: request2.mode, + mode: request3.mode, // credentials mode request’s credentials mode. - credentials: request2.credentials, + credentials: request3.credentials, // cache mode request’s cache mode. - cache: request2.cache, + cache: request3.cache, // redirect mode request’s redirect mode. - redirect: request2.redirect, + redirect: request3.redirect, // integrity metadata request’s integrity metadata. - integrity: request2.integrity, + integrity: request3.integrity, // keepalive request’s keepalive. - keepalive: request2.keepalive, + keepalive: request3.keepalive, // reload-navigation flag request’s reload-navigation flag. - reloadNavigation: request2.reloadNavigation, + reloadNavigation: request3.reloadNavigation, // history-navigation flag request’s history-navigation flag. - historyNavigation: request2.historyNavigation, + historyNavigation: request3.historyNavigation, // URL list A clone of request’s URL list. - urlList: [...request2.urlList] + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -51744,14 +51744,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -51766,33 +51766,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request3.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -51802,9 +51802,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request3.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request3.method === "patch") { process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.", { code: "UNDICI-FETCH-patch" }); @@ -51814,7 +51814,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request3; const ac = new AbortController(); this[kSignal] = ac.signal; if (signal != null) { @@ -51842,12 +51842,12 @@ var require_request4 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - setHeadersList(this[kHeaders], request2.headersList); + setHeadersList(this[kHeaders], request3.headersList); setHeadersGuard(this[kHeaders], "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this[kHeaders], "request-no-cors"); @@ -51866,14 +51866,14 @@ var require_request4 = __commonJS({ } } const inputBody = input instanceof _Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this[kHeaders]).contains("content-type", true)) { @@ -51885,12 +51885,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -52119,21 +52119,21 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(newRequest, request3.body); } return newRequest; } function fromInnerRequest(innerRequest, signal, guard) { - const request2 = new Request(kConstruct); - request2[kState] = innerRequest; - request2[kSignal] = signal; - request2[kHeaders] = new Headers(kConstruct); - setHeadersList(request2[kHeaders], innerRequest.headersList); - setHeadersGuard(request2[kHeaders], guard); - return request2; + const request3 = new Request(kConstruct); + request3[kState] = innerRequest; + request3[kSignal] = signal; + request3[kHeaders] = new Headers(kConstruct); + setHeadersList(request3[kHeaders], innerRequest.headersList); + setHeadersGuard(request3[kHeaders], guard); + return request3; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -52375,14 +52375,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request3 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (globalObject?.constructor?.name === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -52394,7 +52394,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject?.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request3, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -52402,7 +52402,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -52414,7 +52414,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: requestObject[kDispatcher] @@ -52455,12 +52455,12 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error3) { + function abortFetch(p, request3, responseObject, error3) { if (p) { p.reject(error3); } - if (request2.body != null && isReadable(request2.body?.stream)) { - request2.body.stream.cancel(error3).catch((err) => { + if (request3.body != null && isReadable(request3.body?.stream)) { + request3.body.stream.cancel(error3).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -52481,7 +52481,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -52494,9 +52494,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -52504,7 +52504,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -52514,32 +52514,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = request2.client?.globalObject?.constructor?.name === "Window" ? request2.client : "no-window"; + assert(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = request3.client?.globalObject?.constructor?.name === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request3.origin === "client") { + request3.origin = request3.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request3.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request3.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request3.headersList.contains("accept-language", true)) { + request3.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -52547,50 +52547,50 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if ( // - request’s current URL’s origin is same origin with request’s origin, // and request’s response tainting is "basic" - sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || // request’s current URL’s scheme is "data" + sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || // request’s current URL’s scheme is "data" currentURL.protocol === "data:" || // - request’s mode is "navigate" or "websocket" - (request2.mode === "navigate" || request2.mode === "websocket") + (request3.mode === "navigate" || request3.mode === "websocket") ) { - request2.responseTainting = "basic"; + request3.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request3.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -52598,13 +52598,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -52612,26 +52612,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -52647,8 +52647,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -52657,19 +52657,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blob)) { + if (request3.method !== "GET" || !isBlobLike(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type2 = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request3.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -52677,7 +52677,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type2, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request3.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -52708,7 +52708,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -52797,41 +52797,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -52841,13 +52841,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -52858,63 +52858,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization", true); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie", true); + request3.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -52991,7 +52991,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -53003,7 +53003,7 @@ var require_fetch2 = __commonJS({ // response’s status is 421 response.status === 421 && // isNewConnectionFetch is false !isNewConnectionFetch && // request’s body is null, or request’s body is non-null and request’s body’s source is non-null - (request2.body == null || request2.body.source != null) + (request3.body == null || request3.body.source != null) ) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); @@ -53033,21 +53033,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { if (isCancelled(fetchParams)) { return; @@ -53075,7 +53075,7 @@ var require_fetch2 = __commonJS({ }; requestBody = (async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -53185,17 +53185,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve2, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: agent.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -53226,8 +53226,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request3.redirect === "follow" && redirectStatusSet.has(status); + if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { const contentEncoding = headersList.get("content-encoding", true); const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : []; const maxContentEncodings = 5; @@ -54210,31 +54210,31 @@ var require_cache2 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request3, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request3, options); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, _Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -54244,19 +54244,19 @@ var require_cache2 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request3 of requests) { + if (request3 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request3 = webidl.converters.RequestInfo(request3); + if (typeof request3 === "string") { continue; } - const r = request2[kState]; + const r = request3[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -54265,8 +54265,8 @@ var require_cache2 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request3 of requests) { + const r = new Request(request3)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -54343,17 +54343,17 @@ var require_cache2 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, _Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request3 instanceof Request) { + innerRequest = request3[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request3)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -54424,21 +54424,21 @@ var require_cache2 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request3 === "string"); + r = new Request(request3)[kState]; } const operations = []; const operation = { @@ -54470,25 +54470,25 @@ var require_cache2 = __commonJS({ * @param {import('../../types/cache').CacheQueryOptions} options * @returns {Promise} */ - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, _Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -54500,9 +54500,9 @@ var require_cache2 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = fromInnerRequest( - request3, + request4, new AbortController().signal, "immutable" ); @@ -54620,9 +54620,9 @@ var require_cache2 = __commonJS({ * @param {import('../../types/cache').CacheQueryOptions | undefined} options * @returns {boolean} */ - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options?.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -54638,7 +54638,7 @@ var require_cache2 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -54646,20 +54646,20 @@ var require_cache2 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request3, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -54748,21 +54748,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, _CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -54912,9 +54912,9 @@ var require_util15 = __commonJS({ } } } - function validateCookiePath(path3) { - for (let i = 0; i < path3.length; ++i) { - const code = path3.charCodeAt(i); + function validateCookiePath(path4) { + for (let i = 0; i < path4.length; ++i) { + const code = path4.charCodeAt(i); if (code < 32 || // exclude CTLs (0-31) code === 127 || // DEL code === 59) { @@ -55904,7 +55904,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -55916,18 +55916,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto2.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request3.headersList.append("sec-websocket-key", keyValue); + request3.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request3.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate); + request3.headersList.append("sec-websocket-extensions", permessageDeflate); const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -55964,7 +55964,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request3.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; @@ -57508,11 +57508,11 @@ var require_undici2 = __commonJS({ if (typeof opts.path !== "string") { throw new InvalidArgumentError("invalid opts.path"); } - let path3 = opts.path; + let path4 = opts.path; if (!opts.path.startsWith("/")) { - path3 = `/${path3}`; + path4 = `/${path4}`; } - url = new URL(util.parseOrigin(url).origin + path3); + url = new URL(util.parseOrigin(url).origin + path4); } else { if (!opts) { opts = typeof url === "object" ? url : {}; @@ -58471,16 +58471,16 @@ function withDefaults2(oldEndpoint, newDefaults) { if (!endpointOptions.request || !endpointOptions.request.hook) { return fetchWrapper(endpoint2.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( endpoint2.parse(endpoint2.merge(route2, parameters2)) ); }; - Object.assign(request2, { + Object.assign(request22, { endpoint: endpoint2, defaults: withDefaults2.bind(null, endpoint2) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { endpoint: endpoint2, @@ -58525,7 +58525,7 @@ function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -58555,11 +58555,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -58574,8 +58574,8 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults3(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; @@ -58597,9 +58597,9 @@ var init_dist_bundle3 = __esm({ init_universal_user_agent4(); VERSION3 = "0.0.0-development"; GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -58652,13 +58652,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request3, route, parameters) { + const endpoint2 = request3.endpoint.merge( route, parameters ); endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + return request3(endpoint2); } var b64url, sep, jwtRE, isJWT, createTokenAuth; var init_dist_bundle4 = __esm({ @@ -63770,7 +63770,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -63810,6 +63810,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -63819,7 +63820,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -63840,7 +63841,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -63873,828 +63874,6 @@ var require_package = __commonJS({ } }); -// node_modules/@actions/tool-cache/lib/manifest.js -var require_manifest = __commonJS({ - "node_modules/@actions/tool-cache/lib/manifest.js"(exports2, module2) { - "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) 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 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { - var ownKeys2 = function(o) { - ownKeys2 = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys2(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); - } - __setModuleDefault2(result, mod); - return result; - }; - })(); - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); - }); - } - return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._findMatch = _findMatch; - exports2._getOsVersion = _getOsVersion; - exports2._readLinuxVersionFile = _readLinuxVersionFile; - var semver6 = __importStar2(require_semver2()); - var core_1 = require_core(); - var os2 = require("os"); - var cp = require("child_process"); - var fs = require("fs"); - function _findMatch(versionSpec, stable, candidates, archFilter) { - return __awaiter2(this, void 0, void 0, function* () { - const platFilter = os2.platform(); - let result; - let match; - let file; - for (const candidate of candidates) { - const version = candidate.version; - (0, core_1.debug)(`check ${version} satisfies ${versionSpec}`); - if (semver6.satisfies(version, versionSpec) && (!stable || candidate.stable === stable)) { - file = candidate.files.find((item) => { - (0, core_1.debug)(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); - let chk = item.arch === archFilter && item.platform === platFilter; - if (chk && item.platform_version) { - const osVersion = module2.exports._getOsVersion(); - if (osVersion === item.platform_version) { - chk = true; - } else { - chk = semver6.satisfies(osVersion, item.platform_version); - } - } - return chk; - }); - if (file) { - (0, core_1.debug)(`matched ${candidate.version}`); - match = candidate; - break; - } - } - } - if (match && file) { - result = Object.assign({}, match); - result.files = [file]; - } - return result; - }); - } - function _getOsVersion() { - const plat = os2.platform(); - let version = ""; - if (plat === "darwin") { - version = cp.execSync("sw_vers -productVersion").toString(); - } else if (plat === "linux") { - const lsbContents = module2.exports._readLinuxVersionFile(); - if (lsbContents) { - const lines = lsbContents.split("\n"); - for (const line of lines) { - const parts = line.split("="); - if (parts.length === 2 && (parts[0].trim() === "VERSION_ID" || parts[0].trim() === "DISTRIB_RELEASE")) { - version = parts[1].trim().replace(/^"/, "").replace(/"$/, ""); - break; - } - } - } - } - return version; - } - function _readLinuxVersionFile() { - const lsbReleaseFile = "/etc/lsb-release"; - const osReleaseFile = "/etc/os-release"; - let contents = ""; - if (fs.existsSync(lsbReleaseFile)) { - contents = fs.readFileSync(lsbReleaseFile).toString(); - } else if (fs.existsSync(osReleaseFile)) { - contents = fs.readFileSync(osReleaseFile).toString(); - } - return contents; - } - } -}); - -// node_modules/@actions/tool-cache/lib/retry-helper.js -var require_retry_helper = __commonJS({ - "node_modules/@actions/tool-cache/lib/retry-helper.js"(exports2) { - "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) 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 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { - var ownKeys2 = function(o) { - ownKeys2 = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys2(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); - } - __setModuleDefault2(result, mod); - return result; - }; - })(); - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); - }); - } - return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RetryHelper = void 0; - var core12 = __importStar2(require_core()); - var RetryHelper = class { - constructor(maxAttempts, minSeconds, maxSeconds) { - if (maxAttempts < 1) { - throw new Error("max attempts should be greater than or equal to 1"); - } - this.maxAttempts = maxAttempts; - this.minSeconds = Math.floor(minSeconds); - this.maxSeconds = Math.floor(maxSeconds); - if (this.minSeconds > this.maxSeconds) { - throw new Error("min seconds should be less than or equal to max seconds"); - } - } - execute(action, isRetryable) { - return __awaiter2(this, void 0, void 0, function* () { - let attempt = 1; - while (attempt < this.maxAttempts) { - try { - return yield action(); - } catch (err) { - if (isRetryable && !isRetryable(err)) { - throw err; - } - core12.info(err.message); - } - const seconds = this.getSleepAmount(); - core12.info(`Waiting ${seconds} seconds before trying again`); - yield this.sleep(seconds); - attempt++; - } - return yield action(); - }); - } - getSleepAmount() { - return Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) + this.minSeconds; - } - sleep(seconds) { - return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve2) => setTimeout(resolve2, seconds * 1e3)); - }); - } - }; - exports2.RetryHelper = RetryHelper; - } -}); - -// node_modules/@actions/tool-cache/lib/tool-cache.js -var require_tool_cache = __commonJS({ - "node_modules/@actions/tool-cache/lib/tool-cache.js"(exports2) { - "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) 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 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { - var ownKeys2 = function(o) { - ownKeys2 = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys2(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); - } - __setModuleDefault2(result, mod); - return result; - }; - })(); - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); - }); - } - return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HTTPError = void 0; - exports2.downloadTool = downloadTool2; - exports2.extract7z = extract7z; - exports2.extractTar = extractTar2; - exports2.extractXar = extractXar; - exports2.extractZip = extractZip; - exports2.cacheDir = cacheDir2; - exports2.cacheFile = cacheFile; - exports2.find = find2; - exports2.findAllVersions = findAllVersions; - exports2.getManifestFromRepo = getManifestFromRepo; - exports2.findFromManifest = findFromManifest; - exports2.isExplicitVersion = isExplicitVersion; - exports2.evaluateVersions = evaluateVersions; - var core12 = __importStar2(require_core()); - var io4 = __importStar2(require_io()); - var crypto2 = __importStar2(require("crypto")); - var fs = __importStar2(require("fs")); - var mm = __importStar2(require_manifest()); - var os2 = __importStar2(require("os")); - var path3 = __importStar2(require("path")); - var httpm = __importStar2(require_lib()); - var semver6 = __importStar2(require_semver2()); - var stream = __importStar2(require("stream")); - var util = __importStar2(require("util")); - var assert_1 = require("assert"); - var exec_1 = require_exec(); - var retry_helper_1 = require_retry_helper(); - var HTTPError2 = class extends Error { - constructor(httpStatusCode) { - super(`Unexpected HTTP response: ${httpStatusCode}`); - this.httpStatusCode = httpStatusCode; - Object.setPrototypeOf(this, new.target.prototype); - } - }; - exports2.HTTPError = HTTPError2; - var IS_WINDOWS = process.platform === "win32"; - var IS_MAC = process.platform === "darwin"; - var userAgent2 = "actions/tool-cache"; - function downloadTool2(url, dest, auth2, headers) { - return __awaiter2(this, void 0, void 0, function* () { - dest = dest || path3.join(_getTempDirectory(), crypto2.randomUUID()); - yield io4.mkdirP(path3.dirname(dest)); - core12.debug(`Downloading ${url}`); - core12.debug(`Destination ${dest}`); - const maxAttempts = 3; - const minSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS", 10); - const maxSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS", 20); - const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds); - return yield retryHelper.execute(() => __awaiter2(this, void 0, void 0, function* () { - return yield downloadToolAttempt(url, dest || "", auth2, headers); - }), (err) => { - if (err instanceof HTTPError2 && err.httpStatusCode) { - if (err.httpStatusCode < 500 && err.httpStatusCode !== 408 && err.httpStatusCode !== 429) { - return false; - } - } - return true; - }); - }); - } - function downloadToolAttempt(url, dest, auth2, headers) { - return __awaiter2(this, void 0, void 0, function* () { - if (fs.existsSync(dest)) { - throw new Error(`Destination file path ${dest} already exists`); - } - const http = new httpm.HttpClient(userAgent2, [], { - allowRetries: false - }); - if (auth2) { - core12.debug("set auth"); - if (headers === void 0) { - headers = {}; - } - headers.authorization = auth2; - } - const response = yield http.get(url, headers); - if (response.message.statusCode !== 200) { - const err = new HTTPError2(response.message.statusCode); - core12.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); - throw err; - } - const pipeline = util.promisify(stream.pipeline); - const responseMessageFactory = _getGlobal("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY", () => response.message); - const readStream = responseMessageFactory(); - let succeeded = false; - try { - yield pipeline(readStream, fs.createWriteStream(dest)); - core12.debug("download complete"); - succeeded = true; - return dest; - } finally { - if (!succeeded) { - core12.debug("download failed"); - try { - yield io4.rmRF(dest); - } catch (err) { - core12.debug(`Failed to delete '${dest}'. ${err.message}`); - } - } - } - }); - } - function extract7z(file, dest, _7zPath) { - return __awaiter2(this, void 0, void 0, function* () { - (0, assert_1.ok)(IS_WINDOWS, "extract7z() not supported on current OS"); - (0, assert_1.ok)(file, 'parameter "file" is required'); - dest = yield _createExtractFolder(dest); - const originalCwd = process.cwd(); - process.chdir(dest); - if (_7zPath) { - try { - const logLevel = core12.isDebug() ? "-bb1" : "-bb0"; - const args = [ - "x", - // eXtract files with full paths - logLevel, - // -bb[0-3] : set output log level - "-bd", - // disable progress indicator - "-sccUTF-8", - // set charset for for console input/output - file - ]; - const options = { - silent: true - }; - yield (0, exec_1.exec)(`"${_7zPath}"`, args, options); - } finally { - process.chdir(originalCwd); - } - } else { - const escapedScript = path3.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, ""); - const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); - const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); - const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; - const args = [ - "-NoLogo", - "-Sta", - "-NoProfile", - "-NonInteractive", - "-ExecutionPolicy", - "Unrestricted", - "-Command", - command - ]; - const options = { - silent: true - }; - try { - const powershellPath = yield io4.which("powershell", true); - yield (0, exec_1.exec)(`"${powershellPath}"`, args, options); - } finally { - process.chdir(originalCwd); - } - } - return dest; - }); - } - function extractTar2(file_1, dest_1) { - return __awaiter2(this, arguments, void 0, function* (file, dest, flags = "xz") { - if (!file) { - throw new Error("parameter 'file' is required"); - } - dest = yield _createExtractFolder(dest); - core12.debug("Checking tar --version"); - let versionOutput = ""; - yield (0, exec_1.exec)("tar --version", [], { - ignoreReturnCode: true, - silent: true, - listeners: { - stdout: (data) => versionOutput += data.toString(), - stderr: (data) => versionOutput += data.toString() - } - }); - core12.debug(versionOutput.trim()); - const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR"); - let args; - if (flags instanceof Array) { - args = flags; - } else { - args = [flags]; - } - if (core12.isDebug() && !flags.includes("v")) { - args.push("-v"); - } - let destArg = dest; - let fileArg = file; - if (IS_WINDOWS && isGnuTar) { - args.push("--force-local"); - destArg = dest.replace(/\\/g, "/"); - fileArg = file.replace(/\\/g, "/"); - } - if (isGnuTar) { - args.push("--warning=no-unknown-keyword"); - args.push("--overwrite"); - } - args.push("-C", destArg, "-f", fileArg); - yield (0, exec_1.exec)(`tar`, args); - return dest; - }); - } - function extractXar(file_1, dest_1) { - return __awaiter2(this, arguments, void 0, function* (file, dest, flags = []) { - (0, assert_1.ok)(IS_MAC, "extractXar() not supported on current OS"); - (0, assert_1.ok)(file, 'parameter "file" is required'); - dest = yield _createExtractFolder(dest); - let args; - if (flags instanceof Array) { - args = flags; - } else { - args = [flags]; - } - args.push("-x", "-C", dest, "-f", file); - if (core12.isDebug()) { - args.push("-v"); - } - const xarPath = yield io4.which("xar", true); - yield (0, exec_1.exec)(`"${xarPath}"`, _unique(args)); - return dest; - }); - } - function extractZip(file, dest) { - return __awaiter2(this, void 0, void 0, function* () { - if (!file) { - throw new Error("parameter 'file' is required"); - } - dest = yield _createExtractFolder(dest); - if (IS_WINDOWS) { - yield extractZipWin(file, dest); - } else { - yield extractZipNix(file, dest); - } - return dest; - }); - } - function extractZipWin(file, dest) { - return __awaiter2(this, void 0, void 0, function* () { - const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); - const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); - const pwshPath = yield io4.which("pwsh", false); - if (pwshPath) { - const pwshCommand = [ - `$ErrorActionPreference = 'Stop' ;`, - `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`, - `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`, - `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;` - ].join(" "); - const args = [ - "-NoLogo", - "-NoProfile", - "-NonInteractive", - "-ExecutionPolicy", - "Unrestricted", - "-Command", - pwshCommand - ]; - core12.debug(`Using pwsh at path: ${pwshPath}`); - yield (0, exec_1.exec)(`"${pwshPath}"`, args); - } else { - const powershellCommand = [ - `$ErrorActionPreference = 'Stop' ;`, - `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`, - `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`, - `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }` - ].join(" "); - const args = [ - "-NoLogo", - "-Sta", - "-NoProfile", - "-NonInteractive", - "-ExecutionPolicy", - "Unrestricted", - "-Command", - powershellCommand - ]; - const powershellPath = yield io4.which("powershell", true); - core12.debug(`Using powershell at path: ${powershellPath}`); - yield (0, exec_1.exec)(`"${powershellPath}"`, args); - } - }); - } - function extractZipNix(file, dest) { - return __awaiter2(this, void 0, void 0, function* () { - const unzipPath = yield io4.which("unzip", true); - const args = [file]; - if (!core12.isDebug()) { - args.unshift("-q"); - } - args.unshift("-o"); - yield (0, exec_1.exec)(`"${unzipPath}"`, args, { cwd: dest }); - }); - } - function cacheDir2(sourceDir, tool, version, arch) { - return __awaiter2(this, void 0, void 0, function* () { - version = semver6.clean(version) || version; - arch = arch || os2.arch(); - core12.debug(`Caching tool ${tool} ${version} ${arch}`); - core12.debug(`source dir: ${sourceDir}`); - if (!fs.statSync(sourceDir).isDirectory()) { - throw new Error("sourceDir is not a directory"); - } - const destPath = yield _createToolPath(tool, version, arch); - for (const itemName of fs.readdirSync(sourceDir)) { - const s = path3.join(sourceDir, itemName); - yield io4.cp(s, destPath, { recursive: true }); - } - _completeToolPath(tool, version, arch); - return destPath; - }); - } - function cacheFile(sourceFile, targetFile, tool, version, arch) { - return __awaiter2(this, void 0, void 0, function* () { - version = semver6.clean(version) || version; - arch = arch || os2.arch(); - core12.debug(`Caching tool ${tool} ${version} ${arch}`); - core12.debug(`source file: ${sourceFile}`); - if (!fs.statSync(sourceFile).isFile()) { - throw new Error("sourceFile is not a file"); - } - const destFolder = yield _createToolPath(tool, version, arch); - const destPath = path3.join(destFolder, targetFile); - core12.debug(`destination file ${destPath}`); - yield io4.cp(sourceFile, destPath); - _completeToolPath(tool, version, arch); - return destFolder; - }); - } - function find2(toolName, versionSpec, arch) { - if (!toolName) { - throw new Error("toolName parameter is required"); - } - if (!versionSpec) { - throw new Error("versionSpec parameter is required"); - } - arch = arch || os2.arch(); - if (!isExplicitVersion(versionSpec)) { - const localVersions = findAllVersions(toolName, arch); - const match = evaluateVersions(localVersions, versionSpec); - versionSpec = match; - } - let toolPath = ""; - if (versionSpec) { - versionSpec = semver6.clean(versionSpec) || ""; - const cachePath = path3.join(_getCacheDirectory(), toolName, versionSpec, arch); - core12.debug(`checking cache: ${cachePath}`); - if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) { - core12.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`); - toolPath = cachePath; - } else { - core12.debug("not found"); - } - } - return toolPath; - } - function findAllVersions(toolName, arch) { - const versions = []; - arch = arch || os2.arch(); - const toolPath = path3.join(_getCacheDirectory(), toolName); - if (fs.existsSync(toolPath)) { - const children = fs.readdirSync(toolPath); - for (const child of children) { - if (isExplicitVersion(child)) { - const fullPath = path3.join(toolPath, child, arch || ""); - if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) { - versions.push(child); - } - } - } - } - return versions; - } - function getManifestFromRepo(owner_1, repo_1, auth_1) { - return __awaiter2(this, arguments, void 0, function* (owner, repo, auth2, branch = "master") { - let releases = []; - const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`; - const http = new httpm.HttpClient("tool-cache"); - const headers = {}; - if (auth2) { - core12.debug("set auth"); - headers.authorization = auth2; - } - const response = yield http.getJson(treeUrl, headers); - if (!response.result) { - return releases; - } - let manifestUrl = ""; - for (const item of response.result.tree) { - if (item.path === "versions-manifest.json") { - manifestUrl = item.url; - break; - } - } - headers["accept"] = "application/vnd.github.VERSION.raw"; - let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody(); - if (versionsRaw) { - versionsRaw = versionsRaw.replace(/^\uFEFF/, ""); - try { - releases = JSON.parse(versionsRaw); - } catch (_a) { - core12.debug("Invalid json"); - } - } - return releases; - }); - } - function findFromManifest(versionSpec_1, stable_1, manifest_1) { - return __awaiter2(this, arguments, void 0, function* (versionSpec, stable, manifest, archFilter = os2.arch()) { - const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter); - return match; - }); - } - function _createExtractFolder(dest) { - return __awaiter2(this, void 0, void 0, function* () { - if (!dest) { - dest = path3.join(_getTempDirectory(), crypto2.randomUUID()); - } - yield io4.mkdirP(dest); - return dest; - }); - } - function _createToolPath(tool, version, arch) { - return __awaiter2(this, void 0, void 0, function* () { - const folderPath = path3.join(_getCacheDirectory(), tool, semver6.clean(version) || version, arch || ""); - core12.debug(`destination ${folderPath}`); - const markerPath = `${folderPath}.complete`; - yield io4.rmRF(folderPath); - yield io4.rmRF(markerPath); - yield io4.mkdirP(folderPath); - return folderPath; - }); - } - function _completeToolPath(tool, version, arch) { - const folderPath = path3.join(_getCacheDirectory(), tool, semver6.clean(version) || version, arch || ""); - const markerPath = `${folderPath}.complete`; - fs.writeFileSync(markerPath, ""); - core12.debug("finished caching tool"); - } - function isExplicitVersion(versionSpec) { - const c = semver6.clean(versionSpec) || ""; - core12.debug(`isExplicit: ${c}`); - const valid2 = semver6.valid(c) != null; - core12.debug(`explicit? ${valid2}`); - return valid2; - } - function evaluateVersions(versions, versionSpec) { - let version = ""; - core12.debug(`evaluating ${versions.length} versions`); - versions = versions.sort((a, b) => { - if (semver6.gt(a, b)) { - return 1; - } - return -1; - }); - for (let i = versions.length - 1; i >= 0; i--) { - const potential = versions[i]; - const satisfied = semver6.satisfies(potential, versionSpec); - if (satisfied) { - version = potential; - break; - } - } - if (version) { - core12.debug(`matched: ${version}`); - } else { - core12.debug("match not found"); - } - return version; - } - function _getCacheDirectory() { - const cacheDirectory = process.env["RUNNER_TOOL_CACHE"] || ""; - (0, assert_1.ok)(cacheDirectory, "Expected RUNNER_TOOL_CACHE to be defined"); - return cacheDirectory; - } - function _getTempDirectory() { - const tempDirectory = process.env["RUNNER_TEMP"] || ""; - (0, assert_1.ok)(tempDirectory, "Expected RUNNER_TEMP to be defined"); - return tempDirectory; - } - function _getGlobal(key, defaultValue) { - const value = global[key]; - return value !== void 0 ? value : defaultValue; - } - function _unique(values) { - return Array.from(new Set(values)); - } - } -}); - // node_modules/bottleneck/light.js var require_light = __commonJS({ "node_modules/bottleneck/light.js"(exports2, module2) { @@ -66014,1303 +65193,6 @@ var require_light = __commonJS({ } }); -// node_modules/jsonschema/lib/helpers.js -var require_helpers = __commonJS({ - "node_modules/jsonschema/lib/helpers.js"(exports2, module2) { - "use strict"; - var uri = require("url"); - var ValidationError = exports2.ValidationError = function ValidationError2(message, instance, schema2, path3, name, argument) { - if (Array.isArray(path3)) { - this.path = path3; - this.property = path3.reduce(function(sum, item) { - return sum + makeSuffix(item); - }, "instance"); - } else if (path3 !== void 0) { - this.property = path3; - } - if (message) { - this.message = message; - } - if (schema2) { - var id = schema2.$id || schema2.id; - this.schema = id || schema2; - } - if (instance !== void 0) { - this.instance = instance; - } - this.name = name; - this.argument = argument; - this.stack = this.toString(); - }; - ValidationError.prototype.toString = function toString2() { - return this.property + " " + this.message; - }; - var ValidatorResult = exports2.ValidatorResult = function ValidatorResult2(instance, schema2, options, ctx) { - this.instance = instance; - this.schema = schema2; - this.options = options; - this.path = ctx.path; - this.propertyPath = ctx.propertyPath; - this.errors = []; - this.throwError = options && options.throwError; - this.throwFirst = options && options.throwFirst; - this.throwAll = options && options.throwAll; - this.disableFormat = options && options.disableFormat === true; - }; - ValidatorResult.prototype.addError = function addError(detail) { - var err; - if (typeof detail == "string") { - err = new ValidationError(detail, this.instance, this.schema, this.path); - } else { - if (!detail) throw new Error("Missing error detail"); - if (!detail.message) throw new Error("Missing error message"); - if (!detail.name) throw new Error("Missing validator type"); - err = new ValidationError(detail.message, this.instance, this.schema, this.path, detail.name, detail.argument); - } - this.errors.push(err); - if (this.throwFirst) { - throw new ValidatorResultError(this); - } else if (this.throwError) { - throw err; - } - return err; - }; - ValidatorResult.prototype.importErrors = function importErrors(res) { - if (typeof res == "string" || res && res.validatorType) { - this.addError(res); - } else if (res && res.errors) { - this.errors = this.errors.concat(res.errors); - } - }; - function stringizer(v, i) { - return i + ": " + v.toString() + "\n"; - } - ValidatorResult.prototype.toString = function toString2(res) { - return this.errors.map(stringizer).join(""); - }; - Object.defineProperty(ValidatorResult.prototype, "valid", { get: function() { - return !this.errors.length; - } }); - module2.exports.ValidatorResultError = ValidatorResultError; - function ValidatorResultError(result) { - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ValidatorResultError); - } - this.instance = result.instance; - this.schema = result.schema; - this.options = result.options; - this.errors = result.errors; - } - ValidatorResultError.prototype = new Error(); - ValidatorResultError.prototype.constructor = ValidatorResultError; - ValidatorResultError.prototype.name = "Validation Error"; - var SchemaError = exports2.SchemaError = function SchemaError2(msg, schema2) { - this.message = msg; - this.schema = schema2; - Error.call(this, msg); - Error.captureStackTrace(this, SchemaError2); - }; - SchemaError.prototype = Object.create( - Error.prototype, - { - constructor: { value: SchemaError, enumerable: false }, - name: { value: "SchemaError", enumerable: false } - } - ); - var SchemaContext = exports2.SchemaContext = function SchemaContext2(schema2, options, path3, base, schemas) { - this.schema = schema2; - this.options = options; - if (Array.isArray(path3)) { - this.path = path3; - this.propertyPath = path3.reduce(function(sum, item) { - return sum + makeSuffix(item); - }, "instance"); - } else { - this.propertyPath = path3; - } - this.base = base; - this.schemas = schemas; - }; - SchemaContext.prototype.resolve = function resolve2(target) { - return uri.resolve(this.base, target); - }; - SchemaContext.prototype.makeChild = function makeChild(schema2, propertyName) { - var path3 = propertyName === void 0 ? this.path : this.path.concat([propertyName]); - var id = schema2.$id || schema2.id; - var base = uri.resolve(this.base, id || ""); - var ctx = new SchemaContext(schema2, this.options, path3, base, Object.create(this.schemas)); - if (id && !ctx.schemas[base]) { - ctx.schemas[base] = schema2; - } - return ctx; - }; - var FORMAT_REGEXPS = exports2.FORMAT_REGEXPS = { - // 7.3.1. Dates, Times, and Duration - "date-time": /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/, - "date": /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/, - "time": /^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/, - "duration": /P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i, - // 7.3.2. Email Addresses - // TODO: fix the email production - "email": /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/, - "idn-email": /^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u, - // 7.3.3. Hostnames - // 7.3.4. IP Addresses - "ip-address": /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, - // FIXME whitespace is invalid - "ipv6": /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, - // 7.3.5. Resource Identifiers - // TODO: A more accurate regular expression for "uri" goes: - // [A-Za-z][+\-.0-9A-Za-z]*:((/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?)?#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])|/?%[0-9A-Fa-f]{2}|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*(#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?)? - "uri": /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, - "uri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/, - "iri": /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, - "iri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u, - "uuid": /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, - // 7.3.6. uri-template - "uri-template": /(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu, - // 7.3.7. JSON Pointers - "json-pointer": /^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu, - "relative-json-pointer": /^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu, - // hostname regex from: http://stackoverflow.com/a/1420225/5628 - "hostname": /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, - "host-name": /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, - "utc-millisec": function(input) { - return typeof input === "string" && parseFloat(input) === parseInt(input, 10) && !isNaN(input); - }, - // 7.3.8. regex - "regex": function(input) { - var result = true; - try { - new RegExp(input); - } catch (e) { - result = false; - } - return result; - }, - // Other definitions - // "style" was removed from JSON Schema in draft-4 and is deprecated - "style": /[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/, - // "color" was removed from JSON Schema in draft-4 and is deprecated - "color": /^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/, - "phone": /^\+(?:[0-9] ?){6,14}[0-9]$/, - "alpha": /^[a-zA-Z]+$/, - "alphanumeric": /^[a-zA-Z0-9]+$/ - }; - FORMAT_REGEXPS.regexp = FORMAT_REGEXPS.regex; - FORMAT_REGEXPS.pattern = FORMAT_REGEXPS.regex; - FORMAT_REGEXPS.ipv4 = FORMAT_REGEXPS["ip-address"]; - exports2.isFormat = function isFormat(input, format, validator) { - if (typeof input === "string" && FORMAT_REGEXPS[format] !== void 0) { - if (FORMAT_REGEXPS[format] instanceof RegExp) { - return FORMAT_REGEXPS[format].test(input); - } - if (typeof FORMAT_REGEXPS[format] === "function") { - return FORMAT_REGEXPS[format](input); - } - } else if (validator && validator.customFormats && typeof validator.customFormats[format] === "function") { - return validator.customFormats[format](input); - } - return true; - }; - var makeSuffix = exports2.makeSuffix = function makeSuffix2(key) { - key = key.toString(); - if (!key.match(/[.\s\[\]]/) && !key.match(/^[\d]/)) { - return "." + key; - } - if (key.match(/^\d+$/)) { - return "[" + key + "]"; - } - return "[" + JSON.stringify(key) + "]"; - }; - exports2.deepCompareStrict = function deepCompareStrict(a, b) { - if (typeof a !== typeof b) { - return false; - } - if (Array.isArray(a)) { - if (!Array.isArray(b)) { - return false; - } - if (a.length !== b.length) { - return false; - } - return a.every(function(v, i) { - return deepCompareStrict(a[i], b[i]); - }); - } - if (typeof a === "object") { - if (!a || !b) { - return a === b; - } - var aKeys = Object.keys(a); - var bKeys = Object.keys(b); - if (aKeys.length !== bKeys.length) { - return false; - } - return aKeys.every(function(v) { - return deepCompareStrict(a[v], b[v]); - }); - } - return a === b; - }; - function deepMerger(target, dst, e, i) { - if (typeof e === "object") { - dst[i] = deepMerge(target[i], e); - } else { - if (target.indexOf(e) === -1) { - dst.push(e); - } - } - } - function copyist(src, dst, key) { - dst[key] = src[key]; - } - function copyistWithDeepMerge(target, src, dst, key) { - if (typeof src[key] !== "object" || !src[key]) { - dst[key] = src[key]; - } else { - if (!target[key]) { - dst[key] = src[key]; - } else { - dst[key] = deepMerge(target[key], src[key]); - } - } - } - function deepMerge(target, src) { - var array = Array.isArray(src); - var dst = array && [] || {}; - if (array) { - target = target || []; - dst = dst.concat(target); - src.forEach(deepMerger.bind(null, target, dst)); - } else { - if (target && typeof target === "object") { - Object.keys(target).forEach(copyist.bind(null, target, dst)); - } - Object.keys(src).forEach(copyistWithDeepMerge.bind(null, target, src, dst)); - } - return dst; - } - module2.exports.deepMerge = deepMerge; - exports2.objectGetPath = function objectGetPath(o, s) { - var parts = s.split("/").slice(1); - var k; - while (typeof (k = parts.shift()) == "string") { - var n = decodeURIComponent(k.replace(/~0/, "~").replace(/~1/g, "/")); - if (!(n in o)) return; - o = o[n]; - } - return o; - }; - function pathEncoder(v) { - return "/" + encodeURIComponent(v).replace(/~/g, "%7E"); - } - exports2.encodePath = function encodePointer(a) { - return a.map(pathEncoder).join(""); - }; - exports2.getDecimalPlaces = function getDecimalPlaces(number) { - var decimalPlaces = 0; - if (isNaN(number)) return decimalPlaces; - if (typeof number !== "number") { - number = Number(number); - } - var parts = number.toString().split("e"); - if (parts.length === 2) { - if (parts[1][0] !== "-") { - return decimalPlaces; - } else { - decimalPlaces = Number(parts[1].slice(1)); - } - } - var decimalParts = parts[0].split("."); - if (decimalParts.length === 2) { - decimalPlaces += decimalParts[1].length; - } - return decimalPlaces; - }; - exports2.isSchema = function isSchema(val) { - return typeof val === "object" && val || typeof val === "boolean"; - }; - } -}); - -// node_modules/jsonschema/lib/attribute.js -var require_attribute = __commonJS({ - "node_modules/jsonschema/lib/attribute.js"(exports2, module2) { - "use strict"; - var helpers = require_helpers(); - var ValidatorResult = helpers.ValidatorResult; - var SchemaError = helpers.SchemaError; - var attribute = {}; - attribute.ignoreProperties = { - // informative properties - "id": true, - "default": true, - "description": true, - "title": true, - // arguments to other properties - "additionalItems": true, - "then": true, - "else": true, - // special-handled properties - "$schema": true, - "$ref": true, - "extends": true - }; - var validators = attribute.validators = {}; - validators.type = function validateType(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - var result = new ValidatorResult(instance, schema2, options, ctx); - var types = Array.isArray(schema2.type) ? schema2.type : [schema2.type]; - if (!types.some(this.testType.bind(this, instance, schema2, options, ctx))) { - var list = types.map(function(v) { - if (!v) return; - var id = v.$id || v.id; - return id ? "<" + id + ">" : v + ""; - }); - result.addError({ - name: "type", - argument: list, - message: "is not of a type(s) " + list - }); - } - return result; - }; - function testSchemaNoThrow(instance, options, ctx, callback, schema2) { - var throwError2 = options.throwError; - var throwAll = options.throwAll; - options.throwError = false; - options.throwAll = false; - var res = this.validateSchema(instance, schema2, options, ctx); - options.throwError = throwError2; - options.throwAll = throwAll; - if (!res.valid && callback instanceof Function) { - callback(res); - } - return res.valid; - } - validators.anyOf = function validateAnyOf(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - var result = new ValidatorResult(instance, schema2, options, ctx); - var inner = new ValidatorResult(instance, schema2, options, ctx); - if (!Array.isArray(schema2.anyOf)) { - throw new SchemaError("anyOf must be an array"); - } - if (!schema2.anyOf.some( - testSchemaNoThrow.bind( - this, - instance, - options, - ctx, - function(res) { - inner.importErrors(res); - } - ) - )) { - var list = schema2.anyOf.map(function(v, i) { - var id = v.$id || v.id; - if (id) return "<" + id + ">"; - return v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; - }); - if (options.nestedErrors) { - result.importErrors(inner); - } - result.addError({ - name: "anyOf", - argument: list, - message: "is not any of " + list.join(",") - }); - } - return result; - }; - validators.allOf = function validateAllOf(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - if (!Array.isArray(schema2.allOf)) { - throw new SchemaError("allOf must be an array"); - } - var result = new ValidatorResult(instance, schema2, options, ctx); - var self2 = this; - schema2.allOf.forEach(function(v, i) { - var valid2 = self2.validateSchema(instance, v, options, ctx); - if (!valid2.valid) { - var id = v.$id || v.id; - var msg = id || v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; - result.addError({ - name: "allOf", - argument: { id: msg, length: valid2.errors.length, valid: valid2 }, - message: "does not match allOf schema " + msg + " with " + valid2.errors.length + " error[s]:" - }); - result.importErrors(valid2); - } - }); - return result; - }; - validators.oneOf = function validateOneOf(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - if (!Array.isArray(schema2.oneOf)) { - throw new SchemaError("oneOf must be an array"); - } - var result = new ValidatorResult(instance, schema2, options, ctx); - var inner = new ValidatorResult(instance, schema2, options, ctx); - var count = schema2.oneOf.filter( - testSchemaNoThrow.bind( - this, - instance, - options, - ctx, - function(res) { - inner.importErrors(res); - } - ) - ).length; - var list = schema2.oneOf.map(function(v, i) { - var id = v.$id || v.id; - return id || v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; - }); - if (count !== 1) { - if (options.nestedErrors) { - result.importErrors(inner); - } - result.addError({ - name: "oneOf", - argument: list, - message: "is not exactly one from " + list.join(",") - }); - } - return result; - }; - validators.if = function validateIf(instance, schema2, options, ctx) { - if (instance === void 0) return null; - if (!helpers.isSchema(schema2.if)) throw new Error('Expected "if" keyword to be a schema'); - var ifValid = testSchemaNoThrow.call(this, instance, options, ctx, null, schema2.if); - var result = new ValidatorResult(instance, schema2, options, ctx); - var res; - if (ifValid) { - if (schema2.then === void 0) return; - if (!helpers.isSchema(schema2.then)) throw new Error('Expected "then" keyword to be a schema'); - res = this.validateSchema(instance, schema2.then, options, ctx.makeChild(schema2.then)); - result.importErrors(res); - } else { - if (schema2.else === void 0) return; - if (!helpers.isSchema(schema2.else)) throw new Error('Expected "else" keyword to be a schema'); - res = this.validateSchema(instance, schema2.else, options, ctx.makeChild(schema2.else)); - result.importErrors(res); - } - return result; - }; - function getEnumerableProperty(object, key) { - if (Object.hasOwnProperty.call(object, key)) return object[key]; - if (!(key in object)) return; - while (object = Object.getPrototypeOf(object)) { - if (Object.propertyIsEnumerable.call(object, key)) return object[key]; - } - } - validators.propertyNames = function validatePropertyNames(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var subschema = schema2.propertyNames !== void 0 ? schema2.propertyNames : {}; - if (!helpers.isSchema(subschema)) throw new SchemaError('Expected "propertyNames" to be a schema (object or boolean)'); - for (var property in instance) { - if (getEnumerableProperty(instance, property) !== void 0) { - var res = this.validateSchema(property, subschema, options, ctx.makeChild(subschema)); - result.importErrors(res); - } - } - return result; - }; - validators.properties = function validateProperties(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var properties = schema2.properties || {}; - for (var property in properties) { - var subschema = properties[property]; - if (subschema === void 0) { - continue; - } else if (subschema === null) { - throw new SchemaError('Unexpected null, expected schema in "properties"'); - } - if (typeof options.preValidateProperty == "function") { - options.preValidateProperty(instance, property, subschema, options, ctx); - } - var prop = getEnumerableProperty(instance, property); - var res = this.validateSchema(prop, subschema, options, ctx.makeChild(subschema, property)); - if (res.instance !== result.instance[property]) result.instance[property] = res.instance; - result.importErrors(res); - } - return result; - }; - function testAdditionalProperty(instance, schema2, options, ctx, property, result) { - if (!this.types.object(instance)) return; - if (schema2.properties && schema2.properties[property] !== void 0) { - return; - } - if (schema2.additionalProperties === false) { - result.addError({ - name: "additionalProperties", - argument: property, - message: "is not allowed to have the additional property " + JSON.stringify(property) - }); - } else { - var additionalProperties = schema2.additionalProperties || {}; - if (typeof options.preValidateProperty == "function") { - options.preValidateProperty(instance, property, additionalProperties, options, ctx); - } - var res = this.validateSchema(instance[property], additionalProperties, options, ctx.makeChild(additionalProperties, property)); - if (res.instance !== result.instance[property]) result.instance[property] = res.instance; - result.importErrors(res); - } - } - validators.patternProperties = function validatePatternProperties(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var patternProperties = schema2.patternProperties || {}; - for (var property in instance) { - var test = true; - for (var pattern in patternProperties) { - var subschema = patternProperties[pattern]; - if (subschema === void 0) { - continue; - } else if (subschema === null) { - throw new SchemaError('Unexpected null, expected schema in "patternProperties"'); - } - try { - var regexp = new RegExp(pattern, "u"); - } catch (_e) { - regexp = new RegExp(pattern); - } - if (!regexp.test(property)) { - continue; - } - test = false; - if (typeof options.preValidateProperty == "function") { - options.preValidateProperty(instance, property, subschema, options, ctx); - } - var res = this.validateSchema(instance[property], subschema, options, ctx.makeChild(subschema, property)); - if (res.instance !== result.instance[property]) result.instance[property] = res.instance; - result.importErrors(res); - } - if (test) { - testAdditionalProperty.call(this, instance, schema2, options, ctx, property, result); - } - } - return result; - }; - validators.additionalProperties = function validateAdditionalProperties(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - if (schema2.patternProperties) { - return null; - } - var result = new ValidatorResult(instance, schema2, options, ctx); - for (var property in instance) { - testAdditionalProperty.call(this, instance, schema2, options, ctx, property, result); - } - return result; - }; - validators.minProperties = function validateMinProperties(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var keys = Object.keys(instance); - if (!(keys.length >= schema2.minProperties)) { - result.addError({ - name: "minProperties", - argument: schema2.minProperties, - message: "does not meet minimum property length of " + schema2.minProperties - }); - } - return result; - }; - validators.maxProperties = function validateMaxProperties(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var keys = Object.keys(instance); - if (!(keys.length <= schema2.maxProperties)) { - result.addError({ - name: "maxProperties", - argument: schema2.maxProperties, - message: "does not meet maximum property length of " + schema2.maxProperties - }); - } - return result; - }; - validators.items = function validateItems(instance, schema2, options, ctx) { - var self2 = this; - if (!this.types.array(instance)) return; - if (schema2.items === void 0) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - instance.every(function(value, i) { - if (Array.isArray(schema2.items)) { - var items = schema2.items[i] === void 0 ? schema2.additionalItems : schema2.items[i]; - } else { - var items = schema2.items; - } - if (items === void 0) { - return true; - } - if (items === false) { - result.addError({ - name: "items", - message: "additionalItems not permitted" - }); - return false; - } - var res = self2.validateSchema(value, items, options, ctx.makeChild(items, i)); - if (res.instance !== result.instance[i]) result.instance[i] = res.instance; - result.importErrors(res); - return true; - }); - return result; - }; - validators.contains = function validateContains(instance, schema2, options, ctx) { - var self2 = this; - if (!this.types.array(instance)) return; - if (schema2.contains === void 0) return; - if (!helpers.isSchema(schema2.contains)) throw new Error('Expected "contains" keyword to be a schema'); - var result = new ValidatorResult(instance, schema2, options, ctx); - var count = instance.some(function(value, i) { - var res = self2.validateSchema(value, schema2.contains, options, ctx.makeChild(schema2.contains, i)); - return res.errors.length === 0; - }); - if (count === false) { - result.addError({ - name: "contains", - argument: schema2.contains, - message: "must contain an item matching given schema" - }); - } - return result; - }; - validators.minimum = function validateMinimum(instance, schema2, options, ctx) { - if (!this.types.number(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (schema2.exclusiveMinimum && schema2.exclusiveMinimum === true) { - if (!(instance > schema2.minimum)) { - result.addError({ - name: "minimum", - argument: schema2.minimum, - message: "must be greater than " + schema2.minimum - }); - } - } else { - if (!(instance >= schema2.minimum)) { - result.addError({ - name: "minimum", - argument: schema2.minimum, - message: "must be greater than or equal to " + schema2.minimum - }); - } - } - return result; - }; - validators.maximum = function validateMaximum(instance, schema2, options, ctx) { - if (!this.types.number(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (schema2.exclusiveMaximum && schema2.exclusiveMaximum === true) { - if (!(instance < schema2.maximum)) { - result.addError({ - name: "maximum", - argument: schema2.maximum, - message: "must be less than " + schema2.maximum - }); - } - } else { - if (!(instance <= schema2.maximum)) { - result.addError({ - name: "maximum", - argument: schema2.maximum, - message: "must be less than or equal to " + schema2.maximum - }); - } - } - return result; - }; - validators.exclusiveMinimum = function validateExclusiveMinimum(instance, schema2, options, ctx) { - if (typeof schema2.exclusiveMinimum === "boolean") return; - if (!this.types.number(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var valid2 = instance > schema2.exclusiveMinimum; - if (!valid2) { - result.addError({ - name: "exclusiveMinimum", - argument: schema2.exclusiveMinimum, - message: "must be strictly greater than " + schema2.exclusiveMinimum - }); - } - return result; - }; - validators.exclusiveMaximum = function validateExclusiveMaximum(instance, schema2, options, ctx) { - if (typeof schema2.exclusiveMaximum === "boolean") return; - if (!this.types.number(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var valid2 = instance < schema2.exclusiveMaximum; - if (!valid2) { - result.addError({ - name: "exclusiveMaximum", - argument: schema2.exclusiveMaximum, - message: "must be strictly less than " + schema2.exclusiveMaximum - }); - } - return result; - }; - var validateMultipleOfOrDivisbleBy = function validateMultipleOfOrDivisbleBy2(instance, schema2, options, ctx, validationType, errorMessage) { - if (!this.types.number(instance)) return; - var validationArgument = schema2[validationType]; - if (validationArgument == 0) { - throw new SchemaError(validationType + " cannot be zero"); - } - var result = new ValidatorResult(instance, schema2, options, ctx); - var instanceDecimals = helpers.getDecimalPlaces(instance); - var divisorDecimals = helpers.getDecimalPlaces(validationArgument); - var maxDecimals = Math.max(instanceDecimals, divisorDecimals); - var multiplier = Math.pow(10, maxDecimals); - if (Math.round(instance * multiplier) % Math.round(validationArgument * multiplier) !== 0) { - result.addError({ - name: validationType, - argument: validationArgument, - message: errorMessage + JSON.stringify(validationArgument) - }); - } - return result; - }; - validators.multipleOf = function validateMultipleOf(instance, schema2, options, ctx) { - return validateMultipleOfOrDivisbleBy.call(this, instance, schema2, options, ctx, "multipleOf", "is not a multiple of (divisible by) "); - }; - validators.divisibleBy = function validateDivisibleBy(instance, schema2, options, ctx) { - return validateMultipleOfOrDivisbleBy.call(this, instance, schema2, options, ctx, "divisibleBy", "is not divisible by (multiple of) "); - }; - validators.required = function validateRequired(instance, schema2, options, ctx) { - var result = new ValidatorResult(instance, schema2, options, ctx); - if (instance === void 0 && schema2.required === true) { - result.addError({ - name: "required", - message: "is required" - }); - } else if (this.types.object(instance) && Array.isArray(schema2.required)) { - schema2.required.forEach(function(n) { - if (getEnumerableProperty(instance, n) === void 0) { - result.addError({ - name: "required", - argument: n, - message: "requires property " + JSON.stringify(n) - }); - } - }); - } - return result; - }; - validators.pattern = function validatePattern(instance, schema2, options, ctx) { - if (!this.types.string(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var pattern = schema2.pattern; - try { - var regexp = new RegExp(pattern, "u"); - } catch (_e) { - regexp = new RegExp(pattern); - } - if (!instance.match(regexp)) { - result.addError({ - name: "pattern", - argument: schema2.pattern, - message: "does not match pattern " + JSON.stringify(schema2.pattern.toString()) - }); - } - return result; - }; - validators.format = function validateFormat(instance, schema2, options, ctx) { - if (instance === void 0) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!result.disableFormat && !helpers.isFormat(instance, schema2.format, this)) { - result.addError({ - name: "format", - argument: schema2.format, - message: "does not conform to the " + JSON.stringify(schema2.format) + " format" - }); - } - return result; - }; - validators.minLength = function validateMinLength(instance, schema2, options, ctx) { - if (!this.types.string(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var hsp = instance.match(/[\uDC00-\uDFFF]/g); - var length = instance.length - (hsp ? hsp.length : 0); - if (!(length >= schema2.minLength)) { - result.addError({ - name: "minLength", - argument: schema2.minLength, - message: "does not meet minimum length of " + schema2.minLength - }); - } - return result; - }; - validators.maxLength = function validateMaxLength(instance, schema2, options, ctx) { - if (!this.types.string(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - var hsp = instance.match(/[\uDC00-\uDFFF]/g); - var length = instance.length - (hsp ? hsp.length : 0); - if (!(length <= schema2.maxLength)) { - result.addError({ - name: "maxLength", - argument: schema2.maxLength, - message: "does not meet maximum length of " + schema2.maxLength - }); - } - return result; - }; - validators.minItems = function validateMinItems(instance, schema2, options, ctx) { - if (!this.types.array(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!(instance.length >= schema2.minItems)) { - result.addError({ - name: "minItems", - argument: schema2.minItems, - message: "does not meet minimum length of " + schema2.minItems - }); - } - return result; - }; - validators.maxItems = function validateMaxItems(instance, schema2, options, ctx) { - if (!this.types.array(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!(instance.length <= schema2.maxItems)) { - result.addError({ - name: "maxItems", - argument: schema2.maxItems, - message: "does not meet maximum length of " + schema2.maxItems - }); - } - return result; - }; - function testArrays(v, i, a) { - var j, len = a.length; - for (j = i + 1, len; j < len; j++) { - if (helpers.deepCompareStrict(v, a[j])) { - return false; - } - } - return true; - } - validators.uniqueItems = function validateUniqueItems(instance, schema2, options, ctx) { - if (schema2.uniqueItems !== true) return; - if (!this.types.array(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!instance.every(testArrays)) { - result.addError({ - name: "uniqueItems", - message: "contains duplicate item" - }); - } - return result; - }; - validators.dependencies = function validateDependencies(instance, schema2, options, ctx) { - if (!this.types.object(instance)) return; - var result = new ValidatorResult(instance, schema2, options, ctx); - for (var property in schema2.dependencies) { - if (instance[property] === void 0) { - continue; - } - var dep = schema2.dependencies[property]; - var childContext = ctx.makeChild(dep, property); - if (typeof dep == "string") { - dep = [dep]; - } - if (Array.isArray(dep)) { - dep.forEach(function(prop) { - if (instance[prop] === void 0) { - result.addError({ - // FIXME there's two different "dependencies" errors here with slightly different outputs - // Can we make these the same? Or should we create different error types? - name: "dependencies", - argument: childContext.propertyPath, - message: "property " + prop + " not found, required by " + childContext.propertyPath - }); - } - }); - } else { - var res = this.validateSchema(instance, dep, options, childContext); - if (result.instance !== res.instance) result.instance = res.instance; - if (res && res.errors.length) { - result.addError({ - name: "dependencies", - argument: childContext.propertyPath, - message: "does not meet dependency required by " + childContext.propertyPath - }); - result.importErrors(res); - } - } - } - return result; - }; - validators["enum"] = function validateEnum(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - if (!Array.isArray(schema2["enum"])) { - throw new SchemaError("enum expects an array", schema2); - } - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!schema2["enum"].some(helpers.deepCompareStrict.bind(null, instance))) { - result.addError({ - name: "enum", - argument: schema2["enum"], - message: "is not one of enum values: " + schema2["enum"].map(String).join(",") - }); - } - return result; - }; - validators["const"] = function validateEnum(instance, schema2, options, ctx) { - if (instance === void 0) { - return null; - } - var result = new ValidatorResult(instance, schema2, options, ctx); - if (!helpers.deepCompareStrict(schema2["const"], instance)) { - result.addError({ - name: "const", - argument: schema2["const"], - message: "does not exactly match expected constant: " + schema2["const"] - }); - } - return result; - }; - validators.not = validators.disallow = function validateNot(instance, schema2, options, ctx) { - var self2 = this; - if (instance === void 0) return null; - var result = new ValidatorResult(instance, schema2, options, ctx); - var notTypes = schema2.not || schema2.disallow; - if (!notTypes) return null; - if (!Array.isArray(notTypes)) notTypes = [notTypes]; - notTypes.forEach(function(type2) { - if (self2.testType(instance, schema2, options, ctx, type2)) { - var id = type2 && (type2.$id || type2.id); - var schemaId = id || type2; - result.addError({ - name: "not", - argument: schemaId, - message: "is of prohibited type " + schemaId - }); - } - }); - return result; - }; - module2.exports = attribute; - } -}); - -// node_modules/jsonschema/lib/scan.js -var require_scan = __commonJS({ - "node_modules/jsonschema/lib/scan.js"(exports2, module2) { - "use strict"; - var urilib = require("url"); - var helpers = require_helpers(); - module2.exports.SchemaScanResult = SchemaScanResult; - function SchemaScanResult(found, ref) { - this.id = found; - this.ref = ref; - } - module2.exports.scan = function scan(base, schema2) { - function scanSchema(baseuri, schema3) { - if (!schema3 || typeof schema3 != "object") return; - if (schema3.$ref) { - var resolvedUri = urilib.resolve(baseuri, schema3.$ref); - ref[resolvedUri] = ref[resolvedUri] ? ref[resolvedUri] + 1 : 0; - return; - } - var id = schema3.$id || schema3.id; - var ourBase = id ? urilib.resolve(baseuri, id) : baseuri; - if (ourBase) { - if (ourBase.indexOf("#") < 0) ourBase += "#"; - if (found[ourBase]) { - if (!helpers.deepCompareStrict(found[ourBase], schema3)) { - throw new Error("Schema <" + ourBase + "> already exists with different definition"); - } - return found[ourBase]; - } - found[ourBase] = schema3; - if (ourBase[ourBase.length - 1] == "#") { - found[ourBase.substring(0, ourBase.length - 1)] = schema3; - } - } - scanArray(ourBase + "/items", Array.isArray(schema3.items) ? schema3.items : [schema3.items]); - scanArray(ourBase + "/extends", Array.isArray(schema3.extends) ? schema3.extends : [schema3.extends]); - scanSchema(ourBase + "/additionalItems", schema3.additionalItems); - scanObject(ourBase + "/properties", schema3.properties); - scanSchema(ourBase + "/additionalProperties", schema3.additionalProperties); - scanObject(ourBase + "/definitions", schema3.definitions); - scanObject(ourBase + "/patternProperties", schema3.patternProperties); - scanObject(ourBase + "/dependencies", schema3.dependencies); - scanArray(ourBase + "/disallow", schema3.disallow); - scanArray(ourBase + "/allOf", schema3.allOf); - scanArray(ourBase + "/anyOf", schema3.anyOf); - scanArray(ourBase + "/oneOf", schema3.oneOf); - scanSchema(ourBase + "/not", schema3.not); - } - function scanArray(baseuri, schemas) { - if (!Array.isArray(schemas)) return; - for (var i = 0; i < schemas.length; i++) { - scanSchema(baseuri + "/" + i, schemas[i]); - } - } - function scanObject(baseuri, schemas) { - if (!schemas || typeof schemas != "object") return; - for (var p in schemas) { - scanSchema(baseuri + "/" + p, schemas[p]); - } - } - var found = {}; - var ref = {}; - scanSchema(base, schema2); - return new SchemaScanResult(found, ref); - }; - } -}); - -// node_modules/jsonschema/lib/validator.js -var require_validator = __commonJS({ - "node_modules/jsonschema/lib/validator.js"(exports2, module2) { - "use strict"; - var urilib = require("url"); - var attribute = require_attribute(); - var helpers = require_helpers(); - var scanSchema = require_scan().scan; - var ValidatorResult = helpers.ValidatorResult; - var ValidatorResultError = helpers.ValidatorResultError; - var SchemaError = helpers.SchemaError; - var SchemaContext = helpers.SchemaContext; - var anonymousBase = "/"; - var Validator2 = function Validator3() { - this.customFormats = Object.create(Validator3.prototype.customFormats); - this.schemas = {}; - this.unresolvedRefs = []; - this.types = Object.create(types); - this.attributes = Object.create(attribute.validators); - }; - Validator2.prototype.customFormats = {}; - Validator2.prototype.schemas = null; - Validator2.prototype.types = null; - Validator2.prototype.attributes = null; - Validator2.prototype.unresolvedRefs = null; - Validator2.prototype.addSchema = function addSchema(schema2, base) { - var self2 = this; - if (!schema2) { - return null; - } - var scan = scanSchema(base || anonymousBase, schema2); - var ourUri = base || schema2.$id || schema2.id; - for (var uri in scan.id) { - this.schemas[uri] = scan.id[uri]; - } - for (var uri in scan.ref) { - this.unresolvedRefs.push(uri); - } - this.unresolvedRefs = this.unresolvedRefs.filter(function(uri2) { - return typeof self2.schemas[uri2] === "undefined"; - }); - return this.schemas[ourUri]; - }; - Validator2.prototype.addSubSchemaArray = function addSubSchemaArray(baseuri, schemas) { - if (!Array.isArray(schemas)) return; - for (var i = 0; i < schemas.length; i++) { - this.addSubSchema(baseuri, schemas[i]); - } - }; - Validator2.prototype.addSubSchemaObject = function addSubSchemaArray(baseuri, schemas) { - if (!schemas || typeof schemas != "object") return; - for (var p in schemas) { - this.addSubSchema(baseuri, schemas[p]); - } - }; - Validator2.prototype.setSchemas = function setSchemas(schemas) { - this.schemas = schemas; - }; - Validator2.prototype.getSchema = function getSchema(urn) { - return this.schemas[urn]; - }; - Validator2.prototype.validate = function validate(instance, schema2, options, ctx) { - if (typeof schema2 !== "boolean" && typeof schema2 !== "object" || schema2 === null) { - throw new SchemaError("Expected `schema` to be an object or boolean"); - } - if (!options) { - options = {}; - } - var id = schema2.$id || schema2.id; - var base = urilib.resolve(options.base || anonymousBase, id || ""); - if (!ctx) { - ctx = new SchemaContext(schema2, options, [], base, Object.create(this.schemas)); - if (!ctx.schemas[base]) { - ctx.schemas[base] = schema2; - } - var found = scanSchema(base, schema2); - for (var n in found.id) { - var sch = found.id[n]; - ctx.schemas[n] = sch; - } - } - if (options.required && instance === void 0) { - var result = new ValidatorResult(instance, schema2, options, ctx); - result.addError("is required, but is undefined"); - return result; - } - var result = this.validateSchema(instance, schema2, options, ctx); - if (!result) { - throw new Error("Result undefined"); - } else if (options.throwAll && result.errors.length) { - throw new ValidatorResultError(result); - } - return result; - }; - function shouldResolve(schema2) { - var ref = typeof schema2 === "string" ? schema2 : schema2.$ref; - if (typeof ref == "string") return ref; - return false; - } - Validator2.prototype.validateSchema = function validateSchema(instance, schema2, options, ctx) { - var result = new ValidatorResult(instance, schema2, options, ctx); - if (typeof schema2 === "boolean") { - if (schema2 === true) { - schema2 = {}; - } else if (schema2 === false) { - schema2 = { type: [] }; - } - } else if (!schema2) { - throw new Error("schema is undefined"); - } - if (schema2["extends"]) { - if (Array.isArray(schema2["extends"])) { - var schemaobj = { schema: schema2, ctx }; - schema2["extends"].forEach(this.schemaTraverser.bind(this, schemaobj)); - schema2 = schemaobj.schema; - schemaobj.schema = null; - schemaobj.ctx = null; - schemaobj = null; - } else { - schema2 = helpers.deepMerge(schema2, this.superResolve(schema2["extends"], ctx)); - } - } - var switchSchema = shouldResolve(schema2); - if (switchSchema) { - var resolved = this.resolve(schema2, switchSchema, ctx); - var subctx = new SchemaContext(resolved.subschema, options, ctx.path, resolved.switchSchema, ctx.schemas); - return this.validateSchema(instance, resolved.subschema, options, subctx); - } - var skipAttributes = options && options.skipAttributes || []; - for (var key in schema2) { - if (!attribute.ignoreProperties[key] && skipAttributes.indexOf(key) < 0) { - var validatorErr = null; - var validator = this.attributes[key]; - if (validator) { - validatorErr = validator.call(this, instance, schema2, options, ctx); - } else if (options.allowUnknownAttributes === false) { - throw new SchemaError("Unsupported attribute: " + key, schema2); - } - if (validatorErr) { - result.importErrors(validatorErr); - } - } - } - if (typeof options.rewrite == "function") { - var value = options.rewrite.call(this, instance, schema2, options, ctx); - result.instance = value; - } - return result; - }; - Validator2.prototype.schemaTraverser = function schemaTraverser(schemaobj, s) { - schemaobj.schema = helpers.deepMerge(schemaobj.schema, this.superResolve(s, schemaobj.ctx)); - }; - Validator2.prototype.superResolve = function superResolve(schema2, ctx) { - var ref = shouldResolve(schema2); - if (ref) { - return this.resolve(schema2, ref, ctx).subschema; - } - return schema2; - }; - Validator2.prototype.resolve = function resolve2(schema2, switchSchema, ctx) { - switchSchema = ctx.resolve(switchSchema); - if (ctx.schemas[switchSchema]) { - return { subschema: ctx.schemas[switchSchema], switchSchema }; - } - var parsed = urilib.parse(switchSchema); - var fragment = parsed && parsed.hash; - var document2 = fragment && fragment.length && switchSchema.substr(0, switchSchema.length - fragment.length); - if (!document2 || !ctx.schemas[document2]) { - throw new SchemaError("no such schema <" + switchSchema + ">", schema2); - } - var subschema = helpers.objectGetPath(ctx.schemas[document2], fragment.substr(1)); - if (subschema === void 0) { - throw new SchemaError("no such schema " + fragment + " located in <" + document2 + ">", schema2); - } - return { subschema, switchSchema }; - }; - Validator2.prototype.testType = function validateType(instance, schema2, options, ctx, type2) { - if (type2 === void 0) { - return; - } else if (type2 === null) { - throw new SchemaError('Unexpected null in "type" keyword'); - } - if (typeof this.types[type2] == "function") { - return this.types[type2].call(this, instance); - } - if (type2 && typeof type2 == "object") { - var res = this.validateSchema(instance, type2, options, ctx); - return res === void 0 || !(res && res.errors.length); - } - return true; - }; - var types = Validator2.prototype.types = {}; - types.string = function testString(instance) { - return typeof instance == "string"; - }; - types.number = function testNumber(instance) { - return typeof instance == "number" && isFinite(instance); - }; - types.integer = function testInteger(instance) { - return typeof instance == "number" && instance % 1 === 0; - }; - types.boolean = function testBoolean(instance) { - return typeof instance == "boolean"; - }; - types.array = function testArray(instance) { - return Array.isArray(instance); - }; - types["null"] = function testNull(instance) { - return instance === null; - }; - types.date = function testDate(instance) { - return instance instanceof Date; - }; - types.any = function testAny(instance) { - return true; - }; - types.object = function testObject(instance) { - return instance && typeof instance === "object" && !Array.isArray(instance) && !(instance instanceof Date); - }; - module2.exports = Validator2; - } -}); - -// node_modules/jsonschema/lib/index.js -var require_lib3 = __commonJS({ - "node_modules/jsonschema/lib/index.js"(exports2, module2) { - "use strict"; - var Validator2 = module2.exports.Validator = require_validator(); - module2.exports.ValidatorResult = require_helpers().ValidatorResult; - module2.exports.ValidatorResultError = require_helpers().ValidatorResultError; - module2.exports.ValidationError = require_helpers().ValidationError; - module2.exports.SchemaError = require_helpers().SchemaError; - module2.exports.SchemaScanResult = require_scan().SchemaScanResult; - module2.exports.scan = require_scan().scan; - module2.exports.validate = function(instance, schema2, options) { - var v = new Validator2(); - return v.validate(instance, schema2, options); - }; - } -}); - // node_modules/@actions/glob/lib/internal-glob-options-helper.js var require_internal_glob_options_helper = __commonJS({ "node_modules/@actions/glob/lib/internal-glob-options-helper.js"(exports2) { @@ -67441,7 +65323,7 @@ var require_internal_path_helper = __commonJS({ exports2.hasRoot = hasRoot; exports2.normalizeSeparators = normalizeSeparators; exports2.safeTrimTrailingSeparator = safeTrimTrailingSeparator; - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var assert_1 = __importDefault2(require("assert")); var IS_WINDOWS = process.platform === "win32"; function dirname(p) { @@ -67449,7 +65331,7 @@ var require_internal_path_helper = __commonJS({ if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) { return p; } - let result = path3.dirname(p); + let result = path4.dirname(p); if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) { result = safeTrimTrailingSeparator(result); } @@ -67486,7 +65368,7 @@ var require_internal_path_helper = __commonJS({ (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) { } else { - root += path3.sep; + root += path4.sep; } return root + itemPath; } @@ -67520,10 +65402,10 @@ var require_internal_path_helper = __commonJS({ return ""; } p = normalizeSeparators(p); - if (!p.endsWith(path3.sep)) { + if (!p.endsWith(path4.sep)) { return p; } - if (p === path3.sep) { + if (p === path4.sep) { return p; } if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) { @@ -67868,7 +65750,7 @@ var require_minimatch = __commonJS({ "node_modules/minimatch/minimatch.js"(exports2, module2) { module2.exports = minimatch; minimatch.Minimatch = Minimatch; - var path3 = (function() { + var path4 = (function() { try { return require("path"); } catch (e) { @@ -67876,7 +65758,7 @@ var require_minimatch = __commonJS({ })() || { sep: "/" }; - minimatch.sep = path3.sep; + minimatch.sep = path4.sep; var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; var expand2 = require_brace_expansion(); var plTypes = { @@ -67965,8 +65847,8 @@ var require_minimatch = __commonJS({ assertValidPattern(pattern); if (!options) options = {}; pattern = pattern.trim(); - if (!options.allowWindowsEscape && path3.sep !== "/") { - pattern = pattern.split(path3.sep).join("/"); + if (!options.allowWindowsEscape && path4.sep !== "/") { + pattern = pattern.split(path4.sep).join("/"); } this.options = options; this.set = []; @@ -68335,8 +66217,8 @@ var require_minimatch = __commonJS({ if (this.empty) return f === ""; if (f === "/" && partial) return true; var options = this.options; - if (path3.sep !== "/") { - f = f.split(path3.sep).join("/"); + if (path4.sep !== "/") { + f = f.split(path4.sep).join("/"); } f = f.split(slashSplit); this.debug(this.pattern, "split", f); @@ -68482,7 +66364,7 @@ var require_internal_path = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Path = void 0; - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var pathHelper = __importStar2(require_internal_path_helper()); var assert_1 = __importDefault2(require("assert")); var IS_WINDOWS = process.platform === "win32"; @@ -68497,12 +66379,12 @@ var require_internal_path = __commonJS({ (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); if (!pathHelper.hasRoot(itemPath)) { - this.segments = itemPath.split(path3.sep); + this.segments = itemPath.split(path4.sep); } else { let remaining = itemPath; let dir = pathHelper.dirname(remaining); while (dir !== remaining) { - const basename = path3.basename(remaining); + const basename = path4.basename(remaining); this.segments.unshift(basename); remaining = dir; dir = pathHelper.dirname(remaining); @@ -68520,7 +66402,7 @@ var require_internal_path = __commonJS({ (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } else { - (0, assert_1.default)(!segment.includes(path3.sep), `Parameter 'itemPath' contains unexpected path separators`); + (0, assert_1.default)(!segment.includes(path4.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -68531,12 +66413,12 @@ var require_internal_path = __commonJS({ */ toString() { let result = this.segments[0]; - let skipSlash = result.endsWith(path3.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); + let skipSlash = result.endsWith(path4.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); for (let i = 1; i < this.segments.length; i++) { if (skipSlash) { skipSlash = false; } else { - result += path3.sep; + result += path4.sep; } result += this.segments[i]; } @@ -68594,7 +66476,7 @@ var require_internal_pattern = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Pattern = void 0; var os2 = __importStar2(require("os")); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var pathHelper = __importStar2(require_internal_path_helper()); var assert_1 = __importDefault2(require("assert")); var minimatch_1 = require_minimatch(); @@ -68623,7 +66505,7 @@ var require_internal_pattern = __commonJS({ } pattern = _Pattern.fixupPattern(pattern, homedir); this.segments = new internal_path_1.Path(pattern).segments; - this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path3.sep); + this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path4.sep); pattern = pathHelper.safeTrimTrailingSeparator(pattern); let foundGlob = false; const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === "")); @@ -68647,8 +66529,8 @@ var require_internal_pattern = __commonJS({ match(itemPath) { if (this.segments[this.segments.length - 1] === "**") { itemPath = pathHelper.normalizeSeparators(itemPath); - if (!itemPath.endsWith(path3.sep) && this.isImplicitPattern === false) { - itemPath = `${itemPath}${path3.sep}`; + if (!itemPath.endsWith(path4.sep) && this.isImplicitPattern === false) { + itemPath = `${itemPath}${path4.sep}`; } } else { itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); @@ -68683,9 +66565,9 @@ var require_internal_pattern = __commonJS({ (0, assert_1.default)(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); pattern = pathHelper.normalizeSeparators(pattern); - if (pattern === "." || pattern.startsWith(`.${path3.sep}`)) { + if (pattern === "." || pattern.startsWith(`.${path4.sep}`)) { pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1); - } else if (pattern === "~" || pattern.startsWith(`~${path3.sep}`)) { + } else if (pattern === "~" || pattern.startsWith(`~${path4.sep}`)) { homedir = homedir || os2.homedir(); (0, assert_1.default)(homedir, "Unable to determine HOME directory"); (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); @@ -68769,8 +66651,8 @@ var require_internal_search_state = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.SearchState = void 0; var SearchState = class { - constructor(path3, level) { - this.path = path3; + constructor(path4, level) { + this.path = path4; this.level = level; } }; @@ -68912,9 +66794,9 @@ var require_internal_globber = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultGlobber = void 0; var core12 = __importStar2(require_core()); - var fs = __importStar2(require("fs")); + var fs2 = __importStar2(require("fs")); var globOptionsHelper = __importStar2(require_internal_glob_options_helper()); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var patternHelper = __importStar2(require_internal_pattern_helper()); var internal_match_kind_1 = require_internal_match_kind(); var internal_pattern_1 = require_internal_pattern(); @@ -68966,7 +66848,7 @@ var require_internal_globber = __commonJS({ for (const searchPath of patternHelper.getSearchPaths(patterns)) { core12.debug(`Search path '${searchPath}'`); try { - yield __await2(fs.promises.lstat(searchPath)); + yield __await2(fs2.promises.lstat(searchPath)); } catch (err) { if (err.code === "ENOENT") { continue; @@ -68990,7 +66872,7 @@ var require_internal_globber = __commonJS({ if (!stats) { continue; } - if (options.excludeHiddenFiles && path3.basename(item.path).match(/^\./)) { + if (options.excludeHiddenFiles && path4.basename(item.path).match(/^\./)) { continue; } if (stats.isDirectory()) { @@ -69000,7 +66882,7 @@ var require_internal_globber = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await2(fs.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path3.join(item.path, x), childLevel)); + const childItems = (yield __await2(fs2.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path4.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match & internal_match_kind_1.MatchKind.File) { yield yield __await2(item.path); @@ -69035,7 +66917,7 @@ var require_internal_globber = __commonJS({ let stats; if (options.followSymbolicLinks) { try { - stats = yield fs.promises.stat(item.path); + stats = yield fs2.promises.stat(item.path); } catch (err) { if (err.code === "ENOENT") { if (options.omitBrokenSymbolicLinks) { @@ -69047,10 +66929,10 @@ var require_internal_globber = __commonJS({ throw err; } } else { - stats = yield fs.promises.lstat(item.path); + stats = yield fs2.promises.lstat(item.path); } if (stats.isDirectory() && options.followSymbolicLinks) { - const realPath = yield fs.promises.realpath(item.path); + const realPath = yield fs2.promises.realpath(item.path); while (traversalChain.length >= item.level) { traversalChain.pop(); } @@ -69159,10 +67041,10 @@ var require_internal_hash_files = __commonJS({ exports2.hashFiles = hashFiles; var crypto2 = __importStar2(require("crypto")); var core12 = __importStar2(require_core()); - var fs = __importStar2(require("fs")); + var fs2 = __importStar2(require("fs")); var stream = __importStar2(require("stream")); var util = __importStar2(require("util")); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); function hashFiles(globber_1, currentWorkspace_1) { return __awaiter2(this, arguments, void 0, function* (globber, currentWorkspace, verbose = false) { var _a, e_1, _b, _c; @@ -69178,17 +67060,17 @@ var require_internal_hash_files = __commonJS({ _e = false; const file = _c; writeDelegate(file); - if (!file.startsWith(`${githubWorkspace}${path3.sep}`)) { + if (!file.startsWith(`${githubWorkspace}${path4.sep}`)) { writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); continue; } - if (fs.statSync(file).isDirectory()) { + if (fs2.statSync(file).isDirectory()) { writeDelegate(`Skip directory '${file}'.`); continue; } const hash = crypto2.createHash("sha256"); const pipeline = util.promisify(stream.pipeline); - yield pipeline(fs.createReadStream(file), hash); + yield pipeline(fs2.createReadStream(file), hash); result.write(hash.digest()); count++; if (!hasMatch) { @@ -70563,8 +68445,8 @@ var require_cacheUtils = __commonJS({ var glob = __importStar2(require_glob()); var io4 = __importStar2(require_io()); var crypto2 = __importStar2(require("crypto")); - var fs = __importStar2(require("fs")); - var path3 = __importStar2(require("path")); + var fs2 = __importStar2(require("fs")); + var path4 = __importStar2(require("path")); var semver6 = __importStar2(require_semver3()); var util = __importStar2(require("util")); var constants_1 = require_constants12(); @@ -70584,15 +68466,15 @@ var require_cacheUtils = __commonJS({ baseLocation = "/home"; } } - tempDirectory = path3.join(baseLocation, "actions", "temp"); + tempDirectory = path4.join(baseLocation, "actions", "temp"); } - const dest = path3.join(tempDirectory, crypto2.randomUUID()); + const dest = path4.join(tempDirectory, crypto2.randomUUID()); yield io4.mkdirP(dest); return dest; }); } function getArchiveFileSizeInBytes(filePath) { - return fs.statSync(filePath).size; + return fs2.statSync(filePath).size; } function resolvePaths(patterns) { return __awaiter2(this, void 0, void 0, function* () { @@ -70608,7 +68490,7 @@ var require_cacheUtils = __commonJS({ _c = _g.value; _e = false; const file = _c; - const relativeFile = path3.relative(workspace, file).replace(new RegExp(`\\${path3.sep}`, "g"), "/"); + const relativeFile = path4.relative(workspace, file).replace(new RegExp(`\\${path4.sep}`, "g"), "/"); core12.debug(`Matched: ${relativeFile}`); if (relativeFile === "") { paths.push("."); @@ -70630,7 +68512,7 @@ var require_cacheUtils = __commonJS({ } function unlinkFile(filePath) { return __awaiter2(this, void 0, void 0, function* () { - return util.promisify(fs.unlink)(filePath); + return util.promisify(fs2.unlink)(filePath); }); } function getVersion(app_1) { @@ -70672,7 +68554,7 @@ var require_cacheUtils = __commonJS({ } function getGnuTarPathOnWindows() { return __awaiter2(this, void 0, void 0, function* () { - if (fs.existsSync(constants_1.GnuTarPathOnWindows)) { + if (fs2.existsSync(constants_1.GnuTarPathOnWindows)) { return constants_1.GnuTarPathOnWindows; } const versionOutput = yield getVersion("tar"); @@ -71135,13 +69017,13 @@ function __disposeResources(env) { } return next(); } -function __rewriteRelativeImportExtension(path3, preserveJsx) { - if (typeof path3 === "string" && /^\.\.?\//.test(path3)) { - return path3.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { +function __rewriteRelativeImportExtension(path4, preserveJsx) { + if (typeof path4 === "string" && /^\.\.?\//.test(path4)) { + return path4.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js"; }); } - return path3; + return path4; } var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default; var init_tslib_es6 = __esm({ @@ -71752,14 +69634,14 @@ var require_pipeline = __commonJS({ this._orderedPolicies = void 0; return removedPolicies; } - sendRequest(httpClient, request2) { + sendRequest(httpClient, request3) { const policies = this.getOrderedPolicies(); const pipeline = policies.reduceRight((next, policy) => { return (req) => { return policy.sendRequest(req, next); }; }, (req) => httpClient.sendRequest(req)); - return pipeline(request2); + return pipeline(request3); } getOrderedPolicies() { if (!this._orderedPolicies) { @@ -72256,11 +70138,11 @@ var require_nodeHttpClient = __commonJS({ * Makes a request over an underlying transport layer and returns the response. * @param request - The request to be made. */ - async sendRequest(request2) { + async sendRequest(request3) { const abortController = new AbortController(); let abortListener; - if (request2.abortSignal) { - if (request2.abortSignal.aborted) { + if (request3.abortSignal) { + if (request3.abortSignal.aborted) { throw new AbortError_js_1.AbortError("The operation was aborted. Request has already been canceled."); } abortListener = (event) => { @@ -72268,29 +70150,29 @@ var require_nodeHttpClient = __commonJS({ abortController.abort(); } }; - request2.abortSignal.addEventListener("abort", abortListener); + request3.abortSignal.addEventListener("abort", abortListener); } let timeoutId; - if (request2.timeout > 0) { + if (request3.timeout > 0) { timeoutId = setTimeout(() => { const sanitizer = new sanitizer_js_1.Sanitizer(); - log_js_1.logger.info(`request to '${sanitizer.sanitizeUrl(request2.url)}' timed out. canceling...`); + log_js_1.logger.info(`request to '${sanitizer.sanitizeUrl(request3.url)}' timed out. canceling...`); abortController.abort(); - }, request2.timeout); + }, request3.timeout); } - const acceptEncoding = request2.headers.get("Accept-Encoding"); + const acceptEncoding = request3.headers.get("Accept-Encoding"); const shouldDecompress = acceptEncoding?.includes("gzip") || acceptEncoding?.includes("deflate"); - let body = typeof request2.body === "function" ? request2.body() : request2.body; - if (body && !request2.headers.has("Content-Length")) { + let body = typeof request3.body === "function" ? request3.body() : request3.body; + if (body && !request3.headers.has("Content-Length")) { const bodyLength = getBodyLength(body); if (bodyLength !== null) { - request2.headers.set("Content-Length", bodyLength); + request3.headers.set("Content-Length", bodyLength); } } let responseStream; try { - if (body && request2.onUploadProgress) { - const onUploadProgress = request2.onUploadProgress; + if (body && request3.onUploadProgress) { + const onUploadProgress = request3.onUploadProgress; const uploadReportStream = new ReportTransform(onUploadProgress); uploadReportStream.on("error", (e) => { log_js_1.logger.error("Error in upload progress", e); @@ -72302,7 +70184,7 @@ var require_nodeHttpClient = __commonJS({ } body = uploadReportStream; } - const res = await this.makeRequest(request2, abortController, body); + const res = await this.makeRequest(request3, abortController, body); if (timeoutId !== void 0) { clearTimeout(timeoutId); } @@ -72311,14 +70193,14 @@ var require_nodeHttpClient = __commonJS({ const response = { status, headers, - request: request2 + request: request3 }; - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { res.resume(); return response; } responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res; - const onDownloadProgress = request2.onDownloadProgress; + const onDownloadProgress = request3.onDownloadProgress; if (onDownloadProgress) { const downloadReportStream = new ReportTransform(onDownloadProgress); downloadReportStream.on("error", (e) => { @@ -72329,7 +70211,7 @@ var require_nodeHttpClient = __commonJS({ } if ( // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code - request2.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) || request2.streamResponseStatusCodes?.has(response.status) + request3.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) || request3.streamResponseStatusCodes?.has(response.status) ) { response.readableStreamBody = responseStream; } else { @@ -72337,7 +70219,7 @@ var require_nodeHttpClient = __commonJS({ } return response; } finally { - if (request2.abortSignal && abortListener) { + if (request3.abortSignal && abortListener) { let uploadStreamDone = Promise.resolve(); if (isReadableStream(body)) { uploadStreamDone = isStreamComplete(body); @@ -72348,7 +70230,7 @@ var require_nodeHttpClient = __commonJS({ } Promise.all([uploadStreamDone, downloadStreamDone]).then(() => { if (abortListener) { - request2.abortSignal?.removeEventListener("abort", abortListener); + request3.abortSignal?.removeEventListener("abort", abortListener); } }).catch((e) => { log_js_1.logger.warning("Error when cleaning up abortListener on httpRequest", e); @@ -72356,26 +70238,26 @@ var require_nodeHttpClient = __commonJS({ } } } - makeRequest(request2, abortController, body) { - const url = new URL(request2.url); + makeRequest(request3, abortController, body) { + const url = new URL(request3.url); const isInsecure = url.protocol !== "https:"; - if (isInsecure && !request2.allowInsecureConnection) { - throw new Error(`Cannot connect to ${request2.url} while allowInsecureConnection is false.`); + if (isInsecure && !request3.allowInsecureConnection) { + throw new Error(`Cannot connect to ${request3.url} while allowInsecureConnection is false.`); } - const agent = request2.agent ?? this.getOrCreateAgent(request2, isInsecure); + const agent = request3.agent ?? this.getOrCreateAgent(request3, isInsecure); const options = { agent, hostname: url.hostname, path: `${url.pathname}${url.search}`, port: url.port, - method: request2.method, - headers: request2.headers.toJSON({ preserveCase: true }), - ...request2.requestOverrides + method: request3.method, + headers: request3.headers.toJSON({ preserveCase: true }), + ...request3.requestOverrides }; return new Promise((resolve2, reject) => { const req = isInsecure ? node_http_1.default.request(options, resolve2) : node_https_1.default.request(options, resolve2); req.once("error", (err) => { - reject(new restError_js_1.RestError(err.message, { code: err.code ?? restError_js_1.RestError.REQUEST_SEND_ERROR, request: request2 })); + reject(new restError_js_1.RestError(err.message, { code: err.code ?? restError_js_1.RestError.REQUEST_SEND_ERROR, request: request3 })); }); abortController.signal.addEventListener("abort", () => { const abortError = new AbortError_js_1.AbortError("The operation was aborted. Rejecting from abort signal callback while making request."); @@ -72398,8 +70280,8 @@ var require_nodeHttpClient = __commonJS({ } }); } - getOrCreateAgent(request2, isInsecure) { - const disableKeepAlive = request2.disableKeepAlive; + getOrCreateAgent(request3, isInsecure) { + const disableKeepAlive = request3.disableKeepAlive; if (isInsecure) { if (disableKeepAlive) { return node_http_1.default.globalAgent; @@ -72409,10 +70291,10 @@ var require_nodeHttpClient = __commonJS({ } return this.cachedHttpAgent; } else { - if (disableKeepAlive && !request2.tlsSettings) { + if (disableKeepAlive && !request3.tlsSettings) { return node_https_1.default.globalAgent; } - const tlsSettings = request2.tlsSettings ?? DEFAULT_TLS_SETTINGS; + const tlsSettings = request3.tlsSettings ?? DEFAULT_TLS_SETTINGS; let agent = this.cachedHttpsAgents.get(tlsSettings); if (agent && agent.options.keepAlive === !disableKeepAlive) { return agent; @@ -72532,12 +70414,12 @@ var require_logPolicy = __commonJS({ }); return { name: exports2.logPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (!logger.enabled) { - return next(request2); + return next(request3); } - logger(`Request: ${sanitizer.sanitize(request2)}`); - const response = await next(request2); + logger(`Request: ${sanitizer.sanitize(request3)}`); + const response = await next(request3); logger(`Response status code: ${response.status}`); logger(`Headers: ${sanitizer.sanitize(response.headers)}`); return response; @@ -72560,25 +70442,25 @@ var require_redirectPolicy = __commonJS({ const { maxRetries = 20 } = options; return { name: exports2.redirectPolicyName, - async sendRequest(request2, next) { - const response = await next(request2); + async sendRequest(request3, next) { + const response = await next(request3); return handleRedirect(next, response, maxRetries); } }; } async function handleRedirect(next, response, maxRetries, currentRetries = 0) { - const { request: request2, status, headers } = response; + const { request: request3, status, headers } = response; const locationHeader = headers.get("location"); - if (locationHeader && (status === 300 || status === 301 && allowedRedirect.includes(request2.method) || status === 302 && allowedRedirect.includes(request2.method) || status === 303 && request2.method === "POST" || status === 307) && currentRetries < maxRetries) { - const url = new URL(locationHeader, request2.url); - request2.url = url.toString(); + if (locationHeader && (status === 300 || status === 301 && allowedRedirect.includes(request3.method) || status === 302 && allowedRedirect.includes(request3.method) || status === 303 && request3.method === "POST" || status === 307) && currentRetries < maxRetries) { + const url = new URL(locationHeader, request3.url); + request3.url = url.toString(); if (status === 303) { - request2.method = "GET"; - request2.headers.delete("Content-Length"); - delete request2.body; + request3.method = "GET"; + request3.headers.delete("Content-Length"); + delete request3.body; } - request2.headers.delete("Authorization"); - const res = await next(request2); + request3.headers.delete("Authorization"); + const res = await next(request3); return handleRedirect(next, res, maxRetries, currentRetries + 1); } return response; @@ -72671,11 +70553,11 @@ var require_userAgentPolicy = __commonJS({ const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix); return { name: exports2.userAgentPolicyName, - async sendRequest(request2, next) { - if (!request2.headers.has(UserAgentHeaderName)) { - request2.headers.set(UserAgentHeaderName, await userAgentValue); + async sendRequest(request3, next) { + if (!request3.headers.has(UserAgentHeaderName)) { + request3.headers.set(UserAgentHeaderName, await userAgentValue); } - return next(request2); + return next(request3); } }; } @@ -72693,11 +70575,11 @@ var require_decompressResponsePolicy = __commonJS({ function decompressResponsePolicy() { return { name: exports2.decompressResponsePolicyName, - async sendRequest(request2, next) { - if (request2.method !== "HEAD") { - request2.headers.set("Accept-Encoding", "gzip,deflate"); + async sendRequest(request3, next) { + if (request3.method !== "HEAD") { + request3.headers.set("Accept-Encoding", "gzip,deflate"); } - return next(request2); + return next(request3); } }; } @@ -72736,7 +70618,7 @@ var require_delay = __commonJS({ }); // node_modules/@typespec/ts-http-runtime/dist/commonjs/util/helpers.js -var require_helpers2 = __commonJS({ +var require_helpers = __commonJS({ "node_modules/@typespec/ts-http-runtime/dist/commonjs/util/helpers.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -72794,7 +70676,7 @@ var require_throttlingRetryStrategy = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.isThrottlingRetryResponse = isThrottlingRetryResponse; exports2.throttlingRetryStrategy = throttlingRetryStrategy; - var helpers_js_1 = require_helpers2(); + var helpers_js_1 = require_helpers(); var RetryAfterHeader = "Retry-After"; var AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader]; function getRetryAfterInMs(response) { @@ -72892,7 +70774,7 @@ var require_retryPolicy = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.retryPolicy = retryPolicy; - var helpers_js_1 = require_helpers2(); + var helpers_js_1 = require_helpers(); var AbortError_js_1 = require_AbortError(); var logger_js_1 = require_logger(); var constants_js_1 = require_constants13(); @@ -72902,7 +70784,7 @@ var require_retryPolicy = __commonJS({ const logger = options.logger || retryPolicyLogger; return { name: retryPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { let response; let responseError; let retryCount = -1; @@ -72911,18 +70793,18 @@ var require_retryPolicy = __commonJS({ response = void 0; responseError = void 0; try { - logger.info(`Retry ${retryCount}: Attempting to send request`, request2.requestId); - response = await next(request2); - logger.info(`Retry ${retryCount}: Received a response from request`, request2.requestId); + logger.info(`Retry ${retryCount}: Attempting to send request`, request3.requestId); + response = await next(request3); + logger.info(`Retry ${retryCount}: Received a response from request`, request3.requestId); } catch (e) { - logger.error(`Retry ${retryCount}: Received an error from request`, request2.requestId); + logger.error(`Retry ${retryCount}: Received an error from request`, request3.requestId); responseError = e; if (!e || responseError.name !== "RestError") { throw e; } response = responseError.response; } - if (request2.abortSignal?.aborted) { + if (request3.abortSignal?.aborted) { logger.error(`Retry ${retryCount}: Request aborted.`); const abortError = new AbortError_js_1.AbortError(); throw abortError; @@ -72957,12 +70839,12 @@ var require_retryPolicy = __commonJS({ } if (retryAfterInMs || retryAfterInMs === 0) { strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`); - await (0, helpers_js_1.delay)(retryAfterInMs, void 0, { abortSignal: request2.abortSignal }); + await (0, helpers_js_1.delay)(retryAfterInMs, void 0, { abortSignal: request3.abortSignal }); continue retryRequest; } if (redirectTo) { strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`); - request2.url = redirectTo; + request3.url = redirectTo; continue retryRequest; } } @@ -73042,21 +70924,21 @@ var require_formDataPolicy = __commonJS({ function formDataPolicy() { return { name: exports2.formDataPolicyName, - async sendRequest(request2, next) { - if (checkEnvironment_js_1.isNodeLike && typeof FormData !== "undefined" && request2.body instanceof FormData) { - request2.formData = formDataToFormDataMap(request2.body); - request2.body = void 0; + async sendRequest(request3, next) { + if (checkEnvironment_js_1.isNodeLike && typeof FormData !== "undefined" && request3.body instanceof FormData) { + request3.formData = formDataToFormDataMap(request3.body); + request3.body = void 0; } - if (request2.formData) { - const contentType = request2.headers.get("Content-Type"); + if (request3.formData) { + const contentType = request3.headers.get("Content-Type"); if (contentType && contentType.indexOf("application/x-www-form-urlencoded") !== -1) { - request2.body = wwwFormUrlEncode(request2.formData); + request3.body = wwwFormUrlEncode(request3.formData); } else { - await prepareFormData(request2.formData, request2); + await prepareFormData(request3.formData, request3); } - request2.formData = void 0; + request3.formData = void 0; } - return next(request2); + return next(request3); } }; } @@ -73073,12 +70955,12 @@ var require_formDataPolicy = __commonJS({ } return urlSearchParams.toString(); } - async function prepareFormData(formData, request2) { - const contentType = request2.headers.get("Content-Type"); + async function prepareFormData(formData, request3) { + const contentType = request3.headers.get("Content-Type"); if (contentType && !contentType.startsWith("multipart/form-data")) { return; } - request2.headers.set("Content-Type", contentType ?? "multipart/form-data"); + request3.headers.set("Content-Type", contentType ?? "multipart/form-data"); const parts = []; for (const [fieldName, values] of Object.entries(formData)) { for (const value of Array.isArray(values) ? values : [values]) { @@ -73103,7 +70985,7 @@ var require_formDataPolicy = __commonJS({ } } } - request2.multipartBody = { parts }; + request3.multipartBody = { parts }; } } }); @@ -73872,7 +71754,7 @@ var require_src = __commonJS({ }); // node_modules/agent-base/dist/helpers.js -var require_helpers3 = __commonJS({ +var require_helpers2 = __commonJS({ "node_modules/agent-base/dist/helpers.js"(exports2) { "use strict"; var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { @@ -73905,7 +71787,7 @@ var require_helpers3 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.req = exports2.json = exports2.toBuffer = void 0; var http = __importStar2(require("http")); - var https = __importStar2(require("https")); + var https2 = __importStar2(require("https")); async function toBuffer(stream) { let length = 0; const chunks = []; @@ -73930,7 +71812,7 @@ var require_helpers3 = __commonJS({ exports2.json = json2; function req(url, opts = {}) { const href = typeof url === "string" ? url : url.href; - const req2 = (href.startsWith("https:") ? https : http).request(url, opts); + const req2 = (href.startsWith("https:") ? https2 : http).request(url, opts); const promise = new Promise((resolve2, reject) => { req2.once("response", resolve2).once("error", reject).end(); }); @@ -73980,7 +71862,7 @@ var require_dist = __commonJS({ var net = __importStar2(require("net")); var http = __importStar2(require("http")); var https_1 = require("https"); - __exportStar2(require_helpers3(), exports2); + __exportStar2(require_helpers2(), exports2); var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState"); var Agent = class extends http.Agent { constructor(opts) { @@ -74246,7 +72128,7 @@ var require_dist2 = __commonJS({ } return options; }; - var HttpsProxyAgent = class extends agent_base_1.Agent { + var HttpsProxyAgent2 = class extends agent_base_1.Agent { constructor(proxy, opts) { super(opts); this.options = { path: void 0 }; @@ -74325,8 +72207,8 @@ var require_dist2 = __commonJS({ return fakeSocket; } }; - HttpsProxyAgent.protocols = ["http", "https"]; - exports2.HttpsProxyAgent = HttpsProxyAgent; + HttpsProxyAgent2.protocols = ["http", "https"]; + exports2.HttpsProxyAgent = HttpsProxyAgent2; function resume(socket) { socket.resume(); } @@ -74581,26 +72463,26 @@ var require_proxyPolicy = __commonJS({ } return parsedProxyUrl; } - function setProxyAgentOnRequest(request2, cachedAgents, proxyUrl) { - if (request2.agent) { + function setProxyAgentOnRequest(request3, cachedAgents, proxyUrl) { + if (request3.agent) { return; } - const url = new URL(request2.url); + const url = new URL(request3.url); const isInsecure = url.protocol !== "https:"; - if (request2.tlsSettings) { + if (request3.tlsSettings) { log_js_1.logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored."); } - const headers = request2.headers.toJSON(); + const headers = request3.headers.toJSON(); if (isInsecure) { if (!cachedAgents.httpProxyAgent) { cachedAgents.httpProxyAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { headers }); } - request2.agent = cachedAgents.httpProxyAgent; + request3.agent = cachedAgents.httpProxyAgent; } else { if (!cachedAgents.httpsProxyAgent) { cachedAgents.httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { headers }); } - request2.agent = cachedAgents.httpsProxyAgent; + request3.agent = cachedAgents.httpsProxyAgent; } } function proxyPolicy(proxySettings, options) { @@ -74611,13 +72493,13 @@ var require_proxyPolicy = __commonJS({ const cachedAgents = {}; return { name: exports2.proxyPolicyName, - async sendRequest(request2, next) { - if (!request2.proxySettings && defaultProxy && !isBypassed(request2.url, options?.customNoProxyList ?? exports2.globalNoProxyList, options?.customNoProxyList ? void 0 : globalBypassedMap)) { - setProxyAgentOnRequest(request2, cachedAgents, defaultProxy); - } else if (request2.proxySettings) { - setProxyAgentOnRequest(request2, cachedAgents, getUrlFromProxySettings(request2.proxySettings)); + async sendRequest(request3, next) { + if (!request3.proxySettings && defaultProxy && !isBypassed(request3.url, options?.customNoProxyList ?? exports2.globalNoProxyList, options?.customNoProxyList ? void 0 : globalBypassedMap)) { + setProxyAgentOnRequest(request3, cachedAgents, defaultProxy); + } else if (request3.proxySettings) { + setProxyAgentOnRequest(request3, cachedAgents, getUrlFromProxySettings(request3.proxySettings)); } - return next(request2); + return next(request3); } }; } @@ -74801,7 +72683,7 @@ var require_multipartPolicy = __commonJS({ } return total; } - async function buildRequestBody(request2, parts, boundary) { + async function buildRequestBody(request3, parts, boundary) { const sources = [ (0, bytesEncoding_js_1.stringToUint8Array)(`--${boundary}`, "utf-8"), ...parts.flatMap((part) => [ @@ -74816,9 +72698,9 @@ var require_multipartPolicy = __commonJS({ ]; const contentLength = getTotalLength(sources); if (contentLength) { - request2.headers.set("Content-Length", contentLength); + request3.headers.set("Content-Length", contentLength); } - request2.body = await (0, concat_js_1.concat)(sources); + request3.body = await (0, concat_js_1.concat)(sources); } exports2.multipartPolicyName = "multipartPolicy"; var maxBoundaryLength = 70; @@ -74834,15 +72716,15 @@ var require_multipartPolicy = __commonJS({ function multipartPolicy() { return { name: exports2.multipartPolicyName, - async sendRequest(request2, next) { - if (!request2.multipartBody) { - return next(request2); + async sendRequest(request3, next) { + if (!request3.multipartBody) { + return next(request3); } - if (request2.body) { + if (request3.body) { throw new Error("multipartBody and regular body cannot be set at the same time"); } - let boundary = request2.multipartBody.boundary; - const contentTypeHeader = request2.headers.get("Content-Type") ?? "multipart/mixed"; + let boundary = request3.multipartBody.boundary; + const contentTypeHeader = request3.headers.get("Content-Type") ?? "multipart/mixed"; const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/); if (!parsedHeader) { throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`); @@ -74857,10 +72739,10 @@ var require_multipartPolicy = __commonJS({ } else { boundary = generateBoundary(); } - request2.headers.set("Content-Type", `${contentType}; boundary=${boundary}`); - await buildRequestBody(request2, request2.multipartBody.parts, boundary); - request2.multipartBody = void 0; - return next(request2); + request3.headers.set("Content-Type", `${contentType}; boundary=${boundary}`); + await buildRequestBody(request3, request3.multipartBody.parts, boundary); + request3.multipartBody = void 0; + return next(request3); } }; } @@ -74965,9 +72847,9 @@ var require_checkInsecureConnection = __commonJS({ exports2.ensureSecureConnection = ensureSecureConnection; var log_js_1 = require_log3(); var insecureConnectionWarningEmmitted = false; - function allowInsecureConnection(request2, options) { - if (options.allowInsecureConnection && request2.allowInsecureConnection) { - const url = new URL(request2.url); + function allowInsecureConnection(request3, options) { + if (options.allowInsecureConnection && request3.allowInsecureConnection) { + const url = new URL(request3.url); if (url.hostname === "localhost" || url.hostname === "127.0.0.1") { return true; } @@ -74982,9 +72864,9 @@ var require_checkInsecureConnection = __commonJS({ process.emitWarning(warning7); } } - function ensureSecureConnection(request2, options) { - if (!request2.url.toLowerCase().startsWith("https://")) { - if (allowInsecureConnection(request2, options)) { + function ensureSecureConnection(request3, options) { + if (!request3.url.toLowerCase().startsWith("https://")) { + if (allowInsecureConnection(request3, options)) { emitInsecureConnectionWarning(); } else { throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false."); @@ -75006,17 +72888,17 @@ var require_apiKeyAuthenticationPolicy = __commonJS({ function apiKeyAuthenticationPolicy(options) { return { name: exports2.apiKeyAuthenticationPolicyName, - async sendRequest(request2, next) { - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request2, options); - const scheme = (request2.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "apiKey"); + async sendRequest(request3, next) { + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request3, options); + const scheme = (request3.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "apiKey"); if (!scheme) { - return next(request2); + return next(request3); } if (scheme.apiKeyLocation !== "header") { throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`); } - request2.headers.set(scheme.name, options.credential.key); - return next(request2); + request3.headers.set(scheme.name, options.credential.key); + return next(request3); } }; } @@ -75036,16 +72918,16 @@ var require_basicAuthenticationPolicy = __commonJS({ function basicAuthenticationPolicy(options) { return { name: exports2.basicAuthenticationPolicyName, - async sendRequest(request2, next) { - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request2, options); - const scheme = (request2.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "basic"); + async sendRequest(request3, next) { + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request3, options); + const scheme = (request3.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "basic"); if (!scheme) { - return next(request2); + return next(request3); } const { username, password } = options.credential; const headerValue = (0, bytesEncoding_js_1.uint8ArrayToString)((0, bytesEncoding_js_1.stringToUint8Array)(`${username}:${password}`, "utf-8"), "base64"); - request2.headers.set("Authorization", `Basic ${headerValue}`); - return next(request2); + request3.headers.set("Authorization", `Basic ${headerValue}`); + return next(request3); } }; } @@ -75064,17 +72946,17 @@ var require_bearerAuthenticationPolicy = __commonJS({ function bearerAuthenticationPolicy(options) { return { name: exports2.bearerAuthenticationPolicyName, - async sendRequest(request2, next) { - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request2, options); - const scheme = (request2.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "bearer"); + async sendRequest(request3, next) { + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request3, options); + const scheme = (request3.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "bearer"); if (!scheme) { - return next(request2); + return next(request3); } const token = await options.credential.getBearerToken({ - abortSignal: request2.abortSignal + abortSignal: request3.abortSignal }); - request2.headers.set("Authorization", `Bearer ${token}`); - return next(request2); + request3.headers.set("Authorization", `Bearer ${token}`); + return next(request3); } }; } @@ -75093,17 +72975,17 @@ var require_oauth2AuthenticationPolicy = __commonJS({ function oauth2AuthenticationPolicy(options) { return { name: exports2.oauth2AuthenticationPolicyName, - async sendRequest(request2, next) { - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request2, options); - const scheme = (request2.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "oauth2"); + async sendRequest(request3, next) { + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request3, options); + const scheme = (request3.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "oauth2"); if (!scheme) { - return next(request2); + return next(request3); } const token = await options.credential.getOAuth2Token(scheme.flows, { - abortSignal: request2.abortSignal + abortSignal: request3.abortSignal }); - request2.headers.set("Authorization", `Bearer ${token}`); - return next(request2); + request3.headers.set("Authorization", `Bearer ${token}`); + return next(request3); } }; } @@ -75279,18 +73161,18 @@ var require_sendRequest = __commonJS({ var multipart_js_1 = require_multipart(); async function sendRequest(method, url, pipeline, options = {}, customHttpClient) { const httpClient = customHttpClient ?? (0, clientHelpers_js_1.getCachedDefaultHttpsClient)(); - const request2 = buildPipelineRequest(method, url, options); + const request3 = buildPipelineRequest(method, url, options); try { - const response = await pipeline.sendRequest(httpClient, request2); + const response = await pipeline.sendRequest(httpClient, request3); const headers = response.headers.toJSON(); const stream = response.readableStreamBody ?? response.browserStreamBody; const parsedBody = options.responseAsStream || stream !== void 0 ? void 0 : getResponseBody(response); const body = stream ?? parsedBody; if (options?.onResponse) { - options.onResponse({ ...response, request: request2, rawHeaders: headers, parsedBody }); + options.onResponse({ ...response, request: request3, rawHeaders: headers, parsedBody }); } return { - request: request2, + request: request3, headers, status: `${response.status}`, body @@ -75299,7 +73181,7 @@ var require_sendRequest = __commonJS({ if ((0, restError_js_1.isRestError)(e) && e.response && options.onResponse) { const { response } = e; const rawHeaders = response.headers.toJSON(); - options?.onResponse({ ...response, request: request2, rawHeaders }, e); + options?.onResponse({ ...response, request: request3, rawHeaders }, e); } throw e; } @@ -75555,8 +73437,8 @@ var require_getClient = __commonJS({ } const { allowInsecureConnection, httpClient } = clientOptions; const endpointUrl = clientOptions.endpoint ?? endpoint2; - const client = (path3, ...args) => { - const getUrl = (requestOptions) => (0, urlHelpers_js_1.buildRequestUrl)(endpointUrl, path3, args, { allowInsecureConnection, ...requestOptions }); + const client = (path4, ...args) => { + const getUrl = (requestOptions) => (0, urlHelpers_js_1.buildRequestUrl)(endpointUrl, path4, args, { allowInsecureConnection, ...requestOptions }); return { get: (requestOptions = {}) => { return buildOperation("GET", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); @@ -76103,11 +73985,11 @@ var require_userAgentPolicy2 = __commonJS({ const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix); return { name: exports2.userAgentPolicyName, - async sendRequest(request2, next) { - if (!request2.headers.has(UserAgentHeaderName)) { - request2.headers.set(UserAgentHeaderName, await userAgentValue); + async sendRequest(request3, next) { + if (!request3.headers.has(UserAgentHeaderName)) { + request3.headers.set(UserAgentHeaderName, await userAgentValue); } - return next(request2); + return next(request3); } }; } @@ -76555,15 +74437,15 @@ var require_multipartPolicy2 = __commonJS({ const tspPolicy = (0, policies_1.multipartPolicy)(); return { name: exports2.multipartPolicyName, - sendRequest: async (request2, next) => { - if (request2.multipartBody) { - for (const part of request2.multipartBody.parts) { + sendRequest: async (request3, next) => { + if (request3.multipartBody) { + for (const part of request3.multipartBody.parts) { if ((0, file_js_1.hasRawContent)(part.body)) { part.body = (0, file_js_1.getRawContent)(part.body); } } } - return tspPolicy.sendRequest(request2, next); + return tspPolicy.sendRequest(request3, next); } }; } @@ -76645,11 +74527,11 @@ var require_setClientRequestIdPolicy = __commonJS({ function setClientRequestIdPolicy(requestIdHeaderName = "x-ms-client-request-id") { return { name: exports2.setClientRequestIdPolicyName, - async sendRequest(request2, next) { - if (!request2.headers.has(requestIdHeaderName)) { - request2.headers.set(requestIdHeaderName, request2.requestId); + async sendRequest(request3, next) { + if (!request3.headers.has(requestIdHeaderName)) { + request3.headers.set(requestIdHeaderName, request3.requestId); } - return next(request2); + return next(request3); } }; } @@ -76918,26 +74800,26 @@ var require_tracingPolicy = __commonJS({ const tracingClient = tryCreateTracingClient(); return { name: exports2.tracingPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (!tracingClient) { - return next(request2); + return next(request3); } const userAgent2 = await userAgentPromise; const spanAttributes = { - "http.url": sanitizer.sanitizeUrl(request2.url), - "http.method": request2.method, + "http.url": sanitizer.sanitizeUrl(request3.url), + "http.method": request3.method, "http.user_agent": userAgent2, - requestId: request2.requestId + requestId: request3.requestId }; if (userAgent2) { spanAttributes["http.user_agent"] = userAgent2; } - const { span, tracingContext } = tryCreateSpan(tracingClient, request2, spanAttributes) ?? {}; + const { span, tracingContext } = tryCreateSpan(tracingClient, request3, spanAttributes) ?? {}; if (!span || !tracingContext) { - return next(request2); + return next(request3); } try { - const response = await tracingClient.withContext(tracingContext, next, request2); + const response = await tracingClient.withContext(tracingContext, next, request3); tryProcessResponse(span, response); return response; } catch (err) { @@ -76959,9 +74841,9 @@ var require_tracingPolicy = __commonJS({ return void 0; } } - function tryCreateSpan(tracingClient, request2, spanAttributes) { + function tryCreateSpan(tracingClient, request3, spanAttributes) { try { - const { span, updatedOptions } = tracingClient.startSpan(`HTTP ${request2.method}`, { tracingOptions: request2.tracingOptions }, { + const { span, updatedOptions } = tracingClient.startSpan(`HTTP ${request3.method}`, { tracingOptions: request3.tracingOptions }, { spanKind: "client", spanAttributes }); @@ -76971,7 +74853,7 @@ var require_tracingPolicy = __commonJS({ } const headers = tracingClient.createRequestHeaders(updatedOptions.tracingOptions.tracingContext); for (const [key, value] of Object.entries(headers)) { - request2.headers.set(key, value); + request3.headers.set(key, value); } return { span, tracingContext: updatedOptions.tracingOptions.tracingContext }; } catch (e) { @@ -77056,14 +74938,14 @@ var require_wrapAbortSignalLikePolicy = __commonJS({ function wrapAbortSignalLikePolicy() { return { name: exports2.wrapAbortSignalLikePolicyName, - sendRequest: async (request2, next) => { - if (!request2.abortSignal) { - return next(request2); + sendRequest: async (request3, next) => { + if (!request3.abortSignal) { + return next(request3); } - const { abortSignal, cleanup } = (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request2.abortSignal); - request2.abortSignal = abortSignal; + const { abortSignal, cleanup } = (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request3.abortSignal); + request3.abortSignal = abortSignal; try { - return await next(request2); + return await next(request3); } finally { cleanup?.(); } @@ -77135,11 +75017,11 @@ var require_defaultHttpClient2 = __commonJS({ function createDefaultHttpClient() { const client = (0, ts_http_runtime_1.createDefaultHttpClient)(); return { - async sendRequest(request2) { - const { abortSignal, cleanup } = request2.abortSignal ? (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request2.abortSignal) : {}; + async sendRequest(request3) { + const { abortSignal, cleanup } = request3.abortSignal ? (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request3.abortSignal) : {}; try { - request2.abortSignal = abortSignal; - return await client.sendRequest(request2); + request3.abortSignal = abortSignal; + return await client.sendRequest(request3); } finally { cleanup?.(); } @@ -77367,9 +75249,9 @@ var require_bearerTokenAuthenticationPolicy = __commonJS({ var log_js_1 = require_log4(); var restError_js_1 = require_restError3(); exports2.bearerTokenAuthenticationPolicyName = "bearerTokenAuthenticationPolicy"; - async function trySendRequest(request2, next) { + async function trySendRequest(request3, next) { try { - return [await next(request2), void 0]; + return [await next(request3), void 0]; } catch (e) { if ((0, restError_js_1.isRestError)(e) && e.response) { return [e.response, e]; @@ -77379,10 +75261,10 @@ var require_bearerTokenAuthenticationPolicy = __commonJS({ } } async function defaultAuthorizeRequest(options) { - const { scopes, getAccessToken, request: request2 } = options; + const { scopes, getAccessToken, request: request3 } = options; const getTokenOptions = { - abortSignal: request2.abortSignal, - tracingOptions: request2.tracingOptions, + abortSignal: request3.abortSignal, + tracingOptions: request3.tracingOptions, enableCae: true }; const accessToken = await getAccessToken(scopes, getTokenOptions); @@ -77431,20 +75313,20 @@ var require_bearerTokenAuthenticationPolicy = __commonJS({ * - Process a challenge if the response contains it. * - Retrieve a token with the challenge information, then re-send the request. */ - async sendRequest(request2, next) { - if (!request2.url.toLowerCase().startsWith("https://")) { + async sendRequest(request3, next) { + if (!request3.url.toLowerCase().startsWith("https://")) { throw new Error("Bearer token authentication is not permitted for non-TLS protected (non-https) URLs."); } await callbacks.authorizeRequest({ scopes: Array.isArray(scopes) ? scopes : [scopes], - request: request2, + request: request3, getAccessToken, logger }); let response; let error3; let shouldSendRequest; - [response, error3] = await trySendRequest(request2, next); + [response, error3] = await trySendRequest(request3, next); if (isChallengeResponse(response)) { let claims = getCaeChallengeClaims(response.headers.get("WWW-Authenticate")); if (claims) { @@ -77458,23 +75340,23 @@ var require_bearerTokenAuthenticationPolicy = __commonJS({ shouldSendRequest = await authorizeRequestOnCaeChallenge({ scopes: Array.isArray(scopes) ? scopes : [scopes], response, - request: request2, + request: request3, getAccessToken, logger }, parsedClaim); if (shouldSendRequest) { - [response, error3] = await trySendRequest(request2, next); + [response, error3] = await trySendRequest(request3, next); } } else if (callbacks.authorizeRequestOnChallenge) { shouldSendRequest = await callbacks.authorizeRequestOnChallenge({ scopes: Array.isArray(scopes) ? scopes : [scopes], - request: request2, + request: request3, response, getAccessToken, logger }); if (shouldSendRequest) { - [response, error3] = await trySendRequest(request2, next); + [response, error3] = await trySendRequest(request3, next); } if (isChallengeResponse(response)) { claims = getCaeChallengeClaims(response.headers.get("WWW-Authenticate")); @@ -77489,12 +75371,12 @@ var require_bearerTokenAuthenticationPolicy = __commonJS({ shouldSendRequest = await authorizeRequestOnCaeChallenge({ scopes: Array.isArray(scopes) ? scopes : [scopes], response, - request: request2, + request: request3, getAccessToken, logger }, parsedClaim); if (shouldSendRequest) { - [response, error3] = await trySendRequest(request2, next); + [response, error3] = await trySendRequest(request3, next); } } } @@ -77546,14 +75428,14 @@ var require_ndJsonPolicy = __commonJS({ function ndJsonPolicy() { return { name: exports2.ndJsonPolicyName, - async sendRequest(request2, next) { - if (typeof request2.body === "string" && request2.body.startsWith("[")) { - const body = JSON.parse(request2.body); + async sendRequest(request3, next) { + if (typeof request3.body === "string" && request3.body.startsWith("[")) { + const body = JSON.parse(request3.body); if (Array.isArray(body)) { - request2.body = body.map((item) => JSON.stringify(item) + "\n").join(""); + request3.body = body.map((item) => JSON.stringify(item) + "\n").join(""); } } - return next(request2); + return next(request3); } }; } @@ -77572,10 +75454,10 @@ var require_auxiliaryAuthenticationHeaderPolicy = __commonJS({ exports2.auxiliaryAuthenticationHeaderPolicyName = "auxiliaryAuthenticationHeaderPolicy"; var AUTHORIZATION_AUXILIARY_HEADER = "x-ms-authorization-auxiliary"; async function sendAuthorizeRequest(options) { - const { scopes, getAccessToken, request: request2 } = options; + const { scopes, getAccessToken, request: request3 } = options; const getTokenOptions = { - abortSignal: request2.abortSignal, - tracingOptions: request2.tracingOptions + abortSignal: request3.abortSignal, + tracingOptions: request3.tracingOptions }; return (await getAccessToken(scopes, getTokenOptions))?.token ?? ""; } @@ -77585,13 +75467,13 @@ var require_auxiliaryAuthenticationHeaderPolicy = __commonJS({ const tokenCyclerMap = /* @__PURE__ */ new WeakMap(); return { name: exports2.auxiliaryAuthenticationHeaderPolicyName, - async sendRequest(request2, next) { - if (!request2.url.toLowerCase().startsWith("https://")) { + async sendRequest(request3, next) { + if (!request3.url.toLowerCase().startsWith("https://")) { throw new Error("Bearer token authentication for auxiliary header is not permitted for non-TLS protected (non-https) URLs."); } if (!credentials || credentials.length === 0) { logger.info(`${exports2.auxiliaryAuthenticationHeaderPolicyName} header will not be set due to empty credentials.`); - return next(request2); + return next(request3); } const tokenPromises = []; for (const credential of credentials) { @@ -77602,7 +75484,7 @@ var require_auxiliaryAuthenticationHeaderPolicy = __commonJS({ } tokenPromises.push(sendAuthorizeRequest({ scopes: Array.isArray(scopes) ? scopes : [scopes], - request: request2, + request: request3, getAccessToken, logger })); @@ -77610,10 +75492,10 @@ var require_auxiliaryAuthenticationHeaderPolicy = __commonJS({ const auxiliaryTokens = (await Promise.all(tokenPromises)).filter((token) => Boolean(token)); if (auxiliaryTokens.length === 0) { logger.warning(`None of the auxiliary tokens are valid. ${AUTHORIZATION_AUXILIARY_HEADER} header will not be set.`); - return next(request2); + return next(request3); } - request2.headers.set(AUTHORIZATION_AUXILIARY_HEADER, auxiliaryTokens.map((token) => `Bearer ${token}`).join(", ")); - return next(request2); + request3.headers.set(AUTHORIZATION_AUXILIARY_HEADER, auxiliaryTokens.map((token) => `Bearer ${token}`).join(", ")); + return next(request3); } }; } @@ -78027,9 +75909,9 @@ var require_disableKeepAlivePolicy = __commonJS({ function createDisableKeepAlivePolicy() { return { name: exports2.disableKeepAlivePolicyName, - async sendRequest(request2, next) { - request2.disableKeepAlive = true; - return next(request2); + async sendRequest(request3, next) { + request3.disableKeepAlive = true; + return next(request3); } }; } @@ -78985,17 +76867,17 @@ var require_operationHelpers = __commonJS({ return result; } var originalRequestSymbol = /* @__PURE__ */ Symbol.for("@azure/core-client original request"); - function hasOriginalRequest(request2) { - return originalRequestSymbol in request2; + function hasOriginalRequest(request3) { + return originalRequestSymbol in request3; } - function getOperationRequestInfo(request2) { - if (hasOriginalRequest(request2)) { - return getOperationRequestInfo(request2[originalRequestSymbol]); + function getOperationRequestInfo(request3) { + if (hasOriginalRequest(request3)) { + return getOperationRequestInfo(request3[originalRequestSymbol]); } - let info6 = state_js_1.state.operationRequestMap.get(request2); + let info6 = state_js_1.state.operationRequestMap.get(request3); if (!info6) { info6 = {}; - state_js_1.state.operationRequestMap.set(request2, info6); + state_js_1.state.operationRequestMap.set(request3, info6); } return info6; } @@ -79030,16 +76912,16 @@ var require_deserializationPolicy = __commonJS({ }; return { name: exports2.deserializationPolicyName, - async sendRequest(request2, next) { - const response = await next(request2); + async sendRequest(request3, next) { + const response = await next(request3); return deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, updatedOptions, parseXML); } }; } function getOperationResponseMap(parsedResponse) { let result; - const request2 = parsedResponse.request; - const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request2); + const request3 = parsedResponse.request; + const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request3); const operationSpec = operationInfo?.operationSpec; if (operationSpec) { if (!operationInfo?.operationResponseGetter) { @@ -79051,8 +76933,8 @@ var require_deserializationPolicy = __commonJS({ return result; } function shouldDeserializeResponse(parsedResponse) { - const request2 = parsedResponse.request; - const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request2); + const request3 = parsedResponse.request; + const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request3); const shouldDeserialize = operationInfo?.shouldDeserialize; let result; if (shouldDeserialize === void 0) { @@ -79251,19 +77133,19 @@ var require_serializationPolicy = __commonJS({ const stringifyXML = options.stringifyXML; return { name: exports2.serializationPolicyName, - async sendRequest(request2, next) { - const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request2); + async sendRequest(request3, next) { + const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request3); const operationSpec = operationInfo?.operationSpec; const operationArguments = operationInfo?.operationArguments; if (operationSpec && operationArguments) { - serializeHeaders(request2, operationArguments, operationSpec); - serializeRequestBody(request2, operationArguments, operationSpec, stringifyXML); + serializeHeaders(request3, operationArguments, operationSpec); + serializeRequestBody(request3, operationArguments, operationSpec, stringifyXML); } - return next(request2); + return next(request3); } }; } - function serializeHeaders(request2, operationArguments, operationSpec) { + function serializeHeaders(request3, operationArguments, operationSpec) { if (operationSpec.headerParameters) { for (const headerParameter of operationSpec.headerParameters) { let headerValue = (0, operationHelpers_js_1.getOperationArgumentValueFromParameter)(operationArguments, headerParameter); @@ -79272,10 +77154,10 @@ var require_serializationPolicy = __commonJS({ const headerCollectionPrefix = headerParameter.mapper.headerCollectionPrefix; if (headerCollectionPrefix) { for (const key of Object.keys(headerValue)) { - request2.headers.set(headerCollectionPrefix + key, headerValue[key]); + request3.headers.set(headerCollectionPrefix + key, headerValue[key]); } } else { - request2.headers.set(headerParameter.mapper.serializedName || (0, interfaceHelpers_js_1.getPathStringFromParameter)(headerParameter), headerValue); + request3.headers.set(headerParameter.mapper.serializedName || (0, interfaceHelpers_js_1.getPathStringFromParameter)(headerParameter), headerValue); } } } @@ -79283,11 +77165,11 @@ var require_serializationPolicy = __commonJS({ const customHeaders = operationArguments.options?.requestOptions?.customHeaders; if (customHeaders) { for (const customHeaderName of Object.keys(customHeaders)) { - request2.headers.set(customHeaderName, customHeaders[customHeaderName]); + request3.headers.set(customHeaderName, customHeaders[customHeaderName]); } } } - function serializeRequestBody(request2, operationArguments, operationSpec, stringifyXML = function() { + function serializeRequestBody(request3, operationArguments, operationSpec, stringifyXML = function() { throw new Error("XML serialization unsupported!"); }) { const serializerOptions = operationArguments.options?.serializerOptions; @@ -79300,22 +77182,22 @@ var require_serializationPolicy = __commonJS({ }; const xmlCharKey = updatedOptions.xml.xmlCharKey; if (operationSpec.requestBody && operationSpec.requestBody.mapper) { - request2.body = (0, operationHelpers_js_1.getOperationArgumentValueFromParameter)(operationArguments, operationSpec.requestBody); + request3.body = (0, operationHelpers_js_1.getOperationArgumentValueFromParameter)(operationArguments, operationSpec.requestBody); const bodyMapper = operationSpec.requestBody.mapper; const { required, serializedName, xmlName, xmlElementName, xmlNamespace, xmlNamespacePrefix, nullable } = bodyMapper; const typeName = bodyMapper.type.name; try { - if (request2.body !== void 0 && request2.body !== null || nullable && request2.body === null || required) { + if (request3.body !== void 0 && request3.body !== null || nullable && request3.body === null || required) { const requestBodyParameterPathString = (0, interfaceHelpers_js_1.getPathStringFromParameter)(operationSpec.requestBody); - request2.body = operationSpec.serializer.serialize(bodyMapper, request2.body, requestBodyParameterPathString, updatedOptions); + request3.body = operationSpec.serializer.serialize(bodyMapper, request3.body, requestBodyParameterPathString, updatedOptions); const isStream = typeName === serializer_js_1.MapperTypeNames.Stream; if (operationSpec.isXML) { const xmlnsKey = xmlNamespacePrefix ? `xmlns:${xmlNamespacePrefix}` : "xmlns"; - const value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, request2.body, updatedOptions); + const value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, request3.body, updatedOptions); if (typeName === serializer_js_1.MapperTypeNames.Sequence) { - request2.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { rootName: xmlName || serializedName, xmlCharKey }); + request3.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { rootName: xmlName || serializedName, xmlCharKey }); } else if (!isStream) { - request2.body = stringifyXML(value, { + request3.body = stringifyXML(value, { rootName: xmlName || serializedName, xmlCharKey }); @@ -79323,19 +77205,19 @@ var require_serializationPolicy = __commonJS({ } else if (typeName === serializer_js_1.MapperTypeNames.String && (operationSpec.contentType?.match("text/plain") || operationSpec.mediaType === "text")) { return; } else if (!isStream) { - request2.body = JSON.stringify(request2.body); + request3.body = JSON.stringify(request3.body); } } } catch (error3) { throw new Error(`Error "${error3.message}" occurred in serializing the payload - ${JSON.stringify(serializedName, void 0, " ")}.`); } } else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) { - request2.formData = {}; + request3.formData = {}; for (const formDataParameter of operationSpec.formDataParameters) { const formDataParameterValue = (0, operationHelpers_js_1.getOperationArgumentValueFromParameter)(operationArguments, formDataParameter); if (formDataParameterValue !== void 0 && formDataParameterValue !== null) { const formDataParameterPropertyName = formDataParameter.mapper.serializedName || (0, interfaceHelpers_js_1.getPathStringFromParameter)(formDataParameter); - request2.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, (0, interfaceHelpers_js_1.getPathStringFromParameter)(formDataParameter), updatedOptions); + request3.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, (0, interfaceHelpers_js_1.getPathStringFromParameter)(formDataParameter), updatedOptions); } } } @@ -79427,15 +77309,15 @@ var require_urlHelpers2 = __commonJS({ let isAbsolutePath = false; let requestUrl = replaceAll(baseUri, urlReplacements); if (operationSpec.path) { - let path3 = replaceAll(operationSpec.path, urlReplacements); - if (operationSpec.path === "/{nextLink}" && path3.startsWith("/")) { - path3 = path3.substring(1); + let path4 = replaceAll(operationSpec.path, urlReplacements); + if (operationSpec.path === "/{nextLink}" && path4.startsWith("/")) { + path4 = path4.substring(1); } - if (isAbsoluteUrl(path3)) { - requestUrl = path3; + if (isAbsoluteUrl(path4)) { + requestUrl = path4; isAbsolutePath = true; } else { - requestUrl = appendPath(requestUrl, path3); + requestUrl = appendPath(requestUrl, path4); } } const { queryParams, sequenceParams } = calculateQueryParameters(operationSpec, operationArguments, fallbackObject); @@ -79481,9 +77363,9 @@ var require_urlHelpers2 = __commonJS({ } const searchStart = pathToAppend.indexOf("?"); if (searchStart !== -1) { - const path3 = pathToAppend.substring(0, searchStart); + const path4 = pathToAppend.substring(0, searchStart); const search = pathToAppend.substring(searchStart + 1); - newPath = newPath + path3; + newPath = newPath + path4; if (search) { parsedUrl.search = parsedUrl.search ? `${parsedUrl.search}&${search}` : search; } @@ -79681,8 +77563,8 @@ var require_serviceClient = __commonJS({ /** * Send the provided httpRequest. */ - async sendRequest(request2) { - return this.pipeline.sendRequest(this._httpClient, request2); + async sendRequest(request3) { + return this.pipeline.sendRequest(this._httpClient, request3); } /** * Send an HTTP request that is populated using the provided OperationSpec. @@ -79696,52 +77578,52 @@ var require_serviceClient = __commonJS({ throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use."); } const url = (0, urlHelpers_js_1.getRequestUrl)(endpoint2, operationSpec, operationArguments, this); - const request2 = (0, core_rest_pipeline_1.createPipelineRequest)({ + const request3 = (0, core_rest_pipeline_1.createPipelineRequest)({ url }); - request2.method = operationSpec.httpMethod; - const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request2); + request3.method = operationSpec.httpMethod; + const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request3); operationInfo.operationSpec = operationSpec; operationInfo.operationArguments = operationArguments; const contentType = operationSpec.contentType || this._requestContentType; if (contentType && operationSpec.requestBody) { - request2.headers.set("Content-Type", contentType); + request3.headers.set("Content-Type", contentType); } const options = operationArguments.options; if (options) { const requestOptions = options.requestOptions; if (requestOptions) { if (requestOptions.timeout) { - request2.timeout = requestOptions.timeout; + request3.timeout = requestOptions.timeout; } if (requestOptions.onUploadProgress) { - request2.onUploadProgress = requestOptions.onUploadProgress; + request3.onUploadProgress = requestOptions.onUploadProgress; } if (requestOptions.onDownloadProgress) { - request2.onDownloadProgress = requestOptions.onDownloadProgress; + request3.onDownloadProgress = requestOptions.onDownloadProgress; } if (requestOptions.shouldDeserialize !== void 0) { operationInfo.shouldDeserialize = requestOptions.shouldDeserialize; } if (requestOptions.allowInsecureConnection) { - request2.allowInsecureConnection = true; + request3.allowInsecureConnection = true; } } if (options.abortSignal) { - request2.abortSignal = options.abortSignal; + request3.abortSignal = options.abortSignal; } if (options.tracingOptions) { - request2.tracingOptions = options.tracingOptions; + request3.tracingOptions = options.tracingOptions; } } if (this._allowInsecureConnection) { - request2.allowInsecureConnection = true; + request3.allowInsecureConnection = true; } - if (request2.streamResponseStatusCodes === void 0) { - request2.streamResponseStatusCodes = (0, interfaceHelpers_js_1.getStreamingResponseStatusCodes)(operationSpec); + if (request3.streamResponseStatusCodes === void 0) { + request3.streamResponseStatusCodes = (0, interfaceHelpers_js_1.getStreamingResponseStatusCodes)(operationSpec); } try { - const rawResponse = await this.sendRequest(request2); + const rawResponse = await this.sendRequest(request3); const flatResponse = (0, utils_js_1.flattenResponse)(rawResponse, operationSpec.responses[rawResponse.status]); if (options?.onResponse) { options.onResponse(rawResponse, flatResponse); @@ -79908,13 +77790,13 @@ var require_authorizeRequestOnTenantChallenge = __commonJS({ const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split("="))); return keyValuePairs.reduce((a, b) => ({ ...a, ...b }), {}); } - function requestToOptions(request2) { + function requestToOptions(request3) { return { - abortSignal: request2.abortSignal, + abortSignal: request3.abortSignal, requestOptions: { - timeout: request2.timeout + timeout: request3.timeout }, - tracingOptions: request2.tracingOptions + tracingOptions: request3.tracingOptions }; } } @@ -79987,11 +77869,11 @@ var require_util18 = __commonJS({ var originalClientRequestSymbol = /* @__PURE__ */ Symbol.for("@azure/core-client original request"); function toPipelineRequest(webResource, options = {}) { const compatWebResource = webResource; - const request2 = compatWebResource[originalRequestSymbol]; + const request3 = compatWebResource[originalRequestSymbol]; const headers = (0, core_rest_pipeline_1.createHttpHeaders)(webResource.headers.toJson({ preserveCase: true })); - if (request2) { - request2.headers = headers; - return request2; + if (request3) { + request3.headers = headers; + return request3; } else { const newRequest = (0, core_rest_pipeline_1.createPipelineRequest)({ url: webResource.url, @@ -80017,25 +77899,25 @@ var require_util18 = __commonJS({ return newRequest; } } - function toWebResourceLike(request2, options) { - const originalRequest = options?.originalRequest ?? request2; + function toWebResourceLike(request3, options) { + const originalRequest = options?.originalRequest ?? request3; const webResource = { - url: request2.url, - method: request2.method, - headers: toHttpHeadersLike(request2.headers), - withCredentials: request2.withCredentials, - timeout: request2.timeout, - requestId: request2.headers.get("x-ms-client-request-id") || request2.requestId, - abortSignal: request2.abortSignal, - body: request2.body, - formData: request2.formData, - keepAlive: !!request2.disableKeepAlive, - onDownloadProgress: request2.onDownloadProgress, - onUploadProgress: request2.onUploadProgress, - proxySettings: request2.proxySettings, - streamResponseStatusCodes: request2.streamResponseStatusCodes, - agent: request2.agent, - requestOverrides: request2.requestOverrides, + url: request3.url, + method: request3.method, + headers: toHttpHeadersLike(request3.headers), + withCredentials: request3.withCredentials, + timeout: request3.timeout, + requestId: request3.headers.get("x-ms-client-request-id") || request3.requestId, + abortSignal: request3.abortSignal, + body: request3.body, + formData: request3.formData, + keepAlive: !!request3.disableKeepAlive, + onDownloadProgress: request3.onDownloadProgress, + onUploadProgress: request3.onUploadProgress, + proxySettings: request3.proxySettings, + streamResponseStatusCodes: request3.streamResponseStatusCodes, + agent: request3.agent, + requestOverrides: request3.requestOverrides, clone() { throw new Error("Cannot clone a non-proxied WebResourceLike"); }, @@ -80049,7 +77931,7 @@ var require_util18 = __commonJS({ return new Proxy(webResource, { get(target, prop, receiver) { if (prop === originalRequestSymbol) { - return request2; + return request3; } else if (prop === "clone") { return () => { return toWebResourceLike(toPipelineRequest(webResource, { originalRequest }), { @@ -80062,7 +77944,7 @@ var require_util18 = __commonJS({ }, set(target, prop, value, receiver) { if (prop === "keepAlive") { - request2.disableKeepAlive = !value; + request3.disableKeepAlive = !value; } const passThroughProps = [ "url", @@ -80081,7 +77963,7 @@ var require_util18 = __commonJS({ "requestOverrides" ]; if (typeof prop === "string" && passThroughProps.includes(prop)) { - request2[prop] = value; + request3[prop] = value; } return Reflect.set(target, prop, value, receiver); } @@ -80232,7 +78114,7 @@ var require_response3 = __commonJS({ var util_js_1 = require_util18(); var originalResponse = /* @__PURE__ */ Symbol("Original FullOperationResponse"); function toCompatResponse(response, options) { - let request2 = (0, util_js_1.toWebResourceLike)(response.request); + let request3 = (0, util_js_1.toWebResourceLike)(response.request); let headers = (0, util_js_1.toHttpHeadersLike)(response.headers); if (options?.createProxy) { return new Proxy(response, { @@ -80240,7 +78122,7 @@ var require_response3 = __commonJS({ if (prop === "headers") { return headers; } else if (prop === "request") { - return request2; + return request3; } else if (prop === originalResponse) { return response; } @@ -80250,7 +78132,7 @@ var require_response3 = __commonJS({ if (prop === "headers") { headers = value; } else if (prop === "request") { - request2 = value; + request3 = value; } return Reflect.set(target, prop, value, receiver); } @@ -80258,7 +78140,7 @@ var require_response3 = __commonJS({ } else { return { ...response, - request: request2, + request: request3, headers }; } @@ -80364,7 +78246,7 @@ var require_requestPolicyFactoryPolicy = __commonJS({ const orderedFactories = factories.slice().reverse(); return { name: exports2.requestPolicyFactoryPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { let httpPipeline = { async sendRequest(httpRequest) { const response2 = await next((0, util_js_1.toPipelineRequest)(httpRequest)); @@ -80374,7 +78256,7 @@ var require_requestPolicyFactoryPolicy = __commonJS({ for (const factory of orderedFactories) { httpPipeline = factory.create(httpPipeline, mockRequestPolicyOptions); } - const webResourceLike = (0, util_js_1.toWebResourceLike)(request2, { createProxy: true }); + const webResourceLike = (0, util_js_1.toWebResourceLike)(request3, { createProxy: true }); const response = await httpPipeline.sendRequest(webResourceLike); return (0, response_js_1.toPipelineResponse)(response); } @@ -80393,8 +78275,8 @@ var require_httpClientAdapter = __commonJS({ var util_js_1 = require_util18(); function convertHttpClient(requestPolicyClient) { return { - sendRequest: async (request2) => { - const response = await requestPolicyClient.sendRequest((0, util_js_1.toWebResourceLike)(request2, { createProxy: true })); + sendRequest: async (request3) => { + const response = await requestPolicyClient.sendRequest((0, util_js_1.toWebResourceLike)(request3, { createProxy: true })); return (0, response_js_1.toPipelineResponse)(response); } }; @@ -81716,10 +79598,10 @@ var require_utils_common = __commonJS({ var constants_js_1 = require_constants15(); function escapeURLPath(url) { const urlParsed = new URL(url); - let path3 = urlParsed.pathname; - path3 = path3 || "/"; - path3 = escape2(path3); - urlParsed.pathname = path3; + let path4 = urlParsed.pathname; + path4 = path4 || "/"; + path4 = escape2(path4); + urlParsed.pathname = path4; return urlParsed.toString(); } function getProxyUriFromDevConnString(connectionString) { @@ -81804,9 +79686,9 @@ var require_utils_common = __commonJS({ } function appendToURLPath(url, name) { const urlParsed = new URL(url); - let path3 = urlParsed.pathname; - path3 = path3 ? path3.endsWith("/") ? `${path3}${name}` : `${path3}/${name}` : name; - urlParsed.pathname = path3; + let path4 = urlParsed.pathname; + path4 = path4 ? path4.endsWith("/") ? `${path4}${name}` : `${path4}/${name}` : name; + urlParsed.pathname = path4; return urlParsed.toString(); } function setURLParameter(url, name, value) { @@ -82294,8 +80176,8 @@ var require_StorageRetryPolicy = __commonJS({ * * @param request - */ - async sendRequest(request2) { - return this.attemptSendRequest(request2, false, 1); + async sendRequest(request3) { + return this.attemptSendRequest(request3, false, 1); } /** * Decide and perform next retry. Won't mutate request parameter. @@ -82307,9 +80189,9 @@ var require_StorageRetryPolicy = __commonJS({ * @param attempt - How many retries has been attempted to performed, starting from 1, which includes * the attempt will be performed by this method call. */ - async attemptSendRequest(request2, secondaryHas404, attempt) { - const newRequest = request2.clone(); - const isPrimaryRetry = secondaryHas404 || !this.retryOptions.secondaryHost || !(request2.method === "GET" || request2.method === "HEAD" || request2.method === "OPTIONS") || attempt % 2 === 1; + async attemptSendRequest(request3, secondaryHas404, attempt) { + const newRequest = request3.clone(); + const isPrimaryRetry = secondaryHas404 || !this.retryOptions.secondaryHost || !(request3.method === "GET" || request3.method === "HEAD" || request3.method === "OPTIONS") || attempt % 2 === 1; if (!isPrimaryRetry) { newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); } @@ -82330,8 +80212,8 @@ var require_StorageRetryPolicy = __commonJS({ throw err; } } - await this.delay(isPrimaryRetry, attempt, request2.abortSignal); - return this.attemptSendRequest(request2, secondaryHas404, ++attempt); + await this.delay(isPrimaryRetry, attempt, request3.abortSignal); + return this.attemptSendRequest(request3, secondaryHas404, ++attempt); } /** * Decide whether to retry according to last HTTP response and retry counters. @@ -82475,8 +80357,8 @@ var require_CredentialPolicy = __commonJS({ * * @param request - */ - sendRequest(request2) { - return this._nextPolicy.sendRequest(this.signRequest(request2)); + sendRequest(request3) { + return this._nextPolicy.sendRequest(this.signRequest(request3)); } /** * Child classes must implement this method with request signing. This method @@ -82484,8 +80366,8 @@ var require_CredentialPolicy = __commonJS({ * * @param request - */ - signRequest(request2) { - return request2; + signRequest(request3) { + return request3; } }; exports2.CredentialPolicy = CredentialPolicy; @@ -82954,28 +80836,28 @@ var require_StorageSharedKeyCredentialPolicy = __commonJS({ * * @param request - */ - signRequest(request2) { - request2.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); - if (request2.body && (typeof request2.body === "string" || request2.body !== void 0) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + signRequest(request3) { + request3.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); + if (request3.body && (typeof request3.body === "string" || request3.body !== void 0) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } const stringToSign = [ - request2.method.toUpperCase(), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_ENCODING), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LENGTH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_MD5), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_TYPE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.DATE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MATCH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_NONE_MATCH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.RANGE) - ].join("\n") + "\n" + this.getCanonicalizedHeadersString(request2) + this.getCanonicalizedResourceString(request2); + request3.method.toUpperCase(), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_ENCODING), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LENGTH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_MD5), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_TYPE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.DATE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MATCH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_NONE_MATCH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.RANGE) + ].join("\n") + "\n" + this.getCanonicalizedHeadersString(request3) + this.getCanonicalizedResourceString(request3); const signature = this.factory.computeHMACSHA256(stringToSign); - request2.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); - return request2; + request3.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); + return request3; } /** * Retrieve header value according to shared key sign rules. @@ -82984,8 +80866,8 @@ var require_StorageSharedKeyCredentialPolicy = __commonJS({ * @param request - * @param headerName - */ - getHeaderValueToSign(request2, headerName) { - const value = request2.headers.get(headerName); + getHeaderValueToSign(request3, headerName) { + const value = request3.headers.get(headerName); if (!value) { return ""; } @@ -83007,8 +80889,8 @@ var require_StorageSharedKeyCredentialPolicy = __commonJS({ * * @param request - */ - getCanonicalizedHeadersString(request2) { - let headersArray = request2.headers.headersArray().filter((value) => { + getCanonicalizedHeadersString(request3) { + let headersArray = request3.headers.headersArray().filter((value) => { return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); }); headersArray.sort((a, b) => { @@ -83032,11 +80914,11 @@ var require_StorageSharedKeyCredentialPolicy = __commonJS({ * * @param request - */ - getCanonicalizedResourceString(request2) { - const path3 = (0, utils_common_js_1.getURLPath)(request2.url) || "/"; + getCanonicalizedResourceString(request3) { + const path4 = (0, utils_common_js_1.getURLPath)(request3.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${this.factory.accountName}${path3}`; - const queries = (0, utils_common_js_1.getURLQueries)(request2.url); + canonicalizedResourceString += `/${this.factory.accountName}${path4}`; + const queries = (0, utils_common_js_1.getURLQueries)(request3.url); const lowercaseQueries = {}; if (queries) { const queryKeys = []; @@ -83774,10 +81656,10 @@ var require_utils_common2 = __commonJS({ var constants_js_1 = require_constants16(); function escapeURLPath(url) { const urlParsed = new URL(url); - let path3 = urlParsed.pathname; - path3 = path3 || "/"; - path3 = escape2(path3); - urlParsed.pathname = path3; + let path4 = urlParsed.pathname; + path4 = path4 || "/"; + path4 = escape2(path4); + urlParsed.pathname = path4; return urlParsed.toString(); } function getProxyUriFromDevConnString(connectionString) { @@ -83862,9 +81744,9 @@ var require_utils_common2 = __commonJS({ } function appendToURLPath(url, name) { const urlParsed = new URL(url); - let path3 = urlParsed.pathname; - path3 = path3 ? path3.endsWith("/") ? `${path3}${name}` : `${path3}/${name}` : name; - urlParsed.pathname = path3; + let path4 = urlParsed.pathname; + path4 = path4 ? path4.endsWith("/") ? `${path4}${name}` : `${path4}/${name}` : name; + urlParsed.pathname = path4; return urlParsed.toString(); } function setURLParameter(url, name, value) { @@ -84106,16 +81988,16 @@ var require_StorageBrowserPolicy = __commonJS({ * * @param request - */ - async sendRequest(request2) { + async sendRequest(request3) { if (core_util_1.isNodeLike) { - return this._nextPolicy.sendRequest(request2); + return this._nextPolicy.sendRequest(request3); } - if (request2.method.toUpperCase() === "GET" || request2.method.toUpperCase() === "HEAD") { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); + if (request3.method.toUpperCase() === "GET" || request3.method.toUpperCase() === "HEAD") { + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); } - request2.headers.remove(constants_js_1.HeaderConstants.COOKIE); - request2.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return this._nextPolicy.sendRequest(request2); + request3.headers.remove(constants_js_1.HeaderConstants.COOKIE); + request3.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return this._nextPolicy.sendRequest(request3); } }; exports2.StorageBrowserPolicy = StorageBrowserPolicy; @@ -84160,8 +82042,8 @@ var require_CredentialPolicy2 = __commonJS({ * * @param request - */ - sendRequest(request2) { - return this._nextPolicy.sendRequest(this.signRequest(request2)); + sendRequest(request3) { + return this._nextPolicy.sendRequest(this.signRequest(request3)); } /** * Child classes must implement this method with request signing. This method @@ -84169,8 +82051,8 @@ var require_CredentialPolicy2 = __commonJS({ * * @param request - */ - signRequest(request2) { - return request2; + signRequest(request3) { + return request3; } }; exports2.CredentialPolicy = CredentialPolicy; @@ -84706,28 +82588,28 @@ var require_StorageSharedKeyCredentialPolicy2 = __commonJS({ * * @param request - */ - signRequest(request2) { - request2.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); - if (request2.body && (typeof request2.body === "string" || request2.body !== void 0) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + signRequest(request3) { + request3.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); + if (request3.body && (typeof request3.body === "string" || request3.body !== void 0) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } const stringToSign = [ - request2.method.toUpperCase(), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_ENCODING), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LENGTH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_MD5), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_TYPE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.DATE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MATCH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_NONE_MATCH), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - this.getHeaderValueToSign(request2, constants_js_1.HeaderConstants.RANGE) - ].join("\n") + "\n" + this.getCanonicalizedHeadersString(request2) + this.getCanonicalizedResourceString(request2); + request3.method.toUpperCase(), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_ENCODING), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LENGTH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_MD5), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_TYPE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.DATE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MATCH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_NONE_MATCH), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + this.getHeaderValueToSign(request3, constants_js_1.HeaderConstants.RANGE) + ].join("\n") + "\n" + this.getCanonicalizedHeadersString(request3) + this.getCanonicalizedResourceString(request3); const signature = this.factory.computeHMACSHA256(stringToSign); - request2.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); - return request2; + request3.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); + return request3; } /** * Retrieve header value according to shared key sign rules. @@ -84736,8 +82618,8 @@ var require_StorageSharedKeyCredentialPolicy2 = __commonJS({ * @param request - * @param headerName - */ - getHeaderValueToSign(request2, headerName) { - const value = request2.headers.get(headerName); + getHeaderValueToSign(request3, headerName) { + const value = request3.headers.get(headerName); if (!value) { return ""; } @@ -84759,8 +82641,8 @@ var require_StorageSharedKeyCredentialPolicy2 = __commonJS({ * * @param request - */ - getCanonicalizedHeadersString(request2) { - let headersArray = request2.headers.headersArray().filter((value) => { + getCanonicalizedHeadersString(request3) { + let headersArray = request3.headers.headersArray().filter((value) => { return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); }); headersArray.sort((a, b) => { @@ -84784,11 +82666,11 @@ var require_StorageSharedKeyCredentialPolicy2 = __commonJS({ * * @param request - */ - getCanonicalizedResourceString(request2) { - const path3 = (0, utils_common_js_1.getURLPath)(request2.url) || "/"; + getCanonicalizedResourceString(request3) { + const path4 = (0, utils_common_js_1.getURLPath)(request3.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${this.factory.accountName}${path3}`; - const queries = (0, utils_common_js_1.getURLQueries)(request2.url); + canonicalizedResourceString += `/${this.factory.accountName}${path4}`; + const queries = (0, utils_common_js_1.getURLQueries)(request3.url); const lowercaseQueries = {}; if (queries) { const queryKeys = []; @@ -84974,8 +82856,8 @@ var require_StorageRetryPolicy2 = __commonJS({ * * @param request - */ - async sendRequest(request2) { - return this.attemptSendRequest(request2, false, 1); + async sendRequest(request3) { + return this.attemptSendRequest(request3, false, 1); } /** * Decide and perform next retry. Won't mutate request parameter. @@ -84987,9 +82869,9 @@ var require_StorageRetryPolicy2 = __commonJS({ * @param attempt - How many retries has been attempted to performed, starting from 1, which includes * the attempt will be performed by this method call. */ - async attemptSendRequest(request2, secondaryHas404, attempt) { - const newRequest = request2.clone(); - const isPrimaryRetry = secondaryHas404 || !this.retryOptions.secondaryHost || !(request2.method === "GET" || request2.method === "HEAD" || request2.method === "OPTIONS") || attempt % 2 === 1; + async attemptSendRequest(request3, secondaryHas404, attempt) { + const newRequest = request3.clone(); + const isPrimaryRetry = secondaryHas404 || !this.retryOptions.secondaryHost || !(request3.method === "GET" || request3.method === "HEAD" || request3.method === "OPTIONS") || attempt % 2 === 1; if (!isPrimaryRetry) { newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); } @@ -85010,8 +82892,8 @@ var require_StorageRetryPolicy2 = __commonJS({ throw err; } } - await this.delay(isPrimaryRetry, attempt, request2.abortSignal); - return this.attemptSendRequest(request2, secondaryHas404, ++attempt); + await this.delay(isPrimaryRetry, attempt, request3.abortSignal); + return this.attemptSendRequest(request3, secondaryHas404, ++attempt); } /** * Decide whether to retry according to last HTTP response and retry counters. @@ -85156,16 +83038,16 @@ var require_StorageBrowserPolicyV2 = __commonJS({ function storageBrowserPolicy() { return { name: exports2.storageBrowserPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (core_util_1.isNodeLike) { - return next(request2); + return next(request3); } - if (request2.method === "GET" || request2.method === "HEAD") { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); + if (request3.method === "GET" || request3.method === "HEAD") { + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); } - request2.headers.delete(constants_js_1.HeaderConstants.COOKIE); - request2.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return next(request2); + request3.headers.delete(constants_js_1.HeaderConstants.COOKIE); + request3.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return next(request3); } }; } @@ -85182,16 +83064,16 @@ var require_StorageCorrectContentLengthPolicy = __commonJS({ var constants_js_1 = require_constants16(); exports2.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; function storageCorrectContentLengthPolicy() { - function correctContentLength(request2) { - if (request2.body && (typeof request2.body === "string" || Buffer.isBuffer(request2.body)) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + function correctContentLength(request3) { + if (request3.body && (typeof request3.body === "string" || Buffer.isBuffer(request3.body)) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } } return { name: exports2.storageCorrectContentLengthPolicyName, - async sendRequest(request2, next) { - correctContentLength(request2); - return next(request2); + async sendRequest(request3, next) { + correctContentLength(request3); + return next(request3); } }; } @@ -85303,25 +83185,25 @@ var require_StorageRetryPolicyV2 = __commonJS({ } return { name: exports2.storageRetryPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (tryTimeoutInMs) { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1e3))); + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1e3))); } - const primaryUrl = request2.url; - const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request2.url, secondaryHost) : void 0; + const primaryUrl = request3.url; + const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request3.url, secondaryHost) : void 0; let secondaryHas404 = false; let attempt = 1; let retryAgain = true; let response; let error3; while (retryAgain) { - const isPrimaryRetry = secondaryHas404 || !secondaryUrl || !["GET", "HEAD", "OPTIONS"].includes(request2.method) || attempt % 2 === 1; - request2.url = isPrimaryRetry ? primaryUrl : secondaryUrl; + const isPrimaryRetry = secondaryHas404 || !secondaryUrl || !["GET", "HEAD", "OPTIONS"].includes(request3.method) || attempt % 2 === 1; + request3.url = isPrimaryRetry ? primaryUrl : secondaryUrl; response = void 0; error3 = void 0; try { log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await next(request2); + response = await next(request3); secondaryHas404 = secondaryHas404 || !isPrimaryRetry && response.status === 404; } catch (e) { if ((0, core_rest_pipeline_1.isRestError)(e)) { @@ -85334,7 +83216,7 @@ var require_StorageRetryPolicyV2 = __commonJS({ } retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error: error3 }); if (retryAgain) { - await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request2.abortSignal, RETRY_ABORT_ERROR); + await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request3.abortSignal, RETRY_ABORT_ERROR); } attempt++; } @@ -85361,30 +83243,30 @@ var require_StorageSharedKeyCredentialPolicyV2 = __commonJS({ var SharedKeyComparator_js_1 = require_SharedKeyComparator2(); exports2.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; function storageSharedKeyCredentialPolicy(options) { - function signRequest(request2) { - request2.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); - if (request2.body && (typeof request2.body === "string" || Buffer.isBuffer(request2.body)) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + function signRequest(request3) { + request3.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); + if (request3.body && (typeof request3.body === "string" || Buffer.isBuffer(request3.body)) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } const stringToSign = [ - request2.method.toUpperCase(), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_ENCODING), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LENGTH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_MD5), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_TYPE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.DATE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MATCH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_NONE_MATCH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.RANGE) - ].join("\n") + "\n" + getCanonicalizedHeadersString(request2) + getCanonicalizedResourceString(request2); + request3.method.toUpperCase(), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_ENCODING), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LENGTH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_MD5), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_TYPE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.DATE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MATCH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_NONE_MATCH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.RANGE) + ].join("\n") + "\n" + getCanonicalizedHeadersString(request3) + getCanonicalizedResourceString(request3); const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey).update(stringToSign, "utf8").digest("base64"); - request2.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); + request3.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); } - function getHeaderValueToSign(request2, headerName) { - const value = request2.headers.get(headerName); + function getHeaderValueToSign(request3, headerName) { + const value = request3.headers.get(headerName); if (!value) { return ""; } @@ -85393,9 +83275,9 @@ var require_StorageSharedKeyCredentialPolicyV2 = __commonJS({ } return value; } - function getCanonicalizedHeadersString(request2) { + function getCanonicalizedHeadersString(request3) { let headersArray = []; - for (const [name, value] of request2.headers) { + for (const [name, value] of request3.headers) { if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { headersArray.push({ name, value }); } @@ -85416,11 +83298,11 @@ var require_StorageSharedKeyCredentialPolicyV2 = __commonJS({ }); return canonicalizedHeadersStringToSign; } - function getCanonicalizedResourceString(request2) { - const path3 = (0, utils_common_js_1.getURLPath)(request2.url) || "/"; + function getCanonicalizedResourceString(request3) { + const path4 = (0, utils_common_js_1.getURLPath)(request3.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${options.accountName}${path3}`; - const queries = (0, utils_common_js_1.getURLQueries)(request2.url); + canonicalizedResourceString += `/${options.accountName}${path4}`; + const queries = (0, utils_common_js_1.getURLQueries)(request3.url); const lowercaseQueries = {}; if (queries) { const queryKeys = []; @@ -85441,9 +83323,9 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`; } return { name: exports2.storageSharedKeyCredentialPolicyName, - async sendRequest(request2, next) { - signRequest(request2); - return next(request2); + async sendRequest(request3, next) { + signRequest(request3); + return next(request3); } }; } @@ -85461,9 +83343,9 @@ var require_StorageRequestFailureDetailsParserPolicy = __commonJS({ function storageRequestFailureDetailsParserPolicy() { return { name: exports2.storageRequestFailureDetailsParserPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { try { - const response = await next(request2); + const response = await next(request3); return response; } catch (err) { if (typeof err === "object" && err !== null && err.response && err.response.parsedBody) { @@ -85529,16 +83411,16 @@ var require_StorageBrowserPolicyV22 = __commonJS({ function storageBrowserPolicy() { return { name: exports2.storageBrowserPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (core_util_1.isNodeLike) { - return next(request2); + return next(request3); } - if (request2.method === "GET" || request2.method === "HEAD") { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); + if (request3.method === "GET" || request3.method === "HEAD") { + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); } - request2.headers.delete(constants_js_1.HeaderConstants.COOKIE); - request2.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return next(request2); + request3.headers.delete(constants_js_1.HeaderConstants.COOKIE); + request3.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return next(request3); } }; } @@ -85650,25 +83532,25 @@ var require_StorageRetryPolicyV22 = __commonJS({ } return { name: exports2.storageRetryPolicyName, - async sendRequest(request2, next) { + async sendRequest(request3, next) { if (tryTimeoutInMs) { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1e3))); + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1e3))); } - const primaryUrl = request2.url; - const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request2.url, secondaryHost) : void 0; + const primaryUrl = request3.url; + const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request3.url, secondaryHost) : void 0; let secondaryHas404 = false; let attempt = 1; let retryAgain = true; let response; let error3; while (retryAgain) { - const isPrimaryRetry = secondaryHas404 || !secondaryUrl || !["GET", "HEAD", "OPTIONS"].includes(request2.method) || attempt % 2 === 1; - request2.url = isPrimaryRetry ? primaryUrl : secondaryUrl; + const isPrimaryRetry = secondaryHas404 || !secondaryUrl || !["GET", "HEAD", "OPTIONS"].includes(request3.method) || attempt % 2 === 1; + request3.url = isPrimaryRetry ? primaryUrl : secondaryUrl; response = void 0; error3 = void 0; try { log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await next(request2); + response = await next(request3); secondaryHas404 = secondaryHas404 || !isPrimaryRetry && response.status === 404; } catch (e) { if ((0, core_rest_pipeline_1.isRestError)(e)) { @@ -85681,7 +83563,7 @@ var require_StorageRetryPolicyV22 = __commonJS({ } retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error: error3 }); if (retryAgain) { - await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request2.abortSignal, RETRY_ABORT_ERROR); + await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request3.abortSignal, RETRY_ABORT_ERROR); } attempt++; } @@ -85708,30 +83590,30 @@ var require_StorageSharedKeyCredentialPolicyV22 = __commonJS({ var SharedKeyComparator_js_1 = require_SharedKeyComparator(); exports2.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; function storageSharedKeyCredentialPolicy(options) { - function signRequest(request2) { - request2.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); - if (request2.body && (typeof request2.body === "string" || Buffer.isBuffer(request2.body)) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + function signRequest(request3) { + request3.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString()); + if (request3.body && (typeof request3.body === "string" || Buffer.isBuffer(request3.body)) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } const stringToSign = [ - request2.method.toUpperCase(), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_ENCODING), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_LENGTH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_MD5), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.CONTENT_TYPE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.DATE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_MATCH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_NONE_MATCH), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - getHeaderValueToSign(request2, constants_js_1.HeaderConstants.RANGE) - ].join("\n") + "\n" + getCanonicalizedHeadersString(request2) + getCanonicalizedResourceString(request2); + request3.method.toUpperCase(), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_ENCODING), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_LENGTH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_MD5), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.CONTENT_TYPE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.DATE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_MATCH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_NONE_MATCH), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + getHeaderValueToSign(request3, constants_js_1.HeaderConstants.RANGE) + ].join("\n") + "\n" + getCanonicalizedHeadersString(request3) + getCanonicalizedResourceString(request3); const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey).update(stringToSign, "utf8").digest("base64"); - request2.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); + request3.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); } - function getHeaderValueToSign(request2, headerName) { - const value = request2.headers.get(headerName); + function getHeaderValueToSign(request3, headerName) { + const value = request3.headers.get(headerName); if (!value) { return ""; } @@ -85740,9 +83622,9 @@ var require_StorageSharedKeyCredentialPolicyV22 = __commonJS({ } return value; } - function getCanonicalizedHeadersString(request2) { + function getCanonicalizedHeadersString(request3) { let headersArray = []; - for (const [name, value] of request2.headers) { + for (const [name, value] of request3.headers) { if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { headersArray.push({ name, value }); } @@ -85763,11 +83645,11 @@ var require_StorageSharedKeyCredentialPolicyV22 = __commonJS({ }); return canonicalizedHeadersStringToSign; } - function getCanonicalizedResourceString(request2) { - const path3 = (0, utils_common_js_1.getURLPath)(request2.url) || "/"; + function getCanonicalizedResourceString(request3) { + const path4 = (0, utils_common_js_1.getURLPath)(request3.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${options.accountName}${path3}`; - const queries = (0, utils_common_js_1.getURLQueries)(request2.url); + canonicalizedResourceString += `/${options.accountName}${path4}`; + const queries = (0, utils_common_js_1.getURLQueries)(request3.url); const lowercaseQueries = {}; if (queries) { const queryKeys = []; @@ -85788,9 +83670,9 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`; } return { name: exports2.storageSharedKeyCredentialPolicyName, - async sendRequest(request2, next) { - signRequest(request2); - return next(request2); + async sendRequest(request3, next) { + signRequest(request3); + return next(request3); } }; } @@ -85823,16 +83705,16 @@ var require_StorageBrowserPolicy2 = __commonJS({ * * @param request - */ - async sendRequest(request2) { + async sendRequest(request3) { if (core_util_1.isNodeLike) { - return this._nextPolicy.sendRequest(request2); + return this._nextPolicy.sendRequest(request3); } - if (request2.method.toUpperCase() === "GET" || request2.method.toUpperCase() === "HEAD") { - request2.url = (0, utils_common_js_1.setURLParameter)(request2.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); + if (request3.method.toUpperCase() === "GET" || request3.method.toUpperCase() === "HEAD") { + request3.url = (0, utils_common_js_1.setURLParameter)(request3.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, (/* @__PURE__ */ new Date()).getTime().toString()); } - request2.headers.remove(constants_js_1.HeaderConstants.COOKIE); - request2.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return this._nextPolicy.sendRequest(request2); + request3.headers.remove(constants_js_1.HeaderConstants.COOKIE); + request3.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return this._nextPolicy.sendRequest(request3); } }; exports2.StorageBrowserPolicy = StorageBrowserPolicy; @@ -85874,16 +83756,16 @@ var require_StorageCorrectContentLengthPolicy2 = __commonJS({ var constants_js_1 = require_constants15(); exports2.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; function storageCorrectContentLengthPolicy() { - function correctContentLength(request2) { - if (request2.body && (typeof request2.body === "string" || Buffer.isBuffer(request2.body)) && request2.body.length > 0) { - request2.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request2.body)); + function correctContentLength(request3) { + if (request3.body && (typeof request3.body === "string" || Buffer.isBuffer(request3.body)) && request3.body.length > 0) { + request3.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request3.body)); } } return { name: exports2.storageCorrectContentLengthPolicyName, - async sendRequest(request2, next) { - correctContentLength(request2); - return next(request2); + async sendRequest(request3, next) { + correctContentLength(request3); + return next(request3); } }; } @@ -86123,10 +84005,10 @@ var require_Pipeline = __commonJS({ "DeserializationPolicy" ]; const mockHttpClient = { - sendRequest: async (request2) => { + sendRequest: async (request3) => { return { - request: request2, - headers: request2.headers.clone(), + request: request3, + headers: request3.headers.clone(), status: 500 }; } @@ -107401,7 +105283,7 @@ var require_BlobBatch = __commonJS({ pipeline._corePipeline = corePipeline; return pipeline; } - appendSubRequestToBody(request2) { + appendSubRequestToBody(request3) { this.body += [ this.subRequestPrefix, // sub request constant prefix @@ -107409,10 +105291,10 @@ var require_BlobBatch = __commonJS({ // sub request's content ID "", // empty line after sub request's content ID - `${request2.method.toString()} ${(0, utils_common_js_1.getURLPathAndQuery)(request2.url)} ${constants_js_1.HTTP_VERSION_1_1}${constants_js_1.HTTP_LINE_ENDING}` + `${request3.method.toString()} ${(0, utils_common_js_1.getURLPathAndQuery)(request3.url)} ${constants_js_1.HTTP_VERSION_1_1}${constants_js_1.HTTP_LINE_ENDING}` // sub request start line with method ].join(constants_js_1.HTTP_LINE_ENDING); - for (const [name, value] of request2.headers) { + for (const [name, value] of request3.headers) { this.body += `${name}: ${value}${constants_js_1.HTTP_LINE_ENDING}`; } this.body += constants_js_1.HTTP_LINE_ENDING; @@ -107421,8 +105303,8 @@ var require_BlobBatch = __commonJS({ if (this.operationCount >= constants_js_1.BATCH_MAX_REQUEST) { throw new RangeError(`Cannot exceed ${constants_js_1.BATCH_MAX_REQUEST} sub requests in a single batch`); } - const path3 = (0, utils_common_js_1.getURLPath)(subRequest.url); - if (!path3 || path3 === "") { + const path4 = (0, utils_common_js_1.getURLPath)(subRequest.url); + if (!path4 || path4 === "") { throw new RangeError(`Invalid url for sub request: '${subRequest.url}'`); } } @@ -107444,10 +105326,10 @@ var require_BlobBatch = __commonJS({ function batchRequestAssemblePolicy(batchRequest) { return { name: "batchRequestAssemblePolicy", - async sendRequest(request2) { - batchRequest.appendSubRequestToBody(request2); + async sendRequest(request3) { + batchRequest.appendSubRequestToBody(request3); return { - request: request2, + request: request3, status: 200, headers: (0, core_rest_pipeline_1.createHttpHeaders)() }; @@ -107457,17 +105339,17 @@ var require_BlobBatch = __commonJS({ function batchHeaderFilterPolicy() { return { name: "batchHeaderFilterPolicy", - async sendRequest(request2, next) { + async sendRequest(request3, next) { let xMsHeaderName = ""; - for (const [name] of request2.headers) { + for (const [name] of request3.headers) { if ((0, utils_common_js_1.iEqual)(name, constants_js_1.HeaderConstants.X_MS_VERSION)) { xMsHeaderName = name; } } if (xMsHeaderName !== "") { - request2.headers.delete(xMsHeaderName); + request3.headers.delete(xMsHeaderName); } - return next(request2); + return next(request3); } }; } @@ -107500,8 +105382,8 @@ var require_BlobBatchClient = __commonJS({ pipeline = (0, Pipeline_js_1.newPipeline)(credentialOrPipeline, options); } const storageClientContext = new StorageContextClient_js_1.StorageContextClient(url, (0, Pipeline_js_1.getCoreClientOptions)(pipeline)); - const path3 = (0, utils_common_js_1.getURLPath)(url); - if (path3 && path3 !== "/") { + const path4 = (0, utils_common_js_1.getURLPath)(url); + if (path4 && path4 !== "/") { this.serviceOrContainerContext = storageClientContext.container; } else { this.serviceOrContainerContext = storageClientContext.service; @@ -110788,7 +108670,7 @@ var require_downloadUtils = __commonJS({ var http_client_1 = require_lib(); var storage_blob_1 = require_commonjs15(); var buffer = __importStar2(require("buffer")); - var fs = __importStar2(require("fs")); + var fs2 = __importStar2(require("fs")); var stream = __importStar2(require("stream")); var util = __importStar2(require("util")); var utils = __importStar2(require_cacheUtils()); @@ -110899,7 +108781,7 @@ var require_downloadUtils = __commonJS({ exports2.DownloadProgress = DownloadProgress; function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter2(this, void 0, void 0, function* () { - const writeStream = fs.createWriteStream(archivePath); + const writeStream = fs2.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient("actions/cache"); const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCache", () => __awaiter2(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); @@ -110924,7 +108806,7 @@ var require_downloadUtils = __commonJS({ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { return __awaiter2(this, void 0, void 0, function* () { var _a; - const archiveDescriptor = yield fs.promises.open(archivePath, "w"); + const archiveDescriptor = yield fs2.promises.open(archivePath, "w"); const httpClient = new http_client_1.HttpClient("actions/cache", void 0, { socketTimeout: options.timeoutInMs, keepAlive: true @@ -111040,7 +108922,7 @@ var require_downloadUtils = __commonJS({ } else { const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); - const fd = fs.openSync(archivePath, "w"); + const fd = fs2.openSync(archivePath, "w"); try { downloadProgress.startDisplayTimer(); const controller = new abort_controller_1.AbortController(); @@ -111058,12 +108940,12 @@ var require_downloadUtils = __commonJS({ controller.abort(); throw new Error("Aborting cache download as the download time exceeded the timeout."); } else if (Buffer.isBuffer(result)) { - fs.writeFileSync(fd, result); + fs2.writeFileSync(fd, result); } } } finally { downloadProgress.stopDisplayTimer(); - fs.closeSync(fd); + fs2.closeSync(fd); } } }); @@ -111385,7 +109267,7 @@ var require_cacheHttpClient = __commonJS({ var core12 = __importStar2(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); - var fs = __importStar2(require("fs")); + var fs2 = __importStar2(require("fs")); var url_1 = require("url"); var utils = __importStar2(require_cacheUtils()); var uploadUtils_1 = require_uploadUtils(); @@ -111520,7 +109402,7 @@ Other caches with similar key:`); return __awaiter2(this, void 0, void 0, function* () { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); - const fd = fs.openSync(archivePath, "r"); + const fd = fs2.openSync(archivePath, "r"); const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize); @@ -111534,7 +109416,7 @@ Other caches with similar key:`); const start = offset; const end = offset + chunkSize - 1; offset += maxChunkSize; - yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, { + yield uploadChunk(httpClient, resourceUrl, () => fs2.createReadStream(archivePath, { fd, start, end, @@ -111545,7 +109427,7 @@ Other caches with similar key:`); } }))); } finally { - fs.closeSync(fd); + fs2.closeSync(fd); } return; }); @@ -115086,10 +112968,10 @@ var require_unary_call = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UnaryCall = void 0; var UnaryCall = class { - constructor(method, requestHeaders, request2, headers, response, status, trailers) { + constructor(method, requestHeaders, request3, headers, response, status, trailers) { this.method = method; this.requestHeaders = requestHeaders; - this.request = request2; + this.request = request3; this.headers = headers; this.response = response; this.status = status; @@ -115155,10 +113037,10 @@ var require_server_streaming_call = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.ServerStreamingCall = void 0; var ServerStreamingCall = class { - constructor(method, requestHeaders, request2, headers, response, status, trailers) { + constructor(method, requestHeaders, request3, headers, response, status, trailers) { this.method = method; this.requestHeaders = requestHeaders; - this.request = request2; + this.request = request3; this.headers = headers; this.responses = response; this.status = status; @@ -115225,10 +113107,10 @@ var require_client_streaming_call = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.ClientStreamingCall = void 0; var ClientStreamingCall = class { - constructor(method, requestHeaders, request2, headers, response, status, trailers) { + constructor(method, requestHeaders, request3, headers, response, status, trailers) { this.method = method; this.requestHeaders = requestHeaders; - this.requests = request2; + this.requests = request3; this.headers = headers; this.response = response; this.status = status; @@ -115294,10 +113176,10 @@ var require_duplex_streaming_call = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DuplexStreamingCall = void 0; var DuplexStreamingCall = class { - constructor(method, requestHeaders, request2, headers, response, status, trailers) { + constructor(method, requestHeaders, request3, headers, response, status, trailers) { this.method = method; this.requestHeaders = requestHeaders; - this.requests = request2; + this.requests = request3; this.headers = headers; this.responses = response; this.status = status; @@ -116451,8 +114333,8 @@ var require_cache_twirp_client = __commonJS({ this.FinalizeCacheEntryUpload.bind(this); this.GetCacheEntryDownloadURL.bind(this); } - CreateCacheEntry(request2) { - const data = cache_1.CreateCacheEntryRequest.toJson(request2, { + CreateCacheEntry(request3) { + const data = cache_1.CreateCacheEntryRequest.toJson(request3, { useProtoFieldName: true, emitDefaultValues: false }); @@ -116461,8 +114343,8 @@ var require_cache_twirp_client = __commonJS({ ignoreUnknownFields: true })); } - FinalizeCacheEntryUpload(request2) { - const data = cache_1.FinalizeCacheEntryUploadRequest.toJson(request2, { + FinalizeCacheEntryUpload(request3) { + const data = cache_1.FinalizeCacheEntryUploadRequest.toJson(request3, { useProtoFieldName: true, emitDefaultValues: false }); @@ -116471,8 +114353,8 @@ var require_cache_twirp_client = __commonJS({ ignoreUnknownFields: true })); } - GetCacheEntryDownloadURL(request2) { - const data = cache_1.GetCacheEntryDownloadURLRequest.toJson(request2, { + GetCacheEntryDownloadURL(request3) { + const data = cache_1.GetCacheEntryDownloadURLRequest.toJson(request3, { useProtoFieldName: true, emitDefaultValues: false }); @@ -116490,18 +114372,18 @@ var require_cache_twirp_client = __commonJS({ this.FinalizeCacheEntryUpload.bind(this); this.GetCacheEntryDownloadURL.bind(this); } - CreateCacheEntry(request2) { - const data = cache_1.CreateCacheEntryRequest.toBinary(request2); + CreateCacheEntry(request3) { + const data = cache_1.CreateCacheEntryRequest.toBinary(request3); const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "CreateCacheEntry", "application/protobuf", data); return promise.then((data2) => cache_1.CreateCacheEntryResponse.fromBinary(data2)); } - FinalizeCacheEntryUpload(request2) { - const data = cache_1.FinalizeCacheEntryUploadRequest.toBinary(request2); + FinalizeCacheEntryUpload(request3) { + const data = cache_1.FinalizeCacheEntryUploadRequest.toBinary(request3); const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "FinalizeCacheEntryUpload", "application/protobuf", data); return promise.then((data2) => cache_1.FinalizeCacheEntryUploadResponse.fromBinary(data2)); } - GetCacheEntryDownloadURL(request2) { - const data = cache_1.GetCacheEntryDownloadURLRequest.toBinary(request2); + GetCacheEntryDownloadURL(request3) { + const data = cache_1.GetCacheEntryDownloadURLRequest.toBinary(request3); const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/protobuf", data); return promise.then((data2) => cache_1.GetCacheEntryDownloadURLResponse.fromBinary(data2)); } @@ -116810,7 +114692,7 @@ var require_tar = __commonJS({ var exec_1 = require_exec(); var io4 = __importStar2(require_io()); var fs_1 = require("fs"); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var utils = __importStar2(require_cacheUtils()); var constants_1 = require_constants12(); var IS_WINDOWS = process.platform === "win32"; @@ -116856,13 +114738,13 @@ var require_tar = __commonJS({ const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && compressionMethod !== constants_1.CompressionMethod.Gzip && IS_WINDOWS; switch (type2) { case "create": - args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); + args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); break; case "extract": - args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path3.sep}`, "g"), "/")); + args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path4.sep}`, "g"), "/")); break; case "list": - args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), "-P"); + args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), "-P"); break; } if (tarPath.type === constants_1.ArchiveToolType.GNU) { @@ -116908,7 +114790,7 @@ var require_tar = __commonJS({ return BSD_TAR_ZSTD ? [ "zstd -d --long=30 --force -o", constants_1.TarFilename, - archivePath.replace(new RegExp(`\\${path3.sep}`, "g"), "/") + archivePath.replace(new RegExp(`\\${path4.sep}`, "g"), "/") ] : [ "--use-compress-program", IS_WINDOWS ? '"zstd -d --long=30"' : "unzstd --long=30" @@ -116917,7 +114799,7 @@ var require_tar = __commonJS({ return BSD_TAR_ZSTD ? [ "zstd -d --force -o", constants_1.TarFilename, - archivePath.replace(new RegExp(`\\${path3.sep}`, "g"), "/") + archivePath.replace(new RegExp(`\\${path4.sep}`, "g"), "/") ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -d"' : "unzstd"]; default: return ["-z"]; @@ -116932,7 +114814,7 @@ var require_tar = __commonJS({ case constants_1.CompressionMethod.Zstd: return BSD_TAR_ZSTD ? [ "zstd -T0 --long=30 --force -o", - cacheFileName.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), + cacheFileName.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), constants_1.TarFilename ] : [ "--use-compress-program", @@ -116941,7 +114823,7 @@ var require_tar = __commonJS({ case constants_1.CompressionMethod.ZstdWithoutLong: return BSD_TAR_ZSTD ? [ "zstd -T0 --force -o", - cacheFileName.replace(new RegExp(`\\${path3.sep}`, "g"), "/"), + cacheFileName.replace(new RegExp(`\\${path4.sep}`, "g"), "/"), constants_1.TarFilename ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -T0"' : "zstdmt"]; default: @@ -116979,7 +114861,7 @@ var require_tar = __commonJS({ } function createTar(archiveFolder, sourceDirectories, compressionMethod) { return __awaiter2(this, void 0, void 0, function* () { - (0, fs_1.writeFileSync)(path3.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n")); + (0, fs_1.writeFileSync)(path4.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n")); const commands = yield getCommands(compressionMethod, "create"); yield execCommands(commands, archiveFolder); }); @@ -117061,7 +114943,7 @@ var require_cache5 = __commonJS({ exports2.restoreCache = restoreCache3; exports2.saveCache = saveCache3; var core12 = __importStar2(require_core()); - var path3 = __importStar2(require("path")); + var path4 = __importStar2(require("path")); var utils = __importStar2(require_cacheUtils()); var cacheHttpClient = __importStar2(require_cacheHttpClient()); var cacheTwirpClient = __importStar2(require_cacheTwirpClient()); @@ -117156,7 +115038,7 @@ var require_cache5 = __commonJS({ core12.info("Lookup only - skipping download"); return cacheEntry.cacheKey; } - archivePath = path3.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); + archivePath = path4.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core12.debug(`Archive Path: ${archivePath}`); yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); if (core12.isDebug()) { @@ -117205,17 +115087,17 @@ var require_cache5 = __commonJS({ try { const twirpClient = cacheTwirpClient.internalCacheTwirpClient(); const compressionMethod = yield utils.getCompressionMethod(); - const request2 = { + const request3 = { key: primaryKey, restoreKeys, version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive) }; - const response = yield twirpClient.GetCacheEntryDownloadURL(request2); + const response = yield twirpClient.GetCacheEntryDownloadURL(request3); if (!response.ok) { - core12.debug(`Cache not found for version ${request2.version} of keys: ${keys.join(", ")}`); + core12.debug(`Cache not found for version ${request3.version} of keys: ${keys.join(", ")}`); return void 0; } - const isRestoreKeyMatch = request2.key !== response.matchedKey; + const isRestoreKeyMatch = request3.key !== response.matchedKey; if (isRestoreKeyMatch) { core12.info(`Cache hit for restore-key: ${response.matchedKey}`); } else { @@ -117225,7 +115107,7 @@ var require_cache5 = __commonJS({ core12.info("Lookup only - skipping download"); return response.matchedKey; } - archivePath = path3.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); + archivePath = path4.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core12.debug(`Archive path: ${archivePath}`); core12.debug(`Starting download of archive to: ${archivePath}`); yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options); @@ -117287,7 +115169,7 @@ var require_cache5 = __commonJS({ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); - const archivePath = path3.join(archiveFolder, utils.getCacheFileName(compressionMethod)); + const archivePath = path4.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core12.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); @@ -117351,7 +115233,7 @@ var require_cache5 = __commonJS({ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); - const archivePath = path3.join(archiveFolder, utils.getCacheFileName(compressionMethod)); + const archivePath = path4.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core12.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); @@ -117363,13 +115245,13 @@ var require_cache5 = __commonJS({ options.archiveSizeBytes = archiveFileSize; core12.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); - const request2 = { + const request3 = { key, version }; let signedUploadUrl; try { - const response = yield twirpClient.CreateCacheEntry(request2); + const response = yield twirpClient.CreateCacheEntry(request3); if (!response.ok) { if (response.message) { core12.warning(`Cache reservation failed: ${response.message}`); @@ -117425,9 +115307,2128 @@ var require_cache5 = __commonJS({ } }); +// node_modules/@actions/tool-cache/lib/manifest.js +var require_manifest = __commonJS({ + "node_modules/@actions/tool-cache/lib/manifest.js"(exports2, module2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) 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 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { + var ownKeys2 = function(o) { + ownKeys2 = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys2(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); + } + __setModuleDefault2(result, mod); + return result; + }; + })(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve2) { + resolve2(value); + }); + } + return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._findMatch = _findMatch; + exports2._getOsVersion = _getOsVersion; + exports2._readLinuxVersionFile = _readLinuxVersionFile; + var semver6 = __importStar2(require_semver2()); + var core_1 = require_core(); + var os2 = require("os"); + var cp = require("child_process"); + var fs2 = require("fs"); + function _findMatch(versionSpec, stable, candidates, archFilter) { + return __awaiter2(this, void 0, void 0, function* () { + const platFilter = os2.platform(); + let result; + let match; + let file; + for (const candidate of candidates) { + const version = candidate.version; + (0, core_1.debug)(`check ${version} satisfies ${versionSpec}`); + if (semver6.satisfies(version, versionSpec) && (!stable || candidate.stable === stable)) { + file = candidate.files.find((item) => { + (0, core_1.debug)(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); + let chk = item.arch === archFilter && item.platform === platFilter; + if (chk && item.platform_version) { + const osVersion = module2.exports._getOsVersion(); + if (osVersion === item.platform_version) { + chk = true; + } else { + chk = semver6.satisfies(osVersion, item.platform_version); + } + } + return chk; + }); + if (file) { + (0, core_1.debug)(`matched ${candidate.version}`); + match = candidate; + break; + } + } + } + if (match && file) { + result = Object.assign({}, match); + result.files = [file]; + } + return result; + }); + } + function _getOsVersion() { + const plat = os2.platform(); + let version = ""; + if (plat === "darwin") { + version = cp.execSync("sw_vers -productVersion").toString(); + } else if (plat === "linux") { + const lsbContents = module2.exports._readLinuxVersionFile(); + if (lsbContents) { + const lines = lsbContents.split("\n"); + for (const line of lines) { + const parts = line.split("="); + if (parts.length === 2 && (parts[0].trim() === "VERSION_ID" || parts[0].trim() === "DISTRIB_RELEASE")) { + version = parts[1].trim().replace(/^"/, "").replace(/"$/, ""); + break; + } + } + } + } + return version; + } + function _readLinuxVersionFile() { + const lsbReleaseFile = "/etc/lsb-release"; + const osReleaseFile = "/etc/os-release"; + let contents = ""; + if (fs2.existsSync(lsbReleaseFile)) { + contents = fs2.readFileSync(lsbReleaseFile).toString(); + } else if (fs2.existsSync(osReleaseFile)) { + contents = fs2.readFileSync(osReleaseFile).toString(); + } + return contents; + } + } +}); + +// node_modules/@actions/tool-cache/lib/retry-helper.js +var require_retry_helper = __commonJS({ + "node_modules/@actions/tool-cache/lib/retry-helper.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) 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 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { + var ownKeys2 = function(o) { + ownKeys2 = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys2(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); + } + __setModuleDefault2(result, mod); + return result; + }; + })(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve2) { + resolve2(value); + }); + } + return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RetryHelper = void 0; + var core12 = __importStar2(require_core()); + var RetryHelper = class { + constructor(maxAttempts, minSeconds, maxSeconds) { + if (maxAttempts < 1) { + throw new Error("max attempts should be greater than or equal to 1"); + } + this.maxAttempts = maxAttempts; + this.minSeconds = Math.floor(minSeconds); + this.maxSeconds = Math.floor(maxSeconds); + if (this.minSeconds > this.maxSeconds) { + throw new Error("min seconds should be less than or equal to max seconds"); + } + } + execute(action, isRetryable) { + return __awaiter2(this, void 0, void 0, function* () { + let attempt = 1; + while (attempt < this.maxAttempts) { + try { + return yield action(); + } catch (err) { + if (isRetryable && !isRetryable(err)) { + throw err; + } + core12.info(err.message); + } + const seconds = this.getSleepAmount(); + core12.info(`Waiting ${seconds} seconds before trying again`); + yield this.sleep(seconds); + attempt++; + } + return yield action(); + }); + } + getSleepAmount() { + return Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) + this.minSeconds; + } + sleep(seconds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve2) => setTimeout(resolve2, seconds * 1e3)); + }); + } + }; + exports2.RetryHelper = RetryHelper; + } +}); + +// node_modules/@actions/tool-cache/lib/tool-cache.js +var require_tool_cache = __commonJS({ + "node_modules/@actions/tool-cache/lib/tool-cache.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) 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 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { + var ownKeys2 = function(o) { + ownKeys2 = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys2(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); + } + __setModuleDefault2(result, mod); + return result; + }; + })(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve2) { + resolve2(value); + }); + } + return new (P || (P = Promise))(function(resolve2, 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 ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HTTPError = void 0; + exports2.downloadTool = downloadTool2; + exports2.extract7z = extract7z; + exports2.extractTar = extractTar2; + exports2.extractXar = extractXar; + exports2.extractZip = extractZip; + exports2.cacheDir = cacheDir2; + exports2.cacheFile = cacheFile; + exports2.find = find2; + exports2.findAllVersions = findAllVersions; + exports2.getManifestFromRepo = getManifestFromRepo; + exports2.findFromManifest = findFromManifest; + exports2.isExplicitVersion = isExplicitVersion; + exports2.evaluateVersions = evaluateVersions; + var core12 = __importStar2(require_core()); + var io4 = __importStar2(require_io()); + var crypto2 = __importStar2(require("crypto")); + var fs2 = __importStar2(require("fs")); + var mm = __importStar2(require_manifest()); + var os2 = __importStar2(require("os")); + var path4 = __importStar2(require("path")); + var httpm = __importStar2(require_lib()); + var semver6 = __importStar2(require_semver2()); + var stream = __importStar2(require("stream")); + var util = __importStar2(require("util")); + var assert_1 = require("assert"); + var exec_1 = require_exec(); + var retry_helper_1 = require_retry_helper(); + var HTTPError2 = class extends Error { + constructor(httpStatusCode) { + super(`Unexpected HTTP response: ${httpStatusCode}`); + this.httpStatusCode = httpStatusCode; + Object.setPrototypeOf(this, new.target.prototype); + } + }; + exports2.HTTPError = HTTPError2; + var IS_WINDOWS = process.platform === "win32"; + var IS_MAC = process.platform === "darwin"; + var userAgent2 = "actions/tool-cache"; + function downloadTool2(url, dest, auth2, headers) { + return __awaiter2(this, void 0, void 0, function* () { + dest = dest || path4.join(_getTempDirectory(), crypto2.randomUUID()); + yield io4.mkdirP(path4.dirname(dest)); + core12.debug(`Downloading ${url}`); + core12.debug(`Destination ${dest}`); + const maxAttempts = 3; + const minSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS", 10); + const maxSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS", 20); + const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds); + return yield retryHelper.execute(() => __awaiter2(this, void 0, void 0, function* () { + return yield downloadToolAttempt(url, dest || "", auth2, headers); + }), (err) => { + if (err instanceof HTTPError2 && err.httpStatusCode) { + if (err.httpStatusCode < 500 && err.httpStatusCode !== 408 && err.httpStatusCode !== 429) { + return false; + } + } + return true; + }); + }); + } + function downloadToolAttempt(url, dest, auth2, headers) { + return __awaiter2(this, void 0, void 0, function* () { + if (fs2.existsSync(dest)) { + throw new Error(`Destination file path ${dest} already exists`); + } + const http = new httpm.HttpClient(userAgent2, [], { + allowRetries: false + }); + if (auth2) { + core12.debug("set auth"); + if (headers === void 0) { + headers = {}; + } + headers.authorization = auth2; + } + const response = yield http.get(url, headers); + if (response.message.statusCode !== 200) { + const err = new HTTPError2(response.message.statusCode); + core12.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); + throw err; + } + const pipeline = util.promisify(stream.pipeline); + const responseMessageFactory = _getGlobal("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY", () => response.message); + const readStream = responseMessageFactory(); + let succeeded = false; + try { + yield pipeline(readStream, fs2.createWriteStream(dest)); + core12.debug("download complete"); + succeeded = true; + return dest; + } finally { + if (!succeeded) { + core12.debug("download failed"); + try { + yield io4.rmRF(dest); + } catch (err) { + core12.debug(`Failed to delete '${dest}'. ${err.message}`); + } + } + } + }); + } + function extract7z(file, dest, _7zPath) { + return __awaiter2(this, void 0, void 0, function* () { + (0, assert_1.ok)(IS_WINDOWS, "extract7z() not supported on current OS"); + (0, assert_1.ok)(file, 'parameter "file" is required'); + dest = yield _createExtractFolder(dest); + const originalCwd = process.cwd(); + process.chdir(dest); + if (_7zPath) { + try { + const logLevel = core12.isDebug() ? "-bb1" : "-bb0"; + const args = [ + "x", + // eXtract files with full paths + logLevel, + // -bb[0-3] : set output log level + "-bd", + // disable progress indicator + "-sccUTF-8", + // set charset for for console input/output + file + ]; + const options = { + silent: true + }; + yield (0, exec_1.exec)(`"${_7zPath}"`, args, options); + } finally { + process.chdir(originalCwd); + } + } else { + const escapedScript = path4.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; + const args = [ + "-NoLogo", + "-Sta", + "-NoProfile", + "-NonInteractive", + "-ExecutionPolicy", + "Unrestricted", + "-Command", + command + ]; + const options = { + silent: true + }; + try { + const powershellPath = yield io4.which("powershell", true); + yield (0, exec_1.exec)(`"${powershellPath}"`, args, options); + } finally { + process.chdir(originalCwd); + } + } + return dest; + }); + } + function extractTar2(file_1, dest_1) { + return __awaiter2(this, arguments, void 0, function* (file, dest, flags = "xz") { + if (!file) { + throw new Error("parameter 'file' is required"); + } + dest = yield _createExtractFolder(dest); + core12.debug("Checking tar --version"); + let versionOutput = ""; + yield (0, exec_1.exec)("tar --version", [], { + ignoreReturnCode: true, + silent: true, + listeners: { + stdout: (data) => versionOutput += data.toString(), + stderr: (data) => versionOutput += data.toString() + } + }); + core12.debug(versionOutput.trim()); + const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR"); + let args; + if (flags instanceof Array) { + args = flags; + } else { + args = [flags]; + } + if (core12.isDebug() && !flags.includes("v")) { + args.push("-v"); + } + let destArg = dest; + let fileArg = file; + if (IS_WINDOWS && isGnuTar) { + args.push("--force-local"); + destArg = dest.replace(/\\/g, "/"); + fileArg = file.replace(/\\/g, "/"); + } + if (isGnuTar) { + args.push("--warning=no-unknown-keyword"); + args.push("--overwrite"); + } + args.push("-C", destArg, "-f", fileArg); + yield (0, exec_1.exec)(`tar`, args); + return dest; + }); + } + function extractXar(file_1, dest_1) { + return __awaiter2(this, arguments, void 0, function* (file, dest, flags = []) { + (0, assert_1.ok)(IS_MAC, "extractXar() not supported on current OS"); + (0, assert_1.ok)(file, 'parameter "file" is required'); + dest = yield _createExtractFolder(dest); + let args; + if (flags instanceof Array) { + args = flags; + } else { + args = [flags]; + } + args.push("-x", "-C", dest, "-f", file); + if (core12.isDebug()) { + args.push("-v"); + } + const xarPath = yield io4.which("xar", true); + yield (0, exec_1.exec)(`"${xarPath}"`, _unique(args)); + return dest; + }); + } + function extractZip(file, dest) { + return __awaiter2(this, void 0, void 0, function* () { + if (!file) { + throw new Error("parameter 'file' is required"); + } + dest = yield _createExtractFolder(dest); + if (IS_WINDOWS) { + yield extractZipWin(file, dest); + } else { + yield extractZipNix(file, dest); + } + return dest; + }); + } + function extractZipWin(file, dest) { + return __awaiter2(this, void 0, void 0, function* () { + const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const pwshPath = yield io4.which("pwsh", false); + if (pwshPath) { + const pwshCommand = [ + `$ErrorActionPreference = 'Stop' ;`, + `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`, + `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`, + `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;` + ].join(" "); + const args = [ + "-NoLogo", + "-NoProfile", + "-NonInteractive", + "-ExecutionPolicy", + "Unrestricted", + "-Command", + pwshCommand + ]; + core12.debug(`Using pwsh at path: ${pwshPath}`); + yield (0, exec_1.exec)(`"${pwshPath}"`, args); + } else { + const powershellCommand = [ + `$ErrorActionPreference = 'Stop' ;`, + `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`, + `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`, + `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }` + ].join(" "); + const args = [ + "-NoLogo", + "-Sta", + "-NoProfile", + "-NonInteractive", + "-ExecutionPolicy", + "Unrestricted", + "-Command", + powershellCommand + ]; + const powershellPath = yield io4.which("powershell", true); + core12.debug(`Using powershell at path: ${powershellPath}`); + yield (0, exec_1.exec)(`"${powershellPath}"`, args); + } + }); + } + function extractZipNix(file, dest) { + return __awaiter2(this, void 0, void 0, function* () { + const unzipPath = yield io4.which("unzip", true); + const args = [file]; + if (!core12.isDebug()) { + args.unshift("-q"); + } + args.unshift("-o"); + yield (0, exec_1.exec)(`"${unzipPath}"`, args, { cwd: dest }); + }); + } + function cacheDir2(sourceDir, tool, version, arch) { + return __awaiter2(this, void 0, void 0, function* () { + version = semver6.clean(version) || version; + arch = arch || os2.arch(); + core12.debug(`Caching tool ${tool} ${version} ${arch}`); + core12.debug(`source dir: ${sourceDir}`); + if (!fs2.statSync(sourceDir).isDirectory()) { + throw new Error("sourceDir is not a directory"); + } + const destPath = yield _createToolPath(tool, version, arch); + for (const itemName of fs2.readdirSync(sourceDir)) { + const s = path4.join(sourceDir, itemName); + yield io4.cp(s, destPath, { recursive: true }); + } + _completeToolPath(tool, version, arch); + return destPath; + }); + } + function cacheFile(sourceFile, targetFile, tool, version, arch) { + return __awaiter2(this, void 0, void 0, function* () { + version = semver6.clean(version) || version; + arch = arch || os2.arch(); + core12.debug(`Caching tool ${tool} ${version} ${arch}`); + core12.debug(`source file: ${sourceFile}`); + if (!fs2.statSync(sourceFile).isFile()) { + throw new Error("sourceFile is not a file"); + } + const destFolder = yield _createToolPath(tool, version, arch); + const destPath = path4.join(destFolder, targetFile); + core12.debug(`destination file ${destPath}`); + yield io4.cp(sourceFile, destPath); + _completeToolPath(tool, version, arch); + return destFolder; + }); + } + function find2(toolName, versionSpec, arch) { + if (!toolName) { + throw new Error("toolName parameter is required"); + } + if (!versionSpec) { + throw new Error("versionSpec parameter is required"); + } + arch = arch || os2.arch(); + if (!isExplicitVersion(versionSpec)) { + const localVersions = findAllVersions(toolName, arch); + const match = evaluateVersions(localVersions, versionSpec); + versionSpec = match; + } + let toolPath = ""; + if (versionSpec) { + versionSpec = semver6.clean(versionSpec) || ""; + const cachePath = path4.join(_getCacheDirectory(), toolName, versionSpec, arch); + core12.debug(`checking cache: ${cachePath}`); + if (fs2.existsSync(cachePath) && fs2.existsSync(`${cachePath}.complete`)) { + core12.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`); + toolPath = cachePath; + } else { + core12.debug("not found"); + } + } + return toolPath; + } + function findAllVersions(toolName, arch) { + const versions = []; + arch = arch || os2.arch(); + const toolPath = path4.join(_getCacheDirectory(), toolName); + if (fs2.existsSync(toolPath)) { + const children = fs2.readdirSync(toolPath); + for (const child of children) { + if (isExplicitVersion(child)) { + const fullPath = path4.join(toolPath, child, arch || ""); + if (fs2.existsSync(fullPath) && fs2.existsSync(`${fullPath}.complete`)) { + versions.push(child); + } + } + } + } + return versions; + } + function getManifestFromRepo(owner_1, repo_1, auth_1) { + return __awaiter2(this, arguments, void 0, function* (owner, repo, auth2, branch = "master") { + let releases = []; + const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`; + const http = new httpm.HttpClient("tool-cache"); + const headers = {}; + if (auth2) { + core12.debug("set auth"); + headers.authorization = auth2; + } + const response = yield http.getJson(treeUrl, headers); + if (!response.result) { + return releases; + } + let manifestUrl = ""; + for (const item of response.result.tree) { + if (item.path === "versions-manifest.json") { + manifestUrl = item.url; + break; + } + } + headers["accept"] = "application/vnd.github.VERSION.raw"; + let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody(); + if (versionsRaw) { + versionsRaw = versionsRaw.replace(/^\uFEFF/, ""); + try { + releases = JSON.parse(versionsRaw); + } catch (_a) { + core12.debug("Invalid json"); + } + } + return releases; + }); + } + function findFromManifest(versionSpec_1, stable_1, manifest_1) { + return __awaiter2(this, arguments, void 0, function* (versionSpec, stable, manifest, archFilter = os2.arch()) { + const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter); + return match; + }); + } + function _createExtractFolder(dest) { + return __awaiter2(this, void 0, void 0, function* () { + if (!dest) { + dest = path4.join(_getTempDirectory(), crypto2.randomUUID()); + } + yield io4.mkdirP(dest); + return dest; + }); + } + function _createToolPath(tool, version, arch) { + return __awaiter2(this, void 0, void 0, function* () { + const folderPath = path4.join(_getCacheDirectory(), tool, semver6.clean(version) || version, arch || ""); + core12.debug(`destination ${folderPath}`); + const markerPath = `${folderPath}.complete`; + yield io4.rmRF(folderPath); + yield io4.rmRF(markerPath); + yield io4.mkdirP(folderPath); + return folderPath; + }); + } + function _completeToolPath(tool, version, arch) { + const folderPath = path4.join(_getCacheDirectory(), tool, semver6.clean(version) || version, arch || ""); + const markerPath = `${folderPath}.complete`; + fs2.writeFileSync(markerPath, ""); + core12.debug("finished caching tool"); + } + function isExplicitVersion(versionSpec) { + const c = semver6.clean(versionSpec) || ""; + core12.debug(`isExplicit: ${c}`); + const valid2 = semver6.valid(c) != null; + core12.debug(`explicit? ${valid2}`); + return valid2; + } + function evaluateVersions(versions, versionSpec) { + let version = ""; + core12.debug(`evaluating ${versions.length} versions`); + versions = versions.sort((a, b) => { + if (semver6.gt(a, b)) { + return 1; + } + return -1; + }); + for (let i = versions.length - 1; i >= 0; i--) { + const potential = versions[i]; + const satisfied = semver6.satisfies(potential, versionSpec); + if (satisfied) { + version = potential; + break; + } + } + if (version) { + core12.debug(`matched: ${version}`); + } else { + core12.debug("match not found"); + } + return version; + } + function _getCacheDirectory() { + const cacheDirectory = process.env["RUNNER_TOOL_CACHE"] || ""; + (0, assert_1.ok)(cacheDirectory, "Expected RUNNER_TOOL_CACHE to be defined"); + return cacheDirectory; + } + function _getTempDirectory() { + const tempDirectory = process.env["RUNNER_TEMP"] || ""; + (0, assert_1.ok)(tempDirectory, "Expected RUNNER_TEMP to be defined"); + return tempDirectory; + } + function _getGlobal(key, defaultValue) { + const value = global[key]; + return value !== void 0 ? value : defaultValue; + } + function _unique(values) { + return Array.from(new Set(values)); + } + } +}); + +// node_modules/jsonschema/lib/helpers.js +var require_helpers3 = __commonJS({ + "node_modules/jsonschema/lib/helpers.js"(exports2, module2) { + "use strict"; + var uri = require("url"); + var ValidationError = exports2.ValidationError = function ValidationError2(message, instance, schema2, path4, name, argument) { + if (Array.isArray(path4)) { + this.path = path4; + this.property = path4.reduce(function(sum, item) { + return sum + makeSuffix(item); + }, "instance"); + } else if (path4 !== void 0) { + this.property = path4; + } + if (message) { + this.message = message; + } + if (schema2) { + var id = schema2.$id || schema2.id; + this.schema = id || schema2; + } + if (instance !== void 0) { + this.instance = instance; + } + this.name = name; + this.argument = argument; + this.stack = this.toString(); + }; + ValidationError.prototype.toString = function toString2() { + return this.property + " " + this.message; + }; + var ValidatorResult = exports2.ValidatorResult = function ValidatorResult2(instance, schema2, options, ctx) { + this.instance = instance; + this.schema = schema2; + this.options = options; + this.path = ctx.path; + this.propertyPath = ctx.propertyPath; + this.errors = []; + this.throwError = options && options.throwError; + this.throwFirst = options && options.throwFirst; + this.throwAll = options && options.throwAll; + this.disableFormat = options && options.disableFormat === true; + }; + ValidatorResult.prototype.addError = function addError(detail) { + var err; + if (typeof detail == "string") { + err = new ValidationError(detail, this.instance, this.schema, this.path); + } else { + if (!detail) throw new Error("Missing error detail"); + if (!detail.message) throw new Error("Missing error message"); + if (!detail.name) throw new Error("Missing validator type"); + err = new ValidationError(detail.message, this.instance, this.schema, this.path, detail.name, detail.argument); + } + this.errors.push(err); + if (this.throwFirst) { + throw new ValidatorResultError(this); + } else if (this.throwError) { + throw err; + } + return err; + }; + ValidatorResult.prototype.importErrors = function importErrors(res) { + if (typeof res == "string" || res && res.validatorType) { + this.addError(res); + } else if (res && res.errors) { + this.errors = this.errors.concat(res.errors); + } + }; + function stringizer(v, i) { + return i + ": " + v.toString() + "\n"; + } + ValidatorResult.prototype.toString = function toString2(res) { + return this.errors.map(stringizer).join(""); + }; + Object.defineProperty(ValidatorResult.prototype, "valid", { get: function() { + return !this.errors.length; + } }); + module2.exports.ValidatorResultError = ValidatorResultError; + function ValidatorResultError(result) { + if (Error.captureStackTrace) { + Error.captureStackTrace(this, ValidatorResultError); + } + this.instance = result.instance; + this.schema = result.schema; + this.options = result.options; + this.errors = result.errors; + } + ValidatorResultError.prototype = new Error(); + ValidatorResultError.prototype.constructor = ValidatorResultError; + ValidatorResultError.prototype.name = "Validation Error"; + var SchemaError = exports2.SchemaError = function SchemaError2(msg, schema2) { + this.message = msg; + this.schema = schema2; + Error.call(this, msg); + Error.captureStackTrace(this, SchemaError2); + }; + SchemaError.prototype = Object.create( + Error.prototype, + { + constructor: { value: SchemaError, enumerable: false }, + name: { value: "SchemaError", enumerable: false } + } + ); + var SchemaContext = exports2.SchemaContext = function SchemaContext2(schema2, options, path4, base, schemas) { + this.schema = schema2; + this.options = options; + if (Array.isArray(path4)) { + this.path = path4; + this.propertyPath = path4.reduce(function(sum, item) { + return sum + makeSuffix(item); + }, "instance"); + } else { + this.propertyPath = path4; + } + this.base = base; + this.schemas = schemas; + }; + SchemaContext.prototype.resolve = function resolve2(target) { + return uri.resolve(this.base, target); + }; + SchemaContext.prototype.makeChild = function makeChild(schema2, propertyName) { + var path4 = propertyName === void 0 ? this.path : this.path.concat([propertyName]); + var id = schema2.$id || schema2.id; + var base = uri.resolve(this.base, id || ""); + var ctx = new SchemaContext(schema2, this.options, path4, base, Object.create(this.schemas)); + if (id && !ctx.schemas[base]) { + ctx.schemas[base] = schema2; + } + return ctx; + }; + var FORMAT_REGEXPS = exports2.FORMAT_REGEXPS = { + // 7.3.1. Dates, Times, and Duration + "date-time": /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/, + "date": /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/, + "time": /^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/, + "duration": /P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i, + // 7.3.2. Email Addresses + // TODO: fix the email production + "email": /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/, + "idn-email": /^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u, + // 7.3.3. Hostnames + // 7.3.4. IP Addresses + "ip-address": /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, + // FIXME whitespace is invalid + "ipv6": /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, + // 7.3.5. Resource Identifiers + // TODO: A more accurate regular expression for "uri" goes: + // [A-Za-z][+\-.0-9A-Za-z]*:((/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?)?#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])|/?%[0-9A-Fa-f]{2}|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*(#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?)? + "uri": /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, + "uri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/, + "iri": /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, + "iri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u, + "uuid": /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, + // 7.3.6. uri-template + "uri-template": /(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu, + // 7.3.7. JSON Pointers + "json-pointer": /^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu, + "relative-json-pointer": /^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu, + // hostname regex from: http://stackoverflow.com/a/1420225/5628 + "hostname": /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, + "host-name": /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, + "utc-millisec": function(input) { + return typeof input === "string" && parseFloat(input) === parseInt(input, 10) && !isNaN(input); + }, + // 7.3.8. regex + "regex": function(input) { + var result = true; + try { + new RegExp(input); + } catch (e) { + result = false; + } + return result; + }, + // Other definitions + // "style" was removed from JSON Schema in draft-4 and is deprecated + "style": /[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/, + // "color" was removed from JSON Schema in draft-4 and is deprecated + "color": /^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/, + "phone": /^\+(?:[0-9] ?){6,14}[0-9]$/, + "alpha": /^[a-zA-Z]+$/, + "alphanumeric": /^[a-zA-Z0-9]+$/ + }; + FORMAT_REGEXPS.regexp = FORMAT_REGEXPS.regex; + FORMAT_REGEXPS.pattern = FORMAT_REGEXPS.regex; + FORMAT_REGEXPS.ipv4 = FORMAT_REGEXPS["ip-address"]; + exports2.isFormat = function isFormat(input, format, validator) { + if (typeof input === "string" && FORMAT_REGEXPS[format] !== void 0) { + if (FORMAT_REGEXPS[format] instanceof RegExp) { + return FORMAT_REGEXPS[format].test(input); + } + if (typeof FORMAT_REGEXPS[format] === "function") { + return FORMAT_REGEXPS[format](input); + } + } else if (validator && validator.customFormats && typeof validator.customFormats[format] === "function") { + return validator.customFormats[format](input); + } + return true; + }; + var makeSuffix = exports2.makeSuffix = function makeSuffix2(key) { + key = key.toString(); + if (!key.match(/[.\s\[\]]/) && !key.match(/^[\d]/)) { + return "." + key; + } + if (key.match(/^\d+$/)) { + return "[" + key + "]"; + } + return "[" + JSON.stringify(key) + "]"; + }; + exports2.deepCompareStrict = function deepCompareStrict(a, b) { + if (typeof a !== typeof b) { + return false; + } + if (Array.isArray(a)) { + if (!Array.isArray(b)) { + return false; + } + if (a.length !== b.length) { + return false; + } + return a.every(function(v, i) { + return deepCompareStrict(a[i], b[i]); + }); + } + if (typeof a === "object") { + if (!a || !b) { + return a === b; + } + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + if (aKeys.length !== bKeys.length) { + return false; + } + return aKeys.every(function(v) { + return deepCompareStrict(a[v], b[v]); + }); + } + return a === b; + }; + function deepMerger(target, dst, e, i) { + if (typeof e === "object") { + dst[i] = deepMerge(target[i], e); + } else { + if (target.indexOf(e) === -1) { + dst.push(e); + } + } + } + function copyist(src, dst, key) { + dst[key] = src[key]; + } + function copyistWithDeepMerge(target, src, dst, key) { + if (typeof src[key] !== "object" || !src[key]) { + dst[key] = src[key]; + } else { + if (!target[key]) { + dst[key] = src[key]; + } else { + dst[key] = deepMerge(target[key], src[key]); + } + } + } + function deepMerge(target, src) { + var array = Array.isArray(src); + var dst = array && [] || {}; + if (array) { + target = target || []; + dst = dst.concat(target); + src.forEach(deepMerger.bind(null, target, dst)); + } else { + if (target && typeof target === "object") { + Object.keys(target).forEach(copyist.bind(null, target, dst)); + } + Object.keys(src).forEach(copyistWithDeepMerge.bind(null, target, src, dst)); + } + return dst; + } + module2.exports.deepMerge = deepMerge; + exports2.objectGetPath = function objectGetPath(o, s) { + var parts = s.split("/").slice(1); + var k; + while (typeof (k = parts.shift()) == "string") { + var n = decodeURIComponent(k.replace(/~0/, "~").replace(/~1/g, "/")); + if (!(n in o)) return; + o = o[n]; + } + return o; + }; + function pathEncoder(v) { + return "/" + encodeURIComponent(v).replace(/~/g, "%7E"); + } + exports2.encodePath = function encodePointer(a) { + return a.map(pathEncoder).join(""); + }; + exports2.getDecimalPlaces = function getDecimalPlaces(number) { + var decimalPlaces = 0; + if (isNaN(number)) return decimalPlaces; + if (typeof number !== "number") { + number = Number(number); + } + var parts = number.toString().split("e"); + if (parts.length === 2) { + if (parts[1][0] !== "-") { + return decimalPlaces; + } else { + decimalPlaces = Number(parts[1].slice(1)); + } + } + var decimalParts = parts[0].split("."); + if (decimalParts.length === 2) { + decimalPlaces += decimalParts[1].length; + } + return decimalPlaces; + }; + exports2.isSchema = function isSchema(val) { + return typeof val === "object" && val || typeof val === "boolean"; + }; + } +}); + +// node_modules/jsonschema/lib/attribute.js +var require_attribute = __commonJS({ + "node_modules/jsonschema/lib/attribute.js"(exports2, module2) { + "use strict"; + var helpers = require_helpers3(); + var ValidatorResult = helpers.ValidatorResult; + var SchemaError = helpers.SchemaError; + var attribute = {}; + attribute.ignoreProperties = { + // informative properties + "id": true, + "default": true, + "description": true, + "title": true, + // arguments to other properties + "additionalItems": true, + "then": true, + "else": true, + // special-handled properties + "$schema": true, + "$ref": true, + "extends": true + }; + var validators = attribute.validators = {}; + validators.type = function validateType(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + var result = new ValidatorResult(instance, schema2, options, ctx); + var types = Array.isArray(schema2.type) ? schema2.type : [schema2.type]; + if (!types.some(this.testType.bind(this, instance, schema2, options, ctx))) { + var list = types.map(function(v) { + if (!v) return; + var id = v.$id || v.id; + return id ? "<" + id + ">" : v + ""; + }); + result.addError({ + name: "type", + argument: list, + message: "is not of a type(s) " + list + }); + } + return result; + }; + function testSchemaNoThrow(instance, options, ctx, callback, schema2) { + var throwError2 = options.throwError; + var throwAll = options.throwAll; + options.throwError = false; + options.throwAll = false; + var res = this.validateSchema(instance, schema2, options, ctx); + options.throwError = throwError2; + options.throwAll = throwAll; + if (!res.valid && callback instanceof Function) { + callback(res); + } + return res.valid; + } + validators.anyOf = function validateAnyOf(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + var result = new ValidatorResult(instance, schema2, options, ctx); + var inner = new ValidatorResult(instance, schema2, options, ctx); + if (!Array.isArray(schema2.anyOf)) { + throw new SchemaError("anyOf must be an array"); + } + if (!schema2.anyOf.some( + testSchemaNoThrow.bind( + this, + instance, + options, + ctx, + function(res) { + inner.importErrors(res); + } + ) + )) { + var list = schema2.anyOf.map(function(v, i) { + var id = v.$id || v.id; + if (id) return "<" + id + ">"; + return v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; + }); + if (options.nestedErrors) { + result.importErrors(inner); + } + result.addError({ + name: "anyOf", + argument: list, + message: "is not any of " + list.join(",") + }); + } + return result; + }; + validators.allOf = function validateAllOf(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + if (!Array.isArray(schema2.allOf)) { + throw new SchemaError("allOf must be an array"); + } + var result = new ValidatorResult(instance, schema2, options, ctx); + var self2 = this; + schema2.allOf.forEach(function(v, i) { + var valid2 = self2.validateSchema(instance, v, options, ctx); + if (!valid2.valid) { + var id = v.$id || v.id; + var msg = id || v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; + result.addError({ + name: "allOf", + argument: { id: msg, length: valid2.errors.length, valid: valid2 }, + message: "does not match allOf schema " + msg + " with " + valid2.errors.length + " error[s]:" + }); + result.importErrors(valid2); + } + }); + return result; + }; + validators.oneOf = function validateOneOf(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + if (!Array.isArray(schema2.oneOf)) { + throw new SchemaError("oneOf must be an array"); + } + var result = new ValidatorResult(instance, schema2, options, ctx); + var inner = new ValidatorResult(instance, schema2, options, ctx); + var count = schema2.oneOf.filter( + testSchemaNoThrow.bind( + this, + instance, + options, + ctx, + function(res) { + inner.importErrors(res); + } + ) + ).length; + var list = schema2.oneOf.map(function(v, i) { + var id = v.$id || v.id; + return id || v.title && JSON.stringify(v.title) || v["$ref"] && "<" + v["$ref"] + ">" || "[subschema " + i + "]"; + }); + if (count !== 1) { + if (options.nestedErrors) { + result.importErrors(inner); + } + result.addError({ + name: "oneOf", + argument: list, + message: "is not exactly one from " + list.join(",") + }); + } + return result; + }; + validators.if = function validateIf(instance, schema2, options, ctx) { + if (instance === void 0) return null; + if (!helpers.isSchema(schema2.if)) throw new Error('Expected "if" keyword to be a schema'); + var ifValid = testSchemaNoThrow.call(this, instance, options, ctx, null, schema2.if); + var result = new ValidatorResult(instance, schema2, options, ctx); + var res; + if (ifValid) { + if (schema2.then === void 0) return; + if (!helpers.isSchema(schema2.then)) throw new Error('Expected "then" keyword to be a schema'); + res = this.validateSchema(instance, schema2.then, options, ctx.makeChild(schema2.then)); + result.importErrors(res); + } else { + if (schema2.else === void 0) return; + if (!helpers.isSchema(schema2.else)) throw new Error('Expected "else" keyword to be a schema'); + res = this.validateSchema(instance, schema2.else, options, ctx.makeChild(schema2.else)); + result.importErrors(res); + } + return result; + }; + function getEnumerableProperty(object, key) { + if (Object.hasOwnProperty.call(object, key)) return object[key]; + if (!(key in object)) return; + while (object = Object.getPrototypeOf(object)) { + if (Object.propertyIsEnumerable.call(object, key)) return object[key]; + } + } + validators.propertyNames = function validatePropertyNames(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var subschema = schema2.propertyNames !== void 0 ? schema2.propertyNames : {}; + if (!helpers.isSchema(subschema)) throw new SchemaError('Expected "propertyNames" to be a schema (object or boolean)'); + for (var property in instance) { + if (getEnumerableProperty(instance, property) !== void 0) { + var res = this.validateSchema(property, subschema, options, ctx.makeChild(subschema)); + result.importErrors(res); + } + } + return result; + }; + validators.properties = function validateProperties(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var properties = schema2.properties || {}; + for (var property in properties) { + var subschema = properties[property]; + if (subschema === void 0) { + continue; + } else if (subschema === null) { + throw new SchemaError('Unexpected null, expected schema in "properties"'); + } + if (typeof options.preValidateProperty == "function") { + options.preValidateProperty(instance, property, subschema, options, ctx); + } + var prop = getEnumerableProperty(instance, property); + var res = this.validateSchema(prop, subschema, options, ctx.makeChild(subschema, property)); + if (res.instance !== result.instance[property]) result.instance[property] = res.instance; + result.importErrors(res); + } + return result; + }; + function testAdditionalProperty(instance, schema2, options, ctx, property, result) { + if (!this.types.object(instance)) return; + if (schema2.properties && schema2.properties[property] !== void 0) { + return; + } + if (schema2.additionalProperties === false) { + result.addError({ + name: "additionalProperties", + argument: property, + message: "is not allowed to have the additional property " + JSON.stringify(property) + }); + } else { + var additionalProperties = schema2.additionalProperties || {}; + if (typeof options.preValidateProperty == "function") { + options.preValidateProperty(instance, property, additionalProperties, options, ctx); + } + var res = this.validateSchema(instance[property], additionalProperties, options, ctx.makeChild(additionalProperties, property)); + if (res.instance !== result.instance[property]) result.instance[property] = res.instance; + result.importErrors(res); + } + } + validators.patternProperties = function validatePatternProperties(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var patternProperties = schema2.patternProperties || {}; + for (var property in instance) { + var test = true; + for (var pattern in patternProperties) { + var subschema = patternProperties[pattern]; + if (subschema === void 0) { + continue; + } else if (subschema === null) { + throw new SchemaError('Unexpected null, expected schema in "patternProperties"'); + } + try { + var regexp = new RegExp(pattern, "u"); + } catch (_e) { + regexp = new RegExp(pattern); + } + if (!regexp.test(property)) { + continue; + } + test = false; + if (typeof options.preValidateProperty == "function") { + options.preValidateProperty(instance, property, subschema, options, ctx); + } + var res = this.validateSchema(instance[property], subschema, options, ctx.makeChild(subschema, property)); + if (res.instance !== result.instance[property]) result.instance[property] = res.instance; + result.importErrors(res); + } + if (test) { + testAdditionalProperty.call(this, instance, schema2, options, ctx, property, result); + } + } + return result; + }; + validators.additionalProperties = function validateAdditionalProperties(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + if (schema2.patternProperties) { + return null; + } + var result = new ValidatorResult(instance, schema2, options, ctx); + for (var property in instance) { + testAdditionalProperty.call(this, instance, schema2, options, ctx, property, result); + } + return result; + }; + validators.minProperties = function validateMinProperties(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var keys = Object.keys(instance); + if (!(keys.length >= schema2.minProperties)) { + result.addError({ + name: "minProperties", + argument: schema2.minProperties, + message: "does not meet minimum property length of " + schema2.minProperties + }); + } + return result; + }; + validators.maxProperties = function validateMaxProperties(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var keys = Object.keys(instance); + if (!(keys.length <= schema2.maxProperties)) { + result.addError({ + name: "maxProperties", + argument: schema2.maxProperties, + message: "does not meet maximum property length of " + schema2.maxProperties + }); + } + return result; + }; + validators.items = function validateItems(instance, schema2, options, ctx) { + var self2 = this; + if (!this.types.array(instance)) return; + if (schema2.items === void 0) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + instance.every(function(value, i) { + if (Array.isArray(schema2.items)) { + var items = schema2.items[i] === void 0 ? schema2.additionalItems : schema2.items[i]; + } else { + var items = schema2.items; + } + if (items === void 0) { + return true; + } + if (items === false) { + result.addError({ + name: "items", + message: "additionalItems not permitted" + }); + return false; + } + var res = self2.validateSchema(value, items, options, ctx.makeChild(items, i)); + if (res.instance !== result.instance[i]) result.instance[i] = res.instance; + result.importErrors(res); + return true; + }); + return result; + }; + validators.contains = function validateContains(instance, schema2, options, ctx) { + var self2 = this; + if (!this.types.array(instance)) return; + if (schema2.contains === void 0) return; + if (!helpers.isSchema(schema2.contains)) throw new Error('Expected "contains" keyword to be a schema'); + var result = new ValidatorResult(instance, schema2, options, ctx); + var count = instance.some(function(value, i) { + var res = self2.validateSchema(value, schema2.contains, options, ctx.makeChild(schema2.contains, i)); + return res.errors.length === 0; + }); + if (count === false) { + result.addError({ + name: "contains", + argument: schema2.contains, + message: "must contain an item matching given schema" + }); + } + return result; + }; + validators.minimum = function validateMinimum(instance, schema2, options, ctx) { + if (!this.types.number(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (schema2.exclusiveMinimum && schema2.exclusiveMinimum === true) { + if (!(instance > schema2.minimum)) { + result.addError({ + name: "minimum", + argument: schema2.minimum, + message: "must be greater than " + schema2.minimum + }); + } + } else { + if (!(instance >= schema2.minimum)) { + result.addError({ + name: "minimum", + argument: schema2.minimum, + message: "must be greater than or equal to " + schema2.minimum + }); + } + } + return result; + }; + validators.maximum = function validateMaximum(instance, schema2, options, ctx) { + if (!this.types.number(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (schema2.exclusiveMaximum && schema2.exclusiveMaximum === true) { + if (!(instance < schema2.maximum)) { + result.addError({ + name: "maximum", + argument: schema2.maximum, + message: "must be less than " + schema2.maximum + }); + } + } else { + if (!(instance <= schema2.maximum)) { + result.addError({ + name: "maximum", + argument: schema2.maximum, + message: "must be less than or equal to " + schema2.maximum + }); + } + } + return result; + }; + validators.exclusiveMinimum = function validateExclusiveMinimum(instance, schema2, options, ctx) { + if (typeof schema2.exclusiveMinimum === "boolean") return; + if (!this.types.number(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var valid2 = instance > schema2.exclusiveMinimum; + if (!valid2) { + result.addError({ + name: "exclusiveMinimum", + argument: schema2.exclusiveMinimum, + message: "must be strictly greater than " + schema2.exclusiveMinimum + }); + } + return result; + }; + validators.exclusiveMaximum = function validateExclusiveMaximum(instance, schema2, options, ctx) { + if (typeof schema2.exclusiveMaximum === "boolean") return; + if (!this.types.number(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var valid2 = instance < schema2.exclusiveMaximum; + if (!valid2) { + result.addError({ + name: "exclusiveMaximum", + argument: schema2.exclusiveMaximum, + message: "must be strictly less than " + schema2.exclusiveMaximum + }); + } + return result; + }; + var validateMultipleOfOrDivisbleBy = function validateMultipleOfOrDivisbleBy2(instance, schema2, options, ctx, validationType, errorMessage) { + if (!this.types.number(instance)) return; + var validationArgument = schema2[validationType]; + if (validationArgument == 0) { + throw new SchemaError(validationType + " cannot be zero"); + } + var result = new ValidatorResult(instance, schema2, options, ctx); + var instanceDecimals = helpers.getDecimalPlaces(instance); + var divisorDecimals = helpers.getDecimalPlaces(validationArgument); + var maxDecimals = Math.max(instanceDecimals, divisorDecimals); + var multiplier = Math.pow(10, maxDecimals); + if (Math.round(instance * multiplier) % Math.round(validationArgument * multiplier) !== 0) { + result.addError({ + name: validationType, + argument: validationArgument, + message: errorMessage + JSON.stringify(validationArgument) + }); + } + return result; + }; + validators.multipleOf = function validateMultipleOf(instance, schema2, options, ctx) { + return validateMultipleOfOrDivisbleBy.call(this, instance, schema2, options, ctx, "multipleOf", "is not a multiple of (divisible by) "); + }; + validators.divisibleBy = function validateDivisibleBy(instance, schema2, options, ctx) { + return validateMultipleOfOrDivisbleBy.call(this, instance, schema2, options, ctx, "divisibleBy", "is not divisible by (multiple of) "); + }; + validators.required = function validateRequired(instance, schema2, options, ctx) { + var result = new ValidatorResult(instance, schema2, options, ctx); + if (instance === void 0 && schema2.required === true) { + result.addError({ + name: "required", + message: "is required" + }); + } else if (this.types.object(instance) && Array.isArray(schema2.required)) { + schema2.required.forEach(function(n) { + if (getEnumerableProperty(instance, n) === void 0) { + result.addError({ + name: "required", + argument: n, + message: "requires property " + JSON.stringify(n) + }); + } + }); + } + return result; + }; + validators.pattern = function validatePattern(instance, schema2, options, ctx) { + if (!this.types.string(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var pattern = schema2.pattern; + try { + var regexp = new RegExp(pattern, "u"); + } catch (_e) { + regexp = new RegExp(pattern); + } + if (!instance.match(regexp)) { + result.addError({ + name: "pattern", + argument: schema2.pattern, + message: "does not match pattern " + JSON.stringify(schema2.pattern.toString()) + }); + } + return result; + }; + validators.format = function validateFormat(instance, schema2, options, ctx) { + if (instance === void 0) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!result.disableFormat && !helpers.isFormat(instance, schema2.format, this)) { + result.addError({ + name: "format", + argument: schema2.format, + message: "does not conform to the " + JSON.stringify(schema2.format) + " format" + }); + } + return result; + }; + validators.minLength = function validateMinLength(instance, schema2, options, ctx) { + if (!this.types.string(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var hsp = instance.match(/[\uDC00-\uDFFF]/g); + var length = instance.length - (hsp ? hsp.length : 0); + if (!(length >= schema2.minLength)) { + result.addError({ + name: "minLength", + argument: schema2.minLength, + message: "does not meet minimum length of " + schema2.minLength + }); + } + return result; + }; + validators.maxLength = function validateMaxLength(instance, schema2, options, ctx) { + if (!this.types.string(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + var hsp = instance.match(/[\uDC00-\uDFFF]/g); + var length = instance.length - (hsp ? hsp.length : 0); + if (!(length <= schema2.maxLength)) { + result.addError({ + name: "maxLength", + argument: schema2.maxLength, + message: "does not meet maximum length of " + schema2.maxLength + }); + } + return result; + }; + validators.minItems = function validateMinItems(instance, schema2, options, ctx) { + if (!this.types.array(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!(instance.length >= schema2.minItems)) { + result.addError({ + name: "minItems", + argument: schema2.minItems, + message: "does not meet minimum length of " + schema2.minItems + }); + } + return result; + }; + validators.maxItems = function validateMaxItems(instance, schema2, options, ctx) { + if (!this.types.array(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!(instance.length <= schema2.maxItems)) { + result.addError({ + name: "maxItems", + argument: schema2.maxItems, + message: "does not meet maximum length of " + schema2.maxItems + }); + } + return result; + }; + function testArrays(v, i, a) { + var j, len = a.length; + for (j = i + 1, len; j < len; j++) { + if (helpers.deepCompareStrict(v, a[j])) { + return false; + } + } + return true; + } + validators.uniqueItems = function validateUniqueItems(instance, schema2, options, ctx) { + if (schema2.uniqueItems !== true) return; + if (!this.types.array(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!instance.every(testArrays)) { + result.addError({ + name: "uniqueItems", + message: "contains duplicate item" + }); + } + return result; + }; + validators.dependencies = function validateDependencies(instance, schema2, options, ctx) { + if (!this.types.object(instance)) return; + var result = new ValidatorResult(instance, schema2, options, ctx); + for (var property in schema2.dependencies) { + if (instance[property] === void 0) { + continue; + } + var dep = schema2.dependencies[property]; + var childContext = ctx.makeChild(dep, property); + if (typeof dep == "string") { + dep = [dep]; + } + if (Array.isArray(dep)) { + dep.forEach(function(prop) { + if (instance[prop] === void 0) { + result.addError({ + // FIXME there's two different "dependencies" errors here with slightly different outputs + // Can we make these the same? Or should we create different error types? + name: "dependencies", + argument: childContext.propertyPath, + message: "property " + prop + " not found, required by " + childContext.propertyPath + }); + } + }); + } else { + var res = this.validateSchema(instance, dep, options, childContext); + if (result.instance !== res.instance) result.instance = res.instance; + if (res && res.errors.length) { + result.addError({ + name: "dependencies", + argument: childContext.propertyPath, + message: "does not meet dependency required by " + childContext.propertyPath + }); + result.importErrors(res); + } + } + } + return result; + }; + validators["enum"] = function validateEnum(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + if (!Array.isArray(schema2["enum"])) { + throw new SchemaError("enum expects an array", schema2); + } + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!schema2["enum"].some(helpers.deepCompareStrict.bind(null, instance))) { + result.addError({ + name: "enum", + argument: schema2["enum"], + message: "is not one of enum values: " + schema2["enum"].map(String).join(",") + }); + } + return result; + }; + validators["const"] = function validateEnum(instance, schema2, options, ctx) { + if (instance === void 0) { + return null; + } + var result = new ValidatorResult(instance, schema2, options, ctx); + if (!helpers.deepCompareStrict(schema2["const"], instance)) { + result.addError({ + name: "const", + argument: schema2["const"], + message: "does not exactly match expected constant: " + schema2["const"] + }); + } + return result; + }; + validators.not = validators.disallow = function validateNot(instance, schema2, options, ctx) { + var self2 = this; + if (instance === void 0) return null; + var result = new ValidatorResult(instance, schema2, options, ctx); + var notTypes = schema2.not || schema2.disallow; + if (!notTypes) return null; + if (!Array.isArray(notTypes)) notTypes = [notTypes]; + notTypes.forEach(function(type2) { + if (self2.testType(instance, schema2, options, ctx, type2)) { + var id = type2 && (type2.$id || type2.id); + var schemaId = id || type2; + result.addError({ + name: "not", + argument: schemaId, + message: "is of prohibited type " + schemaId + }); + } + }); + return result; + }; + module2.exports = attribute; + } +}); + +// node_modules/jsonschema/lib/scan.js +var require_scan = __commonJS({ + "node_modules/jsonschema/lib/scan.js"(exports2, module2) { + "use strict"; + var urilib = require("url"); + var helpers = require_helpers3(); + module2.exports.SchemaScanResult = SchemaScanResult; + function SchemaScanResult(found, ref) { + this.id = found; + this.ref = ref; + } + module2.exports.scan = function scan(base, schema2) { + function scanSchema(baseuri, schema3) { + if (!schema3 || typeof schema3 != "object") return; + if (schema3.$ref) { + var resolvedUri = urilib.resolve(baseuri, schema3.$ref); + ref[resolvedUri] = ref[resolvedUri] ? ref[resolvedUri] + 1 : 0; + return; + } + var id = schema3.$id || schema3.id; + var ourBase = id ? urilib.resolve(baseuri, id) : baseuri; + if (ourBase) { + if (ourBase.indexOf("#") < 0) ourBase += "#"; + if (found[ourBase]) { + if (!helpers.deepCompareStrict(found[ourBase], schema3)) { + throw new Error("Schema <" + ourBase + "> already exists with different definition"); + } + return found[ourBase]; + } + found[ourBase] = schema3; + if (ourBase[ourBase.length - 1] == "#") { + found[ourBase.substring(0, ourBase.length - 1)] = schema3; + } + } + scanArray(ourBase + "/items", Array.isArray(schema3.items) ? schema3.items : [schema3.items]); + scanArray(ourBase + "/extends", Array.isArray(schema3.extends) ? schema3.extends : [schema3.extends]); + scanSchema(ourBase + "/additionalItems", schema3.additionalItems); + scanObject(ourBase + "/properties", schema3.properties); + scanSchema(ourBase + "/additionalProperties", schema3.additionalProperties); + scanObject(ourBase + "/definitions", schema3.definitions); + scanObject(ourBase + "/patternProperties", schema3.patternProperties); + scanObject(ourBase + "/dependencies", schema3.dependencies); + scanArray(ourBase + "/disallow", schema3.disallow); + scanArray(ourBase + "/allOf", schema3.allOf); + scanArray(ourBase + "/anyOf", schema3.anyOf); + scanArray(ourBase + "/oneOf", schema3.oneOf); + scanSchema(ourBase + "/not", schema3.not); + } + function scanArray(baseuri, schemas) { + if (!Array.isArray(schemas)) return; + for (var i = 0; i < schemas.length; i++) { + scanSchema(baseuri + "/" + i, schemas[i]); + } + } + function scanObject(baseuri, schemas) { + if (!schemas || typeof schemas != "object") return; + for (var p in schemas) { + scanSchema(baseuri + "/" + p, schemas[p]); + } + } + var found = {}; + var ref = {}; + scanSchema(base, schema2); + return new SchemaScanResult(found, ref); + }; + } +}); + +// node_modules/jsonschema/lib/validator.js +var require_validator = __commonJS({ + "node_modules/jsonschema/lib/validator.js"(exports2, module2) { + "use strict"; + var urilib = require("url"); + var attribute = require_attribute(); + var helpers = require_helpers3(); + var scanSchema = require_scan().scan; + var ValidatorResult = helpers.ValidatorResult; + var ValidatorResultError = helpers.ValidatorResultError; + var SchemaError = helpers.SchemaError; + var SchemaContext = helpers.SchemaContext; + var anonymousBase = "/"; + var Validator2 = function Validator3() { + this.customFormats = Object.create(Validator3.prototype.customFormats); + this.schemas = {}; + this.unresolvedRefs = []; + this.types = Object.create(types); + this.attributes = Object.create(attribute.validators); + }; + Validator2.prototype.customFormats = {}; + Validator2.prototype.schemas = null; + Validator2.prototype.types = null; + Validator2.prototype.attributes = null; + Validator2.prototype.unresolvedRefs = null; + Validator2.prototype.addSchema = function addSchema(schema2, base) { + var self2 = this; + if (!schema2) { + return null; + } + var scan = scanSchema(base || anonymousBase, schema2); + var ourUri = base || schema2.$id || schema2.id; + for (var uri in scan.id) { + this.schemas[uri] = scan.id[uri]; + } + for (var uri in scan.ref) { + this.unresolvedRefs.push(uri); + } + this.unresolvedRefs = this.unresolvedRefs.filter(function(uri2) { + return typeof self2.schemas[uri2] === "undefined"; + }); + return this.schemas[ourUri]; + }; + Validator2.prototype.addSubSchemaArray = function addSubSchemaArray(baseuri, schemas) { + if (!Array.isArray(schemas)) return; + for (var i = 0; i < schemas.length; i++) { + this.addSubSchema(baseuri, schemas[i]); + } + }; + Validator2.prototype.addSubSchemaObject = function addSubSchemaArray(baseuri, schemas) { + if (!schemas || typeof schemas != "object") return; + for (var p in schemas) { + this.addSubSchema(baseuri, schemas[p]); + } + }; + Validator2.prototype.setSchemas = function setSchemas(schemas) { + this.schemas = schemas; + }; + Validator2.prototype.getSchema = function getSchema(urn) { + return this.schemas[urn]; + }; + Validator2.prototype.validate = function validate(instance, schema2, options, ctx) { + if (typeof schema2 !== "boolean" && typeof schema2 !== "object" || schema2 === null) { + throw new SchemaError("Expected `schema` to be an object or boolean"); + } + if (!options) { + options = {}; + } + var id = schema2.$id || schema2.id; + var base = urilib.resolve(options.base || anonymousBase, id || ""); + if (!ctx) { + ctx = new SchemaContext(schema2, options, [], base, Object.create(this.schemas)); + if (!ctx.schemas[base]) { + ctx.schemas[base] = schema2; + } + var found = scanSchema(base, schema2); + for (var n in found.id) { + var sch = found.id[n]; + ctx.schemas[n] = sch; + } + } + if (options.required && instance === void 0) { + var result = new ValidatorResult(instance, schema2, options, ctx); + result.addError("is required, but is undefined"); + return result; + } + var result = this.validateSchema(instance, schema2, options, ctx); + if (!result) { + throw new Error("Result undefined"); + } else if (options.throwAll && result.errors.length) { + throw new ValidatorResultError(result); + } + return result; + }; + function shouldResolve(schema2) { + var ref = typeof schema2 === "string" ? schema2 : schema2.$ref; + if (typeof ref == "string") return ref; + return false; + } + Validator2.prototype.validateSchema = function validateSchema(instance, schema2, options, ctx) { + var result = new ValidatorResult(instance, schema2, options, ctx); + if (typeof schema2 === "boolean") { + if (schema2 === true) { + schema2 = {}; + } else if (schema2 === false) { + schema2 = { type: [] }; + } + } else if (!schema2) { + throw new Error("schema is undefined"); + } + if (schema2["extends"]) { + if (Array.isArray(schema2["extends"])) { + var schemaobj = { schema: schema2, ctx }; + schema2["extends"].forEach(this.schemaTraverser.bind(this, schemaobj)); + schema2 = schemaobj.schema; + schemaobj.schema = null; + schemaobj.ctx = null; + schemaobj = null; + } else { + schema2 = helpers.deepMerge(schema2, this.superResolve(schema2["extends"], ctx)); + } + } + var switchSchema = shouldResolve(schema2); + if (switchSchema) { + var resolved = this.resolve(schema2, switchSchema, ctx); + var subctx = new SchemaContext(resolved.subschema, options, ctx.path, resolved.switchSchema, ctx.schemas); + return this.validateSchema(instance, resolved.subschema, options, subctx); + } + var skipAttributes = options && options.skipAttributes || []; + for (var key in schema2) { + if (!attribute.ignoreProperties[key] && skipAttributes.indexOf(key) < 0) { + var validatorErr = null; + var validator = this.attributes[key]; + if (validator) { + validatorErr = validator.call(this, instance, schema2, options, ctx); + } else if (options.allowUnknownAttributes === false) { + throw new SchemaError("Unsupported attribute: " + key, schema2); + } + if (validatorErr) { + result.importErrors(validatorErr); + } + } + } + if (typeof options.rewrite == "function") { + var value = options.rewrite.call(this, instance, schema2, options, ctx); + result.instance = value; + } + return result; + }; + Validator2.prototype.schemaTraverser = function schemaTraverser(schemaobj, s) { + schemaobj.schema = helpers.deepMerge(schemaobj.schema, this.superResolve(s, schemaobj.ctx)); + }; + Validator2.prototype.superResolve = function superResolve(schema2, ctx) { + var ref = shouldResolve(schema2); + if (ref) { + return this.resolve(schema2, ref, ctx).subschema; + } + return schema2; + }; + Validator2.prototype.resolve = function resolve2(schema2, switchSchema, ctx) { + switchSchema = ctx.resolve(switchSchema); + if (ctx.schemas[switchSchema]) { + return { subschema: ctx.schemas[switchSchema], switchSchema }; + } + var parsed = urilib.parse(switchSchema); + var fragment = parsed && parsed.hash; + var document2 = fragment && fragment.length && switchSchema.substr(0, switchSchema.length - fragment.length); + if (!document2 || !ctx.schemas[document2]) { + throw new SchemaError("no such schema <" + switchSchema + ">", schema2); + } + var subschema = helpers.objectGetPath(ctx.schemas[document2], fragment.substr(1)); + if (subschema === void 0) { + throw new SchemaError("no such schema " + fragment + " located in <" + document2 + ">", schema2); + } + return { subschema, switchSchema }; + }; + Validator2.prototype.testType = function validateType(instance, schema2, options, ctx, type2) { + if (type2 === void 0) { + return; + } else if (type2 === null) { + throw new SchemaError('Unexpected null in "type" keyword'); + } + if (typeof this.types[type2] == "function") { + return this.types[type2].call(this, instance); + } + if (type2 && typeof type2 == "object") { + var res = this.validateSchema(instance, type2, options, ctx); + return res === void 0 || !(res && res.errors.length); + } + return true; + }; + var types = Validator2.prototype.types = {}; + types.string = function testString(instance) { + return typeof instance == "string"; + }; + types.number = function testNumber(instance) { + return typeof instance == "number" && isFinite(instance); + }; + types.integer = function testInteger(instance) { + return typeof instance == "number" && instance % 1 === 0; + }; + types.boolean = function testBoolean(instance) { + return typeof instance == "boolean"; + }; + types.array = function testArray(instance) { + return Array.isArray(instance); + }; + types["null"] = function testNull(instance) { + return instance === null; + }; + types.date = function testDate(instance) { + return instance instanceof Date; + }; + types.any = function testAny(instance) { + return true; + }; + types.object = function testObject(instance) { + return instance && typeof instance === "object" && !Array.isArray(instance) && !(instance instanceof Date); + }; + module2.exports = Validator2; + } +}); + +// node_modules/jsonschema/lib/index.js +var require_lib3 = __commonJS({ + "node_modules/jsonschema/lib/index.js"(exports2, module2) { + "use strict"; + var Validator2 = module2.exports.Validator = require_validator(); + module2.exports.ValidatorResult = require_helpers3().ValidatorResult; + module2.exports.ValidatorResultError = require_helpers3().ValidatorResultError; + module2.exports.ValidationError = require_helpers3().ValidationError; + module2.exports.SchemaError = require_helpers3().SchemaError; + module2.exports.SchemaScanResult = require_scan().SchemaScanResult; + module2.exports.scan = require_scan().scan; + module2.exports.validate = function(instance, schema2, options) { + var v = new Validator2(); + return v.validate(instance, schema2, options); + }; + } +}); + // src/start-proxy-action.ts var import_child_process = require("child_process"); -var path2 = __toESM(require("path")); +var path3 = __toESM(require("path")); var core11 = __toESM(require_core()); var import_node_forge = __toESM(require_lib2()); @@ -117450,21 +117451,21 @@ async function getFolderSize(itemPath, options) { getFolderSize.loose = async (itemPath, options) => await core(itemPath, options); getFolderSize.strict = async (itemPath, options) => await core(itemPath, options, { strict: true }); async function core(rootItemPath, options = {}, returnType = {}) { - const fs = options.fs || await import("node:fs/promises"); + const fs2 = options.fs || await import("node:fs/promises"); let folderSize = 0n; const foundInos = /* @__PURE__ */ new Set(); const errors = []; await processItem(rootItemPath); async function processItem(itemPath) { if (options.ignore?.test(itemPath)) return; - const stats = returnType.strict ? await fs.lstat(itemPath, { bigint: true }) : await fs.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); + const stats = returnType.strict ? await fs2.lstat(itemPath, { bigint: true }) : await fs2.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); if (typeof stats !== "object") return; if (!foundInos.has(stats.ino)) { foundInos.add(stats.ino); folderSize += stats.size; } if (stats.isDirectory()) { - const directoryItems = returnType.strict ? await fs.readdir(itemPath) : await fs.readdir(itemPath).catch((error3) => errors.push(error3)); + const directoryItems = returnType.strict ? await fs2.readdir(itemPath) : await fs2.readdir(itemPath).catch((error3) => errors.push(error3)); if (typeof directoryItems !== "object") return; await Promise.all( directoryItems.map( @@ -120087,6 +120088,34 @@ var safeDump = renamed("safeDump", "dump"); var semver = __toESM(require_semver2()); var GITHUB_DOTCOM_URL = "https://github.com"; var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024; +function parseGitHubUrl(inputUrl) { + const originalUrl = inputUrl; + if (inputUrl.indexOf("://") === -1) { + inputUrl = `https://${inputUrl}`; + } + if (!inputUrl.startsWith("http://") && !inputUrl.startsWith("https://")) { + throw new ConfigurationError(`"${originalUrl}" is not a http or https URL`); + } + let url; + try { + url = new URL(inputUrl); + } catch { + throw new ConfigurationError(`"${originalUrl}" is not a valid URL`); + } + if (url.hostname === "github.com" || url.hostname === "api.github.com") { + return GITHUB_DOTCOM_URL; + } + if (url.pathname.indexOf("/api/v3") !== -1) { + url.pathname = url.pathname.substring(0, url.pathname.indexOf("/api/v3")); + } + if (url.hostname.startsWith("api.")) { + url.hostname = url.hostname.substring(4); + } + if (!url.pathname.endsWith("/")) { + url.pathname = `${url.pathname}/`; + } + return url.toString(); +} function getRequiredEnvParam(paramName) { const value = process.env[paramName]; if (value === void 0 || value.length === 0) { @@ -120122,6 +120151,9 @@ var cachedCodeQlVersion = void 0; function getCachedCodeQlVersion() { return cachedCodeQlVersion; } +async function codeQlVersionAtLeast(codeql, requiredVersion) { + return semver.gte((await codeql.getVersion()).version, requiredVersion); +} async function delay(milliseconds, opts) { const { allowProcessExit } = opts || {}; return new Promise((resolve2) => { @@ -120235,6 +120267,10 @@ function getWorkflowRunAttempt() { function isSelfHostedRunner() { return process.env.RUNNER_ENVIRONMENT === "self-hosted"; } +var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer"; +function isCCR() { + return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false; +} var persistedInputsKey = "persisted_inputs"; var persistInputs = function() { const inputEnvironmentVariables = Object.entries(process.env).filter( @@ -120243,27 +120279,8 @@ var persistInputs = function() { core4.saveState(persistedInputsKey, JSON.stringify(inputEnvironmentVariables)); }; -// src/logging.ts -var core5 = __toESM(require_core()); -function getActionsLogger() { - return { - debug: core5.debug, - info: core5.info, - warning: core5.warning, - error: core5.error, - isDebug: core5.isDebug, - startGroup: core5.startGroup, - endGroup: core5.endGroup - }; -} - -// src/start-proxy.ts -var path = __toESM(require("path")); -var core10 = __toESM(require_core()); -var toolcache = __toESM(require_tool_cache()); - // src/api-client.ts -var core6 = __toESM(require_core()); +var core5 = __toESM(require_core()); var githubUtils = __toESM(require_utils5()); // node_modules/@octokit/plugin-retry/dist-bundle/index.js @@ -120281,7 +120298,7 @@ async function errorRequest(state, octokit, error3, options) { } throw error3; } -async function wrapRequest(state, octokit, request2, options) { +async function wrapRequest(state, octokit, request3, options) { const limiter = new import_light.default(); limiter.on("failed", function(error3, info6) { const maxRetries = ~~error3.request.request.retries; @@ -120292,12 +120309,12 @@ async function wrapRequest(state, octokit, request2, options) { } }); return limiter.schedule( - requestWithGraphqlErrorHandling.bind(null, state, octokit, request2), + requestWithGraphqlErrorHandling.bind(null, state, octokit, request3), options ); } -async function requestWithGraphqlErrorHandling(state, octokit, request2, options) { - const response = await request2(request2, options); +async function requestWithGraphqlErrorHandling(state, octokit, request3, options) { + const response = await request3(request3, options); if (response.data && response.data.errors && response.data.errors.length > 0 && /Something went wrong while executing your query/.test( response.data.errors[0].message )) { @@ -120362,6 +120379,7 @@ function parseRepositoryNwo(input) { } // src/api-client.ts +var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version"; function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) { const auth2 = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth; const retryingOctokit = githubUtils.GitHub.plugin(retry); @@ -120370,10 +120388,16 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) baseUrl: apiDetails.apiURL, userAgent: `CodeQL-Action/${getActionVersion()}`, log: { - debug: core6.debug, - info: core6.info, - warn: core6.warning, - error: core6.error + debug: core5.debug, + info: core5.info, + warn: core5.warning, + error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -120396,6 +120420,30 @@ function getAuthorizationHeaderFor(logger, apiDetails, url) { logger.debug(`Not using an authorization token.`); return void 0; } +var cachedGitHubVersion = void 0; +async function getGitHubVersionFromApi(apiClient, apiDetails) { + if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) { + return { type: "GitHub.com" /* DOTCOM */ }; + } + const response = await apiClient.rest.meta.get(); + if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) { + return { type: "GitHub.com" /* DOTCOM */ }; + } + if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") { + return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ }; + } + const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER]; + return { type: "GitHub Enterprise Server" /* GHES */, version }; +} +async function getGitHubVersion() { + if (cachedGitHubVersion === void 0) { + cachedGitHubVersion = await getGitHubVersionFromApi( + getApiClient(), + getApiDetails() + ); + } + return cachedGitHubVersion; +} async function getWorkflowRelativePath() { const repo_nwo = getRepositoryNwo(); const run_id = Number(getRequiredEnvParam("GITHUB_RUN_ID")); @@ -120424,112 +120472,34 @@ async function getAnalysisKey() { const workflowPath = await getWorkflowRelativePath(); const jobName = getRequiredEnvParam("GITHUB_JOB"); analysisKey = `${workflowPath}:${jobName}`; - core6.exportVariable("CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */, analysisKey); + core5.exportVariable("CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */, analysisKey); return analysisKey; } -// src/artifact-scanner.ts -var exec = __toESM(require_exec()); -var GITHUB_PAT_CLASSIC_PATTERN = { - type: "Personal Access Token (Classic)" /* PersonalAccessClassic */, - pattern: /\bghp_[a-zA-Z0-9]{36}\b/g -}; -var GITHUB_PAT_FINE_GRAINED_PATTERN = { - type: "Personal Access Token (Fine-grained)" /* PersonalAccessFineGrained */, - pattern: /\bgithub_pat_[a-zA-Z0-9_]+\b/g -}; -var GITHUB_TOKEN_PATTERNS = [ - GITHUB_PAT_CLASSIC_PATTERN, - GITHUB_PAT_FINE_GRAINED_PATTERN, - { - type: "OAuth Access Token" /* OAuth */, - pattern: /\bgho_[a-zA-Z0-9]{36}\b/g - }, - { - type: "User-to-Server Token" /* UserToServer */, - pattern: /\bghu_[a-zA-Z0-9]{36}\b/g - }, - { - type: "Server-to-Server Token" /* ServerToServer */, - pattern: /\bghs_[a-zA-Z0-9]{36}\b/g - }, - { - type: "Refresh Token" /* Refresh */, - pattern: /\bghr_[a-zA-Z0-9]{36}\b/g - }, - { - type: "App Installation Access Token" /* AppInstallationAccess */, - pattern: /\bghs_[a-zA-Z0-9]{255}\b/g - } -]; -function isAuthToken(value, patterns = GITHUB_TOKEN_PATTERNS) { - for (const { type: type2, pattern } of patterns) { - if (value.match(pattern)) { - return type2; - } - } - return void 0; -} +// src/feature-flags.ts +var fs = __toESM(require("fs")); +var path = __toESM(require("path")); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.24.1"; var cliVersion = "2.24.1"; -// src/languages.ts -var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => { - KnownLanguage2["actions"] = "actions"; - KnownLanguage2["cpp"] = "cpp"; - KnownLanguage2["csharp"] = "csharp"; - KnownLanguage2["go"] = "go"; - KnownLanguage2["java"] = "java"; - KnownLanguage2["javascript"] = "javascript"; - KnownLanguage2["python"] = "python"; - KnownLanguage2["ruby"] = "ruby"; - KnownLanguage2["rust"] = "rust"; - KnownLanguage2["swift"] = "swift"; - return KnownLanguage2; -})(KnownLanguage || {}); - -// src/status-report.ts -var os = __toESM(require("os")); -var core9 = __toESM(require_core()); - -// src/analyses.ts -var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { - AnalysisKind2["CodeScanning"] = "code-scanning"; - AnalysisKind2["CodeQuality"] = "code-quality"; - return AnalysisKind2; -})(AnalysisKind || {}); -var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); - -// src/caching-utils.ts -var core7 = __toESM(require_core()); - -// src/config/db-config.ts -var jsonschema = __toESM(require_lib3()); -var semver2 = __toESM(require_semver2()); -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); - -// src/feature-flags.ts -var semver5 = __toESM(require_semver2()); - // src/overlay-database-utils.ts var actionsCache = __toESM(require_cache5()); +// src/caching-utils.ts +var core6 = __toESM(require_core()); + // src/git-utils.ts -var core8 = __toESM(require_core()); +var core7 = __toESM(require_core()); var toolrunner2 = __toESM(require_toolrunner()); var io3 = __toESM(require_io()); -var semver3 = __toESM(require_semver2()); +var semver2 = __toESM(require_semver2()); var runGitCommand = async function(workingDirectory, args, customErrorMessage, options) { let stdout = ""; let stderr = ""; - core8.debug(`Running git command: git ${args.join(" ")}`); + core7.debug(`Running git command: git ${args.join(" ")}`); try { await new toolrunner2.ToolRunner(await io3.which("git", true), args, { silent: true, @@ -120550,7 +120520,7 @@ var runGitCommand = async function(workingDirectory, args, customErrorMessage, o if (stderr.includes("not a git repository")) { reason = "The checkout path provided to the action does not appear to be a git repository."; } - core8.info(`git call failed. ${customErrorMessage} Error: ${reason}`); + core7.info(`git call failed. ${customErrorMessage} Error: ${reason}`); throw error3; } }; @@ -120606,7 +120576,7 @@ async function getRef() { ) !== head; if (hasChangedRef) { const newRef = ref.replace(pull_ref_regex, "refs/pull/$1/head"); - core8.debug( + core7.debug( `No longer on merge commit, rewriting ref from ${ref} to ${newRef}.` ); return newRef; @@ -120615,15 +120585,31 @@ async function getRef() { } } +// src/logging.ts +var core8 = __toESM(require_core()); +function getActionsLogger() { + return { + debug: core8.debug, + info: core8.info, + warning: core8.warning, + error: core8.error, + isDebug: core8.isDebug, + startGroup: core8.startGroup, + endGroup: core8.endGroup + }; +} + // src/overlay-database-utils.ts var CODEQL_OVERLAY_MINIMUM_VERSION = "2.23.8"; var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB = 7500; var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_BYTES = OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB * 1e6; // src/tools-features.ts -var semver4 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); // src/feature-flags.ts +var DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_"; +var DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled"; var featureConfig = { ["allow_toolcache_input" /* AllowToolcacheInput */]: { defaultValue: false, @@ -120815,6 +120801,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -120832,6 +120823,374 @@ var featureConfig = { minimumVersion: void 0 } }; +var FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json"; +var Features = class { + constructor(gitHubVersion, repositoryNwo, tempDir, logger) { + this.logger = logger; + this.gitHubFeatureFlags = new GitHubFeatureFlags( + gitHubVersion, + repositoryNwo, + path.join(tempDir, FEATURE_FLAGS_FILE_NAME), + logger + ); + } + gitHubFeatureFlags; + async getDefaultCliVersion(variant) { + return await this.gitHubFeatureFlags.getDefaultCliVersion(variant); + } + /** + * + * @param feature The feature to check. + * @param codeql An optional CodeQL object. If provided, and a `minimumVersion` is specified for the + * feature, the version of the CodeQL CLI will be checked against the minimum version. + * If the version is less than the minimum version, the feature will be considered + * disabled. If not provided, and a `minimumVersion` is specified for the feature, the + * this function will throw. + * @returns true if the feature is enabled, false otherwise. + * + * @throws if a `minimumVersion` is specified for the feature, and `codeql` is not provided. + */ + async getValue(feature, codeql) { + const config = featureConfig[feature]; + if (!codeql && config.minimumVersion) { + throw new Error( + `Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.` + ); + } + if (!codeql && config.toolsFeature) { + throw new Error( + `Internal error: A required tools feature is specified for feature ${feature}, but no instance of CodeQL was provided.` + ); + } + const envVar = (process.env[config.envVar] || "").toLocaleLowerCase(); + if (envVar === "false") { + this.logger.debug( + `Feature ${feature} is disabled via the environment variable ${config.envVar}.` + ); + return false; + } + const minimumVersion = config.minimumVersion; + if (codeql && minimumVersion) { + if (!await codeQlVersionAtLeast(codeql, minimumVersion)) { + this.logger.debug( + `Feature ${feature} is disabled because the CodeQL CLI version is older than the minimum version ${minimumVersion}.` + ); + return false; + } else { + this.logger.debug( + `CodeQL CLI version ${(await codeql.getVersion()).version} is newer than the minimum version ${minimumVersion} for feature ${feature}.` + ); + } + } + const toolsFeature = config.toolsFeature; + if (codeql && toolsFeature) { + if (!await codeql.supportsFeature(toolsFeature)) { + this.logger.debug( + `Feature ${feature} is disabled because the CodeQL CLI version does not support the required tools feature ${toolsFeature}.` + ); + return false; + } else { + this.logger.debug( + `CodeQL CLI version ${(await codeql.getVersion()).version} supports the required tools feature ${toolsFeature} for feature ${feature}.` + ); + } + } + if (envVar === "true") { + this.logger.debug( + `Feature ${feature} is enabled via the environment variable ${config.envVar}.` + ); + return true; + } + const apiValue = await this.gitHubFeatureFlags.getValue(feature); + if (apiValue !== void 0) { + this.logger.debug( + `Feature ${feature} is ${apiValue ? "enabled" : "disabled"} via the GitHub API.` + ); + return apiValue; + } + const defaultValue = config.defaultValue; + this.logger.debug( + `Feature ${feature} is ${defaultValue ? "enabled" : "disabled"} due to its default value.` + ); + return defaultValue; + } +}; +var GitHubFeatureFlags = class { + constructor(gitHubVersion, repositoryNwo, featureFlagsFile, logger) { + this.gitHubVersion = gitHubVersion; + this.repositoryNwo = repositoryNwo; + this.featureFlagsFile = featureFlagsFile; + this.logger = logger; + this.hasAccessedRemoteFeatureFlags = false; + } + cachedApiResponse; + // We cache whether the feature flags were accessed or not in order to accurately report whether flags were + // incorrectly configured vs. inaccessible in our telemetry. + hasAccessedRemoteFeatureFlags; + getCliVersionFromFeatureFlag(f) { + if (!f.startsWith(DEFAULT_VERSION_FEATURE_FLAG_PREFIX) || !f.endsWith(DEFAULT_VERSION_FEATURE_FLAG_SUFFIX)) { + return void 0; + } + const version = f.substring( + DEFAULT_VERSION_FEATURE_FLAG_PREFIX.length, + f.length - DEFAULT_VERSION_FEATURE_FLAG_SUFFIX.length + ).replace(/_/g, "."); + if (!semver4.valid(version)) { + this.logger.warning( + `Ignoring feature flag ${f} as it does not specify a valid CodeQL version.` + ); + return void 0; + } + return version; + } + async getDefaultCliVersion(variant) { + if (supportsFeatureFlags(variant)) { + return await this.getDefaultCliVersionFromFlags(); + } + return { + cliVersion, + tagName: bundleVersion + }; + } + async getDefaultCliVersionFromFlags() { + const response = await this.getAllFeatures(); + const enabledFeatureFlagCliVersions = Object.entries(response).map( + ([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0 + ).filter((f) => f !== void 0); + if (enabledFeatureFlagCliVersions.length === 0) { + this.logger.warning( + `Feature flags do not specify a default CLI version. Falling back to the CLI version shipped with the Action. This is ${cliVersion}.` + ); + const result = { + cliVersion, + tagName: bundleVersion + }; + if (this.hasAccessedRemoteFeatureFlags) { + result.toolsFeatureFlagsValid = false; + } + return result; + } + const maxCliVersion = enabledFeatureFlagCliVersions.reduce( + (maxVersion, currentVersion) => currentVersion > maxVersion ? currentVersion : maxVersion, + enabledFeatureFlagCliVersions[0] + ); + this.logger.debug( + `Derived default CLI version of ${maxCliVersion} from feature flags.` + ); + return { + cliVersion: maxCliVersion, + tagName: `codeql-bundle-v${maxCliVersion}`, + toolsFeatureFlagsValid: true + }; + } + async getValue(feature) { + const response = await this.getAllFeatures(); + if (response === void 0) { + this.logger.debug(`No feature flags API response for ${feature}.`); + return void 0; + } + const features = response[feature]; + if (features === void 0) { + this.logger.debug(`Feature '${feature}' undefined in API response.`); + return void 0; + } + return !!features; + } + async getAllFeatures() { + if (this.cachedApiResponse !== void 0) { + return this.cachedApiResponse; + } + const fileFlags = await this.readLocalFlags(); + if (fileFlags !== void 0) { + this.cachedApiResponse = fileFlags; + return fileFlags; + } + let remoteFlags = await this.loadApiResponse(); + if (remoteFlags === void 0) { + remoteFlags = {}; + } + this.cachedApiResponse = remoteFlags; + await this.writeLocalFlags(remoteFlags); + return remoteFlags; + } + async readLocalFlags() { + try { + if (fs.existsSync(this.featureFlagsFile)) { + this.logger.debug( + `Loading feature flags from ${this.featureFlagsFile}` + ); + return JSON.parse( + fs.readFileSync(this.featureFlagsFile, "utf8") + ); + } + } catch (e) { + this.logger.warning( + `Error reading cached feature flags file ${this.featureFlagsFile}: ${e}. Requesting from GitHub instead.` + ); + } + return void 0; + } + async writeLocalFlags(flags) { + try { + this.logger.debug(`Writing feature flags to ${this.featureFlagsFile}`); + fs.writeFileSync(this.featureFlagsFile, JSON.stringify(flags)); + } catch (e) { + this.logger.warning( + `Error writing cached feature flags file ${this.featureFlagsFile}: ${e}.` + ); + } + } + async loadApiResponse() { + if (!supportsFeatureFlags(this.gitHubVersion.type)) { + this.logger.debug( + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + try { + const featuresToRequest = Object.entries(featureConfig).filter( + ([, config]) => !config.legacyApi + ).map(([f]) => f); + const FEATURES_PER_REQUEST = 25; + const featureChunks = []; + while (featuresToRequest.length > 0) { + featureChunks.push(featuresToRequest.splice(0, FEATURES_PER_REQUEST)); + } + let remoteFlags = {}; + for (const chunk of featureChunks) { + const response = await getApiClient().request( + "GET /repos/:owner/:repo/code-scanning/codeql-action/features", + { + owner: this.repositoryNwo.owner, + repo: this.repositoryNwo.repo, + features: chunk.join(",") + } + ); + const chunkFlags = response.data; + remoteFlags = { ...remoteFlags, ...chunkFlags }; + } + this.logger.debug( + "Loaded the following default values for the feature flags from the CodeQL Action API:" + ); + for (const [feature, value] of Object.entries(remoteFlags).sort( + ([nameA], [nameB]) => nameA.localeCompare(nameB) + )) { + this.logger.debug(` ${feature}: ${value}`); + } + this.hasAccessedRemoteFeatureFlags = true; + return remoteFlags; + } catch (e) { + const httpError = asHTTPError(e); + if (httpError?.status === 403) { + this.logger.warning( + `This run of the CodeQL Action does not have permission to access the CodeQL Action API endpoints. As a result, it will not be opted into any experimental features. This could be because the Action is running on a pull request from a fork. If not, please ensure the workflow has at least the 'security-events: read' permission. Details: ${httpError.message}` + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } else { + throw new Error( + `Encountered an error while trying to determine feature enablement: ${e}` + ); + } + } + } +}; +function supportsFeatureFlags(githubVariant) { + return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */; +} + +// src/start-proxy.ts +var path2 = __toESM(require("path")); +var core10 = __toESM(require_core()); +var toolcache = __toESM(require_tool_cache()); + +// src/artifact-scanner.ts +var exec = __toESM(require_exec()); +var GITHUB_PAT_CLASSIC_PATTERN = { + type: "Personal Access Token (Classic)" /* PersonalAccessClassic */, + pattern: /\bghp_[a-zA-Z0-9]{36}\b/g +}; +var GITHUB_PAT_FINE_GRAINED_PATTERN = { + type: "Personal Access Token (Fine-grained)" /* PersonalAccessFineGrained */, + pattern: /\bgithub_pat_[a-zA-Z0-9_]+\b/g +}; +var GITHUB_TOKEN_PATTERNS = [ + GITHUB_PAT_CLASSIC_PATTERN, + GITHUB_PAT_FINE_GRAINED_PATTERN, + { + type: "OAuth Access Token" /* OAuth */, + pattern: /\bgho_[a-zA-Z0-9]{36}\b/g + }, + { + type: "User-to-Server Token" /* UserToServer */, + pattern: /\bghu_[a-zA-Z0-9]{36}\b/g + }, + { + type: "Server-to-Server Token" /* ServerToServer */, + pattern: /\bghs_[a-zA-Z0-9]{36}\b/g + }, + { + type: "Refresh Token" /* Refresh */, + pattern: /\bghr_[a-zA-Z0-9]{36}\b/g + }, + { + type: "App Installation Access Token" /* AppInstallationAccess */, + pattern: /\bghs_[a-zA-Z0-9]{255}\b/g + } +]; +function isAuthToken(value, patterns = GITHUB_TOKEN_PATTERNS) { + for (const { type: type2, pattern } of patterns) { + if (value.match(pattern)) { + return type2; + } + } + return void 0; +} + +// src/languages.ts +var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => { + KnownLanguage2["actions"] = "actions"; + KnownLanguage2["cpp"] = "cpp"; + KnownLanguage2["csharp"] = "csharp"; + KnownLanguage2["go"] = "go"; + KnownLanguage2["java"] = "java"; + KnownLanguage2["javascript"] = "javascript"; + KnownLanguage2["python"] = "python"; + KnownLanguage2["ruby"] = "ruby"; + KnownLanguage2["rust"] = "rust"; + KnownLanguage2["swift"] = "swift"; + return KnownLanguage2; +})(KnownLanguage || {}); + +// src/status-report.ts +var os = __toESM(require("os")); +var core9 = __toESM(require_core()); + +// src/analyses.ts +var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { + AnalysisKind2["CodeScanning"] = "code-scanning"; + AnalysisKind2["CodeQuality"] = "code-quality"; + return AnalysisKind2; +})(AnalysisKind || {}); +var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); + +// src/config/db-config.ts +var jsonschema = __toESM(require_lib3()); +var semver5 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); // src/trap-caching.ts var actionsCache2 = __toESM(require_cache5()); @@ -121070,6 +121429,15 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } +// src/start-proxy/types.ts +function getAddressString(address) { + if (address.url === void 0) { + return address.host; + } else { + return address.url; + } +} + // src/start-proxy.ts function getStartProxyErrorMessage(errorType) { switch (errorType) { @@ -121167,6 +121535,23 @@ var LANGUAGE_TO_REGISTRY_TYPE = { rust: ["cargo_registry"], go: ["goproxy_server", "git_source"] }; +function getRegistryAddress(registry) { + if (isDefined2(registry.url)) { + return { + url: registry.url, + host: registry.host + }; + } else if (isDefined2(registry.host)) { + return { + url: void 0, + host: registry.host + }; + } else { + throw new ConfigurationError( + "Invalid credentials - must specify host or url" + ); + } +} function getCredentials(logger, registrySecrets, registriesCredentials, language) { const registryTypeForLanguage = language ? LANGUAGE_TO_REGISTRY_TYPE[language] : void 0; let credentialsStr; @@ -121197,17 +121582,16 @@ function getCredentials(logger, registrySecrets, registriesCredentials, language if (e === null || typeof e !== "object") { throw new ConfigurationError("Invalid credentials - must be an object"); } + if (!isDefined2(e.type)) { + throw new ConfigurationError("Invalid credentials - must have a type"); + } if (isDefined2(e.password)) { core10.setSecret(e.password); } if (isDefined2(e.token)) { core10.setSecret(e.token); } - if (!isDefined2(e.url) && !isDefined2(e.host)) { - throw new ConfigurationError( - "Invalid credentials - must specify host or url" - ); - } + const address = getRegistryAddress(e); if (registryTypeForLanguage && !registryTypeForLanguage.some((t) => t === e.type)) { continue; } @@ -121226,11 +121610,10 @@ function getCredentials(logger, registrySecrets, registriesCredentials, language } out.push({ type: e.type, - host: e.host, - url: e.url, username: e.username, password: e.password, - token: e.token + token: e.token, + ...address }); } return out; @@ -121344,7 +121727,93 @@ async function getProxyBinaryPath(logger) { proxyInfo.version ); } - return path.join(proxyBin, proxyFileName); + return path2.join(proxyBin, proxyFileName); +} + +// src/start-proxy/reachability.ts +var https = __toESM(require("https")); +var import_https_proxy_agent = __toESM(require_dist2()); +var ReachabilityError = class extends Error { + constructor(statusCode) { + super(); + this.statusCode = statusCode; + } +}; +var NetworkReachabilityBackend = class { + constructor(proxy) { + this.proxy = proxy; + this.agent = new import_https_proxy_agent.HttpsProxyAgent(`http://${proxy.host}:${proxy.port}`); + } + agent; + async checkConnection(url) { + return new Promise((resolve2, reject) => { + const req = https.request( + url, + { + agent: this.agent, + method: "HEAD", + ca: this.proxy.cert, + timeout: 5 * 1e3 + // 5 seconds + }, + (res) => { + res.destroy(); + if (res.statusCode !== void 0 && res.statusCode < 400) { + resolve2(res.statusCode); + } else { + reject(new ReachabilityError(res.statusCode)); + } + } + ); + req.on("error", (e) => { + reject(e); + }); + req.on("timeout", () => { + req.destroy(); + reject(new Error("Connection timeout.")); + }); + req.end(); + }); + } +}; +async function checkConnections(logger, proxy, backend) { + const result = /* @__PURE__ */ new Set(); + if (proxy.registries.length === 0) return result; + try { + if (backend === void 0) { + backend = new NetworkReachabilityBackend(proxy); + } + for (const registry of proxy.registries) { + const address = getAddressString(registry); + const url = URL.parse(address); + if (url === null) { + logger.info( + `Skipping check for ${address} since it is not a valid URL.` + ); + continue; + } + try { + logger.debug(`Testing connection to ${url}...`); + const statusCode = await backend.checkConnection(url); + logger.info(`Successfully tested connection to ${url} (${statusCode})`); + result.add(registry); + } catch (e) { + if (e instanceof ReachabilityError && e.statusCode !== void 0) { + logger.error(`Connection test to ${url} failed. (${e.statusCode})`); + } else { + logger.error( + `Connection test to ${url} failed: ${getErrorMessage(e)}` + ); + } + } + } + logger.debug(`Finished testing connections to private registries.`); + } catch (e) { + logger.error( + `Failed to test connections to private registries: ${getErrorMessage(e)}` + ); + } + return result; } // src/start-proxy-action.ts @@ -121396,12 +121865,21 @@ function generateCertificateAuthority() { } async function run(startedAt) { const logger = getActionsLogger(); + let features; let language; try { persistInputs(); const tempDir = getTemporaryDirectory(); - const proxyLogFilePath = path2.resolve(tempDir, "proxy.log"); + const proxyLogFilePath = path3.resolve(tempDir, "proxy.log"); core11.saveState("proxy-log-file", proxyLogFilePath); + const repositoryNwo = getRepositoryNwo(); + const gitHubVersion = await getGitHubVersion(); + features = new Features( + gitHubVersion, + repositoryNwo, + getTemporaryDirectory(), + logger + ); const languageInput = getOptionalInput("language"); language = languageInput ? parseLanguage(languageInput) : void 0; const credentials = getCredentials( @@ -121424,7 +121902,15 @@ async function run(startedAt) { ca }; const proxyBin = await getProxyBinaryPath(logger); - await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); + const proxyInfo = await startProxy( + proxyBin, + proxyConfig, + proxyLogFilePath, + logger + ); + if (await features.getValue("start_proxy_connection_checks" /* StartProxyConnectionChecks */)) { + await checkConnections(logger, proxyInfo); + } await sendSuccessStatusReport( startedAt, { @@ -121496,6 +121982,7 @@ async function startProxy(binPath, config, logFilePath, logger) { url: credential.url })); core11.setOutput("proxy_urls", JSON.stringify(registry_urls)); + return { host, port, cert: config.ca.cert, registries: registry_urls }; } void runWrapper(); /*! Bundled license information: diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 15d879b91..037bd65f9 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -47283,7 +47283,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -47323,6 +47323,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -47332,7 +47333,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -47353,7 +47354,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -106276,6 +106277,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -107156,6 +107163,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index c29ff1b0b..a4e388f94 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -160811,6 +160812,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -161263,6 +161270,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index dc14cce6e..0a5c86a07 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -45986,7 +45986,7 @@ var require_package = __commonJS({ "package.json"(exports2, module2) { module2.exports = { name: "codeql", - version: "3.32.2", + version: "3.32.3", private: true, description: "CodeQL action", scripts: { @@ -46026,6 +46026,7 @@ var require_package = __commonJS({ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", jsonschema: "1.4.1", long: "^5.3.2", @@ -46035,7 +46036,7 @@ var require_package = __commonJS({ }, devDependencies: { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -46056,7 +46057,7 @@ var require_package = __commonJS({ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", glob: "^11.1.0", nock: "^14.0.10", @@ -106322,6 +106323,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); @@ -106951,6 +106958,11 @@ var featureConfig = { // cannot be found when interpreting results. minimumVersion: void 0 }, + ["start_proxy_connection_checks" /* StartProxyConnectionChecks */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -107188,7 +107200,14 @@ var GitHubFeatureFlags = class { async loadApiResponse() { if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features." + "Not running against github.com. Using default values for all features." + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features." ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/package-lock.json b/package-lock.json index 1f120c984..34105dcc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codeql", - "version": "4.32.2", + "version": "4.32.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codeql", - "version": "4.32.2", + "version": "4.32.3", "license": "MIT", "dependencies": { "@actions/artifact": "^5.0.3", @@ -25,6 +25,7 @@ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", "jsonschema": "1.4.1", "long": "^5.3.2", @@ -34,7 +35,7 @@ }, "devDependencies": { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -55,7 +56,7 @@ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", "glob": "^11.1.0", "nock": "^14.0.10", @@ -1341,19 +1342,19 @@ } }, "node_modules/@eslint/compat": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.0.1.tgz", - "integrity": "sha512-yl/JsgplclzuvGFNqwNYV4XNPhP3l62ZOP9w/47atNAdmDtIFCx6X7CSk/SlWUuBGkT4Et/5+UD+WyvX2iiIWA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.0.2.tgz", + "integrity": "sha512-pR1DoD0h3HfF675QZx0xsyrsU8q70Z/plx7880NOhS02NuWLgBCOMDL787nUeQ7EWLkxv3bPQJaarjcPQb2Dwg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.0.1" + "@eslint/core": "^1.1.0" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" }, "peerDependencies": { - "eslint": "^8.40 || 9" + "eslint": "^8.40 || 9 || 10" }, "peerDependenciesMeta": { "eslint": { @@ -1362,9 +1363,9 @@ } }, "node_modules/@eslint/core": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.0.1.tgz", - "integrity": "sha512-r18fEAj9uCk+VjzGt2thsbOmychS+4kxI14spVNibUO2vqKX7obOG+ymZljAwuPZl+S3clPGwCwTDtrdqTiY6Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.0.tgz", + "integrity": "sha512-/nr9K9wkr3P1EzFTdFdMoLuo1PmIxjmwvPozwoSodjNBdefGujXQUF93u1DDZpEaTuDvMsIQddsd35BwtrW9Xw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -4885,9 +4886,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "62.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.4.1.tgz", - "integrity": "sha512-HgX2iN4j104D/mCUqRbhtzSZbph+KO9jfMHiIJjJ19Q+IwLQ5Na2IqvOJYq4S+4kgvEk1w6KYF4vVus6H2wcHg==", + "version": "62.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.5.0.tgz", + "integrity": "sha512-D+1haMVDzW/ZMoPwOnsbXCK07rJtsq98Z1v+ApvDKxSzYTTcPgmFc/nyUDCGmxm2cP7g7hszyjYHO7Zodl/43w==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -5999,6 +6000,7 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", "dependencies": { "agent-base": "^7.1.2", "debug": "4" diff --git a/package.json b/package.json index d5fd12fa0..52087ecb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codeql", - "version": "3.32.2", + "version": "3.32.3", "private": true, "description": "CodeQL action", "scripts": { @@ -40,6 +40,7 @@ "fast-deep-equal": "^3.1.3", "follow-redirects": "^1.15.11", "get-folder-size": "^5.0.0", + "https-proxy-agent": "^7.0.6", "js-yaml": "^4.1.1", "jsonschema": "1.4.1", "long": "^5.3.2", @@ -49,7 +50,7 @@ }, "devDependencies": { "@ava/typescript": "6.0.0", - "@eslint/compat": "^2.0.1", + "@eslint/compat": "^2.0.2", "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.2", "@microsoft/eslint-formatter-sarif": "^3.1.0", @@ -70,7 +71,7 @@ "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.5.0", "eslint-plugin-no-async-foreach": "^0.1.1", "glob": "^11.1.0", "nock": "^14.0.10", diff --git a/pr-checks/checks/rubocop-multi-language.yml b/pr-checks/checks/rubocop-multi-language.yml index f4f4567da..e88ddbeda 100644 --- a/pr-checks/checks/rubocop-multi-language.yml +++ b/pr-checks/checks/rubocop-multi-language.yml @@ -4,7 +4,7 @@ description: "Tests using RuboCop to analyze a multi-language repository and the versions: ["default"] steps: - name: Set up Ruby - uses: ruby/setup-ruby@90be1154f987f4dc0fe0dd0feedac9e473aa4ba8 # v1.286.0 + uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0 with: ruby-version: 2.6 - name: Install Code Scanning integration diff --git a/src/api-client.test.ts b/src/api-client.test.ts index 073f68ff1..3af9ae282 100644 --- a/src/api-client.test.ts +++ b/src/api-client.test.ts @@ -36,6 +36,9 @@ test("getApiClient", async (t) => { baseUrl: "http://api.github.localhost", log: sinon.match.any, userAgent: `CodeQL-Action/${actionsUtil.getActionVersion()}`, + retry: { + doNotRetry: [400, 410, 422, 451], + }, }), ); }); diff --git a/src/api-client.ts b/src/api-client.ts index f2fe01edf..13babcd38 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -51,6 +51,12 @@ function createApiClientWithDetails( warn: core.warning, error: core.error, }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451], + }, }), ); } diff --git a/src/feature-flags.test.ts b/src/feature-flags.test.ts index cdab85e27..6632cf252 100644 --- a/src/feature-flags.test.ts +++ b/src/feature-flags.test.ts @@ -4,6 +4,7 @@ import * as path from "path"; import test, { ExecutionContext } from "ava"; import * as defaults from "./defaults.json"; +import { EnvVar } from "./environment"; import { Feature, featureConfig, @@ -37,29 +38,39 @@ test.beforeEach(() => { const testRepositoryNwo = parseRepositoryNwo("github/example"); -test(`All features are disabled if running against GHES`, async (t) => { +test(`All features use default values if running against GHES`, async (t) => { await withTmpDir(async (tmpDir) => { - const loggedMessages = []; + const loggedMessages: LoggedMessage[] = []; const features = setUpFeatureFlagTests( tmpDir, getRecordingLogger(loggedMessages), { type: GitHubVariant.GHES, version: "3.0.0" }, ); - for (const feature of Object.values(Feature)) { - t.deepEqual( - await getFeatureIncludingCodeQlIfRequired(features, feature), - featureConfig[feature].defaultValue, - ); - } + await assertAllFeaturesHaveDefaultValues(t, features); + assertLoggedMessage( + t, + loggedMessages, + "Not running against github.com. Using default values for all features.", + ); + }); +}); - t.assert( - loggedMessages.find( - (v: LoggedMessage) => - v.type === "debug" && - v.message === - "Not running against github.com. Disabling all toggleable features.", - ) !== undefined, +test(`All features use default values if running in CCR`, async (t) => { + await withTmpDir(async (tmpDir) => { + const loggedMessages: LoggedMessage[] = []; + const features = setUpFeatureFlagTests( + tmpDir, + getRecordingLogger(loggedMessages), + ); + + process.env[EnvVar.ANALYSIS_KEY] = "dynamic/copilot-pull-request-reviewer"; + + await assertAllFeaturesHaveDefaultValues(t, features); + assertLoggedMessage( + t, + loggedMessages, + "Feature flags are not supported in Copilot Code Review. Using default values for all features.", ); }); }); @@ -542,6 +553,30 @@ test("non-legacy feature flags should not start with codeql_action_", async (t) } }); +async function assertAllFeaturesHaveDefaultValues( + t: ExecutionContext, + features: FeatureEnablement, +) { + for (const feature of Object.values(Feature)) { + t.deepEqual( + await getFeatureIncludingCodeQlIfRequired(features, feature), + featureConfig[feature].defaultValue, + ); + } +} + +function assertLoggedMessage( + t: ExecutionContext, + loggedMessages: LoggedMessage[], + expectedMessage: string, +) { + t.assert( + loggedMessages.find( + (v: LoggedMessage) => v.type === "debug" && v.message === expectedMessage, + ) !== undefined, + ); +} + function assertAllFeaturesUndefinedInApi( t: ExecutionContext, loggedMessages: LoggedMessage[], diff --git a/src/feature-flags.ts b/src/feature-flags.ts index 8de68a28d..04508089d 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -3,6 +3,7 @@ import * as path from "path"; import * as semver from "semver"; +import { isCCR } from "./actions-util"; import { getApiClient } from "./api-client"; import type { CodeQL } from "./codeql"; import * as defaults from "./defaults.json"; @@ -72,6 +73,7 @@ export enum Feature { QaTelemetryEnabled = "qa_telemetry_enabled", /** Note that this currently only disables baseline file coverage information. */ SkipFileCoverageOnPrs = "skip_file_coverage_on_prs", + StartProxyConnectionChecks = "start_proxy_connection_checks", UploadOverlayDbToApi = "upload_overlay_db_to_api", UseRepositoryProperties = "use_repository_properties", ValidateDbConfig = "validate_db_config", @@ -297,6 +299,11 @@ export const featureConfig = { // cannot be found when interpreting results. minimumVersion: undefined, }, + [Feature.StartProxyConnectionChecks]: { + defaultValue: false, + envVar: "CODEQL_ACTION_START_PROXY_CONNECTION_CHECKS", + minimumVersion: undefined, + }, [Feature.UploadOverlayDbToApi]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -658,7 +665,14 @@ class GitHubFeatureFlags { // Do nothing when not running against github.com if (!supportsFeatureFlags(this.gitHubVersion.type)) { this.logger.debug( - "Not running against github.com. Disabling all toggleable features.", + "Not running against github.com. Using default values for all features.", + ); + this.hasAccessedRemoteFeatureFlags = false; + return {}; + } + if (isCCR()) { + this.logger.debug( + "Feature flags are not supported in Copilot Code Review. Using default values for all features.", ); this.hasAccessedRemoteFeatureFlags = false; return {}; diff --git a/src/start-proxy-action.ts b/src/start-proxy-action.ts index 195df354b..a9b355eaa 100644 --- a/src/start-proxy-action.ts +++ b/src/start-proxy-action.ts @@ -5,18 +5,24 @@ import * as core from "@actions/core"; import { pki } from "node-forge"; import * as actionsUtil from "./actions-util"; +import { getGitHubVersion } from "./api-client"; +import { Feature, Features } from "./feature-flags"; import { KnownLanguage } from "./languages"; import { getActionsLogger, Logger } from "./logging"; +import { getRepositoryNwo } from "./repository"; import { - Credential, credentialToStr, getCredentials, getProxyBinaryPath, getSafeErrorMessage, parseLanguage, + ProxyInfo, sendFailedStatusReport, sendSuccessStatusReport, + Credential, + Registry, } from "./start-proxy"; +import { checkConnections } from "./start-proxy/reachability"; import { ActionName, sendUnhandledErrorStatusReport } from "./status-report"; import * as util from "./util"; @@ -34,6 +40,7 @@ type BasicAuthCredentials = { }; type ProxyConfig = { + /** The validated configurations for the proxy. */ all_credentials: Credential[]; ca: CertificateAuthority; proxy_auth?: BasicAuthCredentials; @@ -92,6 +99,7 @@ async function run(startedAt: Date) { // possible, and only use safe functions outside. const logger = getActionsLogger(); + let features: Features | undefined; let language: KnownLanguage | undefined; try { @@ -103,9 +111,21 @@ async function run(startedAt: Date) { const proxyLogFilePath = path.resolve(tempDir, "proxy.log"); core.saveState("proxy-log-file", proxyLogFilePath); - // Get the configuration options + // Initialise FFs. + const repositoryNwo = getRepositoryNwo(); + const gitHubVersion = await getGitHubVersion(); + features = new Features( + gitHubVersion, + repositoryNwo, + actionsUtil.getTemporaryDirectory(), + logger, + ); + + // Get the language input. const languageInput = actionsUtil.getOptionalInput("language"); language = languageInput ? parseLanguage(languageInput) : undefined; + + // Get the registry configurations from one of the inputs. const credentials = getCredentials( logger, actionsUtil.getOptionalInput("registry_secrets"), @@ -133,7 +153,17 @@ async function run(startedAt: Date) { // Start the Proxy const proxyBin = await getProxyBinaryPath(logger); - await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); + const proxyInfo = await startProxy( + proxyBin, + proxyConfig, + proxyLogFilePath, + logger, + ); + + // Check that the private registries are reachable. + if (await features.getValue(Feature.StartProxyConnectionChecks)) { + await checkConnections(logger, proxyInfo); + } // Report success if we have reached this point. await sendSuccessStatusReport( @@ -171,7 +201,7 @@ async function startProxy( config: ProxyConfig, logFilePath: string, logger: Logger, -) { +): Promise { const host = "127.0.0.1"; let port = 49152; let subprocess: ChildProcess | undefined = undefined; @@ -214,13 +244,15 @@ async function startProxy( core.setOutput("proxy_port", port.toString()); core.setOutput("proxy_ca_certificate", config.ca.cert); - const registry_urls = config.all_credentials + const registry_urls: Registry[] = config.all_credentials .filter((credential) => credential.url !== undefined) .map((credential) => ({ type: credential.type, url: credential.url, })); core.setOutput("proxy_urls", JSON.stringify(registry_urls)); + + return { host, port, cert: config.ca.cert, registries: registry_urls }; } void runWrapper(); diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 792944c09..321a41a29 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -175,6 +175,27 @@ test("getCredentials throws error when credential is not an object", async (t) = } }); +test("getCredentials throws error when credential is missing type", async (t) => { + const testCredentials = [[{ token: "abc", url: "https://localhost" }]].map( + toEncodedJSON, + ); + + for (const testCredential of testCredentials) { + t.throws( + () => + startProxyExports.getCredentials( + getRunnerLogger(true), + undefined, + testCredential, + undefined, + ), + { + message: "Invalid credentials - must have a type", + }, + ); + } +}); + test("getCredentials throws error when credential missing host and url", async (t) => { const testCredentials = [ [{ type: "npm_registry", token: "abc" }], @@ -396,13 +417,14 @@ test("credentialToStr - hides passwords", (t) => { const credential = { type: "maven_credential", password: secret, + url: "https://localhost", }; const str = startProxyExports.credentialToStr(credential); t.false(str.includes(secret)); t.is( - "Type: maven_credential; Host: undefined; Url: undefined Username: undefined; Password: true; Token: false", + "Type: maven_credential; Host: undefined; Url: https://localhost Username: undefined; Password: true; Token: false", str, ); }); @@ -412,13 +434,14 @@ test("credentialToStr - hides tokens", (t) => { const credential = { type: "maven_credential", token: secret, + url: "https://localhost", }; const str = startProxyExports.credentialToStr(credential); t.false(str.includes(secret)); t.is( - "Type: maven_credential; Host: undefined; Url: undefined Username: undefined; Password: false; Token: true", + "Type: maven_credential; Host: undefined; Url: https://localhost Username: undefined; Password: false; Token: true", str, ); }); diff --git a/src/start-proxy.ts b/src/start-proxy.ts index f592d076b..755c0a40c 100644 --- a/src/start-proxy.ts +++ b/src/start-proxy.ts @@ -13,6 +13,12 @@ import { Config } from "./config-utils"; import * as defaults from "./defaults.json"; import { KnownLanguage } from "./languages"; import { Logger } from "./logging"; +import { + Address, + RawCredential, + Registry, + Credential, +} from "./start-proxy/types"; import { ActionName, createStatusReportBase, @@ -23,6 +29,8 @@ import { import * as util from "./util"; import { ConfigurationError, getErrorMessage, isDefined } from "./util"; +export * from "./start-proxy/types"; + /** * Enumerates specific error types for which we have corresponding error messages that * are safe to include in status reports. @@ -161,15 +169,6 @@ export const UPDATEJOB_PROXY_VERSION = "v2.0.20250624110901"; const UPDATEJOB_PROXY_URL_PREFIX = "https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.22.0/"; -export type Credential = { - type: string; - host?: string; - url?: string; - username?: string; - password?: string; - token?: string; -}; - /* * Language aliases supported by the start-proxy Action. * @@ -229,6 +228,31 @@ const LANGUAGE_TO_REGISTRY_TYPE: Partial> = { go: ["goproxy_server", "git_source"], } as const; +/** + * Extracts an `Address` value from the given `Registry` value by determining whether it has + * a `url` value, or no `url` value but a `host` value. + * + * @throws A `ConfigurationError` if the `Registry` value contains neither a `url` or `host` field. + */ +function getRegistryAddress(registry: Partial): Address { + if (isDefined(registry.url)) { + return { + url: registry.url, + host: registry.host, + }; + } else if (isDefined(registry.host)) { + return { + url: undefined, + host: registry.host, + }; + } else { + // The proxy needs one of these to work. If both are defined, the url has the precedence. + throw new ConfigurationError( + "Invalid credentials - must specify host or url", + ); + } +} + // getCredentials returns registry credentials from action inputs. // It prefers `registries_credentials` over `registry_secrets`. // If neither is set, it returns an empty array. @@ -255,9 +279,9 @@ export function getCredentials( } // Parse and validate the credentials - let parsed: Credential[]; + let parsed: RawCredential[]; try { - parsed = JSON.parse(credentialsStr) as Credential[]; + parsed = JSON.parse(credentialsStr) as RawCredential[]; } catch { // Don't log the error since it might contain sensitive information. logger.error("Failed to parse the credentials data."); @@ -277,6 +301,11 @@ export function getCredentials( throw new ConfigurationError("Invalid credentials - must be an object"); } + // The configuration must have a type. + if (!isDefined(e.type)) { + throw new ConfigurationError("Invalid credentials - must have a type"); + } + // Mask credentials to reduce chance of accidental leakage in logs. if (isDefined(e.password)) { core.setSecret(e.password); @@ -285,12 +314,7 @@ export function getCredentials( core.setSecret(e.token); } - if (!isDefined(e.url) && !isDefined(e.host)) { - // The proxy needs one of these to work. If both are defined, the url has the precedence. - throw new ConfigurationError( - "Invalid credentials - must specify host or url", - ); - } + const address = getRegistryAddress(e); // Filter credentials based on language if specified. `type` is the registry type. // E.g., "maven_feed" for Java/Kotlin, "nuget_repository" for C#. @@ -333,11 +357,10 @@ export function getCredentials( out.push({ type: e.type, - host: e.host, - url: e.url, username: e.username, password: e.password, token: e.token, + ...address, }); } return out; diff --git a/src/start-proxy/reachability.test.ts b/src/start-proxy/reachability.test.ts new file mode 100644 index 000000000..cbba99399 --- /dev/null +++ b/src/start-proxy/reachability.test.ts @@ -0,0 +1,120 @@ +import test from "ava"; +import * as sinon from "sinon"; + +import { + checkExpectedLogMessages, + setupTests, + withRecordingLoggerAsync, +} from "./../testing-utils"; +import { + checkConnections, + ReachabilityBackend, + ReachabilityError, +} from "./reachability"; +import { ProxyInfo, Registry } from "./types"; + +setupTests(test); + +class MockReachabilityBackend implements ReachabilityBackend { + public async checkConnection(_url: URL): Promise { + return 200; + } +} + +const mavenRegistry: Registry = { + type: "maven_registry", + url: "https://repo.maven.apache.org/maven2/", +}; + +const nugetFeed: Registry = { + type: "nuget_feed", + url: "https://api.nuget.org/v3/index.json", +}; + +const proxyInfo: ProxyInfo = { + host: "127.0.0.1", + port: 1080, + cert: "", + registries: [mavenRegistry, nugetFeed], +}; + +test("checkConnections - basic functionality", async (t) => { + const backend = new MockReachabilityBackend(); + const messages = await withRecordingLoggerAsync(async (logger) => { + const reachable = await checkConnections(logger, proxyInfo, backend); + t.is(reachable.size, proxyInfo.registries.length); + t.true(reachable.has(mavenRegistry)); + t.true(reachable.has(nugetFeed)); + }); + checkExpectedLogMessages(t, messages, [ + `Testing connection to ${mavenRegistry.url}`, + `Successfully tested connection to ${mavenRegistry.url}`, + `Testing connection to ${nugetFeed.url}`, + `Successfully tested connection to ${nugetFeed.url}`, + `Finished testing connections`, + ]); +}); + +test("checkConnections - excludes failed status codes", async (t) => { + const backend = new MockReachabilityBackend(); + sinon + .stub(backend, "checkConnection") + .onSecondCall() + .throws(new ReachabilityError(400)); + const messages = await withRecordingLoggerAsync(async (logger) => { + const reachable = await checkConnections(logger, proxyInfo, backend); + t.is(reachable.size, 1); + t.true(reachable.has(mavenRegistry)); + }); + checkExpectedLogMessages(t, messages, [ + `Testing connection to ${mavenRegistry.url}`, + `Successfully tested connection to ${mavenRegistry.url}`, + `Testing connection to ${nugetFeed.url}`, + `Connection test to ${nugetFeed.url} failed. (400)`, + `Finished testing connections`, + ]); +}); + +test("checkConnections - handles other exceptions", async (t) => { + const backend = new MockReachabilityBackend(); + sinon + .stub(backend, "checkConnection") + .onSecondCall() + .throws(new Error("Some generic error")); + const messages = await withRecordingLoggerAsync(async (logger) => { + const reachable = await checkConnections(logger, proxyInfo, backend); + t.is(reachable.size, 1); + t.true(reachable.has(mavenRegistry)); + }); + checkExpectedLogMessages(t, messages, [ + `Testing connection to ${mavenRegistry.url}`, + `Successfully tested connection to ${mavenRegistry.url}`, + `Testing connection to ${nugetFeed.url}`, + `Connection test to ${nugetFeed.url} failed: Some generic error`, + `Finished testing connections`, + ]); +}); + +test("checkConnections - handles invalid URLs", async (t) => { + const backend = new MockReachabilityBackend(); + const messages = await withRecordingLoggerAsync(async (logger) => { + const reachable = await checkConnections( + logger, + { + ...proxyInfo, + registries: [ + { + type: "nuget_feed", + url: "localhost", + }, + ], + }, + backend, + ); + t.is(reachable.size, 0); + }); + checkExpectedLogMessages(t, messages, [ + `Skipping check for localhost since it is not a valid URL.`, + `Finished testing connections`, + ]); +}); diff --git a/src/start-proxy/reachability.ts b/src/start-proxy/reachability.ts new file mode 100644 index 000000000..2951c8a0c --- /dev/null +++ b/src/start-proxy/reachability.ts @@ -0,0 +1,130 @@ +import * as https from "https"; + +import { HttpsProxyAgent } from "https-proxy-agent"; + +import { Logger } from "../logging"; +import { getErrorMessage } from "../util"; + +import { getAddressString, ProxyInfo, Registry } from "./types"; + +export class ReachabilityError extends Error { + constructor(public readonly statusCode?: number | undefined) { + super(); + } +} + +/** + * Abstracts over the backend for the reachability checks, + * to allow actual networking to be replaced with stubs. + */ +export interface ReachabilityBackend { + /** + * Performs a test HTTP request to the specified `url`. Resolves to the status code, + * if a successful status code was obtained. Otherwise throws + * + * @param url The URL of the registry to try and reach. + * @returns The successful status code (in the `<400` range). + */ + checkConnection: (url: URL) => Promise; +} + +class NetworkReachabilityBackend implements ReachabilityBackend { + private agent: https.Agent; + + constructor(private readonly proxy: ProxyInfo) { + this.agent = new HttpsProxyAgent(`http://${proxy.host}:${proxy.port}`); + } + + public async checkConnection(url: URL): Promise { + return new Promise((resolve, reject) => { + const req = https.request( + url, + { + agent: this.agent, + method: "HEAD", + ca: this.proxy.cert, + timeout: 5 * 1000, // 5 seconds + }, + (res) => { + res.destroy(); + + if (res.statusCode !== undefined && res.statusCode < 400) { + resolve(res.statusCode); + } else { + reject(new ReachabilityError(res.statusCode)); + } + }, + ); + req.on("error", (e) => { + reject(e); + }); + req.on("timeout", () => { + req.destroy(); + reject(new Error("Connection timeout.")); + }); + req.end(); + }); + } +} + +/** + * Determines which configured registries can be reached by performing test requests to them. + * + * @param logger The logger to use. + * @param proxy Information about the proxy, including the configured registries. + * @param backend Optionally for testing, a `ReachabilityBackend` to use. + * @returns The set of registries which passed the checks. + */ +export async function checkConnections( + logger: Logger, + proxy: ProxyInfo, + backend?: ReachabilityBackend, +): Promise> { + const result: Set = new Set(); + + // Don't do anything if there are no registries. + if (proxy.registries.length === 0) return result; + + try { + // Initialise a networking backend if no backend was provided. + if (backend === undefined) { + backend = new NetworkReachabilityBackend(proxy); + } + + for (const registry of proxy.registries) { + const address = getAddressString(registry); + const url = URL.parse(address); + + if (url === null) { + logger.info( + `Skipping check for ${address} since it is not a valid URL.`, + ); + continue; + } + + try { + logger.debug(`Testing connection to ${url}...`); + const statusCode = await backend.checkConnection(url); + + logger.info(`Successfully tested connection to ${url} (${statusCode})`); + result.add(registry); + } catch (e) { + if (e instanceof ReachabilityError && e.statusCode !== undefined) { + logger.error(`Connection test to ${url} failed. (${e.statusCode})`); + } else { + logger.error( + `Connection test to ${url} failed: ${getErrorMessage(e)}`, + ); + } + } + } + + logger.debug(`Finished testing connections to private registries.`); + } catch (e) { + logger.error( + `Failed to test connections to private registries: ${getErrorMessage(e)}`, + ); + } + + return result; +} diff --git a/src/start-proxy/types.ts b/src/start-proxy/types.ts new file mode 100644 index 000000000..0fb67f21c --- /dev/null +++ b/src/start-proxy/types.ts @@ -0,0 +1,61 @@ +/** + * After parsing configurations from JSON, we don't know whether all the keys we expect are + * present or not. This type is used to represent such values, which we expect to be + * `Credential` values, but haven't validated yet. + */ +export type RawCredential = Partial; + +/** + * A package registry configuration includes identifying information as well as + * authentication credentials. + */ +export type Credential = { + /** The username needed to authenticate to the package registry, if any. */ + username?: string; + /** The password needed to authenticate to the package registry, if any. */ + password?: string; + /** The token needed to authenticate to the package registry, if any. */ + token?: string; +} & Registry; + +/** A package registry is identified by its type and address. */ +export type Registry = { + /** The type of the package registry. */ + type: string; +} & Address; + +// If a registry has an `url`, then that takes precedence over the `host` which may or may +// not be defined. +interface HasUrl { + url: string; + host?: string; +} + +// If a registry does not have an `url`, then it must have a `host`. +interface WithoutUrl { + url: undefined; + host: string; +} + +/** + * A valid `Registry` value must either have a `url` or a `host` value. If it has a `url` value, + * then that takes precedence over the `host` value. If there is no `url` value, then it must + * have a `host` value. + */ +export type Address = HasUrl | WithoutUrl; + +/** Gets the address as a string. This will either be the `url` if present, or the `host` if not. */ +export function getAddressString(address: Address): string { + if (address.url === undefined) { + return address.host; + } else { + return address.url; + } +} + +export interface ProxyInfo { + host: string; + port: number; + cert: string; + registries: Registry[]; +} diff --git a/tsconfig.json b/tsconfig.json index dd944b9fa..7676dc322 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,8 +19,8 @@ "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noUnusedLocals": false, /* Report errors on unused locals. */ + "noUnusedParameters": false, /* Report errors on unused parameters. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */