@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/prefab/mirror.ts
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { Lifecycle, type EntityConstructor, type Fields } from '@fougere/schema';
|
|
2
|
+
import type { Storage } from '../storage.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* A paginated local copy of a source that cannot be queried directly.
|
|
6
|
-
*
|
|
7
|
-
* The shape must contain an `updated()` field used as a high-water mark. Subclasses
|
|
8
|
-
* implement `pull`; `refresh` validates and upserts each returned page.
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* export default class PartnerCatalog extends Mirror(BookCard) {
|
|
12
|
-
* constructor(orm: EntityOrm<BookCard>, private catalog: Facade<CatalogHandler>) {
|
|
13
|
-
* super(orm);
|
|
14
|
-
* }
|
|
15
|
-
*
|
|
16
|
-
* async *pull(since?: Date) {
|
|
17
|
-
* for (let page = 0; page !== null;) {
|
|
18
|
-
* const body = await fetch(`${api}?page=${page}&since=${since?.toISOString() ?? ''}`);
|
|
19
|
-
* const { items, next } = await body.json();
|
|
20
|
-
* yield items.map(toCard);
|
|
21
|
-
* page = next;
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
4
|
+
/** A paginated local copy of a source that cannot be queried directly. */
|
|
27
5
|
/** What one refresh did — enough to log it, and to decide whether to run again. */
|
|
28
6
|
export interface Refreshed {
|
|
29
|
-
/**
|
|
7
|
+
/** Instances written, counting a replaced one once. */
|
|
30
8
|
written: number;
|
|
31
9
|
/** The age the pull was asked to start from — absent on the first ever run. */
|
|
32
10
|
since?: Date;
|
|
@@ -36,7 +14,7 @@ export interface Refreshed {
|
|
|
36
14
|
|
|
37
15
|
export interface MirrorOf<T> {
|
|
38
16
|
/** The copy's own storage — where a page lands, and where its age is read. */
|
|
39
|
-
|
|
17
|
+
storage: Storage<T>;
|
|
40
18
|
/** Pages of rows to write. The one thing a mirror's author supplies. */
|
|
41
19
|
pull(since?: Date): AsyncIterable<Partial<T>[]>;
|
|
42
20
|
/** Run one pass: read the high-water mark, pull from there, write each page. */
|
|
@@ -46,7 +24,7 @@ export interface MirrorOf<T> {
|
|
|
46
24
|
}
|
|
47
25
|
|
|
48
26
|
export interface MirrorConstructor<T> {
|
|
49
|
-
new (
|
|
27
|
+
new (storage: Storage<T>): MirrorOf<T>;
|
|
50
28
|
readonly __entity: unknown;
|
|
51
29
|
}
|
|
52
30
|
|
|
@@ -66,13 +44,13 @@ export function Mirror<E extends EntityConstructor>(shape: E): MirrorConstructor
|
|
|
66
44
|
abstract class MirrorBase implements MirrorOf<T> {
|
|
67
45
|
static readonly __entity = shape;
|
|
68
46
|
|
|
69
|
-
constructor(public
|
|
47
|
+
constructor(public storage: Storage<T>) {}
|
|
70
48
|
|
|
71
49
|
abstract pull(since?: Date): AsyncIterable<Partial<T>[]>;
|
|
72
50
|
|
|
73
51
|
/** The freshest persisted stamp; no process-local freshness state is kept. */
|
|
74
52
|
async freshness(): Promise<Date | undefined> {
|
|
75
|
-
const [newest] = await this.
|
|
53
|
+
const [newest] = await this.storage.list({ orderBy: age, order: 'desc', limit: 1 });
|
|
76
54
|
const value = (newest as Record<string, unknown> | undefined)?.[age];
|
|
77
55
|
return value instanceof Date ? value : undefined;
|
|
78
56
|
}
|
|
@@ -84,7 +62,7 @@ export function Mirror<E extends EntityConstructor>(shape: E): MirrorConstructor
|
|
|
84
62
|
// Preserve the source's page boundaries: one page becomes one upsert.
|
|
85
63
|
for await (const page of this.pull(since)) {
|
|
86
64
|
if (page.length === 0) continue;
|
|
87
|
-
written += await this.
|
|
65
|
+
written += await this.storage.upsertAll(page);
|
|
88
66
|
}
|
|
89
67
|
return { written, since, ms: Date.now() - started };
|
|
90
68
|
}
|
|
@@ -102,21 +80,3 @@ export function ageFieldOf(shape: unknown): string | undefined {
|
|
|
102
80
|
}
|
|
103
81
|
return undefined;
|
|
104
82
|
}
|
|
105
|
-
|
|
106
|
-
/** Validate and decode a page, naming a refused row by its declared primary field. */
|
|
107
|
-
function judgePage<T>(shape: unknown, page: Partial<T>[]): Record<string, unknown>[] {
|
|
108
|
-
const judge = (shape as { validate?: (input: unknown) => ValidationResult<unknown> }).validate;
|
|
109
|
-
if (typeof judge !== 'function') return page as Record<string, unknown>[];
|
|
110
|
-
|
|
111
|
-
const name = (shape as { name?: string }).name ?? 'mirror';
|
|
112
|
-
const fields = (shape as { getFields?: () => Fields }).getFields?.();
|
|
113
|
-
const primary = fields ? FieldSet.of(fields).primary : undefined;
|
|
114
|
-
return page.map((row, index) => {
|
|
115
|
-
const verdict = judge.call(shape, row);
|
|
116
|
-
if (verdict.success) return verdict.data as Record<string, unknown>;
|
|
117
|
-
const key = primary === undefined ? undefined : (row as Record<string, unknown>)[primary];
|
|
118
|
-
const where = key !== undefined ? `row ${primary} ${JSON.stringify(key)}` : `row ${index} of this page`;
|
|
119
|
-
const why = verdict.errors.map((e) => `${e.path}: ${e.message}`).join(', ');
|
|
120
|
-
throw new Error(`${name} mirror refused ${where} — ${why}`);
|
|
121
|
-
});
|
|
122
|
-
}
|
package/src/prefab/prefab.ts
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import type { EntityConstructor } from '@fougere/schema';
|
|
2
2
|
import type { PresenterViews } from './presenter.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* What a prefab class declares about ITSELF, at runtime.
|
|
6
|
-
*
|
|
7
|
-
* `Crud(Post)`, `Presenter(Post)`, `Repository(Post)`, `Collector(User)` and
|
|
8
|
-
* `Mirror(BookCard)` all fabricate a class, and only the fabricator knows what it was
|
|
9
|
-
* built on: the AST scan is workspace-only, so an INSTALLED prefab resolves to nothing
|
|
10
|
-
* and a statement written in source would be lost. Hence a runtime marker — the same
|
|
11
|
-
* reason `__ops` exists.
|
|
12
|
-
*
|
|
13
|
-
* It was three spellings for one statement: `static __entity` on three of the five, a
|
|
14
|
-
* private `Symbol.for('fougere:x_target')` on the other two, and BOTH on `Repository`
|
|
15
|
-
* and `Mirror` — the same class recording its subject twice, under two names, with two
|
|
16
|
-
* readers that could disagree. A mark that answers one question answers it once.
|
|
17
|
-
*/
|
|
4
|
+
/** What a prefab class declares about ITSELF, at runtime. */
|
|
18
5
|
interface Prefab {
|
|
19
6
|
/** The shape this class was built on. `Mirror` calls it a shape; it is the same slot. */
|
|
20
7
|
readonly __entity?: EntityConstructor;
|
|
@@ -24,13 +11,7 @@ interface Prefab {
|
|
|
24
11
|
readonly __output?: EntityConstructor;
|
|
25
12
|
}
|
|
26
13
|
|
|
27
|
-
/**
|
|
28
|
-
* The shape a prefab was built on, or `undefined` when the class is not one.
|
|
29
|
-
*
|
|
30
|
-
* A plain property read: JavaScript walks a constructor's own prototype chain, so a
|
|
31
|
-
* subclass of a prefab answers what its base recorded. Three of the five accessors this
|
|
32
|
-
* replaces walked that chain by hand, and two did not — one question, two mechanisms.
|
|
33
|
-
*/
|
|
14
|
+
/** The shape a prefab was built on, or `undefined` when the class is not one. */
|
|
34
15
|
export function targetOf(ctor: unknown): EntityConstructor | undefined {
|
|
35
16
|
return (ctor as Prefab | undefined)?.__entity;
|
|
36
17
|
}
|
package/src/prefab/presenter.ts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Presenter(Entity) — enriches an entity's output with computed fields.
|
|
3
|
-
*
|
|
4
|
-
* Each method on the presenter is a computed field resolver:
|
|
5
|
-
* - Receives the entity record as first argument
|
|
6
|
-
* - Can be sync or async
|
|
7
|
-
* - Injected via DI (constructor params resolved by the container)
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* ```ts
|
|
11
|
-
* export default class PostPresenter extends Presenter(Post) {
|
|
12
|
-
* constructor(private commentOrm: CommentOrm) { super(); }
|
|
13
|
-
*
|
|
14
|
-
* excerpt(post: Post) {
|
|
15
|
-
* return post.body.slice(0, 200);
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* async commentCount(post: Post) {
|
|
19
|
-
* return this.commentOrm.countFor(post.id);
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
1
|
+
/** Presenter(Entity) — enriches an entity's output with computed fields. */
|
|
24
2
|
|
|
25
3
|
import { upperFirst, type EntityConstructor } from '@fougere/schema';
|
|
26
4
|
|
|
@@ -30,19 +8,7 @@ import { upperFirst, type EntityConstructor } from '@fougere/schema';
|
|
|
30
8
|
*/
|
|
31
9
|
export type PresenterViews = Record<string, EntityConstructor | [EntityConstructor]>;
|
|
32
10
|
|
|
33
|
-
/**
|
|
34
|
-
* `Presenter(Order, { items: [OrderItemView], user: UserCard })` — the second argument names
|
|
35
|
-
* the view each computed field emits, exactly as `Crud(Post, { list: PostCard })` names an
|
|
36
|
-
* op's. What fabricates a field declares its contract, and it declares it **once**: the
|
|
37
|
-
* façade applies the presenter (see `PresenterExecutor`), and every surface reads the same statement
|
|
38
|
-
* instead of guessing.
|
|
39
|
-
*
|
|
40
|
-
* Guessing was the cost of not stating it. The scan can read a scalar off a return type and
|
|
41
|
-
* nothing more, so a field returning an object had no derivable shape: the GraphQL projection
|
|
42
|
-
* fell back to a serialized `String`, and a client asking `items { quantity }` got a schema
|
|
43
|
-
* error on a field REST served whole. Declaring is optional — a scalar field needs nothing,
|
|
44
|
-
* and an undeclared object keeps the old behaviour.
|
|
45
|
-
*/
|
|
11
|
+
/** `Presenter(Order, { items. */
|
|
46
12
|
export function Presenter<E extends EntityConstructor>(entity: E, views?: PresenterViews) {
|
|
47
13
|
class PresenterBase {
|
|
48
14
|
static readonly __entity = entity;
|
package/src/prefab/repository.ts
CHANGED
|
@@ -1,95 +1,32 @@
|
|
|
1
1
|
import { upperFirst, type EntityConstructor } from '@fougere/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Storage, ListOptions, ListResult, SelectOption } from '../storage.js';
|
|
3
3
|
import type { SchemaView } from '@fougere/schema';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Repository(…entities) — who owns an entity's storage, and where its questions are named.
|
|
7
|
-
*
|
|
8
|
-
* **The arity decides**, which is the second reading of what `orm.ts` already states for
|
|
9
|
-
* `EntityOrm` against `Together`: the arity of the unit is the whole distinction.
|
|
10
|
-
*
|
|
11
|
-
* ONE entity — the repository IS that entity's storage, with your methods added. The port's
|
|
12
|
-
* thirteen gestures are forwarded, so a handler reads `this.posts.list()` whether or not
|
|
13
|
-
* anyone wrote the file, and a named question sits beside them:
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
* // repositories/PostRepository.ts
|
|
17
|
-
* export default class PostRepository extends Repository(Post) {
|
|
18
|
-
* published() {
|
|
19
|
-
* return this.list({ where: { status: 'published' }, orderBy: 'publishedAt', order: 'desc' });
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* TWO OR MORE — an aggregate. It owns them: nothing else in the app is handed their
|
|
25
|
-
* storage, and no gesture is forwarded (which entity would `create` write to?), so the only
|
|
26
|
-
* way in is a method this class names. That is what lets a rule spanning two tables exist:
|
|
27
|
-
* it is ordinary TypeScript inside the method that does the writing.
|
|
28
|
-
*
|
|
29
|
-
* ```ts
|
|
30
|
-
* // repositories/CommandeRepository.ts
|
|
31
|
-
* export default class CommandeRepository extends Repository(Commande, Stock) {
|
|
32
|
-
* avecLignes(id: string) {
|
|
33
|
-
* const [commandes, stock] = this.orms;
|
|
34
|
-
* …
|
|
35
|
-
* }
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* `this.orms` is protected, because the whole point is that the storage stops at this file.
|
|
40
|
-
* `protected` is erased at runtime, like `abstract` on a port: a compile-time guarantee, not
|
|
41
|
-
* a barrier. The same bargain, already accepted.
|
|
42
|
-
*
|
|
43
|
-
* **The boundary is not the unit of work.** An aggregate says the rules of these entities
|
|
44
|
-
* hold together; a frame says these writes land together, and the two lists coincide only
|
|
45
|
-
* often. Deriving the frame from the membership would make a read-only aggregate carry one
|
|
46
|
-
* — refusals included, and `registerFrames` refuses without storage or over `remotes:` —
|
|
47
|
-
* and would put `Together<[Commande, Stock], [StockMirror]>` out of reach forever. So a
|
|
48
|
-
* frame is ASKED FOR here as anywhere else, which is what makes it declared:
|
|
49
|
-
*
|
|
50
|
-
* ```ts
|
|
51
|
-
* constructor(commandes: CommandeOrm, stock: StockOrm, private frame: Together<[Commande, Stock]>) {
|
|
52
|
-
* super(commandes, stock);
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* The ORM words come back in that line, and only there: this class IS the holder, which is
|
|
57
|
-
* the one case `boot/ownership.ts` lets name the storage it was built on.
|
|
58
|
-
*
|
|
59
|
-
* A repository is NOT a door: it has no façade, so nothing here is reachable from the wire.
|
|
60
|
-
*/
|
|
5
|
+
/** Repository(…entities) — who owns an entity's storage, and where its questions are named. */
|
|
61
6
|
|
|
62
7
|
/**
|
|
63
|
-
* The shape a repository of ONE entity has — the port itself, plus whatever the subclass
|
|
64
|
-
*
|
|
65
|
-
* to `PostRepository` what `EntityOrm<Post>` is to `PostOrm`, one spelling of one key, and
|
|
66
|
-
* `depKeyOf` reads both.
|
|
8
|
+
* The shape a repository of ONE entity has — the port itself, plus whatever the subclass names on
|
|
9
|
+
* top.
|
|
67
10
|
*/
|
|
68
|
-
export type RepositoryOf<T> =
|
|
11
|
+
export type RepositoryOf<T> = Storage<T>;
|
|
69
12
|
|
|
70
13
|
/** The single-entity form: the port, plus whatever the subclass names. */
|
|
71
14
|
export interface RepositoryConstructor<T> {
|
|
72
|
-
new (
|
|
15
|
+
new (storage: Storage<T>): Storage<T>;
|
|
73
16
|
readonly __entity: unknown;
|
|
74
17
|
}
|
|
75
18
|
|
|
76
|
-
/**
|
|
77
|
-
* What an aggregate's subclass sees: the storage of the members it owns, in declared order,
|
|
78
|
-
* and `protected` — the storage stops at that file, which is the whole mechanism.
|
|
79
|
-
*
|
|
80
|
-
* A class and not an interface, because `protected` cannot be spelled in one. Ambient: the
|
|
81
|
-
* value it describes is fabricated by `many()` for an arity only known at the call.
|
|
82
|
-
*/
|
|
19
|
+
/** What an aggregate's subclass sees. */
|
|
83
20
|
declare abstract class AggregateShape<E extends readonly EntityConstructor[]> {
|
|
84
|
-
protected
|
|
21
|
+
protected storages: { [K in keyof E]: Storage<InstanceType<E[K]>> };
|
|
85
22
|
}
|
|
86
23
|
|
|
87
24
|
/** The tuple an aggregate holds — the readable form of {@link AggregateShape}'s member. */
|
|
88
25
|
export type AggregateOf<E extends readonly EntityConstructor[]> =
|
|
89
|
-
{ [K in keyof E]:
|
|
26
|
+
{ [K in keyof E]: Storage<InstanceType<E[K]>> };
|
|
90
27
|
|
|
91
28
|
export type AggregateConstructor<E extends readonly EntityConstructor[]> =
|
|
92
|
-
(new (...
|
|
29
|
+
(new (...storages: unknown[]) => AggregateShape<E>) & {
|
|
93
30
|
readonly __entity: unknown;
|
|
94
31
|
/** The entities this class owns. Present from two on — an owner of one owns nothing. */
|
|
95
32
|
readonly __owns: E;
|
|
@@ -103,51 +40,43 @@ export function Repository(...entities: EntityConstructor[]): unknown {
|
|
|
103
40
|
return entities.length === 1 ? one(entities[0]) : many(entities);
|
|
104
41
|
}
|
|
105
42
|
|
|
106
|
-
/**
|
|
107
|
-
* The port forwarded, member by member. Written out rather than proxied: a Proxy would
|
|
108
|
-
* answer every name including the ones the port does not have, and this file would then
|
|
109
|
-
* state the surface nowhere. Thirteen lines against one declaration that can be read.
|
|
110
|
-
*/
|
|
43
|
+
/** The port forwarded, member by member. */
|
|
111
44
|
function one<E extends EntityConstructor>(entity: E): RepositoryConstructor<InstanceType<E>> {
|
|
112
45
|
type T = InstanceType<E>;
|
|
113
46
|
|
|
114
|
-
class RepositoryBase implements
|
|
47
|
+
class RepositoryBase implements Storage<T> {
|
|
115
48
|
static readonly __entity = entity;
|
|
116
49
|
|
|
117
|
-
constructor(protected
|
|
118
|
-
|
|
119
|
-
list(options?: ListOptions & SelectOption): Promise<ListResult<T>> { return this.
|
|
120
|
-
findById(id: string, options?: SelectOption) { return this.
|
|
121
|
-
findBy(criteria: Partial<T> | Record<string, unknown>, options?: SelectOption) { return this.
|
|
122
|
-
findAllBy(criteria: Partial<T> | Record<string, unknown>, options?: SelectOption) { return this.
|
|
123
|
-
findByKeys(ids: readonly string[], options?: SelectOption) { return this.
|
|
124
|
-
findAllByKeys(field: string, keys: readonly string[], options?: SelectOption) { return this.
|
|
125
|
-
create(input: Partial<T>, options?: SelectOption) { return this.
|
|
126
|
-
upsert(input: Partial<T>, options?: SelectOption) { return this.
|
|
127
|
-
upsertAll(inputs: readonly Partial<T>[], options?: SelectOption) { return this.
|
|
128
|
-
update(id: string, input: Partial<T>, options?: SelectOption) { return this.
|
|
129
|
-
delete(id: string) { return this.
|
|
130
|
-
output(schema: SchemaView) { return this.
|
|
131
|
-
get client(): unknown { return this.
|
|
50
|
+
constructor(protected storage: Storage<T>) {}
|
|
51
|
+
|
|
52
|
+
list(options?: ListOptions & SelectOption): Promise<ListResult<T>> { return this.storage.list(options); }
|
|
53
|
+
findById(id: string, options?: SelectOption) { return this.storage.findById(id, options); }
|
|
54
|
+
findBy(criteria: Partial<T> | Record<string, unknown>, options?: SelectOption) { return this.storage.findBy(criteria, options); }
|
|
55
|
+
findAllBy(criteria: Partial<T> | Record<string, unknown>, options?: SelectOption) { return this.storage.findAllBy(criteria, options); }
|
|
56
|
+
findByKeys(ids: readonly string[], options?: SelectOption) { return this.storage.findByKeys(ids, options); }
|
|
57
|
+
findAllByKeys(field: string, keys: readonly string[], options?: SelectOption) { return this.storage.findAllByKeys(field, keys, options); }
|
|
58
|
+
create(input: Partial<T>, options?: SelectOption) { return this.storage.create(input, options); }
|
|
59
|
+
upsert(input: Partial<T>, options?: SelectOption) { return this.storage.upsert(input, options); }
|
|
60
|
+
upsertAll(inputs: readonly Partial<T>[], options?: SelectOption) { return this.storage.upsertAll(inputs, options); }
|
|
61
|
+
update(id: string, input: Partial<T>, options?: SelectOption) { return this.storage.update(id, input, options); }
|
|
62
|
+
delete(id: string) { return this.storage.delete(id); }
|
|
63
|
+
output(schema: SchemaView) { return this.storage.output(schema); }
|
|
64
|
+
get client(): unknown { return this.storage.client; }
|
|
132
65
|
}
|
|
133
66
|
|
|
134
67
|
return RepositoryBase as unknown as RepositoryConstructor<T>;
|
|
135
68
|
}
|
|
136
69
|
|
|
137
|
-
/**
|
|
138
|
-
* The aggregate. Its constructor takes the members' storage in the DECLARED order — the
|
|
139
|
-
* order `toProvider` fills its `deps` with, and the order a subclass hands back to `super()`
|
|
140
|
-
* when it declares a constructor of its own.
|
|
141
|
-
*/
|
|
70
|
+
/** The aggregate. */
|
|
142
71
|
function many<E extends readonly EntityConstructor[]>(entities: E): AggregateConstructor<E> {
|
|
143
72
|
class AggregateBase {
|
|
144
73
|
static readonly __entity = entities[0];
|
|
145
74
|
static readonly __owns = entities;
|
|
146
75
|
|
|
147
|
-
protected
|
|
76
|
+
protected storages: AggregateOf<E>;
|
|
148
77
|
|
|
149
|
-
constructor(...
|
|
150
|
-
this.
|
|
78
|
+
constructor(...storages: unknown[]) {
|
|
79
|
+
this.storages = storages.slice(0, entities.length) as AggregateOf<E>;
|
|
151
80
|
}
|
|
152
81
|
}
|
|
153
82
|
|
|
@@ -159,12 +88,7 @@ export function repositoryKeyOf(entity: string): string {
|
|
|
159
88
|
return `${upperFirst(entity)}Repository`;
|
|
160
89
|
}
|
|
161
90
|
|
|
162
|
-
/**
|
|
163
|
-
* The entities a class owns — empty for anything that is not an aggregate.
|
|
164
|
-
*
|
|
165
|
-
* Read from the mark rather than from the constructor, for the reason `Crud.__ops` exists:
|
|
166
|
-
* the AST scan is workspace-only, so an installed prefab resolves to nothing.
|
|
167
|
-
*/
|
|
91
|
+
/** The entities a class owns — empty for anything that is not an aggregate. */
|
|
168
92
|
export function ownedBy(ctor: unknown): readonly EntityConstructor[] {
|
|
169
93
|
return (ctor as { __owns?: readonly EntityConstructor[] } | undefined)?.__owns ?? [];
|
|
170
94
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
/** Which adapters a PROJECT could load, read off its dependencies. */
|
|
5
|
+
const ADAPTER_PACKAGE = /^@fougere\/adapter-(.+)$/;
|
|
6
|
+
|
|
7
|
+
/** The adapter names this project depends on — empty when it has no package.json to read. */
|
|
8
|
+
export async function adaptersOf(root: string): Promise<string[]> {
|
|
9
|
+
const manifest = await read(join(root, 'package.json'));
|
|
10
|
+
if (!manifest) return [];
|
|
11
|
+
|
|
12
|
+
const declared = { ...manifest.dependencies, ...manifest.devDependencies };
|
|
13
|
+
|
|
14
|
+
return Object.keys(declared)
|
|
15
|
+
.map((name) => ADAPTER_PACKAGE.exec(name)?.[1])
|
|
16
|
+
.filter((name): name is string => name !== undefined);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function read(path: string): Promise<Manifest | undefined> {
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(await readFile(path, 'utf8')) as Manifest;
|
|
22
|
+
} catch {
|
|
23
|
+
// No manifest, or one that is not JSON. Either way this cannot validate a name, and
|
|
24
|
+
// reporting every `adapters:` key as unknown would be worse than saying nothing.
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Manifest {
|
|
30
|
+
dependencies?: Record<string, string>;
|
|
31
|
+
devDependencies?: Record<string, string>;
|
|
32
|
+
}
|
package/src/scan/bundling.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a Fougere boot loads at RUNTIME, so a bundler must leave it alone.
|
|
3
|
-
*
|
|
4
|
-
* Stated once because it was stated twice and the two had already drifted: the Vite plugin
|
|
5
|
-
* listed `@fougere/schema`, `@fougere/adapter-graphql` and `@fougere/auth-better`, the Next
|
|
6
|
-
* one did not, and BOTH omitted the two packages `@fougere/app`'s boot actually imports
|
|
7
|
-
* dynamically — `@fougere/defaults` and `@fougere/transport-http`. A list a bundler reads
|
|
8
|
-
* has no way to notice it is wrong: nothing fails at build time, the app fails at boot.
|
|
9
|
-
*
|
|
10
|
-
* It sits here rather than beside the dynamic imports because both readers are BUILD-TIME
|
|
11
|
-
* plugins that already depend on core, and neither may pull the boot into a bundler config.
|
|
12
|
-
*/
|
|
1
|
+
/** What a Fougere boot loads at RUNTIME, so a bundler must leave it alone. */
|
|
13
2
|
export const RUNTIME_PACKAGES: readonly string[] = [
|
|
14
3
|
'@fougere/app',
|
|
15
4
|
'@fougere/core',
|
package/src/scan/conventions.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The names the scan READS instead of deriving them.
|
|
3
|
-
*
|
|
4
|
-
* Everything else a frond states, it states by its shape; these seven directories and the
|
|
5
|
-
* import prefix are the one place where a name is the declaration. They were spelled as
|
|
6
|
-
* literals in five packages, so a project could not move any of them and `frondsDir` was
|
|
7
|
-
* a declared key with no reader.
|
|
8
|
-
*/
|
|
1
|
+
/** The names the scan READS instead of deriving them. */
|
|
9
2
|
|
|
10
3
|
export interface Conventions {
|
|
11
|
-
/**
|
|
12
|
-
* The scope a frond's package name carries — `@fronds/blog`.
|
|
13
|
-
*
|
|
14
|
-
* A real package name, not only an alias: the CLI writes it as `name` in a scaffolded
|
|
15
|
-
* frond and as a `workspace:*` dependency in the app that consumes it.
|
|
16
|
-
*/
|
|
4
|
+
/** The scope a frond's package name carries — `@fronds/blog`. */
|
|
17
5
|
scope: string;
|
|
18
6
|
/** The directory holding fronds, below the project root. */
|
|
19
7
|
fronds: string;
|
|
@@ -31,12 +19,7 @@ export interface Conventions {
|
|
|
31
19
|
};
|
|
32
20
|
}
|
|
33
21
|
|
|
34
|
-
/**
|
|
35
|
-
* What a project means when it declares nothing — the convention itself.
|
|
36
|
-
*
|
|
37
|
-
* `@fronds` and not `@frond`: the npm org for the singular belongs to someone else, and a
|
|
38
|
-
* scope is a name that must be ownable.
|
|
39
|
-
*/
|
|
22
|
+
/** What a project means when it declares nothing — the convention itself. */
|
|
40
23
|
export const DEFAULT_CONVENTIONS: Conventions = {
|
|
41
24
|
scope: '@fronds',
|
|
42
25
|
fronds: 'fronds',
|
|
@@ -59,13 +42,7 @@ export type ConventionsInput = {
|
|
|
59
42
|
dirs?: Partial<Conventions['dirs']>;
|
|
60
43
|
};
|
|
61
44
|
|
|
62
|
-
/**
|
|
63
|
-
* The convention, with a project's exceptions folded in.
|
|
64
|
-
*
|
|
65
|
-
* Merged one level into `dirs` so renaming one directory does not require restating the
|
|
66
|
-
* other six — the same reading `sources:` and `ports:` get, where only the exception is
|
|
67
|
-
* declared.
|
|
68
|
-
*/
|
|
45
|
+
/** The convention, with a project's exceptions folded in. */
|
|
69
46
|
export function resolveConventions(input?: ConventionsInput): Conventions {
|
|
70
47
|
return {
|
|
71
48
|
scope: input?.scope ?? DEFAULT_CONVENTIONS.scope,
|
|
@@ -79,23 +56,12 @@ export function frondPackage(name: string, conventions: Conventions): string {
|
|
|
79
56
|
return `${conventions.scope}/${name}`;
|
|
80
57
|
}
|
|
81
58
|
|
|
82
|
-
/**
|
|
83
|
-
* Directories whose classes register as providers — two spellings, one behaviour.
|
|
84
|
-
*
|
|
85
|
-
* A project may point both roles at one directory; the scan must then read it once, or
|
|
86
|
-
* every provider would be registered twice.
|
|
87
|
-
*/
|
|
59
|
+
/** Directories whose classes register as providers — two spellings, one behaviour. */
|
|
88
60
|
export function providerDirsOf(conventions: Conventions): string[] {
|
|
89
61
|
return [...new Set([conventions.dirs.services, conventions.dirs.repositories])];
|
|
90
62
|
}
|
|
91
63
|
|
|
92
|
-
/**
|
|
93
|
-
* The frond vocabulary — every directory the scan reads.
|
|
94
|
-
*
|
|
95
|
-
* What a reader needs to bound a frond: the Nuxt module watches these for the root frond
|
|
96
|
-
* (watching the root itself would match every write), and a flat app's tsconfig lists
|
|
97
|
-
* them instead of `["."]`, which would swallow `app/` and `nuxt.config.ts`.
|
|
98
|
-
*/
|
|
64
|
+
/** The frond vocabulary — every directory the scan reads. */
|
|
99
65
|
export function frondDirsOf(conventions: Conventions): string[] {
|
|
100
66
|
const { entities, handlers, presenters, collectors, seeds, versions } = conventions.dirs;
|
|
101
67
|
return [...new Set([
|
package/src/scan/emit.ts
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The scan, written down as a module — what `createApp` is handed where there is no disk.
|
|
3
|
-
*
|
|
4
|
-
* It RE-RESOLVES NOTHING. By the time this runs the scan has already decided what every
|
|
5
|
-
* slot holds, and `resolveSchema` put the entity's own class in `contract.output` — the
|
|
6
|
-
* very object `EntityEntry.entityClass` holds. So the emitter keeps a table from object
|
|
7
|
-
* to import alias and writes the alias. Identity is preserved because it is the same
|
|
8
|
-
* object that becomes the same import, which is what three call sites depend on
|
|
9
|
-
* (`adapter/graphql`'s `view === entity.entityClass` and its WeakMap, and `bootstrap`'s
|
|
10
|
-
* `outputSchema !== entity.entityClass`). An emitter that re-resolved instead would build
|
|
11
|
-
* a second class for `Post` and those three would silently take the other branch.
|
|
12
|
-
*
|
|
13
|
-
* Measured on three real projects: every live reference is either a class the descriptor
|
|
14
|
-
* already names by `filePath`, a named export of the file that declared the signature, or
|
|
15
|
-
* `Partial<X>` — the one derivation `resolveSchema` fabricates.
|
|
16
|
-
*/
|
|
1
|
+
/** The scan, written down as a module — what `createApp` is handed where there is no disk. */
|
|
17
2
|
import { dirname, relative } from 'node:path';
|
|
18
3
|
import { ANONYMOUS_SCHEMA_NAME, Card, type SchemaView } from '@fougere/schema';
|
|
19
|
-
import type {
|
|
20
|
-
|
|
21
|
-
PresenterEntry, CollectorEntry, ProviderEntry, SeedEntry,
|
|
22
|
-
} from './frond.js';
|
|
4
|
+
import type { FrondDescriptor, EntityEntry, HandlerEntry, PresenterEntry, CollectorEntry, ProviderEntry, SeedEntry } from '../descriptor/frond.js';
|
|
5
|
+
import type { ScanResult } from './result.js';
|
|
23
6
|
import type { OperationContract } from '../wire/operation.js';
|
|
24
7
|
|
|
25
8
|
export interface EmitOptions {
|
|
@@ -34,14 +17,7 @@ type Live = object;
|
|
|
34
17
|
/** Is a TypeScript compiler going to read this module? Its name is the only thing that says. */
|
|
35
18
|
const isTypeScript = (outFile: string): boolean => /\.tsx?$/.test(outFile);
|
|
36
19
|
|
|
37
|
-
/**
|
|
38
|
-
* A source file becomes a specifier its reader can follow — and the two readers differ.
|
|
39
|
-
*
|
|
40
|
-
* A `.ts` destination is compiled by tsc under Node16 resolution, which spells a
|
|
41
|
-
* TypeScript source with `.js`. A `.mjs` destination is read by a bundler, which resolves
|
|
42
|
-
* the path AS IT IS ON DISK — measured, Nitro's rollup refused `Post.seed.js` because no
|
|
43
|
-
* such file exists. One rule, read off the destination, exactly like the type annotation.
|
|
44
|
-
*/
|
|
20
|
+
/** A source file becomes a specifier its reader can follow — and the two readers differ. */
|
|
45
21
|
function specifierOf(filePath: string, outFile: string): string {
|
|
46
22
|
const path = relative(dirname(outFile), filePath);
|
|
47
23
|
const rel = isTypeScript(outFile) ? path.replace(/\.tsx?$/, '.js') : path;
|
|
@@ -83,15 +59,7 @@ class Imports {
|
|
|
83
59
|
render(): string { return this.lines.join('\n'); }
|
|
84
60
|
}
|
|
85
61
|
|
|
86
|
-
/**
|
|
87
|
-
* What a schema slot becomes in the generated module.
|
|
88
|
-
*
|
|
89
|
-
* Three answers, and the third is the only rule: a class already imported is its alias; a
|
|
90
|
-
* named export of the file that declared the signature is imported by its own name — it
|
|
91
|
-
* IS exported there, because that is where `resolveSchema` found it; and an anonymous
|
|
92
|
-
* schema is `Partial<X>`, the one derivation `resolveSchema` builds, so it is written as
|
|
93
|
-
* the derivation rather than as a value.
|
|
94
|
-
*/
|
|
62
|
+
/** What a schema slot becomes in the generated module. */
|
|
95
63
|
function schemaRef(schema: SchemaView | undefined, declaredIn: string, imports: Imports): string | undefined {
|
|
96
64
|
if (!schema) return undefined;
|
|
97
65
|
const known = imports.aliasOf(schema as Live);
|
|
@@ -180,11 +148,7 @@ function frondOf(f: FrondDescriptor, imports: Imports): string {
|
|
|
180
148
|
].filter(Boolean).join('\n');
|
|
181
149
|
}
|
|
182
150
|
|
|
183
|
-
/**
|
|
184
|
-
* Write a scan down. The result is a TypeScript module whose only imports are the classes
|
|
185
|
-
* the scan found — static, so a bundler traces them — and whose only value is the
|
|
186
|
-
* descriptor `createApp` asks for.
|
|
187
|
-
*/
|
|
151
|
+
/** Write a scan down. */
|
|
188
152
|
export function emitScan(result: ScanResult, options: EmitOptions): string {
|
|
189
153
|
const imports = new Imports(options.outFile);
|
|
190
154
|
const core = options.core ?? '@fougere/core';
|
|
@@ -222,7 +186,7 @@ import { Fronds } from '${core}';
|
|
|
222
186
|
${typed ? `import type { ScanResult } from '${core}';\n` : ''}${imports.render()}
|
|
223
187
|
|
|
224
188
|
export const scan${typed ? ': ScanResult' : ''} = {
|
|
225
|
-
fronds: Fronds.
|
|
189
|
+
fronds: Fronds.hosting([
|
|
226
190
|
${fronds}
|
|
227
191
|
]),
|
|
228
192
|
diagnostics: [${diagnostics.join(', ')}],
|