@bleedingdev/modern-js-plugin-bff 3.8.3-ultramodern.1 → 3.8.3-ultramodern.3
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/generator.js +45 -53
- package/dist/cjs/cli/serverGlobalVars.js +1 -1
- package/dist/cjs/cli.js +1 -0
- package/dist/cjs/loader.js +7 -18
- package/dist/cjs/runtime/data-platform/index.js +32 -94
- package/dist/cjs/runtime/effect/edge-dispatcher.js +5 -91
- package/dist/cjs/runtime/effect/edge.js +11 -45
- package/dist/cjs/runtime/effect/index.js +173 -55
- package/dist/cjs/runtime/effect-client/index.js +32 -166
- package/dist/cjs/runtime/effect-client/runtime.js +32 -70
- package/dist/cjs/runtime/hono/adapter.js +13 -54
- package/dist/cjs/server.js +2 -2
- package/dist/cjs/utils/client-generator/generate.js +9 -6
- package/dist/cjs/utils/crossProjectApiPlugin.js +5 -1
- package/dist/cjs/utils/pluginGenerator.js +4 -4
- package/dist/cjs/utils/runtimeGenerator.js +4 -16
- package/dist/esm/cli/generator.mjs +45 -53
- package/dist/esm/cli/serverGlobalVars.mjs +1 -1
- package/dist/esm/cli.mjs +1 -0
- package/dist/esm/loader.mjs +5 -16
- package/dist/esm/runtime/data-platform/index.mjs +1 -7
- package/dist/esm/runtime/effect/edge-dispatcher.mjs +1 -38
- package/dist/esm/runtime/effect/edge.mjs +2 -2
- package/dist/esm/runtime/effect/index.mjs +16 -8
- package/dist/esm/runtime/effect-client/index.mjs +1 -98
- package/dist/esm/runtime/effect-client/runtime.mjs +1 -62
- package/dist/esm/runtime/hono/adapter.mjs +13 -54
- package/dist/esm/server.mjs +2 -2
- package/dist/esm/utils/client-generator/generate.mjs +8 -5
- package/dist/esm/utils/crossProjectApiPlugin.mjs +3 -2
- package/dist/esm/utils/pluginGenerator.mjs +5 -5
- package/dist/esm/utils/runtimeGenerator.mjs +4 -16
- package/dist/esm-node/cli/generator.mjs +45 -53
- package/dist/esm-node/cli/serverGlobalVars.mjs +1 -1
- package/dist/esm-node/cli.mjs +1 -0
- package/dist/esm-node/loader.mjs +5 -16
- package/dist/esm-node/runtime/data-platform/index.mjs +1 -7
- package/dist/esm-node/runtime/effect/edge-dispatcher.mjs +1 -38
- package/dist/esm-node/runtime/effect/edge.mjs +2 -2
- package/dist/esm-node/runtime/effect/index.mjs +16 -8
- package/dist/esm-node/runtime/effect-client/index.mjs +1 -98
- package/dist/esm-node/runtime/effect-client/runtime.mjs +1 -62
- package/dist/esm-node/runtime/hono/adapter.mjs +13 -54
- package/dist/esm-node/server.mjs +2 -2
- package/dist/esm-node/utils/client-generator/generate.mjs +8 -5
- package/dist/esm-node/utils/crossProjectApiPlugin.mjs +3 -2
- package/dist/esm-node/utils/pluginGenerator.mjs +5 -5
- package/dist/esm-node/utils/runtimeGenerator.mjs +4 -16
- package/dist/types/loader.d.ts +1 -0
- package/dist/types/runtime/data-platform/index.d.ts +1 -8
- package/dist/types/runtime/effect/edge-dispatcher.d.ts +1 -26
- package/dist/types/runtime/effect/edge.d.ts +2 -2
- package/dist/types/runtime/effect/index.d.ts +15 -7
- package/dist/types/runtime/effect-client/index.d.ts +1 -58
- package/dist/types/runtime/effect-client/runtime.d.ts +1 -5
- package/dist/types/runtime/hono/adapter.d.ts +1 -11
- package/dist/types/utils/client-generator/generate.d.ts +2 -1
- package/dist/types/utils/crossProjectApiPlugin.d.ts +1 -0
- package/dist/types/utils/pluginGenerator.d.ts +2 -1
- package/package.json +29 -28
- package/dist/cjs/runtime/data-platform/batch/queue.js +0 -284
- package/dist/cjs/runtime/data-platform/batch/request.js +0 -98
- package/dist/cjs/runtime/data-platform/batch/response.js +0 -64
- package/dist/cjs/runtime/data-platform/batch/telemetry.js +0 -67
- package/dist/cjs/runtime/data-platform/batch/url.js +0 -69
- package/dist/cjs/runtime/data-platform/batch-transport.js +0 -59
- package/dist/cjs/runtime/data-platform/codec.js +0 -155
- package/dist/cjs/runtime/data-platform/invalidation.js +0 -61
- package/dist/cjs/runtime/data-platform/trace.js +0 -73
- package/dist/cjs/runtime/data-platform/types.js +0 -48
- package/dist/cjs/runtime/data-platform/validation.js +0 -178
- package/dist/cjs/runtime/effect/adapter/constants.js +0 -44
- package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +0 -66
- package/dist/cjs/runtime/effect/adapter/entry.js +0 -100
- package/dist/cjs/runtime/effect/adapter/error-response.js +0 -81
- package/dist/cjs/runtime/effect/adapter/handler.js +0 -53
- package/dist/cjs/runtime/effect/adapter.js +0 -155
- package/dist/cjs/runtime/effect/backend-federation/entry.js +0 -99
- package/dist/cjs/runtime/effect/backend-federation/identity.js +0 -82
- package/dist/cjs/runtime/effect/backend-federation/load.js +0 -75
- package/dist/cjs/runtime/effect/backend-federation/plugin.js +0 -63
- package/dist/cjs/runtime/effect/backend-federation/remotes.js +0 -51
- package/dist/cjs/runtime/effect/backend-federation/runtime.js +0 -128
- package/dist/cjs/runtime/effect/backend-federation/types.js +0 -18
- package/dist/cjs/runtime/effect/backend-federation/utils.js +0 -48
- package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +0 -83
- package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +0 -55
- package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +0 -94
- package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +0 -101
- package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +0 -120
- package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +0 -68
- package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +0 -18
- package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +0 -109
- package/dist/cjs/runtime/effect/backend-federation-manifest.js +0 -62
- package/dist/cjs/runtime/effect/backend-federation.js +0 -65
- package/dist/cjs/runtime/effect/context.js +0 -60
- package/dist/cjs/runtime/effect/dispatch.js +0 -101
- package/dist/cjs/runtime/effect/edge-context.js +0 -81
- package/dist/cjs/runtime/effect/endpoint-contracts.js +0 -121
- package/dist/cjs/runtime/effect/entry-shape.js +0 -84
- package/dist/cjs/runtime/effect/handler/batch-handler.js +0 -161
- package/dist/cjs/runtime/effect/handler/batch.js +0 -159
- package/dist/cjs/runtime/effect/handler/definition.js +0 -102
- package/dist/cjs/runtime/effect/handler/envelope.js +0 -104
- package/dist/cjs/runtime/effect/handler/http.js +0 -107
- package/dist/cjs/runtime/effect/handler/openapi.js +0 -57
- package/dist/cjs/runtime/effect/handler/routing.js +0 -100
- package/dist/cjs/runtime/effect/handler/rpc.js +0 -63
- package/dist/cjs/runtime/effect/handler/types.js +0 -43
- package/dist/cjs/runtime/effect/handler.js +0 -189
- package/dist/cjs/runtime/effect/module.js +0 -113
- package/dist/cjs/runtime/effect/operation-context.js +0 -103
- package/dist/cjs/runtime/effect/rpcSerialization.js +0 -54
- package/dist/cjs/runtime/effect-client/batch.js +0 -73
- package/dist/cjs/runtime/effect-client/envelope.js +0 -145
- package/dist/cjs/runtime/effect-client/guards.js +0 -44
- package/dist/cjs/runtime/effect-client/request-context.js +0 -64
- package/dist/cjs/runtime/effect-client/request.js +0 -66
- package/dist/cjs/runtime/effect-client/types.js +0 -18
- package/dist/cjs/runtime/safe-failure.js +0 -84
- package/dist/cjs/utils/crossProjectServerPolicy.js +0 -98
- package/dist/cjs/utils/effect-client-generator/generator.js +0 -69
- package/dist/cjs/utils/effect-client-generator/index.js +0 -51
- package/dist/cjs/utils/effect-client-generator/paths.js +0 -62
- package/dist/cjs/utils/effect-client-generator/rendering.js +0 -220
- package/dist/cjs/utils/effect-client-generator/runtime.js +0 -68
- package/dist/cjs/utils/effect-client-generator/types.js +0 -18
- package/dist/cjs/utils/effectClientGenerator.js +0 -49
- package/dist/cjs/utils/effectSourceLoader.js +0 -312
- package/dist/cjs/utils/headers.js +0 -46
- package/dist/esm/runtime/data-platform/batch/queue.mjs +0 -246
- package/dist/esm/runtime/data-platform/batch/request.mjs +0 -45
- package/dist/esm/runtime/data-platform/batch/response.mjs +0 -23
- package/dist/esm/runtime/data-platform/batch/telemetry.mjs +0 -23
- package/dist/esm/runtime/data-platform/batch/url.mjs +0 -25
- package/dist/esm/runtime/data-platform/batch-transport.mjs +0 -12
- package/dist/esm/runtime/data-platform/codec.mjs +0 -90
- package/dist/esm/runtime/data-platform/invalidation.mjs +0 -20
- package/dist/esm/runtime/data-platform/trace.mjs +0 -29
- package/dist/esm/runtime/data-platform/types.mjs +0 -4
- package/dist/esm/runtime/data-platform/validation.mjs +0 -128
- package/dist/esm/runtime/effect/adapter/constants.mjs +0 -6
- package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +0 -28
- package/dist/esm/runtime/effect/adapter/entry.mjs +0 -52
- package/dist/esm/runtime/effect/adapter/error-response.mjs +0 -43
- package/dist/esm/runtime/effect/adapter/handler.mjs +0 -15
- package/dist/esm/runtime/effect/adapter.mjs +0 -107
- package/dist/esm/runtime/effect/backend-federation/entry.mjs +0 -61
- package/dist/esm/runtime/effect/backend-federation/identity.mjs +0 -41
- package/dist/esm/runtime/effect/backend-federation/load.mjs +0 -37
- package/dist/esm/runtime/effect/backend-federation/plugin.mjs +0 -25
- package/dist/esm/runtime/effect/backend-federation/remotes.mjs +0 -13
- package/dist/esm/runtime/effect/backend-federation/runtime.mjs +0 -90
- package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation/utils.mjs +0 -7
- package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +0 -32
- package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +0 -4
- package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +0 -56
- package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +0 -42
- package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +0 -76
- package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +0 -30
- package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +0 -65
- package/dist/esm/runtime/effect/backend-federation-manifest.mjs +0 -1
- package/dist/esm/runtime/effect/backend-federation.mjs +0 -5
- package/dist/esm/runtime/effect/context.mjs +0 -13
- package/dist/esm/runtime/effect/dispatch.mjs +0 -63
- package/dist/esm/runtime/effect/edge-context.mjs +0 -34
- package/dist/esm/runtime/effect/endpoint-contracts.mjs +0 -68
- package/dist/esm/runtime/effect/entry-shape.mjs +0 -36
- package/dist/esm/runtime/effect/handler/batch-handler.mjs +0 -123
- package/dist/esm/runtime/effect/handler/batch.mjs +0 -97
- package/dist/esm/runtime/effect/handler/definition.mjs +0 -61
- package/dist/esm/runtime/effect/handler/envelope.mjs +0 -63
- package/dist/esm/runtime/effect/handler/http.mjs +0 -69
- package/dist/esm/runtime/effect/handler/openapi.mjs +0 -19
- package/dist/esm/runtime/effect/handler/routing.mjs +0 -50
- package/dist/esm/runtime/effect/handler/rpc.mjs +0 -22
- package/dist/esm/runtime/effect/handler/types.mjs +0 -5
- package/dist/esm/runtime/effect/handler.mjs +0 -14
- package/dist/esm/runtime/effect/module.mjs +0 -75
- package/dist/esm/runtime/effect/operation-context.mjs +0 -65
- package/dist/esm/runtime/effect/rpcSerialization.mjs +0 -16
- package/dist/esm/runtime/effect-client/batch.mjs +0 -35
- package/dist/esm/runtime/effect-client/envelope.mjs +0 -104
- package/dist/esm/runtime/effect-client/guards.mjs +0 -3
- package/dist/esm/runtime/effect-client/request-context.mjs +0 -23
- package/dist/esm/runtime/effect-client/request.mjs +0 -28
- package/dist/esm/runtime/effect-client/types.mjs +0 -0
- package/dist/esm/runtime/safe-failure.mjs +0 -46
- package/dist/esm/utils/crossProjectServerPolicy.mjs +0 -44
- package/dist/esm/utils/effect-client-generator/generator.mjs +0 -28
- package/dist/esm/utils/effect-client-generator/index.mjs +0 -3
- package/dist/esm/utils/effect-client-generator/paths.mjs +0 -24
- package/dist/esm/utils/effect-client-generator/rendering.mjs +0 -179
- package/dist/esm/utils/effect-client-generator/runtime.mjs +0 -27
- package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
- package/dist/esm/utils/effectClientGenerator.mjs +0 -1
- package/dist/esm/utils/effectSourceLoader.mjs +0 -256
- package/dist/esm/utils/headers.mjs +0 -8
- package/dist/esm-node/runtime/data-platform/batch/queue.mjs +0 -247
- package/dist/esm-node/runtime/data-platform/batch/request.mjs +0 -46
- package/dist/esm-node/runtime/data-platform/batch/response.mjs +0 -24
- package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +0 -24
- package/dist/esm-node/runtime/data-platform/batch/url.mjs +0 -26
- package/dist/esm-node/runtime/data-platform/batch-transport.mjs +0 -13
- package/dist/esm-node/runtime/data-platform/codec.mjs +0 -91
- package/dist/esm-node/runtime/data-platform/invalidation.mjs +0 -21
- package/dist/esm-node/runtime/data-platform/trace.mjs +0 -30
- package/dist/esm-node/runtime/data-platform/types.mjs +0 -5
- package/dist/esm-node/runtime/data-platform/validation.mjs +0 -129
- package/dist/esm-node/runtime/effect/adapter/constants.mjs +0 -7
- package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +0 -29
- package/dist/esm-node/runtime/effect/adapter/entry.mjs +0 -53
- package/dist/esm-node/runtime/effect/adapter/error-response.mjs +0 -44
- package/dist/esm-node/runtime/effect/adapter/handler.mjs +0 -16
- package/dist/esm-node/runtime/effect/adapter.mjs +0 -108
- package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +0 -62
- package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +0 -42
- package/dist/esm-node/runtime/effect/backend-federation/load.mjs +0 -38
- package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +0 -26
- package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +0 -14
- package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +0 -91
- package/dist/esm-node/runtime/effect/backend-federation/types.mjs +0 -1
- package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +0 -8
- package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +0 -33
- package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +0 -5
- package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +0 -57
- package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +0 -43
- package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +0 -77
- package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +0 -31
- package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +0 -1
- package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +0 -66
- package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +0 -2
- package/dist/esm-node/runtime/effect/backend-federation.mjs +0 -6
- package/dist/esm-node/runtime/effect/context.mjs +0 -14
- package/dist/esm-node/runtime/effect/dispatch.mjs +0 -64
- package/dist/esm-node/runtime/effect/edge-context.mjs +0 -35
- package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +0 -69
- package/dist/esm-node/runtime/effect/entry-shape.mjs +0 -37
- package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +0 -124
- package/dist/esm-node/runtime/effect/handler/batch.mjs +0 -98
- package/dist/esm-node/runtime/effect/handler/definition.mjs +0 -62
- package/dist/esm-node/runtime/effect/handler/envelope.mjs +0 -64
- package/dist/esm-node/runtime/effect/handler/http.mjs +0 -70
- package/dist/esm-node/runtime/effect/handler/openapi.mjs +0 -20
- package/dist/esm-node/runtime/effect/handler/routing.mjs +0 -51
- package/dist/esm-node/runtime/effect/handler/rpc.mjs +0 -23
- package/dist/esm-node/runtime/effect/handler/types.mjs +0 -6
- package/dist/esm-node/runtime/effect/handler.mjs +0 -15
- package/dist/esm-node/runtime/effect/module.mjs +0 -76
- package/dist/esm-node/runtime/effect/operation-context.mjs +0 -66
- package/dist/esm-node/runtime/effect/rpcSerialization.mjs +0 -17
- package/dist/esm-node/runtime/effect-client/batch.mjs +0 -36
- package/dist/esm-node/runtime/effect-client/envelope.mjs +0 -105
- package/dist/esm-node/runtime/effect-client/guards.mjs +0 -4
- package/dist/esm-node/runtime/effect-client/request-context.mjs +0 -24
- package/dist/esm-node/runtime/effect-client/request.mjs +0 -29
- package/dist/esm-node/runtime/effect-client/types.mjs +0 -1
- package/dist/esm-node/runtime/safe-failure.mjs +0 -47
- package/dist/esm-node/utils/crossProjectServerPolicy.mjs +0 -46
- package/dist/esm-node/utils/effect-client-generator/generator.mjs +0 -29
- package/dist/esm-node/utils/effect-client-generator/index.mjs +0 -4
- package/dist/esm-node/utils/effect-client-generator/paths.mjs +0 -25
- package/dist/esm-node/utils/effect-client-generator/rendering.mjs +0 -180
- package/dist/esm-node/utils/effect-client-generator/runtime.mjs +0 -29
- package/dist/esm-node/utils/effect-client-generator/types.mjs +0 -1
- package/dist/esm-node/utils/effectClientGenerator.mjs +0 -2
- package/dist/esm-node/utils/effectSourceLoader.mjs +0 -257
- package/dist/esm-node/utils/headers.mjs +0 -9
- package/dist/types/runtime/data-platform/batch/queue.d.ts +0 -8
- package/dist/types/runtime/data-platform/batch/request.d.ts +0 -13
- package/dist/types/runtime/data-platform/batch/response.d.ts +0 -3
- package/dist/types/runtime/data-platform/batch/telemetry.d.ts +0 -4
- package/dist/types/runtime/data-platform/batch/url.d.ts +0 -4
- package/dist/types/runtime/data-platform/batch-transport.d.ts +0 -3
- package/dist/types/runtime/data-platform/codec.d.ts +0 -17
- package/dist/types/runtime/data-platform/invalidation.d.ts +0 -8
- package/dist/types/runtime/data-platform/trace.d.ts +0 -4
- package/dist/types/runtime/data-platform/types.d.ts +0 -146
- package/dist/types/runtime/data-platform/validation.d.ts +0 -29
- package/dist/types/runtime/effect/adapter/constants.d.ts +0 -1
- package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +0 -4
- package/dist/types/runtime/effect/adapter/entry.d.ts +0 -2
- package/dist/types/runtime/effect/adapter/error-response.d.ts +0 -2
- package/dist/types/runtime/effect/adapter/handler.d.ts +0 -7
- package/dist/types/runtime/effect/adapter.d.ts +0 -22
- package/dist/types/runtime/effect/backend-federation/entry.d.ts +0 -2
- package/dist/types/runtime/effect/backend-federation/identity.d.ts +0 -30
- package/dist/types/runtime/effect/backend-federation/load.d.ts +0 -13
- package/dist/types/runtime/effect/backend-federation/plugin.d.ts +0 -3
- package/dist/types/runtime/effect/backend-federation/remotes.d.ts +0 -2
- package/dist/types/runtime/effect/backend-federation/runtime.d.ts +0 -3
- package/dist/types/runtime/effect/backend-federation/types.d.ts +0 -73
- package/dist/types/runtime/effect/backend-federation/utils.d.ts +0 -2
- package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +0 -11
- package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +0 -6
- package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +0 -3
- package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +0 -18
- package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +0 -4
- package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +0 -3
- package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +0 -51
- package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +0 -5
- package/dist/types/runtime/effect/backend-federation-manifest.d.ts +0 -1
- package/dist/types/runtime/effect/backend-federation.d.ts +0 -7
- package/dist/types/runtime/effect/context.d.ts +0 -5
- package/dist/types/runtime/effect/dispatch.d.ts +0 -13
- package/dist/types/runtime/effect/edge-context.d.ts +0 -5
- package/dist/types/runtime/effect/endpoint-contracts.d.ts +0 -66
- package/dist/types/runtime/effect/entry-shape.d.ts +0 -31
- package/dist/types/runtime/effect/handler/batch-handler.d.ts +0 -11
- package/dist/types/runtime/effect/handler/batch.d.ts +0 -13
- package/dist/types/runtime/effect/handler/definition.d.ts +0 -7
- package/dist/types/runtime/effect/handler/envelope.d.ts +0 -13
- package/dist/types/runtime/effect/handler/http.d.ts +0 -15
- package/dist/types/runtime/effect/handler/openapi.d.ts +0 -4
- package/dist/types/runtime/effect/handler/routing.d.ts +0 -5
- package/dist/types/runtime/effect/handler/rpc.d.ts +0 -7
- package/dist/types/runtime/effect/handler/types.d.ts +0 -153
- package/dist/types/runtime/effect/handler.d.ts +0 -14
- package/dist/types/runtime/effect/module.d.ts +0 -36
- package/dist/types/runtime/effect/operation-context.d.ts +0 -10
- package/dist/types/runtime/effect/rpcSerialization.d.ts +0 -3
- package/dist/types/runtime/effect-client/batch.d.ts +0 -2
- package/dist/types/runtime/effect-client/envelope.d.ts +0 -15
- package/dist/types/runtime/effect-client/guards.d.ts +0 -2
- package/dist/types/runtime/effect-client/request-context.d.ts +0 -3
- package/dist/types/runtime/effect-client/request.d.ts +0 -1
- package/dist/types/runtime/effect-client/types.d.ts +0 -68
- package/dist/types/runtime/safe-failure.d.ts +0 -1
- package/dist/types/utils/crossProjectServerPolicy.d.ts +0 -36
- package/dist/types/utils/effect-client-generator/generator.d.ts +0 -10
- package/dist/types/utils/effect-client-generator/index.d.ts +0 -4
- package/dist/types/utils/effect-client-generator/paths.d.ts +0 -5
- package/dist/types/utils/effect-client-generator/rendering.d.ts +0 -4
- package/dist/types/utils/effect-client-generator/runtime.d.ts +0 -12
- package/dist/types/utils/effect-client-generator/types.d.ts +0 -27
- package/dist/types/utils/effectClientGenerator.d.ts +0 -2
- package/dist/types/utils/effectSourceLoader.d.ts +0 -25
- package/dist/types/utils/headers.d.ts +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { DEFAULT_DATA_BATCH_ENDPOINT, isPlainObject, normalizeMethod } from "../../data-platform/index.mjs";
|
|
3
|
-
function normalizeBatchPath(pathname) {
|
|
4
|
-
if (!pathname || '/' === pathname) return DEFAULT_DATA_BATCH_ENDPOINT;
|
|
5
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
6
|
-
return pathname;
|
|
7
|
-
}
|
|
8
|
-
function normalizeBatchAllowedMethods(allowedMethods) {
|
|
9
|
-
const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
|
|
10
|
-
'GET'
|
|
11
|
-
];
|
|
12
|
-
return new Set(source.map((method)=>method.toUpperCase()));
|
|
13
|
-
}
|
|
14
|
-
function isBatchRequestPayload(value) {
|
|
15
|
-
return isPlainObject(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
|
|
16
|
-
}
|
|
17
|
-
function createBatchValidationResponse(message, status = 400) {
|
|
18
|
-
return new Response(JSON.stringify({
|
|
19
|
-
message
|
|
20
|
-
}), {
|
|
21
|
-
status,
|
|
22
|
-
headers: {
|
|
23
|
-
'content-type': 'application/json; charset=utf-8'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function cloneWithoutJsonBodyHeaders(request) {
|
|
28
|
-
const headers = new Headers(request.headers);
|
|
29
|
-
headers.delete('content-type');
|
|
30
|
-
headers.delete('content-length');
|
|
31
|
-
return new Request(request.url, {
|
|
32
|
-
method: request.method,
|
|
33
|
-
headers,
|
|
34
|
-
signal: request.signal
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
async function prepareJsonRequestBody(request) {
|
|
38
|
-
const method = normalizeMethod(request.method);
|
|
39
|
-
if ('GET' === method || 'HEAD' === method) return request;
|
|
40
|
-
const contentType = (request.headers.get('content-type') || '').toLowerCase();
|
|
41
|
-
if (!contentType.includes('application/json')) return request;
|
|
42
|
-
if (null === request.body) return cloneWithoutJsonBodyHeaders(request);
|
|
43
|
-
try {
|
|
44
|
-
const bodyText = await request.clone().text();
|
|
45
|
-
if ('' === bodyText) return cloneWithoutJsonBodyHeaders(request);
|
|
46
|
-
JSON.parse(bodyText);
|
|
47
|
-
} catch {
|
|
48
|
-
return createBatchValidationResponse('Invalid JSON request body');
|
|
49
|
-
}
|
|
50
|
-
return request;
|
|
51
|
-
}
|
|
52
|
-
function toBatchItemError(id, status, message) {
|
|
53
|
-
return {
|
|
54
|
-
id,
|
|
55
|
-
status,
|
|
56
|
-
headers: {
|
|
57
|
-
'content-type': 'application/json; charset=utf-8'
|
|
58
|
-
},
|
|
59
|
-
body: JSON.stringify({
|
|
60
|
-
message
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function promiseWithTimeout(effect, timeoutMs) {
|
|
65
|
-
if (timeoutMs <= 0) return effect;
|
|
66
|
-
return new Promise((resolve, reject)=>{
|
|
67
|
-
const timer = setTimeout(()=>{
|
|
68
|
-
reject(new Error(`Batch item timeout after ${String(timeoutMs)}ms`));
|
|
69
|
-
}, timeoutMs);
|
|
70
|
-
effect.then((value)=>{
|
|
71
|
-
clearTimeout(timer);
|
|
72
|
-
resolve(value);
|
|
73
|
-
}, (error)=>{
|
|
74
|
-
clearTimeout(timer);
|
|
75
|
-
reject(error);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async function mapWithConcurrency(items, concurrency, mapper) {
|
|
80
|
-
if (0 === items.length) return [];
|
|
81
|
-
const normalizedConcurrency = Math.max(1, concurrency);
|
|
82
|
-
const output = new Array(items.length);
|
|
83
|
-
let index = 0;
|
|
84
|
-
const workers = Array.from({
|
|
85
|
-
length: Math.min(normalizedConcurrency, items.length)
|
|
86
|
-
}, async ()=>{
|
|
87
|
-
while(true){
|
|
88
|
-
const currentIndex = index;
|
|
89
|
-
index += 1;
|
|
90
|
-
if (currentIndex >= items.length) return;
|
|
91
|
-
output[currentIndex] = await mapper(items[currentIndex], currentIndex);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
await Promise.all(workers);
|
|
95
|
-
return output;
|
|
96
|
-
}
|
|
97
|
-
export { toHeaderRecord } from "../../../utils/headers.mjs";
|
|
98
|
-
export { createBatchValidationResponse, isBatchRequestPayload, mapWithConcurrency, normalizeBatchAllowedMethods, normalizeBatchPath, prepareJsonRequestBody, promiseWithTimeout, toBatchItemError };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { EFFECT_VALIDATOR_AWARE_FACTORY } from "../entry-shape.mjs";
|
|
3
|
-
import { mergeDataPlatformOptions } from "./envelope.mjs";
|
|
4
|
-
import { createHttpApiHandler } from "./http.mjs";
|
|
5
|
-
import { createRpcApiHandler } from "./rpc.mjs";
|
|
6
|
-
function defineEffectBff(definition) {
|
|
7
|
-
const createHandler = (options)=>{
|
|
8
|
-
const rpcDefinition = definition.rpc;
|
|
9
|
-
let mergedRpcOptions = rpcDefinition;
|
|
10
|
-
if (rpcDefinition && options?.rpc) mergedRpcOptions = {
|
|
11
|
-
...rpcDefinition,
|
|
12
|
-
...options.rpc
|
|
13
|
-
};
|
|
14
|
-
return createHttpApiHandler({
|
|
15
|
-
api: definition.api,
|
|
16
|
-
layer: definition.layer,
|
|
17
|
-
openapi: options?.openapi,
|
|
18
|
-
rpc: mergedRpcOptions,
|
|
19
|
-
dataPlatform: mergeDataPlatformOptions(definition.dataPlatform, options?.dataPlatform),
|
|
20
|
-
interceptRequest: definition.interceptRequest,
|
|
21
|
-
validateRequest: options?.validateRequest
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(createHandler, EFFECT_VALIDATOR_AWARE_FACTORY, {
|
|
25
|
-
value: true
|
|
26
|
-
});
|
|
27
|
-
const client = createLoaderMaterializedClientPlaceholder();
|
|
28
|
-
return {
|
|
29
|
-
...definition,
|
|
30
|
-
createHandler,
|
|
31
|
-
client
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const LOADER_CLIENT_IGNORED_KEYS = new Set([
|
|
35
|
-
'then',
|
|
36
|
-
'catch',
|
|
37
|
-
'finally',
|
|
38
|
-
'toJSON',
|
|
39
|
-
'$$typeof'
|
|
40
|
-
]);
|
|
41
|
-
function createLoaderMaterializedClientPlaceholder() {
|
|
42
|
-
const explain = (property)=>{
|
|
43
|
-
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.`);
|
|
44
|
-
};
|
|
45
|
-
return new Proxy(Object.create(null), {
|
|
46
|
-
get (_target, property) {
|
|
47
|
-
if ('symbol' == typeof property || LOADER_CLIENT_IGNORED_KEYS.has(property)) return;
|
|
48
|
-
return explain(property);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function defineEffectRpcBff(definition) {
|
|
53
|
-
const createHandler = (options)=>createRpcApiHandler({
|
|
54
|
-
...definition,
|
|
55
|
-
...options
|
|
56
|
-
});
|
|
57
|
-
return {
|
|
58
|
-
...definition,
|
|
59
|
-
createHandler
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export { defineEffectBff, defineEffectRpcBff };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { DEFAULT_DATA_ENVELOPE_HEADER, decodeRequestEnvelopeHeader, validateRequestEnvelope, validateSelectionPlan } from "../../data-platform/index.mjs";
|
|
3
|
-
import { getExpectedEnvelopeOrigin } from "./routing.mjs";
|
|
4
|
-
function createInvalidEnvelopeResponse(message, errors) {
|
|
5
|
-
return new Response(JSON.stringify({
|
|
6
|
-
message,
|
|
7
|
-
...errors && errors.length > 0 ? {
|
|
8
|
-
errors
|
|
9
|
-
} : {}
|
|
10
|
-
}), {
|
|
11
|
-
status: 400,
|
|
12
|
-
headers: {
|
|
13
|
-
'content-type': 'application/json; charset=utf-8'
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function validateDataPlatformRequestEnvelope(request, options) {
|
|
18
|
-
const isEnabled = options?.enabled ?? true;
|
|
19
|
-
if (!isEnabled) return null;
|
|
20
|
-
const envelopeHeader = options?.envelopeHeader || DEFAULT_DATA_ENVELOPE_HEADER;
|
|
21
|
-
const encodedEnvelope = request.headers.get(envelopeHeader);
|
|
22
|
-
if (!encodedEnvelope) {
|
|
23
|
-
if (options?.requireEnvelope) return createInvalidEnvelopeResponse(`Missing required data envelope header: ${envelopeHeader}`);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const envelope = decodeRequestEnvelopeHeader(encodedEnvelope);
|
|
27
|
-
if (!envelope) return createInvalidEnvelopeResponse(`Invalid data envelope header format: ${envelopeHeader}`);
|
|
28
|
-
const validation = validateRequestEnvelope(envelope, {
|
|
29
|
-
expectedProtocolVersion: 1,
|
|
30
|
-
expectedNamespace: options?.expectedNamespace,
|
|
31
|
-
expectedOrigin: options?.validateOrigin === false ? void 0 : getExpectedEnvelopeOrigin(request),
|
|
32
|
-
requireTraceContext: options?.requireTraceContext
|
|
33
|
-
});
|
|
34
|
-
if (!validation.ok) return createInvalidEnvelopeResponse('Invalid data envelope', validation.errors);
|
|
35
|
-
if (envelope.selectionPlan) {
|
|
36
|
-
const selectionValidation = validateSelectionPlan(envelope.selectionPlan, {
|
|
37
|
-
maxDepth: options?.selection?.maxDepth,
|
|
38
|
-
maxFields: options?.selection?.maxFields,
|
|
39
|
-
allowedLeafPaths: options?.selection?.allowedLeafPaths
|
|
40
|
-
});
|
|
41
|
-
if (!selectionValidation.ok) return createInvalidEnvelopeResponse('Invalid data envelope selection plan', selectionValidation.errors);
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
function mergeDataPlatformOptions(base, override) {
|
|
46
|
-
if (!base && !override) return;
|
|
47
|
-
const baseSelection = base?.selection;
|
|
48
|
-
const overrideSelection = override?.selection;
|
|
49
|
-
const baseBatch = base?.batch;
|
|
50
|
-
const overrideBatch = override?.batch;
|
|
51
|
-
return {
|
|
52
|
-
...base,
|
|
53
|
-
...override,
|
|
54
|
-
selection: baseSelection || overrideSelection ? {
|
|
55
|
-
...baseSelection,
|
|
56
|
-
...overrideSelection
|
|
57
|
-
} : void 0,
|
|
58
|
-
batch: baseBatch || overrideBatch ? {
|
|
59
|
-
...baseBatch,
|
|
60
|
-
...overrideBatch
|
|
61
|
-
} : void 0
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export { mergeDataPlatformOptions, validateDataPlatformRequestEnvelope };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { HttpRouter, HttpServer } from "effect/unstable/http";
|
|
3
|
-
import { prepareJsonRequestBody } from "./batch.mjs";
|
|
4
|
-
import { createDataPlatformBatchRequestHandler } from "./batch-handler.mjs";
|
|
5
|
-
import { validateDataPlatformRequestEnvelope } from "./envelope.mjs";
|
|
6
|
-
import { createOpenApiLayer } from "./openapi.mjs";
|
|
7
|
-
import { getRequestPathname, isRpcRequest } from "./routing.mjs";
|
|
8
|
-
import { createRpcApiHandler, normalizeRpcPath } from "./rpc.mjs";
|
|
9
|
-
import { toEffectServiceContext } from "./types.mjs";
|
|
10
|
-
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
11
|
-
function createHttpApiHandler(options) {
|
|
12
|
-
const apiLayer = options.layer.pipe(__rspack_external_effect_Layer_69c46453.provide(HttpServer.layerServices));
|
|
13
|
-
const openApiLayer = createOpenApiLayer(options.api, options.openapi);
|
|
14
|
-
const mergedLayer = openApiLayer ? __rspack_external_effect_Layer_69c46453.mergeAll(apiLayer, openApiLayer) : apiLayer;
|
|
15
|
-
const httpApiHandler = HttpRouter.toWebHandler(mergedLayer);
|
|
16
|
-
const dispatchHttpApiRequest = async (request, context)=>{
|
|
17
|
-
const preparedRequest = await prepareJsonRequestBody(request);
|
|
18
|
-
if (preparedRequest instanceof Response) return preparedRequest;
|
|
19
|
-
const validationError = validateDataPlatformRequestEnvelope(preparedRequest, options.dataPlatform);
|
|
20
|
-
if (validationError) return validationError;
|
|
21
|
-
return httpApiHandler.handler(preparedRequest, toEffectServiceContext(context));
|
|
22
|
-
};
|
|
23
|
-
const withRequestPolicy = async (request, context)=>{
|
|
24
|
-
const policyDenial = options.validateRequest?.(request);
|
|
25
|
-
if (policyDenial) return policyDenial;
|
|
26
|
-
const next = ()=>dispatchHttpApiRequest(request, context);
|
|
27
|
-
return options.interceptRequest ? options.interceptRequest({
|
|
28
|
-
request,
|
|
29
|
-
next
|
|
30
|
-
}) : next();
|
|
31
|
-
};
|
|
32
|
-
const batchHandler = createDataPlatformBatchRequestHandler({
|
|
33
|
-
dataPlatform: options.dataPlatform,
|
|
34
|
-
handleItem: withRequestPolicy
|
|
35
|
-
});
|
|
36
|
-
const handleHttpApiRequest = async (request, context)=>{
|
|
37
|
-
const pathname = getRequestPathname(request);
|
|
38
|
-
if (batchHandler.enabled && pathname === batchHandler.path) return batchHandler.handle(request, context);
|
|
39
|
-
return withRequestPolicy(request, context);
|
|
40
|
-
};
|
|
41
|
-
if (!options.rpc) return {
|
|
42
|
-
handler: handleHttpApiRequest,
|
|
43
|
-
dispose: async ()=>{
|
|
44
|
-
await httpApiHandler.dispose();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const rpcPath = normalizeRpcPath(options.rpc.path);
|
|
48
|
-
const rpcHandler = createRpcApiHandler(options.rpc);
|
|
49
|
-
return {
|
|
50
|
-
handler: async (request, context)=>{
|
|
51
|
-
if (isRpcRequest(request, rpcPath)) {
|
|
52
|
-
const policyDenial = options.validateRequest?.(request);
|
|
53
|
-
if (policyDenial) return policyDenial;
|
|
54
|
-
const next = ()=>rpcHandler.handler(request, toEffectServiceContext(context));
|
|
55
|
-
return options.interceptRequest ? options.interceptRequest({
|
|
56
|
-
request,
|
|
57
|
-
next
|
|
58
|
-
}) : next();
|
|
59
|
-
}
|
|
60
|
-
return handleHttpApiRequest(request, context);
|
|
61
|
-
},
|
|
62
|
-
dispose: async ()=>{
|
|
63
|
-
await Promise.all([
|
|
64
|
-
httpApiHandler.dispose(),
|
|
65
|
-
rpcHandler.dispose()
|
|
66
|
-
]);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export { createHttpApiHandler };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { HttpRouter, HttpServerResponse } from "effect/unstable/http";
|
|
3
|
-
import { OpenApi } from "effect/unstable/httpapi";
|
|
4
|
-
function normalizeOpenApiPath(pathname) {
|
|
5
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
6
|
-
return pathname;
|
|
7
|
-
}
|
|
8
|
-
function getOpenApiOptions(openapi) {
|
|
9
|
-
if (!openapi || 'object' != typeof openapi) return;
|
|
10
|
-
if (!openapi.path) return;
|
|
11
|
-
return {
|
|
12
|
-
path: normalizeOpenApiPath(openapi.path)
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function createOpenApiLayer(api, openapi) {
|
|
16
|
-
const openApiOptions = getOpenApiOptions(openapi);
|
|
17
|
-
if (!openApiOptions) return null;
|
|
18
|
-
return HttpRouter.add('GET', openApiOptions.path, HttpServerResponse.jsonUnsafe(OpenApi.fromApi(api)));
|
|
19
|
-
}
|
|
20
|
-
export { createOpenApiLayer };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { isPlainObject } from "../../data-platform/index.mjs";
|
|
3
|
-
function getRequestPathname(request) {
|
|
4
|
-
try {
|
|
5
|
-
return new URL(request.url).pathname;
|
|
6
|
-
} catch {
|
|
7
|
-
return new URL(request.url, 'http://localhost').pathname;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function normalizeMountPrefix(prefix) {
|
|
11
|
-
if (!prefix || '/' === prefix) return '';
|
|
12
|
-
return prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
|
|
13
|
-
}
|
|
14
|
-
function getMountedPrefixFromContext(request, context) {
|
|
15
|
-
if (!isPlainObject(context) || 'string' != typeof context.path) return '';
|
|
16
|
-
const contextPath = normalizeMountPrefix(context.path);
|
|
17
|
-
const requestPath = normalizeMountPrefix(getRequestPathname(request));
|
|
18
|
-
if (!contextPath || !requestPath || contextPath === requestPath || !contextPath.endsWith(requestPath)) return '';
|
|
19
|
-
return normalizeMountPrefix(contextPath.slice(0, contextPath.length - requestPath.length));
|
|
20
|
-
}
|
|
21
|
-
function removeMountedPrefixFromBatchPath(pathWithQuery, prefix) {
|
|
22
|
-
const normalizedPrefix = normalizeMountPrefix(prefix);
|
|
23
|
-
if (!normalizedPrefix) return pathWithQuery;
|
|
24
|
-
const [pathname, ...queryParts] = pathWithQuery.split('?');
|
|
25
|
-
if (!pathname) return pathWithQuery;
|
|
26
|
-
let nextPathname = pathname;
|
|
27
|
-
if (pathname === normalizedPrefix) nextPathname = '/';
|
|
28
|
-
else if (pathname.startsWith(`${normalizedPrefix}/`)) {
|
|
29
|
-
const sliced = pathname.slice(normalizedPrefix.length);
|
|
30
|
-
nextPathname = sliced.startsWith('/') ? sliced : `/${sliced}`;
|
|
31
|
-
}
|
|
32
|
-
if (0 === queryParts.length) return nextPathname;
|
|
33
|
-
return `${nextPathname}?${queryParts.join('?')}`;
|
|
34
|
-
}
|
|
35
|
-
function getRequestOrigin(request) {
|
|
36
|
-
try {
|
|
37
|
-
return new URL(request.url).origin;
|
|
38
|
-
} catch {
|
|
39
|
-
return new URL(request.url, 'http://localhost').origin;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function getExpectedEnvelopeOrigin(request) {
|
|
43
|
-
const origin = request.headers.get('origin');
|
|
44
|
-
if (origin && 'null' !== origin) return origin;
|
|
45
|
-
return getRequestOrigin(request);
|
|
46
|
-
}
|
|
47
|
-
function isRpcRequest(request, rpcPath) {
|
|
48
|
-
const pathname = getRequestPathname(request);
|
|
49
|
-
return pathname === rpcPath || pathname.startsWith(`${rpcPath}/`);
|
|
50
|
-
}
|
|
51
|
-
export { getExpectedEnvelopeOrigin, getMountedPrefixFromContext, getRequestPathname, isRpcRequest, removeMountedPrefixFromBatchPath };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { HttpRouter } from "effect/unstable/http";
|
|
3
|
-
import { RpcServer } from "effect/unstable/rpc";
|
|
4
|
-
import { getRpcSerializationLayer } from "../rpcSerialization.mjs";
|
|
5
|
-
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
6
|
-
function normalizeRpcPath(pathname) {
|
|
7
|
-
if (!pathname || '/' === pathname) return '/rpc';
|
|
8
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
9
|
-
return pathname;
|
|
10
|
-
}
|
|
11
|
-
function createRpcApiHandler(options) {
|
|
12
|
-
const rpcPath = normalizeRpcPath(options.path);
|
|
13
|
-
const rpcLayer = __rspack_external_effect_Layer_69c46453.provide(RpcServer.layerHttp({
|
|
14
|
-
group: options.group,
|
|
15
|
-
path: rpcPath,
|
|
16
|
-
protocol: 'http',
|
|
17
|
-
disableTracing: options.disableTracing,
|
|
18
|
-
spanPrefix: options.spanPrefix,
|
|
19
|
-
spanAttributes: options.spanAttributes
|
|
20
|
-
}), __rspack_external_effect_Layer_69c46453.mergeAll(options.layer, getRpcSerializationLayer(options.serialization)));
|
|
21
|
-
return HttpRouter.toWebHandler(rpcLayer);
|
|
22
|
-
}
|
|
23
|
-
export { createRpcApiHandler, normalizeRpcPath };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import * as __rspack_external_effect_Context_b3520bd3 from "effect/Context";
|
|
3
|
-
const emptyEffectServiceContext = __rspack_external_effect_Context_b3520bd3.empty();
|
|
4
|
-
const isEffectServiceContext = (context)=>'object' == typeof context && null !== context && 'mapUnsafe' in context;
|
|
5
|
-
const toEffectServiceContext = (context)=>isEffectServiceContext(context) ? context : emptyEffectServiceContext;
|
|
6
|
-
export { toEffectServiceContext };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import * as __rspack_external_effect_Config_76cfa59d from "effect/Config";
|
|
3
|
-
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
4
|
-
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
5
|
-
import * as __rspack_external_effect_Option_0498e63a from "effect/Option";
|
|
6
|
-
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
7
|
-
export * from "effect/unstable/http";
|
|
8
|
-
export * from "effect/unstable/httpapi";
|
|
9
|
-
export * from "effect/unstable/rpc";
|
|
10
|
-
export { HttpTraceContext } from "effect/unstable/http";
|
|
11
|
-
export { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
12
|
-
export { EFFECT_VALIDATOR_AWARE_FACTORY, isValidatorAwareHandlerFactory } from "./entry-shape.mjs";
|
|
13
|
-
export { defineEffectBff, defineEffectRpcBff } from "./handler/definition.mjs";
|
|
14
|
-
export { createHttpApiHandler } from "./handler/http.mjs";
|
|
15
|
-
export { __rspack_external_effect_Config_76cfa59d as Config, __rspack_external_effect_Effect_41060786 as Effect, __rspack_external_effect_Layer_69c46453 as Layer, __rspack_external_effect_Option_0498e63a as Option, __rspack_external_effect_Schema_6065f72d as Schema };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { HttpApi } from "effect/unstable/httpapi";
|
|
3
|
-
import { classifyEffectBffEntryModule, isValidatorAwareHandlerFactory, strictEffectApproachMessage } from "./entry-shape.mjs";
|
|
4
|
-
import { createHttpApiHandler } from "./handler.mjs";
|
|
5
|
-
import * as __rspack_external_effect_Context_b3520bd3 from "effect/Context";
|
|
6
|
-
function isRequestHandler(value) {
|
|
7
|
-
return 'function' == typeof value;
|
|
8
|
-
}
|
|
9
|
-
function isEffectServiceContext(context) {
|
|
10
|
-
return 'object' == typeof context && null !== context && 'mapUnsafe' in context;
|
|
11
|
-
}
|
|
12
|
-
const emptyEffectServiceContext = __rspack_external_effect_Context_b3520bd3.empty();
|
|
13
|
-
function rejectLegacyEffectModuleShape(options, shape) {
|
|
14
|
-
options.onWarning?.(`${strictEffectApproachMessage} Rejected ${shape}.`);
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
function callEffectBffRequestHandler(handler, request, context) {
|
|
18
|
-
return void 0 === context ? handler(request) : handler(request, context);
|
|
19
|
-
}
|
|
20
|
-
function createLoadedHandler(webHandler) {
|
|
21
|
-
return {
|
|
22
|
-
handler: (request, context)=>callEffectBffRequestHandler(webHandler.handler, request, context),
|
|
23
|
-
dispose: webHandler.dispose
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function createLoadedHttpApiHandler(webHandler) {
|
|
27
|
-
return {
|
|
28
|
-
handler: (request, context)=>{
|
|
29
|
-
const effectContext = isEffectServiceContext(context) ? context : emptyEffectServiceContext;
|
|
30
|
-
return webHandler.handler(request, effectContext);
|
|
31
|
-
},
|
|
32
|
-
dispose: webHandler.dispose
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function classifyEffectBffRuntimeEntryShape(module) {
|
|
36
|
-
return classifyEffectBffEntryModule(module, {
|
|
37
|
-
isRequestHandler: isRequestHandler,
|
|
38
|
-
isValidatorAwareHandlerFactory: isValidatorAwareHandlerFactory,
|
|
39
|
-
isHttpApi: HttpApi.isHttpApi
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
43
|
-
if (!facts) return null;
|
|
44
|
-
if (facts.legacyShape) {
|
|
45
|
-
if (rejectLegacyEffectModuleShape(options, facts.legacyShape)) return null;
|
|
46
|
-
}
|
|
47
|
-
if ('function' == typeof facts.createHandler) {
|
|
48
|
-
if (!facts.createHandlerValidatorAware && rejectLegacyEffectModuleShape(options, 'unbranded `createHandler` export')) return null;
|
|
49
|
-
const factory = facts.createHandler;
|
|
50
|
-
const webHandler = factory({
|
|
51
|
-
openapi: options.openapi,
|
|
52
|
-
dataPlatform: options.dataPlatform,
|
|
53
|
-
validateRequest: options.validateRequest
|
|
54
|
-
});
|
|
55
|
-
return createLoadedHandler(webHandler);
|
|
56
|
-
}
|
|
57
|
-
if (void 0 !== facts.api && facts.hasRuntimeLayer) {
|
|
58
|
-
options.onWarning?.('[BFF][Effect] Detected { api, layer } export without createHandler. Prefer `defineEffectBff(...)` from @modern-js/plugin-bff/server to avoid module instance mismatch.');
|
|
59
|
-
const webHandler = createHttpApiHandler({
|
|
60
|
-
api: facts.api,
|
|
61
|
-
layer: facts.layer,
|
|
62
|
-
openapi: options.openapi,
|
|
63
|
-
dataPlatform: options.dataPlatform,
|
|
64
|
-
validateRequest: options.validateRequest
|
|
65
|
-
});
|
|
66
|
-
return createLoadedHttpApiHandler(webHandler);
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
function resolveNormalizedEffectBffModuleHandler(normalizedModule, options = {}) {
|
|
71
|
-
return resolveClassifiedEffectBffModuleHandler(classifyEffectBffRuntimeEntryShape(normalizedModule), options);
|
|
72
|
-
}
|
|
73
|
-
function resolveEffectBffModuleHandler(mod, options = {}) {
|
|
74
|
-
return Promise.resolve(resolveNormalizedEffectBffModuleHandler(mod, options));
|
|
75
|
-
}
|
|
76
|
-
export { resolveEffectBffModuleHandler };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { BFF_LOCALE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, BFF_TRACEPARENT_HEADER, parseTraceparent } from "@modern-js/create-request";
|
|
3
|
-
const readHeader = (headers, header)=>{
|
|
4
|
-
const value = headers.get(header);
|
|
5
|
-
return value && value.length > 0 ? value : void 0;
|
|
6
|
-
};
|
|
7
|
-
const copyStringField = (target, details, key)=>{
|
|
8
|
-
const value = details[key];
|
|
9
|
-
if ('string' == typeof value && value.length > 0) target[key] = value;
|
|
10
|
-
};
|
|
11
|
-
const readOperationContextDetails = (request)=>{
|
|
12
|
-
const rawDetails = readHeader(request.headers, BFF_OPERATION_CONTEXT_DETAIL_HEADER);
|
|
13
|
-
if (!rawDetails) return {};
|
|
14
|
-
try {
|
|
15
|
-
const parsed = JSON.parse(rawDetails);
|
|
16
|
-
if (!parsed || 'object' != typeof parsed || Array.isArray(parsed)) return {};
|
|
17
|
-
const details = parsed;
|
|
18
|
-
const safeDetails = {};
|
|
19
|
-
copyStringField(safeDetails, details, 'requestId');
|
|
20
|
-
copyStringField(safeDetails, details, 'operationId');
|
|
21
|
-
copyStringField(safeDetails, details, 'schemaHash');
|
|
22
|
-
copyStringField(safeDetails, details, 'traceparent');
|
|
23
|
-
copyStringField(safeDetails, details, 'traceId');
|
|
24
|
-
copyStringField(safeDetails, details, 'spanId');
|
|
25
|
-
if ('number' == typeof details.operationVersion) safeDetails.operationVersion = details.operationVersion;
|
|
26
|
-
return safeDetails;
|
|
27
|
-
} catch {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const createEffectOperationContext = ({ request, path, method })=>{
|
|
32
|
-
const details = readOperationContextDetails(request);
|
|
33
|
-
const servicePath = new URL(request.url).pathname;
|
|
34
|
-
const traceparent = readHeader(request.headers, BFF_TRACEPARENT_HEADER) || details.traceparent;
|
|
35
|
-
const parsedTraceparent = details.traceId && details.spanId ? {
|
|
36
|
-
traceId: details.traceId,
|
|
37
|
-
spanId: details.spanId
|
|
38
|
-
} : parseTraceparent(traceparent);
|
|
39
|
-
const locale = readHeader(request.headers, BFF_LOCALE_HEADER);
|
|
40
|
-
const headerOperationId = readHeader(request.headers, BFF_OPERATION_CONTEXT_HEADER);
|
|
41
|
-
return {
|
|
42
|
-
...details,
|
|
43
|
-
...headerOperationId || details.operationId ? {
|
|
44
|
-
operationId: headerOperationId || details.operationId
|
|
45
|
-
} : {},
|
|
46
|
-
routePath: servicePath,
|
|
47
|
-
method: (method || request.method || 'GET').toUpperCase(),
|
|
48
|
-
source: 'effect-adapter',
|
|
49
|
-
...path && path !== servicePath ? {
|
|
50
|
-
attributes: {
|
|
51
|
-
mountedPath: path
|
|
52
|
-
}
|
|
53
|
-
} : {},
|
|
54
|
-
...locale ? {
|
|
55
|
-
locale
|
|
56
|
-
} : {},
|
|
57
|
-
...traceparent ? {
|
|
58
|
-
traceparent
|
|
59
|
-
} : {},
|
|
60
|
-
...parsedTraceparent ? {
|
|
61
|
-
traceId: parsedTraceparent.traceId,
|
|
62
|
-
spanId: parsedTraceparent.spanId
|
|
63
|
-
} : {}
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
export { createEffectOperationContext };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { RpcSerialization } from "effect/unstable/rpc";
|
|
3
|
-
function getRpcSerializationLayer(serialization) {
|
|
4
|
-
switch(serialization){
|
|
5
|
-
case 'ndjson':
|
|
6
|
-
return RpcSerialization.layerNdjson;
|
|
7
|
-
case 'jsonRpc':
|
|
8
|
-
return RpcSerialization.layerJsonRpc();
|
|
9
|
-
case 'ndJsonRpc':
|
|
10
|
-
return RpcSerialization.layerNdJsonRpc();
|
|
11
|
-
case 'msgPack':
|
|
12
|
-
return RpcSerialization.layerMsgPack;
|
|
13
|
-
default:
|
|
14
|
-
return RpcSerialization.layerJsonRpc();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { getRpcSerializationLayer };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { createDataBatchTransport } from "../data-platform/index.mjs";
|
|
3
|
-
import { resolveOrigin } from "./envelope.mjs";
|
|
4
|
-
const resolveRuntimeFetch = ()=>'function' == typeof fetch ? fetch.bind(globalThis) : void 0;
|
|
5
|
-
const configureGeneratedEffectClientRuntime = (config, configureRequest)=>{
|
|
6
|
-
const defaultOrigin = config.defaultOrigin;
|
|
7
|
-
if (config.requestId && configureRequest) {
|
|
8
|
-
const configurePayload = {
|
|
9
|
-
requestId: config.requestId,
|
|
10
|
-
requireEnvelope: true,
|
|
11
|
-
identityBinding: {
|
|
12
|
-
enabled: true,
|
|
13
|
-
strict: true
|
|
14
|
-
},
|
|
15
|
-
operationContract: {
|
|
16
|
-
enabled: true,
|
|
17
|
-
strict: true,
|
|
18
|
-
requireSchemaHash: true,
|
|
19
|
-
requireOperationVersion: true
|
|
20
|
-
},
|
|
21
|
-
setDomain: ()=>resolveOrigin(defaultOrigin)
|
|
22
|
-
};
|
|
23
|
-
const runtimeFetch = resolveRuntimeFetch();
|
|
24
|
-
if (false !== config.batch.enabled && runtimeFetch) configurePayload.request = createDataBatchTransport({
|
|
25
|
-
fetch: runtimeFetch,
|
|
26
|
-
endpoint: config.batch.endpoint,
|
|
27
|
-
flushIntervalMs: config.batch.flushIntervalMs,
|
|
28
|
-
maxBatchSize: config.batch.maxBatchSize,
|
|
29
|
-
maxBatchBytes: config.batch.maxBatchBytes,
|
|
30
|
-
requestTimeoutMs: config.batch.requestTimeoutMs,
|
|
31
|
-
allowedMethods: config.batch.allowedMethods
|
|
32
|
-
});
|
|
33
|
-
configureRequest(configurePayload);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export { configureGeneratedEffectClientRuntime };
|