@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.
Files changed (519) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/Emissions.d.ts +14 -91
  3. package/dist/boot/Emissions.d.ts.map +1 -1
  4. package/dist/boot/Emissions.js +21 -118
  5. package/dist/boot/Emissions.js.map +1 -1
  6. package/dist/boot/ambient-port.d.ts +3 -24
  7. package/dist/boot/ambient-port.d.ts.map +1 -1
  8. package/dist/boot/ambient.als.d.ts.map +1 -1
  9. package/dist/boot/ambient.als.js +7 -12
  10. package/dist/boot/ambient.als.js.map +1 -1
  11. package/dist/boot/ambient.queue.d.ts +2 -5
  12. package/dist/boot/ambient.queue.d.ts.map +1 -1
  13. package/dist/boot/ambient.queue.js.map +1 -1
  14. package/dist/boot/apply.d.ts +1 -13
  15. package/dist/boot/apply.d.ts.map +1 -1
  16. package/dist/boot/apply.js +3 -15
  17. package/dist/boot/apply.js.map +1 -1
  18. package/dist/boot/auth.d.ts +6 -16
  19. package/dist/boot/auth.d.ts.map +1 -1
  20. package/dist/boot/boot.d.ts +5 -18
  21. package/dist/boot/boot.d.ts.map +1 -1
  22. package/dist/boot/boot.js +4 -11
  23. package/dist/boot/boot.js.map +1 -1
  24. package/dist/boot/bootstrap.d.ts.map +1 -1
  25. package/dist/boot/bootstrap.js +106 -163
  26. package/dist/boot/bootstrap.js.map +1 -1
  27. package/dist/boot/card.d.ts +5 -0
  28. package/dist/boot/card.d.ts.map +1 -0
  29. package/dist/boot/card.js +71 -0
  30. package/dist/boot/card.js.map +1 -0
  31. package/dist/boot/frame.d.ts +8 -32
  32. package/dist/boot/frame.d.ts.map +1 -1
  33. package/dist/boot/frame.js +23 -57
  34. package/dist/boot/frame.js.map +1 -1
  35. package/dist/boot/hosted.d.ts +3 -19
  36. package/dist/boot/hosted.d.ts.map +1 -1
  37. package/dist/boot/hosted.js +12 -17
  38. package/dist/boot/hosted.js.map +1 -1
  39. package/dist/boot/ownership.d.ts +5 -36
  40. package/dist/boot/ownership.d.ts.map +1 -1
  41. package/dist/boot/ownership.js +9 -49
  42. package/dist/boot/ownership.js.map +1 -1
  43. package/dist/boot/ports.d.ts +2 -15
  44. package/dist/boot/ports.d.ts.map +1 -1
  45. package/dist/boot/ports.js +1 -14
  46. package/dist/boot/ports.js.map +1 -1
  47. package/dist/boot/remote.d.ts +5 -38
  48. package/dist/boot/remote.d.ts.map +1 -1
  49. package/dist/boot/remote.js +8 -41
  50. package/dist/boot/remote.js.map +1 -1
  51. package/dist/boot/runner.d.ts +11 -0
  52. package/dist/boot/runner.d.ts.map +1 -0
  53. package/dist/boot/runner.js +13 -0
  54. package/dist/boot/runner.js.map +1 -0
  55. package/dist/boot/seed.d.ts +5 -32
  56. package/dist/boot/seed.d.ts.map +1 -1
  57. package/dist/boot/seed.js +10 -41
  58. package/dist/boot/seed.js.map +1 -1
  59. package/dist/boot/statement-drift.d.ts +4 -22
  60. package/dist/boot/statement-drift.d.ts.map +1 -1
  61. package/dist/boot/statement-drift.js +4 -9
  62. package/dist/boot/statement-drift.js.map +1 -1
  63. package/dist/boot/together.d.ts +8 -12
  64. package/dist/boot/together.d.ts.map +1 -1
  65. package/dist/boot/together.js +28 -65
  66. package/dist/boot/together.js.map +1 -1
  67. package/dist/boot/types.d.ts +36 -180
  68. package/dist/boot/types.d.ts.map +1 -1
  69. package/dist/builtin/config.d.ts +7 -0
  70. package/dist/builtin/config.d.ts.map +1 -0
  71. package/dist/builtin/config.js +15 -0
  72. package/dist/builtin/config.js.map +1 -0
  73. package/dist/{builtins → builtin}/logger.d.ts +4 -25
  74. package/dist/builtin/logger.d.ts.map +1 -0
  75. package/dist/{builtins → builtin}/logger.js +5 -32
  76. package/dist/builtin/logger.js.map +1 -0
  77. package/dist/config-loader.d.ts +9 -67
  78. package/dist/config-loader.d.ts.map +1 -1
  79. package/dist/config-loader.js +5 -18
  80. package/dist/config-loader.js.map +1 -1
  81. package/dist/contract.d.ts +13 -31
  82. package/dist/contract.d.ts.map +1 -1
  83. package/dist/contract.js +10 -26
  84. package/dist/contract.js.map +1 -1
  85. package/dist/crypto/encoding.d.ts +2 -15
  86. package/dist/crypto/encoding.d.ts.map +1 -1
  87. package/dist/crypto/encoding.js +2 -15
  88. package/dist/crypto/encoding.js.map +1 -1
  89. package/dist/crypto/node.d.ts.map +1 -1
  90. package/dist/crypto/node.js +1 -7
  91. package/dist/crypto/node.js.map +1 -1
  92. package/dist/crypto/port.d.ts +2 -18
  93. package/dist/crypto/port.d.ts.map +1 -1
  94. package/dist/crypto/port.js +1 -17
  95. package/dist/crypto/port.js.map +1 -1
  96. package/dist/crypto/webcrypto.d.ts.map +1 -1
  97. package/dist/crypto/webcrypto.js +1 -12
  98. package/dist/crypto/webcrypto.js.map +1 -1
  99. package/dist/declare.d.ts +41 -0
  100. package/dist/declare.d.ts.map +1 -0
  101. package/dist/{scan/declare.js → declare.js} +6 -31
  102. package/dist/declare.js.map +1 -0
  103. package/dist/define.d.ts +2 -3
  104. package/dist/define.d.ts.map +1 -1
  105. package/dist/define.js +2 -3
  106. package/dist/define.js.map +1 -1
  107. package/dist/descriptor/Fronds.d.ts +19 -0
  108. package/dist/descriptor/Fronds.d.ts.map +1 -0
  109. package/dist/descriptor/Fronds.js +40 -0
  110. package/dist/descriptor/Fronds.js.map +1 -0
  111. package/dist/descriptor/frond.d.ts +135 -0
  112. package/dist/descriptor/frond.d.ts.map +1 -0
  113. package/dist/{scan → descriptor}/frond.js.map +1 -1
  114. package/dist/dispatch/ArgumentResolver.d.ts +6 -3
  115. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
  116. package/dist/dispatch/ArgumentResolver.js +48 -3
  117. package/dist/dispatch/ArgumentResolver.js.map +1 -1
  118. package/dist/dispatch/DispatchEvent.d.ts +2 -2
  119. package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
  120. package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
  121. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
  122. package/dist/dispatch/DispatchLifecycle.js +1 -7
  123. package/dist/dispatch/DispatchLifecycle.js.map +1 -1
  124. package/dist/dispatch/DispatchPort.d.ts +1 -1
  125. package/dist/dispatch/DispatchPort.d.ts.map +1 -1
  126. package/dist/dispatch/Dispatcher.d.ts +1 -1
  127. package/dist/dispatch/Dispatcher.d.ts.map +1 -1
  128. package/dist/dispatch/Dispatcher.js +2 -2
  129. package/dist/dispatch/Dispatcher.js.map +1 -1
  130. package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
  131. package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
  132. package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
  133. package/dist/dispatch/HandlerFacade.js.map +1 -0
  134. package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
  135. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
  136. package/dist/dispatch/LocalRoutePolicy.js +4 -4
  137. package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
  138. package/dist/dispatch/OperationRoute.d.ts +2 -2
  139. package/dist/dispatch/OperationRoute.d.ts.map +1 -1
  140. package/dist/dispatch/OutputView.d.ts +3 -2
  141. package/dist/dispatch/OutputView.d.ts.map +1 -1
  142. package/dist/dispatch/OutputView.js +19 -1
  143. package/dist/dispatch/OutputView.js.map +1 -1
  144. package/dist/dispatch/Route.d.ts +2 -3
  145. package/dist/dispatch/Route.d.ts.map +1 -1
  146. package/dist/dispatch/RoutePolicy.d.ts +1 -1
  147. package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
  148. package/dist/dispatch/RouteRegistry.d.ts +1 -1
  149. package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
  150. package/dist/dispatch/RouteRegistry.js +2 -2
  151. package/dist/dispatch/RouteRegistry.js.map +1 -1
  152. package/dist/dispatch/RouteResolver.d.ts +2 -4
  153. package/dist/dispatch/RouteResolver.d.ts.map +1 -1
  154. package/dist/dispatch/StorageGuard.d.ts +9 -8
  155. package/dist/dispatch/StorageGuard.d.ts.map +1 -1
  156. package/dist/dispatch/StorageGuard.js +66 -23
  157. package/dist/dispatch/StorageGuard.js.map +1 -1
  158. package/dist/dispatch/presenterArguments.d.ts +7 -0
  159. package/dist/dispatch/presenterArguments.d.ts.map +1 -0
  160. package/dist/dispatch/presenterArguments.js +12 -0
  161. package/dist/dispatch/presenterArguments.js.map +1 -0
  162. package/dist/dispatch/remoteRoutes.d.ts +7 -0
  163. package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
  164. package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
  165. package/dist/dispatch/remoteRoutes.js.map +1 -0
  166. package/dist/dispatch/routeNotFound.d.ts +9 -0
  167. package/dist/dispatch/routeNotFound.d.ts.map +1 -0
  168. package/dist/dispatch/routeNotFound.js +21 -0
  169. package/dist/dispatch/routeNotFound.js.map +1 -0
  170. package/dist/dispatch/validateInput.d.ts +5 -0
  171. package/dist/dispatch/validateInput.d.ts.map +1 -0
  172. package/dist/dispatch/validateInput.js +20 -0
  173. package/dist/dispatch/validateInput.js.map +1 -0
  174. package/dist/effective-operation.d.ts +6 -3
  175. package/dist/effective-operation.d.ts.map +1 -1
  176. package/dist/effective-operation.js +49 -27
  177. package/dist/effective-operation.js.map +1 -1
  178. package/dist/emit.d.ts +4 -42
  179. package/dist/emit.d.ts.map +1 -1
  180. package/dist/emit.js +3 -39
  181. package/dist/emit.js.map +1 -1
  182. package/dist/entry/facade.d.ts +8 -0
  183. package/dist/entry/facade.d.ts.map +1 -0
  184. package/dist/entry/facade.js +28 -0
  185. package/dist/entry/facade.js.map +1 -0
  186. package/dist/entry/transport.d.ts +5 -0
  187. package/dist/entry/transport.d.ts.map +1 -0
  188. package/dist/entry/transport.js +11 -0
  189. package/dist/entry/transport.js.map +1 -0
  190. package/dist/frond-config.d.ts +8 -71
  191. package/dist/frond-config.d.ts.map +1 -1
  192. package/dist/frond-config.js +1 -9
  193. package/dist/frond-config.js.map +1 -1
  194. package/dist/graph.d.ts +1 -1
  195. package/dist/graph.d.ts.map +1 -1
  196. package/dist/identity-keys.d.ts +2 -5
  197. package/dist/identity-keys.d.ts.map +1 -1
  198. package/dist/identity-keys.js +3 -16
  199. package/dist/identity-keys.js.map +1 -1
  200. package/dist/identity.d.ts +4 -30
  201. package/dist/identity.d.ts.map +1 -1
  202. package/dist/identity.js +11 -73
  203. package/dist/identity.js.map +1 -1
  204. package/dist/imports.d.ts +2 -8
  205. package/dist/imports.d.ts.map +1 -1
  206. package/dist/imports.js +1 -7
  207. package/dist/imports.js.map +1 -1
  208. package/dist/index.d.ts +28 -30
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +17 -22
  211. package/dist/index.js.map +1 -1
  212. package/dist/loader.d.ts +1 -8
  213. package/dist/loader.d.ts.map +1 -1
  214. package/dist/loader.js +1 -8
  215. package/dist/loader.js.map +1 -1
  216. package/dist/node.d.ts +2 -11
  217. package/dist/node.d.ts.map +1 -1
  218. package/dist/node.js +2 -11
  219. package/dist/node.js.map +1 -1
  220. package/dist/prefab/collector.d.ts +1 -22
  221. package/dist/prefab/collector.d.ts.map +1 -1
  222. package/dist/prefab/collector.js +1 -22
  223. package/dist/prefab/collector.js.map +1 -1
  224. package/dist/prefab/crud.d.ts +19 -35
  225. package/dist/prefab/crud.d.ts.map +1 -1
  226. package/dist/prefab/crud.js +39 -66
  227. package/dist/prefab/crud.js.map +1 -1
  228. package/dist/prefab/mirror.d.ts +5 -27
  229. package/dist/prefab/mirror.d.ts.map +1 -1
  230. package/dist/prefab/mirror.js +6 -24
  231. package/dist/prefab/mirror.js.map +1 -1
  232. package/dist/prefab/prefab.d.ts +1 -7
  233. package/dist/prefab/prefab.d.ts.map +1 -1
  234. package/dist/prefab/prefab.js +1 -7
  235. package/dist/prefab/prefab.js.map +1 -1
  236. package/dist/prefab/presenter.d.ts +2 -36
  237. package/dist/prefab/presenter.d.ts.map +1 -1
  238. package/dist/prefab/presenter.js +2 -36
  239. package/dist/prefab/presenter.js.map +1 -1
  240. package/dist/prefab/repository.d.ts +12 -80
  241. package/dist/prefab/repository.d.ts.map +1 -1
  242. package/dist/prefab/repository.js +22 -35
  243. package/dist/prefab/repository.js.map +1 -1
  244. package/dist/scan/adapters.d.ts +3 -0
  245. package/dist/scan/adapters.d.ts.map +1 -0
  246. package/dist/scan/adapters.js +25 -0
  247. package/dist/scan/adapters.js.map +1 -0
  248. package/dist/scan/bundling.d.ts +1 -12
  249. package/dist/scan/bundling.d.ts.map +1 -1
  250. package/dist/scan/bundling.js +1 -12
  251. package/dist/scan/bundling.js.map +1 -1
  252. package/dist/scan/conventions.d.ts +6 -40
  253. package/dist/scan/conventions.d.ts.map +1 -1
  254. package/dist/scan/conventions.js +5 -34
  255. package/dist/scan/conventions.js.map +1 -1
  256. package/dist/scan/emit.d.ts +2 -6
  257. package/dist/scan/emit.d.ts.map +1 -1
  258. package/dist/scan/emit.js +5 -39
  259. package/dist/scan/emit.js.map +1 -1
  260. package/dist/scan/handler-parser.d.ts +9 -76
  261. package/dist/scan/handler-parser.d.ts.map +1 -1
  262. package/dist/scan/handler-parser.js +28 -85
  263. package/dist/scan/handler-parser.js.map +1 -1
  264. package/dist/scan/result.d.ts +28 -0
  265. package/dist/scan/result.d.ts.map +1 -0
  266. package/dist/scan/result.js +2 -0
  267. package/dist/scan/result.js.map +1 -0
  268. package/dist/scan/scanner.d.ts +3 -28
  269. package/dist/scan/scanner.d.ts.map +1 -1
  270. package/dist/scan/scanner.js +36 -135
  271. package/dist/scan/scanner.js.map +1 -1
  272. package/dist/scan/statement.d.ts +1 -1
  273. package/dist/scan/statement.d.ts.map +1 -1
  274. package/dist/scan/statement.js +4 -30
  275. package/dist/scan/statement.js.map +1 -1
  276. package/dist/source.d.ts +41 -0
  277. package/dist/source.d.ts.map +1 -0
  278. package/dist/source.js +10 -0
  279. package/dist/source.js.map +1 -0
  280. package/dist/storage.d.ts +92 -0
  281. package/dist/storage.d.ts.map +1 -0
  282. package/dist/storage.js +50 -0
  283. package/dist/storage.js.map +1 -0
  284. package/dist/store.d.ts +18 -0
  285. package/dist/store.d.ts.map +1 -0
  286. package/dist/store.js +146 -0
  287. package/dist/store.js.map +1 -0
  288. package/dist/verify.d.ts +6 -39
  289. package/dist/verify.d.ts.map +1 -1
  290. package/dist/verify.js +19 -39
  291. package/dist/verify.js.map +1 -1
  292. package/dist/wire/CallLog.d.ts +32 -0
  293. package/dist/wire/CallLog.d.ts.map +1 -0
  294. package/dist/{contract → wire}/CallLog.js.map +1 -1
  295. package/dist/wire/Invocation.d.ts +32 -0
  296. package/dist/wire/Invocation.d.ts.map +1 -0
  297. package/dist/wire/Invocation.js +66 -0
  298. package/dist/wire/Invocation.js.map +1 -0
  299. package/dist/wire/RouteAddress.d.ts +24 -0
  300. package/dist/wire/RouteAddress.d.ts.map +1 -0
  301. package/dist/{contract → wire}/RouteAddress.js +7 -0
  302. package/dist/wire/RouteAddress.js.map +1 -0
  303. package/dist/wire/binding.d.ts +36 -0
  304. package/dist/wire/binding.d.ts.map +1 -0
  305. package/dist/{boot → wire}/binding.js +5 -62
  306. package/dist/wire/binding.js.map +1 -0
  307. package/dist/wire/call.d.ts +25 -172
  308. package/dist/wire/call.d.ts.map +1 -1
  309. package/dist/wire/call.js +15 -166
  310. package/dist/wire/call.js.map +1 -1
  311. package/dist/wire/drift.d.ts +3 -28
  312. package/dist/wire/drift.d.ts.map +1 -1
  313. package/dist/wire/drift.js +4 -23
  314. package/dist/wire/drift.js.map +1 -1
  315. package/dist/wire/errors.d.ts +4 -24
  316. package/dist/wire/errors.d.ts.map +1 -1
  317. package/dist/wire/errors.js +4 -24
  318. package/dist/wire/errors.js.map +1 -1
  319. package/dist/wire/http-error.d.ts +2 -13
  320. package/dist/wire/http-error.d.ts.map +1 -1
  321. package/dist/wire/http-error.js +5 -19
  322. package/dist/wire/http-error.js.map +1 -1
  323. package/dist/wire/loggerMiddleware.d.ts +2 -8
  324. package/dist/wire/loggerMiddleware.d.ts.map +1 -1
  325. package/dist/wire/loggerMiddleware.js +1 -7
  326. package/dist/wire/loggerMiddleware.js.map +1 -1
  327. package/dist/wire/middleware.d.ts +3 -7
  328. package/dist/wire/middleware.d.ts.map +1 -1
  329. package/dist/wire/middleware.js +1 -5
  330. package/dist/wire/middleware.js.map +1 -1
  331. package/dist/wire/operation.d.ts +12 -74
  332. package/dist/wire/operation.d.ts.map +1 -1
  333. package/dist/wire/operation.js +4 -66
  334. package/dist/wire/operation.js.map +1 -1
  335. package/dist/wire/signature.d.ts +37 -0
  336. package/dist/wire/signature.d.ts.map +1 -0
  337. package/dist/wire/signature.js +2 -0
  338. package/dist/wire/signature.js.map +1 -0
  339. package/package.json +3 -3
  340. package/src/boot/Emissions.ts +22 -119
  341. package/src/boot/ambient-port.ts +3 -24
  342. package/src/boot/ambient.als.ts +7 -12
  343. package/src/boot/ambient.queue.ts +2 -5
  344. package/src/boot/apply.ts +3 -15
  345. package/src/boot/auth.ts +6 -16
  346. package/src/boot/boot.ts +8 -23
  347. package/src/boot/bootstrap.ts +117 -173
  348. package/src/boot/card.ts +84 -0
  349. package/src/boot/frame.ts +31 -65
  350. package/src/boot/hosted.ts +15 -40
  351. package/src/boot/ownership.ts +14 -49
  352. package/src/boot/ports.ts +2 -15
  353. package/src/boot/remote.ts +11 -58
  354. package/src/boot/runner.ts +17 -0
  355. package/src/boot/seed.ts +11 -42
  356. package/src/boot/statement-drift.ts +10 -28
  357. package/src/boot/together.ts +38 -72
  358. package/src/boot/types.ts +36 -180
  359. package/src/{builtins → builtin}/config.ts +1 -7
  360. package/src/{builtins → builtin}/logger.ts +6 -39
  361. package/src/config-loader.ts +12 -71
  362. package/src/contract.ts +15 -39
  363. package/src/crypto/encoding.ts +2 -15
  364. package/src/crypto/node.ts +1 -7
  365. package/src/crypto/port.ts +2 -18
  366. package/src/crypto/webcrypto.ts +1 -12
  367. package/src/{scan/declare.ts → declare.ts} +11 -42
  368. package/src/define.ts +2 -3
  369. package/src/descriptor/Fronds.ts +47 -0
  370. package/src/descriptor/frond.ts +145 -0
  371. package/src/dispatch/ArgumentResolver.ts +54 -8
  372. package/src/dispatch/DispatchEvent.ts +2 -2
  373. package/src/dispatch/DispatchLifecycle.ts +1 -7
  374. package/src/dispatch/DispatchPort.ts +1 -1
  375. package/src/dispatch/Dispatcher.ts +3 -3
  376. package/src/dispatch/HandlerFacade.ts +231 -0
  377. package/src/dispatch/LocalRoutePolicy.ts +4 -4
  378. package/src/dispatch/OperationRoute.ts +2 -2
  379. package/src/dispatch/OutputView.ts +24 -2
  380. package/src/dispatch/Route.ts +2 -4
  381. package/src/dispatch/RoutePolicy.ts +1 -1
  382. package/src/dispatch/RouteRegistry.ts +2 -2
  383. package/src/dispatch/RouteResolver.ts +2 -4
  384. package/src/dispatch/StorageGuard.ts +75 -23
  385. package/src/dispatch/presenterArguments.ts +25 -0
  386. package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
  387. package/src/dispatch/routeNotFound.ts +33 -0
  388. package/src/dispatch/validateInput.ts +28 -0
  389. package/src/effective-operation.ts +60 -37
  390. package/src/emit.ts +5 -63
  391. package/src/entry/facade.ts +44 -0
  392. package/src/entry/transport.ts +16 -0
  393. package/src/frond-config.ts +8 -71
  394. package/src/graph.ts +1 -1
  395. package/src/identity-keys.ts +3 -16
  396. package/src/identity.ts +12 -80
  397. package/src/imports.ts +3 -32
  398. package/src/index.ts +28 -33
  399. package/src/loader.ts +2 -16
  400. package/src/node.ts +2 -11
  401. package/src/prefab/collector.ts +1 -22
  402. package/src/prefab/crud.ts +51 -90
  403. package/src/prefab/mirror.ts +9 -49
  404. package/src/prefab/prefab.ts +2 -21
  405. package/src/prefab/presenter.ts +2 -36
  406. package/src/prefab/repository.ts +32 -108
  407. package/src/scan/adapters.ts +32 -0
  408. package/src/scan/bundling.ts +1 -12
  409. package/src/scan/conventions.ts +6 -40
  410. package/src/scan/emit.ts +7 -43
  411. package/src/scan/handler-parser.ts +41 -163
  412. package/src/scan/result.ts +29 -0
  413. package/src/scan/scanner.ts +40 -138
  414. package/src/scan/statement.ts +6 -31
  415. package/src/source.ts +44 -0
  416. package/src/storage.ts +141 -0
  417. package/src/store.ts +152 -0
  418. package/src/verify.ts +19 -60
  419. package/src/wire/CallLog.ts +30 -0
  420. package/src/{contract → wire}/Invocation.ts +24 -17
  421. package/src/{contract → wire}/RouteAddress.ts +10 -0
  422. package/src/wire/binding.ts +102 -0
  423. package/src/wire/call.ts +30 -261
  424. package/src/wire/drift.ts +5 -30
  425. package/src/wire/errors.ts +4 -24
  426. package/src/wire/http-error.ts +5 -19
  427. package/src/wire/loggerMiddleware.ts +2 -8
  428. package/src/wire/middleware.ts +3 -7
  429. package/src/wire/operation.ts +13 -110
  430. package/src/wire/signature.ts +38 -0
  431. package/dist/boot/HandlerFacade.d.ts.map +0 -1
  432. package/dist/boot/HandlerFacade.js.map +0 -1
  433. package/dist/boot/binding.d.ts +0 -60
  434. package/dist/boot/binding.d.ts.map +0 -1
  435. package/dist/boot/binding.js.map +0 -1
  436. package/dist/builtins/config.d.ts +0 -13
  437. package/dist/builtins/config.d.ts.map +0 -1
  438. package/dist/builtins/config.js +0 -21
  439. package/dist/builtins/config.js.map +0 -1
  440. package/dist/builtins/logger.d.ts.map +0 -1
  441. package/dist/builtins/logger.js.map +0 -1
  442. package/dist/contract/Call.d.ts +0 -10
  443. package/dist/contract/Call.d.ts.map +0 -1
  444. package/dist/contract/Call.js +0 -15
  445. package/dist/contract/Call.js.map +0 -1
  446. package/dist/contract/CallLog.d.ts +0 -57
  447. package/dist/contract/CallLog.d.ts.map +0 -1
  448. package/dist/contract/Invocation.d.ts +0 -27
  449. package/dist/contract/Invocation.d.ts.map +0 -1
  450. package/dist/contract/Invocation.js +0 -59
  451. package/dist/contract/Invocation.js.map +0 -1
  452. package/dist/contract/RouteAddress.d.ts +0 -17
  453. package/dist/contract/RouteAddress.d.ts.map +0 -1
  454. package/dist/contract/RouteAddress.js.map +0 -1
  455. package/dist/dispatch/InputValidator.d.ts +0 -7
  456. package/dist/dispatch/InputValidator.d.ts.map +0 -1
  457. package/dist/dispatch/InputValidator.js +0 -22
  458. package/dist/dispatch/InputValidator.js.map +0 -1
  459. package/dist/dispatch/OperationExecutor.d.ts +0 -25
  460. package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
  461. package/dist/dispatch/OperationExecutor.js +0 -32
  462. package/dist/dispatch/OperationExecutor.js.map +0 -1
  463. package/dist/dispatch/OutputProjector.d.ts +0 -12
  464. package/dist/dispatch/OutputProjector.d.ts.map +0 -1
  465. package/dist/dispatch/OutputProjector.js +0 -30
  466. package/dist/dispatch/OutputProjector.js.map +0 -1
  467. package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
  468. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
  469. package/dist/dispatch/PresenterArgumentResolver.js +0 -20
  470. package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
  471. package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
  472. package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
  473. package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
  474. package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
  475. package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
  476. package/dist/dispatch/RouteNotFoundError.js +0 -24
  477. package/dist/dispatch/RouteNotFoundError.js.map +0 -1
  478. package/dist/entry/DynamicFacade.d.ts +0 -10
  479. package/dist/entry/DynamicFacade.d.ts.map +0 -1
  480. package/dist/entry/DynamicFacade.js +0 -27
  481. package/dist/entry/DynamicFacade.js.map +0 -1
  482. package/dist/entry/FacadeEntry.d.ts +0 -11
  483. package/dist/entry/FacadeEntry.d.ts.map +0 -1
  484. package/dist/entry/FacadeEntry.js +0 -26
  485. package/dist/entry/FacadeEntry.js.map +0 -1
  486. package/dist/entry/TransportEntry.d.ts +0 -13
  487. package/dist/entry/TransportEntry.d.ts.map +0 -1
  488. package/dist/entry/TransportEntry.js +0 -24
  489. package/dist/entry/TransportEntry.js.map +0 -1
  490. package/dist/orm.d.ts +0 -207
  491. package/dist/orm.d.ts.map +0 -1
  492. package/dist/orm.js +0 -66
  493. package/dist/orm.js.map +0 -1
  494. package/dist/scan/Fronds.d.ts +0 -45
  495. package/dist/scan/Fronds.d.ts.map +0 -1
  496. package/dist/scan/Fronds.js +0 -66
  497. package/dist/scan/Fronds.js.map +0 -1
  498. package/dist/scan/declare.d.ts +0 -71
  499. package/dist/scan/declare.d.ts.map +0 -1
  500. package/dist/scan/declare.js.map +0 -1
  501. package/dist/scan/frond.d.ts +0 -224
  502. package/dist/scan/frond.d.ts.map +0 -1
  503. package/src/boot/HandlerFacade.ts +0 -242
  504. package/src/boot/binding.ts +0 -182
  505. package/src/contract/Call.ts +0 -18
  506. package/src/contract/CallLog.ts +0 -55
  507. package/src/dispatch/InputValidator.ts +0 -28
  508. package/src/dispatch/OperationExecutor.ts +0 -60
  509. package/src/dispatch/OutputProjector.ts +0 -32
  510. package/src/dispatch/PresenterArgumentResolver.ts +0 -25
  511. package/src/dispatch/RouteNotFoundError.ts +0 -29
  512. package/src/entry/DynamicFacade.ts +0 -28
  513. package/src/entry/FacadeEntry.ts +0 -32
  514. package/src/entry/TransportEntry.ts +0 -30
  515. package/src/orm.ts +0 -252
  516. package/src/scan/Fronds.ts +0 -73
  517. package/src/scan/frond.ts +0 -235
  518. /package/dist/{scan → descriptor}/frond.js +0 -0
  519. /package/dist/{contract → wire}/CallLog.js +0 -0
