debug cleanup
This commit is contained in:
parent
f79a6921fc
commit
8e3f314d86
@ -1,4 +1,7 @@
|
|||||||
import { jsonToAst } from '../src/utils/json-ast/index';
|
import { jsonToAst } from '../src/utils/json-ast/index';
|
||||||
|
import { JsonNode } from '../src/utils/json-ast/types';
|
||||||
|
import Debug from 'debug';
|
||||||
|
const debug = Debug('rz:json-ast');
|
||||||
|
|
||||||
// Example JSON data
|
// Example JSON data
|
||||||
const exampleJson = {
|
const exampleJson = {
|
||||||
@ -34,7 +37,7 @@ debug("Original JSON:", JSON.stringify(exampleJson, null, 2));
|
|||||||
debug("\nAST:", JSON.stringify(ast, null, 2));
|
debug("\nAST:", JSON.stringify(ast, null, 2));
|
||||||
|
|
||||||
// Example of traversing the AST
|
// Example of traversing the AST
|
||||||
function traverse(node: any, indent = 0) {
|
function traverse(node: JsonNode, indent = 0) {
|
||||||
const padding = ' '.repeat(indent);
|
const padding = ' '.repeat(indent);
|
||||||
const type = node.type.toUpperCase();
|
const type = node.type.toUpperCase();
|
||||||
const value = node.value !== undefined ? `: ${JSON.stringify(node.value)}` : '';
|
const value = node.value !== undefined ? `: ${JSON.stringify(node.value)}` : '';
|
||||||
@ -43,7 +46,7 @@ function traverse(node: any, indent = 0) {
|
|||||||
debug(`${padding}${type}${value}${path}`);
|
debug(`${padding}${type}${value}${path}`);
|
||||||
|
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
node.children.forEach((child: any) => traverse(child, indent + 2));
|
node.children.forEach((child: JsonNode) => traverse(child, indent + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
59
merge-chore-major-cleanup.md
Normal file
59
merge-chore-major-cleanup.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# Merge Request: Major Cleanup and Refactoring
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This MR represents a significant cleanup and refactoring effort, focusing on improving code organization, test structure, and documentation. The changes touch multiple areas of the codebase with a particular emphasis on the custom resolvers system and test infrastructure.
|
||||||
|
|
||||||
|
## Key Changes
|
||||||
|
|
||||||
|
### 1. Code Organization & Structure
|
||||||
|
- Reorganized test files into logical directories (`unit/`, `integration/`, `e2e/`, `performance/`)
|
||||||
|
- Moved and refactored custom resolvers into a more modular plugin architecture
|
||||||
|
- Created dedicated directories for documentation and planning artifacts
|
||||||
|
|
||||||
|
### 2. New Features & Enhancements
|
||||||
|
- Implemented JSON AST functionality for better delta analysis
|
||||||
|
- Enhanced plugin system with inter-plugin dependency support
|
||||||
|
- Added new built-in resolver plugins:
|
||||||
|
- Concatenation
|
||||||
|
- First Write Wins
|
||||||
|
- Last Write Wins
|
||||||
|
- Majority Vote
|
||||||
|
- Max/Min
|
||||||
|
- Running Average
|
||||||
|
|
||||||
|
### 3. Refactoring & Improvements
|
||||||
|
- Replaced `NegationHelper.createNegation` with `DeltaBuilder.negate`
|
||||||
|
- Improved relationship graph implementation
|
||||||
|
- Optimized lossless view resolution
|
||||||
|
- Enhanced resolver dependency handling and logging
|
||||||
|
- Added comprehensive test coverage for new and refactored components
|
||||||
|
|
||||||
|
### 4. Documentation
|
||||||
|
- Added extensive documentation for custom resolvers API
|
||||||
|
- Created documentation for delta patterns and schema validation
|
||||||
|
- Added test helper documentation
|
||||||
|
- Organized planning documents in `__plans__/` directory
|
||||||
|
|
||||||
|
### 5. Build & Tooling
|
||||||
|
- Added module alias `@src` for better import paths
|
||||||
|
- Removed unused scripts and logs
|
||||||
|
- Updated package dependencies
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
- Added numerous unit tests for new functionality
|
||||||
|
- Reorganized test files for better maintainability
|
||||||
|
- Added performance test cases
|
||||||
|
- Ensured backward compatibility through comprehensive test coverage
|
||||||
|
|
||||||
|
## Migration Notes
|
||||||
|
- Some test files have been moved to new locations
|
||||||
|
- Custom resolvers now use the new plugin architecture
|
||||||
|
- Dependencies between resolvers should now be handled through the new dependency system
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
- Review the new plugin architecture documentation
|
||||||
|
- Update any custom resolvers to use the new plugin system
|
||||||
|
- Test performance impact of the changes in production-like environments
|
||||||
|
|
||||||
|
## Related Issues
|
||||||
|
- [Reference any related issues or tickets here]
|
@ -3,8 +3,6 @@ import { Lossy } from '../lossy';
|
|||||||
import { DomainEntityID, PropertyID, ViewMany } from "../../core/types";
|
import { DomainEntityID, PropertyID, ViewMany } from "../../core/types";
|
||||||
import { valueFromDelta } from "../lossless";
|
import { valueFromDelta } from "../lossless";
|
||||||
import { EntityRecord, EntityRecordMany } from "@src/core/entity";
|
import { EntityRecord, EntityRecordMany } from "@src/core/entity";
|
||||||
import Debug from 'debug';
|
|
||||||
const debug = Debug('rz:test:performance');
|
|
||||||
|
|
||||||
export type AggregationType = 'min' | 'max' | 'sum' | 'average' | 'count';
|
export type AggregationType = 'min' | 'max' | 'sum' | 'average' | 'count';
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
import { ResolverPlugin } from "./plugin";
|
|
||||||
|
|
||||||
export abstract class TargetedPlugin<T> extends ResolverPlugin<T> {
|
|
||||||
constructor(target?: string) {
|
|
||||||
// If no target is provided, then we want to implicitly target the property
|
|
||||||
// to which this plugin is attached. That means that when we apply an update,
|
|
||||||
// we want to take the value of
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user