@fougere/core 0.6.0-alpha.0 → 0.8.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.
Files changed (510) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/AppLifecycle.d.ts +1 -1
  3. package/dist/boot/AppLifecycle.d.ts.map +1 -1
  4. package/dist/boot/AppLifecycle.js +13 -2
  5. package/dist/boot/AppLifecycle.js.map +1 -1
  6. package/dist/boot/Emissions.d.ts +13 -90
  7. package/dist/boot/Emissions.d.ts.map +1 -1
  8. package/dist/boot/Emissions.js +21 -118
  9. package/dist/boot/Emissions.js.map +1 -1
  10. package/dist/boot/ambient-port.d.ts +3 -24
  11. package/dist/boot/ambient-port.d.ts.map +1 -1
  12. package/dist/boot/ambient.als.d.ts.map +1 -1
  13. package/dist/boot/ambient.als.js +7 -12
  14. package/dist/boot/ambient.als.js.map +1 -1
  15. package/dist/boot/ambient.queue.d.ts +2 -5
  16. package/dist/boot/ambient.queue.d.ts.map +1 -1
  17. package/dist/boot/ambient.queue.js.map +1 -1
  18. package/dist/boot/apply.d.ts +1 -13
  19. package/dist/boot/apply.d.ts.map +1 -1
  20. package/dist/boot/apply.js +9 -16
  21. package/dist/boot/apply.js.map +1 -1
  22. package/dist/boot/auth.d.ts +2 -12
  23. package/dist/boot/auth.d.ts.map +1 -1
  24. package/dist/boot/boot.d.ts +3 -16
  25. package/dist/boot/boot.d.ts.map +1 -1
  26. package/dist/boot/boot.js +4 -11
  27. package/dist/boot/boot.js.map +1 -1
  28. package/dist/boot/bootstrap.d.ts.map +1 -1
  29. package/dist/boot/bootstrap.js +84 -130
  30. package/dist/boot/bootstrap.js.map +1 -1
  31. package/dist/boot/card.d.ts +1 -17
  32. package/dist/boot/card.d.ts.map +1 -1
  33. package/dist/boot/card.js +3 -32
  34. package/dist/boot/card.js.map +1 -1
  35. package/dist/boot/frame.d.ts +8 -32
  36. package/dist/boot/frame.d.ts.map +1 -1
  37. package/dist/boot/frame.js +17 -56
  38. package/dist/boot/frame.js.map +1 -1
  39. package/dist/boot/hosted.d.ts +2 -24
  40. package/dist/boot/hosted.d.ts.map +1 -1
  41. package/dist/boot/hosted.js +10 -15
  42. package/dist/boot/hosted.js.map +1 -1
  43. package/dist/boot/ownership.d.ts +3 -36
  44. package/dist/boot/ownership.d.ts.map +1 -1
  45. package/dist/boot/ownership.js +5 -40
  46. package/dist/boot/ownership.js.map +1 -1
  47. package/dist/boot/ports.d.ts +1 -14
  48. package/dist/boot/ports.d.ts.map +1 -1
  49. package/dist/boot/ports.js +1 -14
  50. package/dist/boot/ports.js.map +1 -1
  51. package/dist/boot/remote.d.ts +5 -38
  52. package/dist/boot/remote.d.ts.map +1 -1
  53. package/dist/boot/remote.js +8 -41
  54. package/dist/boot/remote.js.map +1 -1
  55. package/dist/boot/runner.d.ts +4 -21
  56. package/dist/boot/runner.d.ts.map +1 -1
  57. package/dist/boot/runner.js +4 -17
  58. package/dist/boot/runner.js.map +1 -1
  59. package/dist/boot/seed.d.ts +4 -31
  60. package/dist/boot/seed.d.ts.map +1 -1
  61. package/dist/boot/seed.js +6 -37
  62. package/dist/boot/seed.js.map +1 -1
  63. package/dist/boot/statement-drift.d.ts +2 -21
  64. package/dist/boot/statement-drift.d.ts.map +1 -1
  65. package/dist/boot/statement-drift.js +4 -9
  66. package/dist/boot/statement-drift.js.map +1 -1
  67. package/dist/boot/together.d.ts +4 -8
  68. package/dist/boot/together.d.ts.map +1 -1
  69. package/dist/boot/together.js +15 -50
  70. package/dist/boot/together.js.map +1 -1
  71. package/dist/boot/types.d.ts +31 -173
  72. package/dist/boot/types.d.ts.map +1 -1
  73. package/dist/builtin/config.d.ts +7 -0
  74. package/dist/builtin/config.d.ts.map +1 -0
  75. package/dist/builtin/config.js +15 -0
  76. package/dist/builtin/config.js.map +1 -0
  77. package/dist/{builtins → builtin}/logger.d.ts +4 -25
  78. package/dist/builtin/logger.d.ts.map +1 -0
  79. package/dist/{builtins → builtin}/logger.js +5 -32
  80. package/dist/builtin/logger.js.map +1 -0
  81. package/dist/config-loader.d.ts +9 -67
  82. package/dist/config-loader.d.ts.map +1 -1
  83. package/dist/config-loader.js +5 -18
  84. package/dist/config-loader.js.map +1 -1
  85. package/dist/contract.d.ts +15 -31
  86. package/dist/contract.d.ts.map +1 -1
  87. package/dist/contract.js +13 -26
  88. package/dist/contract.js.map +1 -1
  89. package/dist/criterion.d.ts +37 -0
  90. package/dist/criterion.d.ts.map +1 -0
  91. package/dist/criterion.js +28 -0
  92. package/dist/criterion.js.map +1 -0
  93. package/dist/crypto/encoding.d.ts +2 -15
  94. package/dist/crypto/encoding.d.ts.map +1 -1
  95. package/dist/crypto/encoding.js +2 -15
  96. package/dist/crypto/encoding.js.map +1 -1
  97. package/dist/crypto/node.d.ts.map +1 -1
  98. package/dist/crypto/node.js +1 -7
  99. package/dist/crypto/node.js.map +1 -1
  100. package/dist/crypto/port.d.ts +2 -18
  101. package/dist/crypto/port.d.ts.map +1 -1
  102. package/dist/crypto/port.js +1 -17
  103. package/dist/crypto/port.js.map +1 -1
  104. package/dist/crypto/webcrypto.d.ts.map +1 -1
  105. package/dist/crypto/webcrypto.js +1 -12
  106. package/dist/crypto/webcrypto.js.map +1 -1
  107. package/dist/declare.d.ts +19 -37
  108. package/dist/declare.d.ts.map +1 -1
  109. package/dist/declare.js +23 -30
  110. package/dist/declare.js.map +1 -1
  111. package/dist/define.d.ts +2 -3
  112. package/dist/define.d.ts.map +1 -1
  113. package/dist/define.js +2 -3
  114. package/dist/define.js.map +1 -1
  115. package/dist/descriptor/Fronds.d.ts +3 -28
  116. package/dist/descriptor/Fronds.d.ts.map +1 -1
  117. package/dist/descriptor/Fronds.js +6 -31
  118. package/dist/descriptor/Fronds.js.map +1 -1
  119. package/dist/descriptor/frond.d.ts +25 -60
  120. package/dist/descriptor/frond.d.ts.map +1 -1
  121. package/dist/descriptor/frond.js +5 -1
  122. package/dist/descriptor/frond.js.map +1 -1
  123. package/dist/dispatch/ArgumentResolver.d.ts +1 -1
  124. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
  125. package/dist/dispatch/ArgumentResolver.js +5 -5
  126. package/dist/dispatch/ArgumentResolver.js.map +1 -1
  127. package/dist/dispatch/DispatchEvent.d.ts +2 -2
  128. package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
  129. package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
  130. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
  131. package/dist/dispatch/DispatchLifecycle.js +1 -7
  132. package/dist/dispatch/DispatchLifecycle.js.map +1 -1
  133. package/dist/dispatch/DispatchPort.d.ts +1 -1
  134. package/dist/dispatch/DispatchPort.d.ts.map +1 -1
  135. package/dist/dispatch/Dispatcher.d.ts +1 -1
  136. package/dist/dispatch/Dispatcher.d.ts.map +1 -1
  137. package/dist/dispatch/Dispatcher.js +2 -2
  138. package/dist/dispatch/Dispatcher.js.map +1 -1
  139. package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
  140. package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
  141. package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
  142. package/dist/dispatch/HandlerFacade.js.map +1 -0
  143. package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
  144. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
  145. package/dist/dispatch/LocalRoutePolicy.js +4 -4
  146. package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
  147. package/dist/dispatch/OperationRoute.d.ts +2 -2
  148. package/dist/dispatch/OperationRoute.d.ts.map +1 -1
  149. package/dist/dispatch/OutputView.d.ts +3 -2
  150. package/dist/dispatch/OutputView.d.ts.map +1 -1
  151. package/dist/dispatch/OutputView.js +19 -1
  152. package/dist/dispatch/OutputView.js.map +1 -1
  153. package/dist/dispatch/Route.d.ts +2 -2
  154. package/dist/dispatch/Route.d.ts.map +1 -1
  155. package/dist/dispatch/RoutePolicy.d.ts +1 -1
  156. package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
  157. package/dist/dispatch/RouteRegistry.d.ts +1 -1
  158. package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
  159. package/dist/dispatch/RouteRegistry.js +2 -2
  160. package/dist/dispatch/RouteRegistry.js.map +1 -1
  161. package/dist/dispatch/RouteResolver.d.ts +2 -4
  162. package/dist/dispatch/RouteResolver.d.ts.map +1 -1
  163. package/dist/dispatch/StorageGuard.d.ts +40 -8
  164. package/dist/dispatch/StorageGuard.d.ts.map +1 -1
  165. package/dist/dispatch/StorageGuard.js +151 -20
  166. package/dist/dispatch/StorageGuard.js.map +1 -1
  167. package/dist/dispatch/presenterArguments.d.ts +7 -0
  168. package/dist/dispatch/presenterArguments.d.ts.map +1 -0
  169. package/dist/dispatch/presenterArguments.js +12 -0
  170. package/dist/dispatch/presenterArguments.js.map +1 -0
  171. package/dist/dispatch/remoteRoutes.d.ts +7 -0
  172. package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
  173. package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
  174. package/dist/dispatch/remoteRoutes.js.map +1 -0
  175. package/dist/dispatch/routeNotFound.d.ts +9 -0
  176. package/dist/dispatch/routeNotFound.d.ts.map +1 -0
  177. package/dist/dispatch/routeNotFound.js +21 -0
  178. package/dist/dispatch/routeNotFound.js.map +1 -0
  179. package/dist/dispatch/validateInput.d.ts +5 -0
  180. package/dist/dispatch/validateInput.d.ts.map +1 -0
  181. package/dist/dispatch/validateInput.js +20 -0
  182. package/dist/dispatch/validateInput.js.map +1 -0
  183. package/dist/effective-operation.d.ts +1 -24
  184. package/dist/effective-operation.d.ts.map +1 -1
  185. package/dist/effective-operation.js +21 -50
  186. package/dist/effective-operation.js.map +1 -1
  187. package/dist/emit.d.ts +4 -42
  188. package/dist/emit.d.ts.map +1 -1
  189. package/dist/emit.js +3 -39
  190. package/dist/emit.js.map +1 -1
  191. package/dist/entry/facade.d.ts +8 -0
  192. package/dist/entry/facade.d.ts.map +1 -0
  193. package/dist/entry/facade.js +28 -0
  194. package/dist/entry/facade.js.map +1 -0
  195. package/dist/entry/transport.d.ts +5 -0
  196. package/dist/entry/transport.d.ts.map +1 -0
  197. package/dist/entry/transport.js +11 -0
  198. package/dist/entry/transport.js.map +1 -0
  199. package/dist/frond-config.d.ts +7 -70
  200. package/dist/frond-config.d.ts.map +1 -1
  201. package/dist/frond-config.js +1 -9
  202. package/dist/frond-config.js.map +1 -1
  203. package/dist/identity-keys.d.ts +2 -5
  204. package/dist/identity-keys.d.ts.map +1 -1
  205. package/dist/identity-keys.js +3 -16
  206. package/dist/identity-keys.js.map +1 -1
  207. package/dist/identity.d.ts +4 -30
  208. package/dist/identity.d.ts.map +1 -1
  209. package/dist/identity.js +11 -73
  210. package/dist/identity.js.map +1 -1
  211. package/dist/imports.d.ts +1 -7
  212. package/dist/imports.d.ts.map +1 -1
  213. package/dist/imports.js +1 -7
  214. package/dist/imports.js.map +1 -1
  215. package/dist/index.d.ts +17 -24
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +10 -18
  218. package/dist/index.js.map +1 -1
  219. package/dist/loader.d.ts +1 -8
  220. package/dist/loader.d.ts.map +1 -1
  221. package/dist/loader.js +1 -8
  222. package/dist/loader.js.map +1 -1
  223. package/dist/node.d.ts +2 -11
  224. package/dist/node.d.ts.map +1 -1
  225. package/dist/node.js +2 -11
  226. package/dist/node.js.map +1 -1
  227. package/dist/prefab/collector.d.ts +1 -22
  228. package/dist/prefab/collector.d.ts.map +1 -1
  229. package/dist/prefab/collector.js +1 -22
  230. package/dist/prefab/collector.js.map +1 -1
  231. package/dist/prefab/crud.d.ts +16 -32
  232. package/dist/prefab/crud.d.ts.map +1 -1
  233. package/dist/prefab/crud.js +31 -58
  234. package/dist/prefab/crud.js.map +1 -1
  235. package/dist/prefab/mirror.d.ts +2 -24
  236. package/dist/prefab/mirror.d.ts.map +1 -1
  237. package/dist/prefab/mirror.js +2 -20
  238. package/dist/prefab/mirror.js.map +1 -1
  239. package/dist/prefab/prefab.d.ts +1 -7
  240. package/dist/prefab/prefab.d.ts.map +1 -1
  241. package/dist/prefab/prefab.js +1 -7
  242. package/dist/prefab/prefab.js.map +1 -1
  243. package/dist/prefab/presenter.d.ts +2 -36
  244. package/dist/prefab/presenter.d.ts.map +1 -1
  245. package/dist/prefab/presenter.js +2 -36
  246. package/dist/prefab/presenter.js.map +1 -1
  247. package/dist/prefab/repository.d.ts +5 -73
  248. package/dist/prefab/repository.d.ts.map +1 -1
  249. package/dist/prefab/repository.js +3 -16
  250. package/dist/prefab/repository.js.map +1 -1
  251. package/dist/scan/adapters.d.ts +3 -0
  252. package/dist/scan/adapters.d.ts.map +1 -0
  253. package/dist/scan/adapters.js +25 -0
  254. package/dist/scan/adapters.js.map +1 -0
  255. package/dist/scan/bundling.d.ts +1 -12
  256. package/dist/scan/bundling.d.ts.map +1 -1
  257. package/dist/scan/bundling.js +1 -12
  258. package/dist/scan/bundling.js.map +1 -1
  259. package/dist/scan/contract.d.ts +27 -0
  260. package/dist/scan/contract.d.ts.map +1 -0
  261. package/dist/scan/contract.js +46 -0
  262. package/dist/scan/contract.js.map +1 -0
  263. package/dist/scan/conventions.d.ts +6 -40
  264. package/dist/scan/conventions.d.ts.map +1 -1
  265. package/dist/scan/conventions.js +5 -34
  266. package/dist/scan/conventions.js.map +1 -1
  267. package/dist/scan/emit.d.ts +1 -5
  268. package/dist/scan/emit.d.ts.map +1 -1
  269. package/dist/scan/emit.js +10 -78
  270. package/dist/scan/emit.js.map +1 -1
  271. package/dist/scan/handler-parser.d.ts +4 -26
  272. package/dist/scan/handler-parser.d.ts.map +1 -1
  273. package/dist/scan/handler-parser.js +26 -83
  274. package/dist/scan/handler-parser.js.map +1 -1
  275. package/dist/scan/result.d.ts +3 -16
  276. package/dist/scan/result.d.ts.map +1 -1
  277. package/dist/scan/scanner.d.ts +2 -27
  278. package/dist/scan/scanner.d.ts.map +1 -1
  279. package/dist/scan/scanner.js +45 -133
  280. package/dist/scan/scanner.js.map +1 -1
  281. package/dist/scan/statement.d.ts.map +1 -1
  282. package/dist/scan/statement.js +60 -37
  283. package/dist/scan/statement.js.map +1 -1
  284. package/dist/source.d.ts +53 -0
  285. package/dist/source.d.ts.map +1 -0
  286. package/dist/source.js +18 -0
  287. package/dist/source.js.map +1 -0
  288. package/dist/storage.d.ts +13 -210
  289. package/dist/storage.d.ts.map +1 -1
  290. package/dist/storage.js +4 -68
  291. package/dist/storage.js.map +1 -1
  292. package/dist/store.d.ts +18 -0
  293. package/dist/store.d.ts.map +1 -0
  294. package/dist/store.js +179 -0
  295. package/dist/store.js.map +1 -0
  296. package/dist/verify.d.ts +5 -38
  297. package/dist/verify.d.ts.map +1 -1
  298. package/dist/verify.js +17 -37
  299. package/dist/verify.js.map +1 -1
  300. package/dist/wire/CallLog.d.ts +32 -0
  301. package/dist/wire/CallLog.d.ts.map +1 -0
  302. package/dist/{contract → wire}/CallLog.js.map +1 -1
  303. package/dist/wire/Invocation.d.ts +32 -0
  304. package/dist/wire/Invocation.d.ts.map +1 -0
  305. package/dist/wire/Invocation.js +66 -0
  306. package/dist/wire/Invocation.js.map +1 -0
  307. package/dist/{contract → wire}/RouteAddress.d.ts +5 -0
  308. package/dist/wire/RouteAddress.d.ts.map +1 -0
  309. package/dist/{contract → wire}/RouteAddress.js +7 -0
  310. package/dist/wire/RouteAddress.js.map +1 -0
  311. package/dist/wire/binding.d.ts +5 -21
  312. package/dist/wire/binding.d.ts.map +1 -1
  313. package/dist/wire/binding.js +5 -10
  314. package/dist/wire/binding.js.map +1 -1
  315. package/dist/wire/call.d.ts +24 -133
  316. package/dist/wire/call.d.ts.map +1 -1
  317. package/dist/wire/call.js +15 -41
  318. package/dist/wire/call.js.map +1 -1
  319. package/dist/wire/drift.d.ts +3 -28
  320. package/dist/wire/drift.d.ts.map +1 -1
  321. package/dist/wire/drift.js +4 -23
  322. package/dist/wire/drift.js.map +1 -1
  323. package/dist/wire/errors.d.ts +4 -24
  324. package/dist/wire/errors.d.ts.map +1 -1
  325. package/dist/wire/errors.js +4 -24
  326. package/dist/wire/errors.js.map +1 -1
  327. package/dist/wire/http-error.d.ts +2 -13
  328. package/dist/wire/http-error.d.ts.map +1 -1
  329. package/dist/wire/http-error.js +5 -19
  330. package/dist/wire/http-error.js.map +1 -1
  331. package/dist/wire/loggerMiddleware.d.ts +2 -8
  332. package/dist/wire/loggerMiddleware.d.ts.map +1 -1
  333. package/dist/wire/loggerMiddleware.js +1 -7
  334. package/dist/wire/loggerMiddleware.js.map +1 -1
  335. package/dist/wire/middleware.d.ts +3 -7
  336. package/dist/wire/middleware.d.ts.map +1 -1
  337. package/dist/wire/middleware.js +1 -5
  338. package/dist/wire/middleware.js.map +1 -1
  339. package/dist/wire/operation.d.ts +7 -43
  340. package/dist/wire/operation.d.ts.map +1 -1
  341. package/dist/wire/operation.js +4 -15
  342. package/dist/wire/operation.js.map +1 -1
  343. package/dist/wire/signature.d.ts +4 -25
  344. package/dist/wire/signature.d.ts.map +1 -1
  345. package/package.json +3 -3
  346. package/src/boot/AppLifecycle.ts +15 -2
  347. package/src/boot/Emissions.ts +21 -118
  348. package/src/boot/ambient-port.ts +3 -24
  349. package/src/boot/ambient.als.ts +7 -12
  350. package/src/boot/ambient.queue.ts +2 -5
  351. package/src/boot/apply.ts +9 -16
  352. package/src/boot/auth.ts +2 -12
  353. package/src/boot/boot.ts +6 -21
  354. package/src/boot/bootstrap.ts +95 -140
  355. package/src/boot/card.ts +4 -33
  356. package/src/boot/frame.ts +24 -64
  357. package/src/boot/hosted.ts +12 -34
  358. package/src/boot/ownership.ts +5 -39
  359. package/src/boot/ports.ts +1 -14
  360. package/src/boot/remote.ts +11 -58
  361. package/src/boot/runner.ts +5 -22
  362. package/src/boot/seed.ts +6 -37
  363. package/src/boot/statement-drift.ts +5 -24
  364. package/src/boot/together.ts +18 -51
  365. package/src/boot/types.ts +31 -173
  366. package/src/{builtins → builtin}/config.ts +1 -7
  367. package/src/{builtins → builtin}/logger.ts +6 -39
  368. package/src/config-loader.ts +12 -71
  369. package/src/contract.ts +19 -39
  370. package/src/criterion.ts +54 -0
  371. package/src/crypto/encoding.ts +2 -15
  372. package/src/crypto/node.ts +1 -7
  373. package/src/crypto/port.ts +2 -18
  374. package/src/crypto/webcrypto.ts +1 -12
  375. package/src/declare.ts +42 -41
  376. package/src/define.ts +2 -3
  377. package/src/descriptor/Fronds.ts +6 -31
  378. package/src/descriptor/frond.ts +26 -60
  379. package/src/dispatch/ArgumentResolver.ts +6 -6
  380. package/src/dispatch/DispatchEvent.ts +2 -2
  381. package/src/dispatch/DispatchLifecycle.ts +1 -7
  382. package/src/dispatch/DispatchPort.ts +1 -1
  383. package/src/dispatch/Dispatcher.ts +3 -3
  384. package/src/dispatch/HandlerFacade.ts +231 -0
  385. package/src/dispatch/LocalRoutePolicy.ts +4 -4
  386. package/src/dispatch/OperationRoute.ts +2 -2
  387. package/src/dispatch/OutputView.ts +24 -2
  388. package/src/dispatch/Route.ts +2 -2
  389. package/src/dispatch/RoutePolicy.ts +1 -1
  390. package/src/dispatch/RouteRegistry.ts +2 -2
  391. package/src/dispatch/RouteResolver.ts +2 -4
  392. package/src/dispatch/StorageGuard.ts +175 -19
  393. package/src/dispatch/presenterArguments.ts +25 -0
  394. package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
  395. package/src/dispatch/routeNotFound.ts +33 -0
  396. package/src/dispatch/validateInput.ts +28 -0
  397. package/src/effective-operation.ts +21 -50
  398. package/src/emit.ts +5 -63
  399. package/src/entry/facade.ts +44 -0
  400. package/src/entry/transport.ts +16 -0
  401. package/src/frond-config.ts +7 -70
  402. package/src/identity-keys.ts +3 -16
  403. package/src/identity.ts +12 -80
  404. package/src/imports.ts +2 -31
  405. package/src/index.ts +17 -24
  406. package/src/loader.ts +2 -16
  407. package/src/node.ts +2 -11
  408. package/src/prefab/collector.ts +1 -22
  409. package/src/prefab/crud.ts +37 -76
  410. package/src/prefab/mirror.ts +4 -44
  411. package/src/prefab/prefab.ts +2 -21
  412. package/src/prefab/presenter.ts +2 -36
  413. package/src/prefab/repository.ts +7 -83
  414. package/src/scan/adapters.ts +32 -0
  415. package/src/scan/bundling.ts +1 -12
  416. package/src/scan/contract.ts +80 -0
  417. package/src/scan/conventions.ts +6 -40
  418. package/src/scan/emit.ts +11 -80
  419. package/src/scan/handler-parser.ts +27 -96
  420. package/src/scan/result.ts +3 -16
  421. package/src/scan/scanner.ts +46 -132
  422. package/src/scan/statement.ts +73 -41
  423. package/src/source.ts +63 -0
  424. package/src/storage.ts +14 -234
  425. package/src/store.ts +191 -0
  426. package/src/verify.ts +16 -57
  427. package/src/wire/CallLog.ts +30 -0
  428. package/src/{contract → wire}/Invocation.ts +24 -17
  429. package/src/{contract → wire}/RouteAddress.ts +7 -0
  430. package/src/wire/binding.ts +9 -25
  431. package/src/wire/call.ts +30 -133
  432. package/src/wire/drift.ts +5 -30
  433. package/src/wire/errors.ts +4 -24
  434. package/src/wire/http-error.ts +5 -19
  435. package/src/wire/loggerMiddleware.ts +2 -8
  436. package/src/wire/middleware.ts +3 -7
  437. package/src/wire/operation.ts +8 -48
  438. package/src/wire/signature.ts +4 -25
  439. package/dist/boot/HandlerFacade.d.ts.map +0 -1
  440. package/dist/boot/HandlerFacade.js.map +0 -1
  441. package/dist/builtins/config.d.ts +0 -13
  442. package/dist/builtins/config.d.ts.map +0 -1
  443. package/dist/builtins/config.js +0 -21
  444. package/dist/builtins/config.js.map +0 -1
  445. package/dist/builtins/logger.d.ts.map +0 -1
  446. package/dist/builtins/logger.js.map +0 -1
  447. package/dist/contract/Call.d.ts +0 -10
  448. package/dist/contract/Call.d.ts.map +0 -1
  449. package/dist/contract/Call.js +0 -15
  450. package/dist/contract/Call.js.map +0 -1
  451. package/dist/contract/CallLog.d.ts +0 -57
  452. package/dist/contract/CallLog.d.ts.map +0 -1
  453. package/dist/contract/Invocation.d.ts +0 -27
  454. package/dist/contract/Invocation.d.ts.map +0 -1
  455. package/dist/contract/Invocation.js +0 -59
  456. package/dist/contract/Invocation.js.map +0 -1
  457. package/dist/contract/RouteAddress.d.ts.map +0 -1
  458. package/dist/contract/RouteAddress.js.map +0 -1
  459. package/dist/dispatch/InputValidator.d.ts +0 -7
  460. package/dist/dispatch/InputValidator.d.ts.map +0 -1
  461. package/dist/dispatch/InputValidator.js +0 -22
  462. package/dist/dispatch/InputValidator.js.map +0 -1
  463. package/dist/dispatch/OperationExecutor.d.ts +0 -25
  464. package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
  465. package/dist/dispatch/OperationExecutor.js +0 -32
  466. package/dist/dispatch/OperationExecutor.js.map +0 -1
  467. package/dist/dispatch/OutputProjector.d.ts +0 -12
  468. package/dist/dispatch/OutputProjector.d.ts.map +0 -1
  469. package/dist/dispatch/OutputProjector.js +0 -30
  470. package/dist/dispatch/OutputProjector.js.map +0 -1
  471. package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
  472. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
  473. package/dist/dispatch/PresenterArgumentResolver.js +0 -20
  474. package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
  475. package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
  476. package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
  477. package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
  478. package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
  479. package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
  480. package/dist/dispatch/RouteNotFoundError.js +0 -24
  481. package/dist/dispatch/RouteNotFoundError.js.map +0 -1
  482. package/dist/entry/DynamicFacade.d.ts +0 -10
  483. package/dist/entry/DynamicFacade.d.ts.map +0 -1
  484. package/dist/entry/DynamicFacade.js +0 -27
  485. package/dist/entry/DynamicFacade.js.map +0 -1
  486. package/dist/entry/FacadeEntry.d.ts +0 -11
  487. package/dist/entry/FacadeEntry.d.ts.map +0 -1
  488. package/dist/entry/FacadeEntry.js +0 -26
  489. package/dist/entry/FacadeEntry.js.map +0 -1
  490. package/dist/entry/TransportEntry.d.ts +0 -13
  491. package/dist/entry/TransportEntry.d.ts.map +0 -1
  492. package/dist/entry/TransportEntry.js +0 -24
  493. package/dist/entry/TransportEntry.js.map +0 -1
  494. package/dist/rows.d.ts +0 -40
  495. package/dist/rows.d.ts.map +0 -1
  496. package/dist/rows.js +0 -146
  497. package/dist/rows.js.map +0 -1
  498. package/src/boot/HandlerFacade.ts +0 -242
  499. package/src/contract/Call.ts +0 -18
  500. package/src/contract/CallLog.ts +0 -55
  501. package/src/dispatch/InputValidator.ts +0 -28
  502. package/src/dispatch/OperationExecutor.ts +0 -60
  503. package/src/dispatch/OutputProjector.ts +0 -32
  504. package/src/dispatch/PresenterArgumentResolver.ts +0 -25
  505. package/src/dispatch/RouteNotFoundError.ts +0 -29
  506. package/src/entry/DynamicFacade.ts +0 -28
  507. package/src/entry/FacadeEntry.ts +0 -32
  508. package/src/entry/TransportEntry.ts +0 -30
  509. package/src/rows.ts +0 -155
  510. /package/dist/{contract → wire}/CallLog.js +0 -0
