@mavenmachines/event-handler-lib 2.0.0-rc.1 → 2.0.0-rc.3

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.
Files changed (72) hide show
  1. package/README.md +54 -86
  2. package/dist/cjs/cli/loadInjectedEventHandlers.js +117 -10
  3. package/dist/cjs/cli/loadInjectedEventHandlers.js.map +1 -1
  4. package/dist/cjs/clients/kafka/kafkaConsumer.d.ts +3 -2
  5. package/dist/cjs/clients/kafka/kafkaConsumer.js +45 -30
  6. package/dist/cjs/clients/kafka/kafkaConsumer.js.map +1 -1
  7. package/dist/cjs/clients/kafka/kafkaEventConsumer.d.ts +2 -4
  8. package/dist/cjs/clients/kafka/kafkaEventConsumer.js +62 -93
  9. package/dist/cjs/clients/kafka/kafkaEventConsumer.js.map +1 -1
  10. package/dist/cjs/clients/kafka/kafkaTopicMap.d.ts +1 -8
  11. package/dist/cjs/clients/kafka/kafkaTopicMap.js +3 -39
  12. package/dist/cjs/clients/kafka/kafkaTopicMap.js.map +1 -1
  13. package/dist/cjs/clients/kafka/kafkaTypes.d.ts +4 -1
  14. package/dist/cjs/clients/kafka/loadPlatformaticKafka.js.map +1 -1
  15. package/dist/cjs/clients/s3Client.js +1 -1
  16. package/dist/cjs/clients/s3Client.js.map +1 -1
  17. package/dist/cjs/configs/serviceConfigs.js +3 -1
  18. package/dist/cjs/configs/serviceConfigs.js.map +1 -1
  19. package/dist/cjs/handlers/baseHandler.js +1 -1
  20. package/dist/cjs/handlers/baseHandler.js.map +1 -1
  21. package/dist/cjs/handlers/crud/helpers.js +6 -2
  22. package/dist/cjs/handlers/crud/helpers.js.map +1 -1
  23. package/dist/cjs/helpers/array.helpers.js +1 -1
  24. package/dist/cjs/helpers/array.helpers.js.map +1 -1
  25. package/dist/cjs/helpers/classConverter.js +1 -1
  26. package/dist/cjs/helpers/classConverter.js.map +1 -1
  27. package/dist/cjs/helpers/dataStructure.helpers.js +5 -5
  28. package/dist/cjs/helpers/dataStructure.helpers.js.map +1 -1
  29. package/dist/cjs/helpers/filesystem.helpers.js +1 -1
  30. package/dist/cjs/helpers/string.helpers.js +2 -3
  31. package/dist/cjs/helpers/string.helpers.js.map +1 -1
  32. package/dist/cjs/rpc/abstractRpcClient.js +6 -1
  33. package/dist/cjs/rpc/abstractRpcClient.js.map +1 -1
  34. package/dist/cjs/testUtils/testDependencies.d.ts +1 -1
  35. package/dist/cjs/testUtils/testDependencies.js +7 -6
  36. package/dist/cjs/testUtils/testDependencies.js.map +1 -1
  37. package/dist/esm/cli/loadInjectedEventHandlers.js +117 -10
  38. package/dist/esm/cli/loadInjectedEventHandlers.js.map +1 -1
  39. package/dist/esm/clients/kafka/kafkaConsumer.d.ts +3 -2
  40. package/dist/esm/clients/kafka/kafkaConsumer.js +45 -30
  41. package/dist/esm/clients/kafka/kafkaConsumer.js.map +1 -1
  42. package/dist/esm/clients/kafka/kafkaEventConsumer.d.ts +2 -4
  43. package/dist/esm/clients/kafka/kafkaEventConsumer.js +62 -93
  44. package/dist/esm/clients/kafka/kafkaEventConsumer.js.map +1 -1
  45. package/dist/esm/clients/kafka/kafkaTopicMap.d.ts +1 -8
  46. package/dist/esm/clients/kafka/kafkaTopicMap.js +3 -38
  47. package/dist/esm/clients/kafka/kafkaTopicMap.js.map +1 -1
  48. package/dist/esm/clients/kafka/kafkaTypes.d.ts +4 -1
  49. package/dist/esm/clients/kafka/loadPlatformaticKafka.js.map +1 -1
  50. package/dist/esm/clients/s3Client.js +1 -1
  51. package/dist/esm/clients/s3Client.js.map +1 -1
  52. package/dist/esm/configs/serviceConfigs.js +4 -2
  53. package/dist/esm/configs/serviceConfigs.js.map +1 -1
  54. package/dist/esm/handlers/baseHandler.js +1 -1
  55. package/dist/esm/handlers/baseHandler.js.map +1 -1
  56. package/dist/esm/handlers/crud/helpers.js +6 -2
  57. package/dist/esm/handlers/crud/helpers.js.map +1 -1
  58. package/dist/esm/helpers/array.helpers.js +1 -1
  59. package/dist/esm/helpers/array.helpers.js.map +1 -1
  60. package/dist/esm/helpers/classConverter.js +1 -1
  61. package/dist/esm/helpers/classConverter.js.map +1 -1
  62. package/dist/esm/helpers/dataStructure.helpers.js +5 -5
  63. package/dist/esm/helpers/dataStructure.helpers.js.map +1 -1
  64. package/dist/esm/helpers/filesystem.helpers.js +1 -1
  65. package/dist/esm/helpers/string.helpers.js +2 -3
  66. package/dist/esm/helpers/string.helpers.js.map +1 -1
  67. package/dist/esm/rpc/abstractRpcClient.js +6 -1
  68. package/dist/esm/rpc/abstractRpcClient.js.map +1 -1
  69. package/dist/esm/testUtils/testDependencies.d.ts +1 -1
  70. package/dist/esm/testUtils/testDependencies.js +7 -6
  71. package/dist/esm/testUtils/testDependencies.js.map +1 -1
  72. package/package.json +1 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ import { camelCase } from "@mavenmachines/event-handler-lib/utils";
