Skip to content

Commit

Permalink
chore(deps): update dependency @octokit/tsconfig to v4 (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Sep 24, 2024
1 parent 72a7a09 commit 69a1d8b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"update-endpoints": "npm-run-all update-endpoints:*",
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.js",
"update-endpoints:code": "node scripts/update-endpoints/code.js",
"validate:ts": "tsc --noEmit --noImplicitAny --target es2022 --esModuleInterop --moduleResolution node16 --module node16 test/typescript-validate.ts"
"validate:ts": "tsc --noEmit --noImplicitAny --target es2022 --strict --esModuleInterop --moduleResolution node16 --module node16 --exactOptionalPropertyTypes test/typescript-validate.ts"
},
"repository": "github:octokit/plugin-throttling.js",
"author": "Simon Grondin (http://github.com/SGrondin)",
Expand All @@ -31,7 +31,7 @@
"devDependencies": {
"@octokit/core": "^6.0.0",
"@octokit/request-error": "^6.0.1",
"@octokit/tsconfig": "^3.0.0",
"@octokit/tsconfig": "^4.0.0",
"@types/node": "^20.0.0",
"@vitest/coverage-v8": "^2.0.2",
"esbuild": "^0.24.0",
Expand Down
20 changes: 11 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import BottleneckLight from "bottleneck/light.js";
import type TBottleneck from "bottleneck";
import type { Octokit, OctokitOptions } from "@octokit/core";
import type { Groups, State, ThrottlingOptions } from "./types.js";
import type {
CreateGroupsCommon,
Groups,
State,
ThrottlingOptions,
} from "./types.js";
import { VERSION } from "./version.js";

import { wrapRequest } from "./wrap-request.js";
Expand All @@ -18,13 +23,7 @@ const groups: Groups = {};

const createGroups = function (
Bottleneck: typeof TBottleneck,
common: {
connection:
| TBottleneck.RedisConnection
| TBottleneck.IORedisConnection
| undefined;
timeout: number;
},
common: CreateGroupsCommon,
) {
groups.global = new Bottleneck.Group({
id: "octokit-global",
Expand Down Expand Up @@ -62,7 +61,10 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) {
if (!enabled) {
return {};
}
const common = { connection, timeout };
const common: CreateGroupsCommon = { timeout };
if (typeof connection !== "undefined") {
common.connection = connection;
}

if (groups.global == null) {
createGroups(Bottleneck, common);
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ export type State = {
id: string;
} & Required<Groups> &
ThrottlingOptions;

export type CreateGroupsCommon = {
connection?: Bottleneck.RedisConnection | Bottleneck.IORedisConnection;
timeout: number;
};

0 comments on commit 69a1d8b

Please sign in to comment.