@fougere/core 0.2.0-alpha.2 → 0.3.0-alpha.0
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 +2 -1
- package/dist/boot/AppLifecycle.d.ts +18 -0
- package/dist/boot/AppLifecycle.d.ts.map +1 -0
- package/dist/boot/AppLifecycle.js +42 -0
- package/dist/boot/AppLifecycle.js.map +1 -0
- package/dist/boot/Emissions.d.ts +126 -0
- package/dist/boot/Emissions.d.ts.map +1 -0
- package/dist/boot/Emissions.js +233 -0
- package/dist/boot/Emissions.js.map +1 -0
- package/dist/boot/HandlerFacade.d.ts +72 -0
- package/dist/boot/HandlerFacade.d.ts.map +1 -0
- package/dist/boot/HandlerFacade.js +174 -0
- package/dist/boot/HandlerFacade.js.map +1 -0
- package/dist/boot/Lifecycle.d.ts +4 -0
- package/dist/boot/Lifecycle.d.ts.map +1 -0
- package/dist/boot/Lifecycle.js +3 -0
- package/dist/boot/Lifecycle.js.map +1 -0
- package/dist/boot/ambient-port.d.ts +38 -0
- package/dist/boot/ambient-port.d.ts.map +1 -0
- package/dist/boot/ambient-port.js +2 -0
- package/dist/boot/ambient-port.js.map +1 -0
- package/dist/boot/ambient.als.d.ts +3 -0
- package/dist/boot/ambient.als.d.ts.map +1 -0
- package/dist/boot/ambient.als.js +34 -0
- package/dist/boot/ambient.als.js.map +1 -0
- package/dist/boot/ambient.queue.d.ts +10 -0
- package/dist/boot/ambient.queue.d.ts.map +1 -0
- package/dist/boot/ambient.queue.js +60 -0
- package/dist/boot/ambient.queue.js.map +1 -0
- package/dist/boot/apply.d.ts +22 -0
- package/dist/boot/apply.d.ts.map +1 -0
- package/dist/boot/apply.js +48 -0
- package/dist/boot/apply.js.map +1 -0
- package/dist/boot/auth.d.ts +53 -0
- package/dist/boot/auth.d.ts.map +1 -0
- package/dist/boot/auth.js +2 -0
- package/dist/boot/auth.js.map +1 -0
- package/dist/{binding.d.ts → boot/binding.d.ts} +14 -17
- package/dist/boot/binding.d.ts.map +1 -0
- package/dist/{binding.js → boot/binding.js} +19 -10
- package/dist/boot/binding.js.map +1 -0
- package/dist/{boot.d.ts → boot/boot.d.ts} +25 -5
- package/dist/boot/boot.d.ts.map +1 -0
- package/dist/boot/boot.js +70 -0
- package/dist/boot/boot.js.map +1 -0
- package/dist/boot/bootstrap.d.ts.map +1 -0
- package/dist/boot/bootstrap.js +721 -0
- package/dist/boot/bootstrap.js.map +1 -0
- package/dist/boot/egress.d.ts +8 -0
- package/dist/boot/egress.d.ts.map +1 -0
- package/dist/boot/egress.js +11 -0
- package/dist/boot/egress.js.map +1 -0
- package/dist/boot/frame.d.ts +44 -0
- package/dist/boot/frame.d.ts.map +1 -0
- package/dist/boot/frame.js +181 -0
- package/dist/boot/frame.js.map +1 -0
- package/dist/boot/ownership.d.ts +42 -0
- package/dist/boot/ownership.d.ts.map +1 -0
- package/dist/boot/ownership.js +127 -0
- package/dist/boot/ownership.js.map +1 -0
- package/dist/boot/ports.d.ts +17 -0
- package/dist/boot/ports.d.ts.map +1 -0
- package/dist/boot/ports.js +57 -0
- package/dist/boot/ports.js.map +1 -0
- package/dist/{remote.d.ts → boot/remote.d.ts} +11 -3
- package/dist/boot/remote.d.ts.map +1 -0
- package/dist/{remote.js → boot/remote.js} +24 -26
- package/dist/boot/remote.js.map +1 -0
- package/dist/{seed.d.ts → boot/seed.d.ts} +13 -1
- package/dist/boot/seed.d.ts.map +1 -0
- package/dist/{seed.js → boot/seed.js} +24 -3
- package/dist/boot/seed.js.map +1 -0
- package/dist/boot/together.d.ts +26 -0
- package/dist/boot/together.d.ts.map +1 -0
- package/dist/boot/together.js +163 -0
- package/dist/boot/together.js.map +1 -0
- package/dist/boot/types.d.ts +260 -0
- package/dist/boot/types.d.ts.map +1 -0
- package/dist/boot/types.js.map +1 -0
- package/dist/builtins/config.d.ts +9 -0
- package/dist/builtins/config.d.ts.map +1 -1
- package/dist/builtins/config.js +16 -1
- package/dist/builtins/config.js.map +1 -1
- package/dist/builtins/logger.d.ts +37 -4
- package/dist/builtins/logger.d.ts.map +1 -1
- package/dist/builtins/logger.js +66 -7
- package/dist/builtins/logger.js.map +1 -1
- package/dist/config-loader.d.ts +39 -35
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +15 -54
- package/dist/config-loader.js.map +1 -1
- package/dist/contract/Call.d.ts +10 -0
- package/dist/contract/Call.d.ts.map +1 -0
- package/dist/contract/Call.js +15 -0
- package/dist/contract/Call.js.map +1 -0
- package/dist/contract/Invocation.d.ts +27 -0
- package/dist/contract/Invocation.d.ts.map +1 -0
- package/dist/contract/Invocation.js +59 -0
- package/dist/contract/Invocation.js.map +1 -0
- package/dist/contract/RouteAddress.d.ts +17 -0
- package/dist/contract/RouteAddress.d.ts.map +1 -0
- package/dist/contract/RouteAddress.js +38 -0
- package/dist/contract/RouteAddress.js.map +1 -0
- package/dist/contract.d.ts +25 -19
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +25 -10
- package/dist/contract.js.map +1 -1
- package/dist/crypto/encoding.d.ts +25 -0
- package/dist/crypto/encoding.d.ts.map +1 -0
- package/dist/crypto/encoding.js +58 -0
- package/dist/crypto/encoding.js.map +1 -0
- package/dist/crypto/node.d.ts +4 -0
- package/dist/crypto/node.d.ts.map +1 -0
- package/dist/crypto/node.js +25 -0
- package/dist/crypto/node.js.map +1 -0
- package/dist/crypto/port.d.ts +42 -0
- package/dist/crypto/port.d.ts.map +1 -0
- package/dist/crypto/port.js +19 -0
- package/dist/crypto/port.js.map +1 -0
- package/dist/crypto/webcrypto.d.ts +4 -0
- package/dist/crypto/webcrypto.d.ts.map +1 -0
- package/dist/crypto/webcrypto.js +34 -0
- package/dist/crypto/webcrypto.js.map +1 -0
- package/dist/dispatch/ArgumentResolver.d.ts +10 -0
- package/dist/dispatch/ArgumentResolver.d.ts.map +1 -0
- package/dist/dispatch/ArgumentResolver.js +12 -0
- package/dist/dispatch/ArgumentResolver.js.map +1 -0
- package/dist/dispatch/ArrayResult.d.ts +3 -0
- package/dist/dispatch/ArrayResult.d.ts.map +1 -0
- package/dist/dispatch/ArrayResult.js +11 -0
- package/dist/dispatch/ArrayResult.js.map +1 -0
- package/dist/dispatch/DispatchEvent.d.ts +18 -0
- package/dist/dispatch/DispatchEvent.d.ts.map +1 -0
- package/dist/dispatch/DispatchEvent.js +30 -0
- package/dist/dispatch/DispatchEvent.js.map +1 -0
- package/dist/dispatch/DispatchLifecycle.d.ts +9 -0
- package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -0
- package/dist/dispatch/DispatchLifecycle.js +25 -0
- package/dist/dispatch/DispatchLifecycle.js.map +1 -0
- package/dist/dispatch/DispatchPort.d.ts +6 -0
- package/dist/dispatch/DispatchPort.d.ts.map +1 -0
- package/dist/dispatch/DispatchPort.js +2 -0
- package/dist/dispatch/DispatchPort.js.map +1 -0
- package/dist/dispatch/Dispatcher.d.ts +16 -0
- package/dist/dispatch/Dispatcher.d.ts.map +1 -0
- package/dist/dispatch/Dispatcher.js +44 -0
- package/dist/dispatch/Dispatcher.js.map +1 -0
- package/dist/dispatch/InFlight.d.ts +12 -0
- package/dist/dispatch/InFlight.d.ts.map +1 -0
- package/dist/dispatch/InFlight.js +46 -0
- package/dist/dispatch/InFlight.js.map +1 -0
- package/dist/dispatch/InputValidator.d.ts +7 -0
- package/dist/dispatch/InputValidator.d.ts.map +1 -0
- package/dist/dispatch/InputValidator.js +21 -0
- package/dist/dispatch/InputValidator.js.map +1 -0
- package/dist/dispatch/LocalRoutePolicy.d.ts +11 -0
- package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -0
- package/dist/dispatch/LocalRoutePolicy.js +32 -0
- package/dist/dispatch/LocalRoutePolicy.js.map +1 -0
- package/dist/dispatch/OperationExecutor.d.ts +25 -0
- package/dist/dispatch/OperationExecutor.d.ts.map +1 -0
- package/dist/dispatch/OperationExecutor.js +32 -0
- package/dist/dispatch/OperationExecutor.js.map +1 -0
- package/dist/dispatch/OperationRoute.d.ts +13 -0
- package/dist/dispatch/OperationRoute.d.ts.map +1 -0
- package/dist/dispatch/OperationRoute.js +15 -0
- package/dist/dispatch/OperationRoute.js.map +1 -0
- package/dist/dispatch/OutputProjector.d.ts +12 -0
- package/dist/dispatch/OutputProjector.d.ts.map +1 -0
- package/dist/dispatch/OutputProjector.js +30 -0
- package/dist/dispatch/OutputProjector.js.map +1 -0
- package/dist/dispatch/OutputView.d.ts +8 -0
- package/dist/dispatch/OutputView.d.ts.map +1 -0
- package/dist/dispatch/OutputView.js +10 -0
- package/dist/dispatch/OutputView.js.map +1 -0
- package/dist/dispatch/PresenterArgumentResolver.d.ts +12 -0
- package/dist/dispatch/PresenterArgumentResolver.d.ts.map +1 -0
- package/dist/dispatch/PresenterArgumentResolver.js +20 -0
- package/dist/dispatch/PresenterArgumentResolver.js.map +1 -0
- package/dist/dispatch/PresenterExecutor.d.ts +11 -0
- package/dist/dispatch/PresenterExecutor.d.ts.map +1 -0
- package/dist/dispatch/PresenterExecutor.js +56 -0
- package/dist/dispatch/PresenterExecutor.js.map +1 -0
- package/dist/dispatch/RemoteRouteResolver.d.ts +13 -0
- package/dist/dispatch/RemoteRouteResolver.d.ts.map +1 -0
- package/dist/dispatch/RemoteRouteResolver.js +18 -0
- package/dist/dispatch/RemoteRouteResolver.js.map +1 -0
- package/dist/dispatch/Route.d.ts +10 -0
- package/dist/dispatch/Route.d.ts.map +1 -0
- package/dist/dispatch/Route.js +2 -0
- package/dist/dispatch/Route.js.map +1 -0
- package/dist/dispatch/RouteNotFoundError.d.ts +10 -0
- package/dist/dispatch/RouteNotFoundError.d.ts.map +1 -0
- package/dist/dispatch/RouteNotFoundError.js +24 -0
- package/dist/dispatch/RouteNotFoundError.js.map +1 -0
- package/dist/dispatch/RoutePolicy.d.ts +8 -0
- package/dist/dispatch/RoutePolicy.d.ts.map +1 -0
- package/dist/dispatch/RoutePolicy.js +2 -0
- package/dist/dispatch/RoutePolicy.js.map +1 -0
- package/dist/dispatch/RouteRegistry.d.ts +18 -0
- package/dist/dispatch/RouteRegistry.d.ts.map +1 -0
- package/dist/dispatch/RouteRegistry.js +62 -0
- package/dist/dispatch/RouteRegistry.js.map +1 -0
- package/dist/dispatch/RouteResolver.d.ts +7 -0
- package/dist/dispatch/RouteResolver.d.ts.map +1 -0
- package/dist/dispatch/RouteResolver.js +2 -0
- package/dist/dispatch/RouteResolver.js.map +1 -0
- package/dist/dispatch/StorageGuard.d.ts +15 -0
- package/dist/dispatch/StorageGuard.d.ts.map +1 -0
- package/dist/dispatch/StorageGuard.js +63 -0
- package/dist/dispatch/StorageGuard.js.map +1 -0
- package/dist/effective-operation.d.ts +90 -0
- package/dist/effective-operation.d.ts.map +1 -0
- package/dist/effective-operation.js +450 -0
- package/dist/effective-operation.js.map +1 -0
- package/dist/emit.js +2 -2
- package/dist/emit.js.map +1 -1
- package/dist/entry/DynamicFacade.d.ts +10 -0
- package/dist/entry/DynamicFacade.d.ts.map +1 -0
- package/dist/entry/DynamicFacade.js +27 -0
- package/dist/entry/DynamicFacade.js.map +1 -0
- package/dist/entry/FacadeEntry.d.ts +11 -0
- package/dist/entry/FacadeEntry.d.ts.map +1 -0
- package/dist/entry/FacadeEntry.js +26 -0
- package/dist/entry/FacadeEntry.js.map +1 -0
- package/dist/entry/TransportEntry.d.ts +13 -0
- package/dist/entry/TransportEntry.d.ts.map +1 -0
- package/dist/entry/TransportEntry.js +24 -0
- package/dist/entry/TransportEntry.js.map +1 -0
- package/dist/frond-config.d.ts +24 -7
- package/dist/frond-config.d.ts.map +1 -1
- package/dist/frond-config.js.map +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +3 -2
- package/dist/graph.js.map +1 -1
- package/dist/identity-keys.d.ts +14 -0
- package/dist/identity-keys.d.ts.map +1 -0
- package/dist/identity-keys.js +37 -0
- package/dist/identity-keys.js.map +1 -0
- package/dist/identity.d.ts +58 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +182 -0
- package/dist/identity.js.map +1 -0
- package/dist/imports.d.ts +1 -1
- package/dist/imports.d.ts.map +1 -1
- package/dist/imports.js +7 -3
- package/dist/imports.js.map +1 -1
- package/dist/index.d.ts +57 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -32
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +16 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +25 -0
- package/dist/loader.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +24 -0
- package/dist/node.js.map +1 -0
- package/dist/orm.d.ts +69 -8
- package/dist/orm.d.ts.map +1 -1
- package/dist/orm.js +35 -2
- package/dist/orm.js.map +1 -1
- package/dist/prefab/collector.d.ts +29 -0
- package/dist/prefab/collector.d.ts.map +1 -0
- package/dist/prefab/collector.js +34 -0
- package/dist/prefab/collector.js.map +1 -0
- package/dist/{crud.d.ts → prefab/crud.d.ts} +7 -8
- package/dist/prefab/crud.d.ts.map +1 -0
- package/dist/{crud.js → prefab/crud.js} +39 -5
- package/dist/prefab/crud.js.map +1 -0
- package/dist/prefab/mirror.d.ts +52 -0
- package/dist/prefab/mirror.d.ts.map +1 -0
- package/dist/prefab/mirror.js +66 -0
- package/dist/prefab/mirror.js.map +1 -0
- package/dist/prefab/prefab.d.ts +15 -0
- package/dist/prefab/prefab.d.ts.map +1 -0
- package/dist/prefab/prefab.js +19 -0
- package/dist/prefab/prefab.js.map +1 -0
- package/dist/{presenter.d.ts → prefab/presenter.d.ts} +6 -17
- package/dist/prefab/presenter.d.ts.map +1 -0
- package/dist/{presenter.js → prefab/presenter.js} +5 -23
- package/dist/prefab/presenter.js.map +1 -0
- package/dist/prefab/repository.d.ts +104 -0
- package/dist/prefab/repository.d.ts.map +1 -0
- package/dist/prefab/repository.js +62 -0
- package/dist/prefab/repository.js.map +1 -0
- package/dist/scan/Fronds.d.ts +45 -0
- package/dist/scan/Fronds.d.ts.map +1 -0
- package/dist/scan/Fronds.js +66 -0
- package/dist/scan/Fronds.js.map +1 -0
- package/dist/scan/conventions.d.ts +74 -0
- package/dist/scan/conventions.d.ts.map +1 -0
- package/dist/scan/conventions.js +82 -0
- package/dist/scan/conventions.js.map +1 -0
- package/dist/scan/emit.d.ts +14 -0
- package/dist/scan/emit.d.ts.map +1 -0
- package/dist/scan/emit.js +211 -0
- package/dist/scan/emit.js.map +1 -0
- package/dist/scan/frond.d.ts +224 -0
- package/dist/scan/frond.d.ts.map +1 -0
- package/dist/scan/frond.js +2 -0
- package/dist/scan/frond.js.map +1 -0
- package/dist/{handler-parser.d.ts → scan/handler-parser.d.ts} +18 -9
- package/dist/scan/handler-parser.d.ts.map +1 -0
- package/dist/scan/handler-parser.js +625 -0
- package/dist/scan/handler-parser.js.map +1 -0
- package/dist/scan/scan-cache.d.ts +16 -0
- package/dist/scan/scan-cache.d.ts.map +1 -0
- package/dist/{scan-cache.js → scan/scan-cache.js} +27 -20
- package/dist/scan/scan-cache.js.map +1 -0
- package/dist/scan/scanner.d.ts +20 -0
- package/dist/scan/scanner.d.ts.map +1 -0
- package/dist/{scanner.js → scan/scanner.js} +185 -167
- package/dist/scan/scanner.js.map +1 -0
- package/dist/verify.d.ts +16 -3
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +21 -18
- package/dist/verify.js.map +1 -1
- package/dist/{call.d.ts → wire/call.d.ts} +70 -1
- package/dist/wire/call.d.ts.map +1 -0
- package/dist/{call.js → wire/call.js} +48 -75
- package/dist/wire/call.js.map +1 -0
- package/dist/{middleware.d.ts → wire/errors.d.ts} +18 -19
- package/dist/wire/errors.d.ts.map +1 -0
- package/dist/{middleware.js → wire/errors.js} +26 -14
- package/dist/wire/errors.js.map +1 -0
- package/dist/{errors.d.ts → wire/http-error.d.ts} +5 -6
- package/dist/wire/http-error.d.ts.map +1 -0
- package/dist/{errors.js → wire/http-error.js} +7 -6
- package/dist/wire/http-error.js.map +1 -0
- package/dist/wire/invocation.d.ts +4 -0
- package/dist/wire/invocation.d.ts.map +1 -0
- package/dist/wire/invocation.js +3 -0
- package/dist/wire/invocation.js.map +1 -0
- package/dist/{middleware/logger.d.ts → wire/loggerMiddleware.d.ts} +3 -3
- package/dist/wire/loggerMiddleware.d.ts.map +1 -0
- package/dist/{middleware/logger.js → wire/loggerMiddleware.js} +2 -2
- package/dist/wire/loggerMiddleware.js.map +1 -0
- package/dist/wire/middleware.d.ts +29 -0
- package/dist/wire/middleware.d.ts.map +1 -0
- package/dist/wire/middleware.js +20 -0
- package/dist/wire/middleware.js.map +1 -0
- package/dist/{operation.d.ts → wire/operation.d.ts} +39 -10
- package/dist/wire/operation.d.ts.map +1 -0
- package/dist/wire/operation.js +167 -0
- package/dist/wire/operation.js.map +1 -0
- package/package.json +24 -7
- package/dist/binding.d.ts.map +0 -1
- package/dist/binding.js.map +0 -1
- package/dist/boot.d.ts.map +0 -1
- package/dist/boot.js +0 -53
- package/dist/boot.js.map +0 -1
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -879
- package/dist/bootstrap.js.map +0 -1
- package/dist/call.d.ts.map +0 -1
- package/dist/call.js.map +0 -1
- package/dist/collector.d.ts +0 -28
- package/dist/collector.d.ts.map +0 -1
- package/dist/collector.js +0 -32
- package/dist/collector.js.map +0 -1
- package/dist/crud.d.ts.map +0 -1
- package/dist/crud.js.map +0 -1
- package/dist/egress.d.ts +0 -52
- package/dist/egress.d.ts.map +0 -1
- package/dist/egress.js +0 -186
- package/dist/egress.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/handler-parser.d.ts.map +0 -1
- package/dist/handler-parser.js +0 -505
- package/dist/handler-parser.js.map +0 -1
- package/dist/invocation.d.ts +0 -20
- package/dist/invocation.d.ts.map +0 -1
- package/dist/invocation.js +0 -15
- package/dist/invocation.js.map +0 -1
- package/dist/middleware/error-handler.d.ts +0 -15
- package/dist/middleware/error-handler.d.ts.map +0 -1
- package/dist/middleware/error-handler.js +0 -29
- package/dist/middleware/error-handler.js.map +0 -1
- package/dist/middleware/logger.d.ts.map +0 -1
- package/dist/middleware/logger.js.map +0 -1
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js.map +0 -1
- package/dist/mirror.d.ts +0 -93
- package/dist/mirror.d.ts.map +0 -1
- package/dist/mirror.js +0 -96
- package/dist/mirror.js.map +0 -1
- package/dist/operation.d.ts.map +0 -1
- package/dist/operation.js +0 -95
- package/dist/operation.js.map +0 -1
- package/dist/presenter.d.ts.map +0 -1
- package/dist/presenter.js.map +0 -1
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js.map +0 -1
- package/dist/repository.d.ts +0 -55
- package/dist/repository.d.ts.map +0 -1
- package/dist/repository.js +0 -26
- package/dist/repository.js.map +0 -1
- package/dist/scan-cache.d.ts +0 -10
- package/dist/scan-cache.d.ts.map +0 -1
- package/dist/scan-cache.js.map +0 -1
- package/dist/scanner.d.ts +0 -34
- package/dist/scanner.d.ts.map +0 -1
- package/dist/scanner.js.map +0 -1
- package/dist/seed.d.ts.map +0 -1
- package/dist/seed.js.map +0 -1
- package/dist/types.d.ts +0 -421
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{bootstrap.d.ts → boot/bootstrap.d.ts} +0 -0
- /package/dist/{types.js → boot/types.js} +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@ strictly locally; `createAppRunner` follows the topology (local façades, remote
|
|
|
5
5
|
stand-ins). Transports move the value — they never reshape it.
|
|
6
6
|
|
|
7
7
|
The façade judges the input, projects the output, and exposes only what a contract
|
|
8
|
-
declares.
|
|
8
|
+
declares. It also canonicalizes optional input before binding: omission is `undefined`,
|
|
9
|
+
JSON may omit its property, and an explicit `null` is never rewritten.
|
|
9
10
|
|
|
10
11
|
Node-free surface, for the browser: the `@fougere/core/contract` subpath.
|
|
11
12
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { App } from './types.js';
|
|
2
|
+
/** One process-level extension and its reversible lifecycle. */
|
|
3
|
+
export interface Extension {
|
|
4
|
+
name: string;
|
|
5
|
+
up?(app: App): void | Promise<void>;
|
|
6
|
+
down?(app: App): void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/** Runs application extensions up in order and down in reverse order. */
|
|
9
|
+
export declare class AppLifecycle {
|
|
10
|
+
private readonly members;
|
|
11
|
+
add(...extensions: readonly (Extension | undefined)[]): this;
|
|
12
|
+
names(): string[];
|
|
13
|
+
up(app: App): Promise<void>;
|
|
14
|
+
down(app: App): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/** The replaceable migration slot of the application lifecycle. */
|
|
17
|
+
export declare function migrating(migrate?: Extension['up']): Extension;
|
|
18
|
+
//# sourceMappingURL=AppLifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLifecycle.d.ts","sourceRoot":"","sources":["../../src/boot/AppLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,yEAAyE;AACzE,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAE3C,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI;IAU5D,KAAK,IAAI,MAAM,EAAE;IAIX,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3B,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAapC;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAE9D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Runs application extensions up in order and down in reverse order. */
|
|
2
|
+
export class AppLifecycle {
|
|
3
|
+
members = [];
|
|
4
|
+
add(...extensions) {
|
|
5
|
+
for (const extension of extensions) {
|
|
6
|
+
if (!extension)
|
|
7
|
+
continue;
|
|
8
|
+
const at = this.members.findIndex((held) => held.name === extension.name);
|
|
9
|
+
if (at === -1)
|
|
10
|
+
this.members.push(extension);
|
|
11
|
+
else
|
|
12
|
+
this.members[at] = extension;
|
|
13
|
+
}
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
names() {
|
|
17
|
+
return this.members.map((extension) => extension.name);
|
|
18
|
+
}
|
|
19
|
+
async up(app) {
|
|
20
|
+
for (const extension of this.members)
|
|
21
|
+
await extension.up?.(app);
|
|
22
|
+
}
|
|
23
|
+
async down(app) {
|
|
24
|
+
const refused = [];
|
|
25
|
+
for (const extension of [...this.members].reverse()) {
|
|
26
|
+
try {
|
|
27
|
+
await extension.down?.(app);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
refused.push(error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (refused.length > 0) {
|
|
34
|
+
throw new AggregateError(refused, `${refused.length} extension(s) refused to release`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** The replaceable migration slot of the application lifecycle. */
|
|
39
|
+
export function migrating(migrate) {
|
|
40
|
+
return migrate ? { name: 'migrate', up: migrate } : { name: 'migrate' };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=AppLifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLifecycle.js","sourceRoot":"","sources":["../../src/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CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,kCAAkC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { type SchemaView } from '@fougere/schema';
|
|
2
|
+
import type { Container } from '@fougere/container';
|
|
3
|
+
import type { Logger } from '../builtins/logger.js';
|
|
4
|
+
import type { Fronds } from '../scan/Fronds.js';
|
|
5
|
+
import type { OperationsMap } from '../wire/operation.js';
|
|
6
|
+
/** Carries an announced fact out of this process — see `CreateAppOptions.onEmit`. */
|
|
7
|
+
type Carrier = (fact: string, payload: unknown) => void | Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Emissions — the only place in Fougere where an initiator names a SUBJECT.
|
|
10
|
+
*
|
|
11
|
+
* It was eight closures over four collections in the middle of the boot, which is a
|
|
12
|
+
* class that had not been named: the announced set, the subscriber index, the chain
|
|
13
|
+
* carried in async context, and the shapes a fact is judged against.
|
|
14
|
+
*
|
|
15
|
+
* **It is a resolver, not a channel.** It answers *who*, then hands over to the door
|
|
16
|
+
* that already exists — so a subscriber keeps its judge, its binding and its
|
|
17
|
+
* middlewares, and nothing here is durable.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Emissions {
|
|
20
|
+
private readonly shapes;
|
|
21
|
+
private readonly container;
|
|
22
|
+
private readonly log;
|
|
23
|
+
private readonly carry?;
|
|
24
|
+
/** Who listens to what. Filled as each door's contracts are resolved. */
|
|
25
|
+
private readonly subscribers;
|
|
26
|
+
/**
|
|
27
|
+
* What is announced here, read from the DEPS and not from the subscribers: a handler
|
|
28
|
+
* declaring `Emit<PostPublished>` must resolve it whether or not anybody listens, and
|
|
29
|
+
* announcing to nobody is legal.
|
|
30
|
+
*/
|
|
31
|
+
private readonly announced;
|
|
32
|
+
constructor(fronds: Fronds, shapes: Map<string, SchemaView>, container: Container, log: Logger, carry?: Carrier | undefined);
|
|
33
|
+
/**
|
|
34
|
+
* Who listens to what — read from the PLAN, where `{ kind: 'fact' }` is a sentence
|
|
35
|
+
* `computeBindingPlan` already wrote, so nothing re-derives what a parameter is.
|
|
36
|
+
*
|
|
37
|
+
* It is called for a frond hosted here AND for one declared remote. A remote frond is
|
|
38
|
+
* still scanned — only its hosting is elsewhere — so its subscriptions are known, and
|
|
39
|
+
* its door resolves to a doublure. That is the whole reason an emission crosses a
|
|
40
|
+
* process without a line of transport code: the emitter learned the signature locally
|
|
41
|
+
* and calls the same key. Noting only the hosted ones left the index EMPTY under a
|
|
42
|
+
* split, and a fact announced to a remote listener reached nobody, in silence.
|
|
43
|
+
*/
|
|
44
|
+
note(contracts: OperationsMap, door: string): void;
|
|
45
|
+
/** The shape a fact is judged by, when the fact is a declared entity. */
|
|
46
|
+
shapeOf(fact: string): SchemaView | undefined;
|
|
47
|
+
/** The facts this process has a listener for — what a carrier subscribes to on its behalf. */
|
|
48
|
+
listensTo(): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Register one emission value per fact — announced here, or merely listened to.
|
|
51
|
+
*
|
|
52
|
+
* A process that only subscribes still needs the value, because `deliver` is what a
|
|
53
|
+
* carrier calls and it goes through the same door. Called once every door has been
|
|
54
|
+
* built, so the two sets are complete.
|
|
55
|
+
*/
|
|
56
|
+
register(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Announcing. Dispatch, never delivery — the emitter is handed back the moment every
|
|
59
|
+
* subscriber has been HANDED the fact, not when any of them is done.
|
|
60
|
+
*
|
|
61
|
+
* The `EventBus` this replaces did `await Promise.all(handlers)` and passed their
|
|
62
|
+
* rejections up, which made a publication hostage to its own indexer.
|
|
63
|
+
*/
|
|
64
|
+
private announce;
|
|
65
|
+
/**
|
|
66
|
+
* Receiving. **The opposite rule, deliberately**: this one waits, and it tells.
|
|
67
|
+
*
|
|
68
|
+
* `deliver` is what a CARRIER calls, and a carrier's whole job is to know whether the
|
|
69
|
+
* fact landed — at-least-once is retrying what failed, so a delivery that cannot report
|
|
70
|
+
* makes durability impossible to build on top. It used to be the announcement itself:
|
|
71
|
+
* it resolved before any subscriber had run and swallowed every failure into a log, so a
|
|
72
|
+
* queue calling it could only ever ack blindly.
|
|
73
|
+
*
|
|
74
|
+
* That is not a contradiction of "dispatch is not delivery". That rule protects the
|
|
75
|
+
* EMITTER, which must not become hostage to a subscriber; a carrier is not the emitter,
|
|
76
|
+
* it is precisely the party whose business this is.
|
|
77
|
+
*
|
|
78
|
+
* What it still does not do is HOLD anything. A fact refused here is refused, and the
|
|
79
|
+
* carrier decides whether it comes back — which is the whole of Fougere's position on
|
|
80
|
+
* durability: the channel goes underneath, it is not reimplemented here.
|
|
81
|
+
*/
|
|
82
|
+
deliver(fact: string, payload: unknown): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* The announcement realizes the fact's own `lifecycle.create` — a `created()` stamped,
|
|
85
|
+
* an id generated, a default applied.
|
|
86
|
+
*
|
|
87
|
+
* `applyCreate` (`schema/src/axis/lifecycle/apply.ts`) is where the split is realized:
|
|
88
|
+
* the judge never fills a hole, the STORAGE does, at the point of persistence. A fact has no storage, so nobody did — the judge declared an
|
|
89
|
+
* absent `created()` legal and omitted it, and a subscriber received a value missing a
|
|
90
|
+
* field its own type promises. Announcing is a fact's point of persistence.
|
|
91
|
+
*
|
|
92
|
+
* Announcing only, never `deliver`: a fact that arrives from elsewhere was stamped by
|
|
93
|
+
* its sender, and stamping it again would give one fact a different identity in every
|
|
94
|
+
* process that relayed it.
|
|
95
|
+
*
|
|
96
|
+
* **A typed emitter cannot reach this yet.** `Emit<T>` names the ROW type, where a
|
|
97
|
+
* `created()` field is present and required, so `announce({ id, title })` is a compile
|
|
98
|
+
* error and the author writes `at: new Date()` anyway. So this runs for a payload built
|
|
99
|
+
* outside the type — a bridge, a replay, a test — and is inert for everyone else.
|
|
100
|
+
*/
|
|
101
|
+
private stamped;
|
|
102
|
+
/**
|
|
103
|
+
* Hand the fact to every listener in THIS process, and give back one promise each.
|
|
104
|
+
*
|
|
105
|
+
* The call goes THROUGH the door, so a subscriber meets the same judge, the same binding
|
|
106
|
+
* and the same middlewares as any caller. Nothing new answers for correctness — that is
|
|
107
|
+
* the dividend of a subscriber being an ordinary op rather than a special kind.
|
|
108
|
+
*
|
|
109
|
+
* It returns the promises rather than settling them, because the two callers want
|
|
110
|
+
* opposite things and only one of them is wrong to wait.
|
|
111
|
+
*/
|
|
112
|
+
private handToListeners;
|
|
113
|
+
/**
|
|
114
|
+
* A subscriber refusing the SHAPE, said in one line instead of dumped as an error.
|
|
115
|
+
*
|
|
116
|
+
* This is the one refusal nobody else will ever see. A door hands its 400 back to the
|
|
117
|
+
* caller who can fix it; a fact is dispatched, not delivered, so the sender learns
|
|
118
|
+
* nothing and the log is the whole of the evidence. The most likely cause is also the
|
|
119
|
+
* one a stack trace hides worst — this process's copy is older than the sender's — so
|
|
120
|
+
* the line names the fields and the remedy, and hedges because a genuinely bad payload
|
|
121
|
+
* produces the same refusal.
|
|
122
|
+
*/
|
|
123
|
+
private describeRefusal;
|
|
124
|
+
}
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=Emissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emissions.d.ts","sourceRoot":"","sources":["../../src/boot/Emissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KA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A8BvB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CAMxB"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { applyCreate } from '@fougere/schema';
|
|
2
|
+
import { validationErrorsOf } from '../wire/errors.js';
|
|
3
|
+
import { emitKeyOf, factsAnnouncedBy } from '../emit.js';
|
|
4
|
+
import { ambient } from '#ambient';
|
|
5
|
+
import { EMPTY_INVOCATION } from '../wire/invocation.js';
|
|
6
|
+
/**
|
|
7
|
+
* Emissions — the only place in Fougere where an initiator names a SUBJECT.
|
|
8
|
+
*
|
|
9
|
+
* It was eight closures over four collections in the middle of the boot, which is a
|
|
10
|
+
* class that had not been named: the announced set, the subscriber index, the chain
|
|
11
|
+
* carried in async context, and the shapes a fact is judged against.
|
|
12
|
+
*
|
|
13
|
+
* **It is a resolver, not a channel.** It answers *who*, then hands over to the door
|
|
14
|
+
* that already exists — so a subscriber keeps its judge, its binding and its
|
|
15
|
+
* middlewares, and nothing here is durable.
|
|
16
|
+
*/
|
|
17
|
+
export class Emissions {
|
|
18
|
+
shapes;
|
|
19
|
+
container;
|
|
20
|
+
log;
|
|
21
|
+
carry;
|
|
22
|
+
/** Who listens to what. Filled as each door's contracts are resolved. */
|
|
23
|
+
subscribers = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* What is announced here, read from the DEPS and not from the subscribers: a handler
|
|
26
|
+
* declaring `Emit<PostPublished>` must resolve it whether or not anybody listens, and
|
|
27
|
+
* announcing to nobody is legal.
|
|
28
|
+
*/
|
|
29
|
+
announced;
|
|
30
|
+
constructor(fronds, shapes, container, log, carry) {
|
|
31
|
+
this.shapes = shapes;
|
|
32
|
+
this.container = container;
|
|
33
|
+
this.log = log;
|
|
34
|
+
this.carry = carry;
|
|
35
|
+
this.announced = new Set(fronds.flatMap((frond) => factsAnnouncedBy(frond.handlers)));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Who listens to what — read from the PLAN, where `{ kind: 'fact' }` is a sentence
|
|
39
|
+
* `computeBindingPlan` already wrote, so nothing re-derives what a parameter is.
|
|
40
|
+
*
|
|
41
|
+
* It is called for a frond hosted here AND for one declared remote. A remote frond is
|
|
42
|
+
* still scanned — only its hosting is elsewhere — so its subscriptions are known, and
|
|
43
|
+
* its door resolves to a doublure. That is the whole reason an emission crosses a
|
|
44
|
+
* process without a line of transport code: the emitter learned the signature locally
|
|
45
|
+
* and calls the same key. Noting only the hosted ones left the index EMPTY under a
|
|
46
|
+
* split, and a fact announced to a remote listener reached nobody, in silence.
|
|
47
|
+
*/
|
|
48
|
+
note(contracts, door) {
|
|
49
|
+
for (const [op, contract] of contracts) {
|
|
50
|
+
for (const bound of contract.binding ?? []) {
|
|
51
|
+
if (bound.source.kind !== 'fact')
|
|
52
|
+
continue;
|
|
53
|
+
const listeners = this.subscribers.get(bound.source.factName) ?? [];
|
|
54
|
+
listeners.push({ door, op });
|
|
55
|
+
this.subscribers.set(bound.source.factName, listeners);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** The shape a fact is judged by, when the fact is a declared entity. */
|
|
60
|
+
shapeOf(fact) {
|
|
61
|
+
return this.shapes.get(fact);
|
|
62
|
+
}
|
|
63
|
+
/** The facts this process has a listener for — what a carrier subscribes to on its behalf. */
|
|
64
|
+
listensTo() {
|
|
65
|
+
return [...this.subscribers.keys()];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Register one emission value per fact — announced here, or merely listened to.
|
|
69
|
+
*
|
|
70
|
+
* A process that only subscribes still needs the value, because `deliver` is what a
|
|
71
|
+
* carrier calls and it goes through the same door. Called once every door has been
|
|
72
|
+
* built, so the two sets are complete.
|
|
73
|
+
*/
|
|
74
|
+
register() {
|
|
75
|
+
for (const fact of new Set([...this.announced, ...this.subscribers.keys()])) {
|
|
76
|
+
this.container.registerValue(emitKeyOf(fact), (raw) => this.announce(fact, raw));
|
|
77
|
+
}
|
|
78
|
+
if (ambient.degraded && this.subscribers.size > 0) {
|
|
79
|
+
this.log.warn('no async context on this runtime — an emission ring is not detected');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Announcing. Dispatch, never delivery — the emitter is handed back the moment every
|
|
84
|
+
* subscriber has been HANDED the fact, not when any of them is done.
|
|
85
|
+
*
|
|
86
|
+
* The `EventBus` this replaces did `await Promise.all(handlers)` and passed their
|
|
87
|
+
* rejections up, which made a publication hostage to its own indexer.
|
|
88
|
+
*/
|
|
89
|
+
async announce(fact, raw) {
|
|
90
|
+
/**
|
|
91
|
+
* A fact announced inside a frame that then rolls back is a lie, and nothing can take
|
|
92
|
+
* it back: announcing is DISPATCH — every subscriber has been handed the fact and the
|
|
93
|
+
* carrier has already put it on the wire — while the frame's writes are still
|
|
94
|
+
* provisional.
|
|
95
|
+
*
|
|
96
|
+
* Refused rather than deferred to the commit. Deferring would make `Emit<T>` behave
|
|
97
|
+
* differently depending on where it is called from, which is the hidden runtime the
|
|
98
|
+
* doctrine refuses; and it opens a window between the commit and the announcement whose
|
|
99
|
+
* only remedy is an outbox — a table, therefore durability, the one thing Fougere says
|
|
100
|
+
* it does not hold.
|
|
101
|
+
*
|
|
102
|
+
* A fact designates something that HAS happened. `run` returning is when that becomes
|
|
103
|
+
* true, so that is where the announcement belongs.
|
|
104
|
+
*/
|
|
105
|
+
await ambient.beforeAnnounce(fact);
|
|
106
|
+
const payload = this.stamped(fact, raw);
|
|
107
|
+
/**
|
|
108
|
+
* Whoever is not in this process — and it is the ONLY way to reach them.
|
|
109
|
+
*
|
|
110
|
+
* The local dispatch finds its listeners by having READ their code, so it stops at
|
|
111
|
+
* the repository boundary: another team's Frond is not on this disk, and the
|
|
112
|
+
* emission reaches nobody. A carrier hands the fact to a name instead, and the far
|
|
113
|
+
* side subscribes to that same name from ITS own code. Neither reads the other.
|
|
114
|
+
*
|
|
115
|
+
* `deliver` deliberately does NOT come here: a hub that resolved this value to hand
|
|
116
|
+
* on an incoming reading echoed it straight back to the whole fleet.
|
|
117
|
+
*/
|
|
118
|
+
const carried = this.carry?.(fact, payload);
|
|
119
|
+
if (carried)
|
|
120
|
+
void Promise.resolve(carried).catch((cause) => this.log.error(`${fact} — carrier refused it`, cause));
|
|
121
|
+
for (const { door, op, done } of this.handToListeners(fact, payload)) {
|
|
122
|
+
void done.catch((cause) => this.log.error(`${fact} → ${door}.${op}`, this.describeRefusal(fact, cause) ?? cause));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Receiving. **The opposite rule, deliberately**: this one waits, and it tells.
|
|
127
|
+
*
|
|
128
|
+
* `deliver` is what a CARRIER calls, and a carrier's whole job is to know whether the
|
|
129
|
+
* fact landed — at-least-once is retrying what failed, so a delivery that cannot report
|
|
130
|
+
* makes durability impossible to build on top. It used to be the announcement itself:
|
|
131
|
+
* it resolved before any subscriber had run and swallowed every failure into a log, so a
|
|
132
|
+
* queue calling it could only ever ack blindly.
|
|
133
|
+
*
|
|
134
|
+
* That is not a contradiction of "dispatch is not delivery". That rule protects the
|
|
135
|
+
* EMITTER, which must not become hostage to a subscriber; a carrier is not the emitter,
|
|
136
|
+
* it is precisely the party whose business this is.
|
|
137
|
+
*
|
|
138
|
+
* What it still does not do is HOLD anything. A fact refused here is refused, and the
|
|
139
|
+
* carrier decides whether it comes back — which is the whole of Fougere's position on
|
|
140
|
+
* durability: the channel goes underneath, it is not reimplemented here.
|
|
141
|
+
*/
|
|
142
|
+
async deliver(fact, payload) {
|
|
143
|
+
const handed = this.handToListeners(fact, payload);
|
|
144
|
+
const settled = await Promise.allSettled(handed.map((h) => h.done));
|
|
145
|
+
const refused = settled.flatMap((result, i) => result.status === 'rejected' ? [{ ...handed[i], reason: result.reason }] : []);
|
|
146
|
+
for (const { door, op, reason } of refused) {
|
|
147
|
+
this.log.error(`${fact} → ${door}.${op}`, this.describeRefusal(fact, reason) ?? reason);
|
|
148
|
+
}
|
|
149
|
+
if (refused.length > 0) {
|
|
150
|
+
throw new AggregateError(refused.map((r) => r.reason), `${fact} — ${refused.length} of ${handed.length} listener(s) refused it`
|
|
151
|
+
+ ` (${refused.map((r) => `${r.door}.${r.op}`).join(', ')}).`
|
|
152
|
+
+ ` Nothing here holds it: the carrier decides whether it comes back.`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The announcement realizes the fact's own `lifecycle.create` — a `created()` stamped,
|
|
157
|
+
* an id generated, a default applied.
|
|
158
|
+
*
|
|
159
|
+
* `applyCreate` (`schema/src/axis/lifecycle/apply.ts`) is where the split is realized:
|
|
160
|
+
* the judge never fills a hole, the STORAGE does, at the point of persistence. A fact has no storage, so nobody did — the judge declared an
|
|
161
|
+
* absent `created()` legal and omitted it, and a subscriber received a value missing a
|
|
162
|
+
* field its own type promises. Announcing is a fact's point of persistence.
|
|
163
|
+
*
|
|
164
|
+
* Announcing only, never `deliver`: a fact that arrives from elsewhere was stamped by
|
|
165
|
+
* its sender, and stamping it again would give one fact a different identity in every
|
|
166
|
+
* process that relayed it.
|
|
167
|
+
*
|
|
168
|
+
* **A typed emitter cannot reach this yet.** `Emit<T>` names the ROW type, where a
|
|
169
|
+
* `created()` field is present and required, so `announce({ id, title })` is a compile
|
|
170
|
+
* error and the author writes `at: new Date()` anyway. So this runs for a payload built
|
|
171
|
+
* outside the type — a bridge, a replay, a test — and is inert for everyone else.
|
|
172
|
+
*/
|
|
173
|
+
stamped(fact, raw) {
|
|
174
|
+
const shape = this.shapes.get(fact);
|
|
175
|
+
return shape && raw !== null && typeof raw === 'object' && !Array.isArray(raw)
|
|
176
|
+
? applyCreate(shape.getFields(), raw)
|
|
177
|
+
: raw;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Hand the fact to every listener in THIS process, and give back one promise each.
|
|
181
|
+
*
|
|
182
|
+
* The call goes THROUGH the door, so a subscriber meets the same judge, the same binding
|
|
183
|
+
* and the same middlewares as any caller. Nothing new answers for correctness — that is
|
|
184
|
+
* the dividend of a subscriber being an ordinary op rather than a special kind.
|
|
185
|
+
*
|
|
186
|
+
* It returns the promises rather than settling them, because the two callers want
|
|
187
|
+
* opposite things and only one of them is wrong to wait.
|
|
188
|
+
*/
|
|
189
|
+
handToListeners(fact, payload) {
|
|
190
|
+
const walked = ambient.currentChain();
|
|
191
|
+
if (walked.includes(fact)) {
|
|
192
|
+
throw new Error(`Emission cycle: ${[...walked, fact].join(' → ')}.\n`
|
|
193
|
+
+ ` A fact cannot cause itself. One of the subscribers above announces a fact that leads back here.`);
|
|
194
|
+
}
|
|
195
|
+
const listeners = this.subscribers.get(fact) ?? [];
|
|
196
|
+
if (listeners.length === 0) {
|
|
197
|
+
this.log.debug(`${fact} — nobody listens in this process`);
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
return listeners.map(({ door, op }) => ({
|
|
201
|
+
door,
|
|
202
|
+
op,
|
|
203
|
+
done: ambient.enterChain(fact, async () => {
|
|
204
|
+
let facade;
|
|
205
|
+
try {
|
|
206
|
+
facade = this.container.resolve(door);
|
|
207
|
+
}
|
|
208
|
+
catch (cause) {
|
|
209
|
+
throw new Error(`${fact} → ${door} could not be reached`, { cause });
|
|
210
|
+
}
|
|
211
|
+
return facade[op]({ ...EMPTY_INVOCATION, body: payload });
|
|
212
|
+
}),
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A subscriber refusing the SHAPE, said in one line instead of dumped as an error.
|
|
217
|
+
*
|
|
218
|
+
* This is the one refusal nobody else will ever see. A door hands its 400 back to the
|
|
219
|
+
* caller who can fix it; a fact is dispatched, not delivered, so the sender learns
|
|
220
|
+
* nothing and the log is the whole of the evidence. The most likely cause is also the
|
|
221
|
+
* one a stack trace hides worst — this process's copy is older than the sender's — so
|
|
222
|
+
* the line names the fields and the remedy, and hedges because a genuinely bad payload
|
|
223
|
+
* produces the same refusal.
|
|
224
|
+
*/
|
|
225
|
+
describeRefusal(fact, cause) {
|
|
226
|
+
const refusals = validationErrorsOf(cause);
|
|
227
|
+
if (!refusals?.length)
|
|
228
|
+
return undefined;
|
|
229
|
+
return `refused the shape — ${refusals.map((d) => `${d.path}: ${d.message}`).join(', ')}.`
|
|
230
|
+
+ ` If '${fact}' gained a field, this copy is older than the sender's: re-run \`fougere sync\`.`;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=Emissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emissions.js","sourceRoot":"","sources":["../../src/boot/Emissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAczD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,SAAS;IAaD;IACA;IACA;IACA;IAfnB,yEAAyE;IACxD,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE7D;;;;OAIG;IACc,SAAS,CAAc;IAExC,YACE,MAAc,EACG,MAA+B,EAC/B,SAAoB,EACpB,GAAW,EACX,KAAe;QAHf,WAAM,GAAN,MAAM,CAAyB;QAC/B,cAAS,GAAT,SAAS,CAAW;QACpB,QAAG,GAAH,GAAG,CAAQ;QACX,UAAK,GAAL,KAAK,CAAU;QAEhC,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CAAC,SAAwB,EAAE,IAAY;QACzC,KAAK,MAAM,CAAC,EAAE,EAA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C,EAAE,GAAG,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC;SACH,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACK,eAAe,CAAC,IAAY,EAAE,KAAc;QAClD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,EAAE,MAAM;YAAE,OAAO,SAAS,CAAC;QACxC,OAAO,uBAAuB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;cACtF,QAAQ,IAAI,kFAAkF,CAAC;IACrG,CAAC;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Container } from '@fougere/container';
|
|
2
|
+
import type { AppMiddleware } from '../wire/middleware.js';
|
|
3
|
+
import type { OperationsMap } from '../wire/operation.js';
|
|
4
|
+
import type { EffectiveOperationsMap } from '../effective-operation.js';
|
|
5
|
+
import type { Emissions } from './Emissions.js';
|
|
6
|
+
import type { Logger } from '../builtins/logger.js';
|
|
7
|
+
import type { EntityEntry, HandlerEntry, PresenterEntry } from '../scan/frond.js';
|
|
8
|
+
/** What this door is about: a handler, the entity behind it when there is one, and where it resolves. */
|
|
9
|
+
export interface Doorway {
|
|
10
|
+
handler: HandlerEntry;
|
|
11
|
+
/** Handlers in the owning frond, used to realize a resolved implementation override. */
|
|
12
|
+
handlers: readonly HandlerEntry[];
|
|
13
|
+
/** The canonical operation table resolved before boot performs any side effect. */
|
|
14
|
+
operations: EffectiveOperationsMap;
|
|
15
|
+
/** The subject — absent is ordinary: a health check owns no row. */
|
|
16
|
+
entity: EntityEntry | undefined;
|
|
17
|
+
/** The scope the handler and its collectors resolve in — a surface gets its own. */
|
|
18
|
+
scope: Container;
|
|
19
|
+
/** The container key this door answers under. */
|
|
20
|
+
key: string;
|
|
21
|
+
}
|
|
22
|
+
/** What the frond and the boot supply to every door alike. */
|
|
23
|
+
export interface Wiring {
|
|
24
|
+
/** The frond this door belongs to — travels on every OperationContext. */
|
|
25
|
+
frond: string;
|
|
26
|
+
/** The frond's own scope — where presenters live, whatever sub-scope the door uses. */
|
|
27
|
+
frondScope: Container;
|
|
28
|
+
log: Logger;
|
|
29
|
+
/** Entity names this frond has a collector for. */
|
|
30
|
+
collectors: Set<string>;
|
|
31
|
+
presenters: Map<string, PresenterEntry>;
|
|
32
|
+
/** The middlewares that apply to an address, read at call time and never at boot. */
|
|
33
|
+
middlewaresFor: (address: string) => AppMiddleware[];
|
|
34
|
+
emissions: Emissions;
|
|
35
|
+
}
|
|
36
|
+
/** Adapts one handler door to executable operations. */
|
|
37
|
+
export declare class HandlerFacade {
|
|
38
|
+
private readonly door;
|
|
39
|
+
private readonly wiring;
|
|
40
|
+
/** Rich operation facts shared with check, explain and adapters. */
|
|
41
|
+
readonly effectiveOperations: EffectiveOperationsMap;
|
|
42
|
+
/** Contracts served by this door. */
|
|
43
|
+
readonly contracts: OperationsMap;
|
|
44
|
+
/** The callable surface: op name → the function a caller reaches. */
|
|
45
|
+
readonly ops: Record<string, Function>;
|
|
46
|
+
private readonly cachedViews;
|
|
47
|
+
private instance;
|
|
48
|
+
private readonly implementationKeys;
|
|
49
|
+
private readonly implementationInstances;
|
|
50
|
+
private readonly inputValidator;
|
|
51
|
+
private readonly argumentResolver;
|
|
52
|
+
private readonly presenterArguments;
|
|
53
|
+
constructor(door: Doorway, wiring: Wiring);
|
|
54
|
+
/** Storage follows the Crud subject, which may differ from the door address. */
|
|
55
|
+
private subjectOf;
|
|
56
|
+
private inheritsCrud;
|
|
57
|
+
private get handlerKey();
|
|
58
|
+
private depsOf;
|
|
59
|
+
/** A custom Crud constructor must explicitly receive its repository. */
|
|
60
|
+
private refuseCrudWithoutRepository;
|
|
61
|
+
/** Resolve and cache the output view declared for one operation. */
|
|
62
|
+
private viewOf;
|
|
63
|
+
private collectorResolver;
|
|
64
|
+
/** The handler itself, resolved on first call — never at boot. */
|
|
65
|
+
private resolvedHandler;
|
|
66
|
+
private isBaseImplementation;
|
|
67
|
+
/** The exact handler entry the pure model selected; no name-only retry or fallback. */
|
|
68
|
+
private implementationHandler;
|
|
69
|
+
private resolvedImplementation;
|
|
70
|
+
private wrap;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=HandlerFacade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandlerFacade.d.ts","sourceRoot":"","sources":["../../src/boot/HandlerFacade.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlF,yGAAyG;AACzG,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,wFAAwF;IACxF,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,mFAAmF;IACnF,UAAU,EAAE,sBAAsB,CAAC;IACnC,oEAAoE;IACpE,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,oFAAoF;IACpF,KAAK,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,8DAA8D;AAC9D,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,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