@bleedingdev/modern-js-plugin-bff-extensions 3.9.0-ultramodern.11 → 3.9.0-ultramodern.12
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/backend-federation/identity.js +23 -22
- package/dist/cjs/backend-federation-manifest/validation.js +11 -7
- package/dist/cjs/cross-project-policy/node.js +8 -28
- package/dist/cjs/effect-adapter/cross-project-policy.js +2 -2
- package/dist/cjs/effect-adapter/entry.js +8 -44
- package/dist/cjs/effect-adapter/index.js +10 -2
- package/dist/cjs/effect-source-loader/built-entry.js +4 -5
- package/dist/cjs/effect-source-loader/loader.js +2 -1
- package/dist/cjs/effect-source-loader/operation-contracts.js +8 -31
- package/dist/cjs/effect-source-loader/paths.js +38 -10
- package/dist/esm/backend-federation/identity.mjs +18 -23
- package/dist/esm/backend-federation-manifest/validation.mjs +12 -8
- package/dist/esm/cross-project-policy/node.mjs +9 -19
- package/dist/esm/effect-adapter/cross-project-policy.mjs +2 -2
- package/dist/esm/effect-adapter/entry.mjs +9 -45
- package/dist/esm/effect-adapter/index.mjs +10 -2
- package/dist/esm/effect-source-loader/built-entry.mjs +5 -6
- package/dist/esm/effect-source-loader/loader.mjs +2 -1
- package/dist/esm/effect-source-loader/operation-contracts.mjs +10 -33
- package/dist/esm/effect-source-loader/paths.mjs +30 -11
- package/dist/esm-node/backend-federation/identity.mjs +18 -23
- package/dist/esm-node/backend-federation-manifest/validation.mjs +12 -8
- package/dist/esm-node/cross-project-policy/node.mjs +9 -19
- package/dist/esm-node/effect-adapter/cross-project-policy.mjs +2 -2
- package/dist/esm-node/effect-adapter/entry.mjs +9 -45
- package/dist/esm-node/effect-adapter/index.mjs +10 -2
- package/dist/esm-node/effect-source-loader/built-entry.mjs +5 -6
- package/dist/esm-node/effect-source-loader/loader.mjs +2 -1
- package/dist/esm-node/effect-source-loader/operation-contracts.mjs +10 -33
- package/dist/esm-node/effect-source-loader/paths.mjs +30 -11
- package/dist/types/backend-federation/identity.d.ts +3 -6
- package/dist/types/cross-project-policy/node.d.ts +2 -2
- package/dist/types/effect-adapter/cross-project-policy.d.ts +2 -1
- package/dist/types/effect-source-loader/paths.d.ts +20 -2
- package/package.json +10 -10
- package/src/backend-federation/identity.ts +39 -47
- package/src/backend-federation-manifest/validation.ts +22 -29
- package/src/cross-project-policy/node.ts +7 -38
- package/src/effect-adapter/cross-project-policy.ts +7 -1
- package/src/effect-adapter/entry.ts +10 -88
- package/src/effect-adapter/index.ts +7 -1
- package/src/effect-source-loader/built-entry.ts +11 -9
- package/src/effect-source-loader/loader.ts +10 -5
- package/src/effect-source-loader/operation-contracts.ts +7 -41
- package/src/effect-source-loader/paths.ts +55 -21
|
@@ -28,47 +28,48 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
backendFederationCompatibility: ()=>backendFederationCompatibility,
|
|
31
32
|
formatBackendFederationIdentityIssues: ()=>formatBackendFederationIdentityIssues,
|
|
33
|
+
validateBackendFederationCompatibility: ()=>validateBackendFederationCompatibility,
|
|
32
34
|
validateExpectedBackendFederationIdentity: ()=>validateExpectedBackendFederationIdentity
|
|
33
35
|
});
|
|
34
36
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
35
|
-
function
|
|
36
|
-
const issues = [];
|
|
37
|
+
function backendFederationCompatibility(loaded) {
|
|
37
38
|
const contract = (0, external_utils_js_namespaceObject.isRecord)(loaded) ? loaded.backendFederationContract : void 0;
|
|
38
39
|
const compatibility = (0, external_utils_js_namespaceObject.isRecord)(contract) ? contract.compatibility : void 0;
|
|
39
|
-
|
|
40
|
+
return (0, external_utils_js_namespaceObject.isRecord)(compatibility) ? compatibility : void 0;
|
|
41
|
+
}
|
|
42
|
+
function validateBackendFederationCompatibility(compatibility, expected) {
|
|
43
|
+
return Object.entries(expected).flatMap(([field, value])=>void 0 === value || 'string' == typeof compatibility[field] && compatibility[field].length > 0 && compatibility[field] === value ? [] : [
|
|
44
|
+
{
|
|
45
|
+
path: `backendFederationContract.compatibility.${field}`,
|
|
46
|
+
message: `expected ${value}, received ${'string' == typeof compatibility[field] ? compatibility[field] : typeof compatibility[field]}`
|
|
47
|
+
}
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
function validateExpectedBackendFederationIdentity(loaded, expected) {
|
|
51
|
+
const compatibility = backendFederationCompatibility(loaded);
|
|
52
|
+
return compatibility ? validateBackendFederationCompatibility(compatibility, {
|
|
53
|
+
unitId: expected.unitId,
|
|
54
|
+
build: expected.buildMarker
|
|
55
|
+
}) : [
|
|
40
56
|
{
|
|
41
57
|
path: 'backendFederationContract.compatibility',
|
|
42
58
|
message: 'loaded module declares no compatibility metadata; delivery-unit identity cannot be validated'
|
|
43
59
|
}
|
|
44
60
|
];
|
|
45
|
-
const unitId = compatibility.unitId;
|
|
46
|
-
if ('string' != typeof unitId || 0 === unitId.length) issues.push({
|
|
47
|
-
path: 'backendFederationContract.compatibility.unitId',
|
|
48
|
-
message: `missing delivery-unit id; expected ${expected.unitId}`
|
|
49
|
-
});
|
|
50
|
-
else if (unitId !== expected.unitId) issues.push({
|
|
51
|
-
path: 'backendFederationContract.compatibility.unitId',
|
|
52
|
-
message: `expected ${expected.unitId}, received ${unitId}`
|
|
53
|
-
});
|
|
54
|
-
const build = compatibility.build;
|
|
55
|
-
if ('string' != typeof build || 0 === build.length) issues.push({
|
|
56
|
-
path: 'backendFederationContract.compatibility.build',
|
|
57
|
-
message: `missing build marker; expected ${expected.buildMarker}`
|
|
58
|
-
});
|
|
59
|
-
else if (build !== expected.buildMarker) issues.push({
|
|
60
|
-
path: 'backendFederationContract.compatibility.build',
|
|
61
|
-
message: `expected ${expected.buildMarker}, received ${build}`
|
|
62
|
-
});
|
|
63
|
-
return issues;
|
|
64
61
|
}
|
|
65
62
|
function formatBackendFederationIdentityIssues(issues) {
|
|
66
63
|
return issues.map((issue)=>`${issue.path}: ${issue.message}`).join('; ');
|
|
67
64
|
}
|
|
65
|
+
exports.backendFederationCompatibility = __webpack_exports__.backendFederationCompatibility;
|
|
68
66
|
exports.formatBackendFederationIdentityIssues = __webpack_exports__.formatBackendFederationIdentityIssues;
|
|
67
|
+
exports.validateBackendFederationCompatibility = __webpack_exports__.validateBackendFederationCompatibility;
|
|
69
68
|
exports.validateExpectedBackendFederationIdentity = __webpack_exports__.validateExpectedBackendFederationIdentity;
|
|
70
69
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
70
|
+
"backendFederationCompatibility",
|
|
71
71
|
"formatBackendFederationIdentityIssues",
|
|
72
|
+
"validateBackendFederationCompatibility",
|
|
72
73
|
"validateExpectedBackendFederationIdentity"
|
|
73
74
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
74
75
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -34,6 +34,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
});
|
|
35
35
|
const backend_federation_contracts_namespaceObject = require("@modern-js/backend-federation-contracts");
|
|
36
36
|
const index_js_namespaceObject = require("../backend-federation/index.js");
|
|
37
|
+
const identity_js_namespaceObject = require("../backend-federation/identity.js");
|
|
37
38
|
const external_errors_js_namespaceObject = require("./errors.js");
|
|
38
39
|
const external_metadata_js_namespaceObject = require("./metadata.js");
|
|
39
40
|
function resolveExpectedBuildMarker(expected) {
|
|
@@ -76,19 +77,22 @@ function validateLoadedBackendFederationContract(loaded, manifest, remote) {
|
|
|
76
77
|
const loadedContract = loaded.backendFederationContract;
|
|
77
78
|
const backendFederation = (0, external_metadata_js_namespaceObject.backendFederationMetadata)(manifest);
|
|
78
79
|
const boundary = (0, external_metadata_js_namespaceObject.versionBoundaryMetadata)(manifest);
|
|
79
|
-
const compatibility = (0,
|
|
80
|
+
const compatibility = (0, identity_js_namespaceObject.backendFederationCompatibility)(loaded);
|
|
80
81
|
(0, external_errors_js_namespaceObject.assertManifestAdapter)(compatibility, 'version_mismatch', `[BFF][Effect] Backend federation expose ${remote.name}/${remote.expose?.replace(/^\.\//u, '')} must declare compatibility metadata.`);
|
|
81
82
|
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(loadedContract?.role), 'microvertical-server', 'expose role');
|
|
82
83
|
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(loadedContract?.name), remote.name, 'expose name');
|
|
83
|
-
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(compatibility.contractVersion), (0, external_metadata_js_namespaceObject.stringValue)(backendFederation?.contractVersion), 'expose contractVersion');
|
|
84
|
-
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(compatibility.nodeAdapterVersion), (0, external_metadata_js_namespaceObject.stringValue)(backendFederation?.nodeAdapterVersion), 'expose nodeAdapterVersion');
|
|
85
|
-
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(compatibility.packageName), (0, external_metadata_js_namespaceObject.stringValue)(boundary?.packageName), 'expose packageName');
|
|
86
|
-
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(compatibility.build), (0, external_metadata_js_namespaceObject.stringValue)(boundary?.buildVersion), 'expose buildVersion');
|
|
87
84
|
const deliveryUnit = (0, external_metadata_js_namespaceObject.manifestDeliveryUnit)(backendFederation, boundary);
|
|
88
85
|
const manifestUnitId = (0, external_metadata_js_namespaceObject.stringValue)(deliveryUnit.boundary?.unitId) ?? (0, external_metadata_js_namespaceObject.stringValue)(deliveryUnit.top?.unitId);
|
|
89
86
|
const manifestBuildMarker = (0, external_metadata_js_namespaceObject.stringValue)(deliveryUnit.boundary?.buildMarker);
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
const issues = (0, identity_js_namespaceObject.validateBackendFederationCompatibility)(compatibility, {
|
|
88
|
+
contractVersion: (0, external_metadata_js_namespaceObject.stringValue)(backendFederation?.contractVersion),
|
|
89
|
+
nodeAdapterVersion: (0, external_metadata_js_namespaceObject.stringValue)(backendFederation?.nodeAdapterVersion),
|
|
90
|
+
packageName: (0, external_metadata_js_namespaceObject.stringValue)(boundary?.packageName),
|
|
91
|
+
unitId: manifestUnitId,
|
|
92
|
+
build: manifestBuildMarker ?? (0, external_metadata_js_namespaceObject.stringValue)(boundary?.buildVersion)
|
|
93
|
+
});
|
|
94
|
+
(0, external_errors_js_namespaceObject.assertVersionValue)((0, external_metadata_js_namespaceObject.stringValue)(compatibility.build), (0, external_metadata_js_namespaceObject.stringValue)(boundary?.buildVersion), 'expose buildVersion');
|
|
95
|
+
(0, external_errors_js_namespaceObject.assertManifestAdapter)(0 === issues.length, 'version_mismatch', `[BFF][Effect] ${(0, identity_js_namespaceObject.formatBackendFederationIdentityIssues)(issues)}.`);
|
|
92
96
|
}
|
|
93
97
|
function classifyLoadError(error) {
|
|
94
98
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
5
|
var define = (defs, kind)=>{
|
|
@@ -39,33 +30,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
31
|
resolveAdapterCrossProjectPolicy: ()=>resolveAdapterCrossProjectPolicy
|
|
41
32
|
});
|
|
42
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
43
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
44
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
33
|
require("@modern-js/server-runtime-extensions/server-config");
|
|
46
34
|
const node_namespaceObject = require("@modern-js/server-runtime-extensions/bff-policy/node");
|
|
47
|
-
const
|
|
48
|
-
if (!startDir) return;
|
|
49
|
-
let current = external_node_path_default().resolve(startDir);
|
|
50
|
-
for(let depth = 0; depth < 10; depth += 1){
|
|
51
|
-
try {
|
|
52
|
-
const packageJson = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(external_node_path_default().join(current, 'package.json'), 'utf8'));
|
|
53
|
-
if ('string' == typeof packageJson.version) return packageJson.version;
|
|
54
|
-
} catch {}
|
|
55
|
-
const parent = external_node_path_default().dirname(current);
|
|
56
|
-
if (parent === current) break;
|
|
57
|
-
current = parent;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const resolveAdapterCrossProjectPolicy = (api, handlers)=>{
|
|
35
|
+
const resolveAdapterCrossProjectPolicy = (api, handlers, producer)=>{
|
|
61
36
|
const bff = api.getServerConfig()?.bff;
|
|
62
37
|
const { apiDirectory, appDirectory } = api.getServerContext();
|
|
63
38
|
return (0, node_namespaceObject.resolveCrossProjectPolicy)({
|
|
64
39
|
crossProjectPolicy: bff?.crossProjectPolicy,
|
|
65
40
|
handlers,
|
|
66
|
-
requestId: bff?.requestId,
|
|
67
41
|
isCrossProjectServer: bff?.isCrossProjectServer,
|
|
68
|
-
|
|
42
|
+
...producer ?? (0, node_namespaceObject.resolveOperationProducer)({
|
|
43
|
+
directories: [
|
|
44
|
+
apiDirectory,
|
|
45
|
+
appDirectory
|
|
46
|
+
],
|
|
47
|
+
requestId: bff?.requestId || 'default'
|
|
48
|
+
})
|
|
69
49
|
});
|
|
70
50
|
};
|
|
71
51
|
exports.resolveAdapterCrossProjectPolicy = __webpack_exports__.resolveAdapterCrossProjectPolicy;
|
|
@@ -34,7 +34,7 @@ const effect_namespaceObject = require("@modern-js/bff-effect/effect");
|
|
|
34
34
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
35
35
|
const httpapi_namespaceObject = require("effect/unstable/httpapi");
|
|
36
36
|
const index_js_namespaceObject = require("../cross-project-policy/index.js");
|
|
37
|
-
function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod) {
|
|
37
|
+
function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod, producer) {
|
|
38
38
|
const contractSourcesPromise = null === mod ? Promise.resolve([]) : Promise.resolve().then(()=>(0, effect_namespaceObject.extractHttpApiFromModule)(mod, httpapi_namespaceObject.HttpApi.isHttpApi)).then((effectApi)=>{
|
|
39
39
|
if (null === effectApi) return [];
|
|
40
40
|
const reflect = (apiValue, handlers)=>{
|
|
@@ -50,7 +50,7 @@ function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod) {
|
|
|
50
50
|
return [];
|
|
51
51
|
});
|
|
52
52
|
return contractSourcesPromise.then((contractSources)=>{
|
|
53
|
-
const policy = (0, index_js_namespaceObject.resolveAdapterCrossProjectPolicy)(api, contractSources);
|
|
53
|
+
const policy = (0, index_js_namespaceObject.resolveAdapterCrossProjectPolicy)(api, contractSources, producer);
|
|
54
54
|
if (policy?.enabled === true && 0 === contractSources.length) utils_namespaceObject.logger.warn('[BFF][Effect] Cross-project policy enabled but no HttpApi endpoints could be reflected; requests fail operation-contract matching unless allowUnknownOperations is enabled.');
|
|
55
55
|
return policy;
|
|
56
56
|
});
|
|
@@ -43,52 +43,16 @@ const external_node_path_namespaceObject = require("node:path");
|
|
|
43
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
44
|
require("@modern-js/server-runtime-extensions/server-config");
|
|
45
45
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
46
|
-
const
|
|
47
|
-
'.js',
|
|
48
|
-
'.jsx',
|
|
49
|
-
'.ts',
|
|
50
|
-
'.tsx',
|
|
51
|
-
'.mjs',
|
|
52
|
-
'.mts',
|
|
53
|
-
'.cjs',
|
|
54
|
-
'.cts'
|
|
55
|
-
];
|
|
56
|
-
function resolveJsOrTsEntry(entryWithoutOrWithExt) {
|
|
57
|
-
const extension = external_node_path_default().extname(entryWithoutOrWithExt);
|
|
58
|
-
if (JS_OR_TS_EXTS.includes(extension)) return utils_namespaceObject.fs.existsSync(entryWithoutOrWithExt) ? entryWithoutOrWithExt : void 0;
|
|
59
|
-
return (0, utils_namespaceObject.findExists)(JS_OR_TS_EXTS.map((ext)=>`${entryWithoutOrWithExt}${ext}`)) || void 0;
|
|
60
|
-
}
|
|
61
|
-
function builtEntryPath(entryPath) {
|
|
62
|
-
return entryPath.replace(/\.(?:[cm]?ts|tsx|jsx)$/u, '.js');
|
|
63
|
-
}
|
|
64
|
-
function relativeAppPath(appDirectory, entryPath) {
|
|
65
|
-
const relativePath = external_node_path_default().relative(appDirectory, entryPath);
|
|
66
|
-
return '..' === relativePath || relativePath.startsWith(`..${external_node_path_default().sep}`) ? void 0 : relativePath;
|
|
67
|
-
}
|
|
68
|
-
function isDependencyPath(relativePath) {
|
|
69
|
-
return relativePath?.split(/[\\/]/u).includes('node_modules') ?? false;
|
|
70
|
-
}
|
|
46
|
+
const paths_js_namespaceObject = require("../effect-source-loader/paths.js");
|
|
71
47
|
function resolveEffectAdapterEntryFile(api) {
|
|
72
48
|
const { appDirectory, apiDirectory, distDirectory } = api.getServerContext();
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (void 0 === relativeEntry || isDependencyPath(relativeEntry)) return resolveJsOrTsEntry(sourceEntry);
|
|
81
|
-
return relativeEntry ? resolveJsOrTsEntry(builtEntryPath(external_node_path_default().resolve(productionRoot, relativeEntry))) : void 0;
|
|
82
|
-
}
|
|
83
|
-
return resolveJsOrTsEntry(sourceEntry);
|
|
84
|
-
}
|
|
85
|
-
const resolvedApiDirectory = external_node_path_default().resolve(appRoot, apiDirectory || utils_namespaceObject.API_DIR);
|
|
86
|
-
const productionApiDirectory = productionRoot ? void 0 !== relativeAppPath(productionRoot, resolvedApiDirectory) ? resolvedApiDirectory : (()=>{
|
|
87
|
-
const relativeApiDirectory = relativeAppPath(appRoot, resolvedApiDirectory);
|
|
88
|
-
if (isDependencyPath(relativeApiDirectory)) return resolvedApiDirectory;
|
|
89
|
-
return relativeApiDirectory ? external_node_path_default().resolve(productionRoot, relativeApiDirectory) : void 0;
|
|
90
|
-
})() : resolvedApiDirectory;
|
|
91
|
-
return productionApiDirectory ? resolveJsOrTsEntry(external_node_path_default().resolve(productionApiDirectory, 'index')) : void 0;
|
|
49
|
+
const appDir = external_node_path_default().resolve(appDirectory || process.cwd());
|
|
50
|
+
return (0, paths_js_namespaceObject.resolveEffectEntry)({
|
|
51
|
+
appDir,
|
|
52
|
+
apiDir: external_node_path_default().resolve(appDir, apiDirectory || utils_namespaceObject.API_DIR),
|
|
53
|
+
effectEntry: api.getServerConfig()?.bff?.effect?.entry,
|
|
54
|
+
distDir: (0, utils_namespaceObject.isProd)() && distDirectory ? external_node_path_default().resolve(distDirectory) : void 0
|
|
55
|
+
}).path;
|
|
92
56
|
}
|
|
93
57
|
exports.resolveEffectAdapterEntryFile = __webpack_exports__.resolveEffectAdapterEntryFile;
|
|
94
58
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -44,6 +44,7 @@ const external_node_path_namespaceObject = require("node:path");
|
|
|
44
44
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
45
|
require("@modern-js/server-runtime-extensions/server-config");
|
|
46
46
|
const effect_namespaceObject = require("@modern-js/bff-effect/effect");
|
|
47
|
+
const node_namespaceObject = require("@modern-js/server-runtime-extensions/bff-policy/node");
|
|
47
48
|
const runtime_lifecycle_namespaceObject = require("@modern-js/server-runtime-extensions/runtime-lifecycle");
|
|
48
49
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
49
50
|
const evaluation_js_namespaceObject = require("../cross-project-policy/evaluation.js");
|
|
@@ -63,9 +64,9 @@ class EffectAdapter {
|
|
|
63
64
|
this.handler = null;
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
67
|
+
const { appDirectory } = this.api.getServerContext();
|
|
66
68
|
let mod;
|
|
67
69
|
try {
|
|
68
|
-
const { appDirectory } = this.api.getServerContext();
|
|
69
70
|
mod = await ((0, utils_namespaceObject.isProd)() ? (0, loader_js_namespaceObject.loadEffectBuiltModule)(entryFile) : (0, loader_js_namespaceObject.loadEffectSourceModule)({
|
|
70
71
|
resourcePath: entryFile,
|
|
71
72
|
appDir: appDirectory || external_node_path_default().dirname(entryFile)
|
|
@@ -74,9 +75,16 @@ class EffectAdapter {
|
|
|
74
75
|
utils_namespaceObject.logger.error(`[BFF][Effect] Failed to load Effect entry: ${entryFile}\n${String(error)}`);
|
|
75
76
|
throw error;
|
|
76
77
|
}
|
|
78
|
+
const producer = (0, node_namespaceObject.resolveOperationProducer)({
|
|
79
|
+
directories: [
|
|
80
|
+
external_node_path_default().dirname(entryFile),
|
|
81
|
+
appDirectory
|
|
82
|
+
],
|
|
83
|
+
requestId: this.api.getServerConfig()?.bff?.requestId
|
|
84
|
+
});
|
|
77
85
|
const crossProjectPolicies = new Map(await Promise.all(this.prefixes.map(async (prefix)=>[
|
|
78
86
|
prefix,
|
|
79
|
-
await (0, external_cross_project_policy_js_namespaceObject.resolveEffectAdapterCrossProjectPolicy)(this.api, prefix, mod)
|
|
87
|
+
await (0, external_cross_project_policy_js_namespaceObject.resolveEffectAdapterCrossProjectPolicy)(this.api, prefix, mod, producer)
|
|
80
88
|
])));
|
|
81
89
|
const effectConfig = this.api.getServerConfig()?.bff?.effect;
|
|
82
90
|
const loaded = await (0, effect_namespaceObject.resolveEffectBffModuleHandler)(mod, {
|
|
@@ -34,12 +34,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
});
|
|
35
35
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
36
36
|
const external_paths_js_namespaceObject = require("./paths.js");
|
|
37
|
-
const BUILT_ENTRY_EXT = /\.(?:[cm]?ts|tsx|jsx)$/u;
|
|
38
37
|
function resolveBuiltEffectEntry(appDirectory, distDirectory, sourceEntry) {
|
|
39
38
|
if (void 0 === sourceEntry || 0 === sourceEntry.length) return;
|
|
40
|
-
const relativeEntry =
|
|
41
|
-
if (
|
|
42
|
-
const builtEntry = utils_namespaceObject.upath.resolve(distDirectory, relativeEntry)
|
|
39
|
+
const relativeEntry = (0, external_paths_js_namespaceObject.relativeEffectAppPath)(appDirectory, sourceEntry);
|
|
40
|
+
if (void 0 === relativeEntry) throw new Error(`Effect BFF entry must be inside the application directory: ${sourceEntry}`);
|
|
41
|
+
const builtEntry = (0, external_paths_js_namespaceObject.emittedEffectEntry)(utils_namespaceObject.upath.resolve(distDirectory, relativeEntry));
|
|
43
42
|
return utils_namespaceObject.fs.existsSync(builtEntry) ? builtEntry : void 0;
|
|
44
43
|
}
|
|
45
44
|
async function bundleBuiltEffectEntryForNode(options) {
|
|
@@ -65,7 +64,7 @@ function resolveEffectEntryPaths(options) {
|
|
|
65
64
|
apiDir,
|
|
66
65
|
effectEntry
|
|
67
66
|
});
|
|
68
|
-
const relativeEffectEntry = void 0 !== sourceEffectEntry && sourceEffectEntry.length > 0 ? utils_namespaceObject.upath.relative(appDir, sourceEffectEntry)
|
|
67
|
+
const relativeEffectEntry = void 0 !== sourceEffectEntry && sourceEffectEntry.length > 0 ? (0, external_paths_js_namespaceObject.emittedEffectEntry)(utils_namespaceObject.upath.relative(appDir, sourceEffectEntry)) : '';
|
|
69
68
|
return {
|
|
70
69
|
sourceEffectEntry,
|
|
71
70
|
relativeEffectEntry
|
|
@@ -176,7 +176,8 @@ function externalizeInstalledDependencies(options) {
|
|
|
176
176
|
path: args.path
|
|
177
177
|
};
|
|
178
178
|
const realPath = await external_node_fs_default().promises.realpath(resolution.path).catch(()=>resolution.path);
|
|
179
|
-
|
|
179
|
+
const loader = SOURCE_LOADERS.get(external_node_path_default().extname(realPath).toLowerCase());
|
|
180
|
+
if (realPath.includes(`${external_node_path_default().sep}node_modules${external_node_path_default().sep}`) && 'ts' !== loader && 'tsx' !== loader && 'jsx' !== loader) {
|
|
180
181
|
const runtimeResolution = await buildApi.resolve(args.path, {
|
|
181
182
|
importer: '',
|
|
182
183
|
kind: args.kind,
|
|
@@ -34,44 +34,21 @@ const effect_namespaceObject = require("@modern-js/bff-effect/effect");
|
|
|
34
34
|
const node_namespaceObject = require("@modern-js/server-runtime-extensions/bff-policy/node");
|
|
35
35
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
36
36
|
const external_http_api_runtime_js_namespaceObject = require("./http-api-runtime.js");
|
|
37
|
-
function getPackageInfo(resourcePath, appDir, onDependency) {
|
|
38
|
-
for (const startDir of [
|
|
39
|
-
utils_namespaceObject.upath.dirname(resourcePath),
|
|
40
|
-
appDir
|
|
41
|
-
]){
|
|
42
|
-
let current = utils_namespaceObject.upath.resolve(startDir);
|
|
43
|
-
for(let depth = 0; depth < 32; depth += 1){
|
|
44
|
-
const packageJsonPath = utils_namespaceObject.upath.join(current, 'package.json');
|
|
45
|
-
if (utils_namespaceObject.fs.existsSync(packageJsonPath)) {
|
|
46
|
-
onDependency?.(packageJsonPath);
|
|
47
|
-
try {
|
|
48
|
-
const packageJson = utils_namespaceObject.fs.readJSONSync(packageJsonPath);
|
|
49
|
-
return {
|
|
50
|
-
name: packageJson.name,
|
|
51
|
-
version: packageJson.version
|
|
52
|
-
};
|
|
53
|
-
} catch {
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const parent = utils_namespaceObject.upath.dirname(current);
|
|
58
|
-
if (parent === current) break;
|
|
59
|
-
current = parent;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return {};
|
|
63
|
-
}
|
|
64
37
|
async function resolveEffectOperationContracts(options) {
|
|
65
38
|
const api = await (0, external_http_api_runtime_js_namespaceObject.loadEffectApi)(options);
|
|
66
39
|
if (null === api) return null;
|
|
67
40
|
const runtime = await (0, external_http_api_runtime_js_namespaceObject.getHttpApiRuntime)();
|
|
68
41
|
const endpoints = (0, effect_namespaceObject.collectEffectEndpoints)(runtime.reflect, api, options.prefix);
|
|
69
|
-
const packageInfo = getPackageInfo(options.resourcePath, options.appDir, options.onDependency);
|
|
70
|
-
const requestId = options.requestId?.trim() || packageInfo.name || 'default';
|
|
71
42
|
return (0, node_namespaceObject.buildOperationContractMap)({
|
|
72
43
|
handlers: (0, effect_namespaceObject.toOperationContractSources)(endpoints),
|
|
73
|
-
|
|
74
|
-
|
|
44
|
+
...(0, node_namespaceObject.resolveOperationProducer)({
|
|
45
|
+
directories: [
|
|
46
|
+
utils_namespaceObject.upath.dirname(options.resourcePath),
|
|
47
|
+
options.appDir
|
|
48
|
+
],
|
|
49
|
+
requestId: options.requestId,
|
|
50
|
+
onDependency: options.onDependency
|
|
51
|
+
})
|
|
75
52
|
});
|
|
76
53
|
}
|
|
77
54
|
exports.resolveEffectOperationContracts = __webpack_exports__.resolveEffectOperationContracts;
|
|
@@ -28,6 +28,9 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
emittedEffectEntry: ()=>emittedEffectEntry,
|
|
32
|
+
relativeEffectAppPath: ()=>relativeEffectAppPath,
|
|
33
|
+
resolveEffectEntry: ()=>resolveEffectEntry,
|
|
31
34
|
resolveEffectEntryFile: ()=>resolveEffectEntryFile
|
|
32
35
|
});
|
|
33
36
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
@@ -41,20 +44,45 @@ const JS_OR_TS_EXTS = [
|
|
|
41
44
|
'.cjs',
|
|
42
45
|
'.cts'
|
|
43
46
|
];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const emittedEffectEntry = (entry)=>entry.replace(/\.(?:[cm]?ts|tsx|jsx)$/u, '.js');
|
|
48
|
+
function relativeEffectAppPath(appDir, entry) {
|
|
49
|
+
const relative = utils_namespaceObject.upath.relative(appDir, entry);
|
|
50
|
+
return '..' === relative || relative.startsWith('../') || relative.split('/').includes('node_modules') ? void 0 : relative;
|
|
51
|
+
}
|
|
52
|
+
function existingEntry(entry) {
|
|
53
|
+
return utils_namespaceObject.upath.extname(entry) ? utils_namespaceObject.fs.existsSync(entry) ? entry : void 0 : (0, utils_namespaceObject.findExists)(JS_OR_TS_EXTS.map((ext)=>`${entry}${ext}`)) || void 0;
|
|
54
|
+
}
|
|
55
|
+
function resolveEffectEntry(options) {
|
|
56
|
+
const { appDir, apiDir, effectEntry, distDir } = options;
|
|
57
|
+
const entry = utils_namespaceObject.upath.resolve(appDir, effectEntry || utils_namespaceObject.upath.join(apiDir, 'index'));
|
|
58
|
+
if (distDir && void 0 !== relativeEffectAppPath(distDir, entry)) return {
|
|
59
|
+
kind: 'built-output',
|
|
60
|
+
path: existingEntry(emittedEffectEntry(entry))
|
|
61
|
+
};
|
|
62
|
+
const relative = relativeEffectAppPath(appDir, entry);
|
|
63
|
+
if (void 0 === relative) return {
|
|
64
|
+
kind: 'external-sdk',
|
|
65
|
+
path: existingEntry(entry)
|
|
49
66
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
67
|
+
return distDir ? {
|
|
68
|
+
kind: 'built-output',
|
|
69
|
+
path: existingEntry(emittedEffectEntry(utils_namespaceObject.upath.resolve(distDir, relative)))
|
|
70
|
+
} : {
|
|
71
|
+
kind: 'app-source',
|
|
72
|
+
path: existingEntry(entry)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function resolveEffectEntryFile(options) {
|
|
76
|
+
return resolveEffectEntry(options).path;
|
|
55
77
|
}
|
|
78
|
+
exports.emittedEffectEntry = __webpack_exports__.emittedEffectEntry;
|
|
79
|
+
exports.relativeEffectAppPath = __webpack_exports__.relativeEffectAppPath;
|
|
80
|
+
exports.resolveEffectEntry = __webpack_exports__.resolveEffectEntry;
|
|
56
81
|
exports.resolveEffectEntryFile = __webpack_exports__.resolveEffectEntryFile;
|
|
57
82
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"emittedEffectEntry",
|
|
84
|
+
"relativeEffectAppPath",
|
|
85
|
+
"resolveEffectEntry",
|
|
58
86
|
"resolveEffectEntryFile"
|
|
59
87
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
88
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
import { isRecord } from "./utils.mjs";
|
|
2
|
-
function
|
|
3
|
-
const issues = [];
|
|
2
|
+
function backendFederationCompatibility(loaded) {
|
|
4
3
|
const contract = isRecord(loaded) ? loaded.backendFederationContract : void 0;
|
|
5
4
|
const compatibility = isRecord(contract) ? contract.compatibility : void 0;
|
|
6
|
-
|
|
5
|
+
return isRecord(compatibility) ? compatibility : void 0;
|
|
6
|
+
}
|
|
7
|
+
function validateBackendFederationCompatibility(compatibility, expected) {
|
|
8
|
+
return Object.entries(expected).flatMap(([field, value])=>void 0 === value || 'string' == typeof compatibility[field] && compatibility[field].length > 0 && compatibility[field] === value ? [] : [
|
|
9
|
+
{
|
|
10
|
+
path: `backendFederationContract.compatibility.${field}`,
|
|
11
|
+
message: `expected ${value}, received ${'string' == typeof compatibility[field] ? compatibility[field] : typeof compatibility[field]}`
|
|
12
|
+
}
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
function validateExpectedBackendFederationIdentity(loaded, expected) {
|
|
16
|
+
const compatibility = backendFederationCompatibility(loaded);
|
|
17
|
+
return compatibility ? validateBackendFederationCompatibility(compatibility, {
|
|
18
|
+
unitId: expected.unitId,
|
|
19
|
+
build: expected.buildMarker
|
|
20
|
+
}) : [
|
|
7
21
|
{
|
|
8
22
|
path: 'backendFederationContract.compatibility',
|
|
9
23
|
message: 'loaded module declares no compatibility metadata; delivery-unit identity cannot be validated'
|
|
10
24
|
}
|
|
11
25
|
];
|
|
12
|
-
const unitId = compatibility.unitId;
|
|
13
|
-
if ('string' != typeof unitId || 0 === unitId.length) issues.push({
|
|
14
|
-
path: 'backendFederationContract.compatibility.unitId',
|
|
15
|
-
message: `missing delivery-unit id; expected ${expected.unitId}`
|
|
16
|
-
});
|
|
17
|
-
else if (unitId !== expected.unitId) issues.push({
|
|
18
|
-
path: 'backendFederationContract.compatibility.unitId',
|
|
19
|
-
message: `expected ${expected.unitId}, received ${unitId}`
|
|
20
|
-
});
|
|
21
|
-
const build = compatibility.build;
|
|
22
|
-
if ('string' != typeof build || 0 === build.length) issues.push({
|
|
23
|
-
path: 'backendFederationContract.compatibility.build',
|
|
24
|
-
message: `missing build marker; expected ${expected.buildMarker}`
|
|
25
|
-
});
|
|
26
|
-
else if (build !== expected.buildMarker) issues.push({
|
|
27
|
-
path: 'backendFederationContract.compatibility.build',
|
|
28
|
-
message: `expected ${expected.buildMarker}, received ${build}`
|
|
29
|
-
});
|
|
30
|
-
return issues;
|
|
31
26
|
}
|
|
32
27
|
function formatBackendFederationIdentityIssues(issues) {
|
|
33
28
|
return issues.map((issue)=>`${issue.path}: ${issue.message}`).join('; ');
|
|
34
29
|
}
|
|
35
|
-
export { formatBackendFederationIdentityIssues, validateExpectedBackendFederationIdentity };
|
|
30
|
+
export { backendFederationCompatibility, formatBackendFederationIdentityIssues, validateBackendFederationCompatibility, validateExpectedBackendFederationIdentity };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { formatBackendFederationValidationErrors, validateBackendFederationManifest } from "@modern-js/backend-federation-contracts";
|
|
2
2
|
import { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_NODE_ADAPTER_VERSION } from "../backend-federation/index.mjs";
|
|
3
|
+
import { backendFederationCompatibility, formatBackendFederationIdentityIssues, validateBackendFederationCompatibility } from "../backend-federation/identity.mjs";
|
|
3
4
|
import { BackendFederationManifestAdapterError, assertConsistentValue, assertManifestAdapter, assertVersionValue } from "./errors.mjs";
|
|
4
|
-
import { backendFederationMetadata, manifestDeliveryUnit,
|
|
5
|
+
import { backendFederationMetadata, manifestDeliveryUnit, stringValue, versionBoundaryMetadata } from "./metadata.mjs";
|
|
5
6
|
function resolveExpectedBuildMarker(expected) {
|
|
6
7
|
if (void 0 !== expected.buildVersion && void 0 !== expected.buildMarker && expected.buildVersion !== expected.buildMarker) throw new BackendFederationManifestAdapterError('version_mismatch', `[BFF][Effect] Backend federation expected buildVersion/buildMarker mismatch: buildVersion ${expected.buildVersion}, buildMarker ${expected.buildMarker}.`, void 0, {
|
|
7
8
|
label: 'expected.buildVersion/buildMarker',
|
|
@@ -42,19 +43,22 @@ function validateLoadedBackendFederationContract(loaded, manifest, remote) {
|
|
|
42
43
|
const loadedContract = loaded.backendFederationContract;
|
|
43
44
|
const backendFederation = backendFederationMetadata(manifest);
|
|
44
45
|
const boundary = versionBoundaryMetadata(manifest);
|
|
45
|
-
const compatibility =
|
|
46
|
+
const compatibility = backendFederationCompatibility(loaded);
|
|
46
47
|
assertManifestAdapter(compatibility, 'version_mismatch', `[BFF][Effect] Backend federation expose ${remote.name}/${remote.expose?.replace(/^\.\//u, '')} must declare compatibility metadata.`);
|
|
47
48
|
assertVersionValue(stringValue(loadedContract?.role), 'microvertical-server', 'expose role');
|
|
48
49
|
assertVersionValue(stringValue(loadedContract?.name), remote.name, 'expose name');
|
|
49
|
-
assertVersionValue(stringValue(compatibility.contractVersion), stringValue(backendFederation?.contractVersion), 'expose contractVersion');
|
|
50
|
-
assertVersionValue(stringValue(compatibility.nodeAdapterVersion), stringValue(backendFederation?.nodeAdapterVersion), 'expose nodeAdapterVersion');
|
|
51
|
-
assertVersionValue(stringValue(compatibility.packageName), stringValue(boundary?.packageName), 'expose packageName');
|
|
52
|
-
assertVersionValue(stringValue(compatibility.build), stringValue(boundary?.buildVersion), 'expose buildVersion');
|
|
53
50
|
const deliveryUnit = manifestDeliveryUnit(backendFederation, boundary);
|
|
54
51
|
const manifestUnitId = stringValue(deliveryUnit.boundary?.unitId) ?? stringValue(deliveryUnit.top?.unitId);
|
|
55
52
|
const manifestBuildMarker = stringValue(deliveryUnit.boundary?.buildMarker);
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const issues = validateBackendFederationCompatibility(compatibility, {
|
|
54
|
+
contractVersion: stringValue(backendFederation?.contractVersion),
|
|
55
|
+
nodeAdapterVersion: stringValue(backendFederation?.nodeAdapterVersion),
|
|
56
|
+
packageName: stringValue(boundary?.packageName),
|
|
57
|
+
unitId: manifestUnitId,
|
|
58
|
+
build: manifestBuildMarker ?? stringValue(boundary?.buildVersion)
|
|
59
|
+
});
|
|
60
|
+
assertVersionValue(stringValue(compatibility.build), stringValue(boundary?.buildVersion), 'expose buildVersion');
|
|
61
|
+
assertManifestAdapter(0 === issues.length, 'version_mismatch', `[BFF][Effect] ${formatBackendFederationIdentityIssues(issues)}.`);
|
|
58
62
|
}
|
|
59
63
|
function classifyLoadError(error) {
|
|
60
64
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1,29 +1,19 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import node_path from "node:path";
|
|
3
1
|
import "@modern-js/server-runtime-extensions/server-config";
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
if (!startDir) return;
|
|
7
|
-
let current = node_path.resolve(startDir);
|
|
8
|
-
for(let depth = 0; depth < 10; depth += 1){
|
|
9
|
-
try {
|
|
10
|
-
const packageJson = JSON.parse(readFileSync(node_path.join(current, 'package.json'), 'utf8'));
|
|
11
|
-
if ('string' == typeof packageJson.version) return packageJson.version;
|
|
12
|
-
} catch {}
|
|
13
|
-
const parent = node_path.dirname(current);
|
|
14
|
-
if (parent === current) break;
|
|
15
|
-
current = parent;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const resolveAdapterCrossProjectPolicy = (api, handlers)=>{
|
|
2
|
+
import { resolveCrossProjectPolicy, resolveOperationProducer } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
3
|
+
const resolveAdapterCrossProjectPolicy = (api, handlers, producer)=>{
|
|
19
4
|
const bff = api.getServerConfig()?.bff;
|
|
20
5
|
const { apiDirectory, appDirectory } = api.getServerContext();
|
|
21
6
|
return resolveCrossProjectPolicy({
|
|
22
7
|
crossProjectPolicy: bff?.crossProjectPolicy,
|
|
23
8
|
handlers,
|
|
24
|
-
requestId: bff?.requestId,
|
|
25
9
|
isCrossProjectServer: bff?.isCrossProjectServer,
|
|
26
|
-
|
|
10
|
+
...producer ?? resolveOperationProducer({
|
|
11
|
+
directories: [
|
|
12
|
+
apiDirectory,
|
|
13
|
+
appDirectory
|
|
14
|
+
],
|
|
15
|
+
requestId: bff?.requestId || 'default'
|
|
16
|
+
})
|
|
27
17
|
});
|
|
28
18
|
};
|
|
29
19
|
export { resolveAdapterCrossProjectPolicy };
|
|
@@ -2,7 +2,7 @@ import { collectEffectEndpoints, extractHttpApiFromModule, toOperationContractSo
|
|
|
2
2
|
import { logger } from "@modern-js/utils";
|
|
3
3
|
import { HttpApi } from "effect/unstable/httpapi";
|
|
4
4
|
import { resolveAdapterCrossProjectPolicy } from "../cross-project-policy/index.mjs";
|
|
5
|
-
function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod) {
|
|
5
|
+
function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod, producer) {
|
|
6
6
|
const contractSourcesPromise = null === mod ? Promise.resolve([]) : Promise.resolve().then(()=>extractHttpApiFromModule(mod, HttpApi.isHttpApi)).then((effectApi)=>{
|
|
7
7
|
if (null === effectApi) return [];
|
|
8
8
|
const reflect = (apiValue, handlers)=>{
|
|
@@ -18,7 +18,7 @@ function resolveEffectAdapterCrossProjectPolicy(api, prefix, mod) {
|
|
|
18
18
|
return [];
|
|
19
19
|
});
|
|
20
20
|
return contractSourcesPromise.then((contractSources)=>{
|
|
21
|
-
const policy = resolveAdapterCrossProjectPolicy(api, contractSources);
|
|
21
|
+
const policy = resolveAdapterCrossProjectPolicy(api, contractSources, producer);
|
|
22
22
|
if (policy?.enabled === true && 0 === contractSources.length) logger.warn('[BFF][Effect] Cross-project policy enabled but no HttpApi endpoints could be reflected; requests fail operation-contract matching unless allowUnknownOperations is enabled.');
|
|
23
23
|
return policy;
|
|
24
24
|
});
|