@octokit/plugin-enterprise-compatibility
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -7,3 +7,3 @@ 'use strict'; | ||
const VERSION = "1.2.3"; | ||
const VERSION = "1.2.4"; | ||
@@ -98,2 +98,23 @@ function isIssueLabelsUpdateOrReplace({ | ||
}); | ||
} // TODO: implement fix for #62 here | ||
// https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
try { | ||
return await request(options); | ||
} catch (error) { | ||
if (error.status !== 404) { | ||
throw error; | ||
} | ||
if (!error.headers || !error.headers["x-github-enterprise-version"]) { | ||
throw error; | ||
} | ||
const deprecatedUrl = options.url.replace(/\/orgs\/[^/]+\/teams\/[^/]+/, "/teams/:team_id"); | ||
throw new requestError.RequestError(`"${options.method} ${options.url}" is not supported in your GitHub Enterprise Server version. Please replace with octokit.request("${options.method} ${deprecatedUrl}", { team_id })`, 404, { | ||
request: options | ||
}); | ||
} | ||
} | ||
@@ -100,0 +121,0 @@ |
@@ -50,2 +50,21 @@ import { RequestError } from "@octokit/request-error"; | ||
} | ||
// TODO: implement fix for #62 here | ||
// https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
try { | ||
return await request(options); | ||
} | ||
catch (error) { | ||
if (error.status !== 404) { | ||
throw error; | ||
} | ||
if (!error.headers || !error.headers["x-github-enterprise-version"]) { | ||
throw error; | ||
} | ||
const deprecatedUrl = options.url.replace(/\/orgs\/[^/]+\/teams\/[^/]+/, "/teams/:team_id"); | ||
throw new RequestError(`"${options.method} ${options.url}" is not supported in your GitHub Enterprise Server version. Please replace with octokit.request("${options.method} ${deprecatedUrl}", { team_id })`, 404, { | ||
request: options, | ||
}); | ||
} | ||
} | ||
return request(options); | ||
@@ -52,0 +71,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "1.2.3"; | ||
export const VERSION = "1.2.4"; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "1.2.3"; | ||
export declare const VERSION = "1.2.4"; |
import { RequestError } from '@octokit/request-error'; | ||
const VERSION = "1.2.3"; | ||
const VERSION = "1.2.4"; | ||
@@ -75,2 +75,21 @@ function isIssueLabelsUpdateOrReplace({ method, url }) { | ||
} | ||
// TODO: implement fix for #62 here | ||
// https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
try { | ||
return await request(options); | ||
} | ||
catch (error) { | ||
if (error.status !== 404) { | ||
throw error; | ||
} | ||
if (!error.headers || !error.headers["x-github-enterprise-version"]) { | ||
throw error; | ||
} | ||
const deprecatedUrl = options.url.replace(/\/orgs\/[^/]+\/teams\/[^/]+/, "/teams/:team_id"); | ||
throw new RequestError(`"${options.method} ${options.url}" is not supported in your GitHub Enterprise Server version. Please replace with octokit.request("${options.method} ${deprecatedUrl}", { team_id })`, 404, { | ||
request: options, | ||
}); | ||
} | ||
} | ||
return request(options); | ||
@@ -77,0 +96,0 @@ }); |
{ | ||
"name": "@octokit/plugin-enterprise-compatibility", | ||
"description": "Octokit plugin for improving GHE compatibility", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32486
301