dexie-cloud-addon 4.1.0-beta.41 → 4.1.0-beta.43
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 +137 -107
- 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/helpers/dbOnClosed.d.ts +2 -0
- package/dist/modern/service-worker.js +54 -24
- 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/umd/dexie-cloud-addon.js +137 -107
- 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/helpers/dbOnClosed.d.ts +2 -0
- package/dist/umd/service-worker.js +54 -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/package.json +3 -3
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.1.0-beta.
|
|
11
|
+
* Version 4.1.0-beta.43, Fri Feb 07 2025
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -1803,19 +1803,25 @@
|
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
1805
|
|
|
1806
|
+
const hasArrayBufferB64 = "fromBase64" in Uint8Array; // https://github.com/tc39/proposal-arraybuffer-base64;
|
|
1806
1807
|
const b64decode = typeof Buffer !== "undefined"
|
|
1807
|
-
? (base64) => Buffer.from(base64, "base64")
|
|
1808
|
-
:
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1808
|
+
? (base64) => Buffer.from(base64, "base64") // Node
|
|
1809
|
+
: hasArrayBufferB64
|
|
1810
|
+
? // @ts-ignore: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64
|
|
1811
|
+
(base64) => Uint8Array.fromBase64(base64) // Modern javascript standard
|
|
1812
|
+
: (base64) => {
|
|
1813
|
+
// Legacy DOM workaround
|
|
1814
|
+
const binary_string = atob(base64);
|
|
1815
|
+
const len = binary_string.length;
|
|
1816
|
+
const bytes = new Uint8Array(len);
|
|
1817
|
+
for (var i = 0; i < len; i++) {
|
|
1818
|
+
bytes[i] = binary_string.charCodeAt(i);
|
|
1819
|
+
}
|
|
1820
|
+
return bytes;
|
|
1821
|
+
};
|
|
1817
1822
|
const b64encode = typeof Buffer !== "undefined"
|
|
1818
1823
|
? (b) => {
|
|
1824
|
+
// Node
|
|
1819
1825
|
if (ArrayBuffer.isView(b)) {
|
|
1820
1826
|
return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64");
|
|
1821
1827
|
}
|
|
@@ -1823,16 +1829,20 @@
|
|
|
1823
1829
|
return Buffer.from(b).toString("base64");
|
|
1824
1830
|
}
|
|
1825
1831
|
}
|
|
1826
|
-
:
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1832
|
+
: hasArrayBufferB64
|
|
1833
|
+
? // @ts-ignore https://github.com/tc39/proposal-arraybuffer-base64
|
|
1834
|
+
(b) => b.toBase64() // Modern Javascript standard
|
|
1835
|
+
: (b) => {
|
|
1836
|
+
// Legacy DOM workaround
|
|
1837
|
+
const u8a = ArrayBuffer.isView(b) ? b : new Uint8Array(b);
|
|
1838
|
+
const CHUNK_SIZE = 0x1000;
|
|
1839
|
+
const strs = [];
|
|
1840
|
+
for (let i = 0, l = u8a.length; i < l; i += CHUNK_SIZE) {
|
|
1841
|
+
const chunk = u8a.subarray(i, i + CHUNK_SIZE);
|
|
1842
|
+
strs.push(String.fromCharCode.apply(null, chunk));
|
|
1843
|
+
}
|
|
1844
|
+
return btoa(strs.join(""));
|
|
1845
|
+
};
|
|
1836
1846
|
|
|
1837
1847
|
function computeRealmSetHash(_a) {
|
|
1838
1848
|
return __awaiter(this, arguments, void 0, function* ({ realms, inviteRealms, }) {
|
|
@@ -4238,6 +4248,26 @@
|
|
|
4238
4248
|
},
|
|
4239
4249
|
};
|
|
4240
4250
|
|
|
4251
|
+
var FileDef = {
|
|
4252
|
+
File: {
|
|
4253
|
+
test: (file, toStringTag) => toStringTag === "File",
|
|
4254
|
+
replace: (file) => ({
|
|
4255
|
+
$t: "File",
|
|
4256
|
+
v: b64encode(string2ArrayBuffer(readBlobSync(file))),
|
|
4257
|
+
type: file.type,
|
|
4258
|
+
name: file.name,
|
|
4259
|
+
lastModified: new Date(file.lastModified).toISOString(),
|
|
4260
|
+
}),
|
|
4261
|
+
revive: ({ type, v, name, lastModified }) => {
|
|
4262
|
+
const ab = b64decode(v);
|
|
4263
|
+
return new File([ab], name, {
|
|
4264
|
+
type,
|
|
4265
|
+
lastModified: new Date(lastModified).getTime(),
|
|
4266
|
+
});
|
|
4267
|
+
},
|
|
4268
|
+
},
|
|
4269
|
+
};
|
|
4270
|
+
|
|
4241
4271
|
// Since server revisions are stored in bigints, we need to handle clients without
|
|
4242
4272
|
// bigint support to not fail when serverRevision is passed over to client.
|
|
4243
4273
|
// We need to not fail when reviving it and we need to somehow store the information.
|
|
@@ -4273,7 +4303,7 @@
|
|
|
4273
4303
|
revive: ({ v }) => new FakeBigInt(v),
|
|
4274
4304
|
},
|
|
4275
4305
|
};
|
|
4276
|
-
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), { PropModification: {
|
|
4306
|
+
const defs = Object.assign(Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), FileDef), { PropModification: {
|
|
4277
4307
|
test: (val) => val instanceof Dexie.PropModification,
|
|
4278
4308
|
replace: (propModification) => {
|
|
4279
4309
|
return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
|
|
@@ -8161,7 +8191,7 @@
|
|
|
8161
8191
|
const syncComplete = new rxjs.Subject();
|
|
8162
8192
|
dexie.cloud = {
|
|
8163
8193
|
// @ts-ignore
|
|
8164
|
-
version: "4.1.0-beta.
|
|
8194
|
+
version: "4.1.0-beta.43",
|
|
8165
8195
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8166
8196
|
schema: null,
|
|
8167
8197
|
get currentUserId() {
|
|
@@ -8479,7 +8509,7 @@
|
|
|
8479
8509
|
}
|
|
8480
8510
|
}
|
|
8481
8511
|
// @ts-ignore
|
|
8482
|
-
dexieCloud.version = "4.1.0-beta.
|
|
8512
|
+
dexieCloud.version = "4.1.0-beta.43";
|
|
8483
8513
|
Dexie.Cloud = dexieCloud;
|
|
8484
8514
|
|
|
8485
8515
|
// In case the SW lives for a while, let it reuse already opened connections:
|