indexeddbshim 7.1.0 → 10.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "7.1.0",
3
+ "version": "10.0.0",
4
4
  "author": "Parashuram <code@nparashuram.com>",
5
5
  "contributors": [
6
6
  "Brett Zamir"
@@ -24,75 +24,6 @@
24
24
  "test-support/**"
25
25
  ]
26
26
  },
27
- "scripts": {
28
- "prepublishOnly": "echo 'reenable when license-badger updated: npm run license-badges'",
29
- "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",
30
- "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
31
- "license-badges": "run-p license-badge license-badge-dev",
32
- "start": "static -p 9999 -H '{\"Access-Control-Allow-Origin\": \"http://web-platform.test:8000\", \"Access-Control-Allow-Methods\": \"GET\", \"Access-Control-Allow-Headers\": \"Content-Type\"}'",
33
- "watch": "chokidar \"src/*\" \"node_modules/eventtarget/EventTarget.js\" \"node_modules/websql/lib/websql/WebSQLTransaction.js\" \"node_modules/websql/lib/websql/WebSQLDatabase.js\" -c \"npm run rollup\"",
34
- "dev": "run-p start watch",
35
- "clean": "run-p clean-sysDB clean-mocha clean-fake clean-mock clean-w3c clean-w3cOld",
36
- "clean-sysDB": "rimraf __sysdb__*",
37
- "clean-polyfill": "run-p clean-fake clean-mock clean-w3cOld clean-sysDB",
38
- "clean-mocha": "rimraf D_indexeddbshim_test_database_* D_test.sqlite",
39
- "clean-fake": "rimraf D_test0.*",
40
- "clean-mock": "rimraf D_test_database*",
41
- "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*",
42
- "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
43
- "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",
44
- "lint": "eslint --ext=js,md,html .",
45
- "eslint": "npm run lint",
46
- "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
47
- "w3c-build-only": "node test-support/node-buildjs",
48
- "w3c-build": "run-s clean-w3c w3c-build-only",
49
- "fake": "run-s clean-fake coverage:fake clean-fake",
50
- "mock": "run-s clean-mock coverage:mock clean-mock",
51
- "w3c-old": "run-s clean-w3cOld coverage:w3cOld clean-w3cOld",
52
- "tests-polyfill": "run-s clean-polyfill coverage:fake coverage:mock coverage:w3cOld",
53
- "mocha": "run-s clean-mocha coverage:mocha clean-mocha",
54
- "rollup": "rollup -c",
55
- "coverage:fake": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@mochajs/json-file-reporter+output+fake --require source-map-support/register tests-polyfill/fakeIndexedDB/test-node.js",
56
- "coverage:mock": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@mochajs/json-file-reporter+output+mock --require source-map-support/register tests-polyfill/indexedDBmock/test-node.js",
57
- "coverage:w3cOld": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@mochajs/json-file-reporter+output+w3c --require source-map-support/register tests-polyfill/w3c/test-node.js",
58
- "coverage:w3c": "NODE_OPTIONS=--max_old_space_size=4096 nyc --silent --no-clean npm run w3c-test-only",
59
- "test:w3c": "NODE_OPTIONS=--max_old_space_size=4096 node --experimental-worker test-support/node-idb-test",
60
- "w3c-test-only": "node --experimental-worker test-support/node-idb-test",
61
- "coverage:mocha": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@mochajs/json-file-reporter+output+mocha --require source-map-support/register tests-mocha/test-node.js",
62
- "coverage-badge": "coveradge badges/coverage-badge",
63
- "coverage:report-only": "nyc report",
64
- "coverage:report": "run-s coverage:report-only",
65
- "remove-cache": "rimraf node_modules/.cache",
66
- "remove-cov": "rimraf .nyc_output ",
67
- "remove-results": "rimraf test-support/results/file*.json",
68
- "coverage:polyfill": "run-s coverage:fake coverage:mock coverage:w3cOld",
69
- "tests-badge": "mbg --fileGlob \"./test-support/results/file*.json\" --badge_output badges/tests-badge.svg",
70
- "coverage": "run-s -c clean remove-cache remove-cov remove-results coverage:fake coverage:mock coverage:mocha coverage:w3c clean tests-badge coverage-badge coverage:report",
71
- "open-coverage-only": "open http://localhost:9999/coverage/lcov-report/",
72
- "open-coverage": "run-p start open-coverage-only",
73
- "test": "run-s lint coverage",
74
- "submodules-init": "git submodule update --init --recursive",
75
- "submodules-fetch": "git submodule foreach --recursive git fetch",
76
- "submodules-merge": "git submodule foreach git merge origin master",
77
- "submodules": "run-s submodules-init submodules-fetch submodules-merge",
78
- "wpt": "run-p start web-platform-tests",
79
- "web-platform-tests": "cd web-platform-tests && ./wpt serve",
80
- "w3c-find-unused": "node test-support/find-unused.js",
81
- "w3c": "run-s w3c-build w3c-test",
82
- "w3c-add-wrap": "node test-support/wrap-w3c-tests",
83
- "w3c-remove-wrap": "node test-support/wrap-w3c-tests remove",
84
- "w3c-wrap": "node test-support/wrap-w3c-tests",
85
- "test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
86
- "delay": "delay 9",
87
- "delayed-w3c-test": "run-s delay test:w3c",
88
- "w3c-test": "run-s clean-w3c test-and-start:w3c",
89
- "w3c-good-only": "node test-support/node-idb-test good",
90
- "w3c-bad-only": "node test-support/node-idb-test bad",
91
- "w3c-good": "run-s w3c-build w3c-good-only clean-w3c",
92
- "w3c-bad": "run-s w3c-build w3c-bad-only clean-w3c",
93
- "w3c-good-test": "run-s w3c-good-only clean-w3c",
94
- "w3c-bad-test": "run-s w3c-bad-only clean-w3c"
95
- },
96
27
  "repository": {
97
28
  "type": "git",
98
29
  "url": "https://github.com/indexeddbshim/IndexedDBShim"
@@ -129,78 +60,147 @@
129
60
  "last 3 Samsung versions"
130
61
  ],
131
62
  "engines": {
132
- "node": ">=10.0.0"
63
+ "node": ">=14.0.0"
133
64
  },
134
65
  "dependencies": {
135
66
  "eventtargeter": "0.8.0",
136
67
  "sync-promise": "git+https://github.com/brettz9/sync-promise.git#full-sync-missing-promise-features",
137
- "typeson": "6.0.0",
138
- "typeson-registry": "1.0.0-alpha.39",
139
- "websql": "git+https://github.com/brettz9/node-websql.git#configurable-secure2"
68
+ "typeson": "7.0.1",
69
+ "typeson-registry": "3.0.0",
70
+ "websql": "git+https://github.com/brettz9/node-websql.git#configurable-secure3"
140
71
  },
