tinybase 4.3.7 → 4.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/lib/checkpoints.js +1 -1
  2. package/lib/checkpoints.js.gz +0 -0
  3. package/lib/cjs/checkpoints.cjs +1 -1
  4. package/lib/cjs/checkpoints.cjs.gz +0 -0
  5. package/lib/cjs/indexes.cjs +1 -1
  6. package/lib/cjs/indexes.cjs.gz +0 -0
  7. package/lib/cjs/metrics.cjs +1 -1
  8. package/lib/cjs/metrics.cjs.gz +0 -0
  9. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  10. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  11. package/lib/cjs/persisters/persister-expo-sqlite.cjs +1 -1
  12. package/lib/cjs/persisters/persister-expo-sqlite.cjs.gz +0 -0
  13. package/lib/cjs/persisters/persister-indexed-db.cjs +1 -1
  14. package/lib/cjs/persisters/persister-indexed-db.cjs.gz +0 -0
  15. package/lib/cjs/persisters/persister-partykit-client.cjs +1 -1
  16. package/lib/cjs/persisters/persister-partykit-client.cjs.gz +0 -0
  17. package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
  18. package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
  19. package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
  20. package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  21. package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
  22. package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
  23. package/lib/cjs/persisters/persister-yjs.cjs +1 -1
  24. package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
  25. package/lib/cjs/queries.cjs +1 -1
  26. package/lib/cjs/queries.cjs.gz +0 -0
  27. package/lib/cjs/relationships.cjs +1 -1
  28. package/lib/cjs/relationships.cjs.gz +0 -0
  29. package/lib/cjs/store.cjs +1 -1
  30. package/lib/cjs/store.cjs.gz +0 -0
  31. package/lib/cjs/tinybase.cjs +1 -1
  32. package/lib/cjs/tinybase.cjs.gz +0 -0
  33. package/lib/cjs/tools.cjs +1 -1
  34. package/lib/cjs/tools.cjs.gz +0 -0
  35. package/lib/cjs/ui-react-dom-debug.cjs +1 -1
  36. package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
  37. package/lib/cjs/ui-react.cjs +1 -1
  38. package/lib/cjs/ui-react.cjs.gz +0 -0
  39. package/lib/cjs-es6/checkpoints.cjs +1 -1
  40. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  41. package/lib/cjs-es6/indexes.cjs +1 -1
  42. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  43. package/lib/cjs-es6/metrics.cjs +1 -1
  44. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  45. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  46. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  47. package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs +1 -1
  48. package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs.gz +0 -0
  49. package/lib/cjs-es6/persisters/persister-indexed-db.cjs +1 -1
  50. package/lib/cjs-es6/persisters/persister-indexed-db.cjs.gz +0 -0
  51. package/lib/cjs-es6/persisters/persister-partykit-client.cjs +1 -1
  52. package/lib/cjs-es6/persisters/persister-partykit-client.cjs.gz +0 -0
  53. package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
  54. package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
  55. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
  56. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  57. package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
  58. package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
  59. package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -1
  60. package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
  61. package/lib/cjs-es6/queries.cjs +1 -1
  62. package/lib/cjs-es6/queries.cjs.gz +0 -0
  63. package/lib/cjs-es6/relationships.cjs +1 -1
  64. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  65. package/lib/cjs-es6/store.cjs +1 -1
  66. package/lib/cjs-es6/store.cjs.gz +0 -0
  67. package/lib/cjs-es6/tinybase.cjs +1 -1
  68. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  69. package/lib/cjs-es6/tools.cjs +1 -1
  70. package/lib/cjs-es6/tools.cjs.gz +0 -0
  71. package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
  72. package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
  73. package/lib/cjs-es6/ui-react.cjs +1 -1
  74. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  75. package/lib/debug/checkpoints.js +12 -12
  76. package/lib/debug/indexes.js +9 -9
  77. package/lib/debug/metrics.js +9 -9
  78. package/lib/debug/persisters/persister-automerge.js +6 -6
  79. package/lib/debug/persisters/persister-browser.js +2 -2
  80. package/lib/debug/persisters/persister-cr-sqlite-wasm.js +5 -5
  81. package/lib/debug/persisters/persister-expo-sqlite.js +5 -5
  82. package/lib/debug/persisters/persister-file.js +2 -2
  83. package/lib/debug/persisters/persister-indexed-db.js +6 -6
  84. package/lib/debug/persisters/persister-partykit-client.js +15 -5
  85. package/lib/debug/persisters/persister-partykit-server.js +44 -30
  86. package/lib/debug/persisters/persister-remote.js +2 -2
  87. package/lib/debug/persisters/persister-sqlite-wasm.js +5 -5
  88. package/lib/debug/persisters/persister-sqlite3.js +5 -5
  89. package/lib/debug/persisters/persister-yjs.js +9 -9
  90. package/lib/debug/persisters.js +2 -2
  91. package/lib/debug/queries.js +16 -15
  92. package/lib/debug/relationships.js +9 -9
  93. package/lib/debug/store.js +9 -9
  94. package/lib/debug/tinybase.js +16 -15
  95. package/lib/debug/tools.js +6 -7
  96. package/lib/debug/ui-react-dom.js +10 -10
  97. package/lib/debug/ui-react.js +2 -2
  98. package/lib/es6/checkpoints.js +1 -1
  99. package/lib/es6/checkpoints.js.gz +0 -0
  100. package/lib/es6/indexes.js +1 -1
  101. package/lib/es6/indexes.js.gz +0 -0
  102. package/lib/es6/metrics.js +1 -1
  103. package/lib/es6/metrics.js.gz +0 -0
  104. package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  105. package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  106. package/lib/es6/persisters/persister-expo-sqlite.js +1 -1
  107. package/lib/es6/persisters/persister-expo-sqlite.js.gz +0 -0
  108. package/lib/es6/persisters/persister-indexed-db.js +1 -1
  109. package/lib/es6/persisters/persister-indexed-db.js.gz +0 -0
  110. package/lib/es6/persisters/persister-partykit-client.js +1 -1
  111. package/lib/es6/persisters/persister-partykit-client.js.gz +0 -0
  112. package/lib/es6/persisters/persister-partykit-server.js +1 -1
  113. package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
  114. package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
  115. package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  116. package/lib/es6/persisters/persister-sqlite3.js +1 -1
  117. package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
  118. package/lib/es6/persisters/persister-yjs.js +1 -1
  119. package/lib/es6/persisters/persister-yjs.js.gz +0 -0
  120. package/lib/es6/queries.js +1 -1
  121. package/lib/es6/queries.js.gz +0 -0
  122. package/lib/es6/relationships.js +1 -1
  123. package/lib/es6/relationships.js.gz +0 -0
  124. package/lib/es6/store.js +1 -1
  125. package/lib/es6/store.js.gz +0 -0
  126. package/lib/es6/tinybase.js +1 -1
  127. package/lib/es6/tinybase.js.gz +0 -0
  128. package/lib/es6/tools.js +1 -1
  129. package/lib/es6/tools.js.gz +0 -0
  130. package/lib/es6/ui-react-dom-debug.js +1 -1
  131. package/lib/es6/ui-react-dom-debug.js.gz +0 -0
  132. package/lib/es6/ui-react.js +1 -1
  133. package/lib/es6/ui-react.js.gz +0 -0
  134. package/lib/indexes.js +1 -1
  135. package/lib/indexes.js.gz +0 -0
  136. package/lib/metrics.js +1 -1
  137. package/lib/metrics.js.gz +0 -0
  138. package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
  139. package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  140. package/lib/persisters/persister-expo-sqlite.js +1 -1
  141. package/lib/persisters/persister-expo-sqlite.js.gz +0 -0
  142. package/lib/persisters/persister-indexed-db.js +1 -1
  143. package/lib/persisters/persister-indexed-db.js.gz +0 -0
  144. package/lib/persisters/persister-partykit-client.js +1 -1
  145. package/lib/persisters/persister-partykit-client.js.gz +0 -0
  146. package/lib/persisters/persister-partykit-server.js +1 -1
  147. package/lib/persisters/persister-partykit-server.js.gz +0 -0
  148. package/lib/persisters/persister-sqlite-wasm.js +1 -1
  149. package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
  150. package/lib/persisters/persister-sqlite3.js +1 -1
  151. package/lib/persisters/persister-sqlite3.js.gz +0 -0
  152. package/lib/persisters/persister-yjs.js +1 -1
  153. package/lib/persisters/persister-yjs.js.gz +0 -0
  154. package/lib/queries.js +1 -1
  155. package/lib/queries.js.gz +0 -0
  156. package/lib/relationships.js +1 -1
  157. package/lib/relationships.js.gz +0 -0
  158. package/lib/store.js +1 -1
  159. package/lib/store.js.gz +0 -0
  160. package/lib/tinybase.js +1 -1
  161. package/lib/tinybase.js.gz +0 -0
  162. package/lib/tools.js +1 -1
  163. package/lib/tools.js.gz +0 -0
  164. package/lib/types/persisters/persister-partykit-client.d.ts +43 -4
  165. package/lib/types/persisters/persister-partykit-server.d.ts +66 -0
  166. package/lib/types/queries.d.ts +24 -0
  167. package/lib/types/with-schemas/persisters/persister-partykit-client.d.ts +44 -5
  168. package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +66 -0
  169. package/lib/types/with-schemas/queries.d.ts +24 -0
  170. package/lib/ui-react.js +1 -1
  171. package/lib/ui-react.js.gz +0 -0
  172. package/lib/umd/checkpoints.js +1 -1
  173. package/lib/umd/checkpoints.js.gz +0 -0
  174. package/lib/umd/indexes.js +1 -1
  175. package/lib/umd/indexes.js.gz +0 -0
  176. package/lib/umd/metrics.js +1 -1
  177. package/lib/umd/metrics.js.gz +0 -0
  178. package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
  179. package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  180. package/lib/umd/persisters/persister-expo-sqlite.js +1 -1
  181. package/lib/umd/persisters/persister-expo-sqlite.js.gz +0 -0
  182. package/lib/umd/persisters/persister-indexed-db.js +1 -1
  183. package/lib/umd/persisters/persister-indexed-db.js.gz +0 -0
  184. package/lib/umd/persisters/persister-partykit-client.js +1 -1
  185. package/lib/umd/persisters/persister-partykit-client.js.gz +0 -0
  186. package/lib/umd/persisters/persister-partykit-server.js +1 -1
  187. package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
  188. package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
  189. package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
  190. package/lib/umd/persisters/persister-sqlite3.js +1 -1
  191. package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
  192. package/lib/umd/persisters/persister-yjs.js +1 -1
  193. package/lib/umd/persisters/persister-yjs.js.gz +0 -0
  194. package/lib/umd/queries.js +1 -1
  195. package/lib/umd/queries.js.gz +0 -0
  196. package/lib/umd/relationships.js +1 -1
  197. package/lib/umd/relationships.js.gz +0 -0
  198. package/lib/umd/store.js +1 -1
  199. package/lib/umd/store.js.gz +0 -0
  200. package/lib/umd/tinybase.js +1 -1
  201. package/lib/umd/tinybase.js.gz +0 -0
  202. package/lib/umd/tools.js +1 -1
  203. package/lib/umd/tools.js.gz +0 -0
  204. package/lib/umd/ui-react-dom-debug.js +1 -1
  205. package/lib/umd/ui-react-dom-debug.js.gz +0 -0
  206. package/lib/umd/ui-react.js +1 -1
  207. package/lib/umd/ui-react.js.gz +0 -0
  208. package/lib/umd-es6/checkpoints.js +1 -1
  209. package/lib/umd-es6/checkpoints.js.gz +0 -0
  210. package/lib/umd-es6/indexes.js +1 -1
  211. package/lib/umd-es6/indexes.js.gz +0 -0
  212. package/lib/umd-es6/metrics.js +1 -1
  213. package/lib/umd-es6/metrics.js.gz +0 -0
  214. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  215. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  216. package/lib/umd-es6/persisters/persister-expo-sqlite.js +1 -1
  217. package/lib/umd-es6/persisters/persister-expo-sqlite.js.gz +0 -0
  218. package/lib/umd-es6/persisters/persister-indexed-db.js +1 -1
  219. package/lib/umd-es6/persisters/persister-indexed-db.js.gz +0 -0
  220. package/lib/umd-es6/persisters/persister-partykit-client.js +1 -1
  221. package/lib/umd-es6/persisters/persister-partykit-client.js.gz +0 -0
  222. package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
  223. package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
  224. package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
  225. package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  226. package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
  227. package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
  228. package/lib/umd-es6/persisters/persister-yjs.js +1 -1
  229. package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
  230. package/lib/umd-es6/queries.js +1 -1
  231. package/lib/umd-es6/queries.js.gz +0 -0
  232. package/lib/umd-es6/relationships.js +1 -1
  233. package/lib/umd-es6/relationships.js.gz +0 -0
  234. package/lib/umd-es6/store.js +1 -1
  235. package/lib/umd-es6/store.js.gz +0 -0
  236. package/lib/umd-es6/tinybase.js +1 -1
  237. package/lib/umd-es6/tinybase.js.gz +0 -0
  238. package/lib/umd-es6/tools.js +1 -1
  239. package/lib/umd-es6/tools.js.gz +0 -0
  240. package/lib/umd-es6/ui-react-dom-debug.js +1 -1
  241. package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
  242. package/lib/umd-es6/ui-react.js +1 -1
  243. package/lib/umd-es6/ui-react.js.gz +0 -0
  244. package/package.json +7 -7
  245. package/readme.md +2 -2