27
27
  | `/errors` | Common error classes (not found, state, projection) |
28
28
  | `/types` | Core event-sourcing types, RPC enums, `CompanyConfigurationClient` |
29
29
  | `/utils` | String/data helpers, file watcher, cleanup helpers, version helpers |
30
- | `/infrastructure` | Logger, metrics (`ensureEventHandlerMetrics`), queue manager, feature flags, `AbstractRpcHandler` |
30
+ | `/infrastructure` | Logger, metrics (`registerMetric`), queue manager, feature flags, `AbstractRpcHandler` |
31
31
  | `/rpc` | RPC clients, protocols, return-event types |
32
32
  | `/clients` | Redis, MySQL, Kafka, Firestore, OpenSearch, Dynamo clients |
33
33
  | `/sourcing` | Event/command handlers, projections, repositories, CRUD |
@@ -44,7 +44,7 @@ Notes:
44
44
 
45
45
  - TypeScript consumers need a `moduleResolution` that honors `package.json` `"exports"` (`Node16`, `NodeNext`, or `bundler`).
46
46
  - Still call `import "reflect-metadata"` (or Nest’s equivalent) **before** importing decorated classes from this library.
47
- - Call `bindEventHandlerDeps(...)` or `ensureEventHandlerMetrics()` before relying on Prometheus metrics from this package.
47
+ - Call `bindEventHandlerDeps(...)` before relying on Prometheus metrics from this package. It registers the metrics. `registerMetric` is the public helper for adding more.
48
48
  - In one process, use only `import` **or** only `require` for this package (avoid dual-package hazard).
49
49
 
50
50
  # Versioning
@@ -61,10 +61,10 @@ the next available `{PATCH}` version, and the `develop` branch will find the nex
61
61
  All logging should go through `Logger` objects provided by the `LoggerService`:
62
62
 
63
63
  ```
64
- import { Logger, LoggerService } from "@mavenmachines/event-handler-lib";
64
+ import { Logger, LoggerService, TYPES } from "@mavenmachines/event-handler-lib";
65
65
 
66
66
  class MyClass {
67
- constructor(@inject(LoggerService) loggerService: LoggerService) {
67
+ constructor(@inject(TYPES.LoggerService) loggerService: LoggerService) {
68
68
  this.logger = loggerService.getLogger(this);
69
69
  }
70
70
 
@@ -92,10 +92,13 @@ for that logger. A structured logger configuration has the following structure:
92
92
 
93
93
  // If includeObject is true, and this is non-empty, only these (deep) fields will be emitted
94
94
  objectFields: string[];
95
+
96
+ // If includeObject is true, these (deep) fields are removed before the object is emitted
97
+ omitFields: string[];
95
98
  }
96
99
  ```
97
100
 
98
- The `logLevels.json` file has the following structure:
101
+ Unknown keys are ignored, with a warning. The `logLevels.json` file has the following structure:
99
102
 
