webext-schema 5.0.10 → 5.0.11

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.
package/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /* api */
6
6
  import { logErr, throwErr } from './modules/common.js';
7
7
  import { parseCommand } from './modules/update.js';
8
- import process from 'process';
8
+ import process from 'node:process';
9
9
  export { Schema } from './modules/schema.js';
10
10
 
11
11
  /* process */
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  /* api */
6
- import os from 'os';
6
+ import os from 'node:os';
7
7
 
8
8
  /* constants */
9
9
  export const CHAR = 'utf8';
@@ -3,10 +3,10 @@
3
3
  */
4
4
 
5
5
  /* api */
6
- import { fileURLToPath } from 'url';
6
+ import { fileURLToPath } from 'node:url';
7
7
  import { getType, isString } from './common.js';
8
- import fs, { promises as fsPromise } from 'fs';
9
- import path from 'path';
8
+ import fs, { promises as fsPromise } from 'node:fs';
9
+ import path from 'node:path';
10
10
  import { IS_WIN } from './constant.js';
11
11
 
12
12
  /* constants */
package/modules/schema.js CHANGED
@@ -8,8 +8,8 @@ import { convertUriToFilePath } from './file-util.js';
8
8
  import { getType, isObjectNotEmpty, isString } from './common.js';
9
9
  import camelize from 'camelize';
10
10
  import decamelize from 'decamelize';
11
- import fs from 'fs';
12
- import path from 'path';
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
13
  import sinon from 'sinon';
14
14
 
15
15
  export class Schema {
package/modules/update.js CHANGED
@@ -9,8 +9,8 @@ import { createFile } from './file-util.js';
9
9
  import { getType, isString } from './common.js';
10
10
  import { program as commander } from 'commander';
11
11
  import fetch from 'node-fetch';
12
- import path from 'path';
13
- import process from 'process';
12
+ import path from 'node:path';
13
+ import process from 'node:process';
14
14
 
15
15
  /* constants */
16
16
  const DIR_CWD = process.cwd();
package/package.json CHANGED
@@ -29,24 +29,25 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "camelize": "^1.0.1",
32
- "commander": "^9.4.1",
32
+ "commander": "^9.5.0",
33
33
  "decamelize": "^6.0.0",
34
- "json5": "^2.2.1",
34
+ "json5": "^2.2.3",
35
35
  "node-fetch": "^3.3.0",
36
- "sinon": "^15.0.0"
36
+ "sinon": "^15.0.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "c8": "^7.12.0",
40
40
  "chai": "^4.3.7",
41
- "eslint": "^8.29.0",
41
+ "eslint": "^8.31.0",
42
42
  "eslint-config-standard": "^17.0.0",
43
43
  "eslint-plugin-import": "^2.26.0",
44
44
  "eslint-plugin-jsdoc": "^39.6.4",
45
45
  "eslint-plugin-node": "^11.1.0",
46
46
  "eslint-plugin-promise": "^6.1.1",
47
+ "eslint-plugin-unicorn": "^45.0.2",
47
48
  "mocha": "^10.2.0",
48
49
  "nock": "^13.2.9",
49
50
  "npm-run-all": "^4.1.5"
50
51
  },
51
- "version": "5.0.10"
52
+ "version": "5.0.11"
52
53
  }
@@ -2507,6 +2507,7 @@
2507
2507
  },
2508
2508
  "bookmarkId": {
2509
2509
  "type": "string",
2510
+ "optional": true,
2510
2511
  "description": "The id of the bookmark where the context menu was clicked, if it was on a bookmark."
2511
2512
  },
2512
2513
  "modifiers": {
@@ -10106,6 +10107,42 @@
10106
10107
  }
10107
10108
  ],
10108
10109
  "functions": [
10110
+ {
10111
+ "name": "updateDynamicRules",
10112
+ "type": "function",
10113
+ "description": "Modifies the current set of dynamic rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. These rules are persisted across browser sessions and extension updates.",
10114
+ "async": "callback",
10115
+ "parameters": [
10116
+ {
10117
+ "name": "options",
10118
+ "type": "object",
10119
+ "properties": {
10120
+ "removeRuleIds": {
10121
+ "type": "array",
10122
+ "optional": true,
10123
+ "description": "IDs of the rules to remove. Any invalid IDs will be ignored.",
10124
+ "items": {
10125
+ "type": "integer"
10126
+ }
10127
+ },
10128
+ "addRules": {
10129
+ "type": "array",
10130
+ "optional": true,
10131
+ "description": "Rules to add.",
10132
+ "items": {
10133
+ "$ref": "Rule"
10134
+ }
10135
+ }
10136
+ }
10137
+ },
10138
+ {
10139
+ "name": "callback",
10140
+ "type": "function",
10141
+ "description": "Called when the dynamic rules have been updated",
10142
+ "parameters": []
10143
+ }
10144
+ ]
10145
+ },
10109
10146
  {
10110
10147
  "name": "updateSessionRules",
10111
10148
  "type": "function",
@@ -10216,6 +10253,27 @@
10216
10253
  }
10217
10254
  ]
