vue-fate 1.5.0 → 1.5.2
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/README.md +5 -7
- package/lib/client.d.mts +3 -3
- package/lib/index.d.mts +15 -15
- package/lib/vite.d.mts +3 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1354,13 +1354,13 @@ Then pass `persistence` when creating the client:
|
|
|
1354
1354
|
|
|
1355
1355
|
```tsx
|
|
1356
1356
|
import { createPersistence } from '@nkzw/fate/persistence';
|
|
1357
|
-
import {
|
|
1357
|
+
import { createIndexedDBStorage } from '@nkzw/fate-indexeddb';
|
|
1358
1358
|
import { createFateClient } from 'react-fate/client';
|
|
1359
1359
|
|
|
1360
1360
|
const fate = createFateClient({
|
|
1361
1361
|
persistence: createPersistence({
|
|
1362
1362
|
key: `workspace:${workspaceId}:user:${userId}`,
|
|
1363
|
-
storage:
|
|
1363
|
+
storage: createIndexedDBStorage(),
|
|
1364
1364
|
}),
|
|
1365
1365
|
url: '/api/fate',
|
|
1366
1366
|
});
|
|
@@ -1373,7 +1373,7 @@ persistence: createPersistence({
|
|
|
1373
1373
|
key: `workspace:${workspaceId}:user:${userId}`,
|
|
1374
1374
|
maxAge: 24 * 60 * 60 * 1000,
|
|
1375
1375
|
maxBytes: 25 * 1024 * 1024,
|
|
1376
|
-
storage:
|
|
1376
|
+
storage: createIndexedDBStorage(),
|
|
1377
1377
|
}),
|
|
1378
1378
|
```
|
|
1379
1379
|
|
|
@@ -1545,7 +1545,7 @@ const durableHTTP = createHTTPTransport<MyAPI>({
|
|
|
1545
1545
|
|
|
1546
1546
|
const fate = createFateClient({
|
|
1547
1547
|
// ...your generated tRPC or GraphQL client options...
|
|
1548
|
-
persistence: createPersistence({ key: accountKey, storage:
|
|
1548
|
+
persistence: createPersistence({ key: accountKey, storage: createIndexedDBStorage() }),
|
|
1549
1549
|
mutateDurably: durableHTTP.mutateDurably,
|
|
1550
1550
|
});
|
|
1551
1551
|
```
|
|
@@ -1635,7 +1635,6 @@ The core persistence layer has no IndexedDB dependency. You can use another back
|
|
|
1635
1635
|
```ts
|
|
1636
1636
|
interface PersistenceStorage {
|
|
1637
1637
|
read(key: string): Promise<unknown>;
|
|
1638
|
-
write(key: string, value: unknown): Promise<void>;
|
|
1639
1638
|
scan(
|
|
1640
1639
|
prefix: string,
|
|
1641
1640
|
after?: string,
|
|
@@ -1650,9 +1649,8 @@ interface PersistenceStorage {
|
|
|
1650
1649
|
Values use fate's hydration codec and can be stored as JSON. The adapter handles storage and coordination:
|
|
1651
1650
|
|
|
1652
1651
|
- `read` returns the saved value for a key.
|
|
1653
|
-
- `write` replaces one value atomically and resolves after it has committed.
|
|
1654
1652
|
- `scan` returns keys under a prefix in ascending order, strictly after the optional cursor, up to the limit (64 by default). Use your backend's ordered index to keep each scan small.
|
|
1655
|
-
- `writeBatch` commits all entries atomically. An `undefined` value deletes the key.
|
|
1653
|
+
- `writeBatch` commits all entries atomically and resolves after they have committed. An `undefined` value deletes the key. Use a one-entry batch for a single write.
|
|
1656
1654
|
- `exclusive` coordinates every tab or process sharing the backend. Different lock names are independent: fate holds a delivery lock during network work and acquires a separate write lock when updating storage. Your adapter must allow that nesting.
|
|
1657
1655
|
- `subscribe` notifies other clients after a change commits, including keys changed by `writeBatch`. Without notifications, clients check saved mutations during delivery attempts and explicit `retry()` calls.
|
|
1658
1656
|
|
package/lib/client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFateClient } from "@nkzw/fate/client";
|
|
2
2
|
//#region src/client.d.ts
|
|
3
|
-
interface ClientMutations {}
|
|
4
|
-
interface ClientRoots {}
|
|
3
|
+
export interface ClientMutations {}
|
|
4
|
+
export interface ClientRoots {}
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { createFateClient };
|
package/lib/index.d.mts
CHANGED
|
@@ -14,17 +14,17 @@ type RequestResource<T> = {
|
|
|
14
14
|
/**
|
|
15
15
|
* Declares the data a component or screen needs and exposes it as a Vue resource.
|
|
16
16
|
*/
|
|
17
|
-
declare function useRequest<R extends Request, O extends FateRoots = Roots>(request: MaybeRefOrGetter<R>, options?: RequestOptions): RequestResource<RequestResult<O, R>>;
|
|
17
|
+
export declare function useRequest<R extends Request, O extends FateRoots = Roots>(request: MaybeRefOrGetter<R>, options?: RequestOptions): RequestResource<RequestResult<O, R>>;
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/context.d.ts
|
|
20
20
|
type GeneratedFateClient = ReturnType<typeof import('vue-fate/client').createFateClient>;
|
|
21
21
|
type Mutations = [GeneratedFateClient] extends [never] ? FateMutations : GeneratedFateClient extends FateClient$1<any, infer M> ? M : FateMutations;
|
|
22
22
|
type FateClientSource = ComputedRef<FateClient$1<any, any>> | Ref<FateClient$1<any, any>>;
|
|
23
|
-
declare const FateClientKey: InjectionKey<FateClientSource>;
|
|
23
|
+
export declare const FateClientKey: InjectionKey<FateClientSource>;
|
|
24
24
|
/**
|
|
25
25
|
* Provides a configured fate client to Vue composables.
|
|
26
26
|
*/
|
|
27
|
-
declare const FateClient: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
27
|
+
export declare const FateClient: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
28
28
|
client: {
|
|
29
29
|
required: true;
|
|
30
30
|
type: PropType<MaybeRefOrGetter<FateClient$1<any, any>>>;
|
|
@@ -37,12 +37,12 @@ declare const FateClient: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
37
37
|
type: PropType<MaybeRefOrGetter<FateClient$1<any, any>>>;
|
|
38
38
|
};
|
|
39
39
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
-
declare const provideFateClient: (client: MaybeRefOrGetter<FateClient$1<any, any>>) => void;
|
|
41
|
-
declare const createFatePlugin: (client: MaybeRefOrGetter<FateClient$1<any, any>>) => Plugin;
|
|
40
|
+
export declare const provideFateClient: (client: MaybeRefOrGetter<FateClient$1<any, any>>) => void;
|
|
41
|
+
export declare const createFatePlugin: (client: MaybeRefOrGetter<FateClient$1<any, any>>) => Plugin;
|
|
42
42
|
/**
|
|
43
43
|
* Returns the nearest fate client from Vue dependency injection.
|
|
44
44
|
*/
|
|
45
|
-
declare function useFateClient<T extends [Roots, Mutations] = [Roots, Mutations]>(): FateClient$1<T[0], T[1]>;
|
|
45
|
+
export declare function useFateClient<T extends [Roots, Mutations] = [Roots, Mutations]>(): FateClient$1<T[0], T[1]>;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/listView.d.ts
|
|
48
48
|
type ConnectionItems<C> = C extends {
|
|
@@ -71,7 +71,7 @@ type ListViewState<C> = [ShallowRef<ConnectionItems<ResolvedConnection<C>>>, Sha
|
|
|
71
71
|
/**
|
|
72
72
|
* Subscribes to a connection field, returning the current items and pagination helpers.
|
|
73
73
|
*/
|
|
74
|
-
declare function useListView<C extends ConnectionValue$1 | Deferred$1<ConnectionValue$1> | null | undefined>(selection: ConnectionSelection, connection: MaybeRefOrGetter<C>): ListViewState<C>;
|
|
74
|
+
export declare function useListView<C extends ConnectionValue$1 | Deferred$1<ConnectionValue$1> | null | undefined>(selection: ConnectionSelection, connection: MaybeRefOrGetter<C>): ListViewState<C>;
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/useLiveListView.d.ts
|
|
77
77
|
type ConnectionValue = {
|
|
@@ -81,7 +81,7 @@ type ConnectionValue = {
|
|
|
81
81
|
/**
|
|
82
82
|
* Subscribes to a connection field, returning live-updating items and pagination helpers.
|
|
83
83
|
*/
|
|
84
|
-
declare function useLiveListView<C extends ConnectionValue | Deferred$1<ConnectionValue> | null | undefined>(selection: ConnectionSelection, connection: MaybeRefOrGetter<C>): ListViewState<C>;
|
|
84
|
+
export declare function useLiveListView<C extends ConnectionValue | Deferred$1<ConnectionValue> | null | undefined>(selection: ConnectionSelection, connection: MaybeRefOrGetter<C>): ListViewState<C>;
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/useView.d.ts
|
|
87
87
|
type ViewEntityWithTypename$1<V extends View<any, any>> = ViewEntity<V> & {
|
|
@@ -97,9 +97,9 @@ type ViewResource<T> = ShallowRef<T> & {
|
|
|
97
97
|
/**
|
|
98
98
|
* Resolves a reference against a view and subscribes to updates for that selection.
|
|
99
99
|
*/
|
|
100
|
-
declare function useView<V extends View<any, any>, R extends ViewRef$1<ViewEntityName<V>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>>>;
|
|
101
|
-
declare function useView<V extends View<any, any>, R extends Deferred$1<ViewRef$1<ViewEntityName<V>>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>>>;
|
|
102
|
-
declare function useView<V extends View<any, any>>(view: V, ref: MaybeRefOrGetter<Deferred$1<ViewRef$1<ViewEntityName<V>>> | ViewRef$1<ViewEntityName<V>> | null>): ViewResource<ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>> | null>;
|
|
100
|
+
export declare function useView<V extends View<any, any>, R extends ViewRef$1<ViewEntityName<V>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>>>;
|
|
101
|
+
export declare function useView<V extends View<any, any>, R extends Deferred$1<ViewRef$1<ViewEntityName<V>>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>>>;
|
|
102
|
+
export declare function useView<V extends View<any, any>>(view: V, ref: MaybeRefOrGetter<Deferred$1<ViewRef$1<ViewEntityName<V>>> | ViewRef$1<ViewEntityName<V>> | null>): ViewResource<ViewData<ViewEntityWithTypename$1<V>, ViewSelection<V>> | null>;
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region src/useLiveView.d.ts
|
|
105
105
|
type ViewEntityWithTypename<V extends View<any, any>> = ViewEntity<V> & {
|
|
@@ -108,8 +108,8 @@ type ViewEntityWithTypename<V extends View<any, any>> = ViewEntity<V> & {
|
|
|
108
108
|
/**
|
|
109
109
|
* Resolves a reference against a view and subscribes to live server updates for that selection.
|
|
110
110
|
*/
|
|
111
|
-
declare function useLiveView<V extends View<any, any>, R extends ViewRef$1<ViewEntityName<V>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename<V>, ViewSelection<V>>>;
|
|
112
|
-
declare function useLiveView<V extends View<any, any>, R extends Deferred$1<ViewRef$1<ViewEntityName<V>>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename<V>, ViewSelection<V>>>;
|
|
113
|
-
declare function useLiveView<V extends View<any, any>>(view: V, ref: MaybeRefOrGetter<Deferred$1<ViewRef$1<ViewEntityName<V>>> | ViewRef$1<ViewEntityName<V>> | null>): ViewResource<ViewData<ViewEntityWithTypename<V>, ViewSelection<V>> | null>;
|
|
111
|
+
export declare function useLiveView<V extends View<any, any>, R extends ViewRef$1<ViewEntityName<V>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename<V>, ViewSelection<V>>>;
|
|
112
|
+
export declare function useLiveView<V extends View<any, any>, R extends Deferred$1<ViewRef$1<ViewEntityName<V>>> | null>(view: V, ref: MaybeRefOrGetter<R>): ViewResource<R extends null ? null : ViewData<ViewEntityWithTypename<V>, ViewSelection<V>>>;
|
|
113
|
+
export declare function useLiveView<V extends View<any, any>>(view: V, ref: MaybeRefOrGetter<Deferred$1<ViewRef$1<ViewEntityName<V>>> | ViewRef$1<ViewEntityName<V>> | null>): ViewResource<ViewData<ViewEntityWithTypename<V>, ViewSelection<V>> | null>;
|
|
114
114
|
//#endregion
|
|
115
|
-
export { type ConnectionRef, type Deferred,
|
|
115
|
+
export { type ConnectionRef, type Deferred, type FateDehydratedState, type GraphQLMutationDefinition, type GraphQLMutationInput, type GraphQLMutationMap, type GraphQLMutationOutput, type GraphQLTransportOptions, type HydrateOptions, type HydrationLimits, type InferFateAPI, type ListViewState, type Pagination, type Persistence, type PersistenceSession, type PersistenceSnapshot, type RequestResource, type ViewRef, type ViewResource, clientRoot, createClient, createGraphQLTransport, createHTTPTransport, createTRPCTransport, defer, graphqlMutation, mutation, toEntityId, view };
|
package/lib/vite.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FateViteTransport, fate as fate$1 } from "@nkzw/fate/vite";
|
|
2
2
|
//#region src/vite.d.ts
|
|
3
|
-
type FateVitePluginOptions = {
|
|
3
|
+
export type FateVitePluginOptions = {
|
|
4
4
|
generatedFile?: false | string;
|
|
5
5
|
module: string;
|
|
6
6
|
transport?: FateViteTransport;
|
|
7
7
|
tsconfigFile?: false | string;
|
|
8
8
|
};
|
|
9
|
-
declare const fate: (options: FateVitePluginOptions) => ReturnType<typeof fate$1>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { FateVitePluginOptions, fate };
|
|
9
|
+
export declare const fate: (options: FateVitePluginOptions) => ReturnType<typeof fate$1>;
|
|
10
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-fate",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "fate is a modern data client for Vue.",
|
|
5
5
|
"homepage": "https://github.com/nkzw-tech/fate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@nkzw/fate": "^1.5.
|
|
43
|
+
"@nkzw/fate": "^1.5.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"vue": "^3.5.42"
|