100
103
  ```
101
104
  {
@@ -105,7 +108,8 @@ The `logLevels.json` file has the following structure:
105
108
  "MyEventHandler": {
106
109
  "level": "debug",
107
110
  "includeObject": true,
108
- "objectField": ["event.eventType", "etc"]
111
+ "objectFields": ["event.eventType", "etc"],
112
+ "omitFields": ["payload.secret"]
109
113
  }
110
114
  }
111
115
  }
@@ -120,9 +124,9 @@ Currently, the Event Sourcing pipeline uses RabbitMQ for messaging, and DynamoDB
120
124
 
121
125
  ## Creating a new Event Topic
122
126
 
123
- Rather than being the partition key for a Dynamo table, Kafka Events will be separated one event type per Kafka Topic. The topic names are the `eventType` prefixed with `eventSourcing.` so for example, `eventSourcing.entity.manifest.updated` is the topic that streams manifest-updated events.
127
+ Each event type is assigned a Kafka topic in the topic map. The name is chosen at assignment time. Names conventionally use the `eventSourcing.` prefix, for example `eventSourcing.manifests`. This library does not derive the topic from the event type, and consumers do not create topics.
124
128
 
125
- The `event-sourcing-service` and `event-handler-lib` consumers both know how to dynamically create a topic for a given event, so that new events are not published to non-existent topics, and consumers do not subscribe to non-existent topics. However, because different event types will need different partition configuration, the value for a given topic must be stored in a redis map. The key for this map is `eventSourcing.kafka.partitionCounts` (stored in `src/clients/kafka/kafkaPartitionConfigManager.js`), and the key for an entry in the map is the topic name (`eventSourcing.<eventType>` as described in the previous paragraph).
129
+ The map for an environment is the S3 object `s3://maven-event-sourcing-service-data/environments/<NODE_ENV>/eventTopics.json`. Each event type maps to `{ topic, isActive }`. If that object cannot be loaded, this library builds it from the Redis hash `eventSourcing.kafka.eventTopics` and the Redis set `eventSourcing.kafka.activeEvents`, then writes the result to S3.
126
130
 
127
131
  ## Enabling Kafka in an environment.
128
132
 
@@ -142,38 +146,19 @@ service instances.
142
146
 
143
147
  ### Kafka Event Topic Configuration
144
148
 
145
- The `event-sourcing-service` will only publish to Kafka if two conditions are met, otherwise it will continue to publish to RabbitMQ:
146
-
147
- 1. The eventType has an entry in the Event Topic Map
148
-
149
- The new mapping of EventType -> Kafka Partitions lives in S3.
150
-
151
- If an entry for a given EventType does not exist, startup fails after logging every subscribed event that has no topic. The `event-sourcing-service` also has no topic to publish to.
149
+ The `event-sourcing-service` will only publish to Kafka if all three conditions are met, otherwise it will continue to publish to RabbitMQ:
152
150
 
153
- For backwards compatibility, the `event-sourcing-service` also maintains the legacy mappings of EventType -> Kafka Partition which lives in Redis at `eventSourcing.kafka.topicPartitions`.
151
+ 1. The event type has an entry in the topic map.
154
152
 
155
- 2. The specified topic in the map exists in the Kafka cluster.
153
+ If a subscribed event has no topic, startup logs every such event and fails. The `event-sourcing-service` also has no topic to publish to.
156
154
 
