indexeddbshim 17.2.2 → 17.3.1

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 (92) hide show
  1. package/README.md +8 -5
  2. package/dist/CFG.d.ts +1 -1
  3. package/dist/CFG.d.ts.map +1 -1
  4. package/dist/DOMException.d.ts +21 -7
  5. package/dist/DOMException.d.ts.map +1 -1
  6. package/dist/DOMStringList.d.ts.map +1 -1
  7. package/dist/Event.d.ts +12 -6
  8. package/dist/Event.d.ts.map +1 -1
  9. package/dist/IDBCursor.d.ts +125 -7
  10. package/dist/IDBCursor.d.ts.map +1 -1
  11. package/dist/IDBDatabase.d.ts +17 -10
  12. package/dist/IDBDatabase.d.ts.map +1 -1
  13. package/dist/IDBFactory.d.ts +5 -0
  14. package/dist/IDBFactory.d.ts.map +1 -1
  15. package/dist/IDBIndex.d.ts +43 -13
  16. package/dist/IDBIndex.d.ts.map +1 -1
  17. package/dist/IDBKeyRange.d.ts +6 -2
  18. package/dist/IDBKeyRange.d.ts.map +1 -1
  19. package/dist/IDBObjectStore.d.ts +66 -17
  20. package/dist/IDBObjectStore.d.ts.map +1 -1
  21. package/dist/IDBRecord.d.ts +44 -0
  22. package/dist/IDBRecord.d.ts.map +1 -0
  23. package/dist/IDBRequest.d.ts +2 -2
  24. package/dist/IDBRequest.d.ts.map +1 -1
  25. package/dist/IDBTransaction.d.ts +43 -15
  26. package/dist/IDBTransaction.d.ts.map +1 -1
  27. package/dist/IDBVersionChangeEvent.d.ts +23 -12
  28. package/dist/IDBVersionChangeEvent.d.ts.map +1 -1
  29. package/dist/Key.d.ts +7 -6
  30. package/dist/Key.d.ts.map +1 -1
  31. package/dist/Sca.d.ts +15 -0
  32. package/dist/Sca.d.ts.map +1 -1
  33. package/dist/indexeddbshim-Key.js +59 -23
  34. package/dist/indexeddbshim-Key.js.map +1 -1
  35. package/dist/indexeddbshim-Key.min.js +2 -2
  36. package/dist/indexeddbshim-Key.min.js.map +1 -1
  37. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +3090 -1168
  38. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  39. package/dist/indexeddbshim-UnicodeIdentifiers.js +2660 -988
  40. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  41. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
  42. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  43. package/dist/indexeddbshim-node.cjs +3090 -1168
  44. package/dist/indexeddbshim-node.cjs.map +1 -1
  45. package/dist/indexeddbshim-noninvasive.js +2660 -988
  46. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  47. package/dist/indexeddbshim-noninvasive.min.js +4 -4
  48. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  49. package/dist/indexeddbshim.js +2660 -988
  50. package/dist/indexeddbshim.js.map +1 -1
  51. package/dist/indexeddbshim.min.js +4 -4
  52. package/dist/indexeddbshim.min.js.map +1 -1
  53. package/dist/node-UnicodeIdentifiers.d.ts +2 -2
  54. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
  55. package/dist/node.d.ts +2 -2
  56. package/dist/node.d.ts.map +1 -1
  57. package/dist/nodeSQLiteDatabase.d.ts +13 -14
  58. package/dist/nodeSQLiteDatabase.d.ts.map +1 -1
  59. package/dist/nodeWebSQL.d.ts +17 -1
  60. package/dist/nodeWebSQL.d.ts.map +1 -1
  61. package/dist/setGlobalVars.d.ts +2 -2
  62. package/dist/setGlobalVars.d.ts.map +1 -1
  63. package/dist/util.d.ts +15 -0
  64. package/dist/util.d.ts.map +1 -1
  65. package/examples/IDBKeyUtils.html +0 -1
  66. package/package.json +27 -21
  67. package/src/CFG.js +2 -1
  68. package/src/DOMException.js +38 -12
  69. package/src/DOMStringList.js +21 -2
  70. package/src/Event.js +9 -4
  71. package/src/IDBCursor.js +346 -18
  72. package/src/IDBDatabase.js +33 -16
  73. package/src/IDBFactory.js +118 -56
  74. package/src/IDBIndex.js +78 -45
  75. package/src/IDBKeyRange.js +8 -2
  76. package/src/IDBObjectStore.js +89 -65
  77. package/src/IDBRecord.js +96 -0
  78. package/src/IDBRequest.js +7 -7
  79. package/src/IDBTransaction.js +335 -67
  80. package/src/IDBVersionChangeEvent.js +37 -30
  81. package/src/Key.js +36 -18
  82. package/src/Sca.js +22 -1
  83. package/src/browser-UnicodeIdentifiers.js +3 -1
  84. package/src/browser-noninvasive.js +3 -1
  85. package/src/browser.js +3 -1
  86. package/src/node-UnicodeIdentifiers.js +1 -1
  87. package/src/node.js +1 -1
  88. package/src/nodeSQLiteDatabase.js +67 -2
  89. package/src/nodeWebSQL.js +22 -2
  90. package/src/setGlobalVars.js +23 -7
  91. package/src/util.js +29 -1
  92. package/typings/shimIndexedDB.d.ts +1 -1
