@hexaijs/core 0.3.0 → 0.4.0

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 CHANGED
@@ -190,35 +190,6 @@ Propagation.EXISTING // Use existing transaction (error if none)
190
190
  Propagation.NESTED // Nested transaction (savepoint)
191
191
  ```
192
192
 
193
- ### QueryableUnitOfWork
194
-
195
- Extends `UnitOfWork` with a `query()` method for executing read operations without transaction overhead.
196
-
197
- ```typescript
198
- import { QueryableUnitOfWork } from "@hexaijs/core";
199
-
200
- interface OrderApplicationContext {
201
- getUnitOfWork(): QueryableUnitOfWork;
202
- getOrderRepository(): OrderRepository;
203
- }
204
-
205
- // Execute a query without transaction overhead
206
- const user = await unitOfWork.query(async (client) => {
207
- return await userRepo.findById(client, userId);
208
- });
209
- ```
210
-
211
- **When to use `wrap()` vs `query()`:**
212
-
213
- | Method | Transaction | Use Case |
214
- |--------|-------------|----------|
215
- | `wrap()` | Yes (BEGIN/COMMIT) | Commands that modify state |
216
- | `query()` | No (autocommit) | Read-only queries |
217
-
218
- The `query()` method is context-aware:
219
- - **Outside transaction**: Acquires a new connection, executes, then releases
220
- - **Inside transaction**: Reuses the existing transaction's client
221
-
222
193
  ### EventStore
223
194
 
224
195
  Interface for event sourcing scenarios. Stores and retrieves events by position.
@@ -292,7 +263,6 @@ throw new DuplicateObjectError("Order with this ID already exists");
292
263
  | `Identifiable<T>` | Interface for entities with identity |
293
264
  | `Repository<T>` | Interface for aggregate persistence |
294
265
  | `UnitOfWork` | Interface for transaction management |
295
- | `QueryableUnitOfWork` | UnitOfWork with `query()` for non-transactional reads |
296
266
  | `Propagation` | Enum for transaction propagation modes |
297
267
  | `EventStore` | Interface for event store implementations |
298
268
 
@@ -1,4 +1,4 @@
1
- import { Message } from "../message";
1
+ import { Message } from "@/message";
2
2
  export declare class DomainEvent<P extends Record<string, any> = Record<string, unknown>> extends Message<P> {
3
3
  static getIntent(): string;
4
4
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DomainEvent = void 0;
4
- const message_1 = require("../message");
4
+ const message_1 = require("@/message");
5
5
  class DomainEvent extends message_1.Message {
6
6
  static getIntent() {
7
7
  return "event";
@@ -1,4 +1,4 @@
1
- import { Message, MessageHeaders } from "../message";
1
+ import { Message, MessageHeaders } from "@/message";
2
2
  export declare class DummyMessage extends Message<Record<never, never>> {
3
3
  static type: string;
4
4
  static create(): DummyMessage;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DummyMessage = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
- const message_1 = require("../message");
8
+ const message_1 = require("@/message");
9
9
  class DummyMessage extends message_1.Message {
10
10
  static type = "test.dummy-message";
11
11
  static create() {
@@ -1,5 +1,5 @@
1
- import { EventStore, EventStoreFetchResult, StoredEvent } from "../event-store";
2
- import { Message } from "../message";
1
+ import { EventStore, EventStoreFetchResult, StoredEvent } from "@/event-store";
2
+ import { Message } from "@/message";
3
3
  export declare class InMemoryEventStore implements EventStore {
4
4
  private events;
5
5
  store(event: Message): Promise<StoredEvent>;
@@ -1,4 +1,4 @@
1
- import { Message, MessageClass } from "../message";
1
+ import { Message, MessageClass } from "@/message";
2
2
  export declare function expectMessagesToBeFullyEqual(messages: Message[], expectedMessages: Message[]): void;
3
3
  export declare function expectMessagesToContain(messages: Message[], expectedMessages: Message[]): void;
4
4
  export declare function expectMessageToMatch(messages: Message[], messageType: string | MessageClass<any>, payload?: Record<string, unknown>): void;
@@ -10,7 +10,4 @@ export interface UnitOfWork<Client = unknown, Options extends BaseUnitOfWorkOpti
10
10
  getClient(): Client;
11
11
  wrap<T>(fn: (client: Client) => Promise<T>, options?: Partial<Options>): Promise<T>;
12
12
  }
13
- export interface QueryableUnitOfWork<Client = unknown, Options extends BaseUnitOfWorkOptions = BaseUnitOfWorkOptions> extends UnitOfWork<Client, Options> {
14
- query<T>(fn: (client: Client) => Promise<T>): Promise<T>;
15
- }
16
13
  //# sourceMappingURL=unit-of-work.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unit-of-work.d.ts","sourceRoot":"","sources":["../src/unit-of-work.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU,CACvB,MAAM,GAAG,OAAO,EAChB,OAAO,SAAS,qBAAqB,GAAG,qBAAqB;IAE7D,SAAS,IAAI,MAAM,CAAC;IACpB,IAAI,CAAC,CAAC,EACF,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB,CAChC,MAAM,GAAG,OAAO,EAChB,OAAO,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;IACjC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC5D"}
1
+ {"version":3,"file":"unit-of-work.d.ts","sourceRoot":"","sources":["../src/unit-of-work.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU,CACvB,MAAM,GAAG,OAAO,EAChB,OAAO,SAAS,qBAAqB,GAAG,qBAAqB;IAE7D,SAAS,IAAI,MAAM,CAAC;IACpB,IAAI,CAAC,CAAC,EACF,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,CAAC,CAAC,CAAC;CACjB"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.0",
6
+ "version": "0.4.0",
7
7
  "description": "Core utilities/types/base classes for hexai projects",
8
8
  "license": "MIT",
9
9
  "author": "Sangwoo Hyun <wkdny.hyun@gmail.com>",
@@ -20,7 +20,15 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/workingdanny911/hexai/issues"
22
22
  },
23
- "keywords": ["hexai", "hexagonal", "clean-architecture", "ddd", "cqrs", "typescript", "event-sourcing"],
23
+ "keywords": [
24
+ "hexai",
25
+ "hexagonal",
26
+ "clean-architecture",
27
+ "ddd",
28
+ "cqrs",
29
+ "typescript",
30
+ "event-sourcing"
31
+ ],
24
32
  "files": [
25
33
  "dist",
26
34
  "LICENSE"
@@ -40,7 +48,8 @@
40
48
  },
41
49
  "scripts": {
42
50
  "test": "vitest run",
43
- "build": "tsc -p ./tsconfig.build.json && tsc-alias"
51
+ "build": "pnpm clean && tsc -p ./tsconfig.build.json && tsc-alias",
52
+ "clean": "rm -rf dist"
44
53
  },
45
54
  "dependencies": {
46
55
  "lodash": "^4.17.21",