@@ -1,18 +1,10 @@
1
- /**
2
- * Building a frame — what a handler asking for `Together<[…]>` receives.
3
- *
4
- * The declaration names its members and nothing else; where they live, and therefore
5
- * which of the two realizations they get, is read HERE and stated at boot. A frame whose
6
- * members share an engine is a transaction; one whose members are split replays its own
7
- * inverses (`frame.ts`). Same user code, two guarantees, and the boot says which — the
8
- * one thing a gradient must never leave to assumption.
9
- */
1
+ /** Building a frame — what a handler asking for `Together<[…]>` receives. */
10
2
  import { ambient } from '#ambient';
11
3
  import { upperFirst, lowerFirst, type SchemaView } from '@fougere/schema';
12
4
  import type { Container } from '@fougere/container';
13
- import { membersOfTogetherKey, ormKeyOf, type EntityOrm, type OrmFactory } from '../orm.js';
14
- import type { Logger } from '../builtins/logger.js';
15
- import type { ProviderEntry } from '../scan/frond.js';
5
+ import { membersOfTogetherKey, storageKeyOf, entityOfStorageKey, type Storage, type StorageFactory } from '../storage.js';
6
+ import type { Logger } from '../builtin/logger.js';
7
+ import type { ProviderEntry } from '../descriptor/frond.js';
16
8
  import { StorageGuard } from '../dispatch/StorageGuard.js';
