You've already forked dynamic-badges-action
🎉 Initial commit
This commit is contained in:
60
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
generated
vendored
Normal file
60
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
export function endpointsToMethods(octokit, endpointsMap) {
|
||||
const newMethods = {};
|
||||
for (const [scope, endpoints] of Object.entries(endpointsMap)) {
|
||||
for (const [methodName, endpoint] of Object.entries(endpoints)) {
|
||||
const [route, defaults, decorations] = endpoint;
|
||||
const [method, url] = route.split(/ /);
|
||||
const endpointDefaults = Object.assign({ method, url }, defaults);
|
||||
if (!newMethods[scope]) {
|
||||
newMethods[scope] = {};
|
||||
}
|
||||
const scopeMethods = newMethods[scope];
|
||||
if (decorations) {
|
||||
scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations);
|
||||
continue;
|
||||
}
|
||||
scopeMethods[methodName] = octokit.request.defaults(endpointDefaults);
|
||||
}
|
||||
}
|
||||
return newMethods;
|
||||
}
|
||||
function decorate(octokit, scope, methodName, defaults, decorations) {
|
||||
const requestWithDefaults = octokit.request.defaults(defaults);
|
||||
/* istanbul ignore next */
|
||||
function withDecorations(...args) {
|
||||
// @ts-ignore https://github.com/microsoft/TypeScript/issues/25488
|
||||
let options = requestWithDefaults.endpoint.merge(...args);
|
||||
// There are currently no other decorations than `.mapToData`
|
||||
if (decorations.mapToData) {
|
||||
options = Object.assign({}, options, {
|
||||
data: options[decorations.mapToData],
|
||||
[decorations.mapToData]: undefined,
|
||||
});
|
||||
return requestWithDefaults(options);
|
||||
}
|
||||
if (decorations.renamed) {
|
||||
const [newScope, newMethodName] = decorations.renamed;
|
||||
octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`);
|
||||
}
|
||||
if (decorations.deprecated) {
|
||||
octokit.log.warn(decorations.deprecated);
|
||||
}
|
||||
if (decorations.renamedParameters) {
|
||||
// @ts-ignore https://github.com/microsoft/TypeScript/issues/25488
|
||||
const options = requestWithDefaults.endpoint.merge(...args);
|
||||
for (const [name, alias] of Object.entries(decorations.renamedParameters)) {
|
||||
if (name in options) {
|
||||
octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`);
|
||||
if (!(alias in options)) {
|
||||
options[alias] = options[name];
|
||||
}
|
||||
delete options[name];
|
||||
}
|
||||
}
|
||||
return requestWithDefaults(options);
|
||||
}
|
||||
// @ts-ignore https://github.com/microsoft/TypeScript/issues/25488
|
||||
return requestWithDefaults(...args);
|
||||
}
|
||||
return Object.assign(withDecorations, requestWithDefaults);
|
||||
}
|
||||
1234
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
generated
vendored
Normal file
1234
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/method-types.js
generated
vendored
Normal file
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/method-types.js
generated
vendored
Normal file
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/parameters-and-response-types.js
generated
vendored
Normal file
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/parameters-and-response-types.js
generated
vendored
Normal file
17
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
generated
vendored
Normal file
17
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import ENDPOINTS from "./generated/endpoints";
|
||||
import { VERSION } from "./version";
|
||||
import { endpointsToMethods } from "./endpoints-to-methods";
|
||||
/**
|
||||
* This plugin is a 1:1 copy of internal @octokit/rest plugins. The primary
|
||||
* goal is to rebuild @octokit/rest on top of @octokit/core. Once that is
|
||||
* done, we will remove the registerEndpoints methods and return the methods
|
||||
* directly as with the other plugins. At that point we will also remove the
|
||||
* legacy workarounds and deprecations.
|
||||
*
|
||||
* See the plan at
|
||||
* https://github.com/octokit/plugin-rest-endpoint-methods.js/pull/1
|
||||
*/
|
||||
export function restEndpointMethods(octokit) {
|
||||
return endpointsToMethods(octokit, ENDPOINTS);
|
||||
}
|
||||
restEndpointMethods.VERSION = VERSION;
|
||||
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/types.js
generated
vendored
Normal file
0
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/types.js
generated
vendored
Normal file
1
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
generated
vendored
Normal file
1
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const VERSION = "4.1.2";
|
||||
Reference in New Issue
Block a user