@fougere/core 0.6.0-alpha.0 → 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 (493) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/Emissions.d.ts +13 -90
  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 +2 -12
  19. package/dist/boot/auth.d.ts.map +1 -1
  20. package/dist/boot/boot.d.ts +3 -16
  21. package/dist/boot/boot.d.ts.map +1 -1
  22. package/dist/boot/boot.js +3 -10
  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 +61 -127
  26. package/dist/boot/bootstrap.js.map +1 -1
  27. package/dist/boot/card.d.ts +1 -17
  28. package/dist/boot/card.d.ts.map +1 -1
  29. package/dist/boot/card.js +3 -32
  30. package/dist/boot/card.js.map +1 -1
  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 +20 -54
  34. package/dist/boot/frame.js.map +1 -1
  35. package/dist/boot/hosted.d.ts +2 -24
  36. package/dist/boot/hosted.d.ts.map +1 -1
  37. package/dist/boot/hosted.js +10 -15
  38. package/dist/boot/hosted.js.map +1 -1
  39. package/dist/boot/ownership.d.ts +3 -36
  40. package/dist/boot/ownership.d.ts.map +1 -1
  41. package/dist/boot/ownership.js +5 -40
  42. package/dist/boot/ownership.js.map +1 -1
  43. package/dist/boot/ports.d.ts +1 -14
  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 +4 -21
  52. package/dist/boot/runner.d.ts.map +1 -1
  53. package/dist/boot/runner.js +4 -17
  54. package/dist/boot/runner.js.map +1 -1
  55. package/dist/boot/seed.d.ts +4 -31
  56. package/dist/boot/seed.d.ts.map +1 -1
  57. package/dist/boot/seed.js +6 -37
  58. package/dist/boot/seed.js.map +1 -1
  59. package/dist/boot/statement-drift.d.ts +2 -21
  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 +4 -8
  64. package/dist/boot/together.d.ts.map +1 -1
  65. package/dist/boot/together.js +15 -50
  66. package/dist/boot/together.js.map +1 -1
  67. package/dist/boot/types.d.ts +28 -173
  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 +6 -36
  100. package/dist/declare.d.ts.map +1 -1
  101. package/dist/declare.js +4 -29
  102. package/dist/declare.js.map +1 -1
  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 +3 -28
  108. package/dist/descriptor/Fronds.d.ts.map +1 -1
  109. package/dist/descriptor/Fronds.js +6 -31
  110. package/dist/descriptor/Fronds.js.map +1 -1
  111. package/dist/descriptor/frond.d.ts +14 -63
  112. package/dist/descriptor/frond.d.ts.map +1 -1
  113. package/dist/dispatch/ArgumentResolver.d.ts +1 -1
  114. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
  115. package/dist/dispatch/ArgumentResolver.js +5 -5
  116. package/dist/dispatch/ArgumentResolver.js.map +1 -1
  117. package/dist/dispatch/DispatchEvent.d.ts +2 -2
  118. package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
  119. package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
  120. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
  121. package/dist/dispatch/DispatchLifecycle.js +1 -7
  122. package/dist/dispatch/DispatchLifecycle.js.map +1 -1
  123. package/dist/dispatch/DispatchPort.d.ts +1 -1
  124. package/dist/dispatch/DispatchPort.d.ts.map +1 -1
  125. package/dist/dispatch/Dispatcher.d.ts +1 -1
  126. package/dist/dispatch/Dispatcher.d.ts.map +1 -1
  127. package/dist/dispatch/Dispatcher.js +2 -2
  128. package/dist/dispatch/Dispatcher.js.map +1 -1
  129. package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
  130. package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
  131. package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
  132. package/dist/dispatch/HandlerFacade.js.map +1 -0
  133. package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
  134. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
  135. package/dist/dispatch/LocalRoutePolicy.js +4 -4
  136. package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
  137. package/dist/dispatch/OperationRoute.d.ts +2 -2
  138. package/dist/dispatch/OperationRoute.d.ts.map +1 -1
  139. package/dist/dispatch/OutputView.d.ts +3 -2
  140. package/dist/dispatch/OutputView.d.ts.map +1 -1
  141. package/dist/dispatch/OutputView.js +19 -1
  142. package/dist/dispatch/OutputView.js.map +1 -1
  143. package/dist/dispatch/Route.d.ts +2 -2
  144. package/dist/dispatch/Route.d.ts.map +1 -1
  145. package/dist/dispatch/RoutePolicy.d.ts +1 -1
  146. package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
  147. package/dist/dispatch/RouteRegistry.d.ts +1 -1
  148. package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
  149. package/dist/dispatch/RouteRegistry.js +2 -2
  150. package/dist/dispatch/RouteRegistry.js.map +1 -1
  151. package/dist/dispatch/RouteResolver.d.ts +2 -4
  152. package/dist/dispatch/RouteResolver.d.ts.map +1 -1
  153. package/dist/dispatch/StorageGuard.d.ts +8 -7
  154. package/dist/dispatch/StorageGuard.d.ts.map +1 -1
  155. package/dist/dispatch/StorageGuard.js +61 -18
  156. package/dist/dispatch/StorageGuard.js.map +1 -1
  157. package/dist/dispatch/presenterArguments.d.ts +7 -0
  158. package/dist/dispatch/presenterArguments.d.ts.map +1 -0
  159. package/dist/dispatch/presenterArguments.js +12 -0
  160. package/dist/dispatch/presenterArguments.js.map +1 -0
  161. package/dist/dispatch/remoteRoutes.d.ts +7 -0
  162. package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
  163. package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
  164. package/dist/dispatch/remoteRoutes.js.map +1 -0
  165. package/dist/dispatch/routeNotFound.d.ts +9 -0
  166. package/dist/dispatch/routeNotFound.d.ts.map +1 -0
  167. package/dist/dispatch/routeNotFound.js +21 -0
  168. package/dist/dispatch/routeNotFound.js.map +1 -0
  169. package/dist/dispatch/validateInput.d.ts +5 -0
  170. package/dist/dispatch/validateInput.d.ts.map +1 -0
  171. package/dist/dispatch/validateInput.js +20 -0
  172. package/dist/dispatch/validateInput.js.map +1 -0
  173. package/dist/effective-operation.d.ts +1 -24
  174. package/dist/effective-operation.d.ts.map +1 -1
  175. package/dist/effective-operation.js +21 -50
  176. package/dist/effective-operation.js.map +1 -1
  177. package/dist/emit.d.ts +4 -42
  178. package/dist/emit.d.ts.map +1 -1
  179. package/dist/emit.js +3 -39
  180. package/dist/emit.js.map +1 -1
  181. package/dist/entry/facade.d.ts +8 -0
  182. package/dist/entry/facade.d.ts.map +1 -0
  183. package/dist/entry/facade.js +28 -0
  184. package/dist/entry/facade.js.map +1 -0
  185. package/dist/entry/transport.d.ts +5 -0
  186. package/dist/entry/transport.d.ts.map +1 -0
  187. package/dist/entry/transport.js +11 -0
  188. package/dist/entry/transport.js.map +1 -0
  189. package/dist/frond-config.d.ts +7 -70
  190. package/dist/frond-config.d.ts.map +1 -1
  191. package/dist/frond-config.js +1 -9
  192. package/dist/frond-config.js.map +1 -1
  193. package/dist/identity-keys.d.ts +2 -5
  194. package/dist/identity-keys.d.ts.map +1 -1
  195. package/dist/identity-keys.js +3 -16
  196. package/dist/identity-keys.js.map +1 -1
  197. package/dist/identity.d.ts +4 -30
  198. package/dist/identity.d.ts.map +1 -1
  199. package/dist/identity.js +11 -73
  200. package/dist/identity.js.map +1 -1
  201. package/dist/imports.d.ts +1 -7
  202. package/dist/imports.d.ts.map +1 -1
  203. package/dist/imports.js +1 -7
  204. package/dist/imports.js.map +1 -1
  205. package/dist/index.d.ts +17 -24
  206. package/dist/index.d.ts.map +1 -1
  207. package/dist/index.js +10 -18
  208. package/dist/index.js.map +1 -1
  209. package/dist/loader.d.ts +1 -8
  210. package/dist/loader.d.ts.map +1 -1
  211. package/dist/loader.js +1 -8
  212. package/dist/loader.js.map +1 -1
  213. package/dist/node.d.ts +2 -11
  214. package/dist/node.d.ts.map +1 -1
  215. package/dist/node.js +2 -11
  216. package/dist/node.js.map +1 -1
  217. package/dist/prefab/collector.d.ts +1 -22
  218. package/dist/prefab/collector.d.ts.map +1 -1
  219. package/dist/prefab/collector.js +1 -22
  220. package/dist/prefab/collector.js.map +1 -1
  221. package/dist/prefab/crud.d.ts +16 -32
  222. package/dist/prefab/crud.d.ts.map +1 -1
  223. package/dist/prefab/crud.js +31 -58
  224. package/dist/prefab/crud.js.map +1 -1
  225. package/dist/prefab/mirror.d.ts +2 -24
  226. package/dist/prefab/mirror.d.ts.map +1 -1
  227. package/dist/prefab/mirror.js +2 -20
  228. package/dist/prefab/mirror.js.map +1 -1
  229. package/dist/prefab/prefab.d.ts +1 -7
  230. package/dist/prefab/prefab.d.ts.map +1 -1
  231. package/dist/prefab/prefab.js +1 -7
  232. package/dist/prefab/prefab.js.map +1 -1
  233. package/dist/prefab/presenter.d.ts +2 -36
  234. package/dist/prefab/presenter.d.ts.map +1 -1
  235. package/dist/prefab/presenter.js +2 -36
  236. package/dist/prefab/presenter.js.map +1 -1
  237. package/dist/prefab/repository.d.ts +5 -73
  238. package/dist/prefab/repository.d.ts.map +1 -1
  239. package/dist/prefab/repository.js +3 -16
  240. package/dist/prefab/repository.js.map +1 -1
  241. package/dist/scan/adapters.d.ts +3 -0
  242. package/dist/scan/adapters.d.ts.map +1 -0
  243. package/dist/scan/adapters.js +25 -0
  244. package/dist/scan/adapters.js.map +1 -0
  245. package/dist/scan/bundling.d.ts +1 -12
  246. package/dist/scan/bundling.d.ts.map +1 -1
  247. package/dist/scan/bundling.js +1 -12
  248. package/dist/scan/bundling.js.map +1 -1
  249. package/dist/scan/conventions.d.ts +6 -40
  250. package/dist/scan/conventions.d.ts.map +1 -1
  251. package/dist/scan/conventions.js +5 -34
  252. package/dist/scan/conventions.js.map +1 -1
  253. package/dist/scan/emit.d.ts +1 -5
  254. package/dist/scan/emit.d.ts.map +1 -1
  255. package/dist/scan/emit.js +4 -38
  256. package/dist/scan/emit.js.map +1 -1
  257. package/dist/scan/handler-parser.d.ts +4 -26
  258. package/dist/scan/handler-parser.d.ts.map +1 -1
  259. package/dist/scan/handler-parser.js +26 -83
  260. package/dist/scan/handler-parser.js.map +1 -1
  261. package/dist/scan/result.d.ts +3 -16
  262. package/dist/scan/result.d.ts.map +1 -1
  263. package/dist/scan/scanner.d.ts +2 -27
  264. package/dist/scan/scanner.d.ts.map +1 -1
  265. package/dist/scan/scanner.js +28 -127
  266. package/dist/scan/scanner.js.map +1 -1
  267. package/dist/scan/statement.d.ts.map +1 -1
  268. package/dist/scan/statement.js +4 -30
  269. package/dist/scan/statement.js.map +1 -1
  270. package/dist/source.d.ts +41 -0
  271. package/dist/source.d.ts.map +1 -0
  272. package/dist/source.js +10 -0
  273. package/dist/source.js.map +1 -0
  274. package/dist/storage.d.ts +13 -210
  275. package/dist/storage.d.ts.map +1 -1
  276. package/dist/storage.js +4 -68
  277. package/dist/storage.js.map +1 -1
  278. package/dist/store.d.ts +18 -0
  279. package/dist/store.d.ts.map +1 -0
  280. package/dist/store.js +146 -0
  281. package/dist/store.js.map +1 -0
  282. package/dist/verify.d.ts +5 -38
  283. package/dist/verify.d.ts.map +1 -1
  284. package/dist/verify.js +17 -37
  285. package/dist/verify.js.map +1 -1
  286. package/dist/wire/CallLog.d.ts +32 -0
  287. package/dist/wire/CallLog.d.ts.map +1 -0
  288. package/dist/{contract → wire}/CallLog.js.map +1 -1
  289. package/dist/wire/Invocation.d.ts +32 -0
  290. package/dist/wire/Invocation.d.ts.map +1 -0
  291. package/dist/wire/Invocation.js +66 -0
  292. package/dist/wire/Invocation.js.map +1 -0
  293. package/dist/{contract → wire}/RouteAddress.d.ts +5 -0
  294. package/dist/wire/RouteAddress.d.ts.map +1 -0
  295. package/dist/{contract → wire}/RouteAddress.js +7 -0
  296. package/dist/wire/RouteAddress.js.map +1 -0
  297. package/dist/wire/binding.d.ts +5 -21
  298. package/dist/wire/binding.d.ts.map +1 -1
  299. package/dist/wire/binding.js +5 -10
  300. package/dist/wire/binding.js.map +1 -1
  301. package/dist/wire/call.d.ts +24 -133
  302. package/dist/wire/call.d.ts.map +1 -1
  303. package/dist/wire/call.js +15 -41
  304. package/dist/wire/call.js.map +1 -1
  305. package/dist/wire/drift.d.ts +3 -28
  306. package/dist/wire/drift.d.ts.map +1 -1
  307. package/dist/wire/drift.js +4 -23
  308. package/dist/wire/drift.js.map +1 -1
  309. package/dist/wire/errors.d.ts +4 -24
  310. package/dist/wire/errors.d.ts.map +1 -1
  311. package/dist/wire/errors.js +4 -24
  312. package/dist/wire/errors.js.map +1 -1
  313. package/dist/wire/http-error.d.ts +2 -13
  314. package/dist/wire/http-error.d.ts.map +1 -1
  315. package/dist/wire/http-error.js +5 -19
  316. package/dist/wire/http-error.js.map +1 -1
  317. package/dist/wire/loggerMiddleware.d.ts +2 -8
  318. package/dist/wire/loggerMiddleware.d.ts.map +1 -1
  319. package/dist/wire/loggerMiddleware.js +1 -7
  320. package/dist/wire/loggerMiddleware.js.map +1 -1
  321. package/dist/wire/middleware.d.ts +3 -7
  322. package/dist/wire/middleware.d.ts.map +1 -1
  323. package/dist/wire/middleware.js +1 -5
  324. package/dist/wire/middleware.js.map +1 -1
  325. package/dist/wire/operation.d.ts +7 -43
  326. package/dist/wire/operation.d.ts.map +1 -1
  327. package/dist/wire/operation.js +4 -15
  328. package/dist/wire/operation.js.map +1 -1
  329. package/dist/wire/signature.d.ts +4 -25
  330. package/dist/wire/signature.d.ts.map +1 -1
  331. package/package.json +3 -3
  332. package/src/boot/Emissions.ts +21 -118
  333. package/src/boot/ambient-port.ts +3 -24
  334. package/src/boot/ambient.als.ts +7 -12
  335. package/src/boot/ambient.queue.ts +2 -5
  336. package/src/boot/apply.ts +3 -15
  337. package/src/boot/auth.ts +2 -12
  338. package/src/boot/boot.ts +5 -20
  339. package/src/boot/bootstrap.ts +69 -136
  340. package/src/boot/card.ts +4 -33
  341. package/src/boot/frame.ts +28 -62
  342. package/src/boot/hosted.ts +12 -34
  343. package/src/boot/ownership.ts +5 -39
  344. package/src/boot/ports.ts +1 -14
  345. package/src/boot/remote.ts +11 -58
  346. package/src/boot/runner.ts +5 -22
  347. package/src/boot/seed.ts +6 -37
  348. package/src/boot/statement-drift.ts +5 -24
  349. package/src/boot/together.ts +18 -51
  350. package/src/boot/types.ts +28 -173
  351. package/src/{builtins → builtin}/config.ts +1 -7
  352. package/src/{builtins → builtin}/logger.ts +6 -39
  353. package/src/config-loader.ts +12 -71
  354. package/src/contract.ts +15 -39
  355. package/src/crypto/encoding.ts +2 -15
  356. package/src/crypto/node.ts +1 -7
  357. package/src/crypto/port.ts +2 -18
  358. package/src/crypto/webcrypto.ts +1 -12
  359. package/src/declare.ts +8 -39
  360. package/src/define.ts +2 -3
  361. package/src/descriptor/Fronds.ts +6 -31
  362. package/src/descriptor/frond.ts +14 -63
  363. package/src/dispatch/ArgumentResolver.ts +6 -6
  364. package/src/dispatch/DispatchEvent.ts +2 -2
  365. package/src/dispatch/DispatchLifecycle.ts +1 -7
  366. package/src/dispatch/DispatchPort.ts +1 -1
  367. package/src/dispatch/Dispatcher.ts +3 -3
  368. package/src/dispatch/HandlerFacade.ts +231 -0
  369. package/src/dispatch/LocalRoutePolicy.ts +4 -4
  370. package/src/dispatch/OperationRoute.ts +2 -2
  371. package/src/dispatch/OutputView.ts +24 -2
  372. package/src/dispatch/Route.ts +2 -2
  373. package/src/dispatch/RoutePolicy.ts +1 -1
  374. package/src/dispatch/RouteRegistry.ts +2 -2
  375. package/src/dispatch/RouteResolver.ts +2 -4
  376. package/src/dispatch/StorageGuard.ts +70 -18
  377. package/src/dispatch/presenterArguments.ts +25 -0
  378. package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
  379. package/src/dispatch/routeNotFound.ts +33 -0
  380. package/src/dispatch/validateInput.ts +28 -0
  381. package/src/effective-operation.ts +21 -50
  382. package/src/emit.ts +5 -63
  383. package/src/entry/facade.ts +44 -0
  384. package/src/entry/transport.ts +16 -0
  385. package/src/frond-config.ts +7 -70
  386. package/src/identity-keys.ts +3 -16
  387. package/src/identity.ts +12 -80
  388. package/src/imports.ts +2 -31
  389. package/src/index.ts +17 -24
  390. package/src/loader.ts +2 -16
  391. package/src/node.ts +2 -11
  392. package/src/prefab/collector.ts +1 -22
  393. package/src/prefab/crud.ts +37 -76
  394. package/src/prefab/mirror.ts +4 -44
  395. package/src/prefab/prefab.ts +2 -21
  396. package/src/prefab/presenter.ts +2 -36
  397. package/src/prefab/repository.ts +7 -83
  398. package/src/scan/adapters.ts +32 -0
  399. package/src/scan/bundling.ts +1 -12
  400. package/src/scan/conventions.ts +6 -40
  401. package/src/scan/emit.ts +4 -38
  402. package/src/scan/handler-parser.ts +27 -96
  403. package/src/scan/result.ts +3 -16
  404. package/src/scan/scanner.ts +27 -126
  405. package/src/scan/statement.ts +4 -30
  406. package/src/source.ts +44 -0
  407. package/src/storage.ts +14 -234
  408. package/src/store.ts +152 -0
  409. package/src/verify.ts +16 -57
  410. package/src/wire/CallLog.ts +30 -0
  411. package/src/{contract → wire}/Invocation.ts +24 -17
  412. package/src/{contract → wire}/RouteAddress.ts +7 -0
  413. package/src/wire/binding.ts +9 -25
  414. package/src/wire/call.ts +30 -133
  415. package/src/wire/drift.ts +5 -30
  416. package/src/wire/errors.ts +4 -24
  417. package/src/wire/http-error.ts +5 -19
  418. package/src/wire/loggerMiddleware.ts +2 -8
  419. package/src/wire/middleware.ts +3 -7
  420. package/src/wire/operation.ts +8 -48
  421. package/src/wire/signature.ts +4 -25
  422. package/dist/boot/HandlerFacade.d.ts.map +0 -1
  423. package/dist/boot/HandlerFacade.js.map +0 -1
  424. package/dist/builtins/config.d.ts +0 -13
  425. package/dist/builtins/config.d.ts.map +0 -1
  426. package/dist/builtins/config.js +0 -21
  427. package/dist/builtins/config.js.map +0 -1
  428. package/dist/builtins/logger.d.ts.map +0 -1
  429. package/dist/builtins/logger.js.map +0 -1
  430. package/dist/contract/Call.d.ts +0 -10
  431. package/dist/contract/Call.d.ts.map +0 -1
  432. package/dist/contract/Call.js +0 -15
  433. package/dist/contract/Call.js.map +0 -1
  434. package/dist/contract/CallLog.d.ts +0 -57
  435. package/dist/contract/CallLog.d.ts.map +0 -1
  436. package/dist/contract/Invocation.d.ts +0 -27
  437. package/dist/contract/Invocation.d.ts.map +0 -1
  438. package/dist/contract/Invocation.js +0 -59
  439. package/dist/contract/Invocation.js.map +0 -1
  440. package/dist/contract/RouteAddress.d.ts.map +0 -1
  441. package/dist/contract/RouteAddress.js.map +0 -1
  442. package/dist/dispatch/InputValidator.d.ts +0 -7
  443. package/dist/dispatch/InputValidator.d.ts.map +0 -1
  444. package/dist/dispatch/InputValidator.js +0 -22
  445. package/dist/dispatch/InputValidator.js.map +0 -1
  446. package/dist/dispatch/OperationExecutor.d.ts +0 -25
  447. package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
  448. package/dist/dispatch/OperationExecutor.js +0 -32
  449. package/dist/dispatch/OperationExecutor.js.map +0 -1
  450. package/dist/dispatch/OutputProjector.d.ts +0 -12
  451. package/dist/dispatch/OutputProjector.d.ts.map +0 -1
  452. package/dist/dispatch/OutputProjector.js +0 -30
  453. package/dist/dispatch/OutputProjector.js.map +0 -1
  454. package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
  455. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
  456. package/dist/dispatch/PresenterArgumentResolver.js +0 -20
  457. package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
  458. package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
  459. package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
  460. package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
  461. package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
  462. package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
  463. package/dist/dispatch/RouteNotFoundError.js +0 -24
  464. package/dist/dispatch/RouteNotFoundError.js.map +0 -1
  465. package/dist/entry/DynamicFacade.d.ts +0 -10
  466. package/dist/entry/DynamicFacade.d.ts.map +0 -1
  467. package/dist/entry/DynamicFacade.js +0 -27
  468. package/dist/entry/DynamicFacade.js.map +0 -1
  469. package/dist/entry/FacadeEntry.d.ts +0 -11
  470. package/dist/entry/FacadeEntry.d.ts.map +0 -1
  471. package/dist/entry/FacadeEntry.js +0 -26
  472. package/dist/entry/FacadeEntry.js.map +0 -1
  473. package/dist/entry/TransportEntry.d.ts +0 -13
  474. package/dist/entry/TransportEntry.d.ts.map +0 -1
  475. package/dist/entry/TransportEntry.js +0 -24
  476. package/dist/entry/TransportEntry.js.map +0 -1
  477. package/dist/rows.d.ts +0 -40
  478. package/dist/rows.d.ts.map +0 -1
  479. package/dist/rows.js +0 -146
  480. package/dist/rows.js.map +0 -1
  481. package/src/boot/HandlerFacade.ts +0 -242
  482. package/src/contract/Call.ts +0 -18
  483. package/src/contract/CallLog.ts +0 -55
  484. package/src/dispatch/InputValidator.ts +0 -28
  485. package/src/dispatch/OperationExecutor.ts +0 -60
  486. package/src/dispatch/OutputProjector.ts +0 -32
  487. package/src/dispatch/PresenterArgumentResolver.ts +0 -25
  488. package/src/dispatch/RouteNotFoundError.ts +0 -29
  489. package/src/entry/DynamicFacade.ts +0 -28
  490. package/src/entry/FacadeEntry.ts +0 -32
  491. package/src/entry/TransportEntry.ts +0 -30
  492. package/src/rows.ts +0 -155
  493. /package/dist/{contract → wire}/CallLog.js +0 -0
