@fougere/core 0.2.0-alpha.2 → 0.4.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 (500) hide show
  1. package/README.md +3 -2
  2. package/dist/boot/AppLifecycle.d.ts +18 -0
  3. package/dist/boot/AppLifecycle.d.ts.map +1 -0
  4. package/dist/boot/AppLifecycle.js +42 -0
  5. package/dist/boot/AppLifecycle.js.map +1 -0
  6. package/dist/boot/Emissions.d.ts +126 -0
  7. package/dist/boot/Emissions.d.ts.map +1 -0
  8. package/dist/boot/Emissions.js +233 -0
  9. package/dist/boot/Emissions.js.map +1 -0
  10. package/dist/boot/HandlerFacade.d.ts +72 -0
  11. package/dist/boot/HandlerFacade.d.ts.map +1 -0
  12. package/dist/boot/HandlerFacade.js +174 -0
  13. package/dist/boot/HandlerFacade.js.map +1 -0
  14. package/dist/boot/Lifecycle.d.ts +4 -0
  15. package/dist/boot/Lifecycle.d.ts.map +1 -0
  16. package/dist/boot/Lifecycle.js +3 -0
  17. package/dist/boot/Lifecycle.js.map +1 -0
  18. package/dist/boot/ambient-port.d.ts +38 -0
  19. package/dist/boot/ambient-port.d.ts.map +1 -0
  20. package/dist/boot/ambient-port.js +2 -0
  21. package/dist/boot/ambient-port.js.map +1 -0
  22. package/dist/boot/ambient.als.d.ts +3 -0
  23. package/dist/boot/ambient.als.d.ts.map +1 -0
  24. package/dist/boot/ambient.als.js +34 -0
  25. package/dist/boot/ambient.als.js.map +1 -0
  26. package/dist/boot/ambient.queue.d.ts +10 -0
  27. package/dist/boot/ambient.queue.d.ts.map +1 -0
  28. package/dist/boot/ambient.queue.js +60 -0
  29. package/dist/boot/ambient.queue.js.map +1 -0
  30. package/dist/boot/apply.d.ts +22 -0
  31. package/dist/boot/apply.d.ts.map +1 -0
  32. package/dist/boot/apply.js +38 -0
  33. package/dist/boot/apply.js.map +1 -0
  34. package/dist/boot/auth.d.ts +53 -0
  35. package/dist/boot/auth.d.ts.map +1 -0
  36. package/dist/boot/auth.js +2 -0
  37. package/dist/boot/auth.js.map +1 -0
  38. package/dist/{binding.d.ts → boot/binding.d.ts} +14 -17
  39. package/dist/boot/binding.d.ts.map +1 -0
  40. package/dist/{binding.js → boot/binding.js} +19 -10
  41. package/dist/boot/binding.js.map +1 -0
  42. package/dist/{boot.d.ts → boot/boot.d.ts} +25 -5
  43. package/dist/boot/boot.d.ts.map +1 -0
  44. package/dist/boot/boot.js +70 -0
  45. package/dist/boot/boot.js.map +1 -0
  46. package/dist/boot/bootstrap.d.ts.map +1 -0
  47. package/dist/boot/bootstrap.js +722 -0
  48. package/dist/boot/bootstrap.js.map +1 -0
  49. package/dist/boot/frame.d.ts +44 -0
  50. package/dist/boot/frame.d.ts.map +1 -0
  51. package/dist/boot/frame.js +172 -0
  52. package/dist/boot/frame.js.map +1 -0
  53. package/dist/boot/ownership.d.ts +42 -0
  54. package/dist/boot/ownership.d.ts.map +1 -0
  55. package/dist/boot/ownership.js +127 -0
  56. package/dist/boot/ownership.js.map +1 -0
  57. package/dist/boot/ports.d.ts +17 -0
  58. package/dist/boot/ports.d.ts.map +1 -0
  59. package/dist/boot/ports.js +57 -0
  60. package/dist/boot/ports.js.map +1 -0
  61. package/dist/{remote.d.ts → boot/remote.d.ts} +11 -3
  62. package/dist/boot/remote.d.ts.map +1 -0
  63. package/dist/{remote.js → boot/remote.js} +26 -28
  64. package/dist/boot/remote.js.map +1 -0
  65. package/dist/{seed.d.ts → boot/seed.d.ts} +13 -1
  66. package/dist/boot/seed.d.ts.map +1 -0
  67. package/dist/{seed.js → boot/seed.js} +24 -3
  68. package/dist/boot/seed.js.map +1 -0
  69. package/dist/boot/together.d.ts +26 -0
  70. package/dist/boot/together.d.ts.map +1 -0
  71. package/dist/boot/together.js +163 -0
  72. package/dist/boot/together.js.map +1 -0
  73. package/dist/boot/types.d.ts +260 -0
  74. package/dist/boot/types.d.ts.map +1 -0
  75. package/dist/boot/types.js.map +1 -0
  76. package/dist/builtins/config.d.ts +9 -0
  77. package/dist/builtins/config.d.ts.map +1 -1
  78. package/dist/builtins/config.js +16 -1
  79. package/dist/builtins/config.js.map +1 -1
  80. package/dist/builtins/logger.d.ts +37 -4
  81. package/dist/builtins/logger.d.ts.map +1 -1
  82. package/dist/builtins/logger.js +66 -7
  83. package/dist/builtins/logger.js.map +1 -1
  84. package/dist/config-loader.d.ts +39 -35
  85. package/dist/config-loader.d.ts.map +1 -1
  86. package/dist/config-loader.js +15 -54
  87. package/dist/config-loader.js.map +1 -1
  88. package/dist/contract/Call.d.ts +10 -0
  89. package/dist/contract/Call.d.ts.map +1 -0
  90. package/dist/contract/Call.js +15 -0
  91. package/dist/contract/Call.js.map +1 -0
  92. package/dist/contract/Invocation.d.ts +27 -0
  93. package/dist/contract/Invocation.d.ts.map +1 -0
  94. package/dist/contract/Invocation.js +59 -0
  95. package/dist/contract/Invocation.js.map +1 -0
  96. package/dist/contract/RouteAddress.d.ts +17 -0
  97. package/dist/contract/RouteAddress.d.ts.map +1 -0
  98. package/dist/contract/RouteAddress.js +38 -0
  99. package/dist/contract/RouteAddress.js.map +1 -0
  100. package/dist/contract.d.ts +25 -19
  101. package/dist/contract.d.ts.map +1 -1
  102. package/dist/contract.js +25 -10
  103. package/dist/contract.js.map +1 -1
  104. package/dist/crypto/encoding.d.ts +25 -0
  105. package/dist/crypto/encoding.d.ts.map +1 -0
  106. package/dist/crypto/encoding.js +58 -0
  107. package/dist/crypto/encoding.js.map +1 -0
  108. package/dist/crypto/node.d.ts +4 -0
  109. package/dist/crypto/node.d.ts.map +1 -0
  110. package/dist/crypto/node.js +25 -0
  111. package/dist/crypto/node.js.map +1 -0
  112. package/dist/crypto/port.d.ts +42 -0
  113. package/dist/crypto/port.d.ts.map +1 -0
  114. package/dist/crypto/port.js +19 -0
  115. package/dist/crypto/port.js.map +1 -0
  116. package/dist/crypto/webcrypto.d.ts +4 -0
  117. package/dist/crypto/webcrypto.d.ts.map +1 -0
  118. package/dist/crypto/webcrypto.js +34 -0
  119. package/dist/crypto/webcrypto.js.map +1 -0
  120. package/dist/dispatch/ArgumentResolver.d.ts +10 -0
  121. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -0
  122. package/dist/dispatch/ArgumentResolver.js +12 -0
  123. package/dist/dispatch/ArgumentResolver.js.map +1 -0
  124. package/dist/dispatch/ArrayResult.d.ts +3 -0
  125. package/dist/dispatch/ArrayResult.d.ts.map +1 -0
  126. package/dist/dispatch/ArrayResult.js +11 -0
  127. package/dist/dispatch/ArrayResult.js.map +1 -0
  128. package/dist/dispatch/DispatchEvent.d.ts +18 -0
  129. package/dist/dispatch/DispatchEvent.d.ts.map +1 -0
  130. package/dist/dispatch/DispatchEvent.js +30 -0
  131. package/dist/dispatch/DispatchEvent.js.map +1 -0
  132. package/dist/dispatch/DispatchLifecycle.d.ts +9 -0
  133. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -0
  134. package/dist/dispatch/DispatchLifecycle.js +25 -0
  135. package/dist/dispatch/DispatchLifecycle.js.map +1 -0
  136. package/dist/dispatch/DispatchPort.d.ts +6 -0
  137. package/dist/dispatch/DispatchPort.d.ts.map +1 -0
  138. package/dist/dispatch/DispatchPort.js +2 -0
  139. package/dist/dispatch/DispatchPort.js.map +1 -0
  140. package/dist/dispatch/Dispatcher.d.ts +16 -0
  141. package/dist/dispatch/Dispatcher.d.ts.map +1 -0
  142. package/dist/dispatch/Dispatcher.js +44 -0
  143. package/dist/dispatch/Dispatcher.js.map +1 -0
  144. package/dist/dispatch/InFlight.d.ts +12 -0
  145. package/dist/dispatch/InFlight.d.ts.map +1 -0
  146. package/dist/dispatch/InFlight.js +46 -0
  147. package/dist/dispatch/InFlight.js.map +1 -0
  148. package/dist/dispatch/InputValidator.d.ts +7 -0
  149. package/dist/dispatch/InputValidator.d.ts.map +1 -0
  150. package/dist/dispatch/InputValidator.js +22 -0
  151. package/dist/dispatch/InputValidator.js.map +1 -0
  152. package/dist/dispatch/LocalRoutePolicy.d.ts +11 -0
  153. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -0
  154. package/dist/dispatch/LocalRoutePolicy.js +32 -0
  155. package/dist/dispatch/LocalRoutePolicy.js.map +1 -0
  156. package/dist/dispatch/OperationExecutor.d.ts +25 -0
  157. package/dist/dispatch/OperationExecutor.d.ts.map +1 -0
  158. package/dist/dispatch/OperationExecutor.js +32 -0
  159. package/dist/dispatch/OperationExecutor.js.map +1 -0
  160. package/dist/dispatch/OperationRoute.d.ts +13 -0
  161. package/dist/dispatch/OperationRoute.d.ts.map +1 -0
  162. package/dist/dispatch/OperationRoute.js +15 -0
  163. package/dist/dispatch/OperationRoute.js.map +1 -0
  164. package/dist/dispatch/OutputProjector.d.ts +12 -0
  165. package/dist/dispatch/OutputProjector.d.ts.map +1 -0
  166. package/dist/dispatch/OutputProjector.js +30 -0
  167. package/dist/dispatch/OutputProjector.js.map +1 -0
  168. package/dist/dispatch/OutputView.d.ts +8 -0
  169. package/dist/dispatch/OutputView.d.ts.map +1 -0
  170. package/dist/dispatch/OutputView.js +10 -0
  171. package/dist/dispatch/OutputView.js.map +1 -0
  172. package/dist/dispatch/PresenterArgumentResolver.d.ts +12 -0
  173. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +1 -0
  174. package/dist/dispatch/PresenterArgumentResolver.js +20 -0
  175. package/dist/dispatch/PresenterArgumentResolver.js.map +1 -0
  176. package/dist/dispatch/PresenterExecutor.d.ts +11 -0
  177. package/dist/dispatch/PresenterExecutor.d.ts.map +1 -0
  178. package/dist/dispatch/PresenterExecutor.js +56 -0
  179. package/dist/dispatch/PresenterExecutor.js.map +1 -0
  180. package/dist/dispatch/RemoteRouteResolver.d.ts +13 -0
  181. package/dist/dispatch/RemoteRouteResolver.d.ts.map +1 -0
  182. package/dist/dispatch/RemoteRouteResolver.js +18 -0
  183. package/dist/dispatch/RemoteRouteResolver.js.map +1 -0
  184. package/dist/dispatch/Route.d.ts +10 -0
  185. package/dist/dispatch/Route.d.ts.map +1 -0
  186. package/dist/dispatch/Route.js +2 -0
  187. package/dist/dispatch/Route.js.map +1 -0
  188. package/dist/dispatch/RouteNotFoundError.d.ts +10 -0
  189. package/dist/dispatch/RouteNotFoundError.d.ts.map +1 -0
  190. package/dist/dispatch/RouteNotFoundError.js +24 -0
  191. package/dist/dispatch/RouteNotFoundError.js.map +1 -0
  192. package/dist/dispatch/RoutePolicy.d.ts +8 -0
  193. package/dist/dispatch/RoutePolicy.d.ts.map +1 -0
  194. package/dist/dispatch/RoutePolicy.js +2 -0
  195. package/dist/dispatch/RoutePolicy.js.map +1 -0
  196. package/dist/dispatch/RouteRegistry.d.ts +18 -0
  197. package/dist/dispatch/RouteRegistry.d.ts.map +1 -0
  198. package/dist/dispatch/RouteRegistry.js +62 -0
  199. package/dist/dispatch/RouteRegistry.js.map +1 -0
  200. package/dist/dispatch/RouteResolver.d.ts +7 -0
  201. package/dist/dispatch/RouteResolver.d.ts.map +1 -0
  202. package/dist/dispatch/RouteResolver.js +2 -0
  203. package/dist/dispatch/RouteResolver.js.map +1 -0
  204. package/dist/dispatch/StorageGuard.d.ts +15 -0
  205. package/dist/dispatch/StorageGuard.d.ts.map +1 -0
  206. package/dist/dispatch/StorageGuard.js +63 -0
  207. package/dist/dispatch/StorageGuard.js.map +1 -0
  208. package/dist/effective-operation.d.ts +90 -0
  209. package/dist/effective-operation.d.ts.map +1 -0
  210. package/dist/effective-operation.js +449 -0
  211. package/dist/effective-operation.js.map +1 -0
  212. package/dist/emit.d.ts +2 -2
  213. package/dist/emit.d.ts.map +1 -1
  214. package/dist/emit.js +2 -2
  215. package/dist/emit.js.map +1 -1
  216. package/dist/entry/DynamicFacade.d.ts +10 -0
  217. package/dist/entry/DynamicFacade.d.ts.map +1 -0
  218. package/dist/entry/DynamicFacade.js +27 -0
  219. package/dist/entry/DynamicFacade.js.map +1 -0
  220. package/dist/entry/FacadeEntry.d.ts +11 -0
  221. package/dist/entry/FacadeEntry.d.ts.map +1 -0
  222. package/dist/entry/FacadeEntry.js +26 -0
  223. package/dist/entry/FacadeEntry.js.map +1 -0
  224. package/dist/entry/TransportEntry.d.ts +13 -0
  225. package/dist/entry/TransportEntry.d.ts.map +1 -0
  226. package/dist/entry/TransportEntry.js +24 -0
  227. package/dist/entry/TransportEntry.js.map +1 -0
  228. package/dist/frond-config.d.ts +24 -7
  229. package/dist/frond-config.d.ts.map +1 -1
  230. package/dist/frond-config.js.map +1 -1
  231. package/dist/graph.d.ts +1 -1
  232. package/dist/graph.d.ts.map +1 -1
  233. package/dist/graph.js +3 -2
  234. package/dist/graph.js.map +1 -1
  235. package/dist/identity-keys.d.ts +14 -0
  236. package/dist/identity-keys.d.ts.map +1 -0
  237. package/dist/identity-keys.js +37 -0
  238. package/dist/identity-keys.js.map +1 -0
  239. package/dist/identity.d.ts +58 -0
  240. package/dist/identity.d.ts.map +1 -0
  241. package/dist/identity.js +182 -0
  242. package/dist/identity.js.map +1 -0
  243. package/dist/imports.d.ts +2 -2
  244. package/dist/imports.d.ts.map +1 -1
  245. package/dist/imports.js +7 -3
  246. package/dist/imports.js.map +1 -1
  247. package/dist/index.d.ts +57 -38
  248. package/dist/index.d.ts.map +1 -1
  249. package/dist/index.js +38 -32
  250. package/dist/index.js.map +1 -1
  251. package/dist/loader.d.ts +16 -0
  252. package/dist/loader.d.ts.map +1 -0
  253. package/dist/loader.js +25 -0
  254. package/dist/loader.js.map +1 -0
  255. package/dist/node.d.ts +21 -0
  256. package/dist/node.d.ts.map +1 -0
  257. package/dist/node.js +24 -0
  258. package/dist/node.js.map +1 -0
  259. package/dist/orm.d.ts +69 -8
  260. package/dist/orm.d.ts.map +1 -1
  261. package/dist/orm.js +35 -2
  262. package/dist/orm.js.map +1 -1
  263. package/dist/prefab/collector.d.ts +29 -0
  264. package/dist/prefab/collector.d.ts.map +1 -0
  265. package/dist/prefab/collector.js +34 -0
  266. package/dist/prefab/collector.js.map +1 -0
  267. package/dist/{crud.d.ts → prefab/crud.d.ts} +7 -8
  268. package/dist/prefab/crud.d.ts.map +1 -0
  269. package/dist/{crud.js → prefab/crud.js} +39 -5
  270. package/dist/prefab/crud.js.map +1 -0
  271. package/dist/prefab/mirror.d.ts +52 -0
  272. package/dist/prefab/mirror.d.ts.map +1 -0
  273. package/dist/prefab/mirror.js +66 -0
  274. package/dist/prefab/mirror.js.map +1 -0
  275. package/dist/prefab/prefab.d.ts +15 -0
  276. package/dist/prefab/prefab.d.ts.map +1 -0
  277. package/dist/prefab/prefab.js +19 -0
  278. package/dist/prefab/prefab.js.map +1 -0
  279. package/dist/{presenter.d.ts → prefab/presenter.d.ts} +6 -17
  280. package/dist/prefab/presenter.d.ts.map +1 -0
  281. package/dist/{presenter.js → prefab/presenter.js} +5 -23
  282. package/dist/prefab/presenter.js.map +1 -0
  283. package/dist/prefab/repository.d.ts +104 -0
  284. package/dist/prefab/repository.d.ts.map +1 -0
  285. package/dist/prefab/repository.js +62 -0
  286. package/dist/prefab/repository.js.map +1 -0
  287. package/dist/scan/Fronds.d.ts +45 -0
  288. package/dist/scan/Fronds.d.ts.map +1 -0
  289. package/dist/scan/Fronds.js +66 -0
  290. package/dist/scan/Fronds.js.map +1 -0
  291. package/dist/scan/conventions.d.ts +74 -0
  292. package/dist/scan/conventions.d.ts.map +1 -0
  293. package/dist/scan/conventions.js +82 -0
  294. package/dist/scan/conventions.js.map +1 -0
  295. package/dist/scan/emit.d.ts +14 -0
  296. package/dist/scan/emit.d.ts.map +1 -0
  297. package/dist/scan/emit.js +212 -0
  298. package/dist/scan/emit.js.map +1 -0
  299. package/dist/scan/frond.d.ts +224 -0
  300. package/dist/scan/frond.d.ts.map +1 -0
  301. package/dist/scan/frond.js +2 -0
  302. package/dist/scan/frond.js.map +1 -0
  303. package/dist/{handler-parser.d.ts → scan/handler-parser.d.ts} +20 -9
  304. package/dist/scan/handler-parser.d.ts.map +1 -0
  305. package/dist/scan/handler-parser.js +665 -0
  306. package/dist/scan/handler-parser.js.map +1 -0
  307. package/dist/scan/scan-cache.d.ts +16 -0
  308. package/dist/scan/scan-cache.d.ts.map +1 -0
  309. package/dist/{scan-cache.js → scan/scan-cache.js} +27 -20
  310. package/dist/scan/scan-cache.js.map +1 -0
  311. package/dist/scan/scanner.d.ts +20 -0
  312. package/dist/scan/scanner.d.ts.map +1 -0
  313. package/dist/{scanner.js → scan/scanner.js} +212 -167
  314. package/dist/scan/scanner.js.map +1 -0
  315. package/dist/verify.d.ts +16 -3
  316. package/dist/verify.d.ts.map +1 -1
  317. package/dist/verify.js +21 -18
  318. package/dist/verify.js.map +1 -1
  319. package/dist/{call.d.ts → wire/call.d.ts} +76 -7
  320. package/dist/wire/call.d.ts.map +1 -0
  321. package/dist/{call.js → wire/call.js} +53 -80
  322. package/dist/wire/call.js.map +1 -0
  323. package/dist/{middleware.d.ts → wire/errors.d.ts} +18 -19
  324. package/dist/wire/errors.d.ts.map +1 -0
  325. package/dist/{middleware.js → wire/errors.js} +26 -14
  326. package/dist/wire/errors.js.map +1 -0
  327. package/dist/{errors.d.ts → wire/http-error.d.ts} +5 -6
  328. package/dist/wire/http-error.d.ts.map +1 -0
  329. package/dist/{errors.js → wire/http-error.js} +7 -6
  330. package/dist/wire/http-error.js.map +1 -0
  331. package/dist/wire/invocation.d.ts +4 -0
  332. package/dist/wire/invocation.d.ts.map +1 -0
  333. package/dist/wire/invocation.js +3 -0
  334. package/dist/wire/invocation.js.map +1 -0
  335. package/dist/{middleware/logger.d.ts → wire/loggerMiddleware.d.ts} +3 -3
  336. package/dist/wire/loggerMiddleware.d.ts.map +1 -0
  337. package/dist/{middleware/logger.js → wire/loggerMiddleware.js} +2 -2
  338. package/dist/wire/loggerMiddleware.js.map +1 -0
  339. package/dist/wire/middleware.d.ts +29 -0
  340. package/dist/wire/middleware.d.ts.map +1 -0
  341. package/dist/wire/middleware.js +20 -0
  342. package/dist/wire/middleware.js.map +1 -0
  343. package/dist/{operation.d.ts → wire/operation.d.ts} +39 -10
  344. package/dist/wire/operation.d.ts.map +1 -0
  345. package/dist/wire/operation.js +167 -0
  346. package/dist/wire/operation.js.map +1 -0
  347. package/package.json +27 -8
  348. package/src/boot/AppLifecycle.ts +50 -0
  349. package/src/boot/Emissions.ts +263 -0
  350. package/src/boot/HandlerFacade.ts +242 -0
  351. package/src/boot/Lifecycle.ts +3 -0
  352. package/src/boot/ambient-port.ts +41 -0
  353. package/src/boot/ambient.als.ts +43 -0
  354. package/src/boot/ambient.queue.ts +75 -0
  355. package/src/boot/apply.ts +47 -0
  356. package/src/boot/auth.ts +55 -0
  357. package/src/boot/binding.ts +182 -0
  358. package/src/boot/boot.ts +125 -0
  359. package/src/boot/bootstrap.ts +839 -0
  360. package/src/boot/frame.ts +210 -0
  361. package/src/boot/ownership.ts +140 -0
  362. package/src/boot/ports.ts +66 -0
  363. package/src/boot/remote.ts +179 -0
  364. package/src/boot/seed.ts +158 -0
  365. package/src/boot/together.ts +215 -0
  366. package/src/boot/types.ts +261 -0
  367. package/src/builtins/config.ts +19 -0
  368. package/src/builtins/logger.ts +175 -0
  369. package/src/config-loader.ts +146 -0
  370. package/src/contract/Call.ts +18 -0
  371. package/src/contract/Invocation.ts +72 -0
  372. package/src/contract/RouteAddress.ts +49 -0
  373. package/src/contract.ts +74 -0
  374. package/src/crypto/encoding.ts +59 -0
  375. package/src/crypto/node.ts +30 -0
  376. package/src/crypto/port.ts +45 -0
  377. package/src/crypto/webcrypto.ts +55 -0
  378. package/src/define.ts +10 -0
  379. package/src/dispatch/ArgumentResolver.ts +17 -0
  380. package/src/dispatch/ArrayResult.ts +10 -0
  381. package/src/dispatch/DispatchEvent.ts +38 -0
  382. package/src/dispatch/DispatchLifecycle.ts +23 -0
  383. package/src/dispatch/DispatchPort.ts +6 -0
  384. package/src/dispatch/Dispatcher.ts +48 -0
  385. package/src/dispatch/InFlight.ts +49 -0
  386. package/src/dispatch/InputValidator.ts +28 -0
  387. package/src/dispatch/LocalRoutePolicy.ts +34 -0
  388. package/src/dispatch/OperationExecutor.ts +60 -0
  389. package/src/dispatch/OperationRoute.ts +18 -0
  390. package/src/dispatch/OutputProjector.ts +32 -0
  391. package/src/dispatch/OutputView.ts +9 -0
  392. package/src/dispatch/PresenterArgumentResolver.ts +25 -0
  393. package/src/dispatch/PresenterExecutor.ts +55 -0
  394. package/src/dispatch/RemoteRouteResolver.ts +21 -0
  395. package/src/dispatch/Route.ts +11 -0
  396. package/src/dispatch/RouteNotFoundError.ts +29 -0
  397. package/src/dispatch/RoutePolicy.ts +8 -0
  398. package/src/dispatch/RouteRegistry.ts +73 -0
  399. package/src/dispatch/RouteResolver.ts +7 -0
  400. package/src/dispatch/StorageGuard.ts +71 -0
  401. package/src/effective-operation.ts +597 -0
  402. package/src/emit.ts +90 -0
  403. package/src/entry/DynamicFacade.ts +28 -0
  404. package/src/entry/FacadeEntry.ts +32 -0
  405. package/src/entry/TransportEntry.ts +30 -0
  406. package/src/frond-config.ts +138 -0
  407. package/src/graph.ts +180 -0
  408. package/src/identity-keys.ts +43 -0
  409. package/src/identity.ts +235 -0
  410. package/src/imports.ts +123 -0
  411. package/src/index.ts +106 -0
  412. package/src/loader.ts +41 -0
  413. package/src/node.ts +28 -0
  414. package/src/orm.ts +252 -0
  415. package/src/prefab/collector.ts +36 -0
  416. package/src/prefab/crud.ts +188 -0
  417. package/src/prefab/mirror.ts +122 -0
  418. package/src/prefab/prefab.ts +46 -0
  419. package/src/prefab/presenter.ts +63 -0
  420. package/src/prefab/repository.ts +170 -0
  421. package/src/scan/Fronds.ts +73 -0
  422. package/src/scan/conventions.ts +122 -0
  423. package/src/scan/emit.ts +231 -0
  424. package/src/scan/frond.ts +235 -0
  425. package/src/scan/handler-parser.ts +818 -0
  426. package/src/scan/scan-cache.ts +115 -0
  427. package/src/scan/scanner.ts +758 -0
  428. package/src/verify.ts +193 -0
  429. package/src/wire/call.ts +369 -0
  430. package/src/wire/errors.ts +124 -0
  431. package/src/wire/http-error.ts +77 -0
  432. package/src/wire/invocation.ts +10 -0
  433. package/src/wire/loggerMiddleware.ts +29 -0
  434. package/src/wire/middleware.ts +47 -0
  435. package/src/wire/operation.ts +258 -0
  436. package/dist/binding.d.ts.map +0 -1
  437. package/dist/binding.js.map +0 -1
  438. package/dist/boot.d.ts.map +0 -1
  439. package/dist/boot.js +0 -53
  440. package/dist/boot.js.map +0 -1
  441. package/dist/bootstrap.d.ts.map +0 -1
  442. package/dist/bootstrap.js +0 -879
  443. package/dist/bootstrap.js.map +0 -1
  444. package/dist/call.d.ts.map +0 -1
  445. package/dist/call.js.map +0 -1
  446. package/dist/collector.d.ts +0 -28
  447. package/dist/collector.d.ts.map +0 -1
  448. package/dist/collector.js +0 -32
  449. package/dist/collector.js.map +0 -1
  450. package/dist/crud.d.ts.map +0 -1
  451. package/dist/crud.js.map +0 -1
  452. package/dist/egress.d.ts +0 -52
  453. package/dist/egress.d.ts.map +0 -1
  454. package/dist/egress.js +0 -186
  455. package/dist/egress.js.map +0 -1
  456. package/dist/errors.d.ts.map +0 -1
  457. package/dist/errors.js.map +0 -1
  458. package/dist/handler-parser.d.ts.map +0 -1
  459. package/dist/handler-parser.js +0 -505
  460. package/dist/handler-parser.js.map +0 -1
  461. package/dist/invocation.d.ts +0 -20
  462. package/dist/invocation.d.ts.map +0 -1
  463. package/dist/invocation.js +0 -15
  464. package/dist/invocation.js.map +0 -1
  465. package/dist/middleware/error-handler.d.ts +0 -15
  466. package/dist/middleware/error-handler.d.ts.map +0 -1
  467. package/dist/middleware/error-handler.js +0 -29
  468. package/dist/middleware/error-handler.js.map +0 -1
  469. package/dist/middleware/logger.d.ts.map +0 -1
  470. package/dist/middleware/logger.js.map +0 -1
  471. package/dist/middleware.d.ts.map +0 -1
  472. package/dist/middleware.js.map +0 -1
  473. package/dist/mirror.d.ts +0 -93
  474. package/dist/mirror.d.ts.map +0 -1
  475. package/dist/mirror.js +0 -96
  476. package/dist/mirror.js.map +0 -1
  477. package/dist/operation.d.ts.map +0 -1
  478. package/dist/operation.js +0 -95
  479. package/dist/operation.js.map +0 -1
  480. package/dist/presenter.d.ts.map +0 -1
  481. package/dist/presenter.js.map +0 -1
  482. package/dist/remote.d.ts.map +0 -1
  483. package/dist/remote.js.map +0 -1
  484. package/dist/repository.d.ts +0 -55
  485. package/dist/repository.d.ts.map +0 -1
  486. package/dist/repository.js +0 -26
  487. package/dist/repository.js.map +0 -1
  488. package/dist/scan-cache.d.ts +0 -10
  489. package/dist/scan-cache.d.ts.map +0 -1
  490. package/dist/scan-cache.js.map +0 -1
  491. package/dist/scanner.d.ts +0 -34
  492. package/dist/scanner.d.ts.map +0 -1
  493. package/dist/scanner.js.map +0 -1
  494. package/dist/seed.d.ts.map +0 -1
  495. package/dist/seed.js.map +0 -1
  496. package/dist/types.d.ts +0 -421
  497. package/dist/types.d.ts.map +0 -1
  498. package/dist/types.js.map +0 -1
  499. /package/dist/{bootstrap.d.ts → boot/bootstrap.d.ts} +0 -0
  500. /package/dist/{types.js → boot/types.js} +0 -0
