@fougere/core 0.5.0-alpha.1 → 0.7.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/Emissions.d.ts +14 -91
  3. package/dist/boot/Emissions.d.ts.map +1 -1
  4. package/dist/boot/Emissions.js +21 -118
  5. package/dist/boot/Emissions.js.map +1 -1
  6. package/dist/boot/ambient-port.d.ts +3 -24
  7. package/dist/boot/ambient-port.d.ts.map +1 -1
  8. package/dist/boot/ambient.als.d.ts.map +1 -1
  9. package/dist/boot/ambient.als.js +7 -12
  10. package/dist/boot/ambient.als.js.map +1 -1
  11. package/dist/boot/ambient.queue.d.ts +2 -5
  12. package/dist/boot/ambient.queue.d.ts.map +1 -1
  13. package/dist/boot/ambient.queue.js.map +1 -1
  14. package/dist/boot/apply.d.ts +1 -13
  15. package/dist/boot/apply.d.ts.map +1 -1
  16. package/dist/boot/apply.js +3 -15
  17. package/dist/boot/apply.js.map +1 -1
  18. package/dist/boot/auth.d.ts +6 -16
  19. package/dist/boot/auth.d.ts.map +1 -1
  20. package/dist/boot/boot.d.ts +5 -18
  21. package/dist/boot/boot.d.ts.map +1 -1
  22. package/dist/boot/boot.js +4 -11
  23. package/dist/boot/boot.js.map +1 -1
  24. package/dist/boot/bootstrap.d.ts.map +1 -1
  25. package/dist/boot/bootstrap.js +106 -163
  26. package/dist/boot/bootstrap.js.map +1 -1
  27. package/dist/boot/card.d.ts +5 -0
  28. package/dist/boot/card.d.ts.map +1 -0
  29. package/dist/boot/card.js +71 -0
  30. package/dist/boot/card.js.map +1 -0
  31. package/dist/boot/frame.d.ts +8 -32
  32. package/dist/boot/frame.d.ts.map +1 -1
  33. package/dist/boot/frame.js +23 -57
  34. package/dist/boot/frame.js.map +1 -1
  35. package/dist/boot/hosted.d.ts +3 -19
  36. package/dist/boot/hosted.d.ts.map +1 -1
  37. package/dist/boot/hosted.js +12 -17
  38. package/dist/boot/hosted.js.map +1 -1
  39. package/dist/boot/ownership.d.ts +5 -36
  40. package/dist/boot/ownership.d.ts.map +1 -1
  41. package/dist/boot/ownership.js +9 -49
  42. package/dist/boot/ownership.js.map +1 -1
  43. package/dist/boot/ports.d.ts +2 -15
  44. package/dist/boot/ports.d.ts.map +1 -1
  45. package/dist/boot/ports.js +1 -14
  46. package/dist/boot/ports.js.map +1 -1
  47. package/dist/boot/remote.d.ts +5 -38
  48. package/dist/boot/remote.d.ts.map +1 -1
  49. package/dist/boot/remote.js +8 -41
  50. package/dist/boot/remote.js.map +1 -1
  51. package/dist/boot/runner.d.ts +11 -0
  52. package/dist/boot/runner.d.ts.map +1 -0
  53. package/dist/boot/runner.js +13 -0
  54. package/dist/boot/runner.js.map +1 -0
  55. package/dist/boot/seed.d.ts +5 -32
  56. package/dist/boot/seed.d.ts.map +1 -1
  57. package/dist/boot/seed.js +10 -41
  58. package/dist/boot/seed.js.map +1 -1
  59. package/dist/boot/statement-drift.d.ts +4 -22
  60. package/dist/boot/statement-drift.d.ts.map +1 -1
  61. package/dist/boot/statement-drift.js +4 -9
  62. package/dist/boot/statement-drift.js.map +1 -1
  63. package/dist/boot/together.d.ts +8 -12
  64. package/dist/boot/together.d.ts.map +1 -1
  65. package/dist/boot/together.js +28 -65
  66. package/dist/boot/together.js.map +1 -1
  67. package/dist/boot/types.d.ts +36 -180
  68. package/dist/boot/types.d.ts.map +1 -1
  69. package/dist/builtin/config.d.ts +7 -0
  70. package/dist/builtin/config.d.ts.map +1 -0
  71. package/dist/builtin/config.js +15 -0
  72. package/dist/builtin/config.js.map +1 -0
  73. package/dist/{builtins → builtin}/logger.d.ts +4 -25
  74. package/dist/builtin/logger.d.ts.map +1 -0
  75. package/dist/{builtins → builtin}/logger.js +5 -32
  76. package/dist/builtin/logger.js.map +1 -0
  77. package/dist/config-loader.d.ts +9 -67
  78. package/dist/config-loader.d.ts.map +1 -1
  79. package/dist/config-loader.js +5 -18
  80. package/dist/config-loader.js.map +1 -1
  81. package/dist/contract.d.ts +13 -31
  82. package/dist/contract.d.ts.map +1 -1
  83. package/dist/contract.js +10 -26
  84. package/dist/contract.js.map +1 -1
  85. package/dist/crypto/encoding.d.ts +2 -15
  86. package/dist/crypto/encoding.d.ts.map +1 -1
  87. package/dist/crypto/encoding.js +2 -15
  88. package/dist/crypto/encoding.js.map +1 -1
  89. package/dist/crypto/node.d.ts.map +1 -1
  90. package/dist/crypto/node.js +1 -7
  91. package/dist/crypto/node.js.map +1 -1
  92. package/dist/crypto/port.d.ts +2 -18
  93. package/dist/crypto/port.d.ts.map +1 -1
  94. package/dist/crypto/port.js +1 -17
  95. package/dist/crypto/port.js.map +1 -1
  96. package/dist/crypto/webcrypto.d.ts.map +1 -1
  97. package/dist/crypto/webcrypto.js +1 -12
  98. package/dist/crypto/webcrypto.js.map +1 -1
  99. package/dist/declare.d.ts +41 -0
  100. package/dist/declare.d.ts.map +1 -0
  101. package/dist/{scan/declare.js → declare.js} +6 -31
  102. package/dist/declare.js.map +1 -0
  103. package/dist/define.d.ts +2 -3
  104. package/dist/define.d.ts.map +1 -1
  105. package/dist/define.js +2 -3
  106. package/dist/define.js.map +1 -1
  107. package/dist/descriptor/Fronds.d.ts +19 -0
  108. package/dist/descriptor/Fronds.d.ts.map +1 -0
  109. package/dist/descriptor/Fronds.js +40 -0
  110. package/dist/descriptor/Fronds.js.map +1 -0
  111. package/dist/descriptor/frond.d.ts +135 -0
  112. package/dist/descriptor/frond.d.ts.map +1 -0
  113. package/dist/{scan → descriptor}/frond.js.map +1 -1
  114. package/dist/dispatch/ArgumentResolver.d.ts +6 -3
  115. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
  116. package/dist/dispatch/ArgumentResolver.js +48 -3
  117. package/dist/dispatch/ArgumentResolver.js.map +1 -1
  118. package/dist/dispatch/DispatchEvent.d.ts +2 -2
  119. package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
  120. package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
  121. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
  122. package/dist/dispatch/DispatchLifecycle.js +1 -7
  123. package/dist/dispatch/DispatchLifecycle.js.map +1 -1
  124. package/dist/dispatch/DispatchPort.d.ts +1 -1
  125. package/dist/dispatch/DispatchPort.d.ts.map +1 -1
  126. package/dist/dispatch/Dispatcher.d.ts +1 -1
  127. package/dist/dispatch/Dispatcher.d.ts.map +1 -1
  128. package/dist/dispatch/Dispatcher.js +2 -2
  129. package/dist/dispatch/Dispatcher.js.map +1 -1
  130. package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
  131. package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
  132. package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
  133. package/dist/dispatch/HandlerFacade.js.map +1 -0
  134. package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
  135. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
  136. package/dist/dispatch/LocalRoutePolicy.js +4 -4
  137. package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
  138. package/dist/dispatch/OperationRoute.d.ts +2 -2
  139. package/dist/dispatch/OperationRoute.d.ts.map +1 -1
  140. package/dist/dispatch/OutputView.d.ts +3 -2
  141. package/dist/dispatch/OutputView.d.ts.map +1 -1
  142. package/dist/dispatch/OutputView.js +19 -1
  143. package/dist/dispatch/OutputView.js.map +1 -1
  144. package/dist/dispatch/Route.d.ts +2 -3
  145. package/dist/dispatch/Route.d.ts.map +1 -1
  146. package/dist/dispatch/RoutePolicy.d.ts +1 -1
  147. package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
  148. package/dist/dispatch/RouteRegistry.d.ts +1 -1
  149. package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
  150. package/dist/dispatch/RouteRegistry.js +2 -2
  151. package/dist/dispatch/RouteRegistry.js.map +1 -1
  152. package/dist/dispatch/RouteResolver.d.ts +2 -4
  153. package/dist/dispatch/RouteResolver.d.ts.map +1 -1
  154. package/dist/dispatch/StorageGuard.d.ts +9 -8
  155. package/dist/dispatch/StorageGuard.d.ts.map +1 -1
  156. package/dist/dispatch/StorageGuard.js +66 -23
  157. package/dist/dispatch/StorageGuard.js.map +1 -1
  158. package/dist/dispatch/presenterArguments.d.ts +7 -0
  159. package/dist/dispatch/presenterArguments.d.ts.map +1 -0
  160. package/dist/dispatch/presenterArguments.js +12 -0
  161. package/dist/dispatch/presenterArguments.js.map +1 -0
  162. package/dist/dispatch/remoteRoutes.d.ts +7 -0
  163. package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
  164. package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
  165. package/dist/dispatch/remoteRoutes.js.map +1 -0
  166. package/dist/dispatch/routeNotFound.d.ts +9 -0
  167. package/dist/dispatch/routeNotFound.d.ts.map +1 -0
  168. package/dist/dispatch/routeNotFound.js +21 -0
  169. package/dist/dispatch/routeNotFound.js.map +1 -0
  170. package/dist/dispatch/validateInput.d.ts +5 -0
  171. package/dist/dispatch/validateInput.d.ts.map +1 -0
  172. package/dist/dispatch/validateInput.js +20 -0
  173. package/dist/dispatch/validateInput.js.map +1 -0
  174. package/dist/effective-operation.d.ts +6 -3
  175. package/dist/effective-operation.d.ts.map +1 -1
  176. package/dist/effective-operation.js +49 -27
  177. package/dist/effective-operation.js.map +1 -1
  178. package/dist/emit.d.ts +4 -42
  179. package/dist/emit.d.ts.map +1 -1
  180. package/dist/emit.js +3 -39
  181. package/dist/emit.js.map +1 -1
  182. package/dist/entry/facade.d.ts +8 -0
  183. package/dist/entry/facade.d.ts.map +1 -0
  184. package/dist/entry/facade.js +28 -0
  185. package/dist/entry/facade.js.map +1 -0
  186. package/dist/entry/transport.d.ts +5 -0
  187. package/dist/entry/transport.d.ts.map +1 -0
  188. package/dist/entry/transport.js +11 -0
  189. package/dist/entry/transport.js.map +1 -0
  190. package/dist/frond-config.d.ts +8 -71
  191. package/dist/frond-config.d.ts.map +1 -1
  192. package/dist/frond-config.js +1 -9
  193. package/dist/frond-config.js.map +1 -1
  194. package/dist/graph.d.ts +1 -1
  195. package/dist/graph.d.ts.map +1 -1
  196. package/dist/identity-keys.d.ts +2 -5
  197. package/dist/identity-keys.d.ts.map +1 -1
  198. package/dist/identity-keys.js +3 -16
  199. package/dist/identity-keys.js.map +1 -1
  200. package/dist/identity.d.ts +4 -30
  201. package/dist/identity.d.ts.map +1 -1
  202. package/dist/identity.js +11 -73
  203. package/dist/identity.js.map +1 -1
  204. package/dist/imports.d.ts +2 -8
  205. package/dist/imports.d.ts.map +1 -1
  206. package/dist/imports.js +1 -7
  207. package/dist/imports.js.map +1 -1
  208. package/dist/index.d.ts +28 -30
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +17 -22
  211. package/dist/index.js.map +1 -1
  212. package/dist/loader.d.ts +1 -8
  213. package/dist/loader.d.ts.map +1 -1
  214. package/dist/loader.js +1 -8
  215. package/dist/loader.js.map +1 -1
  216. package/dist/node.d.ts +2 -11
  217. package/dist/node.d.ts.map +1 -1
  218. package/dist/node.js +2 -11
  219. package/dist/node.js.map +1 -1
  220. package/dist/prefab/collector.d.ts +1 -22
  221. package/dist/prefab/collector.d.ts.map +1 -1
  222. package/dist/prefab/collector.js +1 -22
  223. package/dist/prefab/collector.js.map +1 -1
  224. package/dist/prefab/crud.d.ts +19 -35
  225. package/dist/prefab/crud.d.ts.map +1 -1
  226. package/dist/prefab/crud.js +39 -66
  227. package/dist/prefab/crud.js.map +1 -1
  228. package/dist/prefab/mirror.d.ts +5 -27
  229. package/dist/prefab/mirror.d.ts.map +1 -1
  230. package/dist/prefab/mirror.js +6 -24
  231. package/dist/prefab/mirror.js.map +1 -1
  232. package/dist/prefab/prefab.d.ts +1 -7
  233. package/dist/prefab/prefab.d.ts.map +1 -1
  234. package/dist/prefab/prefab.js +1 -7
  235. package/dist/prefab/prefab.js.map +1 -1
  236. package/dist/prefab/presenter.d.ts +2 -36
  237. package/dist/prefab/presenter.d.ts.map +1 -1
  238. package/dist/prefab/presenter.js +2 -36
  239. package/dist/prefab/presenter.js.map +1 -1
  240. package/dist/prefab/repository.d.ts +12 -80
  241. package/dist/prefab/repository.d.ts.map +1 -1
  242. package/dist/prefab/repository.js +22 -35
  243. package/dist/prefab/repository.js.map +1 -1
  244. package/dist/scan/adapters.d.ts +3 -0
  245. package/dist/scan/adapters.d.ts.map +1 -0
  246. package/dist/scan/adapters.js +25 -0
  247. package/dist/scan/adapters.js.map +1 -0
  248. package/dist/scan/bundling.d.ts +1 -12
  249. package/dist/scan/bundling.d.ts.map +1 -1
  250. package/dist/scan/bundling.js +1 -12
  251. package/dist/scan/bundling.js.map +1 -1
  252. package/dist/scan/conventions.d.ts +6 -40
  253. package/dist/scan/conventions.d.ts.map +1 -1
  254. package/dist/scan/conventions.js +5 -34
  255. package/dist/scan/conventions.js.map +1 -1
  256. package/dist/scan/emit.d.ts +2 -6
  257. package/dist/scan/emit.d.ts.map +1 -1
  258. package/dist/scan/emit.js +5 -39
  259. package/dist/scan/emit.js.map +1 -1
  260. package/dist/scan/handler-parser.d.ts +9 -76
  261. package/dist/scan/handler-parser.d.ts.map +1 -1
  262. package/dist/scan/handler-parser.js +28 -85
  263. package/dist/scan/handler-parser.js.map +1 -1
  264. package/dist/scan/result.d.ts +28 -0
  265. package/dist/scan/result.d.ts.map +1 -0
  266. package/dist/scan/result.js +2 -0
  267. package/dist/scan/result.js.map +1 -0
  268. package/dist/scan/scanner.d.ts +3 -28
  269. package/dist/scan/scanner.d.ts.map +1 -1
  270. package/dist/scan/scanner.js +36 -135
  271. package/dist/scan/scanner.js.map +1 -1
  272. package/dist/scan/statement.d.ts +1 -1
  273. package/dist/scan/statement.d.ts.map +1 -1
  274. package/dist/scan/statement.js +4 -30
  275. package/dist/scan/statement.js.map +1 -1
  276. package/dist/source.d.ts +41 -0
  277. package/dist/source.d.ts.map +1 -0
  278. package/dist/source.js +10 -0
  279. package/dist/source.js.map +1 -0
  280. package/dist/storage.d.ts +92 -0
  281. package/dist/storage.d.ts.map +1 -0
  282. package/dist/storage.js +50 -0
  283. package/dist/storage.js.map +1 -0
  284. package/dist/store.d.ts +18 -0
  285. package/dist/store.d.ts.map +1 -0
  286. package/dist/store.js +146 -0
  287. package/dist/store.js.map +1 -0
  288. package/dist/verify.d.ts +6 -39
  289. package/dist/verify.d.ts.map +1 -1
  290. package/dist/verify.js +19 -39
  291. package/dist/verify.js.map +1 -1
  292. package/dist/wire/CallLog.d.ts +32 -0
  293. package/dist/wire/CallLog.d.ts.map +1 -0
  294. package/dist/{contract → wire}/CallLog.js.map +1 -1
  295. package/dist/wire/Invocation.d.ts +32 -0
  296. package/dist/wire/Invocation.d.ts.map +1 -0
  297. package/dist/wire/Invocation.js +66 -0
  298. package/dist/wire/Invocation.js.map +1 -0
  299. package/dist/wire/RouteAddress.d.ts +24 -0
  300. package/dist/wire/RouteAddress.d.ts.map +1 -0
  301. package/dist/{contract → wire}/RouteAddress.js +7 -0
  302. package/dist/wire/RouteAddress.js.map +1 -0
  303. package/dist/wire/binding.d.ts +36 -0
  304. package/dist/wire/binding.d.ts.map +1 -0
  305. package/dist/{boot → wire}/binding.js +5 -62
  306. package/dist/wire/binding.js.map +1 -0
  307. package/dist/wire/call.d.ts +25 -172
  308. package/dist/wire/call.d.ts.map +1 -1
  309. package/dist/wire/call.js +15 -166
  310. package/dist/wire/call.js.map +1 -1
  311. package/dist/wire/drift.d.ts +3 -28
  312. package/dist/wire/drift.d.ts.map +1 -1
  313. package/dist/wire/drift.js +4 -23
  314. package/dist/wire/drift.js.map +1 -1
  315. package/dist/wire/errors.d.ts +4 -24
  316. package/dist/wire/errors.d.ts.map +1 -1
  317. package/dist/wire/errors.js +4 -24
  318. package/dist/wire/errors.js.map +1 -1
  319. package/dist/wire/http-error.d.ts +2 -13
  320. package/dist/wire/http-error.d.ts.map +1 -1
  321. package/dist/wire/http-error.js +5 -19
  322. package/dist/wire/http-error.js.map +1 -1
  323. package/dist/wire/loggerMiddleware.d.ts +2 -8
  324. package/dist/wire/loggerMiddleware.d.ts.map +1 -1
  325. package/dist/wire/loggerMiddleware.js +1 -7
  326. package/dist/wire/loggerMiddleware.js.map +1 -1
  327. package/dist/wire/middleware.d.ts +3 -7
  328. package/dist/wire/middleware.d.ts.map +1 -1
  329. package/dist/wire/middleware.js +1 -5
  330. package/dist/wire/middleware.js.map +1 -1
  331. package/dist/wire/operation.d.ts +12 -74
  332. package/dist/wire/operation.d.ts.map +1 -1
  333. package/dist/wire/operation.js +4 -66
  334. package/dist/wire/operation.js.map +1 -1
  335. package/dist/wire/signature.d.ts +37 -0
  336. package/dist/wire/signature.d.ts.map +1 -0
  337. package/dist/wire/signature.js +2 -0
  338. package/dist/wire/signature.js.map +1 -0
  339. package/package.json +3 -3
  340. package/src/boot/Emissions.ts +22 -119
  341. package/src/boot/ambient-port.ts +3 -24
  342. package/src/boot/ambient.als.ts +7 -12
  343. package/src/boot/ambient.queue.ts +2 -5
  344. package/src/boot/apply.ts +3 -15
  345. package/src/boot/auth.ts +6 -16
  346. package/src/boot/boot.ts +8 -23
  347. package/src/boot/bootstrap.ts +117 -173
  348. package/src/boot/card.ts +84 -0
  349. package/src/boot/frame.ts +31 -65
  350. package/src/boot/hosted.ts +15 -40
  351. package/src/boot/ownership.ts +14 -49
  352. package/src/boot/ports.ts +2 -15
  353. package/src/boot/remote.ts +11 -58
  354. package/src/boot/runner.ts +17 -0
  355. package/src/boot/seed.ts +11 -42
  356. package/src/boot/statement-drift.ts +10 -28
  357. package/src/boot/together.ts +38 -72
  358. package/src/boot/types.ts +36 -180
  359. package/src/{builtins → builtin}/config.ts +1 -7
  360. package/src/{builtins → builtin}/logger.ts +6 -39
  361. package/src/config-loader.ts +12 -71
  362. package/src/contract.ts +15 -39
  363. package/src/crypto/encoding.ts +2 -15
  364. package/src/crypto/node.ts +1 -7
  365. package/src/crypto/port.ts +2 -18
  366. package/src/crypto/webcrypto.ts +1 -12
  367. package/src/{scan/declare.ts → declare.ts} +11 -42
  368. package/src/define.ts +2 -3
  369. package/src/descriptor/Fronds.ts +47 -0
  370. package/src/descriptor/frond.ts +145 -0
  371. package/src/dispatch/ArgumentResolver.ts +54 -8
  372. package/src/dispatch/DispatchEvent.ts +2 -2
  373. package/src/dispatch/DispatchLifecycle.ts +1 -7
  374. package/src/dispatch/DispatchPort.ts +1 -1
  375. package/src/dispatch/Dispatcher.ts +3 -3
  376. package/src/dispatch/HandlerFacade.ts +231 -0
  377. package/src/dispatch/LocalRoutePolicy.ts +4 -4
  378. package/src/dispatch/OperationRoute.ts +2 -2
  379. package/src/dispatch/OutputView.ts +24 -2
  380. package/src/dispatch/Route.ts +2 -4
  381. package/src/dispatch/RoutePolicy.ts +1 -1
  382. package/src/dispatch/RouteRegistry.ts +2 -2
  383. package/src/dispatch/RouteResolver.ts +2 -4
  384. package/src/dispatch/StorageGuard.ts +75 -23
  385. package/src/dispatch/presenterArguments.ts +25 -0
  386. package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
  387. package/src/dispatch/routeNotFound.ts +33 -0
  388. package/src/dispatch/validateInput.ts +28 -0
  389. package/src/effective-operation.ts +60 -37
  390. package/src/emit.ts +5 -63
  391. package/src/entry/facade.ts +44 -0
  392. package/src/entry/transport.ts +16 -0
  393. package/src/frond-config.ts +8 -71
  394. package/src/graph.ts +1 -1
  395. package/src/identity-keys.ts +3 -16
  396. package/src/identity.ts +12 -80
  397. package/src/imports.ts +3 -32
  398. package/src/index.ts +28 -33
  399. package/src/loader.ts +2 -16
  400. package/src/node.ts +2 -11
  401. package/src/prefab/collector.ts +1 -22
  402. package/src/prefab/crud.ts +51 -90
  403. package/src/prefab/mirror.ts +9 -49
  404. package/src/prefab/prefab.ts +2 -21
  405. package/src/prefab/presenter.ts +2 -36
  406. package/src/prefab/repository.ts +32 -108
  407. package/src/scan/adapters.ts +32 -0
  408. package/src/scan/bundling.ts +1 -12
  409. package/src/scan/conventions.ts +6 -40
  410. package/src/scan/emit.ts +7 -43
  411. package/src/scan/handler-parser.ts +41 -163
  412. package/src/scan/result.ts +29 -0
  413. package/src/scan/scanner.ts +40 -138
  414. package/src/scan/statement.ts +6 -31
  415. package/src/source.ts +44 -0
  416. package/src/storage.ts +141 -0
  417. package/src/store.ts +152 -0
  418. package/src/verify.ts +19 -60
  419. package/src/wire/CallLog.ts +30 -0
  420. package/src/{contract → wire}/Invocation.ts +24 -17
  421. package/src/{contract → wire}/RouteAddress.ts +10 -0
  422. package/src/wire/binding.ts +102 -0
  423. package/src/wire/call.ts +30 -261
  424. package/src/wire/drift.ts +5 -30
  425. package/src/wire/errors.ts +4 -24
  426. package/src/wire/http-error.ts +5 -19
  427. package/src/wire/loggerMiddleware.ts +2 -8
  428. package/src/wire/middleware.ts +3 -7
  429. package/src/wire/operation.ts +13 -110
  430. package/src/wire/signature.ts +38 -0
  431. package/dist/boot/HandlerFacade.d.ts.map +0 -1
  432. package/dist/boot/HandlerFacade.js.map +0 -1
  433. package/dist/boot/binding.d.ts +0 -60
  434. package/dist/boot/binding.d.ts.map +0 -1
  435. package/dist/boot/binding.js.map +0 -1
  436. package/dist/builtins/config.d.ts +0 -13
  437. package/dist/builtins/config.d.ts.map +0 -1
  438. package/dist/builtins/config.js +0 -21
  439. package/dist/builtins/config.js.map +0 -1
  440. package/dist/builtins/logger.d.ts.map +0 -1
  441. package/dist/builtins/logger.js.map +0 -1
  442. package/dist/contract/Call.d.ts +0 -10
  443. package/dist/contract/Call.d.ts.map +0 -1
  444. package/dist/contract/Call.js +0 -15
  445. package/dist/contract/Call.js.map +0 -1
  446. package/dist/contract/CallLog.d.ts +0 -57
  447. package/dist/contract/CallLog.d.ts.map +0 -1
  448. package/dist/contract/Invocation.d.ts +0 -27
  449. package/dist/contract/Invocation.d.ts.map +0 -1
  450. package/dist/contract/Invocation.js +0 -59
  451. package/dist/contract/Invocation.js.map +0 -1
  452. package/dist/contract/RouteAddress.d.ts +0 -17
  453. package/dist/contract/RouteAddress.d.ts.map +0 -1
  454. package/dist/contract/RouteAddress.js.map +0 -1
  455. package/dist/dispatch/InputValidator.d.ts +0 -7
  456. package/dist/dispatch/InputValidator.d.ts.map +0 -1
  457. package/dist/dispatch/InputValidator.js +0 -22
  458. package/dist/dispatch/InputValidator.js.map +0 -1
  459. package/dist/dispatch/OperationExecutor.d.ts +0 -25
  460. package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
  461. package/dist/dispatch/OperationExecutor.js +0 -32
  462. package/dist/dispatch/OperationExecutor.js.map +0 -1
  463. package/dist/dispatch/OutputProjector.d.ts +0 -12
  464. package/dist/dispatch/OutputProjector.d.ts.map +0 -1
  465. package/dist/dispatch/OutputProjector.js +0 -30
  466. package/dist/dispatch/OutputProjector.js.map +0 -1
  467. package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
  468. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
  469. package/dist/dispatch/PresenterArgumentResolver.js +0 -20
  470. package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
  471. package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
  472. package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
  473. package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
  474. package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
  475. package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
  476. package/dist/dispatch/RouteNotFoundError.js +0 -24
  477. package/dist/dispatch/RouteNotFoundError.js.map +0 -1
  478. package/dist/entry/DynamicFacade.d.ts +0 -10
  479. package/dist/entry/DynamicFacade.d.ts.map +0 -1
  480. package/dist/entry/DynamicFacade.js +0 -27
  481. package/dist/entry/DynamicFacade.js.map +0 -1
  482. package/dist/entry/FacadeEntry.d.ts +0 -11
  483. package/dist/entry/FacadeEntry.d.ts.map +0 -1
  484. package/dist/entry/FacadeEntry.js +0 -26
  485. package/dist/entry/FacadeEntry.js.map +0 -1
  486. package/dist/entry/TransportEntry.d.ts +0 -13
  487. package/dist/entry/TransportEntry.d.ts.map +0 -1
  488. package/dist/entry/TransportEntry.js +0 -24
  489. package/dist/entry/TransportEntry.js.map +0 -1
  490. package/dist/orm.d.ts +0 -207
  491. package/dist/orm.d.ts.map +0 -1
  492. package/dist/orm.js +0 -66
  493. package/dist/orm.js.map +0 -1
  494. package/dist/scan/Fronds.d.ts +0 -45
  495. package/dist/scan/Fronds.d.ts.map +0 -1
  496. package/dist/scan/Fronds.js +0 -66
  497. package/dist/scan/Fronds.js.map +0 -1
  498. package/dist/scan/declare.d.ts +0 -71
  499. package/dist/scan/declare.d.ts.map +0 -1
  500. package/dist/scan/declare.js.map +0 -1
  501. package/dist/scan/frond.d.ts +0 -224
  502. package/dist/scan/frond.d.ts.map +0 -1
  503. package/src/boot/HandlerFacade.ts +0 -242
  504. package/src/boot/binding.ts +0 -182
  505. package/src/contract/Call.ts +0 -18
  506. package/src/contract/CallLog.ts +0 -55
  507. package/src/dispatch/InputValidator.ts +0 -28
  508. package/src/dispatch/OperationExecutor.ts +0 -60
  509. package/src/dispatch/OutputProjector.ts +0 -32
  510. package/src/dispatch/PresenterArgumentResolver.ts +0 -25
  511. package/src/dispatch/RouteNotFoundError.ts +0 -29
  512. package/src/entry/DynamicFacade.ts +0 -28
  513. package/src/entry/FacadeEntry.ts +0 -32
  514. package/src/entry/TransportEntry.ts +0 -30
  515. package/src/orm.ts +0 -252
  516. package/src/scan/Fronds.ts +0 -73
  517. package/src/scan/frond.ts +0 -235
  518. /package/dist/{scan → descriptor}/frond.js +0 -0
  519. /package/dist/{contract → wire}/CallLog.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/boot/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,0FAA0F;IAC1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AAC;IACZ,gFAAgF;IAChF,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,4DAA4D;IAC5D,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -19,24 +19,16 @@ interface BootOptions {
19
19
  remotes?: Record<string, string>;
20
20
  /** Builds the transport to reach `remotes`. Supplied by a layer-2 package. */
21
21
  remoteTransport?: (url: string) => Transport;
22
- /**
23
- * Carries an announced fact out of this process. Forwarded rather than dropped: a
24
- * caller handing one in has no other way to reach the emitter, and this path silently
25
- * kept it to itself.
26
- */
22
+ /** Carries an announced fact out of this process. */
27
23
  onEmit?: CreateAppOptions['onEmit'];
28
24
  /**
29
- * ORM setup — returns the storage handle (db), an ormFactory, and its two halves.
25
+ * storage setup — returns the storage handle (db), an storageFactory, and its two halves.
30
26
  * The `db` value is forwarded to the auth provider via AuthContext when `auth` is set.
31
27
  */
32
28
  db?: (config: FougereConfig) => {
33
29
  db?: unknown;
34
- ormFactory: CreateAppOptions['ormFactory'];
35
- /**
36
- * Bring the schema up to date — an extension's `up`, because it runs after the
37
- * container. It used to be called `afterBoot`, a word that also meant the host's
38
- * post-boot and was read in four places under two senses.
39
- */
30
+ storageFactory: CreateAppOptions['storageFactory'];
31
+ /** Bring the schema up to date — an extension's `up`, because it runs after the container. */
40
32
  migrate?: (app: App) => Promise<void> | void;
41
33
  /** Closes what the factory opened — `boot()` called it, so `boot()` releases it. */
42
34
  close?: () => Promise<void>;
@@ -47,12 +39,7 @@ interface BootOptions {
47
39
  */
48
40
  extensions?: readonly (Extension | undefined)[];
49
41
  }
50
- /**
51
- * Boot a Fougere app from fougere.config.ts.
52
- *
53
- * Handles: config loading, container creation, DB setup, seeding.
54
- * Works for any surface (Nuxt, GraphQL standalone, CLI, tests).
55
- */
42
+ /** Boot a Fougere app from fougere.config.ts. */
56
43
  export declare function boot(options: BootOptions): Promise<App>;
57
44
  export {};
58
45
  //# sourceMappingURL=boot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/boot/boot.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,UAAU,WAAW;IACnB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,mCAAmC;IACnC,eAAe,EAAE,MAAM,SAAS,CAAC;IACjC,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC;;;OAGG;IACH,EAAE,CAAC,EAAE,CAAC,MA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,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;IAC7C,qDAAqD;IACrD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC;;;OAGG;IACH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK;QAC9B,EAAE,CAAC,EAAE,OAAO,CAAC;QACb,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QACnD,8FAA8F;QAC9F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7C,oFAAoF;QACpF,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7B,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;CACjD;AAED,iDAAiD;AACjD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CA4D7D"}
package/dist/boot/boot.js CHANGED
@@ -2,15 +2,10 @@ import { createApp } from './bootstrap.js';
2
2
  import { seeding } from './seed.js';
3
3
  import { scanProject } from '../scan/scanner.js';
4
4
  import { loadConfig } from '../config-loader.js';
5
- import { Logger } from '../builtins/logger.js';
5
+ import { Logger } from '../builtin/logger.js';
6
6
  import { applyConfig } from './apply.js';
7
7
  import { migrating } from './AppLifecycle.js';
8
- /**
9
- * Boot a Fougere app from fougere.config.ts.
10
- *
11
- * Handles: config loading, container creation, DB setup, seeding.
12
- * Works for any surface (Nuxt, GraphQL standalone, CLI, tests).
13
- */
8
+ /** Boot a Fougere app from fougere.config.ts. */
14
9
  export async function boot(options) {
15
10
  const bootStart = performance.now();
16
11
  const log = new Logger('boot');
@@ -35,7 +30,7 @@ export async function boot(options) {
35
30
  // handed the answer and reaches for nothing.
36
31
  scan: await scanProject(root, options.fronds, config.conventions),
37
32
  createContainer: options.createContainer,
38
- ormFactory: dbSetup?.ormFactory,
33
+ storageFactory: dbSetup?.storageFactory,
39
34
  db: dbSetup?.db,
40
35
  auth: config.auth,
41
36
  remotes: options.remotes,
@@ -50,9 +45,7 @@ export async function boot(options) {
50
45
  // it was opened before the container existed, so it closes after the container goes.
51
46
  onDispose: dbSetup?.close,
52
47
  /**
53
- * The whole ascent, in one ordered list — tables, then rows, then whatever the host
54
- * takes on. It was four call sites under the name `afterBoot`, two of which meant
55
- * different things and one of which was generated into a Nitro plugin.
48
+ * The whole ascent, in one ordered list — tables, then rows, then whatever the host takes on.
56
49
  */
57
50
  extensions: [
58
51
  migrating(dbSetup?.migrate),
@@ -1 +1 @@
1
- {"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/boot/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAiD9D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAoB;IAC7C,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAE1B,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5B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,EAAE,KAAK;QACzB;;WAEG;QACH,UAAU,EAAE;YACV,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;YAC3B,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACxC,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;SAC9B;QACD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;IAE1E,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/boot/bootstrap.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAyFxD,uCAAuC;AACvC,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CA+uBvE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/boot/bootstrap.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAsExD,uCAAuC;AACvC,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CA0sBvE"}
@@ -1,64 +1,45 @@
1
1
  import { lowerFirst } from '@fougere/schema';
2
2
  import { hostedBy } from './hosted.js';
3
- import { Logger } from '../builtins/logger.js';
4
- import { Config } from '../builtins/config.js';
3
+ import { Logger } from '../builtin/logger.js';
4
+ import { Config } from '../builtin/config.js';
5
5
  import { createRemoteRouter, createRemoteFacade } from './remote.js';
6
6
  import { registerFrames } from './together.js';
7
7
  import { Emissions } from './Emissions.js';
8
- import { HandlerFacade } from './HandlerFacade.js';
8
+ import { HandlerFacade } from '../dispatch/HandlerFacade.js';
9
9
  import { targetOf } from '../prefab/prefab.js';
10
- import { ownersOf, refuseOrmInUserCode, refuseCrudOnOwned } from './ownership.js';
10
+ import { ownersOf, refuseStorageInUserCode, refuseCrudOnOwned } from './ownership.js';
11
11
  import { resolveEffectiveOperations, } from '../effective-operation.js';
12
12
  import { StorageGuard } from '../dispatch/StorageGuard.js';
13
13
  import { portBindings } from './ports.js';
14
14
  import { InFlight } from '../dispatch/InFlight.js';
15
15
  // The keys, each read from where its concept is declared — never respelled here.
16
- import { facadeKeyOf, contractsKeyOf, identityCardOf } from '../wire/call.js';
16
+ import { facadeKeyOf, contractsKeyOf } from '../wire/call.js';
17
+ import { identityCardOf } from './card.js';
17
18
  import { AppLifecycle } from './AppLifecycle.js';
19
+ import { inheritsCrud, subjectOf } from '../prefab/crud.js';
18
20
  import { repositoryKeyOf } from '../prefab/repository.js';
19
- import { ormKeyOf } from '../orm.js';
21
+ import { storageKeyOf } from '../storage.js';
20
22
  import { presenterKeyOf } from '../prefab/presenter.js';
21
23
  import { collectorKeyOf } from '../prefab/collector.js';
22
- import { RouteAddress } from '../contract/RouteAddress.js';
24
+ import { RouteAddress } from '../wire/RouteAddress.js';
23
25
  import { DispatchLifecycle } from '../dispatch/DispatchLifecycle.js';
24
26
  import { Dispatcher } from '../dispatch/Dispatcher.js';
25
27
  import { LocalRoutePolicy } from '../dispatch/LocalRoutePolicy.js';
26
28
  import { OperationRoute } from '../dispatch/OperationRoute.js';
27
- import { RemoteRouteResolver } from '../dispatch/RemoteRouteResolver.js';
29
+ import { remoteRoutes } from '../dispatch/remoteRoutes.js';
28
30
  import { RouteRegistry } from '../dispatch/RouteRegistry.js';
29
- import { FacadeEntry } from '../entry/FacadeEntry.js';
30
- /**
31
- * The one wording for "nobody hosts this here", with both ways out. Said twice, and the
32
- * second copy (`schemaFor`) had lost the two remedies — the same dead end, strictly less
33
- * useful, for no reason.
34
- */
31
+ import { facadeOperations } from '../entry/facade.js';
32
+ /** The one wording for "nobody hosts this here", with both ways out. */
35
33
  const notLoaded = (entity) => `Frond for '${entity}' is not loaded.\n` +
36
34
  ` - Add '${entity}' to --fronds flag\n` +
37
35
  ` - Or declare a remote: remotes: { ${entity}: 'http://...' }`;
38
- /**
39
- * Two fronds cannot claim one name — said at boot, because nothing else says it.
40
- *
41
- * A door lands on the ROOT container under `facadeKeyOf(address)`, and that key carries
42
- * no frond; a presenter lands there too. `registerValue` is a `Map.set`, so the second
43
- * frond loaded simply replaced the first and every call meant for one went to the other.
44
- * Silent in-process, and worse than silent under a split: `createRemoteRouter` guards its
45
- * index with `if (!byEntity.has(...))`, so THERE the first frond discovered wins. The same
46
- * application answered differently depending on how it was deployed.
47
- *
48
- * Refusing is the honest answer while a key cannot say which frond owns it. It is not the
49
- * last word: qualify the key and this boot can accept both. ORMs and repositories are not
50
- * checked because they are registered in the frond's own scope, where two fronds do not meet.
51
- *
52
- * A frond declared remote registers nothing locally, so it cannot collide here. Two REMOTE
53
- * fronds publishing one entity still shadow each other inside the router — a hole this
54
- * check does not reach.
55
- */
36
+ /** Two fronds cannot claim one name — said at boot, because nothing else says it. */
56
37
  function assertOneOwnerPerKey(fronds, remotes) {
57
38
  const owner = new Map();
58
39
  const claim = (key, frond, what) => {
59
- const held = owner.get(key);
60
- if (held !== undefined && held !== frond) {
61
- throw new Error(`Two fronds claim the key '${key}': '${held}' and '${frond}'.\n`
40
+ const first = owner.get(key);
41
+ if (first !== undefined && first !== frond) {
42
+ throw new Error(`Two fronds claim the key '${key}': '${first}' and '${frond}'.\n`
62
43
  + ` A ${what} is registered under a key that names no frond, so one would silently replace the other.\n`
63
44
  + ` - Rename one of the two classes, or\n`
64
45
  + ` - keep one of the two fronds out of this process (--fronds), or declare it in remotes:`);
@@ -92,6 +73,14 @@ export async function createApp(options) {
92
73
  // no builtin and a Worker can run what it builds.
93
74
  const scanStart = performance.now();
94
75
  const { fronds, diagnostics } = await hostedBy(options);
76
+ // An app that states nothing AND scans nothing is a mistake — unless something else it
77
+ // declares brings its own entities, which an auth provider does. Refused here and not in
78
+ // `hostedBy`, which is handed the frond sources and cannot see the rest of the app. The
79
+ // condition is the KEYS, not the count: a scan that found nothing is an ordinary answer.
80
+ if (!options.fronds && !options.scan && !options.auth) {
81
+ throw new Error('createApp needs `fronds:` (what this app states) or `scan:` (what a scanner found). '
82
+ + 'Neither was given, and nothing else declares entities of its own.');
83
+ }
95
84
  const operationModel = resolveEffectiveOperations(fronds, {
96
85
  diagnostics,
97
86
  remotes: options.remotes,
@@ -101,24 +90,13 @@ export async function createApp(options) {
101
90
  const blocking = diagnostics.filter((d) => d.severity === 'blocking');
102
91
  log.info(`read ${fronds.length} frond(s) in ${scanMs}ms`
103
92
  + (diagnostics.length ? ` — ${diagnostics.length} thing(s) the scan could not do` : ''));
104
- /**
105
- * Say what could not be read, at the one line everyone already watches.
106
- *
107
- * Not a refusal: an app whose `presenters/` is unreadable still serves its
108
- * entities, and stopping the boot would trade a partial app for none. But it is
109
- * an ERROR, not a debug line — the app now serves less than its source declares,
110
- * and nothing downstream can tell that from a source that declares less.
111
- */
93
+ /** Say what could not be read, at the one line everyone already watches. */
112
94
  for (const d of blocking)
113
95
  log.error(`[${d.code}] ${d.message}`, d.cause);
114
96
  for (const d of diagnostics)
115
97
  if (d.severity === 'warning')
116
98
  log.warn(`[${d.code}] ${d.message}`);
117
- /**
118
- * An ambiguous convention is not a partial scan. Every relevant declaration was read,
119
- * but more than one executable contract can be built from it. Refuse before auth,
120
- * storage, migrations or seeds make the boot observable.
121
- */
99
+ /** An ambiguous convention is not a partial scan. */
122
100
  const invalidOperations = operationModel.resolutionDiagnostics
123
101
  .filter((diagnostic) => diagnostic.severity === 'blocking');
124
102
  if (invalidOperations.length > 0) {
@@ -128,11 +106,11 @@ export async function createApp(options) {
128
106
  }
129
107
  // Auth runtime — built once from the lazy AuthConfig produced by a provider factory
130
108
  // (e.g. betterAuth({...})) in fougere.config.ts. The provider receives our db +
131
- // ormFactory so all auth writes flow through EntityOrm.
109
+ // storageFactory so all auth writes flow through Storage.
132
110
  let authRuntime;
133
111
  if (options.auth) {
134
- if (!options.ormFactory) {
135
- throw new Error('createApp: `auth` is set but `ormFactory` is missing — auth providers need it to back their adapter.');
112
+ if (!options.storageFactory) {
113
+ throw new Error('createApp: `auth` is set but `storageFactory` is missing — auth providers need it to back their adapter.');
136
114
  }
137
115
  if (options.db === undefined) {
138
116
  throw new Error('createApp: `auth` is set but `db` is missing — pass the storage handle through CreateAppOptions.db.');
@@ -140,11 +118,11 @@ export async function createApp(options) {
140
118
  log.info('initializing auth runtime');
141
119
  authRuntime = await options.auth.create({
142
120
  db: options.db,
143
- ormFactory: options.ormFactory,
121
+ storageFactory: options.storageFactory,
144
122
  });
145
123
  log.info(`auth ready — mounted at ${authRuntime.basePath}`);
146
124
  }
147
- // Remote routing — judged at boot: declaring remotes without a transport is a config error.
125
+ // Remote routing — validated at boot: declaring remotes without a transport is a config error.
148
126
  // A remote declaration wins over local presence: `remotes: { blog: url }` IS
149
127
  // the topology statement — the frond's code may sit in fronds/**, it runs elsewhere.
150
128
  const declaredRemotes = Object.entries(options.remotes ?? {});
@@ -171,7 +149,7 @@ export async function createApp(options) {
171
149
  return [...globalMiddlewares, ...scoped];
172
150
  }
173
151
  assertOneOwnerPerKey(fronds, options.remotes);
174
- // Every entity of every frond, by name — so a fact can be judged where it LANDS, and
152
+ // Every entity of every frond, by name — so a fact can be validated where it LANDS, and
175
153
  // so a `reads:` clause can name a neighbour's.
176
154
  const entityByName = fronds.schemas();
177
155
  // Which frond holds an entity — what turns "a member is remote" into a refusal that
@@ -204,13 +182,13 @@ export async function createApp(options) {
204
182
  // `reads:` is what makes a cross-source reader exist here, and the list IS its
205
183
  // environment — a source holding none of these is never opened. Registered under
206
184
  // the type's own name, which is the key `depKeyOf` already derives for a plain
207
- // parameter: `constructor(private sources: Sources)` and nothing else to say.
185
+ // parameter: `constructor(private reads: Reads)` and nothing else to say.
208
186
  // Declaring `reads:` with nothing to build the reader is a boot that ignores a
209
- // clause: the handler asking for `Sources` then dies at its first call, on a
187
+ // clause: the handler asking for `Reads` then dies at its first call, on a
210
188
  // container message that names neither the clause nor what is missing.
211
189
  if (frond.reads?.length && !options.sourcesFactory) {
212
190
  frondLog.warn(`[reads] ${frond.reads.join(', ')} — declared in frond.config.ts, but this boot passes no `
213
- + '`sourcesFactory`, so no reader is registered and a handler asking for `Sources` will fail '
191
+ + '`sourcesFactory`, so no reader is registered and a handler asking for `Reads` will fail '
214
192
  + 'at its first call. Pass one (`@fougere/adapter-duckdb`), or drop the clause.');
215
193
  }
216
194
  if (frond.reads?.length && options.sourcesFactory) {
@@ -226,13 +204,13 @@ export async function createApp(options) {
226
204
  frondLog.warn(`[reads] ${missing.join(', ')} — named in frond.config.ts but scanned nowhere in this app, `
227
205
  + 'so a query naming one would find no table. Check the spelling, or the entity file.');
228
206
  }
229
- scope.registerValue('Sources', await options.sourcesFactory(named, frond.name));
207
+ scope.registerValue('Reads', await options.sourcesFactory(named, frond.name));
230
208
  frondLog.debug(`cross-source reader over ${named.length} entit(ies)`);
231
209
  }
232
210
  // Who owns what, and the rule that makes owning mean something. Before anything is
233
211
  // registered, so a bad line is named by this refusal rather than by the container's.
234
212
  const owners = ownersOf(frond.providers);
235
- refuseOrmInUserCode(frond, owners);
213
+ refuseStorageInUserCode(frond, owners, (entity) => entityByName.has(entity));
236
214
  refuseCrudOnOwned(frond, owners);
237
215
  for (const provider of frond.providers) {
238
216
  scope.register(provider.ctor.name, provider.ctor, { deps: provider.deps });
@@ -249,25 +227,25 @@ export async function createApp(options) {
249
227
  if (frond.providers.length > 0) {
250
228
  frondLog.debug(`${frond.providers.length} provider(s): ${frond.providers.map((p) => p.ctor.name).join(', ')}`);
251
229
  }
252
- // Register EntityOrm for each entity — PascalCase type name (e.g. 'PostOrm')
253
- // When a handler declares Crud(Entity, Output), scope the ORM via .output(Output)
254
- if (options.ormFactory) {
230
+ // Register Storage for each entity — PascalCase type name (e.g. 'PostStorage')
231
+ // When a handler declares Crud(Entity, Output), scope the storage via .output(Output)
232
+ if (options.storageFactory) {
255
233
  for (const entity of frond.entities) {
256
- const ormName = ormKeyOf(entity.name);
257
- const baseOrm = options.ormFactory(entity.entityClass, entity.name);
234
+ const key = storageKeyOf(entity.name);
235
+ const baseStorage = options.storageFactory(entity.entityClass, entity.name);
258
236
  // Check if the default handler (no surface) declares an output override
259
237
  const defaultHandler = frond.handlers.find((h) => h.address === entity.name && !h.surface);
260
238
  const outputSchema = defaultHandler?.outputOverride ?? defaultHandler?.ctor?.__output;
261
239
  const scoped = outputSchema && outputSchema !== entity.entityClass
262
- ? baseOrm.output(outputSchema)
263
- : baseOrm;
240
+ ? baseStorage.output(outputSchema)
241
+ : baseStorage;
264
242
  // Storage is a way out like the client surface — see `StorageGuard`.
265
243
  const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name).guard(scoped);
266
- scope.registerValue(ormName, guarded);
244
+ scope.registerValue(key, guarded);
267
245
  // The default repository IS the guarded port — it already answers every gesture a
268
246
  // declared one forwards, so the two forms have the same shape and a handler reads
269
- // `repo.list()` either way. The wrapper that used to sit here (`{ orm: guarded }`)
270
- // existed to make `repo.orm` true in both, back when `.orm` was the way in.
247
+ // `repo.list()` either way. The wrapper that used to sit here (`{ storage: guarded }`)
248
+ // existed to make `repo.storage` true in both, back when `.storage` was the way in.
271
249
  //
272
250
  // Not registered for an OWNED entity: an aggregate's members are reached through it
273
251
  // and nowhere else, and the default would be a second door under a name a handler
@@ -283,7 +261,7 @@ export async function createApp(options) {
283
261
  }
284
262
  }
285
263
  if (frond.entities.length > 0) {
286
- frondLog.debug(`${frond.entities.length} entity ORM(s): ${frond.entities.map((e) => e.name).join(', ')}`);
264
+ frondLog.debug(`${frond.entities.length} entity storage(s): ${frond.entities.map((e) => e.name).join(', ')}`);
287
265
  }
288
266
  }
289
267
  // Frames, after the ORMs and before anything that may ask for one. A frame is read
@@ -293,8 +271,9 @@ export async function createApp(options) {
293
271
  entityByName,
294
272
  frondOf,
295
273
  hostedHere: (name) => !(options.remotes && name in options.remotes),
296
- ormFactory: options.ormFactory,
274
+ storageFactory: options.storageFactory,
297
275
  sourceOf: options.sourceOf,
276
+ transacts: options.transacts,
298
277
  transacted: options.transacted,
299
278
  log: frondLog,
300
279
  });
@@ -321,22 +300,24 @@ export async function createApp(options) {
321
300
  const defaultHandlerMap = new Map(defaultHandlers.map((h) => [h.address, h]));
322
301
  /** Build the door of a handler and register it under the audience it serves. */
323
302
  const buildFacade = (entity, handler, targetScope, facadeKey) => {
324
- const facade = new HandlerFacade({
325
- handler,
326
- handlers: frond.handlers,
327
- entity,
328
- scope: targetScope,
303
+ if (inheritsCrud(handler.ctor) && !entity) {
304
+ // An installed Crud subject may be absent from the local scan.
305
+ frondLog.debug(`${handler.ctor.name} extends Crud() and no scanned entity is named `
306
+ + `'${subjectOf(handler.ctor, handler.address)}' — installed entity, or a missing `
307
+ + `one: no storage will be injected`);
308
+ }
309
+ const facade = new HandlerFacade(handler, targetScope, {
329
310
  key: facadeKey,
330
- operations: operationModel.forHandler(handler),
331
- }, {
332
311
  frond: frond.name,
333
- frondScope: scope,
334
- log: frondLog,
312
+ handlers: frond.handlers,
313
+ operations: operationModel.forHandler(handler),
335
314
  collectors: collectorTypeNames,
336
- presenters: presenterMap,
337
- middlewaresFor: getMiddlewares,
338
- emissions,
315
+ presenter: presenterMap.get(handler.address),
316
+ presenterScope: scope,
317
+ middlewares: () => getMiddlewares(handler.address),
339
318
  });
319
+ // Emissions use the same contracts and execution path as direct calls.
320
+ emissions.note(facade.contracts, facadeKey);
340
321
  // The terms alongside the door, under the same audience — a surface that serves
341
322
  // fewer ops describes fewer ops.
342
323
  container.registerValue(contractsKeyOf(handler.address, handler.surface), facade.contracts);
@@ -357,11 +338,11 @@ export async function createApp(options) {
357
338
  operation,
358
339
  ...(surface !== undefined ? { surface } : {}),
359
340
  });
360
- routeRegistry.register(new OperationRoute('local', address, (call) => facade.ops[operation](call.invocation)));
341
+ routeRegistry.register(new OperationRoute('local', address, (call) => facade.execute(operation, call.invocation)));
361
342
  }
362
343
  }
363
- const entry = new FacadeEntry(handler.surface ? localDispatcher : dispatcher, handler.address, routeRegistry.operationNames(handler.address, handler.surface), handler.surface);
364
- container.registerValue(facadeKey, entry.operations);
344
+ const operations = facadeOperations(handler.surface ? localDispatcher : dispatcher, handler.address, routeRegistry.operationNames(handler.address, handler.surface), handler.surface);
345
+ container.registerValue(facadeKey, operations);
365
346
  };
366
347
  // A presenter is about an entity — computed fields sit on a shape — so this walks
367
348
  // entities. Exposing the instance lazily; the bridge resolves it on first access.
@@ -395,7 +376,7 @@ export async function createApp(options) {
395
376
  const facadeKey = facadeKeyOf(handler.address);
396
377
  buildFacade(entity, handler, scope, facadeKey);
397
378
  frondLog.debug(`${facadeKey} [${Object.keys(container.resolve(facadeKey)).join(', ')}]`
398
- + (entity ? '' : ' — no entity of that name: no ORM, no projection, no presenter'));
379
+ + (entity ? '' : ' — no entity of that name: no storage, no projection, no presenter'));
399
380
  }
400
381
  // The dual, and it stays: a shape that declares no operation answers nothing. Said
401
382
  // once per entity rather than deduced from a silence.
@@ -404,7 +385,7 @@ export async function createApp(options) {
404
385
  frondLog.debug(`${entity.name} — entity only, no handler: exposes nothing`);
405
386
  }
406
387
  }
407
- // Surface handlers — create sub-scope per surface handler with scoped ORM
388
+ // Surface handlers — create sub-scope per surface handler with scoped storage
408
389
  //
409
390
  // Pointing at nothing is legal HERE TOO. This loop used to `continue` when no entity
410
391
  // carried the handler's name, so `handlers/public/SearchHandler.ts` with no `Search`
@@ -413,24 +394,24 @@ export async function createApp(options) {
413
394
  for (const handler of surfaceHandlers) {
414
395
  const entity = frond.entities.find((e) => e.name === handler.address);
415
396
  const surfaceScope = scope.createScope();
416
- // Register scoped ORM if output override differs from entity — under the REPOSITORY
397
+ // Register scoped storage if output override differs from entity — under the REPOSITORY
417
398
  // key, which is what a Crud handler asks for, and under the port's own for a holder
418
399
  // that legitimately names it. Registering only the latter left a named surface with
419
400
  // no door at all once the façade stopped spelling the storage.
420
- if (entity && options.ormFactory) {
421
- const baseOrm = options.ormFactory(entity.entityClass, entity.name);
401
+ if (entity && options.storageFactory) {
402
+ const baseStorage = options.storageFactory(entity.entityClass, entity.name);
422
403
  const outputSchema = handler.outputOverride ?? handler.ctor.__output;
423
404
  const scoped = outputSchema && outputSchema !== entity.entityClass
424
- ? baseOrm.output(outputSchema)
425
- : baseOrm;
405
+ ? baseStorage.output(outputSchema)
406
+ : baseStorage;
426
407
  const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name).guard(scoped);
427
- surfaceScope.registerValue(ormKeyOf(entity.name), guarded);
408
+ surfaceScope.registerValue(storageKeyOf(entity.name), guarded);
428
409
  surfaceScope.registerValue(repositoryKeyOf(entity.name), guarded);
429
410
  }
430
411
  const facadeKey = facadeKeyOf(handler.address, handler.surface);
431
412
  buildFacade(entity, handler, surfaceScope, facadeKey);
432
413
  frondLog.debug(`${facadeKey} [${Object.keys(container.resolve(facadeKey)).join(', ')}]`
433
- + (entity ? '' : ' — no entity of that name: no ORM, no projection, no presenter'));
414
+ + (entity ? '' : ' — no entity of that name: no storage, no projection, no presenter'));
434
415
  }
435
416
  // A named surface is closed, so what it contains is a fact worth stating.
436
417
  // Saying it at boot is the difference between a rule and a rule you can
@@ -459,17 +440,7 @@ export async function createApp(options) {
459
440
  }
460
441
  // Once every door exists: what is announced here and what is listened to are both known.
461
442
  emissions.register();
462
- /**
463
- * The last resort, held by the container so every resolution path shares it.
464
- *
465
- * It used to live on `app.resolve` alone, which meant the runner found a remote façade
466
- * and dependency injection did not — a handler asking for a neighbour that had moved
467
- * got `is not registered` while the very same call over the wire worked. One door now.
468
- *
469
- * Surface-scoped keys ('admin:productHandler') stay local: a named surface resolves in
470
- * this container only, so fabricating one for a remote frond would answer NOT_FOUND on
471
- * everything (see Known issues).
472
- */
443
+ /** The last resort, held by the container so every resolution path shares it. */
473
444
  container.setFallback?.((name) => {
474
445
  if (!remoteRouter)
475
446
  return undefined;
@@ -479,15 +450,11 @@ export async function createApp(options) {
479
450
  // `lowerFirst` because a DEPENDENCY names the type as written — `ProductHandler`,
480
451
  // PascalCase — while a card declares `product`, so the raw strip asked the router for
481
452
  // 'Product' and every by-type dependency on a remote handler answered NOT_FOUND.
482
- return new FacadeEntry(dispatcher, lowerFirst(name.replace(/Handler$/, ''))).operations;
453
+ return facadeOperations(dispatcher, lowerFirst(name.replace(/Handler$/, '')));
483
454
  });
484
455
  /**
485
- * Everything this app holds, let go in reverse of how it was taken: what an extension
486
- * took on last, then the container's own, then whoever handed a resource in.
487
- *
488
- * It does NOT wait for running calls — `drain()` is that, and it is a separate gesture
489
- * because waiting and releasing do not have the same owner: a test releases at once, a
490
- * host turning the ring wants the work finished first.
456
+ * Everything this app holds, let go in reverse of how it was taken: what an extension took on
457
+ * last, then the container's own, then whoever handed a resource in.
491
458
  */
492
459
  const release = async () => {
493
460
  // Every level is told to close even when one refuses, and the refusals leave together —
@@ -512,13 +479,7 @@ export async function createApp(options) {
512
479
  throw new AggregateError(refused, `${refused.length} refusal(s) while releasing the app`);
513
480
  }
514
481
  };
515
- /**
516
- * Stop taking calls, and resolve once the ones already running are done.
517
- *
518
- * Refuses on `timeoutMs` rather than resolving anyway: a drain that gives up quietly
519
- * reads exactly like a drain that succeeded, and the caller — who is about to release
520
- * a storage connection under whatever is left — is the one who must decide.
521
- */
482
+ /** Stop taking calls, and resolve once the ones already running are done. */
522
483
  const drain = async (timeoutMs) => {
523
484
  inflight.close();
524
485
  if (timeoutMs === undefined)
@@ -568,28 +529,7 @@ export async function createApp(options) {
568
529
  return undefined;
569
530
  }
570
531
  };
571
- /**
572
- * THE membership rule, stated once — every projection reads this and nothing
573
- * else. It used to live twice, verbatim, in the REST and GraphQL adapters,
574
- * and two other readers invented their own answer.
575
- *
576
- * Naming an audience closes it. Two ways to name an entity into a surface,
577
- * in precedence order:
578
- * - `surfaces:` in frond.config.ts — when the list exists, it IS the list;
579
- * - a handler under `handlers/<surface>/` — which also restricts the façade.
580
- * `@expose` is a THIRD way and this rule does not read it: the scan sets a
581
- * boolean, read by the two adapters and by `exposedAdapters` — never here.
582
- * What neither of the two names is not served. It used to be the reverse: no
583
- * `public:categoryHandler` meant the FULL CategoryHandler rode the public
584
- * door, create/update/delete included (measured on demos/nuxt-blog).
585
- *
586
- * A named entity with no façade of its own falls back to the default one —
587
- * that is not the old widening, it is the author saying "this one, as it is".
588
- * The leak was exposure with no statement behind it.
589
- *
590
- * A surface key stays local: a doublure serves whatever the remote's own door
591
- * serves, which is the remote's business and not ours to re-audience.
592
- */
532
+ /** THE membership rule, stated once — every projection reads this and nothing else. */
593
533
  const facadeFor = (entity, surface) => {
594
534
  if (!surface)
595
535
  return facadeAt(facadeKeyOf(entity), true);
@@ -603,12 +543,12 @@ export async function createApp(options) {
603
543
  return own;
604
544
  const fallback = facadeAt(facadeKeyOf(entity), false);
605
545
  return fallback
606
- ? new FacadeEntry(localDispatcher, entity, routeRegistry.operationNames(entity, surface), surface).operations
546
+ ? facadeOperations(localDispatcher, entity, routeRegistry.operationNames(entity, surface), surface)
607
547
  : undefined;
608
548
  };
609
549
  if (remoteRouter) {
610
550
  const remoteFacades = new Map();
611
- routeRegistry.addResolver(new RemoteRouteResolver((entity) => {
551
+ routeRegistry.addResolver(remoteRoutes((entity) => {
612
552
  const known = remoteFacades.get(entity);
613
553
  if (known)
614
554
  return known;
@@ -630,19 +570,14 @@ export async function createApp(options) {
630
570
  : undefined;
631
571
  };
632
572
  /**
633
- * The storage an entity is backed by — the dual of `facadeFor`, which serves its
634
- * client-facing door. Both are ways in; an entity that opens none of them still has rows.
635
- *
636
- * It resolves through the owning frond's scope, because that is where entity ORMs live:
637
- * `resolve('UserOrm')` reads the ROOT container and never finds one, so callers outside
638
- * the frond concluded there was no storage. The seed loop did exactly that, and skipped
639
- * every entity with no façade — the one case its own fallback existed for.
573
+ * The storage an entity is backed by — the dual of `facadeFor`, which serves its client-facing
574
+ * door.
640
575
  */
641
- const ormFor = (entity) => {
576
+ const storageFor = (entity) => {
642
577
  const owner = fronds.owner(entity);
643
578
  if (!owner)
644
579
  return undefined;
645
- const key = ormKeyOf(entity);
580
+ const key = storageKeyOf(entity);
646
581
  try {
647
582
  return container.resolve(`frond:${owner.name}`).resolve(key);
648
583
  }
@@ -650,14 +585,7 @@ export async function createApp(options) {
650
585
  return undefined;
651
586
  }
652
587
  };
653
- /**
654
- * The presenter of an entity, resolved through its owning frond's scope.
655
- *
656
- * Same shape as `ormFor`, and it exists for the same reason: without it an adapter
657
- * has to spell the container key itself. `schema-graphql` did — a hand-written
658
- * `${Name}Presenter` — and a key respelled elsewhere finds nothing and says nothing
659
- * the day the convention moves, which is exactly the failure `verify.ts` refuses.
660
- */
588
+ /** The presenter of an entity, resolved through its owning frond's scope. */
661
589
  const presenterFor = (entity) => {
662
590
  const owner = fronds.owner(entity);
663
591
  if (!owner)
@@ -687,7 +615,7 @@ export async function createApp(options) {
687
615
  operationsFor,
688
616
  listensTo: () => emissions.listensTo(),
689
617
  deliver: (fact, payload) => emissions.deliver(fact, payload),
690
- ormFor,
618
+ storageFor,
691
619
  presenterFor,
692
620
  dispose: release,
693
621
  drain,
@@ -724,7 +652,22 @@ export async function createApp(options) {
724
652
  app.serveRpc('discover', (_invocation, surface) => identityCardOf(app, surface));
725
653
  // The last thing the boot does, and the first thing a release undoes. An extension may
726
654
  // await here — which is what a provider needing to OPEN something could never do.
727
- await appLifecycle.up(app);
655
+ //
656
+ // A refusal here has to release what the boot took, because the caller cannot: it handed
657
+ // `onDispose` over BEFORE this line and never receives the app that would carry it back.
658
+ // Whoever opened a connection to give it to us would otherwise leak it on every failed boot.
659
+ try {
660
+ await appLifecycle.up(app);
661
+ }
662
+ catch (cause) {
663
+ try {
664
+ await release();
665
+ }
666
+ catch (refused) {
667
+ throw new AggregateError([cause, ...(refused instanceof AggregateError ? refused.errors : [refused])], `The boot failed and could not release everything it had taken: ${cause?.message ?? String(cause)}`);
668
+ }
669
+ throw cause;
670
+ }
728
671
  return app;
729
672
  }
730
673
  //# sourceMappingURL=bootstrap.js.map