@fougere/core 0.5.0-alpha.1 → 0.7.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 +1 -1
- package/dist/boot/Emissions.d.ts +14 -91
- package/dist/boot/Emissions.d.ts.map +1 -1
- package/dist/boot/Emissions.js +21 -118
- package/dist/boot/Emissions.js.map +1 -1
- package/dist/boot/ambient-port.d.ts +3 -24
- package/dist/boot/ambient-port.d.ts.map +1 -1
- package/dist/boot/ambient.als.d.ts.map +1 -1
- package/dist/boot/ambient.als.js +7 -12
- package/dist/boot/ambient.als.js.map +1 -1
- package/dist/boot/ambient.queue.d.ts +2 -5
- package/dist/boot/ambient.queue.d.ts.map +1 -1
- package/dist/boot/ambient.queue.js.map +1 -1
- package/dist/boot/apply.d.ts +1 -13
- package/dist/boot/apply.d.ts.map +1 -1
- package/dist/boot/apply.js +3 -15
- package/dist/boot/apply.js.map +1 -1
- package/dist/boot/auth.d.ts +6 -16
- package/dist/boot/auth.d.ts.map +1 -1
- package/dist/boot/boot.d.ts +5 -18
- package/dist/boot/boot.d.ts.map +1 -1
- package/dist/boot/boot.js +4 -11
- package/dist/boot/boot.js.map +1 -1
- package/dist/boot/bootstrap.d.ts.map +1 -1
- package/dist/boot/bootstrap.js +106 -163
- package/dist/boot/bootstrap.js.map +1 -1
- package/dist/boot/card.d.ts +5 -0
- package/dist/boot/card.d.ts.map +1 -0
- package/dist/boot/card.js +71 -0
- package/dist/boot/card.js.map +1 -0
- package/dist/boot/frame.d.ts +8 -32
- package/dist/boot/frame.d.ts.map +1 -1
- package/dist/boot/frame.js +23 -57
- package/dist/boot/frame.js.map +1 -1
- package/dist/boot/hosted.d.ts +3 -19
- package/dist/boot/hosted.d.ts.map +1 -1
- package/dist/boot/hosted.js +12 -17
- package/dist/boot/hosted.js.map +1 -1
- package/dist/boot/ownership.d.ts +5 -36
- package/dist/boot/ownership.d.ts.map +1 -1
- package/dist/boot/ownership.js +9 -49
- package/dist/boot/ownership.js.map +1 -1
- package/dist/boot/ports.d.ts +2 -15
- package/dist/boot/ports.d.ts.map +1 -1
- package/dist/boot/ports.js +1 -14
- package/dist/boot/ports.js.map +1 -1
- package/dist/boot/remote.d.ts +5 -38
- package/dist/boot/remote.d.ts.map +1 -1
- package/dist/boot/remote.js +8 -41
- package/dist/boot/remote.js.map +1 -1
- package/dist/boot/runner.d.ts +11 -0
- package/dist/boot/runner.d.ts.map +1 -0
- package/dist/boot/runner.js +13 -0
- package/dist/boot/runner.js.map +1 -0
- package/dist/boot/seed.d.ts +5 -32
- package/dist/boot/seed.d.ts.map +1 -1
- package/dist/boot/seed.js +10 -41
- package/dist/boot/seed.js.map +1 -1
- package/dist/boot/statement-drift.d.ts +4 -22
- package/dist/boot/statement-drift.d.ts.map +1 -1
- package/dist/boot/statement-drift.js +4 -9
- package/dist/boot/statement-drift.js.map +1 -1
- package/dist/boot/together.d.ts +8 -12
- package/dist/boot/together.d.ts.map +1 -1
- package/dist/boot/together.js +28 -65
- package/dist/boot/together.js.map +1 -1
- package/dist/boot/types.d.ts +36 -180
- package/dist/boot/types.d.ts.map +1 -1
- package/dist/builtin/config.d.ts +7 -0
- package/dist/builtin/config.d.ts.map +1 -0
- package/dist/builtin/config.js +15 -0
- package/dist/builtin/config.js.map +1 -0
- package/dist/{builtins → builtin}/logger.d.ts +4 -25
- package/dist/builtin/logger.d.ts.map +1 -0
- package/dist/{builtins → builtin}/logger.js +5 -32
- package/dist/builtin/logger.js.map +1 -0
- package/dist/config-loader.d.ts +9 -67
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +5 -18
- package/dist/config-loader.js.map +1 -1
- package/dist/contract.d.ts +13 -31
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +10 -26
- package/dist/contract.js.map +1 -1
- package/dist/crypto/encoding.d.ts +2 -15
- package/dist/crypto/encoding.d.ts.map +1 -1
- package/dist/crypto/encoding.js +2 -15
- package/dist/crypto/encoding.js.map +1 -1
- package/dist/crypto/node.d.ts.map +1 -1
- package/dist/crypto/node.js +1 -7
- package/dist/crypto/node.js.map +1 -1
- package/dist/crypto/port.d.ts +2 -18
- package/dist/crypto/port.d.ts.map +1 -1
- package/dist/crypto/port.js +1 -17
- package/dist/crypto/port.js.map +1 -1
- package/dist/crypto/webcrypto.d.ts.map +1 -1
- package/dist/crypto/webcrypto.js +1 -12
- package/dist/crypto/webcrypto.js.map +1 -1
- package/dist/declare.d.ts +41 -0
- package/dist/declare.d.ts.map +1 -0
- package/dist/{scan/declare.js → declare.js} +6 -31
- package/dist/declare.js.map +1 -0
- package/dist/define.d.ts +2 -3
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +2 -3
- package/dist/define.js.map +1 -1
- package/dist/descriptor/Fronds.d.ts +19 -0
- package/dist/descriptor/Fronds.d.ts.map +1 -0
- package/dist/descriptor/Fronds.js +40 -0
- package/dist/descriptor/Fronds.js.map +1 -0
- package/dist/descriptor/frond.d.ts +135 -0
- package/dist/descriptor/frond.d.ts.map +1 -0
- package/dist/{scan → descriptor}/frond.js.map +1 -1
- package/dist/dispatch/ArgumentResolver.d.ts +6 -3
- package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
- package/dist/dispatch/ArgumentResolver.js +48 -3
- package/dist/dispatch/ArgumentResolver.js.map +1 -1
- package/dist/dispatch/DispatchEvent.d.ts +2 -2
- package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
- package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
- package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
- package/dist/dispatch/DispatchLifecycle.js +1 -7
- package/dist/dispatch/DispatchLifecycle.js.map +1 -1
- package/dist/dispatch/DispatchPort.d.ts +1 -1
- package/dist/dispatch/DispatchPort.d.ts.map +1 -1
- package/dist/dispatch/Dispatcher.d.ts +1 -1
- package/dist/dispatch/Dispatcher.d.ts.map +1 -1
- package/dist/dispatch/Dispatcher.js +2 -2
- package/dist/dispatch/Dispatcher.js.map +1 -1
- package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
- package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
- package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
- package/dist/dispatch/HandlerFacade.js.map +1 -0
- package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
- package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
- package/dist/dispatch/LocalRoutePolicy.js +4 -4
- package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
- package/dist/dispatch/OperationRoute.d.ts +2 -2
- package/dist/dispatch/OperationRoute.d.ts.map +1 -1
- package/dist/dispatch/OutputView.d.ts +3 -2
- package/dist/dispatch/OutputView.d.ts.map +1 -1
- package/dist/dispatch/OutputView.js +19 -1
- package/dist/dispatch/OutputView.js.map +1 -1
- package/dist/dispatch/Route.d.ts +2 -3
- package/dist/dispatch/Route.d.ts.map +1 -1
- package/dist/dispatch/RoutePolicy.d.ts +1 -1
- package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
- package/dist/dispatch/RouteRegistry.d.ts +1 -1
- package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
- package/dist/dispatch/RouteRegistry.js +2 -2
- package/dist/dispatch/RouteRegistry.js.map +1 -1
- package/dist/dispatch/RouteResolver.d.ts +2 -4
- package/dist/dispatch/RouteResolver.d.ts.map +1 -1
- package/dist/dispatch/StorageGuard.d.ts +9 -8
- package/dist/dispatch/StorageGuard.d.ts.map +1 -1
- package/dist/dispatch/StorageGuard.js +66 -23
- package/dist/dispatch/StorageGuard.js.map +1 -1
- package/dist/dispatch/presenterArguments.d.ts +7 -0
- package/dist/dispatch/presenterArguments.d.ts.map +1 -0
- package/dist/dispatch/presenterArguments.js +12 -0
- package/dist/dispatch/presenterArguments.js.map +1 -0
- package/dist/dispatch/remoteRoutes.d.ts +7 -0
- package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
- package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
- package/dist/dispatch/remoteRoutes.js.map +1 -0
- package/dist/dispatch/routeNotFound.d.ts +9 -0
- package/dist/dispatch/routeNotFound.d.ts.map +1 -0
- package/dist/dispatch/routeNotFound.js +21 -0
- package/dist/dispatch/routeNotFound.js.map +1 -0
- package/dist/dispatch/validateInput.d.ts +5 -0
- package/dist/dispatch/validateInput.d.ts.map +1 -0
- package/dist/dispatch/validateInput.js +20 -0
- package/dist/dispatch/validateInput.js.map +1 -0
- package/dist/effective-operation.d.ts +6 -3
- package/dist/effective-operation.d.ts.map +1 -1
- package/dist/effective-operation.js +49 -27
- package/dist/effective-operation.js.map +1 -1
- package/dist/emit.d.ts +4 -42
- package/dist/emit.d.ts.map +1 -1
- package/dist/emit.js +3 -39
- package/dist/emit.js.map +1 -1
- package/dist/entry/facade.d.ts +8 -0
- package/dist/entry/facade.d.ts.map +1 -0
- package/dist/entry/facade.js +28 -0
- package/dist/entry/facade.js.map +1 -0
- package/dist/entry/transport.d.ts +5 -0
- package/dist/entry/transport.d.ts.map +1 -0
- package/dist/entry/transport.js +11 -0
- package/dist/entry/transport.js.map +1 -0
- package/dist/frond-config.d.ts +8 -71
- package/dist/frond-config.d.ts.map +1 -1
- package/dist/frond-config.js +1 -9
- 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/identity-keys.d.ts +2 -5
- package/dist/identity-keys.d.ts.map +1 -1
- package/dist/identity-keys.js +3 -16
- package/dist/identity-keys.js.map +1 -1
- package/dist/identity.d.ts +4 -30
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +11 -73
- package/dist/identity.js.map +1 -1
- package/dist/imports.d.ts +2 -8
- package/dist/imports.d.ts.map +1 -1
- package/dist/imports.js +1 -7
- package/dist/imports.js.map +1 -1
- package/dist/index.d.ts +28 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -22
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -8
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +1 -8
- package/dist/loader.js.map +1 -1
- package/dist/node.d.ts +2 -11
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2 -11
- package/dist/node.js.map +1 -1
- package/dist/prefab/collector.d.ts +1 -22
- package/dist/prefab/collector.d.ts.map +1 -1
- package/dist/prefab/collector.js +1 -22
- package/dist/prefab/collector.js.map +1 -1
- package/dist/prefab/crud.d.ts +19 -35
- package/dist/prefab/crud.d.ts.map +1 -1
- package/dist/prefab/crud.js +39 -66
- package/dist/prefab/crud.js.map +1 -1
- package/dist/prefab/mirror.d.ts +5 -27
- package/dist/prefab/mirror.d.ts.map +1 -1
- package/dist/prefab/mirror.js +6 -24
- package/dist/prefab/mirror.js.map +1 -1
- package/dist/prefab/prefab.d.ts +1 -7
- package/dist/prefab/prefab.d.ts.map +1 -1
- package/dist/prefab/prefab.js +1 -7
- package/dist/prefab/prefab.js.map +1 -1
- package/dist/prefab/presenter.d.ts +2 -36
- package/dist/prefab/presenter.d.ts.map +1 -1
- package/dist/prefab/presenter.js +2 -36
- package/dist/prefab/presenter.js.map +1 -1
- package/dist/prefab/repository.d.ts +12 -80
- package/dist/prefab/repository.d.ts.map +1 -1
- package/dist/prefab/repository.js +22 -35
- package/dist/prefab/repository.js.map +1 -1
- package/dist/scan/adapters.d.ts +3 -0
- package/dist/scan/adapters.d.ts.map +1 -0
- package/dist/scan/adapters.js +25 -0
- package/dist/scan/adapters.js.map +1 -0
- package/dist/scan/bundling.d.ts +1 -12
- package/dist/scan/bundling.d.ts.map +1 -1
- package/dist/scan/bundling.js +1 -12
- package/dist/scan/bundling.js.map +1 -1
- package/dist/scan/conventions.d.ts +6 -40
- package/dist/scan/conventions.d.ts.map +1 -1
- package/dist/scan/conventions.js +5 -34
- package/dist/scan/conventions.js.map +1 -1
- package/dist/scan/emit.d.ts +2 -6
- package/dist/scan/emit.d.ts.map +1 -1
- package/dist/scan/emit.js +5 -39
- package/dist/scan/emit.js.map +1 -1
- package/dist/scan/handler-parser.d.ts +9 -76
- package/dist/scan/handler-parser.d.ts.map +1 -1
- package/dist/scan/handler-parser.js +28 -85
- package/dist/scan/handler-parser.js.map +1 -1
- package/dist/scan/result.d.ts +28 -0
- package/dist/scan/result.d.ts.map +1 -0
- package/dist/scan/result.js +2 -0
- package/dist/scan/result.js.map +1 -0
- package/dist/scan/scanner.d.ts +3 -28
- package/dist/scan/scanner.d.ts.map +1 -1
- package/dist/scan/scanner.js +36 -135
- package/dist/scan/scanner.js.map +1 -1
- package/dist/scan/statement.d.ts +1 -1
- package/dist/scan/statement.d.ts.map +1 -1
- package/dist/scan/statement.js +4 -30
- package/dist/scan/statement.js.map +1 -1
- package/dist/source.d.ts +41 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +10 -0
- package/dist/source.js.map +1 -0
- package/dist/storage.d.ts +92 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +50 -0
- package/dist/storage.js.map +1 -0
- package/dist/store.d.ts +18 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +146 -0
- package/dist/store.js.map +1 -0
- package/dist/verify.d.ts +6 -39
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +19 -39
- package/dist/verify.js.map +1 -1
- package/dist/wire/CallLog.d.ts +32 -0
- package/dist/wire/CallLog.d.ts.map +1 -0
- package/dist/{contract → wire}/CallLog.js.map +1 -1
- package/dist/wire/Invocation.d.ts +32 -0
- package/dist/wire/Invocation.d.ts.map +1 -0
- package/dist/wire/Invocation.js +66 -0
- package/dist/wire/Invocation.js.map +1 -0
- package/dist/wire/RouteAddress.d.ts +24 -0
- package/dist/wire/RouteAddress.d.ts.map +1 -0
- package/dist/{contract → wire}/RouteAddress.js +7 -0
- package/dist/wire/RouteAddress.js.map +1 -0
- package/dist/wire/binding.d.ts +36 -0
- package/dist/wire/binding.d.ts.map +1 -0
- package/dist/{boot → wire}/binding.js +5 -62
- package/dist/wire/binding.js.map +1 -0
- package/dist/wire/call.d.ts +25 -172
- package/dist/wire/call.d.ts.map +1 -1
- package/dist/wire/call.js +15 -166
- package/dist/wire/call.js.map +1 -1
- package/dist/wire/drift.d.ts +3 -28
- package/dist/wire/drift.d.ts.map +1 -1
- package/dist/wire/drift.js +4 -23
- package/dist/wire/drift.js.map +1 -1
- package/dist/wire/errors.d.ts +4 -24
- package/dist/wire/errors.d.ts.map +1 -1
- package/dist/wire/errors.js +4 -24
- package/dist/wire/errors.js.map +1 -1
- package/dist/wire/http-error.d.ts +2 -13
- package/dist/wire/http-error.d.ts.map +1 -1
- package/dist/wire/http-error.js +5 -19
- package/dist/wire/http-error.js.map +1 -1
- package/dist/wire/loggerMiddleware.d.ts +2 -8
- package/dist/wire/loggerMiddleware.d.ts.map +1 -1
- package/dist/wire/loggerMiddleware.js +1 -7
- package/dist/wire/loggerMiddleware.js.map +1 -1
- package/dist/wire/middleware.d.ts +3 -7
- package/dist/wire/middleware.d.ts.map +1 -1
- package/dist/wire/middleware.js +1 -5
- package/dist/wire/middleware.js.map +1 -1
- package/dist/wire/operation.d.ts +12 -74
- package/dist/wire/operation.d.ts.map +1 -1
- package/dist/wire/operation.js +4 -66
- package/dist/wire/operation.js.map +1 -1
- package/dist/wire/signature.d.ts +37 -0
- package/dist/wire/signature.d.ts.map +1 -0
- package/dist/wire/signature.js +2 -0
- package/dist/wire/signature.js.map +1 -0
- package/package.json +3 -3
- package/src/boot/Emissions.ts +22 -119
- package/src/boot/ambient-port.ts +3 -24
- package/src/boot/ambient.als.ts +7 -12
- package/src/boot/ambient.queue.ts +2 -5
- package/src/boot/apply.ts +3 -15
- package/src/boot/auth.ts +6 -16
- package/src/boot/boot.ts +8 -23
- package/src/boot/bootstrap.ts +117 -173
- package/src/boot/card.ts +84 -0
- package/src/boot/frame.ts +31 -65
- package/src/boot/hosted.ts +15 -40
- package/src/boot/ownership.ts +14 -49
- package/src/boot/ports.ts +2 -15
- package/src/boot/remote.ts +11 -58
- package/src/boot/runner.ts +17 -0
- package/src/boot/seed.ts +11 -42
- package/src/boot/statement-drift.ts +10 -28
- package/src/boot/together.ts +38 -72
- package/src/boot/types.ts +36 -180
- package/src/{builtins → builtin}/config.ts +1 -7
- package/src/{builtins → builtin}/logger.ts +6 -39
- package/src/config-loader.ts +12 -71
- package/src/contract.ts +15 -39
- package/src/crypto/encoding.ts +2 -15
- package/src/crypto/node.ts +1 -7
- package/src/crypto/port.ts +2 -18
- package/src/crypto/webcrypto.ts +1 -12
- package/src/{scan/declare.ts → declare.ts} +11 -42
- package/src/define.ts +2 -3
- package/src/descriptor/Fronds.ts +47 -0
- package/src/descriptor/frond.ts +145 -0
- package/src/dispatch/ArgumentResolver.ts +54 -8
- package/src/dispatch/DispatchEvent.ts +2 -2
- package/src/dispatch/DispatchLifecycle.ts +1 -7
- package/src/dispatch/DispatchPort.ts +1 -1
- package/src/dispatch/Dispatcher.ts +3 -3
- package/src/dispatch/HandlerFacade.ts +231 -0
- package/src/dispatch/LocalRoutePolicy.ts +4 -4
- package/src/dispatch/OperationRoute.ts +2 -2
- package/src/dispatch/OutputView.ts +24 -2
- package/src/dispatch/Route.ts +2 -4
- package/src/dispatch/RoutePolicy.ts +1 -1
- package/src/dispatch/RouteRegistry.ts +2 -2
- package/src/dispatch/RouteResolver.ts +2 -4
- package/src/dispatch/StorageGuard.ts +75 -23
- package/src/dispatch/presenterArguments.ts +25 -0
- package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
- package/src/dispatch/routeNotFound.ts +33 -0
- package/src/dispatch/validateInput.ts +28 -0
- package/src/effective-operation.ts +60 -37
- package/src/emit.ts +5 -63
- package/src/entry/facade.ts +44 -0
- package/src/entry/transport.ts +16 -0
- package/src/frond-config.ts +8 -71
- package/src/graph.ts +1 -1
- package/src/identity-keys.ts +3 -16
- package/src/identity.ts +12 -80
- package/src/imports.ts +3 -32
- package/src/index.ts +28 -33
- package/src/loader.ts +2 -16
- package/src/node.ts +2 -11
- package/src/prefab/collector.ts +1 -22
- package/src/prefab/crud.ts +51 -90
- package/src/prefab/mirror.ts +9 -49
- package/src/prefab/prefab.ts +2 -21
- package/src/prefab/presenter.ts +2 -36
- package/src/prefab/repository.ts +32 -108
- package/src/scan/adapters.ts +32 -0
- package/src/scan/bundling.ts +1 -12
- package/src/scan/conventions.ts +6 -40
- package/src/scan/emit.ts +7 -43
- package/src/scan/handler-parser.ts +41 -163
- package/src/scan/result.ts +29 -0
- package/src/scan/scanner.ts +40 -138
- package/src/scan/statement.ts +6 -31
- package/src/source.ts +44 -0
- package/src/storage.ts +141 -0
- package/src/store.ts +152 -0
- package/src/verify.ts +19 -60
- package/src/wire/CallLog.ts +30 -0
- package/src/{contract → wire}/Invocation.ts +24 -17
- package/src/{contract → wire}/RouteAddress.ts +10 -0
- package/src/wire/binding.ts +102 -0
- package/src/wire/call.ts +30 -261
- package/src/wire/drift.ts +5 -30
- package/src/wire/errors.ts +4 -24
- package/src/wire/http-error.ts +5 -19
- package/src/wire/loggerMiddleware.ts +2 -8
- package/src/wire/middleware.ts +3 -7
- package/src/wire/operation.ts +13 -110
- package/src/wire/signature.ts +38 -0
- package/dist/boot/HandlerFacade.d.ts.map +0 -1
- package/dist/boot/HandlerFacade.js.map +0 -1
- package/dist/boot/binding.d.ts +0 -60
- package/dist/boot/binding.d.ts.map +0 -1
- package/dist/boot/binding.js.map +0 -1
- package/dist/builtins/config.d.ts +0 -13
- package/dist/builtins/config.d.ts.map +0 -1
- package/dist/builtins/config.js +0 -21
- package/dist/builtins/config.js.map +0 -1
- package/dist/builtins/logger.d.ts.map +0 -1
- package/dist/builtins/logger.js.map +0 -1
- package/dist/contract/Call.d.ts +0 -10
- package/dist/contract/Call.d.ts.map +0 -1
- package/dist/contract/Call.js +0 -15
- package/dist/contract/Call.js.map +0 -1
- package/dist/contract/CallLog.d.ts +0 -57
- package/dist/contract/CallLog.d.ts.map +0 -1
- package/dist/contract/Invocation.d.ts +0 -27
- package/dist/contract/Invocation.d.ts.map +0 -1
- package/dist/contract/Invocation.js +0 -59
- package/dist/contract/Invocation.js.map +0 -1
- package/dist/contract/RouteAddress.d.ts +0 -17
- package/dist/contract/RouteAddress.d.ts.map +0 -1
- package/dist/contract/RouteAddress.js.map +0 -1
- package/dist/dispatch/InputValidator.d.ts +0 -7
- package/dist/dispatch/InputValidator.d.ts.map +0 -1
- package/dist/dispatch/InputValidator.js +0 -22
- package/dist/dispatch/InputValidator.js.map +0 -1
- package/dist/dispatch/OperationExecutor.d.ts +0 -25
- package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
- package/dist/dispatch/OperationExecutor.js +0 -32
- package/dist/dispatch/OperationExecutor.js.map +0 -1
- package/dist/dispatch/OutputProjector.d.ts +0 -12
- package/dist/dispatch/OutputProjector.d.ts.map +0 -1
- package/dist/dispatch/OutputProjector.js +0 -30
- package/dist/dispatch/OutputProjector.js.map +0 -1
- package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
- package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
- package/dist/dispatch/PresenterArgumentResolver.js +0 -20
- package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
- package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
- package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
- package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
- package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
- package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
- package/dist/dispatch/RouteNotFoundError.js +0 -24
- package/dist/dispatch/RouteNotFoundError.js.map +0 -1
- package/dist/entry/DynamicFacade.d.ts +0 -10
- package/dist/entry/DynamicFacade.d.ts.map +0 -1
- package/dist/entry/DynamicFacade.js +0 -27
- package/dist/entry/DynamicFacade.js.map +0 -1
- package/dist/entry/FacadeEntry.d.ts +0 -11
- package/dist/entry/FacadeEntry.d.ts.map +0 -1
- package/dist/entry/FacadeEntry.js +0 -26
- package/dist/entry/FacadeEntry.js.map +0 -1
- package/dist/entry/TransportEntry.d.ts +0 -13
- package/dist/entry/TransportEntry.d.ts.map +0 -1
- package/dist/entry/TransportEntry.js +0 -24
- package/dist/entry/TransportEntry.js.map +0 -1
- package/dist/orm.d.ts +0 -207
- package/dist/orm.d.ts.map +0 -1
- package/dist/orm.js +0 -66
- package/dist/orm.js.map +0 -1
- package/dist/scan/Fronds.d.ts +0 -45
- package/dist/scan/Fronds.d.ts.map +0 -1
- package/dist/scan/Fronds.js +0 -66
- package/dist/scan/Fronds.js.map +0 -1
- package/dist/scan/declare.d.ts +0 -71
- package/dist/scan/declare.d.ts.map +0 -1
- package/dist/scan/declare.js.map +0 -1
- package/dist/scan/frond.d.ts +0 -224
- package/dist/scan/frond.d.ts.map +0 -1
- package/src/boot/HandlerFacade.ts +0 -242
- package/src/boot/binding.ts +0 -182
- package/src/contract/Call.ts +0 -18
- package/src/contract/CallLog.ts +0 -55
- package/src/dispatch/InputValidator.ts +0 -28
- package/src/dispatch/OperationExecutor.ts +0 -60
- package/src/dispatch/OutputProjector.ts +0 -32
- package/src/dispatch/PresenterArgumentResolver.ts +0 -25
- package/src/dispatch/RouteNotFoundError.ts +0 -29
- package/src/entry/DynamicFacade.ts +0 -28
- package/src/entry/FacadeEntry.ts +0 -32
- package/src/entry/TransportEntry.ts +0 -30
- package/src/orm.ts +0 -252
- package/src/scan/Fronds.ts +0 -73
- package/src/scan/frond.ts +0 -235
- /package/dist/{scan → descriptor}/frond.js +0 -0
- /package/dist/{contract → wire}/CallLog.js +0 -0
package/src/wire/call.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Call contract — a frond call is a value.
|
|
3
|
-
*
|
|
4
|
-
* (frond, entity, op, invocation) → result, or a thrown FougereError.
|
|
5
|
-
* A transport is a function that executes this call elsewhere; the local
|
|
6
|
-
* runner below is the reference realization. Transports move the value,
|
|
7
|
-
* they never reshape it.
|
|
8
|
-
*/
|
|
1
|
+
/** Call contract — a frond call is a value. */
|
|
9
2
|
import { Card, type SchemaDescriptor } from '@fougere/schema';
|
|
10
3
|
import { factsAnnouncedBy } from '../emit.js';
|
|
11
|
-
import type
|
|
4
|
+
import { Invocation, type InvocationContext, type PartialInvocation } from './Invocation.js';
|
|
5
|
+
import type { RouteAddress } from './RouteAddress.js';
|
|
12
6
|
import { FougereError, ErrorCode } from './errors.js';
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
|
|
8
|
+
/** One normalized request, frozen: where it goes and what the caller supplied. */
|
|
9
|
+
export class Call {
|
|
10
|
+
readonly address: RouteAddress;
|
|
11
|
+
readonly invocation: Invocation;
|
|
12
|
+
|
|
13
|
+
constructor(address: RouteAddress, invocation?: PartialInvocation) {
|
|
14
|
+
this.address = address;
|
|
15
|
+
this.invocation = Invocation.from(invocation);
|
|
16
|
+
Object.freeze(this);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
/** Target of a call — which façade operation, wherever it lives. */
|
|
17
21
|
export interface FrondCall {
|
|
@@ -27,49 +31,27 @@ export interface FrondCall {
|
|
|
27
31
|
export type Transport = (call: FrondCall, invocation: InvocationContext) => Promise<unknown>;
|
|
28
32
|
|
|
29
33
|
/** Reserved namespace — calls the runner answers itself, never a façade. */
|
|
30
|
-
/**
|
|
31
|
-
* What a receiver accepts before it stops reading a body.
|
|
32
|
-
*
|
|
33
|
-
* Stated once because it was stated FOUR times — `transport/http/policy.ts` said so in its
|
|
34
|
-
* own comment ("spelled in four packages") while three doors kept their own literal, so
|
|
35
|
-
* raising the cap here used to leave three of them refusing at the old one.
|
|
36
|
-
*
|
|
37
|
-
* `@fougere/http` keeps a fourth copy on purpose: it declares no Fougere dependency at all,
|
|
38
|
-
* and giving a leaf port a dependency on the kernel to share a number is the wrong trade.
|
|
39
|
-
*/
|
|
34
|
+
/** What a receiver accepts before it stops reading an input. */
|
|
40
35
|
export const MAX_BODY_BYTES = 1024 * 1024;
|
|
41
36
|
|
|
42
37
|
export const RPC_ENTITY = 'rpc';
|
|
43
38
|
|
|
44
|
-
/**
|
|
45
|
-
* What an `rpc` op answers — the door for what the app says about ITSELF, never about a row.
|
|
46
|
-
*
|
|
47
|
-
* `discover` is core's own, registered like any other (`bootstrap.ts`): a package declares
|
|
48
|
-
* its reading beside it, and an app that installed none serves none.
|
|
49
|
-
*/
|
|
39
|
+
/** What an `rpc` op answers — the door for what the app says about ITSELF, never about a row. */
|
|
50
40
|
export type RpcAnswer = (invocation: InvocationContext, surface?: string) => unknown;
|
|
51
41
|
|
|
52
|
-
/**
|
|
53
|
-
* Everything a caller's envelope covers — the call as the sender meant it.
|
|
54
|
-
*
|
|
55
|
-
* Here and not beside the signing code because it is a CONTRACT: the sender binds it,
|
|
56
|
-
* the receiver re-presents what arrived, and a frond written in another language reads
|
|
57
|
-
* this shape without reading our crypto. `body` is bound by digest (arbitrary, possibly
|
|
58
|
-
* large), the rest by value — which is what keeps a canonical-JSON dependency out.
|
|
59
|
-
*/
|
|
42
|
+
/** Everything a caller's envelope covers — the call as the sender meant it. */
|
|
60
43
|
export interface SignedCall {
|
|
61
44
|
entity: string;
|
|
62
45
|
op: string;
|
|
63
46
|
params?: Record<string, unknown>;
|
|
64
47
|
query?: Record<string, unknown>;
|
|
65
|
-
|
|
48
|
+
input?: unknown;
|
|
66
49
|
state?: Record<string, unknown>;
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
/**
|
|
70
|
-
* One operation, as a stranger meets it — its name, what it is for, what it takes
|
|
71
|
-
*
|
|
72
|
-
* it just never left the process.
|
|
53
|
+
* One operation, as a stranger meets it — its name, what it is for, what it takes and whether it
|
|
54
|
+
* reads or writes.
|
|
73
55
|
*/
|
|
74
56
|
export interface CardOp {
|
|
75
57
|
name: string;
|
|
@@ -81,57 +63,21 @@ export interface CardOp {
|
|
|
81
63
|
output?: SchemaDescriptor;
|
|
82
64
|
/** `query` reads, `command` writes — the same call REST turns into GET vs POST. */
|
|
83
65
|
kind: 'query' | 'command';
|
|
84
|
-
/**
|
|
85
|
-
* How much `output` describes: one row, maybe one, many, a page, or nothing shaped.
|
|
86
|
-
* `output` alone is the shape of a ROW, so a consumer generating a signature from
|
|
87
|
-
* this card would otherwise have to guess — and `list` returning a page rather than
|
|
88
|
-
* an array is exactly the guess it would get wrong.
|
|
89
|
-
*/
|
|
66
|
+
/** How much `output` describes. */
|
|
90
67
|
cardinality?: 'one' | 'maybe' | 'many' | 'page' | 'none';
|
|
91
68
|
}
|
|
92
69
|
|
|
93
|
-
/**
|
|
94
|
-
* What an app hosts — the wire projection of its scanned fronds.
|
|
95
|
-
*
|
|
96
|
-
* Two lists per frond, and they are duals: **what you may call**, and **what you will
|
|
97
|
-
* receive**. A door is entered from outside; a fact leaves on its own.
|
|
98
|
-
*
|
|
99
|
-
* `doors` was called `entities` and the name lied: an entry is an ADDRESS, and the shape
|
|
100
|
-
* behind it is optional (`facadeKeyOf` builds its key from a handler's name, which need not
|
|
101
|
-
* be an entity's). The lie cost something real — `fougere sync` demanded a descriptor on
|
|
102
|
-
* every entry and refused whole cards over a health check.
|
|
103
|
-
*/
|
|
70
|
+
/** What an app hosts — the wire projection of its scanned fronds. */
|
|
104
71
|
export interface IdentityCard {
|
|
105
72
|
fronds: {
|
|
106
73
|
name: string;
|
|
107
74
|
doors: {
|
|
108
75
|
name: string;
|
|
109
76
|
ops: CardOp[];
|
|
110
|
-
/**
|
|
111
|
-
* The shape stored under this name — **absent when nothing is**. A handler may
|
|
112
|
-
* carry no entity (`bootstrap`: *pointing at nothing is legal*), and a door with
|
|
113
|
-
* no rows behind it is ordinary: a health check, a computation, a search across
|
|
114
|
-
* several shapes. A reader that needs the shape must say what it does without one.
|
|
115
|
-
*/
|
|
77
|
+
/** The shape stored under this name — **absent when nothing is**. */
|
|
116
78
|
schema?: SchemaDescriptor;
|
|
117
79
|
}[];
|
|
118
|
-
/**
|
|
119
|
-
* The facts this frond ANNOUNCES — one entry per `Emit<T>` its handlers inject.
|
|
120
|
-
*
|
|
121
|
-
* They carry no operation, which is why they cannot ride in `doors`: the rule there is
|
|
122
|
-
* *hosting means answering*, and an entity with no façade is excluded on purpose (it
|
|
123
|
-
* would publish the auth tables to anyone who asks). A fact is the opposite case —
|
|
124
|
-
* someone WROTE that it leaves, so publishing its shape is honouring a statement, not
|
|
125
|
-
* leaking one.
|
|
126
|
-
*
|
|
127
|
-
* Without this, a fact stopped at the repository boundary: `remotes:` gives the
|
|
128
|
-
* location, colocation gives the contract, and across two repositories there is no
|
|
129
|
-
* colocation. The subscriber had to hand-copy the emitter's declaration.
|
|
130
|
-
*
|
|
131
|
-
* `schema` is absent when the announced type is not a declared entity — legal (nothing
|
|
132
|
-
* requires a fact to be one) and worth saying rather than hiding: the name travels, the
|
|
133
|
-
* shape does not, and a consumer can see exactly that.
|
|
134
|
-
*/
|
|
80
|
+
/** The facts this frond ANNOUNCES — one entry per `Emit<T>` its handlers inject. */
|
|
135
81
|
facts: { name: string; schema?: SchemaDescriptor }[];
|
|
136
82
|
}[];
|
|
137
83
|
}
|
|
@@ -152,17 +98,7 @@ export interface Edge {
|
|
|
152
98
|
errors: number;
|
|
153
99
|
}
|
|
154
100
|
|
|
155
|
-
/**
|
|
156
|
-
* The shape of the system as ONE process discovered it — the answer to `rpc.topology`.
|
|
157
|
-
*
|
|
158
|
-
* Here and not in the package that produces it, for the reason `SignedCall` is here: it
|
|
159
|
-
* crosses a process boundary, so a reader consumes it without depending on the producer.
|
|
160
|
-
* `@fougere/observability` fills it; a panel reads it; neither imports the other.
|
|
161
|
-
*
|
|
162
|
-
* Nothing in it is declared — a frond is `local` because this process scanned it, `remote`
|
|
163
|
-
* because it answered a call nobody here hosts. `remotes:` states an intent, and the two
|
|
164
|
-
* disagree exactly when something is misconfigured.
|
|
165
|
-
*/
|
|
101
|
+
/** The shape of the system as ONE process discovered it — the answer to `rpc.topology`. */
|
|
166
102
|
export interface TopologyReport {
|
|
167
103
|
/** When this process started counting — an edge count is read against it. */
|
|
168
104
|
since: number;
|
|
@@ -172,18 +108,7 @@ export interface TopologyReport {
|
|
|
172
108
|
edges: Edge[];
|
|
173
109
|
}
|
|
174
110
|
|
|
175
|
-
/**
|
|
176
|
-
* The shape a card must have to be walked — `fronds`, and each frond's `doors`.
|
|
177
|
-
*
|
|
178
|
-
* A card crosses a process boundary, so it is judged like anything else that does.
|
|
179
|
-
* The check lives beside the type because two readers walk it: the boot indexes a
|
|
180
|
-
* remote's doors, and `fougere sync` writes classes from them. `TypeError:
|
|
181
|
-
* card.fronds is not iterable` was what a malformed card produced at the boot,
|
|
182
|
-
* naming neither the remote nor the address.
|
|
183
|
-
*
|
|
184
|
-
* The descriptor behind a door is NOT checked here — `Card.toSchema` refuses it, and
|
|
185
|
-
* only where one is consumed.
|
|
186
|
-
*/
|
|
111
|
+
/** The shape a card must have to be walked — `fronds`, and each frond's `doors`. */
|
|
187
112
|
export function assertIdentityCard(value: unknown, source: string): IdentityCard {
|
|
188
113
|
const card = value as IdentityCard | undefined;
|
|
189
114
|
const fronds = Array.isArray(card?.fronds) ? card.fronds : undefined;
|
|
@@ -206,176 +131,20 @@ function cardRefusal(source: string, what: string): FougereError {
|
|
|
206
131
|
}
|
|
207
132
|
|
|
208
133
|
/** A façade as the runtime holds it: op names to functions, nothing typed about them. */
|
|
209
|
-
type AnyFacade = Record<string, (invocation?: InvocationContext) => Promise<unknown>>;
|
|
210
134
|
|
|
211
|
-
/**
|
|
212
|
-
* The door built in front of a handler — the framework's second port, after `EntityOrm`.
|
|
213
|
-
*
|
|
214
|
-
* `Facade<PostHandler>` is what a neighbouring frond injects. It names what ARRIVES
|
|
215
|
-
* rather than what is written: never the handler (nobody injects it, and its methods take
|
|
216
|
-
* positional arguments), but the door, whose every op takes the invocation and whose
|
|
217
|
-
* implementation is the local façade or a doublure. A signature therefore says nothing
|
|
218
|
-
* about where the other frond runs, which is the whole point.
|
|
219
|
-
*
|
|
220
|
-
* `keyof T` is the right set by construction, not by approximation: the scan skips
|
|
221
|
-
* `private` and `protected` (`handler-parser.ts`) because "TypeScript already has the
|
|
222
|
-
* word for it", so a handler's public methods ARE its operations — and `keyof` excludes
|
|
223
|
-
* the rest for the same reason.
|
|
224
|
-
*/
|
|
135
|
+
/** The door built in front of a handler — the framework's second port, after `Storage`. */
|
|
225
136
|
export type Facade<T> = {
|
|
226
137
|
[K in keyof T]: T[K] extends (...args: never[]) => infer R
|
|
227
138
|
? (invocation?: InvocationContext) => R
|
|
228
139
|
: never;
|
|
229
140
|
};
|
|
230
141
|
|
|
231
|
-
/**
|
|
232
|
-
* The container key of a façade — THE one place that spells the format.
|
|
233
|
-
*
|
|
234
|
-
* A surface is a named audience, and it is a key: `handlers/public/PostHandler.ts`
|
|
235
|
-
* registers `public:postHandler` next to the default `postHandler`. The default
|
|
236
|
-
* surface is the empty key, so callers that know nothing about surfaces keep
|
|
237
|
-
* designating exactly what they designated before.
|
|
238
|
-
*
|
|
239
|
-
* Nobody outside this package builds this string: adapters ask `app.facadeFor()`,
|
|
240
|
-
* which is why an adapter can stay structurally typed and core-free.
|
|
241
|
-
*/
|
|
142
|
+
/** The container key of a façade — THE one place that spells the format. */
|
|
242
143
|
export function facadeKeyOf(entityName: string, surface?: string): string {
|
|
243
144
|
return surface ? `${surface}:${entityName}Handler` : `${entityName}Handler`;
|
|
244
145
|
}
|
|
245
146
|
|
|
246
|
-
/**
|
|
247
|
-
* Where the contracts behind a façade live — the dual of `facadeKeyOf`.
|
|
248
|
-
*
|
|
249
|
-
* The façade answers calls; it does not say what it answers. That sentence used
|
|
250
|
-
* to be true only inside `buildFacade`, so anything asking the app what it hosts
|
|
251
|
-
* got bare names. A door and its terms are registered together, under the same
|
|
252
|
-
* audience.
|
|
253
|
-
*/
|
|
147
|
+
/** Where the contracts behind a façade live — the dual of `facadeKeyOf`. */
|
|
254
148
|
export function contractsKeyOf(entityName: string, surface?: string): string {
|
|
255
149
|
return `${facadeKeyOf(entityName, surface)}:contracts`;
|
|
256
150
|
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Serialize what the app hosts, for one audience. Served on `rpc.discover`,
|
|
260
|
-
* cached by callers.
|
|
261
|
-
*
|
|
262
|
-
* Hosting means answering: an entity with no façade declares no operation, so
|
|
263
|
-
* it is not among the DOORS — publishing its shape would hand an anonymous caller
|
|
264
|
-
* the structure of tables it can never reach (the auth tables, typically), and
|
|
265
|
-
* `fougere sync` would rebuild a schema with nothing to call on it.
|
|
266
|
-
*
|
|
267
|
-
* `facts` is the one thing that shape-without-a-door rule does not cover, and the
|
|
268
|
-
* reason is the opposite of a leak: an entity nobody exposed is silent, whereas a
|
|
269
|
-
* fact was explicitly declared to leave.
|
|
270
|
-
*
|
|
271
|
-
* `surface` makes that sentence audience-aware rather than app-wide: a door
|
|
272
|
-
* answers with what IT serves. Nothing falls back to the full façade — under a
|
|
273
|
-
* named surface, an entity with no façade of its own is simply not there.
|
|
274
|
-
*/
|
|
275
|
-
export function identityCardOf(app: App, surface?: string): IdentityCard {
|
|
276
|
-
const declared = app.fronds.schemas();
|
|
277
|
-
|
|
278
|
-
return {
|
|
279
|
-
fronds: app.fronds.map((frond) => {
|
|
280
|
-
// What the frond answers to, not what it stores. This walked `frond.entities`, so a
|
|
281
|
-
// handler carrying no entity — a health check, a search across shapes — was built,
|
|
282
|
-
// served, and absent from the card: `sync` could not generate its door and a remote
|
|
283
|
-
// consumer had no way to know it existed. The boot has said "pointing at nothing is
|
|
284
|
-
// legal" since handlers became the subject; the card had not caught up.
|
|
285
|
-
const byEntity = new Map(frond.entities.map((entity) => [entity.name, entity]));
|
|
286
|
-
const addresses = [...new Set([
|
|
287
|
-
...frond.entities.map((entity) => entity.name),
|
|
288
|
-
...frond.handlers.map((handler) => handler.address),
|
|
289
|
-
])];
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
name: frond.name,
|
|
293
|
-
doors: addresses.flatMap((address) => {
|
|
294
|
-
const ops = facadeOps(app, address, surface);
|
|
295
|
-
if (ops.length === 0) return [];
|
|
296
|
-
const entity = byEntity.get(address);
|
|
297
|
-
return [{
|
|
298
|
-
name: address,
|
|
299
|
-
ops,
|
|
300
|
-
// Absent when nothing of that name is stored. A door is still a door.
|
|
301
|
-
...(entity ? { schema: Card.fromSchema(entity.entityClass, address).descriptor } : {}),
|
|
302
|
-
}];
|
|
303
|
-
}),
|
|
304
|
-
/**
|
|
305
|
-
* What leaves on its own — the same list on every surface, deliberately.
|
|
306
|
-
*
|
|
307
|
-
* A door has an audience; a fact does not. `Emit<T>` names a subject and *the
|
|
308
|
-
* number of readers is not the emitter's business* (`emit.ts`), so narrowing this
|
|
309
|
-
* by `surface` would invent an axis the primitive refuses. The consequence is
|
|
310
|
-
* stated rather than hidden: a fact's SHAPE is readable by anyone who can read the
|
|
311
|
-
* card at all. What must not be published must not be announced.
|
|
312
|
-
*/
|
|
313
|
-
facts: factsAnnouncedBy(frond.handlers).map((name) => {
|
|
314
|
-
const entityClass = declared.get(name);
|
|
315
|
-
return { name, ...(entityClass ? { schema: Card.fromSchema(entityClass, name).descriptor } : {}) };
|
|
316
|
-
}),
|
|
317
|
-
};
|
|
318
|
-
}),
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function facadeOps(app: App, entityName: string, surface?: string): CardOp[] {
|
|
323
|
-
let facade: AnyFacade;
|
|
324
|
-
try {
|
|
325
|
-
facade = app.container.resolve<AnyFacade>(facadeKeyOf(entityName, surface));
|
|
326
|
-
} catch {
|
|
327
|
-
return [];
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// The façade is the list of names; the model is the resolved terms.
|
|
331
|
-
const effective = app.operationsFor(entityName, surface);
|
|
332
|
-
if (!effective) {
|
|
333
|
-
throw new Error(
|
|
334
|
-
`Facade '${facadeKeyOf(entityName, surface)}' exists without an effective operation table.`,
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return Object.keys(facade).map((name) => {
|
|
339
|
-
const contract = effective.get(name);
|
|
340
|
-
if (!contract) {
|
|
341
|
-
throw new Error(
|
|
342
|
-
`Facade '${facadeKeyOf(entityName, surface)}' serves '${name}' without an effective contract.`,
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return {
|
|
347
|
-
name,
|
|
348
|
-
...(contract?.description && { description: contract.description }),
|
|
349
|
-
...(contract?.input && { input: Card.fromSchema(contract.input, name).descriptor }),
|
|
350
|
-
...(contract?.output && { output: Card.fromSchema(contract.output, name).descriptor }),
|
|
351
|
-
...(contract?.cardinality && { cardinality: contract.cardinality }),
|
|
352
|
-
kind: contract.kind,
|
|
353
|
-
};
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Build the local runner — the reference realization of Transport.
|
|
359
|
-
*
|
|
360
|
-
* Resolves strictly from the app's own container: a call that lands here is
|
|
361
|
-
* judged here. A miss is a typed NOT_FOUND, never a forward to another remote.
|
|
362
|
-
*/
|
|
363
|
-
export function createLocalRunner(app: App, surface?: string): Transport {
|
|
364
|
-
return createTransportEntry(app.local, surface);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Build the app runner — same judgment, but resolution follows the app's
|
|
369
|
-
* topology: local façades and remote doublures alike. This is the runner
|
|
370
|
-
* an app's own entry points (browser endpoint, bridges) stand on.
|
|
371
|
-
*
|
|
372
|
-
* `surface` is the audience this runner serves, and it belongs to the DOOR that
|
|
373
|
-
* builds the runner, never to the call: a caller cannot name its own audience
|
|
374
|
-
* any more than it can name its own identity (`state` is stamped server-side
|
|
375
|
-
* for the same reason). Reaching the admin door IS the proof. So `FrondCall`
|
|
376
|
-
* gains nothing and the wire format gains nothing — a remote frond's audience
|
|
377
|
-
* is simply which URL `remotes:` points at.
|
|
378
|
-
*/
|
|
379
|
-
export function createAppRunner(app: App, surface?: string): Transport {
|
|
380
|
-
return createTransportEntry(app, surface);
|
|
381
|
-
}
|
package/src/wire/drift.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { Card, type Change, type SchemaDescriptor } from '@fougere/schema';
|
|
2
2
|
import type { IdentityCard } from './call.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* What separates the copy a consumer holds from what the producer actually serves.
|
|
6
|
-
*
|
|
7
|
-
* It lives beside `IdentityCard` and not in `@fougere/testing` for the reason the card
|
|
8
|
-
* itself does: the subject is the card, and a second reader arrived — the dev panel, which
|
|
9
|
-
* must not drag a 426 KB faker in to compare two of them.
|
|
10
|
-
*/
|
|
4
|
+
/** What separates the copy a consumer holds from what the producer actually serves. */
|
|
11
5
|
export interface CardDrift {
|
|
12
6
|
frond: string;
|
|
13
7
|
/** A door the consumer calls that the producer no longer serves. */
|
|
@@ -41,26 +35,13 @@ function factsOf(card: IdentityCard, frond: string): Map<string, SchemaDescripto
|
|
|
41
35
|
return found;
|
|
42
36
|
}
|
|
43
37
|
|
|
44
|
-
/**
|
|
45
|
-
* What a consumer's synced copy no longer matches in what the producer serves.
|
|
46
|
-
*
|
|
47
|
-
* The gap TypeScript cannot see, and the only place the gradient genuinely lies: the code
|
|
48
|
-
* is identical in-process and split, but one side may have aged. `fougere sync` wrote the
|
|
49
|
-
* consumer's copy three weeks ago, the producer moved on, and it still compiles —
|
|
50
|
-
* production is where that is found today. This is what Pact sells; the material was
|
|
51
|
-
* already here, in `rpc.discover` and in `Card.diff`.
|
|
52
|
-
*
|
|
53
|
-
* Read in ONE direction on purpose: what the consumer holds, checked against what is
|
|
54
|
-
* served. A producer serving MORE than the consumer knows is not drift — it is a producer
|
|
55
|
-
* that moved forward without breaking anyone, which is the whole point of the order the
|
|
56
|
-
* repo already states (re-sync the readers, then deploy the sender).
|
|
57
|
-
*/
|
|
38
|
+
/** What a consumer's synced copy no longer matches in what the producer serves. */
|
|
58
39
|
export function driftOf(mine: IdentityCard, theirs: IdentityCard, frond: string): CardDrift {
|
|
59
|
-
const
|
|
40
|
+
const mineDoors = doorsOf(mine, frond);
|
|
60
41
|
const served = doorsOf(theirs, frond);
|
|
61
42
|
const drift: CardDrift = { frond, missingDoors: [], missingOps: [], shapes: [], facts: [] };
|
|
62
43
|
|
|
63
|
-
for (const [name, door] of
|
|
44
|
+
for (const [name, door] of mineDoors) {
|
|
64
45
|
const there = served.get(name);
|
|
65
46
|
if (!there) { drift.missingDoors.push(name); continue; }
|
|
66
47
|
|
|
@@ -97,13 +78,7 @@ export function agrees(drift: CardDrift): boolean {
|
|
|
97
78
|
&& drift.facts.length === 0;
|
|
98
79
|
}
|
|
99
80
|
|
|
100
|
-
/**
|
|
101
|
-
* The drift, in the words a deploy needs.
|
|
102
|
-
*
|
|
103
|
-
* A fact says the order out loud, because the repo already states it as a rule and
|
|
104
|
-
* nothing enforced it: a fact is judged strictly, so a reader that has not been re-synced
|
|
105
|
-
* refuses what the sender now announces.
|
|
106
|
-
*/
|
|
81
|
+
/** The drift, in the words a deploy needs. */
|
|
107
82
|
export function explain(drift: CardDrift): string[] {
|
|
108
83
|
const lines: string[] = [];
|
|
109
84
|
for (const door of drift.missingDoors) lines.push(`${drift.frond}.${door} — you call it, it is not served`);
|
package/src/wire/errors.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The error vocabulary — what a refusal IS, independently of who hears it.
|
|
3
|
-
*
|
|
4
|
-
* It travels on the wire (`toJSON`/`fromJSON`) and through the browser-safe
|
|
5
|
-
* `@fougere/core/contract`, so nothing here may know about HTTP, a logger, or a
|
|
6
|
-
* middleware chain. Its HTTP reading is one file over, in `http-error.ts`; it used
|
|
7
|
-
* to live in `middleware.ts`, which named the one concept this is not.
|
|
8
|
-
*/
|
|
1
|
+
/** The error vocabulary — what a refusal IS, independently of who hears it. */
|
|
9
2
|
|
|
10
3
|
import type { ValidationError } from '@fougere/schema';
|
|
11
4
|
|
|
@@ -79,12 +72,7 @@ export class FougereError extends Error {
|
|
|
79
72
|
};
|
|
80
73
|
}
|
|
81
74
|
|
|
82
|
-
/**
|
|
83
|
-
* Dual of toJSON — rebuild a typed error from its wire form.
|
|
84
|
-
*
|
|
85
|
-
* Wire input is untrusted: an unknown code degrades to INTERNAL_ERROR
|
|
86
|
-
* (original code kept in details) instead of forging a fake semantic code.
|
|
87
|
-
*/
|
|
75
|
+
/** Dual of toJSON — rebuild a typed error from its wire form. */
|
|
88
76
|
static fromJSON(json: unknown): FougereError {
|
|
89
77
|
const raw = (typeof json === 'object' && json !== null ? json : {}) as Record<string, unknown>;
|
|
90
78
|
const known = Object.values(ErrorCode).includes(raw.code as ErrorCode);
|
|
@@ -99,16 +87,8 @@ export class FougereError extends Error {
|
|
|
99
87
|
}
|
|
100
88
|
|
|
101
89
|
/**
|
|
102
|
-
* The refusals behind a VALIDATION_FAILED, or nothing — the ONE place that reads
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* `details` is `unknown` because it is genuinely polymorphic: `StorageGuard.judge` puts a
|
|
106
|
-
* `string[]` there under INTERNAL_ERROR, `fromJSON` puts `{ originalCode, details }`
|
|
107
|
-
* there for a code it does not know. So the shape is not the field's, it is a reading
|
|
108
|
-
* of the PAIR (code, details) — which is why this is a reader and not a narrower type.
|
|
109
|
-
*
|
|
110
|
-
* It judges rather than casts: five call sites asserted `{ path, message }[]` by hand,
|
|
111
|
-
* and a malformed VALIDATION_FAILED would have been accepted as structured refusals.
|
|
90
|
+
* The refusals behind a VALIDATION_FAILED, or nothing — the ONE place that reads `details` under
|
|
91
|
+
* that code.
|
|
112
92
|
*/
|
|
113
93
|
export function validationErrorsOf(error: unknown): ValidationError[] | undefined {
|
|
114
94
|
if (!(error instanceof FougereError) || error.code !== ErrorCode.VALIDATION_FAILED) return undefined;
|
package/src/wire/http-error.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP reading of an error — used by HTTP bridges (REST, Next, Inertia).
|
|
3
|
-
*
|
|
4
|
-
* Not imported by GraphQL, CLI, or event bus bridges. The vocabulary it projects
|
|
5
|
-
* is in `errors.ts` and knows nothing of this file.
|
|
6
|
-
*/
|
|
1
|
+
/** HTTP reading of an error — used by HTTP bridges (REST, Next, Inertia). */
|
|
7
2
|
import { FougereError, ErrorCode } from './errors.js';
|
|
8
|
-
import { Logger } from '../
|
|
3
|
+
import { Logger } from '../builtin/logger.js';
|
|
9
4
|
/**
|
|
10
|
-
* An INTERNAL_ERROR is the one class of error whose message never leaves: it was not
|
|
11
|
-
*
|
|
12
|
-
* masking it *silently* is how a bug becomes unobservable — the operator loses the same
|
|
13
|
-
* sentence the attacker does. So the mask and the record live in one function: whoever
|
|
14
|
-
* calls `toPublicError` cannot forget the half that keeps the error findable.
|
|
5
|
+
* An INTERNAL_ERROR is the one class of error whose message never leaves: it was not written for a
|
|
6
|
+
* caller and may quote a path, a query or a row.
|
|
15
7
|
*/
|
|
16
8
|
const log = new Logger('error');
|
|
17
9
|
|
|
@@ -42,13 +34,7 @@ function httpStatusFor(code: ErrorCode): number {
|
|
|
42
34
|
return HTTP_STATUS[code] ?? 500;
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
/**
|
|
46
|
-
* Serialize an application error for an untrusted caller.
|
|
47
|
-
*
|
|
48
|
-
* Every code but INTERNAL_ERROR was written for the caller and travels whole. An
|
|
49
|
-
* INTERNAL_ERROR is replaced by a constant — and logged here, with its cause, so the
|
|
50
|
-
* sentence exists exactly once: on the server.
|
|
51
|
-
*/
|
|
37
|
+
/** Serialize an application error for an untrusted caller. */
|
|
52
38
|
export function toPublicError(err: FougereError): ReturnType<FougereError['toJSON']> {
|
|
53
39
|
if (err.code !== ErrorCode.INTERNAL_ERROR) return err.toJSON();
|
|
54
40
|
const where = [err.entity, err.operation].filter(Boolean).join('.');
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
* Logger middleware — logs every operation with timing.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppMiddleware } from './middleware.js';
|
|
5
|
-
import type { Logger } from '../
|
|
5
|
+
import type { Logger } from '../builtin/logger.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Create a logger middleware that logs operation entry, exit, and errors.
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* app.use(loggerMiddleware(app.resolve('Logger')))
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
7
|
+
/** Create a logger middleware that logs operation entry, exit, and errors. */
|
|
14
8
|
export function loggerMiddleware(logger: Logger): AppMiddleware {
|
|
15
9
|
return async (ctx, next) => {
|
|
16
10
|
const start = performance.now();
|
package/src/wire/middleware.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* App-level middleware — intercepts handler facade operations.
|
|
3
|
-
*
|
|
4
|
-
* Works regardless of entry point (HTTP, Nitro, event bus, CLI, tests).
|
|
5
|
-
*/
|
|
1
|
+
/** App-level middleware — intercepts handler facade operations. */
|
|
6
2
|
|
|
7
3
|
// ── Types ───────────────────────────────────────
|
|
8
4
|
export interface OperationContext {
|
|
@@ -19,8 +15,8 @@ export interface OperationContext {
|
|
|
19
15
|
args: unknown[];
|
|
20
16
|
/** Extensible bag — middlewares deposit data here (user, permissions, etc.). */
|
|
21
17
|
state: Record<string, unknown>;
|
|
22
|
-
/** Transport-agnostic invocation context (params, query,
|
|
23
|
-
invocation?: import('../
|
|
18
|
+
/** Transport-agnostic invocation context (params, query, input, state). */
|
|
19
|
+
invocation?: import('../wire/Invocation.js').InvocationContext;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
export type AppNext = () => Promise<unknown>;
|