package/lib/tools.js CHANGED
@@ -1 +1 @@
1
- const e=e=>typeof e,t="tinybase",l="",a=",",n=e(l),o=e(!0),d=e(0),s="type",r="default",I="Listener",c="get",$="add",u="Ids",i="Table",p=i+"s",b=i+u,C="Row",h=C+u,m="Sorted"+C+u,g="Cell",f=g+u,w="Value",y=w+"s",T=w+u,v=Promise,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==n||e==o,S=t=>e(t)==n,P=e=>Array.isArray(e),A=(e,t,l)=>e.slice(t,l),E=async e=>v.all(e),D=t=>{const l=e(t);return k(l)||l==d&&V(t)?l:void 0},O=(e,t)=>e.every(t),N=(e,t)=>e.sort(t),G=(e,t)=>e.forEach(t),L=(e,t=l)=>e.join(t),j=(e,t)=>e.map(t),M=e=>e.length,J=(e,t)=>e.filter(t),z=(e,...t)=>e.push(...t),W=e=>e.pop(),B=(e,...t)=>e.unshift(...t),F=e=>e.shift(),U=Object,_=U.keys,Z=U.freeze,H=e=>x(e,U)&&e.constructor==U,Q=(e,t)=>j(U.entries(e),(([e,l])=>t(l,e))),q=e=>M(_(e)),K=e=>H(e)&&0==q(e),X=(e,t)=>e?.has(t)??!1,Y=e=>[...e?.values()??[]],ee=(e,t)=>e?.forEach(t),te=(e,t)=>e?.delete(t),le=e=>new Map(e),ae=(e,t)=>e?.get(t),ne=(e,t)=>ee(e,((e,l)=>t(l,e))),oe=(e,t)=>j([...e?.entries()??[]],(([e,l])=>t(l,e))),de=(e,t,l)=>R(l)?(te(e,t),e):e?.set(t,l),se=(e,t,l)=>(X(e,t)||de(e,t,l()),ae(e,t)),re=e=>e.toUpperCase(),Ie=e=>e.toLowerCase(),ce="a ",$e="A function for",ue=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",pe="Del",be="Deps",Ce=be+"?: React.DependencyList",he="doRollback?: DoRollback",me="actions: () => Return, "+he,ge="export",fe="Id",we="Invalid",ye="Json",Te=Ie(I),ve="?: ",Ve=" | undefined",xe="NonNullable",Re="Partial",ke="Props",Se="Provider",Pe=`Registers a ${Te} that will be called`,Ae="Represents",Ee="rowId: "+fe,De="Schema",Oe="Set",Ne=", descending?: boolean, offset?: number, limit?: number",Ge="[]",Le="the Store",je="Transaction",Me=je+"Changes",Je=Ie(je),ze="Execute a "+Je+" to make multiple mutations",We="Explicitly starts a "+Je,Be="Explicitly finishes a "+Je,Fe="the end of the "+Je,Ue="void",_e=" => "+Ue,Ze="WhenSet",He=" when setting it",Qe=ce+"string serialization of",qe=" ",Ke="Gets a callback that can ",Xe="the ",Ye=" the schema for",et=(e=0,t=0)=>`the ${mt[e]}content of`+(t?qe+Le:l),tt=(e=0,t,a=0)=>bt[t]+qe+et(e,1)+(a?" when setting it":l),lt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${et()} the '${e}' `+i,at=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,nt=(e,t)=>`Calls a function for each ${e} in `+t,ot=e=>"The props passed to a component that renders "+e,dt=e=>"A function that takes "+e,st=(e,t=0)=>$e+" listening to changes to "+ht[e]+" in "+ht[t],rt=(e,t,a=0)=>Pe+" whenever "+ht[e]+" in "+ht[t]+" change"+(a?l:"s"),It=e=>`the '${e}' `+i,ct=e=>"the specified Row in "+It(e),$t=(e,t=0)=>bt[t]+` ${et()} `+It(e),ut=(e,t=0)=>bt[t]+` ${et()} `+ct(e),it=(e,t,l=0)=>bt[l]+` the '${t}' Cell for `+ct(e),pt=(e,t=0)=>bt[t]+` the '${e}' Value`,bt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+Qe,"Sets "+Qe,Pe+" whenever",Ke+"set",Ke+"add",Ke+"set part of",Ke+"delete","Renders","Gets "+Qe+Ye,"Sets"+Ye,"Deletes"+Ye],Ct=[c,"has","set","del","set","forEach",$,l],ht=[Le,p,Xe+i+qe+u,ce+i,Xe+C+qe+u,ce+C,Xe+g+qe+u,ce+g,"invalid Cell changes",y,Xe+w+qe+u,ce+w,"invalid Value changes",Xe+"sorted "+C+qe+u,Xe+g+qe+u+" anywhere",Xe+"number of Rows"],mt=[l,"tabular ","keyed value "],gt=e=>new Set(P(e)||R(e)?e:[e]),ft=(e,t)=>e?.add(t),wt=/[^A-Za-z]+/,yt=/[^A-Za-z0-9]+/,Tt=/^( *)\/\*\* *(.*?) *\*\/$/gm,vt=e=>e.includes(a),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return X(e,n)?Vt(e,t,l,a+1):(de(e,n,l),n)},xt=e=>e.replace(Tt,((e,t,l)=>{const a=77-Rt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.length,kt=e=>e.flat(1e3),St=(e,t=0)=>L(j(e.split(yt),((e,l)=>(l>0||t?re:Ie)(A(e,0,1))+A(e,1)))),Pt=e=>re(L((e&&!wt.test(e[0])?e:" "+e).split(yt),"_")),At=e=>`/** ${e}. */`,Et=(...e)=>L(J(e,(e=>e)),", "),Dt=(...e)=>"{"+L(e,"; ")+"}",Ot=(...e)=>Dt(...j(e,(e=>"readonly "+e))),Nt=()=>{const e=[le(),le(),le(),le()],t=le(),a=le(),n=e=>{const t=e.indexOf(" as ");return-1!=t?A(e,t+4):e};return[(...e)=>L(kt(e),"\n"),(t,l,...a)=>G(a,(a=>G([0,1],(n=>(t??n)==n?ft(se(e[n],l,gt),a):0)))),(e,a,n,o=l,d=1)=>Vt(t,e,[a,n,o,d]),(e,t,l)=>Vt(a,e,P(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>ae(a,e)===t?e:Vt(a,e,t),(t=0)=>j([...N(oe(e[t],((e,t)=>`import {${L(N(Y(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),l],(e=>e.replace("{React}","React"))),()=>oe(t,(([e,t,a,n],o)=>[At(t),`${n?ge+" ":l}type ${o}${a} = ${e};`,l])),()=>oe(a,((e,t)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${t} = ${F(e)}`,e,l])))]},Gt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Lt=(e,t,l)=>[t=>Q(e,((e,a)=>t(a,St(a,1),l(Pt(a),`'${a}'`)))),(t,a)=>Q(e[t],((e,t)=>a(t,e[s],e[r],l(Pt(t),`'${t}'`),St(t,1)))),e=>Q(t,((t,a)=>e(a,t[s],t[r],l(Pt(a),`'${a}'`),St(a,1))))],jt=(e,t,a,n)=>[(n,o)=>{const d=n+": "+o,s=e(p,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...a(e,((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`)))+"}"))),tt(1,5)),r=e(p+Ze,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...a(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),tt(1,5,1)),c=e(i+fe,"keyof "+s,"A "+i+" Id in "+Le),$=`<TId extends ${c}>`,u=e(i,xe+`<${s}[TId]>`,"A "+i+" in "+Le,$),w=e(i+Ze,xe+`<${r}[TId]>`,"A "+i+" in "+Le+He,$),y=e(C,u+"<TId>[Id]","A "+C+" in a "+i,$),T=e(C+Ze,w+"<TId>[Id]","A "+C+" in a "+i+He,$),v=e(g+fe,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+C,$),V=e(g,xe+`<${s}[TId]>[Id][CId]`,"A "+g+" in a "+C,`<TId extends ${c}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+C,`<TId extends ${c}, CId = ${v}<TId>>`,0),k=e(g+ie,`(...[cellId, cell]: ${x}<TId>)`+_e,dt(ce+g+" Id, and "+g),$),S=e(C+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+_e+") "+_e,dt(ce+C+" Id, and a "+g+" iterator"),$),P=e(i+g+ie,`(cellId: ${v}<TId>, count: number) `+_e,dt(ce+g+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${c} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${_e}] : never`,i+" Ids and callback types",`<TId = ${c}>`,0),E=e(i+ie,`(...[tableId, forEachRow]: ${A})`+_e,dt(ce+i+" Id, and a "+C+" iterator"),l),D=e("TableIdRowIdCellIdArray",`TId extends ${c} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${c}>`,0),O=e("GetCellChange",`(...[tableId, rowId, cellId]: ${D}) => CellChange`,$e+" returning information about any Cell's changes during a "+Je),N=e(p+I,`(${d}, getCellChange: ${O}${Ve})`+_e,st(1)),G=e(b+I,`(${d})`+_e,st(2)),L=e(i+I,`(${d}, tableId: ${c}, getCellChange: ${O}${Ve})`+_e,st(3)),j=e(i+f+I,`(${d}, tableId: ${c})`+_e,st(14,3)),M=e(C+"Count"+I,`(${d}, tableId: ${c})`+_e,st(15,3)),J=e(h+I,`(${d}, tableId: ${c})`+_e,st(4,3)),z=e(m+I,"("+Et(d,"tableId: "+c,"cellId: Id"+Ve,"descending: boolean","offset: number","limit: number"+Ve,"sortedRowIds: Ids")+")"+_e,st(13,3)),W=e(C+I,"("+Et(""+d,"tableId: "+c,Ee,`getCellChange: ${O}${Ve}`)+")"+_e,st(5,3)),B=e(f+I,"("+Et(""+d,"tableId: "+c,Ee)+")"+_e,st(6,5)),F=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Ee}, cellId: CId, newCell: ${V}<TId, CId> ${Ve}, oldCell: ${V}<TId, CId> ${Ve}, getCellChange: ${O} ${Ve}] : never`,"Cell args for CellListener",`<TId extends ${c}, CId = ${v}<TId>>`,0),U=e("CellListenerArgsArrayOuter",`TId extends ${c} ? `+F+"<TId> : never","Table args for CellListener",`<TId = ${c}>`,0);return[s,r,c,u,w,y,T,v,V,k,S,P,E,N,G,L,j,M,J,z,W,B,e(g+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${U})`+_e,st(7,5)),e(we+g+I,`(${d}, tableId: Id, ${Ee}, cellId: Id, invalidCells: any[])`+_e,st(8))]},(t,a)=>{const o=t+": "+a,d=e(y,Dt(...n(((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`))),tt(2,5)),s=e(y+Ze,Dt(...n(((e,t)=>`'${e}'?: ${t}`))),tt(2,5,1)),r=e(w+fe,"keyof "+d,"A "+w+" Id in "+Le),c=e(w,xe+`<${d}[VId]>`,"A "+w+" Id in "+Le,`<VId extends ${r}>`),$=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${c}<VId>] : never`,w+" Ids and types in "+Le,`<VId = ${r}>`,0),u=e(w+ie,`(...[valueId, value]: ${$})`+_e,dt(ce+w+" Id, and "+w)),i=e("GetValueChange",`(valueId: ${r}) => ValueChange`,$e+" returning information about any Value's changes during a "+Je),p=e(y+I,`(${o}, getValueChange: ${i}${Ve})`+_e,st(9)),b=e(T+I,`(${o})`+_e,st(10)),C=e("ValueListenerArgsArray",`VId extends ${r} ? [${o}, valueId: VId, newValue: ${c}<VId> ${Ve}, oldValue: ${c}<VId> ${Ve}, getValueChange: ${i} ${Ve}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[d,s,r,c,u,p,b,e(w+I,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+_e,st(11)),e(we+w+I,`(${o}, valueId: Id, invalidValues: any[])`+_e,st(12))]},(t,l)=>e(je+I,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+_e,$e+" listening to the completion of a "+Je)],Mt=(e,t=l,a=l)=>`store.${e}(${t})`+(a?" as "+a:l),Jt=(e,t=l)=>`fluent(() => ${Mt(e,t)})`,zt=(e,t=l,a=l)=>`store.${e}(${t?t+", ":l}proxy(listener)${a?", "+a:l})`,Wt=(e,a,n)=>{const[d,c,v,V,x,k,P,A]=Nt(),[E,D,O]=Lt(e,a,x),[N,j,M]=jt(v,E,D,O),J=le(),W=(e=0)=>oe(J,(([t,a,n,o,d],s)=>{const r=e?[s+`: ${d}(${t}): ${a} => ${n},`]:[s+d+`(${t}): ${a};`];return e||B(r,At(o)),z(r,l),r})),F=(e,t,a,n,o,d=l)=>Vt(J,e,[t,a,n,o,d]),U=(e,t,a,n,o,d=l,s=l,r=l)=>F(Ct[e]+t+(4==e?Re:l)+a,d,n,(n==H?Jt:Mt)(Ct[e]+(4==e?Re:l)+a,s,e?void 0:n),o,r),_=(e,t,a,n=l,o=l,d=1,s=l)=>F($+e+I,(n?n+", ":l)+Te+": "+t+(d?", mutator?: boolean":l),fe,zt($+e+I,o,d?"mutator":l),a,s),Z=`./${St(n)}.d`,H=St(n,1),Q=St(H),q=[],X=le();let ee=[],te=[];if(c(1,Z,H,`create${H} as create${H}Decl`),K(e))c(null,t,p);else{c(0,t,"CellChange"),c(null,t,u);const[e,a,n,d,I,$,w,y,T,V,k,P,A,O,j,M,J,W,B,F,K,te,ne,oe]=N(Q,H),se=le();E(((e,t)=>{const l=`<'${e}'>`,a=[v(t+i,d+l,Ae+` the '${e}' `+i),v(t+i+Ze,I+l,Ae+` the '${e}' `+i+He),v(t+C,$+l,lt(e)),v(t+C+Ze,w+l,lt(e,1)),v(t+g+fe,y+l,`A Cell Id for the '${e}' `+i),v(t+g+ie,V+l,dt(`a Cell Id and value from a Row in the '${e}' `+i)),v(t+C+ie,k+l,dt(`a Row Id from the '${e}' Table, and a Cell iterator`)),v(t+i+g+ie,P+l,dt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];de(se,e,a),c(1,Z,...a)})),c(1,Z,e,a,n,y,A,O,j,M,J,W,B,F,K,te,ne,oe),ee=[e,a,n,y,O,j,M,J,W,B,F,K,te,ne,se],G([[e],[o],[H,"tables: "+a,"tables"],[H]],(([e,t,a],n)=>U(n,l,p,e,tt(1,n),t,a))),U(0,l,b,n+Ge,at(i,Le)),U(5,l,i,Ue,nt(i,Le),"tableCallback: "+A,"tableCallback as any"),E(((e,t,a)=>{const[n,d,s,r,I,c,$,p]=ae(se,e);G([[n],[o],[H,"table: "+d,", table"],[H]],(([n,o,d=l],s)=>U(s,t,i,n,$t(e,s),o,a+d))),U(0,t,i+f,u,at(g,"the whole of "+It(e)),l,a),U(5,t,i+g,Ue,nt(i+g,"the whole of "+It(e)),"tableCellCallback: "+p,a+", tableCellCallback as any"),U(0,t,C+"Count","number","Gets the number of Rows in the "+It(e),l,a),U(0,t,h,u,at(C,It(e)),l,a),U(0,t,m,u,at(C,It(e),1),"cellId?: "+I+Ne,a+", cellId, descending, offset, limit"),U(5,t,C,Ue,nt(C,It(e)),"rowCallback: "+$,a+", rowCallback as any"),G([[s],[o],[H,", row: "+r,", row"],[H],[H,", partialRow: "+r,", partialRow"]],(([n,o=l,d=l],s)=>U(s,t,C,n,ut(e,s),Ee+o,a+", rowId"+d))),U(6,t,C,fe+Ve,"Add a new Row to "+It(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,t,f,I+Ge,at(g,ct(e)),Ee,a+", rowId"),U(5,t,g,Ue,nt(g,ct(e)),Ee+", cellCallback: "+c,a+", rowId, cellCallback as any"),D(e,((n,d,s,r,I)=>{const c="Map"+St(d,1);de(X,d,c);const $=d+(R(s)?Ve:l);G([[$],[o],[H,`, cell: ${d} | `+c,", cell as any"],[H]],(([o,d=l,s=l],c)=>U(c,t+I,g,o,it(e,n,c),Ee+d,a+", rowId, "+r+s))),U(1,t+I,i+g,o,bt[1]+` the '${n}' Cell anywhere in `+It(e),l,a+", "+r)}))})),U(0,l,p+ye,ye,tt(1,6)),U(2,l,p+ye,H,tt(1,7),"tablesJson: "+ye,"tables"+ye),_(p,O,tt(1,8)+" changes"),_(b,j,rt(2,0,1)),_(i,M,rt(3,0),`tableId: ${n} | null`,"tableId"),_(i+f,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(C+"Count",W,rt(15,3),`tableId: ${n} | null`,"tableId"),_(h,B,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,F,rt(13,3,1),Et("tableId: TId",`cellId: ${y}<TId>`+Ve,"descending: boolean","offset: number","limit: number"+Ve),Et("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(C,K,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,te,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,ne,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${L(E((e=>ae(se,e)?.[4]??l))," | ")} | null`,"tableId, rowId, cellId"),_(we+g,oe,Pe+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),c(1,Z,...Y(X)),z(q,".set"+p+De+"({",kt(E(((e,t,a)=>[`[${a}]: {`,...D(e,((e,t,a,n)=>`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(a)?l:`, [${x(Pt(r),`'${r}'`)}]: `+(S(a)?x(Pt(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(K(a))c(null,t,y);else{const[e,a,n,d,I,$,u,i,p]=j(Q,H);c(1,Z,e,a,n,I,$,u,i,p),te=[e,a,n,$,u,i],G([[e],[o],[H,"values: "+a,"values"],[H],[H,"partialValues: "+a,"partialValues"]],(([e,t,a],n)=>U(n,l,y,e,tt(2,n),t,a))),U(0,l,T,n+Ge,at(w,Le)),U(5,l,w,"void",nt(w,Le),"valueCallback: "+I,"valueCallback as any"),O(((e,t,a,n,d)=>{const s="Map"+St(t,1);de(X,t,s),G([[t],[o],[H,`value: ${t} | `+s,", value as any"],[H]],(([t,a,o=l],s)=>U(s,d,w,t,pt(e,s),a,n+o)))})),U(0,l,y+ye,ye,tt(2,6)),U(2,l,y+ye,H,tt(2,7),"valuesJson: "+ye,"values"+ye),_(y,$,tt(2,8)+" changes"),_(T,u,rt(10,0,1)),_(w,i,rt(11,0),`valueId: ${n} | null`,"valueId"),_(we+w,p,Pe+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),c(1,Z,...Y(X)),c(0,t,"ValueChange"),z(q,".set"+y+De+"({",O(((e,t,a,n)=>[`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(a)?l:`, [${x(Pt(r),`'${r}'`)}]: `+(S(a)?x(Pt(a),`'${a}'`):a)}},`])),"})")}U(0,l,"Content",`[${p}, ${y}]`,tt(0,0)),U(2,l,"Content",H,tt(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,l,Me,H,`Applies a set of ${Me} to the Store`,"transactionChanges: "+Me,"transactionChanges"),ne(X,((e,t)=>v(t,`(cell: ${e}${Ve}) => `+e,`Takes a ${e} Cell value and returns another`))),c(null,t,"DoRollback",fe,"IdOrNull",ye,"Store",Me),c(0,t,"Get"+Me,"GetTransactionLog"),U(0,l,ye,ye,tt(0,6)),U(2,l,ye,H,tt(0,7),"tablesAndValuesJson: "+ye,"tablesAndValuesJson"),U(7,l,Je,"Return",ze,me,"actions, doRollback","<Return>"),U(7,l,"start"+je,H,We),U(7,l,"finish"+je,H,Be,he,"doRollback");const se=M(Q,H);return _("Start"+je,se,Pe+" just before the start of the "+Je,l,l,0),_("WillFinish"+je,se,Pe+" just before "+Fe,l,l,0),_("DidFinish"+je,se,Pe+" just after "+Fe,l,l,0),U(7,l,"call"+I,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,l,I,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",l,"Store","store",bt[0]+" the underlying Store object"),c(1,t,"createStore"),c(1,Z,H,`create${H} as create${H}Decl`,se),x("store",["createStore()",...q]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...W(1),"}"]),[d(...k(0),...P(),ge+" interface "+H+" {",...W(0),"}",l,At(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),d(...k(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${Q});`,"};"),ee,te]},Bt=e=>c+e,Ft=e=>Et(Bt(e),Bt(e)+be),Ut="debugIds?: boolean",_t="debugIds={debugIds}",Zt="then"+Ce,Ht="Parameter",Qt=": (parameter: "+Ht+", store: Store) => ",qt="const contextValue = useContext(Context);",Kt=", based on a parameter",Xt=": ",Yt="<"+Ht+",>",el=Ht+"ized"+ie+"<"+Ht+">",tl="rowId",ll="rowId={rowId}",al=", separator, debugIds",nl="separator?: ReactElement | string",ol="then?: (store: Store",dl=Et(ol+")"+_e,Zt),sl="then, then"+be,rl=tl+Xt+fe,Il="View",cl=(e,...t)=>Et(...t,Te+": "+e,Te+Ce,"mutator?: boolean"),$l=(...e)=>Et(...e,Te,Te+be,"mutator"),ul=(e,a,n,o,d)=>{const[s,r,c,$,v,V,x,k]=Nt(),[S,P,A]=Lt(e,a,v),E=`./${St(n)}.d`,D=`./${St(n)}-ui-react.d`,O="tinybase/ui-react",N=St(n,1),G=St(N),j=N+"Or"+N+fe,M=G+"Or"+N+fe,J=G+`={${G}}`,W=le(),F=(e,t,a,n,o,d=l)=>(r(1,D,e+" as "+e+"Decl"),Vt(W,e,[t,a,n,o,d])),U=(e,t,a,n,o,d=l)=>F("use"+e,t,a,n,o,d),_=(e,t,a,n,o=l,d=l,s=l,I=l,c=l)=>(r(1,O,`use${t} as use${t}Core`),U(e,Et(o,X,I),a,ee+`(${M}, use${t}Core, [`+(d||l)+(c?"], ["+c:l)+"]);",n,s)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>oe(W,(([t,a,n,o,d],s)=>{const r=e?[ge+` const ${s}: typeof ${s}Decl = ${d}(${t}): ${1==a?"any":a} =>`,n]:[ge+` function ${s}${d}(${t}): ${1==a?"ComponentReturnType":a};`];return e||B(r,At(o)),z(r,l),r}));r(null,t,fe,"Store",ie,Ht+"ized"+ie),r(0,O,"ComponentReturnType"),r(1,O,"useCellIds"),r(null,O,"ExtraProps"),r(0,E,N);const Q=c(j,N+" | "+fe,`Used when you need to refer to a ${N} in a React hook or component`),q=c(Se+ke,Ot(G+ve+N,G+`ById?: {[${G}Id: Id]: ${N}}`),`Used with the ${Se} component, so that a `+N+" can be passed into the context of an application");r(0,"react","ReactElement","ComponentType"),r(1,"react","React"),r(1,D,Q,q);const X=M+ve+Q;v("{createContext, useContext, useMemo}","React"),v("Context",`createContext<[${N}?, {[${G}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+Ce,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Ve,["{",qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Se} component context`),ee=$("useHook",M+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${M} as Id);`,`return hook(...preParams, ((${M} == null || typeof ${M} == 'string')`,`? ${G} : ${M})?.getStore(), ...postParams)`]),te=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),ne=$("wrap",Et("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("useCustomOrDefaultCellIds",Et("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${M}?: ${Q} | undefined`),[`const defaultCellIds = ${ee}(${M}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),se=v("NullComponent","() => null");if(!K(e)){const[e,a,n,d,s,w,y,T,v,V,x,k,A,O,j]=o;r(null,E,e,a,n,s,w,y,T,v,V,x,k,A,O),r(0,E,d),r(1,E,N),r(null,t,u,"IdOrNull");const M=$("tableView",`{${G}, rowComponent, getRowComponentProps, customCellIds`+al+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${ne}(rowIds.map((rowId) => (`,"<Row","{..."+te+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ll,"customCellIds={customCellIds}",J,_t,"/>","))",al,", tableId,",");"]),z=$("getDefaultTableComponent","tableId: Id",L(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+se),W=$("getDefaultCellComponent","tableId: Id, cellId: Id",L(S(((e,t,l)=>`tableId == ${l} ? ${L(P(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+se} : `)))+se);_(p,p,e,tt(1,0)+ue);const B=_(b,b,n+Ge,at(i,Le)+ue);_(Oe+p+ie,Oe+p+ie,el,tt(1,9)+Kt,Et(Bt(p)+Qt+a,Bt(p)+Ce),Ft(p),Yt,Et(ol,`tables: ${a})`+_e,Zt),sl),_(pe+p+ie,pe+p+ie,ie,tt(1,12),l,l,l,dl,sl);const F=c(g+ke,Ot("tableId?: TId","rowId: Id","cellId?: CId",G+ve+N,Ut),ot(ce+g),`<TId extends ${n}, CId extends ${d}<TId>>`),U=c(C+ke,Ot("tableId?: TId","rowId: Id",G+ve+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${F}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,nl,Ut),ot(ce+C),`<TId extends ${n}>`),H=c(i+ke,Ot("tableId?: TId",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),ot(ce+i),`<TId extends ${n}>`),Q=c("Sorted"+i+ke,Ot("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),ot(ce+"sorted "+i),`<TId extends ${n}>`),q=c(p+ke,Ot(G+ve+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${H}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,nl,Ut),ot(et(1,1)));r(1,D,q,H,Q,U,F),Z(p+Il,"{"+G+", tableComponents, getTableComponentProps"+al+"}: "+q,[ne+`(${B}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+z+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${te}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",J,_t,"/>;","}), separator)"],tt(1,13)+ue),S(((e,t,a)=>{const[n,o,d,s,I]=ae(j,e);r(null,E,n,o,d,s,I),_(t+i,i,n,$t(e)+ue,l,a),_(t+i+f,i+f,u,at(g,"the whole of "+It(e))+ue,l,a);const c=_(t+h,h,u,at(C,It(e))+ue,l,a),$=_(t+m,m,u,at(C,It(e),1)+ue,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");_(t+C,C,d,ut(e)+ue,rl,Et(a,tl)),_(t+f,f,I+Ge,at(g,ct(e))+ue,rl,Et(a,tl)),_(Oe+t+i+ie,Oe+i+ie,el,$t(e,9)+Kt,Et(Bt(i)+Qt+o,Bt(i)+Ce),Et(a,Ft(i)),Yt,Et(ol,`table: ${o})`+_e,Zt),sl),_(pe+t+i+ie,pe+i+ie,ie,$t(e,12),l,a,l,dl,sl),_(Oe+t+C+ie,Oe+C+ie,el,ut(e,9)+Kt,Et(rl,Bt(C)+Qt+s,Bt(C)+Ce),Et(a,tl,Ft(C)),Yt,Et(ol,`row: ${s})`+_e,Zt),sl),_("Add"+t+C+ie,"Add"+C+ie,el,ut(e,10)+Kt,Et(Bt(C)+Qt+s,Bt(C)+Ce),Et(a,Ft(C)),Yt,"then?: ("+Et(rl+Ve,"store: Store","row: "+s+")"+_e,"then"+Ce)+", reuseRowIds?: boolean",sl+", reuseRowIds"),_(Oe+t+Re+C+ie,Oe+Re+C+ie,el,ut(e,11)+Kt,Et(rl,Bt(Re+C)+Qt+s,Bt(Re+C)+Ce),Et(a,tl,Ft(Re+C)),Yt,Et(ol,`partialRow: ${s})`+_e,Zt),sl),_(pe+t+C+ie,pe+C+ie,ie,ut(e,12),rl,Et(a,tl),l,dl,sl);const p=Z(t+C+Il,"{rowId, "+G+", cellComponents, getCellComponentProps, customCellIds"+al+`}: ${U}<'${e}'>`,[ne+`(${de}(customCellIds, `+a+`, rowId, ${G}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+W+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${te}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,ll,"cellId={cellId}",J,_t,"/>;","})"+al+", rowId)"],ut(e,13)+ue);Z(t+"Sorted"+i+Il,"{cellId, descending, offset, limit, ...props}: "+Q+`<'${e}'>`,M+"(props, "+$+`(cellId, descending, offset, limit, props.${G}), ${a}, ${p});`,$t(e,13)+", sorted"+ue),Z(t+i+Il,`props: ${H}<'${e}'>`,M+"(props, "+c+`(props.${G}), ${a}, ${p});`,$t(e,13)+ue),P(e,((n,o,d,s,I)=>{const c="Map"+St(o,1);r(0,E,c),r(1,E,c);const $=_(t+I+g,g,o+(R(d)?Ve:l),it(e,n)+ue,rl,Et(a,tl,s));_(Oe+t+I+g+ie,Oe+g+ie,el,it(e,n,9)+Kt,Et(rl,Bt(g)+Qt+o+" | "+c,Bt(g)+Ce),Et(a,tl,s,Ft(g)),Yt,Et(ol,`cell: ${o} | ${c})`+_e,Zt),sl),_(pe+t+I+g+ie,pe+g+ie,ie,it(e,n,12),Et(rl,"forceDel?: boolean"),Et(a,tl,s,"forceDel"),l,dl,sl),Z(t+I+g+Il,`{rowId, ${G}, debugIds}: `+F+`<'${e}', '${n}'>`,[ne+`('' + ${$}(rowId, `+G+`) ?? '', undefined, debugIds, ${s})`],it(e,n,13)+ue)}))}));const K=L(S((e=>ae(j,e)?.[4]??l))," | ");_(p+I,p+I,Ue,tt(1,8)+" changes",cl(s),$l()),_(b+I,b+I,Ue,rt(2,0,1),cl(w),$l()),_(i+I,i+I,Ue,rt(3,0),cl(y,`tableId: ${n} | null`),$l("tableId")),_(i+f+I,i+f+I,Ue,rt(14,3,1),cl(T,`tableId: ${n} | null`),$l("tableId")),_(h+I,h+I,Ue,rt(4,3,1),cl(V,`tableId: ${n} | null`),$l("tableId")),_(m+I,m+I,Ue,rt(13,3,1),cl(x,`tableId: ${n} | null`,"cellId: "+K+Ve,"descending: boolean","offset: number","limit: number"+Ve),$l("tableId","cellId","descending","offset","limit")),_(C+I,C+I,Ue,rt(5,3),cl(k,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(f+I,f+I,Ue,rt(6,5,1),cl(A,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(g+I,g+I,Ue,rt(7,5),cl(O,`tableId: ${n} | null`,tl+": IdOrNull",`cellId: ${K} | null`),$l("tableId",tl,"cellId"))}if(!K(a)){const[e,t,a,n,o,s]=d;r(null,E,...d),r(1,E,N);const u=$("getDefaultValueComponent","valueId: Id",L(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+se);_(y,y,e,tt(2,0)+ue);const i=_(T,T,a+Ge,at(w,Le)+ue);_(Oe+y+ie,Oe+y+ie,el,tt(2,9)+Kt,Et(Bt(y)+Qt+t,Bt(y)+Ce),Ft(y),Yt,Et(ol,`values: ${t})`+_e,Zt),sl),_(Oe+Re+y+ie,Oe+Re+y+ie,el,tt(2,11)+Kt,Et(Bt(Re+y)+Qt+t,Bt(Re+y)+Ce),Ft(Re+y),Yt,Et(ol,`partialValues: ${t})`+_e,Zt),sl),_(pe+y+ie,pe+y+ie,ie,tt(2,12),l,l,l,dl,sl);const p=c(w+ke,Ot("valueId?: VId",G+ve+N,Ut),ot("a Value"),`<VId extends ${a}>`),b=c(y+ke,Ot(G+ve+N,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,nl,Ut),ot(et(2,1)));r(1,D,b,p),Z(y+Il,"{"+G+", valueComponents, getValueComponentProps"+al+"}: "+b,[ne+`(${i}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+u+"(valueId);","return <Value",`{...${te}(getValueComponentProps, valueId)}`,"key={valueId}",J,_t,"/>;","}), separator)"],tt(2,13)+ue),A(((e,t,a,n,o)=>{const d="Map"+St(t,1);r(0,E,d),r(1,E,d);const s=_(o+w,w,t,pt(e)+ue,l,n);_(Oe+o+w+ie,Oe+w+ie,el,pt(e,9)+Kt,Et(Bt(w)+Qt+t+" | "+d,Bt(w)+Ce),Et(n,Ft(w)),Yt,Et(ol,`value: ${t} | ${d})`+_e,Zt),sl),_(pe+o+w+ie,pe+w+ie,ie,pt(e,12),l,n,l,dl,sl),Z(o+w+Il,`{${G}, debugIds}: ${p}<'${e}'>`,[ne+`('' + ${s}(`+G+`) ?? '', undefined, debugIds, ${n})`],pt(e,13)+ue)})),_(y+I,y+I,Ue,tt(2,8)+" changes",cl(n),$l()),_(T+I,T+I,Ue,rt(10,0,1),cl(o),$l()),_(w+I,w+I,Ue,rt(11,0),cl(s,`valueId: ${a} | null`),$l("valueId"))}return Z(Se,`{${G}, ${G}ById, children}: `+q+" & {children: React.ReactNode}",["{",qt,"return (","<Context."+Se,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${Se}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[s(...V(0),...x(),...H(0)),s(...V(1),...k(),...H(1))]},il=(e,t,a)=>{if(K(e)&&K(t))return[l,l,l,l];const[n,o,d,s]=Wt(e,t,a);return[n,o,...ul(e,t,a,d,s)]},pl=JSON.parse,bl="prettier/",Cl=bl+"plugins/",hl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},ml=Gt((e=>{const t=()=>{const t=pl(e.getTablesSchemaJson());return!K(t)||O(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=le();if(O(a,(t=>O(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=se(n,a,(()=>[D(o),le(),[0],0])),[s,r,[I]]=d,c=se(r,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),de(r,o,c),d[3]++,s==D(o)})))))return t[l]={},ee(n,(([e,,[,n],o],d)=>{t[l][d]={[s]:e,...o==M(a)?{[r]:n}:{}}})),1}))?t:{}},l=()=>{const t=pl(e.getValuesSchemaJson());return K(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:D(l)}})),t},a=e=>il(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"],l=[];let n;try{n=(await import(bl+"standalone")).format,z(l,await import(Cl+"estree"),await import(Cl+"typescript"))}catch(e){n=async e=>e}return await E(j(a(e),(async(e,a)=>xt(await n(e,{...hl,plugins:l,filepath:"_."+t[a]})))))};return Z({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let s=0,r=0;const I={};d(((e,l)=>{s++;let a=0;l((()=>a++)),r+=a,t&&(I[e]={rowCells:a})})),a+=s,n+=r,t&&(o[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:M(e.getValueIds()),jsonLength:Rt(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{ml as createTools};
1
+ const e=e=>typeof e,t="tinybase",l="",a=",",n=e(l),o=e(!0),d=e(0),s="type",r="default",I="Listener",c="get",$="add",u="Ids",i="Table",p=i+"s",b=i+u,C="Row",h=C+u,m="Sorted"+C+u,g="Cell",f=g+u,w="Value",y=w+"s",T=w+u,v=Promise,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==n||e==o,S=t=>e(t)==n,P=e=>Array.isArray(e),A=(e,t,l)=>e.slice(t,l),E=e=>e.length,D=async e=>v.all(e),O=t=>{const l=e(t);return k(l)||l==d&&V(t)?l:void 0},N=(e,t)=>e.every(t),G=(e,t)=>e.sort(t),L=(e,t)=>e.forEach(t),j=(e,t=l)=>e.join(t),M=(e,t)=>e.map(t),J=(e,t)=>e.filter(t),z=(e,...t)=>e.push(...t),W=e=>e.pop(),B=(e,...t)=>e.unshift(...t),F=e=>e.shift(),U=Object,_=U.keys,Z=U.freeze,H=e=>x(e,U)&&e.constructor==U,Q=(e,t)=>M(U.entries(e),(([e,l])=>t(l,e))),q=e=>E(_(e)),K=e=>H(e)&&0==q(e),X=(e,t)=>e?.has(t)??!1,Y=e=>[...e?.values()??[]],ee=(e,t)=>e?.forEach(t),te=(e,t)=>e?.delete(t),le=e=>new Map(e),ae=(e,t)=>e?.get(t),ne=(e,t)=>ee(e,((e,l)=>t(l,e))),oe=(e,t)=>M([...e?.entries()??[]],(([e,l])=>t(l,e))),de=(e,t,l)=>R(l)?(te(e,t),e):e?.set(t,l),se=(e,t,l)=>(X(e,t)||de(e,t,l()),ae(e,t)),re=e=>e.toUpperCase(),Ie=e=>e.toLowerCase(),ce="a ",$e="A function for",ue=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",pe="Del",be="Deps",Ce=be+"?: React.DependencyList",he="doRollback?: DoRollback",me="actions: () => Return, "+he,ge="export",fe="Id",we="Invalid",ye="Json",Te=Ie(I),ve="?: ",Ve=" | undefined",xe="NonNullable",Re="Partial",ke="Props",Se="Provider",Pe=`Registers a ${Te} that will be called`,Ae="Represents",Ee="rowId: "+fe,De="Schema",Oe="Set",Ne=", descending?: boolean, offset?: number, limit?: number",Ge="[]",Le="the Store",je="Transaction",Me=je+"Changes",Je=Ie(je),ze="Execute a "+Je+" to make multiple mutations",We="Explicitly starts a "+Je,Be="Explicitly finishes a "+Je,Fe="the end of the "+Je,Ue="void",_e=" => "+Ue,Ze="WhenSet",He=" when setting it",Qe=ce+"string serialization of",qe=" ",Ke="Gets a callback that can ",Xe="the ",Ye=" the schema for",et=(e=0,t=0)=>`the ${mt[e]}content of`+(t?qe+Le:l),tt=(e=0,t,a=0)=>bt[t]+qe+et(e,1)+(a?" when setting it":l),lt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${et()} the '${e}' `+i,at=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,nt=(e,t)=>`Calls a function for each ${e} in `+t,ot=e=>"The props passed to a component that renders "+e,dt=e=>"A function that takes "+e,st=(e,t=0)=>$e+" listening to changes to "+ht[e]+" in "+ht[t],rt=(e,t,a=0)=>Pe+" whenever "+ht[e]+" in "+ht[t]+" change"+(a?l:"s"),It=e=>`the '${e}' `+i,ct=e=>"the specified Row in "+It(e),$t=(e,t=0)=>bt[t]+` ${et()} `+It(e),ut=(e,t=0)=>bt[t]+` ${et()} `+ct(e),it=(e,t,l=0)=>bt[l]+` the '${t}' Cell for `+ct(e),pt=(e,t=0)=>bt[t]+` the '${e}' Value`,bt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+Qe,"Sets "+Qe,Pe+" whenever",Ke+"set",Ke+"add",Ke+"set part of",Ke+"delete","Renders","Gets "+Qe+Ye,"Sets"+Ye,"Deletes"+Ye],Ct=[c,"has","set","del","set","forEach",$,l],ht=[Le,p,Xe+i+qe+u,ce+i,Xe+C+qe+u,ce+C,Xe+g+qe+u,ce+g,"invalid Cell changes",y,Xe+w+qe+u,ce+w,"invalid Value changes",Xe+"sorted "+C+qe+u,Xe+g+qe+u+" anywhere",Xe+"number of Rows"],mt=[l,"tabular ","keyed value "],gt=e=>new Set(P(e)||R(e)?e:[e]),ft=(e,t)=>e?.add(t),wt=/[^A-Za-z]+/,yt=/[^A-Za-z0-9]+/,Tt=/^( *)\/\*\* *(.*?) *\*\/$/gm,vt=e=>e.includes(a),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return X(e,n)?Vt(e,t,l,a+1):(de(e,n,l),n)},xt=e=>e.replace(Tt,((e,t,l)=>{const a=77-E(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.flat(1e3),kt=(e,t=0)=>j(M(e.split(yt),((e,l)=>(l>0||t?re:Ie)(A(e,0,1))+A(e,1)))),St=e=>re(j((e&&!wt.test(e[0])?e:" "+e).split(yt),"_")),Pt=e=>`/** ${e}. */`,At=(...e)=>j(J(e,(e=>e)),", "),Et=(...e)=>"{"+j(e,"; ")+"}",Dt=(...e)=>Et(...M(e,(e=>"readonly "+e))),Ot=()=>{const e=[le(),le(),le(),le()],t=le(),a=le(),n=e=>{const t=e.indexOf(" as ");return-1!=t?A(e,t+4):e};return[(...e)=>j(Rt(e),"\n"),(t,l,...a)=>L(a,(a=>L([0,1],(n=>(t??n)==n?ft(se(e[n],l,gt),a):0)))),(e,a,n,o=l,d=1)=>Vt(t,e,[a,n,o,d]),(e,t,l)=>Vt(a,e,P(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>ae(a,e)===t?e:Vt(a,e,t),(t=0)=>M([...G(oe(e[t],((e,t)=>`import {${j(G(Y(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),l],(e=>e.replace("{React}","React"))),()=>oe(t,(([e,t,a,n],o)=>[Pt(t),`${n?ge+" ":l}type ${o}${a} = ${e};`,l])),()=>oe(a,((e,t)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${t} = ${F(e)}`,e,l])))]},Nt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Gt=(e,t,l)=>[t=>Q(e,((e,a)=>t(a,kt(a,1),l(St(a),`'${a}'`)))),(t,a)=>Q(e[t],((e,t)=>a(t,e[s],e[r],l(St(t),`'${t}'`),kt(t,1)))),e=>Q(t,((t,a)=>e(a,t[s],t[r],l(St(a),`'${a}'`),kt(a,1))))],Lt=(e,t,a,n)=>[(n,o)=>{const d=n+": "+o,s=e(p,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...a(e,((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`)))+"}"))),tt(1,5)),r=e(p+Ze,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...a(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),tt(1,5,1)),c=e(i+fe,"keyof "+s,"A "+i+" Id in "+Le),$=`<TId extends ${c}>`,u=e(i,xe+`<${s}[TId]>`,"A "+i+" in "+Le,$),w=e(i+Ze,xe+`<${r}[TId]>`,"A "+i+" in "+Le+He,$),y=e(C,u+"<TId>[Id]","A "+C+" in a "+i,$),T=e(C+Ze,w+"<TId>[Id]","A "+C+" in a "+i+He,$),v=e(g+fe,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+C,$),V=e(g,xe+`<${s}[TId]>[Id][CId]`,"A "+g+" in a "+C,`<TId extends ${c}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+C,`<TId extends ${c}, CId = ${v}<TId>>`,0),k=e(g+ie,`(...[cellId, cell]: ${x}<TId>)`+_e,dt(ce+g+" Id, and "+g),$),S=e(C+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+_e+") "+_e,dt(ce+C+" Id, and a "+g+" iterator"),$),P=e(i+g+ie,`(cellId: ${v}<TId>, count: number) `+_e,dt(ce+g+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${c} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${_e}] : never`,i+" Ids and callback types",`<TId = ${c}>`,0),E=e(i+ie,`(...[tableId, forEachRow]: ${A})`+_e,dt(ce+i+" Id, and a "+C+" iterator"),l),D=e("TableIdRowIdCellIdArray",`TId extends ${c} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${c}>`,0),O=e("GetCellChange",`(...[tableId, rowId, cellId]: ${D}) => CellChange`,$e+" returning information about any Cell's changes during a "+Je),N=e(p+I,`(${d}, getCellChange: ${O}${Ve})`+_e,st(1)),G=e(b+I,`(${d})`+_e,st(2)),L=e(i+I,`(${d}, tableId: ${c}, getCellChange: ${O}${Ve})`+_e,st(3)),j=e(i+f+I,`(${d}, tableId: ${c})`+_e,st(14,3)),M=e(C+"Count"+I,`(${d}, tableId: ${c})`+_e,st(15,3)),J=e(h+I,`(${d}, tableId: ${c})`+_e,st(4,3)),z=e(m+I,"("+At(d,"tableId: "+c,"cellId: Id"+Ve,"descending: boolean","offset: number","limit: number"+Ve,"sortedRowIds: Ids")+")"+_e,st(13,3)),W=e(C+I,"("+At(""+d,"tableId: "+c,Ee,`getCellChange: ${O}${Ve}`)+")"+_e,st(5,3)),B=e(f+I,"("+At(""+d,"tableId: "+c,Ee)+")"+_e,st(6,5)),F=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Ee}, cellId: CId, newCell: ${V}<TId, CId> ${Ve}, oldCell: ${V}<TId, CId> ${Ve}, getCellChange: ${O} ${Ve}] : never`,"Cell args for CellListener",`<TId extends ${c}, CId = ${v}<TId>>`,0),U=e("CellListenerArgsArrayOuter",`TId extends ${c} ? `+F+"<TId> : never","Table args for CellListener",`<TId = ${c}>`,0);return[s,r,c,u,w,y,T,v,V,k,S,P,E,N,G,L,j,M,J,z,W,B,e(g+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${U})`+_e,st(7,5)),e(we+g+I,`(${d}, tableId: Id, ${Ee}, cellId: Id, invalidCells: any[])`+_e,st(8))]},(t,a)=>{const o=t+": "+a,d=e(y,Et(...n(((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`))),tt(2,5)),s=e(y+Ze,Et(...n(((e,t)=>`'${e}'?: ${t}`))),tt(2,5,1)),r=e(w+fe,"keyof "+d,"A "+w+" Id in "+Le),c=e(w,xe+`<${d}[VId]>`,"A "+w+" Id in "+Le,`<VId extends ${r}>`),$=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${c}<VId>] : never`,w+" Ids and types in "+Le,`<VId = ${r}>`,0),u=e(w+ie,`(...[valueId, value]: ${$})`+_e,dt(ce+w+" Id, and "+w)),i=e("GetValueChange",`(valueId: ${r}) => ValueChange`,$e+" returning information about any Value's changes during a "+Je),p=e(y+I,`(${o}, getValueChange: ${i}${Ve})`+_e,st(9)),b=e(T+I,`(${o})`+_e,st(10)),C=e("ValueListenerArgsArray",`VId extends ${r} ? [${o}, valueId: VId, newValue: ${c}<VId> ${Ve}, oldValue: ${c}<VId> ${Ve}, getValueChange: ${i} ${Ve}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[d,s,r,c,u,p,b,e(w+I,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+_e,st(11)),e(we+w+I,`(${o}, valueId: Id, invalidValues: any[])`+_e,st(12))]},(t,l)=>e(je+I,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+_e,$e+" listening to the completion of a "+Je)],jt=(e,t=l,a=l)=>`store.${e}(${t})`+(a?" as "+a:l),Mt=(e,t=l)=>`fluent(() => ${jt(e,t)})`,Jt=(e,t=l,a=l)=>`store.${e}(${t?t+", ":l}proxy(listener)${a?", "+a:l})`,zt=(e,a,n)=>{const[d,c,v,V,x,k,P,A]=Ot(),[E,D,O]=Gt(e,a,x),[N,G,M]=Lt(v,E,D,O),J=le(),W=(e=0)=>oe(J,(([t,a,n,o,d],s)=>{const r=e?[s+`: ${d}(${t}): ${a} => ${n},`]:[s+d+`(${t}): ${a};`];return e||B(r,Pt(o)),z(r,l),r})),F=(e,t,a,n,o,d=l)=>Vt(J,e,[t,a,n,o,d]),U=(e,t,a,n,o,d=l,s=l,r=l)=>F(Ct[e]+t+(4==e?Re:l)+a,d,n,(n==H?Mt:jt)(Ct[e]+(4==e?Re:l)+a,s,e?void 0:n),o,r),_=(e,t,a,n=l,o=l,d=1,s=l)=>F($+e+I,(n?n+", ":l)+Te+": "+t+(d?", mutator?: boolean":l),fe,Jt($+e+I,o,d?"mutator":l),a,s),Z=`./${kt(n)}.d`,H=kt(n,1),Q=kt(H),q=[],X=le();let ee=[],te=[];if(c(1,Z,H,`create${H} as create${H}Decl`),K(e))c(null,t,p);else{c(0,t,"CellChange"),c(null,t,u);const[e,a,n,d,I,$,w,y,T,V,k,P,A,O,G,M,J,W,B,F,K,te,ne,oe]=N(Q,H),se=le();E(((e,t)=>{const l=`<'${e}'>`,a=[v(t+i,d+l,Ae+` the '${e}' `+i),v(t+i+Ze,I+l,Ae+` the '${e}' `+i+He),v(t+C,$+l,lt(e)),v(t+C+Ze,w+l,lt(e,1)),v(t+g+fe,y+l,`A Cell Id for the '${e}' `+i),v(t+g+ie,V+l,dt(`a Cell Id and value from a Row in the '${e}' `+i)),v(t+C+ie,k+l,dt(`a Row Id from the '${e}' Table, and a Cell iterator`)),v(t+i+g+ie,P+l,dt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];de(se,e,a),c(1,Z,...a)})),c(1,Z,e,a,n,y,A,O,G,M,J,W,B,F,K,te,ne,oe),ee=[e,a,n,y,O,G,M,J,W,B,F,K,te,ne,se],L([[e],[o],[H,"tables: "+a,"tables"],[H]],(([e,t,a],n)=>U(n,l,p,e,tt(1,n),t,a))),U(0,l,b,n+Ge,at(i,Le)),U(5,l,i,Ue,nt(i,Le),"tableCallback: "+A,"tableCallback as any"),E(((e,t,a)=>{const[n,d,s,r,I,c,$,p]=ae(se,e);L([[n],[o],[H,"table: "+d,", table"],[H]],(([n,o,d=l],s)=>U(s,t,i,n,$t(e,s),o,a+d))),U(0,t,i+f,u,at(g,"the whole of "+It(e)),l,a),U(5,t,i+g,Ue,nt(i+g,"the whole of "+It(e)),"tableCellCallback: "+p,a+", tableCellCallback as any"),U(0,t,C+"Count","number","Gets the number of Rows in the "+It(e),l,a),U(0,t,h,u,at(C,It(e)),l,a),U(0,t,m,u,at(C,It(e),1),"cellId?: "+I+Ne,a+", cellId, descending, offset, limit"),U(5,t,C,Ue,nt(C,It(e)),"rowCallback: "+$,a+", rowCallback as any"),L([[s],[o],[H,", row: "+r,", row"],[H],[H,", partialRow: "+r,", partialRow"]],(([n,o=l,d=l],s)=>U(s,t,C,n,ut(e,s),Ee+o,a+", rowId"+d))),U(6,t,C,fe+Ve,"Add a new Row to "+It(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,t,f,I+Ge,at(g,ct(e)),Ee,a+", rowId"),U(5,t,g,Ue,nt(g,ct(e)),Ee+", cellCallback: "+c,a+", rowId, cellCallback as any"),D(e,((n,d,s,r,I)=>{const c="Map"+kt(d,1);de(X,d,c);const $=d+(R(s)?Ve:l);L([[$],[o],[H,`, cell: ${d} | `+c,", cell as any"],[H]],(([o,d=l,s=l],c)=>U(c,t+I,g,o,it(e,n,c),Ee+d,a+", rowId, "+r+s))),U(1,t+I,i+g,o,bt[1]+` the '${n}' Cell anywhere in `+It(e),l,a+", "+r)}))})),U(0,l,p+ye,ye,tt(1,6)),U(2,l,p+ye,H,tt(1,7),"tablesJson: "+ye,"tables"+ye),_(p,O,tt(1,8)+" changes"),_(b,G,rt(2,0,1)),_(i,M,rt(3,0),`tableId: ${n} | null`,"tableId"),_(i+f,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(C+"Count",W,rt(15,3),`tableId: ${n} | null`,"tableId"),_(h,B,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,F,rt(13,3,1),At("tableId: TId",`cellId: ${y}<TId>`+Ve,"descending: boolean","offset: number","limit: number"+Ve),At("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(C,K,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,te,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,ne,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${j(E((e=>ae(se,e)?.[4]??l))," | ")} | null`,"tableId, rowId, cellId"),_(we+g,oe,Pe+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),c(1,Z,...Y(X)),z(q,".set"+p+De+"({",Rt(E(((e,t,a)=>[`[${a}]: {`,...D(e,((e,t,a,n)=>`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${R(a)?l:`, [${x(St(r),`'${r}'`)}]: `+(S(a)?x(St(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(K(a))c(null,t,y);else{const[e,a,n,d,I,$,u,i,p]=G(Q,H);c(1,Z,e,a,n,I,$,u,i,p),te=[e,a,n,$,u,i],L([[e],[o],[H,"values: "+a,"values"],[H],[H,"partialValues: "+a,"partialValues"]],(([e,t,a],n)=>U(n,l,y,e,tt(2,n),t,a))),U(0,l,T,n+Ge,at(w,Le)),U(5,l,w,"void",nt(w,Le),"valueCallback: "+I,"valueCallback as any"),O(((e,t,a,n,d)=>{const s="Map"+kt(t,1);de(X,t,s),L([[t],[o],[H,`value: ${t} | `+s,", value as any"],[H]],(([t,a,o=l],s)=>U(s,d,w,t,pt(e,s),a,n+o)))})),U(0,l,y+ye,ye,tt(2,6)),U(2,l,y+ye,H,tt(2,7),"valuesJson: "+ye,"values"+ye),_(y,$,tt(2,8)+" changes"),_(T,u,rt(10,0,1)),_(w,i,rt(11,0),`valueId: ${n} | null`,"valueId"),_(we+w,p,Pe+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),c(1,Z,...Y(X)),c(0,t,"ValueChange"),z(q,".set"+y+De+"({",O(((e,t,a,n)=>[`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${R(a)?l:`, [${x(St(r),`'${r}'`)}]: `+(S(a)?x(St(a),`'${a}'`):a)}},`])),"})")}U(0,l,"Content",`[${p}, ${y}]`,tt(0,0)),U(2,l,"Content",H,tt(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,l,Me,H,`Applies a set of ${Me} to the Store`,"transactionChanges: "+Me,"transactionChanges"),ne(X,((e,t)=>v(t,`(cell: ${e}${Ve}) => `+e,`Takes a ${e} Cell value and returns another`))),c(null,t,"DoRollback",fe,"IdOrNull",ye,"Store",Me),c(0,t,"Get"+Me,"GetTransactionLog"),U(0,l,ye,ye,tt(0,6)),U(2,l,ye,H,tt(0,7),"tablesAndValuesJson: "+ye,"tablesAndValuesJson"),U(7,l,Je,"Return",ze,me,"actions, doRollback","<Return>"),U(7,l,"start"+je,H,We),U(7,l,"finish"+je,H,Be,he,"doRollback");const se=M(Q,H);return _("Start"+je,se,Pe+" just before the start of the "+Je,l,l,0),_("WillFinish"+je,se,Pe+" just before "+Fe,l,l,0),_("DidFinish"+je,se,Pe+" just after "+Fe,l,l,0),U(7,l,"call"+I,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,l,I,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",l,"Store","store",bt[0]+" the underlying Store object"),c(1,t,"createStore"),c(1,Z,H,`create${H} as create${H}Decl`,se),x("store",["createStore()",...q]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...W(1),"}"]),[d(...k(0),...P(),ge+" interface "+H+" {",...W(0),"}",l,Pt(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),d(...k(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${Q});`,"};"),ee,te]},Wt=e=>c+e,Bt=e=>At(Wt(e),Wt(e)+be),Ft="debugIds?: boolean",Ut="debugIds={debugIds}",_t="then"+Ce,Zt="Parameter",Ht=": (parameter: "+Zt+", store: Store) => ",Qt="const contextValue = useContext(Context);",qt=", based on a parameter",Kt=": ",Xt="<"+Zt+",>",Yt=Zt+"ized"+ie+"<"+Zt+">",el="rowId",tl="rowId={rowId}",ll=", separator, debugIds",al="separator?: ReactElement | string",nl="then?: (store: Store",ol=At(nl+")"+_e,_t),dl="then, then"+be,sl=el+Kt+fe,rl="View",Il=(e,...t)=>At(...t,Te+": "+e,Te+Ce,"mutator?: boolean"),cl=(...e)=>At(...e,Te,Te+be,"mutator"),$l=(e,a,n,o,d)=>{const[s,r,c,$,v,V,x,k]=Ot(),[S,P,A]=Gt(e,a,v),E=`./${kt(n)}.d`,D=`./${kt(n)}-ui-react.d`,O="tinybase/ui-react",N=kt(n,1),G=kt(N),L=N+"Or"+N+fe,M=G+"Or"+N+fe,J=G+`={${G}}`,W=le(),F=(e,t,a,n,o,d=l)=>(r(1,D,e+" as "+e+"Decl"),Vt(W,e,[t,a,n,o,d])),U=(e,t,a,n,o,d=l)=>F("use"+e,t,a,n,o,d),_=(e,t,a,n,o=l,d=l,s=l,I=l,c=l)=>(r(1,O,`use${t} as use${t}Core`),U(e,At(o,X,I),a,ee+`(${M}, use${t}Core, [`+(d||l)+(c?"], ["+c:l)+"]);",n,s)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>oe(W,(([t,a,n,o,d],s)=>{const r=e?[ge+` const ${s}: typeof ${s}Decl = ${d}(${t}): ${1==a?"any":a} =>`,n]:[ge+` function ${s}${d}(${t}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Pt(o)),z(r,l),r}));r(null,t,fe,"Store",ie,Zt+"ized"+ie),r(0,O,"ComponentReturnType"),r(1,O,"useCellIds"),r(null,O,"ExtraProps"),r(0,E,N);const Q=c(L,N+" | "+fe,`Used when you need to refer to a ${N} in a React hook or component`),q=c(Se+ke,Dt(G+ve+N,G+`ById?: {[${G}Id: Id]: ${N}}`),`Used with the ${Se} component, so that a `+N+" can be passed into the context of an application");r(0,"react","ReactElement","ComponentType"),r(1,"react","React"),r(1,D,Q,q);const X=M+ve+Q;v("{createContext, useContext, useMemo}","React"),v("Context",`createContext<[${N}?, {[${G}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+Ce,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Ve,["{",Qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Se} component context`),ee=$("useHook",M+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${M} as Id);`,`return hook(...preParams, ((${M} == null || typeof ${M} == 'string')`,`? ${G} : ${M})?.getStore(), ...postParams)`]),te=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),ne=$("wrap",At("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("useCustomOrDefaultCellIds",At("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${M}?: ${Q} | undefined`),[`const defaultCellIds = ${ee}(${M}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),se=v("NullComponent","() => null");if(!K(e)){const[e,a,n,d,s,w,y,T,v,V,x,k,A,O,L]=o;r(null,E,e,a,n,s,w,y,T,v,V,x,k,A,O),r(0,E,d),r(1,E,N),r(null,t,u,"IdOrNull");const M=$("tableView",`{${G}, rowComponent, getRowComponentProps, customCellIds`+ll+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${ne}(rowIds.map((rowId) => (`,"<Row","{..."+te+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",tl,"customCellIds={customCellIds}",J,Ut,"/>","))",ll,", tableId,",");"]),z=$("getDefaultTableComponent","tableId: Id",j(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+se),W=$("getDefaultCellComponent","tableId: Id, cellId: Id",j(S(((e,t,l)=>`tableId == ${l} ? ${j(P(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+se} : `)))+se);_(p,p,e,tt(1,0)+ue);const B=_(b,b,n+Ge,at(i,Le)+ue);_(Oe+p+ie,Oe+p+ie,Yt,tt(1,9)+qt,At(Wt(p)+Ht+a,Wt(p)+Ce),Bt(p),Xt,At(nl,`tables: ${a})`+_e,_t),dl),_(pe+p+ie,pe+p+ie,ie,tt(1,12),l,l,l,ol,dl);const F=c(g+ke,Dt("tableId?: TId","rowId: Id","cellId?: CId",G+ve+N,Ft),ot(ce+g),`<TId extends ${n}, CId extends ${d}<TId>>`),U=c(C+ke,Dt("tableId?: TId","rowId: Id",G+ve+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${F}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,al,Ft),ot(ce+C),`<TId extends ${n}>`),H=c(i+ke,Dt("tableId?: TId",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),ot(ce+i),`<TId extends ${n}>`),Q=c("Sorted"+i+ke,Dt("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),ot(ce+"sorted "+i),`<TId extends ${n}>`),q=c(p+ke,Dt(G+ve+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${H}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,al,Ft),ot(et(1,1)));r(1,D,q,H,Q,U,F),Z(p+rl,"{"+G+", tableComponents, getTableComponentProps"+ll+"}: "+q,[ne+`(${B}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+z+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${te}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",J,Ut,"/>;","}), separator)"],tt(1,13)+ue),S(((e,t,a)=>{const[n,o,d,s,I]=ae(L,e);r(null,E,n,o,d,s,I),_(t+i,i,n,$t(e)+ue,l,a),_(t+i+f,i+f,u,at(g,"the whole of "+It(e))+ue,l,a);const c=_(t+h,h,u,at(C,It(e))+ue,l,a),$=_(t+m,m,u,at(C,It(e),1)+ue,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");_(t+C,C,d,ut(e)+ue,sl,At(a,el)),_(t+f,f,I+Ge,at(g,ct(e))+ue,sl,At(a,el)),_(Oe+t+i+ie,Oe+i+ie,Yt,$t(e,9)+qt,At(Wt(i)+Ht+o,Wt(i)+Ce),At(a,Bt(i)),Xt,At(nl,`table: ${o})`+_e,_t),dl),_(pe+t+i+ie,pe+i+ie,ie,$t(e,12),l,a,l,ol,dl),_(Oe+t+C+ie,Oe+C+ie,Yt,ut(e,9)+qt,At(sl,Wt(C)+Ht+s,Wt(C)+Ce),At(a,el,Bt(C)),Xt,At(nl,`row: ${s})`+_e,_t),dl),_("Add"+t+C+ie,"Add"+C+ie,Yt,ut(e,10)+qt,At(Wt(C)+Ht+s,Wt(C)+Ce),At(a,Bt(C)),Xt,"then?: ("+At(sl+Ve,"store: Store","row: "+s+")"+_e,"then"+Ce)+", reuseRowIds?: boolean",dl+", reuseRowIds"),_(Oe+t+Re+C+ie,Oe+Re+C+ie,Yt,ut(e,11)+qt,At(sl,Wt(Re+C)+Ht+s,Wt(Re+C)+Ce),At(a,el,Bt(Re+C)),Xt,At(nl,`partialRow: ${s})`+_e,_t),dl),_(pe+t+C+ie,pe+C+ie,ie,ut(e,12),sl,At(a,el),l,ol,dl);const p=Z(t+C+rl,"{rowId, "+G+", cellComponents, getCellComponentProps, customCellIds"+ll+`}: ${U}<'${e}'>`,[ne+`(${de}(customCellIds, `+a+`, rowId, ${G}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+W+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${te}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,tl,"cellId={cellId}",J,Ut,"/>;","})"+ll+", rowId)"],ut(e,13)+ue);Z(t+"Sorted"+i+rl,"{cellId, descending, offset, limit, ...props}: "+Q+`<'${e}'>`,M+"(props, "+$+`(cellId, descending, offset, limit, props.${G}), ${a}, ${p});`,$t(e,13)+", sorted"+ue),Z(t+i+rl,`props: ${H}<'${e}'>`,M+"(props, "+c+`(props.${G}), ${a}, ${p});`,$t(e,13)+ue),P(e,((n,o,d,s,I)=>{const c="Map"+kt(o,1);r(0,E,c),r(1,E,c);const $=_(t+I+g,g,o+(R(d)?Ve:l),it(e,n)+ue,sl,At(a,el,s));_(Oe+t+I+g+ie,Oe+g+ie,Yt,it(e,n,9)+qt,At(sl,Wt(g)+Ht+o+" | "+c,Wt(g)+Ce),At(a,el,s,Bt(g)),Xt,At(nl,`cell: ${o} | ${c})`+_e,_t),dl),_(pe+t+I+g+ie,pe+g+ie,ie,it(e,n,12),At(sl,"forceDel?: boolean"),At(a,el,s,"forceDel"),l,ol,dl),Z(t+I+g+rl,`{rowId, ${G}, debugIds}: `+F+`<'${e}', '${n}'>`,[ne+`('' + ${$}(rowId, `+G+`) ?? '', undefined, debugIds, ${s})`],it(e,n,13)+ue)}))}));const K=j(S((e=>ae(L,e)?.[4]??l))," | ");_(p+I,p+I,Ue,tt(1,8)+" changes",Il(s),cl()),_(b+I,b+I,Ue,rt(2,0,1),Il(w),cl()),_(i+I,i+I,Ue,rt(3,0),Il(y,`tableId: ${n} | null`),cl("tableId")),_(i+f+I,i+f+I,Ue,rt(14,3,1),Il(T,`tableId: ${n} | null`),cl("tableId")),_(h+I,h+I,Ue,rt(4,3,1),Il(V,`tableId: ${n} | null`),cl("tableId")),_(m+I,m+I,Ue,rt(13,3,1),Il(x,`tableId: ${n} | null`,"cellId: "+K+Ve,"descending: boolean","offset: number","limit: number"+Ve),cl("tableId","cellId","descending","offset","limit")),_(C+I,C+I,Ue,rt(5,3),Il(k,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(f+I,f+I,Ue,rt(6,5,1),Il(A,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(g+I,g+I,Ue,rt(7,5),Il(O,`tableId: ${n} | null`,el+": IdOrNull",`cellId: ${K} | null`),cl("tableId",el,"cellId"))}if(!K(a)){const[e,t,a,n,o,s]=d;r(null,E,...d),r(1,E,N);const u=$("getDefaultValueComponent","valueId: Id",j(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+se);_(y,y,e,tt(2,0)+ue);const i=_(T,T,a+Ge,at(w,Le)+ue);_(Oe+y+ie,Oe+y+ie,Yt,tt(2,9)+qt,At(Wt(y)+Ht+t,Wt(y)+Ce),Bt(y),Xt,At(nl,`values: ${t})`+_e,_t),dl),_(Oe+Re+y+ie,Oe+Re+y+ie,Yt,tt(2,11)+qt,At(Wt(Re+y)+Ht+t,Wt(Re+y)+Ce),Bt(Re+y),Xt,At(nl,`partialValues: ${t})`+_e,_t),dl),_(pe+y+ie,pe+y+ie,ie,tt(2,12),l,l,l,ol,dl);const p=c(w+ke,Dt("valueId?: VId",G+ve+N,Ft),ot("a Value"),`<VId extends ${a}>`),b=c(y+ke,Dt(G+ve+N,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,al,Ft),ot(et(2,1)));r(1,D,b,p),Z(y+rl,"{"+G+", valueComponents, getValueComponentProps"+ll+"}: "+b,[ne+`(${i}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+u+"(valueId);","return <Value",`{...${te}(getValueComponentProps, valueId)}`,"key={valueId}",J,Ut,"/>;","}), separator)"],tt(2,13)+ue),A(((e,t,a,n,o)=>{const d="Map"+kt(t,1);r(0,E,d),r(1,E,d);const s=_(o+w,w,t,pt(e)+ue,l,n);_(Oe+o+w+ie,Oe+w+ie,Yt,pt(e,9)+qt,At(Wt(w)+Ht+t+" | "+d,Wt(w)+Ce),At(n,Bt(w)),Xt,At(nl,`value: ${t} | ${d})`+_e,_t),dl),_(pe+o+w+ie,pe+w+ie,ie,pt(e,12),l,n,l,ol,dl),Z(o+w+rl,`{${G}, debugIds}: ${p}<'${e}'>`,[ne+`('' + ${s}(`+G+`) ?? '', undefined, debugIds, ${n})`],pt(e,13)+ue)})),_(y+I,y+I,Ue,tt(2,8)+" changes",Il(n),cl()),_(T+I,T+I,Ue,rt(10,0,1),Il(o),cl()),_(w+I,w+I,Ue,rt(11,0),Il(s,`valueId: ${a} | null`),cl("valueId"))}return Z(Se,`{${G}, ${G}ById, children}: `+q+" & {children: React.ReactNode}",["{",Qt,"return (","<Context."+Se,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${Se}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[s(...V(0),...x(),...H(0)),s(...V(1),...k(),...H(1))]},ul=(e,t,a)=>{if(K(e)&&K(t))return[l,l,l,l];const[n,o,d,s]=zt(e,t,a);return[n,o,...$l(e,t,a,d,s)]},il=JSON.parse,pl="prettier/",bl=pl+"plugins/",Cl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},hl=Nt((e=>{const t=()=>{const t=il(e.getTablesSchemaJson());return!K(t)||N(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=le();if(N(a,(t=>N(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=se(n,a,(()=>[O(o),le(),[0],0])),[s,r,[I]]=d,c=se(r,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),de(r,o,c),d[3]++,s==O(o)})))))return t[l]={},ee(n,(([e,,[,n],o],d)=>{t[l][d]={[s]:e,...o==E(a)?{[r]:n}:{}}})),1}))?t:{}},l=()=>{const t=il(e.getValuesSchemaJson());return K(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:O(l)}})),t},a=e=>ul(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"],l=[];let n;try{n=(await import(pl+"standalone")).format,z(l,await import(bl+"estree"),await import(bl+"typescript"))}catch(e){n=async e=>e}return await D(M(a(e),(async(e,a)=>xt(await n(e,{...Cl,plugins:l,filepath:"_."+t[a]})))))};return Z({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let s=0,r=0;const I={};d(((e,l)=>{s++;let a=0;l((()=>a++)),r+=a,t&&(I[e]={rowCells:a})})),a+=s,n+=r,t&&(o[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{hl as createTools};
package/lib/tools.js.gz CHANGED
Binary file
@@ -23,6 +23,45 @@ import PartySocket from 'partysocket';
23
23
  import {Persister} from '../persisters';
24
24
  import {Store} from '../store';
25
25
 
26
+ /**
27
+ * The PartyKitPersisterConfig type describes the configuration of a PartyKit
28
+ * Persister on the client side.
29
+ *
30
+ * The defaults (if used on both the server and client) will work fine, but if
31
+ * you are building more complex PartyKit apps and you need to configure path
32
+ * names, for example, then this is the thing to use.
33
+ * @example
34
+ * When applied to a PartyKit Persister, this PartyKitPersisterConfig will load
35
+ * and save a JSON serialization from and to an end point in your room called
36
+ * `/my_tinybase`, and use HTTP (rather than the default HTTPS) as the protocol.
37
+ *
38
+ * Note that this would require you to also add the matching storePath setting
39
+ * to the TinyBasePartyKitServerConfig on the server side.
40
+ *
41
+ * ```js
42
+ * const partyKitPersisterConfig: PartyKitPersisterConfig = {
43
+ * storeProtocol: 'http',
44
+ * storePath: '/my_tinybase',
45
+ * };
46
+ * ```
47
+ * @category Configuration
48
+ * @since v4.3.9
49
+ */
50
+ export type PartyKitPersisterConfig = {
51
+ /**
52
+ * The HTTP protocol to use (in addition to the websocket channel). This
53
+ * defaults to 'https' but you may wish to use 'http' for local PartyKit
54
+ * development.
55
+ */
56
+ storeProtocol?: 'http' | 'https';
57
+ /**
58
+ * The path used to set and get the whole Store over HTTP(S) on the server.
59
+ * This must match the storePath property of the TinyBasePartyKitServerConfig
60
+ * object on the server. Both default to '/store'.
61
+ */
62
+ storePath?: string;
63
+ };
64
+
26
65
  /**
27
66
  * The createPartyKitPersister function creates a Persister object that can
28
67
  * persist the Store to durable PartyKit storage, enabling synchronization of
@@ -52,9 +91,9 @@ import {Store} from '../store';
52
91
  * @param store The Store to persist.
53
92
  * @param connection The PartySocket to use for participating in the PartyKit
54
93
  * room.
55
- * @param storeUrlProtocol The HTTP protocol to use (in addition to the
56
- * websocket channel). This defaults to 'https' but you may wish to use 'http'
57
- * for local PartyKit development.
94
+ * @param configOrStoreProtocol The PartyKitPersisterConfig configuration for
95
+ * the Persister, (or a string to specify a HTTP protocol to use, defaulting to
96
+ * 'https').
58
97
  * @param onIgnoredError An optional handler for the errors that the Persister
59
98
  * would otherwise ignore when trying to save or load data. This is suitable for
60
99
  * debugging persistence issues in a development environment.
@@ -83,6 +122,6 @@ import {Store} from '../store';
83
122
  export function createPartyKitPersister(
84
123
  store: Store,
85
124
  connection: PartySocket,
86
- storeUrlProtocol?: 'http' | 'https',
125
+ configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
87
126
  onIgnoredError?: (error: any) => void,
88
127
  ): Persister;
@@ -20,6 +20,65 @@
20
20
 
21
21
  import {Connection, Party, Request, Server} from 'partykit/server';
22
22
 
23
+ /**
24
+ * The TinyBasePartyKitServerConfig type describes the configuration of a
25
+ * PartyKit Persister on the server side.
26
+ *
27
+ * The defaults (if used on both the server and client) will work fine, but if
28
+ * you are building more complex PartyKit apps and you need to configure path
29
+ * names, for example, then this is the type to use.
30
+ * @example
31
+ * When set as the config in a TinyBasePartyKitServer, this
32
+ * TinyBasePartyKitServerConfig will expect clients to load and save their JSON
33
+ * serialization from and to an end point in the room called `/my_tinybase`.
34
+ * Note that this would require you to also add the matching storePath setting
35
+ * to the PartyKitPersisterConfig on the client side.
36
+ *
37
+ * It will also store the data in the durable storage with a prefix of
38
+ * 'tinybase_' in case you are worried about colliding with other data stored
39
+ * in the room.
40
+ *
41
+ * ```js yolo
42
+ * export default class extends TinyBasePartyServer {
43
+ * readonly config: TinyBasePartyKitServerConfig = {
44
+ * storePath: '/my_tinybase',
45
+ * storagePrefix: 'tinybase_',
46
+ * };
47
+ * };
48
+ * ```
49
+ * @category Configuration
50
+ * @since v4.3.9
51
+ */
52
+ export type TinyBasePartyKitServerConfig = {
53
+ /**
54
+ * The path used to set and get the whole Store over HTTP(S) on the server.
55
+ * This must match the storePath property of the PartyKitPersisterConfig used
56
+ * on the client. Both default to '/store'.
57
+ */
58
+ storePath?: string;
59
+ /**
60
+ * The prefix used before all the keys in the server's durable storage. Use
61
+ * this in case you are worried about the Store data colliding with other data
62
+ * stored in the room. Defaults to an empty string.
63
+ */
64
+ storagePrefix?: string;
65
+ /**
66
+ * An object containing the extra HTTP(S) headers returned to the client from
67
+ * this server. This defaults to the following three headers to allow CORS:
68
+ *
69
+ * ```
70
+ * Access-Control-Allow-Origin: *
71
+ * Access-Control-Allow-Methods: *
72
+ * Access-Control-Allow-Headers: *
73
+ * ```
74
+ *
75
+ * If you set this field, it will override the default completely. So, for
76
+ * example, if you add another header but still want the CORS defaults, you
77
+ * will need to explicitly set the Access-Control-Allow headers above again.
78
+ */
79
+ responseHeaders?: HeadersInit;
80
+ };
81
+
23
82
  /**
24
83
  * A TinyBasePartyKitServer is the server component for persisting the Store to
25
84
  * durable PartyKit storage, enabling synchronization of the same Store across
@@ -68,6 +127,13 @@ import {Connection, Party, Request, Server} from 'partykit/server';
68
127
  */
69
128
  export class TinyBasePartyKitServer implements Server {
70
129
  constructor(party: Party);
130
+ /**
131
+ * The config property is used to optionally configure the server, using an
132
+ * object of the TinyBasePartyKitServerConfig type.
133
+ *
134
+ * See the documentation for that type for more details.
135
+ */
136
+ readonly config: TinyBasePartyKitServerConfig;
71
137
  /**
72
138
  * The onRequest method is called when a HTTP request is made to the party
73
139
  * URL.
@@ -264,6 +264,9 @@ export type QueryIdsListener = (queries: Queries) => void;
264
264
  * object, the Id of the ResultTable that changed (which is the same as the
265
265
  * query Id), and a GetResultCellChange function that can be used to query
266
266
  * ResultCell values before and after the change.
267
+ *
268
+ * You can create new query definitions within the body of this listener, though
269
+ * obviously be aware of the possible cascading effects of doing so.
267
270
  * @param queries A reference to the Queries object that changed.
268
271
  * @param tableId The Id of the ResultTable that changed, which is also the
269
272
  * query Id.
@@ -289,6 +292,9 @@ export type ResultTableListener = (
289
292
  * When called, a ResultTableCellIdsListener is given a reference to the Queries
290
293
  * object, and the Id of the ResultTable whose Cell Ids changed (which is the
291
294
  * same as the query Id).
295
+ *
296
+ * You can create new query definitions within the body of this listener, though
297
+ * obviously be aware of the possible cascading effects of doing so.
292
298
  * @param queries A reference to the Queries object that changed.
293
299
  * @param tableId The Id of the ResultTable that changed, which is also the
294
300
  * query Id.
@@ -311,6 +317,9 @@ export type ResultTableCellIdsListener = (
311
317
  * When called, a ResultRowCountListener is given a reference to the Queries
312
318
  * object, the Id of the ResultTable whose ResultRow Ids changed (which is the
313
319
  * same as the query Id), and the count of ResultRow objects in the ResultTable.
320
+ *
321
+ * You can create new query definitions within the body of this listener, though
322
+ * obviously be aware of the possible cascading effects of doing so.
314
323
  * @param queries A reference to the Queries object that changed.
315
324
  * @param tableId The Id of the ResultTable that changed, which is also the
316
325
  * query Id.
@@ -334,6 +343,9 @@ export type ResultRowCountListener = (
334
343
  * When called, a ResultRowIdsListener is given a reference to the Queries
335
344
  * object, and the Id of the ResultTable whose ResultRow Ids changed (which is
336
345
  * the same as the query Id).
346
+ *
347
+ * You can create new query definitions within the body of this listener, though
348
+ * obviously be aware of the possible cascading effects of doing so.
337
349
  * @param queries A reference to the Queries object that changed.
338
350
  * @param tableId The Id of the ResultTable that changed, which is also the
339
351
  * query Id.
@@ -360,6 +372,9 @@ export type ResultRowIdsListener = (
360
372
  * for pagination purposes. It also receives the sorted array of Ids itself, so
361
373
  * that you can use them in the listener without the additional cost of an
362
374
  * explicit call to getResultSortedRowIds.
375
+ *
376
+ * You can create new query definitions within the body of this listener, though
377
+ * obviously be aware of the possible cascading effects of doing so.
363
378
  * @param queries A reference to the Queries object that changed.
364
379
  * @param tableId The Id of the ResultTable that changed, which is also the
365
380
  * query Id.
@@ -393,6 +408,9 @@ export type ResultSortedRowIdsListener = (
393
408
  * the Id of the ResultTable that changed (which is the same as the query Id),
394
409
  * the Id of the ResultRow that changed, and a GetResultCellChange function that
395
410
  * can be used to query ResultCell values before and after the change.
411
+ *
412
+ * You can create new query definitions within the body of this listener, though
413
+ * obviously be aware of the possible cascading effects of doing so.
396
414
  * @param queries A reference to the Queries object that changed.
397
415
  * @param tableId The Id of the ResultTable that changed, which is also the
398
416
  * query Id.
@@ -419,6 +437,9 @@ export type ResultRowListener = (
419
437
  * When called, a ResultCellIdsListener is given a reference to the Queries
420
438
  * object, the Id of the ResultTable that changed (which is the same as the
421
439
  * query Id), and the Id of the ResultRow whose ResultCell Ids changed.
440
+ *
441
+ * You can create new query definitions within the body of this listener, though
442
+ * obviously be aware of the possible cascading effects of doing so.
422
443
  * @param queries A reference to the Queries object that changed.
423
444
  * @param tableId The Id of the ResultTable that changed, which is also the
424
445
  * query Id.
@@ -446,6 +467,9 @@ export type ResultCellIdsListener = (
446
467
  * It is also given the new value of the ResultCell, the old value of the
447
468
  * ResultCell, and a GetResultCellChange function that can be used to query
448
469
  * ResultCell values before and after the change.
470
+ *
471
+ * You can create new query definitions within the body of this listener, though
472
+ * obviously be aware of the possible cascading effects of doing so.
449
473
  * @param queries A reference to the Queries object that changed.
450
474
  * @param tableId The Id of the ResultTable that changed, which is also the
451
475
  * query Id.
@@ -23,6 +23,45 @@ import {OptionalSchemas, Store} from '../store';
23
23
  import PartySocket from 'partysocket';
24
24
  import {Persister} from '../persisters';
25
25
 
26
+ /**
27
+ * The PartyKitPersisterConfig type describes the configuration of a PartyKit
28
+ * Persister on the client side.
29
+ *
30
+ * The defaults (if used on both the server and client) will work fine, but if
31
+ * you are building more complex PartyKit apps and you need to configure path
32
+ * names, for example, then this is the thing to use.
33
+ * @example
34
+ * When applied to a PartyKit Persister, this PartyKitPersisterConfig will load
35
+ * and save a JSON serialization from and to an end point in your room called
36
+ * `/my_tinybase`, and use HTTP (rather than the default HTTPS) as the protocol.
37
+ *
38
+ * Note that this would require you to also add the matching storePath setting
39
+ * to the TinyBasePartyKitServerConfig on the server side.
40
+ *
41
+ * ```js
42
+ * const partyKitPersisterConfig: PartyKitPersisterConfig = {
43
+ * storeProtocol: 'http',
44
+ * storePath: '/my_tinybase',
45
+ * };
46
+ * ```
47
+ * @category Configuration
48
+ * @since v4.3.9
49
+ */
50
+ export type PartyKitPersisterConfig = {
51
+ /**
52
+ * The HTTP protocol to use (in addition to the websocket channel). This
53
+ * defaults to 'https' but you may wish to use 'http' for local PartyKit
54
+ * development.
55
+ */
56
+ storeProtocol?: 'http' | 'https';
57
+ /**
58
+ * The path used to set and get the whole Store over HTTP(S) on the server.
59
+ * This must match the storePath property of the TinyBasePartyKitServerConfig
60
+ * object on the server. Both default to '/store'.
61
+ */
62
+ storePath?: string;
63
+ };
64
+
26
65
  /**
27
66
  * The createPartyKitPersister function creates a Persister object that can
28
67
  * persist the Store to durable PartyKit storage, enabling synchronization of
@@ -34,7 +73,7 @@ import {Persister} from '../persisters';
34
73
  * createPartyKitPersister(
35
74
  * store: Store,
36
75
  * connection: PartySocket,
37
- * storeUrlProtocol?: 'http' | 'https',
76
+ * configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
38
77
  * onIgnoredError?: (error: any) => void,
39
78
  * ): Persister;
40
79
  * ```
@@ -63,9 +102,9 @@ import {Persister} from '../persisters';
63
102
  * @param store The Store to persist.
64
103
  * @param connection The PartySocket to use for participating in the PartyKit
65
104
  * room.
66
- * @param storeUrlProtocol The HTTP protocol to use (in addition to the
67
- * websocket channel). This defaults to 'https' but you may wish to use 'http'
68
- * for local PartyKit development.
105
+ * @param configOrStoreProtocol The PartyKitPersisterConfig configuration for
106
+ * the Persister, (or a string to specify a HTTP protocol to use, defaulting to
107
+ * 'https').
69
108
  * @param onIgnoredError An optional handler for the errors that the Persister
70
109
  * would otherwise ignore when trying to save or load data. This is suitable for
71
110
  * debugging persistence issues in a development environment.
@@ -94,6 +133,6 @@ import {Persister} from '../persisters';
94
133
  export function createPartyKitPersister<Schemas extends OptionalSchemas>(
95
134
  store: Store<Schemas>,
96
135
  connection: PartySocket,
97
- storeUrlProtocol?: 'http' | 'https',
136
+ configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
98
137
  onIgnoredError?: (error: any) => void,
99
138
  ): Persister<Schemas>;
@@ -20,6 +20,65 @@
20
20
 
21
21
  import {Connection, Party, Request, Server} from 'partykit/server';
22
22
 
23
+ /**
24
+ * The TinyBasePartyKitServerConfig type describes the configuration of a
25
+ * PartyKit Persister on the server side.
26
+ *
27
+ * The defaults (if used on both the server and client) will work fine, but if
28
+ * you are building more complex PartyKit apps and you need to configure path
29
+ * names, for example, then this is the type to use.
30
+ * @example
31
+ * When set as the config in a TinyBasePartyKitServer, this
32
+ * TinyBasePartyKitServerConfig will expect clients to load and save their JSON
33
+ * serialization from and to an end point in the room called `/my_tinybase`.
34
+ * Note that this would require you to also add the matching storePath setting
35
+ * to the PartyKitPersisterConfig on the client side.
36
+ *
37
+ * It will also store the data in the durable storage with a prefix of
38
+ * 'tinybase_' in case you are worried about colliding with other data stored
39
+ * in the room.
40
+ *
41
+ * ```js yolo
42
+ * export default class extends TinyBasePartyServer {
43
+ * readonly config: TinyBasePartyKitServerConfig = {
44
+ * storePath: '/my_tinybase',
45
+ * storagePrefix: 'tinybase_',
46
+ * };
47
+ * };
48
+ * ```
49
+ * @category Configuration
50
+ * @since v4.3.9
51
+ */
52
+ export type TinyBasePartyKitServerConfig = {
53
+ /**
54
+ * The path used to set and get the whole Store over HTTP(S) on the server.
55
+ * This must match the storePath property of the PartyKitPersisterConfig used
56
+ * on the client. Both default to '/store'.
57
+ */
58
+ storePath?: string;
59
+ /**
60
+ * The prefix used before all the keys in the server's durable storage. Use
61
+ * this in case you are worried about the Store data colliding with other data
62
+ * stored in the room. Defaults to an empty string.
63
+ */
64
+ storagePrefix?: string;
65
+ /**
66
+ * An object containing the extra HTTP(S) headers returned to the client from
67
+ * this server. This defaults to the following three headers to allow CORS:
68
+ *
69
+ * ```
70
+ * Access-Control-Allow-Origin: *
71
+ * Access-Control-Allow-Methods: *
72
+ * Access-Control-Allow-Headers: *
73
+ * ```
74
+ *
75
+ * If you set this field, it will override the default completely. So, for
76
+ * example, if you add another header but still want the CORS defaults, you
77
+ * will need to explicitly set the Access-Control-Allow headers above again.
78
+ */
79
+ responseHeaders?: HeadersInit;
80
+ };
81
+
23
82
  /**
24
83
  * A TinyBasePartyKitServer is the server component for persisting the Store to
25
84
  * durable PartyKit storage, enabling synchronization of the same Store across
@@ -68,6 +127,13 @@ import {Connection, Party, Request, Server} from 'partykit/server';
68
127
  */
69
128
  export class TinyBasePartyKitServer implements Server {
70
129
  constructor(party: Party);
130
+ /**
131
+ * The config property is used to optionally configure the server, using an
132
+ * object of the TinyBasePartyKitServerConfig type.
133
+ *
134
+ * See the documentation for that type for more details.
135
+ */
136
+ readonly config: TinyBasePartyKitServerConfig;
71
137
  /**
72
138
  * The onRequest method is called when a HTTP request is made to the party
73
139
  * URL.
@@ -293,6 +293,9 @@ export type QueryIdsListener<Schemas extends OptionalSchemas> = (
293
293
  * object, the Id of the ResultTable that changed (which is the same as the
294
294
  * query Id), and a GetResultCellChange function that can be used to query
295
295
  * ResultCell values before and after the change.
296
+ *
297
+ * You can create new query definitions within the body of this listener, though
298
+ * obviously be aware of the possible cascading effects of doing so.
296
299
  * @param queries A reference to the Queries object that changed.
297
300
  * @param tableId The Id of the ResultTable that changed, which is also the
298
301
  * query Id.
@@ -328,6 +331,9 @@ export type ResultTableListener<Schemas extends OptionalSchemas> = (
328
331
  * When called, a ResultTableCellIdsListener is given a reference to the Queries
329
332
  * object, and the Id of the ResultTable whose Cell Ids changed (which is the
330
333
  * same as the query Id).
334
+ *
335
+ * You can create new query definitions within the body of this listener, though
336
+ * obviously be aware of the possible cascading effects of doing so.
331
337
  * @param queries A reference to the Queries object that changed.
332
338
  * @param tableId The Id of the ResultTable that changed, which is also the
333
339
  * query Id.
@@ -360,6 +366,9 @@ export type ResultTableCellIdsListener<Schemas extends OptionalSchemas> = (
360
366
  * When called, a ResultRowCountListener is given a reference to the Queries
361
367
  * object, the Id of the ResultTable whose ResultRow Ids changed (which is the
362
368
  * same as the query Id), and the count of ResultRow objects in the ResultTable.
369
+ *
370
+ * You can create new query definitions within the body of this listener, though
371
+ * obviously be aware of the possible cascading effects of doing so.
363
372
  * @param queries A reference to the Queries object that changed.
364
373
  * @param tableId The Id of the ResultTable that changed, which is also the
365
374
  * query Id.
@@ -393,6 +402,9 @@ export type ResultRowCountListener<Schemas extends OptionalSchemas> = (
393
402
  * When called, a ResultRowIdsListener is given a reference to the Queries
394
403
  * object, and the Id of the ResultTable whose ResultRow Ids changed (which is
395
404
  * the same as the query Id).
405
+ *
406
+ * You can create new query definitions within the body of this listener, though
407
+ * obviously be aware of the possible cascading effects of doing so.
396
408
  * @param queries A reference to the Queries object that changed.
397
409
  * @param tableId The Id of the ResultTable that changed, which is also the
398
410
  * query Id.
@@ -433,6 +445,9 @@ export type ResultRowIdsListener<Schemas extends OptionalSchemas> = (
433
445
  * for pagination purposes. It also receives the sorted array of Ids itself, so
434
446
  * that you can use them in the listener without the additional cost of an
435
447
  * explicit call to getResultSortedRowIds.
448
+ *
449
+ * You can create new query definitions within the body of this listener, though
450
+ * obviously be aware of the possible cascading effects of doing so.
436
451
  * @param queries A reference to the Queries object that changed.
437
452
  * @param tableId The Id of the ResultTable that changed, which is also the
438
453
  * query Id.
@@ -477,6 +492,9 @@ export type ResultSortedRowIdsListener<Schemas extends OptionalSchemas> = (
477
492
  * the Id of the ResultTable that changed (which is the same as the query Id),
478
493
  * the Id of the ResultRow that changed, and a GetResultCellChange function that
479
494
  * can be used to query ResultCell values before and after the change.
495
+ *
496
+ * You can create new query definitions within the body of this listener, though
497
+ * obviously be aware of the possible cascading effects of doing so.
480
498
  * @param queries A reference to the Queries object that changed.
481
499
  * @param tableId The Id of the ResultTable that changed, which is also the
482
500
  * query Id.
@@ -514,6 +532,9 @@ export type ResultRowListener<Schemas extends OptionalSchemas> = (
514
532
  * When called, a ResultCellIdsListener is given a reference to the Queries
515
533
  * object, the Id of the ResultTable that changed (which is the same as the
516
534
  * query Id), and the Id of the ResultRow whose ResultCell Ids changed.
535
+ *
536
+ * You can create new query definitions within the body of this listener, though
537
+ * obviously be aware of the possible cascading effects of doing so.
517
538
  * @param queries A reference to the Queries object that changed.
518
539
  * @param tableId The Id of the ResultTable that changed, which is also the
519
540
  * query Id.
@@ -555,6 +576,9 @@ export type ResultCellIdsListener<Schemas extends OptionalSchemas> = (
555
576
  * It is also given the new value of the ResultCell, the old value of the
556
577
  * ResultCell, and a GetResultCellChange function that can be used to query
557
578
  * ResultCell values before and after the change.
579
+ *
580
+ * You can create new query definitions within the body of this listener, though
581
+ * obviously be aware of the possible cascading effects of doing so.
558
582
  * @param queries A reference to the Queries object that changed.
559
583
  * @param tableId The Id of the ResultTable that changed, which is also the
560
584
  * query Id.