@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
package/src/identity.ts CHANGED
@@ -1,35 +1,4 @@
1
- /**
2
- * Who is calling — the proof, not the claim.
3
- *
4
- * `InvocationContext.state` is what a caller SAYS about itself, and a split receiver
5
- * used to believe it: identity read straight off the wire, so a reader could post
6
- * `{ state: { user: { role: 'admin' } } }` and be one. This module is what turns that
7
- * sack into something a receiver establishes instead of accepts.
8
- *
9
- * Two signatures, one public key to distribute:
10
- *
11
- * GRANT the root says "this key is `blog`" — issued once, at deployment
12
- * ENVELOPE `blog` says "here is my whole call" — signed per call
13
- *
14
- * The envelope binds the CALL and not only its state: address, params, query, a digest
15
- * of the body. Signing the state alone proved WHO without proving WHAT, so anyone on the
16
- * wire could replay a captured envelope against another operation for as long as it
17
- * stayed valid — `post.list` re-sent as `post.delete`, same signature, still good.
18
- *
19
- * A receiver holds the root's public key and nothing else: it validates any frond it
20
- * has never seen, which is what a per-caller list could not do. The private root key
21
- * signs grants and never leaves the machine that issued them.
22
- *
23
- * Ed25519 and a JWS-shaped grant rather than X.509: node can PARSE a certificate but
24
- * not ISSUE one, so a real chain would mean openssl or a library. The grant says the
25
- * same thing — a name bound to a public key, signed by the root — with no dependency.
26
- *
27
- * The Ed25519 itself comes through `#crypto`, which has two realizations: `node:crypto`
28
- * everywhere, WebCrypto under `workerd`. Everything here is therefore async — WebCrypto
29
- * has no synchronous form — and a key is parsed ONCE, into a `Signer` or a `Verifier`,
30
- * never per call. Making the keys and issuing grants happen at a deployment and live in
31
- * `identity-keys.ts`, on the Node entry.
32
- */
1
+ /** Who is calling — the proof, not the claim. */
33
2
  import { crypto } from '#crypto';
34
3
  import type { PublicJwk, Signer, Verifier } from './crypto/port.js';
35
4
  import { b64url, unb64url, bytesOf, textOf, unb64 } from './crypto/encoding.js';
@@ -50,13 +19,13 @@ export interface FrondIdentity {
50
19
  grant: string;
51
20
  }
52
21
 
53
- /** The body's fingerprint. Absence and explicit null are different signed calls. */
54
- async function digestOf(body: unknown): Promise<string> {
22
+ /** The input's fingerprint. Absence and explicit null are different signed calls. */
23
+ async function digestOf(input: unknown): Promise<string> {
55
24
  // The tag is outside the caller value, so no user object can collide with it. JSON's
56
25
  // own omission rule still applies inside `value`, matching what crosses the wire.
57
- const canonical = body === undefined
26
+ const canonical = input === undefined
58
27
  ? { kind: 'undefined' }
59
- : { kind: 'value', value: body };
28
+ : { kind: 'value', value: input };
60
29
  return b64url(await crypto.sha256(bytesOf(JSON.stringify(canonical))));
61
30
  }
62
31
 
@@ -67,7 +36,7 @@ async function boundTo(call: SignedCall) {
67
36
  op: call.op,
68
37
  params: call.params ?? {},
69
38
  query: call.query ?? {},
70
- body: await digestOf(call.body),
39
+ input: await digestOf(call.input),
71
40
  };
72
41
  }
73
42
 
@@ -85,11 +54,7 @@ async function signJws(header: object, payload: object, signer: Signer): Promise
85
54
  return `${signingInput}.${b64url(await signer.sign(bytesOf(signingInput)))}`;
86
55
  }
87
56
 
