tinybase 4.5.6 → 4.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/debug/persisters/persister-partykit-server.js +28 -19
- package/lib/es6/persisters/persister-partykit-server.js +1 -1
- package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/persisters/persister-partykit-server.js +1 -1
- package/lib/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/types/persisters/persister-partykit-server.d.ts +8 -8
- package/lib/types/persisters.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +10 -10
- package/lib/types/with-schemas/persisters.d.ts +1 -0
- package/lib/umd/persisters/persister-partykit-server.js +1 -1
- package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
- package/package.json +13 -13
- package/readme.md +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a=a=>typeof a,t=a(""),e="t",s=(a,t)=>a.startsWith(t),n=Promise,r=a=>null==a,i=(a,t,e)=>r(a)?e?.():t(a),c=(a,t,e)=>a.slice(t,e),o=a=>a.length,l=async a=>n.all(a),w=(a,t)=>a.map(t),g=(a,...t)=>a.push(...t),h=Object,y=(a=[])=>h.fromEntries(a),f=(a,t)=>w(h.entries(a),(([a,e])=>t(e,a))),u=(a,t,e)=>(((a,t)=>!r(((a,t)=>i(a,(a=>a[t])))(a,t)))(a,t)||(a[t]=e()),a[t]),p=a=>JSON.stringify(a,((a,t)=>t instanceof Map?h.fromEntries([...t]):t)),S=JSON.parse,d=(e,s,n)=>e+s+(a(n)==t?n:p(n)),x=(a,t,e)=>{const n=o(a);return s(t,a)?[t[n],(e?S:String)(c(t,n+1))]:void 0},P=(a,t)=>((a,t)=>a?.forEach(t))(a,((a,e)=>t(e,a))),m="hasStore",D=y(w(["Origin","Methods","Headers"],(a=>["Access-Control-Allow-"+a,"*"]))),b=async(a,t="")=>!!await a.get(t+m),R=async(a,t="")=>{const s={},n={};return P(await a.list(),((a,r)=>i(x(t,a),(([a,t])=>{if(a==e){const[a,e,n]=S("["+t+"]");u(u(s,a,y),e,y)[n]=r}else"v"==a&&(n[t]=r)})))),[s,n]},T=async(a,t,e)=>a.party.broadcast(d(a.config.messagePrefix,"s",t),e),C=async(a,t,n,i)=>{const c=a.party.storage,w=a.config.storagePrefix,h={[w+m]:1},y=[],u=[];await l(f(t[0],(async(t,s)=>r(t)?!n&&await a.canDelTable(s,i)&&((a,...t)=>a.unshift(...t))(u,v(w,e,s)):await a.canSetTable(s,n,i)&&await l(f(t,(async(t,o)=>r(t)?!n&&await a.canDelRow(s,o,i)&&g(u,v(w,e,s,o)):await a.canSetRow(s,o,n,i)&&await l(f(t,(async(t,l)=>{const f=[s,o,l],u=v(w,e,...f);r(t)?!n&&await a.canDelCell(...f,i)&&g(y,u):await a.canSetCell(...f,t,n,i,await c.get(u))&&(h[u]=t)}))))))))),await l(f(t[1],(async(t,e)=>{const s=w+"v"+e;r(t)?!n&&await a.canDelValue(e,i)&&g(y,s):await a.canSetValue(e,t,n,i,await c.get(s))&&(h[s]=t)}))),0!=o(u)&&P(await c.list(),(a=>u.every((t=>!s(a,t)||g(y,a)&&0)))),await c.delete(y),await c.put(h)},v=(a,t,...e)=>d(a,t,c(p(e),1,-1)),O=async(a,t,e=null)=>new Response(e,{status:t,headers:a.config.responseHeaders});exports.TinyBasePartyKitServer=class{constructor(a){this.party=a,this.config={},this.config.storePath??="/store",this.config.messagePrefix??="",this.config.storagePrefix??="",this.config.responseHeaders??=D}async onRequest(a){const{party:{storage:t},config:{storePath:e,storagePrefix:s}}=this;if(new URL(a.url).pathname.endsWith(e)){const e=await b(t,s),n=await a.text();return"PUT"==a.method?e?O(this,205):(await C(this,S(n),!0,a),O(this,201)):O(this,200,e?p(await R(t,s)):"")}return O(this,404)}async onMessage(a,t){const{config:{messagePrefix:e,storagePrefix:s}}=this;await i(x(e,a,1),(async([a,e])=>{"s"==a&&await b(this.party.storage,s)&&(await C(this,e,!1,t),T(this,e,[t.id]))}))}async canSetTable(a,t,e){return!0}async canDelTable(a,t){return!0}async canSetRow(a,t,e,s){return!0}async canDelRow(a,t,e){return!0}async canSetCell(a,t,e,s,n,r,i){return!0}async canDelCell(a,t,e,s){return!0}async canSetValue(a,t,e,s,n){return!0}async canDelValue(a,t){return!0}},exports.broadcastTransactionChanges=T,exports.hasStoreInStorage=b,exports.loadStoreFromStorage=R;
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=e=>typeof e,t=e(""),n="t",r=(e,t)=>e.startsWith(t),
|
|
1
|
+
"use strict";const e=e=>typeof e,t=e(""),n="t",r=(e,t)=>e.startsWith(t),i=Promise,l=e=>null==e,s=(e,t,n)=>l(e)?null==n?void 0:n():t(e),o=(e,t,n)=>e.slice(t,n),u=e=>e.length,a=e=>{return t=function*(){return i.all(e)},new Promise(((e,n)=>{var r=e=>{try{l(t.next(e))}catch(e){n(e)}},i=e=>{try{l(t.throw(e))}catch(e){n(e)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,i);l((t=t.apply(void 0,null)).next())}));var t},c=(e,t)=>e.map(t),d=(e,...t)=>e.push(...t),h=Object,f=(e=[])=>h.fromEntries(e),y=(e,t)=>c(h.entries(e),(([e,n])=>t(n,e))),g=(e,t,n)=>(((e,t)=>!l(((e,t)=>s(e,(e=>e[t])))(e,t)))(e,t)||(e[t]=n()),e[t]),v=e=>JSON.stringify(e,((e,t)=>t instanceof Map?h.fromEntries([...t]):t)),p=JSON.parse,P=(n,r,i)=>n+r+(e(i)==t?i:v(i)),x=(e,t,n)=>{const i=u(e);return r(t,e)?[t[i],(n?p:String)(o(t,i+1))]:void 0},S=(e,t)=>((e,t)=>null==e?void 0:e.forEach(t))(e,((e,n)=>t(n,e)));var m=(e,t,n)=>new Promise(((r,i)=>{var l=e=>{try{o(n.next(e))}catch(e){i(e)}},s=e=>{try{o(n.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);o((n=n.apply(e,t)).next())}));const w="hasStore",D=f(c(["Origin","Methods","Headers"],(e=>["Access-Control-Allow-"+e,"*"]))),b=(e,...t)=>m(void 0,[e,...t],(function*(e,t=""){return!!(yield e.get(t+w))})),R=(e,...t)=>m(void 0,[e,...t],(function*(e,t=""){const r={},i={};return S(yield e.list(),((e,l)=>s(x(t,e),(([e,t])=>{if(e==n){const[e,n,i]=p("["+t+"]");g(g(r,e,f),n,f)[i]=l}else"v"==e&&(i[t]=l)})))),[r,i]})),T=(e,t,n)=>m(void 0,null,(function*(){return e.party.broadcast(P(e.config.messagePrefix,"s",t),n)})),C=(e,t,i,s)=>m(void 0,null,(function*(){const o=e.party.storage,c=e.config.storagePrefix,h={[c+w]:1},f=[],g=[];yield a(y(t[0],((t,r)=>m(void 0,null,(function*(){return l(t)?!i&&(yield e.canDelTable(r,s))&&((e,...t)=>e.unshift(...t))(g,H(c,n,r)):(yield e.canSetTable(r,i,s))&&(yield a(y(t,((t,u)=>m(void 0,null,(function*(){return l(t)?!i&&(yield e.canDelRow(r,u,s))&&d(g,H(c,n,r,u)):(yield e.canSetRow(r,u,i,s))&&(yield a(y(t,((t,a)=>m(void 0,null,(function*(){const y=[r,u,a],g=H(c,n,...y);l(t)?!i&&(yield e.canDelCell(...y,s))&&d(f,g):(yield e.canSetCell(...y,t,i,s,yield o.get(g)))&&(h[g]=t)}))))))}))))))}))))),yield a(y(t[1],((t,n)=>m(void 0,null,(function*(){const r=c+"v"+n;l(t)?!i&&(yield e.canDelValue(n,s))&&d(f,r):(yield e.canSetValue(n,t,i,s,yield o.get(r)))&&(h[r]=t)}))))),0!=u(g)&&S(yield o.list(),(e=>g.every((t=>!r(e,t)||d(f,e)&&0)))),yield o.delete(f),yield o.put(h)})),H=(e,t,...n)=>P(e,t,o(v(n),1,-1)),O=(e,t,n=null)=>m(void 0,null,(function*(){return new Response(n,{status:t,headers:e.config.responseHeaders})}));exports.TinyBasePartyKitServer=class{constructor(e){var t,n,r,i;this.party=e,this.config={},null!=(t=this.config).storePath||(t.storePath="/store"),null!=(n=this.config).messagePrefix||(n.messagePrefix=""),null!=(r=this.config).storagePrefix||(r.storagePrefix=""),null!=(i=this.config).responseHeaders||(i.responseHeaders=D)}onRequest(e){return m(this,null,(function*(){const{party:{storage:t},config:{storePath:n,storagePrefix:r}}=this;if(new URL(e.url).pathname.endsWith(n)){const n=yield b(t,r),i=yield e.text();return"PUT"==e.method?n?O(this,205):(yield C(this,p(i),!0,e),O(this,201)):O(this,200,n?v(yield R(t,r)):"")}return O(this,404)}))}onMessage(e,t){return m(this,null,(function*(){const{config:{messagePrefix:n,storagePrefix:r}}=this;yield s(x(n,e,1),(e=>m(this,[e],(function*([e,n]){"s"==e&&(yield b(this.party.storage,r))&&(yield C(this,n,!1,t),T(this,n,[t.id]))}))))}))}canSetTable(e,t,n){return m(this,null,(function*(){return!0}))}canDelTable(e,t){return m(this,null,(function*(){return!0}))}canSetRow(e,t,n,r){return m(this,null,(function*(){return!0}))}canDelRow(e,t,n){return m(this,null,(function*(){return!0}))}canSetCell(e,t,n,r,i,l,s){return m(this,null,(function*(){return!0}))}canDelCell(e,t,n,r){return m(this,null,(function*(){return!0}))}canSetValue(e,t,n,r,i){return m(this,null,(function*(){return!0}))}canDelValue(e,t){return m(this,null,(function*(){return!0}))}},exports.broadcastTransactionChanges=T,exports.hasStoreInStorage=b,exports.loadStoreFromStorage=R;
|
|
Binary file
|
|
@@ -111,42 +111,45 @@ const saveStore = async (
|
|
|
111
111
|
objMap(transactionChanges[0], async (table, tableId) =>
|
|
112
112
|
isUndefined(table)
|
|
113
113
|
? !initialSave &&
|
|
114
|
-
that.canDelTable(tableId, requestOrConnection) &&
|
|
114
|
+
(await that.canDelTable(tableId, requestOrConnection)) &&
|
|
115
115
|
arrayUnshift(
|
|
116
116
|
keyPrefixesToDel,
|
|
117
117
|
constructStorageKey(storagePrefix, T, tableId),
|
|
118
118
|
)
|
|
119
|
-
: that.canSetTable(tableId, initialSave, requestOrConnection) &&
|
|
119
|
+
: (await that.canSetTable(tableId, initialSave, requestOrConnection)) &&
|
|
120
120
|
(await promiseAll(
|
|
121
121
|
objMap(table, async (row, rowId) =>
|
|
122
122
|
isUndefined(row)
|
|
123
123
|
? !initialSave &&
|
|
124
|
-
that.canDelRow(tableId, rowId, requestOrConnection) &&
|
|
124
|
+
(await that.canDelRow(tableId, rowId, requestOrConnection)) &&
|
|
125
125
|
arrayPush(
|
|
126
126
|
keyPrefixesToDel,
|
|
127
127
|
constructStorageKey(storagePrefix, T, tableId, rowId),
|
|
128
128
|
)
|
|
129
|
-
: that.canSetRow(
|
|
129
|
+
: (await that.canSetRow(
|
|
130
130
|
tableId,
|
|
131
131
|
rowId,
|
|
132
132
|
initialSave,
|
|
133
133
|
requestOrConnection,
|
|
134
|
-
) &&
|
|
134
|
+
)) &&
|
|
135
135
|
(await promiseAll(
|
|
136
136
|
objMap(row, async (cell, cellId) => {
|
|
137
137
|
const ids = [tableId, rowId, cellId];
|
|
138
138
|
const key = constructStorageKey(storagePrefix, T, ...ids);
|
|
139
139
|
isUndefined(cell)
|
|
140
140
|
? !initialSave &&
|
|
141
|
-
that.canDelCell(
|
|
141
|
+
(await that.canDelCell(
|
|
142
|
+
...ids,
|
|
143
|
+
requestOrConnection,
|
|
144
|
+
)) &&
|
|
142
145
|
arrayPush(keysToDel, key)
|
|
143
|
-
: that.canSetCell(
|
|
146
|
+
: (await that.canSetCell(
|
|
144
147
|
...ids,
|
|
145
148
|
cell,
|
|
146
149
|
initialSave,
|
|
147
150
|
requestOrConnection,
|
|
148
151
|
await storage.get(key),
|
|
149
|
-
) && (keysToSet[key] = cell);
|
|
152
|
+
)) && (keysToSet[key] = cell);
|
|
150
153
|
}),
|
|
151
154
|
)),
|
|
152
155
|
),
|
|
@@ -158,15 +161,15 @@ const saveStore = async (
|
|
|
158
161
|
const key = storagePrefix + V + valueId;
|
|
159
162
|
isUndefined(value)
|
|
160
163
|
? !initialSave &&
|
|
161
|
-
that.canDelValue(valueId, requestOrConnection) &&
|
|
164
|
+
(await that.canDelValue(valueId, requestOrConnection)) &&
|
|
162
165
|
arrayPush(keysToDel, key)
|
|
163
|
-
: that.canSetValue(
|
|
166
|
+
: (await that.canSetValue(
|
|
164
167
|
valueId,
|
|
165
168
|
value,
|
|
166
169
|
initialSave,
|
|
167
170
|
requestOrConnection,
|
|
168
171
|
await storage.get(key),
|
|
169
|
-
) && (keysToSet[key] = value);
|
|
172
|
+
)) && (keysToSet[key] = value);
|
|
170
173
|
}),
|
|
171
174
|
);
|
|
172
175
|
if (!arrayIsEmpty(keyPrefixesToDel)) {
|
|
@@ -240,19 +243,19 @@ class TinyBasePartyKitServer {
|
|
|
240
243
|
},
|
|
241
244
|
);
|
|
242
245
|
}
|
|
243
|
-
canSetTable(_tableId, _initialSave, _requestOrConnection) {
|
|
246
|
+
async canSetTable(_tableId, _initialSave, _requestOrConnection) {
|
|
244
247
|
return true;
|
|
245
248
|
}
|
|
246
|
-
canDelTable(_tableId, _connection) {
|
|
249
|
+
async canDelTable(_tableId, _connection) {
|
|
247
250
|
return true;
|
|
248
251
|
}
|
|
249
|
-
canSetRow(_tableId, _rowId, _initialSave, _requestOrConnection) {
|
|
252
|
+
async canSetRow(_tableId, _rowId, _initialSave, _requestOrConnection) {
|
|
250
253
|
return true;
|
|
251
254
|
}
|
|
252
|
-
canDelRow(_tableId, _rowId, _connection) {
|
|
255
|
+
async canDelRow(_tableId, _rowId, _connection) {
|
|
253
256
|
return true;
|
|
254
257
|
}
|
|
255
|
-
canSetCell(
|
|
258
|
+
async canSetCell(
|
|
256
259
|
_tableId,
|
|
257
260
|
_rowId,
|
|
258
261
|
_cellId,
|
|
@@ -263,13 +266,19 @@ class TinyBasePartyKitServer {
|
|
|
263
266
|
) {
|
|
264
267
|
return true;
|
|
265
268
|
}
|
|
266
|
-
canDelCell(_tableId, _rowId, _cellId, _connection) {
|
|
269
|
+
async canDelCell(_tableId, _rowId, _cellId, _connection) {
|
|
267
270
|
return true;
|
|
268
271
|
}
|
|
269
|
-
canSetValue(
|
|
272
|
+
async canSetValue(
|
|
273
|
+
_valueId,
|
|
274
|
+
_value,
|
|
275
|
+
_initialSave,
|
|
276
|
+
_requestOrConnection,
|
|
277
|
+
_oldValue,
|
|
278
|
+
) {
|
|
270
279
|
return true;
|
|
271
280
|
}
|
|
272
|
-
canDelValue(_valueId, _connection) {
|
|
281
|
+
async canDelValue(_valueId, _connection) {
|
|
273
282
|
return true;
|
|
274
283
|
}
|
|
275
284
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>typeof e,t=e(""),n="t",
|
|
1
|
+
const e=e=>typeof e,t=e(""),n="t",i=(e,t)=>e.startsWith(t),r=Promise,l=e=>null==e,s=(e,t,n)=>l(e)?null==n?void 0:n():t(e),o=(e,t,n)=>e.slice(t,n),u=e=>e.length,a=e=>{return t=function*(){return r.all(e)},new Promise(((e,n)=>{var i=e=>{try{l(t.next(e))}catch(e){n(e)}},r=e=>{try{l(t.throw(e))}catch(e){n(e)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,r);l((t=t.apply(void 0,null)).next())}));var t},c=(e,t)=>e.map(t),d=(e,...t)=>e.push(...t),f=Object,h=(e=[])=>f.fromEntries(e),y=(e,t)=>c(f.entries(e),(([e,n])=>t(n,e))),g=(e,t,n)=>(((e,t)=>!l(((e,t)=>s(e,(e=>e[t])))(e,t)))(e,t)||(e[t]=n()),e[t]),v=e=>JSON.stringify(e,((e,t)=>t instanceof Map?f.fromEntries([...t]):t)),p=JSON.parse,P=(n,i,r)=>n+i+(e(r)==t?r:v(r)),x=(e,t,n)=>{const r=u(e);return i(t,e)?[t[r],(n?p:String)(o(t,r+1))]:void 0},m=(e,t)=>((e,t)=>null==e?void 0:e.forEach(t))(e,((e,n)=>t(n,e)));var S=(e,t,n)=>new Promise(((i,r)=>{var l=e=>{try{o(n.next(e))}catch(e){r(e)}},s=e=>{try{o(n.throw(e))}catch(e){r(e)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(l,s);o((n=n.apply(e,t)).next())}));const w="hasStore",D=h(c(["Origin","Methods","Headers"],(e=>["Access-Control-Allow-"+e,"*"]))),R=(e,...t)=>S(void 0,[e,...t],(function*(e,t=""){return!!(yield e.get(t+w))})),b=(e,...t)=>S(void 0,[e,...t],(function*(e,t=""){const i={},r={};return m(yield e.list(),((e,l)=>s(x(t,e),(([e,t])=>{if(e==n){const[e,n,r]=p("["+t+"]");g(g(i,e,h),n,h)[r]=l}else"v"==e&&(r[t]=l)})))),[i,r]})),C=(e,t,n)=>S(void 0,null,(function*(){return e.party.broadcast(P(e.config.messagePrefix,"s",t),n)})),T=(e,t,r,s)=>S(void 0,null,(function*(){const o=e.party.storage,c=e.config.storagePrefix,f={[c+w]:1},h=[],g=[];yield a(y(t[0],((t,i)=>S(void 0,null,(function*(){return l(t)?!r&&(yield e.canDelTable(i,s))&&((e,...t)=>e.unshift(...t))(g,H(c,n,i)):(yield e.canSetTable(i,r,s))&&(yield a(y(t,((t,u)=>S(void 0,null,(function*(){return l(t)?!r&&(yield e.canDelRow(i,u,s))&&d(g,H(c,n,i,u)):(yield e.canSetRow(i,u,r,s))&&(yield a(y(t,((t,a)=>S(void 0,null,(function*(){const y=[i,u,a],g=H(c,n,...y);l(t)?!r&&(yield e.canDelCell(...y,s))&&d(h,g):(yield e.canSetCell(...y,t,r,s,yield o.get(g)))&&(f[g]=t)}))))))}))))))}))))),yield a(y(t[1],((t,n)=>S(void 0,null,(function*(){const i=c+"v"+n;l(t)?!r&&(yield e.canDelValue(n,s))&&d(h,i):(yield e.canSetValue(n,t,r,s,yield o.get(i)))&&(f[i]=t)}))))),0!=u(g)&&m(yield o.list(),(e=>g.every((t=>!i(e,t)||d(h,e)&&0)))),yield o.delete(h),yield o.put(f)})),H=(e,t,...n)=>P(e,t,o(v(n),1,-1)),O=(e,t,n=null)=>S(void 0,null,(function*(){return new Response(n,{status:t,headers:e.config.responseHeaders})}));class V{constructor(e){var t,n,i,r;this.party=e,this.config={},null!=(t=this.config).storePath||(t.storePath="/store"),null!=(n=this.config).messagePrefix||(n.messagePrefix=""),null!=(i=this.config).storagePrefix||(i.storagePrefix=""),null!=(r=this.config).responseHeaders||(r.responseHeaders=D)}onRequest(e){return S(this,null,(function*(){const{party:{storage:t},config:{storePath:n,storagePrefix:i}}=this;if(new URL(e.url).pathname.endsWith(n)){const n=yield R(t,i),r=yield e.text();return"PUT"==e.method?n?O(this,205):(yield T(this,p(r),!0,e),O(this,201)):O(this,200,n?v(yield b(t,i)):"")}return O(this,404)}))}onMessage(e,t){return S(this,null,(function*(){const{config:{messagePrefix:n,storagePrefix:i}}=this;yield s(x(n,e,1),(e=>S(this,[e],(function*([e,n]){"s"==e&&(yield R(this.party.storage,i))&&(yield T(this,n,!1,t),C(this,n,[t.id]))}))))}))}canSetTable(e,t,n){return S(this,null,(function*(){return!0}))}canDelTable(e,t){return S(this,null,(function*(){return!0}))}canSetRow(e,t,n,i){return S(this,null,(function*(){return!0}))}canDelRow(e,t,n){return S(this,null,(function*(){return!0}))}canSetCell(e,t,n,i,r,l,s){return S(this,null,(function*(){return!0}))}canDelCell(e,t,n,i){return S(this,null,(function*(){return!0}))}canSetValue(e,t,n,i,r){return S(this,null,(function*(){return!0}))}canDelValue(e,t){return S(this,null,(function*(){return!0}))}}export{V as TinyBasePartyKitServer,C as broadcastTransactionChanges,R as hasStoreInStorage,b as loadStoreFromStorage};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a=a=>typeof a,t=a(""),e="t",s=(a,t)=>a.startsWith(t),n=Promise,i=a=>null==a,r=(a,t,e)=>i(a)?e?.():t(a),c=(a,t,e)=>a.slice(t,e),o=a=>a.length,l=async a=>n.all(a),w=(a,t)=>a.map(t),h=(a,...t)=>a.push(...t),y=Object,g=(a=[])=>y.fromEntries(a),f=(a,t)=>w(y.entries(a),(([a,e])=>t(e,a))),u=(a,t,e)=>(((a,t)=>!i(((a,t)=>r(a,(a=>a[t])))(a,t)))(a,t)||(a[t]=e()),a[t]),p=a=>JSON.stringify(a,((a,t)=>t instanceof Map?y.fromEntries([...t]):t)),S=JSON.parse,d=(e,s,n)=>e+s+(a(n)==t?n:p(n)),P=(a,t,e)=>{const n=o(a);return s(t,a)?[t[n],(e?S:String)(c(t,n+1))]:void 0},m=(a,t)=>((a,t)=>a?.forEach(t))(a,((a,e)=>t(e,a))),x="hasStore",D=g(w(["Origin","Methods","Headers"],(a=>["Access-Control-Allow-"+a,"*"]))),R=async(a,t="")=>!!await a.get(t+x),b=async(a,t="")=>{const s={},n={};return m(await a.list(),((a,i)=>r(P(t,a),(([a,t])=>{if(a==e){const[a,e,n]=S("["+t+"]");u(u(s,a,g),e,g)[n]=i}else"v"==a&&(n[t]=i)})))),[s,n]},C=async(a,t,e)=>a.party.broadcast(d(a.config.messagePrefix,"s",t),e),T=async(a,t,n,r)=>{const c=a.party.storage,w=a.config.storagePrefix,y={[w+x]:1},g=[],u=[];await l(f(t[0],(async(t,s)=>i(t)?!n&&await a.canDelTable(s,r)&&((a,...t)=>a.unshift(...t))(u,v(w,e,s)):await a.canSetTable(s,n,r)&&await l(f(t,(async(t,o)=>i(t)?!n&&await a.canDelRow(s,o,r)&&h(u,v(w,e,s,o)):await a.canSetRow(s,o,n,r)&&await l(f(t,(async(t,l)=>{const f=[s,o,l],u=v(w,e,...f);i(t)?!n&&await a.canDelCell(...f,r)&&h(g,u):await a.canSetCell(...f,t,n,r,await c.get(u))&&(y[u]=t)}))))))))),await l(f(t[1],(async(t,e)=>{const s=w+"v"+e;i(t)?!n&&await a.canDelValue(e,r)&&h(g,s):await a.canSetValue(e,t,n,r,await c.get(s))&&(y[s]=t)}))),0!=o(u)&&m(await c.list(),(a=>u.every((t=>!s(a,t)||h(g,a)&&0)))),await c.delete(g),await c.put(y)},v=(a,t,...e)=>d(a,t,c(p(e),1,-1)),O=async(a,t,e=null)=>new Response(e,{status:t,headers:a.config.responseHeaders});class V{constructor(a){this.party=a,this.config={},this.config.storePath??="/store",this.config.messagePrefix??="",this.config.storagePrefix??="",this.config.responseHeaders??=D}async onRequest(a){const{party:{storage:t},config:{storePath:e,storagePrefix:s}}=this;if(new URL(a.url).pathname.endsWith(e)){const e=await R(t,s),n=await a.text();return"PUT"==a.method?e?O(this,205):(await T(this,S(n),!0,a),O(this,201)):O(this,200,e?p(await b(t,s)):"")}return O(this,404)}async onMessage(a,t){const{config:{messagePrefix:e,storagePrefix:s}}=this;await r(P(e,a,1),(async([a,e])=>{"s"==a&&await R(this.party.storage,s)&&(await T(this,e,!1,t),C(this,e,[t.id]))}))}async canSetTable(a,t,e){return!0}async canDelTable(a,t){return!0}async canSetRow(a,t,e,s){return!0}async canDelRow(a,t,e){return!0}async canSetCell(a,t,e,s,n,i,r){return!0}async canDelCell(a,t,e,s){return!0}async canSetValue(a,t,e,s,n){return!0}async canDelValue(a,t){return!0}}export{V as TinyBasePartyKitServer,C as broadcastTransactionChanges,R as hasStoreInStorage,b as loadStoreFromStorage};
|
|
Binary file
|
|
@@ -249,7 +249,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
249
249
|
tableId: Id,
|
|
250
250
|
initialSave: boolean,
|
|
251
251
|
requestOrConnection: Request | Connection,
|
|
252
|
-
): boolean
|
|
252
|
+
): Promise<boolean>;
|
|
253
253
|
/**
|
|
254
254
|
* The canDelTable method lets you allow or disallow deletions of a Table
|
|
255
255
|
* stored on the server, as sent from a client.
|
|
@@ -281,7 +281,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
281
281
|
* @category Sanitization
|
|
282
282
|
* @since v4.3.12
|
|
283
283
|
*/
|
|
284
|
-
canDelTable(tableId: Id, connection: Connection): boolean
|
|
284
|
+
canDelTable(tableId: Id, connection: Connection): Promise<boolean>;
|
|
285
285
|
/**
|
|
286
286
|
* The canSetRow method lets you allow or disallow any changes to a Row stored
|
|
287
287
|
* on the server, as sent from a client.
|
|
@@ -324,7 +324,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
324
324
|
rowId: Id,
|
|
325
325
|
initialSave: boolean,
|
|
326
326
|
requestOrConnection: Request | Connection,
|
|
327
|
-
): boolean
|
|
327
|
+
): Promise<boolean>;
|
|
328
328
|
/**
|
|
329
329
|
* The canDelRow method lets you allow or disallow deletions of a Row stored
|
|
330
330
|
* on the server, as sent from a client.
|
|
@@ -357,7 +357,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
357
357
|
* @category Sanitization
|
|
358
358
|
* @since v4.3.12
|
|
359
359
|
*/
|
|
360
|
-
canDelRow(tableId: Id, rowId: Id, connection: Connection): boolean
|
|
360
|
+
canDelRow(tableId: Id, rowId: Id, connection: Connection): Promise<boolean>;
|
|
361
361
|
/**
|
|
362
362
|
* The canSetCell method lets you allow or disallow any changes to a Cell
|
|
363
363
|
* stored on the server, as sent from a client.
|
|
@@ -406,7 +406,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
406
406
|
initialSave: boolean,
|
|
407
407
|
requestOrConnection: Request | Connection,
|
|
408
408
|
oldCell: CellOrUndefined,
|
|
409
|
-
): boolean
|
|
409
|
+
): Promise<boolean>;
|
|
410
410
|
/**
|
|
411
411
|
* The canDelCell method lets you allow or disallow deletions of a Cell stored
|
|
412
412
|
* on the server, as sent from a client.
|
|
@@ -444,7 +444,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
444
444
|
rowId: Id,
|
|
445
445
|
cellId: Id,
|
|
446
446
|
connection: Connection,
|
|
447
|
-
): boolean
|
|
447
|
+
): Promise<boolean>;
|
|
448
448
|
/**
|
|
449
449
|
* The canSetValue method lets you allow or disallow any changes to a Value
|
|
450
450
|
* stored on the server, as sent from a client.
|
|
@@ -491,7 +491,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
491
491
|
initialSave: boolean,
|
|
492
492
|
requestOrConnection: Request | Connection,
|
|
493
493
|
oldValue: ValueOrUndefined,
|
|
494
|
-
): boolean
|
|
494
|
+
): Promise<boolean>;
|
|
495
495
|
/**
|
|
496
496
|
* The canDelValue method lets you allow or disallow deletions of a Value
|
|
497
497
|
* stored on the server, as sent from a client.
|
|
@@ -523,7 +523,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
523
523
|
* @category Sanitization
|
|
524
524
|
* @since v4.3.12
|
|
525
525
|
*/
|
|
526
|
-
canDelValue(valueId: Id, connection: Connection): boolean
|
|
526
|
+
canDelValue(valueId: Id, connection: Connection): Promise<boolean>;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/**
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* |persister-indexed-db|createIndexedDbPersister|Browser IndexedDB|
|
|
16
16
|
* |persister-remote|createRemotePersister|Remote server|
|
|
17
17
|
* |persister-file|createFilePersister|Local file (where possible)|
|
|
18
|
+
* |persister-partykit-client|createPartyKitPersister|PartyKit with the persister-partykit-server module|
|
|
18
19
|
* |persister-sqlite3|createSqlite3Persister|SQLite in Node, via [sqlite3](https://github.com/TryGhost/node-sqlite3)|
|
|
19
20
|
* |persister-sqlite-wasm|createSqliteWasmPersister|SQLite in a browser, via [sqlite-wasm](https://github.com/tomayac/sqlite-wasm)|
|
|
20
21
|
* |persister-cr-sqlite-wasm|createCrSqliteWasmPersister|SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite)|
|
|
@@ -252,7 +252,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
252
252
|
tableId: Id,
|
|
253
253
|
initialSave: boolean,
|
|
254
254
|
requestOrConnection: Request | Connection,
|
|
255
|
-
): boolean
|
|
255
|
+
): Promise<boolean>;
|
|
256
256
|
/**
|
|
257
257
|
* The canDelTable method lets you allow or disallow deletions of a Table
|
|
258
258
|
* stored on the server, as sent from a client.
|
|
@@ -284,7 +284,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
284
284
|
* @category Sanitization
|
|
285
285
|
* @since v4.3.12
|
|
286
286
|
*/
|
|
287
|
-
canDelTable(tableId: Id, connection: Connection): boolean
|
|
287
|
+
canDelTable(tableId: Id, connection: Connection): Promise<boolean>;
|
|
288
288
|
/**
|
|
289
289
|
* The canSetRow method lets you allow or disallow any changes to a Row stored
|
|
290
290
|
* on the server, as sent from a client.
|
|
@@ -327,7 +327,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
327
327
|
rowId: Id,
|
|
328
328
|
initialSave: boolean,
|
|
329
329
|
requestOrConnection: Request | Connection,
|
|
330
|
-
): boolean
|
|
330
|
+
): Promise<boolean>;
|
|
331
331
|
/**
|
|
332
332
|
* The canDelRow method lets you allow or disallow deletions of a Row stored
|
|
333
333
|
* on the server, as sent from a client.
|
|
@@ -360,7 +360,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
360
360
|
* @category Sanitization
|
|
361
361
|
* @since v4.3.12
|
|
362
362
|
*/
|
|
363
|
-
canDelRow(tableId: Id, rowId: Id, connection: Connection): boolean
|
|
363
|
+
canDelRow(tableId: Id, rowId: Id, connection: Connection): Promise<boolean>;
|
|
364
364
|
/**
|
|
365
365
|
* The canSetCell method lets you allow or disallow any changes to a Cell
|
|
366
366
|
* stored on the server, as sent from a client.
|
|
@@ -376,7 +376,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
376
376
|
* initialSave: boolean,
|
|
377
377
|
* requestOrConnection: Request | Connection,
|
|
378
378
|
* oldCell: CellOrUndefined,
|
|
379
|
-
* ): boolean
|
|
379
|
+
* ): Promise<boolean>;
|
|
380
380
|
* ```
|
|
381
381
|
*
|
|
382
382
|
* This is one of the functions use to sanitize the data that is being sent
|
|
@@ -423,7 +423,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
423
423
|
initialSave: boolean,
|
|
424
424
|
requestOrConnection: Request | Connection,
|
|
425
425
|
oldCell: CellOrUndefined<NoTablesSchema, Id, Id>,
|
|
426
|
-
): boolean
|
|
426
|
+
): Promise<boolean>;
|
|
427
427
|
/**
|
|
428
428
|
* The canDelCell method lets you allow or disallow deletions of a Cell stored
|
|
429
429
|
* on the server, as sent from a client.
|
|
@@ -461,7 +461,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
461
461
|
rowId: Id,
|
|
462
462
|
cellId: Id,
|
|
463
463
|
connection: Connection,
|
|
464
|
-
): boolean
|
|
464
|
+
): Promise<boolean>;
|
|
465
465
|
/**
|
|
466
466
|
* The canSetValue method lets you allow or disallow any changes to a Value
|
|
467
467
|
* stored on the server, as sent from a client.
|
|
@@ -475,7 +475,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
475
475
|
* initialSave: boolean,
|
|
476
476
|
* requestOrConnection: Request | Connection,
|
|
477
477
|
* oldValue: ValueOrUndefined,
|
|
478
|
-
* ): boolean
|
|
478
|
+
* ): Promise<boolean>;
|
|
479
479
|
* ```
|
|
480
480
|
*
|
|
481
481
|
* This is one of the functions use to sanitize the data that is being sent
|
|
@@ -520,7 +520,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
520
520
|
initialSave: boolean,
|
|
521
521
|
requestOrConnection: Request | Connection,
|
|
522
522
|
oldValue: ValueOrUndefined<NoValuesSchema, Id>,
|
|
523
|
-
): boolean
|
|
523
|
+
): Promise<boolean>;
|
|
524
524
|
/**
|
|
525
525
|
* The canDelValue method lets you allow or disallow deletions of a Value
|
|
526
526
|
* stored on the server, as sent from a client.
|
|
@@ -552,7 +552,7 @@ export class TinyBasePartyKitServer implements Server {
|
|
|
552
552
|
* @category Sanitization
|
|
553
553
|
* @since v4.3.12
|
|
554
554
|
*/
|
|
555
|
-
canDelValue(valueId: Id, connection: Connection): boolean
|
|
555
|
+
canDelValue(valueId: Id, connection: Connection): Promise<boolean>;
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
/**
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* |persister-indexed-db|createIndexedDbPersister|Browser IndexedDB|
|
|
16
16
|
* |persister-remote|createRemotePersister|Remote server|
|
|
17
17
|
* |persister-file|createFilePersister|Local file (where possible)|
|
|
18
|
+
* |persister-partykit-client|createPartyKitPersister|PartyKit with the persister-partykit-server module|
|
|
18
19
|
* |persister-sqlite3|createSqlite3Persister|SQLite in Node, via [sqlite3](https://github.com/TryGhost/node-sqlite3)|
|
|
19
20
|
* |persister-sqlite-wasm|createSqliteWasmPersister|SQLite in a browser, via [sqlite-wasm](https://github.com/tomayac/sqlite-wasm)|
|
|
20
21
|
* |persister-cr-sqlite-wasm|createCrSqliteWasmPersister|SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite)|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a,t;a=this,t=function(a){"use strict";const t=a=>typeof a,e=t(""),s="t",n=(a,t)=>a.startsWith(t),i=Promise,r=a=>null==a,o=(a,t,e)=>r(a)?e?.():t(a),c=(a,t,e)=>a.slice(t,e),l=a=>a.length,f=async a=>i.all(a),y=(a,t)=>a.map(t),h=(a,...t)=>a.push(...t),g=Object,w=(a=[])=>g.fromEntries(a),u=(a,t)=>y(g.entries(a),(([a,e])=>t(e,a))),d=(a,t,e)=>(((a,t)=>!r(((a,t)=>o(a,(a=>a[t])))(a,t)))(a,t)||(a[t]=e()),a[t]),p=a=>JSON.stringify(a,((a,t)=>t instanceof Map?g.fromEntries([...t]):t)),S=JSON.parse,P=(a,s,n)=>a+s+(t(n)==e?n:p(n)),m=(a,t,e)=>{const s=l(a);return n(t,a)?[t[s],(e?S:String)(c(t,s+1))]:void 0},x=(a,t)=>((a,t)=>a?.forEach(t))(a,((a,e)=>t(e,a))),b="hasStore",T=w(y(["Origin","Methods","Headers"],(a=>["Access-Control-Allow-"+a,"*"]))),D=async(a,t="")=>!!await a.get(t+b),v=async(a,t="")=>{const e={},n={};return x(await a.list(),((a,i)=>o(m(t,a),(([a,t])=>{if(a==s){const[a,s,n]=S("["+t+"]");d(d(e,a,w),s,w)[n]=i}else"v"==a&&(n[t]=i)})))),[e,n]},R=async(a,t,e)=>a.party.broadcast(P(a.config.messagePrefix,"s",t),e),C=async(a,t,e,i)=>{const o=a.party.storage,c=a.config.storagePrefix,y={[c+b]:1},g=[],w=[];await f(u(t[0],(async(t,n)=>r(t)?!e&&await a.canDelTable(n,i)&&((a,...t)=>a.unshift(...t))(w,O(c,s,n)):await a.canSetTable(n,e,i)&&await f(u(t,(async(t,l)=>r(t)?!e&&await a.canDelRow(n,l,i)&&h(w,O(c,s,n,l)):await a.canSetRow(n,l,e,i)&&await f(u(t,(async(t,f)=>{const w=[n,l,f],u=O(c,s,...w);r(t)?!e&&await a.canDelCell(...w,i)&&h(g,u):await a.canSetCell(...w,t,e,i,await o.get(u))&&(y[u]=t)}))))))))),await f(u(t[1],(async(t,s)=>{const n=c+"v"+s;r(t)?!e&&await a.canDelValue(s,i)&&h(g,n):await a.canSetValue(s,t,e,i,await o.get(n))&&(y[n]=t)}))),0!=l(w)&&x(await o.list(),(a=>w.every((t=>!n(a,t)||h(g,a)&&0)))),await o.delete(g),await o.put(y)},O=(a,t,...e)=>P(a,t,c(p(e),1,-1)),V=async(a,t,e=null)=>new Response(e,{status:t,headers:a.config.responseHeaders});a.TinyBasePartyKitServer=class{constructor(a){this.party=a,this.config={},this.config.storePath??="/store",this.config.messagePrefix??="",this.config.storagePrefix??="",this.config.responseHeaders??=T}async onRequest(a){const{party:{storage:t},config:{storePath:e,storagePrefix:s}}=this;if(new URL(a.url).pathname.endsWith(e)){const e=await D(t,s),n=await a.text();return"PUT"==a.method?e?V(this,205):(await C(this,S(n),!0,a),V(this,201)):V(this,200,e?p(await v(t,s)):"")}return V(this,404)}async onMessage(a,t){const{config:{messagePrefix:e,storagePrefix:s}}=this;await o(m(e,a,1),(async([a,e])=>{"s"==a&&await D(this.party.storage,s)&&(await C(this,e,!1,t),R(this,e,[t.id]))}))}async canSetTable(a,t,e){return!0}async canDelTable(a,t){return!0}async canSetRow(a,t,e,s){return!0}async canDelRow(a,t,e){return!0}async canSetCell(a,t,e,s,n,i,r){return!0}async canDelCell(a,t,e,s){return!0}async canSetValue(a,t,e,s,n){return!0}async canDelValue(a,t){return!0}},a.broadcastTransactionChanges=R,a.hasStoreInStorage=D,a.loadStoreFromStorage=v},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((a="undefined"!=typeof globalThis?globalThis:a||self).TinyBasePersisterPartyKitServer={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n=t(""),r="t",i=(e,t)=>e.startsWith(t),
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n=t(""),r="t",i=(e,t)=>e.startsWith(t),l=Promise,s=e=>null==e,o=(e,t,n)=>s(e)?null==n?void 0:n():t(e),u=(e,t,n)=>e.slice(t,n),a=e=>e.length,c=e=>{return t=function*(){return l.all(e)},new Promise(((e,n)=>{var r=e=>{try{l(t.next(e))}catch(e){n(e)}},i=e=>{try{l(t.throw(e))}catch(e){n(e)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,i);l((t=t.apply(void 0,null)).next())}));var t},d=(e,t)=>e.map(t),f=(e,...t)=>e.push(...t),h=Object,y=(e=[])=>h.fromEntries(e),g=(e,t)=>d(h.entries(e),(([e,n])=>t(n,e))),v=(e,t,n)=>(((e,t)=>!s(((e,t)=>o(e,(e=>e[t])))(e,t)))(e,t)||(e[t]=n()),e[t]),p=e=>JSON.stringify(e,((e,t)=>t instanceof Map?h.fromEntries([...t]):t)),P=JSON.parse,S=(e,r,i)=>e+r+(t(i)==n?i:p(i)),m=(e,t,n)=>{const r=a(e);return i(t,e)?[t[r],(n?P:String)(u(t,r+1))]:void 0},x=(e,t)=>((e,t)=>null==e?void 0:e.forEach(t))(e,((e,n)=>t(n,e)));var w=(e,t,n)=>new Promise(((r,i)=>{var l=e=>{try{o(n.next(e))}catch(e){i(e)}},s=e=>{try{o(n.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);o((n=n.apply(e,t)).next())}));const b="hasStore",T=y(d(["Origin","Methods","Headers"],(e=>["Access-Control-Allow-"+e,"*"]))),D=(e,...t)=>w(void 0,[e,...t],(function*(e,t=""){return!!(yield e.get(t+b))})),R=(e,...t)=>w(void 0,[e,...t],(function*(e,t=""){const n={},i={};return x(yield e.list(),((e,l)=>o(m(t,e),(([e,t])=>{if(e==r){const[e,r,i]=P("["+t+"]");v(v(n,e,y),r,y)[i]=l}else"v"==e&&(i[t]=l)})))),[n,i]})),C=(e,t,n)=>w(void 0,null,(function*(){return e.party.broadcast(S(e.config.messagePrefix,"s",t),n)})),H=(e,t,n,l)=>w(void 0,null,(function*(){const o=e.party.storage,u=e.config.storagePrefix,d={[u+b]:1},h=[],y=[];yield c(g(t[0],((t,i)=>w(void 0,null,(function*(){return s(t)?!n&&(yield e.canDelTable(i,l))&&((e,...t)=>e.unshift(...t))(y,O(u,r,i)):(yield e.canSetTable(i,n,l))&&(yield c(g(t,((t,a)=>w(void 0,null,(function*(){return s(t)?!n&&(yield e.canDelRow(i,a,l))&&f(y,O(u,r,i,a)):(yield e.canSetRow(i,a,n,l))&&(yield c(g(t,((t,c)=>w(void 0,null,(function*(){const y=[i,a,c],g=O(u,r,...y);s(t)?!n&&(yield e.canDelCell(...y,l))&&f(h,g):(yield e.canSetCell(...y,t,n,l,yield o.get(g)))&&(d[g]=t)}))))))}))))))}))))),yield c(g(t[1],((t,r)=>w(void 0,null,(function*(){const i=u+"v"+r;s(t)?!n&&(yield e.canDelValue(r,l))&&f(h,i):(yield e.canSetValue(r,t,n,l,yield o.get(i)))&&(d[i]=t)}))))),0!=a(y)&&x(yield o.list(),(e=>y.every((t=>!i(e,t)||f(h,e)&&0)))),yield o.delete(h),yield o.put(d)})),O=(e,t,...n)=>S(e,t,u(p(n),1,-1)),V=(e,t,n=null)=>w(void 0,null,(function*(){return new Response(n,{status:t,headers:e.config.responseHeaders})}));e.TinyBasePartyKitServer=class{constructor(e){var t,n,r,i;this.party=e,this.config={},null!=(t=this.config).storePath||(t.storePath="/store"),null!=(n=this.config).messagePrefix||(n.messagePrefix=""),null!=(r=this.config).storagePrefix||(r.storagePrefix=""),null!=(i=this.config).responseHeaders||(i.responseHeaders=T)}onRequest(e){return w(this,null,(function*(){const{party:{storage:t},config:{storePath:n,storagePrefix:r}}=this;if(new URL(e.url).pathname.endsWith(n)){const n=yield D(t,r),i=yield e.text();return"PUT"==e.method?n?V(this,205):(yield H(this,P(i),!0,e),V(this,201)):V(this,200,n?p(yield R(t,r)):"")}return V(this,404)}))}onMessage(e,t){return w(this,null,(function*(){const{config:{messagePrefix:n,storagePrefix:r}}=this;yield o(m(n,e,1),(e=>w(this,[e],(function*([e,n]){"s"==e&&(yield D(this.party.storage,r))&&(yield H(this,n,!1,t),C(this,n,[t.id]))}))))}))}canSetTable(e,t,n){return w(this,null,(function*(){return!0}))}canDelTable(e,t){return w(this,null,(function*(){return!0}))}canSetRow(e,t,n,r){return w(this,null,(function*(){return!0}))}canDelRow(e,t,n){return w(this,null,(function*(){return!0}))}canSetCell(e,t,n,r,i,l,s){return w(this,null,(function*(){return!0}))}canDelCell(e,t,n,r){return w(this,null,(function*(){return!0}))}canSetValue(e,t,n,r,i){return w(this,null,(function*(){return!0}))}canDelValue(e,t){return w(this,null,(function*(){return!0}))}},e.broadcastTransactionChanges=C,e.hasStoreInStorage=D,e.loadStoreFromStorage=R},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBasePersisterPartyKitServer={});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.8",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -227,10 +227,10 @@
|
|
|
227
227
|
"@types/asciichart": "^1.5.8",
|
|
228
228
|
"@types/expect-puppeteer": "^5.0.6",
|
|
229
229
|
"@types/http-server": "^0.12.4",
|
|
230
|
-
"@types/jest": "^29.5.
|
|
230
|
+
"@types/jest": "^29.5.11",
|
|
231
231
|
"@types/jest-environment-puppeteer": "^5.0.6",
|
|
232
232
|
"@types/less": "^3.0.6",
|
|
233
|
-
"@types/node": "^20.10.
|
|
233
|
+
"@types/node": "^20.10.4",
|
|
234
234
|
"@types/puppeteer": "^5.4.7",
|
|
235
235
|
"@types/react": "^18.2.42",
|
|
236
236
|
"@types/react-dom": "^18.2.17",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"babel-preset-minify": "^0.5.2",
|
|
249
249
|
"buffer-replace": "^1.0.0",
|
|
250
250
|
"country-flag-emoji-json": "^2.0.0",
|
|
251
|
-
"cspell": "^8.1.
|
|
251
|
+
"cspell": "^8.1.3",
|
|
252
252
|
"esbuild": "^0.19.8",
|
|
253
253
|
"eslint": "^8.55.0",
|
|
254
254
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -265,16 +265,16 @@
|
|
|
265
265
|
"jest": "^29.7.0",
|
|
266
266
|
"jest-environment-jsdom": "^29.7.0",
|
|
267
267
|
"jest-fetch-mock": "^3.0.3",
|
|
268
|
-
"jest-puppeteer": "^9.0.
|
|
268
|
+
"jest-puppeteer": "^9.0.2",
|
|
269
269
|
"less": "^4.2.0",
|
|
270
|
-
"partykit": "^0.0.
|
|
271
|
-
"partysocket": "^0.0.
|
|
270
|
+
"partykit": "^0.0.43",
|
|
271
|
+
"partysocket": "^0.0.17",
|
|
272
272
|
"prettier": "^3.1.0",
|
|
273
|
-
"puppeteer": "21.
|
|
273
|
+
"puppeteer": "21.6.0",
|
|
274
274
|
"react": "^18.2.0",
|
|
275
275
|
"react-dom": "^18.2.0",
|
|
276
276
|
"react-test-renderer": "^18.2.0",
|
|
277
|
-
"rollup": "^4.
|
|
277
|
+
"rollup": "^4.7.0",
|
|
278
278
|
"rollup-plugin-esbuild": "^6.1.0",
|
|
279
279
|
"rollup-plugin-gzip": "^3.1.0",
|
|
280
280
|
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
@@ -284,16 +284,16 @@
|
|
|
284
284
|
"tinydocs": "^0.1.33",
|
|
285
285
|
"tmp": "^0.2.1",
|
|
286
286
|
"ts-unused-exports": "^10.0.1",
|
|
287
|
-
"typescript": "5.3.
|
|
287
|
+
"typescript": "5.3.3",
|
|
288
288
|
"yjs": "^13.6.10"
|
|
289
289
|
},
|
|
290
290
|
"peerDependencies": {
|
|
291
291
|
"@sqlite.org/sqlite-wasm": "^3.44.2-build1",
|
|
292
292
|
"@vlcn.io/crsqlite-wasm": "^0.15.2",
|
|
293
293
|
"automerge-repo": "^0.1.0",
|
|
294
|
-
"partykit": "^0.0.
|
|
295
|
-
"partysocket": "^0.0.
|
|
296
|
-
"prettier": "^3.0
|
|
294
|
+
"partykit": "^0.0.43",
|
|
295
|
+
"partysocket": "^0.0.17",
|
|
296
|
+
"prettier": "^3.1.0",
|
|
297
297
|
"react": "^18.2.0",
|
|
298
298
|
"react-dom": "^18.2.0",
|
|
299
299
|
"sqlite3": "^5.1.6",
|
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><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-5"><em>NEW!</em> v4.5 release</a> <span id="one-with">"The One With Expo SQLite Next"</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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <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>!</li></ul><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/sqlite.svg"> SQLite</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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&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&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&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&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.5.
|
|
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><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-5"><em>NEW!</em> v4.5 release</a> <span id="one-with">"The One With Expo SQLite Next"</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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <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>!</li></ul><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/sqlite.svg"> SQLite</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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&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&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&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&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.5.8" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&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
|
const store = createStore()
|
|
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
247
247
|
};
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
<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'll only add a gzipped <em>5.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.3kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</em>, and everything is super fast. Life'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 width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>5.0kB</td><td>12.0kB</td><td>51.6kB</td><td>252.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>126.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.7kB</td><td>35.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.3kB</td><td>43.
|
|
250
|
+
<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'll only add a gzipped <em>5.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.3kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</em>, and everything is super fast. Life'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 width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>5.0kB</td><td>12.0kB</td><td>51.6kB</td><td>252.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>126.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.7kB</td><td>35.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.3kB</td><td>43.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.4kB</td><td>23.2kB</td><td>100.8kB</td><td>0.3kB</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>1,968</td><td>1,968</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,127</td><td>2,127</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>848</td><td>848</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>719</td><td>719</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,787</td></tr><tr><th class="right">Assertions</th><td colspan="3">17,909</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/expo" target="_blank"><img title="expo" src="https://github.com/expo.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/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/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/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/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/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.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/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/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/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.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/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/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>
|