@fougere/core 0.2.0-alpha.2 → 0.3.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 (414) hide show
  1. package/README.md +2 -1
  2. package/dist/boot/AppLifecycle.d.ts +18 -0
  3. package/dist/boot/AppLifecycle.d.ts.map +1 -0
  4. package/dist/boot/AppLifecycle.js +42 -0
  5. package/dist/boot/AppLifecycle.js.map +1 -0
  6. package/dist/boot/Emissions.d.ts +126 -0
  7. package/dist/boot/Emissions.d.ts.map +1 -0
  8. package/dist/boot/Emissions.js +233 -0
  9. package/dist/boot/Emissions.js.map +1 -0
  10. package/dist/boot/HandlerFacade.d.ts +72 -0
  11. package/dist/boot/HandlerFacade.d.ts.map +1 -0
  12. package/dist/boot/HandlerFacade.js +174 -0
  13. package/dist/boot/HandlerFacade.js.map +1 -0
  14. package/dist/boot/Lifecycle.d.ts +4 -0
  15. package/dist/boot/Lifecycle.d.ts.map +1 -0
  16. package/dist/boot/Lifecycle.js +3 -0
  17. package/dist/boot/Lifecycle.js.map +1 -0
  18. package/dist/boot/ambient-port.d.ts +38 -0
  19. package/dist/boot/ambient-port.d.ts.map +1 -0
  20. package/dist/boot/ambient-port.js +2 -0
  21. package/dist/boot/ambient-port.js.map +1 -0
  22. package/dist/boot/ambient.als.d.ts +3 -0
  23. package/dist/boot/ambient.als.d.ts.map +1 -0
  24. package/dist/boot/ambient.als.js +34 -0
  25. package/dist/boot/ambient.als.js.map +1 -0
  26. package/dist/boot/ambient.queue.d.ts +10 -0
  27. package/dist/boot/ambient.queue.d.ts.map +1 -0
  28. package/dist/boot/ambient.queue.js +60 -0
  29. package/dist/boot/ambient.queue.js.map +1 -0
  30. package/dist/boot/apply.d.ts +22 -0
  31. package/dist/boot/apply.d.ts.map +1 -0
  32. package/dist/boot/apply.js +48 -0
  33. package/dist/boot/apply.js.map +1 -0
  34. package/dist/boot/auth.d.ts +53 -0
  35. package/dist/boot/auth.d.ts.map +1 -0
  36. package/dist/boot/auth.js +2 -0
  37. package/dist/boot/auth.js.map +1 -0
  38. package/dist/{binding.d.ts → boot/binding.d.ts} +14 -17
  39. package/dist/boot/binding.d.ts.map +1 -0
  40. package/dist/{binding.js → boot/binding.js} +19 -10
  41. package/dist/boot/binding.js.map +1 -0
  42. package/dist/{boot.d.ts → boot/boot.d.ts} +25 -5
  43. package/dist/boot/boot.d.ts.map +1 -0
  44. package/dist/boot/boot.js +70 -0
  45. package/dist/boot/boot.js.map +1 -0
  46. package/dist/boot/bootstrap.d.ts.map +1 -0
  47. package/dist/boot/bootstrap.js +721 -0
  48. package/dist/boot/bootstrap.js.map +1 -0
  49. package/dist/boot/egress.d.ts +8 -0
  50. package/dist/boot/egress.d.ts.map +1 -0
  51. package/dist/boot/egress.js +11 -0
  52. package/dist/boot/egress.js.map +1 -0
  53. package/dist/boot/frame.d.ts +44 -0
  54. package/dist/boot/frame.d.ts.map +1 -0
  55. package/dist/boot/frame.js +181 -0
  56. package/dist/boot/frame.js.map +1 -0
  57. package/dist/boot/ownership.d.ts +42 -0
  58. package/dist/boot/ownership.d.ts.map +1 -0
  59. package/dist/boot/ownership.js +127 -0
  60. package/dist/boot/ownership.js.map +1 -0
  61. package/dist/boot/ports.d.ts +17 -0
  62. package/dist/boot/ports.d.ts.map +1 -0
  63. package/dist/boot/ports.js +57 -0
  64. package/dist/boot/ports.js.map +1 -0
  65. package/dist/{remote.d.ts → boot/remote.d.ts} +11 -3
  66. package/dist/boot/remote.d.ts.map +1 -0
  67. package/dist/{remote.js → boot/remote.js} +24 -26
  68. package/dist/boot/remote.js.map +1 -0
  69. package/dist/{seed.d.ts → boot/seed.d.ts} +13 -1
  70. package/dist/boot/seed.d.ts.map +1 -0
  71. package/dist/{seed.js → boot/seed.js} +24 -3
  72. package/dist/boot/seed.js.map +1 -0
  73. package/dist/boot/together.d.ts +26 -0
  74. package/dist/boot/together.d.ts.map +1 -0
  75. package/dist/boot/together.js +163 -0
  76. package/dist/boot/together.js.map +1 -0
  77. package/dist/boot/types.d.ts +260 -0
  78. package/dist/boot/types.d.ts.map +1 -0
  79. package/dist/boot/types.js.map +1 -0
  80. package/dist/builtins/config.d.ts +9 -0
  81. package/dist/builtins/config.d.ts.map +1 -1
  82. package/dist/builtins/config.js +16 -1
  83. package/dist/builtins/config.js.map +1 -1
  84. package/dist/builtins/logger.d.ts +37 -4
  85. package/dist/builtins/logger.d.ts.map +1 -1
  86. package/dist/builtins/logger.js +66 -7
  87. package/dist/builtins/logger.js.map +1 -1
  88. package/dist/config-loader.d.ts +39 -35
  89. package/dist/config-loader.d.ts.map +1 -1
  90. package/dist/config-loader.js +15 -54
  91. package/dist/config-loader.js.map +1 -1
  92. package/dist/contract/Call.d.ts +10 -0
  93. package/dist/contract/Call.d.ts.map +1 -0
  94. package/dist/contract/Call.js +15 -0
  95. package/dist/contract/Call.js.map +1 -0
  96. package/dist/contract/Invocation.d.ts +27 -0
  97. package/dist/contract/Invocation.d.ts.map +1 -0
  98. package/dist/contract/Invocation.js +59 -0
  99. package/dist/contract/Invocation.js.map +1 -0
  100. package/dist/contract/RouteAddress.d.ts +17 -0
  101. package/dist/contract/RouteAddress.d.ts.map +1 -0
  102. package/dist/contract/RouteAddress.js +38 -0
  103. package/dist/contract/RouteAddress.js.map +1 -0
  104. package/dist/contract.d.ts +25 -19
  105. package/dist/contract.d.ts.map +1 -1
  106. package/dist/contract.js +25 -10
  107. package/dist/contract.js.map +1 -1
  108. package/dist/crypto/encoding.d.ts +25 -0
  109. package/dist/crypto/encoding.d.ts.map +1 -0
  110. package/dist/crypto/encoding.js +58 -0
  111. package/dist/crypto/encoding.js.map +1 -0
  112. package/dist/crypto/node.d.ts +4 -0
  113. package/dist/crypto/node.d.ts.map +1 -0
  114. package/dist/crypto/node.js +25 -0
  115. package/dist/crypto/node.js.map +1 -0
  116. package/dist/crypto/port.d.ts +42 -0
  117. package/dist/crypto/port.d.ts.map +1 -0
  118. package/dist/crypto/port.js +19 -0
  119. package/dist/crypto/port.js.map +1 -0
  120. package/dist/crypto/webcrypto.d.ts +4 -0
  121. package/dist/crypto/webcrypto.d.ts.map +1 -0
  122. package/dist/crypto/webcrypto.js +34 -0
  123. package/dist/crypto/webcrypto.js.map +1 -0
  124. package/dist/dispatch/ArgumentResolver.d.ts +10 -0
  125. package/dist/dispatch/ArgumentResolver.d.ts.map +1 -0
  126. package/dist/dispatch/ArgumentResolver.js +12 -0
  127. package/dist/dispatch/ArgumentResolver.js.map +1 -0
  128. package/dist/dispatch/ArrayResult.d.ts +3 -0
  129. package/dist/dispatch/ArrayResult.d.ts.map +1 -0
  130. package/dist/dispatch/ArrayResult.js +11 -0
  131. package/dist/dispatch/ArrayResult.js.map +1 -0
  132. package/dist/dispatch/DispatchEvent.d.ts +18 -0
  133. package/dist/dispatch/DispatchEvent.d.ts.map +1 -0
  134. package/dist/dispatch/DispatchEvent.js +30 -0
  135. package/dist/dispatch/DispatchEvent.js.map +1 -0
  136. package/dist/dispatch/DispatchLifecycle.d.ts +9 -0
  137. package/dist/dispatch/DispatchLifecycle.d.ts.map +1 -0
  138. package/dist/dispatch/DispatchLifecycle.js +25 -0
  139. package/dist/dispatch/DispatchLifecycle.js.map +1 -0
  140. package/dist/dispatch/DispatchPort.d.ts +6 -0
  141. package/dist/dispatch/DispatchPort.d.ts.map +1 -0
  142. package/dist/dispatch/DispatchPort.js +2 -0
  143. package/dist/dispatch/DispatchPort.js.map +1 -0
  144. package/dist/dispatch/Dispatcher.d.ts +16 -0
  145. package/dist/dispatch/Dispatcher.d.ts.map +1 -0
  146. package/dist/dispatch/Dispatcher.js +44 -0
  147. package/dist/dispatch/Dispatcher.js.map +1 -0
  148. package/dist/dispatch/InFlight.d.ts +12 -0
  149. package/dist/dispatch/InFlight.d.ts.map +1 -0
  150. package/dist/dispatch/InFlight.js +46 -0
  151. package/dist/dispatch/InFlight.js.map +1 -0
  152. package/dist/dispatch/InputValidator.d.ts +7 -0
  153. package/dist/dispatch/InputValidator.d.ts.map +1 -0
  154. package/dist/dispatch/InputValidator.js +21 -0
  155. package/dist/dispatch/InputValidator.js.map +1 -0
  156. package/dist/dispatch/LocalRoutePolicy.d.ts +11 -0
  157. package/dist/dispatch/LocalRoutePolicy.d.ts.map +1 -0
  158. package/dist/dispatch/LocalRoutePolicy.js +32 -0
  159. package/dist/dispatch/LocalRoutePolicy.js.map +1 -0
  160. package/dist/dispatch/OperationExecutor.d.ts +25 -0
  161. package/dist/dispatch/OperationExecutor.d.ts.map +1 -0
  162. package/dist/dispatch/OperationExecutor.js +32 -0
  163. package/dist/dispatch/OperationExecutor.js.map +1 -0
  164. package/dist/dispatch/OperationRoute.d.ts +13 -0
  165. package/dist/dispatch/OperationRoute.d.ts.map +1 -0
  166. package/dist/dispatch/OperationRoute.js +15 -0
  167. package/dist/dispatch/OperationRoute.js.map +1 -0
  168. package/dist/dispatch/OutputProjector.d.ts +12 -0
  169. package/dist/dispatch/OutputProjector.d.ts.map +1 -0
  170. package/dist/dispatch/OutputProjector.js +30 -0
  171. package/dist/dispatch/OutputProjector.js.map +1 -0
  172. package/dist/dispatch/OutputView.d.ts +8 -0
  173. package/dist/dispatch/OutputView.d.ts.map +1 -0
  174. package/dist/dispatch/OutputView.js +10 -0
  175. package/dist/dispatch/OutputView.js.map +1 -0
  176. package/dist/dispatch/PresenterArgumentResolver.d.ts +12 -0
  177. package/dist/dispatch/PresenterArgumentResolver.d.ts.map +1 -0
  178. package/dist/dispatch/PresenterArgumentResolver.js +20 -0
  179. package/dist/dispatch/PresenterArgumentResolver.js.map +1 -0
  180. package/dist/dispatch/PresenterExecutor.d.ts +11 -0
  181. package/dist/dispatch/PresenterExecutor.d.ts.map +1 -0
  182. package/dist/dispatch/PresenterExecutor.js +56 -0
  183. package/dist/dispatch/PresenterExecutor.js.map +1 -0
  184. package/dist/dispatch/RemoteRouteResolver.d.ts +13 -0
  185. package/dist/dispatch/RemoteRouteResolver.d.ts.map +1 -0
  186. package/dist/dispatch/RemoteRouteResolver.js +18 -0
  187. package/dist/dispatch/RemoteRouteResolver.js.map +1 -0
  188. package/dist/dispatch/Route.d.ts +10 -0
  189. package/dist/dispatch/Route.d.ts.map +1 -0
  190. package/dist/dispatch/Route.js +2 -0
  191. package/dist/dispatch/Route.js.map +1 -0
  192. package/dist/dispatch/RouteNotFoundError.d.ts +10 -0
  193. package/dist/dispatch/RouteNotFoundError.d.ts.map +1 -0
  194. package/dist/dispatch/RouteNotFoundError.js +24 -0
  195. package/dist/dispatch/RouteNotFoundError.js.map +1 -0
  196. package/dist/dispatch/RoutePolicy.d.ts +8 -0
  197. package/dist/dispatch/RoutePolicy.d.ts.map +1 -0
  198. package/dist/dispatch/RoutePolicy.js +2 -0
  199. package/dist/dispatch/RoutePolicy.js.map +1 -0
  200. package/dist/dispatch/RouteRegistry.d.ts +18 -0
  201. package/dist/dispatch/RouteRegistry.d.ts.map +1 -0
  202. package/dist/dispatch/RouteRegistry.js +62 -0
  203. package/dist/dispatch/RouteRegistry.js.map +1 -0
  204. package/dist/dispatch/RouteResolver.d.ts +7 -0
  205. package/dist/dispatch/RouteResolver.d.ts.map +1 -0
  206. package/dist/dispatch/RouteResolver.js +2 -0
  207. package/dist/dispatch/RouteResolver.js.map +1 -0
  208. package/dist/dispatch/StorageGuard.d.ts +15 -0
  209. package/dist/dispatch/StorageGuard.d.ts.map +1 -0
  210. package/dist/dispatch/StorageGuard.js +63 -0
  211. package/dist/dispatch/StorageGuard.js.map +1 -0
  212. package/dist/effective-operation.d.ts +90 -0
  213. package/dist/effective-operation.d.ts.map +1 -0
  214. package/dist/effective-operation.js +450 -0
  215. package/dist/effective-operation.js.map +1 -0
  216. package/dist/emit.js +2 -2
  217. package/dist/emit.js.map +1 -1
  218. package/dist/entry/DynamicFacade.d.ts +10 -0
  219. package/dist/entry/DynamicFacade.d.ts.map +1 -0
  220. package/dist/entry/DynamicFacade.js +27 -0
  221. package/dist/entry/DynamicFacade.js.map +1 -0
  222. package/dist/entry/FacadeEntry.d.ts +11 -0
  223. package/dist/entry/FacadeEntry.d.ts.map +1 -0
  224. package/dist/entry/FacadeEntry.js +26 -0
  225. package/dist/entry/FacadeEntry.js.map +1 -0
  226. package/dist/entry/TransportEntry.d.ts +13 -0
  227. package/dist/entry/TransportEntry.d.ts.map +1 -0
  228. package/dist/entry/TransportEntry.js +24 -0
  229. package/dist/entry/TransportEntry.js.map +1 -0
  230. package/dist/frond-config.d.ts +24 -7
  231. package/dist/frond-config.d.ts.map +1 -1
  232. package/dist/frond-config.js.map +1 -1
  233. package/dist/graph.d.ts +1 -1
  234. package/dist/graph.d.ts.map +1 -1
  235. package/dist/graph.js +3 -2
  236. package/dist/graph.js.map +1 -1
  237. package/dist/identity-keys.d.ts +14 -0
  238. package/dist/identity-keys.d.ts.map +1 -0
  239. package/dist/identity-keys.js +37 -0
  240. package/dist/identity-keys.js.map +1 -0
  241. package/dist/identity.d.ts +58 -0
  242. package/dist/identity.d.ts.map +1 -0
  243. package/dist/identity.js +182 -0
  244. package/dist/identity.js.map +1 -0
  245. package/dist/imports.d.ts +1 -1
  246. package/dist/imports.d.ts.map +1 -1
  247. package/dist/imports.js +7 -3
  248. package/dist/imports.js.map +1 -1
  249. package/dist/index.d.ts +57 -38
  250. package/dist/index.d.ts.map +1 -1
  251. package/dist/index.js +38 -32
  252. package/dist/index.js.map +1 -1
  253. package/dist/loader.d.ts +16 -0
  254. package/dist/loader.d.ts.map +1 -0
  255. package/dist/loader.js +25 -0
  256. package/dist/loader.js.map +1 -0
  257. package/dist/node.d.ts +21 -0
  258. package/dist/node.d.ts.map +1 -0
  259. package/dist/node.js +24 -0
  260. package/dist/node.js.map +1 -0
  261. package/dist/orm.d.ts +69 -8
  262. package/dist/orm.d.ts.map +1 -1
  263. package/dist/orm.js +35 -2
  264. package/dist/orm.js.map +1 -1
  265. package/dist/prefab/collector.d.ts +29 -0
  266. package/dist/prefab/collector.d.ts.map +1 -0
  267. package/dist/prefab/collector.js +34 -0
  268. package/dist/prefab/collector.js.map +1 -0
  269. package/dist/{crud.d.ts → prefab/crud.d.ts} +7 -8
  270. package/dist/prefab/crud.d.ts.map +1 -0
  271. package/dist/{crud.js → prefab/crud.js} +39 -5
  272. package/dist/prefab/crud.js.map +1 -0
  273. package/dist/prefab/mirror.d.ts +52 -0
  274. package/dist/prefab/mirror.d.ts.map +1 -0
  275. package/dist/prefab/mirror.js +66 -0
  276. package/dist/prefab/mirror.js.map +1 -0
  277. package/dist/prefab/prefab.d.ts +15 -0
  278. package/dist/prefab/prefab.d.ts.map +1 -0
  279. package/dist/prefab/prefab.js +19 -0
  280. package/dist/prefab/prefab.js.map +1 -0
  281. package/dist/{presenter.d.ts → prefab/presenter.d.ts} +6 -17
  282. package/dist/prefab/presenter.d.ts.map +1 -0
  283. package/dist/{presenter.js → prefab/presenter.js} +5 -23
  284. package/dist/prefab/presenter.js.map +1 -0
  285. package/dist/prefab/repository.d.ts +104 -0
  286. package/dist/prefab/repository.d.ts.map +1 -0
  287. package/dist/prefab/repository.js +62 -0
  288. package/dist/prefab/repository.js.map +1 -0
  289. package/dist/scan/Fronds.d.ts +45 -0
  290. package/dist/scan/Fronds.d.ts.map +1 -0
  291. package/dist/scan/Fronds.js +66 -0
  292. package/dist/scan/Fronds.js.map +1 -0
  293. package/dist/scan/conventions.d.ts +74 -0
  294. package/dist/scan/conventions.d.ts.map +1 -0
  295. package/dist/scan/conventions.js +82 -0
  296. package/dist/scan/conventions.js.map +1 -0
  297. package/dist/scan/emit.d.ts +14 -0
  298. package/dist/scan/emit.d.ts.map +1 -0
  299. package/dist/scan/emit.js +211 -0
  300. package/dist/scan/emit.js.map +1 -0
  301. package/dist/scan/frond.d.ts +224 -0
  302. package/dist/scan/frond.d.ts.map +1 -0
  303. package/dist/scan/frond.js +2 -0
  304. package/dist/scan/frond.js.map +1 -0
  305. package/dist/{handler-parser.d.ts → scan/handler-parser.d.ts} +18 -9
  306. package/dist/scan/handler-parser.d.ts.map +1 -0
  307. package/dist/scan/handler-parser.js +625 -0
  308. package/dist/scan/handler-parser.js.map +1 -0
  309. package/dist/scan/scan-cache.d.ts +16 -0
  310. package/dist/scan/scan-cache.d.ts.map +1 -0
  311. package/dist/{scan-cache.js → scan/scan-cache.js} +27 -20
  312. package/dist/scan/scan-cache.js.map +1 -0
  313. package/dist/scan/scanner.d.ts +20 -0
  314. package/dist/scan/scanner.d.ts.map +1 -0
  315. package/dist/{scanner.js → scan/scanner.js} +185 -167
  316. package/dist/scan/scanner.js.map +1 -0
  317. package/dist/verify.d.ts +16 -3
  318. package/dist/verify.d.ts.map +1 -1
  319. package/dist/verify.js +21 -18
  320. package/dist/verify.js.map +1 -1
  321. package/dist/{call.d.ts → wire/call.d.ts} +70 -1
  322. package/dist/wire/call.d.ts.map +1 -0
  323. package/dist/{call.js → wire/call.js} +48 -75
  324. package/dist/wire/call.js.map +1 -0
  325. package/dist/{middleware.d.ts → wire/errors.d.ts} +18 -19
  326. package/dist/wire/errors.d.ts.map +1 -0
  327. package/dist/{middleware.js → wire/errors.js} +26 -14
  328. package/dist/wire/errors.js.map +1 -0
  329. package/dist/{errors.d.ts → wire/http-error.d.ts} +5 -6
  330. package/dist/wire/http-error.d.ts.map +1 -0
  331. package/dist/{errors.js → wire/http-error.js} +7 -6
  332. package/dist/wire/http-error.js.map +1 -0
  333. package/dist/wire/invocation.d.ts +4 -0
  334. package/dist/wire/invocation.d.ts.map +1 -0
  335. package/dist/wire/invocation.js +3 -0
  336. package/dist/wire/invocation.js.map +1 -0
  337. package/dist/{middleware/logger.d.ts → wire/loggerMiddleware.d.ts} +3 -3
  338. package/dist/wire/loggerMiddleware.d.ts.map +1 -0
  339. package/dist/{middleware/logger.js → wire/loggerMiddleware.js} +2 -2
  340. package/dist/wire/loggerMiddleware.js.map +1 -0
  341. package/dist/wire/middleware.d.ts +29 -0
  342. package/dist/wire/middleware.d.ts.map +1 -0
  343. package/dist/wire/middleware.js +20 -0
  344. package/dist/wire/middleware.js.map +1 -0
  345. package/dist/{operation.d.ts → wire/operation.d.ts} +39 -10
  346. package/dist/wire/operation.d.ts.map +1 -0
  347. package/dist/wire/operation.js +167 -0
  348. package/dist/wire/operation.js.map +1 -0
  349. package/package.json +24 -7
  350. package/dist/binding.d.ts.map +0 -1
  351. package/dist/binding.js.map +0 -1
  352. package/dist/boot.d.ts.map +0 -1
  353. package/dist/boot.js +0 -53
  354. package/dist/boot.js.map +0 -1
  355. package/dist/bootstrap.d.ts.map +0 -1
  356. package/dist/bootstrap.js +0 -879
  357. package/dist/bootstrap.js.map +0 -1
  358. package/dist/call.d.ts.map +0 -1
  359. package/dist/call.js.map +0 -1
  360. package/dist/collector.d.ts +0 -28
  361. package/dist/collector.d.ts.map +0 -1
  362. package/dist/collector.js +0 -32
  363. package/dist/collector.js.map +0 -1
  364. package/dist/crud.d.ts.map +0 -1
  365. package/dist/crud.js.map +0 -1
  366. package/dist/egress.d.ts +0 -52
  367. package/dist/egress.d.ts.map +0 -1
  368. package/dist/egress.js +0 -186
  369. package/dist/egress.js.map +0 -1
  370. package/dist/errors.d.ts.map +0 -1
  371. package/dist/errors.js.map +0 -1
  372. package/dist/handler-parser.d.ts.map +0 -1
  373. package/dist/handler-parser.js +0 -505
  374. package/dist/handler-parser.js.map +0 -1
  375. package/dist/invocation.d.ts +0 -20
  376. package/dist/invocation.d.ts.map +0 -1
  377. package/dist/invocation.js +0 -15
  378. package/dist/invocation.js.map +0 -1
  379. package/dist/middleware/error-handler.d.ts +0 -15
  380. package/dist/middleware/error-handler.d.ts.map +0 -1
  381. package/dist/middleware/error-handler.js +0 -29
  382. package/dist/middleware/error-handler.js.map +0 -1
  383. package/dist/middleware/logger.d.ts.map +0 -1
  384. package/dist/middleware/logger.js.map +0 -1
  385. package/dist/middleware.d.ts.map +0 -1
  386. package/dist/middleware.js.map +0 -1
  387. package/dist/mirror.d.ts +0 -93
  388. package/dist/mirror.d.ts.map +0 -1
  389. package/dist/mirror.js +0 -96
  390. package/dist/mirror.js.map +0 -1
  391. package/dist/operation.d.ts.map +0 -1
  392. package/dist/operation.js +0 -95
  393. package/dist/operation.js.map +0 -1
  394. package/dist/presenter.d.ts.map +0 -1
  395. package/dist/presenter.js.map +0 -1
  396. package/dist/remote.d.ts.map +0 -1
  397. package/dist/remote.js.map +0 -1
  398. package/dist/repository.d.ts +0 -55
  399. package/dist/repository.d.ts.map +0 -1
  400. package/dist/repository.js +0 -26
  401. package/dist/repository.js.map +0 -1
  402. package/dist/scan-cache.d.ts +0 -10
  403. package/dist/scan-cache.d.ts.map +0 -1
  404. package/dist/scan-cache.js.map +0 -1
  405. package/dist/scanner.d.ts +0 -34
  406. package/dist/scanner.d.ts.map +0 -1
  407. package/dist/scanner.js.map +0 -1
  408. package/dist/seed.d.ts.map +0 -1
  409. package/dist/seed.js.map +0 -1
  410. package/dist/types.d.ts +0 -421
  411. package/dist/types.d.ts.map +0 -1
  412. package/dist/types.js.map +0 -1
  413. /package/dist/{bootstrap.d.ts → boot/bootstrap.d.ts} +0 -0
  414. /package/dist/{types.js → boot/types.js} +0 -0
