@bleedingdev/modern-js-plugin-bff 3.8.2-ultramodern.9 → 3.8.3-ultramodern.2

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 (348) hide show
  1. package/dist/cjs/cli/generator.js +45 -53
  2. package/dist/cjs/cli/serverGlobalVars.js +1 -1
  3. package/dist/cjs/cli.js +1 -0
  4. package/dist/cjs/loader.js +7 -18
  5. package/dist/cjs/runtime/data-platform/index.js +32 -94
  6. package/dist/cjs/runtime/effect/edge-dispatcher.js +5 -91
  7. package/dist/cjs/runtime/effect/edge.js +11 -45
  8. package/dist/cjs/runtime/effect/index.js +173 -55
  9. package/dist/cjs/runtime/effect-client/index.js +32 -166
  10. package/dist/cjs/runtime/effect-client/runtime.js +32 -70
  11. package/dist/cjs/runtime/hono/adapter.js +13 -54
  12. package/dist/cjs/server.js +2 -2
  13. package/dist/cjs/utils/client-generator/generate.js +11 -8
  14. package/dist/cjs/utils/client-generator/index.js +0 -3
  15. package/dist/cjs/utils/client-generator/type-facade.js +16 -10
  16. package/dist/cjs/utils/crossProjectApiPlugin.js +5 -1
  17. package/dist/cjs/utils/pluginGenerator.js +4 -4
  18. package/dist/cjs/utils/runtimeGenerator.js +4 -16
  19. package/dist/esm/cli/generator.mjs +45 -53
  20. package/dist/esm/cli/serverGlobalVars.mjs +1 -1
  21. package/dist/esm/cli.mjs +1 -0
  22. package/dist/esm/loader.mjs +5 -16
  23. package/dist/esm/runtime/data-platform/index.mjs +1 -7
  24. package/dist/esm/runtime/effect/edge-dispatcher.mjs +1 -38
  25. package/dist/esm/runtime/effect/edge.mjs +2 -2
  26. package/dist/esm/runtime/effect/index.mjs +16 -8
  27. package/dist/esm/runtime/effect-client/index.mjs +1 -98
  28. package/dist/esm/runtime/effect-client/runtime.mjs +1 -62
  29. package/dist/esm/runtime/hono/adapter.mjs +13 -54
  30. package/dist/esm/server.mjs +2 -2
  31. package/dist/esm/utils/client-generator/generate.mjs +11 -8
  32. package/dist/esm/utils/client-generator/index.mjs +1 -1
  33. package/dist/esm/utils/client-generator/type-facade.mjs +9 -6
  34. package/dist/esm/utils/crossProjectApiPlugin.mjs +3 -2
  35. package/dist/esm/utils/pluginGenerator.mjs +5 -5
  36. package/dist/esm/utils/runtimeGenerator.mjs +4 -16
  37. package/dist/esm-node/cli/generator.mjs +45 -53
  38. package/dist/esm-node/cli/serverGlobalVars.mjs +1 -1
  39. package/dist/esm-node/cli.mjs +1 -0
  40. package/dist/esm-node/loader.mjs +5 -16
  41. package/dist/esm-node/runtime/data-platform/index.mjs +1 -7
  42. package/dist/esm-node/runtime/effect/edge-dispatcher.mjs +1 -38
  43. package/dist/esm-node/runtime/effect/edge.mjs +2 -2
  44. package/dist/esm-node/runtime/effect/index.mjs +16 -8
  45. package/dist/esm-node/runtime/effect-client/index.mjs +1 -98
  46. package/dist/esm-node/runtime/effect-client/runtime.mjs +1 -62
  47. package/dist/esm-node/runtime/hono/adapter.mjs +13 -54
  48. package/dist/esm-node/server.mjs +2 -2
  49. package/dist/esm-node/utils/client-generator/generate.mjs +11 -8
  50. package/dist/esm-node/utils/client-generator/index.mjs +1 -1
  51. package/dist/esm-node/utils/client-generator/type-facade.mjs +9 -6
  52. package/dist/esm-node/utils/crossProjectApiPlugin.mjs +3 -2
  53. package/dist/esm-node/utils/pluginGenerator.mjs +5 -5
  54. package/dist/esm-node/utils/runtimeGenerator.mjs +4 -16
  55. package/dist/types/loader.d.ts +1 -0
  56. package/dist/types/runtime/data-platform/index.d.ts +1 -8
  57. package/dist/types/runtime/effect/edge-dispatcher.d.ts +1 -26
  58. package/dist/types/runtime/effect/edge.d.ts +2 -2
  59. package/dist/types/runtime/effect/index.d.ts +15 -7
  60. package/dist/types/runtime/effect-client/index.d.ts +1 -58
  61. package/dist/types/runtime/effect-client/runtime.d.ts +1 -5
  62. package/dist/types/runtime/hono/adapter.d.ts +1 -11
  63. package/dist/types/utils/client-generator/generate.d.ts +2 -1
  64. package/dist/types/utils/client-generator/index.d.ts +1 -1
  65. package/dist/types/utils/client-generator/type-facade.d.ts +2 -12
  66. package/dist/types/utils/crossProjectApiPlugin.d.ts +1 -0
  67. package/dist/types/utils/pluginGenerator.d.ts +2 -1
  68. package/package.json +34 -33
  69. package/dist/cjs/runtime/data-platform/batch/queue.js +0 -284
  70. package/dist/cjs/runtime/data-platform/batch/request.js +0 -98
  71. package/dist/cjs/runtime/data-platform/batch/response.js +0 -64
  72. package/dist/cjs/runtime/data-platform/batch/telemetry.js +0 -67
  73. package/dist/cjs/runtime/data-platform/batch/url.js +0 -69
  74. package/dist/cjs/runtime/data-platform/batch-transport.js +0 -59
  75. package/dist/cjs/runtime/data-platform/codec.js +0 -155
  76. package/dist/cjs/runtime/data-platform/invalidation.js +0 -61
  77. package/dist/cjs/runtime/data-platform/trace.js +0 -73
  78. package/dist/cjs/runtime/data-platform/types.js +0 -48
  79. package/dist/cjs/runtime/data-platform/validation.js +0 -178
  80. package/dist/cjs/runtime/effect/adapter/constants.js +0 -44
  81. package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +0 -66
  82. package/dist/cjs/runtime/effect/adapter/entry.js +0 -100
  83. package/dist/cjs/runtime/effect/adapter/error-response.js +0 -81
  84. package/dist/cjs/runtime/effect/adapter/handler.js +0 -53
  85. package/dist/cjs/runtime/effect/adapter.js +0 -155
  86. package/dist/cjs/runtime/effect/backend-federation/entry.js +0 -99
  87. package/dist/cjs/runtime/effect/backend-federation/identity.js +0 -82
  88. package/dist/cjs/runtime/effect/backend-federation/load.js +0 -75
  89. package/dist/cjs/runtime/effect/backend-federation/plugin.js +0 -63
  90. package/dist/cjs/runtime/effect/backend-federation/remotes.js +0 -51
  91. package/dist/cjs/runtime/effect/backend-federation/runtime.js +0 -128
  92. package/dist/cjs/runtime/effect/backend-federation/types.js +0 -18
  93. package/dist/cjs/runtime/effect/backend-federation/utils.js +0 -48
  94. package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +0 -83
  95. package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +0 -55
  96. package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +0 -94
  97. package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +0 -101
  98. package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +0 -120
  99. package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +0 -68
  100. package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +0 -18
  101. package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +0 -109
  102. package/dist/cjs/runtime/effect/backend-federation-manifest.js +0 -62
  103. package/dist/cjs/runtime/effect/backend-federation.js +0 -65
  104. package/dist/cjs/runtime/effect/context.js +0 -60
  105. package/dist/cjs/runtime/effect/dispatch.js +0 -101
  106. package/dist/cjs/runtime/effect/edge-context.js +0 -81
  107. package/dist/cjs/runtime/effect/endpoint-contracts.js +0 -121
  108. package/dist/cjs/runtime/effect/entry-shape.js +0 -84
  109. package/dist/cjs/runtime/effect/handler/batch-handler.js +0 -161
  110. package/dist/cjs/runtime/effect/handler/batch.js +0 -159
  111. package/dist/cjs/runtime/effect/handler/definition.js +0 -102
  112. package/dist/cjs/runtime/effect/handler/envelope.js +0 -104
  113. package/dist/cjs/runtime/effect/handler/http.js +0 -107
  114. package/dist/cjs/runtime/effect/handler/openapi.js +0 -57
  115. package/dist/cjs/runtime/effect/handler/routing.js +0 -100
  116. package/dist/cjs/runtime/effect/handler/rpc.js +0 -63
  117. package/dist/cjs/runtime/effect/handler/types.js +0 -43
  118. package/dist/cjs/runtime/effect/handler.js +0 -189
  119. package/dist/cjs/runtime/effect/module.js +0 -113
  120. package/dist/cjs/runtime/effect/operation-context.js +0 -103
  121. package/dist/cjs/runtime/effect/rpcSerialization.js +0 -54
  122. package/dist/cjs/runtime/effect-client/batch.js +0 -73
  123. package/dist/cjs/runtime/effect-client/envelope.js +0 -145
  124. package/dist/cjs/runtime/effect-client/guards.js +0 -44
  125. package/dist/cjs/runtime/effect-client/request-context.js +0 -64
  126. package/dist/cjs/runtime/effect-client/request.js +0 -66
  127. package/dist/cjs/runtime/effect-client/types.js +0 -18
  128. package/dist/cjs/runtime/safe-failure.js +0 -84
  129. package/dist/cjs/utils/crossProjectServerPolicy.js +0 -98
  130. package/dist/cjs/utils/effect-client-generator/generator.js +0 -69
  131. package/dist/cjs/utils/effect-client-generator/index.js +0 -51
  132. package/dist/cjs/utils/effect-client-generator/paths.js +0 -62
  133. package/dist/cjs/utils/effect-client-generator/rendering.js +0 -220
  134. package/dist/cjs/utils/effect-client-generator/runtime.js +0 -68
  135. package/dist/cjs/utils/effect-client-generator/types.js +0 -18
  136. package/dist/cjs/utils/effectClientGenerator.js +0 -49
  137. package/dist/cjs/utils/effectSourceLoader.js +0 -312
  138. package/dist/cjs/utils/headers.js +0 -46
  139. package/dist/esm/runtime/data-platform/batch/queue.mjs +0 -246
  140. package/dist/esm/runtime/data-platform/batch/request.mjs +0 -45
  141. package/dist/esm/runtime/data-platform/batch/response.mjs +0 -23
  142. package/dist/esm/runtime/data-platform/batch/telemetry.mjs +0 -23
  143. package/dist/esm/runtime/data-platform/batch/url.mjs +0 -25
  144. package/dist/esm/runtime/data-platform/batch-transport.mjs +0 -12
  145. package/dist/esm/runtime/data-platform/codec.mjs +0 -90
  146. package/dist/esm/runtime/data-platform/invalidation.mjs +0 -20
  147. package/dist/esm/runtime/data-platform/trace.mjs +0 -29
  148. package/dist/esm/runtime/data-platform/types.mjs +0 -4
  149. package/dist/esm/runtime/data-platform/validation.mjs +0 -128
  150. package/dist/esm/runtime/effect/adapter/constants.mjs +0 -6
  151. package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +0 -28
  152. package/dist/esm/runtime/effect/adapter/entry.mjs +0 -52
  153. package/dist/esm/runtime/effect/adapter/error-response.mjs +0 -43
  154. package/dist/esm/runtime/effect/adapter/handler.mjs +0 -15
  155. package/dist/esm/runtime/effect/adapter.mjs +0 -107
  156. package/dist/esm/runtime/effect/backend-federation/entry.mjs +0 -61
  157. package/dist/esm/runtime/effect/backend-federation/identity.mjs +0 -41
  158. package/dist/esm/runtime/effect/backend-federation/load.mjs +0 -37
  159. package/dist/esm/runtime/effect/backend-federation/plugin.mjs +0 -25
  160. package/dist/esm/runtime/effect/backend-federation/remotes.mjs +0 -13
  161. package/dist/esm/runtime/effect/backend-federation/runtime.mjs +0 -90
  162. package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
  163. package/dist/esm/runtime/effect/backend-federation/utils.mjs +0 -7
  164. package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +0 -32
  165. package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +0 -4
  166. package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +0 -56
  167. package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +0 -42
  168. package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +0 -76
  169. package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +0 -30
  170. package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
  171. package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +0 -65
  172. package/dist/esm/runtime/effect/backend-federation-manifest.mjs +0 -1
  173. package/dist/esm/runtime/effect/backend-federation.mjs +0 -5
  174. package/dist/esm/runtime/effect/context.mjs +0 -13
  175. package/dist/esm/runtime/effect/dispatch.mjs +0 -63
  176. package/dist/esm/runtime/effect/edge-context.mjs +0 -34
  177. package/dist/esm/runtime/effect/endpoint-contracts.mjs +0 -68
  178. package/dist/esm/runtime/effect/entry-shape.mjs +0 -36
  179. package/dist/esm/runtime/effect/handler/batch-handler.mjs +0 -123
  180. package/dist/esm/runtime/effect/handler/batch.mjs +0 -97
  181. package/dist/esm/runtime/effect/handler/definition.mjs +0 -61
  182. package/dist/esm/runtime/effect/handler/envelope.mjs +0 -63
  183. package/dist/esm/runtime/effect/handler/http.mjs +0 -69
  184. package/dist/esm/runtime/effect/handler/openapi.mjs +0 -19
  185. package/dist/esm/runtime/effect/handler/routing.mjs +0 -50
  186. package/dist/esm/runtime/effect/handler/rpc.mjs +0 -22
  187. package/dist/esm/runtime/effect/handler/types.mjs +0 -5
  188. package/dist/esm/runtime/effect/handler.mjs +0 -14
  189. package/dist/esm/runtime/effect/module.mjs +0 -75
  190. package/dist/esm/runtime/effect/operation-context.mjs +0 -65
  191. package/dist/esm/runtime/effect/rpcSerialization.mjs +0 -16
  192. package/dist/esm/runtime/effect-client/batch.mjs +0 -35
  193. package/dist/esm/runtime/effect-client/envelope.mjs +0 -104
  194. package/dist/esm/runtime/effect-client/guards.mjs +0 -3
  195. package/dist/esm/runtime/effect-client/request-context.mjs +0 -23
  196. package/dist/esm/runtime/effect-client/request.mjs +0 -28
  197. package/dist/esm/runtime/effect-client/types.mjs +0 -0
  198. package/dist/esm/runtime/safe-failure.mjs +0 -46
  199. package/dist/esm/utils/crossProjectServerPolicy.mjs +0 -44
  200. package/dist/esm/utils/effect-client-generator/generator.mjs +0 -28
  201. package/dist/esm/utils/effect-client-generator/index.mjs +0 -3
  202. package/dist/esm/utils/effect-client-generator/paths.mjs +0 -24
  203. package/dist/esm/utils/effect-client-generator/rendering.mjs +0 -179
  204. package/dist/esm/utils/effect-client-generator/runtime.mjs +0 -27
  205. package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
  206. package/dist/esm/utils/effectClientGenerator.mjs +0 -1
  207. package/dist/esm/utils/effectSourceLoader.mjs +0 -256
  208. package/dist/esm/utils/headers.mjs +0 -8
  209. package/dist/esm-node/runtime/data-platform/batch/queue.mjs +0 -247
  210. package/dist/esm-node/runtime/data-platform/batch/request.mjs +0 -46
  211. package/dist/esm-node/runtime/data-platform/batch/response.mjs +0 -24
  212. package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +0 -24
  213. package/dist/esm-node/runtime/data-platform/batch/url.mjs +0 -26
  214. package/dist/esm-node/runtime/data-platform/batch-transport.mjs +0 -13
  215. package/dist/esm-node/runtime/data-platform/codec.mjs +0 -91
  216. package/dist/esm-node/runtime/data-platform/invalidation.mjs +0 -21
  217. package/dist/esm-node/runtime/data-platform/trace.mjs +0 -30
  218. package/dist/esm-node/runtime/data-platform/types.mjs +0 -5
  219. package/dist/esm-node/runtime/data-platform/validation.mjs +0 -129
  220. package/dist/esm-node/runtime/effect/adapter/constants.mjs +0 -7
  221. package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +0 -29
  222. package/dist/esm-node/runtime/effect/adapter/entry.mjs +0 -53
  223. package/dist/esm-node/runtime/effect/adapter/error-response.mjs +0 -44
  224. package/dist/esm-node/runtime/effect/adapter/handler.mjs +0 -16
  225. package/dist/esm-node/runtime/effect/adapter.mjs +0 -108
  226. package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +0 -62
  227. package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +0 -42
  228. package/dist/esm-node/runtime/effect/backend-federation/load.mjs +0 -38
  229. package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +0 -26
  230. package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +0 -14
  231. package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +0 -91
  232. package/dist/esm-node/runtime/effect/backend-federation/types.mjs +0 -1
  233. package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +0 -8
  234. package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +0 -33
  235. package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +0 -5
  236. package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +0 -57
  237. package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +0 -43
  238. package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +0 -77
  239. package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +0 -31
  240. package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +0 -1
  241. package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +0 -66
  242. package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +0 -2
  243. package/dist/esm-node/runtime/effect/backend-federation.mjs +0 -6
  244. package/dist/esm-node/runtime/effect/context.mjs +0 -14
  245. package/dist/esm-node/runtime/effect/dispatch.mjs +0 -64
  246. package/dist/esm-node/runtime/effect/edge-context.mjs +0 -35
  247. package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +0 -69
  248. package/dist/esm-node/runtime/effect/entry-shape.mjs +0 -37
  249. package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +0 -124
  250. package/dist/esm-node/runtime/effect/handler/batch.mjs +0 -98
  251. package/dist/esm-node/runtime/effect/handler/definition.mjs +0 -62
  252. package/dist/esm-node/runtime/effect/handler/envelope.mjs +0 -64
  253. package/dist/esm-node/runtime/effect/handler/http.mjs +0 -70
  254. package/dist/esm-node/runtime/effect/handler/openapi.mjs +0 -20
  255. package/dist/esm-node/runtime/effect/handler/routing.mjs +0 -51
  256. package/dist/esm-node/runtime/effect/handler/rpc.mjs +0 -23
  257. package/dist/esm-node/runtime/effect/handler/types.mjs +0 -6
  258. package/dist/esm-node/runtime/effect/handler.mjs +0 -15
  259. package/dist/esm-node/runtime/effect/module.mjs +0 -76
  260. package/dist/esm-node/runtime/effect/operation-context.mjs +0 -66
  261. package/dist/esm-node/runtime/effect/rpcSerialization.mjs +0 -17
  262. package/dist/esm-node/runtime/effect-client/batch.mjs +0 -36
  263. package/dist/esm-node/runtime/effect-client/envelope.mjs +0 -105
  264. package/dist/esm-node/runtime/effect-client/guards.mjs +0 -4
  265. package/dist/esm-node/runtime/effect-client/request-context.mjs +0 -24
  266. package/dist/esm-node/runtime/effect-client/request.mjs +0 -29
  267. package/dist/esm-node/runtime/effect-client/types.mjs +0 -1
  268. package/dist/esm-node/runtime/safe-failure.mjs +0 -47
  269. package/dist/esm-node/utils/crossProjectServerPolicy.mjs +0 -46
  270. package/dist/esm-node/utils/effect-client-generator/generator.mjs +0 -29
  271. package/dist/esm-node/utils/effect-client-generator/index.mjs +0 -4
  272. package/dist/esm-node/utils/effect-client-generator/paths.mjs +0 -25
  273. package/dist/esm-node/utils/effect-client-generator/rendering.mjs +0 -180
  274. package/dist/esm-node/utils/effect-client-generator/runtime.mjs +0 -29
  275. package/dist/esm-node/utils/effect-client-generator/types.mjs +0 -1
  276. package/dist/esm-node/utils/effectClientGenerator.mjs +0 -2
  277. package/dist/esm-node/utils/effectSourceLoader.mjs +0 -257
  278. package/dist/esm-node/utils/headers.mjs +0 -9
  279. package/dist/types/runtime/data-platform/batch/queue.d.ts +0 -8
  280. package/dist/types/runtime/data-platform/batch/request.d.ts +0 -13
  281. package/dist/types/runtime/data-platform/batch/response.d.ts +0 -3
  282. package/dist/types/runtime/data-platform/batch/telemetry.d.ts +0 -4
  283. package/dist/types/runtime/data-platform/batch/url.d.ts +0 -4
  284. package/dist/types/runtime/data-platform/batch-transport.d.ts +0 -3
  285. package/dist/types/runtime/data-platform/codec.d.ts +0 -17
  286. package/dist/types/runtime/data-platform/invalidation.d.ts +0 -8
  287. package/dist/types/runtime/data-platform/trace.d.ts +0 -4
  288. package/dist/types/runtime/data-platform/types.d.ts +0 -146
  289. package/dist/types/runtime/data-platform/validation.d.ts +0 -29
  290. package/dist/types/runtime/effect/adapter/constants.d.ts +0 -1
  291. package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +0 -4
  292. package/dist/types/runtime/effect/adapter/entry.d.ts +0 -2
  293. package/dist/types/runtime/effect/adapter/error-response.d.ts +0 -2
  294. package/dist/types/runtime/effect/adapter/handler.d.ts +0 -7
  295. package/dist/types/runtime/effect/adapter.d.ts +0 -22
  296. package/dist/types/runtime/effect/backend-federation/entry.d.ts +0 -2
  297. package/dist/types/runtime/effect/backend-federation/identity.d.ts +0 -30
  298. package/dist/types/runtime/effect/backend-federation/load.d.ts +0 -13
  299. package/dist/types/runtime/effect/backend-federation/plugin.d.ts +0 -3
  300. package/dist/types/runtime/effect/backend-federation/remotes.d.ts +0 -2
  301. package/dist/types/runtime/effect/backend-federation/runtime.d.ts +0 -3
  302. package/dist/types/runtime/effect/backend-federation/types.d.ts +0 -73
  303. package/dist/types/runtime/effect/backend-federation/utils.d.ts +0 -2
  304. package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +0 -11
  305. package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +0 -6
  306. package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +0 -3
  307. package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +0 -18
  308. package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +0 -4
  309. package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +0 -3
  310. package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +0 -51
  311. package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +0 -5
  312. package/dist/types/runtime/effect/backend-federation-manifest.d.ts +0 -1
  313. package/dist/types/runtime/effect/backend-federation.d.ts +0 -7
  314. package/dist/types/runtime/effect/context.d.ts +0 -5
  315. package/dist/types/runtime/effect/dispatch.d.ts +0 -13
  316. package/dist/types/runtime/effect/edge-context.d.ts +0 -5
  317. package/dist/types/runtime/effect/endpoint-contracts.d.ts +0 -66
  318. package/dist/types/runtime/effect/entry-shape.d.ts +0 -31
  319. package/dist/types/runtime/effect/handler/batch-handler.d.ts +0 -11
  320. package/dist/types/runtime/effect/handler/batch.d.ts +0 -13
  321. package/dist/types/runtime/effect/handler/definition.d.ts +0 -7
  322. package/dist/types/runtime/effect/handler/envelope.d.ts +0 -13
  323. package/dist/types/runtime/effect/handler/http.d.ts +0 -15
  324. package/dist/types/runtime/effect/handler/openapi.d.ts +0 -4
  325. package/dist/types/runtime/effect/handler/routing.d.ts +0 -5
  326. package/dist/types/runtime/effect/handler/rpc.d.ts +0 -7
  327. package/dist/types/runtime/effect/handler/types.d.ts +0 -153
  328. package/dist/types/runtime/effect/handler.d.ts +0 -14
  329. package/dist/types/runtime/effect/module.d.ts +0 -36
  330. package/dist/types/runtime/effect/operation-context.d.ts +0 -10
  331. package/dist/types/runtime/effect/rpcSerialization.d.ts +0 -3
  332. package/dist/types/runtime/effect-client/batch.d.ts +0 -2
  333. package/dist/types/runtime/effect-client/envelope.d.ts +0 -15
  334. package/dist/types/runtime/effect-client/guards.d.ts +0 -2
  335. package/dist/types/runtime/effect-client/request-context.d.ts +0 -3
  336. package/dist/types/runtime/effect-client/request.d.ts +0 -1
  337. package/dist/types/runtime/effect-client/types.d.ts +0 -68
  338. package/dist/types/runtime/safe-failure.d.ts +0 -1
  339. package/dist/types/utils/crossProjectServerPolicy.d.ts +0 -36
  340. package/dist/types/utils/effect-client-generator/generator.d.ts +0 -10
  341. package/dist/types/utils/effect-client-generator/index.d.ts +0 -4
  342. package/dist/types/utils/effect-client-generator/paths.d.ts +0 -5
  343. package/dist/types/utils/effect-client-generator/rendering.d.ts +0 -4
  344. package/dist/types/utils/effect-client-generator/runtime.d.ts +0 -12
  345. package/dist/types/utils/effect-client-generator/types.d.ts +0 -27
  346. package/dist/types/utils/effectClientGenerator.d.ts +0 -2
  347. package/dist/types/utils/effectSourceLoader.d.ts +0 -25
  348. package/dist/types/utils/headers.d.ts +0 -1
