@bleedingdev/modern-js-plugin-bff 3.5.0-ultramodern.6 → 3.5.0-ultramodern.75

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 (332) hide show
  1. package/dist/cjs/cli/compress.js +52 -0
  2. package/dist/cjs/cli/generator.js +152 -0
  3. package/dist/cjs/cli/prefix.js +50 -0
  4. package/dist/cjs/cli/serverGlobalVars.js +127 -0
  5. package/dist/cjs/cli/watch.js +51 -0
  6. package/dist/cjs/cli.js +11 -130
  7. package/dist/cjs/loader.js +19 -2
  8. package/dist/cjs/runtime/data-platform/batch/queue.js +284 -0
  9. package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
  10. package/dist/cjs/runtime/data-platform/batch/response.js +64 -0
  11. package/dist/cjs/runtime/data-platform/batch/telemetry.js +67 -0
  12. package/dist/cjs/runtime/data-platform/batch/url.js +69 -0
  13. package/dist/cjs/runtime/data-platform/batch-transport.js +59 -0
  14. package/dist/cjs/runtime/data-platform/codec.js +155 -0
  15. package/dist/cjs/runtime/data-platform/index.js +30 -633
  16. package/dist/cjs/runtime/data-platform/invalidation.js +61 -0
  17. package/dist/cjs/runtime/data-platform/trace.js +73 -0
  18. package/dist/cjs/runtime/data-platform/types.js +48 -0
  19. package/dist/cjs/runtime/data-platform/validation.js +178 -0
  20. package/dist/cjs/runtime/effect/adapter/constants.js +44 -0
  21. package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +61 -0
  22. package/dist/cjs/runtime/effect/adapter/entry.js +92 -0
  23. package/dist/cjs/runtime/effect/adapter/error-response.js +79 -0
  24. package/dist/cjs/runtime/effect/adapter/handler.js +53 -0
  25. package/dist/cjs/runtime/effect/adapter.js +26 -146
  26. package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
  27. package/dist/cjs/runtime/effect/backend-federation/identity.js +82 -0
  28. package/dist/cjs/runtime/effect/backend-federation/load.js +66 -0
  29. package/dist/cjs/runtime/effect/backend-federation/plugin.js +53 -0
  30. package/dist/cjs/runtime/effect/backend-federation/remotes.js +50 -0
  31. package/dist/cjs/runtime/effect/backend-federation/runtime.js +64 -0
  32. package/dist/cjs/runtime/effect/backend-federation/types.js +18 -0
  33. package/dist/cjs/runtime/effect/backend-federation/utils.js +48 -0
  34. package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +83 -0
  35. package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +55 -0
  36. package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +94 -0
  37. package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
  38. package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +120 -0
  39. package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +68 -0
  40. package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +18 -0
  41. package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +109 -0
  42. package/dist/cjs/runtime/effect/backend-federation-manifest.js +62 -0
  43. package/dist/cjs/runtime/effect/backend-federation.js +65 -0
  44. package/dist/cjs/runtime/effect/dispatch.js +101 -0
  45. package/dist/cjs/runtime/effect/edge.js +64 -71
  46. package/dist/cjs/runtime/effect/endpoint-contracts.js +7 -21
  47. package/dist/cjs/runtime/effect/entry-shape.js +84 -0
  48. package/dist/cjs/runtime/effect/handler/batch-handler.js +161 -0
  49. package/dist/cjs/runtime/effect/handler/batch.js +195 -0
  50. package/dist/cjs/runtime/effect/handler/definition.js +101 -0
  51. package/dist/cjs/runtime/effect/handler/envelope.js +104 -0
  52. package/dist/cjs/runtime/effect/handler/http.js +96 -0
  53. package/dist/cjs/runtime/effect/handler/openapi.js +57 -0
  54. package/dist/cjs/runtime/effect/handler/routing.js +100 -0
  55. package/dist/cjs/runtime/effect/handler/rpc.js +63 -0
  56. package/dist/cjs/runtime/effect/handler/types.js +43 -0
  57. package/dist/cjs/runtime/effect/handler.js +37 -529
  58. package/dist/cjs/runtime/effect/index.js +91 -15
  59. package/dist/cjs/runtime/effect/module.js +23 -80
  60. package/dist/cjs/runtime/effect/rpcSerialization.js +54 -0
  61. package/dist/cjs/runtime/effect-client/batch.js +73 -0
  62. package/dist/cjs/runtime/effect-client/envelope.js +145 -0
  63. package/dist/cjs/runtime/effect-client/guards.js +44 -0
  64. package/dist/cjs/runtime/effect-client/index.js +6 -16
  65. package/dist/cjs/runtime/effect-client/request-context.js +64 -0
  66. package/dist/cjs/runtime/effect-client/request.js +66 -0
  67. package/dist/cjs/runtime/effect-client/runtime.js +12 -178
  68. package/dist/cjs/runtime/effect-client/types.js +18 -0
  69. package/dist/cjs/runtime/safe-failure.js +2 -1
  70. package/dist/cjs/utils/client-generator/files.js +152 -0
  71. package/dist/cjs/utils/client-generator/generate.js +138 -0
  72. package/dist/cjs/utils/client-generator/index.js +83 -0
  73. package/dist/cjs/utils/client-generator/package-json.js +132 -0
  74. package/dist/cjs/utils/client-generator/write-package.js +125 -0
  75. package/dist/cjs/utils/clientGenerator.js +26 -303
  76. package/dist/cjs/utils/effect-client-generator/generator.js +68 -0
  77. package/dist/cjs/utils/effect-client-generator/index.js +51 -0
  78. package/dist/cjs/utils/effect-client-generator/paths.js +73 -0
  79. package/dist/cjs/utils/effect-client-generator/rendering.js +231 -0
  80. package/dist/cjs/utils/effect-client-generator/runtime.js +85 -0
  81. package/dist/cjs/utils/effect-client-generator/types.js +18 -0
  82. package/dist/cjs/utils/effectClientGenerator.js +5 -262
  83. package/dist/cjs/utils/effectSourceLoader.js +173 -0
  84. package/dist/esm/cli/compress.mjs +14 -0
  85. package/dist/esm/cli/generator.mjs +101 -0
  86. package/dist/esm/cli/prefix.mjs +9 -0
  87. package/dist/esm/cli/serverGlobalVars.mjs +76 -0
  88. package/dist/esm/cli/watch.mjs +13 -0
  89. package/dist/esm/cli.mjs +7 -121
  90. package/dist/esm/loader.mjs +19 -2
  91. package/dist/esm/runtime/data-platform/batch/queue.mjs +246 -0
  92. package/dist/esm/runtime/data-platform/batch/request.mjs +45 -0
  93. package/dist/esm/runtime/data-platform/batch/response.mjs +23 -0
  94. package/dist/esm/runtime/data-platform/batch/telemetry.mjs +23 -0
  95. package/dist/esm/runtime/data-platform/batch/url.mjs +25 -0
  96. package/dist/esm/runtime/data-platform/batch-transport.mjs +12 -0
  97. package/dist/esm/runtime/data-platform/codec.mjs +90 -0
  98. package/dist/esm/runtime/data-platform/index.mjs +6 -610
  99. package/dist/esm/runtime/data-platform/invalidation.mjs +20 -0
  100. package/dist/esm/runtime/data-platform/trace.mjs +29 -0
  101. package/dist/esm/runtime/data-platform/types.mjs +4 -0
  102. package/dist/esm/runtime/data-platform/validation.mjs +128 -0
  103. package/dist/esm/runtime/effect/adapter/constants.mjs +6 -0
  104. package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +23 -0
  105. package/dist/esm/runtime/effect/adapter/entry.mjs +44 -0
  106. package/dist/esm/runtime/effect/adapter/error-response.mjs +41 -0
  107. package/dist/esm/runtime/effect/adapter/handler.mjs +15 -0
  108. package/dist/esm/runtime/effect/adapter.mjs +27 -147
  109. package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
  110. package/dist/esm/runtime/effect/backend-federation/identity.mjs +41 -0
  111. package/dist/esm/runtime/effect/backend-federation/load.mjs +28 -0
  112. package/dist/esm/runtime/effect/backend-federation/plugin.mjs +15 -0
  113. package/dist/esm/runtime/effect/backend-federation/remotes.mjs +12 -0
  114. package/dist/esm/runtime/effect/backend-federation/runtime.mjs +26 -0
  115. package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
  116. package/dist/esm/runtime/effect/backend-federation/utils.mjs +7 -0
  117. package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +32 -0
  118. package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +4 -0
  119. package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +56 -0
  120. package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +42 -0
  121. package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +76 -0
  122. package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +30 -0
  123. package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
  124. package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +65 -0
  125. package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -0
  126. package/dist/esm/runtime/effect/backend-federation.mjs +5 -0
  127. package/dist/esm/runtime/effect/dispatch.mjs +63 -0
  128. package/dist/esm/runtime/effect/edge.mjs +17 -63
  129. package/dist/esm/runtime/effect/endpoint-contracts.mjs +8 -13
  130. package/dist/esm/runtime/effect/entry-shape.mjs +36 -0
  131. package/dist/esm/runtime/effect/handler/batch-handler.mjs +123 -0
  132. package/dist/esm/runtime/effect/handler/batch.mjs +124 -0
  133. package/dist/esm/runtime/effect/handler/definition.mjs +60 -0
  134. package/dist/esm/runtime/effect/handler/envelope.mjs +63 -0
  135. package/dist/esm/runtime/effect/handler/http.mjs +58 -0
  136. package/dist/esm/runtime/effect/handler/openapi.mjs +19 -0
  137. package/dist/esm/runtime/effect/handler/routing.mjs +50 -0
  138. package/dist/esm/runtime/effect/handler/rpc.mjs +22 -0
  139. package/dist/esm/runtime/effect/handler/types.mjs +5 -0
  140. package/dist/esm/runtime/effect/handler.mjs +11 -506
  141. package/dist/esm/runtime/effect/index.mjs +5 -2
  142. package/dist/esm/runtime/effect/module.mjs +25 -82
  143. package/dist/esm/runtime/effect/rpcSerialization.mjs +16 -0
  144. package/dist/esm/runtime/effect-client/batch.mjs +35 -0
  145. package/dist/esm/runtime/effect-client/envelope.mjs +104 -0
  146. package/dist/esm/runtime/effect-client/guards.mjs +3 -0
  147. package/dist/esm/runtime/effect-client/index.mjs +27 -37
  148. package/dist/esm/runtime/effect-client/request-context.mjs +23 -0
  149. package/dist/esm/runtime/effect-client/request.mjs +28 -0
  150. package/dist/esm/runtime/effect-client/runtime.mjs +12 -178
  151. package/dist/esm/runtime/effect-client/types.mjs +0 -0
  152. package/dist/esm/runtime/safe-failure.mjs +2 -1
  153. package/dist/esm/utils/client-generator/files.mjs +68 -0
  154. package/dist/esm/utils/client-generator/generate.mjs +88 -0
  155. package/dist/esm/utils/client-generator/index.mjs +4 -0
  156. package/dist/esm/utils/client-generator/package-json.mjs +78 -0
  157. package/dist/esm/utils/client-generator/write-package.mjs +74 -0
  158. package/dist/esm/utils/clientGenerator.mjs +2 -293
  159. package/dist/esm/utils/effect-client-generator/generator.mjs +27 -0
  160. package/dist/esm/utils/effect-client-generator/index.mjs +3 -0
  161. package/dist/esm/utils/effect-client-generator/paths.mjs +25 -0
  162. package/dist/esm/utils/effect-client-generator/rendering.mjs +180 -0
  163. package/dist/esm/utils/effect-client-generator/runtime.mjs +34 -0
  164. package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
  165. package/dist/esm/utils/effectClientGenerator.mjs +1 -249
  166. package/dist/esm/utils/effectSourceLoader.mjs +123 -0
  167. package/dist/esm-node/cli/compress.mjs +15 -0
  168. package/dist/esm-node/cli/generator.mjs +102 -0
  169. package/dist/esm-node/cli/prefix.mjs +10 -0
  170. package/dist/esm-node/cli/serverGlobalVars.mjs +77 -0
  171. package/dist/esm-node/cli/watch.mjs +14 -0
  172. package/dist/esm-node/cli.mjs +7 -121
  173. package/dist/esm-node/loader.mjs +19 -2
  174. package/dist/esm-node/runtime/data-platform/batch/queue.mjs +247 -0
  175. package/dist/esm-node/runtime/data-platform/batch/request.mjs +46 -0
  176. package/dist/esm-node/runtime/data-platform/batch/response.mjs +24 -0
  177. package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +24 -0
  178. package/dist/esm-node/runtime/data-platform/batch/url.mjs +26 -0
  179. package/dist/esm-node/runtime/data-platform/batch-transport.mjs +13 -0
  180. package/dist/esm-node/runtime/data-platform/codec.mjs +91 -0
  181. package/dist/esm-node/runtime/data-platform/index.mjs +6 -610
  182. package/dist/esm-node/runtime/data-platform/invalidation.mjs +21 -0
  183. package/dist/esm-node/runtime/data-platform/trace.mjs +30 -0
  184. package/dist/esm-node/runtime/data-platform/types.mjs +5 -0
  185. package/dist/esm-node/runtime/data-platform/validation.mjs +129 -0
  186. package/dist/esm-node/runtime/effect/adapter/constants.mjs +7 -0
  187. package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +24 -0
  188. package/dist/esm-node/runtime/effect/adapter/entry.mjs +45 -0
  189. package/dist/esm-node/runtime/effect/adapter/error-response.mjs +42 -0
  190. package/dist/esm-node/runtime/effect/adapter/handler.mjs +16 -0
  191. package/dist/esm-node/runtime/effect/adapter.mjs +28 -149
  192. package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
  193. package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +42 -0
  194. package/dist/esm-node/runtime/effect/backend-federation/load.mjs +29 -0
  195. package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +16 -0
  196. package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +13 -0
  197. package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +27 -0
  198. package/dist/esm-node/runtime/effect/backend-federation/types.mjs +1 -0
  199. package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +8 -0
  200. package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +33 -0
  201. package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +5 -0
  202. package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +57 -0
  203. package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +43 -0
  204. package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +77 -0
  205. package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +31 -0
  206. package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +1 -0
  207. package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +66 -0
  208. package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +2 -0
  209. package/dist/esm-node/runtime/effect/backend-federation.mjs +6 -0
  210. package/dist/esm-node/runtime/effect/dispatch.mjs +64 -0
  211. package/dist/esm-node/runtime/effect/edge.mjs +17 -63
  212. package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +8 -13
  213. package/dist/esm-node/runtime/effect/entry-shape.mjs +37 -0
  214. package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +124 -0
  215. package/dist/esm-node/runtime/effect/handler/batch.mjs +125 -0
  216. package/dist/esm-node/runtime/effect/handler/definition.mjs +61 -0
  217. package/dist/esm-node/runtime/effect/handler/envelope.mjs +64 -0
  218. package/dist/esm-node/runtime/effect/handler/http.mjs +59 -0
  219. package/dist/esm-node/runtime/effect/handler/openapi.mjs +20 -0
  220. package/dist/esm-node/runtime/effect/handler/routing.mjs +51 -0
  221. package/dist/esm-node/runtime/effect/handler/rpc.mjs +23 -0
  222. package/dist/esm-node/runtime/effect/handler/types.mjs +6 -0
  223. package/dist/esm-node/runtime/effect/handler.mjs +11 -506
  224. package/dist/esm-node/runtime/effect/index.mjs +5 -2
  225. package/dist/esm-node/runtime/effect/module.mjs +25 -82
  226. package/dist/esm-node/runtime/effect/rpcSerialization.mjs +17 -0
  227. package/dist/esm-node/runtime/effect-client/batch.mjs +36 -0
  228. package/dist/esm-node/runtime/effect-client/envelope.mjs +105 -0
  229. package/dist/esm-node/runtime/effect-client/guards.mjs +4 -0
  230. package/dist/esm-node/runtime/effect-client/index.mjs +27 -37
  231. package/dist/esm-node/runtime/effect-client/request-context.mjs +24 -0
  232. package/dist/esm-node/runtime/effect-client/request.mjs +29 -0
  233. package/dist/esm-node/runtime/effect-client/runtime.mjs +12 -178
  234. package/dist/esm-node/runtime/effect-client/types.mjs +1 -0
  235. package/dist/esm-node/runtime/safe-failure.mjs +2 -1
  236. package/dist/esm-node/utils/client-generator/files.mjs +69 -0
  237. package/dist/esm-node/utils/client-generator/generate.mjs +89 -0
  238. package/dist/esm-node/utils/client-generator/index.mjs +5 -0
  239. package/dist/esm-node/utils/client-generator/package-json.mjs +79 -0
  240. package/dist/esm-node/utils/client-generator/write-package.mjs +75 -0
  241. package/dist/esm-node/utils/clientGenerator.mjs +2 -293
  242. package/dist/esm-node/utils/effect-client-generator/generator.mjs +28 -0
  243. package/dist/esm-node/utils/effect-client-generator/index.mjs +4 -0
  244. package/dist/esm-node/utils/effect-client-generator/paths.mjs +26 -0
  245. package/dist/esm-node/utils/effect-client-generator/rendering.mjs +181 -0
  246. package/dist/esm-node/utils/effect-client-generator/runtime.mjs +36 -0
  247. package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
  248. package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
  249. package/dist/esm-node/utils/effectSourceLoader.mjs +124 -0
  250. package/dist/types/cli/compress.d.ts +2 -0
  251. package/dist/types/cli/generator.d.ts +7 -0
  252. package/dist/types/cli/prefix.d.ts +2 -0
  253. package/dist/types/cli/serverGlobalVars.d.ts +4 -0
  254. package/dist/types/cli/watch.d.ts +1 -0
  255. package/dist/types/cli.d.ts +0 -1
  256. package/dist/types/runtime/data-platform/batch/queue.d.ts +8 -0
  257. package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
  258. package/dist/types/runtime/data-platform/batch/response.d.ts +3 -0
  259. package/dist/types/runtime/data-platform/batch/telemetry.d.ts +4 -0
  260. package/dist/types/runtime/data-platform/batch/url.d.ts +4 -0
  261. package/dist/types/runtime/data-platform/batch-transport.d.ts +3 -0
  262. package/dist/types/runtime/data-platform/codec.d.ts +17 -0
  263. package/dist/types/runtime/data-platform/index.d.ts +7 -191
  264. package/dist/types/runtime/data-platform/invalidation.d.ts +8 -0
  265. package/dist/types/runtime/data-platform/trace.d.ts +4 -0
  266. package/dist/types/runtime/data-platform/types.d.ts +146 -0
  267. package/dist/types/runtime/data-platform/validation.d.ts +29 -0
  268. package/dist/types/runtime/effect/adapter/constants.d.ts +1 -0
  269. package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +4 -0
  270. package/dist/types/runtime/effect/adapter/entry.d.ts +2 -0
  271. package/dist/types/runtime/effect/adapter/error-response.d.ts +2 -0
  272. package/dist/types/runtime/effect/adapter/handler.d.ts +7 -0
  273. package/dist/types/runtime/effect/adapter.d.ts +4 -13
  274. package/dist/types/runtime/effect/backend-federation/entry.d.ts +2 -0
  275. package/dist/types/runtime/effect/backend-federation/identity.d.ts +30 -0
  276. package/dist/types/runtime/effect/backend-federation/load.d.ts +13 -0
  277. package/dist/types/runtime/effect/backend-federation/plugin.d.ts +3 -0
  278. package/dist/types/runtime/effect/backend-federation/remotes.d.ts +2 -0
  279. package/dist/types/runtime/effect/backend-federation/runtime.d.ts +3 -0
  280. package/dist/types/runtime/effect/backend-federation/types.d.ts +73 -0
  281. package/dist/types/runtime/effect/backend-federation/utils.d.ts +2 -0
  282. package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +11 -0
  283. package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +6 -0
  284. package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +3 -0
  285. package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +18 -0
  286. package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +4 -0
  287. package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +3 -0
  288. package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +51 -0
  289. package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +5 -0
  290. package/dist/types/runtime/effect/backend-federation-manifest.d.ts +1 -0
  291. package/dist/types/runtime/effect/backend-federation.d.ts +7 -0
  292. package/dist/types/runtime/effect/dispatch.d.ts +13 -0
  293. package/dist/types/runtime/effect/edge.d.ts +8 -8
  294. package/dist/types/runtime/effect/endpoint-contracts.d.ts +5 -7
  295. package/dist/types/runtime/effect/entry-shape.d.ts +31 -0
  296. package/dist/types/runtime/effect/handler/batch-handler.d.ts +11 -0
  297. package/dist/types/runtime/effect/handler/batch.d.ts +17 -0
  298. package/dist/types/runtime/effect/handler/definition.d.ts +17 -0
  299. package/dist/types/runtime/effect/handler/envelope.d.ts +13 -0
  300. package/dist/types/runtime/effect/handler/http.d.ts +14 -0
  301. package/dist/types/runtime/effect/handler/openapi.d.ts +4 -0
  302. package/dist/types/runtime/effect/handler/routing.d.ts +5 -0
  303. package/dist/types/runtime/effect/handler/rpc.d.ts +7 -0
  304. package/dist/types/runtime/effect/handler/types.d.ts +148 -0
  305. package/dist/types/runtime/effect/handler.d.ts +4 -190
  306. package/dist/types/runtime/effect/index.d.ts +3 -0
  307. package/dist/types/runtime/effect/module.d.ts +3 -2
  308. package/dist/types/runtime/effect/rpcSerialization.d.ts +3 -0
  309. package/dist/types/runtime/effect-client/batch.d.ts +2 -0
  310. package/dist/types/runtime/effect-client/envelope.d.ts +15 -0
  311. package/dist/types/runtime/effect-client/guards.d.ts +2 -0
  312. package/dist/types/runtime/effect-client/index.d.ts +1 -1
  313. package/dist/types/runtime/effect-client/request-context.d.ts +3 -0
  314. package/dist/types/runtime/effect-client/request.d.ts +1 -0
  315. package/dist/types/runtime/effect-client/runtime.d.ts +2 -68
  316. package/dist/types/runtime/effect-client/types.d.ts +68 -0
  317. package/dist/types/utils/client-generator/files.d.ts +28 -0
  318. package/dist/types/utils/client-generator/generate.d.ts +26 -0
  319. package/dist/types/utils/client-generator/index.d.ts +7 -0
  320. package/dist/types/utils/client-generator/package-json.d.ts +16 -0
  321. package/dist/types/utils/client-generator/write-package.d.ts +6 -0
  322. package/dist/types/utils/clientGenerator.d.ts +2 -37
  323. package/dist/types/utils/crossProjectServerPolicy.d.ts +3 -2
  324. package/dist/types/utils/effect-client-generator/generator.d.ts +10 -0
  325. package/dist/types/utils/effect-client-generator/index.d.ts +4 -0
  326. package/dist/types/utils/effect-client-generator/paths.d.ts +5 -0
  327. package/dist/types/utils/effect-client-generator/rendering.d.ts +4 -0
  328. package/dist/types/utils/effect-client-generator/runtime.d.ts +12 -0
  329. package/dist/types/utils/effect-client-generator/types.d.ts +27 -0
  330. package/dist/types/utils/effectClientGenerator.d.ts +2 -41
  331. package/dist/types/utils/effectSourceLoader.d.ts +10 -0
  332. package/package.json +45 -33
