@bleedingdev/modern-js-bff-effect 3.8.3-ultramodern.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/dist/cjs/data-platform/batch/protocol.js +130 -0
- package/dist/cjs/data-platform/batch/queue.js +623 -0
- package/dist/cjs/data-platform/batch/request.js +121 -0
- package/dist/cjs/data-platform/batch/response.js +65 -0
- package/dist/cjs/data-platform/batch/telemetry.js +71 -0
- package/dist/cjs/data-platform/batch/url.js +69 -0
- package/dist/cjs/data-platform/batch-transport.js +59 -0
- package/dist/cjs/data-platform/codec.js +155 -0
- package/dist/cjs/data-platform/index.js +124 -0
- package/dist/cjs/data-platform/invalidation.js +61 -0
- package/dist/cjs/data-platform/trace.js +73 -0
- package/dist/cjs/data-platform/types.js +48 -0
- package/dist/cjs/data-platform/validation.js +178 -0
- package/dist/cjs/effect/context.js +59 -0
- package/dist/cjs/effect/dispatch.js +101 -0
- package/dist/cjs/effect/edge-context.js +61 -0
- package/dist/cjs/effect/edge-dispatcher.js +354 -0
- package/dist/cjs/effect/edge.js +62 -0
- package/dist/cjs/effect/endpoint-contracts.js +121 -0
- package/dist/cjs/effect/entry-shape-registry.js +31 -0
- package/dist/cjs/effect/entry-shape.js +113 -0
- package/dist/cjs/effect/handler/batch-handler.js +270 -0
- package/dist/cjs/effect/handler/batch.js +170 -0
- package/dist/cjs/effect/handler/definition.js +99 -0
- package/dist/cjs/effect/handler/envelope.js +104 -0
- package/dist/cjs/effect/handler/http.js +107 -0
- package/dist/cjs/effect/handler/openapi.js +58 -0
- package/dist/cjs/effect/handler/routing.js +100 -0
- package/dist/cjs/effect/handler/rpc.js +63 -0
- package/dist/cjs/effect/handler/types.js +43 -0
- package/dist/cjs/effect/handler.js +173 -0
- package/dist/cjs/effect/index.js +137 -0
- package/dist/cjs/effect/module.js +118 -0
- package/dist/cjs/effect/operation-context.js +116 -0
- package/dist/cjs/effect/rpcSerialization.js +54 -0
- package/dist/cjs/effect-client/batch.js +73 -0
- package/dist/cjs/effect-client/envelope.js +145 -0
- package/dist/cjs/effect-client/guards.js +44 -0
- package/dist/cjs/effect-client/index.js +208 -0
- package/dist/cjs/effect-client/request-context.js +64 -0
- package/dist/cjs/effect-client/request.js +66 -0
- package/dist/cjs/effect-client/runtime.js +100 -0
- package/dist/cjs/effect-client/types.js +18 -0
- package/dist/cjs/headers.js +46 -0
- package/dist/cjs/index.js +83 -0
- package/dist/esm/data-platform/batch/protocol.mjs +71 -0
- package/dist/esm/data-platform/batch/queue.mjs +582 -0
- package/dist/esm/data-platform/batch/request.mjs +68 -0
- package/dist/esm/data-platform/batch/response.mjs +24 -0
- package/dist/esm/data-platform/batch/telemetry.mjs +27 -0
- package/dist/esm/data-platform/batch/url.mjs +25 -0
- package/dist/esm/data-platform/batch-transport.mjs +12 -0
- package/dist/esm/data-platform/codec.mjs +90 -0
- package/dist/esm/data-platform/index.mjs +7 -0
- package/dist/esm/data-platform/invalidation.mjs +20 -0
- package/dist/esm/data-platform/trace.mjs +29 -0
- package/dist/esm/data-platform/types.mjs +4 -0
- package/dist/esm/data-platform/validation.mjs +128 -0
- package/dist/esm/effect/context.mjs +12 -0
- package/dist/esm/effect/dispatch.mjs +63 -0
- package/dist/esm/effect/edge-context.mjs +14 -0
- package/dist/esm/effect/edge-dispatcher.mjs +115 -0
- package/dist/esm/effect/edge.mjs +1 -0
- package/dist/esm/effect/endpoint-contracts.mjs +68 -0
- package/dist/esm/effect/entry-shape-registry.mjs +17 -0
- package/dist/esm/effect/entry-shape.mjs +51 -0
- package/dist/esm/effect/handler/batch-handler.mjs +232 -0
- package/dist/esm/effect/handler/batch.mjs +105 -0
- package/dist/esm/effect/handler/definition.mjs +58 -0
- package/dist/esm/effect/handler/envelope.mjs +63 -0
- package/dist/esm/effect/handler/http.mjs +69 -0
- package/dist/esm/effect/handler/openapi.mjs +20 -0
- package/dist/esm/effect/handler/routing.mjs +50 -0
- package/dist/esm/effect/handler/rpc.mjs +22 -0
- package/dist/esm/effect/handler/types.mjs +5 -0
- package/dist/esm/effect/handler.mjs +13 -0
- package/dist/esm/effect/index.mjs +7 -0
- package/dist/esm/effect/module.mjs +80 -0
- package/dist/esm/effect/operation-context.mjs +75 -0
- package/dist/esm/effect/rpcSerialization.mjs +16 -0
- package/dist/esm/effect-client/batch.mjs +35 -0
- package/dist/esm/effect-client/envelope.mjs +104 -0
- package/dist/esm/effect-client/guards.mjs +3 -0
- package/dist/esm/effect-client/index.mjs +110 -0
- package/dist/esm/effect-client/request-context.mjs +23 -0
- package/dist/esm/effect-client/request.mjs +28 -0
- package/dist/esm/effect-client/runtime.mjs +62 -0
- package/dist/esm/effect-client/types.mjs +0 -0
- package/dist/esm/headers.mjs +8 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm-node/data-platform/batch/protocol.mjs +72 -0
- package/dist/esm-node/data-platform/batch/queue.mjs +583 -0
- package/dist/esm-node/data-platform/batch/request.mjs +69 -0
- package/dist/esm-node/data-platform/batch/response.mjs +25 -0
- package/dist/esm-node/data-platform/batch/telemetry.mjs +28 -0
- package/dist/esm-node/data-platform/batch/url.mjs +26 -0
- package/dist/esm-node/data-platform/batch-transport.mjs +13 -0
- package/dist/esm-node/data-platform/codec.mjs +91 -0
- package/dist/esm-node/data-platform/index.mjs +8 -0
- package/dist/esm-node/data-platform/invalidation.mjs +21 -0
- package/dist/esm-node/data-platform/trace.mjs +30 -0
- package/dist/esm-node/data-platform/types.mjs +5 -0
- package/dist/esm-node/data-platform/validation.mjs +129 -0
- package/dist/esm-node/effect/context.mjs +13 -0
- package/dist/esm-node/effect/dispatch.mjs +64 -0
- package/dist/esm-node/effect/edge-context.mjs +15 -0
- package/dist/esm-node/effect/edge-dispatcher.mjs +116 -0
- package/dist/esm-node/effect/edge.mjs +2 -0
- package/dist/esm-node/effect/endpoint-contracts.mjs +69 -0
- package/dist/esm-node/effect/entry-shape-registry.mjs +18 -0
- package/dist/esm-node/effect/entry-shape.mjs +63 -0
- package/dist/esm-node/effect/handler/batch-handler.mjs +233 -0
- package/dist/esm-node/effect/handler/batch.mjs +106 -0
- package/dist/esm-node/effect/handler/definition.mjs +59 -0
- package/dist/esm-node/effect/handler/envelope.mjs +64 -0
- package/dist/esm-node/effect/handler/http.mjs +70 -0
- package/dist/esm-node/effect/handler/openapi.mjs +21 -0
- package/dist/esm-node/effect/handler/routing.mjs +51 -0
- package/dist/esm-node/effect/handler/rpc.mjs +23 -0
- package/dist/esm-node/effect/handler/types.mjs +6 -0
- package/dist/esm-node/effect/handler.mjs +14 -0
- package/dist/esm-node/effect/index.mjs +8 -0
- package/dist/esm-node/effect/module.mjs +81 -0
- package/dist/esm-node/effect/operation-context.mjs +76 -0
- package/dist/esm-node/effect/rpcSerialization.mjs +17 -0
- package/dist/esm-node/effect-client/batch.mjs +36 -0
- package/dist/esm-node/effect-client/envelope.mjs +105 -0
- package/dist/esm-node/effect-client/guards.mjs +4 -0
- package/dist/esm-node/effect-client/index.mjs +111 -0
- package/dist/esm-node/effect-client/request-context.mjs +24 -0
- package/dist/esm-node/effect-client/request.mjs +29 -0
- package/dist/esm-node/effect-client/runtime.mjs +63 -0
- package/dist/esm-node/effect-client/types.mjs +1 -0
- package/dist/esm-node/headers.mjs +9 -0
- package/dist/esm-node/index.mjs +5 -0
- package/dist/esm-node/rslib-runtime.mjs +19 -0
- package/dist/types/data-platform/batch/protocol.d.ts +9 -0
- package/dist/types/data-platform/batch/queue.d.ts +47 -0
- package/dist/types/data-platform/batch/request.d.ts +19 -0
- package/dist/types/data-platform/batch/response.d.ts +3 -0
- package/dist/types/data-platform/batch/telemetry.d.ts +4 -0
- package/dist/types/data-platform/batch/url.d.ts +4 -0
- package/dist/types/data-platform/batch-transport.d.ts +3 -0
- package/dist/types/data-platform/codec.d.ts +17 -0
- package/dist/types/data-platform/index.d.ts +8 -0
- package/dist/types/data-platform/invalidation.d.ts +8 -0
- package/dist/types/data-platform/trace.d.ts +4 -0
- package/dist/types/data-platform/types.d.ts +151 -0
- package/dist/types/data-platform/validation.d.ts +29 -0
- package/dist/types/effect/context.d.ts +5 -0
- package/dist/types/effect/dispatch.d.ts +13 -0
- package/dist/types/effect/edge-context.d.ts +5 -0
- package/dist/types/effect/edge-dispatcher.d.ts +37 -0
- package/dist/types/effect/edge.d.ts +1 -0
- package/dist/types/effect/endpoint-contracts.d.ts +67 -0
- package/dist/types/effect/entry-shape.d.ts +32 -0
- package/dist/types/effect/handler/batch-handler.d.ts +11 -0
- package/dist/types/effect/handler/batch.d.ts +15 -0
- package/dist/types/effect/handler/definition.d.ts +7 -0
- package/dist/types/effect/handler/envelope.d.ts +13 -0
- package/dist/types/effect/handler/http.d.ts +15 -0
- package/dist/types/effect/handler/openapi.d.ts +4 -0
- package/dist/types/effect/handler/routing.d.ts +5 -0
- package/dist/types/effect/handler/rpc.d.ts +7 -0
- package/dist/types/effect/handler/types.d.ts +153 -0
- package/dist/types/effect/handler.d.ts +13 -0
- package/dist/types/effect/index.d.ts +6 -0
- package/dist/types/effect/module.d.ts +36 -0
- package/dist/types/effect/operation-context.d.ts +15 -0
- package/dist/types/effect/rpcSerialization.d.ts +3 -0
- package/dist/types/effect-client/batch.d.ts +2 -0
- package/dist/types/effect-client/envelope.d.ts +15 -0
- package/dist/types/effect-client/guards.d.ts +2 -0
- package/dist/types/effect-client/index.d.ts +58 -0
- package/dist/types/effect-client/request-context.d.ts +3 -0
- package/dist/types/effect-client/request.d.ts +1 -0
- package/dist/types/effect-client/runtime.d.ts +5 -0
- package/dist/types/effect-client/types.d.ts +68 -0
- package/dist/types/headers.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +164 -0
- package/src/data-platform/batch/protocol.ts +112 -0
- package/src/data-platform/batch/queue.ts +876 -0
- package/src/data-platform/batch/request.ts +130 -0
- package/src/data-platform/batch/response.ts +74 -0
- package/src/data-platform/batch/telemetry.ts +47 -0
- package/src/data-platform/batch/url.ts +54 -0
- package/src/data-platform/batch-transport.ts +22 -0
- package/src/data-platform/codec.ts +145 -0
- package/src/data-platform/index.ts +63 -0
- package/src/data-platform/invalidation.ts +57 -0
- package/src/data-platform/trace.ts +49 -0
- package/src/data-platform/types.ts +186 -0
- package/src/data-platform/validation.ts +303 -0
- package/src/effect/context.ts +37 -0
- package/src/effect/dispatch.ts +132 -0
- package/src/effect/edge-context.ts +51 -0
- package/src/effect/edge-dispatcher.ts +310 -0
- package/src/effect/edge.ts +1 -0
- package/src/effect/endpoint-contracts.ts +191 -0
- package/src/effect/entry-shape-registry.cjs +16 -0
- package/src/effect/entry-shape-registry.d.cts +6 -0
- package/src/effect/entry-shape.ts +155 -0
- package/src/effect/handler/batch-handler.ts +475 -0
- package/src/effect/handler/batch.ts +182 -0
- package/src/effect/handler/definition.ts +121 -0
- package/src/effect/handler/envelope.ts +133 -0
- package/src/effect/handler/http.ts +133 -0
- package/src/effect/handler/openapi.ts +45 -0
- package/src/effect/handler/routing.ts +91 -0
- package/src/effect/handler/rpc.ts +45 -0
- package/src/effect/handler/types.ts +255 -0
- package/src/effect/handler.ts +33 -0
- package/src/effect/index.ts +22 -0
- package/src/effect/module.ts +186 -0
- package/src/effect/operation-context.ts +144 -0
- package/src/effect/rpcSerialization.ts +20 -0
- package/src/effect-client/batch.ts +50 -0
- package/src/effect-client/envelope.ts +238 -0
- package/src/effect-client/guards.ts +6 -0
- package/src/effect-client/index.ts +325 -0
- package/src/effect-client/request-context.ts +54 -0
- package/src/effect-client/request.ts +51 -0
- package/src/effect-client/runtime.ts +122 -0
- package/src/effect-client/types.ts +84 -0
- package/src/headers.ts +7 -0
- package/src/index.ts +3 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
Config: ()=>Config_namespaceObject,
|
|
32
|
+
Cookies: ()=>http_namespaceObject.Cookies,
|
|
33
|
+
Effect: ()=>Effect_namespaceObject,
|
|
34
|
+
Etag: ()=>http_namespaceObject.Etag,
|
|
35
|
+
FetchHttpClient: ()=>http_namespaceObject.FetchHttpClient,
|
|
36
|
+
FindMyWay: ()=>http_namespaceObject.FindMyWay,
|
|
37
|
+
Headers: ()=>http_namespaceObject.Headers,
|
|
38
|
+
HttpApi: ()=>httpapi_namespaceObject.HttpApi,
|
|
39
|
+
HttpApiBuilder: ()=>httpapi_namespaceObject.HttpApiBuilder,
|
|
40
|
+
HttpApiClient: ()=>httpapi_namespaceObject.HttpApiClient,
|
|
41
|
+
HttpApiEndpoint: ()=>httpapi_namespaceObject.HttpApiEndpoint,
|
|
42
|
+
HttpApiError: ()=>httpapi_namespaceObject.HttpApiError,
|
|
43
|
+
HttpApiGroup: ()=>httpapi_namespaceObject.HttpApiGroup,
|
|
44
|
+
HttpApiMiddleware: ()=>httpapi_namespaceObject.HttpApiMiddleware,
|
|
45
|
+
HttpApiSchema: ()=>httpapi_namespaceObject.HttpApiSchema,
|
|
46
|
+
HttpApiSecurity: ()=>httpapi_namespaceObject.HttpApiSecurity,
|
|
47
|
+
HttpApiTest: ()=>httpapi_namespaceObject.HttpApiTest,
|
|
48
|
+
HttpBody: ()=>http_namespaceObject.HttpBody,
|
|
49
|
+
HttpClient: ()=>http_namespaceObject.HttpClient,
|
|
50
|
+
HttpClientError: ()=>http_namespaceObject.HttpClientError,
|
|
51
|
+
HttpClientRequest: ()=>http_namespaceObject.HttpClientRequest,
|
|
52
|
+
HttpClientResponse: ()=>http_namespaceObject.HttpClientResponse,
|
|
53
|
+
HttpEffect: ()=>http_namespaceObject.HttpEffect,
|
|
54
|
+
HttpIncomingMessage: ()=>http_namespaceObject.HttpIncomingMessage,
|
|
55
|
+
HttpMethod: ()=>http_namespaceObject.HttpMethod,
|
|
56
|
+
HttpMiddleware: ()=>http_namespaceObject.HttpMiddleware,
|
|
57
|
+
HttpPlatform: ()=>http_namespaceObject.HttpPlatform,
|
|
58
|
+
HttpRouter: ()=>http_namespaceObject.HttpRouter,
|
|
59
|
+
HttpServer: ()=>http_namespaceObject.HttpServer,
|
|
60
|
+
HttpServerError: ()=>http_namespaceObject.HttpServerError,
|
|
61
|
+
HttpServerRequest: ()=>http_namespaceObject.HttpServerRequest,
|
|
62
|
+
HttpServerRespondable: ()=>http_namespaceObject.HttpServerRespondable,
|
|
63
|
+
HttpServerResponse: ()=>http_namespaceObject.HttpServerResponse,
|
|
64
|
+
HttpStaticServer: ()=>http_namespaceObject.HttpStaticServer,
|
|
65
|
+
HttpStatus: ()=>http_namespaceObject.HttpStatus,
|
|
66
|
+
HttpTraceContext: ()=>http_namespaceObject.HttpTraceContext,
|
|
67
|
+
Layer: ()=>Layer_namespaceObject,
|
|
68
|
+
Multipart: ()=>http_namespaceObject.Multipart,
|
|
69
|
+
MultipartParser: ()=>http_namespaceObject.MultipartParser,
|
|
70
|
+
OpenApi: ()=>httpapi_namespaceObject.OpenApi,
|
|
71
|
+
Option: ()=>Option_namespaceObject,
|
|
72
|
+
Rpc: ()=>rpc_namespaceObject.Rpc,
|
|
73
|
+
RpcClient: ()=>rpc_namespaceObject.RpcClient,
|
|
74
|
+
RpcClientError: ()=>rpc_namespaceObject.RpcClientError,
|
|
75
|
+
RpcGroup: ()=>rpc_namespaceObject.RpcGroup,
|
|
76
|
+
RpcMessage: ()=>rpc_namespaceObject.RpcMessage,
|
|
77
|
+
RpcMiddleware: ()=>rpc_namespaceObject.RpcMiddleware,
|
|
78
|
+
RpcSchema: ()=>rpc_namespaceObject.RpcSchema,
|
|
79
|
+
RpcSerialization: ()=>rpc_namespaceObject.RpcSerialization,
|
|
80
|
+
RpcServer: ()=>rpc_namespaceObject.RpcServer,
|
|
81
|
+
RpcTest: ()=>rpc_namespaceObject.RpcTest,
|
|
82
|
+
RpcWorker: ()=>rpc_namespaceObject.RpcWorker,
|
|
83
|
+
Schema: ()=>Schema_namespaceObject,
|
|
84
|
+
Template: ()=>http_namespaceObject.Template,
|
|
85
|
+
Url: ()=>http_namespaceObject.Url,
|
|
86
|
+
UrlParams: ()=>http_namespaceObject.UrlParams,
|
|
87
|
+
Utils: ()=>rpc_namespaceObject.Utils,
|
|
88
|
+
createEffectBffEdgeDispatcher: ()=>createEffectBffEdgeDispatcher,
|
|
89
|
+
createEffectBffEdgeHandler: ()=>createEffectBffEdgeHandler,
|
|
90
|
+
createEffectBffTestHandler: ()=>createEffectBffTestHandler,
|
|
91
|
+
createEffectOperationContext: ()=>external_operation_context_js_namespaceObject.createEffectOperationContext,
|
|
92
|
+
createHttpApiHandler: ()=>external_handler_js_namespaceObject.createHttpApiHandler,
|
|
93
|
+
defineEffectBff: ()=>external_handler_js_namespaceObject.defineEffectBff,
|
|
94
|
+
defineEffectRpcBff: ()=>external_handler_js_namespaceObject.defineEffectRpcBff,
|
|
95
|
+
dispatchEffectBffRequest: ()=>dispatchEffectBffRequest,
|
|
96
|
+
runWithEffectContext: ()=>external_edge_context_js_namespaceObject.runWithEffectContext,
|
|
97
|
+
useEffectContext: ()=>external_edge_context_js_namespaceObject.useEffectContext,
|
|
98
|
+
useOperationContext: ()=>external_edge_context_js_namespaceObject.useOperationContext
|
|
99
|
+
});
|
|
100
|
+
const cross_project_policy_namespaceObject = require("@modern-js/bff-core/security/cross-project-policy");
|
|
101
|
+
const external_headers_js_namespaceObject = require("../headers.js");
|
|
102
|
+
const external_dispatch_js_namespaceObject = require("./dispatch.js");
|
|
103
|
+
const external_edge_context_js_namespaceObject = require("./edge-context.js");
|
|
104
|
+
const external_module_js_namespaceObject = require("./module.js");
|
|
105
|
+
const Config_namespaceObject = require("effect/Config");
|
|
106
|
+
const Effect_namespaceObject = require("effect/Effect");
|
|
107
|
+
const Layer_namespaceObject = require("effect/Layer");
|
|
108
|
+
const Option_namespaceObject = require("effect/Option");
|
|
109
|
+
const Schema_namespaceObject = require("effect/Schema");
|
|
110
|
+
const http_namespaceObject = require("effect/unstable/http");
|
|
111
|
+
const httpapi_namespaceObject = require("effect/unstable/httpapi");
|
|
112
|
+
const rpc_namespaceObject = require("effect/unstable/rpc");
|
|
113
|
+
const external_handler_js_namespaceObject = require("./handler.js");
|
|
114
|
+
const external_operation_context_js_namespaceObject = require("./operation-context.js");
|
|
115
|
+
const NORMALIZED_POLICY_BOOLEAN_FIELDS = [
|
|
116
|
+
'enabled',
|
|
117
|
+
'requireEnvelope',
|
|
118
|
+
'requireOperationContext',
|
|
119
|
+
'requireOperationContextDetails',
|
|
120
|
+
'requireOperationSchemaHash',
|
|
121
|
+
'requireOperationVersion',
|
|
122
|
+
'allowUnknownOperations'
|
|
123
|
+
];
|
|
124
|
+
function assertNormalizedCrossProjectPolicy(policy) {
|
|
125
|
+
if (void 0 === policy) return;
|
|
126
|
+
if (!policy || 'object' != typeof policy || Array.isArray(policy)) throw new Error('[BFF][Effect] Edge cross-project policy must be a normalized object.');
|
|
127
|
+
for (const field of NORMALIZED_POLICY_BOOLEAN_FIELDS)if ('boolean' != typeof policy[field]) throw new Error(`[BFF][Effect] Edge cross-project policy requires boolean ${field}.`);
|
|
128
|
+
if (!policy.expectedOperationContracts || 'object' != typeof policy.expectedOperationContracts || Array.isArray(policy.expectedOperationContracts)) throw new Error('[BFF][Effect] Edge cross-project policy requires expectedOperationContracts object.');
|
|
129
|
+
}
|
|
130
|
+
function restoreEffectBffMountPath(request, prefix) {
|
|
131
|
+
const pathname = new URL(request.url).pathname;
|
|
132
|
+
if (!prefix || '/' === prefix) return pathname;
|
|
133
|
+
const normalizedPrefix = prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
|
|
134
|
+
return '/' === pathname ? normalizedPrefix : `${normalizedPrefix}${pathname}`;
|
|
135
|
+
}
|
|
136
|
+
async function dispatchEffectBffRequest(handler, request, options = {}) {
|
|
137
|
+
return (0, external_dispatch_js_namespaceObject.dispatchEffectBffRequestWithContext)(handler, request, {
|
|
138
|
+
...options,
|
|
139
|
+
runWithEffectContext: external_edge_context_js_namespaceObject.runWithEffectContext
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async function createEffectBffEdgeDispatcher(options) {
|
|
143
|
+
const crossProjectPolicy = options.crossProjectPolicy;
|
|
144
|
+
assertNormalizedCrossProjectPolicy(crossProjectPolicy);
|
|
145
|
+
const loaded = await (0, external_module_js_namespaceObject.resolveEffectBffModuleHandler)(options.module, {
|
|
146
|
+
openapi: options.openapi,
|
|
147
|
+
dataPlatform: options.dataPlatform,
|
|
148
|
+
validateRequest: crossProjectPolicy?.enabled === true ? (request)=>{
|
|
149
|
+
const pathname = new URL(request.url).pathname;
|
|
150
|
+
const observedRequest = (0, cross_project_policy_namespaceObject.resolveCrossProjectRequestObservation)({
|
|
151
|
+
method: request.method,
|
|
152
|
+
pathname
|
|
153
|
+
}, crossProjectPolicy) ?? {
|
|
154
|
+
method: request.method,
|
|
155
|
+
routePath: restoreEffectBffMountPath(request, options.prefix)
|
|
156
|
+
};
|
|
157
|
+
const violation = (0, cross_project_policy_namespaceObject.evaluateCrossProjectPolicy)((0, external_headers_js_namespaceObject.toHeaderRecord)(request.headers), crossProjectPolicy, observedRequest);
|
|
158
|
+
if (!violation) return null;
|
|
159
|
+
return new Response(JSON.stringify({
|
|
160
|
+
code: violation.code,
|
|
161
|
+
reason: violation.reason,
|
|
162
|
+
message: violation.message
|
|
163
|
+
}), {
|
|
164
|
+
status: violation.status,
|
|
165
|
+
headers: {
|
|
166
|
+
'content-type': 'application/json; charset=utf-8'
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
} : void 0,
|
|
170
|
+
onWarning: options.onWarning
|
|
171
|
+
});
|
|
172
|
+
if (!loaded) throw new Error('[BFF][Effect] Invalid Effect edge module. Export defineEffectBff(...) or a { api, layer } HttpApi module.');
|
|
173
|
+
const retiredError = new Error('[BFF][Effect] Edge dispatcher is disposing or has been disposed.');
|
|
174
|
+
let acceptingRequests = true;
|
|
175
|
+
let activeDispatches = 0;
|
|
176
|
+
let resolveDrain;
|
|
177
|
+
let disposePromise;
|
|
178
|
+
return {
|
|
179
|
+
dispatch: (request, dispatchOptions = {})=>{
|
|
180
|
+
if (!acceptingRequests) return Promise.reject(retiredError);
|
|
181
|
+
activeDispatches += 1;
|
|
182
|
+
return dispatchEffectBffRequest(loaded.handler, request, {
|
|
183
|
+
...dispatchOptions,
|
|
184
|
+
prefix: options.prefix,
|
|
185
|
+
onError: options.onError
|
|
186
|
+
}).finally(()=>{
|
|
187
|
+
activeDispatches -= 1;
|
|
188
|
+
if (0 === activeDispatches) {
|
|
189
|
+
resolveDrain?.();
|
|
190
|
+
resolveDrain = void 0;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
dispose: ()=>{
|
|
195
|
+
disposePromise ??= (async ()=>{
|
|
196
|
+
acceptingRequests = false;
|
|
197
|
+
if (activeDispatches > 0) await new Promise((resolve)=>{
|
|
198
|
+
resolveDrain = resolve;
|
|
199
|
+
});
|
|
200
|
+
await loaded.dispose?.();
|
|
201
|
+
})();
|
|
202
|
+
return disposePromise;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const createEffectBffTestHandler = createEffectBffEdgeHandler;
|
|
207
|
+
async function createEffectBffEdgeHandler(options) {
|
|
208
|
+
const dispatcher = await createEffectBffEdgeDispatcher(options);
|
|
209
|
+
return {
|
|
210
|
+
handler: dispatcher.dispatch,
|
|
211
|
+
dispose: dispatcher.dispose
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
exports.Config = __webpack_exports__.Config;
|
|
215
|
+
exports.Cookies = __webpack_exports__.Cookies;
|
|
216
|
+
exports.Effect = __webpack_exports__.Effect;
|
|
217
|
+
exports.Etag = __webpack_exports__.Etag;
|
|
218
|
+
exports.FetchHttpClient = __webpack_exports__.FetchHttpClient;
|
|
219
|
+
exports.FindMyWay = __webpack_exports__.FindMyWay;
|
|
220
|
+
exports.Headers = __webpack_exports__.Headers;
|
|
221
|
+
exports.HttpApi = __webpack_exports__.HttpApi;
|
|
222
|
+
exports.HttpApiBuilder = __webpack_exports__.HttpApiBuilder;
|
|
223
|
+
exports.HttpApiClient = __webpack_exports__.HttpApiClient;
|
|
224
|
+
exports.HttpApiEndpoint = __webpack_exports__.HttpApiEndpoint;
|
|
225
|
+
exports.HttpApiError = __webpack_exports__.HttpApiError;
|
|
226
|
+
exports.HttpApiGroup = __webpack_exports__.HttpApiGroup;
|
|
227
|
+
exports.HttpApiMiddleware = __webpack_exports__.HttpApiMiddleware;
|
|
228
|
+
exports.HttpApiSchema = __webpack_exports__.HttpApiSchema;
|
|
229
|
+
exports.HttpApiSecurity = __webpack_exports__.HttpApiSecurity;
|
|
230
|
+
exports.HttpApiTest = __webpack_exports__.HttpApiTest;
|
|
231
|
+
exports.HttpBody = __webpack_exports__.HttpBody;
|
|
232
|
+
exports.HttpClient = __webpack_exports__.HttpClient;
|
|
233
|
+
exports.HttpClientError = __webpack_exports__.HttpClientError;
|
|
234
|
+
exports.HttpClientRequest = __webpack_exports__.HttpClientRequest;
|
|
235
|
+
exports.HttpClientResponse = __webpack_exports__.HttpClientResponse;
|
|
236
|
+
exports.HttpEffect = __webpack_exports__.HttpEffect;
|
|
237
|
+
exports.HttpIncomingMessage = __webpack_exports__.HttpIncomingMessage;
|
|
238
|
+
exports.HttpMethod = __webpack_exports__.HttpMethod;
|
|
239
|
+
exports.HttpMiddleware = __webpack_exports__.HttpMiddleware;
|
|
240
|
+
exports.HttpPlatform = __webpack_exports__.HttpPlatform;
|
|
241
|
+
exports.HttpRouter = __webpack_exports__.HttpRouter;
|
|
242
|
+
exports.HttpServer = __webpack_exports__.HttpServer;
|
|
243
|
+
exports.HttpServerError = __webpack_exports__.HttpServerError;
|
|
244
|
+
exports.HttpServerRequest = __webpack_exports__.HttpServerRequest;
|
|
245
|
+
exports.HttpServerRespondable = __webpack_exports__.HttpServerRespondable;
|
|
246
|
+
exports.HttpServerResponse = __webpack_exports__.HttpServerResponse;
|
|
247
|
+
exports.HttpStaticServer = __webpack_exports__.HttpStaticServer;
|
|
248
|
+
exports.HttpStatus = __webpack_exports__.HttpStatus;
|
|
249
|
+
exports.HttpTraceContext = __webpack_exports__.HttpTraceContext;
|
|
250
|
+
exports.Layer = __webpack_exports__.Layer;
|
|
251
|
+
exports.Multipart = __webpack_exports__.Multipart;
|
|
252
|
+
exports.MultipartParser = __webpack_exports__.MultipartParser;
|
|
253
|
+
exports.OpenApi = __webpack_exports__.OpenApi;
|
|
254
|
+
exports.Option = __webpack_exports__.Option;
|
|
255
|
+
exports.Rpc = __webpack_exports__.Rpc;
|
|
256
|
+
exports.RpcClient = __webpack_exports__.RpcClient;
|
|
257
|
+
exports.RpcClientError = __webpack_exports__.RpcClientError;
|
|
258
|
+
exports.RpcGroup = __webpack_exports__.RpcGroup;
|
|
259
|
+
exports.RpcMessage = __webpack_exports__.RpcMessage;
|
|
260
|
+
exports.RpcMiddleware = __webpack_exports__.RpcMiddleware;
|
|
261
|
+
exports.RpcSchema = __webpack_exports__.RpcSchema;
|
|
262
|
+
exports.RpcSerialization = __webpack_exports__.RpcSerialization;
|
|
263
|
+
exports.RpcServer = __webpack_exports__.RpcServer;
|
|
264
|
+
exports.RpcTest = __webpack_exports__.RpcTest;
|
|
265
|
+
exports.RpcWorker = __webpack_exports__.RpcWorker;
|
|
266
|
+
exports.Schema = __webpack_exports__.Schema;
|
|
267
|
+
exports.Template = __webpack_exports__.Template;
|
|
268
|
+
exports.Url = __webpack_exports__.Url;
|
|
269
|
+
exports.UrlParams = __webpack_exports__.UrlParams;
|
|
270
|
+
exports.Utils = __webpack_exports__.Utils;
|
|
271
|
+
exports.createEffectBffEdgeDispatcher = __webpack_exports__.createEffectBffEdgeDispatcher;
|
|
272
|
+
exports.createEffectBffEdgeHandler = __webpack_exports__.createEffectBffEdgeHandler;
|
|
273
|
+
exports.createEffectBffTestHandler = __webpack_exports__.createEffectBffTestHandler;
|
|
274
|
+
exports.createEffectOperationContext = __webpack_exports__.createEffectOperationContext;
|
|
275
|
+
exports.createHttpApiHandler = __webpack_exports__.createHttpApiHandler;
|
|
276
|
+
exports.defineEffectBff = __webpack_exports__.defineEffectBff;
|
|
277
|
+
exports.defineEffectRpcBff = __webpack_exports__.defineEffectRpcBff;
|
|
278
|
+
exports.dispatchEffectBffRequest = __webpack_exports__.dispatchEffectBffRequest;
|
|
279
|
+
exports.runWithEffectContext = __webpack_exports__.runWithEffectContext;
|
|
280
|
+
exports.useEffectContext = __webpack_exports__.useEffectContext;
|
|
281
|
+
exports.useOperationContext = __webpack_exports__.useOperationContext;
|
|
282
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
283
|
+
"Config",
|
|
284
|
+
"Cookies",
|
|
285
|
+
"Effect",
|
|
286
|
+
"Etag",
|
|
287
|
+
"FetchHttpClient",
|
|
288
|
+
"FindMyWay",
|
|
289
|
+
"Headers",
|
|
290
|
+
"HttpApi",
|
|
291
|
+
"HttpApiBuilder",
|
|
292
|
+
"HttpApiClient",
|
|
293
|
+
"HttpApiEndpoint",
|
|
294
|
+
"HttpApiError",
|
|
295
|
+
"HttpApiGroup",
|
|
296
|
+
"HttpApiMiddleware",
|
|
297
|
+
"HttpApiSchema",
|
|
298
|
+
"HttpApiSecurity",
|
|
299
|
+
"HttpApiTest",
|
|
300
|
+
"HttpBody",
|
|
301
|
+
"HttpClient",
|
|
302
|
+
"HttpClientError",
|
|
303
|
+
"HttpClientRequest",
|
|
304
|
+
"HttpClientResponse",
|
|
305
|
+
"HttpEffect",
|
|
306
|
+
"HttpIncomingMessage",
|
|
307
|
+
"HttpMethod",
|
|
308
|
+
"HttpMiddleware",
|
|
309
|
+
"HttpPlatform",
|
|
310
|
+
"HttpRouter",
|
|
311
|
+
"HttpServer",
|
|
312
|
+
"HttpServerError",
|
|
313
|
+
"HttpServerRequest",
|
|
314
|
+
"HttpServerRespondable",
|
|
315
|
+
"HttpServerResponse",
|
|
316
|
+
"HttpStaticServer",
|
|
317
|
+
"HttpStatus",
|
|
318
|
+
"HttpTraceContext",
|
|
319
|
+
"Layer",
|
|
320
|
+
"Multipart",
|
|
321
|
+
"MultipartParser",
|
|
322
|
+
"OpenApi",
|
|
323
|
+
"Option",
|
|
324
|
+
"Rpc",
|
|
325
|
+
"RpcClient",
|
|
326
|
+
"RpcClientError",
|
|
327
|
+
"RpcGroup",
|
|
328
|
+
"RpcMessage",
|
|
329
|
+
"RpcMiddleware",
|
|
330
|
+
"RpcSchema",
|
|
331
|
+
"RpcSerialization",
|
|
332
|
+
"RpcServer",
|
|
333
|
+
"RpcTest",
|
|
334
|
+
"RpcWorker",
|
|
335
|
+
"Schema",
|
|
336
|
+
"Template",
|
|
337
|
+
"Url",
|
|
338
|
+
"UrlParams",
|
|
339
|
+
"Utils",
|
|
340
|
+
"createEffectBffEdgeDispatcher",
|
|
341
|
+
"createEffectBffEdgeHandler",
|
|
342
|
+
"createEffectBffTestHandler",
|
|
343
|
+
"createEffectOperationContext",
|
|
344
|
+
"createHttpApiHandler",
|
|
345
|
+
"defineEffectBff",
|
|
346
|
+
"defineEffectRpcBff",
|
|
347
|
+
"dispatchEffectBffRequest",
|
|
348
|
+
"runWithEffectContext",
|
|
349
|
+
"useEffectContext",
|
|
350
|
+
"useOperationContext"
|
|
351
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
352
|
+
Object.defineProperty(exports, '__esModule', {
|
|
353
|
+
value: true
|
|
354
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./edge-dispatcher" (module) {
|
|
4
|
+
module.exports = require("./edge-dispatcher.js");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.n = (module)=>{
|
|
19
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
20
|
+
__webpack_require__.d(getter, {
|
|
21
|
+
a: getter
|
|
22
|
+
});
|
|
23
|
+
return getter;
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
(()=>{
|
|
39
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
40
|
+
})();
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.r = (exports1)=>{
|
|
43
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
44
|
+
value: 'Module'
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
47
|
+
value: true
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
51
|
+
var __webpack_exports__ = {};
|
|
52
|
+
(()=>{
|
|
53
|
+
__webpack_require__.r(__webpack_exports__);
|
|
54
|
+
var _edge_dispatcher__rspack_import_0 = __webpack_require__("./edge-dispatcher");
|
|
55
|
+
var __rspack_reexport = {};
|
|
56
|
+
for(const __rspack_import_key in _edge_dispatcher__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_edge_dispatcher__rspack_import_0[__rspack_import_key];
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
58
|
+
})();
|
|
59
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
|
+
Object.defineProperty(exports, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
collectEffectEndpoints: ()=>collectEffectEndpoints,
|
|
32
|
+
createEffectEndpointContractHash: ()=>createEffectEndpointContractHash,
|
|
33
|
+
ensureLeadingSlash: ()=>ensureLeadingSlash,
|
|
34
|
+
extractHttpApiFromModule: ()=>extractHttpApiFromModule,
|
|
35
|
+
normalizeEffectPrefix: ()=>normalizeEffectPrefix,
|
|
36
|
+
toOperationContractSources: ()=>toOperationContractSources
|
|
37
|
+
});
|
|
38
|
+
const bff_core_namespaceObject = require("@modern-js/bff-core");
|
|
39
|
+
const external_entry_shape_js_namespaceObject = require("./entry-shape.js");
|
|
40
|
+
function resolveEffectEndpointName(endpoint) {
|
|
41
|
+
if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
|
|
42
|
+
if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
function ensureLeadingSlash(pathname) {
|
|
46
|
+
return pathname.startsWith('/') ? pathname : `/${pathname}`;
|
|
47
|
+
}
|
|
48
|
+
function normalizeEffectPrefix(prefix) {
|
|
49
|
+
if ('/' === prefix) return '';
|
|
50
|
+
return ensureLeadingSlash(prefix || '/api');
|
|
51
|
+
}
|
|
52
|
+
function getEffectRoutePath(prefix, endpointPath) {
|
|
53
|
+
const normalizedPrefix = normalizeEffectPrefix(prefix);
|
|
54
|
+
const normalizedEndpointPath = ensureLeadingSlash(endpointPath);
|
|
55
|
+
const finalEndpointPath = '/' === normalizedEndpointPath ? '' : endpointPath;
|
|
56
|
+
if (!normalizedPrefix && !finalEndpointPath) return '/';
|
|
57
|
+
return `${normalizedPrefix}${finalEndpointPath || ''}`;
|
|
58
|
+
}
|
|
59
|
+
function resolveEffectApiId(api) {
|
|
60
|
+
const fallback = 'EffectHttpApi';
|
|
61
|
+
if ('identifier' in api && 'string' == typeof api.identifier && api.identifier) return api.identifier;
|
|
62
|
+
return fallback;
|
|
63
|
+
}
|
|
64
|
+
function collectEffectEndpoints(reflect, api, prefix) {
|
|
65
|
+
const endpoints = [];
|
|
66
|
+
const apiId = resolveEffectApiId(api);
|
|
67
|
+
reflect(api, {
|
|
68
|
+
onGroup: ()=>{},
|
|
69
|
+
onEndpoint: ({ group, endpoint })=>{
|
|
70
|
+
endpoints.push({
|
|
71
|
+
apiId,
|
|
72
|
+
groupName: String(group.identifier),
|
|
73
|
+
endpointName: resolveEffectEndpointName(endpoint),
|
|
74
|
+
method: String(endpoint.method).toUpperCase(),
|
|
75
|
+
routePath: getEffectRoutePath(prefix, String(endpoint.path))
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return endpoints.sort((a, b)=>{
|
|
80
|
+
if (a.groupName === b.groupName) return a.endpointName.localeCompare(b.endpointName);
|
|
81
|
+
return a.groupName.localeCompare(b.groupName);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function toOperationContractSources(endpoints) {
|
|
85
|
+
return endpoints.map(createEffectOperationContractSource);
|
|
86
|
+
}
|
|
87
|
+
function createEffectOperationContractSource(endpoint) {
|
|
88
|
+
return {
|
|
89
|
+
name: endpoint.endpointName,
|
|
90
|
+
httpMethod: endpoint.method,
|
|
91
|
+
routePath: endpoint.routePath
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async function extractHttpApiFromModule(mod, isHttpApi) {
|
|
95
|
+
const facts = (0, external_entry_shape_js_namespaceObject.classifyEffectBffEntryModule)(mod, {
|
|
96
|
+
isRequestHandler: (value)=>'function' == typeof value,
|
|
97
|
+
isValidatorAwareHandlerFactory: external_entry_shape_js_namespaceObject.isValidatorAwareHandlerFactory,
|
|
98
|
+
isHttpApi
|
|
99
|
+
});
|
|
100
|
+
return !facts?.legacyShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
|
|
101
|
+
}
|
|
102
|
+
function createEffectEndpointContractHash(endpoint, requestId) {
|
|
103
|
+
return (0, bff_core_namespaceObject.createOperationContractHash)(createEffectOperationContractSource(endpoint), requestId);
|
|
104
|
+
}
|
|
105
|
+
exports.collectEffectEndpoints = __webpack_exports__.collectEffectEndpoints;
|
|
106
|
+
exports.createEffectEndpointContractHash = __webpack_exports__.createEffectEndpointContractHash;
|
|
107
|
+
exports.ensureLeadingSlash = __webpack_exports__.ensureLeadingSlash;
|
|
108
|
+
exports.extractHttpApiFromModule = __webpack_exports__.extractHttpApiFromModule;
|
|
109
|
+
exports.normalizeEffectPrefix = __webpack_exports__.normalizeEffectPrefix;
|
|
110
|
+
exports.toOperationContractSources = __webpack_exports__.toOperationContractSources;
|
|
111
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
112
|
+
"collectEffectEndpoints",
|
|
113
|
+
"createEffectEndpointContractHash",
|
|
114
|
+
"ensureLeadingSlash",
|
|
115
|
+
"extractHttpApiFromModule",
|
|
116
|
+
"normalizeEffectPrefix",
|
|
117
|
+
"toOperationContractSources"
|
|
118
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
119
|
+
Object.defineProperty(exports, '__esModule', {
|
|
120
|
+
value: true
|
|
121
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
"./src/effect/entry-shape-registry.cjs" (module) {
|
|
5
|
+
const validatorAwareHandlerFactories = new WeakSet();
|
|
6
|
+
module.exports = {
|
|
7
|
+
register (factory) {
|
|
8
|
+
validatorAwareHandlerFactories.add(factory);
|
|
9
|
+
return factory;
|
|
10
|
+
},
|
|
11
|
+
is (factory) {
|
|
12
|
+
return 'function' == typeof factory && validatorAwareHandlerFactories.has(factory);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var __webpack_module_cache__ = {};
|
|
18
|
+
function __webpack_require__(moduleId) {
|
|
19
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
20
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
21
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
22
|
+
exports: {}
|
|
23
|
+
};
|
|
24
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
25
|
+
return module.exports;
|
|
26
|
+
}
|
|
27
|
+
var __webpack_exports__ = __webpack_require__("./src/effect/entry-shape-registry.cjs");
|
|
28
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
29
|
+
Object.defineProperty(exports, '__esModule', {
|
|
30
|
+
value: true
|
|
31
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
+
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
|
+
}();
|
|
5
|
+
var __webpack_require__ = {};
|
|
6
|
+
(()=>{
|
|
7
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
8
|
+
var define = (defs, kind)=>{
|
|
9
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
[kind]: defs[key]
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
define(getters, "get");
|
|
15
|
+
define(values, "value");
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
20
|
+
})();
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.r = (exports1)=>{
|
|
23
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
24
|
+
value: 'Module'
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
27
|
+
value: true
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
31
|
+
var __webpack_exports__ = {};
|
|
32
|
+
__webpack_require__.r(__webpack_exports__);
|
|
33
|
+
function createLocalValidatorAwareHandlerFactoryRegistry() {
|
|
34
|
+
const factories = new WeakSet();
|
|
35
|
+
return {
|
|
36
|
+
register (factory) {
|
|
37
|
+
factories.add(factory);
|
|
38
|
+
return factory;
|
|
39
|
+
},
|
|
40
|
+
is (factory) {
|
|
41
|
+
return 'function' == typeof factory && factories.has(factory);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function loadNodeValidatorAwareHandlerFactoryRegistry() {
|
|
46
|
+
const moduleUrl = __rslib_import_meta_url__;
|
|
47
|
+
if ('string' != typeof moduleUrl || !moduleUrl.startsWith('file:')) return createLocalValidatorAwareHandlerFactoryRegistry();
|
|
48
|
+
const moduleBuiltin = process.getBuiltinModule('node:module');
|
|
49
|
+
try {
|
|
50
|
+
return moduleBuiltin.createRequire(moduleUrl)("#effect-entry-shape-registry");
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (null !== error && 'object' == typeof error && 'code' in error && 'MODULE_NOT_FOUND' === error.code) return createLocalValidatorAwareHandlerFactoryRegistry();
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const validatorAwareHandlerFactoryRegistry = loadNodeValidatorAwareHandlerFactoryRegistry();
|
|
57
|
+
function registerValidatorAwareHandlerFactory(factory) {
|
|
58
|
+
return validatorAwareHandlerFactoryRegistry.register(factory);
|
|
59
|
+
}
|
|
60
|
+
function isValidatorAwareHandlerFactory(factory) {
|
|
61
|
+
return validatorAwareHandlerFactoryRegistry.is(factory);
|
|
62
|
+
}
|
|
63
|
+
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.';
|
|
64
|
+
function isEffectEntryRecord(value) {
|
|
65
|
+
return 'object' == typeof value && null !== value;
|
|
66
|
+
}
|
|
67
|
+
function classifyEffectBffEntryModule(value, predicates) {
|
|
68
|
+
if (!isEffectEntryRecord(value)) return null;
|
|
69
|
+
const rootModule = value;
|
|
70
|
+
if (predicates.isRequestHandler(rootModule.handler)) return createEntryShapeFacts(rootModule, predicates, '`handler` export');
|
|
71
|
+
const defaultEntry = rootModule.default;
|
|
72
|
+
if (predicates.isRequestHandler(defaultEntry)) return createEntryShapeFacts(rootModule, predicates, 'default request handler');
|
|
73
|
+
const module = isEffectEntryRecord(defaultEntry) ? {
|
|
74
|
+
...rootModule,
|
|
75
|
+
...defaultEntry
|
|
76
|
+
} : rootModule;
|
|
77
|
+
if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
|
|
78
|
+
return createEntryShapeFacts(module, predicates);
|
|
79
|
+
}
|
|
80
|
+
function createEntryShapeFacts(module, predicates, legacyShape) {
|
|
81
|
+
const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
|
|
82
|
+
const api = predicates.isHttpApi(module.api) ? module.api : void 0;
|
|
83
|
+
const hasRuntimeLayer = void 0 !== module.layer;
|
|
84
|
+
return {
|
|
85
|
+
module,
|
|
86
|
+
legacyShape,
|
|
87
|
+
createHandler,
|
|
88
|
+
createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
|
|
89
|
+
api,
|
|
90
|
+
layer: module.layer,
|
|
91
|
+
hasRuntimeLayer
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
95
|
+
classifyEffectBffEntryModule: ()=>classifyEffectBffEntryModule,
|
|
96
|
+
isValidatorAwareHandlerFactory: ()=>isValidatorAwareHandlerFactory,
|
|
97
|
+
registerValidatorAwareHandlerFactory: ()=>registerValidatorAwareHandlerFactory
|
|
98
|
+
}, {
|
|
99
|
+
strictEffectApproachMessage: strictEffectApproachMessage
|
|
100
|
+
});
|
|
101
|
+
exports.classifyEffectBffEntryModule = __webpack_exports__.classifyEffectBffEntryModule;
|
|
102
|
+
exports.isValidatorAwareHandlerFactory = __webpack_exports__.isValidatorAwareHandlerFactory;
|
|
103
|
+
exports.registerValidatorAwareHandlerFactory = __webpack_exports__.registerValidatorAwareHandlerFactory;
|
|
104
|
+
exports.strictEffectApproachMessage = __webpack_exports__.strictEffectApproachMessage;
|
|
105
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
106
|
+
"classifyEffectBffEntryModule",
|
|
107
|
+
"isValidatorAwareHandlerFactory",
|
|
108
|
+
"registerValidatorAwareHandlerFactory",
|
|
109
|
+
"strictEffectApproachMessage"
|
|
110
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|