17
9
  import { recording, unwind, type Undo } from './frame.js';
18
10
 
@@ -23,9 +15,11 @@ export interface FrameWorld {
23
15
  /** Which frond holds an entity — the question `remotes:` turns into a refusal. */
24
16
  frondOf: Map<string, string>;
25
17
  hostedHere: (frond: string) => boolean;
26
- ormFactory?: OrmFactory;
18
+ storageFactory?: StorageFactory;
27
19
  sourceOf?: (entityName: string) => string;
28
- transacted?: <R>(source: string, fn: (ormFactory: OrmFactory) => Promise<R>) => Promise<R>;
20
+ /** Whether that source hands one out asked before the frame is built, not at the call. */
21
+ transacts?: (source: string) => boolean;
22
+ transacted?: <R>(source: string, fn: (storageFactory: StorageFactory) => Promise<R>) => Promise<R>;
29
23
  log: Logger;
30
24
  }
31
25
 
@@ -35,14 +29,7 @@ interface Members {
35
29
  providers: ProviderEntry[];
36
30
  }
37
31
 
38
- /**
39
- * Each declared name, resolved to what it designates.
40
- *
41
- * A name that resolves to nothing is refused rather than skipped: `Together<[Account,
42
- * Ledgre]>` is a typo whose only other symptom is a frame quietly one member short. The
43
- * two lists are checked against different registries, which is exactly why the declaration
44
- * separates them — nothing here has to guess what kind a name is.
45
- */
32
+ /** Each declared name, resolved to what it designates. */
46
33
  function resolve(names: { entities: string[]; providers: string[] }, declared: readonly ProviderEntry[], world: FrameWorld): Members {
47
34
  const entities = names.entities.map((member) => {
48
35
  const name = lowerFirst(member);
@@ -71,12 +58,7 @@ function resolve(names: { entities: string[]; providers: string[] }, declared: r
71
58
  return { entities, providers };
72
59
  }
73
60
 
74
- /**
75
- * A member that cannot write here at all — its frond is hosted elsewhere.
76
- *
77
- * Refused rather than compensated: a compensated frame still writes through a local ORM,
78
- * and a remote frond registers none. There is nothing to record and nothing to undo.
79
- */
61
+ /** A member that cannot write here at all — its frond is hosted elsewhere. */
80
62
  function refuseRemote(members: Members, world: FrameWorld, key: string): void {
81
63
  for (const member of members.entities) {
82
64
  const frond = world.frondOf.get(member.name);
@@ -90,19 +72,13 @@ function refuseRemote(members: Members, world: FrameWorld, key: string): void {
90
72
  }
91
73
  }
92
74
 
93
- /**
94
- * A provider member writing an entity the frame does not name.
95
- *
96
- * The frame does not widen itself to cover it: doing so would pull an entity from another
97
- * source into the group without anyone writing it down. Named instead, with the one-word fix.
98
- */
99
- function refuseUncoveredWrites(members: Members, key: string): void {
75
+ /** A provider member writing an entity the frame does not name. */
76
+ function refuseUncoveredWrites(members: Members, key: string, world: FrameWorld): void {
100
77
  const covered = new Set(members.entities.map((member) => member.name));
101
78
  for (const provider of members.providers) {
102
79
  for (const dep of provider.deps) {
103
- if (!dep.endsWith('Orm')) continue;
104
- const entity = lowerFirst(dep.slice(0, -'Orm'.length));
105
- if (covered.has(entity)) continue;
80
+ const entity = entityOfStorageKey(dep, (name) => world.entityByName.has(name));
81
+ if (!entity || covered.has(entity)) continue;
106
82
  throw new Error(
107
83
  `Together<[…]> (${key}): ${provider.ctor.name} writes ${entity}, which is not in the ` +
108
84
  `frame's entity list — its writes would escape the unwind. Add it: ` +
@@ -112,45 +88,33 @@ function refuseUncoveredWrites(members: Members, key: string): void {
112
88
  }
113
89
  }
114
90
 
115
- /**
116
- * Open the block: build every member over `factory`, in a scope of their own.
117
- *
118
- * The scope is what makes a provider member work without a locator — its ORM keys are
119
- * registered here, so the container hands it the framed ones through the ordinary
120
- * constructor. It is disposed when the block ends, whichever way it ended.
121
- */
91
+ /** Open the block. */
122
92
  async function inScope<R>(
123
93
  parent: Container,
124
94
  members: Members,
125
- factory: OrmFactory,
126
- wrap: (orm: EntityOrm, name: string, schema: SchemaView) => EntityOrm,
95
+ factory: StorageFactory,
96
+ wrap: (storage: Storage, name: string, schema: SchemaView) => Storage,
127
97
  fn: (entities: unknown[], providers: unknown[]) => Promise<R>,
128
98
  ): Promise<R> {
129
99
  const scope = parent.createScope();
130
100
  try {
131
- const orms = members.entities.map((member) => {
132
- const orm = wrap(factory(member.schema, member.name), member.name, member.schema);
133
- scope.registerValue(ormKeyOf(member.name), orm);
134
- return orm;
101
+ const storages = members.entities.map((member) => {
102
+ const storage = wrap(factory(member.schema, member.name), member.name, member.schema);
103
+ scope.registerValue(storageKeyOf(member.name), storage);
104
+ return storage;
135
105
  });
136
- // Providers after every ORM is in place: one may depend on another member's.
106
+ // Providers after every storage is in place: one may depend on another member's.
137
107
  const built = members.providers.map((provider) => {
138
108
  scope.register(provider.ctor.name, provider.ctor, { deps: provider.deps });
139
109
  return scope.resolve(provider.ctor.name);
140
110
  });
141
- return await fn(orms, built);
111
+ return await fn(storages, built);
142
112
  } finally {
143
113
  await scope.dispose();
144
114
  }
145
115
  }
146
116
 
147
- /**
148
- * Register one frame per key a handler or provider of this frond asked for.
149
- *
150
- * Called with the frond's scope, because that is where the asking constructor resolves —
151
- * while the MEMBERS are looked up app-wide, a frame crossing fronds being the ordinary case
152
- * rather than the exception (the frond is not the storage boundary; `sources:` is).
153
- */
117
+ /** Register one frame per key a handler or provider of this frond asked for. */
154
118
  export function registerFrames(
155
119
  scope: Container,
156
120
  keys: Iterable<string>,
@@ -162,32 +126,34 @@ export function registerFrames(
162
126
  const names = membersOfTogetherKey(key);
163
127
  if (!names) continue;
164
128
  registered += 1;
165
- if (!world.ormFactory) {
129
+ if (!world.storageFactory) {
166
130
  throw new Error(`Together<[${names.entities.join(', ')}]> needs storage, and this boot declares none.`);
167
131
  }
168
132
 
169
133
  const members = resolve(names, providers, world);
170
134
  refuseRemote(members, world, key);
171
- refuseUncoveredWrites(members, key);
135
+ refuseUncoveredWrites(members, key, world);
172
136
 
173
137
  const sources = new Set(members.entities.map((member) => world.sourceOf?.(member.name) ?? 'db'));
174
- const judge = (orm: EntityOrm, name: string, schema: SchemaView) =>
175
- new StorageGuard(schema.getFields(), name).guard(orm);
138
+ const validator = (storage: Storage, name: string, schema: SchemaView) =>
139
+ new StorageGuard(schema.getFields(), name).guard(storage);
176
140
 
177
- // One engine and a way into it: the engine gives the unwind AND the isolation.
178
- if (world.transacted && sources.size === 1) {
179
- const source = [...sources][0];
141
+ // One engine and a way into it: the engine gives the unwind AND the isolation. The
142
+ // question goes to the source these members live in — a composition answering for the
143
+ // default one would compensate a frame whose own engine holds transactions.
144
+ const source = sources.size === 1 ? [...sources][0]! : undefined;
145
+ if (world.transacted && source !== undefined && (world.transacts?.(source) ?? true)) {
180
146
  world.log.info(`${key} — transaction, source '${source}'`);
181
147
  scope.registerValue(key, {
182
148
  run: <R>(fn: (entities: never, providers: never) => Promise<R>) =>
183
149
  ambient.enterFrame(key, () =>
184
- world.transacted!(source, (factory) => inScope(scope, members, factory, judge, fn as never))),
150
+ world.transacted!(source, (factory) => inScope(scope, members, factory, validator, fn as never))),
185
151
  });
186
152
  continue;
187
153
  }
188
154
 
189
155
  // Split, or an engine that hands out no transaction: the frame keeps the before-image
190
- // of every write and replays the inverses itself. `judge` stays OUTSIDE `recording`, so
156
+ // of every write and replays the inverses itself. `validator` stays OUTSIDE `recording`, so
191
157
  // a write the entity refuses never enters the journal.
192
158
  const why = sources.size > 1
193
159
  ? members.entities.map((m) => `${m.name} in '${world.sourceOf?.(m.name) ?? 'db'}'`).join(', ')
@@ -196,10 +162,10 @@ export function registerFrames(
196
162
  scope.registerValue(key, {
197
163
  run: <R>(fn: (entities: never, providers: never) => Promise<R>): Promise<R> => ambient.enterFrame(key, async () => {
198
164
  const journal: Undo[] = [];
199
- const record = (orm: EntityOrm, name: string, schema: SchemaView) =>
200
- judge(recording(orm, name, schema.getFields(), journal), name, schema);
165
+ const record = (storage: Storage, name: string, schema: SchemaView) =>
166
+ validator(recording(storage, name, schema, journal), name, schema);
201
167
  try {
202
- return await inScope(scope, members, world.ormFactory!, record, fn as never);
168
+ return await inScope(scope, members, world.storageFactory!, record, fn as never);
203
169
  } catch (cause) {
204
170
  return unwind(journal, cause, world.log);
205
171
  }
package/src/boot/types.ts CHANGED
@@ -1,15 +1,10 @@
1
- /**
2
- * The boot's two ends: what `createApp` takes, and what it hands back.
3
- *
4
- * The scan's descriptors moved to `frond.ts` and the auth contract to `auth.ts` — this
5
- * file was named after a role ("the types"), so everything with nowhere else to be
6
- * landed in it, seventeen notions deep.
7
- */
1
+ /** The boot's two ends. */
8
2
  import type { Container } from '@fougere/container';
9
- import type { Fronds } from '../scan/Fronds.js';
10
- import type { FrondDescriptor, ScanResult } from '../scan/frond.js';
3
+ import type { Fronds } from '../descriptor/Fronds.js';
4
+ import type { FrondDescriptor } from '../descriptor/frond.js';
5
+ import type { ScanResult } from '../scan/result.js';
11
6
  import type { SchemaView } from '@fougere/schema';
12
- import type { OrmFactory } from '../orm.js';
7
+ import type { StorageFactory } from '../storage.js';
13
8
  import type { AppMiddleware } from '../wire/middleware.js';
14
9
  import type { RpcAnswer, Transport } from '../wire/call.js';
15
10
  import type { Extension } from './AppLifecycle.js';
@@ -22,107 +17,44 @@ import type { DispatchPort } from '../dispatch/DispatchPort.js';
22
17
  export interface CreateAppOptions {
23
18
  /** Factory function to create the container. Required. */
24
19
  createContainer: () => Container;
25
- /** Factory to auto-generate EntityOrm for each scanned entity. */
26
- ormFactory?: OrmFactory;
20
+ /** Factory to auto-generate Storage for each scanned entity. */
21
+ storageFactory?: StorageFactory;
27
22
  /**
28
23
  * Which source an entity's rows live in, and how to open a transaction on one — the two
29
- * questions that decide whether `Together<[…]>` gets the engine's own unwind or replays
30
- * inverses itself.
31
- *
32
- * Optional together, because a host may hand in a bare `ormFactory` and know neither. A
33
- * frame then compensates: not knowing where the rows are and promising atomicity over
34
- * them are two different things, and only one of them is honest.
24
+ * questions that decide whether `Together<[…]>` gets the engine's own unwind or replays inverses
25
+ * itself.
35
26
  */
36
27
  sourceOf?: (entityName: string) => string;
37
- transacted?: <R>(source: string, fn: (ormFactory: OrmFactory) => Promise<R>) => Promise<R>;
38
- /**
39
- * Builds the cross-source reader a frond gets when it declares `reads:`.
40
- *
41
- * A factory rather than a value, for the same reason `ormFactory` is one: core must
42
- * not name a storage package, and this one costs 71 MB of downloaded extensions and a
43
- * native module — nothing a first run that only wanted sqlite should carry. The host
44
- * decides what backs it; `@fougere/adapter-duckdb` is one answer, not the contract.
45
- *
46
- * Called once per frond that asks, with the entity CLASSES its `reads:` named — a
47
- * name would make the reader resolve the schema a second time.
48
- */
28
+ transacts?: (source: string) => boolean;
29
+ transacted?: <R>(source: string, fn: (storageFactory: StorageFactory) => Promise<R>) => Promise<R>;
30
+ /** Builds the cross-source reader a frond gets when it declares `reads:`. */
49
31
  sourcesFactory?: (reads: unknown[], frond: string) => Promise<unknown> | unknown;
50
- /**
51
- * What this app is built from — required, because producing it is what reads a disk.
52
- *
53
- * `scanProject` (`@fougere/core/node`) reads the fronds off the filesystem; a module a
54
- * build wrote holds the same value with no disk at all. `createApp` cannot tell them
55
- * apart, and that is the point: it names no builtin, so a runtime without `node:fs`
56
- * runs it. `root` and `fronds` used to live here — both were arguments to the scan.
57
- */
32
+ /** What this app is built from — required, because producing it is what reads a disk. */
58
33
  scan?: ScanResult | (() => Promise<ScanResult> | ScanResult);
59
- /**
60
- * What this app STATES it hosts — `frond('blog', { entities: [Post] })`.
61
- *
62
- * Passing this and not `scan:` is how an app says "do not scan": nothing reads a disk,
63
- * nothing loads `typescript`, and what was not named does not exist. Passing both fills
64
- * the members left unnamed from what the scan found — the app's word wins, the way
65
- * `frond.config.ts` wins over the scan one level down.
66
- */
34
+ /** What this app STATES it hosts — `frond('blog', { entities: [Post] })`. */
67
35
  fronds?: readonly FrondDescriptor[];
68
36
  /**
69
37
  * Remote fronds — label → address. What each remote hosts is discovered
70
38
  * at the first miss (rpc.discover), never declared here.
71
39
  */
72
40
  remotes?: Record<string, string>;
73
- /**
74
- * Builds the transport used to reach `remotes` addresses. Wired by
75
- * layer-2 packages (e.g. @fougere/transport-http); required when
76
- * `remotes` is non-empty.
77
- */
41
+ /** Builds the transport used to reach `remotes` addresses. */
78
42
  remoteTransport?: (url: string) => Transport;
79
43
  /**
80
44
  * Which realization answers which port — see `FougereConfig.ports`. Needed only
81
45
  * when two classes extend the same port; one is resolved by convention.
82
46
  */
83
47
  ports?: Record<string, string>;
84
- /**
85
- * What this app takes on beyond its fronds, each stating what it does and what it undoes.
86
- *
87
- * `up` runs before `createApp` returns, in this order; `down` runs inside `dispose()`,
88
- * in reverse. Three levels release in reverse of construction, which is the container's
89
- * own rule read one level out: extensions first (built last), then the container, then
90
- * `onDispose` — a resource opened before any of this existed.
91
- *
92
- * A member may be `undefined`, so a host writes a conditional one inline rather than a
93
- * spread over a ternary. The framework's own two are always declared, `migrate` as an
94
- * empty slot when nothing migrates: a host filling it later REPLACES that member in
95
- * place instead of adding one after the seeds.
96
- */
48
+ /** What this app takes on beyond its fronds, each stating what it does and what it undoes. */
97
49
  extensions?: readonly (Extension | undefined)[];
98
50
  /**
99
- * Released by `app.dispose()` AFTER the container, for a resource handed in rather
100
- * than built here — a storage connection is the one case today.
101
- *
102
- * NOT an extension, and the difference is a time: this was opened BEFORE the container,
103
- * so it closes after it, while an extension's `up` runs after the container and its
104
- * `down` therefore runs before. A storage's migration is an extension; its connection
105
- * is not, and `ResolvedStorage` declares the two beside each other.
51
+ * Released by `app.dispose()` AFTER the container, for a resource handed in rather than built
52
+ * here — a storage connection is the one case today.
106
53
  */
107
54
  onDispose?: () => Promise<void> | void;
108
- /**
109
- * Which protocol adapters this app serves — see `FougereConfig.adapters`.
110
- * Carried onto the App so every door reads one answer instead of each host
111
- * deciding for itself.
112
- */
55
+ /** Which protocol adapters this app serves — see `FougereConfig.adapters`. */
113
56
  adapters?: Record<string, boolean | undefined>;
114
- /**
115
- * Carries an announced fact out of this process — a broker, a queue, a log.
116
- *
117
- * Called for every emission, ALONGSIDE the local dispatch and never instead of it: a
118
- * listener in this process is reached directly, and this is how the others hear.
119
- *
120
- * It exists because the local dispatch finds its listeners by having READ their code,
121
- * which stops at the repository boundary. A carrier hands the fact to a NAME; the far
122
- * side subscribes to that same name from its own code, and neither ever reads the other.
123
- *
124
- * Its failure never reaches the emitter — same rule as a subscriber's.
125
- */
57
+ /** Carries an announced fact out of this process — a broker, a queue, a log. */
126
58
  onEmit?: (fact: string, payload: unknown) => void | Promise<void>;
127
59
  /** Passive observers of every dispatch transition. */
128
60
  dispatchObservers?: readonly DispatchObserver[];
@@ -141,13 +73,7 @@ export interface App extends DispatchPort {
141
73
  local: DispatchPort;
142
74
  /** Root container with builtins + frond scopes. */
143
75
  container: Container;
144
- /**
145
- * Which protocol adapters this app declared, from `fougere.config.ts`.
146
- *
147
- * Read by the doors themselves, so an undeclared adapter serves nothing whatever
148
- * the host mounted — the route file may exist, the middleware may be installed, and
149
- * the answer is still "not here".
150
- */
76
+ /** Which protocol adapters this app declared, from `fougere.config.ts`. */
151
77
  adapters: Record<string, boolean | undefined>;
152
78
  /** Where a call goes, as the config declared it — frond name to address. */
153
79
  remotes: Readonly<Record<string, string>>;
@@ -156,113 +82,43 @@ export interface App extends DispatchPort {
156
82
  /** Resolve from root container (shortcut). */
157
83
  resolve<T>(name: string): T;
158
84
  /**
159
- * Resolve an entity's schema — the local `entityClass` when it's hosted or
160
- * scanned here, else reconstructed from the remote's identity card
161
- * (`rpc.discover` to `Card.toSchema`). The one way to get a live schema for an
162
- * entity whose class may not be importable at all (another repo, another
163
- * language) — a card travelled, but until now its `schema` was thrown away.
85
+ * Resolve an entity's schema — the local `entityClass` when it's hosted or scanned here, else
86
+ * reconstructed from the remote's identity card (`rpc.discover` to `Card.toSchema`).
164
87
  */
165
88
  schemaFor(entity: string): Promise<SchemaView>;
166
- /**
167
- * The door a name exposes to one audience, or `undefined` when it exposes
168
- * none. A named surface is CLOSED: a name with no door of its own under that
169
- * surface is not in it — it never falls back to the full one.
170
- *
171
- * **Not always a façade**, despite the name: when the owning frond is declared
172
- * remote, nothing is registered locally (`bootstrap.ts`, `declaredRemotes`) and
173
- * this resolves to a doublure — a façade-shaped stand-in (`remote.ts`). The
174
- * caller cannot tell, which is the point; the word here was simply wrong.
175
- *
176
- * The one way an adapter reaches that door. It exists so the key format stays
177
- * inside core (see `facadeKeyOf`), which is what lets a projection package
178
- * stay structurally typed and depend on nothing.
179
- */
89
+ /** The door a name exposes to one audience, or `undefined` when it exposes none. */
180
90
  facadeFor(entity: string, surface?: string): Record<string, Function> | undefined;
181
91
  /**
182
- * The canonical contracts served beside a facade, after prefab + scan + config,
183
- * binding, kind, topology and surface resolution. Check, explain and adapters read
184
- * this table instead of replaying those decisions.
92
+ * The canonical contracts served beside a facade, after prefab + scan + config, binding, kind,
93
+ * topology and surface resolution.
185
94
  */
186
95
  operationsFor(entity: string, surface?: string): EffectiveOperationsMap | undefined;
187
- /**
188
- * The facts this app has a listener for — what a carrier must subscribe to on its behalf.
189
- *
190
- * Derived from the signatures it scanned (`Fact<T>` in an op's parameters), so a process
191
- * states what it listens to without anyone declaring it twice. The dual of `onEmit`: one
192
- * says what leaves, this says what should be brought in.
193
- */
96
+ /** The facts this app has a listener for — what a carrier must subscribe to on its behalf. */
194
97
  listensTo(): string[];
195
- /**
196
- * Hand a fact that came from OUTSIDE to the listeners in this process — and stop there.
197
- *
198
- * The dual of `onEmit`, and deliberately not the same thing as announcing: resolving the
199
- * emission value to deliver an inbound fact would carry it straight back out through
200
- * `onEmit`, so a hub echoed every reading it received to the whole fleet. Receiving and
201
- * announcing are two operations; only one of them leaves.
202
- *
203
- * The local dispatch is identical either way — same judge, same binding, same
204
- * middlewares — so a fact off a wire is no less checked than one raised next door.
205
- *
206
- * **It waits, and it tells** — the opposite of announcing, on purpose. It resolves once
207
- * every listener here is done, and REJECTS with an `AggregateError` if any refused. A
208
- * carrier's whole job is to know whether the fact landed: at-least-once is retrying what
209
- * failed, so a delivery that cannot report makes durability impossible to build above it.
210
- * "Dispatch is not delivery" protects the EMITTER from a slow subscriber; a carrier is
211
- * not the emitter, it is the party whose business this is.
212
- *
213
- * It still holds nothing. A refused fact is refused, and whether it comes back is the
214
- * carrier's decision — Fougere puts the channel underneath rather than reimplementing it.
215
- */
98
+ /** Hand a fact that came from OUTSIDE to the listeners in this process — and stop there. */
216
99
  deliver(fact: string, payload: unknown): Promise<void>;
217
100
  /**
218
- * The storage an entity is backed by, resolved through its owning frond's scope —
219
- * the dual of {@link facadeFor}. `undefined` when no loaded frond hosts the entity,
220
- * or when the app booted with no storage at all.
221
- *
222
- * `unknown` because the port belongs to whoever wired it: narrowing it to `EntityOrm`
223
- * is the caller saying which implementation they are standing on.
224
- */
225
- ormFor(entity: string): unknown | undefined;
226
- /**
227
- * The presenter of an entity, resolved through its owning frond's scope.
228
- *
229
- * Same shape as {@link ormFor}, and it exists so an adapter never spells the container
230
- * key itself: `schema-graphql` wrote out `${Name}Presenter` by hand, and a key respelled
231
- * in a second place finds nothing and reports nothing the day the convention moves.
101
+ * The storage an entity is backed by, resolved through its owning frond's scope — the dual of
102
+ * {@link facadeFor}.
232
103
  */
104
+ storageFor(entity: string): unknown | undefined;
105
+ /** The presenter of an entity, resolved through its owning frond's scope. */
233
106
  presenterFor(entity: string): unknown | undefined;
234
107
  /** Dispose the root container. */
235
108
  dispose(): Promise<void>;
236
- /**
237
- * Stop taking calls, and resolve once the running ones are done.
238
- *
239
- * The step before releasing, when there is work on the app: `dispose()` closes a
240
- * storage connection the running calls are standing on. Rejects on `timeoutMs`
241
- * naming how many are left, rather than resolving as if it had succeeded.
242
- */
109
+ /** Stop taking calls, and resolve once the running ones are done. */
243
110
  drain(timeoutMs?: number): Promise<void>;
244
111
  /** How many calls are running right now — one count for all three doors and the wire. */
245
112
  inFlight(): number;
246
- /**
247
- * The same disposal, spelled so the language does it: `await using app = await
248
- * createApp(…)`. Twelve of the twenty-six mounts in this repo's own tests never
249
- * called `dispose()` — a scope that closes itself is the only version of that
250
- * rule nobody forgets.
251
- */
113
+ /** The same disposal, spelled so the language does it: `await using app = await createApp(…)`. */
252
114
  [Symbol.asyncDispose](): Promise<void>;
253
115
  /**
254
116
  * What this app took on, in the order it will release them. The reading of
255
117
  * `CreateAppOptions.extensions` after the boot resolved it.
256
118
  */
257
119
  extensions(): string[];
258
- /**
259
- * Declare one `rpc` op — what the app says about ITSELF, beside the card.
260
- *
261
- * The gesture a package uses to add a reading core does not hold: an app that never
262
- * installed it never registers it, so the runner's refusal is the whole degradation.
263
- * A name already declared is refused rather than replaced — `discover` included.
264
- */
265
- serveRpc(op: string, answer: RpcAnswer): void;
120
+ /** Declare one `rpc` op — what the app says about ITSELF, beside the card. */
121
+ serveRpc(operationName: string, answer: RpcAnswer): void;
266
122
  /** Register a global app middleware (runs on every operation). */
267
123
  /** Watch every dispatch transition; the returned function unsubscribes. */
268
124
  observe(observer: DispatchObserver): () => void;
@@ -1,10 +1,4 @@
1
- /**
2
- * The process environment, as a service — so a handler asks for it rather than reading it.
3
- *
4
- * `process` is absent on a Worker, where the environment arrives as a binding. Read through
5
- * `globalThis` and treated as empty when there is none: a missing variable and a missing
6
- * `process` are the same answer to a caller, and the fallback already says what to do.
7
- */
1
+ /** The process environment, as a service — so a handler asks for it rather than reading it. */
8
2
  export class Config {
9
3
  constructor(private readonly env: Record<string, string | undefined> = envOfProcess()) {}
10
4
 
@@ -1,18 +1,8 @@
1
- /**
2
- * Fougere Logger — structured, colored, multi-runtime.
3
- *
4
- * Works on Node, Bun, Deno, Cloudflare Workers (console-based, no native bindings).
5
- */
1
+ /** Fougere Logger — structured, colored, multi-runtime. */
6
2
 
7
3
  export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
8
4
 
9
- /**
10
- * One line, before it was formatted for a terminal.
11
- *
12
- * The console form is already cooked — ANSI codes, a badge, a timestamp — so anything
13
- * that wants to FORWARD a log needs it before that. What travels is the structure, and
14
- * nothing here knows where it goes.
15
- */
5
+ /** One line, before it was formatted for a terminal. */
16
6
  export interface LogRecord {
17
7
  level: Exclude<LogLevel, 'silent'>;
18
8
  /** The logger's own name — 'boot:app', 'boot:app:catalog'. */
@@ -25,12 +15,7 @@ export interface LogRecord {
25
15
 
26
16
  export type LogSink = (record: LogRecord) => void;
27
17
 
28
- /**
29
- * Who else takes this process's log lines, beside the console. A list, like the span
30
- * sinks: a line is one fact, and forwarding it twice is the caller's business.
31
- *
32
- * Nothing is built when nobody listens — the record is only shaped if a sink exists.
33
- */
18
+ /** Who else takes this process's log lines, beside the console. */
34
19
  const sinks: LogSink[] = [];
35
20
 
36
21
  /** Take every line this process logs. Returns the way to withdraw. */
@@ -44,34 +29,16 @@ export function onLog(next: LogSink): () => void {
44
29
 
45
30
  const LEVELS: Record<LogLevel, number> = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
46
31
 
47
- /**
48
- * The level, held ONCE for the process and CONSULTED at every emission.
49
- *
50
- * It used to be copied into each Logger by the constructor, and copied again by
51
- * `child()` — so there was no place where "the level" was, and changing it meant
52
- * rebuilding every logger AND everything that had been handed one. A value read at
53
- * the moment it is used costs the same and can move.
54
- */
32
+ /** The level, held ONCE for the process and CONSULTED at every emission. */
55
33
  let threshold: number = LEVELS[envLevel() ?? 'info'];
56
34
 
57
- /**
58
- * The level the PROCESS was started with. Read here rather than only at `applyConfig`,
59
- * which runs after the boot has already said where its root is — an operator asking for
60
- * `warn` got that line anyway. Guarded: this module runs on Workers, where there is no
61
- * `process`.
62
- */
35
+ /** The level the PROCESS was started with. */
63
36
  export function envLevel(): LogLevel | undefined {
64
37
  const raw = typeof process === 'undefined' ? undefined : process.env.FOUGERE_LOG_LEVEL;
65
38
  return raw !== undefined && raw in LEVELS ? (raw as LogLevel) : undefined;
66
39
  }
67
40
 
68
- /**
69
- * Set the level for every logger in this process, at once.
70
- *
71
- * Refuses a level it does not know rather than storing `undefined` as the threshold:
72
- * every comparison against it is then `NaN`, so nothing is filtered and `logLevel()`
73
- * reports its own fallback instead of what is in force.
74
- */
41
+ /** Set the level for every logger in this process, at once. */
75
42
  export function setLogLevel(level: LogLevel): void {
76
43
  if (!(level in LEVELS)) {
77
44
  throw new Error(`Unknown log level: '${level}'. One of ${Object.keys(LEVELS).join(', ')}.`);