@enfyra/sdk-nuxt 0.3.17 → 0.3.19

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.
Files changed (62) hide show
  1. package/dist/composables/useEnfyraApi.d.ts +8 -0
  2. package/dist/composables/useEnfyraApi.d.ts.map +1 -0
  3. package/dist/composables/useEnfyraApi.js +363 -0
  4. package/dist/composables/useEnfyraApi.mjs +345 -0
  5. package/dist/composables/useEnfyraAuth.d.ts +89 -0
  6. package/dist/composables/useEnfyraAuth.d.ts.map +1 -0
  7. package/dist/composables/useEnfyraAuth.js +77 -0
  8. package/dist/composables/useEnfyraAuth.mjs +81 -0
  9. package/dist/constants/auth.d.ts +0 -0
  10. package/dist/constants/auth.mjs +3 -0
  11. package/dist/constants/config.d.ts +2 -0
  12. package/dist/constants/config.d.ts.map +1 -0
  13. package/dist/constants/config.js +1 -0
  14. package/dist/constants/config.mjs +1 -0
  15. package/dist/module.cjs +82 -0
  16. package/dist/module.d.cts +10 -0
  17. package/dist/module.d.mts +10 -0
  18. package/dist/module.d.ts +10 -0
  19. package/dist/module.json +9 -0
  20. package/dist/module.mjs +79 -0
  21. package/dist/runtime/plugin/config-error.client.d.ts +0 -0
  22. package/dist/runtime/plugin/config-error.client.js +107 -0
  23. package/dist/runtime/plugin/config-error.client.mjs +107 -0
  24. package/dist/runtime/server/api/all.d.ts +0 -0
  25. package/dist/runtime/server/api/all.js +5 -0
  26. package/dist/runtime/server/api/all.mjs +5 -0
  27. package/dist/runtime/server/api/login.post.d.ts +0 -0
  28. package/dist/runtime/server/api/login.post.js +62 -0
  29. package/dist/runtime/server/api/login.post.mjs +62 -0
  30. package/dist/runtime/server/api/logout.post.d.ts +0 -0
  31. package/dist/runtime/server/api/logout.post.js +35 -0
  32. package/dist/runtime/server/api/logout.post.mjs +35 -0
  33. package/dist/runtime/server/middleware/auth.d.ts +0 -0
  34. package/dist/runtime/server/middleware/auth.js +36 -0
  35. package/dist/runtime/server/middleware/auth.mjs +36 -0
  36. package/dist/types/auth.d.ts +43 -0
  37. package/dist/types/auth.d.ts.map +1 -0
  38. package/dist/types/auth.js +1 -0
  39. package/dist/types/index.d.ts +141 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/index.js +1 -0
  42. package/dist/types.d.mts +7 -0
  43. package/dist/types.d.ts +7 -0
  44. package/dist/utils/config.d.ts +0 -0
  45. package/dist/utils/config.mjs +16 -0
  46. package/dist/utils/http.d.ts +8 -0
  47. package/dist/utils/http.d.ts.map +1 -0
  48. package/dist/utils/http.js +57 -0
  49. package/dist/utils/http.mjs +61 -0
  50. package/dist/utils/server/proxy.d.ts +0 -0
  51. package/dist/utils/server/proxy.mjs +14 -0
  52. package/dist/utils/server/refreshToken.d.ts +0 -0
  53. package/dist/utils/server/refreshToken.mjs +69 -0
  54. package/dist/utils/url.d.ts +12 -0
  55. package/dist/utils/url.d.ts.map +1 -0
  56. package/dist/utils/url.js +77 -0
  57. package/dist/utils/url.mjs +56 -0
  58. package/index.ts +1 -1
  59. package/module.d.ts +2 -2
  60. package/package.json +25 -22
  61. package/src/composables/useEnfyraAuth.ts +1 -1
  62. package/{module.ts → src/module.ts} +9 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/sdk-nuxt",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "description": "Nuxt SDK for Enfyra CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,12 +10,13 @@
10
10
  "url": "https://github.com/dothinh115/enfyra-sdk-nuxt/issues"
11
11
  },
12
12
  "homepage": "https://github.com/dothinh115/enfyra-sdk-nuxt#readme",
13
- "main": "./module.ts",
14
- "types": "./module.d.ts",
13
+ "main": "./dist/module.mjs",
14
+ "types": "./dist/types.d.ts",
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./module.d.ts",
18
- "import": "./module.ts"
17
+ "import": "./dist/module.mjs",
18
+ "require": "./dist/module.cjs",
19
+ "types": "./dist/types.d.ts"
19
20
  },
20
21
  "./src/composables/useEnfyraApi": {
21
22
  "types": "./src/composables/useEnfyraApi.ts",
@@ -25,24 +26,16 @@
25
26
  "types": "./src/composables/useEnfyraAuth.ts",
26
27
  "import": "./src/composables/useEnfyraAuth.ts"
27
28
  },
