@liveblocks/server 1.1.0 → 1.1.1-pnpmtest1

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/dist/index.cjs CHANGED
@@ -891,6 +891,9 @@ var InMemoryDriver = class {
891
891
  async delete_leased_session(sessionId) {
892
892
  this._leasedSessions.delete(sessionId);
893
893
  }
894
+ takeRowsWritten() {
895
+ return 0;
896
+ }
894
897
  next_actor() {
895
898
  return ++this._nextActor;
896
899
  }
@@ -1701,7 +1704,7 @@ function stripOpId(op2) {
1701
1704
  var __socket, __debug, __lastActiveAt, __hasNotifiedClientStorageUpdateError;
1702
1705
  var BrowserSession = class {
1703
1706
  /** @internal - Never create a BrowserSession instance manually. Use the room.startBrowserSession() API instead. */
1704
- constructor(ticket, socket, debug) {
1707
+ constructor(ticket, socket, debug, createdAt) {
1705
1708
  // ^^ User-defined Session Metadata
1706
1709
  // ^^ User-defined Client Metadata (sent to client in ROOM_STATE)
1707
1710
  __publicField(this, "version");
@@ -1730,7 +1733,7 @@ var BrowserSession = class {
1730
1733
  this.publicMeta = ticket.publicMeta;
1731
1734
  __privateSet(this, __socket, socket);
1732
1735
  __privateSet(this, __debug, debug);
1733
- const now = /* @__PURE__ */ new Date();
1736
+ const now = _nullishCoalesce(createdAt, () => ( /* @__PURE__ */ new Date()));
1734
1737
  this.createdAt = now;
1735
1738
  __privateSet(this, __lastActiveAt, now);
1736
1739
  __privateSet(this, __hasNotifiedClientStorageUpdateError, false);
@@ -1973,8 +1976,13 @@ var Room = class {
1973
1976
  if (this.sessions.size > 0) {
1974
1977
  throw new Error("This API can only be called before any sessions exist");
1975
1978
  }
1976
- for (const { ticket, socket, lastActivity } of sessions) {
1977
- const newSession = new BrowserSession(ticket, socket, __privateGet(this, __debug2));
1979
+ for (const { ticket, socket, lastActivity, createdAt } of sessions) {
1980
+ const newSession = new BrowserSession(
1981
+ ticket,
1982
+ socket,
1983
+ __privateGet(this, __debug2),
1984
+ createdAt
1985
+ );
1978
1986
  this.sessions.set(ticket.sessionKey, newSession);
1979
1987
  newSession.markActive(lastActivity);
1980
1988
  }