sst 2.12.1 → 2.13.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.
@@ -126,10 +126,6 @@ export async function useLocalServer(opts) {
126
126
  };
127
127
  },
128
128
  });
129
- process.on("SIGTERM", () => {
130
- handler.broadcastReconnectNotification();
131
- wss.close();
132
- });
133
129
  const bus = useBus();
134
130
  const pending = [];
135
131
  function updateState(cb) {
@@ -435,7 +435,7 @@ export declare class EventBus extends Construct implements SSTConstruct {
435
435
  private addLogGroupTarget;
436
436
  private addCdkFunctionTarget;
437
437
  private subs;
438
- subscribe(type: string, target: FunctionDefinition, props?: {
438
+ subscribe(type: string | string[], target: FunctionDefinition, props?: {
439
439
  retries?: number;
440
440
  }): this;
441
441
  private addFunctionTarget;
@@ -354,9 +354,11 @@ export class EventBus extends Construct {
354
354
  }
355
355
  subs = new Map();
356
356
  subscribe(type, target, props) {
357
- const count = this.subs.get(type) || 0 + 1;
358
- this.subs.set(type, count);
359
- const name = `${type.replaceAll(/[^a-zA-Z_]/g, "_")}_${count}`;
357
+ type = Array.isArray(type) ? type : [type];
358
+ const joined = type.join("_");
359
+ const count = this.subs.get(joined) || 0 + 1;
360
+ this.subs.set(joined, count);
361
+ const name = `${joined.replaceAll(/[^a-zA-Z_]/g, "_")}_${count}`;
360
362
  const retries = props?.retries || this.props.defaults?.retries;
361
363
  const fn = (() => {
362
364
  if (retries) {
@@ -373,7 +375,7 @@ export class EventBus extends Construct {
373
375
  })();
374
376
  this.addRule(this, name + "_rule", {
375
377
  pattern: {
376
- detailType: [type],
378
+ detailType: type,
377
379
  },
378
380
  targets: {
379
381
  [name + "_target"]: {
@@ -188,8 +188,6 @@ export class Queue extends Construct {
188
188
  if (root.debugIncreaseTimeout) {
189
189
  if (!sqsQueueProps.visibilityTimeout ||
190
190
  sqsQueueProps.visibilityTimeout.toSeconds() < 900) {
191
- // TODO
192
- console.log(toCdkDuration("900 seconds"));
193
191
  debugOverrideProps = {
194
192
  visibilityTimeout: toCdkDuration("900 seconds"),
195
193
  };
@@ -13,7 +13,7 @@ export interface RDSProps {
13
13
  /**
14
14
  * Database engine of the cluster. Cannot be changed once set.
15
15
  */
16
- engine: "mysql5.6" | "mysql5.7" | "postgresql10.14" | "postgresql11.13" | "postgresql11.16";
16
+ engine: "mysql5.6" | "mysql5.7" | "postgresql10.14" | "postgresql11.13" | "postgresql11.16" | "postgresql13.9";
17
17
  /**
18
18
  * Name of a database which is automatically created inside the cluster.
19
19
  */
@@ -191,7 +191,7 @@ export declare class RDS extends Construct implements SSTConstruct {
191
191
  getConstructMetadata(): {
192
192
  type: "RDS";
193
193
  data: {
194
- engine: "mysql5.6" | "mysql5.7" | "postgresql10.14" | "postgresql11.13" | "postgresql11.16";
194
+ engine: "mysql5.6" | "mysql5.7" | "postgresql10.14" | "postgresql11.13" | "postgresql11.16" | "postgresql13.9";
195
195
  secretArn: string;
196
196
  types: RDSTypes | undefined;
197
197
  clusterArn: string;
package/constructs/RDS.js CHANGED
@@ -209,7 +209,12 @@ export class RDS extends Construct {
209
209
  version: rds.AuroraPostgresEngineVersion.VER_11_16,
210
210
  });
211
211
  }
212
- throw new Error(`The specified "engine" is not supported for sst.RDS. Only mysql5.6, mysql5.7, postgresql11.13, and postgresql11.16 engines are currently supported.`);
212
+ else if (engine === "postgresql13.9") {
213
+ return rds.DatabaseClusterEngine.auroraPostgres({
214
+ version: rds.AuroraPostgresEngineVersion.VER_13_9,
215
+ });
216
+ }
217
+ throw new Error(`The specified "engine" is not supported for sst.RDS. Only mysql5.6, mysql5.7, postgresql11.13, postgresql11.16, and postgres13.9 engines are currently supported.`);
213
218
  }
214
219
  getScaling(scaling) {
215
220
  return {
@@ -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.13.0",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/sst.mjs CHANGED
@@ -5673,10 +5673,6 @@ async function useLocalServer(opts) {
5673
5673
  };
5674
5674
  }
5675
5675
  });
5676
- process.on("SIGTERM", () => {
5677
- handler.broadcastReconnectNotification();
5678
- wss.close();
5679
- });
5680
5676
  const bus = useBus();
5681
5677
  const pending = [];
5682
5678
  function updateState(cb) {