@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/dist/prefab/crud.js
CHANGED
|
@@ -1,41 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { lowerFirst } from '@fougere/schema';
|
|
2
|
+
import { targetOf } from './prefab.js';
|
|
3
|
+
/**
|
|
4
|
+
* So a class is recognized by what it ANSWERS, since the mixin leaves no other trace.
|
|
5
|
+
* FR : pour qu'une classe se reconnaisse à ce qu'elle répond, le mixin ne laissant rien d'autre.
|
|
6
|
+
* `inheritsCrud(class PostHandler extends Crud(Post) {})` → `true`
|
|
7
|
+
*/
|
|
8
|
+
export function inheritsCrud(ctor) {
|
|
9
|
+
const proto = ctor?.prototype;
|
|
10
|
+
return typeof proto?.list === 'function' && typeof proto?.findById === 'function';
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
* GraphQL argument needs the type. So a producer that fills only `binding` leaves
|
|
9
|
-
* `adapter/graphql` with nothing to declare — it drops the op (`registerOperations`,
|
|
10
|
-
* `if (!sig) continue`) and four of the five CRUD ops vanish from the schema while
|
|
11
|
-
* the façade and REST still serve them. Measured on an installed app: 16 handlers,
|
|
12
|
-
* 14 with unresolvable heritage, zero `createX` in the schema.
|
|
13
|
+
* So storage follows the shape the handler was built on, which may differ from its address.
|
|
14
|
+
* FR : pour que le stockage suive la forme sur laquelle le handler est bâti.
|
|
15
|
+
* `subjectOf(class Draft extends Crud(Post) {}, 'draft')` → `'post'`
|
|
13
16
|
*/
|
|
17
|
+
export function subjectOf(ctor, address) {
|
|
18
|
+
const target = targetOf(ctor);
|
|
19
|
+
return target?.name ? lowerFirst(target.name) : address;
|
|
20
|
+
}
|
|
21
|
+
/** The id of the row an op acts on — a route segment, or a query fallback. */
|
|
22
|
+
const byId = { name: 'id', source: { kind: 'param', name: 'id' }, optional: false };
|
|
23
|
+
const fromBody = { name: 'input', source: { kind: 'input' }, optional: false };
|
|
24
|
+
/** The same five, written as the scan would have written them. */
|
|
14
25
|
const idParam = { name: 'id', type: { raw: 'string', name: 'string' } };
|
|
15
26
|
const inputParam = (entity) => ({ name: 'input', type: { raw: `Partial<${entity}>`, name: entity } });
|
|
16
27
|
const returns = (raw, name, extra) => ({ raw, name, ...extra });
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* The mixin built them, so it alone knows their contract in full: what judges
|
|
21
|
-
* their input, where each argument comes from. It says so on the class, at
|
|
22
|
-
* runtime — which is what makes the guarantee independent of the AST scan (an
|
|
23
|
-
* installed app cannot resolve this file, and never needs to).
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* `output` says the entity, and saying it costs nothing at runtime.
|
|
27
|
-
*
|
|
28
|
-
* The façade already projected onto the entity when nothing else was named, so this
|
|
29
|
-
* changes no result: `outputFieldsFor` reads `contractOutput` and falls back to the
|
|
30
|
-
* entity, and both are the same shape here. What changes is that the sentence now
|
|
31
|
-
* EXISTS — the identity card publishes `output` per op, and a card was measured
|
|
32
|
-
* carrying none at all (2026-08-06, ten ops, zero outputs), which typed every remote
|
|
33
|
-
* return as `unknown` for anyone building on it.
|
|
34
|
-
*
|
|
35
|
-
* It does not close the view: only an explicit `__opOutputs` does (`closed: perOp !==
|
|
36
|
-
* undefined`), so a named view still wins and a presenter's computed fields still ride
|
|
37
|
-
* out. `delete` names none — a boolean is not a shape.
|
|
38
|
-
*/
|
|
28
|
+
/** The five ops a Crud handler brings, declared rather than discovered. */
|
|
29
|
+
/** `output` says the entity, and saying it costs nothing at runtime. */
|
|
39
30
|
function crudOps(entity) {
|
|
40
31
|
const name = entity.name ?? 'Entity';
|
|
41
32
|
const input = inputParam(name);
|
|
@@ -68,52 +59,34 @@ function crudOps(entity) {
|
|
|
68
59
|
},
|
|
69
60
|
};
|
|
70
61
|
}
|
|
71
|
-
/**
|
|
72
|
-
* The mixin's single "trust me" point — the twin of `asSchemaConstructor` in @fougere/schema.
|
|
73
|
-
*
|
|
74
|
-
* The implementation returns whatever the ORM hands back; the declaration names the view
|
|
75
|
-
* each op emits at the port. TypeScript cannot connect the two (the view is a runtime
|
|
76
|
-
* argument, the type is a generic), so one assertion states that the mixin honours what it
|
|
77
|
-
* declared — and the façade makes it true, projecting each op's result onto its view
|
|
78
|
-
* (`outputFieldsFor` in `bootstrap.ts`).
|
|
79
|
-
*/
|
|
62
|
+
/** The mixin's single "trust me" point — the twin of `asSchemaConstructor` in @fougere/schema. */
|
|
80
63
|
function asCrudConstructor(impl) {
|
|
81
64
|
return impl;
|
|
82
65
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Mixin — extends Crud(Entity) to get all 5 typed CRUD methods.
|
|
85
|
-
*
|
|
86
|
-
* The second argument (optional) names the view the ops emit, and comes in two
|
|
87
|
-
* spellings of one idea — a view per op, or one view for all five:
|
|
88
|
-
*
|
|
89
|
-
* Crud(Post) → every op emits Post
|
|
90
|
-
* Crud(Post, { list: PostCard }) → list emits cards, the rest emit Post. Declaration
|
|
91
|
-
* only: the handler keeps its full-row ORM, so a
|
|
92
|
-
* judge can still read `body`.
|
|
93
|
-
* Crud(Post, PostPublic) → every op emits PostPublic, and the bootstrap
|
|
94
|
-
* scopes the injected ORM via .output(PostPublic) —
|
|
95
|
-
* the whole handler speaks the restricted view.
|
|
96
|
-
*/
|
|
66
|
+
/** Mixin — extends Crud(Entity) to get all 5 typed CRUD methods. */
|
|
97
67
|
export function Crud(entity, output) {
|
|
98
68
|
// A view is a class (it carries fields) ; a map of views is a plain object.
|
|
99
69
|
const perOp = typeof output === 'object' && output !== null ? output : undefined;
|
|
100
70
|
const wholeHandler = typeof output === 'function' ? output : undefined;
|
|
101
71
|
return asCrudConstructor(class CrudHandler {
|
|
102
72
|
static __entity = entity;
|
|
103
|
-
/** Handler-wide view only — a per-op map must NOT scope the
|
|
73
|
+
/** Handler-wide view only — a per-op map must NOT scope the storage the validators read. */
|
|
104
74
|
static __output = wholeHandler ?? entity;
|
|
105
75
|
static __opOutputs = perOp;
|
|
106
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* What this prefab handler declares — read by the façade, merged under the author's own
|
|
78
|
+
* methods.
|
|
79
|
+
*/
|
|
107
80
|
static __ops = crudOps(entity);
|
|
108
|
-
|
|
109
|
-
constructor(
|
|
110
|
-
this.
|
|
81
|
+
storage;
|
|
82
|
+
constructor(storage) {
|
|
83
|
+
this.storage = storage;
|
|
111
84
|
}
|
|
112
|
-
async list(options) { return this.
|
|
113
|
-
async findById(id) { return this.
|
|
114
|
-
async create(input) { return this.
|
|
115
|
-
async update(id, input) { return this.
|
|
116
|
-
async delete(id) { return this.
|
|
85
|
+
async list(options) { return this.storage.list(options); }
|
|
86
|
+
async findById(id) { return this.storage.findById(id); }
|
|
87
|
+
async create(input) { return this.storage.create(input); }
|
|
88
|
+
async update(id, input) { return this.storage.update(id, input); }
|
|
89
|
+
async delete(id) { return this.storage.delete(id); }
|
|
117
90
|
});
|
|
118
91
|
}
|
|
119
92
|
//# sourceMappingURL=crud.js.map
|
package/dist/prefab/crud.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../src/prefab/crud.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../src/prefab/crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,iBAAiB,CAAC;AAGtF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,MAAM,KAAK,GAAI,IAA4D,EAAE,SAAS,CAAC;IAEvF,OAAO,OAAO,KAAK,EAAE,IAAI,KAAK,UAAU,IAAI,OAAO,KAAK,EAAE,QAAQ,KAAK,UAAU,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa,EAAE,OAAe;IACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1D,CAAC;AAED,8EAA8E;AAC9E,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAA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,CAAC,CAAC,CAAC;QAClG,KAAK,CAAC,MAAM,CAAC,EAAU,IAAsB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC"}
|
package/dist/prefab/mirror.d.ts
CHANGED
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
import { type EntityConstructor } from '@fougere/schema';
|
|
2
|
-
import type {
|
|
3
|
-
/**
|
|
4
|
-
* A paginated local copy of a source that cannot be queried directly.
|
|
5
|
-
*
|
|
6
|
-
* The shape must contain an `updated()` field used as a high-water mark. Subclasses
|
|
7
|
-
* implement `pull`; `refresh` validates and upserts each returned page.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* export default class PartnerCatalog extends Mirror(BookCard) {
|
|
11
|
-
* constructor(orm: EntityOrm<BookCard>, private catalog: Facade<CatalogHandler>) {
|
|
12
|
-
* super(orm);
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* async *pull(since?: Date) {
|
|
16
|
-
* for (let page = 0; page !== null;) {
|
|
17
|
-
* const body = await fetch(`${api}?page=${page}&since=${since?.toISOString() ?? ''}`);
|
|
18
|
-
* const { items, next } = await body.json();
|
|
19
|
-
* yield items.map(toCard);
|
|
20
|
-
* page = next;
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
2
|
+
import type { Storage } from '../storage.js';
|
|
3
|
+
/** A paginated local copy of a source that cannot be queried directly. */
|
|
26
4
|
/** What one refresh did — enough to log it, and to decide whether to run again. */
|
|
27
5
|
export interface Refreshed {
|
|
28
|
-
/**
|
|
6
|
+
/** Instances written, counting a replaced one once. */
|
|
29
7
|
written: number;
|
|
30
8
|
/** The age the pull was asked to start from — absent on the first ever run. */
|
|
31
9
|
since?: Date;
|
|
@@ -34,7 +12,7 @@ export interface Refreshed {
|
|
|
34
12
|
}
|
|
35
13
|
export interface MirrorOf<T> {
|
|
36
14
|
/** The copy's own storage — where a page lands, and where its age is read. */
|
|
37
|
-
|
|
15
|
+
storage: Storage<T>;
|
|
38
16
|
/** Pages of rows to write. The one thing a mirror's author supplies. */
|
|
39
17
|
pull(since?: Date): AsyncIterable<Partial<T>[]>;
|
|
40
18
|
/** Run one pass: read the high-water mark, pull from there, write each page. */
|
|
@@ -43,7 +21,7 @@ export interface MirrorOf<T> {
|
|
|
43
21
|
freshness(): Promise<Date | undefined>;
|
|
44
22
|
}
|
|
45
23
|
export interface MirrorConstructor<T> {
|
|
46
|
-
new (
|
|
24
|
+
new (storage: Storage<T>): MirrorOf<T>;
|
|
47
25
|
readonly __entity: unknown;
|
|
48
26
|
}
|
|
49
27
|
export declare function Mirror<E extends EntityConstructor>(shape: E): MirrorConstructor<InstanceType<E>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAe,MAAM,iBAAiB,CAAC;AACjF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,0EAA0E;AAC1E,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD,gFAAgF;IAChF,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9B,oFAAoF;IACpF,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,iBAAiB,EAAE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAyChG;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO7D"}
|
package/dist/prefab/mirror.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lifecycle } from '@fougere/schema';
|
|
2
2
|
export function Mirror(shape) {
|
|
3
3
|
// Refuse an undated copy before it can be used as if it held live rows.
|
|
4
4
|
const declared = ageFieldOf(shape);
|
|
@@ -8,14 +8,14 @@ export function Mirror(shape) {
|
|
|
8
8
|
}
|
|
9
9
|
const age = declared;
|
|
10
10
|
class MirrorBase {
|
|
11
|
-
|
|
11
|
+
storage;
|
|
12
12
|
static __entity = shape;
|
|
13
|
-
constructor(
|
|
14
|
-
this.
|
|
13
|
+
constructor(storage) {
|
|
14
|
+
this.storage = storage;
|
|
15
15
|
}
|
|
16
16
|
/** The freshest persisted stamp; no process-local freshness state is kept. */
|
|
17
17
|
async freshness() {
|
|
18
|
-
const [newest] = await this.
|
|
18
|
+
const [newest] = await this.storage.list({ orderBy: age, order: 'desc', limit: 1 });
|
|
19
19
|
const value = newest?.[age];
|
|
20
20
|
return value instanceof Date ? value : undefined;
|
|
21
21
|
}
|
|
@@ -27,7 +27,7 @@ export function Mirror(shape) {
|
|
|
27
27
|
for await (const page of this.pull(since)) {
|
|
28
28
|
if (page.length === 0)
|
|
29
29
|
continue;
|
|
30
|
-
written += await this.
|
|
30
|
+
written += await this.storage.upsertAll(page);
|
|
31
31
|
}
|
|
32
32
|
return { written, since, ms: Date.now() - started };
|
|
33
33
|
}
|
|
@@ -45,22 +45,4 @@ export function ageFieldOf(shape) {
|
|
|
45
45
|
}
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
|
-
/** Validate and decode a page, naming a refused row by its declared primary field. */
|
|
49
|
-
function judgePage(shape, page) {
|
|
50
|
-
const judge = shape.validate;
|
|
51
|
-
if (typeof judge !== 'function')
|
|
52
|
-
return page;
|
|
53
|
-
const name = shape.name ?? 'mirror';
|
|
54
|
-
const fields = shape.getFields?.();
|
|
55
|
-
const primary = fields ? FieldSet.of(fields).primary : undefined;
|
|
56
|
-
return page.map((row, index) => {
|
|
57
|
-
const verdict = judge.call(shape, row);
|
|
58
|
-
if (verdict.success)
|
|
59
|
-
return verdict.data;
|
|
60
|
-
const key = primary === undefined ? undefined : row[primary];
|
|
61
|
-
const where = key !== undefined ? `row ${primary} ${JSON.stringify(key)}` : `row ${index} of this page`;
|
|
62
|
-
const why = verdict.errors.map((e) => `${e.path}: ${e.message}`).join(', ');
|
|
63
|
-
throw new Error(`${name} mirror refused ${where} — ${why}`);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
48
|
//# sourceMappingURL=mirror.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.js","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mirror.js","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,iBAAiB,CAAC;AA8BjF,MAAM,UAAU,MAAM,CAA8B,KAAQ;IAG1D,wEA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AE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QACtD,CAAC;;IAGH,OAAO,UAA6C,CAAC;AACvD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,MAAM,GAAI,KAAsC,CAAC,SAAS,EAAE,EAAE,CAAC;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC;IACvD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/prefab/prefab.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { EntityConstructor } from '@fougere/schema';
|
|
2
2
|
import type { PresenterViews } from './presenter.js';
|
|
3
|
-
/**
|
|
4
|
-
* The shape a prefab was built on, or `undefined` when the class is not one.
|
|
5
|
-
*
|
|
6
|
-
* A plain property read: JavaScript walks a constructor's own prototype chain, so a
|
|
7
|
-
* subclass of a prefab answers what its base recorded. Three of the five accessors this
|
|
8
|
-
* replaces walked that chain by hand, and two did not — one question, two mechanisms.
|
|
9
|
-
*/
|
|
3
|
+
/** The shape a prefab was built on, or `undefined` when the class is not one. */
|
|
10
4
|
export declare function targetOf(ctor: unknown): EntityConstructor | undefined;
|
|
11
5
|
/** The views a prefab declares, same rule. */
|
|
12
6
|
export declare function viewsOf(ctor: unknown): PresenterViews | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefab.d.ts","sourceRoot":"","sources":["../../src/prefab/prefab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"prefab.d.ts","sourceRoot":"","sources":["../../src/prefab/prefab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAYrD,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAErE;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAEjE;AAED,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAErE"}
|
package/dist/prefab/prefab.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The shape a prefab was built on, or `undefined` when the class is not one.
|
|
3
|
-
*
|
|
4
|
-
* A plain property read: JavaScript walks a constructor's own prototype chain, so a
|
|
5
|
-
* subclass of a prefab answers what its base recorded. Three of the five accessors this
|
|
6
|
-
* replaces walked that chain by hand, and two did not — one question, two mechanisms.
|
|
7
|
-
*/
|
|
1
|
+
/** The shape a prefab was built on, or `undefined` when the class is not one. */
|
|
8
2
|
export function targetOf(ctor) {
|
|
9
3
|
return ctor?.__entity;
|
|
10
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefab.js","sourceRoot":"","sources":["../../src/prefab/prefab.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefab.js","sourceRoot":"","sources":["../../src/prefab/prefab.ts"],"names":[],"mappings":"AAaA,iFAAiF;AACjF,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,OAAQ,IAA2B,EAAE,QAAQ,CAAC;AAChD,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,OAAO,CAAC,IAAa;IACnC,OAAQ,IAA2B,EAAE,OAAO,CAAC;AAC/C,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,OAAQ,IAA2B,EAAE,QAAQ,CAAC;AAChD,CAAC"}
|
|
@@ -1,45 +1,11 @@
|
|
|
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
|
import { type EntityConstructor } from '@fougere/schema';
|
|
25
3
|
/**
|
|
26
4
|
* The view a computed field emits — `OrderItemView` for one, `[OrderItemView]` for many.
|
|
27
5
|
* A view is a schema, so it derives: `Order.pick('id', 'status')`, never a hand-written type.
|
|
28
6
|
*/
|
|
29
7
|
export type PresenterViews = Record<string, EntityConstructor | [EntityConstructor]>;
|
|
30
|
-
/**
|
|
31
|
-
* `Presenter(Order, { items: [OrderItemView], user: UserCard })` — the second argument names
|
|
32
|
-
* the view each computed field emits, exactly as `Crud(Post, { list: PostCard })` names an
|
|
33
|
-
* op's. What fabricates a field declares its contract, and it declares it **once**: the
|
|
34
|
-
* façade applies the presenter (see `PresenterExecutor`), and every surface reads the same statement
|
|
35
|
-
* instead of guessing.
|
|
36
|
-
*
|
|
37
|
-
* Guessing was the cost of not stating it. The scan can read a scalar off a return type and
|
|
38
|
-
* nothing more, so a field returning an object had no derivable shape: the GraphQL projection
|
|
39
|
-
* fell back to a serialized `String`, and a client asking `items { quantity }` got a schema
|
|
40
|
-
* error on a field REST served whole. Declaring is optional — a scalar field needs nothing,
|
|
41
|
-
* and an undeclared object keeps the old behaviour.
|
|
42
|
-
*/
|
|
8
|
+
/** `Presenter(Order, { items. */
|
|
43
9
|
export declare function Presenter<E extends EntityConstructor>(entity: E, views?: PresenterViews): {
|
|
44
10
|
new (): {};
|
|
45
11
|
readonly __entity: E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presenter.d.ts","sourceRoot":"","sources":["../../src/prefab/presenter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"presenter.d.ts","sourceRoot":"","sources":["../../src/prefab/presenter.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAErF,iCAAiC;AACjC,wBAAgB,SAAS,CAAC,CAAC,SAAS,iBAAiB,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc;;;;EAMvF;AAED,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAG3D;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/dist/prefab/presenter.js
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
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
|
import { upperFirst } from '@fougere/schema';
|
|
25
|
-
/**
|
|
26
|
-
* `Presenter(Order, { items: [OrderItemView], user: UserCard })` — the second argument names
|
|
27
|
-
* the view each computed field emits, exactly as `Crud(Post, { list: PostCard })` names an
|
|
28
|
-
* op's. What fabricates a field declares its contract, and it declares it **once**: the
|
|
29
|
-
* façade applies the presenter (see `PresenterExecutor`), and every surface reads the same statement
|
|
30
|
-
* instead of guessing.
|
|
31
|
-
*
|
|
32
|
-
* Guessing was the cost of not stating it. The scan can read a scalar off a return type and
|
|
33
|
-
* nothing more, so a field returning an object had no derivable shape: the GraphQL projection
|
|
34
|
-
* fell back to a serialized `String`, and a client asking `items { quantity }` got a schema
|
|
35
|
-
* error on a field REST served whole. Declaring is optional — a scalar field needs nothing,
|
|
36
|
-
* and an undeclared object keeps the old behaviour.
|
|
37
|
-
*/
|
|
3
|
+
/** `Presenter(Order, { items. */
|
|
38
4
|
export function Presenter(entity, views) {
|
|
39
5
|
class PresenterBase {
|
|
40
6
|
static __entity = entity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presenter.js","sourceRoot":"","sources":["../../src/prefab/presenter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"presenter.js","sourceRoot":"","sources":["../../src/prefab/presenter.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AAQrE,iCAAiC;AACjC,MAAM,UAAU,SAAS,CAA8B,MAAS,EAAE,KAAsB;IACtF,MAAM,aAAa;QACjB,MAAM,CAAU,QAAQ,GAAG,MAAM,CAAC;QAClC,MAAM,CAAU,OAAO,GAAG,KAAK,CAAC;;IAElC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAAC,IAAc;IAC/C,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC;SAC9C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,aAAa,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AAC5F,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC;AAC1C,CAAC"}
|
|
@@ -1,90 +1,27 @@
|
|
|
1
1
|
import { type EntityConstructor } from '@fougere/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Storage } from '../storage.js';
|
|
3
|
+
/** Repository(…entities) — who owns an entity's storage, and where its questions are named. */
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* **The arity decides**, which is the second reading of what `orm.ts` already states for
|
|
7
|
-
* `EntityOrm` against `Together`: the arity of the unit is the whole distinction.
|
|
8
|
-
*
|
|
9
|
-
* ONE entity — the repository IS that entity's storage, with your methods added. The port's
|
|
10
|
-
* thirteen gestures are forwarded, so a handler reads `this.posts.list()` whether or not
|
|
11
|
-
* anyone wrote the file, and a named question sits beside them:
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* // repositories/PostRepository.ts
|
|
15
|
-
* export default class PostRepository extends Repository(Post) {
|
|
16
|
-
* published() {
|
|
17
|
-
* return this.list({ where: { status: 'published' }, orderBy: 'publishedAt', order: 'desc' });
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* TWO OR MORE — an aggregate. It owns them: nothing else in the app is handed their
|
|
23
|
-
* storage, and no gesture is forwarded (which entity would `create` write to?), so the only
|
|
24
|
-
* way in is a method this class names. That is what lets a rule spanning two tables exist:
|
|
25
|
-
* it is ordinary TypeScript inside the method that does the writing.
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* // repositories/CommandeRepository.ts
|
|
29
|
-
* export default class CommandeRepository extends Repository(Commande, Stock) {
|
|
30
|
-
* avecLignes(id: string) {
|
|
31
|
-
* const [commandes, stock] = this.orms;
|
|
32
|
-
* …
|
|
33
|
-
* }
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* `this.orms` is protected, because the whole point is that the storage stops at this file.
|
|
38
|
-
* `protected` is erased at runtime, like `abstract` on a port: a compile-time guarantee, not
|
|
39
|
-
* a barrier. The same bargain, already accepted.
|
|
40
|
-
*
|
|
41
|
-
* **The boundary is not the unit of work.** An aggregate says the rules of these entities
|
|
42
|
-
* hold together; a frame says these writes land together, and the two lists coincide only
|
|
43
|
-
* often. Deriving the frame from the membership would make a read-only aggregate carry one
|
|
44
|
-
* — refusals included, and `registerFrames` refuses without storage or over `remotes:` —
|
|
45
|
-
* and would put `Together<[Commande, Stock], [StockMirror]>` out of reach forever. So a
|
|
46
|
-
* frame is ASKED FOR here as anywhere else, which is what makes it declared:
|
|
47
|
-
*
|
|
48
|
-
* ```ts
|
|
49
|
-
* constructor(commandes: CommandeOrm, stock: StockOrm, private frame: Together<[Commande, Stock]>) {
|
|
50
|
-
* super(commandes, stock);
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* The ORM words come back in that line, and only there: this class IS the holder, which is
|
|
55
|
-
* the one case `boot/ownership.ts` lets name the storage it was built on.
|
|
56
|
-
*
|
|
57
|
-
* A repository is NOT a door: it has no façade, so nothing here is reachable from the wire.
|
|
5
|
+
* The shape a repository of ONE entity has — the port itself, plus whatever the subclass names on
|
|
6
|
+
* top.
|
|
58
7
|
*/
|
|
59
|
-
|
|
60
|
-
* The shape a repository of ONE entity has — the port itself, plus whatever the subclass
|
|
61
|
-
* names on top. Written by an author who has not written the file: `RepositoryOf<Post>` is
|
|
62
|
-
* to `PostRepository` what `EntityOrm<Post>` is to `PostOrm`, one spelling of one key, and
|
|
63
|
-
* `depKeyOf` reads both.
|
|
64
|
-
*/
|
|
65
|
-
export type RepositoryOf<T> = EntityOrm<T>;
|
|
8
|
+
export type RepositoryOf<T> = Storage<T>;
|
|
66
9
|
/** The single-entity form: the port, plus whatever the subclass names. */
|
|
67
10
|
export interface RepositoryConstructor<T> {
|
|
68
|
-
new (
|
|
11
|
+
new (storage: Storage<T>): Storage<T>;
|
|
69
12
|
readonly __entity: unknown;
|
|
70
13
|
}
|
|
71
|
-
/**
|
|
72
|
-
* What an aggregate's subclass sees: the storage of the members it owns, in declared order,
|
|
73
|
-
* and `protected` — the storage stops at that file, which is the whole mechanism.
|
|
74
|
-
*
|
|
75
|
-
* A class and not an interface, because `protected` cannot be spelled in one. Ambient: the
|
|
76
|
-
* value it describes is fabricated by `many()` for an arity only known at the call.
|
|
77
|
-
*/
|
|
14
|
+
/** What an aggregate's subclass sees. */
|
|
78
15
|
declare abstract class AggregateShape<E extends readonly EntityConstructor[]> {
|
|
79
|
-
protected
|
|
80
|
-
[K in keyof E]:
|
|
16
|
+
protected storages: {
|
|
17
|
+
[K in keyof E]: Storage<InstanceType<E[K]>>;
|
|
81
18
|
};
|
|
82
19
|
}
|
|
83
20
|
/** The tuple an aggregate holds — the readable form of {@link AggregateShape}'s member. */
|
|
84
21
|
export type AggregateOf<E extends readonly EntityConstructor[]> = {
|
|
85
|
-
[K in keyof E]:
|
|
22
|
+
[K in keyof E]: Storage<InstanceType<E[K]>>;
|
|
86
23
|
};
|
|
87
|
-
export type AggregateConstructor<E extends readonly EntityConstructor[]> = (new (...
|
|
24
|
+
export type AggregateConstructor<E extends readonly EntityConstructor[]> = (new (...storages: unknown[]) => AggregateShape<E>) & {
|
|
88
25
|
readonly __entity: unknown;
|
|
89
26
|
/** The entities this class owns. Present from two on — an owner of one owns nothing. */
|
|
90
27
|
readonly __owns: E;
|
|
@@ -93,12 +30,7 @@ export declare function Repository<E extends EntityConstructor>(entity: E): Repo
|
|
|
93
30
|
export declare function Repository<E extends readonly [EntityConstructor, EntityConstructor, ...EntityConstructor[]]>(...entities: E): AggregateConstructor<E>;
|
|
94
31
|
/** Container key of an entity's repository — 'reading' → 'ReadingRepository'. */
|
|
95
32
|
export declare function repositoryKeyOf(entity: string): string;
|
|
96
|
-
/**
|
|
97
|
-
* The entities a class owns — empty for anything that is not an aggregate.
|
|
98
|
-
*
|
|
99
|
-
* Read from the mark rather than from the constructor, for the reason `Crud.__ops` exists:
|
|
100
|
-
* the AST scan is workspace-only, so an installed prefab resolves to nothing.
|
|
101
|
-
*/
|
|
33
|
+
/** The entities a class owns — empty for anything that is not an aggregate. */
|
|
102
34
|
export declare function ownedBy(ctor: unknown): readonly EntityConstructor[];
|
|
103
35
|
export {};
|
|
104
36
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/prefab/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/prefab/repository.ts"],"names":[],"mappings":"AAAA,OAA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