157
- Additionally, since partition tuning is an important part of Kafka operations, the event sourcing service will not manage the creation of any partitions itself, and they must be made manually. See the [official documentation](https://kafka.apache.org/documentation/#topicconfigs) for more information.
155
+ 2. The topic named in the map exists in the Kafka cluster.
158
156
 
159
- 3. The eventType is "active".
157
+ Consumers do not create missing topics. Create them with `ensureTopics`, or directly in Kafka, before depending on them. Partition counts are chosen at creation time. See the [official documentation](https://kafka.apache.org/documentation/#topicconfigs) for more information.
160
158
 
161
- Because the services have a 10-minute resubscribe loop, and new consumer groups begin
162
- at the head of the partitions, the events must not be published to Kafka until all
163
- services are subscribed to the necessray topics. To facilitate this, events should be
164
- "activated" once the services have subscribed to Kafka.
159
+ 3. The event type is active.
165
160
 
166
- #### Forcing a refresh of subscriptions
167
-
168
- If you don't want to wait for the 10-minute resubscribe loop before subscribing to
169
- a newly configured topic, you can send a `SIGHUP` to the running process:
170
-
171
- ```bash
172
- pm2 sendSignal SIGHUP <PM2_PROCESS_ID>
173
- ```
174
-
175
- Note that sending to a clustered service by its name will result in only one service
176
- receiving the signal, and the above command must be run once per process.
161
+ A process subscribes once, during startup, and does not subscribe again when the map changes. New members start at the latest offset. Activate an event only after every consumer that should receive it has been started, or restarted, with that topic assigned. Assigning a topic to a process that is already running does not make that process subscribe.
177
162
 
178
163
  #### Ensuring every subscribed event has a topic
179
164
 
@@ -250,20 +235,11 @@ Changing the assigned topic of an eventType is not currently supported.
250
235
 
251
236
  ## Seeking Kafka to Head
252
237
 
253
- If an event-sourcing Consumer Group has a high OffsetLag, it can be forced
254
- to seek ALL TOPICS to the current head by sending `SIGUSR1`:
255
-
256
- ```bash
257
- pm2 sendSignal SIGUSR1 <PM2_PROCESS_ID>
258
- ```
238
+ `ResetKafkaTopic` listens for `SIGUSR1` and seeks every topic in `KafkaEventConsumer.topics`. That set is never filled, so the signal does not move offsets.
259
239
 
260
- Note that sending to a clustered service by its name will result in only one service
261
- receiving the signal, and the above command must be run once per process.
240
+ ### Seeking one topic
262
241
 
263
- ### Granular seeking
264
-
265
- For more granular control over seeking a topic to head, the services have an AMQP
266
- endpoint to seek an individual topic (and optionally, a single partition) to head.
242
+ Each service binds `#.<camelCased package name>.kafka.setTopicToHead`. A package named `es-manifest-aggregator` receives:
267
243
 
268
244
  ```
269
245
  {
@@ -274,13 +250,9 @@ endpoint to seek an individual topic (and optionally, a single partition) to hea
274
250
  }
275
251
  ```
276
252
 
277
- To specify a single partition of the topic, set `partition` to the partition number
278
- in the request. If the receiving service is not subscribed to that partition, it
279
- will not have any effect.
253
+ To seek a single partition, set `partition` to the partition number. If the receiving member is not assigned that partition, the request has no effect.
280
254
 
281
- Because the Pump RPC protocol is delivered via AMQP, one running instance
282
- of a clustered service will receive the message. Resetting topics to head in this
283
- way is not recommended.
255
+ Pump delivers the RPC to one instance of a clustered service. Resetting topics to head this way is not recommended.
284
256
 
285
257
  TODO: Implement a mechanism to propagate the AMQP request to all instances in a `cluster`.
286
258
 
@@ -344,16 +316,11 @@ and requests are routed round-robin, leading to bad metrics quality.**
344
316
 
345
317
  If using the `event-handler-lib`'s `MonitoringService`, you can allow the
346
318
  library to use its default monitoring port discovery mechanism, searching
347
- for the first available port between 3300 and 3309, inclusively.
348
-
349
- These default ports can be overridden by specifying the `es_monitoring_port`
350
- environment variable. If that port is unavailable, it will try the next port
351
- up, for a total of `es_monitoring_port_attempts` retries (default: 50).
319
+ for the first available port from 3300 through 3349 (50 attempts).
352
320
 
353
- If you do not specify `es_monitoring_port`, but you DO specify
354
- `monitoring_port` a-la services built on the
355
- [typescript-service-template](https://bitbucket.org/mavenmachines/typescript-service-template)
356
- library, it will fall back to using that port instead.
321
+ Set `es_monitoring_port` to start at a different port. If that port is taken,
322
+ the next port is tried, for `es_monitoring_port_attempts` attempts (default: 50).
323
+ A legacy `monitoring.port` value is logged and is not used as the listen port.
357
324
 
358
325
  ## Implement an Event Handler
359
326
 
@@ -423,7 +390,7 @@ export class MyEventHandler extends BaseEventHandler<MyEventType> {
423
390
  ```
424
391
 
425
392
  These promises can also be given an optional name when Stashing for observability.
426
- If no name is provided, a name based on the order of stash calls will be provided (`e.g., "Stashed1")
393
+ If no name is provided, the name is `Promise 1`, `Promise 2`, and so on.
427
394
 
428
395
  In this scenario, `handleEvent` will return almost immediately, and begin performing
429
396
  post-handle tasks like checking for Projection modifications.
@@ -473,7 +440,7 @@ To allow for this, the `EventHandlerContext` also has an `addRollback` method th
473
440
  will behave similarly to the stashed Promise rollbacks:
474
441
 
475
442
  ```
476
- override doHandle(context: EventHandlerContext<MyEventType>) {
443
+ protected async handleEvent(context: EventHandlerContext<MyEventType>) {
477
444
  const {
478
445
  payload: {
479
446
  id,
@@ -653,7 +620,7 @@ describe("", () => {
653
620
  The `projectionRepository` is an instance of the `BaseEventHandler` class (TODO: should probably move to `EventContext`). It is primarily used for loading projections, as any modifications or creation will be done using the Projection Modifier.
654
621
 
655
622
  ```
656
- const myProjection = this.projectionRepository.load({
623
+ const myProjection = this.projectionRepository.loadItem({
657
624
  companyId,
658
625
  projectionType: "myProjectionType",
659
626
  entityId: "myEntityId"
@@ -669,7 +636,7 @@ The `projectionModifier` object lives in the `EventContext` for a given Event Ha
669
636
  2. When performing multiple modifications on a single projection, you must store the returned value of the previous modification, and pass it to the next method invocation. If you fail to do this, you will lose the previous modifications when the projection is written to DynamoDB.
670
637
  Additionally, the published modifications will include all operations, causing incorrect state to be reported to the update handlers.
671
638
 
672
- 3. Modifications to a projection through the `projectionModifier` will trigger a `projection.<ProjectionType>.updated` event to be published for handling changes. For example, a single update handler can be responsible for persisting projection changes to Firestore, sending Return Events, or performing other external operations, regardless of which Event Handler made those changes.
639
+ 3. Modifications to a projection through the `projectionModifier` publish an `entity.<ProjectionType>.updated` event. Deletes publish that same event name, with the deletion marked on the payload. A single handler for that event can persist projection changes to Firestore, send Return Events, or perform other external operations, regardless of which Event Handler made the change.
673
640
 
674
641
  ### Projection Blurb Synchronization
675
642
 
@@ -720,7 +687,7 @@ the Projection's `payload` into a document directly, using the
720
687
  `SetFirestorePlugin` base class.
721
688
 
722
689
  ```
723
- export class ProductFirestoreSync extends SetFirestoreProjection<Product> {
690
+ export class ProductFirestoreSync extends SetFirestorePlugin<Product> {
724
691
  projectionType = "product";
725
692
  documentType = "products";
726
693
  }
@@ -733,7 +700,7 @@ If you need to change the format of the Firestore document, set the second type
733
700
  argument and overload `convertDocument`.
734
701
 
735
702
  ```
736
- export class ProductFirestoreSync extends SetFirestoreProjection<
703
+ export class ProductFirestoreSync extends SetFirestorePlugin<
737
704
  Product,
738
705
  FirestoreProduct
739
706
  > {
@@ -755,12 +722,12 @@ the correct subpath for the Firestore document.
755
722
  #### Partial Document Update
756
723
 
757
724
  If you need to make partial modifications to Firestore documents, you can use
758
- the `UpdateFirestoreProjection` plugin, which has an additional property,
725
+ the `UpdateFirestorePlugin` plugin, which has an additional property,
759
726
  `fields`, which can either be an array of paths to fields you need to pick
760
727
  or a nested object representing their paths.
761
728
 
762
729
  ```
763
- export class ProductFirestoreSync extends UpdateFirestoreProjection<
730
+ export class ProductFirestoreSync extends UpdateFirestorePlugin<
764
731
  Product,
765
732
  FirestoreProduct,
766
733
  > {
@@ -773,7 +740,7 @@ export class ProductFirestoreSync extends UpdateFirestoreProjection<
773
740
  or
774
741
 
775
742
  ```
776
- export class ProductFirestoreSync extends UpdateFirestoreProjection<
743
+ export class ProductFirestoreSync extends UpdateFirestorePlugin<
777
744
  Product,
778
745
  FirestoreProduct,
779
746
  > {
@@ -807,11 +774,11 @@ The `EventContext` object will also include a `.state` field containing a Redis-
807
774
  Having a background "services" worker within a `node` process that requires
808
775
  initialization after creation is a very common pattern that you may need to implement.
809
776
 
810
- Traditionally, an author would implement a custom or subclassed `AppModule` to call `start`/`init` at the appropriate time. Another option is to use `inversify`'s `onActivation` method when injecting. `event-handler-lib` provides a `PostInitializationService` interface and binding key to simplify this functionality.
777
+ Traditionally, an author would implement a custom or subclassed `AppModule` to call `start`/`init` at the appropriate time. Another option is to use `inversify`'s `onActivation` method when injecting. `event-handler-lib` provides a `PostInitializationService` interface to simplify this functionality.
811
778
 
812
779
  For a service that must run after the `AppModule` is initialized, its containing class should include a `start()` method that returns either `this` or a `Promise` that `resolves` to `this` (i.e., the method may-or-may-not be `async`).
813
780
 
814
- Binding the container class to `TYPES.PostInitializationService` will ensure that these services will `start` after the rest of the `AppModule` has been initialized.
781
+ Binding the class to `TYPES.PostInitializationServices` will ensure that these services will `start` after the rest of the `AppModule` has been initialized. The interface is `PostInitializationService`. The binding key is plural.
815
782
 
816
783
  ### App Cleanup
817
784
 
@@ -829,7 +796,7 @@ import { AppCleanupHelper } from "@mavenmachines/event-handler-lib";
829
796
 
830
797
  class MyClass {
831
798
  constructor(
832
- @inject(AppCleanupHelper}) private readonly cleanup,
799
+ @inject(AppCleanupHelper) private readonly cleanup,
833
800
  ) {}
834
801
 
835
802
  init() {
@@ -961,7 +928,7 @@ Important caveats:
961
928
  ```
962
929
  // IMPORTANT: The inversify @inject() decorator cannot be applied to method
963
930
  // parameters. The Inject decorator from event-handler-lib must be used.
964
- import { Inject, ProjectionType, ProjectionRepository } from "@mavenmachines/event-handler-lib";
931
+ import { CreationRequestType, Inject, ProjectionType, ProjectionRepository } from "@mavenmachines/event-handler-lib";
965
932
 
966
933
  class CreateTemplateStopRequest {
967
934
  @IsNumber()
@@ -971,7 +938,7 @@ class CreateTemplateStopRequest {
971
938
  stopTemplateId!: string;
972
939
 
973
940
  @IsNumber()
974
- companyLocationId!: number
941
+ companyLocationId!: number;
975
942
 
976
943
  async createEntity(
977
944
  @Inject(ProjectionRepository) projectionRepository: ProjectionRepository,
@@ -982,10 +949,10 @@ class CreateTemplateStopRequest {
982
949
  projectionType: "stopTemplate",
983
950
  entityId: this.stopTemplateId,
984
951
  });
985
- const companyLocation = await companyLocationsClient.getCompanyLocationById(this.companyid, this.companyLocationId);
952
+ const companyLocation = await companyLocationsServiceClient.getCompanyLocationById(this.companyId, this.companyLocationId);
986
953
  return {
987
954
  ...stopTemplateProjection.payload,
988
- companyLocationId: number;
955
+ companyLocationId: this.companyLocationId,
989
956
  latLon: {
990
957
  lat: companyLocation.lat,
991
958
  lon: companyLocation.lon
@@ -994,7 +961,8 @@ class CreateTemplateStopRequest {
994
961
  }
995
962
  }
996
963
 
997
- @ProjectionType("StopTemplate") {
964
+ @ProjectionType("StopTemplate")
965
+ class StopTemplate {
998
966
  /* ... fields for template */
999
967
  }
1000
968
 
@@ -1006,7 +974,7 @@ class LatLon {
1006
974
  lon!: number;
1007
975
  }
1008
976
 
1009
- @CreationRequest(CreateTemplateStopRequest)
977
+ @CreationRequestType(CreateTemplateStopRequest)
1010
978
  class TemplateStop extends StopTemplate {
1011
979
  @IsNumber()
1012
980
  companyLocationId!: number;
@@ -1016,7 +984,8 @@ class TemplateStop extends StopTemplate {
1016
984
  latLon!: LatLon;
1017
985
  }
1018
986
 
1019
- @ProjectionType("RouteTemplate") {
987
+ @ProjectionType("RouteTemplate")
988
+ class RouteTemplate {
1020
989
  /* ... */
1021
990
 
1022
991
  @ValidateNested({ each: true })
@@ -1170,7 +1139,7 @@ Response:
1170
1139
  ```
1171
1140
 
1172
1141
  When paging through search results, the `continuationToken` will be valid for
1173
- ten minutes, after which it will expire and queries will fail. During that time,
1142
+ one minute (`keep_alive: "1m"`), after which it will expire and queries will fail. During that time,
1174
1143
  OpenSearch maintains a point-in-time snapshot of the data, so the results will
1175
1144
  be consistent _at the time of the query_.
1176
1145
 
@@ -1465,14 +1434,13 @@ class TestDependencies extends BaseTestDependencies {
1465
1434
 
1466
1435
  ### Docker Compose
1467
1436
 
1468
- This package exports a `./services/docker-compose.yml` that describes the containers required to run the event handler infrastructure for testing. To use, simply copy the file to your repository root.
1437
+ The git repository contains `services/docker-compose.yml`, which describes the containers required to run the event handler infrastructure for testing. Copy it from a clone of this repository. The published npm package does not include `services/` (`package.json` `"files"` is `bin` and `dist`), so the file is not in `node_modules`.
1469
1438
 
1470
- For services that require MySQL, there are two additional required files that should
1471
- be copied to your project's base directory, alongside `docker-compose.yml`:
1439
+ For services that require MySQL, copy these files from the same directory to your project's base directory, alongside `docker-compose.yml`:
1472
1440
 
1473
- - `./services/my.cnf` has MySQL configuration options to reduce memory usage
1441
+ - `services/my.cnf` has MySQL configuration options to reduce memory usage
1474
1442
  from ~350MB to ~100MB, reducing problems in the BitBucket pipelines
1475
- - `./services/sql-test-bootstrap.sql` is a blank script that can be modified to
1443
+ - `services/sql-test-bootstrap.sql` is a blank script that can be modified to
1476
1444
  perform additional pre-test bootstrapping of the database upon initialization.
1477
1445
  This should not take the place of the `npm run db-migrate-test` command, and
1478
1446
  should instead perform bootstrapping that is required for your tests, but
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eventTypesFromHandlers = eventTypesFromHandlers;
4
4
  exports.loadInjectedEventHandlers = loadInjectedEventHandlers;
5
+ const node_child_process_1 = require("node:child_process");
5
6
  const node_fs_1 = require("node:fs");
6
7
  const node_module_1 = require("node:module");
7
8
  const node_path_1 = require("node:path");
@@ -51,6 +52,66 @@ function exportedContainer(loaded) {
51
52
  const record = loaded;
52
53
  return record.appContainer ?? record.default?.appContainer;
53
54
  }
55
+ const RESULT_FD = 3;
56
+ const ESM_CONTAINER_WORKER = `
57
+ import { writeSync } from "node:fs";
58
+ import { pathToFileURL } from "node:url";
59
+ import "reflect-metadata";
60
+
61
+ const configPath = process.argv[1];
62
+ const key = ${JSON.stringify(dependencyTypes_1.EVENT_HANDLER_BINDING_KEY)};
63
+ const noHandlers = ${JSON.stringify(NO_HANDLERS)};
64
+ const cannotList =
65
+ "appContainer cannot list EventHandler bindings. Export the inversify container as appContainer.";
66
+
67
+ function report(payload) {
68
+ writeSync(${RESULT_FD}, JSON.stringify(payload));
69
+ }
70
+
71
+ try {
72
+ const loaded = await import(pathToFileURL(configPath).href);
73
+ const container = loaded?.appContainer ?? loaded?.default?.appContainer;
74
+ if (!container) {
75
+ report({ error: configPath + " does not export appContainer." });
76
+ process.exit(1);
77
+ }
78
+ if (typeof container.isBound === "function" && !container.isBound(key)) {
79
+ report({ error: noHandlers });
80
+ process.exit(1);
81
+ }
82
+ let handlers;
83
+ try {
84
+ if (typeof container.getAllAsync === "function") {
85
+ handlers = await container.getAllAsync(key);
86
+ } else if (typeof container.getAll === "function") {
87
+ handlers = container.getAll(key);
88
+ } else {
89
+ report({ error: cannotList });
90
+ process.exit(1);
91
+ }
92
+ } catch (err) {
93
+ const message = err instanceof Error ? err.message : String(err);
94
+ const detail =
95
+ err instanceof Error ? err.stack || err.message : message;
96
+ report({
97
+ error: message.includes("No matching bindings") ? noHandlers : detail,
98
+ });
99
+ process.exit(1);
100
+ }
101
+ report({
102
+ handlers: (Array.isArray(handlers) ? handlers : []).map((handler) => ({
103
+ eventType:
104
+ handler && handler.eventType !== undefined ? handler.eventType : null,
105
+ name: handler && handler.constructor ? handler.constructor.name : null,
106
+ })),
107
+ });
108
+ process.exit(0);
109
+ } catch (err) {
110
+ const message = err instanceof Error ? err.stack || err.message : String(err);
111
+ report({ error: message });
112
+ process.exit(1);
113
+ }
114
+ `;
54
115
  function packageType(cwd) {
55
116
  const packageJsonPath = (0, node_path_1.join)(cwd, "package.json");
56
117
  if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
@@ -82,9 +143,9 @@ function isTsxUnavailable(err) {
82
143
  }
83
144
  return err.message.includes("tsx");
84
145
  }
85
- function loadTsx(requireFromService) {
146
+ function resolveTsx(requireFromService) {
86
147
  try {
87
- return requireFromService("tsx/esm/api");
148
+ return requireFromService.resolve("tsx");
88
149
  }
89
150
  catch (err) {
90
151
  if (isTsxUnavailable(err)) {
@@ -93,6 +154,52 @@ function loadTsx(requireFromService) {
93
154
  throw err;
94
155
  }
95
156
  }
157
+ function handlersFromTsxWorker(cwd, tsConfig, tsxLoader) {
158
+ const tsconfigPath = (0, node_path_1.join)(cwd, "tsconfig.json");
159
+ const env = { ...process.env };
160
+ if ((0, node_fs_1.existsSync)(tsconfigPath)) {
161
+ env.TSX_TSCONFIG_PATH = tsconfigPath;
162
+ }
163
+ const result = (0, node_child_process_1.spawnSync)(process.execPath, [
164
+ "--import",
165
+ tsxLoader,
166
+ "--input-type=module",
167
+ "--eval",
168
+ ESM_CONTAINER_WORKER,
169
+ "--",
170
+ tsConfig,
171
+ ], {
172
+ cwd,
173
+ env,
174
+ encoding: "utf8",
175
+ stdio: ["ignore", "inherit", "inherit", "pipe"],
176
+ });
177
+ if (result.error) {
178
+ throw result.error;
179
+ }
180
+ const raw = result.output[RESULT_FD];
181
+ if (typeof raw === "string" && raw.trim() !== "") {
182
+ let parsed;
183
+ try {
184
+ parsed = JSON.parse(raw);
185
+ }
186
+ catch (err) {
187
+ const message = err instanceof Error ? err.message : String(err);
188
+ throw new Error(`Could not read event handlers from ${tsConfig}: ${message}`);
189
+ }
190
+ if (parsed.error) {
191
+ throw new Error(parsed.error);
192
+ }
193
+ return (parsed.handlers ?? []).map((handler) => ({
194
+ eventType: handler.eventType,
195
+ constructor: handler.name ? { name: handler.name } : undefined,
196
+ }));
197
+ }
198
+ const message = result.stderr?.trim() ||
199
+ result.stdout?.trim() ||
200
+ `tsx exited with status ${result.status ?? "unknown"} while loading ${tsConfig}.`;
201
+ throw new Error(message);
202
+ }
96
203
  function containerFromModule(loaded, configPath) {
97
204
  const container = exportedContainer(loaded);
98
205
  if (!container) {
@@ -140,14 +247,14 @@ function loadCjsContainer(cwd, requireFromService, tsConfig) {
140
247
  async function loadEsmContainer(cwd, requireFromService, tsConfig) {
141
248
  const hasTypeScriptContainer = (0, node_fs_1.existsSync)(tsConfig);
142
249
  if (hasTypeScriptContainer) {
143
- const tsx = loadTsx(requireFromService);
144
- if (tsx) {
145
- const tsconfigPath = (0, node_path_1.join)(cwd, "tsconfig.json");
146
- const loaded = await tsx.tsImport((0, node_url_1.pathToFileURL)(tsConfig).href, {
147
- parentURL: (0, node_url_1.pathToFileURL)((0, node_path_1.join)(cwd, "package.json")).href,
148
- tsconfig: (0, node_fs_1.existsSync)(tsconfigPath) ? tsconfigPath : false,
149
- });
150
- return containerFromModule(loaded, tsConfig);
250
+ const tsxLoader = resolveTsx(requireFromService);
251
+ if (tsxLoader) {
252
+ const handlers = handlersFromTsxWorker(cwd, tsConfig, tsxLoader);
253
+ return {
254
+ async getAllAsync() {
255
+ return handlers;
256
+ },
257
+ };
151
258
  }
152
259
  }
153
260
  for (const relative of COMPILED_CONTAINER_PATHS) {
@@ -1 +1 @@
1
- {"version":3,"file":"loadInjectedEventHandlers.js","sourceRoot":"","sources":["../../../src/cli/loadInjectedEventHandlers.ts"],"names":[],"mappings":";;AA2CA,wDAiBC;AA6MD,8DAWC;AApRD,qCAAmD;AACnD,6CAA4C;AAC5C,yCAAiC;AACjC,uCAAyC;AACzC,4BAA0B;AAC1B,qEAA4E;AAM5E,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAEjD,CAAC;AAEtB,MAAM,wBAAwB,GAAG;IAC/B,sCAAsC;IACtC,2CAA2C;IAC3C,uCAAuC;CACxC,CAAC;AAEF,MAAM,WAAW,GACf,yFAAyF,CAAC;AAa5F,SAAS,WAAW,CAAC,OAAwB;IAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;IACvC,IAAI,IAAI,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,sBAAsB,CAAC,QAA2B;IAChE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IACE,OAAO,OAAO,EAAE,SAAS,KAAK,QAAQ;YACtC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,EAC/B,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0BAA0B,WAAW,CAAC,OAAO,CAAC,oBAAoB,CACnE,CAAC;QACJ,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CA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 +13,7 @@ export declare class KafkaConsumer {
13
13
  private readonly streams;
14
14
  private readonly streamLoops;
15
15
  private readonly pendingSeeks;
16
- private readonly topicOps;
16
+ private readonly topicOperations;
17
17
  private readonly closing;
18
18
  private readonly observedAssignmentTopics;
19
19
  private eachMessage?;
@@ -37,12 +37,13 @@ export declare class KafkaConsumer {
37
37
  waitForAssignment(topics: string[]): Promise<void>;
38
38
  getSubscribedTopics(): string[];
39
39
  private waitForGroupJoin;
40
- private enqueueTopicOp;
40
+ private enqueueTopicOperation;
41
41
  private restartTopicStream;
42
42
  private stopTopicStream;
43
43
  private waitForStreamClose;
44
44
  private startTopicStream;
45
45
  private ownsStream;
46
46
  private recoverTopic;
47
+ private retryTopicStream;
47
48
  private processStream;
48
49
  }