@bleedingdev/modern-js-bff-effect 3.9.0-ultramodern.4 → 3.9.0-ultramodern.6
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/README.md +20 -4
- package/dist/cjs/{effect-client/guards.js → assembly.js} +15 -9
- package/dist/cjs/data-platform/trace.js +2 -2
- package/dist/cjs/effect/edge-dispatcher.js +7 -7
- package/dist/cjs/effect/edge.js +15 -2
- package/dist/cjs/effect/endpoint-contracts.js +3 -4
- package/dist/cjs/effect/entry-shape.js +2 -2
- package/dist/cjs/effect/generated-entry.js +57 -0
- package/dist/cjs/effect/handler/batch-handler.js +5 -4
- package/dist/cjs/effect/handler/batch.js +8 -1
- package/dist/cjs/effect/handler/definition.js +1 -21
- package/dist/cjs/effect/module.js +4 -4
- package/dist/cjs/effect/operation-context.js +7 -7
- package/dist/cjs/effect-client/cross-project.js +92 -0
- package/dist/cjs/effect-client/index.js +5 -3
- package/dist/cjs/microvertical-api.js +120 -0
- package/dist/esm/assembly.mjs +12 -0
- package/dist/esm/data-platform/trace.mjs +1 -1
- package/dist/esm/effect/edge-dispatcher.mjs +5 -5
- package/dist/esm/effect/edge.mjs +1 -0
- package/dist/esm/effect/endpoint-contracts.mjs +2 -3
- package/dist/esm/effect/entry-shape.mjs +2 -2
- package/dist/esm/effect/generated-entry.mjs +19 -0
- package/dist/esm/effect/handler/batch-handler.mjs +5 -4
- package/dist/esm/effect/handler/batch.mjs +8 -1
- package/dist/esm/effect/handler/definition.mjs +1 -21
- package/dist/esm/effect/module.mjs +4 -4
- package/dist/esm/effect/operation-context.mjs +1 -1
- package/dist/esm/effect-client/cross-project.mjs +54 -0
- package/dist/esm/effect-client/index.mjs +4 -2
- package/dist/esm/microvertical-api.mjs +67 -0
- package/dist/esm-node/assembly.mjs +13 -0
- package/dist/esm-node/data-platform/trace.mjs +1 -1
- package/dist/esm-node/effect/edge-dispatcher.mjs +5 -5
- package/dist/esm-node/effect/edge.mjs +1 -0
- package/dist/esm-node/effect/endpoint-contracts.mjs +2 -3
- package/dist/esm-node/effect/entry-shape.mjs +2 -2
- package/dist/esm-node/effect/generated-entry.mjs +20 -0
- package/dist/esm-node/effect/handler/batch-handler.mjs +5 -4
- package/dist/esm-node/effect/handler/batch.mjs +8 -1
- package/dist/esm-node/effect/handler/definition.mjs +1 -21
- package/dist/esm-node/effect/module.mjs +4 -4
- package/dist/esm-node/effect/operation-context.mjs +1 -1
- package/dist/esm-node/effect-client/cross-project.mjs +55 -0
- package/dist/esm-node/effect-client/index.mjs +4 -2
- package/dist/esm-node/microvertical-api.mjs +68 -0
- package/dist/types/assembly.d.ts +10 -0
- package/dist/types/effect/context.d.ts +1 -1
- package/dist/types/effect/edge-context.d.ts +1 -1
- package/dist/types/effect/edge-dispatcher.d.ts +2 -2
- package/dist/types/effect/edge.d.ts +1 -0
- package/dist/types/effect/endpoint-contracts.d.ts +2 -20
- package/dist/types/effect/entry-shape.d.ts +2 -2
- package/dist/types/effect/generated-entry.d.ts +7 -0
- package/dist/types/effect/handler/batch.d.ts +7 -1
- package/dist/types/effect/handler/types.d.ts +0 -15
- package/dist/types/effect/handler.d.ts +1 -1
- package/dist/types/effect/operation-context.d.ts +1 -1
- package/dist/types/effect-client/cross-project.d.ts +10 -0
- package/dist/types/effect-client/index.d.ts +4 -1
- package/dist/types/microvertical-api.d.ts +65 -0
- package/package.json +26 -13
- package/src/assembly.ts +43 -0
- package/src/data-platform/batch/queue.ts +2 -3
- package/src/data-platform/trace.ts +1 -1
- package/src/effect/edge-dispatcher.ts +7 -5
- package/src/effect/edge.ts +1 -0
- package/src/effect/endpoint-contracts.ts +3 -24
- package/src/effect/entry-shape.ts +10 -5
- package/src/effect/generated-entry.ts +36 -0
- package/src/effect/handler/batch-handler.ts +21 -16
- package/src/effect/handler/batch.ts +9 -1
- package/src/effect/handler/definition.ts +0 -44
- package/src/effect/handler/http.ts +2 -2
- package/src/effect/handler/types.ts +0 -27
- package/src/effect/handler.ts +0 -1
- package/src/effect/module.ts +4 -4
- package/src/effect/operation-context.ts +1 -1
- package/src/effect-client/cross-project.ts +109 -0
- package/src/effect-client/index.ts +13 -3
- package/src/microvertical-api.ts +102 -0
- package/dist/cjs/effect-client/batch.js +0 -73
- package/dist/cjs/effect-client/envelope.js +0 -145
- package/dist/cjs/effect-client/request-context.js +0 -64
- package/dist/cjs/effect-client/request.js +0 -66
- package/dist/cjs/effect-client/runtime.js +0 -100
- package/dist/cjs/effect-client/types.js +0 -18
- package/dist/esm/effect-client/batch.mjs +0 -35
- package/dist/esm/effect-client/envelope.mjs +0 -104
- package/dist/esm/effect-client/guards.mjs +0 -3
- package/dist/esm/effect-client/request-context.mjs +0 -23
- package/dist/esm/effect-client/request.mjs +0 -28
- package/dist/esm/effect-client/runtime.mjs +0 -62
- package/dist/esm/effect-client/types.mjs +0 -0
- package/dist/esm-node/effect-client/batch.mjs +0 -36
- package/dist/esm-node/effect-client/envelope.mjs +0 -105
- package/dist/esm-node/effect-client/guards.mjs +0 -4
- package/dist/esm-node/effect-client/request-context.mjs +0 -24
- package/dist/esm-node/effect-client/request.mjs +0 -29
- package/dist/esm-node/effect-client/runtime.mjs +0 -63
- package/dist/esm-node/effect-client/types.mjs +0 -1
- package/dist/types/effect-client/batch.d.ts +0 -2
- package/dist/types/effect-client/envelope.d.ts +0 -15
- package/dist/types/effect-client/guards.d.ts +0 -2
- package/dist/types/effect-client/request-context.d.ts +0 -3
- package/dist/types/effect-client/request.d.ts +0 -1
- package/dist/types/effect-client/runtime.d.ts +0 -5
- package/dist/types/effect-client/types.d.ts +0 -68
- package/src/effect-client/batch.ts +0 -50
- package/src/effect-client/envelope.ts +0 -238
- package/src/effect-client/guards.ts +0 -6
- package/src/effect-client/request-context.ts +0 -54
- package/src/effect-client/request.ts +0 -51
- package/src/effect-client/runtime.ts +0 -122
- package/src/effect-client/types.ts +0 -84
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
MicroVerticalBuildMarkerSchema: ()=>MicroVerticalBuildMarkerSchema,
|
|
32
|
+
MicroVerticalOperationContextSchema: ()=>MicroVerticalOperationContextSchema,
|
|
33
|
+
MicroVerticalOperationSourceSchema: ()=>MicroVerticalOperationSourceSchema,
|
|
34
|
+
MicroVerticalReadinessSchema: ()=>MicroVerticalReadinessSchema,
|
|
35
|
+
createMicroVerticalOperationContext: ()=>createMicroVerticalOperationContext,
|
|
36
|
+
microVerticalOperationAttributes: ()=>microVerticalOperationAttributes
|
|
37
|
+
});
|
|
38
|
+
const external_effect_namespaceObject = require("effect");
|
|
39
|
+
const MicroVerticalAppIdSchema = external_effect_namespaceObject.Schema.String.pipe(external_effect_namespaceObject.Schema.brand('MicroVerticalAppId'), external_effect_namespaceObject.Schema.decodeTo(external_effect_namespaceObject.Schema.String));
|
|
40
|
+
const MicroVerticalUnitIdSchema = external_effect_namespaceObject.Schema.String.pipe(external_effect_namespaceObject.Schema.brand('MicroVerticalUnitId'), external_effect_namespaceObject.Schema.decodeTo(external_effect_namespaceObject.Schema.String));
|
|
41
|
+
const MicroVerticalOperationIdSchema = external_effect_namespaceObject.Schema.String.pipe(external_effect_namespaceObject.Schema.brand('MicroVerticalOperationId'), external_effect_namespaceObject.Schema.decodeTo(external_effect_namespaceObject.Schema.String));
|
|
42
|
+
const MicroVerticalTraceIdSchema = external_effect_namespaceObject.Schema.String.pipe(external_effect_namespaceObject.Schema.brand('MicroVerticalTraceId'), external_effect_namespaceObject.Schema.decodeTo(external_effect_namespaceObject.Schema.String));
|
|
43
|
+
const MicroVerticalBuildMarkerSchema = external_effect_namespaceObject.Schema.Struct({
|
|
44
|
+
appId: MicroVerticalAppIdSchema,
|
|
45
|
+
build: external_effect_namespaceObject.Schema.String,
|
|
46
|
+
buildMarker: external_effect_namespaceObject.Schema.String,
|
|
47
|
+
deployProfile: external_effect_namespaceObject.Schema.String,
|
|
48
|
+
packageName: external_effect_namespaceObject.Schema.String,
|
|
49
|
+
sourceRevision: external_effect_namespaceObject.Schema.String,
|
|
50
|
+
surface: external_effect_namespaceObject.Schema.String,
|
|
51
|
+
unitId: MicroVerticalUnitIdSchema,
|
|
52
|
+
version: external_effect_namespaceObject.Schema.String
|
|
53
|
+
});
|
|
54
|
+
const MicroVerticalReadinessSchema = external_effect_namespaceObject.Schema.Struct({
|
|
55
|
+
checks: external_effect_namespaceObject.Schema.Struct({
|
|
56
|
+
api: external_effect_namespaceObject.Schema.Literal('ready'),
|
|
57
|
+
moduleFederation: external_effect_namespaceObject.Schema.Literal('ready'),
|
|
58
|
+
ssr: external_effect_namespaceObject.Schema.Literal('ready'),
|
|
59
|
+
translations: external_effect_namespaceObject.Schema.Literal('ready')
|
|
60
|
+
}),
|
|
61
|
+
marker: MicroVerticalBuildMarkerSchema,
|
|
62
|
+
status: external_effect_namespaceObject.Schema.Literal('ready'),
|
|
63
|
+
versionSkew: external_effect_namespaceObject.Schema.Literal('none')
|
|
64
|
+
});
|
|
65
|
+
const MicroVerticalOperationSourceSchema = external_effect_namespaceObject.Schema.Literals([
|
|
66
|
+
'client',
|
|
67
|
+
'server',
|
|
68
|
+
'generated-client',
|
|
69
|
+
'effect-adapter',
|
|
70
|
+
'data-platform',
|
|
71
|
+
'unknown'
|
|
72
|
+
]);
|
|
73
|
+
const MicroVerticalOperationContextSchema = external_effect_namespaceObject.Schema.Struct({
|
|
74
|
+
method: external_effect_namespaceObject.Schema.String,
|
|
75
|
+
operationId: MicroVerticalOperationIdSchema,
|
|
76
|
+
routePath: external_effect_namespaceObject.Schema.String,
|
|
77
|
+
source: MicroVerticalOperationSourceSchema,
|
|
78
|
+
traceId: external_effect_namespaceObject.Schema.optionalKey(MicroVerticalTraceIdSchema)
|
|
79
|
+
});
|
|
80
|
+
const createMicroVerticalOperationContext = (input)=>{
|
|
81
|
+
const context = {
|
|
82
|
+
method: input.method,
|
|
83
|
+
operationId: input.operationId,
|
|
84
|
+
routePath: input.routePath,
|
|
85
|
+
source: 'generated-client'
|
|
86
|
+
};
|
|
87
|
+
return void 0 === input.traceId ? context : {
|
|
88
|
+
...context,
|
|
89
|
+
traceId: input.traceId
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
const microVerticalOperationAttributes = (operationContext)=>{
|
|
93
|
+
const attributes = {
|
|
94
|
+
'modernjs.operation.id': operationContext.operationId,
|
|
95
|
+
'modernjs.operation.method': operationContext.method,
|
|
96
|
+
'modernjs.operation.route': operationContext.routePath,
|
|
97
|
+
'modernjs.operation.source': operationContext.source
|
|
98
|
+
};
|
|
99
|
+
return void 0 === operationContext.traceId ? attributes : {
|
|
100
|
+
...attributes,
|
|
101
|
+
'modernjs.trace.id': operationContext.traceId
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
exports.MicroVerticalBuildMarkerSchema = __webpack_exports__.MicroVerticalBuildMarkerSchema;
|
|
105
|
+
exports.MicroVerticalOperationContextSchema = __webpack_exports__.MicroVerticalOperationContextSchema;
|
|
106
|
+
exports.MicroVerticalOperationSourceSchema = __webpack_exports__.MicroVerticalOperationSourceSchema;
|
|
107
|
+
exports.MicroVerticalReadinessSchema = __webpack_exports__.MicroVerticalReadinessSchema;
|
|
108
|
+
exports.createMicroVerticalOperationContext = __webpack_exports__.createMicroVerticalOperationContext;
|
|
109
|
+
exports.microVerticalOperationAttributes = __webpack_exports__.microVerticalOperationAttributes;
|
|
110
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
111
|
+
"MicroVerticalBuildMarkerSchema",
|
|
112
|
+
"MicroVerticalOperationContextSchema",
|
|
113
|
+
"MicroVerticalOperationSourceSchema",
|
|
114
|
+
"MicroVerticalReadinessSchema",
|
|
115
|
+
"createMicroVerticalOperationContext",
|
|
116
|
+
"microVerticalOperationAttributes"
|
|
117
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
118
|
+
Object.defineProperty(exports, '__esModule', {
|
|
119
|
+
value: true
|
|
120
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
2
|
+
import { defineEffectBff } from "./effect/handler/definition.mjs";
|
|
3
|
+
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
4
|
+
const assembleEffectBffRuntime = ({ api, handlers, transport })=>{
|
|
5
|
+
const apiLayer = HttpApiBuilder.layer(api).pipe(__rspack_external_effect_Layer_69c46453.provide(handlers));
|
|
6
|
+
const layer = void 0 === transport ? apiLayer : apiLayer.pipe(__rspack_external_effect_Layer_69c46453.merge(transport));
|
|
7
|
+
return defineEffectBff({
|
|
8
|
+
api,
|
|
9
|
+
layer
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { assembleEffectBffRuntime };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { evaluateCrossProjectPolicy, resolveCrossProjectRequestObservation } from "@modern-js/
|
|
1
|
+
import { evaluateCrossProjectPolicy, resolveCrossProjectRequestObservation } from "@modern-js/server-runtime-extensions/bff-policy";
|
|
2
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
2
3
|
import { toHeaderRecord } from "../headers.mjs";
|
|
3
4
|
import { dispatchEffectBffRequestWithContext } from "./dispatch.mjs";
|
|
4
5
|
import { runWithEffectContext, useEffectContext, useOperationContext } from "./edge-context.mjs";
|
|
5
6
|
import { resolveEffectBffModuleHandler } from "./module.mjs";
|
|
6
7
|
import * as __rspack_external_effect_Config_76cfa59d from "effect/Config";
|
|
7
|
-
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
8
8
|
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
9
9
|
import * as __rspack_external_effect_Option_0498e63a from "effect/Option";
|
|
10
10
|
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
@@ -90,9 +90,9 @@ async function createEffectBffEdgeDispatcher(options) {
|
|
|
90
90
|
dispose: ()=>{
|
|
91
91
|
disposePromise ??= (async ()=>{
|
|
92
92
|
acceptingRequests = false;
|
|
93
|
-
if (activeDispatches > 0) await
|
|
94
|
-
resolveDrain =
|
|
95
|
-
});
|
|
93
|
+
if (activeDispatches > 0) await __rspack_external_effect_Effect_41060786.runPromise(__rspack_external_effect_Effect_41060786.callback((resume)=>{
|
|
94
|
+
resolveDrain = ()=>resume(__rspack_external_effect_Effect_41060786["void"]);
|
|
95
|
+
}));
|
|
96
96
|
await loaded.dispose?.();
|
|
97
97
|
})();
|
|
98
98
|
return disposePromise;
|
package/dist/esm/effect/edge.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { createOperationContractHash } from "@modern-js/bff-
|
|
1
|
+
import { createOperationContractHash } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
2
2
|
import { classifyEffectBffEntryModule, isValidatorAwareHandlerFactory } from "./entry-shape.mjs";
|
|
3
3
|
function resolveEffectEndpointName(endpoint) {
|
|
4
4
|
if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
|
|
5
|
-
if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
|
|
6
5
|
return '';
|
|
7
6
|
}
|
|
8
7
|
function ensureLeadingSlash(pathname) {
|
|
@@ -60,7 +59,7 @@ async function extractHttpApiFromModule(mod, isHttpApi) {
|
|
|
60
59
|
isValidatorAwareHandlerFactory: isValidatorAwareHandlerFactory,
|
|
61
60
|
isHttpApi
|
|
62
61
|
});
|
|
63
|
-
return !facts?.
|
|
62
|
+
return !facts?.unsupportedShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
|
|
64
63
|
}
|
|
65
64
|
function createEffectEndpointContractHash(endpoint, requestId) {
|
|
66
65
|
return createOperationContractHash(createEffectOperationContractSource(endpoint), requestId);
|
|
@@ -34,13 +34,13 @@ function classifyEffectBffEntryModule(value, predicates) {
|
|
|
34
34
|
if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
|
|
35
35
|
return createEntryShapeFacts(module, predicates);
|
|
36
36
|
}
|
|
37
|
-
function createEntryShapeFacts(module, predicates,
|
|
37
|
+
function createEntryShapeFacts(module, predicates, unsupportedShape) {
|
|
38
38
|
const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
|
|
39
39
|
const api = predicates.isHttpApi(module.api) ? module.api : void 0;
|
|
40
40
|
const hasRuntimeLayer = void 0 !== module.layer;
|
|
41
41
|
return {
|
|
42
42
|
module,
|
|
43
|
-
|
|
43
|
+
unsupportedShape,
|
|
44
44
|
createHandler,
|
|
45
45
|
createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
|
|
46
46
|
api,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createEffectBffEdgeDispatcher } from "./edge-dispatcher.mjs";
|
|
2
|
+
function createEffectBffEdgeDispatcherFactory(module, generatedOperationContracts) {
|
|
3
|
+
return (options)=>{
|
|
4
|
+
const policy = options?.crossProjectPolicy;
|
|
5
|
+
const crossProjectPolicy = null == policy || null === policy.expectedOperationContracts || 'object' != typeof policy.expectedOperationContracts || Array.isArray(policy.expectedOperationContracts) ? policy : {
|
|
6
|
+
...policy,
|
|
7
|
+
expectedOperationContracts: {
|
|
8
|
+
...policy.expectedOperationContracts,
|
|
9
|
+
...generatedOperationContracts
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return createEffectBffEdgeDispatcher({
|
|
13
|
+
...options,
|
|
14
|
+
crossProjectPolicy,
|
|
15
|
+
module
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export { createEffectBffEdgeDispatcherFactory };
|
|
@@ -2,6 +2,7 @@ import { DEFAULT_DATA_BATCH_HEADER, DEFAULT_DATA_ENVELOPE_HEADER, decodeRequestE
|
|
|
2
2
|
import { decodeBatchBody, isBatchBody, toBatchResponseItem } from "../../data-platform/batch/protocol.mjs";
|
|
3
3
|
import { BatchItemTimeoutError, createBatchValidationResponse, isBatchRequestPayload, mapWithConcurrency, normalizeBatchAllowedMethods, normalizeBatchPath, promiseWithTimeout, toBatchItemError } from "./batch.mjs";
|
|
4
4
|
import { getMountedPrefixFromContext, removeMountedPrefixFromBatchPath } from "./routing.mjs";
|
|
5
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
5
6
|
const HOP_BY_HOP_BATCH_ITEM_HEADERS = new Set([
|
|
6
7
|
'connection',
|
|
7
8
|
'keep-alive',
|
|
@@ -184,25 +185,25 @@ function createDataPlatformBatchRequestHandler(options) {
|
|
|
184
185
|
return toBatchResponseItem(itemId, itemResponse, 'HEAD' === itemMethod);
|
|
185
186
|
} catch (error) {
|
|
186
187
|
if (error instanceof BatchItemTimeoutError) {
|
|
187
|
-
|
|
188
|
+
__rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Effect_41060786.logError({
|
|
188
189
|
event: 'bff.batch.item.timeout',
|
|
189
190
|
batchId: payload.batchId,
|
|
190
191
|
itemId,
|
|
191
192
|
method: itemMethod,
|
|
192
193
|
path: itemPathname,
|
|
193
194
|
errorName: error.name
|
|
194
|
-
});
|
|
195
|
+
}));
|
|
195
196
|
return toBatchItemError(itemId, 504, 'Batch item request timed out');
|
|
196
197
|
}
|
|
197
198
|
if (error instanceof Response) return toBatchResponseItem(itemId, error, 'HEAD' === itemMethod);
|
|
198
|
-
|
|
199
|
+
__rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Effect_41060786.logError({
|
|
199
200
|
event: 'bff.batch.item.failure',
|
|
200
201
|
batchId: payload.batchId,
|
|
201
202
|
itemId,
|
|
202
203
|
method: itemMethod,
|
|
203
204
|
path: itemPathname,
|
|
204
205
|
errorName: error instanceof Error ? error.name : 'UnknownError'
|
|
205
|
-
});
|
|
206
|
+
}));
|
|
206
207
|
return toBatchItemError(itemId, 500, 'Internal Server Error');
|
|
207
208
|
} finally{
|
|
208
209
|
request.signal.removeEventListener('abort', abortFromBatchRequest);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_DATA_BATCH_ENDPOINT, isPlainObject, normalizeMethod } from "../../data-platform/index.mjs";
|
|
2
2
|
import { encodeBatchText } from "../../data-platform/batch/protocol.mjs";
|
|
3
|
+
import * as __rspack_external_effect_Data_2b3f4efb from "effect/Data";
|
|
3
4
|
function normalizeBatchPath(pathname) {
|
|
4
5
|
if (!pathname || '/' === pathname) return DEFAULT_DATA_BATCH_ENDPOINT;
|
|
5
6
|
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
@@ -64,7 +65,13 @@ function toBatchItemError(id, status, message) {
|
|
|
64
65
|
}))
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
class BatchItemTimeoutError extends
|
|
68
|
+
class BatchItemTimeoutError extends __rspack_external_effect_Data_2b3f4efb.TaggedError('BatchItemTimeoutError') {
|
|
69
|
+
constructor(message){
|
|
70
|
+
super({
|
|
71
|
+
message
|
|
72
|
+
});
|
|
73
|
+
this.name = 'Error';
|
|
74
|
+
}
|
|
68
75
|
}
|
|
69
76
|
function promiseWithTimeout(effect, timeoutMs, onTimeout) {
|
|
70
77
|
if (timeoutMs <= 0) return effect;
|
|
@@ -20,30 +20,10 @@ function defineEffectBff(definition) {
|
|
|
20
20
|
validateRequest: options?.validateRequest
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
|
-
const client = createLoaderMaterializedClientPlaceholder();
|
|
24
23
|
return {
|
|
25
24
|
...definition,
|
|
26
|
-
createHandler
|
|
27
|
-
client
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const LOADER_CLIENT_IGNORED_KEYS = new Set([
|
|
31
|
-
'then',
|
|
32
|
-
'catch',
|
|
33
|
-
'finally',
|
|
34
|
-
'toJSON',
|
|
35
|
-
'$$typeof'
|
|
36
|
-
]);
|
|
37
|
-
function createLoaderMaterializedClientPlaceholder() {
|
|
38
|
-
const explain = (property)=>{
|
|
39
|
-
throw new Error(`[BFF][Effect] client.${String(property)} is not available here: the typed client only exists when the API entry is imported through the "@api/index" transformed path (the BFF loader replaces it with generated client code). On the server, use HttpApiClient or call the Effect layer directly.`);
|
|
25
|
+
createHandler
|
|
40
26
|
};
|
|
41
|
-
return new Proxy(Object.create(null), {
|
|
42
|
-
get (_target, property) {
|
|
43
|
-
if ('symbol' == typeof property || LOADER_CLIENT_IGNORED_KEYS.has(property)) return;
|
|
44
|
-
return explain(property);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
27
|
}
|
|
48
28
|
function defineEffectRpcBff(definition) {
|
|
49
29
|
const createHandler = (options)=>createRpcApiHandler({
|
|
@@ -11,7 +11,7 @@ function shareDispose(dispose) {
|
|
|
11
11
|
return disposePromise;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function rejectUnsupportedEffectModuleShape(options, shape) {
|
|
15
15
|
options.onWarning?.(`${strictEffectApproachMessage} Rejected ${shape}.`);
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
@@ -39,8 +39,8 @@ function classifyEffectBffRuntimeEntryShape(module) {
|
|
|
39
39
|
}
|
|
40
40
|
function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
41
41
|
if (!facts) return null;
|
|
42
|
-
if (facts.
|
|
43
|
-
if (
|
|
42
|
+
if (facts.unsupportedShape) {
|
|
43
|
+
if (rejectUnsupportedEffectModuleShape(options, facts.unsupportedShape)) return null;
|
|
44
44
|
}
|
|
45
45
|
if ('function' == typeof facts.createHandler) {
|
|
46
46
|
if (facts.createHandlerValidatorAware) {
|
|
@@ -53,7 +53,7 @@ function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
|
53
53
|
return createLoadedHandler(webHandler);
|
|
54
54
|
}
|
|
55
55
|
if (void 0 === facts.api || !facts.hasRuntimeLayer) {
|
|
56
|
-
|
|
56
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded `createHandler` export');
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
options.onWarning?.(`${strictEffectApproachMessage} Ignored unbranded \`createHandler\` export and rebuilt the handler from its { api, layer } exports.`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BFF_LOCALE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, BFF_TRACEPARENT_HEADER, parseTraceparent } from "@modern-js/
|
|
1
|
+
import { BFF_LOCALE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, BFF_TRACEPARENT_HEADER, parseTraceparent } from "@modern-js/runtime-extensions/request-context";
|
|
2
2
|
const kEffectContextStorage = Symbol.for('modernjs.plugin-bff.effectContextStorage');
|
|
3
3
|
const readHeader = (headers, header)=>{
|
|
4
4
|
const value = headers.get(header);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BFF_ENVELOPE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, resolveCrossProjectRequestObservation } from "@modern-js/server-runtime-extensions/bff-policy";
|
|
2
|
+
import { HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
3
|
+
import { HttpApi } from "effect/unstable/httpapi";
|
|
4
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
5
|
+
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
6
|
+
const encodeJson = __rspack_external_effect_Schema_6065f72d.encodeSync(__rspack_external_effect_Schema_6065f72d.fromJsonString(__rspack_external_effect_Schema_6065f72d.Unknown));
|
|
7
|
+
function withCrossProjectPolicy(api, options, client) {
|
|
8
|
+
const contracts = {};
|
|
9
|
+
const prefix = options.prefix.replace(/\/$/, '');
|
|
10
|
+
HttpApi.reflect(api, {
|
|
11
|
+
onGroup: ()=>{},
|
|
12
|
+
onEndpoint: ({ endpoint })=>{
|
|
13
|
+
const routePath = `${prefix}${'/' === endpoint.path ? '' : endpoint.path}` || '/';
|
|
14
|
+
const name = endpoint.identifier;
|
|
15
|
+
contracts[`${endpoint.method}:${routePath}`] = {
|
|
16
|
+
operationId: `${options.requestId}:${name}`,
|
|
17
|
+
name,
|
|
18
|
+
method: endpoint.method,
|
|
19
|
+
routePath
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return client.pipe(HttpClient.mapRequestEffect((request)=>{
|
|
24
|
+
const observed = resolveCrossProjectRequestObservation({
|
|
25
|
+
method: request.method,
|
|
26
|
+
pathname: new URL(request.url, 'http://effect.invalid').pathname
|
|
27
|
+
}, {
|
|
28
|
+
expectedOperationContracts: contracts
|
|
29
|
+
});
|
|
30
|
+
const contract = observed && contracts[`${observed.method}:${observed.routePath}`];
|
|
31
|
+
if (void 0 === contract) return __rspack_external_effect_Effect_41060786.die(new Error('[BFF][Effect] Request has no matching shared operation contract.'));
|
|
32
|
+
return __rspack_external_effect_Effect_41060786.gen(function*() {
|
|
33
|
+
const input = encodeJson({
|
|
34
|
+
httpMethod: contract.method,
|
|
35
|
+
name: contract.name,
|
|
36
|
+
requestId: options.requestId,
|
|
37
|
+
routePath: contract.routePath
|
|
38
|
+
});
|
|
39
|
+
const digest = yield* __rspack_external_effect_Effect_41060786.promise(()=>globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(input)));
|
|
40
|
+
const schemaHash = Array.from(new Uint8Array(digest), (value)=>value.toString(16).padStart(2, '0')).join('');
|
|
41
|
+
return request.pipe(HttpClientRequest.setHeader(BFF_ENVELOPE_HEADER, encodeJson({
|
|
42
|
+
requestId: options.requestId
|
|
43
|
+
})), HttpClientRequest.setHeader(BFF_OPERATION_CONTEXT_HEADER, contract.operationId), HttpClientRequest.setHeader(BFF_OPERATION_CONTEXT_DETAIL_HEADER, encodeJson({
|
|
44
|
+
requestId: options.requestId,
|
|
45
|
+
operationId: contract.operationId,
|
|
46
|
+
method: contract.method,
|
|
47
|
+
routePath: contract.routePath,
|
|
48
|
+
schemaHash,
|
|
49
|
+
operationVersion: options.operationVersion
|
|
50
|
+
})));
|
|
51
|
+
});
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
export { withCrossProjectPolicy };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { createRequestContextHeaders } from "@modern-js/
|
|
1
|
+
import { createRequestContextHeaders } from "@modern-js/runtime-extensions/request-context";
|
|
2
2
|
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
3
3
|
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
4
4
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
5
5
|
import { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
6
6
|
import { Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization } from "effect/unstable/rpc";
|
|
7
7
|
import { getRpcSerializationLayer } from "../effect/rpcSerialization.mjs";
|
|
8
|
+
import { withCrossProjectPolicy } from "./cross-project.mjs";
|
|
8
9
|
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
9
10
|
import * as __rspack_external_effect_unstable_http_HttpClientError_4b9eaee6 from "effect/unstable/http/HttpClientError";
|
|
10
11
|
import * as __rspack_external_effect_Data_2b3f4efb from "effect/Data";
|
|
@@ -46,7 +47,8 @@ function makeEffectHttpApiClient(api, options) {
|
|
|
46
47
|
for (const [header, value] of Object.entries(requestContextHeaders))if (void 0 === nextRequest.headers[header.toLowerCase()]) nextRequest = HttpClientRequest.setHeader(nextRequest, header, value);
|
|
47
48
|
return nextRequest;
|
|
48
49
|
}));
|
|
49
|
-
|
|
50
|
+
const policyClient = options?.crossProject !== void 0 ? withCrossProjectPolicy(api, options.crossProject, contextClient) : contextClient;
|
|
51
|
+
return 'function' == typeof options?.transformClient ? options.transformClient(policyClient) : policyClient;
|
|
50
52
|
};
|
|
51
53
|
return HttpApiClient.make(api, {
|
|
52
54
|
baseUrl: options?.baseUrl,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
const MicroVerticalAppIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalAppId'), Schema.decodeTo(Schema.String));
|
|
3
|
+
const MicroVerticalUnitIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalUnitId'), Schema.decodeTo(Schema.String));
|
|
4
|
+
const MicroVerticalOperationIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalOperationId'), Schema.decodeTo(Schema.String));
|
|
5
|
+
const MicroVerticalTraceIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalTraceId'), Schema.decodeTo(Schema.String));
|
|
6
|
+
const MicroVerticalBuildMarkerSchema = Schema.Struct({
|
|
7
|
+
appId: MicroVerticalAppIdSchema,
|
|
8
|
+
build: Schema.String,
|
|
9
|
+
buildMarker: Schema.String,
|
|
10
|
+
deployProfile: Schema.String,
|
|
11
|
+
packageName: Schema.String,
|
|
12
|
+
sourceRevision: Schema.String,
|
|
13
|
+
surface: Schema.String,
|
|
14
|
+
unitId: MicroVerticalUnitIdSchema,
|
|
15
|
+
version: Schema.String
|
|
16
|
+
});
|
|
17
|
+
const MicroVerticalReadinessSchema = Schema.Struct({
|
|
18
|
+
checks: Schema.Struct({
|
|
19
|
+
api: Schema.Literal('ready'),
|
|
20
|
+
moduleFederation: Schema.Literal('ready'),
|
|
21
|
+
ssr: Schema.Literal('ready'),
|
|
22
|
+
translations: Schema.Literal('ready')
|
|
23
|
+
}),
|
|
24
|
+
marker: MicroVerticalBuildMarkerSchema,
|
|
25
|
+
status: Schema.Literal('ready'),
|
|
26
|
+
versionSkew: Schema.Literal('none')
|
|
27
|
+
});
|
|
28
|
+
const MicroVerticalOperationSourceSchema = Schema.Literals([
|
|
29
|
+
'client',
|
|
30
|
+
'server',
|
|
31
|
+
'generated-client',
|
|
32
|
+
'effect-adapter',
|
|
33
|
+
'data-platform',
|
|
34
|
+
'unknown'
|
|
35
|
+
]);
|
|
36
|
+
const MicroVerticalOperationContextSchema = Schema.Struct({
|
|
37
|
+
method: Schema.String,
|
|
38
|
+
operationId: MicroVerticalOperationIdSchema,
|
|
39
|
+
routePath: Schema.String,
|
|
40
|
+
source: MicroVerticalOperationSourceSchema,
|
|
41
|
+
traceId: Schema.optionalKey(MicroVerticalTraceIdSchema)
|
|
42
|
+
});
|
|
43
|
+
const createMicroVerticalOperationContext = (input)=>{
|
|
44
|
+
const context = {
|
|
45
|
+
method: input.method,
|
|
46
|
+
operationId: input.operationId,
|
|
47
|
+
routePath: input.routePath,
|
|
48
|
+
source: 'generated-client'
|
|
49
|
+
};
|
|
50
|
+
return void 0 === input.traceId ? context : {
|
|
51
|
+
...context,
|
|
52
|
+
traceId: input.traceId
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const microVerticalOperationAttributes = (operationContext)=>{
|
|
56
|
+
const attributes = {
|
|
57
|
+
'modernjs.operation.id': operationContext.operationId,
|
|
58
|
+
'modernjs.operation.method': operationContext.method,
|
|
59
|
+
'modernjs.operation.route': operationContext.routePath,
|
|
60
|
+
'modernjs.operation.source': operationContext.source
|
|
61
|
+
};
|
|
62
|
+
return void 0 === operationContext.traceId ? attributes : {
|
|
63
|
+
...attributes,
|
|
64
|
+
'modernjs.trace.id': operationContext.traceId
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export { MicroVerticalBuildMarkerSchema, MicroVerticalOperationContextSchema, MicroVerticalOperationSourceSchema, MicroVerticalReadinessSchema, createMicroVerticalOperationContext, microVerticalOperationAttributes };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
3
|
+
import { defineEffectBff } from "./effect/handler/definition.mjs";
|
|
4
|
+
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
5
|
+
const assembleEffectBffRuntime = ({ api, handlers, transport })=>{
|
|
6
|
+
const apiLayer = HttpApiBuilder.layer(api).pipe(__rspack_external_effect_Layer_69c46453.provide(handlers));
|
|
7
|
+
const layer = void 0 === transport ? apiLayer : apiLayer.pipe(__rspack_external_effect_Layer_69c46453.merge(transport));
|
|
8
|
+
return defineEffectBff({
|
|
9
|
+
api,
|
|
10
|
+
layer
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { assembleEffectBffRuntime };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { evaluateCrossProjectPolicy, resolveCrossProjectRequestObservation } from "@modern-js/
|
|
2
|
+
import { evaluateCrossProjectPolicy, resolveCrossProjectRequestObservation } from "@modern-js/server-runtime-extensions/bff-policy";
|
|
3
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
3
4
|
import { toHeaderRecord } from "../headers.mjs";
|
|
4
5
|
import { dispatchEffectBffRequestWithContext } from "./dispatch.mjs";
|
|
5
6
|
import { runWithEffectContext, useEffectContext, useOperationContext } from "./edge-context.mjs";
|
|
6
7
|
import { resolveEffectBffModuleHandler } from "./module.mjs";
|
|
7
8
|
import * as __rspack_external_effect_Config_76cfa59d from "effect/Config";
|
|
8
|
-
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
9
9
|
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
10
10
|
import * as __rspack_external_effect_Option_0498e63a from "effect/Option";
|
|
11
11
|
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
@@ -91,9 +91,9 @@ async function createEffectBffEdgeDispatcher(options) {
|
|
|
91
91
|
dispose: ()=>{
|
|
92
92
|
disposePromise ??= (async ()=>{
|
|
93
93
|
acceptingRequests = false;
|
|
94
|
-
if (activeDispatches > 0) await
|
|
95
|
-
resolveDrain =
|
|
96
|
-
});
|
|
94
|
+
if (activeDispatches > 0) await __rspack_external_effect_Effect_41060786.runPromise(__rspack_external_effect_Effect_41060786.callback((resume)=>{
|
|
95
|
+
resolveDrain = ()=>resume(__rspack_external_effect_Effect_41060786["void"]);
|
|
96
|
+
}));
|
|
97
97
|
await loaded.dispose?.();
|
|
98
98
|
})();
|
|
99
99
|
return disposePromise;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { createOperationContractHash } from "@modern-js/bff-
|
|
2
|
+
import { createOperationContractHash } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
3
3
|
import { classifyEffectBffEntryModule, isValidatorAwareHandlerFactory } from "./entry-shape.mjs";
|
|
4
4
|
function resolveEffectEndpointName(endpoint) {
|
|
5
5
|
if ('string' == typeof endpoint.identifier && endpoint.identifier) return endpoint.identifier;
|
|
6
|
-
if ('string' == typeof endpoint.name && endpoint.name) return endpoint.name;
|
|
7
6
|
return '';
|
|
8
7
|
}
|
|
9
8
|
function ensureLeadingSlash(pathname) {
|
|
@@ -61,7 +60,7 @@ async function extractHttpApiFromModule(mod, isHttpApi) {
|
|
|
61
60
|
isValidatorAwareHandlerFactory: isValidatorAwareHandlerFactory,
|
|
62
61
|
isHttpApi
|
|
63
62
|
});
|
|
64
|
-
return !facts?.
|
|
63
|
+
return !facts?.unsupportedShape && facts?.api !== void 0 && facts.hasRuntimeLayer && (void 0 === facts.createHandler || facts.createHandlerValidatorAware) ? facts.api : null;
|
|
65
64
|
}
|
|
66
65
|
function createEffectEndpointContractHash(endpoint, requestId) {
|
|
67
66
|
return createOperationContractHash(createEffectOperationContractSource(endpoint), requestId);
|
|
@@ -46,13 +46,13 @@ function classifyEffectBffEntryModule(value, predicates) {
|
|
|
46
46
|
if (predicates.isRequestHandler(module.handler)) return createEntryShapeFacts(module, predicates, '`handler` export');
|
|
47
47
|
return createEntryShapeFacts(module, predicates);
|
|
48
48
|
}
|
|
49
|
-
function createEntryShapeFacts(module, predicates,
|
|
49
|
+
function createEntryShapeFacts(module, predicates, unsupportedShape) {
|
|
50
50
|
const createHandler = 'function' == typeof module.createHandler ? module.createHandler : void 0;
|
|
51
51
|
const api = predicates.isHttpApi(module.api) ? module.api : void 0;
|
|
52
52
|
const hasRuntimeLayer = void 0 !== module.layer;
|
|
53
53
|
return {
|
|
54
54
|
module,
|
|
55
|
-
|
|
55
|
+
unsupportedShape,
|
|
56
56
|
createHandler,
|
|
57
57
|
createHandlerValidatorAware: void 0 !== createHandler && predicates.isValidatorAwareHandlerFactory(createHandler),
|
|
58
58
|
api,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { createEffectBffEdgeDispatcher } from "./edge-dispatcher.mjs";
|
|
3
|
+
function createEffectBffEdgeDispatcherFactory(module, generatedOperationContracts) {
|
|
4
|
+
return (options)=>{
|
|
5
|
+
const policy = options?.crossProjectPolicy;
|
|
6
|
+
const crossProjectPolicy = null == policy || null === policy.expectedOperationContracts || 'object' != typeof policy.expectedOperationContracts || Array.isArray(policy.expectedOperationContracts) ? policy : {
|
|
7
|
+
...policy,
|
|
8
|
+
expectedOperationContracts: {
|
|
9
|
+
...policy.expectedOperationContracts,
|
|
10
|
+
...generatedOperationContracts
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return createEffectBffEdgeDispatcher({
|
|
14
|
+
...options,
|
|
15
|
+
crossProjectPolicy,
|
|
16
|
+
module
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export { createEffectBffEdgeDispatcherFactory };
|