28
- "./src/types": {
29
- "types": "./src/types/index.ts",
30
- "import": "./src/types/index.ts"
31
- },
32
- "./src/runtime/server/api/all": "./src/runtime/server/api/all.ts",
33
- "./src/runtime/server/api/all.ts": "./src/runtime/server/api/all.ts",
34
- "./src/runtime/server/api/login.post": "./src/runtime/server/api/login.post.ts",
35
- "./src/runtime/server/api/login.post.ts": "./src/runtime/server/api/login.post.ts",
36
- "./src/runtime/server/api/logout.post": "./src/runtime/server/api/logout.post.ts",
37
- "./src/runtime/server/api/logout.post.ts": "./src/runtime/server/api/logout.post.ts",
38
- "./src/runtime/server/middleware/auth": "./src/runtime/server/middleware/auth.ts",
39
- "./src/runtime/server/middleware/auth.ts": "./src/runtime/server/middleware/auth.ts"
29
+ "./types": {
30
+ "types": "./dist/types/index.d.ts",
31
+ "import": "./dist/types/index.js"
32
+ }
40
33
  },
41
34
  "files": [
42
- "module.ts",
35
+ "dist/",
36
+ "src/",
43
37
  "module.d.ts",
44
- "index.ts",
45
- "src/**/*"
38
+ "index.ts"
46
39
  ],
47
40
  "keywords": [
48
41
  "nuxt",
@@ -56,7 +49,12 @@
56
49
  "access": "public"
57
50
  },
58
51
  "scripts": {
59
- "build": "npx tsc --noEmit --skipLibCheck"
52
+ "dev": "nuxi dev playground",
53
+ "build": "nuxt-module-build build && npx tsc -p tsconfig.build.json",
54
+ "prepack": "nuxt-module-build build && npx tsc -p tsconfig.build.json",
55
+ "test": "vitest",
56
+ "test:ui": "vitest --ui",
57
+ "test:run": "vitest run"
60
58
  },
61
59
  "peerDependencies": {
62
60
  "@nuxt/kit": "^3.18.1",
@@ -67,8 +65,13 @@
67
65
  "ofetch": "^1.3.3"
68
66
  },
69
67
  "devDependencies": {
68
+ "@nuxt/module-builder": "^0.8.4",
70
69
  "@types/node": "^24.10.1",
70
+ "@vitest/ui": "^3.2.4",
71
71
  "nuxt": "^3.18.1",
72
- "typescript": "^5.0.0"
72
+ "typescript": "^5.0.0",
73
+ "vite": "^6.0.7",
74
+ "vite-plugin-dts": "^4.3.0",
75
+ "vitest": "^3.2.4"
73
76
  }
74
77
  }
@@ -1,5 +1,5 @@
1
1
  import { ref, computed } from "vue";
2
- import type { LoginPayload, User } from "../types/auth";
2
+ import type { LoginPayload, User, UseEnfyraAuthReturn } from "../types/auth";
3
3
  import { useEnfyraApi } from "./useEnfyraApi";
4
4
 
5
5
  const me = ref<User | null>(null);
@@ -5,7 +5,7 @@ import {
5
5
  addImportsDir,
6
6
  addPlugin,
7
7
  } from "@nuxt/kit";
8
- import { ENFYRA_API_PREFIX } from "./src/constants/config";
8
+ import { ENFYRA_API_PREFIX } from "./constants/config";
9
9
 
10
10
  export interface ModuleOptions {
11
11
  apiUrl: string;
@@ -65,46 +65,45 @@ export default defineNuxtModule<ModuleOptions>({
65
65
 
66
66
  if (!normalizedOptions.apiUrl) {
67
67
  addPlugin({
68
- src: resolve("./src/runtime/plugin/config-error.client"),
68
+ src: resolve("./runtime/plugin/config-error.client"),
69
69
  mode: 'client'
70
70
  });
71
71
  }
72
72
 
73
- addImportsDir(resolve("./src/composables"));
73
+ addImportsDir(resolve("./composables"));
74
74
 
75
75
  nuxt.hook('prepare:types', ({ declarations, references }: any) => {
76
76
  references.push({
77
- path: resolve('./src/types/nuxt-imports.d.ts'),
77
+ path: resolve('./types/nuxt-imports.d.ts'),
78
78
  })
79
79
  })
80
80
 
81
81
  addServerHandler({
82
- handler: '@enfyra/sdk-nuxt/src/runtime/server/middleware/auth',
82
+ handler: resolve("./runtime/server/middleware/auth"),
83
83
  middleware: true,
84
84
  });
85
85
 
86
86
  addServerHandler({
87
87
  route: `${apiPrefix}/login`,
88
- handler: '@enfyra/sdk-nuxt/src/runtime/server/api/login.post',
88
+ handler: resolve("./runtime/server/api/login.post"),
89
89
  method: "post",
90
90
  });
91
91
 
92
92
  addServerHandler({
93
93
  route: `${apiPrefix}/logout`,
94
- handler: '@enfyra/sdk-nuxt/src/runtime/server/api/logout.post',
94
+ handler: resolve("./runtime/server/api/logout.post"),
95
95
  method: "post",
96
96
  });
97
97
 
98
98
 
99
99
  addServerHandler({
100
100
  route: "/assets/**",
101
- handler: '@enfyra/sdk-nuxt/src/runtime/server/api/all',
101
+ handler: resolve("./runtime/server/api/all"),
102
102
  });
103
103
 
104
104
  addServerHandler({
105
105
  route: `${apiPrefix}/**`,
106
- handler: '@enfyra/sdk-nuxt/src/runtime/server/api/all',
106
+ handler: resolve("./runtime/server/api/all"),
107
107
  });
108
108
  },
109
109
  });
110
-