@triplit/react 0.0.13 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{useEffect as y,useState as n}from"react";var m=e=>`http://localhost:3000/queryTriples?live=true&query=${encodeURIComponent(JSON.stringify(e))}`;function d(e,t){let[s,l]=n(void 0),[o,r]=n(!1),{selectStatements:c,whereStatements:i}=t,u=m({collection:t.collectionName,select:c,where:i,clientId:e.clientId});return y(()=>{r(!0);let a=e.subscribe(t,f=>{r(!1),l(f)});return()=>{a()}},[u]),{fetchingLocal:o,results:s,error:null}}export{d as useQuery};
1
+ import{useEffect as c,useState as u}from"react";function Q(e,i){let[n,s]=u(void 0),[l,r]=u(!1),t=i.build(),o=JSON.stringify(t);return c(()=>{r(!0);let y=e.subscribe(t,f=>{r(!1),s(f)});return()=>{y()}},[o,e]),{fetchingLocal:l,results:n,error:null}}export{Q as useQuery};
@@ -1,6 +1,6 @@
1
- import { QueryResults, TriplitClient, CollectionQuery } from '@triplit/client';
2
- export declare function useQuery<CQ extends CollectionQuery<any>>(client: TriplitClient<any>, collectionQuery: CQ): {
1
+ import { TriplitClient, ClientQuery, toBuilder } from '@triplit/client';
2
+ export declare function useQuery<QueryBuilder extends toBuilder<ClientQuery<any>>>(client: TriplitClient<any>, query: QueryBuilder): {
3
3
  fetchingLocal: boolean;
4
- results: QueryResults<CQ> | undefined;
4
+ results: Map<string, import("db/src/schema").UnTimestampedObject<any>> | Map<string, never> | undefined;
5
5
  error: null;
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triplit/react",
3
3
  "packageManager": "yarn@3.4.1",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "module",