feat: add v5.8.0 features - transactions, pagination, and comprehensive docs
**Transaction System (TIER 1.2)** - Atomic operations with automatic rollback - 36 unit tests + 35 integration tests passing - Full documentation in docs/transactions.md **Duplicate Check Optimization (TIER 1.4)** - Optimized from O(n) to O(log n) using GraphAdjacencyIndex - Uses LSM-tree for efficient lookups - Tests verify performance improvements **GraphIndex Pagination (TIER 1.5)** - Production-scale pagination for high-degree nodes - Backward compatible API - 18 pagination tests passing **Comprehensive Filter Documentation (TIER 1.6)** - Complete operator reference (15 operators) - Compound filters (anyOf, allOf, nested logic) - Common query patterns and troubleshooting guide - 642 lines of new documentation **README Updates** - Added Filter & Query Syntax Guide to Essential Reading - Added Transactions to Core Concepts section All changes tested and production-ready for v5.8.0 release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
52e961760d
commit
e40fee39d8
21 changed files with 5657 additions and 182 deletions
88
src/transaction/errors.ts
Normal file
88
src/transaction/errors.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* Transaction System Errors
|
||||
*
|
||||
* Provides detailed error information for transaction failures.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for all transaction errors
|
||||
*/
|
||||
export class TransactionError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly context?: Record<string, any>
|
||||
) {
|
||||
super(message)
|
||||
this.name = 'TransactionError'
|
||||
Error.captureStackTrace(this, this.constructor)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error during transaction execution
|
||||
*/
|
||||
export class TransactionExecutionError extends TransactionError {
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly operationIndex: number,
|
||||
public readonly operationName: string | undefined,
|
||||
public readonly cause: Error
|
||||
) {
|
||||
super(message, {
|
||||
operationIndex,
|
||||
operationName,
|
||||
cause: cause.message
|
||||
})
|
||||
this.name = 'TransactionExecutionError'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error during transaction rollback
|
||||
*/
|
||||
export class TransactionRollbackError extends TransactionError {
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly originalError: Error,
|
||||
public readonly rollbackErrors: Error[]
|
||||
) {
|
||||
super(message, {
|
||||
originalError: originalError.message,
|
||||
rollbackErrorCount: rollbackErrors.length,
|
||||
rollbackErrors: rollbackErrors.map(e => e.message)
|
||||
})
|
||||
this.name = 'TransactionRollbackError'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error for invalid transaction state
|
||||
*/
|
||||
export class InvalidTransactionStateError extends TransactionError {
|
||||
constructor(
|
||||
currentState: string,
|
||||
attemptedAction: string
|
||||
) {
|
||||
super(
|
||||
`Cannot ${attemptedAction}: transaction is in state '${currentState}'`,
|
||||
{ currentState, attemptedAction }
|
||||
)
|
||||
this.name = 'InvalidTransactionStateError'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error for transaction timeout
|
||||
*/
|
||||
export class TransactionTimeoutError extends TransactionError {
|
||||
constructor(
|
||||
timeoutMs: number,
|
||||
operationIndex: number
|
||||
) {
|
||||
super(
|
||||
`Transaction timed out after ${timeoutMs}ms at operation ${operationIndex}`,
|
||||
{ timeoutMs, operationIndex }
|
||||
)
|
||||
this.name = 'TransactionTimeoutError'
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue