@cratis/chronicle 6.55.0 → 6.56.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/WellKnownTelemetryNames.ts +2 -0
- package/connection/ChronicleConnection.auth.spec.ts +2 -0
- package/connection/for_TraceContextMiddleware/when_calling/with_active_context.spec.ts +1 -0
- package/connection/for_TraceContextMiddleware/when_calling/with_grpc_instrumentation.spec.ts +1 -0
- package/dist/WellKnownTelemetryNames.d.ts +2 -0
- package/dist/WellKnownTelemetryNames.d.ts.map +1 -1
- package/dist/WellKnownTelemetryNames.js +2 -0
- package/dist/WellKnownTelemetryNames.js.map +1 -1
- package/dist/eventSequences/EventSequence.d.ts +3 -0
- package/dist/eventSequences/EventSequence.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +29 -1
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventSequences/IEventSequence.d.ts +12 -0
- package/dist/eventSequences/IEventSequence.d.ts.map +1 -1
- package/dist/externalServices/ExternalServiceBuilder.js +1 -1
- package/dist/externalServices/ExternalServiceBuilder.js.map +1 -1
- package/dist/reactors/Reactors.d.ts.map +1 -1
- package/dist/reactors/Reactors.js +6 -2
- package/dist/reactors/Reactors.js.map +1 -1
- package/dist/readModels/for_ReadModels/given/a_stored_read_model.d.ts.map +1 -1
- package/dist/readModels/for_ReadModels/given/a_stored_read_model.js +1 -1
- package/dist/readModels/for_ReadModels/given/a_stored_read_model.js.map +1 -1
- package/dist/readModels/indexDecorator.js +1 -1
- package/dist/readModels/indexDecorator.js.map +1 -1
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +2 -1
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/reducers/ReductionOutcome.d.ts.map +1 -1
- package/dist/reducers/ReductionOutcome.js +4 -1
- package/dist/reducers/ReductionOutcome.js.map +1 -1
- package/dist/testing/InProcessEventSequence.d.ts +2 -1
- package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
- package/dist/testing/InProcessEventSequence.js +1 -0
- package/dist/testing/InProcessEventSequence.js.map +1 -1
- package/dist/webhooks/WebhookDefinitionBuilder.d.ts.map +1 -1
- package/dist/webhooks/WebhookDefinitionBuilder.js +4 -2
- package/dist/webhooks/WebhookDefinitionBuilder.js.map +1 -1
- package/dist/webhooks/Webhooks.d.ts.map +1 -1
- package/dist/webhooks/Webhooks.js +2 -1
- package/dist/webhooks/Webhooks.js.map +1 -1
- package/eventSequences/EventSequence.spec.ts +55 -0
- package/eventSequences/EventSequence.ts +30 -1
- package/eventSequences/IEventSequence.ts +13 -0
- package/externalServices/ExternalServiceBuilder.ts +1 -1
- package/externalServices/ExternalServices.spec.ts +1 -1
- package/for_ChronicleClient/when_starting_background_work/with_a_correlated_caller.spec.ts +1 -0
- package/package.json +2 -2
- package/reactors/Reactors.ts +6 -2
- package/readModels/for_ReadModels/given/a_stored_read_model.ts +1 -1
- package/readModels/indexDecorator.legacy.spec.ts +7 -7
- package/readModels/indexDecorator.ts +1 -1
- package/readModels/indexRegistration.spec.ts +4 -4
- package/readModels/standardFallbacks.standard.spec.ts +2 -2
- package/reducers/Reducers.ts +2 -1
- package/reducers/ReductionOutcome.ts +4 -1
- package/telemetry/for_ChronicleTelemetry/given/a_client.fixture.ts +1 -0
- package/telemetry/for_ChronicleTelemetry/given/a_span_name_registry.fixture.ts +2 -0
- package/telemetry/for_ChronicleTelemetry/given/an_event_sequence.fixture.ts +2 -1
- package/telemetry/for_ChronicleTelemetry/when_naming_spans/with_convention_names.spec.ts +1 -0
- package/telemetry/for_ChronicleTelemetry/when_recording_identifiers/with_per_client_privacy.spec.ts +2 -1
- package/testing/InProcessEventSequence.ts +1 -0
- package/webhooks/WebhookDefinitionBuilder.ts +4 -2
- package/webhooks/Webhooks.ts +2 -1
package/reactors/Reactors.ts
CHANGED
|
@@ -289,7 +289,8 @@ export class Reactors implements IReactors {
|
|
|
289
289
|
EventSourceType: getEventSourceTypeFor(reactorType),
|
|
290
290
|
EventStreamType: getEventStreamTypeFor(reactorType)
|
|
291
291
|
}
|
|
292
|
-
}
|
|
292
|
+
},
|
|
293
|
+
PageDelivery: undefined
|
|
293
294
|
},
|
|
294
295
|
Value1: undefined
|
|
295
296
|
}
|
|
@@ -441,7 +442,10 @@ export class Reactors implements IReactors {
|
|
|
441
442
|
State: state,
|
|
442
443
|
LastSuccessfulObservation: lastSuccessfullyObservedEvent,
|
|
443
444
|
ExceptionMessages: exceptionMessages,
|
|
444
|
-
ExceptionStackTrace: exceptionStackTrace
|
|
445
|
+
ExceptionStackTrace: exceptionStackTrace,
|
|
446
|
+
DeliveryId: 0n,
|
|
447
|
+
RetryAfterMilliseconds: 0n,
|
|
448
|
+
Partitions: []
|
|
445
449
|
}
|
|
446
450
|
}
|
|
447
451
|
});
|
|
@@ -44,7 +44,7 @@ export class AccountDocument {
|
|
|
44
44
|
|
|
45
45
|
export class a_stored_read_model {
|
|
46
46
|
readonly release = vi.fn<(request: ReleaseRequest) => Promise<ReleaseResponse>>()
|
|
47
|
-
.mockImplementation(async request => ({ HasError: false, Error: '', Payload: request.Payload }));
|
|
47
|
+
.mockImplementation(async request => ({ HasError: false, Error: '', Payload: request.Payload, FailedProperties: [], Strict: false }));
|
|
48
48
|
readonly readModels: IReadModels;
|
|
49
49
|
|
|
50
50
|
constructor() {
|
|
@@ -57,15 +57,15 @@ describe('read-model index registration with legacy decorators', () => {
|
|
|
57
57
|
expect.objectContaining({
|
|
58
58
|
ObserverIdentifier: 'indexed-orders',
|
|
59
59
|
Indexes: [
|
|
60
|
-
{ PropertyPath: 'customerId' },
|
|
61
|
-
{ PropertyPath: 'number' },
|
|
62
|
-
{ PropertyPath: 'address.zipCode' },
|
|
63
|
-
{ PropertyPath: 'lines.productId' }
|
|
60
|
+
{ PropertyPath: 'customerId', Properties: [] },
|
|
61
|
+
{ PropertyPath: 'number', Properties: [] },
|
|
62
|
+
{ PropertyPath: 'address.zipCode', Properties: [] },
|
|
63
|
+
{ PropertyPath: 'lines.productId', Properties: [] }
|
|
64
64
|
]
|
|
65
65
|
}),
|
|
66
66
|
expect.objectContaining({
|
|
67
67
|
ObserverIdentifier: 'reduced-orders',
|
|
68
|
-
Indexes: [{ PropertyPath: 'number' }]
|
|
68
|
+
Indexes: [{ PropertyPath: 'number', Properties: [] }]
|
|
69
69
|
})
|
|
70
70
|
]
|
|
71
71
|
}));
|
|
@@ -76,8 +76,8 @@ describe('read-model index registration with legacy decorators', () => {
|
|
|
76
76
|
const connection = { readModels: { registerMany } } as unknown as ChronicleConnection;
|
|
77
77
|
await new ReadModels('test', 'Default', connection, artifacts, 'sink').register(Order);
|
|
78
78
|
expect(registerMany.mock.calls[0][0].ReadModels[0].Indexes).toEqual([
|
|
79
|
-
{ PropertyPath: 'customerId' }, { PropertyPath: 'number' },
|
|
80
|
-
{ PropertyPath: 'address.zipCode' }, { PropertyPath: 'lines.productId' }
|
|
79
|
+
{ PropertyPath: 'customerId', Properties: [] }, { PropertyPath: 'number', Properties: [] },
|
|
80
|
+
{ PropertyPath: 'address.zipCode', Properties: [] }, { PropertyPath: 'lines.productId', Properties: [] }
|
|
81
81
|
]);
|
|
82
82
|
});
|
|
83
83
|
});
|
|
@@ -41,7 +41,7 @@ export function getIndexesForType(type: Function): IndexDefinition[] {
|
|
|
41
41
|
for (const [name, memberType] of TypeIntrospector.getMembers(current)) {
|
|
42
42
|
const path = prefix ? `${prefix}.${name}` : name;
|
|
43
43
|
if (hasPropertyMetadata(INDEX_METADATA_KEY, current.prototype, name)) {
|
|
44
|
-
indexes.push({ PropertyPath: path });
|
|
44
|
+
indexes.push({ PropertyPath: path, Properties: [] });
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const nestedType = memberType === Array
|
|
@@ -74,19 +74,19 @@ describe('when registering indexed read models through the startup paths', () =>
|
|
|
74
74
|
it('should send indexes for a declarative projection', async () => {
|
|
75
75
|
const { value, registerMany } = connection();
|
|
76
76
|
await new Projections('store', 'Default', value, artifacts([], [DeclarativeProjection]), 'sink').register();
|
|
77
|
-
expect(indexesFor(registerMany, 'DeclarativeModel')).toEqual([{ PropertyPath: 'reference' }]);
|
|
77
|
+
expect(indexesFor(registerMany, 'DeclarativeModel')).toEqual([{ PropertyPath: 'reference', Properties: [] }]);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('should send indexes for a model-bound projection', async () => {
|
|
81
81
|
const { value, registerMany } = connection();
|
|
82
82
|
await new Projections('store', 'Default', value, artifacts([ModelBoundModel]), 'sink').register();
|
|
83
|
-
expect(indexesFor(registerMany, 'ModelBoundModel')).toEqual([{ PropertyPath: 'reference' }]);
|
|
83
|
+
expect(indexesFor(registerMany, 'ModelBoundModel')).toEqual([{ PropertyPath: 'reference', Properties: [] }]);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('should send indexes for a model-bound variant', async () => {
|
|
87
87
|
const { value, registerMany } = connection();
|
|
88
88
|
await new Projections('store', 'Default', value, artifacts([IndexedVariant]), 'sink').register();
|
|
89
|
-
expect(indexesFor(registerMany, 'IndexedVariant')).toEqual([{ PropertyPath: 'reference' }]);
|
|
89
|
+
expect(indexesFor(registerMany, 'IndexedVariant')).toEqual([{ PropertyPath: 'reference', Properties: [] }]);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
it('should send indexes for a reducer read model', async () => {
|
|
@@ -94,6 +94,6 @@ describe('when registering indexed read models through the startup paths', () =>
|
|
|
94
94
|
const reducers = new Reducers(artifacts([], [], [IndexedReducer]), value, 'store', 'Default', new ConnectionLifecycle(), 'sink');
|
|
95
95
|
await reducers.register();
|
|
96
96
|
reducers.dispose();
|
|
97
|
-
expect(indexesFor(registerMany, 'ReducedModel')).toEqual([{ PropertyPath: 'reference' }]);
|
|
97
|
+
expect(indexesFor(registerMany, 'ReducedModel')).toEqual([{ PropertyPath: 'reference', Properties: [] }]);
|
|
98
98
|
});
|
|
99
99
|
});
|
|
@@ -46,8 +46,8 @@ describe('inferred read models with standard decorators', () => {
|
|
|
46
46
|
expect(registerMany).toHaveBeenCalledWith(expect.objectContaining({
|
|
47
47
|
ReadModels: [expect.objectContaining({
|
|
48
48
|
Indexes: [
|
|
49
|
-
{ PropertyPath: 'customerId' },
|
|
50
|
-
{ PropertyPath: 'lines.productId' }
|
|
49
|
+
{ PropertyPath: 'customerId', Properties: [] },
|
|
50
|
+
{ PropertyPath: 'lines.productId', Properties: [] }
|
|
51
51
|
]
|
|
52
52
|
})]
|
|
53
53
|
}));
|
package/reducers/Reducers.ts
CHANGED
|
@@ -67,7 +67,10 @@ export class ReductionOutcome {
|
|
|
67
67
|
LastSuccessfulObservation: this.lastSuccessfullyObservedEvent,
|
|
68
68
|
ExceptionMessages: this.exceptionMessages,
|
|
69
69
|
ExceptionStackTrace: this.exceptionStackTrace,
|
|
70
|
-
ReadModelState: readModelState ?? ''
|
|
70
|
+
ReadModelState: readModelState ?? '',
|
|
71
|
+
DeliveryId: 0n,
|
|
72
|
+
RetryAfterMilliseconds: 0n,
|
|
73
|
+
Partitions: []
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
};
|
|
@@ -28,6 +28,7 @@ vi.mock('../../../connection/ChronicleConnection.js', () => ({
|
|
|
28
28
|
fromSequenceNumber: async () => ({ IsAuthorized: true, Data: [] }),
|
|
29
29
|
redact: async () => ({}),
|
|
30
30
|
redactForEventSource: async () => ({}),
|
|
31
|
+
copyEventsForEventSource: async () => ({ Response: { lo: 1n, hi: 2n } }),
|
|
31
32
|
completeStream: async () => ({ Response: { IsSuccess: true, SequenceNumber: 42n } })
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -11,6 +11,7 @@ export const legacySpans = {
|
|
|
11
11
|
getFromSequenceNumber: 'chronicle.event_sequences.get_from_sequence_number',
|
|
12
12
|
redact: 'chronicle.event_sequences.redact',
|
|
13
13
|
redactForEventSource: 'chronicle.event_sequences.redact_for_event_source',
|
|
14
|
+
copyForEventSource: 'chronicle.event_sequences.copy_for_event_source',
|
|
14
15
|
completeStream: 'chronicle.event_sequences.complete_stream',
|
|
15
16
|
getEventStore: 'chronicle.client.get_event_store',
|
|
16
17
|
getEventStores: 'chronicle.client.get_event_stores',
|
|
@@ -26,6 +27,7 @@ export const conventionSpans = {
|
|
|
26
27
|
getFromSequenceNumber: 'cratis.chronicle.client.event_sequence.get_from_sequence_number',
|
|
27
28
|
redact: 'cratis.chronicle.client.event_sequence.redact',
|
|
28
29
|
redactForEventSource: 'cratis.chronicle.client.event_sequence.redact_for_event_source',
|
|
30
|
+
copyForEventSource: 'cratis.chronicle.client.event_sequence.copy_for_event_source',
|
|
29
31
|
completeStream: 'cratis.chronicle.client.event_sequence.complete_stream',
|
|
30
32
|
getEventStore: 'cratis.chronicle.client.event_store.get',
|
|
31
33
|
getEventStores: 'cratis.chronicle.client.event_store.list',
|
|
@@ -21,7 +21,8 @@ export function eventSequence(telemetry?: ChronicleTelemetryOptions) {
|
|
|
21
21
|
forEventSourceIdAndEventTypes: vi.fn().mockResolvedValue({ IsAuthorized: true, Data: [] }),
|
|
22
22
|
fromSequenceNumber: vi.fn().mockResolvedValue({ IsAuthorized: true, Data: [] }),
|
|
23
23
|
redact: vi.fn().mockResolvedValue({}),
|
|
24
|
-
redactForEventSource: vi.fn().mockResolvedValue({})
|
|
24
|
+
redactForEventSource: vi.fn().mockResolvedValue({}),
|
|
25
|
+
copyEventsForEventSource: vi.fn().mockResolvedValue({ Response: { lo: 1n, hi: 2n } })
|
|
25
26
|
};
|
|
26
27
|
const connection = { eventSequences: services } as unknown as ChronicleConnection;
|
|
27
28
|
return { services, sequence: new EventSequence(EventSequenceId.eventLog, 'store', 'namespace', connection,
|
|
@@ -27,6 +27,7 @@ const operations = {
|
|
|
27
27
|
getFromSequenceNumber: (sequence: IEventSequence) => sequence.getFromSequenceNumber(sequenceNumber),
|
|
28
28
|
redact: (sequence: IEventSequence) => sequence.redact(sequenceNumber, 'reason'),
|
|
29
29
|
redactForEventSource: (sequence: IEventSequence) => sequence.redactForEventSource('source', 'reason'),
|
|
30
|
+
copyForEventSource: (sequence: IEventSequence) => sequence.copy('source', 'target'),
|
|
30
31
|
completeStream: (sequence: IEventSequence) => sequence.completeStream('stream-type', 'stream-id')
|
|
31
32
|
};
|
|
32
33
|
|
package/telemetry/for_ChronicleTelemetry/when_recording_identifiers/with_per_client_privacy.spec.ts
CHANGED
|
@@ -30,10 +30,11 @@ for (const [label, policy, expected] of [
|
|
|
30
30
|
await sequence.getForEventSourceIdAndEventTypes(source, [Recorded]);
|
|
31
31
|
await sequence.getFromSequenceNumber(new EventSequenceNumber(1n), source);
|
|
32
32
|
await sequence.redactForEventSource(source, 'private reason');
|
|
33
|
+
await sequence.copy(source, 'target');
|
|
33
34
|
services.append.mock.calls[0][0].EventSourceId.should.equal(source);
|
|
34
35
|
});
|
|
35
36
|
it('should apply the policy only to the canonical name on every operation', () => {
|
|
36
|
-
telemetry.spans.getFinishedSpans().should.have.lengthOf(
|
|
37
|
+
telemetry.spans.getFinishedSpans().should.have.lengthOf(9);
|
|
37
38
|
for (const span of telemetry.spans.getFinishedSpans()) {
|
|
38
39
|
should.equal(span.attributes['cratis.event_source.id'], expected);
|
|
39
40
|
should.equal(span.attributes['chronicle.event_source_id'], undefined);
|
|
@@ -395,6 +395,7 @@ export class InProcessEventSequence implements IEventSequence {
|
|
|
395
395
|
|
|
396
396
|
async redact(): Promise<void> { throw this.unsupported('redact', this.id.value, 'Redaction requires kernel storage.'); }
|
|
397
397
|
async redactForEventSource(): Promise<void> { throw this.unsupported('redactForEventSource', this.id.value, 'Redaction requires kernel storage.'); }
|
|
398
|
+
async copy(): Promise<Guid> { throw this.unsupported('copy', this.id.value, 'Copying events requires kernel jobs.'); }
|
|
398
399
|
async completeStream(): Promise<CompleteStreamResult> { throw this.unsupported('completeStream', this.id.value, 'Stream completion requires a kernel.'); }
|
|
399
400
|
|
|
400
401
|
private filterIds(types?: Constructor[]): string[] {
|
|
@@ -70,7 +70,8 @@ export class WebhookDefinitionBuilder implements IWebhookDefinitionBuilder {
|
|
|
70
70
|
const value: OAuthAuthorization = {
|
|
71
71
|
Authority: authority,
|
|
72
72
|
ClientId: clientId,
|
|
73
|
-
ClientSecret: clientSecret
|
|
73
|
+
ClientSecret: clientSecret,
|
|
74
|
+
Scope: ''
|
|
74
75
|
};
|
|
75
76
|
this._authorization = {
|
|
76
77
|
Value0: undefined,
|
|
@@ -136,7 +137,8 @@ export class WebhookDefinitionBuilder implements IWebhookDefinitionBuilder {
|
|
|
136
137
|
Target: {
|
|
137
138
|
Url: targetUrl.value,
|
|
138
139
|
Authorization: this._authorization,
|
|
139
|
-
Headers: Object.fromEntries(this._headers)
|
|
140
|
+
Headers: Object.fromEntries(this._headers),
|
|
141
|
+
ManagedIdentity: undefined
|
|
140
142
|
},
|
|
141
143
|
IsReplayable: this._isReplayable,
|
|
142
144
|
IsActive: this._isActive,
|
package/webhooks/Webhooks.ts
CHANGED
|
@@ -99,7 +99,8 @@ export class Webhooks implements IWebhooks {
|
|
|
99
99
|
Target: {
|
|
100
100
|
Url: webhook.Url,
|
|
101
101
|
Authorization: undefined,
|
|
102
|
-
Headers: webhook.Headers
|
|
102
|
+
Headers: webhook.Headers,
|
|
103
|
+
ManagedIdentity: undefined
|
|
103
104
|
},
|
|
104
105
|
IsReplayable: webhook.IsReplayable,
|
|
105
106
|
IsActive: webhook.IsActive,
|