@arts-n-crafts/ts 3.18.1 → 5.0.0-rc.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/README.md +221 -6
- package/package.json +109 -22
- package/packages/v3/dist/index.cjs +63 -72
- package/packages/v3/dist/index.cjs.map +1 -1
- package/packages/v3/dist/index.d.cts +22 -22
- package/packages/v3/dist/index.d.ts +22 -22
- package/packages/v3/dist/index.js +63 -72
- package/packages/v3/dist/index.js.map +1 -1
- package/packages/v3/package.json +49 -50
- package/packages/v4/dist/index.cjs +222 -136
- package/packages/v4/dist/index.cjs.map +1 -1
- package/packages/v4/dist/index.d.cts +71 -52
- package/packages/v4/dist/index.d.ts +71 -52
- package/packages/v4/dist/index.js +220 -135
- package/packages/v4/dist/index.js.map +1 -1
- package/packages/v4/package.json +49 -50
- package/packages/v5/dist/DomainEvent-CSzUMw46.d.cts +23 -0
- package/packages/v5/dist/DomainEvent-w1jyCjai.d.ts +23 -0
- package/packages/v5/dist/Intent-B6l0bHZU.d.cts +13 -0
- package/packages/v5/dist/Intent-BLNY6RoG.d.ts +13 -0
- package/packages/v5/dist/Message-c9XdBoh4.d.cts +36 -0
- package/packages/v5/dist/Message-c9XdBoh4.d.ts +36 -0
- package/packages/v5/dist/Rejection-D9PlzquK.d.cts +19 -0
- package/packages/v5/dist/Rejection-D9PlzquK.d.ts +19 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.cjs +4 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.cjs.map +1 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.d.cts +77 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.d.ts +77 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.js +3 -0
- package/packages/v5/dist/adapters/outbound/capabilities/index.js.map +1 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.cjs +4 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.cjs.map +1 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.d.cts +68 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.d.ts +68 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.js +3 -0
- package/packages/v5/dist/adapters/outbound/shapes/index.js.map +1 -0
- package/packages/v5/dist/core/capabilities/index.cjs +4 -0
- package/packages/v5/dist/core/capabilities/index.cjs.map +1 -0
- package/packages/v5/dist/core/capabilities/index.d.cts +33 -0
- package/packages/v5/dist/core/capabilities/index.d.ts +33 -0
- package/packages/v5/dist/core/capabilities/index.js +3 -0
- package/packages/v5/dist/core/capabilities/index.js.map +1 -0
- package/packages/v5/dist/core/shapes/index.cjs +4 -0
- package/packages/v5/dist/core/shapes/index.cjs.map +1 -0
- package/packages/v5/dist/core/shapes/index.d.cts +27 -0
- package/packages/v5/dist/core/shapes/index.d.ts +27 -0
- package/packages/v5/dist/core/shapes/index.js +3 -0
- package/packages/v5/dist/core/shapes/index.js.map +1 -0
- package/packages/v5/dist/useCases/command/capabilities/index.cjs +4 -0
- package/packages/v5/dist/useCases/command/capabilities/index.cjs.map +1 -0
- package/packages/v5/dist/useCases/command/capabilities/index.d.cts +27 -0
- package/packages/v5/dist/useCases/command/capabilities/index.d.ts +27 -0
- package/packages/v5/dist/useCases/command/capabilities/index.js +3 -0
- package/packages/v5/dist/useCases/command/capabilities/index.js.map +1 -0
- package/packages/v5/dist/useCases/command/shapes/index.cjs +4 -0
- package/packages/v5/dist/useCases/command/shapes/index.cjs.map +1 -0
- package/packages/v5/dist/useCases/command/shapes/index.d.cts +78 -0
- package/packages/v5/dist/useCases/command/shapes/index.d.ts +78 -0
- package/packages/v5/dist/useCases/command/shapes/index.js +3 -0
- package/packages/v5/dist/useCases/command/shapes/index.js.map +1 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.cjs +4 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.cjs.map +1 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.d.cts +12 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.d.ts +12 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.js +3 -0
- package/packages/v5/dist/useCases/policy/capabilities/index.js.map +1 -0
- package/packages/v5/dist/useCases/query/capabilities/index.cjs +4 -0
- package/packages/v5/dist/useCases/query/capabilities/index.cjs.map +1 -0
- package/packages/v5/dist/useCases/query/capabilities/index.d.cts +8 -0
- package/packages/v5/dist/useCases/query/capabilities/index.d.ts +8 -0
- package/packages/v5/dist/useCases/query/capabilities/index.js +3 -0
- package/packages/v5/dist/useCases/query/capabilities/index.js.map +1 -0
- package/packages/v5/dist/useCases/query/shapes/index.cjs +4 -0
- package/packages/v5/dist/useCases/query/shapes/index.cjs.map +1 -0
- package/packages/v5/dist/useCases/query/shapes/index.d.cts +7 -0
- package/packages/v5/dist/useCases/query/shapes/index.d.ts +7 -0
- package/packages/v5/dist/useCases/query/shapes/index.js +3 -0
- package/packages/v5/dist/useCases/query/shapes/index.js.map +1 -0
- package/packages/v5/package.json +59 -0
package/README.md
CHANGED
|
@@ -33,26 +33,241 @@ Workflows are a way to organize usecases into a sequence of steps. Each step in
|
|
|
33
33
|
|
|
34
34
|
### System design
|
|
35
35
|
|
|
36
|
-
Event
|
|
36
|
+
The recommended approach to designing features is **Event Storming**: start by identifying the domain events that matter (facts that already happened), then work backwards to find the commands that caused them and the queries that read from their projections. This surfaces the natural boundaries between usecases and bounded contexts before any code is written.
|
|
37
|
+
|
|
38
|
+
Once events are identified, each feature becomes a vertical slice:
|
|
39
|
+
|
|
40
|
+
1. A **command** triggers a **CommandHandler** that loads state, runs a **Decider**, and appends **DomainEvents** to the **EventStore**.
|
|
41
|
+
2. The **EventStore** enqueues each event to the **Outbox** at write time, decoupling persistence from publishing.
|
|
42
|
+
3. The **OutboxWorker** drains the **Outbox** and publishes to the **EventBus**, which fans out to **EventHandlers**.
|
|
43
|
+
4. **EventHandlers** either update a read-model **Database** (projection) or dispatch follow-up commands (saga / ACL).
|
|
44
|
+
5. A **query** triggers a **QueryHandler** that reads the projected **Database** using a **Specification**.
|
|
37
45
|
|
|
38
46
|
## Installation
|
|
39
47
|
|
|
48
|
+
This package is available on npm as `@arts-n-crafts/ts`. It ships two versioned entry points:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Install
|
|
52
|
+
bun add @arts-n-crafts/ts
|
|
53
|
+
# or
|
|
54
|
+
npm install @arts-n-crafts/ts
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// v4 (recommended)
|
|
59
|
+
import { ... } from '@arts-n-crafts/ts/v4'
|
|
40
60
|
|
|
61
|
+
// v3 (legacy)
|
|
62
|
+
import { ... } from '@arts-n-crafts/ts/v3'
|
|
63
|
+
|
|
64
|
+
// or the default (v3)
|
|
65
|
+
import { ... } from '@arts-n-crafts/ts'
|
|
66
|
+
```
|
|
41
67
|
|
|
42
68
|
## Contributing
|
|
43
69
|
|
|
44
70
|
This codebase is written in TypeScript and uses Bun as the runtime.
|
|
45
71
|
|
|
46
|
-
To install dependencies:
|
|
47
|
-
|
|
48
72
|
```bash
|
|
49
|
-
bun install
|
|
73
|
+
bun install # Install dependencies
|
|
74
|
+
bun run build # Build all packages
|
|
75
|
+
bun run lint # Lint all packages
|
|
76
|
+
bun run lint:fix # Auto-fix lint issues
|
|
77
|
+
bun run typecheck # Type-check all packages
|
|
78
|
+
bun run coverage # Run tests with coverage
|
|
79
|
+
bun run check-exports # Validate package exports
|
|
50
80
|
```
|
|
51
81
|
|
|
52
|
-
To
|
|
82
|
+
To work on a single package:
|
|
53
83
|
|
|
54
84
|
```bash
|
|
55
|
-
|
|
85
|
+
cd packages/v4
|
|
86
|
+
bun run test # Run tests once
|
|
87
|
+
bun run test:watch # Run tests in watch mode
|
|
88
|
+
bun run build # Build this package only
|
|
56
89
|
```
|
|
57
90
|
|
|
91
|
+
Commits follow the [Conventional Commits](https://www.conventionalcommits.org/) spec. Use `bun run commit` for an interactive prompt.
|
|
92
|
+
|
|
58
93
|
This project was created using `bun init` in bun v1.2.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Concepts (v4)
|
|
98
|
+
|
|
99
|
+
All concept documentation lives co-located with the source in `docs/` subfolders per layer.
|
|
100
|
+
|
|
101
|
+
### Utils
|
|
102
|
+
|
|
103
|
+
| Concept | Description |
|
|
104
|
+
|---------|-------------|
|
|
105
|
+
| [fail](packages/v4/src/utils/fail/docs/fail.md) | Wraps a value in a thunk for lazy error creation |
|
|
106
|
+
| [invariant](packages/v4/src/utils/invariant/docs/invariant.md) | Asserts a condition and throws if false |
|
|
107
|
+
| [isEqual](packages/v4/src/utils/isEqual/docs/isEqual.md) | Deep structural equality check |
|
|
108
|
+
| [parseAsError](packages/v4/src/utils/parseAsError/docs/parseAsError.md) | Normalises unknown catch values to `Error` |
|
|
109
|
+
| [StreamKey](packages/v4/src/utils/streamKey/docs/StreamKey.md) | Composite `${streamName}#${aggregateId}` key type |
|
|
110
|
+
|
|
111
|
+
### Core — types
|
|
112
|
+
|
|
113
|
+
| Concept | Description |
|
|
114
|
+
|---------|-------------|
|
|
115
|
+
| [BaseMetadata](packages/v4/src/core/docs/types/BaseMetadata.md) | Shared metadata for all message types |
|
|
116
|
+
| [ISODateTime](packages/v4/src/core/docs/types/ISODateTime.md) | ISO 8601 date-time string brand |
|
|
117
|
+
| [UnixTimestamp](packages/v4/src/core/docs/types/UnixTimestamp.md) | Epoch milliseconds number brand |
|
|
118
|
+
| [WithIdentifier](packages/v4/src/core/docs/types/WithIdentifier.md) | `{ id: string }` constraint |
|
|
119
|
+
| [FilledArray](packages/v4/src/core/docs/types/FilledArray.md) | Non-empty array type |
|
|
120
|
+
| [Maybe](packages/v4/src/core/docs/types/Maybe.md) | `T \| undefined` |
|
|
121
|
+
| [Nullable](packages/v4/src/core/docs/types/Nullable.md) | `T \| null` |
|
|
122
|
+
| [Primitive](packages/v4/src/core/docs/types/Primitive.md) | Scalar value union |
|
|
123
|
+
|
|
124
|
+
### Core — CQRS primitives
|
|
125
|
+
|
|
126
|
+
| Concept | Description |
|
|
127
|
+
|---------|-------------|
|
|
128
|
+
| [Command](packages/v4/src/core/docs/Command.md) | Write-side intent message |
|
|
129
|
+
| [Query](packages/v4/src/core/docs/Query.md) | Read-side data request |
|
|
130
|
+
| [createCommand](packages/v4/src/core/docs/createCommand.md) | Factory for `Command` objects |
|
|
131
|
+
| [isCommand](packages/v4/src/core/docs/isCommand.md) | Type guard for `Command` |
|
|
132
|
+
| [createQuery](packages/v4/src/core/docs/createQuery.md) | Factory for `Query` objects |
|
|
133
|
+
| [isQuery](packages/v4/src/core/docs/isQuery.md) | Type guard for `Query` |
|
|
134
|
+
| [getTimestamp](packages/v4/src/core/docs/getTimestamp.md) | Current epoch milliseconds |
|
|
135
|
+
|
|
136
|
+
### Core — handlers
|
|
137
|
+
|
|
138
|
+
| Concept | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| [CommandHandler](packages/v4/src/core/docs/CommandHandler.md) | Application-layer write handler |
|
|
141
|
+
| [QueryHandler](packages/v4/src/core/docs/QueryHandler.md) | Application-layer read handler |
|
|
142
|
+
| [EventHandler](packages/v4/src/core/docs/EventHandler.md) | Projection or ACL reaction handler |
|
|
143
|
+
|
|
144
|
+
### Domain — events
|
|
145
|
+
|
|
146
|
+
| Concept | Description |
|
|
147
|
+
|---------|-------------|
|
|
148
|
+
| [DomainEvent](packages/v4/src/domain/docs/DomainEvent.md) | Internal fact produced by a `Decider` |
|
|
149
|
+
| [Rejection](packages/v4/src/domain/docs/Rejection.md) | Explicit command failure |
|
|
150
|
+
| [createDomainEvent](packages/v4/src/domain/docs/createDomainEvent.md) | Factory for `DomainEvent` |
|
|
151
|
+
| [isDomainEvent](packages/v4/src/domain/docs/isDomainEvent.md) | Type guard for `DomainEvent` |
|
|
152
|
+
| [isEvent](packages/v4/src/domain/docs/isEvent.md) | Broad structural guard for any event shape |
|
|
153
|
+
| [createRejection](packages/v4/src/domain/docs/createRejection.md) | Factory for `Rejection` |
|
|
154
|
+
| [isRejection](packages/v4/src/domain/docs/isRejection.md) | Type guard for `Rejection` |
|
|
155
|
+
| [convertDomainEventToIntegrationEvent](packages/v4/src/domain/docs/convertDomainEventToIntegrationEvent.md) | Converts an internal event to the external wire format |
|
|
156
|
+
| [convertRejectionToIntegrationEvent](packages/v4/src/domain/docs/convertRejectionToIntegrationEvent.md) | Converts a rejection to the external wire format |
|
|
157
|
+
|
|
158
|
+
### Domain — building blocks
|
|
159
|
+
|
|
160
|
+
| Concept | Description |
|
|
161
|
+
|---------|-------------|
|
|
162
|
+
| [AggregateRoot](packages/v4/src/domain/docs/AggregateRoot.md) | OOP aggregate base class |
|
|
163
|
+
| [Decider](packages/v4/src/domain/docs/Decider.md) | Functional event-sourcing: `decide` + `evolve` + `initialState` |
|
|
164
|
+
| [Repository](packages/v4/src/domain/docs/Repository.md) | Domain output port for loading and storing aggregates |
|
|
165
|
+
| [Specification](packages/v4/src/domain/docs/Specification.md) | Composable query predicates with `.and()/.or()/.not()` |
|
|
166
|
+
|
|
167
|
+
### Infrastructure — event types
|
|
168
|
+
|
|
169
|
+
| Concept | Description |
|
|
170
|
+
|---------|-------------|
|
|
171
|
+
| [IntegrationEvent](packages/v4/src/infrastructure/docs/IntegrationEvent.md) | External wire format for outbound events |
|
|
172
|
+
| [ExternalEvent](packages/v4/src/infrastructure/docs/ExternalEvent.md) | Inbound event from another bounded context |
|
|
173
|
+
| [createIntegrationEvent](packages/v4/src/infrastructure/docs/createIntegrationEvent.md) | Factory for `IntegrationEvent` |
|
|
174
|
+
| [isIntegrationEvent](packages/v4/src/infrastructure/docs/isIntegrationEvent.md) | Type guard for `IntegrationEvent` |
|
|
175
|
+
| [createExternalEvent](packages/v4/src/infrastructure/docs/createExternalEvent.md) | Factory for `ExternalEvent` |
|
|
176
|
+
| [isExternalEvent](packages/v4/src/infrastructure/docs/isExternalEvent.md) | Type guard for `ExternalEvent` |
|
|
177
|
+
|
|
178
|
+
### Infrastructure — interfaces
|
|
179
|
+
|
|
180
|
+
| Concept | Description |
|
|
181
|
+
|---------|-------------|
|
|
182
|
+
| [CommandBus](packages/v4/src/infrastructure/docs/CommandBus.md) | Routes commands to registered handlers |
|
|
183
|
+
| [QueryBus](packages/v4/src/infrastructure/docs/QueryBus.md) | Routes queries to registered handlers |
|
|
184
|
+
| [EventBus](packages/v4/src/infrastructure/docs/EventBus.md) | Publishes and consumes events across streams |
|
|
185
|
+
| [EventStore](packages/v4/src/infrastructure/docs/EventStore.md) | Append-only event ledger |
|
|
186
|
+
| [StoredEvent](packages/v4/src/infrastructure/docs/StoredEvent.md) | Persistence envelope for a `DomainEvent` |
|
|
187
|
+
| [Database](packages/v4/src/infrastructure/docs/Database.md) | Generic record storage with typed operations |
|
|
188
|
+
| [Outbox](packages/v4/src/infrastructure/docs/Outbox.md) | At-least-once delivery buffer |
|
|
189
|
+
| [OutboxEntry](packages/v4/src/infrastructure/docs/OutboxEntry.md) | A single buffered `IntegrationEvent` with delivery state |
|
|
190
|
+
| [OutboxWorker](packages/v4/src/infrastructure/docs/OutboxWorker.md) | Drains the outbox and publishes to the `EventBus` |
|
|
191
|
+
|
|
192
|
+
### Infrastructure — implementations
|
|
193
|
+
|
|
194
|
+
| Concept | Simple | Resulted |
|
|
195
|
+
|---------|--------|---------|
|
|
196
|
+
| CommandBus | [SimpleCommandBus](packages/v4/src/infrastructure/docs/SimpleCommandBus.md) | [ResultedCommandBus](packages/v4/src/infrastructure/docs/ResultedCommandBus.md) |
|
|
197
|
+
| QueryBus | [SimpleQueryBus](packages/v4/src/infrastructure/docs/SimpleQueryBus.md) | [ResultedQueryBus](packages/v4/src/infrastructure/docs/ResultedQueryBus.md) |
|
|
198
|
+
| EventBus | [SimpleEventBus](packages/v4/src/infrastructure/docs/SimpleEventBus.md) | [ResultedEventBus](packages/v4/src/infrastructure/docs/ResultedEventBus.md) |
|
|
199
|
+
| EventStore | [SimpleEventStore](packages/v4/src/infrastructure/docs/SimpleEventStore.md) | [ResultedEventStore](packages/v4/src/infrastructure/docs/ResultedEventStore.md) |
|
|
200
|
+
| Database | [SimpleDatabase](packages/v4/src/infrastructure/docs/SimpleDatabase.md) | [ResultedDatabase](packages/v4/src/infrastructure/docs/ResultedDatabase.md) |
|
|
201
|
+
| Repository | [SimpleRepository](packages/v4/src/infrastructure/docs/SimpleRepository.md) | [ResultedRepository](packages/v4/src/infrastructure/docs/ResultedRepository.md) |
|
|
202
|
+
| Outbox | [InMemoryOutbox](packages/v4/src/infrastructure/docs/InMemoryOutbox.md) | — |
|
|
203
|
+
| OutboxWorker | [GenericOutboxWorker](packages/v4/src/infrastructure/docs/GenericOutboxWorker.md) | — |
|
|
204
|
+
|
|
205
|
+
### Integration point
|
|
206
|
+
|
|
207
|
+
| Concept | Description |
|
|
208
|
+
|---------|-------------|
|
|
209
|
+
| [ScenarioTest](packages/v4/src/infrastructure/docs/ScenarioTest.md) | BDD-style `given().when().then()` test harness |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## How to build features
|
|
214
|
+
|
|
215
|
+
### Write path
|
|
216
|
+
|
|
217
|
+
A command enters the system, is handled, and its resulting domain events are published via the Outbox to the EventBus. A saga handler can loop back and dispatch further commands.
|
|
218
|
+
|
|
219
|
+
```mermaid
|
|
220
|
+
flowchart TD
|
|
221
|
+
CMD[Command] --> CB[CommandBus]
|
|
222
|
+
CB --> CH[CommandHandler]
|
|
223
|
+
CH -->|load state| R[Repository]
|
|
224
|
+
R -->|replay events| ES[EventStore]
|
|
225
|
+
CH -->|decide| DC[Decider]
|
|
226
|
+
DC -->|DomainEvents| R
|
|
227
|
+
R -->|append events| ES
|
|
228
|
+
ES -->|enqueue| OB[Outbox]
|
|
229
|
+
OB --> OW[OutboxWorker]
|
|
230
|
+
OW -->|publish| EB[EventBus]
|
|
231
|
+
EB -->|saga: dispatch| CB
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
1. A `Command` is dispatched to the `CommandBus`, which routes it to the registered `CommandHandler`.
|
|
235
|
+
2. The `CommandHandler` calls `Repository.load` to replay the aggregate's `DomainEvent[]` through `Decider.evolve`, reconstructing current state.
|
|
236
|
+
3. `Decider.decide(command, state)` produces new `DomainEvent[]` (or a `Rejection`).
|
|
237
|
+
4. `Repository.store` calls `EventStore.append`, which persists the events and immediately enqueues each to the `Outbox`.
|
|
238
|
+
5. The `OutboxWorker` polls the `Outbox` on each tick and publishes pending entries to the `EventBus` — giving at-least-once delivery even if publishing fails transiently.
|
|
239
|
+
6. A saga `EventHandler` can receive the published event and dispatch a follow-up `Command` back to the `CommandBus`, chaining usecases across bounded contexts.
|
|
240
|
+
|
|
241
|
+
### Projection and read path
|
|
242
|
+
|
|
243
|
+
An EventHandler projects domain events into a read-model Database. Queries read directly from that projection.
|
|
244
|
+
|
|
245
|
+
```mermaid
|
|
246
|
+
flowchart TD
|
|
247
|
+
EB[EventBus] -->|fan-out| EH[EventHandler - projection]
|
|
248
|
+
EH -->|write| DB[(Read model Database)]
|
|
249
|
+
Q[Query] --> QB[QueryBus]
|
|
250
|
+
QB --> QH[QueryHandler]
|
|
251
|
+
QH -->|Specification| DB
|
|
252
|
+
DB -->|results| QH
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
1. The `EventBus` fans out each published event to all subscribed `EventHandler` instances on the stream.
|
|
256
|
+
2. A projection `EventHandler` receives the event and writes a denormalised record to a read-model `Database`.
|
|
257
|
+
3. A `Query` is dispatched to the `QueryBus`, which routes it to the registered `QueryHandler`.
|
|
258
|
+
4. The `QueryHandler` queries the read-model `Database` using a `Specification`, returning the projected records directly.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Architecture principles
|
|
263
|
+
|
|
264
|
+
| Principle | Embodied by |
|
|
265
|
+
|-----------|-------------|
|
|
266
|
+
| **Hexagonal / Ports & Adapters** | `CommandBus`, `QueryBus`, `EventBus`, `EventStore`, `Database`, `Repository` are ports; `Simple*` / `Resulted*` are adapters |
|
|
267
|
+
| **Clean Architecture** | `core` → `domain` → `infrastructure` dependency direction; domain never imports infrastructure |
|
|
268
|
+
| **Vertical Slices** | Each `CommandHandler` / `QueryHandler` owns its full slice: data access, logic, and output |
|
|
269
|
+
| **sans-I/O** | `Decider`, `Specification`, `AggregateRoot` contain zero I/O; all side effects are injected |
|
|
270
|
+
| **CQRS** | `Command` / `CommandHandler` / `CommandBus` are fully separate from `Query` / `QueryHandler` / `QueryBus` |
|
|
271
|
+
| **Event Sourcing** | `Decider` + `EventStore` + `Repository` reconstruct state by replaying `DomainEvent[]` |
|
|
272
|
+
| **ISP (SOLID)** | `EventBus` is split into `EventProducer` and `EventConsumer`; `Database` into `Executable` and `QueryAble` |
|
|
273
|
+
| **OCP (SOLID)** | `CommandBus` / `QueryBus` register handlers without modifying the bus itself |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arts-n-crafts/ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.1",
|
|
4
4
|
"workspaces": [
|
|
5
5
|
"packages/*"
|
|
6
6
|
],
|
|
@@ -16,33 +16,27 @@
|
|
|
16
16
|
"main": "./dist/index.cjs",
|
|
17
17
|
"module": "./dist/index.js",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@commitlint/
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"@vitest/ui": "^4.0.16",
|
|
29
|
-
"changelogen": "^0.6.2",
|
|
30
|
-
"commitizen": "^4.3.1",
|
|
19
|
+
"@arethetypeswrong/cli": "^0.18.4",
|
|
20
|
+
"@commitlint/cli": "^21.1.0",
|
|
21
|
+
"@commitlint/config-conventional": "^21.1.0",
|
|
22
|
+
"@release-it/bumper": "^7.0.6",
|
|
23
|
+
"@release-it/conventional-changelog": "^11.0.1",
|
|
24
|
+
"@types/bun": "^1.3.14",
|
|
25
|
+
"@vitest/coverage-istanbul": "^4.1.9",
|
|
26
|
+
"@vitest/ui": "^4.1.9",
|
|
27
|
+
"commitizen": "^4.3.2",
|
|
31
28
|
"cz-conventional-changelog": "^3.3.0",
|
|
32
|
-
"
|
|
33
|
-
"globals": "^16.5.0",
|
|
29
|
+
"globals": "^17.7.0",
|
|
34
30
|
"husky": "^9.1.7",
|
|
35
31
|
"oxide.ts": "^1.1.0",
|
|
36
|
-
"release-it": "^
|
|
37
|
-
"
|
|
38
|
-
"rimraf": "^6.1.2",
|
|
32
|
+
"release-it": "^20.2.0",
|
|
33
|
+
"rimraf": "^6.1.3",
|
|
39
34
|
"tsup": "^8.5.1",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"vitest": "^4.0.16"
|
|
35
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
36
|
+
"vitest": "^4.1.9"
|
|
43
37
|
},
|
|
44
38
|
"peerDependencies": {
|
|
45
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^6.0.3"
|
|
46
40
|
},
|
|
47
41
|
"exports": {
|
|
48
42
|
".": {
|
|
@@ -75,11 +69,102 @@
|
|
|
75
69
|
"default": "./packages/v4/dist/index.cjs"
|
|
76
70
|
}
|
|
77
71
|
},
|
|
72
|
+
"./v5/module/adapters/outbound/capabilities": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./packages/v5/dist/adapters/outbound/capabilities/index.d.ts",
|
|
75
|
+
"default": "./packages/v5/dist/adapters/outbound/capabilities/index.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./packages/v5/dist/adapters/outbound/capabilities/index.d.cts",
|
|
79
|
+
"default": "./packages/v5/dist/adapters/outbound/capabilities/index.cjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./v5/module/adapters/outbound/shapes": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./packages/v5/dist/adapters/outbound/shapes/index.d.ts",
|
|
85
|
+
"default": "./packages/v5/dist/adapters/outbound/shapes/index.js"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./packages/v5/dist/adapters/outbound/shapes/index.d.cts",
|
|
89
|
+
"default": "./packages/v5/dist/adapters/outbound/shapes/index.cjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"./v5/module/core/capabilities": {
|
|
93
|
+
"import": {
|
|
94
|
+
"types": "./packages/v5/dist/core/capabilities/index.d.ts",
|
|
95
|
+
"default": "./packages/v5/dist/core/capabilities/index.js"
|
|
96
|
+
},
|
|
97
|
+
"require": {
|
|
98
|
+
"types": "./packages/v5/dist/core/capabilities/index.d.cts",
|
|
99
|
+
"default": "./packages/v5/dist/core/capabilities/index.cjs"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"./v5/module/core/shapes": {
|
|
103
|
+
"import": {
|
|
104
|
+
"types": "./packages/v5/dist/core/shapes/index.d.ts",
|
|
105
|
+
"default": "./packages/v5/dist/core/shapes/index.js"
|
|
106
|
+
},
|
|
107
|
+
"require": {
|
|
108
|
+
"types": "./packages/v5/dist/core/shapes/index.d.cts",
|
|
109
|
+
"default": "./packages/v5/dist/core/shapes/index.cjs"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"./v5/module/useCases/command/capabilities": {
|
|
113
|
+
"import": {
|
|
114
|
+
"types": "./packages/v5/dist/useCases/command/capabilities/index.d.ts",
|
|
115
|
+
"default": "./packages/v5/dist/useCases/command/capabilities/index.js"
|
|
116
|
+
},
|
|
117
|
+
"require": {
|
|
118
|
+
"types": "./packages/v5/dist/useCases/command/capabilities/index.d.cts",
|
|
119
|
+
"default": "./packages/v5/dist/useCases/command/capabilities/index.cjs"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"./v5/module/useCases/command/shapes": {
|
|
123
|
+
"import": {
|
|
124
|
+
"types": "./packages/v5/dist/useCases/command/shapes/index.d.ts",
|
|
125
|
+
"default": "./packages/v5/dist/useCases/command/shapes/index.js"
|
|
126
|
+
},
|
|
127
|
+
"require": {
|
|
128
|
+
"types": "./packages/v5/dist/useCases/command/shapes/index.d.cts",
|
|
129
|
+
"default": "./packages/v5/dist/useCases/command/shapes/index.cjs"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"./v5/module/useCases/policy/capabilities": {
|
|
133
|
+
"import": {
|
|
134
|
+
"types": "./packages/v5/dist/useCases/policy/capabilities/index.d.ts",
|
|
135
|
+
"default": "./packages/v5/dist/useCases/policy/capabilities/index.js"
|
|
136
|
+
},
|
|
137
|
+
"require": {
|
|
138
|
+
"types": "./packages/v5/dist/useCases/policy/capabilities/index.d.cts",
|
|
139
|
+
"default": "./packages/v5/dist/useCases/policy/capabilities/index.cjs"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"./v5/module/useCases/query/capabilities": {
|
|
143
|
+
"import": {
|
|
144
|
+
"types": "./packages/v5/dist/useCases/query/capabilities/index.d.ts",
|
|
145
|
+
"default": "./packages/v5/dist/useCases/query/capabilities/index.js"
|
|
146
|
+
},
|
|
147
|
+
"require": {
|
|
148
|
+
"types": "./packages/v5/dist/useCases/query/capabilities/index.d.cts",
|
|
149
|
+
"default": "./packages/v5/dist/useCases/query/capabilities/index.cjs"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"./v5/module/useCases/query/shapes": {
|
|
153
|
+
"import": {
|
|
154
|
+
"types": "./packages/v5/dist/useCases/query/shapes/index.d.ts",
|
|
155
|
+
"default": "./packages/v5/dist/useCases/query/shapes/index.js"
|
|
156
|
+
},
|
|
157
|
+
"require": {
|
|
158
|
+
"types": "./packages/v5/dist/useCases/query/shapes/index.d.cts",
|
|
159
|
+
"default": "./packages/v5/dist/useCases/query/shapes/index.cjs"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
78
162
|
"./package.json": "./package.json"
|
|
79
163
|
},
|
|
80
164
|
"files": [
|
|
81
165
|
"packages/v3/dist",
|
|
82
166
|
"packages/v4/dist",
|
|
167
|
+
"packages/v5/dist",
|
|
83
168
|
"package.json",
|
|
84
169
|
"README.md",
|
|
85
170
|
"LICENSE"
|
|
@@ -93,6 +178,8 @@
|
|
|
93
178
|
"coverage": "bun run --workspaces coverage",
|
|
94
179
|
"lint": "bun run --workspaces lint",
|
|
95
180
|
"lint:fix": "bun run --workspaces lint:fix",
|
|
181
|
+
"fmt": "bun run --workspaces fmt",
|
|
182
|
+
"fmt:check": "bun run --workspaces fmt:check",
|
|
96
183
|
"typecheck": "bun run --workspaces typecheck",
|
|
97
184
|
"check-exports": "attw --pack . --profile node16"
|
|
98
185
|
},
|