@data-fair/lib-vue 1.26.0 → 1.27.1
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/fetch.d.ts +1 -0
- package/fetch.js +3 -2
- package/package.json +7 -3
- package/reactive-search-params.d.ts +11 -4
- package/session.d.ts +4 -2
package/fetch.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type UseFetchOptions = {
|
|
|
6
6
|
watch?: Boolean;
|
|
7
7
|
notifError?: Boolean;
|
|
8
8
|
immediate?: Boolean;
|
|
9
|
+
waitFor?: MaybeRefOrGetter<Boolean>;
|
|
9
10
|
};
|
|
10
11
|
type OptionalUrl = string | null | undefined;
|
|
11
12
|
export declare function useFetch<T>(url: MaybeRefOrGetter<OptionalUrl>, options?: UseFetchOptions): {
|
package/fetch.js
CHANGED
|
@@ -4,10 +4,11 @@ import { computed, watch, ref, shallowRef, readonly, shallowReadonly, toValue }
|
|
|
4
4
|
import { useUiNotif } from '@data-fair/lib-vue/ui-notif.js';
|
|
5
5
|
export function useFetch(url, options = {}) {
|
|
6
6
|
const { sendUiNotif } = useUiNotif();
|
|
7
|
-
if (typeof url === 'function')
|
|
8
|
-
url = computed(url);
|
|
9
7
|
const fullUrl = computed(() => {
|
|
10
8
|
let fullUrl = toValue(url);
|
|
9
|
+
const waitFor = toValue(options.waitFor);
|
|
10
|
+
if (waitFor === false)
|
|
11
|
+
return null;
|
|
11
12
|
if (!fullUrl)
|
|
12
13
|
return null;
|
|
13
14
|
const query = toValue(options.query);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/lib-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"description": "Composables and other utilities for Vue applications in the data-fair stack.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"dayjs": "1",
|
|
18
18
|
"ofetch": "1",
|
|
19
19
|
"reconnecting-websocket": "4",
|
|
20
|
-
"vue": "3"
|
|
20
|
+
"vue": "3",
|
|
21
|
+
"vue-router": "4 || 5"
|
|
21
22
|
},
|
|
22
23
|
"peerDependenciesMeta": {
|
|
23
24
|
"reconnecting-websocket": {
|
|
@@ -25,6 +26,9 @@
|
|
|
25
26
|
},
|
|
26
27
|
"dayjs": {
|
|
27
28
|
"optional": true
|
|
29
|
+
},
|
|
30
|
+
"vue-router": {
|
|
31
|
+
"optional": true
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
},
|
|
37
41
|
"devDependencies": {
|
|
38
42
|
"reconnecting-websocket": "^4.4.0",
|
|
39
|
-
"vue-router": "^
|
|
43
|
+
"vue-router": "^5.0.3"
|
|
40
44
|
},
|
|
41
45
|
"type": "module"
|
|
42
46
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import type { App } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { App, ShallowRef } from 'vue';
|
|
2
|
+
interface ReactiveSearchParamsRouter {
|
|
3
|
+
currentRoute: ShallowRef<{
|
|
4
|
+
query: Record<string, string | null | (string | null)[]>;
|
|
5
|
+
}>;
|
|
6
|
+
replace: (to: {
|
|
7
|
+
query: Record<string, string>;
|
|
8
|
+
}) => unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare function getReactiveSearchParams(router?: ReactiveSearchParamsRouter): Record<string, string>;
|
|
4
11
|
export declare const reactiveSearchParamsKey: unique symbol;
|
|
5
|
-
export declare function createReactiveSearchParams(router?:
|
|
12
|
+
export declare function createReactiveSearchParams(router?: ReactiveSearchParamsRouter): {
|
|
6
13
|
install(app: App): void;
|
|
7
14
|
state: Record<string, string>;
|
|
8
15
|
};
|
package/session.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type IncomingMessage } from 'node:http';
|
|
2
2
|
import { type Ref, type ComputedRef, type App } from 'vue';
|
|
3
|
-
import { type RouteLocation } from 'vue-router';
|
|
4
3
|
import { type fetch } from 'ofetch';
|
|
4
|
+
interface RouteLocationLike {
|
|
5
|
+
fullPath: string;
|
|
6
|
+
}
|
|
5
7
|
import { type AccountKeys, type SessionState, type SessionStateAuthenticated } from '@data-fair/lib-common-types/session/index.js';
|
|
6
8
|
export * from '@data-fair/lib-common-types/session/index.js';
|
|
7
9
|
interface GenericCookies {
|
|
@@ -13,7 +15,7 @@ export interface SessionOptions {
|
|
|
13
15
|
sitePath: string;
|
|
14
16
|
directoryUrl: string;
|
|
15
17
|
defaultLang: string;
|
|
16
|
-
route?:
|
|
18
|
+
route?: RouteLocationLike;
|
|
17
19
|
logoutRedirectUrl?: string;
|
|
18
20
|
req?: IncomingMessage;
|
|
19
21
|
cookies?: GenericCookies;
|