Skip to content

Commit 866e53a

Browse files
committed
Merge branch 'release/2.0.0-rc.1'
2 parents ef74fbd + d706c23 commit 866e53a

File tree

297 files changed

+9432
-5243
lines changed

Some content is hidden

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

297 files changed

+9432
-5243
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, develop, next ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main, develop, next ]
88

99
jobs:
1010
build:

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,75 @@ All notable changes to this project will be documented in this file. This projec
55

66
## Unreleased
77

8+
### [2.0.0-rc.1] - 2024-05-07
9+
10+
**Refer to the [Upgrade Guide.](./docs/guide/upgrade.md)**
11+
12+
### Added
13+
14+
- **BREAKING** The command bus interface now has a `queue()` method. Our command dispatcher implementation has been
15+
updated to accept a queue factory closure as its third constructor argument. This is an optional argument, so this
16+
change only breaks your implementation if you have manually implemented the command dispatch interface.
17+
- The `FailedResultException` now implements `ContextProvider` to get log context from the exception's
18+
result object. In Laravel applications, this means the exception context will automatically be logged.
19+
- The `Result` interface has a new `abort()` method. This throws a `FailedResultException` if the result is not
20+
successful.
21+
- The inbound integration event handler container now accepts an optional factory for a default handler. This can be
22+
used to swallow inbound events that the bounded context does not need to consume. We have also added
23+
a `SwallowInboundEvent` handler that can be used in this scenario.
24+
25+
### Changed
26+
27+
- **BREAKING** Package now uses a _hexagonal architecture_ approach, which helps clarify the relationship between the
28+
application and infrastructure layers. This means a number of interfaces have been moved to
29+
the `Contracts\Application\Ports` namespace, with them differentiated between driving and driven ports.
30+
- **BREAKING** As a number of interfaces had to be moved to a `Ports` namespace, we've tidied them all up by removing
31+
the `Interface` suffix and moving them to a `Contracts` namespace.
32+
- **BREAKING** We've also removed the `Trait` suffix from traits. To avoid collisions with interfaces, we've use `Is` a
33+
prefix where it makes sense. For example, `EntityTrait` has become `IsEntity`.
34+
- **BREAKING** The `DomainEventDispatching` namespace has been moved from `Infrastructure` to `Application`. This was
35+
needed for the new hexagonal architecture approach, but also makes it a lot clearer that domain events are the way the
36+
domain layer communicates with the application layer.
37+
- **BREAKING** The event bus implementation has been split into an inbound event bus (in the application layer) and an
38+
outbound event bus (in the infrastructure layer). With the new hexagonal architecture, this changes was required
39+
because inbound events are received via a driving port, while outbound events are published via a driven port.
40+
- **BREAKING** Refactored the queue implementation so that commands are queued. The queue implementation was previously
41+
not documented. There is now complete documentation in
42+
the [Asynchronous Processing chapter](docs/guide/application/asynchronous-processing.md) Refer to that documentation
43+
to upgrade your implementation.
44+
- **BREAKING** For clarity, the following classes have had their `pipeline` constructor argument renamed
45+
to `middleware`. You will need to update the construction of these classes if you are using named arguments:
46+
- `Application\Bus\CommandDispatcher`
47+
- `Application\Bus\QueryDispatcher`
48+
- `Application\InboundEventBus\EventDispatcher`
49+
- `Application\DomainEventDispatching\Dispatcher`
50+
- `Application\DomainEventDispatching\DeferredDispatcher`
51+
- `Application\DomainEventDispatching\UnitOfWorkAwareDispatcher`
52+
- **BREAKING** The command and query validators have been merged into a single class - `Application\Bus\Validator`. This
53+
is because there was no functional difference between the two, so this tidies up the implementation.
54+
- **BREAKING** Renamed the bus `MessageMiddleware` interface to `BusMiddleware` interface. Also changed the type-hint
55+
for the message from `Message` to `Command|Query`. This makes this interface clearer about its purpose, as it is
56+
intended only for use with commands and queries - i.e. not integration event messages.
57+
- **BREAKING** the `ResultContext` and `ObjectContext` helper classes have been moved to the `Toolkit\Loggable`
58+
namespace.
59+
- **BREAKING** The `Result::value()` method now throws a `FailedResultException` if the result is not successful.
60+
Previously it threw a `ContractException`.
61+
- **BREAKING** The unit of work implementation has been moved to the `Application\UnitOfWork` namespace. Previously it
62+
was in `Infrastructure\Persistence`. This reflects the fact that the unit of work manager is an application concern.
63+
The unit of work interface is now a driven port.
64+
65+
### Removed
66+
67+
- **BREAKING** The pipeline builder factory was no longer required, so the following classes/interfaces have been
68+
deleted. Although breaking, this is unlikely to affect your implementation as these classes were only used internal
69+
within our bus and dispatch implementations.
70+
- `Toolkit\Pipeline\PipelineBuilderFactoryInterface`
71+
- `Toolkit\Pipeline\PipelineBuilderFactory`
72+
- **BREAKING** Removed the following previously deprecated event bus middleware:
73+
- `LogOutboundIntegrationEvent` - use `Infrastructure\OutboundEventBus\Middleware\LogOutboundEvent` instead.
74+
- `LogInboundIntegrationEvent` - use `Application\InboundEventBus\Middleware\LogInboundEvent` instead.
75+
- **BREAKING** Removed the `Infrastructure::assert()` helper. This was not documented so is unlikely to be breaking.
76+
877
## [1.2.0] - 2024-04-05
978

