@types/chrome 0.0.172 → 0.0.173

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.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +75 -15
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ 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, 23 Dec 2021 23:34:23 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
 
chrome/index.d.ts CHANGED
@@ -10988,6 +10988,18 @@ declare namespace chrome.declarativeNetRequest {
10988
10988
  /** Ruleset ID for the session-scoped rules added by the extension. */
10989
10989
  export const SESSION_RULESET_ID: string;
10990
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
+
10991
11003
  /** This describes the resource type of the network request. */
10992
11004
  export enum ResourceType {
10993
11005
  MAIN_FRAME = "main_frame",
@@ -11113,13 +11125,15 @@ declare namespace chrome.declarativeNetRequest {
11113
11125
  type: RuleActionType;
11114
11126
  }
11115
11127
 
11116
- export interface RuleCondition {
11117
- /** 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.
11118
11131
  * If omitted, all requests are accepted.
11119
11132
  */
11120
11133
  domainType?: DomainType | undefined;
11121
11134
 
11122
- /** 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.
11123
11137
  * If the list is omitted, the rule is applied to requests from all domains.
11124
11138
  * An empty list is not allowed.
11125
11139
  *
@@ -11131,7 +11145,8 @@ declare namespace chrome.declarativeNetRequest {
11131
11145
  */
11132
11146
  domains?: string[] | undefined;
11133
11147
 
11134
- /** 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.
11135
11150
  * If the list is empty or omitted, no domains are excluded.
11136
11151
  * This takes precedence over domains.
11137
11152
  *
@@ -11143,19 +11158,36 @@ declare namespace chrome.declarativeNetRequest {
11143
11158
  */
11144
11159
  excludedDomains?: string[] | undefined;
11145
11160
 
11146
- /** List of resource types which the rule won't match.
11147
- * 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.
11148
11172
  * If neither of them is specified, all resource types except "main_frame" are blocked.
11149
11173
  */
11150
11174
  excludedResourceTypes?: ResourceType[] | undefined;
11151
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
+
11152
11183
  /**
11153
11184
  * Whether the urlFilter or regexFilter (whichever is specified) is case sensitive.
11154
11185
  * Default is true.
11155
11186
  */
11156
11187
  isUrlFilterCaseSensitive?: boolean | undefined;
11157
11188
 
11158
- /** Regular expression to match against the network request url.
11189
+ /**
11190
+ * Regular expression to match against the network request url.
11159
11191
  * This follows the RE2 syntax.
11160
11192
  *
11161
11193
  * Note: Only one of urlFilter or regexFilter can be specified.
@@ -11165,14 +11197,22 @@ declare namespace chrome.declarativeNetRequest {
11165
11197
  */
11166
11198
  regexFilter?: string | undefined;
11167
11199
 
11168
- /** List of resource types which the rule can match.
11169
- * An empty list is not allowed.
11170
- *
11171
- * 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.
11172
11204
  */
11173
- resourceTypes?: ResourceType[] | undefined;
11205
+ requestMethods?: RequestMethod[];
11174
11206
 
11175
- /** The pattern which is matched against the network request url.
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.
11211
+ */
11212
+ tabIds?: number | undefined;
11213
+
11214
+ /**
11215
+ * The pattern which is matched against the network request url.
11176
11216
  * Supported constructs:
11177
11217
  *
11178
11218
  * '*' : Wildcard: Matches any number of characters.
@@ -11197,7 +11237,26 @@ declare namespace chrome.declarativeNetRequest {
11197
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.
11198
11238
  */
11199
11239
  urlFilter?: string | undefined;
11200
- }
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
+ );
11201
11260
 
11202
11261
  export interface MatchedRule {
11203
11262
  /** A matching rule's ID. */
@@ -11367,7 +11426,8 @@ declare namespace chrome.declarativeNetRequest {
11367
11426
  /** Rules to add. */
11368
11427
  addRules?: Rule[] | undefined;
11369
11428
 
11370
- /** IDs of the rules to remove.
11429
+ /**
11430
+ * IDs of the rules to remove.
11371
11431
  * Any invalid IDs will be ignored.
11372
11432
  */
11373
11433
  removeRuleIds?: number[] | undefined;
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.172",
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",
@@ -98,6 +98,6 @@
98
98
  "@types/filesystem": "*",
99
99
  "@types/har-format": "*"
100
100
  },
101
- "typesPublisherContentHash": "973f145197598c70e1e305ec6d5d91e58618d4e4b404c855315e4d4cea3f0890",
101
+ "typesPublisherContentHash": "fbe995bc0c62c1c3411056a81eb115bed3b617527d187fc0cebf08338b4e25b8",
102
102
  "typeScriptVersion": "3.8"
103
103
  }