@saptools/service-flow 0.1.41 → 0.1.42
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/CHANGELOG.md +7 -0
- package/dist/{chunk-7L4QKKGN.js → chunk-RP3BJ64F.js} +74 -5
- package/dist/chunk-RP3BJ64F.js.map +1 -0
- package/dist/cli.js +28 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/indexer/cds-extension-resolver.ts +27 -4
- package/src/linker/cross-repo-linker.ts +12 -2
- package/src/parsers/cds-parser.ts +18 -1
- package/src/parsers/outbound-call-parser.ts +29 -1
- package/dist/chunk-7L4QKKGN.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
parsePackageJson,
|
|
14
14
|
parseServiceBindings,
|
|
15
15
|
trace
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RP3BJ64F.js";
|
|
17
17
|
|
|
18
18
|
// src/cli.ts
|
|
19
19
|
import { Command } from "commander";
|
|
@@ -209,7 +209,7 @@ function migrate(db) {
|
|
|
209
209
|
// package.json
|
|
210
210
|
var package_default = {
|
|
211
211
|
name: "@saptools/service-flow",
|
|
212
|
-
version: "0.1.
|
|
212
|
+
version: "0.1.42",
|
|
213
213
|
description: "Trace SAP CAP service-to-service flows across multi-repository workspaces with runtime-aware graph resolution",
|
|
214
214
|
type: "module",
|
|
215
215
|
publishConfig: {
|
|
@@ -1151,13 +1151,35 @@ async function repositoryFingerprint(root, files, facts) {
|
|
|
1151
1151
|
function materializeCdsExtensionOperations(db, workspaceId) {
|
|
1152
1152
|
const extensions = db.prepare(`SELECT s.id,r.id repoId,s.service_name serviceName,s.qualified_name qualifiedName,s.source_file sourceFile,s.extension_module_specifier moduleSpecifier,s.extension_imported_symbol importedSymbol,s.extension_import_kind importKind
|
|
1153
1153
|
FROM cds_services s JOIN repositories r ON r.id=s.repo_id WHERE r.workspace_id=? AND s.is_extend=1`).all(workspaceId);
|
|
1154
|
-
const insert = db.prepare(`INSERT INTO cds_operations(service_id,operation_type,operation_name,operation_path,params_json,return_type,source_file,source_line,provenance,base_operation_id)
|
|
1155
|
-
SELECT ?,operation_type,operation_name,operation_path,params_json,return_type,source_file,source_line,'inherited',id FROM cds_operations WHERE service_id=? AND NOT EXISTS (SELECT 1 FROM cds_operations existing WHERE existing.service_id=? AND existing.operation_name=cds_operations.operation_name AND existing.operation_path=cds_operations.operation_path)`);
|
|
1156
1154
|
for (const extension of extensions) {
|
|
1157
1155
|
const bases = resolveBase(db, workspaceId, extension);
|
|
1158
1156
|
const status = bases.length === 1 ? "resolved" : bases.length > 1 ? "ambiguous" : "unresolved";
|
|
1159
|
-
db.prepare("UPDATE cds_services SET extension_base_status=?, extension_base_service_id=? WHERE id=?").run(status, bases[0]?.id
|
|
1160
|
-
if (bases.length
|
|
1157
|
+
db.prepare("UPDATE cds_services SET extension_base_status=?, extension_base_service_id=? WHERE id=?").run(status, status === "resolved" ? bases[0]?.id : null, extension.id);
|
|
1158
|
+
if (bases.length !== 1) {
|
|
1159
|
+
db.prepare("DELETE FROM cds_operations WHERE service_id=? AND provenance='inherited'").run(extension.id);
|
|
1160
|
+
db.prepare("DELETE FROM search_index WHERE repo=? AND kind='operation' AND name NOT IN (SELECT operation_name FROM cds_operations o JOIN cds_services s ON s.id=o.service_id WHERE s.repo_id=?)").run(String(extension.repoId), extension.repoId);
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
reconcileInheritedOperations(db, extension, bases[0]);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function reconcileInheritedOperations(db, extension, base) {
|
|
1167
|
+
const existing = db.prepare("SELECT id,operation_name operationName,operation_path operationPath,base_operation_id baseOperationId FROM cds_operations WHERE service_id=? AND provenance='inherited'").all(extension.id);
|
|
1168
|
+
const desired = db.prepare("SELECT id,operation_type operationType,operation_name operationName,operation_path operationPath,params_json paramsJson,return_type returnType,source_file sourceFile,source_line sourceLine FROM cds_operations WHERE service_id=? AND provenance='direct' AND NOT EXISTS (SELECT 1 FROM cds_operations direct WHERE direct.service_id=? AND direct.provenance='direct' AND direct.operation_name=cds_operations.operation_name AND direct.operation_path=cds_operations.operation_path)").all(base.id, extension.id);
|
|
1169
|
+
const desiredKeys = new Set(desired.map((row) => `${String(row.operationName)}\0${String(row.operationPath)}`));
|
|
1170
|
+
const byKey = new Map(existing.map((row) => [`${row.operationName}\0${row.operationPath}`, row]));
|
|
1171
|
+
for (const row of existing) {
|
|
1172
|
+
if (!desiredKeys.has(`${row.operationName}\0${row.operationPath}`)) db.prepare("DELETE FROM cds_operations WHERE id=?").run(row.id);
|
|
1173
|
+
}
|
|
1174
|
+
const update = db.prepare("UPDATE cds_operations SET operation_type=?,params_json=?,return_type=?,source_file=?,source_line=?,base_operation_id=? WHERE id=?");
|
|
1175
|
+
const add = db.prepare("INSERT INTO cds_operations(service_id,operation_type,operation_name,operation_path,params_json,return_type,source_file,source_line,provenance,base_operation_id) VALUES(?,?,?,?,?,?,?,?,'inherited',?)");
|
|
1176
|
+
const search = db.prepare("INSERT INTO search_index(kind,name,path,repo) SELECT ?,?,?,? WHERE NOT EXISTS (SELECT 1 FROM search_index WHERE kind=? AND name=? AND path=? AND repo=?)");
|
|
1177
|
+
for (const row of desired) {
|
|
1178
|
+
const key = `${String(row.operationName)}\0${String(row.operationPath)}`;
|
|
1179
|
+
const current = byKey.get(key);
|
|
1180
|
+
if (current) update.run(row.operationType, row.paramsJson, row.returnType, row.sourceFile, row.sourceLine, row.id, current.id);
|
|
1181
|
+
else add.run(extension.id, row.operationType, row.operationName, row.operationPath, row.paramsJson, row.returnType, row.sourceFile, row.sourceLine, row.id);
|
|
1182
|
+
search.run("operation", row.operationName, row.operationPath, String(extension.repoId), "operation", row.operationName, row.operationPath, String(extension.repoId));
|
|
1161
1183
|
}
|
|
1162
1184
|
}
|
|
1163
1185
|
function resolveBase(db, workspaceId, extension) {
|