1079
### Added

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
},
5757
"extra": {
5858
"branch-alias": {
59-
"dev-develop": "1.x-dev"
59+
"dev-develop": "2.x-dev",
60+
"dev-next": "3.x-dev"
6061
}
6162
},
6263
"minimum-stability": "stable",

deptrac.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,44 @@ deptrac:
44
layers:
55
- name: Toolkit
66
collectors:
7+
- type: className
8+
value: CloudCreativity\\Modules\\Contracts\\Toolkit\\*
79
- type: className
810
value: CloudCreativity\\Modules\\Toolkit\\*
911
- type: className
1012
value: Ramsey\\Uuid\\*
1113
- name: Domain
1214
collectors:
15+
- type: className
16+
value: CloudCreativity\\Modules\\Contracts\\Domain\\*
1317
- type: className
1418
value: CloudCreativity\\Modules\\Domain\\*
15-
- name: Infrastructure
19+
- name: Application
1620
collectors:
1721
- type: className
18-
value: CloudCreativity\\Modules\\Infrastructure\\*
22+
value: CloudCreativity\\Modules\\Contracts\\Application\\*
1923
- type: className
20-
value: Psr\\Log\\*
21-
- name: Application
24+
value: CloudCreativity\\Modules\\Application\\*
25+
- name: Infrastructure
2226
collectors:
2327
- type: className
24-
value: CloudCreativity\\Modules\\Bus\\*
28+
value: CloudCreativity\\Modules\\Contracts\\Infrastructure\\*
2529
- type: className
26-
value: CloudCreativity\\Modules\\EventBus\\*
30+
value: CloudCreativity\\Modules\\Infrastructure\\*
31+
- name: PSR Log
32+
collectors:
33+
- type: className
34+
value: Psr\\Log\\*
2735
ruleset:
2836
Toolkit:
2937
Domain:
3038
- Toolkit
31-
Infrastructure:
39+
Application:
3240
- Toolkit
3341
- Domain
34-
Application:
42+
- PSR Log
43+
Infrastructure:
3544
- Toolkit
3645
- Domain
37-
- Infrastructure
46+
- Application
47+
- PSR Log

docs/.vitepress/config.mts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default defineConfig({
2222
items: [
2323
{text: 'What is DDD Modules?', link: '/guide/'},
2424
{text: 'Installation', link: '/guide/installation'},
25+
{text: 'Upgrading', link: '/guide/upgrade'},
2526
],
2627
},
2728
{
@@ -32,7 +33,7 @@ export default defineConfig({
3233
{text: 'Bounded Contexts', link: '/guide/concepts/bounded-contexts'},
3334
{text: 'Layers', link: '/guide/concepts/layers'},
3435
{text: 'Encapsulation', link: '/guide/concepts/encapsulation'},
35-
{text: 'Modularisation', link: '/guide/concepts/modularisation'},
36+
{text: 'Modularisation & Structure', link: '/guide/concepts/modularisation'},
3637
],
3738
},
3839
{
@@ -41,27 +42,32 @@ export default defineConfig({
4142
items: [
4243
{text: 'Entities & Aggregates', link: '/guide/domain/entities'},
4344
{text: 'Value Objects', link: '/guide/domain/value-objects'},
44-
{text: 'Domain Events', link: '/guide/domain/events'},
45+
{text: 'Events', link: '/guide/domain/events'},
4546
{text: 'Services', link: '/guide/domain/services'},
4647
],
4748
},
48-
{
49-
text: 'Infrastructure Layer',
50-
collapsed: true,
51-
items: [
52-
{text: 'Asynchronous Processing', link: '/guide/infrastructure/queues'},
53-
{text: 'Outbox & Inbox', link: '/guide/infrastructure/outbox-inbox'},
54-
{text: 'Persistence', link: '/guide/infrastructure/persistence'},
55-
{text: 'Units of Work', link: '/guide/infrastructure/units-of-work'},
56-
],
57-
},
5849
{
5950
text: 'Application Layer',
6051
collapsed: false,
6152
items: [
6253
{text: 'Commands', link: '/guide/application/commands'},
6354
{text: 'Queries', link: '/guide/application/queries'},
6455
{text: 'Integration Events', link: '/guide/application/events'},
56+
{text: 'Domain Events', link: '/guide/application/domain-events'},
57+
{text: 'Units of Work', link: '/guide/application/units-of-work'},
58+
{text: 'Asynchronous Processing', link: '/guide/application/asynchronous-processing'},
59+
],
60+
},
61+
{
62+
text: 'Infrastructure Layer',
63+
collapsed: false,
64+
items: [
65+
{text: 'Dependency Injection', link: '/guide/infrastructure/dependency-injection'},
66+
{text: 'Exception Reporting', link: '/guide/infrastructure/exception-reporting'},
67+
{text: 'Persistence', link: '/guide/infrastructure/persistence'},
68+
{text: 'Publishing Events', link: '/guide/infrastructure/publishing-events'},
69+
{text: 'Transactional Outbox', link: '/guide/infrastructure/outbox'},
70+
{text: 'Queues', link: '/guide/infrastructure/queues'},
6571
],
6672
},
6773
{

0 commit comments

Comments
 (0)