@justscale/core 0.1.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 (784) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/bin/just.js +34 -0
  4. package/dist/app.d.ts +56 -0
  5. package/dist/app.d.ts.map +1 -0
  6. package/dist/app.js +182 -0
  7. package/dist/app.js.map +1 -0
  8. package/dist/builder/build-context.d.ts +8 -0
  9. package/dist/builder/build-context.d.ts.map +1 -0
  10. package/dist/builder/build-context.js +4 -0
  11. package/dist/builder/build-context.js.map +1 -0
  12. package/dist/builder/builder.d.ts +60 -0
  13. package/dist/builder/builder.d.ts.map +1 -0
  14. package/dist/builder/builder.js +72 -0
  15. package/dist/builder/builder.js.map +1 -0
  16. package/dist/builder/create-builder.d.ts +36 -0
  17. package/dist/builder/create-builder.d.ts.map +1 -0
  18. package/dist/builder/create-builder.js +66 -0
  19. package/dist/builder/create-builder.js.map +1 -0
  20. package/dist/builder/execute.d.ts +37 -0
  21. package/dist/builder/execute.d.ts.map +1 -0
  22. package/dist/builder/execute.js +62 -0
  23. package/dist/builder/execute.js.map +1 -0
  24. package/dist/builder/feature-builder.d.ts +147 -0
  25. package/dist/builder/feature-builder.d.ts.map +1 -0
  26. package/dist/builder/feature-builder.js +138 -0
  27. package/dist/builder/feature-builder.js.map +1 -0
  28. package/dist/builder/index.d.ts +35 -0
  29. package/dist/builder/index.d.ts.map +1 -0
  30. package/dist/builder/index.js +37 -0
  31. package/dist/builder/index.js.map +1 -0
  32. package/dist/builder/plugin.d.ts +90 -0
  33. package/dist/builder/plugin.d.ts.map +1 -0
  34. package/dist/builder/plugin.js +101 -0
  35. package/dist/builder/plugin.js.map +1 -0
  36. package/dist/builder/plugins/query.d.ts +31 -0
  37. package/dist/builder/plugins/query.d.ts.map +1 -0
  38. package/dist/builder/plugins/query.js +42 -0
  39. package/dist/builder/plugins/query.js.map +1 -0
  40. package/dist/builder/plugins/validation.d.ts +12 -0
  41. package/dist/builder/plugins/validation.d.ts.map +1 -0
  42. package/dist/builder/plugins/validation.js +12 -0
  43. package/dist/builder/plugins/validation.js.map +1 -0
  44. package/dist/builder/sort.d.ts +27 -0
  45. package/dist/builder/sort.d.ts.map +1 -0
  46. package/dist/builder/sort.js +210 -0
  47. package/dist/builder/sort.js.map +1 -0
  48. package/dist/builder/stop.d.ts +24 -0
  49. package/dist/builder/stop.d.ts.map +1 -0
  50. package/dist/builder/stop.js +27 -0
  51. package/dist/builder/stop.js.map +1 -0
  52. package/dist/builder/test/permits-type-spike.d.ts +8 -0
  53. package/dist/builder/test/permits-type-spike.d.ts.map +1 -0
  54. package/dist/builder/test/permits-type-spike.js +117 -0
  55. package/dist/builder/test/permits-type-spike.js.map +1 -0
  56. package/dist/builder/types.d.ts +678 -0
  57. package/dist/builder/types.d.ts.map +1 -0
  58. package/dist/builder/types.js +98 -0
  59. package/dist/builder/types.js.map +1 -0
  60. package/dist/builder/validation.d.ts +101 -0
  61. package/dist/builder/validation.d.ts.map +1 -0
  62. package/dist/builder/validation.js +335 -0
  63. package/dist/builder/validation.js.map +1 -0
  64. package/dist/cli/adapter.d.ts +23 -0
  65. package/dist/cli/adapter.d.ts.map +1 -0
  66. package/dist/cli/adapter.js +26 -0
  67. package/dist/cli/adapter.js.map +1 -0
  68. package/dist/cli/args.d.ts +150 -0
  69. package/dist/cli/args.d.ts.map +1 -0
  70. package/dist/cli/args.js +172 -0
  71. package/dist/cli/args.js.map +1 -0
  72. package/dist/cli/assemble.d.ts +20 -0
  73. package/dist/cli/assemble.d.ts.map +1 -0
  74. package/dist/cli/assemble.js +55 -0
  75. package/dist/cli/assemble.js.map +1 -0
  76. package/dist/cli/bin/main.d.ts +26 -0
  77. package/dist/cli/bin/main.d.ts.map +1 -0
  78. package/dist/cli/bin/main.js +475 -0
  79. package/dist/cli/bin/main.js.map +1 -0
  80. package/dist/cli/build/migrations-plugin.d.ts +21 -0
  81. package/dist/cli/build/migrations-plugin.d.ts.map +1 -0
  82. package/dist/cli/build/migrations-plugin.js +41 -0
  83. package/dist/cli/build/migrations-plugin.js.map +1 -0
  84. package/dist/cli/build/process-plugin.d.ts +29 -0
  85. package/dist/cli/build/process-plugin.d.ts.map +1 -0
  86. package/dist/cli/build/process-plugin.js +66 -0
  87. package/dist/cli/build/process-plugin.js.map +1 -0
  88. package/dist/cli/builder/create-cli-builder.d.ts +42 -0
  89. package/dist/cli/builder/create-cli-builder.d.ts.map +1 -0
  90. package/dist/cli/builder/create-cli-builder.js +104 -0
  91. package/dist/cli/builder/create-cli-builder.js.map +1 -0
  92. package/dist/cli/builder/index.d.ts +8 -0
  93. package/dist/cli/builder/index.d.ts.map +1 -0
  94. package/dist/cli/builder/index.js +7 -0
  95. package/dist/cli/builder/index.js.map +1 -0
  96. package/dist/cli/builder/types.d.ts +113 -0
  97. package/dist/cli/builder/types.d.ts.map +1 -0
  98. package/dist/cli/builder/types.js +7 -0
  99. package/dist/cli/builder/types.js.map +1 -0
  100. package/dist/cli/cluster.d.ts +8 -0
  101. package/dist/cli/cluster.d.ts.map +1 -0
  102. package/dist/cli/cluster.js +145 -0
  103. package/dist/cli/cluster.js.map +1 -0
  104. package/dist/cli/current-app.d.ts +36 -0
  105. package/dist/cli/current-app.d.ts.map +1 -0
  106. package/dist/cli/current-app.js +21 -0
  107. package/dist/cli/current-app.js.map +1 -0
  108. package/dist/cli/define-app.d.ts +35 -0
  109. package/dist/cli/define-app.d.ts.map +1 -0
  110. package/dist/cli/define-app.js +79 -0
  111. package/dist/cli/define-app.js.map +1 -0
  112. package/dist/cli/define-main.d.ts +33 -0
  113. package/dist/cli/define-main.d.ts.map +1 -0
  114. package/dist/cli/define-main.js +67 -0
  115. package/dist/cli/define-main.js.map +1 -0
  116. package/dist/cli/define-project.d.ts +93 -0
  117. package/dist/cli/define-project.d.ts.map +1 -0
  118. package/dist/cli/define-project.js +85 -0
  119. package/dist/cli/define-project.js.map +1 -0
  120. package/dist/cli/dev-server.d.ts +20 -0
  121. package/dist/cli/dev-server.d.ts.map +1 -0
  122. package/dist/cli/dev-server.js +131 -0
  123. package/dist/cli/dev-server.js.map +1 -0
  124. package/dist/cli/discovery.d.ts +29 -0
  125. package/dist/cli/discovery.d.ts.map +1 -0
  126. package/dist/cli/discovery.js +142 -0
  127. package/dist/cli/discovery.js.map +1 -0
  128. package/dist/cli/factory.d.ts +43 -0
  129. package/dist/cli/factory.d.ts.map +1 -0
  130. package/dist/cli/factory.js +52 -0
  131. package/dist/cli/factory.js.map +1 -0
  132. package/dist/cli/generators/ai.d.ts +3 -0
  133. package/dist/cli/generators/ai.d.ts.map +1 -0
  134. package/dist/cli/generators/ai.js +65 -0
  135. package/dist/cli/generators/ai.js.map +1 -0
  136. package/dist/cli/generators/ci.d.ts +5 -0
  137. package/dist/cli/generators/ci.d.ts.map +1 -0
  138. package/dist/cli/generators/ci.js +102 -0
  139. package/dist/cli/generators/ci.js.map +1 -0
  140. package/dist/cli/generators/detect.d.ts +15 -0
  141. package/dist/cli/generators/detect.d.ts.map +1 -0
  142. package/dist/cli/generators/detect.js +75 -0
  143. package/dist/cli/generators/detect.js.map +1 -0
  144. package/dist/cli/generators/ide.d.ts +3 -0
  145. package/dist/cli/generators/ide.d.ts.map +1 -0
  146. package/dist/cli/generators/ide.js +179 -0
  147. package/dist/cli/generators/ide.js.map +1 -0
  148. package/dist/cli/generators/index.d.ts +5 -0
  149. package/dist/cli/generators/index.d.ts.map +1 -0
  150. package/dist/cli/generators/index.js +5 -0
  151. package/dist/cli/generators/index.js.map +1 -0
  152. package/dist/cli/index.d.ts +81 -0
  153. package/dist/cli/index.d.ts.map +1 -0
  154. package/dist/cli/index.js +88 -0
  155. package/dist/cli/index.js.map +1 -0
  156. package/dist/cli/io.d.ts +131 -0
  157. package/dist/cli/io.d.ts.map +1 -0
  158. package/dist/cli/io.js +373 -0
  159. package/dist/cli/io.js.map +1 -0
  160. package/dist/cli/mcp/server.d.ts +23 -0
  161. package/dist/cli/mcp/server.d.ts.map +1 -0
  162. package/dist/cli/mcp/server.js +148 -0
  163. package/dist/cli/mcp/server.js.map +1 -0
  164. package/dist/cli/parser.d.ts +106 -0
  165. package/dist/cli/parser.d.ts.map +1 -0
  166. package/dist/cli/parser.js +520 -0
  167. package/dist/cli/parser.js.map +1 -0
  168. package/dist/cli/runner.d.ts +75 -0
  169. package/dist/cli/runner.d.ts.map +1 -0
  170. package/dist/cli/runner.js +422 -0
  171. package/dist/cli/runner.js.map +1 -0
  172. package/dist/cli/service.d.ts +61 -0
  173. package/dist/cli/service.d.ts.map +1 -0
  174. package/dist/cli/service.js +95 -0
  175. package/dist/cli/service.js.map +1 -0
  176. package/dist/cli/types.d.ts +47 -0
  177. package/dist/cli/types.d.ts.map +1 -0
  178. package/dist/cli/types.js +20 -0
  179. package/dist/cli/types.js.map +1 -0
  180. package/dist/cli/wizard.d.ts +11 -0
  181. package/dist/cli/wizard.d.ts.map +1 -0
  182. package/dist/cli/wizard.js +2 -0
  183. package/dist/cli/wizard.js.map +1 -0
  184. package/dist/cli/workspace-controller.d.ts +36 -0
  185. package/dist/cli/workspace-controller.d.ts.map +1 -0
  186. package/dist/cli/workspace-controller.js +896 -0
  187. package/dist/cli/workspace-controller.js.map +1 -0
  188. package/dist/cluster/client.d.ts +101 -0
  189. package/dist/cluster/client.d.ts.map +1 -0
  190. package/dist/cluster/client.js +256 -0
  191. package/dist/cluster/client.js.map +1 -0
  192. package/dist/cluster/cluster.d.ts +82 -0
  193. package/dist/cluster/cluster.d.ts.map +1 -0
  194. package/dist/cluster/cluster.js +27 -0
  195. package/dist/cluster/cluster.js.map +1 -0
  196. package/dist/cluster/coordinator/cluster-node.model.d.ts +14 -0
  197. package/dist/cluster/coordinator/cluster-node.model.d.ts.map +1 -0
  198. package/dist/cluster/coordinator/cluster-node.model.js +15 -0
  199. package/dist/cluster/coordinator/cluster-node.model.js.map +1 -0
  200. package/dist/cluster/coordinator/cluster-signals.d.ts +45 -0
  201. package/dist/cluster/coordinator/cluster-signals.d.ts.map +1 -0
  202. package/dist/cluster/coordinator/cluster-signals.js +24 -0
  203. package/dist/cluster/coordinator/cluster-signals.js.map +1 -0
  204. package/dist/cluster/coordinator/coordinator.process.d.ts +21 -0
  205. package/dist/cluster/coordinator/coordinator.process.d.ts.map +1 -0
  206. package/dist/cluster/coordinator/coordinator.process.js +221 -0
  207. package/dist/cluster/coordinator/coordinator.process.js.map +1 -0
  208. package/dist/cluster/coordinator/index.d.ts +13 -0
  209. package/dist/cluster/coordinator/index.d.ts.map +1 -0
  210. package/dist/cluster/coordinator/index.js +13 -0
  211. package/dist/cluster/coordinator/index.js.map +1 -0
  212. package/dist/cluster/coordinator/node-lifecycle.d.ts +31 -0
  213. package/dist/cluster/coordinator/node-lifecycle.d.ts.map +1 -0
  214. package/dist/cluster/coordinator/node-lifecycle.js +178 -0
  215. package/dist/cluster/coordinator/node-lifecycle.js.map +1 -0
  216. package/dist/cluster/index.d.ts +45 -0
  217. package/dist/cluster/index.d.ts.map +1 -0
  218. package/dist/cluster/index.js +57 -0
  219. package/dist/cluster/index.js.map +1 -0
  220. package/dist/cluster/protocol.d.ts +204 -0
  221. package/dist/cluster/protocol.d.ts.map +1 -0
  222. package/dist/cluster/protocol.js +274 -0
  223. package/dist/cluster/protocol.js.map +1 -0
  224. package/dist/cluster/scheduled-task/builder.d.ts +24 -0
  225. package/dist/cluster/scheduled-task/builder.d.ts.map +1 -0
  226. package/dist/cluster/scheduled-task/builder.js +63 -0
  227. package/dist/cluster/scheduled-task/builder.js.map +1 -0
  228. package/dist/cluster/scheduled-task/factory.d.ts +76 -0
  229. package/dist/cluster/scheduled-task/factory.d.ts.map +1 -0
  230. package/dist/cluster/scheduled-task/factory.js +64 -0
  231. package/dist/cluster/scheduled-task/factory.js.map +1 -0
  232. package/dist/cluster/scheduled-task/index.d.ts +43 -0
  233. package/dist/cluster/scheduled-task/index.d.ts.map +1 -0
  234. package/dist/cluster/scheduled-task/index.js +45 -0
  235. package/dist/cluster/scheduled-task/index.js.map +1 -0
  236. package/dist/cluster/scheduled-task/transport.d.ts +12 -0
  237. package/dist/cluster/scheduled-task/transport.d.ts.map +1 -0
  238. package/dist/cluster/scheduled-task/transport.js +146 -0
  239. package/dist/cluster/scheduled-task/transport.js.map +1 -0
  240. package/dist/cluster/scheduled-task/types.d.ts +89 -0
  241. package/dist/cluster/scheduled-task/types.d.ts.map +1 -0
  242. package/dist/cluster/scheduled-task/types.js +7 -0
  243. package/dist/cluster/scheduled-task/types.js.map +1 -0
  244. package/dist/cluster/server.d.ts +87 -0
  245. package/dist/cluster/server.d.ts.map +1 -0
  246. package/dist/cluster/server.js +290 -0
  247. package/dist/cluster/server.js.map +1 -0
  248. package/dist/cluster/transport.d.ts +86 -0
  249. package/dist/cluster/transport.d.ts.map +1 -0
  250. package/dist/cluster/transport.js +138 -0
  251. package/dist/cluster/transport.js.map +1 -0
  252. package/dist/core/container-hooks.d.ts +22 -0
  253. package/dist/core/container-hooks.d.ts.map +1 -0
  254. package/dist/core/container-hooks.js +29 -0
  255. package/dist/core/container-hooks.js.map +1 -0
  256. package/dist/core/container-reflection.d.ts +71 -0
  257. package/dist/core/container-reflection.d.ts.map +1 -0
  258. package/dist/core/container-reflection.js +60 -0
  259. package/dist/core/container-reflection.js.map +1 -0
  260. package/dist/core/context.d.ts +146 -0
  261. package/dist/core/context.d.ts.map +1 -0
  262. package/dist/core/context.js +155 -0
  263. package/dist/core/context.js.map +1 -0
  264. package/dist/core/contribution.d.ts +152 -0
  265. package/dist/core/contribution.d.ts.map +1 -0
  266. package/dist/core/contribution.js +213 -0
  267. package/dist/core/contribution.js.map +1 -0
  268. package/dist/core/controller.contextual.d.ts +193 -0
  269. package/dist/core/controller.contextual.d.ts.map +1 -0
  270. package/dist/core/controller.contextual.js +459 -0
  271. package/dist/core/controller.contextual.js.map +1 -0
  272. package/dist/core/controller.d.ts +510 -0
  273. package/dist/core/controller.d.ts.map +1 -0
  274. package/dist/core/controller.js +411 -0
  275. package/dist/core/controller.js.map +1 -0
  276. package/dist/core/controller.procedure.d.ts +147 -0
  277. package/dist/core/controller.procedure.d.ts.map +1 -0
  278. package/dist/core/controller.procedure.js +115 -0
  279. package/dist/core/controller.procedure.js.map +1 -0
  280. package/dist/core/disposable.d.ts +126 -0
  281. package/dist/core/disposable.d.ts.map +1 -0
  282. package/dist/core/disposable.js +179 -0
  283. package/dist/core/disposable.js.map +1 -0
  284. package/dist/core/hmr.d.ts +83 -0
  285. package/dist/core/hmr.d.ts.map +1 -0
  286. package/dist/core/hmr.js +211 -0
  287. package/dist/core/hmr.js.map +1 -0
  288. package/dist/core/index.d.ts +17 -0
  289. package/dist/core/index.d.ts.map +1 -0
  290. package/dist/core/index.js +25 -0
  291. package/dist/core/index.js.map +1 -0
  292. package/dist/core/internal/routes.d.ts +26 -0
  293. package/dist/core/internal/routes.d.ts.map +1 -0
  294. package/dist/core/internal/routes.js +48 -0
  295. package/dist/core/internal/routes.js.map +1 -0
  296. package/dist/core/lifecycle-impl.d.ts +45 -0
  297. package/dist/core/lifecycle-impl.d.ts.map +1 -0
  298. package/dist/core/lifecycle-impl.js +102 -0
  299. package/dist/core/lifecycle-impl.js.map +1 -0
  300. package/dist/core/lifecycle.d.ts +86 -0
  301. package/dist/core/lifecycle.d.ts.map +1 -0
  302. package/dist/core/lifecycle.js +38 -0
  303. package/dist/core/lifecycle.js.map +1 -0
  304. package/dist/core/logger.d.ts +282 -0
  305. package/dist/core/logger.d.ts.map +1 -0
  306. package/dist/core/logger.js +368 -0
  307. package/dist/core/logger.js.map +1 -0
  308. package/dist/core/middleware.d.ts +108 -0
  309. package/dist/core/middleware.d.ts.map +1 -0
  310. package/dist/core/middleware.js +60 -0
  311. package/dist/core/middleware.js.map +1 -0
  312. package/dist/core/openapi-methods.d.ts +61 -0
  313. package/dist/core/openapi-methods.d.ts.map +1 -0
  314. package/dist/core/openapi-methods.js +53 -0
  315. package/dist/core/openapi-methods.js.map +1 -0
  316. package/dist/core/plugin.d.ts +209 -0
  317. package/dist/core/plugin.d.ts.map +1 -0
  318. package/dist/core/plugin.js +36 -0
  319. package/dist/core/plugin.js.map +1 -0
  320. package/dist/core/scope-bridge.d.ts +19 -0
  321. package/dist/core/scope-bridge.d.ts.map +1 -0
  322. package/dist/core/scope-bridge.js +34 -0
  323. package/dist/core/scope-bridge.js.map +1 -0
  324. package/dist/core/service.d.ts +429 -0
  325. package/dist/core/service.d.ts.map +1 -0
  326. package/dist/core/service.js +875 -0
  327. package/dist/core/service.js.map +1 -0
  328. package/dist/features/channel/backend.d.ts +98 -0
  329. package/dist/features/channel/backend.d.ts.map +1 -0
  330. package/dist/features/channel/backend.js +75 -0
  331. package/dist/features/channel/backend.js.map +1 -0
  332. package/dist/features/channel/channel.d.ts +18 -0
  333. package/dist/features/channel/channel.d.ts.map +1 -0
  334. package/dist/features/channel/channel.js +219 -0
  335. package/dist/features/channel/channel.js.map +1 -0
  336. package/dist/features/channel/channels.d.ts +87 -0
  337. package/dist/features/channel/channels.d.ts.map +1 -0
  338. package/dist/features/channel/channels.js +252 -0
  339. package/dist/features/channel/channels.js.map +1 -0
  340. package/dist/features/channel/feature.d.ts +40 -0
  341. package/dist/features/channel/feature.d.ts.map +1 -0
  342. package/dist/features/channel/feature.js +44 -0
  343. package/dist/features/channel/feature.js.map +1 -0
  344. package/dist/features/channel/index.d.ts +41 -0
  345. package/dist/features/channel/index.d.ts.map +1 -0
  346. package/dist/features/channel/index.js +41 -0
  347. package/dist/features/channel/index.js.map +1 -0
  348. package/dist/features/channel/types.d.ts +165 -0
  349. package/dist/features/channel/types.d.ts.map +1 -0
  350. package/dist/features/channel/types.js +10 -0
  351. package/dist/features/channel/types.js.map +1 -0
  352. package/dist/features/config/cli/config-controller.d.ts +77 -0
  353. package/dist/features/config/cli/config-controller.d.ts.map +1 -0
  354. package/dist/features/config/cli/config-controller.js +209 -0
  355. package/dist/features/config/cli/config-controller.js.map +1 -0
  356. package/dist/features/config/cli/index.d.ts +9 -0
  357. package/dist/features/config/cli/index.d.ts.map +1 -0
  358. package/dist/features/config/cli/index.js +9 -0
  359. package/dist/features/config/cli/index.js.map +1 -0
  360. package/dist/features/config/cli/profile-controller.d.ts +87 -0
  361. package/dist/features/config/cli/profile-controller.d.ts.map +1 -0
  362. package/dist/features/config/cli/profile-controller.js +223 -0
  363. package/dist/features/config/cli/profile-controller.js.map +1 -0
  364. package/dist/features/config/cli/utils.d.ts +14 -0
  365. package/dist/features/config/cli/utils.d.ts.map +1 -0
  366. package/dist/features/config/cli/utils.js +29 -0
  367. package/dist/features/config/cli/utils.js.map +1 -0
  368. package/dist/features/config/config-of.d.ts +36 -0
  369. package/dist/features/config/config-of.d.ts.map +1 -0
  370. package/dist/features/config/config-of.js +36 -0
  371. package/dist/features/config/config-of.js.map +1 -0
  372. package/dist/features/config/config-service.d.ts +54 -0
  373. package/dist/features/config/config-service.d.ts.map +1 -0
  374. package/dist/features/config/config-service.js +184 -0
  375. package/dist/features/config/config-service.js.map +1 -0
  376. package/dist/features/config/create-config.d.ts +21 -0
  377. package/dist/features/config/create-config.d.ts.map +1 -0
  378. package/dist/features/config/create-config.js +16 -0
  379. package/dist/features/config/create-config.js.map +1 -0
  380. package/dist/features/config/define-config-partial.d.ts +13 -0
  381. package/dist/features/config/define-config-partial.d.ts.map +1 -0
  382. package/dist/features/config/define-config-partial.js +19 -0
  383. package/dist/features/config/define-config-partial.js.map +1 -0
  384. package/dist/features/config/env-service.d.ts +54 -0
  385. package/dist/features/config/env-service.d.ts.map +1 -0
  386. package/dist/features/config/env-service.js +115 -0
  387. package/dist/features/config/env-service.js.map +1 -0
  388. package/dist/features/config/file-watcher.d.ts +13 -0
  389. package/dist/features/config/file-watcher.d.ts.map +1 -0
  390. package/dist/features/config/file-watcher.js +98 -0
  391. package/dist/features/config/file-watcher.js.map +1 -0
  392. package/dist/features/config/index.d.ts +21 -0
  393. package/dist/features/config/index.d.ts.map +1 -0
  394. package/dist/features/config/index.js +24 -0
  395. package/dist/features/config/index.js.map +1 -0
  396. package/dist/features/config/profile-service.d.ts +59 -0
  397. package/dist/features/config/profile-service.d.ts.map +1 -0
  398. package/dist/features/config/profile-service.js +114 -0
  399. package/dist/features/config/profile-service.js.map +1 -0
  400. package/dist/features/config/types.d.ts +38 -0
  401. package/dist/features/config/types.d.ts.map +1 -0
  402. package/dist/features/config/types.js +17 -0
  403. package/dist/features/config/types.js.map +1 -0
  404. package/dist/features/contract/contract.d.ts +264 -0
  405. package/dist/features/contract/contract.d.ts.map +1 -0
  406. package/dist/features/contract/contract.js +183 -0
  407. package/dist/features/contract/contract.js.map +1 -0
  408. package/dist/features/contract/index.d.ts +2 -0
  409. package/dist/features/contract/index.d.ts.map +1 -0
  410. package/dist/features/contract/index.js +2 -0
  411. package/dist/features/contract/index.js.map +1 -0
  412. package/dist/features/env/contribute.d.ts +70 -0
  413. package/dist/features/env/contribute.d.ts.map +1 -0
  414. package/dist/features/env/contribute.js +195 -0
  415. package/dist/features/env/contribute.js.map +1 -0
  416. package/dist/features/environment/create-environment.d.ts +58 -0
  417. package/dist/features/environment/create-environment.d.ts.map +1 -0
  418. package/dist/features/environment/create-environment.js +22 -0
  419. package/dist/features/environment/create-environment.js.map +1 -0
  420. package/dist/features/environment/index.d.ts +12 -0
  421. package/dist/features/environment/index.d.ts.map +1 -0
  422. package/dist/features/environment/index.js +10 -0
  423. package/dist/features/environment/index.js.map +1 -0
  424. package/dist/features/environment/load.d.ts +59 -0
  425. package/dist/features/environment/load.d.ts.map +1 -0
  426. package/dist/features/environment/load.js +117 -0
  427. package/dist/features/environment/load.js.map +1 -0
  428. package/dist/features/environment/types.d.ts +165 -0
  429. package/dist/features/environment/types.d.ts.map +1 -0
  430. package/dist/features/environment/types.js +18 -0
  431. package/dist/features/environment/types.js.map +1 -0
  432. package/dist/features/feature-flags/create-feature-flag-provider.d.ts +21 -0
  433. package/dist/features/feature-flags/create-feature-flag-provider.d.ts.map +1 -0
  434. package/dist/features/feature-flags/create-feature-flag-provider.js +16 -0
  435. package/dist/features/feature-flags/create-feature-flag-provider.js.map +1 -0
  436. package/dist/features/feature-flags/define-feature-flag-partial.d.ts +20 -0
  437. package/dist/features/feature-flags/define-feature-flag-partial.d.ts.map +1 -0
  438. package/dist/features/feature-flags/define-feature-flag-partial.js +26 -0
  439. package/dist/features/feature-flags/define-feature-flag-partial.js.map +1 -0
  440. package/dist/features/feature-flags/feature-flag-of.d.ts +16 -0
  441. package/dist/features/feature-flags/feature-flag-of.d.ts.map +1 -0
  442. package/dist/features/feature-flags/feature-flag-of.js +16 -0
  443. package/dist/features/feature-flags/feature-flag-of.js.map +1 -0
  444. package/dist/features/feature-flags/feature-flag-service.d.ts +22 -0
  445. package/dist/features/feature-flags/feature-flag-service.d.ts.map +1 -0
  446. package/dist/features/feature-flags/feature-flag-service.js +112 -0
  447. package/dist/features/feature-flags/feature-flag-service.js.map +1 -0
  448. package/dist/features/feature-flags/index.d.ts +15 -0
  449. package/dist/features/feature-flags/index.d.ts.map +1 -0
  450. package/dist/features/feature-flags/index.js +12 -0
  451. package/dist/features/feature-flags/index.js.map +1 -0
  452. package/dist/features/feature-flags/types.d.ts +30 -0
  453. package/dist/features/feature-flags/types.d.ts.map +1 -0
  454. package/dist/features/feature-flags/types.js +8 -0
  455. package/dist/features/feature-flags/types.js.map +1 -0
  456. package/dist/features/index.d.ts +6 -0
  457. package/dist/features/index.d.ts.map +1 -0
  458. package/dist/features/index.js +7 -0
  459. package/dist/features/index.js.map +1 -0
  460. package/dist/features/lock/index.d.ts +4 -0
  461. package/dist/features/lock/index.d.ts.map +1 -0
  462. package/dist/features/lock/index.js +4 -0
  463. package/dist/features/lock/index.js.map +1 -0
  464. package/dist/features/lock/lock-service.d.ts +74 -0
  465. package/dist/features/lock/lock-service.d.ts.map +1 -0
  466. package/dist/features/lock/lock-service.js +210 -0
  467. package/dist/features/lock/lock-service.js.map +1 -0
  468. package/dist/features/lock/memory.d.ts +60 -0
  469. package/dist/features/lock/memory.d.ts.map +1 -0
  470. package/dist/features/lock/memory.js +194 -0
  471. package/dist/features/lock/memory.js.map +1 -0
  472. package/dist/features/lock/types.d.ts +151 -0
  473. package/dist/features/lock/types.d.ts.map +1 -0
  474. package/dist/features/lock/types.js +17 -0
  475. package/dist/features/lock/types.js.map +1 -0
  476. package/dist/features/memory/index.d.ts +18 -0
  477. package/dist/features/memory/index.d.ts.map +1 -0
  478. package/dist/features/memory/index.js +18 -0
  479. package/dist/features/memory/index.js.map +1 -0
  480. package/dist/features/memory/lock-feature.d.ts +21 -0
  481. package/dist/features/memory/lock-feature.d.ts.map +1 -0
  482. package/dist/features/memory/lock-feature.js +24 -0
  483. package/dist/features/memory/lock-feature.js.map +1 -0
  484. package/dist/features/secrets/create-secret-provider.d.ts +31 -0
  485. package/dist/features/secrets/create-secret-provider.d.ts.map +1 -0
  486. package/dist/features/secrets/create-secret-provider.js +26 -0
  487. package/dist/features/secrets/create-secret-provider.js.map +1 -0
  488. package/dist/features/secrets/define-secret-partial.d.ts +16 -0
  489. package/dist/features/secrets/define-secret-partial.d.ts.map +1 -0
  490. package/dist/features/secrets/define-secret-partial.js +26 -0
  491. package/dist/features/secrets/define-secret-partial.js.map +1 -0
  492. package/dist/features/secrets/index.d.ts +17 -0
  493. package/dist/features/secrets/index.d.ts.map +1 -0
  494. package/dist/features/secrets/index.js +14 -0
  495. package/dist/features/secrets/index.js.map +1 -0
  496. package/dist/features/secrets/secret-of.d.ts +19 -0
  497. package/dist/features/secrets/secret-of.d.ts.map +1 -0
  498. package/dist/features/secrets/secret-of.js +21 -0
  499. package/dist/features/secrets/secret-of.js.map +1 -0
  500. package/dist/features/secrets/secret-service.d.ts +21 -0
  501. package/dist/features/secrets/secret-service.d.ts.map +1 -0
  502. package/dist/features/secrets/secret-service.js +28 -0
  503. package/dist/features/secrets/secret-service.js.map +1 -0
  504. package/dist/features/secrets/types.d.ts +30 -0
  505. package/dist/features/secrets/types.d.ts.map +1 -0
  506. package/dist/features/secrets/types.js +8 -0
  507. package/dist/features/secrets/types.js.map +1 -0
  508. package/dist/features/vault/env-var-vault.d.ts +24 -0
  509. package/dist/features/vault/env-var-vault.d.ts.map +1 -0
  510. package/dist/features/vault/env-var-vault.js +43 -0
  511. package/dist/features/vault/env-var-vault.js.map +1 -0
  512. package/dist/features/vault/hardcoded-vault.d.ts +34 -0
  513. package/dist/features/vault/hardcoded-vault.d.ts.map +1 -0
  514. package/dist/features/vault/hardcoded-vault.js +46 -0
  515. package/dist/features/vault/hardcoded-vault.js.map +1 -0
  516. package/dist/features/vault/hashicorp-vault.d.ts +32 -0
  517. package/dist/features/vault/hashicorp-vault.d.ts.map +1 -0
  518. package/dist/features/vault/hashicorp-vault.js +69 -0
  519. package/dist/features/vault/hashicorp-vault.js.map +1 -0
  520. package/dist/features/vault/index.d.ts +13 -0
  521. package/dist/features/vault/index.d.ts.map +1 -0
  522. package/dist/features/vault/index.js +12 -0
  523. package/dist/features/vault/index.js.map +1 -0
  524. package/dist/features/vault/kubernetes-vault.d.ts +27 -0
  525. package/dist/features/vault/kubernetes-vault.d.ts.map +1 -0
  526. package/dist/features/vault/kubernetes-vault.js +51 -0
  527. package/dist/features/vault/kubernetes-vault.js.map +1 -0
  528. package/dist/features/vault/types.d.ts +41 -0
  529. package/dist/features/vault/types.d.ts.map +1 -0
  530. package/dist/features/vault/types.js +21 -0
  531. package/dist/features/vault/types.js.map +1 -0
  532. package/dist/index.d.ts +78 -0
  533. package/dist/index.d.ts.map +1 -0
  534. package/dist/index.js +48 -0
  535. package/dist/index.js.map +1 -0
  536. package/dist/justscale.d.ts +63 -0
  537. package/dist/justscale.d.ts.map +1 -0
  538. package/dist/justscale.js +501 -0
  539. package/dist/justscale.js.map +1 -0
  540. package/dist/kernel/adapter.d.ts +9 -0
  541. package/dist/kernel/adapter.d.ts.map +1 -0
  542. package/dist/kernel/adapter.js +2 -0
  543. package/dist/kernel/adapter.js.map +1 -0
  544. package/dist/kernel/kernel.d.ts +15 -0
  545. package/dist/kernel/kernel.d.ts.map +1 -0
  546. package/dist/kernel/kernel.js +134 -0
  547. package/dist/kernel/kernel.js.map +1 -0
  548. package/dist/models/access.d.ts +26 -0
  549. package/dist/models/access.d.ts.map +1 -0
  550. package/dist/models/access.js +126 -0
  551. package/dist/models/access.js.map +1 -0
  552. package/dist/models/apply-types-config.d.ts +52 -0
  553. package/dist/models/apply-types-config.d.ts.map +1 -0
  554. package/dist/models/apply-types-config.js +47 -0
  555. package/dist/models/apply-types-config.js.map +1 -0
  556. package/dist/models/define-model.d.ts +249 -0
  557. package/dist/models/define-model.d.ts.map +1 -0
  558. package/dist/models/define-model.js +388 -0
  559. package/dist/models/define-model.js.map +1 -0
  560. package/dist/models/field.d.ts +309 -0
  561. package/dist/models/field.d.ts.map +1 -0
  562. package/dist/models/field.js +312 -0
  563. package/dist/models/field.js.map +1 -0
  564. package/dist/models/in-memory/condition-evaluator.d.ts +53 -0
  565. package/dist/models/in-memory/condition-evaluator.d.ts.map +1 -0
  566. package/dist/models/in-memory/condition-evaluator.js +593 -0
  567. package/dist/models/in-memory/condition-evaluator.js.map +1 -0
  568. package/dist/models/in-memory/in-memory-model.d.ts +89 -0
  569. package/dist/models/in-memory/in-memory-model.d.ts.map +1 -0
  570. package/dist/models/in-memory/in-memory-model.js +101 -0
  571. package/dist/models/in-memory/in-memory-model.js.map +1 -0
  572. package/dist/models/in-memory/in-memory-repository.d.ts +208 -0
  573. package/dist/models/in-memory/in-memory-repository.d.ts.map +1 -0
  574. package/dist/models/in-memory/in-memory-repository.js +618 -0
  575. package/dist/models/in-memory/in-memory-repository.js.map +1 -0
  576. package/dist/models/in-memory/in-memory-scheduled-task.repository.d.ts +92 -0
  577. package/dist/models/in-memory/in-memory-scheduled-task.repository.d.ts.map +1 -0
  578. package/dist/models/in-memory/in-memory-scheduled-task.repository.js +395 -0
  579. package/dist/models/in-memory/in-memory-scheduled-task.repository.js.map +1 -0
  580. package/dist/models/in-memory/index.d.ts +35 -0
  581. package/dist/models/in-memory/index.d.ts.map +1 -0
  582. package/dist/models/in-memory/index.js +36 -0
  583. package/dist/models/in-memory/index.js.map +1 -0
  584. package/dist/models/index.d.ts +52 -0
  585. package/dist/models/index.d.ts.map +1 -0
  586. package/dist/models/index.js +86 -0
  587. package/dist/models/index.js.map +1 -0
  588. package/dist/models/model-name-registry.d.ts +16 -0
  589. package/dist/models/model-name-registry.d.ts.map +1 -0
  590. package/dist/models/model-name-registry.js +19 -0
  591. package/dist/models/model-name-registry.js.map +1 -0
  592. package/dist/models/model.d.ts +15 -0
  593. package/dist/models/model.d.ts.map +1 -0
  594. package/dist/models/model.js +114 -0
  595. package/dist/models/model.js.map +1 -0
  596. package/dist/models/model.repository.d.ts +318 -0
  597. package/dist/models/model.repository.d.ts.map +1 -0
  598. package/dist/models/model.repository.js +146 -0
  599. package/dist/models/model.repository.js.map +1 -0
  600. package/dist/models/observable.d.ts +15 -0
  601. package/dist/models/observable.d.ts.map +1 -0
  602. package/dist/models/observable.js +64 -0
  603. package/dist/models/observable.js.map +1 -0
  604. package/dist/models/proxy.d.ts +5 -0
  605. package/dist/models/proxy.d.ts.map +1 -0
  606. package/dist/models/proxy.js +407 -0
  607. package/dist/models/proxy.js.map +1 -0
  608. package/dist/models/query.d.ts +574 -0
  609. package/dist/models/query.d.ts.map +1 -0
  610. package/dist/models/query.js +701 -0
  611. package/dist/models/query.js.map +1 -0
  612. package/dist/models/reference/reference.d.ts +229 -0
  613. package/dist/models/reference/reference.d.ts.map +1 -0
  614. package/dist/models/reference/reference.js +331 -0
  615. package/dist/models/reference/reference.js.map +1 -0
  616. package/dist/models/reference/transient-ref.d.ts +123 -0
  617. package/dist/models/reference/transient-ref.d.ts.map +1 -0
  618. package/dist/models/reference/transient-ref.js +152 -0
  619. package/dist/models/reference/transient-ref.js.map +1 -0
  620. package/dist/models/repository.d.ts +53 -0
  621. package/dist/models/repository.d.ts.map +1 -0
  622. package/dist/models/repository.js +37 -0
  623. package/dist/models/repository.js.map +1 -0
  624. package/dist/models/scheduled-task/index.d.ts +13 -0
  625. package/dist/models/scheduled-task/index.d.ts.map +1 -0
  626. package/dist/models/scheduled-task/index.js +12 -0
  627. package/dist/models/scheduled-task/index.js.map +1 -0
  628. package/dist/models/scheduled-task/scheduled-task.d.ts +73 -0
  629. package/dist/models/scheduled-task/scheduled-task.d.ts.map +1 -0
  630. package/dist/models/scheduled-task/scheduled-task.js +95 -0
  631. package/dist/models/scheduled-task/scheduled-task.js.map +1 -0
  632. package/dist/models/scheduled-task/scheduled-task.repository.d.ts +150 -0
  633. package/dist/models/scheduled-task/scheduled-task.repository.d.ts.map +1 -0
  634. package/dist/models/scheduled-task/scheduled-task.repository.js +40 -0
  635. package/dist/models/scheduled-task/scheduled-task.repository.js.map +1 -0
  636. package/dist/models/stream.d.ts +139 -0
  637. package/dist/models/stream.d.ts.map +1 -0
  638. package/dist/models/stream.js +153 -0
  639. package/dist/models/stream.js.map +1 -0
  640. package/dist/models/symbols.d.ts +73 -0
  641. package/dist/models/symbols.d.ts.map +1 -0
  642. package/dist/models/symbols.js +97 -0
  643. package/dist/models/symbols.js.map +1 -0
  644. package/dist/models/types.d.ts +291 -0
  645. package/dist/models/types.d.ts.map +1 -0
  646. package/dist/models/types.js +50 -0
  647. package/dist/models/types.js.map +1 -0
  648. package/dist/models/watch.d.ts +27 -0
  649. package/dist/models/watch.d.ts.map +1 -0
  650. package/dist/models/watch.js +124 -0
  651. package/dist/models/watch.js.map +1 -0
  652. package/dist/models/zod-ref.d.ts +46 -0
  653. package/dist/models/zod-ref.d.ts.map +1 -0
  654. package/dist/models/zod-ref.js +31 -0
  655. package/dist/models/zod-ref.js.map +1 -0
  656. package/dist/process/builtin-serializers.d.ts +19 -0
  657. package/dist/process/builtin-serializers.d.ts.map +1 -0
  658. package/dist/process/builtin-serializers.js +213 -0
  659. package/dist/process/builtin-serializers.js.map +1 -0
  660. package/dist/process/cluster-plugin.d.ts +129 -0
  661. package/dist/process/cluster-plugin.d.ts.map +1 -0
  662. package/dist/process/cluster-plugin.js +175 -0
  663. package/dist/process/cluster-plugin.js.map +1 -0
  664. package/dist/process/createProcess.d.ts +67 -0
  665. package/dist/process/createProcess.d.ts.map +1 -0
  666. package/dist/process/createProcess.js +111 -0
  667. package/dist/process/createProcess.js.map +1 -0
  668. package/dist/process/define-signals.d.ts +113 -0
  669. package/dist/process/define-signals.d.ts.map +1 -0
  670. package/dist/process/define-signals.js +222 -0
  671. package/dist/process/define-signals.js.map +1 -0
  672. package/dist/process/delay-controller.d.ts +35 -0
  673. package/dist/process/delay-controller.d.ts.map +1 -0
  674. package/dist/process/delay-controller.js +55 -0
  675. package/dist/process/delay-controller.js.map +1 -0
  676. package/dist/process/index.d.ts +38 -0
  677. package/dist/process/index.d.ts.map +1 -0
  678. package/dist/process/index.js +47 -0
  679. package/dist/process/index.js.map +1 -0
  680. package/dist/process/primitives.d.ts +393 -0
  681. package/dist/process/primitives.d.ts.map +1 -0
  682. package/dist/process/primitives.js +325 -0
  683. package/dist/process/primitives.js.map +1 -0
  684. package/dist/process/serialization.d.ts +58 -0
  685. package/dist/process/serialization.d.ts.map +1 -0
  686. package/dist/process/serialization.js +220 -0
  687. package/dist/process/serialization.js.map +1 -0
  688. package/dist/process/stream-utils.d.ts +123 -0
  689. package/dist/process/stream-utils.d.ts.map +1 -0
  690. package/dist/process/stream-utils.js +247 -0
  691. package/dist/process/stream-utils.js.map +1 -0
  692. package/dist/process/testing/clock.d.ts +115 -0
  693. package/dist/process/testing/clock.d.ts.map +1 -0
  694. package/dist/process/testing/clock.js +166 -0
  695. package/dist/process/testing/clock.js.map +1 -0
  696. package/dist/process/testing/index.d.ts +9 -0
  697. package/dist/process/testing/index.d.ts.map +1 -0
  698. package/dist/process/testing/index.js +9 -0
  699. package/dist/process/testing/index.js.map +1 -0
  700. package/dist/process/testing.d.ts +50 -0
  701. package/dist/process/testing.d.ts.map +1 -0
  702. package/dist/process/testing.js +59 -0
  703. package/dist/process/testing.js.map +1 -0
  704. package/dist/process/types.d.ts +540 -0
  705. package/dist/process/types.d.ts.map +1 -0
  706. package/dist/process/types.js +21 -0
  707. package/dist/process/types.js.map +1 -0
  708. package/dist/queue/index.d.ts +2 -0
  709. package/dist/queue/index.d.ts.map +1 -0
  710. package/dist/queue/index.js +2 -0
  711. package/dist/queue/index.js.map +1 -0
  712. package/dist/queue/queue.d.ts +34 -0
  713. package/dist/queue/queue.d.ts.map +1 -0
  714. package/dist/queue/queue.js +108 -0
  715. package/dist/queue/queue.js.map +1 -0
  716. package/dist/runtime/process/compiled.d.ts +56 -0
  717. package/dist/runtime/process/compiled.d.ts.map +1 -0
  718. package/dist/runtime/process/compiled.js +221 -0
  719. package/dist/runtime/process/compiled.js.map +1 -0
  720. package/dist/runtime/process/executor.d.ts +279 -0
  721. package/dist/runtime/process/executor.d.ts.map +1 -0
  722. package/dist/runtime/process/executor.js +1941 -0
  723. package/dist/runtime/process/executor.js.map +1 -0
  724. package/dist/runtime/process/factory.d.ts +72 -0
  725. package/dist/runtime/process/factory.d.ts.map +1 -0
  726. package/dist/runtime/process/factory.js +78 -0
  727. package/dist/runtime/process/factory.js.map +1 -0
  728. package/dist/runtime/process/freeze.d.ts +5 -0
  729. package/dist/runtime/process/freeze.d.ts.map +1 -0
  730. package/dist/runtime/process/freeze.js +94 -0
  731. package/dist/runtime/process/freeze.js.map +1 -0
  732. package/dist/runtime/process/scheduled-task-timer.d.ts +52 -0
  733. package/dist/runtime/process/scheduled-task-timer.d.ts.map +1 -0
  734. package/dist/runtime/process/scheduled-task-timer.js +104 -0
  735. package/dist/runtime/process/scheduled-task-timer.js.map +1 -0
  736. package/dist/runtime/process/signal-bus.d.ts +186 -0
  737. package/dist/runtime/process/signal-bus.d.ts.map +1 -0
  738. package/dist/runtime/process/signal-bus.js +256 -0
  739. package/dist/runtime/process/signal-bus.js.map +1 -0
  740. package/dist/runtime/process/state-serializer.d.ts +30 -0
  741. package/dist/runtime/process/state-serializer.d.ts.map +1 -0
  742. package/dist/runtime/process/state-serializer.js +244 -0
  743. package/dist/runtime/process/state-serializer.js.map +1 -0
  744. package/dist/runtime/process/storage.d.ts +96 -0
  745. package/dist/runtime/process/storage.d.ts.map +1 -0
  746. package/dist/runtime/process/storage.js +165 -0
  747. package/dist/runtime/process/storage.js.map +1 -0
  748. package/dist/runtime/process/timer-scheduler.d.ts +115 -0
  749. package/dist/runtime/process/timer-scheduler.d.ts.map +1 -0
  750. package/dist/runtime/process/timer-scheduler.js +192 -0
  751. package/dist/runtime/process/timer-scheduler.js.map +1 -0
  752. package/dist/runtime/process/trace.d.ts +17 -0
  753. package/dist/runtime/process/trace.d.ts.map +1 -0
  754. package/dist/runtime/process/trace.js +26 -0
  755. package/dist/runtime/process/trace.js.map +1 -0
  756. package/dist/runtime/protobuf/encoding/index.d.ts +26 -0
  757. package/dist/runtime/protobuf/encoding/index.d.ts.map +1 -0
  758. package/dist/runtime/protobuf/encoding/index.js +30 -0
  759. package/dist/runtime/protobuf/encoding/index.js.map +1 -0
  760. package/dist/runtime/protobuf/encoding/reader.d.ts +182 -0
  761. package/dist/runtime/protobuf/encoding/reader.d.ts.map +1 -0
  762. package/dist/runtime/protobuf/encoding/reader.js +353 -0
  763. package/dist/runtime/protobuf/encoding/reader.js.map +1 -0
  764. package/dist/runtime/protobuf/encoding/varint.d.ts +67 -0
  765. package/dist/runtime/protobuf/encoding/varint.d.ts.map +1 -0
  766. package/dist/runtime/protobuf/encoding/varint.js +117 -0
  767. package/dist/runtime/protobuf/encoding/varint.js.map +1 -0
  768. package/dist/runtime/protobuf/encoding/wire-types.d.ts +62 -0
  769. package/dist/runtime/protobuf/encoding/wire-types.d.ts.map +1 -0
  770. package/dist/runtime/protobuf/encoding/wire-types.js +103 -0
  771. package/dist/runtime/protobuf/encoding/wire-types.js.map +1 -0
  772. package/dist/runtime/protobuf/encoding/writer.d.ts +147 -0
  773. package/dist/runtime/protobuf/encoding/writer.d.ts.map +1 -0
  774. package/dist/runtime/protobuf/encoding/writer.js +214 -0
  775. package/dist/runtime/protobuf/encoding/writer.js.map +1 -0
  776. package/dist/runtime/protobuf/index.d.ts +3 -0
  777. package/dist/runtime/protobuf/index.d.ts.map +1 -0
  778. package/dist/runtime/protobuf/index.js +3 -0
  779. package/dist/runtime/protobuf/index.js.map +1 -0
  780. package/dist/runtime/protobuf/serialized.d.ts +48 -0
  781. package/dist/runtime/protobuf/serialized.d.ts.map +1 -0
  782. package/dist/runtime/protobuf/serialized.js +517 -0
  783. package/dist/runtime/protobuf/serialized.js.map +1 -0
  784. package/package.json +209 -0
