@gravitee/gamma-modules-sdk 1.0.0-alpha.2-feat-dev-mock-middleware.ef15ce9 → 1.0.0-alpha.2-feat-dev-mock-middleware.37cc1ee

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 (2) hide show
  1. package/README.md +21 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -27,12 +27,13 @@ In GitHub, set the **default branch** to `alpha` while you are in this phase so
27
27
 
28
28
  ## Architecture
29
29
 
30
- The SDK publishes two entry points:
30
+ The SDK publishes three entry points:
31
31
 
32
32
  | Entry point | Contents | Used by |
33
33
  | ----------------------------------- | ---------------------------- | ------------------------- |
34
34
  | `@gravitee/gamma-modules-sdk` | Types + runtime stubs | Remotes (and host barrel) |
35
35
  | `@gravitee/gamma-modules-sdk/types` | Interfaces only (no runtime) | Host implementation |
36
+ | `@gravitee/gamma-modules-sdk/dev` | OpenAPI mock middleware | Module dev servers |
36
37
 
37
38
  Remote modules compile and bundle against the stubs. At runtime, the host provides its real implementation as a Module Federation singleton (`additionalShared`), replacing the stubs transparently.
38
39
 
@@ -88,6 +89,25 @@ resolve: {
88
89
 
89
90
  ## Exports
90
91
 
92
+ ### Dev mock middleware (`/dev`)
93
+
94
+ OpenAPI-based mock middleware for standalone dev mode. Reads OpenAPI specs and serves mock responses from fixture files, so modules can run without a backend.
95
+
96
+ ```typescript
97
+ import { createOpenApiMockMiddleware } from '@gravitee/gamma-modules-sdk/dev';
98
+
99
+ // In rsbuild.config.ts setupMiddlewares:
100
+ createOpenApiMockMiddleware({
101
+ moduleId: 'aim',
102
+ specs: [join(__dirname, 'src/main/resources/openapi/openapi-catalog.yaml')],
103
+ fixturesDir: join(__dirname, 'src/main/resources/catalog-fixtures'),
104
+ });
105
+ ```
106
+
107
+ Handles GET list (pagination, `?q=` search), GET by ID, sub-resource filtering, POST, PUT, DELETE, and the `/gamma/ui/bootstrap` endpoint.
108
+
109
+ Fixture files are named after the last path segment in the spec (e.g. `models.json`, `mcp-servers.json`).
110
+
91
111
  ### Permissions domain
92
112
 
93
113
  **Types**: `PermissionScope`, `PermissionCheck`, `UserRole`, `PermissionGateProps`, `UseHasPermissionOptions`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/gamma-modules-sdk",
3
- "version": "1.0.0-alpha.2-feat-dev-mock-middleware.ef15ce9",
3
+ "version": "1.0.0-alpha.2-feat-dev-mock-middleware.37cc1ee",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "packageManager": "yarn@4.13.0",