88
- /**
89
- * The payload, once the signature holds. Throws rather than returning a falsy value:
90
- * every caller here is deciding whether to admit a call, and an unverified payload
91
- * must never be reachable by forgetting a check.
92
- */
57
+ /** The payload, once the signature holds. */
93
58
  async function verifyJws(token: string, verifier: Verifier, what: string): Promise<Record<string, unknown>> {
94
59
  const parts = token.split('.');
95
60
  if (parts.length !== 3) throw new Error(`Malformed ${what}`);
@@ -111,13 +76,7 @@ function headerOf(token: string): Record<string, unknown> {
111
76
  return JSON.parse(textOf(unb64url(encodedHeader))) as Record<string, unknown>;
112
77
  }
113
78
 
114
- /**
115
- * Sign one call, whole: who is asking, what is asked, and on whose behalf.
116
- *
117
- * The private key is parsed on every call here, which is the convenience form. A process
118
- * that signs in a request path builds its signer once — `identityFromEnv` does exactly
119
- * that, and `sign` on the value it returns holds the parsed key.
120
- */
79
+ /** Sign one call, whole. */
121
80
  export async function signEnvelope(identity: FrondIdentity, call: SignedCall): Promise<string> {
122
81
  return sealWith(await crypto.signerOf(identity.privateKey), identity.grant, call);
123
82
  }
@@ -133,11 +92,7 @@ async function sealWith(signer: Signer, grant: string, call: SignedCall): Promis
133
92
  );
134
93
  }
135
94
 
136
- /**
137
- * Establish the caller, or throw. Order matters: the grant is checked against the ROOT
138
- * first, and only the key it carries verifies the envelope — reading the envelope's own
139
- * claim of who it is before that would be believing the thing under examination.
140
- */
95
+ /** Establish the caller, or throw. */
141
96
  export async function verifyEnvelope(token: string, rootPublicKey: string, presented: SignedCall): Promise<VerifiedCall> {
142
97
  return openWith(await crypto.verifierOf(rootPublicKey), token, presented);
143
98
  }
@@ -173,13 +128,7 @@ async function openWith(root: Verifier, token: string, presented: SignedCall): P
173
128
 
174
129
  /** The two halves a boot needs, and the environment they come from. */
175
130
  export interface CallIdentity {
176
- /**
177
- * Signs an outgoing call, whole. Absent when this process holds no key — it only answers.
178
- *
179
- * A promise because WebCrypto has no synchronous form. On Node the work stays
180
- * synchronous inside and only the answer is wrapped: measured at 14.28 µs awaited
181
- * against 14.30 µs called directly, while WebCrypto on the same curve costs 22.72.
182
- */
131
+ /** Signs an outgoing call, whole. */
183
132
  sign?: (call: SignedCall) => Promise<string>;
184
133
  /** Establishes an incoming caller, against the call that actually arrived. */
185
134
  verify?: (identity: string, presented: SignedCall) => Promise<VerifiedCall>;
@@ -187,29 +136,12 @@ export interface CallIdentity {
187
136
  requireIdentity: boolean;
188
137
  }
189
138
 
190
- /**
191
- * A PEM, however the deployment chose to carry it.
192
- *
193
- * A PEM is multi-line and an environment variable that spans lines survives poorly —
194
- * docker-compose, systemd and CI secret stores each mangle it differently — so
195
- * `fougere keys` prints base64. Both forms are read here rather than one being decreed:
196
- * a human pasting a real PEM is not making a mistake.
197
- */
139
+ /** A PEM, however the deployment chose to carry it. */
198
140
  function pemOf(value: string): string {
199
141
  return value.trimStart().startsWith('-----') ? value : textOf(unb64(value));
200
142
  }
201
143
 
202
- /**
203
- * What the deployment injected, read once at boot.
204
- *
205
- * Three variables, no config key: a private key never belongs in a committed file, and
206
- * `fougere keys` prints exactly these. A process may hold either half or both — a frond
207
- * that only answers has no key, one that only calls trusts no root, one in the middle
208
- * does both.
209
- *
210
- * Trusting a root IS asking to refuse: there is no separate flag, because a deployment
211
- * that names an authority and then accepts unsigned calls has said two things at once.
212
- */
144
+ /** What the deployment injected, read once at boot. */
213
145
  export async function identityFromEnv(env: Record<string, string | undefined> = envOfProcess()): Promise<CallIdentity> {
214
146
  const root = env.FOUGERE_ROOT_KEY ? pemOf(env.FOUGERE_ROOT_KEY) : undefined;
215
147
  const privateKey = env.FOUGERE_KEY ? pemOf(env.FOUGERE_KEY) : undefined;
package/src/imports.ts CHANGED
@@ -1,31 +1,8 @@
1
- /**
2
- * A frond reaching into another one by FILE PATH.
3
- *
4
- * `verify()` next door answers the same question — does this app survive a split? — from
5
- * the MODEL: what a constructor asks for, what a parameter is typed. This one can only be
6
- * answered from the source text, so it reads files and lives apart rather than making
7
- * `verify` lose the sentence that says it reads none.
8
- *
9
- * ```ts
10
- * import User from '../../user/entities/User.js'; // these two folders are neighbours
11
- * import User from '@fronds/user/entities/User'; // I depend on the frond named user
12
- * ```
13
- *
14
- * Both resolve today, and that is exactly the trap: a frond declared in `remotes:` is
15
- * still scanned, its code is still on this disk, so the relative form keeps working right
16
- * up to the day the folder is not there — an extraction into its own repository, an image
17
- * that copies one frond. Then it fails at build time, with a message about a file path
18
- * that says nothing about the model.
19
- *
20
- * So a relative path across a boundary is not a bug. It is a **colocation constraint that
21
- * nothing declares**: real, load-bearing, and invisible to the scan, to the identity card
22
- * and to `remotes:`. The named form states the same dependency in terms the model can
23
- * read — and it is the form `fougere sync` writes, so it survives the move.
24
- */
1
+ /** A frond reaching into another one by FILE PATH. */
25
2
  import type ts from '@typescript/typescript6';
26
3
  import { readdir, readFile } from 'node:fs/promises';
27
4
  import { join, resolve, dirname, relative, isAbsolute } from 'node:path';
28
- import type { FrondDescriptor } from './scan/frond.js';
5
+ import type { FrondDescriptor } from './descriptor/frond.js';
29
6
 
30
7
  let _ts: typeof ts | undefined;
31
8
  async function loadTs(): Promise<typeof ts> {
@@ -71,13 +48,7 @@ async function sourcesUnder(dir: string): Promise<string[]> {
71
48
  return out;
72
49
  }
73
50
 
74
- /**
75
- * Every relative import that resolves outside its own frond.
76
- *
77
- * `preProcessFile` rather than a regex or a full parse: it is TypeScript's own scanner for
78
- * exactly this question, so `// import x from '../../other'` in a comment is not a finding
79
- * and a specifier split across lines still is.
80
- */
51
+ /** Every relative import that resolves outside its own frond. */
81
52
  export async function crossFrondImports(
82
53
  fronds: readonly Pick<FrondDescriptor, 'name' | 'source'>[],
83
54
  ): Promise<CrossFrondImport[]> {
package/src/index.ts CHANGED
@@ -1,16 +1,7 @@
1
- /**
2
- * What a consumer writes, and nothing else.
3
- *
4
- * `exports` publishes this barrel and `./contract`, so an import that is not here
5
- * cannot be reached from outside the package at all — which is what makes this file
6
- * the contract rather than a convenience. The machinery the boot uses to keep its own
7
- * promises stays inside: container keys, the binding plan, the mixin's runtime
8
- * accessors, the config merge. Measured on 2026-08-16, none of them had a single
9
- * importer anywhere in the workspace.
10
- */
1
+ /** What a consumer writes, and nothing else. */
11
2
  export { createApp } from './boot/bootstrap.js';
12
3
  export { orderSeeds, runSeeds, seeding } from './boot/seed.js';
13
- export { AppLifecycle, AppLifecycle as Lifecycle, migrating } from './boot/AppLifecycle.js';
4
+ export { AppLifecycle, migrating } from './boot/AppLifecycle.js';
14
5
  export type { Extension } from './boot/AppLifecycle.js';
15
6
  export { defineFougere } from './define.js';
16
7
  export type { AdapterConfig, FougereConfig } from './config-loader.js';
@@ -24,33 +15,33 @@ export { Presenter } from './prefab/presenter.js';
24
15
  export type { PresenterViews } from './prefab/presenter.js';
25
16
  export { Collector } from './prefab/collector.js';
26
17
  export { Repository, type RepositoryOf, type RepositoryConstructor, type AggregateOf, type AggregateConstructor } from './prefab/repository.js';
27
- export { Invocation, canonicalInvocation, EMPTY_INVOCATION } from './contract/Invocation.js';
28
- export type { InvocationContext, InvocationInput } from './contract/Invocation.js';
29
- export { Call } from './contract/Call.js';
30
- export { RouteAddress } from './contract/RouteAddress.js';
31
- export type { RouteAddressInput } from './contract/RouteAddress.js';
18
+ export { Invocation, canonicalInvocation, EMPTY_INVOCATION } from './wire/Invocation.js';
19
+ export type { InvocationContext, PartialInvocation } from './wire/Invocation.js';
20
+ export { Call } from './wire/call.js';
21
+ export { RouteAddress } from './wire/RouteAddress.js';
22
+ export type { RouteAddressInput } from './wire/RouteAddress.js';
32
23
  export { DispatchLifecycle } from './dispatch/DispatchLifecycle.js';
33
24
  export { Dispatcher } from './dispatch/Dispatcher.js';
34
25
  // The class and not only its type: an observer RECEIVES these, so a package that folds
35
26
  // them — or a test of one — has to be able to make one through the door.
36
27
  export { DispatchEvent } from './dispatch/DispatchEvent.js';
37
- export type { CallPage, CallRecord } from './contract/CallLog.js';
28
+ export type { CallPage, CallRecord } from './wire/CallLog.js';
38
29
  export { driftOf, agrees, explain, type CardDrift } from './wire/drift.js';
39
30
  export type { DispatchObserver } from './dispatch/DispatchEvent.js';
40
31
  export type { DispatchPort } from './dispatch/DispatchPort.js';
41
32
  export {
42
33
  inferOperationKind,
43
- resolveContracts,
44
34
  resolveIsReadOp,
45
35
  resolveOperationKind,
46
36
  } from './wire/operation.js';
37
+ export { resolveContracts } from './effective-operation.js';
47
38
  export type {
48
39
  OperationContract,
49
40
  OperationKind,
50
41
  OperationKindInference,
51
42
  OperationsMap,
52
- ParsedParam,
53
- ParsedType,
43
+ Param,
44
+ TypeRef,
54
45
  } from './wire/operation.js';
55
46
  export {
56
47
  EFFECTIVE_OPERATION_SEMANTICS,
@@ -67,16 +58,17 @@ export type {
67
58
  export type { ModuleLoader } from './loader.js';
68
59
  export { FougereError, ErrorCode, validationErrorsOf, type FougereErrorOptions } from './wire/errors.js';
69
60
  export type { OperationContext, AppNext, AppMiddleware } from './wire/middleware.js';
70
- export { createLocalRunner, createAppRunner, assertIdentityCard, RPC_ENTITY, MAX_BODY_BYTES } from './wire/call.js';
61
+ export { assertIdentityCard, RPC_ENTITY, MAX_BODY_BYTES } from './wire/call.js';
62
+ export { createLocalRunner, createAppRunner } from './boot/runner.js';
71
63
 
72
64
  // A frond an app STATES, for a boot that will not scan. No disk, no `typescript` — which
73
65
  // is why it sits here and not in `/node`, beside the scanner that reads a project.
74
- export { frond } from './scan/declare.js';
75
- export type { FrondDeclaration, Declared, DeclaredSubject } from './scan/declare.js';
66
+ export { frond } from './declare.js';
67
+ export type { FrondDeclaration, Declared, DeclaredSubject } from './declare.js';
76
68
  // What this app would answer to `rpc.discover`. Served by the boot, and reached until now
77
69
  // only by tests through a deep path — a consumer comparing its own card to a producer's
78
70
  // had to dispatch a call to ask a question about itself.
79
- export { identityCardOf } from './wire/call.js';
71
+ export { identityCardOf } from './boot/card.js';
80
72
  export type {
81
73
  FrondCall, Transport, IdentityCard, CardOp, Facade, RpcAnswer,
82
74
  TopologyReport, FrondPlacement, Edge,
@@ -86,17 +78,20 @@ export { callValueOf } from './contract.js';
86
78
  export type { CallValue } from './contract.js';
87
79
  export { toHttpError, toPublicError } from './wire/http-error.js';
88
80
  export { loggerMiddleware } from './wire/loggerMiddleware.js';
89
- export { Logger, setLogLevel, logLevel, envLevel, onLog } from './builtins/logger.js';
90
- export type { LogLevel, LogRecord, LogSink } from './builtins/logger.js';
81
+ export { Logger, setLogLevel, logLevel, envLevel, onLog } from './builtin/logger.js';
82
+ export type { LogLevel, LogRecord, LogSink } from './builtin/logger.js';
91
83
  // What a re-read config changes in a running process — and what it cannot.
92
84
  export { applyConfig, type ConfigApplication } from './boot/apply.js';
93
- export { Config } from './builtins/config.js';
94
- export type { EntityOrm, OrmFactory, ListOptions, ListResult, Together } from './orm.js';
95
- export { togetherKeyOf, membersOfTogetherKey } from './orm.js';
85
+ export { Config } from './builtin/config.js';
86
+ export type { Storage, StorageFactory, ListOptions, ListResult, Together } from './storage.js';
87
+ export { togetherKeyOf, membersOfTogetherKey } from './storage.js';
88
+ export type { Source, SourceConfig, SourceView } from './source.js';
89
+ export { Sources } from './source.js';
90
+ export { storageOver } from './store.js';
91
+ export type { Store, Values } from './store.js';
96
92
  export type { App, CreateAppOptions } from './boot/types.js';
93
+ export type { ScanResult, ScanDiagnostic } from './scan/result.js';
97
94
  export type {
98
- ScanResult,
99
- ScanDiagnostic,
100
95
  FrondDescriptor,
101
96
  FrondSource,
102
97
  ProviderEntry,
@@ -107,9 +102,9 @@ export type {
107
102
  PresenterEntry,
108
103
  PresenterFieldMeta,
109
104
  CollectorEntry,
110
- } from './scan/frond.js';
105
+ } from './descriptor/frond.js';
111
106
  export type { AuthConfig, AuthContext, AuthRuntime } from './boot/auth.js';
112
- export { Fronds } from './scan/Fronds.js';
107
+ export { Fronds } from './descriptor/Fronds.js';
113
108
  export { verify, assertSplittable, type Violation } from './verify.js';
114
109
  // Same question as verify(), answered from the source text instead of the model.
115
110
  export type { CrossFrondImport } from './imports.js';
package/src/loader.ts CHANGED
@@ -1,21 +1,7 @@
1
- /**
2
- * How a source file becomes a module — one registry, two readers.
3
- *
4
- * The scanner loads fronds and `config-loader` loads a config, and both must use the
5
- * loader the host installed: a TS file needs jiti under Nuxt and plain `import` under
6
- * tsx. It lived in `scan/scanner.ts`, so reading a config dragged the scanner, its AST
7
- * parser and the TypeScript compiler behind it.
8
- */
1
+ /** How a source file becomes a module — one registry, two readers. */
9
2
  import { pathToFileURL } from 'node:url';
10
3
 
11
- /**
12
- * Module loader — can be swapped (e.g. jiti for TS files in Nuxt context).
13
- *
14
- * `fresh` asks for a file that may have changed since it was last read. Every loader
15
- * caches, so without it a second read of an EDITED file hands back the first one —
16
- * which is what re-reading a config is for. A loader that cannot honour it may ignore
17
- * the flag; it then answers with what it already had.
18
- */
4
+ /** Module loader — can be swapped (e.g. */
19
5
  export type ModuleLoader = (
20
6
  filePath: string,
21
7
  options?: { fresh?: boolean },
package/src/node.ts CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * What Fougere does with a filesystem — the half of core that a Worker cannot run.
3
- *
4
- * The line is not "build vs runtime": `boot()` and `loadConfig` run in production, on a
5
- * server, every time. It is whether the thing reaches for a disk. Everything here does,
6
- * transitively, and nothing on the main entry does — which is what lets a bundler for a
7
- * runtime without `node:fs` trace the main entry and find no builtin at all.
8
- *
9
- * The third entry, `@fougere/core/contract`, answers a different question: what crosses a
10
- * process boundary. A foreign frond reads it without reading our boot.
11
- */
1
+ /** What Fougere does with a filesystem — the half of core that a Worker cannot run. */
12
2
  export { boot } from './boot/boot.js';
13
3
 
14
4
  export { scanProject, frondAliases, watchPathsOf } from './scan/scanner.js';
@@ -23,6 +13,7 @@ export { setModuleLoader, getModuleLoader } from './loader.js';
23
13
  export { loadConfig, loadCascadedConfig } from './config-loader.js';
24
14
  export { defineFrond } from './frond-config.js';
25
15
  export { crossFrondImports } from './imports.js';
16
+ export { adaptersOf } from './scan/adapters.js';
26
17
 
27
18
  // Making a key and binding a name to it happen once, at a deployment, on a machine with
28
19
  // a filesystem — the CLI speaking. Verifying happens per call, everywhere, and stays on
@@ -1,25 +1,4 @@
1
- /**
2
- * Collector(Type) — resolves one handler input parameter from the invocation context.
3
- *
4
- * The target is a NAME matched against the parameter's type, never a schema: nothing
5
- * here nor in the scan reads its fields. So `Ability`, built per call from state, sits
6
- * beside `User`, loaded from a row.
7
- *
8
- * The dual of Presenter only in direction. A presenter's subject is a ROW — it adds
9
- * computed fields to one, so its target must be an entity. A collector's subject is a
10
- * PARAMETER.
11
- *
12
- * Usage:
13
- * ```ts
14
- * export default class UserCollector extends Collector(User) {
15
- * constructor(private userOrm: UserOrm) { super(); }
16
- *
17
- * async collect(ctx: InvocationContext) {
18
- * return this.userOrm.findById(ctx.state.userId as string);
19
- * }
20
- * }
21
- * ```
22
- */
1
+ /** Collector(Type) — resolves one handler input parameter from the invocation context. */
23
2
 
24
3
  import { upperFirst } from '@fougere/schema';
25
4
 
@@ -1,48 +1,42 @@
1
- import type { EntityOrm, ListOptions, ListResult } from '../orm.js';
1
+ import { lowerFirst, type EntityConstructor, type SchemaView } from '@fougere/schema';
2
+ import type { Storage, ListOptions, ListResult } from '../storage.js';
2
3
  import type { OperationContract } from '../wire/operation.js';
3
- import type { EntityConstructor, SchemaView } from '@fougere/schema';
4
+ import { targetOf } from './prefab.js';
4
5
 
5
- /** The id of the row an op acts on — a route segment, or a query fallback. */
6
- const byId = { name: 'id', source: { kind: 'param' as const, name: 'id' }, optional: false };
7
- const fromBody = { name: 'input', source: { kind: 'body' as const }, optional: false };
6
+ /**
7
+ * So a class is recognized by what it ANSWERS, since the mixin leaves no other trace.
8
+ * FR : pour qu'une classe se reconnaisse à ce qu'elle répond, le mixin ne laissant rien d'autre.
9
+ * `inheritsCrud(class PostHandler extends Crud(Post) {})` → `true`
10
+ */
11
+ export function inheritsCrud(ctor: unknown): boolean {
12
+ const proto = (ctor as { prototype?: Record<string, unknown> } | undefined)?.prototype;
13
+
14
+ return typeof proto?.list === 'function' && typeof proto?.findById === 'function';
15
+ }
8
16
 
9
17
  /**
10
- * The same five, written as the scan would have written them.
11
- *
12
- * `binding` says WHERE an argument is read from; it never says of what type, and a
13
- * GraphQL argument needs the type. So a producer that fills only `binding` leaves
14
- * `adapter/graphql` with nothing to declare — it drops the op (`registerOperations`,
15
- * `if (!sig) continue`) and four of the five CRUD ops vanish from the schema while
16
- * the façade and REST still serve them. Measured on an installed app: 16 handlers,
17
- * 14 with unresolvable heritage, zero `createX` in the schema.
18
+ * So storage follows the shape the handler was built on, which may differ from its address.
19
+ * FR : pour que le stockage suive la forme sur laquelle le handler est bâti.
20
+ * `subjectOf(class Draft extends Crud(Post) {}, 'draft')` → `'post'`
18
21
  */
22
+ export function subjectOf(ctor: unknown, address: string): string {
23
+ const target = targetOf(ctor);
24
+
25
+ return target?.name ? lowerFirst(target.name) : address;
26
+ }
27
+
28
+ /** The id of the row an op acts on — a route segment, or a query fallback. */
29
+ const byId = { name: 'id', source: { kind: 'param' as const, name: 'id' }, optional: false };
30
+ const fromBody = { name: 'input', source: { kind: 'input' as const }, optional: false };
31
+
32
+ /** The same five, written as the scan would have written them. */
19
33
  const idParam = { name: 'id', type: { raw: 'string', name: 'string' } };
20
34
  const inputParam = (entity: string) => ({ name: 'input', type: { raw: `Partial<${entity}>`, name: entity } });
21
35
  const returns = (raw: string, name: string, extra?: { array?: boolean; nullable?: boolean }) =>
22
36
  ({ raw, name, ...extra });
23
37
 
24
- /**
25
- * The five ops a Crud handler brings, declared rather than discovered.
26
- *
27
- * The mixin built them, so it alone knows their contract in full: what judges
28
- * their input, where each argument comes from. It says so on the class, at
29
- * runtime — which is what makes the guarantee independent of the AST scan (an
30
- * installed app cannot resolve this file, and never needs to).
31
- */
32
- /**
33
- * `output` says the entity, and saying it costs nothing at runtime.
34
- *
35
- * The façade already projected onto the entity when nothing else was named, so this
36
- * changes no result: `outputFieldsFor` reads `contractOutput` and falls back to the
37
- * entity, and both are the same shape here. What changes is that the sentence now
38
- * EXISTS — the identity card publishes `output` per op, and a card was measured
39
- * carrying none at all (2026-08-06, ten ops, zero outputs), which typed every remote
40
- * return as `unknown` for anyone building on it.
41
- *
42
- * It does not close the view: only an explicit `__opOutputs` does (`closed: perOp !==
43
- * undefined`), so a named view still wins and a presenter's computed fields still ride
44
- * out. `delete` names none — a boolean is not a shape.
45
- */
38
+ /** The five ops a Crud handler brings, declared rather than discovered. */
39
+ /** `output` says the entity, and saying it costs nothing at runtime. */
46
40
  function crudOps(entity: SchemaView & { partial?: () => SchemaView }): Record<string, OperationContract> {
47
41
  const name = (entity as { name?: string }).name ?? 'Entity';
48
42
  const input = inputParam(name);
@@ -76,15 +70,7 @@ function crudOps(entity: SchemaView & { partial?: () => SchemaView }): Record<st
76
70
  };
77
71
  }
78
72
 
79
- /**
80
- * The mixin's single "trust me" point — the twin of `asSchemaConstructor` in @fougere/schema.
81
- *
82
- * The implementation returns whatever the ORM hands back; the declaration names the view
83
- * each op emits at the port. TypeScript cannot connect the two (the view is a runtime
84
- * argument, the type is a generic), so one assertion states that the mixin honours what it
85
- * declared — and the façade makes it true, projecting each op's result onto its view
86
- * (`outputFieldsFor` in `bootstrap.ts`).
87
- */
73
+ /** The mixin's single "trust me" point — the twin of `asSchemaConstructor` in @fougere/schema. */
88
74
  function asCrudConstructor<T, V>(impl: object): CrudConstructor<T, V> {
89
75
  return impl as CrudConstructor<T, V>;
90
76
  }
@@ -95,12 +81,7 @@ export type CrudOpName = 'list' | 'findById' | 'create' | 'update' | 'delete';
95
81
  /** Which view each op speaks — omitted ops speak the entity, the trivial view. */
96
82
  export type CrudViews = Partial<Record<CrudOpName, EntityConstructor>>;
97
83
 
98
- /**
99
- * The view an op emits, fabricated: the one declared for it, the single view when the
100
- * whole handler declares one, the entity otherwise. `PostCard` is not a hand-written
101
- * type — `Post.pick(...)` derives it field by field, so an op's return is a projection
102
- * of the entity exactly like the entity is the projection that keeps everything.
103
- */
84
+ /** The view an op emits, fabricated. */
104
85
  type OutOf<V, K extends CrudOpName, T> =
105
86
  // Bracketed on purpose: a naked `V extends …` DISTRIBUTES, and the no-view default
106
87
  // is the empty map, whose `keyof` is `never` — distribution would then collapse
@@ -109,19 +90,9 @@ type OutOf<V, K extends CrudOpName, T> =
109
90
  : K extends keyof V ? (V[K] extends EntityConstructor ? InstanceType<V[K]> : T)
110
91
  : T;
111
92
 
112
- /**
113
- * The five ops, typed from the entity and its views.
114
- *
115
- * Two things the mixin declares but does not own. The **output** is the view the
116
- * handler names (`Crud(Post, { list: PostCard })`) — fabricated, so a redefinition
117
- * that returns cards stays assignable. The **trailing parameters** are resolved by
118
- * type from the container (`delete(id, user?: User)` gets its user from a
119
- * collector): the mixin cannot know them, they belong to the app, so it declares that
120
- * a tail exists and that it supplies none — which is what `never` says, and what keeps
121
- * a judged redefinition assignable.
122
- */
93
+ /** The five ops, typed from the entity and its views. */
123
94
  export interface CrudOps<T, V = {}> {
124
- orm: EntityOrm<T>;
95
+ storage: Storage<T>;
125
96
  list(options?: ListOptions, ...collected: never[]): Promise<ListResult<OutOf<V, 'list', T>>>;
126
97
  findById(id: string, ...collected: never[]): Promise<OutOf<V, 'findById', T> | undefined>;
127
98
  create(input: Partial<T>, ...collected: never[]): Promise<OutOf<V, 'create', T>>;
@@ -131,30 +102,17 @@ export interface CrudOps<T, V = {}> {
131
102
 
132
103
  /** The prefab handler class — its ops, plus the statics the bootstrap and adapters read. */
133
104
  export interface CrudConstructor<T, V = {}> {
134
- // `EntityOrm<T>`, not the bare `EntityOrm`: a handler that injects a second ORM has to
135
- // spell its own constructor, and `super(orm)` with the ORM the container hands it —
136
- // typed on the entity, as the `orm` property below already says — was refused.
137
- new (orm: EntityOrm<T>): CrudOps<T, V>;
105
+ // `Storage<T>`, not the bare `Storage`: a handler that injects a second storage has to
106
+ // spell its own constructor, and `super(storage)` with the storage the container hands it —
107
+ // typed on the entity, as the `storage` property below already says — was refused.
108
+ new (storage: Storage<T>): CrudOps<T, V>;
138
109
  readonly __entity: unknown;
139
110
  readonly __output: unknown;
140
111
  readonly __opOutputs?: CrudViews;
141
112
  readonly __ops: Record<string, OperationContract>;
142
113
  }
143
114
 
144
- /**
145
- * Mixin — extends Crud(Entity) to get all 5 typed CRUD methods.
146
- *
147
- * The second argument (optional) names the view the ops emit, and comes in two
148
- * spellings of one idea — a view per op, or one view for all five:
149
- *
150
- * Crud(Post) → every op emits Post
151
- * Crud(Post, { list: PostCard }) → list emits cards, the rest emit Post. Declaration
152
- * only: the handler keeps its full-row ORM, so a
153
- * judge can still read `body`.
154
- * Crud(Post, PostPublic) → every op emits PostPublic, and the bootstrap
155
- * scopes the injected ORM via .output(PostPublic) —
156
- * the whole handler speaks the restricted view.
157
- */
115
+ /** Mixin — extends Crud(Entity) to get all 5 typed CRUD methods. */
158
116
  export function Crud<E extends EntityConstructor, V extends CrudViews | EntityConstructor = {}>(
159
117
  entity: E,
160
118
  output?: V,
@@ -168,21 +126,24 @@ export function Crud<E extends EntityConstructor, V extends CrudViews | EntityCo
168
126
 
169
127
  return asCrudConstructor<T, V>(class CrudHandler {
170
128
  static __entity = entity;
171
- /** Handler-wide view only — a per-op map must NOT scope the ORM the judges read. */
129
+ /** Handler-wide view only — a per-op map must NOT scope the storage the validators read. */
172
130
  static __output = wholeHandler ?? entity;
173
131
  static __opOutputs = perOp;
174
- /** What this prefab handler declares — read by the façade, merged under the author's own methods. */
132
+ /**
133
+ * What this prefab handler declares — read by the façade, merged under the author's own
134
+ * methods.
135
+ */
175
136
  static __ops: Record<string, OperationContract> = crudOps(entity as unknown as SchemaView & { partial?: () => SchemaView });
176
137
 
177
- orm: EntityOrm<T>;
178
- constructor(orm: EntityOrm) {
179
- this.orm = orm as EntityOrm<T>;
138
+ storage: Storage<T>;
139
+ constructor(storage: Storage) {
140
+ this.storage = storage as Storage<T>;
180
141
  }
181
142
 
182
- async list(options?: ListOptions): Promise<ListResult<T>> { return this.orm.list(options) as Promise<ListResult<T>>; }
183
- async findById(id: string): Promise<T | undefined> { return this.orm.findById(id); }
184
- async create(input: Partial<T>): Promise<T> { return this.orm.create(input); }
185
- async update(id: string, input: Partial<T>): Promise<T> { return this.orm.update(id, input); }
186
- async delete(id: string): Promise<boolean> { return this.orm.delete(id); }
143
+ async list(options?: ListOptions): Promise<ListResult<T>> { return this.storage.list(options) as Promise<ListResult<T>>; }
144
+ async findById(id: string): Promise<T | undefined> { return this.storage.findById(id); }
145
+ async create(input: Partial<T>): Promise<T> { return this.storage.create(input); }
146
+ async update(id: string, input: Partial<T>): Promise<T> { return this.storage.update(id, input); }
147
+ async delete(id: string): Promise<boolean> { return this.storage.delete(id); }
187
148
  });
188
149
  }