@bleedingdev/modern-js-plugin-bff 3.5.0-ultramodern.5 → 3.5.0-ultramodern.75
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.
- package/dist/cjs/cli/compress.js +52 -0
- package/dist/cjs/cli/generator.js +152 -0
- package/dist/cjs/cli/prefix.js +50 -0
- package/dist/cjs/cli/serverGlobalVars.js +127 -0
- package/dist/cjs/cli/watch.js +51 -0
- package/dist/cjs/cli.js +11 -130
- package/dist/cjs/loader.js +19 -2
- package/dist/cjs/runtime/data-platform/batch/queue.js +284 -0
- package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
- package/dist/cjs/runtime/data-platform/batch/response.js +64 -0
- package/dist/cjs/runtime/data-platform/batch/telemetry.js +67 -0
- package/dist/cjs/runtime/data-platform/batch/url.js +69 -0
- package/dist/cjs/runtime/data-platform/batch-transport.js +59 -0
- package/dist/cjs/runtime/data-platform/codec.js +155 -0
- package/dist/cjs/runtime/data-platform/index.js +30 -633
- package/dist/cjs/runtime/data-platform/invalidation.js +61 -0
- package/dist/cjs/runtime/data-platform/trace.js +73 -0
- package/dist/cjs/runtime/data-platform/types.js +48 -0
- package/dist/cjs/runtime/data-platform/validation.js +178 -0
- package/dist/cjs/runtime/effect/adapter/constants.js +44 -0
- package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +61 -0
- package/dist/cjs/runtime/effect/adapter/entry.js +92 -0
- package/dist/cjs/runtime/effect/adapter/error-response.js +79 -0
- package/dist/cjs/runtime/effect/adapter/handler.js +53 -0
- package/dist/cjs/runtime/effect/adapter.js +26 -146
- package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
- package/dist/cjs/runtime/effect/backend-federation/identity.js +82 -0
- package/dist/cjs/runtime/effect/backend-federation/load.js +66 -0
- package/dist/cjs/runtime/effect/backend-federation/plugin.js +53 -0
- package/dist/cjs/runtime/effect/backend-federation/remotes.js +50 -0
- package/dist/cjs/runtime/effect/backend-federation/runtime.js +64 -0
- package/dist/cjs/runtime/effect/backend-federation/types.js +18 -0
- package/dist/cjs/runtime/effect/backend-federation/utils.js +48 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +83 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +55 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +94 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +120 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +68 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +18 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +109 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest.js +62 -0
- package/dist/cjs/runtime/effect/backend-federation.js +65 -0
- package/dist/cjs/runtime/effect/dispatch.js +101 -0
- package/dist/cjs/runtime/effect/edge.js +64 -71
- package/dist/cjs/runtime/effect/endpoint-contracts.js +7 -21
- package/dist/cjs/runtime/effect/entry-shape.js +84 -0
- package/dist/cjs/runtime/effect/handler/batch-handler.js +161 -0
- package/dist/cjs/runtime/effect/handler/batch.js +195 -0
- package/dist/cjs/runtime/effect/handler/definition.js +101 -0
- package/dist/cjs/runtime/effect/handler/envelope.js +104 -0
- package/dist/cjs/runtime/effect/handler/http.js +96 -0
- package/dist/cjs/runtime/effect/handler/openapi.js +57 -0
- package/dist/cjs/runtime/effect/handler/routing.js +100 -0
- package/dist/cjs/runtime/effect/handler/rpc.js +63 -0
- package/dist/cjs/runtime/effect/handler/types.js +43 -0
- package/dist/cjs/runtime/effect/handler.js +37 -529
- package/dist/cjs/runtime/effect/index.js +91 -15
- package/dist/cjs/runtime/effect/module.js +23 -80
- package/dist/cjs/runtime/effect/rpcSerialization.js +54 -0
- package/dist/cjs/runtime/effect-client/batch.js +73 -0
- package/dist/cjs/runtime/effect-client/envelope.js +145 -0
- package/dist/cjs/runtime/effect-client/guards.js +44 -0
- package/dist/cjs/runtime/effect-client/index.js +6 -16
- package/dist/cjs/runtime/effect-client/request-context.js +64 -0
- package/dist/cjs/runtime/effect-client/request.js +66 -0
- package/dist/cjs/runtime/effect-client/runtime.js +12 -178
- package/dist/cjs/runtime/effect-client/types.js +18 -0
- package/dist/cjs/runtime/safe-failure.js +2 -1
- package/dist/cjs/utils/client-generator/files.js +152 -0
- package/dist/cjs/utils/client-generator/generate.js +138 -0
- package/dist/cjs/utils/client-generator/index.js +83 -0
- package/dist/cjs/utils/client-generator/package-json.js +132 -0
- package/dist/cjs/utils/client-generator/write-package.js +125 -0
- package/dist/cjs/utils/clientGenerator.js +26 -303
- package/dist/cjs/utils/effect-client-generator/generator.js +68 -0
- package/dist/cjs/utils/effect-client-generator/index.js +51 -0
- package/dist/cjs/utils/effect-client-generator/paths.js +73 -0
- package/dist/cjs/utils/effect-client-generator/rendering.js +231 -0
- package/dist/cjs/utils/effect-client-generator/runtime.js +85 -0
- package/dist/cjs/utils/effect-client-generator/types.js +18 -0
- package/dist/cjs/utils/effectClientGenerator.js +5 -262
- package/dist/cjs/utils/effectSourceLoader.js +173 -0
- package/dist/esm/cli/compress.mjs +14 -0
- package/dist/esm/cli/generator.mjs +101 -0
- package/dist/esm/cli/prefix.mjs +9 -0
- package/dist/esm/cli/serverGlobalVars.mjs +76 -0
- package/dist/esm/cli/watch.mjs +13 -0
- package/dist/esm/cli.mjs +7 -121
- package/dist/esm/loader.mjs +19 -2
- package/dist/esm/runtime/data-platform/batch/queue.mjs +246 -0
- package/dist/esm/runtime/data-platform/batch/request.mjs +45 -0
- package/dist/esm/runtime/data-platform/batch/response.mjs +23 -0
- package/dist/esm/runtime/data-platform/batch/telemetry.mjs +23 -0
- package/dist/esm/runtime/data-platform/batch/url.mjs +25 -0
- package/dist/esm/runtime/data-platform/batch-transport.mjs +12 -0
- package/dist/esm/runtime/data-platform/codec.mjs +90 -0
- package/dist/esm/runtime/data-platform/index.mjs +6 -610
- package/dist/esm/runtime/data-platform/invalidation.mjs +20 -0
- package/dist/esm/runtime/data-platform/trace.mjs +29 -0
- package/dist/esm/runtime/data-platform/types.mjs +4 -0
- package/dist/esm/runtime/data-platform/validation.mjs +128 -0
- package/dist/esm/runtime/effect/adapter/constants.mjs +6 -0
- package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +23 -0
- package/dist/esm/runtime/effect/adapter/entry.mjs +44 -0
- package/dist/esm/runtime/effect/adapter/error-response.mjs +41 -0
- package/dist/esm/runtime/effect/adapter/handler.mjs +15 -0
- package/dist/esm/runtime/effect/adapter.mjs +27 -147
- package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
- package/dist/esm/runtime/effect/backend-federation/identity.mjs +41 -0
- package/dist/esm/runtime/effect/backend-federation/load.mjs +28 -0
- package/dist/esm/runtime/effect/backend-federation/plugin.mjs +15 -0
- package/dist/esm/runtime/effect/backend-federation/remotes.mjs +12 -0
- package/dist/esm/runtime/effect/backend-federation/runtime.mjs +26 -0
- package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation/utils.mjs +7 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +32 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +4 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +56 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +42 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +76 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +30 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +65 -0
- package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -0
- package/dist/esm/runtime/effect/backend-federation.mjs +5 -0
- package/dist/esm/runtime/effect/dispatch.mjs +63 -0
- package/dist/esm/runtime/effect/edge.mjs +17 -63
- package/dist/esm/runtime/effect/endpoint-contracts.mjs +8 -13
- package/dist/esm/runtime/effect/entry-shape.mjs +36 -0
- package/dist/esm/runtime/effect/handler/batch-handler.mjs +123 -0
- package/dist/esm/runtime/effect/handler/batch.mjs +124 -0
- package/dist/esm/runtime/effect/handler/definition.mjs +60 -0
- package/dist/esm/runtime/effect/handler/envelope.mjs +63 -0
- package/dist/esm/runtime/effect/handler/http.mjs +58 -0
- package/dist/esm/runtime/effect/handler/openapi.mjs +19 -0
- package/dist/esm/runtime/effect/handler/routing.mjs +50 -0
- package/dist/esm/runtime/effect/handler/rpc.mjs +22 -0
- package/dist/esm/runtime/effect/handler/types.mjs +5 -0
- package/dist/esm/runtime/effect/handler.mjs +11 -506
- package/dist/esm/runtime/effect/index.mjs +5 -2
- package/dist/esm/runtime/effect/module.mjs +25 -82
- package/dist/esm/runtime/effect/rpcSerialization.mjs +16 -0
- package/dist/esm/runtime/effect-client/batch.mjs +35 -0
- package/dist/esm/runtime/effect-client/envelope.mjs +104 -0
- package/dist/esm/runtime/effect-client/guards.mjs +3 -0
- package/dist/esm/runtime/effect-client/index.mjs +27 -37
- package/dist/esm/runtime/effect-client/request-context.mjs +23 -0
- package/dist/esm/runtime/effect-client/request.mjs +28 -0
- package/dist/esm/runtime/effect-client/runtime.mjs +12 -178
- package/dist/esm/runtime/effect-client/types.mjs +0 -0
- package/dist/esm/runtime/safe-failure.mjs +2 -1
- package/dist/esm/utils/client-generator/files.mjs +68 -0
- package/dist/esm/utils/client-generator/generate.mjs +88 -0
- package/dist/esm/utils/client-generator/index.mjs +4 -0
- package/dist/esm/utils/client-generator/package-json.mjs +78 -0
- package/dist/esm/utils/client-generator/write-package.mjs +74 -0
- package/dist/esm/utils/clientGenerator.mjs +2 -293
- package/dist/esm/utils/effect-client-generator/generator.mjs +27 -0
- package/dist/esm/utils/effect-client-generator/index.mjs +3 -0
- package/dist/esm/utils/effect-client-generator/paths.mjs +25 -0
- package/dist/esm/utils/effect-client-generator/rendering.mjs +180 -0
- package/dist/esm/utils/effect-client-generator/runtime.mjs +34 -0
- package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
- package/dist/esm/utils/effectClientGenerator.mjs +1 -249
- package/dist/esm/utils/effectSourceLoader.mjs +123 -0
- package/dist/esm-node/cli/compress.mjs +15 -0
- package/dist/esm-node/cli/generator.mjs +102 -0
- package/dist/esm-node/cli/prefix.mjs +10 -0
- package/dist/esm-node/cli/serverGlobalVars.mjs +77 -0
- package/dist/esm-node/cli/watch.mjs +14 -0
- package/dist/esm-node/cli.mjs +7 -121
- package/dist/esm-node/loader.mjs +19 -2
- package/dist/esm-node/runtime/data-platform/batch/queue.mjs +247 -0
- package/dist/esm-node/runtime/data-platform/batch/request.mjs +46 -0
- package/dist/esm-node/runtime/data-platform/batch/response.mjs +24 -0
- package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +24 -0
- package/dist/esm-node/runtime/data-platform/batch/url.mjs +26 -0
- package/dist/esm-node/runtime/data-platform/batch-transport.mjs +13 -0
- package/dist/esm-node/runtime/data-platform/codec.mjs +91 -0
- package/dist/esm-node/runtime/data-platform/index.mjs +6 -610
- package/dist/esm-node/runtime/data-platform/invalidation.mjs +21 -0
- package/dist/esm-node/runtime/data-platform/trace.mjs +30 -0
- package/dist/esm-node/runtime/data-platform/types.mjs +5 -0
- package/dist/esm-node/runtime/data-platform/validation.mjs +129 -0
- package/dist/esm-node/runtime/effect/adapter/constants.mjs +7 -0
- package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +24 -0
- package/dist/esm-node/runtime/effect/adapter/entry.mjs +45 -0
- package/dist/esm-node/runtime/effect/adapter/error-response.mjs +42 -0
- package/dist/esm-node/runtime/effect/adapter/handler.mjs +16 -0
- package/dist/esm-node/runtime/effect/adapter.mjs +28 -149
- package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
- package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +42 -0
- package/dist/esm-node/runtime/effect/backend-federation/load.mjs +29 -0
- package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +16 -0
- package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +13 -0
- package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +27 -0
- package/dist/esm-node/runtime/effect/backend-federation/types.mjs +1 -0
- package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +8 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +33 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +5 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +57 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +43 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +77 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +31 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +1 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +66 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +2 -0
- package/dist/esm-node/runtime/effect/backend-federation.mjs +6 -0
- package/dist/esm-node/runtime/effect/dispatch.mjs +64 -0
- package/dist/esm-node/runtime/effect/edge.mjs +17 -63
- package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +8 -13
- package/dist/esm-node/runtime/effect/entry-shape.mjs +37 -0
- package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +124 -0
- package/dist/esm-node/runtime/effect/handler/batch.mjs +125 -0
- package/dist/esm-node/runtime/effect/handler/definition.mjs +61 -0
- package/dist/esm-node/runtime/effect/handler/envelope.mjs +64 -0
- package/dist/esm-node/runtime/effect/handler/http.mjs +59 -0
- package/dist/esm-node/runtime/effect/handler/openapi.mjs +20 -0
- package/dist/esm-node/runtime/effect/handler/routing.mjs +51 -0
- package/dist/esm-node/runtime/effect/handler/rpc.mjs +23 -0
- package/dist/esm-node/runtime/effect/handler/types.mjs +6 -0
- package/dist/esm-node/runtime/effect/handler.mjs +11 -506
- package/dist/esm-node/runtime/effect/index.mjs +5 -2
- package/dist/esm-node/runtime/effect/module.mjs +25 -82
- package/dist/esm-node/runtime/effect/rpcSerialization.mjs +17 -0
- package/dist/esm-node/runtime/effect-client/batch.mjs +36 -0
- package/dist/esm-node/runtime/effect-client/envelope.mjs +105 -0
- package/dist/esm-node/runtime/effect-client/guards.mjs +4 -0
- package/dist/esm-node/runtime/effect-client/index.mjs +27 -37
- package/dist/esm-node/runtime/effect-client/request-context.mjs +24 -0
- package/dist/esm-node/runtime/effect-client/request.mjs +29 -0
- package/dist/esm-node/runtime/effect-client/runtime.mjs +12 -178
- package/dist/esm-node/runtime/effect-client/types.mjs +1 -0
- package/dist/esm-node/runtime/safe-failure.mjs +2 -1
- package/dist/esm-node/utils/client-generator/files.mjs +69 -0
- package/dist/esm-node/utils/client-generator/generate.mjs +89 -0
- package/dist/esm-node/utils/client-generator/index.mjs +5 -0
- package/dist/esm-node/utils/client-generator/package-json.mjs +79 -0
- package/dist/esm-node/utils/client-generator/write-package.mjs +75 -0
- package/dist/esm-node/utils/clientGenerator.mjs +2 -293
- package/dist/esm-node/utils/effect-client-generator/generator.mjs +28 -0
- package/dist/esm-node/utils/effect-client-generator/index.mjs +4 -0
- package/dist/esm-node/utils/effect-client-generator/paths.mjs +26 -0
- package/dist/esm-node/utils/effect-client-generator/rendering.mjs +181 -0
- package/dist/esm-node/utils/effect-client-generator/runtime.mjs +36 -0
- package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
- package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
- package/dist/esm-node/utils/effectSourceLoader.mjs +124 -0
- package/dist/types/cli/compress.d.ts +2 -0
- package/dist/types/cli/generator.d.ts +7 -0
- package/dist/types/cli/prefix.d.ts +2 -0
- package/dist/types/cli/serverGlobalVars.d.ts +4 -0
- package/dist/types/cli/watch.d.ts +1 -0
- package/dist/types/cli.d.ts +0 -1
- package/dist/types/runtime/data-platform/batch/queue.d.ts +8 -0
- package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
- package/dist/types/runtime/data-platform/batch/response.d.ts +3 -0
- package/dist/types/runtime/data-platform/batch/telemetry.d.ts +4 -0
- package/dist/types/runtime/data-platform/batch/url.d.ts +4 -0
- package/dist/types/runtime/data-platform/batch-transport.d.ts +3 -0
- package/dist/types/runtime/data-platform/codec.d.ts +17 -0
- package/dist/types/runtime/data-platform/index.d.ts +7 -191
- package/dist/types/runtime/data-platform/invalidation.d.ts +8 -0
- package/dist/types/runtime/data-platform/trace.d.ts +4 -0
- package/dist/types/runtime/data-platform/types.d.ts +146 -0
- package/dist/types/runtime/data-platform/validation.d.ts +29 -0
- package/dist/types/runtime/effect/adapter/constants.d.ts +1 -0
- package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +4 -0
- package/dist/types/runtime/effect/adapter/entry.d.ts +2 -0
- package/dist/types/runtime/effect/adapter/error-response.d.ts +2 -0
- package/dist/types/runtime/effect/adapter/handler.d.ts +7 -0
- package/dist/types/runtime/effect/adapter.d.ts +4 -13
- package/dist/types/runtime/effect/backend-federation/entry.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation/identity.d.ts +30 -0
- package/dist/types/runtime/effect/backend-federation/load.d.ts +13 -0
- package/dist/types/runtime/effect/backend-federation/plugin.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation/remotes.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation/runtime.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation/types.d.ts +73 -0
- package/dist/types/runtime/effect/backend-federation/utils.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +11 -0
- package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +6 -0
- package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +18 -0
- package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +4 -0
- package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +51 -0
- package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +5 -0
- package/dist/types/runtime/effect/backend-federation-manifest.d.ts +1 -0
- package/dist/types/runtime/effect/backend-federation.d.ts +7 -0
- package/dist/types/runtime/effect/dispatch.d.ts +13 -0
- package/dist/types/runtime/effect/edge.d.ts +8 -8
- package/dist/types/runtime/effect/endpoint-contracts.d.ts +5 -7
- package/dist/types/runtime/effect/entry-shape.d.ts +31 -0
- package/dist/types/runtime/effect/handler/batch-handler.d.ts +11 -0
- package/dist/types/runtime/effect/handler/batch.d.ts +17 -0
- package/dist/types/runtime/effect/handler/definition.d.ts +17 -0
- package/dist/types/runtime/effect/handler/envelope.d.ts +13 -0
- package/dist/types/runtime/effect/handler/http.d.ts +14 -0
- package/dist/types/runtime/effect/handler/openapi.d.ts +4 -0
- package/dist/types/runtime/effect/handler/routing.d.ts +5 -0
- package/dist/types/runtime/effect/handler/rpc.d.ts +7 -0
- package/dist/types/runtime/effect/handler/types.d.ts +148 -0
- package/dist/types/runtime/effect/handler.d.ts +4 -190
- package/dist/types/runtime/effect/index.d.ts +3 -0
- package/dist/types/runtime/effect/module.d.ts +3 -2
- package/dist/types/runtime/effect/rpcSerialization.d.ts +3 -0
- package/dist/types/runtime/effect-client/batch.d.ts +2 -0
- package/dist/types/runtime/effect-client/envelope.d.ts +15 -0
- package/dist/types/runtime/effect-client/guards.d.ts +2 -0
- package/dist/types/runtime/effect-client/index.d.ts +1 -1
- package/dist/types/runtime/effect-client/request-context.d.ts +3 -0
- package/dist/types/runtime/effect-client/request.d.ts +1 -0
- package/dist/types/runtime/effect-client/runtime.d.ts +2 -68
- package/dist/types/runtime/effect-client/types.d.ts +68 -0
- package/dist/types/utils/client-generator/files.d.ts +28 -0
- package/dist/types/utils/client-generator/generate.d.ts +26 -0
- package/dist/types/utils/client-generator/index.d.ts +7 -0
- package/dist/types/utils/client-generator/package-json.d.ts +16 -0
- package/dist/types/utils/client-generator/write-package.d.ts +6 -0
- package/dist/types/utils/clientGenerator.d.ts +2 -37
- package/dist/types/utils/crossProjectServerPolicy.d.ts +3 -2
- package/dist/types/utils/effect-client-generator/generator.d.ts +10 -0
- package/dist/types/utils/effect-client-generator/index.d.ts +4 -0
- package/dist/types/utils/effect-client-generator/paths.d.ts +5 -0
- package/dist/types/utils/effect-client-generator/rendering.d.ts +4 -0
- package/dist/types/utils/effect-client-generator/runtime.d.ts +12 -0
- package/dist/types/utils/effect-client-generator/types.d.ts +27 -0
- package/dist/types/utils/effectClientGenerator.d.ts +2 -41
- package/dist/types/utils/effectSourceLoader.d.ts +10 -0
- package/package.json +45 -33
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
"
|
|
4
|
-
module.exports = require("
|
|
3
|
+
"./entry-shape" (module) {
|
|
4
|
+
module.exports = require("./entry-shape.js");
|
|
5
|
+
},
|
|
6
|
+
"./handler/definition" (module) {
|
|
7
|
+
module.exports = require("./handler/definition.js");
|
|
8
|
+
},
|
|
9
|
+
"./handler/http" (module) {
|
|
10
|
+
module.exports = require("./handler/http.js");
|
|
5
11
|
},
|
|
6
12
|
"effect/Config" (module) {
|
|
7
13
|
module.exports = require("effect/Config");
|
|
8
14
|
},
|
|
9
|
-
"effect/Context" (module) {
|
|
10
|
-
module.exports = require("effect/Context");
|
|
11
|
-
},
|
|
12
15
|
"effect/Effect" (module) {
|
|
13
16
|
module.exports = require("effect/Effect");
|
|
14
17
|
},
|
|
@@ -78,18 +81,14 @@ function __webpack_require__(moduleId) {
|
|
|
78
81
|
var __webpack_exports__ = {};
|
|
79
82
|
(()=>{
|
|
80
83
|
__webpack_require__.r(__webpack_exports__);
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
var effect_Config__rspack_import_6 = __webpack_require__("effect/Config");
|
|
88
|
-
var effect_Effect__rspack_import_7 = __webpack_require__("effect/Effect");
|
|
89
|
-
var effect_Option__rspack_import_8 = __webpack_require__("effect/Option");
|
|
90
|
-
var effect_Schema__rspack_import_9 = __webpack_require__("effect/Schema");
|
|
84
|
+
var effect_Config__rspack_import_0 = __webpack_require__("effect/Config");
|
|
85
|
+
var effect_Effect__rspack_import_1 = __webpack_require__("effect/Effect");
|
|
86
|
+
var effect_Layer__rspack_import_2 = __webpack_require__("effect/Layer");
|
|
87
|
+
var effect_Option__rspack_import_3 = __webpack_require__("effect/Option");
|
|
88
|
+
var effect_Schema__rspack_import_4 = __webpack_require__("effect/Schema");
|
|
89
|
+
var effect_unstable_http__rspack_import_5 = __webpack_require__("effect/unstable/http");
|
|
91
90
|
var __rspack_reexport = {};
|
|
92
|
-
for(const __rspack_import_key in
|
|
91
|
+
for(const __rspack_import_key in effect_unstable_http__rspack_import_5)if ([
|
|
93
92
|
"Config",
|
|
94
93
|
"Layer",
|
|
95
94
|
"Schema",
|
|
@@ -103,10 +102,11 @@ var __webpack_exports__ = {};
|
|
|
103
102
|
"EFFECT_VALIDATOR_AWARE_FACTORY",
|
|
104
103
|
"isValidatorAwareHandlerFactory",
|
|
105
104
|
"Option"
|
|
106
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
105
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>effect_unstable_http__rspack_import_5[__rspack_import_key];
|
|
107
106
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
107
|
+
var effect_unstable_httpapi__rspack_import_6 = __webpack_require__("effect/unstable/httpapi");
|
|
108
108
|
var __rspack_reexport = {};
|
|
109
|
-
for(const __rspack_import_key in
|
|
109
|
+
for(const __rspack_import_key in effect_unstable_httpapi__rspack_import_6)if ([
|
|
110
110
|
"Config",
|
|
111
111
|
"Layer",
|
|
112
112
|
"Schema",
|
|
@@ -120,10 +120,11 @@ var __webpack_exports__ = {};
|
|
|
120
120
|
"EFFECT_VALIDATOR_AWARE_FACTORY",
|
|
121
121
|
"isValidatorAwareHandlerFactory",
|
|
122
122
|
"Option"
|
|
123
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
123
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>effect_unstable_httpapi__rspack_import_6[__rspack_import_key];
|
|
124
124
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
125
|
+
var effect_unstable_rpc__rspack_import_7 = __webpack_require__("effect/unstable/rpc");
|
|
125
126
|
var __rspack_reexport = {};
|
|
126
|
-
for(const __rspack_import_key in
|
|
127
|
+
for(const __rspack_import_key in effect_unstable_rpc__rspack_import_7)if ([
|
|
127
128
|
"Config",
|
|
128
129
|
"Layer",
|
|
129
130
|
"Schema",
|
|
@@ -137,517 +138,24 @@ var __webpack_exports__ = {};
|
|
|
137
138
|
"EFFECT_VALIDATOR_AWARE_FACTORY",
|
|
138
139
|
"isValidatorAwareHandlerFactory",
|
|
139
140
|
"Option"
|
|
140
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
141
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>effect_unstable_rpc__rspack_import_7[__rspack_import_key];
|
|
141
142
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const EFFECT_VALIDATOR_AWARE_FACTORY = Symbol.for('modernjs.effect.validatorAware');
|
|
146
|
-
function isValidatorAwareHandlerFactory(factory) {
|
|
147
|
-
return 'function' == typeof factory && true === factory[EFFECT_VALIDATOR_AWARE_FACTORY];
|
|
148
|
-
}
|
|
149
|
-
function normalizeOpenApiPath(pathname) {
|
|
150
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
151
|
-
return pathname;
|
|
152
|
-
}
|
|
153
|
-
function getOpenApiOptions(openapi) {
|
|
154
|
-
if (!openapi || 'object' != typeof openapi) return;
|
|
155
|
-
if (!openapi.path) return;
|
|
156
|
-
return {
|
|
157
|
-
path: normalizeOpenApiPath(openapi.path)
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
function normalizeRpcPath(pathname) {
|
|
161
|
-
if (!pathname || '/' === pathname) return '/rpc';
|
|
162
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
163
|
-
return pathname;
|
|
164
|
-
}
|
|
165
|
-
function normalizeBatchPath(pathname) {
|
|
166
|
-
if (!pathname || '/' === pathname) return _data_platform__rspack_import_5.DEFAULT_DATA_BATCH_ENDPOINT;
|
|
167
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
168
|
-
return pathname;
|
|
169
|
-
}
|
|
170
|
-
function isPlainObject(value) {
|
|
171
|
-
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
172
|
-
}
|
|
173
|
-
function toTextLength(value) {
|
|
174
|
-
if ("u" > typeof TextEncoder) return new TextEncoder().encode(value).length;
|
|
175
|
-
if ("u" > typeof Buffer) return Buffer.byteLength(value);
|
|
176
|
-
return value.length;
|
|
177
|
-
}
|
|
178
|
-
function toHeaderRecord(headers) {
|
|
179
|
-
const record = {};
|
|
180
|
-
headers.forEach((value, key)=>{
|
|
181
|
-
record[key] = value;
|
|
182
|
-
});
|
|
183
|
-
return record;
|
|
184
|
-
}
|
|
185
|
-
function normalizeItemMethod(method) {
|
|
186
|
-
return (method || 'GET').toUpperCase();
|
|
187
|
-
}
|
|
188
|
-
function normalizeBatchAllowedMethods(allowedMethods) {
|
|
189
|
-
const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
|
|
190
|
-
'GET'
|
|
191
|
-
];
|
|
192
|
-
return new Set(source.map((method)=>method.toUpperCase()));
|
|
193
|
-
}
|
|
194
|
-
function isBatchRequestPayload(value) {
|
|
195
|
-
return isPlainObject(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
|
|
196
|
-
}
|
|
197
|
-
function createBatchValidationResponse(message, status = 400) {
|
|
198
|
-
return new Response(JSON.stringify({
|
|
199
|
-
message
|
|
200
|
-
}), {
|
|
201
|
-
status,
|
|
202
|
-
headers: {
|
|
203
|
-
'content-type': 'application/json; charset=utf-8'
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
function createJsonValidationResponse(message, status = 400) {
|
|
208
|
-
return new Response(JSON.stringify({
|
|
209
|
-
message
|
|
210
|
-
}), {
|
|
211
|
-
status,
|
|
212
|
-
headers: {
|
|
213
|
-
'content-type': 'application/json; charset=utf-8'
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function cloneWithoutJsonBodyHeaders(request) {
|
|
218
|
-
const headers = new Headers(request.headers);
|
|
219
|
-
headers.delete('content-type');
|
|
220
|
-
headers.delete('content-length');
|
|
221
|
-
return new Request(request.url, {
|
|
222
|
-
method: request.method,
|
|
223
|
-
headers,
|
|
224
|
-
signal: request.signal
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
async function prepareJsonRequestBody(request) {
|
|
228
|
-
const method = normalizeItemMethod(request.method);
|
|
229
|
-
if ('GET' === method || 'HEAD' === method) return request;
|
|
230
|
-
const contentType = (request.headers.get('content-type') || '').toLowerCase();
|
|
231
|
-
if (!contentType.includes('application/json')) return request;
|
|
232
|
-
if (null === request.body) return cloneWithoutJsonBodyHeaders(request);
|
|
233
|
-
try {
|
|
234
|
-
const bodyText = await request.clone().text();
|
|
235
|
-
if ('' === bodyText) return cloneWithoutJsonBodyHeaders(request);
|
|
236
|
-
JSON.parse(bodyText);
|
|
237
|
-
} catch {
|
|
238
|
-
return createJsonValidationResponse('Invalid JSON request body');
|
|
239
|
-
}
|
|
240
|
-
return request;
|
|
241
|
-
}
|
|
242
|
-
function toBatchItemError(id, status, message) {
|
|
243
|
-
return {
|
|
244
|
-
id,
|
|
245
|
-
status,
|
|
246
|
-
headers: {
|
|
247
|
-
'content-type': 'application/json; charset=utf-8'
|
|
248
|
-
},
|
|
249
|
-
body: JSON.stringify({
|
|
250
|
-
message
|
|
251
|
-
})
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function promiseWithTimeout(effect, timeoutMs) {
|
|
255
|
-
if (timeoutMs <= 0) return effect;
|
|
256
|
-
return new Promise((resolve, reject)=>{
|
|
257
|
-
const timer = setTimeout(()=>{
|
|
258
|
-
reject(new Error(`Batch item timeout after ${String(timeoutMs)}ms`));
|
|
259
|
-
}, timeoutMs);
|
|
260
|
-
effect.then((value)=>{
|
|
261
|
-
clearTimeout(timer);
|
|
262
|
-
resolve(value);
|
|
263
|
-
}, (error)=>{
|
|
264
|
-
clearTimeout(timer);
|
|
265
|
-
reject(error);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
async function mapWithConcurrency(items, concurrency, mapper) {
|
|
270
|
-
if (0 === items.length) return [];
|
|
271
|
-
const normalizedConcurrency = Math.max(1, concurrency);
|
|
272
|
-
const output = new Array(items.length);
|
|
273
|
-
let index = 0;
|
|
274
|
-
const workers = Array.from({
|
|
275
|
-
length: Math.min(normalizedConcurrency, items.length)
|
|
276
|
-
}, async ()=>{
|
|
277
|
-
while(true){
|
|
278
|
-
const currentIndex = index;
|
|
279
|
-
index += 1;
|
|
280
|
-
if (currentIndex >= items.length) return;
|
|
281
|
-
output[currentIndex] = await mapper(items[currentIndex], currentIndex);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
await Promise.all(workers);
|
|
285
|
-
return output;
|
|
286
|
-
}
|
|
287
|
-
function getRequestPathname(request) {
|
|
288
|
-
try {
|
|
289
|
-
return new URL(request.url).pathname;
|
|
290
|
-
} catch {
|
|
291
|
-
return new URL(request.url, 'http://localhost').pathname;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function normalizeMountPrefix(prefix) {
|
|
295
|
-
if (!prefix || '/' === prefix) return '';
|
|
296
|
-
return prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
|
|
297
|
-
}
|
|
298
|
-
function getMountedPrefixFromContext(request, context) {
|
|
299
|
-
if (!isPlainObject(context) || 'string' != typeof context.path) return '';
|
|
300
|
-
const contextPath = normalizeMountPrefix(context.path);
|
|
301
|
-
const requestPath = normalizeMountPrefix(getRequestPathname(request));
|
|
302
|
-
if (!contextPath || !requestPath || contextPath === requestPath || !contextPath.endsWith(requestPath)) return '';
|
|
303
|
-
return normalizeMountPrefix(contextPath.slice(0, contextPath.length - requestPath.length));
|
|
304
|
-
}
|
|
305
|
-
function removeMountedPrefixFromBatchPath(pathWithQuery, prefix) {
|
|
306
|
-
const normalizedPrefix = normalizeMountPrefix(prefix);
|
|
307
|
-
if (!normalizedPrefix) return pathWithQuery;
|
|
308
|
-
const [pathname, ...queryParts] = pathWithQuery.split('?');
|
|
309
|
-
if (!pathname) return pathWithQuery;
|
|
310
|
-
let nextPathname = pathname;
|
|
311
|
-
if (pathname === normalizedPrefix) nextPathname = '/';
|
|
312
|
-
else if (pathname.startsWith(`${normalizedPrefix}/`)) {
|
|
313
|
-
const sliced = pathname.slice(normalizedPrefix.length);
|
|
314
|
-
nextPathname = sliced.startsWith('/') ? sliced : `/${sliced}`;
|
|
315
|
-
}
|
|
316
|
-
if (0 === queryParts.length) return nextPathname;
|
|
317
|
-
return `${nextPathname}?${queryParts.join('?')}`;
|
|
318
|
-
}
|
|
319
|
-
function getRequestOrigin(request) {
|
|
320
|
-
try {
|
|
321
|
-
return new URL(request.url).origin;
|
|
322
|
-
} catch {
|
|
323
|
-
return new URL(request.url, 'http://localhost').origin;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function getExpectedEnvelopeOrigin(request) {
|
|
327
|
-
const origin = request.headers.get('origin');
|
|
328
|
-
if (origin && 'null' !== origin) return origin;
|
|
329
|
-
return getRequestOrigin(request);
|
|
330
|
-
}
|
|
331
|
-
function isRpcRequest(request, rpcPath) {
|
|
332
|
-
const pathname = getRequestPathname(request);
|
|
333
|
-
return pathname === rpcPath || pathname.startsWith(`${rpcPath}/`);
|
|
334
|
-
}
|
|
335
|
-
function getRpcSerializationLayer(serialization) {
|
|
336
|
-
switch(serialization){
|
|
337
|
-
case 'ndjson':
|
|
338
|
-
return effect_unstable_rpc__rspack_import_4.RpcSerialization.layerNdjson;
|
|
339
|
-
case 'jsonRpc':
|
|
340
|
-
return effect_unstable_rpc__rspack_import_4.RpcSerialization.layerJsonRpc();
|
|
341
|
-
case 'ndJsonRpc':
|
|
342
|
-
return effect_unstable_rpc__rspack_import_4.RpcSerialization.layerNdJsonRpc();
|
|
343
|
-
case 'msgPack':
|
|
344
|
-
return effect_unstable_rpc__rspack_import_4.RpcSerialization.layerMsgPack;
|
|
345
|
-
default:
|
|
346
|
-
return effect_unstable_rpc__rspack_import_4.RpcSerialization.layerJsonRpc();
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
function createRpcApiHandler(options) {
|
|
350
|
-
const rpcPath = normalizeRpcPath(options.path);
|
|
351
|
-
const rpcLayer = effect_Layer__rspack_import_1.provide(effect_unstable_rpc__rspack_import_4.RpcServer.layerHttp({
|
|
352
|
-
group: options.group,
|
|
353
|
-
path: rpcPath,
|
|
354
|
-
protocol: 'http',
|
|
355
|
-
disableTracing: options.disableTracing,
|
|
356
|
-
spanPrefix: options.spanPrefix,
|
|
357
|
-
spanAttributes: options.spanAttributes
|
|
358
|
-
}), effect_Layer__rspack_import_1.mergeAll(options.layer, getRpcSerializationLayer(options.serialization)));
|
|
359
|
-
return effect_unstable_http__rspack_import_2.HttpRouter.toWebHandler(rpcLayer);
|
|
360
|
-
}
|
|
361
|
-
function createOpenApiLayer(api, openapi) {
|
|
362
|
-
const openApiOptions = getOpenApiOptions(openapi);
|
|
363
|
-
if (!openApiOptions) return null;
|
|
364
|
-
return effect_unstable_http__rspack_import_2.HttpRouter.add('GET', openApiOptions.path, effect_unstable_http__rspack_import_2.HttpServerResponse.jsonUnsafe(effect_unstable_httpapi__rspack_import_3.OpenApi.fromApi(api)));
|
|
365
|
-
}
|
|
366
|
-
function createInvalidEnvelopeResponse(message, errors) {
|
|
367
|
-
return new Response(JSON.stringify({
|
|
368
|
-
message,
|
|
369
|
-
...errors && errors.length > 0 ? {
|
|
370
|
-
errors
|
|
371
|
-
} : {}
|
|
372
|
-
}), {
|
|
373
|
-
status: 400,
|
|
374
|
-
headers: {
|
|
375
|
-
'content-type': 'application/json; charset=utf-8'
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
function validateDataPlatformRequestEnvelope(request, options) {
|
|
380
|
-
const isEnabled = options?.enabled ?? true;
|
|
381
|
-
if (!isEnabled) return null;
|
|
382
|
-
const envelopeHeader = options?.envelopeHeader || _data_platform__rspack_import_5.DEFAULT_DATA_ENVELOPE_HEADER;
|
|
383
|
-
const encodedEnvelope = request.headers.get(envelopeHeader);
|
|
384
|
-
if (!encodedEnvelope) {
|
|
385
|
-
if (options?.requireEnvelope) return createInvalidEnvelopeResponse(`Missing required data envelope header: ${envelopeHeader}`);
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
const envelope = (0, _data_platform__rspack_import_5.decodeRequestEnvelopeHeader)(encodedEnvelope);
|
|
389
|
-
if (!envelope) return createInvalidEnvelopeResponse(`Invalid data envelope header format: ${envelopeHeader}`);
|
|
390
|
-
const validation = (0, _data_platform__rspack_import_5.validateRequestEnvelope)(envelope, {
|
|
391
|
-
expectedProtocolVersion: 1,
|
|
392
|
-
expectedNamespace: options?.expectedNamespace,
|
|
393
|
-
expectedOrigin: options?.validateOrigin === false ? void 0 : getExpectedEnvelopeOrigin(request),
|
|
394
|
-
requireTraceContext: options?.requireTraceContext
|
|
395
|
-
});
|
|
396
|
-
if (!validation.ok) return createInvalidEnvelopeResponse('Invalid data envelope', validation.errors);
|
|
397
|
-
if (envelope.selectionPlan) {
|
|
398
|
-
const selectionValidation = (0, _data_platform__rspack_import_5.validateSelectionPlan)(envelope.selectionPlan, {
|
|
399
|
-
maxDepth: options?.selection?.maxDepth,
|
|
400
|
-
maxFields: options?.selection?.maxFields,
|
|
401
|
-
allowedLeafPaths: options?.selection?.allowedLeafPaths
|
|
402
|
-
});
|
|
403
|
-
if (!selectionValidation.ok) return createInvalidEnvelopeResponse('Invalid data envelope selection plan', selectionValidation.errors);
|
|
404
|
-
}
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
function mergeDataPlatformOptions(base, override) {
|
|
408
|
-
if (!base && !override) return;
|
|
409
|
-
const baseSelection = base?.selection;
|
|
410
|
-
const overrideSelection = override?.selection;
|
|
411
|
-
const baseBatch = base?.batch;
|
|
412
|
-
const overrideBatch = override?.batch;
|
|
413
|
-
return {
|
|
414
|
-
...base,
|
|
415
|
-
...override,
|
|
416
|
-
selection: baseSelection || overrideSelection ? {
|
|
417
|
-
...baseSelection,
|
|
418
|
-
...overrideSelection
|
|
419
|
-
} : void 0,
|
|
420
|
-
batch: baseBatch || overrideBatch ? {
|
|
421
|
-
...baseBatch,
|
|
422
|
-
...overrideBatch
|
|
423
|
-
} : void 0
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
function defineEffectBff(definition) {
|
|
427
|
-
const createHandler = (options)=>{
|
|
428
|
-
const rpcDefinition = definition.rpc;
|
|
429
|
-
let mergedRpcOptions = rpcDefinition;
|
|
430
|
-
if (rpcDefinition && options?.rpc) mergedRpcOptions = {
|
|
431
|
-
...rpcDefinition,
|
|
432
|
-
...options.rpc
|
|
433
|
-
};
|
|
434
|
-
return createHttpApiHandler({
|
|
435
|
-
api: definition.api,
|
|
436
|
-
layer: definition.layer,
|
|
437
|
-
openapi: options?.openapi,
|
|
438
|
-
rpc: mergedRpcOptions,
|
|
439
|
-
dataPlatform: mergeDataPlatformOptions(definition.dataPlatform, options?.dataPlatform),
|
|
440
|
-
validateRequest: options?.validateRequest
|
|
441
|
-
});
|
|
442
|
-
};
|
|
443
|
-
Object.defineProperty(createHandler, EFFECT_VALIDATOR_AWARE_FACTORY, {
|
|
444
|
-
value: true
|
|
445
|
-
});
|
|
446
|
-
const client = createLoaderMaterializedClientPlaceholder();
|
|
447
|
-
return {
|
|
448
|
-
...definition,
|
|
449
|
-
createHandler,
|
|
450
|
-
client
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
const LOADER_CLIENT_IGNORED_KEYS = new Set([
|
|
454
|
-
'then',
|
|
455
|
-
'catch',
|
|
456
|
-
'finally',
|
|
457
|
-
'toJSON',
|
|
458
|
-
'$$typeof'
|
|
459
|
-
]);
|
|
460
|
-
function createLoaderMaterializedClientPlaceholder() {
|
|
461
|
-
const explain = (property)=>{
|
|
462
|
-
throw new Error(`[BFF][Effect] client.${String(property)} is not available here: the typed client only exists when the API entry is imported through the "@api/index" transformed path (the BFF loader replaces it with generated client code). On the server, use HttpApiClient or call the Effect layer directly.`);
|
|
463
|
-
};
|
|
464
|
-
return new Proxy(Object.create(null), {
|
|
465
|
-
get (_target, property) {
|
|
466
|
-
if ('symbol' == typeof property || LOADER_CLIENT_IGNORED_KEYS.has(property)) return;
|
|
467
|
-
return explain(property);
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
function defineEffectRpcBff(definition) {
|
|
472
|
-
const createHandler = (options)=>createRpcApiHandler({
|
|
473
|
-
...definition,
|
|
474
|
-
...options
|
|
475
|
-
});
|
|
476
|
-
return {
|
|
477
|
-
...definition,
|
|
478
|
-
createHandler
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
function createHttpApiHandler(options) {
|
|
482
|
-
const apiLayer = options.layer.pipe(effect_Layer__rspack_import_1.provide(effect_unstable_http__rspack_import_2.HttpServer.layerServices));
|
|
483
|
-
const openApiLayer = createOpenApiLayer(options.api, options.openapi);
|
|
484
|
-
const mergedLayer = openApiLayer ? effect_Layer__rspack_import_1.mergeAll(apiLayer, openApiLayer) : apiLayer;
|
|
485
|
-
const httpApiHandler = effect_unstable_http__rspack_import_2.HttpRouter.toWebHandler(mergedLayer);
|
|
486
|
-
const dataPlatformBatchOptions = options.dataPlatform?.batch;
|
|
487
|
-
const batchEnabled = dataPlatformBatchOptions?.enabled !== false;
|
|
488
|
-
const batchPath = normalizeBatchPath(dataPlatformBatchOptions?.endpoint);
|
|
489
|
-
const batchMaxSize = Math.max(1, dataPlatformBatchOptions?.maxBatchSize ?? 16);
|
|
490
|
-
const batchMaxBytes = Math.max(1024, dataPlatformBatchOptions?.maxBatchBytes ?? 65536);
|
|
491
|
-
const batchConcurrency = Math.max(1, dataPlatformBatchOptions?.maxConcurrency ?? 4);
|
|
492
|
-
const batchItemTimeoutMs = Math.max(0, dataPlatformBatchOptions?.requestTimeoutMs ?? 10000);
|
|
493
|
-
const batchAllowedMethods = normalizeBatchAllowedMethods(dataPlatformBatchOptions?.allowedMethods);
|
|
494
|
-
const envelopeHeader = options.dataPlatform?.envelopeHeader || _data_platform__rspack_import_5.DEFAULT_DATA_ENVELOPE_HEADER;
|
|
495
|
-
const normalizedEnvelopeHeader = envelopeHeader.toLowerCase();
|
|
496
|
-
const withDataPlatformValidation = async (request, context)=>{
|
|
497
|
-
const policyDenial = options.validateRequest?.(request);
|
|
498
|
-
if (policyDenial) return policyDenial;
|
|
499
|
-
const preparedRequest = await prepareJsonRequestBody(request);
|
|
500
|
-
if (preparedRequest instanceof Response) return preparedRequest;
|
|
501
|
-
const validationError = validateDataPlatformRequestEnvelope(preparedRequest, options.dataPlatform);
|
|
502
|
-
if (validationError) return validationError;
|
|
503
|
-
return httpApiHandler.handler(preparedRequest, toEffectServiceContext(context));
|
|
504
|
-
};
|
|
505
|
-
const handleBatchRequest = async (request, context)=>{
|
|
506
|
-
const mountedPrefix = getMountedPrefixFromContext(request, context);
|
|
507
|
-
const method = normalizeItemMethod(request.method);
|
|
508
|
-
if ('POST' !== method) return createBatchValidationResponse('Batch endpoint only supports POST requests', 405);
|
|
509
|
-
const contentType = request.headers.get('content-type') || '';
|
|
510
|
-
if (!contentType.includes('application/json')) return createBatchValidationResponse('Batch endpoint requires application/json content-type', 415);
|
|
511
|
-
const payloadText = await request.text();
|
|
512
|
-
if (toTextLength(payloadText) > batchMaxBytes) return createBatchValidationResponse(`Batch payload exceeds max size (${String(batchMaxBytes)} bytes)`, 413);
|
|
513
|
-
let payload;
|
|
514
|
-
try {
|
|
515
|
-
payload = JSON.parse(payloadText);
|
|
516
|
-
} catch {
|
|
517
|
-
return createBatchValidationResponse('Invalid batch payload JSON');
|
|
518
|
-
}
|
|
519
|
-
if (!isBatchRequestPayload(payload)) return createBatchValidationResponse('Invalid batch payload shape');
|
|
520
|
-
if (0 === payload.items.length) return createBatchValidationResponse('Batch payload items cannot be empty');
|
|
521
|
-
if (payload.items.length > batchMaxSize) return createBatchValidationResponse(`Batch item count exceeds max size (${String(batchMaxSize)})`, 413);
|
|
522
|
-
const responseItems = await mapWithConcurrency(payload.items, batchConcurrency, async (rawItem, index)=>{
|
|
523
|
-
const fallbackId = `item_${String(index)}`;
|
|
524
|
-
const itemId = isPlainObject(rawItem) && 'string' == typeof rawItem.id ? rawItem.id : fallbackId;
|
|
525
|
-
if (!isPlainObject(rawItem)) return toBatchItemError(itemId, 400, 'Invalid batch item; expected object');
|
|
526
|
-
if ('string' != typeof rawItem.path || 0 === rawItem.path.length) return toBatchItemError(itemId, 400, 'Invalid batch item path');
|
|
527
|
-
if (!rawItem.path.startsWith('/')) return toBatchItemError(itemId, 400, 'Batch item path must start with "/"');
|
|
528
|
-
const normalizedItemPath = removeMountedPrefixFromBatchPath(rawItem.path, mountedPrefix);
|
|
529
|
-
const itemPathname = normalizedItemPath.split('?')[0] || normalizedItemPath;
|
|
530
|
-
if (itemPathname === batchPath || itemPathname.startsWith(`${batchPath}/`)) return toBatchItemError(itemId, 400, 'Batch item path cannot target batch endpoint');
|
|
531
|
-
const itemMethod = normalizeItemMethod('string' == typeof rawItem.method ? rawItem.method : void 0);
|
|
532
|
-
if (!batchAllowedMethods.has(itemMethod)) return toBatchItemError(itemId, 405, `Batch item method ${itemMethod} is not allowed`);
|
|
533
|
-
if (void 0 !== rawItem.body && null !== rawItem.body && 'string' != typeof rawItem.body) return toBatchItemError(itemId, 400, 'Batch item body must be a string when provided');
|
|
534
|
-
if (('GET' === itemMethod || 'HEAD' === itemMethod) && 'string' == typeof rawItem.body) return toBatchItemError(itemId, 400, `${itemMethod} batch item cannot include body`);
|
|
535
|
-
const normalizedHeaders = {};
|
|
536
|
-
if (void 0 !== rawItem.headers) {
|
|
537
|
-
if (!isPlainObject(rawItem.headers)) return toBatchItemError(itemId, 400, 'Batch item headers must be an object');
|
|
538
|
-
for (const [key, value] of Object.entries(rawItem.headers)){
|
|
539
|
-
if ('string' != typeof value) return toBatchItemError(itemId, 400, `Invalid header "${key}" for batch item`);
|
|
540
|
-
normalizedHeaders[key.toLowerCase()] = value;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
if (!normalizedHeaders.traceparent) {
|
|
544
|
-
const encodedEnvelope = normalizedHeaders[normalizedEnvelopeHeader];
|
|
545
|
-
if ('string' == typeof encodedEnvelope) {
|
|
546
|
-
const envelope = (0, _data_platform__rspack_import_5.decodeRequestEnvelopeHeader)(encodedEnvelope);
|
|
547
|
-
if (envelope?.traceparent) normalizedHeaders.traceparent = envelope.traceparent;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
if (!normalizedHeaders.traceparent) {
|
|
551
|
-
const requestTraceparent = request.headers.get('traceparent');
|
|
552
|
-
if (requestTraceparent) normalizedHeaders.traceparent = requestTraceparent;
|
|
553
|
-
}
|
|
554
|
-
const targetUrl = new URL(normalizedItemPath, request.url);
|
|
555
|
-
const requestHeaders = new Headers(normalizedHeaders);
|
|
556
|
-
const body = 'GET' === itemMethod || 'HEAD' === itemMethod ? void 0 : rawItem.body;
|
|
557
|
-
if (void 0 === body) requestHeaders.delete('content-type');
|
|
558
|
-
const itemRequest = new Request(targetUrl.toString(), {
|
|
559
|
-
method: itemMethod,
|
|
560
|
-
headers: requestHeaders,
|
|
561
|
-
body
|
|
562
|
-
});
|
|
563
|
-
try {
|
|
564
|
-
const itemResponse = await promiseWithTimeout(withDataPlatformValidation(itemRequest, context), batchItemTimeoutMs);
|
|
565
|
-
if (!(itemResponse instanceof Response)) return toBatchItemError(itemId, 500, 'Invalid response returned by batch item handler');
|
|
566
|
-
const bodyText = await itemResponse.text();
|
|
567
|
-
const responseItem = {
|
|
568
|
-
id: itemId,
|
|
569
|
-
status: itemResponse.status,
|
|
570
|
-
headers: toHeaderRecord(itemResponse.headers),
|
|
571
|
-
...bodyText ? {
|
|
572
|
-
body: bodyText
|
|
573
|
-
} : {}
|
|
574
|
-
};
|
|
575
|
-
return responseItem;
|
|
576
|
-
} catch (error) {
|
|
577
|
-
if (error instanceof Response) {
|
|
578
|
-
const bodyText = await error.text();
|
|
579
|
-
return {
|
|
580
|
-
id: itemId,
|
|
581
|
-
status: error.status,
|
|
582
|
-
headers: toHeaderRecord(error.headers),
|
|
583
|
-
...bodyText ? {
|
|
584
|
-
body: bodyText
|
|
585
|
-
} : {}
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
589
|
-
return toBatchItemError(itemId, 500, message);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
const responsePayload = {
|
|
593
|
-
protocolVersion: 1,
|
|
594
|
-
batchId: payload.batchId,
|
|
595
|
-
receivedAt: Date.now(),
|
|
596
|
-
items: responseItems
|
|
597
|
-
};
|
|
598
|
-
return new Response(JSON.stringify(responsePayload), {
|
|
599
|
-
status: 200,
|
|
600
|
-
headers: {
|
|
601
|
-
'content-type': 'application/json; charset=utf-8',
|
|
602
|
-
[_data_platform__rspack_import_5.DEFAULT_DATA_BATCH_HEADER]: '1',
|
|
603
|
-
'x-modernjs-data-batch-id': payload.batchId
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
};
|
|
607
|
-
const handleHttpApiRequest = async (request, context)=>{
|
|
608
|
-
const pathname = getRequestPathname(request);
|
|
609
|
-
if (batchEnabled && pathname === batchPath) return handleBatchRequest(request, context);
|
|
610
|
-
return withDataPlatformValidation(request, context);
|
|
611
|
-
};
|
|
612
|
-
if (!options.rpc) return {
|
|
613
|
-
handler: handleHttpApiRequest,
|
|
614
|
-
dispose: async ()=>{
|
|
615
|
-
await httpApiHandler.dispose();
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
const rpcPath = normalizeRpcPath(options.rpc.path);
|
|
619
|
-
const rpcHandler = createRpcApiHandler(options.rpc);
|
|
620
|
-
return {
|
|
621
|
-
handler: async (request, context)=>{
|
|
622
|
-
if (isRpcRequest(request, rpcPath)) {
|
|
623
|
-
const policyDenial = options.validateRequest?.(request);
|
|
624
|
-
if (policyDenial) return policyDenial;
|
|
625
|
-
return rpcHandler.handler(request, toEffectServiceContext(context));
|
|
626
|
-
}
|
|
627
|
-
return handleHttpApiRequest(request);
|
|
628
|
-
},
|
|
629
|
-
dispose: async ()=>{
|
|
630
|
-
await Promise.all([
|
|
631
|
-
httpApiHandler.dispose(),
|
|
632
|
-
rpcHandler.dispose()
|
|
633
|
-
]);
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
}
|
|
143
|
+
var _entry_shape__rspack_import_8 = __webpack_require__("./entry-shape");
|
|
144
|
+
var _handler_definition__rspack_import_9 = __webpack_require__("./handler/definition");
|
|
145
|
+
var _handler_http__rspack_import_10 = __webpack_require__("./handler/http");
|
|
637
146
|
__webpack_require__.d(__webpack_exports__, {
|
|
638
|
-
Config: ()=>
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
EFFECT_VALIDATOR_AWARE_FACTORY: EFFECT_VALIDATOR_AWARE_FACTORY
|
|
147
|
+
Config: ()=>effect_Config__rspack_import_0,
|
|
148
|
+
EFFECT_VALIDATOR_AWARE_FACTORY: ()=>_entry_shape__rspack_import_8.EFFECT_VALIDATOR_AWARE_FACTORY,
|
|
149
|
+
Effect: ()=>effect_Effect__rspack_import_1,
|
|
150
|
+
HttpApiBuilder: ()=>effect_unstable_httpapi__rspack_import_6.HttpApiBuilder,
|
|
151
|
+
HttpTraceContext: ()=>effect_unstable_http__rspack_import_5.HttpTraceContext,
|
|
152
|
+
Layer: ()=>effect_Layer__rspack_import_2,
|
|
153
|
+
Option: ()=>effect_Option__rspack_import_3,
|
|
154
|
+
Schema: ()=>effect_Schema__rspack_import_4,
|
|
155
|
+
createHttpApiHandler: ()=>_handler_http__rspack_import_10.createHttpApiHandler,
|
|
156
|
+
defineEffectBff: ()=>_handler_definition__rspack_import_9.defineEffectBff,
|
|
157
|
+
defineEffectRpcBff: ()=>_handler_definition__rspack_import_9.defineEffectRpcBff,
|
|
158
|
+
isValidatorAwareHandlerFactory: ()=>_entry_shape__rspack_import_8.isValidatorAwareHandlerFactory
|
|
651
159
|
});
|
|
652
160
|
})();
|
|
653
161
|
exports.Config = __webpack_exports__.Config;
|