cry-synced-db-client 0.1.97 → 0.1.99

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3682,6 +3682,10 @@ var SyncedDb = class _SyncedDb {
3682
3682
  if ((_a = this.collections.get(collection)) == null ? void 0 : _a.writeOnly) {
3683
3683
  return this.writeOnlyFindById(collection, id);
3684
3684
  }
3685
+ if (!(opts == null ? void 0 : opts.returnDeleted) && !(opts == null ? void 0 : opts.returnArchived)) {
3686
+ const memItem = this.inMemDb.getById(collection, id);
3687
+ if (memItem) return memItem;
3688
+ }
3685
3689
  if (((opts == null ? void 0 : opts.returnDeleted) || (opts == null ? void 0 : opts.returnArchived)) && this.isOnline()) {
3686
3690
  try {
3687
3691
  const serverItem = await this.connectionManager.withRestTimeout(
@@ -7353,10 +7357,7 @@ var Ebus2ProxyServerUpdateNotifier = class {
7353
7357
  this.connected = true;
7354
7358
  this.reconnectAttempt = 0;
7355
7359
  this.currentReconnectDelay = this.reconnectDelayMs;
7356
- for (const collection of this.collections) {
7357
- const channel = `db/${this.dbName}/${collection}`;
7358
- this.sendSubscribe(channel);
7359
- }
7360
+ this.sendSubscribe(`db/${this.dbName}`);
7360
7361
  this.startPingInterval();
7361
7362
  for (const callback of this.onWsConnectCallbacks) {
7362
7363
  try {
@@ -7416,7 +7417,12 @@ var Ebus2ProxyServerUpdateNotifier = class {
7416
7417
  }
7417
7418
  }
7418
7419
  handleChannelMessage(message) {
7419
- if (!message.channel.startsWith("db/")) {
7420
+ const prefix = `db/${this.dbName}/`;
7421
+ if (!message.channel.startsWith(prefix)) {
7422
+ return;
7423
+ }
7424
+ const collection = message.channel.slice(prefix.length);
7425
+ if (!this.collections.includes(collection)) {
7420
7426
  return;
7421
7427
  }
7422
7428
  const payload = message.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.97",
3
+ "version": "0.1.99",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",