@lark-sh/client 0.1.20 → 0.1.22

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.
@@ -1665,15 +1665,14 @@ var SubscriptionManager = class {
1665
1665
  }
1666
1666
  /**
1667
1667
  * Handle an incoming event message from the server.
1668
- * Server sends 'put', 'patch', or 'vb' (volatile batch) events; we generate child_* events client-side.
1668
+ * Server sends 'put' or 'patch' events; we generate child_* events client-side.
1669
+ * Volatile events use `x: true` flag on patch events.
1669
1670
  */
1670
1671
  handleEvent(message) {
1671
1672
  if (message.ev === "put") {
1672
1673
  this.handlePutEvent(message);
1673
1674
  } else if (message.ev === "patch") {
1674
1675
  this.handlePatchEvent(message);
1675
- } else if (message.ev === "vb") {
1676
- this.handleVolatileBatchEvent(message);
1677
1676
  } else {
1678
1677
  console.warn("Unknown event type:", message.ev);
1679
1678
  }
@@ -1746,28 +1745,6 @@ var SubscriptionManager = class {
1746
1745
  this.applyServerUpdateToView(view, updates, isVolatile, serverTimestamp);
1747
1746
  }
1748
1747
  }
1749
- /**
1750
- * Handle a 'vb' (volatile batch) event - batched volatile updates across subscriptions.
1751
- * Server batches volatile events in 50ms intervals to reduce message overhead.
1752
- * Format: { ev: 'vb', b: { subscriptionPath: { relativePath: value } }, ts: timestamp }
1753
- * Dispatches to ALL Views at each subscription path.
1754
- */
1755
- handleVolatileBatchEvent(message) {
1756
- const batch = message.b;
1757
- const serverTimestamp = message.ts;
1758
- if (!batch) return;
1759
- for (const [subscriptionPath, updates] of Object.entries(batch)) {
1760
- const views = this.getViewsAtPath(subscriptionPath);
1761
- if (views.length === 0) continue;
1762
- const updatesList = [];
1763
- for (const [relativePath, value] of Object.entries(updates)) {
1764
- updatesList.push({ relativePath, value });
1765
- }
1766
- for (const view of views) {
1767
- this.applyServerUpdateToView(view, updatesList, true, serverTimestamp);
1768
- }
1769
- }
1770
- }
1771
1748
  /**
1772
1749
  * Detect and fire child_moved events for children that changed position OR sort value.
1773
1750
  *
@@ -4288,6 +4265,11 @@ var LarkDatabase = class {
4288
4265
  this._domain = options.domain || DEFAULT_LARK_DOMAIN;
4289
4266
  this._currentToken = options.token || "";
4290
4267
  this._isAnonymous = !options.token && options.anonymous !== false;
4268
+ this.subscriptionManager.initialize({
4269
+ sendSubscribe: this.sendSubscribeMessage.bind(this),
4270
+ sendUnsubscribe: this.sendUnsubscribeMessage.bind(this),
4271
+ createSnapshot: this.createSnapshot.bind(this)
4272
+ });
4291
4273
  }
4292
4274
  // ============================================
4293
4275
  // Connection State
@@ -4469,13 +4451,6 @@ var LarkDatabase = class {
4469
4451
  this._state = "authenticated";
4470
4452
  this._reconnectAttempt = 0;
4471
4453
  this.fireConnectionStateChange();
4472
- if (!isReconnect) {
4473
- this.subscriptionManager.initialize({
4474
- sendSubscribe: this.sendSubscribeMessage.bind(this),
4475
- sendUnsubscribe: this.sendUnsubscribeMessage.bind(this),
4476
- createSnapshot: this.createSnapshot.bind(this)
4477
- });
4478
- }
4479
4454
  if (isReconnect) {
4480
4455
  await this.restoreAfterReconnect();
4481
4456
  }
@@ -5346,4 +5321,4 @@ export {
5346
5321
  ServerValue,
5347
5322
  LarkDatabase
5348
5323
  };
5349
- //# sourceMappingURL=chunk-ELNTJSEE.mjs.map
5324
+ //# sourceMappingURL=chunk-T5RXZAER.mjs.map