@saptools/service-flow 0.1.53 → 0.1.54
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/README.md +2 -0
- package/TECHNICAL-NOTE.md +7 -0
- package/dist/{chunk-LFH7C46B.js → chunk-ERIZHM5C.js} +535 -126
- package/dist/chunk-ERIZHM5C.js.map +1 -0
- package/dist/cli.js +13 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/cli/001-doctor-projection.ts +3 -7
- package/src/linker/000-implementation-candidates.ts +35 -2
- package/src/linker/001-implementation-evidence-projection.ts +78 -6
- package/src/output/table-output.ts +11 -2
- package/src/trace/008-contextual-runtime-state.ts +294 -0
- package/src/trace/009-selected-handler-provenance.ts +186 -0
- package/src/trace/evidence.ts +103 -31
- package/src/trace/trace-engine.ts +67 -82
- package/src/utils/000-bounded-projection.ts +20 -15
- package/dist/chunk-LFH7C46B.js.map +0 -1
|
@@ -23,6 +23,25 @@ export function projectBounded<T>(
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Evidence producers establish semantic order before calling the generic
|
|
28
|
+
* recursive bounder. Re-sorting here would make a selected decision appear
|
|
29
|
+
* to be explained by a different candidate.
|
|
30
|
+
*/
|
|
31
|
+
export function projectBoundedInOrder<T>(
|
|
32
|
+
values: readonly T[],
|
|
33
|
+
limit = DEFAULT_EVIDENCE_CANDIDATE_LIMIT,
|
|
34
|
+
): BoundedProjection<T> {
|
|
35
|
+
const normalizedLimit = positiveLimit(limit);
|
|
36
|
+
const items = values.slice(0, normalizedLimit);
|
|
37
|
+
return {
|
|
38
|
+
totalCount: values.length,
|
|
39
|
+
shownCount: items.length,
|
|
40
|
+
omittedCount: Math.max(0, values.length - items.length),
|
|
41
|
+
items,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
export function positiveLimit(value: number | undefined): number {
|
|
27
46
|
return Number.isFinite(value) && Number(value) > 0
|
|
28
47
|
? Math.floor(Number(value))
|
|
@@ -73,7 +92,7 @@ export function boundCandidateLikeEvidence(
|
|
|
73
92
|
output[key] = boundNestedEvidence(value, limit);
|
|
74
93
|
continue;
|
|
75
94
|
}
|
|
76
|
-
const projection =
|
|
95
|
+
const projection = projectBoundedInOrder(value, limit);
|
|
77
96
|
output[key] = projection.items.map((item) => boundNestedEvidence(item, limit));
|
|
78
97
|
addCollectionCounts(output, evidence, key, projection);
|
|
79
98
|
}
|
|
@@ -138,20 +157,6 @@ function collectionStem(key: string): string {
|
|
|
138
157
|
return stems[key] ?? 'candidate';
|
|
139
158
|
}
|
|
140
159
|
|
|
141
|
-
function compareEvidenceValue(left: unknown, right: unknown): number {
|
|
142
|
-
return stableProjectionValue(left).localeCompare(stableProjectionValue(right));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export function stableProjectionValue(value: unknown): string {
|
|
146
|
-
if (Array.isArray(value))
|
|
147
|
-
return `[${value.map(stableProjectionValue).join(',')}]`;
|
|
148
|
-
if (isEvidenceRecord(value)) {
|
|
149
|
-
return `{${Object.keys(value).sort().map((key) =>
|
|
150
|
-
`${JSON.stringify(key)}:${stableProjectionValue(value[key])}`).join(',')}}`;
|
|
151
|
-
}
|
|
152
|
-
return JSON.stringify(value) ?? '';
|
|
153
|
-
}
|
|
154
|
-
|
|
155
160
|
function numericValue(value: unknown): number {
|
|
156
161
|
return typeof value === 'number' && Number.isFinite(value) ? value : 0;
|
|
157
162
|
}
|