10218
10255
  },
10256
+ {
10257
+ "name": "getDynamicRules",
10258
+ "type": "function",
10259
+ "description": "Returns the current set of dynamic rules for the extension.",
10260
+ "async": "callback",
10261
+ "parameters": [
10262
+ {
10263
+ "name": "callback",
10264
+ "type": "function",
10265
+ "parameters": [
10266
+ {
10267
+ "name": "dynamicRules",
10268
+ "type": "array",
10269
+ "items": {
10270
+ "$ref": "Rule"
10271
+ }
10272
+ }
10273
+ ]
10274
+ }
10275
+ ]
10276
+ },
10219
10277
  {
10220
10278
  "name": "getSessionRules",
10221
10279
  "type": "function",
@@ -10227,6 +10285,7 @@
10227
10285
  "type": "function",
10228
10286
  "parameters": [
10229
10287
  {
10288
+ "name": "sessionRules",
10230
10289
  "type": "array",
10231
10290
  "items": {
10232
10291
  "$ref": "Rule"
@@ -17457,7 +17516,7 @@
17457
17516
  {
17458
17517
  "name": "submitPing",
17459
17518
  "type": "function",
17460
- "description": "Submits a custom ping to the Telemetry back-end. See <code>submitExternalPing</code> inside TelemetryController.jsm for more details.",
17519
+ "description": "Submits a custom ping to the Telemetry back-end. See <code>submitExternalPing</code> inside TelemetryController.sys.mjs for more details.",
17461
17520
  "async": true,
17462
17521
  "parameters": [
17463
17522
  {
@@ -8559,28 +8559,45 @@
8559
8559
  "types": [
8560
8560
  {
8561
8561
  "id": "ContextType",
8562
- "type": "string",
8563
- "enum": [
8564
- "all",
8565
- "page",
8566
- "frame",
8567
- "selection",
8568
- "link",
8569
- "editable",
8570
- "password",
8571
- "image",
8572
- "video",
8573
- "audio",
8574
- "browser_action",
8575
- "compose_action",
8576
- "message_display_action",
8577
- "tab",
8578
- "message_list",
8579
- "folder_pane",
8580
- "compose_attachments",
8581
- "message_attachments",
8582
- "all_message_attachments",
8583
- "tools_menu"
8562
+ "choices": [
8563
+ {
8564
+ "type": "string",
8565
+ "enum": [
8566
+ "all",
8567
+ "page",
8568
+ "frame",
8569
+ "selection",
8570
+ "link",
8571
+ "editable",
8572
+ "password",
8573
+ "image",
8574
+ "video",
8575
+ "audio",
8576
+ "compose_action",
8577
+ "message_display_action",
8578
+ "tab",
8579
+ "message_list",
8580
+ "folder_pane",
8581
+ "compose_attachments",
8582
+ "message_attachments",
8583
+ "all_message_attachments",
8584
+ "tools_menu"
8585
+ ]
8586
+ },
8587
+ {
8588
+ "type": "string",
8589
+ "max_manifest_version": 2,
8590
+ "enum": [
8591
+ "browser_action"
8592
+ ]
8593
+ },
8594
+ {
8595
+ "type": "string",
8596
+ "min_manifest_version": 3,
8597
+ "enum": [
8598
+ "action"
8599
+ ]
8600
+ }
8584
8601
  ],
8585
8602
  "description": "The different contexts a menu can appear in. Specifying <value>all</value> is equivalent to the combination of all other contexts excluding <value>tab</value> and <value>tools_menu</value>. More information about each context can be found in the `Supported UI Elements <|link-ui-elements|>`__ article on developer.thunderbird.net."
8586
8603
  },
@@ -9005,7 +9022,7 @@
9005
9022
  "command": {
9006
9023
  "type": "string",
9007
9024
  "optional": true,
9008
- "description": "Specifies a command to issue for the context click. Currently supports internal commands <value>_execute_browser_action</value>, <value>_execute_compose_action</value> and <value>_execute_message_display_action</value>."
9025
+ "description": "Specifies a command to issue for the context click. Currently supports internal commands <value>_execute_action</value>, <value>_execute_compose_action</value> and <value>_execute_message_display_action</value>."
9009
9026
  }
9010
9027
  }
9011
9028
  },
@@ -3267,6 +3267,11 @@
3267
3267
  "minLength": 1,
3268
3268
  "description": "The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. <dim><match>dimmed match</match></dim>. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 "
3269
3269
  },
3270
+ "deletable": {
3271
+ "type": "boolean",
3272
+ "optional": true,
3273
+ "description": "Whether the suggest result can be deleted by the user."
3274
+ },
3270
3275
  "descriptionStyles": {
3271
3276
  "optional": true,
3272
3277
  "unsupported": true,
@@ -3431,6 +3436,17 @@
3431
3436
  "type": "function",
3432
3437
  "description": "User has ended the keyword input session without accepting the input.",
3433
3438
  "parameters": []
3439
+ },
3440
+ {
3441
+ "name": "onDeleteSuggestion",
3442
+ "type": "function",
3443
+ "description": "User has deleted a suggested result.",
3444
+ "parameters": [
3445
+ {
3446
+ "type": "string",
3447
+ "name": "text"
3448
+ }
3449
+ ]
3434
3450
  }
3435
3451
  ]
3436
3452
  }
@@ -9662,6 +9678,46 @@
9662
9678
  "min_manifest_version": 3
9663
9679
  }
9664
9680
  ]
9681
+ },
9682
+ {
9683
+ "$extend": "WebExtensionManifest",
9684
+ "properties": {
9685
+ "declarative_net_request": {
9686
+ "type": "object",
9687
+ "min_manifest_version": 3,
9688
+ "optional": true,
9689
+ "additionalProperties": {
9690
+ "$ref": "UnrecognizedProperty"
9691
+ },
9692
+ "properties": {
9693
+ "rule_resources": {
9694
+ "type": "array",
9695
+ "minItems": 1,
9696
+ "items": {
9697
+ "type": "object",
9698
+ "additionalProperties": {
9699
+ "$ref": "UnrecognizedProperty"
9700
+ },
9701
+ "properties": {
9702
+ "id": {
9703
+ "type": "string",
9704
+ "pattern": "^[^_]",
9705
+ "description": "A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use."
9706
+ },
9707
+ "enabled": {
9708
+ "type": "boolean",
9709
+ "description": "Whether the ruleset is enabled by default."
9710
+ },
9711
+ "path": {
9712
+ "$ref": "manifest.ExtensionURL",
9713
+ "description": "The path of the JSON ruleset relative to the extension directory."
9714
+ }
9715
+ }
9716
+ }
9717
+ }
9718
+ }
9719
+ }
9720
+ }
9665
9721
  }
9666
9722
  ]
