indexeddbshim 17.3.4 → 17.4.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.
- package/README.md +3 -146
- package/dist/CFG.d.ts +1 -0
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts +4 -4
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +4 -4
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +3 -2
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +2 -2
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +52 -38
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +35 -35
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +52 -38
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +35 -35
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +2 -2
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +35 -35
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts +3 -3
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/node.d.ts +3 -3
- package/dist/node.d.ts.map +1 -1
- package/dist/nodeSQLiteDatabase.d.ts.map +1 -1
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/CFG.js +2 -0
- package/src/DOMException.js +21 -21
- package/src/IDBFactory.js +2 -2
- package/src/IDBObjectStore.js +1 -1
- package/src/node-UnicodeIdentifiers.js +2 -2
- package/src/node.js +2 -2
- package/src/nodeSQLiteDatabase.js +10 -1
- package/src/nodeWebSQL.js +3 -0
- package/src/setGlobalVars.js +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default __setGlobalVars;
|
|
2
2
|
/**
|
|
3
|
-
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
4
|
-
* @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
|
|
3
|
+
* @param {import('./setGlobalVars.js').ShimmedObject} [idb]
|
|
4
|
+
* @param {Partial<import('./CFG.js').ConfigValues>} [initialConfig]
|
|
5
5
|
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
6
6
|
*/
|
|
7
|
-
declare function __setGlobalVars(idb
|
|
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,
|
|
1
|
+
{"version":3,"file":"node-UnicodeIdentifiers.d.ts","sourceRoot":"","sources":["../src/node-UnicodeIdentifiers.js"],"names":[],"mappings":";AASA;;;;GAIG;AACH,uCAJW,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
|
-
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
4
|
-
* @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
|
|
3
|
+
* @param {import('./setGlobalVars.js').ShimmedObject} [idb]
|
|
4
|
+
* @param {Partial<import('./CFG.js').ConfigValues>} [initialConfig]
|
|
5
5
|
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
6
6
|
*/
|
|
7
|
-
declare function __setGlobalVars(idb
|
|
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
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,uCAJW,OAAO,oBAAoB,EAAE,aAAa,kBAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,OAAO,oBAAoB,EAAE,aAAa,GAAC,MAAM,CAQ7D"}
|
|
@@ -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;AAkC9C;;;;;;GAMG;AACH;SAHgB,GAAG;gBAAc,MAAM;SAF5B,MAAM,SACN;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAAC,GAEjF,IAAI,
|
|
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;AAkC9C;;;;;;GAMG;AACH;SAHgB,GAAG;gBAAc,MAAM;SAF5B,MAAM,SACN;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAAC,GAEjF,IAAI,CA4EhB;;IAjFD;;;;;;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,EA8E7F;IAzEG,mBAAsB;IAkBtB,SAsDE;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,CA2IhB;;AArTD;;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"}
|
package/dist/nodeWebSQL.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAgCrE,qHAAsK;2BAnD3I,yBAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indexeddbshim",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Parashuram <code@nparashuram.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
+
"prepublishOnly": "npm run license-badges && npm run build",
|
|
33
|
+
"attw": "attw --pack . --profile node16",
|
|
32
34
|
"tsc": "tsc",
|
|
33
35
|
"tsc-prod": "tsc -p tsconfig-prod.json",
|
|
34
36
|
"tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
|
|
35
37
|
"tsc-prod:ts7": "npx -y typescript@^7 tsc -p tsconfig-prod.json",
|
|
36
38
|
"build": "rm -R dist && npm run tsc-prod && npm run rollup",
|
|
37
|
-
"prepublishOnly": "npm run license-badges && npm run build",
|
|
38
39
|
"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",
|
|
39
40
|
"license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
|
|
40
41
|
"license-badges": "run-p license-badge license-badge-dev",
|
|
@@ -47,13 +48,13 @@
|
|
|
47
48
|
"clean-mocha": "rimraf D_indexeddbshim_test_database_* D_test.sqlite",
|
|
48
49
|
"clean-fake": "rimraf D_test0.*",
|
|
49
50
|
"clean-mock": "rimraf D_test_database*",
|
|
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*",
|
|
51
|
+
"clean-w3c": "rimraf D_opaque* D_inbox* D_output* D_*_bucket_* 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*",
|
|
51
52
|
"clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
|
|
52
53
|
"clean-w3c-built": "rimraf test-support/js",
|
|
53
54
|
"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",
|
|
54
55
|
"fix-permissions": "chmod +x node_modules/npm-run-all/bin/*/index.js",
|
|
55
56
|
"lint": "eslint .",
|
|
56
|
-
"eslint": "npm run lint",
|
|
57
|
+
"eslint": "npm run lint --",
|
|
57
58
|
"sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
|
|
58
59
|
"w3c-build-only": "node test-support/node-buildjs",
|
|
59
60
|
"w3c-build": "run-s clean-w3c clean-w3c-built w3c-build-only",
|
|
@@ -176,6 +177,7 @@
|
|
|
176
177
|
"websql-configurable": "^3.1.0"
|
|
177
178
|
},
|
|
178
179
|
"devDependencies": {
|
|
180
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
179
181
|
"@babel/core": "^8.0.1",
|
|
180
182
|
"@babel/preset-env": "^8.0.2",
|
|
181
183
|
"@es-joy/json-file-reporter": "^1.5.0",
|
|
@@ -186,9 +188,9 @@
|
|
|
186
188
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
187
189
|
"@rollup/plugin-terser": "^1.0.0",
|
|
188
190
|
"@types/better-sqlite3": "^9.6.0",
|
|
189
|
-
"@types/node": "^26.
|
|
191
|
+
"@types/node": "^26.4.0",
|
|
190
192
|
"@types/websql": "^0.0.30",
|
|
191
|
-
"@unicode/unicode-17.0.0": "^
|
|
193
|
+
"@unicode/unicode-17.0.0": "^2.0.2",
|
|
192
194
|
"babel-plugin-add-module-exports": "1.0.4",
|
|
193
195
|
"bson": "^7.3.2",
|
|
194
196
|
"builtin-modules": "^5.3.0",
|
|
@@ -198,7 +200,6 @@
|
|
|
198
200
|
"colors": "1.4.0",
|
|
199
201
|
"copyfiles": "^2.4.1",
|
|
200
202
|
"coveradge": "^0.8.2",
|
|
201
|
-
"cyclonejs": "1.1.4",
|
|
202
203
|
"delay-cli": "^3.0.0",
|
|
203
204
|
"eslint": "^10.9.1",
|
|
204
205
|
"eslint-config-ash-nazg": "^42.6.0",
|
|
@@ -207,7 +208,7 @@
|
|
|
207
208
|
"isomorphic-fetch": "^3.0.0",
|
|
208
209
|
"jsdom": "^30.0.1",
|
|
209
210
|
"license-badger": "^0.23.0",
|
|
210
|
-
"local-xmlhttprequest": "
|
|
211
|
+
"local-xmlhttprequest": "4.0.0",
|
|
211
212
|
"mocha": "^11.8.0",
|
|
212
213
|
"mocha-badge-generator": "^0.11.0",
|
|
213
214
|
"mocha-multi-reporters": "^1.5.1",
|
package/src/CFG.js
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
* sqlBusyTimeout: number,
|
|
44
44
|
* sqlTrace: () => void,
|
|
45
45
|
* sqlProfile: () => void,
|
|
46
|
+
* sqlMemoryQuota: number,
|
|
46
47
|
* escapeNULForSQLiteStatements: boolean,
|
|
47
48
|
* createIndexes: boolean
|
|
48
49
|
* }} ConfigValues
|
|
@@ -220,6 +221,7 @@ const CFG = /** @type {ConfigValues} */ ({});
|
|
|
220
221
|
// Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
|
|
221
222
|
'escapeNULForSQLiteStatements',
|
|
222
223
|
|
|
224
|
+
'sqlMemoryQuota',
|
|
223
225
|
'createIndexes'
|
|
224
226
|
]).forEach((prop) => {
|
|
225
227
|
/** @type {(val: any) => void} */
|
package/src/DOMException.js
CHANGED
|
@@ -330,15 +330,14 @@ function findError (args) {
|
|
|
330
330
|
* optional here and, in practice, always `undefined` today (the `case 4`/
|
|
331
331
|
* `case 7` branches below are effectively unreachable pending upstream
|
|
332
332
|
* support for surfacing a real error code).
|
|
333
|
-
* @param {Error & {code?: number}} webSQLErr
|
|
333
|
+
* @param {Error & {code?: number|string}} webSQLErr
|
|
334
334
|
* @returns {(DOMException|Error) & {
|
|
335
|
-
* sqlError: Error & {code?: number}
|
|
335
|
+
* sqlError: Error & {code?: number|string}
|
|
336
336
|
* }|QuotaExceededError}
|
|
337
337
|
*/
|
|
338
338
|
function webSQLErrback (webSQLErr) {
|
|
339
339
|
let name, message, useQuotaExceededError = false;
|
|
340
|
-
|
|
341
|
-
case 4: { // SQLError.QUOTA_ERR
|
|
340
|
+
if (webSQLErr.code === 4 || webSQLErr.code === 'SQLITE_FULL') { // SQLError.QUOTA_ERR or better-sqlite3 SQLITE_FULL
|
|
342
341
|
name = 'QuotaExceededError';
|
|
343
342
|
message = 'The operation failed because there was not enough ' +
|
|
344
343
|
'remaining storage space, or the storage quota was reached ' +
|
|
@@ -346,22 +345,23 @@ function webSQLErrback (webSQLErr) {
|
|
|
346
345
|
if (typeof QuotaExceededError !== 'undefined') {
|
|
347
346
|
useQuotaExceededError = true;
|
|
348
347
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
348
|
+
} else {
|
|
349
|
+
switch (webSQLErr.code) {
|
|
350
|
+
/*
|
|
351
|
+
// Should a WebSQL timeout treat as IndexedDB `TransactionInactiveError` or `UnknownError`?
|
|
352
|
+
case 7: { // SQLError.TIMEOUT_ERR
|
|
353
|
+
// All transaction errors abort later, so no need to mark inactive
|
|
354
|
+
name = 'TransactionInactiveError';
|
|
355
|
+
message = 'A request was placed against a transaction which is currently not active, or which is finished (Internal SQL Timeout).';
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
*/
|
|
359
|
+
default: {
|
|
360
|
+
name = 'UnknownError';
|
|
361
|
+
message = 'The operation failed for reasons unrelated to the database itself and not covered by any other errors.';
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
365
|
}
|
|
366
366
|
message += ' (' + webSQLErr.message + ')--(' + webSQLErr.code + ')';
|
|
367
367
|
|
|
@@ -372,7 +372,7 @@ function webSQLErrback (webSQLErr) {
|
|
|
372
372
|
const err =
|
|
373
373
|
/**
|
|
374
374
|
* @type {(Error | DOMException) & {
|
|
375
|
-
* sqlError: Error & {code?: number}
|
|
375
|
+
* sqlError: Error & {code?: number|string}
|
|
376
376
|
* }}
|
|
377
377
|
*/
|
|
378
378
|
(createDOMException(name, message));
|
package/src/IDBFactory.js
CHANGED
|
@@ -1220,8 +1220,8 @@ IDBFactory.prototype.cmp = function (key1, key2) {
|
|
|
1220
1220
|
* @see https://github.com/w3c/IndexedDB/pull/240/files
|
|
1221
1221
|
* @this {IDBFactoryFull}
|
|
1222
1222
|
* @returns {Promise<{
|
|
1223
|
-
* name
|
|
1224
|
-
* version
|
|
1223
|
+
* name?: string,
|
|
1224
|
+
* version?: Integer
|
|
1225
1225
|
* }[]>}
|
|
1226
1226
|
*/
|
|
1227
1227
|
IDBFactory.prototype.databases = function () {
|
package/src/IDBObjectStore.js
CHANGED
|
@@ -322,7 +322,7 @@ IDBObjectStore.__createObjectStore = function (db, store) {
|
|
|
322
322
|
encodedKeyPath,
|
|
323
323
|
// For why converting here, see comment and following
|
|
324
324
|
// discussion at:
|
|
325
|
-
// https://github.com/
|
|
325
|
+
// https://github.com/indexeddbshim/IndexedDBShim/issues/313#issuecomment-590086778
|
|
326
326
|
Number(store.autoIncrement),
|
|
327
327
|
'{}',
|
|
328
328
|
1
|
|
@@ -8,8 +8,8 @@ import * as UnicodeIdentifiers from './UnicodeIdentifiers.js';
|
|
|
8
8
|
CFG.win = {openDatabase: nodeWebSQL};
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
12
|
-
* @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
|
|
11
|
+
* @param {import('./setGlobalVars.js').ShimmedObject} [idb]
|
|
12
|
+
* @param {Partial<import('./CFG.js').ConfigValues>} [initialConfig]
|
|
13
13
|
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
14
14
|
*/
|
|
15
15
|
const __setGlobalVars = function (idb, initialConfig = {}) {
|
package/src/node.js
CHANGED
|
@@ -7,8 +7,8 @@ import CFG from './CFG.js';
|
|
|
7
7
|
CFG.win = {openDatabase: nodeWebSQL};
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @param {import('./setGlobalVars.js').ShimmedObject} idb
|
|
11
|
-
* @param {Partial<import('./CFG.js').ConfigValues>} initialConfig
|
|
10
|
+
* @param {import('./setGlobalVars.js').ShimmedObject} [idb]
|
|
11
|
+
* @param {Partial<import('./CFG.js').ConfigValues>} [initialConfig]
|
|
12
12
|
* @returns {import('./setGlobalVars.js').ShimmedObject|Window}
|
|
13
13
|
*/
|
|
14
14
|
const __setGlobalVars = function (idb, initialConfig = {}) {
|
|
@@ -91,7 +91,7 @@ function SQLiteDatabase (name, opts = {}) {
|
|
|
91
91
|
_db: db,
|
|
92
92
|
/**
|
|
93
93
|
* Compatibility with node-sqlite3's configure API.
|
|
94
|
-
* @param {'busyTimeout'|'trace'|'profile'} option
|
|
94
|
+
* @param {'busyTimeout'|'trace'|'profile'|'memoryQuota'} option
|
|
95
95
|
* @param {number|((sql: string, duration?: number) => void)} value
|
|
96
96
|
* @returns {void}
|
|
97
97
|
*/
|
|
@@ -106,6 +106,15 @@ function SQLiteDatabase (name, opts = {}) {
|
|
|
106
106
|
}
|
|
107
107
|
if (option === 'profile') {
|
|
108
108
|
profile = /** @type {SQLProfileCallback} */ (value);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (option === 'memoryQuota') {
|
|
112
|
+
const bytes = Number(value);
|
|
113
|
+
// `better-sqlite3` doesn't have a direct `sqlite3_quota_set` binding,
|
|
114
|
+
// but we can limit the max pages:
|
|
115
|
+
const pageSizeObj = db.pragma('page_size', {simple: true});
|
|
116
|
+
const pageSize = Number(pageSizeObj);
|
|
117
|
+
db.pragma('max_page_count = ' + Math.ceil(bytes / pageSize));
|
|
109
118
|
}
|
|
110
119
|
},
|
|
111
120
|
/**
|
package/src/nodeWebSQL.js
CHANGED
package/src/setGlobalVars.js
CHANGED
|
@@ -368,7 +368,7 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
368
368
|
!navigator.userAgent.includes('Chrome')
|
|
369
369
|
) ||
|
|
370
370
|
(
|
|
371
|
-
// Bad non-Safari iOS9 support (see <https://github.com/
|
|
371
|
+
// Bad non-Safari iOS9 support (see <https://github.com/indexeddbshim/IndexedDBShim/issues/252>)
|
|
372
372
|
(!navigator.userAgent.includes('Safari') || navigator.userAgent.includes('Chrome')) && // Exclude genuine Safari: https://stackoverflow.com/a/7768006/271577
|
|
373
373
|
// Detect iOS: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
|
|
374
374
|
// and detect version 9: https://stackoverflow.com/a/26363560/271577
|
|
@@ -381,8 +381,8 @@ function setGlobalVars (idb, initialConfig) {
|
|
|
381
381
|
if (!CFG.DEFAULT_DB_SIZE) {
|
|
382
382
|
CFG.DEFAULT_DB_SIZE = (
|
|
383
383
|
( // Safari currently requires larger size: (We don't need a larger size for Node as node-websql doesn't use this info)
|
|
384
|
-
// https://github.com/
|
|
385
|
-
// https://github.com/
|
|
384
|
+
// https://github.com/indexeddbshim/IndexedDBShim/issues/41
|
|
385
|
+
// https://github.com/indexeddbshim/IndexedDBShim/issues/115
|
|
386
386
|
typeof navigator !== 'undefined' &&
|
|
387
387
|
// React Native
|
|
388
388
|
navigator.userAgent &&
|