@fluojs/cqrs 1.0.0-beta.3 → 1.0.0-beta.5
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.ko.md +13 -1
- package/README.md +13 -1
- package/dist/decorators.js +2 -2
- package/dist/discovery.d.ts +15 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +19 -0
- package/dist/module.d.ts +2 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +1 -1
- package/dist/status.d.ts +15 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +19 -0
- package/package.json +5 -5
package/README.ko.md
CHANGED
|
@@ -106,7 +106,7 @@ class UserSaga implements ISaga<UserCreatedEvent> {
|
|
|
106
106
|
}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Saga 실행은 같은 프로세스 안에서 동일 saga route로 순환 재진입하거나 중첩 hop 수가 32를 넘으면 `SagaTopologyError`로 즉시 실패합니다. 서로 다른 이벤트 단계를 순차 처리하는 multi-stage saga는 계속 허용되지만, in-process saga graph 전체는 비순환(acyclic) 구조를 유지해야 하며, 의도적인 순환/피드백 루프나 더 긴 체인은 외부 transport, scheduler, 또는 다른 bounded boundary 뒤로 이동해야 합니다.
|
|
110
110
|
|
|
111
111
|
### Event 발행 계약
|
|
112
112
|
|
|
@@ -116,6 +116,8 @@ class UserSaga implements ISaga<UserCreatedEvent> {
|
|
|
116
116
|
|
|
117
117
|
Event class는 payload state를 clone 가능하고 enumerable하게 유지해야 합니다. 문자열 key와 symbol key를 가진 enumerable payload field는 shared core clone fallback으로 보존되지만, 열린 socket, function, process-local handle처럼 의도적으로 clone할 수 없는 resource는 발행 전에 ID나 다른 serializable boundary로 표현해야 합니다.
|
|
118
118
|
|
|
119
|
+
CQRS handler, event handler, saga는 singleton provider에서만 discovery됩니다. Non-singleton registration은 경고와 함께 건너뜁니다.
|
|
120
|
+
|
|
119
121
|
### 심볼 토큰
|
|
120
122
|
|
|
121
123
|
CQRS 버스에 명시적인 Symbol 토큰이 필요하면 다음 익스포트를 사용할 수 있습니다.
|
|
@@ -134,6 +136,7 @@ class TokenInjectedService {
|
|
|
134
136
|
|
|
135
137
|
### 모듈 및 프로바이더
|
|
136
138
|
- `CqrsModule.forRoot(options)`: 메인 진입점입니다. 버스를 등록하고 탐색을 시작합니다.
|
|
139
|
+
- Module option은 명시적인 `commandHandlers`, `queryHandlers`, `eventHandlers`, `sagas`, 위임 `eventBus` option을 받을 수 있습니다.
|
|
137
140
|
- `CommandBusLifecycleService`: Command 실행을 위한 기본 서비스입니다.
|
|
138
141
|
- `QueryBusLifecycleService`: Query 실행을 위한 기본 서비스입니다.
|
|
139
142
|
- `CqrsEventBusService`: Event 발행을 위한 기본 서비스입니다.
|
|
@@ -149,8 +152,15 @@ class TokenInjectedService {
|
|
|
149
152
|
- `ICommandHandler<C, R>`, `IQueryHandler<Q, R>`, `IEventHandler<E>`, `ISaga<E>`: 핸들러 계약입니다.
|
|
150
153
|
|
|
151
154
|
### 오류
|
|
155
|
+
- `CommandHandlerNotFoundException`, `QueryHandlerNotFoundException`: bus에 일치하는 handler가 없을 때 발생합니다.
|
|
156
|
+
- `DuplicateCommandHandlerError`, `DuplicateQueryHandlerError`, `DuplicateEventHandlerError`: 중복 handler registration에서 발생합니다.
|
|
157
|
+
- `SagaExecutionError`: 예상하지 못한 non-Fluo saga 실패를 감쌉니다.
|
|
152
158
|
- `SagaTopologyError`: 자기 트리거, 순환, 또는 과도하게 깊은 in-process saga graph를 감지했을 때 발생합니다.
|
|
153
159
|
|
|
160
|
+
### status와 metadata
|
|
161
|
+
- `createCqrsPlatformStatusSnapshot(...)`: diagnostics와 health surface를 위한 CQRS status snapshot을 생성합니다.
|
|
162
|
+
- command, query, event, saga registration을 검사해야 하는 framework package를 위해 metadata helper와 symbol이 export됩니다.
|
|
163
|
+
|
|
154
164
|
## 관련 패키지
|
|
155
165
|
|
|
156
166
|
- `@fluojs/event-bus`: `CqrsEventBusService`에서 사용하는 하위 이벤트 분산 패키지입니다.
|
|
@@ -160,3 +170,5 @@ class TokenInjectedService {
|
|
|
160
170
|
|
|
161
171
|
- `packages/cqrs/src/module.test.ts`: 모듈 등록 및 기본 버스 사용 예제.
|
|
162
172
|
- `packages/cqrs/src/public-api.test.ts`: 루트 배럴 공개 API 계약 검증 예제.
|
|
173
|
+
- `packages/cqrs/src/status.test.ts`: CQRS status snapshot 동작 테스트 예제.
|
|
174
|
+
- `packages/cqrs/src/event-clone.test.ts`: event clone fallback 동작 테스트 예제.
|
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ class UserSaga implements ISaga<UserCreatedEvent> {
|
|
|
106
106
|
}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Saga execution
|
|
109
|
+
Saga execution fails fast with `SagaTopologyError` when an in-process publish chain re-enters the same saga route cyclically or exceeds 32 nested saga hops. Multi-stage sagas may still react to different event types in sequence, but in-process saga graphs must stay acyclic overall; move intentionally cyclic or long-running feedback loops behind an external transport, scheduler, or other bounded boundary.
|
|
110
110
|
|
|
111
111
|
### Event Publishing Contracts
|
|
112
112
|
|
|
@@ -116,6 +116,8 @@ Each CQRS event handler and saga receives an isolated event copy with the matche
|
|
|
116
116
|
|
|
117
117
|
Event classes should keep their payload state cloneable and enumerable. String-keyed and symbol-keyed enumerable payload fields are preserved by the shared core clone fallback, while intentionally non-cloneable resources such as open sockets, functions, or process-local handles should be represented by IDs or other serializable boundaries before publishing.
|
|
118
118
|
|
|
119
|
+
CQRS handlers, event handlers, and sagas are discovered only on singleton providers. Non-singleton registrations are skipped with warnings.
|
|
120
|
+
|
|
119
121
|
### Symbol Tokens
|
|
120
122
|
|
|
121
123
|
Use these exports when you want explicit symbol tokens for the CQRS buses:
|
|
@@ -134,6 +136,7 @@ class TokenInjectedService {
|
|
|
134
136
|
|
|
135
137
|
### Modules & Providers
|
|
136
138
|
- `CqrsModule.forRoot(options)`: Main entry point. Registers buses and starts discovery.
|
|
139
|
+
- Module options can provide explicit `commandHandlers`, `queryHandlers`, `eventHandlers`, `sagas`, and delegated `eventBus` options.
|
|
137
140
|
- `CommandBusLifecycleService`: Primary service for executing commands.
|
|
138
141
|
- `QueryBusLifecycleService`: Primary service for executing queries.
|
|
139
142
|
- `CqrsEventBusService`: Primary service for publishing events.
|
|
@@ -149,8 +152,15 @@ class TokenInjectedService {
|
|
|
149
152
|
- `ICommandHandler<C, R>`, `IQueryHandler<Q, R>`, `IEventHandler<E>`, `ISaga<E>`: Handler contracts.
|
|
150
153
|
|
|
151
154
|
### Errors
|
|
155
|
+
- `CommandHandlerNotFoundException`, `QueryHandlerNotFoundException`: Raised when a bus has no matching handler.
|
|
156
|
+
- `DuplicateCommandHandlerError`, `DuplicateQueryHandlerError`, `DuplicateEventHandlerError`: Raised for duplicate handler registrations.
|
|
157
|
+
- `SagaExecutionError`: Wraps unexpected non-Fluo saga failures.
|
|
152
158
|
- `SagaTopologyError`: Raised when saga orchestration detects a self-triggering, cyclic, or over-deep in-process saga graph.
|
|
153
159
|
|
|
160
|
+
### Status and metadata
|
|
161
|
+
- `createCqrsPlatformStatusSnapshot(...)`: Creates CQRS status snapshots for diagnostics and health surfaces.
|
|
162
|
+
- Metadata helpers and symbols are exported for framework packages that need to inspect command, query, event, or saga registrations.
|
|
163
|
+
|
|
154
164
|
## Related Packages
|
|
155
165
|
|
|
156
166
|
- `@fluojs/event-bus`: Underlying event distribution used by `CqrsEventBusService`.
|
|
@@ -160,3 +170,5 @@ class TokenInjectedService {
|
|
|
160
170
|
|
|
161
171
|
- `packages/cqrs/src/module.test.ts`: Module registration and basic bus usage.
|
|
162
172
|
- `packages/cqrs/src/public-api.test.ts`: Root-barrel public API contract coverage.
|
|
173
|
+
- `packages/cqrs/src/status.test.ts`: CQRS status snapshot behavior.
|
|
174
|
+
- `packages/cqrs/src/event-clone.test.ts`: Event clone fallback behavior.
|
package/dist/decorators.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureMetadataSymbol } from '@fluojs/core/internal';
|
|
2
2
|
import { commandHandlerMetadataSymbol, eventHandlerMetadataSymbol, queryHandlerMetadataSymbol, sagaMetadataSymbol } from './metadata.js';
|
|
3
|
+
ensureMetadataSymbol();
|
|
3
4
|
function getStandardMetadataBag(metadata) {
|
|
4
|
-
void metadataSymbol;
|
|
5
5
|
if (typeof metadata !== 'object' || metadata === null) {
|
|
6
6
|
throw new Error('Decorator metadata is unavailable. Ensure standard decorators are enabled.');
|
|
7
7
|
}
|
package/dist/discovery.d.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { type Token } from '@fluojs/core';
|
|
2
2
|
import type { Container } from '@fluojs/di';
|
|
3
3
|
import type { ApplicationLogger, CompiledModule } from '@fluojs/runtime';
|
|
4
|
+
/**
|
|
5
|
+
* Describes the discovery candidate contract.
|
|
6
|
+
*/
|
|
4
7
|
export interface DiscoveryCandidate {
|
|
5
8
|
moduleName: string;
|
|
6
9
|
scope: 'request' | 'singleton' | 'transient';
|
|
7
10
|
targetType: Function;
|
|
8
11
|
token: Token;
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Create duplicate handler message.
|
|
15
|
+
*
|
|
16
|
+
* @param kind The kind.
|
|
17
|
+
* @param messageType The message type.
|
|
18
|
+
* @param first The first.
|
|
19
|
+
* @param second The second.
|
|
20
|
+
* @returns The create duplicate handler message result.
|
|
21
|
+
*/
|
|
10
22
|
export declare function createDuplicateHandlerMessage(kind: 'command' | 'query' | 'event', messageType: Function, first: {
|
|
11
23
|
moduleName: string;
|
|
12
24
|
targetType: Function;
|
|
@@ -14,6 +26,9 @@ export declare function createDuplicateHandlerMessage(kind: 'command' | 'query'
|
|
|
14
26
|
moduleName: string;
|
|
15
27
|
targetType: Function;
|
|
16
28
|
}): string;
|
|
29
|
+
/**
|
|
30
|
+
* Represents the cqrs bus base.
|
|
31
|
+
*/
|
|
17
32
|
export declare abstract class CqrsBusBase {
|
|
18
33
|
protected readonly runtimeContainer: Container;
|
|
19
34
|
protected readonly compiledModules: readonly CompiledModule[];
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;IAC7C,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;CACd;AAkBD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,EACnC,WAAW,EAAE,QAAQ,EACrB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,QAAQ,CAAA;CAAE,EACnD,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,QAAQ,CAAA;CAAE,GACnD,MAAM,CAER;AAED,8BAAsB,WAAW;IAI7B,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,SAAS;IAC9C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE;IAC7D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB;IAL9C,SAAS,CAAC,QAAQ,CAAC,gBAAgB,+BAAsC;gBAGpD,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,MAAM,EAAE,iBAAiB;IAG9C,SAAS,CAAC,mBAAmB,IAAI,kBAAkB,EAAE;cAsCrC,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,iBAAiB;IAG9C,SAAS,CAAC,mBAAmB,IAAI,kBAAkB,EAAE;cAsCrC,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;cAgBnD,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAiBvE"}
|
package/dist/discovery.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { getClassDiMetadata } from '@fluojs/core/internal';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes the discovery candidate contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
2
7
|
function scopeFromProvider(provider) {
|
|
3
8
|
if (typeof provider === 'function') {
|
|
4
9
|
return getClassDiMetadata(provider)?.scope ?? 'singleton';
|
|
@@ -11,9 +16,23 @@ function scopeFromProvider(provider) {
|
|
|
11
16
|
function isClassProvider(provider) {
|
|
12
17
|
return typeof provider === 'object' && provider !== null && 'useClass' in provider;
|
|
13
18
|
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create duplicate handler message.
|
|
22
|
+
*
|
|
23
|
+
* @param kind The kind.
|
|
24
|
+
* @param messageType The message type.
|
|
25
|
+
* @param first The first.
|
|
26
|
+
* @param second The second.
|
|
27
|
+
* @returns The create duplicate handler message result.
|
|
28
|
+
*/
|
|
14
29
|
export function createDuplicateHandlerMessage(kind, messageType, first, second) {
|
|
15
30
|
return `Duplicate ${kind} handler for ${messageType.name} was discovered in ${first.moduleName}.${first.targetType.name} and ${second.moduleName}.${second.targetType.name}.`;
|
|
16
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the cqrs bus base.
|
|
35
|
+
*/
|
|
17
36
|
export class CqrsBusBase {
|
|
18
37
|
handlerInstances = new Map();
|
|
19
38
|
constructor(runtimeContainer, compiledModules, logger) {
|
package/dist/module.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface CqrsModuleOptions {
|
|
|
7
7
|
commandHandlers?: readonly CommandHandlerClass[];
|
|
8
8
|
eventBus?: EventBusModuleOptions;
|
|
9
9
|
eventHandlers?: readonly EventHandlerClass[];
|
|
10
|
+
/** Whether CQRS bus providers should be visible globally. Defaults to `true`. */
|
|
11
|
+
global?: boolean;
|
|
10
12
|
queryHandlers?: readonly QueryHandlerClass[];
|
|
11
13
|
sagas?: readonly SagaClass[];
|
|
12
14
|
}
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOhE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAIjB,iBAAiB,EACjB,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC9B;AAwBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,iBAAsB,GAAG,QAAQ,EAAE,CA8B/E;AAED,iFAAiF;AACjF,qBAAa,UAAU;IACrB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU;CAiB5D"}
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOhE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAIjB,iBAAiB,EACjB,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC9B;AAwBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,iBAAsB,GAAG,QAAQ,EAAE,CA8B/E;AAED,iFAAiF;AACjF,qBAAa,UAAU;IACrB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU;CAiB5D"}
|
package/dist/module.js
CHANGED
|
@@ -66,7 +66,7 @@ export class CqrsModule {
|
|
|
66
66
|
class CqrsModuleDefinition {}
|
|
67
67
|
return defineModule(CqrsModuleDefinition, {
|
|
68
68
|
exports: [CommandBusLifecycleService, QueryBusLifecycleService, CqrsEventBusService, COMMAND_BUS, QUERY_BUS, EVENT_BUS],
|
|
69
|
-
global: true,
|
|
69
|
+
global: options.global ?? true,
|
|
70
70
|
imports: [EventBusModule.forRoot(options.eventBus)],
|
|
71
71
|
providers: createCqrsProviders(options)
|
|
72
72
|
});
|
package/dist/status.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { PlatformHealthReport, PlatformReadinessReport, PlatformSnapshot } from '@fluojs/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the cqrs lifecycle state type.
|
|
4
|
+
*/
|
|
2
5
|
export type CqrsLifecycleState = 'created' | 'discovering' | 'ready' | 'stopping' | 'stopped' | 'failed';
|
|
6
|
+
/**
|
|
7
|
+
* Describes the cqrs status adapter input contract.
|
|
8
|
+
*/
|
|
3
9
|
export interface CqrsStatusAdapterInput {
|
|
4
10
|
eventHandlersDiscovered: number;
|
|
5
11
|
inFlightSagaExecutions: number;
|
|
@@ -7,11 +13,20 @@ export interface CqrsStatusAdapterInput {
|
|
|
7
13
|
sagaLifecycleState: CqrsLifecycleState;
|
|
8
14
|
sagasDiscovered: number;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Describes the cqrs platform status snapshot contract.
|
|
18
|
+
*/
|
|
10
19
|
export interface CqrsPlatformStatusSnapshot {
|
|
11
20
|
readiness: PlatformReadinessReport;
|
|
12
21
|
health: PlatformHealthReport;
|
|
13
22
|
ownership: PlatformSnapshot['ownership'];
|
|
14
23
|
details: Record<string, unknown>;
|
|
15
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Create cqrs platform status snapshot.
|
|
27
|
+
*
|
|
28
|
+
* @param input The input.
|
|
29
|
+
* @returns The create cqrs platform status snapshot result.
|
|
30
|
+
*/
|
|
16
31
|
export declare function createCqrsPlatformStatusSnapshot(input: CqrsStatusAdapterInput): CqrsPlatformStatusSnapshot;
|
|
17
32
|
//# sourceMappingURL=status.d.ts.map
|
package/dist/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvG,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,aAAa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C,CAAC;CAClC;AA4ED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,sBAAsB,GAAG,0BAA0B,CAiB1G"}
|
package/dist/status.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the cqrs lifecycle state type.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Describes the cqrs status adapter input contract.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Describes the cqrs platform status snapshot contract.
|
|
11
|
+
*/
|
|
12
|
+
|
|
1
13
|
function createReadiness(input) {
|
|
2
14
|
if (input.lifecycleState === 'ready' && input.sagaLifecycleState === 'ready') {
|
|
3
15
|
return {
|
|
@@ -49,6 +61,13 @@ function createHealth(input) {
|
|
|
49
61
|
status: 'healthy'
|
|
50
62
|
};
|
|
51
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Create cqrs platform status snapshot.
|
|
67
|
+
*
|
|
68
|
+
* @param input The input.
|
|
69
|
+
* @returns The create cqrs platform status snapshot result.
|
|
70
|
+
*/
|
|
52
71
|
export function createCqrsPlatformStatusSnapshot(input) {
|
|
53
72
|
return {
|
|
54
73
|
details: {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"saga",
|
|
10
10
|
"event-sourcing"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.5",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.0-beta.
|
|
40
|
-
"@fluojs/di": "^1.0.0-beta.
|
|
41
|
-
"@fluojs/event-bus": "^1.0.0-beta.
|
|
42
|
-
"@fluojs/runtime": "^1.0.0-beta.
|
|
39
|
+
"@fluojs/core": "^1.0.0-beta.4",
|
|
40
|
+
"@fluojs/di": "^1.0.0-beta.6",
|
|
41
|
+
"@fluojs/event-bus": "^1.0.0-beta.5",
|
|
42
|
+
"@fluojs/runtime": "^1.0.0-beta.11"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vitest": "^3.2.4"
|