@jaypie/constructs 1.2.20 → 1.2.21

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.
@@ -109,7 +109,7 @@ export declare class JaypieWebSocket extends Construct {
109
109
  get callbackUrl(): string;
110
110
  /**
111
111
  * Grant a Lambda function permission to manage WebSocket connections
112
- * (post to connections, delete connections).
112
+ * (post messages to connections, get connection info, delete connections).
113
113
  */
114
114
  grantManageConnections(grantee: lambda.IFunction): iam.Grant;
115
115
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as cdk from 'aws-cdk-lib';
2
- import { Tags, Stack, Fn, CfnOutput, SecretValue, Duration, RemovalPolicy, CfnStack, ArnFormat } from 'aws-cdk-lib';
2
+ import { Tags, Stack, Fn, CfnOutput, SecretValue, Duration, RemovalPolicy, CfnStack } from 'aws-cdk-lib';
3
3
  import * as s3 from 'aws-cdk-lib/aws-s3';
4
4
  import { Bucket, StorageClass, BucketAccessControl, EventType } from 'aws-cdk-lib/aws-s3';
5
5
  import { Construct } from 'constructs';
@@ -10,7 +10,6 @@ import * as route53Targets from 'aws-cdk-lib/aws-route53-targets';
10
10
  import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
11
11
  import { DatadogLambda } from 'datadog-cdk-constructs-v2';
12
12
  import { ConfigurationError } from '@jaypie/errors';
13
- import * as iam from 'aws-cdk-lib/aws-iam';
14
13
  import { Role, PolicyStatement, Policy, FederatedPrincipal, Effect, ServicePrincipal, ManagedPolicy } from 'aws-cdk-lib/aws-iam';
15
14
  import * as acm from 'aws-cdk-lib/aws-certificatemanager';
16
15
  import * as lambda from 'aws-cdk-lib/aws-lambda';
@@ -4305,21 +4304,12 @@ class JaypieWebSocket extends Construct {
4305
4304
  //
4306
4305
  /**
4307
4306
  * Grant a Lambda function permission to manage WebSocket connections
4308
- * (post to connections, delete connections).
4307
+ * (post messages to connections, get connection info, delete connections).
4309
4308
  */
4310
4309
  grantManageConnections(grantee) {
4311
- return iam.Grant.addToPrincipal({
4312
- actions: ["execute-api:ManageConnections"],
4313
- grantee: grantee.grantPrincipal,
4314
- resourceArns: [
4315
- Stack.of(this).formatArn({
4316
- arnFormat: ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME,
4317
- resource: this._api.apiId,
4318
- resourceName: `${this._stage.stageName}/POST/@connections/*`,
4319
- service: "execute-api",
4320
- }),
4321
- ],
4322
- });
4310
+ // Use the CDK's built-in grantManageConnections which properly grants
4311
+ // permissions for all @connections methods (POST, GET, DELETE) across all stages
4312
+ return this._api.grantManageConnections(grantee);
4323
4313
  }
4324
4314
  }
4325
4315