@reifydb/react 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { ShapeNode, InferShape, FrameResults } from '@reifydb/core';
1
+ import { ShapeNode, FrameResults } from '@reifydb/core';
2
2
  export * from '@reifydb/core';
3
- import { SubscriptionConfig } from '@reifydb/client';
4
3
  export * from '@reifydb/client';
5
- import { Store, Entry } from '@reifydb/store';
4
+ import { Store, ReadSpec, Entry, SpecData, WriteSpec } from '@reifydb/store';
6
5
  export * from '@reifydb/store';
7
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
7
  import { ReactNode } from 'react';
@@ -15,26 +14,25 @@ declare function StoreProvider({ store, children }: StoreProviderProps): react_j
15
14
  declare function useStore(): Store;
16
15
 
17
16
  interface UseSubscriptionOptions {
18
- config?: SubscriptionConfig;
19
17
  enabled?: boolean;
20
18
  }
21
- declare function useSubscription<S extends ShapeNode>(rql: string, params: any, shape: S, options?: UseSubscriptionOptions): Entry<InferShape<S>>;
19
+ declare function useSubscription<S extends ShapeNode, P extends object | null>(spec: ReadSpec<S, P>, params: NoInfer<P>, options?: UseSubscriptionOptions): Entry<SpecData<ReadSpec<S, P>>>;
22
20
 
23
21
  interface UseQueryOptions {
24
22
  enabled?: boolean;
25
23
  }
26
- declare function useQuery<S extends ShapeNode>(rql: string, params: any, shape: S, options?: UseQueryOptions): Entry<InferShape<S>>;
24
+ declare function useQuery<S extends ShapeNode | readonly ShapeNode[], P extends object | null>(spec: ReadSpec<S, P>, params: NoInfer<P>, options?: UseQueryOptions): Entry<SpecData<ReadSpec<S, P>>>;
27
25
 
