@saptools/service-flow 0.1.56 → 0.1.57
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 +6 -0
- package/dist/{chunk-Y7H7ZU5B.js → chunk-DCOFNDKS.js} +78 -23
- package/dist/chunk-DCOFNDKS.js.map +1 -0
- package/dist/cli.js +14 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/db/repositories.ts +77 -22
- package/src/parsers/symbol-parser.ts +12 -6
- package/dist/chunk-Y7H7ZU5B.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.57
|
|
4
|
+
|
|
5
|
+
- Made local executable symbol-call resolution import-binding-aware: relative helper shadowing now bypasses same-file methods (RC1), namespace members resolve within their imported module (RC2), duplicate exports use fail-closed path disambiguation while barrels remain ambiguous (RC3), and singleton-accessor chains reach non-exported instance methods in the imported class module (RC4).
|
|
6
|
+
- Recorded non-relative package-import calls with `package_import` evidence instead of silently dropping them (RC5 minimal-safe); they remain deterministically unresolved until a post-publication workspace pass can resolve sibling-package symbols without index-order or stale-ID risk.
|
|
7
|
+
- Persisted bounded module-path and candidate-strategy evidence without a schema migration or trace/rendering shape change, with neutral parser, SQLite, trace-edge, and repeated force-index/relink coverage.
|
|
8
|
+
|
|
3
9
|
## 0.1.56
|
|
4
10
|
|
|
5
11
|
- Completed direct CAP query-builder execution-context indexing for builders returned by async or syntactically guaranteed-Promise callables and for static builder elements in awaited `Promise.all(...)`, while retaining one fact per logical statement and the existing conservative unknown-entity behavior.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/db/repositories.ts
|
|
4
|
+
import { posix } from "path";
|
|
5
|
+
|
|
3
6
|
// src/utils/000-bounded-projection.ts
|
|
4
7
|
var DEFAULT_EVIDENCE_CANDIDATE_LIMIT = 5;
|
|
5
8
|
function projectBounded(values, compare, limit = DEFAULT_EVIDENCE_CANDIDATE_LIMIT) {
|
|
@@ -387,34 +390,86 @@ function insertSymbolCalls(db, repoId, rows2) {
|
|
|
387
390
|
for (const r of rows2) {
|
|
388
391
|
const caller = callerStmt.get(repoId, r.sourceFile, r.callerQualifiedName);
|
|
389
392
|
const target = resolveSymbolCallTarget(db, repoId, r);
|
|
390
|
-
insertStmt.run(repoId, caller?.id, target.id, r.calleeExpression, r.importSource, r.sourceFile, r.sourceLine, target.status, 0.8, JSON.stringify({ ...r.evidence, candidateStrategy: target.strategy, candidateCount: target.candidateCount }), target.reason);
|
|
393
|
+
insertStmt.run(repoId, caller?.id, target.id, r.calleeExpression, r.importSource, r.sourceFile, r.sourceLine, target.status, 0.8, JSON.stringify({ ...r.evidence, candidateStrategy: target.strategy, candidateCount: target.candidateCount, resolvedModulePath: target.resolvedModulePath }), target.reason);
|
|
391
394
|
}
|
|
392
395
|
}
|
|
396
|
+
var stripExt = (value) => value.replace(/\.(ts|tsx|js|jsx|cds)$/, "");
|
|
397
|
+
function symbolTargetRows(rows2) {
|
|
398
|
+
return rows2.flatMap((row) => typeof row.id === "number" ? [{ id: row.id, kind: typeof row.kind === "string" ? row.kind : void 0, sourceFile: nullableString(row.sourceFile), evidenceJson: nullableString(row.evidenceJson) }] : []);
|
|
399
|
+
}
|
|
400
|
+
function relativeModuleTargets(callerSourceFile, importSource) {
|
|
401
|
+
const base = posix.dirname(callerSourceFile);
|
|
402
|
+
const joined = stripExt(posix.normalize(posix.join(base, importSource)));
|
|
403
|
+
return /* @__PURE__ */ new Set([joined, `${joined}/index`]);
|
|
404
|
+
}
|
|
405
|
+
function moduleRows(rows2, r) {
|
|
406
|
+
if (!r.importSource) return [];
|
|
407
|
+
const targets = relativeModuleTargets(r.sourceFile, r.importSource);
|
|
408
|
+
return rows2.filter((row) => typeof row.sourceFile === "string" && targets.has(stripExt(row.sourceFile)));
|
|
409
|
+
}
|
|
410
|
+
function resolvedSymbol(row, strategy, candidateCount, moduleScoped = false) {
|
|
411
|
+
return { id: row.id, status: "resolved", reason: null, strategy, candidateCount, resolvedModulePath: moduleScoped && row.sourceFile ? stripExt(row.sourceFile) : void 0 };
|
|
412
|
+
}
|
|
413
|
+
function exportedSymbolRows(db, repoId, r) {
|
|
414
|
+
return symbolTargetRows(db.prepare("SELECT id,kind,source_file sourceFile,evidence_json evidenceJson FROM symbols WHERE repo_id=? AND source_file<>? AND exported=1 AND (exported_name=? OR name=? OR qualified_name=?) ORDER BY id").all(repoId, r.sourceFile, r.calleeLocalName, r.calleeLocalName, r.calleeLocalName));
|
|
415
|
+
}
|
|
393
416
|
function isRelativeImportedSymbolCall(r) {
|
|
394
417
|
return Boolean(r.importSource?.startsWith("."));
|
|
395
418
|
}
|
|
419
|
+
function sameFileResolution(db, repoId, r, relation) {
|
|
420
|
+
const bareImport = relation === "relative_import" && isRelativeImportedSymbolCall(r) && !String(r.calleeLocalName).includes(".");
|
|
421
|
+
if (bareImport || relation === "relative_import_namespace_member" || relation === "package_import") return void 0;
|
|
422
|
+
const rows2 = symbolTargetRows(db.prepare("SELECT id FROM symbols WHERE repo_id=? AND source_file=? AND (name=? OR qualified_name=?) ORDER BY id").all(repoId, r.sourceFile, r.calleeLocalName, r.calleeLocalName));
|
|
423
|
+
if (rows2.length === 1 && rows2[0]) return resolvedSymbol(rows2[0], "same_file_exact", 1);
|
|
424
|
+
return rows2.length > 1 ? { id: null, status: "ambiguous", reason: "Multiple same-file symbol targets matched exactly", strategy: "same_file_exact", candidateCount: rows2.length } : void 0;
|
|
425
|
+
}
|
|
426
|
+
function classInstanceResolution(db, repoId, r, relation) {
|
|
427
|
+
if (relation !== "class_instance_method" || !isRelativeImportedSymbolCall(r)) return void 0;
|
|
428
|
+
const rows2 = symbolTargetRows(db.prepare("SELECT id FROM symbols WHERE repo_id=? AND source_file<>? AND qualified_name=? ORDER BY id").all(repoId, r.sourceFile, r.calleeLocalName));
|
|
429
|
+
if (rows2.length === 1 && rows2[0]) return resolvedSymbol(rows2[0], "relative_import_class_instance_method", 1);
|
|
430
|
+
return rows2.length > 1 ? { id: null, status: "ambiguous", reason: "Multiple relative class instance method targets matched exactly", strategy: "relative_import_class_instance_method", candidateCount: rows2.length } : void 0;
|
|
431
|
+
}
|
|
432
|
+
function namespaceResolution(db, repoId, r, relation) {
|
|
433
|
+
if (relation !== "relative_import_namespace_member" || !isRelativeImportedSymbolCall(r)) return void 0;
|
|
434
|
+
const rows2 = moduleRows(exportedSymbolRows(db, repoId, r), r);
|
|
435
|
+
if (rows2.length === 1 && rows2[0]) return resolvedSymbol(rows2[0], "relative_import_namespace_member", 1, true);
|
|
436
|
+
if (rows2.length > 1) return { id: null, status: "ambiguous", reason: "Multiple namespace member targets matched the imported module", strategy: "relative_import_namespace_member", candidateCount: rows2.length };
|
|
437
|
+
return { id: null, status: "unresolved", reason: "No namespace member target matched the imported module", strategy: "relative_import_namespace_member", candidateCount: 0 };
|
|
438
|
+
}
|
|
439
|
+
function proxyResolution(rows2, r, relation) {
|
|
440
|
+
if (relation !== "relative_import_proxy_member" || rows2.length <= 1) return void 0;
|
|
441
|
+
const mapped = rows2.filter((row) => String(row.evidenceJson ?? "").includes("exported_object_shorthand") || String(row.evidenceJson ?? "").includes("exported_object_literal"));
|
|
442
|
+
if (mapped.length > 0) {
|
|
443
|
+
const concrete = rows2.find((row) => row.kind !== "object_alias") ?? mapped[0];
|
|
444
|
+
return { id: concrete?.id ?? null, status: "resolved", reason: null, strategy: "proxy_member_exported_object_map", candidateCount: rows2.length };
|
|
445
|
+
}
|
|
446
|
+
const scoped = moduleRows(rows2, r);
|
|
447
|
+
if (scoped.length === 1 && scoped[0]) return resolvedSymbol(scoped[0], "relative_import_path_disambiguated", rows2.length, true);
|
|
448
|
+
return { id: null, status: "ambiguous", reason: "Proxy member target requires explicit factory/module/type evidence; global member name is ambiguous", strategy: "proxy_member_no_global_name_fallback", candidateCount: rows2.length };
|
|
449
|
+
}
|
|
450
|
+
function exportedResolution(rows2, r, relation) {
|
|
451
|
+
if (rows2.length === 1 && rows2[0]) return resolvedSymbol(rows2[0], relation === "relative_import_proxy_member" ? "proxy_member_unique_exported_candidate" : "relative_import_exported_exact", 1, moduleRows(rows2, r).length === 1);
|
|
452
|
+
if (rows2.length <= 1) return void 0;
|
|
453
|
+
const scoped = isRelativeImportedSymbolCall(r) ? moduleRows(rows2, r) : [];
|
|
454
|
+
if (scoped.length === 1 && scoped[0]) return resolvedSymbol(scoped[0], "relative_import_path_disambiguated", rows2.length, true);
|
|
455
|
+
return { id: null, status: "ambiguous", reason: "Multiple exported symbol targets matched exactly", strategy: "exported_exact", candidateCount: rows2.length };
|
|
456
|
+
}
|
|
457
|
+
function accessorResolution(db, repoId, r, relation) {
|
|
458
|
+
if (relation !== "relative_import" || !isRelativeImportedSymbolCall(r) || !/^[^.]+\.[^.]+$/.test(String(r.calleeLocalName))) return void 0;
|
|
459
|
+
const methodRows = symbolTargetRows(db.prepare("SELECT id,kind,source_file sourceFile FROM symbols WHERE repo_id=? AND source_file<>? AND kind='method' AND qualified_name=? ORDER BY id").all(repoId, r.sourceFile, r.calleeLocalName));
|
|
460
|
+
const scoped = moduleRows(methodRows, r);
|
|
461
|
+
if (scoped.length === 1 && scoped[0]) return resolvedSymbol(scoped[0], "relative_import_static_accessor_instance_method", 1, true);
|
|
462
|
+
return scoped.length > 1 ? { id: null, status: "ambiguous", reason: "Multiple static-accessor instance method targets matched the imported module", strategy: "relative_import_static_accessor_instance_method", candidateCount: scoped.length } : void 0;
|
|
463
|
+
}
|
|
396
464
|
function resolveSymbolCallTarget(db, repoId, r) {
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
const rows2 = db.prepare("SELECT id,kind,evidence_json evidenceJson FROM symbols WHERE repo_id=? AND source_file<>? AND exported=1 AND (exported_name=? OR name=? OR qualified_name=?) ORDER BY id").all(repoId, r.sourceFile, r.calleeLocalName, r.calleeLocalName, r.calleeLocalName);
|
|
407
|
-
if (evidence.relation === "relative_import_proxy_member" && rows2.length > 1) {
|
|
408
|
-
const objectMapRows = rows2.filter((row) => String(row.evidenceJson ?? "").includes("exported_object_shorthand") || String(row.evidenceJson ?? "").includes("exported_object_literal"));
|
|
409
|
-
if (objectMapRows.length > 0) {
|
|
410
|
-
const concrete = rows2.find((row) => row.kind !== "object_alias") ?? objectMapRows[0];
|
|
411
|
-
return { id: concrete?.id ?? null, status: "resolved", reason: null, strategy: "proxy_member_exported_object_map", candidateCount: rows2.length };
|
|
412
|
-
}
|
|
413
|
-
return { id: null, status: "ambiguous", reason: "Proxy member target requires explicit factory/module/type evidence; global member name is ambiguous", strategy: "proxy_member_no_global_name_fallback", candidateCount: rows2.length };
|
|
414
|
-
}
|
|
415
|
-
if (rows2.length === 1) return { id: rows2[0]?.id ?? null, status: "resolved", reason: null, strategy: evidence.relation === "relative_import_proxy_member" ? "proxy_member_unique_exported_candidate" : "relative_import_exported_exact", candidateCount: 1 };
|
|
416
|
-
if (rows2.length > 1) return { id: null, status: "ambiguous", reason: "Multiple exported symbol targets matched exactly", strategy: "exported_exact", candidateCount: rows2.length };
|
|
417
|
-
return { id: null, status: "unresolved", reason: "No local symbol target matched exactly", strategy: evidence.relation === "relative_import_proxy_member" ? "proxy_member_no_global_name_fallback" : "exact_symbol_match", candidateCount: 0 };
|
|
465
|
+
const relation = r.evidence.relation;
|
|
466
|
+
const early = sameFileResolution(db, repoId, r, relation) ?? classInstanceResolution(db, repoId, r, relation) ?? namespaceResolution(db, repoId, r, relation);
|
|
467
|
+
if (early) return early;
|
|
468
|
+
const rows2 = relation === "package_import" ? [] : exportedSymbolRows(db, repoId, r);
|
|
469
|
+
const matched = proxyResolution(rows2, r, relation) ?? exportedResolution(rows2, r, relation) ?? accessorResolution(db, repoId, r, relation);
|
|
470
|
+
if (matched) return matched;
|
|
471
|
+
if (relation === "package_import") return { id: null, status: "unresolved", reason: "Package import target resolution requires a post-publication workspace pass", strategy: "package_import_unresolved", candidateCount: 0 };
|
|
472
|
+
return { id: null, status: "unresolved", reason: "No local symbol target matched exactly", strategy: relation === "relative_import_proxy_member" ? "proxy_member_no_global_name_fallback" : "exact_symbol_match", candidateCount: 0 };
|
|
418
473
|
}
|
|
419
474
|
function insertCalls(db, repoId, rows2) {
|
|
420
475
|
const stmt = db.prepare(
|
|
@@ -8489,4 +8544,4 @@ export {
|
|
|
8489
8544
|
selectorRepoAmbiguousDiagnostic,
|
|
8490
8545
|
trace
|
|
8491
8546
|
};
|
|
8492
|
-
//# sourceMappingURL=chunk-
|
|
8547
|
+
//# sourceMappingURL=chunk-DCOFNDKS.js.map
|