@saptools/service-flow 0.1.32 → 0.1.33
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 +8 -0
- package/README.md +4 -0
- package/TECHNICAL-NOTE.md +8 -0
- package/dist/{chunk-VT5FVMOA.js → chunk-CWJYVIG2.js} +56 -11
- package/dist/chunk-CWJYVIG2.js.map +1 -0
- package/dist/cli.js +22 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-VT5FVMOA.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
parsePackageJson,
|
|
13
13
|
parseServiceBindings,
|
|
14
14
|
trace
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CWJYVIG2.js";
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
import { Command } from "commander";
|
|
@@ -116,7 +116,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS search_index USING fts5(kind, name, path, rep
|
|
|
116
116
|
`;
|
|
117
117
|
|
|
118
118
|
// src/db/migrations.ts
|
|
119
|
-
var CURRENT_SCHEMA_VERSION =
|
|
119
|
+
var CURRENT_SCHEMA_VERSION = 7;
|
|
120
120
|
var columns = {
|
|
121
121
|
service_bindings: [
|
|
122
122
|
{ name: "helper_chain_json", ddl: "ALTER TABLE service_bindings ADD COLUMN helper_chain_json TEXT" },
|
|
@@ -192,7 +192,7 @@ function migrate(db) {
|
|
|
192
192
|
// package.json
|
|
193
193
|
var package_default = {
|
|
194
194
|
name: "@saptools/service-flow",
|
|
195
|
-
version: "0.1.
|
|
195
|
+
version: "0.1.33",
|
|
196
196
|
description: "Trace SAP CAP service-to-service flows across multi-repository workspaces with runtime-aware graph resolution",
|
|
197
197
|
type: "module",
|
|
198
198
|
publishConfig: {
|
|
@@ -1258,6 +1258,20 @@ async function withReadOnlyWorkspace(workspace, fn) {
|
|
|
1258
1258
|
db.close();
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
|
+
function schemaDriftDiagnostics(db, strict) {
|
|
1262
|
+
if (!strict) return [];
|
|
1263
|
+
const symbolColumns = db.prepare("PRAGMA table_info(symbols)").all();
|
|
1264
|
+
const legacy = symbolColumns.filter((row) => ["external_target_kind", "external_target_id", "external_target_label", "external_target_dynamic"].includes(String(row.name))).map((row) => row.name);
|
|
1265
|
+
const missingExternal = db.prepare("SELECT id id,source_file sourceFile,source_line sourceLine FROM outbound_calls WHERE call_type='external_http' AND (external_target_id IS NULL OR external_target_label IS NULL OR external_target_kind IS NULL) LIMIT 20").all();
|
|
1266
|
+
const diagnostics = [];
|
|
1267
|
+
if (legacy.length > 0) diagnostics.push({ severity: "warning", code: "schema_legacy_columns_present", message: "Legacy external-target columns are present on symbols; run service-flow clean --db-only, then init/index/link to rebuild with the current schema.", scope: "workspace", affectedColumns: legacy, remediation: "service-flow clean --db-only && service-flow init <workspace> && service-flow index && service-flow link" });
|
|
1268
|
+
if (missingExternal.length > 0) diagnostics.push({ severity: "warning", code: "external_target_columns_missing_data", message: "External HTTP calls are missing queryable external target metadata; reindex is required after upgrade.", scope: "workspace", affectedRows: missingExternal, remediation: "service-flow index --force && service-flow link" });
|
|
1269
|
+
if (legacy.length > 0 || missingExternal.length > 0) diagnostics.push({ severity: "warning", code: "reindex_required_after_upgrade", message: "This database cannot be made equivalent to a fresh index by relink alone.", scope: "workspace", remediation: "Rebuild or force reindex the workspace, then run service-flow doctor --strict." });
|
|
1270
|
+
return diagnostics;
|
|
1271
|
+
}
|
|
1272
|
+
function linkUpgradeWarnings(db) {
|
|
1273
|
+
return schemaDriftDiagnostics(db, true).filter((item) => ["schema_legacy_columns_present", "external_target_columns_missing_data", "reindex_required_after_upgrade"].includes(String(item.code)));
|
|
1274
|
+
}
|
|
1261
1275
|
function localServiceDiagnostics(db, strict) {
|
|
1262
1276
|
const rows = db.prepare(`SELECT e.status status,e.unresolved_reason reason,e.evidence_json evidenceJson FROM graph_edges e JOIN outbound_calls c ON e.from_kind='call' AND c.id=CAST(e.from_id AS INTEGER) WHERE c.call_type='local_service_call'`).all();
|
|
1263
1277
|
const implementationContext = rows.filter((row) => row.status === "resolved" && String(row.evidenceJson ?? "").includes("implementation_context_caller_ownership")).length;
|
|
@@ -1572,8 +1586,10 @@ function createProgram() {
|
|
|
1572
1586
|
program.command("link").option("--workspace <path>").option("--force").action(
|
|
1573
1587
|
(opts) => void withWorkspace(opts.workspace, (db, workspaceId) => {
|
|
1574
1588
|
const r = linkWorkspace(db, workspaceId);
|
|
1589
|
+
const upgradeWarnings = linkUpgradeWarnings(db);
|
|
1575
1590
|
process.stdout.write(
|
|
1576
|
-
|
|
1591
|
+
`${upgradeWarnings.length ? `Warnings: ${upgradeWarnings.map((item) => String(item.code)).join(", ")}. Run service-flow doctor --strict for remediation.
|
|
1592
|
+
` : ""}Linked ${r.edgeCount} edges: ${r.remoteResolvedCount} remote operation calls resolved, ${r.localResolvedCount} local operation calls resolved, ${r.unresolvedCount} unresolved operation calls, ${r.ambiguousCount} ambiguous operation calls, ${r.dynamicCount} dynamic operation calls, ${r.terminalCount} terminal call edges, ${r.dependencyResolvedCount} dependency resolved, ${r.dependencyAmbiguousCount} dependency ambiguous, ${r.implementationResolvedCount} implementation resolved, ${r.implementationAmbiguousCount} implementation ambiguous, ${r.implementationUnresolvedCount} implementation unresolved
|
|
1577
1593
|
`
|
|
1578
1594
|
);
|
|
1579
1595
|
}).catch(fail)
|
|
@@ -1760,7 +1776,8 @@ function createProgram() {
|
|
|
1760
1776
|
).all(Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict), Boolean(opts.strict));
|
|
1761
1777
|
const localServiceHealth = localServiceDiagnostics(db, Boolean(opts.strict));
|
|
1762
1778
|
const parserQualityHealth = parserQualityDiagnostics(db, Boolean(opts.strict));
|
|
1763
|
-
const
|
|
1779
|
+
const schemaDriftHealth = schemaDriftDiagnostics(db, Boolean(opts.strict));
|
|
1780
|
+
const allDiagnostics = [...diagnostics, ...health, ...localServiceHealth, ...schemaDriftHealth, ...parserQualityHealth];
|
|
1764
1781
|
process.stdout.write(
|
|
1765
1782
|
allDiagnostics.length ? renderJson(allDiagnostics) : `${pc.green("No diagnostics recorded")}
|
|
1766
1783
|
`
|