From 69a1d8bab17fe7cdd2c708b904972ddd0f890835 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 21:06:41 +0000 Subject: [PATCH] chore(deps): update dependency @octokit/tsconfig to v4 (#735) --- package-lock.json | 8 ++++---- package.json | 4 ++-- src/index.ts | 20 +++++++++++--------- src/types.ts | 5 +++++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 83a0b6e7..cb8d7aaa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,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", @@ -755,9 +755,9 @@ } }, "node_modules/@octokit/tsconfig": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@octokit/tsconfig/-/tsconfig-3.1.0.tgz", - "integrity": "sha512-3jGTGqDnnh/MZlg/sf21J/0cghsmaSnG+ZPK+o++sQwUwgrLVtfbUi/BANHgf22SRnxhdYtOoRX90I9/cP+9BA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/tsconfig/-/tsconfig-4.0.0.tgz", + "integrity": "sha512-hRd6UhX19m+8WhfrEpNLtm9TjuizYSG/dE0a+ivU71ylSxABVe4mEK+JMAGdjj6/gIQ+5DPegTPofi4P8VC5IA==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 43913e10..f13da4ae 100644 --- a/package.json +++ b/package.json @@ -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)", @@ -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", diff --git a/src/index.ts b/src/index.ts index 1bc27468..95b72bb0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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"; @@ -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", @@ -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); diff --git a/src/types.ts b/src/types.ts index 01ddb85e..d27f485f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -53,3 +53,8 @@ export type State = { id: string; } & Required & ThrottlingOptions; + +export type CreateGroupsCommon = { + connection?: Bottleneck.RedisConnection | Bottleneck.IORedisConnection; + timeout: number; +};