indexeddbshim 12.0.0 → 13.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.
Files changed (101) hide show
  1. package/README.md +1 -1
  2. package/badges/licenses-badge-dev.svg +1 -1
  3. package/dist/CFG.d.ts +80 -0
  4. package/dist/CFG.d.ts.map +1 -0
  5. package/dist/DOMException.d.ts +71 -0
  6. package/dist/DOMException.d.ts.map +1 -0
  7. package/dist/DOMStringList.d.ts +20 -0
  8. package/dist/DOMStringList.d.ts.map +1 -0
  9. package/dist/Event.d.ts +21 -0
  10. package/dist/Event.d.ts.map +1 -0
  11. package/dist/IDBCursor.d.ts +288 -0
  12. package/dist/IDBCursor.d.ts.map +1 -0
  13. package/dist/IDBDatabase.d.ts +143 -0
  14. package/dist/IDBDatabase.d.ts.map +1 -0
  15. package/dist/IDBFactory.d.ts +96 -0
  16. package/dist/IDBFactory.d.ts.map +1 -0
  17. package/dist/IDBIndex.d.ts +243 -0
  18. package/dist/IDBIndex.d.ts.map +1 -0
  19. package/dist/IDBKeyRange.d.ts +79 -0
  20. package/dist/IDBKeyRange.d.ts.map +1 -0
  21. package/dist/IDBObjectStore.d.ts +273 -0
  22. package/dist/IDBObjectStore.d.ts.map +1 -0
  23. package/dist/IDBRequest.d.ts +88 -0
  24. package/dist/IDBRequest.d.ts.map +1 -0
  25. package/dist/IDBTransaction.d.ts +270 -0
  26. package/dist/IDBTransaction.d.ts.map +1 -0
  27. package/dist/IDBVersionChangeEvent.d.ts +22 -0
  28. package/dist/IDBVersionChangeEvent.d.ts.map +1 -0
  29. package/dist/Key.d.ts +214 -0
  30. package/dist/Key.d.ts.map +1 -0
  31. package/dist/Sca.d.ts +31 -0
  32. package/dist/Sca.d.ts.map +1 -0
  33. package/dist/UnicodeIdentifiers.d.ts +3 -0
  34. package/dist/UnicodeIdentifiers.d.ts.map +1 -0
  35. package/dist/browser-UnicodeIdentifiers.d.ts +2 -0
  36. package/dist/browser-UnicodeIdentifiers.d.ts.map +1 -0
  37. package/dist/browser-noninvasive.d.ts +3 -0
  38. package/dist/browser-noninvasive.d.ts.map +1 -0
  39. package/dist/browser.d.ts +2 -0
  40. package/dist/browser.d.ts.map +1 -0
  41. package/dist/cmp.d.ts +9 -0
  42. package/dist/cmp.d.ts.map +1 -0
  43. package/dist/indexeddbshim-Key.js +553 -252
  44. package/dist/indexeddbshim-Key.js.map +1 -1
  45. package/dist/indexeddbshim-Key.min.js +2 -2
  46. package/dist/indexeddbshim-Key.min.js.map +1 -1
  47. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +17560 -1302
  48. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  49. package/dist/indexeddbshim-UnicodeIdentifiers.js +4367 -1604
  50. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  51. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
  52. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  53. package/dist/indexeddbshim-node.cjs +17556 -1302
  54. package/dist/indexeddbshim-node.cjs.map +1 -1
  55. package/dist/indexeddbshim-noninvasive.js +4362 -1604
  56. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  57. package/dist/indexeddbshim-noninvasive.min.js +2 -2
  58. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  59. package/dist/indexeddbshim.js +4362 -1604
  60. package/dist/indexeddbshim.js.map +1 -1
  61. package/dist/indexeddbshim.min.js +2 -2
  62. package/dist/indexeddbshim.min.js.map +1 -1
  63. package/dist/node-UnicodeIdentifiers.d.ts +8 -0
  64. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -0
  65. package/dist/node.d.ts +8 -0
  66. package/dist/node.d.ts.map +1 -0
  67. package/dist/nodeWebSQL.d.ts +3 -0
  68. package/dist/nodeWebSQL.d.ts.map +1 -0
  69. package/dist/setGlobalVars.d.ts +79 -0
  70. package/dist/setGlobalVars.d.ts.map +1 -0
  71. package/dist/unicode-regex.d.ts +3 -0
  72. package/dist/unicode-regex.d.ts.map +1 -0
  73. package/dist/util.d.ts +174 -0
  74. package/dist/util.d.ts.map +1 -0
  75. package/index.html +1 -1
  76. package/package.json +51 -37
  77. package/src/CFG.js +89 -11
  78. package/src/DOMException.js +117 -31
  79. package/src/DOMStringList.js +93 -3
  80. package/src/Event.js +19 -4
  81. package/src/IDBCursor.js +350 -76
  82. package/src/IDBDatabase.js +88 -10
  83. package/src/IDBFactory.js +331 -61
  84. package/src/IDBIndex.js +393 -110
  85. package/src/IDBKeyRange.js +90 -17
  86. package/src/IDBObjectStore.js +347 -86
  87. package/src/IDBRequest.js +59 -1
  88. package/src/IDBTransaction.js +254 -46
  89. package/src/IDBVersionChangeEvent.js +28 -3
  90. package/src/Key.d.ts +1 -0
  91. package/src/Key.js +272 -162
  92. package/src/Sca.js +29 -4
  93. package/src/browser-UnicodeIdentifiers.js +5 -1
  94. package/src/cmp.js +5 -5
  95. package/src/node-UnicodeIdentifiers.js +9 -0
  96. package/src/node.js +5 -0
  97. package/src/nodeWebSQL.js +11 -5
  98. package/src/setGlobalVars.js +159 -22
  99. package/src/unicode-regex.js +2 -0
  100. package/src/util.js +229 -40
  101. package/typings/shimIndexedDB.d.ts +9 -0
