@bleedingdev/modern-js-plugin-bff 3.8.3-ultramodern.1 → 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 (340) 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 +9 -6
  14. package/dist/cjs/utils/crossProjectApiPlugin.js +5 -1
  15. package/dist/cjs/utils/pluginGenerator.js +4 -4
  16. package/dist/cjs/utils/runtimeGenerator.js +4 -16
  17. package/dist/esm/cli/generator.mjs +45 -53
  18. package/dist/esm/cli/serverGlobalVars.mjs +1 -1
  19. package/dist/esm/cli.mjs +1 -0
  20. package/dist/esm/loader.mjs +5 -16
  21. package/dist/esm/runtime/data-platform/index.mjs +1 -7
  22. package/dist/esm/runtime/effect/edge-dispatcher.mjs +1 -38
  23. package/dist/esm/runtime/effect/edge.mjs +2 -2
  24. package/dist/esm/runtime/effect/index.mjs +16 -8
  25. package/dist/esm/runtime/effect-client/index.mjs +1 -98
  26. package/dist/esm/runtime/effect-client/runtime.mjs +1 -62
  27. package/dist/esm/runtime/hono/adapter.mjs +13 -54
  28. package/dist/esm/server.mjs +2 -2
  29. package/dist/esm/utils/client-generator/generate.mjs +8 -5
  30. package/dist/esm/utils/crossProjectApiPlugin.mjs +3 -2
  31. package/dist/esm/utils/pluginGenerator.mjs +5 -5
  32. package/dist/esm/utils/runtimeGenerator.mjs +4 -16
  33. package/dist/esm-node/cli/generator.mjs +45 -53
  34. package/dist/esm-node/cli/serverGlobalVars.mjs +1 -1
  35. package/dist/esm-node/cli.mjs +1 -0
  36. package/dist/esm-node/loader.mjs +5 -16
  37. package/dist/esm-node/runtime/data-platform/index.mjs +1 -7
  38. package/dist/esm-node/runtime/effect/edge-dispatcher.mjs +1 -38
  39. package/dist/esm-node/runtime/effect/edge.mjs +2 -2
  40. package/dist/esm-node/runtime/effect/index.mjs +16 -8
  41. package/dist/esm-node/runtime/effect-client/index.mjs +1 -98
  42. package/dist/esm-node/runtime/effect-client/runtime.mjs +1 -62
  43. package/dist/esm-node/runtime/hono/adapter.mjs +13 -54
  44. package/dist/esm-node/server.mjs +2 -2
  45. package/dist/esm-node/utils/client-generator/generate.mjs +8 -5
  46. package/dist/esm-node/utils/crossProjectApiPlugin.mjs +3 -2
  47. package/dist/esm-node/utils/pluginGenerator.mjs +5 -5
  48. package/dist/esm-node/utils/runtimeGenerator.mjs +4 -16
  49. package/dist/types/loader.d.ts +1 -0
  50. package/dist/types/runtime/data-platform/index.d.ts +1 -8
  51. package/dist/types/runtime/effect/edge-dispatcher.d.ts +1 -26
  52. package/dist/types/runtime/effect/edge.d.ts +2 -2
  53. package/dist/types/runtime/effect/index.d.ts +15 -7
  54. package/dist/types/runtime/effect-client/index.d.ts +1 -58
  55. package/dist/types/runtime/effect-client/runtime.d.ts +1 -5
  56. package/dist/types/runtime/hono/adapter.d.ts +1 -11
  57. package/dist/types/utils/client-generator/generate.d.ts +2 -1
  58. package/dist/types/utils/crossProjectApiPlugin.d.ts +1 -0
  59. package/dist/types/utils/pluginGenerator.d.ts +2 -1
  60. package/package.json +29 -28
  61. package/dist/cjs/runtime/data-platform/batch/queue.js +0 -284
  62. package/dist/cjs/runtime/data-platform/batch/request.js +0 -98
  63. package/dist/cjs/runtime/data-platform/batch/response.js +0 -64
  64. package/dist/cjs/runtime/data-platform/batch/telemetry.js +0 -67
  65. package/dist/cjs/runtime/data-platform/batch/url.js +0 -69
  66. package/dist/cjs/runtime/data-platform/batch-transport.js +0 -59
  67. package/dist/cjs/runtime/data-platform/codec.js +0 -155
  68. package/dist/cjs/runtime/data-platform/invalidation.js +0 -61
  69. package/dist/cjs/runtime/data-platform/trace.js +0 -73
  70. package/dist/cjs/runtime/data-platform/types.js +0 -48
  71. package/dist/cjs/runtime/data-platform/validation.js +0 -178
  72. package/dist/cjs/runtime/effect/adapter/constants.js +0 -44
  73. package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +0 -66
  74. package/dist/cjs/runtime/effect/adapter/entry.js +0 -100
  75. package/dist/cjs/runtime/effect/adapter/error-response.js +0 -81
  76. package/dist/cjs/runtime/effect/adapter/handler.js +0 -53
  77. package/dist/cjs/runtime/effect/adapter.js +0 -155
  78. package/dist/cjs/runtime/effect/backend-federation/entry.js +0 -99
  79. package/dist/cjs/runtime/effect/backend-federation/identity.js +0 -82
  80. package/dist/cjs/runtime/effect/backend-federation/load.js +0 -75
  81. package/dist/cjs/runtime/effect/backend-federation/plugin.js +0 -63
  82. package/dist/cjs/runtime/effect/backend-federation/remotes.js +0 -51
  83. package/dist/cjs/runtime/effect/backend-federation/runtime.js +0 -128
  84. package/dist/cjs/runtime/effect/backend-federation/types.js +0 -18
  85. package/dist/cjs/runtime/effect/backend-federation/utils.js +0 -48
  86. package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +0 -83
  87. package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +0 -55
  88. package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +0 -94
  89. package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +0 -101
  90. package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +0 -120
  91. package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +0 -68
  92. package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +0 -18
  93. package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +0 -109
  94. package/dist/cjs/runtime/effect/backend-federation-manifest.js +0 -62
  95. package/dist/cjs/runtime/effect/backend-federation.js +0 -65
  96. package/dist/cjs/runtime/effect/context.js +0 -60
  97. package/dist/cjs/runtime/effect/dispatch.js +0 -101
  98. package/dist/cjs/runtime/effect/edge-context.js +0 -81
  99. package/dist/cjs/runtime/effect/endpoint-contracts.js +0 -121
  100. package/dist/cjs/runtime/effect/entry-shape.js +0 -84
  101. package/dist/cjs/runtime/effect/handler/batch-handler.js +0 -161
  102. package/dist/cjs/runtime/effect/handler/batch.js +0 -159
  103. package/dist/cjs/runtime/effect/handler/definition.js +0 -102
  104. package/dist/cjs/runtime/effect/handler/envelope.js +0 -104
  105. package/dist/cjs/runtime/effect/handler/http.js +0 -107
  106. package/dist/cjs/runtime/effect/handler/openapi.js +0 -57
  107. package/dist/cjs/runtime/effect/handler/routing.js +0 -100
  108. package/dist/cjs/runtime/effect/handler/rpc.js +0 -63
  109. package/dist/cjs/runtime/effect/handler/types.js +0 -43
  110. package/dist/cjs/runtime/effect/handler.js +0 -189
  111. package/dist/cjs/runtime/effect/module.js +0 -113
  112. package/dist/cjs/runtime/effect/operation-context.js +0 -103
  113. package/dist/cjs/runtime/effect/rpcSerialization.js +0 -54
  114. package/dist/cjs/runtime/effect-client/batch.js +0 -73
  115. package/dist/cjs/runtime/effect-client/envelope.js +0 -145
  116. package/dist/cjs/runtime/effect-client/guards.js +0 -44
  117. package/dist/cjs/runtime/effect-client/request-context.js +0 -64
  118. package/dist/cjs/runtime/effect-client/request.js +0 -66
  119. package/dist/cjs/runtime/effect-client/types.js +0 -18
  120. package/dist/cjs/runtime/safe-failure.js +0 -84
  121. package/dist/cjs/utils/crossProjectServerPolicy.js +0 -98
  122. package/dist/cjs/utils/effect-client-generator/generator.js +0 -69
  123. package/dist/cjs/utils/effect-client-generator/index.js +0 -51
  124. package/dist/cjs/utils/effect-client-generator/paths.js +0 -62
  125. package/dist/cjs/utils/effect-client-generator/rendering.js +0 -220
  126. package/dist/cjs/utils/effect-client-generator/runtime.js +0 -68
  127. package/dist/cjs/utils/effect-client-generator/types.js +0 -18
  128. package/dist/cjs/utils/effectClientGenerator.js +0 -49
  129. package/dist/cjs/utils/effectSourceLoader.js +0 -312
  130. package/dist/cjs/utils/headers.js +0 -46
  131. package/dist/esm/runtime/data-platform/batch/queue.mjs +0 -246
  132. package/dist/esm/runtime/data-platform/batch/request.mjs +0 -45
  133. package/dist/esm/runtime/data-platform/batch/response.mjs +0 -23
  134. package/dist/esm/runtime/data-platform/batch/telemetry.mjs +0 -23
  135. package/dist/esm/runtime/data-platform/batch/url.mjs +0 -25
  136. package/dist/esm/runtime/data-platform/batch-transport.mjs +0 -12
  137. package/dist/esm/runtime/data-platform/codec.mjs +0 -90
  138. package/dist/esm/runtime/data-platform/invalidation.mjs +0 -20
  139. package/dist/esm/runtime/data-platform/trace.mjs +0 -29
  140. package/dist/esm/runtime/data-platform/types.mjs +0 -4
  141. package/dist/esm/runtime/data-platform/validation.mjs +0 -128
  142. package/dist/esm/runtime/effect/adapter/constants.mjs +0 -6
  143. package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +0 -28
  144. package/dist/esm/runtime/effect/adapter/entry.mjs +0 -52
  145. package/dist/esm/runtime/effect/adapter/error-response.mjs +0 -43
  146. package/dist/esm/runtime/effect/adapter/handler.mjs +0 -15
  147. package/dist/esm/runtime/effect/adapter.mjs +0 -107
  148. package/dist/esm/runtime/effect/backend-federation/entry.mjs +0 -61
  149. package/dist/esm/runtime/effect/backend-federation/identity.mjs +0 -41
  150. package/dist/esm/runtime/effect/backend-federation/load.mjs +0 -37
  151. package/dist/esm/runtime/effect/backend-federation/plugin.mjs +0 -25
  152. package/dist/esm/runtime/effect/backend-federation/remotes.mjs +0 -13
  153. package/dist/esm/runtime/effect/backend-federation/runtime.mjs +0 -90
  154. package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
  155. package/dist/esm/runtime/effect/backend-federation/utils.mjs +0 -7
  156. package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +0 -32
  157. package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +0 -4
  158. package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +0 -56
  159. package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +0 -42
  160. package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +0 -76
  161. package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +0 -30
  162. package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
  163. package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +0 -65
  164. package/dist/esm/runtime/effect/backend-federation-manifest.mjs +0 -1
  165. package/dist/esm/runtime/effect/backend-federation.mjs +0 -5
  166. package/dist/esm/runtime/effect/context.mjs +0 -13
  167. package/dist/esm/runtime/effect/dispatch.mjs +0 -63
  168. package/dist/esm/runtime/effect/edge-context.mjs +0 -34
  169. package/dist/esm/runtime/effect/endpoint-contracts.mjs +0 -68
  170. package/dist/esm/runtime/effect/entry-shape.mjs +0 -36
  171. package/dist/esm/runtime/effect/handler/batch-handler.mjs +0 -123
  172. package/dist/esm/runtime/effect/handler/batch.mjs +0 -97
  173. package/dist/esm/runtime/effect/handler/definition.mjs +0 -61
  174. package/dist/esm/runtime/effect/handler/envelope.mjs +0 -63
  175. package/dist/esm/runtime/effect/handler/http.mjs +0 -69
  176. package/dist/esm/runtime/effect/handler/openapi.mjs +0 -19
  177. package/dist/esm/runtime/effect/handler/routing.mjs +0 -50
  178. package/dist/esm/runtime/effect/handler/rpc.mjs +0 -22
  179. package/dist/esm/runtime/effect/handler/types.mjs +0 -5
  180. package/dist/esm/runtime/effect/handler.mjs +0 -14
  181. package/dist/esm/runtime/effect/module.mjs +0 -75
  182. package/dist/esm/runtime/effect/operation-context.mjs +0 -65
  183. package/dist/esm/runtime/effect/rpcSerialization.mjs +0 -16
  184. package/dist/esm/runtime/effect-client/batch.mjs +0 -35
  185. package/dist/esm/runtime/effect-client/envelope.mjs +0 -104
  186. package/dist/esm/runtime/effect-client/guards.mjs +0 -3
  187. package/dist/esm/runtime/effect-client/request-context.mjs +0 -23
  188. package/dist/esm/runtime/effect-client/request.mjs +0 -28
  189. package/dist/esm/runtime/effect-client/types.mjs +0 -0
  190. package/dist/esm/runtime/safe-failure.mjs +0 -46
  191. package/dist/esm/utils/crossProjectServerPolicy.mjs +0 -44
  192. package/dist/esm/utils/effect-client-generator/generator.mjs +0 -28
  193. package/dist/esm/utils/effect-client-generator/index.mjs +0 -3
  194. package/dist/esm/utils/effect-client-generator/paths.mjs +0 -24
  195. package/dist/esm/utils/effect-client-generator/rendering.mjs +0 -179
  196. package/dist/esm/utils/effect-client-generator/runtime.mjs +0 -27
  197. package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
  198. package/dist/esm/utils/effectClientGenerator.mjs +0 -1
  199. package/dist/esm/utils/effectSourceLoader.mjs +0 -256
  200. package/dist/esm/utils/headers.mjs +0 -8
  201. package/dist/esm-node/runtime/data-platform/batch/queue.mjs +0 -247
  202. package/dist/esm-node/runtime/data-platform/batch/request.mjs +0 -46
  203. package/dist/esm-node/runtime/data-platform/batch/response.mjs +0 -24
  204. package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +0 -24
  205. package/dist/esm-node/runtime/data-platform/batch/url.mjs +0 -26
  206. package/dist/esm-node/runtime/data-platform/batch-transport.mjs +0 -13
  207. package/dist/esm-node/runtime/data-platform/codec.mjs +0 -91
  208. package/dist/esm-node/runtime/data-platform/invalidation.mjs +0 -21
  209. package/dist/esm-node/runtime/data-platform/trace.mjs +0 -30
  210. package/dist/esm-node/runtime/data-platform/types.mjs +0 -5
  211. package/dist/esm-node/runtime/data-platform/validation.mjs +0 -129
  212. package/dist/esm-node/runtime/effect/adapter/constants.mjs +0 -7
  213. package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +0 -29
  214. package/dist/esm-node/runtime/effect/adapter/entry.mjs +0 -53
  215. package/dist/esm-node/runtime/effect/adapter/error-response.mjs +0 -44
  216. package/dist/esm-node/runtime/effect/adapter/handler.mjs +0 -16
  217. package/dist/esm-node/runtime/effect/adapter.mjs +0 -108
  218. package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +0 -62
  219. package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +0 -42
  220. package/dist/esm-node/runtime/effect/backend-federation/load.mjs +0 -38
  221. package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +0 -26
  222. package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +0 -14
  223. package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +0 -91
  224. package/dist/esm-node/runtime/effect/backend-federation/types.mjs +0 -1
  225. package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +0 -8
  226. package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +0 -33
  227. package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +0 -5
  228. package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +0 -57
  229. package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +0 -43
  230. package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +0 -77
  231. package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +0 -31
  232. package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +0 -1
  233. package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +0 -66
  234. package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +0 -2
  235. package/dist/esm-node/runtime/effect/backend-federation.mjs +0 -6
  236. package/dist/esm-node/runtime/effect/context.mjs +0 -14
  237. package/dist/esm-node/runtime/effect/dispatch.mjs +0 -64
  238. package/dist/esm-node/runtime/effect/edge-context.mjs +0 -35
  239. package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +0 -69
  240. package/dist/esm-node/runtime/effect/entry-shape.mjs +0 -37
  241. package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +0 -124
  242. package/dist/esm-node/runtime/effect/handler/batch.mjs +0 -98
  243. package/dist/esm-node/runtime/effect/handler/definition.mjs +0 -62
  244. package/dist/esm-node/runtime/effect/handler/envelope.mjs +0 -64
  245. package/dist/esm-node/runtime/effect/handler/http.mjs +0 -70
  246. package/dist/esm-node/runtime/effect/handler/openapi.mjs +0 -20
  247. package/dist/esm-node/runtime/effect/handler/routing.mjs +0 -51
  248. package/dist/esm-node/runtime/effect/handler/rpc.mjs +0 -23
  249. package/dist/esm-node/runtime/effect/handler/types.mjs +0 -6
  250. package/dist/esm-node/runtime/effect/handler.mjs +0 -15
  251. package/dist/esm-node/runtime/effect/module.mjs +0 -76
  252. package/dist/esm-node/runtime/effect/operation-context.mjs +0 -66
  253. package/dist/esm-node/runtime/effect/rpcSerialization.mjs +0 -17
  254. package/dist/esm-node/runtime/effect-client/batch.mjs +0 -36
  255. package/dist/esm-node/runtime/effect-client/envelope.mjs +0 -105
  256. package/dist/esm-node/runtime/effect-client/guards.mjs +0 -4
  257. package/dist/esm-node/runtime/effect-client/request-context.mjs +0 -24
  258. package/dist/esm-node/runtime/effect-client/request.mjs +0 -29
  259. package/dist/esm-node/runtime/effect-client/types.mjs +0 -1
  260. package/dist/esm-node/runtime/safe-failure.mjs +0 -47
  261. package/dist/esm-node/utils/crossProjectServerPolicy.mjs +0 -46
  262. package/dist/esm-node/utils/effect-client-generator/generator.mjs +0 -29
  263. package/dist/esm-node/utils/effect-client-generator/index.mjs +0 -4
  264. package/dist/esm-node/utils/effect-client-generator/paths.mjs +0 -25
  265. package/dist/esm-node/utils/effect-client-generator/rendering.mjs +0 -180
  266. package/dist/esm-node/utils/effect-client-generator/runtime.mjs +0 -29
  267. package/dist/esm-node/utils/effect-client-generator/types.mjs +0 -1
  268. package/dist/esm-node/utils/effectClientGenerator.mjs +0 -2
  269. package/dist/esm-node/utils/effectSourceLoader.mjs +0 -257
  270. package/dist/esm-node/utils/headers.mjs +0 -9
  271. package/dist/types/runtime/data-platform/batch/queue.d.ts +0 -8
  272. package/dist/types/runtime/data-platform/batch/request.d.ts +0 -13
  273. package/dist/types/runtime/data-platform/batch/response.d.ts +0 -3
  274. package/dist/types/runtime/data-platform/batch/telemetry.d.ts +0 -4
  275. package/dist/types/runtime/data-platform/batch/url.d.ts +0 -4
  276. package/dist/types/runtime/data-platform/batch-transport.d.ts +0 -3
  277. package/dist/types/runtime/data-platform/codec.d.ts +0 -17
  278. package/dist/types/runtime/data-platform/invalidation.d.ts +0 -8
  279. package/dist/types/runtime/data-platform/trace.d.ts +0 -4
  280. package/dist/types/runtime/data-platform/types.d.ts +0 -146
  281. package/dist/types/runtime/data-platform/validation.d.ts +0 -29
  282. package/dist/types/runtime/effect/adapter/constants.d.ts +0 -1
  283. package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +0 -4
  284. package/dist/types/runtime/effect/adapter/entry.d.ts +0 -2
  285. package/dist/types/runtime/effect/adapter/error-response.d.ts +0 -2
  286. package/dist/types/runtime/effect/adapter/handler.d.ts +0 -7
  287. package/dist/types/runtime/effect/adapter.d.ts +0 -22
  288. package/dist/types/runtime/effect/backend-federation/entry.d.ts +0 -2
  289. package/dist/types/runtime/effect/backend-federation/identity.d.ts +0 -30
  290. package/dist/types/runtime/effect/backend-federation/load.d.ts +0 -13
  291. package/dist/types/runtime/effect/backend-federation/plugin.d.ts +0 -3
  292. package/dist/types/runtime/effect/backend-federation/remotes.d.ts +0 -2
  293. package/dist/types/runtime/effect/backend-federation/runtime.d.ts +0 -3
  294. package/dist/types/runtime/effect/backend-federation/types.d.ts +0 -73
  295. package/dist/types/runtime/effect/backend-federation/utils.d.ts +0 -2
  296. package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +0 -11
  297. package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +0 -6
  298. package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +0 -3
  299. package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +0 -18
  300. package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +0 -4
  301. package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +0 -3
  302. package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +0 -51
  303. package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +0 -5
  304. package/dist/types/runtime/effect/backend-federation-manifest.d.ts +0 -1
  305. package/dist/types/runtime/effect/backend-federation.d.ts +0 -7
  306. package/dist/types/runtime/effect/context.d.ts +0 -5
  307. package/dist/types/runtime/effect/dispatch.d.ts +0 -13
  308. package/dist/types/runtime/effect/edge-context.d.ts +0 -5
  309. package/dist/types/runtime/effect/endpoint-contracts.d.ts +0 -66
  310. package/dist/types/runtime/effect/entry-shape.d.ts +0 -31
  311. package/dist/types/runtime/effect/handler/batch-handler.d.ts +0 -11
  312. package/dist/types/runtime/effect/handler/batch.d.ts +0 -13
  313. package/dist/types/runtime/effect/handler/definition.d.ts +0 -7
  314. package/dist/types/runtime/effect/handler/envelope.d.ts +0 -13
  315. package/dist/types/runtime/effect/handler/http.d.ts +0 -15
  316. package/dist/types/runtime/effect/handler/openapi.d.ts +0 -4
  317. package/dist/types/runtime/effect/handler/routing.d.ts +0 -5
  318. package/dist/types/runtime/effect/handler/rpc.d.ts +0 -7
  319. package/dist/types/runtime/effect/handler/types.d.ts +0 -153
  320. package/dist/types/runtime/effect/handler.d.ts +0 -14
  321. package/dist/types/runtime/effect/module.d.ts +0 -36
  322. package/dist/types/runtime/effect/operation-context.d.ts +0 -10
  323. package/dist/types/runtime/effect/rpcSerialization.d.ts +0 -3
  324. package/dist/types/runtime/effect-client/batch.d.ts +0 -2
  325. package/dist/types/runtime/effect-client/envelope.d.ts +0 -15
  326. package/dist/types/runtime/effect-client/guards.d.ts +0 -2
  327. package/dist/types/runtime/effect-client/request-context.d.ts +0 -3
  328. package/dist/types/runtime/effect-client/request.d.ts +0 -1
  329. package/dist/types/runtime/effect-client/types.d.ts +0 -68
  330. package/dist/types/runtime/safe-failure.d.ts +0 -1
  331. package/dist/types/utils/crossProjectServerPolicy.d.ts +0 -36
  332. package/dist/types/utils/effect-client-generator/generator.d.ts +0 -10
  333. package/dist/types/utils/effect-client-generator/index.d.ts +0 -4
  334. package/dist/types/utils/effect-client-generator/paths.d.ts +0 -5
  335. package/dist/types/utils/effect-client-generator/rendering.d.ts +0 -4
  336. package/dist/types/utils/effect-client-generator/runtime.d.ts +0 -12
  337. package/dist/types/utils/effect-client-generator/types.d.ts +0 -27
  338. package/dist/types/utils/effectClientGenerator.d.ts +0 -2
  339. package/dist/types/utils/effectSourceLoader.d.ts +0 -25
  340. package/dist/types/utils/headers.d.ts +0 -1
