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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/dist/cjs/cli/compress.js +52 -0
  2. package/dist/cjs/cli/generator.js +149 -0
  3. package/dist/cjs/cli/prefix.js +50 -0
  4. package/dist/cjs/cli/watch.js +51 -0
  5. package/dist/cjs/cli.js +11 -130
  6. package/dist/cjs/runtime/data-platform/batch/queue.js +287 -0
  7. package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
  8. package/dist/cjs/runtime/data-platform/batch/response.js +67 -0
  9. package/dist/cjs/runtime/data-platform/batch/telemetry.js +67 -0
  10. package/dist/cjs/runtime/data-platform/batch/url.js +69 -0
  11. package/dist/cjs/runtime/data-platform/batch-transport.js +59 -0
  12. package/dist/cjs/runtime/data-platform/codec.js +155 -0
  13. package/dist/cjs/runtime/data-platform/index.js +30 -633
  14. package/dist/cjs/runtime/data-platform/invalidation.js +61 -0
  15. package/dist/cjs/runtime/data-platform/trace.js +73 -0
  16. package/dist/cjs/runtime/data-platform/types.js +48 -0
  17. package/dist/cjs/runtime/data-platform/validation.js +178 -0
  18. package/dist/cjs/runtime/effect/adapter/constants.js +44 -0
  19. package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +61 -0
  20. package/dist/cjs/runtime/effect/adapter/entry.js +77 -0
  21. package/dist/cjs/runtime/effect/adapter/error-response.js +79 -0
  22. package/dist/cjs/runtime/effect/adapter/handler.js +53 -0
  23. package/dist/cjs/runtime/effect/adapter.js +12 -115
  24. package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
  25. package/dist/cjs/runtime/effect/backend-federation/load.js +57 -0
  26. package/dist/cjs/runtime/effect/backend-federation/plugin.js +53 -0
  27. package/dist/cjs/runtime/effect/backend-federation/remotes.js +50 -0
  28. package/dist/cjs/runtime/effect/backend-federation/runtime.js +64 -0
  29. package/dist/cjs/runtime/effect/backend-federation/types.js +18 -0
  30. package/dist/cjs/runtime/effect/backend-federation/utils.js +48 -0
  31. package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +83 -0
  32. package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +55 -0
  33. package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +74 -0
  34. package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
  35. package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +117 -0
  36. package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +68 -0
  37. package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +18 -0
  38. package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +108 -0
  39. package/dist/cjs/runtime/effect/backend-federation-manifest.js +32 -257
  40. package/dist/cjs/runtime/effect/backend-federation.js +11 -139
  41. package/dist/cjs/runtime/effect/handler/batch-handler.js +161 -0
  42. package/dist/cjs/runtime/effect/handler/batch.js +195 -0
  43. package/dist/cjs/runtime/effect/handler/definition.js +101 -0
  44. package/dist/cjs/runtime/effect/handler/envelope.js +104 -0
  45. package/dist/cjs/runtime/effect/handler/http.js +96 -0
  46. package/dist/cjs/runtime/effect/handler/openapi.js +57 -0
  47. package/dist/cjs/runtime/effect/handler/routing.js +100 -0
  48. package/dist/cjs/runtime/effect/handler/rpc.js +63 -0
  49. package/dist/cjs/runtime/effect/handler/types.js +43 -0
  50. package/dist/cjs/runtime/effect/handler.js +35 -526
  51. package/dist/cjs/runtime/effect/rpcSerialization.js +54 -0
  52. package/dist/cjs/runtime/effect-client/batch.js +73 -0
  53. package/dist/cjs/runtime/effect-client/envelope.js +145 -0
  54. package/dist/cjs/runtime/effect-client/guards.js +44 -0
  55. package/dist/cjs/runtime/effect-client/index.js +6 -16
  56. package/dist/cjs/runtime/effect-client/request-context.js +64 -0
  57. package/dist/cjs/runtime/effect-client/request.js +66 -0
  58. package/dist/cjs/runtime/effect-client/runtime.js +12 -178
  59. package/dist/cjs/runtime/effect-client/types.js +18 -0
  60. package/dist/cjs/runtime/safe-failure.js +2 -1
  61. package/dist/cjs/utils/client-generator/files.js +152 -0
  62. package/dist/cjs/utils/client-generator/generate.js +138 -0
  63. package/dist/cjs/utils/client-generator/index.js +83 -0
  64. package/dist/cjs/utils/client-generator/package-json.js +132 -0
  65. package/dist/cjs/utils/client-generator/write-package.js +125 -0
  66. package/dist/cjs/utils/clientGenerator.js +26 -303
  67. package/dist/cjs/utils/effect-client-generator/generator.js +64 -0
  68. package/dist/cjs/utils/effect-client-generator/index.js +51 -0
  69. package/dist/cjs/utils/effect-client-generator/paths.js +73 -0
  70. package/dist/cjs/utils/effect-client-generator/rendering.js +231 -0
  71. package/dist/cjs/utils/effect-client-generator/runtime.js +84 -0
  72. package/dist/cjs/utils/effect-client-generator/types.js +18 -0
  73. package/dist/cjs/utils/effectClientGenerator.js +5 -262
  74. package/dist/esm/cli/compress.mjs +14 -0
  75. package/dist/esm/cli/generator.mjs +98 -0
  76. package/dist/esm/cli/prefix.mjs +9 -0
  77. package/dist/esm/cli/watch.mjs +13 -0
  78. package/dist/esm/cli.mjs +7 -121
  79. package/dist/esm/runtime/data-platform/batch/queue.mjs +246 -0
  80. package/dist/esm/runtime/data-platform/batch/request.mjs +45 -0
  81. package/dist/esm/runtime/data-platform/batch/response.mjs +23 -0
  82. package/dist/esm/runtime/data-platform/batch/telemetry.mjs +23 -0
  83. package/dist/esm/runtime/data-platform/batch/url.mjs +25 -0
  84. package/dist/esm/runtime/data-platform/batch-transport.mjs +12 -0
  85. package/dist/esm/runtime/data-platform/codec.mjs +90 -0
  86. package/dist/esm/runtime/data-platform/index.mjs +6 -610
  87. package/dist/esm/runtime/data-platform/invalidation.mjs +20 -0
  88. package/dist/esm/runtime/data-platform/trace.mjs +29 -0
  89. package/dist/esm/runtime/data-platform/types.mjs +4 -0
  90. package/dist/esm/runtime/data-platform/validation.mjs +128 -0
  91. package/dist/esm/runtime/effect/adapter/constants.mjs +6 -0
  92. package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +23 -0
  93. package/dist/esm/runtime/effect/adapter/entry.mjs +29 -0
  94. package/dist/esm/runtime/effect/adapter/error-response.mjs +41 -0
  95. package/dist/esm/runtime/effect/adapter/handler.mjs +15 -0
  96. package/dist/esm/runtime/effect/adapter.mjs +12 -105
  97. package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
  98. package/dist/esm/runtime/effect/backend-federation/load.mjs +19 -0
  99. package/dist/esm/runtime/effect/backend-federation/plugin.mjs +15 -0
  100. package/dist/esm/runtime/effect/backend-federation/remotes.mjs +12 -0
  101. package/dist/esm/runtime/effect/backend-federation/runtime.mjs +26 -0
  102. package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
  103. package/dist/esm/runtime/effect/backend-federation/utils.mjs +7 -0
  104. package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +32 -0
  105. package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +4 -0
  106. package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +36 -0
  107. package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +42 -0
  108. package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +76 -0
  109. package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +30 -0
  110. package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
  111. package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +64 -0
  112. package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -237
  113. package/dist/esm/runtime/effect/backend-federation.mjs +4 -132
  114. package/dist/esm/runtime/effect/handler/batch-handler.mjs +123 -0
  115. package/dist/esm/runtime/effect/handler/batch.mjs +124 -0
  116. package/dist/esm/runtime/effect/handler/definition.mjs +60 -0
  117. package/dist/esm/runtime/effect/handler/envelope.mjs +63 -0
  118. package/dist/esm/runtime/effect/handler/http.mjs +58 -0
  119. package/dist/esm/runtime/effect/handler/openapi.mjs +19 -0
  120. package/dist/esm/runtime/effect/handler/routing.mjs +50 -0
  121. package/dist/esm/runtime/effect/handler/rpc.mjs +22 -0
  122. package/dist/esm/runtime/effect/handler/types.mjs +5 -0
  123. package/dist/esm/runtime/effect/handler.mjs +7 -499
  124. package/dist/esm/runtime/effect/rpcSerialization.mjs +16 -0
  125. package/dist/esm/runtime/effect-client/batch.mjs +35 -0
  126. package/dist/esm/runtime/effect-client/envelope.mjs +104 -0
  127. package/dist/esm/runtime/effect-client/guards.mjs +3 -0
  128. package/dist/esm/runtime/effect-client/index.mjs +5 -15
  129. package/dist/esm/runtime/effect-client/request-context.mjs +23 -0
  130. package/dist/esm/runtime/effect-client/request.mjs +28 -0
  131. package/dist/esm/runtime/effect-client/runtime.mjs +12 -178
  132. package/dist/esm/runtime/effect-client/types.mjs +0 -0
  133. package/dist/esm/runtime/safe-failure.mjs +2 -1
  134. package/dist/esm/utils/client-generator/files.mjs +68 -0
  135. package/dist/esm/utils/client-generator/generate.mjs +88 -0
  136. package/dist/esm/utils/client-generator/index.mjs +4 -0
  137. package/dist/esm/utils/client-generator/package-json.mjs +78 -0
  138. package/dist/esm/utils/client-generator/write-package.mjs +74 -0
  139. package/dist/esm/utils/clientGenerator.mjs +2 -293
  140. package/dist/esm/utils/effect-client-generator/generator.mjs +23 -0
  141. package/dist/esm/utils/effect-client-generator/index.mjs +3 -0
  142. package/dist/esm/utils/effect-client-generator/paths.mjs +25 -0
  143. package/dist/esm/utils/effect-client-generator/rendering.mjs +180 -0
  144. package/dist/esm/utils/effect-client-generator/runtime.mjs +33 -0
  145. package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
  146. package/dist/esm/utils/effectClientGenerator.mjs +1 -249
  147. package/dist/esm-node/cli/compress.mjs +15 -0
  148. package/dist/esm-node/cli/generator.mjs +99 -0
  149. package/dist/esm-node/cli/prefix.mjs +10 -0
  150. package/dist/esm-node/cli/watch.mjs +14 -0
  151. package/dist/esm-node/cli.mjs +7 -121
  152. package/dist/esm-node/runtime/data-platform/batch/queue.mjs +247 -0
  153. package/dist/esm-node/runtime/data-platform/batch/request.mjs +46 -0
  154. package/dist/esm-node/runtime/data-platform/batch/response.mjs +24 -0
  155. package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +24 -0
  156. package/dist/esm-node/runtime/data-platform/batch/url.mjs +26 -0
  157. package/dist/esm-node/runtime/data-platform/batch-transport.mjs +13 -0
  158. package/dist/esm-node/runtime/data-platform/codec.mjs +91 -0
  159. package/dist/esm-node/runtime/data-platform/index.mjs +6 -610
  160. package/dist/esm-node/runtime/data-platform/invalidation.mjs +21 -0
  161. package/dist/esm-node/runtime/data-platform/trace.mjs +30 -0
  162. package/dist/esm-node/runtime/data-platform/types.mjs +5 -0
  163. package/dist/esm-node/runtime/data-platform/validation.mjs +129 -0
  164. package/dist/esm-node/runtime/effect/adapter/constants.mjs +7 -0
  165. package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +24 -0
  166. package/dist/esm-node/runtime/effect/adapter/entry.mjs +30 -0
  167. package/dist/esm-node/runtime/effect/adapter/error-response.mjs +42 -0
  168. package/dist/esm-node/runtime/effect/adapter/handler.mjs +16 -0
  169. package/dist/esm-node/runtime/effect/adapter.mjs +12 -105
  170. package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
  171. package/dist/esm-node/runtime/effect/backend-federation/load.mjs +20 -0
  172. package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +16 -0
  173. package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +13 -0
  174. package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +27 -0
  175. package/dist/esm-node/runtime/effect/backend-federation/types.mjs +1 -0
  176. package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +8 -0
  177. package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +33 -0
  178. package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +5 -0
  179. package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +37 -0
  180. package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +43 -0
  181. package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +77 -0
  182. package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +31 -0
  183. package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +1 -0
  184. package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +65 -0
  185. package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +1 -237
  186. package/dist/esm-node/runtime/effect/backend-federation.mjs +4 -132
  187. package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +124 -0
  188. package/dist/esm-node/runtime/effect/handler/batch.mjs +125 -0
  189. package/dist/esm-node/runtime/effect/handler/definition.mjs +61 -0
  190. package/dist/esm-node/runtime/effect/handler/envelope.mjs +64 -0
  191. package/dist/esm-node/runtime/effect/handler/http.mjs +59 -0
  192. package/dist/esm-node/runtime/effect/handler/openapi.mjs +20 -0
  193. package/dist/esm-node/runtime/effect/handler/routing.mjs +51 -0
  194. package/dist/esm-node/runtime/effect/handler/rpc.mjs +23 -0
  195. package/dist/esm-node/runtime/effect/handler/types.mjs +6 -0
  196. package/dist/esm-node/runtime/effect/handler.mjs +7 -499
  197. package/dist/esm-node/runtime/effect/rpcSerialization.mjs +17 -0
  198. package/dist/esm-node/runtime/effect-client/batch.mjs +36 -0
  199. package/dist/esm-node/runtime/effect-client/envelope.mjs +105 -0
  200. package/dist/esm-node/runtime/effect-client/guards.mjs +4 -0
  201. package/dist/esm-node/runtime/effect-client/index.mjs +5 -15
  202. package/dist/esm-node/runtime/effect-client/request-context.mjs +24 -0
  203. package/dist/esm-node/runtime/effect-client/request.mjs +29 -0
  204. package/dist/esm-node/runtime/effect-client/runtime.mjs +12 -178
  205. package/dist/esm-node/runtime/effect-client/types.mjs +1 -0
  206. package/dist/esm-node/runtime/safe-failure.mjs +2 -1
  207. package/dist/esm-node/utils/client-generator/files.mjs +69 -0
  208. package/dist/esm-node/utils/client-generator/generate.mjs +89 -0
  209. package/dist/esm-node/utils/client-generator/index.mjs +5 -0
  210. package/dist/esm-node/utils/client-generator/package-json.mjs +79 -0
  211. package/dist/esm-node/utils/client-generator/write-package.mjs +75 -0
  212. package/dist/esm-node/utils/clientGenerator.mjs +2 -293
  213. package/dist/esm-node/utils/effect-client-generator/generator.mjs +24 -0
  214. package/dist/esm-node/utils/effect-client-generator/index.mjs +4 -0
  215. package/dist/esm-node/utils/effect-client-generator/paths.mjs +26 -0
  216. package/dist/esm-node/utils/effect-client-generator/rendering.mjs +181 -0
  217. package/dist/esm-node/utils/effect-client-generator/runtime.mjs +35 -0
  218. package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
  219. package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
  220. package/dist/types/cli/compress.d.ts +2 -0
  221. package/dist/types/cli/generator.d.ts +7 -0
  222. package/dist/types/cli/prefix.d.ts +2 -0
  223. package/dist/types/cli/watch.d.ts +1 -0
  224. package/dist/types/cli.d.ts +0 -1
  225. package/dist/types/runtime/data-platform/batch/queue.d.ts +25 -0
  226. package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
  227. package/dist/types/runtime/data-platform/batch/response.d.ts +4 -0
  228. package/dist/types/runtime/data-platform/batch/telemetry.d.ts +4 -0
  229. package/dist/types/runtime/data-platform/batch/url.d.ts +4 -0
  230. package/dist/types/runtime/data-platform/batch-transport.d.ts +3 -0
  231. package/dist/types/runtime/data-platform/codec.d.ts +17 -0
  232. package/dist/types/runtime/data-platform/index.d.ts +7 -191
  233. package/dist/types/runtime/data-platform/invalidation.d.ts +8 -0
  234. package/dist/types/runtime/data-platform/trace.d.ts +4 -0
  235. package/dist/types/runtime/data-platform/types.d.ts +146 -0
  236. package/dist/types/runtime/data-platform/validation.d.ts +29 -0
  237. package/dist/types/runtime/effect/adapter/constants.d.ts +1 -0
  238. package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +4 -0
  239. package/dist/types/runtime/effect/adapter/entry.d.ts +2 -0
  240. package/dist/types/runtime/effect/adapter/error-response.d.ts +2 -0
  241. package/dist/types/runtime/effect/adapter/handler.d.ts +4 -0
  242. package/dist/types/runtime/effect/adapter.d.ts +4 -13
  243. package/dist/types/runtime/effect/backend-federation/entry.d.ts +2 -0
  244. package/dist/types/runtime/effect/backend-federation/load.d.ts +2 -0
  245. package/dist/types/runtime/effect/backend-federation/plugin.d.ts +3 -0
  246. package/dist/types/runtime/effect/backend-federation/remotes.d.ts +2 -0
  247. package/dist/types/runtime/effect/backend-federation/runtime.d.ts +3 -0
  248. package/dist/types/runtime/effect/backend-federation/types.d.ts +58 -0
  249. package/dist/types/runtime/effect/backend-federation/utils.d.ts +2 -0
  250. package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +11 -0
  251. package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +6 -0
  252. package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +3 -0
  253. package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +18 -0
  254. package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +3 -0
  255. package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +3 -0
  256. package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +51 -0
  257. package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +5 -0
  258. package/dist/types/runtime/effect/backend-federation-manifest.d.ts +1 -60
  259. package/dist/types/runtime/effect/backend-federation.d.ts +6 -60
  260. package/dist/types/runtime/effect/handler/batch-handler.d.ts +11 -0
  261. package/dist/types/runtime/effect/handler/batch.d.ts +17 -0
  262. package/dist/types/runtime/effect/handler/definition.d.ts +17 -0
  263. package/dist/types/runtime/effect/handler/envelope.d.ts +13 -0
  264. package/dist/types/runtime/effect/handler/http.d.ts +14 -0
  265. package/dist/types/runtime/effect/handler/openapi.d.ts +4 -0
  266. package/dist/types/runtime/effect/handler/routing.d.ts +5 -0
  267. package/dist/types/runtime/effect/handler/rpc.d.ts +7 -0
  268. package/dist/types/runtime/effect/handler/types.d.ts +148 -0
  269. package/dist/types/runtime/effect/handler.d.ts +3 -173
  270. package/dist/types/runtime/effect/rpcSerialization.d.ts +3 -0
  271. package/dist/types/runtime/effect-client/batch.d.ts +2 -0
  272. package/dist/types/runtime/effect-client/envelope.d.ts +15 -0
  273. package/dist/types/runtime/effect-client/guards.d.ts +2 -0
  274. package/dist/types/runtime/effect-client/request-context.d.ts +3 -0
  275. package/dist/types/runtime/effect-client/request.d.ts +1 -0
  276. package/dist/types/runtime/effect-client/runtime.d.ts +2 -68
  277. package/dist/types/runtime/effect-client/types.d.ts +68 -0
  278. package/dist/types/utils/client-generator/files.d.ts +28 -0
  279. package/dist/types/utils/client-generator/generate.d.ts +26 -0
  280. package/dist/types/utils/client-generator/index.d.ts +7 -0
  281. package/dist/types/utils/client-generator/package-json.d.ts +16 -0
  282. package/dist/types/utils/client-generator/write-package.d.ts +6 -0
  283. package/dist/types/utils/clientGenerator.d.ts +2 -37
  284. package/dist/types/utils/crossProjectServerPolicy.d.ts +3 -2
  285. package/dist/types/utils/effect-client-generator/generator.d.ts +10 -0
  286. package/dist/types/utils/effect-client-generator/index.d.ts +4 -0
  287. package/dist/types/utils/effect-client-generator/paths.d.ts +5 -0
  288. package/dist/types/utils/effect-client-generator/rendering.d.ts +4 -0
  289. package/dist/types/utils/effect-client-generator/runtime.d.ts +8 -0
  290. package/dist/types/utils/effect-client-generator/types.d.ts +26 -0
  291. package/dist/types/utils/effectClientGenerator.d.ts +2 -41
  292. package/package.json +12 -12
@@ -1,251 +1,2 @@
1
- import __rslib_shim_module__ from "node:module";
2
- const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
- import { deriveOperationVersion } from "@modern-js/bff-core";
4
- import { compatibleRequire, findExists, fs, logger } from "@modern-js/utils";
5
- import path from "path";
6
- import { collectEffectEndpoints, createEffectEndpointContractHash, ensureLeadingSlash, extractHttpApiFromModule, normalizeEffectPrefix } from "../runtime/effect/endpoint-contracts.mjs";
7
- const JS_OR_TS_EXTS = [
8
- '.js',
9
- '.jsx',
10
- '.ts',
11
- '.tsx',
12
- '.mjs',
13
- '.mts',
14
- '.cjs',
15
- '.cts'
16
- ];
17
- const DEFAULT_REQUEST_CREATOR = '@modern-js/plugin-bff/client';
18
- const EFFECT_CLIENT_RUNTIME_IMPORT = '@modern-js/plugin-bff/effect-client-runtime';
19
- let httpApiRuntimePromise;
20
- function isRecord(value) {
21
- return 'object' == typeof value && null !== value;
22
- }
23
- function isAbsoluteUrl(value) {
24
- try {
25
- new URL(value);
26
- return true;
27
- } catch {
28
- return false;
29
- }
30
- }
31
- function resolveBatchEndpoint(prefix, endpoint) {
32
- const value = endpoint || '/_data/batch';
33
- if (isAbsoluteUrl(value)) return value;
34
- const normalizedPrefix = normalizeEffectPrefix(prefix);
35
- const normalizedEndpoint = ensureLeadingSlash(value);
36
- if (!normalizedPrefix) return normalizedEndpoint;
37
- if (normalizedEndpoint === normalizedPrefix || normalizedEndpoint.startsWith(`${normalizedPrefix}/`)) return normalizedEndpoint;
38
- return `${normalizedPrefix}${'/' === normalizedEndpoint ? '' : normalizedEndpoint}`;
39
- }
40
- function getPackageInfo(appDir) {
41
- try {
42
- const packageJsonPath = path.resolve(appDir, './package.json');
43
- const packageJson = fs.readJSONSync(packageJsonPath);
44
- return {
45
- name: packageJson.name,
46
- version: packageJson.version
47
- };
48
- } catch {
49
- return {};
50
- }
51
- }
52
- async function getHttpApiRuntime() {
53
- if (!httpApiRuntimePromise) httpApiRuntimePromise = (async ()=>{
54
- let mod;
55
- try {
56
- mod = await compatibleRequire('effect/unstable/httpapi', false);
57
- } catch (error) {
58
- const message = error instanceof Error ? error.message : String(error);
59
- if (!message.includes("Cannot find module 'effect/unstable/httpapi'")) throw error;
60
- const effectPackageJson = require.resolve('effect/package.json');
61
- const effectHttpApiRuntimePath = path.join(path.dirname(effectPackageJson), 'dist', 'unstable', 'httpapi', 'index.js');
62
- mod = await compatibleRequire(effectHttpApiRuntimePath, false);
63
- }
64
- if (isRecord(mod) && isRecord(mod.HttpApi)) {
65
- const maybeHttpApi = mod.HttpApi;
66
- if ('function' == typeof maybeHttpApi.isHttpApi && 'function' == typeof maybeHttpApi.reflect) return maybeHttpApi;
67
- }
68
- throw new Error('[BFF][Effect] Unable to resolve HttpApi runtime from effect/unstable/httpapi.');
69
- })();
70
- return httpApiRuntimePromise;
71
- }
72
- async function loadEffectApi(resourcePath) {
73
- const httpApiRuntime = await getHttpApiRuntime();
74
- const mod = await compatibleRequire(resourcePath, false);
75
- return extractHttpApiFromModule(mod, httpApiRuntime.isHttpApi);
76
- }
77
- function renderEffectClientCode(endpoints, options) {
78
- const requestCreator = options.requestCreator || DEFAULT_REQUEST_CREATOR;
79
- const httpMethodDecider = options.httpMethodDecider || 'functionName';
80
- const packageInfo = getPackageInfo(options.appDir);
81
- const packageName = packageInfo.name;
82
- const dataPlatformAppNamespace = packageName || 'unknown-app';
83
- const requestId = 'bundle' === options.target ? packageName || process.env.npm_package_name : void 0;
84
- const normalizedRequestId = requestId || 'default';
85
- const operationVersion = deriveOperationVersion(packageInfo.version);
86
- const batchConfig = options.dataPlatformBatch;
87
- const batchEndpoint = resolveBatchEndpoint(options.prefix, batchConfig?.endpoint);
88
- const manifest = {
89
- endpoints: endpoints.map((endpoint)=>({
90
- apiId: endpoint.apiId,
91
- group: endpoint.groupName,
92
- endpoint: endpoint.endpointName,
93
- method: endpoint.method,
94
- routePath: endpoint.routePath,
95
- schemaHash: createEffectEndpointContractHash(endpoint, normalizedRequestId),
96
- operationVersion
97
- }))
98
- };
99
- const config = {
100
- appNamespace: dataPlatformAppNamespace,
101
- ...requestId ? {
102
- requestId
103
- } : {},
104
- port: options.port,
105
- useEnvPort: 'server' === options.target,
106
- defaultOrigin: `http://localhost:${String(options.port)}`,
107
- httpMethodDecider,
108
- batch: {
109
- enabled: batchConfig?.enabled ?? true,
110
- endpoint: batchEndpoint,
111
- flushIntervalMs: batchConfig?.flushIntervalMs ?? 8,
112
- maxBatchSize: batchConfig?.maxBatchSize ?? 16,
113
- maxBatchBytes: batchConfig?.maxBatchBytes ?? 65536,
114
- requestTimeoutMs: batchConfig?.requestTimeoutMs ?? 10000,
115
- allowedMethods: batchConfig?.allowedMethods && batchConfig.allowedMethods.length > 0 ? batchConfig.allowedMethods : [
116
- 'GET'
117
- ]
118
- }
119
- };
120
- return `import * as __requestRuntime from ${JSON.stringify(requestCreator)};
121
- import { createGeneratedEffectClient } from ${JSON.stringify(EFFECT_CLIENT_RUNTIME_IMPORT)};
122
-
123
- const __manifest = ${JSON.stringify(manifest, null, 2)};
124
-
125
- const __config = ${JSON.stringify(config, null, 2)};
126
-
127
- const __generated = createGeneratedEffectClient(__manifest, __config, __requestRuntime);
128
-
129
- const client = __generated.client;
130
- const operationManifest = __generated.operationManifest;
131
- const createEffectRequestContext = __generated.createEffectRequestContext;
132
- const apiModule = {
133
- client,
134
- operationManifest,
135
- createEffectRequestContext,
136
- };
137
-
138
- export { client, createEffectRequestContext, operationManifest };
139
- export default apiModule;
140
- `;
141
- }
142
- function renderClientShape(endpoints, valueType) {
143
- if (0 === endpoints.length) return `Record<string, Record<string, ${valueType}>>`;
144
- const groups = new Map();
145
- for (const endpoint of endpoints){
146
- const group = groups.get(endpoint.groupName) || [];
147
- group.push(endpoint.endpointName);
148
- groups.set(endpoint.groupName, group);
149
- }
150
- const groupEntries = [
151
- ...groups.entries()
152
- ].map(([groupName, names])=>{
153
- const endpointEntries = names.map((name)=>` ${JSON.stringify(name)}: ${valueType};`).join('\n');
154
- return ` ${JSON.stringify(groupName)}: {\n${endpointEntries}\n };`;
155
- });
156
- return `{\n${groupEntries.join('\n')}\n}`;
157
- }
158
- function renderEffectClientDeclaration(endpoints = []) {
159
- return `export type EffectClientOperation = (
160
- request?: unknown,
161
- ) => Promise<unknown>;
162
- export type EffectClientGroup = Record<string, EffectClientOperation>;
163
- export type EffectClient = Record<string, EffectClientGroup>;
164
- export type EffectOperationDescriptor = {
165
- appNamespace: string;
166
- apiId: string;
167
- group: string;
168
- endpoint: string;
169
- operationId: string;
170
- routePath: string;
171
- method: string;
172
- operationVersion: number;
173
- schemaHash: string;
174
- version: number;
175
- };
176
- export type EffectOperationManifest = Record<
177
- string,
178
- Record<string, EffectOperationDescriptor>
179
- >;
180
- export type EffectOperationContext = {
181
- requestId?: string;
182
- operationId?: string;
183
- routePath?: string;
184
- method?: string;
185
- schemaHash?: string;
186
- operationVersion?: number;
187
- locale?: string;
188
- traceparent?: string;
189
- traceId?: string;
190
- spanId?: string;
191
- source?: string;
192
- scope?: Record<string, unknown>;
193
- sessionClaims?: Record<string, unknown>;
194
- attributes?: Record<string, unknown>;
195
- };
196
- export type EffectRequestContext = {
197
- headers?: Record<string, string>;
198
- locale?: string;
199
- operationContext?: EffectOperationContext;
200
- traceparent?: string;
201
- traceId?: string;
202
- spanId?: string;
203
- };
204
- export type GeneratedEffectClient = ${renderClientShape(endpoints, 'EffectClientOperation')};
205
- export type GeneratedEffectOperationManifest = ${renderClientShape(endpoints, "EffectOperationDescriptor")};
206
-
207
- export declare const client: GeneratedEffectClient;
208
- export declare const createEffectRequestContext: (
209
- requestContext: Record<string, unknown>,
210
- ) => EffectRequestContext;
211
- export declare const operationManifest: GeneratedEffectOperationManifest;
212
- declare const apiModule: {
213
- client: GeneratedEffectClient;
214
- createEffectRequestContext: typeof createEffectRequestContext;
215
- operationManifest: GeneratedEffectOperationManifest;
216
- };
217
-
218
- export default apiModule;
219
- `;
220
- }
221
- async function generateEffectClient(options) {
222
- const api = await loadEffectApi(options.resourcePath);
223
- if (!api) {
224
- logger.warn(`[BFF][Effect] Failed to generate client for ${options.resourcePath}: unable to resolve exported HttpApi.`);
225
- return null;
226
- }
227
- const httpApiRuntime = await getHttpApiRuntime();
228
- const endpoints = collectEffectEndpoints(httpApiRuntime.reflect, api, options.prefix);
229
- return {
230
- code: renderEffectClientCode(endpoints, options),
231
- declaration: renderEffectClientDeclaration(endpoints),
232
- endpoints
233
- };
234
- }
235
- async function generateEffectClientCode(options) {
236
- const artifacts = await generateEffectClient(options);
237
- return artifacts ? artifacts.code : null;
238
- }
239
- function resolveEffectEntryFile(options) {
240
- const { appDir, apiDir, effectEntry } = options;
241
- const resolveEntry = (entryWithoutExt)=>{
242
- if (path.extname(entryWithoutExt)) return fs.existsSync(entryWithoutExt) ? entryWithoutExt : void 0;
243
- return findExists(JS_OR_TS_EXTS.map((ext)=>`${entryWithoutExt}${ext}`));
244
- };
245
- if (effectEntry) {
246
- const entryWithoutExt = path.isAbsolute(effectEntry) ? effectEntry : path.resolve(appDir, effectEntry);
247
- return resolveEntry(entryWithoutExt);
248
- }
249
- return resolveEntry(path.resolve(apiDir, 'index'));
250
- }
251
- export { generateEffectClient, generateEffectClientCode, renderEffectClientDeclaration, resolveEffectEntryFile };
1
+ import "node:module";
2
+ export { generateEffectClient, generateEffectClientCode, renderEffectClientDeclaration, resolveEffectEntryFile } from "./effect-client-generator/index.mjs";
@@ -0,0 +1,2 @@
1
+ import type { ToolsDevServerConfig } from '@modern-js/builder';
2
+ export declare const createCompressConfig: (devServer: ToolsDevServerConfig | undefined, prefix: string | string[] | undefined) => false | import("@rsbuild/core").CompressOptions | undefined;
@@ -0,0 +1,7 @@
1
+ import type { AppTools } from '@modern-js/app-tools';
2
+ import type { CLIPluginAPI } from '@modern-js/plugin';
3
+ export declare const createBffGenerator: (api: CLIPluginAPI<AppTools>) => {
4
+ compileApi: () => Promise<void>;
5
+ generate: () => Promise<void>;
6
+ handleCrossProjectInvocation: (isBuild?: boolean) => Promise<void>;
7
+ };
@@ -0,0 +1,2 @@
1
+ export declare const normalizePrefixList: (prefix: string | string[] | undefined) => string[];
2
+ export declare const getPrimaryPrefix: (prefix: string | string[] | undefined) => string;
@@ -0,0 +1 @@
1
+ export declare const isWatchableBffFile: (filename: string) => boolean;
@@ -1,3 +1,2 @@
1
1
  import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
2
  export declare const bffPlugin: () => CliPlugin<AppTools>;
3
- export default bffPlugin;
@@ -0,0 +1,25 @@
1
+ import type { DataBatchRequestItem, DataBatchTransportOptions, DataTransportRequestInfo } from '../types';
2
+ type DataBatchFetch = NonNullable<DataBatchTransportOptions['fetch']>;
3
+ type CreateBatchTransportQueueOptions = {
4
+ options: DataBatchTransportOptions;
5
+ baseFetch: DataBatchFetch;
6
+ };
7
+ export type QueuedBatchRequest = {
8
+ key: string;
9
+ endpoint: string;
10
+ requestUrl: string;
11
+ requestInit: RequestInit;
12
+ item: DataBatchRequestItem;
13
+ size: number;
14
+ resolve: (value: unknown) => void;
15
+ reject: (reason: unknown) => void;
16
+ };
17
+ export type BatchBucket = {
18
+ items: QueuedBatchRequest[];
19
+ bytes: number;
20
+ timer: ReturnType<typeof setTimeout> | null;
21
+ flushing: boolean;
22
+ };
23
+ export declare function ensureBucket(buckets: Map<string, BatchBucket>, endpoint: string): BatchBucket;
24
+ export declare function createBatchTransportQueue({ options, baseFetch, }: CreateBatchTransportQueueOptions): (input: DataTransportRequestInfo, init?: RequestInit) => Promise<any>;
25
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare function toHeaderRecord(headers: HeadersInit | undefined): Record<string, string>;
2
+ export declare function measureTextBytes(value: string): number;
3
+ export declare function createBatchId(): string;
4
+ export declare function normalizeMethod(method: string | undefined): string;
5
+ export declare function toRequestBody(initBody: BodyInit | null | undefined): string | undefined;
6
+ export declare function shouldBatchRequest(input: {
7
+ method: string;
8
+ body: string | undefined;
9
+ headers: Record<string, string>;
10
+ allowedMethods: Set<string>;
11
+ batchEndpoint: string;
12
+ requestUrl: URL;
13
+ }): boolean;
@@ -0,0 +1,4 @@
1
+ import type { DataBatchResponseItem, DataBatchResponsePayload } from '../types';
2
+ export declare function isBatchResponseItem(value: unknown): value is DataBatchResponseItem;
3
+ export declare function isBatchResponsePayload(value: unknown): value is DataBatchResponsePayload;
4
+ export declare function parseResponseLikeCreateRequest(response: Response): Promise<any>;
@@ -0,0 +1,4 @@
1
+ import type { DataBatchTransportEvent, DataBatchTransportTelemetryAttributes } from '../types';
2
+ export declare const DATA_BATCH_TRANSPORT_OTEL_EVENT = "modernjs.data.batch";
3
+ export declare function createDataBatchTransportTelemetryAttributes(event: DataBatchTransportEvent): DataBatchTransportTelemetryAttributes;
4
+ export declare function emitDataBatchTransportEvent(onEvent: ((event: DataBatchTransportEvent) => void) | undefined, event: DataBatchTransportEvent): void;
@@ -0,0 +1,4 @@
1
+ import type { DataTransportRequestInfo } from '../types';
2
+ export declare function resolveRuntimeOrigin(): string;
3
+ export declare function toAbsoluteUrl(input: DataTransportRequestInfo): URL;
4
+ export declare function normalizeBatchEndpoint(requestUrl: URL, endpoint: string | undefined): URL;
@@ -0,0 +1,3 @@
1
+ import type { DataBatchTransportOptions } from './types';
2
+ export { createDataBatchTransportTelemetryAttributes, DATA_BATCH_TRANSPORT_OTEL_EVENT, emitDataBatchTransportEvent, } from './batch/telemetry';
3
+ export declare function createDataBatchTransport(options?: DataBatchTransportOptions): (input: import("./types").DataTransportRequestInfo, init?: RequestInit) => Promise<any>;
@@ -0,0 +1,17 @@
1
+ import type { CacheScope, DataRequestMode, OperationDescriptor, RequestEnvelope, SelectionPlan } from './types';
2
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
3
+ export declare function stableStringify(value: unknown): string;
4
+ export declare function encodeRequestEnvelopeHeader(envelope: RequestEnvelope): string;
5
+ export declare function decodeRequestEnvelopeHeader(value: string): RequestEnvelope | null;
6
+ export declare function hashString(value: string): string;
7
+ export declare function sanitizeSegment(segment: string): string;
8
+ export declare function normalizeOrigin(origin: string): string;
9
+ export declare function createOperationId(input: OperationDescriptor): string;
10
+ export declare function buildScopeKey(scope: CacheScope): string;
11
+ export declare function buildQueryKey(input: {
12
+ operationId: string;
13
+ scopeKey: string;
14
+ requestMode?: DataRequestMode;
15
+ requestInput?: unknown;
16
+ selectionPlan?: SelectionPlan;
17
+ }): string;
@@ -1,191 +1,7 @@
1
- export type DataRequestMode = 'cache-first' | 'stale-while-revalidate' | 'network-only';
2
- export type DataMutationMode = 'optimistic' | 'pessimistic' | 'fire-and-forget';
3
- export type SelectionPlan = {
4
- [field: string]: true | SelectionPlan;
5
- };
6
- export interface OperationDescriptor {
7
- appNamespace: string;
8
- apiId: string;
9
- group: string;
10
- endpoint: string;
11
- schemaHash?: string;
12
- version?: number;
13
- }
14
- export interface CacheScope {
15
- appNamespace: string;
16
- origin: string;
17
- tenantId?: string;
18
- userId?: string;
19
- sessionId?: string;
20
- }
21
- export interface TraceContext {
22
- traceId: string;
23
- spanId: string;
24
- sampled: boolean;
25
- parentSpanId?: string;
26
- }
27
- export interface RequestEnvelope<Input = unknown> {
28
- protocolVersion: 1;
29
- operationId: string;
30
- appNamespace: string;
31
- origin: string;
32
- requestMode: DataRequestMode;
33
- mutationMode?: DataMutationMode;
34
- scopeKey: string;
35
- input: Input;
36
- inputHash: string;
37
- selectionPlan?: SelectionPlan;
38
- selectionHash?: string;
39
- traceparent?: string;
40
- timestamp: number;
41
- }
42
- export interface HydrationEnvelope<Payload = unknown> {
43
- protocolVersion: 1;
44
- runtimeVersion: string;
45
- appNamespace: string;
46
- origin: string;
47
- createdAt: number;
48
- payload: Payload;
49
- checksum: string;
50
- }
51
- export interface InvalidationEvent {
52
- sourceNamespace: string;
53
- sourceOperationId: string;
54
- scopeKey: string;
55
- targetNamespaces?: string[];
56
- targetOperationIds?: string[];
57
- }
58
- export interface InvalidationSubscriber {
59
- namespace: string;
60
- operationIds?: string[];
61
- scopeKey?: string;
62
- acceptCrossNamespace?: boolean;
63
- }
64
- export interface DataBatchRequestItem {
65
- id: string;
66
- path: string;
67
- method: string;
68
- headers?: Record<string, string>;
69
- body?: string;
70
- }
71
- export interface DataBatchRequestPayload {
72
- protocolVersion: 1;
73
- batchId: string;
74
- sentAt: number;
75
- items: DataBatchRequestItem[];
76
- }
77
- export interface DataBatchResponseItem {
78
- id: string;
79
- status: number;
80
- headers?: Record<string, string>;
81
- body?: string;
82
- }
83
- export interface DataBatchResponsePayload {
84
- protocolVersion: 1;
85
- batchId: string;
86
- receivedAt: number;
87
- items: DataBatchResponseItem[];
88
- }
89
- export interface DataBatchTransportEvent {
90
- type: 'enqueue' | 'flush' | 'fallback' | 'disable';
91
- endpoint: string;
92
- batchId?: string;
93
- size?: number;
94
- reason?: string;
95
- }
96
- export type DataBatchTransportTelemetryAttributes = Record<string, string | number | boolean>;
97
- export interface DataBatchTransportOptions {
98
- endpoint?: string;
99
- fetch?: (input: DataTransportRequestInfo, init?: RequestInit) => Promise<Response>;
100
- flushIntervalMs?: number;
101
- maxBatchSize?: number;
102
- maxBatchBytes?: number;
103
- requestTimeoutMs?: number;
104
- allowedMethods?: string[];
105
- onEvent?: (event: DataBatchTransportEvent) => void;
106
- }
107
- export declare const DATA_BATCH_TRANSPORT_OTEL_EVENT = "modernjs.data.batch";
108
- export declare function createDataBatchTransportTelemetryAttributes(event: DataBatchTransportEvent): DataBatchTransportTelemetryAttributes;
109
- export declare function emitDataBatchTransportEvent(onEvent: ((event: DataBatchTransportEvent) => void) | undefined, event: DataBatchTransportEvent): void;
110
- export interface SelectionPlanValidationOptions {
111
- maxDepth?: number;
112
- maxFields?: number;
113
- allowedLeafPaths?: ReadonlyArray<string>;
114
- }
115
- export interface SelectionPlanValidationResult {
116
- ok: boolean;
117
- errors: string[];
118
- stats: {
119
- maxDepth: number;
120
- fieldCount: number;
121
- };
122
- }
123
- export interface RequestEnvelopeValidationOptions {
124
- expectedProtocolVersion?: number;
125
- expectedNamespace?: string;
126
- expectedOrigin?: string;
127
- requireTraceContext?: boolean;
128
- }
129
- export interface HydrationEnvelopeValidationOptions {
130
- expectedProtocolVersion?: number;
131
- expectedNamespace?: string;
132
- expectedOrigin?: string;
133
- expectedRuntimeVersion?: string;
134
- }
135
- export declare const DEFAULT_DATA_ENVELOPE_HEADER = "x-modernjs-data-envelope";
136
- export declare const DEFAULT_DATA_BATCH_ENDPOINT = "/_data/batch";
137
- export declare const DEFAULT_DATA_BATCH_HEADER = "x-modernjs-data-batch";
138
- type DataTransportRequestInfo = string | URL | Request;
139
- export declare function stableStringify(value: unknown): string;
140
- export declare function encodeRequestEnvelopeHeader(envelope: RequestEnvelope): string;
141
- export declare function decodeRequestEnvelopeHeader(value: string): RequestEnvelope | null;
142
- export declare function normalizeOrigin(origin: string): string;
143
- export declare function createOperationId(input: OperationDescriptor): string;
144
- export declare function buildScopeKey(scope: CacheScope): string;
145
- export declare function buildQueryKey(input: {
146
- operationId: string;
147
- scopeKey: string;
148
- requestMode?: DataRequestMode;
149
- requestInput?: unknown;
150
- selectionPlan?: SelectionPlan;
151
- }): string;
152
- export declare function parseTraceparentHeader(header: string): TraceContext | null;
153
- export declare function formatTraceparentHeader(trace: TraceContext): string;
154
- export declare function deriveChildTraceContext(parent: TraceContext, childSpanId: string): TraceContext;
155
- export declare function validateSelectionPlan(plan: SelectionPlan, options?: SelectionPlanValidationOptions): SelectionPlanValidationResult;
156
- export declare function createRequestEnvelope<Input>(input: {
157
- operation: OperationDescriptor;
158
- scope: CacheScope;
159
- requestInput: Input;
160
- selectionPlan?: SelectionPlan;
161
- requestMode?: DataRequestMode;
162
- mutationMode?: DataMutationMode;
163
- traceContext?: TraceContext;
164
- requireTraceContext?: boolean;
165
- timestamp?: number;
166
- protocolVersion?: 1;
167
- }): RequestEnvelope<Input>;
168
- export declare function validateRequestEnvelope(envelope: RequestEnvelope, options?: RequestEnvelopeValidationOptions): {
169
- ok: boolean;
170
- errors: string[];
171
- };
172
- export declare function createHydrationEnvelope<Payload>(input: {
173
- runtimeVersion: string;
174
- scope: Pick<CacheScope, 'appNamespace' | 'origin'>;
175
- payload: Payload;
176
- createdAt?: number;
177
- protocolVersion?: 1;
178
- }): HydrationEnvelope<Payload>;
179
- export declare function validateHydrationEnvelope(envelope: HydrationEnvelope, options?: HydrationEnvelopeValidationOptions): {
180
- ok: boolean;
181
- errors: string[];
182
- };
183
- export declare function createInvalidationEvent(input: {
184
- sourceOperation: OperationDescriptor;
185
- sourceScope: CacheScope;
186
- targetNamespaces?: string[];
187
- targetOperations?: OperationDescriptor[];
188
- }): InvalidationEvent;
189
- export declare function shouldApplyInvalidation(event: InvalidationEvent, subscriber: InvalidationSubscriber): boolean;
190
- export declare function createDataBatchTransport(options?: DataBatchTransportOptions): (input: DataTransportRequestInfo, init?: RequestInit) => Promise<any>;
191
- export {};
1
+ export { createDataBatchTransport, createDataBatchTransportTelemetryAttributes, DATA_BATCH_TRANSPORT_OTEL_EVENT, emitDataBatchTransportEvent, } from './batch-transport';
2
+ export { buildQueryKey, buildScopeKey, createOperationId, decodeRequestEnvelopeHeader, encodeRequestEnvelopeHeader, normalizeOrigin, stableStringify, } from './codec';
3
+ export { createInvalidationEvent, shouldApplyInvalidation, } from './invalidation';
4
+ export { deriveChildTraceContext, formatTraceparentHeader, parseTraceparentHeader, } from './trace';
5
+ export type { CacheScope, DataBatchRequestItem, DataBatchRequestPayload, DataBatchResponseItem, DataBatchResponsePayload, DataBatchTransportEvent, DataBatchTransportOptions, DataBatchTransportTelemetryAttributes, DataMutationMode, DataRequestMode, HydrationEnvelope, HydrationEnvelopeValidationOptions, InvalidationEvent, InvalidationSubscriber, OperationDescriptor, RequestEnvelope, RequestEnvelopeValidationOptions, SelectionPlan, SelectionPlanValidationOptions, SelectionPlanValidationResult, TraceContext, } from './types';
6
+ export { DEFAULT_DATA_BATCH_ENDPOINT, DEFAULT_DATA_BATCH_HEADER, DEFAULT_DATA_ENVELOPE_HEADER, } from './types';
7
+ export { createHydrationEnvelope, createRequestEnvelope, validateHydrationEnvelope, validateRequestEnvelope, validateSelectionPlan, } from './validation';
@@ -0,0 +1,8 @@
1
+ import type { CacheScope, InvalidationEvent, InvalidationSubscriber, OperationDescriptor } from './types';
2
+ export declare function createInvalidationEvent(input: {
3
+ sourceOperation: OperationDescriptor;
4
+ sourceScope: CacheScope;
5
+ targetNamespaces?: string[];
6
+ targetOperations?: OperationDescriptor[];
7
+ }): InvalidationEvent;
8
+ export declare function shouldApplyInvalidation(event: InvalidationEvent, subscriber: InvalidationSubscriber): boolean;
@@ -0,0 +1,4 @@
1
+ import type { TraceContext } from './types';
2
+ export declare function parseTraceparentHeader(header: string): TraceContext | null;
3
+ export declare function formatTraceparentHeader(trace: TraceContext): string;
4
+ export declare function deriveChildTraceContext(parent: TraceContext, childSpanId: string): TraceContext;