@cratis/chronicle 6.56.0 → 6.58.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 +2 -2
- package/WellKnownTelemetryNames.ts +2 -0
- package/auditing/CausationType.ts +5 -0
- package/dist/EventStore.js +2 -2
- package/dist/EventStore.js.map +1 -1
- 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/auditing/CausationType.d.ts +4 -0
- package/dist/auditing/CausationType.d.ts.map +1 -1
- package/dist/auditing/CausationType.js +4 -0
- package/dist/auditing/CausationType.js.map +1 -1
- package/dist/eventSequences/CompensateOptions.d.ts +7 -0
- package/dist/eventSequences/CompensateOptions.d.ts.map +1 -0
- package/dist/eventSequences/CompensateOptions.js +4 -0
- package/dist/eventSequences/CompensateOptions.js.map +1 -0
- package/dist/eventSequences/EventSequence.d.ts +3 -0
- package/dist/eventSequences/EventSequence.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +45 -0
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventSequences/IEventSequence.d.ts +13 -0
- package/dist/eventSequences/IEventSequence.d.ts.map +1 -1
- package/dist/eventSequences/index.d.ts +1 -0
- package/dist/eventSequences/index.d.ts.map +1 -1
- package/dist/eventSequences/index.js.map +1 -1
- package/dist/events/EventContext.d.ts +5 -0
- package/dist/events/EventContext.d.ts.map +1 -1
- package/dist/events/compensationForDecorator.d.ts +32 -0
- package/dist/events/compensationForDecorator.d.ts.map +1 -0
- package/dist/events/compensationForDecorator.js +44 -0
- package/dist/events/compensationForDecorator.js.map +1 -0
- package/dist/events/eventTypeDecorator.d.ts +7 -0
- package/dist/events/eventTypeDecorator.d.ts.map +1 -1
- package/dist/events/eventTypeDecorator.js +13 -4
- package/dist/events/eventTypeDecorator.js.map +1 -1
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -1
- package/dist/events/index.js.map +1 -1
- package/dist/events/toClientEventContext.d.ts.map +1 -1
- package/dist/events/toClientEventContext.js +20 -0
- package/dist/events/toClientEventContext.js.map +1 -1
- package/dist/observation/batches/BatchContext.d.ts +43 -0
- package/dist/observation/batches/BatchContext.d.ts.map +1 -0
- package/dist/observation/batches/BatchContext.js +60 -0
- package/dist/observation/batches/BatchContext.js.map +1 -0
- package/dist/observation/batches/BatchContextObserver.d.ts +14 -0
- package/dist/observation/batches/BatchContextObserver.d.ts.map +1 -0
- package/dist/observation/batches/BatchContextObserver.js +4 -0
- package/dist/observation/batches/BatchContextObserver.js.map +1 -0
- package/dist/observation/batches/BatchContextValues.d.ts +13 -0
- package/dist/observation/batches/BatchContextValues.d.ts.map +1 -0
- package/dist/observation/batches/BatchContextValues.js +4 -0
- package/dist/observation/batches/BatchContextValues.js.map +1 -0
- package/dist/observation/batches/BatchMethod.d.ts +9 -0
- package/dist/observation/batches/BatchMethod.d.ts.map +1 -0
- package/dist/observation/batches/BatchMethod.js +4 -0
- package/dist/observation/batches/BatchMethod.js.map +1 -0
- package/dist/observation/batches/BatchMethodReturnedAValue.d.ts +12 -0
- package/dist/observation/batches/BatchMethodReturnedAValue.d.ts.map +1 -0
- package/dist/observation/batches/BatchMethodReturnedAValue.js +20 -0
- package/dist/observation/batches/BatchMethodReturnedAValue.js.map +1 -0
- package/dist/observation/batches/BatchMethods.d.ts +31 -0
- package/dist/observation/batches/BatchMethods.d.ts.map +1 -0
- package/dist/observation/batches/BatchMethods.js +81 -0
- package/dist/observation/batches/BatchMethods.js.map +1 -0
- package/dist/observation/batches/BatchOutcome.d.ts +15 -0
- package/dist/observation/batches/BatchOutcome.d.ts.map +1 -0
- package/dist/observation/batches/BatchOutcome.js +4 -0
- package/dist/observation/batches/BatchOutcome.js.map +1 -0
- package/dist/observation/batches/BatchOutcomeKind.d.ts +8 -0
- package/dist/observation/batches/BatchOutcomeKind.d.ts.map +1 -0
- package/dist/observation/batches/BatchOutcomeKind.js +11 -0
- package/dist/observation/batches/BatchOutcomeKind.js.map +1 -0
- package/dist/observation/batches/DeferralNotSupportedByKernel.d.ts +13 -0
- package/dist/observation/batches/DeferralNotSupportedByKernel.d.ts.map +1 -0
- package/dist/observation/batches/DeferralNotSupportedByKernel.js +19 -0
- package/dist/observation/batches/DeferralNotSupportedByKernel.js.map +1 -0
- package/dist/observation/batches/DeliveredPartition.d.ts +11 -0
- package/dist/observation/batches/DeliveredPartition.d.ts.map +1 -0
- package/dist/observation/batches/DeliveredPartition.js +4 -0
- package/dist/observation/batches/DeliveredPartition.js.map +1 -0
- package/dist/observation/batches/EventAndContext.d.ts +28 -0
- package/dist/observation/batches/EventAndContext.d.ts.map +1 -0
- package/dist/observation/batches/EventAndContext.js +35 -0
- package/dist/observation/batches/EventAndContext.js.map +1 -0
- package/dist/observation/batches/EventBatch.d.ts +52 -0
- package/dist/observation/batches/EventBatch.d.ts.map +1 -0
- package/dist/observation/batches/EventBatch.js +92 -0
- package/dist/observation/batches/EventBatch.js.map +1 -0
- package/dist/observation/batches/EventTypeObservedByMoreThanOneMethod.d.ts +14 -0
- package/dist/observation/batches/EventTypeObservedByMoreThanOneMethod.d.ts.map +1 -0
- package/dist/observation/batches/EventTypeObservedByMoreThanOneMethod.js +23 -0
- package/dist/observation/batches/EventTypeObservedByMoreThanOneMethod.js.map +1 -0
- package/dist/observation/batches/InvalidBatchMethod.d.ts +13 -0
- package/dist/observation/batches/InvalidBatchMethod.d.ts.map +1 -0
- package/dist/observation/batches/InvalidBatchMethod.js +20 -0
- package/dist/observation/batches/InvalidBatchMethod.js.map +1 -0
- package/dist/observation/batches/ObservationOrigin.d.ts +21 -0
- package/dist/observation/batches/ObservationOrigin.d.ts.map +1 -0
- package/dist/observation/batches/ObservationOrigin.js +32 -0
- package/dist/observation/batches/ObservationOrigin.js.map +1 -0
- package/dist/observation/batches/ObservedEventType.d.ts +11 -0
- package/dist/observation/batches/ObservedEventType.d.ts.map +1 -0
- package/dist/observation/batches/ObservedEventType.js +4 -0
- package/dist/observation/batches/ObservedEventType.js.map +1 -0
- package/dist/observation/batches/PageMessages.d.ts +22 -0
- package/dist/observation/batches/PageMessages.d.ts.map +1 -0
- package/dist/observation/batches/PageMessages.js +32 -0
- package/dist/observation/batches/PageMessages.js.map +1 -0
- package/dist/observation/batches/PartitionFailedInBatch.d.ts +10 -0
- package/dist/observation/batches/PartitionFailedInBatch.d.ts.map +1 -0
- package/dist/observation/batches/PartitionFailedInBatch.js +16 -0
- package/dist/observation/batches/PartitionFailedInBatch.js.map +1 -0
- package/dist/observation/batches/PartitionNotInBatch.d.ts +10 -0
- package/dist/observation/batches/PartitionNotInBatch.d.ts.map +1 -0
- package/dist/observation/batches/PartitionNotInBatch.js +16 -0
- package/dist/observation/batches/PartitionNotInBatch.js.map +1 -0
- package/dist/observation/batches/PartitionOutcome.d.ts +19 -0
- package/dist/observation/batches/PartitionOutcome.d.ts.map +1 -0
- package/dist/observation/batches/PartitionOutcome.js +4 -0
- package/dist/observation/batches/PartitionOutcome.js.map +1 -0
- package/dist/observation/batches/PartitionProblem.d.ts +17 -0
- package/dist/observation/batches/PartitionProblem.d.ts.map +1 -0
- package/dist/observation/batches/PartitionProblem.js +4 -0
- package/dist/observation/batches/PartitionProblem.js.map +1 -0
- package/dist/observation/batches/PartitionSettlement.d.ts +29 -0
- package/dist/observation/batches/PartitionSettlement.d.ts.map +1 -0
- package/dist/observation/batches/PartitionSettlement.js +64 -0
- package/dist/observation/batches/PartitionSettlement.js.map +1 -0
- package/dist/observation/batches/ReducerMixesBatchAndPerEventMethods.d.ts +12 -0
- package/dist/observation/batches/ReducerMixesBatchAndPerEventMethods.d.ts.map +1 -0
- package/dist/observation/batches/ReducerMixesBatchAndPerEventMethods.js +20 -0
- package/dist/observation/batches/ReducerMixesBatchAndPerEventMethods.js.map +1 -0
- package/dist/observation/batches/batchSize.d.ts +42 -0
- package/dist/observation/batches/batchSize.d.ts.map +1 -0
- package/dist/observation/batches/batchSize.js +55 -0
- package/dist/observation/batches/batchSize.js.map +1 -0
- package/dist/observation/batches/createBatchContext.d.ts +13 -0
- package/dist/observation/batches/createBatchContext.d.ts.map +1 -0
- package/dist/observation/batches/createBatchContext.js +27 -0
- package/dist/observation/batches/createBatchContext.js.map +1 -0
- package/dist/observation/batches/observes.d.ts +39 -0
- package/dist/observation/batches/observes.d.ts.map +1 -0
- package/dist/observation/batches/observes.js +63 -0
- package/dist/observation/batches/observes.js.map +1 -0
- package/dist/observation/batches/runConcurrently.d.ts +9 -0
- package/dist/observation/batches/runConcurrently.d.ts.map +1 -0
- package/dist/observation/batches/runConcurrently.js +22 -0
- package/dist/observation/batches/runConcurrently.js.map +1 -0
- package/dist/observation/createHandlerInstanceValidator.d.ts +1 -1
- package/dist/observation/createHandlerInstanceValidator.d.ts.map +1 -1
- package/dist/observation/createHandlerInstanceValidator.js +5 -7
- package/dist/observation/createHandlerInstanceValidator.js.map +1 -1
- package/dist/observation/getInstanceMethods.d.ts +3 -1
- package/dist/observation/getInstanceMethods.d.ts.map +1 -1
- package/dist/observation/getInstanceMethods.js +13 -4
- package/dist/observation/getInstanceMethods.js.map +1 -1
- package/dist/observation/index.d.ts +14 -0
- package/dist/observation/index.d.ts.map +1 -1
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -1
- package/dist/projections/eventContextPropertyExpression.js +1 -1
- package/dist/projections/eventContextPropertyExpression.js.map +1 -1
- package/dist/reactors/ReactorDispatcher.d.ts +15 -0
- package/dist/reactors/ReactorDispatcher.d.ts.map +1 -1
- package/dist/reactors/ReactorDispatcher.js +25 -2
- package/dist/reactors/ReactorDispatcher.js.map +1 -1
- package/dist/reactors/ReactorObservationTarget.d.ts +45 -0
- package/dist/reactors/ReactorObservationTarget.d.ts.map +1 -0
- package/dist/reactors/ReactorObservationTarget.js +4 -0
- package/dist/reactors/ReactorObservationTarget.js.map +1 -0
- package/dist/reactors/ReactorPageDispatcher.d.ts +33 -0
- package/dist/reactors/ReactorPageDispatcher.d.ts.map +1 -0
- package/dist/reactors/ReactorPageDispatcher.js +293 -0
- package/dist/reactors/ReactorPageDispatcher.js.map +1 -0
- package/dist/reactors/Reactors.d.ts.map +1 -1
- package/dist/reactors/Reactors.js +21 -149
- package/dist/reactors/Reactors.js.map +1 -1
- package/dist/reactors/for_Reactors/given/observe_reactor_messages.d.ts +14 -0
- package/dist/reactors/for_Reactors/given/observe_reactor_messages.d.ts.map +1 -0
- package/dist/reactors/for_Reactors/given/observe_reactor_messages.js +61 -0
- package/dist/reactors/for_Reactors/given/observe_reactor_messages.js.map +1 -0
- package/dist/reactors/index.d.ts +2 -0
- package/dist/reactors/index.d.ts.map +1 -1
- package/dist/reactors/index.js +1 -0
- package/dist/reactors/index.js.map +1 -1
- package/dist/reducers/ReducerEventDispatcher.d.ts +26 -1
- package/dist/reducers/ReducerEventDispatcher.d.ts.map +1 -1
- package/dist/reducers/ReducerEventDispatcher.js +35 -3
- package/dist/reducers/ReducerEventDispatcher.js.map +1 -1
- package/dist/reducers/Reducers.d.ts +2 -0
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +94 -22
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/reducers/ReductionOutcome.d.ts +27 -3
- package/dist/reducers/ReductionOutcome.d.ts.map +1 -1
- package/dist/reducers/ReductionOutcome.js +51 -7
- package/dist/reducers/ReductionOutcome.js.map +1 -1
- package/dist/reducers/for_Reducers/given/observe_reducer_messages.d.ts +19 -0
- package/dist/reducers/for_Reducers/given/observe_reducer_messages.d.ts.map +1 -0
- package/dist/reducers/for_Reducers/given/observe_reducer_messages.js +61 -0
- package/dist/reducers/for_Reducers/given/observe_reducer_messages.js.map +1 -0
- package/dist/reducers/index.d.ts +2 -0
- package/dist/reducers/index.d.ts.map +1 -1
- package/dist/reducers/index.js +1 -0
- package/dist/reducers/index.js.map +1 -1
- package/dist/schemas/JsonSchema.d.ts +2 -0
- package/dist/schemas/JsonSchema.d.ts.map +1 -1
- package/dist/testing/InProcessEventSequence.d.ts +1 -0
- 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/testing/ReactorScenario.d.ts.map +1 -1
- package/dist/testing/ReactorScenario.js +4 -1
- package/dist/testing/ReactorScenario.js.map +1 -1
- package/dist/testing/ReducerReadModelProcessor.d.ts +1 -0
- package/dist/testing/ReducerReadModelProcessor.d.ts.map +1 -1
- package/dist/testing/ReducerReadModelProcessor.js +45 -0
- package/dist/testing/ReducerReadModelProcessor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eventSequences/CompensateOptions.ts +10 -0
- package/eventSequences/EventSequence.compensate.spec.ts +72 -0
- package/eventSequences/EventSequence.ts +51 -0
- package/eventSequences/IEventSequence.ts +14 -0
- package/eventSequences/index.ts +1 -0
- package/events/EventContext.ts +6 -0
- package/events/compensationFor.spec.ts +73 -0
- package/events/compensationForDecorator.ts +48 -0
- package/events/eventTypeDecorator.ts +13 -4
- package/events/index.ts +2 -1
- package/events/toClientEventContext.ts +21 -0
- package/observation/batches/BatchContext.ts +75 -0
- package/observation/batches/BatchContextObserver.ts +16 -0
- package/observation/batches/BatchContextValues.ts +16 -0
- package/observation/batches/BatchMethod.ts +13 -0
- package/observation/batches/BatchMethodReturnedAValue.ts +16 -0
- package/observation/batches/BatchMethods.ts +90 -0
- package/observation/batches/BatchOutcome.ts +22 -0
- package/observation/batches/BatchOutcomeKind.ts +11 -0
- package/observation/batches/DeferralNotSupportedByKernel.ts +17 -0
- package/observation/batches/DeliveredPartition.ts +16 -0
- package/observation/batches/EventAndContext.ts +37 -0
- package/observation/batches/EventBatch.ts +105 -0
- package/observation/batches/EventTypeObservedByMoreThanOneMethod.ts +17 -0
- package/observation/batches/InvalidBatchMethod.ts +16 -0
- package/observation/batches/ObservationOrigin.ts +37 -0
- package/observation/batches/ObservedEventType.ts +16 -0
- package/observation/batches/PageMessages.ts +37 -0
- package/observation/batches/PartitionFailedInBatch.ts +14 -0
- package/observation/batches/PartitionNotInBatch.ts +14 -0
- package/observation/batches/PartitionOutcome.ts +22 -0
- package/observation/batches/PartitionProblem.ts +25 -0
- package/observation/batches/PartitionSettlement.ts +70 -0
- package/observation/batches/ReducerMixesBatchAndPerEventMethods.ts +16 -0
- package/observation/batches/batchSize.ts +79 -0
- package/observation/batches/createBatchContext.ts +32 -0
- package/observation/batches/for_BatchMethods/when_discovering_batch_methods.spec.ts +155 -0
- package/observation/batches/for_EventBatch/when_reporting_outcomes.spec.ts +66 -0
- package/observation/batches/for_PartitionSettlement/when_settling_a_partition.spec.ts +31 -0
- package/observation/batches/for_batchSize/when_declaring_bounds.spec.ts +23 -0
- package/observation/batches/for_observes/when_decorating_methods.legacy.spec.ts +28 -0
- package/observation/batches/for_observes/when_decorating_methods.spec.ts +33 -0
- package/observation/batches/for_runConcurrently/when_running_items.spec.ts +22 -0
- package/observation/batches/observes.ts +68 -0
- package/observation/batches/runConcurrently.ts +23 -0
- package/observation/createHandlerInstanceValidator.ts +5 -7
- package/observation/getInstanceMethods.ts +13 -4
- package/observation/index.ts +14 -0
- package/package.json +2 -2
- package/projections/eventContextPropertyExpression.ts +2 -2
- package/reactors/ReactorDispatcher.ts +27 -2
- package/reactors/ReactorObservationTarget.ts +48 -0
- package/reactors/ReactorPageDispatcher.ts +321 -0
- package/reactors/Reactors.ts +22 -164
- package/reactors/for_Reactors/given/observe_reactor_messages.ts +72 -0
- package/reactors/for_Reactors/when_delivering_pages/as_a_legacy_single_partition.spec.ts +51 -0
- package/reactors/for_Reactors/when_delivering_pages/returning_a_value_from_a_batch_method.spec.ts +34 -0
- package/reactors/for_Reactors/when_delivering_pages/with_batch_and_per_event_methods.spec.ts +81 -0
- package/reactors/for_Reactors/when_delivering_pages/with_batch_outcomes.spec.ts +86 -0
- package/reactors/for_Reactors/when_delivering_pages/with_per_event_handlers.spec.ts +52 -0
- package/reactors/index.ts +2 -0
- package/reducers/ReducerEventDispatcher.ts +44 -3
- package/reducers/Reducers.ts +109 -25
- package/reducers/ReductionOutcome.ts +55 -8
- package/reducers/for_Reducers/given/observe_reducer_messages.ts +77 -0
- package/reducers/for_Reducers/when_delivering_pages/to_a_batch_reducer.spec.ts +111 -0
- package/reducers/for_Reducers/when_delivering_pages/to_a_per_event_reducer.spec.ts +53 -0
- package/reducers/index.ts +2 -0
- package/schemas/JsonSchema.ts +2 -0
- 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/when_naming_spans/with_convention_names.spec.ts +2 -1
- package/testing/InProcessEventSequence.ts +1 -0
- package/testing/ReactorScenario.ts +5 -1
- package/testing/ReducerReadModelProcessor.ts +44 -0
- package/testing/for_ReactorScenario/when_the_reactor_has_a_batch_method.spec.ts +26 -0
- package/testing/for_ReadModelScenario/when_reducing_with_a_batch_method/with_events_for_two_event_sources.spec.ts +43 -0
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/** Captures @handles prototype methods during preflight and rejects instance properties hiding them, except bound methods. */
|
|
3
|
+
import { describeExplicitHandler, getInstanceMethods } from './getInstanceMethods.js';
|
|
4
|
+
/** Captures @handles and @observes prototype methods during preflight and rejects instance properties hiding them, except bound methods. */
|
|
6
5
|
export function createHandlerInstanceValidator(type, names, methods = getInstanceMethods(type)) {
|
|
7
|
-
const handlers = [...new Set(names)].filter(name =>
|
|
6
|
+
const handlers = [...new Set(names)].filter(name => describeExplicitHandler(methods.get(name)) !== undefined).map(name => {
|
|
8
7
|
const method = methods.get(name);
|
|
9
8
|
let declaring = type.prototype;
|
|
10
9
|
while (declaring && Object.getOwnPropertyDescriptor(declaring, name)?.value !== method) {
|
|
11
10
|
declaring = Object.getPrototypeOf(declaring);
|
|
12
11
|
}
|
|
13
|
-
const
|
|
14
|
-
const declaration = `@handles(${eventType.name})`;
|
|
12
|
+
const declaration = describeExplicitHandler(method);
|
|
15
13
|
return { name, method, declaration, declaringType: declaring?.constructor.name ?? type.name };
|
|
16
14
|
});
|
|
17
15
|
return instance => {
|
|
@@ -23,7 +21,7 @@ export function createHandlerInstanceValidator(type, names, methods = getInstanc
|
|
|
23
21
|
if (current === instance && typeof value === 'function' && isBoundCopyOf(value, method))
|
|
24
22
|
continue;
|
|
25
23
|
if (current === instance || !current || value !== method) {
|
|
26
|
-
throw new Error(`Override '${name}' on '${type.name}' hides ${declaration} declared on '${declaringType}'; use a method with @handles instead of an instance field.`);
|
|
24
|
+
throw new Error(`Override '${name}' on '${type.name}' hides ${declaration} declared on '${declaringType}'; use a method with ${declaration.startsWith('@observes') ? '@observes' : '@handles'} instead of an instance field.`);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHandlerInstanceValidator.js","sourceRoot":"","sources":["../../observation/createHandlerInstanceValidator.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createHandlerInstanceValidator.js","sourceRoot":"","sources":["../../observation/createHandlerInstanceValidator.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEtF,4IAA4I;AAC5I,MAAM,UAAU,8BAA8B,CAAC,IAAiB,EAAE,KAAuB,EAAE,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAEzH,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KA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AAE,SAAS;YAClG,IAAI,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;gBACvD,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,IAAI,CAAC,IAAI,WAAW,WAAW,iBAAiB,aAAa,wBAAwB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,gCAAgC,CAAC,CAAC;YACnO,CAAC;QACL,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,KAAe,EAAE,MAAgB;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC;AACnG,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
-
/** Finds prototype methods without invoking getters; explicit handlers require explicitly decorated overrides. */
|
|
2
|
+
/** Finds prototype methods without invoking getters; explicit handlers and batch methods require explicitly decorated overrides. */
|
|
3
3
|
export declare function getInstanceMethods(type: Constructor): Map<string, Function>;
|
|
4
|
+
/** Describes the explicit handler decorator of a method, or undefined when it has none. */
|
|
5
|
+
export declare function describeExplicitHandler(method: Function): string | undefined;
|
|
4
6
|
//# sourceMappingURL=getInstanceMethods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInstanceMethods.d.ts","sourceRoot":"","sources":["../../observation/getInstanceMethods.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getInstanceMethods.d.ts","sourceRoot":"","sources":["../../observation/getInstanceMethods.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,oIAAoI;AACpI,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAqB3E;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAK5E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
import { getHandledEventType } from '../events/handles.js';
|
|
4
|
-
|
|
4
|
+
import { getObservedEventTypes } from './batches/observes.js';
|
|
5
|
+
/** Finds prototype methods without invoking getters; explicit handlers and batch methods require explicitly decorated overrides. */
|
|
5
6
|
export function getInstanceMethods(type) {
|
|
6
7
|
const methods = new Map();
|
|
7
8
|
const declaringTypes = new Map();
|
|
@@ -12,10 +13,10 @@ export function getInstanceMethods(type) {
|
|
|
12
13
|
const method = Object.getOwnPropertyDescriptor(current, name)?.value;
|
|
13
14
|
const declaringType = declaringTypes.get(name);
|
|
14
15
|
if (declaringType !== undefined) {
|
|
15
|
-
const
|
|
16
|
+
const declaration = typeof method === 'function' ? describeExplicitHandler(method) : undefined;
|
|
16
17
|
const override = methods.get(name);
|
|
17
|
-
if (
|
|
18
|
-
throw new Error(`Override '${name}' on '${declaringType}' hides
|
|
18
|
+
if (declaration && (!override || describeExplicitHandler(override) === undefined)) {
|
|
19
|
+
throw new Error(`Override '${name}' on '${declaringType}' hides ${declaration} declared on '${current.constructor.name}'; redecorate the override.`);
|
|
19
20
|
}
|
|
20
21
|
continue;
|
|
21
22
|
}
|
|
@@ -26,4 +27,12 @@ export function getInstanceMethods(type) {
|
|
|
26
27
|
}
|
|
27
28
|
return methods;
|
|
28
29
|
}
|
|
30
|
+
/** Describes the explicit handler decorator of a method, or undefined when it has none. */
|
|
31
|
+
export function describeExplicitHandler(method) {
|
|
32
|
+
const eventType = getHandledEventType(method);
|
|
33
|
+
if (eventType)
|
|
34
|
+
return `@handles(${eventType.name})`;
|
|
35
|
+
const observed = getObservedEventTypes(method);
|
|
36
|
+
return observed.length > 0 ? observed.map(type => `@observes(${type.name})`).join(' ') : undefined;
|
|
37
|
+
}
|
|
29
38
|
//# sourceMappingURL=getInstanceMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInstanceMethods.js","sourceRoot":"","sources":["../../observation/getInstanceMethods.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getInstanceMethods.js","sourceRoot":"","sources":["../../observation/getInstanceMethods.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,oIAAoI;AACpI,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IAChD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjD,KAAK,IAAI,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,IAAI,OAAO,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QACnH,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;YACrD,IAAI,IAAI,KAAK,aAAa;gBAAE,SAAS;YACrC,MAAM,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;YACrE,MAAM,aAAa,GAAG,cAAc,CAAC,G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AC"}
|
|
@@ -18,4 +18,18 @@ export type { IObservers } from './IObservers.js';
|
|
|
18
18
|
export { Observers } from './Observers.js';
|
|
19
19
|
export type { ICanBeNotifiedWhenReplay } from './ICanBeNotifiedWhenReplay.js';
|
|
20
20
|
export type { ICanBeNotifiedWhenPartitionReplayed } from './ICanBeNotifiedWhenPartitionReplayed.js';
|
|
21
|
+
export { observes } from './batches/observes.js';
|
|
22
|
+
export { batchSize } from './batches/batchSize.js';
|
|
23
|
+
export type { BatchSizeOptions } from './batches/batchSize.js';
|
|
24
|
+
export { EventBatch } from './batches/EventBatch.js';
|
|
25
|
+
export { EventAndContext } from './batches/EventAndContext.js';
|
|
26
|
+
export { BatchContext } from './batches/BatchContext.js';
|
|
27
|
+
export { ObservationOrigin } from './batches/ObservationOrigin.js';
|
|
28
|
+
export { PartitionNotInBatch } from './batches/PartitionNotInBatch.js';
|
|
29
|
+
export { PartitionFailedInBatch } from './batches/PartitionFailedInBatch.js';
|
|
30
|
+
export { DeferralNotSupportedByKernel } from './batches/DeferralNotSupportedByKernel.js';
|
|
31
|
+
export { EventTypeObservedByMoreThanOneMethod } from './batches/EventTypeObservedByMoreThanOneMethod.js';
|
|
32
|
+
export { InvalidBatchMethod } from './batches/InvalidBatchMethod.js';
|
|
33
|
+
export { ReducerMixesBatchAndPerEventMethods } from './batches/ReducerMixesBatchAndPerEventMethods.js';
|
|
34
|
+
export { BatchMethodReturnedAValue } from './batches/BatchMethodReturnedAValue.js';
|
|
21
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../observation/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,sBAAsB,EAAE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mB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mCAAmC,EAAE,MAAM,kDAAkD,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -11,4 +11,17 @@ export { toObserverRemovalOutcome, toObserverRemovalResult } from './toObserverR
|
|
|
11
11
|
export { FastForwardOutcome } from './FastForwardOutcome.js';
|
|
12
12
|
export { toFastForwardOutcome, toFastForwardResult } from './toFastForwardResult.js';
|
|
13
13
|
export { Observers } from './Observers.js';
|
|
14
|
+
export { observes } from './batches/observes.js';
|
|
15
|
+
export { batchSize } from './batches/batchSize.js';
|
|
16
|
+
export { EventBatch } from './batches/EventBatch.js';
|
|
17
|
+
export { EventAndContext } from './batches/EventAndContext.js';
|
|
18
|
+
export { BatchContext } from './batches/BatchContext.js';
|
|
19
|
+
export { ObservationOrigin } from './batches/ObservationOrigin.js';
|
|
20
|
+
export { PartitionNotInBatch } from './batches/PartitionNotInBatch.js';
|
|
21
|
+
export { PartitionFailedInBatch } from './batches/PartitionFailedInBatch.js';
|
|
22
|
+
export { DeferralNotSupportedByKernel } from './batches/DeferralNotSupportedByKernel.js';
|
|
23
|
+
export { EventTypeObservedByMoreThanOneMethod } from './batches/EventTypeObservedByMoreThanOneMethod.js';
|
|
24
|
+
export { InvalidBatchMethod } from './batches/InvalidBatchMethod.js';
|
|
25
|
+
export { ReducerMixesBatchAndPerEventMethods } from './batches/ReducerMixesBatchAndPerEventMethods.js';
|
|
26
|
+
export { BatchMethodReturnedAValue } from './batches/BatchMethodReturnedAValue.js';
|
|
14
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../observation/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../observation/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mCAAmC,EAAE,MAAM,kDAAkD,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -20,7 +20,7 @@ const contextProperties = {
|
|
|
20
20
|
correlationId: true,
|
|
21
21
|
causation: true,
|
|
22
22
|
tags: true
|
|
23
|
-
// eventSource and
|
|
23
|
+
// eventSource, namedTags and compensationFor are deliberately not projectable: their kernel resolution is not part of the
|
|
24
24
|
// supported expression set.
|
|
25
25
|
};
|
|
26
26
|
// Mirror the kernel's DerivedPropertyFunctions registry: Week() applies to dates only.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventContextPropertyExpression.js","sourceRoot":"","sources":["../../projections/eventContextPropertyExpression.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,6FAA6F;AAC7F,gGAAgG;AAChG,MAAM,iBAAiB,GAAG;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,
|
|
1
|
+
{"version":3,"file":"eventContextPropertyExpression.js","sourceRoot":"","sources":["../../projections/eventContextPropertyExpression.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,6FAA6F;AAC7F,gGAAgG;AAChG,MAAM,iBAAiB,GAAG;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,0HAA0H;IA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C,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtG,OAAO,iBAAiB,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;AACjF,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Constructor } from '@cratis/fundamentals';
|
|
2
2
|
import type { ActivatedArtifact } from '../artifacts/ActivatedArtifact.js';
|
|
3
3
|
import type { EventContext } from '../events/EventContext.js';
|
|
4
|
+
import type { BatchMethod } from '../observation/batches/BatchMethod.js';
|
|
4
5
|
import type { ReactorServices } from './ReactorServices.js';
|
|
5
6
|
import type { ReactorDelivery } from './ReactorDelivery.js';
|
|
6
7
|
/** Internal handler catalog shared by live observations and in-process deliveries. */
|
|
@@ -10,6 +11,20 @@ export interface ReactorEventTypeEntry {
|
|
|
10
11
|
readonly methodName?: string;
|
|
11
12
|
readonly replayMethodName?: string;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Discovers the batch methods of a reactor, the methods decorated with \`@observes\`.
|
|
16
|
+
* @param reactorType - The reactor class.
|
|
17
|
+
* @param registeredTypes - The event types registered with the event store.
|
|
18
|
+
* @returns The batch methods.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getReactorBatchMethods(reactorType: Constructor, registeredTypes: readonly Constructor[]): BatchMethod[];
|
|
21
|
+
/**
|
|
22
|
+
* Discovers the per-event handlers of a reactor and checks that each event type reaches exactly one method,
|
|
23
|
+
* a batch method or a per-event method.
|
|
24
|
+
* @param reactorType - The reactor class.
|
|
25
|
+
* @param registeredTypes - The event types registered with the event store.
|
|
26
|
+
* @returns The per-event handler entries.
|
|
27
|
+
*/
|
|
13
28
|
export declare function getReactorEventTypes(reactorType: Constructor, registeredTypes: readonly Constructor[]): ReactorEventTypeEntry[];
|
|
14
29
|
export declare function selectReactorHandler(entries: readonly ReactorEventTypeEntry[], reactorType: Constructor, instance: Record<string, Function> | undefined, id: string | undefined, observationState: number): {
|
|
15
30
|
methodName: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactorDispatcher.d.ts","sourceRoot":"","sources":["../../reactors/ReactorDispatcher.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactorDispatcher.d.ts","sourceRoot":"","sources":["../../reactors/ReactorDispatcher.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAEvH;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,WAAW,EAAE,GAAG,qBAAqB,EAAE,CAkD/H;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,EAAE,WAAW,EAAE,WAAW,EACpG,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,gBAAgB,EAAE,MAAM,GAChG;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAOzF;AAED,uFAAuF;AACvF,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAChH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,GAAG,SAAS,EAC9F,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7F"}
|
|
@@ -7,10 +7,29 @@ import { getEventTypeMetadata } from '../events/eventTypeDecorator.js';
|
|
|
7
7
|
import { getHandledEventType } from '../events/handles.js';
|
|
8
8
|
import { getEventHandlers } from '../observation/getEventHandlers.js';
|
|
9
9
|
import { getInstanceMethods } from '../observation/getInstanceMethods.js';
|
|
10
|
+
import { assertEachEventTypeReachesOneMethod, getBatchMethods, withoutBatchMethods } from '../observation/batches/BatchMethods.js';
|
|
10
11
|
import { isOnceOnly } from './onceOnly.js';
|
|
11
12
|
import { getReplayEventType } from './replay.js';
|
|
13
|
+
/**
|
|
14
|
+
* Discovers the batch methods of a reactor, the methods decorated with \`@observes\`.
|
|
15
|
+
* @param reactorType - The reactor class.
|
|
16
|
+
* @param registeredTypes - The event types registered with the event store.
|
|
17
|
+
* @returns The batch methods.
|
|
18
|
+
*/
|
|
19
|
+
export function getReactorBatchMethods(reactorType, registeredTypes) {
|
|
20
|
+
return getBatchMethods(reactorType, registeredTypes);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Discovers the per-event handlers of a reactor and checks that each event type reaches exactly one method,
|
|
24
|
+
* a batch method or a per-event method.
|
|
25
|
+
* @param reactorType - The reactor class.
|
|
26
|
+
* @param registeredTypes - The event types registered with the event store.
|
|
27
|
+
* @returns The per-event handler entries.
|
|
28
|
+
*/
|
|
12
29
|
export function getReactorEventTypes(reactorType, registeredTypes) {
|
|
13
|
-
const
|
|
30
|
+
const allMethods = getInstanceMethods(reactorType);
|
|
31
|
+
const batchMethods = getBatchMethods(reactorType, registeredTypes, allMethods);
|
|
32
|
+
const methods = withoutBatchMethods(allMethods, batchMethods);
|
|
14
33
|
const replayHandlers = new Map();
|
|
15
34
|
const eventTypes = new Map();
|
|
16
35
|
for (const eventTypeClass of registeredTypes) {
|
|
@@ -50,7 +69,11 @@ export function getReactorEventTypes(reactorType, registeredTypes) {
|
|
|
50
69
|
entries.set(eventType.id, { id: eventType.id, generation: eventType.generation, ...entries.get(eventType.id), replayMethodName });
|
|
51
70
|
}
|
|
52
71
|
}
|
|
53
|
-
|
|
72
|
+
const handlers = [...entries.values()];
|
|
73
|
+
assertEachEventTypeReachesOneMethod(reactorType, batchMethods, handlers.map(handler => ({
|
|
74
|
+
id: handler.id, methodNames: [handler.methodName, handler.replayMethodName].filter((name) => !!name)
|
|
75
|
+
})));
|
|
76
|
+
return handlers;
|
|
54
77
|
}
|
|
55
78
|
export function selectReactorHandler(entries, reactorType, instance, id, observationState) {
|
|
56
79
|
const entry = entries.find(candidate => candidate.id === id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactorDispatcher.js","sourceRoot":"","sources":["../../reactors/ReactorDispatcher.ts"],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MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,IAAK,WAAW,CAAC,SAAsC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpI,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,IAAI,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;AACxG,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAAqD,EAAE,UAAkB,EAChH,OAAgC,EAAE,OAAqB,EAAE,QAAqC,EAC9F,YAA+C,EAAE,QAAyB;IAC1E,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACzF,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,EAAE,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { ClientArtifactsActivator } from '../artifacts/ClientArtifactsActivator.js';
|
|
3
|
+
import type { IEventLog } from '../eventSequences/IEventLog.js';
|
|
4
|
+
import type { createLogger } from '../logging/createLogger.js';
|
|
5
|
+
import type { IChronicleLogger } from '../logging/IChronicleLogger.js';
|
|
6
|
+
import type { BatchMethod } from '../observation/batches/BatchMethod.js';
|
|
7
|
+
import type { ReactorEventTypeEntry } from './ReactorDispatcher.js';
|
|
8
|
+
import type { ReactorResultHandler } from './ReactorResultHandler.js';
|
|
9
|
+
import type { ReactorServices } from './ReactorServices.js';
|
|
10
|
+
/** Everything a {@link ReactorPageDispatcher} needs to know about one reactor observation. */
|
|
11
|
+
export interface ReactorObservationTarget {
|
|
12
|
+
/** The reactor identifier. */
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/** The reactor class. */
|
|
15
|
+
readonly reactorType: Constructor;
|
|
16
|
+
/** The event sequence the reactor observes. */
|
|
17
|
+
readonly eventSequenceId: string;
|
|
18
|
+
/** The event store the reactor is registered with. */
|
|
19
|
+
readonly eventStoreName: string;
|
|
20
|
+
/** The namespace the reactor is registered in. */
|
|
21
|
+
readonly namespace: string;
|
|
22
|
+
/** The per-event handlers. */
|
|
23
|
+
readonly entries: readonly ReactorEventTypeEntry[];
|
|
24
|
+
/** The batch methods. */
|
|
25
|
+
readonly batchMethods: readonly BatchMethod[];
|
|
26
|
+
/** Rejects instances whose fields hide decorated methods. */
|
|
27
|
+
readonly validateInstance: (instance: object) => void;
|
|
28
|
+
/** The long-lived reactor instance, or undefined when instances are activated per delivery. */
|
|
29
|
+
readonly reactorInstance: Record<string, Function> | undefined;
|
|
30
|
+
/** The services handed to per-event handlers. */
|
|
31
|
+
readonly services: ReactorServices | undefined;
|
|
32
|
+
/** Aborted when the observation stops. */
|
|
33
|
+
readonly signal: AbortSignal;
|
|
34
|
+
/** The event log side effects returned by per-event handlers are appended to. */
|
|
35
|
+
readonly eventLog: IEventLog;
|
|
36
|
+
/** Optional handler of side-effect results. */
|
|
37
|
+
readonly resultHandler?: ReactorResultHandler;
|
|
38
|
+
/** Optional per-delivery activator. */
|
|
39
|
+
readonly artifactActivator?: ClientArtifactsActivator;
|
|
40
|
+
/** The reactor logger. */
|
|
41
|
+
readonly logger: ReturnType<typeof createLogger>;
|
|
42
|
+
/** The connection logger, for activation diagnostics. */
|
|
43
|
+
readonly connectionLogger?: IChronicleLogger;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ReactorObservationTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Re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E,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC/D,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IAC/C,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAC9C,uCAAuC;IACvC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IACtD,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACjD,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactorObservationTarget.js","sourceRoot":"","sources":["../../reactors/ReactorObservationTarget.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type EventsToObserve, type ReactorResult } from '@cratis/chronicle.contracts';
|
|
2
|
+
import type { ReactorObservationTarget } from './ReactorObservationTarget.js';
|
|
3
|
+
/**
|
|
4
|
+
* Dispatches one delivery of a reactor observation, a page of partitions or a legacy single partition, to its batch and
|
|
5
|
+
* per-event methods, and settles each partition on its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ReactorPageDispatcher {
|
|
8
|
+
private readonly _target;
|
|
9
|
+
private readonly _batchEventTypes;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new {@link ReactorPageDispatcher}.
|
|
12
|
+
* @param _target - The {@link ReactorObservationTarget}.
|
|
13
|
+
*/
|
|
14
|
+
constructor(_target: ReactorObservationTarget);
|
|
15
|
+
/**
|
|
16
|
+
* Dispatches a delivery and creates the result to send back to the kernel.
|
|
17
|
+
* @param message - The {@link EventsToObserve} delivered.
|
|
18
|
+
* @returns The {@link ReactorResult}.
|
|
19
|
+
*/
|
|
20
|
+
dispatch(message: EventsToObserve): Promise<ReactorResult>;
|
|
21
|
+
private notifyReplayTransition;
|
|
22
|
+
private observe;
|
|
23
|
+
private firstInvocableEvent;
|
|
24
|
+
private select;
|
|
25
|
+
private observeWith;
|
|
26
|
+
private observeBatches;
|
|
27
|
+
private invokeBatchMethod;
|
|
28
|
+
private observePartition;
|
|
29
|
+
private toEventAndContext;
|
|
30
|
+
private deliveryFor;
|
|
31
|
+
private createBatchContext;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ReactorPageDispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactorPageDispatcher.d.ts","sourceRoot":"","sources":["../../reactors/ReactorPageDispatcher.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqD,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAwB1I,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAU9E;;;GAGG;AACH,qBAAa,qBAAqB;IAOlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkE;IAEnG;;;OAGG;IACH,YAA6B,OAAO,EAAE,wBAAwB,EAG7D;IAED;;;;OAIG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAc/D;YAEa,sBAAsB;YA8BtB,OAAO;IAyBrB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,MAAM;YAKA,WAAW;YAYX,cAAc;YA0Bd,iBAAiB;YA0BjB,gBAAgB;IAqC9B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,kBAAkB;CAI7B"}
|