@liuhange/dsh-construction-data-inventory 0.0.0-stage → 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/README.md +72 -3
- package/config/classification-config.json +111 -0
- package/config/encoding-rule-config.json +9 -0
- package/config/source-adapter-config.json +26 -0
- package/lib/acceptance-doc-adapter.js +56 -0
- package/lib/asset-code-generator.js +82 -0
- package/lib/asset-ledger-exporter.js +35 -0
- package/lib/change-traceability-checker.js +79 -0
- package/lib/checksum-calculator.js +53 -0
- package/lib/classification-mapper.js +50 -0
- package/lib/code-uniqueness-validator.js +20 -0
- package/lib/construction-config-loader.js +105 -0
- package/lib/contract-adapter.js +57 -0
- package/lib/default-classification-config.js +112 -0
- package/lib/default-encoding-rule-config.js +10 -0
- package/lib/ifc-model-adapter.js +156 -0
- package/lib/index.js +304 -0
- package/lib/input-validator.js +113 -0
- package/lib/invariant.js +32 -0
- package/lib/inventory-report-generator.js +140 -0
- package/lib/policy-basis-builder.js +25 -0
- package/lib/progress-record-adapter.js +58 -0
- package/lib/report-desensitizer.js +72 -0
- package/lib/review-override-recorder.js +54 -0
- package/lib/sequential-code-allocator.js +22 -0
- package/lib/source-adapter.js +2 -0
- package/lib/types/acceptance-doc-adapter.d.ts +11 -0
- package/lib/types/asset-code-generator.d.ts +17 -0
- package/lib/types/asset-ledger-exporter.d.ts +7 -0
- package/lib/types/change-traceability-checker.d.ts +11 -0
- package/lib/types/checksum-calculator.d.ts +7 -0
- package/lib/types/classification-mapper.d.ts +12 -0
- package/lib/types/code-uniqueness-validator.d.ts +8 -0
- package/lib/types/construction-config-loader.d.ts +11 -0
- package/lib/types/contract-adapter.d.ts +11 -0
- package/lib/types/default-classification-config.d.ts +3 -0
- package/lib/types/default-encoding-rule-config.d.ts +3 -0
- package/lib/types/ifc-model-adapter.d.ts +14 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/input-validator.d.ts +12 -0
- package/lib/types/invariant.d.ts +12 -0
- package/lib/types/inventory-report-generator.d.ts +22 -0
- package/lib/types/policy-basis-builder.d.ts +8 -0
- package/lib/types/progress-record-adapter.d.ts +11 -0
- package/lib/types/report-desensitizer.d.ts +12 -0
- package/lib/types/review-override-recorder.d.ts +21 -0
- package/lib/types/sequential-code-allocator.d.ts +10 -0
- package/lib/types/source-adapter.d.ts +9 -0
- package/lib/types/types.d.ts +157 -0
- package/lib/types/unified-asset-merger.d.ts +13 -0
- package/lib/types.js +2 -0
- package/lib/unified-asset-merger.js +18 -0
- package/package.json +68 -5
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const SENSITIVE_FIELD_PATTERNS = [
|
|
2
|
+
'amount',
|
|
3
|
+
'price',
|
|
4
|
+
'cost',
|
|
5
|
+
'fee',
|
|
6
|
+
'quote',
|
|
7
|
+
'quotation',
|
|
8
|
+
'合同金额',
|
|
9
|
+
'报价',
|
|
10
|
+
'费用',
|
|
11
|
+
'金额',
|
|
12
|
+
'参建方报价',
|
|
13
|
+
];
|
|
14
|
+
const UNKNOWN_SENSITIVE_REPLACEMENT = '***';
|
|
15
|
+
export class ReportDesensitizer {
|
|
16
|
+
desensitize(report) {
|
|
17
|
+
const warnings = [];
|
|
18
|
+
const desensitizedAssetList = report.assetList.map((asset) => {
|
|
19
|
+
const cleaned = this.desensitizeAsset(asset, warnings);
|
|
20
|
+
return cleaned;
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
report: {
|
|
24
|
+
...report,
|
|
25
|
+
assetList: desensitizedAssetList,
|
|
26
|
+
},
|
|
27
|
+
warnings,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
desensitizeAsset(asset, warnings) {
|
|
31
|
+
const cleaned = { ...asset };
|
|
32
|
+
const keys = Object.keys(cleaned);
|
|
33
|
+
for (const key of keys) {
|
|
34
|
+
if (this.isSensitiveField(String(key))) {
|
|
35
|
+
const value = cleaned[key];
|
|
36
|
+
if (value !== undefined && value !== null && String(value) !== '') {
|
|
37
|
+
warnings.push(`敏感字段 ${String(key)} 已脱敏`);
|
|
38
|
+
cleaned[key] = UNKNOWN_SENSITIVE_REPLACEMENT;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return cleaned;
|
|
43
|
+
}
|
|
44
|
+
desensitizeRecord(record) {
|
|
45
|
+
const warnings = [];
|
|
46
|
+
return this.desensitizeGenericRecord(record, warnings);
|
|
47
|
+
}
|
|
48
|
+
desensitizeGenericRecord(record, warnings) {
|
|
49
|
+
const cleaned = {};
|
|
50
|
+
for (const key of Object.keys(record)) {
|
|
51
|
+
if (this.isSensitiveField(key)) {
|
|
52
|
+
const value = record[key];
|
|
53
|
+
if (value !== undefined && value !== null && String(value) !== '') {
|
|
54
|
+
warnings.push(`敏感字段 ${key} 已脱敏`);
|
|
55
|
+
cleaned[key] = UNKNOWN_SENSITIVE_REPLACEMENT;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
cleaned[key] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
cleaned[key] = record[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return cleaned;
|
|
66
|
+
}
|
|
67
|
+
isSensitiveField(fieldName) {
|
|
68
|
+
const lower = fieldName.toLowerCase();
|
|
69
|
+
return SENSITIVE_FIELD_PATTERNS.some((pattern) => lower.includes(pattern.toLowerCase()));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=report-desensitizer.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { DEFAULT_OVERRIDE_LOG_PATH } from './invariant.js';
|
|
4
|
+
export class ReviewOverrideRecorder {
|
|
5
|
+
logPath;
|
|
6
|
+
constructor(logPath) {
|
|
7
|
+
this.logPath = logPath ?? resolve(process.cwd(), DEFAULT_OVERRIDE_LOG_PATH);
|
|
8
|
+
}
|
|
9
|
+
record(record) {
|
|
10
|
+
const dir = dirname(this.logPath);
|
|
11
|
+
if (!existsSync(dir)) {
|
|
12
|
+
mkdirSync(dir, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
const line = JSON.stringify(record) + '\n';
|
|
15
|
+
appendFileSync(this.logPath, line, 'utf-8');
|
|
16
|
+
}
|
|
17
|
+
getAll() {
|
|
18
|
+
if (!existsSync(this.logPath)) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const content = readFileSync(this.logPath, 'utf-8');
|
|
22
|
+
const records = [];
|
|
23
|
+
for (const line of content.split(/\r?\n/)) {
|
|
24
|
+
if (line.trim() === '')
|
|
25
|
+
continue;
|
|
26
|
+
try {
|
|
27
|
+
records.push(JSON.parse(line));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return records;
|
|
34
|
+
}
|
|
35
|
+
delete() {
|
|
36
|
+
return {
|
|
37
|
+
error: 'OVERWRITE_RECORD_IMMUTABLE',
|
|
38
|
+
message: '覆盖记录不可删除,仅允许追加新的覆盖记录',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
buildRecord(params) {
|
|
42
|
+
return {
|
|
43
|
+
assetId: params.assetId,
|
|
44
|
+
reviewItem: params.reviewItem,
|
|
45
|
+
originalConclusion: params.originalConclusion,
|
|
46
|
+
newConclusion: params.newConclusion,
|
|
47
|
+
overrideReason: params.overrideReason,
|
|
48
|
+
operator: params.operator,
|
|
49
|
+
overrideTime: new Date().toISOString(),
|
|
50
|
+
originalAssetCode: params.originalAssetCode,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=review-override-recorder.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class SequentialCodeAllocator {
|
|
2
|
+
current;
|
|
3
|
+
max;
|
|
4
|
+
start;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.start = config.sequentialCodeStart;
|
|
7
|
+
this.current = config.sequentialCodeStart;
|
|
8
|
+
this.max = config.sequentialCodeMax;
|
|
9
|
+
}
|
|
10
|
+
allocate() {
|
|
11
|
+
if (this.current > this.max) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const value = this.current;
|
|
15
|
+
this.current++;
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
reset() {
|
|
19
|
+
this.current = this.start;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=sequential-code-allocator.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UnifiedAssetItem } from './types.js';
|
|
2
|
+
import type { SourceAdapter } from './source-adapter.js';
|
|
3
|
+
export declare class AcceptanceDocAdapter implements SourceAdapter {
|
|
4
|
+
adapt(sourcePath: string, systemId: string, projectId: string): {
|
|
5
|
+
assets: UnifiedAssetItem[];
|
|
6
|
+
warnings: string[];
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
private mapAcceptanceTypeToDataType;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=acceptance-doc-adapter.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AssetCodeGenerateResult, EncodingRuleConfig, UnifiedAssetItem } from './types.js';
|
|
2
|
+
export interface AssetCodeGenerationResult {
|
|
3
|
+
assets: UnifiedAssetItem[];
|
|
4
|
+
errors: string[];
|
|
5
|
+
warnings: string[];
|
|
6
|
+
overflowAssets: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class AssetCodeGenerator {
|
|
9
|
+
private readonly checksumCalculator;
|
|
10
|
+
private readonly uniquenessValidator;
|
|
11
|
+
constructor();
|
|
12
|
+
generate(classifiedAssets: UnifiedAssetItem[], encodingRuleConfig: EncodingRuleConfig): AssetCodeGenerationResult;
|
|
13
|
+
regenerateForAsset(asset: UnifiedAssetItem, encodingRuleConfig: EncodingRuleConfig): AssetCodeGenerationResult;
|
|
14
|
+
generateSingleCode(classificationCode: string, sequentialCode: number, encodingRuleConfig: EncodingRuleConfig): AssetCodeGenerateResult;
|
|
15
|
+
private padToLength;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=asset-code-generator.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssetLedgerEntry, UnifiedAssetItem } from './types.js';
|
|
2
|
+
export declare class AssetLedgerExporter {
|
|
3
|
+
export(assetList: UnifiedAssetItem[], outputPath: string): string;
|
|
4
|
+
buildLedger(assetList: UnifiedAssetItem[]): AssetLedgerEntry[];
|
|
5
|
+
exportToPath(assetList: UnifiedAssetItem[], outputPathDir: string): string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=asset-ledger-exporter.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChangeRecord, ChangeTraceabilityResult } from './types.js';
|
|
2
|
+
export interface ChangeTraceabilityCheckResult {
|
|
3
|
+
results: ChangeTraceabilityResult[];
|
|
4
|
+
warnings: string[];
|
|
5
|
+
skipped: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class ChangeTraceabilityChecker {
|
|
8
|
+
check(changeRecords: ChangeRecord[], assetIds: string[]): ChangeTraceabilityCheckResult;
|
|
9
|
+
checkWithSkip(changeRecords: ChangeRecord[] | null, assetIds: string[]): ChangeTraceabilityCheckResult;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=change-traceability-checker.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ClassificationConfig, UnifiedAssetItem } from './types.js';
|
|
2
|
+
export interface ClassificationMapResult {
|
|
3
|
+
assets: UnifiedAssetItem[];
|
|
4
|
+
warnings: string[];
|
|
5
|
+
unclassified: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class ClassificationMapper {
|
|
8
|
+
map(unifiedAssets: UnifiedAssetItem[], classificationConfig: ClassificationConfig | null): ClassificationMapResult;
|
|
9
|
+
private findMatchingRules;
|
|
10
|
+
isValidClassificationCode(code: string, config: ClassificationConfig): boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=classification-mapper.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfigLoadResult } from './types.js';
|
|
2
|
+
export declare class ConstructionConfigLoader {
|
|
3
|
+
private readonly configPath;
|
|
4
|
+
constructor(configPath?: string);
|
|
5
|
+
load(): ConfigLoadResult;
|
|
6
|
+
private aggregateStatus;
|
|
7
|
+
private loadClassificationConfig;
|
|
8
|
+
private loadEncodingRuleConfig;
|
|
9
|
+
private loadSourceAdapterConfig;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=construction-config-loader.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UnifiedAssetItem } from './types.js';
|
|
2
|
+
import type { SourceAdapter } from './source-adapter.js';
|
|
3
|
+
export declare class ContractAdapter implements SourceAdapter {
|
|
4
|
+
adapt(sourcePath: string, systemId: string, projectId: string): {
|
|
5
|
+
assets: UnifiedAssetItem[];
|
|
6
|
+
warnings: string[];
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
private mapContractTypeToDataType;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=contract-adapter.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IfcParseResult, UnifiedAssetItem } from './types.js';
|
|
2
|
+
import type { SourceAdapter } from './source-adapter.js';
|
|
3
|
+
export declare class IfcModelAdapter implements SourceAdapter {
|
|
4
|
+
adapt(sourcePath: string, systemId: string, projectId: string): {
|
|
5
|
+
assets: UnifiedAssetItem[];
|
|
6
|
+
warnings: string[];
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
parseIfc(content: string, filePath: string): IfcParseResult;
|
|
10
|
+
private extractGuid;
|
|
11
|
+
private extractAttributes;
|
|
12
|
+
private mapEntityTypeToDataType;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ifc-model-adapter.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChangeRecord, SourceConfig, ValidationResult } from './types.js';
|
|
2
|
+
export declare class InputValidator {
|
|
3
|
+
validateInspectInput(args: unknown): ValidationResult;
|
|
4
|
+
validateOverrideInput(args: unknown): ValidationResult;
|
|
5
|
+
validateSources(sourceConfig: SourceConfig): ValidationResult;
|
|
6
|
+
isSourceAvailable(sourcePath: string): boolean;
|
|
7
|
+
validateChangeRecords(changeRecords: unknown): {
|
|
8
|
+
valid: ChangeRecord[];
|
|
9
|
+
invalid: string[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=input-validator.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const PLUGIN_NAME = "@liuhange/dsh-construction-data-inventory";
|
|
2
|
+
export declare const DEFAULT_CLASSIFICATION_CONFIG_PATH = "config/classification-config.json";
|
|
3
|
+
export declare const DEFAULT_ENCODING_RULE_CONFIG_PATH = "config/encoding-rule-config.json";
|
|
4
|
+
export declare const DEFAULT_SOURCE_ADAPTER_CONFIG_PATH = "config/source-adapter-config.json";
|
|
5
|
+
export declare const DEFAULT_OVERRIDE_LOG_PATH = "logs/override-records.log";
|
|
6
|
+
export declare const LEGAL_DISCLAIMER = "\u672C\u62A5\u544A\u7531\u8F85\u52A9\u76D8\u70B9\u5DE5\u5177\u751F\u6210\uFF0C\u4E0D\u66FF\u4EE3GB/T 51269\u6807\u51C6\u7684\u6B63\u5F0F\u5408\u89C4\u8BA4\u8BC1";
|
|
7
|
+
export declare const POLICY_STANDARD_NAME = "\u300A\u5EFA\u7B51\u4FE1\u606F\u6A21\u578B\u5206\u7C7B\u548C\u7F16\u7801\u6807\u51C6\u300B\uFF08GB/T 51269-2017\uFF09";
|
|
8
|
+
export type ErrorCode = 'ASSET_NOT_FOUND' | 'REASON_REQUIRED' | 'OVERWRITE_RECORD_IMMUTABLE' | 'INVALID_CLASSIFICATION_CODE' | 'CHECKSUM_ALGORITHM_MISSING' | 'INPUT_INVALID' | 'CONFIG_NOT_FOUND' | 'SOURCE_UNAVAILABLE' | 'IFC_PARSE_ERROR' | 'SEQUENTIAL_CODE_OVERFLOW' | 'UNKNOWN_ERROR';
|
|
9
|
+
export type ConfigLoadStatus = 'CONFIG_LOADED' | 'DEFAULT_MISSING' | 'DEFAULT_PARSE' | 'DEFAULT_VERSION' | 'DEFAULT_PARTIAL';
|
|
10
|
+
export declare const SUPPORTED_IFC_VERSIONS: readonly ["IFC2X3", "IFC4"];
|
|
11
|
+
export declare const IFC_ENTITY_TYPES: readonly ["IFCWALL", "IFCWALLSTANDARDCASE", "IFCCOLUMN", "IFCCOLUMNSTANDARDCASE", "IFCSLAB", "IFCSLABSTANDARDCASE", "IFCDOOR", "IFCWINDOW", "IFCSPACE", "IFCBUILDINGSTOREY", "IFCBUILDING", "IFCSITE", "IFCROOF", "IFCBEAM", "IFCBEAMSTANDARDCASE", "IFCFOOTING", "IFCSTAIR", "IFCSTAIRFLIGHT", "IFCRAILING", "IFCCURTAINWALL", "IFCPROPERTYSET"];
|
|
12
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ChangeTraceabilityResult, ClassificationEncodingEntry, ConfigVersionSet, InventoryReport, ReviewOverrideRecord, UnifiedAssetItem, ValidationError } from './types.js';
|
|
2
|
+
export declare class InventoryReportGenerator {
|
|
3
|
+
private readonly policyBasisBuilder;
|
|
4
|
+
private readonly desensitizer;
|
|
5
|
+
private readonly ledgerExporter;
|
|
6
|
+
constructor();
|
|
7
|
+
generate(params: {
|
|
8
|
+
assetList: UnifiedAssetItem[];
|
|
9
|
+
classificationEncodingList: ClassificationEncodingEntry[];
|
|
10
|
+
changeTraceabilityReport: ChangeTraceabilityResult[];
|
|
11
|
+
overrideList: ReviewOverrideRecord[];
|
|
12
|
+
errorList: ValidationError[];
|
|
13
|
+
configVersions: ConfigVersionSet;
|
|
14
|
+
projectId: string;
|
|
15
|
+
skippedChangeTraceability?: boolean;
|
|
16
|
+
}): InventoryReport;
|
|
17
|
+
writeJson(report: InventoryReport, outputPathDir: string): string;
|
|
18
|
+
writeMarkdown(report: InventoryReport, outputPathDir: string): string;
|
|
19
|
+
exportLedger(assetList: UnifiedAssetItem[], outputPathDir: string): string;
|
|
20
|
+
private renderMarkdown;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=inventory-report-generator.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class PolicyBasisBuilder {
|
|
2
|
+
build(clause: string): string;
|
|
3
|
+
buildClassification(): string;
|
|
4
|
+
buildEncoding(): string;
|
|
5
|
+
buildChangeTraceability(): string;
|
|
6
|
+
buildSummary(policyBasisList: string[]): string[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=policy-basis-builder.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UnifiedAssetItem } from './types.js';
|
|
2
|
+
import type { SourceAdapter } from './source-adapter.js';
|
|
3
|
+
export declare class ProgressRecordAdapter implements SourceAdapter {
|
|
4
|
+
adapt(sourcePath: string, systemId: string, projectId: string): {
|
|
5
|
+
assets: UnifiedAssetItem[];
|
|
6
|
+
warnings: string[];
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
private mapProcessTypeToDataType;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=progress-record-adapter.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InventoryReport, UnifiedAssetItem } from './types.js';
|
|
2
|
+
export declare class ReportDesensitizer {
|
|
3
|
+
desensitize(report: InventoryReport): {
|
|
4
|
+
report: InventoryReport;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
};
|
|
7
|
+
desensitizeAsset(asset: UnifiedAssetItem, warnings: string[]): UnifiedAssetItem;
|
|
8
|
+
desensitizeRecord(record: Record<string, unknown>): Record<string, unknown>;
|
|
9
|
+
private desensitizeGenericRecord;
|
|
10
|
+
private isSensitiveField;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=report-desensitizer.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReviewOverrideRecord } from './types.js';
|
|
2
|
+
export declare class ReviewOverrideRecorder {
|
|
3
|
+
private readonly logPath;
|
|
4
|
+
constructor(logPath?: string);
|
|
5
|
+
record(record: ReviewOverrideRecord): void;
|
|
6
|
+
getAll(): ReviewOverrideRecord[];
|
|
7
|
+
delete(): {
|
|
8
|
+
error: 'OVERWRITE_RECORD_IMMUTABLE';
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
buildRecord(params: {
|
|
12
|
+
assetId: string;
|
|
13
|
+
reviewItem: ReviewOverrideRecord['reviewItem'];
|
|
14
|
+
originalConclusion: string;
|
|
15
|
+
newConclusion: string;
|
|
16
|
+
overrideReason: string;
|
|
17
|
+
operator: string;
|
|
18
|
+
originalAssetCode: string;
|
|
19
|
+
}): ReviewOverrideRecord;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=review-override-recorder.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EncodingRuleConfig } from './types.js';
|
|
2
|
+
export declare class SequentialCodeAllocator {
|
|
3
|
+
private current;
|
|
4
|
+
private readonly max;
|
|
5
|
+
private readonly start;
|
|
6
|
+
constructor(config: EncodingRuleConfig);
|
|
7
|
+
allocate(): number | null;
|
|
8
|
+
reset(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=sequential-code-allocator.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UnifiedAssetItem } from './types.js';
|
|
2
|
+
export interface SourceAdapter {
|
|
3
|
+
adapt(sourcePath: string, systemId: string, projectId: string): {
|
|
4
|
+
assets: UnifiedAssetItem[];
|
|
5
|
+
warnings: string[];
|
|
6
|
+
errors: string[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=source-adapter.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { ConfigLoadStatus, ErrorCode } from './invariant.js';
|
|
2
|
+
export type JudgmentStatus = '自动判定' | '人工确认';
|
|
3
|
+
export type ReviewItem = 'classification' | 'encoding' | 'changeTraceability';
|
|
4
|
+
export interface UnifiedAssetItem {
|
|
5
|
+
assetId: string;
|
|
6
|
+
sourceSystemId: string;
|
|
7
|
+
dataType: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
collectionTime: string;
|
|
10
|
+
classificationCode: string;
|
|
11
|
+
assetCode: string;
|
|
12
|
+
judgmentStatus: JudgmentStatus;
|
|
13
|
+
originalAssetCode?: string;
|
|
14
|
+
policyBasis?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SourceConfigEntry {
|
|
17
|
+
type: string;
|
|
18
|
+
systemId: string;
|
|
19
|
+
path: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SourceConfig {
|
|
23
|
+
projectId: string;
|
|
24
|
+
sources: SourceConfigEntry[];
|
|
25
|
+
}
|
|
26
|
+
export interface ApprovalChain {
|
|
27
|
+
initiator: string;
|
|
28
|
+
approver: string;
|
|
29
|
+
approvalTime: string;
|
|
30
|
+
approvalConclusion: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ChangeRecord {
|
|
33
|
+
changeId: string;
|
|
34
|
+
relatedAssetId: string;
|
|
35
|
+
changeReason: string;
|
|
36
|
+
approvalChain: ApprovalChain;
|
|
37
|
+
impactScope: string[];
|
|
38
|
+
changeDate: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ClassificationNode {
|
|
41
|
+
classificationCode: string;
|
|
42
|
+
classificationName: string;
|
|
43
|
+
parentCode: string;
|
|
44
|
+
level: number;
|
|
45
|
+
mappedDataTypes: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface ClassificationConfig {
|
|
48
|
+
version: string;
|
|
49
|
+
lastUpdated: string;
|
|
50
|
+
nodes: ClassificationNode[];
|
|
51
|
+
}
|
|
52
|
+
export interface EncodingRuleConfig {
|
|
53
|
+
version: string;
|
|
54
|
+
lastUpdated: string;
|
|
55
|
+
classificationCodeLength: number;
|
|
56
|
+
sequentialCodeLength: number;
|
|
57
|
+
sequentialCodeStart: number;
|
|
58
|
+
sequentialCodeMax: number;
|
|
59
|
+
checksumAlgorithm: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SourceAdapterConfigEntry {
|
|
62
|
+
type: string;
|
|
63
|
+
adapterClassName: string;
|
|
64
|
+
supportedVersions: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface SourceAdapterConfig {
|
|
67
|
+
version: string;
|
|
68
|
+
lastUpdated: string;
|
|
69
|
+
adapters: SourceAdapterConfigEntry[];
|
|
70
|
+
}
|
|
71
|
+
export interface ClassificationEncodingEntry {
|
|
72
|
+
assetId: string;
|
|
73
|
+
classificationCode: string;
|
|
74
|
+
assetCode: string;
|
|
75
|
+
policyBasis: string;
|
|
76
|
+
judgmentStatus: JudgmentStatus;
|
|
77
|
+
}
|
|
78
|
+
export interface ChangeTraceabilityResult {
|
|
79
|
+
changeId: string;
|
|
80
|
+
assetLinked: boolean;
|
|
81
|
+
recordComplete: boolean;
|
|
82
|
+
approvalChainComplete: boolean;
|
|
83
|
+
impactScopeLinked: boolean;
|
|
84
|
+
missingItems: string[];
|
|
85
|
+
policyBasis: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ReviewOverrideRecord {
|
|
88
|
+
assetId: string;
|
|
89
|
+
reviewItem: ReviewItem;
|
|
90
|
+
originalConclusion: string;
|
|
91
|
+
newConclusion: string;
|
|
92
|
+
overrideReason: string;
|
|
93
|
+
operator: string;
|
|
94
|
+
overrideTime: string;
|
|
95
|
+
originalAssetCode: string;
|
|
96
|
+
}
|
|
97
|
+
export interface AssetLedgerEntry {
|
|
98
|
+
assetCode: string;
|
|
99
|
+
classificationCode: string;
|
|
100
|
+
sourceSystemId: string;
|
|
101
|
+
inventoryTime: string;
|
|
102
|
+
judgmentStatus: JudgmentStatus;
|
|
103
|
+
}
|
|
104
|
+
export interface ConfigVersionSet {
|
|
105
|
+
classificationConfigVersion: string;
|
|
106
|
+
encodingRuleConfigVersion: string;
|
|
107
|
+
sourceAdapterConfigVersion: string;
|
|
108
|
+
}
|
|
109
|
+
export interface ValidationError {
|
|
110
|
+
assetId: string;
|
|
111
|
+
errorMessage: string;
|
|
112
|
+
}
|
|
113
|
+
export interface InventoryReport {
|
|
114
|
+
reportId: string;
|
|
115
|
+
inventoryTime: string;
|
|
116
|
+
projectId: string;
|
|
117
|
+
assetList: UnifiedAssetItem[];
|
|
118
|
+
classificationEncodingList: ClassificationEncodingEntry[];
|
|
119
|
+
changeTraceabilityReport: ChangeTraceabilityResult[];
|
|
120
|
+
overrideList: ReviewOverrideRecord[];
|
|
121
|
+
errorList: ValidationError[];
|
|
122
|
+
policyBasisSummary: string[];
|
|
123
|
+
configVersions: ConfigVersionSet;
|
|
124
|
+
legalDisclaimer: string;
|
|
125
|
+
}
|
|
126
|
+
export interface ConfigLoadResult {
|
|
127
|
+
classificationConfig: ClassificationConfig;
|
|
128
|
+
encodingRuleConfig: EncodingRuleConfig;
|
|
129
|
+
sourceAdapterConfig: SourceAdapterConfig;
|
|
130
|
+
loadStatus: ConfigLoadStatus;
|
|
131
|
+
}
|
|
132
|
+
export interface ValidationResult {
|
|
133
|
+
isValid: boolean;
|
|
134
|
+
errors: ValidationError[];
|
|
135
|
+
}
|
|
136
|
+
export interface IfcEntityRecord {
|
|
137
|
+
lineId: number;
|
|
138
|
+
entityType: string;
|
|
139
|
+
guid: string;
|
|
140
|
+
attributes: string[];
|
|
141
|
+
}
|
|
142
|
+
export interface IfcParseResult {
|
|
143
|
+
entities: IfcEntityRecord[];
|
|
144
|
+
warnings: string[];
|
|
145
|
+
errors: string[];
|
|
146
|
+
version: string;
|
|
147
|
+
}
|
|
148
|
+
export interface AssetCodeGenerateResult {
|
|
149
|
+
assetCode: string;
|
|
150
|
+
policyBasis: string;
|
|
151
|
+
error?: ErrorCode;
|
|
152
|
+
}
|
|
153
|
+
export interface ToolError {
|
|
154
|
+
error: ErrorCode;
|
|
155
|
+
message: string;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UnifiedAssetItem } from './types.js';
|
|
2
|
+
export declare class UnifiedAssetMerger {
|
|
3
|
+
merge(adaptedAssetLists: Array<{
|
|
4
|
+
assets: UnifiedAssetItem[];
|
|
5
|
+
warnings: string[];
|
|
6
|
+
errors: string[];
|
|
7
|
+
}>): {
|
|
8
|
+
unifiedAssets: UnifiedAssetItem[];
|
|
9
|
+
warnings: string[];
|
|
10
|
+
errors: string[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=unified-asset-merger.d.ts.map
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class UnifiedAssetMerger {
|
|
2
|
+
merge(adaptedAssetLists) {
|
|
3
|
+
const unifiedAssets = [];
|
|
4
|
+
const warnings = [];
|
|
5
|
+
const errors = [];
|
|
6
|
+
for (const list of adaptedAssetLists) {
|
|
7
|
+
if (!list)
|
|
8
|
+
continue;
|
|
9
|
+
warnings.push(...(list.warnings ?? []));
|
|
10
|
+
errors.push(...(list.errors ?? []));
|
|
11
|
+
for (const asset of list.assets ?? []) {
|
|
12
|
+
unifiedAssets.push(asset);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return { unifiedAssets, warnings, errors };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=unified-asset-merger.js.map
|