fake-indexeddb 6.2.1 → 6.2.2

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/auto/index.js CHANGED
@@ -22,27 +22,21 @@ var globalVar =
22
22
  ? global
23
23
  : Function("return this;")();
24
24
 
25
- // Match the native behavior for `globalThis.indexedDB`, `globlThis.IDBCursor`, etc.
26
- // Per the IDL, `indexedDB` is readonly but the others are readwrite
25
+ // Partly match the native behavior for `globalThis.indexedDB`, `globalThis.IDBCursor`, etc.
26
+ // Per the IDL, `indexedDB` is readonly but the others are readwrite. For us, though, we want it to still
27
+ // be overwritable with `globalThis.<global> = ...`, so we make them all readwrite.
27
28
  // https://w3c.github.io/IndexedDB/#idl-index
28
- const createPropertyDescriptor = (value, readOnly = false) => {
29
+ const createPropertyDescriptor = (value) => {
29
30
  return {
30
- ...(readOnly
31
- ? {
32
- set: undefined,
33
- get: () => value,
34
- }
35
- : {
36
- value,
37
- writable: true,
38
- }),
31
+ value,
39
32
  enumerable: true,
40
33
  configurable: true,
34
+ writable: true,
41
35
  };
42
36
  };
43
37
 
44
38
  Object.defineProperties(globalVar, {
45
- indexedDB: createPropertyDescriptor(fakeIndexedDB, true),
39
+ indexedDB: createPropertyDescriptor(fakeIndexedDB),
46
40
  IDBCursor: createPropertyDescriptor(FDBCursor),
47
41
  IDBCursorWithValue: createPropertyDescriptor(FDBCursorWithValue),
48
42
  IDBDatabase: createPropertyDescriptor(FDBDatabase),
package/auto/index.mjs CHANGED
@@ -22,27 +22,21 @@ var globalVar =
22
22
  ? global
23
23
  : Function("return this;")();
24
24
 
25
- // Match the native behavior for `globalThis.indexedDB`, `globlThis.IDBCursor`, etc.
26
- // Per the IDL, `indexedDB` is readonly but the others are readwrite
25
+ // Partly match the native behavior for `globalThis.indexedDB`, `globalThis.IDBCursor`, etc.
26
+ // Per the IDL, `indexedDB` is readonly but the others are readwrite. For us, though, we want it to still
27
+ // be overwritable with `globalThis.<global> = ...`, so we make them all readwrite.
27
28
  // https://w3c.github.io/IndexedDB/#idl-index
28
- const createPropertyDescriptor = (value, readOnly = false) => {
29
+ const createPropertyDescriptor = (value) => {
29
30
  return {
30
- ...(readOnly
31
- ? {
32
- set: undefined,
33
- get: () => value,
34
- }
35
- : {
36
- value,
37
- writable: true,
38
- }),
31
+ value,
39
32
  enumerable: true,
40
33
  configurable: true,
34
+ writable: true,
41
35
  };
42
36
  };
43
37
 
44
38
  Object.defineProperties(globalVar, {
45
- indexedDB: createPropertyDescriptor(fakeIndexedDB, true),
39
+ indexedDB: createPropertyDescriptor(fakeIndexedDB),
46
40
  IDBCursor: createPropertyDescriptor(FDBCursor),
47
41
  IDBCursorWithValue: createPropertyDescriptor(FDBCursorWithValue),
48
42
  IDBDatabase: createPropertyDescriptor(FDBDatabase),
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _FDBRecord = _interopRequireDefault(require("../FDBRecord.js"));
7
8
  var _errors = require("./errors.js");
8
9
  var _extractKey = _interopRequireDefault(require("./extractKey.js"));
9
10
  var _RecordStore = _interopRequireDefault(require("./RecordStore.js"));
10
11
  var _valueToKey = _interopRequireDefault(require("./valueToKey.js"));
11
- var _FDBRecord = _interopRequireDefault(require("../FDBRecord.js"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-index
14
14
  class Index {
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _FDBRecord = _interopRequireDefault(require("../FDBRecord.js"));
7
8
  var _errors = require("./errors.js");
8
9
  var _extractKey = _interopRequireDefault(require("./extractKey.js"));
9
10
  var _KeyGenerator = _interopRequireDefault(require("./KeyGenerator.js"));
10
11
  var _RecordStore = _interopRequireDefault(require("./RecordStore.js"));
11
- var _FDBRecord = _interopRequireDefault(require("../FDBRecord.js"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-object-store
14
14
  class ObjectStore {
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _cmp = _interopRequireDefault(require("./cmp.js"));
8
7
  var _FDBKeyRange = _interopRequireDefault(require("../FDBKeyRange.js"));
8
+ var _cmp = _interopRequireDefault(require("./cmp.js"));
9
9
  var _errors = require("./errors.js");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  // what fraction of the total number of nodes are allowed to be deleted tombstones?
@@ -1,7 +1,6 @@
1
1
  import cmp from "./lib/cmp.js";
2
2
  import { DataError } from "./lib/errors.js";
3
3
  import valueToKey from "./lib/valueToKey.js";
4
-
5
4
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#range-concept
6
5
  class FDBKeyRange {
7
6
  static only(value) {
@@ -1,5 +1,4 @@
1
1
  import closeConnection from "./lib/closeConnection.js";
2
-
3
2
  /**
4
3
  * Forcibly closes a database. This simulates a database being closed due to abnormal reasons, such as
5
4
  * using DevTools to clear data while a database is open. Spec-wise, this is equivalent to
@@ -1,5 +1,4 @@
1
1
  import { queueTask } from "./scheduling.js";
2
-
3
2
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-database
4
3
  class Database {
5
4
  deletePending = false;
@@ -1,9 +1,8 @@
1
+ import FDBRecord from "../FDBRecord.js";
1
2
  import { ConstraintError } from "./errors.js";
2
3
  import extractKey from "./extractKey.js";
3
4
  import RecordStore from "./RecordStore.js";
4
5
  import valueToKey from "./valueToKey.js";
5
- import FDBRecord from "../FDBRecord.js";
6
-
7
6
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-index
8
7
  class Index {
9
8
  deleted = false;
@@ -1,9 +1,8 @@
1
+ import FDBRecord from "../FDBRecord.js";
1
2
  import { DataError } from "./errors.js";
2
3
  import extractKey from "./extractKey.js";
3
4
  import KeyGenerator from "./KeyGenerator.js";
4
5
  import RecordStore from "./RecordStore.js";
5
- import FDBRecord from "../FDBRecord.js";
6
-
7
6
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-object-store
8
7
  class ObjectStore {
9
8
  deleted = false;
@@ -1,7 +1,6 @@
1
- import cmp from "./cmp.js";
2
1
  import FDBKeyRange from "../FDBKeyRange.js";
2
+ import cmp from "./cmp.js";
3
3
  import { ConstraintError } from "./errors.js";
4
-
5
4
  // what fraction of the total number of nodes are allowed to be deleted tombstones?
6
5
  const MAX_TOMBSTONE_FACTOR = 2 / 3;
7
6
  const EVERYTHING_KEY_RANGE = new FDBKeyRange(undefined, undefined, false, false);
@@ -1,6 +1,5 @@
1
1
  import isPotentiallyValidKeyRange from "./isPotentiallyValidKeyRange.js";
2
2
  import enforceRange from "./enforceRange.js";
3
-
4
3
  // https://www.w3.org/TR/IndexedDB/#create-request-to-retrieve-multiple-items
5
4
  const extractGetAllOptions = (queryOrOptions, count, numArguments) => {
6
5
  let query;
@@ -1,5 +1,4 @@
1
1
  import valueToKey from "./valueToKey.js";
2
-
3
2
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-extracting-a-key-from-a-value-using-a-key-path
4
3
  const extractKey = (keyPath, value) => {
5
4
  if (Array.isArray(keyPath)) {
@@ -1,5 +1,4 @@
1
1
  import { SyntaxError } from "./errors.js";
2
-
3
2
  // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-valid-key-path
4
3
  const validateKeyPath = (keyPath, parent) => {
5
4
  // This doesn't make sense to me based on the spec, but it is needed to pass the W3C KeyPath tests (see same
@@ -1,6 +1,5 @@
1
1
  import { DataError } from "./errors.js";
2
2
  import isSharedArrayBuffer from "./isSharedArrayBuffer.js";
3
-
4
3
  // https://w3c.github.io/IndexedDB/#convert-value-to-key
5
4
  const valueToKey = (input, seen) => {
6
5
  if (typeof input === "number") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fake-indexeddb",
3
- "version": "6.2.1",
3
+ "version": "6.2.2",
4
4
  "description": "Fake IndexedDB: a pure JS in-memory implementation of the IndexedDB API",
5
5
  "homepage": "https://github.com/dumbmatter/fakeIndexedDB",
6
6
  "repository": {
@@ -131,6 +131,7 @@
131
131
  "dexie": "^4.0.11",
132
132
  "eslint": "^8.57.1",
133
133
  "eslint-config-prettier": "^9.1.0",
134
+ "eslint-plugin-import": "^2.32.0",
134
135
  "glob": "^11.0.2",
135
136
  "husky": "^9.1.7",
136
137
  "jest": "^30.0.0",