@types/chrome 0.0.169 → 0.0.173

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +2 -2
  2. chrome/index.d.ts +86 -24
  3. chrome/package.json +2 -7
chrome/README.md CHANGED
@@ -8,9 +8,9 @@ This package contains type definitions for Chrome extension development (http://
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 09 Dec 2021 19:01:03 GMT
11
+ * Last updated: Sun, 26 Dec 2021 19:01:23 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
  * Global values: `chrome`
14
14
 
15
15
  # Credits
16
- These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://github.com/couven92), [RReverser](https://github.com/rreverser), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Thierry Régagnon](https://github.com/tregagnon), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [pokutuna](https://github.com/pokutuna), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), [Nicolas Rodriguez](https://github.com/nicolas377), and [Ido Salomon](https://github.com/idosal).
16
+ These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [RReverser](https://github.com/rreverser), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Thierry Régagnon](https://github.com/tregagnon), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [pokutuna](https://github.com/pokutuna), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), [Nicolas Rodriguez](https://github.com/nicolas377), and [Ido Salomon](https://github.com/idosal).
chrome/index.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  // Project: http://developer.chrome.com/extensions/
3
3
  // Definitions by: Matthew Kimber <https://github.com/matthewkimber>
4
4
  // otiai10 <https://github.com/otiai10>
5
- // couven92 <https://github.com/couven92>
6
5
  // RReverser <https://github.com/rreverser>
7
6
  // sreimer15 <https://github.com/sreimer15>
8
7
  // MatCarlson <https://github.com/MatCarlson>
@@ -1516,7 +1515,7 @@ declare namespace chrome.contextMenus {
1516
1515
  * Since Chrome 35.
1517
1516
  * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements.
1518
1517
  */
1519
- mediaType?: string | undefined;
1518
+ mediaType?: 'image' | 'video' | 'audio' | undefined;
1520
1519
  /**
1521
1520
  * Optional.
1522
1521
  * Since Chrome 35.
@@ -1548,6 +1547,10 @@ declare namespace chrome.contextMenus {
1548
1547
  srcUrl?: string | undefined;
1549
1548
  }
1550
1549
 
1550
+ type ContextType = "all" | "page" | "frame" | "selection" | "link" | "editable" | "image" | "video" | "audio" | "launcher" | "browser_action" | "page_action" | "action";
1551
+
1552
+ type ContextItemType = "normal" | "checkbox" | "radio" | "separator";
1553
+
1551
1554
  export interface CreateProperties {
1552
1555
  /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */
1553
1556
  documentUrlPatterns?: string[] | undefined;
@@ -1556,7 +1559,7 @@ declare namespace chrome.contextMenus {
1556
1559
  /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
1557
1560
  title?: string | undefined;
1558
1561
  /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */
1559
- contexts?: string[] | undefined;
1562
+ contexts?: ContextType | ContextType[] | undefined;
1560
1563
  /**
1561
1564
  * Optional.
1562
1565
  * Since Chrome 20.
@@ -1575,7 +1578,7 @@ declare namespace chrome.contextMenus {
1575
1578
  /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */
1576
1579
  parentId?: any;
1577
1580
  /** Optional. The type of menu item. Defaults to 'normal' if not specified. */
1578
- type?: string | undefined;
1581
+ type?: ContextItemType | undefined;
1579
1582
  /**
1580
1583
  * Optional.
1581
1584
  * Since Chrome 21.
@@ -1594,14 +1597,14 @@ declare namespace chrome.contextMenus {
1594
1597
  documentUrlPatterns?: string[] | undefined;
1595
1598
  checked?: boolean | undefined;
1596
1599
  title?: string | undefined;
1597
- contexts?: string[] | undefined;
1600
+ contexts?: ContextType[] | undefined;
1598
1601
  /** Optional. Since Chrome 20. */
1599
1602
  enabled?: boolean | undefined;
1600
1603
  targetUrlPatterns?: string[] | undefined;
1601
1604
  onclick?: Function | undefined;
1602
1605
  /** Optional. Note: You cannot change an item to be a child of one of its own descendants. */
1603
1606
  parentId?: number | string;
1604
- type?: string | undefined;
1607
+ type?: ContextItemType | undefined;
1605
1608
  /**
1606
1609
  * Optional.
1607
1610
  * @since Chrome 62.
@@ -1628,10 +1631,9 @@ declare namespace chrome.contextMenus {
1628
1631
  /**
1629
1632
  * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).
1630
1633
  * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.
1631
- * If you specify the callback parameter, it should be a function that looks like this:
1632
- * function() {...};
1634
+ * @returns The ID of the newly created item.
1633
1635
  */
1634
- export function create(createProperties: CreateProperties, callback?: () => void): void;
1636
+ export function create(createProperties: CreateProperties, callback?: () => void): number | string;
1635
1637
  /**
1636
1638
  * Updates a previously created context menu item.
1637
1639
  * @param id The ID of the item to update.
@@ -10986,6 +10988,18 @@ declare namespace chrome.declarativeNetRequest {
10986
10988
  /** Ruleset ID for the session-scoped rules added by the extension. */
10987
10989
  export const SESSION_RULESET_ID: string;
10988
10990
 
10991
+ /** This describes the HTTP request method of a network request. */
10992
+ export enum RequestMethod {
10993
+ CONNECT = "connect",
10994
+ DELETE = "delete",
10995
+ GET = "get",
10996
+ HEAD = "head",
10997
+ OPTIONS = "options",
10998
+ PATCH = "patch",
10999
+ POST = "post",
11000
+ PUT = "put"
11001
+ }
11002
+
10989
11003
  /** This describes the resource type of the network request. */
10990
11004
  export enum ResourceType {
10991
11005
  MAIN_FRAME = "main_frame",
@@ -11111,13 +11125,15 @@ declare namespace chrome.declarativeNetRequest {
11111
11125
  type: RuleActionType;
11112
11126
  }
11113
11127
 
11114
- export interface RuleCondition {
11115
- /** Specifies whether the network request is first-party or third-party to the domain from which it originated.
11128
+ export type RuleCondition = {
11129
+ /**
11130
+ * Specifies whether the network request is first-party or third-party to the domain from which it originated.
11116
11131
  * If omitted, all requests are accepted.
11117
11132
  */
11118
11133
  domainType?: DomainType | undefined;
11119
11134
 
11120
- /** The rule will only match network requests originating from the list of domains.
11135
+ /**
11136
+ * The rule will only match network requests originating from the list of domains.
11121
11137
  * If the list is omitted, the rule is applied to requests from all domains.
11122
11138
  * An empty list is not allowed.
11123
11139
  *
@@ -11129,7 +11145,8 @@ declare namespace chrome.declarativeNetRequest {
11129
11145
  */
11130
11146
  domains?: string[] | undefined;
11131
11147
 
11132
- /** The rule will not match network requests originating from the list of excludedDomains.
11148
+ /**
11149
+ * The rule will not match network requests originating from the list of excludedDomains.
11133
11150
  * If the list is empty or omitted, no domains are excluded.
11134
11151
  * This takes precedence over domains.
11135
11152
  *
@@ -11141,19 +11158,36 @@ declare namespace chrome.declarativeNetRequest {
11141
11158
  */
11142
11159
  excludedDomains?: string[] | undefined;
11143
11160
 
11144
- /** List of resource types which the rule won't match.
11145
- * Only one of resourceTypes and excludedResourceTypes should be specified.
11161
+ /**
11162
+ * List of request methods which the rule won't match.
11163
+ * Only one of requestMethods and excludedRequestMethods should be specified.
11164
+ * If neither of them is specified, all request methods are matched.
11165
+ */
11166
+ excludedRequestMethods?: RequestMethod[] | undefined;
11167
+
11168
+ /**
11169
+ * List of resource types which the rule won't match.
11170
+ * Only one of {@link chrome.declarativeNetRequest.RuleCondition.resourceTypes}
11171
+ * and {@link chrome.declarativeNetRequest.RuleCondition.excludedResourceTypes} should be specified.
11146
11172
  * If neither of them is specified, all resource types except "main_frame" are blocked.
11147
11173
  */
11148
11174
  excludedResourceTypes?: ResourceType[] | undefined;
11149
11175
 
11176
+ /**
11177
+ * List of {@link chrome.tabs.Tab.id} which the rule should not match.
11178
+ * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
11179
+ * Only supported for session-scoped rules.
11180
+ */
11181
+ excludedTabIds?: number[] | undefined;
11182
+
11150
11183
  /**
11151
11184
  * Whether the urlFilter or regexFilter (whichever is specified) is case sensitive.
11152
11185
  * Default is true.
11153
11186
  */
11154
11187
  isUrlFilterCaseSensitive?: boolean | undefined;
11155
11188
 
11156
- /** Regular expression to match against the network request url.
11189
+ /**
11190
+ * Regular expression to match against the network request url.
11157
11191
  * This follows the RE2 syntax.
11158
11192
  *
11159
11193
  * Note: Only one of urlFilter or regexFilter can be specified.
@@ -11163,14 +11197,22 @@ declare namespace chrome.declarativeNetRequest {
11163
11197
  */
11164
11198
  regexFilter?: string | undefined;
11165
11199
 
11166
- /** List of resource types which the rule can match.
11167
- * An empty list is not allowed.
11168
- *
11169
- * Note: this must be specified for allowAllRequests rules and may only include the sub_frame and main_frame resource types.
11200
+ /**
11201
+ * List of HTTP request methods which the rule can match. An empty list is not allowed.
11202
+ * Note: Specifying a {@link chrome.declarativeNetRequest.RuleCondition.requestMethods} rule condition will also exclude non-HTTP(s) requests,
11203
+ * whereas specifying {@link chrome.declarativeNetRequest.RuleCondition.excludedRequestMethods} will not.
11204
+ */
11205
+ requestMethods?: RequestMethod[];
11206
+
11207
+ /**
11208
+ * List of {@link chrome.tabs.Tab.id} which the rule should not match.
11209
+ * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
11210
+ * An empty list is not allowed. Only supported for session-scoped rules.
11170
11211
  */
11171
- resourceTypes?: ResourceType[] | undefined;
11212
+ tabIds?: number | undefined;
11172
11213
 
11173
- /** The pattern which is matched against the network request url.
11214
+ /**
11215
+ * The pattern which is matched against the network request url.
11174
11216
  * Supported constructs:
11175
11217
  *
11176
11218
  * '*' : Wildcard: Matches any number of characters.
@@ -11195,7 +11237,26 @@ declare namespace chrome.declarativeNetRequest {
11195
11237
  * For example, when the request url is http://abc.рф?q=ф, the urlFilter will be matched against the url http://abc.xn--p1ai/?q=%D1%84.
11196
11238
  */
11197
11239
  urlFilter?: string | undefined;
11198
- }
11240
+ } & (
11241
+ | {
11242
+ /**
11243
+ * List of resource types which the rule won't match.
11244
+ * Only one of {@link chrome.declarativeNetRequest.RuleCondition.resourceTypes}
11245
+ * and {@link chrome.declarativeNetRequest.RuleCondition.excludedResourceTypes} should be specified.
11246
+ * If neither of them is specified, all resource types except "main_frame" are blocked.
11247
+ */
11248
+ excludedResourceTypes?: ResourceType[] | undefined;
11249
+ }
11250
+ | {
11251
+ /**
11252
+ * List of resource types which the rule can match.
11253
+ * An empty list is not allowed.
11254
+ *
11255
+ * Note: this must be specified for allowAllRequests rules and may only include the sub_frame and main_frame resource types.
11256
+ */
11257
+ resourceTypes?: ResourceType[] | undefined;
11258
+ }
11259
+ );
11199
11260
 
11200
11261
  export interface MatchedRule {
11201
11262
  /** A matching rule's ID. */
@@ -11365,7 +11426,8 @@ declare namespace chrome.declarativeNetRequest {
11365
11426
  /** Rules to add. */
11366
11427
  addRules?: Rule[] | undefined;
11367
11428
 
11368
- /** IDs of the rules to remove.
11429
+ /**
11430
+ * IDs of the rules to remove.
11369
11431
  * Any invalid IDs will be ignored.
11370
11432
  */
11371
11433
  removeRuleIds?: number[] | undefined;
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.169",
3
+ "version": "0.0.173",
4
4
  "description": "TypeScript definitions for Chrome extension development",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -15,11 +15,6 @@
15
15
  "url": "https://github.com/otiai10",
16
16
  "githubUsername": "otiai10"
17
17
  },
18
- {
19
- "name": "couven92",
20
- "url": "https://github.com/couven92",
21
- "githubUsername": "couven92"
22
- },
23
18
  {
24
19
  "name": "RReverser",
25
20
  "url": "https://github.com/rreverser",
@@ -103,6 +98,6 @@
103
98
  "@types/filesystem": "*",
104
99
  "@types/har-format": "*"
105
100
  },
106
- "typesPublisherContentHash": "602536495e691a80cf6e4d822b17751d3f2615eebca8617ae606281fe7279afc",
101
+ "typesPublisherContentHash": "fbe995bc0c62c1c3411056a81eb115bed3b617527d187fc0cebf08338b4e25b8",
107
102
  "typeScriptVersion": "3.8"
108
103
  }