@@ -0,0 +1,8 @@
1
+ export default __setGlobalVars;
2
+ /**
3
+ * @param {import('./setGlobalVars.js').ShimmedObject} idb
4
+ * @param {import('./CFG.js').default} initialConfig
5
+ * @returns {{}|Window}
6
+ */
7
+ declare function __setGlobalVars(idb: import('./setGlobalVars.js').ShimmedObject, initialConfig?: any): {} | Window;
8
+ //# sourceMappingURL=node-UnicodeIdentifiers.d.ts.map
@@ -0,0 +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,EAAE,GAAC,MAAM,CAWrB"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export default __setGlobalVars;
2
+ /**
3
+ * @param {import('./setGlobalVars.js').ShimmedObject} idb
4
+ * @param {import('./CFG.js').default} initialConfig
5
+ * @returns {{}|Window}
6
+ */
7
+ declare function __setGlobalVars(idb: import('./setGlobalVars.js').ShimmedObject, initialConfig?: any): {} | Window;
8
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,sCAJW,OAAO,oBAAoB,EAAE,aAAa,wBAExC,EAAE,GAAC,MAAM,CAIrB"}
@@ -0,0 +1,3 @@
1
+ export default nodeWebSQL;
2
+ declare const nodeWebSQL: (...args: any[]) => import("websql-configurable/lib/websql/WebSQLDatabase.js").default;
3
+ //# sourceMappingURL=nodeWebSQL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeWebSQL.d.ts","sourceRoot":"","sources":["../src/nodeWebSQL.js"],"names":[],"mappings":";AAwBA,iHAAiE"}
@@ -0,0 +1,79 @@
1
+ export { createDOMException };
2
+ export default setGlobalVars;
3
+ export type AnyValue = any;
4
+ export type SetConfig = (prop: import('./CFG.js').KeyofConfigValues | Partial<import('./CFG.js').ConfigValues>, val?: AnyValue) => any;
5
+ export type GetConfig = (prop: import('./CFG.js').KeyofConfigValues) => import('../src/CFG.js').ConfigValue;
6
+ export type SetUnicodeIdentifiers = (cfg: {
7
+ UnicodeIDStart: string;
8
+ UnicodeIDContinue: string;
9
+ }) => void;
10
+ export type ShimIndexedDB = (object | IDBFactory) & {
11
+ __useShim: () => void;
12
+ __debug: (val: boolean) => void;
13
+ __setConfig: SetConfig;
14
+ __getConfig: GetConfig;
15
+ __setUnicodeIdentifiers: SetUnicodeIdentifiers;
16
+ __setConnectionQueueOrigin: (origin?: string) => void;
17
+ };
18
+ export type Integer = number;
19
+ export type ShimmedObject = (typeof globalThis | object) & {
20
+ indexedDB?: Partial<IDBFactory>;
21
+ IDBFactory: typeof IDBFactory;
22
+ IDBOpenDBRequest: typeof IDBOpenDBRequest;
23
+ IDBRequest: typeof IDBRequest;
24
+ IDBCursorWithValue: typeof IDBCursorWithValue;
25
+ IDBCursor: typeof IDBCursor;
26
+ IDBDatabase: typeof IDBDatabase;
27
+ IDBTransaction: typeof IDBTransaction;
28
+ IDBKeyRange: typeof IDBKeyRange;
29
+ shimIndexedDB?: ShimIndexedDB;
30
+ };
31
+ import { createDOMException } from './DOMException.js';
32
+ /**
33
+ * @typedef {(
34
+ * prop: import('./CFG.js').KeyofConfigValues
35
+ * ) => import('../src/CFG.js').ConfigValue} GetConfig
36
+ */
37
+ /**
38
+ * @typedef {(cfg: {
39
+ * UnicodeIDStart: string,
40
+ * UnicodeIDContinue: string
41
+ * }) => void} SetUnicodeIdentifiers
42
+ */
43
+ /**
44
+ * @typedef {(IDBFactory|object) & {
45
+ * __useShim: () => void,
46
+ * __debug: (val: boolean) => void,
47
+ * __setConfig: SetConfig,
48
+ * __getConfig: GetConfig,
49
+ * __setUnicodeIdentifiers: SetUnicodeIdentifiers,
50
+ * __setConnectionQueueOrigin: (origin?: string) => void
51
+ * }} ShimIndexedDB
52
+ */
53
+ /**
54
+ * @typedef {number} Integer
55
+ */
56
+ /**
57
+ * @typedef {(typeof globalThis|object) & {
58
+ * indexedDB?: Partial<IDBFactory>,
59
+ * IDBFactory: typeof IDBFactory,
60
+ * IDBOpenDBRequest: typeof IDBOpenDBRequest,
61
+ * IDBRequest: typeof IDBRequest,
62
+ * IDBCursorWithValue: typeof IDBCursorWithValue,
63
+ * IDBCursor: typeof IDBCursor,
64
+ * IDBDatabase: typeof IDBDatabase,
65
+ * IDBTransaction: typeof IDBTransaction,
66
+ * IDBKeyRange: typeof IDBKeyRange,
67
+ * shimIndexedDB?: ShimIndexedDB
68
+ * }} ShimmedObject
69
+ */
70
+ /**
71
+ *
72
+ * @param {ShimmedObject} [idb]
73
+ * @param {import('./CFG.js').ConfigValues} [initialConfig]
74
+ * @returns {ShimmedObject}
75
+ */
76
+ declare function setGlobalVars(idb?: ShimmedObject | undefined, initialConfig?: import("./CFG.js").ConfigValues | undefined): ShimmedObject;
77
+ import { IDBFactory } from './IDBFactory.js';
78
+ import { shimIndexedDB } from './IDBFactory.js';
79
+ //# sourceMappingURL=setGlobalVars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setGlobalVars.d.ts","sourceRoot":"","sources":["../src/setGlobalVars.js"],"names":[],"mappings":";;uBAkBa,GAAG;+BAKL,OAAO,UAAU,EAAE,iBAAiB,GAC9C,QAAY,OAAO,UAAU,EAAE,YAAY,CAAC,QAClC,QAAQ;+BAqCR,OAAO,UAAU,EAAE,iBAAiB,KACvC,OAAO,eAAe,EAAE,WAAW;0CAIxB;IAClB,cAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAqB,EAAE,MAAM,CAAA;CAC1B,KAAK,IAAI;;eAKK,MAAM,IAAI;mBACN,OAAO,KAAK,IAAI;iBAClB,SAAS;iBACT,SAAS;6BACG,qBAAqB;0CACR,MAAM,KAAK,IAAI;;sBAK/C,MAAM;4BAIN,CAAC,iBAAiB,GAAC,MAAM,CAAC,GAAG;IACzC,SAAa,CAAC,EAAE,QAAQ,UAAU,CAAC,CAAC;IACpC,YAAgB,iBAAiB,CAAC;IAClC,kBAAsB,uBAAuB,CAAC;IAC9C,YAAgB,iBAAiB,CAAC;IAClC,oBAAwB,yBAAyB,CAAC;IAClD,WAAe,gBAAgB,CAAC;IAChC,aAAiB,kBAAkB,CAAC;IACpC,gBAAoB,qBAAqB,CAAC;IAC1C,aAAiB,kBAAkB,CAAC;IACpC,aAAiB,CAAC,EAAE,aAAa,CAAA;CAC9B;mCAhG+C,mBAAmB;AAwDtE;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,8HAFa,aAAa,CA+RzB;2BArY8C,iBAAiB;8BAAjB,iBAAiB"}
@@ -0,0 +1,3 @@
1
+ export { regex$1 as default };
2
+ declare var regex$1: any;
3
+ //# sourceMappingURL=unicode-regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unicode-regex.d.ts","sourceRoot":"","sources":["../src/unicode-regex.js"],"names":[],"mappings":";AAQA,yBAA0D"}
package/dist/util.d.ts ADDED
@@ -0,0 +1,174 @@
1
+ export type Integer = number;
2
+ export type AnyClass = Function;
3
+ export type AnyValue = any;
4
+ /**
5
+ * The escaping of unmatched surrogates was needed by Chrome but not Node.
6
+ * @param {string} arg
7
+ * @returns {string}
8
+ */
9
+ export function escapeSQLiteStatement(arg: string): string;
10
+ /**
11
+ * @param {string} arg
12
+ * @returns {string}
13
+ */
14
+ export function unescapeSQLiteResponse(arg: string): string;
15
+ /**
16
+ * @param {string} db
17
+ * @throws {Error}
18
+ * @returns {string}
19
+ */
20
+ export function escapeDatabaseNameForSQLAndFiles(db: string): string;
21
+ /**
22
+ * Not in use internally but supplied for convenience.
23
+ * @param {string} db
24
+ * @returns {string}
25
+ */
26
+ export function unescapeDatabaseNameForSQLAndFiles(db: string): string;
27
+ /**
28
+ * @param {string} store
29
+ * @returns {string}
30
+ */
31
+ export function escapeStoreNameForSQL(store: string): string;
32
+ /**
33
+ * @param {string} index
34
+ * @returns {string}
35
+ */
36
+ export function escapeIndexNameForSQL(index: string): string;
37
+ /**
38
+ * @param {string} index
39
+ * @returns {string}
40
+ */
41
+ export function escapeIndexNameForSQLKeyColumn(index: string): string;
42
+ /**
43
+ * @param {string} str
44
+ * @returns {string}
45
+ */
46
+ export function sqlLIKEEscape(str: string): string;
47
+ /**
48
+ * @param {string} arg
49
+ * @returns {string}
50
+ */
51
+ export function sqlQuote(arg: string): string;
52
+ /**
53
+ * @typedef {Function} AnyClass
54
+ */
55
+ /**
56
+ *
57
+ * @param {AnyValue} obj
58
+ * @param {AnyClass} Clss
59
+ * @returns {boolean}
60
+ */
61
+ export function instanceOf(obj: AnyValue, Clss: AnyClass): boolean;
62
+ /**
63
+ *
64
+ * @param {AnyValue} obj
65
+ * @returns {obj is object}
66
+ */
67
+ export function isObj(obj: AnyValue): obj is object;
68
+ /**
69
+ *
70
+ * @param {object} obj
71
+ * @returns {boolean}
72
+ */
73
+ export function isDate(obj: object): boolean;
74
+ /**
75
+ *
76
+ * @param {object} obj
77
+ * @returns {boolean}
78
+ */
79
+ export function isBlob(obj: object): boolean;
80
+ /**
81
+ *
82
+ * @param {object} obj
83
+ * @returns {boolean}
84
+ */
85
+ export function isRegExp(obj: object): boolean;
86
+ /**
87
+ *
88
+ * @param {object} obj
89
+ * @returns {boolean}
90
+ */
91
+ export function isFile(obj: object): boolean;
92
+ /**
93
+ *
94
+ * @param {AnyValue} obj
95
+ * @returns {boolean}
96
+ */
97
+ export function isBinary(obj: AnyValue): boolean;
98
+ /**
99
+ *
100
+ * @param {AnyValue} obj
101
+ * @returns {boolean}
102
+ */
103
+ export function isIterable(obj: AnyValue): boolean;
104
+ /**
105
+ *
106
+ * @param {object} obj
107
+ * @param {string[]} props
108
+ * @returns {void}
109
+ */
110
+ export function defineOuterInterface(obj: object, props: string[]): void;
111
+ /**
112
+ *
113
+ * @param {object} obj
114
+ * @param {string[]} props
115
+ * @returns {void}
116
+ */
117
+ export function defineReadonlyOuterInterface(obj: object, props: string[]): void;
118
+ /**
119
+ *
120
+ * @param {object & {
121
+ * [key: string]: any
122
+ * }} obj
123
+ * @param {string[]} listeners
124
+ * @returns {void}
125
+ */
126
+ export function defineListenerProperties(obj: object & {
127
+ [key: string]: any;
128
+ }, listeners: string[]): void;
129
+ /**
130
+ *
131
+ * @param {object} obj
132
+ * @param {string|string[]} props
133
+ * @param {null|{
134
+ * [key: string]: any
135
+ * }} getter
136
+ * @returns {void}
137
+ */
138
+ export function defineReadonlyProperties(obj: object, props: string | string[], getter?: {
139
+ [key: string]: any;
140
+ } | null): void;
141
+ /**
142
+ *
143
+ * @param {string|string[]} keyPath
144
+ * @returns {boolean}
145
+ */
146
+ export function isValidKeyPath(keyPath: string | string[]): boolean;
147
+ /**
148
+ * @param {number} number
149
+ * @param {"unsigned long long"|"unsigned long"} type
150
+ * @throws {Error|TypeError}
151
+ * @returns {number}
152
+ */
153
+ export function enforceRange(number: number, type: "unsigned long long" | "unsigned long"): number;
154
+ /**
155
+ * @typedef {any} AnyValue
156
+ */
157
+ /**
158
+ * @param {AnyValue} v
159
+ * @param {boolean} [treatNullAs]
160
+ * @returns {string}
161
+ */
162
+ export function convertToDOMString(v: AnyValue, treatNullAs?: boolean | undefined): string;
163
+ /**
164
+ *
165
+ * @param {AnyValue} val
166
+ * @returns {string|string[]}
167
+ */
168
+ export function convertToSequenceDOMString(val: AnyValue): string | string[];
169
+ /**
170
+ * @param {AnyValue} v
171
+ * @returns {v is null|undefined}
172
+ */
173
+ export function isNullish(v: AnyValue): v is null | undefined;
174
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAIa,MAAM;;uBAifN,GAAG;AAvchB;;;;GAIG;AACH,2CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,4CAHW,MAAM,GACJ,MAAM,CAUlB;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;;;GAGG;AACH,mCAHW,MAAM,GACJ,MAAM,CAKlB;AAxID;;;GAGG;AACH,8BAHW,MAAM,GACJ,MAAM,CAIlB;AAoID;;GAEG;AAGH;;;;;GAKG;AACH,gCAJW,QAAQ,QACR,QAAQ,GACN,OAAO,CAInB;AAED;;;;GAIG;AACH,2BAHW,QAAQ,iBAKlB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,8BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,8BAHW,QAAQ,GACN,OAAO,CAOnB;AAED;;;;GAIG;AACH,gCAHW,QAAQ,GACN,OAAO,CAKnB;AAED;;;;;GAKG;AACH,0CAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAkBhB;AAED;;;;;GAKG;AACH,kDAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAchB;AAED;;;;;;;GAOG;AACH;;cAHW,MAAM,EAAE,GACN,IAAI,CA2BhB;AAED;;;;;;;;GAQG;AACH,8CAPW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE;;WAIb,IAAI,CA8BhB;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,sCAEN,MAAM,CAIlB;AAWD;;;;GAIG;AACH,gDAHW,QAAQ,GACN,MAAM,GAAC,MAAM,EAAE,CAW3B;AAED;;;GAGG;AACH,6BAHW,QAAQ,yBAKlB"}
package/index.html CHANGED
@@ -114,7 +114,7 @@
114
114
  ga.src = (document.location.protocol === 'https:' ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
115
115
  const s = document.querySelector('script');
116
116
  s.parentNode.insertBefore(ga, s);
117
- })();
117
+ }());
118
118
  }
