{{ message }}
Repository navigation
Tags: bufferpunk/modelcore
Tags
CHORE: Update tsconfig include path - Added `src/**/*.ts` to the `include` array in `tsconfig.json`. - This ensures that TypeScript files within the `src` directory are now included in the compilation process. - Previously, only files in the root directory were included, which would have prevented the project from building correctly if source code was organized into subdirectories.
FIX: Improve type checking for Date and Number - Added a check to `isOfType` to correctly validate `Date` and `Number` types when the value is `NaN`. This ensures that `NaN` values are not incorrectly accepted as valid `Date` or `Number` types during validation. - Updated the version and description in `package.json`.
CHORE: Refactor validation handlers and update tsconfig - Removed static `version` property from `User` class in tests as it was unused. - Updated validation handler tests to use named handlers with `addValidationHandler` and `removeValidationHandler` for better management and to avoid global state manipulation. - Added tests for `Set` and `Map` types, including their construction, item/key validation, and proxying of standard Map/Set methods. - Introduced tests for handler scoping and deduplication, demonstrating that handlers are shared via prototype and duplicate names are ignored. - Enhanced `buildError` tests to ensure all metadata fields are correctly produced and that `expected` values are meaningful. - Updated `tsconfig.json` to remove `noEmit` and `allowImportingTsExtensions` as they are no longer necessary for the current setup, and adjusted `include` path.
FEAT: Add global autorequire toggle and enhance test coverage - Introduce `Base.autorequire` global toggle to control behavior for missing non-optional fields. - When `Base.autorequire` is `false`, missing non-optional fields will be silently set to `undefined` instead of throwing a `RequiredError`. - Explicit `required: true` or `optional: false` configurations will always take precedence, ensuring required fields are always enforced. - This feature aids in gradual schema adoption and can be useful for ORMs. - Significantly expand test coverage with 13 new tests focusing on validation handler lifecycle (calls, rejection, ordering, arguments, nesting, error metadata) and the new `autorequire` functionality (default, true, false, precedence, and defaults). - Update README and CHANGELOG.md to reflect the new `autorequire` feature and its documentation. - Synchronize `base.js` with `base.ts` for `autorequire` and handler loop logic. - Update version in `package.json` and `package-lock.json` to 1.5.0.
REFACTOR: Implement Proxy-based validation and immutability - Replaced direct property assignment with Proxy handlers for more robust validation and immutability enforcement. - Introduced `createProxyHandler` for general object validation and `createArrayHandler` for array-specific validation and mutation control. - Implemented `__safeSet__` method to allow internal safe updates within the proxy. - Added `handlerCache` to optimize proxy handler creation for repeated paths. - Modified the constructor to return a proxied instance of the object. - Updated `update` method to utilize the new proxy mechanism for setting properties. - Refactored `runValidate` to work with the new proxy system and handle nested object/array validation. - Enhanced `createFrom` to `create` method for consistency. - Updated benchmarks and tests to reflect the changes in object creation and updates. - Fixed email validation regex in benchmark. - Updated package version to 1.3.0.
feat: Enhance schema definition and validation features - Added `required` field to `FieldConfig` for clarity in schema definitions. - Updated `keys` and `values` in `FieldConfig` to accept functions for more flexibility. - Introduced `Union` function for creating union types in schemas. - Improved type inference for nested structures and simplified optional/required key handling. - Enhanced validation logic in `Base` class to support new schema features. - Updated benchmarks to reflect new validation scenarios and improved performance metrics. - Refactored example files to demonstrate new features and best practices. - Added TypeScript definitions for example files. - Updated package metadata for versioning and repository links.
feat: Enhance error handling with custom error classes and improve va… …lidation logic - Added rich error handling with descriptive error classes for better semantics. - Improved validation logic in the Base class to throw specific errors for various validation failures. - Updated the README and CHANGELOG to reflect new features and improvements. - Added benchmarking capabilities to measure performance of model creation and updates. - Refactored CI workflow to streamline testing and coverage reporting.
REFACTOR: Rename package and update manifesto - Rename the package from `@bufferpunk/schema` to `@bufferpunk/modelcore`. - Update the `package.json` file to reflect the new package name, version, and keywords. - Add a new `manifesto.md` file that outlines the core principles of runtime entity integrity. - Adjust tests to align with the new package name and concepts, including: - Renaming `parseConfig.coerce` to `coerce`. - Adding tests for custom types like `Email`. - Adding tests for array manipulation methods (`fill`, `push`, `unshift`, `splice`) and their validation behavior. - Adding tests for default factories and their distinct value generation. - Adding tests for nested validation and error handling. - Adding tests for splice delete-only operations. - Adding tests for array with object values enforcing nested object validation.