@@ -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 };
@@ -1,91 +0,0 @@
1
- import "node:module";
2
- function isPlainObject(value) {
3
- if ('object' != typeof value || null === value || Array.isArray(value)) return false;
4
- const proto = Object.getPrototypeOf(value);
5
- return proto === Object.prototype || null === proto;
6
- }
7
- function canonicalize(value) {
8
- if (Array.isArray(value)) return value.map((item)=>canonicalize(item));
9
- if (isPlainObject(value)) return Object.keys(value).sort().reduce((acc, key)=>{
10
- acc[key] = canonicalize(value[key]);
11
- return acc;
12
- }, {});
13
- return value;
14
- }
15
- function stableStringify(value) {
16
- return JSON.stringify(canonicalize(value));
17
- }
18
- function encodeRequestEnvelopeHeader(envelope) {
19
- return encodeURIComponent(stableStringify(envelope));
20
- }
21
- function isRequestEnvelopeShape(value) {
22
- if (!isPlainObject(value)) return false;
23
- return 1 === value.protocolVersion && 'string' == typeof value.operationId && 'string' == typeof value.appNamespace && 'string' == typeof value.origin && 'string' == typeof value.scopeKey && 'string' == typeof value.inputHash && 'number' == typeof value.timestamp;
24
- }
25
- function decodeRequestEnvelopeHeader(value) {
26
- try {
27
- const decoded = decodeURIComponent(value);
28
- const parsed = JSON.parse(decoded);
29
- if (!isRequestEnvelopeShape(parsed)) return null;
30
- return parsed;
31
- } catch {
32
- return null;
33
- }
34
- }
35
- function hashString(value) {
36
- let hash = 0x811c9dc5;
37
- for(let index = 0; index < value.length; index++){
38
- hash ^= value.charCodeAt(index);
39
- hash = Math.imul(hash, 0x01000193);
40
- }
41
- return (hash >>> 0).toString(16).padStart(8, '0');
42
- }
43
- function sanitizeSegment(segment) {
44
- const normalized = segment.trim().replace(/[^a-zA-Z0-9_-]+/g, '_');
45
- return normalized.length > 0 ? normalized : 'unknown';
46
- }
47
- function normalizeOrigin(origin) {
48
- const normalized = origin.trim();
49
- try {
50
- const url = new URL(normalized);
51
- return `${url.protocol}//${url.host}`.toLowerCase();
52
- } catch {
53
- return normalized.toLowerCase();
54
- }
55
- }
56
- function normalizeOperationDescriptor(input) {
57
- return {
58
- appNamespace: sanitizeSegment(input.appNamespace),
59
- apiId: sanitizeSegment(input.apiId),
60
- group: sanitizeSegment(input.group),
61
- endpoint: sanitizeSegment(input.endpoint),
62
- schemaHash: input.schemaHash || null,
63
- version: input.version ?? 1
64
- };
65
- }
66
- function createOperationId(input) {
67
- const descriptor = normalizeOperationDescriptor(input);
68
- const readable = `${descriptor.appNamespace}.${descriptor.apiId}.${descriptor.group}.${descriptor.endpoint}.v${String(descriptor.version)}`;
69
- return `${readable}:${hashString(stableStringify(descriptor))}`;
70
- }
71
- function buildScopeKey(scope) {
72
- const canonical = {
73
- appNamespace: sanitizeSegment(scope.appNamespace),
74
- origin: normalizeOrigin(scope.origin),
75
- tenantId: scope.tenantId ?? null,
76
- userId: scope.userId ?? null,
77
- sessionId: scope.sessionId ?? null
78
- };
79
- return `${canonical.appNamespace}:${hashString(stableStringify(canonical))}`;
80
- }
81
- function buildQueryKey(input) {
82
- const canonical = {
83
- operationId: input.operationId,
84
- scopeKey: input.scopeKey,
85
- requestMode: input.requestMode ?? 'cache-first',
86
- requestInput: input.requestInput ?? null,
87
- selectionPlan: input.selectionPlan ?? null
88
- };
89
- return `${input.operationId}:${hashString(stableStringify(canonical))}`;
90
- }
91
- export { buildQueryKey, buildScopeKey, createOperationId, decodeRequestEnvelopeHeader, encodeRequestEnvelopeHeader, hashString, isPlainObject, normalizeOrigin, sanitizeSegment, stableStringify };
@@ -1,21 +0,0 @@
1
- import "node:module";
2
- import { buildScopeKey, createOperationId, sanitizeSegment } from "./codec.mjs";
3
- function createInvalidationEvent(input) {
4
- return {
5
- sourceNamespace: sanitizeSegment(input.sourceOperation.appNamespace),
6
- sourceOperationId: createOperationId(input.sourceOperation),
7
- scopeKey: buildScopeKey(input.sourceScope),
8
- targetNamespaces: input.targetNamespaces?.map((namespace)=>sanitizeSegment(namespace)),
9
- targetOperationIds: input.targetOperations?.map((operation)=>createOperationId(operation))
10
- };
11
- }
12
- function shouldApplyInvalidation(event, subscriber) {
13
- if (subscriber.scopeKey && subscriber.scopeKey !== event.scopeKey) return false;
14
- const sameNamespace = subscriber.namespace === event.sourceNamespace;
15
- const allowedCrossNamespace = true === subscriber.acceptCrossNamespace && event.targetNamespaces?.includes(subscriber.namespace) === true;
16
- if (!sameNamespace && !allowedCrossNamespace) return false;
17
- if (!subscriber.operationIds || 0 === subscriber.operationIds.length) return true;
18
- if (!event.targetOperationIds || 0 === event.targetOperationIds.length) return true;
19
- return subscriber.operationIds.some((operationId)=>event.targetOperationIds?.includes(operationId));
20
- }
21
- export { createInvalidationEvent, shouldApplyInvalidation };
@@ -1,30 +0,0 @@
1
- import "node:module";
2
- import { parseTraceparent } from "@modern-js/create-request";
3
- function isAllZeroHex(value) {
4
- return /^0+$/.test(value);
5
- }
6
- function isValidHex(value, length) {
7
- return value.length === length && /^[0-9a-f]+$/.test(value);
8
- }
9
- function parseTraceparentHeader(header) {
10
- return parseTraceparent(header) ?? null;
11
- }
12
- function formatTraceparentHeader(trace) {
13
- const traceId = trace.traceId.toLowerCase();
14
- const spanId = trace.spanId.toLowerCase();
15
- if (!isValidHex(traceId, 32) || !isValidHex(spanId, 16)) throw new Error('Invalid trace context: traceId/spanId format mismatch');
16
- if (isAllZeroHex(traceId) || isAllZeroHex(spanId)) throw new Error('Invalid trace context: traceId/spanId cannot be zero');
17
- const flags = trace.sampled ? '01' : '00';
18
- return `00-${traceId}-${spanId}-${flags}`;
19
- }
20
- function deriveChildTraceContext(parent, childSpanId) {
21
- const normalizedSpanId = childSpanId.toLowerCase();
22
- if (!isValidHex(normalizedSpanId, 16) || isAllZeroHex(normalizedSpanId)) throw new Error('Invalid child span id');
23
- return {
24
- traceId: parent.traceId.toLowerCase(),
25
- spanId: normalizedSpanId,
26
- sampled: parent.sampled,
27
- parentSpanId: parent.spanId.toLowerCase()
28
- };
29
- }
30
- export { deriveChildTraceContext, formatTraceparentHeader, parseTraceparentHeader };
@@ -1,5 +0,0 @@
1
- import "node:module";
2
- const DEFAULT_DATA_ENVELOPE_HEADER = 'x-modernjs-data-envelope';
3
- const DEFAULT_DATA_BATCH_ENDPOINT = '/_data/batch';
4
- const DEFAULT_DATA_BATCH_HEADER = 'x-modernjs-data-batch';
5
- export { DEFAULT_DATA_BATCH_ENDPOINT, DEFAULT_DATA_BATCH_HEADER, DEFAULT_DATA_ENVELOPE_HEADER };
@@ -1,129 +0,0 @@
1
- import "node:module";
2
- import { buildScopeKey, createOperationId, hashString, isPlainObject, normalizeOrigin, sanitizeSegment, stableStringify } from "./codec.mjs";
3
- import { formatTraceparentHeader, parseTraceparentHeader } from "./trace.mjs";
4
- function validateSelectionPlan(plan, options = {}) {
5
- const maxDepthLimit = options.maxDepth ?? 8;
6
- const maxFieldsLimit = options.maxFields ?? 256;
7
- const allowedLeafPaths = options.allowedLeafPaths ? new Set(options.allowedLeafPaths) : null;
8
- const errors = [];
9
- let maxDepth = 0;
10
- let fieldCount = 0;
11
- const walk = (node, path)=>{
12
- if (!isPlainObject(node)) return void errors.push(`Selection node at "${path.join('.') || '<root>'}" must be an object`);
13
- const keys = Object.keys(node);
14
- if (0 === keys.length) return void errors.push(`Selection node at "${path.join('.') || '<root>'}" cannot be empty`);
15
- for (const key of keys){
16
- fieldCount += 1;
17
- if (fieldCount > maxFieldsLimit) return void errors.push(`Selection has too many fields: ${String(fieldCount)} > ${String(maxFieldsLimit)}`);
18
- const nextPath = [
19
- ...path,
20
- key
21
- ];
22
- const depth = nextPath.length;
23
- if (depth > maxDepth) maxDepth = depth;
24
- if (depth > maxDepthLimit) return void errors.push(`Selection exceeds maxDepth at "${nextPath.join('.')}" (${String(depth)} > ${String(maxDepthLimit)})`);
25
- const value = node[key];
26
- if (true === value) {
27
- if (allowedLeafPaths && !allowedLeafPaths.has(nextPath.join('.'))) errors.push(`Unknown selected field "${nextPath.join('.')}"`);
28
- continue;
29
- }
30
- if (!isPlainObject(value)) {
31
- errors.push(`Invalid selection value at "${nextPath.join('.')}"; expected true or nested object`);
32
- continue;
33
- }
34
- walk(value, nextPath);
35
- }
36
- };
37
- walk(plan, []);
38
- return {
39
- ok: 0 === errors.length,
40
- errors,
41
- stats: {
42
- maxDepth,
43
- fieldCount
44
- }
45
- };
46
- }
47
- function createRequestEnvelope(input) {
48
- if (input.requireTraceContext && !input.traceContext) throw new Error('Trace context is required for this request envelope');
49
- const traceparent = input.traceContext ? formatTraceparentHeader(input.traceContext) : void 0;
50
- const envelope = {
51
- protocolVersion: input.protocolVersion ?? 1,
52
- operationId: createOperationId(input.operation),
53
- appNamespace: sanitizeSegment(input.scope.appNamespace),
54
- origin: normalizeOrigin(input.scope.origin),
55
- requestMode: input.requestMode ?? 'cache-first',
56
- mutationMode: input.mutationMode,
57
- scopeKey: buildScopeKey(input.scope),
58
- input: input.requestInput,
59
- inputHash: hashString(stableStringify(input.requestInput ?? null)),
60
- selectionPlan: input.selectionPlan,
61
- selectionHash: input.selectionPlan ? hashString(stableStringify(input.selectionPlan)) : void 0,
62
- traceparent,
63
- timestamp: input.timestamp ?? Date.now()
64
- };
65
- return envelope;
66
- }
67
- function validateRequestEnvelope(envelope, options = {}) {
68
- const errors = [];
69
- if (void 0 !== options.expectedProtocolVersion && envelope.protocolVersion !== options.expectedProtocolVersion) errors.push(`Protocol mismatch: expected ${String(options.expectedProtocolVersion)} but received ${String(envelope.protocolVersion)}`);
70
- if (options.expectedNamespace && envelope.appNamespace !== options.expectedNamespace) errors.push(`Namespace mismatch: expected ${options.expectedNamespace} but received ${envelope.appNamespace}`);
71
- if (options.expectedOrigin) {
72
- const expectedOrigin = normalizeOrigin(options.expectedOrigin);
73
- if (envelope.origin !== expectedOrigin) errors.push(`Origin mismatch: expected ${expectedOrigin} but received ${envelope.origin}`);
74
- }
75
- if (!envelope.operationId) errors.push('Missing operationId');
76
- if (!envelope.scopeKey) errors.push('Missing scopeKey');
77
- if (options.requireTraceContext && !envelope.traceparent) errors.push('Missing trace context');
78
- if (envelope.traceparent && !parseTraceparentHeader(envelope.traceparent)) errors.push('Invalid traceparent header');
79
- const computedInputHash = hashString(stableStringify(envelope.input ?? null));
80
- if (computedInputHash !== envelope.inputHash) errors.push('Input hash mismatch');
81
- if (envelope.selectionPlan) {
82
- const computedSelectionHash = hashString(stableStringify(envelope.selectionPlan));
83
- if (computedSelectionHash !== envelope.selectionHash) errors.push('Selection hash mismatch');
84
- }
85
- return {
86
- ok: 0 === errors.length,
87
- errors
88
- };
89
- }
90
- function createHydrationEnvelope(input) {
91
- const envelopeWithoutChecksum = {
92
- protocolVersion: input.protocolVersion ?? 1,
93
- runtimeVersion: input.runtimeVersion,
94
- appNamespace: sanitizeSegment(input.scope.appNamespace),
95
- origin: normalizeOrigin(input.scope.origin),
96
- createdAt: input.createdAt ?? Date.now(),
97
- payload: input.payload
98
- };
99
- const checksum = hashString(stableStringify(envelopeWithoutChecksum));
100
- return {
101
- ...envelopeWithoutChecksum,
102
- checksum
103
- };
104
- }
105
- function validateHydrationEnvelope(envelope, options = {}) {
106
- const errors = [];
107
- if (void 0 !== options.expectedProtocolVersion && envelope.protocolVersion !== options.expectedProtocolVersion) errors.push(`Protocol mismatch: expected ${String(options.expectedProtocolVersion)} but received ${String(envelope.protocolVersion)}`);
108
- if (options.expectedNamespace && envelope.appNamespace !== options.expectedNamespace) errors.push(`Namespace mismatch: expected ${options.expectedNamespace} but received ${envelope.appNamespace}`);
109
- if (options.expectedOrigin) {
110
- const expectedOrigin = normalizeOrigin(options.expectedOrigin);
111
- if (envelope.origin !== expectedOrigin) errors.push(`Origin mismatch: expected ${expectedOrigin} but received ${envelope.origin}`);
112
- }
113
- if (options.expectedRuntimeVersion && envelope.runtimeVersion !== options.expectedRuntimeVersion) errors.push(`Runtime version mismatch: expected ${options.expectedRuntimeVersion} but received ${envelope.runtimeVersion}`);
114
- const checksumBase = {
115
- protocolVersion: envelope.protocolVersion,
116
- runtimeVersion: envelope.runtimeVersion,
117
- appNamespace: envelope.appNamespace,
118
- origin: envelope.origin,
119
- createdAt: envelope.createdAt,
120
- payload: envelope.payload
121
- };
122
- const checksum = hashString(stableStringify(checksumBase));
123
- if (checksum !== envelope.checksum) errors.push('Hydration checksum mismatch');
124
- return {
125
- ok: 0 === errors.length,
126
- errors
127
- };
128
- }
129
- export { createHydrationEnvelope, createRequestEnvelope, validateHydrationEnvelope, validateRequestEnvelope, validateSelectionPlan };
@@ -1,7 +0,0 @@
1
- import "node:module";
2
- const before = [
3
- 'custom-server-hook',
4
- 'custom-server-middleware',
5
- 'render'
6
- ];
7
- export { before };