@triplit/svelte 0.1.39 → 0.1.40
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/dist/index.svelte.d.ts +14 -0
- package/dist/index.svelte.js +14 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.svelte.d.ts
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
import type { ClientFetchResult, ClientQuery, ClientQueryBuilder, Models, SubscriptionOptions, TriplitClient, Unalias } from '@triplit/client';
|
2
2
|
import { WorkerClient } from '@triplit/client/worker-client';
|
3
|
+
/**
|
4
|
+
* A hook that subscribes to a query
|
5
|
+
*
|
6
|
+
* @param client - The client instance to query with
|
7
|
+
* @param query - The query to subscribe to
|
8
|
+
* @param options - Additional options for the subscription
|
9
|
+
* @returns An object containing the fetching state, the result of the query, any error that occurred, and a function to update the query
|
10
|
+
*/
|
3
11
|
export declare function useQuery<M extends Models<any, any> | undefined, Q extends ClientQuery<M, any, any, any>>(client: TriplitClient<any> | WorkerClient<any>, query: ClientQueryBuilder<Q>, options?: Partial<SubscriptionOptions>): {
|
4
12
|
fetching: boolean;
|
5
13
|
fetchingLocal: boolean;
|
@@ -8,6 +16,12 @@ export declare function useQuery<M extends Models<any, any> | undefined, Q exten
|
|
8
16
|
error: any;
|
9
17
|
updateQuery: (query: ClientQueryBuilder<Q>) => void;
|
10
18
|
};
|
19
|
+
/**
|
20
|
+
* A hook that subscribes to the connection status of a client with the server
|
21
|
+
*
|
22
|
+
* @param client - The client instance to get the connection status of
|
23
|
+
* @returns An object containing `status`, the current connection status of the client with the server
|
24
|
+
*/
|
11
25
|
export declare function useConnectionStatus(client: TriplitClient<any> | WorkerClient<any>): {
|
12
26
|
readonly status: string;
|
13
27
|
};
|
package/dist/index.svelte.js
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
/// <reference types="svelte" />
|
2
|
+
/**
|
3
|
+
* A hook that subscribes to a query
|
4
|
+
*
|
5
|
+
* @param client - The client instance to query with
|
6
|
+
* @param query - The query to subscribe to
|
7
|
+
* @param options - Additional options for the subscription
|
8
|
+
* @returns An object containing the fetching state, the result of the query, any error that occurred, and a function to update the query
|
9
|
+
*/
|
2
10
|
export function useQuery(client, query, options) {
|
3
11
|
let results = $state(undefined);
|
4
12
|
let isInitialFetch = $state(true);
|
@@ -72,6 +80,12 @@ export function useQuery(client, query, options) {
|
|
72
80
|
updateQuery,
|
73
81
|
};
|
74
82
|
}
|
83
|
+
/**
|
84
|
+
* A hook that subscribes to the connection status of a client with the server
|
85
|
+
*
|
86
|
+
* @param client - The client instance to get the connection status of
|
87
|
+
* @returns An object containing `status`, the current connection status of the client with the server
|
88
|
+
*/
|
75
89
|
export function useConnectionStatus(client) {
|
76
90
|
let status = $state('CONNECTING');
|
77
91
|
$effect(() => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@triplit/svelte",
|
3
3
|
"packageManager": "yarn@3.4.1",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.40",
|
5
5
|
"source": "./src/index.svelte.ts",
|
6
6
|
"main": "./dist/index.svelte.js",
|
7
7
|
"module": "./dist/index.svelte.js",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"/dist"
|
29
29
|
],
|
30
30
|
"dependencies": {
|
31
|
-
"@triplit/client": "^0.3.
|
31
|
+
"@triplit/client": "^0.3.68"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@sveltejs/package": "^2.3.0",
|