Skip to content

Commit a98f917

Browse files
author
Sergio García Prado
authored
Merge pull request #461 from minos-framework/0.8.0
0.8.0.dev1
2 parents f9f6ae4 + fc8baa0 commit a98f917

File tree

229 files changed

+6025
-3188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+6025
-3188
lines changed

.github/workflows/minos-database-aiopg-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'packages/plugins/minos-database-aiopg/**'
1111
- 'packages/core/minos-microservice-aggregate/**'
1212
- 'packages/core/minos-microservice-networks/**'
13+
- 'packages/core/minos-microservice-transactions/**'
1314
- 'packages/core/minos-microservice-common/**'
1415

1516
jobs:

.github/workflows/minos-microservice-aggregate-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
paths:
1010
- 'packages/core/minos-microservice-aggregate/**'
1111
- 'packages/core/minos-microservice-networks/**'
12+
- 'packages/core/minos-microservice-transactions/**'
1213
- 'packages/core/minos-microservice-common/**'
1314

1415
jobs:

.github/workflows/minos-microservice-networks-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
pull_request:
99
paths:
1010
- 'packages/core/minos-microservice-networks/**'
11+
- 'packages/core/minos-microservice-transactions/**'
1112
- 'packages/core/minos-microservice-common/**'
1213

1314
jobs:

.github/workflows/minos-microservice-saga-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
paths:
1010
- 'packages/core/minos-microservice-saga/**'
1111
- 'packages/core/minos-microservice-networks/**'
12-
- 'packages/core/minos-microservice-aggregate/**'
12+
- 'packages/core/minos-microservice-transactions/**'
1313
- 'packages/core/minos-microservice-common/**'
1414

1515
jobs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Publish: minos-microservice-transactions"
2+
3+
on:
4+
push:
5+
branches:
6+
- '*.*.x'
7+
paths:
8+
- 'packages/core/minos-microservice-transactions/**'
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
container: python:3.9-buster
14+
defaults:
15+
run:
16+
working-directory: packages/core/minos-microservice-transactions
17+
18+
steps:
19+
20+
- name: Check out repository code
21+
uses: actions/checkout@v2
22+
23+
- name: Install Poetry
24+
uses: snok/install-poetry@v1
25+
26+
- name: Install dependencies
27+
run: make install
28+
29+
- name: Publish package
30+
run: make release
31+
env:
32+
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
33+
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Test: minos-microservice-transactions"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '*.*.x'
8+
pull_request:
9+
paths:
10+
- 'packages/core/minos-microservice-transactions/**'
11+
- 'packages/core/minos-microservice-common/**'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
container: python:3.9-buster
17+
defaults:
18+
run:
19+
working-directory: packages/core/minos-microservice-transactions
20+
21+
steps:
22+
- name: Check out repository code
23+
uses: actions/checkout@v2
24+
25+
- name: Install Poetry
26+
uses: snok/install-poetry@v1
27+
28+
- name: Install dependencies
29+
run: make install
30+
31+
- name: Lint package
32+
run: make lint
33+
34+
- name: Test package with coverage
35+
run: make coverage
36+
37+
- name: Publish coverage
38+
uses: codecov/codecov-action@v2
39+
with:
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
files: ./packages/core/minos-microservice-transactions/coverage.xml
42+
fail_ci_if_error: true
43+
44+
- name: Generate documentation
45+
run: make docs
46+
47+
- name: Generate build
48+
run: make dist

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ repos:
3737
files: ^packages/core/minos-microservice-saga/
3838
language: system
3939

40+
- id: minos-microservice-transactions-check
41+
pass_filenames: false
42+
entry: make --directory=packages/core/minos-microservice-transactions check
43+
name: Check minos-microservice-transactions
44+
files: ^packages/core/minos-microservice-transactions/
45+
language: system
46+
4047
- id: minos-broker-kafka-check
4148
pass_filenames: false
4249
entry: make --directory=packages/plugins/minos-broker-kafka check

README.md

