@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/config-loader.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import type { AuthConfig } from './boot/auth.js';
|
|
4
|
-
import type { LogLevel } from './
|
|
4
|
+
import type { LogLevel } from './builtin/logger.js';
|
|
5
5
|
import type { ConventionsInput } from './scan/conventions.js';
|
|
6
6
|
import { getModuleLoader } from './loader.js';
|
|
7
7
|
|
|
@@ -10,68 +10,22 @@ import { getModuleLoader } from './loader.js';
|
|
|
10
10
|
export interface FougereConfig {
|
|
11
11
|
/** Database configuration — the DEFAULT source, the one an entity lands in unnamed. */
|
|
12
12
|
db?: 'sqlite' | { dialect: 'sqlite'; path?: string } | false;
|
|
13
|
-
/**
|
|
14
|
-
* The other places rows live — a name, an engine, and the entities it holds.
|
|
15
|
-
*
|
|
16
|
-
* A fact about the APP, stated beside `remotes:` because it is the same kind of
|
|
17
|
-
* statement: `remotes:` says where a CALL goes, this says where a ROW is. Neither
|
|
18
|
-
* belongs on the entity, which describes itself and not its deployment.
|
|
19
|
-
*
|
|
20
|
-
* Only the exception is declared: everything unnamed stays in `db`. Membership is
|
|
21
|
-
* per ENTITY rather than per frond — two fronds may share a database, and one frond
|
|
22
|
-
* may hold entities in two — so the entity is the truth and a frond-wide shorthand
|
|
23
|
-
* waits for a case that needs it.
|
|
24
|
-
*
|
|
25
|
-
* A `ref()` across two sources gets no foreign key: two databases share no
|
|
26
|
-
* constraint. The DDL stops pretending rather than the `ref` being refused.
|
|
27
|
-
*/
|
|
13
|
+
/** The other places rows live — a name, an engine, and the entities it holds. */
|
|
28
14
|
sources?: Record<string, { dialect?: 'sqlite'; path?: string; entities: string[] }>;
|
|
29
15
|
/**
|
|
30
|
-
* The names the scan reads instead of deriving them — the import scope, the fronds
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Only what differs is stated. Read BEFORE the fronds are discovered, which is what
|
|
34
|
-
* lets it name the prefix they are found under: nothing in this file may import
|
|
35
|
-
* `@fronds/*`, or the name would be needed to read the file that declares it.
|
|
16
|
+
* The names the scan reads instead of deriving them — the import scope, the fronds directory,
|
|
17
|
+
* the seven convention directories.
|
|
36
18
|
*/
|
|
37
19
|
conventions?: ConventionsInput;
|
|
38
|
-
/**
|
|
39
|
-
* How much every logger says. The one key a running app CONSULTS rather than
|
|
40
|
-
* consumes, so re-reading this file changes it without rebuilding anything.
|
|
41
|
-
*
|
|
42
|
-
* `FOUGERE_LOG_LEVEL` still wins — it is how the CLI speaks, and the precedence is
|
|
43
|
-
* the usual one (CLI over config file).
|
|
44
|
-
*/
|
|
20
|
+
/** How much every logger says. */
|
|
45
21
|
logLevel?: LogLevel;
|
|
46
22
|
/** Remote fronds — frondName → base URL. */
|
|
47
23
|
remotes?: Record<string, string>;
|
|
48
|
-
/**
|
|
49
|
-
* Which realization answers which port — port class name → implementation class name.
|
|
50
|
-
*
|
|
51
|
-
* A fact about the APP, stated beside `remotes:` for the same reason `sources:` is:
|
|
52
|
-
* `remotes:` says where a CALL goes, `sources:` says where a ROW is, this says who
|
|
53
|
-
* performs an ACTION. None of the three belongs inside the frond, which describes
|
|
54
|
-
* itself and not its deployment — a `billing` frond naming Stripe would be the one
|
|
55
|
-
* thing the framework refuses.
|
|
56
|
-
*
|
|
57
|
-
* Only the exception is declared. One class extending a port answers it by
|
|
58
|
-
* convention and this key stays absent; two make the boot refuse until one is named.
|
|
59
|
-
*/
|
|
24
|
+
/** Which realization answers which port — port class name → implementation class name. */
|
|
60
25
|
ports?: Record<string, string>;
|
|
61
26
|
/** Auth declaration — picks a provider package and forwards options to it. */
|
|
62
27
|
auth?: AuthConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Which protocol adapters this app serves.
|
|
65
|
-
*
|
|
66
|
-
* A fact about the APP, declared once beside `db`, `remotes` and `auth` — not a
|
|
67
|
-
* property of whichever host runs it. Before this existed the same decision was
|
|
68
|
-
* spelled five different ways: Nuxt mounted REST unconditionally, the Web hosts
|
|
69
|
-
* served it if you happened to create a route file, and Express if you happened to
|
|
70
|
-
* call a middleware. One decision, five dialects, no canonical place.
|
|
71
|
-
*
|
|
72
|
-
* Absent means not served. The call envelope is not listed here: it is the wire the
|
|
73
|
-
* client primitives use, not a projection an app chooses to publish.
|
|
74
|
-
*/
|
|
28
|
+
/** Which protocol adapters this app serves. */
|
|
75
29
|
adapters?: AdapterConfig;
|
|
76
30
|
}
|
|
77
31
|
|
|
@@ -105,13 +59,7 @@ async function loadConfigFrom(dir: string, fresh?: boolean): Promise<FougereConf
|
|
|
105
59
|
return {};
|
|
106
60
|
}
|
|
107
61
|
|
|
108
|
-
/**
|
|
109
|
-
* Load the root fougere.config.{ts,js,mjs} from the given directory.
|
|
110
|
-
*
|
|
111
|
-
* `fresh` re-reads a file that may have changed since the last load — what a host
|
|
112
|
-
* calls when it decides to reconsider its config, and the only way `applyConfig` has
|
|
113
|
-
* anything new to apply.
|
|
114
|
-
*/
|
|
62
|
+
/** Load the root fougere.config.{ts,js,mjs} from the given directory. */
|
|
115
63
|
export async function loadConfig(root: string, options?: { fresh?: boolean }): Promise<FougereConfig> {
|
|
116
64
|
return loadConfigFrom(root, options?.fresh);
|
|
117
65
|
}
|
|
@@ -119,10 +67,9 @@ export async function loadConfig(root: string, options?: { fresh?: boolean }): P
|
|
|
119
67
|
// ── Merging ──────────────────────────────────────
|
|
120
68
|
|
|
121
69
|
/**
|
|
122
|
-
* Override a config with another, the invariant of every cascade level:
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* for global→CLI alike.
|
|
70
|
+
* Override a config with another, the invariant of every cascade level: scalar keys replace, but
|
|
71
|
+
* `remotes` (the topology) MERGES — an override adds or redirects a frond without erasing the
|
|
72
|
+
* others.
|
|
126
73
|
*/
|
|
127
74
|
function mergeGlobal(base: FougereConfig, override: Partial<FougereConfig>): FougereConfig {
|
|
128
75
|
const merged: FougereConfig = { ...base, ...override };
|
|
@@ -132,13 +79,7 @@ function mergeGlobal(base: FougereConfig, override: Partial<FougereConfig>): Fou
|
|
|
132
79
|
return merged;
|
|
133
80
|
}
|
|
134
81
|
|
|
135
|
-
/**
|
|
136
|
-
* Load config along the workspace→app frontier. The workspace-root config is
|
|
137
|
-
* the base (canonical topology: `remotes`, shared `db`); the app-root config
|
|
138
|
-
* overrides. Same `root` boundary the fronds already cascade along. When both
|
|
139
|
-
* roots resolve to the same dir (single app, no workspace), this is the plain
|
|
140
|
-
* root config — idempotent, no behavior change.
|
|
141
|
-
*/
|
|
82
|
+
/** Load config along the workspace→app frontier. */
|
|
142
83
|
export async function loadCascadedConfig(workspaceRoot: string, appRoot: string): Promise<FougereConfig> {
|
|
143
84
|
const base = await loadConfig(workspaceRoot);
|
|
144
85
|
if (resolve(workspaceRoot) === resolve(appRoot)) return base;
|
package/src/contract.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contract surface — what a sender needs to speak to a receiver, and
|
|
3
|
-
*
|
|
4
|
-
* shape, the call value, the naming convention.
|
|
5
|
-
*
|
|
6
|
-
* Browser-safe by design: no node builtin may enter this module's import
|
|
7
|
-
* graph. Published as the `@fougere/core/contract` subpath so client
|
|
8
|
-
* bundles never touch the full index (scanner, config loader). `@fougere/schema`
|
|
9
|
-
* is allowed in — measured, it imports no node builtin either.
|
|
2
|
+
* Contract surface — what a sender needs to speak to a receiver, and nothing that assumes a
|
|
3
|
+
* runtime: the error vocabulary, the invocation shape, the call value, the naming convention.
|
|
10
4
|
*/
|
|
11
5
|
import { lowerFirst } from '@fougere/schema';
|
|
12
|
-
import { canonicalInvocation, type InvocationContext } from './
|
|
6
|
+
import { canonicalInvocation, type InvocationContext } from './wire/Invocation.js';
|
|
13
7
|
import type { FrondCall } from './wire/call.js';
|
|
14
8
|
|
|
15
9
|
export { FougereError, ErrorCode, validationErrorsOf } from './wire/errors.js';
|
|
@@ -17,45 +11,29 @@ export { FougereError, ErrorCode, validationErrorsOf } from './wire/errors.js';
|
|
|
17
11
|
// core's boot — reaching it through the main entry dragged the scanner into a bundle.
|
|
18
12
|
export { toPublicError } from './wire/http-error.js';
|
|
19
13
|
export type { FougereErrorOptions } from './wire/errors.js';
|
|
20
|
-
export { canonicalInvocation, EMPTY_INVOCATION } from './
|
|
21
|
-
export type { InvocationContext } from './
|
|
22
|
-
export { Invocation } from './
|
|
23
|
-
export type {
|
|
24
|
-
export { Call } from './
|
|
25
|
-
export { RouteAddress } from './
|
|
26
|
-
export type { RouteAddressInput } from './
|
|
14
|
+
export { canonicalInvocation, EMPTY_INVOCATION } from './wire/Invocation.js';
|
|
15
|
+
export type { InvocationContext } from './wire/Invocation.js';
|
|
16
|
+
export { Invocation } from './wire/Invocation.js';
|
|
17
|
+
export type { PartialInvocation } from './wire/Invocation.js';
|
|
18
|
+
export { Call } from './wire/call.js';
|
|
19
|
+
export { RouteAddress } from './wire/RouteAddress.js';
|
|
20
|
+
export type { RouteAddressInput } from './wire/RouteAddress.js';
|
|
27
21
|
export type { FrondCall, Transport, SignedCall } from './wire/call.js';
|
|
28
22
|
export { MAX_BODY_BYTES } from './wire/call.js';
|
|
29
23
|
// The reserved entity, VALUE and not type: a consumer that wants to leave it alone — a
|
|
30
24
|
// call log ignoring its own reader — has to be able to name it.
|
|
31
25
|
export { RPC_ENTITY } from './wire/call.js';
|
|
32
|
-
export type { CallPage, CallRecord } from './
|
|
26
|
+
export type { CallPage, CallRecord } from './wire/CallLog.js';
|
|
33
27
|
// The comparison of two cards, which a consumer runs about a producer — browser-safe on
|
|
34
28
|
// purpose: a panel showing the drift holds only the two cards, never the app.
|
|
35
29
|
export { driftOf, agrees, explain } from './wire/drift.js';
|
|
36
30
|
export type { CardDrift } from './wire/drift.js';
|
|
37
31
|
|
|
38
|
-
/**
|
|
39
|
-
* What `rpc.discover` answers. It belongs here and not to the runtime: the
|
|
40
|
-
* reserved op travels on the same wire as every other call, so a consumer that
|
|
41
|
-
* only sends — a browser bundle, a frond written elsewhere — needs its shape and
|
|
42
|
-
* nothing else. Type-only, so `call.js` never enters the runtime graph.
|
|
43
|
-
*
|
|
44
|
-
* Stated once, on purpose: two private copies of this interface have already gone
|
|
45
|
-
* stale (the CLI's, then the Rust demo's) the day an op stopped being a bare name.
|
|
46
|
-
*/
|
|
32
|
+
/** What `rpc.discover` answers. */
|
|
47
33
|
export type { IdentityCard, CardOp, TopologyReport, FrondPlacement, Edge } from './wire/call.js';
|
|
48
34
|
export { assertIdentityCard } from './wire/call.js';
|
|
49
35
|
|
|
50
|
-
/**
|
|
51
|
-
* The key a class name is filed under — 'Post' → 'post'. Re-exported rather than
|
|
52
|
-
* respelled: a card writes it and a foreign key derives from it, so the convention
|
|
53
|
-
* belongs to the schema, and a second copy here is a second opinion. It travels
|
|
54
|
-
* through this subpath because a consumer of the wire (a browser bundle) may hold no
|
|
55
|
-
* schema dependency of its own — that audience only. Inside the package it is read from
|
|
56
|
-
* `@fougere/schema` directly: routing four modules through here bought nothing and put
|
|
57
|
-
* this file inside a cycle.
|
|
58
|
-
*/
|
|
36
|
+
/** The key a class name is filed under — 'Post' → 'post'. */
|
|
59
37
|
export { lowerFirst } from '@fougere/schema';
|
|
60
38
|
|
|
61
39
|
/** A call, fully fabricated: the designation and its completed invocation. */
|
|
@@ -65,10 +43,8 @@ export interface CallValue {
|
|
|
65
43
|
}
|
|
66
44
|
|
|
67
45
|
/**
|
|
68
|
-
* Fabricate the call value — one designation, two spellings:
|
|
69
|
-
* `callValueOf(
|
|
70
|
-
* `callValueOf({ entity, op }, input)` (raw, for dynamic bridges).
|
|
71
|
-
* Missing invocation fields complete to the empty invocation.
|
|
46
|
+
* Fabricate the call value — one designation, two spellings: `callValueOf(Post, 'list', { query
|
|
47
|
+
* })` (class + verb) or `callValueOf({ entity, op }, input)` (raw, for dynamic bridges).
|
|
72
48
|
*/
|
|
73
49
|
export function callValueOf(
|
|
74
50
|
target: { name: string } | FrondCall,
|
package/src/crypto/encoding.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What both realizations spell identically — bytes in, bytes out, no platform.
|
|
3
|
-
*
|
|
4
|
-
* `Buffer` did all of this and does not exist on a Worker; `atob`/`btoa` exist on both.
|
|
5
|
-
* Nothing here is a policy decision, which is why it sits beside the port rather than
|
|
6
|
-
* inside either half: two copies of a base64url would be two chances to disagree on the
|
|
7
|
-
* padding, and the disagreement would show up as a bad signature.
|
|
8
|
-
*/
|
|
1
|
+
/** What both realizations spell identically — bytes in, bytes out, no platform. */
|
|
9
2
|
|
|
10
3
|
const encoder = new TextEncoder();
|
|
11
4
|
const decoder = new TextDecoder();
|
|
@@ -45,13 +38,7 @@ export const unb64 = (input: string): Uint8Array => {
|
|
|
45
38
|
return bytes;
|
|
46
39
|
};
|
|
47
40
|
|
|
48
|
-
/**
|
|
49
|
-
* The DER a PEM wraps. WebCrypto imports DER and knows nothing about the armour.
|
|
50
|
-
*
|
|
51
|
-
* The label is not checked: a caller asking for a private key and handed a public one
|
|
52
|
-
* fails at `importKey` with a message about the key, which is the truer error than one
|
|
53
|
-
* about a header line.
|
|
54
|
-
*/
|
|
41
|
+
/** The DER a PEM wraps. */
|
|
55
42
|
export function derOf(pem: string): Uint8Array {
|
|
56
43
|
const body = pem.replace(/-----(BEGIN|END)[^-]+-----/g, '').replace(/\s+/g, '');
|
|
57
44
|
if (body.length === 0) throw new Error('Not a PEM: no base64 body between the armour');
|
package/src/crypto/node.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ed25519 through `node:crypto` — the default realization, and the fast one.
|
|
3
|
-
*
|
|
4
|
-
* `sign`/`verify` are synchronous here and stay synchronous: the promise is put around
|
|
5
|
-
* the answer, never around the work. That is the whole reason this file exists rather
|
|
6
|
-
* than everyone sharing the WebCrypto half.
|
|
7
|
-
*/
|
|
1
|
+
/** Ed25519 through `node:crypto` — the default realization, and the fast one. */
|
|
8
2
|
import { createHash, createPrivateKey, createPublicKey, sign, verify } from 'node:crypto';
|
|
9
3
|
import type { CryptoPort, PublicJwk, Signer, Verifier } from './port.js';
|
|
10
4
|
|
package/src/crypto/port.ts
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The two Ed25519 gestures a signed call needs, and the one hash that binds it.
|
|
3
|
-
*
|
|
4
|
-
* Node signs 59% faster than WebCrypto on the same curve (measured 2026-08-23: 14.30 µs
|
|
5
|
-
* against 22.72 µs per signature, 34.42 against 41.81 to verify), so this is a PORT with
|
|
6
|
-
* two realizations and not one implementation at the lowest common denominator. `#crypto`
|
|
7
|
-
* resolves to `crypto/node.ts` everywhere except under the `workerd` condition — the
|
|
8
|
-
* bundler picks at build time, and neither half ever appears in the other's output.
|
|
9
|
-
*
|
|
10
|
-
* The shape is async because WebCrypto is. On Node that costs one microtask, which the
|
|
11
|
-
* same measurement puts inside the noise of the signature itself (14.30 sync against
|
|
12
|
-
* 14.28 awaited) — awaiting is free, converting is not.
|
|
13
|
-
*
|
|
14
|
-
* A KEY IS PARSED ONCE. `crypto.subtle.importKey` is async and per-key, so an interface
|
|
15
|
-
* shaped `sign(key, data)` would import on every call; `signerOf(pem)` hands back
|
|
16
|
-
* something that holds the parsed key, and a boot builds it once.
|
|
17
|
-
*/
|
|
1
|
+
/** The two Ed25519 gestures a signed call needs, and the one hash that binds it. */
|
|
18
2
|
|
|
19
3
|
/** A parsed private key. */
|
|
20
4
|
export interface Signer {
|
|
@@ -36,7 +20,7 @@ export interface PublicJwk {
|
|
|
36
20
|
}
|
|
37
21
|
|
|
38
22
|
export interface CryptoPort {
|
|
39
|
-
/** SHA-256. What binds
|
|
23
|
+
/** SHA-256. What binds an input to an envelope without carrying the input. */
|
|
40
24
|
sha256(data: Uint8Array): Promise<Uint8Array>;
|
|
41
25
|
/** From a PKCS#8 PEM — what `fougere keys` writes. */
|
|
42
26
|
signerOf(privateKeyPem: string): Promise<Signer>;
|
package/src/crypto/webcrypto.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ed25519 through WebCrypto — what a runtime with no `node:` builtin has.
|
|
3
|
-
*
|
|
4
|
-
* Verified in real workerd with no compatibility flag (2026-08-23): sign, verify, a JWK
|
|
5
|
-
* import, an SPKI import and SHA-256 all answer. `Ed25519` is the algorithm name; the
|
|
6
|
-
* older `NODE-ED25519` spelling is not used, and a runtime that only knows that one will
|
|
7
|
-
* refuse at `importKey` rather than silently signing with something else.
|
|
8
|
-
*
|
|
9
|
-
* The four gestures are declared here rather than pulled from `lib.dom`: this package
|
|
10
|
-
* compiles with `lib: ["ESNext"]` and naming DOM would make every consumer carry a
|
|
11
|
-
* browser's globals to read a server type. What the file needs IS the declaration.
|
|
12
|
-
*/
|
|
1
|
+
/** Ed25519 through WebCrypto — what a runtime with no `node:` builtin has. */
|
|
13
2
|
import { derOf } from './encoding.js';
|
|
14
3
|
import type { CryptoPort, PublicJwk, Signer, Verifier } from './port.js';
|
|
15
4
|
|
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A frond stated by its author, for an app that will not scan.
|
|
3
|
-
*
|
|
4
|
-
* The scan reads the type checker because a signature IS a declaration — and that reading
|
|
5
|
-
* has to happen while the types still exist, which is build time. An app that wants
|
|
6
|
-
* neither a build step nor `typescript` at runtime says the same thing here instead, and
|
|
7
|
-
* `createApp` cannot tell the difference: it consumes a `ScanResult`, never a scanner.
|
|
8
|
-
*
|
|
9
|
-
* What it does NOT ask for is the point. Every name the scan derives from a class is
|
|
10
|
-
* derived here the same way — `PostHandler` answers at `post`, `Post` is stored as `post`
|
|
11
|
-
* — so a declaration states classes and nothing else. `filePath` is empty because there is
|
|
12
|
-
* no file to point at, and a diagnostic that would have quoted one says so plainly.
|
|
13
|
-
*
|
|
14
|
-
* Measured on `demos/nuxt-blog`: 23 of its 29 operations need no word here at all, because
|
|
15
|
-
* `Crud.__ops` declares them at runtime. Only the six the author wrote by hand cost
|
|
16
|
-
* anything, and they cost `frond.config.ts` — where what is not derivable is stated.
|
|
17
|
-
*/
|
|
1
|
+
/** A frond stated by its author, for an app that will not scan. */
|
|
18
2
|
import { lowerFirst, type SchemaView } from '@fougere/schema';
|
|
19
3
|
import type {
|
|
20
4
|
CollectorEntry, EntityEntry, FrondDescriptor, HandlerEntry,
|
|
21
5
|
PresenterEntry, ProviderEntry, SeedEntry,
|
|
22
|
-
} from './frond.js';
|
|
23
|
-
import { DEFAULT_CONVENTIONS } from './conventions.js';
|
|
24
|
-
import { getPresenterFields } from '
|
|
6
|
+
} from './descriptor/frond.js';
|
|
7
|
+
import { DEFAULT_CONVENTIONS } from './scan/conventions.js';
|
|
8
|
+
import { getPresenterFields } from './prefab/presenter.js';
|
|
25
9
|
|
|
26
10
|
/** A class, as a declaration hands it over: the constructor itself. */
|
|
27
11
|
type Ctor = new (...args: never[]) => unknown;
|
|
28
12
|
|
|
29
|
-
/**
|
|
30
|
-
* What a subject needs beyond its class, when its constructor names a frame or a port.
|
|
31
|
-
*
|
|
32
|
-
* `deps` is the one thing no runtime can recover: TypeScript erases the parameter types,
|
|
33
|
-
* and `registerFrames` reads them to know which frames to build — asking for one IS
|
|
34
|
-
* declaring it. A handler that takes only its own entity's ORM needs nothing here.
|
|
35
|
-
*/
|
|
13
|
+
/** What a subject needs beyond its class, when its constructor names a frame or a port. */
|
|
36
14
|
export interface DeclaredSubject {
|
|
37
15
|
ctor: Ctor;
|
|
38
16
|
deps?: string[];
|
|
@@ -41,9 +19,9 @@ export interface DeclaredSubject {
|
|
|
41
19
|
/** A handler, and the surface it answers on when it is not the default one. */
|
|
42
20
|
export interface DeclaredHandler extends DeclaredSubject {
|
|
43
21
|
/**
|
|
44
|
-
* The scan reads this from the directory (`handlers/public/`), so a statement has to
|
|
45
|
-
*
|
|
46
|
-
*
|
|
22
|
+
* The scan reads this from the directory (`handlers/public/`), so a statement has to say it: two
|
|
23
|
+
* handlers over one entity collide on their address otherwise, and the refusal names the same
|
|
24
|
+
* route twice.
|
|
47
25
|
*/
|
|
48
26
|
surface?: string;
|
|
49
27
|
}
|
|
@@ -55,9 +33,8 @@ const ctorOf = (d: Declared): Ctor => (typeof d === 'function' ? d : d.ctor);
|
|
|
55
33
|
|
|
56
34
|
/**
|
|
57
35
|
* What a prefab was BUILT ON — `Presenter(Post)` and `Collector(User)` both keep it under
|
|
58
|
-
* `__entity`, which is the only place it survives: nothing in the FORM of `PostPresenter`
|
|
59
|
-
*
|
|
60
|
-
* rather than yielding a frond whose presenter belongs to no entity.
|
|
36
|
+
* `__entity`, which is the only place it survives: nothing in the FORM of `PostPresenter` says
|
|
37
|
+
* `Post`.
|
|
61
38
|
*/
|
|
62
39
|
function subjectOf(ctor: Ctor, kind: string): { name: string } {
|
|
63
40
|
const subject = (ctor as unknown as { __entity?: { name: string } }).__entity;
|
|
@@ -93,15 +70,7 @@ export interface FrondDeclaration {
|
|
|
93
70
|
scope?: string;
|
|
94
71
|
}
|
|
95
72
|
|
|
96
|
-
/**
|
|
97
|
-
* State a frond without reading a disk.
|
|
98
|
-
*
|
|
99
|
-
* ```ts
|
|
100
|
-
* createApp({
|
|
101
|
-
* scan: { fronds: Fronds.scanned([frond('blog', { entities: [Post], handlers: [PostHandler] })]), diagnostics: [] },
|
|
102
|
-
* })
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
73
|
+
/** State a frond without reading a disk. */
|
|
105
74
|
export function frond(name: string, declared: FrondDeclaration = {}): FrondDescriptor {
|
|
106
75
|
const scope = declared.scope ?? DEFAULT_CONVENTIONS.scope;
|
|
107
76
|
|
package/src/define.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { FougereConfig } from './config-loader.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Identity helper for fougere.config.ts — preserves literal types for autocomplete
|
|
5
|
-
*
|
|
6
|
-
* but more explicit and aligned with defineFrond().
|
|
4
|
+
* Identity helper for fougere.config.ts — preserves literal types for autocomplete while
|
|
5
|
+
* validating against FougereConfig.
|
|
7
6
|
*/
|
|
8
7
|
export function defineFougere<T extends FougereConfig>(config: T): T {
|
|
9
8
|
return config;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SchemaView } from '@fougere/schema';
|
|
2
|
+
import type { EntityEntry, FrondDescriptor } from './frond.js';
|
|
3
|
+
|
|
4
|
+
/** What this app hosts, with the questions everyone was asking it by hand. */
|
|
5
|
+
export class Fronds extends Array<FrondDescriptor> {
|
|
6
|
+
static override get [Symbol.species](): ArrayConstructor {
|
|
7
|
+
return Array;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** The fronds an app hosts, scanned or stated. The only gate in — `Array.of` is taken. */
|
|
11
|
+
static hosting(fronds: readonly FrondDescriptor[]): Fronds {
|
|
12
|
+
const all = new Fronds();
|
|
13
|
+
all.push(...fronds);
|
|
14
|
+
return all;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The frond that hosts an entity — `undefined` when no loaded frond does. */
|
|
18
|
+
owner(entity: string): FrondDescriptor | undefined {
|
|
19
|
+
return this.find((frond) => frond.entities.some((e) => e.name === entity));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The entity of that name, wherever it was declared. */
|
|
23
|
+
entity(name: string): EntityEntry | undefined {
|
|
24
|
+
for (const frond of this) {
|
|
25
|
+
const found = frond.entities.find((e) => e.name === name);
|
|
26
|
+
if (found) return found;
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Every entity class, by name — across all fronds and never per-frond. */
|
|
32
|
+
schemas(): Map<string, SchemaView> {
|
|
33
|
+
return new Map(this.flatMap((frond) => frond.entities.map((e) => [e.name, e.entityClass] as const)));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Every declared entity, sorted. What is DECLARED, not what answers. */
|
|
37
|
+
entityNames(): string[] {
|
|
38
|
+
return this.flatMap((frond) => frond.entities.map((e) => e.name)).sort();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The names a call may address, sorted — what a NOT_FOUND must print. */
|
|
42
|
+
servedNames(surface?: string): string[] {
|
|
43
|
+
return this.flatMap((frond) => frond.handlers
|
|
44
|
+
.filter((handler) => (handler.surface ?? undefined) === surface)
|
|
45
|
+
.map((handler) => handler.address)).sort();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/** What a frond is made of — one interface per convention directory. */
|
|
2
|
+
import type { SchemaView } from '@fougere/schema';
|
|
3
|
+
import type { Param, OperationContract, OperationsMap } from '../wire/operation.js';
|
|
4
|
+
import type { PresenterViews } from '../prefab/presenter.js';
|
|
5
|
+
import type { Fronds } from './Fronds.js';
|
|
6
|
+
|
|
7
|
+
/** A discovered provider — a class under `services/` or `repositories/`, injected by type. */
|
|
8
|
+
export interface ProviderEntry {
|
|
9
|
+
/** The class constructor (default export of the file). */
|
|
10
|
+
ctor: new (...args: never[]) => unknown;
|
|
11
|
+
/** Constructor dependency type names (from AST scan). */
|
|
12
|
+
deps: string[];
|
|
13
|
+
/** Absolute file path (for debugging). */
|
|
14
|
+
filePath: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** A discovered entity (Entity subclass in entities/ dir). */
|
|
18
|
+
export interface EntityEntry {
|
|
19
|
+
/** Registration key: class name lowercased first char (e.g. 'product'). */
|
|
20
|
+
name: string;
|
|
21
|
+
/** The Entity class (has static getFields()). */
|
|
22
|
+
entityClass: SchemaView;
|
|
23
|
+
/** Absolute file path (for debugging). */
|
|
24
|
+
filePath: string;
|
|
25
|
+
/** Whether this entity is part of the frond's public contract. */
|
|
26
|
+
exposed?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A discovered handler (controls what a service exposes). */
|
|
30
|
+
export interface HandlerEntry {
|
|
31
|
+
/** Registration key (e.g. 'postHandler'). */
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* The name this handler answers to — its class name minus `Handler`, lowercased (`PostHandler` →
|
|
35
|
+
* `post`).
|
|
36
|
+
*/
|
|
37
|
+
address: string;
|
|
38
|
+
/** The handler class. */
|
|
39
|
+
ctor: new (...args: never[]) => unknown;
|
|
40
|
+
/** All operations with full signatures for binding. */
|
|
41
|
+
operations: OperationsMap;
|
|
42
|
+
/** Constructor dependency type names (from AST scan). */
|
|
43
|
+
deps: string[];
|
|
44
|
+
/** Absolute file path (for debugging). */
|
|
45
|
+
filePath: string;
|
|
46
|
+
/** Whether this handler is part of the frond's public contract. */
|
|
47
|
+
exposed?: boolean;
|
|
48
|
+
/** Output schema override — when Crud(Entity, Output), restricts storage output. */
|
|
49
|
+
outputOverride?: SchemaView;
|
|
50
|
+
/** Surface name — subdirectory in handlers/ (e.g. 'admin', 'public'). */
|
|
51
|
+
surface?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Return type metadata for a presenter computed field. */
|
|
55
|
+
export interface PresenterFieldMeta {
|
|
56
|
+
name: string;
|
|
57
|
+
/** Inferred return type name: 'string', 'number', 'boolean', or a class name. */
|
|
58
|
+
returnType?: string;
|
|
59
|
+
/** The field emits a LIST per row — `tags(posts: Post[]): string[][]`. */
|
|
60
|
+
list?: boolean;
|
|
61
|
+
/** Whether the return is nullable. */
|
|
62
|
+
nullable?: boolean;
|
|
63
|
+
/** The declared parameters AFTER the rows. */
|
|
64
|
+
params?: Param[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A discovered presenter (computed fields for an entity's output). */
|
|
68
|
+
export interface PresenterEntry {
|
|
69
|
+
/** Entity name this presenter enriches (e.g. 'post' from PostPresenter). */
|
|
70
|
+
entityName: string;
|
|
71
|
+
/** The presenter class. */
|
|
72
|
+
ctor: new (...args: never[]) => unknown;
|
|
73
|
+
/** Computed field names (method names on prototype). */
|
|
74
|
+
fields: string[];
|
|
75
|
+
/** Per-field type metadata (inferred from source via parser). */
|
|
76
|
+
fieldMeta: PresenterFieldMeta[];
|
|
77
|
+
/**
|
|
78
|
+
* The view each computed field emits, when the presenter declares one (`Presenter(Order, {
|
|
79
|
+
* items: [OrderItemView] })`).
|
|
80
|
+
*/
|
|
81
|
+
views?: PresenterViews;
|
|
82
|
+
/** Constructor dependency type names (from AST scan). */
|
|
83
|
+
deps: string[];
|
|
84
|
+
/** Absolute file path (for debugging). */
|
|
85
|
+
filePath: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A discovered collector (resolves handler input params from invocation context). */
|
|
89
|
+
export interface CollectorEntry {
|
|
90
|
+
/** Registration key of the TYPE this collector resolves — 'user', 'ability'. */
|
|
91
|
+
typeName: string;
|
|
92
|
+
/** The collector class. */
|
|
93
|
+
ctor: new (...args: never[]) => unknown;
|
|
94
|
+
/** Constructor dependency type names (from AST scan). */
|
|
95
|
+
deps: string[];
|
|
96
|
+
/** Absolute file path (for debugging). */
|
|
97
|
+
filePath: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** A discovered seed file (array of records or async factory). */
|
|
101
|
+
export interface SeedEntry {
|
|
102
|
+
/** Entity name this seed targets (from filename: Author.seed.ts → 'author'). */
|
|
103
|
+
entityName: string;
|
|
104
|
+
/** Raw default export — array or function. Resolved at runtime. */
|
|
105
|
+
data: Record<string, unknown>[] | SeedFactory;
|
|
106
|
+
/** Absolute file path (for debugging). */
|
|
107
|
+
filePath: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Seed factory — receives a resolver to access handlers cross-frond. */
|
|
111
|
+
export type SeedFactory = (resolve: <T>(name: string) => T) => Promise<Record<string, unknown>[]>;
|
|
112
|
+
|
|
113
|
+
/** Where a frond lives on disk. */
|
|
114
|
+
export interface FrondSource {
|
|
115
|
+
/** Absolute path to the frond directory. */
|
|
116
|
+
path: string;
|
|
117
|
+
/** The @fronds/{name} package name. Always present. */
|
|
118
|
+
package: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface FrondDescriptor {
|
|
122
|
+
name: string;
|
|
123
|
+
source: FrondSource;
|
|
124
|
+
providers: ProviderEntry[];
|
|
125
|
+
entities: EntityEntry[];
|
|
126
|
+
handlers: HandlerEntry[];
|
|
127
|
+
presenters: PresenterEntry[];
|
|
128
|
+
collectors: CollectorEntry[];
|
|
129
|
+
seeds: SeedEntry[];
|
|
130
|
+
/**
|
|
131
|
+
* Per-surface entity lists from frond.config.ts (e.g. { graphql: ['Post'], rest: ['Post',
|
|
132
|
+
* 'Author'] }).
|
|
133
|
+
*/
|
|
134
|
+
surfaces?: Record<string, string[]>;
|
|
135
|
+
/** Entities this frond may read across sources — see `FrondConfig.reads`. */
|
|
136
|
+
reads?: string[];
|
|
137
|
+
/** Per-operation overrides from frond.config.ts. */
|
|
138
|
+
operationsOverrides?: Record<string, OperationContract & {
|
|
139
|
+
kind?: 'query' | 'command';
|
|
140
|
+
/** Class name to resolve from DI (overrides default `{Entity}Handler` lookup). */
|
|
141
|
+
handlerName?: string;
|
|
142
|
+
/** Method name on the resolved handler (defaults to op name). */
|
|
143
|
+
method?: string;
|
|
144
|
+
}>;
|
|
145
|
+
}
|