119
119
  </script>
120
120
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "12.0.0",
3
+ "version": "13.0.0",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
@@ -29,7 +29,10 @@
29
29
  ]
30
30
  },
31
31
  "scripts": {
32
- "prepublishOnly": "echo 'reenable when license-badger updated: npm run license-badges'",
32
+ "tsc": "tsc",
33
+ "tsc-prod": "tsc -p tsconfig-prod.json",
34
+ "build": "npm run rollup && npm run tsc-prod",
35
+ "prepublishOnly": "npm run license-badges",
33
36
  "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",
34
37
  "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
35
38
  "license-badges": "run-p license-badge license-badge-dev",
@@ -105,17 +108,25 @@
105
108
  "url": "https://github.com/indexeddbshim/IndexedDBShim/issues"
106
109
  },
107
110
  "main": "./dist/indexeddbshim-node.cjs",
111
+ "types": "./dist/node.d.ts",
108
112
  "exports": {
109
113
  ".": {
110
114
  "node": {
115
+ "types": "./dist/node-UnicodeIdentifiers.d.ts",
111
116
  "import": "./src/node-UnicodeIdentifiers.js",
112
117
  "require": "./dist/indexeddbshim-UnicodeIdentifiers-node.cjs"
113
118
  },
114
119
  "default": {
120
+ "types": "./dist/browser-noninvasive.d.ts",
115
121
  "import": "./src/browser-noninvasive.js",
116
122
  "require": "./dist/indexeddbshim-noninvasive.js"
117
123
  }
118
124
  },
125
+ "./src/Key.js": {
126
+ "types": "./dist/Key.d.ts",
127
+ "import": "./src/Key.js",
128
+ "require": "./dist/indexeddbshim-Key.js"
129
+ },
119
130
  "./*": "./*"
120
131
  },