@@ -0,0 +1,4 @@
1
+ import type { BackendFederationManifest, BackendFederationManifestAdapterOptions } from './types';
2
+ export declare function resolveBackendFederationManifestReference(options: Pick<BackendFederationManifestAdapterOptions, 'env' | 'manifestEnv' | 'manifestPath' | 'manifestUrl'>): string | undefined;
3
+ export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, label: string): Promise<T>;
4
+ export declare function loadBackendFederationManifest(options: Pick<BackendFederationManifestAdapterOptions, 'allowLegacyManifest' | 'env' | 'expected' | 'fetch' | 'manifest' | 'manifestEnv' | 'manifestPath' | 'manifestUrl' | 'timeoutMs'>): Promise<BackendFederationManifest>;
@@ -0,0 +1,3 @@
1
+ import { type BackendFederationRemote } from '../backend-federation';
2
+ import type { BackendFederationManifest } from './types';
3
+ export declare function resolveBackendFederationRemoteFromManifest(manifest: BackendFederationManifest, remoteOverride?: Partial<BackendFederationRemote>): BackendFederationRemote;
@@ -0,0 +1,51 @@
1
+ import type { ModuleFederation, ModuleFederationRuntimePlugin } from '@module-federation/runtime';
2
+ import type { BackendFederatedEffectApiModule, BackendFederationRemote } from '../backend-federation';
3
+ import type { BackendFederationManifestAdapterError } from './errors';
4
+ export type BackendFederationManifest = Record<string, unknown>;
5
+ export type BackendFederationVersionBoundaryExpectation = {
6
+ buildVersion?: string;
7
+ /**
8
+ * Delivery-unit build marker (ADR-0019). Semantically the same value as
9
+ * `buildVersion`; treated as an alias. If both are set and disagree the
10
+ * expectation itself is invalid and fails closed before any manifest
11
+ * comparison runs.
12
+ */
13
+ buildMarker?: string;
14
+ contractVersion?: string;
15
+ nodeAdapterVersion?: string;
16
+ packageName?: string;
17
+ remoteName?: string;
18
+ /**
19
+ * Delivery-unit identity root (ADR-0019 §3). When set, the manifest's
20
+ * `backendFederation.versionBoundary.deliveryUnit.unitId` (or the
21
+ * top-level `backendFederation.deliveryUnit.unitId` fallback) must match.
22
+ */
23
+ unitId?: string;
24
+ version?: string;
25
+ };
26
+ export type BackendFederationManifestFetchResponse = {
27
+ ok: boolean;
28
+ status: number;
29
+ statusText?: string;
30
+ text: () => Promise<string>;
31
+ };
32
+ export type BackendFederationManifestAdapterFallback = (error: BackendFederationManifestAdapterError, context: {
33
+ manifest?: BackendFederationManifest;
34
+ remote?: BackendFederationRemote;
35
+ }) => BackendFederatedEffectApiModule | Promise<BackendFederatedEffectApiModule>;
36
+ export type BackendFederationManifestAdapterOptions = {
37
+ allowLegacyManifest?: boolean;
38
+ env?: Record<string, string | undefined>;
39
+ expected?: BackendFederationVersionBoundaryExpectation;
40
+ fallback?: BackendFederationManifestAdapterFallback;
41
+ fetch?: (url: string) => Promise<BackendFederationManifestFetchResponse>;
42
+ hostName: string;
43
+ manifest?: BackendFederationManifest;
44
+ manifestEnv?: string;
45
+ manifestPath?: string;
46
+ manifestUrl?: string;
47
+ plugins?: ModuleFederationRuntimePlugin[];
48
+ remote?: Partial<BackendFederationRemote>;
49
+ runtime?: ModuleFederation;
50
+ timeoutMs?: number;
51
+ };
@@ -0,0 +1,5 @@
1
+ import { type BackendFederatedEffectApiModule, type BackendFederationRemote } from '../backend-federation';
2
+ import type { BackendFederationManifest, BackendFederationVersionBoundaryExpectation } from './types';
3
+ export declare function validateBackendFederationManifest(manifest: BackendFederationManifest, expected?: BackendFederationVersionBoundaryExpectation): void;
4
+ export declare function validateLoadedBackendFederationContract(loaded: BackendFederatedEffectApiModule, manifest: BackendFederationManifest, remote: BackendFederationRemote): void;
5
+ export declare function classifyLoadError(error: unknown): "remote_unavailable" | "strict_effect_required" | "version_mismatch";
@@ -0,0 +1 @@
1
+ export * from './backend-federation-manifest/index';
@@ -0,0 +1,7 @@
1
+ import { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION } from '@modern-js/utils/universal';
2
+ export { type BackendFederationExpectedIdentity, type BackendFederationIdentityIssue, validateExpectedBackendFederationIdentity, } from './backend-federation/identity';
3
+ export { loadBackendFederatedEffectApi } from './backend-federation/load';
4
+ export { createBackendFederationLoadEntryPlugin } from './backend-federation/plugin';
5
+ export { createBackendFederationRuntime } from './backend-federation/runtime';
6
+ export type { BackendFederatedEffectApiModule, BackendFederationEntryExports, BackendFederationIdentityLoadOptions, BackendFederationLoadEntryPluginOptions, BackendFederationRemote, BackendFederationRuntimeOptions, } from './backend-federation/types';
7
+ export { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION, };
@@ -0,0 +1,13 @@
1
+ import type { EffectBffRequestHandler } from './module';
2
+ import { type EffectContext } from './operation-context';
3
+ type EffectDispatchContextRunner = <T>(context: EffectContext, cb: () => T) => T;
4
+ export type DispatchEffectBffRequestOptions = {
5
+ prefix?: string;
6
+ env?: Record<string, unknown>;
7
+ path?: string;
8
+ method?: string;
9
+ runWithEffectContext: EffectDispatchContextRunner;
10
+ onError?: (error: unknown, context: EffectContext) => Promise<Response> | Response;
11
+ };
12
+ export declare function dispatchEffectBffRequestWithContext(handler: EffectBffRequestHandler, request: Request, options: DispatchEffectBffRequestOptions): Promise<Response>;
13
+ export {};
@@ -1,16 +1,12 @@
1
+ import { type DispatchEffectBffRequestOptions } from './dispatch';
1
2
  import type { EffectBffOpenApiConfig, EffectDataPlatformValidationOptions } from './handler';
