@cratis/chronicle 6.48.0 → 6.49.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/EventStore.ts +8 -2
- package/IEventStore.ts +8 -0
- package/artifacts/DefaultClientArtifactsProvider.ts +5 -0
- package/artifacts/IClientArtifactsProvider.ts +3 -0
- package/connection/ChronicleConnection.ts +6 -0
- package/connection/ChronicleServices.ts +2 -0
- package/dist/EventStore.d.ts +2 -0
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +7 -2
- package/dist/EventStore.js.map +1 -1
- package/dist/IEventStore.d.ts +7 -0
- package/dist/IEventStore.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +2 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
- package/dist/artifacts/IClientArtifactsProvider.d.ts +2 -0
- package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.d.ts +1 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +5 -1
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleServices.d.ts +2 -1
- package/dist/connection/ChronicleServices.d.ts.map +1 -1
- package/dist/eventSequences/AppendOptions.d.ts +12 -0
- package/dist/eventSequences/AppendOptions.d.ts.map +1 -1
- package/dist/eventSequences/EventForEventSourceId.d.ts +11 -0
- package/dist/eventSequences/EventForEventSourceId.d.ts.map +1 -1
- package/dist/eventSequences/EventLog.d.ts +2 -1
- package/dist/eventSequences/EventLog.d.ts.map +1 -1
- package/dist/eventSequences/EventLog.js +2 -2
- package/dist/eventSequences/EventLog.js.map +1 -1
- package/dist/eventSequences/EventSequence.d.ts +4 -1
- package/dist/eventSequences/EventSequence.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +32 -6
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventSequences/ITransactionalEventSequence.d.ts +5 -2
- package/dist/eventSequences/ITransactionalEventSequence.d.ts.map +1 -1
- package/dist/eventSequences/TransactionalEventSequence.d.ts +3 -2
- package/dist/eventSequences/TransactionalEventSequence.d.ts.map +1 -1
- package/dist/eventSequences/TransactionalEventSequence.js +4 -4
- package/dist/eventSequences/TransactionalEventSequence.js.map +1 -1
- package/dist/eventSequences/resolveEventSourceRouting.d.ts +39 -0
- package/dist/eventSequences/resolveEventSourceRouting.d.ts.map +1 -0
- package/dist/eventSequences/resolveEventSourceRouting.js +92 -0
- package/dist/eventSequences/resolveEventSourceRouting.js.map +1 -0
- package/dist/eventSources/ConcurrencyDimensions.d.ts +19 -0
- package/dist/eventSources/ConcurrencyDimensions.d.ts.map +1 -0
- package/dist/eventSources/ConcurrencyDimensions.js +19 -0
- package/dist/eventSources/ConcurrencyDimensions.js.map +1 -0
- package/dist/eventSources/DuplicateEventSourceName.d.ts +6 -0
- package/dist/eventSources/DuplicateEventSourceName.d.ts.map +1 -0
- package/dist/eventSources/DuplicateEventSourceName.js +12 -0
- package/dist/eventSources/DuplicateEventSourceName.js.map +1 -0
- package/dist/eventSources/DuplicateEventStreamName.d.ts +7 -0
- package/dist/eventSources/DuplicateEventStreamName.d.ts.map +1 -0
- package/dist/eventSources/DuplicateEventStreamName.js +14 -0
- package/dist/eventSources/DuplicateEventStreamName.js.map +1 -0
- package/dist/eventSources/EventRoutingContradictsEventSource.d.ts +9 -0
- package/dist/eventSources/EventRoutingContradictsEventSource.d.ts.map +1 -0
- package/dist/eventSources/EventRoutingContradictsEventSource.js +18 -0
- package/dist/eventSources/EventRoutingContradictsEventSource.js.map +1 -0
- package/dist/eventSources/EventSourceDefinition.d.ts +20 -0
- package/dist/eventSources/EventSourceDefinition.d.ts.map +1 -0
- package/dist/eventSources/EventSourceDefinition.js +4 -0
- package/dist/eventSources/EventSourceDefinition.js.map +1 -0
- package/dist/eventSources/EventSources.d.ts +31 -0
- package/dist/eventSources/EventSources.d.ts.map +1 -0
- package/dist/eventSources/EventSources.js +90 -0
- package/dist/eventSources/EventSources.js.map +1 -0
- package/dist/eventSources/EventStreamDefinition.d.ts +13 -0
- package/dist/eventSources/EventStreamDefinition.d.ts.map +1 -0
- package/dist/eventSources/EventStreamDefinition.js +4 -0
- package/dist/eventSources/EventStreamDefinition.js.map +1 -0
- package/dist/eventSources/EventStreamDoesNotBelongToEventSource.d.ts +7 -0
- package/dist/eventSources/EventStreamDoesNotBelongToEventSource.d.ts.map +1 -0
- package/dist/eventSources/EventStreamDoesNotBelongToEventSource.js +14 -0
- package/dist/eventSources/EventStreamDoesNotBelongToEventSource.js.map +1 -0
- package/dist/eventSources/EventStreamRequiresEventSource.d.ts +6 -0
- package/dist/eventSources/EventStreamRequiresEventSource.d.ts.map +1 -0
- package/dist/eventSources/EventStreamRequiresEventSource.js +12 -0
- package/dist/eventSources/EventStreamRequiresEventSource.js.map +1 -0
- package/dist/eventSources/IEventSources.d.ts +27 -0
- package/dist/eventSources/IEventSources.d.ts.map +1 -0
- package/dist/eventSources/IEventSources.js +4 -0
- package/dist/eventSources/IEventSources.js.map +1 -0
- package/dist/eventSources/ResolvedEventRouting.d.ts +37 -0
- package/dist/eventSources/ResolvedEventRouting.d.ts.map +1 -0
- package/dist/eventSources/ResolvedEventRouting.js +60 -0
- package/dist/eventSources/ResolvedEventRouting.js.map +1 -0
- package/dist/eventSources/UnknownEventSource.d.ts +6 -0
- package/dist/eventSources/UnknownEventSource.d.ts.map +1 -0
- package/dist/eventSources/UnknownEventSource.js +12 -0
- package/dist/eventSources/UnknownEventSource.js.map +1 -0
- package/dist/eventSources/eventSource.d.ts +60 -0
- package/dist/eventSources/eventSource.d.ts.map +1 -0
- package/dist/eventSources/eventSource.js +72 -0
- package/dist/eventSources/eventSource.js.map +1 -0
- package/dist/eventSources/index.d.ts +17 -0
- package/dist/eventSources/index.d.ts.map +1 -0
- package/dist/eventSources/index.js +13 -0
- package/dist/eventSources/index.js.map +1 -0
- package/dist/events/EventContext.d.ts +5 -0
- package/dist/events/EventContext.d.ts.map +1 -1
- package/dist/events/WireEventContext.d.ts +2 -0
- package/dist/events/WireEventContext.d.ts.map +1 -1
- package/dist/events/toClientEventContext.d.ts.map +1 -1
- package/dist/events/toClientEventContext.js +1 -0
- package/dist/events/toClientEventContext.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/projections/eventContextPropertyExpression.d.ts.map +1 -1
- package/dist/projections/eventContextPropertyExpression.js +1 -0
- package/dist/projections/eventContextPropertyExpression.js.map +1 -1
- package/dist/testing/projections/ProjectionReadModelProcessor.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionReadModelProcessor.js +2 -1
- package/dist/testing/projections/ProjectionReadModelProcessor.js.map +1 -1
- package/dist/transactions/IUnitOfWork.d.ts +3 -1
- package/dist/transactions/IUnitOfWork.d.ts.map +1 -1
- package/dist/transactions/TransactionalEventRouting.d.ts +12 -0
- package/dist/transactions/TransactionalEventRouting.d.ts.map +1 -0
- package/dist/transactions/TransactionalEventRouting.js +4 -0
- package/dist/transactions/TransactionalEventRouting.js.map +1 -0
- package/dist/transactions/UnitOfWork.d.ts +2 -1
- package/dist/transactions/UnitOfWork.d.ts.map +1 -1
- package/dist/transactions/UnitOfWork.js +11 -2
- package/dist/transactions/UnitOfWork.js.map +1 -1
- package/dist/transactions/index.d.ts +1 -0
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/DecoratorType.d.ts +3 -1
- package/dist/types/DecoratorType.d.ts.map +1 -1
- package/dist/types/DecoratorType.js +2 -0
- package/dist/types/DecoratorType.js.map +1 -1
- package/eventSequences/AppendOptions.ts +14 -0
- package/eventSequences/EventForEventSourceId.ts +13 -0
- package/eventSequences/EventLog.ts +4 -2
- package/eventSequences/EventSequence.ts +33 -6
- package/eventSequences/ITransactionalEventSequence.ts +5 -2
- package/eventSequences/TransactionalEventSequence.ts +5 -4
- package/eventSequences/resolveEventSourceRouting.ts +125 -0
- package/eventSources/ConcurrencyDimensions.ts +26 -0
- package/eventSources/DuplicateEventSourceName.ts +10 -0
- package/eventSources/DuplicateEventStreamName.ts +10 -0
- package/eventSources/EventRoutingContradictsEventSource.ts +10 -0
- package/eventSources/EventSourceDefinition.ts +27 -0
- package/eventSources/EventSources.ts +93 -0
- package/eventSources/EventStreamDefinition.ts +18 -0
- package/eventSources/EventStreamDoesNotBelongToEventSource.ts +10 -0
- package/eventSources/EventStreamRequiresEventSource.ts +10 -0
- package/eventSources/IEventSources.ts +33 -0
- package/eventSources/ResolvedEventRouting.ts +78 -0
- package/eventSources/UnknownEventSource.ts +10 -0
- package/eventSources/eventSource.ts +116 -0
- package/eventSources/for_EventSources/against_a_kernel/when_appending_through_registered_sources.integration.spec.ts +106 -0
- package/eventSources/for_EventSources/when_appending_through_a_definition.spec.ts +190 -0
- package/eventSources/for_EventSources/when_batch_requires_differing_guards.spec.ts +139 -0
- package/eventSources/for_EventSources/when_discovering_and_registering.spec.ts +94 -0
- package/eventSources/index.ts +19 -0
- package/events/EventContext.ts +6 -0
- package/events/WireEventContext.ts +2 -0
- package/events/for_EventContext/with_event_source.spec.ts +22 -0
- package/events/toClientEventContext.ts +1 -0
- package/for_EventStore/when_implementing_a_legacy_event_store.spec.ts +19 -0
- package/index.ts +3 -0
- package/package.json +3 -3
- package/projections/eventContextPropertyExpression.ts +2 -1
- package/testing/EventScenario.event-sources.spec.ts +34 -0
- package/testing/projections/ProjectionReadModelProcessor.ts +2 -1
- package/transactions/IUnitOfWork.ts +3 -1
- package/transactions/TransactionalEventRouting.ts +16 -0
- package/transactions/UnitOfWork.ts +13 -2
- package/transactions/for_UnitOfWork/when_committing_events_with_event_source_routing.spec.ts +41 -0
- package/transactions/index.ts +1 -0
- package/types/DecoratorType.ts +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventRoutingContradictsEventSource.d.ts","sourceRoot":"","sources":["../../eventSources/EventRoutingContradictsEventSource.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,qBAAa,kCAAmC,SAAQ,KAAK;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAxH,YAAqB,WAAW,EAAE,MAAM,EAAW,SAAS,EAAE,MAAM,EAAW,QAAQ,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM,EAGvH;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown when explicit routing values contradict the event source definition. */
|
|
4
|
+
export class EventRoutingContradictsEventSource extends Error {
|
|
5
|
+
eventSource;
|
|
6
|
+
dimension;
|
|
7
|
+
expected;
|
|
8
|
+
actual;
|
|
9
|
+
constructor(eventSource, dimension, expected, actual) {
|
|
10
|
+
super(`The explicit ${dimension} '${actual}' contradicts the event source '${eventSource}', which requires '${expected}'.`);
|
|
11
|
+
this.eventSource = eventSource;
|
|
12
|
+
this.dimension = dimension;
|
|
13
|
+
this.expected = expected;
|
|
14
|
+
this.actual = actual;
|
|
15
|
+
this.name = 'EventRoutingContradictsEventSource';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=EventRoutingContradictsEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventRoutingContradictsEventSource.js","sourceRoot":"","sources":["../../eventSources/EventRoutingContradictsEventSource.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,kFAAkF;AAClF,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IACpC,WAAW;IAAmB,SAAS;IAAmB,QAAQ;IAAmB,MAAM;IAAhH,YAAqB,WAAmB,EAAW,SAAiB,EAAW,QAAgB,EAAW,MAAc;QACpH,KAAK,CAAC,gBAAgB,SAAS,KAAK,MAAM,mCAAmC,WAAW,sBAAsB,QAAQ,IAAI,CAAC,CAAC;2BAD3G,WAAW;yBAAmB,SAAS;wBAAmB,QAAQ;sBAAmB,MAAM;QAE5G,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACrD,CAAC;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { ConcurrencyDimensionFlags } from './ConcurrencyDimensions.js';
|
|
3
|
+
import type { EventStreamDefinition } from './EventStreamDefinition.js';
|
|
4
|
+
/**
|
|
5
|
+
* Describes a registered event source: a stable name, its default concurrency dimensions and its streams.
|
|
6
|
+
* Routing belongs to the append, not to event types.
|
|
7
|
+
*/
|
|
8
|
+
export interface EventSourceDefinition {
|
|
9
|
+
/** The class carrying the definition. */
|
|
10
|
+
readonly type: Constructor;
|
|
11
|
+
/** The stable name of the event source; this is the event source type of appended events. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/** The description of the event source. */
|
|
14
|
+
readonly description: string;
|
|
15
|
+
/** The default dimensions that take part in concurrency checks. */
|
|
16
|
+
readonly concurrency: ConcurrencyDimensionFlags;
|
|
17
|
+
/** The streams declared by the event source. */
|
|
18
|
+
readonly streams: ReadonlyArray<EventStreamDefinition>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=EventSourceDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSourceDefinition.d.ts","sourceRoot":"","sources":["../../eventSources/EventSourceDefinition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAEhD,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSourceDefinition.js","sourceRoot":"","sources":["../../eventSources/EventSourceDefinition.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { IClientArtifactsProvider } from '../artifacts/index.js';
|
|
3
|
+
import type { ChronicleConnection } from '../connection/index.js';
|
|
4
|
+
import type { EventSourceDefinition } from './EventSourceDefinition.js';
|
|
5
|
+
import type { IEventSources } from './IEventSources.js';
|
|
6
|
+
/**
|
|
7
|
+
* Implements {@link IEventSources}, discovering `@eventSource` classes and registering them with the Kernel.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EventSources implements IEventSources {
|
|
10
|
+
private readonly _eventStore;
|
|
11
|
+
private readonly _connection;
|
|
12
|
+
private readonly _clientArtifacts;
|
|
13
|
+
private _byType;
|
|
14
|
+
private _byName;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new {@link EventSources}.
|
|
17
|
+
* @param _eventStore - The name of the event store the definitions belong to.
|
|
18
|
+
* @param _connection - The connection used to communicate with the Kernel.
|
|
19
|
+
* @param _clientArtifacts - Provider for discovered client artifact types.
|
|
20
|
+
*/
|
|
21
|
+
constructor(_eventStore: string, _connection: ChronicleConnection, _clientArtifacts: IClientArtifactsProvider);
|
|
22
|
+
/** @inheritdoc */
|
|
23
|
+
get all(): ReadonlyArray<EventSourceDefinition>;
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
discover(): Promise<void>;
|
|
26
|
+
/** @inheritdoc */
|
|
27
|
+
register(): Promise<void>;
|
|
28
|
+
/** @inheritdoc */
|
|
29
|
+
getFor(eventSource: Constructor | string): EventSourceDefinition;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=EventSources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSources.d.ts","sourceRoot":"","sources":["../../eventSources/EventSources.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAKxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,qBAAa,YAAa,YAAW,aAAa;IAW1C,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAZrC,OAAO,CAAC,OAAO,CAAiD;IAChE,OAAO,CAAC,OAAO,CAA4C;IAE3D;;;;;OAKG;IACH,YACqB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,EAAE,wBAAwB,EAC3D;IAEJ,kBAAkB;IAClB,IAAI,GAAG,IAAI,aAAa,CAAC,qBAAqB,CAAC,CAE9C;IAED,kBAAkB;IACZ,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAyB9B;IAED,kBAAkB;IACZ,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB9B;IAED,kBAAkB;IAClB,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,qBAAqB,CAI/D;CACJ"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { EventSourceOwner } from '@cratis/chronicle.contracts';
|
|
4
|
+
import { ensureCommandSuccess } from '../connection/callResults.js';
|
|
5
|
+
import { getEventSourceMetadata, getEventStreamsFor } from './eventSource.js';
|
|
6
|
+
import { DuplicateEventSourceName } from './DuplicateEventSourceName.js';
|
|
7
|
+
import { DuplicateEventStreamName } from './DuplicateEventStreamName.js';
|
|
8
|
+
import { UnknownEventSource } from './UnknownEventSource.js';
|
|
9
|
+
/**
|
|
10
|
+
* Implements {@link IEventSources}, discovering `@eventSource` classes and registering them with the Kernel.
|
|
11
|
+
*/
|
|
12
|
+
export class EventSources {
|
|
13
|
+
_eventStore;
|
|
14
|
+
_connection;
|
|
15
|
+
_clientArtifacts;
|
|
16
|
+
_byType = new Map();
|
|
17
|
+
_byName = new Map();
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new {@link EventSources}.
|
|
20
|
+
* @param _eventStore - The name of the event store the definitions belong to.
|
|
21
|
+
* @param _connection - The connection used to communicate with the Kernel.
|
|
22
|
+
* @param _clientArtifacts - Provider for discovered client artifact types.
|
|
23
|
+
*/
|
|
24
|
+
constructor(_eventStore, _connection, _clientArtifacts) {
|
|
25
|
+
this._eventStore = _eventStore;
|
|
26
|
+
this._connection = _connection;
|
|
27
|
+
this._clientArtifacts = _clientArtifacts;
|
|
28
|
+
}
|
|
29
|
+
/** @inheritdoc */
|
|
30
|
+
get all() {
|
|
31
|
+
return [...this._byType.values()];
|
|
32
|
+
}
|
|
33
|
+
/** @inheritdoc */
|
|
34
|
+
async discover() {
|
|
35
|
+
const byType = new Map();
|
|
36
|
+
const byName = new Map();
|
|
37
|
+
for (const type of this._clientArtifacts.eventSources ?? []) {
|
|
38
|
+
const metadata = getEventSourceMetadata(type);
|
|
39
|
+
if (!metadata)
|
|
40
|
+
continue;
|
|
41
|
+
if (byName.has(metadata.name))
|
|
42
|
+
throw new DuplicateEventSourceName(metadata.name);
|
|
43
|
+
const streams = getEventStreamsFor(type);
|
|
44
|
+
const seen = new Set();
|
|
45
|
+
for (const stream of streams) {
|
|
46
|
+
if (seen.has(stream.name))
|
|
47
|
+
throw new DuplicateEventStreamName(metadata.name, stream.name);
|
|
48
|
+
seen.add(stream.name);
|
|
49
|
+
}
|
|
50
|
+
const definition = {
|
|
51
|
+
type,
|
|
52
|
+
name: metadata.name,
|
|
53
|
+
description: metadata.description,
|
|
54
|
+
concurrency: metadata.concurrency,
|
|
55
|
+
streams: streams.map(stream => ({ ...stream }))
|
|
56
|
+
};
|
|
57
|
+
byType.set(type, definition);
|
|
58
|
+
byName.set(definition.name, definition);
|
|
59
|
+
}
|
|
60
|
+
this._byType = byType;
|
|
61
|
+
this._byName = byName;
|
|
62
|
+
}
|
|
63
|
+
/** @inheritdoc */
|
|
64
|
+
async register() {
|
|
65
|
+
if (this._byType.size === 0)
|
|
66
|
+
return;
|
|
67
|
+
ensureCommandSuccess('register event sources', await this._connection.eventSources.registerEventSources({
|
|
68
|
+
EventStore: this._eventStore,
|
|
69
|
+
Sources: this.all.map(definition => ({
|
|
70
|
+
Name: definition.name,
|
|
71
|
+
Description: definition.description,
|
|
72
|
+
Owner: EventSourceOwner.Client,
|
|
73
|
+
Concurrency: definition.concurrency,
|
|
74
|
+
Streams: definition.streams.map(stream => ({
|
|
75
|
+
Name: stream.name,
|
|
76
|
+
Description: stream.description,
|
|
77
|
+
Concurrency: stream.concurrency
|
|
78
|
+
}))
|
|
79
|
+
}))
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
/** @inheritdoc */
|
|
83
|
+
getFor(eventSource) {
|
|
84
|
+
const definition = typeof eventSource === 'string' ? this._byName.get(eventSource) : this._byType.get(eventSource);
|
|
85
|
+
if (!definition)
|
|
86
|
+
throw new UnknownEventSource(typeof eventSource === 'string' ? eventSource : eventSource.name);
|
|
87
|
+
return definition;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=EventSources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSources.js","sourceRoot":"","sources":["../../eventSources/EventSources.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAKrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,YAAY;IAWA,WAAW;IACX,WAAW;IACX,gBAAgB;IAZ7B,OAAO,GAAG,IAAI,GAAG,EAAsC,CAAC;IACxD,OAAO,GAAG,IAAI,GAAG,EAAiC,CAAC;IAE3D;;;;;OAKG;IACH,YACqB,WAAmB,EACnB,WAAgC,EAChC,gBAA0C;2BAF1C,WAAW;2BACX,WAAW;gCACX,gBAAgB;IAClC,CAAC;IAEJ,kBAAkB;IAClB,IAAI,GAAG;QACH,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,QAAQ;QACV,MAAM,MAAM,GAAG,IAAI,GAAG,EAAsC,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+
import type { ConcurrencyDimensionFlags } from './ConcurrencyDimensions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Describes an event stream declared by an event source definition.
|
|
4
|
+
*/
|
|
5
|
+
export interface EventStreamDefinition {
|
|
6
|
+
/** The stable name of the stream; this is the event stream type of appended events. */
|
|
7
|
+
readonly name: string;
|
|
8
|
+
/** The description of the stream. */
|
|
9
|
+
readonly description: string;
|
|
10
|
+
/** The dimensions that take part in concurrency checks for the stream. Falls back to the event source when none. */
|
|
11
|
+
readonly concurrency: ConcurrencyDimensionFlags;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=EventStreamDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamDefinition.d.ts","sourceRoot":"","sources":["../../eventSources/EventStreamDefinition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,qCAAqC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,oHAAoH;IACpH,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;CACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamDefinition.js","sourceRoot":"","sources":["../../eventSources/EventStreamDefinition.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Thrown when an append names a stream the event source does not declare. */
|
|
2
|
+
export declare class EventStreamDoesNotBelongToEventSource extends Error {
|
|
3
|
+
readonly eventSource: string;
|
|
4
|
+
readonly stream: string;
|
|
5
|
+
constructor(eventSource: string, stream: string);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=EventStreamDoesNotBelongToEventSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamDoesNotBelongToEventSource.d.ts","sourceRoot":"","sources":["../../eventSources/EventStreamDoesNotBelongToEventSource.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,qBAAa,qCAAsC,SAAQ,KAAK;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAjE,YAAqB,WAAW,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM,EAGhE;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown when an append names a stream the event source does not declare. */
|
|
4
|
+
export class EventStreamDoesNotBelongToEventSource extends Error {
|
|
5
|
+
eventSource;
|
|
6
|
+
stream;
|
|
7
|
+
constructor(eventSource, stream) {
|
|
8
|
+
super(`The event stream '${stream}' is not declared by the event source '${eventSource}'.`);
|
|
9
|
+
this.eventSource = eventSource;
|
|
10
|
+
this.stream = stream;
|
|
11
|
+
this.name = 'EventStreamDoesNotBelongToEventSource';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=EventStreamDoesNotBelongToEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamDoesNotBelongToEventSource.js","sourceRoot":"","sources":["../../eventSources/EventStreamDoesNotBelongToEventSource.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,8EAA8E;AAC9E,MAAM,OAAO,qCAAsC,SAAQ,KAAK;IACvC,WAAW;IAAmB,MAAM;IAAzD,YAAqB,WAAmB,EAAW,MAAc;QAC7D,KAAK,CAAC,qBAAqB,MAAM,0CAA0C,WAAW,IAAI,CAAC,CAAC;2BAD3E,WAAW;sBAAmB,MAAM;QAErD,IAAI,CAAC,IAAI,GAAG,uCAAuC,CAAC;IACxD,CAAC;CACJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Thrown when an append names a stream without naming the event source that declares it. */
|
|
2
|
+
export declare class EventStreamRequiresEventSource extends Error {
|
|
3
|
+
readonly stream: string;
|
|
4
|
+
constructor(stream: string);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=EventStreamRequiresEventSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamRequiresEventSource.d.ts","sourceRoot":"","sources":["../../eventSources/EventStreamRequiresEventSource.ts"],"names":[],"mappings":"AAGA,6FAA6F;AAC7F,qBAAa,8BAA+B,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAnC,YAAqB,MAAM,EAAE,MAAM,EAGlC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown when an append names a stream without naming the event source that declares it. */
|
|
4
|
+
export class EventStreamRequiresEventSource extends Error {
|
|
5
|
+
stream;
|
|
6
|
+
constructor(stream) {
|
|
7
|
+
super(`The event stream '${stream}' can only be used together with an event source.`);
|
|
8
|
+
this.stream = stream;
|
|
9
|
+
this.name = 'EventStreamRequiresEventSource';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=EventStreamRequiresEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventStreamRequiresEventSource.js","sourceRoot":"","sources":["../../eventSources/EventStreamRequiresEventSource.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,6FAA6F;AAC7F,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IAChC,MAAM;IAA3B,YAAqB,MAAc;QAC/B,KAAK,CAAC,qBAAqB,MAAM,mDAAmD,CAAC,CAAC;sBADrE,MAAM;QAEvB,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IACjD,CAAC;CACJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { EventSourceDefinition } from './EventSourceDefinition.js';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the discovery and registration of event source definitions.
|
|
5
|
+
*/
|
|
6
|
+
export interface IEventSources {
|
|
7
|
+
/** Gets all discovered event source definitions. */
|
|
8
|
+
readonly all: ReadonlyArray<EventSourceDefinition>;
|
|
9
|
+
/**
|
|
10
|
+
* Discovers the event source definitions from the client artifacts.
|
|
11
|
+
* @throws DuplicateEventSourceName when two definitions share a name.
|
|
12
|
+
* @throws DuplicateEventStreamName when a definition declares the same stream twice.
|
|
13
|
+
*/
|
|
14
|
+
discover(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers the discovered definitions with the Kernel. Registration is an upsert; the Kernel retains
|
|
17
|
+
* historical definitions that are no longer registered. Does nothing when there are no definitions.
|
|
18
|
+
*/
|
|
19
|
+
register(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the definition by class or name.
|
|
22
|
+
* @param eventSource - The class decorated with `@eventSource`, or the definition name.
|
|
23
|
+
* @throws UnknownEventSource when there is no such definition.
|
|
24
|
+
*/
|
|
25
|
+
getFor(eventSource: Constructor | string): EventSourceDefinition;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=IEventSources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventSources.d.ts","sourceRoot":"","sources":["../../eventSources/IEventSources.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAEnD;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,qBAAqB,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventSources.js","sourceRoot":"","sources":["../../eventSources/IEventSources.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { ConcurrencyDimensionFlags } from './ConcurrencyDimensions.js';
|
|
3
|
+
import type { EventSourceDefinition } from './EventSourceDefinition.js';
|
|
4
|
+
import type { EventStreamDefinition } from './EventStreamDefinition.js';
|
|
5
|
+
import type { IEventSources } from './IEventSources.js';
|
|
6
|
+
/** The explicit routing a caller supplied next to a definition. */
|
|
7
|
+
export interface ExplicitRouting {
|
|
8
|
+
/** Explicit event source type, if any. */
|
|
9
|
+
sourceType?: string;
|
|
10
|
+
/** Explicit event stream type, if any. */
|
|
11
|
+
streamType?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The routing of an append resolved through an event source definition. */
|
|
14
|
+
export declare class ResolvedEventRouting {
|
|
15
|
+
readonly definition: EventSourceDefinition;
|
|
16
|
+
readonly stream?: EventStreamDefinition | undefined;
|
|
17
|
+
private constructor();
|
|
18
|
+
/** The registered event source name written on the event. */
|
|
19
|
+
get eventSource(): string;
|
|
20
|
+
/** The event source type written on the event. */
|
|
21
|
+
get sourceType(): string;
|
|
22
|
+
/** The event stream type to write, or undefined to let the Kernel choose. */
|
|
23
|
+
get streamType(): string | undefined;
|
|
24
|
+
/** The concurrency dimensions that apply: the stream's when it declares any, otherwise the source's. */
|
|
25
|
+
get dimensions(): ConcurrencyDimensionFlags;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the routing of an append.
|
|
28
|
+
* @param eventSources - The event sources; undefined when the store has none.
|
|
29
|
+
* @param eventSource - The definition class or name; undefined for a legacy append.
|
|
30
|
+
* @param stream - The declared stream name, if any.
|
|
31
|
+
* @param explicit - Explicit routing that must not contradict the definition.
|
|
32
|
+
* @returns The routing, or undefined when no definition is involved.
|
|
33
|
+
* @throws UnknownEventSource, EventStreamDoesNotBelongToEventSource, EventRoutingContradictsEventSource, EventStreamRequiresEventSource.
|
|
34
|
+
*/
|
|
35
|
+
static resolve(eventSources: IEventSources | undefined, eventSource: Constructor | string | undefined, stream: string | undefined, explicit?: ExplicitRouting): ResolvedEventRouting | undefined;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ResolvedEventRouting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResolvedEventRouting.d.ts","sourceRoot":"","sources":["../../eventSources/ResolvedEventRouting.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMxD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC5B,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,4EAA4E;AAC5E,qBAAa,oBAAoB;IACT,QAAQ,CAAC,UAAU,EAAE,qBAAqB;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB;IAAvG,OAAO,eAAoG;IAE3G,6DAA6D;IAC7D,IAAI,WAAW,IAAI,MAAM,CAAiC;IAE1D,kDAAkD;IAClD,IAAI,UAAU,IAAI,MAAM,CAAiC;IAEzD,6EAA6E;IAC7E,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAA8B;IAElE,wGAAwG;IACxG,IAAI,UAAU,IAAI,yBAAyB,CAE1C;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CACV,YAAY,EAAE,aAAa,GAAG,SAAS,EACvC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC7C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,GAAE,eAAoB,GAC/B,oBAAoB,GAAG,SAAS,CAsBlC;CACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { EventRoutingContradictsEventSource } from './EventRoutingContradictsEventSource.js';
|
|
4
|
+
import { EventStreamDoesNotBelongToEventSource } from './EventStreamDoesNotBelongToEventSource.js';
|
|
5
|
+
import { EventStreamRequiresEventSource } from './EventStreamRequiresEventSource.js';
|
|
6
|
+
import { UnknownEventSource } from './UnknownEventSource.js';
|
|
7
|
+
/** The routing of an append resolved through an event source definition. */
|
|
8
|
+
export class ResolvedEventRouting {
|
|
9
|
+
definition;
|
|
10
|
+
stream;
|
|
11
|
+
constructor(definition, stream) {
|
|
12
|
+
this.definition = definition;
|
|
13
|
+
this.stream = stream;
|
|
14
|
+
}
|
|
15
|
+
/** The registered event source name written on the event. */
|
|
16
|
+
get eventSource() { return this.definition.name; }
|
|
17
|
+
/** The event source type written on the event. */
|
|
18
|
+
get sourceType() { return this.definition.name; }
|
|
19
|
+
/** The event stream type to write, or undefined to let the Kernel choose. */
|
|
20
|
+
get streamType() { return this.stream?.name; }
|
|
21
|
+
/** The concurrency dimensions that apply: the stream's when it declares any, otherwise the source's. */
|
|
22
|
+
get dimensions() {
|
|
23
|
+
return this.stream && this.stream.concurrency !== 0 ? this.stream.concurrency : this.definition.concurrency;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the routing of an append.
|
|
27
|
+
* @param eventSources - The event sources; undefined when the store has none.
|
|
28
|
+
* @param eventSource - The definition class or name; undefined for a legacy append.
|
|
29
|
+
* @param stream - The declared stream name, if any.
|
|
30
|
+
* @param explicit - Explicit routing that must not contradict the definition.
|
|
31
|
+
* @returns The routing, or undefined when no definition is involved.
|
|
32
|
+
* @throws UnknownEventSource, EventStreamDoesNotBelongToEventSource, EventRoutingContradictsEventSource, EventStreamRequiresEventSource.
|
|
33
|
+
*/
|
|
34
|
+
static resolve(eventSources, eventSource, stream, explicit = {}) {
|
|
35
|
+
if (eventSource === undefined) {
|
|
36
|
+
if (stream !== undefined)
|
|
37
|
+
throw new EventStreamRequiresEventSource(stream);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
if (!eventSources)
|
|
41
|
+
throw new UnknownEventSource(typeof eventSource === 'string' ? eventSource : eventSource.name);
|
|
42
|
+
const definition = eventSources.getFor(eventSource);
|
|
43
|
+
const isSet = (value, unspecified) => value !== undefined && value !== '' && !unspecified.includes(value);
|
|
44
|
+
if (isSet(explicit.sourceType, ['Default', 'Unspecified']) && explicit.sourceType !== definition.name) {
|
|
45
|
+
throw new EventRoutingContradictsEventSource(definition.name, 'event source type', definition.name, explicit.sourceType);
|
|
46
|
+
}
|
|
47
|
+
const explicitStream = isSet(explicit.streamType, ['All']) ? explicit.streamType : undefined;
|
|
48
|
+
if (stream !== undefined && explicitStream !== undefined && stream !== explicitStream) {
|
|
49
|
+
throw new EventRoutingContradictsEventSource(definition.name, 'event stream type', stream, explicitStream);
|
|
50
|
+
}
|
|
51
|
+
const name = stream ?? explicitStream;
|
|
52
|
+
if (name === undefined)
|
|
53
|
+
return new ResolvedEventRouting(definition);
|
|
54
|
+
const found = definition.streams.find(candidate => candidate.name === name);
|
|
55
|
+
if (!found)
|
|
56
|
+
throw new EventStreamDoesNotBelongToEventSource(definition.name, name);
|
|
57
|
+
return new ResolvedEventRouting(definition, found);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ResolvedEventRouting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResolvedEventRouting.js","sourceRoot":"","sources":["../../eventSources/ResolvedEventRouting.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAOrG,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAW7D,4EAA4E;AAC5E,MAAM,OAAO,oBAAoB;IACA,UAAU;IAAkC,MAAM;IAA/E,YAA6B,UAAiC,EAAW,MAA8B;0BAA1E,UAAU;sBAAkC,MAAM;IAA2B,CAAC;IAE3G,6DAA6D;IAC7D,IAAI,WAAW,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1D,kDAAkD;IAClD,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,6EAA6E;IAC7E,IAAI,UAAU,KAAyB,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAElE,wGAAwG;IACxG,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IAChH,CAAC;IAED;;;;;;;;OAQG;IACH,MA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,MAAM,EAAE,cAAc,CAAC,CAAC;QAC/G,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,cAAc,CAAC;QACtC,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,qCAAqC,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnF,OAAO,IAAI,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownEventSource.d.ts","sourceRoot":"","sources":["../../eventSources/UnknownEventSource.ts"],"names":[],"mappings":"AAGA,uFAAuF;AACvF,qBAAa,kBAAmB,SAAQ,KAAK;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAxC,YAAqB,WAAW,EAAE,MAAM,EAGvC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown when an append names an event source that is not a discovered definition. */
|
|
4
|
+
export class UnknownEventSource extends Error {
|
|
5
|
+
eventSource;
|
|
6
|
+
constructor(eventSource) {
|
|
7
|
+
super(`The event source '${eventSource}' is not a discovered event source definition.`);
|
|
8
|
+
this.eventSource = eventSource;
|
|
9
|
+
this.name = 'UnknownEventSource';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=UnknownEventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownEventSource.js","sourceRoot":"","sources":["../../eventSources/UnknownEventSource.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,uFAAuF;AACvF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACpB,WAAW;IAAhC,YAAqB,WAAmB;QACpC,KAAK,CAAC,qBAAqB,WAAW,gDAAgD,CAAC,CAAC;2BADvE,WAAW;QAE5B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { ChronicleClassDecorator } from '../types/standardDecoratorMetadata.js';
|
|
3
|
+
import type { ConcurrencyDimensionFlags } from './ConcurrencyDimensions.js';
|
|
4
|
+
/** Optional settings for {@link eventSource}. */
|
|
5
|
+
export interface EventSourceOptions {
|
|
6
|
+
/** The stable name. Defaults to the class name without a trailing `EventSource`. */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** The description of the event source. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** The default dimensions that take part in concurrency checks; combine {@link ConcurrencyDimensions} values with `|`. */
|
|
11
|
+
concurrency?: ConcurrencyDimensionFlags;
|
|
12
|
+
}
|
|
13
|
+
/** Optional settings for {@link eventStream}. */
|
|
14
|
+
export interface EventStreamOptions {
|
|
15
|
+
/** The description of the stream. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** The dimensions that take part in concurrency checks for the stream. Falls back to the event source when omitted or none. */
|
|
18
|
+
concurrency?: ConcurrencyDimensionFlags;
|
|
19
|
+
}
|
|
20
|
+
/** Metadata recorded by {@link eventSource}. */
|
|
21
|
+
export interface EventSourceMetadata {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly concurrency: ConcurrencyDimensionFlags;
|
|
25
|
+
}
|
|
26
|
+
/** Metadata recorded by {@link eventStream}. */
|
|
27
|
+
export interface EventStreamMetadata {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly description: string;
|
|
30
|
+
readonly concurrency: ConcurrencyDimensionFlags;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Declares a class as an event source definition, discovered and registered with the Kernel at startup.
|
|
34
|
+
* The definition is not tied to event types; an append routes through it with `AppendOptions.eventSource`.
|
|
35
|
+
* Supports legacy and standard class decorators.
|
|
36
|
+
* @param options - Optional name (defaults to the class name without a trailing `EventSource`), description and concurrency.
|
|
37
|
+
* @returns A class decorator.
|
|
38
|
+
*/
|
|
39
|
+
export declare function eventSource(options?: EventSourceOptions): ChronicleClassDecorator;
|
|
40
|
+
/**
|
|
41
|
+
* Declares a stream of an event source. Repeat the decorator for several streams.
|
|
42
|
+
* Only takes effect on a class that is also decorated with {@link eventSource}.
|
|
43
|
+
* @param name - The stable name of the stream, which is the event stream type of appended events.
|
|
44
|
+
* @param options - Optional description and concurrency dimensions.
|
|
45
|
+
* @returns A class decorator.
|
|
46
|
+
*/
|
|
47
|
+
export declare function eventStream(name: string, options?: EventStreamOptions): ChronicleClassDecorator;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the event source metadata declared on a class.
|
|
50
|
+
* @param target - The class constructor.
|
|
51
|
+
* @returns The metadata, or undefined when the class is not an event source.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getEventSourceMetadata(target: Function): EventSourceMetadata | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the streams declared on a class, in declaration order (duplicates are preserved so they can be rejected).
|
|
56
|
+
* @param target - The class constructor.
|
|
57
|
+
* @returns The declared streams.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getEventStreamsFor(target: Function): ReadonlyArray<EventStreamMetadata>;
|
|
60
|
+
//# sourceMappingURL=eventSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventSource.d.ts","sourceRoot":"","sources":["../../eventSources/eventSource.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,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c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import 'reflect-metadata';
|
|
4
|
+
import { DecoratorType, TypeDiscoverer } from '../types/index.js';
|
|
5
|
+
const EVENT_SOURCE_METADATA_KEY = 'chronicle:eventSource';
|
|
6
|
+
const EVENT_STREAMS_METADATA_KEY = 'chronicle:eventSource:streams';
|
|
7
|
+
let registrationCounter = 0;
|
|
8
|
+
/**
|
|
9
|
+
* Declares a class as an event source definition, discovered and registered with the Kernel at startup.
|
|
10
|
+
* The definition is not tied to event types; an append routes through it with `AppendOptions.eventSource`.
|
|
11
|
+
* Supports legacy and standard class decorators.
|
|
12
|
+
* @param options - Optional name (defaults to the class name without a trailing `EventSource`), description and concurrency.
|
|
13
|
+
* @returns A class decorator.
|
|
14
|
+
*/
|
|
15
|
+
export function eventSource(options) {
|
|
16
|
+
return ((target, context) => {
|
|
17
|
+
let constructor = target;
|
|
18
|
+
const metadata = {
|
|
19
|
+
name: options?.name ?? defaultNameFor(constructor),
|
|
20
|
+
description: options?.description ?? '',
|
|
21
|
+
concurrency: options?.concurrency ?? 0
|
|
22
|
+
};
|
|
23
|
+
Reflect.defineMetadata(EVENT_SOURCE_METADATA_KEY, metadata, target);
|
|
24
|
+
TypeDiscoverer.default.register(DecoratorType.EventSource, constructor, `${metadata.name}#${registrationCounter++}`);
|
|
25
|
+
context?.addInitializer(function () {
|
|
26
|
+
if (this !== constructor) {
|
|
27
|
+
constructor = this;
|
|
28
|
+
Reflect.defineMetadata(EVENT_SOURCE_METADATA_KEY, metadata, constructor);
|
|
29
|
+
Reflect.defineMetadata(EVENT_STREAMS_METADATA_KEY, Reflect.getOwnMetadata(EVENT_STREAMS_METADATA_KEY, target), constructor);
|
|
30
|
+
TypeDiscoverer.default.register(DecoratorType.EventSource, constructor, `${metadata.name}#${registrationCounter++}`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Declares a stream of an event source. Repeat the decorator for several streams.
|
|
37
|
+
* Only takes effect on a class that is also decorated with {@link eventSource}.
|
|
38
|
+
* @param name - The stable name of the stream, which is the event stream type of appended events.
|
|
39
|
+
* @param options - Optional description and concurrency dimensions.
|
|
40
|
+
* @returns A class decorator.
|
|
41
|
+
*/
|
|
42
|
+
export function eventStream(name, options) {
|
|
43
|
+
return ((target) => {
|
|
44
|
+
const existing = Reflect.getOwnMetadata(EVENT_STREAMS_METADATA_KEY, target) ?? [];
|
|
45
|
+
// Decorators evaluate bottom-up; unshift keeps declaration order.
|
|
46
|
+
Reflect.defineMetadata(EVENT_STREAMS_METADATA_KEY, [
|
|
47
|
+
{ name, description: options?.description ?? '', concurrency: options?.concurrency ?? 0 },
|
|
48
|
+
...existing
|
|
49
|
+
], target);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the event source metadata declared on a class.
|
|
54
|
+
* @param target - The class constructor.
|
|
55
|
+
* @returns The metadata, or undefined when the class is not an event source.
|
|
56
|
+
*/
|
|
57
|
+
export function getEventSourceMetadata(target) {
|
|
58
|
+
return Reflect.getOwnMetadata(EVENT_SOURCE_METADATA_KEY, target);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the streams declared on a class, in declaration order (duplicates are preserved so they can be rejected).
|
|
62
|
+
* @param target - The class constructor.
|
|
63
|
+
* @returns The declared streams.
|
|
64
|
+
*/
|
|
65
|
+
export function getEventStreamsFor(target) {
|
|
66
|
+
return Reflect.getOwnMetadata(EVENT_STREAMS_METADATA_KEY, target) ?? [];
|
|
67
|
+
}
|
|
68
|
+
function defaultNameFor(type) {
|
|
69
|
+
const suffix = 'EventSource';
|
|
70
|
+
return type.name.length > suffix.length && type.name.endsWith(suffix) ? type.name.slice(0, -suffix.length) : type.name;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=eventSource.js.map
|
|
@@ -0,0 +1 @@
|
|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