28
- interface Runner<S extends readonly ShapeNode[]> {
29
- run: (rql: string, params?: any) => Promise<FrameResults<S>>;
26
+ interface Runner<S extends readonly ShapeNode[], P extends object | null> {
27
+ run: (params: P) => Promise<FrameResults<S>>;
30
28
  isPending: boolean;
31
29
  error: Error | undefined;
32
30
  }
33
31
 
34
- type UseCommandResult<S extends readonly ShapeNode[]> = Runner<S>;
35
- declare function useCommand<const S extends readonly ShapeNode[]>(shapes: S): UseCommandResult<S>;
32
+ type UseCommandResult<S extends readonly ShapeNode[], P extends object | null> = Runner<S, P>;
33
+ declare function useCommand<S extends readonly ShapeNode[], P extends object | null>(spec: WriteSpec<S, P>): UseCommandResult<S, P>;
36
34
 
37
- type UseAdminResult<S extends readonly ShapeNode[]> = Runner<S>;
38
- declare function useAdmin<const S extends readonly ShapeNode[]>(shapes: S): UseAdminResult<S>;
35
+ type UseAdminResult<S extends readonly ShapeNode[], P extends object | null> = Runner<S, P>;
36
+ declare function useAdmin<S extends readonly ShapeNode[], P extends object | null>(spec: WriteSpec<S, P>): UseAdminResult<S, P>;
39
37
 
40
38
  export { StoreProvider, type StoreProviderProps, type UseAdminResult, type UseCommandResult, type UseQueryOptions, type UseSubscriptionOptions, useAdmin, useCommand, useQuery, useStore, useSubscription };
package/dist/index.js CHANGED
@@ -24,38 +24,38 @@ import { entryKey } from "@reifydb/store";
24
24
 
25
25
  // src/use-entry.ts
26
26
  import { useCallback, useSyncExternalStore } from "react";
27
- function useEntry(store, rql, params, shape) {
27
+ function useEntry(store, spec, params) {
28
28
  const subscribe = useCallback((listener) => store.subscribeState(listener), [store]);
29
- return useSyncExternalStore(subscribe, () => store.getEntry(rql, params, shape));
29
+ return useSyncExternalStore(subscribe, () => store.getEntry(spec, params));
30
30
  }
31
31
 
32
32
  // src/use-subscription.ts
33
- function useSubscription(rql, params, shape, options = {}) {
33
+ function useSubscription(spec, params, options = {}) {
34
34
  const store = useStore();
35
- const { config, enabled = true } = options;
36
- const key = entryKey(rql, params, shape);
35
+ const { enabled = true } = options;
36
+ const key = entryKey(spec.rql, params, spec.shape);
37
37
  useEffect(() => {
38
38
  if (!enabled) {
39
39
  return;
40
40
  }
41
- return store.subscribe(rql, params, shape, config);
41
+ return store.subscribe(spec, params);
42
42
  }, [store, key, enabled]);
43
- return useEntry(store, rql, params, shape);
43
+ return useEntry(store, spec, params);
44
44
  }
45
45
 
46
46
  // src/use-query.ts
47
47
  import { useEffect as useEffect2 } from "react";
48
48
  import { entryKey as entryKey2 } from "@reifydb/store";
49
- function useQuery(rql, params, shape, options = {}) {
49
+ function useQuery(spec, params, options = {}) {
50
50
  const store = useStore();
51
51
  const { enabled = true } = options;
52
- const key = entryKey2(rql, params, shape);
52
+ const key = entryKey2(spec.rql, params, spec.shape);
53
53
  useEffect2(() => {
54
54
  if (enabled) {
55
- store.query(rql, params, shape).catch(() => void 0);
55
+ store.query(spec, params).catch(() => void 0);
56
56
  }
57
57
  }, [store, key, enabled]);
58
- return useEntry(store, rql, params, shape);
58
+ return useEntry(store, spec, params);
59
59
  }
60
60
 
61
61
  // src/use-runner.ts
@@ -63,14 +63,14 @@ import { useCallback as useCallback2, useState } from "react";
63
63
  function toError(error) {
64
64
  return error instanceof Error ? error : new Error(String(error));
65
65
  }
66
- function useRunner(kind, shapes) {
66
+ function useRunner(kind, spec) {
67
67
  const store = useStore();
68
68
  const [pending, setPending] = useState(0);
69
69
  const [error, setError] = useState(void 0);
70
- const run = useCallback2(async (rql, params = null) => {
70
+ const run = useCallback2(async (params) => {
71
71
  setPending((count) => count + 1);
72
72
  try {
73
- const result = await store[kind](rql, params, shapes);
73
+ const result = await store[kind](spec, params);
74
74
  setError(void 0);
75
75
  return result;
76
76
  } catch (cause) {
@@ -79,18 +79,18 @@ function useRunner(kind, shapes) {
79
79
  } finally {
80
80
  setPending((count) => count - 1);
81
81
  }
82
- }, [store, kind, shapes]);
82
+ }, [store, kind, spec]);
83
83
  return { run, isPending: pending > 0, error };
84
84
  }
85
85
 
86
86
  // src/use-command.ts
87
- function useCommand(shapes) {
88
- return useRunner("command", shapes);
87
+ function useCommand(spec) {
88
+ return useRunner("command", spec);
89
89
  }
90
90
 
91
91
  // src/use-admin.ts
92
- function useAdmin(shapes) {
93
- return useRunner("admin", shapes);
92
+ function useAdmin(spec) {
93
+ return useRunner("admin", spec);
94
94
  }
95
95
  export {
96
96
  StoreProvider,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/provider.tsx","../src/use-subscription.ts","../src/use-entry.ts","../src/use-query.ts","../src/use-runner.ts","../src/use-command.ts","../src/use-admin.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nexport * from '@reifydb/core';\nexport * from '@reifydb/client';\nexport * from '@reifydb/store';\nexport {StoreProvider, useStore} from './provider';\nexport type {StoreProviderProps} from './provider';\nexport {useSubscription} from './use-subscription';\nexport type {UseSubscriptionOptions} from './use-subscription';\nexport {useQuery} from './use-query';\nexport type {UseQueryOptions} from './use-query';\nexport {useCommand} from './use-command';\nexport type {UseCommandResult} from './use-command';\nexport {useAdmin} from './use-admin';\nexport type {UseAdminResult} from './use-admin';\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {createContext, useContext} from 'react';\nimport type {ReactNode} from 'react';\nimport type {Store} from '@reifydb/store';\n\nconst StoreContext = createContext<Store | undefined>(undefined);\n\nexport interface StoreProviderProps {\n store: Store;\n children?: ReactNode;\n}\n\nexport function StoreProvider({store, children}: StoreProviderProps) {\n return <StoreContext.Provider value={store}>{children}</StoreContext.Provider>;\n}\n\nexport function useStore(): Store {\n const store = useContext(StoreContext);\n if (store === undefined) {\n throw new Error('useStore must be used inside a StoreProvider');\n }\n return store;\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useEffect} from 'react';\nimport type {InferShape, ShapeNode} from '@reifydb/core';\nimport type {SubscriptionConfig} from '@reifydb/client';\nimport {entryKey} from '@reifydb/store';\nimport type {Entry} from '@reifydb/store';\nimport {useStore} from './provider';\nimport {useEntry} from './use-entry';\n\nexport interface UseSubscriptionOptions {\n config?: SubscriptionConfig;\n enabled?: boolean;\n}\n\nexport function useSubscription<S extends ShapeNode>(\n rql: string,\n params: any,\n shape: S,\n options: UseSubscriptionOptions = {}\n): Entry<InferShape<S>> {\n const store = useStore();\n const {config, enabled = true} = options;\n const key = entryKey(rql, params, shape);\n useEffect(() => {\n if (!enabled) {\n return;\n }\n return store.subscribe(rql, params, shape, config);\n }, [store, key, enabled]);\n return useEntry(store, rql, params, shape) as Entry<InferShape<S>>;\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useCallback, useSyncExternalStore} from 'react';\nimport type {ShapeNode} from '@reifydb/core';\nimport type {Entry, Store} from '@reifydb/store';\n\n// Widened to Entry<unknown>: relating Entry<InferShape<S>> to itself for a generic S makes TypeScript recurse through InferShape.\nexport function useEntry<S extends ShapeNode>(store: Store, rql: string, params: any, shape: S): Entry<unknown> {\n const subscribe = useCallback((listener: () => void) => store.subscribeState(listener), [store]);\n return useSyncExternalStore<Entry<unknown>>(subscribe, () => store.getEntry(rql, params, shape));\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useEffect} from 'react';\nimport type {InferShape, ShapeNode} from '@reifydb/core';\nimport {entryKey} from '@reifydb/store';\nimport type {Entry} from '@reifydb/store';\nimport {useStore} from './provider';\nimport {useEntry} from './use-entry';\n\nexport interface UseQueryOptions {\n enabled?: boolean;\n}\n\nexport function useQuery<S extends ShapeNode>(\n rql: string,\n params: any,\n shape: S,\n options: UseQueryOptions = {}\n): Entry<InferShape<S>> {\n const store = useStore();\n const {enabled = true} = options;\n const key = entryKey(rql, params, shape);\n useEffect(() => {\n if (enabled) {\n // The rejection is already recorded on the entry, so the promise only needs to be settled.\n store.query(rql, params, shape).catch(() => undefined);\n }\n }, [store, key, enabled]);\n return useEntry(store, rql, params, shape) as Entry<InferShape<S>>;\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useCallback, useState} from 'react';\nimport type {FrameResults, ShapeNode} from '@reifydb/core';\nimport {useStore} from './provider';\n\nexport interface Runner<S extends readonly ShapeNode[]> {\n run: (rql: string, params?: any) => Promise<FrameResults<S>>;\n isPending: boolean;\n error: Error | undefined;\n}\n\nfunction toError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n// Nothing runs until run() is called, so a statement that writes or changes the catalog never fires on mount.\nexport function useRunner<const S extends readonly ShapeNode[]>(kind: 'admin' | 'command', shapes: S): Runner<S> {\n const store = useStore();\n const [pending, setPending] = useState(0);\n const [error, setError] = useState<Error | undefined>(undefined);\n const run = useCallback(async (rql: string, params: any = null): Promise<FrameResults<S>> => {\n setPending(count => count + 1);\n try {\n const result = await store[kind](rql, params, shapes);\n setError(undefined);\n return result;\n } catch (cause) {\n setError(toError(cause));\n throw cause;\n } finally {\n setPending(count => count - 1);\n }\n }, [store, kind, shapes]);\n return {run, isPending: pending > 0, error};\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport type {ShapeNode} from '@reifydb/core';\nimport {useRunner} from './use-runner';\nimport type {Runner} from './use-runner';\n\nexport type UseCommandResult<S extends readonly ShapeNode[]> = Runner<S>;\n\nexport function useCommand<const S extends readonly ShapeNode[]>(shapes: S): UseCommandResult<S> {\n return useRunner('command', shapes);\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport type {ShapeNode} from '@reifydb/core';\nimport {useRunner} from './use-runner';\nimport type {Runner} from './use-runner';\n\nexport type UseAdminResult<S extends readonly ShapeNode[]> = Runner<S>;\n\n// Admin carries the rights that DDL needs, and reads run through it too; the result is returned, never cached.\nexport function useAdmin<const S extends readonly ShapeNode[]>(shapes: S): UseAdminResult<S> {\n return useRunner('admin', shapes);\n}\n"],"mappings":";AAEA,cAAc;AACd,cAAc;AACd,cAAc;;;ACFd,SAAQ,eAAe,kBAAiB;AAY7B;AARX,IAAM,eAAe,cAAiC,MAAS;AAOxD,SAAS,cAAc,EAAC,OAAO,SAAQ,GAAuB;AACjE,S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B,SAAO,SAAS,OAAO,KAAK,QAAQ,KAAK;AAC7C;;;AC3BA,SAAQ,eAAAC,cAAa,gBAAe;AAUpC,SAAS,QAAQ,OAAuB;AACpC,SAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACnE;AAGO,SAAS,UAAgD,MAA2B,QAAsB;AAC7G,QAAM,QAAQ,SAAS;AACvB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA4B,MAAS;AAC/D,QAAM,MAAMC,aAAY,OAAO,KAAa,SAAc,SAAmC;AACzF,eAAW,WAAS,QAAQ,CAAC;AAC7B,QAAI;AACA,YAAM,SAAS,MAAM,MAAM,IAAI,EAAE,KAAK,QAAQ,MAAM;AACpD,eAAS,MAAS;AAClB,aAAO;AAAA,IACX,SAAS,OAAO;AACZ,eAAS,QAAQ,KAAK,CAAC;AACvB,YAAM;AAAA,IACV,UAAE;AACE,iBAAW,WAAS,QAAQ,CAAC;AAAA,IACjC;AAAA,EACJ,GAAG,CAAC,OAAO,MAAM,MAAM,CAAC;AACxB,SAAO,EAAC,KAAK,WAAW,UAAU,GAAG,MAAK;AAC9C;;;AC3BO,SAAS,WAAiD,QAAgC;AAC7F,SAAO,UAAU,WAAW,MAAM;AACtC;;;ACDO,SAAS,SAA+C,QAA8B;AACzF,SAAO,UAAU,SAAS,MAAM;AACpC;","names":["useEffect","entryKey","entryKey","useEffect","useCallback","useCallback"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/provider.tsx","../src/use-subscription.ts","../src/use-entry.ts","../src/use-query.ts","../src/use-runner.ts","../src/use-command.ts","../src/use-admin.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nexport * from '@reifydb/core';\nexport * from '@reifydb/client';\nexport * from '@reifydb/store';\nexport {StoreProvider, useStore} from './provider';\nexport type {StoreProviderProps} from './provider';\nexport {useSubscription} from './use-subscription';\nexport type {UseSubscriptionOptions} from './use-subscription';\nexport {useQuery} from './use-query';\nexport type {UseQueryOptions} from './use-query';\nexport {useCommand} from './use-command';\nexport type {UseCommandResult} from './use-command';\nexport {useAdmin} from './use-admin';\nexport type {UseAdminResult} from './use-admin';\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {createContext, useContext} from 'react';\nimport type {ReactNode} from 'react';\nimport type {Store} from '@reifydb/store';\n\nconst StoreContext = createContext<Store | undefined>(undefined);\n\nexport interface StoreProviderProps {\n store: Store;\n children?: ReactNode;\n}\n\nexport function StoreProvider({store, children}: StoreProviderProps) {\n return <StoreContext.Provider value={store}>{children}</StoreContext.Provider>;\n}\n\nexport function useStore(): Store {\n const store = useContext(StoreContext);\n if (store === undefined) {\n throw new Error('useStore must be used inside a StoreProvider');\n }\n return store;\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useEffect} from 'react';\nimport type {ShapeNode} from '@reifydb/core';\nimport {entryKey} from '@reifydb/store';\nimport type {Entry, ReadSpec, SpecData} from '@reifydb/store';\nimport {useStore} from './provider';\nimport {useEntry} from './use-entry';\n\nexport interface UseSubscriptionOptions {\n enabled?: boolean;\n}\n\nexport function useSubscription<S extends ShapeNode, P extends object | null>(\n spec: ReadSpec<S, P>,\n params: NoInfer<P>,\n options: UseSubscriptionOptions = {}\n): Entry<SpecData<ReadSpec<S, P>>> {\n const store = useStore();\n const {enabled = true} = options;\n const key = entryKey(spec.rql, params, spec.shape);\n useEffect(() => {\n if (!enabled) {\n return;\n }\n return store.subscribe(spec, params);\n }, [store, key, enabled]);\n return useEntry(store, spec, params);\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useCallback, useSyncExternalStore} from 'react';\nimport type {ShapeNode} from '@reifydb/core';\nimport type {Entry, ReadSpec, SpecData, Store} from '@reifydb/store';\n\nexport function useEntry<S extends ShapeNode | readonly ShapeNode[], P extends object | null>(\n store: Store,\n spec: ReadSpec<S, P>,\n params: P\n): Entry<SpecData<ReadSpec<S, P>>> {\n const subscribe = useCallback((listener: () => void) => store.subscribeState(listener), [store]);\n return useSyncExternalStore(subscribe, () => store.getEntry(spec, params));\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useEffect} from 'react';\nimport type {ShapeNode} from '@reifydb/core';\nimport {entryKey} from '@reifydb/store';\nimport type {Entry, ReadSpec, SpecData} from '@reifydb/store';\nimport {useStore} from './provider';\nimport {useEntry} from './use-entry';\n\nexport interface UseQueryOptions {\n enabled?: boolean;\n}\n\nexport function useQuery<S extends ShapeNode | readonly ShapeNode[], P extends object | null>(\n spec: ReadSpec<S, P>,\n params: NoInfer<P>,\n options: UseQueryOptions = {}\n): Entry<SpecData<ReadSpec<S, P>>> {\n const store = useStore();\n const {enabled = true} = options;\n const key = entryKey(spec.rql, params, spec.shape);\n useEffect(() => {\n if (enabled) {\n // The rejection is already recorded on the entry, so the promise only needs to be settled.\n store.query(spec, params).catch(() => undefined);\n }\n }, [store, key, enabled]);\n return useEntry(store, spec, params);\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport {useCallback, useState} from 'react';\nimport type {FrameResults, ShapeNode} from '@reifydb/core';\nimport type {WriteSpec} from '@reifydb/store';\nimport {useStore} from './provider';\n\nexport interface Runner<S extends readonly ShapeNode[], P extends object | null> {\n run: (params: P) => Promise<FrameResults<S>>;\n isPending: boolean;\n error: Error | undefined;\n}\n\nfunction toError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n// Nothing runs until run() is called, so a statement that writes or changes the catalog never fires on mount.\nexport function useRunner<S extends readonly ShapeNode[], P extends object | null>(\n kind: 'admin' | 'command',\n spec: WriteSpec<S, P>\n): Runner<S, P> {\n const store = useStore();\n const [pending, setPending] = useState(0);\n const [error, setError] = useState<Error | undefined>(undefined);\n const run = useCallback(async (params: P): Promise<FrameResults<S>> => {\n setPending(count => count + 1);\n try {\n const result = await store[kind](spec, params);\n setError(undefined);\n return result;\n } catch (cause) {\n setError(toError(cause));\n throw cause;\n } finally {\n setPending(count => count - 1);\n }\n }, [store, kind, spec]);\n return {run, isPending: pending > 0, error};\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport type {ShapeNode} from '@reifydb/core';\nimport type {WriteSpec} from '@reifydb/store';\nimport {useRunner} from './use-runner';\nimport type {Runner} from './use-runner';\n\nexport type UseCommandResult<S extends readonly ShapeNode[], P extends object | null> = Runner<S, P>;\n\nexport function useCommand<S extends readonly ShapeNode[], P extends object | null>(spec: WriteSpec<S, P>): UseCommandResult<S, P> {\n return useRunner('command', spec);\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2026 ReifyDB\nimport type {ShapeNode} from '@reifydb/core';\nimport type {WriteSpec} from '@reifydb/store';\nimport {useRunner} from './use-runner';\nimport type {Runner} from './use-runner';\n\nexport type UseAdminResult<S extends readonly ShapeNode[], P extends object | null> = Runner<S, P>;\n\n// Admin carries the rights that DDL needs, and reads run through it too; the result is returned, never cached.\nexport function useAdmin<S extends readonly ShapeNode[], P extends object | null>(spec: WriteSpec<S, P>): UseAdminResult<S, P> {\n return useRunner('admin', spec);\n}\n"],"mappings":";AAEA,cAAc;AACd,cAAc;AACd,cAAc;;;ACFd,SAAQ,eAAe,kBAAiB;AAY7B;AARX,IAAM,eAAe,cAAiC,MAAS;AAOxD,SAAS,cAAc,EAAC,OAAO,SAAQ,GAAuB;AACjE,SAAO,oBAAC,aAAa,UAAb,EAAsB,OAAO,OAAQ,UAAS;AAC1D;AAEO,SAAS,WAAkB;AAC9B,QAAM,QAAQ,WAAW,YAAY;AACrC,MAAI,UAAU,QAAW;AACrB,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAClE;AACA,SAAO;AACX;;;ACrBA,SAAQ,iBAAgB;AAExB,SAAQ,gBAAe;;;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xC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA4B,MAAS;AAC/D,QAAM,MAAMC,aAAY,OAAO,WAAwC;AACnE,eAAW,WAAS,QAAQ,CAAC;AAC7B,QAAI;AACA,YAAM,SAAS,MAAM,MAAM,IAAI,EAAE,MAAM,MAAM;AAC7C,eAAS,MAAS;AAClB,aAAO;AAAA,IACX,SAAS,OAAO;AACZ,eAAS,QAAQ,KAAK,CAAC;AACvB,YAAM;AAAA,IACV,UAAE;AACE,iBAAW,WAAS,QAAQ,CAAC;AAAA,IACjC;AAAA,EACJ,GAAG,CAAC,OAAO,MAAM,IAAI,CAAC;AACtB,SAAO,EAAC,KAAK,WAAW,UAAU,GAAG,MAAK;AAC9C;;;AC9BO,SAAS,WAAoE,MAA+C;AAC/H,SAAO,UAAU,WAAW,IAAI;AACpC;;;ACDO,SAAS,SAAkE,MAA6C;AAC3H,SAAO,UAAU,SAAS,IAAI;AAClC;","names":["useEffect","entryKey","entryKey","useEffect","useCallback","useCallback"]}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reifydb/react",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "dependencies": {
8
- "@reifydb/core": "0.9.2",
9
- "@reifydb/client": "0.9.2",
10
- "@reifydb/store": "0.9.2"
8
+ "@reifydb/core": "0.10.0",
9
+ "@reifydb/client": "0.10.0",
10
+ "@reifydb/store": "0.10.0"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "react": ">=16.8.0"
@@ -40,8 +40,9 @@
40
40
  "license": "Apache-2.0",
41
41
  "scripts": {
42
42
  "build": "tsup src/index.ts --dts --format esm --sourcemap",
43
+ "typecheck": "tsc --noEmit -p tsconfig.types.json",
43
44
  "dev": "tsc --watch",
44
- "test": "pnpm test:unit",
45
+ "test": "pnpm typecheck && pnpm test:unit",
45
46
  "test:unit": "vitest run --config vitest.unit.config.ts",
46
47
  "test:unit:watch": "vitest --config vitest.unit.config.ts",
47
48
  "test:integration": "vitest run --config vitest.config.ts",