dexie-cloud-addon 4.0.0-beta.13 → 4.0.0-beta.14

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.
@@ -1,4 +1,4 @@
1
- import { DBPermissionSet, DBRealm, DBRealmMember } from "dexie-cloud-common";
1
+ import { DBPermissionSet, DBRealm, DBRealmMember } from 'dexie-cloud-common';
2
2
  export interface Invite extends DBRealmMember {
3
3
  realm?: DBRealm & {
4
4
  permissions: DBPermissionSet;
@@ -3,6 +3,7 @@ import './extend-dexie-interface';
3
3
  export { DexieCloudTable } from './DexieCloudTable';
4
4
  export * from './getTiedRealmId';
5
5
  export { DBRealm, DBRealmMember, DBRealmRole, DBSyncedObject, DBPermissionSet, } from 'dexie-cloud-common';
6
+ export { Invite } from './Invite';
6
7
  export declare function dexieCloud(dexie: Dexie): void;
7
8
  export declare namespace dexieCloud {
8
9
  var version: string;
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('dexie'), require('rxjs')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'dexie', 'rxjs'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.DexieCloud = {}, global.Dexie, global.rxjs));
5
- }(this, (function (exports, Dexie, rxjs) { 'use strict';
5
+ })(this, (function (exports, Dexie, rxjs) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -108,7 +108,7 @@
108
108
  *
109
109
  * ==========================================================================
110
110
  *
111
- * Version 4.0.0-beta.13, Sun Dec 19 2021
111
+ * Version 4.0.0-beta.14, Mon Dec 20 2021
112
112
  *
113
113
  * https://dexie.org
114
114
  *
@@ -818,7 +818,8 @@
818
818
  for (var _i = 0; _i < arguments.length; _i++) {
819
819
  args[_i] = arguments[_i];
820
820
  }
821
- return (setTimeout).apply(void 0, __spreadArray([], __read(args)));
821
+ var delegate = timeoutProvider.delegate;
822
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
822
823
  },
823
824
  clearTimeout: function (handle) {
824
825
  return (clearTimeout)(handle);
@@ -858,23 +859,20 @@
858
859
  return new SafeSubscriber(next, error, complete);
859
860
  };
860
861
  Subscriber.prototype.next = function (value) {
861
- if (this.isStopped)
862
- ;
862
+ if (this.isStopped) ;
863
863
  else {
864
864
  this._next(value);
865
865
  }
866
866
  };
867
867
  Subscriber.prototype.error = function (err) {
868
- if (this.isStopped)
869
- ;
868
+ if (this.isStopped) ;
870
869
  else {
871
870
  this.isStopped = true;
872
871
  this._error(err);
873
872
  }
874
873
  };
875
874
  Subscriber.prototype.complete = function () {
876
- if (this.isStopped)
877
- ;
875
+ if (this.isStopped) ;
878
876
  else {
879
877
  this.isStopped = true;
880
878
  this._complete();
@@ -1329,7 +1327,8 @@
1329
1327
  for (var _i = 0; _i < arguments.length; _i++) {
1330
1328
  args[_i] = arguments[_i];
1331
1329
  }
1332
- return (setInterval).apply(void 0, __spreadArray([], __read(args)));
1330
+ var delegate = intervalProvider.delegate;
1331
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval).apply(void 0, __spreadArray([], __read(args)));
1333
1332
  },
1334
1333
  clearInterval: function (handle) {
1335
1334
  return (clearInterval)(handle);
@@ -2127,7 +2126,7 @@
2127
2126
  resolve(res);
2128
2127
  }, onCancel: function () {
2129
2128
  userInteraction.next(undefined);
2130
- reject(new Dexie__default['default'].AbortError("User cancelled"));
2129
+ reject(new Dexie__default["default"].AbortError("User cancelled"));
2131
2130
  } });
2132
2131
  userInteraction.next(interactionProps);
2133
2132
  // Start subscribing for external updates to db.cloud.userInteraction, and if so, cancel this request.
@@ -3581,7 +3580,7 @@
3581
3580
  var rewrittenKey = JSON.stringify(key);