121
132
  "keywords": [
@@ -148,73 +159,76 @@
148
159
  },
149
160
  "dependencies": {
150
161
  "canvas": "^2.11.2",
151
- "eventtargeter": "0.8.0",
152
- "sync-promise": "git+https://github.com/brettz9/sync-promise.git#full-sync-missing-promise-features",
153
- "typeson": "8.0.2",
154
- "typeson-registry": "6.0.0",
155
- "websql": "git+https://github.com/brettz9/node-websql.git#configurable-secure3"
162
+ "eventtargeter": "0.9.0",
163
+ "sync-promise-expanded": "^1.0.0",
164
+ "typeson": "9.0.3",
165
+ "typeson-registry": "9.2.1",
166
+ "websql-configurable": "^3.0.3"
156
167
  },
157
168
  "devDependencies": {
158
- "@babel/core": "^7.21.5",
159
- "@babel/preset-env": "^7.21.5",
169
+ "@babel/core": "^7.23.5",
170
+ "@babel/preset-env": "^7.23.5",
160
171
  "@brettz9/eslint-plugin": "^1.0.4",
161
172
  "@brettz9/node-static": "^0.1.1",
162
173
  "@es-joy/json-file-reporter": "^1.4.0",
163
- "@rollup/plugin-babel": "^6.0.3",
164
- "@rollup/plugin-commonjs": "^24.1.0",
165
- "@rollup/plugin-json": "^6.0.0",
166
- "@rollup/plugin-node-resolve": "^15.0.2",
167
- "@rollup/plugin-terser": "^0.4.1",
168
- "@unicode/unicode-13.0.0": "1.3.1",
174
+ "@rollup/plugin-babel": "^6.0.4",
175
+ "@rollup/plugin-commonjs": "^25.0.7",
176
+ "@rollup/plugin-json": "^6.0.1",
177
+ "@rollup/plugin-node-resolve": "^15.2.3",
178
+ "@rollup/plugin-terser": "^0.4.4",
179
+ "@types/node": "^20.10.4",
180
+ "@types/websql": "^0.0.30",
181
+ "@unicode/unicode-13.0.0": "1.5.2",
169
182
  "babel-plugin-add-module-exports": "1.0.4",
170
- "bson": "^5.2.0",
183
+ "bson": "^6.2.0",
171
184
  "builtin-modules": "^3.3.0",
172
- "c8": "^7.13.0",
173
- "chai": "4.3.7",
185
+ "c8": "^8.0.1",
186
+ "chai": "4.3.10",
174
187
  "chokidar-cli": "^3.0.0",
175
188
  "colors": "1.4.0",
176
189
  "copyfiles": "^2.4.1",
177
- "core-js-bundle": "^3.30.1",
190
+ "core-js-bundle": "^3.34.0",
178
191
  "coveradge": "^0.8.2",
179
192
  "cyclonejs": "1.1.4",
180
193
  "delay-cli": "^2.0.0",
181
- "eslint": "^8.39.0",
182
- "eslint-config-ash-nazg": "^34.11.1",
183
- "eslint-config-standard": "^17.0.0",
184
- "eslint-plugin-array-func": "^3.1.8",
185
- "eslint-plugin-compat": "^4.1.4",
194
+ "eslint": "^8.55.0",
195
+ "eslint-config-ash-nazg": "^35.1.0",
196
+ "eslint-config-standard": "^17.1.0",
197
+ "eslint-plugin-array-func": "^4.0.0",
198
+ "eslint-plugin-compat": "^4.2.0",
186
199
  "eslint-plugin-eslint-comments": "^3.2.0",
187
200
  "eslint-plugin-html": "^7.1.0",
188
- "eslint-plugin-import": "^2.27.5",
189
- "eslint-plugin-jsdoc": "^43.1.1",
190
- "eslint-plugin-markdown": "^3.0.0",
201
+ "eslint-plugin-import": "^2.29.0",
202
+ "eslint-plugin-jsdoc": "^46.9.0",
203
+ "eslint-plugin-markdown": "^3.0.1",
204
+ "eslint-plugin-n": "^16.3.1",
191
205
  "eslint-plugin-no-unsanitized": "^4.0.2",
192
206
  "eslint-plugin-no-use-extend-native": "^0.5.0",
193
- "eslint-plugin-node": "^11.1.0",
194
207
  "eslint-plugin-promise": "^6.1.1",
195
- "eslint-plugin-sonarjs": "^0.19.0",
208
+ "eslint-plugin-sonarjs": "^0.23.0",
196
209
  "eslint-plugin-standard": "^4.1.0",
197
- "eslint-plugin-unicorn": "^46.0.0",
198
- "got": "^12.6.0",
210
+ "eslint-plugin-unicorn": "^49.0.0",
211
+ "got": "^13.0.0",
199
212
  "is-date-object": "1.0.5",
200
213
  "isomorphic-fetch": "^3.0.0",
201
- "jsdom": "^21.1.1",
214
+ "jsdom": "^23.0.1",
202
215
  "license-badger": "^0.21.1",
203
216
  "local-xmlhttprequest": "2.0.0",
204
217
  "mocha": "^10.2.0",
205
- "mocha-badge-generator": "^0.10.6",
218
+ "mocha-badge-generator": "^0.11.0",
206
219
  "mocha-multi-reporters": "^1.5.1",
207
220
  "npm-run-all": "^4.1.5",
208
221
  "open-cli": "^7.2.0",
209
- "rimraf": "^5.0.0",
210
- "rollup": "^3.21.1",
222
+ "rimraf": "^5.0.5",
223
+ "rollup": "^4.6.1",
211
224
  "rollup-plugin-filesize": "^10.0.0",
212
225
  "rollup-plugin-node-globals": "^1.4.0",
213
226
  "rollup-plugin-node-polyfills": "^0.2.1",
214
- "sinon": "^15.0.4",
227
+ "sinon": "^17.0.1",
215
228
  "source-map-support": "0.5.21",
216
229
  "sourcemap-transformer": "git+https://github.com/brettz9/sourcemap-transformer.git",
230
+ "typescript": "^5.3.3",
217
231
  "w3c-blob": "0.0.1",
218
- "ws": "^8.13.0"
232
+ "ws": "^8.14.2"
219
233
  }
