Skip to content

Commit 552500a

Browse files
authored
Merge pull request #2045 from dexie/support-yjs-dexie-cloud
Support yjs in dexie-cloud-addon
2 parents 3874e1b + 17a65c5 commit 552500a

File tree

116 files changed

+6060
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+6060
-646
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ jobs:
4747
- name: Run headless test
4848
uses: coactions/setup-xvfb@v1
4949
with:
50-
run: bash ./gh-actions.sh
50+
run: bash -e ./gh-actions.sh
5151
working-directory: ${{ matrix.TF }}

addons/Dexie.Observable/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@
8181
},
8282
"homepage": "https://dexie.org",
8383
"peerDependencies": {
84-
"dexie": "workspace:^3.0.2 || ^4.0.1"
84+
"dexie": "workspace:^"
8585
},
8686
"devDependencies": {
8787
"@types/node": "^18.11.18",
88-
"dexie": "workspace:^3.0.2 || ^4.0.1",
88+
"dexie": "workspace:^",
8989
"eslint": "^7.27.0",
9090
"just-build": "^0.9.24",
9191
"qunit": "^2.9.2",

addons/Dexie.Syncable/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@
7474
},
7575
"homepage": "https://dexie.org",
7676
"peerDependencies": {
77-
"dexie": "workspace:^3.0.2 || ^4.0.1",
77+
"dexie": "workspace:^",
7878
"dexie-observable": "workspace:^"
7979
},
8080
"devDependencies": {
81-
"dexie": "workspace:^3.0.2 || ^4.0.1",
81+
"dexie": "workspace:^",
8282
"dexie-observable": "workspace:^",
8383
"eslint": "^5.16.0",
8484
"just-build": "^0.9.24",

addons/dexie-cloud/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
The web client for [Dexie Cloud](https://dexie.org/cloud/).
2+
3+
## Getting started
4+
5+
```
6+
npm install dexie@latest
7+
npm install dexie-cloud-addon@latest
8+
```
9+
10+
```ts
11+
import Dexie from 'dexie';
12+
import dexieCloud from 'dexie-cloud-addon';
13+
14+
const db = new Dexie('dbname', { addons: [dexieCloud]});
15+
16+
db.version(1).stores({
17+
yourTable: '@primKeyProp, indexedProp1, indexedProp2, ...'
18+
});
19+
20+
db.cloud.configure({
21+
databaseUrl: 'https://<yourdb>.dexie.cloud'
22+
})
23+
```
24+
25+
## See also
26+
27+
https://dexie.org/cloud/docs/dexie-cloud-addon#api
28+
29+
## Obtaining a database URL
30+
31+
Run the following command in a console / terminal:
32+
33+
```
34+
npx dexie-cloud create
35+
```
36+
37+
See also https://dexie.org/cloud/#getting-started
38+
39+
*Having problems getting started, please [file an issue](https://github.com/dexie/Dexie.js/issues/new)*
40+
41+
# The Cloud Service
42+
43+
[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v2/monitor/jist.svg)](https://www.dexie-cloud-status.com)
44+
45+
The official production service for Dexie Cloud Server is forever free of charge so you do not need to install any server to get started. The free service has some limits, see https://dexie.org/cloud/pricing
46+
47+
# On-Prem version
48+
49+
Dexie Cloud Server is a closed source software that can be purchased and installed on own hardware, see [On-Prem Silver / On-Prem Gold](https://dexie.org/cloud/pricing)
50+
51+
# CLI
52+
53+
See https://dexie.org/cloud/docs/cli
54+
55+
# APIs
56+
57+
See https://dexie.org/cloud/docs/dexie-cloud-api

addons/dexie-cloud/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dexie-cloud-addon",
3-
"version": "4.0.11",
3+
"version": "4.1.0-beta.45",
44
"description": "Dexie addon that syncs with to Dexie Cloud",
55
"main": "dist/umd/dexie-cloud-addon.js",
66
"type": "module",
@@ -52,7 +52,7 @@
5252
},
5353
"scripts": {
5454
"test": "just-build test && pnpm run test-unit",
55-
"test-unit": "karma start test/unit/karma.conf.js --single-run",
55+
"test-unit": "karma start test/unit/karma.conf.cjs --single-run",
5656
"build": "rollup -c tools/build-configs/rollup.config.mjs",
5757
"watch": "rollup -c tools/build-configs/rollup.config.mjs --watch",
5858
"clean": "rm -rf tools/tmp dist test/unit/bundle.*"
@@ -78,20 +78,21 @@
7878
"@rollup/plugin-terser": "^0.4.4",
7979
"@rollup/plugin-typescript": "^11.1.5",
8080
"@types/node": "^18.11.18",
81-
"dreambase-library": "^1.0.21",
81+
"dreambase-library": "^1.0.23",
8282
"just-build": "*",
8383
"karma": "*",
8484
"karma-chrome-launcher": "*",
8585
"karma-firefox-launcher": "*",
8686
"karma-qunit": "*",
87+
"lib0": "^0.2.97",
8788
"preact": "*",
8889
"rollup": "^4.1.4",
8990
"terser": "^5.20.0",
9091
"tslib": "*",
91-
"typescript": "^5.3.3"
92+
"typescript": "^5.6.3"
9293
},
9394
"dependencies": {
94-
"dexie-cloud-common": "^1.0.31",
95+
"dexie-cloud-common": "workspace:^",
9596
"rxjs": "^7.x"
9697
},
9798
"peerDependencies": {

addons/dexie-cloud/src/DexieCloudOptions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export interface DexieCloudOptions {
2929
// not be synced with Dexie Cloud
3030
unsyncedTables?: string[];
3131

32+
unsyncedProperties?: {
33+
[tableName: string]: string[];
34+
}
35+
3236
// By default Dexie Cloud will suffix the cloud DB ID to your IndexedDB database name
3337
// in order to ensure that the local database is uniquely tied to the remote one and
3438
// will use another local database if databaseURL is changed or if dexieCloud addon
@@ -52,4 +56,6 @@ export interface DexieCloudOptions {
5256
public_key: string;
5357
hints?: { userId?: string; email?: string };
5458
}) => Promise<TokenFinalResponse>;
59+
60+
awarenessProtocol?: typeof import('y-protocols/awareness');
5561
}

addons/dexie-cloud/src/PermissionChecker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class PermissionChecker<T, TableNames extends string = TableName<T>> {
4242
// If user can update any prop in any table in this realm, return true unless
4343
// it regards to ownership change:
4444
if (this.permissions.update === '*') {
45+
// @ts-ignore
4546
return props.every((prop) => prop !== 'owner');
4647
}
4748
const tablePermissions = this.permissions.update?.[this.tableName];

addons/dexie-cloud/src/TSON.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import undefinedDef from 'dreambase-library/dist/typeson-simplified/types/undefi
44
import tsonBuiltinDefs from 'dreambase-library/dist/typeson-simplified/presets/builtin.js';
55
import { TypeDefSet } from 'dreambase-library/dist/typeson-simplified/TypeDefSet';
66
import { PropModSpec, PropModification } from 'dexie';
7+
import FileDef from "dreambase-library/dist/typeson-simplified/types/File.js";
78

89
// Since server revisions are stored in bigints, we need to handle clients without
910
// bigint support to not fail when serverRevision is passed over to client.
@@ -71,6 +72,7 @@ const bigIntDef = hasBigIntSupport
7172
const defs: TypeDefSet = {
7273
...undefinedDef,
7374
...bigIntDef,
75+
...FileDef,
7476
PropModification: {
7577
test: (val: any) => val instanceof PropModification,
7678
replace: (propModification: any) => {

0 commit comments

Comments
 (0)