sst 2.12.1 → 2.12.2

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.
@@ -19,10 +19,22 @@ export declare function createEventBuilder<Bus extends keyof typeof EventBus, Me
19
19
  export type inferEvent<T extends {
20
20
  shape: ZodObject<any>;
21
21
  }> = z.infer<T["shape"]>;
22
- export declare function EventHandler<Event extends {
22
+ type Event = {
23
+ type: string;
23
24
  shape: {
24
25
  properties: any;
25
26
  metadata: any;
26
27
  metadataFn: any;
27
28
  };
28
- }>(_events: Event, cb: (properties: Event["shape"]["properties"], metadata: undefined extends Event["shape"]["metadata"] ? Event["shape"]["metadataFn"] : Event["shape"]["metadata"]) => Promise<void>): (event: EventBridgeEvent<string, any>) => Promise<void>;
29
+ };
30
+ type EventPayload<E extends Event> = {
31
+ type: E["type"];
32
+ properties: E["shape"]["properties"];
33
+ metadata: undefined extends E["shape"]["metadata"] ? E["shape"]["metadataFn"] : E["shape"]["metadata"];
34
+ };
35
+ export declare function EventHandler<Events extends Event>(_events: Events | Events[], cb: (evt: {
36
+ [K in Events["type"]]: EventPayload<Extract<Events, {
37
+ type: K;
38
+ }>>;
39
+ }[Events["type"]]) => Promise<void>): (event: EventBridgeEvent<string, any>) => Promise<void>;
40
+ export {};
@@ -47,7 +47,10 @@ export function createEventBuilder(props) {
47
47
  }
48
48
  export function EventHandler(_events, cb) {
49
49
  return async (event) => {
50
- console.log("received", event);
51
- await cb(event.detail.properties, event.detail.metadata);
50
+ await cb({
51
+ type: event["detail-type"],
52
+ properties: event.detail.properties,
53
+ metadata: event.detail.metadata,
54
+ });
52
55
  };
53
56
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.12.1",
4
+ "version": "2.12.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },