dexie-cloud-addon 4.1.0-beta.37 → 4.1.0-beta.39

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/README.md CHANGED
@@ -3,10 +3,12 @@ The web client for [Dexie Cloud](https://dexie.org/cloud/).
3
3
  ## Getting started
4
4
 
5
5
  ```
6
- npm install dexie-cloud-addon
6
+ npm install dexie@latest
7
+ npm install dexie-cloud-addon@latest
7
8
  ```
8
9
 
9
10
  ```ts
11
+ import Dexie from 'dexie';
10
12
  import dexieCloud from 'dexie-cloud-addon';
11
13
 
12
14
  const db = new Dexie('dbname', { addons: [dexieCloud]});
@@ -20,6 +22,10 @@ db.cloud.configure({
20
22
  })
21
23
  ```
22
24
 
25
+ ## See also
26
+
27
+ https://dexie.org/cloud/docs/dexie-cloud-addon#api
28
+
23
29
  ## Obtaining a database URL
24
30
 
25
31
  Run the following command in a console / terminal:
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.1.0-beta.37, Fri Dec 06 2024
11
+ * Version 4.1.0-beta.39, Mon Jan 20 2025
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -4222,7 +4222,7 @@ var numberDef = {
4222
4222
  },
4223
4223
  };
4224
4224
 
4225
- const bigIntDef = {
4225
+ const bigIntDef$1 = {
4226
4226
  bigint: {
4227
4227
  replace: (realVal) => {
4228
4228
  return { $t: "bigint", v: "" + realVal };
@@ -4465,7 +4465,7 @@ var BlobDef = {
4465
4465
 
4466
4466
  const builtin = {
4467
4467
  ...numberDef,
4468
- ...bigIntDef,
4468
+ ...bigIntDef$1,
4469
4469
  ...DateDef,
4470
4470
  ...SetDef,
4471
4471
  ...MapDef,
@@ -4575,7 +4575,7 @@ class FakeBigInt {
4575
4575
  this.v = value;
4576
4576
  }
4577
4577
  }
4578
- const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
4578
+ const bigIntDef = hasBigIntSupport
4579
4579
  ? {}
4580
4580
  : {
4581
4581
  bigint: {
@@ -4583,17 +4583,19 @@ const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBi
4583
4583
  replace: (fakeBigInt) => {
4584
4584
  return Object.assign({ $t: 'bigint' }, fakeBigInt);
4585
4585
  },
4586
- revive: ({ v, }) => new FakeBigInt(v)
4587
- }
4588
- })), { PropModification: {
4586
+ revive: ({ v }) => new FakeBigInt(v),
4587
+ },
4588
+ };
4589
+ const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), { PropModification: {
4589
4590
  test: (val) => val instanceof PropModification,
4590
4591
  replace: (propModification) => {
4591
- return Object.assign({ $t: 'PropModification' }, propModification);
4592
+ return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
4592
4593
  },
4593
4594
  revive: (_a) => {
4594
- var propModification = __rest(_a, ["$t"]);
4595
- return new PropModification(propModification);
4596
- }
4595
+ var propModSpec = __rest(_a, ["$t"]) // keep the rest
4596
+ ;
4597
+ return new PropModification(propModSpec);
4598
+ },
4597
4599
  } });
4598
4600
  const TSON = TypesonSimplified(builtin, defs);
4599
4601
  const BISON = Bison(defs);
@@ -4741,11 +4743,12 @@ function syncWithServer(changes, y, syncState, baseRevs, db, databaseUrl, schema
4741
4743
  db.syncStateChangedEvent.next({
4742
4744
  phase: 'pushing',
4743
4745
  });
4746
+ const body = TSON.stringify(syncRequest);
4744
4747
  const res = yield fetch(`${databaseUrl}/sync`, {
4745
4748
  method: 'post',
4746
4749
  headers,
4747
4750
  credentials: 'include', // For Arr Affinity cookie only, for better Rate-Limit counting only.
4748
- body: TSON.stringify(syncRequest),
4751
+ body,
4749
4752
  });
4750
4753
  //const contentLength = Number(res.headers.get('content-length'));
4751
4754
  db.syncStateChangedEvent.next({
@@ -5580,7 +5583,12 @@ function _sync(db_1, options_1, schema_1) {
5580
5583
  const usingYProps = Object.values(schema).some(tbl => { var _a; return (_a = tbl.yProps) === null || _a === void 0 ? void 0 : _a.length; });
5581
5584
  const serverSupportsYprops = !!res.yMessages;
5582
5585
  if (usingYProps && serverSupportsYprops) {
5583
- yield downloadYDocsFromServer(db, databaseUrl, newSyncState);
5586
+ try {
5587
+ yield downloadYDocsFromServer(db, databaseUrl, newSyncState);
5588
+ }
5589
+ catch (error) {
5590
+ console.error('Failed to download Yjs documents from server', error);
5591
+ }
5584
5592
  }
5585
5593
  console.debug('SYNC DONE', { isInitialSync });
5586
5594
  db.syncCompleteEvent.next();
@@ -8157,7 +8165,7 @@ function dexieCloud(dexie) {
8157
8165
  const syncComplete = new Subject();
8158
8166
  dexie.cloud = {
8159
8167
  // @ts-ignore
8160
- version: "4.1.0-beta.37",
8168
+ version: "4.1.0-beta.39",
8161
8169
  options: Object.assign({}, DEFAULT_OPTIONS),
8162
8170
  schema: null,
8163
8171
  get currentUserId() {
@@ -8475,7 +8483,7 @@ function dexieCloud(dexie) {
8475
8483
  }
8476
8484
  }
8477
8485
  // @ts-ignore
8478
- dexieCloud.version = "4.1.0-beta.37";
8486
+ dexieCloud.version = "4.1.0-beta.39";
8479
8487
  Dexie.Cloud = dexieCloud;
8480
8488
 
8481
8489
  const ydocTriggers = {};