141
72
  "devDependencies": {
142
- "@babel/core": "^7.13.8",
143
- "@babel/preset-env": "^7.13.9",
144
- "@brettz9/eslint-plugin": "^1.0.3",
145
- "@mochajs/json-file-reporter": "^1.3.0",
146
- "@rollup/plugin-babel": "^5.3.0",
147
- "@rollup/plugin-commonjs": "^17.1.0",
73
+ "@babel/core": "^7.17.10",
74
+ "@babel/preset-env": "^7.17.10",
75
+ "@brettz9/eslint-plugin": "^1.0.4",
76
+ "@brettz9/node-static": "^0.1.1",
77
+ "@es-joy/json-file-reporter": "^1.3.1",
78
+ "@rollup/plugin-babel": "^5.3.1",
79
+ "@rollup/plugin-commonjs": "^22.0.0",
148
80
  "@rollup/plugin-json": "^4.1.0",
149
- "@rollup/plugin-node-resolve": "^11.2.0",
150
- "@rollup/plugin-replace": "^2.4.1",
151
- "@unicode/unicode-13.0.0": "1.0.4",
81
+ "@rollup/plugin-node-resolve": "^13.2.1",
82
+ "@rollup/plugin-replace": "^4.0.0",
83
+ "@unicode/unicode-13.0.0": "1.2.1",
152
84
  "babel-plugin-add-module-exports": "1.0.4",
153
- "bson": "^4.2.3",
85
+ "bson": "^4.6.3",
154
86
  "builtin-modules": "^3.2.0",
155
- "canvas": "^2.7.0",
156
- "chai": "4.3.3",
157
- "chokidar-cli": "^2.1.0",
87
+ "canvas": "^2.9.1",
88
+ "chai": "4.3.6",
89
+ "chokidar-cli": "^3.0.0",
158
90
  "colors": "1.4.0",
159
91
  "copyfiles": "^2.4.1",
160
- "core-js-bundle": "^3.9.1",
161
- "coveradge": "^0.6.0",
92
+ "core-js-bundle": "^3.22.3",
93
+ "coveradge": "^0.7.0",
162
94
  "cyclonejs": "1.1.4",
163
- "delay-cli": "^1.1.0",
164
- "eslint": "^7.21.0",
165
- "eslint-config-ash-nazg": "^29.8.1",
166
- "eslint-config-standard": "^16.0.2",
95
+ "delay-cli": "^2.0.0",
96
+ "eslint": "^8.14.0",
97
+ "eslint-config-ash-nazg": "^33.1.0",
98
+ "eslint-config-standard": "^17.0.0",
167
99
  "eslint-plugin-array-func": "^3.1.7",
168
- "eslint-plugin-compat": "^3.9.0",
100
+ "eslint-plugin-compat": "^4.0.2",
169
101
  "eslint-plugin-eslint-comments": "^3.2.0",
170
- "eslint-plugin-html": "^6.1.1",
171
- "eslint-plugin-import": "^2.22.1",
172
- "eslint-plugin-jsdoc": "^32.2.0",
173
- "eslint-plugin-markdown": "^2.0.0",
174
- "eslint-plugin-no-unsanitized": "^3.1.4",
102
+ "eslint-plugin-html": "^6.2.0",
103
+ "eslint-plugin-import": "^2.26.0",
104
+ "eslint-plugin-jsdoc": "^39.2.9",
105
+ "eslint-plugin-markdown": "^2.2.1",
106
+ "eslint-plugin-no-unsanitized": "^4.0.1",
175
107
  "eslint-plugin-no-use-extend-native": "^0.5.0",
176
108
  "eslint-plugin-node": "^11.1.0",
177
- "eslint-plugin-promise": "^4.3.1",
178
- "eslint-plugin-radar": "^0.2.1",
109
+ "eslint-plugin-promise": "^6.0.0",
110
+ "eslint-plugin-sonarjs": "^0.13.0",
179
111
  "eslint-plugin-standard": "^4.1.0",
180
- "eslint-plugin-unicorn": "^28.0.2",
181
- "got": "^11.8.2",
182
- "is-date-object": "1.0.2",
112
+ "eslint-plugin-unicorn": "^42.0.0",
113
+ "got": "^11.8.3",
114
+ "is-date-object": "1.0.5",
183
115
  "isomorphic-fetch": "^3.0.0",
184
- "jsdom": "^16.4.0",
185
- "license-badger": "^0.18.0",
116
+ "jsdom": "^19.0.0",
117
+ "license-badger": "^0.19.0",
186
118
  "local-xmlhttprequest": "2.0.0",
187
- "mocha": "^8.3.0",
119
+ "mocha": "^9.2.2",
188
120
  "mocha-badge-generator": "^0.9.0",
189
121
  "mocha-multi-reporters": "^1.5.1",
190
- "node-static": "^0.7.11",
191
122
  "npm-run-all": "^4.1.5",
192
123
  "nyc": "^15.1.0",
193
- "open-cli": "^6.0.1",
124
+ "open-cli": "^7.0.1",
194
125
  "rimraf": "^3.0.2",
195
- "rollup": "^2.40.0",
196
- "rollup-plugin-filesize": "^9.1.1",
126
+ "rollup": "^2.71.1",
127
+ "rollup-plugin-filesize": "^9.1.2",
197
128
  "rollup-plugin-node-globals": "^1.4.0",
198
129
  "rollup-plugin-node-polyfills": "^0.2.1",
199
130
  "rollup-plugin-terser": "^7.0.2",
200
- "sinon": "^9.2.4",
201
- "source-map-support": "0.5.19",
131
+ "sinon": "^13.0.2",
132
+ "source-map-support": "0.5.21",
202
133
  "sourcemap-transformer": "git+https://github.com/brettz9/sourcemap-transformer.git",
203
134
  "w3c-blob": "0.0.1",
204
- "ws": "^7.4.3"
205
- }
206
- }
135
+ "ws": "^8.5.0"
136
+ },
137
+ "scripts": {
138
+ "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",
139
+ "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
140
+ "license-badges": "run-p license-badge license-badge-dev",
141
+ "start": "static -p 9999 -H '{\"Access-Control-Allow-Origin\": \"http://web-platform.test:8000\", \"Access-Control-Allow-Methods\": \"GET\", \"Access-Control-Allow-Headers\": \"Content-Type\"}'",
142
+ "watch": "chokidar \"src/*\" \"node_modules/eventtarget/EventTarget.js\" \"node_modules/websql/lib/websql/WebSQLTransaction.js\" \"node_modules/websql/lib/websql/WebSQLDatabase.js\" -c \"npm run rollup\"",
143
+ "dev": "run-p start watch",
144
+ "clean": "run-p clean-sysDB clean-mocha clean-fake clean-mock clean-w3c clean-w3cOld",
145
+ "clean-sysDB": "rimraf __sysdb__*",
146
+ "clean-polyfill": "run-p clean-fake clean-mock clean-w3cOld clean-sysDB",
147
+ "clean-mocha": "rimraf D_indexeddbshim_test_database_* D_test.sqlite",
148
+ "clean-fake": "rimraf D_test0.*",
149
+ "clean-mock": "rimraf D_test_database*",
150
+ "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*",
151
+ "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
152
+ "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",
153
+ "lint": "eslint --ext=js,md,html .",
154
+ "eslint": "npm run lint",
155
+ "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
156
+ "w3c-build-only": "node test-support/node-buildjs",
157
+ "w3c-build": "run-s clean-w3c w3c-build-only",
158
+ "fake": "run-s clean-fake coverage:fake clean-fake",
159
+ "mock": "run-s clean-mock coverage:mock clean-mock",
160
+ "w3c-old": "run-s clean-w3cOld coverage:w3cOld clean-w3cOld",
161
+ "tests-polyfill": "run-s clean-polyfill coverage:fake coverage:mock coverage:w3cOld",
162
+ "mocha": "run-s clean-mocha coverage:mocha clean-mocha",
163
+ "rollup": "rollup -c",
164
+ "coverage:fake": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+fake --require source-map-support/register tests-polyfill/fakeIndexedDB/test-node.js",
165
+ "coverage:mock": "nyc --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mock --require source-map-support/register tests-polyfill/indexedDBmock/test-node.js",
166
+ "coverage:w3cOld": "nyc --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",
167
+ "coverage:w3c": "NODE_OPTIONS=--max_old_space_size=4096 nyc --silent --no-clean npm run w3c-test-only",
168
+ "test:w3c": "NODE_OPTIONS=--max_old_space_size=4096 node --experimental-worker test-support/node-idb-test",
169
+ "w3c-test-only": "node --experimental-worker test-support/node-idb-test",
170
+ "coverage:mocha": "nyc --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",
171
+ "coverage-badge": "coveradge badges/coverage-badge",
172
+ "coverage:report-only": "nyc report",
173
+ "coverage:report": "run-s coverage:report-only",
174
+ "remove-cache": "rimraf node_modules/.cache",
175
+ "remove-cov": "rimraf .nyc_output ",
176
+ "remove-results": "rimraf test-support/results/file*.json",
177
+ "coverage:polyfill": "run-s coverage:fake coverage:mock coverage:w3cOld",
178
+ "tests-badge": "mbg --fileGlob \"./test-support/results/file*.json\" --badge_output badges/tests-badge.svg",
179
+ "coverage": "run-s -c clean remove-cache remove-cov remove-results coverage:fake coverage:mock coverage:mocha coverage:w3c clean tests-badge coverage-badge coverage:report",
180
+ "open-coverage-only": "open http://localhost:9999/coverage/lcov-report/",
181
+ "open-coverage": "run-p start open-coverage-only",
182
+ "test": "run-s lint coverage",
183
+ "submodules-init": "git submodule update --init --recursive",
184
+ "submodules-fetch": "git submodule foreach --recursive git fetch",
185
+ "submodules-merge": "git submodule foreach git merge origin master",
186
+ "submodules": "run-s submodules-init submodules-fetch submodules-merge",
187
+ "wpt": "run-p start web-platform-tests",
188
+ "web-platform-tests": "cd web-platform-tests && ./wpt serve",
189
+ "w3c-find-unused": "node test-support/find-unused.js",
190
+ "w3c": "run-s w3c-build w3c-test",
191
+ "w3c-add-wrap": "node test-support/wrap-w3c-tests",
192
+ "w3c-remove-wrap": "node test-support/wrap-w3c-tests remove",
193
+ "w3c-wrap": "node test-support/wrap-w3c-tests",
194
+ "test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
195
+ "delay": "delay 9",
196
+ "delayed-w3c-test": "run-s delay test:w3c",
197
+ "w3c-test": "run-s clean-w3c test-and-start:w3c",
198
+ "w3c-good-only": "node test-support/node-idb-test good",
199
+ "w3c-bad-only": "node test-support/node-idb-test bad",
200
+ "w3c-good": "run-s w3c-build w3c-good-only clean-w3c",
201
+ "w3c-bad": "run-s w3c-build w3c-bad-only clean-w3c",
202
+ "w3c-good-test": "run-s w3c-good-only clean-w3c",
203
+ "w3c-bad-test": "run-s w3c-bad-only clean-w3c"
204
+ },
205
+ "readme": "# IndexedDB Polyfill\n\n[![Build Status](https://img.shields.io/travis/indexeddbshim/IndexedDBShim.svg)](https://travis-ci.org/indexeddbshim/IndexedDBShim)\n[![Dependencies](https://img.shields.io/david/indexeddbshim/indexeddbshim.svg)](https://david-dm.org/indexeddbshim/indexeddbshim)\n[![devDependencies](https://img.shields.io/david/dev/indexeddbshim/indexeddbshim.svg)](https://david-dm.org/indexeddbshim/indexeddbshim?type=dev)\n[![npm](http://img.shields.io/npm/v/indexeddbshim.svg)](https://www.npmjs.com/package/indexeddbshim)\n[![CDNJS](https://img.shields.io/cdnjs/v/IndexedDBShim.svg)](https://cdnjs.com/libraries/indexeddbshim)\n\n[![Tests badge](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/badges/tests-badge.svg?sanitize=true)](badges/tests-badge.svg)\n[![Coverage badge](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/badges/coverage-badge.svg?sanitize=true)](badges/coverage-badge.svg)\n\n[![Known Vulnerabilities](https://snyk.io/test/github/indexeddbshim/indexeddbshim/badge.svg)](https://snyk.io/test/github/indexeddbshim/indexeddbshim)\n[![Total Alerts](https://img.shields.io/lgtm/alerts/g/indexeddbshim/indexeddbshim.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/indexeddbshim/indexeddbshim/alerts)\n[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/indexeddbshim/indexeddbshim.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/indexeddbshim/indexeddbshim/context:javascript)\n\n[![License](https://img.shields.io/npm/l/indexeddbshim.svg)](LICENSE-APACHE)\n\n[![Licenses badge](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/badges/licenses-badge.svg?sanitize=true)](badges/licenses-badge.svg)\n<!--\n[![Licenses dev badge](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/badges/licenses-badge-dev.svg?sanitize=true)](badges/licenses-badge-dev.svg)\n-->\n(see also [licenses for dev. deps.](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/badges/licenses-badge-dev.svg?sanitize=true))\n\n<!--[![issuehunt-to-marktext](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/r/indexeddbshim/indexeddbshim)-->\n\n|[Live Demo (stable)!](https://raw.githack.com/indexeddbshim/indexeddbshim/v6.2.0/index.html) | [Live Demo (master)!](https://indexeddbshim.github.io/indexeddbshim/) |\n| -------------- | ----------------- |\n\n__Use a single, indexable, offline storage API across all desktop and mobile\nbrowsers and Node.js.__\n\nEven if a browser natively supports [IndexedDB](http://w3c.github.io/IndexedDB/),\nyou may still want to use this shim. Some native IndexedDB implementations are\n[very buggy](http://www.raymondcamden.com/2014/09/25/IndexedDB-on-iOS-8-Broken-Bad/).\nOthers are [missing certain features](http://codepen.io/cemerick/pen/Itymi).\nThere are also many minor inconsistencies between different browser\nimplementations of IndexedDB, such as how errors are handled, how transaction\ntiming works, how records are sorted, how cursors behave, etc. Using this\nshim will ensure consistent behavior across all browsers.\n\n## Features\n\n- Optionally adds full IndexedDB support to any web browser that\n [supports WebSQL](http://caniuse.com/#search=websql)\n- Does nothing if the browser already\n [natively supports IndexedDB](http://caniuse.com/#search=indexeddb)\n- Can _optionally replace_ native IndexedDB on browsers with\n [buggy implementations](http://www.raymondcamden.com/2014/09/25/IndexedDB-on-iOS-8-Broken-Bad/)\n- Works on __desktop__ and __mobile__ devices as well as __Node.js__ (courtesy of\n [websql](https://www.npmjs.com/package/websql) which sits on top of SQLite3)\n- Works on __Cordova__ and __PhoneGap__ via the\n [IndexedDB plug-in](http://plugins.cordova.io/#/package/com.msopentech.websql)\n (Not recently tested)\n- This shim is basically an IndexedDB-to-WebSQL adapter.\n- More (though most likely now outdated) details about the project at\n <http://nparashuram.com/IndexedDBShim>\n\n## Installation\n\nYou can download the [development](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/dist/indexeddbshim.js)\nor\n[production (minified)](https://raw.githubusercontent.com/indexeddbshim/indexeddbshim/master/dist/indexeddbshim.min.js)\nscript, or install it using [NPM](https://docs.npmjs.com/getting-started/what-is-npm).\n\nFor Mac, you may need to have [CMake](https://cmake.org/download/) installed\nfor the SQLite3 install to work (See\n`Tools->How to Install For Command Line Use`) as well as build SQLite3 from\nsource via `npm install --build-from-source` in the `node-sqlite3` directory.\nAlso make sure Python (2.7) is installed.\n\n### npm\n\n```shell\nnpm install indexeddbshim\n```\n\nor\n\n```shell\nyarn add indexeddbshim\n```\n\n## Browser set-up\n\nAdd the following scripts to your page:\n\n```html\n<script src=\"./node_modules/core-js-bundle/minified.js\"></script>\n<script src=\"./node_modules/indexeddbshim/dist/indexeddbshim.min.js\"></script>\n```\n\nIf you need full Unicode compliance (handling special\nnon-alphanumeric identifiers in store and index names),\nuse the following instead:\n\n```html\n<script src=\"./node_modules/core-js-bundle/minified.js\"></script>\n<script src=\"./node_modules/indexeddbshim/dist/indexeddbshim-UnicodeIdentifiers.min.js\"></script>\n```\n\n## Node set-up\n\n```js\nconst setGlobalVars = require('indexeddbshim');\n\nglobal.window = global; // We'll allow ourselves to use `window.indexedDB` or `indexedDB` as a global\nsetGlobalVars(); // See signature below\n```\n\n## ES6 Modules\n\n### Bundler for Browser\n\n```js\nimport setGlobalVars from 'indexeddbshim';\n```\n\n### Bundler for Node\n\n```js\nimport setGlobalVars from 'indexeddbshim/src/node-UnicodeIdentifiers';\n\n// Or without Unicode support\n// import setGlobalVars from 'indexeddbshim/src/node';\n```\n\n## Usage/API\n\nFor the browser scripts, if the browser already natively supports IndexedDB\nand is not known to be buggy, then the script won't do anything.\n\nOtherwise, assuming WebSQL is available, the script will add the\n[IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)\nto the browser (unless you use one of the non-invasive files, in which case\n`setGlobalVars` can be used to optionally add the API to an object of your\nchoosing; if you also wish Unicode support, you will need to add it yourself).\n\nEither way, you can use IndexedDB just like normal.\n[Here's an example](https://gist.github.com/BigstickCarpet/a0d6389a5d0e3a24814b).\n\n### setGlobalVars(\\<winObj or `null`\\>, initialConfig)\n\nIn the non-invasive builds (and Node.js), globals are not automatically set.\nYou have the choice to set globals when you wish as well as to set the API\non an object of your choosing in place of setting globals.\n\nThis is done through `setGlobalVars()` (which is otherwise called in the\nbrowser builds automatically with no arguments).\n\nThis function defines `shimIndexedDB`, `indexedDB`, `IDBFactory`, etc. on\none of the following objects in order of precedence:\n\n1. The passed in `winObj` object if defined\n1. `window` (for Node, define `global.window = global;`)\n1. `self` (for web workers)\n1. `global` (for Node)\n1. A new empty object\n\nThe `initialConfig` argument, if present, should be an object whose keys\nare the config properties to set and its values are the config values (see\n`shimIndexedDB.__setConfig` below).\n\nIf you are adding your own `window.openDatabase` implementation, supplying\nit within `initialConfig` (keyed as `openDatabase`) will ensure that\n`shimIndexedDB.__useShim()` is auto-invoked for you if poor IndexedDB\nsupport is detected.\n\n### shimIndexedDB.\\__useShim();\n\nTo force IndexedDBShim to shim the browser's native IndexedDB (if our code\nis not already auto-shimming your browser when detecting poor browser\nsupport), add this method call to your script.\n\nOn browsers that support WebSQL, this line will _completely replace_ the\nnative IndexedDB implementation with the IndexedDBShim-to-WebSQL\nimplementation.\n\nOn browsers that _don't_ support WebSQL, but _do_ support IndexedDB, this\nline will patch many known problems and add missing features. For example,\non Internet Explorer, this will add support for compound keys.\n\nIf `CFG.addNonIDBGlobals` has been set (e.g., on the `initialConfig` argument\nof `setGlobalVars`), the other non-IndexedDB shims necessitated by this\nlibrary will be polyfilled as possible on the chosen \"global\" (i.e.,\n`ShimEvent`, `ShimCustomEvent`, `ShimEventTarget`, `ShimDOMException`,\nand `ShimDOMStringList`). Mostly useful for testing.\n\nIf `CFG.replaceNonIDBGlobals` is used, it will instead attempt to add,\nor if already present, overwrite these globals.\n\nIf `CFG.fullIDLSupport` has been set, the slow-performing\n`Object.setPrototypeOf` calls required for full WebIDL compliance will\nbe used. Probably only needed for testing or environments where full\nintrospection on class relationships is required.\nSee this [SO topic](http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements)\n\n### shimIndexedDB.\\__forceClose([dbName], [connIdx], [msg])\n\nThe spec anticipates the [closing of a database connection with a forced flag](http://w3c.github.io/IndexedDB/#steps-for-closing-a-database-connection).\n\nThe spec also mentions [some circumstances](http://w3c.github.io/IndexedDB/#database-connection)\nwhere this may occur:\n\n> A connection may be closed by a user agent in exceptional circumstances,\n> for example due to loss of access to the file system, a permission change,\n> or clearing of the origin’s storage.\n\nSince the latter examples are under the browser's control, this method may\nbe more useful on the server or for unit-testing.\n\nIf the first argument, `dbName` is missing (or `null` or `undefined`),\nall connections to all databases will be force-closed.\n\nIf the second argument, `connIdx` is missing (or `null` or `undefined`),\nall connections with the given name will be force-closed. It can\nalternatively be an integer representing a 0-based index to indicate a\nspecific connection to close.\n\nThe third argument `msg` will be appended to the `AbortError` that will be\ntriggered on the transactions of the connection.\n\nIndividual `IDBDatabase` database instances can also be force-closed\nwith a particular message:\n\n```js\ndb.__forceClose(msg);\n```\n\n### shimIndexedDB.\\__setConnectionQueueOrigin(origin = getOrigin())\n\nEstablishes a `connectionQueue` for the supplied (or current) origin.\n\nThe queue is otherwise only keyed to the detected origin on the\nloading of the IndexedDBShim script, though this is usually the\ndesired behavior.\n\n### shimIndexedDB.\\__debug(boolean)\n\nThe IndexedDB polyfill has sourcemaps enabled, so the polyfill can be debugged\neven if the minified file is included.\n\nTo print out detailed debug messages, add this line to your script:\n\n```js\nshimIndexedDB.__debug(true);\n```\n\n### shimIndexedDB.\\__setConfig()\n\nRather than using globals, a method has been provided to share state across\nIndexedDBShim modules.\n\nConfiguration can be set early in the non-invasive browser and Node builds\nvia the second argument to `setGlobalVars()` (see its definition above).\n\nIts signature (for setting configuration after `shimIndexedDB` is created) is:\n\n```js\nshimIndexedDB.__setConfig({\n property: value, property2: value2, ...otherProperties\n});\n```\n\nor:\n\n```js\nshimIndexedDB.__setConfig(property, value);\n```\n\n### `createDOMException(name, message)`\n\nA utility for creating a `DOMException` instance. Attempts to use any\navailable native implementation.\n\n#### Configuration options\n\nThe available properties relevant to browser or Node are:\n\n- __DEBUG__ - Boolean (equivalent to calling `shimIndexedDB.__debug(val)`)\n- __cacheDatabaseInstances__ - Config to ensure that any repeat\n `IDBFactory.open` call to the same name and version (assuming\n no deletes or aborts causing rollbacks) will reuse the same SQLite\n `openDatabase` instance.\n- __checkOrigin__ - Boolean on whether to perform origin checks in `IDBFactory`\n methods (`open`, `deleteDatabase`, `databases`); effectively\n defaults to true (must be set to `false` to cancel checks); for Node\n testing, you will either need to define a `location` global from which\n the origin value can be found or set this property to `false`.\n- __UnicodeIDStart__ and __UnicodeIDContinue__ - Invocation of\n `createObjectStore` and `createIndex` calls for validation of key paths.\n The specification technically allows all\n `IdentifierName`](https://tc39.github.io/ecma262/#prod-IdentifierName)\n strings, but as this requires a [very large regular expression](https://gist.github.com/brettz9/b4cd6821d990daa023b2e604de371407),\n it is replaced by default with `[$A-Z_a-z]` and `[$0-9A-Z_a-z]`,\n respectively. Note that these are and must be expressed as strings,\n not `RegExp` objects. You can use this configuration to change the default\n to match the spec or as you see fit. In the future we may allow the spec\n behavior via optional dynamic loading of an internal module.\n- __registerSCA__ - For data created in 3.* versions of IndexedDBShim to\n continue to work with the more recent version of typeson-registry we\n are using (specifically its Structured Cloning Algorithm), set this\n property to a callback which is passed the current typeson-registry\n structured cloning algorithm representation and return its own to be\n passed to `typeson.register`. See the library\n [typeson-registry-sca-reverter](https://github.com/brettz9/typeson-registry-sca-reverter)\n for a function that can do this and check it for updates if you are\n using it in case needed to work against new updates of IndexedDBShim.\n- __fullIDLSupport__ - If set to `true`, the slow-performing\n `Object.setPrototypeOf` calls required for full WebIDL compliance will\n be used. Probably only needed for testing or environments where full\n introspection on class relationships is required.\n See this [SO topic](http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements)\n- __win__, Object on which there may be an `openDatabase` method (if any)\n for WebSQL; Defaults to `window` or `self` in the browser and for Node,\n it is set by default to [`node-websql`](https://github.com/nolanlawson/node-websql).\n If you are intending on adding your own `openDatabase` implementation,\n please note that (for the sake of Node), we rely on supplying an additional\n non-WebSQL-standard callback argument to *WebSQL* `transaction` or\n `readTransaction` calls in our `node-websql` fork to allow it to prolong\n the transaction (to last through our IndexedDB transaction) and to provide\n rollback functionality. (See\n <https://github.com/axemclion/IndexedDBShim/issues/296>, however, for\n a remaining issue this fix does not currently overcome.)\n- __cursorPreloadPackSize__ - Number indicating how many records to preload for\n caching of (non-multiEntry) `IDBCursor.continue` calls. Defaults to 100.\n- __DEFAULT_DB_SIZE__ - Used as estimated size argument (in bytes) to\n underlying WebSQL `openDatabase` calls. Defaults to `4 * 1024 * 1024` or\n `25 * 1024 * 1024` in Safari (apparently necessary due to Safari creating\n larger files and possibly also due to Safari not completing the storage\n of all records even after permission is given). Has no effect in Node\n (using [`node-websql`](https://github.com/nolanlawson/node-websql)),\n and its use in WebSQL-compliant browsers is implementation dependent (the\n browser may use this information to suggest the use of this quota to the\n user rather than prompting the user regularly for say incremental 5MB\n permissions).\n- __useSQLiteIndexes__ - Whether to create indexes on SQLite tables (and also\n whether to try dropping). Indexes can increase file size and slow\n performance on tables involving many write operations, but can speed\n performance for retrieval. Defaults to `false`.\n- __avoidAutoShim__ - Where WebSQL is detected but where `indexedDB` is\n missing or poor support is known (non-Chrome Android or\n non-Safari iOS9), the shim will be auto-applied without\n `shimIndexedDB.__useShim()`. Set this to `true` to avoid forcing\n the shim for such cases.\n\nThe following config are mostly relevant to Node but has bearing on the\nbrowser, particularly if one changes the defaults.\n\n- __fs__ - File system module with `unlink` to remove deleted database files.\n Auto-set by Node distributions.\n- __addNonIDBGlobals__ - If set to `true` will polyfill the \"global\" with\n non-IndexedDB shims created by and sometimes returned publicly by\n the library. These include `ShimEvent`, `ShimCustomEvent`,\n `ShimEventTarget`, `ShimDOMException`, and `ShimDOMStringList`.\n Mostly useful for debugging (and in Node where these\n are not available by default).\n- __replaceNonIDBGlobals__ - Similar to `addNonIDBGlobals` but will attempt\n to add the values unprefixed and overwrite if possible. Mostly for\n testing.\n- __escapeDatabaseName__ - Due to the Node implementation's reliance on\n `node-websql`/`node-sqlite3` which create files for each database\n (and the fact that we haven't provided an option to map filename-safe\n IDs to arbitrary, user-supplied IndexedDB database names),\n when the user creates IndexedDB databases, the Node implementation\n will be subject to the limitations systems can have with filenames.\n Since IndexedDBShim aims to facilitate code that can work on both\n the server and client, we have applied some escaping and restrictions\n by default. The default behavior is to prefix the database name with\n `D_` (to avoid filesystem, SQLite, and `node-sqlite3` problems if\n the user supplies the IndexedDB-permitted empty string database\n name), to escape `^` which we use as our own generally-filename-supported\n escape character, to escape NUL (which is also problematic in SQLite\n identifiers and in `node-sqlite3` in general) as `^0`, to escape upper-case\n letters A-Z as `^A`, `^B`, etc. (since IndexedDB insists on\n case-sensitivity while file systems often do not), to escape any\n characters mentioned in `databaseCharacterEscapeList` (as `^1` + a\n two-hexadecimal-digit-padded sequence), and to throw an `Error` if\n `databaseNameLengthLimit` is not set to `false` and is surpassed\n by the resulting escaped name. You can use this `escapeDatabaseName`\n callback property to override the default behavior, with the callback\n accepting a single argument of the user's database name choice and\n returning your own filename-safe value. Note that we do escape NUL and\n our own escape character (`^`) before passing in the value (for the\n above-mentioned reasons), though you could unescape and\n return your own escaped format. While some file systems may not have\n the other restrictions, you should at a minimum anticipate\n the possibility for empty strings (since we rely on the result of this\n function for internal escaping as a SQLite identifier) as well as\n realize the string `\":memory:\"` will, if unescaped, have a special\n meaning with `node-sqlite3`. You can make the escaping more lax,\n e.g., if your file system is case-sensitive, or you could make it more\n stringent.\n- __unescapeDatabaseName__ - Not used internally; usable as a convenience\n method for unescaping strings formatted per our default escaping\n conventions.\n- __databaseCharacterEscapeList__ - When this property and\n `escapeDatabaseName` are not overridden, the following characters will\n be escaped by default, even though IndexedDB has no such restrictions,\n as they are restricted in a number of file systems, even modern,\n Unicode-supporting ones: `0x00-0x1F 0x7F \" * / : < > ? \\ |`. This\n property can be overridden with a string that will be converted into\n an alternate regular expression or supplied with `false` to disable\n any character limitations.\n- __databaseNameLengthLimit__ - When this property and\n `escapeDatabaseName` are not overridden, an error will be thrown if\n the escaped filename exceeds the length of 254 characters (the shortest\n typical modern file length maximum). Provide a number to change the\n limit or supply `false` to disable any length checking.\n- __escapeNFDForDatabaseNames__ - Boolean defaulting to true on whether\n to escape NFD-escaping characters to avoid clashes on MacOS which\n performs NFD on files\n- __addSQLiteExtension__ - Boolean on whether to add the `.sqlite` extension\n to database file names (including `__sysdb__` which tracks versions);\n defaults to `true`\n- __autoName__ - Boolean config to interpret empty string name as a\n cue for creating a database name automatically (introspect on\n `IDBDatabase.name` to get the actual name used); `false` by default\n\nNode-only config:\n\n- __sysDatabaseBasePath__ - Base path for the `__sysdb__(.sqlite)` database\n file; defaults to `__databaseBasePath` unless another value (including\n the empty string) is given; otherwise is the empty string\n- __databaseBasePath__ - Base path for user database files; defaults to the\n empty string\n- __deleteDatabaseFiles__ - Deletes physical database file upon\n `deleteDatabase` (instead of merely emptying). Defaults to `true`.\n Does not currently delete the database for tracking available\n databases and versions, `__sys__`, if emptied; see\n [#278](https://github.com/axemclion/IndexedDBShim/issues/278).\n- __memoryDatabase__ - String config to cause all opening, deleting, and\n listing to be of SQLite in-memory databases; name supplied\n by user is still used (including to automatically build a cache since\n SQLite does not allow naming of in-memory databases); the name is also\n accessible to `IDBFactory.databases()`; causes database\n name/version tracking to also be within an in-memory database; if\n set in the browser, avoids normal database name escaping meant\n for Node compatibility; allowable values include the empty string,\n `\":memory:\"`, and `file::memory:[?optionalQueryString][#optionalHash]`.\n See <https://sqlite.org/inmemorydb.html> and <https://sqlite.org/uri.html>\n for more on the function and form of such values\n\nNode config mostly for development debugging:\n\n- __sqlBusyTimeout__ - Integer used by Node WebSQL for\n [SQLite config](https://github.com/mapbox/node-sqlite3/wiki/API#databaseconfigureoption-value)\n to set the [busy timeout](https://www.sqlite.org/c3ref/busy_timeout.html)\n (Defaults to 1000 ms)\n- __sqlTrace__ - Callback used by Node WebSQL for\n [SQLite config](https://github.com/mapbox/node-sqlite3/wiki/API#databaseconfigureoption-value)\n (Invoked when an SQL statement executes, with a rendering of the\n statement text)\n- __sqlProfile__ - Callback used by Node WebSQL for\n [SQLite config](https://github.com/mapbox/node-sqlite3/wiki/API#databaseconfigureoption-value)\n (Invoked every time an SQL statement executes)\n // Overcoming limitations with node-sqlite3/storing database name on\n // file systems\n // https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n\n### shimIndexedDB.\\__getConfig()\n\nFor retrieving a config value:\n\n```js\nshimIndexedDB.__getConfig(property);\n```\n\n## Known Issues\n\nAll code has bugs, and this project is no exception. If you find a bug,\nplease [let us know about it](https://github.com/indexeddbshim/indexeddbshim/issues).\nOr better yet, [send us a fix](https://github.com/indexeddbshim/indexeddbshim/pulls)!\nPlease make sure someone else hasn't already reported the same bug though.\n\nHere is a summary of main [known issues](https://github.com/axemclion/IndexedDBShim/issues/262#issuecomment-254413002)\nto resolve:\n\n1. `blocked` and `versionchange` `IDBVersionChangeEvent` event support ([#2](https://github.com/axemclion/IndexedDBShim/issues/2) and [#273](https://github.com/axemclion/IndexedDBShim/issues/273)) across\nprocesses/browser windows\n1. Some issues related to [task/micro-task timing](https://github.com/axemclion/IndexedDBShim/issues/296)\nin Node (for inherent limitations in the browser, see below).\n1. [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData) storage on Node 14 when used with `node-canvas` - due to [this issue](https://github.com/Automattic/node-canvas/issues/1646)\n\nThere are a few bugs that are outside of our power to fix. Namely:\n\n### Browser rollback\n\nWhile we do try to rollback the database version in the browser when\ncalled for, as we are not able to prolong WebSQL transactions to benefit\nfrom the auto-rollback they perform upon encountering an error (nor\ndoes WebSQL permit manual ROLLBACK commands so that we could undo the\nvarious WebSQL calls we need to make up IndexedDB transactions), we are\nnot able to provide safe rollbacks in the browser. The synchronous WebSQL\nAPI was not apparently well supported, at least it is missing in Safari\nand Chrome, and it would particularly degrade performance in a Node\nenvironment.\n\nThe special build of `websql` that we use does allow such\nIndexedDB-spec-compliant (and data-integrity-friendly!) rollback behavior\nin Node.\n\nSee below on task/micro-task timing for more.\n\n### Task/micro-task timing\n\nIndexedDB transactions [will timeout](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB#Adding_data_to_the_database)\nso long as there are no detected active requests.\n\nWhile a single promise delay (a \"microtask\") is not supposed to be\nlong enough to cause a transaction timeout (and they do not in Node\nwhere we have control over extending the transaction), it could possibly\noccur in our browser implementation.\n\n(Note that chaining multiple promises or having a long-resolving\npromise will likely cause a transaction to expire even in compliant\nimplementations.)\n\nA `setTimeout` timeout of `0`, on the other hand (a full \"task\"), ought,\nfor compliant implementations, to be long enough of a time to cause a\ntime out of the transaction, but in Node where we prolong transactions\nlong enough to ensure our full chain of asynchronous SQL needed for the\ntransaction operations is run (as well as ensure complete rollback should\nthere be an error causing a transaction abort), it may be too short.\n\nWe could fix this in Node (where we can have access to a synchronous\nSQLite API such as <https://github.com/grumdrig/node-sqlite> unlike\non the browser) and ensure transactions finish before the next task\n(though always after a microtask), but as mentioned above, this would\ndegrade performance particularly on a server (and in the browser,\nthe WebSQL API on which we are relying did not apparently\ngain support in browsers for the synchronous API).\n\n[This test](https://github.com/w3c/web-platform-tests/blob/master/IndexedDB/transaction-deactivation-timing.html) and\n[this one](https://github.com/w3c/web-platform-tests/blob/master/IndexedDB/upgrade-transaction-deactivation-timing.html)\ndemonstrate the *expected* timeout behavior with regard to `setTimeout`\nor promises and transaction expiration.\n\n### [Structured Cloning Algorithm](https://html.spec.whatwg.org/multipage/infrastructure.html#safe-passing-of-structured-data)\n\nDue to\n[certain challenges](http://stackoverflow.com/questions/42170826/categories-for-rejection-by-the-structured-cloning-algorithm)\nin detecting cloneable objects from within JavaScript, there are certain\nlimitations regarding cloning:\n\n1. We cannot properly detect `Proxy` to throw upon encountering such\n non-cloneable objects\n1. Our reliance on `Object.prototype.toString` to detect uncloneable objects\n can fail if that method is overridden or if `Symbol.toStringTag` is used\n to change the default reporting of a given \"class\".\n1. Although they are currently working, we were only able to resolve `Blob`,\n `File`, and `FileList` objects synchronously (as\n [required per spec](https://github.com/axemclion/IndexedDBShim/issues/285))\n using the now-deprecated `XMLHttpRequest` synchronous API.\n1. Without a means of transferring `ArrayBuffer` objects in Node, we cannot\n meet the requirement to fail upon encountering detached binary objects.\n1. They may be other subtleties we have not been able to work around.\n\nWe have, however, overcome some cloning issues still faced by browser\nimplementations, e.g., in Chrome (issue\n[#698564](https://bugs.chromium.org/p/chromium/issues/detail?id=698564))\n(re: not failing on `WeakMap`, `WeakSet`, `Promise`, and `Object.prototype`).\n\nWe also have limitations in creating certain objects synchronously, namely, the\none method for creating an image bitmap, `createImageBitmap`, returns a\n`Promise`, so we cannot clone a bona fide image bitmap synchronously so as to\nobtain any errors synchronously as expected by the IndexedDB methods involving\ncloning.\n\n### Node versions 8.9.3 to 9.0.0\n\nOur Mocha test \"query multi-entry indexes with hundreds of records\" of\n`IDBIndex/openCursor-spec.js` is failing for these versions. Starting\nwith 9.1.0, however, the test passes again.\n\n### iOS\n\nDue to a [bug in WebKit](https://bugs.webkit.org/show_bug.cgi?id=137034), the\n`window.indexedDB` property is read-only and cannot be overridden by\nIndexedDBShim. There are two possible workarounds for this:\n\n1. Use `window.shimIndexedDB` instead of `window.indexedDB`\n1. Create an `indexedDB` variable in your closure\n\nBy creating a variable named `indexedDB`, all the code within that closure\nwill use the variable instead of the `window.indexedDB` property. For\nexample:\n\n```js\n(function () {\n // This works on all browsers, and only uses IndexedDBShim as a final fallback\n var indexedDB = window.indexedDB || window.mozIndexedDB || // eslint-disable-line no-var\n window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;\n\n // This code will use the native IndexedDB, if it exists, or the shim otherwise\n indexedDB.open('MyDatabase', 1);\n})();\n```\n\n### Windows Phone\n\n*This information might be outdated. Reports on current support or fixes welcome.*\n\nIndexedDBShim works on Windows Phone via a Cordova/PhoneGap plug-in. There\nare two plugins available: [cordova-plugin-indexedDB](https://github.com/MSOpenTech/cordova-plugin-indexedDB)\nand [cordova-plugin-indexeddb-async](https://github.com/ABB-Austin/cordova-plugin-indexeddb-async).\nBoth plug-ins rely on a WebSQL-to-SQLite adapter, but there are differences\nin their implementations. Try them both and see which one works best for\nyour app.\n\n## Building\n\nTo build the project locally on your computer:\n\n1. __Clone this repo__\nIf you clone the repository to work against an unstable version, you only\nneed to clone the repository recursively (via\n`git clone https://github.com/indexeddbshim/indexeddbshim.git --recursive`)\nif you wish to have the W3C tests available for testing (which\nunfortunately loads all W3C tests into the \"web-platform-tests\"\nsubdirectory rather than just the IndexedDB ones). Otherwise, just use\n`git clone https://github.com/indexeddbshim/indexeddbshim.git`\n\n1. __Install dev dependencies (and websql for Node)__\n`yarn install`\n\n1. __Run the build script__\n`npm start`\n\n1. __Done__\n\nThe output files will be generated in the `dist` directory\n\n## Upgrading from previous versions\n\nSee [Versions](docs/versions/) for migration information.\n\n## Testing\n\nSee [TESTING](docs/TESTING.md).\n\n## Resources for IndexedDB\n\n- [TrialTool](http://nparashuram.com/trialtool) - For experimenting with\n IndexedDB commands, including predefined examples. (Some examples\n may depend on others previously being run, even with\n \"Load Pre-Requisites\" added, but it is nevertheless useful to avoid\n boilerplate in testing out commands, in conjunction with\n the browser developer tools.)\n\n## Contributing\n\nPull requests or Bug reports welcome! See [CONTRIBUTING](docs/CONTRIBUTING.MD)\n"
206
+ }
@@ -61,11 +61,11 @@ DOMStringList.prototype = {
61
61
  return this._items;
62
62
  },