3582
3581
  mutClone.keys[keyIndex] = rewrittenKey;
3583
3582
  if (rewriteValues) {
3584
- Dexie__default['default'].setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
3583
+ Dexie__default["default"].setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
3585
3584
  }
3586
3585
  }
3587
3586
  else if (key[0] === '#') {
@@ -3594,7 +3593,7 @@
3594
3593
  var rewrittenKey = "".concat(key, ":").concat(currentUser.userId);
3595
3594
  mutClone.keys[keyIndex] = rewrittenKey;
3596
3595
  if (rewriteValues) {
3597
- Dexie__default['default'].setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
3596
+ Dexie__default["default"].setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
3598
3597
  }
3599
3598
  }
3600
3599
  });
@@ -3744,7 +3743,7 @@
3744
3743
  }
3745
3744
  function throwIfCancelled(cancelToken) {
3746
3745
  if (cancelToken === null || cancelToken === void 0 ? void 0 : cancelToken.cancelled)
3747
- throw new Dexie__default['default'].AbortError("Operation was cancelled");
3746
+ throw new Dexie__default["default"].AbortError("Operation was cancelled");
3748
3747
  }
3749
3748
  /* Need this because navigator.onLine seems to say "false" when it is actually online.
3750
3749
  This function relies initially on navigator.onLine but then uses online and offline events
@@ -3804,7 +3803,7 @@
3804
3803
  }
3805
3804
  }
3806
3805
  else {
3807
- Dexie__default['default'].setByKeyPath(obj, keyPath, value);
3806
+ Dexie__default["default"].setByKeyPath(obj, keyPath, value);
3808
3807
  }
3809
3808
  }
3810
3809
  resultKeys.push(key);
@@ -3827,7 +3826,7 @@
3827
3826
  return __generator$1(this, function (_g) {
3828
3827
  switch (_g.label) {
3829
3828
  case 0:
3830
- console.debug('Applying server changes', changes, Dexie__default['default'].currentTransaction);
3829
+ console.debug('Applying server changes', changes, Dexie__default["default"].currentTransaction);
3831
3830
  _loop_3 = function (tableName, muts) {
3832
3831
  var table, primaryKey, keyDecoder, _loop_4, _h, muts_2, mut;
3833
3832
  return __generator$1(this, function (_j) {
@@ -3882,7 +3881,7 @@
3882
3881
  case 3:
3883
3882
  keys.forEach(function (key, i) {
3884
3883
  // Make sure inbound keys are consistent
3885
- Dexie__default['default'].setByKeyPath(mut.values[i], primaryKey.keyPath, key);
3884
+ Dexie__default["default"].setByKeyPath(mut.values[i], primaryKey.keyPath, key);
3886
3885
  });
3887
3886
  return [4 /*yield*/, table.bulkAdd(mut.values)];
3888
3887
  case 4:
@@ -3898,7 +3897,7 @@
3898
3897
  case 8:
3899
3898
  keys.forEach(function (key, i) {
3900
3899
  // Make sure inbound keys are consistent
3901
- Dexie__default['default'].setByKeyPath(mut.values[i], primaryKey.keyPath, key);
3900
+ Dexie__default["default"].setByKeyPath(mut.values[i], primaryKey.keyPath, key);
3902
3901
  });
3903
3902
  return [4 /*yield*/, table.bulkPut(mut.values)];
3904
3903
  case 9:
@@ -4570,7 +4569,7 @@
4570
4569
  }
4571
4570
  return [2 /*return*/]; // Ignore message
4572
4571
  }
