@cratis/chronicle 0.2.0 → 0.2.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/EventStore.ts +8 -0
- package/IEventStore.ts +8 -0
- package/compliance/ComplianceContracts.ts +63 -0
- package/compliance/ComplianceMetadata.ts +19 -0
- package/compliance/ComplianceMetadataResolver.ts +51 -0
- package/compliance/ComplianceMetadataType.ts +36 -0
- package/compliance/index.ts +7 -0
- package/compliance/pii.ts +115 -0
- package/connection/ChronicleConnection.ts +19 -1
- package/connection/ChronicleServices.ts +6 -0
- package/dist/EventStore.d.ts +4 -0
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +6 -0
- package/dist/EventStore.js.map +1 -1
- package/dist/IEventStore.d.ts +6 -0
- package/dist/IEventStore.d.ts.map +1 -1
- package/dist/compliance/ComplianceContracts.d.ts +56 -0
- package/dist/compliance/ComplianceContracts.d.ts.map +1 -0
- package/dist/compliance/ComplianceContracts.js +25 -0
- package/dist/compliance/ComplianceContracts.js.map +1 -0
- package/dist/compliance/ComplianceMetadata.d.ts +15 -0
- package/dist/compliance/ComplianceMetadata.d.ts.map +1 -0
- package/dist/compliance/ComplianceMetadata.js +4 -0
- package/dist/compliance/ComplianceMetadata.js.map +1 -0
- package/dist/compliance/ComplianceMetadataResolver.d.ts +27 -0
- package/dist/compliance/ComplianceMetadataResolver.d.ts.map +1 -0
- package/dist/compliance/ComplianceMetadataResolver.js +45 -0
- package/dist/compliance/ComplianceMetadataResolver.js.map +1 -0
- package/dist/compliance/ComplianceMetadataType.d.ts +24 -0
- package/dist/compliance/ComplianceMetadataType.d.ts.map +1 -0
- package/dist/compliance/ComplianceMetadataType.js +32 -0
- package/dist/compliance/ComplianceMetadataType.js.map +1 -0
- package/dist/compliance/index.d.ts +5 -0
- package/dist/compliance/index.d.ts.map +1 -0
- package/dist/compliance/index.js +6 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/pii.d.ts +69 -0
- package/dist/compliance/pii.d.ts.map +1 -0
- package/dist/compliance/pii.js +106 -0
- package/dist/compliance/pii.js.map +1 -0
- package/dist/connection/ChronicleConnection.d.ts +3 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +16 -2
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleServices.d.ts +6 -1
- package/dist/connection/ChronicleServices.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +3 -3
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionBuilder.d.ts +20 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionBuilder.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionBuilder.js +41 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionBuilder.js.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionDefinition.d.ts +12 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionDefinition.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionDefinition.js +16 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionDefinition.js.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionId.d.ts +10 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionId.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionId.js +16 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptionId.js.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts +21 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js +60 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js.map +1 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptionBuilder.d.ts +20 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptionBuilder.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptionBuilder.js +4 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptionBuilder.js.map +1 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts +21 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.js +4 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.js.map +1 -0
- package/dist/eventStoreSubscriptions/contracts.d.ts +71 -0
- package/dist/eventStoreSubscriptions/contracts.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/contracts.js +310 -0
- package/dist/eventStoreSubscriptions/contracts.js.map +1 -0
- package/dist/eventStoreSubscriptions/index.d.ts +7 -0
- package/dist/eventStoreSubscriptions/index.d.ts.map +1 -0
- package/dist/eventStoreSubscriptions/index.js +7 -0
- package/dist/eventStoreSubscriptions/index.js.map +1 -0
- package/dist/events/constraints/IUniqueConstraintBuilder.d.ts +3 -2
- package/dist/events/constraints/IUniqueConstraintBuilder.d.ts.map +1 -1
- package/dist/events/constraints/UniqueConstraintBuilder.d.ts +2 -8
- package/dist/events/constraints/UniqueConstraintBuilder.d.ts.map +1 -1
- package/dist/events/constraints/UniqueConstraintBuilder.js +4 -15
- package/dist/events/constraints/UniqueConstraintBuilder.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/reactors/Reactors.js +1 -1
- package/dist/reactors/Reactors.js.map +1 -1
- package/dist/readModels/IMaterializedReadModels.d.ts +23 -0
- package/dist/readModels/IMaterializedReadModels.d.ts.map +1 -0
- package/dist/readModels/IMaterializedReadModels.js +4 -0
- package/dist/readModels/IMaterializedReadModels.js.map +1 -0
- package/dist/readModels/IReadModels.d.ts +75 -0
- package/dist/readModels/IReadModels.d.ts.map +1 -0
- package/dist/readModels/IReadModels.js +4 -0
- package/dist/readModels/IReadModels.js.map +1 -0
- package/dist/readModels/MaterializedReadModels.d.ts +25 -0
- package/dist/readModels/MaterializedReadModels.d.ts.map +1 -0
- package/dist/readModels/MaterializedReadModels.js +125 -0
- package/dist/readModels/MaterializedReadModels.js.map +1 -0
- package/dist/readModels/ReadModelChangeset.d.ts +14 -0
- package/dist/readModels/ReadModelChangeset.d.ts.map +1 -0
- package/dist/readModels/ReadModelChangeset.js +4 -0
- package/dist/readModels/ReadModelChangeset.js.map +1 -0
- package/dist/readModels/ReadModelSnapshot.d.ts +15 -0
- package/dist/readModels/ReadModelSnapshot.d.ts.map +1 -0
- package/dist/readModels/ReadModelSnapshot.js +4 -0
- package/dist/readModels/ReadModelSnapshot.js.map +1 -0
- package/dist/readModels/ReadModels.d.ts +42 -0
- package/dist/readModels/ReadModels.d.ts.map +1 -0
- package/dist/readModels/ReadModels.js +270 -0
- package/dist/readModels/ReadModels.js.map +1 -0
- package/dist/readModels/index.d.ts +6 -0
- package/dist/readModels/index.d.ts.map +1 -1
- package/dist/readModels/index.js +2 -0
- package/dist/readModels/index.js.map +1 -1
- package/dist/readModels/readModel.d.ts.map +1 -1
- package/dist/readModels/readModel.js +0 -20
- package/dist/readModels/readModel.js.map +1 -1
- package/dist/reducers/Reducers.d.ts +1 -0
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +10 -3
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/schemas/JsonSchemaGenerator.d.ts +9 -0
- package/dist/schemas/JsonSchemaGenerator.d.ts.map +1 -1
- package/dist/schemas/JsonSchemaGenerator.js +53 -1
- package/dist/schemas/JsonSchemaGenerator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/TypeIntrospector.d.ts +11 -1
- package/dist/types/TypeIntrospector.d.ts.map +1 -1
- package/dist/types/TypeIntrospector.js +29 -3
- package/dist/types/TypeIntrospector.js.map +1 -1
- package/eventSequences/EventSequence.ts +3 -3
- package/eventStoreSubscriptions/EventStoreSubscriptionBuilder.ts +52 -0
- package/eventStoreSubscriptions/EventStoreSubscriptionDefinition.ts +16 -0
- package/eventStoreSubscriptions/EventStoreSubscriptionId.ts +14 -0
- package/eventStoreSubscriptions/EventStoreSubscriptions.ts +74 -0
- package/eventStoreSubscriptions/IEventStoreSubscriptionBuilder.ts +24 -0
- package/eventStoreSubscriptions/IEventStoreSubscriptions.ts +29 -0
- package/eventStoreSubscriptions/contracts.ts +372 -0
- package/eventStoreSubscriptions/index.ts +9 -0
- package/events/constraints/IUniqueConstraintBuilder.ts +3 -2
- package/events/constraints/UniqueConstraintBuilder.ts +5 -17
- package/index.ts +6 -0
- package/package.json +17 -7
- package/reactors/Reactors.ts +1 -1
- package/readModels/IMaterializedReadModels.ts +27 -0
- package/readModels/IReadModels.ts +87 -0
- package/readModels/MaterializedReadModels.ts +151 -0
- package/readModels/ReadModelChangeset.ts +19 -0
- package/readModels/ReadModelSnapshot.ts +21 -0
- package/readModels/ReadModels.ts +333 -0
- package/readModels/index.ts +6 -0
- package/readModels/readModel.ts +0 -22
- package/reducers/Reducers.ts +12 -3
- package/schemas/JsonSchemaGenerator.ts +61 -1
- package/types/TypeIntrospector.ts +32 -3
package/EventStore.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { Reactors } from './reactors/Reactors';
|
|
|
23
23
|
import { IReactors } from './reactors/IReactors';
|
|
24
24
|
import { Reducers } from './reducers/Reducers';
|
|
25
25
|
import { IReducers } from './reducers/IReducers';
|
|
26
|
+
import { IReadModels } from './readModels/IReadModels';
|
|
27
|
+
import { ReadModels } from './readModels/ReadModels';
|
|
26
28
|
import { EventSeeding } from './seeding/EventSeeding';
|
|
27
29
|
import { IEventSeeding } from './seeding/IEventSeeding';
|
|
28
30
|
import { ChronicleTracer } from './Tracing';
|
|
@@ -33,6 +35,8 @@ import { IJobs } from './jobs/IJobs';
|
|
|
33
35
|
import { Jobs } from './jobs/Jobs';
|
|
34
36
|
import { IWebhooks } from './webhooks/IWebhooks';
|
|
35
37
|
import { Webhooks } from './webhooks/Webhooks';
|
|
38
|
+
import { EventStoreSubscriptions } from './eventStoreSubscriptions/EventStoreSubscriptions';
|
|
39
|
+
import { IEventStoreSubscriptions } from './eventStoreSubscriptions/IEventStoreSubscriptions';
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* Implements {@link IEventStore} by communicating with the Chronicle Kernel
|
|
@@ -49,9 +53,11 @@ export class EventStore implements IEventStore {
|
|
|
49
53
|
readonly projections: IProjections;
|
|
50
54
|
readonly reactors: IReactors;
|
|
51
55
|
readonly reducers: IReducers;
|
|
56
|
+
readonly readModels: IReadModels;
|
|
52
57
|
readonly unitOfWorkManager: IUnitOfWorkManager;
|
|
53
58
|
readonly jobs: IJobs;
|
|
54
59
|
readonly webhooks: IWebhooks;
|
|
60
|
+
readonly subscriptions: IEventStoreSubscriptions;
|
|
55
61
|
readonly seeding: IEventSeeding;
|
|
56
62
|
|
|
57
63
|
private readonly _sequences: Map<string, IEventSequence> = new Map();
|
|
@@ -73,8 +79,10 @@ export class EventStore implements IEventStore {
|
|
|
73
79
|
this.projections = new Projections(name.value, _connection, artifacts);
|
|
74
80
|
this.reactors = new Reactors(artifacts, _connection, name.value, namespace.value, lifecycle);
|
|
75
81
|
this.reducers = new Reducers(artifacts, _connection, name.value, namespace.value, lifecycle);
|
|
82
|
+
this.readModels = new ReadModels(name.value, namespace.value, _connection, artifacts);
|
|
76
83
|
this.jobs = new Jobs(name.value, namespace.value, _connection);
|
|
77
84
|
this.webhooks = new Webhooks(name.value, _connection, this.eventTypes, artifacts);
|
|
85
|
+
this.subscriptions = new EventStoreSubscriptions(this.eventTypes, name.value, _connection);
|
|
78
86
|
this.seeding = new EventSeeding(name.value, _connection, artifacts);
|
|
79
87
|
}
|
|
80
88
|
|
package/IEventStore.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { IUnitOfWorkManager } from './transactions/IUnitOfWorkManager';
|
|
|
15
15
|
import { IJobs } from './jobs/IJobs';
|
|
16
16
|
import { IWebhooks } from './webhooks/IWebhooks';
|
|
17
17
|
import { IEventSeeding } from './seeding/IEventSeeding';
|
|
18
|
+
import { IEventStoreSubscriptions } from './eventStoreSubscriptions/IEventStoreSubscriptions';
|
|
19
|
+
import { IReadModels } from './readModels/IReadModels';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Defines the API surface for an event store.
|
|
@@ -45,6 +47,9 @@ export interface IEventStore {
|
|
|
45
47
|
/** The reducers manager for this event store. */
|
|
46
48
|
readonly reducers: IReducers;
|
|
47
49
|
|
|
50
|
+
/** The read-models manager for this event store. */
|
|
51
|
+
readonly readModels: IReadModels;
|
|
52
|
+
|
|
48
53
|
/** The unit of work manager for transaction-scoped appends. */
|
|
49
54
|
readonly unitOfWorkManager: IUnitOfWorkManager;
|
|
50
55
|
|
|
@@ -54,6 +59,9 @@ export interface IEventStore {
|
|
|
54
59
|
/** The webhooks manager for this event store. */
|
|
55
60
|
readonly webhooks: IWebhooks;
|
|
56
61
|
|
|
62
|
+
/** The event store subscriptions manager for this event store. */
|
|
63
|
+
readonly subscriptions: IEventStoreSubscriptions;
|
|
64
|
+
|
|
57
65
|
/** The event seeding manager for this event store. */
|
|
58
66
|
readonly seeding: IEventSeeding;
|
|
59
67
|
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
|
|
4
|
+
import type { CallOptions } from 'nice-grpc-common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Request to release (decrypt) PII properties in a read model.
|
|
8
|
+
*
|
|
9
|
+
* Note: These types mirror the compliance contracts until they are exported
|
|
10
|
+
* from @cratis/chronicle.contracts package.
|
|
11
|
+
*/
|
|
12
|
+
export interface ReleaseRequest {
|
|
13
|
+
EventStore: string;
|
|
14
|
+
Namespace: string;
|
|
15
|
+
Subject: string;
|
|
16
|
+
Schema: string;
|
|
17
|
+
Payload: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Response from releasing PII properties.
|
|
22
|
+
*/
|
|
23
|
+
export interface ReleaseResponse {
|
|
24
|
+
Payload: string;
|
|
25
|
+
HasError: boolean;
|
|
26
|
+
Error: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
30
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
31
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
32
|
+
} : Partial<T>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Compliance service client interface.
|
|
36
|
+
*/
|
|
37
|
+
export interface ComplianceClient<CallOptionsExt = {}> {
|
|
38
|
+
release(request: DeepPartial<ReleaseRequest>, options?: CallOptions & CallOptionsExt): Promise<ReleaseResponse>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Message functions placeholder - not needed for nice-grpc client creation
|
|
43
|
+
*/
|
|
44
|
+
export const ReleaseRequestFns = {} as any;
|
|
45
|
+
export const ReleaseResponseFns = {} as any;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Compliance service definition for nice-grpc.
|
|
49
|
+
*/
|
|
50
|
+
export const ComplianceDefinition = {
|
|
51
|
+
name: 'Compliance',
|
|
52
|
+
fullName: 'Cratis.Chronicle.Contracts.Compliance.Compliance',
|
|
53
|
+
methods: {
|
|
54
|
+
release: {
|
|
55
|
+
name: 'Release',
|
|
56
|
+
requestType: ReleaseRequestFns,
|
|
57
|
+
requestStream: false as const,
|
|
58
|
+
responseType: ReleaseResponseFns,
|
|
59
|
+
responseStream: false as const,
|
|
60
|
+
options: {}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} as const;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
|
|
4
|
+
import type { ComplianceMetadataType } from './ComplianceMetadataType';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents metadata related to compliance.
|
|
8
|
+
*/
|
|
9
|
+
export interface ComplianceMetadata {
|
|
10
|
+
/**
|
|
11
|
+
* The type of compliance metadata.
|
|
12
|
+
*/
|
|
13
|
+
readonly metadataType: ComplianceMetadataType;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Any additional details - can be empty.
|
|
17
|
+
*/
|
|
18
|
+
readonly details: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
4
|
+
import type { ComplianceMetadata } from './ComplianceMetadata';
|
|
5
|
+
import { getPIIMetadata, getTypePIIMetadata } from './pii';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Resolves compliance metadata for properties and types.
|
|
9
|
+
*/
|
|
10
|
+
export class ComplianceMetadataResolver {
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a property has compliance metadata.
|
|
13
|
+
* @param target - The class prototype.
|
|
14
|
+
* @param propertyKey - The property name.
|
|
15
|
+
* @returns True if the property has compliance metadata; false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
static hasMetadataFor(target: object, propertyKey: string): boolean {
|
|
18
|
+
return getPIIMetadata(target, propertyKey) !== undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Gets all compliance metadata for a property.
|
|
23
|
+
* @param target - The class prototype.
|
|
24
|
+
* @param propertyKey - The property name.
|
|
25
|
+
* @returns Array of compliance metadata.
|
|
26
|
+
*/
|
|
27
|
+
static getMetadataFor(target: object, propertyKey: string): ComplianceMetadata[] {
|
|
28
|
+
const metadata: ComplianceMetadata[] = [];
|
|
29
|
+
|
|
30
|
+
const piiMetadata = getPIIMetadata(target, propertyKey);
|
|
31
|
+
if (piiMetadata) {
|
|
32
|
+
metadata.push(piiMetadata);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return metadata;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets compliance metadata for a type (e.g., ConceptAs types).
|
|
40
|
+
* @param type - The type constructor.
|
|
41
|
+
* @returns Array of compliance metadata.
|
|
42
|
+
*/
|
|
43
|
+
static getMetadataForType(type: Function): ComplianceMetadata[] {
|
|
44
|
+
const metadata: ComplianceMetadata[] = [];
|
|
45
|
+
const piiMetadata = getTypePIIMetadata(type);
|
|
46
|
+
if (piiMetadata) {
|
|
47
|
+
metadata.push(piiMetadata);
|
|
48
|
+
}
|
|
49
|
+
return metadata;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a type of compliance metadata.
|
|
6
|
+
*/
|
|
7
|
+
export class ComplianceMetadataType {
|
|
8
|
+
/**
|
|
9
|
+
* Personal Identifiable Information according to the definition in GDPR.
|
|
10
|
+
*/
|
|
11
|
+
static readonly PII = new ComplianceMetadataType('PII');
|
|
12
|
+
|
|
13
|
+
private readonly _value: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Initializes a new instance of ComplianceMetadataType.
|
|
17
|
+
* @param value - The string value of the compliance metadata type.
|
|
18
|
+
*/
|
|
19
|
+
constructor(value: string) {
|
|
20
|
+
this._value = value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Gets the underlying string value.
|
|
25
|
+
*/
|
|
26
|
+
get value(): string {
|
|
27
|
+
return this._value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the string representation of the compliance metadata type.
|
|
32
|
+
*/
|
|
33
|
+
toString(): string {
|
|
34
|
+
return this._value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
|
|
4
|
+
export { ComplianceMetadataType } from './ComplianceMetadataType';
|
|
5
|
+
export type { ComplianceMetadata } from './ComplianceMetadata';
|
|
6
|
+
export { pii, getPIIMetadata, hasPIIMetadata, getTypePIIMetadata, isPII } from './pii';
|
|
7
|
+
export { ComplianceMetadataResolver } from './ComplianceMetadataResolver';
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import type { ComplianceMetadata } from './ComplianceMetadata';
|
|
6
|
+
import { ComplianceMetadataType } from './ComplianceMetadataType';
|
|
7
|
+
import { TypeIntrospector } from '../types';
|
|
8
|
+
|
|
9
|
+
/** Metadata key for PII decorator on properties. */
|
|
10
|
+
const PII_PROPERTY_METADATA_KEY = 'chronicle:compliance:pii:property';
|
|
11
|
+
|
|
12
|
+
/** Metadata key for PII decorator on types. */
|
|
13
|
+
const PII_TYPE_METADATA_KEY = 'chronicle:compliance:pii:type';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Decorator that marks a property or type as containing Personal Identifiable Information (PII)
|
|
17
|
+
* according to the GDPR definition. When applied to read model properties or ConceptAs types,
|
|
18
|
+
* the Chronicle Kernel will encrypt the values using compliance-aware encryption.
|
|
19
|
+
*
|
|
20
|
+
* This decorator can be used in two ways:
|
|
21
|
+
* - As a property decorator: `@pii('details') propertyName: type`
|
|
22
|
+
* - As a class decorator: `@pii('details') class TypeName { }`
|
|
23
|
+
*
|
|
24
|
+
* @param details - Optional details explaining why or to what extent the property/type is classified as PII.
|
|
25
|
+
* @returns A decorator function that can be applied to either properties or classes (but not both on the same target).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* Property usage:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @readModel()
|
|
31
|
+
* class Employee {
|
|
32
|
+
* @pii('Employee social security number')
|
|
33
|
+
* ssn: string = '';
|
|
34
|
+
*
|
|
35
|
+
* @pii('Personal email address')
|
|
36
|
+
* email: string = '';
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* Type usage with ConceptAs:
|
|
42
|
+
* ```typescript
|
|
43
|
+
* @pii('Customer email address')
|
|
44
|
+
* class CustomerEmailConcept extends ConceptAs<string> {}
|
|
45
|
+
* export type CustomerEmail = CustomerEmailConcept | string;
|
|
46
|
+
*
|
|
47
|
+
* @readModel()
|
|
48
|
+
* class Customer {
|
|
49
|
+
* @field(CustomerEmailConcept)
|
|
50
|
+
* email: CustomerEmail = '';
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function pii(details?: string): PropertyDecorator & ClassDecorator {
|
|
55
|
+
return (target: object | Function, propertyKey?: string | symbol) => {
|
|
56
|
+
// Class decorator usage (for types like ConceptAs)
|
|
57
|
+
if (typeof target === 'function' && propertyKey === undefined) {
|
|
58
|
+
const metadata: ComplianceMetadata = {
|
|
59
|
+
metadataType: ComplianceMetadataType.PII,
|
|
60
|
+
details: details ?? ''
|
|
61
|
+
};
|
|
62
|
+
Reflect.defineMetadata(PII_TYPE_METADATA_KEY, metadata, target);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Property decorator usage
|
|
67
|
+
if (propertyKey !== undefined) {
|
|
68
|
+
const key = propertyKey.toString();
|
|
69
|
+
TypeIntrospector.trackProperty((target as { constructor: Function }).constructor, key);
|
|
70
|
+
const metadata: ComplianceMetadata = {
|
|
71
|
+
metadataType: ComplianceMetadataType.PII,
|
|
72
|
+
details: details ?? ''
|
|
73
|
+
};
|
|
74
|
+
Reflect.defineMetadata(PII_PROPERTY_METADATA_KEY, metadata, target, key);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Gets the PII compliance metadata for a property.
|
|
81
|
+
* @param target - The class prototype.
|
|
82
|
+
* @param propertyKey - The property name.
|
|
83
|
+
* @returns The compliance metadata, or undefined if not decorated with @pii.
|
|
84
|
+
*/
|
|
85
|
+
export function getPIIMetadata(target: object, propertyKey: string): ComplianceMetadata | undefined {
|
|
86
|
+
return Reflect.getMetadata(PII_PROPERTY_METADATA_KEY, target, propertyKey);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Checks whether a property has been decorated with @pii.
|
|
91
|
+
* @param target - The class prototype.
|
|
92
|
+
* @param propertyKey - The property name.
|
|
93
|
+
* @returns True if the property has @pii decorator; false otherwise.
|
|
94
|
+
*/
|
|
95
|
+
export function hasPIIMetadata(target: object, propertyKey: string): boolean {
|
|
96
|
+
return Reflect.hasMetadata(PII_PROPERTY_METADATA_KEY, target, propertyKey);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Gets the PII compliance metadata for a type.
|
|
101
|
+
* @param type - The type constructor.
|
|
102
|
+
* @returns The compliance metadata, or undefined if not decorated with @pii.
|
|
103
|
+
*/
|
|
104
|
+
export function getTypePIIMetadata(type: Function): ComplianceMetadata | undefined {
|
|
105
|
+
return Reflect.getMetadata(PII_TYPE_METADATA_KEY, type);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Checks whether a type has been decorated with @pii.
|
|
110
|
+
* @param type - The type constructor.
|
|
111
|
+
* @returns True if the type has @pii decorator; false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
export function isPII(type: Function): boolean {
|
|
114
|
+
return Reflect.hasMetadata(PII_TYPE_METADATA_KEY, type);
|
|
115
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
FailedPartitionsDefinition,
|
|
13
13
|
IdentitiesDefinition,
|
|
14
14
|
JobsDefinition,
|
|
15
|
+
MaterializedReadModelsDefinition,
|
|
15
16
|
NamespacesDefinition,
|
|
16
17
|
ObserversDefinition,
|
|
17
18
|
ProjectionsDefinition,
|
|
@@ -23,9 +24,11 @@ import {
|
|
|
23
24
|
WebhooksDefinition,
|
|
24
25
|
type ConnectionServiceClient
|
|
25
26
|
} from '@cratis/chronicle.contracts';
|
|
27
|
+
import { ComplianceDefinition } from '../compliance/ComplianceContracts';
|
|
26
28
|
import { createChannel, createClientFactory, waitForChannelReady } from 'nice-grpc';
|
|
27
29
|
import type { ClientMiddleware } from 'nice-grpc-common';
|
|
28
30
|
import { Metadata } from 'nice-grpc-common';
|
|
31
|
+
import { EventStoreSubscriptionsDefinition } from '../eventStoreSubscriptions/contracts';
|
|
29
32
|
import { AuthenticationMode, ChronicleConnectionString } from './ChronicleConnectionString';
|
|
30
33
|
import { ChronicleServices } from './ChronicleServices';
|
|
31
34
|
import { ITokenProvider, NoOpTokenProvider, OAuthTokenProvider } from './TokenProvider';
|
|
@@ -146,6 +149,10 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
146
149
|
return this._services.observers;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
get eventStoreSubscriptions() {
|
|
153
|
+
return this._services.eventStoreSubscriptions;
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
get failedPartitions() {
|
|
150
157
|
return this._services.failedPartitions;
|
|
151
158
|
}
|
|
@@ -166,6 +173,10 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
166
173
|
return this._services.readModels;
|
|
167
174
|
}
|
|
168
175
|
|
|
176
|
+
get materializedReadModels() {
|
|
177
|
+
return this._services.materializedReadModels;
|
|
178
|
+
}
|
|
179
|
+
|
|
169
180
|
get jobs() {
|
|
170
181
|
return this._services.jobs;
|
|
171
182
|
}
|
|
@@ -182,6 +193,10 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
182
193
|
return this._services.server;
|
|
183
194
|
}
|
|
184
195
|
|
|
196
|
+
get compliance() {
|
|
197
|
+
return this._services.compliance;
|
|
198
|
+
}
|
|
199
|
+
|
|
185
200
|
get connections(): ConnectionServiceClient {
|
|
186
201
|
return this._connections;
|
|
187
202
|
}
|
|
@@ -243,15 +258,18 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
243
258
|
eventTypes: factory.create(EventTypesDefinition, this._channel),
|
|
244
259
|
constraints: factory.create(ConstraintsDefinition, this._channel),
|
|
245
260
|
observers: factory.create(ObserversDefinition, this._channel),
|
|
261
|
+
eventStoreSubscriptions: factory.create(EventStoreSubscriptionsDefinition, this._channel),
|
|
246
262
|
failedPartitions: factory.create(FailedPartitionsDefinition, this._channel),
|
|
247
263
|
reactors: factory.create(ReactorsDefinition, this._channel),
|
|
248
264
|
reducers: factory.create(ReducersDefinition, this._channel),
|
|
249
265
|
projections: factory.create(ProjectionsDefinition, this._channel),
|
|
250
266
|
readModels: factory.create(ReadModelsDefinition, this._channel),
|
|
267
|
+
materializedReadModels: factory.create(MaterializedReadModelsDefinition, this._channel),
|
|
251
268
|
jobs: factory.create(JobsDefinition, this._channel),
|
|
252
269
|
webhooks: factory.create(WebhooksDefinition, this._channel),
|
|
253
270
|
eventSeeding: factory.create(EventSeedingDefinition, this._channel),
|
|
254
|
-
server: factory.create(ServerDefinition, this._channel)
|
|
271
|
+
server: factory.create(ServerDefinition, this._channel),
|
|
272
|
+
compliance: factory.create(ComplianceDefinition as any, this._channel) as any
|
|
255
273
|
};
|
|
256
274
|
this._connections = factory.create(ConnectionServiceDefinition, this._channel);
|
|
257
275
|
}
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
FailedPartitionsClient,
|
|
11
11
|
IdentitiesClient,
|
|
12
12
|
JobsClient,
|
|
13
|
+
MaterializedReadModelsClient,
|
|
13
14
|
NamespacesClient,
|
|
14
15
|
ObserversClient,
|
|
15
16
|
ProjectionsClient,
|
|
@@ -20,6 +21,8 @@ import type {
|
|
|
20
21
|
ServerClient,
|
|
21
22
|
WebhooksClient
|
|
22
23
|
} from '@cratis/chronicle.contracts';
|
|
24
|
+
import type { ComplianceClient } from '../compliance/ComplianceContracts';
|
|
25
|
+
import type { EventStoreSubscriptionsClient } from '../eventStoreSubscriptions/contracts';
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* Represents all Chronicle gRPC services.
|
|
@@ -33,13 +36,16 @@ export interface ChronicleServices {
|
|
|
33
36
|
eventTypes: EventTypesClient;
|
|
34
37
|
constraints: ConstraintsClient;
|
|
35
38
|
observers: ObserversClient;
|
|
39
|
+
eventStoreSubscriptions: EventStoreSubscriptionsClient;
|
|
36
40
|
failedPartitions: FailedPartitionsClient;
|
|
37
41
|
reactors: ReactorsClient;
|
|
38
42
|
reducers: ReducersClient;
|
|
39
43
|
projections: ProjectionsClient;
|
|
40
44
|
readModels: ReadModelsClient;
|
|
45
|
+
materializedReadModels: MaterializedReadModelsClient;
|
|
41
46
|
jobs: JobsClient;
|
|
42
47
|
webhooks: WebhooksClient;
|
|
43
48
|
eventSeeding: EventSeedingClient;
|
|
44
49
|
server: ServerClient;
|
|
50
|
+
compliance: ComplianceClient;
|
|
45
51
|
}
|
package/dist/EventStore.d.ts
CHANGED
|
@@ -11,10 +11,12 @@ import { IConstraints } from './events/constraints/IConstraints';
|
|
|
11
11
|
import { IProjections } from './projections/IProjections';
|
|
12
12
|
import { IReactors } from './reactors/IReactors';
|
|
13
13
|
import { IReducers } from './reducers/IReducers';
|
|
14
|
+
import { IReadModels } from './readModels/IReadModels';
|
|
14
15
|
import { IEventSeeding } from './seeding/IEventSeeding';
|
|
15
16
|
import { IUnitOfWorkManager } from './transactions/IUnitOfWorkManager';
|
|
16
17
|
import { IJobs } from './jobs/IJobs';
|
|
17
18
|
import { IWebhooks } from './webhooks/IWebhooks';
|
|
19
|
+
import { IEventStoreSubscriptions } from './eventStoreSubscriptions/IEventStoreSubscriptions';
|
|
18
20
|
/**
|
|
19
21
|
* Implements {@link IEventStore} by communicating with the Chronicle Kernel
|
|
20
22
|
* via gRPC using the provided {@link ChronicleConnection}.
|
|
@@ -30,9 +32,11 @@ export declare class EventStore implements IEventStore {
|
|
|
30
32
|
readonly projections: IProjections;
|
|
31
33
|
readonly reactors: IReactors;
|
|
32
34
|
readonly reducers: IReducers;
|
|
35
|
+
readonly readModels: IReadModels;
|
|
33
36
|
readonly unitOfWorkManager: IUnitOfWorkManager;
|
|
34
37
|
readonly jobs: IJobs;
|
|
35
38
|
readonly webhooks: IWebhooks;
|
|
39
|
+
readonly subscriptions: IEventStoreSubscriptions;
|
|
36
40
|
readonly seeding: IEventSeeding;
|
|
37
41
|
private readonly _sequences;
|
|
38
42
|
constructor(name: EventStoreName, namespace: EventStoreNamespaceName, _connection: ChronicleConnection, lifecycle: ConnectionLifecycle);
|
package/dist/EventStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventStore.d.ts","sourceRoot":"","sources":["../EventStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAA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AAE,CAAC;CAiB5D"}
|
package/dist/EventStore.js
CHANGED
|
@@ -11,12 +11,14 @@ import { Constraints } from './events/constraints/Constraints';
|
|
|
11
11
|
import { Projections } from './projections/Projections';
|
|
12
12
|
import { Reactors } from './reactors/Reactors';
|
|
13
13
|
import { Reducers } from './reducers/Reducers';
|
|
14
|
+
import { ReadModels } from './readModels/ReadModels';
|
|
14
15
|
import { EventSeeding } from './seeding/EventSeeding';
|
|
15
16
|
import { ChronicleTracer } from './Tracing';
|
|
16
17
|
import { DefaultClientArtifactsProvider } from './artifacts/DefaultClientArtifactsProvider';
|
|
17
18
|
import { UnitOfWorkManager } from './transactions/UnitOfWorkManager';
|
|
18
19
|
import { Jobs } from './jobs/Jobs';
|
|
19
20
|
import { Webhooks } from './webhooks/Webhooks';
|
|
21
|
+
import { EventStoreSubscriptions } from './eventStoreSubscriptions/EventStoreSubscriptions';
|
|
20
22
|
/**
|
|
21
23
|
* Implements {@link IEventStore} by communicating with the Chronicle Kernel
|
|
22
24
|
* via gRPC using the provided {@link ChronicleConnection}.
|
|
@@ -34,9 +36,11 @@ export class EventStore {
|
|
|
34
36
|
projections;
|
|
35
37
|
reactors;
|
|
36
38
|
reducers;
|
|
39
|
+
readModels;
|
|
37
40
|
unitOfWorkManager;
|
|
38
41
|
jobs;
|
|
39
42
|
webhooks;
|
|
43
|
+
subscriptions;
|
|
40
44
|
seeding;
|
|
41
45
|
_sequences = new Map();
|
|
42
46
|
constructor(name, namespace, _connection, lifecycle) {
|
|
@@ -52,8 +56,10 @@ export class EventStore {
|
|
|
52
56
|
this.projections = new Projections(name.value, _connection, artifacts);
|
|
53
57
|
this.reactors = new Reactors(artifacts, _connection, name.value, namespace.value, lifecycle);
|
|
54
58
|
this.reducers = new Reducers(artifacts, _connection, name.value, namespace.value, lifecycle);
|
|
59
|
+
this.readModels = new ReadModels(name.value, namespace.value, _connection, artifacts);
|
|
55
60
|
this.jobs = new Jobs(name.value, namespace.value, _connection);
|
|
56
61
|
this.webhooks = new Webhooks(name.value, _connection, this.eventTypes, artifacts);
|
|
62
|
+
this.subscriptions = new EventStoreSubscriptions(this.eventTypes, name.value, _connection);
|
|
57
63
|
this.seeding = new EventSeeding(name.value, _connection, artifacts);
|
|
58
64
|
}
|
|
59
65
|
/**
|
package/dist/EventStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventStore.js","sourceRoot":"","sources":["../EventStore.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAInE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"EventStore.js","sourceRoot":"","sources":["../EventStore.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE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AK,CAAC,CAAC;YAC5D,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;gBAClG,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;gBACzG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC5C,OAAO,MAAM,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACvE,IAAI,CAAC,eAAe,CAAC,KAAc,CAAC,CAAC;gBACrC,MAAM,KAAK,CAAC;YAChB,CAAC;oBAAS,CAAC;gBACP,IAAI,CAAC,GAAG,EAAE,CAAC;YACf,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/IEventStore.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { IUnitOfWorkManager } from './transactions/IUnitOfWorkManager';
|
|
|
12
12
|
import { IJobs } from './jobs/IJobs';
|
|
13
13
|
import { IWebhooks } from './webhooks/IWebhooks';
|
|
14
14
|
import { IEventSeeding } from './seeding/IEventSeeding';
|
|
15
|
+
import { IEventStoreSubscriptions } from './eventStoreSubscriptions/IEventStoreSubscriptions';
|
|
16
|
+
import { IReadModels } from './readModels/IReadModels';
|
|
15
17
|
/**
|
|
16
18
|
* Defines the API surface for an event store.
|
|
17
19
|
* An event store is a logical grouping of event sequences within a namespace.
|
|
@@ -33,12 +35,16 @@ export interface IEventStore {
|
|
|
33
35
|
readonly reactors: IReactors;
|
|
34
36
|
/** The reducers manager for this event store. */
|
|
35
37
|
readonly reducers: IReducers;
|
|
38
|
+
/** The read-models manager for this event store. */
|
|
39
|
+
readonly readModels: IReadModels;
|
|
36
40
|
/** The unit of work manager for transaction-scoped appends. */
|
|
37
41
|
readonly unitOfWorkManager: IUnitOfWorkManager;
|
|
38
42
|
/** The jobs manager for this event store. */
|
|
39
43
|
readonly jobs: IJobs;
|
|
40
44
|
/** The webhooks manager for this event store. */
|
|
41
45
|
readonly webhooks: IWebhooks;
|
|
46
|
+
/** The event store subscriptions manager for this event store. */
|
|
47
|
+
readonly subscriptions: IEventStoreSubscriptions;
|
|
42
48
|
/** The event seeding manager for this event store. */
|
|
43
49
|
readonly seeding: IEventSeeding;
|
|
44
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEventStore.d.ts","sourceRoot":"","sources":["../IEventStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,O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