tinybase 4.3.2 → 4.3.4
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-indexed-db.cjs +1 -1
- package/lib/cjs/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/debug/persisters/persister-indexed-db.js +6 -4
- package/lib/es6/persisters/persister-indexed-db.js +1 -1
- package/lib/es6/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/persisters/persister-indexed-db.js +1 -1
- package/lib/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd/persisters/persister-indexed-db.js +1 -1
- package/lib/umd/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-indexed-db.js +1 -1
- package/lib/umd-es6/persisters/persister-indexed-db.js.gz +0 -0
- package/package.json +3 -3
- package/readme.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=(t,a)=>t.map(a),a=(t,...a)=>t.push(...a),e=Promise,s=setInterval,n=clearInterval,o=t=>null==t,c=(t,a,e)=>o(t)?e?.():a(t),r=t=>new e(t),i=async t=>e.all(t),y=Object,
|
|
1
|
+
"use strict";const t=(t,a)=>t.map(a),a=(t,...a)=>t.push(...a),e=Promise,s=setInterval,n=clearInterval,o=t=>null==t,c=(t,a,e)=>o(t)?e?.():a(t),r=t=>new e(t),i=async t=>e.all(t),y=Object,d=y.keys,l=y.freeze,u=t=>(t=>t instanceof y&&t.constructor==y)(t)&&0==(t=>d(t).length)(t),w=t=>new Map(t),h=(t,a)=>t?.get(a),v=(t,a,e)=>{return o(e)?(s=t,n=a,s?.delete(n),t):t?.set(a,e);var s,n},p=(t,a,e)=>{var s,n;return s=t,n=a,s?.has(n)||v(t,a,e()),h(t,a)},g=w(),A=w(),S=globalThis.window,b=["t","v"],f={keyPath:"k"},L=async(e,s)=>{const n=((a,s)=>t(y.entries(a),(([t,a])=>j(e,"put",{k:t,v:a}))))(s);t(await j(e,"getAllKeys"),(t=>((t,a)=>!o(((t,a)=>c(t,(t=>t[a])))(t,a)))(s,t)?0:a(n,j(e,"delete",t)))),await i(n)},j=async(t,a,e)=>r(((s,n)=>{const o=t[a](e);o.onsuccess=()=>s(o.result),o.onerror=()=>n(`objectStore.${a} error`)}));exports.createIndexedDbPersister=(e,d,w=1,k)=>{const x=async(a,e=[],s=0)=>r(((n,o)=>{const c=S.indexedDB.open(d,s?2:void 0);c.onupgradeneeded=()=>s&&t(b,(t=>{try{c.result.createObjectStore(t,f)}catch{}})),c.onsuccess=async()=>{try{const s=c.result.transaction(b,"readwrite"),o=await i(t(b,(async(t,n)=>await a(s.objectStore(t),e[n]))));c.result.close(),n(o)}catch(t){o(t)}},c.onerror=()=>o("indexedDB.open error")}));return((t,e,s,n,r,i,y=[])=>{let d,w,S,b=0,f=0;p(g,y,(()=>0)),p(A,y,(()=>[]));const L=async t=>(2!=b&&(b=1,await j.schedule((async()=>{await t(),b=0}))),j),j={load:async(a,s)=>await L((async()=>{try{t.setContent(await e())}catch{t.setContent([a,s])}})),startAutoLoad:async(a={},s={})=>(j.stopAutoLoad(),await j.load(a,s),f=1,S=n((async(a,s)=>{if(s){const a=s();await L((async()=>t.setTransactionChanges(a)))}else await L((async()=>{try{t.setContent(a?.()??await e())}catch(t){i?.(t)}}))})),j),stopAutoLoad:()=>(f&&(r(S),S=void 0,f=0),j),save:async a=>(1!=b&&(b=2,await j.schedule((async()=>{try{await s(t.getContent,a)}catch(t){i?.(t)}b=0}))),j),startAutoSave:async()=>(await j.stopAutoSave().save(),d=t.addDidFinishTransactionListener(((t,a)=>{const[e,s]=a();u(e)&&u(s)||j.save((()=>[e,s]))})),j),stopAutoSave:()=>(c(d,t.delListener),j),schedule:async(...t)=>(a(h(A,y),...t),await(async()=>{if(!h(g,y)){for(v(g,y,1);!o((t=h(A,y),w=t.shift()));)try{await w()}catch(t){i?.(t)}v(g,y,0)}var t})(),j),getStore:()=>t,destroy:()=>j.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return l(j)})(e,(async()=>await x((async a=>((t=[])=>y.fromEntries(t))(t(await j(a,"getAll"),(({k:t,v:a})=>[t,a])))))),(async t=>await x((async(t,a)=>await L(t,a)),t(),1)),(t=>s(t,1e3*w)),(t=>n(t)),k)},exports.objectStoreMatch=L;
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=(e,t)=>e.map(t),t=(e,...t)=>e.push(...t),n=Promise,o=setInterval,l=clearInterval,r=e=>null==e,u=(e,t,n)=>r(e)?null==n?void 0:n():t(e),i=e=>new n(e),c=e=>{return t=function*(){return n.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},d=Object,s=d.keys,a=d.freeze,v=e=>(e=>e instanceof d&&e.constructor==d)(e)&&0==(e=>s(e).length)(e),y=e=>new Map(e),f=(e,t)=>null==e?void 0:e.get(t),h=(e,t,n)=>{return r(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},p=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||h(e,t,n()),f(e,t)};var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const x=y(),g=y();var A=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const S=globalThis.window,m=["t","v"],P={keyPath:"k"},b=(n,o)=>A(void 0,null,(function*(){const l=((t,o)=>e(d.entries(t),(([e,t])=>L(n,"put",{k:e,v:t}))))(o);e(yield L(n,"getAllKeys"),(e=>((e,t)=>!r(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,e)?0:t(l,L(n,"delete",e)))),yield c(l)})),L=(e,t,n)=>A(void 0,null,(function*(){return i(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))}));exports.createIndexedDbPersister=(n,s,y=1,j)=>{const k=(t,...n)=>A(void 0,[t,...n],(function*(t,n=[],o=0){return i(((l,r)=>{const u=S.indexedDB.open(s,
|
|
1
|
+
"use strict";const e=(e,t)=>e.map(t),t=(e,...t)=>e.push(...t),n=Promise,o=setInterval,l=clearInterval,r=e=>null==e,u=(e,t,n)=>r(e)?null==n?void 0:n():t(e),i=e=>new n(e),c=e=>{return t=function*(){return n.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},d=Object,s=d.keys,a=d.freeze,v=e=>(e=>e instanceof d&&e.constructor==d)(e)&&0==(e=>s(e).length)(e),y=e=>new Map(e),f=(e,t)=>null==e?void 0:e.get(t),h=(e,t,n)=>{return r(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},p=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||h(e,t,n()),f(e,t)};var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const x=y(),g=y();var A=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const S=globalThis.window,m=["t","v"],P={keyPath:"k"},b=(n,o)=>A(void 0,null,(function*(){const l=((t,o)=>e(d.entries(t),(([e,t])=>L(n,"put",{k:e,v:t}))))(o);e(yield L(n,"getAllKeys"),(e=>((e,t)=>!r(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,e)?0:t(l,L(n,"delete",e)))),yield c(l)})),L=(e,t,n)=>A(void 0,null,(function*(){return i(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))}));exports.createIndexedDbPersister=(n,s,y=1,j)=>{const k=(t,...n)=>A(void 0,[t,...n],(function*(t,n=[],o=0){return i(((l,r)=>{const u=S.indexedDB.open(s,o?2:void 0);u.onupgradeneeded=()=>o&&e(m,(e=>{try{u.result.createObjectStore(e,P)}catch(e){}})),u.onsuccess=()=>A(void 0,null,(function*(){try{const o=u.result.transaction(m,"readwrite"),r=yield c(e(m,((e,l)=>A(void 0,null,(function*(){return yield t(o.objectStore(e),n[l])})))));u.result.close(),l(r)}catch(e){r(e)}})),u.onerror=()=>r("indexedDB.open error")}))}));return((e,n,o,l,i,c,d=[])=>{let s,y,A,S=0,m=0;p(x,d,(()=>0)),p(g,d,(()=>[]));const P=e=>w(void 0,null,(function*(){return 2!=S&&(S=1,yield b.schedule((()=>w(void 0,null,(function*(){yield e(),S=0}))))),b})),b={load:(t,o)=>w(void 0,null,(function*(){return yield P((()=>w(void 0,null,(function*(){try{e.setContent(yield n())}catch(n){e.setContent([t,o])}}))))})),startAutoLoad:(...t)=>w(void 0,[...t],(function*(t={},o={}){return b.stopAutoLoad(),yield b.load(t,o),m=1,A=l(((t,o)=>w(void 0,null,(function*(){if(o){const t=o();yield P((()=>w(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield P((()=>w(void 0,null,(function*(){var o;try{e.setContent(null!=(o=null==t?void 0:t())?o:yield n())}catch(e){null==c||c(e)}}))))})))),b})),stopAutoLoad:()=>(m&&(i(A),A=void 0,m=0),b),save:t=>w(void 0,null,(function*(){return 1!=S&&(S=2,yield b.schedule((()=>w(void 0,null,(function*(){try{yield o(e.getContent,t)}catch(e){null==c||c(e)}S=0}))))),b})),startAutoSave:()=>w(void 0,null,(function*(){return yield b.stopAutoSave().save(),s=e.addDidFinishTransactionListener(((e,t)=>{const[n,o]=t();v(n)&&v(o)||b.save((()=>[n,o]))})),b})),stopAutoSave:()=>(u(s,e.delListener),b),schedule:(...e)=>w(void 0,null,(function*(){return t(f(g,d),...e),yield w(void 0,null,(function*(){if(!f(x,d)){for(h(x,d,1);!r((e=f(g,d),y=e.shift()));)try{yield y()}catch(e){null==c||c(e)}h(x,d,0)}var e})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return a(b)})(n,(()=>A(void 0,null,(function*(){return yield k((t=>A(void 0,null,(function*(){return((e=[])=>d.fromEntries(e))(e(yield L(t,"getAll"),(({k:e,v:t})=>[e,t])))}))))}))),(e=>A(void 0,null,(function*(){return yield k(((e,t)=>A(void 0,null,(function*(){return yield b(e,t)}))),e(),1)}))),(e=>o(e,1e3*y)),(e=>l(e)),j)},exports.objectStoreMatch=b;
|
|
Binary file
|
|
@@ -210,12 +210,14 @@ const createIndexedDbPersister = (
|
|
|
210
210
|
) => {
|
|
211
211
|
const forObjectStores = async (forObjectStore, args = [], create = 0) =>
|
|
212
212
|
promiseNew((resolve, reject) => {
|
|
213
|
-
const request = WINDOW.indexedDB.open(dbName,
|
|
213
|
+
const request = WINDOW.indexedDB.open(dbName, create ? 2 : void 0);
|
|
214
214
|
request.onupgradeneeded = () =>
|
|
215
215
|
create &&
|
|
216
|
-
arrayMap(OBJECT_STORE_NAMES, (objectStoreName) =>
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
arrayMap(OBJECT_STORE_NAMES, (objectStoreName) => {
|
|
217
|
+
try {
|
|
218
|
+
request.result.createObjectStore(objectStoreName, KEY_PATH);
|
|
219
|
+
} catch {}
|
|
220
|
+
});
|
|
219
221
|
request.onsuccess = async () => {
|
|
220
222
|
try {
|
|
221
223
|
const transaction = request.result.transaction(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(e,t)=>e.map(t),t=(e,...t)=>e.push(...t),n=Promise,o=setInterval,l=clearInterval,r=e=>null==e,u=(e,t,n)=>r(e)?null==n?void 0:n():t(e),i=e=>new n(e),d=e=>{return t=function*(){return n.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},c=Object,s=c.keys,a=c.freeze,v=e=>(e=>e instanceof c&&e.constructor==c)(e)&&0==(e=>s(e).length)(e),y=e=>new Map(e),f=(e,t)=>null==e?void 0:e.get(t),h=(e,t,n)=>{return r(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},p=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||h(e,t,n()),f(e,t)};var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const g=y(),A=y();var m=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const x=globalThis.window,S=["t","v"],P={keyPath:"k"},L=(n,o)=>m(void 0,null,(function*(){const l=((t,o)=>e(c.entries(t),(([e,t])=>b(n,"put",{k:e,v:t}))))(o);e(yield b(n,"getAllKeys"),(e=>((e,t)=>!r(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,e)?0:t(l,b(n,"delete",e)))),yield d(l)})),b=(e,t,n)=>m(void 0,null,(function*(){return i(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))})),k=(n,s,y=1,k)=>{const C=(t,...n)=>m(void 0,[t,...n],(function*(t,n=[],o=0){return i(((l,r)=>{const u=x.indexedDB.open(s,
|
|
1
|
+
const e=(e,t)=>e.map(t),t=(e,...t)=>e.push(...t),n=Promise,o=setInterval,l=clearInterval,r=e=>null==e,u=(e,t,n)=>r(e)?null==n?void 0:n():t(e),i=e=>new n(e),d=e=>{return t=function*(){return n.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},c=Object,s=c.keys,a=c.freeze,v=e=>(e=>e instanceof c&&e.constructor==c)(e)&&0==(e=>s(e).length)(e),y=e=>new Map(e),f=(e,t)=>null==e?void 0:e.get(t),h=(e,t,n)=>{return r(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},p=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||h(e,t,n()),f(e,t)};var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const g=y(),A=y();var m=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{i(n.next(e))}catch(e){l(e)}},u=e=>{try{i(n.throw(e))}catch(e){l(e)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,u);i((n=n.apply(e,t)).next())}));const x=globalThis.window,S=["t","v"],P={keyPath:"k"},L=(n,o)=>m(void 0,null,(function*(){const l=((t,o)=>e(c.entries(t),(([e,t])=>b(n,"put",{k:e,v:t}))))(o);e(yield b(n,"getAllKeys"),(e=>((e,t)=>!r(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,e)?0:t(l,b(n,"delete",e)))),yield d(l)})),b=(e,t,n)=>m(void 0,null,(function*(){return i(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))})),k=(n,s,y=1,k)=>{const C=(t,...n)=>m(void 0,[t,...n],(function*(t,n=[],o=0){return i(((l,r)=>{const u=x.indexedDB.open(s,o?2:void 0);u.onupgradeneeded=()=>o&&e(S,(e=>{try{u.result.createObjectStore(e,P)}catch(e){}})),u.onsuccess=()=>m(void 0,null,(function*(){try{const o=u.result.transaction(S,"readwrite"),r=yield d(e(S,((e,l)=>m(void 0,null,(function*(){return yield t(o.objectStore(e),n[l])})))));u.result.close(),l(r)}catch(e){r(e)}})),u.onerror=()=>r("indexedDB.open error")}))}));return((e,n,o,l,i,d,c=[])=>{let s,y,m,x=0,S=0;p(g,c,(()=>0)),p(A,c,(()=>[]));const P=e=>w(void 0,null,(function*(){return 2!=x&&(x=1,yield L.schedule((()=>w(void 0,null,(function*(){yield e(),x=0}))))),L})),L={load:(t,o)=>w(void 0,null,(function*(){return yield P((()=>w(void 0,null,(function*(){try{e.setContent(yield n())}catch(n){e.setContent([t,o])}}))))})),startAutoLoad:(...t)=>w(void 0,[...t],(function*(t={},o={}){return L.stopAutoLoad(),yield L.load(t,o),S=1,m=l(((t,o)=>w(void 0,null,(function*(){if(o){const t=o();yield P((()=>w(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield P((()=>w(void 0,null,(function*(){var o;try{e.setContent(null!=(o=null==t?void 0:t())?o:yield n())}catch(e){null==d||d(e)}}))))})))),L})),stopAutoLoad:()=>(S&&(i(m),m=void 0,S=0),L),save:t=>w(void 0,null,(function*(){return 1!=x&&(x=2,yield L.schedule((()=>w(void 0,null,(function*(){try{yield o(e.getContent,t)}catch(e){null==d||d(e)}x=0}))))),L})),startAutoSave:()=>w(void 0,null,(function*(){return yield L.stopAutoSave().save(),s=e.addDidFinishTransactionListener(((e,t)=>{const[n,o]=t();v(n)&&v(o)||L.save((()=>[n,o]))})),L})),stopAutoSave:()=>(u(s,e.delListener),L),schedule:(...e)=>w(void 0,null,(function*(){return t(f(A,c),...e),yield w(void 0,null,(function*(){if(!f(g,c)){for(h(g,c,1);!r((e=f(A,c),y=e.shift()));)try{yield y()}catch(e){null==d||d(e)}h(g,c,0)}var e})),L})),getStore:()=>e,destroy:()=>L.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return a(L)})(n,(()=>m(void 0,null,(function*(){return yield C((t=>m(void 0,null,(function*(){return((e=[])=>c.fromEntries(e))(e(yield b(t,"getAll"),(({k:e,v:t})=>[e,t])))}))))}))),(e=>m(void 0,null,(function*(){return yield C(((e,t)=>m(void 0,null,(function*(){return yield L(e,t)}))),e(),1)}))),(e=>o(e,1e3*y)),(e=>l(e)),k)};export{k as createIndexedDbPersister,L as objectStoreMatch};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=(t,a)=>t.map(a),a=(t,...a)=>t.push(...a),e=Promise,s=setInterval,n=clearInterval,o=t=>null==t,c=(t,a,e)=>o(t)?e?.():a(t),r=t=>new e(t),i=async t=>e.all(t),y=Object,l=y.keys,d=y.freeze,u=t=>(t=>t instanceof y&&t.constructor==y)(t)&&0==(t=>l(t).length)(t),w=t=>new Map(t),h=(t,a)=>t?.get(a),v=(t,a,e)=>{return o(e)?(s=t,n=a,s?.delete(n),t):t?.set(a,e);var s,n},p=(t,a,e)=>{var s,n;return s=t,n=a,s?.has(n)||v(t,a,e()),h(t,a)},g=w(),A=w(),S=globalThis.window,f=["t","v"],L={keyPath:"k"},b=async(e,s)=>{const n=((a,s)=>t(y.entries(a),(([t,a])=>k(e,"put",{k:t,v:a}))))(s);t(await k(e,"getAllKeys"),(t=>((t,a)=>!o(((t,a)=>c(t,(t=>t[a])))(t,a)))(s,t)?0:a(n,k(e,"delete",t)))),await i(n)},k=async(t,a,e)=>r(((s,n)=>{const o=t[a](e);o.onsuccess=()=>s(o.result),o.onerror=()=>n(`objectStore.${a} error`)})),C=(e,l,w=1,C)=>{const j=async(a,e=[],s=0)=>r(((n,o)=>{const c=S.indexedDB.open(l,
|
|
1
|
+
const t=(t,a)=>t.map(a),a=(t,...a)=>t.push(...a),e=Promise,s=setInterval,n=clearInterval,o=t=>null==t,c=(t,a,e)=>o(t)?e?.():a(t),r=t=>new e(t),i=async t=>e.all(t),y=Object,l=y.keys,d=y.freeze,u=t=>(t=>t instanceof y&&t.constructor==y)(t)&&0==(t=>l(t).length)(t),w=t=>new Map(t),h=(t,a)=>t?.get(a),v=(t,a,e)=>{return o(e)?(s=t,n=a,s?.delete(n),t):t?.set(a,e);var s,n},p=(t,a,e)=>{var s,n;return s=t,n=a,s?.has(n)||v(t,a,e()),h(t,a)},g=w(),A=w(),S=globalThis.window,f=["t","v"],L={keyPath:"k"},b=async(e,s)=>{const n=((a,s)=>t(y.entries(a),(([t,a])=>k(e,"put",{k:t,v:a}))))(s);t(await k(e,"getAllKeys"),(t=>((t,a)=>!o(((t,a)=>c(t,(t=>t[a])))(t,a)))(s,t)?0:a(n,k(e,"delete",t)))),await i(n)},k=async(t,a,e)=>r(((s,n)=>{const o=t[a](e);o.onsuccess=()=>s(o.result),o.onerror=()=>n(`objectStore.${a} error`)})),C=(e,l,w=1,C)=>{const j=async(a,e=[],s=0)=>r(((n,o)=>{const c=S.indexedDB.open(l,s?2:void 0);c.onupgradeneeded=()=>s&&t(f,(t=>{try{c.result.createObjectStore(t,L)}catch{}})),c.onsuccess=async()=>{try{const s=c.result.transaction(f,"readwrite"),o=await i(t(f,(async(t,n)=>await a(s.objectStore(t),e[n]))));c.result.close(),n(o)}catch(t){o(t)}},c.onerror=()=>o("indexedDB.open error")}));return((t,e,s,n,r,i,y=[])=>{let l,w,S,f=0,L=0;p(g,y,(()=>0)),p(A,y,(()=>[]));const b=async t=>(2!=f&&(f=1,await k.schedule((async()=>{await t(),f=0}))),k),k={load:async(a,s)=>await b((async()=>{try{t.setContent(await e())}catch{t.setContent([a,s])}})),startAutoLoad:async(a={},s={})=>(k.stopAutoLoad(),await k.load(a,s),L=1,S=n((async(a,s)=>{if(s){const a=s();await b((async()=>t.setTransactionChanges(a)))}else await b((async()=>{try{t.setContent(a?.()??await e())}catch(t){i?.(t)}}))})),k),stopAutoLoad:()=>(L&&(r(S),S=void 0,L=0),k),save:async a=>(1!=f&&(f=2,await k.schedule((async()=>{try{await s(t.getContent,a)}catch(t){i?.(t)}f=0}))),k),startAutoSave:async()=>(await k.stopAutoSave().save(),l=t.addDidFinishTransactionListener(((t,a)=>{const[e,s]=a();u(e)&&u(s)||k.save((()=>[e,s]))})),k),stopAutoSave:()=>(c(l,t.delListener),k),schedule:async(...t)=>(a(h(A,y),...t),await(async()=>{if(!h(g,y)){for(v(g,y,1);!o((t=h(A,y),w=t.shift()));)try{await w()}catch(t){i?.(t)}v(g,y,0)}var t})(),k),getStore:()=>t,destroy:()=>k.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return d(k)})(e,(async()=>await j((async a=>((t=[])=>y.fromEntries(t))(t(await k(a,"getAll"),(({k:t,v:a})=>[t,a])))))),(async t=>await j((async(t,a)=>await b(t,a)),t(),1)),(t=>s(t,1e3*w)),(t=>n(t)),C)};export{C as createIndexedDbPersister,b as objectStoreMatch};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e;t=this,e=function(t){"use strict";const e=(t,e)=>t.map(e),a=(t,...e)=>t.push(...e),s=Promise,n=setInterval,o=clearInterval,
|
|
1
|
+
var t,e;t=this,e=function(t){"use strict";const e=(t,e)=>t.map(e),a=(t,...e)=>t.push(...e),s=Promise,n=setInterval,o=clearInterval,c=t=>null==t,r=(t,e,a)=>c(t)?a?.():e(t),i=t=>new s(t),d=async t=>s.all(t),y=Object,l=y.keys,u=y.freeze,w=t=>(t=>t instanceof y&&t.constructor==y)(t)&&0==(t=>l(t).length)(t),h=t=>new Map(t),p=(t,e)=>t?.get(e),f=(t,e,a)=>{return c(a)?(s=t,n=e,s?.delete(n),t):t?.set(e,a);var s,n},v=(t,e,a)=>{var s,n;return s=t,n=e,s?.has(n)||f(t,e,a()),p(t,e)},g=h(),b=h(),A=globalThis.window,S=["t","v"],x={keyPath:"k"},j=async(t,s)=>{const n=((a,s)=>e(y.entries(a),(([e,a])=>L(t,"put",{k:e,v:a}))))(s);e(await L(t,"getAllKeys"),(e=>((t,e)=>!c(((t,e)=>r(t,(t=>t[e])))(t,e)))(s,e)?0:a(n,L(t,"delete",e)))),await d(n)},L=async(t,e,a)=>i(((s,n)=>{const o=t[e](a);o.onsuccess=()=>s(o.result),o.onerror=()=>n(`objectStore.${e} error`)}));t.createIndexedDbPersister=(t,s,l=1,h)=>{const T=async(t,a=[],n=0)=>i(((o,c)=>{const r=A.indexedDB.open(s,n?2:void 0);r.onupgradeneeded=()=>n&&e(S,(t=>{try{r.result.createObjectStore(t,x)}catch{}})),r.onsuccess=async()=>{try{const s=r.result.transaction(S,"readwrite"),n=await d(e(S,(async(e,n)=>await t(s.objectStore(e),a[n]))));r.result.close(),o(n)}catch(t){c(t)}},r.onerror=()=>c("indexedDB.open error")}));return((t,e,s,n,o,i,d=[])=>{let y,l,h,A=0,S=0;v(g,d,(()=>0)),v(b,d,(()=>[]));const x=async t=>(2!=A&&(A=1,await j.schedule((async()=>{await t(),A=0}))),j),j={load:async(a,s)=>await x((async()=>{try{t.setContent(await e())}catch{t.setContent([a,s])}})),startAutoLoad:async(a={},s={})=>(j.stopAutoLoad(),await j.load(a,s),S=1,h=n((async(a,s)=>{if(s){const e=s();await x((async()=>t.setTransactionChanges(e)))}else await x((async()=>{try{t.setContent(a?.()??await e())}catch(t){i?.(t)}}))})),j),stopAutoLoad:()=>(S&&(o(h),h=void 0,S=0),j),save:async e=>(1!=A&&(A=2,await j.schedule((async()=>{try{await s(t.getContent,e)}catch(t){i?.(t)}A=0}))),j),startAutoSave:async()=>(await j.stopAutoSave().save(),y=t.addDidFinishTransactionListener(((t,e)=>{const[a,s]=e();w(a)&&w(s)||j.save((()=>[a,s]))})),j),stopAutoSave:()=>(r(y,t.delListener),j),schedule:async(...t)=>(a(p(b,d),...t),await(async()=>{if(!p(g,d)){for(f(g,d,1);!c((t=p(b,d),l=t.shift()));)try{await l()}catch(t){i?.(t)}f(g,d,0)}var t})(),j),getStore:()=>t,destroy:()=>j.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return u(j)})(t,(async()=>await T((async t=>((t=[])=>y.fromEntries(t))(e(await L(t,"getAll"),(({k:t,v:e})=>[t,e])))))),(async t=>await T((async(t,e)=>await j(t,e)),t(),1)),(t=>n(t,1e3*l)),(t=>o(t)),h)},t.objectStoreMatch=j},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TinyBasePersisterIndexedDb={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=(e,t)=>e.map(t),n=(e,...t)=>e.push(...t),o=Promise,l=setInterval,r=clearInterval,i=e=>null==e,u=(e,t,n)=>i(e)?null==n?void 0:n():t(e),d=e=>new o(e),s=e=>{return t=function*(){return o.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},c=Object,a=c.keys,v=c.freeze,y=e=>(e=>e instanceof c&&e.constructor==c)(e)&&0==(e=>a(e).length)(e),f=e=>new Map(e),h=(e,t)=>null==e?void 0:e.get(t),p=(e,t,n)=>{return i(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},x=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||p(e,t,n()),h(e,t)};var g=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{u(n.next(e))}catch(e){l(e)}},i=e=>{try{u(n.throw(e))}catch(e){l(e)}},u=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);u((n=n.apply(e,t)).next())}));const b=f(),m=f();var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{u(n.next(e))}catch(e){l(e)}},i=e=>{try{u(n.throw(e))}catch(e){l(e)}},u=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);u((n=n.apply(e,t)).next())}));const A=globalThis.window,P=["t","v"],S={keyPath:"k"},j=(e,o)=>w(void 0,null,(function*(){const l=((n,o)=>t(c.entries(n),(([t,n])=>L(e,"put",{k:t,v:n}))))(o);t(yield L(e,"getAllKeys"),(t=>((e,t)=>!i(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,t)?0:n(l,L(e,"delete",t)))),yield s(l)})),L=(e,t,n)=>w(void 0,null,(function*(){return d(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))}));e.createIndexedDbPersister=(e,o,a=1,f)=>{const T=(e,...n)=>w(void 0,[e,...n],(function*(e,n=[],l=0){return d(((r,i)=>{const u=A.indexedDB.open(o,
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=(e,t)=>e.map(t),n=(e,...t)=>e.push(...t),o=Promise,l=setInterval,r=clearInterval,i=e=>null==e,u=(e,t,n)=>i(e)?null==n?void 0:n():t(e),d=e=>new o(e),s=e=>{return t=function*(){return o.all(e)},new Promise(((e,n)=>{var o=e=>{try{r(t.next(e))}catch(e){n(e)}},l=e=>{try{r(t.throw(e))}catch(e){n(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,l);r((t=t.apply(void 0,null)).next())}));var t},c=Object,a=c.keys,v=c.freeze,y=e=>(e=>e instanceof c&&e.constructor==c)(e)&&0==(e=>a(e).length)(e),f=e=>new Map(e),h=(e,t)=>null==e?void 0:e.get(t),p=(e,t,n)=>{return i(n)?(l=t,null==(o=e)||o.delete(l),e):null==e?void 0:e.set(t,n);var o,l},x=(e,t,n)=>{var o,l,r;return l=t,null!=(r=null==(o=e)?void 0:o.has(l))&&r||p(e,t,n()),h(e,t)};var g=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{u(n.next(e))}catch(e){l(e)}},i=e=>{try{u(n.throw(e))}catch(e){l(e)}},u=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);u((n=n.apply(e,t)).next())}));const b=f(),m=f();var w=(e,t,n)=>new Promise(((o,l)=>{var r=e=>{try{u(n.next(e))}catch(e){l(e)}},i=e=>{try{u(n.throw(e))}catch(e){l(e)}},u=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);u((n=n.apply(e,t)).next())}));const A=globalThis.window,P=["t","v"],S={keyPath:"k"},j=(e,o)=>w(void 0,null,(function*(){const l=((n,o)=>t(c.entries(n),(([t,n])=>L(e,"put",{k:t,v:n}))))(o);t(yield L(e,"getAllKeys"),(t=>((e,t)=>!i(((e,t)=>u(e,(e=>e[t])))(e,t)))(o,t)?0:n(l,L(e,"delete",t)))),yield s(l)})),L=(e,t,n)=>w(void 0,null,(function*(){return d(((o,l)=>{const r=e[t](n);r.onsuccess=()=>o(r.result),r.onerror=()=>l(`objectStore.${t} error`)}))}));e.createIndexedDbPersister=(e,o,a=1,f)=>{const T=(e,...n)=>w(void 0,[e,...n],(function*(e,n=[],l=0){return d(((r,i)=>{const u=A.indexedDB.open(o,l?2:void 0);u.onupgradeneeded=()=>l&&t(P,(e=>{try{u.result.createObjectStore(e,S)}catch(e){}})),u.onsuccess=()=>w(void 0,null,(function*(){try{const o=u.result.transaction(P,"readwrite"),l=yield s(t(P,((t,l)=>w(void 0,null,(function*(){return yield e(o.objectStore(t),n[l])})))));u.result.close(),r(l)}catch(e){i(e)}})),u.onerror=()=>i("indexedDB.open error")}))}));return((e,t,o,l,r,d,s=[])=>{let c,a,f,w=0,A=0;x(b,s,(()=>0)),x(m,s,(()=>[]));const P=e=>g(void 0,null,(function*(){return 2!=w&&(w=1,yield S.schedule((()=>g(void 0,null,(function*(){yield e(),w=0}))))),S})),S={load:(n,o)=>g(void 0,null,(function*(){return yield P((()=>g(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([n,o])}}))))})),startAutoLoad:(...n)=>g(void 0,[...n],(function*(n={},o={}){return S.stopAutoLoad(),yield S.load(n,o),A=1,f=l(((n,o)=>g(void 0,null,(function*(){if(o){const t=o();yield P((()=>g(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield P((()=>g(void 0,null,(function*(){var o;try{e.setContent(null!=(o=null==n?void 0:n())?o:yield t())}catch(e){null==d||d(e)}}))))})))),S})),stopAutoLoad:()=>(A&&(r(f),f=void 0,A=0),S),save:t=>g(void 0,null,(function*(){return 1!=w&&(w=2,yield S.schedule((()=>g(void 0,null,(function*(){try{yield o(e.getContent,t)}catch(e){null==d||d(e)}w=0}))))),S})),startAutoSave:()=>g(void 0,null,(function*(){return yield S.stopAutoSave().save(),c=e.addDidFinishTransactionListener(((e,t)=>{const[n,o]=t();y(n)&&y(o)||S.save((()=>[n,o]))})),S})),stopAutoSave:()=>(u(c,e.delListener),S),schedule:(...e)=>g(void 0,null,(function*(){return n(h(m,s),...e),yield g(void 0,null,(function*(){if(!h(b,s)){for(p(b,s,1);!i((e=h(m,s),a=e.shift()));)try{yield a()}catch(e){null==d||d(e)}p(b,s,0)}var e})),S})),getStore:()=>e,destroy:()=>S.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return v(S)})(e,(()=>w(void 0,null,(function*(){return yield T((e=>w(void 0,null,(function*(){return((e=[])=>c.fromEntries(e))(t(yield L(e,"getAll"),(({k:e,v:t})=>[e,t])))}))))}))),(e=>w(void 0,null,(function*(){return yield T(((e,t)=>w(void 0,null,(function*(){return yield j(e,t)}))),e(),1)}))),(e=>l(e,1e3*a)),(e=>r(e)),f)},e.objectStoreMatch=j},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBasePersisterIndexedDb={});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -289,8 +289,8 @@
|
|
|
289
289
|
"@sqlite.org/sqlite-wasm": "^3.43.1-build1",
|
|
290
290
|
"@vlcn.io/crsqlite-wasm": "^0.15.2",
|
|
291
291
|
"automerge-repo": "^0.1.0",
|
|
292
|
-
"partykit": "^0.0.
|
|
293
|
-
"partysocket": "^0.0.
|
|
292
|
+
"partykit": "^0.0.20",
|
|
293
|
+
"partysocket": "^0.0.8",
|
|
294
294
|
"prettier": "^3.0.3",
|
|
295
295
|
"react": "^18.2.0",
|
|
296
296
|
"react-dom": "^18.2.0",
|
package/readme.md
CHANGED
|
@@ -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>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</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>4.8kB</td><td>11.4kB</td><td>48.7kB</td><td>220.1kB</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.1kB</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.2kB</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.6kB</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.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.7kB</td><td>1.5kB</td><td>5.1kB</td><td>43.4kB</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.2kB</td><td>22.5kB</td><td>97.5kB</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,880</td><td>1,880</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,034</td><td>2,034</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>811</td><td>811</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>689</td><td>689</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,365</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,251</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><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.3.
|
|
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>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</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>4.8kB</td><td>11.4kB</td><td>48.7kB</td><td>220.1kB</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.1kB</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.2kB</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.6kB</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.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.7kB</td><td>1.5kB</td><td>5.1kB</td><td>43.4kB</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.2kB</td><td>22.5kB</td><td>97.5kB</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,880</td><td>1,880</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,034</td><td>2,034</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>811</td><td>811</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>689</td><td>689</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,365</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,251</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><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.3.4">NPM</a>.</li></ul></section><section><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>
|