@@ -1,8 +1,8 @@
1
1
  export default __setGlobalVars;
2
2
  /**
3
3
  * @param {import('./setGlobalVars.js').ShimmedObject} idb
4
- * @param {import('./CFG.js').default} initialConfig
4
+ * @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
5
5
  * @returns {import('./setGlobalVars.js').ShimmedObject|Window}
6
6
  */
7
- declare function __setGlobalVars(idb: import("./setGlobalVars.js").ShimmedObject, initialConfig?: any): import("./setGlobalVars.js").ShimmedObject | Window;
7
+ declare function __setGlobalVars(idb: import("./setGlobalVars.js").ShimmedObject, initialConfig?: Partial<import("./CFG.js").ConfigValues>): import("./setGlobalVars.js").ShimmedObject | Window;
8
8
  //# sourceMappingURL=node-UnicodeIdentifiers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-UnicodeIdentifiers.d.ts","sourceRoot":"","sources":["../src/node-UnicodeIdentifiers.js"],"names":[],"mappings":";AASA;;;;GAIG;AACH,sCAJW,OAAO,oBAAoB,EAAE,aAAa,wBAExC,OAAO,oBAAoB,EAAE,aAAa,GAAC,MAAM,CAe7D"}
1
+ {"version":3,"file":"node-UnicodeIdentifiers.d.ts","sourceRoot":"","sources":["../src/node-UnicodeIdentifiers.js"],"names":[],"mappings":";AASA;;;;GAIG;AACH,sCAJW,OAAO,oBAAoB,EAAE,aAAa,kBAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,OAAO,oBAAoB,EAAE,aAAa,GAAC,MAAM,CAe7D"}
package/dist/node.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export default __setGlobalVars;
2
2
  /**
3
3
  * @param {import('./setGlobalVars.js').ShimmedObject} idb
4
- * @param {import('./CFG.js').default} initialConfig
4
+ * @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
5
5
  * @returns {import('./setGlobalVars.js').ShimmedObject|Window}
6
6
  */
7
- declare function __setGlobalVars(idb: import("./setGlobalVars.js").ShimmedObject, initialConfig?: any): import("./setGlobalVars.js").ShimmedObject | Window;
7
+ declare function __setGlobalVars(idb: import("./setGlobalVars.js").ShimmedObject, initialConfig?: Partial<import("./CFG.js").ConfigValues>): import("./setGlobalVars.js").ShimmedObject | Window;
8
8
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,sCAJW,OAAO,oBAAoB,EAAE,aAAa,wBAExC,OAAO,oBAAoB,EAAE,aAAa,GAAC,MAAM,CAQ7D"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,sCAJW,OAAO,oBAAoB,EAAE,aAAa,kBAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,OAAO,oBAAoB,EAAE,aAAa,GAAC,MAAM,CAQ7D"}
@@ -2,38 +2,37 @@ export default SQLiteDatabase;
2
2
  export type SQLProfileCallback = (sql: string, duration: number) => void;
3
3
  export type SQLTraceCallback = ((sql: string) => void) | undefined;
4
4
  /**
5
- * @typedef {(sql: string, duration: number) => void} SQLProfileCallback
6
- */
7
- /**
8
- * @typedef {((sql: string) => void)|undefined} SQLTraceCallback
9
- */
10
- /**
5
+ * @class
11
6
  * @param {string} name
12
7
  * @param {{busyTimeout?: number, trace?: (sql: string) => void, profile?: SQLProfileCallback}} [opts]
8
+ * @this {{_db: any, _qFilePath: string}}
13
9
  * @returns {void}
14
10
  */
