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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.0.1-beta.
|
|
11
|
+
* Version 4.0.1-beta.31, Thu Mar 09 2023
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -151,9 +151,6 @@ function __asyncValues(o) {
|
|
|
151
151
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
//@ts-check
|
|
155
|
-
const randomFillSync = crypto.getRandomValues.bind(crypto);
|
|
156
|
-
|
|
157
154
|
function assert(b) {
|
|
158
155
|
if (!b)
|
|
159
156
|
throw new Error('Assertion Failed');
|
|
@@ -214,17 +211,22 @@ function setByKeyPath(obj, keyPath, value) {
|
|
|
214
211
|
}
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
const randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes) => {
|
|
214
|
+
const randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes, randomFill = crypto.getRandomValues.bind(crypto)) => {
|
|
218
215
|
// Web
|
|
219
216
|
const buf = new Uint8Array(bytes);
|
|
220
|
-
|
|
221
|
-
return btoa(String.fromCharCode.apply(null, buf));
|
|
222
|
-
} : typeof Buffer !== 'undefined' ? (bytes) => {
|
|
217
|
+
randomFill(buf);
|
|
218
|
+
return self.btoa(String.fromCharCode.apply(null, buf));
|
|
219
|
+
} : typeof Buffer !== 'undefined' ? (bytes, randomFill = simpleRandomFill) => {
|
|
223
220
|
// Node
|
|
224
221
|
const buf = Buffer.alloc(bytes);
|
|
225
|
-
|
|
222
|
+
randomFill(buf);
|
|
226
223
|
return buf.toString("base64");
|
|
227
224
|
} : () => { throw new Error("No implementation of randomString was found"); };
|
|
225
|
+
function simpleRandomFill(buf) {
|
|
226
|
+
for (let i = 0; i < buf.length; ++i) {
|
|
227
|
+
buf[i] = Math.floor(Math.random() * 256);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
228
230
|
|
|
229
231
|
/** Verifies that given primary key is valid.
|
|
230
232
|
* The reason we narrow validity for valid keys are twofold:
|
|
@@ -388,9 +390,10 @@ changesToSubtract // additional mutations on client during syncWithServer()
|
|
|
388
390
|
* @param inSet
|
|
389
391
|
* @returns DBOperationsSet representing inSet
|
|
390
392
|
*/
|
|
391
|
-
function toDBOperationSet(inSet) {
|
|
393
|
+
function toDBOperationSet(inSet, txid = "") {
|
|
392
394
|
// Fictive transaction:
|
|
393
|
-
|
|
395
|
+
if (!txid)
|
|
396
|
+
txid = randomString$1(16);
|
|
394
397
|
// Convert data into a temporary map to collect mutations of same table and type
|
|
395
398
|
const map = {};
|
|
396
399
|
for (const [table, ops] of Object.entries(inSet)) {
|
|
@@ -2529,7 +2532,7 @@ try {
|
|
|
2529
2532
|
catch (_a) { }
|
|
2530
2533
|
|
|
2531
2534
|
const swHolder = {};
|
|
2532
|
-
const swContainer = self.document && navigator.serviceWorker; // self.document is to verify we're not the SW ourself
|
|
2535
|
+
const swContainer = typeof self !== undefined && self.document && navigator.serviceWorker; // self.document is to verify we're not the SW ourself
|
|
2533
2536
|
if (swContainer)
|
|
2534
2537
|
swContainer.ready.then((registration) => (swHolder.registration = registration));
|
|
2535
2538
|
if (typeof self !== 'undefined' && 'clients' in self && !self.document) {
|
|
@@ -2563,7 +2566,7 @@ class SWBroadcastChannel {
|
|
|
2563
2566
|
// We're a service worker. Propagate to our browser clients.
|
|
2564
2567
|
[...self['clients'].matchAll({ includeUncontrolled: true })].forEach((client) => client.postMessage({
|
|
2565
2568
|
type: `sw-broadcast-${this.name}`,
|
|
2566
|
-
message
|
|
2569
|
+
message,
|
|
2567
2570
|
}));
|
|
2568
2571
|
}
|
|
2569
2572
|
else if (swHolder.registration) {
|
|
@@ -2571,7 +2574,7 @@ class SWBroadcastChannel {
|
|
|
2571
2574
|
// Post to SW so it can repost to all its clients and to itself
|
|
2572
2575
|
(_a = swHolder.registration.active) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
2573
2576
|
type: `sw-broadcast-${this.name}`,
|
|
2574
|
-
message
|
|
2577
|
+
message,
|
|
2575
2578
|
});
|
|
2576
2579
|
}
|
|
2577
2580
|
}
|
|
@@ -3180,7 +3183,7 @@ const builtin = {
|
|
|
3180
3183
|
...MapDef,
|
|
3181
3184
|
...TypedArraysDefs,
|
|
3182
3185
|
...ArrayBufferDef,
|
|
3183
|
-
...BlobDef,
|
|
3186
|
+
...BlobDef, // Should be moved to another preset for DOM types (or universal? since it supports node as well with FakeBlob)
|
|
3184
3187
|
};
|
|
3185
3188
|
|
|
3186
3189
|
function Bison(...typeDefsInputs) {
|
|
@@ -5935,7 +5938,7 @@ function dexieCloud(dexie) {
|
|
|
5935
5938
|
currentUserEmitter.next(UNAUTHORIZED_USER);
|
|
5936
5939
|
});
|
|
5937
5940
|
dexie.cloud = {
|
|
5938
|
-
version: '4.0.1-beta.
|
|
5941
|
+
version: '4.0.1-beta.31',
|
|
5939
5942
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
5940
5943
|
schema: null,
|
|
5941
5944
|
get currentUserId() {
|
|
@@ -6190,7 +6193,7 @@ function dexieCloud(dexie) {
|
|
|
6190
6193
|
});
|
|
6191
6194
|
}
|
|
6192
6195
|
}
|
|
6193
|
-
dexieCloud.version = '4.0.1-beta.
|
|
6196
|
+
dexieCloud.version = '4.0.1-beta.31';
|
|
6194
6197
|
Dexie.Cloud = dexieCloud;
|
|
6195
6198
|
|
|
6196
6199
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };
|