220
234
  }
package/src/CFG.js CHANGED
@@ -1,7 +1,72 @@
1
+ /* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/147 */
2
+ /**
3
+ * @typedef {T[keyof T]} ValueOf<T>
4
+ * @template T
5
+ */
6
+ /* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/147 */
7
+
8
+ /**
9
+ * @typedef {{unlink: (path: string, cb: import('fs').NoParamCallback) => void}} FSApi
10
+ */
11
+
12
+ /**
13
+ * @typedef {{
14
+ * DEBUG: boolean,
15
+ * cacheDatabaseInstances: boolean,
16
+ * autoName: boolean,
17
+ * fullIDLSupport: boolean,
18
+ * checkOrigin: boolean,
19
+ * cursorPreloadPackSize: number,
20
+ * UnicodeIDStart: string,
21
+ * UnicodeIDContinue: string,
22
+ * registerSCA: (
23
+ * preset: import('typeson').Preset
24
+ * ) => import('typeson').Preset,
25
+ * avoidAutoShim: boolean,
26
+ * win: {
27
+ * openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) => import('websql-configurable').default
28
+ * },
29
+ * DEFAULT_DB_SIZE: number,
30
+ * useSQLiteIndexes: boolean,
31
+ * fs: FSApi,
32
+ * addNonIDBGlobals: boolean,
33
+ * replaceNonIDBGlobals: boolean,
34
+ * escapeDatabaseName: (name: string) => string,
35
+ * unescapeDatabaseName: (name: string) => string,
36
+ * databaseCharacterEscapeList: string|false,
37
+ * databaseNameLengthLimit: number|false,
38
+ * escapeNFDForDatabaseNames: boolean,
39
+ * addSQLiteExtension: boolean,
40
+ * memoryDatabase: string,
41
+ * deleteDatabaseFiles: boolean,
42
+ * databaseBasePath: string,
43
+ * sysDatabaseBasePath: string,
44
+ * sqlBusyTimeout: number,
45
+ * sqlTrace: () => void,
46
+ * sqlProfile: () => void,
47
+ * createIndexes: boolean
48
+ * }} ConfigValues
49
+ */
50
+
51
+ /**
52
+ * @typedef {ValueOf<ConfigValues>} ConfigValue
53
+ */
54
+
55
+ /** @type {{[key: string]: ConfigValue}} */
1
56
  const map = {};
