@octokit/plugin-enterprise-compatibility
Advanced tools
Comparing version 1.2.10 to 1.2.11
@@ -7,37 +7,8 @@ 'use strict'; | ||
const VERSION = "1.2.10"; | ||
const VERSION = "1.2.11"; | ||
function isIssueLabelsUpdateOrReplace({ | ||
method, | ||
url | ||
}) { | ||
if (!["POST", "PUT"].includes(method)) { | ||
return false; | ||
} | ||
if (!/\/repos\/[^/]+\/[^/]+\/issues\/[^/]+\/labels/.test(url)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// see https://github.com/octokit/rest.js/blob/15.x/lib/routes.json#L3046-L3068 | ||
if (isIssueLabelsUpdateOrReplace(options)) { | ||
options.data = options.labels; | ||
delete options.labels; // for @octokit/rest v16.x, remove validation of labels option | ||
/* istanbul ignore if */ | ||
if (options.request.validate) { | ||
delete options.request.validate.labels; | ||
} | ||
return request(options); | ||
} // TODO: implement fix for #62 here | ||
// TODO: implement fix for #62 here | ||
// https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
@@ -44,0 +15,0 @@ try { |
import { RequestError } from "@octokit/request-error"; | ||
import { VERSION } from "./version"; | ||
import { isIssueLabelsUpdateOrReplace } from "./is-issue-labels-update-or-replace"; | ||
export function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// see https://github.com/octokit/rest.js/blob/15.x/lib/routes.json#L3046-L3068 | ||
if (isIssueLabelsUpdateOrReplace(options)) { | ||
options.data = options.labels; | ||
delete options.labels; | ||
// for @octokit/rest v16.x, remove validation of labels option | ||
/* istanbul ignore if */ | ||
if (options.request.validate) { | ||
delete options.request.validate.labels; | ||
} | ||
return request(options); | ||
} | ||
// TODO: implement fix for #62 here | ||
@@ -18,0 +6,0 @@ // https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "1.2.10"; | ||
export const VERSION = "1.2.11"; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "1.2.10"; | ||
export declare const VERSION = "1.2.11"; |
import { RequestError } from '@octokit/request-error'; | ||
const VERSION = "1.2.10"; | ||
const VERSION = "1.2.11"; | ||
function isIssueLabelsUpdateOrReplace({ method, url }) { | ||
if (!["POST", "PUT"].includes(method)) { | ||
return false; | ||
} | ||
if (!/\/repos\/[^/]+\/[^/]+\/issues\/[^/]+\/labels/.test(url)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// see https://github.com/octokit/rest.js/blob/15.x/lib/routes.json#L3046-L3068 | ||
if (isIssueLabelsUpdateOrReplace(options)) { | ||
options.data = options.labels; | ||
delete options.labels; | ||
// for @octokit/rest v16.x, remove validation of labels option | ||
/* istanbul ignore if */ | ||
if (options.request.validate) { | ||
delete options.request.validate.labels; | ||
} | ||
return request(options); | ||
} | ||
// TODO: implement fix for #62 here | ||
@@ -29,0 +8,0 @@ // https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 |
{ | ||
"name": "@octokit/plugin-enterprise-compatibility", | ||
"description": "Octokit plugin for improving GHE compatibility", | ||
"version": "1.2.10", | ||
"version": "1.2.11", | ||
"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
14327
104