@powersync/react 0.0.0-dev-20250804151331 → 0.0.0-dev-20250828085411
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/QueryStore.d.ts +1 -1
- package/lib/hooks/deprecated/usePowerSyncQuery.js +1 -1
- package/lib/hooks/deprecated/usePowerSyncStatus.js +1 -1
- package/lib/hooks/deprecated/usePowerSyncWatchedQuery.js +1 -1
- package/lib/hooks/suspense/SuspenseQueryResult.d.ts +1 -1
- package/lib/hooks/suspense/suspense-utils.d.ts +1 -4
- package/lib/hooks/suspense/suspense-utils.js +5 -8
- package/lib/hooks/suspense/useSingleSuspenseQuery.d.ts +2 -2
- package/lib/hooks/suspense/useSingleSuspenseQuery.js +5 -8
- package/lib/hooks/suspense/useSuspenseQuery.d.ts +2 -2
- package/lib/hooks/suspense/useSuspenseQuery.js +2 -2
- package/lib/hooks/suspense/useWatchedQuerySuspenseSubscription.js +2 -7
- package/lib/hooks/suspense/useWatchedSuspenseQuery.d.ts +1 -1
- package/lib/hooks/suspense/useWatchedSuspenseQuery.js +4 -4
- package/lib/hooks/useStatus.js +1 -1
- package/lib/hooks/watched/useQuery.d.ts +1 -1
- package/lib/hooks/watched/useQuery.js +25 -25
- package/lib/hooks/watched/useSingleQuery.d.ts +5 -2
- package/lib/hooks/watched/useSingleQuery.js +13 -7
- package/lib/hooks/watched/useWatchedQuery.d.ts +2 -2
- package/lib/hooks/watched/useWatchedQuery.js +11 -8
- package/lib/hooks/watched/useWatchedQuerySubscription.d.ts +4 -0
- package/lib/hooks/watched/useWatchedQuerySubscription.js +16 -9
- package/lib/hooks/watched/watch-utils.d.ts +2 -1
- package/lib/hooks/watched/watch-utils.js +1 -1
- package/lib/index.d.ts +11 -11
- package/lib/index.js +9 -9
- package/package.json +6 -11
package/lib/QueryStore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractPowerSyncDatabase, WatchCompatibleQuery, WatchedQuery } from '@powersync/common';
|
|
2
|
-
import { DifferentialHookOptions } from './hooks/watched/watch-types';
|
|
2
|
+
import { DifferentialHookOptions } from './hooks/watched/watch-types.js';
|
|
3
3
|
export declare function generateQueryKey(sqlStatement: string, parameters: ReadonlyArray<unknown>, options: DifferentialHookOptions<unknown>): string;
|
|
4
4
|
export declare class QueryStore {
|
|
5
5
|
private db;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { QueryResult, ReadonlyQueryResult } from '../watched/watch-types';
|
|
1
|
+
import { QueryResult, ReadonlyQueryResult } from '../watched/watch-types.js';
|
|
2
2
|
export type SuspenseQueryResult<T> = Pick<QueryResult<T>, 'data' | 'refresh'>;
|
|
3
3
|
export type ReadonlySuspenseQueryResult<T> = Pick<ReadonlyQueryResult<T>, 'data' | 'refresh'>;
|
|
@@ -5,11 +5,8 @@ import { WatchedQuery } from '@powersync/common';
|
|
|
5
5
|
* before this component is committed. The promise will release it's listener once the query is no longer loading.
|
|
6
6
|
* This temporary hold is used to ensure that the query is not disposed in the interim.
|
|
7
7
|
* Creates a subscription for state change which creates a temporary hold on the query
|
|
8
|
-
* @returns a function to release the hold
|
|
9
8
|
*/
|
|
10
|
-
export declare const useTemporaryHold: (watchedQuery?: WatchedQuery<unknown>) =>
|
|
11
|
-
releaseHold: () => void;
|
|
12
|
-
};
|
|
9
|
+
export declare const useTemporaryHold: (watchedQuery?: WatchedQuery<unknown>) => void;
|
|
13
10
|
/**
|
|
14
11
|
* React suspense relies on a promise that resolves once the initial data has loaded.
|
|
15
12
|
* This creates a promise which registers a listener on the watched query.
|
|
@@ -5,20 +5,20 @@ import React from 'react';
|
|
|
5
5
|
* before this component is committed. The promise will release it's listener once the query is no longer loading.
|
|
6
6
|
* This temporary hold is used to ensure that the query is not disposed in the interim.
|
|
7
7
|
* Creates a subscription for state change which creates a temporary hold on the query
|
|
8
|
-
* @returns a function to release the hold
|
|
9
8
|
*/
|
|
10
9
|
export const useTemporaryHold = (watchedQuery) => {
|
|
11
10
|
const releaseTemporaryHold = React.useRef(undefined);
|
|
12
11
|
const addedHoldTo = React.useRef(undefined);
|
|
13
12
|
if (addedHoldTo.current !== watchedQuery) {
|
|
13
|
+
// The query changed, we no longer need the previous hold if present
|
|
14
14
|
releaseTemporaryHold.current?.();
|
|
15
|
+
releaseTemporaryHold.current = undefined;
|
|
15
16
|
addedHoldTo.current = watchedQuery;
|
|
16
17
|
if (!watchedQuery || !watchedQuery.state.isLoading) {
|
|
17
|
-
// No query to hold or no reason to hold, return
|
|
18
|
-
return
|
|
19
|
-
releaseHold: () => { }
|
|
20
|
-
};
|
|
18
|
+
// No query to hold or no reason to hold, return
|
|
19
|
+
return;
|
|
21
20
|
}
|
|
21
|
+
// Create a hold by subscribing
|
|
22
22
|
const disposeSubscription = watchedQuery.registerListener({
|
|
23
23
|
onStateChange: (state) => { }
|
|
24
24
|
});
|
|
@@ -50,9 +50,6 @@ export const useTemporaryHold = (watchedQuery) => {
|
|
|
50
50
|
// Set a timeout to conditionally remove the temporary hold
|
|
51
51
|
setTimeout(checkHold, timeoutPollMs);
|
|
52
52
|
}
|
|
53
|
-
return {
|
|
54
|
-
releaseHold: releaseTemporaryHold.current
|
|
55
|
-
};
|
|
56
53
|
};
|
|
57
54
|
/**
|
|
58
55
|
* React suspense relies on a promise that resolves once the initial data has loaded.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompilableQuery } from '@powersync/common';
|
|
2
|
-
import { AdditionalOptions } from '../watched/watch-types';
|
|
3
|
-
import { SuspenseQueryResult } from './SuspenseQueryResult';
|
|
2
|
+
import { AdditionalOptions } from '../watched/watch-types.js';
|
|
3
|
+
import { SuspenseQueryResult } from './SuspenseQueryResult.js';
|
|
4
4
|
/**
|
|
5
5
|
* Use a query which is not watched, but suspends until the initial result has loaded.
|
|
6
6
|
* Internally this uses a WatchedQuery during suspense for state management. The watched
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { generateQueryKey, getQueryStore } from '../../QueryStore';
|
|
3
|
-
import { usePowerSync } from '../PowerSyncContext';
|
|
4
|
-
import { constructCompatibleQuery } from '../watched/watch-utils';
|
|
5
|
-
import { createSuspendingPromise, useTemporaryHold } from './suspense-utils';
|
|
2
|
+
import { generateQueryKey, getQueryStore } from '../../QueryStore.js';
|
|
3
|
+
import { usePowerSync } from '../PowerSyncContext.js';
|
|
4
|
+
import { constructCompatibleQuery } from '../watched/watch-utils.js';
|
|
5
|
+
import { createSuspendingPromise, useTemporaryHold } from './suspense-utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Use a query which is not watched, but suspends until the initial result has loaded.
|
|
8
8
|
* Internally this uses a WatchedQuery during suspense for state management. The watched
|
|
@@ -25,7 +25,7 @@ export const useSingleSuspenseQuery = (query, parameters = [], options = {}) =>
|
|
|
25
25
|
const store = getQueryStore(powerSync);
|
|
26
26
|
// Only use a temporary watched query if we don't have data yet.
|
|
27
27
|
const watchedQuery = data ? null : store.getQuery(key, parsedQuery, options);
|
|
28
|
-
|
|
28
|
+
useTemporaryHold(watchedQuery);
|
|
29
29
|
React.useEffect(() => {
|
|
30
30
|
// Set the initial yielded data
|
|
31
31
|
// it should be available once we commit the component
|
|
@@ -36,9 +36,6 @@ export const useSingleSuspenseQuery = (query, parameters = [], options = {}) =>
|
|
|
36
36
|
setData(watchedQuery.state.data);
|
|
37
37
|
setError(null);
|
|
38
38
|
}
|
|
39
|
-
if (!watchedQuery?.state.isLoading) {
|
|
40
|
-
releaseHold();
|
|
41
|
-
}
|
|
42
39
|
}, []);
|
|
43
40
|
if (error != null) {
|
|
44
41
|
// Report errors - this is caught by an error boundary
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompilableQuery } from '@powersync/common';
|
|
2
|
-
import { AdditionalOptions, DifferentialHookOptions } from '../watched/watch-types';
|
|
3
|
-
import { ReadonlySuspenseQueryResult, SuspenseQueryResult } from './SuspenseQueryResult';
|
|
2
|
+
import { AdditionalOptions, DifferentialHookOptions } from '../watched/watch-types.js';
|
|
3
|
+
import { ReadonlySuspenseQueryResult, SuspenseQueryResult } from './SuspenseQueryResult.js';
|
|
4
4
|
/**
|
|
5
5
|
* A hook to access the results of a watched query that suspends until the initial result has loaded.
|
|
6
6
|
* @example
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useSingleSuspenseQuery } from './useSingleSuspenseQuery';
|
|
2
|
-
import { useWatchedSuspenseQuery } from './useWatchedSuspenseQuery';
|
|
1
|
+
import { useSingleSuspenseQuery } from './useSingleSuspenseQuery.js';
|
|
2
|
+
import { useWatchedSuspenseQuery } from './useWatchedSuspenseQuery.js';
|
|
3
3
|
export function useSuspenseQuery(query, parameters = [], options = {}) {
|
|
4
4
|
switch (options?.runQueryOnce) {
|
|
5
5
|
case true:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { createSuspendingPromise, useTemporaryHold } from './suspense-utils';
|
|
2
|
+
import { createSuspendingPromise, useTemporaryHold } from './suspense-utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* A hook to access and subscribe to the results of an existing {@link WatchedQuery}.
|
|
5
5
|
* @example
|
|
@@ -22,7 +22,7 @@ import { createSuspendingPromise, useTemporaryHold } from './suspense-utils';
|
|
|
22
22
|
* }
|
|
23
23
|
*/
|
|
24
24
|
export const useWatchedQuerySuspenseSubscription = (query) => {
|
|
25
|
-
|
|
25
|
+
useTemporaryHold(query);
|
|
26
26
|
// Force update state function
|
|
27
27
|
const [, setUpdateCounter] = React.useState(0);
|
|
28
28
|
React.useEffect(() => {
|
|
@@ -34,11 +34,6 @@ export const useWatchedQuerySuspenseSubscription = (query) => {
|
|
|
34
34
|
setUpdateCounter((prev) => prev + 1);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
// This runs on the first iteration before the component is suspended
|
|
38
|
-
// We should only release the hold once the component is no longer loading
|
|
39
|
-
if (!query.state.isLoading) {
|
|
40
|
-
releaseHold();
|
|
41
|
-
}
|
|
42
37
|
return dispose;
|
|
43
38
|
}, []);
|
|
44
39
|
if (query.state.error != null) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generateQueryKey, getQueryStore } from '../../QueryStore';
|
|
2
|
-
import { usePowerSync } from '../PowerSyncContext';
|
|
3
|
-
import { constructCompatibleQuery } from '../watched/watch-utils';
|
|
4
|
-
import { useWatchedQuerySuspenseSubscription } from './useWatchedQuerySuspenseSubscription';
|
|
1
|
+
import { generateQueryKey, getQueryStore } from '../../QueryStore.js';
|
|
2
|
+
import { usePowerSync } from '../PowerSyncContext.js';
|
|
3
|
+
import { constructCompatibleQuery } from '../watched/watch-utils.js';
|
|
4
|
+
import { useWatchedQuerySuspenseSubscription } from './useWatchedQuerySuspenseSubscription.js';
|
|
5
5
|
/**
|
|
6
6
|
* @internal This is not exported in the index.ts
|
|
7
7
|
*/
|
package/lib/hooks/useStatus.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CompilableQuery } from '@powersync/common';
|
|
2
|
-
import { AdditionalOptions, DifferentialHookOptions, QueryResult, ReadonlyQueryResult } from './watch-types';
|
|
2
|
+
import { AdditionalOptions, DifferentialHookOptions, QueryResult, ReadonlyQueryResult } from './watch-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* A hook to access the results of a watched query.
|
|
5
5
|
* @example
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { usePowerSync } from '../PowerSyncContext';
|
|
2
|
-
import { useSingleQuery } from './useSingleQuery';
|
|
3
|
-
import { useWatchedQuery } from './useWatchedQuery';
|
|
4
|
-
import { constructCompatibleQuery } from './watch-utils';
|
|
1
|
+
import { usePowerSync } from '../PowerSyncContext.js';
|
|
2
|
+
import { useSingleQuery } from './useSingleQuery.js';
|
|
3
|
+
import { useWatchedQuery } from './useWatchedQuery.js';
|
|
4
|
+
import { constructCompatibleQuery } from './watch-utils.js';
|
|
5
5
|
export function useQuery(query, parameters = [], options = {}) {
|
|
6
6
|
const powerSync = usePowerSync();
|
|
7
7
|
if (!powerSync) {
|
|
8
8
|
return { isLoading: false, isFetching: false, data: [], error: new Error('PowerSync not configured.') };
|
|
9
9
|
}
|
|
10
10
|
const { parsedQuery, queryChanged } = constructCompatibleQuery(query, parameters, options);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
const runOnce = options?.runQueryOnce == true;
|
|
12
|
+
const single = useSingleQuery({
|
|
13
|
+
query: parsedQuery,
|
|
14
|
+
powerSync,
|
|
15
|
+
queryChanged,
|
|
16
|
+
active: runOnce
|
|
17
|
+
});
|
|
18
|
+
const watched = useWatchedQuery({
|
|
19
|
+
query: parsedQuery,
|
|
20
|
+
powerSync,
|
|
21
|
+
queryChanged,
|
|
22
|
+
options: {
|
|
23
|
+
reportFetching: options.reportFetching,
|
|
24
|
+
// Maintains backwards compatibility with previous versions
|
|
25
|
+
// Differentiation is opt-in by default
|
|
26
|
+
// We emit new data for each table change by default.
|
|
27
|
+
rowComparator: options.rowComparator
|
|
28
|
+
},
|
|
29
|
+
active: !runOnce
|
|
30
|
+
});
|
|
31
|
+
return runOnce ? single : watched;
|
|
32
32
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { QueryResult } from './watch-types';
|
|
2
|
-
import { InternalHookOptions } from './watch-utils';
|
|
1
|
+
import { QueryResult } from './watch-types.js';
|
|
2
|
+
import { InternalHookOptions } from './watch-utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* @internal not exported from `index.ts`
|
|
5
|
+
*/
|
|
3
6
|
export declare const useSingleQuery: <RowType = any>(options: InternalHookOptions<RowType[]>) => QueryResult<RowType>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal not exported from `index.ts`
|
|
4
|
+
*/
|
|
2
5
|
export const useSingleQuery = (options) => {
|
|
3
|
-
const { query, powerSync, queryChanged } = options;
|
|
6
|
+
const { query, powerSync, queryChanged, active } = options;
|
|
4
7
|
const [output, setOutputState] = React.useState({
|
|
5
8
|
isLoading: true,
|
|
6
9
|
isFetching: true,
|
|
@@ -38,13 +41,16 @@ export const useSingleQuery = (options) => {
|
|
|
38
41
|
}
|
|
39
42
|
}, [queryChanged, query]);
|
|
40
43
|
// Trigger initial query execution
|
|
44
|
+
// @ts-ignore: Complains about not all code paths returning a value
|
|
41
45
|
React.useEffect(() => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (active) {
|
|
47
|
+
const abortController = new AbortController();
|
|
48
|
+
runQuery(abortController.signal);
|
|
49
|
+
return () => {
|
|
50
|
+
abortController.abort();
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, [powerSync, active, queryChanged]);
|
|
48
54
|
return {
|
|
49
55
|
...output,
|
|
50
56
|
refresh: runQuery
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DifferentialHookOptions, QueryResult, ReadonlyQueryResult } from './watch-types';
|
|
2
|
-
import { InternalHookOptions } from './watch-utils';
|
|
1
|
+
import { DifferentialHookOptions, QueryResult, ReadonlyQueryResult } from './watch-types.js';
|
|
2
|
+
import { InternalHookOptions } from './watch-utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal This is not exported from the index.ts
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useNullableWatchedQuerySubscription } from './useWatchedQuerySubscription.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal This is not exported from the index.ts
|
|
5
5
|
*
|
|
@@ -9,8 +9,11 @@ import { useWatchedQuerySubscription } from './useWatchedQuerySubscription';
|
|
|
9
9
|
* not affect the internal implementation in this case.
|
|
10
10
|
*/
|
|
11
11
|
export const useWatchedQuery = (options) => {
|
|
12
|
-
const { query, powerSync, queryChanged, options: hookOptions } = options;
|
|
13
|
-
|
|
12
|
+
const { query, powerSync, queryChanged, options: hookOptions, active } = options;
|
|
13
|
+
function createWatchedQuery() {
|
|
14
|
+
if (!active) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
14
17
|
const watch = hookOptions.rowComparator
|
|
15
18
|
? powerSync.customQuery(query).differentialWatch({
|
|
16
19
|
rowComparator: hookOptions.rowComparator,
|
|
@@ -22,22 +25,22 @@ export const useWatchedQuery = (options) => {
|
|
|
22
25
|
throttleMs: hookOptions.throttleMs
|
|
23
26
|
});
|
|
24
27
|
return watch;
|
|
25
|
-
}
|
|
28
|
+
}
|
|
26
29
|
const [watchedQuery, setWatchedQuery] = React.useState(createWatchedQuery);
|
|
27
30
|
React.useEffect(() => {
|
|
28
|
-
watchedQuery
|
|
31
|
+
watchedQuery?.close();
|
|
29
32
|
setWatchedQuery(createWatchedQuery);
|
|
30
|
-
}, [powerSync]);
|
|
33
|
+
}, [powerSync, active]);
|
|
31
34
|
// Indicates that the query will be re-fetched due to a change in the query.
|
|
32
35
|
// Used when `isFetching` hasn't been set to true yet due to React execution.
|
|
33
36
|
React.useEffect(() => {
|
|
34
37
|
if (queryChanged) {
|
|
35
|
-
watchedQuery
|
|
38
|
+
watchedQuery?.updateSettings({
|
|
36
39
|
query,
|
|
37
40
|
throttleMs: hookOptions.throttleMs,
|
|
38
41
|
reportFetching: hookOptions.reportFetching
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
44
|
}, [queryChanged]);
|
|
42
|
-
return
|
|
45
|
+
return useNullableWatchedQuerySubscription(watchedQuery);
|
|
43
46
|
};
|
|
@@ -14,3 +14,7 @@ import { WatchedQuery } from '@powersync/common';
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export declare const useWatchedQuerySubscription: <ResultType = unknown, Query extends WatchedQuery<ResultType> = WatchedQuery<ResultType>>(query: Query) => Query["state"];
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const useNullableWatchedQuerySubscription: <ResultType = unknown, Query extends WatchedQuery<ResultType> = WatchedQuery<ResultType>>(query: Query | null) => Query["state"] | undefined;
|
|
@@ -14,16 +14,23 @@ import React from 'react';
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export const useWatchedQuerySubscription = (query) => {
|
|
17
|
-
|
|
17
|
+
return useNullableWatchedQuerySubscription(query);
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export const useNullableWatchedQuerySubscription = (query) => {
|
|
23
|
+
const [output, setOutputState] = React.useState(query?.state);
|
|
24
|
+
// @ts-ignore: Complains about not all code paths returning a value
|
|
18
25
|
React.useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
26
|
+
if (query) {
|
|
27
|
+
setOutputState(query.state);
|
|
28
|
+
return query.registerListener({
|
|
29
|
+
onStateChange: (state) => {
|
|
30
|
+
setOutputState({ ...state });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
27
34
|
}, [query]);
|
|
28
35
|
return output;
|
|
29
36
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AbstractPowerSyncDatabase, CompilableQuery, WatchCompatibleQuery } from '@powersync/common';
|
|
2
|
-
import { AdditionalOptions } from './watch-types';
|
|
2
|
+
import { AdditionalOptions } from './watch-types.js';
|
|
3
3
|
export type InternalHookOptions<DataType> = {
|
|
4
4
|
query: WatchCompatibleQuery<DataType>;
|
|
5
5
|
powerSync: AbstractPowerSyncDatabase;
|
|
6
6
|
queryChanged: boolean;
|
|
7
|
+
active: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare const checkQueryChanged: <T>(query: WatchCompatibleQuery<T>, options: AdditionalOptions) => boolean;
|
|
9
10
|
export declare const constructCompatibleQuery: <RowType>(query: string | CompilableQuery<RowType>, parameters: any[], options: AdditionalOptions) => {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { usePowerSyncQuery } from './hooks/deprecated/usePowerSyncQuery';
|
|
2
|
-
export { usePowerSyncStatus } from './hooks/deprecated/usePowerSyncStatus';
|
|
3
|
-
export { usePowerSyncWatchedQuery } from './hooks/deprecated/usePowerSyncWatchedQuery';
|
|
4
|
-
export * from './hooks/PowerSyncContext';
|
|
5
|
-
export { SuspenseQueryResult } from './hooks/suspense/SuspenseQueryResult';
|
|
6
|
-
export { useSuspenseQuery } from './hooks/suspense/useSuspenseQuery';
|
|
7
|
-
export { useWatchedQuerySuspenseSubscription } from './hooks/suspense/useWatchedQuerySuspenseSubscription';
|
|
8
|
-
export { useStatus } from './hooks/useStatus';
|
|
9
|
-
export { useQuery } from './hooks/watched/useQuery';
|
|
10
|
-
export { useWatchedQuerySubscription } from './hooks/watched/useWatchedQuerySubscription';
|
|
11
|
-
export { AdditionalOptions } from './hooks/watched/watch-types';
|
|
1
|
+
export { usePowerSyncQuery } from './hooks/deprecated/usePowerSyncQuery.js';
|
|
2
|
+
export { usePowerSyncStatus } from './hooks/deprecated/usePowerSyncStatus.js';
|
|
3
|
+
export { usePowerSyncWatchedQuery } from './hooks/deprecated/usePowerSyncWatchedQuery.js';
|
|
4
|
+
export * from './hooks/PowerSyncContext.js';
|
|
5
|
+
export { SuspenseQueryResult } from './hooks/suspense/SuspenseQueryResult.js';
|
|
6
|
+
export { useSuspenseQuery } from './hooks/suspense/useSuspenseQuery.js';
|
|
7
|
+
export { useWatchedQuerySuspenseSubscription } from './hooks/suspense/useWatchedQuerySuspenseSubscription.js';
|
|
8
|
+
export { useStatus } from './hooks/useStatus.js';
|
|
9
|
+
export { useQuery } from './hooks/watched/useQuery.js';
|
|
10
|
+
export { useWatchedQuerySubscription } from './hooks/watched/useWatchedQuerySubscription.js';
|
|
11
|
+
export { AdditionalOptions } from './hooks/watched/watch-types.js';
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { usePowerSyncQuery } from './hooks/deprecated/usePowerSyncQuery';
|
|
2
|
-
export { usePowerSyncStatus } from './hooks/deprecated/usePowerSyncStatus';
|
|
3
|
-
export { usePowerSyncWatchedQuery } from './hooks/deprecated/usePowerSyncWatchedQuery';
|
|
4
|
-
export * from './hooks/PowerSyncContext';
|
|
5
|
-
export { useSuspenseQuery } from './hooks/suspense/useSuspenseQuery';
|
|
6
|
-
export { useWatchedQuerySuspenseSubscription } from './hooks/suspense/useWatchedQuerySuspenseSubscription';
|
|
7
|
-
export { useStatus } from './hooks/useStatus';
|
|
8
|
-
export { useQuery } from './hooks/watched/useQuery';
|
|
9
|
-
export { useWatchedQuerySubscription } from './hooks/watched/useWatchedQuerySubscription';
|
|
1
|
+
export { usePowerSyncQuery } from './hooks/deprecated/usePowerSyncQuery.js';
|
|
2
|
+
export { usePowerSyncStatus } from './hooks/deprecated/usePowerSyncStatus.js';
|
|
3
|
+
export { usePowerSyncWatchedQuery } from './hooks/deprecated/usePowerSyncWatchedQuery.js';
|
|
4
|
+
export * from './hooks/PowerSyncContext.js';
|
|
5
|
+
export { useSuspenseQuery } from './hooks/suspense/useSuspenseQuery.js';
|
|
6
|
+
export { useWatchedQuerySuspenseSubscription } from './hooks/suspense/useWatchedQuerySuspenseSubscription.js';
|
|
7
|
+
export { useStatus } from './hooks/useStatus.js';
|
|
8
|
+
export { useQuery } from './hooks/watched/useQuery.js';
|
|
9
|
+
export { useWatchedQuerySubscription } from './hooks/watched/useWatchedQuerySubscription.js';
|
package/package.json
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/react",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250828085411",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"description": "React components for JourneyApps PowerSync",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"main": "./lib/index.js",
|
|
10
11
|
"module": "./lib/index.js",
|
|
11
12
|
"types": "./lib/index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"lib"
|
|
14
15
|
],
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"types": "./lib/index.d.ts",
|
|
18
|
-
"import": "./lib/index.js",
|
|
19
|
-
"default": "./lib/index.js"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
16
|
"repository": {
|
|
23
17
|
"type": "git",
|
|
24
18
|
"url": "git+https://github.com/powersync-ja/powersync-js.git"
|
|
@@ -30,7 +24,7 @@
|
|
|
30
24
|
},
|
|
31
25
|
"homepage": "https://docs.powersync.com",
|
|
32
26
|
"peerDependencies": {
|
|
33
|
-
"@powersync/common": "
|
|
27
|
+
"@powersync/common": "0.0.0-dev-20250828085411",
|
|
34
28
|
"react": "*"
|
|
35
29
|
},
|
|
36
30
|
"devDependencies": {
|
|
@@ -41,14 +35,15 @@
|
|
|
41
35
|
"react": "18.3.1",
|
|
42
36
|
"react-dom": "18.3.1",
|
|
43
37
|
"react-error-boundary": "^4.1.0",
|
|
44
|
-
"@powersync/common": "
|
|
45
|
-
"@powersync/web": "
|
|
38
|
+
"@powersync/common": "0.0.0-dev-20250828085411",
|
|
39
|
+
"@powersync/web": "0.0.0-dev-20250828085411"
|
|
46
40
|
},
|
|
47
41
|
"scripts": {
|
|
48
42
|
"build": "tsc -b",
|
|
49
43
|
"build:prod": "tsc -b --sourceMap false",
|
|
50
44
|
"clean": "rm -rf lib tsconfig.tsbuildinfo",
|
|
51
45
|
"test": "vitest",
|
|
46
|
+
"test:exports": "attw --pack --profile=esm-only .",
|
|
52
47
|
"watch": "tsc -b -w"
|
|
53
48
|
}
|
|
54
49
|
}
|