@liuhange/dsh-data-asset-valuation 3.0.0 → 3.1.0
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/lib/capitalizationTraceGuard.js +31 -0
- package/lib/index.js +15 -1
- package/package.json +22 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function checkCapitalizationTrace(_recommendedValue, config) {
|
|
2
|
+
if (!config.enabled) {
|
|
3
|
+
return { passed: true, warning: null, policyRef: config.policyRef };
|
|
4
|
+
}
|
|
5
|
+
return {
|
|
6
|
+
passed: true,
|
|
7
|
+
warning: config.warningMessage,
|
|
8
|
+
policyRef: config.policyRef,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function annotateCostReliability(hasCompleteVouchers, hasPartialVouchers, config) {
|
|
12
|
+
if (!config.enabled) {
|
|
13
|
+
return { level: 'medium', criteria: config.criteria.medium ?? '', policyRef: config.policyRef };
|
|
14
|
+
}
|
|
15
|
+
let level;
|
|
16
|
+
if (hasCompleteVouchers) {
|
|
17
|
+
level = 'high';
|
|
18
|
+
}
|
|
19
|
+
else if (hasPartialVouchers) {
|
|
20
|
+
level = 'medium';
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
level = 'low';
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
level,
|
|
27
|
+
criteria: config.criteria[level] ?? '',
|
|
28
|
+
policyRef: config.policyRef,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=capitalizationTraceGuard.js.map
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { calculateCostBasedValue } from './costBasedValuation.js';
|
|
|
2
2
|
import { calculateIncomeBasedValue } from './incomeBasedValuation.js';
|
|
3
3
|
import { generateValuationReport } from './valuationReportGenerator.js';
|
|
4
4
|
import { validateValuationArgs } from './invariant.js';
|
|
5
|
+
import { checkCapitalizationTrace, annotateCostReliability } from './capitalizationTraceGuard.js';
|
|
5
6
|
export const name = '@liuhange/dsh-data-asset-valuation';
|
|
6
7
|
export const inject = ['tools'];
|
|
7
8
|
export function apply(ctx) {
|
|
@@ -72,7 +73,20 @@ export function apply(ctx) {
|
|
|
72
73
|
const costBased = calculateCostBasedValue(validated.costItems, valuationConfig.costBased);
|
|
73
74
|
const incomeBased = calculateIncomeBasedValue(validated.incomeScenarios, valuationConfig.incomeBased, validated.discountRate);
|
|
74
75
|
const report = generateValuationReport(validated.assetName, costBased, incomeBased, valuationConfig.pricingReference, validated.qualityScore, policyDocuments);
|
|
75
|
-
|
|
76
|
+
const capGuardConfig = valuationConfig.capitalizationTraceGuard;
|
|
77
|
+
const capGuard = capGuardConfig
|
|
78
|
+
? checkCapitalizationTrace(report.recommendedValue, capGuardConfig)
|
|
79
|
+
: null;
|
|
80
|
+
const costRelConfig = valuationConfig.costReliabilityMeasurement;
|
|
81
|
+
const costReliability = costRelConfig
|
|
82
|
+
? annotateCostReliability(true, false, costRelConfig)
|
|
83
|
+
: null;
|
|
84
|
+
const enrichedReport = {
|
|
85
|
+
...report,
|
|
86
|
+
capitalizationTraceGuard: capGuard,
|
|
87
|
+
costReliabilityAnnotation: costReliability,
|
|
88
|
+
};
|
|
89
|
+
return JSON.stringify(enrichedReport, null, 2);
|
|
76
90
|
}
|
|
77
91
|
catch (e) {
|
|
78
92
|
const err = e;
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liuhange/dsh-data-asset-valuation",
|
|
3
3
|
"description": "Data asset valuation plugin: cost-based (replacement cost - depreciation) + income-based (DCF) dual model",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
|
|
4
|
+
"version": "3.1.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/liuhange789/data-asset-inspector.git",
|
|
11
|
+
"directory": "packages/data-asset/data-asset-valuation"
|
|
12
|
+
},
|
|
7
13
|
"type": "module",
|
|
8
14
|
"main": "lib/index.js",
|
|
9
15
|
"types": "lib/types/index.d.ts",
|
|
10
16
|
"exports": {
|
|
11
|
-
".": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
12
21
|
"./src/*": "./src/*",
|
|
13
22
|
"./package.json": "./package.json"
|
|
14
23
|
},
|
|
15
|
-
"files": [
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/**/*.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
16
28
|
"license": "MIT",
|
|
17
29
|
"scripts": {
|
|
18
30
|
"typecheck": "tsc --noEmit",
|
|
@@ -24,5 +36,9 @@
|
|
|
24
36
|
"@deepseek-ai/dsh-tools": "0.0.1-rc.1",
|
|
25
37
|
"@liuhange/dsh-data-asset-shared": "^3.0.0"
|
|
26
38
|
},
|
|
27
|
-
"dsh": {
|
|
39
|
+
"dsh": {
|
|
40
|
+
"bundle": {
|
|
41
|
+
"patch": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
28
44
|
}
|