@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchOutcome.js","sourceRoot":"","sources":["../../../observation/batches/BatchOutcome.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What a batch method reported for a partition. */
|
|
2
|
+
export declare enum BatchOutcomeKind {
|
|
3
|
+
/** The partition failed. */
|
|
4
|
+
Failed = "failed",
|
|
5
|
+
/** The partition is delivered again later, without failing. */
|
|
6
|
+
Deferred = "deferred"
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=BatchOutcomeKind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchOutcomeKind.d.ts","sourceRoot":"","sources":["../../../observation/batches/BatchOutcomeKind.ts"],"names":[],"mappings":"AAGA,oDAAoD;AACpD,oBAAY,gBAAgB;IACxB,4BAA4B;IAC5B,MAAM,WAAW;IAEjB,+DAA+D;IAC/D,QAAQ,aAAa;CACxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/** What a batch method reported for a partition. */
|
|
4
|
+
export var BatchOutcomeKind;
|
|
5
|
+
(function (BatchOutcomeKind) {
|
|
6
|
+
/** The partition failed. */
|
|
7
|
+
BatchOutcomeKind["Failed"] = "failed";
|
|
8
|
+
/** The partition is delivered again later, without failing. */
|
|
9
|
+
BatchOutcomeKind["Deferred"] = "deferred";
|
|
10
|
+
})(BatchOutcomeKind || (BatchOutcomeKind = {}));
|
|
11
|
+
//# sourceMappingURL=BatchOutcomeKind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchOutcomeKind.js","sourceRoot":"","sources":["../../../observation/batches/BatchOutcomeKind.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,oDAAoD;AACpD,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IACxB,4BAA4B;IAC5B,qCAAiB,CAAA;IAEjB,+DAA+D;IAC/D,yCAAqB,CAAA;AACzB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reported when a batch method defers a partition but the kernel does not accept deferred partitions,
|
|
3
|
+
* so the partition is failed instead.
|
|
4
|
+
*/
|
|
5
|
+
export declare class DeferralNotSupportedByKernel extends Error {
|
|
6
|
+
readonly partition: string;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link DeferralNotSupportedByKernel}.
|
|
9
|
+
* @param partition - The partition that was deferred.
|
|
10
|
+
*/
|
|
11
|
+
constructor(partition: string);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DeferralNotSupportedByKernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeferralNotSupportedByKernel.d.ts","sourceRoot":"","sources":["../../../observation/batches/DeferralNotSupportedByKernel.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAKvC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAJtC;;;OAGG;IACH,YAAqB,SAAS,EAAE,MAAM,EAGrC;CACJ"}
|
|
@@ -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
|
+
* Reported when a batch method defers a partition but the kernel does not accept deferred partitions,
|
|
5
|
+
* so the partition is failed instead.
|
|
6
|
+
*/
|
|
7
|
+
export class DeferralNotSupportedByKernel extends Error {
|
|
8
|
+
partition;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new {@link DeferralNotSupportedByKernel}.
|
|
11
|
+
* @param partition - The partition that was deferred.
|
|
12
|
+
*/
|
|
13
|
+
constructor(partition) {
|
|
14
|
+
super(`Partition '${partition}' was deferred, but the kernel does not accept deferred partitions. The partition is failed instead.`);
|
|
15
|
+
this.partition = partition;
|
|
16
|
+
this.name = 'DeferralNotSupportedByKernel';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=DeferralNotSupportedByKernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeferralNotSupportedByKernel.js","sourceRoot":"","sources":["../../../observation/batches/DeferralNotSupportedByKernel.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAK9B,SAAS;IAJ9B;;;OAGG;IACH,YAAqB,SAAiB;QAClC,KAAK,CAAC,cAAc,SAAS,sGAAsG,CAAC,CAAC;yBADpH,SAAS;QAE1B,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC/C,CAAC;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AppendedEvent } from '@cratis/chronicle.contracts';
|
|
2
|
+
/** The events of one partition in a delivery. */
|
|
3
|
+
export interface DeliveredPartition {
|
|
4
|
+
/** The partition. */
|
|
5
|
+
readonly partition: string;
|
|
6
|
+
/** The events of the partition, in sequence order. */
|
|
7
|
+
readonly events: readonly AppendedEvent[];
|
|
8
|
+
/** The stored read model state as JSON, for reducers. */
|
|
9
|
+
readonly initialState: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=DeliveredPartition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeliveredPartition.d.ts","sourceRoot":"","sources":["../../../observation/batches/DeliveredPartition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IAC/B,qBAAqB;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAE1C,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeliveredPartition.js","sourceRoot":"","sources":["../../../observation/batches/DeliveredPartition.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { EventContext } from '../../events/EventContext.js';
|
|
3
|
+
import type { ReactorDelivery } from '../../reactors/ReactorDelivery.js';
|
|
4
|
+
/**
|
|
5
|
+
* One event in an {@link EventBatch}: its content, its context and the event type it was registered as.
|
|
6
|
+
* The content is the deserialized JSON of the event, as per-event handlers receive it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EventAndContext<TEvent = unknown> {
|
|
9
|
+
readonly event: TEvent;
|
|
10
|
+
readonly context: EventContext;
|
|
11
|
+
readonly eventType: Constructor;
|
|
12
|
+
readonly delivery?: ReactorDelivery | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link EventAndContext}.
|
|
15
|
+
* @param event - The content of the event.
|
|
16
|
+
* @param context - The {@link EventContext} of the event.
|
|
17
|
+
* @param eventType - The registered event constructor the event was appended as.
|
|
18
|
+
* @param delivery - The {@link ReactorDelivery} identifying the event's delivery, for reactors.
|
|
19
|
+
*/
|
|
20
|
+
constructor(event: TEvent, context: EventContext, eventType: Constructor, delivery?: ReactorDelivery | undefined);
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether the event is of a given event type, narrowing {@link event} to it.
|
|
23
|
+
* @param eventType - The event constructor to check for.
|
|
24
|
+
* @returns True when the event was appended as that event type.
|
|
25
|
+
*/
|
|
26
|
+
is<T>(eventType: Constructor<T>): this is EventAndContext<T>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=EventAndContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventAndContext.d.ts","sourceRoot":"","sources":["../../../observation/batches/EventAndContext.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;GAGG;AACH,qBAAa,eAAe,CAAC,MAAM,GAAG,OAAO;IASrC,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,OAAO,EAAE,YAAY;IAC9B,QAAQ,CAAC,SAAS,EAAE,WAAW;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe;IAXvC;;;;;;OAMG;IACH,YACa,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,WAAW,EACtB,QAAQ,CAAC,EAAE,eAAe,YAAA,EAGtC;IAED;;;;OAIG;IACH,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,CAE3D;CACJ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
* One event in an {@link EventBatch}: its content, its context and the event type it was registered as.
|
|
5
|
+
* The content is the deserialized JSON of the event, as per-event handlers receive it.
|
|
6
|
+
*/
|
|
7
|
+
export class EventAndContext {
|
|
8
|
+
event;
|
|
9
|
+
context;
|
|
10
|
+
eventType;
|
|
11
|
+
delivery;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new {@link EventAndContext}.
|
|
14
|
+
* @param event - The content of the event.
|
|
15
|
+
* @param context - The {@link EventContext} of the event.
|
|
16
|
+
* @param eventType - The registered event constructor the event was appended as.
|
|
17
|
+
* @param delivery - The {@link ReactorDelivery} identifying the event's delivery, for reactors.
|
|
18
|
+
*/
|
|
19
|
+
constructor(event, context, eventType, delivery) {
|
|
20
|
+
this.event = event;
|
|
21
|
+
this.context = context;
|
|
22
|
+
this.eventType = eventType;
|
|
23
|
+
this.delivery = delivery;
|
|
24
|
+
Object.freeze(this);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks whether the event is of a given event type, narrowing {@link event} to it.
|
|
28
|
+
* @param eventType - The event constructor to check for.
|
|
29
|
+
* @returns True when the event was appended as that event type.
|
|
30
|
+
*/
|
|
31
|
+
is(eventType) {
|
|
32
|
+
return this.eventType === eventType;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=EventAndContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventAndContext.js","sourceRoot":"","sources":["../../../observation/batches/EventAndContext.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAMrG;;;GAGG;AACH,MAAM,OAAO,eAAe;IASX,KAAK;IACL,OAAO;IACP,SAAS;IACT,QAAQ;IAXrB;;;;;;OAMG;IACH,YACa,KAAa,EACb,OAAqB,EACrB,SAAsB,EACtB,QAA0B;qBAH1B,KAAK;uBACL,OAAO;yBACP,SAAS;wBACT,QAAQ;QAEjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,EAAE,CAAI,SAAyB;QAC3B,OAAO,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC;IACxC,CAAC;CACJ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { EventContext } from '../../events/EventContext.js';
|
|
3
|
+
import type { EventAndContext } from './EventAndContext.js';
|
|
4
|
+
import type { BatchOutcome } from './BatchOutcome.js';
|
|
5
|
+
/**
|
|
6
|
+
* The events a batch method is called with, in sequence order, and the way it reports partitions it could not handle.
|
|
7
|
+
*
|
|
8
|
+
* Returning normally means every partition in the batch succeeded. Throwing fails every partition in the batch at its
|
|
9
|
+
* first event in the batch. {@link EventBatch.fail} and {@link EventBatch.defer} report a single partition, so the rest
|
|
10
|
+
* of the batch can still succeed.
|
|
11
|
+
*/
|
|
12
|
+
export declare class EventBatch implements Iterable<EventAndContext> {
|
|
13
|
+
#private;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new {@link EventBatch}.
|
|
16
|
+
* @param events - The events, in sequence order.
|
|
17
|
+
* @param canDefer - Whether the kernel accepts deferred partitions.
|
|
18
|
+
*/
|
|
19
|
+
constructor(events: readonly EventAndContext[], canDefer?: boolean);
|
|
20
|
+
/** The events in the batch, in sequence order. */
|
|
21
|
+
get events(): readonly EventAndContext[];
|
|
22
|
+
/** The number of events in the batch. */
|
|
23
|
+
get length(): number;
|
|
24
|
+
/** The partitions (event source identifiers) the batch holds events for, in the order their first event appears. */
|
|
25
|
+
get partitions(): readonly string[];
|
|
26
|
+
/** The outcomes reported for single partitions, in the order they were reported. */
|
|
27
|
+
get outcomes(): readonly BatchOutcome[];
|
|
28
|
+
/**
|
|
29
|
+
* Gets the events of one event type, narrowed to it.
|
|
30
|
+
* @param eventType - The event constructor.
|
|
31
|
+
* @returns The events of that type, in sequence order.
|
|
32
|
+
*/
|
|
33
|
+
ofType<T>(eventType: Constructor<T>): EventAndContext<T>[];
|
|
34
|
+
/**
|
|
35
|
+
* Fails a partition. Given a partition, it fails from its first event in the batch; given the context of an event,
|
|
36
|
+
* it fails from that event, and the partition's earlier events count as handled.
|
|
37
|
+
* @param partitionOrEvent - The partition (event source identifier), or the {@link EventContext} of the event it fails at.
|
|
38
|
+
* @param error - What went wrong. Defaults to a {@link PartitionFailedInBatch} error.
|
|
39
|
+
*/
|
|
40
|
+
fail(partitionOrEvent: string | EventContext, error?: unknown): void;
|
|
41
|
+
/**
|
|
42
|
+
* Defers a partition: it is not failed, does not count towards quarantine, and is delivered again after a delay.
|
|
43
|
+
* Given a partition, it is delivered again from its first event in the batch; given the context of an event, from that event.
|
|
44
|
+
* When the kernel does not accept deferrals, the partition is failed with {@link DeferralNotSupportedByKernel} instead.
|
|
45
|
+
* @param partitionOrEvent - The partition (event source identifier), or the {@link EventContext} of the event to deliver again from.
|
|
46
|
+
* @param retryAfterMilliseconds - How long to wait, in milliseconds, before the partition is delivered again.
|
|
47
|
+
*/
|
|
48
|
+
defer(partitionOrEvent: string | EventContext, retryAfterMilliseconds: number): void;
|
|
49
|
+
/** @inheritdoc */
|
|
50
|
+
[Symbol.iterator](): Iterator<EventAndContext>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=EventBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBatch.d.ts","sourceRoot":"","sources":["../../../observation/batches/EventBatch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD;;;;;;GAMG;AACH,qBAAa,UAAW,YAAW,QAAQ,CAAC,eAAe,CAAC;;IAKxD;;;;OAIG;IACH,YAAY,MAAM,EAAE,SAAS,eAAe,EAAE,EAAE,QAAQ,GAAE,OAAc,EAGvE;IAED,kDAAkD;IAClD,IAAI,MAAM,IAAI,SAAS,eAAe,EAAE,CAEvC;IAED,yCAAyC;IACzC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,oHAAoH;IACpH,IAAI,UAAU,IAAI,SAAS,MAAM,EAAE,CAElC;IAED,oFAAoF;IACpF,IAAI,QAAQ,IAAI,SAAS,YAAY,EAAE,CAEtC;IAED;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,CAEzD;IAED;;;;;OAKG;IACH,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAGnE;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY,EAAE,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAOnF;IAED,kBAAkB;IAClB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,eAAe,CAAC,CAE7C;CAYJ"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { BatchOutcomeKind } from './BatchOutcomeKind.js';
|
|
4
|
+
import { DeferralNotSupportedByKernel } from './DeferralNotSupportedByKernel.js';
|
|
5
|
+
import { PartitionNotInBatch } from './PartitionNotInBatch.js';
|
|
6
|
+
/**
|
|
7
|
+
* The events a batch method is called with, in sequence order, and the way it reports partitions it could not handle.
|
|
8
|
+
*
|
|
9
|
+
* Returning normally means every partition in the batch succeeded. Throwing fails every partition in the batch at its
|
|
10
|
+
* first event in the batch. {@link EventBatch.fail} and {@link EventBatch.defer} report a single partition, so the rest
|
|
11
|
+
* of the batch can still succeed.
|
|
12
|
+
*/
|
|
13
|
+
export class EventBatch {
|
|
14
|
+
#events;
|
|
15
|
+
#canDefer;
|
|
16
|
+
#outcomes = [];
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new {@link EventBatch}.
|
|
19
|
+
* @param events - The events, in sequence order.
|
|
20
|
+
* @param canDefer - Whether the kernel accepts deferred partitions.
|
|
21
|
+
*/
|
|
22
|
+
constructor(events, canDefer = true) {
|
|
23
|
+
this.#events = Object.freeze([...events]);
|
|
24
|
+
this.#canDefer = canDefer;
|
|
25
|
+
}
|
|
26
|
+
/** The events in the batch, in sequence order. */
|
|
27
|
+
get events() {
|
|
28
|
+
return this.#events;
|
|
29
|
+
}
|
|
30
|
+
/** The number of events in the batch. */
|
|
31
|
+
get length() {
|
|
32
|
+
return this.#events.length;
|
|
33
|
+
}
|
|
34
|
+
/** The partitions (event source identifiers) the batch holds events for, in the order their first event appears. */
|
|
35
|
+
get partitions() {
|
|
36
|
+
return [...new Set(this.#events.map(event => event.context.eventSourceId))];
|
|
37
|
+
}
|
|
38
|
+
/** The outcomes reported for single partitions, in the order they were reported. */
|
|
39
|
+
get outcomes() {
|
|
40
|
+
return this.#outcomes;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the events of one event type, narrowed to it.
|
|
44
|
+
* @param eventType - The event constructor.
|
|
45
|
+
* @returns The events of that type, in sequence order.
|
|
46
|
+
*/
|
|
47
|
+
ofType(eventType) {
|
|
48
|
+
return this.#events.filter((event) => event.is(eventType));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Fails a partition. Given a partition, it fails from its first event in the batch; given the context of an event,
|
|
52
|
+
* it fails from that event, and the partition's earlier events count as handled.
|
|
53
|
+
* @param partitionOrEvent - The partition (event source identifier), or the {@link EventContext} of the event it fails at.
|
|
54
|
+
* @param error - What went wrong. Defaults to a {@link PartitionFailedInBatch} error.
|
|
55
|
+
*/
|
|
56
|
+
fail(partitionOrEvent, error) {
|
|
57
|
+
const [partition, at] = this.#locate(partitionOrEvent);
|
|
58
|
+
this.#outcomes.push({ partition, at, kind: BatchOutcomeKind.Failed, error, retryAfterMilliseconds: 0 });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Defers a partition: it is not failed, does not count towards quarantine, and is delivered again after a delay.
|
|
62
|
+
* Given a partition, it is delivered again from its first event in the batch; given the context of an event, from that event.
|
|
63
|
+
* When the kernel does not accept deferrals, the partition is failed with {@link DeferralNotSupportedByKernel} instead.
|
|
64
|
+
* @param partitionOrEvent - The partition (event source identifier), or the {@link EventContext} of the event to deliver again from.
|
|
65
|
+
* @param retryAfterMilliseconds - How long to wait, in milliseconds, before the partition is delivered again.
|
|
66
|
+
*/
|
|
67
|
+
defer(partitionOrEvent, retryAfterMilliseconds) {
|
|
68
|
+
const [partition, at] = this.#locate(partitionOrEvent);
|
|
69
|
+
if (!this.#canDefer) {
|
|
70
|
+
this.#outcomes.push({ partition, at, kind: BatchOutcomeKind.Failed, error: new DeferralNotSupportedByKernel(partition), retryAfterMilliseconds: 0 });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.#outcomes.push({ partition, at, kind: BatchOutcomeKind.Deferred, retryAfterMilliseconds: Math.max(0, Math.round(retryAfterMilliseconds)) });
|
|
74
|
+
}
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
[Symbol.iterator]() {
|
|
77
|
+
return this.#events[Symbol.iterator]();
|
|
78
|
+
}
|
|
79
|
+
#locate(partitionOrEvent) {
|
|
80
|
+
if (typeof partitionOrEvent === 'string') {
|
|
81
|
+
const first = this.#events.find(event => event.context.eventSourceId === partitionOrEvent);
|
|
82
|
+
if (!first)
|
|
83
|
+
throw new PartitionNotInBatch(partitionOrEvent);
|
|
84
|
+
return [partitionOrEvent, first.context.sequenceNumber];
|
|
85
|
+
}
|
|
86
|
+
const partition = partitionOrEvent.eventSourceId;
|
|
87
|
+
if (!this.#events.some(event => event.context.eventSourceId === partition))
|
|
88
|
+
throw new PartitionNotInBatch(partition);
|
|
89
|
+
return [partition, partitionOrEvent.sequenceNumber];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=EventBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBatch.js","sourceRoot":"","sources":["../../../observation/batches/EventBatch.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Thrown at registration when an event type would reach more than one method of an observer. */
|
|
2
|
+
export declare class EventTypeObservedByMoreThanOneMethod extends Error {
|
|
3
|
+
readonly observerType: string;
|
|
4
|
+
readonly eventType: string;
|
|
5
|
+
readonly methods: readonly string[];
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new {@link EventTypeObservedByMoreThanOneMethod}.
|
|
8
|
+
* @param observerType - The name of the observer class.
|
|
9
|
+
* @param eventType - The name of the event type.
|
|
10
|
+
* @param methods - The methods the event type would reach.
|
|
11
|
+
*/
|
|
12
|
+
constructor(observerType: string, eventType: string, methods: readonly string[]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=EventTypeObservedByMoreThanOneMethod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTypeObservedByMoreThanOneMethod.d.ts","sourceRoot":"","sources":["../../../observation/batches/EventTypeObservedByMoreThanOneMethod.ts"],"names":[],"mappings":"AAGA,iGAAiG;AACjG,qBAAa,oCAAqC,SAAQ,KAAK;IAO/C,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE;IAN1G;;;;;OAKG;IACH,YAAqB,YAAY,EAAE,MAAM,EAAW,SAAS,EAAE,MAAM,EAAW,OAAO,EAAE,SAAS,MAAM,EAAE,EAIzG;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown at registration when an event type would reach more than one method of an observer. */
|
|
4
|
+
export class EventTypeObservedByMoreThanOneMethod extends Error {
|
|
5
|
+
observerType;
|
|
6
|
+
eventType;
|
|
7
|
+
methods;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new {@link EventTypeObservedByMoreThanOneMethod}.
|
|
10
|
+
* @param observerType - The name of the observer class.
|
|
11
|
+
* @param eventType - The name of the event type.
|
|
12
|
+
* @param methods - The methods the event type would reach.
|
|
13
|
+
*/
|
|
14
|
+
constructor(observerType, eventType, methods) {
|
|
15
|
+
super(`Event type '${eventType}' reaches more than one method of '${observerType}' (${methods.map(method => `'${method}'`).join(', ')}). ` +
|
|
16
|
+
'Each event type must reach exactly one method: a batch method or a per-event method, never both.');
|
|
17
|
+
this.observerType = observerType;
|
|
18
|
+
this.eventType = eventType;
|
|
19
|
+
this.methods = methods;
|
|
20
|
+
this.name = 'EventTypeObservedByMoreThanOneMethod';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=EventTypeObservedByMoreThanOneMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTypeObservedByMoreThanOneMethod.js","sourceRoot":"","sources":["../../../observation/batches/EventTypeObservedByMoreThanOneMethod.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,iGAAiG;AACjG,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IAOtC,YAAY;IAAmB,SAAS;IAAmB,OAAO;IANvF;;;;;OAKG;IACH,YAAqB,YAAoB,EAAW,SAAiB,EAAW,OAA0B;QACtG,KAAK,CAAC,eAAe,SAAS,sCAAsC,YAAY,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YACtI,kGAAkG,CAAC,CAAC;4BAFvF,YAAY;yBAAmB,SAAS;uBAAmB,OAAO;QAGnF,IAAI,CAAC,IAAI,GAAG,sCAAsC,CAAC;IACvD,CAAC;CACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Thrown at registration when a method decorated with `@observes` cannot be used as a batch method. */
|
|
2
|
+
export declare class InvalidBatchMethod extends Error {
|
|
3
|
+
readonly observerType: string;
|
|
4
|
+
readonly method: string;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link InvalidBatchMethod}.
|
|
7
|
+
* @param observerType - The name of the observer class.
|
|
8
|
+
* @param method - The name of the method.
|
|
9
|
+
* @param reason - Why the method cannot be a batch method.
|
|
10
|
+
*/
|
|
11
|
+
constructor(observerType: string, method: string, reason: string);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=InvalidBatchMethod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidBatchMethod.d.ts","sourceRoot":"","sources":["../../../observation/batches/InvalidBatchMethod.ts"],"names":[],"mappings":"AAGA,wGAAwG;AACxG,qBAAa,kBAAmB,SAAQ,KAAK;IAO7B,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IANlE;;;;;OAKG;IACH,YAAqB,YAAY,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAGjF;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Thrown at registration when a method decorated with `@observes` cannot be used as a batch method. */
|
|
4
|
+
export class InvalidBatchMethod extends Error {
|
|
5
|
+
observerType;
|
|
6
|
+
method;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link InvalidBatchMethod}.
|
|
9
|
+
* @param observerType - The name of the observer class.
|
|
10
|
+
* @param method - The name of the method.
|
|
11
|
+
* @param reason - Why the method cannot be a batch method.
|
|
12
|
+
*/
|
|
13
|
+
constructor(observerType, method, reason) {
|
|
14
|
+
super(`Batch method '${method}' on '${observerType}' is not valid: ${reason}`);
|
|
15
|
+
this.observerType = observerType;
|
|
16
|
+
this.method = method;
|
|
17
|
+
this.name = 'InvalidBatchMethod';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=InvalidBatchMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidBatchMethod.js","sourceRoot":"","sources":["../../../observation/batches/InvalidBatchMethod.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,wGAAwG;AACxG,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAOpB,YAAY;IAAmB,MAAM;IAN1D;;;;;OAKG;IACH,YAAqB,YAAoB,EAAW,MAAc,EAAE,MAAc;QAC9E,KAAK,CAAC,iBAAiB,MAAM,SAAS,YAAY,mBAAmB,MAAM,EAAE,CAAC,CAAC;4BAD9D,YAAY;sBAAmB,MAAM;QAEtD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ObservationOrigin as ContractObservationOrigin } from '@cratis/chronicle.contracts';
|
|
2
|
+
/** The path a delivery of events to an observer came from. */
|
|
3
|
+
export declare enum ObservationOrigin {
|
|
4
|
+
/** The origin is not known, for example because the kernel does not report it. */
|
|
5
|
+
Unknown = 0,
|
|
6
|
+
/** The events were appended now and delivered to an observer that is up to date. */
|
|
7
|
+
Live = 1,
|
|
8
|
+
/** The events were read from storage for an observer that is behind. */
|
|
9
|
+
CatchUp = 2,
|
|
10
|
+
/** The events were read from storage for an observer that was rewound. */
|
|
11
|
+
Replay = 3,
|
|
12
|
+
/** The events were read from storage to recover a failed or deferred partition. */
|
|
13
|
+
Retry = 4
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Converts the origin the kernel reports to the client {@link ObservationOrigin}.
|
|
17
|
+
* @param origin - The origin on the wire, or undefined when the kernel does not report one.
|
|
18
|
+
* @returns The client {@link ObservationOrigin}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toObservationOrigin(origin: ContractObservationOrigin | undefined): ObservationOrigin;
|
|
21
|
+
//# sourceMappingURL=ObservationOrigin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservationOrigin.d.ts","sourceRoot":"","sources":["../../../observation/batches/ObservationOrigin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,8DAA8D;AAC9D,oBAAY,iBAAiB;IACzB,kFAAkF;IAClF,OAAO,IAAI;IAEX,oFAAoF;IACpF,IAAI,IAAI;IAER,wEAAwE;IACxE,OAAO,IAAI;IAEX,0EAA0E;IAC1E,MAAM,IAAI;IAEV,mFAAmF;IACnF,KAAK,IAAI;CACZ;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,SAAS,GAAG,iBAAiB,CAQpG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { ObservationOrigin as ContractObservationOrigin } from '@cratis/chronicle.contracts';
|
|
4
|
+
/** The path a delivery of events to an observer came from. */
|
|
5
|
+
export var ObservationOrigin;
|
|
6
|
+
(function (ObservationOrigin) {
|
|
7
|
+
/** The origin is not known, for example because the kernel does not report it. */
|
|
8
|
+
ObservationOrigin[ObservationOrigin["Unknown"] = 0] = "Unknown";
|
|
9
|
+
/** The events were appended now and delivered to an observer that is up to date. */
|
|
10
|
+
ObservationOrigin[ObservationOrigin["Live"] = 1] = "Live";
|
|
11
|
+
/** The events were read from storage for an observer that is behind. */
|
|
12
|
+
ObservationOrigin[ObservationOrigin["CatchUp"] = 2] = "CatchUp";
|
|
13
|
+
/** The events were read from storage for an observer that was rewound. */
|
|
14
|
+
ObservationOrigin[ObservationOrigin["Replay"] = 3] = "Replay";
|
|
15
|
+
/** The events were read from storage to recover a failed or deferred partition. */
|
|
16
|
+
ObservationOrigin[ObservationOrigin["Retry"] = 4] = "Retry";
|
|
17
|
+
})(ObservationOrigin || (ObservationOrigin = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Converts the origin the kernel reports to the client {@link ObservationOrigin}.
|
|
20
|
+
* @param origin - The origin on the wire, or undefined when the kernel does not report one.
|
|
21
|
+
* @returns The client {@link ObservationOrigin}.
|
|
22
|
+
*/
|
|
23
|
+
export function toObservationOrigin(origin) {
|
|
24
|
+
switch (origin) {
|
|
25
|
+
case ContractObservationOrigin.Live: return ObservationOrigin.Live;
|
|
26
|
+
case ContractObservationOrigin.CatchingUp: return ObservationOrigin.CatchUp;
|
|
27
|
+
case ContractObservationOrigin.Replaying: return ObservationOrigin.Replay;
|
|
28
|
+
case ContractObservationOrigin.Retrying: return ObservationOrigin.Retry;
|
|
29
|
+
default: return ObservationOrigin.Unknown;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ObservationOrigin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservationOrigin.js","sourceRoot":"","sources":["../../../observation/batches/ObservationOrigin.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,8DAA8D;AAC9D,MAAM,CAAN,IAAY,iBAeX;AAfD,WAAY,iBAAiB;IACzB,kFAAkF;IAClF,+DAAW,CAAA;IAEX,oFAAoF;IACpF,yDAAQ,CAAA;IAER,wEAAwE;IACxE,+DAAW,CAAA;IAEX,0EAA0E;IAC1E,6DAAU,CAAA;IAEV,mFAAmF;IACnF,2DAAS,CAAA;AACb,CAAC,EAfW,iBAAiB,KAAjB,iBAAiB,QAe5B;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA6C;IAC7E,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,yBAAyB,CAAC,IAAI,EAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC;QACnE,KAAK,yBAAyB,CAAC,UAAU,EAAE,OAAO,iBAAiB,CAAC,OAAO,CAAC;QAC5E,KAAK,yBAAyB,CAAC,SAAS,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC;QAC1E,KAAK,yBAAyB,CAAC,QAAQ,EAAE,OAAO,iBAAiB,CAAC,KAAK,CAAC;QACxE,SAAS,OAAO,iBAAiB,CAAC,OAAO,CAAC;IAC9C,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
/** An event type a batch method observes. */
|
|
3
|
+
export interface ObservedEventType {
|
|
4
|
+
/** The event constructor. */
|
|
5
|
+
readonly type: Constructor;
|
|
6
|
+
/** The event type identifier. */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** The event type generation. */
|
|
9
|
+
readonly generation: number;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ObservedEventType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedEventType.d.ts","sourceRoot":"","sources":["../../../observation/batches/ObservedEventType.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAC9B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedEventType.js","sourceRoot":"","sources":["../../../observation/batches/ObservedEventType.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EventsToObserve, ReduceOperationMessage } from '@cratis/chronicle.contracts';
|
|
2
|
+
import type { DeliveredPartition } from './DeliveredPartition.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gets whether the kernel delivered a page of partitions. A kernel that does not know page delivery sends one partition
|
|
5
|
+
* in the legacy fields, and cannot take deferrals or per-partition results.
|
|
6
|
+
* @param message - The delivered message.
|
|
7
|
+
* @returns True when the message is a page.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isPage(message: EventsToObserve | ReduceOperationMessage): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the partitions of a reactor delivery, treating a single-partition delivery as a page of one.
|
|
12
|
+
* @param message - The {@link EventsToObserve} delivered.
|
|
13
|
+
* @returns The {@link DeliveredPartition} instances.
|
|
14
|
+
*/
|
|
15
|
+
export declare function partitionsOfEvents(message: EventsToObserve): DeliveredPartition[];
|
|
16
|
+
/**
|
|
17
|
+
* Gets the partitions of a reducer delivery, treating a single-partition delivery as a page of one.
|
|
18
|
+
* @param message - The {@link ReduceOperationMessage} delivered.
|
|
19
|
+
* @returns The {@link DeliveredPartition} instances.
|
|
20
|
+
*/
|
|
21
|
+
export declare function partitionsOfOperation(message: ReduceOperationMessage): DeliveredPartition[];
|
|
22
|
+
//# sourceMappingURL=PageMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageMessages.d.ts","sourceRoot":"","sources":["../../../observation/batches/PageMessages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,sBAAsB,GAAG,OAAO,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,EAAE,CAIjF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,kBAAkB,EAAE,CAI3F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
* Gets whether the kernel delivered a page of partitions. A kernel that does not know page delivery sends one partition
|
|
5
|
+
* in the legacy fields, and cannot take deferrals or per-partition results.
|
|
6
|
+
* @param message - The delivered message.
|
|
7
|
+
* @returns True when the message is a page.
|
|
8
|
+
*/
|
|
9
|
+
export function isPage(message) {
|
|
10
|
+
return (message.Partitions?.length ?? 0) > 0;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gets the partitions of a reactor delivery, treating a single-partition delivery as a page of one.
|
|
14
|
+
* @param message - The {@link EventsToObserve} delivered.
|
|
15
|
+
* @returns The {@link DeliveredPartition} instances.
|
|
16
|
+
*/
|
|
17
|
+
export function partitionsOfEvents(message) {
|
|
18
|
+
return isPage(message)
|
|
19
|
+
? message.Partitions.map(partition => ({ partition: partition.Partition, events: partition.Events, initialState: '' }))
|
|
20
|
+
: [{ partition: message.Partition, events: message.Events ?? [], initialState: '' }];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the partitions of a reducer delivery, treating a single-partition delivery as a page of one.
|
|
24
|
+
* @param message - The {@link ReduceOperationMessage} delivered.
|
|
25
|
+
* @returns The {@link DeliveredPartition} instances.
|
|
26
|
+
*/
|
|
27
|
+
export function partitionsOfOperation(message) {
|
|
28
|
+
return isPage(message)
|
|
29
|
+
? message.Partitions.map(partition => ({ partition: partition.Partition, events: partition.Events, initialState: partition.InitialState }))
|
|
30
|
+
: [{ partition: message.Partition, events: message.Events ?? [], initialState: message.InitialState }];
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=PageMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageMessages.js","sourceRoot":"","sources":["../../../observation/batches/PageMessages.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAKrG;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,OAAiD;IACpE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAwB;IACvD,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QACvH,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;AAC7F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACjE,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC;QAC3I,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AAC/G,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Reported when a batch method fails a partition without giving a reason. */
|
|
2
|
+
export declare class PartitionFailedInBatch extends Error {
|
|
3
|
+
readonly partition: string;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new {@link PartitionFailedInBatch}.
|
|
6
|
+
* @param partition - The partition that was failed.
|
|
7
|
+
*/
|
|
8
|
+
constructor(partition: string);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PartitionFailedInBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartitionFailedInBatch.d.ts","sourceRoot":"","sources":["../../../observation/batches/PartitionFailedInBatch.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,qBAAa,sBAAuB,SAAQ,KAAK;IAKjC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAJtC;;;OAGG;IACH,YAAqB,SAAS,EAAE,MAAM,EAGrC;CACJ"}
|