sst 2.1.30 → 2.1.32

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.
@@ -1,10 +1,5 @@
1
1
  export declare function weakImport(pkg: string): Promise<any>;
2
2
  import { Construct } from "constructs";
3
- import * as rds from "aws-cdk-lib/aws-rds";
4
- import * as appsync from "aws-cdk-lib/aws-appsync";
5
- import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
6
- import * as acm from "aws-cdk-lib/aws-certificatemanager";
7
- import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
8
3
  import { Table } from "./Table.js";
9
4
  import { RDS } from "./RDS.js";
10
5
  import * as appSyncApiDomain from "./util/appSyncApiDomain.js";
@@ -12,6 +7,11 @@ import { SSTConstruct } from "./Construct.js";
12
7
  import { Function as Fn, FunctionProps, FunctionInlineDefinition, FunctionDefinition } from "./Function.js";
13
8
  import { FunctionBindingProps } from "./util/functionBinding.js";
14
9
  import { Permissions } from "./util/permission.js";
10
+ import { Table as CDKTable } from "aws-cdk-lib/aws-dynamodb";
11
+ import { IServerlessCluster } from "aws-cdk-lib/aws-rds";
12
+ import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
13
+ import { AwsIamConfig, BaseDataSource, CfnDomainName, GraphqlApi, GraphqlApiProps, IGraphqlApi, Resolver, ResolverProps } from "aws-cdk-lib/aws-appsync";
14
+ import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
15
15
  export interface AppSyncApiDomainProps extends appSyncApiDomain.CustomDomainProps {
16
16
  }
17
17
  interface AppSyncApiBaseDataSourceProps {
@@ -76,7 +76,7 @@ export interface AppSyncApiDynamoDbDataSourceProps extends AppSyncApiBaseDataSou
76
76
  table?: Table;
77
77
  cdk?: {
78
78
  dataSource?: {
79
- table: dynamodb.Table;
79
+ table: CDKTable;
80
80
  };
81
81
  };
82
82
  }
@@ -110,8 +110,8 @@ export interface AppSyncApiRdsDataSourceProps extends AppSyncApiBaseDataSourcePr
110
110
  databaseName?: string;
111
111
  cdk?: {
112
112
  dataSource?: {
113
- serverlessCluster: rds.IServerlessCluster;
114
- secretStore: secretsmanager.ISecret;
113
+ serverlessCluster: IServerlessCluster;
114
+ secretStore: ISecret;
115
115
  databaseName?: string;
116
116
  };
117
117
  };
@@ -142,7 +142,7 @@ export interface AppSyncApiHttpDataSourceProps extends AppSyncApiBaseDataSourceP
142
142
  endpoint: string;
143
143
  cdk?: {
144
144
  dataSource?: {
145
- authorizationConfig?: appsync.AwsIamConfig;
145
+ authorizationConfig?: AwsIamConfig;
146
146
  };
147
147
  };
148
148
  }
@@ -231,7 +231,7 @@ export interface AppSyncApiResolverProps {
231
231
  /**
232
232
  * This allows you to override the default settings this construct uses internally to create the resolver.
233
233
  */
234
- resolver: Omit<appsync.ResolverProps, "api" | "fieldName" | "typeName" | "dataSource">;
234
+ resolver: Omit<ResolverProps, "api" | "fieldName" | "typeName" | "dataSource">;
235
235
  };
236
236
  }
237
237
  export interface AppSyncApiProps {
@@ -328,10 +328,10 @@ export interface AppSyncApiProps {
328
328
  /**
329
329
  * Allows you to override default settings this construct uses internally to create the AppSync API.
330
330
  */
331
- graphqlApi?: appsync.IGraphqlApi | AppSyncApiCdkGraphqlProps;
331
+ graphqlApi?: IGraphqlApi | AppSyncApiCdkGraphqlProps;
332
332
  };
333
333
  }
334
- export interface AppSyncApiCdkGraphqlProps extends Omit<appsync.GraphqlApiProps, "name" | "schema"> {
334
+ export interface AppSyncApiCdkGraphqlProps extends Omit<GraphqlApiProps, "name" | "schema"> {
335
335
  name?: string;
336
336
  }
337
337
  /**
@@ -364,15 +364,15 @@ export declare class AppSyncApi extends Construct implements SSTConstruct {
364
364
  /**
365
365
  * The internally created appsync api
366
366
  */
367
- graphqlApi: appsync.GraphqlApi;
367
+ graphqlApi: GraphqlApi;
368
368
  /**
369
369
  * If custom domain is enabled, this is the internally created CDK Certificate instance.
370
370
  */
371
- certificate?: acm.ICertificate;
371
+ certificate?: ICertificate;
372
372
  };
373
373
  private readonly props;
374
374
  private _customDomainUrl?;
