@dyrected/nuxt 2.5.60 → 2.5.62
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
package/dist/module.mjs
CHANGED
|
@@ -78,7 +78,8 @@ const module = defineNuxtModule({
|
|
|
78
78
|
{ name: "useDyrectedAuth", from: resolver.resolve("./runtime/composables/useDyrectedAuth") },
|
|
79
79
|
{ name: "useLivePreview", from: "@dyrected/vue" },
|
|
80
80
|
{ name: "useDyPath", from: "@dyrected/vue" },
|
|
81
|
-
{ name: "provideDyPath", from: "@dyrected/vue" }
|
|
81
|
+
{ name: "provideDyPath", from: "@dyrected/vue" },
|
|
82
|
+
{ name: "getPreviewToken", from: "@dyrected/vue" }
|
|
82
83
|
]);
|
|
83
84
|
const runtimeConfig = {
|
|
84
85
|
...options,
|
|
@@ -183,9 +184,10 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
183
184
|
const base = listener.url.replace(/\/$/, "");
|
|
184
185
|
const adminSlug = options.adminPath || "cms";
|
|
185
186
|
const apiSlug = options.apiBase || "/dyrected";
|
|
187
|
+
const apiUrl = apiSlug.startsWith("http") ? apiSlug : `${base}${apiSlug}`;
|
|
186
188
|
console.log(`
|
|
187
189
|
\u279C Dyrected admin: ${base}/${adminSlug}`);
|
|
188
|
-
console.log(` \u279C Dyrected API: ${
|
|
190
|
+
console.log(` \u279C Dyrected API: ${apiUrl}
|
|
189
191
|
`);
|
|
190
192
|
});
|
|
191
193
|
if (options.db) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<DyrectedAdmin
|
|
3
|
-
:config="config"
|
|
4
|
-
:basename="basename || '/cms-admin'"
|
|
2
|
+
<DyrectedAdmin
|
|
3
|
+
:config="config"
|
|
5
4
|
:components="components"
|
|
6
5
|
/>
|
|
7
6
|
</template>
|
|
@@ -12,11 +11,6 @@ import { useRuntimeConfig } from "#imports";
|
|
|
12
11
|
import { DyrectedAdmin } from "@dyrected/vue";
|
|
13
12
|
|
|
14
13
|
defineProps<{
|
|
15
|
-
/**
|
|
16
|
-
* The base path where the admin is mounted.
|
|
17
|
-
* @default "/cms-admin"
|
|
18
|
-
*/
|
|
19
|
-
basename?: string;
|
|
20
14
|
/**
|
|
21
15
|
* Custom components to inject into the Admin UI.
|
|
22
16
|
*/
|
|
@@ -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.62",
|
|
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.62",
|
|
24
|
+
"@dyrected/sdk": "2.5.62",
|
|
25
|
+
"@dyrected/vue": "2.5.62",
|
|
26
|
+
"@dyrected/admin": "2.5.62"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"nuxt": "^3.0.0",
|