nuxt-directus-sdk 0.0.11 → 0.0.13
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 +1 -1
- package/dist/module.mjs +3 -32
- package/dist/runtime/types/generate.mjs +2 -12
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createDirectus, authentication, rest, readCollections, readFields, read
|
|
|
5
5
|
import { pascalCase } from 'change-case';
|
|
6
6
|
|
|
7
7
|
const name = "nuxt-directus-sdk";
|
|
8
|
-
const version = "0.0.
|
|
8
|
+
const version = "0.0.13";
|
|
9
9
|
|
|
10
10
|
function warn(message) {
|
|
11
11
|
useLogger("nuxt-directus-sdk").warn(message);
|
|
@@ -41,17 +41,6 @@ async function generateTypes(options) {
|
|
|
41
41
|
return item.startsWith("directus_users") || !item.startsWith("directus_");
|
|
42
42
|
}));
|
|
43
43
|
return `
|
|
44
|
-
// This file is auto-generated by nuxt-directus-sdk
|
|
45
|
-
${types}
|
|
46
|
-
|
|
47
|
-
export interface AllDirectusCollections {
|
|
48
|
-
${allTypes}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export interface DirectusSchema {
|
|
52
|
-
${schemaTypes}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
44
|
declare module '#app' {
|
|
56
45
|
${types.replaceAll("export type", "type")}
|
|
57
46
|
|
|
@@ -64,7 +53,7 @@ async function generateTypes(options) {
|
|
|
64
53
|
};
|
|
65
54
|
}
|
|
66
55
|
|
|
67
|
-
declare
|
|
56
|
+
declare global {
|
|
68
57
|
${types.replaceAll("export type", "type")}
|
|
69
58
|
|
|
70
59
|
interface AllDirectusCollections {
|
|
@@ -75,6 +64,7 @@ async function generateTypes(options) {
|
|
|
75
64
|
${schemaTypes}
|
|
76
65
|
};
|
|
77
66
|
}
|
|
67
|
+
|
|
78
68
|
export {};
|
|
79
69
|
`;
|
|
80
70
|
}
|
|
@@ -277,25 +267,6 @@ const module = defineNuxtModule({
|
|
|
277
267
|
]
|
|
278
268
|
});
|
|
279
269
|
});
|
|
280
|
-
try {
|
|
281
|
-
const typesPath = addTypeTemplate({
|
|
282
|
-
filename: `types/${configKey}-server.d.ts`,
|
|
283
|
-
getContents: () => [
|
|
284
|
-
"declare global {",
|
|
285
|
-
` const useDirectus: typeof import('${resolver.resolve("./runtime/server/services")}').useDirectus`,
|
|
286
|
-
` const useAdminDirectus: typeof import('${resolver.resolve("./runtime/server/services")}').useAdminDirectus`,
|
|
287
|
-
` const useDirectusUrl: typeof import('${resolver.resolve("./runtime/server/services")}').useDirectusUrl`,
|
|
288
|
-
` const useDirectusAccessToken: typeof import('${resolver.resolve("./runtime/server/services")}').useDirectusAccessToken`,
|
|
289
|
-
"}",
|
|
290
|
-
"export {};"
|
|
291
|
-
].join("\n")
|
|
292
|
-
}).dst;
|
|
293
|
-
nuxt.hook("prepare:types", (options2) => {
|
|
294
|
-
options2.references.push({ path: typesPath });
|
|
295
|
-
});
|
|
296
|
-
} catch (error) {
|
|
297
|
-
logger.error(error.message);
|
|
298
|
-
}
|
|
299
270
|
if (options.url) {
|
|
300
271
|
const adminUrl = joinURL(options.url, "/admin/");
|
|
301
272
|
logger.info(`Directus Admin URL: ${adminUrl}`);
|
|
@@ -35,17 +35,6 @@ export async function generateTypes(options) {
|
|
|
35
35
|
return item.startsWith("directus_users") || !item.startsWith("directus_");
|
|
36
36
|
}));
|
|
37
37
|
return `
|
|
38
|
-
// This file is auto-generated by nuxt-directus-sdk
|
|
39
|
-
${types}
|
|
40
|
-
|
|
41
|
-
export interface AllDirectusCollections {
|
|
42
|
-
${allTypes}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export interface DirectusSchema {
|
|
46
|
-
${schemaTypes}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
38
|
declare module '#app' {
|
|
50
39
|
${types.replaceAll("export type", "type")}
|
|
51
40
|
|
|
@@ -58,7 +47,7 @@ export async function generateTypes(options) {
|
|
|
58
47
|
};
|
|
59
48
|
}
|
|
60
49
|
|
|
61
|
-
declare
|
|
50
|
+
declare global {
|
|
62
51
|
${types.replaceAll("export type", "type")}
|
|
63
52
|
|
|
64
53
|
interface AllDirectusCollections {
|
|
@@ -69,6 +58,7 @@ export async function generateTypes(options) {
|
|
|
69
58
|
${schemaTypes}
|
|
70
59
|
};
|
|
71
60
|
}
|
|
61
|
+
|
|
72
62
|
export {};
|
|
73
63
|
`;
|
|
74
64
|
}
|