@@ -1,17 +1,9 @@
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
5
  import { membersOfTogetherKey, storageKeyOf, entityOfStorageKey, type Storage, type StorageFactory } from '../storage.js';
14
- import type { Logger } from '../builtins/logger.js';
6
+ import type { Logger } from '../builtin/logger.js';
15
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';
@@ -25,6 +17,8 @@ export interface FrameWorld {
25
17
  hostedHere: (frond: string) => boolean;
26
18
  storageFactory?: StorageFactory;
27
19
  sourceOf?: (entityName: string) => string;
20
+ /** Whether that source hands one out — asked before the frame is built, not at the call. */
21
+ transacts?: (source: string) => boolean;
28
22
  transacted?: <R>(source: string, fn: (storageFactory: StorageFactory) => Promise<R>) => Promise<R>;
29
23
  log: Logger;
30
24
  }
@@ -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 storage,
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,12 +72,7 @@ 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
- */
75
+ /** A provider member writing an entity the frame does not name. */
99
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) {
@@ -111,13 +88,7 @@ function refuseUncoveredWrites(members: Members, key: string, world: FrameWorld)
111
88
  }
112
89
  }
113
90
 
114
- /**
115
- * Open the block: build every member over `factory`, in a scope of their own.
116
- *
117
- * The scope is what makes a provider member work without a locator — its storage keys are
118
- * registered here, so the container hands it the framed ones through the ordinary
119
- * constructor. It is disposed when the block ends, whichever way it ended.
120
- */
91
+ /** Open the block. */
121
92
  async function inScope<R>(
122
93
  parent: Container,
123
94
  members: Members,
@@ -143,13 +114,7 @@ async function inScope<R>(
143
114
  }
144
115
  }
