@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,256 +0,0 @@
1
- import node_crypto from "node:crypto";
2
- import node_fs from "node:fs";
3
- import { builtinModules, createRequire } from "node:module";
4
- import node_path from "node:path";
5
- import { pathToFileURL } from "node:url";
6
- import { build, transform } from "esbuild";
7
- const dynamicImport = new Function('specifier', 'return import(specifier)');
8
- const SOURCE_LOADERS = new Map([
9
- [
10
- '.js',
11
- 'js'
12
- ],
13
- [
14
- '.jsx',
15
- 'jsx'
16
- ],
17
- [
18
- '.mjs',
19
- 'js'
20
- ],
21
- [
22
- '.cjs',
23
- 'js'
24
- ],
25
- [
26
- '.ts',
27
- 'ts'
28
- ],
29
- [
30
- '.tsx',
31
- 'tsx'
32
- ],
33
- [
34
- '.mts',
35
- 'ts'
36
- ],
37
- [
38
- '.cts',
39
- 'ts'
40
- ]
41
- ]);
42
- function sourceLoader(args) {
43
- return SOURCE_LOADERS.get(node_path.extname(args.path).toLowerCase());
44
- }
45
- function preserveSourceModuleSemantics() {
46
- return {
47
- name: 'modern-js-effect-source-semantics',
48
- setup (buildApi) {
49
- buildApi.onLoad({
50
- filter: /\.[cm]?[jt]sx?$/
51
- }, async (args)=>{
52
- const loader = sourceLoader(args);
53
- if (!loader) return;
54
- const source = await node_fs.promises.readFile(args.path, 'utf8');
55
- const compiled = await transform(source, {
56
- define: {
57
- 'import.meta.url': JSON.stringify(pathToFileURL(args.path).href)
58
- },
59
- jsx: 'automatic',
60
- loader,
61
- sourcefile: args.path,
62
- target: 'node20'
63
- });
64
- return {
65
- contents: compiled.code,
66
- loader: 'js',
67
- resolveDir: node_path.dirname(args.path)
68
- };
69
- });
70
- }
71
- };
72
- }
73
- const nodeBuiltins = new Set([
74
- ...builtinModules,
75
- ...builtinModules.map((name)=>`node:${name}`)
76
- ]);
77
- const dependencyResolutionMarker = 'modern-js-effect-dependency-resolution';
78
- async function isEsmOnlyFile(filename) {
79
- const extension = node_path.extname(filename).toLowerCase();
80
- if ('.mjs' === extension || '.mts' === extension) return true;
81
- if ('.cjs' === extension || '.cts' === extension) return false;
82
- let directory = node_path.dirname(filename);
83
- while(true){
84
- const packagePath = node_path.join(directory, 'package.json');
85
- try {
86
- const packageJson = JSON.parse(await node_fs.promises.readFile(packagePath, 'utf8'));
87
- return 'module' === packageJson.type;
88
- } catch (error) {
89
- if (!error || 'object' != typeof error || !('code' in error) || 'ENOENT' !== error.code) throw error;
90
- }
91
- const parent = node_path.dirname(directory);
92
- if (parent === directory) return false;
93
- directory = parent;
94
- }
95
- }
96
- function isBareSpecifier(specifier) {
97
- return !specifier.startsWith('.') && !specifier.startsWith('/') && !node_path.isAbsolute(specifier);
98
- }
99
- function externalizeInstalledDependencies(options) {
100
- const runtimeRequire = createRequire(node_path.join(options.runtimeResolveDir, '__modern_effect_entry.cjs'));
101
- return {
102
- name: 'modern-js-effect-installed-dependencies',
103
- setup (buildApi) {
104
- buildApi.onResolve({
105
- filter: /.*/
106
- }, async (args)=>{
107
- if (!isBareSpecifier(args.path) || nodeBuiltins.has(args.path) || args.pluginData?.[dependencyResolutionMarker] === true) return nodeBuiltins.has(args.path) ? {
108
- external: true,
109
- path: args.path
110
- } : void 0;
111
- const resolution = await buildApi.resolve(args.path, {
112
- importer: args.importer,
113
- kind: args.kind,
114
- namespace: args.namespace,
115
- pluginData: {
116
- ...args.pluginData,
117
- [dependencyResolutionMarker]: true
118
- },
119
- resolveDir: args.resolveDir
120
- });
121
- if (resolution.errors.length > 0) return {
122
- external: true,
123
- path: args.path
124
- };
125
- if (resolution.external || !resolution.path) return {
126
- external: true,
127
- path: args.path
128
- };
129
- const realPath = await node_fs.promises.realpath(resolution.path).catch(()=>resolution.path);
130
- if (realPath.includes(`${node_path.sep}node_modules${node_path.sep}`)) {
131
- const runtimeResolution = await buildApi.resolve(args.path, {
132
- importer: '',
133
- kind: args.kind,
134
- namespace: 'file',
135
- pluginData: {
136
- [dependencyResolutionMarker]: true
137
- },
138
- resolveDir: options.runtimeResolveDir
139
- });
140
- if (0 === runtimeResolution.errors.length && runtimeResolution.path) {
141
- if ('cjs' === options.format) {
142
- let requiredPath;
143
- try {
144
- requiredPath = runtimeRequire.resolve(args.path);
145
- } catch {
146
- requiredPath = runtimeResolution.path;
147
- }
148
- if (await isEsmOnlyFile(requiredPath)) return {
149
- namespace: resolution.namespace,
150
- path: resolution.path,
151
- pluginData: resolution.pluginData,
152
- sideEffects: resolution.sideEffects,
153
- suffix: resolution.suffix,
154
- warnings: resolution.warnings
155
- };
156
- }
157
- return {
158
- external: true,
159
- path: args.path
160
- };
161
- }
162
- }
163
- return {
164
- namespace: resolution.namespace,
165
- path: resolution.path,
166
- pluginData: resolution.pluginData,
167
- sideEffects: resolution.sideEffects,
168
- suffix: resolution.suffix,
169
- warnings: resolution.warnings
170
- };
171
- });
172
- }
173
- };
174
- }
175
- async function bundleEffectEntryForNode(options) {
176
- await build({
177
- absWorkingDir: options.appDir,
178
- allowOverwrite: true,
179
- bundle: true,
180
- entryPoints: [
181
- options.entryPath
182
- ],
183
- format: options.format,
184
- logLevel: 'silent',
185
- outfile: options.entryPath,
186
- platform: 'node',
187
- plugins: [
188
- externalizeInstalledDependencies({
189
- format: options.format,
190
- runtimeResolveDir: options.appDir
191
- }),
192
- preserveSourceModuleSemantics()
193
- ],
194
- target: 'node20'
195
- });
196
- }
197
- function isWatchableInput(filename) {
198
- return !filename.includes(`${node_path.sep}node_modules${node_path.sep}`) && (SOURCE_LOADERS.has(node_path.extname(filename).toLowerCase()) || '.json' === node_path.extname(filename).toLowerCase());
199
- }
200
- function normalizeImportedModule(module) {
201
- if (!module || 'object' != typeof module) return module;
202
- const namespace = module;
203
- const commonJsModule = namespace.default;
204
- if (1 === Object.keys(namespace).length && null !== commonJsModule && 'object' == typeof commonJsModule && true === commonJsModule.__esModule) return commonJsModule;
205
- return module;
206
- }
207
- async function loadEffectBuiltModule(resourcePath) {
208
- const canonicalPath = await node_fs.promises.realpath(node_path.resolve(resourcePath));
209
- if (!await isEsmOnlyFile(canonicalPath)) return createRequire(canonicalPath)(canonicalPath);
210
- return normalizeImportedModule(await dynamicImport(pathToFileURL(canonicalPath).href));
211
- }
212
- async function loadEffectSourceModule(options) {
213
- const resourcePath = node_path.resolve(options.resourcePath);
214
- const appDir = node_path.resolve(options.appDir ?? node_path.dirname(resourcePath));
215
- const tsconfigPath = node_path.join(appDir, 'tsconfig.json');
216
- const cacheDirectory = node_path.join(appDir, 'node_modules', '.cache', 'modern-js', 'effect-source-loader');
217
- const outputName = node_crypto.createHash('sha256').update(resourcePath).digest('hex').slice(0, 24);
218
- const outputPath = node_path.join(cacheDirectory, `${outputName}.mjs`);
219
- await node_fs.promises.mkdir(cacheDirectory, {
220
- recursive: true
221
- });
222
- const result = await build({
223
- absWorkingDir: appDir,
224
- banner: {
225
- js: `import { createRequire as __modernCreateEffectRequire } from 'node:module'; const require = __modernCreateEffectRequire(${JSON.stringify(pathToFileURL(resourcePath).href)});`
226
- },
227
- bundle: true,
228
- entryPoints: [
229
- resourcePath
230
- ],
231
- format: 'esm',
232
- jsx: 'automatic',
233
- logLevel: 'silent',
234
- metafile: true,
235
- outfile: outputPath,
236
- platform: 'node',
237
- plugins: [
238
- externalizeInstalledDependencies({
239
- format: 'esm',
240
- runtimeResolveDir: appDir
241
- }),
242
- preserveSourceModuleSemantics()
243
- ],
244
- sourcemap: 'inline',
245
- target: 'node20',
246
- tsconfig: node_fs.existsSync(tsconfigPath) ? tsconfigPath : void 0
247
- });
248
- for (const input of Object.keys(result.metafile.inputs)){
249
- const dependency = node_path.isAbsolute(input) ? node_path.normalize(input) : node_path.resolve(appDir, input);
250
- if (isWatchableInput(dependency)) options.onDependency?.(dependency);
251
- }
252
- const output = await node_fs.promises.readFile(outputPath);
253
- const revision = node_crypto.createHash('sha256').update(output).digest('hex');
254
- return normalizeImportedModule(await dynamicImport(`${pathToFileURL(outputPath).href}?v=${revision}`));
255
- }
256
- export { bundleEffectEntryForNode, loadEffectBuiltModule, loadEffectSourceModule };
@@ -1,8 +0,0 @@
1
- function toHeaderRecord(headers) {
2
- const record = {};
3
- headers.forEach((value, key)=>{
4
- record[key] = value;
5
- });
6
- return record;
7
- }
8
- export { toHeaderRecord };
@@ -1,247 +0,0 @@
1
- import "node:module";
2
- import { stableStringify } from "../codec.mjs";
3
- import { DEFAULT_DATA_BATCH_HEADER } from "../types.mjs";
4
- import { createBatchId, measureTextBytes, normalizeMethod, shouldBatchRequest, toHeaderRecord, toRequestBody } from "./request.mjs";
5
- import { isBatchResponsePayload, parseResponseLikeCreateRequest } from "./response.mjs";
6
- import { emitDataBatchTransportEvent } from "./telemetry.mjs";
7
- import { normalizeBatchEndpoint, toAbsoluteUrl } from "./url.mjs";
8
- function ensureBucket(buckets, endpoint) {
9
- const existing = buckets.get(endpoint);
10
- if (existing) return existing;
11
- const next = {
12
- items: [],
13
- bytes: 0,
14
- timer: null,
15
- flushing: false
16
- };
17
- buckets.set(endpoint, next);
18
- return next;
19
- }
20
- function createBatchTransportQueue({ options, baseFetch }) {
21
- const flushIntervalMs = Math.max(0, options.flushIntervalMs ?? 8);
22
- const maxBatchSize = Math.max(1, options.maxBatchSize ?? 16);
23
- const maxBatchBytes = Math.max(1024, options.maxBatchBytes ?? 65536);
24
- const requestTimeoutMs = options.requestTimeoutMs;
25
- const allowedMethods = new Set((options.allowedMethods && options.allowedMethods.length > 0 ? options.allowedMethods : [
26
- 'GET'
27
- ]).map((method)=>method.toUpperCase()));
28
- const onEvent = options.onEvent;
29
- const buckets = new Map();
30
- const pendingByKey = new Map();
31
- const disabledEndpoints = new Set();
32
- let nextItemId = 0;
33
- const runSingle = async (request)=>{
34
- const response = await baseFetch(request.requestUrl, request.requestInit);
35
- return parseResponseLikeCreateRequest(response);
36
- };
37
- const settleRequests = async (items, runner)=>{
38
- await Promise.all(items.map(async (item)=>{
39
- try {
40
- const value = await runner(item);
41
- item.resolve(value);
42
- } catch (error) {
43
- item.reject(error);
44
- } finally{
45
- pendingByKey.delete(item.key);
46
- }
47
- }));
48
- };
49
- const flushBucket = async (endpoint)=>{
50
- const bucket = buckets.get(endpoint);
51
- if (!bucket || bucket.flushing) return;
52
- if (bucket.timer) {
53
- clearTimeout(bucket.timer);
54
- bucket.timer = null;
55
- }
56
- if (0 === bucket.items.length) return;
57
- bucket.flushing = true;
58
- const items = bucket.items;
59
- bucket.items = [];
60
- bucket.bytes = 0;
61
- if (1 === items.length || disabledEndpoints.has(endpoint)) {
62
- emitDataBatchTransportEvent(onEvent, {
63
- type: disabledEndpoints.has(endpoint) ? 'fallback' : 'flush',
64
- endpoint,
65
- size: items.length,
66
- reason: disabledEndpoints.has(endpoint) ? 'batch-disabled' : void 0
67
- });
68
- await settleRequests(items, runSingle);
69
- bucket.flushing = false;
70
- if (bucket.items.length > 0 && !bucket.timer) flushBucket(endpoint);
71
- return;
72
- }
73
- const batchId = createBatchId();
74
- const payload = {
75
- protocolVersion: 1,
76
- batchId,
77
- sentAt: Date.now(),
78
- items: items.map((item)=>item.item)
79
- };
80
- emitDataBatchTransportEvent(onEvent, {
81
- type: 'flush',
82
- endpoint,
83
- batchId,
84
- size: items.length
85
- });
86
- const payloadJson = JSON.stringify(payload);
87
- const traceparent = items.find((item)=>'string' == typeof item.item.headers?.traceparent)?.item.headers?.traceparent || void 0;
88
- const requestInit = {
89
- method: 'POST',
90
- headers: {
91
- accept: 'application/json, */*;q=0.8',
92
- 'content-type': 'application/json; charset=utf-8',
93
- [DEFAULT_DATA_BATCH_HEADER]: '1',
94
- ...traceparent ? {
95
- traceparent
96
- } : {}
97
- },
98
- body: payloadJson
99
- };
100
- let timeoutHandle = null;
101
- try {
102
- const controller = requestTimeoutMs && requestTimeoutMs > 0 ? new AbortController() : void 0;
103
- if (controller) {
104
- requestInit.signal = controller.signal;
105
- timeoutHandle = setTimeout(()=>{
106
- controller.abort();
107
- emitDataBatchTransportEvent(onEvent, {
108
- type: 'fallback',
109
- endpoint,
110
- batchId,
111
- size: items.length,
112
- reason: 'batch-timeout'
113
- });
114
- }, requestTimeoutMs);
115
- }
116
- const response = await baseFetch(endpoint, requestInit);
117
- if (!response.ok) {
118
- if (404 === response.status || 405 === response.status) {
119
- disabledEndpoints.add(endpoint);
120
- emitDataBatchTransportEvent(onEvent, {
121
- type: 'disable',
122
- endpoint,
123
- batchId,
124
- reason: `batch-endpoint-unavailable-${String(response.status)}`
125
- });
126
- } else emitDataBatchTransportEvent(onEvent, {
127
- type: 'fallback',
128
- endpoint,
129
- batchId,
130
- size: items.length,
131
- reason: `batch-response-${String(response.status)}`
132
- });
133
- await settleRequests(items, runSingle);
134
- bucket.flushing = false;
135
- return;
136
- }
137
- const result = await response.json();
138
- if (!isBatchResponsePayload(result)) {
139
- emitDataBatchTransportEvent(onEvent, {
140
- type: 'fallback',
141
- endpoint,
142
- batchId,
143
- size: items.length,
144
- reason: 'invalid-batch-response'
145
- });
146
- await settleRequests(items, runSingle);
147
- bucket.flushing = false;
148
- return;
149
- }
150
- const itemMap = new Map();
151
- for (const item of result.items)itemMap.set(item.id, item);
152
- await settleRequests(items, async (request)=>{
153
- const resultItem = itemMap.get(request.item.id);
154
- if (!resultItem) return runSingle(request);
155
- const reconstructedResponse = new Response(resultItem.body ?? '', {
156
- status: resultItem.status,
157
- headers: resultItem.headers
158
- });
159
- return parseResponseLikeCreateRequest(reconstructedResponse);
160
- });
161
- } catch (error) {
162
- emitDataBatchTransportEvent(onEvent, {
163
- type: 'fallback',
164
- endpoint,
165
- batchId,
166
- size: items.length,
167
- reason: 'batch-transport-error'
168
- });
169
- await settleRequests(items, runSingle);
170
- } finally{
171
- if (timeoutHandle) clearTimeout(timeoutHandle);
172
- bucket.flushing = false;
173
- if (bucket.items.length > 0 && !bucket.timer) flushBucket(endpoint);
174
- }
175
- };
176
- return (input, init)=>{
177
- const requestUrl = toAbsoluteUrl(input);
178
- const batchEndpointUrl = normalizeBatchEndpoint(requestUrl, options.endpoint);
179
- const endpoint = batchEndpointUrl.toString();
180
- const method = normalizeMethod(init?.method);
181
- const body = toRequestBody(init?.body ?? null);
182
- const headers = toHeaderRecord(init?.headers);
183
- const normalizedInit = {
184
- ...init,
185
- method,
186
- headers,
187
- body
188
- };
189
- if (disabledEndpoints.has(endpoint) || !shouldBatchRequest({
190
- method,
191
- body,
192
- headers,
193
- allowedMethods,
194
- batchEndpoint: endpoint,
195
- requestUrl
196
- })) return baseFetch(requestUrl.toString(), normalizedInit).then(parseResponseLikeCreateRequest);
197
- const itemId = `${Date.now().toString(36)}_${nextItemId.toString(36)}_${Math.random().toString(16).slice(2, 8)}`;
198
- nextItemId += 1;
199
- const item = {
200
- id: itemId,
201
- path: `${requestUrl.pathname}${requestUrl.search}`,
202
- method,
203
- headers,
204
- ...body ? {
205
- body
206
- } : {}
207
- };
208
- const key = stableStringify({
209
- endpoint,
210
- path: item.path,
211
- method: item.method,
212
- headers: item.headers,
213
- body: item.body ?? null
214
- });
215
- const existing = pendingByKey.get(key);
216
- if (existing) return existing;
217
- const size = measureTextBytes(stableStringify(item));
218
- const promise = new Promise((resolve, reject)=>{
219
- const bucket = ensureBucket(buckets, endpoint);
220
- const queued = {
221
- key,
222
- endpoint,
223
- requestUrl: requestUrl.toString(),
224
- requestInit: normalizedInit,
225
- item,
226
- size,
227
- resolve,
228
- reject
229
- };
230
- bucket.items.push(queued);
231
- bucket.bytes += size;
232
- emitDataBatchTransportEvent(onEvent, {
233
- type: 'enqueue',
234
- endpoint,
235
- size: bucket.items.length
236
- });
237
- if (bucket.items.length >= maxBatchSize || bucket.bytes >= maxBatchBytes) return void flushBucket(endpoint);
238
- if (!bucket.timer) bucket.timer = setTimeout(()=>{
239
- bucket.timer = null;
240
- flushBucket(endpoint);
241
- }, flushIntervalMs);
242
- });
243
- pendingByKey.set(key, promise);
244
- return promise;
245
- };
246
- }
247
- export { createBatchTransportQueue };
@@ -1,46 +0,0 @@
1
- import "node:module";
2
- import { DEFAULT_DATA_BATCH_HEADER } from "../types.mjs";
3
- function toHeaderRecord(headers) {
4
- if (!headers) return {};
5
- if (headers instanceof Headers) {
6
- const next = {};
7
- headers.forEach((value, key)=>{
8
- next[key.toLowerCase()] = value;
9
- });
10
- return next;
11
- }
12
- if (Array.isArray(headers)) return headers.reduce((acc, [key, value])=>{
13
- acc[String(key).toLowerCase()] = String(value);
14
- return acc;
15
- }, {});
16
- return Object.entries(headers).reduce((acc, [key, value])=>{
17
- if (void 0 === value) return acc;
18
- acc[String(key).toLowerCase()] = Array.isArray(value) ? value.join(', ') : String(value);
19
- return acc;
20
- }, {});
21
- }
22
- function measureTextBytes(value) {
23
- if ("u" > typeof TextEncoder) return new TextEncoder().encode(value).length;
24
- if ("u" > typeof Buffer) return Buffer.byteLength(value);
25
- return value.length;
26
- }
27
- function createBatchId() {
28
- const now = Date.now().toString(36);
29
- const random = Math.random().toString(16).slice(2, 10);
30
- return `batch_${now}_${random}`;
31
- }
32
- function normalizeMethod(method) {
33
- return (method || 'GET').toUpperCase();
34
- }
35
- function toRequestBody(initBody) {
36
- if ('string' == typeof initBody) return initBody;
37
- if ("u" > typeof URLSearchParams && initBody instanceof URLSearchParams) return initBody.toString();
38
- }
39
- function shouldBatchRequest(input) {
40
- if (input.requestUrl.href === input.batchEndpoint) return false;
41
- if ('off' === input.headers[DEFAULT_DATA_BATCH_HEADER]) return false;
42
- if (!input.allowedMethods.has(input.method)) return false;
43
- if (void 0 !== input.body) return false;
44
- return true;
45
- }
46
- export { createBatchId, measureTextBytes, normalizeMethod, shouldBatchRequest, toHeaderRecord, toRequestBody };
@@ -1,24 +0,0 @@
1
- import "node:module";
2
- import { isPlainObject } from "../codec.mjs";
3
- function isBatchResponseItem(value) {
4
- return isPlainObject(value) && 'string' == typeof value.id && 'number' == typeof value.status;
5
- }
6
- function isBatchResponsePayload(value) {
7
- return isPlainObject(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.receivedAt && Array.isArray(value.items) && value.items.every((item)=>isBatchResponseItem(item));
8
- }
9
- async function parseResponseLikeCreateRequest(response) {
10
- const contentType = (response.headers.get('content-type') || '').toLowerCase();
11
- if (!response.ok) {
12
- let data = null;
13
- data = contentType.includes('application/json') ? await response.json() : await response.text();
14
- response.data = data;
15
- throw response;
16
- }
17
- if (contentType.includes('application/json') || contentType.includes('text/json')) return response.json();
18
- if (contentType.includes('text/html') || contentType.includes('text/plain')) return response.text();
19
- if (contentType.includes('application/x-www-form-urlencoded') || contentType.includes('multipart/form-data')) return response.formData();
20
- if (contentType.includes('application/octet-stream')) return response.arrayBuffer();
21
- if (contentType.includes('image/png')) return response;
22
- return response.text();
23
- }
24
- export { isBatchResponsePayload, parseResponseLikeCreateRequest };
@@ -1,24 +0,0 @@
1
- import "node:module";
2
- import { trace } from "@opentelemetry/api";
3
- const DATA_BATCH_TRANSPORT_OTEL_EVENT = 'modernjs.data.batch';
4
- function createDataBatchTransportTelemetryAttributes(event) {
5
- return {
6
- 'modernjs.data.batch.type': event.type,
7
- 'modernjs.data.batch.endpoint': event.endpoint,
8
- 'modernjs.data.batch.degraded': 'fallback' === event.type || 'disable' === event.type,
9
- ...event.batchId ? {
10
- 'modernjs.data.batch.id': event.batchId
11
- } : {},
12
- ...'number' == typeof event.size ? {
13
- 'modernjs.data.batch.size': event.size
14
- } : {},
15
- ...event.reason ? {
16
- 'modernjs.data.batch.reason': event.reason
17
- } : {}
18
- };
19
- }
20
- function emitDataBatchTransportEvent(onEvent, event) {
21
- onEvent?.(event);
22
- trace.getActiveSpan()?.addEvent(DATA_BATCH_TRANSPORT_OTEL_EVENT, createDataBatchTransportTelemetryAttributes(event));
23
- }
24
- export { DATA_BATCH_TRANSPORT_OTEL_EVENT, createDataBatchTransportTelemetryAttributes, emitDataBatchTransportEvent };
@@ -1,26 +0,0 @@
1
- import "node:module";
2
- import { DEFAULT_DATA_BATCH_ENDPOINT } from "../types.mjs";
3
- function resolveRuntimeOrigin() {
4
- if ("u" > typeof window && window.location && 'string' == typeof window.location.origin && window.location.origin) return window.location.origin;
5
- if ("u" > typeof globalThis && globalThis.location && 'string' == typeof globalThis.location?.origin) return globalThis.location.origin;
6
- return 'http://localhost';
7
- }
8
- function toAbsoluteUrl(input) {
9
- if (input instanceof URL) return input;
10
- if ("u" > typeof Request && input instanceof Request) return new URL(input.url);
11
- const value = String(input);
12
- try {
13
- return new URL(value);
14
- } catch {
15
- return new URL(value, resolveRuntimeOrigin());
16
- }
17
- }
18
- function normalizeBatchEndpoint(requestUrl, endpoint) {
19
- const value = endpoint || DEFAULT_DATA_BATCH_ENDPOINT;
20
- try {
21
- return new URL(value);
22
- } catch {
23
- return new URL(value, requestUrl.origin);
24
- }
25
- }
26
- export { normalizeBatchEndpoint, resolveRuntimeOrigin, toAbsoluteUrl };
@@ -1,13 +0,0 @@
1
- import "node:module";
2
- import { createBatchTransportQueue } from "./batch/queue.mjs";
3
- function createDataBatchTransport(options = {}) {
4
- const fallbackFetch = 'function' == typeof fetch ? fetch.bind(globalThis) : void 0;
5
- const baseFetch = options.fetch || fallbackFetch;
6
- if (!baseFetch) throw new Error('createDataBatchTransport requires a fetch implementation');
7
- return createBatchTransportQueue({
8
- options,
9
- baseFetch
10
- });
11
- }
12
- export { DATA_BATCH_TRANSPORT_OTEL_EVENT, createDataBatchTransportTelemetryAttributes, emitDataBatchTransportEvent } from "./batch/telemetry.mjs";
13
- export { createDataBatchTransport };