4573
- return [4 /*yield*/, Dexie__default['default'].waitFor(
4572
+ return [4 /*yield*/, Dexie__default["default"].waitFor(
4574
4573
  // Keep TX in non-IDB work
4575
4574
  computeRealmSetHash(syncState))];
4576
4575
  case 2:
@@ -4777,7 +4776,7 @@
4777
4776
  }
4778
4777
  var IS_SERVICE_WORKER = typeof self !== "undefined" && "clients" in self && !self.document;
4779
4778
  function throwVersionIncrementNeeded() {
4780
- throw new Dexie__default['default'].SchemaError("Version increment needed to allow dexie-cloud change tracking");
4779
+ throw new Dexie__default["default"].SchemaError("Version increment needed to allow dexie-cloud change tracking");
4781
4780
  }
4782
4781
  var toString = {}.toString;
4783
4782
  function toStringTag(o) {
@@ -4891,14 +4890,14 @@
4891
4890
  if (!table.schema.primaryKey.outbound) {
4892
4891
  if (!valueClones)
4893
4892
  valueClones = req.values.slice();
4894
- valueClones[idx] = Dexie__default['default'].deepClone(valueClones[idx]);
4895
- Dexie__default['default'].setByKeyPath(valueClones[idx], table.schema.primaryKey.keyPath, keys[idx]);
4893
+ valueClones[idx] = Dexie__default["default"].deepClone(valueClones[idx]);
4894
+ Dexie__default["default"].setByKeyPath(valueClones[idx], table.schema.primaryKey.keyPath, keys[idx]);
4896
4895
  }
4897
4896
  }
4898
4897
  else if (typeof key !== 'string' ||
4899
4898
  (!key.startsWith(idPrefix) && !key.startsWith('#' + idPrefix))) {
4900
4899
  // Key was specified by caller. Verify it complies with id prefix.
4901
- throw new Dexie__default['default'].ConstraintError("The ID \"".concat(key, "\" is not valid for table \"").concat(tableName, "\". ") +
4900
+ throw new Dexie__default["default"].ConstraintError("The ID \"".concat(key, "\" is not valid for table \"").concat(tableName, "\". ") +
4902
4901
  "Primary '@' keys requires the key to be prefixed with \"".concat(idPrefix, "\" (or \"#").concat(idPrefix, ").\n") +
4903
4902
  "If you want to generate IDs programmatically, remove '@' from the schema to get rid of this constraint. Dexie Cloud supports custom IDs as long as they are random and globally unique.");
4904
4903
  }
@@ -4923,7 +4922,7 @@
4923
4922
  var type = Array.isArray(key)
4924
4923
  ? key.map(toStringTag).join(',')
4925
4924
  : toStringTag(key);
4926
- throw new Dexie__default['default'].ConstraintError("Invalid primary key type ".concat(type, " for table ").concat(tableName, ". Tables marked for sync has primary keys of type string or Array of string (and optional numbers)"));
4925
+ throw new Dexie__default["default"].ConstraintError("Invalid primary key type ".concat(type, " for table ").concat(tableName, ". Tables marked for sync has primary keys of type string or Array of string (and optional numbers)"));
4927
4926
  }
4928
4927
  });
4929
4928
  }
@@ -6027,11 +6026,11 @@
6027
6026
  var table = _h[_g];
