@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,21 +1,19 @@
1
- import type { RouteAddress } from '../contract/RouteAddress.js';
2
1
  import { OperationRoute } from './OperationRoute.js';
3
- import type { Route } from './Route.js';
4
2
  import type { RouteResolver } from './RouteResolver.js';
5
3
 
6
4
  type RemoteFacade = Record<string, Function>;
7
5
  export type RemoteFacadeResolver = (entity: string) => RemoteFacade | undefined;
8
6
 
9
- /** Builds a remote route on the first call, after the remote façade can be resolved. */
10
- export class RemoteRouteResolver implements RouteResolver {
11
- constructor(private readonly facades: RemoteFacadeResolver) {}
12
-
13
- resolve(address: RouteAddress): Route | undefined {
7
+ /** Builds a remote route on the first call, once the remote façade can be resolved. */
8
+ export function remoteRoutes(facades: RemoteFacadeResolver): RouteResolver {
9
+ return (address) => {
14
10
  if (address.surface !== undefined) return undefined;
15
11
 
16
- const facade = this.facades(address.entity);
12
+ const facade = facades(address.entity);
17
13
  const operation = facade?.[address.operation];
14
+
18
15
  if (typeof operation !== 'function') return undefined;
16
+
19
17
  return new OperationRoute('remote', address, (call) => operation(call.invocation));
20
- }
18
+ };
21
19
  }
@@ -0,0 +1,33 @@
1
+ import type { Call } from '../wire/call.js';
2
+ import { ErrorCode, FougereError } from '../wire/errors.js';
3
+ import type { Route } from './Route.js';
4
+ import type { RoutePolicy } from './RoutePolicy.js';
5
+
6
+ /** The operations this dispatcher would have served for the entity the call names. */
7
+ export function servedOperations(
8
+ call: Call,
9
+ routes: readonly Route[],
10
+ policy?: RoutePolicy,
11
+ ): readonly string[] {
12
+ return routes
13
+ .filter((route) => !policy || policy.accepts(route))
14
+ .filter((route) => route.address.entity === call.address.entity)
15
+ .filter((route) => route.kind === 'system' || route.address.surface === call.address.surface)
16
+ .map((route) => route.address.operation);
17
+ }
18
+
19
+ /** `Unknown operation 'draft' on 'post'. It serves list, findById.` */
20
+ export function routeNotFound(
21
+ call: Call,
22
+ served: readonly string[],
23
+ ): FougereError {
24
+ const { entity, operation } = call.address;
25
+ const message = entity === 'rpc'
26
+ ? `Unknown rpc operation '${operation}'. `
27
+ + (served.length ? `It serves ${served.join(', ')}.` : 'It serves nothing.')
28
+ : served.length
29
+ ? `Unknown operation '${operation}' on '${entity}'. It serves ${served.join(', ')}.`
30
+ : `No route serves '${call.address}'`;
31
+
32
+ return new FougereError({ code: ErrorCode.NOT_FOUND, message, entity, operation });
33
+ }
@@ -0,0 +1,28 @@
1
+ import { InputValidator, type SchemaView } from '@fougere/schema';
2
+ import type { InvocationContext } from '../wire/Invocation.js';
3
+ import { ErrorCode, FougereError } from '../wire/errors.js';
4
+
5
+ /** Validates and decodes the input declared by one operation contract. */
6
+ export function validateInput(
7
+ schema: SchemaView | undefined,
8
+ invocation: InvocationContext,
9
+ entity: string,
10
+ operation: string,
11
+ ): InvocationContext {
12
+ if (!schema || invocation.input === undefined || invocation.input === null) return invocation;
13
+
14
+ const result = InputValidator.of(schema.getFields(), { patch: schema.getOpts().patch })
15
+ .validate(invocation.input);
16
+
17
+ if (!result.success) {
18
+ throw new FougereError({
19
+ code: ErrorCode.VALIDATION_FAILED,
20
+ message: result.errors.map((error) => `${error.path}: ${error.message}`).join(', '),
21
+ details: result.errors,
22
+ entity,
23
+ operation,
24
+ });
25
+ }
26
+
27
+ return { ...invocation, input: result.data };
28
+ }
@@ -1,10 +1,4 @@
1
- /**
2
- * The operation model after every declaration and convention has been resolved.
3
- *
4
- * The scanner produces evidence. This module turns that evidence into the one table
5
- * boot, check, explain and protocol projections consume. It is deliberately pure: no
6
- * container, filesystem, migration or handler construction is involved.
7
- */
1
+ /** The operation model after every declaration and convention has been resolved. */
8
2
  import { lowerFirst, type SchemaView } from '@fougere/schema';
9
3
  import { statementDrift } from './boot/statement-drift.js';
10
4
  import { computeBindingPlan, type BindingPlan } from './wire/binding.js';
@@ -232,7 +226,7 @@ export function resolveEffectiveOperations(
232
226
  resolutionDiagnostics,
233
227
  )) continue;