375
- _cfnDomainName?: appsync.CfnDomainName;
375
+ _cfnDomainName?: CfnDomainName;
376
376
  private readonly functionsByDsKey;
377
377
  private readonly dataSourcesByDsKey;
378
378
  private readonly dsKeysByResKey;
@@ -442,7 +442,7 @@ export declare class AppSyncApi extends Construct implements SSTConstruct {
442
442
  * api.getDataSource("billingDS");
443
443
  * ```
444
444
  */
445
- getDataSource(key: string): appsync.BaseDataSource | undefined;
445
+ getDataSource(key: string): BaseDataSource | undefined;
446
446
  /**
447
447
  * Get a resolver
448
448
  *
@@ -451,7 +451,7 @@ export declare class AppSyncApi extends Construct implements SSTConstruct {
451
451
  * api.getResolver("Mutation charge");
452
452
  * ```
453
453
  */
454
- getResolver(key: string): appsync.Resolver | undefined;
454
+ getResolver(key: string): Resolver | undefined;
455
455
  /**
456
456
  * Binds the given list of resources to all function data sources.
457
457
  *
@@ -11,11 +11,11 @@ export async function weakImport(pkg) {
11
11
  const { print, buildSchema } = await weakImport("graphql");
12
12
  const { mergeTypeDefs } = await weakImport("@graphql-tools/merge");
13
13
  import { Construct } from "constructs";
14
- import * as appsync from "aws-cdk-lib/aws-appsync";
15
14
  import * as appSyncApiDomain from "./util/appSyncApiDomain.js";
16
15
  import { getFunctionRef, isCDKConstruct } from "./Construct.js";
17
16
  import { Function as Fn, } from "./Function.js";
18
17
  import { useProject } from "../project.js";
18
+ import { GraphqlApi, MappingTemplate as CDKMappingTemplate, SchemaFile, } from "aws-cdk-lib/aws-appsync";
19
19
  /////////////////////
20
20
  // Construct
21
21
  /////////////////////
@@ -282,7 +282,7 @@ export class AppSyncApi extends Construct {
282
282
  throw new Error(`Missing "schema" in "${id}" AppSyncApi`);
283
283
  }
284
284
  else if (typeof schema === "string") {
285
- mainSchema = appsync.SchemaFile.fromAsset(schema);
285
+ mainSchema = SchemaFile.fromAsset(schema);
286
286
  }
287
287
  else {
288
288
  if (schema.length === 0) {
@@ -294,13 +294,13 @@ export class AppSyncApi extends Construct {
294
294
  .map(buildSchema));
295
295
  const filePath = path.join(useProject().paths.out, `appsyncapi-${id}-${this.node.addr}.graphql`);
296
296
  fs.writeFileSync(filePath, print(mergedSchema));
297
- mainSchema = appsync.SchemaFile.fromAsset(filePath);
297
+ mainSchema = SchemaFile.fromAsset(filePath);
298
298
  }
299
299
  // build domain
300
300
  const domainData = appSyncApiDomain.buildCustomDomainData(this, customDomain);
301
301
  this._customDomainUrl =
302
302
  domainData && `https://${domainData.domainName}/graphql`;
303
- this.cdk.graphqlApi = new appsync.GraphqlApi(this, "Api", {
303
+ this.cdk.graphqlApi = new GraphqlApi(this, "Api", {
304
304
  name: app.logicalPrefixedName(id),
305
305
  xrayEnabled: true,
306
306
  schema: mainSchema,
@@ -482,9 +482,9 @@ export class AppSyncApi extends Construct {
482
482
  return undefined;
483
483
  }
484
484
  if (mapping.file) {
485
- return appsync.MappingTemplate.fromFile(mapping.file);
485
+ return CDKMappingTemplate.fromFile(mapping.file);
486
486
  }
487
- return appsync.MappingTemplate.fromString(mapping.inline);
487
+ return CDKMappingTemplate.fromString(mapping.inline);
488
488
  }
489
489
  buildDataSourceKey(typeName, fieldName) {
490
490
  return `LambdaDS_${typeName}_${fieldName}`;
@@ -1,5 +1,4 @@
1
1
  import { Construct } from "constructs";
2
- import * as s3 from "aws-cdk-lib/aws-s3";
3
2
  import { Queue } from "./Queue.js";
4
3
  import { Topic } from "./Topic.js";
5
4
  import { SSTConstruct } from "./Construct.js";
@@ -7,11 +6,12 @@ import { Function as Fn, FunctionProps, FunctionInlineDefinition, FunctionDefini
7
6
  import { FunctionBindingProps } from "./util/functionBinding.js";
8
7
  import { Permissions } from "./util/permission.js";
9
8
  import { Duration } from "./util/duration.js";
9
+ import { BucketProps as CDKBucketProps, IBucket, EventType, HttpMethods } from "aws-cdk-lib/aws-s3";
10
10
  export interface BucketCorsRule {
11
11
  /**
12
12
  * The collection of allowed HTTP methods.
13
13
  */
14
- allowedMethods: (keyof typeof s3.HttpMethods)[];
14
+ allowedMethods: (keyof typeof HttpMethods)[];
15
15
  /**
16
16
  * The collection of allowed origins.
17
17
  *
@@ -46,7 +46,7 @@ interface BucketBaseNotificationProps {
46
46
  /**
47
47
  * The S3 event types that will trigger the notification.
48
48
  */
49
- events?: Lowercase<keyof typeof s3.EventType>[];
49
+ events?: Lowercase<keyof typeof EventType>[];
50
50
  /**
51
51
  * S3 object key filter rules to determine which objects trigger this event.
52
52
  */
@@ -219,7 +219,7 @@ export interface BucketProps {
219
219
  * });
