@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
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boot's two ends: what `createApp` takes, and what it hands back.
|
|
3
|
+
*
|
|
4
|
+
* The scan's descriptors moved to `frond.ts` and the auth contract to `auth.ts` — this
|
|
5
|
+
* file was named after a role ("the types"), so everything with nowhere else to be
|
|
6
|
+
* landed in it, seventeen notions deep.
|
|
7
|
+
*/
|
|
8
|
+
import type { Container } from '@fougere/container';
|
|
9
|
+
import type { Fronds } from '../scan/Fronds.js';
|
|
10
|
+
import type { ScanResult } from '../scan/frond.js';
|
|
11
|
+
import type { SchemaView } from '@fougere/schema';
|
|
12
|
+
import type { OrmFactory } from '../orm.js';
|
|
13
|
+
import type { AppMiddleware } from '../wire/middleware.js';
|
|
14
|
+
import type { RpcAnswer, Transport } from '../wire/call.js';
|
|
15
|
+
import type { Extension } from './AppLifecycle.js';
|
|
16
|
+
import type { AuthConfig, AuthRuntime } from './auth.js';
|
|
17
|
+
import type { EffectiveOperationsMap } from '../effective-operation.js';
|
|
18
|
+
import type { DispatchObserver } from '../dispatch/DispatchEvent.js';
|
|
19
|
+
import type { DispatchPort } from '../dispatch/DispatchPort.js';
|
|
20
|
+
/** Options for createApp(). */
|
|
21
|
+
export interface CreateAppOptions {
|
|
22
|
+
/** Factory function to create the container. Required. */
|
|
23
|
+
createContainer: () => Container;
|
|
24
|
+
/** Factory to auto-generate EntityOrm for each scanned entity. */
|
|
25
|
+
ormFactory?: OrmFactory;
|
|
26
|
+
/**
|
|
27
|
+
* Which source an entity's rows live in, and how to open a transaction on one — the two
|
|
28
|
+
* questions that decide whether `Together<[…]>` gets the engine's own unwind or replays
|
|
29
|
+
* inverses itself.
|
|
30
|
+
*
|
|
31
|
+
* Optional together, because a host may hand in a bare `ormFactory` and know neither. A
|
|
32
|
+
* frame then compensates: not knowing where the rows are and promising atomicity over
|
|
33
|
+
* them are two different things, and only one of them is honest.
|
|
34
|
+
*/
|
|
35
|
+
sourceOf?: (entityName: string) => string;
|
|
36
|
+
transacted?: <R>(source: string, fn: (ormFactory: OrmFactory) => Promise<R>) => Promise<R>;
|
|
37
|
+
/**
|
|
38
|
+
* Builds the cross-source reader a frond gets when it declares `reads:`.
|
|
39
|
+
*
|
|
40
|
+
* A factory rather than a value, for the same reason `ormFactory` is one: core must
|
|
41
|
+
* not name a storage package, and this one costs 71 MB of downloaded extensions and a
|
|
42
|
+
* native module — nothing a first run that only wanted sqlite should carry. The host
|
|
43
|
+
* decides what backs it; `@fougere/adapter-duckdb` is one answer, not the contract.
|
|
44
|
+
*
|
|
45
|
+
* Called once per frond that asks, with the entity CLASSES its `reads:` named — a
|
|
46
|
+
* name would make the reader resolve the schema a second time.
|
|
47
|
+
*/
|
|
48
|
+
sourcesFactory?: (reads: unknown[], frond: string) => Promise<unknown> | unknown;
|
|
49
|
+
/**
|
|
50
|
+
* What this app is built from — required, because producing it is what reads a disk.
|
|
51
|
+
*
|
|
52
|
+
* `scanProject` (`@fougere/core/node`) reads the fronds off the filesystem; a module a
|
|
53
|
+
* build wrote holds the same value with no disk at all. `createApp` cannot tell them
|
|
54
|
+
* apart, and that is the point: it names no builtin, so a runtime without `node:fs`
|
|
55
|
+
* runs it. `root` and `fronds` used to live here — both were arguments to the scan.
|
|
56
|
+
*/
|
|
57
|
+
scan: ScanResult | (() => Promise<ScanResult> | ScanResult);
|
|
58
|
+
/**
|
|
59
|
+
* Remote fronds — label → address. What each remote hosts is discovered
|
|
60
|
+
* at the first miss (rpc.discover), never declared here.
|
|
61
|
+
*/
|
|
62
|
+
remotes?: Record<string, string>;
|
|
63
|
+
/**
|
|
64
|
+
* Builds the transport used to reach `remotes` addresses. Wired by
|
|
65
|
+
* layer-2 packages (e.g. @fougere/transport-http); required when
|
|
66
|
+
* `remotes` is non-empty.
|
|
67
|
+
*/
|
|
68
|
+
remoteTransport?: (url: string) => Transport;
|
|
69
|
+
/**
|
|
70
|
+
* Which realization answers which port — see `FougereConfig.ports`. Needed only
|
|
71
|
+
* when two classes extend the same port; one is resolved by convention.
|
|
72
|
+
*/
|
|
73
|
+
ports?: Record<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* What this app takes on beyond its fronds, each stating what it does and what it undoes.
|
|
76
|
+
*
|
|
77
|
+
* `up` runs before `createApp` returns, in this order; `down` runs inside `dispose()`,
|
|
78
|
+
* in reverse. Three levels release in reverse of construction, which is the container's
|
|
79
|
+
* own rule read one level out: extensions first (built last), then the container, then
|
|
80
|
+
* `onDispose` — a resource opened before any of this existed.
|
|
81
|
+
*
|
|
82
|
+
* A member may be `undefined`, so a host writes a conditional one inline rather than a
|
|
83
|
+
* spread over a ternary. The framework's own two are always declared, `migrate` as an
|
|
84
|
+
* empty slot when nothing migrates: a host filling it later REPLACES that member in
|
|
85
|
+
* place instead of adding one after the seeds.
|
|
86
|
+
*/
|
|
87
|
+
extensions?: ReadonlyArray<Extension | undefined>;
|
|
88
|
+
/**
|
|
89
|
+
* Released by `app.dispose()` AFTER the container, for a resource handed in rather
|
|
90
|
+
* than built here — a storage connection is the one case today.
|
|
91
|
+
*
|
|
92
|
+
* NOT an extension, and the difference is a time: this was opened BEFORE the container,
|
|
93
|
+
* so it closes after it, while an extension's `up` runs after the container and its
|
|
94
|
+
* `down` therefore runs before. A storage's migration is an extension; its connection
|
|
95
|
+
* is not, and `ResolvedStorage` declares the two beside each other.
|
|
96
|
+
*/
|
|
97
|
+
onDispose?: () => Promise<void> | void;
|
|
98
|
+
/**
|
|
99
|
+
* Which protocol adapters this app serves — see `FougereConfig.adapters`.
|
|
100
|
+
* Carried onto the App so every door reads one answer instead of each host
|
|
101
|
+
* deciding for itself.
|
|
102
|
+
*/
|
|
103
|
+
adapters?: Record<string, boolean | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* Carries an announced fact out of this process — a broker, a queue, a log.
|
|
106
|
+
*
|
|
107
|
+
* Called for every emission, ALONGSIDE the local dispatch and never instead of it: a
|
|
108
|
+
* listener in this process is reached directly, and this is how the others hear.
|
|
109
|
+
*
|
|
110
|
+
* It exists because the local dispatch finds its listeners by having READ their code,
|
|
111
|
+
* which stops at the repository boundary. A carrier hands the fact to a NAME; the far
|
|
112
|
+
* side subscribes to that same name from its own code, and neither ever reads the other.
|
|
113
|
+
*
|
|
114
|
+
* Its failure never reaches the emitter — same rule as a subscriber's.
|
|
115
|
+
*/
|
|
116
|
+
onEmit?: (fact: string, payload: unknown) => void | Promise<void>;
|
|
117
|
+
/** Passive observers of every dispatch transition. */
|
|
118
|
+
dispatchObservers?: readonly DispatchObserver[];
|
|
119
|
+
/**
|
|
120
|
+
* Storage handle to expose to the auth provider via AuthContext.db.
|
|
121
|
+
* Required when `auth` is set.
|
|
122
|
+
*/
|
|
123
|
+
db?: unknown;
|
|
124
|
+
/** Auth declaration to wire into the app at boot. */
|
|
125
|
+
auth?: AuthConfig;
|
|
126
|
+
}
|
|
127
|
+
/** The App object returned by createApp(). */
|
|
128
|
+
export interface App extends DispatchPort {
|
|
129
|
+
/** Process-only dispatch capability used by incoming transports. */
|
|
130
|
+
local: DispatchPort;
|
|
131
|
+
/** Root container with builtins + frond scopes. */
|
|
132
|
+
container: Container;
|
|
133
|
+
/**
|
|
134
|
+
* Which protocol adapters this app declared, from `fougere.config.ts`.
|
|
135
|
+
*
|
|
136
|
+
* Read by the doors themselves, so an undeclared adapter serves nothing whatever
|
|
137
|
+
* the host mounted — the route file may exist, the middleware may be installed, and
|
|
138
|
+
* the answer is still "not here".
|
|
139
|
+
*/
|
|
140
|
+
adapters: Record<string, boolean | undefined>;
|
|
141
|
+
/** Discovered fronds metadata. */
|
|
142
|
+
fronds: Fronds;
|
|
143
|
+
/** Resolve from root container (shortcut). */
|
|
144
|
+
resolve<T>(name: string): T;
|
|
145
|
+
/**
|
|
146
|
+
* Resolve an entity's schema — the local `entityClass` when it's hosted or
|
|
147
|
+
* scanned here, else reconstructed from the remote's identity card
|
|
148
|
+
* (rpc.discover → reconstruct()). The one way to get a live schema for an
|
|
149
|
+
* entity whose class may not be importable at all (another repo, another
|
|
150
|
+
* language) — a card travelled, but until now its `schema` was thrown away.
|
|
151
|
+
*/
|
|
152
|
+
schemaFor(entity: string): Promise<SchemaView>;
|
|
153
|
+
/**
|
|
154
|
+
* The door a name exposes to one audience, or `undefined` when it exposes
|
|
155
|
+
* none. A named surface is CLOSED: a name with no door of its own under that
|
|
156
|
+
* surface is not in it — it never falls back to the full one.
|
|
157
|
+
*
|
|
158
|
+
* **Not always a façade**, despite the name: when the owning frond is declared
|
|
159
|
+
* remote, nothing is registered locally (`bootstrap.ts`, `declaredRemotes`) and
|
|
160
|
+
* this resolves to a doublure — a façade-shaped stand-in (`remote.ts`). The
|
|
161
|
+
* caller cannot tell, which is the point; the word here was simply wrong.
|
|
162
|
+
*
|
|
163
|
+
* The one way an adapter reaches that door. It exists so the key format stays
|
|
164
|
+
* inside core (see `facadeKeyOf`), which is what lets a projection package
|
|
165
|
+
* stay structurally typed and depend on nothing.
|
|
166
|
+
*/
|
|
167
|
+
facadeFor(entity: string, surface?: string): Record<string, Function> | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* The canonical contracts served beside a facade, after prefab + scan + config,
|
|
170
|
+
* binding, kind, topology and surface resolution. Check, explain and adapters read
|
|
171
|
+
* this table instead of replaying those decisions.
|
|
172
|
+
*/
|
|
173
|
+
operationsFor(entity: string, surface?: string): EffectiveOperationsMap | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* The facts this app has a listener for — what a carrier must subscribe to on its behalf.
|
|
176
|
+
*
|
|
177
|
+
* Derived from the signatures it scanned (`Fact<T>` in an op's parameters), so a process
|
|
178
|
+
* states what it listens to without anyone declaring it twice. The dual of `onEmit`: one
|
|
179
|
+
* says what leaves, this says what should be brought in.
|
|
180
|
+
*/
|
|
181
|
+
listensTo(): string[];
|
|
182
|
+
/**
|
|
183
|
+
* Hand a fact that came from OUTSIDE to the listeners in this process — and stop there.
|
|
184
|
+
*
|
|
185
|
+
* The dual of `onEmit`, and deliberately not the same thing as announcing: resolving the
|
|
186
|
+
* emission value to deliver an inbound fact would carry it straight back out through
|
|
187
|
+
* `onEmit`, so a hub echoed every reading it received to the whole fleet. Receiving and
|
|
188
|
+
* announcing are two operations; only one of them leaves.
|
|
189
|
+
*
|
|
190
|
+
* The local dispatch is identical either way — same judge, same binding, same
|
|
191
|
+
* middlewares — so a fact off a wire is no less checked than one raised next door.
|
|
192
|
+
*
|
|
193
|
+
* **It waits, and it tells** — the opposite of announcing, on purpose. It resolves once
|
|
194
|
+
* every listener here is done, and REJECTS with an `AggregateError` if any refused. A
|
|
195
|
+
* carrier's whole job is to know whether the fact landed: at-least-once is retrying what
|
|
196
|
+
* failed, so a delivery that cannot report makes durability impossible to build above it.
|
|
197
|
+
* "Dispatch is not delivery" protects the EMITTER from a slow subscriber; a carrier is
|
|
198
|
+
* not the emitter, it is the party whose business this is.
|
|
199
|
+
*
|
|
200
|
+
* It still holds nothing. A refused fact is refused, and whether it comes back is the
|
|
201
|
+
* carrier's decision — Fougere puts the channel underneath rather than reimplementing it.
|
|
202
|
+
*/
|
|
203
|
+
deliver(fact: string, payload: unknown): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* The storage an entity is backed by, resolved through its owning frond's scope —
|
|
206
|
+
* the dual of {@link facadeFor}. `undefined` when no loaded frond hosts the entity,
|
|
207
|
+
* or when the app booted with no storage at all.
|
|
208
|
+
*
|
|
209
|
+
* `unknown` because the port belongs to whoever wired it: narrowing it to `EntityOrm`
|
|
210
|
+
* is the caller saying which implementation they are standing on.
|
|
211
|
+
*/
|
|
212
|
+
ormFor(entity: string): unknown | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* The presenter of an entity, resolved through its owning frond's scope.
|
|
215
|
+
*
|
|
216
|
+
* Same shape as {@link ormFor}, and it exists so an adapter never spells the container
|
|
217
|
+
* key itself: `schema-graphql` wrote out `${Name}Presenter` by hand, and a key respelled
|
|
218
|
+
* in a second place finds nothing and reports nothing the day the convention moves.
|
|
219
|
+
*/
|
|
220
|
+
presenterFor(entity: string): unknown | undefined;
|
|
221
|
+
/** Dispose the root container. */
|
|
222
|
+
dispose(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Stop taking calls, and resolve once the running ones are done.
|
|
225
|
+
*
|
|
226
|
+
* The step before releasing, when there is work on the app: `dispose()` closes a
|
|
227
|
+
* storage connection the running calls are standing on. Rejects on `timeoutMs`
|
|
228
|
+
* naming how many are left, rather than resolving as if it had succeeded.
|
|
229
|
+
*/
|
|
230
|
+
drain(timeoutMs?: number): Promise<void>;
|
|
231
|
+
/** How many calls are running right now — one count for all three doors and the wire. */
|
|
232
|
+
inFlight(): number;
|
|
233
|
+
/**
|
|
234
|
+
* The same disposal, spelled so the language does it: `await using app = await
|
|
235
|
+
* createApp(…)`. Twelve of the twenty-six mounts in this repo's own tests never
|
|
236
|
+
* called `dispose()` — a scope that closes itself is the only version of that
|
|
237
|
+
* rule nobody forgets.
|
|
238
|
+
*/
|
|
239
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* What this app took on, in the order it will release them. The reading of
|
|
242
|
+
* `CreateAppOptions.extensions` after the boot resolved it.
|
|
243
|
+
*/
|
|
244
|
+
extensions(): string[];
|
|
245
|
+
/**
|
|
246
|
+
* Declare one `rpc` op — what the app says about ITSELF, beside the card.
|
|
247
|
+
*
|
|
248
|
+
* The gesture a package uses to add a reading core does not hold: an app that never
|
|
249
|
+
* installed it never registers it, so the runner's refusal is the whole degradation.
|
|
250
|
+
* A name already declared is refused rather than replaced — `discover` included.
|
|
251
|
+
*/
|
|
252
|
+
serveRpc(op: string, answer: RpcAnswer): void;
|
|
253
|
+
/** Register a global app middleware (runs on every operation). */
|
|
254
|
+
use(middleware: AppMiddleware): void;
|
|
255
|
+
/** Register an app middleware scoped to a specific entity. */
|
|
256
|
+
use(entity: string, middleware: AppMiddleware): void;
|
|
257
|
+
/** Auth runtime, present when fougere.config.ts declares `auth`. */
|
|
258
|
+
auth?: AuthRuntime;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/boot/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,O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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/boot/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The process environment, as a service — so a handler asks for it rather than reading it.
|
|
3
|
+
*
|
|
4
|
+
* `process` is absent on a Worker, where the environment arrives as a binding. Read through
|
|
5
|
+
* `globalThis` and treated as empty when there is none: a missing variable and a missing
|
|
6
|
+
* `process` are the same answer to a caller, and the fallback already says what to do.
|
|
7
|
+
*/
|
|
1
8
|
export declare class Config {
|
|
9
|
+
private readonly env;
|
|
10
|
+
constructor(env?: Record<string, string | undefined>);
|
|
2
11
|
get<T = string>(key: string, fallback?: T): T;
|
|
3
12
|
}
|
|
4
13
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/builtins/config.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/builtins/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAkB;IAErF,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC;CAG9C"}
|
package/dist/builtins/config.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The process environment, as a service — so a handler asks for it rather than reading it.
|
|
3
|
+
*
|
|
4
|
+
* `process` is absent on a Worker, where the environment arrives as a binding. Read through
|
|
5
|
+
* `globalThis` and treated as empty when there is none: a missing variable and a missing
|
|
6
|
+
* `process` are the same answer to a caller, and the fallback already says what to do.
|
|
7
|
+
*/
|
|
1
8
|
export class Config {
|
|
9
|
+
env;
|
|
10
|
+
constructor(env = envOfProcess()) {
|
|
11
|
+
this.env = env;
|
|
12
|
+
}
|
|
2
13
|
get(key, fallback) {
|
|
3
|
-
return
|
|
14
|
+
return this.env[key] ?? fallback;
|
|
4
15
|
}
|
|
5
16
|
}
|
|
17
|
+
function envOfProcess() {
|
|
18
|
+
const proc = globalThis.process;
|
|
19
|
+
return proc?.env ?? {};
|
|
20
|
+
}
|
|
6
21
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/builtins/config.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/builtins/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,MAAM;IACY;IAA7B,YAA6B,MAA0C,YAAY,EAAE;QAAxD,QAAG,GAAH,GAAG,CAAqD;IAAG,CAAC;IAEzF,GAAG,CAAa,GAAW,EAAE,QAAY;QACvC,OAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAO,IAAK,QAAc,CAAC;IACjD,CAAC;CACF;AAED,SAAS,YAAY;IACnB,MAAM,IAAI,GAAI,UAAyE,CAAC,OAAO,CAAC;IAChG,OAAO,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -4,20 +4,53 @@
|
|
|
4
4
|
* Works on Node, Bun, Deno, Cloudflare Workers (console-based, no native bindings).
|
|
5
5
|
*/
|
|
6
6
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
7
|
+
/**
|
|
8
|
+
* One line, before it was formatted for a terminal.
|
|
9
|
+
*
|
|
10
|
+
* The console form is already cooked — ANSI codes, a badge, a timestamp — so anything
|
|
11
|
+
* that wants to FORWARD a log needs it before that. What travels is the structure, and
|
|
12
|
+
* nothing here knows where it goes.
|
|
13
|
+
*/
|
|
14
|
+
export interface LogRecord {
|
|
15
|
+
level: Exclude<LogLevel, 'silent'>;
|
|
16
|
+
/** The logger's own name — 'boot:app', 'boot:app:catalog'. */
|
|
17
|
+
name: string;
|
|
18
|
+
message: string;
|
|
19
|
+
args: unknown[];
|
|
20
|
+
/** Epoch milliseconds. */
|
|
21
|
+
at: number;
|
|
22
|
+
}
|
|
23
|
+
export type LogSink = (record: LogRecord) => void;
|
|
24
|
+
/** Take every line this process logs. Returns the way to withdraw. */
|
|
25
|
+
export declare function onLog(next: LogSink): () => void;
|
|
26
|
+
/**
|
|
27
|
+
* The level the PROCESS was started with. Read here rather than only at `applyConfig`,
|
|
28
|
+
* which runs after the boot has already said where its root is — an operator asking for
|
|
29
|
+
* `warn` got that line anyway. Guarded: this module runs on Workers, where there is no
|
|
30
|
+
* `process`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function envLevel(): LogLevel | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Set the level for every logger in this process, at once.
|
|
35
|
+
*
|
|
36
|
+
* Refuses a level it does not know rather than storing `undefined` as the threshold:
|
|
37
|
+
* every comparison against it is then `NaN`, so nothing is filtered and `logLevel()`
|
|
38
|
+
* reports its own fallback instead of what is in force.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setLogLevel(level: LogLevel): void;
|
|
41
|
+
/** What the level is now — the dual, so a reload can report what it changed. */
|
|
42
|
+
export declare function logLevel(): LogLevel;
|
|
7
43
|
export interface LoggerOptions {
|
|
8
|
-
/** Minimum log level. Default: 'info'. */
|
|
9
|
-
level?: LogLevel;
|
|
10
44
|
/** Logger name / prefix. */
|
|
11
45
|
name?: string;
|
|
12
46
|
/** Force color on/off. Auto-detected by default. */
|
|
13
47
|
color?: boolean;
|
|
14
48
|
}
|
|
15
49
|
export declare class Logger {
|
|
16
|
-
private level;
|
|
17
50
|
private name;
|
|
18
51
|
private color;
|
|
19
52
|
constructor(prefix?: string, options?: Omit<LoggerOptions, 'name'>);
|
|
20
|
-
/** Create a child logger with a sub-name. */
|
|
53
|
+
/** Create a child logger with a sub-name. It carries no level of its own either. */
|
|
21
54
|
child(name: string): Logger;
|
|
22
55
|
debug(msg: string, ...args: unknown[]): void;
|
|
23
56
|
info(msg: string, ...args: unknown[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/builtins/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/builtins/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;AAUlD,sEAAsE;AACtE,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,IAAI,CAM/C;AAcD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAG/C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAKjD;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,IAAI,QAAQ,CAEnC;AAuCD,MAAM,WAAW,aAAa;IAC5B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAU;gBAEX,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAKlE,oFAAoF;IACpF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IACrC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IACpC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IACpC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAErC,OAAO,CAAC,GAAG;CAyBZ"}
|
package/dist/builtins/logger.js
CHANGED
|
@@ -3,7 +3,59 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Works on Node, Bun, Deno, Cloudflare Workers (console-based, no native bindings).
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Who else takes this process's log lines, beside the console. A list, like the span
|
|
8
|
+
* sinks: a line is one fact, and forwarding it twice is the caller's business.
|
|
9
|
+
*
|
|
10
|
+
* Nothing is built when nobody listens — the record is only shaped if a sink exists.
|
|
11
|
+
*/
|
|
12
|
+
const sinks = [];
|
|
13
|
+
/** Take every line this process logs. Returns the way to withdraw. */
|
|
14
|
+
export function onLog(next) {
|
|
15
|
+
sinks.push(next);
|
|
16
|
+
return () => {
|
|
17
|
+
const at = sinks.indexOf(next);
|
|
18
|
+
if (at >= 0)
|
|
19
|
+
sinks.splice(at, 1);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
6
22
|
const LEVELS = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
|
|
23
|
+
/**
|
|
24
|
+
* The level, held ONCE for the process and CONSULTED at every emission.
|
|
25
|
+
*
|
|
26
|
+
* It used to be copied into each Logger by the constructor, and copied again by
|
|
27
|
+
* `child()` — so there was no place where "the level" was, and changing it meant
|
|
28
|
+
* rebuilding every logger AND everything that had been handed one. A value read at
|
|
29
|
+
* the moment it is used costs the same and can move.
|
|
30
|
+
*/
|
|
31
|
+
let threshold = LEVELS[envLevel() ?? 'info'];
|
|
32
|
+
/**
|
|
33
|
+
* The level the PROCESS was started with. Read here rather than only at `applyConfig`,
|
|
34
|
+
* which runs after the boot has already said where its root is — an operator asking for
|
|
35
|
+
* `warn` got that line anyway. Guarded: this module runs on Workers, where there is no
|
|
36
|
+
* `process`.
|
|
37
|
+
*/
|
|
38
|
+
export function envLevel() {
|
|
39
|
+
const raw = typeof process === 'undefined' ? undefined : process.env.FOUGERE_LOG_LEVEL;
|
|
40
|
+
return raw !== undefined && raw in LEVELS ? raw : undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set the level for every logger in this process, at once.
|
|
44
|
+
*
|
|
45
|
+
* Refuses a level it does not know rather than storing `undefined` as the threshold:
|
|
46
|
+
* every comparison against it is then `NaN`, so nothing is filtered and `logLevel()`
|
|
47
|
+
* reports its own fallback instead of what is in force.
|
|
48
|
+
*/
|
|
49
|
+
export function setLogLevel(level) {
|
|
50
|
+
if (!(level in LEVELS)) {
|
|
51
|
+
throw new Error(`Unknown log level: '${level}'. One of ${Object.keys(LEVELS).join(', ')}.`);
|
|
52
|
+
}
|
|
53
|
+
threshold = LEVELS[level];
|
|
54
|
+
}
|
|
55
|
+
/** What the level is now — the dual, so a reload can report what it changed. */
|
|
56
|
+
export function logLevel() {
|
|
57
|
+
return Object.keys(LEVELS).find((l) => LEVELS[l] === threshold) ?? 'info';
|
|
58
|
+
}
|
|
7
59
|
const COLORS = {
|
|
8
60
|
reset: '\x1b[0m',
|
|
9
61
|
dim: '\x1b[2m',
|
|
@@ -40,29 +92,36 @@ function formatTime() {
|
|
|
40
92
|
return `${h}:${m}:${s}.${ms}`;
|
|
41
93
|
}
|
|
42
94
|
export class Logger {
|
|
43
|
-
level;
|
|
44
95
|
name;
|
|
45
96
|
color;
|
|
46
97
|
constructor(prefix, options) {
|
|
47
98
|
this.name = prefix ?? 'app';
|
|
48
|
-
this.level = LEVELS[options?.level ?? 'info'];
|
|
49
99
|
this.color = options?.color ?? supportsColor();
|
|
50
100
|
}
|
|
51
|
-
/** Create a child logger with a sub-name. */
|
|
101
|
+
/** Create a child logger with a sub-name. It carries no level of its own either. */
|
|
52
102
|
child(name) {
|
|
53
|
-
|
|
54
|
-
return new Logger(`${this.name}:${name}`, { level, color: this.color });
|
|
103
|
+
return new Logger(`${this.name}:${name}`, { color: this.color });
|
|
55
104
|
}
|
|
56
105
|
debug(msg, ...args) { this.log('debug', msg, args); }
|
|
57
106
|
info(msg, ...args) { this.log('info', msg, args); }
|
|
58
107
|
warn(msg, ...args) { this.log('warn', msg, args); }
|
|
59
108
|
error(msg, ...args) { this.log('error', msg, args); }
|
|
60
109
|
log(level, msg, args) {
|
|
61
|
-
if (LEVELS[level] <
|
|
110
|
+
if (LEVELS[level] < threshold)
|
|
62
111
|
return;
|
|
112
|
+
// Beside the console, never instead of it: a forwarded line is an addition, and a
|
|
113
|
+
// sink that throws must not cost the operator the line they were reading.
|
|
114
|
+
for (const take of sinks) {
|
|
115
|
+
try {
|
|
116
|
+
take({ level: level, name: this.name, message: msg, args, at: Date.now() });
|
|
117
|
+
}
|
|
118
|
+
catch { /* forwarding never breaks logging */ }
|
|
119
|
+
}
|
|
63
120
|
const style = LEVEL_STYLE[level];
|
|
64
121
|
const time = formatTime();
|
|
65
|
-
|
|
122
|
+
// One console method per level. `debug` and `info` both went to `console.log`, so
|
|
123
|
+
// nothing downstream — a terminal filter, a collector — could tell them apart.
|
|
124
|
+
const method = level;
|
|
66
125
|
if (this.color) {
|
|
67
126
|
const c = COLORS[style.color];
|
|
68
127
|
const prefix = `${COLORS.dim}${time}${COLORS.reset} ${c}${COLORS.bold}${style.badge}${COLORS.reset} ${COLORS.magenta}${this.name}${COLORS.reset}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/builtins/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/builtins/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH;;;;;GAKG;AACH,MAAM,KAAK,GAAc,EAAE,CAAC;AAE5B,sEAAsE;AACtE,MAAM,UAAU,KAAK,CAAC,IAAa;IACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,GAAG,EAAE;QACV,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,EAAE,IAAI,CAAC;YAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAA6B,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAE7F;;;;;;;GAOG;AACH,IAAI,SAAS,GAAW,MAAM,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,GAAG,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvF,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,IAAI,MAAM,CAAC,CAAC,CAAE,GAAgB,CAAC,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AK,CAAC,CAAC;YAC9B,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;YAClJ,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CACF"}
|
package/dist/config-loader.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { AuthConfig } from './
|
|
1
|
+
import type { AuthConfig } from './boot/auth.js';
|
|
2
|
+
import type { LogLevel } from './builtins/logger.js';
|
|
3
|
+
import type { ConventionsInput } from './scan/conventions.js';
|
|
2
4
|
export interface FougereConfig {
|
|
3
5
|
/** Database configuration — the DEFAULT source, the one an entity lands in unnamed. */
|
|
4
6
|
db?: 'sqlite' | {
|
|
@@ -25,10 +27,38 @@ export interface FougereConfig {
|
|
|
25
27
|
path?: string;
|
|
26
28
|
entities: string[];
|
|
27
29
|
}>;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The names the scan reads instead of deriving them — the import scope, the fronds
|
|
32
|
+
* directory, the seven convention directories.
|
|
33
|
+
*
|
|
34
|
+
* Only what differs is stated. Read BEFORE the fronds are discovered, which is what
|
|
35
|
+
* lets it name the prefix they are found under: nothing in this file may import
|
|
36
|
+
* `@fronds/*`, or the name would be needed to read the file that declares it.
|
|
37
|
+
*/
|
|
38
|
+
conventions?: ConventionsInput;
|
|
39
|
+
/**
|
|
40
|
+
* How much every logger says. The one key a running app CONSULTS rather than
|
|
41
|
+
* consumes, so re-reading this file changes it without rebuilding anything.
|
|
42
|
+
*
|
|
43
|
+
* `FOUGERE_LOG_LEVEL` still wins — it is how the CLI speaks, and the precedence is
|
|
44
|
+
* the usual one (CLI over config file).
|
|
45
|
+
*/
|
|
46
|
+
logLevel?: LogLevel;
|
|
30
47
|
/** Remote fronds — frondName → base URL. */
|
|
31
48
|
remotes?: Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Which realization answers which port — port class name → implementation class name.
|
|
51
|
+
*
|
|
52
|
+
* A fact about the APP, stated beside `remotes:` for the same reason `sources:` is:
|
|
53
|
+
* `remotes:` says where a CALL goes, `sources:` says where a ROW is, this says who
|
|
54
|
+
* performs an ACTION. None of the three belongs inside the frond, which describes
|
|
55
|
+
* itself and not its deployment — a `billing` frond naming Stripe would be the one
|
|
56
|
+
* thing the framework refuses.
|
|
57
|
+
*
|
|
58
|
+
* Only the exception is declared. One class extending a port answers it by
|
|
59
|
+
* convention and this key stays absent; two make the boot refuse until one is named.
|
|
60
|
+
*/
|
|
61
|
+
ports?: Record<string, string>;
|
|
32
62
|
/** Auth declaration — picks a provider package and forwards options to it. */
|
|
33
63
|
auth?: AuthConfig;
|
|
34
64
|
/**
|
|
@@ -54,38 +84,16 @@ export interface AdapterConfig {
|
|
|
54
84
|
/** A surface of your own; the framework only records that you declared it. */
|
|
55
85
|
[adapter: string]: boolean | undefined;
|
|
56
86
|
}
|
|
57
|
-
export interface ResolvedConfig {
|
|
58
|
-
/** Global config merged with all overrides. */
|
|
59
|
-
global: FougereConfig;
|
|
60
|
-
/** Per-frond config overrides. */
|
|
61
|
-
fronds: Record<string, FougereConfig>;
|
|
62
|
-
}
|
|
63
87
|
/**
|
|
64
88
|
* Load the root fougere.config.{ts,js,mjs} from the given directory.
|
|
65
|
-
*/
|
|
66
|
-
export declare function loadConfig(root: string): Promise<FougereConfig>;
|
|
67
|
-
/**
|
|
68
|
-
* Load per-frond config files from each frond's directory.
|
|
69
|
-
*/
|
|
70
|
-
export declare function loadFrondConfigs(root: string, frondsDir?: string): Promise<Record<string, FougereConfig>>;
|
|
71
|
-
/**
|
|
72
|
-
* Override a config with another, the invariant of every cascade level:
|
|
73
|
-
* scalar keys replace, but `remotes` (the topology) MERGES — an override adds
|
|
74
|
-
* or redirects a frond without erasing the others. Used for workspace→app and
|
|
75
|
-
* for global→CLI alike.
|
|
76
|
-
*/
|
|
77
|
-
export declare function mergeGlobal(base: FougereConfig, override: Partial<FougereConfig>): FougereConfig;
|
|
78
|
-
/**
|
|
79
|
-
* Merge configs with cascade: global → frond → CLI overrides.
|
|
80
89
|
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Get the effective config for a specific frond.
|
|
86
|
-
* Cascade: global → frond override.
|
|
90
|
+
* `fresh` re-reads a file that may have changed since the last load — what a host
|
|
91
|
+
* calls when it decides to reconsider its config, and the only way `applyConfig` has
|
|
92
|
+
* anything new to apply.
|
|
87
93
|
*/
|
|
88
|
-
export declare function
|
|
94
|
+
export declare function loadConfig(root: string, options?: {
|
|
95
|
+
fresh?: boolean;
|
|
96
|
+
}): Promise<FougereConfig>;
|
|
89
97
|
/**
|
|
90
98
|
* Load config along the workspace→app frontier. The workspace-root config is
|
|
91
99
|
* the base (canonical topology: `remotes`, shared `db`); the app-root config
|
|
@@ -94,8 +102,4 @@ export declare function configForFrond(resolved: ResolvedConfig, frondName: stri
|
|
|
94
102
|
* root config — idempotent, no behavior change.
|
|
95
103
|
*/
|
|
96
104
|
export declare function loadCascadedConfig(workspaceRoot: string, appRoot: string): Promise<FougereConfig>;
|
|
97
|
-
/**
|
|
98
|
-
* Load everything: root config + frond configs + merge with CLI overrides.
|
|
99
|
-
*/
|
|
100
|
-
export declare function resolveConfig(root: string, cliOverrides?: Partial<FougereConfig>): Promise<ResolvedConfig>;
|
|
101
105
|
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,EAAE,CAAC,EAAE,QAAQ,GAAG;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC;IAC7D;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACpF;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,IAA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