@gravitee/gamma-modules-sdk 1.0.0-alpha.2-feat-dev-mock-middleware.677f073 → 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.
- package/README.md +21 -1
- package/dist/dev.d.ts.map +1 -1
- 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
|
|
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/dist/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAM5D,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,uGAAuG;IACvG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,kBAAkB,IAM7D,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":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