refactor: clean up deprecated functions and unused code

Remove unused files and implement proper version handling:
- Remove unused files: tensorflowUtils.ts, patched-platform-node.ts, test reporters
- Fix 5 TODO items with centralized version management in utils/version.ts
- Clean up duplicate metadata definitions in examples/basicUsage.ts
- Fix rollup config to use @rollup/plugin-terser instead of deprecated package
- Add comprehensive migration plan for deprecated methods (12 methods identified)

This cleanup removes 370 lines of dead code while maintaining full API compatibility.
All tests pass and build system works correctly.
This commit is contained in:
David Snelling 2025-08-05 10:16:05 -07:00
parent 838a998b6a
commit bbc77f292b
10 changed files with 178 additions and 548 deletions

View file

@ -33,6 +33,7 @@ import {
euclideanDistance,
cleanupWorkerPools
} from './utils/index.js'
import { getAugmentationVersion } from './utils/version.js'
import { NounType, VerbType, GraphNoun } from './types/graphTypes.js'
import {
ServerSearchConduitAugmentation,
@ -1557,10 +1558,7 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
// Only set createdBy if it doesn't exist or is being explicitly updated
if (!graphNoun.createdBy || options.service) {
graphNoun.createdBy = {
augmentation: service,
version: '1.0' // TODO: Get actual version from augmentation
}
graphNoun.createdBy = getAugmentationVersion(service)
}
// Update timestamps
@ -2957,10 +2955,7 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
}
} else if (!graphNoun.createdBy) {
// If no existing createdBy and none in the update, set it
graphNoun.createdBy = {
augmentation: service,
version: '1.0' // TODO: Get actual version from augmentation
}
graphNoun.createdBy = getAugmentationVersion(service)
// Set createdAt if it doesn't exist
if (!graphNoun.createdAt) {
@ -3223,10 +3218,7 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
createdAt: timestamp,
updatedAt: timestamp,
noun: NounType.Concept,
createdBy: {
augmentation: service,
version: '1.0' // TODO: Get actual version from augmentation
}
createdBy: getAugmentationVersion(service)
}
// Add the missing noun
@ -3265,10 +3257,7 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
createdAt: timestamp,
updatedAt: timestamp,
noun: NounType.Concept,
createdBy: {
augmentation: service,
version: '1.0' // TODO: Get actual version from augmentation
}
createdBy: getAugmentationVersion(service)
}
// Add the missing noun
@ -3389,10 +3378,7 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
weight: options.weight,
createdAt: timestamp,
updatedAt: timestamp,
createdBy: {
augmentation: service,
version: '1.0' // TODO: Get actual version from augmentation
},
createdBy: getAugmentationVersion(service),
data: options.metadata // Store the original metadata in the data field
}