nuxt-directus-sdk 0.0.9 → 0.0.11
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 +33 -2
- package/dist/runtime/types/generate.mjs +22 -0
- package/package.json +2 -2
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.11";
|
|
9
9
|
|
|
10
10
|
function warn(message) {
|
|
11
11
|
useLogger("nuxt-directus-sdk").warn(message);
|
|
@@ -42,6 +42,16 @@ async function generateTypes(options) {
|
|
|
42
42
|
}));
|
|
43
43
|
return `
|
|
44
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
|
+
|
|
45
55
|
declare module '#app' {
|
|
46
56
|
${types.replaceAll("export type", "type")}
|
|
47
57
|
|
|
@@ -53,6 +63,18 @@ async function generateTypes(options) {
|
|
|
53
63
|
${schemaTypes}
|
|
54
64
|
};
|
|
55
65
|
}
|
|
66
|
+
|
|
67
|
+
declare module global {
|
|
68
|
+
${types.replaceAll("export type", "type")}
|
|
69
|
+
|
|
70
|
+
interface AllDirectusCollections {
|
|
71
|
+
${allTypes}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
interface DirectusSchema {
|
|
75
|
+
${schemaTypes}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
56
78
|
export {};
|
|
57
79
|
`;
|
|
58
80
|
}
|
|
@@ -245,6 +267,15 @@ const module = defineNuxtModule({
|
|
|
245
267
|
nitroConfig.imports = nitroConfig.imports || {};
|
|
246
268
|
nitroConfig.imports.presets = nitroConfig.imports.presets || [];
|
|
247
269
|
nitroConfig.imports.presets.push(directusSdkImports);
|
|
270
|
+
nitroConfig.imports.presets.push({
|
|
271
|
+
from: resolver.resolve("./runtime/server/services"),
|
|
272
|
+
imports: [
|
|
273
|
+
"useDirectus",
|
|
274
|
+
"useAdminDirectus",
|
|
275
|
+
"useDirectusUrl",
|
|
276
|
+
"useDirectusAccessToken"
|
|
277
|
+
]
|
|
278
|
+
});
|
|
248
279
|
});
|
|
249
280
|
try {
|
|
250
281
|
const typesPath = addTypeTemplate({
|
|
@@ -256,7 +287,7 @@ const module = defineNuxtModule({
|
|
|
256
287
|
` const useDirectusUrl: typeof import('${resolver.resolve("./runtime/server/services")}').useDirectusUrl`,
|
|
257
288
|
` const useDirectusAccessToken: typeof import('${resolver.resolve("./runtime/server/services")}').useDirectusAccessToken`,
|
|
258
289
|
"}",
|
|
259
|
-
|
|
290
|
+
"export {};"
|
|
260
291
|
].join("\n")
|
|
261
292
|
}).dst;
|
|
262
293
|
nuxt.hook("prepare:types", (options2) => {
|
|
@@ -36,6 +36,16 @@ export async function generateTypes(options) {
|
|
|
36
36
|
}));
|
|
37
37
|
return `
|
|
38
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
|
+
|
|
39
49
|
declare module '#app' {
|
|
40
50
|
${types.replaceAll("export type", "type")}
|
|
41
51
|
|
|
@@ -47,6 +57,18 @@ export async function generateTypes(options) {
|
|
|
47
57
|
${schemaTypes}
|
|
48
58
|
};
|
|
49
59
|
}
|
|
60
|
+
|
|
61
|
+
declare module global {
|
|
62
|
+
${types.replaceAll("export type", "type")}
|
|
63
|
+
|
|
64
|
+
interface AllDirectusCollections {
|
|
65
|
+
${allTypes}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
interface DirectusSchema {
|
|
69
|
+
${schemaTypes}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
50
72
|
export {};
|
|
51
73
|
`;
|
|
52
74
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-directus-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"description": "A nuxt module that uses the directus SDK",
|
|
6
6
|
"author": "Matthew Rollinson <matt@rolley.io>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test:watch": "vitest watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@directus/sdk": "^12.0.
|
|
31
|
+
"@directus/sdk": "^12.0.01",
|
|
32
32
|
"@directus/shared": "^9.24.0",
|
|
33
33
|
"@nuxt/kit": "^3.7.1",
|
|
34
34
|
"change-case": "^4.1.2",
|