tinybase 5.0.2 → 5.0.3

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 (42) hide show
  1. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +32 -27
  2. package/@types/synchronizers/synchronizer-ws-server/index.d.ts +32 -27
  3. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +32 -27
  4. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +32 -27
  5. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  6. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  7. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  8. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  9. package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +4 -6
  10. package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +4 -6
  11. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  12. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  13. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  14. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  15. package/cjs/synchronizers/synchronizer-ws-server/index.cjs +4 -4
  16. package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +4 -4
  17. package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  18. package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  19. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  20. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  21. package/es6/synchronizers/synchronizer-ws-server/index.js +4 -6
  22. package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
  23. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  24. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  25. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  26. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  27. package/package.json +1 -1
  28. package/readme.md +2 -2
  29. package/synchronizers/synchronizer-ws-server/index.js +4 -4
  30. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -4
  31. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  32. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  33. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  34. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  35. package/umd/es6/synchronizers/synchronizer-ws-server/index.js +4 -6
  36. package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
  37. package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  38. package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  39. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  40. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  41. package/umd/synchronizers/synchronizer-ws-server/index.js +4 -6
  42. package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
@@ -175,9 +175,9 @@ const createWsServer = (webSocketServer) => {
175
175
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
176
176
  mapSet(clients, clientId, webSocket);
177
177
  if (clients.size == 1) {
178
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
178
+ callListeners(pathIdListeners, void 0, pathId, 1);
179
179
  }
180
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
180
+ callListeners(clientIdListeners, [pathId], clientId, 1);
181
181
  webSocket.on('message', (data) => {
182
182
  const payload = data.toString(UTF8);
183
183
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -199,10 +199,10 @@ const createWsServer = (webSocketServer) => {
199
199
  });
200
200
  webSocket.on('close', () => {
201
201
  collDel(clients, clientId);
202
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: -1}));
202
+ callListeners(clientIdListeners, [pathId], clientId, -1);
203
203
  if (collIsEmpty(clients)) {
204
204
  collDel(clientsByPath, pathId);
205
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
205
+ callListeners(pathIdListeners, void 0, pathId, -1);
206
206
  }
207
207
  });
208
208
  }),
@@ -175,9 +175,9 @@ const createWsServer = (webSocketServer) => {
175
175
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
176
176
  mapSet(clients, clientId, webSocket);
177
177
  if (clients.size == 1) {
178
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
178
+ callListeners(pathIdListeners, void 0, pathId, 1);
179
179
  }
180
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
180
+ callListeners(clientIdListeners, [pathId], clientId, 1);
181
181
  webSocket.on('message', (data) => {
182
182
  const payload = data.toString(UTF8);
183
183
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -199,10 +199,10 @@ const createWsServer = (webSocketServer) => {
199
199
  });
200
200
  webSocket.on('close', () => {
201
201
  collDel(clients, clientId);
202
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: -1}));
202
+ callListeners(clientIdListeners, [pathId], clientId, -1);
203
203
  if (collIsEmpty(clients)) {
204
204
  collDel(clientsByPath, pathId);
205
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
205
+ callListeners(pathIdListeners, void 0, pathId, -1);
206
206
  }
207
207
  });
208
208
  }),
