@types/chrome 0.0.306 → 0.0.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chrome/README.md +1 -1
- chrome/index.d.ts +84 -77
- chrome/package.json +2 -2
chrome/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated: Fri,
|
11
|
+
* Last updated: Fri, 28 Feb 2025 08:36:18 GMT
|
12
12
|
* Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
|
13
13
|
|
14
14
|
# Credits
|
chrome/index.d.ts
CHANGED
@@ -5576,7 +5576,6 @@ declare namespace chrome {
|
|
5576
5576
|
* Permissions: "identity"
|
5577
5577
|
*/
|
5578
5578
|
export namespace identity {
|
5579
|
-
/** @since Chrome 32 */
|
5580
5579
|
export interface AccountInfo {
|
5581
5580
|
/** A unique identifier for the account. This ID will not change for the lifetime of the account. */
|
5582
5581
|
id: string;
|
@@ -5584,78 +5583,81 @@ declare namespace chrome {
|
|
5584
5583
|
|
5585
5584
|
/** @since Chrome 84 */
|
5586
5585
|
export enum AccountStatus {
|
5586
|
+
/** Specifies that Sync is enabled for the primary account. */
|
5587
5587
|
SYNC = "SYNC",
|
5588
|
+
/** Specifies the existence of a primary account, if any. */
|
5588
5589
|
ANY = "ANY",
|
5589
5590
|
}
|
5590
5591
|
|
5592
|
+
/** @since Chrome 84 */
|
5591
5593
|
export interface ProfileDetails {
|
5592
|
-
/**
|
5593
|
-
|
5594
|
-
* A status of the primary account signed into a profile whose ProfileUserInfo should be returned. Defaults to SYNC account status.
|
5595
|
-
*/
|
5596
|
-
accountStatus?: AccountStatus | undefined;
|
5594
|
+
/** A status of the primary account signed into a profile whose `ProfileUserInfo` should be returned. Defaults to `SYNC` account status. */
|
5595
|
+
accountStatus?: `${AccountStatus}`;
|
5597
5596
|
}
|
5598
5597
|
|
5599
5598
|
export interface TokenDetails {
|
5599
|
+
/** Fetching a token may require the user to sign-in to Chrome, or approve the application's requested scopes. If the interactive flag is `true`, `getAuthToken` will prompt the user as necessary. When the flag is `false` or omitted, `getAuthToken` will return failure any time a prompt would be required. */
|
5600
|
+
interactive?: boolean;
|
5601
|
+
/** The account ID whose token should be returned. If not specified, the function will use an account from the Chrome profile: the Sync account if there is one, or otherwise the first Google web account. */
|
5602
|
+
account?: AccountInfo;
|
5600
5603
|
/**
|
5601
|
-
*
|
5602
|
-
*
|
5603
|
-
*/
|
5604
|
-
interactive?: boolean | undefined;
|
5605
|
-
/**
|
5606
|
-
* Optional.
|
5607
|
-
* The account ID whose token should be returned. If not specified, the primary account for the profile will be used.
|
5608
|
-
* account is only supported when the "enable-new-profile-management" flag is set.
|
5609
|
-
* @since Chrome 37
|
5604
|
+
* The `enableGranularPermissions` flag allows extensions to opt-in early to the granular permissions consent screen, in which requested permissions are granted or denied individually.
|
5605
|
+
* @since Chrome 87
|
5610
5606
|
*/
|
5611
|
-
|
5607
|
+
enableGranularPermissions?: boolean;
|
5612
5608
|
/**
|
5613
|
-
* Optional.
|
5614
5609
|
* A list of OAuth2 scopes to request.
|
5615
|
-
*
|
5616
|
-
*
|
5610
|
+
*
|
5611
|
+
* When the `scopes` field is present, it overrides the list of scopes specified in manifest.json.
|
5617
5612
|
*/
|
5618
|
-
scopes?: string[]
|
5613
|
+
scopes?: string[];
|
5619
5614
|
}
|
5620
5615
|
|
5621
|
-
export interface
|
5622
|
-
/** An email address for the user account signed into the current profile. Empty if the user is not signed in or the identity.email manifest permission is not specified. */
|
5616
|
+
export interface ProfileUserInfo {
|
5617
|
+
/** An email address for the user account signed into the current profile. Empty if the user is not signed in or the `identity.email` manifest permission is not specified. */
|
5623
5618
|
email: string;
|
5624
|
-
/** A unique identifier for the account. This ID will not change for the lifetime of the account. Empty if the user is not signed in or (in M41+) the identity.email manifest permission is not specified. */
|
5619
|
+
/** A unique identifier for the account. This ID will not change for the lifetime of the account. Empty if the user is not signed in or (in M41+) the `identity.email` manifest permission is not specified. */
|
5625
5620
|
id: string;
|
5626
5621
|
}
|
5627
5622
|
|
5628
|
-
export interface
|
5623
|
+
export interface InvalidTokenDetails {
|
5629
5624
|
/** The specific token that should be removed from the cache. */
|
5630
5625
|
token: string;
|
5631
5626
|
}
|
5632
5627
|
|
5633
|
-
export interface
|
5628
|
+
export interface WebAuthFlowDetails {
|
5634
5629
|
/** The URL that initiates the auth flow. */
|
5635
5630
|
url: string;
|
5631
|
+
|
5636
5632
|
/**
|
5637
|
-
* Optional.
|
5638
5633
|
* Whether to launch auth flow in interactive mode.
|
5639
|
-
*
|
5640
|
-
*
|
5634
|
+
*
|
5635
|
+
* Since some auth flows may immediately redirect to a result URL, `launchWebAuthFlow` hides its web view until the first navigation either redirects to the final URL, or finishes loading a page meant to be displayed.
|
5636
|
+
*
|
5637
|
+
* If the `interactive` flag is `true`, the window will be displayed when a page load completes. If the flag is `false` or omitted, `launchWebAuthFlow` will return with an error if the initial navigation does not complete the flow.
|
5638
|
+
*
|
5639
|
+
* For flows that use JavaScript for redirection, `abortOnLoadForNonInteractive` can be set to `false` in combination with setting `timeoutMsForNonInteractive` to give the page a chance to perform any redirects.
|
5641
5640
|
*/
|
5642
|
-
interactive?: boolean
|
5643
|
-
}
|
5644
|
-
|
5645
|
-
export interface SignInChangeEvent
|
5646
|
-
extends chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void>
|
5647
|
-
{}
|
5648
|
-
|
5649
|
-
export interface GetAuthTokenResult {
|
5641
|
+
interactive?: boolean;
|
5650
5642
|
/**
|
5651
|
-
*
|
5652
|
-
*
|
5643
|
+
* Whether to terminate `launchWebAuthFlow` for non-interactive requests after the page loads. This parameter does not affect interactive flows.
|
5644
|
+
*
|
5645
|
+
* When set to `true` (default) the flow will terminate immediately after the page loads. When set to `false`, the flow will only terminate after the `timeoutMsForNonInteractive` passes. This is useful for identity providers that use JavaScript to perform redirections after the page loads.
|
5646
|
+
* @since Chrome 113
|
5653
5647
|
*/
|
5654
|
-
|
5648
|
+
abortOnLoadForNonInteractive?: boolean;
|
5655
5649
|
/**
|
5656
|
-
*
|
5657
|
-
*
|
5650
|
+
* The maximum amount of time, in milliseconds, `launchWebAuthFlow` is allowed to run in non-interactive mode in total. Only has an effect if `interactive` is `false`.
|
5651
|
+
* @since Chrome 113
|
5658
5652
|
*/
|
5653
|
+
timeoutMsForNonInteractive?: number;
|
5654
|
+
}
|
5655
|
+
|
5656
|
+
/** @since Chrome 105 */
|
5657
|
+
export interface GetAuthTokenResult {
|
5658
|
+
/** A list of OAuth2 scopes granted to the extension. */
|
5659
|
+
grantedScopes?: string[];
|
5660
|
+
/** The specific token associated with the request. */
|
5659
5661
|
token?: string;
|
5660
5662
|
}
|
5661
5663
|
|
@@ -5665,81 +5667,86 @@ declare namespace chrome {
|
|
5665
5667
|
* * Removes all OAuth2 access tokens from the token cache
|
5666
5668
|
* * Removes user's account preferences
|
5667
5669
|
* * De-authorizes the user from all auth flows
|
5668
|
-
*
|
5670
|
+
*
|
5671
|
+
* Can return its result via Promise since Chrome 106.
|
5669
5672
|
* @since Chrome 87
|
5670
|
-
* @param callback Called when the state has been cleared.
|
5671
5673
|
*/
|
5672
5674
|
export function clearAllCachedAuthTokens(): Promise<void>;
|
5673
5675
|
export function clearAllCachedAuthTokens(callback: () => void): void;
|
5674
5676
|
|
5675
5677
|
/**
|
5676
5678
|
* Retrieves a list of AccountInfo objects describing the accounts present on the profile.
|
5679
|
+
*
|
5677
5680
|
* getAccounts is only supported on dev channel.
|
5678
|
-
* Dev channel only.
|
5679
5681
|
*/
|
5680
5682
|
export function getAccounts(): Promise<AccountInfo[]>;
|
5681
5683
|
export function getAccounts(callback: (accounts: AccountInfo[]) => void): void;
|
5682
5684
|
|
5683
5685
|
/**
|
5684
5686
|
* Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json.
|
5687
|
+
*
|
5685
5688
|
* The Identity API caches access tokens in memory, so it's ok to call getAuthToken non-interactively any time a token is required. The token cache automatically handles expiration.
|
5689
|
+
*
|
5686
5690
|
* For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with with no context. In particular, do not use getAuthToken interactively when your app is first launched.
|
5687
|
-
* If `callback` is not provided, the function returns a Promise that resolves with the token.
|
5688
5691
|
* @param details Token options.
|
5689
|
-
*
|
5692
|
+
*
|
5693
|
+
* Can return its result via Promise since Chrome 105.
|
5690
5694
|
*/
|
5691
|
-
export function getAuthToken(details
|
5692
|
-
export function getAuthToken(
|
5693
|
-
|
5694
|
-
callback: (token?: string, grantedScopes?: string[]) => void,
|
5695
|
-
): void;
|
5695
|
+
export function getAuthToken(details?: TokenDetails): Promise<GetAuthTokenResult>;
|
5696
|
+
export function getAuthToken(details: TokenDetails, callback: (result: GetAuthTokenResult) => void): void;
|
5697
|
+
export function getAuthToken(callback: (result: GetAuthTokenResult) => void): void;
|
5696
5698
|
|
5697
5699
|
/**
|
5698
5700
|
* Retrieves email address and obfuscated gaia id of the user signed into a profile.
|
5701
|
+
*
|
5702
|
+
* Requires the `identity.email` manifest permission. Otherwise, returns an empty result.
|
5703
|
+
*
|
5699
5704
|
* This API is different from identity.getAccounts in two ways. The information returned is available offline, and it only applies to the primary account for the profile.
|
5700
|
-
* @
|
5705
|
+
* @param details Profile options.
|
5706
|
+
*
|
5707
|
+
* Can return its result via Promise since Chrome 105.
|
5701
5708
|
*/
|
5702
|
-
export function getProfileUserInfo(
|
5703
|
-
|
5704
|
-
|
5705
|
-
|
5706
|
-
|
5707
|
-
|
5708
|
-
export function getProfileUserInfo(details?: ProfileDetails): Promise<UserInfo>;
|
5709
|
+
export function getProfileUserInfo(details?: ProfileDetails): Promise<ProfileUserInfo>;
|
5710
|
+
export function getProfileUserInfo(
|
5711
|
+
details: ProfileDetails,
|
5712
|
+
callback: (userInfo: ProfileUserInfo) => void,
|
5713
|
+
): void;
|
5714
|
+
export function getProfileUserInfo(callback: (userInfo: ProfileUserInfo) => void): void;
|
5709
5715
|
|
5710
5716
|
/**
|
5711
5717
|
* Removes an OAuth2 access token from the Identity API's token cache.
|
5712
|
-
*
|
5713
|
-
* If
|
5718
|
+
*
|
5719
|
+
* If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with `getAuthToken`.
|
5714
5720
|
* @param details Token information.
|
5715
|
-
*
|
5721
|
+
*
|
5722
|
+
* Can return its result via Promise since Chrome 105.
|
5716
5723
|
*/
|
5717
|
-
export function removeCachedAuthToken(details:
|
5718
|
-
export function removeCachedAuthToken(details:
|
5724
|
+
export function removeCachedAuthToken(details: InvalidTokenDetails): Promise<void>;
|
5725
|
+
export function removeCachedAuthToken(details: InvalidTokenDetails, callback: () => void): void;
|
5719
5726
|
|
5720
5727
|
/**
|
5721
5728
|
* Starts an auth flow at the specified URL.
|
5722
|
-
*
|
5729
|
+
*
|
5730
|
+
* This method enables auth flows with non-Google identity providers by launching a web view and navigating it to the first URL in the provider's auth flow. When the provider redirects to a URL matching the pattern `https://<app-id>.chromiumapp.org/*`, the window will close, and the final redirect URL will be passed to the `callback` function.
|
5731
|
+
*
|
5723
5732
|
* For a good user experience it is important interactive auth flows are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests with no context. In particular, do not launch an interactive auth flow when your app is first launched.
|
5724
5733
|
* @param details WebAuth flow options.
|
5725
|
-
*
|
5734
|
+
*
|
5735
|
+
* Can return its result via Promise since Chrome 106
|
5726
5736
|
*/
|
5727
|
-
export function launchWebAuthFlow(details:
|
5728
|
-
export function launchWebAuthFlow(details:
|
5737
|
+
export function launchWebAuthFlow(details: WebAuthFlowDetails): Promise<string | undefined>;
|
5738
|
+
export function launchWebAuthFlow(details: WebAuthFlowDetails, callback: (responseUrl?: string) => void): void;
|
5729
5739
|
|
5730
5740
|
/**
|
5731
|
-
* Generates a redirect URL to be used in launchWebAuthFlow
|
5732
|
-
*
|
5733
|
-
*
|
5734
|
-
* @param path
|
5741
|
+
* Generates a redirect URL to be used in `launchWebAuthFlow`.
|
5742
|
+
*
|
5743
|
+
* The generated URLs match the pattern `https://<app-id>.chromiumapp.org/*`.
|
5744
|
+
* @param path The path appended to the end of the generated URL.
|
5735
5745
|
*/
|
5736
5746
|
export function getRedirectURL(path?: string): string;
|
5737
5747
|
|
5738
|
-
/**
|
5739
|
-
|
5740
|
-
* @since Chrome 33
|
5741
|
-
*/
|
5742
|
-
export var onSignInChanged: SignInChangeEvent;
|
5748
|
+
/** Fired when signin state changes for an account on the user's profile. */
|
5749
|
+
export const onSignInChanged: chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void>;
|
5743
5750
|
}
|
5744
5751
|
|
5745
5752
|
////////////////////
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.307",
|
4
4
|
"description": "TypeScript definitions for chrome",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
|
6
6
|
"license": "MIT",
|
@@ -94,6 +94,6 @@
|
|
94
94
|
"@types/har-format": "*"
|
95
95
|
},
|
96
96
|
"peerDependencies": {},
|
97
|
-
"typesPublisherContentHash": "
|
97
|
+
"typesPublisherContentHash": "1b2cd14db3a39318621debc8f99f89670de83d3669b282a376524e7b4fad1362",
|
98
98
|
"typeScriptVersion": "5.0"
|
99
99
|
}
|