@jaypie/constructs 1.1.38 → 1.1.39

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.
@@ -25,7 +25,7 @@ export interface JaypieLambdaProps {
25
25
  [key: string]: secretsmanager.ISecret;
26
26
  };
27
27
  ephemeralStorageSize?: import("aws-cdk-lib").Size;
28
- filesystem?: lambda.FileSystemConfig;
28
+ filesystem?: lambda.FileSystem;
29
29
  handler: string;
30
30
  initialPolicy?: iam.PolicyStatement[];
31
31
  layers?: lambda.ILayerVersion[];
@@ -60,40 +60,10 @@ export interface JaypieLambdaProps {
60
60
  export declare class JaypieLambda extends Construct implements lambda.IFunction {
61
61
  private readonly _lambda;
62
62
  private readonly _provisioned?;
63
- private readonly _code;
64
63
  private readonly _reference;
65
- private readonly _handler;
66
- private readonly _memorySize;
67
- private readonly _timeout;
68
- private readonly _runtime;
69
- private readonly _environment;
70
- private readonly _vpc?;
71
- private readonly _vpcSubnets?;
72
- private readonly _securityGroups?;
73
- private readonly _reservedConcurrentExecutions?;
74
- private readonly _layers;
75
- private readonly _architecture;
76
- private readonly _ephemeralStorageSize?;
77
- private readonly _codeSigningConfig?;
78
- private readonly _filesystemConfigs?;
79
- private readonly _environmentEncryption?;
80
- private readonly _tracing?;
81
- private readonly _profiling?;
82
- private readonly _profilingGroup?;
83
- private readonly _logRetentionRole?;
84
- private readonly _logRetentionRetryOptions?;
85
- private readonly _initialPolicy?;
86
- private readonly _description?;
87
- private readonly _maxEventAge?;
88
- private readonly _retryAttempts?;
89
- private readonly _runtimeManagementMode?;
90
- private readonly _allowAllOutbound?;
91
- private readonly _allowPublicSubnet?;
92
- private readonly _deadLetterQueueEnabled?;
93
64
  constructor(scope: Construct, id: string, props: JaypieLambdaProps);
94
65
  get lambda(): lambda.Function;
95
66
  get provisioned(): lambda.Alias | undefined;
96
- get code(): lambda.Code;
97
67
  get reference(): lambda.IFunction;
98
68
  get functionArn(): string;
99
69
  get functionName(): string;
@@ -110,65 +80,21 @@ export declare class JaypieLambda extends Construct implements lambda.IFunction
110
80
  addFunctionUrl(options?: lambda.FunctionUrlOptions): lambda.FunctionUrl;
111
81
  addPermission(id: string, permission: lambda.Permission): void;
112
82
  addToRolePolicy(statement: iam.PolicyStatement): void;
113
- addEnvironment(key: string, value: string, options?: lambda.EnvironmentOptions): lambda.Function;
114
83
  configureAsyncInvoke(options: lambda.EventInvokeConfigOptions): void;
115
84
  grantInvoke(grantee: iam.IGrantable): iam.Grant;
116
85
  grantInvokeCompositePrincipal(compositePrincipal: iam.CompositePrincipal): iam.Grant[];
117
86
  grantInvokeUrl(grantee: iam.IGrantable): iam.Grant;
87
+ grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
88
+ grantInvokeVersion(grantee: iam.IGrantable, version: lambda.IVersion): iam.Grant;
118
89
  metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
119
90
  metricDuration(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
120
91
  metricErrors(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
121
92
  metricInvocations(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
122
93
  metricThrottles(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
123
- grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
124
- grantInvokeVersion(grantee: iam.IGrantable, version: lambda.Version): iam.Grant;
125
94
  get env(): {
126
95
  account: string;
127
96
  region: string;
128
97
  };
129
98
  get stack(): Stack;
130
99
  applyRemovalPolicy(policy: RemovalPolicy): void;
131
- get currentVersion(): lambda.Version;
132
- get deadLetterQueue(): import("aws-cdk-lib/aws-sqs").IQueue | undefined;
133
- get deadLetterTopic(): import("aws-cdk-lib/aws-sns").ITopic | undefined;
134
- get logGroup(): import("aws-cdk-lib/aws-logs").ILogGroup;
135
- get runtime(): lambda.Runtime;
136
- get timeout(): Duration | undefined;
137
- addAlias(aliasName: string, options?: lambda.AliasOptions): lambda.Alias;
138
- addLayers(...layers: lambda.ILayerVersion[]): void;
139
- invalidateVersionBasedOn(x: string): void;
140
- metricConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
141
- metricUnreservedConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
142
- addVersion(name: string, codeSha256?: string, description?: string, provisionedExecutions?: number, asyncInvokeConfig?: lambda.EventInvokeConfigOptions): lambda.Version;
143
- get memorySize(): number | undefined;
144
- get handler(): string;
145
- get environment(): {
146
- [key: string]: string;
147
- } | undefined;
148
- get layers(): lambda.ILayerVersion[] | undefined;
149
- get maxEventAge(): Duration | undefined;
150
- get retryAttempts(): number | undefined;
151
- get reservedConcurrentExecutions(): number | undefined;
152
- get description(): string | undefined;
153
- get initialPolicy(): iam.PolicyStatement[] | undefined;
154
- get logRetentionRole(): iam.IRole | undefined;
155
- get logRetentionRetryOptions(): lambda.LogRetentionRetryOptions | undefined;
156
- get tracing(): lambda.Tracing | undefined;
157
- get profiling(): boolean | undefined;
158
- get profilingGroup(): import("aws-cdk-lib/aws-codeguruprofiler").IProfilingGroup | undefined;
159
- get environmentEncryption(): import("aws-cdk-lib/aws-kms").IKey | undefined;
160
- get codeSigningConfig(): lambda.ICodeSigningConfig | undefined;
161
- get filesystemConfig(): lambda.FileSystemConfig | undefined;
162
- get filesystemConfigs(): lambda.FileSystemConfig[] | undefined;
163
- get ephemeralStorageSize(): number | undefined;
164
- get runtimeManagementMode(): lambda.RuntimeManagementMode | undefined;
165
- get architectureLabel(): string;
166
- get vpc(): ec2.IVpc | undefined;
167
- get vpcSubnets(): ec2.SubnetSelection | undefined;
168
- get securityGroups(): ec2.ISecurityGroup[] | undefined;
169
- get allowAllOutbound(): boolean | undefined;
170
- get allowPublicSubnet(): boolean | undefined;
171
- get canCreateLambdaLogGroup(): boolean;
172
- get canCreatePermissions(): boolean;
173
- get deadLetterQueueEnabled(): boolean | undefined;
174
100
  }
package/dist/esm/index.js CHANGED
@@ -12,7 +12,6 @@ import * as s3n from 'aws-cdk-lib/aws-s3-notifications';
12
12
  import * as lambda from 'aws-cdk-lib/aws-lambda';
13
13
  import * as sqs from 'aws-cdk-lib/aws-sqs';
14
14
  import * as lambdaEventSources from 'aws-cdk-lib/aws-lambda-event-sources';
15
- import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
16
15
  import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
17
16
  import { ServicePrincipal, Role, FederatedPrincipal, PolicyStatement, Effect } from 'aws-cdk-lib/aws-iam';
18
17
  import { LogGroup, RetentionDays, FilterPattern } from 'aws-cdk-lib/aws-logs';
@@ -336,7 +335,7 @@ class JaypieLambda extends Construct {
336
335
  environment[envVar] = process.env[envVar];
337
336
  }
338
337
  });
339
- this._code = typeof code === "string" ? lambda.Code.fromAsset(code) : code;
338
+ const codeAsset = typeof code === "string" ? lambda.Code.fromAsset(code) : code;
340
339
  // Create a working copy of layers
341
340
  const resolvedLayers = [...layers];
342
341
  // Determine if we should add Datadog integration
@@ -407,7 +406,7 @@ class JaypieLambda extends Construct {
407
406
  allowAllOutbound,
408
407
  allowPublicSubnet,
409
408
  architecture,
410
- code: this._code,
409
+ code: codeAsset,
411
410
  codeSigningConfig,
412
411
  deadLetterQueue,
413
412
  deadLetterQueueEnabled,
@@ -420,7 +419,7 @@ class JaypieLambda extends Construct {
420
419
  },
421
420
  environmentEncryption,
422
421
  ephemeralStorageSize,
423
- filesystem: filesystem ? { config: filesystem } : undefined,
422
+ filesystem,
424
423
  handler,
425
424
  initialPolicy,
426
425
  layers: resolvedLayers,
@@ -482,40 +481,6 @@ class JaypieLambda extends Construct {
482
481
  if (vendorTag) {
483
482
  Tags.of(this._lambda).add(CDK$2.TAG.VENDOR, vendorTag);
484
483
  }
485
- // Store constructor props for later access
486
- this._handler = handler;
487
- this._memorySize = memorySize;
488
- this._timeout =
489
- typeof timeout === "number" ? Duration.seconds(timeout) : timeout;
490
- this._runtime = runtime;
491
- this._environment = {
492
- ...environment,
493
- ...secretsEnvironment,
494
- ...jaypieSecretsEnvironment,
495
- };
496
- this._vpc = vpc;
497
- this._vpcSubnets = vpcSubnets;
498
- this._securityGroups = securityGroups;
499
- this._reservedConcurrentExecutions = reservedConcurrentExecutions;
500
- this._layers = resolvedLayers;
501
- this._architecture = architecture;
502
- this._ephemeralStorageSize = ephemeralStorageSize?.toMebibytes();
503
- this._codeSigningConfig = codeSigningConfig;
504
- this._filesystemConfigs = filesystem ? [filesystem] : undefined;
505
- this._environmentEncryption = environmentEncryption;
506
- this._tracing = tracing;
507
- this._profiling = profiling;
508
- this._profilingGroup = profilingGroup;
509
- this._logRetentionRole = logRetentionRole;
510
- this._logRetentionRetryOptions = logRetentionRetryOptions;
511
- this._initialPolicy = initialPolicy;
512
- this._description = description;
513
- this._maxEventAge = maxEventAge;
514
- this._retryAttempts = retryAttempts;
515
- this._runtimeManagementMode = runtimeManagementMode;
516
- this._allowAllOutbound = allowAllOutbound;
517
- this._allowPublicSubnet = allowPublicSubnet;
518
- this._deadLetterQueueEnabled = deadLetterQueueEnabled;
519
484
  // Assign _reference based on provisioned state
520
485
  this._reference =
521
486
  this._provisioned !== undefined ? this._provisioned : this._lambda;
@@ -527,9 +492,6 @@ class JaypieLambda extends Construct {
527
492
  get provisioned() {
528
493
  return this._provisioned;
529
494
  }
530
- get code() {
531
- return this._code;
532
- }
533
495
  get reference() {
534
496
  return this._reference;
535
497
  }
@@ -579,9 +541,6 @@ class JaypieLambda extends Construct {
579
541
  addToRolePolicy(statement) {
580
542
  this._reference.addToRolePolicy(statement);
581
543
  }
582
- addEnvironment(key, value, options) {
583
- return this._lambda.addEnvironment(key, value, options);
584
- }
585
544
  configureAsyncInvoke(options) {
586
545
  this._reference.configureAsyncInvoke(options);
587
546
  }
@@ -594,6 +553,12 @@ class JaypieLambda extends Construct {
594
553
  grantInvokeUrl(grantee) {
595
554
  return this._reference.grantInvokeUrl(grantee);
596
555
  }
556
+ grantInvokeLatestVersion(grantee) {
557
+ return this._reference.grantInvokeLatestVersion(grantee);
558
+ }
559
+ grantInvokeVersion(grantee, version) {
560
+ return this._reference.grantInvokeVersion(grantee, version);
561
+ }
597
562
  metric(metricName, props) {
598
563
  return this._reference.metric(metricName, props);
599
564
  }
@@ -609,13 +574,6 @@ class JaypieLambda extends Construct {
609
574
  metricThrottles(props) {
610
575
  return this._reference.metricThrottles(props);
611
576
  }
612
- // Additional IFunction implementation
613
- grantInvokeLatestVersion(grantee) {
614
- return this._reference.grantInvokeLatestVersion(grantee);
615
- }
616
- grantInvokeVersion(grantee, version) {
617
- return this._reference.grantInvokeVersion(grantee, version);
618
- }
619
577
  get env() {
620
578
  return {
621
579
  account: Stack.of(this).account,
@@ -628,147 +586,6 @@ class JaypieLambda extends Construct {
628
586
  applyRemovalPolicy(policy) {
629
587
  this._reference.applyRemovalPolicy(policy);
630
588
  }
631
- // Additional Lambda Function specific methods
632
- get currentVersion() {
633
- return this._lambda.currentVersion;
634
- }
635
- get deadLetterQueue() {
636
- return this._lambda.deadLetterQueue;
637
- }
638
- get deadLetterTopic() {
639
- return this._lambda.deadLetterTopic;
640
- }
641
- get logGroup() {
642
- return this._lambda.logGroup;
643
- }
644
- get runtime() {
645
- return this._runtime;
646
- }
647
- get timeout() {
648
- return this._timeout;
649
- }
650
- addAlias(aliasName, options) {
651
- return this._lambda.addAlias(aliasName, options);
652
- }
653
- addLayers(...layers) {
654
- this._lambda.addLayers(...layers);
655
- }
656
- invalidateVersionBasedOn(x) {
657
- this._lambda.invalidateVersionBasedOn(x);
658
- }
659
- metricConcurrentExecutions(props) {
660
- return new cloudwatch.Metric({
661
- namespace: "AWS/Lambda",
662
- metricName: "ConcurrentExecutions",
663
- dimensionsMap: {
664
- FunctionName: this.functionName,
665
- },
666
- ...props,
667
- });
668
- }
669
- metricUnreservedConcurrentExecutions(props) {
670
- return new cloudwatch.Metric({
671
- namespace: "AWS/Lambda",
672
- metricName: "UnreservedConcurrentExecutions",
673
- ...props,
674
- });
675
- }
676
- addVersion(name, codeSha256, description, provisionedExecutions, asyncInvokeConfig) {
677
- return new lambda.Version(this, name, {
678
- lambda: this._lambda,
679
- codeSha256,
680
- description,
681
- provisionedConcurrentExecutions: provisionedExecutions,
682
- ...asyncInvokeConfig,
683
- });
684
- }
685
- get memorySize() {
686
- return this._memorySize;
687
- }
688
- get handler() {
689
- return this._handler;
690
- }
691
- get environment() {
692
- return this._environment;
693
- }
694
- get layers() {
695
- return this._layers;
696
- }
697
- get maxEventAge() {
698
- return this._maxEventAge;
699
- }
700
- get retryAttempts() {
701
- return this._retryAttempts;
702
- }
703
- get reservedConcurrentExecutions() {
704
- return this._reservedConcurrentExecutions;
705
- }
706
- get description() {
707
- return this._description;
708
- }
709
- get initialPolicy() {
710
- return this._initialPolicy;
711
- }
712
- get logRetentionRole() {
713
- return this._logRetentionRole;
714
- }
715
- get logRetentionRetryOptions() {
716
- return this._logRetentionRetryOptions;
717
- }
718
- get tracing() {
719
- return this._tracing;
720
- }
721
- get profiling() {
722
- return this._profiling;
723
- }
724
- get profilingGroup() {
725
- return this._profilingGroup;
726
- }
727
- get environmentEncryption() {
728
- return this._environmentEncryption;
729
- }
730
- get codeSigningConfig() {
731
- return this._codeSigningConfig;
732
- }
733
- get filesystemConfig() {
734
- return this._filesystemConfigs?.[0];
735
- }
736
- get filesystemConfigs() {
737
- return this._filesystemConfigs;
738
- }
739
- get ephemeralStorageSize() {
740
- return this._ephemeralStorageSize;
741
- }
742
- get runtimeManagementMode() {
743
- return this._runtimeManagementMode;
744
- }
745
- get architectureLabel() {
746
- return this._lambda.architecture.name;
747
- }
748
- get vpc() {
749
- return this._vpc;
750
- }
751
- get vpcSubnets() {
752
- return this._vpcSubnets;
753
- }
754
- get securityGroups() {
755
- return this._securityGroups;
756
- }
757
- get allowAllOutbound() {
758
- return this._allowAllOutbound;
759
- }
760
- get allowPublicSubnet() {
761
- return this._allowPublicSubnet;
762
- }
763
- get canCreateLambdaLogGroup() {
764
- return true;
765
- }
766
- get canCreatePermissions() {
767
- return true;
768
- }
769
- get deadLetterQueueEnabled() {
770
- return this._lambda.deadLetterQueue !== undefined || this._lambda.deadLetterTopic !== undefined;
771
- }
772
589
  }
773
590
 
774
591
  class JaypieQueuedLambda extends Construct {