stabilize-orm 1.3.8 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +1097 -546
  2. package/dist/auto-migrate.d.ts +34 -0
  3. package/dist/auto-migrate.d.ts.map +1 -0
  4. package/dist/auto-migrate.js +3003 -0
  5. package/dist/auto-migrate.js.map +163 -0
  6. package/dist/cache.d.ts +90 -0
  7. package/dist/cache.d.ts.map +1 -0
  8. package/dist/cache.js +166 -0
  9. package/dist/cache.js.map +64 -0
  10. package/dist/client.d.ts +73 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +2997 -0
  13. package/dist/client.js.map +162 -0
  14. package/dist/hooks.d.ts +31 -0
  15. package/dist/hooks.d.ts.map +1 -0
  16. package/dist/hooks.js +4 -0
  17. package/dist/hooks.js.map +11 -0
  18. package/dist/index.d.ts +101 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +3183 -0
  21. package/dist/index.js.map +222 -0
  22. package/dist/logger.d.ts +40 -0
  23. package/dist/logger.d.ts.map +1 -0
  24. package/dist/logger.js +8 -0
  25. package/dist/logger.js.map +11 -0
  26. package/dist/migrations.d.ts +31 -0
  27. package/dist/migrations.d.ts.map +1 -0
  28. package/dist/migrations.js +3009 -0
  29. package/dist/migrations.js.map +164 -0
  30. package/{model.ts → dist/model.d.ts} +124 -189
  31. package/dist/model.d.ts.map +1 -0
  32. package/dist/model.js +4 -0
  33. package/dist/model.js.map +10 -0
  34. package/dist/query-builder.d.ts +91 -0
  35. package/dist/query-builder.d.ts.map +1 -0
  36. package/dist/query-builder.js +14 -0
  37. package/dist/query-builder.js.map +12 -0
  38. package/dist/repository.d.ts +165 -0
  39. package/dist/repository.d.ts.map +1 -0
  40. package/dist/repository.js +176 -0
  41. package/dist/repository.js.map +69 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -0
  43. package/dist/types.d.ts +110 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +4 -0
  46. package/dist/types.js.map +10 -0
  47. package/dist/utils/encryption.d.ts +13 -0
  48. package/dist/utils/encryption.d.ts.map +1 -0
  49. package/dist/utils/encryption.js +4 -0
  50. package/dist/utils/encryption.js.map +10 -0
  51. package/package.json +104 -25
  52. package/.eslintrc.json +0 -10
  53. package/.github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md +0 -23
  54. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
  55. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  56. package/.github/workflows/ci-cd.yml +0 -22
  57. package/CHANGELOG.md +0 -75
  58. package/CODE_OF_CONDUCT.md +0 -87
  59. package/CONTRIBUTING.md +0 -48
  60. package/FUNDING.md +0 -14
  61. package/SECURITY.md +0 -35
  62. package/SUPPORT.md +0 -18
  63. package/bun.lock +0 -667
  64. package/cache.ts +0 -181
  65. package/client.ts +0 -249
  66. package/docker-compose.yml +0 -22
  67. package/hooks.ts +0 -76
  68. package/index.ts +0 -158
  69. package/logger.ts +0 -127
  70. package/migrations.ts +0 -318
  71. package/query-builder.ts +0 -209
  72. package/repository.ts +0 -1096
  73. package/tests/migrations.test.ts +0 -141
  74. package/tsconfig.json +0 -32
  75. package/types.ts +0 -106
