@schemeless/event-store-types 2.8.2 → 2.9.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.
@@ -38,6 +38,17 @@ export interface EventFlow<PartialPayload = any, Payload extends PartialPayload
38
38
  readonly eventType?: CreatedEvent<Payload>;
39
39
  readonly payloadType?: PartialPayload | Payload;
40
40
  readonly samplePayload?: PartialPayload | Payload;
41
+ /**
42
+ * Extract the shard key for event routing.
43
+ * Events with the same shard key will be processed sequentially in the same partition.
44
+ * Events with different shard keys can be processed in parallel.
45
+ *
46
+ * @param event - The event to extract the shard key from
47
+ * @returns The shard key string, or undefined to use fallback (identifier)
48
+ * @example
49
+ * getShardKey: (event) => event.payload.userId
50
+ */
51
+ readonly getShardKey?: (event: BaseEvent<Payload>) => string | undefined;
41
52
  readonly receive: (eventStore: {
42
53
  receive: (eventFlow: EventFlow<PartialPayload, Payload>) => (eventInput: BaseEventInput<PartialPayload>) => Promise<[CreatedEvent<Payload>, ...Array<CreatedEvent<any>>]>;
43
54
  }) => (eventInputArgs: BaseEventInput<PartialPayload>) => Promise<[CreatedEvent<Payload>, ...Array<CreatedEvent<any>>]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schemeless/event-store-types",
3
- "version": "2.8.2",
3
+ "version": "2.9.0",
4
4
  "typescript:main": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "2c0e643bf4c66dfab9b537dded1bed30cfef15ca"
37
+ "gitHead": "94d1a0a24423072f691d5594c9d966ace2952fe8"
38
38
  }