dexie 4.0.0-alpha.1 → 4.0.0-alpha.4

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/CONTRIBUTING.md CHANGED
@@ -4,7 +4,7 @@ HOW TO CONTRIBUTE
4
4
  We appreciate contributions in forms of:
5
5
 
6
6
  * issues
7
- * help answering questions in [issues](https://github.com/dfahlander/Dexie.js/issues) and on [stackoverflow](https://stackexchange.com/filters/233583/dexie-stackoverflow)
7
+ * help answering questions in [issues](https://github.com/dexie/Dexie.js/issues) and on [stackoverflow](https://stackexchange.com/filters/233583/dexie-stackoverflow)
8
8
  * fixing bugs via pull-requests
9
9
  * developing addons or other [derived work](https://dexie.org/docs/DerivedWork)
10
10
  * promoting Dexie.js
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Dexie.js
2
2
  ========
3
3
 
4
- [![NPM Version][npm-image]][npm-url] [![Build Status](https://travis-ci.com/dfahlander/Dexie.js.svg?branch=master)](https://travis-ci.com/dfahlander/Dexie.js)[![Tested with Browserstack](https://dexie.org/assets/images/tested-with-browserstack2.png)](https://www.browserstack.com)
4
+ [![NPM Version][npm-image]][npm-url] [![Build Status](https://travis-ci.com/dexie/Dexie.js.svg?branch=master)](https://travis-ci.com/dexie/Dexie.js)[![Tested with Browserstack](https://dexie.org/assets/images/tested-with-browserstack2.png)](https://www.browserstack.com)
5
5
 
6
6
  Dexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org
7
7
 
@@ -191,7 +191,7 @@ Samples
191
191
  -------
192
192
  https://dexie.org/docs/Samples
193
193
 
194
- https://github.com/dfahlander/Dexie.js/tree/master/samples
194
+ https://github.com/dexie/Dexie.js/tree/master/samples
195
195
 
196
196
  Knowledge Base
197
197
  -----
package/SECURITY.md CHANGED
@@ -4,14 +4,15 @@
4
4
 
5
5
  | Version | Supported | Branch
6
6
  | ------- | ------------------ | --------
7
- | 3.x | :white_check_mark: | master
7
+ | 4.x | :white_check_mark: | master
8
+ | 3.x | :white_check_mark: | master-3
8
9
  | 2.0.x | :thinking: | master-2
9
10
  | 1.5.x | :x: | master-1
10
11
  | < 1.5.1 | :x: |
11
12
 
12
13
  ## Reporting a Vulnerability
13
14
 
14
- To report a security vulnerability in Dexie.js, just file an issue in this repo.
15
+ To report a security vulnerability in Dexie.js, please send an email to code@dexie.org describing the vulnerability and how to reproduce it.
15
16
 
16
17
  If we find an issue to be regarded as a security vulnerability, we will patch and release a new version in all the supported versions as soon as possible.
17
18
  Keep in mind though that this is an uncommercial open source project which means that sometimes you might have to be the one that
package/dist/dexie.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.0-alpha.1, Sun Dec 19 2021
7
+ * Version 4.0.0-alpha.4, Tue May 31 2022
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -701,9 +701,34 @@ export interface DbEvents extends DexieEventSet {
701
701
  versionchange: DexieVersionChangeEvent;
702
702
  close: DexieCloseEvent;
703
703
  }
704
+ /** Set of mutated parts of the database
705
+ */
704
706
  export type ObservabilitySet = {
705
- // `idb:${dbName}/${tableName}/changedRowContents` - keys.
706
- // `idb:${dbName}/${tableName}/changedIndexes/${indexName}` - indexes
707
+ /** Database part having been mutated.
708
+ *
709
+ * This structure is produced in observability-middleware.ts
710
+ * and consumed in live-query.ts.
711
+ *
712
+ * Format of 'part':
713
+ *
714
+ * `idb://${dbName}/${tableName}/${indexName}`
715
+ *
716
+ * * dbName is the database name
717
+ * * tableName is the table name
718
+ * * indexName is any of:
719
+ * 1. An empty string - represents the primary keys of the affected objs
720
+ * 2. ":dels" - represents primary keys of deleted objects in the table
721
+ * 3. The keyPath of an index, such as "name", "age" or "address.city" -
722
+ * represents indexes that, if used in a query, might affect the
723
+ * result of that query.
724
+ *
725
+ * IntervalTree
726
+ * * See definition of IntervalTree type in rangeset.d.ts
727
+ * * See rangesOverlap() in rangeset.ts that can be used to compare two
728
+ * IntervalTrees and detect collissions.
729
+ * * See RangeSet class that can be used to create an IntervalTree and add
730
+ * ranges to it.
731
+ */
707
732
  [part: string]: IntervalTree;
708
733
  };
709
734
  export interface DexieOnStorageMutatedEvent {
package/dist/dexie.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.0-alpha.1, Sun Dec 19 2021
7
+ * Version 4.0.0-alpha.4, Tue May 31 2022
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -195,7 +195,7 @@
195
195
  obj[currentKeyPath] = value;
196
196
  else {
197
197
  var innerObj = obj[currentKeyPath];
198
- if (!innerObj)
198
+ if (!innerObj || !hasOwn(obj, currentKeyPath))
199
199
  innerObj = (obj[currentKeyPath] = {});
200
200
  setByKeyPath(innerObj, remainingKeyPath, value);
201
201
  }
@@ -232,7 +232,7 @@
232
232
  function flatten(a) {
233
233
  return concat.apply([], a);
234
234
  }
235
- var intrinsicTypeNames = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey"
235
+ var intrinsicTypeNames = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey"
236
236
  .split(',').concat(flatten([8, 16, 32, 64].map(function (num) { return ["Int", "Uint", "Float"].map(function (t) { return t + num + "Array"; }); }))).filter(function (t) { return _global[t]; });
237
237
  var intrinsicTypes = intrinsicTypeNames.map(function (t) { return _global[t]; });
238
238
  arrayToObject(intrinsicTypeNames, function (x) { return [x, true]; });
@@ -1300,7 +1300,7 @@
1300
1300
  }
1301
1301
  }
1302
1302
 
1303
- var DEXIE_VERSION = '4.0.0-alpha.1';
1303
+ var DEXIE_VERSION = '4.0.0-alpha.4';
1304
1304
  var maxString = String.fromCharCode(65535);
1305
1305
  var minKey = -Infinity;
1306
1306
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -5156,6 +5156,9 @@
5156
5156
 
5157
5157
  if (typeof BroadcastChannel !== 'undefined') {
5158
5158
  var bc_1 = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);
5159
+ if (typeof bc_1.unref === 'function') {
5160
+ bc_1.unref();
5161
+ }
5159
5162
  globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (changedParts) {
5160
5163
  if (!propagatingLocally) {
5161
5164
  bc_1.postMessage(changedParts);
@@ -5188,13 +5191,15 @@
5188
5191
  }
5189
5192
  catch (_a) { }
5190
5193
  });
5191
- addEventListener('storage', function (ev) {
5192
- if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {
5193
- var data = JSON.parse(ev.newValue);
5194
- if (data)
5195
- propagateLocally(data.changedParts);
5196
- }
5197
- });
5194
+ if (typeof addEventListener !== 'undefined') {
5195
+ addEventListener('storage', function (ev) {
5196
+ if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {
5197
+ var data = JSON.parse(ev.newValue);
5198
+ if (data)
5199
+ propagateLocally(data.changedParts);
5200
+ }
5201
+ });
5202
+ }
5198
5203
  var swContainer = self.document && navigator.serviceWorker;
5199
5204
  if (swContainer) {
5200
5205
  swContainer.addEventListener('message', propagateMessageLocally);