@octokit/plugin-enterprise-compatibility
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,13 +0,34 @@ | ||
'use strict'; | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// pkg/dist-src/index.js | ||
var dist_src_exports = {}; | ||
__export(dist_src_exports, { | ||
enterpriseCompatibility: () => enterpriseCompatibility | ||
}); | ||
module.exports = __toCommonJS(dist_src_exports); | ||
var import_request_error = require("@octokit/request-error"); | ||
var requestError = require('@octokit/request-error'); | ||
// pkg/dist-src/version.js | ||
var VERSION = "2.0.5"; | ||
const VERSION = "2.0.4"; | ||
// pkg/dist-src/index.js | ||
function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// TODO: implement fix for #62 here | ||
// https://github.com/octokit/plugin-enterprise-compatibility.js/issues/60 | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
@@ -23,6 +44,13 @@ try { | ||
} | ||
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 | ||
}); | ||
const deprecatedUrl = options.url.replace( | ||
/\/orgs\/[^/]+\/teams\/[^/]+/, | ||
"/teams/{team_id}" | ||
); | ||
throw new import_request_error.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 | ||
} | ||
); | ||
} | ||
@@ -34,4 +62,5 @@ } | ||
enterpriseCompatibility.VERSION = VERSION; | ||
exports.enterpriseCompatibility = enterpriseCompatibility; | ||
//# sourceMappingURL=index.js.map | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
enterpriseCompatibility | ||
}); |
import { RequestError } from "@octokit/request-error"; | ||
import { VERSION } from "./version"; | ||
export function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// 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.response || | ||
!error.response.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, | ||
}); | ||
} | ||
function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
try { | ||
return await request(options); | ||
} catch (error) { | ||
if (error.status !== 404) { | ||
throw error; | ||
} | ||
return request(options); | ||
}); | ||
if (!error.response || !error.response.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); | ||
}); | ||
} | ||
enterpriseCompatibility.VERSION = VERSION; | ||
export { | ||
enterpriseCompatibility | ||
}; |
@@ -1,9 +0,12 @@ | ||
export function isIssueLabelsUpdateOrReplace({ method, url }) { | ||
if (!["POST", "PUT"].includes(method)) { | ||
return false; | ||
} | ||
if (!/\/repos\/[^/]+\/[^/]+\/issues\/[^/]+\/labels/.test(url)) { | ||
return false; | ||
} | ||
return true; | ||
function isIssueLabelsUpdateOrReplace({ method, url }) { | ||
if (!["POST", "PUT"].includes(method)) { | ||
return false; | ||
} | ||
if (!/\/repos\/[^/]+\/[^/]+\/issues\/[^/]+\/labels/.test(url)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
export { | ||
isIssueLabelsUpdateOrReplace | ||
}; |
@@ -1,1 +0,4 @@ | ||
export const VERSION = "2.0.4"; | ||
const VERSION = "2.0.5"; | ||
export { | ||
VERSION | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { Octokit } from "@octokit/core"; | ||
import type { Octokit } from "@octokit/core"; | ||
export declare function enterpriseCompatibility(octokit: Octokit): void; | ||
@@ -3,0 +3,0 @@ export declare namespace enterpriseCompatibility { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.0.4"; | ||
export declare const VERSION = "2.0.5"; |
@@ -1,33 +0,39 @@ | ||
import { RequestError } from '@octokit/request-error'; | ||
// pkg/dist-src/index.js | ||
import { RequestError } from "@octokit/request-error"; | ||
const VERSION = "2.0.4"; | ||
// pkg/dist-src/version.js | ||
var VERSION = "2.0.5"; | ||
// pkg/dist-src/index.js | ||
function enterpriseCompatibility(octokit) { | ||
octokit.hook.wrap("request", async (request, options) => { | ||
// 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.response || | ||
!error.response.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, | ||
}); | ||
} | ||
octokit.hook.wrap("request", async (request, options) => { | ||
if (/\/orgs\/[^/]+\/teams/.test(options.url)) { | ||
try { | ||
return await request(options); | ||
} catch (error) { | ||
if (error.status !== 404) { | ||
throw error; | ||
} | ||
return request(options); | ||
}); | ||
if (!error.response || !error.response.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); | ||
}); | ||
} | ||
enterpriseCompatibility.VERSION = VERSION; | ||
export { enterpriseCompatibility }; | ||
//# sourceMappingURL=index.js.map | ||
export { | ||
enterpriseCompatibility | ||
}; |
{ | ||
"name": "@octokit/plugin-enterprise-compatibility", | ||
"version": "2.0.5", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"description": "Octokit plugin for improving GHE compatibility", | ||
"version": "2.0.4", | ||
"license": "MIT", | ||
"files": [ | ||
"dist-*/", | ||
"bin/" | ||
], | ||
"source": "dist-src/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"main": "dist-node/index.js", | ||
"module": "dist-web/index.js", | ||
"pika": true, | ||
"sideEffects": false, | ||
"repository": "github:octokit/plugin-enterprise-compatibility.js", | ||
"keywords": [ | ||
@@ -24,3 +17,4 @@ "octokit", | ||
], | ||
"repository": "github:octokit/plugin-enterprise-compatibility.js", | ||
"author": "Gregor Martynus (https://github.com/gr2m)", | ||
"license": "MIT", | ||
"dependencies": { | ||
@@ -33,16 +27,15 @@ "@octokit/request-error": "^3.0.0", | ||
"@octokit/rest": "^19.0.0", | ||
"@pika/pack": "^0.3.7", | ||
"@pika/plugin-build-node": "^0.9.0", | ||
"@pika/plugin-build-web": "^0.9.0", | ||
"@pika/plugin-ts-standard-pkg": "^0.9.0", | ||
"@octokit/tsconfig": "^1.0.2", | ||
"@types/fetch-mock": "^7.3.1", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "^18.0.0", | ||
"esbuild": "^0.17.19", | ||
"fetch-mock": "^9.0.0", | ||
"glob": "^10.2.6", | ||
"jest": "^29.0.0", | ||
"prettier": "2.8.3", | ||
"semantic-release": "^20.0.0", | ||
"prettier": "2.8.8", | ||
"semantic-release": "^21.0.0", | ||
"semantic-release-plugin-update-version-in-files": "^1.0.0", | ||
"ts-jest": "^29.0.0", | ||
"typescript": "^4.0.0" | ||
"typescript": "^5.0.0" | ||
}, | ||
@@ -52,5 +45,11 @@ "engines": { | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
"files": [ | ||
"dist-*/**", | ||
"bin/**" | ||
], | ||
"main": "dist-node/index.js", | ||
"browser": "dist-web/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"module": "dist-src/index.js", | ||
"sideEffects": false | ||
} |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
15
156
1
14009