Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: namespaced extensions #7013

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/hungry-squids-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@vue-storefront/middleware": minor
---

It is now possible to add namespaced extensions to integrations. Namespaced extensions are registered under `/{integration-name}/{extension-name}` extension of integration's namespace in opposition to non-namespaced extensions which are registered under `/{integration-name}` integration's namespace. Default value is `false`. Extensions without a namespace can potentially override existing endpoints, so it's recommended to use namespaced extensions whenever possible.

Read more about extensions in our [docs](https://docs.vuestorefront.io/middleware/guides/extensions).




2 changes: 2 additions & 0 deletions docs/content/3.middleware/2.guides/3.extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const integrations = {
...extensions, // don't forget to add existing extensions
{
name: 'extension-name',
isNamespaced: `[true/false:default]`
lsliwaradioluz marked this conversation as resolved.
Show resolved Hide resolved
extendApiMethods: { /* ... */ },
extendApp: (app) => { /* ... */ },
hooks: () => { /* ... */ }
Expand Down Expand Up @@ -49,6 +50,7 @@ const extension = {
```

- `name` - a unique name for your extension,
- `isNamespaced` - defines if the extension should be namespaced. Namespaced extensions are registered under `/{integration-name}/{extension-name}` extension of integration's namespace in opposition to non-namespaced extensions which are registered under `/{integration-name}` integration's namespace. Default value is `false`. Extensions without a namespace can potentially override existing endpoints, so it's recommended to use namespaced extensions whenever possible.
bartoszherba marked this conversation as resolved.
Show resolved Hide resolved
- `extendApiMethods` - overrides an integration's API Client to modify default behavior or add new API endpoints
- `extendApp` - gives you access to the Express.js app
- `hooks` - defines lifecycle hooks of API-client
Expand Down
5 changes: 3 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"@microsoft/api-documenter": "^7.13.30",
"@microsoft/api-extractor": "^7.18.1",
"@types/node": "^18",
"nuxt": "^3.6.2"
"nuxt": "^3.6.2",
"nuxt-gtag": "^1.1.2"
},
"dependencies": {
"@stackblitz/sdk": "^1.9.0",
Expand All @@ -27,4 +28,4 @@
"resolutions": {
"@nuxt/content": "^2.8.0"
}
}
}
Loading
Loading