diff --git a/.github/actions/setup-for-scripts/action.yml b/.github/actions/setup-for-scripts/action.yml index b6338ba54ae60d..47b5be57205314 100644 --- a/.github/actions/setup-for-scripts/action.yml +++ b/.github/actions/setup-for-scripts/action.yml @@ -4,7 +4,7 @@ description: Set up repo for running scripts runs: using: composite steps: - - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: '20' - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d2865156c0c087..263926420781ee 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: # Need this to be able to inquire about origin/master filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. - - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: '20' @@ -67,7 +67,7 @@ jobs: # Need this to be able to inquire about origin/master filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. - - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: '20' @@ -87,7 +87,7 @@ jobs: echo "store=$(pnpm store path)" >> $GITHUB_OUTPUT - name: Restore pnpm cache - uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache/restore@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 with: path: ${{ steps.pnpm-cache.outputs.store }} key: ${{ runner.os }}-pnpm-store-cache- diff --git a/.github/workflows/format-and-commit.yml b/.github/workflows/format-and-commit.yml index 999947edb12a52..e142078a997373 100644 --- a/.github/workflows/format-and-commit.yml +++ b/.github/workflows/format-and-commit.yml @@ -24,7 +24,7 @@ jobs: id: date run: echo "date=$(/bin/date -u "+%Y-%m-%d")" >> $GITHUB_OUTPUT - - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + - uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 with: # dprint caches info about the files in the repo to skip formatting them. # However, since package.json and .dprint.jsonc don't change very often, diff --git a/.github/workflows/pnpm-cache.yml b/.github/workflows/pnpm-cache.yml index cf8f4ad73a6e4d..9a133051adefd5 100644 --- a/.github/workflows/pnpm-cache.yml +++ b/.github/workflows/pnpm-cache.yml @@ -12,7 +12,7 @@ jobs: if: ${{ github.repository == 'DefinitelyTyped/DefinitelyTyped' }} steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: '20' - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -27,7 +27,7 @@ jobs: run: pnpm install - name: Save pnpm cache - uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache/save@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 with: path: ${{ steps.pnpm-cache.outputs.store }} key: ${{ runner.os }}-pnpm-store-cache-${{ steps.pnpm-cache.outputs.date }} diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index c86df0f4fbfcbb..b5cf06c493c6ee 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -1029,7 +1029,7 @@ declare namespace chrome { cookies?: boolean | undefined; /** * Stored passwords. - * @deprecated Support for password deletion through extensions has been removed. This data type will be ignored. + * @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This data type will be ignored. */ passwords?: boolean | undefined; /** @@ -1125,7 +1125,7 @@ declare namespace chrome { * Clears the browser's stored passwords. * * Can return its result via Promise in Manifest V3 or later since Chrome 96. - * @deprecated Support for password deletion through extensions has been removed. This function has no effect. + * @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This function has no effect. */ export function removePasswords(options: RemovalOptions): Promise; export function removePasswords(options: RemovalOptions, callback: () => void): void; @@ -3779,6 +3779,8 @@ declare namespace chrome { BLOCKED_SCAN_FAILED = "blockedScanFailed", /** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to Google Drive. */ FORCE_SAVE_TO_GDRIVE = "forceSaveToGdrive", + /** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to OneDrive. */ + FORCE_SAVE_TO_ONEDRIVE = "forceSaveToOnedrive", } export interface DownloadItem { @@ -13085,6 +13087,10 @@ declare namespace chrome { EXTRA_HEADERS = "extraHeaders", /** Specifies that the response headers should be included in the event. */ RESPONSE_HEADERS = "responseHeaders", + /** Specifies that the SecurityInfo should be included in the event. */ + SECURITY_INFO = "securityInfo", + /** Specifies that the SecurityInfo with raw bytes of certificates should be included in the event. */ + SECURITY_INFO_RAW_DER = "securityInfoRawDer", } /** @since Chrome 44 */ @@ -13145,6 +13151,23 @@ declare namespace chrome { OTHER = "other", } + /** @since Chrome 144 */ + export interface SecurityInfo { + /** A list of certificates */ + certificates: { + /** Fingerprints of the certificate. */ + fingerprint: { + /** sha256 fingerprint of the certificate. */ + sha256: string; + }; + /** Raw bytes of DER encoded server certificate */ + rawDER?: ArrayBuffer; + }[]; + + /** State of the connection. One of secure, insecure, broken. */ + state: string; + } + /** Contains data uploaded in a URL request. */ export interface UploadData { /** An ArrayBuffer with a copy of the data. */ @@ -13282,6 +13305,11 @@ declare namespace chrome { export interface OnHeadersReceivedDetails extends WebRequestDetails { /** The HTTP response headers that have been received with this response. */ responseHeaders?: HttpHeader[]; + /** + * Information about the TLS/QUIC connection used for the underlying connection. Only provided if `securityInfo` is specified in the `extraInfoSpec` parameter. + * @since Chrome 144 + */ + securityInfo?: SecurityInfo; /** Standard HTTP status code returned by the server. */ statusCode: number; /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/ @@ -14541,6 +14569,14 @@ declare namespace chrome { default_path: string; } + /** + * Closes the extension's side panel. This is a no-op if the panel is already closed. + * @param options Specifies the context in which to close the side panel. + * @since Chrome 141 + */ + export function close(options: CloseOptions): Promise; + export function close(options: CloseOptions, callback: () => void): void; + /** * Returns the side panel's current layout. * @since Chrome 140 @@ -14593,6 +14629,12 @@ declare namespace chrome { export function setPanelBehavior(behavior: PanelBehavior): Promise; export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void; + /** + * Fired when the extension's side panel is closed. + * @since Chrome 142 + */ + const onClosed: events.Event<(info: PanelClosedInfo) => void>; + /** * Fired when the extension's side panel is opened. * @since Chrome 141 diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 323330f3012305..b6c5122fa14511 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -4920,6 +4920,7 @@ function testDownloads() { chrome.downloads.DangerType.DEEP_SCANNED_SAFE === "deepScannedSafe"; chrome.downloads.DangerType.FILE === "file"; chrome.downloads.DangerType.FORCE_SAVE_TO_GDRIVE === "forceSaveToGdrive"; + chrome.downloads.DangerType.FORCE_SAVE_TO_ONEDRIVE === "forceSaveToOnedrive"; chrome.downloads.DangerType.HOST === "host"; chrome.downloads.DangerType.PASSWORD_PROTECTED === "passwordProtected"; chrome.downloads.DangerType.PROMPT_FOR_LOCAL_PASSWORD_SCANNING === "promptForLocalPasswordScanning"; @@ -5080,7 +5081,7 @@ function testDownloads() { result.byExtensionName; // $ExpectType string | undefined result.bytesReceived; // $ExpectType number result.canResume; // $ExpectType boolean - result.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" + result.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" | "forceSaveToOnedrive" result.endTime; // $ExpectType string | undefined result.error; // $ExpectType "CRASH" | "FILE_ACCESS_DENIED" | "FILE_BLOCKED" | "FILE_FAILED" | "FILE_HASH_MISMATCH" | "FILE_NAME_TOO_LONG" | "FILE_NO_SPACE" | "FILE_SAME_AS_SOURCE" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_LARGE" | "FILE_TOO_SHORT" | "FILE_TRANSIENT_ERROR" | "FILE_VIRUS_INFECTED" | "NETWORK_DISCONNECTED" | "NETWORK_FAILED" | "NETWORK_INVALID_REQUEST" | "NETWORK_SERVER_DOWN" | "NETWORK_TIMEOUT" | "SERVER_BAD_CONTENT" | "SERVER_CERT_PROBLEM" | "SERVER_CONTENT_LENGTH_MISMATCH" | "SERVER_CROSS_ORIGIN_REDIRECT" | "SERVER_FAILED" | "SERVER_FORBIDDEN" | "SERVER_NO_RANGE" | "SERVER_UNAUTHORIZED" | "SERVER_UNREACHABLE" | "USER_CANCELED" | "USER_SHUTDOWN" | undefined result.estimatedEndTime; // $ExpectType string | undefined @@ -5138,7 +5139,7 @@ function testDownloads() { downloadItem.byExtensionName; // $ExpectType string | undefined downloadItem.bytesReceived; // $ExpectType number downloadItem.canResume; // $ExpectType boolean - downloadItem.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" + downloadItem.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" | "forceSaveToOnedrive" downloadItem.endTime; // $ExpectType string | undefined downloadItem.error; // $ExpectType "CRASH" | "FILE_ACCESS_DENIED" | "FILE_BLOCKED" | "FILE_FAILED" | "FILE_HASH_MISMATCH" | "FILE_NAME_TOO_LONG" | "FILE_NO_SPACE" | "FILE_SAME_AS_SOURCE" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_LARGE" | "FILE_TOO_SHORT" | "FILE_TRANSIENT_ERROR" | "FILE_VIRUS_INFECTED" | "NETWORK_DISCONNECTED" | "NETWORK_FAILED" | "NETWORK_INVALID_REQUEST" | "NETWORK_SERVER_DOWN" | "NETWORK_TIMEOUT" | "SERVER_BAD_CONTENT" | "SERVER_CERT_PROBLEM" | "SERVER_CONTENT_LENGTH_MISMATCH" | "SERVER_CROSS_ORIGIN_REDIRECT" | "SERVER_FAILED" | "SERVER_FORBIDDEN" | "SERVER_NO_RANGE" | "SERVER_UNAUTHORIZED" | "SERVER_UNREACHABLE" | "USER_CANCELED" | "USER_SHUTDOWN" | undefined downloadItem.estimatedEndTime; // $ExpectType string | undefined @@ -6198,6 +6199,15 @@ function testSidePanel() { chrome.sidePanel.Side.LEFT === "left"; chrome.sidePanel.Side.RIGHT === "right"; + const closeOptions: chrome.sidePanel.CloseOptions = { + tabId: 123, + }; + + chrome.sidePanel.close(closeOptions); // $ExpectType Promise + chrome.sidePanel.close(closeOptions, () => void 0); // $ExpectType void + // @ts-expect-error + chrome.sidePanel.close(closeOptions, () => {}).then(() => {}); + chrome.sidePanel.getLayout(); // $ExpectType Promise chrome.sidePanel.getLayout((layout) => { // $ExpectType void layout.side; // $ExpectType "left" | "right" @@ -6265,6 +6275,12 @@ function testSidePanel() { // @ts-expect-error chrome.sidePanel.setPanelBehavior(setPanelBehavior, () => {}).then(() => {}); + checkChromeEvent(chrome.sidePanel.onClosed, (info) => { + info.path; // $ExpectType string + info.tabId; // $ExpectType number | undefined + info.windowId; // $ExpectType number + }); + checkChromeEvent(chrome.sidePanel.onOpened, (info) => { info.path; // $ExpectType string info.tabId; // $ExpectType number | undefined @@ -6857,6 +6873,8 @@ function testWebRequest() { chrome.webRequest.OnHeadersReceivedOptions.BLOCKING === "blocking"; chrome.webRequest.OnHeadersReceivedOptions.EXTRA_HEADERS === "extraHeaders"; chrome.webRequest.OnHeadersReceivedOptions.RESPONSE_HEADERS === "responseHeaders"; + chrome.webRequest.OnHeadersReceivedOptions.SECURITY_INFO === "securityInfo"; + chrome.webRequest.OnHeadersReceivedOptions.SECURITY_INFO_RAW_DER === "securityInfoRawDer"; chrome.webRequest.OnResponseStartedOptions.EXTRA_HEADERS === "extraHeaders"; chrome.webRequest.OnResponseStartedOptions.RESPONSE_HEADERS === "responseHeaders"; @@ -7064,6 +7082,10 @@ function testWebRequest() { details.responseHeaders?.[0].name; // $ExpectType string | undefined details.responseHeaders?.[0].value; // $ExpectType string | undefined details.responseHeaders?.[0].binaryValue; // $ExpectType ArrayBuffer | undefined + details.securityInfo; // $ExpectType SecurityInfo | undefined + details.securityInfo!.certificates![0].fingerprint.sha256; // $ExpectType string + details.securityInfo!.certificates![0].rawDER; // $ExpectType ArrayBuffer | undefined + details.securityInfo!.state; // $ExpectType string details.statusCode; // $ExpectType number details.statusLine; // $ExpectType string details.tabId; // $ExpectType number diff --git a/types/eslint-plugin-security/eslint-plugin-security-tests.ts b/types/eslint-plugin-security/eslint-plugin-security-tests.ts index 0c38a3eb239502..f0c7440000b6f0 100644 --- a/types/eslint-plugin-security/eslint-plugin-security-tests.ts +++ b/types/eslint-plugin-security/eslint-plugin-security-tests.ts @@ -1,5 +1,12 @@ import type { Linter, Rule } from "eslint"; -import { configs, rules } from "eslint-plugin-security"; +import security from "eslint-plugin-security"; -const config: Linter.FlatConfig = configs.recommended; -const rule: Rule.RuleModule = rules["detect-unsafe-regex"]; +const name: string = security.meta.name; +const version: string = security.meta.version; + +const rule: Rule.RuleModule = security.rules["detect-unsafe-regex"]; + +const ruleConfig: Linter.Severity = security.rulesConfig["detect-unsafe-regex"]; + +const config: Linter.Config = security.configs.recommended; +const configLegacy: Linter.LegacyConfig = security.configs["recommended-legacy"]; diff --git a/types/eslint-plugin-security/index.d.ts b/types/eslint-plugin-security/index.d.ts index 8a4183bcb7aad9..c18a18133eec7e 100644 --- a/types/eslint-plugin-security/index.d.ts +++ b/types/eslint-plugin-security/index.d.ts @@ -1,7 +1,12 @@ -import { Linter, Rule } from "eslint"; +import type { ESLint, Linter, Rule } from "eslint"; -export const configs: { - recommended: Linter.FlatConfig; -}; +export const meta: Required>; export const rules: Record; + +export const rulesConfig: Record; + +export const configs: { + readonly "recommended": Linter.Config; + readonly "recommended-legacy": Linter.LegacyConfig; +}; diff --git a/types/eslint-plugin-security/package.json b/types/eslint-plugin-security/package.json index b0d59d44d62b5c..9f49ba4b4cb1c1 100644 --- a/types/eslint-plugin-security/package.json +++ b/types/eslint-plugin-security/package.json @@ -15,6 +15,10 @@ { "name": "rhysd", "githubUsername": "rhysd" + }, + { + "name": "Dom Porada", + "githubUsername": "porada" } ] } diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index 316c9f05360886..95eb737285d71b 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -371,6 +371,16 @@ declare namespace jasmine { */ function DiffBuilder(): DiffBuilder; + /** + * Formats a value for display, taking into account the current set of + * custom object formatters. + * + * @since 6.0.0 + * @param value The value to pretty-print + * @returns The pretty-printed value + */ + function pp(value: any): string; + /** * That will succeed if the actual value being compared is an instance of the specified class/constructor. */ diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index 45f5d63f8c7095..7818e7e4c3bfcd 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -2604,6 +2604,15 @@ describe("Debug logging", function() { jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; jasmine.MAX_PRETTY_PRINT_DEPTH = 40; +jasmine.pp(true); +jasmine.pp("string"); +jasmine.pp(42); +jasmine.pp({ key: "value" }); +jasmine.pp([1, 2, 3]); +jasmine.pp(new Map()); +jasmine.pp(new Set()); +jasmine.pp(() => {}); + (async () => { throwUnless(1).toEqual(2); diff --git a/types/jasmine/package.json b/types/jasmine/package.json index d0161c4ce29e08..4e98e712754ee1 100644 --- a/types/jasmine/package.json +++ b/types/jasmine/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/jasmine", - "version": "5.1.9999", + "version": "6.0.9999", "projects": [ "http://jasmine.github.io" ], diff --git a/types/leaflet.fullscreen/index.d.ts b/types/leaflet.fullscreen/index.d.ts deleted file mode 100644 index d4a4a9e6760aad..00000000000000 --- a/types/leaflet.fullscreen/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as L from "leaflet"; - -declare module "leaflet" { - namespace Control { - class Fullscreen extends Control { - constructor(options?: FullscreenOptions); - options: FullscreenOptions; - } - - interface FullscreenOptions { - content?: string | undefined; - position?: ControlPosition | undefined; - title?: string | undefined; - titleCancel?: string | undefined; - forceSeparateButton?: boolean | undefined; - forcePseudoFullscreen?: boolean | undefined; - fullscreenElement?: false | HTMLElement | undefined; - } - } - - namespace control { - /** - * Creates a fullscreen control. - */ - function fullscreen(options?: Control.FullscreenOptions): Control.Fullscreen; - } - - interface MapOptions { - fullscreenControl?: boolean | undefined; - fullscreenControlOptions?: Control.FullscreenOptions | undefined; - } - - interface Map { - toggleFullScreen(): void; - } -} diff --git a/types/leaflet.fullscreen/leaflet.fullscreen-tests.ts b/types/leaflet.fullscreen/leaflet.fullscreen-tests.ts deleted file mode 100644 index a7a0399b978d67..00000000000000 --- a/types/leaflet.fullscreen/leaflet.fullscreen-tests.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as L from "leaflet"; -import "leaflet.fullscreen"; - -const map: L.Map = L.map("map-container"); - -// Defaults -const icon: L.Control.Fullscreen = L.control.fullscreen({ - position: "topleft", - title: "Full Screen", - titleCancel: "Exit Full Screen", - forceSeparateButton: false, - forcePseudoFullscreen: false, - fullscreenElement: false, -}); - -icon.addTo(map); - -// My Usage -L.control.fullscreen({ - position: "topleft", - content: "", - forceSeparateButton: true, -}).addTo(map); - -// MapOptions initHook -L.map("map-container", { - fullscreenControl: true, - fullscreenControlOptions: { - position: "topleft", - title: "Full Screen", - titleCancel: "Exit Full Screen", - forceSeparateButton: false, - forcePseudoFullscreen: false, - fullscreenElement: false, - }, -}); - -// configurable fullscreen element -const htmlElement = map.getContainer(); -L.control.fullscreen({ - fullscreenElement: htmlElement, -}); - -// you can also toggle fullscreen from map object -map.toggleFullScreen(); diff --git a/types/leaflet.fullscreen/package.json b/types/leaflet.fullscreen/package.json deleted file mode 100644 index 542f3cf98aa764..00000000000000 --- a/types/leaflet.fullscreen/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "name": "@types/leaflet.fullscreen", - "version": "3.0.9999", - "projects": [ - "https://github.com/brunob/leaflet.fullscreen" - ], - "dependencies": { - "@types/leaflet": "^1.9" - }, - "devDependencies": { - "@types/leaflet.fullscreen": "workspace:." - }, - "owners": [ - { - "name": "William Comartin", - "githubUsername": "wcomartin" - }, - { - "name": "Dan Manastireanu", - "githubUsername": "danmana" - } - ] -} diff --git a/types/leaflet.fullscreen/.npmignore b/types/passport-google-oidc/.npmignore similarity index 100% rename from types/leaflet.fullscreen/.npmignore rename to types/passport-google-oidc/.npmignore diff --git a/types/passport-google-oidc/index.d.ts b/types/passport-google-oidc/index.d.ts new file mode 100644 index 00000000000000..e2c08d54b20c86 --- /dev/null +++ b/types/passport-google-oidc/index.d.ts @@ -0,0 +1,29 @@ +import OpenIDConnectStrategy = require("passport-openidconnect"); + +declare namespace GoogleOidcStrategy { + type StrategyOptions = + & Omit< + OpenIDConnectStrategy.StrategyOptions, + "issuer" | "authorizationURL" | "tokenURL" | "userInfoURL" + > + & { + // In the example from the repo, these are the only required properties + // https://github.com/jaredhanson/passport-google-openidconnect/blob/master/lib/strategy.js + clientID: string; + clientSecret: string; + callbackURL: string; + + issuer?: string | undefined; + authorizationURL?: string | undefined; + tokenURL?: string | undefined; + }; +} + +declare class GoogleOidcStrategy extends OpenIDConnectStrategy { + constructor( + options: GoogleOidcStrategy.StrategyOptions, + verify: OpenIDConnectStrategy.VerifyFunction, + ); +} + +export = GoogleOidcStrategy; diff --git a/types/passport-google-oidc/package.json b/types/passport-google-oidc/package.json new file mode 100644 index 00000000000000..9a17ffb7f4e135 --- /dev/null +++ b/types/passport-google-oidc/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "name": "@types/passport-google-oidc", + "version": "0.1.9999", + "projects": [ + "https://github.com/jaredhanson/passport-google-openidconnect#readme" + ], + "dependencies": { + "@types/passport-openidconnect": "*" + }, + "devDependencies": { + "@types/express": "*", + "@types/passport-google-oidc": "workspace:." + }, + "owners": [ + { + "name": "Nathan H. Leung", + "githubUsername": "nathanhleung" + } + ] +} diff --git a/types/passport-google-oidc/passport-google-oidc-tests.ts b/types/passport-google-oidc/passport-google-oidc-tests.ts new file mode 100644 index 00000000000000..5aef89d6edb382 --- /dev/null +++ b/types/passport-google-oidc/passport-google-oidc-tests.ts @@ -0,0 +1,132 @@ +import { Request } from "express"; +import GoogleOidcStrategy from "passport-google-oidc"; +import { Profile, VerifyCallback } from "passport-openidconnect"; + +const opts: GoogleOidcStrategy.StrategyOptions = { + clientID: "dummy", + clientSecret: "secret", + callbackURL: "https://example.com/callback", +}; + +function testVerifyFunc3(i: string, p: Profile, cb: VerifyCallback) { + cb(new Error("Not implemented")); +} + +function testVerifyFunc4(i: string, p: Profile, ctx: object, cb: VerifyCallback) { + cb(new Error("Not Implemented")); +} +function testVerifyFunc5(i: string, p: Profile, ctx: object, _idToken: string | object, cb: VerifyCallback) { + cb(new Error("Not implemented")); +} + +function testVerifyFunc7( + i: string, + p: Profile, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFunc8( + i: string, + p: Profile, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + _params: any, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFunc9( + i: string, + uiProfile: object, + idProfile: object, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + _params: any, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFuncReq4(r: Request, i: string, p: Profile, cb: VerifyCallback) { + cb(new Error("Not implemented")); +} + +function testVerifyFuncReq5(r: Request, i: string, p: Profile, ctx: object, cb: VerifyCallback) { + cb(new Error("Not Implemented")); +} +function testVerifyFuncReq6( + r: Request, + i: string, + p: Profile, + ctx: object, + _idToken: string | object, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFuncReq8( + r: Request, + i: string, + p: Profile, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFuncReq9( + r: Request, + i: string, + p: Profile, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + _params: any, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +function testVerifyFuncReq10( + r: Request, + i: string, + uiProfile: object, + idProfile: object, + ctx: object, + _idToken: string | object, + _accessToken: string | object, + _refreshToken: string | object, + _params: any, + cb: VerifyCallback, +) { + cb(new Error("Not implemented")); +} + +let strat: GoogleOidcStrategy = new GoogleOidcStrategy(opts, testVerifyFunc3); +strat = new GoogleOidcStrategy(opts, testVerifyFunc4); +strat = new GoogleOidcStrategy(opts, testVerifyFunc5); +strat = new GoogleOidcStrategy(opts, testVerifyFunc7); +strat = new GoogleOidcStrategy(opts, testVerifyFunc8); +strat = new GoogleOidcStrategy(opts, testVerifyFunc9); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq4); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq5); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq6); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq8); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq9); +strat = new GoogleOidcStrategy(opts, testVerifyFuncReq10); diff --git a/types/leaflet.fullscreen/tsconfig.json b/types/passport-google-oidc/tsconfig.json similarity index 82% rename from types/leaflet.fullscreen/tsconfig.json rename to types/passport-google-oidc/tsconfig.json index 9f7454e3fc637f..6f6c514c86e7cf 100644 --- a/types/leaflet.fullscreen/tsconfig.json +++ b/types/passport-google-oidc/tsconfig.json @@ -2,19 +2,18 @@ "compilerOptions": { "module": "node16", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "leaflet.fullscreen-tests.ts" + "passport-google-oidc-tests.ts" ] }