2
- const CFG = {};
3
57
 
4
- [
58
+ const CFG = /** @type {ConfigValues} */ ({});
59
+
60
+ /**
61
+ * @typedef {keyof ConfigValues} KeyofConfigValues
62
+ */
63
+
64
+ /**
65
+ * @typedef {KeyofConfigValues[]} Config
66
+ */
67
+
68
+ /** @type {Config} */
69
+ ([
5
70
  // Boolean for verbose reporting
6
71
  'DEBUG', // Effectively defaults to false (ignored unless `true`)
7
72
 
@@ -121,14 +186,24 @@ const CFG = {};
121
186
  // defaults to `true`
122
187
  'addSQLiteExtension',
123
188
  // Various types of in-memory databases that can auto-delete
124
- ['memoryDatabase', (val) => {
125
- if (!(/^(?::memory:|file::memory:(\?[^#]*)?(#.*)?)?$/u).test(val)) {
126
- throw new TypeError(
127
- '`memoryDatabase` must be the empty string, ":memory:", or a ' +
128
- '"file::memory:[?queryString][#hash] URL".'
129
- );
189
+ [
190
+ 'memoryDatabase',
191
+ /**
192
+ * @param {string} val
193
+ * @throws {TypeError}
194
+ * @returns {void}
195
+ */
196
+ (val) => {
197
+ if (!(/^(?::memory:|file::memory:(\?[^#]*)?(#.*)?)?$/u).test(
198
+ /** @type {string} */ (val)
199
+ )) {
200
+ throw new TypeError(
201
+ '`memoryDatabase` must be the empty string, ":memory:", or a ' +
202
+ '"file::memory:[?queryString][#hash] URL".'
203
+ );
204
+ }
130
205
  }
131
- }],
206
+ ],
132
207
 
133
208
  // NODE-SPECIFIC CONFIG
134
209
  // Boolean on whether to delete the database file itself after
@@ -140,8 +215,11 @@ const CFG = {};
140
215
  // NODE-SPECIFIC WEBSQL CONFIG
141
216
  'sqlBusyTimeout', // Defaults to 1000
142
217
  'sqlTrace', // Callback not used by default
143
- 'sqlProfile' // Callback not used by default
144
- ].forEach((prop) => {
218
+ 'sqlProfile', // Callback not used by default
219
+
220
+ 'createIndexes'
221
+ ]).forEach((prop) => {
222
+ /** @type {(val: any) => void} */
145
223
  let validator;
146
224
  if (Array.isArray(prop)) {
147
225
  [prop, validator] = prop;