sst 2.26.9 → 2.26.11

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.
@@ -4,7 +4,7 @@ import { SSTConstruct } from "./Construct.js";
4
4
  import { Permissions } from "./util/permission.js";
5
5
  import { FunctionBindingProps } from "./util/functionBinding.js";
6
6
  import { IVpc } from "aws-cdk-lib/aws-ec2";
7
- import { Cluster, ContainerDefinitionOptions, CpuArchitecture, FargateServiceProps } from "aws-cdk-lib/aws-ecs";
7
+ import { Cluster, ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps } from "aws-cdk-lib/aws-ecs";
8
8
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
9
9
  import { ApplicationTargetGroupProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
10
10
  declare const supportedCpus: {
@@ -394,6 +394,7 @@ export declare class Service extends Construct implements SSTConstruct {
394
394
  private cluster;
395
395
  private container;
396
396
  private taskDefinition;
397
+ private service;
397
398
  private distribution?;
398
399
  constructor(scope: Construct, id: string, props?: ServiceProps);
399
400
  /**
@@ -411,6 +412,8 @@ export declare class Service extends Construct implements SSTConstruct {
411
412
  get cdk(): {
412
413
  vpc: IVpc;
413
414
  cluster: Cluster;
415
+ fargateService: FargateService;
416
+ taskDefinition: FargateTaskDefinition;
414
417
  distribution: import("aws-cdk-lib/aws-cloudfront").IDistribution | undefined;
415
418
  hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
416
419
  certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
@@ -145,6 +145,7 @@ export class Service extends Construct {
145
145
  cluster;
146
146
  container;
147
147
  taskDefinition;
148
+ service;
148
149
  distribution;
149
150
  constructor(scope, id, props) {
150
151
  super(scope, id);
@@ -168,7 +169,9 @@ export class Service extends Construct {
168
169
  useServices().add(stack.stackName, id, this.props);
169
170
  if (this.doNotDeploy) {
170
171
  // @ts-expect-error
171
- this.vpc = this.cluster = this.container = this.taskDefinition = null;
172
+ this.vpc = this.cluster = null;
173
+ // @ts-expect-error
174
+ this.service = this.container = this.taskDefinition = null;
172
175
  // @ts-expect-error
173
176
  this.distribution = null;
174
177
  this.devFunction = this.createDevFunction();
@@ -184,6 +187,7 @@ export class Service extends Construct {
184
187
  this.distribution = this.createDistribution(alb);
185
188
  this.vpc = vpc;
186
189
  this.cluster = cluster;
190
+ this.service = service;
187
191
  this.container = container;
188
192
  this.taskDefinition = taskDefinition;
189
193
  this.bindForService(props?.bind || []);
@@ -244,6 +248,8 @@ export class Service extends Construct {
244
248
  return {
245
249
  vpc: this.vpc,
246
250
  cluster: this.cluster,
251
+ fargateService: this.service,
252
+ taskDefinition: this.taskDefinition,
247
253
  distribution: this.distribution?.cdk.distribution,
248
254
  hostedZone: this.distribution?.cdk.hostedZone,
249
255
  certificate: this.distribution?.cdk.certificate,
@@ -56,6 +56,12 @@ export function AuthHandler(input) {
56
56
  };
57
57
  return ApiHandler(async (evt) => {
58
58
  const step = usePathParam("step");
59
+ if (!step) {
60
+ return (input.callbacks.index?.(evt) || {
61
+ statusCode: 404,
62
+ body: "Not found",
63
+ });
64
+ }
59
65
  if (step === "favicon.ico") {
60
66
  return {
61
67
  statusCode: 404,
@@ -238,6 +244,12 @@ export function AuthHandler(input) {
238
244
  });
239
245
  }
240
246
  if (response_type === "token" || response_type === "code") {
247
+ if (!redirect_uri) {
248
+ return ((await input.callbacks.auth.error?.(new UnknownStateError())) || {
249
+ statusCode: 400,
250
+ body: new UnknownStateError().message,
251
+ });
252
+ }
241
253
  const onSuccess = await input.callbacks.auth.success({
242
254
  provider,
243
255
  ...result.properties,
@@ -283,7 +295,7 @@ export function AuthHandler(input) {
283
295
  }, {
284
296
  expires: new Date(1),
285
297
  });
286
- const { client_id, redirect_uri, state } = useCookies();
298
+ const { client_id, state } = useCookies();
287
299
  if (response_type === "token") {
288
300
  const location = new URL(redirect_uri);
289
301
  location.hash = `access_token=${token}&state=${state || ""}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.26.9",
4
+ "version": "2.26.11",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/project.d.ts CHANGED
@@ -57,6 +57,7 @@ interface Project {
57
57
  metafile: Metafile;
58
58
  stacks: SSTConfig["stacks"];
59
59
  }
60
+ export declare function setProject(p: Project): void;
60
61
  export declare function useProject(): Project;
61
62
  interface GlobalOptions {
62
63
  profile?: string;
package/project.js CHANGED
@@ -13,6 +13,9 @@ const DEFAULTS = {
13
13
  ssmPrefix: undefined,
14
14
  };
15
15
  let project;
16
+ export function setProject(p) {
17
+ project = p;
18
+ }
16
19
  export function useProject() {
17
20
  if (!project)
18
21
  throw new Error("Project not initialized");
package/stacks/synth.js CHANGED
@@ -4,17 +4,10 @@ import { useAWSProvider, useSTSIdentity } from "../credentials.js";
4
4
  import * as contextproviders from "sst-aws-cdk/lib/context-providers/index.js";
5
5
  import path from "path";
6
6
  import { VisibleError } from "../error.js";
7
+ import fs from "fs/promises";
7
8
  export async function synth(opts) {
8
9
  Logger.debug("Synthesizing stacks...");
9
10
  const { App } = await import("../constructs/App.js");
10
- const { useNodeHandler } = await import("../runtime/handlers/node.js");
11
- const { useGoHandler } = await import("../runtime/handlers/go.js");
12
- const { useContainerHandler } = await import("../runtime/handlers/container.js");
13
- const { useRustHandler } = await import("../runtime/handlers/rust.js");
14
- const { usePythonHandler } = await import("../runtime/handlers/python.js");
15
- const { useJavaHandler } = await import("../runtime/handlers/java.js");
16
- if (opts.mode !== "remove") {
17
- }
18
11
  const cxapi = await import("@aws-cdk/cx-api");
19
12
  const { Configuration } = await import("sst-aws-cdk/lib/settings.js");
20
13
  const project = useProject();
@@ -23,6 +16,8 @@ export async function synth(opts) {
23
16
  ...opts,
24
17
  buildDir: opts.buildDir || path.join(project.paths.out, "dist"),
25
18
  };
19
+ await fs.rm(opts.buildDir, { recursive: true, force: true });
20
+ await fs.mkdir(opts.buildDir, { recursive: true });
26
21
  /*
27
22
  console.log(JSON.stringify(cfg.context));
28
23
  const executable = new CloudExecutable({