6028
6027
  if ((_f = (_e = db.cloud.schema) === null || _e === void 0 ? void 0 : _e[table.name]) === null || _f === void 0 ? void 0 : _f.markedForSync) {
6029
6028
  if (table.schema.primKey.auto) {
6030
- throw new Dexie__default['default'].SchemaError("Table ".concat(table.name, " is both autoIncremented and synced. ") +
6029
+ throw new Dexie__default["default"].SchemaError("Table ".concat(table.name, " is both autoIncremented and synced. ") +
6031
6030
  "Use db.cloud.configure({unsyncedTables: [".concat(JSON.stringify(table.name), "]}) to blacklist it from sync"));
6032
6031
  }
6033
6032
  if (!table.schema.primKey.keyPath) {
6034
- throw new Dexie__default['default'].SchemaError("Table ".concat(table.name, " cannot be both synced and outbound. ") +
6033
+ throw new Dexie__default["default"].SchemaError("Table ".concat(table.name, " cannot be both synced and outbound. ") +
6035
6034
  "Use db.cloud.configure({unsyncedTables: [".concat(JSON.stringify(table.name), "]}) to blacklist it from sync"));
6036
6035
  }
6037
6036
  }
@@ -6205,7 +6204,7 @@
6205
6204
  }
6206
6205
  catch (l) {
6207
6206
  n = l;
6208
- } throw n; }, __v: 0 }, p$1.prototype.setState = function (n, l) { var u; u = null != this.__s && this.__s !== this.state ? this.__s : this.__s = c$1({}, this.state), "function" == typeof n && (n = n(c$1({}, u), this.props)), n && c$1(u, n), null != n && this.__v && (l && this.__h.push(l), k$1(this)); }, p$1.prototype.forceUpdate = function (n) { this.__v && (this.__e = !0, n && this.__h.push(n), k$1(this)); }, p$1.prototype.render = y, u$1 = [], i$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, b$1.__r = 0, 0;
6207
+ } throw n; }, __v: 0 }, p$1.prototype.setState = function (n, l) { var u; u = null != this.__s && this.__s !== this.state ? this.__s : this.__s = c$1({}, this.state), "function" == typeof n && (n = n(c$1({}, u), this.props)), n && c$1(u, n), null != n && this.__v && (l && this.__h.push(l), k$1(this)); }, p$1.prototype.forceUpdate = function (n) { this.__v && (this.__e = !0, n && this.__h.push(n), k$1(this)); }, p$1.prototype.render = y, u$1 = [], i$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, b$1.__r = 0;
6209
6208
  var Styles = {
6210
6209
  Error: {
6211
6210
  color: "red",
@@ -6750,7 +6749,7 @@
6750
6749
  var closed = false;
6751
6750
  function throwIfClosed() {
6752
6751
  if (closed)
6753
- throw new Dexie__default['default'].DatabaseClosedError();
6752
+ throw new Dexie__default["default"].DatabaseClosedError();
6754
6753
  }
6755
6754
  dbOnClosed(dexie, function () {
6756
6755
  subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); });
@@ -6760,7 +6759,7 @@
6760
6759
  currentUserEmitter.next(UNAUTHORIZED_USER);
6761
6760
  });
6762
6761
  dexie.cloud = {
6763
- version: '4.0.0-beta.13',
6762
+ version: '4.0.0-beta.14',
6764
6763
  options: __assign({}, DEFAULT_OPTIONS),
6765
6764
  schema: null,
6766
6765
  serverState: null,
@@ -6868,7 +6867,7 @@
6868
6867
  return permissions(dexie._novip, obj, tableName);
6869
6868
  },
6870
6869
  };
6871
- dexie.Version.prototype['_parseStoresSpec'] = Dexie__default['default'].override(dexie.Version.prototype['_parseStoresSpec'], function (origFunc) { return overrideParseStoresSpec(origFunc, dexie); });
6870
+ dexie.Version.prototype['_parseStoresSpec'] = Dexie__default["default"].override(dexie.Version.prototype['_parseStoresSpec'], function (origFunc) { return overrideParseStoresSpec(origFunc, dexie); });
6872
6871
  dexie.Table.prototype.newId = function (_e) {
6873
6872
  var _f = _e === void 0 ? {} : _e, colocateWith = _f.colocateWith;
6874
6873
  var shardKey = colocateWith && colocateWith.substr(colocateWith.length - 3);
@@ -7087,15 +7086,15 @@
7087
7086
  });
7088
7087
  }
7089
7088
  }
7090
- dexieCloud.version = '4.0.0-beta.13';
7091
- Dexie__default['default'].Cloud = dexieCloud;
7089
+ dexieCloud.version = '4.0.0-beta.14';
7090
+ Dexie__default["default"].Cloud = dexieCloud;
7092
7091
 
7093
- exports.default = dexieCloud;
7092
+ exports["default"] = dexieCloud;
7094
7093
  exports.dexieCloud = dexieCloud;
7095
7094
  exports.getTiedObjectId = getTiedObjectId;
7096
7095
  exports.getTiedRealmId = getTiedRealmId;
7097
7096
 
7098
7097
  Object.defineProperty(exports, '__esModule', { value: true });
7099
7098
 
7100
- })));
7099
+ }));
7101
7100
  //# sourceMappingURL=dexie-cloud-addon.js.map