@@ -1 +1 @@
1
- const n=n=>null==n,l=(l,e,t)=>n(l)?null==t?void 0:t():e(l),e=(n,l,e)=>n.slice(l,e),t=n=>n.length,r=(n,l)=>n.forEach(l),u=(n,...l)=>n.push(...l),s=Object.freeze,o=n=>{var l;return null!=(l=null==n?void 0:n.size)?l:0},d=(a=o,n=>{return l=(n,l)=>n+a(l),c(n).reduce(l,0);var l});var a;const i=l=>n(l)||0==o(l),c=n=>{var l;return[...null!=(l=null==n?void 0:n.values())?l:[]]},v=(n,l)=>null==n?void 0:n.forEach(l),h=(n,l)=>null==n?void 0:n.delete(l),f=n=>new Map(n),g=n=>{var l;return[...null!=(l=null==n?void 0:n.keys())?l:[]]},y=(n,l)=>null==n?void 0:n.get(l),S=(l,e,t)=>n(t)?(h(l,e),l):null==l?void 0:l.set(e,t),k=(n,l,e,t)=>{var r,u,s;return u=l,null!=(s=null==(r=n)?void 0:r.has(u))&&s?null==t||t(y(n,l)):S(n,l,e()),y(n,l)},p=(n,e,r,u,s=0)=>l((r?k:y)(n,e[s],s>t(e)-2?r:f),(l=>{if(s>t(e)-2)return(null==u?void 0:u(l))&&S(n,e[s]),l;const o=p(l,e,r,u,s+1);return i(l)&&S(n,e[s]),o})),I=l=>new Set(Array.isArray(l)||n(l)?l:[l]),b=/^\d+$/,w=/\/([^?]*)/,z=a=>{const c=f(),z=f(),L=f(),[m,x,A]=(e=>{let s;const[o,d]=(()=>{const n=[];let l=0;return[e=>{var t;return null!=(t=e?n.shift():null)?t:""+l++},l=>{b.test(l)&&t(n)<1e3&&u(n,l)}]})(),a=f();return[(n,l,e,t=[],r=(()=>[]))=>{null!=s||(s=C);const u=o(1);var d,i;return S(a,u,[n,l,e,t,r]),i=u,null==(d=p(l,null!=e?e:[""],I))||d.add(i),u},(n,l,...e)=>r(((n,l=[""])=>{const e=[],s=(n,o)=>o==t(l)?u(e,n):null===l[o]?v(n,(n=>s(n,o+1))):r([l[o],null],(l=>s(y(n,l),o+1)));return s(n,0),e})(n,l),(n=>v(n,(n=>y(a,n)[0](s,...null!=l?l:[],...e))))),n=>l(y(a,n),(([,l,e])=>(p(l,null!=e?e:[""],void 0,(l=>(h(l,n),i(l)?1:0))),S(a,n),d(n),e))),e=>l(y(a,e),(([l,,e=[],u,o])=>{const d=(...a)=>{var i,c;const v=t(a);v==t(e)?l(s,...a,...o(a)):n(e[v])?r(null!=(c=null==(i=u[v])?void 0:i.call(u,...a))?c:[],(n=>d(...a,n))):d(...a,e[v])};d()}))]})();a.on("connection",((n,t)=>{var r;return l(null==(r=t.url)?void 0:r.match(w),(([,r])=>l(t.headers["sec-websocket-key"],(l=>{const t=k(L,r,f);S(t,l,n),1==t.size&&x(c,void 0,(()=>({[r]:1}))),x(z,[r],(()=>({[l]:1}))),n.on("message",(n=>{var r;const u=n.toString("utf8"),s=u.indexOf("\n");if(-1!==s){const n=e(u,0,s),d=e(u,s+1);""===n?(o=(n,e)=>n!=l?e.send(l+"\n"+d):0,v(t,((n,l)=>o(l,n)))):null==(r=y(t,n))||r.send(l+"\n"+d)}var o})),n.on("close",(()=>{h(t,l),x(z,[r],(()=>({[l]:-1}))),i(t)&&(h(L,r),x(c,void 0,(()=>({[r]:-1}))))}))}))))}));const C={getWebSocketServer:()=>a,getPathIds:()=>g(L),getClientIds:n=>g(y(L,n)),addPathIdsListener:n=>m(n,c),addClientIdsListener:(n,l)=>m(l,z,[n]),delListener:n=>(A(n),C),getStats:()=>({paths:o(L),clients:d(L)}),destroy:()=>{a.close(),L.clear()}};return s(C)};export{z as createWsServer};
1
+ const n=n=>null==n,l=(l,e,t)=>n(l)?null==t?void 0:t():e(l),e=(n,l,e)=>n.slice(l,e),t=n=>n.length,r=(n,l)=>n.forEach(l),u=(n,...l)=>n.push(...l),s=Object.freeze,o=n=>{var l;return null!=(l=null==n?void 0:n.size)?l:0},d=(a=o,n=>{return l=(n,l)=>n+a(l),c(n).reduce(l,0);var l});var a;const i=l=>n(l)||0==o(l),c=n=>{var l;return[...null!=(l=null==n?void 0:n.values())?l:[]]},v=(n,l)=>null==n?void 0:n.forEach(l),h=(n,l)=>null==n?void 0:n.delete(l),f=n=>new Map(n),g=n=>{var l;return[...null!=(l=null==n?void 0:n.keys())?l:[]]},y=(n,l)=>null==n?void 0:n.get(l),S=(l,e,t)=>n(t)?(h(l,e),l):null==l?void 0:l.set(e,t),k=(n,l,e,t)=>{var r,u,s;return u=l,null!=(s=null==(r=n)?void 0:r.has(u))&&s?null==t||t(y(n,l)):S(n,l,e()),y(n,l)},p=(n,e,r,u,s=0)=>l((r?k:y)(n,e[s],s>t(e)-2?r:f),(l=>{if(s>t(e)-2)return(null==u?void 0:u(l))&&S(n,e[s]),l;const o=p(l,e,r,u,s+1);return i(l)&&S(n,e[s]),o})),I=l=>new Set(Array.isArray(l)||n(l)?l:[l]),b=/^\d+$/,w=/\/([^?]*)/,z=a=>{const c=f(),z=f(),L=f(),[m,x,A]=(e=>{let s;const[o,d]=(()=>{const n=[];let l=0;return[e=>{var t;return null!=(t=e?n.shift():null)?t:""+l++},l=>{b.test(l)&&t(n)<1e3&&u(n,l)}]})(),a=f();return[(n,l,e,t=[],r=(()=>[]))=>{null!=s||(s=C);const u=o(1);var d,i;return S(a,u,[n,l,e,t,r]),i=u,null==(d=p(l,null!=e?e:[""],I))||d.add(i),u},(n,l,...e)=>r(((n,l=[""])=>{const e=[],s=(n,o)=>o==t(l)?u(e,n):null===l[o]?v(n,(n=>s(n,o+1))):r([l[o],null],(l=>s(y(n,l),o+1)));return s(n,0),e})(n,l),(n=>v(n,(n=>y(a,n)[0](s,...null!=l?l:[],...e))))),n=>l(y(a,n),(([,l,e])=>(p(l,null!=e?e:[""],void 0,(l=>(h(l,n),i(l)?1:0))),S(a,n),d(n),e))),e=>l(y(a,e),(([l,,e=[],u,o])=>{const d=(...a)=>{var i,c;const v=t(a);v==t(e)?l(s,...a,...o(a)):n(e[v])?r(null!=(c=null==(i=u[v])?void 0:i.call(u,...a))?c:[],(n=>d(...a,n))):d(...a,e[v])};d()}))]})();a.on("connection",((n,t)=>{var r;return l(null==(r=t.url)?void 0:r.match(w),(([,r])=>l(t.headers["sec-websocket-key"],(l=>{const t=k(L,r,f);S(t,l,n),1==t.size&&x(c,void 0,r,1),x(z,[r],l,1),n.on("message",(n=>{var r;const u=n.toString("utf8"),s=u.indexOf("\n");if(-1!==s){const n=e(u,0,s),d=e(u,s+1);""===n?(o=(n,e)=>n!=l?e.send(l+"\n"+d):0,v(t,((n,l)=>o(l,n)))):null==(r=y(t,n))||r.send(l+"\n"+d)}var o})),n.on("close",(()=>{h(t,l),x(z,[r],l,-1),i(t)&&(h(L,r),x(c,void 0,r,-1))}))}))))}));const C={getWebSocketServer:()=>a,getPathIds:()=>g(L),getClientIds:n=>g(y(L,n)),addPathIdsListener:n=>m(n,c),addClientIdsListener:(n,l)=>m(l,z,[n]),delListener:n=>(A(n),C),getStats:()=>({paths:o(L),clients:d(L)}),destroy:()=>{a.close(),L.clear()}};return s(C)};export{z as createWsServer};
@@ -1 +1 @@
1
- const n=n=>null==n,l=(l,e,t)=>n(l)?null==t?void 0:t():e(l),e=(n,l,e)=>n.slice(l,e),t=n=>n.length,r=(n,l)=>n.forEach(l),u=(n,...l)=>n.push(...l),s=Object.freeze,o=n=>{var l;return null!=(l=null==n?void 0:n.size)?l:0},d=(a=o,n=>{return l=(n,l)=>n+a(l),c(n).reduce(l,0);var l});var a;const i=l=>n(l)||0==o(l),c=n=>{var l;return[...null!=(l=null==n?void 0:n.values())?l:[]]},v=(n,l)=>null==n?void 0:n.forEach(l),h=(n,l)=>null==n?void 0:n.delete(l),f=n=>new Map(n),g=n=>{var l;return[...null!=(l=null==n?void 0:n.keys())?l:[]]},y=(n,l)=>null==n?void 0:n.get(l),S=(l,e,t)=>n(t)?(h(l,e),l):null==l?void 0:l.set(e,t),k=(n,l,e,t)=>{var r,u,s;return u=l,null!=(s=null==(r=n)?void 0:r.has(u))&&s?null==t||t(y(n,l)):S(n,l,e()),y(n,l)},p=(n,e,r,u,s=0)=>l((r?k:y)(n,e[s],s>t(e)-2?r:f),(l=>{if(s>t(e)-2)return(null==u?void 0:u(l))&&S(n,e[s]),l;const o=p(l,e,r,u,s+1);return i(l)&&S(n,e[s]),o})),I=l=>new Set(Array.isArray(l)||n(l)?l:[l]),b=/^\d+$/,w=/\/([^?]*)/,z=a=>{const c=f(),z=f(),L=f(),[m,x,A]=(e=>{let s;const[o,d]=(()=>{const n=[];let l=0;return[e=>{var t;return null!=(t=e?n.shift():null)?t:""+l++},l=>{b.test(l)&&t(n)<1e3&&u(n,l)}]})(),a=f();return[(n,l,e,t=[],r=(()=>[]))=>{null!=s||(s=C);const u=o(1);var d,i;return S(a,u,[n,l,e,t,r]),i=u,null==(d=p(l,null!=e?e:[""],I))||d.add(i),u},(n,l,...e)=>r(((n,l=[""])=>{const e=[],s=(n,o)=>o==t(l)?u(e,n):null===l[o]?v(n,(n=>s(n,o+1))):r([l[o],null],(l=>s(y(n,l),o+1)));return s(n,0),e})(n,l),(n=>v(n,(n=>y(a,n)[0](s,...null!=l?l:[],...e))))),n=>l(y(a,n),(([,l,e])=>(p(l,null!=e?e:[""],void 0,(l=>(h(l,n),i(l)?1:0))),S(a,n),d(n),e))),e=>l(y(a,e),(([l,,e=[],u,o])=>{const d=(...a)=>{var i,c;const v=t(a);v==t(e)?l(s,...a,...o(a)):n(e[v])?r(null!=(c=null==(i=u[v])?void 0:i.call(u,...a))?c:[],(n=>d(...a,n))):d(...a,e[v])};d()}))]})();a.on("connection",((n,t)=>{var r;return l(null==(r=t.url)?void 0:r.match(w),(([,r])=>l(t.headers["sec-websocket-key"],(l=>{const t=k(L,r,f);S(t,l,n),1==t.size&&x(c,void 0,(()=>({[r]:1}))),x(z,[r],(()=>({[l]:1}))),n.on("message",(n=>{var r;const u=n.toString("utf8"),s=u.indexOf("\n");if(-1!==s){const n=e(u,0,s),d=e(u,s+1);""===n?(o=(n,e)=>n!=l?e.send(l+"\n"+d):0,v(t,((n,l)=>o(l,n)))):null==(r=y(t,n))||r.send(l+"\n"+d)}var o})),n.on("close",(()=>{h(t,l),x(z,[r],(()=>({[l]:-1}))),i(t)&&(h(L,r),x(c,void 0,(()=>({[r]:-1}))))}))}))))}));const C={getWebSocketServer:()=>a,getPathIds:()=>g(L),getClientIds:n=>g(y(L,n)),addPathIdsListener:n=>m(n,c),addClientIdsListener:(n,l)=>m(l,z,[n]),delListener:n=>(A(n),C),getStats:()=>({paths:o(L),clients:d(L)}),destroy:()=>{a.close(),L.clear()}};return s(C)};export{z as createWsServer};
1
+ const n=n=>null==n,l=(l,e,t)=>n(l)?null==t?void 0:t():e(l),e=(n,l,e)=>n.slice(l,e),t=n=>n.length,r=(n,l)=>n.forEach(l),u=(n,...l)=>n.push(...l),s=Object.freeze,o=n=>{var l;return null!=(l=null==n?void 0:n.size)?l:0},d=(a=o,n=>{return l=(n,l)=>n+a(l),c(n).reduce(l,0);var l});var a;const i=l=>n(l)||0==o(l),c=n=>{var l;return[...null!=(l=null==n?void 0:n.values())?l:[]]},v=(n,l)=>null==n?void 0:n.forEach(l),h=(n,l)=>null==n?void 0:n.delete(l),f=n=>new Map(n),g=n=>{var l;return[...null!=(l=null==n?void 0:n.keys())?l:[]]},y=(n,l)=>null==n?void 0:n.get(l),S=(l,e,t)=>n(t)?(h(l,e),l):null==l?void 0:l.set(e,t),k=(n,l,e,t)=>{var r,u,s;return u=l,null!=(s=null==(r=n)?void 0:r.has(u))&&s?null==t||t(y(n,l)):S(n,l,e()),y(n,l)},p=(n,e,r,u,s=0)=>l((r?k:y)(n,e[s],s>t(e)-2?r:f),(l=>{if(s>t(e)-2)return(null==u?void 0:u(l))&&S(n,e[s]),l;const o=p(l,e,r,u,s+1);return i(l)&&S(n,e[s]),o})),I=l=>new Set(Array.isArray(l)||n(l)?l:[l]),b=/^\d+$/,w=/\/([^?]*)/,z=a=>{const c=f(),z=f(),L=f(),[m,x,A]=(e=>{let s;const[o,d]=(()=>{const n=[];let l=0;return[e=>{var t;return null!=(t=e?n.shift():null)?t:""+l++},l=>{b.test(l)&&t(n)<1e3&&u(n,l)}]})(),a=f();return[(n,l,e,t=[],r=(()=>[]))=>{null!=s||(s=C);const u=o(1);var d,i;return S(a,u,[n,l,e,t,r]),i=u,null==(d=p(l,null!=e?e:[""],I))||d.add(i),u},(n,l,...e)=>r(((n,l=[""])=>{const e=[],s=(n,o)=>o==t(l)?u(e,n):null===l[o]?v(n,(n=>s(n,o+1))):r([l[o],null],(l=>s(y(n,l),o+1)));return s(n,0),e})(n,l),(n=>v(n,(n=>y(a,n)[0](s,...null!=l?l:[],...e))))),n=>l(y(a,n),(([,l,e])=>(p(l,null!=e?e:[""],void 0,(l=>(h(l,n),i(l)?1:0))),S(a,n),d(n),e))),e=>l(y(a,e),(([l,,e=[],u,o])=>{const d=(...a)=>{var i,c;const v=t(a);v==t(e)?l(s,...a,...o(a)):n(e[v])?r(null!=(c=null==(i=u[v])?void 0:i.call(u,...a))?c:[],(n=>d(...a,n))):d(...a,e[v])};d()}))]})();a.on("connection",((n,t)=>{var r;return l(null==(r=t.url)?void 0:r.match(w),(([,r])=>l(t.headers["sec-websocket-key"],(l=>{const t=k(L,r,f);S(t,l,n),1==t.size&&x(c,void 0,r,1),x(z,[r],l,1),n.on("message",(n=>{var r;const u=n.toString("utf8"),s=u.indexOf("\n");if(-1!==s){const n=e(u,0,s),d=e(u,s+1);""===n?(o=(n,e)=>n!=l?e.send(l+"\n"+d):0,v(t,((n,l)=>o(l,n)))):null==(r=y(t,n))||r.send(l+"\n"+d)}var o})),n.on("close",(()=>{h(t,l),x(z,[r],l,-1),i(t)&&(h(L,r),x(c,void 0,r,-1))}))}))))}));const C={getWebSocketServer:()=>a,getPathIds:()=>g(L),getClientIds:n=>g(y(L,n)),addPathIdsListener:n=>m(n,c),addClientIdsListener:(n,l)=>m(l,z,[n]),delListener:n=>(A(n),C),getStats:()=>({paths:o(L),clients:d(L)}),destroy:()=>{a.close(),L.clear()}};return s(C)};export{z as createWsServer};
@@ -219,9 +219,9 @@ const createWsServer = (webSocketServer) => {
219
219
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
220
220
  mapSet(clients, clientId, webSocket);
221
221
  if (clients.size == 1) {
222
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
222
+ callListeners(pathIdListeners, void 0, pathId, 1);
223
223
  }
224
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
224
+ callListeners(clientIdListeners, [pathId], clientId, 1);
225
225
  webSocket.on('message', (data) => {
226
226
  var _a2;
227
227
  const payload = data.toString(UTF8);
@@ -244,12 +244,10 @@ const createWsServer = (webSocketServer) => {
244
244
  });
245
245
  webSocket.on('close', () => {
246
246
  collDel(clients, clientId);
247
- callListeners(clientIdListeners, [pathId], () => ({
248
- [clientId]: -1,
249
- }));
247
+ callListeners(clientIdListeners, [pathId], clientId, -1);
250
248
  if (collIsEmpty(clients)) {
251
249
  collDel(clientsByPath, pathId);
252
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
250
+ callListeners(pathIdListeners, void 0, pathId, -1);
253
251
  }
254
252
  });
255
253
  }),
