@fougere/core 0.6.0-alpha.0 → 0.8.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 (510) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/AppLifecycle.d.ts +1 -1
  3. package/dist/boot/AppLifecycle.d.ts.map +1 -1
  4. package/dist/boot/AppLifecycle.js +13 -2
  5. package/dist/boot/AppLifecycle.js.map +1 -1
  6. package/dist/boot/Emissions.d.ts +13 -90
  7. package/dist/boot/Emissions.d.ts.map +1 -1
  8. package/dist/boot/Emissions.js +21 -118
  9. package/dist/boot/Emissions.js.map +1 -1
  10. package/dist/boot/ambient-port.d.ts +3 -24
  11. package/dist/boot/ambient-port.d.ts.map +1 -1
  12. package/dist/boot/ambient.als.d.ts.map +1 -1
  13. package/dist/boot/ambient.als.js +7 -12
  14. package/dist/boot/ambient.als.js.map +1 -1
  15. package/dist/boot/ambient.queue.d.ts +2 -5
  16. package/dist/boot/ambient.queue.d.ts.map +1 -1
  17. package/dist/boot/ambient.queue.js.map +1 -1
  18. package/dist/boot/apply.d.ts +1 -13
  19. package/dist/boot/apply.d.ts.map +1 -1
  20. package/dist/boot/apply.js +9 -16
  21. package/dist/boot/apply.js.map +1 -1
  22. package/dist/boot/auth.d.ts +2 -12
  23. package/dist/boot/auth.d.ts.map +1 -1
  24. package/dist/boot/boot.d.ts +3 -16
  25. package/dist/boot/boot.d.ts.map +1 -1
  26. package/dist/boot/boot.js +4 -11
  27. package/dist/boot/boot.js.map +1 -1
  28. package/dist/boot/bootstrap.d.ts.map +1 -1
  29. package/dist/boot/bootstrap.js +84 -130
  30. package/dist/boot/bootstrap.js.map +1 -1
  31. package/dist/boot/card.d.ts +1 -17
  32. package/dist/boot/card.d.ts.map +1 -1
  33. package/dist/boot/card.js +3 -32
  34. package/dist/boot/card.js.map +1 -1
  35. package/dist/boot/frame.d.ts +8 -32
  36. package/dist/boot/frame.d.ts.map +1 -1
  37. package/dist/boot/frame.js +17 -56
  38. package/dist/boot/frame.js.map +1 -1
  39. package/dist/boot/hosted.d.ts +2 -24
  40. package/dist/boot/hosted.d.ts.map +1 -1
  41. package/dist/boot/hosted.js +10 -15
  42. package/dist/boot/hosted.js.map +1 -1
  43. package/dist/boot/ownership.d.ts +3 -36
  44. package/dist/boot/ownership.d.ts.map +1 -1
  45. package/dist/boot/ownership.js +5 -40
  46. package/dist/boot/ownership.js.map +1 -1
  47. package/dist/boot/ports.d.ts +1 -14
  48. package/dist/boot/ports.d.ts.map +1 -1
  49. package/dist/boot/ports.js +1 -14
  50. package/dist/boot/ports.js.map +1 -1
  51. package/dist/boot/remote.d.ts +5 -38
  52. package/dist/boot/remote.d.ts.map +1 -1
  53. package/dist/boot/remote.js +8 -41
  54. package/dist/boot/remote.js.map +1 -1
  55. package/dist/boot/runner.d.ts +4 -21
  56. package/dist/boot/runner.d.ts.map +1 -1
  57. package/dist/boot/runner.js +4 -17
  58. package/dist/boot/runner.js.map +1 -1
  59. package/dist/boot/seed.d.ts +4 -31
  60. package/dist/boot/seed.d.ts.map +1 -1
  61. package/dist/boot/seed.js +6 -37
  62. package/dist/boot/seed.js.map +1 -1
  63. package/dist/boot/statement-drift.d.ts +2 -21
  64. package/dist/boot/statement-drift.d.ts.map +1 -1
  65. package/dist/boot/statement-drift.js +4 -9
  66. package/dist/boot/statement-drift.js.map +1 -1
  67. package/dist/boot/together.d.ts +4 -8
  68. package/dist/boot/together.d.ts.map +1 -1
  69. package/dist/boot/together.js +15 -50
  70. package/dist/boot/together.js.map +1 -1
  71. package/dist/boot/types.d.ts +31 -173
  72. package/dist/boot/types.d.ts.map +1 -1
  73. package/dist/builtin/config.d.ts +7 -0
  74. package/dist/builtin/config.d.ts.map +1 -0
  75. package/dist/builtin/config.js +15 -0
  76. package/dist/builtin/config.js.map +1 -0
  77. package/dist/{builtins → builtin}/logger.d.ts +4 -25
  78. package/dist/builtin/logger.d.ts.map +1 -0
  79. package/dist/{builtins → builtin}/logger.js +5 -32
  80. package/dist/builtin/logger.js.map +1 -0
  81. package/dist/config-loader.d.ts +9 -67
  82. package/dist/config-loader.d.ts.map +1 -1
  83. package/dist/config-loader.js +5 -18
  84. package/dist/config-loader.js.map +1 -1
  85. package/dist/contract.d.ts +15 -31
  86. package/dist/contract.d.ts.map +1 -1
  87. package/dist/contract.js +13 -26
  88. package/dist/contract.js.map +1 -1
  89. package/dist/criterion.d.ts +37 -0
  90. package/dist/criterion.d.ts.map +1 -0
  91. package/dist/criterion.js +28 -0
  92. package/dist/criterion.js.map +1 -0
  93. package/dist/crypto/encoding.d.ts +2 -15
  94. package/dist/crypto/encoding.d.ts.map +1 -1
  95. package/dist/crypto/encoding.js +2 -15
  96. package/dist/crypto/encoding.js.map +1 -1
  97. package/dist/crypto/node.d.ts.map +1 -1
  98. package/dist/crypto/node.js +1 -7
  99. package/dist/crypto/node.js.map +1 -1
  100. package/dist/crypto/port.d.ts +2 -18
  101. package/dist/crypto/port.d.ts.map +1 -1
  102. package/dist/crypto/port.js +1 -17
  103. package/dist/crypto/port.js.map +1 -1
  104. package/dist/crypto/webcrypto.d.ts.map +1 -1
  105. package/dist/crypto/webcrypto.js +1 -12
  106. package/dist/crypto/webcrypto.js.map +1 -1
  107. package/dist/declare.d.ts +19 -37
  108. package/dist/declare.d.ts.map +1 -1
  109. package/dist/declare.js +23 -30
  110. package/dist/declare.js.map +1 -1
  111. package/dist/define.d.ts +2 -3
  112. package/dist/define.d.ts.map +1 -1
  113. package/dist/define.js +2 -3
  114. package/dist/define.js.map +1 -1
  115. package/dist/descriptor/Fronds.d.ts +3 -28
  116. package/dist/descriptor/Fronds.d.ts.map +1 -1
  117. package/dist/descriptor/Fronds.js +6 -31
  118. package/dist/descriptor/Fronds.js.map +1 -1
  119. package/dist/descriptor/frond.d.ts +25 -60
  120. package/dist/descriptor/frond.d.ts.map +1 -1
  121. package/dist/descriptor/frond.js +5 -1
  122. package/dist/descriptor/frond.js.map +1 -1
  123. package/dist/dispatch/ArgumentResolver.d.ts +1 -1
  124. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
  125. package/dist/dispatch/ArgumentResolver.js +5 -5
  126. package/dist/dispatch/ArgumentResolver.js.map +1 -1
  127. package/dist/dispatch/DispatchEvent.d.ts +2 -2
  128. package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
  129. package/dist/dispatch/DispatchLifecycle.d.ts +1 -7
  130. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -1
  131. package/dist/dispatch/DispatchLifecycle.js +1 -7
  132. package/dist/dispatch/DispatchLifecycle.js.map +1 -1
  133. package/dist/dispatch/DispatchPort.d.ts +1 -1
  134. package/dist/dispatch/DispatchPort.d.ts.map +1 -1
  135. package/dist/dispatch/Dispatcher.d.ts +1 -1
  136. package/dist/dispatch/Dispatcher.d.ts.map +1 -1
  137. package/dist/dispatch/Dispatcher.js +2 -2
  138. package/dist/dispatch/Dispatcher.js.map +1 -1
  139. package/dist/{boot → dispatch}/HandlerFacade.d.ts +25 -38
  140. package/dist/dispatch/HandlerFacade.d.ts.map +1 -0
  141. package/dist/{boot → dispatch}/HandlerFacade.js +65 -74
  142. package/dist/dispatch/HandlerFacade.js.map +1 -0
  143. package/dist/dispatch/LocalRoutePolicy.d.ts +1 -1
  144. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -1
  145. package/dist/dispatch/LocalRoutePolicy.js +4 -4
  146. package/dist/dispatch/LocalRoutePolicy.js.map +1 -1
  147. package/dist/dispatch/OperationRoute.d.ts +2 -2
  148. package/dist/dispatch/OperationRoute.d.ts.map +1 -1
  149. package/dist/dispatch/OutputView.d.ts +3 -2
  150. package/dist/dispatch/OutputView.d.ts.map +1 -1
  151. package/dist/dispatch/OutputView.js +19 -1
  152. package/dist/dispatch/OutputView.js.map +1 -1
  153. package/dist/dispatch/Route.d.ts +2 -2
  154. package/dist/dispatch/Route.d.ts.map +1 -1
  155. package/dist/dispatch/RoutePolicy.d.ts +1 -1
  156. package/dist/dispatch/RoutePolicy.d.ts.map +1 -1
  157. package/dist/dispatch/RouteRegistry.d.ts +1 -1
  158. package/dist/dispatch/RouteRegistry.d.ts.map +1 -1
  159. package/dist/dispatch/RouteRegistry.js +2 -2
  160. package/dist/dispatch/RouteRegistry.js.map +1 -1
  161. package/dist/dispatch/RouteResolver.d.ts +2 -4
  162. package/dist/dispatch/RouteResolver.d.ts.map +1 -1
  163. package/dist/dispatch/StorageGuard.d.ts +40 -8
  164. package/dist/dispatch/StorageGuard.d.ts.map +1 -1
  165. package/dist/dispatch/StorageGuard.js +151 -20
  166. package/dist/dispatch/StorageGuard.js.map +1 -1
  167. package/dist/dispatch/presenterArguments.d.ts +7 -0
  168. package/dist/dispatch/presenterArguments.d.ts.map +1 -0
  169. package/dist/dispatch/presenterArguments.js +12 -0
  170. package/dist/dispatch/presenterArguments.js.map +1 -0
  171. package/dist/dispatch/remoteRoutes.d.ts +7 -0
  172. package/dist/dispatch/remoteRoutes.d.ts.map +1 -0
  173. package/dist/dispatch/{RemoteRouteResolver.js → remoteRoutes.js} +6 -10
  174. package/dist/dispatch/remoteRoutes.js.map +1 -0
  175. package/dist/dispatch/routeNotFound.d.ts +9 -0
  176. package/dist/dispatch/routeNotFound.d.ts.map +1 -0
  177. package/dist/dispatch/routeNotFound.js +21 -0
  178. package/dist/dispatch/routeNotFound.js.map +1 -0
  179. package/dist/dispatch/validateInput.d.ts +5 -0
  180. package/dist/dispatch/validateInput.d.ts.map +1 -0
  181. package/dist/dispatch/validateInput.js +20 -0
  182. package/dist/dispatch/validateInput.js.map +1 -0
  183. package/dist/effective-operation.d.ts +1 -24
  184. package/dist/effective-operation.d.ts.map +1 -1
  185. package/dist/effective-operation.js +21 -50
  186. package/dist/effective-operation.js.map +1 -1
  187. package/dist/emit.d.ts +4 -42
  188. package/dist/emit.d.ts.map +1 -1
  189. package/dist/emit.js +3 -39
  190. package/dist/emit.js.map +1 -1
  191. package/dist/entry/facade.d.ts +8 -0
  192. package/dist/entry/facade.d.ts.map +1 -0
  193. package/dist/entry/facade.js +28 -0
  194. package/dist/entry/facade.js.map +1 -0
  195. package/dist/entry/transport.d.ts +5 -0
  196. package/dist/entry/transport.d.ts.map +1 -0
  197. package/dist/entry/transport.js +11 -0
  198. package/dist/entry/transport.js.map +1 -0
  199. package/dist/frond-config.d.ts +7 -70
  200. package/dist/frond-config.d.ts.map +1 -1
  201. package/dist/frond-config.js +1 -9
  202. package/dist/frond-config.js.map +1 -1
  203. package/dist/identity-keys.d.ts +2 -5
  204. package/dist/identity-keys.d.ts.map +1 -1
  205. package/dist/identity-keys.js +3 -16
  206. package/dist/identity-keys.js.map +1 -1
  207. package/dist/identity.d.ts +4 -30
  208. package/dist/identity.d.ts.map +1 -1
  209. package/dist/identity.js +11 -73
  210. package/dist/identity.js.map +1 -1
  211. package/dist/imports.d.ts +1 -7
  212. package/dist/imports.d.ts.map +1 -1
  213. package/dist/imports.js +1 -7
  214. package/dist/imports.js.map +1 -1
  215. package/dist/index.d.ts +17 -24
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +10 -18
  218. package/dist/index.js.map +1 -1
  219. package/dist/loader.d.ts +1 -8
  220. package/dist/loader.d.ts.map +1 -1
  221. package/dist/loader.js +1 -8
  222. package/dist/loader.js.map +1 -1
  223. package/dist/node.d.ts +2 -11
  224. package/dist/node.d.ts.map +1 -1
  225. package/dist/node.js +2 -11
  226. package/dist/node.js.map +1 -1
  227. package/dist/prefab/collector.d.ts +1 -22
  228. package/dist/prefab/collector.d.ts.map +1 -1
  229. package/dist/prefab/collector.js +1 -22
  230. package/dist/prefab/collector.js.map +1 -1
  231. package/dist/prefab/crud.d.ts +16 -32
  232. package/dist/prefab/crud.d.ts.map +1 -1
  233. package/dist/prefab/crud.js +31 -58
  234. package/dist/prefab/crud.js.map +1 -1
  235. package/dist/prefab/mirror.d.ts +2 -24
  236. package/dist/prefab/mirror.d.ts.map +1 -1
  237. package/dist/prefab/mirror.js +2 -20
  238. package/dist/prefab/mirror.js.map +1 -1
  239. package/dist/prefab/prefab.d.ts +1 -7
  240. package/dist/prefab/prefab.d.ts.map +1 -1
  241. package/dist/prefab/prefab.js +1 -7
  242. package/dist/prefab/prefab.js.map +1 -1
  243. package/dist/prefab/presenter.d.ts +2 -36
  244. package/dist/prefab/presenter.d.ts.map +1 -1
  245. package/dist/prefab/presenter.js +2 -36
  246. package/dist/prefab/presenter.js.map +1 -1
  247. package/dist/prefab/repository.d.ts +5 -73
  248. package/dist/prefab/repository.d.ts.map +1 -1
  249. package/dist/prefab/repository.js +3 -16
  250. package/dist/prefab/repository.js.map +1 -1
  251. package/dist/scan/adapters.d.ts +3 -0
  252. package/dist/scan/adapters.d.ts.map +1 -0
  253. package/dist/scan/adapters.js +25 -0
  254. package/dist/scan/adapters.js.map +1 -0
  255. package/dist/scan/bundling.d.ts +1 -12
  256. package/dist/scan/bundling.d.ts.map +1 -1
  257. package/dist/scan/bundling.js +1 -12
  258. package/dist/scan/bundling.js.map +1 -1
  259. package/dist/scan/contract.d.ts +27 -0
  260. package/dist/scan/contract.d.ts.map +1 -0
  261. package/dist/scan/contract.js +46 -0
  262. package/dist/scan/contract.js.map +1 -0
  263. package/dist/scan/conventions.d.ts +6 -40
  264. package/dist/scan/conventions.d.ts.map +1 -1
  265. package/dist/scan/conventions.js +5 -34
  266. package/dist/scan/conventions.js.map +1 -1
  267. package/dist/scan/emit.d.ts +1 -5
  268. package/dist/scan/emit.d.ts.map +1 -1
  269. package/dist/scan/emit.js +10 -78
  270. package/dist/scan/emit.js.map +1 -1
  271. package/dist/scan/handler-parser.d.ts +4 -26
  272. package/dist/scan/handler-parser.d.ts.map +1 -1
  273. package/dist/scan/handler-parser.js +26 -83
  274. package/dist/scan/handler-parser.js.map +1 -1
  275. package/dist/scan/result.d.ts +3 -16
  276. package/dist/scan/result.d.ts.map +1 -1
  277. package/dist/scan/scanner.d.ts +2 -27
  278. package/dist/scan/scanner.d.ts.map +1 -1
  279. package/dist/scan/scanner.js +45 -133
  280. package/dist/scan/scanner.js.map +1 -1
  281. package/dist/scan/statement.d.ts.map +1 -1
  282. package/dist/scan/statement.js +60 -37
  283. package/dist/scan/statement.js.map +1 -1
  284. package/dist/source.d.ts +53 -0
  285. package/dist/source.d.ts.map +1 -0
  286. package/dist/source.js +18 -0
  287. package/dist/source.js.map +1 -0
  288. package/dist/storage.d.ts +13 -210
  289. package/dist/storage.d.ts.map +1 -1
  290. package/dist/storage.js +4 -68
  291. package/dist/storage.js.map +1 -1
  292. package/dist/store.d.ts +18 -0
  293. package/dist/store.d.ts.map +1 -0
  294. package/dist/store.js +179 -0
  295. package/dist/store.js.map +1 -0
  296. package/dist/verify.d.ts +5 -38
  297. package/dist/verify.d.ts.map +1 -1
  298. package/dist/verify.js +17 -37
  299. package/dist/verify.js.map +1 -1
  300. package/dist/wire/CallLog.d.ts +32 -0
  301. package/dist/wire/CallLog.d.ts.map +1 -0
  302. package/dist/{contract → wire}/CallLog.js.map +1 -1
  303. package/dist/wire/Invocation.d.ts +32 -0
  304. package/dist/wire/Invocation.d.ts.map +1 -0
  305. package/dist/wire/Invocation.js +66 -0
  306. package/dist/wire/Invocation.js.map +1 -0
  307. package/dist/{contract → wire}/RouteAddress.d.ts +5 -0
  308. package/dist/wire/RouteAddress.d.ts.map +1 -0
  309. package/dist/{contract → wire}/RouteAddress.js +7 -0
  310. package/dist/wire/RouteAddress.js.map +1 -0
  311. package/dist/wire/binding.d.ts +5 -21
  312. package/dist/wire/binding.d.ts.map +1 -1
  313. package/dist/wire/binding.js +5 -10
  314. package/dist/wire/binding.js.map +1 -1
  315. package/dist/wire/call.d.ts +24 -133
  316. package/dist/wire/call.d.ts.map +1 -1
  317. package/dist/wire/call.js +15 -41
  318. package/dist/wire/call.js.map +1 -1
  319. package/dist/wire/drift.d.ts +3 -28
  320. package/dist/wire/drift.d.ts.map +1 -1
  321. package/dist/wire/drift.js +4 -23
  322. package/dist/wire/drift.js.map +1 -1
  323. package/dist/wire/errors.d.ts +4 -24
  324. package/dist/wire/errors.d.ts.map +1 -1
  325. package/dist/wire/errors.js +4 -24
  326. package/dist/wire/errors.js.map +1 -1
  327. package/dist/wire/http-error.d.ts +2 -13
  328. package/dist/wire/http-error.d.ts.map +1 -1
  329. package/dist/wire/http-error.js +5 -19
  330. package/dist/wire/http-error.js.map +1 -1
  331. package/dist/wire/loggerMiddleware.d.ts +2 -8
  332. package/dist/wire/loggerMiddleware.d.ts.map +1 -1
  333. package/dist/wire/loggerMiddleware.js +1 -7
  334. package/dist/wire/loggerMiddleware.js.map +1 -1
  335. package/dist/wire/middleware.d.ts +3 -7
  336. package/dist/wire/middleware.d.ts.map +1 -1
  337. package/dist/wire/middleware.js +1 -5
  338. package/dist/wire/middleware.js.map +1 -1
  339. package/dist/wire/operation.d.ts +7 -43
  340. package/dist/wire/operation.d.ts.map +1 -1
  341. package/dist/wire/operation.js +4 -15
  342. package/dist/wire/operation.js.map +1 -1
  343. package/dist/wire/signature.d.ts +4 -25
  344. package/dist/wire/signature.d.ts.map +1 -1
  345. package/package.json +3 -3
  346. package/src/boot/AppLifecycle.ts +15 -2
  347. package/src/boot/Emissions.ts +21 -118
  348. package/src/boot/ambient-port.ts +3 -24
  349. package/src/boot/ambient.als.ts +7 -12
  350. package/src/boot/ambient.queue.ts +2 -5
  351. package/src/boot/apply.ts +9 -16
  352. package/src/boot/auth.ts +2 -12
  353. package/src/boot/boot.ts +6 -21
  354. package/src/boot/bootstrap.ts +95 -140
  355. package/src/boot/card.ts +4 -33
  356. package/src/boot/frame.ts +24 -64
  357. package/src/boot/hosted.ts +12 -34
  358. package/src/boot/ownership.ts +5 -39
  359. package/src/boot/ports.ts +1 -14
  360. package/src/boot/remote.ts +11 -58
  361. package/src/boot/runner.ts +5 -22
  362. package/src/boot/seed.ts +6 -37
  363. package/src/boot/statement-drift.ts +5 -24
  364. package/src/boot/together.ts +18 -51
  365. package/src/boot/types.ts +31 -173
  366. package/src/{builtins → builtin}/config.ts +1 -7
  367. package/src/{builtins → builtin}/logger.ts +6 -39
  368. package/src/config-loader.ts +12 -71
  369. package/src/contract.ts +19 -39
  370. package/src/criterion.ts +54 -0
  371. package/src/crypto/encoding.ts +2 -15
  372. package/src/crypto/node.ts +1 -7
  373. package/src/crypto/port.ts +2 -18
  374. package/src/crypto/webcrypto.ts +1 -12
  375. package/src/declare.ts +42 -41
  376. package/src/define.ts +2 -3
  377. package/src/descriptor/Fronds.ts +6 -31
  378. package/src/descriptor/frond.ts +26 -60
  379. package/src/dispatch/ArgumentResolver.ts +6 -6
  380. package/src/dispatch/DispatchEvent.ts +2 -2
  381. package/src/dispatch/DispatchLifecycle.ts +1 -7
  382. package/src/dispatch/DispatchPort.ts +1 -1
  383. package/src/dispatch/Dispatcher.ts +3 -3
  384. package/src/dispatch/HandlerFacade.ts +231 -0
  385. package/src/dispatch/LocalRoutePolicy.ts +4 -4
  386. package/src/dispatch/OperationRoute.ts +2 -2
  387. package/src/dispatch/OutputView.ts +24 -2
  388. package/src/dispatch/Route.ts +2 -2
  389. package/src/dispatch/RoutePolicy.ts +1 -1
  390. package/src/dispatch/RouteRegistry.ts +2 -2
  391. package/src/dispatch/RouteResolver.ts +2 -4
  392. package/src/dispatch/StorageGuard.ts +175 -19
  393. package/src/dispatch/presenterArguments.ts +25 -0
  394. package/src/dispatch/{RemoteRouteResolver.ts → remoteRoutes.ts} +7 -9
  395. package/src/dispatch/routeNotFound.ts +33 -0
  396. package/src/dispatch/validateInput.ts +28 -0
  397. package/src/effective-operation.ts +21 -50
  398. package/src/emit.ts +5 -63
  399. package/src/entry/facade.ts +44 -0
  400. package/src/entry/transport.ts +16 -0
  401. package/src/frond-config.ts +7 -70
  402. package/src/identity-keys.ts +3 -16
  403. package/src/identity.ts +12 -80
  404. package/src/imports.ts +2 -31
  405. package/src/index.ts +17 -24
  406. package/src/loader.ts +2 -16
  407. package/src/node.ts +2 -11
  408. package/src/prefab/collector.ts +1 -22
  409. package/src/prefab/crud.ts +37 -76
  410. package/src/prefab/mirror.ts +4 -44
  411. package/src/prefab/prefab.ts +2 -21
  412. package/src/prefab/presenter.ts +2 -36
  413. package/src/prefab/repository.ts +7 -83
  414. package/src/scan/adapters.ts +32 -0
  415. package/src/scan/bundling.ts +1 -12
  416. package/src/scan/contract.ts +80 -0
  417. package/src/scan/conventions.ts +6 -40
  418. package/src/scan/emit.ts +11 -80
  419. package/src/scan/handler-parser.ts +27 -96
  420. package/src/scan/result.ts +3 -16
  421. package/src/scan/scanner.ts +46 -132
  422. package/src/scan/statement.ts +73 -41
  423. package/src/source.ts +63 -0
  424. package/src/storage.ts +14 -234
  425. package/src/store.ts +191 -0
  426. package/src/verify.ts +16 -57
  427. package/src/wire/CallLog.ts +30 -0
  428. package/src/{contract → wire}/Invocation.ts +24 -17
  429. package/src/{contract → wire}/RouteAddress.ts +7 -0
  430. package/src/wire/binding.ts +9 -25
  431. package/src/wire/call.ts +30 -133
  432. package/src/wire/drift.ts +5 -30
  433. package/src/wire/errors.ts +4 -24
  434. package/src/wire/http-error.ts +5 -19
  435. package/src/wire/loggerMiddleware.ts +2 -8
  436. package/src/wire/middleware.ts +3 -7
  437. package/src/wire/operation.ts +8 -48
  438. package/src/wire/signature.ts +4 -25
  439. package/dist/boot/HandlerFacade.d.ts.map +0 -1
  440. package/dist/boot/HandlerFacade.js.map +0 -1
  441. package/dist/builtins/config.d.ts +0 -13
  442. package/dist/builtins/config.d.ts.map +0 -1
  443. package/dist/builtins/config.js +0 -21
  444. package/dist/builtins/config.js.map +0 -1
  445. package/dist/builtins/logger.d.ts.map +0 -1
  446. package/dist/builtins/logger.js.map +0 -1
  447. package/dist/contract/Call.d.ts +0 -10
  448. package/dist/contract/Call.d.ts.map +0 -1
  449. package/dist/contract/Call.js +0 -15
  450. package/dist/contract/Call.js.map +0 -1
  451. package/dist/contract/CallLog.d.ts +0 -57
  452. package/dist/contract/CallLog.d.ts.map +0 -1
  453. package/dist/contract/Invocation.d.ts +0 -27
  454. package/dist/contract/Invocation.d.ts.map +0 -1
  455. package/dist/contract/Invocation.js +0 -59
  456. package/dist/contract/Invocation.js.map +0 -1
  457. package/dist/contract/RouteAddress.d.ts.map +0 -1
  458. package/dist/contract/RouteAddress.js.map +0 -1
  459. package/dist/dispatch/InputValidator.d.ts +0 -7
  460. package/dist/dispatch/InputValidator.d.ts.map +0 -1
  461. package/dist/dispatch/InputValidator.js +0 -22
  462. package/dist/dispatch/InputValidator.js.map +0 -1
  463. package/dist/dispatch/OperationExecutor.d.ts +0 -25
  464. package/dist/dispatch/OperationExecutor.d.ts.map +0 -1
  465. package/dist/dispatch/OperationExecutor.js +0 -32
  466. package/dist/dispatch/OperationExecutor.js.map +0 -1
  467. package/dist/dispatch/OutputProjector.d.ts +0 -12
  468. package/dist/dispatch/OutputProjector.d.ts.map +0 -1
  469. package/dist/dispatch/OutputProjector.js +0 -30
  470. package/dist/dispatch/OutputProjector.js.map +0 -1
  471. package/dist/dispatch/PresenterArgumentResolver.d.ts +0 -12
  472. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +0 -1
  473. package/dist/dispatch/PresenterArgumentResolver.js +0 -20
  474. package/dist/dispatch/PresenterArgumentResolver.js.map +0 -1
  475. package/dist/dispatch/RemoteRouteResolver.d.ts +0 -13
  476. package/dist/dispatch/RemoteRouteResolver.d.ts.map +0 -1
  477. package/dist/dispatch/RemoteRouteResolver.js.map +0 -1
  478. package/dist/dispatch/RouteNotFoundError.d.ts +0 -10
  479. package/dist/dispatch/RouteNotFoundError.d.ts.map +0 -1
  480. package/dist/dispatch/RouteNotFoundError.js +0 -24
  481. package/dist/dispatch/RouteNotFoundError.js.map +0 -1
  482. package/dist/entry/DynamicFacade.d.ts +0 -10
  483. package/dist/entry/DynamicFacade.d.ts.map +0 -1
  484. package/dist/entry/DynamicFacade.js +0 -27
  485. package/dist/entry/DynamicFacade.js.map +0 -1
  486. package/dist/entry/FacadeEntry.d.ts +0 -11
  487. package/dist/entry/FacadeEntry.d.ts.map +0 -1
  488. package/dist/entry/FacadeEntry.js +0 -26
  489. package/dist/entry/FacadeEntry.js.map +0 -1
  490. package/dist/entry/TransportEntry.d.ts +0 -13
  491. package/dist/entry/TransportEntry.d.ts.map +0 -1
  492. package/dist/entry/TransportEntry.js +0 -24
  493. package/dist/entry/TransportEntry.js.map +0 -1
  494. package/dist/rows.d.ts +0 -40
  495. package/dist/rows.d.ts.map +0 -1
  496. package/dist/rows.js +0 -146
  497. package/dist/rows.js.map +0 -1
  498. package/src/boot/HandlerFacade.ts +0 -242
  499. package/src/contract/Call.ts +0 -18
  500. package/src/contract/CallLog.ts +0 -55
  501. package/src/dispatch/InputValidator.ts +0 -28
  502. package/src/dispatch/OperationExecutor.ts +0 -60
  503. package/src/dispatch/OutputProjector.ts +0 -32
  504. package/src/dispatch/PresenterArgumentResolver.ts +0 -25
  505. package/src/dispatch/RouteNotFoundError.ts +0 -29
  506. package/src/entry/DynamicFacade.ts +0 -28
  507. package/src/entry/FacadeEntry.ts +0 -32
  508. package/src/entry/TransportEntry.ts +0 -30
  509. package/src/rows.ts +0 -155
  510. /package/dist/{contract → wire}/CallLog.js +0 -0
