dexie-cloud-addon 4.0.1-beta.27 → 4.0.1-beta.30
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 +17 -14
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +2 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +16 -13
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +2 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/module-es5/dexie-cloud-addon.js +27 -20
- package/dist/module-es5/dexie-cloud-addon.js.map +1 -1
- package/dist/module-es5/dexie-cloud-addon.min.js +2 -1
- package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.js +27 -20
- 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 +16 -13
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +2 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/dist/umd-modern/dexie-cloud-addon.js +14 -11
- package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js +2 -0
- package/dist/umd-modern/dexie-cloud-addon.min.js.map +1 -0
- package/package.json +42 -15
|
@@ -158,9 +158,6 @@
|
|
|
158
158
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
//@ts-check
|
|
162
|
-
const randomFillSync = crypto.getRandomValues.bind(crypto);
|
|
163
|
-
|
|
164
161
|
function assert(b) {
|
|
165
162
|
if (!b)
|
|
166
163
|
throw new Error('Assertion Failed');
|
|
@@ -221,17 +218,22 @@
|
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
}
|
|
224
|
-
const randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes) => {
|
|
221
|
+
const randomString$1 = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes, randomFill = crypto.getRandomValues.bind(crypto)) => {
|
|
225
222
|
// Web
|
|
226
223
|
const buf = new Uint8Array(bytes);
|
|
227
|
-
|
|
228
|
-
return btoa(String.fromCharCode.apply(null, buf));
|
|
229
|
-
} : typeof Buffer !== 'undefined' ? (bytes) => {
|
|
224
|
+
randomFill(buf);
|
|
225
|
+
return self.btoa(String.fromCharCode.apply(null, buf));
|
|
226
|
+
} : typeof Buffer !== 'undefined' ? (bytes, randomFill = simpleRandomFill) => {
|
|
230
227
|
// Node
|
|
231
228
|
const buf = Buffer.alloc(bytes);
|
|
232
|
-
|
|
229
|
+
randomFill(buf);
|
|
233
230
|
return buf.toString("base64");
|
|
234
231
|
} : () => { throw new Error("No implementation of randomString was found"); };
|
|
232
|
+
function simpleRandomFill(buf) {
|
|
233
|
+
for (let i = 0; i < buf.length; ++i) {
|
|
234
|
+
buf[i] = Math.floor(Math.random() * 256);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
235
237
|
|
|
236
238
|
/** Verifies that given primary key is valid.
|
|
237
239
|
* The reason we narrow validity for valid keys are twofold:
|
|
@@ -395,9 +397,10 @@
|
|
|
395
397
|
* @param inSet
|
|
396
398
|
* @returns DBOperationsSet representing inSet
|
|
397
399
|
*/
|
|
398
|
-
function toDBOperationSet(inSet) {
|
|
400
|
+
function toDBOperationSet(inSet, txid = "") {
|
|
399
401
|
// Fictive transaction:
|
|
400
|
-
|
|
402
|
+
if (!txid)
|
|
403
|
+
txid = randomString$1(16);
|
|
401
404
|
// Convert data into a temporary map to collect mutations of same table and type
|
|
402
405
|
const map = {};
|
|
403
406
|
for (const [table, ops] of Object.entries(inSet)) {
|
|
@@ -3187,7 +3190,7 @@
|
|
|
3187
3190
|
...MapDef,
|
|
3188
3191
|
...TypedArraysDefs,
|
|
3189
3192
|
...ArrayBufferDef,
|
|
3190
|
-
...BlobDef,
|
|
3193
|
+
...BlobDef, // Should be moved to another preset for DOM types (or universal? since it supports node as well with FakeBlob)
|
|
3191
3194
|
};
|
|
3192
3195
|
|
|
3193
3196
|
function Bison(...typeDefsInputs) {
|