15
- declare function SQLiteDatabase(name: string, opts?: {
11
+ declare function SQLiteDatabase(this: {
12
+ _db: any;
13
+ _qFilePath: string;
14
+ }, name: string, opts?: {
16
15
  busyTimeout?: number;
17
16
  trace?: (sql: string) => void;
18
17
  profile?: SQLProfileCallback;
19
18
  }): void;
20
19
  declare class SQLiteDatabase {
21
20
  /**
22
- * @typedef {(sql: string, duration: number) => void} SQLProfileCallback
23
- */
24
- /**
25
- * @typedef {((sql: string) => void)|undefined} SQLTraceCallback
26
- */
27
- /**
21
+ * @class
28
22
  * @param {string} name
29
23
  * @param {{busyTimeout?: number, trace?: (sql: string) => void, profile?: SQLProfileCallback}} [opts]
24
+ * @this {{_db: any, _qFilePath: string}}
30
25
  * @returns {void}
31
26
  */
32
- constructor(name: string, opts?: {
27
+ constructor(this: {
28
+ _db: any;
29
+ _qFilePath: string;
30
+ }, name: string, opts?: {
33
31
  busyTimeout?: number;
34
32
  trace?: (sql: string) => void;
35
33
  profile?: SQLProfileCallback;
36
34
  });
35
+ _qFilePath: string;
37
36
  _db: any;
38
37
  /**
39
38
  * @param {{sql: string, args: unknown[]}[]} queries
@@ -1 +1 @@
1
- {"version":3,"file":"nodeSQLiteDatabase.d.ts","sourceRoot":"","sources":["../src/nodeSQLiteDatabase.js"],"names":[],"mappings":";iCAyBa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI;+BAIvC,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAC,SAAS;AAL9C;;GAEG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,sCAJW,MAAM,SACN;IAAC,WAAW,CAAC,EAAE,MA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AE,kBAAkB,CAAA;CAAC,GAEjF,IAAI,CAmEhB;;IAxED;;;;;;OAMG;IACH;aAHgB,GAAG;oBAAc,MAAM;aAF5B,MAAM,SACN;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,kBAAkB,CAAA;KAAC,EAqE7F;IAhEG,mBAAsB;IAkBtB,SA6CE;IAyBN;;;;;OAKG;IACH,cALW;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,EAAE,CAAA;KAAC,EAAE,YAChC,OAAO,YACP,CAAC,GAAG,EAAE,KAAK,GAAC,IAAI,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,IAAI,GACjD,IAAI,CAqFhB;;AA1OD;;GAEG;AACH;IACI;;;;;OAKG;IACH,mBALW,KAAK,GAAC,IAAI,GAAC,SAAS,aACpB,MAAM,GAAC,SAAS,iBAChB,MAAM,SACN,MAAM,EAAE,EAOlB;IAJG,gCAAkB;IAClB,6BAAwB;IACxB,iCAAgC;IAChC,2BAAgB;CAEvB"}
@@ -1,3 +1,19 @@
1
1
  export default nodeWebSQL;
2
- declare const nodeWebSQL: (...args: any[]) => import("websql-configurable/lib/websql/WebSQLDatabase.js").default;
2
+ export type SQLiteDatabaseInstance = {
3
+ _db: any;
4
+ exec: (typeof SQLiteDatabase)["prototype"]["exec"];
5
+ };
6
+ /**
7
+ * `websql-configurable`'s `customOpenDatabase` always calls this via `new`
8
+ * (see its `custom.js`: `new SQLiteDatabase(dbName, sqliteOpts)`), so this
9
+ * is typed with a construct signature even though `wrappedSQLiteDatabase`
10
+ * below is written as a plain function -- that's a deliberate, working JS
11
+ * idiom (a plain function invoked with `new` that explicitly `return`s an
12
+ * object yields that object as the `new` expression's result, overriding
13
+ * the default "return `this`" behavior), not something TypeScript can
14
+ * verify structurally.
15
+ */
16
+ export type SQLiteDatabaseConstructor = new (name: string, opts?: any) => SQLiteDatabaseInstance;
17
+ declare const nodeWebSQL: (...args: unknown[]) => import("websql-configurable/lib/websql/WebSQLDatabase.js").default;
18
+ import SQLiteDatabase from './nodeSQLiteDatabase.js';
3
19
  //# sourceMappingURL=nodeWebSQL.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeWebSQL.d.ts","sourceRoot":"","sources":["../src/nodeWebSQL.js"],"names":[],"mappings":";AAsBA,iHAAiE"}
1
+ {"version":3,"file":"nodeWebSQL.d.ts","sourceRoot":"","sources":["../src/nodeWebSQL.js"],"names":[],"mappings":";qCAKa;IACR,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,CAAA,OAAO,cAAc,EAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;CACjD;;;;;;;;;;;wCAYS,KAAK,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,sBAAsB;AAsBrE,qHAAqI;2BAzC1G,yBAAyB"}
@@ -70,9 +70,9 @@ import { createDOMException } from './DOMException.js';
70
70
  /**
71
71
  *
72
72
  * @param {ShimmedObject} [idb]
73
- * @param {import('./CFG.js').ConfigValues} [initialConfig]
73
+ * @param {Partial<import('./CFG.js').ConfigValues>} [initialConfig]
74
74
  * @returns {ShimmedObject}
75
75
  */
76
- declare function setGlobalVars(idb?: ShimmedObject, initialConfig?: import("./CFG.js").ConfigValues): ShimmedObject;
76
+ declare function setGlobalVars(idb?: ShimmedObject, initialConfig?: Partial<import("./CFG.js").ConfigValues>): ShimmedObject;
77
77
  import { IDBFactory } from './IDBFactory.js';
78
78
  //# sourceMappingURL=setGlobalVars.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setGlobalVars.d.ts","sourceRoot":"","sources":["../src/setGlobalVars.js"],"names":[],"mappings":";;uBAkBa,GAAG;+BAKL,OAAO,UAAU,EAAE,iBAAiB,GAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,QA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AAEH;;;;;GAKG;AACH,qCAJW,aAAa,kBACb,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,aAAa,CAkTzB;2BAxZ8C,iBAAiB"}
package/dist/util.d.ts CHANGED
@@ -139,6 +139,21 @@ export function defineListenerProperties(obj: object & {
139
139
  export function defineReadonlyProperties(obj: object, props: string | string[], getter?: null | {
140
140
  [key: string]: any;
141
141
  }): void;
142
+ /**
143
+ * `X.prototype.method = function (...) {}` (an assignment to a
144
+ * `MemberExpression`, as used throughout this codebase for IDB
145
+ * interface operations) does not get its `name` inferred by the
146
+ * engine the way object-literal method shorthand or a plain variable
147
+ * assignment would, so it is left as `''`. Per Web IDL, an operation's
148
+ * function object must have its `name` set to the operation's
149
+ * identifier, so call this once all of an interface's own-property
150
+ * operations have been assigned onto its prototype (or, for static
151
+ * operations, onto the constructor itself) to patch any still-empty
152
+ * names in place.
153
+ * @param {object} obj
154
+ * @returns {void}
155
+ */
156
+ export function setOperationNames(obj: object): void;
142
157
  /**
143
158
  *
144
159
  * @param {string|string[]} keyPath
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAKa,MAAM;;uBA6fN,GAAG;AAndhB;;;;GAIG;AACH,2CAHW,MAAM,GACJ,MAAM,CASlB;AAED;;;GAGG;AACH,4CAHW,MAAM,GACJ,MAAM,CAclB;AAuBD;;;;GAIG;AACH,qDAJW,MAAM,GAEJ,MAAM,CAoClB;AAmBD;;;;GAIG;AACH,uDAHW,MAAM,GACJ,MAAM,CAkClB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,sDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,mCAHW,MAAM,GACJ,MAAM,CAKlB;AAzID;;;GAGG;AACH,8BAHW,MAAM,GACJ,MAAM,CAI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ED;;;;;;;GAOG;AACH,8CANW,MAAM,GAAG;IACnB,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,aACO,MAAM,EAAE,GACN,IAAI,CA0BhB;AAED;;;;;;;;GAQG;AACH,8CAPW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,WACf,IAAI,GAAC;IACf,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,GACS,IAAI,CA8BhB;AAED;;;;;;;;;;;;;GAaG;AACH,uCAHW,MAAM,GACJ,IAAI,CAchB;AAgCD;;;;GAIG;AACH,wCAHW,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAWnB;AAED;;;;;GAKG;AACH,qCALW,MAAM,QACN,oBAAoB,GAAC,eAAe,GAElC,MAAM,CAyBlB;AAED;;GAEG;AAEH;;;;GAIG;AACH,sCAJW,QAAQ,gBACR,OAAO,GACL,MAAM,CAIlB;AAWD;;;;GAIG;AACH,gDAHW,QAAQ,GACN,MAAM,GAAC,MAAM,EAAE,CAW3B;AAED;;;GAGG;AACH,6BAHW,QAAQ,GACN,CAAC,IAAI,IAAI,GAAC,SAAS,CAI/B;AA6BD;;;GAGG;AACH,0CAHW,MAAM,IAAI,GACR,IAAI,CAmBhB"}
@@ -6,7 +6,6 @@
6
6
  <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
7
7
  </head>
8
8
  <body>
9
- <script src="../node_modules/core-js-bundle/minified.js"></script>
10
9
  <script src="../dist/indexeddbshim-Key.min.js"></script>
11
10
  <script>
12
11
  // import {extractKeyValueDecodedFromValueUsingKeyPath} from './src/Key.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "17.2.2",
3
+ "version": "17.3.1",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
@@ -22,7 +22,7 @@
22
22
  "coverage",
23
23
  "ignore",
24
24
  "eslint.config.js",
25
- ".mocharc.js",
25
+ ".mocharc.cjs",
26
26
  "tests-mocha/**",
27
27
  "tests-polyfill/**",
28
28
  "test-support/**"
@@ -31,6 +31,8 @@
31
31
  "scripts": {
32
32
  "tsc": "tsc",
33
33
  "tsc-prod": "tsc -p tsconfig-prod.json",
34
+ "tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
35
+ "tsc-prod:ts7": "npx -y typescript@^7 tsc -p tsconfig-prod.json",
34
36
  "build": "rm -R dist && npm run tsc-prod && npm run rollup",
35
37
  "prepublishOnly": "npm run license-badges && npm run build",
36
38
  "license-badge": "license-badger --corrections --uncategorizedLicenseTemplate \"\\${license} (\\${name} (\\${version}))\" --filteredTypes=nonempty --textTemplate \"License types\n(project, deps, and bundled devDeps)\" --packageJson --production badges/licenses-badge.svg",
@@ -47,13 +49,14 @@
47
49
  "clean-mock": "rimraf D_test_database*",
48
50
  "clean-w3c": "rimraf D_^D^B2* D_db* D_test* D_about* D_^I^D^B* D_blank* D_database_name* D_idbtransaction* D_x D_x.sqlite D_y D_y.sqlite D_webworker* D_http*",
49
51
  "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
50
- "copy": "copyup node_modules/core-js-bundle/minified.js node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
52
+ "clean-w3c-built": "rimraf test-support/js",
53
+ "copy": "copyup node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
51
54
  "fix-permissions": "chmod +x node_modules/npm-run-all/bin/*/index.js",
52
55
  "lint": "eslint .",
53
56
  "eslint": "npm run lint",
54
57
  "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
55
58
  "w3c-build-only": "node test-support/node-buildjs",
56
- "w3c-build": "run-s clean-w3c w3c-build-only",
59
+ "w3c-build": "run-s clean-w3c clean-w3c-built w3c-build-only",
57
60
  "fake": "run-s clean-fake coverage:fake clean-fake",
58
61
  "mock": "run-s clean-mock coverage:mock clean-mock",
59
62
  "w3c-old": "run-s clean-w3cOld coverage:w3cOld clean-w3cOld",
@@ -65,7 +68,7 @@
65
68
  "coverage:w3cOld": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+w3c --require source-map-support/register tests-polyfill/w3c/test-node.js",
66
69
  "coverage:w3c": "NODE_OPTIONS=--max_old_space_size=16384 c8 --silent --no-clean npm run w3c-test-only",
67
70
  "test:w3c": "NODE_OPTIONS=--max_old_space_size=16384 NODE_OPTIONS=--trace-warnings node test-support/node-idb-test.js",
68
- "w3c-test-only": "node --trace-warnings test-support/node-idb-test.js",
71
+ "w3c-test-only": "NODE_OPTIONS=--max_old_space_size=16384 node --trace-warnings test-support/node-idb-test.js",
69
72
  "coverage:mocha": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mocha --require source-map-support/register tests-mocha/test-node.js",
70
73
  "coverage-badge": "coveradge badges/coverage-badge",
71
74
  "coverage:report-only": "c8 report",
@@ -85,21 +88,26 @@
85
88
  "submodules": "run-s submodules-init submodules-fetch submodules-merge",
86
89
  "wpt": "run-p start web-platform-tests",
87
90
  "web-platform-tests": "cd web-platform-tests && ./wpt serve",
91
+ "stop-server": "pkill -f \"static -p 9999\" || true",
92
+ "stop-wpt": "pkill -f \"wpt serve\" || true",
93
+ "stop": "run-s stop-server stop-wpt",
88
94
  "w3c-find-unused": "node test-support/find-unused.js",
89
- "w3c": "run-s w3c-build w3c-test",
95
+ "w3c": "run-s w3c-test",
90
96
  "w3c-add-wrap": "node test-support/wrap-w3c-tests",
91
97
  "w3c-remove-wrap": "node test-support/wrap-w3c-tests remove",
92
98
  "w3c-wrap": "node test-support/wrap-w3c-tests",
93
99
  "test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
94
100
  "delay": "delay 9",
95
- "delayed-w3c-test": "run-s delay test:w3c",
101
+ "delayed-w3c-test": "run-s delay w3c-build-only test:w3c",
96
102
  "w3c-test": "run-s clean-w3c test-and-start:w3c",
97
- "w3c-good-only": "node test-support/node-idb-test.js good",
98
- "w3c-bad-only": "node test-support/node-idb-test.js bad",
103
+ "w3c-good-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js good",
104
+ "w3c-bad-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js bad",
99
105
  "w3c-good": "run-s w3c-build w3c-good-only clean-w3c",
100
106
  "w3c-bad": "run-s w3c-build w3c-bad-only clean-w3c",
101
107
  "w3c-good-test": "run-s w3c-good-only clean-w3c",
102
- "w3c-bad-test": "run-s w3c-bad-only clean-w3c"
108
+ "w3c-bad-test": "run-s w3c-bad-only clean-w3c",
109
+ "w3c-any-workers-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js any-workers",
110
+ "w3c-non-workers-only": "NODE_OPTIONS=--max_old_space_size=16384 node --trace-warnings test-support/node-idb-test.js"
103
111
  },
104
112
  "repository": {
105
113
  "type": "git",
@@ -157,14 +165,14 @@
157
165
  "node": "^22.18.0 || >= 24.11.0"
158
166
  },
159
167
  "dependencies": {
160
- "@node-static/node-static": "^0.9.0",
168
+ "@node-static/node-static": "^0.9.1",
161
169
  "better-sqlite3": "^13.0.3",
162
170
  "canvas": "^3.2.3",
163
- "eventtargeter": "0.9.0",
171
+ "eventtargeter": "0.12.0",
164
172
  "sync-promise-expanded": "^2.0.0",
165
173
  "typeson": "10.2.0",
166
- "typeson-registry": "13.1.0",
167
- "websql-configurable": "^3.0.3"
174
+ "typeson-registry": "14.2.1",
175
+ "websql-configurable": "^3.0.6"
168
176
  },
169
177
  "devDependencies": {
170
178
  "@babel/core": "^8.0.1",
@@ -177,7 +185,7 @@
177
185
  "@rollup/plugin-node-resolve": "^16.0.3",
178
186
  "@rollup/plugin-terser": "^1.0.0",
179
187
  "@types/better-sqlite3": "^9.6.0",
180
- "@types/node": "^26.2.0",
188
+ "@types/node": "^26.3.0",
181
189
  "@types/websql": "^0.0.30",
182
190
  "@unicode/unicode-17.0.0": "^1.6.17",
183
191
  "babel-plugin-add-module-exports": "1.0.4",
@@ -188,25 +196,24 @@
188
196
  "chokidar-cli": "^3.0.0",
189
197
  "colors": "1.4.0",
190
198
  "copyfiles": "^2.4.1",
191
- "core-js-bundle": "^3.50.0",
192
199
  "coveradge": "^0.8.2",
193
200
  "cyclonejs": "1.1.4",
194
201
  "delay-cli": "^3.0.0",
195
- "eslint": "^10.8.1",
196
- "eslint-config-ash-nazg": "^42.5.0",
202
+ "eslint": "^10.9.1",
203
+ "eslint-config-ash-nazg": "^42.6.0",
197
204
  "globals": "^17.11.0",
198
205
  "is-date-object": "1.1.0",
199
206
  "isomorphic-fetch": "^3.0.0",
200
207
  "jsdom": "^30.0.1",
201
208
  "license-badger": "^0.23.0",
202
- "local-xmlhttprequest": "2.0.0",
209
+ "local-xmlhttprequest": "3.0.0",
203
210
  "mocha": "^11.8.0",
204
211
  "mocha-badge-generator": "^0.11.0",
205
212
  "mocha-multi-reporters": "^1.5.1",
206
213
  "npm-run-all": "^4.1.5",
207
214
  "open-cli": "^9.0.0",
208
215
  "rimraf": "^6.1.3",
209
- "rollup": "^4.62.4",
216
+ "rollup": "^4.62.5",
210
217
  "rollup-plugin-filesize": "^10.0.0",
211
218
  "rollup-plugin-node-polyfills": "^0.2.1",
212
219
  "sinon": "^22.1.0",
@@ -222,7 +229,6 @@
222
229
  "canvas@3.2.3": true,
223
230
  "unrs-resolver@1.12.2": true,
224
231
  "better-sqlite3@13.0.3": true,
225
- "core-js-bundle@3.50.0": true,
226
232
  "is-hidden-file@1.1.2": true
227
233
  }
228
234
  }
package/src/CFG.js CHANGED
@@ -22,7 +22,8 @@
22
22
  * ) => import('typeson').Preset,
23
23
  * avoidAutoShim: boolean,
24
24
  * win: {
25
- * openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) => import('websql-configurable').default
25
+ * openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) =>
26
+ * import('websql-configurable/lib/websql/WebSQLDatabase.js').default
26
27
  * },
27
28
  * DEFAULT_DB_SIZE: number,
28
29
  * useSQLiteIndexes: boolean,
@@ -104,18 +104,29 @@ const legacyCodes = {
104
104
  DATA_CLONE_ERR: 25
105
105
  };
106
106
 
107
+ /**
108
+ * @typedef {globalThis.DOMException & {
109
+ * _code: number,
110
+ * _name: string|Code|LegacyCode,
111
+ * _message: string
112
+ * }} DOMExceptionFull
113
+ */
114
+
107
115
  /**
108
116
  *
109
117
  * @returns {typeof DOMException}
110
118
  */
111
119
  function createNonNativeDOMExceptionClass () {
112
120
  /**
121
+ * @class
113
122
  * @param {string|undefined} message
114
123
  * @param {Code|LegacyCode} name
124
+ * @this {DOMExceptionFull}
115
125
  * @returns {void}
116
126
  */
117
127
  function DOMException (message, name) {
118
128
  // const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
129
+ // @ts-expect-error It's ok
119
130
  this[Symbol.toStringTag] = 'DOMException';
120
131
  this._code = Object.hasOwn(codes, name)
121
132
  ? codes[/** @type {Code} */ (name)]
@@ -166,13 +177,14 @@ function createNonNativeDOMExceptionClass () {
166
177
  */
167
178
  get () {
168
179
  if (!(this instanceof DOMException ||
169
- // @ts-expect-error Just checking
180
+ // @ts-ignore Just checking; needed under some TS versions
170
181
  this instanceof DummyDOMException ||
171
- // @ts-expect-error Just checking
182
+ // @ts-ignore Just checking; needed under some TS versions
172
183
  this instanceof Error)) {
173
184
  throw new TypeError('Illegal invocation');
174
185
  }
175
- return this[prop === 'name' ? '_name' : '_message'];
186
+ const me = /** @type {DOMExceptionFull} */ (/** @type {unknown} */ (this));
187
+ return me[prop === 'name' ? '_name' : '_message'];
176
188
  }
177
189
  });
178
190
  });
@@ -194,7 +206,7 @@ function createNonNativeDOMExceptionClass () {
194
206
 
195
207
  const keys = Object.keys(codes);
196
208
 
197
- /** @type {(keyof codes)[]} */ (keys).forEach(
209
+ /** @type {(keyof typeof codes)[]} */ (keys).forEach(
198
210
  (codeName) => {
199
211
  Object.defineProperty(DOMException.prototype, codeName, {
200
212
  enumerable: true,
@@ -208,7 +220,7 @@ function createNonNativeDOMExceptionClass () {
208
220
  });
209
221
  }
210
222
  );
211
- /** @type {(keyof legacyCodes)[]} */ (Object.keys(legacyCodes)).forEach((
223
+ /** @type {(keyof typeof legacyCodes)[]} */ (Object.keys(legacyCodes)).forEach((
212
224
  codeName
213
225
  ) => {
214
226
  Object.defineProperty(DOMException.prototype, codeName, {
@@ -229,7 +241,7 @@ function createNonNativeDOMExceptionClass () {
229
241
  value: DOMException
230
242
  });
231
243
 
232
- // @ts-expect-error We don't need all its properties
244
+ // @ts-ignore We don't need all its properties; needed under some TS versions
233
245
  return DOMException;
234
246
  }
235
247
 
@@ -242,6 +254,7 @@ const ShimNonNativeDOMException = createNonNativeDOMExceptionClass();
242
254
  * @returns {Error}
243
255
  */
244
256
  function createNonNativeDOMException (name, message) {
257
+ // @ts-ignore It's ok; needed under some TS versions
245
258
  return new ShimNonNativeDOMException(message, name);
246
259
  }
247
260
 
@@ -311,20 +324,28 @@ function findError (args) {
311
324
  }
312
325
 
313
326
  /**
314
- *
315
- * @param {SQLError} webSQLErr
327
+ * The `websql-configurable` driver never constructs a real, spec-conformant
328
+ * `SQLError` (with a required numeric `.code`) -- errors it reports are
329
+ * always plain `Error`s from the underlying SQL driver, so `.code` is
330
+ * optional here and, in practice, always `undefined` today (the `case 4`/
331
+ * `case 7` branches below are effectively unreachable pending upstream
332
+ * support for surfacing a real error code).
333
+ * @param {Error & {code?: number}} webSQLErr
316
334
  * @returns {(DOMException|Error) & {
317
- * sqlError: SQLError
318
- * }}
335
+ * sqlError: Error & {code?: number}
336
+ * }|QuotaExceededError}
319
337
  */
320
338
  function webSQLErrback (webSQLErr) {
321
- let name, message;
339
+ let name, message, useQuotaExceededError = false;
322
340
  switch (webSQLErr.code) {
323
341
  case 4: { // SQLError.QUOTA_ERR
324
342
  name = 'QuotaExceededError';
325
343
  message = 'The operation failed because there was not enough ' +
326
344
  'remaining storage space, or the storage quota was reached ' +
327
345
  'and the user declined to give more space to the database.';
346
+ if (typeof QuotaExceededError !== 'undefined') {
347
+ useQuotaExceededError = true;
348
+ }
328
349
  break;
329
350
  }
330
351
  /*
@@ -343,10 +364,15 @@ function webSQLErrback (webSQLErr) {
343
364
  }
344
365
  }
345
366
  message += ' (' + webSQLErr.message + ')--(' + webSQLErr.code + ')';
367
+
368
+ if (useQuotaExceededError) {
369
+ return new QuotaExceededError(message);
370
+ }
371
+
346
372
  const err =
347
373
  /**
348
374
  * @type {(Error | DOMException) & {
349
- * sqlError: SQLError
375
+ * sqlError: Error & {code?: number}
350
376
  * }}
351
377
  */
352
378
  (createDOMException(name, message));
@@ -38,6 +38,10 @@ if (Object.defineProperty) {
38
38
  * @throws {TypeError}
39
39
  * @class
40
40
  */
41
+ /**
42
+ * @this {DOMStringListFull}
43
+ * @returns {never}
44
+ */
41
45
  const DOMStringList = function () {
42
46
  /** @type {string[]} */
43
47
  this._items = [];
@@ -53,6 +57,7 @@ DOMStringList.prototype = {
53
57
 
54
58
  /**
55
59
  * @param {string} str
60
+ * @this {DOMStringListFull}
56
61
  * @returns {boolean}
57
62
  */
58
63
  contains (str) {
@@ -64,6 +69,7 @@ DOMStringList.prototype = {
64
69
 
65
70
  /**
66
71
  * @param {number} key
72
+ * @this {DOMStringListFull}
67
73
  * @returns {string|null}
68
74
  */
69
75
  item (key) {
@@ -80,6 +86,7 @@ DOMStringList.prototype = {
80
86
 
81
87
  // Helpers. Should only be used internally.
82
88
  /**
89
+ * @this {DOMStringListFull}
83
90
  * @returns {DOMStringListFull}
84
91
  */
85
92
  clone () {
@@ -111,6 +118,7 @@ DOMStringList.prototype = {
111
118
  return this._items;
112
119
  },
113
120
  /**
121
+ * @this {DOMStringListFull}
114
122
  * @param {(value: string, i: Integer, arr: string[]) => void} cb
115
123
  * @param {object} thisArg
116
124
  * @returns {void}
@@ -120,6 +128,7 @@ DOMStringList.prototype = {
120
128
  this._items.forEach(cb, thisArg);
121
129
  },
122
130
  /**
131
+ * @this {DOMStringListFull}
123
132
  * @param {(value: string, i: Integer, arr: string[]) => any[]} cb
124
133
  * @param {object} thisArg
125
134
  * @returns {any[]}
@@ -130,6 +139,7 @@ DOMStringList.prototype = {
130
139
  },
131
140
  /**
132
141
  * @param {string} str
142
+ * @this {DOMStringListFull}
133
143
  * @returns {Integer}
134
144
  */
135
145
  indexOf (str) {
@@ -169,6 +179,11 @@ DOMStringList.prototype = {
169
179
  // and particularly as some methods, e.g., `IDBDatabase.transaction`
170
180
  // expect such sequence<DOMString> (or DOMString), we need an iterator (some of
171
181
  // the Mocha tests rely on these)
182
+ /**
183
+ * @this {DOMStringListFull}
184
+ * @yields {string}
185
+ * @returns {Generator<string, void, undefined>}
186
+ */
172
187
  *[Symbol.iterator] () {
173
188
  let i = 0;
174
189
  while (i < this._items.length) {
@@ -199,7 +214,7 @@ Object.defineProperty(DOMStringList, '__createInstance', {
199
214
  value () {
200
215
  /**
201
216
  * @class
202
- * @this {DOMStringList}
217
+ * @this {DOMStringListFull}
203
218
  */
204
219
  const DOMStringList = function DOMStringList () {
205
220
  this.toString = function () {
@@ -208,6 +223,10 @@ Object.defineProperty(DOMStringList, '__createInstance', {
208
223
  // Internal functions on the prototype have been made non-enumerable below.
209
224
  Object.defineProperty(this, 'length', {
210
225
  enumerable: true,
226
+ /**
227
+ * @this {DOMStringListFull}
228
+ * @returns {Integer}
229
+ */
211
230
  get () {
212
231
  return this._length;
213
232
  }
@@ -216,6 +235,7 @@ Object.defineProperty(DOMStringList, '__createInstance', {
216
235
  this._length = 0;
217
236
  };
218
237
  DOMStringList.prototype = DOMStringListAlias.prototype;
238
+ // @ts-ignore It's ok; needed under some TS versions
219
239
  return /** @type {DOMStringListFull} */ (new DOMStringList());
220
240
  }
221
241
  });
@@ -233,7 +253,6 @@ if (cleanInterface) {
233
253
  });
234
254
 
235
255
  // Illegal invocations
236
- // @ts-expect-error No return value
237
256
  Object.defineProperty(DOMStringList.prototype, 'length', {
238
257
  configurable: true,
239
258
  enumerable: true,
package/src/Event.js CHANGED
@@ -5,18 +5,23 @@ import * as util from './util.js';
5
5
  * @typedef {Error} DebuggingError
6
6
  */
7
7
 
8
+ /**
9
+ * @typedef {Event & {
10
+ * __legacyOutputDidListenersThrowError?: boolean,
11
+ * debug?: DebuggingError|null
12
+ * }} EventFull
13
+ */
14
+
8
15
  /**
9
16
  *
10
17
  * @param {string} type
11
18
  * @param {DebuggingError|null} [debug]
12
19
  * @param {EventInit} [evInit]
13
- * @returns {Event & {
14
- * __legacyOutputDidListenersThrowError?: boolean
15
- * }}
20
+ * @returns {EventFull}
16
21
  */
17
22
  function createEvent (type, debug, evInit) {
18
23
  // @ts-expect-error It's ok
19
- const ev = new ShimEvent(type, evInit);
24
+ const ev = /** @type {EventFull} */ (new ShimEvent(type, evInit));
20
25
  ev.debug = debug;
21
26
  return ev;
22
27
  }