Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
75fdab2
Implement audit recommendations: security, performance, and code qual…
avoidwork Apr 17, 2026
7307216
Remove PLAN.md - implementation complete
avoidwork Apr 17, 2026
749112a
chore: swap eslint for oxlint/oxfmt
avoidwork Apr 17, 2026
7a6505d
chore: add AGENTS.md and config files
avoidwork Apr 17, 2026
34f81c6
chore: remove eslint config
avoidwork Apr 17, 2026
64e5b70
chore: update build and config
avoidwork Apr 17, 2026
e3ba299
chore: rebuild dist
avoidwork Apr 17, 2026
c0178f7
test: convert mocha tests to node:test
avoidwork Apr 17, 2026
c31e662
chore: remove .cursor directory
avoidwork Apr 17, 2026
37c9feb
types: update haro.d.ts for accuracy
avoidwork Apr 17, 2026
7845b64
docs: update CODE_STYLE_GUIDE.md for oxlint
avoidwork Apr 17, 2026
15e1f32
docs: add CONTRIBUTING.md
avoidwork Apr 17, 2026
c385194
docs: update TECHNICAL_DOCUMENTATION.md for accuracy
avoidwork Apr 17, 2026
477aa32
docs: add Mathematical Foundation section
avoidwork Apr 17, 2026
6c08422
docs: use LaTeX-style math notation
avoidwork Apr 17, 2026
5e6ed7e
docs: fix AND logic example in Set Theory Operations
avoidwork Apr 17, 2026
47258c2
docs: fix AND logic example syntax
avoidwork Apr 17, 2026
fb77571
docs: use code block for LaTeX formula
avoidwork Apr 17, 2026
c186ff9
docs: revert to 404872 for LaTeX formula
avoidwork Apr 17, 2026
506cf61
docs: use plain text with Unicode symbols
avoidwork Apr 17, 2026
ee1e95d
docs: use proper LaTeX syntax
avoidwork Apr 17, 2026
806188d
docs: simplify AND logic example
avoidwork Apr 17, 2026
d14fe80
docs: use inline code for formulas
avoidwork Apr 17, 2026
b2a43f5
docs: update LaTeX formula for AND logic query
avoidwork Apr 17, 2026
362f6e6
docs: update LaTeX formulas for find and OR logic queries
avoidwork Apr 17, 2026
ba956da
docs: fix Mermaid chart accuracy for query flow
avoidwork Apr 18, 2026
7fb5e75
refactor: optimize performance and use private fields
avoidwork Apr 18, 2026
244572c
refactor: return flat arrays from methods, remove raw parameter
avoidwork Apr 18, 2026
bebee48
refactor: rename on* hooks to camelCase for consistency
avoidwork Apr 18, 2026
7b8bc8c
build: update dist files
avoidwork Apr 18, 2026
1e237f3
refactor: make all before* hooks side-effect only (void return)
avoidwork Apr 18, 2026
42c2aaf
build: update dist files
avoidwork Apr 18, 2026
a379a59
refactor: remove all lifecycle hooks
avoidwork Apr 18, 2026
0a975c0
Refactor: make internal methods private and remove reduce()
avoidwork Apr 18, 2026
6d56bcf
Refactor: replace #each with for loops
avoidwork Apr 18, 2026
0686e06
Test: add coverage report
avoidwork Apr 18, 2026
209a394
Test: improve coverage to 97.91%
avoidwork Apr 18, 2026
70c91f1
Add coverage ignore directives for 99.79% coverage
avoidwork Apr 18, 2026
1ac2de2
Add test for JSON fallback in clone method
avoidwork Apr 18, 2026
4d2f931
Remove coverage directives and add comprehensive tests
avoidwork Apr 18, 2026
4471ae1
Remove initialized flag and simplify initialization
avoidwork Apr 18, 2026
b2bcb99
Merge branch 'master' into audit
avoidwork Apr 18, 2026
2b7357f
Add comprehensive API documentation
avoidwork Apr 18, 2026
0f41579
Update copyright year to 2026 and update dependencies
avoidwork Apr 18, 2026
e2f8667
Correct Big O complexity in documentation
avoidwork Apr 18, 2026
dc872b6
Fix incorrect method signatures in README
avoidwork Apr 18, 2026
ad38b46
Add setMany() and deleteMany() methods, deprecate batch()
avoidwork Apr 18, 2026
69ed46d
Remove batch() method, lifecycle hooks, and fix MVCC documentation
avoidwork Apr 18, 2026
0269250
Update docs, optimize loops, and improve package metadata
avoidwork Apr 18, 2026
a4a8e6f
Fix benchmark DELETE operations to use correct method name
avoidwork Apr 18, 2026
3228fca
Rewrite benchmarks to use tinybench
avoidwork Apr 18, 2026
3fd9f28
Fix benchmark test names and logic to match actual operations
avoidwork Apr 18, 2026
0802d21
Replace benchmark verbs with actual method names
avoidwork Apr 18, 2026
692f810
Optimize get() method: remove key validation and conditional freeze
avoidwork Apr 18, 2026
bbb608a
Replace #freezeResult with direct Object.freeze() calls
avoidwork Apr 18, 2026
64fe5d7
Succinct docblocks in haro.js
avoidwork Apr 18, 2026
10700af
Delete docs/API.md
avoidwork Apr 18, 2026
0f4baf0
Generate API.md from haro.js docblocks
avoidwork Apr 18, 2026
dc5af23
Fix technical documentation accuracy
avoidwork Apr 18, 2026
2dc1bce
Make clone, merge, and uuid private methods
avoidwork Apr 18, 2026
b2ae708
Enhance #merge method with comprehensive test coverage
avoidwork Apr 18, 2026
2a131de
Build distribution files
avoidwork Apr 18, 2026
18a0ab8
Update pre-commit hook to run fix and coverage
avoidwork Apr 18, 2026
23df337
Add tests for uncovered lines to achieve 100% coverage
avoidwork Apr 18, 2026
b56dc06
Refactor batch operations with internal state tracking
avoidwork Apr 18, 2026
6b6f325
Add tests for nested batch operations error handling
avoidwork Apr 18, 2026
389879e
Add getters for private configuration fields
avoidwork Apr 18, 2026
b4f18a8
Remove unreachable fallback code in where() method
avoidwork Apr 18, 2026
22b4989
Document private fields in README and docs
avoidwork Apr 18, 2026
ede2eeb
docs: Improve README.md readability and structure
avoidwork Apr 18, 2026
6a5bf51
docs: Update all documentation links to point to master branch
avoidwork Apr 18, 2026
31b4756
docs: Remove detailed API methods from README
avoidwork Apr 18, 2026
3bb68ec
docs: Emphasize time savings and productivity benefits
avoidwork Apr 18, 2026
7179c81
docs: Fix duplicate header and update bundle size
avoidwork Apr 18, 2026
b4addb3
docs: Update bundle size to accurate 6KB gzipped
avoidwork Apr 18, 2026
d1f1fde
docs: Verify and update bundle sizes in comparison table
avoidwork Apr 18, 2026
1053c6d
docs: Update Haro bundle size to 6KB gzipped
avoidwork Apr 18, 2026
7aff776
docs: Remove Requirements section
avoidwork Apr 18, 2026
9b36eef
Remove Discussions and Twitter links from README
avoidwork Apr 18, 2026
12d7e67
docs: Update benchmarks README with current results
avoidwork Apr 18, 2026
c60e88d
fix: Remove unneeded reindex() in clear() and extra arg in sort()
avoidwork Apr 18, 2026
300594e
build: Update dist files
avoidwork Apr 18, 2026
81cc92e
Optimize find() method with direct index lookup
avoidwork Apr 18, 2026
287d191
feat: Add LRU caching for search and where methods
avoidwork Apr 19, 2026
6679ef8
docs: Update AGENTS.md with LRU caching details
avoidwork Apr 19, 2026
4d11bf6
Fix LaTeX underscore syntax in Mathematical Foundation section
avoidwork Apr 19, 2026
f4be94a
Fix underscore in math mode text
avoidwork Apr 19, 2026
e8fecc0
Fix underscore escaping for markdown parser
avoidwork Apr 19, 2026
4028b5f
Fix LRU_head underscore escaping
avoidwork Apr 19, 2026
233c1c4
Split pie charts into separate mermaid blocks
avoidwork Apr 19, 2026
ad2dabc
Update mermaid diagrams for accuracy
avoidwork Apr 19, 2026
db2314a
Add deep indexing with dot notation support
avoidwork Apr 19, 2026
0d5c0f1
Update documentation for deep indexing support
avoidwork Apr 19, 2026
f19941c
Fix markdown formatting in API.md
avoidwork Apr 19, 2026
4865054
Fix parameter list spacing in setMany
avoidwork Apr 19, 2026
6c92e0a
test: add edge cases tests and improve coverage
avoidwork Apr 19, 2026
ce63d35
docs: add coverage ignore directives for unreachable edge cases
avoidwork Apr 19, 2026
4e5a122
docs: update benchmark documentation with accurate information
avoidwork Apr 19, 2026
660cf02
build: remove minified files and update build configuration
avoidwork Apr 19, 2026
b41cb87
fix: update lint and fix scripts to include root JS files and benchmarks
avoidwork Apr 19, 2026
f43f98e
refactor: use constants for all property names and update TypeScript …
avoidwork Apr 19, 2026
9d006e0
refactor: replace magic strings with constants (STRING_DOT, STRING_EM…
avoidwork Apr 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .cursor/rules/nodejs-api-service.mdc

This file was deleted.

187 changes: 187 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Contributing to Haro

Thank you for your interest in contributing to Haro! This document provides guidelines and instructions for contributing.

## Table of Contents

1. [Getting Started](#getting-started)
2. [Development Setup](#development-setup)
3. [Code Style](#code-style)
4. [Testing](#testing)
5. [Submitting Changes](#submitting-changes)
6. [Reporting Issues](#reporting-issues)

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/your-username/haro.git`
3. Install dependencies: `npm install`
4. Create a branch: `git checkout -b feature/your-feature-name`

## Development Setup

### Requirements

- Node.js >= 17.0.0
- npm

### Project Structure

- `src/` - Source code
- `tests/unit/` - Unit tests
- `dist/` - Built distribution (generated)
- `types/` - TypeScript definitions

## Code Style

This project uses **Oxlint** and **Oxfmt** for code quality and formatting:

```bash
# Check code style
npm run lint

# Fix auto-fixable issues
npm run fix
```

### Key Guidelines

- Use **tabs** for indentation
- Use **double quotes** for strings
- Use **camelCase** for variables and functions
- Use **PascalCase** for classes
- Use **UPPER_SNAKE_CASE** for constants
- Write **JSDoc comments** for all public APIs
- Keep functions small and focused

### String Constants

Use string constants from `src/constants.js` for string literals:

```javascript
// βœ… Good
import { STRING_EMPTY } from './constants.js';
if (str === STRING_EMPTY) { ... }

// ❌ Bad
if (str === '') { ... }
```

## Testing

This project uses **Node.js native test runner**:

```bash
# Run all tests
npm test

# Run tests with coverage
npm run coverage
```

### Writing Tests

- Place unit tests in `tests/unit/`
- Use `node:assert` for assertions
- Follow AAA pattern (Arrange, Act, Assert)
- Test both success and error cases

Example:

```javascript
import assert from 'node:assert';
import { describe, it } from 'node:test';
import { Haro } from '../src/haro.js';

describe('MyFeature', () => {
it('should do something', () => {
// Arrange
const store = new Haro();

// Act
const result = store.set(null, { name: 'test' });

// Assert
assert.ok(result);
assert.strictEqual(result.name, 'test');
});
});
```

## Submitting Changes

1. Make your changes
2. Run tests: `npm test`
3. Run lint: `npm run lint`
4. Commit with clear messages
5. Push to your fork
6. Open a Pull Request

### Commit Messages

- Use present tense ("Add feature" not "Added feature")
- Use imperative mood ("Move cursor to..." not "Moves cursor to...")
- Be concise and descriptive
- Reference issues when applicable

### Pull Request Checklist

- [ ] Tests pass (`npm test`)
- [ ] Lint passes (`npm run lint`)
- [ ] Code is formatted (`npm run fix`)
- [ ] Documentation is updated if needed
- [ ] Commit messages are clear

## Reporting Issues

When reporting issues, please include:

- **Description**: Clear description of the issue
- **Steps to Reproduce**: Detailed steps to reproduce
- **Expected Behavior**: What should happen
- **Actual Behavior**: What actually happens
- **Environment**: Node.js version, OS, etc.
- **Code Example**: Minimal reproducible example

Example:

```markdown
## Description
The `find()` method throws an error when passed null.

## Steps to Reproduce
1. Create a new Haro instance
2. Call `store.find(null)`

## Expected Behavior
Should throw a descriptive error or handle null gracefully

## Actual Behavior
Throws: "Cannot read property 'length' of null"

## Environment
- Node.js: v18.0.0
- OS: macOS 13.0

## Code Example
```javascript
import { Haro } from 'haro';
const store = new Haro();
store.find(null); // Throws error
```
```

## Code of Conduct

- Be respectful and inclusive
- Focus on constructive feedback
- Welcome newcomers and help them learn
- Keep discussions professional and on-topic

## Questions?

Feel free to open an issue for questions or discussions about contributing.

---

Thank you for contributing to Haro! πŸŽ‰
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm test
npm run fix && npm run coverage && git add -A
5 changes: 5 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": [],
"useTabs": true
}
8 changes: 8 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"ignorePatterns": ["!**/src/**", "benchmarks/**"],
"rules": {
"no-console": ["error", {"allow": ["warn", "error"]}],
"no-unused-vars": ["error", {"argsIgnorePattern": "^(arg|batch|data|key|override|type)$"}]
}
}
64 changes: 64 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Haro Project Guide

## Overview
Haro is a modern immutable DataStore for collections of records with indexing, versioning, and batch operations support.

## Project Structure
- `src/haro.js` - Main Haro class and factory function
- `src/constants.js` - String and number constants
- `tests/` - Unit tests using Node.js native test runner
- `dist/` - Built distribution files (generated)
- `types/haro.d.ts` - TypeScript definitions

## Commands
```bash
npm run lint # Lint code with oxlint
npm run fix # Fix linting issues with oxlint and oxfmt
npm run test # Run tests with Node.js test runner
npm run coverage # Generate coverage report
npm run build # Lint and build distribution files
npm run benchmark # Run benchmarks
```

## Code Style
- Use tabs for indentation
- Follow ESLint/oxlint rules (no-console, no-unused-vars)
- Use JSDoc comments for documentation
- Keep functions small and focused
- Use template literals for string concatenation

## Rules
- No magic strings or magic numbers - always use constants from `src/constants.js`
- All string literals must be defined as constants with descriptive names (e.g., `STRING_EMPTY`, `STRING_ID`)
- All numeric literals (except 0 and 1 in simple operations) should use constants (e.g., `INT_0`, `CACHE_SIZE_DEFAULT`)
- Constants follow naming convention: `TYPE_NAME` for strings, `TYPE_NAME` for numbers

## Testing
- Tests use Node.js native test runner (`node --test`)
- Test files are in `tests/unit/` directory
- Run tests: `npm test`
- Generate coverage: `npm run coverage`

## Key Conventions
- All string literals use constants from `src/constants.js`
- Private/internal methods start with underscore prefix
- Lifecycle hooks follow `before*` and `on*` naming pattern
- Return `this` for method chaining where appropriate
- Use `Map` and `Set` for data structures
- Immutable mode uses `Object.freeze()` for data safety
- Adheres to DRY, YAGNI, and SOLID principles
- Follows OWASP security guidance

## Important Notes
- The `immutable` option freezes data for immutability
- Indexes improve query performance for `find()` and `where()` operations
- Deep indexing with dot notation is supported (e.g., `user.profile.department`)
- Versioning tracks historical changes when enabled
- Batch operations are more efficient than individual operations
- LRU caching is available for `search()` and `where()` methods (opt-in with `cache: true`)
- Cache uses Web Crypto API for SHA-256 hash generation (requires Node.js >=19.0.0)
- Cache keys are multi-domain: `search_HASH` or `where_HASH` format
- Cached results are cloned/frozen to prevent mutation (respects `immutable` mode)
- Cache invalidates on all write operations but preserves statistics
- `search()` and `where()` are async methods - use `await` when calling
- Cache statistics persist for the lifetime of the Haro instance
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025, Jason Mulligan
Copyright (c) 2026, Jason Mulligan
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Loading
Loading