2
3
  import { type EffectApiModule, type EffectBffRequestHandler } from './module';
3
- import { type EffectContext } from './operation-context';
4
+ import type { EffectContext } from './operation-context';
5
+ export { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION, type BackendFederatedEffectApiModule, type BackendFederationEntryExports, type BackendFederationExpectedIdentity, type BackendFederationIdentityIssue, type BackendFederationIdentityLoadOptions, type BackendFederationLoadEntryPluginOptions, type BackendFederationRemote, type BackendFederationRuntimeOptions, createBackendFederationLoadEntryPlugin, createBackendFederationRuntime, loadBackendFederatedEffectApi, validateExpectedBackendFederationIdentity, } from './backend-federation';
4
6
  export { runWithEffectContext, useEffectContext, useOperationContext, } from './edge-context';
5
7
  export * from './handler';
6
8
  export { type CreateEffectOperationContextOptions, createEffectOperationContext, type EffectContext, } from './operation-context';
7
- export type EffectBffEdgeDispatchOptions = {
8
- prefix?: string;
9
- env?: Record<string, unknown>;
10
- path?: string;
11
- method?: string;
12
- onError?: (error: unknown, context: EffectContext) => Promise<Response> | Response;
13
- };
9
+ export type EffectBffEdgeDispatchOptions = Omit<DispatchEffectBffRequestOptions, 'runWithEffectContext'>;
14
10
  export type EffectBffEdgeHandlerOptions = {
15
11
  module: EffectApiModule;
16
12
  prefix?: string;
@@ -20,6 +16,10 @@ export type EffectBffEdgeHandlerOptions = {
20
16
  onWarning?: (message: string) => void;
21
17
  };
22
18
  export declare function dispatchEffectBffRequest(handler: EffectBffRequestHandler, request: Request, options?: EffectBffEdgeDispatchOptions): Promise<Response>;
19
+ export declare function createEffectBffEdgeDispatcher(options: EffectBffEdgeHandlerOptions): Promise<{
20
+ dispatch: (request: Request, dispatchOptions?: Omit<EffectBffEdgeDispatchOptions, 'prefix' | 'onError'>) => Promise<Response>;
21
+ dispose: () => Promise<void>;
22
+ }>;
23
23
  export declare const createEffectBffTestHandler: typeof createEffectBffEdgeHandler;
24
24
  export declare function createEffectBffEdgeHandler(options: EffectBffEdgeHandlerOptions): Promise<{
25
25
  handler: (request: Request, dispatchOptions?: Omit<EffectBffEdgeDispatchOptions, 'prefix' | 'onError'>) => Promise<Response>;
@@ -21,10 +21,10 @@ export type EffectEndpointMeta = {
21
21
  export type HttpApiLike = {
22
22
  identifier?: unknown;
23
23
  };
24
- export type HttpApiGroupLike = {
24
+ type HttpApiGroupLike = {
25
25
  identifier?: unknown;
26
26
  };
27
- export type HttpApiEndpointLike = {
27
+ type HttpApiEndpointLike = {
28
28
  name?: unknown;
29
29
  method?: unknown;
30
30
  path?: unknown;
@@ -39,8 +39,6 @@ export type HttpApiReflect = (api: unknown, handlers: {
39
39
  }) => void;
40
40
  export declare function ensureLeadingSlash(pathname: string): string;
41
41
  export declare function normalizeEffectPrefix(prefix: string): string;
42
- export declare function getEffectRoutePath(prefix: string, endpointPath: string): string;
43
- export declare function resolveEffectApiId(api: HttpApiLike): string;
44
42
  export declare function collectEffectEndpoints(reflect: HttpApiReflect, api: HttpApiLike, prefix: string): EffectEndpointMeta[];
45
43
  /**
46
44
  * Maps reflected endpoints onto operation-contract sources for
@@ -48,11 +46,10 @@ export declare function collectEffectEndpoints(reflect: HttpApiReflect, api: Htt
48
46
  * carry no zod metadata, so the contract hash covers the endpoint identity.
49
47
  */
50
48
  export declare function toOperationContractSources(endpoints: EffectEndpointMeta[]): OperationContractSource[];
51
- export declare function createEffectOperationContractSource(endpoint: EffectEndpointMeta): OperationContractSource;
52
49
  /**
53
50
  * Extracts the HttpApi instance from a loaded effect entry module. Mirrors
54
- * the module shapes accepted by `resolveEffectBffModuleHandler`:
55
- * `{ api }`, `{ default: { api } }` and zero-arg default factories.
51
+ * the shared entry-shape policy accepted by `resolveEffectBffModuleHandler`,
52
+ * without executing factories during contract extraction.
56
53
  */
57
54
  export declare function extractHttpApiFromModule(mod: unknown, isHttpApi: (value: unknown) => boolean): Promise<HttpApiLike | null>;
58
55
  /**
@@ -60,3 +57,4 @@ export declare function extractHttpApiFromModule(mod: unknown, isHttpApi: (value
60
57
  * contract map (it is the same bff-core hash over the same inputs).
61
58
  */
62
59
  export declare function createEffectEndpointContractHash(endpoint: EffectEndpointMeta, requestId: string): string;
60
+ export {};
@@ -0,0 +1,31 @@
1
+ type EffectBffEntryModule = {
2
+ api?: unknown;
3
+ layer?: unknown;
4
+ handler?: unknown;
5
+ createHandler?: unknown;
6
+ default?: unknown;
7
+ };
8
+ type LegacyEffectBffEntryShape = '`handler` export' | 'default request handler';
9
+ export type EffectBffEntryShapeFacts = {
10
+ module: EffectBffEntryModule;
11
+ legacyShape?: LegacyEffectBffEntryShape;
12
+ createHandler?: unknown;
13
+ createHandlerValidatorAware: boolean;
14
+ api?: unknown;
15
+ layer?: unknown;
16
+ hasRuntimeLayer: boolean;
17
+ };
18
+ type EffectBffEntryShapePredicates = {
19
+ isRequestHandler: (value: unknown) => boolean;
20
+ isValidatorAwareHandlerFactory: (value: unknown) => boolean;
21
+ isHttpApi: (value: unknown) => boolean;
22
+ };
23
+ export declare const EFFECT_VALIDATOR_AWARE_FACTORY: symbol;
24
+ /**
25
+ * True when a custom createHandler factory is produced by defineEffectBff and
26
+ * therefore forwards strict cross-project validation into createHttpApiHandler.
27
+ */
28
+ export declare function isValidatorAwareHandlerFactory(factory: unknown): boolean;
29
+ export declare const strictEffectApproachMessage = "[BFF][Effect] strictEffectApproach is enforced: Effect API entries export defineEffectBff(...) or { api, layer } HttpApi module. Raw handler exports, default request handlers, unbranded custom createHandler factories not valid Effect API entries.";
30
+ export declare function classifyEffectBffEntryModule(value: unknown, predicates: EffectBffEntryShapePredicates): EffectBffEntryShapeFacts | null;
31
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { EffectDataPlatformValidationOptions } from './types';
2
+ type DataPlatformBatchItemHandler<TContext> = (request: Request, context?: TContext) => Promise<unknown>;
3
+ export declare function createDataPlatformBatchRequestHandler<TContext>(options: {
4
+ dataPlatform?: EffectDataPlatformValidationOptions;
5
+ handleItem: DataPlatformBatchItemHandler<TContext>;
6
+ }): {
7
+ enabled: boolean;
8
+ path: `/${string}`;
9
+ handle: (request: Request, context?: TContext) => Promise<Response>;
10
+ };
11
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type DataBatchRequestPayload, type DataBatchResponseItem } from '../../data-platform';
2
+ export declare function normalizeBatchPath(pathname: string | undefined): `/${string}`;
3
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
4
+ export declare function toTextLength(value: string): number;
5
+ export declare function toHeaderRecord(headers: Headers): Record<string, string>;
6
+ export declare function normalizeItemMethod(method: string | undefined): string;
7
+ export declare function normalizeBatchAllowedMethods(allowedMethods: string[] | undefined): Set<string>;
8
+ type ParsedBatchRequestPayload = Omit<DataBatchRequestPayload, 'items'> & {
9
+ items: unknown[];
10
+ };
11
+ export declare function isBatchRequestPayload(value: unknown): value is ParsedBatchRequestPayload;
12
+ export declare function createBatchValidationResponse(message: string, status?: number): Response;
13
+ export declare function prepareJsonRequestBody(request: Request): Promise<Request | Response>;
14
+ export declare function toBatchItemError(id: string, status: number, message: string): DataBatchResponseItem;
15
+ export declare function promiseWithTimeout<T>(effect: Promise<T>, timeoutMs: number): Promise<T>;
16
+ export declare function mapWithConcurrency<TItem, TResult>(items: readonly TItem[], concurrency: number, mapper: (item: TItem, index: number) => Promise<TResult>): Promise<TResult[]>;
17
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { HttpApi } from 'effect/unstable/httpapi';
2
+ import type { Rpc } from 'effect/unstable/rpc';
3
+ import type { EffectBffRuntime, EffectDataPlatformValidationOptions, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcRuntimeLayer, EffectRuntimeLayer } from './types';
4
+ export declare function defineEffectBff<TApi extends HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any>(definition: {
5
+ api: TApi;
6
+ layer: TLayer;
7
+ rpc?: EffectRpcBffDefinition<TRpcs>;
8
+ dataPlatform?: EffectDataPlatformValidationOptions;
9
+ }): {
10
+ api: TApi;
11
+ layer: TLayer;
12
+ rpc?: EffectRpcBffDefinition<TRpcs>;
13
+ dataPlatform?: EffectDataPlatformValidationOptions;
14
+ } & EffectBffRuntime<TApi, TLayer>;
15
+ export declare function defineEffectRpcBff<TRpcs extends Rpc.Any = Rpc.Any, TLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>>(definition: EffectRpcBffDefinition<TRpcs, TLayer>): EffectRpcBffDefinition<TRpcs, TLayer> & {
16
+ createHandler: EffectRpcBffHandlerFactory<TRpcs>;
17
+ };
@@ -0,0 +1,13 @@
1
+ import type { EffectDataPlatformValidationOptions } from './types';
2
+ /**
3
+ * Validates the `x-modernjs-data-envelope` header (the data-platform
4
+ * transport/cache contract: protocol version, scope, selection plan).
5
+ *
6
+ * This is NOT a security boundary: the envelope is client-constructed cache
7
+ * metadata used for batching, scope keys and hydration. Cross-project
8
+ * authorization runs through the bff-core policy evaluator wired in via
9
+ * `validateRequest` (see `EffectRequestValidator`), which both the direct
10
+ * and batched request paths hit before this check.
11
+ */
12
+ export declare function validateDataPlatformRequestEnvelope(request: Request, options: EffectDataPlatformValidationOptions | undefined): Response | null;
13
+ export declare function mergeDataPlatformOptions(base: EffectDataPlatformValidationOptions | undefined, override: Partial<EffectDataPlatformValidationOptions> | undefined): EffectDataPlatformValidationOptions | undefined;
@@ -0,0 +1,14 @@
1
+ import type { HttpApi } from 'effect/unstable/httpapi';
2
+ import type { Rpc } from 'effect/unstable/rpc';
3
+ import type { EffectBffOpenApiConfig, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRuntimeLayer } from './types';
4
+ export declare function createHttpApiHandler<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TRpcs extends Rpc.Any = Rpc.Any>(options: {
5
+ api: TApi;
6
+ layer: EffectRuntimeLayer;
7
+ openapi?: EffectBffOpenApiConfig;
8
+ rpc?: EffectRpcBffDefinition<TRpcs>;
9
+ dataPlatform?: EffectDataPlatformValidationOptions;
10
+ validateRequest?: EffectRequestValidator;
11
+ }): {
12
+ handler: (request: Request, context?: Parameters<(request: globalThis.Request, context: import("effect/Context").Context<unknown>) => Promise<Response>>[1]) => Promise<Response>;
13
+ dispose: () => Promise<void>;
14
+ };
@@ -0,0 +1,4 @@
1
+ import { HttpRouter } from 'effect/unstable/http';
2
+ import { type HttpApi } from 'effect/unstable/httpapi';
3
+ import type { EffectBffOpenApiConfig } from './types';
4
+ export declare function createOpenApiLayer(api: HttpApi.AnyWithProps, openapi: EffectBffOpenApiConfig | undefined): import("effect/Layer").Layer<never, never, HttpRouter.HttpRouter> | null;
@@ -0,0 +1,5 @@
1
+ export declare function getRequestPathname(request: Request): string;
2
+ export declare function getMountedPrefixFromContext(request: Request, context: unknown): string;
3
+ export declare function removeMountedPrefixFromBatchPath(pathWithQuery: string, prefix: string): string;
4
+ export declare function getExpectedEnvelopeOrigin(request: Request): string;
5
+ export declare function isRpcRequest(request: Request, rpcPath: `/${string}`): boolean;
@@ -0,0 +1,7 @@
1
+ import { type Rpc } from 'effect/unstable/rpc';
2
+ import type { EffectRpcBffDefinition } from './types';
3
+ export declare function normalizeRpcPath(pathname: string | undefined): `/${string}`;
4
+ export declare function createRpcApiHandler<TRpcs extends Rpc.Any = Rpc.Any>(options: EffectRpcBffDefinition<TRpcs>): {
5
+ readonly handler: (request: globalThis.Request, context?: import("effect/Context").Context<never> | undefined) => Promise<Response>;
6
+ readonly dispose: () => Promise<void>;
7
+ };
@@ -0,0 +1,148 @@
1
+ import type { FileSystem, Path } from 'effect';
2
+ import * as Context from 'effect/Context';
3
+ import type * as EffectType from 'effect/Effect';
4
+ import type * as Layer from 'effect/Layer';
5
+ import type { Etag, HttpPlatform, HttpRouter } from 'effect/unstable/http';
6
+ import type { HttpApi, HttpApiClient, HttpApiGroup } from 'effect/unstable/httpapi';
7
+ import type { Rpc, RpcGroup } from 'effect/unstable/rpc';
8
+ import type { createHttpApiHandler } from './http';
9
+ import type { createRpcApiHandler } from './rpc';
10
+ export type EffectRuntimeRequirements = Etag.Generator | FileSystem.FileSystem | HttpPlatform.HttpPlatform | HttpRouter.HttpRouter | HttpRouter.Request<'Error', unknown> | HttpRouter.Request<'GlobalError', unknown> | HttpRouter.Request<'GlobalRequires', unknown> | HttpRouter.Request<'Requires', unknown> | Path.Path;
11
+ export type EffectRuntimeLayer = Layer.Layer<never, never, EffectRuntimeRequirements>;
12
+ export declare const toEffectServiceContext: (context: unknown) => Context.Context<any>;
13
+ export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc' | 'msgPack';
14
+ export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
15
+ export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
16
+ group: RpcGroup.RpcGroup<TRpcs>;
17
+ layer: TRpcLayer;
18
+ path?: `/${string}`;
19
+ serialization?: EffectRpcSerialization;
20
+ disableTracing?: boolean;
21
+ spanPrefix?: string;
22
+ spanAttributes?: Record<string, unknown>;
23
+ disableFatalDefects?: boolean;
24
+ };
25
+ export type EffectRpcBffHandlerOptions = Pick<EffectRpcBffDefinition, 'path' | 'serialization' | 'disableTracing' | 'spanPrefix' | 'spanAttributes' | 'disableFatalDefects'>;
26
+ type EffectApiPromiseClient<TClient> = {
27
+ [GroupName in keyof TClient]: {
28
+ [EndpointName in keyof TClient[GroupName]]: TClient[GroupName][EndpointName] extends (...args: infer TArgs) => infer TResult ? TResult extends EffectType.Effect<unknown, unknown, unknown> ? (...args: TArgs) => Promise<Exclude<EffectType.Success<TResult>, readonly [unknown, unknown]>> : never : never;
29
+ };
30
+ };
31
+ export type EffectApiClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = TApi extends HttpApi.HttpApi<infer _ApiId, infer Groups> ? HttpApiClient.Client<Extract<Groups, HttpApiGroup.Any>, never, never> : never;
32
+ export type EffectApiPromiseClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = EffectApiPromiseClient<EffectApiClientFromApi<TApi>>;
33
+ export type EffectBffDefinition<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any> = {
34
+ api: TApi;
35
+ layer: TLayer;
36
+ rpc?: EffectRpcBffDefinition<TRpcs>;
37
+ dataPlatform?: EffectDataPlatformValidationOptions;
38
+ };
39
+ export type EffectDataPlatformSelectionValidationOptions = {
40
+ maxDepth?: number;
41
+ maxFields?: number;
42
+ allowedLeafPaths?: string[];
43
+ };
44
+ export type EffectDataPlatformBatchOptions = {
45
+ /**
46
+ * Enable network batching endpoint for Effect HttpApi requests.
47
+ * Defaults to `true`.
48
+ */
49
+ enabled?: boolean;
50
+ /**
51
+ * Batch endpoint path mounted under BFF prefix.
52
+ * Defaults to `/_data/batch`.
53
+ */
54
+ endpoint?: `/${string}`;
55
+ /**
56
+ * Maximum request items accepted per batch call.
57
+ * Defaults to `16`.
58
+ */
59
+ maxBatchSize?: number;
60
+ /**
61
+ * Maximum serialized request payload size in bytes.
62
+ * Defaults to `65536` (64KiB).
63
+ */
64
+ maxBatchBytes?: number;
65
+ /**
66
+ * Client-side micro-batch flush window in milliseconds.
67
+ * Server runtime ignores this value and passes it through for codegen.
68
+ * Defaults to `8`.
69
+ */
70
+ flushIntervalMs?: number;
71
+ /**
72
+ * Maximum per-batch internal request concurrency.
73
+ * Defaults to `4`.
74
+ */
75
+ maxConcurrency?: number;
76
+ /**
77
+ * Optional timeout per internal request in milliseconds.
78
+ * Defaults to `10000`.
79
+ */
80
+ requestTimeoutMs?: number;
81
+ /**
82
+ * Allowed HTTP methods for internal batched dispatch.
83
+ * Defaults to `['GET']`.
84
+ */
85
+ allowedMethods?: string[];
86
+ };
87
+ export type EffectDataPlatformValidationOptions = {
88
+ /**
89
+ * Enable envelope validation for HttpApi requests.
90
+ * Defaults to `true`.
91
+ */
92
+ enabled?: boolean;
93
+ /**
94
+ * Require every HttpApi request to include an envelope header.
95
+ * Defaults to `false`.
96
+ */
97
+ requireEnvelope?: boolean;
98
+ /**
99
+ * Header name used by client/server for the serialized request envelope.
100
+ * Defaults to `x-modernjs-data-envelope`.
101
+ */
102
+ envelopeHeader?: string;
103
+ /**
104
+ * Optional namespace assertion for envelope validation.
105
+ */
106
+ expectedNamespace?: string;
107
+ /**
108
+ * Validate envelope origin against incoming request origin.
109
+ * Defaults to `true`.
110
+ */
111
+ validateOrigin?: boolean;
112
+ /**
113
+ * Require trace context inside request envelope.
114
+ * Defaults to `false`.
115
+ */
116
+ requireTraceContext?: boolean;
117
+ /**
118
+ * Selection plan guardrails for server-side validation.
119
+ */
120
+ selection?: EffectDataPlatformSelectionValidationOptions;
121
+ /**
122
+ * Network batching gateway configuration.
123
+ */
124
+ batch?: EffectDataPlatformBatchOptions;
125
+ };
126
+ /**
127
+ * Server-seam request validator applied to every HttpApi request — direct,
128
+ * batched (per item) and rpc. Returning a Response short-circuits the
129
+ * request; returning `null`/`undefined` lets it through. Used by the effect
130
+ * adapter to enforce the cross-project policy at one seam so batched items
131
+ * cannot bypass it.
132
+ */
133
+ export type EffectRequestValidator = (request: Request) => Response | null | undefined;
134
+ export type EffectBffHandlerFactory<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
135
+ openapi?: EffectBffOpenApiConfig;
136
+ rpc?: Partial<EffectRpcBffHandlerOptions>;
137
+ dataPlatform?: Partial<EffectDataPlatformValidationOptions>;
138
+ validateRequest?: EffectRequestValidator;
139
+ }) => ReturnType<typeof createHttpApiHandler>;
140
+ export type EffectBffRuntime<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = {
141
+ createHandler: EffectBffHandlerFactory<TApi, TLayer>;
142
+ client: EffectApiPromiseClientFromApi<TApi>;
143
+ };
144
+ export type EffectBffOpenApiConfig = boolean | {
145
+ path?: string;
146
+ };
147
+ export type EffectRpcBffHandlerFactory<TRpcs extends Rpc.Any = Rpc.Any> = (options?: Partial<EffectRpcBffHandlerOptions>) => ReturnType<typeof createRpcApiHandler<TRpcs>>;
148
+ export {};