@enfyra/sdk-nuxt 0.3.0 → 0.3.1
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 +23 -0
- package/dist/module.cjs +4 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -0
- package/package.json +1 -1
- package/src/module.ts +6 -0
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Nuxt SDK for Enfyra CMS - A powerful composable-based API client with full SSR s
|
|
|
6
6
|
|
|
7
7
|
✅ **SSR & Client-Side Support** - Automatic server-side rendering with `useFetch` or client-side with `$fetch`
|
|
8
8
|
✅ **Authentication Integration** - Built-in auth composables with automatic header forwarding
|
|
9
|
+
✅ **Asset Proxy** - Automatic `/assets/**` proxy to backend with no configuration needed
|
|
9
10
|
✅ **TypeScript Support** - Full type safety with auto-generated declarations
|
|
10
11
|
✅ **Batch Operations** - Efficient bulk operations with real-time progress tracking (client-side)
|
|
11
12
|
✅ **Error Handling** - Automatic error management with console logging
|
|
@@ -107,6 +108,28 @@ await logout();
|
|
|
107
108
|
</script>
|
|
108
109
|
```
|
|
109
110
|
|
|
111
|
+
### Asset URLs - Automatic Proxy
|
|
112
|
+
|
|
113
|
+
The SDK automatically proxies all asset requests to your backend. Simply use `/assets/**` paths directly:
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<template>
|
|
117
|
+
<!-- ✅ Assets are automatically proxied to your backend -->
|
|
118
|
+
<img src="/assets/images/logo.svg" alt="Logo" />
|
|
119
|
+
<img :src="`/assets/images/users/${user.id}/avatar.jpg`" alt="Avatar" />
|
|
120
|
+
|
|
121
|
+
<!-- Works with any asset type -->
|
|
122
|
+
<video src="/assets/videos/intro.mp4" controls />
|
|
123
|
+
<a :href="`/assets/documents/${doc.filename}`" download>Download PDF</a>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**How it works:**
|
|
128
|
+
- All requests to `/assets/**` are automatically proxied to `{apiUrl}/enfyra/api/assets/**`
|
|
129
|
+
- No configuration needed - works out of the box
|
|
130
|
+
- Supports all asset types: images, videos, documents, etc.
|
|
131
|
+
- Maintains proper authentication headers
|
|
132
|
+
|
|
110
133
|
## Core Composables
|
|
111
134
|
|
|
112
135
|
### `useEnfyraApi<T>(path, options)`
|
package/dist/module.cjs
CHANGED
|
@@ -54,6 +54,10 @@ enfyraSDK: {
|
|
|
54
54
|
handler: resolve("./runtime/server/api/extension_definition/[id].patch"),
|
|
55
55
|
method: "patch"
|
|
56
56
|
});
|
|
57
|
+
kit.addServerHandler({
|
|
58
|
+
route: "/assets/**",
|
|
59
|
+
handler: resolve("./runtime/server/api/all")
|
|
60
|
+
});
|
|
57
61
|
kit.addServerHandler({
|
|
58
62
|
route: `${config_mjs.ENFYRA_API_PREFIX}/**`,
|
|
59
63
|
handler: resolve("./runtime/server/api/all")
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -51,6 +51,10 @@ enfyraSDK: {
|
|
|
51
51
|
handler: resolve("./runtime/server/api/extension_definition/[id].patch"),
|
|
52
52
|
method: "patch"
|
|
53
53
|
});
|
|
54
|
+
addServerHandler({
|
|
55
|
+
route: "/assets/**",
|
|
56
|
+
handler: resolve("./runtime/server/api/all")
|
|
57
|
+
});
|
|
54
58
|
addServerHandler({
|
|
55
59
|
route: `${ENFYRA_API_PREFIX}/**`,
|
|
56
60
|
handler: resolve("./runtime/server/api/all")
|
package/package.json
CHANGED
package/src/module.ts
CHANGED
|
@@ -73,6 +73,12 @@ export default defineNuxtModule({
|
|
|
73
73
|
method: "patch",
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
// Assets proxy handler - catch all assets requests
|
|
77
|
+
addServerHandler({
|
|
78
|
+
route: "/assets/**",
|
|
79
|
+
handler: resolve("./runtime/server/api/all"),
|
|
80
|
+
});
|
|
81
|
+
|
|
76
82
|
// Catch-all handler for other routes
|
|
77
83
|
addServerHandler({
|
|
78
84
|
route: `${ENFYRA_API_PREFIX}/**`,
|