220
220
  * ```
221
221
  */
222
- bucket?: s3.IBucket | s3.BucketProps;
222
+ bucket?: IBucket | CDKBucketProps;
223
223
  };
224
224
  }
225
225
  /**
@@ -239,7 +239,7 @@ export declare class Bucket extends Construct implements SSTConstruct {
239
239
  /**
240
240
  * The internally created CDK `Bucket` instance.
241
241
  */
242
- bucket: s3.IBucket;
242
+ bucket: IBucket;
243
243
  };
244
244
  readonly notifications: Record<string, Fn | Queue | Topic>;
245
245
  readonly bindingForAllNotifications: SSTConstruct[];
@@ -1,11 +1,11 @@
1
1
  import { Construct } from "constructs";
2
- import * as s3 from "aws-cdk-lib/aws-s3";
3
- import * as s3Notifications from "aws-cdk-lib/aws-s3-notifications";
4
2
  import { Queue } from "./Queue.js";
5
3
  import { Topic } from "./Topic.js";
6
4
  import { getFunctionRef, isCDKConstruct } from "./Construct.js";
7
5
  import { Function as Fn, } from "./Function.js";
8
6
  import { toCdkDuration } from "./util/duration.js";
7
+ import { Bucket as CDKBucket, EventType, HttpMethods, } from "aws-cdk-lib/aws-s3";
8
+ import { LambdaDestination, SnsDestination, SqsDestination, } from "aws-cdk-lib/aws-s3-notifications";
9
9
  /////////////////////
10
10
  // Construct
11
11
  /////////////////////
@@ -179,7 +179,7 @@ export class Bucket extends Construct {
179
179
  this.cdk.bucket = cdk?.bucket;
180
180
  }
181
181
  else {
182
- this.cdk.bucket = new s3.Bucket(this, "Bucket", {
182
+ this.cdk.bucket = new CDKBucket(this, "Bucket", {
183
183
  bucketName: name,
184
184
  cors: this.buildCorsConfig(cors),
185
185
  ...cdk?.bucket,
@@ -202,7 +202,7 @@ export class Bucket extends Construct {
202
202
  this.addFunctionNotification(scope, notificationName, notification);
203
203
  }
204
204
  }
205
- addQueueNotification(scope, notificationName, notification) {
205
+ addQueueNotification(_scope, notificationName, notification) {
206
206
  // Parse notification props
207
207
  let notificationProps;
208
208
  let queue;
@@ -225,9 +225,9 @@ export class Bucket extends Construct {
225
225
  "object_removed",
226
226
  ];
227
227
  const filters = notificationProps?.filters || [];
228
- events.forEach((event) => this.cdk.bucket.addEventNotification(s3.EventType[event.toUpperCase()], new s3Notifications.SqsDestination(queue.cdk.queue), ...filters));
228
+ events.forEach((event) => this.cdk.bucket.addEventNotification(EventType[event.toUpperCase()], new SqsDestination(queue.cdk.queue), ...filters));
229
229
  }
230
- addTopicNotification(scope, notificationName, notification) {
230
+ addTopicNotification(_scope, notificationName, notification) {
231
231
  // Parse notification props
232
232
  let notificationProps;
233
233
  let topic;
@@ -250,7 +250,7 @@ export class Bucket extends Construct {
250
250
  "object_removed",
251
251
  ];
252
252
  const filters = notificationProps?.filters || [];
253
- events.forEach((event) => this.cdk.bucket.addEventNotification(s3.EventType[event.toUpperCase()], new s3Notifications.SnsDestination(topic.cdk.topic), ...filters));
253
+ events.forEach((event) => this.cdk.bucket.addEventNotification(EventType[event.toUpperCase()], new SnsDestination(topic.cdk.topic), ...filters));
254
254
  }
255
255
  addFunctionNotification(scope, notificationName, notification) {
256
256
  // parse notification
@@ -275,7 +275,7 @@ export class Bucket extends Construct {
275
275
  "object_removed",
276
276
  ];
277
277
  const filters = notificationProps?.filters || [];
278
- events.forEach((event) => this.cdk.bucket.addEventNotification(s3.EventType[event.toUpperCase()], new s3Notifications.LambdaDestination(fn), ...filters));
278
+ events.forEach((event) => this.cdk.bucket.addEventNotification(EventType[event.toUpperCase()], new LambdaDestination(fn), ...filters));
279
279
  // attached permissions
280
280
  this.permissionsAttachedForAllNotifications.forEach((permissions) => fn.attachPermissions(permissions));
281
281
  fn.bind(this.bindingForAllNotifications);
@@ -289,18 +289,18 @@ export class Bucket extends Construct {
289
289
  {
290
290
  allowedHeaders: ["*"],
291
291
  allowedMethods: [
292
- s3.HttpMethods.GET,
293
- s3.HttpMethods.PUT,
294
- s3.HttpMethods.HEAD,
295
- s3.HttpMethods.POST,
296
- s3.HttpMethods.DELETE,
292
+ HttpMethods.GET,
293
+ HttpMethods.PUT,
294
+ HttpMethods.HEAD,
295
+ HttpMethods.POST,
296
+ HttpMethods.DELETE,
297
297
  ],
298
298
  allowedOrigins: ["*"],
299
299
  },
300
300
  ];
301
301
  }
302
302
  return cors.map((e) => ({
303
- allowedMethods: (e.allowedMethods || []).map((method) => s3.HttpMethods[method]),
303
+ allowedMethods: (e.allowedMethods || []).map((method) => HttpMethods[method]),
304
304
  allowedOrigins: e.allowedOrigins,
305
305
  allowedHeaders: e.allowedHeaders,
306
306
  exposedHeaders: e.exposedHeaders,
@@ -1,9 +1,9 @@
1
1
  import { Construct } from "constructs";
2
- import * as iam from "aws-cdk-lib/aws-iam";
3
- import * as cognito from "aws-cdk-lib/aws-cognito";
4
2
  import { SSTConstruct } from "./Construct.js";
5
3
  import { Function as Fn, FunctionProps, FunctionDefinition } from "./Function.js";
6
4
  import { Permissions } from "./util/permission.js";
5
+ import { CfnIdentityPool, CfnIdentityPoolProps, IUserPool, IUserPoolClient, UserPoolClientOptions, UserPoolProps } from "aws-cdk-lib/aws-cognito";
6
+ import { Role } from "aws-cdk-lib/aws-iam";
7
7
  export interface CognitoUserPoolTriggers {
8
8
  createAuthChallenge?: FunctionDefinition;
9
9
  customEmailSender?: FunctionDefinition;
@@ -38,7 +38,7 @@ export interface CognitoTwitterProps {
38
38
  consumerKey: string;
39
39
  consumerSecret: string;
40
40
  }
41
- export interface CognitoCdkCfnIdentityPoolProps extends Omit<cognito.CfnIdentityPoolProps, "allowUnauthenticatedIdentities"> {
41
+ export interface CognitoCdkCfnIdentityPoolProps extends Omit<CfnIdentityPoolProps, "allowUnauthenticatedIdentities"> {
42
42
  allowUnauthenticatedIdentities?: boolean;
43
43
  }
44
44
  export interface CognitoIdentityPoolFederationProps {
@@ -112,11 +112,11 @@ export interface CognitoProps {
112
112
  /**
113
113
  * This allows you to override the default settings this construct uses internally to create the User Pool.
114
114
  */
115
- userPool?: cognito.UserPoolProps | cognito.IUserPool;
115
+ userPool?: UserPoolProps | IUserPool;
116
116
  /**
117
117
  * This allows you to override the default settings this construct uses internally to create the User Pool client.
118
118
  */
119
- userPoolClient?: cognito.UserPoolClientOptions | cognito.IUserPoolClient;
119
+ userPoolClient?: UserPoolClientOptions | IUserPoolClient;
120
120
  };
121
121
  }
122
122
  /**
@@ -133,11 +133,11 @@ export interface CognitoProps {
133
133
  export declare class Cognito extends Construct implements SSTConstruct {
134
134
  readonly id: string;
135
135
  readonly cdk: {
136
- userPool: cognito.IUserPool;
137
- userPoolClient: cognito.IUserPoolClient;
138
- cfnIdentityPool?: cognito.CfnIdentityPool;
139
- authRole: iam.Role;
140
- unauthRole: iam.Role;
136
+ userPool: IUserPool;
137
+ userPoolClient: IUserPoolClient;
138
+ cfnIdentityPool?: CfnIdentityPool;
139
+ authRole: Role;
140
+ unauthRole: Role;
141
141
  };
142
142
  private functions;
143
143
  private props;
@@ -1,23 +1,23 @@
1
1
  import { Construct } from "constructs";
2
- import * as iam from "aws-cdk-lib/aws-iam";
3
- import * as cognito from "aws-cdk-lib/aws-cognito";
4
2
  import { Stack } from "./Stack.js";
5
- import { getFunctionRef, isCDKConstruct, } from "./Construct.js";
3
+ import { getFunctionRef, isCDKConstruct } from "./Construct.js";
6
4
  import { Function as Fn, } from "./Function.js";
7
5
  import { attachPermissionsToRole, attachPermissionsToPolicy, } from "./util/permission.js";
6
+ import { CfnIdentityPool, CfnIdentityPoolRoleAttachment, UserPool, UserPoolClient, UserPoolOperation, } from "aws-cdk-lib/aws-cognito";
7
+ import { Effect, FederatedPrincipal, OpenIdConnectProvider, Policy, PolicyStatement, Role, } from "aws-cdk-lib/aws-iam";
8
8
  const CognitoUserPoolTriggerOperationMapping = {
9
- createAuthChallenge: cognito.UserPoolOperation.CREATE_AUTH_CHALLENGE,
10
- customEmailSender: cognito.UserPoolOperation.CUSTOM_EMAIL_SENDER,
11
- customMessage: cognito.UserPoolOperation.CUSTOM_MESSAGE,
12
- customSmsSender: cognito.UserPoolOperation.CUSTOM_SMS_SENDER,
13
- defineAuthChallenge: cognito.UserPoolOperation.DEFINE_AUTH_CHALLENGE,
14
- postAuthentication: cognito.UserPoolOperation.POST_AUTHENTICATION,
15
- postConfirmation: cognito.UserPoolOperation.POST_CONFIRMATION,
16
- preAuthentication: cognito.UserPoolOperation.PRE_AUTHENTICATION,
17
- preSignUp: cognito.UserPoolOperation.PRE_SIGN_UP,
18
- preTokenGeneration: cognito.UserPoolOperation.PRE_TOKEN_GENERATION,
19
- userMigration: cognito.UserPoolOperation.USER_MIGRATION,
20
- verifyAuthChallengeResponse: cognito.UserPoolOperation.VERIFY_AUTH_CHALLENGE_RESPONSE,
9
+ createAuthChallenge: UserPoolOperation.CREATE_AUTH_CHALLENGE,
10
+ customEmailSender: UserPoolOperation.CUSTOM_EMAIL_SENDER,
11
+ customMessage: UserPoolOperation.CUSTOM_MESSAGE,
12
+ customSmsSender: UserPoolOperation.CUSTOM_SMS_SENDER,
13
+ defineAuthChallenge: UserPoolOperation.DEFINE_AUTH_CHALLENGE,
14
+ postAuthentication: UserPoolOperation.POST_AUTHENTICATION,
15
+ postConfirmation: UserPoolOperation.POST_CONFIRMATION,
16
+ preAuthentication: UserPoolOperation.PRE_AUTHENTICATION,
17
+ preSignUp: UserPoolOperation.PRE_SIGN_UP,
18
+ preTokenGeneration: UserPoolOperation.PRE_TOKEN_GENERATION,
19
+ userMigration: UserPoolOperation.USER_MIGRATION,
20
+ verifyAuthChallengeResponse: UserPoolOperation.VERIFY_AUTH_CHALLENGE_RESPONSE,
21
21
  };
22
22
  /////////////////////
23
23
  // Construct
@@ -141,7 +141,7 @@ export class Cognito extends Construct {
141
141
  : `Auth-${this.node.id}-${scope.node.id}-UnauthRole`;
142
142
  let policy = scope.node.tryFindChild(policyId);
143
143
  if (!policy) {
144
- policy = new iam.Policy(scope, policyId);
144
+ policy = new Policy(scope, policyId);
145
145
  }
146
146
  role.attachInlinePolicy(policy);
147
147
  attachPermissionsToPolicy(policy, permissions);
@@ -154,8 +154,7 @@ export class Cognito extends Construct {
154
154
  this.cdk.userPool = cdk?.userPool;
155
155
  }
156
156
  else {
157
- const cognitoUserPoolProps = (cdk?.userPool ||
158
- {});
157
+ const cognitoUserPoolProps = (cdk?.userPool || {});
159
158
  // validate `lambdaTriggers` is not specified
160
159
  if (cognitoUserPoolProps.lambdaTriggers) {
161
160
  throw new Error(`Cannot configure the "cdk.userPool.lambdaTriggers" in the Cognito construct. Use the "triggers" instead.`);
@@ -164,7 +163,7 @@ export class Cognito extends Construct {
164
163
  if (isCDKConstruct(cdk?.userPoolClient)) {
165
164
  throw new Error(`Cannot import the "userPoolClient" when the "userPool" is not imported.`);
166
165
  }
167
- this.cdk.userPool = new cognito.UserPool(this, "UserPool", {
166
+ this.cdk.userPool = new UserPool(this, "UserPool", {
168
167
  userPoolName: app.logicalPrefixedName(this.node.id),
169
168
  selfSignUpEnabled: true,
170
169
  signInCaseSensitive: false,
@@ -179,9 +178,8 @@ export class Cognito extends Construct {
179
178
  this.cdk.userPoolClient = cdk?.userPoolClient;
180
179
  }
181
180
  else {
182
- const clientProps = (cdk?.userPoolClient ||
183
- {});
184
- this.cdk.userPoolClient = new cognito.UserPoolClient(this, "UserPoolClient", {
181
+ const clientProps = (cdk?.userPoolClient || {});
182
+ this.cdk.userPoolClient = new UserPoolClient(this, "UserPoolClient", {
185
183
  userPool: this.cdk.userPool,
186
184
  ...clientProps,
187
185
  });
@@ -217,7 +215,7 @@ export class Cognito extends Construct {
217
215
  if (!auth0.clientId) {
218
216
  throw new Error(`Auth0ClientId: No Auth0 clientId defined for the "${id}" Auth`);
219
217
  }
220
- const provider = new iam.OpenIdConnectProvider(this, "Auth0Provider", {
218
+ const provider = new OpenIdConnectProvider(this, "Auth0Provider", {
221
219
  url: auth0.domain.startsWith("https://")
222
220
  ? auth0.domain
223
221
  : `https://${auth0.domain}`,
