@bleedingdev/modern-js-plugin-bff 3.8.2-ultramodern.9 → 3.8.3-ultramodern.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +11 -8
- package/dist/cjs/utils/client-generator/index.js +0 -3
- package/dist/cjs/utils/client-generator/type-facade.js +16 -10
- 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 +11 -8
- package/dist/esm/utils/client-generator/index.mjs +1 -1
- package/dist/esm/utils/client-generator/type-facade.mjs +9 -6
- 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 +11 -8
- package/dist/esm-node/utils/client-generator/index.mjs +1 -1
- package/dist/esm-node/utils/client-generator/type-facade.mjs +9 -6
- 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/client-generator/index.d.ts +1 -1
- package/dist/types/utils/client-generator/type-facade.d.ts +2 -12
- package/dist/types/utils/crossProjectApiPlugin.d.ts +1 -0
- package/dist/types/utils/pluginGenerator.d.ts +2 -1
- package/package.json +34 -33
- 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,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createEffectOperationContext: ()=>external_operation_context_js_namespaceObject.createEffectOperationContext,
|
|
32
|
-
runWithEffectContext: ()=>runWithEffectContext,
|
|
33
|
-
useEffectContext: ()=>useEffectContext,
|
|
34
|
-
useOperationContext: ()=>useOperationContext
|
|
35
|
-
});
|
|
36
|
-
const external_operation_context_js_namespaceObject = require("./operation-context.js");
|
|
37
|
-
const kEffectContext = Symbol.for('modernjs.plugin-bff.edgeEffectContext');
|
|
38
|
-
const kEffectContextStorage = Symbol.for('modernjs.plugin-bff.edgeEffectContextStorage');
|
|
39
|
-
const globalStore = globalThis;
|
|
40
|
-
const isPromiseLike = (value)=>'object' == typeof value && null !== value && 'then' in value && 'function' == typeof value.then;
|
|
41
|
-
const getRuntimeStorage = ()=>{
|
|
42
|
-
if (globalStore[kEffectContextStorage]) return globalStore[kEffectContextStorage];
|
|
43
|
-
if ('function' == typeof globalStore.AsyncLocalStorage) globalStore[kEffectContextStorage] = new globalStore.AsyncLocalStorage();
|
|
44
|
-
return globalStore[kEffectContextStorage];
|
|
45
|
-
};
|
|
46
|
-
const runWithEffectContext = (context, cb)=>{
|
|
47
|
-
const storage = getRuntimeStorage();
|
|
48
|
-
if (storage) return storage.run(context, cb);
|
|
49
|
-
const previous = globalStore[kEffectContext];
|
|
50
|
-
globalStore[kEffectContext] = context;
|
|
51
|
-
try {
|
|
52
|
-
const result = cb();
|
|
53
|
-
if (isPromiseLike(result)) return Promise.resolve(result).finally(()=>{
|
|
54
|
-
globalStore[kEffectContext] = previous;
|
|
55
|
-
});
|
|
56
|
-
globalStore[kEffectContext] = previous;
|
|
57
|
-
return result;
|
|
58
|
-
} catch (error) {
|
|
59
|
-
globalStore[kEffectContext] = previous;
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const useEffectContext = ()=>{
|
|
64
|
-
const context = getRuntimeStorage()?.getStore() ?? globalStore[kEffectContext];
|
|
65
|
-
if (!context) throw new Error("Can't call useEffectContext out of Effect runtime scope");
|
|
66
|
-
return context;
|
|
67
|
-
};
|
|
68
|
-
const useOperationContext = ()=>useEffectContext().operationContext;
|
|
69
|
-
exports.createEffectOperationContext = __webpack_exports__.createEffectOperationContext;
|
|
70
|
-
exports.runWithEffectContext = __webpack_exports__.runWithEffectContext;
|
|
71
|
-
exports.useEffectContext = __webpack_exports__.useEffectContext;
|
|
72
|
-
exports.useOperationContext = __webpack_exports__.useOperationContext;
|
|
73
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
74
|
-
"createEffectOperationContext",
|
|
75
|
-
"runWithEffectContext",
|
|
76
|
-
"useEffectContext",
|
|
77
|
-
"useOperationContext"
|
|
78
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
79
|
-
Object.defineProperty(exports, '__esModule', {
|
|
80
|
-
value: true
|
|
81
|
-
});
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
collectEffectEndpoints: ()=>collectEffectEndpoints,
|
|
32
|
-
createEffectEndpointContractHash: ()=>createEffectEndpointContractHash,
|
|
33
|
-
ensureLeadingSlash: ()=>ensureLeadingSlash,
|
|
34
|
-
extractHttpApiFromModule: ()=>extractHttpApiFromModule,
|
|
35
|
-
normalizeEffectPrefix: ()=>normalizeEffectPrefix,
|
|
36
|
-
toOperationContractSources: ()=>toOperationContractSources
|
|
37
|
-
});
|
|
38
|
-
const bff_core_namespaceObject = require("@modern-js/bff-core");
|
|
39
|
-
const external_entry_shape_js_namespaceObject = require("./entry-shape.js");
|
|
40
|
-
function resolveEffectEndpointName(endpoint) {
|
|
41
|
-
if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
|
|
42
|
-
if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
45
|
-
function ensureLeadingSlash(pathname) {
|
|
46
|
-
return pathname.startsWith('/') ? pathname : `/${pathname}`;
|
|
47
|
-
}
|
|
48
|
-
function normalizeEffectPrefix(prefix) {
|
|
49
|
-
if ('/' === prefix) return '';
|
|
50
|
-
return ensureLeadingSlash(prefix || '/api');
|
|
51
|
-
}
|
|
52
|
-
function getEffectRoutePath(prefix, endpointPath) {
|
|
53
|
-
const normalizedPrefix = normalizeEffectPrefix(prefix);
|
|
54
|
-
const normalizedEndpointPath = ensureLeadingSlash(endpointPath);
|
|
55
|
-
const finalEndpointPath = '/' === normalizedEndpointPath ? '' : endpointPath;
|
|
56
|
-
if (!normalizedPrefix && !finalEndpointPath) return '/';
|
|
57
|
-
return `${normalizedPrefix}${finalEndpointPath || ''}`;
|
|
58
|
-
}
|
|
59
|
-
function resolveEffectApiId(api) {
|
|
60
|
-
const fallback = 'EffectHttpApi';
|
|
61
|
-
if ('identifier' in api && 'string' == typeof api.identifier && api.identifier) return api.identifier;
|
|
62
|
-
return fallback;
|
|
63
|
-
}
|
|
64
|
-
function collectEffectEndpoints(reflect, api, prefix) {
|
|
65
|
-
const endpoints = [];
|
|
66
|
-
const apiId = resolveEffectApiId(api);
|
|
67
|
-
reflect(api, {
|
|
68
|
-
onGroup: ()=>{},
|
|
69
|
-
onEndpoint: ({ group, endpoint })=>{
|
|
70
|
-
endpoints.push({
|
|
71
|
-
apiId,
|
|
72
|
-
groupName: String(group.identifier),
|
|
73
|
-
endpointName: resolveEffectEndpointName(endpoint),
|
|
74
|
-
method: String(endpoint.method).toUpperCase(),
|
|
75
|
-
routePath: getEffectRoutePath(prefix, String(endpoint.path))
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return endpoints.sort((a, b)=>{
|
|
80
|
-
if (a.groupName === b.groupName) return a.endpointName.localeCompare(b.endpointName);
|
|
81
|
-
return a.groupName.localeCompare(b.groupName);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function toOperationContractSources(endpoints) {
|
|
85
|
-
return endpoints.map(createEffectOperationContractSource);
|
|
86
|
-
}
|
|
87
|
-
function createEffectOperationContractSource(endpoint) {
|
|
88
|
-
return {
|
|
89
|
-
name: endpoint.endpointName,
|
|
90
|
-
httpMethod: endpoint.method,
|
|
91
|
-
routePath: endpoint.routePath
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
async function extractHttpApiFromModule(mod, isHttpApi) {
|
|
95
|
-
const facts = (0, external_entry_shape_js_namespaceObject.classifyEffectBffEntryModule)(mod, {
|
|
96
|
-
isRequestHandler: (value)=>'function' == typeof value,
|
|
97
|
-
isValidatorAwareHandlerFactory: external_entry_shape_js_namespaceObject.isValidatorAwareHandlerFactory,
|
|
98
|
-
isHttpApi
|
|
99
|
-
});
|
|
100
|
-
return !facts?.legacyShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
|
|
101
|
-
}
|
|
102
|
-
function createEffectEndpointContractHash(endpoint, requestId) {
|
|
103
|
-
return (0, bff_core_namespaceObject.createOperationContractHash)(createEffectOperationContractSource(endpoint), requestId);
|
|
104
|
-
}
|
|
105
|
-
exports.collectEffectEndpoints = __webpack_exports__.collectEffectEndpoints;
|
|
106
|
-
exports.createEffectEndpointContractHash = __webpack_exports__.createEffectEndpointContractHash;
|
|
107
|
-
exports.ensureLeadingSlash = __webpack_exports__.ensureLeadingSlash;
|
|
108
|
-
exports.extractHttpApiFromModule = __webpack_exports__.extractHttpApiFromModule;
|
|
109
|
-
exports.normalizeEffectPrefix = __webpack_exports__.normalizeEffectPrefix;
|
|
110
|
-
exports.toOperationContractSources = __webpack_exports__.toOperationContractSources;
|
|
111
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
112
|
-
"collectEffectEndpoints",
|
|
113
|
-
"createEffectEndpointContractHash",
|
|
114
|
-
"ensureLeadingSlash",
|
|
115
|
-
"extractHttpApiFromModule",
|
|
116
|
-
"normalizeEffectPrefix",
|
|
117
|
-
"toOperationContractSources"
|
|
118
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
119
|
-
Object.defineProperty(exports, '__esModule', {
|
|
120
|
-
value: true
|
|
121
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const EFFECT_VALIDATOR_AWARE_FACTORY = Symbol.for('modernjs.effect.validatorAware');
|
|
31
|
-
function isValidatorAwareHandlerFactory(factory) {
|
|
32
|
-
return Boolean('function' == typeof factory && factory[EFFECT_VALIDATOR_AWARE_FACTORY]);
|
|
33
|
-
}
|
|
34
|
-
const strictEffectApproachMessage = '[BFF][Effect] strictEffectApproach is enforced: Effect API entries export defineEffectBff(...) or { api, layer } HttpApi module. Raw handler exports, default request handlers, unbranded custom createHandler factories not valid Effect API entries.';
|
|
35
|
-
function isEffectEntryRecord(value) {
|
|
36
|
-
return 'object' == typeof value && null !== value;
|
|
37
|
-
}
|
|
38
|
-
function classifyEffectBffEntryModule(value, predicates) {
|
|
39
|
-
if (!isEffectEntryRecord(value)) return null;
|
|
40
|
-
const rootModule = value;
|
|
41
|
-
if (predicates.isRequestHandler(rootModule.handler)) return createEntryShapeFacts(rootModule, predicates, '`handler` export');
|
|
42
|
-
const defaultEntry = rootModule.default;
|
|
43
|
-
if (predicates.isRequestHandler(defaultEntry)) return createEntryShapeFacts(rootModule, predicates, 'default request handler');
|
|
44
|
-
const module = isEffectEntryRecord(defaultEntry) ? {
|
|
45
|
-
...rootModule,
|
|
46
|
-
...defaultEntry
|
|
47
|
-
} : rootModule;
|
|
48
|
-
if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
|
|
49
|
-
return createEntryShapeFacts(module, predicates);
|
|
50
|
-
}
|
|
51
|
-
function createEntryShapeFacts(module, predicates, legacyShape) {
|
|
52
|
-
const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
|
|
53
|
-
const api = predicates.isHttpApi(module.api) ? module.api : void 0;
|
|
54
|
-
const hasRuntimeLayer = void 0 !== module.layer;
|
|
55
|
-
return {
|
|
56
|
-
module,
|
|
57
|
-
legacyShape,
|
|
58
|
-
createHandler,
|
|
59
|
-
createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
|
|
60
|
-
api,
|
|
61
|
-
layer: module.layer,
|
|
62
|
-
hasRuntimeLayer
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
66
|
-
classifyEffectBffEntryModule: ()=>classifyEffectBffEntryModule,
|
|
67
|
-
isValidatorAwareHandlerFactory: ()=>isValidatorAwareHandlerFactory
|
|
68
|
-
}, {
|
|
69
|
-
EFFECT_VALIDATOR_AWARE_FACTORY: EFFECT_VALIDATOR_AWARE_FACTORY,
|
|
70
|
-
strictEffectApproachMessage: strictEffectApproachMessage
|
|
71
|
-
});
|
|
72
|
-
exports.EFFECT_VALIDATOR_AWARE_FACTORY = __webpack_exports__.EFFECT_VALIDATOR_AWARE_FACTORY;
|
|
73
|
-
exports.classifyEffectBffEntryModule = __webpack_exports__.classifyEffectBffEntryModule;
|
|
74
|
-
exports.isValidatorAwareHandlerFactory = __webpack_exports__.isValidatorAwareHandlerFactory;
|
|
75
|
-
exports.strictEffectApproachMessage = __webpack_exports__.strictEffectApproachMessage;
|
|
76
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
77
|
-
"EFFECT_VALIDATOR_AWARE_FACTORY",
|
|
78
|
-
"classifyEffectBffEntryModule",
|
|
79
|
-
"isValidatorAwareHandlerFactory",
|
|
80
|
-
"strictEffectApproachMessage"
|
|
81
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
82
|
-
Object.defineProperty(exports, '__esModule', {
|
|
83
|
-
value: true
|
|
84
|
-
});
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createDataPlatformBatchRequestHandler: ()=>createDataPlatformBatchRequestHandler
|
|
32
|
-
});
|
|
33
|
-
const index_js_namespaceObject = require("../../data-platform/index.js");
|
|
34
|
-
const external_batch_js_namespaceObject = require("./batch.js");
|
|
35
|
-
const external_routing_js_namespaceObject = require("./routing.js");
|
|
36
|
-
function createDataPlatformBatchRequestHandler(options) {
|
|
37
|
-
const dataPlatformBatchOptions = options.dataPlatform?.batch;
|
|
38
|
-
const batchEnabled = dataPlatformBatchOptions?.enabled !== false;
|
|
39
|
-
const batchPath = (0, external_batch_js_namespaceObject.normalizeBatchPath)(dataPlatformBatchOptions?.endpoint);
|
|
40
|
-
const batchMaxSize = Math.max(1, dataPlatformBatchOptions?.maxBatchSize ?? 16);
|
|
41
|
-
const batchMaxBytes = Math.max(1024, dataPlatformBatchOptions?.maxBatchBytes ?? 65536);
|
|
42
|
-
const batchConcurrency = Math.max(1, dataPlatformBatchOptions?.maxConcurrency ?? 4);
|
|
43
|
-
const batchItemTimeoutMs = Math.max(0, dataPlatformBatchOptions?.requestTimeoutMs ?? 10000);
|
|
44
|
-
const batchAllowedMethods = (0, external_batch_js_namespaceObject.normalizeBatchAllowedMethods)(dataPlatformBatchOptions?.allowedMethods);
|
|
45
|
-
const envelopeHeader = options.dataPlatform?.envelopeHeader || index_js_namespaceObject.DEFAULT_DATA_ENVELOPE_HEADER;
|
|
46
|
-
const normalizedEnvelopeHeader = envelopeHeader.toLowerCase();
|
|
47
|
-
const handle = async (request, context)=>{
|
|
48
|
-
const mountedPrefix = (0, external_routing_js_namespaceObject.getMountedPrefixFromContext)(request, context);
|
|
49
|
-
const method = (0, index_js_namespaceObject.normalizeMethod)(request.method);
|
|
50
|
-
if ('POST' !== method) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch endpoint only supports POST requests', 405);
|
|
51
|
-
const contentType = request.headers.get('content-type') || '';
|
|
52
|
-
if (!contentType.includes('application/json')) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch endpoint requires application/json content-type', 415);
|
|
53
|
-
const payloadText = await request.text();
|
|
54
|
-
if ((0, index_js_namespaceObject.measureTextBytes)(payloadText) > batchMaxBytes) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)(`Batch payload exceeds max size (${String(batchMaxBytes)} bytes)`, 413);
|
|
55
|
-
let payload;
|
|
56
|
-
try {
|
|
57
|
-
payload = JSON.parse(payloadText);
|
|
58
|
-
} catch {
|
|
59
|
-
return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Invalid batch payload JSON');
|
|
60
|
-
}
|
|
61
|
-
if (!(0, external_batch_js_namespaceObject.isBatchRequestPayload)(payload)) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Invalid batch payload shape');
|
|
62
|
-
if (0 === payload.items.length) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)('Batch payload items cannot be empty');
|
|
63
|
-
if (payload.items.length > batchMaxSize) return (0, external_batch_js_namespaceObject.createBatchValidationResponse)(`Batch item count exceeds max size (${String(batchMaxSize)})`, 413);
|
|
64
|
-
const responseItems = await (0, external_batch_js_namespaceObject.mapWithConcurrency)(payload.items, batchConcurrency, async (rawItem, index)=>{
|
|
65
|
-
const fallbackId = `item_${String(index)}`;
|
|
66
|
-
const itemId = (0, index_js_namespaceObject.isPlainObject)(rawItem) && 'string' == typeof rawItem.id ? rawItem.id : fallbackId;
|
|
67
|
-
if (!(0, index_js_namespaceObject.isPlainObject)(rawItem)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Invalid batch item; expected object');
|
|
68
|
-
if ('string' != typeof rawItem.path || 0 === rawItem.path.length) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Invalid batch item path');
|
|
69
|
-
if (!rawItem.path.startsWith('/')) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item path must start with "/"');
|
|
70
|
-
const normalizedItemPath = (0, external_routing_js_namespaceObject.removeMountedPrefixFromBatchPath)(rawItem.path, mountedPrefix);
|
|
71
|
-
const itemPathname = normalizedItemPath.split('?')[0] || normalizedItemPath;
|
|
72
|
-
if (itemPathname === batchPath || itemPathname.startsWith(`${batchPath}/`)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item path cannot target batch endpoint');
|
|
73
|
-
const itemMethod = (0, index_js_namespaceObject.normalizeMethod)('string' == typeof rawItem.method ? rawItem.method : void 0);
|
|
74
|
-
if (!batchAllowedMethods.has(itemMethod)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 405, `Batch item method ${itemMethod} is not allowed`);
|
|
75
|
-
if (void 0 !== rawItem.body && null !== rawItem.body && 'string' != typeof rawItem.body) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item body must be a string when provided');
|
|
76
|
-
if (('GET' === itemMethod || 'HEAD' === itemMethod) && 'string' == typeof rawItem.body) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, `${itemMethod} batch item cannot include body`);
|
|
77
|
-
const normalizedHeaders = {};
|
|
78
|
-
if (void 0 !== rawItem.headers) {
|
|
79
|
-
if (!(0, index_js_namespaceObject.isPlainObject)(rawItem.headers)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, 'Batch item headers must be an object');
|
|
80
|
-
for (const [key, value] of Object.entries(rawItem.headers)){
|
|
81
|
-
if ('string' != typeof value) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 400, `Invalid header "${key}" for batch item`);
|
|
82
|
-
normalizedHeaders[key.toLowerCase()] = value;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (!normalizedHeaders.traceparent) {
|
|
86
|
-
const encodedEnvelope = normalizedHeaders[normalizedEnvelopeHeader];
|
|
87
|
-
if ('string' == typeof encodedEnvelope) {
|
|
88
|
-
const envelope = (0, index_js_namespaceObject.decodeRequestEnvelopeHeader)(encodedEnvelope);
|
|
89
|
-
if (envelope?.traceparent) normalizedHeaders.traceparent = envelope.traceparent;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (!normalizedHeaders.traceparent) {
|
|
93
|
-
const requestTraceparent = request.headers.get('traceparent');
|
|
94
|
-
if (requestTraceparent) normalizedHeaders.traceparent = requestTraceparent;
|
|
95
|
-
}
|
|
96
|
-
const targetUrl = new URL(normalizedItemPath, request.url);
|
|
97
|
-
const requestHeaders = new Headers(normalizedHeaders);
|
|
98
|
-
const body = 'GET' === itemMethod || 'HEAD' === itemMethod ? void 0 : rawItem.body;
|
|
99
|
-
if (void 0 === body) requestHeaders.delete('content-type');
|
|
100
|
-
const itemRequest = new Request(targetUrl.toString(), {
|
|
101
|
-
method: itemMethod,
|
|
102
|
-
headers: requestHeaders,
|
|
103
|
-
body
|
|
104
|
-
});
|
|
105
|
-
try {
|
|
106
|
-
const itemResponse = await (0, external_batch_js_namespaceObject.promiseWithTimeout)(options.handleItem(itemRequest, context), batchItemTimeoutMs);
|
|
107
|
-
if (!(itemResponse instanceof Response)) return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 500, 'Invalid response returned by batch item handler');
|
|
108
|
-
const bodyText = await itemResponse.text();
|
|
109
|
-
const responseItem = {
|
|
110
|
-
id: itemId,
|
|
111
|
-
status: itemResponse.status,
|
|
112
|
-
headers: (0, external_batch_js_namespaceObject.toHeaderRecord)(itemResponse.headers),
|
|
113
|
-
...bodyText ? {
|
|
114
|
-
body: bodyText
|
|
115
|
-
} : {}
|
|
116
|
-
};
|
|
117
|
-
return responseItem;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
if (error instanceof Response) {
|
|
120
|
-
const bodyText = await error.text();
|
|
121
|
-
return {
|
|
122
|
-
id: itemId,
|
|
123
|
-
status: error.status,
|
|
124
|
-
headers: (0, external_batch_js_namespaceObject.toHeaderRecord)(error.headers),
|
|
125
|
-
...bodyText ? {
|
|
126
|
-
body: bodyText
|
|
127
|
-
} : {}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
131
|
-
return (0, external_batch_js_namespaceObject.toBatchItemError)(itemId, 500, message);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
const responsePayload = {
|
|
135
|
-
protocolVersion: 1,
|
|
136
|
-
batchId: payload.batchId,
|
|
137
|
-
receivedAt: Date.now(),
|
|
138
|
-
items: responseItems
|
|
139
|
-
};
|
|
140
|
-
return new Response(JSON.stringify(responsePayload), {
|
|
141
|
-
status: 200,
|
|
142
|
-
headers: {
|
|
143
|
-
'content-type': 'application/json; charset=utf-8',
|
|
144
|
-
[index_js_namespaceObject.DEFAULT_DATA_BATCH_HEADER]: '1',
|
|
145
|
-
'x-modernjs-data-batch-id': payload.batchId
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
return {
|
|
150
|
-
enabled: batchEnabled,
|
|
151
|
-
path: batchPath,
|
|
152
|
-
handle
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
exports.createDataPlatformBatchRequestHandler = __webpack_exports__.createDataPlatformBatchRequestHandler;
|
|
156
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
157
|
-
"createDataPlatformBatchRequestHandler"
|
|
158
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
159
|
-
Object.defineProperty(exports, '__esModule', {
|
|
160
|
-
value: true
|
|
161
|
-
});
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createBatchValidationResponse: ()=>createBatchValidationResponse,
|
|
32
|
-
isBatchRequestPayload: ()=>isBatchRequestPayload,
|
|
33
|
-
mapWithConcurrency: ()=>mapWithConcurrency,
|
|
34
|
-
normalizeBatchAllowedMethods: ()=>normalizeBatchAllowedMethods,
|
|
35
|
-
normalizeBatchPath: ()=>normalizeBatchPath,
|
|
36
|
-
prepareJsonRequestBody: ()=>prepareJsonRequestBody,
|
|
37
|
-
promiseWithTimeout: ()=>promiseWithTimeout,
|
|
38
|
-
toBatchItemError: ()=>toBatchItemError,
|
|
39
|
-
toHeaderRecord: ()=>headers_js_namespaceObject.toHeaderRecord
|
|
40
|
-
});
|
|
41
|
-
const index_js_namespaceObject = require("../../data-platform/index.js");
|
|
42
|
-
const headers_js_namespaceObject = require("../../../utils/headers.js");
|
|
43
|
-
function normalizeBatchPath(pathname) {
|
|
44
|
-
if (!pathname || '/' === pathname) return index_js_namespaceObject.DEFAULT_DATA_BATCH_ENDPOINT;
|
|
45
|
-
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
46
|
-
return pathname;
|
|
47
|
-
}
|
|
48
|
-
function normalizeBatchAllowedMethods(allowedMethods) {
|
|
49
|
-
const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
|
|
50
|
-
'GET'
|
|
51
|
-
];
|
|
52
|
-
return new Set(source.map((method)=>method.toUpperCase()));
|
|
53
|
-
}
|
|
54
|
-
function isBatchRequestPayload(value) {
|
|
55
|
-
return (0, index_js_namespaceObject.isPlainObject)(value) && 1 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
|
|
56
|
-
}
|
|
57
|
-
function createBatchValidationResponse(message, status = 400) {
|
|
58
|
-
return new Response(JSON.stringify({
|
|
59
|
-
message
|
|
60
|
-
}), {
|
|
61
|
-
status,
|
|
62
|
-
headers: {
|
|
63
|
-
'content-type': 'application/json; charset=utf-8'
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function cloneWithoutJsonBodyHeaders(request) {
|
|
68
|
-
const headers = new Headers(request.headers);
|
|
69
|
-
headers.delete('content-type');
|
|
70
|
-
headers.delete('content-length');
|
|
71
|
-
return new Request(request.url, {
|
|
72
|
-
method: request.method,
|
|
73
|
-
headers,
|
|
74
|
-
signal: request.signal
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
async function prepareJsonRequestBody(request) {
|
|
78
|
-
const method = (0, index_js_namespaceObject.normalizeMethod)(request.method);
|
|
79
|
-
if ('GET' === method || 'HEAD' === method) return request;
|
|
80
|
-
const contentType = (request.headers.get('content-type') || '').toLowerCase();
|
|
81
|
-
if (!contentType.includes('application/json')) return request;
|
|
82
|
-
if (null === request.body) return cloneWithoutJsonBodyHeaders(request);
|
|
83
|
-
try {
|
|
84
|
-
const bodyText = await request.clone().text();
|
|
85
|
-
if ('' === bodyText) return cloneWithoutJsonBodyHeaders(request);
|
|
86
|
-
JSON.parse(bodyText);
|
|
87
|
-
} catch {
|
|
88
|
-
return createBatchValidationResponse('Invalid JSON request body');
|
|
89
|
-
}
|
|
90
|
-
return request;
|
|
91
|
-
}
|
|
92
|
-
function toBatchItemError(id, status, message) {
|
|
93
|
-
return {
|
|
94
|
-
id,
|
|
95
|
-
status,
|
|
96
|
-
headers: {
|
|
97
|
-
'content-type': 'application/json; charset=utf-8'
|
|
98
|
-
},
|
|
99
|
-
body: JSON.stringify({
|
|
100
|
-
message
|
|
101
|
-
})
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function promiseWithTimeout(effect, timeoutMs) {
|
|
105
|
-
if (timeoutMs <= 0) return effect;
|
|
106
|
-
return new Promise((resolve, reject)=>{
|
|
107
|
-
const timer = setTimeout(()=>{
|
|
108
|
-
reject(new Error(`Batch item timeout after ${String(timeoutMs)}ms`));
|
|
109
|
-
}, timeoutMs);
|
|
110
|
-
effect.then((value)=>{
|
|
111
|
-
clearTimeout(timer);
|
|
112
|
-
resolve(value);
|
|
113
|
-
}, (error)=>{
|
|
114
|
-
clearTimeout(timer);
|
|
115
|
-
reject(error);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
async function mapWithConcurrency(items, concurrency, mapper) {
|
|
120
|
-
if (0 === items.length) return [];
|
|
121
|
-
const normalizedConcurrency = Math.max(1, concurrency);
|
|
122
|
-
const output = new Array(items.length);
|
|
123
|
-
let index = 0;
|
|
124
|
-
const workers = Array.from({
|
|
125
|
-
length: Math.min(normalizedConcurrency, items.length)
|
|
126
|
-
}, async ()=>{
|
|
127
|
-
while(true){
|
|
128
|
-
const currentIndex = index;
|
|
129
|
-
index += 1;
|
|
130
|
-
if (currentIndex >= items.length) return;
|
|
131
|
-
output[currentIndex] = await mapper(items[currentIndex], currentIndex);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
await Promise.all(workers);
|
|
135
|
-
return output;
|
|
136
|
-
}
|
|
137
|
-
exports.createBatchValidationResponse = __webpack_exports__.createBatchValidationResponse;
|
|
138
|
-
exports.isBatchRequestPayload = __webpack_exports__.isBatchRequestPayload;
|
|
139
|
-
exports.mapWithConcurrency = __webpack_exports__.mapWithConcurrency;
|
|
140
|
-
exports.normalizeBatchAllowedMethods = __webpack_exports__.normalizeBatchAllowedMethods;
|
|
141
|
-
exports.normalizeBatchPath = __webpack_exports__.normalizeBatchPath;
|
|
142
|
-
exports.prepareJsonRequestBody = __webpack_exports__.prepareJsonRequestBody;
|
|
143
|
-
exports.promiseWithTimeout = __webpack_exports__.promiseWithTimeout;
|
|
144
|
-
exports.toBatchItemError = __webpack_exports__.toBatchItemError;
|
|
145
|
-
exports.toHeaderRecord = __webpack_exports__.toHeaderRecord;
|
|
146
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
147
|
-
"createBatchValidationResponse",
|
|
148
|
-
"isBatchRequestPayload",
|
|
149
|
-
"mapWithConcurrency",
|
|
150
|
-
"normalizeBatchAllowedMethods",
|
|
151
|
-
"normalizeBatchPath",
|
|
152
|
-
"prepareJsonRequestBody",
|
|
153
|
-
"promiseWithTimeout",
|
|
154
|
-
"toBatchItemError",
|
|
155
|
-
"toHeaderRecord"
|
|
156
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
157
|
-
Object.defineProperty(exports, '__esModule', {
|
|
158
|
-
value: true
|
|
159
|
-
});
|