145
116
 
146
- /**
147
- * Register one frame per key a handler or provider of this frond asked for.
148
- *
149
- * Called with the frond's scope, because that is where the asking constructor resolves —
150
- * while the MEMBERS are looked up app-wide, a frame crossing fronds being the ordinary case
151
- * rather than the exception (the frond is not the storage boundary; `sources:` is).
152
- */
117
+ /** Register one frame per key a handler or provider of this frond asked for. */
153
118
  export function registerFrames(
154
119
  scope: Container,
155
120
  keys: Iterable<string>,
@@ -170,23 +135,25 @@ export function registerFrames(
170
135
  refuseUncoveredWrites(members, key, world);
171
136
 
172
137
  const sources = new Set(members.entities.map((member) => world.sourceOf?.(member.name) ?? 'db'));
173
- const judge = (storage: Storage, name: string, schema: SchemaView) =>
138
+ const validator = (storage: Storage, name: string, schema: SchemaView) =>
174
139
  new StorageGuard(schema.getFields(), name).guard(storage);
175
140
 
176
- // One engine and a way into it: the engine gives the unwind AND the isolation.
177
- if (world.transacted && sources.size === 1) {
178
- 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)) {
179
146
  world.log.info(`${key} — transaction, source '${source}'`);
180
147
  scope.registerValue(key, {
181
148
  run: <R>(fn: (entities: never, providers: never) => Promise<R>) =>
182
149
  ambient.enterFrame(key, () =>
183
- 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))),
184
151
  });
