dexie-cloud-addon 4.1.0-beta.40 → 4.1.0-beta.42
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 +54 -24
- 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 +54 -24
- 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 +5 -5
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.1.0-beta.
|
|
11
|
+
* Version 4.1.0-beta.42, Tue Feb 04 2025
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -3035,19 +3035,25 @@ function triggerSync(db, purpose) {
|
|
|
3035
3035
|
}
|
|
3036
3036
|
}
|
|
3037
3037
|
|
|
3038
|
+
const hasArrayBufferB64 = "fromBase64" in Uint8Array; // https://github.com/tc39/proposal-arraybuffer-base64;
|
|
3038
3039
|
const b64decode = typeof Buffer !== "undefined"
|
|
3039
|
-
? (base64) => Buffer.from(base64, "base64")
|
|
3040
|
-
:
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3040
|
+
? (base64) => Buffer.from(base64, "base64") // Node
|
|
3041
|
+
: hasArrayBufferB64
|
|
3042
|
+
? // @ts-ignore: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64
|
|
3043
|
+
(base64) => Uint8Array.fromBase64(base64) // Modern javascript standard
|
|
3044
|
+
: (base64) => {
|
|
3045
|
+
// Legacy DOM workaround
|
|
3046
|
+
const binary_string = atob(base64);
|
|
3047
|
+
const len = binary_string.length;
|
|
3048
|
+
const bytes = new Uint8Array(len);
|
|
3049
|
+
for (var i = 0; i < len; i++) {
|
|
3050
|
+
bytes[i] = binary_string.charCodeAt(i);
|
|
3051
|
+
}
|
|
3052
|
+
return bytes;
|
|
3053
|
+
};
|
|
3049
3054
|
const b64encode = typeof Buffer !== "undefined"
|
|
3050
3055
|
? (b) => {
|
|
3056
|
+
// Node
|
|
3051
3057
|
if (ArrayBuffer.isView(b)) {
|
|
3052
3058
|
return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64");
|
|
3053
3059
|
}
|
|
@@ -3055,16 +3061,20 @@ const b64encode = typeof Buffer !== "undefined"
|
|
|
3055
3061
|
return Buffer.from(b).toString("base64");
|
|
3056
3062
|
}
|
|
3057
3063
|
}
|
|
3058
|
-
:
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3064
|
+
: hasArrayBufferB64
|
|
3065
|
+
? // @ts-ignore https://github.com/tc39/proposal-arraybuffer-base64
|
|
3066
|
+
(b) => b.toBase64() // Modern Javascript standard
|
|
3067
|
+
: (b) => {
|
|
3068
|
+
// Legacy DOM workaround
|
|
3069
|
+
const u8a = ArrayBuffer.isView(b) ? b : new Uint8Array(b);
|
|
3070
|
+
const CHUNK_SIZE = 0x1000;
|
|
3071
|
+
const strs = [];
|
|
3072
|
+
for (let i = 0, l = u8a.length; i < l; i += CHUNK_SIZE) {
|
|
3073
|
+
const chunk = u8a.subarray(i, i + CHUNK_SIZE);
|
|
3074
|
+
strs.push(String.fromCharCode.apply(null, chunk));
|
|
3075
|
+
}
|
|
3076
|
+
return btoa(strs.join(""));
|
|
3077
|
+
};
|
|
3068
3078
|
|
|
3069
3079
|
class TokenErrorResponseError extends Error {
|
|
3070
3080
|
constructor({ title, message, messageCode, messageParams, }) {
|
|
@@ -4551,6 +4561,26 @@ var undefinedDef = {
|
|
|
4551
4561
|
},
|
|
4552
4562
|
};
|
|
4553
4563
|
|
|
4564
|
+
var FileDef = {
|
|
4565
|
+
File: {
|
|
4566
|
+
test: (file, toStringTag) => toStringTag === "File",
|
|
4567
|
+
replace: (file) => ({
|
|
4568
|
+
$t: "File",
|
|
4569
|
+
v: b64encode(string2ArrayBuffer(readBlobSync(file))),
|
|
4570
|
+
type: file.type,
|
|
4571
|
+
name: file.name,
|
|
4572
|
+
lastModified: new Date(file.lastModified).toISOString(),
|
|
4573
|
+
}),
|
|
4574
|
+
revive: ({ type, v, name, lastModified }) => {
|
|
4575
|
+
const ab = b64decode(v);
|
|
4576
|
+
return new File([ab], name, {
|
|
4577
|
+
type,
|
|
4578
|
+
lastModified: new Date(lastModified).getTime(),
|
|
4579
|
+
});
|
|
4580
|
+
},
|
|
4581
|
+
},
|
|
4582
|
+
};
|
|
4583
|
+
|
|
4554
4584
|
// Since server revisions are stored in bigints, we need to handle clients without
|
|
4555
4585
|
// bigint support to not fail when serverRevision is passed over to client.
|
|
4556
4586
|
// We need to not fail when reviving it and we need to somehow store the information.
|
|
@@ -4586,7 +4616,7 @@ const bigIntDef = hasBigIntSupport
|
|
|
4586
4616
|
revive: ({ v }) => new FakeBigInt(v),
|
|
4587
4617
|
},
|
|
4588
4618
|
};
|
|
4589
|
-
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), { PropModification: {
|
|
4619
|
+
const defs = Object.assign(Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), FileDef), { PropModification: {
|
|
4590
4620
|
test: (val) => val instanceof PropModification,
|
|
4591
4621
|
replace: (propModification) => {
|
|
4592
4622
|
return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
|
|
@@ -8321,7 +8351,7 @@ function dexieCloud(dexie) {
|
|
|
8321
8351
|
const syncComplete = new Subject();
|
|
8322
8352
|
dexie.cloud = {
|
|
8323
8353
|
// @ts-ignore
|
|
8324
|
-
version: "4.1.0-beta.
|
|
8354
|
+
version: "4.1.0-beta.42",
|
|
8325
8355
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8326
8356
|
schema: null,
|
|
8327
8357
|
get currentUserId() {
|
|
@@ -8639,7 +8669,7 @@ function dexieCloud(dexie) {
|
|
|
8639
8669
|
}
|
|
8640
8670
|
}
|
|
8641
8671
|
// @ts-ignore
|
|
8642
|
-
dexieCloud.version = "4.1.0-beta.
|
|
8672
|
+
dexieCloud.version = "4.1.0-beta.42";
|
|
8643
8673
|
Dexie.Cloud = dexieCloud;
|
|
8644
8674
|
|
|
8645
8675
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|