@bleedingdev/modern-js-plugin-bff 3.5.0-ultramodern.30 → 3.5.0-ultramodern.31

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 (292) hide show
  1. package/dist/cjs/cli/compress.js +52 -0
  2. package/dist/cjs/cli/generator.js +149 -0
  3. package/dist/cjs/cli/prefix.js +50 -0
  4. package/dist/cjs/cli/watch.js +51 -0
  5. package/dist/cjs/cli.js +11 -130
  6. package/dist/cjs/runtime/data-platform/batch/queue.js +287 -0
  7. package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
  8. package/dist/cjs/runtime/data-platform/batch/response.js +67 -0
  9. package/dist/cjs/runtime/data-platform/batch/telemetry.js +67 -0
  10. package/dist/cjs/runtime/data-platform/batch/url.js +69 -0
  11. package/dist/cjs/runtime/data-platform/batch-transport.js +59 -0
  12. package/dist/cjs/runtime/data-platform/codec.js +155 -0
  13. package/dist/cjs/runtime/data-platform/index.js +30 -633
  14. package/dist/cjs/runtime/data-platform/invalidation.js +61 -0
  15. package/dist/cjs/runtime/data-platform/trace.js +73 -0
  16. package/dist/cjs/runtime/data-platform/types.js +48 -0
  17. package/dist/cjs/runtime/data-platform/validation.js +178 -0
  18. package/dist/cjs/runtime/effect/adapter/constants.js +44 -0
  19. package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +61 -0
  20. package/dist/cjs/runtime/effect/adapter/entry.js +77 -0
  21. package/dist/cjs/runtime/effect/adapter/error-response.js +79 -0
  22. package/dist/cjs/runtime/effect/adapter/handler.js +53 -0
  23. package/dist/cjs/runtime/effect/adapter.js +12 -115
  24. package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
  25. package/dist/cjs/runtime/effect/backend-federation/load.js +57 -0
  26. package/dist/cjs/runtime/effect/backend-federation/plugin.js +53 -0
  27. package/dist/cjs/runtime/effect/backend-federation/remotes.js +50 -0
  28. package/dist/cjs/runtime/effect/backend-federation/runtime.js +64 -0
  29. package/dist/cjs/runtime/effect/backend-federation/types.js +18 -0
  30. package/dist/cjs/runtime/effect/backend-federation/utils.js +48 -0
  31. package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +83 -0
  32. package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +55 -0
  33. package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +74 -0
  34. package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
  35. package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +117 -0
  36. package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +68 -0
  37. package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +18 -0
  38. package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +108 -0
  39. package/dist/cjs/runtime/effect/backend-federation-manifest.js +32 -257
  40. package/dist/cjs/runtime/effect/backend-federation.js +11 -139
  41. package/dist/cjs/runtime/effect/handler/batch-handler.js +161 -0
  42. package/dist/cjs/runtime/effect/handler/batch.js +195 -0
  43. package/dist/cjs/runtime/effect/handler/definition.js +101 -0
  44. package/dist/cjs/runtime/effect/handler/envelope.js +104 -0
  45. package/dist/cjs/runtime/effect/handler/http.js +96 -0
  46. package/dist/cjs/runtime/effect/handler/openapi.js +57 -0
  47. package/dist/cjs/runtime/effect/handler/routing.js +100 -0
  48. package/dist/cjs/runtime/effect/handler/rpc.js +63 -0
  49. package/dist/cjs/runtime/effect/handler/types.js +43 -0
  50. package/dist/cjs/runtime/effect/handler.js +35 -526
  51. package/dist/cjs/runtime/effect/rpcSerialization.js +54 -0
  52. package/dist/cjs/runtime/effect-client/batch.js +73 -0
  53. package/dist/cjs/runtime/effect-client/envelope.js +145 -0
  54. package/dist/cjs/runtime/effect-client/guards.js +44 -0
  55. package/dist/cjs/runtime/effect-client/index.js +6 -16
  56. package/dist/cjs/runtime/effect-client/request-context.js +64 -0
  57. package/dist/cjs/runtime/effect-client/request.js +66 -0
  58. package/dist/cjs/runtime/effect-client/runtime.js +12 -178
  59. package/dist/cjs/runtime/effect-client/types.js +18 -0
  60. package/dist/cjs/runtime/safe-failure.js +2 -1
  61. package/dist/cjs/utils/client-generator/files.js +152 -0
  62. package/dist/cjs/utils/client-generator/generate.js +138 -0
  63. package/dist/cjs/utils/client-generator/index.js +83 -0
  64. package/dist/cjs/utils/client-generator/package-json.js +132 -0
  65. package/dist/cjs/utils/client-generator/write-package.js +125 -0
  66. package/dist/cjs/utils/clientGenerator.js +26 -303
  67. package/dist/cjs/utils/effect-client-generator/generator.js +64 -0
  68. package/dist/cjs/utils/effect-client-generator/index.js +51 -0
  69. package/dist/cjs/utils/effect-client-generator/paths.js +73 -0
  70. package/dist/cjs/utils/effect-client-generator/rendering.js +231 -0
  71. package/dist/cjs/utils/effect-client-generator/runtime.js +84 -0
  72. package/dist/cjs/utils/effect-client-generator/types.js +18 -0
  73. package/dist/cjs/utils/effectClientGenerator.js +5 -262
  74. package/dist/esm/cli/compress.mjs +14 -0
  75. package/dist/esm/cli/generator.mjs +98 -0
  76. package/dist/esm/cli/prefix.mjs +9 -0
  77. package/dist/esm/cli/watch.mjs +13 -0
  78. package/dist/esm/cli.mjs +7 -121
  79. package/dist/esm/runtime/data-platform/batch/queue.mjs +246 -0
  80. package/dist/esm/runtime/data-platform/batch/request.mjs +45 -0
  81. package/dist/esm/runtime/data-platform/batch/response.mjs +23 -0
  82. package/dist/esm/runtime/data-platform/batch/telemetry.mjs +23 -0
  83. package/dist/esm/runtime/data-platform/batch/url.mjs +25 -0
  84. package/dist/esm/runtime/data-platform/batch-transport.mjs +12 -0
  85. package/dist/esm/runtime/data-platform/codec.mjs +90 -0
  86. package/dist/esm/runtime/data-platform/index.mjs +6 -610
  87. package/dist/esm/runtime/data-platform/invalidation.mjs +20 -0
  88. package/dist/esm/runtime/data-platform/trace.mjs +29 -0
  89. package/dist/esm/runtime/data-platform/types.mjs +4 -0
  90. package/dist/esm/runtime/data-platform/validation.mjs +128 -0
  91. package/dist/esm/runtime/effect/adapter/constants.mjs +6 -0
  92. package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +23 -0
  93. package/dist/esm/runtime/effect/adapter/entry.mjs +29 -0
  94. package/dist/esm/runtime/effect/adapter/error-response.mjs +41 -0
  95. package/dist/esm/runtime/effect/adapter/handler.mjs +15 -0
  96. package/dist/esm/runtime/effect/adapter.mjs +12 -105
  97. package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
  98. package/dist/esm/runtime/effect/backend-federation/load.mjs +19 -0
  99. package/dist/esm/runtime/effect/backend-federation/plugin.mjs +15 -0
  100. package/dist/esm/runtime/effect/backend-federation/remotes.mjs +12 -0
  101. package/dist/esm/runtime/effect/backend-federation/runtime.mjs +26 -0
  102. package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
  103. package/dist/esm/runtime/effect/backend-federation/utils.mjs +7 -0
  104. package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +32 -0
  105. package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +4 -0
  106. package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +36 -0
  107. package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +42 -0
  108. package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +76 -0
  109. package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +30 -0
  110. package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
  111. package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +64 -0
  112. package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -237
  113. package/dist/esm/runtime/effect/backend-federation.mjs +4 -132
  114. package/dist/esm/runtime/effect/handler/batch-handler.mjs +123 -0
  115. package/dist/esm/runtime/effect/handler/batch.mjs +124 -0
  116. package/dist/esm/runtime/effect/handler/definition.mjs +60 -0
  117. package/dist/esm/runtime/effect/handler/envelope.mjs +63 -0
  118. package/dist/esm/runtime/effect/handler/http.mjs +58 -0
  119. package/dist/esm/runtime/effect/handler/openapi.mjs +19 -0
  120. package/dist/esm/runtime/effect/handler/routing.mjs +50 -0
  121. package/dist/esm/runtime/effect/handler/rpc.mjs +22 -0
  122. package/dist/esm/runtime/effect/handler/types.mjs +5 -0
  123. package/dist/esm/runtime/effect/handler.mjs +7 -499
  124. package/dist/esm/runtime/effect/rpcSerialization.mjs +16 -0
  125. package/dist/esm/runtime/effect-client/batch.mjs +35 -0
  126. package/dist/esm/runtime/effect-client/envelope.mjs +104 -0
  127. package/dist/esm/runtime/effect-client/guards.mjs +3 -0
  128. package/dist/esm/runtime/effect-client/index.mjs +5 -15
  129. package/dist/esm/runtime/effect-client/request-context.mjs +23 -0
  130. package/dist/esm/runtime/effect-client/request.mjs +28 -0
  131. package/dist/esm/runtime/effect-client/runtime.mjs +12 -178
  132. package/dist/esm/runtime/effect-client/types.mjs +0 -0
  133. package/dist/esm/runtime/safe-failure.mjs +2 -1
  134. package/dist/esm/utils/client-generator/files.mjs +68 -0
  135. package/dist/esm/utils/client-generator/generate.mjs +88 -0
  136. package/dist/esm/utils/client-generator/index.mjs +4 -0
  137. package/dist/esm/utils/client-generator/package-json.mjs +78 -0
  138. package/dist/esm/utils/client-generator/write-package.mjs +74 -0
  139. package/dist/esm/utils/clientGenerator.mjs +2 -293
  140. package/dist/esm/utils/effect-client-generator/generator.mjs +23 -0
  141. package/dist/esm/utils/effect-client-generator/index.mjs +3 -0
  142. package/dist/esm/utils/effect-client-generator/paths.mjs +25 -0
  143. package/dist/esm/utils/effect-client-generator/rendering.mjs +180 -0
  144. package/dist/esm/utils/effect-client-generator/runtime.mjs +33 -0
  145. package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
  146. package/dist/esm/utils/effectClientGenerator.mjs +1 -249
  147. package/dist/esm-node/cli/compress.mjs +15 -0
  148. package/dist/esm-node/cli/generator.mjs +99 -0
  149. package/dist/esm-node/cli/prefix.mjs +10 -0
  150. package/dist/esm-node/cli/watch.mjs +14 -0
  151. package/dist/esm-node/cli.mjs +7 -121
  152. package/dist/esm-node/runtime/data-platform/batch/queue.mjs +247 -0
  153. package/dist/esm-node/runtime/data-platform/batch/request.mjs +46 -0
  154. package/dist/esm-node/runtime/data-platform/batch/response.mjs +24 -0
  155. package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +24 -0
  156. package/dist/esm-node/runtime/data-platform/batch/url.mjs +26 -0
  157. package/dist/esm-node/runtime/data-platform/batch-transport.mjs +13 -0
  158. package/dist/esm-node/runtime/data-platform/codec.mjs +91 -0
  159. package/dist/esm-node/runtime/data-platform/index.mjs +6 -610
  160. package/dist/esm-node/runtime/data-platform/invalidation.mjs +21 -0
  161. package/dist/esm-node/runtime/data-platform/trace.mjs +30 -0
  162. package/dist/esm-node/runtime/data-platform/types.mjs +5 -0
  163. package/dist/esm-node/runtime/data-platform/validation.mjs +129 -0
  164. package/dist/esm-node/runtime/effect/adapter/constants.mjs +7 -0
  165. package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +24 -0
  166. package/dist/esm-node/runtime/effect/adapter/entry.mjs +30 -0
  167. package/dist/esm-node/runtime/effect/adapter/error-response.mjs +42 -0
  168. package/dist/esm-node/runtime/effect/adapter/handler.mjs +16 -0
  169. package/dist/esm-node/runtime/effect/adapter.mjs +12 -105
  170. package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
  171. package/dist/esm-node/runtime/effect/backend-federation/load.mjs +20 -0
  172. package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +16 -0
  173. package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +13 -0
  174. package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +27 -0
  175. package/dist/esm-node/runtime/effect/backend-federation/types.mjs +1 -0
  176. package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +8 -0
  177. package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +33 -0
  178. package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +5 -0
  179. package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +37 -0
  180. package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +43 -0
  181. package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +77 -0
  182. package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +31 -0
  183. package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +1 -0
  184. package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +65 -0
  185. package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +1 -237
  186. package/dist/esm-node/runtime/effect/backend-federation.mjs +4 -132
  187. package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +124 -0
  188. package/dist/esm-node/runtime/effect/handler/batch.mjs +125 -0
  189. package/dist/esm-node/runtime/effect/handler/definition.mjs +61 -0
  190. package/dist/esm-node/runtime/effect/handler/envelope.mjs +64 -0
  191. package/dist/esm-node/runtime/effect/handler/http.mjs +59 -0
  192. package/dist/esm-node/runtime/effect/handler/openapi.mjs +20 -0
  193. package/dist/esm-node/runtime/effect/handler/routing.mjs +51 -0
  194. package/dist/esm-node/runtime/effect/handler/rpc.mjs +23 -0
  195. package/dist/esm-node/runtime/effect/handler/types.mjs +6 -0
  196. package/dist/esm-node/runtime/effect/handler.mjs +7 -499
  197. package/dist/esm-node/runtime/effect/rpcSerialization.mjs +17 -0
  198. package/dist/esm-node/runtime/effect-client/batch.mjs +36 -0
  199. package/dist/esm-node/runtime/effect-client/envelope.mjs +105 -0
  200. package/dist/esm-node/runtime/effect-client/guards.mjs +4 -0
  201. package/dist/esm-node/runtime/effect-client/index.mjs +5 -15
  202. package/dist/esm-node/runtime/effect-client/request-context.mjs +24 -0
  203. package/dist/esm-node/runtime/effect-client/request.mjs +29 -0
  204. package/dist/esm-node/runtime/effect-client/runtime.mjs +12 -178
  205. package/dist/esm-node/runtime/effect-client/types.mjs +1 -0
  206. package/dist/esm-node/runtime/safe-failure.mjs +2 -1
  207. package/dist/esm-node/utils/client-generator/files.mjs +69 -0
  208. package/dist/esm-node/utils/client-generator/generate.mjs +89 -0
  209. package/dist/esm-node/utils/client-generator/index.mjs +5 -0
  210. package/dist/esm-node/utils/client-generator/package-json.mjs +79 -0
  211. package/dist/esm-node/utils/client-generator/write-package.mjs +75 -0
  212. package/dist/esm-node/utils/clientGenerator.mjs +2 -293
  213. package/dist/esm-node/utils/effect-client-generator/generator.mjs +24 -0
  214. package/dist/esm-node/utils/effect-client-generator/index.mjs +4 -0
  215. package/dist/esm-node/utils/effect-client-generator/paths.mjs +26 -0
  216. package/dist/esm-node/utils/effect-client-generator/rendering.mjs +181 -0
  217. package/dist/esm-node/utils/effect-client-generator/runtime.mjs +35 -0
  218. package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
  219. package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
  220. package/dist/types/cli/compress.d.ts +2 -0
  221. package/dist/types/cli/generator.d.ts +7 -0
  222. package/dist/types/cli/prefix.d.ts +2 -0
  223. package/dist/types/cli/watch.d.ts +1 -0
  224. package/dist/types/cli.d.ts +0 -1
  225. package/dist/types/runtime/data-platform/batch/queue.d.ts +25 -0
  226. package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
  227. package/dist/types/runtime/data-platform/batch/response.d.ts +4 -0
  228. package/dist/types/runtime/data-platform/batch/telemetry.d.ts +4 -0
  229. package/dist/types/runtime/data-platform/batch/url.d.ts +4 -0
  230. package/dist/types/runtime/data-platform/batch-transport.d.ts +3 -0
  231. package/dist/types/runtime/data-platform/codec.d.ts +17 -0
  232. package/dist/types/runtime/data-platform/index.d.ts +7 -191
  233. package/dist/types/runtime/data-platform/invalidation.d.ts +8 -0
  234. package/dist/types/runtime/data-platform/trace.d.ts +4 -0
  235. package/dist/types/runtime/data-platform/types.d.ts +146 -0
  236. package/dist/types/runtime/data-platform/validation.d.ts +29 -0
  237. package/dist/types/runtime/effect/adapter/constants.d.ts +1 -0
  238. package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +4 -0
  239. package/dist/types/runtime/effect/adapter/entry.d.ts +2 -0
  240. package/dist/types/runtime/effect/adapter/error-response.d.ts +2 -0
  241. package/dist/types/runtime/effect/adapter/handler.d.ts +4 -0
  242. package/dist/types/runtime/effect/adapter.d.ts +4 -13
  243. package/dist/types/runtime/effect/backend-federation/entry.d.ts +2 -0
  244. package/dist/types/runtime/effect/backend-federation/load.d.ts +2 -0
  245. package/dist/types/runtime/effect/backend-federation/plugin.d.ts +3 -0
  246. package/dist/types/runtime/effect/backend-federation/remotes.d.ts +2 -0
  247. package/dist/types/runtime/effect/backend-federation/runtime.d.ts +3 -0
  248. package/dist/types/runtime/effect/backend-federation/types.d.ts +58 -0
  249. package/dist/types/runtime/effect/backend-federation/utils.d.ts +2 -0
  250. package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +11 -0
  251. package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +6 -0
  252. package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +3 -0
  253. package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +18 -0
  254. package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +3 -0
  255. package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +3 -0
  256. package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +51 -0
  257. package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +5 -0
  258. package/dist/types/runtime/effect/backend-federation-manifest.d.ts +1 -60
  259. package/dist/types/runtime/effect/backend-federation.d.ts +6 -60
  260. package/dist/types/runtime/effect/handler/batch-handler.d.ts +11 -0
  261. package/dist/types/runtime/effect/handler/batch.d.ts +17 -0
  262. package/dist/types/runtime/effect/handler/definition.d.ts +17 -0
  263. package/dist/types/runtime/effect/handler/envelope.d.ts +13 -0
  264. package/dist/types/runtime/effect/handler/http.d.ts +14 -0
  265. package/dist/types/runtime/effect/handler/openapi.d.ts +4 -0
  266. package/dist/types/runtime/effect/handler/routing.d.ts +5 -0
  267. package/dist/types/runtime/effect/handler/rpc.d.ts +7 -0
  268. package/dist/types/runtime/effect/handler/types.d.ts +148 -0
  269. package/dist/types/runtime/effect/handler.d.ts +3 -173
  270. package/dist/types/runtime/effect/rpcSerialization.d.ts +3 -0
  271. package/dist/types/runtime/effect-client/batch.d.ts +2 -0
  272. package/dist/types/runtime/effect-client/envelope.d.ts +15 -0
  273. package/dist/types/runtime/effect-client/guards.d.ts +2 -0
  274. package/dist/types/runtime/effect-client/request-context.d.ts +3 -0
  275. package/dist/types/runtime/effect-client/request.d.ts +1 -0
  276. package/dist/types/runtime/effect-client/runtime.d.ts +2 -68
  277. package/dist/types/runtime/effect-client/types.d.ts +68 -0
  278. package/dist/types/utils/client-generator/files.d.ts +28 -0
  279. package/dist/types/utils/client-generator/generate.d.ts +26 -0
  280. package/dist/types/utils/client-generator/index.d.ts +7 -0
  281. package/dist/types/utils/client-generator/package-json.d.ts +16 -0
  282. package/dist/types/utils/client-generator/write-package.d.ts +6 -0
  283. package/dist/types/utils/clientGenerator.d.ts +2 -37
  284. package/dist/types/utils/crossProjectServerPolicy.d.ts +3 -2
  285. package/dist/types/utils/effect-client-generator/generator.d.ts +10 -0
  286. package/dist/types/utils/effect-client-generator/index.d.ts +4 -0
  287. package/dist/types/utils/effect-client-generator/paths.d.ts +5 -0
  288. package/dist/types/utils/effect-client-generator/rendering.d.ts +4 -0
  289. package/dist/types/utils/effect-client-generator/runtime.d.ts +8 -0
  290. package/dist/types/utils/effect-client-generator/types.d.ts +26 -0
  291. package/dist/types/utils/effectClientGenerator.d.ts +2 -41
  292. package/package.json +12 -12