185
152
  continue;
186
153
  }
187
154
 
188
155
  // Split, or an engine that hands out no transaction: the frame keeps the before-image
189
- // 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
190
157
  // a write the entity refuses never enters the journal.
191
158
  const why = sources.size > 1
192
159
  ? members.entities.map((m) => `${m.name} in '${world.sourceOf?.(m.name) ?? 'db'}'`).join(', ')
@@ -196,7 +163,7 @@ export function registerFrames(
196
163
  run: <R>(fn: (entities: never, providers: never) => Promise<R>): Promise<R> => ambient.enterFrame(key, async () => {
197
164
  const journal: Undo[] = [];
198
165
  const record = (storage: Storage, name: string, schema: SchemaView) =>
199
- judge(recording(storage, name, schema.getFields(), journal), name, schema);
166
+ validator(recording(storage, name, schema, journal), name, schema);
200
167
  try {
201
168
  return await inScope(scope, members, world.storageFactory!, record, fn as never);
202
169
  } catch (cause) {
package/src/boot/types.ts CHANGED
@@ -1,10 +1,4 @@
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
3
  import type { Fronds } from '../descriptor/Fronds.js';
10
4
  import type { FrondDescriptor } from '../descriptor/frond.js';
@@ -27,103 +21,40 @@ export interface CreateAppOptions {
27
21
  storageFactory?: StorageFactory;
28
22
  /**
29
23
  * Which source an entity's rows live in, and how to open a transaction on one — the two
30
- * questions that decide whether `Together<[…]>` gets the engine's own unwind or replays
31
- * inverses itself.
32
- *
33
- * Optional together, because a host may hand in a bare `storageFactory` and know neither. A
34
- * frame then compensates: not knowing where the rows are and promising atomicity over
35
- * 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.
36
26
  */
37
27
  sourceOf?: (entityName: string) => string;
28
+ transacts?: (source: string) => boolean;
38
29
  transacted?: <R>(source: string, fn: (storageFactory: StorageFactory) => Promise<R>) => Promise<R>;
39
- /**
40
- * Builds the cross-source reader a frond gets when it declares `reads:`.
41
- *
42
- * A factory rather than a value, for the same reason `storageFactory` is one: core must
43
- * not name a storage package, and this one costs 71 MB of downloaded extensions and a
44
- * native module — nothing a first run that only wanted sqlite should carry. The host
45
- * decides what backs it; `@fougere/adapter-duckdb` is one answer, not the contract.
46
- *
47
- * Called once per frond that asks, with the entity CLASSES its `reads:` named — a
48
- * name would make the reader resolve the schema a second time.
49
- */
30
+ /** Builds the cross-source reader a frond gets when it declares `reads:`. */
50
31
  sourcesFactory?: (reads: unknown[], frond: string) => Promise<unknown> | unknown;
51
- /**
52
- * What this app is built from — required, because producing it is what reads a disk.
53
- *
54
- * `scanProject` (`@fougere/core/node`) reads the fronds off the filesystem; a module a
55
- * build wrote holds the same value with no disk at all. `createApp` cannot tell them
56
- * apart, and that is the point: it names no builtin, so a runtime without `node:fs`
57
- * runs it. `root` and `fronds` used to live here — both were arguments to the scan.
58
- */
32
+ /** What this app is built from — required, because producing it is what reads a disk. */
59
33
  scan?: ScanResult | (() => Promise<ScanResult> | ScanResult);
60
- /**
61
- * What this app STATES it hosts — `frond('blog', { entities: [Post] })`.
62
- *
63
- * Passing this and not `scan:` is how an app says "do not scan": nothing reads a disk,
64
- * nothing loads `typescript`, and what was not named does not exist. Passing both fills
65
- * the members left unnamed from what the scan found — the app's word wins, the way
66
- * `frond.config.ts` wins over the scan one level down.
67
- */
34
+ /** What this app STATES it hosts — `frond('blog', { entities: [Post] })`. */
68
35
  fronds?: readonly FrondDescriptor[];
69
36
  /**
70
37
  * Remote fronds — label → address. What each remote hosts is discovered
71
38
  * at the first miss (rpc.discover), never declared here.
72
39
  */
73
40
  remotes?: Record<string, string>;
74
- /**
75
- * Builds the transport used to reach `remotes` addresses. Wired by
76
- * layer-2 packages (e.g. @fougere/transport-http); required when
77
- * `remotes` is non-empty.
78
- */
41
+ /** Builds the transport used to reach `remotes` addresses. */
79
42
  remoteTransport?: (url: string) => Transport;
80
43
  /**
81
44
  * Which realization answers which port — see `FougereConfig.ports`. Needed only
82
45
  * when two classes extend the same port; one is resolved by convention.
83
46
  */
84
47
  ports?: Record<string, string>;
85
- /**
86
- * What this app takes on beyond its fronds, each stating what it does and what it undoes.
87
- *
88
- * `up` runs before `createApp` returns, in this order; `down` runs inside `dispose()`,
89
- * in reverse. Three levels release in reverse of construction, which is the container's
90
- * own rule read one level out: extensions first (built last), then the container, then
91
- * `onDispose` — a resource opened before any of this existed.
92
- *
93
- * A member may be `undefined`, so a host writes a conditional one inline rather than a
94
- * spread over a ternary. The framework's own two are always declared, `migrate` as an
95
- * empty slot when nothing migrates: a host filling it later REPLACES that member in
96
- * place instead of adding one after the seeds.
97
- */
48
+ /** What this app takes on beyond its fronds, each stating what it does and what it undoes. */
98
49
  extensions?: readonly (Extension | undefined)[];
99
50
  /**
100
- * Released by `app.dispose()` AFTER the container, for a resource handed in rather
101
- * than built here — a storage connection is the one case today.
102
- *
103
- * NOT an extension, and the difference is a time: this was opened BEFORE the container,
104
- * so it closes after it, while an extension's `up` runs after the container and its
105
- * `down` therefore runs before. A storage's migration is an extension; its connection
106
- * 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.
107
53
  */
108
54
  onDispose?: () => Promise<void> | void;
109
- /**
110
- * Which protocol adapters this app serves — see `FougereConfig.adapters`.
111
- * Carried onto the App so every door reads one answer instead of each host
112
- * deciding for itself.
113
- */
55
+ /** Which protocol adapters this app serves — see `FougereConfig.adapters`. */
114
56
  adapters?: Record<string, boolean | undefined>;
115
- /**
116
- * Carries an announced fact out of this process — a broker, a queue, a log.
117
- *
118
- * Called for every emission, ALONGSIDE the local dispatch and never instead of it: a
119
- * listener in this process is reached directly, and this is how the others hear.
120
- *
121
- * It exists because the local dispatch finds its listeners by having READ their code,
122
- * which stops at the repository boundary. A carrier hands the fact to a NAME; the far
123
- * side subscribes to that same name from its own code, and neither ever reads the other.
124
- *
125
- * Its failure never reaches the emitter — same rule as a subscriber's.
126
- */
57
+ /** Carries an announced fact out of this process — a broker, a queue, a log. */
127
58
  onEmit?: (fact: string, payload: unknown) => void | Promise<void>;
128
59
  /** Passive observers of every dispatch transition. */
129
60
  dispatchObservers?: readonly DispatchObserver[];
@@ -142,13 +73,7 @@ export interface App extends DispatchPort {
142
73
  local: DispatchPort;
143
74
  /** Root container with builtins + frond scopes. */
144
75
  container: Container;
145
- /**
146
- * Which protocol adapters this app declared, from `fougere.config.ts`.
147
- *
148
- * Read by the doors themselves, so an undeclared adapter serves nothing whatever
149
- * the host mounted — the route file may exist, the middleware may be installed, and
150
- * the answer is still "not here".
151
- */
76
+ /** Which protocol adapters this app declared, from `fougere.config.ts`. */
152
77
  adapters: Record<string, boolean | undefined>;
153
78
  /** Where a call goes, as the config declared it — frond name to address. */
154
79
  remotes: Readonly<Record<string, string>>;
@@ -157,113 +82,43 @@ export interface App extends DispatchPort {
157
82
  /** Resolve from root container (shortcut). */
158
83
  resolve<T>(name: string): T;
159
84
  /**
160
- * Resolve an entity's schema — the local `entityClass` when it's hosted or
161
- * scanned here, else reconstructed from the remote's identity card
162
- * (`rpc.discover` to `Card.toSchema`). The one way to get a live schema for an
163
- * entity whose class may not be importable at all (another repo, another
164
- * 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`).
165
87
  */
166
88
  schemaFor(entity: string): Promise<SchemaView>;
167
- /**
168
- * The door a name exposes to one audience, or `undefined` when it exposes
169
- * none. A named surface is CLOSED: a name with no door of its own under that
170
- * surface is not in it — it never falls back to the full one.
171
- *
172
- * **Not always a façade**, despite the name: when the owning frond is declared
173
- * remote, nothing is registered locally (`bootstrap.ts`, `declaredRemotes`) and
174
- * this resolves to a doublure — a façade-shaped stand-in (`remote.ts`). The
175
- * caller cannot tell, which is the point; the word here was simply wrong.
176
- *
177
- * The one way an adapter reaches that door. It exists so the key format stays
178
- * inside core (see `facadeKeyOf`), which is what lets a projection package
179
- * stay structurally typed and depend on nothing.
180
- */
89
+ /** The door a name exposes to one audience, or `undefined` when it exposes none. */
181
90
  facadeFor(entity: string, surface?: string): Record<string, Function> | undefined;
182
91
  /**
183
- * The canonical contracts served beside a facade, after prefab + scan + config,
184
- * binding, kind, topology and surface resolution. Check, explain and adapters read
185
- * 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.
186
94
  */
187
95
  operationsFor(entity: string, surface?: string): EffectiveOperationsMap | undefined;
188
- /**
189
- * The facts this app has a listener for — what a carrier must subscribe to on its behalf.
190
- *
191
- * Derived from the signatures it scanned (`Fact<T>` in an op's parameters), so a process
192
- * states what it listens to without anyone declaring it twice. The dual of `onEmit`: one
193
- * says what leaves, this says what should be brought in.
194
- */
96
+ /** The facts this app has a listener for — what a carrier must subscribe to on its behalf. */
195
97
  listensTo(): string[];
196
- /**
197
- * Hand a fact that came from OUTSIDE to the listeners in this process — and stop there.
198
- *
199
- * The dual of `onEmit`, and deliberately not the same thing as announcing: resolving the
200
- * emission value to deliver an inbound fact would carry it straight back out through
201
- * `onEmit`, so a hub echoed every reading it received to the whole fleet. Receiving and
202
- * announcing are two operations; only one of them leaves.
203
- *
204
- * The local dispatch is identical either way — same judge, same binding, same
205
- * middlewares — so a fact off a wire is no less checked than one raised next door.
206
- *
207
- * **It waits, and it tells** — the opposite of announcing, on purpose. It resolves once
208
- * every listener here is done, and REJECTS with an `AggregateError` if any refused. A
209
- * carrier's whole job is to know whether the fact landed: at-least-once is retrying what
210
- * failed, so a delivery that cannot report makes durability impossible to build above it.
211
- * "Dispatch is not delivery" protects the EMITTER from a slow subscriber; a carrier is
212
- * not the emitter, it is the party whose business this is.
213
- *
214
- * It still holds nothing. A refused fact is refused, and whether it comes back is the
215
- * carrier's decision — Fougere puts the channel underneath rather than reimplementing it.
216
- */
98
+ /** Hand a fact that came from OUTSIDE to the listeners in this process — and stop there. */
217
99
  deliver(fact: string, payload: unknown): Promise<void>;
218
100
  /**
219
- * The storage an entity is backed by, resolved through its owning frond's scope —
220
- * the dual of {@link facadeFor}. `undefined` when no loaded frond hosts the entity,
221
- * or when the app booted with no storage at all.
222
- *
223
- * `unknown` because the port belongs to whoever wired it: narrowing it to `Storage`
224
- * is the caller saying which implementation they are standing on.
101
+ * The storage an entity is backed by, resolved through its owning frond's scope — the dual of
102
+ * {@link facadeFor}.
225
103
  */
226
104
  storageFor(entity: string): unknown | undefined;
227
- /**
228
- * The presenter of an entity, resolved through its owning frond's scope.
229
- *
230
- * Same shape as {@link storageFor}, and it exists so an adapter never spells the container
231
- * key itself: `schema-graphql` wrote out `${Name}Presenter` by hand, and a key respelled
232
- * in a second place finds nothing and reports nothing the day the convention moves.
233
- */
105
+ /** The presenter of an entity, resolved through its owning frond's scope. */
234
106
  presenterFor(entity: string): unknown | undefined;
235
107
  /** Dispose the root container. */
236
108
  dispose(): Promise<void>;
237
- /**
238
- * Stop taking calls, and resolve once the running ones are done.
239
- *
240
- * The step before releasing, when there is work on the app: `dispose()` closes a
241
- * storage connection the running calls are standing on. Rejects on `timeoutMs`
242
- * naming how many are left, rather than resolving as if it had succeeded.
243
- */
109
+ /** Stop taking calls, and resolve once the running ones are done. */
244
110
  drain(timeoutMs?: number): Promise<void>;
245
111
  /** How many calls are running right now — one count for all three doors and the wire. */
246
112
  inFlight(): number;
247
- /**
248
- * The same disposal, spelled so the language does it: `await using app = await
249
- * createApp(…)`. Twelve of the twenty-six mounts in this repo's own tests never
250
- * called `dispose()` — a scope that closes itself is the only version of that
251
- * rule nobody forgets.
252
- */
113
+ /** The same disposal, spelled so the language does it: `await using app = await createApp(…)`. */
253
114
  [Symbol.asyncDispose](): Promise<void>;
254
115
  /**
255
116
  * What this app took on, in the order it will release them. The reading of
256
117
  * `CreateAppOptions.extensions` after the boot resolved it.
257
118
  */
258
119
  extensions(): string[];
259
- /**
260
- * Declare one `rpc` op — what the app says about ITSELF, beside the card.
261
- *
262
- * The gesture a package uses to add a reading core does not hold: an app that never
263
- * installed it never registers it, so the runner's refusal is the whole degradation.
264
- * A name already declared is refused rather than replaced — `discover` included.
265
- */
266
- 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;
267
122
  /** Register a global app middleware (runs on every operation). */
268
123
  /** Watch every dispatch transition; the returned function unsubscribes. */
269
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(', ')}.`);
@@ -1,7 +1,7 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { existsSync } from 'node:fs';
3
3
  import type { AuthConfig } from './boot/auth.js';
4
- import type { LogLevel } from './builtins/logger.js';
4
+ import type { LogLevel } from './builtin/logger.js';
5
5
  import type { ConventionsInput } from './scan/conventions.js';
6
6
  import { getModuleLoader } from './loader.js';
7
7
 
@@ -10,68 +10,22 @@ import { getModuleLoader } from './loader.js';
10
10
  export interface FougereConfig {
11
11
  /** Database configuration — the DEFAULT source, the one an entity lands in unnamed. */
12
12
  db?: 'sqlite' | { dialect: 'sqlite'; path?: string } | false;
13
- /**
14
- * The other places rows live — a name, an engine, and the entities it holds.
15
- *
16
- * A fact about the APP, stated beside `remotes:` because it is the same kind of
17
- * statement: `remotes:` says where a CALL goes, this says where a ROW is. Neither
18
- * belongs on the entity, which describes itself and not its deployment.
19
- *
20
- * Only the exception is declared: everything unnamed stays in `db`. Membership is
21
- * per ENTITY rather than per frond — two fronds may share a database, and one frond
22
- * may hold entities in two — so the entity is the truth and a frond-wide shorthand
23
- * waits for a case that needs it.
24
- *
25
- * A `ref()` across two sources gets no foreign key: two databases share no
26
- * constraint. The DDL stops pretending rather than the `ref` being refused.
27
- */
13
+ /** The other places rows live — a name, an engine, and the entities it holds. */
28
14
  sources?: Record<string, { dialect?: 'sqlite'; path?: string; entities: string[] }>;
29
15
  /**
30
- * The names the scan reads instead of deriving them — the import scope, the fronds
31
- * directory, the seven convention directories.
32
- *
33
- * Only what differs is stated. Read BEFORE the fronds are discovered, which is what
34
- * lets it name the prefix they are found under: nothing in this file may import
35
- * `@fronds/*`, or the name would be needed to read the file that declares it.
16
+ * The names the scan reads instead of deriving them — the import scope, the fronds directory,
17
+ * the seven convention directories.
36
18
  */
37
19
  conventions?: ConventionsInput;
38
- /**
39
- * How much every logger says. The one key a running app CONSULTS rather than
40
- * consumes, so re-reading this file changes it without rebuilding anything.
41
- *
42
- * `FOUGERE_LOG_LEVEL` still wins — it is how the CLI speaks, and the precedence is
43
- * the usual one (CLI over config file).
44
- */
20
+ /** How much every logger says. */
45
21
  logLevel?: LogLevel;
46
22
  /** Remote fronds — frondName → base URL. */
47
23
  remotes?: Record<string, string>;
48
- /**
49
- * Which realization answers which port — port class name → implementation class name.
50
- *
51
- * A fact about the APP, stated beside `remotes:` for the same reason `sources:` is:
52
- * `remotes:` says where a CALL goes, `sources:` says where a ROW is, this says who
53
- * performs an ACTION. None of the three belongs inside the frond, which describes
54
- * itself and not its deployment — a `billing` frond naming Stripe would be the one
55
- * thing the framework refuses.
56
- *
57
- * Only the exception is declared. One class extending a port answers it by
58
- * convention and this key stays absent; two make the boot refuse until one is named.
59
- */
24
+ /** Which realization answers which port — port class name → implementation class name. */
60
25
  ports?: Record<string, string>;
61
26
  /** Auth declaration — picks a provider package and forwards options to it. */
62
27
  auth?: AuthConfig;
63
- /**
64
- * Which protocol adapters this app serves.
65
- *
66
- * A fact about the APP, declared once beside `db`, `remotes` and `auth` — not a
67
- * property of whichever host runs it. Before this existed the same decision was
68
- * spelled five different ways: Nuxt mounted REST unconditionally, the Web hosts
69
- * served it if you happened to create a route file, and Express if you happened to
70
- * call a middleware. One decision, five dialects, no canonical place.
71
- *
72
- * Absent means not served. The call envelope is not listed here: it is the wire the
73
- * client primitives use, not a projection an app chooses to publish.
74
- */
28
+ /** Which protocol adapters this app serves. */
75
29
  adapters?: AdapterConfig;
76
30
  }
77
31
 
@@ -105,13 +59,7 @@ async function loadConfigFrom(dir: string, fresh?: boolean): Promise<FougereConf
105
59
  return {};
106
60
  }
107
61
 
108
- /**
109
- * Load the root fougere.config.{ts,js,mjs} from the given directory.
110
- *
111
- * `fresh` re-reads a file that may have changed since the last load — what a host
112
- * calls when it decides to reconsider its config, and the only way `applyConfig` has
113
- * anything new to apply.
114
- */
62
+ /** Load the root fougere.config.{ts,js,mjs} from the given directory. */
115
63
  export async function loadConfig(root: string, options?: { fresh?: boolean }): Promise<FougereConfig> {
116
64
  return loadConfigFrom(root, options?.fresh);
117
65
  }
@@ -119,10 +67,9 @@ export async function loadConfig(root: string, options?: { fresh?: boolean }): P
119
67
  // ── Merging ──────────────────────────────────────
120
68
 
121
69
  /**
122
- * Override a config with another, the invariant of every cascade level:
123
- * scalar keys replace, but `remotes` (the topology) MERGES — an override adds
124
- * or redirects a frond without erasing the others. Used for workspace→app and
125
- * for global→CLI alike.
70
+ * Override a config with another, the invariant of every cascade level: scalar keys replace, but
71
+ * `remotes` (the topology) MERGES — an override adds or redirects a frond without erasing the
72
+ * others.
126
73
  */
127
74
  function mergeGlobal(base: FougereConfig, override: Partial<FougereConfig>): FougereConfig {
128
75
  const merged: FougereConfig = { ...base, ...override };
@@ -132,13 +79,7 @@ function mergeGlobal(base: FougereConfig, override: Partial<FougereConfig>): Fou
132
79
  return merged;
133
80
  }
134
81
 
135
- /**
136
- * Load config along the workspace→app frontier. The workspace-root config is
137
- * the base (canonical topology: `remotes`, shared `db`); the app-root config
138
- * overrides. Same `root` boundary the fronds already cascade along. When both
139
- * roots resolve to the same dir (single app, no workspace), this is the plain
140
- * root config — idempotent, no behavior change.
141
- */
82
+ /** Load config along the workspace→app frontier. */
142
83
  export async function loadCascadedConfig(workspaceRoot: string, appRoot: string): Promise<FougereConfig> {
143
84
  const base = await loadConfig(workspaceRoot);
144
85
  if (resolve(workspaceRoot) === resolve(appRoot)) return base;