nuxt-directus-sdk 0.0.2 → 0.0.4
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/README.md +17 -17
- package/dist/module.d.mts +41 -35
- package/dist/module.d.ts +41 -35
- package/dist/module.json +2 -2
- package/dist/module.mjs +204 -121
- package/dist/runtime/composables/auth.d.ts +7 -7
- package/dist/runtime/composables/auth.mjs +2 -2
- package/dist/runtime/composables/directus.d.ts +3 -1
- package/dist/runtime/composables/directus.mjs +4 -1
- package/dist/runtime/composables/files.d.ts +21 -3
- package/dist/runtime/composables/files.mjs +29 -13
- package/dist/runtime/composables/toast.d.ts +1 -1
- package/dist/runtime/composables/toast.mjs +2 -2
- package/dist/runtime/composables/tokens.mjs +3 -3
- package/dist/runtime/plugin.mjs +5 -3
- package/dist/runtime/server/services/directus.d.ts +4 -2
- package/dist/runtime/server/services/directus.mjs +5 -9
- package/dist/runtime/types/generate.d.ts +8 -0
- package/dist/runtime/types/generate.mjs +127 -0
- package/dist/runtime/types/generate.types.d.ts +13 -0
- package/dist/runtime/types/index.d.ts +1 -38
- package/dist/runtime/types/index.mjs +1 -0
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +4 -2
- package/dist/runtime/oas/index.d.ts +0 -5
- package/dist/runtime/oas/index.mjs +0 -100
- package/dist/runtime/oas/types.d.ts +0 -27
- /package/dist/runtime/{oas/types.mjs → types/generate.types.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# directus-
|
|
1
|
+
# nuxt-directus-sdk
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
[![License][license-src]][license-href]
|
|
6
6
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
7
7
|
|
|
8
|
-
> A
|
|
8
|
+
> A Nuxt 3 Directus module that uses the official Directus 11 SDK
|
|
9
9
|
|
|
10
10
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- ⛰
|
|
15
|
-
- 🚠
|
|
14
|
+
- ⛰ Directus authentication out of the box
|
|
15
|
+
- 🚠 Automatic type generation based on Directus collections
|
|
16
16
|
|
|
17
17
|
## Quick Setup
|
|
18
18
|
|
|
19
|
-
1. Add `directus-
|
|
19
|
+
1. Add `nuxt-directus-sdk` dependency to your project
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Using pnpm
|
|
23
|
-
pnpm add -D directus-
|
|
23
|
+
pnpm add -D nuxt-directus-sdk
|
|
24
24
|
|
|
25
25
|
# Using yarn
|
|
26
|
-
yarn add --dev directus-
|
|
26
|
+
yarn add --dev nuxt-directus-sdk
|
|
27
27
|
|
|
28
28
|
# Using npm
|
|
29
|
-
npm install --save-dev directus-
|
|
29
|
+
npm install --save-dev nuxt-directus-sdk
|
|
30
30
|
|
|
31
31
|
# Using bun
|
|
32
|
-
bun install --save-dev directus-
|
|
32
|
+
bun install --save-dev nuxt-directus-sdk
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
2. Add `directus-
|
|
35
|
+
2. Add `nuxt-directus-sdk` to the `modules` section of `nuxt.config.ts`
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
export default defineNuxtConfig({
|
|
39
39
|
modules: [
|
|
40
|
-
'directus-
|
|
40
|
+
'nuxt-directus-sdk'
|
|
41
41
|
]
|
|
42
42
|
})
|
|
43
43
|
```
|
|
@@ -71,14 +71,14 @@ npm run release
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
<!-- Badges -->
|
|
74
|
-
[npm-version-src]: https://img.shields.io/npm/v/directus-
|
|
75
|
-
[npm-version-href]: https://npmjs.com/package/directus-
|
|
74
|
+
[npm-version-src]: https://img.shields.io/npm/v/nuxt-directus-sdk/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
75
|
+
[npm-version-href]: https://npmjs.com/package/nuxt-directus-sdk
|
|
76
76
|
|
|
77
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/directus-
|
|
78
|
-
[npm-downloads-href]: https://npmjs.com/package/directus-
|
|
77
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-directus-sdk.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
78
|
+
[npm-downloads-href]: https://npmjs.com/package/nuxt-directus-sdk
|
|
79
79
|
|
|
80
|
-
[license-src]: https://img.shields.io/npm/l/directus-
|
|
81
|
-
[license-href]: https://npmjs.com/package/directus-
|
|
80
|
+
[license-src]: https://img.shields.io/npm/l/nuxt-directus-sdk.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
81
|
+
[license-href]: https://npmjs.com/package/nuxt-directus-sdk
|
|
82
82
|
|
|
83
83
|
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
84
84
|
[nuxt-href]: https://nuxt.com
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { Query } from '@directus/sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { AllDirectusCollections } from '#build/types/directus';
|
|
4
4
|
|
|
5
5
|
interface ModuleOptions {
|
|
6
6
|
/**
|
|
@@ -17,60 +17,66 @@ interface ModuleOptions {
|
|
|
17
17
|
adminToken?: string;
|
|
18
18
|
/**
|
|
19
19
|
* Fetch the user serverside
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
*
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
23
|
fetchUser?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fetchUserParams?: Query<
|
|
25
|
+
* Directus Auth Options
|
|
26
|
+
* @default {}
|
|
27
|
+
* @type Query<AllDirectusCollections, AllDirectusCollections['directus_users']>
|
|
28
|
+
*/
|
|
29
|
+
fetchUserParams?: Query<AllDirectusCollections, AllDirectusCollections['directus_users']>;
|
|
30
30
|
/**
|
|
31
31
|
* Add Directus Admin in Nuxt Devtools
|
|
32
32
|
*
|
|
33
|
-
* @default
|
|
34
|
-
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
35
|
devtools?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Token Cookie Name
|
|
38
38
|
* @type string
|
|
39
|
-
* @
|
|
39
|
+
* @default 'directus_access_token'
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
cookieNameAccessToken?: string;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
* Refresh Token Cookie Name
|
|
44
|
+
* @type string
|
|
45
|
+
* @default 'directus_refresh_token'
|
|
46
|
+
*/
|
|
47
47
|
cookieNameRefreshToken?: string;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
* The max age for auth cookies in seconds.
|
|
50
|
+
* This should match your directus env key AUTH_TOKEN_TTL
|
|
51
|
+
* @type string
|
|
52
|
+
* @default 900
|
|
53
|
+
*/
|
|
54
54
|
cookieMaxAge?: number;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
* The max age for auth cookies in seconds.
|
|
57
|
+
* This should match your directus env key REFRESH_TOKEN_TTL
|
|
58
|
+
* @type string
|
|
59
|
+
* @default 604800
|
|
60
|
+
*/
|
|
61
61
|
cookieMaxAgeRefreshToken?: number;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
* The SameSite attribute for auth cookies.
|
|
64
|
+
* @type string
|
|
65
|
+
* @default 'lax'
|
|
66
|
+
*/
|
|
67
67
|
cookieSameSite?: 'strict' | 'lax' | 'none' | undefined;
|
|
68
68
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
* The Secure attribute for auth cookies.
|
|
70
|
+
* @type boolean
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
73
|
cookieSecure?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The Secure attribute for auth cookies.
|
|
76
|
+
* @type string
|
|
77
|
+
* @default ''
|
|
78
|
+
*/
|
|
79
|
+
typePrefix?: string;
|
|
74
80
|
}
|
|
75
81
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
76
82
|
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { Query } from '@directus/sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { AllDirectusCollections } from '#build/types/directus';
|
|
4
4
|
|
|
5
5
|
interface ModuleOptions {
|
|
6
6
|
/**
|
|
@@ -17,60 +17,66 @@ interface ModuleOptions {
|
|
|
17
17
|
adminToken?: string;
|
|
18
18
|
/**
|
|
19
19
|
* Fetch the user serverside
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
*
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
23
|
fetchUser?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fetchUserParams?: Query<
|
|
25
|
+
* Directus Auth Options
|
|
26
|
+
* @default {}
|
|
27
|
+
* @type Query<AllDirectusCollections, AllDirectusCollections['directus_users']>
|
|
28
|
+
*/
|
|
29
|
+
fetchUserParams?: Query<AllDirectusCollections, AllDirectusCollections['directus_users']>;
|
|
30
30
|
/**
|
|
31
31
|
* Add Directus Admin in Nuxt Devtools
|
|
32
32
|
*
|
|
33
|
-
* @default
|
|
34
|
-
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
35
|
devtools?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Token Cookie Name
|
|
38
38
|
* @type string
|
|
39
|
-
* @
|
|
39
|
+
* @default 'directus_access_token'
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
cookieNameAccessToken?: string;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
* Refresh Token Cookie Name
|
|
44
|
+
* @type string
|
|
45
|
+
* @default 'directus_refresh_token'
|
|
46
|
+
*/
|
|
47
47
|
cookieNameRefreshToken?: string;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
* The max age for auth cookies in seconds.
|
|
50
|
+
* This should match your directus env key AUTH_TOKEN_TTL
|
|
51
|
+
* @type string
|
|
52
|
+
* @default 900
|
|
53
|
+
*/
|
|
54
54
|
cookieMaxAge?: number;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
* The max age for auth cookies in seconds.
|
|
57
|
+
* This should match your directus env key REFRESH_TOKEN_TTL
|
|
58
|
+
* @type string
|
|
59
|
+
* @default 604800
|
|
60
|
+
*/
|
|
61
61
|
cookieMaxAgeRefreshToken?: number;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
* The SameSite attribute for auth cookies.
|
|
64
|
+
* @type string
|
|
65
|
+
* @default 'lax'
|
|
66
|
+
*/
|
|
67
67
|
cookieSameSite?: 'strict' | 'lax' | 'none' | undefined;
|
|
68
68
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
* The Secure attribute for auth cookies.
|
|
70
|
+
* @type boolean
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
73
|
cookieSecure?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The Secure attribute for auth cookies.
|
|
76
|
+
* @type string
|
|
77
|
+
* @default ''
|
|
78
|
+
*/
|
|
79
|
+
typePrefix?: string;
|
|
74
80
|
}
|
|
75
81
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
76
82
|
|