@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,81 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- createEffectOperationContext: ()=>external_operation_context_js_namespaceObject.createEffectOperationContext,
32
- runWithEffectContext: ()=>runWithEffectContext,
33
- useEffectContext: ()=>useEffectContext,
34
- useOperationContext: ()=>useOperationContext
35
- });
36
- const external_operation_context_js_namespaceObject = require("./operation-context.js");
37
- const kEffectContext = Symbol.for('modernjs.plugin-bff.edgeEffectContext');
38
- const kEffectContextStorage = Symbol.for('modernjs.plugin-bff.edgeEffectContextStorage');
39
- const globalStore = globalThis;
40
- const isPromiseLike = (value)=>'object' == typeof value && null !== value && 'then' in value && 'function' == typeof value.then;
41
- const getRuntimeStorage = ()=>{
42
- if (globalStore[kEffectContextStorage]) return globalStore[kEffectContextStorage];
43
- if ('function' == typeof globalStore.AsyncLocalStorage) globalStore[kEffectContextStorage] = new globalStore.AsyncLocalStorage();
44
- return globalStore[kEffectContextStorage];
45
- };
46
- const runWithEffectContext = (context, cb)=>{
47
- const storage = getRuntimeStorage();
48
- if (storage) return storage.run(context, cb);
49
- const previous = globalStore[kEffectContext];
50
- globalStore[kEffectContext] = context;
51
- try {
52
- const result = cb();
53
- if (isPromiseLike(result)) return Promise.resolve(result).finally(()=>{
54
- globalStore[kEffectContext] = previous;
55
- });
56
- globalStore[kEffectContext] = previous;
57
- return result;
58
- } catch (error) {
59
- globalStore[kEffectContext] = previous;
60
- throw error;
61
- }
62
- };
63
- const useEffectContext = ()=>{
64
- const context = getRuntimeStorage()?.getStore() ?? globalStore[kEffectContext];
65
- if (!context) throw new Error("Can't call useEffectContext out of Effect runtime scope");
66
- return context;
67
- };
68
- const useOperationContext = ()=>useEffectContext().operationContext;
69
- exports.createEffectOperationContext = __webpack_exports__.createEffectOperationContext;
70
- exports.runWithEffectContext = __webpack_exports__.runWithEffectContext;
71
- exports.useEffectContext = __webpack_exports__.useEffectContext;
72
- exports.useOperationContext = __webpack_exports__.useOperationContext;
73
- for(var __rspack_i in __webpack_exports__)if (-1 === [
74
- "createEffectOperationContext",
75
- "runWithEffectContext",
76
- "useEffectContext",
77
- "useOperationContext"
78
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
79
- Object.defineProperty(exports, '__esModule', {
80
- value: true
81
- });
@@ -1,121 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- collectEffectEndpoints: ()=>collectEffectEndpoints,
32
- createEffectEndpointContractHash: ()=>createEffectEndpointContractHash,
33
- ensureLeadingSlash: ()=>ensureLeadingSlash,
34
- extractHttpApiFromModule: ()=>extractHttpApiFromModule,
35
- normalizeEffectPrefix: ()=>normalizeEffectPrefix,
36
- toOperationContractSources: ()=>toOperationContractSources
37
- });
38
- const bff_core_namespaceObject = require("@modern-js/bff-core");
39
- const external_entry_shape_js_namespaceObject = require("./entry-shape.js");
40
- function resolveEffectEndpointName(endpoint) {
41
- if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
42
- if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
43
- return '';
44
- }
45
- function ensureLeadingSlash(pathname) {
46
- return pathname.startsWith('/') ? pathname : `/${pathname}`;
47
- }
48
- function normalizeEffectPrefix(prefix) {
49
- if ('/' === prefix) return '';
50
- return ensureLeadingSlash(prefix || '/api');
51
- }
52
- function getEffectRoutePath(prefix, endpointPath) {
53
- const normalizedPrefix = normalizeEffectPrefix(prefix);
54
- const normalizedEndpointPath = ensureLeadingSlash(endpointPath);
55
- const finalEndpointPath = '/' === normalizedEndpointPath ? '' : endpointPath;
56
- if (!normalizedPrefix && !finalEndpointPath) return '/';
57
- return `${normalizedPrefix}${finalEndpointPath || ''}`;
58
- }
59
- function resolveEffectApiId(api) {
60
- const fallback = 'EffectHttpApi';
61
- if ('identifier' in api && 'string' == typeof api.identifier && api.identifier) return api.identifier;
62
- return fallback;
63
- }
64
- function collectEffectEndpoints(reflect, api, prefix) {
65
- const endpoints = [];
66
- const apiId = resolveEffectApiId(api);
67
- reflect(api, {
68
- onGroup: ()=>{},
69
- onEndpoint: ({ group, endpoint })=>{
70
- endpoints.push({
71
- apiId,
72
- groupName: String(group.identifier),
73
- endpointName: resolveEffectEndpointName(endpoint),
74
- method: String(endpoint.method).toUpperCase(),
75
- routePath: getEffectRoutePath(prefix, String(endpoint.path))
76
- });
77
- }
78
- });
79
- return endpoints.sort((a, b)=>{
80
- if (a.groupName === b.groupName) return a.endpointName.localeCompare(b.endpointName);
81
- return a.groupName.localeCompare(b.groupName);
82
- });
83
- }
84
- function toOperationContractSources(endpoints) {
85
- return endpoints.map(createEffectOperationContractSource);
86
- }
87
- function createEffectOperationContractSource(endpoint) {
88
- return {
89
- name: endpoint.endpointName,
90
- httpMethod: endpoint.method,
91
- routePath: endpoint.routePath
92
- };
93
- }
94
- async function extractHttpApiFromModule(mod, isHttpApi) {
95
- const facts = (0, external_entry_shape_js_namespaceObject.classifyEffectBffEntryModule)(mod, {
96
- isRequestHandler: (value)=>'function' == typeof value,
97
- isValidatorAwareHandlerFactory: external_entry_shape_js_namespaceObject.isValidatorAwareHandlerFactory,
98
- isHttpApi
99
- });
100
- return !facts?.legacyShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
101
- }
102
- function createEffectEndpointContractHash(endpoint, requestId) {
103
- return (0, bff_core_namespaceObject.createOperationContractHash)(createEffectOperationContractSource(endpoint), requestId);
104
- }
105
- exports.collectEffectEndpoints = __webpack_exports__.collectEffectEndpoints;
106
- exports.createEffectEndpointContractHash = __webpack_exports__.createEffectEndpointContractHash;
107
- exports.ensureLeadingSlash = __webpack_exports__.ensureLeadingSlash;
108
- exports.extractHttpApiFromModule = __webpack_exports__.extractHttpApiFromModule;
109
- exports.normalizeEffectPrefix = __webpack_exports__.normalizeEffectPrefix;
110
- exports.toOperationContractSources = __webpack_exports__.toOperationContractSources;
111
- for(var __rspack_i in __webpack_exports__)if (-1 === [
112
- "collectEffectEndpoints",
113
- "createEffectEndpointContractHash",
114
- "ensureLeadingSlash",
115
- "extractHttpApiFromModule",
116
- "normalizeEffectPrefix",
117
- "toOperationContractSources"
118
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
119
- Object.defineProperty(exports, '__esModule', {
120
- value: true
121
- });
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- const EFFECT_VALIDATOR_AWARE_FACTORY = Symbol.for('modernjs.effect.validatorAware');
31
- function isValidatorAwareHandlerFactory(factory) {
32
- return Boolean('function' == typeof factory && factory[EFFECT_VALIDATOR_AWARE_FACTORY]);
33
- }
34
- 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.';
35
- function isEffectEntryRecord(value) {
36
- return 'object' == typeof value && null !== value;
37
- }
38
- function classifyEffectBffEntryModule(value, predicates) {
39
- if (!isEffectEntryRecord(value)) return null;
40
- const rootModule = value;
41
- if (predicates.isRequestHandler(rootModule.handler)) return createEntryShapeFacts(rootModule, predicates, '`handler` export');
42
- const defaultEntry = rootModule.default;
43
- if (predicates.isRequestHandler(defaultEntry)) return createEntryShapeFacts(rootModule, predicates, 'default request handler');
44
- const module = isEffectEntryRecord(defaultEntry) ? {
45
- ...rootModule,
46
- ...defaultEntry
47
- } : rootModule;
48
- if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
49
- return createEntryShapeFacts(module, predicates);
50
- }
51
- function createEntryShapeFacts(module, predicates, legacyShape) {
52
- const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
53
- const api = predicates.isHttpApi(module.api) ? module.api : void 0;
54
- const hasRuntimeLayer = void 0 !== module.layer;
55
- return {
56
- module,
57
- legacyShape,
58
- createHandler,
59
- createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
60
- api,
61
- layer: module.layer,
62
- hasRuntimeLayer
63
- };
64
- }
65
- __webpack_require__.d(__webpack_exports__, {
66
- classifyEffectBffEntryModule: ()=>classifyEffectBffEntryModule,
67
- isValidatorAwareHandlerFactory: ()=>isValidatorAwareHandlerFactory
68
- }, {
69
- EFFECT_VALIDATOR_AWARE_FACTORY: EFFECT_VALIDATOR_AWARE_FACTORY,
70
- strictEffectApproachMessage: strictEffectApproachMessage
71
- });
72
- exports.EFFECT_VALIDATOR_AWARE_FACTORY = __webpack_exports__.EFFECT_VALIDATOR_AWARE_FACTORY;
73
- exports.classifyEffectBffEntryModule = __webpack_exports__.classifyEffectBffEntryModule;
74
- exports.isValidatorAwareHandlerFactory = __webpack_exports__.isValidatorAwareHandlerFactory;
75
- exports.strictEffectApproachMessage = __webpack_exports__.strictEffectApproachMessage;
76
- for(var __rspack_i in __webpack_exports__)if (-1 === [
77
- "EFFECT_VALIDATOR_AWARE_FACTORY",
78
- "classifyEffectBffEntryModule",
79
- "isValidatorAwareHandlerFactory",
80
- "strictEffectApproachMessage"
81
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
82
- Object.defineProperty(exports, '__esModule', {
83
- value: true
84
- });
@@ -1,161 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- createDataPlatformBatchRequestHandler: ()=>createDataPlatformBatchRequestHandler
32
- });
33
- const index_js_namespaceObject = require("../../data-platform/index.js");
34
- const external_batch_js_namespaceObject = require("./batch.js");
35
- const external_routing_js_namespaceObject = require("./routing.js");
36
- function createDataPlatformBatchRequestHandler(options) {
37
- const dataPlatformBatchOptions = options.dataPlatform?.batch;
38
- const batchEnabled = dataPlatformBatchOptions?.enabled !== false;
39
- const batchPath = (0, external_batch_js_namespaceObject.normalizeBatchPath)(dataPlatformBatchOptions?.endpoint);
40
- const batchMaxSize = Math.max(1, dataPlatformBatchOptions?.maxBatchSize ?? 16);
41
- const batchMaxBytes = Math.max(1024, dataPlatformBatchOptions?.maxBatchBytes ?? 65536);
42
- const batchConcurrency = Math.max(1, dataPlatformBatchOptions?.maxConcurrency ?? 4);
43
- const batchItemTimeoutMs = Math.max(0, dataPlatformBatchOptions?.requestTimeoutMs ?? 10000);
44
- const batchAllowedMethods = (0, external_batch_js_namespaceObject.normalizeBatchAllowedMethods)(dataPlatformBatchOptions?.allowedMethods);
45
- const envelopeHeader = options.dataPlatform?.envelopeHeader || index_js_namespaceObject.DEFAULT_DATA_ENVELOPE_HEADER;
46
- const normalizedEnvelopeHeader = envelopeHeader.toLowerCase();
47
- const handle = async (request, context)=>{
48
- const mountedPrefix = (0, external_routing_js_namespaceObject.getMountedPrefixFromContext)(request, context);
49
- const method = (0, index_js_namespaceObject.normalizeMethod)(request.method);
50
- if ('POST' !== method) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch endpoint only supports POST requests', 405);
51
- const contentType = request.headers.get('content-type') || '';
52
- if (!contentType.includes('application/json')) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch endpoint requires application/json content-type', 415);
53
- const payloadText = await request.text();
54
- if ((0, index_js_namespaceObject.measureTextBytes)(payloadText) > batchMaxBytes) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)(`Batch payload exceeds max size (${String(batchMaxBytes)} bytes)`, 413);
55
- let payload;
56
- try {
57
- payload = JSON.parse(payloadText);
58
- } catch {
59
- return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Invalid batch payload JSON');
60
- }
61
- if (!(0, external_batch_js_namespaceObject.isBatchRequestPayload)(payload)) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Invalid batch payload shape');
62
- if (0 === payload.items.length) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch payload items cannot be empty');
63
- if (payload.items.length > batchMaxSize) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)(`Batch item count exceeds max size (${String(batchMaxSize)})`, 413);
64
- const responseItems = await (0, external_batch_js_namespaceObject.mapWithConcurrency)(payload.items, batchConcurrency, async (rawItem, index)=>{
65
- const fallbackId = `item_${String(index)}`;
66
- const itemId = (0, index_js_namespaceObject.isPlainObject)(rawItem) && 'string' == typeof rawItem.id ? rawItem.id : fallbackId;
67
- if (!(0, index_js_namespaceObject.isPlainObject)(rawItem)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Invalid batch item; expected object');
68
- if ('string' != typeof rawItem.path || 0 === rawItem.path.length) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Invalid batch item path');
69
- if (!rawItem.path.startsWith('/')) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item path must start with "/"');
70
- const normalizedItemPath = (0, external_routing_js_namespaceObject.removeMountedPrefixFromBatchPath)(rawItem.path, mountedPrefix);
71
- const itemPathname = normalizedItemPath.split('?')[0] || normalizedItemPath;
72
- if (itemPathname === batchPath || itemPathname.startsWith(`${batchPath}/`)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item path cannot target batch endpoint');
73
- const itemMethod = (0, index_js_namespaceObject.normalizeMethod)('string' == typeof rawItem.method ? rawItem.method : void 0);
74
- if (!batchAllowedMethods.has(itemMethod)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 405, `Batch item method ${itemMethod} is not allowed`);
75
- if (void 0 !== rawItem.body && null !== rawItem.body && 'string' != typeof rawItem.body) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item body must be a string when provided');
76
- if (('GET' === itemMethod || 'HEAD' === itemMethod) && 'string' == typeof rawItem.body) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, `${itemMethod} batch item cannot include body`);
77
- const normalizedHeaders = {};
78
- if (void 0 !== rawItem.headers) {
79
- if (!(0, index_js_namespaceObject.isPlainObject)(rawItem.headers)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item headers must be an object');
80
- for (const [key, value] of Object.entries(rawItem.headers)){
81
- if ('string' != typeof value) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, `Invalid header "${key}" for batch item`);
82
- normalizedHeaders[key.toLowerCase()] = value;
83
- }
84
- }
85
- if (!normalizedHeaders.traceparent) {
86
- const encodedEnvelope = normalizedHeaders[normalizedEnvelopeHeader];
87
- if ('string' == typeof encodedEnvelope) {
88
- const envelope = (0, index_js_namespaceObject.decodeRequestEnvelopeHeader)(encodedEnvelope);
89
- if (envelope?.traceparent) normalizedHeaders.traceparent = envelope.traceparent;
90
- }
91
- }
92
- if (!normalizedHeaders.traceparent) {
93
- const requestTraceparent = request.headers.get('traceparent');
94
- if (requestTraceparent) normalizedHeaders.traceparent = requestTraceparent;
95
- }
96
- const targetUrl = new URL(normalizedItemPath, request.url);
97
- const requestHeaders = new Headers(normalizedHeaders);
98
- const body = 'GET' === itemMethod || 'HEAD' === itemMethod ? void 0 : rawItem.body;
99
- if (void 0 === body) requestHeaders.delete('content-type');
100
- const itemRequest = new Request(targetUrl.toString(), {
101
- method: itemMethod,
102
- headers: requestHeaders,
103
- body
104
- });
105
- try {
106
- const itemResponse = await (0, external_batch_js_namespaceObject.promiseWithTimeout)(options.handleItem(itemRequest, context), batchItemTimeoutMs);
107
- if (!(itemResponse instanceof Response)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 500, 'Invalid response returned by batch item handler');
108
- const bodyText = await itemResponse.text();
109
- const responseItem = {
110
- id: itemId,
111
- status: itemResponse.status,
112
- headers: (0, external_batch_js_namespaceObject.toHeaderRecord)(itemResponse.headers),
113
- ...bodyText ? {
114
- body: bodyText
115
- } : {}
116
- };
117
- return responseItem;
118
- } catch (error) {
119
- if (error instanceof Response) {
120
- const bodyText = await error.text();
121
- return {
122
- id: itemId,
123
- status: error.status,
124
- headers: (0, external_batch_js_namespaceObject.toHeaderRecord)(error.headers),
125
- ...bodyText ? {
126
- body: bodyText
127
- } : {}
128
- };
129
- }
130
- const message = error instanceof Error ? error.message : String(error);
131
- return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 500, message);
132
- }
133
- });
134
- const responsePayload = {
135
- protocolVersion: 1,
136
- batchId: payload.batchId,
137
- receivedAt: Date.now(),
138
- items: responseItems
139
- };
140
- return new Response(JSON.stringify(responsePayload), {
141
- status: 200,
142
- headers: {
143
- 'content-type': 'application/json; charset=utf-8',
144
- [index_js_namespaceObject.DEFAULT_DATA_BATCH_HEADER]: '1',
145
- 'x-modernjs-data-batch-id': payload.batchId
146
- }
147
- });
148
- };
149
- return {
150
- enabled: batchEnabled,
151
- path: batchPath,
152
- handle
153
- };
154
- }
155
- exports.createDataPlatformBatchRequestHandler = __webpack_exports__.createDataPlatformBatchRequestHandler;
156
- for(var __rspack_i in __webpack_exports__)if (-1 === [
157
- "createDataPlatformBatchRequestHandler"
158
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
159
- Object.defineProperty(exports, '__esModule', {
160
- value: true
161
- });
@@ -1,159 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- createBatchValidationResponse: ()=>createBatchValidationResponse,
32
- isBatchRequestPayload: ()=>isBatchRequestPayload,
33
- mapWithConcurrency: ()=>mapWithConcurrency,
34
- normalizeBatchAllowedMethods: ()=>normalizeBatchAllowedMethods,
35
- normalizeBatchPath: ()=>normalizeBatchPath,
36
- prepareJsonRequestBody: ()=>prepareJsonRequestBody,
37
- promiseWithTimeout: ()=>promiseWithTimeout,
38
- toBatchItemError: ()=>toBatchItemError,
39
- toHeaderRecord: ()=>headers_js_namespaceObject.toHeaderRecord
40
- });
41
- const index_js_namespaceObject = require("../../data-platform/index.js");
42
- const headers_js_namespaceObject = require("../../../utils/headers.js");
43
- function normalizeBatchPath(pathname) {
44
- if (!pathname || '/' === pathname) return index_js_namespaceObject.DEFAULT_DATA_BATCH_ENDPOINT;
45
- if (!pathname.startsWith('/')) return `/${pathname}`;
46
- return pathname;
47
- }
48
- function normalizeBatchAllowedMethods(allowedMethods) {
49
- const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
50
- 'GET'
51
- ];
52
- return new Set(source.map((method)=>method.toUpperCase()));
53
- }
54
- function isBatchRequestPayload(value) {
55
- return (0, index_js_namespaceObject.isPlainObject)(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
56
- }
57
- function createBatchValidationResponse(message, status = 400) {
58
- return new Response(JSON.stringify({
59
- message
60
- }), {
61
- status,
62
- headers: {
63
- 'content-type': 'application/json; charset=utf-8'
64
- }
65
- });
66
- }
67
- function cloneWithoutJsonBodyHeaders(request) {
68
- const headers = new Headers(request.headers);
69
- headers.delete('content-type');
70
- headers.delete('content-length');
71
- return new Request(request.url, {
72
- method: request.method,
73
- headers,
74
- signal: request.signal
75
- });
76
- }
77
- async function prepareJsonRequestBody(request) {
78
- const method = (0, index_js_namespaceObject.normalizeMethod)(request.method);
79
- if ('GET' === method || 'HEAD' === method) return request;
80
- const contentType = (request.headers.get('content-type') || '').toLowerCase();
81
- if (!contentType.includes('application/json')) return request;
82
- if (null === request.body) return cloneWithoutJsonBodyHeaders(request);
83
- try {
84
- const bodyText = await request.clone().text();
85
- if ('' === bodyText) return cloneWithoutJsonBodyHeaders(request);
86
- JSON.parse(bodyText);
87
- } catch {
88
- return createBatchValidationResponse('Invalid JSON request body');
89
- }
90
- return request;
91
- }
92
- function toBatchItemError(id, status, message) {
93
- return {
94
- id,
95
- status,
96
- headers: {
97
- 'content-type': 'application/json; charset=utf-8'
98
- },
99
- body: JSON.stringify({
100
- message
101
- })
102
- };
103
- }
104
- function promiseWithTimeout(effect, timeoutMs) {
105
- if (timeoutMs <= 0) return effect;
106
- return new Promise((resolve, reject)=>{
107
- const timer = setTimeout(()=>{
108
- reject(new Error(`Batch item timeout after ${String(timeoutMs)}ms`));
109
- }, timeoutMs);
110
- effect.then((value)=>{
111
- clearTimeout(timer);
112
- resolve(value);
113
- }, (error)=>{
114
- clearTimeout(timer);
115
- reject(error);
116
- });
117
- });
118
- }
119
- async function mapWithConcurrency(items, concurrency, mapper) {
120
- if (0 === items.length) return [];
121
- const normalizedConcurrency = Math.max(1, concurrency);
122
- const output = new Array(items.length);
123
- let index = 0;
124
- const workers = Array.from({
125
- length: Math.min(normalizedConcurrency, items.length)
126
- }, async ()=>{
127
- while(true){
128
- const currentIndex = index;
129
- index += 1;
130
- if (currentIndex >= items.length) return;
131
- output[currentIndex] = await mapper(items[currentIndex], currentIndex);
132
- }
133
- });
134
- await Promise.all(workers);
135
- return output;
136
- }
137
- exports.createBatchValidationResponse = __webpack_exports__.createBatchValidationResponse;
138
- exports.isBatchRequestPayload = __webpack_exports__.isBatchRequestPayload;
139
- exports.mapWithConcurrency = __webpack_exports__.mapWithConcurrency;
140
- exports.normalizeBatchAllowedMethods = __webpack_exports__.normalizeBatchAllowedMethods;
141
- exports.normalizeBatchPath = __webpack_exports__.normalizeBatchPath;
142
- exports.prepareJsonRequestBody = __webpack_exports__.prepareJsonRequestBody;
143
- exports.promiseWithTimeout = __webpack_exports__.promiseWithTimeout;
144
- exports.toBatchItemError = __webpack_exports__.toBatchItemError;
145
- exports.toHeaderRecord = __webpack_exports__.toHeaderRecord;
146
- for(var __rspack_i in __webpack_exports__)if (-1 === [
147
- "createBatchValidationResponse",
148
- "isBatchRequestPayload",
149
- "mapWithConcurrency",
150
- "normalizeBatchAllowedMethods",
151
- "normalizeBatchPath",
152
- "prepareJsonRequestBody",
153
- "promiseWithTimeout",
154
- "toBatchItemError",
155
- "toHeaderRecord"
156
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
157
- Object.defineProperty(exports, '__esModule', {
158
- value: true
159
- });