package/README.md CHANGED
@@ -5,7 +5,8 @@ strictly locally; `createAppRunner` follows the topology (local façades, remote
5
5
  stand-ins). Transports move the value — they never reshape it.
6
6
 
7
7
  The façade judges the input, projects the output, and exposes only what a contract
8
- declares.
8
+ declares. It also canonicalizes optional input before binding: omission is `undefined`,
9
+ JSON may omit its property, and an explicit `null` is never rewritten.
9
10
 
10
11
  Node-free surface, for the browser: the `@fougere/core/contract` subpath.
11
12
 
@@ -18,4 +19,4 @@ pnpm add @fougere/core
18
19
 
19
20
  Part of [Fougere](https://github.com/chok/fougere) — one schema, a gradient from
20
21
  monolith to distributed, the same user code.
21
- Reference documentation: [the site](https://chok.github.io/fougere/) (en/fr).
22
+ Reference documentation: [the site](https://fougere.dev/) (en/fr).
@@ -0,0 +1,18 @@
1
+ import type { App } from './types.js';
2
+ /** One process-level extension and its reversible lifecycle. */
3
+ export interface Extension {
4
+ name: string;
5
+ up?(app: App): void | Promise<void>;
6
+ down?(app: App): void | Promise<void>;
7
+ }
8
+ /** Runs application extensions up in order and down in reverse order. */
9
+ export declare class AppLifecycle {
10
+ private readonly members;
11
+ add(...extensions: readonly (Extension | undefined)[]): this;
12
+ names(): string[];
13
+ up(app: App): Promise<void>;
14
+ down(app: App): Promise<void>;
15
+ }
16
+ /** The replaceable migration slot of the application lifecycle. */
17
+ export declare function migrating(migrate?: Extension['up']): Extension;
18
+ //# sourceMappingURL=AppLifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppLifecycle.d.ts","sourceRoot":"","sources":["../../src/boot/AppLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,yEAAyE;AACzE,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAE3C,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI;IAU5D,KAAK,IAAI,MAAM,EAAE;IAIX,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3B,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAapC;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAE9D"}
@@ -0,0 +1,42 @@
1
+ /** Runs application extensions up in order and down in reverse order. */
2
+ export class AppLifecycle {
3
+ members = [];
4
+ add(...extensions) {
5
+ for (const extension of extensions) {
6
+ if (!extension)
7
+ continue;
8
+ const at = this.members.findIndex((held) => held.name === extension.name);
9
+ if (at === -1)
10
+ this.members.push(extension);
11
+ else
12
+ this.members[at] = extension;
13
+ }
14
+ return this;
15
+ }
16
+ names() {
17
+ return this.members.map((extension) => extension.name);
18
+ }
19
+ async up(app) {
20
+ for (const extension of this.members)
21
+ await extension.up?.(app);
22
+ }
23
+ async down(app) {
24
+ const refused = [];
25
+ for (const extension of [...this.members].reverse()) {
26
+ try {
27
+ await extension.down?.(app);
28
+ }
29
+ catch (error) {
30
+ refused.push(error);
31
+ }
32
+ }
33
+ if (refused.length > 0) {
34
+ throw new AggregateError(refused, `${refused.length} extension(s) refused to release`);
35
+ }
36
+ }
37
+ }
38
+ /** The replaceable migration slot of the application lifecycle. */
39
+ export function migrating(migrate) {
40
+ return migrate ? { name: 'migrate', up: migrate } : { name: 'migrate' };
41
+ }
42
+ //# sourceMappingURL=AppLifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppLifecycle.js","sourceRoot":"","sources":["../../src/boot/AppLifecycle.ts"],"names":[],"mappings":"AASA,yEAAyE;AACzE,MAAM,OAAO,YAAY;IACN,OAAO,GAAgB,EAAE,CAAC;IAE3C,GAAG,CAAC,GAAG,UAA8C;QACnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS;gBAAE,SAAS;YACzB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;YAC1E,IAAI,EAAE,KAAK,CAAC,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;gBACvC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,GAAQ;QACf,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,SAAS,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,OAAO,GAAc,EAAE,CAAC;QAC9B,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,kCAAkC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,126 @@
1
+ import { type SchemaView } from '@fougere/schema';
2
+ import type { Container } from '@fougere/container';
3
+ import type { Logger } from '../builtins/logger.js';
4
+ import type { Fronds } from '../scan/Fronds.js';
5
+ import type { OperationsMap } from '../wire/operation.js';
6
+ /** Carries an announced fact out of this process — see `CreateAppOptions.onEmit`. */
7
+ type Carrier = (fact: string, payload: unknown) => void | Promise<void>;
8
+ /**
9
+ * Emissions — the only place in Fougere where an initiator names a SUBJECT.
10
+ *
11
+ * It was eight closures over four collections in the middle of the boot, which is a
12
+ * class that had not been named: the announced set, the subscriber index, the chain
13
+ * carried in async context, and the shapes a fact is judged against.
14
+ *
15
+ * **It is a resolver, not a channel.** It answers *who*, then hands over to the door
16
+ * that already exists — so a subscriber keeps its judge, its binding and its
17
+ * middlewares, and nothing here is durable.
18
+ */
19
+ export declare class Emissions {
20
+ private readonly shapes;
21
+ private readonly container;
22
+ private readonly log;
23
+ private readonly carry?;
24
+ /** Who listens to what. Filled as each door's contracts are resolved. */
25
+ private readonly subscribers;
26
+ /**
27
+ * What is announced here, read from the DEPS and not from the subscribers: a handler
28
+ * declaring `Emit<PostPublished>` must resolve it whether or not anybody listens, and
29
+ * announcing to nobody is legal.
30
+ */
31
+ private readonly announced;
32
+ constructor(fronds: Fronds, shapes: Map<string, SchemaView>, container: Container, log: Logger, carry?: Carrier | undefined);
33
+ /**
34
+ * Who listens to what — read from the PLAN, where `{ kind: 'fact' }` is a sentence
35
+ * `computeBindingPlan` already wrote, so nothing re-derives what a parameter is.
36
+ *
37
+ * It is called for a frond hosted here AND for one declared remote. A remote frond is
38
+ * still scanned — only its hosting is elsewhere — so its subscriptions are known, and
39
+ * its door resolves to a doublure. That is the whole reason an emission crosses a
40
+ * process without a line of transport code: the emitter learned the signature locally
41
+ * and calls the same key. Noting only the hosted ones left the index EMPTY under a
42
+ * split, and a fact announced to a remote listener reached nobody, in silence.
43
+ */
44
+ note(contracts: OperationsMap, door: string): void;
45
+ /** The shape a fact is judged by, when the fact is a declared entity. */
46
+ shapeOf(fact: string): SchemaView | undefined;
47
+ /** The facts this process has a listener for — what a carrier subscribes to on its behalf. */
48
+ listensTo(): string[];
49
+ /**
50
+ * Register one emission value per fact — announced here, or merely listened to.
51
+ *
52
+ * A process that only subscribes still needs the value, because `deliver` is what a
53
+ * carrier calls and it goes through the same door. Called once every door has been
54
+ * built, so the two sets are complete.
55
+ */
56
+ register(): void;
57
+ /**
58
+ * Announcing. Dispatch, never delivery — the emitter is handed back the moment every
59
+ * subscriber has been HANDED the fact, not when any of them is done.
60
+ *
61
+ * The `EventBus` this replaces did `await Promise.all(handlers)` and passed their
62
+ * rejections up, which made a publication hostage to its own indexer.
63
+ */
64
+ private announce;
65
+ /**
66
+ * Receiving. **The opposite rule, deliberately**: this one waits, and it tells.
67
+ *
68
+ * `deliver` is what a CARRIER calls, and a carrier's whole job is to know whether the
69
+ * fact landed — at-least-once is retrying what failed, so a delivery that cannot report
70
+ * makes durability impossible to build on top. It used to be the announcement itself:
71
+ * it resolved before any subscriber had run and swallowed every failure into a log, so a
72
+ * queue calling it could only ever ack blindly.
73
+ *
74
+ * That is not a contradiction of "dispatch is not delivery". That rule protects the
75
+ * EMITTER, which must not become hostage to a subscriber; a carrier is not the emitter,
76
+ * it is precisely the party whose business this is.
77
+ *
78
+ * What it still does not do is HOLD anything. A fact refused here is refused, and the
79
+ * carrier decides whether it comes back — which is the whole of Fougere's position on
80
+ * durability: the channel goes underneath, it is not reimplemented here.
81
+ */
82
+ deliver(fact: string, payload: unknown): Promise<void>;
83
+ /**
84
+ * The announcement realizes the fact's own `lifecycle.create` — a `created()` stamped,
85
+ * an id generated, a default applied.
86
+ *
87
+ * `applyCreate` (`schema/src/axis/lifecycle/apply.ts`) is where the split is realized:
88
+ * the judge never fills a hole, the STORAGE does, at the point of persistence. A fact has no storage, so nobody did — the judge declared an
89
+ * absent `created()` legal and omitted it, and a subscriber received a value missing a
90
+ * field its own type promises. Announcing is a fact's point of persistence.
91
+ *
92
+ * Announcing only, never `deliver`: a fact that arrives from elsewhere was stamped by
93
+ * its sender, and stamping it again would give one fact a different identity in every
94
+ * process that relayed it.
95
+ *
96
+ * **A typed emitter cannot reach this yet.** `Emit<T>` names the ROW type, where a
97
+ * `created()` field is present and required, so `announce({ id, title })` is a compile
98
+ * error and the author writes `at: new Date()` anyway. So this runs for a payload built
99
+ * outside the type — a bridge, a replay, a test — and is inert for everyone else.
100
+ */
101
+ private stamped;
102
+ /**
103
+ * Hand the fact to every listener in THIS process, and give back one promise each.
104
+ *
105
+ * The call goes THROUGH the door, so a subscriber meets the same judge, the same binding
106
+ * and the same middlewares as any caller. Nothing new answers for correctness — that is
107
+ * the dividend of a subscriber being an ordinary op rather than a special kind.
108
+ *
109
+ * It returns the promises rather than settling them, because the two callers want
110
+ * opposite things and only one of them is wrong to wait.
111
+ */
112
+ private handToListeners;
113
+ /**
114
+ * A subscriber refusing the SHAPE, said in one line instead of dumped as an error.
115
+ *
116
+ * This is the one refusal nobody else will ever see. A door hands its 400 back to the
117
+ * caller who can fix it; a fact is dispatched, not delivered, so the sender learns
118
+ * nothing and the log is the whole of the evidence. The most likely cause is also the
119
+ * one a stack trace hides worst — this process's copy is older than the sender's — so
120
+ * the line names the fields and the remedy, and hedges because a genuinely bad payload
121
+ * produces the same refusal.
122
+ */
123
+ private describeRefusal;
124
+ }
125
+ export {};
126
+ //# sourceMappingURL=Emissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Emissions.d.ts","sourceRoot":"","sources":["../../src/boot/Emissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQ1D,qFAAqF;AACrF,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExE;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IAalB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAfzB,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiC;IAE7D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;gBAGtC,MAAM,EAAE,MAAM,EACG,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,OAAO,YAAA;IAKlC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAWlD,yEAAyE;IACzE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI7C,8FAA8F;IAC9F,SAAS,IAAI,MAAM,EAAE;IAIrB;;;;;;OAMG;IACH,QAAQ,IAAI,IAAI;IAShB;;;;;;OAMG;YACW,QAAQ;IAuCtB;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB5D;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,OAAO;IAOf;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IA8BvB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CAMxB"}
@@ -0,0 +1,233 @@
1
+ import { applyCreate } from '@fougere/schema';
2
+ import { validationErrorsOf } from '../wire/errors.js';
3
+ import { emitKeyOf, factsAnnouncedBy } from '../emit.js';
4
+ import { ambient } from '#ambient';
5
+ import { EMPTY_INVOCATION } from '../wire/invocation.js';
6
+ /**
7
+ * Emissions — the only place in Fougere where an initiator names a SUBJECT.
8
+ *
9
+ * It was eight closures over four collections in the middle of the boot, which is a
10
+ * class that had not been named: the announced set, the subscriber index, the chain
11
+ * carried in async context, and the shapes a fact is judged against.
12
+ *
13
+ * **It is a resolver, not a channel.** It answers *who*, then hands over to the door
14
+ * that already exists — so a subscriber keeps its judge, its binding and its
15
+ * middlewares, and nothing here is durable.
16
+ */
17
+ export class Emissions {
18
+ shapes;
19
+ container;
20
+ log;
21
+ carry;
22
+ /** Who listens to what. Filled as each door's contracts are resolved. */
23
+ subscribers = new Map();
24
+ /**
25
+ * What is announced here, read from the DEPS and not from the subscribers: a handler
26
+ * declaring `Emit<PostPublished>` must resolve it whether or not anybody listens, and
27
+ * announcing to nobody is legal.
28
+ */
29
+ announced;
30
+ constructor(fronds, shapes, container, log, carry) {
31
+ this.shapes = shapes;
32
+ this.container = container;
33
+ this.log = log;
34
+ this.carry = carry;
35
+ this.announced = new Set(fronds.flatMap((frond) => factsAnnouncedBy(frond.handlers)));
36
+ }
37
+ /**
38
+ * Who listens to what — read from the PLAN, where `{ kind: 'fact' }` is a sentence
39
+ * `computeBindingPlan` already wrote, so nothing re-derives what a parameter is.
40
+ *
41
+ * It is called for a frond hosted here AND for one declared remote. A remote frond is
42
+ * still scanned — only its hosting is elsewhere — so its subscriptions are known, and
43
+ * its door resolves to a doublure. That is the whole reason an emission crosses a
44
+ * process without a line of transport code: the emitter learned the signature locally
45
+ * and calls the same key. Noting only the hosted ones left the index EMPTY under a
46
+ * split, and a fact announced to a remote listener reached nobody, in silence.
47
+ */
48
+ note(contracts, door) {
49
+ for (const [op, contract] of contracts) {
50
+ for (const bound of contract.binding ?? []) {
51
+ if (bound.source.kind !== 'fact')
52
+ continue;
53
+ const listeners = this.subscribers.get(bound.source.factName) ?? [];
54
+ listeners.push({ door, op });
55
+ this.subscribers.set(bound.source.factName, listeners);
56
+ }
57
+ }
58
+ }
59
+ /** The shape a fact is judged by, when the fact is a declared entity. */
60
+ shapeOf(fact) {
61
+ return this.shapes.get(fact);
62
+ }
63
+ /** The facts this process has a listener for — what a carrier subscribes to on its behalf. */
64
+ listensTo() {
65
+ return [...this.subscribers.keys()];
66
+ }
67
+ /**
68
+ * Register one emission value per fact — announced here, or merely listened to.
69
+ *
70
+ * A process that only subscribes still needs the value, because `deliver` is what a
71
+ * carrier calls and it goes through the same door. Called once every door has been
72
+ * built, so the two sets are complete.
73
+ */
74
+ register() {
75
+ for (const fact of new Set([...this.announced, ...this.subscribers.keys()])) {
76
+ this.container.registerValue(emitKeyOf(fact), (raw) => this.announce(fact, raw));
77
+ }
78
+ if (ambient.degraded && this.subscribers.size > 0) {
79
+ this.log.warn('no async context on this runtime — an emission ring is not detected');
80
+ }
81
+ }
82
+ /**
83
+ * Announcing. Dispatch, never delivery — the emitter is handed back the moment every
84
+ * subscriber has been HANDED the fact, not when any of them is done.
85
+ *
86
+ * The `EventBus` this replaces did `await Promise.all(handlers)` and passed their
87
+ * rejections up, which made a publication hostage to its own indexer.
88
+ */
89
+ async announce(fact, raw) {
90
+ /**
91
+ * A fact announced inside a frame that then rolls back is a lie, and nothing can take
92
+ * it back: announcing is DISPATCH — every subscriber has been handed the fact and the
93
+ * carrier has already put it on the wire — while the frame's writes are still
94
+ * provisional.
95
+ *
96
+ * Refused rather than deferred to the commit. Deferring would make `Emit<T>` behave
97
+ * differently depending on where it is called from, which is the hidden runtime the
98
+ * doctrine refuses; and it opens a window between the commit and the announcement whose
99
+ * only remedy is an outbox — a table, therefore durability, the one thing Fougere says
100
+ * it does not hold.
101
+ *
102
+ * A fact designates something that HAS happened. `run` returning is when that becomes
103
+ * true, so that is where the announcement belongs.
104
+ */
105
+ await ambient.beforeAnnounce(fact);
106
+ const payload = this.stamped(fact, raw);
107
+ /**
108
+ * Whoever is not in this process — and it is the ONLY way to reach them.
109
+ *
110
+ * The local dispatch finds its listeners by having READ their code, so it stops at
111
+ * the repository boundary: another team's Frond is not on this disk, and the
112
+ * emission reaches nobody. A carrier hands the fact to a name instead, and the far
113
+ * side subscribes to that same name from ITS own code. Neither reads the other.
114
+ *
115
+ * `deliver` deliberately does NOT come here: a hub that resolved this value to hand
116
+ * on an incoming reading echoed it straight back to the whole fleet.
117
+ */
118
+ const carried = this.carry?.(fact, payload);
119
+ if (carried)
120
+ void Promise.resolve(carried).catch((cause) => this.log.error(`${fact} — carrier refused it`, cause));
121
+ for (const { door, op, done } of this.handToListeners(fact, payload)) {
122
+ void done.catch((cause) => this.log.error(`${fact} → ${door}.${op}`, this.describeRefusal(fact, cause) ?? cause));
123
+ }
124
+ }
125
+ /**
126
+ * Receiving. **The opposite rule, deliberately**: this one waits, and it tells.
127
+ *
128
+ * `deliver` is what a CARRIER calls, and a carrier's whole job is to know whether the
129
+ * fact landed — at-least-once is retrying what failed, so a delivery that cannot report
130
+ * makes durability impossible to build on top. It used to be the announcement itself:
131
+ * it resolved before any subscriber had run and swallowed every failure into a log, so a
132
+ * queue calling it could only ever ack blindly.
133
+ *
134
+ * That is not a contradiction of "dispatch is not delivery". That rule protects the
135
+ * EMITTER, which must not become hostage to a subscriber; a carrier is not the emitter,
136
+ * it is precisely the party whose business this is.
137
+ *
138
+ * What it still does not do is HOLD anything. A fact refused here is refused, and the
139
+ * carrier decides whether it comes back — which is the whole of Fougere's position on
140
+ * durability: the channel goes underneath, it is not reimplemented here.
141
+ */
142
+ async deliver(fact, payload) {
143
+ const handed = this.handToListeners(fact, payload);
144
+ const settled = await Promise.allSettled(handed.map((h) => h.done));
145
+ const refused = settled.flatMap((result, i) => result.status === 'rejected' ? [{ ...handed[i], reason: result.reason }] : []);
146
+ for (const { door, op, reason } of refused) {
147
+ this.log.error(`${fact} → ${door}.${op}`, this.describeRefusal(fact, reason) ?? reason);
148
+ }
149
+ if (refused.length > 0) {
150
+ throw new AggregateError(refused.map((r) => r.reason), `${fact} — ${refused.length} of ${handed.length} listener(s) refused it`
151
+ + ` (${refused.map((r) => `${r.door}.${r.op}`).join(', ')}).`
152
+ + ` Nothing here holds it: the carrier decides whether it comes back.`);
153
+ }
154
+ }
155
+ /**
156
+ * The announcement realizes the fact's own `lifecycle.create` — a `created()` stamped,
157
+ * an id generated, a default applied.
158
+ *
159
+ * `applyCreate` (`schema/src/axis/lifecycle/apply.ts`) is where the split is realized:
160
+ * the judge never fills a hole, the STORAGE does, at the point of persistence. A fact has no storage, so nobody did — the judge declared an
161
+ * absent `created()` legal and omitted it, and a subscriber received a value missing a
162
+ * field its own type promises. Announcing is a fact's point of persistence.
163
+ *
164
+ * Announcing only, never `deliver`: a fact that arrives from elsewhere was stamped by
165
+ * its sender, and stamping it again would give one fact a different identity in every
166
+ * process that relayed it.
167
+ *
168
+ * **A typed emitter cannot reach this yet.** `Emit<T>` names the ROW type, where a
169
+ * `created()` field is present and required, so `announce({ id, title })` is a compile
170
+ * error and the author writes `at: new Date()` anyway. So this runs for a payload built
171
+ * outside the type — a bridge, a replay, a test — and is inert for everyone else.
172
+ */
173
+ stamped(fact, raw) {
174
+ const shape = this.shapes.get(fact);
175
+ return shape && raw !== null && typeof raw === 'object' && !Array.isArray(raw)
176
+ ? applyCreate(shape.getFields(), raw)
177
+ : raw;
178
+ }
179
+ /**
180
+ * Hand the fact to every listener in THIS process, and give back one promise each.
181
+ *
182
+ * The call goes THROUGH the door, so a subscriber meets the same judge, the same binding
183
+ * and the same middlewares as any caller. Nothing new answers for correctness — that is
184
+ * the dividend of a subscriber being an ordinary op rather than a special kind.
185
+ *
186
+ * It returns the promises rather than settling them, because the two callers want
187
+ * opposite things and only one of them is wrong to wait.
188
+ */
189
+ handToListeners(fact, payload) {
190
+ const walked = ambient.currentChain();
191
+ if (walked.includes(fact)) {
192
+ throw new Error(`Emission cycle: ${[...walked, fact].join(' → ')}.\n`
193
+ + ` A fact cannot cause itself. One of the subscribers above announces a fact that leads back here.`);
194
+ }
195
+ const listeners = this.subscribers.get(fact) ?? [];
196
+ if (listeners.length === 0) {
197
+ this.log.debug(`${fact} — nobody listens in this process`);
198
+ return [];
199
+ }
200
+ return listeners.map(({ door, op }) => ({
201
+ door,
202
+ op,
203
+ done: ambient.enterChain(fact, async () => {
204
+ let facade;
205
+ try {
206
+ facade = this.container.resolve(door);
207
+ }
208
+ catch (cause) {
209
+ throw new Error(`${fact} → ${door} could not be reached`, { cause });
210
+ }
211
+ return facade[op]({ ...EMPTY_INVOCATION, body: payload });
212
+ }),
213
+ }));
214
+ }
215
+ /**
216
+ * A subscriber refusing the SHAPE, said in one line instead of dumped as an error.
217
+ *
218
+ * This is the one refusal nobody else will ever see. A door hands its 400 back to the
219
+ * caller who can fix it; a fact is dispatched, not delivered, so the sender learns
220
+ * nothing and the log is the whole of the evidence. The most likely cause is also the
221
+ * one a stack trace hides worst — this process's copy is older than the sender's — so
222
+ * the line names the fields and the remedy, and hedges because a genuinely bad payload
223
+ * produces the same refusal.
224
+ */
225
+ describeRefusal(fact, cause) {
226
+ const refusals = validationErrorsOf(cause);
227
+ if (!refusals?.length)
228
+ return undefined;
229
+ return `refused the shape — ${refusals.map((d) => `${d.path}: ${d.message}`).join(', ')}.`
230
+ + ` If '${fact}' gained a field, this copy is older than the sender's: re-run \`fougere sync\`.`;
231
+ }
232
+ }
233
+ //# sourceMappingURL=Emissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Emissions.js","sourceRoot":"","sources":["../../src/boot/Emissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAczD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,SAAS;IAaD;IACA;IACA;IACA;IAfnB,yEAAyE;IACxD,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE7D;;;;OAIG;IACc,SAAS,CAAc;IAExC,YACE,MAAc,EACG,MAA+B,EAC/B,SAAoB,EACpB,GAAW,EAC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J,EAAE;YACF,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;gBACxC,IAAI,MAAgC,CAAC;gBACrC,IAAI,CAAC;oBACH,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAA2B,IAAI,CAAC,CAAC;gBAClE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,IAAI,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;gBACvE,CAAC;gBACD,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC;SACH,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACK,eAAe,CAAC,IAAY,EAAE,KAAc;QAClD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,EAAE,MAAM;YAAE,OAAO,SAAS,CAAC;QACxC,OAAO,uBAAuB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;cACtF,QAAQ,IAAI,kFAAkF,CAAC;IACrG,CAAC;CACF"}
@@ -0,0 +1,72 @@
1
+ import type { Container } from '@fougere/container';
2
+ import type { AppMiddleware } from '../wire/middleware.js';
3
+ import type { OperationsMap } from '../wire/operation.js';
4
+ import type { EffectiveOperationsMap } from '../effective-operation.js';
5
+ import type { Emissions } from './Emissions.js';
6
+ import type { Logger } from '../builtins/logger.js';
7
+ import type { EntityEntry, HandlerEntry, PresenterEntry } from '../scan/frond.js';
8
+ /** What this door is about: a handler, the entity behind it when there is one, and where it resolves. */
9
+ export interface Doorway {
10
+ handler: HandlerEntry;
11
+ /** Handlers in the owning frond, used to realize a resolved implementation override. */
12
+ handlers: readonly HandlerEntry[];
13
+ /** The canonical operation table resolved before boot performs any side effect. */
14
+ operations: EffectiveOperationsMap;
15
+ /** The subject — absent is ordinary: a health check owns no row. */
16
+ entity: EntityEntry | undefined;
17
+ /** The scope the handler and its collectors resolve in — a surface gets its own. */
18
+ scope: Container;
19
+ /** The container key this door answers under. */
20
+ key: string;
21
+ }
22
+ /** What the frond and the boot supply to every door alike. */
23
+ export interface Wiring {
24
+ /** The frond this door belongs to — travels on every OperationContext. */
25
+ frond: string;
26
+ /** The frond's own scope — where presenters live, whatever sub-scope the door uses. */
27
+ frondScope: Container;
28
+ log: Logger;
29
+ /** Entity names this frond has a collector for. */
30
+ collectors: Set<string>;
31
+ presenters: Map<string, PresenterEntry>;
32
+ /** The middlewares that apply to an address, read at call time and never at boot. */
33
+ middlewaresFor: (address: string) => AppMiddleware[];
34
+ emissions: Emissions;
35
+ }
36
+ /** Adapts one handler door to executable operations. */
37
+ export declare class HandlerFacade {
38
+ private readonly door;
39
+ private readonly wiring;
40
+ /** Rich operation facts shared with check, explain and adapters. */
41
+ readonly effectiveOperations: EffectiveOperationsMap;
42
+ /** Contracts served by this door. */
43
+ readonly contracts: OperationsMap;
44
+ /** The callable surface: op name → the function a caller reaches. */
45
+ readonly ops: Record<string, Function>;
46
+ private readonly cachedViews;
47
+ private instance;
48
+ private readonly implementationKeys;
49
+ private readonly implementationInstances;
50
+ private readonly inputValidator;
51
+ private readonly argumentResolver;
52
+ private readonly presenterArguments;
53
+ constructor(door: Doorway, wiring: Wiring);
54
+ /** Storage follows the Crud subject, which may differ from the door address. */
55
+ private subjectOf;
56
+ private inheritsCrud;
57
+ private get handlerKey();
58
+ private depsOf;
59
+ /** A custom Crud constructor must explicitly receive its repository. */
60
+ private refuseCrudWithoutRepository;
61
+ /** Resolve and cache the output view declared for one operation. */
62
+ private viewOf;
63
+ private collectorResolver;
64
+ /** The handler itself, resolved on first call — never at boot. */
65
+ private resolvedHandler;
66
+ private isBaseImplementation;
67
+ /** The exact handler entry the pure model selected; no name-only retry or fallback. */
68
+ private implementationHandler;
69
+ private resolvedImplementation;
70
+ private wrap;
71
+ }
72
+ //# sourceMappingURL=HandlerFacade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandlerFacade.d.ts","sourceRoot":"","sources":["../../src/boot/HandlerFacade.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlF,yGAAyG;AACzG,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,wFAAwF;IACxF,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,mFAAmF;IACnF,UAAU,EAAE,sBAAsB,CAAC;IACnC,oEAAoE;IACpE,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,oFAAoF;IACpF,KAAK,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,8DAA8D;AAC9D,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,UAAU,EAAE,SAAS,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,UAAU,EAAE,GAAG,CAAC,MAA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