@@ -1,26 +1,19 @@
1
- import { setLogLevel, logLevel, envLevel } from '../builtins/logger.js';
1
+ import { setLogLevel, logLevel, envLevel } from '../builtin/logger.js';
2
2
  import { dequal } from 'dequal';
3
- /**
4
- * What a (re-)read config changes in a process that is already running.
5
- *
6
- * The rule it realizes, and the only one worth remembering: **a value that is
7
- * CONSULTED can change under a running app; a value that was CONSUMED to build
8
- * something cannot, without rebuilding what it built.** `logLevel` is consulted at
9
- * every emission, so it moves. `db` opened a connection, `ports:` registered a class,
10
- * the entities built façades — those are consumed, and this function reports them
11
- * rather than pretending.
12
- *
13
- * The list of consulted keys is not declared anywhere: a key is consulted when this
14
- * function does something with it, which is the only definition that cannot go stale.
15
- */
3
+ /** What a (re-)read config changes in a process that is already running. */
16
4
  export function applyConfig(next, inForce) {
17
5
  const applied = [];
18
6
  const pending = [];
19
7
  // The CLI speaks through the environment, so it keeps winning over the file — read
20
- // through `envLevel`, which is where the environment is already judged. Casting it
8
+ // through `envLevel`, which is where the environment is already validated. Casting it
21
9
  // here was a second reader that validated nothing: `FOUGERE_LOG_LEVEL=verbose` set
22
10
  // the threshold to `undefined` and every log passed.
23
- const wanted = envLevel() ?? next.logLevel ?? 'debug';
11
+ // A process that declares no level keeps the one it started with — `info`, or whatever
12
+ // the host set for itself before booting. Defaulting to `debug` here meant every caller
13
+ // of this function silently raised the threshold: the CLI sets `warn` and got `debug`
14
+ // back, and the day a web host started calling it, `pnpm dev` would have traced every
15
+ // dispatch of an app that asked for nothing.
16
+ const wanted = envLevel() ?? next.logLevel ?? logLevel();
24
17
  const before = logLevel();
25
18
  if (wanted !== before) {
26
19
  setLogLevel(wanted);
@@ -1 +1 @@
1
- {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/boot/apply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,IAAmB,EAAE,OAAuB;IACtE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,mFAAmF;IACnF,mFAAmF;IACnF,mFAAmF;IACnF,qDAAqD;IACrD,MAAM,MAAM,GAAG,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IACtD,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;IAC1B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,aAAa,MAAM,MAAM,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI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AC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,IAAI,GAAG,KAAK,UAAU,IAAI,CAAC,OAAO;YAAE,SAAS;QAC7C,IAAI,CAAC,MAAM,CAAE,IAAgC,CAAC,GAAG,CAAC,EAAG,OAAmC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC/F,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
@@ -4,13 +4,7 @@
4
4
  */
5
5
  import type { SchemaView } from '@fougere/schema';
6
6
  import type { Storage, StorageFactory } from '../storage.js';
7
- /**
8
- * Lazy auth declaration written in fougere.config.ts.
9
- *
10
- * Each @fougere/auth-* package exports a factory (e.g. `betterAuth(opts)`) that
11
- * returns this shape. The `create()` method is called once at boot with the
12
- * resolved db + storageFactory, so the provider can wire its engine through Fougere.
13
- */
7
+ /** Lazy auth declaration written in fougere.config.ts. */
14
8
  export interface AuthConfig {
15
9
  /** Build the runtime — invoked by createApp at boot with the resolved storage handles. */
16
10
  create(ctx: AuthContext): AuthRuntime | Promise<AuthRuntime>;
@@ -37,11 +31,7 @@ export interface AuthContext {
37
31
  export interface AuthRuntime {
38
32
  /** Entities used by the provider, including any defaults it filled in. */
39
33
  entities: Record<string, SchemaView>;
40
- /**
41
- * Per-entity ORMs the provider built for itself. Exposed so app code can
42
- * query auth tables (e.g. list active sessions for a user) without rebuilding
43
- * the same Storage.
44
- */
34
+ /** Per-entity ORMs the provider built for itself. */
45
35
  storages: Record<string, Storage>;
46
36
  /** Web Standard handler that processes /auth/* requests. */
47
37
  handler: (request: Request) => Promise<Response>;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/boot/auth.ts"],"names":[],"mappings":"AAAA;;;G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AAC,WAAW,CAAC,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,EAAE,EAAE,OAAO,CAAC;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,11 +19,7 @@ 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
25
  * storage setup — returns the storage handle (db), an storageFactory, and its two halves.
@@ -32,11 +28,7 @@ interface BootOptions {
32
28
  db?: (config: FougereConfig) => {
33
29
  db?: unknown;
34
30
  storageFactory: CreateAppOptions['storageFactory'];
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
- */
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,MA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AO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,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');
@@ -50,12 +45,10 @@ 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
- migrating(dbSetup?.migrate),
51
+ migrating(dbSetup?.migrate, (message) => log.warn(message)),
59
52
  seeding((message) => log.debug(message)),
60
53
  ...(options.extensions ?? []),
61
54
  ],
@@ -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,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC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EAAE;YACV,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3D,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;AA0FxD,uCAAuC;AACvC,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CAyvBvE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/boot/bootstrap.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAuExD,uCAAuC;AACvC,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CA8tBvE"}
@@ -1,11 +1,12 @@
1
1
  import { lowerFirst } from '@fougere/schema';
2
+ import { nameOf } from '../descriptor/frond.js';
2
3
  import { hostedBy } from './hosted.js';
3
- import { Logger } from '../builtins/logger.js';
4
- import { Config } from '../builtins/config.js';
4
+ import { Logger } from '../builtin/logger.js';
5
+ import { Config } from '../builtin/config.js';
5
6
  import { createRemoteRouter, createRemoteFacade } from './remote.js';
6
7
  import { registerFrames } from './together.js';
7
8
  import { Emissions } from './Emissions.js';
8
- import { HandlerFacade } from './HandlerFacade.js';
9
+ import { HandlerFacade } from '../dispatch/HandlerFacade.js';
9
10
  import { targetOf } from '../prefab/prefab.js';
10
11
  import { ownersOf, refuseStorageInUserCode, refuseCrudOnOwned } from './ownership.js';
11
12
  import { resolveEffectiveOperations, } from '../effective-operation.js';
@@ -16,50 +17,31 @@ import { InFlight } from '../dispatch/InFlight.js';
16
17
  import { facadeKeyOf, contractsKeyOf } from '../wire/call.js';
17
18
  import { identityCardOf } from './card.js';
18
19
  import { AppLifecycle } from './AppLifecycle.js';
20
+ import { inheritsCrud, subjectOf } from '../prefab/crud.js';
19
21
  import { repositoryKeyOf } from '../prefab/repository.js';
20
22
  import { storageKeyOf } from '../storage.js';
23
+ import { declares } from '../source.js';
21
24
  import { presenterKeyOf } from '../prefab/presenter.js';
22
25
  import { collectorKeyOf } from '../prefab/collector.js';
23
- import { RouteAddress } from '../contract/RouteAddress.js';
26
+ import { RouteAddress } from '../wire/RouteAddress.js';
24
27
  import { DispatchLifecycle } from '../dispatch/DispatchLifecycle.js';
25
28
  import { Dispatcher } from '../dispatch/Dispatcher.js';
26
29
  import { LocalRoutePolicy } from '../dispatch/LocalRoutePolicy.js';
27
30
  import { OperationRoute } from '../dispatch/OperationRoute.js';
28
- import { RemoteRouteResolver } from '../dispatch/RemoteRouteResolver.js';
31
+ import { remoteRoutes } from '../dispatch/remoteRoutes.js';
29
32
  import { RouteRegistry } from '../dispatch/RouteRegistry.js';
30
- import { FacadeEntry } from '../entry/FacadeEntry.js';
31
- /**
32
- * The one wording for "nobody hosts this here", with both ways out. Said twice, and the
33
- * second copy (`schemaFor`) had lost the two remedies — the same dead end, strictly less
34
- * useful, for no reason.
35
- */
33
+ import { facadeOperations } from '../entry/facade.js';
34
+ /** The one wording for "nobody hosts this here", with both ways out. */
36
35
  const notLoaded = (entity) => `Frond for '${entity}' is not loaded.\n` +
37
36
  ` - Add '${entity}' to --fronds flag\n` +
38
37
  ` - Or declare a remote: remotes: { ${entity}: 'http://...' }`;
39
- /**
40
- * Two fronds cannot claim one name — said at boot, because nothing else says it.
41
- *
42
- * A door lands on the ROOT container under `facadeKeyOf(address)`, and that key carries
43
- * no frond; a presenter lands there too. `registerValue` is a `Map.set`, so the second
44
- * frond loaded simply replaced the first and every call meant for one went to the other.
45
- * Silent in-process, and worse than silent under a split: `createRemoteRouter` guards its
46
- * index with `if (!byEntity.has(...))`, so THERE the first frond discovered wins. The same
47
- * application answered differently depending on how it was deployed.
48
- *
49
- * Refusing is the honest answer while a key cannot say which frond owns it. It is not the
50
- * last word: qualify the key and this boot can accept both. ORMs and repositories are not
51
- * checked because they are registered in the frond's own scope, where two fronds do not meet.
52
- *
53
- * A frond declared remote registers nothing locally, so it cannot collide here. Two REMOTE
54
- * fronds publishing one entity still shadow each other inside the router — a hole this
55
- * check does not reach.
56
- */
38
+ /** Two fronds cannot claim one name — said at boot, because nothing else says it. */
57
39
  function assertOneOwnerPerKey(fronds, remotes) {
58
40
  const owner = new Map();
59
41
  const claim = (key, frond, what) => {
60
- const held = owner.get(key);
61
- if (held !== undefined && held !== frond) {
62
- throw new Error(`Two fronds claim the key '${key}': '${held}' and '${frond}'.\n`
42
+ const first = owner.get(key);
43
+ if (first !== undefined && first !== frond) {
44
+ throw new Error(`Two fronds claim the key '${key}': '${first}' and '${frond}'.\n`
63
45
  + ` A ${what} is registered under a key that names no frond, so one would silently replace the other.\n`
64
46
  + ` - Rename one of the two classes, or\n`
65
47
  + ` - keep one of the two fronds out of this process (--fronds), or declare it in remotes:`);
@@ -110,24 +92,13 @@ export async function createApp(options) {
110
92
  const blocking = diagnostics.filter((d) => d.severity === 'blocking');
111
93
  log.info(`read ${fronds.length} frond(s) in ${scanMs}ms`
112
94
  + (diagnostics.length ? ` — ${diagnostics.length} thing(s) the scan could not do` : ''));
113
- /**
114
- * Say what could not be read, at the one line everyone already watches.
115
- *
116
- * Not a refusal: an app whose `presenters/` is unreadable still serves its
117
- * entities, and stopping the boot would trade a partial app for none. But it is
118
- * an ERROR, not a debug line — the app now serves less than its source declares,
119
- * and nothing downstream can tell that from a source that declares less.
120
- */
95
+ /** Say what could not be read, at the one line everyone already watches. */
121
96
  for (const d of blocking)
122
97
  log.error(`[${d.code}] ${d.message}`, d.cause);
123
98
  for (const d of diagnostics)
124
99
  if (d.severity === 'warning')
125
100
  log.warn(`[${d.code}] ${d.message}`);
126
- /**
127
- * An ambiguous convention is not a partial scan. Every relevant declaration was read,
128
- * but more than one executable contract can be built from it. Refuse before auth,
129
- * storage, migrations or seeds make the boot observable.
130
- */
101
+ /** An ambiguous convention is not a partial scan. */
131
102
  const invalidOperations = operationModel.resolutionDiagnostics
132
103
  .filter((diagnostic) => diagnostic.severity === 'blocking');
133
104
  if (invalidOperations.length > 0) {
@@ -153,7 +124,7 @@ export async function createApp(options) {
153
124
  });
154
125
  log.info(`auth ready — mounted at ${authRuntime.basePath}`);
155
126
  }
156
- // Remote routing — judged at boot: declaring remotes without a transport is a config error.
127
+ // Remote routing — validated at boot: declaring remotes without a transport is a config error.
157
128
  // A remote declaration wins over local presence: `remotes: { blog: url }` IS
158
129
  // the topology statement — the frond's code may sit in fronds/**, it runs elsewhere.
159
130
  const declaredRemotes = Object.entries(options.remotes ?? {});
@@ -180,7 +151,7 @@ export async function createApp(options) {
180
151
  return [...globalMiddlewares, ...scoped];
181
152
  }
182
153
  assertOneOwnerPerKey(fronds, options.remotes);
183
- // Every entity of every frond, by name — so a fact can be judged where it LANDS, and
154
+ // Every entity of every frond, by name — so a fact can be validated where it LANDS, and
184
155
  // so a `reads:` clause can name a neighbour's.
185
156
  const entityByName = fronds.schemas();
186
157
  // Which frond holds an entity — what turns "a member is remote" into a refusal that
@@ -244,7 +215,7 @@ export async function createApp(options) {
244
215
  refuseStorageInUserCode(frond, owners, (entity) => entityByName.has(entity));
245
216
  refuseCrudOnOwned(frond, owners);
246
217
  for (const provider of frond.providers) {
247
- scope.register(provider.ctor.name, provider.ctor, { deps: provider.deps });
218
+ scope.register(nameOf(provider), provider.ctor, { deps: provider.deps });
248
219
  }
249
220
  // …and again under the port each one extends, so `private payment: Payment`
250
221
  // reaches the realization instead of the base class it is declared against.
@@ -256,13 +227,18 @@ export async function createApp(options) {
256
227
  frondLog.debug(`port ${port} → ${impl.ctor.name}`);
257
228
  }
258
229
  if (frond.providers.length > 0) {
259
- frondLog.debug(`${frond.providers.length} provider(s): ${frond.providers.map((p) => p.ctor.name).join(', ')}`);
230
+ frondLog.debug(`${frond.providers.length} provider(s): ${frond.providers.map(nameOf).join(', ')}`);
260
231
  }
261
232
  // Register Storage for each entity — PascalCase type name (e.g. 'PostStorage')
262
233
  // When a handler declares Crud(Entity, Output), scope the storage via .output(Output)
263
234
  if (options.storageFactory) {
235
+ const unenforced = [];
264
236
  for (const entity of frond.entities) {
265
237
  const key = storageKeyOf(entity.name);
238
+ const source = options.sourceOf?.(entity.name) ?? 'db';
239
+ if (declares(entity.entityClass, 'unique') && options.enforces?.(source, 'unique') === false) {
240
+ unenforced.push(`${entity.name} in '${source}'`);
241
+ }
266
242
  const baseStorage = options.storageFactory(entity.entityClass, entity.name);
267
243
  // Check if the default handler (no surface) declares an output override
268
244
  const defaultHandler = frond.handlers.find((h) => h.address === entity.name && !h.surface);
@@ -294,6 +270,12 @@ export async function createApp(options) {
294
270
  if (frond.entities.length > 0) {
295
271
  frondLog.debug(`${frond.entities.length} entity storage(s): ${frond.entities.map((e) => e.name).join(', ')}`);
296
272
  }
273
+ // The judge refuses a duplicate it can SEE — the row already stored. Two writes arriving
274
+ // together see the same absence, and only the place they land can refuse the second.
275
+ if (unenforced.length > 0) {
276
+ frondLog.warn(`unique declared, and the source does not enforce it: ${unenforced.join(', ')} — `
277
+ + 'two concurrent writes can both pass');
278
+ }
297
279
  }
298
280
  // Frames, after the ORMs and before anything that may ask for one. A frame is read
299
281
  // from the same `deps` every other port is read from — asking for it IS declaring it,
@@ -304,6 +286,7 @@ export async function createApp(options) {
304
286
  hostedHere: (name) => !(options.remotes && name in options.remotes),
305
287
  storageFactory: options.storageFactory,
306
288
  sourceOf: options.sourceOf,
289
+ transacts: options.transacts,
307
290
  transacted: options.transacted,
308
291
  log: frondLog,
309
292
  });
@@ -330,22 +313,24 @@ export async function createApp(options) {
330
313
  const defaultHandlerMap = new Map(defaultHandlers.map((h) => [h.address, h]));
331
314
  /** Build the door of a handler and register it under the audience it serves. */
332
315
  const buildFacade = (entity, handler, targetScope, facadeKey) => {
333
- const facade = new HandlerFacade({
334
- handler,
335
- handlers: frond.handlers,
336
- entity,
337
- scope: targetScope,
316
+ if (inheritsCrud(handler.ctor) && !entity) {
317
+ // An installed Crud subject may be absent from the local scan.
318
+ frondLog.debug(`${handler.ctor.name} extends Crud() and no scanned entity is named `
319
+ + `'${subjectOf(handler.ctor, handler.address)}' — installed entity, or a missing `
320
+ + `one: no storage will be injected`);
321
+ }
322
+ const facade = new HandlerFacade(handler, targetScope, {
338
323
  key: facadeKey,
339
- operations: operationModel.forHandler(handler),
340
- }, {
341
324
  frond: frond.name,
342
- frondScope: scope,
343
- log: frondLog,
325
+ handlers: frond.handlers,
326
+ operations: operationModel.forHandler(handler),
344
327
  collectors: collectorTypeNames,
345
- presenters: presenterMap,
346
- middlewaresFor: getMiddlewares,
347
- emissions,
328
+ presenter: presenterMap.get(handler.address),
329
+ presenterScope: scope,
330
+ middlewares: () => getMiddlewares(handler.address),
348
331
  });
332
+ // Emissions use the same contracts and execution path as direct calls.
333
+ emissions.note(facade.contracts, facadeKey);
349
334
  // The terms alongside the door, under the same audience — a surface that serves
350
335
  // fewer ops describes fewer ops.
351
336
  container.registerValue(contractsKeyOf(handler.address, handler.surface), facade.contracts);
@@ -366,11 +351,11 @@ export async function createApp(options) {
366
351
  operation,
367
352
  ...(surface !== undefined ? { surface } : {}),
368
353
  });
369
- routeRegistry.register(new OperationRoute('local', address, (call) => facade.ops[operation](call.invocation)));
354
+ routeRegistry.register(new OperationRoute('local', address, (call) => facade.execute(operation, call.invocation)));
370
355
  }
371
356
  }
372
- const entry = new FacadeEntry(handler.surface ? localDispatcher : dispatcher, handler.address, routeRegistry.operationNames(handler.address, handler.surface), handler.surface);
373
- container.registerValue(facadeKey, entry.operations);
357
+ const operations = facadeOperations(handler.surface ? localDispatcher : dispatcher, handler.address, routeRegistry.operationNames(handler.address, handler.surface), handler.surface);
358
+ container.registerValue(facadeKey, operations);
374
359
  };
375
360
  // A presenter is about an entity — computed fields sit on a shape — so this walks
376
361
  // entities. Exposing the instance lazily; the bridge resolves it on first access.
@@ -432,7 +417,14 @@ export async function createApp(options) {
432
417
  const scoped = outputSchema && outputSchema !== entity.entityClass
433
418
  ? baseStorage.output(outputSchema)
434
419
  : baseStorage;
435
- const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name).guard(scoped);
420
+ // The view is handed over so a filter on a field this door hides is SAID. The
421
+ // guard holds no logger — a warning is the boot's to voice, as a seed's report is.
422
+ const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name, {
423
+ ...(outputSchema && outputSchema !== entity.entityClass
424
+ ? { view: outputSchema.getFields() }
425
+ : {}),
426
+ outOfView: (message) => frondLog.warn(message),
427
+ }).guard(scoped);
436
428
  surfaceScope.registerValue(storageKeyOf(entity.name), guarded);
437
429
  surfaceScope.registerValue(repositoryKeyOf(entity.name), guarded);
438
430
  }
@@ -468,17 +460,7 @@ export async function createApp(options) {
468
460
  }
469
461
  // Once every door exists: what is announced here and what is listened to are both known.
470
462
  emissions.register();
471
- /**
472
- * The last resort, held by the container so every resolution path shares it.
473
- *
474
- * It used to live on `app.resolve` alone, which meant the runner found a remote façade
475
- * and dependency injection did not — a handler asking for a neighbour that had moved
476
- * got `is not registered` while the very same call over the wire worked. One door now.
477
- *
478
- * Surface-scoped keys ('admin:productHandler') stay local: a named surface resolves in
479
- * this container only, so fabricating one for a remote frond would answer NOT_FOUND on
480
- * everything (see Known issues).
481
- */
463
+ /** The last resort, held by the container so every resolution path shares it. */
482
464
  container.setFallback?.((name) => {
483
465
  if (!remoteRouter)
484
466
  return undefined;
@@ -488,15 +470,11 @@ export async function createApp(options) {
488
470
  // `lowerFirst` because a DEPENDENCY names the type as written — `ProductHandler`,
489
471
  // PascalCase — while a card declares `product`, so the raw strip asked the router for
490
472
  // 'Product' and every by-type dependency on a remote handler answered NOT_FOUND.
491
- return new FacadeEntry(dispatcher, lowerFirst(name.replace(/Handler$/, ''))).operations;
473
+ return facadeOperations(dispatcher, lowerFirst(name.replace(/Handler$/, '')));
492
474
  });
493
475
  /**
494
- * Everything this app holds, let go in reverse of how it was taken: what an extension
495
- * took on last, then the container's own, then whoever handed a resource in.
496
- *
497
- * It does NOT wait for running calls — `drain()` is that, and it is a separate gesture
498
- * because waiting and releasing do not have the same owner: a test releases at once, a
499
- * host turning the ring wants the work finished first.
476
+ * Everything this app holds, let go in reverse of how it was taken: what an extension took on
477
+ * last, then the container's own, then whoever handed a resource in.
500
478
  */
501
479
  const release = async () => {
502
480
  // Every level is told to close even when one refuses, and the refusals leave together —
@@ -521,13 +499,7 @@ export async function createApp(options) {
521
499
  throw new AggregateError(refused, `${refused.length} refusal(s) while releasing the app`);
522
500
  }
523
501
  };
524
- /**
525
- * Stop taking calls, and resolve once the ones already running are done.
526
- *
527
- * Refuses on `timeoutMs` rather than resolving anyway: a drain that gives up quietly
528
- * reads exactly like a drain that succeeded, and the caller — who is about to release
529
- * a storage connection under whatever is left — is the one who must decide.
530
- */
502
+ /** Stop taking calls, and resolve once the ones already running are done. */
531
503
  const drain = async (timeoutMs) => {
532
504
  inflight.close();
533
505
  if (timeoutMs === undefined)
@@ -577,28 +549,7 @@ export async function createApp(options) {
577
549
  return undefined;
578
550
  }
579
551
  };
580
- /**
581
- * THE membership rule, stated once — every projection reads this and nothing
582
- * else. It used to live twice, verbatim, in the REST and GraphQL adapters,
583
- * and two other readers invented their own answer.
584
- *
585
- * Naming an audience closes it. Two ways to name an entity into a surface,
586
- * in precedence order:
587
- * - `surfaces:` in frond.config.ts — when the list exists, it IS the list;
588
- * - a handler under `handlers/<surface>/` — which also restricts the façade.
589
- * `@expose` is a THIRD way and this rule does not read it: the scan sets a
590
- * boolean, read by the two adapters and by `exposedAdapters` — never here.
591
- * What neither of the two names is not served. It used to be the reverse: no
592
- * `public:categoryHandler` meant the FULL CategoryHandler rode the public
593
- * door, create/update/delete included (measured on demos/nuxt-blog).
594
- *
595
- * A named entity with no façade of its own falls back to the default one —
596
- * that is not the old widening, it is the author saying "this one, as it is".
597
- * The leak was exposure with no statement behind it.
598
- *
599
- * A surface key stays local: a doublure serves whatever the remote's own door
600
- * serves, which is the remote's business and not ours to re-audience.
601
- */
552
+ /** THE membership rule, stated once — every projection reads this and nothing else. */
602
553
  const facadeFor = (entity, surface) => {
603
554
  if (!surface)
604
555
  return facadeAt(facadeKeyOf(entity), true);
@@ -612,12 +563,12 @@ export async function createApp(options) {
612
563
  return own;
613
564
  const fallback = facadeAt(facadeKeyOf(entity), false);
614
565
  return fallback
615
- ? new FacadeEntry(localDispatcher, entity, routeRegistry.operationNames(entity, surface), surface).operations
566
+ ? facadeOperations(localDispatcher, entity, routeRegistry.operationNames(entity, surface), surface)
616
567
  : undefined;
617
568
  };
618
569
  if (remoteRouter) {
619
570
  const remoteFacades = new Map();
620
- routeRegistry.addResolver(new RemoteRouteResolver((entity) => {
571
+ routeRegistry.addResolver(remoteRoutes((entity) => {
621
572
  const known = remoteFacades.get(entity);
622
573
  if (known)
623
574
  return known;
@@ -639,13 +590,8 @@ export async function createApp(options) {
639
590
  : undefined;
640
591
  };
641
592
  /**
642
- * The storage an entity is backed by — the dual of `facadeFor`, which serves its
643
- * client-facing door. Both are ways in; an entity that opens none of them still has rows.
644
- *
645
- * It resolves through the owning frond's scope, because that is where entity ORMs live:
646
- * `resolve('UserStorage')` reads the ROOT container and never finds one, so callers outside
647
- * the frond concluded there was no storage. The seed loop did exactly that, and skipped
648
- * every entity with no façade — the one case its own fallback existed for.
593
+ * The storage an entity is backed by — the dual of `facadeFor`, which serves its client-facing
594
+ * door.
649
595
  */
650
596
  const storageFor = (entity) => {
651
597
  const owner = fronds.owner(entity);
@@ -659,14 +605,7 @@ export async function createApp(options) {
659
605
  return undefined;
660
606
  }
661
607
  };
662
- /**
663
- * The presenter of an entity, resolved through its owning frond's scope.
664
- *
665
- * Same shape as `storageFor`, and it exists for the same reason: without it an adapter
666
- * has to spell the container key itself. `schema-graphql` did — a hand-written
667
- * `${Name}Presenter` — and a key respelled elsewhere finds nothing and says nothing
668
- * the day the convention moves, which is exactly the failure `verify.ts` refuses.
669
- */
608
+ /** The presenter of an entity, resolved through its owning frond's scope. */
670
609
  const presenterFor = (entity) => {
671
610
  const owner = fronds.owner(entity);
672
611
  if (!owner)
@@ -733,7 +672,22 @@ export async function createApp(options) {
733
672
  app.serveRpc('discover', (_invocation, surface) => identityCardOf(app, surface));
734
673
  // The last thing the boot does, and the first thing a release undoes. An extension may
735
674
  // await here — which is what a provider needing to OPEN something could never do.
736
- await appLifecycle.up(app);
675
+ //
676
+ // A refusal here has to release what the boot took, because the caller cannot: it handed
677
+ // `onDispose` over BEFORE this line and never receives the app that would carry it back.
678
+ // Whoever opened a connection to give it to us would otherwise leak it on every failed boot.
679
+ try {
680
+ await appLifecycle.up(app);
681
+ }
682
+ catch (cause) {
683
+ try {
684
+ await release();
685
+ }
686
+ catch (refused) {
687
+ 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)}`);
688
+ }
689
+ throw cause;
690
+ }
737
691
  return app;
738
692
  }
739
693
  //# sourceMappingURL=bootstrap.js.map