@@ -1,24 +0,0 @@
1
- import { Call } from '../contract/Call.js';
2
- import { RouteAddress } from '../contract/RouteAddress.js';
3
- /** Object entry for the historical transport contract. */
4
- export class TransportEntry {
5
- dispatcher;
6
- surface;
7
- constructor(dispatcher, surface) {
8
- this.dispatcher = dispatcher;
9
- this.surface = surface;
10
- }
11
- receive(legacy, invocation) {
12
- return this.dispatcher.dispatch(new Call(new RouteAddress({
13
- entity: legacy.entity,
14
- operation: legacy.op,
15
- ...(this.surface !== undefined ? { surface: this.surface } : {}),
16
- }), invocation));
17
- }
18
- }
19
- /** Adapt the historical transport signature to the canonical dispatch port. */
20
- export function createTransportEntry(dispatcher, surface) {
21
- const entry = new TransportEntry(dispatcher, surface);
22
- return entry.receive.bind(entry);
23
- }
24
- //# sourceMappingURL=TransportEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransportEntry.js","sourceRoot":"","sources":["../../src/entry/TransportEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAK3D,0DAA0D;AAC1D,MAAM,OAAO,cAAc;IAEN;IACA;IAFnB,YACmB,UAAwB,EACxB,OAAgB;QADhB,eAAU,GAAV,UAAU,CAAc;QACxB,YAAO,GAAP,OAAO,CAAS;IAChC,CAAC;IAEJ,OAAO,CAAC,MAAiB,EAAE,UAA6B;QACtD,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,CACtC,IAAI,YAAY,CAAC;YACf,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,EAAE;YACpB,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjE,CAAC,EACF,UAAU,CACX,CAAC,CAAC;IACL,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,UAAwB,EAAE,OAAgB;IAC7E,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
package/dist/rows.d.ts DELETED
@@ -1,40 +0,0 @@
1
- /**
2
- * The thirteen gestures of {@link Storage}, derived from four.
3
- *
4
- * A place rows live varies in ONE thing — how a row is fetched, written, dropped and
5
- * enumerated. Everything above that is the same everywhere: what a page is, how a criterion
6
- * matches, which stamps survive an upsert, and the two refusals a `create` owes its caller.
7
- * Measured on the Map realization: 14 lines of 140 touched the store.
8
- *
9
- * So an adapter supplies {@link Rows} and receives a whole `StorageFactory`. It is the frame
10
- * a third party writing a source needs — without it, `Sources.register` hands over a
11
- * four-gesture contract and leaves the thirteen to be re-derived, which is how three
12
- * divergent copies of the same store ended up in this repo's own demos.
13
- *
14
- * What is NOT here: `transacted`. A unit of work belongs to the engine that has one, and
15
- * this frame has none — which is why a `Source` built on it leaves the key absent and a
16
- * frame compensates.
17
- */
18
- import { type SchemaView } from '@fougere/schema';
19
- import type { StorageFactory } from './storage.js';
20
- /** One row, as every realization hands it over. */
21
- export type Row = Record<string, unknown>;
22
- /**
23
- * A keyed collection of rows — what an adapter supplies, and all of it.
24
- *
25
- * Async on purpose, even where a realization is not: a Map answers instantly and a directory
26
- * does not, and the frame above cannot be written twice. `client` is what the port's own
27
- * escape hatch exposes, `unknown` for the reason it is there.
28
- */
29
- export interface Rows {
30
- get(key: string): Promise<Row | undefined>;
31
- has(key: string): Promise<boolean>;
32
- set(key: string, row: Row): Promise<void>;
33
- delete(key: string): Promise<boolean>;
34
- /** Every row it holds. A realization that cannot answer this cheaply says so in its doc. */
35
- all(): Promise<Row[]>;
36
- /** Handed on as `Storage.client` — the Map, the directory, whatever it is. */
37
- readonly client: unknown;
38
- }
39
- export declare function storageOver(open: (entity: SchemaView, name: string) => Rows): StorageFactory;
40
- //# sourceMappingURL=rows.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D,mDAAmD;AACnD,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,4FAA4F;IAC5F,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,cAAc,CAiH5F"}
package/dist/rows.js DELETED
@@ -1,146 +0,0 @@
1
- /**
2
- * The thirteen gestures of {@link Storage}, derived from four.
3
- *
4
- * A place rows live varies in ONE thing — how a row is fetched, written, dropped and
5
- * enumerated. Everything above that is the same everywhere: what a page is, how a criterion
6
- * matches, which stamps survive an upsert, and the two refusals a `create` owes its caller.
7
- * Measured on the Map realization: 14 lines of 140 touched the store.
8
- *
9
- * So an adapter supplies {@link Rows} and receives a whole `StorageFactory`. It is the frame
10
- * a third party writing a source needs — without it, `Sources.register` hands over a
11
- * four-gesture contract and leaves the thirteen to be re-derived, which is how three
12
- * divergent copies of the same store ended up in this repo's own demos.
13
- *
14
- * What is NOT here: `transacted`. A unit of work belongs to the engine that has one, and
15
- * this frame has none — which is why a `Source` built on it leaves the key absent and a
16
- * frame compensates.
17
- */
18
- import { applyCreate, applyUpdate, Lifecycle, Role } from '@fougere/schema';
19
- export function storageOver(open) {
20
- return (entity, name) => {
21
- const fields = entity.getFields();
22
- const rows = open(entity, name);
23
- const pk = Object.entries(fields).find(([, field]) => Role.of(field).isPrimary)?.[0] ?? 'id';
24
- // `Storage.findById(id: string)` — but a key can hold a number, and a Map keyed on
25
- // `1` does not answer `'1'`. SQL never had the question; here the divergence was
26
- // silent and only on this storage.
27
- const keyOf = (value) => String(value);
28
- // Same contract as SQL: a criterion may name a SET, and an empty set matches nothing.
29
- const matches = (row, criteria) => Object.entries(criteria).every(([key, value]) => Array.isArray(value)
30
- ? value.some((v) => Object.is(row[key], v))
31
- : Object.is(row[key], value));
32
- return {
33
- client: rows.client,
34
- async list(options) {
35
- let items = await rows.all();
36
- if (options?.where)
37
- items = items.filter((row) => matches(row, options.where));
38
- // Held before the page is cut, and after the filter: `total` answers "how many
39
- // match", which is what a paginator divides. Reading `store.size` at the end
40
- // answered a different question — every row the store holds, including the ones
41
- // the filter exists to keep out of this caller's sight.
42
- const matching = items.length;
43
- const limit = options?.limit;
44
- const offset = options?.page && limit ? (options.page - 1) * limit : options?.offset ?? 0;
45
- if (offset > 0)
46
- items = items.slice(offset);
47
- const hasMore = limit ? items.length > limit : false;
48
- if (limit)
49
- items = items.slice(0, limit);
50
- const result = items;
51
- result.hasMore = hasMore;
52
- result.endCursor = items.length > 0 ? String(items[items.length - 1][pk] ?? '') : undefined;
53
- if (options?.count)
54
- result.total = matching;
55
- return result;
56
- },
57
- async findById(id) { return await rows.get(keyOf(id)); },
58
- async findBy(criteria) {
59
- return (await rows.all()).find((row) => matches(row, criteria));
60
- },
61
- async findAllBy(criteria) {
62
- return (await rows.all()).filter((row) => matches(row, criteria));
63
- },
64
- // Same contract as SQL: a map keyed by the primary key, a miss being an absent key.
65
- async findByKeys(ids) {
66
- const found = new Map();
67
- for (const id of ids) {
68
- const row = await rows.get(keyOf(id));
69
- if (row)
70
- found.set(String(id), row);
71
- }
72
- return found;
73
- },
74
- // The dual, same contract as SQL: grouped by the value read off the ROW.
75
- async findAllByKeys(field, keys) {
76
- const grouped = new Map();
77
- if (keys.length === 0)
78
- return grouped;
79
- const wanted = new Set(keys.map(String));
80
- for (const row of await rows.all()) {
81
- const key = String(row[field]);
82
- if (!wanted.has(key))
83
- continue;
84
- const held = grouped.get(key);
85
- if (held)
86
- held.push(row);
87
- else
88
- grouped.set(key, [row]);
89
- }
90
- return grouped;
91
- },
92
- // Same contract as SQL: the key and the creation stamps survive an overwrite.
93
- async upsert(input) {
94
- const record = applyCreate(fields, applyUpdate(fields, input));
95
- const id = record[pk];
96
- if (id === undefined)
97
- throw new Error(`${name}.upsert(): no \`${pk}\` — an upsert needs the key it writes at.`);
98
- const held = await rows.get(keyOf(id));
99
- if (held) {
100
- for (const [key, field] of Object.entries(fields)) {
101
- if (key === pk || Lifecycle.of(field).stampedOnce)
102
- record[key] = held[key];
103
- }
104
- }
105
- await rows.set(keyOf(id), record);
106
- return record;
107
- },
108
- async upsertAll(inputs) {
109
- for (const input of inputs)
110
- await this.upsert(input);
111
- return inputs.length;
112
- },
113
- async create(input) {
114
- const record = applyCreate(fields, input);
115
- const id = record[pk];
116
- // `primary(text())` declares no generator, so nothing fills the hole and the
117
- // caller has to. Keying on `undefined` would let the second create overwrite the
118
- // first, in silence — the old version hid this by inventing an `id` field the
119
- // entity never declared.
120
- if (id === undefined) {
121
- throw new Error(`${name}.create: '${pk}' is the primary key and nothing supplied it — this entity declares no generator for it.`);
122
- }
123
- // A create is not an upsert. `Map.set` overwrites, so a second create under the
124
- // same key answered "created" while destroying the previous row — SQL answers a
125
- // constraint violation, and a store that loses data silently is worse than one
126
- // that fails.
127
- if (await rows.has(keyOf(id))) {
128
- throw new Error(`${name}.create: '${pk}' ${JSON.stringify(id)} already exists.`);
129
- }
130
- await rows.set(keyOf(id), record);
131
- return record;
132
- },
133
- async update(id, input) {
134
- const existing = await rows.get(keyOf(id));
135
- if (!existing)
136
- throw new Error(`Not found: ${id}`);
137
- const updated = { ...existing, ...applyUpdate(fields, input), [pk]: existing[pk] };
138
- await rows.set(keyOf(id), updated);
139
- return updated;
140
- },
141
- async delete(id) { return await rows.delete(keyOf(id)); },
142
- output(_schema) { return this; },
143
- };
144
- };
145
- }
146
- //# sourceMappingURL=rows.js.map
package/dist/rows.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"rows.js","sourceRoot":"","sources":["../src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E,MAAM,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;gBACnD,MAAM,OAAO,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnF,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;gBACnC,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,KAAK,CAAC,MAAM,CAAC,EAAU,IAAI,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,MAAM,CAAC,OAAmB,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;SAC7C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,242 +0,0 @@
1
- import { lowerFirst, type Fields } from '@fougere/schema';
2
- import type { Container } from '@fougere/container';
3
- import type { AppMiddleware } from '../wire/middleware.js';
4
- import type { CollectorResolver } from '../dispatch/ArgumentResolver.js';
5
- import { collectorKeyOf } from '../prefab/collector.js';
6
- import { presenterKeyOf } from '../prefab/presenter.js';
7
- import { repositoryKeyOf } from '../prefab/repository.js';
8
- import { targetOf } from '../prefab/prefab.js';
9
- import type { OperationContract, OperationsMap } from '../wire/operation.js';
10
- import type { EffectiveOperation, EffectiveOperationsMap } from '../effective-operation.js';
11
- import type { InvocationContext } from '../contract/Invocation.js';
12
- import type { Emissions } from './Emissions.js';
13
- import type { Logger } from '../builtins/logger.js';
14
- import type { EntityEntry, HandlerEntry, PresenterEntry } from '../descriptor/frond.js';
15
- import { InputValidator } from '../dispatch/InputValidator.js';
16
- import { ArgumentResolver } from '../dispatch/ArgumentResolver.js';
17
- import { OperationExecutor } from '../dispatch/OperationExecutor.js';
18
- import { OutputProjector } from '../dispatch/OutputProjector.js';
19
- import { OutputView } from '../dispatch/OutputView.js';
20
- import { PresenterExecutor } from '../dispatch/PresenterExecutor.js';
21
- import { PresenterArgumentResolver } from '../dispatch/PresenterArgumentResolver.js';
22
-
23
- /** What this door is about: a handler, the entity behind it when there is one, and where it resolves. */
24
- export interface Doorway {
25
- handler: HandlerEntry;
26
- /** Handlers in the owning frond, used to realize a resolved implementation override. */
27
- handlers: readonly HandlerEntry[];
28
- /** The canonical operation table resolved before boot performs any side effect. */
29
- operations: EffectiveOperationsMap;
30
- /** The subject — absent is ordinary: a health check owns no row. */
31
- entity: EntityEntry | undefined;
32
- /** The scope the handler and its collectors resolve in — a surface gets its own. */
33
- scope: Container;
34
- /** The container key this door answers under. */
35
- key: string;
36
- }
37
-
38
- /** What the frond and the boot supply to every door alike. */
39
- export interface Wiring {
40
- /** The frond this door belongs to — travels on every OperationContext. */
41
- frond: string;
42
- /** The frond's own scope — where presenters live, whatever sub-scope the door uses. */
43
- frondScope: Container;
44
- log: Logger;
45
- /** Entity names this frond has a collector for. */
46
- collectors: Set<string>;
47
- presenters: Map<string, PresenterEntry>;
48
- /** The middlewares that apply to an address, read at call time and never at boot. */
49
- middlewaresFor: (address: string) => AppMiddleware[];
50
- emissions: Emissions;
51
- }
52
-
53
- /** Adapts one handler door to executable operations. */
54
- export class HandlerFacade {
55
- /** Rich operation facts shared with check, explain and adapters. */
56
- readonly effectiveOperations: EffectiveOperationsMap;
57
- /** Contracts served by this door. */
58
- readonly contracts: OperationsMap;
59
-
60
- /** The callable surface: op name → the function a caller reaches. */
61
- readonly ops: Record<string, Function> = {};
62
-
63
- private readonly cachedViews = new Map<string, OutputView>();
64
- private instance: any;
65
- private readonly implementationKeys = new Map<string, string>();
66
- private readonly implementationInstances = new Map<string, any>();
67
- private readonly inputValidator = new InputValidator();
68
- private readonly argumentResolver = new ArgumentResolver(
69
- (typeName) => this.collectorResolver(typeName),
70
- );
71
- private readonly presenterArguments: PresenterArgumentResolver;
72
-
73
- constructor(private readonly door: Doorway, private readonly wiring: Wiring) {
74
- const { handler, entity } = door;
75
- this.presenterArguments = new PresenterArgumentResolver(
76
- this.argumentResolver,
77
- wiring.collectors,
78
- );
79
- this.refuseCrudWithoutRepository(handler);
80
-
81
- door.scope.register(this.handlerKey, handler.ctor, { deps: this.depsOf(handler) });
82
-
83
- this.effectiveOperations = door.operations;
84
- this.contracts = new Map(
85
- [...door.operations].map(([name, operation]) => [name, operation as OperationContract] as const),
86
- );
87
- handler.operations = this.contracts;
88
-
89
- // Register model-selected implementations in the same execution scope.
90
- for (const [name, operation] of door.operations) {
91
- if (this.isBaseImplementation(operation)) continue;
92
- const implementation = this.implementationHandler(name);
93
- this.refuseCrudWithoutRepository(implementation);
94
- const key = `${this.handlerKey}:implementation:${operation.implementation.className}`;
95
- if (!this.implementationKeys.has(operation.implementation.className)) {
96
- door.scope.register(key, implementation.ctor, { deps: this.depsOf(implementation) });
97
- this.implementationKeys.set(operation.implementation.className, key);
98
- }
99
- }
100
-
101
- // Emissions use the same contracts and execution path as direct calls.
102
- wiring.emissions.note(this.contracts, door.key);
103
- // Only declared operations become callable façade members.
104
- for (const op of this.contracts.keys()) this.ops[op] = this.wrap(op);
105
-
106
- if (this.inheritsCrud(handler) && !entity) {
107
- // An installed Crud subject may be absent from the local scan.
108
- wiring.log.debug(`${handler.ctor.name} extends Crud() and no scanned entity is named `
109
- + `'${this.subjectOf(handler)}' — installed entity, or a missing one: no storage will be injected`);
110
- }
111
- }
112
-
113
- /** Storage follows the Crud subject, which may differ from the door address. */
114
- private subjectOf(handler: HandlerEntry): string {
115
- const target = targetOf(handler.ctor);
116
- return target?.name ? lowerFirst(target.name) : handler.address;
117
- }
118
-
119
- private inheritsCrud(handler: HandlerEntry): boolean {
120
- const proto = handler.ctor.prototype;
121
- return typeof proto?.list === 'function' && typeof proto?.findById === 'function';
122
- }
123
-
124
- private get handlerKey(): string {
125
- return `_handler:${this.door.key}`;
126
- }
127
-
128
- private depsOf(handler: HandlerEntry): string[] {
129
- const { deps } = handler;
130
- if (deps.length > 0) return deps;
131
- return this.inheritsCrud(handler) ? [repositoryKeyOf(this.subjectOf(handler))] : [];
132
- }
133
-
134
- /** A custom Crud constructor must explicitly receive its repository. */
135
- private refuseCrudWithoutRepository(handler: HandlerEntry): void {
136
- const repoTypeName = repositoryKeyOf(this.subjectOf(handler));
137
- if (!this.inheritsCrud(handler) || handler.deps.length === 0 || handler.deps.includes(repoTypeName)) return;
138
- throw new Error(
139
- `${handler.ctor.name} extends Crud() and declares a constructor, so its storage is no ` +
140
- `longer injected for it — but it does not take any.\n` +
141
- ` Add it and hand it to super():\n` +
142
- ` constructor(repo: ${repoTypeName}, …) { super(repo); }`,
143
- );
144
- }
145
-
146
- /** Resolve and cache the output view declared for one operation. */
147
- private viewOf(op: string): OutputView {
148
- const known = this.cachedViews.get(op);
149
- if (known) return known;
150
-
151
- const operation = this.effectiveOperations.get(op);
152
- const schema = operation?.output as { getFields?: () => Fields } | undefined;
153
- const resolved = new OutputView(
154
- typeof schema?.getFields === 'function' ? schema.getFields() : {},
155
- operation?.outputClosed ?? false,
156
- );
157
- this.cachedViews.set(op, resolved);
158
- return resolved;
159
- }
160
-
161
- private collectorResolver = (typeName: string): CollectorResolver | undefined => {
162
- try { return this.door.scope.resolve(collectorKeyOf(typeName)) as CollectorResolver; }
163
- catch { return undefined; }
164
- };
165
-
166
- /** The handler itself, resolved on first call — never at boot. */
167
- private resolvedHandler(): any {
168
- if (!this.instance) this.instance = this.door.scope.resolve(this.handlerKey);
169
- return this.instance;
170
- }
171
-
172
- private isBaseImplementation(operation: EffectiveOperation): boolean {
173
- return operation.implementation.className === this.door.handler.ctor.name
174
- && operation.implementation.address === this.door.handler.address
175
- && operation.implementation.filePath === this.door.handler.filePath;
176
- }
177
-
178
- /** The exact handler entry the pure model selected; no name-only retry or fallback. */
179
- private implementationHandler(operationName: string): HandlerEntry {
180
- const operation = this.effectiveOperations.get(operationName)!;
181
- const matches = this.door.handlers.filter((handler) =>
182
- handler.ctor.name === operation.implementation.className
183
- && handler.address === operation.implementation.address
184
- && handler.filePath === operation.implementation.filePath);
185
- if (matches.length !== 1) {
186
- throw new Error(
187
- `EffectiveOperation '${operation.id}' names ${operation.implementation.className}.`
188
- + `${operation.implementation.method}, but boot found ${matches.length} matching handlers.`,
189
- );
190
- }
191
- return matches[0]!;
192
- }
193
-
194
- private resolvedImplementation(operationName: string): { instance: any; method: string } {
195
- const operation = this.effectiveOperations.get(operationName)!;
196
- if (this.isBaseImplementation(operation)) {
197
- return { instance: this.resolvedHandler(), method: operation.implementation.method };
198
- }
199
-
200
- const className = operation.implementation.className;
201
- const key = this.implementationKeys.get(className);
202
- if (!key) throw new Error(`No registered implementation for EffectiveOperation '${operation.id}'.`);
203
- let instance = this.implementationInstances.get(key);
204
- if (!instance) {
205
- instance = this.door.scope.resolve(key);
206
- this.implementationInstances.set(key, instance);
207
- }
208
- return { instance, method: operation.implementation.method };
209
- }
210
-
211
- private wrap(op: string): (invocation?: InvocationContext) => Promise<unknown> {
212
- const address = this.door.handler.address;
213
- const contract = this.contracts.get(op);
214
- const view = this.viewOf(op);
215
- const presenter = this.wiring.presenters.get(address);
216
- const executor = new OperationExecutor({
217
- entity: address,
218
- frond: this.wiring.frond,
219
- operation: op,
220
- contract,
221
- middlewares: () => this.wiring.middlewaresFor(address),
222
- validator: this.inputValidator,
223
- arguments: this.argumentResolver,
224
- invoke: async (args) => {
225
- const implementation = this.resolvedImplementation(op);
226
- return implementation.instance[implementation.method](...args);
227
- },
228
- projector: new OutputProjector(view),
229
- ...(view.closed || !presenter ? {} : {
230
- present: async (result: unknown, effective: InvocationContext) =>
231
- new PresenterExecutor(
232
- this.wiring.frondScope.resolve(presenterKeyOf(address)),
233
- presenter.fields,
234
- address,
235
- op,
236
- ).present(result, await this.presenterArguments.resolve(presenter, effective)),
237
- }),
238
- });
239
-
240
- return (invocation) => executor.execute(invocation);
241
- }
242
- }
@@ -1,18 +0,0 @@
1
- import { Invocation, type InvocationInput } from './Invocation.js';
2
- import type { RouteAddress } from './RouteAddress.js';
3
-
4
- /** One normalized request: where it goes and what the caller supplied. */
5
- export class Call {
6
- readonly address: RouteAddress;
7
- readonly invocation: Invocation;
8
-
9
- constructor(address: RouteAddress, invocation?: InvocationInput) {
10
- this.address = address;
11
- this.invocation = Invocation.from(invocation);
12
- Object.freeze(this);
13
- }
14
-
15
- withInvocation(invocation: Invocation): Call {
16
- return new Call(this.address, invocation);
17
- }
18
- }
@@ -1,55 +0,0 @@
1
- import type { RouteKind } from './RouteAddress.js';
2
-
3
- /**
4
- * What crosses the door: the address, the route it took, and the verdict.
5
- *
6
- * It lives here rather than beside its producer for the reason `TopologyReport` does: it
7
- * crosses a process boundary, so a reader that never installed `@fougere/calls` — the CLI
8
- * — needs its shape, and putting it there is what produces a hand-copied duplicate.
9
- *
10
- * Never the body. Same rule the topology report states — a remote destination is named,
11
- * not disclosed — and it holds here for the same reason: this answer leaves the process.
12
- */
13
- export interface CallRecord {
14
- /** Monotonic, and the whole cursor protocol: a reader asks for what is above its own. */
15
- seq: number;
16
- frond?: string;
17
- entity: string;
18
- operation: string;
19
- surface?: string;
20
- /** Known at `resolved`, so absent on a call that never found a route. */
21
- route?: RouteKind;
22
- /**
23
- * The traceparent the invocation carried, when one did.
24
- *
25
- * One panel reads one process, so this is what lets two of them be sewn: the process
26
- * that sent and the process that executed share it, and the gap between their two
27
- * durations IS the cost of the wire rather than a deduction.
28
- */
29
- trace?: string;
30
- /**
31
- * The peer that established this call, when one did.
32
- *
33
- * A hosted frond serves several consumers, so its own ring mixes them: this is what
34
- * separates them. Absent on a call nobody signed — a loopback dev boot has no identity.
35
- */
36
- caller?: string;
37
- startedAt: number;
38
- /** Known at `settled`. */
39
- ms?: number;
40
- verdict: 'running' | 'ok' | 'failed';
41
- refusal?: { code?: string; message: string };
42
- }
43
-
44
- /**
45
- * One page of the ring.
46
- *
47
- * `dropped` is what the ring could not keep — an absence is named rather than left to
48
- * look like a quiet period.
49
- */
50
- export interface CallPage {
51
- calls: CallRecord[];
52
- cursor: number;
53
- inFlight: number;
54
- dropped: number;
55
- }
@@ -1,28 +0,0 @@
1
- import { RowJudge, type SchemaView } from '@fougere/schema';
2
- import type { InvocationContext } from '../contract/Invocation.js';
3
- import { ErrorCode, FougereError } from '../wire/errors.js';
4
-
5
- /** Validates and decodes the input body declared by one operation contract. */
6
- export class InputValidator {
7
- validate(
8
- schema: SchemaView | undefined,
9
- invocation: InvocationContext,
10
- entity: string,
11
- operation: string,
12
- ): InvocationContext {
13
- if (!schema || invocation.body === undefined || invocation.body === null) return invocation;
14
-
15
- const result = RowJudge.of(schema.getFields(), { patch: schema.getOpts().patch })
16
- .check(invocation.body);
17
- if (!result.success) {
18
- throw new FougereError({
19
- code: ErrorCode.VALIDATION_FAILED,
20
- message: result.errors.map((error) => `${error.path}: ${error.message}`).join(', '),
21
- details: result.errors,
22
- entity,
23
- operation,
24
- });
25
- }
26
- return { ...invocation, body: result.data };
27
- }
28
- }
@@ -1,60 +0,0 @@
1
- import type { InvocationContext } from '../contract/Invocation.js';
2
- import { canonicalInvocation } from '../contract/Invocation.js';
3
- import type { OperationContract } from '../wire/operation.js';
4
- import {
5
- runMiddlewares,
6
- type AppMiddleware,
7
- type OperationContext,
8
- } from '../wire/middleware.js';
9
- import type { ArgumentResolver } from './ArgumentResolver.js';
10
- import type { InputValidator } from './InputValidator.js';
11
- import type { OutputProjector } from './OutputProjector.js';
12
-
13
- export interface OperationExecution {
14
- entity: string;
15
- frond: string;
16
- operation: string;
17
- contract: OperationContract | undefined;
18
- middlewares: () => AppMiddleware[];
19
- validator: InputValidator;
20
- arguments: ArgumentResolver;
21
- invoke: (args: unknown[]) => unknown | Promise<unknown>;
22
- projector: OutputProjector;
23
- present?: (result: unknown, invocation: InvocationContext) => Promise<unknown>;
24
- }
25
-
26
- /** Executes one operation through the same ordered boundary steps on every route. */
27
- export class OperationExecutor {
28
- constructor(private readonly execution: OperationExecution) {}
29
-
30
- async execute(input?: Partial<InvocationContext>): Promise<unknown> {
31
- const invocation = canonicalInvocation(input);
32
- const context: OperationContext = {
33
- entity: this.execution.entity,
34
- frond: this.execution.frond,
35
- operation: this.execution.operation,
36
- args: [],
37
- state: invocation.state,
38
- invocation,
39
- };
40
- return runMiddlewares(this.execution.middlewares(), context, async () => {
41
- const effective = this.execution.validator.validate(
42
- this.execution.contract?.input,
43
- invocation,
44
- context.entity,
45
- context.operation,
46
- );
47
- context.invocation = effective;
48
-
49
- const args = this.execution.contract?.binding
50
- ? await this.execution.arguments.resolve(this.execution.contract.binding, effective)
51
- : [];
52
- const projected = this.execution.projector.project(
53
- await this.execution.invoke(args),
54
- );
55
- return this.execution.present
56
- ? this.execution.present(projected, effective)
57
- : projected;
58
- });
59
- }
60
- }