+28-60
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ Create a `foo/main.py` file and add the following content:
225225
# foo/main.py
226226
227227
from pathlib import Path
228-
from minos.aggregate import Aggregate, RootEntity
228+
from minos.aggregate import Aggregate, Entity
229229
from minos.common import EntrypointLauncher
230230
from minos.cqrs import CommandService, QueryService
231231
232232
233-
class Foo(RootEntity):
234-
"""Foo RootEntity class."""
233+
class Foo(Entity):
234+
"""Foo Entity class."""
235235
236236
237237
class FooAggregate(Aggregate[Foo]):
@@ -262,14 +262,12 @@ python foo/main.py
262262
The way to model data in `minos` is highly inspired by the [Event Sourcing](https://microservices.io/patterns/data/event-sourcing.html) ideas. For this reason, the classes to be used to model data are:
263263

264264
* `minos.aggregate.Entity`: A model that has an identifier that gives it a unique identity, in the sense that some values from which it is composed could change, but its identity will continue being the same.
265-
* `minos.aggregate.ExternalEntity`: A model that belongs to another microservice (or aggregate boundary) but needs to be used for some reason inside this microservice (or aggregate boundary).
266-
* `minos.aggregate.RootEntity`: Is an `Entity` superset that provides global identity across the project compared to standard `Entity` models, that has only local identity (the `RootEntity` can be accessed from another microservices as `ExternalEntity` models, but standard `Entity` models can only be accessed within the microservice that define them). The `RootEntity` is also the one that interacts with the persistence layer (the `EventRepository` and `SnapshotRepository` instances).
267-
* `minos.aggregate.Ref`: A wrapper class that provides the functionality to store a reference of other `RootEntity` or `ExternalEntity` instances.
265+
* `minos.aggregate.Ref`: A wrapper class that provides the functionality to store a reference of other `Entity` instances.
268266
* `minos.aggregate.EntitySet`: A container of `Entity` instances that takes advantage of the incremental behaviour of the `EventRepository`.
269267
* `minos.aggregate.ValueObject`: A model that is only identified by the values that compose it, so that if some of them changes, then the model becomes completely different (for that reason, these models are immutable).
270268
* `minos.aggregate.ValueObjectSet`: A container of `ValueObject` instances that takes advantage of the incremental behaviour of the `EventRepository.
271-
* `minos.aggregate.Aggregate`: A collection of `Entity` and/or `ValueObject` models that are related to each other through a `RootEntity`.
272-
* `minos.aggregate.Event`: A model that contains the difference between the a `RootEntity` instance and its previous version (if any).
269+
* `minos.aggregate.Aggregate`: A collection of `Entity` and/or `ValueObject` models that are related to each other through a special `Entity` known as the Root Entity of the Aggregate.
270+
* `minos.aggregate.Event`: A model that contains the difference between the a `Entity` instance and its previous version (if any).
273271

274272
Here is an example of the creation the `Foo` aggregate. In this case, it has two attributes, a `bar` being a `str`, and a `foobar` being an optional reference to the external `FooBar` aggregate, which it is assumed that it has a `something` attribute.
275273

@@ -279,20 +277,14 @@ Here is an example of the creation the `Foo` aggregate. In this case, it has two
279277
from __future__ import annotations
280278
from typing import Optional
281279
from uuid import UUID
282-
from minos.aggregate import Aggregate, RootEntity, ExternalEntity, Ref
280+
from minos.aggregate import Aggregate, Entity, Ref
283281
284282
285-
class Foo(RootEntity):
286-
"""Foo RootEntity class."""
283+
class Foo(Entity):
284+
"""Foo Entity class."""
287285
288286
bar: str
289-
foobar: Optional[Ref[FooBar]]
290-
291-
292-
class FooBar(ExternalEntity):
293-
"""FooBar ExternalEntity clas."""
294-
295-
something: str
287+
foobar: Optional[Ref["FooBar"]]
296288
297289
298290
class FooAggregate(Aggregate[Foo]):
@@ -334,22 +326,16 @@ from pathlib import Path
334326
from typing import Optional
335327
from uuid import UUID
336328
337-
from minos.aggregate import Aggregate, RootEntity, ExternalEntity, Ref
329+
from minos.aggregate import Aggregate, Entity, Ref
338330
from minos.common import EntrypointLauncher
339331
from minos.cqrs import CommandService, QueryService
340332
341333
342-
class Foo(RootEntity):
343-
"""Foo RootEntity class."""
334+
class Foo(Entity):
335+
"""Foo Entity class."""
344336
345337
bar: str
346-
foobar: Optional[Ref[FooBar]]
347-
348-
349-
class FooBar(ExternalEntity):
350-
"""FooBar ExternalEntity clas."""
351-
352-
something: str
338+
foobar: Optional[Ref["FooBar"]]
353339
354340
355341
class FooAggregate(Aggregate[Foo]):
@@ -436,23 +422,17 @@ from pathlib import Path
436422
from typing import Optional
437423
from uuid import UUID
438424
439-
from minos.aggregate import Aggregate, RootEntity, ExternalEntity, Ref
425+
from minos.aggregate import Aggregate, Entity, Ref
440426
from minos.common import EntrypointLauncher
441427
from minos.cqrs import CommandService, QueryService
442428
from minos.networks import Request, Response, enroute
443429
444430
445-
class Foo(RootEntity):
446-
"""Foo RootEntity class."""
431+
class Foo(Entity):
432+
"""Foo Entity class."""
447433
448434
bar: str
449-
foobar: Optional[Ref[FooBar]]
450-
451-
452-
class FooBar(ExternalEntity):
453-
"""FooBar ExternalEntity clas."""
454-
455-
something: str
435+
foobar: Optional[Ref["FooBar"]]
456436
457437
458438
class FooAggregate(Aggregate[Foo]):
@@ -594,23 +574,17 @@ from pathlib import Path
594574
from typing import Optional
595575
from uuid import UUID
596576
597-
from minos.aggregate import Aggregate, RootEntity, ExternalEntity, Ref
577+
from minos.aggregate import Aggregate, Entity, Ref
598578
from minos.common import EntrypointLauncher
599579
from minos.cqrs import CommandService, QueryService
600580
from minos.networks import Request, Response, enroute
601581
602582
603-
class Foo(RootEntity):
604-
"""Foo RootEntity class."""
583+
class Foo(Entity):
584+
"""Foo Entity class."""
605585
606586
bar: str
607-
foobar: Optional[Ref[FooBar]]
608-
609-
610-
class FooBar(ExternalEntity):
611-
"""FooBar ExternalEntity clas."""
612-
613-
something: str
587+
foobar: Optional[Ref["FooBar"]]
614588
615589
616590
class FooAggregate(Aggregate[Foo]):
@@ -797,24 +771,18 @@ from pathlib import Path
797771
from typing import Optional
798772
from uuid import UUID
799773

800-
from minos.aggregate import Aggregate, RootEntity, ExternalEntity, Ref
774+
from minos.aggregate import Aggregate, Entity, Ref
801775
from minos.common import ModelType, EntrypointLauncher
802776
from minos.cqrs import CommandService, QueryService
803777
from minos.networks import Request, Response, enroute
804778
from minos.saga import Saga, SagaContext, SagaRequest, SagaResponse
805779

806780

807-
class Foo(RootEntity):
808-
"""Foo RootEntity class."""
781+
class Foo(Entity):
782+
"""Foo Entity class."""
809783

810784
bar: str
811-
foobar: Optional[Ref[FooBar]]
812-
813-
814-
class FooBar(ExternalEntity):
815-
"""FooBar ExternalEntity clas."""
816-
817-
something: str
785+
foobar: Optional[Ref["FooBar"]]
818786

819787

820788
class FooAggregate(Aggregate[Foo]):
@@ -1046,13 +1014,13 @@ from __future__ import annotations
10461014
from pathlib import Path
10471015
from uuid import UUID
10481016
1049-
from minos.aggregate import Aggregate, RootEntity
1017+
from minos.aggregate import Aggregate, Entity
10501018
from minos.common import EntrypointLauncher
10511019
from minos.cqrs import CommandService
10521020
from minos.networks import Request, Response, enroute
10531021
10541022
1055-
class FooBar(RootEntity):
1023+
class FooBar(Entity):
10561024
"""FooBar Root Entity clas."""
10571025
10581026
something: str

0 commit comments

Comments
 (0)