dexie-cloud-addon 4.0.0-beta.23 → 4.0.1-beta.26
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/dist/modern/dexie-cloud-addon.js +38 -26
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +37 -25
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/module-es5/dexie-cloud-addon.js +38 -26
- package/dist/module-es5/dexie-cloud-addon.js.map +1 -1
- package/dist/module-es5/dexie-cloud-addon.min.js +1 -1
- package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -1
- package/dist/types/DexieCloudTable.d.ts +18 -2
- package/dist/types/extend-dexie-interface.d.ts +5 -3
- package/dist/types/sync/getTablesToSyncify.d.ts +1 -1
- package/dist/umd/dexie-cloud-addon.js +37 -25
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +36 -24
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/dist/umd-modern/dexie-cloud-addon.js +34 -22
- package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
- package/package.json +3 -3
- package/dist/types/DexieCloudEntity.d.ts +0 -8
- package/dist/types/DexieCloudServerState.d.ts +0 -5
- package/dist/types/WebSocketStatus.d.ts +0 -1
- package/dist/types/createMyMembersObservable.d.ts +0 -14
- package/dist/types/currentUserObservable.d.ts +0 -3
- package/dist/types/helpers/BroadcastedLocalEvent.d.ts +0 -8
- package/dist/types/helpers/visibleState.d.ts +0 -1
- package/dist/types/permissionsLookup.d.ts +0 -9
- package/dist/types/permissionsLookupObservable.d.ts +0 -14
- package/dist/types/sync/globalizePrivateIds.d.ts +0 -4
- package/dist/types/sync/syncServerToClientOnly.d.ts +0 -3
- package/dist/types/types/CloudConnectionStatus.d.ts +0 -0
- package/dist/types/types/ConnectionStatus.d.ts +0 -0
- package/dist/types/types/LoginState.d.ts +0 -41
- package/dist/types/types/SyncConnectionStatus.d.ts +0 -1
- package/dist/types/types/SyncFlowStatus.d.ts +0 -6
- package/dist/types/types/SyncStatus.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Dexie, { liveQuery, cmp } from 'dexie';
|
|
2
|
-
import { BehaviorSubject, fromEvent, of, merge, from as from$1, Observable as Observable$1, Subscription as Subscription$1, Subject, combineLatest,
|
|
2
|
+
import { BehaviorSubject, fromEvent, of, merge, from as from$1, Observable as Observable$1, Subscription as Subscription$1, Subject, combineLatest, map as map$1, share, timer as timer$1, throwError } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
5
5
|
Copyright (c) Microsoft Corporation.
|
|
@@ -101,7 +101,7 @@ function __spreadArray$1(to, from, pack) {
|
|
|
101
101
|
*
|
|
102
102
|
* ==========================================================================
|
|
103
103
|
*
|
|
104
|
-
* Version 4.0.
|
|
104
|
+
* Version 4.0.1-beta.26, Tue Jan 17 2023
|
|
105
105
|
*
|
|
106
106
|
* https://dexie.org
|
|
107
107
|
*
|
|
@@ -306,7 +306,7 @@ function __asyncValues(o) {
|
|
|
306
306
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
307
307
|
}
|
|
308
308
|
//@ts-check
|
|
309
|
-
var randomFillSync = crypto.getRandomValues;
|
|
309
|
+
var randomFillSync = crypto.getRandomValues.bind(crypto);
|
|
310
310
|
function assert(b) {
|
|
311
311
|
if (!b)
|
|
312
312
|
throw new Error('Assertion Failed');
|
|
@@ -367,17 +367,17 @@ function setByKeyPath(obj, keyPath, value) {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
var randomString$1 = typeof
|
|
371
|
-
// Node
|
|
372
|
-
var buf = Buffer.alloc(bytes);
|
|
373
|
-
randomFillSync(buf);
|
|
374
|
-
return buf.toString("base64");
|
|
375
|
-
} : function (bytes) {
|
|
370
|
+
var randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? function (bytes) {
|
|
376
371
|
// Web
|
|
377
372
|
var buf = new Uint8Array(bytes);
|
|
378
373
|
crypto.getRandomValues(buf);
|
|
379
374
|
return btoa(String.fromCharCode.apply(null, buf));
|
|
380
|
-
}
|
|
375
|
+
} : typeof Buffer !== 'undefined' ? function (bytes) {
|
|
376
|
+
// Node
|
|
377
|
+
var buf = Buffer.alloc(bytes);
|
|
378
|
+
randomFillSync(buf);
|
|
379
|
+
return buf.toString("base64");
|
|
380
|
+
} : function () { throw new Error("No implementation of randomString was found"); };
|
|
381
381
|
/** Verifies that given primary key is valid.
|
|
382
382
|
* The reason we narrow validity for valid keys are twofold:
|
|
383
383
|
* 1: Make sure to only support types that can be used as an object index in DBKeyMutationSet.
|
|
@@ -3584,7 +3584,7 @@ var undefinedDef = {
|
|
|
3584
3584
|
// serverRev.rev = bigIntDef.bigint.revive(server.rev)
|
|
3585
3585
|
// else
|
|
3586
3586
|
// serverRev.rev = new FakeBigInt(server.rev)
|
|
3587
|
-
var hasBigIntSupport = typeof BigInt(0) === 'bigint';
|
|
3587
|
+
var hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';
|
|
3588
3588
|
var FakeBigInt = /** @class */ (function () {
|
|
3589
3589
|
function FakeBigInt(value) {
|
|
3590
3590
|
this.v = value;
|
|
@@ -5045,7 +5045,7 @@ function createImplicitPropSetterMiddleware(db) {
|
|
|
5045
5045
|
// modify operations. Reason: Server may not have
|
|
5046
5046
|
// the object. Object should be created on server only
|
|
5047
5047
|
// if is being updated. An update operation won't create it
|
|
5048
|
-
// so we must delete req.changeSpec to
|
|
5048
|
+
// so we must delete req.changeSpec to degrade operation to
|
|
5049
5049
|
// an upsert operation with timestamp so that it will be created.
|
|
5050
5050
|
// We must also degrade from consistent modify operations for the
|
|
5051
5051
|
// same reason - object might be there on server. Must but put up instead.
|
|
@@ -5057,7 +5057,7 @@ function createImplicitPropSetterMiddleware(db) {
|
|
|
5057
5057
|
if (req.type === 'put') {
|
|
5058
5058
|
delete req.criteria;
|
|
5059
5059
|
delete req.changeSpec;
|
|
5060
|
-
delete req.
|
|
5060
|
+
delete req.updates;
|
|
5061
5061
|
obj.$ts = Date.now();
|
|
5062
5062
|
}
|
|
5063
5063
|
}
|
|
@@ -5259,11 +5259,10 @@ function createMutationTrackingMiddleware(_k) {
|
|
|
5259
5259
|
var hasFailures = res.numFailures, failures = res.failures;
|
|
5260
5260
|
var keys = type === 'delete' ? req.keys : res.results;
|
|
5261
5261
|
var values = 'values' in req ? req.values : [];
|
|
5262
|
-
var
|
|
5262
|
+
var updates = 'updates' in req && req.updates;
|
|
5263
5263
|
if (hasFailures) {
|
|
5264
5264
|
keys = keys.filter(function (_, idx) { return !failures[idx]; });
|
|
5265
5265
|
values = values.filter(function (_, idx) { return !failures[idx]; });
|
|
5266
|
-
changeSpecs = changeSpecs.filter(function (_, idx) { return !failures[idx]; });
|
|
5267
5266
|
}
|
|
5268
5267
|
var ts = Date.now();
|
|
5269
5268
|
var mut = req.type === 'delete'
|
|
@@ -5295,13 +5294,13 @@ function createMutationTrackingMiddleware(_k) {
|
|
|
5295
5294
|
txid: txid,
|
|
5296
5295
|
userId: userId
|
|
5297
5296
|
}
|
|
5298
|
-
:
|
|
5297
|
+
: updates
|
|
5299
5298
|
? {
|
|
5300
5299
|
// One changeSpec per key
|
|
5301
5300
|
type: 'update',
|
|
5302
5301
|
ts: ts,
|
|
5303
|
-
keys: keys,
|
|
5304
|
-
changeSpecs: changeSpecs,
|
|
5302
|
+
keys: updates.keys,
|
|
5303
|
+
changeSpecs: updates.changeSpecs,
|
|
5305
5304
|
txid: txid,
|
|
5306
5305
|
userId: userId
|
|
5307
5306
|
}
|
|
@@ -6436,13 +6435,26 @@ var LoginGui = /** @class */ (function (_super_1) {
|
|
|
6436
6435
|
return LoginGui;
|
|
6437
6436
|
}(d$1));
|
|
6438
6437
|
function setupDefaultGUI(db) {
|
|
6439
|
-
var el = document.createElement('div');
|
|
6440
|
-
document.body.appendChild(el);
|
|
6441
|
-
P(h(LoginGui, { db: db.vip }), el);
|
|
6442
6438
|
var closed = false;
|
|
6439
|
+
var el = document.createElement('div');
|
|
6440
|
+
if (document.body) {
|
|
6441
|
+
document.body.appendChild(el);
|
|
6442
|
+
P(h(LoginGui, { db: db.vip }), el);
|
|
6443
|
+
}
|
|
6444
|
+
else {
|
|
6445
|
+
addEventListener('DOMContentLoaded', function () {
|
|
6446
|
+
if (!closed) {
|
|
6447
|
+
document.body.appendChild(el);
|
|
6448
|
+
P(h(LoginGui, { db: db.vip }), el);
|
|
6449
|
+
}
|
|
6450
|
+
});
|
|
6451
|
+
}
|
|
6443
6452
|
return {
|
|
6444
6453
|
unsubscribe: function () {
|
|
6445
|
-
|
|
6454
|
+
try {
|
|
6455
|
+
el.remove();
|
|
6456
|
+
}
|
|
6457
|
+
catch (_a) { }
|
|
6446
6458
|
closed = true;
|
|
6447
6459
|
},
|
|
6448
6460
|
get closed() {
|
|
@@ -6811,10 +6823,10 @@ function permissions(dexie, obj, tableName) {
|
|
|
6811
6823
|
return o;
|
|
6812
6824
|
}
|
|
6813
6825
|
var getInvitesObservable = associate(function (db) {
|
|
6814
|
-
var membersByEmail = getCurrentUserEmitter(db._novip).pipe(switchMap
|
|
6826
|
+
var membersByEmail = getCurrentUserEmitter(db._novip).pipe(switchMap(function (currentUser) { return liveQuery(function () { return db.members.where({ email: currentUser.email || '' }).toArray(); }); }));
|
|
6815
6827
|
var permissions = getPermissionsLookupObservable(db._novip);
|
|
6816
6828
|
var accessControl = getInternalAccessControlObservable(db._novip);
|
|
6817
|
-
return createSharedValueObservable(combineLatest([membersByEmail, accessControl, permissions]).pipe(map
|
|
6829
|
+
return createSharedValueObservable(combineLatest([membersByEmail, accessControl, permissions]).pipe(map(function (_k) {
|
|
6818
6830
|
var membersByEmail = _k[0], accessControl = _k[1], realmLookup = _k[2];
|
|
6819
6831
|
var reducer = function (result, m) {
|
|
6820
6832
|
var _k;
|
|
@@ -6902,7 +6914,7 @@ function dexieCloud(dexie) {
|
|
|
6902
6914
|
currentUserEmitter.next(UNAUTHORIZED_USER);
|
|
6903
6915
|
});
|
|
6904
6916
|
dexie.cloud = {
|
|
6905
|
-
version: '4.0.
|
|
6917
|
+
version: '4.0.1-beta.26',
|
|
6906
6918
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6907
6919
|
schema: null,
|
|
6908
6920
|
get currentUserId() {
|
|
@@ -7233,7 +7245,7 @@ function dexieCloud(dexie) {
|
|
|
7233
7245
|
});
|
|
7234
7246
|
}
|
|
7235
7247
|
}
|
|
7236
|
-
dexieCloud.version = '4.0.
|
|
7248
|
+
dexieCloud.version = '4.0.1-beta.26';
|
|
7237
7249
|
Dexie.Cloud = dexieCloud;
|
|
7238
7250
|
|
|
7239
7251
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };
|