@@ -0,0 +1,625 @@
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { join, dirname, resolve as resolvePath } from 'node:path';
3
+ /** Lazy-loaded TypeScript module — avoids bundling the 9MB compiler. */
4
+ let _ts;
5
+ async function loadTS() {
6
+ if (!_ts)
7
+ _ts = (await import('@typescript/typescript6')).default;
8
+ return _ts;
9
+ }
10
+ function getTS() {
11
+ if (!_ts)
12
+ throw new Error('TypeScript not loaded — call an async parse function first');
13
+ return _ts;
14
+ }
15
+ /**
16
+ * One checked program per project/configuration during a scan.
17
+ *
18
+ * A checker is a project reader, not a file parser: creating one per handler would reopen
19
+ * the standard library and every imported declaration for each method. `scanProject`
20
+ * resets this map at the start of a run, so an edited source can never meet a program from
21
+ * the previous run.
22
+ */
23
+ const typeProjects = new Map();
24
+ const compilerProjects = new Map();
25
+ export function resetTypePrograms() {
26
+ typeProjects.clear();
27
+ compilerProjects.clear();
28
+ }
29
+ function compilerProjectOf(filePath, projectRoot) {
30
+ const typescript = getTS();
31
+ const absolute = resolvePath(filePath);
32
+ const configPath = typescript.findConfigFile(dirname(absolute), typescript.sys.fileExists);
33
+ if (configPath) {
34
+ const key = `${configPath}:${projectRoot ?? ''}`;
35
+ const cached = compilerProjects.get(key);
36
+ if (cached)
37
+ return cached;
38
+ const read = typescript.readConfigFile(configPath, typescript.sys.readFile);
39
+ if (read.error)
40
+ throw new Error(typescript.flattenDiagnosticMessageText(read.error.messageText, '\n'));
41
+ const parsed = typescript.parseJsonConfigFileContent(read.config, typescript.sys, dirname(configPath));
42
+ const configured = {
43
+ key,
44
+ // Compiler options belong to the project; its entire include glob does not belong
45
+ // to this scan. Each declaration inspected below becomes a root and TypeScript
46
+ // follows its imports. Seeding the monorepo here made a one-file scan compile it all.
47
+ roots: [],
48
+ // Handlers may be authored or emitted as JavaScript. They still need to belong to
49
+ // the checked program so constructor parsing does not fail on the first cold scan.
50
+ options: { ...parsed.options, allowJs: true, noEmit: true },
51
+ };
52
+ compilerProjects.set(key, configured);
53
+ return configured;
54
+ }
55
+ const key = projectRoot ?? dirname(absolute);
56
+ const cached = compilerProjects.get(key);
57
+ if (cached)
58
+ return cached;
59
+ const configured = {
60
+ key,
61
+ roots: [],
62
+ options: {
63
+ target: typescript.ScriptTarget.ES2022,
64
+ module: typescript.ModuleKind.Node16,
65
+ moduleResolution: typescript.ModuleResolutionKind.Node16,
66
+ strict: true,
67
+ skipLibCheck: true,
68
+ allowJs: true,
69
+ noEmit: true,
70
+ },
71
+ };
72
+ compilerProjects.set(key, configured);
73
+ return configured;
74
+ }
75
+ /**
76
+ * Declare every file a run will read, so one program covers it.
77
+ *
78
+ * `checkedSourceOf` rebuilds whenever it meets a root it has not seen, and a frond lives
79
+ * outside its project's tsconfig `include`, so every declaration was a new root: 44 files
80
+ * cost 7.3 s that way against 0.34 s for one program.
81
+ */
82
+ export async function seedTypeProgram(filePaths, projectRoot) {
83
+ const typescript = await loadTS();
84
+ const grouped = new Map();
85
+ for (const filePath of filePaths) {
86
+ const absolute = resolvePath(filePath);
87
+ const configured = compilerProjectOf(absolute, projectRoot);
88
+ const held = grouped.get(configured.key) ?? { options: configured.options, paths: [] };
89
+ held.paths.push(absolute);
90
+ grouped.set(configured.key, held);
91
+ }
92
+ for (const [key, { options, paths }] of grouped) {
93
+ const roots = new Set(typeProjects.get(key)?.roots ?? []);
94
+ for (const path of paths)
95
+ roots.add(path);
96
+ typeProjects.set(key, {
97
+ roots,
98
+ options,
99
+ program: typescript.createProgram({ rootNames: [...roots], options }),
100
+ });
101
+ }
102
+ }
103
+ function checkedSourceOf(filePath, projectRoot) {
104
+ const typescript = getTS();
105
+ const absolute = resolvePath(filePath);
106
+ const configured = compilerProjectOf(absolute, projectRoot);
107
+ let held = typeProjects.get(configured.key);
108
+ if (!held) {
109
+ // `path.resolve` is variadic, so handing it directly to `map` also passed the
110
+ // index and the whole roots array as path segments. A fixture without a warm scan
111
+ // cache exposed that first-run-only failure.
112
+ const roots = new Set(configured.roots.map((root) => resolvePath(root)));
113
+ roots.add(absolute);
114
+ const program = typescript.createProgram({ rootNames: [...roots], options: configured.options });
115
+ held = { roots, options: configured.options, program };
116
+ typeProjects.set(configured.key, held);
117
+ }
118
+ else if (!held.roots.has(absolute)) {
119
+ held.roots.add(absolute);
120
+ held.program = typescript.createProgram({
121
+ rootNames: [...held.roots],
122
+ options: held.options,
123
+ oldProgram: held.program,
124
+ });
125
+ }
126
+ const source = held.program.getSourceFile(absolute);
127
+ if (!source)
128
+ throw new Error(`TypeScript did not include '${absolute}' in its program.`);
129
+ return { source, checker: held.program.getTypeChecker() };
130
+ }
131
+ /** A file, opened. Five places read and parsed one, each spelling the same two calls. */
132
+ function sourceOf(filePath) {
133
+ const ts = getTS();
134
+ return ts.createSourceFile(filePath, readFileSync(filePath, 'utf-8'), ts.ScriptTarget.Latest, true);
135
+ }
136
+ /** One declared parameter — a constructor's and a method's are read the same way. */
137
+ function parsedParam(param, source, checker) {
138
+ const ts = getTS();
139
+ const type = param.type ? parseTypeNode(param.type, source, checker) : { raw: 'unknown', name: 'unknown' };
140
+ return {
141
+ name: ts.isIdentifier(param.name) ? param.name.text : param.name.getText(source),
142
+ type,
143
+ // `user?: User` and `user: User | undefined` are the same declaration of
144
+ // absence. A type alias may carry the latter, so only the checker can see it.
145
+ optional: param.questionToken !== undefined || param.initializer !== undefined || type.undefined === true,
146
+ };
147
+ }
148
+ /** Parse a TypeScript type node into a ParsedType. */
149
+ function parseTypeNode(node, source, checker) {
150
+ const ts = getTS();
151
+ const raw = node.getText(source);
152
+ if (checker) {
153
+ // `Fact<T>` is deliberately transparent in TypeScript (`type Fact<T> = T`), because
154
+ // a subscriber receives the payload itself. The checker erases that marker, while
155
+ // the binding plan still needs it to distinguish a fact from an ordinary body.
156
+ if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.text === 'Fact') {
157
+ return {
158
+ raw,
159
+ name: 'Fact',
160
+ generics: node.typeArguments?.map((arg) => parseTypeNode(arg, source, checker)) ?? [],
161
+ };
162
+ }
163
+ return parseCheckedType(checker.getTypeFromTypeNode(node), raw, checker);
164
+ }
165
+ // Union types — extract nullable, strip Promise
166
+ if (ts.isUnionTypeNode(node)) {
167
+ const nonNull = node.types.filter((t) => !(ts.isLiteralTypeNode(t) && t.literal.kind === ts.SyntaxKind.NullKeyword)
168
+ && !(t.kind === ts.SyntaxKind.UndefinedKeyword)
169
+ && !(t.kind === ts.SyntaxKind.VoidKeyword)
170
+ && !(t.kind === ts.SyntaxKind.NullKeyword));
171
+ const nullable = node.types.some((t) => (ts.isLiteralTypeNode(t) && t.literal.kind === ts.SyntaxKind.NullKeyword)
172
+ || t.kind === ts.SyntaxKind.NullKeyword);
173
+ const undefinable = node.types.some((t) => t.kind === ts.SyntaxKind.UndefinedKeyword || t.kind === ts.SyntaxKind.VoidKeyword);
174
+ if (nonNull.length === 1) {
175
+ const inner = parseTypeNode(nonNull[0], source);
176
+ return { ...inner, nullable: nullable || inner.nullable, undefined: undefinable || inner.undefined, raw };
177
+ }
178
+ return { raw, name: raw, nullable, undefined: undefinable };
179
+ }
180
+ // Promise<T> — unwrap
181
+ if (ts.isTypeReferenceNode(node)) {
182
+ const typeName = node.typeName.getText(source);
183
+ if (typeName === 'Promise' && node.typeArguments?.length === 1) {
184
+ const inner = parseTypeNode(node.typeArguments[0], source);
185
+ return { ...inner, promise: true, raw };
186
+ }
187
+ // Array<T>
188
+ if (typeName === 'Array' && node.typeArguments?.length === 1) {
189
+ const inner = parseTypeNode(node.typeArguments[0], source);
190
+ return { ...inner, array: true, arrayDepth: (inner.arrayDepth ?? 0) + 1, raw };
191
+ }
192
+ // Generic type: Foo<Bar, Baz>
193
+ if (node.typeArguments && node.typeArguments.length > 0) {
194
+ const generics = node.typeArguments.map((arg) => parseTypeNode(arg, source));
195
+ return { raw, name: typeName, generics };
196
+ }
197
+ // Simple type reference: Post, string, etc.
198
+ return { raw, name: typeName };
199
+ }
200
+ // T[]
201
+ if (ts.isArrayTypeNode(node)) {
202
+ const inner = parseTypeNode(node.elementType, source);
203
+ return { ...inner, array: true, arrayDepth: (inner.arrayDepth ?? 0) + 1, raw };
204
+ }
205
+ // Keyword types: string, number, boolean, void
206
+ switch (node.kind) {
207
+ case ts.SyntaxKind.StringKeyword: return { raw, name: 'string' };
208
+ case ts.SyntaxKind.NumberKeyword: return { raw, name: 'number' };
209
+ case ts.SyntaxKind.BooleanKeyword: return { raw, name: 'boolean' };
210
+ case ts.SyntaxKind.VoidKeyword: return { raw, name: 'void', undefined: true };
211
+ case ts.SyntaxKind.UndefinedKeyword: return { raw, name: 'undefined', undefined: true };
212
+ case ts.SyntaxKind.NullKeyword: return { raw, name: 'null', nullable: true };
213
+ case ts.SyntaxKind.AnyKeyword: return { raw, name: 'any' };
214
+ case ts.SyntaxKind.UnknownKeyword: return { raw, name: 'unknown' };
215
+ }
216
+ // Object literal type: { title: string; limit: number }
217
+ if (ts.isTypeLiteralNode(node)) {
218
+ return { raw, name: raw };
219
+ }
220
+ // Fallback
221
+ return { raw, name: raw };
222
+ }
223
+ function meaningfulSymbolName(type, checker) {
224
+ const typescript = getTS();
225
+ const symbol = type.aliasSymbol ?? type.getSymbol();
226
+ if (symbol && symbol.name !== 'default' && !symbol.name.startsWith('__'))
227
+ return symbol.name;
228
+ for (const declaration of symbol?.declarations ?? []) {
229
+ if ((typescript.isClassDeclaration(declaration)
230
+ || typescript.isInterfaceDeclaration(declaration)
231
+ || typescript.isTypeAliasDeclaration(declaration))
232
+ && declaration.name)
233
+ return declaration.name.text;
234
+ }
235
+ return checker.typeToString(type, undefined, typescript.TypeFormatFlags.NoTruncation);
236
+ }
237
+ /** Turn a checked TypeScript type into the small, serializable vocabulary the runtime reads. */
238
+ function parseCheckedType(type, raw, checker, depth = 0) {
239
+ const typescript = getTS();
240
+ if (depth > 12)
241
+ return { raw, name: checker.typeToString(type) };
242
+ if (type.isUnion()) {
243
+ const nullable = type.types.some((member) => (member.flags & typescript.TypeFlags.Null) !== 0);
244
+ const undefinable = type.types.some((member) => (member.flags & (typescript.TypeFlags.Undefined | typescript.TypeFlags.Void)) !== 0);
245
+ const members = type.types.filter((member) => (member.flags & (typescript.TypeFlags.Null | typescript.TypeFlags.Undefined | typescript.TypeFlags.Void)) === 0);
246
+ // The checker represents the `boolean` keyword itself as `false | true`. Preserve
247
+ // the primitive vocabulary consumed by binding and presenter metadata.
248
+ if (members.length > 0
249
+ && members.every((member) => (member.flags & typescript.TypeFlags.BooleanLiteral) !== 0)) {
250
+ return { raw, name: 'boolean', nullable, undefined: undefinable };
251
+ }
252
+ if (members.length === 1) {
253
+ const inner = parseCheckedType(members[0], raw, checker, depth + 1);
254
+ return {
255
+ ...inner,
256
+ raw,
257
+ nullable: nullable || inner.nullable,
258
+ undefined: undefinable || inner.undefined,
259
+ };
260
+ }
261
+ return {
262
+ raw,
263
+ name: members.map((member) => meaningfulSymbolName(member, checker)).join(' | ') || raw,
264
+ nullable,
265
+ undefined: undefinable,
266
+ };
267
+ }
268
+ // Present at runtime in the supported compiler versions, but intentionally omitted
269
+ // from TypeScript's public TypeChecker declaration.
270
+ const promised = checker.getPromisedTypeOfPromise(type);
271
+ if (promised)
272
+ return { ...parseCheckedType(promised, raw, checker, depth + 1), raw, promise: true };
273
+ if (checker.isArrayType(type)) {
274
+ const [element] = checker.getTypeArguments(type);
275
+ const inner = element ? parseCheckedType(element, raw, checker, depth + 1) : { raw, name: 'unknown' };
276
+ return { ...inner, raw, array: true, arrayDepth: (inner.arrayDepth ?? 0) + 1 };
277
+ }
278
+ if ((type.flags & typescript.TypeFlags.StringLike) !== 0)
279
+ return { raw, name: 'string' };
280
+ if ((type.flags & typescript.TypeFlags.NumberLike) !== 0)
281
+ return { raw, name: 'number' };
282
+ if ((type.flags & typescript.TypeFlags.BooleanLike) !== 0)
283
+ return { raw, name: 'boolean' };
284
+ if ((type.flags & typescript.TypeFlags.Void) !== 0)
285
+ return { raw, name: 'void', undefined: true };
286
+ if ((type.flags & typescript.TypeFlags.Undefined) !== 0)
287
+ return { raw, name: 'undefined', undefined: true };
288
+ if ((type.flags & typescript.TypeFlags.Null) !== 0)
289
+ return { raw, name: 'null', nullable: true };
290
+ if ((type.flags & typescript.TypeFlags.Any) !== 0)
291
+ return { raw, name: 'any' };
292
+ if ((type.flags & typescript.TypeFlags.Unknown) !== 0)
293
+ return { raw, name: 'unknown' };
294
+ const reference = type;
295
+ // A declared alias such as `Emit<PostPublished>` may reduce to a function or object
296
+ // type, so it is no longer a TypeReference. The checker keeps its arguments beside
297
+ // `aliasSymbol`; losing them turns DI keys into bare `Emit`/`Facade`.
298
+ const args = type.aliasTypeArguments
299
+ ?? checker.getTypeArguments(reference);
300
+ return {
301
+ raw,
302
+ name: meaningfulSymbolName(type, checker),
303
+ ...(args.length && { generics: args.map((arg) => parseCheckedType(arg, checker.typeToString(arg), checker, depth + 1)) }),
304
+ };
305
+ }
306
+ // ── Module resolution ────────────────────────
307
+ const TS_KEYWORDS = new Set([
308
+ 'string', 'number', 'boolean', 'void', 'undefined', 'null', 'any', 'unknown',
309
+ 'never', 'object', 'symbol', 'bigint',
310
+ ]);
311
+ /** Resolve an import specifier to an absolute file path. */
312
+ function resolveSpecifier(specifier, fromFile, projectRoot) {
313
+ // Relative import
314
+ if (specifier.startsWith('.')) {
315
+ const dir = dirname(fromFile);
316
+ let resolved = resolvePath(dir, specifier);
317
+ // .js → .ts
318
+ if (resolved.endsWith('.js'))
319
+ resolved = resolved.slice(0, -3) + '.ts';
320
+ if (!resolved.endsWith('.ts'))
321
+ resolved += '.ts';
322
+ if (existsSync(resolved))
323
+ return resolved;
324
+ return undefined;
325
+ }
326
+ // Workspace package: @fougere/core → packages/core/src/index.ts
327
+ const match = specifier.match(/^@fougere\/([^/]+)$/);
328
+ if (match) {
329
+ const pkgDir = join(projectRoot, 'packages', match[1], 'src');
330
+ const indexPath = join(pkgDir, 'index.ts');
331
+ if (existsSync(indexPath))
332
+ return indexPath;
333
+ }
334
+ return undefined;
335
+ }
336
+ // ── Mixin / heritage parsing ─────────────────
337
+ /**
338
+ * The class a returned expression carries, however it is wrapped.
339
+ *
340
+ * A mixin does not always hand its class back bare. `Crud` returns
341
+ * `asCrudConstructor(class CrudHandler { … })` — one assertion helper standing between
342
+ * `return` and the class — and a parser accepting only a bare `return class` found
343
+ * nothing there, silently: the five inherited CRUD ops stopped being derived, and a warm
344
+ * scan cache kept answering the old parse for weeks (`scan-cache.ts` keys on source, not
345
+ * on parser version).
346
+ *
347
+ * So unwrap rather than match one shape: descend through call arguments, `as` and
348
+ * `satisfies` assertions, and parentheses. What is looked for is a class; where the
349
+ * author put it is their business.
350
+ */
351
+ function classInExpression(expr, depth = 0) {
352
+ const ts = getTS();
353
+ if (depth > 8)
354
+ return undefined;
355
+ if (ts.isClassExpression(expr))
356
+ return expr;
357
+ if (ts.isCallExpression(expr)) {
358
+ for (const arg of expr.arguments) {
359
+ const found = classInExpression(arg, depth + 1);
360
+ if (found)
361
+ return found;
362
+ }
363
+ return undefined;
364
+ }
365
+ if (ts.isAsExpression(expr) || ts.isSatisfiesExpression(expr) || ts.isParenthesizedExpression(expr)) {
366
+ return classInExpression(expr.expression, depth + 1);
367
+ }
368
+ return undefined;
369
+ }
370
+ /** Find a class declaration inside a function (mixin pattern). */
371
+ function findClassInFunction(source, functionName) {
372
+ const ts = getTS();
373
+ for (const stmt of source.statements) {
374
+ if (!ts.isFunctionDeclaration(stmt))
375
+ continue;
376
+ if (stmt.name?.text !== functionName)
377
+ continue;
378
+ if (!stmt.body)
379
+ continue;
380
+ // Walk statements inside the function
381
+ for (const inner of stmt.body.statements) {
382
+ // return class CrudHandler { … }, or the same class behind a wrapper
383
+ if (ts.isReturnStatement(inner) && inner.expression) {
384
+ const found = classInExpression(inner.expression);
385
+ if (found)
386
+ return found;
387
+ }
388
+ // class CrudHandler { ... } (followed by return)
389
+ if (ts.isClassDeclaration(inner))
390
+ return inner;
391
+ }
392
+ }
393
+ return undefined;
394
+ }
395
+ /**
396
+ * Extract methods from a class node (no file reading — works on already-parsed AST).
397
+ */
398
+ function extractClassMethods(cls, source, skip, checker) {
399
+ const ts = getTS();
400
+ const results = [];
401
+ for (const member of cls.members) {
402
+ if (!ts.isMethodDeclaration(member))
403
+ continue;
404
+ if (!member.name || !ts.isIdentifier(member.name))
405
+ continue;
406
+ // `private`/`protected` is a statement about the surface, and the AST carries it —
407
+ // it was read past. Every helper a handler names by intent (`mustOwn`, `readMany`,
408
+ // `refuse`) became a callable op: measured on the bench, `list.readMany` executed
409
+ // and `list.mayPublish` judged its argument. A door is what the author declares
410
+ // public, and TypeScript already has the word for it. `#name` is private too, but
411
+ // it is not an identifier, so it never reached here in the first place.
412
+ if (member.modifiers?.some((m) => m.kind === ts.SyntaxKind.PrivateKeyword || m.kind === ts.SyntaxKind.ProtectedKeyword))
413
+ continue;
414
+ const name = member.name.text;
415
+ if (skip.has(name))
416
+ continue;
417
+ const params = member.parameters.map((p) => parsedParam(p, source, checker));
418
+ const returnType = member.type ? parseTypeNode(member.type, source, checker) : undefined;
419
+ results.push({
420
+ name, params, returnType,
421
+ description: docSentenceOf(member, source),
422
+ });
423
+ }
424
+ return results;
425
+ }
426
+ /**
427
+ * The first sentence of a member's doc comment, or nothing.
428
+ *
429
+ * One sentence on purpose: what a caller needs to choose an operation is a claim,
430
+ * not an essay, and the rest of the comment addresses whoever edits the method.
431
+ * Reads the leading trivia rather than `ts.getJSDocTags` — the comment is what the
432
+ * author wrote, tags are a schema they never agreed to.
433
+ */
434
+ function docSentenceOf(member, source) {
435
+ const ts = getTS();
436
+ const ranges = ts.getLeadingCommentRanges(source.text, member.pos) ?? [];
437
+ const block = ranges.filter((r) => source.text.slice(r.pos, r.pos + 3) === '/**').pop();
438
+ if (!block)
439
+ return undefined;
440
+ const body = source.text
441
+ .slice(block.pos + 3, block.end - 2)
442
+ .split('\n')
443
+ .map((line) => line.replace(/^\s*\*/, '').trim())
444
+ .join(' ')
445
+ .trim();
446
+ const [sentence] = body.split(/(?<=\.)\s/);
447
+ return sentence?.trim() || undefined;
448
+ }
449
+ /**
450
+ * Parse inherited methods from a class's heritage clause.
451
+ * Handles both `extends Crud(Entity)` (mixin) and `extends BaseClass` patterns.
452
+ */
453
+ /**
454
+ * Where a name used here is declared. The checker follows the import, the re-export chain
455
+ * and an installed package's types — the three cases three hand-rolled functions treated
456
+ * separately.
457
+ */
458
+ function declarationFileOf(node, checker) {
459
+ const typescript = getTS();
460
+ let symbol = checker.getSymbolAtLocation(node);
461
+ if (!symbol)
462
+ return undefined;
463
+ if (symbol.flags & typescript.SymbolFlags.Alias)
464
+ symbol = checker.getAliasedSymbol(symbol);
465
+ return symbol.declarations?.[0]?.getSourceFile().fileName;
466
+ }
467
+ /**
468
+ * The methods a base class contributes, read from the INSTANTIATED type.
469
+ *
470
+ * `extends Crud(Post)` gives `create(input: Partial<Post>)` directly: the checker has
471
+ * already substituted the mixin's type parameter. The three functions this replaces
472
+ * detected the generic names and mapped them to the mixin's arguments by position.
473
+ */
474
+ function inheritedFromBase(base, checker, skip) {
475
+ const typescript = getTS();
476
+ const results = [];
477
+ for (const property of checker.getPropertiesOfType(checker.getTypeAtLocation(base))) {
478
+ if (skip.has(property.name))
479
+ continue;
480
+ // `private`/`protected` is a statement about the surface, and the declaration carries
481
+ // it. A door is what the author declares public.
482
+ const declaration = property.declarations?.[0];
483
+ if (declaration && typescript.canHaveModifiers(declaration)
484
+ && typescript.getModifiers(declaration)?.some((m) => m.kind === typescript.SyntaxKind.PrivateKeyword
485
+ || m.kind === typescript.SyntaxKind.ProtectedKeyword))
486
+ continue;
487
+ const signature = checker.getTypeOfSymbolAtLocation(property, base).getCallSignatures()[0];
488
+ if (!signature)
489
+ continue;
490
+ const returned = signature.getReturnType();
491
+ const sentence = typescript.displayPartsToString(property.getDocumentationComment(checker)).trim();
492
+ results.push({
493
+ name: property.name,
494
+ params: signature.getParameters().map((parameter) => {
495
+ const type = checker.getTypeOfSymbolAtLocation(parameter, base);
496
+ return {
497
+ name: parameter.name,
498
+ type: parseCheckedType(type, checker.typeToString(type), checker),
499
+ optional: (parameter.flags & typescript.SymbolFlags.Optional) !== 0,
500
+ };
501
+ }),
502
+ returnType: parseCheckedType(returned, checker.typeToString(returned), checker),
503
+ ...(sentence ? { description: sentence.split(/(?<=\.)\s/)[0] } : {}),
504
+ });
505
+ }
506
+ return results;
507
+ }
508
+ function parseInheritedMethods(cls, source, checker, skip,
509
+ /**
510
+ * Base classes this pass could not open — an INSTALLED one, typically, whose
511
+ * source is not in the workspace. Reported rather than treated as "no inherited
512
+ * method": the two used to be the same answer, so an op inherited from a
513
+ * published base class was absent from the façade without a word.
514
+ */
515
+ unresolved) {
516
+ const ts = getTS();
517
+ if (!cls.heritageClauses)
518
+ return [];
519
+ for (const clause of cls.heritageClauses) {
520
+ if (clause.token !== ts.SyntaxKind.ExtendsKeyword)
521
+ continue;
522
+ for (const base of clause.types) {
523
+ const fromType = inheritedFromBase(base, checker, skip);
524
+ if (fromType.length > 0)
525
+ return fromType;
526
+ // A factory that ERASES its own type — `assertShape<unknown>(class …)`, `as unknown`
527
+ // — leaves the checker with nothing to enumerate. The written class is still there,
528
+ // so read it. This is the one case where what the author wrote beats what it means.
529
+ const expression = base.expression;
530
+ const declared = ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)
531
+ ? declarationFileOf(expression.expression, checker)
532
+ : ts.isIdentifier(expression) ? declarationFileOf(expression, checker) : undefined;
533
+ if (!declared) {
534
+ unresolved.push(expression.getText(source));
535
+ continue;
536
+ }
537
+ const declaredSource = sourceOf(declared);
538
+ const written = ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)
539
+ ? findClassInFunction(declaredSource, expression.expression.text)
540
+ : findDefaultClass(declaredSource);
541
+ if (!written) {
542
+ unresolved.push(expression.getText(source));
543
+ continue;
544
+ }
545
+ return extractClassMethods(written, declaredSource, skip);
546
+ }
547
+ }
548
+ return [];
549
+ }
550
+ // ── Class finding ────────────────────────────
551
+ /** Find the default exported class in a source file. */
552
+ function findDefaultClass(source) {
553
+ const ts = getTS();
554
+ for (const stmt of source.statements) {
555
+ // export default class Foo { ... }
556
+ if (ts.isClassDeclaration(stmt) && stmt.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) && stmt.modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword)) {
557
+ return stmt;
558
+ }
559
+ }
560
+ // export default Foo (separate statement) — find the class it points to
561
+ for (const stmt of source.statements) {
562
+ if (ts.isExportAssignment(stmt) && !stmt.isExportEquals && ts.isIdentifier(stmt.expression)) {
563
+ const name = stmt.expression.text;
564
+ for (const s of source.statements) {
565
+ if (ts.isClassDeclaration(s) && s.name?.text === name)
566
+ return s;
567
+ }
568
+ }
569
+ }
570
+ return undefined;
571
+ }
572
+ /**
573
+ * Every method a handler declares, its inherited ones included — the raw material of a
574
+ * binding plan. With a `projectRoot`, the heritage clause is followed too.
575
+ */
576
+ export async function parseAllHandlerMethods(filePath, projectRoot) {
577
+ await loadTS();
578
+ return parseClassMethods(filePath, CONSTRUCTOR_ONLY, projectRoot);
579
+ }
580
+ /**
581
+ * Parse a presenter source file and extract all method signatures.
582
+ *
583
+ * Returns all methods (no CRUD filtering) — each method is a computed field.
584
+ */
585
+ export async function parsePresenterMethods(filePath, projectRoot) {
586
+ await loadTS();
587
+ // No `projectRoot`, so no heritage pass and nothing to report: a presenter's
588
+ // computed fields are its own methods.
589
+ return parseClassMethods(filePath, CONSTRUCTOR_ONLY, undefined, projectRoot).methods;
590
+ }
591
+ /**
592
+ * Parse constructor parameter types from a source file's default class.
593
+ * Returns type names (e.g. ['PostOrm', 'Logger']) for DI resolution.
594
+ */
595
+ export async function parseConstructorParams(filePath, projectRoot) {
596
+ const ts = await loadTS();
597
+ const { source, checker } = checkedSourceOf(filePath, projectRoot);
598
+ const cls = findDefaultClass(source);
599
+ if (!cls)
600
+ return [];
601
+ const ctor = cls.members.find(ts.isConstructorDeclaration);
602
+ return ctor ? ctor.parameters.map((p) => parsedParam(p, source, checker)) : [];
603
+ }
604
+ const CONSTRUCTOR_ONLY = new Set(['constructor']);
605
+ function parseClassMethods(filePath, skip, heritageRoot, typeRoot = heritageRoot) {
606
+ const unresolved = [];
607
+ const { source, checker } = checkedSourceOf(filePath, typeRoot);
608
+ const cls = findDefaultClass(source);
609
+ if (!cls)
610
+ return { methods: [], unresolvedHeritage: unresolved };
611
+ // Parse child class methods
612
+ const childMethods = extractClassMethods(cls, source, skip, checker);
613
+ const childNames = new Set(childMethods.map((m) => m.name));
614
+ // Parse inherited methods (if projectRoot is provided for resolution)
615
+ if (heritageRoot) {
616
+ const inherited = parseInheritedMethods(cls, source, checker, skip, unresolved);
617
+ // Merge: child methods win over inherited
618
+ const parentOnly = inherited
619
+ .filter((m) => !childNames.has(m.name))
620
+ .map((m) => ({ ...m, inherited: true }));
621
+ return { methods: [...childMethods, ...parentOnly], unresolvedHeritage: unresolved };
622
+ }
623
+ return { methods: childMethods, unresolvedHeritage: unresolved };
624
+ }
625
+ //# sourceMappingURL=handler-parser.js.map