@@ -1,69 +0,0 @@
1
- import "node:module";
2
- import { createOperationContractHash } from "@modern-js/bff-core";
3
- import { classifyEffectBffEntryModule, isValidatorAwareHandlerFactory } from "./entry-shape.mjs";
4
- function resolveEffectEndpointName(endpoint) {
5
- if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
6
- if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
7
- return '';
8
- }
9
- function ensureLeadingSlash(pathname) {
10
- return pathname.startsWith('/') ? pathname : `/${pathname}`;
11
- }
12
- function normalizeEffectPrefix(prefix) {
13
- if ('/' === prefix) return '';
14
- return ensureLeadingSlash(prefix || '/api');
15
- }
16
- function getEffectRoutePath(prefix, endpointPath) {
17
- const normalizedPrefix = normalizeEffectPrefix(prefix);
18
- const normalizedEndpointPath = ensureLeadingSlash(endpointPath);
19
- const finalEndpointPath = '/' === normalizedEndpointPath ? '' : endpointPath;
20
- if (!normalizedPrefix && !finalEndpointPath) return '/';
21
- return `${normalizedPrefix}${finalEndpointPath || ''}`;
22
- }
23
- function resolveEffectApiId(api) {
24
- const fallback = 'EffectHttpApi';
25
- if ('identifier' in api && 'string' == typeof api.identifier && api.identifier) return api.identifier;
26
- return fallback;
27
- }
28
- function collectEffectEndpoints(reflect, api, prefix) {
29
- const endpoints = [];
30
- const apiId = resolveEffectApiId(api);
31
- reflect(api, {
32
- onGroup: ()=>{},
33
- onEndpoint: ({ group, endpoint })=>{
34
- endpoints.push({
35
- apiId,
36
- groupName: String(group.identifier),
37
- endpointName: resolveEffectEndpointName(endpoint),
38
- method: String(endpoint.method).toUpperCase(),
39
- routePath: getEffectRoutePath(prefix, String(endpoint.path))
40
- });
41
- }
42
- });
43
- return endpoints.sort((a, b)=>{
44
- if (a.groupName === b.groupName) return a.endpointName.localeCompare(b.endpointName);
45
- return a.groupName.localeCompare(b.groupName);
46
- });
47
- }
48
- function toOperationContractSources(endpoints) {
49
- return endpoints.map(createEffectOperationContractSource);
50
- }
51
- function createEffectOperationContractSource(endpoint) {
52
- return {
53
- name: endpoint.endpointName,
54
- httpMethod: endpoint.method,
55
- routePath: endpoint.routePath
56
- };
57
- }
58
- async function extractHttpApiFromModule(mod, isHttpApi) {
59
- const facts = classifyEffectBffEntryModule(mod, {
60
- isRequestHandler: (value)=>'function' == typeof value,
61
- isValidatorAwareHandlerFactory: isValidatorAwareHandlerFactory,
62
- isHttpApi
63
- });
64
- return !facts?.legacyShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
65
- }
66
- function createEffectEndpointContractHash(endpoint, requestId) {
67
- return createOperationContractHash(createEffectOperationContractSource(endpoint), requestId);
68
- }
69
- export { collectEffectEndpoints, createEffectEndpointContractHash, ensureLeadingSlash, extractHttpApiFromModule, normalizeEffectPrefix, toOperationContractSources };
@@ -1,37 +0,0 @@
1
- import "node:module";
2
- const EFFECT_VALIDATOR_AWARE_FACTORY = Symbol.for('modernjs.effect.validatorAware');
3
- function isValidatorAwareHandlerFactory(factory) {
4
- return Boolean('function' == typeof factory && factory[EFFECT_VALIDATOR_AWARE_FACTORY]);
5
- }
6
- 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.';
7
- function isEffectEntryRecord(value) {
8
- return 'object' == typeof value && null !== value;
9
- }
10
- function classifyEffectBffEntryModule(value, predicates) {
11
- if (!isEffectEntryRecord(value)) return null;
12
- const rootModule = value;
13
- if (predicates.isRequestHandler(rootModule.handler)) return createEntryShapeFacts(rootModule, predicates, '`handler` export');
14
- const defaultEntry = rootModule.default;
15
- if (predicates.isRequestHandler(defaultEntry)) return createEntryShapeFacts(rootModule, predicates, 'default request handler');
16
- const module = isEffectEntryRecord(defaultEntry) ? {
17
- ...rootModule,
18
- ...defaultEntry
19
- } : rootModule;
20
- if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
21
- return createEntryShapeFacts(module, predicates);
22
- }
23
- function createEntryShapeFacts(module, predicates, legacyShape) {
24
- const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
25
- const api = predicates.isHttpApi(module.api) ? module.api : void 0;
26
- const hasRuntimeLayer = void 0 !== module.layer;
27
- return {
28
- module,
29
- legacyShape,
30
- createHandler,
31
- createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
32
- api,
33
- layer: module.layer,
34
- hasRuntimeLayer
35
- };
36
- }
37
- export { EFFECT_VALIDATOR_AWARE_FACTORY, classifyEffectBffEntryModule, isValidatorAwareHandlerFactory, strictEffectApproachMessage };
@@ -1,124 +0,0 @@
1
- import "node:module";
2
- import { DEFAULT_DATA_BATCH_HEADER, DEFAULT_DATA_ENVELOPE_HEADER, decodeRequestEnvelopeHeader, isPlainObject, measureTextBytes, normalizeMethod } from "../../data-platform/index.mjs";
3
- import { createBatchValidationResponse, isBatchRequestPayload, mapWithConcurrency, normalizeBatchAllowedMethods, normalizeBatchPath, promiseWithTimeout, toBatchItemError, toHeaderRecord } from "./batch.mjs";
4
- import { getMountedPrefixFromContext, removeMountedPrefixFromBatchPath } from "./routing.mjs";
5
- function createDataPlatformBatchRequestHandler(options) {
6
- const dataPlatformBatchOptions = options.dataPlatform?.batch;
7
- const batchEnabled = dataPlatformBatchOptions?.enabled !== false;
8
- const batchPath = normalizeBatchPath(dataPlatformBatchOptions?.endpoint);
9
- const batchMaxSize = Math.max(1, dataPlatformBatchOptions?.maxBatchSize ?? 16);
10
- const batchMaxBytes = Math.max(1024, dataPlatformBatchOptions?.maxBatchBytes ?? 65536);
11
- const batchConcurrency = Math.max(1, dataPlatformBatchOptions?.maxConcurrency ?? 4);
12
- const batchItemTimeoutMs = Math.max(0, dataPlatformBatchOptions?.requestTimeoutMs ?? 10000);
13
- const batchAllowedMethods = normalizeBatchAllowedMethods(dataPlatformBatchOptions?.allowedMethods);
14
- const envelopeHeader = options.dataPlatform?.envelopeHeader || DEFAULT_DATA_ENVELOPE_HEADER;
15
- const normalizedEnvelopeHeader = envelopeHeader.toLowerCase();
16
- const handle = async (request, context)=>{
17
- const mountedPrefix = getMountedPrefixFromContext(request, context);
18
- const method = normalizeMethod(request.method);
19
- if ('POST' !== method) return createBatchValidationResponse('Batch endpoint only supports POST requests', 405);
20
- const contentType = request.headers.get('content-type') || '';
21
- if (!contentType.includes('application/json')) return createBatchValidationResponse('Batch endpoint requires application/json content-type', 415);
22
- const payloadText = await request.text();
23
- if (measureTextBytes(payloadText) > batchMaxBytes) return createBatchValidationResponse(`Batch payload exceeds max size (${String(batchMaxBytes)} bytes)`, 413);
24
- let payload;
25
- try {
26
- payload = JSON.parse(payloadText);
27
- } catch {
28
- return createBatchValidationResponse('Invalid batch payload JSON');
29
- }
30
- if (!isBatchRequestPayload(payload)) return createBatchValidationResponse('Invalid batch payload shape');
31
- if (0 === payload.items.length) return createBatchValidationResponse('Batch payload items cannot be empty');
32
- if (payload.items.length > batchMaxSize) return createBatchValidationResponse(`Batch item count exceeds max size (${String(batchMaxSize)})`, 413);
33
- const responseItems = await mapWithConcurrency(payload.items, batchConcurrency, async (rawItem, index)=>{
34
- const fallbackId = `item_${String(index)}`;
35
- const itemId = isPlainObject(rawItem) && 'string' == typeof rawItem.id ? rawItem.id : fallbackId;
36
- if (!isPlainObject(rawItem)) return toBatchItemError(itemId, 400, 'Invalid batch item; expected object');
37
- if ('string' != typeof rawItem.path || 0 === rawItem.path.length) return toBatchItemError(itemId, 400, 'Invalid batch item path');
38
- if (!rawItem.path.startsWith('/')) return toBatchItemError(itemId, 400, 'Batch item path must start with "/"');
39
- const normalizedItemPath = removeMountedPrefixFromBatchPath(rawItem.path, mountedPrefix);
40
- const itemPathname = normalizedItemPath.split('?')[0] || normalizedItemPath;
41
- if (itemPathname === batchPath || itemPathname.startsWith(`${batchPath}/`)) return toBatchItemError(itemId, 400, 'Batch item path cannot target batch endpoint');
42
- const itemMethod = normalizeMethod('string' == typeof rawItem.method ? rawItem.method : void 0);
43
- if (!batchAllowedMethods.has(itemMethod)) return toBatchItemError(itemId, 405, `Batch item method ${itemMethod} is not allowed`);
44
- if (void 0 !== rawItem.body && null !== rawItem.body && 'string' != typeof rawItem.body) return toBatchItemError(itemId, 400, 'Batch item body must be a string when provided');
45
- if (('GET' === itemMethod || 'HEAD' === itemMethod) && 'string' == typeof rawItem.body) return toBatchItemError(itemId, 400, `${itemMethod} batch item cannot include body`);
46
- const normalizedHeaders = {};
47
- if (void 0 !== rawItem.headers) {
48
- if (!isPlainObject(rawItem.headers)) return toBatchItemError(itemId, 400, 'Batch item headers must be an object');
49
- for (const [key, value] of Object.entries(rawItem.headers)){
50
- if ('string' != typeof value) return toBatchItemError(itemId, 400, `Invalid header "${key}" for batch item`);
51
- normalizedHeaders[key.toLowerCase()] = value;
52
- }
53
- }
54
- if (!normalizedHeaders.traceparent) {
55
- const encodedEnvelope = normalizedHeaders[normalizedEnvelopeHeader];
56
- if ('string' == typeof encodedEnvelope) {
57
- const envelope = decodeRequestEnvelopeHeader(encodedEnvelope);
58
- if (envelope?.traceparent) normalizedHeaders.traceparent = envelope.traceparent;
59
- }
60
- }
61
- if (!normalizedHeaders.traceparent) {
62
- const requestTraceparent = request.headers.get('traceparent');
63
- if (requestTraceparent) normalizedHeaders.traceparent = requestTraceparent;
64
- }
65
- const targetUrl = new URL(normalizedItemPath, request.url);
66
- const requestHeaders = new Headers(normalizedHeaders);
67
- const body = 'GET' === itemMethod || 'HEAD' === itemMethod ? void 0 : rawItem.body;
68
- if (void 0 === body) requestHeaders.delete('content-type');
69
- const itemRequest = new Request(targetUrl.toString(), {
70
- method: itemMethod,
71
- headers: requestHeaders,
72
- body
73
- });
74
- try {
75
- const itemResponse = await promiseWithTimeout(options.handleItem(itemRequest, context), batchItemTimeoutMs);
76
- if (!(itemResponse instanceof Response)) return toBatchItemError(itemId, 500, 'Invalid response returned by batch item handler');
77
- const bodyText = await itemResponse.text();
78
- const responseItem = {
79
- id: itemId,
80
- status: itemResponse.status,
81
- headers: toHeaderRecord(itemResponse.headers),
82
- ...bodyText ? {
83
- body: bodyText
84
- } : {}
85
- };
86
- return responseItem;
87
- } catch (error) {
88
- if (error instanceof Response) {
89
- const bodyText = await error.text();
90
- return {
91
- id: itemId,
92
- status: error.status,
93
- headers: toHeaderRecord(error.headers),
94
- ...bodyText ? {
95
- body: bodyText
96
- } : {}
97
- };
98
- }
99
- const message = error instanceof Error ? error.message : String(error);
100
- return toBatchItemError(itemId, 500, message);
101
- }
102
- });
103
- const responsePayload = {
104
- protocolVersion: 1,
105
- batchId: payload.batchId,
106
- receivedAt: Date.now(),
107
- items: responseItems
108
- };
109
- return new Response(JSON.stringify(responsePayload), {
110
- status: 200,
111
- headers: {
112
- 'content-type': 'application/json; charset=utf-8',
113
- [DEFAULT_DATA_BATCH_HEADER]: '1',
114
- 'x-modernjs-data-batch-id': payload.batchId
115
- }
116
- });
117
- };
118
- return {
119
- enabled: batchEnabled,
120
- path: batchPath,
121
- handle
122
- };
123
- }
124
- export { createDataPlatformBatchRequestHandler };
@@ -1,98 +0,0 @@
1
- import "node:module";
2
- import { DEFAULT_DATA_BATCH_ENDPOINT, isPlainObject, normalizeMethod } from "../../data-platform/index.mjs";
3
- function normalizeBatchPath(pathname) {
4
- if (!pathname || '/' === pathname) return DEFAULT_DATA_BATCH_ENDPOINT;
5
- if (!pathname.startsWith('/')) return `/${pathname}`;
6
- return pathname;
7
- }
8
- function normalizeBatchAllowedMethods(allowedMethods) {
9
- const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
10
- 'GET'
11
- ];
12
- return new Set(source.map((method)=>method.toUpperCase()));
13
- }
14
- function isBatchRequestPayload(value) {
15
- return isPlainObject(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
16
- }
17
- function createBatchValidationResponse(message, status = 400) {
18
- return new Response(JSON.stringify({
19
- message
20
- }), {
21
- status,
22
- headers: {
23
- 'content-type': 'application/json; charset=utf-8'
24
- }
25
- });
26
- }
27
- function cloneWithoutJsonBodyHeaders(request) {
28
- const headers = new Headers(request.headers);
29
- headers.delete('content-type');
30
- headers.delete('content-length');
31
- return new Request(request.url, {
32
- method: request.method,
33
- headers,
34
- signal: request.signal
35
- });
36
- }
37
- async function prepareJsonRequestBody(request) {
38
- const method = normalizeMethod(request.method);
39
- if ('GET' === method || 'HEAD' === method) return request;
40
- const contentType = (request.headers.get('content-type') || '').toLowerCase();
41
- if (!contentType.includes('application/json')) return request;
42
- if (null === request.body) return cloneWithoutJsonBodyHeaders(request);
43
- try {
44
- const bodyText = await request.clone().text();
45
- if ('' === bodyText) return cloneWithoutJsonBodyHeaders(request);
46
- JSON.parse(bodyText);
47
- } catch {
48
- return createBatchValidationResponse('Invalid JSON request body');
49
- }
50
- return request;
51
- }
52
- function toBatchItemError(id, status, message) {
53
- return {
54
- id,
55
- status,
56
- headers: {
57
- 'content-type': 'application/json; charset=utf-8'
58
- },
59
- body: JSON.stringify({
60
- message
61
- })
62
- };
63
- }
64
- function promiseWithTimeout(effect, timeoutMs) {
65
- if (timeoutMs <= 0) return effect;
66
- return new Promise((resolve, reject)=>{
67
- const timer = setTimeout(()=>{
68
- reject(new Error(`Batch item timeout after ${String(timeoutMs)}ms`));
69
- }, timeoutMs);
70
- effect.then((value)=>{
71
- clearTimeout(timer);
72
- resolve(value);
73
- }, (error)=>{
74
- clearTimeout(timer);
75
- reject(error);
76
- });
77
- });
78
- }
79
- async function mapWithConcurrency(items, concurrency, mapper) {
80
- if (0 === items.length) return [];
81
- const normalizedConcurrency = Math.max(1, concurrency);
82
- const output = new Array(items.length);
83
- let index = 0;
84
- const workers = Array.from({
85
- length: Math.min(normalizedConcurrency, items.length)
86
- }, async ()=>{
87
- while(true){
88
- const currentIndex = index;
89
- index += 1;
90
- if (currentIndex >= items.length) return;
91
- output[currentIndex] = await mapper(items[currentIndex], currentIndex);
92
- }
93
- });
94
- await Promise.all(workers);
95
- return output;
96
- }
97
- export { toHeaderRecord } from "../../../utils/headers.mjs";
98
- export { createBatchValidationResponse, isBatchRequestPayload, mapWithConcurrency, normalizeBatchAllowedMethods, normalizeBatchPath, prepareJsonRequestBody, promiseWithTimeout, toBatchItemError };
@@ -1,62 +0,0 @@
1
- import "node:module";
2
- import { EFFECT_VALIDATOR_AWARE_FACTORY } from "../entry-shape.mjs";
3
- import { mergeDataPlatformOptions } from "./envelope.mjs";
4
- import { createHttpApiHandler } from "./http.mjs";
5
- import { createRpcApiHandler } from "./rpc.mjs";
6
- function defineEffectBff(definition) {
7
- const createHandler = (options)=>{
8
- const rpcDefinition = definition.rpc;
9
- let mergedRpcOptions = rpcDefinition;
10
- if (rpcDefinition && options?.rpc) mergedRpcOptions = {
11
- ...rpcDefinition,
12
- ...options.rpc
13
- };
14
- return createHttpApiHandler({
15
- api: definition.api,
16
- layer: definition.layer,
17
- openapi: options?.openapi,
18
- rpc: mergedRpcOptions,
19
- dataPlatform: mergeDataPlatformOptions(definition.dataPlatform, options?.dataPlatform),
20
- interceptRequest: definition.interceptRequest,
21
- validateRequest: options?.validateRequest
22
- });
23
- };
24
- Object.defineProperty(createHandler, EFFECT_VALIDATOR_AWARE_FACTORY, {
25
- value: true
26
- });
27
- const client = createLoaderMaterializedClientPlaceholder();
28
- return {
29
- ...definition,
30
- createHandler,
31
- client
32
- };
33
- }
34
- const LOADER_CLIENT_IGNORED_KEYS = new Set([
35
- 'then',
36
- 'catch',
37
- 'finally',
38
- 'toJSON',
39
- '$$typeof'
40
- ]);
41
- function createLoaderMaterializedClientPlaceholder() {
42
- const explain = (property)=>{
43
- throw new Error(`[BFF][Effect] client.${String(property)} is not available here: the typed client only exists when the API entry is imported through the "@api/index" transformed path (the BFF loader replaces it with generated client code). On the server, use HttpApiClient or call the Effect layer directly.`);
44
- };
45
- return new Proxy(Object.create(null), {
46
- get (_target, property) {
47
- if ('symbol' == typeof property || LOADER_CLIENT_IGNORED_KEYS.has(property)) return;
48
- return explain(property);
49
- }
50
- });
51
- }
52
- function defineEffectRpcBff(definition) {
53
- const createHandler = (options)=>createRpcApiHandler({
54
- ...definition,
55
- ...options
56
- });
57
- return {
58
- ...definition,
59
- createHandler
60
- };
61
- }
62
- export { defineEffectBff, defineEffectRpcBff };
@@ -1,64 +0,0 @@
1
- import "node:module";
2
- import { DEFAULT_DATA_ENVELOPE_HEADER, decodeRequestEnvelopeHeader, validateRequestEnvelope, validateSelectionPlan } from "../../data-platform/index.mjs";
3
- import { getExpectedEnvelopeOrigin } from "./routing.mjs";
4
- function createInvalidEnvelopeResponse(message, errors) {
5
- return new Response(JSON.stringify({
6
- message,
7
- ...errors && errors.length > 0 ? {
8
- errors
9
- } : {}
10
- }), {
11
- status: 400,
12
- headers: {
13
- 'content-type': 'application/json; charset=utf-8'
14
- }
15
- });
16
- }
17
- function validateDataPlatformRequestEnvelope(request, options) {
18
- const isEnabled = options?.enabled ?? true;
19
- if (!isEnabled) return null;
20
- const envelopeHeader = options?.envelopeHeader || DEFAULT_DATA_ENVELOPE_HEADER;
21
- const encodedEnvelope = request.headers.get(envelopeHeader);
22
- if (!encodedEnvelope) {
23
- if (options?.requireEnvelope) return createInvalidEnvelopeResponse(`Missing required data envelope header: ${envelopeHeader}`);
24
- return null;
25
- }
26
- const envelope = decodeRequestEnvelopeHeader(encodedEnvelope);
27
- if (!envelope) return createInvalidEnvelopeResponse(`Invalid data envelope header format: ${envelopeHeader}`);
28
- const validation = validateRequestEnvelope(envelope, {
29
- expectedProtocolVersion: 1,
30
- expectedNamespace: options?.expectedNamespace,
31
- expectedOrigin: options?.validateOrigin === false ? void 0 : getExpectedEnvelopeOrigin(request),
32
- requireTraceContext: options?.requireTraceContext
33
- });
34
- if (!validation.ok) return createInvalidEnvelopeResponse('Invalid data envelope', validation.errors);
35
- if (envelope.selectionPlan) {
36
- const selectionValidation = validateSelectionPlan(envelope.selectionPlan, {
37
- maxDepth: options?.selection?.maxDepth,
38
- maxFields: options?.selection?.maxFields,
39
- allowedLeafPaths: options?.selection?.allowedLeafPaths
40
- });
41
- if (!selectionValidation.ok) return createInvalidEnvelopeResponse('Invalid data envelope selection plan', selectionValidation.errors);
42
- }
43
- return null;
44
- }
45
- function mergeDataPlatformOptions(base, override) {
46
- if (!base && !override) return;
47
- const baseSelection = base?.selection;
48
- const overrideSelection = override?.selection;
49
- const baseBatch = base?.batch;
50
- const overrideBatch = override?.batch;
51
- return {
52
- ...base,
53
- ...override,
54
- selection: baseSelection || overrideSelection ? {
55
- ...baseSelection,
56
- ...overrideSelection
57
- } : void 0,
58
- batch: baseBatch || overrideBatch ? {
59
- ...baseBatch,
60
- ...overrideBatch
61
- } : void 0
62
- };
63
- }
64
- export { mergeDataPlatformOptions, validateDataPlatformRequestEnvelope };
@@ -1,70 +0,0 @@
1
- import "node:module";
2
- import { HttpRouter, HttpServer } from "effect/unstable/http";
3
- import { prepareJsonRequestBody } from "./batch.mjs";
4
- import { createDataPlatformBatchRequestHandler } from "./batch-handler.mjs";
5
- import { validateDataPlatformRequestEnvelope } from "./envelope.mjs";
6
- import { createOpenApiLayer } from "./openapi.mjs";
7
- import { getRequestPathname, isRpcRequest } from "./routing.mjs";
8
- import { createRpcApiHandler, normalizeRpcPath } from "./rpc.mjs";
9
- import { toEffectServiceContext } from "./types.mjs";
10
- import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
11
- function createHttpApiHandler(options) {
12
- const apiLayer = options.layer.pipe(__rspack_external_effect_Layer_69c46453.provide(HttpServer.layerServices));
13
- const openApiLayer = createOpenApiLayer(options.api, options.openapi);
14
- const mergedLayer = openApiLayer ? __rspack_external_effect_Layer_69c46453.mergeAll(apiLayer, openApiLayer) : apiLayer;
15
- const httpApiHandler = HttpRouter.toWebHandler(mergedLayer);
16
- const dispatchHttpApiRequest = async (request, context)=>{
17
- const preparedRequest = await prepareJsonRequestBody(request);
18
- if (preparedRequest instanceof Response) return preparedRequest;
19
- const validationError = validateDataPlatformRequestEnvelope(preparedRequest, options.dataPlatform);
20
- if (validationError) return validationError;
21
- return httpApiHandler.handler(preparedRequest, toEffectServiceContext(context));
22
- };
23
- const withRequestPolicy = async (request, context)=>{
24
- const policyDenial = options.validateRequest?.(request);
25
- if (policyDenial) return policyDenial;
26
- const next = ()=>dispatchHttpApiRequest(request, context);
27
- return options.interceptRequest ? options.interceptRequest({
28
- request,
29
- next
30
- }) : next();
31
- };
32
- const batchHandler = createDataPlatformBatchRequestHandler({
33
- dataPlatform: options.dataPlatform,
34
- handleItem: withRequestPolicy
35
- });
36
- const handleHttpApiRequest = async (request, context)=>{
37
- const pathname = getRequestPathname(request);
38
- if (batchHandler.enabled && pathname === batchHandler.path) return batchHandler.handle(request, context);
39
- return withRequestPolicy(request, context);
40
- };
41
- if (!options.rpc) return {
42
- handler: handleHttpApiRequest,
43
- dispose: async ()=>{
44
- await httpApiHandler.dispose();
45
- }
46
- };
47
- const rpcPath = normalizeRpcPath(options.rpc.path);
48
- const rpcHandler = createRpcApiHandler(options.rpc);
49
- return {
50
- handler: async (request, context)=>{
51
- if (isRpcRequest(request, rpcPath)) {
52
- const policyDenial = options.validateRequest?.(request);
53
- if (policyDenial) return policyDenial;
54
- const next = ()=>rpcHandler.handler(request, toEffectServiceContext(context));
55
- return options.interceptRequest ? options.interceptRequest({
56
- request,
57
- next
58
- }) : next();
59
- }
60
- return handleHttpApiRequest(request, context);
61
- },
62
- dispose: async ()=>{
63
- await Promise.all([
64
- httpApiHandler.dispose(),
65
- rpcHandler.dispose()
66
- ]);
67
- }
68
- };
69
- }
70
- export { createHttpApiHandler };
@@ -1,20 +0,0 @@
1
- import "node:module";
2
- import { HttpRouter, HttpServerResponse } from "effect/unstable/http";
3
- import { OpenApi } from "effect/unstable/httpapi";
4
- function normalizeOpenApiPath(pathname) {
5
- if (!pathname.startsWith('/')) return `/${pathname}`;
6
- return pathname;
7
- }
8
- function getOpenApiOptions(openapi) {
9
- if (!openapi || 'object' != typeof openapi) return;
10
- if (!openapi.path) return;
11
- return {
12
- path: normalizeOpenApiPath(openapi.path)
13
- };
14
- }
15
- function createOpenApiLayer(api, openapi) {
16
- const openApiOptions = getOpenApiOptions(openapi);
17
- if (!openApiOptions) return null;
18
- return HttpRouter.add('GET', openApiOptions.path, HttpServerResponse.jsonUnsafe(OpenApi.fromApi(api)));
19
- }
20
- export { createOpenApiLayer };
@@ -1,51 +0,0 @@
1
- import "node:module";
2
- import { isPlainObject } from "../../data-platform/index.mjs";
3
- function getRequestPathname(request) {
4
- try {
5
- return new URL(request.url).pathname;
6
- } catch {
7
- return new URL(request.url, 'http://localhost').pathname;
8
- }
9
- }
10
- function normalizeMountPrefix(prefix) {
11
- if (!prefix || '/' === prefix) return '';
12
- return prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
13
- }
14
- function getMountedPrefixFromContext(request, context) {
15
- if (!isPlainObject(context) || 'string' != typeof context.path) return '';
16
- const contextPath = normalizeMountPrefix(context.path);
17
- const requestPath = normalizeMountPrefix(getRequestPathname(request));
18
- if (!contextPath || !requestPath || contextPath === requestPath || !contextPath.endsWith(requestPath)) return '';
19
- return normalizeMountPrefix(contextPath.slice(0, contextPath.length - requestPath.length));
20
- }
21
- function removeMountedPrefixFromBatchPath(pathWithQuery, prefix) {
22
- const normalizedPrefix = normalizeMountPrefix(prefix);
23
- if (!normalizedPrefix) return pathWithQuery;
24
- const [pathname, ...queryParts] = pathWithQuery.split('?');
25
- if (!pathname) return pathWithQuery;
26
- let nextPathname = pathname;
27
- if (pathname === normalizedPrefix) nextPathname = '/';
28
- else if (pathname.startsWith(`${normalizedPrefix}/`)) {
29
- const sliced = pathname.slice(normalizedPrefix.length);
30
- nextPathname = sliced.startsWith('/') ? sliced : `/${sliced}`;
31
- }
32
- if (0 === queryParts.length) return nextPathname;
33
- return `${nextPathname}?${queryParts.join('?')}`;
34
- }
35
- function getRequestOrigin(request) {
36
- try {
37
- return new URL(request.url).origin;
38
- } catch {
39
- return new URL(request.url, 'http://localhost').origin;
40
- }
41
- }
42
- function getExpectedEnvelopeOrigin(request) {
43
- const origin = request.headers.get('origin');
44
- if (origin && 'null' !== origin) return origin;
45
- return getRequestOrigin(request);
46
- }
47
- function isRpcRequest(request, rpcPath) {
48
- const pathname = getRequestPathname(request);
49
- return pathname === rpcPath || pathname.startsWith(`${rpcPath}/`);
50
- }
51
- export { getExpectedEnvelopeOrigin, getMountedPrefixFromContext, getRequestPathname, isRpcRequest, removeMountedPrefixFromBatchPath };
@@ -1,23 +0,0 @@
1
- import "node:module";
2
- import { HttpRouter } from "effect/unstable/http";
3
- import { RpcServer } from "effect/unstable/rpc";
4
- import { getRpcSerializationLayer } from "../rpcSerialization.mjs";
5
- import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
6
- function normalizeRpcPath(pathname) {
7
- if (!pathname || '/' === pathname) return '/rpc';
8
- if (!pathname.startsWith('/')) return `/${pathname}`;
9
- return pathname;
10
- }
11
- function createRpcApiHandler(options) {
12
- const rpcPath = normalizeRpcPath(options.path);
13
- const rpcLayer = __rspack_external_effect_Layer_69c46453.provide(RpcServer.layerHttp({
14
- group: options.group,
15
- path: rpcPath,
16
- protocol: 'http',
17
- disableTracing: options.disableTracing,
18
- spanPrefix: options.spanPrefix,
19
- spanAttributes: options.spanAttributes
20
- }), __rspack_external_effect_Layer_69c46453.mergeAll(options.layer, getRpcSerializationLayer(options.serialization)));
21
- return HttpRouter.toWebHandler(rpcLayer);
22
- }
23
- export { createRpcApiHandler, normalizeRpcPath };
@@ -1,6 +0,0 @@
1
- import "node:module";
2
- import * as __rspack_external_effect_Context_b3520bd3 from "effect/Context";
3
- const emptyEffectServiceContext = __rspack_external_effect_Context_b3520bd3.empty();
4
- const isEffectServiceContext = (context)=>'object' == typeof context && null !== context && 'mapUnsafe' in context;
5
- const toEffectServiceContext = (context)=>isEffectServiceContext(context) ? context : emptyEffectServiceContext;
6
- export { toEffectServiceContext };
@@ -1,15 +0,0 @@
1
- import "node:module";
2
- import * as __rspack_external_effect_Config_76cfa59d from "effect/Config";
3
- import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
4
- import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
5
- import * as __rspack_external_effect_Option_0498e63a from "effect/Option";
6
- import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
7
- export * from "effect/unstable/http";
8
- export * from "effect/unstable/httpapi";
9
- export * from "effect/unstable/rpc";
10
- export { HttpTraceContext } from "effect/unstable/http";
11
- export { HttpApiBuilder } from "effect/unstable/httpapi";
12
- export { EFFECT_VALIDATOR_AWARE_FACTORY, isValidatorAwareHandlerFactory } from "./entry-shape.mjs";
13
- export { defineEffectBff, defineEffectRpcBff } from "./handler/definition.mjs";
14
- export { createHttpApiHandler } from "./handler/http.mjs";
15
- export { __rspack_external_effect_Config_76cfa59d as Config, __rspack_external_effect_Effect_41060786 as Effect, __rspack_external_effect_Layer_69c46453 as Layer, __rspack_external_effect_Option_0498e63a as Option, __rspack_external_effect_Schema_6065f72d as Schema };