63
63
  forEach (cb, thisArg) {
64
- // eslint-disable-next-line unicorn/no-array-callback-reference
64
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
65
65
  this._items.forEach(cb, thisArg);
66
66
  },
67
67
  map (cb, thisArg) {
68
- // eslint-disable-next-line unicorn/no-array-callback-reference
68
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
69
69
  return this._items.map(cb, thisArg);
70
70
  },
71
71
  indexOf (str) {
@@ -101,7 +101,7 @@ DOMStringList.prototype = {
101
101
  };
102
102
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
103
103
  value (obj) {
104
- return ({}.toString.call(obj) === 'DOMStringListPrototype');
104
+ return Object.prototype.toString.call(obj) === 'DOMStringListPrototype';
105
105
  }
106
106
  });
107
107
  const DOMStringListAlias = DOMStringList;
@@ -104,7 +104,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions
104
104
  throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');
105
105
  }
106
106
 
107
- /** @name IDBObjectStoreProperties **/
107
+ /** @name IDBObjectStoreProperties */
108
108
  const storeProperties = {
109
109
  name: storeName,
110
110
  keyPath,
package/src/IDBFactory.js CHANGED
@@ -114,9 +114,7 @@ let sysdb;
114
114
  let nameCounter = 0;
115
115
 
116
116
  function getLatestCachedWebSQLVersion (name) {
117
- return Object.keys(websqlDBCache[name]).map((version) => {
118
- return Number(version);
119
- }).reduce(
117
+ return Object.keys(websqlDBCache[name]).map(Number).reduce(
120
118
  (prev, curr) => {
121
119
  return curr > prev ? curr : prev;
122
120
  }, 0
@@ -312,7 +310,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
312
310
  // eslint-disable-next-line no-useless-catch
313
311
  try {
314
312
  escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);
315
- // eslint-disable-next-line radar/no-useless-catch
313
+ // eslint-disable-next-line sonarjs/no-useless-catch
316
314
  } catch (err) {
317
315
  throw err; // new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
318
316
  }
@@ -590,7 +588,7 @@ IDBFactory.prototype.deleteDatabase = function (name) {
590
588
  // eslint-disable-next-line no-useless-catch
591
589
  try {
592
590
  escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);
593
- // eslint-disable-next-line radar/no-useless-catch
591
+ // eslint-disable-next-line sonarjs/no-useless-catch
594
592
  } catch (err) {
595
593
  throw err; // throw new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
596
594
  }
@@ -829,7 +829,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
829
829
  }
830
830
 
831
831
  optionalParameters = optionalParameters || {};
832
- /** @name IDBIndexProperties **/
832
+ /** @name IDBIndexProperties */
833
833
  const indexProperties = {
834
834
  columnName: indexName,
835
835
  keyPath,
package/src/IDBRequest.js CHANGED
@@ -20,7 +20,7 @@ IDBRequest.__super = function IDBRequest () {
20
20
  this.__setOptions({
21
21
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
22
22
  });
23
- doneFlagGetters.forEach(function (prop) {
23
+ doneFlagGetters.forEach((prop) => {
24
24
  Object.defineProperty(this, '__' + prop, {
25
25
  enumerable: false,
26
26
  configurable: false,
@@ -36,7 +36,7 @@ IDBRequest.__super = function IDBRequest () {
36
36
  return this['__' + prop];
37
37
  }
38
38
  });
39
- }, this);
39
+ });
40
40
  util.defineReadonlyProperties(this, readonlyProperties, {
41
41
  readyState: {
42
42
  get readyState () {
package/src/Key.js CHANGED
@@ -21,7 +21,7 @@ const keyTypeToEncodedChar = {
21
21
  };
22
22
  const keyTypes = Object.keys(keyTypeToEncodedChar);
23
23
  keyTypes.forEach((k) => {
24
- keyTypeToEncodedChar[k] = String.fromCharCode(keyTypeToEncodedChar[k]);
24
+ keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
25
25
  });
26
26
 
27
27
  const encodedCharToKeyType = keyTypes.reduce((o, k) => {
@@ -938,7 +938,7 @@ function setCurrentNumber (tx, store, num, successCb, failCb) {
938
938
  function generateKeyForStore (tx, store, cb, sqlFailCb) {
939
939
  getCurrentNumber(tx, store, function (key) {
940
940
  if (key > MAX_ALLOWED_CURRENT_NUMBER) { // 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
941
- cb('failure'); // eslint-disable-line node/no-callback-literal
941
+ cb('failure'); // eslint-disable-line n/no-callback-literal
942
942
  return;
943
943
  }
944
944
  // Increment current number by 1 (we cannot leverage SQLite's
package/src/Sca.js CHANGED
@@ -1,13 +1,15 @@
1
- import Typeson from 'typeson-registry';
1
+ import {
2
+ Typeson, hasConstructorOf, structuredCloningThrowing
3
+ } from 'typeson-registry';
2
4
 
3
5
  import {createDOMException, ShimDOMException} from './DOMException.js';
4
6
 
5
7
  // See: http://stackoverflow.com/questions/42170826/categories-for-rejection-by-the-structured-cloning-algorithm
6
8
 
7
- let typeson = new Typeson().register(Typeson.presets.structuredCloningThrowing);
9
+ let typeson = new Typeson().register(structuredCloningThrowing);
8
10
 
9
11
  function register (func) {
10
- typeson = new Typeson().register(func(Typeson.presets.structuredCloningThrowing));
12
+ typeson = new Typeson().register(func(structuredCloningThrowing));
11
13
  }
12
14
 
13
15
  // We are keeping the callback approach for now in case we wish to reexpose
@@ -16,16 +18,16 @@ function register (func) {
16
18
  function encode (obj, func) {
17
19
  let ret;
18
20
  try {
19
- // eslint-disable-next-line node/no-sync
21
+ // eslint-disable-next-line n/no-sync
20
22
  ret = typeson.stringifySync(obj);
21
23
  } catch (err) {
22
24
  // SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)
23
- if (Typeson.hasConstructorOf(err, ReferenceError) ||
25
+ if (hasConstructorOf(err, ReferenceError) ||
24
26
  // SCA in typeson-registry threw a cloning error and we are in a
25
27
  // supporting environment (e.g., the browser) where `ShimDOMException` is
26
28
  // an alias for `DOMException`; if typeson-registry ever uses our shim
27
29
  // to throw, we can use this condition alone.
28
- Typeson.hasConstructorOf(err, ShimDOMException)) {
30
+ hasConstructorOf(err, ShimDOMException)) {
29
31
  throw createDOMException('DataCloneError', 'The object cannot be cloned.');
30
32
  }
31
33
  // We should rethrow non-cloning exceptions like from
@@ -1,3 +1,3 @@
1
1
  var regex=/[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
2
2
 
3
- export default regex;
3
+ export { regex as default };
package/src/util.js CHANGED
@@ -9,11 +9,11 @@ function escapeUnmatchedSurrogates (arg) {
9
9
  // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
10
10
  // but Chrome having problems
11
11
  if (unmatchedHighSurrogate) {
12
- return '^2' + unmatchedHighSurrogate.charCodeAt()
12
+ return '^2' + unmatchedHighSurrogate.codePointAt()
13
13
  .toString(16).padStart(4, '0');
14
14
  }
15
15
  return (precedingLow || '') + '^3' +
16
- unmatchedLowSurrogate.charCodeAt().toString(16).padStart(4, '0');
16
+ unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
17
17
  }
18
18
  );
19
19
  }
@@ -80,6 +80,7 @@ function escapeDatabaseNameForSQLAndFiles (db) {
80
80
  ? new RegExp(CFG.databaseCharacterEscapeList, 'gu')
81
81
  : /[\u0000-\u001F\u007F"*/:<>?\\|]/gu), // eslint-disable-line no-control-regex
82
82
  function (n0) {
83
+ // eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
83
84
  return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
84
85
  }
85
86
  );
@@ -98,11 +99,11 @@ function unescapeUnmatchedSurrogates (arg) {
98
99
  return arg
99
100
  .replace(/(\^+)3(d[0-9a-f]{3})/gu, (_, esc, lowSurr) => {
100
101
  return esc.length % 2
101
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(lowSurr, 16))
102
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16))
102
103
  : _;
103
104
  }).replace(/(\^+)2(d[0-9a-f]{3})/gu, (_, esc, highSurr) => {
104
105
  return esc.length % 2
105
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(highSurr, 16))
106
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16))
106
107
  : _;
107
108
  });
108
109
  }
@@ -122,7 +123,7 @@ function unescapeDatabaseNameForSQLAndFiles (db) {
122
123
  // CFG.databaseCharacterEscapeList
123
124
  .replace(/(\^+)1([0-9a-f]{2})/gu, (_, esc, hex) => {
124
125
  return esc.length % 2
125
- ? esc.slice(1) + String.fromCharCode(Number.parseInt(hex, 16))
126
+ ? esc.slice(1) + String.fromCodePoint(Number.parseInt(hex, 16))
126
127
  : _;
127
128
  // CFG.escapeNFDForDatabaseNames
128
129
  }).replace(/(\^+)4([0-9a-f]{6})/gu, (_, esc, hex) => {
@@ -352,7 +353,7 @@ function isNullish (v) {
352
353
  }
353
354
 
354
355
  function hasOwn (obj, prop) {
355
- return {}.hasOwnProperty.call(obj, prop);
356
+ return Object.prototype.hasOwnProperty.call(obj, prop);
356
357
  }
357
358
 
358
359
  export {escapeSQLiteStatement, unescapeSQLiteResponse,