@bleedingdev/modern-js-plugin-bff 3.5.0-ultramodern.9 → 3.5.0-ultramodern.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/compress.js +52 -0
- package/dist/cjs/cli/generator.js +184 -0
- package/dist/cjs/cli/prefix.js +50 -0
- package/dist/cjs/cli/serverGlobalVars.js +127 -0
- package/dist/cjs/cli/watch.js +51 -0
- package/dist/cjs/cli.js +11 -130
- package/dist/cjs/loader.js +19 -2
- package/dist/cjs/runtime/data-platform/batch/queue.js +284 -0
- package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
- package/dist/cjs/runtime/data-platform/batch/response.js +64 -0
- package/dist/cjs/runtime/data-platform/batch/telemetry.js +67 -0
- package/dist/cjs/runtime/data-platform/batch/url.js +69 -0
- package/dist/cjs/runtime/data-platform/batch-transport.js +59 -0
- package/dist/cjs/runtime/data-platform/codec.js +155 -0
- package/dist/cjs/runtime/data-platform/index.js +30 -633
- package/dist/cjs/runtime/data-platform/invalidation.js +61 -0
- package/dist/cjs/runtime/data-platform/trace.js +73 -0
- package/dist/cjs/runtime/data-platform/types.js +48 -0
- package/dist/cjs/runtime/data-platform/validation.js +178 -0
- package/dist/cjs/runtime/effect/adapter/constants.js +44 -0
- package/dist/cjs/runtime/effect/adapter/cross-project-policy.js +61 -0
- package/dist/cjs/runtime/effect/adapter/entry.js +92 -0
- package/dist/cjs/runtime/effect/adapter/error-response.js +79 -0
- package/dist/cjs/runtime/effect/adapter/handler.js +53 -0
- package/dist/cjs/runtime/effect/adapter.js +26 -146
- package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
- package/dist/cjs/runtime/effect/backend-federation/identity.js +82 -0
- package/dist/cjs/runtime/effect/backend-federation/load.js +66 -0
- package/dist/cjs/runtime/effect/backend-federation/plugin.js +53 -0
- package/dist/cjs/runtime/effect/backend-federation/remotes.js +50 -0
- package/dist/cjs/runtime/effect/backend-federation/runtime.js +64 -0
- package/dist/cjs/runtime/effect/backend-federation/types.js +18 -0
- package/dist/cjs/runtime/effect/backend-federation/utils.js +48 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/errors.js +83 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/index.js +55 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/load.js +94 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +120 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/remote.js +68 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/types.js +18 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/validation.js +109 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest.js +62 -0
- package/dist/cjs/runtime/effect/backend-federation.js +65 -0
- package/dist/cjs/runtime/effect/dispatch.js +101 -0
- package/dist/cjs/runtime/effect/edge.js +64 -71
- package/dist/cjs/runtime/effect/endpoint-contracts.js +7 -21
- package/dist/cjs/runtime/effect/entry-shape.js +84 -0
- package/dist/cjs/runtime/effect/handler/batch-handler.js +161 -0
- package/dist/cjs/runtime/effect/handler/batch.js +195 -0
- package/dist/cjs/runtime/effect/handler/definition.js +101 -0
- package/dist/cjs/runtime/effect/handler/envelope.js +104 -0
- package/dist/cjs/runtime/effect/handler/http.js +96 -0
- package/dist/cjs/runtime/effect/handler/openapi.js +57 -0
- package/dist/cjs/runtime/effect/handler/routing.js +100 -0
- package/dist/cjs/runtime/effect/handler/rpc.js +63 -0
- package/dist/cjs/runtime/effect/handler/types.js +43 -0
- package/dist/cjs/runtime/effect/handler.js +37 -529
- package/dist/cjs/runtime/effect/index.js +91 -15
- package/dist/cjs/runtime/effect/module.js +23 -80
- package/dist/cjs/runtime/effect/rpcSerialization.js +54 -0
- package/dist/cjs/runtime/effect-client/batch.js +73 -0
- package/dist/cjs/runtime/effect-client/envelope.js +145 -0
- package/dist/cjs/runtime/effect-client/guards.js +44 -0
- package/dist/cjs/runtime/effect-client/index.js +6 -16
- package/dist/cjs/runtime/effect-client/request-context.js +64 -0
- package/dist/cjs/runtime/effect-client/request.js +66 -0
- package/dist/cjs/runtime/effect-client/runtime.js +12 -178
- package/dist/cjs/runtime/effect-client/types.js +18 -0
- package/dist/cjs/runtime/safe-failure.js +2 -1
- package/dist/cjs/utils/client-generator/files.js +152 -0
- package/dist/cjs/utils/client-generator/generate.js +138 -0
- package/dist/cjs/utils/client-generator/index.js +83 -0
- package/dist/cjs/utils/client-generator/package-json.js +132 -0
- package/dist/cjs/utils/client-generator/write-package.js +125 -0
- package/dist/cjs/utils/clientGenerator.js +26 -303
- package/dist/cjs/utils/effect-client-generator/generator.js +68 -0
- package/dist/cjs/utils/effect-client-generator/index.js +51 -0
- package/dist/cjs/utils/effect-client-generator/paths.js +73 -0
- package/dist/cjs/utils/effect-client-generator/rendering.js +231 -0
- package/dist/cjs/utils/effect-client-generator/runtime.js +85 -0
- package/dist/cjs/utils/effect-client-generator/types.js +18 -0
- package/dist/cjs/utils/effectClientGenerator.js +5 -262
- package/dist/cjs/utils/effectSourceLoader.js +252 -0
- package/dist/esm/cli/compress.mjs +14 -0
- package/dist/esm/cli/generator.mjs +133 -0
- package/dist/esm/cli/prefix.mjs +9 -0
- package/dist/esm/cli/serverGlobalVars.mjs +76 -0
- package/dist/esm/cli/watch.mjs +13 -0
- package/dist/esm/cli.mjs +7 -121
- package/dist/esm/loader.mjs +19 -2
- package/dist/esm/runtime/data-platform/batch/queue.mjs +246 -0
- package/dist/esm/runtime/data-platform/batch/request.mjs +45 -0
- package/dist/esm/runtime/data-platform/batch/response.mjs +23 -0
- package/dist/esm/runtime/data-platform/batch/telemetry.mjs +23 -0
- package/dist/esm/runtime/data-platform/batch/url.mjs +25 -0
- package/dist/esm/runtime/data-platform/batch-transport.mjs +12 -0
- package/dist/esm/runtime/data-platform/codec.mjs +90 -0
- package/dist/esm/runtime/data-platform/index.mjs +6 -610
- package/dist/esm/runtime/data-platform/invalidation.mjs +20 -0
- package/dist/esm/runtime/data-platform/trace.mjs +29 -0
- package/dist/esm/runtime/data-platform/types.mjs +4 -0
- package/dist/esm/runtime/data-platform/validation.mjs +128 -0
- package/dist/esm/runtime/effect/adapter/constants.mjs +6 -0
- package/dist/esm/runtime/effect/adapter/cross-project-policy.mjs +23 -0
- package/dist/esm/runtime/effect/adapter/entry.mjs +44 -0
- package/dist/esm/runtime/effect/adapter/error-response.mjs +41 -0
- package/dist/esm/runtime/effect/adapter/handler.mjs +15 -0
- package/dist/esm/runtime/effect/adapter.mjs +27 -147
- package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
- package/dist/esm/runtime/effect/backend-federation/identity.mjs +41 -0
- package/dist/esm/runtime/effect/backend-federation/load.mjs +28 -0
- package/dist/esm/runtime/effect/backend-federation/plugin.mjs +15 -0
- package/dist/esm/runtime/effect/backend-federation/remotes.mjs +12 -0
- package/dist/esm/runtime/effect/backend-federation/runtime.mjs +26 -0
- package/dist/esm/runtime/effect/backend-federation/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation/utils.mjs +7 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/errors.mjs +32 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/index.mjs +4 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/load.mjs +56 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/metadata.mjs +42 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/reference.mjs +76 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/remote.mjs +30 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/types.mjs +0 -0
- package/dist/esm/runtime/effect/backend-federation-manifest/validation.mjs +65 -0
- package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -0
- package/dist/esm/runtime/effect/backend-federation.mjs +5 -0
- package/dist/esm/runtime/effect/dispatch.mjs +63 -0
- package/dist/esm/runtime/effect/edge.mjs +17 -63
- package/dist/esm/runtime/effect/endpoint-contracts.mjs +8 -13
- package/dist/esm/runtime/effect/entry-shape.mjs +36 -0
- package/dist/esm/runtime/effect/handler/batch-handler.mjs +123 -0
- package/dist/esm/runtime/effect/handler/batch.mjs +124 -0
- package/dist/esm/runtime/effect/handler/definition.mjs +60 -0
- package/dist/esm/runtime/effect/handler/envelope.mjs +63 -0
- package/dist/esm/runtime/effect/handler/http.mjs +58 -0
- package/dist/esm/runtime/effect/handler/openapi.mjs +19 -0
- package/dist/esm/runtime/effect/handler/routing.mjs +50 -0
- package/dist/esm/runtime/effect/handler/rpc.mjs +22 -0
- package/dist/esm/runtime/effect/handler/types.mjs +5 -0
- package/dist/esm/runtime/effect/handler.mjs +11 -506
- package/dist/esm/runtime/effect/index.mjs +5 -2
- package/dist/esm/runtime/effect/module.mjs +25 -82
- package/dist/esm/runtime/effect/rpcSerialization.mjs +16 -0
- package/dist/esm/runtime/effect-client/batch.mjs +35 -0
- package/dist/esm/runtime/effect-client/envelope.mjs +104 -0
- package/dist/esm/runtime/effect-client/guards.mjs +3 -0
- package/dist/esm/runtime/effect-client/index.mjs +27 -37
- package/dist/esm/runtime/effect-client/request-context.mjs +23 -0
- package/dist/esm/runtime/effect-client/request.mjs +28 -0
- package/dist/esm/runtime/effect-client/runtime.mjs +12 -178
- package/dist/esm/runtime/effect-client/types.mjs +0 -0
- package/dist/esm/runtime/safe-failure.mjs +2 -1
- package/dist/esm/utils/client-generator/files.mjs +68 -0
- package/dist/esm/utils/client-generator/generate.mjs +88 -0
- package/dist/esm/utils/client-generator/index.mjs +4 -0
- package/dist/esm/utils/client-generator/package-json.mjs +78 -0
- package/dist/esm/utils/client-generator/write-package.mjs +74 -0
- package/dist/esm/utils/clientGenerator.mjs +2 -293
- package/dist/esm/utils/effect-client-generator/generator.mjs +27 -0
- package/dist/esm/utils/effect-client-generator/index.mjs +3 -0
- package/dist/esm/utils/effect-client-generator/paths.mjs +25 -0
- package/dist/esm/utils/effect-client-generator/rendering.mjs +180 -0
- package/dist/esm/utils/effect-client-generator/runtime.mjs +34 -0
- package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
- package/dist/esm/utils/effectClientGenerator.mjs +1 -249
- package/dist/esm/utils/effectSourceLoader.mjs +199 -0
- package/dist/esm-node/cli/compress.mjs +15 -0
- package/dist/esm-node/cli/generator.mjs +134 -0
- package/dist/esm-node/cli/prefix.mjs +10 -0
- package/dist/esm-node/cli/serverGlobalVars.mjs +77 -0
- package/dist/esm-node/cli/watch.mjs +14 -0
- package/dist/esm-node/cli.mjs +7 -121
- package/dist/esm-node/loader.mjs +19 -2
- package/dist/esm-node/runtime/data-platform/batch/queue.mjs +247 -0
- package/dist/esm-node/runtime/data-platform/batch/request.mjs +46 -0
- package/dist/esm-node/runtime/data-platform/batch/response.mjs +24 -0
- package/dist/esm-node/runtime/data-platform/batch/telemetry.mjs +24 -0
- package/dist/esm-node/runtime/data-platform/batch/url.mjs +26 -0
- package/dist/esm-node/runtime/data-platform/batch-transport.mjs +13 -0
- package/dist/esm-node/runtime/data-platform/codec.mjs +91 -0
- package/dist/esm-node/runtime/data-platform/index.mjs +6 -610
- package/dist/esm-node/runtime/data-platform/invalidation.mjs +21 -0
- package/dist/esm-node/runtime/data-platform/trace.mjs +30 -0
- package/dist/esm-node/runtime/data-platform/types.mjs +5 -0
- package/dist/esm-node/runtime/data-platform/validation.mjs +129 -0
- package/dist/esm-node/runtime/effect/adapter/constants.mjs +7 -0
- package/dist/esm-node/runtime/effect/adapter/cross-project-policy.mjs +24 -0
- package/dist/esm-node/runtime/effect/adapter/entry.mjs +45 -0
- package/dist/esm-node/runtime/effect/adapter/error-response.mjs +42 -0
- package/dist/esm-node/runtime/effect/adapter/handler.mjs +16 -0
- package/dist/esm-node/runtime/effect/adapter.mjs +28 -149
- package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
- package/dist/esm-node/runtime/effect/backend-federation/identity.mjs +42 -0
- package/dist/esm-node/runtime/effect/backend-federation/load.mjs +29 -0
- package/dist/esm-node/runtime/effect/backend-federation/plugin.mjs +16 -0
- package/dist/esm-node/runtime/effect/backend-federation/remotes.mjs +13 -0
- package/dist/esm-node/runtime/effect/backend-federation/runtime.mjs +27 -0
- package/dist/esm-node/runtime/effect/backend-federation/types.mjs +1 -0
- package/dist/esm-node/runtime/effect/backend-federation/utils.mjs +8 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/errors.mjs +33 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/index.mjs +5 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/load.mjs +57 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/metadata.mjs +43 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/reference.mjs +77 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/remote.mjs +31 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/types.mjs +1 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest/validation.mjs +66 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +2 -0
- package/dist/esm-node/runtime/effect/backend-federation.mjs +6 -0
- package/dist/esm-node/runtime/effect/dispatch.mjs +64 -0
- package/dist/esm-node/runtime/effect/edge.mjs +17 -63
- package/dist/esm-node/runtime/effect/endpoint-contracts.mjs +8 -13
- package/dist/esm-node/runtime/effect/entry-shape.mjs +37 -0
- package/dist/esm-node/runtime/effect/handler/batch-handler.mjs +124 -0
- package/dist/esm-node/runtime/effect/handler/batch.mjs +125 -0
- package/dist/esm-node/runtime/effect/handler/definition.mjs +61 -0
- package/dist/esm-node/runtime/effect/handler/envelope.mjs +64 -0
- package/dist/esm-node/runtime/effect/handler/http.mjs +59 -0
- package/dist/esm-node/runtime/effect/handler/openapi.mjs +20 -0
- package/dist/esm-node/runtime/effect/handler/routing.mjs +51 -0
- package/dist/esm-node/runtime/effect/handler/rpc.mjs +23 -0
- package/dist/esm-node/runtime/effect/handler/types.mjs +6 -0
- package/dist/esm-node/runtime/effect/handler.mjs +11 -506
- package/dist/esm-node/runtime/effect/index.mjs +5 -2
- package/dist/esm-node/runtime/effect/module.mjs +25 -82
- package/dist/esm-node/runtime/effect/rpcSerialization.mjs +17 -0
- package/dist/esm-node/runtime/effect-client/batch.mjs +36 -0
- package/dist/esm-node/runtime/effect-client/envelope.mjs +105 -0
- package/dist/esm-node/runtime/effect-client/guards.mjs +4 -0
- package/dist/esm-node/runtime/effect-client/index.mjs +27 -37
- package/dist/esm-node/runtime/effect-client/request-context.mjs +24 -0
- package/dist/esm-node/runtime/effect-client/request.mjs +29 -0
- package/dist/esm-node/runtime/effect-client/runtime.mjs +12 -178
- package/dist/esm-node/runtime/effect-client/types.mjs +1 -0
- package/dist/esm-node/runtime/safe-failure.mjs +2 -1
- package/dist/esm-node/utils/client-generator/files.mjs +69 -0
- package/dist/esm-node/utils/client-generator/generate.mjs +89 -0
- package/dist/esm-node/utils/client-generator/index.mjs +5 -0
- package/dist/esm-node/utils/client-generator/package-json.mjs +79 -0
- package/dist/esm-node/utils/client-generator/write-package.mjs +75 -0
- package/dist/esm-node/utils/clientGenerator.mjs +2 -293
- package/dist/esm-node/utils/effect-client-generator/generator.mjs +28 -0
- package/dist/esm-node/utils/effect-client-generator/index.mjs +4 -0
- package/dist/esm-node/utils/effect-client-generator/paths.mjs +26 -0
- package/dist/esm-node/utils/effect-client-generator/rendering.mjs +181 -0
- package/dist/esm-node/utils/effect-client-generator/runtime.mjs +36 -0
- package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
- package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
- package/dist/esm-node/utils/effectSourceLoader.mjs +200 -0
- package/dist/types/cli/compress.d.ts +2 -0
- package/dist/types/cli/generator.d.ts +7 -0
- package/dist/types/cli/prefix.d.ts +2 -0
- package/dist/types/cli/serverGlobalVars.d.ts +4 -0
- package/dist/types/cli/watch.d.ts +1 -0
- package/dist/types/cli.d.ts +0 -1
- package/dist/types/runtime/data-platform/batch/queue.d.ts +8 -0
- package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
- package/dist/types/runtime/data-platform/batch/response.d.ts +3 -0
- package/dist/types/runtime/data-platform/batch/telemetry.d.ts +4 -0
- package/dist/types/runtime/data-platform/batch/url.d.ts +4 -0
- package/dist/types/runtime/data-platform/batch-transport.d.ts +3 -0
- package/dist/types/runtime/data-platform/codec.d.ts +17 -0
- package/dist/types/runtime/data-platform/index.d.ts +7 -191
- package/dist/types/runtime/data-platform/invalidation.d.ts +8 -0
- package/dist/types/runtime/data-platform/trace.d.ts +4 -0
- package/dist/types/runtime/data-platform/types.d.ts +146 -0
- package/dist/types/runtime/data-platform/validation.d.ts +29 -0
- package/dist/types/runtime/effect/adapter/constants.d.ts +1 -0
- package/dist/types/runtime/effect/adapter/cross-project-policy.d.ts +4 -0
- package/dist/types/runtime/effect/adapter/entry.d.ts +2 -0
- package/dist/types/runtime/effect/adapter/error-response.d.ts +2 -0
- package/dist/types/runtime/effect/adapter/handler.d.ts +7 -0
- package/dist/types/runtime/effect/adapter.d.ts +4 -13
- package/dist/types/runtime/effect/backend-federation/entry.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation/identity.d.ts +30 -0
- package/dist/types/runtime/effect/backend-federation/load.d.ts +13 -0
- package/dist/types/runtime/effect/backend-federation/plugin.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation/remotes.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation/runtime.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation/types.d.ts +73 -0
- package/dist/types/runtime/effect/backend-federation/utils.d.ts +2 -0
- package/dist/types/runtime/effect/backend-federation-manifest/errors.d.ts +11 -0
- package/dist/types/runtime/effect/backend-federation-manifest/index.d.ts +6 -0
- package/dist/types/runtime/effect/backend-federation-manifest/load.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation-manifest/metadata.d.ts +18 -0
- package/dist/types/runtime/effect/backend-federation-manifest/reference.d.ts +4 -0
- package/dist/types/runtime/effect/backend-federation-manifest/remote.d.ts +3 -0
- package/dist/types/runtime/effect/backend-federation-manifest/types.d.ts +51 -0
- package/dist/types/runtime/effect/backend-federation-manifest/validation.d.ts +5 -0
- package/dist/types/runtime/effect/backend-federation-manifest.d.ts +1 -0
- package/dist/types/runtime/effect/backend-federation.d.ts +7 -0
- package/dist/types/runtime/effect/dispatch.d.ts +13 -0
- package/dist/types/runtime/effect/edge.d.ts +8 -8
- package/dist/types/runtime/effect/endpoint-contracts.d.ts +5 -7
- package/dist/types/runtime/effect/entry-shape.d.ts +31 -0
- package/dist/types/runtime/effect/handler/batch-handler.d.ts +11 -0
- package/dist/types/runtime/effect/handler/batch.d.ts +17 -0
- package/dist/types/runtime/effect/handler/definition.d.ts +17 -0
- package/dist/types/runtime/effect/handler/envelope.d.ts +13 -0
- package/dist/types/runtime/effect/handler/http.d.ts +14 -0
- package/dist/types/runtime/effect/handler/openapi.d.ts +4 -0
- package/dist/types/runtime/effect/handler/routing.d.ts +5 -0
- package/dist/types/runtime/effect/handler/rpc.d.ts +7 -0
- package/dist/types/runtime/effect/handler/types.d.ts +148 -0
- package/dist/types/runtime/effect/handler.d.ts +4 -190
- package/dist/types/runtime/effect/index.d.ts +3 -0
- package/dist/types/runtime/effect/module.d.ts +3 -2
- package/dist/types/runtime/effect/rpcSerialization.d.ts +3 -0
- package/dist/types/runtime/effect-client/batch.d.ts +2 -0
- package/dist/types/runtime/effect-client/envelope.d.ts +15 -0
- package/dist/types/runtime/effect-client/guards.d.ts +2 -0
- package/dist/types/runtime/effect-client/index.d.ts +1 -1
- package/dist/types/runtime/effect-client/request-context.d.ts +3 -0
- package/dist/types/runtime/effect-client/request.d.ts +1 -0
- package/dist/types/runtime/effect-client/runtime.d.ts +2 -68
- package/dist/types/runtime/effect-client/types.d.ts +68 -0
- package/dist/types/utils/client-generator/files.d.ts +28 -0
- package/dist/types/utils/client-generator/generate.d.ts +26 -0
- package/dist/types/utils/client-generator/index.d.ts +7 -0
- package/dist/types/utils/client-generator/package-json.d.ts +16 -0
- package/dist/types/utils/client-generator/write-package.d.ts +6 -0
- package/dist/types/utils/clientGenerator.d.ts +2 -37
- package/dist/types/utils/crossProjectServerPolicy.d.ts +3 -2
- package/dist/types/utils/effect-client-generator/generator.d.ts +10 -0
- package/dist/types/utils/effect-client-generator/index.d.ts +4 -0
- package/dist/types/utils/effect-client-generator/paths.d.ts +5 -0
- package/dist/types/utils/effect-client-generator/rendering.d.ts +4 -0
- package/dist/types/utils/effect-client-generator/runtime.d.ts +12 -0
- package/dist/types/utils/effect-client-generator/types.d.ts +27 -0
- package/dist/types/utils/effectClientGenerator.d.ts +2 -41
- package/dist/types/utils/effectSourceLoader.d.ts +15 -0
- package/package.json +45 -33
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { BACKEND_FEDERATION_EFFECT_EXPOSE } from '@modern-js/utils/universal';
|
|
2
|
+
import type { ModuleFederation, ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
3
|
+
import type { EffectApiModule } from '../module';
|
|
4
|
+
import type { BackendFederationExpectedIdentity } from './identity';
|
|
5
|
+
export type BackendFederationRemote = {
|
|
6
|
+
name: string;
|
|
7
|
+
entry: string;
|
|
8
|
+
type?: 'commonjs-module' | 'module' | string;
|
|
9
|
+
entryGlobalName?: string;
|
|
10
|
+
shareScope?: string | string[];
|
|
11
|
+
expose?: typeof BACKEND_FEDERATION_EFFECT_EXPOSE;
|
|
12
|
+
};
|
|
13
|
+
export type BackendFederationRuntimeOptions = {
|
|
14
|
+
hostName: string;
|
|
15
|
+
remote?: BackendFederationRemote;
|
|
16
|
+
remotes?: BackendFederationRemote[];
|
|
17
|
+
plugins?: ModuleFederationRuntimePlugin[];
|
|
18
|
+
};
|
|
19
|
+
export type BackendFederationEntryExports = {
|
|
20
|
+
get: (id: string) => (() => Promise<unknown> | unknown) | Promise<() => Promise<unknown> | unknown>;
|
|
21
|
+
init?: (...args: unknown[]) => void | Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export type BackendFederatedEffectApiModule = EffectApiModule & {
|
|
24
|
+
backendFederationContract?: {
|
|
25
|
+
compatibility?: {
|
|
26
|
+
build?: unknown;
|
|
27
|
+
contractVersion?: unknown;
|
|
28
|
+
nodeAdapterVersion?: unknown;
|
|
29
|
+
packageName?: unknown;
|
|
30
|
+
/**
|
|
31
|
+
* ADR-0019 delivery-unit identity root, generator-emitted alongside
|
|
32
|
+
* manifest's `versionBoundary.deliveryUnit`. Additive/optional.
|
|
33
|
+
*/
|
|
34
|
+
unitId?: unknown;
|
|
35
|
+
/** ADR-0019 delivery-unit source revision. Additive/optional. */
|
|
36
|
+
sourceRevision?: unknown;
|
|
37
|
+
};
|
|
38
|
+
name?: unknown;
|
|
39
|
+
role?: unknown;
|
|
40
|
+
runtimeFramework?: unknown;
|
|
41
|
+
strictEffectApproach?: unknown;
|
|
42
|
+
};
|
|
43
|
+
contract?: unknown;
|
|
44
|
+
operationContexts?: unknown;
|
|
45
|
+
runtime?: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type BackendFederationLoadEntryPluginOptions = {
|
|
48
|
+
resolveEntry: (remote: BackendFederationRemote) => BackendFederationEntryExports | undefined | Promise<BackendFederationEntryExports | undefined>;
|
|
49
|
+
};
|
|
50
|
+
export type BackendFederationLoadOptions = BackendFederationRuntimeOptions & {
|
|
51
|
+
runtime?: ModuleFederation;
|
|
52
|
+
remoteName?: string;
|
|
53
|
+
expose?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Identity-aware public load options (MV-G23): the expected delivery-unit
|
|
57
|
+
* `unitId` + `buildMarker` are mandatory and validated against the loaded
|
|
58
|
+
* expose's compatibility metadata.
|
|
59
|
+
*/
|
|
60
|
+
export type BackendFederationIdentityLoadOptions = BackendFederationLoadOptions & {
|
|
61
|
+
expected: BackendFederationExpectedIdentity;
|
|
62
|
+
/**
|
|
63
|
+
* Tolerate legacy exposes without identity metadata (mismatching declared
|
|
64
|
+
* values still fail). Prefer leaving this unset: identity-less exposes
|
|
65
|
+
* cannot be validated against a resolved delivery-unit record.
|
|
66
|
+
*/
|
|
67
|
+
allowMissingIdentityMetadata?: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type BackendFederationLoadEntryPlugin = ModuleFederationRuntimePlugin & {
|
|
70
|
+
loadEntry?: (args: {
|
|
71
|
+
remoteInfo: BackendFederationRemote;
|
|
72
|
+
}) => BackendFederationEntryExports | undefined | Promise<BackendFederationEntryExports | undefined>;
|
|
73
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type BackendFederationManifestAdapterErrorCode = 'manifest_unavailable' | 'manifest_invalid' | 'remote_unavailable' | 'strict_effect_required' | 'timeout' | 'version_mismatch';
|
|
2
|
+
export declare const BACKEND_FEDERATION_MANIFEST_ADAPTER_FAILURE_EVENT: 'modernjs:microvertical-server-fallback';
|
|
3
|
+
export declare class BackendFederationManifestAdapterError extends Error {
|
|
4
|
+
code: BackendFederationManifestAdapterErrorCode;
|
|
5
|
+
readonly failureEvent: "modernjs:microvertical-server-fallback";
|
|
6
|
+
details?: Record<string, unknown>;
|
|
7
|
+
constructor(code: BackendFederationManifestAdapterErrorCode, message: string, cause?: unknown, details?: Record<string, unknown>);
|
|
8
|
+
}
|
|
9
|
+
export declare function assertManifestAdapter(condition: unknown, code: BackendFederationManifestAdapterErrorCode, message: string): asserts condition;
|
|
10
|
+
export declare function assertVersionValue(actual: string | undefined, expected: string | undefined, label: string, details?: Record<string, unknown>): void;
|
|
11
|
+
export declare function assertConsistentValue(left: string | undefined, right: string | undefined, label: string, details?: Record<string, unknown>): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { BackendFederationManifestAdapterErrorCode } from './errors';
|
|
2
|
+
export { BACKEND_FEDERATION_MANIFEST_ADAPTER_FAILURE_EVENT, BackendFederationManifestAdapterError, } from './errors';
|
|
3
|
+
export { loadBackendFederatedEffectApiFromManifest } from './load';
|
|
4
|
+
export { loadBackendFederationManifest } from './reference';
|
|
5
|
+
export { resolveBackendFederationRemoteFromManifest } from './remote';
|
|
6
|
+
export type { BackendFederationManifest, BackendFederationManifestAdapterFallback, BackendFederationManifestAdapterOptions, BackendFederationManifestFetchResponse, BackendFederationVersionBoundaryExpectation, } from './types';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type BackendFederatedEffectApiModule } from '../backend-federation';
|
|
2
|
+
import type { BackendFederationManifestAdapterOptions } from './types';
|
|
3
|
+
export declare function loadBackendFederatedEffectApiFromManifest(options: BackendFederationManifestAdapterOptions): Promise<BackendFederatedEffectApiModule>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BackendFederationManifest } from './types';
|
|
2
|
+
export declare function stringValue(value: unknown): string | undefined;
|
|
3
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
export declare function recordField(value: Record<string, unknown> | undefined, field: string): Record<string, unknown> | undefined;
|
|
5
|
+
export declare function resolveRemoteEntryFromMetadata(manifest: BackendFederationManifest): string | undefined;
|
|
6
|
+
export declare function backendFederationMetadata(manifest: BackendFederationManifest): Record<string, unknown> | undefined;
|
|
7
|
+
export declare function versionBoundaryMetadata(manifest: BackendFederationManifest): Record<string, unknown> | undefined;
|
|
8
|
+
export declare function deliveryUnitMetadata(record: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the delivery-unit identity root for a manifest (ADR-0019 §3):
|
|
11
|
+
* prefers `versionBoundary.deliveryUnit`, falls back to the top-level
|
|
12
|
+
* `backendFederation.deliveryUnit` record. Both are additive/optional so
|
|
13
|
+
* legacy manifests without delivery-unit metadata continue to validate.
|
|
14
|
+
*/
|
|
15
|
+
export declare function manifestDeliveryUnit(backendFederation: Record<string, unknown> | undefined, boundary: Record<string, unknown> | undefined): {
|
|
16
|
+
boundary: Record<string, unknown> | undefined;
|
|
17
|
+
top: Record<string, unknown> | undefined;
|
|
18
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BackendFederationManifest, BackendFederationManifestAdapterOptions } from './types';
|
|
2
|
+
export declare function resolveBackendFederationManifestReference(options: Pick<BackendFederationManifestAdapterOptions, 'env' | 'manifestEnv' | 'manifestPath' | 'manifestUrl'>): string | undefined;
|
|
3
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, label: string): Promise<T>;
|
|
4
|
+
export declare function loadBackendFederationManifest(options: Pick<BackendFederationManifestAdapterOptions, 'allowLegacyManifest' | 'env' | 'expected' | 'fetch' | 'manifest' | 'manifestEnv' | 'manifestPath' | 'manifestUrl' | 'timeoutMs'>): Promise<BackendFederationManifest>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type BackendFederationRemote } from '../backend-federation';
|
|
2
|
+
import type { BackendFederationManifest } from './types';
|
|
3
|
+
export declare function resolveBackendFederationRemoteFromManifest(manifest: BackendFederationManifest, remoteOverride?: Partial<BackendFederationRemote>): BackendFederationRemote;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ModuleFederation, ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
2
|
+
import type { BackendFederatedEffectApiModule, BackendFederationRemote } from '../backend-federation';
|
|
3
|
+
import type { BackendFederationManifestAdapterError } from './errors';
|
|
4
|
+
export type BackendFederationManifest = Record<string, unknown>;
|
|
5
|
+
export type BackendFederationVersionBoundaryExpectation = {
|
|
6
|
+
buildVersion?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Delivery-unit build marker (ADR-0019). Semantically the same value as
|
|
9
|
+
* `buildVersion`; treated as an alias. If both are set and disagree the
|
|
10
|
+
* expectation itself is invalid and fails closed before any manifest
|
|
11
|
+
* comparison runs.
|
|
12
|
+
*/
|
|
13
|
+
buildMarker?: string;
|
|
14
|
+
contractVersion?: string;
|
|
15
|
+
nodeAdapterVersion?: string;
|
|
16
|
+
packageName?: string;
|
|
17
|
+
remoteName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Delivery-unit identity root (ADR-0019 §3). When set, the manifest's
|
|
20
|
+
* `backendFederation.versionBoundary.deliveryUnit.unitId` (or the
|
|
21
|
+
* top-level `backendFederation.deliveryUnit.unitId` fallback) must match.
|
|
22
|
+
*/
|
|
23
|
+
unitId?: string;
|
|
24
|
+
version?: string;
|
|
25
|
+
};
|
|
26
|
+
export type BackendFederationManifestFetchResponse = {
|
|
27
|
+
ok: boolean;
|
|
28
|
+
status: number;
|
|
29
|
+
statusText?: string;
|
|
30
|
+
text: () => Promise<string>;
|
|
31
|
+
};
|
|
32
|
+
export type BackendFederationManifestAdapterFallback = (error: BackendFederationManifestAdapterError, context: {
|
|
33
|
+
manifest?: BackendFederationManifest;
|
|
34
|
+
remote?: BackendFederationRemote;
|
|
35
|
+
}) => BackendFederatedEffectApiModule | Promise<BackendFederatedEffectApiModule>;
|
|
36
|
+
export type BackendFederationManifestAdapterOptions = {
|
|
37
|
+
allowLegacyManifest?: boolean;
|
|
38
|
+
env?: Record<string, string | undefined>;
|
|
39
|
+
expected?: BackendFederationVersionBoundaryExpectation;
|
|
40
|
+
fallback?: BackendFederationManifestAdapterFallback;
|
|
41
|
+
fetch?: (url: string) => Promise<BackendFederationManifestFetchResponse>;
|
|
42
|
+
hostName: string;
|
|
43
|
+
manifest?: BackendFederationManifest;
|
|
44
|
+
manifestEnv?: string;
|
|
45
|
+
manifestPath?: string;
|
|
46
|
+
manifestUrl?: string;
|
|
47
|
+
plugins?: ModuleFederationRuntimePlugin[];
|
|
48
|
+
remote?: Partial<BackendFederationRemote>;
|
|
49
|
+
runtime?: ModuleFederation;
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type BackendFederatedEffectApiModule, type BackendFederationRemote } from '../backend-federation';
|
|
2
|
+
import type { BackendFederationManifest, BackendFederationVersionBoundaryExpectation } from './types';
|
|
3
|
+
export declare function validateBackendFederationManifest(manifest: BackendFederationManifest, expected?: BackendFederationVersionBoundaryExpectation): void;
|
|
4
|
+
export declare function validateLoadedBackendFederationContract(loaded: BackendFederatedEffectApiModule, manifest: BackendFederationManifest, remote: BackendFederationRemote): void;
|
|
5
|
+
export declare function classifyLoadError(error: unknown): "remote_unavailable" | "strict_effect_required" | "version_mismatch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './backend-federation-manifest/index';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION } from '@modern-js/utils/universal';
|
|
2
|
+
export { type BackendFederationExpectedIdentity, type BackendFederationIdentityIssue, validateExpectedBackendFederationIdentity, } from './backend-federation/identity';
|
|
3
|
+
export { loadBackendFederatedEffectApi } from './backend-federation/load';
|
|
4
|
+
export { createBackendFederationLoadEntryPlugin } from './backend-federation/plugin';
|
|
5
|
+
export { createBackendFederationRuntime } from './backend-federation/runtime';
|
|
6
|
+
export type { BackendFederatedEffectApiModule, BackendFederationEntryExports, BackendFederationIdentityLoadOptions, BackendFederationLoadEntryPluginOptions, BackendFederationRemote, BackendFederationRuntimeOptions, } from './backend-federation/types';
|
|
7
|
+
export { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EffectBffRequestHandler } from './module';
|
|
2
|
+
import { type EffectContext } from './operation-context';
|
|
3
|
+
type EffectDispatchContextRunner = <T>(context: EffectContext, cb: () => T) => T;
|
|
4
|
+
export type DispatchEffectBffRequestOptions = {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
env?: Record<string, unknown>;
|
|
7
|
+
path?: string;
|
|
8
|
+
method?: string;
|
|
9
|
+
runWithEffectContext: EffectDispatchContextRunner;
|
|
10
|
+
onError?: (error: unknown, context: EffectContext) => Promise<Response> | Response;
|
|
11
|
+
};
|
|
12
|
+
export declare function dispatchEffectBffRequestWithContext(handler: EffectBffRequestHandler, request: Request, options: DispatchEffectBffRequestOptions): Promise<Response>;
|
|
13
|
+
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
import { type DispatchEffectBffRequestOptions } from './dispatch';
|
|
1
2
|
import type { EffectBffOpenApiConfig, EffectDataPlatformValidationOptions } from './handler';
|
|
2
3
|
import { type EffectApiModule, type EffectBffRequestHandler } from './module';
|
|
3
|
-
import {
|
|
4
|
+
import type { EffectContext } from './operation-context';
|
|
5
|
+
export { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_EFFECT_EXPOSE, BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_NODE_ADAPTER_VERSION, type BackendFederatedEffectApiModule, type BackendFederationEntryExports, type BackendFederationExpectedIdentity, type BackendFederationIdentityIssue, type BackendFederationIdentityLoadOptions, type BackendFederationLoadEntryPluginOptions, type BackendFederationRemote, type BackendFederationRuntimeOptions, createBackendFederationLoadEntryPlugin, createBackendFederationRuntime, loadBackendFederatedEffectApi, validateExpectedBackendFederationIdentity, } from './backend-federation';
|
|
4
6
|
export { runWithEffectContext, useEffectContext, useOperationContext, } from './edge-context';
|
|
5
7
|
export * from './handler';
|
|
6
8
|
export { type CreateEffectOperationContextOptions, createEffectOperationContext, type EffectContext, } from './operation-context';
|
|
7
|
-
export type EffectBffEdgeDispatchOptions =
|
|
8
|
-
prefix?: string;
|
|
9
|
-
env?: Record<string, unknown>;
|
|
10
|
-
path?: string;
|
|
11
|
-
method?: string;
|
|
12
|
-
onError?: (error: unknown, context: EffectContext) => Promise<Response> | Response;
|
|
13
|
-
};
|
|
9
|
+
export type EffectBffEdgeDispatchOptions = Omit<DispatchEffectBffRequestOptions, 'runWithEffectContext'>;
|
|
14
10
|
export type EffectBffEdgeHandlerOptions = {
|
|
15
11
|
module: EffectApiModule;
|
|
16
12
|
prefix?: string;
|
|
@@ -20,6 +16,10 @@ export type EffectBffEdgeHandlerOptions = {
|
|
|
20
16
|
onWarning?: (message: string) => void;
|
|
21
17
|
};
|
|
22
18
|
export declare function dispatchEffectBffRequest(handler: EffectBffRequestHandler, request: Request, options?: EffectBffEdgeDispatchOptions): Promise<Response>;
|
|
19
|
+
export declare function createEffectBffEdgeDispatcher(options: EffectBffEdgeHandlerOptions): Promise<{
|
|
20
|
+
dispatch: (request: Request, dispatchOptions?: Omit<EffectBffEdgeDispatchOptions, 'prefix' | 'onError'>) => Promise<Response>;
|
|
21
|
+
dispose: () => Promise<void>;
|
|
22
|
+
}>;
|
|
23
23
|
export declare const createEffectBffTestHandler: typeof createEffectBffEdgeHandler;
|
|
24
24
|
export declare function createEffectBffEdgeHandler(options: EffectBffEdgeHandlerOptions): Promise<{
|
|
25
25
|
handler: (request: Request, dispatchOptions?: Omit<EffectBffEdgeDispatchOptions, 'prefix' | 'onError'>) => Promise<Response>;
|
|
@@ -21,10 +21,10 @@ export type EffectEndpointMeta = {
|
|
|
21
21
|
export type HttpApiLike = {
|
|
22
22
|
identifier?: unknown;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type HttpApiGroupLike = {
|
|
25
25
|
identifier?: unknown;
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
type HttpApiEndpointLike = {
|
|
28
28
|
name?: unknown;
|
|
29
29
|
method?: unknown;
|
|
30
30
|
path?: unknown;
|
|
@@ -39,8 +39,6 @@ export type HttpApiReflect = (api: unknown, handlers: {
|
|
|
39
39
|
}) => void;
|
|
40
40
|
export declare function ensureLeadingSlash(pathname: string): string;
|
|
41
41
|
export declare function normalizeEffectPrefix(prefix: string): string;
|
|
42
|
-
export declare function getEffectRoutePath(prefix: string, endpointPath: string): string;
|
|
43
|
-
export declare function resolveEffectApiId(api: HttpApiLike): string;
|
|
44
42
|
export declare function collectEffectEndpoints(reflect: HttpApiReflect, api: HttpApiLike, prefix: string): EffectEndpointMeta[];
|
|
45
43
|
/**
|
|
46
44
|
* Maps reflected endpoints onto operation-contract sources for
|
|
@@ -48,11 +46,10 @@ export declare function collectEffectEndpoints(reflect: HttpApiReflect, api: Htt
|
|
|
48
46
|
* carry no zod metadata, so the contract hash covers the endpoint identity.
|
|
49
47
|
*/
|
|
50
48
|
export declare function toOperationContractSources(endpoints: EffectEndpointMeta[]): OperationContractSource[];
|
|
51
|
-
export declare function createEffectOperationContractSource(endpoint: EffectEndpointMeta): OperationContractSource;
|
|
52
49
|
/**
|
|
53
50
|
* Extracts the HttpApi instance from a loaded effect entry module. Mirrors
|
|
54
|
-
* the
|
|
55
|
-
*
|
|
51
|
+
* the shared entry-shape policy accepted by `resolveEffectBffModuleHandler`,
|
|
52
|
+
* without executing factories during contract extraction.
|
|
56
53
|
*/
|
|
57
54
|
export declare function extractHttpApiFromModule(mod: unknown, isHttpApi: (value: unknown) => boolean): Promise<HttpApiLike | null>;
|
|
58
55
|
/**
|
|
@@ -60,3 +57,4 @@ export declare function extractHttpApiFromModule(mod: unknown, isHttpApi: (value
|
|
|
60
57
|
* contract map (it is the same bff-core hash over the same inputs).
|
|
61
58
|
*/
|
|
62
59
|
export declare function createEffectEndpointContractHash(endpoint: EffectEndpointMeta, requestId: string): string;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type EffectBffEntryModule = {
|
|
2
|
+
api?: unknown;
|
|
3
|
+
layer?: unknown;
|
|
4
|
+
handler?: unknown;
|
|
5
|
+
createHandler?: unknown;
|
|
6
|
+
default?: unknown;
|
|
7
|
+
};
|
|
8
|
+
type LegacyEffectBffEntryShape = '`handler` export' | 'default request handler';
|
|
9
|
+
export type EffectBffEntryShapeFacts = {
|
|
10
|
+
module: EffectBffEntryModule;
|
|
11
|
+
legacyShape?: LegacyEffectBffEntryShape;
|
|
12
|
+
createHandler?: unknown;
|
|
13
|
+
createHandlerValidatorAware: boolean;
|
|
14
|
+
api?: unknown;
|
|
15
|
+
layer?: unknown;
|
|
16
|
+
hasRuntimeLayer: boolean;
|
|
17
|
+
};
|
|
18
|
+
type EffectBffEntryShapePredicates = {
|
|
19
|
+
isRequestHandler: (value: unknown) => boolean;
|
|
20
|
+
isValidatorAwareHandlerFactory: (value: unknown) => boolean;
|
|
21
|
+
isHttpApi: (value: unknown) => boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const EFFECT_VALIDATOR_AWARE_FACTORY: symbol;
|
|
24
|
+
/**
|
|
25
|
+
* True when a custom createHandler factory is produced by defineEffectBff and
|
|
26
|
+
* therefore forwards strict cross-project validation into createHttpApiHandler.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isValidatorAwareHandlerFactory(factory: unknown): boolean;
|
|
29
|
+
export declare 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.";
|
|
30
|
+
export declare function classifyEffectBffEntryModule(value: unknown, predicates: EffectBffEntryShapePredicates): EffectBffEntryShapeFacts | null;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EffectDataPlatformValidationOptions } from './types';
|
|
2
|
+
type DataPlatformBatchItemHandler<TContext> = (request: Request, context?: TContext) => Promise<unknown>;
|
|
3
|
+
export declare function createDataPlatformBatchRequestHandler<TContext>(options: {
|
|
4
|
+
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
5
|
+
handleItem: DataPlatformBatchItemHandler<TContext>;
|
|
6
|
+
}): {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
path: `/${string}`;
|
|
9
|
+
handle: (request: Request, context?: TContext) => Promise<Response>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DataBatchRequestPayload, type DataBatchResponseItem } from '../../data-platform';
|
|
2
|
+
export declare function normalizeBatchPath(pathname: string | undefined): `/${string}`;
|
|
3
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
export declare function toTextLength(value: string): number;
|
|
5
|
+
export declare function toHeaderRecord(headers: Headers): Record<string, string>;
|
|
6
|
+
export declare function normalizeItemMethod(method: string | undefined): string;
|
|
7
|
+
export declare function normalizeBatchAllowedMethods(allowedMethods: string[] | undefined): Set<string>;
|
|
8
|
+
type ParsedBatchRequestPayload = Omit<DataBatchRequestPayload, 'items'> & {
|
|
9
|
+
items: unknown[];
|
|
10
|
+
};
|
|
11
|
+
export declare function isBatchRequestPayload(value: unknown): value is ParsedBatchRequestPayload;
|
|
12
|
+
export declare function createBatchValidationResponse(message: string, status?: number): Response;
|
|
13
|
+
export declare function prepareJsonRequestBody(request: Request): Promise<Request | Response>;
|
|
14
|
+
export declare function toBatchItemError(id: string, status: number, message: string): DataBatchResponseItem;
|
|
15
|
+
export declare function promiseWithTimeout<T>(effect: Promise<T>, timeoutMs: number): Promise<T>;
|
|
16
|
+
export declare function mapWithConcurrency<TItem, TResult>(items: readonly TItem[], concurrency: number, mapper: (item: TItem, index: number) => Promise<TResult>): Promise<TResult[]>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HttpApi } from 'effect/unstable/httpapi';
|
|
2
|
+
import type { Rpc } from 'effect/unstable/rpc';
|
|
3
|
+
import type { EffectBffRuntime, EffectDataPlatformValidationOptions, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcRuntimeLayer, EffectRuntimeLayer } from './types';
|
|
4
|
+
export declare function defineEffectBff<TApi extends HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any>(definition: {
|
|
5
|
+
api: TApi;
|
|
6
|
+
layer: TLayer;
|
|
7
|
+
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
8
|
+
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
9
|
+
}): {
|
|
10
|
+
api: TApi;
|
|
11
|
+
layer: TLayer;
|
|
12
|
+
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
13
|
+
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
14
|
+
} & EffectBffRuntime<TApi, TLayer>;
|
|
15
|
+
export declare function defineEffectRpcBff<TRpcs extends Rpc.Any = Rpc.Any, TLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>>(definition: EffectRpcBffDefinition<TRpcs, TLayer>): EffectRpcBffDefinition<TRpcs, TLayer> & {
|
|
16
|
+
createHandler: EffectRpcBffHandlerFactory<TRpcs>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EffectDataPlatformValidationOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the `x-modernjs-data-envelope` header (the data-platform
|
|
4
|
+
* transport/cache contract: protocol version, scope, selection plan).
|
|
5
|
+
*
|
|
6
|
+
* This is NOT a security boundary: the envelope is client-constructed cache
|
|
7
|
+
* metadata used for batching, scope keys and hydration. Cross-project
|
|
8
|
+
* authorization runs through the bff-core policy evaluator wired in via
|
|
9
|
+
* `validateRequest` (see `EffectRequestValidator`), which both the direct
|
|
10
|
+
* and batched request paths hit before this check.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateDataPlatformRequestEnvelope(request: Request, options: EffectDataPlatformValidationOptions | undefined): Response | null;
|
|
13
|
+
export declare function mergeDataPlatformOptions(base: EffectDataPlatformValidationOptions | undefined, override: Partial<EffectDataPlatformValidationOptions> | undefined): EffectDataPlatformValidationOptions | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HttpApi } from 'effect/unstable/httpapi';
|
|
2
|
+
import type { Rpc } from 'effect/unstable/rpc';
|
|
3
|
+
import type { EffectBffOpenApiConfig, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRuntimeLayer } from './types';
|
|
4
|
+
export declare function createHttpApiHandler<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TRpcs extends Rpc.Any = Rpc.Any>(options: {
|
|
5
|
+
api: TApi;
|
|
6
|
+
layer: EffectRuntimeLayer;
|
|
7
|
+
openapi?: EffectBffOpenApiConfig;
|
|
8
|
+
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
9
|
+
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
10
|
+
validateRequest?: EffectRequestValidator;
|
|
11
|
+
}): {
|
|
12
|
+
handler: (request: Request, context?: Parameters<(request: globalThis.Request, context: import("effect/Context").Context<unknown>) => Promise<Response>>[1]) => Promise<Response>;
|
|
13
|
+
dispose: () => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HttpRouter } from 'effect/unstable/http';
|
|
2
|
+
import { type HttpApi } from 'effect/unstable/httpapi';
|
|
3
|
+
import type { EffectBffOpenApiConfig } from './types';
|
|
4
|
+
export declare function createOpenApiLayer(api: HttpApi.AnyWithProps, openapi: EffectBffOpenApiConfig | undefined): import("effect/Layer").Layer<never, never, HttpRouter.HttpRouter> | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getRequestPathname(request: Request): string;
|
|
2
|
+
export declare function getMountedPrefixFromContext(request: Request, context: unknown): string;
|
|
3
|
+
export declare function removeMountedPrefixFromBatchPath(pathWithQuery: string, prefix: string): string;
|
|
4
|
+
export declare function getExpectedEnvelopeOrigin(request: Request): string;
|
|
5
|
+
export declare function isRpcRequest(request: Request, rpcPath: `/${string}`): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Rpc } from 'effect/unstable/rpc';
|
|
2
|
+
import type { EffectRpcBffDefinition } from './types';
|
|
3
|
+
export declare function normalizeRpcPath(pathname: string | undefined): `/${string}`;
|
|
4
|
+
export declare function createRpcApiHandler<TRpcs extends Rpc.Any = Rpc.Any>(options: EffectRpcBffDefinition<TRpcs>): {
|
|
5
|
+
readonly handler: (request: globalThis.Request, context?: import("effect/Context").Context<never> | undefined) => Promise<Response>;
|
|
6
|
+
readonly dispose: () => Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { FileSystem, Path } from 'effect';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import type * as EffectType from 'effect/Effect';
|
|
4
|
+
import type * as Layer from 'effect/Layer';
|
|
5
|
+
import type { Etag, HttpPlatform, HttpRouter } from 'effect/unstable/http';
|
|
6
|
+
import type { HttpApi, HttpApiClient, HttpApiGroup } from 'effect/unstable/httpapi';
|
|
7
|
+
import type { Rpc, RpcGroup } from 'effect/unstable/rpc';
|
|
8
|
+
import type { createHttpApiHandler } from './http';
|
|
9
|
+
import type { createRpcApiHandler } from './rpc';
|
|
10
|
+
export type EffectRuntimeRequirements = Etag.Generator | FileSystem.FileSystem | HttpPlatform.HttpPlatform | HttpRouter.HttpRouter | HttpRouter.Request<'Error', unknown> | HttpRouter.Request<'GlobalError', unknown> | HttpRouter.Request<'GlobalRequires', unknown> | HttpRouter.Request<'Requires', unknown> | Path.Path;
|
|
11
|
+
export type EffectRuntimeLayer = Layer.Layer<never, never, EffectRuntimeRequirements>;
|
|
12
|
+
export declare const toEffectServiceContext: (context: unknown) => Context.Context<any>;
|
|
13
|
+
export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc' | 'msgPack';
|
|
14
|
+
export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
|
|
15
|
+
export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
|
|
16
|
+
group: RpcGroup.RpcGroup<TRpcs>;
|
|
17
|
+
layer: TRpcLayer;
|
|
18
|
+
path?: `/${string}`;
|
|
19
|
+
serialization?: EffectRpcSerialization;
|
|
20
|
+
disableTracing?: boolean;
|
|
21
|
+
spanPrefix?: string;
|
|
22
|
+
spanAttributes?: Record<string, unknown>;
|
|
23
|
+
disableFatalDefects?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type EffectRpcBffHandlerOptions = Pick<EffectRpcBffDefinition, 'path' | 'serialization' | 'disableTracing' | 'spanPrefix' | 'spanAttributes' | 'disableFatalDefects'>;
|
|
26
|
+
type EffectApiPromiseClient<TClient> = {
|
|
27
|
+
[GroupName in keyof TClient]: {
|
|
28
|
+
[EndpointName in keyof TClient[GroupName]]: TClient[GroupName][EndpointName] extends (...args: infer TArgs) => infer TResult ? TResult extends EffectType.Effect<unknown, unknown, unknown> ? (...args: TArgs) => Promise<Exclude<EffectType.Success<TResult>, readonly [unknown, unknown]>> : never : never;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type EffectApiClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = TApi extends HttpApi.HttpApi<infer _ApiId, infer Groups> ? HttpApiClient.Client<Extract<Groups, HttpApiGroup.Any>, never, never> : never;
|
|
32
|
+
export type EffectApiPromiseClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = EffectApiPromiseClient<EffectApiClientFromApi<TApi>>;
|
|
33
|
+
export type EffectBffDefinition<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any> = {
|
|
34
|
+
api: TApi;
|
|
35
|
+
layer: TLayer;
|
|
36
|
+
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
37
|
+
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
38
|
+
};
|
|
39
|
+
export type EffectDataPlatformSelectionValidationOptions = {
|
|
40
|
+
maxDepth?: number;
|
|
41
|
+
maxFields?: number;
|
|
42
|
+
allowedLeafPaths?: string[];
|
|
43
|
+
};
|
|
44
|
+
export type EffectDataPlatformBatchOptions = {
|
|
45
|
+
/**
|
|
46
|
+
* Enable network batching endpoint for Effect HttpApi requests.
|
|
47
|
+
* Defaults to `true`.
|
|
48
|
+
*/
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Batch endpoint path mounted under BFF prefix.
|
|
52
|
+
* Defaults to `/_data/batch`.
|
|
53
|
+
*/
|
|
54
|
+
endpoint?: `/${string}`;
|
|
55
|
+
/**
|
|
56
|
+
* Maximum request items accepted per batch call.
|
|
57
|
+
* Defaults to `16`.
|
|
58
|
+
*/
|
|
59
|
+
maxBatchSize?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Maximum serialized request payload size in bytes.
|
|
62
|
+
* Defaults to `65536` (64KiB).
|
|
63
|
+
*/
|
|
64
|
+
maxBatchBytes?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Client-side micro-batch flush window in milliseconds.
|
|
67
|
+
* Server runtime ignores this value and passes it through for codegen.
|
|
68
|
+
* Defaults to `8`.
|
|
69
|
+
*/
|
|
70
|
+
flushIntervalMs?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Maximum per-batch internal request concurrency.
|
|
73
|
+
* Defaults to `4`.
|
|
74
|
+
*/
|
|
75
|
+
maxConcurrency?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Optional timeout per internal request in milliseconds.
|
|
78
|
+
* Defaults to `10000`.
|
|
79
|
+
*/
|
|
80
|
+
requestTimeoutMs?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Allowed HTTP methods for internal batched dispatch.
|
|
83
|
+
* Defaults to `['GET']`.
|
|
84
|
+
*/
|
|
85
|
+
allowedMethods?: string[];
|
|
86
|
+
};
|
|
87
|
+
export type EffectDataPlatformValidationOptions = {
|
|
88
|
+
/**
|
|
89
|
+
* Enable envelope validation for HttpApi requests.
|
|
90
|
+
* Defaults to `true`.
|
|
91
|
+
*/
|
|
92
|
+
enabled?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Require every HttpApi request to include an envelope header.
|
|
95
|
+
* Defaults to `false`.
|
|
96
|
+
*/
|
|
97
|
+
requireEnvelope?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Header name used by client/server for the serialized request envelope.
|
|
100
|
+
* Defaults to `x-modernjs-data-envelope`.
|
|
101
|
+
*/
|
|
102
|
+
envelopeHeader?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Optional namespace assertion for envelope validation.
|
|
105
|
+
*/
|
|
106
|
+
expectedNamespace?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Validate envelope origin against incoming request origin.
|
|
109
|
+
* Defaults to `true`.
|
|
110
|
+
*/
|
|
111
|
+
validateOrigin?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Require trace context inside request envelope.
|
|
114
|
+
* Defaults to `false`.
|
|
115
|
+
*/
|
|
116
|
+
requireTraceContext?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Selection plan guardrails for server-side validation.
|
|
119
|
+
*/
|
|
120
|
+
selection?: EffectDataPlatformSelectionValidationOptions;
|
|
121
|
+
/**
|
|
122
|
+
* Network batching gateway configuration.
|
|
123
|
+
*/
|
|
124
|
+
batch?: EffectDataPlatformBatchOptions;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Server-seam request validator applied to every HttpApi request — direct,
|
|
128
|
+
* batched (per item) and rpc. Returning a Response short-circuits the
|
|
129
|
+
* request; returning `null`/`undefined` lets it through. Used by the effect
|
|
130
|
+
* adapter to enforce the cross-project policy at one seam so batched items
|
|
131
|
+
* cannot bypass it.
|
|
132
|
+
*/
|
|
133
|
+
export type EffectRequestValidator = (request: Request) => Response | null | undefined;
|
|
134
|
+
export type EffectBffHandlerFactory<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
|
|
135
|
+
openapi?: EffectBffOpenApiConfig;
|
|
136
|
+
rpc?: Partial<EffectRpcBffHandlerOptions>;
|
|
137
|
+
dataPlatform?: Partial<EffectDataPlatformValidationOptions>;
|
|
138
|
+
validateRequest?: EffectRequestValidator;
|
|
139
|
+
}) => ReturnType<typeof createHttpApiHandler>;
|
|
140
|
+
export type EffectBffRuntime<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = {
|
|
141
|
+
createHandler: EffectBffHandlerFactory<TApi, TLayer>;
|
|
142
|
+
client: EffectApiPromiseClientFromApi<TApi>;
|
|
143
|
+
};
|
|
144
|
+
export type EffectBffOpenApiConfig = boolean | {
|
|
145
|
+
path?: string;
|
|
146
|
+
};
|
|
147
|
+
export type EffectRpcBffHandlerFactory<TRpcs extends Rpc.Any = Rpc.Any> = (options?: Partial<EffectRpcBffHandlerOptions>) => ReturnType<typeof createRpcApiHandler<TRpcs>>;
|
|
148
|
+
export {};
|