@@ -219,9 +219,9 @@ const createWsServer = (webSocketServer) => {
219
219
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
220
220
  mapSet(clients, clientId, webSocket);
221
221
  if (clients.size == 1) {
222
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
222
+ callListeners(pathIdListeners, void 0, pathId, 1);
223
223
  }
224
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
224
+ callListeners(clientIdListeners, [pathId], clientId, 1);
225
225
  webSocket.on('message', (data) => {
226
226
  var _a2;
227
227
  const payload = data.toString(UTF8);
@@ -244,12 +244,10 @@ const createWsServer = (webSocketServer) => {
244
244
  });
245
245
  webSocket.on('close', () => {
246
246
  collDel(clients, clientId);
247
- callListeners(clientIdListeners, [pathId], () => ({
248
- [clientId]: -1,
249
- }));
247
+ callListeners(clientIdListeners, [pathId], clientId, -1);
250
248
  if (collIsEmpty(clients)) {
251
249
  collDel(clientsByPath, pathId);
252
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
250
+ callListeners(pathIdListeners, void 0, pathId, -1);
253
251
  }
254
252
  });
255
253
  }),
@@ -1 +1 @@
1
- const e=e=>null==e,t=(t,n,s)=>e(t)?s?.():n(t),n=(e,t,n)=>e.slice(t,n),s=e=>e.length,r=(e,t)=>e.forEach(t),o=(e,...t)=>e.push(...t),c=Object.freeze,a=e=>e?.size??0,d=(l=a,e=>{return t=(e,t)=>e+l(t),u(e).reduce(t,0);var t});var l;const i=t=>e(t)||0==a(t),u=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),f=e=>new Map(e),g=e=>[...e?.keys()??[]],y=(e,t)=>e?.get(t),S=(t,n,s)=>e(s)?(v(t,n),t):t?.set(n,s),k=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(y(e,t)):S(e,t,n()),y(e,t)},p=(e,n,r,o,c=0)=>t((r?k:y)(e,n[c],c>s(n)-2?r:f),(t=>{if(c>s(n)-2)return o?.(t)&&S(e,n[c]),t;const a=p(t,n,r,o,c+1);return i(t)&&S(e,n[c]),a})),I=t=>new Set(Array.isArray(t)||e(t)?t:[t]),b=/^\d+$/,w=/\/([^?]*)/,z=l=>{const u=f(),z=f(),L=f(),[m,x,A]=(n=>{let c;const[a,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{b.test(t)&&s(e)<1e3&&o(e,t)}]})(),l=f();return[(e,t,n,s=[],r=(()=>[]))=>{c??=C;const o=a(1);var d,i;return S(l,o,[e,t,n,s,r]),d=p(t,n??[""],I),i=o,d?.add(i),o},(e,t,...n)=>r(((e,t=[""])=>{const n=[],c=(e,a)=>a==s(t)?o(n,e):null===t[a]?h(e,(e=>c(e,a+1))):r([t[a],null],(t=>c(y(e,t),a+1)));return c(e,0),n})(e,t),(e=>h(e,(e=>y(l,e)[0](c,...t??[],...n))))),e=>t(y(l,e),(([,t,n])=>(p(t,n??[""],void 0,(t=>(v(t,e),i(t)?1:0))),S(l,e),d(e),n))),n=>t(y(l,n),(([t,,n=[],o,a])=>{const d=(...l)=>{const i=s(l);i==s(n)?t(c,...l,...a(l)):e(n[i])?r(o[i]?.(...l)??[],(e=>d(...l,e))):d(...l,n[i])};d()}))]})();l.on("connection",((e,s)=>t(s.url?.match(w),(([,r])=>t(s.headers["sec-websocket-key"],(t=>{const s=k(L,r,f);S(s,t,e),1==s.size&&x(u,void 0,(()=>({[r]:1}))),x(z,[r],(()=>({[t]:1}))),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=n(r,0,o),a=n(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+a):0,h(s,((e,t)=>c(t,e)))):y(s,e)?.send(t+"\n"+a)}var c})),e.on("close",(()=>{v(s,t),x(z,[r],(()=>({[t]:-1}))),i(s)&&(v(L,r),x(u,void 0,(()=>({[r]:-1}))))}))}))))));const C={getWebSocketServer:()=>l,getPathIds:()=>g(L),getClientIds:e=>g(y(L,e)),addPathIdsListener:e=>m(e,u),addClientIdsListener:(e,t)=>m(t,z,[e]),delListener:e=>(A(e),C),getStats:()=>({paths:a(L),clients:d(L)}),destroy:()=>{l.close(),L.clear()}};return c(C)};export{z as createWsServer};
1
+ const e=e=>null==e,t=(t,n,s)=>e(t)?s?.():n(t),n=(e,t,n)=>e.slice(t,n),s=e=>e.length,r=(e,t)=>e.forEach(t),o=(e,...t)=>e.push(...t),c=Object.freeze,a=e=>e?.size??0,d=(l=a,e=>{return t=(e,t)=>e+l(t),u(e).reduce(t,0);var t});var l;const i=t=>e(t)||0==a(t),u=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),f=e=>new Map(e),g=e=>[...e?.keys()??[]],y=(e,t)=>e?.get(t),S=(t,n,s)=>e(s)?(v(t,n),t):t?.set(n,s),k=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(y(e,t)):S(e,t,n()),y(e,t)},p=(e,n,r,o,c=0)=>t((r?k:y)(e,n[c],c>s(n)-2?r:f),(t=>{if(c>s(n)-2)return o?.(t)&&S(e,n[c]),t;const a=p(t,n,r,o,c+1);return i(t)&&S(e,n[c]),a})),I=t=>new Set(Array.isArray(t)||e(t)?t:[t]),b=/^\d+$/,w=/\/([^?]*)/,z=l=>{const u=f(),z=f(),L=f(),[m,x,A]=(n=>{let c;const[a,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{b.test(t)&&s(e)<1e3&&o(e,t)}]})(),l=f();return[(e,t,n,s=[],r=(()=>[]))=>{c??=C;const o=a(1);var d,i;return S(l,o,[e,t,n,s,r]),d=p(t,n??[""],I),i=o,d?.add(i),o},(e,t,...n)=>r(((e,t=[""])=>{const n=[],c=(e,a)=>a==s(t)?o(n,e):null===t[a]?h(e,(e=>c(e,a+1))):r([t[a],null],(t=>c(y(e,t),a+1)));return c(e,0),n})(e,t),(e=>h(e,(e=>y(l,e)[0](c,...t??[],...n))))),e=>t(y(l,e),(([,t,n])=>(p(t,n??[""],void 0,(t=>(v(t,e),i(t)?1:0))),S(l,e),d(e),n))),n=>t(y(l,n),(([t,,n=[],o,a])=>{const d=(...l)=>{const i=s(l);i==s(n)?t(c,...l,...a(l)):e(n[i])?r(o[i]?.(...l)??[],(e=>d(...l,e))):d(...l,n[i])};d()}))]})();l.on("connection",((e,s)=>t(s.url?.match(w),(([,r])=>t(s.headers["sec-websocket-key"],(t=>{const s=k(L,r,f);S(s,t,e),1==s.size&&x(u,void 0,r,1),x(z,[r],t,1),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=n(r,0,o),a=n(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+a):0,h(s,((e,t)=>c(t,e)))):y(s,e)?.send(t+"\n"+a)}var c})),e.on("close",(()=>{v(s,t),x(z,[r],t,-1),i(s)&&(v(L,r),x(u,void 0,r,-1))}))}))))));const C={getWebSocketServer:()=>l,getPathIds:()=>g(L),getClientIds:e=>g(y(L,e)),addPathIdsListener:e=>m(e,u),addClientIdsListener:(e,t)=>m(t,z,[e]),delListener:e=>(A(e),C),getStats:()=>({paths:a(L),clients:d(L)}),destroy:()=>{l.close(),L.clear()}};return c(C)};export{z as createWsServer};
@@ -1 +1 @@
1
- const e=e=>null==e,t=(t,n,s)=>e(t)?s?.():n(t),n=(e,t,n)=>e.slice(t,n),s=e=>e.length,r=(e,t)=>e.forEach(t),o=(e,...t)=>e.push(...t),c=Object.freeze,a=e=>e?.size??0,d=(l=a,e=>{return t=(e,t)=>e+l(t),u(e).reduce(t,0);var t});var l;const i=t=>e(t)||0==a(t),u=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),f=e=>new Map(e),g=e=>[...e?.keys()??[]],y=(e,t)=>e?.get(t),S=(t,n,s)=>e(s)?(v(t,n),t):t?.set(n,s),k=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(y(e,t)):S(e,t,n()),y(e,t)},p=(e,n,r,o,c=0)=>t((r?k:y)(e,n[c],c>s(n)-2?r:f),(t=>{if(c>s(n)-2)return o?.(t)&&S(e,n[c]),t;const a=p(t,n,r,o,c+1);return i(t)&&S(e,n[c]),a})),I=t=>new Set(Array.isArray(t)||e(t)?t:[t]),b=/^\d+$/,w=/\/([^?]*)/,z=l=>{const u=f(),z=f(),L=f(),[m,x,A]=(n=>{let c;const[a,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{b.test(t)&&s(e)<1e3&&o(e,t)}]})(),l=f();return[(e,t,n,s=[],r=(()=>[]))=>{c??=C;const o=a(1);var d,i;return S(l,o,[e,t,n,s,r]),d=p(t,n??[""],I),i=o,d?.add(i),o},(e,t,...n)=>r(((e,t=[""])=>{const n=[],c=(e,a)=>a==s(t)?o(n,e):null===t[a]?h(e,(e=>c(e,a+1))):r([t[a],null],(t=>c(y(e,t),a+1)));return c(e,0),n})(e,t),(e=>h(e,(e=>y(l,e)[0](c,...t??[],...n))))),e=>t(y(l,e),(([,t,n])=>(p(t,n??[""],void 0,(t=>(v(t,e),i(t)?1:0))),S(l,e),d(e),n))),n=>t(y(l,n),(([t,,n=[],o,a])=>{const d=(...l)=>{const i=s(l);i==s(n)?t(c,...l,...a(l)):e(n[i])?r(o[i]?.(...l)??[],(e=>d(...l,e))):d(...l,n[i])};d()}))]})();l.on("connection",((e,s)=>t(s.url?.match(w),(([,r])=>t(s.headers["sec-websocket-key"],(t=>{const s=k(L,r,f);S(s,t,e),1==s.size&&x(u,void 0,(()=>({[r]:1}))),x(z,[r],(()=>({[t]:1}))),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=n(r,0,o),a=n(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+a):0,h(s,((e,t)=>c(t,e)))):y(s,e)?.send(t+"\n"+a)}var c})),e.on("close",(()=>{v(s,t),x(z,[r],(()=>({[t]:-1}))),i(s)&&(v(L,r),x(u,void 0,(()=>({[r]:-1}))))}))}))))));const C={getWebSocketServer:()=>l,getPathIds:()=>g(L),getClientIds:e=>g(y(L,e)),addPathIdsListener:e=>m(e,u),addClientIdsListener:(e,t)=>m(t,z,[e]),delListener:e=>(A(e),C),getStats:()=>({paths:a(L),clients:d(L)}),destroy:()=>{l.close(),L.clear()}};return c(C)};export{z as createWsServer};
1
+ const e=e=>null==e,t=(t,n,s)=>e(t)?s?.():n(t),n=(e,t,n)=>e.slice(t,n),s=e=>e.length,r=(e,t)=>e.forEach(t),o=(e,...t)=>e.push(...t),c=Object.freeze,a=e=>e?.size??0,d=(l=a,e=>{return t=(e,t)=>e+l(t),u(e).reduce(t,0);var t});var l;const i=t=>e(t)||0==a(t),u=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),f=e=>new Map(e),g=e=>[...e?.keys()??[]],y=(e,t)=>e?.get(t),S=(t,n,s)=>e(s)?(v(t,n),t):t?.set(n,s),k=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(y(e,t)):S(e,t,n()),y(e,t)},p=(e,n,r,o,c=0)=>t((r?k:y)(e,n[c],c>s(n)-2?r:f),(t=>{if(c>s(n)-2)return o?.(t)&&S(e,n[c]),t;const a=p(t,n,r,o,c+1);return i(t)&&S(e,n[c]),a})),I=t=>new Set(Array.isArray(t)||e(t)?t:[t]),b=/^\d+$/,w=/\/([^?]*)/,z=l=>{const u=f(),z=f(),L=f(),[m,x,A]=(n=>{let c;const[a,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{b.test(t)&&s(e)<1e3&&o(e,t)}]})(),l=f();return[(e,t,n,s=[],r=(()=>[]))=>{c??=C;const o=a(1);var d,i;return S(l,o,[e,t,n,s,r]),d=p(t,n??[""],I),i=o,d?.add(i),o},(e,t,...n)=>r(((e,t=[""])=>{const n=[],c=(e,a)=>a==s(t)?o(n,e):null===t[a]?h(e,(e=>c(e,a+1))):r([t[a],null],(t=>c(y(e,t),a+1)));return c(e,0),n})(e,t),(e=>h(e,(e=>y(l,e)[0](c,...t??[],...n))))),e=>t(y(l,e),(([,t,n])=>(p(t,n??[""],void 0,(t=>(v(t,e),i(t)?1:0))),S(l,e),d(e),n))),n=>t(y(l,n),(([t,,n=[],o,a])=>{const d=(...l)=>{const i=s(l);i==s(n)?t(c,...l,...a(l)):e(n[i])?r(o[i]?.(...l)??[],(e=>d(...l,e))):d(...l,n[i])};d()}))]})();l.on("connection",((e,s)=>t(s.url?.match(w),(([,r])=>t(s.headers["sec-websocket-key"],(t=>{const s=k(L,r,f);S(s,t,e),1==s.size&&x(u,void 0,r,1),x(z,[r],t,1),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=n(r,0,o),a=n(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+a):0,h(s,((e,t)=>c(t,e)))):y(s,e)?.send(t+"\n"+a)}var c})),e.on("close",(()=>{v(s,t),x(z,[r],t,-1),i(s)&&(v(L,r),x(u,void 0,r,-1))}))}))))));const C={getWebSocketServer:()=>l,getPathIds:()=>g(L),getClientIds:e=>g(y(L,e)),addPathIdsListener:e=>m(e,u),addClientIdsListener:(e,t)=>m(t,z,[e]),delListener:e=>(A(e),C),getStats:()=>({paths:a(L),clients:d(L)}),destroy:()=>{l.close(),L.clear()}};return c(C)};export{z as createWsServer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="&#x27;#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures. TinyBase provides built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - or the powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.1" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="&#x27;#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures. TinyBase provides built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - or the powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  import {createStore} from 'tinybase';
@@ -292,4 +292,4 @@ export const createShop: typeof createShopDecl = () => {
292
292
  };
293
293
  ```
294
294
 
295
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,370</td><td>2,370</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,554</td><td>2,554</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,000</td><td>1,000</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>947</td><td>947</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,817</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,018</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
295
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,373</td><td>2,373</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,561</td><td>2,561</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,004</td><td>1,004</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>947</td><td>947</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,821</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,030</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
@@ -173,9 +173,9 @@ const createWsServer = (webSocketServer) => {
173
173
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
174
174
  mapSet(clients, clientId, webSocket);
175
175
  if (clients.size == 1) {
176
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
176
+ callListeners(pathIdListeners, void 0, pathId, 1);
177
177
  }
178
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
178
+ callListeners(clientIdListeners, [pathId], clientId, 1);
179
179
  webSocket.on('message', (data) => {
180
180
  const payload = data.toString(UTF8);
181
181
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -197,10 +197,10 @@ const createWsServer = (webSocketServer) => {
197
197
  });
198
198
  webSocket.on('close', () => {
199
199
  collDel(clients, clientId);
200
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: -1}));
200
+ callListeners(clientIdListeners, [pathId], clientId, -1);
201
201
  if (collIsEmpty(clients)) {
202
202
  collDel(clientsByPath, pathId);
203
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
203
+ callListeners(pathIdListeners, void 0, pathId, -1);
204
204
  }
205
205
  });
206
206
  }),
@@ -173,9 +173,9 @@ const createWsServer = (webSocketServer) => {
173
173
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
174
174
  mapSet(clients, clientId, webSocket);
175
175
  if (clients.size == 1) {
176
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
176
+ callListeners(pathIdListeners, void 0, pathId, 1);
177
177
  }
178
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
178
+ callListeners(clientIdListeners, [pathId], clientId, 1);
179
179
  webSocket.on('message', (data) => {
180
180
  const payload = data.toString(UTF8);
181
181
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -197,10 +197,10 @@ const createWsServer = (webSocketServer) => {
197
197
  });
198
198
  webSocket.on('close', () => {
199
199
  collDel(clients, clientId);
200
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: -1}));
200
+ callListeners(clientIdListeners, [pathId], clientId, -1);
201
201
  if (collIsEmpty(clients)) {
202
202
  collDel(clientsByPath, pathId);
203
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
203
+ callListeners(pathIdListeners, void 0, pathId, -1);
204
204
  }
205
205
  });
206
206
  }),
@@ -1 +1 @@
1
- var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,(()=>({[r]:1}))),L(v,[r],(()=>({[n]:1}))),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],(()=>({[n]:-1}))),c(l)&&(h(I,r),L(a,void 0,(()=>({[r]:-1}))))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
1
+ var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,r,1),L(v,[r],n,1),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],n,-1),c(l)&&(h(I,r),L(a,void 0,r,-1))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
@@ -1 +1 @@
1
- var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,(()=>({[r]:1}))),L(v,[r],(()=>({[n]:1}))),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],(()=>({[n]:-1}))),c(l)&&(h(I,r),L(a,void 0,(()=>({[r]:-1}))))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
1
+ var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,r,1),L(v,[r],n,1),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],n,-1),c(l)&&(h(I,r),L(a,void 0,r,-1))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
@@ -242,9 +242,9 @@
242
242
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
243
243
  mapSet(clients, clientId, webSocket);
244
244
  if (clients.size == 1) {
245
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
245
+ callListeners(pathIdListeners, void 0, pathId, 1);
246
246
  }
247
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
247
+ callListeners(clientIdListeners, [pathId], clientId, 1);
248
248
  webSocket.on('message', (data) => {
249
249
  var _a2;
250
250
  const payload = data.toString(UTF8);
@@ -267,12 +267,10 @@
267
267
  });
268
268
  webSocket.on('close', () => {
269
269
  collDel(clients, clientId);
270
- callListeners(clientIdListeners, [pathId], () => ({
271
- [clientId]: -1,
272
- }));
270
+ callListeners(clientIdListeners, [pathId], clientId, -1);
273
271
  if (collIsEmpty(clients)) {
274
272
  collDel(clientsByPath, pathId);
275
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
273
+ callListeners(pathIdListeners, void 0, pathId, -1);
276
274
  }
277
275
  });
278
276
  }),
@@ -242,9 +242,9 @@
242
242
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
243
243
  mapSet(clients, clientId, webSocket);
244
244
  if (clients.size == 1) {
245
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
245
+ callListeners(pathIdListeners, void 0, pathId, 1);
246
246
  }
247
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
247
+ callListeners(clientIdListeners, [pathId], clientId, 1);
248
248
  webSocket.on('message', (data) => {
249
249
  var _a2;
250
250
  const payload = data.toString(UTF8);
@@ -267,12 +267,10 @@
267
267
  });
268
268
  webSocket.on('close', () => {
269
269
  collDel(clients, clientId);
270
- callListeners(clientIdListeners, [pathId], () => ({
271
- [clientId]: -1,
272
- }));
270
+ callListeners(clientIdListeners, [pathId], clientId, -1);
273
271
  if (collIsEmpty(clients)) {
274
272
  collDel(clientsByPath, pathId);
275
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
273
+ callListeners(pathIdListeners, void 0, pathId, -1);
276
274
  }
277
275
  });
278
276
  }),
@@ -1 +1 @@
1
- var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=(e,t,n)=>e.slice(t,n),r=e=>e.length,o=(e,t)=>e.forEach(t),c=(e,...t)=>e.push(...t),i=Object.freeze,d=e=>e?.size??0,a=(l=d,e=>{return t=(e,t)=>e+l(t),f(e).reduce(t,0);var t});var l;const u=e=>t(e)||0==d(e),f=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),y=e=>new Map(e),g=e=>[...e?.keys()??[]],p=(e,t)=>e?.get(t),S=(e,n,s)=>t(s)?(v(e,n),e):e?.set(n,s),b=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(p(e,t)):S(e,t,n()),p(e,t)},k=(e,t,s,o,c=0)=>n((s?b:p)(e,t[c],c>r(t)-2?s:y),(n=>{if(c>r(t)-2)return o?.(n)&&S(e,t[c]),n;const i=k(n,t,s,o,c+1);return u(n)&&S(e,t[c]),i})),m=e=>new Set(Array.isArray(e)||t(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const l=y(),f=y(),I=y(),[w,L,T]=(e=>{let s;const[i,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{x.test(t)&&r(e)<1e3&&c(e,t)}]})(),a=y();return[(e,t,n,r=[],o=(()=>[]))=>{s??=W;const c=i(1);var d,l;return S(a,c,[e,t,n,r,o]),d=k(t,n??[""],m),l=c,d?.add(l),c},(e,t,...n)=>o(((e,t=[""])=>{const n=[],s=(e,i)=>i==r(t)?c(n,e):null===t[i]?h(e,(e=>s(e,i+1))):o([t[i],null],(t=>s(p(e,t),i+1)));return s(e,0),n})(e,t),(e=>h(e,(e=>p(a,e)[0](s,...t??[],...n))))),e=>n(p(a,e),(([,t,n])=>(k(t,n??[""],void 0,(t=>(v(t,e),u(t)?1:0))),S(a,e),d(e),n))),e=>n(p(a,e),(([e,,n=[],c,i])=>{const d=(...a)=>{const l=r(a);l==r(n)?e(s,...a,...i(a)):t(n[l])?o(c[l]?.(...a)??[],(e=>d(...a,e))):d(...a,n[l])};d()}))]})();e.on("connection",((e,t)=>n(t.url?.match(z),(([,r])=>n(t.headers["sec-websocket-key"],(t=>{const n=b(I,r,y);S(n,t,e),1==n.size&&L(l,void 0,(()=>({[r]:1}))),L(f,[r],(()=>({[t]:1}))),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=s(r,0,o),i=s(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+i):0,h(n,((e,t)=>c(t,e)))):p(n,e)?.send(t+"\n"+i)}var c})),e.on("close",(()=>{v(n,t),L(f,[r],(()=>({[t]:-1}))),u(n)&&(v(I,r),L(l,void 0,(()=>({[r]:-1}))))}))}))))));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,l),addClientIdsListener:(e,t)=>w(t,f,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:d(I),clients:a(I)}),destroy:()=>{e.close(),I.clear()}};return i(W)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
1
+ var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=(e,t,n)=>e.slice(t,n),r=e=>e.length,o=(e,t)=>e.forEach(t),c=(e,...t)=>e.push(...t),i=Object.freeze,d=e=>e?.size??0,a=(l=d,e=>{return t=(e,t)=>e+l(t),f(e).reduce(t,0);var t});var l;const u=e=>t(e)||0==d(e),f=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),y=e=>new Map(e),g=e=>[...e?.keys()??[]],p=(e,t)=>e?.get(t),S=(e,n,s)=>t(s)?(v(e,n),e):e?.set(n,s),b=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(p(e,t)):S(e,t,n()),p(e,t)},k=(e,t,s,o,c=0)=>n((s?b:p)(e,t[c],c>r(t)-2?s:y),(n=>{if(c>r(t)-2)return o?.(n)&&S(e,t[c]),n;const i=k(n,t,s,o,c+1);return u(n)&&S(e,t[c]),i})),m=e=>new Set(Array.isArray(e)||t(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const l=y(),f=y(),I=y(),[w,L,T]=(e=>{let s;const[i,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{x.test(t)&&r(e)<1e3&&c(e,t)}]})(),a=y();return[(e,t,n,r=[],o=(()=>[]))=>{s??=W;const c=i(1);var d,l;return S(a,c,[e,t,n,r,o]),d=k(t,n??[""],m),l=c,d?.add(l),c},(e,t,...n)=>o(((e,t=[""])=>{const n=[],s=(e,i)=>i==r(t)?c(n,e):null===t[i]?h(e,(e=>s(e,i+1))):o([t[i],null],(t=>s(p(e,t),i+1)));return s(e,0),n})(e,t),(e=>h(e,(e=>p(a,e)[0](s,...t??[],...n))))),e=>n(p(a,e),(([,t,n])=>(k(t,n??[""],void 0,(t=>(v(t,e),u(t)?1:0))),S(a,e),d(e),n))),e=>n(p(a,e),(([e,,n=[],c,i])=>{const d=(...a)=>{const l=r(a);l==r(n)?e(s,...a,...i(a)):t(n[l])?o(c[l]?.(...a)??[],(e=>d(...a,e))):d(...a,n[l])};d()}))]})();e.on("connection",((e,t)=>n(t.url?.match(z),(([,r])=>n(t.headers["sec-websocket-key"],(t=>{const n=b(I,r,y);S(n,t,e),1==n.size&&L(l,void 0,r,1),L(f,[r],t,1),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=s(r,0,o),i=s(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+i):0,h(n,((e,t)=>c(t,e)))):p(n,e)?.send(t+"\n"+i)}var c})),e.on("close",(()=>{v(n,t),L(f,[r],t,-1),u(n)&&(v(I,r),L(l,void 0,r,-1))}))}))))));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,l),addClientIdsListener:(e,t)=>w(t,f,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:d(I),clients:a(I)}),destroy:()=>{e.close(),I.clear()}};return i(W)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
@@ -1 +1 @@
1
- var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=(e,t,n)=>e.slice(t,n),r=e=>e.length,o=(e,t)=>e.forEach(t),c=(e,...t)=>e.push(...t),i=Object.freeze,d=e=>e?.size??0,a=(l=d,e=>{return t=(e,t)=>e+l(t),f(e).reduce(t,0);var t});var l;const u=e=>t(e)||0==d(e),f=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),y=e=>new Map(e),g=e=>[...e?.keys()??[]],p=(e,t)=>e?.get(t),S=(e,n,s)=>t(s)?(v(e,n),e):e?.set(n,s),b=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(p(e,t)):S(e,t,n()),p(e,t)},k=(e,t,s,o,c=0)=>n((s?b:p)(e,t[c],c>r(t)-2?s:y),(n=>{if(c>r(t)-2)return o?.(n)&&S(e,t[c]),n;const i=k(n,t,s,o,c+1);return u(n)&&S(e,t[c]),i})),m=e=>new Set(Array.isArray(e)||t(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const l=y(),f=y(),I=y(),[w,L,T]=(e=>{let s;const[i,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{x.test(t)&&r(e)<1e3&&c(e,t)}]})(),a=y();return[(e,t,n,r=[],o=(()=>[]))=>{s??=W;const c=i(1);var d,l;return S(a,c,[e,t,n,r,o]),d=k(t,n??[""],m),l=c,d?.add(l),c},(e,t,...n)=>o(((e,t=[""])=>{const n=[],s=(e,i)=>i==r(t)?c(n,e):null===t[i]?h(e,(e=>s(e,i+1))):o([t[i],null],(t=>s(p(e,t),i+1)));return s(e,0),n})(e,t),(e=>h(e,(e=>p(a,e)[0](s,...t??[],...n))))),e=>n(p(a,e),(([,t,n])=>(k(t,n??[""],void 0,(t=>(v(t,e),u(t)?1:0))),S(a,e),d(e),n))),e=>n(p(a,e),(([e,,n=[],c,i])=>{const d=(...a)=>{const l=r(a);l==r(n)?e(s,...a,...i(a)):t(n[l])?o(c[l]?.(...a)??[],(e=>d(...a,e))):d(...a,n[l])};d()}))]})();e.on("connection",((e,t)=>n(t.url?.match(z),(([,r])=>n(t.headers["sec-websocket-key"],(t=>{const n=b(I,r,y);S(n,t,e),1==n.size&&L(l,void 0,(()=>({[r]:1}))),L(f,[r],(()=>({[t]:1}))),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=s(r,0,o),i=s(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+i):0,h(n,((e,t)=>c(t,e)))):p(n,e)?.send(t+"\n"+i)}var c})),e.on("close",(()=>{v(n,t),L(f,[r],(()=>({[t]:-1}))),u(n)&&(v(I,r),L(l,void 0,(()=>({[r]:-1}))))}))}))))));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,l),addClientIdsListener:(e,t)=>w(t,f,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:d(I),clients:a(I)}),destroy:()=>{e.close(),I.clear()}};return i(W)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
1
+ var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=(e,t,n)=>e.slice(t,n),r=e=>e.length,o=(e,t)=>e.forEach(t),c=(e,...t)=>e.push(...t),i=Object.freeze,d=e=>e?.size??0,a=(l=d,e=>{return t=(e,t)=>e+l(t),f(e).reduce(t,0);var t});var l;const u=e=>t(e)||0==d(e),f=e=>[...e?.values()??[]],h=(e,t)=>e?.forEach(t),v=(e,t)=>e?.delete(t),y=e=>new Map(e),g=e=>[...e?.keys()??[]],p=(e,t)=>e?.get(t),S=(e,n,s)=>t(s)?(v(e,n),e):e?.set(n,s),b=(e,t,n,s)=>{var r,o;return r=e,o=t,r?.has(o)?s?.(p(e,t)):S(e,t,n()),p(e,t)},k=(e,t,s,o,c=0)=>n((s?b:p)(e,t[c],c>r(t)-2?s:y),(n=>{if(c>r(t)-2)return o?.(n)&&S(e,t[c]),n;const i=k(n,t,s,o,c+1);return u(n)&&S(e,t[c]),i})),m=e=>new Set(Array.isArray(e)||t(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const l=y(),f=y(),I=y(),[w,L,T]=(e=>{let s;const[i,d]=(()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??""+t++,t=>{x.test(t)&&r(e)<1e3&&c(e,t)}]})(),a=y();return[(e,t,n,r=[],o=(()=>[]))=>{s??=W;const c=i(1);var d,l;return S(a,c,[e,t,n,r,o]),d=k(t,n??[""],m),l=c,d?.add(l),c},(e,t,...n)=>o(((e,t=[""])=>{const n=[],s=(e,i)=>i==r(t)?c(n,e):null===t[i]?h(e,(e=>s(e,i+1))):o([t[i],null],(t=>s(p(e,t),i+1)));return s(e,0),n})(e,t),(e=>h(e,(e=>p(a,e)[0](s,...t??[],...n))))),e=>n(p(a,e),(([,t,n])=>(k(t,n??[""],void 0,(t=>(v(t,e),u(t)?1:0))),S(a,e),d(e),n))),e=>n(p(a,e),(([e,,n=[],c,i])=>{const d=(...a)=>{const l=r(a);l==r(n)?e(s,...a,...i(a)):t(n[l])?o(c[l]?.(...a)??[],(e=>d(...a,e))):d(...a,n[l])};d()}))]})();e.on("connection",((e,t)=>n(t.url?.match(z),(([,r])=>n(t.headers["sec-websocket-key"],(t=>{const n=b(I,r,y);S(n,t,e),1==n.size&&L(l,void 0,r,1),L(f,[r],t,1),e.on("message",(e=>{const r=e.toString("utf8"),o=r.indexOf("\n");if(-1!==o){const e=s(r,0,o),i=s(r,o+1);""===e?(c=(e,n)=>e!=t?n.send(t+"\n"+i):0,h(n,((e,t)=>c(t,e)))):p(n,e)?.send(t+"\n"+i)}var c})),e.on("close",(()=>{v(n,t),L(f,[r],t,-1),u(n)&&(v(I,r),L(l,void 0,r,-1))}))}))))));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,l),addClientIdsListener:(e,t)=>w(t,f,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:d(I),clients:a(I)}),destroy:()=>{e.close(),I.clear()}};return i(W)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
@@ -190,9 +190,9 @@
190
190
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
191
191
  mapSet(clients, clientId, webSocket);
192
192
  if (clients.size == 1) {
193
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
193
+ callListeners(pathIdListeners, void 0, pathId, 1);
194
194
  }
195
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
195
+ callListeners(clientIdListeners, [pathId], clientId, 1);
196
196
  webSocket.on('message', (data) => {
197
197
  const payload = data.toString(UTF8);
198
198
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -214,12 +214,10 @@
214
214
  });
215
215
  webSocket.on('close', () => {
216
216
  collDel(clients, clientId);
217
- callListeners(clientIdListeners, [pathId], () => ({
218
- [clientId]: -1,
219
- }));
217
+ callListeners(clientIdListeners, [pathId], clientId, -1);
220
218
  if (collIsEmpty(clients)) {
221
219
  collDel(clientsByPath, pathId);
222
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
220
+ callListeners(pathIdListeners, void 0, pathId, -1);
223
221
  }
224
222
  });
225
223
  }),
@@ -190,9 +190,9 @@
190
190
  const clients = mapEnsure(clientsByPath, pathId, mapNew);
191
191
  mapSet(clients, clientId, webSocket);
192
192
  if (clients.size == 1) {
193
- callListeners(pathIdListeners, void 0, () => ({[pathId]: 1}));
193
+ callListeners(pathIdListeners, void 0, pathId, 1);
194
194
  }
195
- callListeners(clientIdListeners, [pathId], () => ({[clientId]: 1}));
195
+ callListeners(clientIdListeners, [pathId], clientId, 1);
196
196
  webSocket.on('message', (data) => {
197
197
  const payload = data.toString(UTF8);
198
198
  const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
@@ -214,12 +214,10 @@
214
214
  });
215
215
  webSocket.on('close', () => {
216
216
  collDel(clients, clientId);
217
- callListeners(clientIdListeners, [pathId], () => ({
218
- [clientId]: -1,
219
- }));
217
+ callListeners(clientIdListeners, [pathId], clientId, -1);
220
218
  if (collIsEmpty(clients)) {
221
219
  collDel(clientsByPath, pathId);
222
- callListeners(pathIdListeners, void 0, () => ({[pathId]: -1}));
220
+ callListeners(pathIdListeners, void 0, pathId, -1);
223
221
  }
224
222
  });
225
223
  }),