package/CHANGELOG.md DELETED
@@ -1,75 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [Unreleased]
6
-
7
- - Further features and improvements coming soon.
8
-
9
-
10
- ## [1.3.2] - 2025-10-19
11
-
12
- ### Added
13
- - Added **Timestamps Configuration** feature for automatic management of `createdAt` and `updatedAt` columns (`types.ts`, `model.ts`, `repository.ts`, `migrations.ts`).
14
- - Added `TimestampsConfig` interface and `timestamps` property to `ModelConfig` in `types.ts`.
15
- - Added `getTimestamps` method to `MetadataStorage` in `model.ts`.
16
- - Updated `create`, `update`, `bulkCreate`, `bulkUpdate`, and `upsert` methods in `repository.ts` to set timestamps automatically.
17
- - Updated `migrations.ts` to include timestamp columns in schema generation.
18
- - Updated `README.md` with a new "Timestamps" section and example.
19
-
20
- ### Fixed
21
- - Fixed TypeScript error (TS7053) in `repository.ts` for timestamps handling in `_create`, `_bulkCreate`, `_bulkUpdate`, and `_upsert` methods by using `Record<string, any>` for safe property access and maintaining `Partial<T>` type safety.
22
-
23
- ## [1.3.2] - 2025-10-19
24
-
25
- ### Added
26
- - Added **Custom Query Scopes** feature, allowing reusable query conditions defined in model configurations (`types.ts`, `model.ts`, `query-builder.ts`, `repository.ts`).
27
- - Added `scopes` property to `ModelConfig` interface in `types.ts` to define scope functions.
28
- - Added `getScopes` method to `MetadataStorage` in `model.ts` to retrieve scope definitions.
29
- - Added `scope` method to `QueryBuilder` in `query-builder.ts` to apply scopes to queries.
30
- - Added `scope` method to `Repository` in `repository.ts` for direct scope application.
31
- - Updated `README.md` with a new "Custom Query Scopes" section and example.
32
-
33
- ## [1.3.0] - 2025-10-18
34
-
35
- ### Added
36
- - Introduced programmatic `defineModel` API for model definitions, eliminating the need for decorators (`model.ts`).
37
- - Added `MetadataStorage` class to manage model configurations without `reflect-metadata`.
38
- - Added support for defining lifecycle hooks in `ModelConfig` or as class methods (`hooks.ts`).
39
- - Added `example.ts` to demonstrate the new programmatic API usage.
40
- - Extended `ModelConfig` interface to support columns, relations, hooks, versioning, and soft deletes (`types.ts`).
41
-
42
- ### Changed
43
- - Replaced decorator-based model definitions with `defineModel` API, removing dependency on `reflect-metadata` and TypeScript experimental features (`experimentalDecorators`, `emitDecoratorMetadata`).
44
- - Updated `stabilize.ts` to export `defineModel` and remove `reflect-metadata` import.
45
- - Modified `repository.ts` to use `MetadataStorage` for table names, columns, relations, validators, and soft delete fields.
46
- - Rewrote `hooks.ts` to support hooks via `ModelConfig` and class methods, integrated with `MetadataStorage`.
47
- - Updated `migrations.ts` to generate schemas using `MetadataStorage` instead of decorator metadata.
48
- - Revised `types.ts` to remove decorator-related types and add `ModelConfig`, `ColumnConfig`, and `RelationConfig` interfaces.
49
- - Updated `README.md` to reflect the new programmatic API, remove decorator references, and update examples.
50
- - Ensured compatibility with `verbatimModuleSyntax` by using `export type` for type exports in `stabilize.ts`.
51
-
52
- ### Removed
53
- - Deleted `decorators.ts` as decorators are no longer used.
54
- - Removed dependency on `reflect-metadata` from the project.
55
-
56
- ### Fixed
57
- - Fixed TypeScript type errors in `repository.ts` for `columns` and `relations` by mapping `MetadataStorage` outputs to match expected types.
58
- - Corrected `runHooks` in `repository.ts` to call `hook.callback(entity)` instead of `hook()`.
59
- - Fixed TypeScript `verbatimModuleSyntax` error in `stabilize.ts` by separating type and value exports.
60
-
61
- ## [1.1.2] - 2025-10-14
62
-
63
- ### Added
64
- - Improved repository QueryBuilder with chainable joins, advanced where clauses, and cache support.
65
- - Added support for model decorators and repository pattern.
66
- - New CLI features for migrations, seeds, rollback, and status.
67
- - Security, funding, conduct, and contributing markdowns.
68
- - More expressive README and docs.
69
-
70
- ### Changed
71
- - Updated ORM configuration examples.
72
- - Enhanced documentation for open source best practices.
73
-
74
- ### Fixed
75
- - Various bug fixes for connection handling and retry logic.
@@ -1,87 +0,0 @@
1
- # 📝 Contributor Covenant Code of Conduct
2
-
3
- ## 💚 Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ---
10
-
11
- ## 🌟 Our Standards
12
-
13
- **Positive behaviors include:**
14
- - Demonstrating empathy and kindness toward other people
15
- - Being respectful of differing opinions, viewpoints, and experiences
16
- - Giving and gracefully accepting constructive feedback
17
- - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18
- - Focusing on what is best not just for us as individuals, but for the overall community
19
-
20
- **Unacceptable behaviors include:**
21
- - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
- - Trolling, insulting or derogatory comments, and personal or political attacks
23
- - Public or private harassment
24
- - Publishing others’ private information, such as a physical or email address, without their explicit permission
25
- - Other conduct which could reasonably be considered inappropriate in a professional setting
26
-
27
- ---
28
-
29
- ## 🛡️ Enforcement Responsibilities
30
-
31
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
32
-
33
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
34
-
35
- ---
36
-
37
- ## 🌍 Scope
38
-
39
- This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
40
-
41
- ---
42
-
43
- ## 📣 Enforcement
44
-
45
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **lwazicd@icloud.com**.
46
-
47
- All complaints will be reviewed and investigated promptly and fairly.
48
-
49
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
50
-
51
- ---
52
-
53
- ## ⚖️ Enforcement Guidelines
54
-
55
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
56
-
57
- ### 1. Correction
58
-
59
- - **Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
60
- - **Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. May include a public apology.
61
-
62
- ### 2. Warning
63
-
64
- - **Community Impact:** A violation through a single incident or series of actions.
65
- - **Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
66
-
67
- ### 3. Temporary Ban
68
-
69
- - **Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.
70
- - **Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
71
-
72
- ### 4. Permanent Ban
73
-
74
- - **Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
75
- - **Consequence:** A permanent ban from any sort of public interaction within the community.
76
-
77
- ---
78
-
79
- ## 📜 Attribution
80
-
81
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at
82
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
83
-
84
- For answers to common questions about this code of conduct, see [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq).
85
- Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
86
-
87
- ---
package/CONTRIBUTING.md DELETED
@@ -1,48 +0,0 @@
1
- # 🤝 Contributing to Stabilize ORM
2
-
3
- Thank you for your interest in making Stabilize ORM even better! Your ideas, code, and feedback help drive this project forward.
4
-
5
- ---
6
-
7
- ## 🚀 How to Contribute
8
-
9
- 1. **Fork the Repository:**
10
- Click "Fork" to make your own copy.
11
- 2. **Create Your Branch:**
12
- Branch off `main` for your feature or fix.
13
- 3. **Write Code:**
14
- - Use TypeScript.
15
- - Follow established formatting and naming conventions.
16
- 4. **Test Your Changes:**
17
- Ensure your code passes all tests.
18
- 5. **Update Documentation:**
19
- If you change APIs, update the docs and README.
20
- 6. **Open a Pull Request:**
21
- - Fill out the PR template.
22
- - Describe your changes clearly.
23
-
24
- ---
25
-
26
- ## 💡 Code Style
27
-
28
- - **Language:** TypeScript only
29
- - **Formatting:** Use project conventions (Prettier, ESLint, etc.)
30
- - **Naming:** Be descriptive and consistent
31
-
32
- ---
33
-
34
- ## 🐞 Reporting Issues
35
-
36
- - For bugs, use the [Bug Report Issue Template](.github/ISSUE_TEMPLATE/bug_report.md).
37
- - For feature ideas, use the [Feature Request Template](.github/ISSUE_TEMPLATE/feature_request.md).
38
-
39
- If in doubt, ask or open a discussion!
40
-
41
- ---
42
-
43
- ## 🙏 Thank You
44
-
45
- Your contributions make Stabilize ORM stable, expressive, and truly open source.
46
- Happy coding!
47
-
48
- ---
package/FUNDING.md DELETED
@@ -1,14 +0,0 @@
1
- # ❤️ Support Stabilize ORM
2
-
3
- If you love Stabilize ORM and want to help it grow, you can support ongoing development in a few ways:
4
-
5
- - **GitHub Sponsors:**
6
- [Sponsor ElectronSz on GitHub](https://github.com/sponsors/ElectronSz)
7
-
8
- - **Patreon:**
9
- [Become a Patron](https://patreon.com/ElectronSz)
10
-
11
- - **Ko-fi:**
12
- [Buy ElectronSz a coffee](https://ko-fi.com/ElectronSz)
13
-
14
- Your support helps with maintenance, new features, and keeping Stabilize ORM open source for everyone. Thank you! 🙏
package/SECURITY.md DELETED
@@ -1,35 +0,0 @@
1
- # 🛡️ Security Policy
2
-
3
- ## Supported Versions
4
-
5
- We encourage responsible disclosure of security vulnerabilities for all actively maintained versions of Stabilize ORM.
6
-
7
- | Version | Supported |
8
- |--------------|------------------|
9
- | Latest (main)| ✅ Yes |
10
- | Older (< 6mo)| ✅ Yes |
11
- | Unmaintained | ❌ No |
12
-
13
- ## Reporting a Vulnerability
14
-
15
- If you discover a security vulnerability, please **do not disclose it publicly**.
16
-
17
- ### Secure Reporting Steps
18
-
19
- 1. **Email:**
20
- Contact ElectronSz directly at [lwazicd@icloud.com](mailto:lwazicd@icloud.com) with full details.
21
-
22
- 2. **GitHub Security Advisory:**
23
- Alternatively, open a [GitHub security advisory](https://github.com/ElectronSz/stabilize-orm/security/advisories) (private by default).
24
-
25
- 3. **Wait for Response:**
26
- Please allow up to 72 hours for a first response. We may request more details or verification.
27
-
28
- 4. **Coordinated Disclosure:**
29
- We will work with you to verify, patch, and coordinate public disclosure.
30
-
31
- ---
32
-
33
- > **Please do NOT post vulnerabilities in GitHub issues, discussions, or any public forum until a fix is released.**
34
-
35
- Thank you for helping keep Stabilize ORM and its users safe!
package/SUPPORT.md DELETED
@@ -1,18 +0,0 @@
1
- # 🤝 Support
2
-
3
- Need help with Stabilize ORM? We're here for you!
4
-
5
- ## 📬 How to Get Support
6
-
7
- - **Open an Issue:**
8
- Have a bug, question, or need help? [Create an issue on GitHub](https://github.com/ElectronSz/stabilize-orm/issues) and our community will assist you.
9
-
10
- - **Security Concerns:**
11
- If you’ve found a security vulnerability, please see our [Security Policy](SECURITY.md) for private and responsible reporting.
12
-
13
- ## 💬 Community
14
-
15
- - Join discussions, share feedback, and connect with other users and contributors.
16
- - Contributions, suggestions, and PRs are always welcome!
17
-
18
- Thank you for using Stabilize ORM!