234
228
 
235
- // A fact is judged by the entity it names. This used to be patched into the
229
+ // A fact is validated by the entity it names. This used to be patched into the
236
230
  // facade after resolution, leaving check/explain with a different input.
237
231
  let input = contract.input;
238
232
  if (!input) {
@@ -326,9 +320,9 @@ export function resolveEffectiveOperations(
326
320
  function groupedCollectors(collectors: readonly CollectorEntry[]): Map<string, CollectorEntry[]> {
327
321
  const grouped = new Map<string, CollectorEntry[]>();
328
322
  for (const collector of collectors) {
329
- const held = grouped.get(collector.typeName) ?? [];
330
- held.push(collector);
331
- grouped.set(collector.typeName, held);
323
+ const sameName = grouped.get(collector.typeName) ?? [];
324
+ sameName.push(collector);
325
+ grouped.set(collector.typeName, sameName);
332
326
  }
333
327
  return grouped;
334
328
  }
@@ -359,9 +353,9 @@ function normalizeBinding(
359
353
  // Array order is never allowed to become semantic authority.
360
354
  const byName = new Map<string, Binding[]>();
361
355
  for (const binding of contract.binding) {
362
- const held = byName.get(binding.name) ?? [];
363
- held.push(binding);
364
- byName.set(binding.name, held);
356
+ const sameName = byName.get(binding.name) ?? [];
357
+ sameName.push(binding);
358
+ byName.set(binding.name, sameName);
365
359
  }
366
360
  const expected = new Set(params.map((param) => param.name));
367
361
  const invalid = params.filter((param) => (byName.get(param.name)?.length ?? 0) !== 1);
@@ -403,14 +397,14 @@ function validateProvenance(
403
397
  const ambiguousInput = diagnostics.some((diagnostic) =>
404
398
  diagnostic.code === 'input-contract-ambiguous'
405
399
  && diagnostic.subject === `${handler.ctor.name}.${name}`);
406
- const body = parameters.filter((parameter) => parameter.binding.source.kind === 'body');
400
+ const fromInput = parameters.filter((parameter) => parameter.binding.source.kind === 'input');
407
401
  const inferredBody = new Set<EffectiveParameter>();
408
402
 
409
403
  if (!explicitBinding && !ambiguousInput && contract.input) {
410
- if (body.length === 1) {
411
- inferredBody.add(body[0]!);
412
- } else if (body.length > 1) {
413
- const matches = body.filter((parameter) =>
404
+ if (fromInput.length === 1) {
405
+ inferredBody.add(fromInput[0]!);
406
+ } else if (fromInput.length > 1) {
407
+ const matches = fromInput.filter((parameter) =>
414
408
  schemaMatches(contract.input!, contract.signature?.params[parameter.position]?.type));
415
409
  if (matches.length > 1) {
416
410
  diagnostics.push({
@@ -419,7 +413,7 @@ function validateProvenance(
419
413
  filePath: handler.filePath,
420
414
  frond: frond.name,
421
415
  subject: `${handler.ctor.name}.${name}`,
422
- message: `Cannot resolve which parameter of ${handler.ctor.name}.${name} receives the body: `
416
+ message: `Cannot resolve which parameter of ${handler.ctor.name}.${name} receives the input: `
423
417
  + `${matches.map((parameter) => `${parameter.name}: ${parameter.type ?? 'unknown'}`).join('; ')} `
424
418
  + 'all match the resolved input contract. Declare an explicit binding plan.',
425
419
  });
@@ -430,9 +424,9 @@ function validateProvenance(
430
424
  }
431
425
 
432
426
  // A type written with an inline object literal names nothing a collector can register
433
- // under, so the parameter IS the body. Only a NAMED type can be the wrong-frond
427
+ // under, so the parameter IS the input. Only a NAMED type can be the wrong-frond
434
428
  // substitution the refusal below exists for.
435
- for (const parameter of body) {
429
+ for (const parameter of fromInput) {
436
430
  if (structural(contract.signature?.params[parameter.position]?.type)) inferredBody.add(parameter);
437
431
  }
438
432
 
@@ -455,7 +449,7 @@ function validateProvenance(
455
449
  }
456
450
  continue;
457
451
  }
458
- if (source.kind !== 'body' || explicitBinding || ambiguousInput) continue;
452
+ if (source.kind !== 'input' || explicitBinding || ambiguousInput) continue;
459
453
 
460
454
  const typeName = lowerFirst(contract.signature?.params[parameter.position]?.type.name ?? '');
461
455
  const elsewhere = fronds.flatMap((candidate) => candidate === frond
@@ -463,12 +457,12 @@ function validateProvenance(
463
457
  : candidate.collectors.filter((collector) => collector.typeName === typeName));
464
458
  if (elsewhere.length > 0) {
465
459
  // verify() supplies the more complete topology diagnostic; do not also call this
466
- // an unknown body.
460
+ // an unknown input.
467
461
  continue;
468
462
  }
469
463
 
470
- // An inferred body must be backed by exactly one resolved interpretation. With one
471
- // body, the input itself is sufficient evidence; with several, exactly one type may
464
+ // An inferred input must be backed by exactly one resolved interpretation. With one
465
+ // input, the value itself is sufficient evidence; with several, exactly one type may
472
466
  // match. Explicit plans are authoritative because they state every provenance.
473
467
  const recognized = explicitBinding || inferredBody.has(parameter);
474
468
  if (recognized) continue;
@@ -596,30 +590,7 @@ function uniqueDiagnostics(diagnostics: readonly ScanDiagnostic[]): ScanDiagnost
596
590
  });
597
591
  }
598
592
 
599
- /**
600
- * The contract of every operation a handler serves — the three producers, merged once.
601
- *
602
- * This lived inline in `buildFacade`, which made the façade the only thing that could
603
- * answer "what is this op's contract, really?". Anything else asking — a checker, a
604
- * client generator, a descriptor — had to redo the merge, and a second opinion that
605
- * drifts reports nothing wrong while looking at the wrong thing.
606
- *
607
- * The order is a claim about authority, not a convenience:
608
- *
609
- * 1. a prefab DECLARES what it built (`Crud(E).__ops`) — runtime, so it survives a
610
- * scan that resolved nothing;
611
- * 2. the scan DERIVES from source — a method written in this very file is the
612
- * author's own word and beats everything; a method it merely READ on a base
613
- * class is a guess about someone else's code, and yields to that code's own
614
- * declaration;
615
- * 3. `frond.config.ts` STATES — the most explicit statement, made by whoever
616
- * assembles the app, and the only answer for an op inherited from an installed
617
- * base class the workspace-only scan cannot see. Merged per key, so stating a
618
- * `binding` alone does not erase an `input` the scan found.
619
- *
620
- * Pure: no container, no instance, no disk. The binding plan is resolved here, so
621
- * nothing downstream ever meets an AST.
622
- */
593
+ /** The contract of every operation a handler serves — the three producers, merged once. */
623
594
  export function resolveContracts(
624
595
  handler: Pick<HandlerEntry, 'ctor' | 'operations'>,
625
596
  overrides: FrondDescriptor['operationsOverrides'],
package/src/emit.ts CHANGED
@@ -1,61 +1,13 @@
1
- /**
2
- * Announcing a fact — the half of the topology `remotes:` never covered.
3
- *
4
- * Every other call in Fougere names **one** recipient: `remotes` names one address per
5
- * frond, `Facade<T>` resolves one door. `Emit<T>` names a **subject** instead, and the
6
- * number of readers is not the emitter's business.
7
- *
8
- * ```ts
9
- * constructor(private published: Emit<PostPublished>) {}
10
- * await this.published({ id, title }); // I say it happened. I do not know who cares.
11
- *
12
- * async reindex(fact: Fact<PostPublished>) {} // any handler, any frond. Nothing to register.
13
- * ```
14
- *
15
- * **It is a resolver, not a channel.** A bus moves messages — it has a queue, an envelope
16
- * format, a delivery semantic. This has none of that: it answers *who*, then hands over to
17
- * the call path that already exists. It is `resolve` returning N things instead of one.
18
- * That is also why temporal decoupling stays out of reach: a resolver holds nothing. The
19
- * day at-least-once is wanted, a real channel goes UNDER this, in the transport — the
20
- * dispatch line becomes a publish and a consumer calls the same door on the far side.
21
- */
1
+ /** Announcing a fact — the half of the topology `remotes:` never covered. */
22
2
  import { lowerFirst } from '@fougere/schema';
23
3
 
24
- /**
25
- * What an emitter injects. Resolved by type, like `Storage<Post>` and `Facade<T>`.
26
- *
27
- * The returned promise settles when the fact has been **dispatched**, never when it has
28
- * been handled: a subscriber's failure is its own. The `EventBus` this replaces did
29
- * `await Promise.all(handlers)` and handed their rejections back, which made a publication
30
- * hostage to its own indexer.
31
- */
4
+ /** What an emitter injects. */
32
5
  export type Emit<T> = (fact: T) => Promise<void>;
33
6
 
34
- /**
35
- * What a subscriber accepts — and what it PROMISES about itself.
36
- *
37
- * Not merely "I subscribe". Push is the strict mode and pull is a special case of it: an
38
- * op written for push is correct when called directly, the reverse is false. So this
39
- * wrapper commits the operation to three things its author must honour, because no type
40
- * can check them:
41
- *
42
- * 1. **replayable** — delivery is at-least-once the day a broker sits underneath;
43
- * 2. **no reader for its return** — nobody receives what it hands back;
44
- * 3. **owner of its failures** — they reach a log, never the emitter.
45
- *
46
- * It is the identity at runtime. The scan reads the written name, which is the whole
47
- * mechanism: `binding.ts` sees `Fact<X>` and binds the parameter as a fact instead of
48
- * letting it fall through to "everything else — body".
49
- */
7
+ /** What a subscriber accepts — and what it PROMISES about itself. */
50
8
  export type Fact<T> = T;
51
9
 
52
- /**
53
- * The container key of an emission — THE one place that spells the format.
54
- *
55
- * Its dual is right below, because the boot reads the fact back out of a handler's `deps`
56
- * to know which emissions to register. A key and the way to undo it belong together: the
57
- * pair that is split is the pair that drifts.
58
- */
10
+ /** The container key of an emission — THE one place that spells the format. */
59
11
  export function emitKeyOf(fact: string): string {
60
12
  return `${lowerFirst(fact)}Emit`;
61
13
  }
@@ -69,17 +21,7 @@ export function factOfEmitKey(key: string): string | undefined {
69
21
  : undefined;
70
22
  }
71
23
 
72
- /**
73
- * What a set of handlers ANNOUNCES — `Emit<T>` read back out of their dependencies.
74
- *
75
- * Two readers, which is exactly why it is a function and not a line: the boot registers one
76
- * emission value per name, and the identity card publishes the same set. Spelled twice they
77
- * would drift the day an emission stops being a constructor dependency.
78
- *
79
- * The dual — what a handler ACCEPTS — is not here, because it is not read the same way: a
80
- * `Fact<T>` parameter is a fact about one operation, and `computeBindingPlan` has already
81
- * written it into the plan (`app.listensTo()`).
82
- */
24
+ /** What a set of handlers ANNOUNCES — `Emit<T>` read back out of their dependencies. */
83
25
  export function factsAnnouncedBy(handlers: readonly { deps: readonly string[] }[]): string[] {
84
26
  return [...new Set(
85
27
  handlers
@@ -0,0 +1,44 @@
1
+ import { Call } from '../wire/call.js';
2
+ import type { PartialInvocation } from '../wire/Invocation.js';
3
+ import { RouteAddress } from '../wire/RouteAddress.js';
4
+ import type { DispatchPort } from '../dispatch/DispatchPort.js';
5
+
6
+ type Operation = (...args: any[]) => unknown;
7
+
8
+ /** Facade for a contract whose operation names are only known at discovery. */
9
+ export function dynamicOperations(operation: (name: string) => Operation): Record<string, Operation> {
10
+ const isOperationName = (name: string | symbol): name is string =>
11
+ typeof name === 'string'
12
+ && name !== 'then'
13
+ && name !== 'toJSON'
14
+ && !Object.hasOwn(Object.prototype, name);
15
+
16
+ return new Proxy({}, {
17
+ get: (_target, name) => (isOperationName(name) ? operation(name) : undefined),
18
+ has: (_target, name) => isOperationName(name),
19
+ getOwnPropertyDescriptor: (_target, name) => (isOperationName(name)
20
+ ? { value: operation(name), writable: false, enumerable: true, configurable: true }
21
+ : undefined),
22
+ });
23
+ }
24
+
25
+ /** Turns facade method calls into canonical dispatches. */
26
+ export function facadeOperations(
27
+ dispatcher: DispatchPort,
28
+ entity: string,
29
+ operationNames?: Iterable<string>,
30
+ surface?: string,
31
+ ): Record<string, Operation> {
32
+ const operation = (name: string): Operation => (invocation) => dispatcher.dispatch(new Call(
33
+ new RouteAddress({
34
+ entity,
35
+ operation: name,
36
+ ...(surface !== undefined ? { surface } : {}),
37
+ }),
38
+ invocation,
39
+ ));
40
+
41
+ return operationNames
42
+ ? Object.fromEntries([...operationNames].map((name) => [name, operation(name)]))
43
+ : dynamicOperations(operation);
44
+ }
@@ -0,0 +1,16 @@
1
+ import { Call } from '../wire/call.js';
2
+ import { RouteAddress } from '../wire/RouteAddress.js';
3
+ import type { DispatchPort } from '../dispatch/DispatchPort.js';
4
+ import type { Transport } from '../wire/call.js';
5
+
6
+ /** Adapts the historical transport signature to the canonical dispatch port. */
7
+ export function createTransportEntry(dispatcher: DispatchPort, surface?: string): Transport {
8
+ return (legacy, invocation) => dispatcher.dispatch(new Call(
9
+ new RouteAddress({
10
+ entity: legacy.entity,
11
+ operation: legacy.op,
12
+ ...(surface !== undefined ? { surface } : {}),
13
+ }),
14
+ invocation,
15
+ ));
16
+ }
@@ -5,45 +5,11 @@ import type { BindingPlan } from './wire/binding.js';
5
5
 
6
6
  // ── Types ────────────────────────────────────────
7
7
 
8
- /**
9
- * Per-operation override. Config takes precedence over conventions (isReadOp, facade lookup).
10
- *
11
- * Two families of keys, and they act at different depths:
12
- *
13
- * - **Resolution** (`kind`, `handler`, `method`) — intent and implementation, resolved
14
- * once into core's `EffectiveOperation`; every local or remote door consumes it.
15
- * - **Projection** (`graphql`) — protocol vocabulary, read only by that adapter.
16
- * - **Contract** (`input`, `output`, `binding`) — what the op IS. Read by the façade,
17
- * and this is the third producer of an {@link OperationContract}: a prefab DECLARES its
18
- * ops (`Crud.__ops`), the scan DERIVES them from source, config STATES them outright.
19
- * The façade cannot tell the three apart.
20
- *
21
- * Stating a contract here makes the scan optional rather than load-bearing. Two cases it
22
- * answers that nothing else does:
23
- * - a method inherited from an **installed** base class — the scan resolves nothing there
24
- * (workspace-only heritage) and says nothing, so the op silently misses the façade;
25
- * - an operation inherited from a declaration unavailable to the project's type checker.
26
- *
27
- * Config wins over both other producers — it is the most explicit statement, made by
28
- * whoever assembles the app. Precedence: CLI > frond config > fougere config > scan >
29
- * conventions.
30
- */
8
+ /** Per-operation override. */
31
9
  export interface OperationOverride {
32
- /**
33
- * Force operation kind, over the naming convention (`isReadOp`).
34
- *
35
- * The convention reads the NAME, which is a weak signal — an app naming its reads in
36
- * domain terms (`ofBook`, `roots`, `bySlug`) matches no prefix and every one of them is
37
- * published as a mutation and a POST. This is the only place that fixes it.
38
- */
10
+ /** Force operation kind, over the naming convention (`isReadOp`). */
39
11
  kind?: 'query' | 'command';
40
- /**
41
- * The GraphQL root field this op answers to. Defaults to the method name.
42
- *
43
- * A GraphQL root is flat, so two handlers naming a method `ofBook` claim one field and
44
- * the build is refused, naming both. Nothing is renamed for you: the root vocabulary is
45
- * the app's, and a derived name would move the day a distant frond gained an entity.
46
- */
12
+ /** The GraphQL root field this op answers to. */
47
13
  graphql?: string;
48
14
  /**
49
15
  * Handler class to delegate to (overrides the default `{Entity}Handler` lookup).
@@ -52,22 +18,12 @@ export interface OperationOverride {
52
18
  handler?: EntityConstructor;
53
19
  /** Method name on `handler` (defaults to the operation name). */
54
20
  method?: string;
55
- /**
56
- * CASL ability check (e.g. 'archive Post'). **Declared, not implemented** — no
57
- * reader interprets it today, in any adapter. Kept as the named slot for the
58
- * question rather than silently dropped, but do not rely on it: a config that
59
- * states a policy is not enforced anywhere.
60
- *
61
- * Wiring it means adopting a rules engine, which is precisely what the design
62
- * turns down: an identity-dependent right is judged INSIDE the operation
63
- * (`publish` reads `post.authorId !== user.id`), and a door-dependent one is a
64
- * surface. Neither needs a second vocabulary evaluated by a second engine.
65
- */
21
+ /** CASL ability check (e.g. */
66
22
  policy?: string;
67
23
 
68
24
  // ── The contract itself — see the note above ──
69
25
 
70
- /** What judges the input. The view carries its own mode (`partial()` → patch). */
26
+ /** What validates the input. The view carries its own mode (`partial()` → patch). */
71
27
  input?: SchemaView;
72
28
  /**
73
29
  * Where each argument is read from — states what the scan would otherwise derive
@@ -82,18 +38,7 @@ export interface OperationOverride {
82
38
  export interface FrondConfig {
83
39
  /** Class names exposed as the frond's public contract (all surfaces). */
84
40
  expose?: string[];
85
- /**
86
- * The entities this frond may read ACROSS sources, by name.
87
- *
88
- * It is not a permission checked after the fact: the list IS the environment a
89
- * cross-source query runs in — a source holding none of these is never opened, so
90
- * its tables do not exist in that connection. `facadeFor` excludes an entity with no
91
- * door on purpose ("it would publish the auth tables to anyone who asks"), and a SQL
92
- * door at app scope would hand them over; this is what keeps it shut.
93
- *
94
- * Declaring it is what makes `Reads` injectable here. A frond that declares none
95
- * asks for none, and nothing is attached on its behalf.
96
- */
41
+ /** The entities this frond may read ACROSS sources, by name. */
97
42
  reads?: string[];
98
43
  /** Per-surface entity lists. Overrides default deduction for each named surface. */
99
44
  surfaces?: Record<string, string[]>;
@@ -105,15 +50,7 @@ export interface FrondConfig {
105
50
 
106
51
  // ── Helper ───────────────────────────────────────
107
52
 
108
- /**
109
- * Define a frond configuration (typed identity helper).
110
- *
111
- * ```ts
112
- * // fronds/auth/frond.config.ts
113
- * import { defineFrond } from '@fougere/core'
114
- * export default defineFrond({ expose: ['User', 'AuthHandler'] })
115
- * ```
116
- */
53
+ /** Define a frond configuration (typed identity helper). */
117
54
  export function defineFrond(config: FrondConfig): FrondConfig {
118
55
  return config;
119
56
  }
@@ -1,14 +1,4 @@
1
- /**
2
- * Making keys and issuing grants — the half of identity that runs at a DEPLOYMENT.
3
- *
4
- * It sits on the Node entry because it is the CLI speaking: `fougere keys` generates a
5
- * pair, `fougere grant` binds a name to one, and both happen once, on a machine with a
6
- * filesystem. Neither is reachable from a request path, so nothing here is on any hot
7
- * path and `generateKeyPairSync` — the one gesture WebCrypto could not replace without
8
- * changing what a key IS — never has to leave `node:crypto`.
9
- *
10
- * The verifying half is elsewhere (`identity.ts`) because it runs per call, everywhere.
11
- */
1
+ /** Making keys and issuing grants — the half of identity that runs at a DEPLOYMENT. */
12
2
  import { createPrivateKey, createPublicKey, generateKeyPairSync, sign } from 'node:crypto';
13
3
  import { b64url } from './crypto/encoding.js';
14
4
 
@@ -22,11 +12,8 @@ export function generateKeyPair(): { privateKey: string; publicKey: string } {
22
12
  }
23
13
 
24
14
  /**
25
- * Bind a name to a public key, signed by the root — the whole of what a receiver
26
- * needs to recognize a frond it has never seen.
27
- *
28
- * `ttlDays` bounds the damage of a leaked frond key without a revocation list:
29
- * re-issuing is a deployment, which is the same gesture that leaked it.
15
+ * Bind a name to a public key, signed by the root — the whole of what a receiver needs to
16
+ * recognize a frond it has never seen.
30
17
  */
31
18
  export function issueGrant(
32
19
  rootPrivateKey: string,