-
Notifications
You must be signed in to change notification settings - Fork 2
POC Sequelize integration #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tobyhede
wants to merge
10
commits into
main
Choose a base branch
from
protect-sequelize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add comprehensive design document for Sequelize ORM integration with Protect.js, covering: - Hook-based transparent encryption using beforeFind/afterFind - Custom DataType for eql_v2_encrypted composite type - Schema extraction from Sequelize models - Support for all comparison, range, and text search operators - Automatic encryption/decryption with normal Sequelize syntax Design leverages EQL's PostgreSQL operator classes for native operator support without custom SQL generation.
Add detailed step-by-step implementation plan covering: - Project scaffolding with package.json, tsconfig, tsup - Custom ENCRYPTED DataType with composite type parsing - Schema extraction from Sequelize models to Protect schemas - beforeFind/afterFind hooks for transparent encryption/decryption - Comprehensive tests for all components - README documentation with usage examples Plan includes TDD approach with failing tests first, minimal implementations, and frequent commits.
- Fix TypeScript compilation errors with proper ENCRYPTEDConstructor interface - Add error handling to parse() function for malformed composite type values - Fix TokenFilter type inference with const assertion - Scope registry to factory instance to prevent memory leaks and test pollution - Update getEncryptedColumnConfig API to accept column instance parameter All tests passing (11/11) and TypeScript compilation successful. Addresses code review items B1, B2, and B3 from 2025-11-10-review.md
Implement bulkFromComposite() function that automatically detects and parses composite type fields in Sequelize model objects, providing the same ergonomic API as Drizzle's bulkDecryptModels. Features: - Automatic field detection for composite type values - Handles Sequelize model instances and plain objects - Supports nested objects and arrays - Non-destructive (doesn't mutate originals) - Type-safe with generics Also includes: - Comprehensive test suite (27 tests) - Complete manual encryption guide - Full API documentation This provides an alternative to hooks for users who need manual control over encryption workflows (raw SQL, performance optimization, debugging).
- Move MANUAL_ENCRYPTION_GUIDE.md and COMPOSITE_TYPE_UTILITIES.md to docs/sequelize/ - Update README.md links to point to new documentation locations - Add comprehensive code review document (76 tests passing, production-ready) - Add complete production-quality README with installation, usage, API docs, and troubleshooting This cleanup organizes documentation properly while adding the code review results and final README for the sequelize integration.
- Add 13 new tests for error handling, partial failures, and mock improvements (63→76 tests) - Enhance raw SQL example in README with complete workflow - Standardize error message formatting in schema-extraction - Add explanatory comment in hooks for parsing optimization - Add biome.json configuration to manage linter rules appropriately - Improve test isolation with input-based mock implementations All tests passing. Non-blocking improvements from code review.
- Update tsconfig.json and tsup.config.ts for compilation settings - Remove MANUAL_ENCRYPTION_GUIDE.md (moved to docs/) - Update pnpm-lock.yaml with new dependencies - Update implementation plan with progress notes Configuration updates to support the sequelize integration features.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.