@woltz/rich-domain 0.2.1
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.
- package/.github/workflows/ci.yml +40 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.versionrc.json +21 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/README.md +712 -0
- package/commitlint.config.js +23 -0
- package/dist/base-entity.d.ts +67 -0
- package/dist/base-entity.d.ts.map +1 -0
- package/dist/base-entity.js +309 -0
- package/dist/base-entity.js.map +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/criteria.d.ts +60 -0
- package/dist/criteria.d.ts.map +1 -0
- package/dist/criteria.js +214 -0
- package/dist/criteria.js.map +1 -0
- package/dist/deep-proxy.d.ts +34 -0
- package/dist/deep-proxy.d.ts.map +1 -0
- package/dist/deep-proxy.js +297 -0
- package/dist/deep-proxy.js.map +1 -0
- package/dist/domain-event-bus.d.ts +57 -0
- package/dist/domain-event-bus.d.ts.map +1 -0
- package/dist/domain-event-bus.js +112 -0
- package/dist/domain-event-bus.js.map +1 -0
- package/dist/domain-event.d.ts +55 -0
- package/dist/domain-event.d.ts.map +1 -0
- package/dist/domain-event.js +42 -0
- package/dist/domain-event.js.map +1 -0
- package/dist/entity.d.ts +13 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/entity.js +15 -0
- package/dist/entity.js.map +1 -0
- package/dist/filtering.d.ts +107 -0
- package/dist/filtering.d.ts.map +1 -0
- package/dist/filtering.js +202 -0
- package/dist/filtering.js.map +1 -0
- package/dist/id.d.ts +51 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +84 -0
- package/dist/id.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/ordering.d.ts +93 -0
- package/dist/ordering.d.ts.map +1 -0
- package/dist/ordering.js +154 -0
- package/dist/ordering.js.map +1 -0
- package/dist/paginated-result.d.ts +62 -0
- package/dist/paginated-result.d.ts.map +1 -0
- package/dist/paginated-result.js +201 -0
- package/dist/paginated-result.js.map +1 -0
- package/dist/pagination.d.ts +218 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +281 -0
- package/dist/pagination.js.map +1 -0
- package/dist/repository/base-repository.d.ts +77 -0
- package/dist/repository/base-repository.d.ts.map +1 -0
- package/dist/repository/base-repository.js +80 -0
- package/dist/repository/base-repository.js.map +1 -0
- package/dist/repository/in-memory-repository.d.ts +46 -0
- package/dist/repository/in-memory-repository.d.ts.map +1 -0
- package/dist/repository/in-memory-repository.js +85 -0
- package/dist/repository/in-memory-repository.js.map +1 -0
- package/dist/repository/index.d.ts +42 -0
- package/dist/repository/index.d.ts.map +1 -0
- package/dist/repository/index.js +47 -0
- package/dist/repository/index.js.map +1 -0
- package/dist/repository/mapper.d.ts +56 -0
- package/dist/repository/mapper.d.ts.map +1 -0
- package/dist/repository/mapper.js +15 -0
- package/dist/repository/mapper.js.map +1 -0
- package/dist/repository/types.d.ts +87 -0
- package/dist/repository/types.d.ts.map +1 -0
- package/dist/repository/types.js +6 -0
- package/dist/repository/types.js.map +1 -0
- package/dist/repository/unit-of-work.d.ts +70 -0
- package/dist/repository/unit-of-work.d.ts.map +1 -0
- package/dist/repository/unit-of-work.js +122 -0
- package/dist/repository/unit-of-work.js.map +1 -0
- package/dist/repository.d.ts +2 -0
- package/dist/repository.d.ts.map +1 -0
- package/dist/repository.js +21 -0
- package/dist/repository.js.map +1 -0
- package/dist/specification.d.ts +102 -0
- package/dist/specification.d.ts.map +1 -0
- package/dist/specification.js +187 -0
- package/dist/specification.js.map +1 -0
- package/dist/types/criteria.d.ts +35 -0
- package/dist/types/criteria.d.ts.map +1 -0
- package/dist/types/criteria.js +17 -0
- package/dist/types/criteria.js.map +1 -0
- package/dist/types/domain.d.ts +30 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +2 -0
- package/dist/types/domain.js.map +1 -0
- package/dist/types/history-tracker.d.ts +36 -0
- package/dist/types/history-tracker.d.ts.map +1 -0
- package/dist/types/history-tracker.js +2 -0
- package/dist/types/history-tracker.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/repository.d.ts +43 -0
- package/dist/types/repository.d.ts.map +1 -0
- package/dist/types/repository.js +2 -0
- package/dist/types/repository.js.map +1 -0
- package/dist/types/standard-schema.d.ts +15 -0
- package/dist/types/standard-schema.d.ts.map +1 -0
- package/dist/types/standard-schema.js +2 -0
- package/dist/types/standard-schema.js.map +1 -0
- package/dist/types/unit-of-work.d.ts +39 -0
- package/dist/types/unit-of-work.d.ts.map +1 -0
- package/dist/types/unit-of-work.js +2 -0
- package/dist/types/unit-of-work.js.map +1 -0
- package/dist/types/utils.d.ts +14 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +2 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/validation-error.d.ts +42 -0
- package/dist/validation-error.d.ts.map +1 -0
- package/dist/validation-error.js +73 -0
- package/dist/validation-error.js.map +1 -0
- package/dist/value-object.d.ts +47 -0
- package/dist/value-object.d.ts.map +1 -0
- package/dist/value-object.js +136 -0
- package/dist/value-object.js.map +1 -0
- package/eslint.config.js +51 -0
- package/jest.config.js +21 -0
- package/package.json +58 -0
- package/src/base-entity.ts +401 -0
- package/src/constants.ts +7 -0
- package/src/criteria.ts +291 -0
- package/src/deep-proxy.ts +339 -0
- package/src/domain-event-bus.ts +166 -0
- package/src/domain-event.ts +90 -0
- package/src/entity.ts +16 -0
- package/src/id.ts +94 -0
- package/src/index.ts +33 -0
- package/src/paginated-result.ts +274 -0
- package/src/repository/base-repository.ts +152 -0
- package/src/repository/in-memory-repository.ts +104 -0
- package/src/repository/index.ts +55 -0
- package/src/repository/mapper.ts +74 -0
- package/src/repository/unit-of-work.ts +148 -0
- package/src/types/criteria.ts +79 -0
- package/src/types/domain.ts +37 -0
- package/src/types/history-tracker.ts +45 -0
- package/src/types/index.ts +7 -0
- package/src/types/repository.ts +51 -0
- package/src/types/standard-schema.ts +19 -0
- package/src/types/unit-of-work.ts +46 -0
- package/src/types/utils.ts +29 -0
- package/src/validation-error.ts +97 -0
- package/src/value-object.ts +187 -0
- package/tests/criteria.test.ts +432 -0
- package/tests/domain-events.test.ts +445 -0
- package/tests/entity-equality.test.ts +487 -0
- package/tests/entity-validation.test.ts +339 -0
- package/tests/entity.test.ts +33 -0
- package/tests/history-tracker.spec.ts +667 -0
- package/tests/id.test.ts +341 -0
- package/tests/repository.test.ts +641 -0
- package/tests/to-json.test.ts +91 -0
- package/tests/utils.ts +151 -0
- package/tests/value-object-validation.test.ts +228 -0
- package/tests/value-objects.test.ts +52 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [20.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup Node.js ${{ matrix.node-version }}
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
cache: 'npm'
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
- name: Run linter
|
|
31
|
+
run: npm run lint
|
|
32
|
+
|
|
33
|
+
- name: Run type checking
|
|
34
|
+
run: npx tsc --noEmit
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: npm test
|
|
38
|
+
|
|
39
|
+
- name: Build
|
|
40
|
+
run: npm run build
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm test
|
package/.versionrc.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"types": [
|
|
3
|
+
{ "type": "feat", "section": "Features" },
|
|
4
|
+
{ "type": "fix", "section": "Bug Fixes" },
|
|
5
|
+
{ "type": "chore", "hidden": false, "section": "Chores" },
|
|
6
|
+
{ "type": "docs", "hidden": false, "section": "Documentation" },
|
|
7
|
+
{ "type": "style", "hidden": true },
|
|
8
|
+
{ "type": "refactor", "section": "Refactoring" },
|
|
9
|
+
{ "type": "perf", "section": "Performance Improvements" },
|
|
10
|
+
{ "type": "test", "hidden": false, "section": "Tests" }
|
|
11
|
+
],
|
|
12
|
+
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
|
|
13
|
+
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
|
|
14
|
+
"issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
|
|
15
|
+
"userUrlFormat": "{{host}}/{{user}}",
|
|
16
|
+
"releaseCommitMessageFormat": "chore(release): {{currentTag}}",
|
|
17
|
+
"issuePrefixes": ["#"],
|
|
18
|
+
"skip": {
|
|
19
|
+
"changelog": false
|
|
20
|
+
}
|
|
21
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [0.2.1](https://github.com/tarcisioandrade/rich-domain/compare/v0.2.0...v0.2.1) (2025-11-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update TypeScript configuration for module resolution and add check script ([4c0951f](https://github.com/tarcisioandrade/rich-domain/commit/4c0951fa3ce7551fc9182a7e584578053d0137a7))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* add ignoreDeprecations option to TypeScript configuration ([a66e528](https://github.com/tarcisioandrade/rich-domain/commit/a66e5289c33972f0449f9eb6d9e6fb85054888c4))
|
|
16
|
+
|
|
17
|
+
## [0.2.0](https://github.com/tarcisioandrade/rich-domain/compare/v0.1.0...v0.2.0) (2025-11-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add repository and unit of work modules with transaction management and clean exports ([83b652c](https://github.com/tarcisioandrade/rich-domain/commit/83b652cf751c2824799cfc961b282413ac7667f7))
|
|
23
|
+
* add search functionality to Criteria class with related methods ([1445e09](https://github.com/tarcisioandrade/rich-domain/commit/1445e092141c538766af39ec7de13421bf318393))
|
|
24
|
+
* implement abstract base repository and mapper for domain persistence ([f6b06ca](https://github.com/tarcisioandrade/rich-domain/commit/f6b06ca59292d9290e438717acaf2eaf361f63a7))
|
|
25
|
+
* implement criteria with filtering, ordering, and pagination ([bb42425](https://github.com/tarcisioandrade/rich-domain/commit/bb42425cc9e763ced350c3e6ee86954a5239cfb6))
|
|
26
|
+
* implement InMemoryRepository for testing with CRUD operations and criteria support ([a9d0cf6](https://github.com/tarcisioandrade/rich-domain/commit/a9d0cf63e68ab40d2944b6f26792ebfc456db176))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* disable no-unsafe-function-type rule in ESLint configuration ([f185ed9](https://github.com/tarcisioandrade/rich-domain/commit/f185ed920eda8e1f1c205aed8d7f1091cd03fbee))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Chores
|
|
35
|
+
|
|
36
|
+
* add coverage directory to .gitignore ([7a895f0](https://github.com/tarcisioandrade/rich-domain/commit/7a895f0ca777c27056f5bfd5adeed0b44049c60e))
|
|
37
|
+
* enhance Jest configuration and add coverage script to package.json ([d3b08d9](https://github.com/tarcisioandrade/rich-domain/commit/d3b08d97a4ecb650825e0b99d307203a5449ee96))
|
|
38
|
+
* update .gitignore to exclude example directories ([26c2d41](https://github.com/tarcisioandrade/rich-domain/commit/26c2d4140403877dabbd8a8b2b86250fa459f9b5))
|
|
39
|
+
* update version to 0.1.0 and add release scripts ([bb0aafa](https://github.com/tarcisioandrade/rich-domain/commit/bb0aafa85b5527d8ac3a582fcb75c489e7a4aa7a))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Refactoring
|
|
43
|
+
|
|
44
|
+
* drop default values ([a7e130a](https://github.com/tarcisioandrade/rich-domain/commit/a7e130af3a7ece31bb7bdf38afd7e05ed724bf3c))
|
|
45
|
+
* move pagination logic to a new PaginatedResult class and update criteria tests ([96639e1](https://github.com/tarcisioandrade/rich-domain/commit/96639e15c9e7aa2794f7439741150d1a8b087d39))
|
|
46
|
+
* reorganize types and constants, introduce new criteria types ([170e93a](https://github.com/tarcisioandrade/rich-domain/commit/170e93a2b9f68c21e02818f87171df242018a130))
|
|
47
|
+
* update access modifiers and default values in BaseEntity and Criteria classes ([75cde9d](https://github.com/tarcisioandrade/rich-domain/commit/75cde9d162adc1ad8d142140186592c155415c2e))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Documentation
|
|
51
|
+
|
|
52
|
+
* enhance README with new features ([0a49e63](https://github.com/tarcisioandrade/rich-domain/commit/0a49e6339bd36ae0c3193f8a3389906b139e56b3))
|
|
53
|
+
|
|
54
|
+
## 0.1.0 (2025-11-16)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* domain-events implementation ([92384cc](https://github.com/tarcisioandrade/rich-domain/commit/92384cc4cc645ccb2a92ea9348491b05c7e34247))
|
|
60
|
+
* entity equality ([eb19399](https://github.com/tarcisioandrade/rich-domain/commit/eb19399375daaafb8aad850ba9cee590e6ddf11f))
|
|
61
|
+
* id class ([086d6b6](https://github.com/tarcisioandrade/rich-domain/commit/086d6b622041f03c70519e667c3d7b009c241c60))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Refactoring
|
|
65
|
+
|
|
66
|
+
* Change property access in BaseEntity and related classes ([ceacca1](https://github.com/tarcisioandrade/rich-domain/commit/ceacca18b33d70a0d87119436c7b6180ddf61648))
|
|
67
|
+
* Remove Result class and related tests ([02fa29f](https://github.com/tarcisioandrade/rich-domain/commit/02fa29ff6bdad377c5c0737e9cec2dd2f36940af))
|
|
68
|
+
* Standardize quotes and remove obsolete test files ([2a38df7](https://github.com/tarcisioandrade/rich-domain/commit/2a38df7a88f418b63797dd32241284a52bdae3cf))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Tests
|
|
72
|
+
|
|
73
|
+
* validation tests ([eb620a4](https://github.com/tarcisioandrade/rich-domain/commit/eb620a4aec22d2335a466f002f8659bf402ced74))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Chores
|
|
77
|
+
|
|
78
|
+
* config ci and eslint ([88fba8f](https://github.com/tarcisioandrade/rich-domain/commit/88fba8fe51b0929cc55a649cfbf1e76d9bfb99b2))
|
|
79
|
+
* update CI node version matrix to only include 20.x ([9aecd60](https://github.com/tarcisioandrade/rich-domain/commit/9aecd6043dd391a2795e1209631b57d542c748da))
|
|
80
|
+
* update node engine requirement to >=20.0.0 ([213629c](https://github.com/tarcisioandrade/rich-domain/commit/213629cb64b3b85452f0364f802bb58bd4a757f8))
|
|
81
|
+
* update node engine requirement to >=22.0.0 ([1bad966](https://github.com/tarcisioandrade/rich-domain/commit/1bad966de395ff2b02dd0d7a4627aa725039b862))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 tarcisioandrade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|