UNPKG

17 kBSource Map (JSON)View Raw
1{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/wrap-request.js","../dist-src/generated/triggers-notification-paths.js","../dist-src/route-matcher.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"3.3.4\";\n","const noop = () => Promise.resolve();\n// @ts-ignore\nexport function wrapRequest(state, request, options) {\n return state.retryLimiter.schedule(doRequest, state, request, options);\n}\n// @ts-ignore\nasync function doRequest(state, request, options) {\n const isWrite = options.method !== \"GET\" && options.method !== \"HEAD\";\n const isSearch = options.method === \"GET\" && options.url.startsWith(\"/search/\");\n const isGraphQL = options.url.startsWith(\"/graphql\");\n const retryCount = ~~options.request.retryCount;\n const jobOptions = retryCount > 0 ? { priority: 0, weight: 0 } : {};\n if (state.clustering) {\n // Remove a job from Redis if it has not completed or failed within 60s\n // Examples: Node process terminated, client disconnected, etc.\n // @ts-ignore\n jobOptions.expiration = 1000 * 60;\n }\n // Guarantee at least 1000ms between writes\n // GraphQL can also trigger writes\n if (isWrite || isGraphQL) {\n await state.write.key(state.id).schedule(jobOptions, noop);\n }\n // Guarantee at least 3000ms between requests that trigger notifications\n if (isWrite && state.triggersNotification(options.url)) {\n await state.notifications.key(state.id).schedule(jobOptions, noop);\n }\n // Guarantee at least 2000ms between search requests\n if (isSearch) {\n await state.search.key(state.id).schedule(jobOptions, noop);\n }\n const req = state.global.key(state.id).schedule(jobOptions, request, options);\n if (isGraphQL) {\n const res = await req;\n if (res.data.errors != null &&\n // @ts-ignore\n res.data.errors.some((error) => error.type === \"RATE_LIMITED\")) {\n const error = Object.assign(new Error(\"GraphQL Rate Limit Exceeded\"), {\n headers: res.headers,\n data: res.data,\n });\n throw error;\n }\n }\n return req;\n}\n","export default [\n \"/orgs/{org}/invitations\",\n \"/orgs/{org}/teams/{team_slug}/discussions\",\n \"/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments\",\n \"/repos/{owner}/{repo}/collaborators/{username}\",\n \"/repos/{owner}/{repo}/commits/{commit_sha}/comments\",\n \"/repos/{owner}/{repo}/issues\",\n \"/repos/{owner}/{repo}/issues/{issue_number}/comments\",\n \"/repos/{owner}/{repo}/pulls\",\n \"/repos/{owner}/{repo}/pulls/{pull_number}/comments\",\n \"/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies\",\n \"/repos/{owner}/{repo}/pulls/{pull_number}/merge\",\n \"/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers\",\n \"/repos/{owner}/{repo}/pulls/{pull_number}/reviews\",\n \"/repos/{owner}/{repo}/releases\",\n \"/teams/{team_id}/discussions\",\n \"/teams/{team_id}/discussions/{discussion_number}/comments\",\n];\n","// @ts-ignore\nexport function routeMatcher(paths) {\n // EXAMPLE. For the following paths:\n /* [\n \"/orgs/:org/invitations\",\n \"/repos/:owner/:repo/collaborators/:username\"\n ] */\n // @ts-ignore\n const regexes = paths.map((path) => path\n .split(\"/\")\n // @ts-ignore\n .map((c) => (c.startsWith(\"{\") ? \"(?:.+?)\" : c))\n .join(\"/\"));\n // 'regexes' would contain:\n /* [\n '/orgs/(?:.+?)/invitations',\n '/repos/(?:.+?)/(?:.+?)/collaborators/(?:.+?)'\n ] */\n // @ts-ignore\n const regex = `^(?:${regexes.map((r) => `(?:${r})`).join(\"|\")})[^/]*$`;\n // 'regex' would contain:\n /*\n ^(?:(?:\\/orgs\\/(?:.+?)\\/invitations)|(?:\\/repos\\/(?:.+?)\\/(?:.+?)\\/collaborators\\/(?:.+?)))[^\\/]*$\n \n It may look scary, but paste it into https://www.debuggex.com/\n and it will make a lot more sense!\n */\n return new RegExp(regex, \"i\");\n}\n","// @ts-ignore\nimport BottleneckLight from \"bottleneck/light\";\nimport { VERSION } from \"./version\";\nimport { wrapRequest } from \"./wrap-request\";\nimport triggersNotificationPaths from \"./generated/triggers-notification-paths\";\nimport { routeMatcher } from \"./route-matcher\";\n// Workaround to allow tests to directly access the triggersNotification function.\nconst regex = routeMatcher(triggersNotificationPaths);\nconst triggersNotification = regex.test.bind(regex);\nconst groups = {};\n// @ts-ignore\nconst createGroups = function (Bottleneck, common) {\n // @ts-ignore\n groups.global = new Bottleneck.Group({\n id: \"octokit-global\",\n maxConcurrent: 10,\n ...common,\n });\n // @ts-ignore\n groups.search = new Bottleneck.Group({\n id: \"octokit-search\",\n maxConcurrent: 1,\n minTime: 2000,\n ...common,\n });\n // @ts-ignore\n groups.write = new Bottleneck.Group({\n id: \"octokit-write\",\n maxConcurrent: 1,\n minTime: 1000,\n ...common,\n });\n // @ts-ignore\n groups.notifications = new Bottleneck.Group({\n id: \"octokit-notifications\",\n maxConcurrent: 1,\n minTime: 3000,\n ...common,\n });\n};\nexport function throttling(octokit, octokitOptions = {}) {\n const { enabled = true, Bottleneck = BottleneckLight, id = \"no-id\", timeout = 1000 * 60 * 2, // Redis TTL: 2 minutes\n connection, } = octokitOptions.throttle || {};\n if (!enabled) {\n return;\n }\n const common = { connection, timeout };\n // @ts-ignore\n if (groups.global == null) {\n createGroups(Bottleneck, common);\n }\n const state = Object.assign({\n clustering: connection != null,\n triggersNotification,\n minimumAbuseRetryAfter: 5,\n retryAfterBaseValue: 1000,\n retryLimiter: new Bottleneck(),\n id,\n ...groups,\n }, \n // @ts-ignore\n octokitOptions.throttle);\n if (typeof state.onAbuseLimit !== \"function\" ||\n typeof state.onRateLimit !== \"function\") {\n throw new Error(`octokit/plugin-throttling error:\n You must pass the onAbuseLimit and onRateLimit error handlers.\n See https://github.com/octokit/rest.js#throttling\n\n const octokit = new Octokit({\n throttle: {\n onAbuseLimit: (retryAfter, options) => {/* ... */},\n onRateLimit: (retryAfter, options) => {/* ... */}\n }\n })\n `);\n }\n const events = {};\n const emitter = new Bottleneck.Events(events);\n // @ts-ignore\n events.on(\"abuse-limit\", state.onAbuseLimit);\n // @ts-ignore\n events.on(\"rate-limit\", state.onRateLimit);\n // @ts-ignore\n events.on(\"error\", (e) => console.warn(\"Error in throttling-plugin limit handler\", e));\n // @ts-ignore\n state.retryLimiter.on(\"failed\", async function (error, info) {\n const options = info.args[info.args.length - 1];\n const shouldRetryGraphQL = options.url.startsWith(\"/graphql\") && error.status !== 401;\n if (!(shouldRetryGraphQL || error.status === 403)) {\n return;\n }\n const retryCount = ~~options.request.retryCount;\n options.request.retryCount = retryCount;\n const { wantRetry, retryAfter } = await (async function () {\n if (/\\babuse\\b/i.test(error.message)) {\n // The user has hit the abuse rate limit. (REST and GraphQL)\n // https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits\n // The Retry-After header can sometimes be blank when hitting an abuse limit,\n // but is always present after 2-3s, so make sure to set `retryAfter` to at least 5s by default.\n const retryAfter = Math.max(~~error.headers[\"retry-after\"], state.minimumAbuseRetryAfter);\n const wantRetry = await emitter.trigger(\"abuse-limit\", retryAfter, options, octokit);\n return { wantRetry, retryAfter };\n }\n if (error.headers != null &&\n error.headers[\"x-ratelimit-remaining\"] === \"0\") {\n // The user has used all their allowed calls for the current time period (REST and GraphQL)\n // https://docs.github.com/en/rest/reference/rate-limit (REST)\n // https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit (GraphQL)\n const rateLimitReset = new Date(~~error.headers[\"x-ratelimit-reset\"] * 1000).getTime();\n const retryAfter = Math.max(Math.ceil((rateLimitReset - Date.now()) / 1000), 0);\n const wantRetry = await emitter.trigger(\"rate-limit\", retryAfter, options, octokit);\n return { wantRetry, retryAfter };\n }\n return {};\n })();\n if (wantRetry) {\n options.request.retryCount++;\n // @ts-ignore\n return retryAfter * state.retryAfterBaseValue;\n }\n });\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n}\nthrottling.VERSION = VERSION;\nthrottling.triggersNotification = triggersNotification;\n"],"names":["VERSION","noop","Promise","resolve","wrapRequest","state","request","options","retryLimiter","schedule","doRequest","isWrite","method","isSearch","url","startsWith","isGraphQL","retryCount","jobOptions","priority","weight","clustering","expiration","write","key","id","triggersNotification","notifications","search","req","global","res","data","errors","some","error","type","Object","assign","Error","headers","routeMatcher","paths","regexes","map","path","split","c","join","regex","r","RegExp","triggersNotificationPaths","test","bind","groups","createGroups","Bottleneck","common","Group","maxConcurrent","minTime","throttling","octokit","octokitOptions","enabled","BottleneckLight","timeout","connection","throttle","minimumAbuseRetryAfter","retryAfterBaseValue","onAbuseLimit","onRateLimit","events","emitter","Events","on","e","console","warn","info","args","length","shouldRetryGraphQL","status","wantRetry","retryAfter","message","Math","max","trigger","rateLimitReset","Date","getTime","ceil","now","hook","wrap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,OAAO,GAAG,mBAAhB;;ACAP,MAAMC,IAAI,GAAG,MAAMC,OAAO,CAACC,OAAR,EAAnB;;;AAEA,AAAO,SAASC,WAAT,CAAqBC,KAArB,EAA4BC,OAA5B,EAAqCC,OAArC,EAA8C;AACjD,SAAOF,KAAK,CAACG,YAAN,CAAmBC,QAAnB,CAA4BC,SAA5B,EAAuCL,KAAvC,EAA8CC,OAA9C,EAAuDC,OAAvD,CAAP;AACH;;AAED,eAAeG,SAAf,CAAyBL,KAAzB,EAAgCC,OAAhC,EAAyCC,OAAzC,EAAkD;AAC9C,QAAMI,OAAO,GAAGJ,OAAO,CAACK,MAAR,KAAmB,KAAnB,IAA4BL,OAAO,CAACK,MAAR,KAAmB,MAA/D;AACA,QAAMC,QAAQ,GAAGN,OAAO,CAACK,MAAR,KAAmB,KAAnB,IAA4BL,OAAO,CAACO,GAAR,CAAYC,UAAZ,CAAuB,UAAvB,CAA7C;AACA,QAAMC,SAAS,GAAGT,OAAO,CAACO,GAAR,CAAYC,UAAZ,CAAuB,UAAvB,CAAlB;AACA,QAAME,UAAU,GAAG,CAAC,CAACV,OAAO,CAACD,OAAR,CAAgBW,UAArC;AACA,QAAMC,UAAU,GAAGD,UAAU,GAAG,CAAb,GAAiB;AAAEE,IAAAA,QAAQ,EAAE,CAAZ;AAAeC,IAAAA,MAAM,EAAE;AAAvB,GAAjB,GAA8C,EAAjE;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