@dyrected/nuxt 2.5.61 → 2.5.63
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/module.json
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { AsyncData } from "nuxt/app";
|
|
2
|
+
import { type DyrectedClient, type SchemaShape, type RegisteredSchema, type PaginatedResult } from "@dyrected/sdk";
|
|
3
|
+
/** A collection slug from your registered schema (or any string until types are generated). */
|
|
4
|
+
type CollectionSlug = keyof RegisteredSchema["collections"] & string;
|
|
5
|
+
/** The document type for a given collection slug. */
|
|
6
|
+
type CollectionDoc<K extends CollectionSlug> = RegisteredSchema["collections"][K];
|
|
7
|
+
/** A global slug from your registered schema. */
|
|
8
|
+
type GlobalSlug = keyof RegisteredSchema["globals"] & string;
|
|
9
|
+
/** The data type for a given global slug. */
|
|
10
|
+
type GlobalData<K extends GlobalSlug> = RegisteredSchema["globals"][K];
|
|
11
|
+
export declare const useDyrectedClient: <TSchema extends SchemaShape = RegisteredSchema>() => DyrectedClient<TSchema>;
|
|
12
|
+
export declare const useDyrected: <TSchema extends SchemaShape = RegisteredSchema>() => DyrectedClient<TSchema>;
|
|
13
|
+
export declare const useDyrectedDoc: <K extends CollectionSlug, T = CollectionDoc<K>>(collection: K, id: string, options?: {
|
|
5
14
|
depth?: number;
|
|
6
15
|
initialData?: T;
|
|
7
|
-
}) =>
|
|
8
|
-
export declare const useDyrectedCollection: <
|
|
16
|
+
}) => AsyncData<T | null, Error>;
|
|
17
|
+
export declare const useDyrectedCollection: <K extends CollectionSlug, T = CollectionDoc<K>>(collection: K, options?: {
|
|
9
18
|
depth?: number;
|
|
10
19
|
limit?: number;
|
|
11
20
|
page?: number;
|
|
12
21
|
sort?: string;
|
|
13
22
|
where?: any;
|
|
14
23
|
initialData?: T[];
|
|
15
|
-
}) =>
|
|
16
|
-
export declare function useDyrectedGlobal<
|
|
24
|
+
}) => AsyncData<PaginatedResult<T> | null, Error>;
|
|
25
|
+
export declare function useDyrectedGlobal<K extends GlobalSlug, T = GlobalData<K>>(slug: K, options?: {
|
|
17
26
|
depth?: number;
|
|
18
27
|
initialData?: T;
|
|
19
28
|
watch?: any[];
|
|
20
|
-
}):
|
|
29
|
+
}): AsyncData<T | null, Error>;
|
|
30
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useRuntimeConfig, useAsyncData, useRequestFetch } from "#app";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createClient
|
|
4
|
+
} from "@dyrected/sdk";
|
|
3
5
|
function getClient() {
|
|
4
6
|
const config = useRuntimeConfig().public.dyrected;
|
|
5
7
|
const fetcher = useRequestFetch();
|
|
@@ -13,7 +15,7 @@ function getClient() {
|
|
|
13
15
|
export const useDyrectedClient = () => {
|
|
14
16
|
return getClient();
|
|
15
17
|
};
|
|
16
|
-
export const useDyrected =
|
|
18
|
+
export const useDyrected = () => getClient();
|
|
17
19
|
export const useDyrectedDoc = (collection, id, options) => {
|
|
18
20
|
const client = getClient();
|
|
19
21
|
return useAsyncData(
|
|
@@ -32,9 +34,8 @@ export const useDyrectedCollection = (collection, options) => {
|
|
|
32
34
|
export function useDyrectedGlobal(slug, options) {
|
|
33
35
|
const client = getClient();
|
|
34
36
|
const key = `dyrected:global:${slug}:${JSON.stringify(options || {})}`;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
37
|
+
const { watch, ...clientOptions } = options || {};
|
|
38
|
+
return useAsyncData(key, () => client.global(slug).get(clientOptions), {
|
|
39
|
+
watch
|
|
40
|
+
});
|
|
40
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dyrected/nuxt",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/module.mjs",
|
|
6
6
|
"types": "./dist/module.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"h3": "^1.15.0",
|
|
21
21
|
"react": "^18.0.0 || ^19.0.0",
|
|
22
22
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
23
|
-
"@dyrected/
|
|
24
|
-
"@dyrected/
|
|
25
|
-
"@dyrected/
|
|
26
|
-
"@dyrected/
|
|
23
|
+
"@dyrected/core": "2.5.63",
|
|
24
|
+
"@dyrected/sdk": "2.5.63",
|
|
25
|
+
"@dyrected/admin": "2.5.63",
|
|
26
|
+
"@dyrected/vue": "2.5.63"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"nuxt": "^3.0.0",
|