@ddd-ts-kit/drizzle 0.82.0 → 0.83.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.fr.md +16 -8
- package/README.md +15 -7
- package/package.json +5 -5
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:818100938a696ac7 -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/drizzle
|
|
5
5
|
|
|
@@ -179,17 +179,25 @@ Côté domaine, un agrégat qui ne sait rien des lignes, et son port :
|
|
|
179
179
|
|
|
180
180
|
<!-- checked sample -->
|
|
181
181
|
```ts
|
|
182
|
-
|
|
183
|
-
import { AggregateRoot, ConceptError, Repository } from '@ddd-ts-kit/kernel';
|
|
182
|
+
import { AggregateRoot, DomainRefusal, Repository } from '@ddd-ts-kit/kernel';
|
|
184
183
|
|
|
185
|
-
|
|
184
|
+
// contexts/order-management/domain/errors/codes.ts
|
|
185
|
+
export const OrderManagementCodes = {
|
|
186
|
+
OrderAlreadyPlaced: 'ORDER_ALREADY_PLACED',
|
|
187
|
+
} as const;
|
|
188
|
+
|
|
189
|
+
// contexts/order-management/domain/errors/order-already-placed.error.ts
|
|
190
|
+
export class OrderAlreadyPlaced extends DomainRefusal {
|
|
191
|
+
readonly code = OrderManagementCodes.OrderAlreadyPlaced;
|
|
186
192
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return OrderError.refusal('ORDER_ALREADY_PLACED', `Order ${orderId} is already placed.`, { orderId });
|
|
193
|
+
static forOrder(orderId: string) {
|
|
194
|
+
return OrderAlreadyPlaced.refusal(`Order ${orderId} is already placed.`, { orderId });
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
|
|
198
|
+
// contexts/order-management/domain/order.aggregate.ts
|
|
199
|
+
export type OrderStatus = 'open' | 'placed';
|
|
200
|
+
|
|
193
201
|
export class Order extends AggregateRoot {
|
|
194
202
|
private constructor(
|
|
195
203
|
id: string,
|
|
@@ -213,7 +221,7 @@ export class Order extends AggregateRoot {
|
|
|
213
221
|
|
|
214
222
|
place(): void {
|
|
215
223
|
if (this.status === 'placed') {
|
|
216
|
-
throw
|
|
224
|
+
throw OrderAlreadyPlaced.forOrder(this.id);
|
|
217
225
|
}
|
|
218
226
|
|
|
219
227
|
this.status = 'placed';
|
package/README.md
CHANGED
|
@@ -171,17 +171,25 @@ The domain side, an aggregate that knows nothing of rows, and its port:
|
|
|
171
171
|
|
|
172
172
|
<!-- checked sample -->
|
|
173
173
|
```ts
|
|
174
|
-
|
|
175
|
-
import { AggregateRoot, ConceptError, Repository } from '@ddd-ts-kit/kernel';
|
|
174
|
+
import { AggregateRoot, DomainRefusal, Repository } from '@ddd-ts-kit/kernel';
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
// contexts/order-management/domain/errors/codes.ts
|
|
177
|
+
export const OrderManagementCodes = {
|
|
178
|
+
OrderAlreadyPlaced: 'ORDER_ALREADY_PLACED',
|
|
179
|
+
} as const;
|
|
180
|
+
|
|
181
|
+
// contexts/order-management/domain/errors/order-already-placed.error.ts
|
|
182
|
+
export class OrderAlreadyPlaced extends DomainRefusal {
|
|
183
|
+
readonly code = OrderManagementCodes.OrderAlreadyPlaced;
|
|
178
184
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return OrderError.refusal('ORDER_ALREADY_PLACED', `Order ${orderId} is already placed.`, { orderId });
|
|
185
|
+
static forOrder(orderId: string) {
|
|
186
|
+
return OrderAlreadyPlaced.refusal(`Order ${orderId} is already placed.`, { orderId });
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
|
|
190
|
+
// contexts/order-management/domain/order.aggregate.ts
|
|
191
|
+
export type OrderStatus = 'open' | 'placed';
|
|
192
|
+
|
|
185
193
|
export class Order extends AggregateRoot {
|
|
186
194
|
private constructor(
|
|
187
195
|
id: string,
|
|
@@ -205,7 +213,7 @@ export class Order extends AggregateRoot {
|
|
|
205
213
|
|
|
206
214
|
place(): void {
|
|
207
215
|
if (this.status === 'placed') {
|
|
208
|
-
throw
|
|
216
|
+
throw OrderAlreadyPlaced.forOrder(this.id);
|
|
209
217
|
}
|
|
210
218
|
|
|
211
219
|
this.status = 'placed';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/drizzle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.1",
|
|
4
4
|
"description": "Drizzle adapters for the kernel ports on PostgreSQL: unit of work, transactional outbox store, processed-event store, event store, background job store, process store, one schema per context.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ddd-ts-kit/kernel": "0.
|
|
43
|
-
"@ddd-ts-kit/events": "0.
|
|
44
|
-
"@ddd-ts-kit/scheduling": "0.
|
|
42
|
+
"@ddd-ts-kit/kernel": "0.83.1",
|
|
43
|
+
"@ddd-ts-kit/events": "0.83.1",
|
|
44
|
+
"@ddd-ts-kit/scheduling": "0.83.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"drizzle-orm": ">=0.40.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"drizzle-orm": "latest",
|
|
51
51
|
"@electric-sql/pglite": "0.5.9",
|
|
52
|
-
"@ddd-ts-kit/testing": "0.
|
|
52
|
+
"@ddd-ts-kit/testing": "0.83.1",
|
|
53
53
|
"pg": "^8.23.1",
|
|
54
54
|
"@types/pg": "^8.23.1"
|
|
55
55
|
}
|