feat(mesh)!: refuse to export a provider
A provider's value is the object it builds, which cannot cross a JSON wire. What did cross became an app-scope binding the teacup resolved once at boot and served from a cache the teapot no longer stood behind. A step is the shape that travels; the error says so. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
7 files changed
+70
-37
No files matched your search
+4
-4
@@ -75,9 +75,9 @@ if (require.main === module) {
|
||||
|
||||
// ── Mesh Demo (teapot / teacup) ───────────────────────────────────────────
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
class ConfigProvider {
|
||||
provide() {
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class ConfigStep {
|
||||
run() {
|
||||
return { config: { env: 'demo' } };
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class PingController {
|
||||
}
|
||||
}
|
||||
|
||||
@Module({ mountpoint: '/mesh', providers: [ConfigProvider], steps: [AuthStep], controllers: [PingController] })
|
||||
@Module({ mountpoint: '/mesh', steps: [ConfigStep, AuthStep], controllers: [PingController] })
|
||||
class TeapotModule {}
|
||||
|
||||
export const teapotApp = createApp({ modules: [TeapotModule], experimental: true, mesh: { secret: 'demo-secret' } });
|
||||
|
||||
Reference in new issue
Block a user