@@ -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 {};
@@ -1,10 +1,3 @@
1
- import type { FileSystem, Path } from 'effect';
2
- import * as Context from 'effect/Context';
3
- import type * as EffectType from 'effect/Effect';
4
- import * as Layer from 'effect/Layer';
5
- import { Etag, HttpPlatform, HttpRouter } from 'effect/unstable/http';
6
- import { type HttpApi, type HttpApiClient, type HttpApiGroup } from 'effect/unstable/httpapi';
7
- import { type Rpc, type RpcGroup } from 'effect/unstable/rpc';
8
1
  export * as Config from 'effect/Config';
9
2
  export * as Effect from 'effect/Effect';
10
3
  export * as Layer from 'effect/Layer';
@@ -16,169 +9,6 @@ export * from 'effect/unstable/httpapi';
16
9
  export { HttpApiBuilder } from 'effect/unstable/httpapi';
17
10
  export * from 'effect/unstable/rpc';
18
11
  export { EFFECT_VALIDATOR_AWARE_FACTORY, isValidatorAwareHandlerFactory, } from './entry-shape';
19
- 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;
20
- export type EffectRuntimeLayer = Layer.Layer<never, never, EffectRuntimeRequirements>;
21
- export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc' | 'msgPack';
22
- export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
23
- export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
24
- group: RpcGroup.RpcGroup<TRpcs>;
25
- layer: TRpcLayer;
26
- path?: `/${string}`;
27
- serialization?: EffectRpcSerialization;
28
- disableTracing?: boolean;
29
- spanPrefix?: string;
30
- spanAttributes?: Record<string, unknown>;
31
- disableFatalDefects?: boolean;
32
- };
33
- export type EffectRpcBffHandlerOptions = Pick<EffectRpcBffDefinition, 'path' | 'serialization' | 'disableTracing' | 'spanPrefix' | 'spanAttributes' | 'disableFatalDefects'>;
34
- type EffectApiPromiseClient<TClient> = {
35
- [GroupName in keyof TClient]: {
36
- [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;
37
- };
38
- };
39
- 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;
40
- export type EffectApiPromiseClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = EffectApiPromiseClient<EffectApiClientFromApi<TApi>>;
41
- export type EffectBffDefinition<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any> = {
42
- api: TApi;
43
- layer: TLayer;
44
- rpc?: EffectRpcBffDefinition<TRpcs>;
45
- dataPlatform?: EffectDataPlatformValidationOptions;
46
- };
47
- export type EffectDataPlatformSelectionValidationOptions = {
48
- maxDepth?: number;
49
- maxFields?: number;
50
- allowedLeafPaths?: string[];
51
- };
52
- export type EffectDataPlatformBatchOptions = {
53
- /**
54
- * Enable network batching endpoint for Effect HttpApi requests.
55
- * Defaults to `true`.
56
- */
57
- enabled?: boolean;
58
- /**
59
- * Batch endpoint path mounted under BFF prefix.
60
- * Defaults to `/_data/batch`.
61
- */
62
- endpoint?: `/${string}`;
63
- /**
64
- * Maximum request items accepted per batch call.
65
- * Defaults to `16`.
66
- */
67
- maxBatchSize?: number;
68
- /**
69
- * Maximum serialized request payload size in bytes.
70
- * Defaults to `65536` (64KiB).
71
- */
72
- maxBatchBytes?: number;
73
- /**
74
- * Client-side micro-batch flush window in milliseconds.
75
- * Server runtime ignores this value and passes it through for codegen.
76
- * Defaults to `8`.
77
- */
78
- flushIntervalMs?: number;
79
- /**
80
- * Maximum per-batch internal request concurrency.
81
- * Defaults to `4`.
82
- */
83
- maxConcurrency?: number;
84
- /**
85
- * Optional timeout per internal request in milliseconds.
86
- * Defaults to `10000`.
87
- */
88
- requestTimeoutMs?: number;
89
- /**
90
- * Allowed HTTP methods for internal batched dispatch.
91
- * Defaults to `['GET']`.
92
- */
93
- allowedMethods?: string[];
94
- };
95
- export type EffectDataPlatformValidationOptions = {
96
- /**
97
- * Enable envelope validation for HttpApi requests.
98
- * Defaults to `true`.
99
- */
100
- enabled?: boolean;
101
- /**
102
- * Require every HttpApi request to include an envelope header.
103
- * Defaults to `false`.
104
- */
105
- requireEnvelope?: boolean;
106
- /**
107
- * Header name used by client/server for the serialized request envelope.
108
- * Defaults to `x-modernjs-data-envelope`.
109
- */
110
- envelopeHeader?: string;
111
- /**
112
- * Optional namespace assertion for envelope validation.
113
- */
114
- expectedNamespace?: string;
115
- /**
116
- * Validate envelope origin against incoming request origin.
117
- * Defaults to `true`.
118
- */
119
- validateOrigin?: boolean;
120
- /**
121
- * Require trace context inside request envelope.
122
- * Defaults to `false`.
123
- */
124
- requireTraceContext?: boolean;
125
- /**
126
- * Selection plan guardrails for server-side validation.
127
- */
128
- selection?: EffectDataPlatformSelectionValidationOptions;
129
- /**
130
- * Network batching gateway configuration.
131
- */
132
- batch?: EffectDataPlatformBatchOptions;
133
- };
134
- /**
135
- * Server-seam request validator applied to every HttpApi request — direct,
136
- * batched (per item) and rpc. Returning a Response short-circuits the
137
- * request; returning `null`/`undefined` lets it through. Used by the effect
138
- * adapter to enforce the cross-project policy at one seam so batched items
139
- * cannot bypass it.
140
- */
141
- export type EffectRequestValidator = (request: Request) => Response | null | undefined;
142
- export type EffectBffHandlerFactory<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
143
- openapi?: EffectBffOpenApiConfig;
144
- rpc?: Partial<EffectRpcBffHandlerOptions>;
145
- dataPlatform?: Partial<EffectDataPlatformValidationOptions>;
146
- validateRequest?: EffectRequestValidator;
147
- }) => ReturnType<typeof createHttpApiHandler>;
148
- export type EffectBffRuntime<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = {
149
- createHandler: EffectBffHandlerFactory<TApi, TLayer>;
150
- client: EffectApiPromiseClientFromApi<TApi>;
151
- };
152
- export type EffectBffOpenApiConfig = boolean | {
153
- path?: string;
154
- };
155
- export type EffectRpcBffHandlerFactory<TRpcs extends Rpc.Any = Rpc.Any> = (options?: Partial<EffectRpcBffHandlerOptions>) => ReturnType<typeof createRpcApiHandler<TRpcs>>;
156
- declare function createRpcApiHandler<TRpcs extends Rpc.Any = Rpc.Any>(options: EffectRpcBffDefinition<TRpcs>): {
157
- readonly handler: (request: globalThis.Request, context?: Context.Context<never> | undefined) => Promise<Response>;
158
- readonly dispose: () => Promise<void>;
159
- };
160
- export declare function defineEffectBff<TApi extends HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any>(definition: {
161
- api: TApi;
162
- layer: TLayer;
163
- rpc?: EffectRpcBffDefinition<TRpcs>;
164
- dataPlatform?: EffectDataPlatformValidationOptions;
165
- }): {
166
- api: TApi;
167
- layer: TLayer;
168
- rpc?: EffectRpcBffDefinition<TRpcs>;
169
- dataPlatform?: EffectDataPlatformValidationOptions;
170
- } & EffectBffRuntime<TApi, TLayer>;
171
- export declare function defineEffectRpcBff<TRpcs extends Rpc.Any = Rpc.Any, TLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>>(definition: EffectRpcBffDefinition<TRpcs, TLayer>): EffectRpcBffDefinition<TRpcs, TLayer> & {
172
- createHandler: EffectRpcBffHandlerFactory<TRpcs>;
173
- };
174
- export declare function createHttpApiHandler<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TRpcs extends Rpc.Any = Rpc.Any>(options: {
175
- api: TApi;
176
- layer: EffectRuntimeLayer;
177
- openapi?: EffectBffOpenApiConfig;
178
- rpc?: EffectRpcBffDefinition<TRpcs>;
179
- dataPlatform?: EffectDataPlatformValidationOptions;
180
- validateRequest?: EffectRequestValidator;
181
- }): {
182
- handler: (request: Request, context?: Parameters<(request: globalThis.Request, context: Context.Context<unknown>) => Promise<Response>>[1]) => Promise<Response>;
183
- dispose: () => Promise<void>;
184
- };
12
+ export { defineEffectBff, defineEffectRpcBff } from './handler/definition';
13
+ export { createHttpApiHandler } from './handler/http';
14
+ export type { EffectApiClientFromApi, EffectApiPromiseClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler/types';
@@ -0,0 +1,3 @@
1
+ import { RpcSerialization } from 'effect/unstable/rpc';
2
+ import type { EffectRpcSerialization } from './handler/types';
3
+ export declare function getRpcSerializationLayer(serialization: EffectRpcSerialization | undefined): import("effect/Layer").Layer<RpcSerialization.RpcSerialization, never, never>;
@@ -0,0 +1,2 @@
1
+ import type { EffectRequestRuntime, GeneratedEffectClientConfig } from './types';
2
+ export declare const configureGeneratedEffectClientRuntime: (config: GeneratedEffectClientConfig, configureRequest: EffectRequestRuntime['configure'] | undefined) => void;
@@ -0,0 +1,15 @@
1
+ import type { EffectOperationDescriptor, EffectRequestContext, EffectRequestContextInput, GeneratedEffectClientConfig, GeneratedEffectEndpoint } from './types';
2
+ /**
3
+ * Resolves the current page origin with a configurable fallback. Single
4
+ * implementation shared by the configure() bootstrap and the data envelope
5
+ * (the generated template previously duplicated data-platform's
6
+ * `resolveRuntimeOrigin` with a different fallback).
7
+ */
8
+ export declare const resolveOrigin: (defaultOrigin: string) => string;
9
+ export declare const prepareEffectRequest: (options: {
10
+ endpoint: GeneratedEffectEndpoint;
11
+ operation: EffectOperationDescriptor;
12
+ request: unknown;
13
+ config: GeneratedEffectClientConfig;
14
+ createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
15
+ }) => Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
2
+ export declare const stringOrUndefined: (value: unknown) => string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { EffectRequestContext, EffectRequestContextInput, EffectRequestRuntime } from './types';
2
+ export declare const createEffectRequestContext: (createRequestContextHeaders: EffectRequestRuntime['createRequestContextHeaders'], requestContext: EffectRequestContextInput) => EffectRequestContext;
3
+ export declare const applyRequestContext: (normalizedRequest: Record<string, unknown>, request: unknown, createRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext) => Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export declare const normalizeRequest: (method: string, request: unknown) => Record<string, unknown>;
@@ -1,71 +1,5 @@
1
- export type GeneratedEffectEndpoint = {
2
- apiId: string;
3
- group: string;
4
- endpoint: string;
5
- method: string;
6
- routePath: string;
7
- /** Per-endpoint operation contract hash (bff-core hash). */
8
- schemaHash: string;
9
- operationVersion: number;
10
- };
11
- export type GeneratedEffectBatchConfig = {
12
- enabled: boolean;
13
- endpoint: string;
14
- flushIntervalMs: number;
15
- maxBatchSize: number;
16
- maxBatchBytes: number;
17
- requestTimeoutMs: number;
18
- allowedMethods: string[];
19
- };
20
- export type GeneratedEffectClientConfig = {
21
- appNamespace: string;
22
- /** Cross-project producer id; absent for same-project clients. */
23
- requestId?: string;
24
- port: number;
25
- /** Resolve the port from process.env.PORT first (server bundles). */
26
- useEnvPort?: boolean;
27
- defaultOrigin: string;
28
- httpMethodDecider?: string;
29
- batch: GeneratedEffectBatchConfig;
30
- };
31
- export type EffectOperationDescriptor = {
32
- appNamespace: string;
33
- apiId: string;
34
- group: string;
35
- endpoint: string;
36
- operationId: string;
37
- routePath: string;
38
- method: string;
39
- operationVersion: number;
40
- schemaHash: string;
41
- version: number;
42
- };
43
- export type EffectClientOperation = (request?: unknown) => Promise<unknown>;
44
- export type EffectClientGroup = Record<string, EffectClientOperation>;
45
- export type EffectClient = Record<string, EffectClientGroup>;
46
- export type EffectOperationManifest = Record<string, Record<string, EffectOperationDescriptor>>;
47
- export type EffectRequestContextInput = Record<string, unknown>;
48
- export type EffectRequestContext = {
49
- headers: Record<string, string>;
50
- } & Record<string, unknown>;
51
- /** Structural slice of `@modern-js/create-request` the runtime relies on. */
52
- export type EffectRequestRuntime = {
53
- createRequest: (options: {
54
- path: string;
55
- method: string;
56
- port: number | string;
57
- operationContext: Record<string, unknown>;
58
- httpMethodDecider: string;
59
- requestId?: string;
60
- }) => (...args: unknown[]) => Promise<unknown>;
61
- configure?: (options: Record<string, unknown>) => void;
62
- createRequestContextHeaders?: (input: EffectRequestContextInput) => Record<string, string>;
63
- };
64
- export type GeneratedEffectClientModule = {
65
- client: EffectClient;
66
- operationManifest: EffectOperationManifest;
67
- createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
68
- };
1
+ import type { EffectRequestRuntime, GeneratedEffectClientConfig, GeneratedEffectClientModule, GeneratedEffectEndpoint } from './types';
2
+ export type { EffectClient, EffectClientGroup, EffectClientOperation, EffectOperationDescriptor, EffectOperationManifest, EffectRequestContext, EffectRequestContextInput, EffectRequestRuntime, GeneratedEffectBatchConfig, GeneratedEffectClientConfig, GeneratedEffectClientModule, GeneratedEffectEndpoint, } from './types';
69
3
  export declare const createGeneratedEffectClient: (manifest: {
70
4
  endpoints: GeneratedEffectEndpoint[];
71
5
  }, config: GeneratedEffectClientConfig, requestRuntime: EffectRequestRuntime) => GeneratedEffectClientModule;
@@ -0,0 +1,68 @@
1
+ export type GeneratedEffectEndpoint = {
2
+ apiId: string;
3
+ group: string;
4
+ endpoint: string;
5
+ method: string;
6
+ routePath: string;
7
+ /** Per-endpoint operation contract hash (bff-core hash). */
8
+ schemaHash: string;
9
+ operationVersion: number;
10
+ };
11
+ export type GeneratedEffectBatchConfig = {
12
+ enabled: boolean;
13
+ endpoint: string;
14
+ flushIntervalMs: number;
15
+ maxBatchSize: number;
16
+ maxBatchBytes: number;
17
+ requestTimeoutMs: number;
18
+ allowedMethods: string[];
19
+ };
20
+ export type GeneratedEffectClientConfig = {
21
+ appNamespace: string;
22
+ /** Cross-project producer id; absent for same-project clients. */
23
+ requestId?: string;
24
+ port: number;
25
+ /** Resolve the port from process.env.PORT first (server bundles). */
26
+ useEnvPort?: boolean;
27
+ defaultOrigin: string;
28
+ httpMethodDecider?: string;
29
+ batch: GeneratedEffectBatchConfig;
30
+ };
31
+ export type EffectOperationDescriptor = {
32
+ appNamespace: string;
33
+ apiId: string;
34
+ group: string;
35
+ endpoint: string;
36
+ operationId: string;
37
+ routePath: string;
38
+ method: string;
39
+ operationVersion: number;
40
+ schemaHash: string;
41
+ version: number;
42
+ };
43
+ export type EffectClientOperation = (request?: unknown) => Promise<unknown>;
44
+ export type EffectClientGroup = Record<string, EffectClientOperation>;
45
+ export type EffectClient = Record<string, EffectClientGroup>;
46
+ export type EffectOperationManifest = Record<string, Record<string, EffectOperationDescriptor>>;
47
+ export type EffectRequestContextInput = Record<string, unknown>;
48
+ export type EffectRequestContext = {
49
+ headers: Record<string, string>;
50
+ } & Record<string, unknown>;
51
+ /** Structural slice of `@modern-js/create-request` the runtime relies on. */
52
+ export type EffectRequestRuntime = {
53
+ createRequest: (options: {
54
+ path: string;
55
+ method: string;
56
+ port: number | string;
57
+ operationContext: Record<string, unknown>;
58
+ httpMethodDecider: string;
59
+ requestId?: string;
60
+ }) => (...args: unknown[]) => Promise<unknown>;
61
+ configure?: (options: Record<string, unknown>) => void;
62
+ createRequestContextHeaders?: (input: EffectRequestContextInput) => Record<string, string>;
63
+ };
64
+ export type GeneratedEffectClientModule = {
65
+ client: EffectClient;
66
+ operationManifest: EffectOperationManifest;
67
+ createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
68
+ };
@@ -0,0 +1,28 @@
1
+ export interface FileDetails {
2
+ resourcePath: string;
3
+ source: string;
4
+ targetDir: string;
5
+ name: string;
6
+ absTargetDir: string;
7
+ relativeTargetDistDir: string;
8
+ exportKey: string;
9
+ }
10
+ export declare const API_DIR = "api";
11
+ export declare const PLUGIN_DIR = "plugin";
12
+ export declare const RUNTIME_DIR = "runtime";
13
+ export declare const CLIENT_DIR = "client";
14
+ export declare const EXPORT_PREFIX = "./api/";
15
+ export declare const TYPE_PREFIX = "api/";
16
+ export declare const GENERATED_RUNTIME_DIRS: string[];
17
+ export declare const toPosixPath: (p: string) => string;
18
+ export declare const posixJoin: (...args: string[]) => string;
19
+ export declare function createFileDetails(options: {
20
+ appDirectory: string;
21
+ baseDirectory: string;
22
+ resourcePath: string;
23
+ source: string;
24
+ relativeDistPath: string;
25
+ }): FileDetails;
26
+ export declare function readDirectoryFiles(appDirectory: string, directory: string, relativeDistPath: string): Promise<FileDetails[]>;
27
+ export declare function writeTargetFile(absTargetDir: string, content: string): Promise<void>;
28
+ export declare function copyFiles(from: string, to: string): Promise<void>;
@@ -0,0 +1,26 @@
1
+ import type { HttpMethodDecider } from '@modern-js/types';
2
+ export type APILoaderOptions = {
3
+ prefix: string;
4
+ appDir: string;
5
+ apiDir: string;
6
+ lambdaDir: string;
7
+ existLambda: boolean;
8
+ port?: number;
9
+ requestCreator?: string;
10
+ httpMethodDecider?: HttpMethodDecider;
11
+ relativeDistPath: string;
12
+ relativeApiPath: string;
13
+ bffRuntimeFramework?: 'hono' | 'effect';
14
+ effectEntry?: string;
15
+ effectDataPlatformBatch?: {
16
+ enabled?: boolean;
17
+ endpoint?: string;
18
+ flushIntervalMs?: number;
19
+ maxBatchSize?: number;
20
+ maxBatchBytes?: number;
21
+ requestTimeoutMs?: number;
22
+ allowedMethods?: string[];
23
+ };
24
+ };
25
+ export declare function clientGenerator(draftOptions: APILoaderOptions): Promise<void>;
26
+ export default clientGenerator;
@@ -0,0 +1,7 @@
1
+ export type { FileDetails } from './files';
2
+ export { copyFiles, createFileDetails, readDirectoryFiles, writeTargetFile, } from './files';
3
+ export type { APILoaderOptions } from './generate';
4
+ export { clientGenerator, default } from './generate';
5
+ export type { PackageJsonLike } from './package-json';
6
+ export { getClientPackageName, getPackageName, mergePackageJson, } from './package-json';
7
+ export { setPackage, writeClientModuleBoundary } from './write-package';
@@ -0,0 +1,16 @@
1
+ export type PackageJsonLike = {
2
+ files?: string[];
3
+ typesVersions?: Record<string, Record<string, string[]>>;
4
+ exports?: Record<string, {
5
+ import?: string;
6
+ require?: string;
7
+ types?: string;
8
+ }>;
9
+ };
10
+ export declare function getPackageName(appDirectory: string): string | undefined;
11
+ export declare function mergePackageJson(packageJson: PackageJsonLike, files: string[], typesVersion: Record<string, Record<string, string[]>>, exports: Record<string, {
12
+ import?: string;
13
+ require?: string;
14
+ types?: string;
15
+ }>, relativeDistPath: string): void;
16
+ export declare function getClientPackageName(appDirectory: string): string;
@@ -0,0 +1,6 @@
1
+ export declare function writeClientModuleBoundary(appDirectory: string, relativeDistPath: string): Promise<void>;
2
+ export declare function setPackage(files: {
3
+ exportKey: string;
4
+ targetDir: string;
5
+ relativeTargetDistDir: string;
6
+ }[], appDirectory: string, relativeDistPath: string): Promise<void>;