@kimesh/query 0.2.45 → 0.2.46
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.mjs +2 -27
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { QueryClient, QueryClient as QueryClient$1, VueQueryPlugin, VueQueryPlug
|
|
|
2
2
|
import { ofetch } from "ofetch";
|
|
3
3
|
import { computed, isRef, ref, toValue, watch } from "vue";
|
|
4
4
|
import { hash } from "ohash";
|
|
5
|
-
|
|
6
5
|
//#region src/plugin.ts
|
|
7
6
|
/** Default timing values */
|
|
8
7
|
const DEFAULT_STALE_TIME = 5 * 1e3;
|
|
@@ -55,7 +54,6 @@ const KimeshQueryPlugin = { install(app, options = {}) {
|
|
|
55
54
|
queryClient
|
|
56
55
|
});
|
|
57
56
|
} };
|
|
58
|
-
|
|
59
57
|
//#endregion
|
|
60
58
|
//#region src/fetch/create-fetch.ts
|
|
61
59
|
/**
|
|
@@ -86,7 +84,6 @@ function createKmFetch(config = {}) {
|
|
|
86
84
|
});
|
|
87
85
|
return fetchInstance;
|
|
88
86
|
}
|
|
89
|
-
|
|
90
87
|
//#endregion
|
|
91
88
|
//#region src/fetch/layer-fetch.ts
|
|
92
89
|
/**
|
|
@@ -207,7 +204,6 @@ const $fetch = new Proxy((() => {}), {
|
|
|
207
204
|
return promise;
|
|
208
205
|
}
|
|
209
206
|
});
|
|
210
|
-
|
|
211
207
|
//#endregion
|
|
212
208
|
//#region src/fetch/fetch-plugin.ts
|
|
213
209
|
function extractFetchConfig(config) {
|
|
@@ -322,7 +318,6 @@ function layerFetchPlugin(options) {
|
|
|
322
318
|
plugin._name = `kimesh:fetch:${layer}`;
|
|
323
319
|
return plugin;
|
|
324
320
|
}
|
|
325
|
-
|
|
326
321
|
//#endregion
|
|
327
322
|
//#region src/fetch/global-fetch.ts
|
|
328
323
|
/**
|
|
@@ -351,16 +346,7 @@ function useGlobalFetch() {
|
|
|
351
346
|
if (!globalInstance) globalInstance = createKmFetch({});
|
|
352
347
|
return globalInstance;
|
|
353
348
|
}
|
|
354
|
-
|
|
355
|
-
* Global $fetch proxy that lazily accesses the global fetch instance.
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* ```ts
|
|
359
|
-
* const users = await $fetch('/api/users')
|
|
360
|
-
* const user = await $fetch('/api/users', { method: 'POST', body: { name: 'John' } })
|
|
361
|
-
* ```
|
|
362
|
-
*/
|
|
363
|
-
const $fetch$1 = new Proxy((() => {}), {
|
|
349
|
+
new Proxy((() => {}), {
|
|
364
350
|
get(_target, prop) {
|
|
365
351
|
const instance = useGlobalFetch();
|
|
366
352
|
const value = instance[prop];
|
|
@@ -370,7 +356,6 @@ const $fetch$1 = new Proxy((() => {}), {
|
|
|
370
356
|
return useGlobalFetch()(args[0], args[1]);
|
|
371
357
|
}
|
|
372
358
|
});
|
|
373
|
-
|
|
374
359
|
//#endregion
|
|
375
360
|
//#region src/loader.ts
|
|
376
361
|
/**
|
|
@@ -412,7 +397,6 @@ function extractLoaders(to) {
|
|
|
412
397
|
}
|
|
413
398
|
return loaders;
|
|
414
399
|
}
|
|
415
|
-
|
|
416
400
|
//#endregion
|
|
417
401
|
//#region src/prefetch.ts
|
|
418
402
|
/**
|
|
@@ -487,7 +471,6 @@ function createPrefetcher(queryClient, router) {
|
|
|
487
471
|
await Promise.all(loaders.map((loader) => executeLoader(queryClient, loader)));
|
|
488
472
|
};
|
|
489
473
|
}
|
|
490
|
-
|
|
491
474
|
//#endregion
|
|
492
475
|
//#region src/composables/useKmFetch.ts
|
|
493
476
|
/**
|
|
@@ -619,7 +602,6 @@ function useLazyKmFetch(url, options = {}) {
|
|
|
619
602
|
immediate: true
|
|
620
603
|
});
|
|
621
604
|
}
|
|
622
|
-
|
|
623
605
|
//#endregion
|
|
624
606
|
//#region src/composables/useKmAsyncData.ts
|
|
625
607
|
/**
|
|
@@ -702,7 +684,6 @@ function useLazyKmAsyncData(key, handler, options = {}) {
|
|
|
702
684
|
immediate: true
|
|
703
685
|
});
|
|
704
686
|
}
|
|
705
|
-
|
|
706
687
|
//#endregion
|
|
707
688
|
//#region src/composables/useKmData.ts
|
|
708
689
|
/**
|
|
@@ -724,7 +705,6 @@ function useKmData(key) {
|
|
|
724
705
|
}
|
|
725
706
|
});
|
|
726
707
|
}
|
|
727
|
-
|
|
728
708
|
//#endregion
|
|
729
709
|
//#region src/define-query.ts
|
|
730
710
|
/**
|
|
@@ -794,7 +774,6 @@ function defineQuery(options) {
|
|
|
794
774
|
});
|
|
795
775
|
};
|
|
796
776
|
}
|
|
797
|
-
|
|
798
777
|
//#endregion
|
|
799
778
|
//#region src/define-mutation.ts
|
|
800
779
|
/**
|
|
@@ -828,7 +807,6 @@ function defineMutation(options) {
|
|
|
828
807
|
});
|
|
829
808
|
};
|
|
830
809
|
}
|
|
831
|
-
|
|
832
810
|
//#endregion
|
|
833
811
|
//#region src/query-keys.ts
|
|
834
812
|
/**
|
|
@@ -867,7 +845,6 @@ function createQueryKeyFactory(root, keys) {
|
|
|
867
845
|
];
|
|
868
846
|
return factory;
|
|
869
847
|
}
|
|
870
|
-
|
|
871
848
|
//#endregion
|
|
872
849
|
//#region src/defer.ts
|
|
873
850
|
/**
|
|
@@ -929,7 +906,6 @@ function defer(queryClient, ...queries) {
|
|
|
929
906
|
function deferWithPromises(queryClient, ...queries) {
|
|
930
907
|
return queries.map((query) => prefetchSingleQuery(queryClient, query));
|
|
931
908
|
}
|
|
932
|
-
|
|
933
909
|
//#endregion
|
|
934
910
|
//#region src/suspense.ts
|
|
935
911
|
/**
|
|
@@ -1021,6 +997,5 @@ async function useSuspenseInfiniteQuery(optionsOrGetter) {
|
|
|
1021
997
|
await result.suspense();
|
|
1022
998
|
return result;
|
|
1023
999
|
}
|
|
1024
|
-
|
|
1025
1000
|
//#endregion
|
|
1026
|
-
export { $fetch, KimeshQueryPlugin, QueryClient, VueQueryPlugin, createKimeshQueryClient, createKmFetch, createNamedFetchPlugin, createPrefetcher, createQueryKeyFactory, defer, deferWithPromises, defineMutation, defineQuery, defineQueryOptions, executeLoader, extractLoaders, fetchPlugin, getCurrentLayer, getLayerFetch, hasLoader, initGlobalFetch, initLayerFetch, isLayerFetchInitialized, layerFetchPlugin, queryOptions, setCurrentLayer, setupQueryPrefetching, useGlobalFetch, useInfiniteQuery, useKmAsyncData, useKmData, useKmFetch, useLazyKmAsyncData, useLazyKmFetch, useMutation, useQuery, useQueryClient, useSuspenseInfiniteQuery, useSuspenseQuery };
|
|
1001
|
+
export { $fetch, KimeshQueryPlugin, QueryClient, VueQueryPlugin, createKimeshQueryClient, createKmFetch, createNamedFetchPlugin, createPrefetcher, createQueryKeyFactory, defer, deferWithPromises, defineMutation, defineQuery, defineQueryOptions, executeLoader, extractLoaders, fetchPlugin, getCurrentLayer, getLayerFetch, hasLoader, initGlobalFetch, initLayerFetch, isLayerFetchInitialized, layerFetchPlugin, queryOptions, setCurrentLayer, setupQueryPrefetching, useGlobalFetch, useInfiniteQuery, useKmAsyncData, useKmData, useKmFetch, useLazyKmAsyncData, useLazyKmFetch, useMutation, useQuery, useQueryClient, useSuspenseInfiniteQuery, useSuspenseQuery };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/query",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"description": "Query utilities for Kimesh framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@tanstack/vue-query": "^5.92.9",
|
|
34
34
|
"@types/node": "^25.0.8",
|
|
35
|
-
"tsdown": "^0.
|
|
35
|
+
"tsdown": "^0.21.2",
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
37
|
"vitest": "^4.0.17",
|
|
38
38
|
"vue": "^3.5.29",
|