Skip to content

Commit 3d238a4

Browse files
dfahlanderDavid Fahlander
and
David Fahlander
authored
Fix issues #2103 and #2113 (#2119)
* Fix issues #2103 and #2113 * Allow tagging released version as canary --------- Co-authored-by: David Fahlander <[email protected]>
1 parent 7e6b5e6 commit 3d238a4

File tree

14 files changed

+304
-240
lines changed

14 files changed

+304
-240
lines changed

Diff for: addons/dexie-cloud/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dexie-cloud-addon",
3-
"version": "4.0.8",
3+
"version": "4.0.11",
44
"description": "Dexie addon that syncs with to Dexie Cloud",
55
"main": "dist/umd/dexie-cloud-addon.js",
66
"type": "module",
@@ -95,6 +95,6 @@
9595
"rxjs": "^7.x"
9696
},
9797
"peerDependencies": {
98-
"dexie": "^4.0.1"
98+
"dexie": "workspace:^"
9999
}
100100
}

Diff for: addons/dexie-cloud/src/TSON.ts

+38-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TypesonSimplified } from 'dreambase-library/dist/typeson-simplified/TypesonSimplified';
2-
import { Bison } from "dreambase-library/dist/typeson-simplified/Bison";
2+
import { Bison } from 'dreambase-library/dist/typeson-simplified/Bison';
33
import undefinedDef from 'dreambase-library/dist/typeson-simplified/types/undefined.js';
44
import tsonBuiltinDefs from 'dreambase-library/dist/typeson-simplified/presets/builtin.js';
55
import { TypeDefSet } from 'dreambase-library/dist/typeson-simplified/TypeDefSet';
@@ -20,7 +20,8 @@ import { PropModSpec, PropModification } from 'dexie';
2020
// serverRev.rev = bigIntDef.bigint.revive(server.rev)
2121
// else
2222
// serverRev.rev = new FakeBigInt(server.rev)
23-
export const hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';
23+
export const hasBigIntSupport =
24+
typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';
2425

2526
function getValueOfBigInt(x: bigint | FakeBigInt | string) {
2627
if (typeof x === 'bigint') {
@@ -33,7 +34,10 @@ function getValueOfBigInt(x: bigint | FakeBigInt | string) {
3334
}
3435
}
3536

36-
export function compareBigInts(a: bigint | FakeBigInt | string, b:bigint | FakeBigInt | string) {
37+
export function compareBigInts(
38+
a: bigint | FakeBigInt | string,
39+
b: bigint | FakeBigInt | string
40+
) {
3741
const valA = getValueOfBigInt(a);
3842
const valB = getValueOfBigInt(b);
3943
return valA < valB ? -1 : valA > valB ? 1 : 0;
@@ -48,42 +52,40 @@ export class FakeBigInt {
4852
}
4953
}
5054

51-
const defs: TypeDefSet = {
52-
...undefinedDef,
53-
...(hasBigIntSupport
54-
? {}
55-
: {
56-
bigint: {
57-
test: (val: any) => val instanceof FakeBigInt,
58-
replace: (fakeBigInt: any) => {
59-
return {
60-
$t: 'bigint',
61-
...fakeBigInt
62-
};
63-
},
64-
revive: ({
65-
v,
66-
}: {
67-
$t: 'bigint';
68-
v: string;
69-
}) => new FakeBigInt(v) as any as bigint
70-
}
71-
}),
72-
PropModification: {
73-
test: (val: any) => val instanceof PropModification,
74-
replace: (propModification: any) => {
55+
const bigIntDef = hasBigIntSupport
56+
? {}
57+
: {
58+
bigint: {
59+
test: (val: any) => val instanceof FakeBigInt,
60+
replace: (fakeBigInt: any) => {
7561
return {
76-
$t: 'PropModification',
77-
...propModification
62+
$t: 'bigint',
63+
...fakeBigInt,
7864
};
7965
},
80-
revive: ({
81-
$t,
82-
...propModification
83-
}: {
84-
$t: 'PropModification';
85-
} & PropModSpec) => new PropModification(propModification)
86-
}
66+
revive: ({ v }: { $t: 'bigint'; v: string }) =>
67+
new FakeBigInt(v) as any as bigint,
68+
},
69+
};
70+
71+
const defs: TypeDefSet = {
72+
...undefinedDef,
73+
...bigIntDef,
74+
PropModification: {
75+
test: (val: any) => val instanceof PropModification,
76+
replace: (propModification: any) => {
77+
return {
78+
$t: 'PropModification',
79+
...propModification['@@propmod'],
80+
};
81+
},
82+
revive: ({
83+
$t, // strip '$t'
84+
...propModSpec // keep the rest
85+
}: {
86+
$t: 'PropModification';
87+
} & PropModSpec) => new PropModification(propModSpec),
88+
},
8789
};
8890

8991
export const TSON = TypesonSimplified(tsonBuiltinDefs, defs);

Diff for: import-wrapper-prod.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (_Dexie.semVer !== Dexie.semVer) {
99
}
1010
const {
1111
liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Entity,
12-
PropModSymbol, PropModification, replacePrefix, add, remove } = Dexie;
12+
PropModification, replacePrefix, add, remove } = Dexie;
1313
export { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Dexie, Entity,
14-
PropModSymbol, PropModification, replacePrefix, add, remove };
14+
PropModification, replacePrefix, add, remove };
1515
export default Dexie;

Diff for: import-wrapper.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (_Dexie.semVer !== Dexie.semVer) {
88
throw new Error(`Two different versions of Dexie loaded in the same app: ${_Dexie.semVer} and ${Dexie.semVer}`);
99
}
1010
const { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Entity,
11-
PropModSymbol, PropModification, replacePrefix, add, remove } = Dexie;
11+
PropModification, replacePrefix, add, remove } = Dexie;
1212
export { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Dexie, Entity,
13-
PropModSymbol, PropModification, replacePrefix, add, remove };
13+
PropModification, replacePrefix, add, remove };
1414
export default Dexie;

Diff for: libs/dexie-react-hooks/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"homepage": "https://dexie.org",
5656
"peerDependencies": {
5757
"@types/react": ">=16",
58-
"dexie": "^3.2 || ^4.0.1",
58+
"dexie": "workspace:^",
5959
"react": ">=16"
6060
},
6161
"devDependencies": {
@@ -65,7 +65,7 @@
6565
"@types/qunit": "^2.9.6",
6666
"@types/react": "^17.0.0",
6767
"@types/react-dom": "^17.0.0",
68-
"dexie": "^3.2 || ^4.0.1",
68+
"dexie": "workspace:^",
6969
"just-build": "^0.9.24",
7070
"qunit": "^2.12.0",
7171
"react": "^17.0.1",

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dexie",
3-
"version": "4.0.10",
3+
"version": "4.0.11",
44
"description": "A Minimalistic Wrapper for IndexedDB",
55
"main": "dist/dexie.js",
66
"module": "dist/dexie.mjs",

0 commit comments

Comments
 (0)