@@ -266,7 +264,7 @@ export class Cognito extends Construct {
266
264
  const identityPoolProps = typeof identityPoolFederation === "object"
267
265
  ? identityPoolFederation.cdk?.cfnIdentityPool || {}
268
266
  : {};
269
- this.cdk.cfnIdentityPool = new cognito.CfnIdentityPool(this, "IdentityPool", {
267
+ this.cdk.cfnIdentityPool = new CfnIdentityPool(this, "IdentityPool", {
270
268
  identityPoolName: app.logicalPrefixedName(id),
271
269
  allowUnauthenticatedIdentities: true,
272
270
  cognitoIdentityProviders,
@@ -277,7 +275,7 @@ export class Cognito extends Construct {
277
275
  this.cdk.authRole = this.createAuthRole(this.cdk.cfnIdentityPool);
278
276
  this.cdk.unauthRole = this.createUnauthRole(this.cdk.cfnIdentityPool);
279
277
  // Attach roles to Identity Pool
280
- new cognito.CfnIdentityPoolRoleAttachment(this, "IdentityPoolRoleAttachment", {
278
+ new CfnIdentityPoolRoleAttachment(this, "IdentityPoolRoleAttachment", {
281
279
  identityPoolId: this.cdk.cfnIdentityPool.ref,
282
280
  roles: {
283
281
  authenticated: this.cdk.authRole.roleArn,
@@ -312,8 +310,8 @@ export class Cognito extends Construct {
312
310
  return lambda;
313
311
  }
314
312
  createAuthRole(identityPool) {
315
- const role = new iam.Role(this, "IdentityPoolAuthRole", {
316
- assumedBy: new iam.FederatedPrincipal("cognito-identity.amazonaws.com", {
313
+ const role = new Role(this, "IdentityPoolAuthRole", {
314
+ assumedBy: new FederatedPrincipal("cognito-identity.amazonaws.com", {
317
315
  StringEquals: {
318
316
  "cognito-identity.amazonaws.com:aud": identityPool.ref,
319
317
  },
@@ -322,8 +320,8 @@ export class Cognito extends Construct {
322
320
  },
323
321
  }, "sts:AssumeRoleWithWebIdentity"),
324
322
  });
325
- role.addToPolicy(new iam.PolicyStatement({
326
- effect: iam.Effect.ALLOW,
323
+ role.addToPolicy(new PolicyStatement({
324
+ effect: Effect.ALLOW,
327
325
  actions: [
328
326
  "mobileanalytics:PutEvents",
329
327
  "cognito-sync:*",
@@ -334,8 +332,8 @@ export class Cognito extends Construct {
334
332
  return role;
335
333
  }
336
334
  createUnauthRole(identityPool) {
337
- const role = new iam.Role(this, "IdentityPoolUnauthRole", {
338
- assumedBy: new iam.FederatedPrincipal("cognito-identity.amazonaws.com", {
335
+ const role = new Role(this, "IdentityPoolUnauthRole", {
336
+ assumedBy: new FederatedPrincipal("cognito-identity.amazonaws.com", {
339
337
  StringEquals: {
340
338
  "cognito-identity.amazonaws.com:aud": identityPool.ref,
341
339
  },
@@ -344,8 +342,8 @@ export class Cognito extends Construct {
344
342
  },
345
343
  }, "sts:AssumeRoleWithWebIdentity"),
346
344
  });
347
- role.addToPolicy(new iam.PolicyStatement({
348
- effect: iam.Effect.ALLOW,
345
+ role.addToPolicy(new PolicyStatement({
346
+ effect: Effect.ALLOW,
349
347
  actions: ["mobileanalytics:PutEvents", "cognito-sync:*"],
350
348
  resources: ["*"],
351
349
  }));
@@ -1,8 +1,5 @@
1
1
  import type { Loader, BuildOptions } from "esbuild";
2
2
  import { Construct } from "constructs";
3
- import * as cdk from "aws-cdk-lib";
4
- import * as lambda from "aws-cdk-lib/aws-lambda";
5
- import * as logs from "aws-cdk-lib/aws-logs";
6
3
  import { Stack } from "./Stack.js";
7
4
  import { SSTConstruct } from "./Construct.js";
8
5
  import { Size } from "./util/size.js";
@@ -10,31 +7,34 @@ import { Duration } from "./util/duration.js";
10
7
  import { FunctionBindingProps } from "./util/functionBinding.js";
11
8
  import { Permissions } from "./util/permission.js";
12
9
  import * as functionUrlCors from "./util/functionUrlCors.js";
10
+ import { Architecture, Function as CDKFunction, FunctionOptions, ILayerVersion, Runtime as CDKRuntime, Tracing } from "aws-cdk-lib/aws-lambda";
11
+ import { RetentionDays } from "aws-cdk-lib/aws-logs";
12
+ import { Size as CDKSize, Duration as CDKDuration } from "aws-cdk-lib";
13
13
  declare const supportedRuntimes: {
14
- rust: cdk.aws_lambda.Runtime;
15
- nodejs: cdk.aws_lambda.Runtime;
16
- "nodejs4.3": cdk.aws_lambda.Runtime;
17
- "nodejs6.10": cdk.aws_lambda.Runtime;
18
- "nodejs8.10": cdk.aws_lambda.Runtime;
19
- "nodejs10.x": cdk.aws_lambda.Runtime;
20
- "nodejs12.x": cdk.aws_lambda.Runtime;
21
- "nodejs14.x": cdk.aws_lambda.Runtime;
22
- "nodejs16.x": cdk.aws_lambda.Runtime;
23
- "nodejs18.x": cdk.aws_lambda.Runtime;
24
- "python2.7": cdk.aws_lambda.Runtime;
25
- "python3.6": cdk.aws_lambda.Runtime;
26
- "python3.7": cdk.aws_lambda.Runtime;
27
- "python3.8": cdk.aws_lambda.Runtime;
28
- "python3.9": cdk.aws_lambda.Runtime;
29
- "dotnetcore1.0": cdk.aws_lambda.Runtime;
30
- "dotnetcore2.0": cdk.aws_lambda.Runtime;
31
- "dotnetcore2.1": cdk.aws_lambda.Runtime;
32
- "dotnetcore3.1": cdk.aws_lambda.Runtime;
33
- dotnet6: cdk.aws_lambda.Runtime;
34
- java8: cdk.aws_lambda.Runtime;
35
- java11: cdk.aws_lambda.Runtime;
36
- "go1.x": cdk.aws_lambda.Runtime;
37
- go: cdk.aws_lambda.Runtime;
14
+ rust: CDKRuntime;
15
+ nodejs: CDKRuntime;
16
+ "nodejs4.3": CDKRuntime;
17
+ "nodejs6.10": CDKRuntime;
18
+ "nodejs8.10": CDKRuntime;
19
+ "nodejs10.x": CDKRuntime;
20
+ "nodejs12.x": CDKRuntime;
21
+ "nodejs14.x": CDKRuntime;
22
+ "nodejs16.x": CDKRuntime;
23
+ "nodejs18.x": CDKRuntime;
24
+ "python2.7": CDKRuntime;
25
+ "python3.6": CDKRuntime;
26
+ "python3.7": CDKRuntime;
27
+ "python3.8": CDKRuntime;
28
+ "python3.9": CDKRuntime;
29
+ "dotnetcore1.0": CDKRuntime;
30
+ "dotnetcore2.0": CDKRuntime;
31
+ "dotnetcore2.1": CDKRuntime;
32
+ "dotnetcore3.1": CDKRuntime;
33
+ dotnet6: CDKRuntime;
34
+ java8: CDKRuntime;
35
+ java11: CDKRuntime;
36
+ "go1.x": CDKRuntime;
37
+ go: CDKRuntime;
38
38
  };
39
39
  export type Runtime = keyof typeof supportedRuntimes;
40
40
  export type FunctionInlineDefinition = string | Function;
@@ -51,7 +51,7 @@ export interface FunctionHooks {
51
51
  */
52
52
  afterBuild?: (props: FunctionProps, out: string) => Promise<void>;
53
53
  }
54
- export interface FunctionProps extends Omit<lambda.FunctionOptions, "functionName" | "memorySize" | "timeout" | "runtime" | "tracing" | "layers" | "architecture" | "logRetention"> {
54
+ export interface FunctionProps extends Omit<FunctionOptions, "functionName" | "memorySize" | "timeout" | "runtime" | "tracing" | "layers" | "architecture" | "logRetention"> {
55
55
  /**
56
56
  * Used to configure additional files to copy into the function bundle
57
57
  *
@@ -91,7 +91,7 @@ export interface FunctionProps extends Omit<lambda.FunctionOptions, "functionNam
91
91
  * })
92
92
  * ```
93
93
  */
94
- architecture?: Lowercase<keyof Pick<typeof lambda.Architecture, "ARM_64" | "X86_64">>;
94
+ architecture?: Lowercase<keyof Pick<typeof Architecture, "ARM_64" | "X86_64">>;
95
95
  /**
96
96
  * By default, the name of the function is auto-generated by AWS. You can configure the name by providing a string.
97
97
  *
@@ -185,7 +185,7 @@ export interface FunctionProps extends Omit<lambda.FunctionOptions, "functionNam
185
185
  * })
186
186
  *```
187
187
  */
188
- tracing?: Lowercase<keyof typeof lambda.Tracing>;
188
+ tracing?: Lowercase<keyof typeof Tracing>;
189
189
  /**
190
190
  * Can be used to disable Live Lambda Development when using `sst start`. Useful for things like Custom Resources that need to execute during deployment.
191
191
  *
@@ -278,7 +278,7 @@ export interface FunctionProps extends Omit<lambda.FunctionOptions, "functionNam
278
278
  * })
279
279
  * ```
280
280
  */
281
- layers?: (string | lambda.ILayerVersion)[];
281
+ layers?: (string | ILayerVersion)[];
282
282
  /**
283
283
  * The duration function logs are kept in CloudWatch Logs.
284
284
  *
@@ -292,7 +292,7 @@ export interface FunctionProps extends Omit<lambda.FunctionOptions, "functionNam
292
292
  * })
293
293
  * ```
294
294
  */
295
- logRetention?: Lowercase<keyof typeof logs.RetentionDays>;
295
+ logRetention?: Lowercase<keyof typeof RetentionDays>;
296
296
  }
297
297
  export interface FunctionNameProps {
298
298
  /**
@@ -534,7 +534,7 @@ export interface FunctionCopyFilesProps {
534
534
  * });
535
535
  * ```
536
536
  */
537
- export declare class Function extends lambda.Function implements SSTConstruct {
537
+ export declare class Function extends CDKFunction implements SSTConstruct {
538
538
  readonly id: string;
539
539
  readonly _isLiveDevEnabled: boolean;
540
540
  /** @internal */
@@ -580,11 +580,11 @@ export declare class Function extends lambda.Function implements SSTConstruct {
580
580
  private isNodeRuntime;
581
581
  static validateHandlerSet(id: string, props: FunctionProps): void;
582
582
  static validateVpcSettings(id: string, props: FunctionProps): void;
583
- static buildLayers(scope: Construct, id: string, props: FunctionProps): cdk.aws_lambda.ILayerVersion[];
583
+ static buildLayers(scope: Construct, id: string, props: FunctionProps): ILayerVersion[];
584
584
  static normalizeMemorySize(memorySize?: number | Size): number;
585
- static normalizeDiskSize(diskSize?: number | Size): cdk.Size;
586
- static normalizeTimeout(timeout?: number | Duration): cdk.Duration;
587
- static handleImportedLayer(scope: Construct, layer: lambda.ILayerVersion): lambda.ILayerVersion;
585
+ static normalizeDiskSize(diskSize?: number | Size): CDKSize;
586
+ static normalizeTimeout(timeout?: number | Duration): CDKDuration;
587
+ static handleImportedLayer(scope: Construct, layer: ILayerVersion): ILayerVersion;
588
588
  static isInlineDefinition(definition: any): definition is FunctionInlineDefinition;
589
589
  static fromDefinition(scope: Construct, id: string, definition: FunctionDefinition, inheritedProps?: FunctionProps, inheritErrorMessage?: string): Function;
590
590
  static mergeProps(baseProps?: FunctionProps, props?: FunctionProps): FunctionProps;