@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
@@ -0,0 +1,47 @@
1
+ import type { FougereConfig } from '../config-loader.js';
2
+ import { setLogLevel, logLevel, envLevel } from '../builtins/logger.js';
3
+ import { dequal } from 'dequal';
4
+
5
+ export interface ConfigApplication {
6
+ /** What this call changed in the running process. */
7
+ applied: string[];
8
+ /** What differs from the config in force and did NOT take effect. */
9
+ pending: string[];
10
+ }
11
+
12
+ /**
13
+ * What a (re-)read config changes in a process that is already running.
14
+ *
15
+ * The rule it realizes, and the only one worth remembering: **a value that is
16
+ * CONSULTED can change under a running app; a value that was CONSUMED to build
17
+ * something cannot, without rebuilding what it built.** `logLevel` is consulted at
18
+ * every emission, so it moves. `db` opened a connection, `ports:` registered a class,
19
+ * the entities built façades — those are consumed, and this function reports them
20
+ * rather than pretending.
21
+ *
22
+ * The list of consulted keys is not declared anywhere: a key is consulted when this
23
+ * function does something with it, which is the only definition that cannot go stale.
24
+ */
25
+ export function applyConfig(next: FougereConfig, inForce?: FougereConfig): ConfigApplication {
26
+ const applied: string[] = [];
27
+ const pending: string[] = [];
28
+
29
+ // The CLI speaks through the environment, so it keeps winning over the file — read
30
+ // through `envLevel`, which is where the environment is already judged. Casting it
31
+ // here was a second reader that validated nothing: `FOUGERE_LOG_LEVEL=verbose` set
32
+ // the threshold to `undefined` and every log passed.
33
+ const wanted = envLevel() ?? next.logLevel ?? 'debug';
34
+ const before = logLevel();
35
+ if (wanted !== before) {
36
+ setLogLevel(wanted);
37
+ applied.push(`logLevel: ${before} → ${wanted}`);
38
+ }
39
+
40
+ for (const key of new Set([...Object.keys(next), ...Object.keys(inForce ?? {})])) {
41
+ if (key === 'logLevel' || !inForce) continue;
42
+ if (!dequal((next as Record<string, unknown>)[key], (inForce as Record<string, unknown>)[key])) {
43
+ pending.push(key);
44
+ }
45
+ }
46
+ return { applied, pending };
47
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * What an auth provider promises the boot, and what the boot hands it — the whole of
3
+ * the contract between core and an `@fougere/auth-*` package.
4
+ */
5
+ import type { SchemaView } from '@fougere/schema';
6
+ import type { EntityOrm, OrmFactory } from '../orm.js';
7
+
8
+ /**
9
+ * Lazy auth declaration written in fougere.config.ts.
10
+ *
11
+ * Each @fougere/auth-* package exports a factory (e.g. `betterAuth(opts)`) that
12
+ * returns this shape. The `create()` method is called once at boot with the
13
+ * resolved db + ormFactory, so the provider can wire its engine through Fougere.
14
+ */
15
+ export interface AuthConfig {
16
+ /** Build the runtime — invoked by createApp at boot with the resolved storage handles. */
17
+ create(ctx: AuthContext): AuthRuntime | Promise<AuthRuntime>;
18
+ /**
19
+ * Entities the provider will use. Optional metadata — useful for the core's
20
+ * future migration registry to know which tables auth needs.
21
+ */
22
+ entities?: Record<string, SchemaView>;
23
+ }
24
+
25
+ /**
26
+ * Context passed by the core to an auth provider's create() function.
27
+ * Provides the resources the provider needs to integrate with the app.
28
+ */
29
+ export interface AuthContext {
30
+ /** Storage handle (Kysely DB instance, Prisma client, etc.) — opaque to core. */
31
+ db: unknown;
32
+ /** Per-entity ORM factory — auth provider uses this to back its adapter. */
33
+ ormFactory: OrmFactory;
34
+ }
35
+
36
+ /**
37
+ * Runtime returned by an auth provider's create(config, ctx) function.
38
+ * The core mounts this on the App and the HTTP layer (Nuxt module / router) uses it.
39
+ */
40
+ export interface AuthRuntime {
41
+ /** Entities used by the provider, including any defaults it filled in. */
42
+ entities: Record<string, SchemaView>;
43
+ /**
44
+ * Per-entity ORMs the provider built for itself. Exposed so app code can
45
+ * query auth tables (e.g. list active sessions for a user) without rebuilding
46
+ * the same EntityOrm.
47
+ */
48
+ orms: Record<string, EntityOrm>;
49
+ /** Web Standard handler that processes /auth/* requests. */
50
+ handler: (request: Request) => Promise<Response>;
51
+ /** Programmatic API exposed by the provider (getSession, signOut, ...). */
52
+ api: Record<string, unknown>;
53
+ /** Effective mount path (echoes config.basePath or the provider's default). */
54
+ basePath: string;
55
+ }
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Where each parameter of an operation gets its value — decided once at boot from the
3
+ * parsed signature, replayed per call by `resolveArgs`.
4
+ *
5
+ * The branches are ORDERED and each states why it sits where it does; the list used to
6
+ * be repeated here too, and it had already lost `Fact` — the one whose position is
7
+ * load-bearing, since the fall-through would otherwise hand it the caller's body.
8
+ */
9
+ import type { ParsedParam } from '../scan/handler-parser.js';
10
+ import type { InvocationContext } from '../wire/invocation.js';
11
+ import { lowerFirst } from '@fougere/schema';
12
+
13
+ // ── Types ─────────────────────────────────────
14
+
15
+ type ParamSource =
16
+ | { kind: 'collector'; typeName: string }
17
+ /**
18
+ * `Fact<PostPublished>` — something that happened, not something a caller typed.
19
+ *
20
+ * It resolves from the body exactly like `body` does, and that is deliberate: an
21
+ * emission and a direct call ARE the same call, so a subscriber cannot tell them apart
22
+ * and does not need to. The branch exists so the PLAN says what this parameter is —
23
+ * that sentence is what makes the subscriber index readable without reparsing types.
24
+ */
25
+ | { kind: 'fact'; factName: string }
26
+ | { kind: 'param'; name: string; coerce?: 'number' | 'boolean' }
27
+ | { kind: 'body' }
28
+ | { kind: 'context' }
29
+ /** The whole query bag, for an op whose argument IS the options (list). */
30
+ | { kind: 'query' };
31
+
32
+ interface ParamBinding {
33
+ name: string;
34
+ source: ParamSource;
35
+ optional: boolean;
36
+ }
37
+
38
+ export type BindingPlan = ParamBinding[];
39
+
40
+ // ── Primitives ────────────────────────────────
41
+
42
+ const PRIMITIVES = new Set(['string', 'number', 'boolean']);
43
+
44
+ function coercionFor(typeName: string): 'number' | 'boolean' | undefined {
45
+ if (typeName === 'number') return 'number';
46
+ if (typeName === 'boolean') return 'boolean';
47
+ return undefined;
48
+ }
49
+
50
+ // ── Compute ───────────────────────────────────
51
+
52
+ /**
53
+ * Build a BindingPlan from parsed method params.
54
+ *
55
+ * @param params - Parsed parameter list from AST
56
+ * @param collectorTypeNames - Registration keys of the types a Collector answers for
57
+ */
58
+ export function computeBindingPlan(
59
+ params: ParsedParam[],
60
+ collectorTypeNames: Set<string>,
61
+ ): BindingPlan {
62
+ return params.map((param) => {
63
+ const typeName = param.type.name;
64
+ // `lowerFirst`, never `toLowerCase()`: the collector set is keyed the way the
65
+ // scan spells it, and the two agree on one word only — `AuthorUser` looked up as
66
+ // `authoruser` missed `authorUser` and fell through to branch 4, the request body.
67
+ const typeKey = lowerFirst(typeName);
68
+
69
+ // 0. Fact — `Fact<X>` names itself, so nothing has to be known in advance. It comes
70
+ // FIRST because branch 4 would otherwise hand it the caller's body under the name
71
+ // of something that happened.
72
+ const factOf = param.type.name === 'Fact' ? param.type.generics?.[0]?.name : undefined;
73
+ if (factOf) {
74
+ return {
75
+ name: param.name,
76
+ source: { kind: 'fact' as const, factName: lowerFirst(factOf) },
77
+ optional: param.optional ?? false,
78
+ };
79
+ }
80
+
81
+ // 1. Collector — param type matches a type some collector answers for
82
+ if (collectorTypeNames.has(typeKey)) {
83
+ return {
84
+ name: param.name,
85
+ source: { kind: 'collector' as const, typeName: typeKey },
86
+ optional: param.optional ?? false,
87
+ };
88
+ }
89
+
90
+ // 2. InvocationContext — inject the full context
91
+ if (typeName === 'InvocationContext') {
92
+ return {
93
+ name: param.name,
94
+ source: { kind: 'context' as const },
95
+ optional: param.optional ?? false,
96
+ };
97
+ }
98
+
99
+ // 3. Primitives — matched by name from params > query
100
+ if (PRIMITIVES.has(typeName)) {
101
+ return {
102
+ name: param.name,
103
+ source: {
104
+ kind: 'param' as const,
105
+ name: param.name,
106
+ coerce: coercionFor(typeName),
107
+ },
108
+ optional: param.optional ?? false,
109
+ };
110
+ }
111
+
112
+ // 4. Everything else — body
113
+ return {
114
+ name: param.name,
115
+ source: { kind: 'body' as const },
116
+ optional: param.optional ?? false,
117
+ };
118
+ });
119
+ }
120
+
121
+ // ── Resolve ───────────────────────────────────
122
+
123
+ export interface CollectorResolver {
124
+ collect(ctx: InvocationContext): Promise<unknown>;
125
+ }
126
+
127
+ /**
128
+ * Resolve handler arguments from a BindingPlan + InvocationContext.
129
+ */
130
+ export async function resolveArgs(
131
+ plan: BindingPlan,
132
+ ctx: InvocationContext,
133
+ resolveCollector?: (typeName: string) => CollectorResolver | undefined,
134
+ ): Promise<unknown[]> {
135
+ const args: unknown[] = [];
136
+
137
+ for (const binding of plan) {
138
+ switch (binding.source.kind) {
139
+ case 'collector': {
140
+ const collector = resolveCollector?.(binding.source.typeName);
141
+ args.push(collector ? await collector.collect(ctx) : undefined);
142
+ break;
143
+ }
144
+ case 'context': {
145
+ args.push(ctx);
146
+ break;
147
+ }
148
+ case 'param': {
149
+ // `null` is a value, not a miss. Nullish coalescing used to make an explicit
150
+ // nullable path/GraphQL argument fall through to query (or become undefined),
151
+ // collapsing `T | null` into `T | undefined`. Only undefined means absent.
152
+ const fromParams = ctx.params[binding.source.name];
153
+ let val: unknown = fromParams === undefined
154
+ ? ctx.query[binding.source.name]
155
+ : fromParams;
156
+ if (val != null && binding.source.coerce === 'number') val = Number(val);
157
+ if (val != null && binding.source.coerce === 'boolean') val = val === 'true' || val === '1' || val === true;
158
+ args.push(val);
159
+ break;
160
+ }
161
+ case 'fact': {
162
+ // A fact IS the payload — the whole of what happened, never a piece of it.
163
+ // Identical to `body` today, and deliberately not sharing its branch: the two
164
+ // agree by coincidence, not by rule, and the day `body` learns to look up a
165
+ // value by parameter name a subscriber would receive ONE FIELD of the fact it
166
+ // subscribed to. Splitting it costs nothing and removes that trap.
167
+ args.push(ctx.body);
168
+ break;
169
+ }
170
+ case 'body': {
171
+ args.push(ctx.body);
172
+ break;
173
+ }
174
+ case 'query': {
175
+ args.push(ctx.query);
176
+ break;
177
+ }
178
+ }
179
+ }
180
+
181
+ return args;
182
+ }
@@ -0,0 +1,125 @@
1
+ import { createApp } from './bootstrap.js';
2
+ import { seeding } from './seed.js';
3
+ import { scanProject } from '../scan/scanner.js';
4
+ import { loadConfig, type FougereConfig } from '../config-loader.js';
5
+ import { Logger } from '../builtins/logger.js';
6
+ import { applyConfig } from './apply.js';
7
+ import type { App, CreateAppOptions } from './types.js';
8
+ import { migrating, type Extension } from './AppLifecycle.js';
9
+ import type { Transport } from '../wire/call.js';
10
+ import type { Container } from '@fougere/container';
11
+
12
+ interface BootOptions {
13
+ /** Project root. Defaults to process.cwd(). */
14
+ root?: string;
15
+ /** Override config (merged with fougere.config.ts). */
16
+ config?: Partial<FougereConfig>;
17
+ /** Container factory. Required. */
18
+ createContainer: () => Container;
19
+ /** Only boot these fronds (by name). Absent = all. */
20
+ fronds?: string[];
21
+ /**
22
+ * Remote fronds — label → address. A declared remote wins over local
23
+ * presence (the frond runs elsewhere). Requires `remoteTransport`.
24
+ */
25
+ remotes?: Record<string, string>;
26
+ /** Builds the transport to reach `remotes`. Supplied by a layer-2 package. */
27
+ remoteTransport?: (url: string) => Transport;
28
+ /**
29
+ * Carries an announced fact out of this process. Forwarded rather than dropped: a
30
+ * caller handing one in has no other way to reach the emitter, and this path silently
31
+ * kept it to itself.
32
+ */
33
+ onEmit?: CreateAppOptions['onEmit'];
34
+ /**
35
+ * ORM setup — returns the storage handle (db), an ormFactory, and its two halves.
36
+ * The `db` value is forwarded to the auth provider via AuthContext when `auth` is set.
37
+ */
38
+ db?: (config: FougereConfig) => {
39
+ db?: unknown;
40
+ ormFactory: CreateAppOptions['ormFactory'];
41
+ /**
42
+ * Bring the schema up to date — an extension's `up`, because it runs after the
43
+ * container. It used to be called `afterBoot`, a word that also meant the host's
44
+ * post-boot and was read in four places under two senses.
45
+ */
46
+ migrate?: (app: App) => Promise<void> | void;
47
+ /** Closes what the factory opened — `boot()` called it, so `boot()` releases it. */
48
+ close?: () => Promise<void>;
49
+ };
50
+ /**
51
+ * What this app takes on beyond its fronds. Appended after the framework's own, so a
52
+ * host adds to the ascent — or replaces a member of it by declaring the same name.
53
+ */
54
+ extensions?: readonly (Extension | undefined)[];
55
+ }
56
+
57
+ /**
58
+ * Boot a Fougere app from fougere.config.ts.
59
+ *
60
+ * Handles: config loading, container creation, DB setup, seeding.
61
+ * Works for any surface (Nuxt, GraphQL standalone, CLI, tests).
62
+ */
63
+ export async function boot(options: BootOptions): Promise<App> {
64
+ const bootStart = performance.now();
65
+ const log = new Logger('boot');
66
+
67
+ const root = options.root ?? process.cwd();
68
+ log.info(`root: ${root}`);
69
+
70
+ log.debug('loading config');
71
+ const fileConfig = await loadConfig(root);
72
+ const config: FougereConfig = { ...fileConfig, ...options.config };
73
+ // What this config changes in the process, said the same way at boot and at reload —
74
+ // there is one applier, and a host re-reading later calls the very same function.
75
+ applyConfig(config);
76
+ log.info('config loaded');
77
+
78
+ let dbSetup: ReturnType<NonNullable<BootOptions['db']>> | undefined;
79
+ if (options.db) {
80
+ log.debug('initializing database');
81
+ dbSetup = options.db(config);
82
+ log.info('database initialized');
83
+ }
84
+
85
+ log.debug('creating app (scan + container)');
86
+ const app = await createApp({
87
+ // boot() lives on the Node entry, so boot() is what reads the disk. `createApp` is
88
+ // handed the answer and reaches for nothing.
89
+ scan: await scanProject(root, options.fronds, config.conventions),
90
+ createContainer: options.createContainer,
91
+ ormFactory: dbSetup?.ormFactory,
92
+ db: dbSetup?.db,
93
+ auth: config.auth,
94
+ remotes: options.remotes,
95
+ ports: config.ports,
96
+ // Read from the config for the same reason `ports` is, one line up: it is a fact the
97
+ // project states, not one the caller passes. Absent here, `serveRest` and
98
+ // `serveGraphQL` both answered `pass` on an app whose config declared them — the
99
+ // hosts got it right through their own boot (`app/shared/src/boot.ts`), and this
100
+ // path, the conventional one, served nothing.
101
+ adapters: config.adapters,
102
+ // boot() called the factory, so boot() owns closing what it opened. Not an extension:
103
+ // it was opened before the container existed, so it closes after the container goes.
104
+ onDispose: dbSetup?.close,
105
+ /**
106
+ * The whole ascent, in one ordered list — tables, then rows, then whatever the host
107
+ * takes on. It was four call sites under the name `afterBoot`, two of which meant
108
+ * different things and one of which was generated into a Nitro plugin.
109
+ */
110
+ extensions: [
111
+ migrating(dbSetup?.migrate),
112
+ seeding((message) => log.debug(message)),
113
+ ...(options.extensions ?? []),
114
+ ],
115
+ onEmit: options.onEmit,
116
+ remoteTransport: options.remoteTransport,
117
+ });
118
+
119
+ log.info(`ascent: ${app.extensions().join(' → ') || 'nothing declared'}`);
120
+
121
+ const ms = (performance.now() - bootStart).toFixed(0);
122
+ log.info(`ready in ${ms}ms — ${app.fronds.length} frond(s)`);
123
+
124
+ return app;
125
+ }