dexie-cloud-addon 4.0.1-beta.28 → 4.0.1-beta.31
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 +20 -17
- 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 +19 -16
- 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 +30 -23
- 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/umd/dexie-cloud-addon.js +30 -23
- 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 +19 -16
- 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 +17 -14
- package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js +1 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js.map +1 -1
- package/package.json +4 -7
|
@@ -101,7 +101,7 @@ function __spreadArray$1(to, from, pack) {
|
|
|
101
101
|
*
|
|
102
102
|
* ==========================================================================
|
|
103
103
|
*
|
|
104
|
-
* Version 4.0.1-beta.
|
|
104
|
+
* Version 4.0.1-beta.31, Thu Mar 09 2023
|
|
105
105
|
*
|
|
106
106
|
* https://dexie.org
|
|
107
107
|
*
|
|
@@ -305,8 +305,6 @@ function __asyncValues(o) {
|
|
|
305
305
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
306
306
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
307
307
|
}
|
|
308
|
-
//@ts-check
|
|
309
|
-
var randomFillSync = crypto.getRandomValues.bind(crypto);
|
|
310
308
|
function assert(b) {
|
|
311
309
|
if (!b)
|
|
312
310
|
throw new Error('Assertion Failed');
|
|
@@ -367,17 +365,24 @@ function setByKeyPath(obj, keyPath, value) {
|
|
|
367
365
|
}
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
|
-
var randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? function (bytes) {
|
|
368
|
+
var randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? function (bytes, randomFill) {
|
|
369
|
+
if (randomFill === void 0) { randomFill = crypto.getRandomValues.bind(crypto); }
|
|
371
370
|
// Web
|
|
372
371
|
var buf = new Uint8Array(bytes);
|
|
373
|
-
|
|
374
|
-
return btoa(String.fromCharCode.apply(null, buf));
|
|
375
|
-
} : typeof Buffer !== 'undefined' ? function (bytes) {
|
|
372
|
+
randomFill(buf);
|
|
373
|
+
return self.btoa(String.fromCharCode.apply(null, buf));
|
|
374
|
+
} : typeof Buffer !== 'undefined' ? function (bytes, randomFill) {
|
|
375
|
+
if (randomFill === void 0) { randomFill = simpleRandomFill; }
|
|
376
376
|
// Node
|
|
377
377
|
var buf = Buffer.alloc(bytes);
|
|
378
|
-
|
|
378
|
+
randomFill(buf);
|
|
379
379
|
return buf.toString("base64");
|
|
380
380
|
} : function () { throw new Error("No implementation of randomString was found"); };
|
|
381
|
+
function simpleRandomFill(buf) {
|
|
382
|
+
for (var i_1 = 0; i_1 < buf.length; ++i_1) {
|
|
383
|
+
buf[i_1] = Math.floor(Math.random() * 256);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
381
386
|
/** Verifies that given primary key is valid.
|
|
382
387
|
* The reason we narrow validity for valid keys are twofold:
|
|
383
388
|
* 1: Make sure to only support types that can be used as an object index in DBKeyMutationSet.
|
|
@@ -543,9 +548,11 @@ changesToSubtract // additional mutations on client during syncWithServer()
|
|
|
543
548
|
* @param inSet
|
|
544
549
|
* @returns DBOperationsSet representing inSet
|
|
545
550
|
*/
|
|
546
|
-
function toDBOperationSet(inSet) {
|
|
551
|
+
function toDBOperationSet(inSet, txid) {
|
|
552
|
+
if (txid === void 0) { txid = ""; }
|
|
547
553
|
// Fictive transaction:
|
|
548
|
-
|
|
554
|
+
if (!txid)
|
|
555
|
+
txid = randomString$1(16);
|
|
549
556
|
// Convert data into a temporary map to collect mutations of same table and type
|
|
550
557
|
var map = {};
|
|
551
558
|
for (var _k = 0, _l = Object.entries(inSet); _k < _l.length; _k++) {
|
|
@@ -2761,7 +2768,7 @@ try {
|
|
|
2761
2768
|
}
|
|
2762
2769
|
catch (_a) { }
|
|
2763
2770
|
var swHolder = {};
|
|
2764
|
-
var swContainer = self.document && navigator.serviceWorker; // self.document is to verify we're not the SW ourself
|
|
2771
|
+
var swContainer = typeof self !== undefined && self.document && navigator.serviceWorker; // self.document is to verify we're not the SW ourself
|
|
2765
2772
|
if (swContainer)
|
|
2766
2773
|
swContainer.ready.then(function (registration) { return (swHolder.registration = registration); });
|
|
2767
2774
|
if (typeof self !== 'undefined' && 'clients' in self && !self.document) {
|
|
@@ -2797,7 +2804,7 @@ var SWBroadcastChannel = /** @class */ (function () {
|
|
|
2797
2804
|
// We're a service worker. Propagate to our browser clients.
|
|
2798
2805
|
__spreadArray$1([], self['clients'].matchAll({ includeUncontrolled: true }), true).forEach(function (client) { return client.postMessage({
|
|
2799
2806
|
type: "sw-broadcast-".concat(_this_1.name),
|
|
2800
|
-
message: message
|
|
2807
|
+
message: message,
|
|
2801
2808
|
}); });
|
|
2802
2809
|
}
|
|
2803
2810
|
else if (swHolder.registration) {
|
|
@@ -2805,7 +2812,7 @@ var SWBroadcastChannel = /** @class */ (function () {
|
|
|
2805
2812
|
// Post to SW so it can repost to all its clients and to itself
|
|
2806
2813
|
(_a = swHolder.registration.active) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
2807
2814
|
type: "sw-broadcast-".concat(this.name),
|
|
2808
|
-
message: message
|
|
2815
|
+
message: message,
|
|
2809
2816
|
});
|
|
2810
2817
|
}
|
|
2811
2818
|
};
|
|
@@ -3050,10 +3057,10 @@ function getToStringTag(val) {
|
|
|
3050
3057
|
function escapeDollarProps(value) {
|
|
3051
3058
|
var keys = Object.keys(value);
|
|
3052
3059
|
var dollarKeys = null;
|
|
3053
|
-
for (var
|
|
3054
|
-
if (keys[
|
|
3060
|
+
for (var i_2 = 0, l_1 = keys.length; i_2 < l_1; ++i_2) {
|
|
3061
|
+
if (keys[i_2][0] === "$") {
|
|
3055
3062
|
dollarKeys = dollarKeys || [];
|
|
3056
|
-
dollarKeys.push(keys[
|
|
3063
|
+
dollarKeys.push(keys[i_2]);
|
|
3057
3064
|
}
|
|
3058
3065
|
}
|
|
3059
3066
|
if (!dollarKeys)
|
|
@@ -3441,8 +3448,8 @@ function readBlobSync(b) {
|
|
|
3441
3448
|
}
|
|
3442
3449
|
function string2ArrayBuffer(str) {
|
|
3443
3450
|
var array = new Uint8Array(str.length);
|
|
3444
|
-
for (var
|
|
3445
|
-
array[
|
|
3451
|
+
for (var i_3 = 0; i_3 < str.length; ++i_3) {
|
|
3452
|
+
array[i_3] = str.charCodeAt(i_3); // & 0xff;
|
|
3446
3453
|
}
|
|
3447
3454
|
return array.buffer;
|
|
3448
3455
|
}
|
|
@@ -4868,9 +4875,9 @@ function isUpperCase(ch) {
|
|
|
4868
4875
|
}
|
|
4869
4876
|
function generateTablePrefix(tableName, allPrefixes) {
|
|
4870
4877
|
var rv = tableName[0].toLocaleLowerCase(); // "users" = "usr", "friends" = "frn", "realms" = "rlm", etc.
|
|
4871
|
-
for (var
|
|
4872
|
-
if (consonants.test(tableName[
|
|
4873
|
-
rv += tableName[
|
|
4878
|
+
for (var i_4 = 1, l_2 = tableName.length; i_4 < l_2 && rv.length < 3; ++i_4) {
|
|
4879
|
+
if (consonants.test(tableName[i_4]) || isUpperCase(tableName[i_4]))
|
|
4880
|
+
rv += tableName[i_4].toLowerCase();
|
|
4874
4881
|
}
|
|
4875
4882
|
while (allPrefixes.has(rv)) {
|
|
4876
4883
|
if (/\d/g.test(rv)) {
|
|
@@ -6929,7 +6936,7 @@ function dexieCloud(dexie) {
|
|
|
6929
6936
|
currentUserEmitter.next(UNAUTHORIZED_USER);
|
|
6930
6937
|
});
|
|
6931
6938
|
dexie.cloud = {
|
|
6932
|
-
version: '4.0.1-beta.
|
|
6939
|
+
version: '4.0.1-beta.31',
|
|
6933
6940
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6934
6941
|
schema: null,
|
|
6935
6942
|
get currentUserId() {
|
|
@@ -7262,7 +7269,7 @@ function dexieCloud(dexie) {
|
|
|
7262
7269
|
});
|
|
7263
7270
|
}
|
|
7264
7271
|
}
|
|
7265
|
-
dexieCloud.version = '4.0.1-beta.
|
|
7272
|
+
dexieCloud.version = '4.0.1-beta.31';
|
|
7266
7273
|
Dexie.Cloud = dexieCloud;
|
|
7267
7274
|
|
|
7268
7275
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };
|