@bleedingdev/modern-js-plugin-bff 3.5.0-ultramodern.30 → 3.5.0-ultramodern.32
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 +149 -0
- package/dist/cjs/cli/prefix.js +50 -0
- package/dist/cjs/cli/watch.js +51 -0
- package/dist/cjs/cli.js +11 -130
- package/dist/cjs/runtime/data-platform/batch/queue.js +287 -0
- package/dist/cjs/runtime/data-platform/batch/request.js +98 -0
- package/dist/cjs/runtime/data-platform/batch/response.js +67 -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 +77 -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 +12 -115
- package/dist/cjs/runtime/effect/backend-federation/entry.js +99 -0
- package/dist/cjs/runtime/effect/backend-federation/load.js +57 -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 +74 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/metadata.js +101 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest/reference.js +117 -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 +108 -0
- package/dist/cjs/runtime/effect/backend-federation-manifest.js +32 -257
- package/dist/cjs/runtime/effect/backend-federation.js +11 -139
- 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 +35 -526
- 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 +64 -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 +84 -0
- package/dist/cjs/utils/effect-client-generator/types.js +18 -0
- package/dist/cjs/utils/effectClientGenerator.js +5 -262
- package/dist/esm/cli/compress.mjs +14 -0
- package/dist/esm/cli/generator.mjs +98 -0
- package/dist/esm/cli/prefix.mjs +9 -0
- package/dist/esm/cli/watch.mjs +13 -0
- package/dist/esm/cli.mjs +7 -121
- 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 +29 -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 +12 -105
- package/dist/esm/runtime/effect/backend-federation/entry.mjs +61 -0
- package/dist/esm/runtime/effect/backend-federation/load.mjs +19 -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 +36 -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 +64 -0
- package/dist/esm/runtime/effect/backend-federation-manifest.mjs +1 -237
- package/dist/esm/runtime/effect/backend-federation.mjs +4 -132
- 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 +7 -499
- 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 +5 -15
- 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 +23 -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 +33 -0
- package/dist/esm/utils/effect-client-generator/types.mjs +0 -0
- package/dist/esm/utils/effectClientGenerator.mjs +1 -249
- package/dist/esm-node/cli/compress.mjs +15 -0
- package/dist/esm-node/cli/generator.mjs +99 -0
- package/dist/esm-node/cli/prefix.mjs +10 -0
- package/dist/esm-node/cli/watch.mjs +14 -0
- package/dist/esm-node/cli.mjs +7 -121
- 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 +30 -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 +12 -105
- package/dist/esm-node/runtime/effect/backend-federation/entry.mjs +62 -0
- package/dist/esm-node/runtime/effect/backend-federation/load.mjs +20 -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 +37 -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 +65 -0
- package/dist/esm-node/runtime/effect/backend-federation-manifest.mjs +1 -237
- package/dist/esm-node/runtime/effect/backend-federation.mjs +4 -132
- 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 +7 -499
- 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 +5 -15
- 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 +24 -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 +35 -0
- package/dist/esm-node/utils/effect-client-generator/types.mjs +1 -0
- package/dist/esm-node/utils/effectClientGenerator.mjs +2 -251
- 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/watch.d.ts +1 -0
- package/dist/types/cli.d.ts +0 -1
- package/dist/types/runtime/data-platform/batch/queue.d.ts +25 -0
- package/dist/types/runtime/data-platform/batch/request.d.ts +13 -0
- package/dist/types/runtime/data-platform/batch/response.d.ts +4 -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 +4 -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/load.d.ts +2 -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 +58 -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 +3 -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 -60
- package/dist/types/runtime/effect/backend-federation.d.ts +6 -60
- 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 +3 -173
- 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/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 +8 -0
- package/dist/types/utils/effect-client-generator/types.d.ts +26 -0
- package/dist/types/utils/effectClientGenerator.d.ts +2 -41
- package/package.json +13 -13
|
@@ -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 {};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import type { FileSystem, Path } from 'effect';
|
|
2
|
-
import * as Context from 'effect/Context';
|
|
3
|
-
import type * as EffectType from 'effect/Effect';
|
|
4
|
-
import * as Layer from 'effect/Layer';
|
|
5
|
-
import { Etag, HttpPlatform, HttpRouter } from 'effect/unstable/http';
|
|
6
|
-
import { type HttpApi, type HttpApiClient, type HttpApiGroup } from 'effect/unstable/httpapi';
|
|
7
|
-
import { type Rpc, type RpcGroup } from 'effect/unstable/rpc';
|
|
8
1
|
export * as Config from 'effect/Config';
|
|
9
2
|
export * as Effect from 'effect/Effect';
|
|
10
3
|
export * as Layer from 'effect/Layer';
|
|
@@ -16,169 +9,6 @@ export * from 'effect/unstable/httpapi';
|
|
|
16
9
|
export { HttpApiBuilder } from 'effect/unstable/httpapi';
|
|
17
10
|
export * from 'effect/unstable/rpc';
|
|
18
11
|
export { EFFECT_VALIDATOR_AWARE_FACTORY, isValidatorAwareHandlerFactory, } from './entry-shape';
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export type
|
|
22
|
-
export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
|
|
23
|
-
export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
|
|
24
|
-
group: RpcGroup.RpcGroup<TRpcs>;
|
|
25
|
-
layer: TRpcLayer;
|
|
26
|
-
path?: `/${string}`;
|
|
27
|
-
serialization?: EffectRpcSerialization;
|
|
28
|
-
disableTracing?: boolean;
|
|
29
|
-
spanPrefix?: string;
|
|
30
|
-
spanAttributes?: Record<string, unknown>;
|
|
31
|
-
disableFatalDefects?: boolean;
|
|
32
|
-
};
|
|
33
|
-
export type EffectRpcBffHandlerOptions = Pick<EffectRpcBffDefinition, 'path' | 'serialization' | 'disableTracing' | 'spanPrefix' | 'spanAttributes' | 'disableFatalDefects'>;
|
|
34
|
-
type EffectApiPromiseClient<TClient> = {
|
|
35
|
-
[GroupName in keyof TClient]: {
|
|
36
|
-
[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;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
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;
|
|
40
|
-
export type EffectApiPromiseClientFromApi<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps> = EffectApiPromiseClient<EffectApiClientFromApi<TApi>>;
|
|
41
|
-
export type EffectBffDefinition<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any> = {
|
|
42
|
-
api: TApi;
|
|
43
|
-
layer: TLayer;
|
|
44
|
-
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
45
|
-
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
46
|
-
};
|
|
47
|
-
export type EffectDataPlatformSelectionValidationOptions = {
|
|
48
|
-
maxDepth?: number;
|
|
49
|
-
maxFields?: number;
|
|
50
|
-
allowedLeafPaths?: string[];
|
|
51
|
-
};
|
|
52
|
-
export type EffectDataPlatformBatchOptions = {
|
|
53
|
-
/**
|
|
54
|
-
* Enable network batching endpoint for Effect HttpApi requests.
|
|
55
|
-
* Defaults to `true`.
|
|
56
|
-
*/
|
|
57
|
-
enabled?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Batch endpoint path mounted under BFF prefix.
|
|
60
|
-
* Defaults to `/_data/batch`.
|
|
61
|
-
*/
|
|
62
|
-
endpoint?: `/${string}`;
|
|
63
|
-
/**
|
|
64
|
-
* Maximum request items accepted per batch call.
|
|
65
|
-
* Defaults to `16`.
|
|
66
|
-
*/
|
|
67
|
-
maxBatchSize?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Maximum serialized request payload size in bytes.
|
|
70
|
-
* Defaults to `65536` (64KiB).
|
|
71
|
-
*/
|
|
72
|
-
maxBatchBytes?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Client-side micro-batch flush window in milliseconds.
|
|
75
|
-
* Server runtime ignores this value and passes it through for codegen.
|
|
76
|
-
* Defaults to `8`.
|
|
77
|
-
*/
|
|
78
|
-
flushIntervalMs?: number;
|
|
79
|
-
/**
|
|
80
|
-
* Maximum per-batch internal request concurrency.
|
|
81
|
-
* Defaults to `4`.
|
|
82
|
-
*/
|
|
83
|
-
maxConcurrency?: number;
|
|
84
|
-
/**
|
|
85
|
-
* Optional timeout per internal request in milliseconds.
|
|
86
|
-
* Defaults to `10000`.
|
|
87
|
-
*/
|
|
88
|
-
requestTimeoutMs?: number;
|
|
89
|
-
/**
|
|
90
|
-
* Allowed HTTP methods for internal batched dispatch.
|
|
91
|
-
* Defaults to `['GET']`.
|
|
92
|
-
*/
|
|
93
|
-
allowedMethods?: string[];
|
|
94
|
-
};
|
|
95
|
-
export type EffectDataPlatformValidationOptions = {
|
|
96
|
-
/**
|
|
97
|
-
* Enable envelope validation for HttpApi requests.
|
|
98
|
-
* Defaults to `true`.
|
|
99
|
-
*/
|
|
100
|
-
enabled?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Require every HttpApi request to include an envelope header.
|
|
103
|
-
* Defaults to `false`.
|
|
104
|
-
*/
|
|
105
|
-
requireEnvelope?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Header name used by client/server for the serialized request envelope.
|
|
108
|
-
* Defaults to `x-modernjs-data-envelope`.
|
|
109
|
-
*/
|
|
110
|
-
envelopeHeader?: string;
|
|
111
|
-
/**
|
|
112
|
-
* Optional namespace assertion for envelope validation.
|
|
113
|
-
*/
|
|
114
|
-
expectedNamespace?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Validate envelope origin against incoming request origin.
|
|
117
|
-
* Defaults to `true`.
|
|
118
|
-
*/
|
|
119
|
-
validateOrigin?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Require trace context inside request envelope.
|
|
122
|
-
* Defaults to `false`.
|
|
123
|
-
*/
|
|
124
|
-
requireTraceContext?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Selection plan guardrails for server-side validation.
|
|
127
|
-
*/
|
|
128
|
-
selection?: EffectDataPlatformSelectionValidationOptions;
|
|
129
|
-
/**
|
|
130
|
-
* Network batching gateway configuration.
|
|
131
|
-
*/
|
|
132
|
-
batch?: EffectDataPlatformBatchOptions;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Server-seam request validator applied to every HttpApi request — direct,
|
|
136
|
-
* batched (per item) and rpc. Returning a Response short-circuits the
|
|
137
|
-
* request; returning `null`/`undefined` lets it through. Used by the effect
|
|
138
|
-
* adapter to enforce the cross-project policy at one seam so batched items
|
|
139
|
-
* cannot bypass it.
|
|
140
|
-
*/
|
|
141
|
-
export type EffectRequestValidator = (request: Request) => Response | null | undefined;
|
|
142
|
-
export type EffectBffHandlerFactory<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
|
|
143
|
-
openapi?: EffectBffOpenApiConfig;
|
|
144
|
-
rpc?: Partial<EffectRpcBffHandlerOptions>;
|
|
145
|
-
dataPlatform?: Partial<EffectDataPlatformValidationOptions>;
|
|
146
|
-
validateRequest?: EffectRequestValidator;
|
|
147
|
-
}) => ReturnType<typeof createHttpApiHandler>;
|
|
148
|
-
export type EffectBffRuntime<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = {
|
|
149
|
-
createHandler: EffectBffHandlerFactory<TApi, TLayer>;
|
|
150
|
-
client: EffectApiPromiseClientFromApi<TApi>;
|
|
151
|
-
};
|
|
152
|
-
export type EffectBffOpenApiConfig = boolean | {
|
|
153
|
-
path?: string;
|
|
154
|
-
};
|
|
155
|
-
export type EffectRpcBffHandlerFactory<TRpcs extends Rpc.Any = Rpc.Any> = (options?: Partial<EffectRpcBffHandlerOptions>) => ReturnType<typeof createRpcApiHandler<TRpcs>>;
|
|
156
|
-
declare function createRpcApiHandler<TRpcs extends Rpc.Any = Rpc.Any>(options: EffectRpcBffDefinition<TRpcs>): {
|
|
157
|
-
readonly handler: (request: globalThis.Request, context?: Context.Context<never> | undefined) => Promise<Response>;
|
|
158
|
-
readonly dispose: () => Promise<void>;
|
|
159
|
-
};
|
|
160
|
-
export declare function defineEffectBff<TApi extends HttpApi.AnyWithProps, TLayer extends EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any>(definition: {
|
|
161
|
-
api: TApi;
|
|
162
|
-
layer: TLayer;
|
|
163
|
-
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
164
|
-
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
165
|
-
}): {
|
|
166
|
-
api: TApi;
|
|
167
|
-
layer: TLayer;
|
|
168
|
-
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
169
|
-
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
170
|
-
} & EffectBffRuntime<TApi, TLayer>;
|
|
171
|
-
export declare function defineEffectRpcBff<TRpcs extends Rpc.Any = Rpc.Any, TLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>>(definition: EffectRpcBffDefinition<TRpcs, TLayer>): EffectRpcBffDefinition<TRpcs, TLayer> & {
|
|
172
|
-
createHandler: EffectRpcBffHandlerFactory<TRpcs>;
|
|
173
|
-
};
|
|
174
|
-
export declare function createHttpApiHandler<TApi extends HttpApi.AnyWithProps = HttpApi.AnyWithProps, TRpcs extends Rpc.Any = Rpc.Any>(options: {
|
|
175
|
-
api: TApi;
|
|
176
|
-
layer: EffectRuntimeLayer;
|
|
177
|
-
openapi?: EffectBffOpenApiConfig;
|
|
178
|
-
rpc?: EffectRpcBffDefinition<TRpcs>;
|
|
179
|
-
dataPlatform?: EffectDataPlatformValidationOptions;
|
|
180
|
-
validateRequest?: EffectRequestValidator;
|
|
181
|
-
}): {
|
|
182
|
-
handler: (request: Request, context?: Parameters<(request: globalThis.Request, context: Context.Context<unknown>) => Promise<Response>>[1]) => Promise<Response>;
|
|
183
|
-
dispose: () => Promise<void>;
|
|
184
|
-
};
|
|
12
|
+
export { defineEffectBff, defineEffectRpcBff } from './handler/definition';
|
|
13
|
+
export { createHttpApiHandler } from './handler/http';
|
|
14
|
+
export type { EffectApiClientFromApi, EffectApiPromiseClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler/types';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RpcSerialization } from 'effect/unstable/rpc';
|
|
2
|
+
import type { EffectRpcSerialization } from './handler/types';
|
|
3
|
+
export declare function getRpcSerializationLayer(serialization: EffectRpcSerialization | undefined): import("effect/Layer").Layer<RpcSerialization.RpcSerialization, never, never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EffectOperationDescriptor, EffectRequestContext, EffectRequestContextInput, GeneratedEffectClientConfig, GeneratedEffectEndpoint } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the current page origin with a configurable fallback. Single
|
|
4
|
+
* implementation shared by the configure() bootstrap and the data envelope
|
|
5
|
+
* (the generated template previously duplicated data-platform's
|
|
6
|
+
* `resolveRuntimeOrigin` with a different fallback).
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveOrigin: (defaultOrigin: string) => string;
|
|
9
|
+
export declare const prepareEffectRequest: (options: {
|
|
10
|
+
endpoint: GeneratedEffectEndpoint;
|
|
11
|
+
operation: EffectOperationDescriptor;
|
|
12
|
+
request: unknown;
|
|
13
|
+
config: GeneratedEffectClientConfig;
|
|
14
|
+
createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
|
|
15
|
+
}) => Record<string, unknown>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EffectRequestContext, EffectRequestContextInput, EffectRequestRuntime } from './types';
|
|
2
|
+
export declare const createEffectRequestContext: (createRequestContextHeaders: EffectRequestRuntime['createRequestContextHeaders'], requestContext: EffectRequestContextInput) => EffectRequestContext;
|
|
3
|
+
export declare const applyRequestContext: (normalizedRequest: Record<string, unknown>, request: unknown, createRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext) => Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeRequest: (method: string, request: unknown) => Record<string, unknown>;
|
|
@@ -1,71 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
group: string;
|
|
4
|
-
endpoint: string;
|
|
5
|
-
method: string;
|
|
6
|
-
routePath: string;
|
|
7
|
-
/** Per-endpoint operation contract hash (bff-core hash). */
|
|
8
|
-
schemaHash: string;
|
|
9
|
-
operationVersion: number;
|
|
10
|
-
};
|
|
11
|
-
export type GeneratedEffectBatchConfig = {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
endpoint: string;
|
|
14
|
-
flushIntervalMs: number;
|
|
15
|
-
maxBatchSize: number;
|
|
16
|
-
maxBatchBytes: number;
|
|
17
|
-
requestTimeoutMs: number;
|
|
18
|
-
allowedMethods: string[];
|
|
19
|
-
};
|
|
20
|
-
export type GeneratedEffectClientConfig = {
|
|
21
|
-
appNamespace: string;
|
|
22
|
-
/** Cross-project producer id; absent for same-project clients. */
|
|
23
|
-
requestId?: string;
|
|
24
|
-
port: number;
|
|
25
|
-
/** Resolve the port from process.env.PORT first (server bundles). */
|
|
26
|
-
useEnvPort?: boolean;
|
|
27
|
-
defaultOrigin: string;
|
|
28
|
-
httpMethodDecider?: string;
|
|
29
|
-
batch: GeneratedEffectBatchConfig;
|
|
30
|
-
};
|
|
31
|
-
export type EffectOperationDescriptor = {
|
|
32
|
-
appNamespace: string;
|
|
33
|
-
apiId: string;
|
|
34
|
-
group: string;
|
|
35
|
-
endpoint: string;
|
|
36
|
-
operationId: string;
|
|
37
|
-
routePath: string;
|
|
38
|
-
method: string;
|
|
39
|
-
operationVersion: number;
|
|
40
|
-
schemaHash: string;
|
|
41
|
-
version: number;
|
|
42
|
-
};
|
|
43
|
-
export type EffectClientOperation = (request?: unknown) => Promise<unknown>;
|
|
44
|
-
export type EffectClientGroup = Record<string, EffectClientOperation>;
|
|
45
|
-
export type EffectClient = Record<string, EffectClientGroup>;
|
|
46
|
-
export type EffectOperationManifest = Record<string, Record<string, EffectOperationDescriptor>>;
|
|
47
|
-
export type EffectRequestContextInput = Record<string, unknown>;
|
|
48
|
-
export type EffectRequestContext = {
|
|
49
|
-
headers: Record<string, string>;
|
|
50
|
-
} & Record<string, unknown>;
|
|
51
|
-
/** Structural slice of `@modern-js/create-request` the runtime relies on. */
|
|
52
|
-
export type EffectRequestRuntime = {
|
|
53
|
-
createRequest: (options: {
|
|
54
|
-
path: string;
|
|
55
|
-
method: string;
|
|
56
|
-
port: number | string;
|
|
57
|
-
operationContext: Record<string, unknown>;
|
|
58
|
-
httpMethodDecider: string;
|
|
59
|
-
requestId?: string;
|
|
60
|
-
}) => (...args: unknown[]) => Promise<unknown>;
|
|
61
|
-
configure?: (options: Record<string, unknown>) => void;
|
|
62
|
-
createRequestContextHeaders?: (input: EffectRequestContextInput) => Record<string, string>;
|
|
63
|
-
};
|
|
64
|
-
export type GeneratedEffectClientModule = {
|
|
65
|
-
client: EffectClient;
|
|
66
|
-
operationManifest: EffectOperationManifest;
|
|
67
|
-
createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
|
|
68
|
-
};
|
|
1
|
+
import type { EffectRequestRuntime, GeneratedEffectClientConfig, GeneratedEffectClientModule, GeneratedEffectEndpoint } from './types';
|
|
2
|
+
export type { EffectClient, EffectClientGroup, EffectClientOperation, EffectOperationDescriptor, EffectOperationManifest, EffectRequestContext, EffectRequestContextInput, EffectRequestRuntime, GeneratedEffectBatchConfig, GeneratedEffectClientConfig, GeneratedEffectClientModule, GeneratedEffectEndpoint, } from './types';
|
|
69
3
|
export declare const createGeneratedEffectClient: (manifest: {
|
|
70
4
|
endpoints: GeneratedEffectEndpoint[];
|
|
71
5
|
}, config: GeneratedEffectClientConfig, requestRuntime: EffectRequestRuntime) => GeneratedEffectClientModule;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type GeneratedEffectEndpoint = {
|
|
2
|
+
apiId: string;
|
|
3
|
+
group: string;
|
|
4
|
+
endpoint: string;
|
|
5
|
+
method: string;
|
|
6
|
+
routePath: string;
|
|
7
|
+
/** Per-endpoint operation contract hash (bff-core hash). */
|
|
8
|
+
schemaHash: string;
|
|
9
|
+
operationVersion: number;
|
|
10
|
+
};
|
|
11
|
+
export type GeneratedEffectBatchConfig = {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
endpoint: string;
|
|
14
|
+
flushIntervalMs: number;
|
|
15
|
+
maxBatchSize: number;
|
|
16
|
+
maxBatchBytes: number;
|
|
17
|
+
requestTimeoutMs: number;
|
|
18
|
+
allowedMethods: string[];
|
|
19
|
+
};
|
|
20
|
+
export type GeneratedEffectClientConfig = {
|
|
21
|
+
appNamespace: string;
|
|
22
|
+
/** Cross-project producer id; absent for same-project clients. */
|
|
23
|
+
requestId?: string;
|
|
24
|
+
port: number;
|
|
25
|
+
/** Resolve the port from process.env.PORT first (server bundles). */
|
|
26
|
+
useEnvPort?: boolean;
|
|
27
|
+
defaultOrigin: string;
|
|
28
|
+
httpMethodDecider?: string;
|
|
29
|
+
batch: GeneratedEffectBatchConfig;
|
|
30
|
+
};
|
|
31
|
+
export type EffectOperationDescriptor = {
|
|
32
|
+
appNamespace: string;
|
|
33
|
+
apiId: string;
|
|
34
|
+
group: string;
|
|
35
|
+
endpoint: string;
|
|
36
|
+
operationId: string;
|
|
37
|
+
routePath: string;
|
|
38
|
+
method: string;
|
|
39
|
+
operationVersion: number;
|
|
40
|
+
schemaHash: string;
|
|
41
|
+
version: number;
|
|
42
|
+
};
|
|
43
|
+
export type EffectClientOperation = (request?: unknown) => Promise<unknown>;
|
|
44
|
+
export type EffectClientGroup = Record<string, EffectClientOperation>;
|
|
45
|
+
export type EffectClient = Record<string, EffectClientGroup>;
|
|
46
|
+
export type EffectOperationManifest = Record<string, Record<string, EffectOperationDescriptor>>;
|
|
47
|
+
export type EffectRequestContextInput = Record<string, unknown>;
|
|
48
|
+
export type EffectRequestContext = {
|
|
49
|
+
headers: Record<string, string>;
|
|
50
|
+
} & Record<string, unknown>;
|
|
51
|
+
/** Structural slice of `@modern-js/create-request` the runtime relies on. */
|
|
52
|
+
export type EffectRequestRuntime = {
|
|
53
|
+
createRequest: (options: {
|
|
54
|
+
path: string;
|
|
55
|
+
method: string;
|
|
56
|
+
port: number | string;
|
|
57
|
+
operationContext: Record<string, unknown>;
|
|
58
|
+
httpMethodDecider: string;
|
|
59
|
+
requestId?: string;
|
|
60
|
+
}) => (...args: unknown[]) => Promise<unknown>;
|
|
61
|
+
configure?: (options: Record<string, unknown>) => void;
|
|
62
|
+
createRequestContextHeaders?: (input: EffectRequestContextInput) => Record<string, string>;
|
|
63
|
+
};
|
|
64
|
+
export type GeneratedEffectClientModule = {
|
|
65
|
+
client: EffectClient;
|
|
66
|
+
operationManifest: EffectOperationManifest;
|
|
67
|
+
createEffectRequestContext: (requestContext: EffectRequestContextInput) => EffectRequestContext;
|
|
68
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface FileDetails {
|
|
2
|
+
resourcePath: string;
|
|
3
|
+
source: string;
|
|
4
|
+
targetDir: string;
|
|
5
|
+
name: string;
|
|
6
|
+
absTargetDir: string;
|
|
7
|
+
relativeTargetDistDir: string;
|
|
8
|
+
exportKey: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const API_DIR = "api";
|
|
11
|
+
export declare const PLUGIN_DIR = "plugin";
|
|
12
|
+
export declare const RUNTIME_DIR = "runtime";
|
|
13
|
+
export declare const CLIENT_DIR = "client";
|
|
14
|
+
export declare const EXPORT_PREFIX = "./api/";
|
|
15
|
+
export declare const TYPE_PREFIX = "api/";
|
|
16
|
+
export declare const GENERATED_RUNTIME_DIRS: string[];
|
|
17
|
+
export declare const toPosixPath: (p: string) => string;
|
|
18
|
+
export declare const posixJoin: (...args: string[]) => string;
|
|
19
|
+
export declare function createFileDetails(options: {
|
|
20
|
+
appDirectory: string;
|
|
21
|
+
baseDirectory: string;
|
|
22
|
+
resourcePath: string;
|
|
23
|
+
source: string;
|
|
24
|
+
relativeDistPath: string;
|
|
25
|
+
}): FileDetails;
|
|
26
|
+
export declare function readDirectoryFiles(appDirectory: string, directory: string, relativeDistPath: string): Promise<FileDetails[]>;
|
|
27
|
+
export declare function writeTargetFile(absTargetDir: string, content: string): Promise<void>;
|
|
28
|
+
export declare function copyFiles(from: string, to: string): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HttpMethodDecider } from '@modern-js/types';
|
|
2
|
+
export type APILoaderOptions = {
|
|
3
|
+
prefix: string;
|
|
4
|
+
appDir: string;
|
|
5
|
+
apiDir: string;
|
|
6
|
+
lambdaDir: string;
|
|
7
|
+
existLambda: boolean;
|
|
8
|
+
port?: number;
|
|
9
|
+
requestCreator?: string;
|
|
10
|
+
httpMethodDecider?: HttpMethodDecider;
|
|
11
|
+
relativeDistPath: string;
|
|
12
|
+
relativeApiPath: string;
|
|
13
|
+
bffRuntimeFramework?: 'hono' | 'effect';
|
|
14
|
+
effectEntry?: string;
|
|
15
|
+
effectDataPlatformBatch?: {
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
flushIntervalMs?: number;
|
|
19
|
+
maxBatchSize?: number;
|
|
20
|
+
maxBatchBytes?: number;
|
|
21
|
+
requestTimeoutMs?: number;
|
|
22
|
+
allowedMethods?: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function clientGenerator(draftOptions: APILoaderOptions): Promise<void>;
|
|
26
|
+
export default clientGenerator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { FileDetails } from './files';
|
|
2
|
+
export { copyFiles, createFileDetails, readDirectoryFiles, writeTargetFile, } from './files';
|
|
3
|
+
export type { APILoaderOptions } from './generate';
|
|
4
|
+
export { clientGenerator, default } from './generate';
|
|
5
|
+
export type { PackageJsonLike } from './package-json';
|
|
6
|
+
export { getClientPackageName, getPackageName, mergePackageJson, } from './package-json';
|
|
7
|
+
export { setPackage, writeClientModuleBoundary } from './write-package';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type PackageJsonLike = {
|
|
2
|
+
files?: string[];
|
|
3
|
+
typesVersions?: Record<string, Record<string, string[]>>;
|
|
4
|
+
exports?: Record<string, {
|
|
5
|
+
import?: string;
|
|
6
|
+
require?: string;
|
|
7
|
+
types?: string;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
export declare function getPackageName(appDirectory: string): string | undefined;
|
|
11
|
+
export declare function mergePackageJson(packageJson: PackageJsonLike, files: string[], typesVersion: Record<string, Record<string, string[]>>, exports: Record<string, {
|
|
12
|
+
import?: string;
|
|
13
|
+
require?: string;
|
|
14
|
+
types?: string;
|
|
15
|
+
}>, relativeDistPath: string): void;
|
|
16
|
+
export declare function getClientPackageName(appDirectory: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function writeClientModuleBoundary(appDirectory: string, relativeDistPath: string): Promise<void>;
|
|
2
|
+
export declare function setPackage(files: {
|
|
3
|
+
exportKey: string;
|
|
4
|
+
targetDir: string;
|
|
5
|
+
relativeTargetDistDir: string;
|
|
6
|
+
}[], appDirectory: string, relativeDistPath: string): Promise<void>;
|