First upload version 0.0.1
This commit is contained in:
126
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
generated
vendored
Normal file
126
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
import ENDPOINTS from "./generated/endpoints.js";
|
||||
const endpointMethodsMap = /* @__PURE__ */ new Map();
|
||||
for (const [scope, endpoints] of Object.entries(ENDPOINTS)) {
|
||||
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 (!endpointMethodsMap.has(scope)) {
|
||||
endpointMethodsMap.set(scope, /* @__PURE__ */ new Map());
|
||||
}
|
||||
endpointMethodsMap.get(scope).set(methodName, {
|
||||
scope,
|
||||
methodName,
|
||||
endpointDefaults,
|
||||
decorations
|
||||
});
|
||||
}
|
||||
}
|
||||
const handler = {
|
||||
has({ scope }, methodName) {
|
||||
return endpointMethodsMap.get(scope).has(methodName);
|
||||
},
|
||||
getOwnPropertyDescriptor(target, methodName) {
|
||||
return {
|
||||
value: this.get(target, methodName),
|
||||
// ensures method is in the cache
|
||||
configurable: true,
|
||||
writable: true,
|
||||
enumerable: true
|
||||
};
|
||||
},
|
||||
defineProperty(target, methodName, descriptor) {
|
||||
Object.defineProperty(target.cache, methodName, descriptor);
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, methodName) {
|
||||
delete target.cache[methodName];
|
||||
return true;
|
||||
},
|
||||
ownKeys({ scope }) {
|
||||
return [...endpointMethodsMap.get(scope).keys()];
|
||||
},
|
||||
set(target, methodName, value) {
|
||||
return target.cache[methodName] = value;
|
||||
},
|
||||
get({ octokit, scope, cache }, methodName) {
|
||||
if (cache[methodName]) {
|
||||
return cache[methodName];
|
||||
}
|
||||
const method = endpointMethodsMap.get(scope).get(methodName);
|
||||
if (!method) {
|
||||
return void 0;
|
||||
}
|
||||
const { endpointDefaults, decorations } = method;
|
||||
if (decorations) {
|
||||
cache[methodName] = decorate(
|
||||
octokit,
|
||||
scope,
|
||||
methodName,
|
||||
endpointDefaults,
|
||||
decorations
|
||||
);
|
||||
} else {
|
||||
cache[methodName] = octokit.request.defaults(endpointDefaults);
|
||||
}
|
||||
return cache[methodName];
|
||||
}
|
||||
};
|
||||
function endpointsToMethods(octokit) {
|
||||
const newMethods = {};
|
||||
for (const scope of endpointMethodsMap.keys()) {
|
||||
newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
|
||||
}
|
||||
return newMethods;
|
||||
}
|
||||
function decorate(octokit, scope, methodName, defaults, decorations) {
|
||||
const requestWithDefaults = octokit.request.defaults(defaults);
|
||||
function withDecorations(...args) {
|
||||
let options = requestWithDefaults.endpoint.merge(...args);
|
||||
if (decorations.mapToData) {
|
||||
options = Object.assign({}, options, {
|
||||
data: options[decorations.mapToData],
|
||||
[decorations.mapToData]: void 0
|
||||
});
|
||||
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) {
|
||||
const options2 = requestWithDefaults.endpoint.merge(...args);
|
||||
for (const [name, alias] of Object.entries(
|
||||
decorations.renamedParameters
|
||||
)) {
|
||||
if (name in options2) {
|
||||
octokit.log.warn(
|
||||
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
|
||||
);
|
||||
if (!(alias in options2)) {
|
||||
options2[alias] = options2[name];
|
||||
}
|
||||
delete options2[name];
|
||||
}
|
||||
}
|
||||
return requestWithDefaults(options2);
|
||||
}
|
||||
return requestWithDefaults(...args);
|
||||
}
|
||||
return Object.assign(withDecorations, requestWithDefaults);
|
||||
}
|
||||
export {
|
||||
endpointsToMethods
|
||||
};
|
||||
//# sourceMappingURL=endpoints-to-methods.js.map
|
||||
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js.map
generated
vendored
Normal file
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2294
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
generated
vendored
Normal file
2294
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
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js.map
generated
vendored
Normal file
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
generated
vendored
Normal file
22
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { VERSION } from "./version.js";
|
||||
import { endpointsToMethods } from "./endpoints-to-methods.js";
|
||||
function restEndpointMethods(octokit) {
|
||||
const api = endpointsToMethods(octokit);
|
||||
return {
|
||||
rest: api
|
||||
};
|
||||
}
|
||||
restEndpointMethods.VERSION = VERSION;
|
||||
function legacyRestEndpointMethods(octokit) {
|
||||
const api = endpointsToMethods(octokit);
|
||||
return {
|
||||
...api,
|
||||
rest: api
|
||||
};
|
||||
}
|
||||
legacyRestEndpointMethods.VERSION = VERSION;
|
||||
export {
|
||||
legacyRestEndpointMethods,
|
||||
restEndpointMethods
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../src/index.ts"],
|
||||
"sourcesContent": ["import type { Octokit } from \"@octokit/core\";\n\nexport type { RestEndpointMethodTypes } from \"./generated/parameters-and-response-types.js\";\nimport { VERSION } from \"./version.js\";\nimport type { Api } from \"./types.js\";\nimport { endpointsToMethods } from \"./endpoints-to-methods.js\";\n\n// Export the type for downstream users in order to fix a TypeScript error\n// The inferred type of 'Octokit' cannot be named without a reference to '../node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/types.js'. This is likely not portable. A type annotation is necessary.\nexport type { Api };\n\nexport function restEndpointMethods(octokit: Octokit): Api {\n const api = endpointsToMethods(octokit);\n return {\n rest: api,\n };\n}\nrestEndpointMethods.VERSION = VERSION;\n\nexport function legacyRestEndpointMethods(octokit: Octokit): Api[\"rest\"] & Api {\n const api = endpointsToMethods(octokit);\n return {\n ...api,\n rest: api,\n };\n}\nlegacyRestEndpointMethods.VERSION = VERSION;\n"],
|
||||
"mappings": "AAGA,SAAS,eAAe;AAExB,SAAS,0BAA0B;AAM5B,SAAS,oBAAoB,SAAuB;AACzD,QAAM,MAAM,mBAAmB,OAAO;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,EACR;AACF;AACA,oBAAoB,UAAU;AAEvB,SAAS,0BAA0B,SAAqC;AAC7E,QAAM,MAAM,mBAAmB,OAAO;AACtC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM;AAAA,EACR;AACF;AACA,0BAA0B,UAAU;",
|
||||
"names": []
|
||||
}
|
||||
5
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
generated
vendored
Normal file
5
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const VERSION = "17.0.0";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
//# sourceMappingURL=version.js.map
|
||||
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js.map
generated
vendored
Normal file
7
node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../src/version.ts"],
|
||||
"sourcesContent": ["export const VERSION = \"17.0.0\";\n"],
|
||||
"mappings": "AAAO,MAAM,UAAU;",
|
||||
"names": []
|
||||
}
|
||||
Reference in New Issue
Block a user