sst-http 2.0.0-beta.6 → 2.0.0-beta.8

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/dist/infra.cjs CHANGED
@@ -48,13 +48,14 @@ function ensureRecord(value, message) {
48
48
  return value;
49
49
  }
50
50
  function ensureSstAws(source) {
51
- const aws = typeof sst !== "undefined" ? sst.aws : source?.sst?.aws ?? globalThis.sst?.aws;
52
- if (!aws) {
51
+ const awsData = typeof sst !== "undefined" ? sst.aws : source?.sst?.aws ?? globalThis.sst?.aws;
52
+ if (!awsData) {
53
53
  throw new Error(
54
54
  "SST aws namespace is not available. Ensure this code runs within an SST config."
55
55
  );
56
56
  }
57
- return aws;
57
+ awsData.iam = aws.iam;
58
+ return awsData;
58
59
  }
59
60
  function resolveHandlerInput(handler) {
60
61
  if (handler === void 0) {
@@ -81,7 +82,7 @@ function wireEventsFromManifest(events, opts) {
81
82
  if (!events || events.length === 0) {
82
83
  return;
83
84
  }
84
- const aws = ensureSstAws(opts.source);
85
+ const aws2 = ensureSstAws(opts.source);
85
86
  const subscriber = resolveHandlerInput(opts.handler);
86
87
  const seen = /* @__PURE__ */ new Set();
87
88
  for (const event of events) {
@@ -90,7 +91,7 @@ function wireEventsFromManifest(events, opts) {
90
91
  continue;
91
92
  }
92
93
  seen.add(key);
93
- const bus = aws.Bus.get("default", "default");
94
+ const bus = aws2.Bus.get("default", "default");
94
95
  const subscriberName = buildSubscriberName(event.event);
95
96
  subscribeToBus(bus, subscriberName, subscriber, event.event);
96
97
  }
@@ -136,8 +137,8 @@ function wireRoutesFromManifest(manifest, opts) {
136
137
  }
137
138
  }
138
139
  function httpApiAdapter(args) {
139
- const aws = args?.api ? void 0 : ensureSstAws(args);
140
- const api = args?.api ?? new aws.ApiGatewayV2(args?.apiName ?? "HttpApi", args?.apiArgs);
140
+ const aws2 = args?.api ? void 0 : ensureSstAws(args);
141
+ const api = args?.api ?? new aws2.ApiGatewayV2(args?.apiName ?? "HttpApi", args?.apiArgs);
141
142
  const ensureJwtAuthorizer = createHttpAuthorizerManager(api);
142
143
  const registerRoute = createRouteRegistrar(api, "ApiGatewayV2");
143
144
  return {
@@ -147,8 +148,8 @@ function httpApiAdapter(args) {
147
148
  };
148
149
  }
149
150
  function restApiAdapter(args) {
150
- const aws = args?.api ? void 0 : ensureSstAws(args);
151
- const api = args?.api ?? new aws.ApiGateway(args?.apiName ?? "RestApi", args?.apiArgs);
151
+ const aws2 = args?.api ? void 0 : ensureSstAws(args);
152
+ const api = args?.api ?? new aws2.ApiGateway(args?.apiName ?? "RestApi", args?.apiArgs);
152
153
  const ensureJwtAuthorizer = createRestAuthorizerManager(api);
153
154
  const registerRoute = createRouteRegistrar(api, "ApiGateway");
154
155
  return {
@@ -329,9 +330,10 @@ function loadRoutesManifest(filePath) {
329
330
  }
330
331
  return manifest;
331
332
  }
333
+ var publisherHandlerCount = 0;
332
334
  function setHandlerBus(handler) {
333
- const aws = ensureSstAws();
334
- new aws.iam.RolePolicy("PublisherHandlerPolicy", {
335
+ const aws2 = ensureSstAws();
336
+ new aws2.iam.RolePolicy("PublisherHandlerPolicy" + publisherHandlerCount ? publisherHandlerCount : "", {
335
337
  role: handler.nodes.role.name,
336
338
  policy: {
337
339
  Version: "2012-10-17",
@@ -344,6 +346,7 @@ function setHandlerBus(handler) {
344
346
  ]
345
347
  }
346
348
  });
349
+ publisherHandlerCount++;
347
350
  }
348
351
  // Annotate the CommonJS export names for ESM import in node:
349
352
  0 && (module.exports = {
package/dist/infra.js CHANGED
@@ -24,13 +24,14 @@ function ensureRecord(value, message) {
24
24
  return value;
25
25
  }
26
26
  function ensureSstAws(source) {
27
- const aws = typeof sst !== "undefined" ? sst.aws : source?.sst?.aws ?? globalThis.sst?.aws;
28
- if (!aws) {
27
+ const awsData = typeof sst !== "undefined" ? sst.aws : source?.sst?.aws ?? globalThis.sst?.aws;
28
+ if (!awsData) {
29
29
  throw new Error(
30
30
  "SST aws namespace is not available. Ensure this code runs within an SST config."
31
31
  );
32
32
  }
33
- return aws;
33
+ awsData.iam = aws.iam;
34
+ return awsData;
34
35
  }
35
36
  function resolveHandlerInput(handler) {
36
37
  if (handler === void 0) {
@@ -57,7 +58,7 @@ function wireEventsFromManifest(events, opts) {
57
58
  if (!events || events.length === 0) {
58
59
  return;
59
60
  }
60
- const aws = ensureSstAws(opts.source);
61
+ const aws2 = ensureSstAws(opts.source);
61
62
  const subscriber = resolveHandlerInput(opts.handler);
62
63
  const seen = /* @__PURE__ */ new Set();
63
64
  for (const event of events) {
@@ -66,7 +67,7 @@ function wireEventsFromManifest(events, opts) {
66
67
  continue;
67
68
  }
68
69
  seen.add(key);
69
- const bus = aws.Bus.get("default", "default");
70
+ const bus = aws2.Bus.get("default", "default");
70
71
  const subscriberName = buildSubscriberName(event.event);
71
72
  subscribeToBus(bus, subscriberName, subscriber, event.event);
72
73
  }
@@ -106,8 +107,8 @@ function wireRoutesFromManifest(manifest, opts) {
106
107
  }
107
108
  }
108
109
  function httpApiAdapter(args) {
109
- const aws = args?.api ? void 0 : ensureSstAws(args);
110
- const api = args?.api ?? new aws.ApiGatewayV2(args?.apiName ?? "HttpApi", args?.apiArgs);
110
+ const aws2 = args?.api ? void 0 : ensureSstAws(args);
111
+ const api = args?.api ?? new aws2.ApiGatewayV2(args?.apiName ?? "HttpApi", args?.apiArgs);
111
112
  const ensureJwtAuthorizer = createHttpAuthorizerManager(api);
112
113
  const registerRoute = createRouteRegistrar(api, "ApiGatewayV2");
113
114
  return {
@@ -117,8 +118,8 @@ function httpApiAdapter(args) {
117
118
  };
118
119
  }
119
120
  function restApiAdapter(args) {
120
- const aws = args?.api ? void 0 : ensureSstAws(args);
121
- const api = args?.api ?? new aws.ApiGateway(args?.apiName ?? "RestApi", args?.apiArgs);
121
+ const aws2 = args?.api ? void 0 : ensureSstAws(args);
122
+ const api = args?.api ?? new aws2.ApiGateway(args?.apiName ?? "RestApi", args?.apiArgs);
122
123
  const ensureJwtAuthorizer = createRestAuthorizerManager(api);
123
124
  const registerRoute = createRouteRegistrar(api, "ApiGateway");
124
125
  return {
@@ -299,9 +300,10 @@ function loadRoutesManifest(filePath) {
299
300
  }
300
301
  return manifest;
301
302
  }
303
+ var publisherHandlerCount = 0;
302
304
  function setHandlerBus(handler) {
303
- const aws = ensureSstAws();
304
- new aws.iam.RolePolicy("PublisherHandlerPolicy", {
305
+ const aws2 = ensureSstAws();
306
+ new aws2.iam.RolePolicy("PublisherHandlerPolicy" + publisherHandlerCount ? publisherHandlerCount : "", {
305
307
  role: handler.nodes.role.name,
306
308
  policy: {
307
309
  Version: "2012-10-17",
@@ -314,6 +316,7 @@ function setHandlerBus(handler) {
314
316
  ]
315
317
  }
316
318
  });
319
+ publisherHandlerCount++;
317
320
  }
318
321
  export {
319
322
  httpApiAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst-http",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.8",
4
4
  "description": "Decorator-based routing for SST v3 with a single Lambda and Firebase JWT authorizer.",
5
5
  "license": "MIT",
6
6
  "author": "",