9667
9723
  },
@@ -9719,6 +9775,95 @@
9719
9775
  }
9720
9776
  }
9721
9777
  },
9778
+ {
9779
+ "id": "URLTransform",
9780
+ "type": "object",
9781
+ "description": "Describes the type of the Rule.action.redirect.transform property.",
9782
+ "properties": {
9783
+ "scheme": {
9784
+ "type": "string",
9785
+ "optional": true,
9786
+ "description": "The new scheme for the request.",
9787
+ "enum": [
9788
+ "http",
9789
+ "https",
9790
+ "moz-extension"
9791
+ ]
9792
+ },
9793
+ "username": {
9794
+ "type": "string",
9795
+ "optional": true,
9796
+ "description": "The new username for the request."
9797
+ },
9798
+ "password": {
9799
+ "type": "string",
9800
+ "optional": true,
9801
+ "description": "The new password for the request."
9802
+ },
9803
+ "host": {
9804
+ "type": "string",
9805
+ "optional": true,
9806
+ "description": "The new host name for the request."
9807
+ },
9808
+ "port": {
9809
+ "type": "string",
9810
+ "optional": true,
9811
+ "description": "The new port for the request. If empty, the existing port is cleared."
9812
+ },
9813
+ "path": {
9814
+ "type": "string",
9815
+ "optional": true,
9816
+ "description": "The new path for the request. If empty, the existing path is cleared."
9817
+ },
9818
+ "query": {
9819
+ "type": "string",
9820
+ "optional": true,
9821
+ "description": "The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with '?'. Cannot be specified if 'queryTransform' is specified."
9822
+ },
9823
+ "queryTransform": {
9824
+ "type": "object",
9825
+ "optional": true,
9826
+ "description": "Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified.",
9827
+ "properties": {
9828
+ "removeParams": {
9829
+ "type": "array",
9830
+ "optional": true,
9831
+ "description": "The list of query keys to be removed.",
9832
+ "items": {
9833
+ "type": "string"
9834
+ }
9835
+ },
9836
+ "addOrReplaceParams": {
9837
+ "type": "array",
9838
+ "optional": true,
9839
+ "description": "The list of query key-value pairs to be added or replaced.",
9840
+ "items": {
9841
+ "type": "object",
9842
+ "properties": {
9843
+ "key": {
9844
+ "type": "string"
9845
+ },
9846
+ "value": {
9847
+ "type": "string"
9848
+ },
9849
+ "replaceOnly": {
9850
+ "type": "boolean",
9851
+ "optional": true,
9852
+ "description": "If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing.",
9853
+ "default": false
9854
+ }
9855
+ }
9856
+ }
9857
+ }
9858
+ }
9859
+ },
9860
+ "fragment": {
9861
+ "type": "string",
9862
+ "optional": true,
9863
+ "description": "The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should begin with '#'."
9864
+ }
9865
+ }
9866
+ },
9722
9867
  {
9723
9868
  "id": "Rule",
9724
9869
  "type": "object",
@@ -9880,9 +10025,9 @@
9880
10025
  "description": "Path relative to the extension directory. Should start with '/'."
9881
10026
  },
9882
10027
  "transform": {
9883
- "type": "object",
10028
+ "$ref": "URLTransform",
9884
10029
  "optional": true,
9885
- "description": "TODO: URLTransform - Url transformations to perform."
10030
+ "description": "Url transformations to perform."
9886
10031
  },
9887
10032
  "url": {
9888
10033
  "type": "string",
@@ -9911,8 +10056,9 @@
9911
10056
  },
9912
10057
  "operation": {
9913
10058
  "type": "string",
9914
- "description": "The operation to be performed on a header. The 'append' operation is not supported for request headers.",
10059
+ "description": "The operation to be performed on a header.",
9915
10060
  "enum": [
10061
+ "append",
9916
10062
  "set",
9917
10063
  "remove"
9918
10064
  ]
@@ -9920,7 +10066,7 @@
9920
10066
  "value": {
9921
10067
  "type": "string",
9922
10068
  "optional": true,
9923
- "description": "The new value for the header. Must be specified for the 'set' operation."
10069
+ "description": "The new value for the header. Must be specified for the 'append' and 'set' operations."
9924
10070
  }
9925
10071
  }
9926
10072
  }
@@ -9996,6 +10142,80 @@
9996
10142
  }
9997
10143
  ]
9998
10144
  },
10145
+ {
10146
+ "name": "getEnabledRulesets",
10147
+ "type": "function",
10148
+ "description": "Returns the ids for the current set of enabled static rulesets.",
10149
+ "async": "callback",
10150
+ "parameters": [
10151
+ {
10152
+ "name": "callback",
10153
+ "type": "function",
10154
+ "parameters": [
10155
+ {
10156
+ "type": "array",
10157
+ "name": "rulesetIds",
10158
+ "items": {
10159
+ "type": "string"
10160
+ }
10161
+ }
10162
+ ]
10163
+ }
10164
+ ]
10165
+ },
10166
+ {
10167
+ "name": "updateEnabledRulesets",
10168
+ "type": "function",
10169
+ "description": "Returns the ids for the current set of enabled static rulesets.",
10170
+ "async": "callback",
10171
+ "parameters": [
10172
+ {
10173
+ "name": "updateRulesetOptions",
10174
+ "type": "object",
10175
+ "properties": {
10176
+ "disableRulesetIds": {
10177
+ "type": "array",
10178
+ "items": {
10179
+ "type": "string"
10180
+ },
10181
+ "optional": true,
10182
+ "default": []
10183
+ },
10184
+ "enableRulesetIds": {
10185
+ "type": "array",
10186
+ "items": {
10187
+ "type": "string"
10188
+ },
10189
+ "optional": true,
10190
+ "default": []
10191
+ }
10192
+ }
10193
+ },
10194
+ {
10195
+ "name": "callback",
10196
+ "type": "function",
10197
+ "parameters": []
10198
+ }
10199
+ ]
10200
+ },
10201
+ {
10202
+ "name": "getAvailableStaticRuleCount",
10203
+ "type": "function",
10204
+ "description": "Returns the remaining number of static rules an extension can enable",
10205
+ "async": "callback",
10206
+ "parameters": [
10207
+ {
10208
+ "name": "callback",
10209
+ "type": "function",
10210
+ "parameters": [
10211
+ {
10212
+ "name": "count",
10213
+ "type": "integer"
10214
+ }
10215
+ ]
10216
+ }
10217
+ ]
10218
+ },
9999
10219
  {
10000
10220
  "name": "getSessionRules",
10001
10221
  "type": "function",
@@ -19730,6 +19950,11 @@
19730
19950
  "description": "The key exchange algorithm used in this request if state is \"secure\".",
19731
19951
  "optional": true
19732
19952
  },
19953
+ "secretKeyLength": {
19954
+ "type": "number",
19955
+ "description": "The length (in bits) of the secret key.",
19956
+ "optional": true
19957
+ },
19733
19958
  "signatureSchemeName": {
19734
19959
  "type": "string",
19735
19960
  "description": "The signature scheme used in this request if state is \"secure\".",