@@ -0,0 +1,678 @@
1
+ /**
2
+ * Core type definitions for the fluent builder API.
3
+ */
4
+ import type { ServiceDef, Service, ServiceToken as CoreServiceToken } from '../core/service.js';
5
+ import { SERVICE_PROVIDES } from '../core/service.js';
6
+ import type { App } from '../app.js';
7
+ import type { ControllerDef } from '../core/controller.js';
8
+ import type { RepositoryToken, Repository } from '../models/repository.js';
9
+ import type { GuardDef, MiddlewareDef } from '../core/middleware.js';
10
+ import type { Stop } from './stop.js';
11
+ import type { TypedParams } from '../models/apply-types-config.js';
12
+ import type { ConfigComponent, ConfigPartial } from '../features/config/types.js';
13
+ import type { ConfigToken } from '../features/config/config-of.js';
14
+ import type { SecretComponent, SecretPartial } from '../features/secrets/types.js';
15
+ import type { SecretToken } from '../features/secrets/secret-of.js';
16
+ import type { FeatureFlagComponent, FeatureFlagPartial } from '../features/feature-flags/types.js';
17
+ import type { FeatureFlagToken } from '../features/feature-flags/feature-flag-of.js';
18
+ import type { Environment } from '../features/environment/types.js';
19
+ /**
20
+ * Brand for type-level token identification.
21
+ * Ensures Token<A> is not assignable to Token<B>.
22
+ */
23
+ declare const TOKEN_BRAND: unique symbol;
24
+ /**
25
+ * A typed token for dependency injection.
26
+ *
27
+ * Tokens identify what a component provides or requires.
28
+ * They can be:
29
+ * - ServiceDef (created via defineService)
30
+ * - RepositoryToken (created via Repository.of or ModelRepository.of)
31
+ * - Class/AbstractClass
32
+ * - FeatureToken (created via createFeature)
33
+ */
34
+ export type Token<T = unknown> = {
35
+ readonly [TOKEN_BRAND]?: T;
36
+ readonly description?: string;
37
+ };
38
+ /**
39
+ * Union of all valid token types in the system.
40
+ */
41
+ export type AnyToken = CoreServiceToken | RepositoryToken<any> | FeatureToken<any, any>;
42
+ /** Symbol to identify feature tokens */
43
+ export declare const FEATURE_TOKEN: unique symbol;
44
+ /** Symbol for feature metadata */
45
+ export declare const FEATURE_META: unique symbol;
46
+ /**
47
+ * Metadata stored on a feature.
48
+ */
49
+ export interface FeatureMetadata {
50
+ readonly name?: string;
51
+ readonly requires: AnyToken[];
52
+ readonly onStart?: StartHook;
53
+ readonly onStop?: StopHook;
54
+ }
55
+ /**
56
+ * Lifecycle hook called when cluster starts.
57
+ */
58
+ export type StartHook = (ctx: {
59
+ resolve: <T>(token: Token<T>) => T;
60
+ }) => Promise<void> | void;
61
+ /**
62
+ * Lifecycle hook called when cluster stops.
63
+ */
64
+ export type StopHook = () => Promise<void> | void;
65
+ export interface FeatureToken<TRequires extends AnyToken[] = [], TProvides extends AnyToken[] = []> {
66
+ (builder: Builder<TRequires>): Builder<[...TRequires, ...TProvides]>;
67
+ readonly [FEATURE_TOKEN]: true;
68
+ readonly [FEATURE_META]: FeatureMetadata;
69
+ }
70
+ /** Symbol to identify repository bindings */
71
+ export declare const REPO_BINDING: unique symbol;
72
+ /**
73
+ * A binding from a RepositoryToken to its implementation.
74
+ */
75
+ export interface RepositoryBinding<T = unknown> {
76
+ readonly [REPO_BINDING]: true;
77
+ readonly token: RepositoryToken<T>;
78
+ readonly implementation: unknown;
79
+ }
80
+ /** Symbol to identify service bindings */
81
+ export declare const SERVICE_BINDING: unique symbol;
82
+ /**
83
+ * A binding from an abstract service token to its implementation.
84
+ * Used to bind abstract classes to concrete implementations.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * bindService(AbstractChannelBackend, MemoryChannelBackend)
89
+ * ```
90
+ */
91
+ export interface ServiceBinding<T = unknown> {
92
+ readonly [SERVICE_BINDING]: true;
93
+ readonly token: CoreServiceToken<T>;
94
+ readonly implementation: CoreServiceToken<T>;
95
+ }
96
+ /** Symbol to identify instance bindings */
97
+ export declare const INSTANCE_BINDING: unique symbol;
98
+ /**
99
+ * A binding from an abstract service token to a concrete instance.
100
+ * Used to bind abstract classes to pre-created instances.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const taskRepo = new InMemoryScheduledTaskRepository()
105
+ * bindInstance(ScheduledTaskRepository, taskRepo)
106
+ * ```
107
+ */
108
+ export interface InstanceBinding<T = unknown> {
109
+ readonly [INSTANCE_BINDING]: true;
110
+ readonly token: CoreServiceToken<T>;
111
+ readonly instance: T;
112
+ }
113
+ /**
114
+ * Check if value is an InstanceBinding.
115
+ */
116
+ export declare function isInstanceBinding(value: unknown): value is InstanceBinding<any>;
117
+ /**
118
+ * A callback that extends the builder.
119
+ * Can declare requirements via its type signature.
120
+ */
121
+ export type BuilderCallback<TRequires extends AnyToken[] = AnyToken[], TProvides extends AnyToken[] = AnyToken[]> = (builder: Builder<TRequires>) => Builder<[...TRequires, ...TProvides]>;
122
+ /**
123
+ * All component types that can be added to a builder.
124
+ */
125
+ export type Component = ServiceDef<any, any> | Service<any, any> | ControllerDef<any> | RepositoryBinding<any> | ServiceBinding<any> | InstanceBinding<any> | FeatureToken<any, any> | BuilderCallback<any, any> | ConfigComponent | SecretComponent | FeatureFlagComponent | Environment | import('../justscale.js').BuiltApp<any, any> | Component[];
126
+ /**
127
+ * Check if value is a ServiceDef.
128
+ * Handles both defineService object-form and class-extends-function forms.
129
+ */
130
+ export declare function isServiceDef(value: unknown): value is ServiceDef<any, any>;
131
+ /**
132
+ * Check if value is a ControllerDef.
133
+ */
134
+ export declare function isControllerDef(value: unknown): value is ControllerDef<any>;
135
+ /**
136
+ * Check if value is a RepositoryBinding.
137
+ */
138
+ export declare function isRepositoryBinding(value: unknown): value is RepositoryBinding<any>;
139
+ /**
140
+ * Check if value is a ServiceBinding.
141
+ */
142
+ export declare function isServiceBinding(value: unknown): value is ServiceBinding<any>;
143
+ /**
144
+ * Check if value is a FeatureToken.
145
+ */
146
+ export declare function isFeatureToken(value: unknown): value is FeatureToken<any, any>;
147
+ /**
148
+ * Check if value is a BuilderCallback (function but not feature).
149
+ */
150
+ export declare function isBuilderCallback(value: unknown): value is BuilderCallback<any, any>;
151
+ /**
152
+ * Check if value is a component array.
153
+ */
154
+ export declare function isComponentArray(value: unknown): value is Component[];
155
+ type ConstructorOf<T> = T extends InstanceType<infer C> ? C : never;
156
+ type IsClassInstance<T> = ConstructorOf<T> extends never ? false : true;
157
+ /** Extract SERVICE_PROVIDES tokens from a component. */
158
+ type ExtractServiceProvides<C> = C extends {
159
+ [SERVICE_PROVIDES]: infer TProvides extends CoreServiceToken[];
160
+ } ? TProvides : [];
161
+ /**
162
+ * Extract what tokens a component provides to the builder.
163
+ *
164
+ * For ServiceDefs: provides both the ServiceDef itself AND the class constructor
165
+ * if the instance type is a class instance. This allows services that create
166
+ * AbstractPostgresClient instances to satisfy dependencies on typeof AbstractPostgresClient.
167
+ *
168
+ * For services with `provides` option: also provides the tokens listed in SERVICE_PROVIDES.
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * ProvidesOf<ServiceDef<AbstractPostgresClient, {...}>> // [ServiceDef, typeof AbstractPostgresClient]
173
+ * ProvidesOf<RepositoryBinding<User>> // [RepositoryToken<User>]
174
+ * ProvidesOf<FeatureToken<[], [A, B]>> // [A, B]
175
+ * ProvidesOf<Component[]> // flattened provides
176
+ * ProvidesOf<ServiceWithProvides> // [Service, ...provides tokens]
177
+ * ```
178
+ */
179
+ export type ProvidesOf<C> = C extends ServiceDef<infer T, any> ? IsClassInstance<T> extends true ? [C, ConstructorOf<T>, ...ExtractServiceProvides<C>] : [C, ...ExtractServiceProvides<C>] : C extends Service<any, any> ? [C, ...ExtractServiceProvides<C>] : C extends RepositoryBinding<infer T> ? [RepositoryToken<T>] : C extends ServiceBinding<infer T> ? [CoreServiceToken<T>] : C extends InstanceBinding<infer T> ? [CoreServiceToken<T>] : C extends FeatureToken<any, infer TProvides> ? TProvides : C extends (b: Builder<any>) => Builder<infer TNew> ? TNew extends [...any[], ...infer TProvides] ? TProvides : [] : C extends ControllerDef<any> ? [C] : C extends ConfigComponent<infer CP> ? ConfigTokensFor<CP> : C extends SecretComponent<infer SP> ? SecretTokensFor<SP> : C extends FeatureFlagComponent<infer FP> ? FeatureFlagTokensFor<FP> : C extends Environment<infer EnvS, infer EnvP> ? [...FlattenProvidesTuple<EnvS>, ...FlattenProvidesTuple<EnvP>] : C extends readonly (infer Item)[] ? FlattenProvides<Item> : [];
180
+ type ConfigTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends ConfigPartial<infer T> ? [ConfigToken<T>, ...ConfigTokensFor<Rest>] : ConfigTokensFor<Rest> : [];
181
+ type SecretTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends SecretPartial<infer T> ? [SecretToken<T>, ...SecretTokensFor<Rest>] : SecretTokensFor<Rest> : [];
182
+ type FeatureFlagTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends FeatureFlagPartial<infer T> ? [FeatureFlagToken<T>, ...FeatureFlagTokensFor<Rest>] : FeatureFlagTokensFor<Rest> : [];
183
+ /**
184
+ * Walk a tuple of Components and concat each element's ProvidesOf.
185
+ * Used by `Environment<S, P>` to surface the exact set of tokens an env's
186
+ * inner services and providers supply, so consumers downstream of
187
+ * `.add(env)` get the same compile-time DI check as without the env.
188
+ */
189
+ type FlattenProvidesTuple<Items> = Items extends readonly [infer Head, ...infer Rest] ? [...Extract<ProvidesOf<Head>, readonly unknown[]>, ...FlattenProvidesTuple<Rest>] : [];
190
+ /**
191
+ * Flatten provides from array items.
192
+ * Uses NonRecursiveComponent to avoid infinite recursion.
193
+ */
194
+ type NonRecursiveComponent = ServiceDef<any, any> | ControllerDef<any> | RepositoryBinding<any> | ServiceBinding<any> | InstanceBinding<any> | FeatureToken<any, any> | BuilderCallback<any, any>;
195
+ type FlattenProvides<T> = T extends NonRecursiveComponent ? ProvidesOf<T>[number] : never;
196
+ /**
197
+ * Extract the dep tokens from a deps record.
198
+ */
199
+ type DepsToTokens<TDeps> = TDeps extends Record<string, infer V> ? V : never;
200
+ /**
201
+ * Extract transport requirements from a single route definition.
202
+ *
203
+ * A route factory (e.g., `Get()` from @justscale/http) stamps `__transportRequires`
204
+ * on its return type as a brand to declare what the transport needs (typically a
205
+ * Config partial). Routes that don't stamp this (any existing route at the time
206
+ * step 3 lands) yield `never` - RequiresOf is unchanged for them.
207
+ *
208
+ * The field exists at the type level only (no runtime data required for this
209
+ * compile-time check - runtime adapter install happens via build-phase ALS).
210
+ */
211
+ type ExtractRouteTransportRequires<R> = R extends {
212
+ readonly __transportRequires: readonly (infer T)[];
213
+ } ? T : never;
214
+ /**
215
+ * Aggregate transport requirements across all routes in a controller's routes shape.
216
+ * Handles both record form (`{ list: Get(...) }`) and array form.
217
+ */
218
+ type ControllerTransportRequires<TRoutes> = TRoutes extends readonly (infer Route)[] ? ExtractRouteTransportRequires<Route> : TRoutes extends Record<string, infer Route> ? ExtractRouteTransportRequires<Route> : never;
219
+ /**
220
+ * Extract the inject deps from a MiddlewareDef or GuardDef.
221
+ *
222
+ * Plain middleware/guard functions (not passed through `createMiddleware` /
223
+ * `createGuard`) carry no DI metadata - they yield `never`, matching the
224
+ * behavior of the existing transport-requires stamp. Only DI-aware
225
+ * middleware contributes to the controller's require set.
226
+ */
227
+ export type ExtractStepDeps<Step> = Step extends MiddlewareDef<any, infer TDeps> ? DepsToTokens<TDeps> : Step extends GuardDef<infer TDeps> ? DepsToTokens<TDeps> : Step extends readonly GuardDef<infer TDeps>[] ? DepsToTokens<TDeps> : never;
228
+ /**
229
+ * Extract the "added" context type from a middleware value. Handles:
230
+ * - plain functions returning an object or Promise<object>
231
+ * - DI-aware MiddlewareDef (produces a middleware whose return is the added type)
232
+ *
233
+ * Returns `never` for values that don't match either shape - callers
234
+ * compose this with `TContext & ExtractAddedFromMiddleware<TMw>` so
235
+ * `never` neutralises via intersection with whatever context exists.
236
+ */
237
+ export type ExtractAddedFromMiddleware<TMw> = TMw extends MiddlewareDef<infer TAdded, any> ? TAdded : TMw extends (...args: any[]) => infer R ? R extends Promise<infer A> ? A : R : never;
238
+ /**
239
+ * Extract the TRequirements type parameter from a RouteDef.
240
+ *
241
+ * The type parameter accumulates middleware/guard deps as `.use()` and
242
+ * `.guard()` calls are chained on a route builder. Here we pull it off
243
+ * the finalized `RouteDef<TPath, TReturns, TRequirements, TBody>`
244
+ * signature.
245
+ */
246
+ type ExtractRouteRequirements<R> = R extends RouteDef<any, any, infer TReq, any> ? TReq : never;
247
+ /**
248
+ * Aggregate middleware/guard requirements across all routes in a
249
+ * controller's routes shape. Mirror of `ControllerTransportRequires`.
250
+ */
251
+ type ControllerRouteRequirements<TRoutes> = TRoutes extends readonly (infer Route)[] ? ExtractRouteRequirements<Route> : TRoutes extends Record<string, infer Route> ? ExtractRouteRequirements<Route> : never;
252
+ /**
253
+ * Extract what tokens a component requires (direct dependencies).
254
+ *
255
+ * For controllers, this includes:
256
+ * - injected services (from `inject: { ... }`)
257
+ * - transport requirements from route factories (e.g., `Get()` implying
258
+ * an HTTP adapter token)
259
+ * - middleware/guard inject deps attached to routes via `.use()` / `.guard()`
260
+ */
261
+ export type RequiresOf<C> = C extends ControllerDef<infer TDeps, infer TRoutes, any> ? (DepsToTokens<TDeps> | ControllerTransportRequires<TRoutes> | ControllerRouteRequirements<TRoutes>)[] : C extends ServiceDef<any, infer TDeps> ? DepsToTokens<TDeps>[] : C extends Service<any, infer TDeps> ? DepsToTokens<TDeps>[] : C extends FeatureToken<infer TRequires, any> ? TRequires : C extends (b: Builder<infer TReq>) => any ? TReq : [];
262
+ /**
263
+ * Recursively extract transitive requirements.
264
+ * If C requires S, and S is a ServiceDef that requires T, then C transitively requires T.
265
+ *
266
+ * For Repository ServiceDefs (where instance extends Repository<any>), we require BOTH
267
+ * the ServiceDef itself AND its transitive deps. This ensures repositories are explicitly registered.
268
+ *
269
+ * For other ServiceDefs (inline services), we only require transitive deps - they're
270
+ * auto-created by the container on demand.
271
+ *
272
+ * For class tokens and other non-ServiceDef requirements, we require them as-is.
273
+ */
274
+ export type TransitiveRequiresOf<C> = RequiresOf<C> extends (infer Req)[] ? Req extends ServiceDef<infer TInstance, infer TDeps> ? TInstance extends Repository<any> ? Req | DepsToTokens<TDeps> : DepsToTokens<TDeps> : Req extends {
275
+ path: string;
276
+ deps: Record<string, any>;
277
+ } ? never : Req : never;
278
+ /**
279
+ * Check if token T is satisfied by token H (either same type or H provides T).
280
+ * Uses wrapper to avoid distribution over unions.
281
+ */
282
+ type TokenSatisfies<T, H> = [
283
+ T
284
+ ] extends [H] ? true : [H] extends [T] ? true : false;
285
+ /**
286
+ * Check if a token T is provided in the TProvided tuple.
287
+ * Returns true if any provided token satisfies the requirement.
288
+ */
289
+ export type IsProvided<T, TProvided extends AnyToken[]> = TProvided extends [infer Head, ...infer Tail extends AnyToken[]] ? TokenSatisfies<T, Head> extends true ? true : IsProvided<T, Tail> : false;
290
+ /**
291
+ * Get the missing requirements from a list of requirements.
292
+ */
293
+ type MissingRequirements<TRequired, TProvided extends AnyToken[]> = TRequired extends (infer Req)[] ? Req extends AnyToken ? IsProvided<Req, TProvided> extends true ? never : Req : never : never;
294
+ /**
295
+ * Error type shown when dependencies are missing.
296
+ * The error message includes which dependencies are missing.
297
+ */
298
+ export interface MissingDepsError<_C, TMissing> {
299
+ readonly __brand: 'MissingDependencies';
300
+ readonly _missing: TMissing;
301
+ readonly _hint: 'Add the missing dependencies before this component';
302
+ }
303
+ /**
304
+ * Type constraint that enforces dependencies are satisfied at compile time.
305
+ * Returns the component type C if all requirements are met,
306
+ * otherwise returns a MissingDepsError which won't accept the component.
307
+ */
308
+ export type RequiresSatisfied<C, TProvided extends AnyToken[]> = MissingRequirements<TransitiveRequiresOf<C>[], TProvided> extends never ? C : MissingDepsError<C, MissingRequirements<TransitiveRequiresOf<C>[], TProvided>>;
309
+ /**
310
+ * Remove a token from a tuple.
311
+ * Used by .override() to remove the old token before adding the new one.
312
+ */
313
+ export type RemoveFromTuple<T, Tuple extends any[]> = Tuple extends [infer H, ...infer Rest extends any[]] ? TokenSatisfies<T, H> extends true ? RemoveFromTuple<T, Rest> : [H, ...RemoveFromTuple<T, Rest>] : [];
314
+ /**
315
+ * Extract a built sub-app's TRequires tuple. Sub-apps carry their requires
316
+ * tuple in a phantom `__requires` field on `IBuiltApp<TProvided, TRequires>`;
317
+ * this utility pulls it back out so a parent builder can verify its own
318
+ * TProvided covers the sub-app's surface before accepting the `.add()`.
319
+ *
320
+ * Returns `never` for non-sub-app components - callers fall through to
321
+ * the regular `RequiresSatisfied` path in that case.
322
+ */
323
+ type ExtractSubAppRequires<C> = C extends {
324
+ readonly __requires: infer R;
325
+ } ? R extends readonly AnyToken[] ? R : never : never;
326
+ /**
327
+ * Error shown when a sub-app is `.add()`-ed into a builder that doesn't
328
+ * provide all of the sub-app's declared `.requires(...)`. Distinct from
329
+ * `MissingDepsError` so the hint can point at the sub-app's surface.
330
+ */
331
+ export interface MissingSubAppRequiresError<_C, TMissing> {
332
+ readonly __brand: 'MissingSubAppRequires';
333
+ readonly _missing: TMissing;
334
+ readonly _hint: 'This sub-app declared .requires() tokens not provided by the enclosing JustScale(). Add them before .add()-ing the sub-app.';
335
+ }
336
+ /**
337
+ * `.add()` gate used by the Builder. Branches on whether the added
338
+ * component is a built sub-app (carries `__requires`). Sub-apps check
339
+ * their TRequires against TProvided; everything else falls through to
340
+ * the regular component dep check.
341
+ */
342
+ export type AddCheck<C, TProvided extends AnyToken[]> = ExtractSubAppRequires<C> extends infer SR ? [SR] extends [never] ? RequiresSatisfied<C, TProvided> : SR extends AnyToken[] ? MissingRequirements<SR, TProvided> extends never ? C : MissingSubAppRequiresError<C, MissingRequirements<SR, TProvided>> : RequiresSatisfied<C, TProvided> : RequiresSatisfied<C, TProvided>;
343
+ /**
344
+ * Error shown when a builder with unresolved `.requires()` tries to
345
+ * compile. Sub-apps can `.build()` on their own (for shipping as a unit),
346
+ * but must be composed into a parent to `.compile()` successfully.
347
+ */
348
+ export interface CannotCompileSubAppError<TMissing> {
349
+ readonly __brand: 'CannotCompileSubApp';
350
+ readonly _missing: TMissing;
351
+ readonly _hint: 'This builder declared .requires(). .add() it into a parent JustScale() that provides the tokens, then compile the parent.';
352
+ }
353
+ /**
354
+ * Gate used by `IBuiltApp.compile()`. Empty TRequires → real App type.
355
+ * Non-empty TRequires → branded error that the caller gets back when they
356
+ * try to use the compiled value, surfacing the misuse at its call site.
357
+ */
358
+ export type CompileResult<TRequires extends AnyToken[], TApp> = TRequires extends readonly [] ? TApp : CannotCompileSubAppError<TRequires[number]>;
359
+ /**
360
+ * Fluent builder for creating clusters.
361
+ *
362
+ * Two phantom type parameters track the builder's state:
363
+ *
364
+ * - `TProvided` - tokens that have been added via `.add()` (and satisfy
365
+ * other components' `.inject` requirements).
366
+ * - `TRequires` - tokens declared via `.requires()` that the builder
367
+ * expects an enclosing scope to provide. Non-empty TRequires marks the
368
+ * builder as a *sub-app*: it cannot compile standalone; it must be
369
+ * `.add()`-ed into a parent `JustScale()` that covers the requires.
370
+ *
371
+ * @typeParam TProvided - Tuple of tokens that have been added
372
+ * @typeParam TRequires - Tuple of tokens declared via `.requires()`
373
+ */
374
+ export interface Builder<TProvided extends AnyToken[] = [], TRequires extends AnyToken[] = []> {
375
+ /**
376
+ * Add a component to the builder.
377
+ *
378
+ * Components can be:
379
+ * - Services (defineService result)
380
+ * - Controllers (createController result)
381
+ * - Repository bindings (ModelRepository.of(X).bind(Y))
382
+ * - Features (createFeature result)
383
+ * - Callbacks ((b) => b.add(...))
384
+ * - Arrays of components
385
+ * - Sub-apps (another `JustScale()...build()` that used `.requires()`)
386
+ *
387
+ * Dependencies are checked at compile time. For normal components the
388
+ * check is "does TProvided satisfy this component's `.inject` deps?".
389
+ * For sub-apps the check is "does TProvided satisfy the sub-app's
390
+ * declared `.requires(...)`?". Both produce branded compile errors
391
+ * when unsatisfied.
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * createClusterBuilder()
396
+ * .add(PgClient)
397
+ * .add(ModelRepository.of(User).bind(PgUser))
398
+ * .add(UserService)
399
+ * .add(AuthFeature)
400
+ * .build()
401
+ * ```
402
+ */
403
+ add<C extends Component>(component: AddCheck<C, TProvided>): Builder<[...TProvided, ...ProvidesOf<C>], TRequires>;
404
+ /**
405
+ * Append controller defs discovered at runtime (no compile-time dep checking).
406
+ *
407
+ * Intended for infrastructure (e.g. the `just` CLI runner) that needs to
408
+ * register controllers whose existence isn't known until install time -
409
+ * typically CLI controllers contributed by installed packages. Their deps
410
+ * resolve against the same container as the user's app, so injected
411
+ * repositories/services are shared.
412
+ *
413
+ * Prefer `.add()` for anything you type-check at authoring time.
414
+ *
415
+ * @internal
416
+ */
417
+ addControllers(controllers: ReadonlyArray<import('../core/controller.js').ControllerDef<any>>): Builder<TProvided, TRequires>;
418
+ /**
419
+ * Override an existing token with a new implementation.
420
+ *
421
+ * This is useful for replacing built-in services (Logger, Lifecycle)
422
+ * or for testing purposes. The token must already be in TProvided.
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * createClusterBuilder()
427
+ * .add(InMemoryProcessStorage)
428
+ * .override(Logger, CustomLogger) // Replace built-in Logger
429
+ * .build()
430
+ * ```
431
+ */
432
+ override<TToken extends TProvided[number], // Must exist in TProvided
433
+ TImpl extends AnyToken>(token: TToken, implementation: TImpl): Builder<[...RemoveFromTuple<TToken, TProvided>, TImpl], TRequires>;
434
+ /**
435
+ * Declare a token this builder needs from a parent scope.
436
+ *
437
+ * Adding `.requires(T)` turns this builder into a *sub-app*: the
438
+ * resulting TRequires tuple captures everything the builder expects
439
+ * the enclosing `JustScale()` to provide. Downstream `.add()`s see
440
+ * T in TProvided, so components that inject T type-check as usual.
441
+ * But `.compile()` on a builder with non-empty TRequires yields a
442
+ * branded error - the builder must be `.add()`-ed into a parent that
443
+ * covers the requires.
444
+ *
445
+ * At runtime, the parent resolves T and bridges it into the sub-app's
446
+ * container via `createScopedBridge`, so calls through T from inside
447
+ * the sub-app execute in the parent's async scope.
448
+ *
449
+ * The token type is captured as-is (not widened to the full
450
+ * `ServiceToken<T>` union) - so the parent's `IsProvided` check can
451
+ * match the exact shape the consumer passed, without having to
452
+ * satisfy every member of the ServiceToken union.
453
+ *
454
+ * @see CORE_PHILOSOPHY.md principle 9
455
+ */
456
+ requires<T extends AnyToken>(token: T): Builder<[...TProvided, T], [...TRequires, T]>;
457
+ /**
458
+ * Build the cluster.
459
+ *
460
+ * Validates all dependencies are satisfied and creates the runnable
461
+ * cluster. The returned built value is typed with both TProvided and
462
+ * TRequires so downstream composers (parents `.add()`-ing this) can
463
+ * type-check that they cover the sub-app's requires.
464
+ */
465
+ build(): import('../justscale.js').BuiltApp<TProvided, TRequires>;
466
+ }
467
+ /**
468
+ * Extract controller types from a tuple of tokens.
469
+ */
470
+ export type ExtractControllers<TProvided extends AnyToken[]> = TProvided extends [infer Head, ...infer Tail extends AnyToken[]] ? Head extends import('../core/controller.js').ControllerDef<any> ? [Head, ...ExtractControllers<Tail>] : ExtractControllers<Tail> : [];
471
+ /**
472
+ * A built cluster ready to serve.
473
+ * @typeParam TProvided - Tuple of all tokens that were provided to the builder
474
+ */
475
+ export interface BuiltCluster<TProvided extends AnyToken[] = AnyToken[]> {
476
+ /**
477
+ * Compile the cluster into an App instance.
478
+ * This creates the actual runtime with match() and execute() methods.
479
+ */
480
+ compile(): App<ExtractControllers<TProvided>>;
481
+ /**
482
+ * The DI container for resolving services.
483
+ */
484
+ readonly container: import('../core/service.js').Container;
485
+ /**
486
+ * Start serving on the specified protocols.
487
+ * Internally calls compile() if not already compiled.
488
+ */
489
+ serve(options?: ServeOptions): Promise<void>;
490
+ /**
491
+ * Stop the cluster gracefully.
492
+ */
493
+ stop(): Promise<void>;
494
+ /**
495
+ * Resolve a token from the container.
496
+ */
497
+ resolve<T>(token: Token<T>): Promise<T>;
498
+ }
499
+ /**
500
+ * Re-exported from cluster/cluster.ts so IBuiltApp.serve(options?) has the
501
+ * same signature as BuiltApp.serve(options?). Single source of truth -
502
+ * previously these diverged and IBuiltApp silently disagreed with runtime.
503
+ */
504
+ import type { ServeOptions } from '../cluster/cluster.js';
505
+ export type { ServeOptions };
506
+ /**
507
+ * Extract added context type from a middleware function.
508
+ */
509
+ export type ExtractMiddlewareAdded<T> = T extends (ctx: any) => infer R ? R extends Promise<infer A> ? A : R : never;
510
+ /**
511
+ * Response entry in TReturns union.
512
+ * `TPermission` is the permission def type when declared via
513
+ * `.returns(status, schema, permission)`. Defaults to `unknown` for
514
+ * unpermissioned returns.
515
+ */
516
+ export interface ResponseEntry<TStatus extends number, TBody, TPermission = unknown> {
517
+ status: TStatus;
518
+ body: TBody;
519
+ permission: TPermission;
520
+ }
521
+ /**
522
+ * Extract status codes from TReturns union.
523
+ */
524
+ export type ExtractStatuses<T> = T extends ResponseEntry<infer S, any, any> ? S : never;
525
+ /**
526
+ * Extract body type for a specific status code.
527
+ */
528
+ export type ExtractBodyForStatus<T, TStatus extends number> = T extends ResponseEntry<TStatus, infer B, any> ? B : never;
529
+ /**
530
+ * Shape of a permission def with a name discriminator - anything structural
531
+ * matching this can be used as a `.returns()` permission argument.
532
+ */
533
+ export interface PermissionDefLike<TName extends string = string> {
534
+ readonly name: TName;
535
+ }
536
+ /** Extract the permission type from a single ResponseEntry. */
537
+ export type PermOf<E> = E extends ResponseEntry<any, any, infer P> ? P : never;
538
+ /** Extract the body type from a single ResponseEntry. */
539
+ export type BodyOf<E> = E extends ResponseEntry<any, infer B, any> ? B : never;
540
+ /** Extract the permission name from a PermissionDefLike. */
541
+ export type NameOf<P> = P extends PermissionDefLike<infer N> ? N : never;
542
+ /**
543
+ * Filter a ResponseEntry union down to entries that have a permission
544
+ * (i.e. TPermission extends PermissionDefLike).
545
+ */
546
+ export type PermEntries<R> = R extends ResponseEntry<any, any, infer P> ? P extends PermissionDefLike<any> ? R : never : never;
547
+ /**
548
+ * Build a discriminated union variant `{ permission, json }` from a single entry.
549
+ * Uses single-infer helpers to avoid TypeScript's multi-infer-union quirk.
550
+ */
551
+ export type ToPermissionVariant<E> = E extends any ? {
552
+ readonly permission: NameOf<PermOf<E>>;
553
+ json(data: BodyOf<E>): void;
554
+ } : never;
555
+ /** Build the full discriminated union for a permission-scoped res. */
556
+ export type PermissionVariants<R> = ToPermissionVariant<PermEntries<R>>;
557
+ /**
558
+ * A resolved execution step - fn is always a callable function.
559
+ * Used in CompiledRoute after GuardDef resolution.
560
+ */
561
+ export interface Step {
562
+ type: 'use' | 'guard';
563
+ fn: (ctx: any) => any;
564
+ }
565
+ /**
566
+ * An unresolved step - discriminated by type:
567
+ * - 'use': fn may be a MiddlewareDef (DI) or plain middleware function
568
+ * - 'guard': fn may be a GuardDef (DI), array of GuardDefs (OR semantics), or plain guard function
569
+ *
570
+ * Stored in RouteDef (builder output). Resolved to Step[] by createController.
571
+ */
572
+ export type UnresolvedStep = {
573
+ type: 'use';
574
+ fn: ((ctx: any) => any) | MiddlewareDef;
575
+ } | {
576
+ type: 'guard';
577
+ fn: ((ctx: any) => any) | GuardDef<any> | readonly GuardDef<any>[];
578
+ };
579
+ /**
580
+ * Finalized route definition (builder output - steps are unresolved).
581
+ * GuardDefs in steps are resolved by createController via the DI container.
582
+ */
583
+ export interface RouteDef<TPath extends string, TReturns, TRequirements, TBody = unknown> {
584
+ path: TPath;
585
+ steps: UnresolvedStep[];
586
+ responseSchemas: Map<number, import('zod').ZodType | null>;
587
+ handler: (ctx: any) => any;
588
+ /** Model types for path param → Reference transformation */
589
+ types?: Record<string, abstract new (...args: any[]) => any>;
590
+ /**
591
+ * Permission-scoped returns - declared via `.returns(status, schema, permission)`.
592
+ * Consumed by the `permissions` middleware to determine which permission the
593
+ * current caller matches (sets `res.permission`).
594
+ */
595
+ permissionReturns?: ReadonlyArray<{
596
+ status: number;
597
+ schema: import('zod').ZodType | null;
598
+ permission: PermissionDefLike;
599
+ }>;
600
+ }
601
+ /**
602
+ * Base route builder interface.
603
+ *
604
+ * @typeParam TContext - Accumulated context from middleware
605
+ * @typeParam TReturns - Union of possible responses (ResponseEntry union)
606
+ * @typeParam TRequirements - Accumulated DI requirements from plugins
607
+ * @typeParam TPath - Route path literal for param extraction
608
+ * @typeParam TBody - Request body type (accumulated via body() calls)
609
+ */
610
+ export interface RouteBuilder<TContext, TReturns, TRequirements, TPath extends string, TBody = unknown, THandlerReturn = void | Promise<void>> {
611
+ /**
612
+ * Add middleware that extends context.
613
+ * Cannot stop execution - always returns additions.
614
+ * Accepts either a plain function or a MiddlewareDef (with DI).
615
+ *
616
+ * When passed a DI-aware MiddlewareDef (built via `createMiddleware`),
617
+ * the middleware's `inject` deps are accumulated into TRequirements,
618
+ * which flows through to `RequiresOf<ControllerDef>` so that
619
+ * `.add(Controller)` type-checks at the builder level.
620
+ */
621
+ use<TMw extends ((ctx: TContext) => object | Promise<object>) | MiddlewareDef<object, any>>(middleware: TMw): RouteBuilder<TContext & ExtractAddedFromMiddleware<TMw>, TReturns, TRequirements | ExtractStepDeps<TMw>, TPath, TBody, THandlerReturn>;
622
+ /**
623
+ * Add guard that can stop execution.
624
+ * Cannot add to context - only checks and potentially stops.
625
+ * Accepts a guard function, a GuardDef (with DI), or an array of GuardDefs (any match = allow).
626
+ *
627
+ * DI-aware GuardDefs contribute their inject deps to TRequirements
628
+ * (same treatment as `.use()` - see there for the rationale).
629
+ */
630
+ guard<TG extends ((ctx: TContext & {
631
+ stop(): Stop;
632
+ }) => void | Stop | boolean | Promise<void | Stop | boolean>) | GuardDef | readonly GuardDef[]>(check: TG): RouteBuilder<TContext, TReturns, TRequirements | ExtractStepDeps<TG>, TPath, TBody, THandlerReturn>;
633
+ /**
634
+ * Apply a plugin that can chain multiple operations.
635
+ * Plugins can add use/guard/returns in any combination.
636
+ */
637
+ apply<TCtxOut, TRetOut, TReqOut, TBodyOut = TBody>(plugin: BuilderPlugin<TContext, TCtxOut, TReturns, TRetOut, TRequirements, TReqOut, TPath, TBody, TBodyOut>): RouteBuilder<TCtxOut, TRetOut, TReqOut, TPath, TBodyOut, THandlerReturn>;
638
+ /**
639
+ * Declare a permission-scoped response.
640
+ *
641
+ * Multiple `.returns()` calls with the same status and different permissions
642
+ * build a discriminated union on `res.permission` - the handler branches via
643
+ * `switch(res.permission)` and TypeScript narrows `res.json()` per case.
644
+ *
645
+ * Requires `.use(permissions)` middleware (or equivalent) to set `res.permission`.
646
+ */
647
+ returns<TStatus extends number, TSchema extends import('zod').ZodType, TPermission extends PermissionDefLike>(status: TStatus, schema: TSchema, permission: TPermission): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, import('zod').infer<TSchema>, TPermission>, TRequirements, TPath, TBody, THandlerReturn>;
648
+ /**
649
+ * Declare a possible response with schema.
650
+ */
651
+ returns<TStatus extends number, TSchema extends import('zod').ZodType>(status: TStatus, schema: TSchema): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, import('zod').infer<TSchema>>, TRequirements, TPath, TBody, THandlerReturn>;
652
+ /**
653
+ * Declare a possible response without body.
654
+ */
655
+ returns<TStatus extends number>(status: TStatus): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, void>, TRequirements, TPath, TBody, THandlerReturn>;
656
+ /**
657
+ * Declare model types for path params.
658
+ * Transforms matching params from `string` to `Reference<T>`.
659
+ */
660
+ types<TTypes extends Record<string, abstract new (...args: any[]) => any>>(types: TTypes): RouteBuilder<Omit<TContext, 'params'> & {
661
+ params: TypedParams<TPath, TTypes>;
662
+ }, TReturns, TRequirements, TPath, TBody, THandlerReturn>;
663
+ /**
664
+ * Set final handler.
665
+ */
666
+ handle(handler: (ctx: TContext) => THandlerReturn): RouteDef<TPath, TReturns, TRequirements, TBody>;
667
+ }
668
+ /**
669
+ * Forward declaration for BuilderPlugin.
670
+ * Full implementation with PLUGIN_SYMBOL, requirements, and resolve() in plugin.ts
671
+ *
672
+ * This minimal declaration is here to avoid circular dependencies between
673
+ * types.ts (RouteBuilder needs BuilderPlugin) and plugin.ts (BuilderPlugin needs RouteBuilder).
674
+ */
675
+ export interface BuilderPlugin<TCtxIn, TCtxOut, TRetIn, TRetOut, TReqIn, TReqOut, TPath extends string, TBodyIn = unknown, TBodyOut = TBodyIn, THandlerReturn = void | Promise<void>> {
676
+ (builder: RouteBuilder<TCtxIn, TRetIn, TReqIn, TPath, TBodyIn, THandlerReturn>): RouteBuilder<TCtxOut, TRetOut, TReqOut, TPath, TBodyOut, THandlerReturn>;
677
+ }
678
+ //# sourceMappingURL=types.d.ts.map