First upload version 0.0.1
This commit is contained in:
75
node_modules/@octokit/auth-unauthenticated/dist-node/index.js
generated
vendored
Normal file
75
node_modules/@octokit/auth-unauthenticated/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// pkg/dist-src/auth.js
|
||||
async function auth(reason) {
|
||||
return {
|
||||
type: "unauthenticated",
|
||||
reason
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/is-rate-limit-error.js
|
||||
function isRateLimitError(error) {
|
||||
if (error.status !== 403) {
|
||||
return false;
|
||||
}
|
||||
if (!error.response) {
|
||||
return false;
|
||||
}
|
||||
return error.response.headers["x-ratelimit-remaining"] === "0";
|
||||
}
|
||||
|
||||
// pkg/dist-src/is-abuse-limit-error.js
|
||||
var REGEX_ABUSE_LIMIT_MESSAGE = /\babuse\b/i;
|
||||
function isAbuseLimitError(error) {
|
||||
if (error.status !== 403) {
|
||||
return false;
|
||||
}
|
||||
return REGEX_ABUSE_LIMIT_MESSAGE.test(error.message);
|
||||
}
|
||||
|
||||
// pkg/dist-src/hook.js
|
||||
async function hook(reason, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
return request(endpoint).catch((error) => {
|
||||
if (error.status === 404) {
|
||||
error.message = `Not found. May be due to lack of authentication. Reason: ${reason}`;
|
||||
throw error;
|
||||
}
|
||||
if (isRateLimitError(error)) {
|
||||
error.message = `API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${reason}`;
|
||||
throw error;
|
||||
}
|
||||
if (isAbuseLimitError(error)) {
|
||||
error.message = `You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${reason}`;
|
||||
throw error;
|
||||
}
|
||||
if (error.status === 401) {
|
||||
error.message = `Unauthorized. "${endpoint.method} ${endpoint.url}" failed most likely due to lack of authentication. Reason: ${reason}`;
|
||||
throw error;
|
||||
}
|
||||
if (error.status >= 400 && error.status < 500) {
|
||||
error.message = error.message.replace(
|
||||
/\.?$/,
|
||||
`. May be caused by lack of authentication (${reason}).`
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var createUnauthenticatedAuth = function createUnauthenticatedAuth2(options) {
|
||||
if (!options || !options.reason) {
|
||||
throw new Error(
|
||||
"[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth"
|
||||
);
|
||||
}
|
||||
return Object.assign(auth.bind(null, options.reason), {
|
||||
hook: hook.bind(null, options.reason)
|
||||
});
|
||||
};
|
||||
export {
|
||||
createUnauthenticatedAuth
|
||||
};
|
||||
7
node_modules/@octokit/auth-unauthenticated/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/auth-unauthenticated/dist-node/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/auth.js", "../dist-src/is-rate-limit-error.js", "../dist-src/is-abuse-limit-error.js", "../dist-src/hook.js", "../dist-src/index.js"],
|
||||
"sourcesContent": ["async function auth(reason) {\n return {\n type: \"unauthenticated\",\n reason\n };\n}\nexport {\n auth\n};\n", "function isRateLimitError(error) {\n if (error.status !== 403) {\n return false;\n }\n if (!error.response) {\n return false;\n }\n return error.response.headers[\"x-ratelimit-remaining\"] === \"0\";\n}\nexport {\n isRateLimitError\n};\n", "const REGEX_ABUSE_LIMIT_MESSAGE = /\\babuse\\b/i;\nfunction isAbuseLimitError(error) {\n if (error.status !== 403) {\n return false;\n }\n return REGEX_ABUSE_LIMIT_MESSAGE.test(error.message);\n}\nexport {\n isAbuseLimitError\n};\n", "import { isRateLimitError } from \"./is-rate-limit-error.js\";\nimport { isAbuseLimitError } from \"./is-abuse-limit-error.js\";\nasync function hook(reason, request, route, parameters) {\n const endpoint = request.endpoint.merge(\n route,\n parameters\n );\n return request(endpoint).catch((error) => {\n if (error.status === 404) {\n error.message = `Not found. May be due to lack of authentication. Reason: ${reason}`;\n throw error;\n }\n if (isRateLimitError(error)) {\n error.message = `API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${reason}`;\n throw error;\n }\n if (isAbuseLimitError(error)) {\n error.message = `You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${reason}`;\n throw error;\n }\n if (error.status === 401) {\n error.message = `Unauthorized. \"${endpoint.method} ${endpoint.url}\" failed most likely due to lack of authentication. Reason: ${reason}`;\n throw error;\n }\n if (error.status >= 400 && error.status < 500) {\n error.message = error.message.replace(\n /\\.?$/,\n `. May be caused by lack of authentication (${reason}).`\n );\n }\n throw error;\n });\n}\nexport {\n hook\n};\n", "import { auth } from \"./auth.js\";\nimport { hook } from \"./hook.js\";\nconst createUnauthenticatedAuth = function createUnauthenticatedAuth2(options) {\n if (!options || !options.reason) {\n throw new Error(\n \"[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth\"\n );\n }\n return Object.assign(auth.bind(null, options.reason), {\n hook: hook.bind(null, options.reason)\n });\n};\nexport {\n createUnauthenticatedAuth\n};\n"],
|
||||
"mappings": ";AAAA,eAAe,KAAK,QAAQ;AAC1B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;;;ACLA,SAAS,iBAAiB,OAAO;AAC/B,MAAI,MAAM,WAAW,KAAK;AACxB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,MAAM,UAAU;AACnB,WAAO;AAAA,EACT;AACA,SAAO,MAAM,SAAS,QAAQ,uBAAuB,MAAM;AAC7D;;;ACRA,IAAM,4BAA4B;AAClC,SAAS,kBAAkB,OAAO;AAChC,MAAI,MAAM,WAAW,KAAK;AACxB,WAAO;AAAA,EACT;AACA,SAAO,0BAA0B,KAAK,MAAM,OAAO;AACrD;;;ACJA,eAAe,KAAK,QAAQ,SAAS,OAAO,YAAY;AACtD,QAAM,WAAW,QAAQ,SAAS;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,SAAO,QAAQ,QAAQ,EAAE,MAAM,CAAC,UA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