@jaypie/constructs 1.1.37 → 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.
@@ -7,17 +7,32 @@ import * as ec2 from "aws-cdk-lib/aws-ec2";
7
7
  import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
8
8
  import { JaypieEnvSecret } from "./JaypieEnvSecret.js";
9
9
  export interface JaypieLambdaProps {
10
+ allowAllOutbound?: boolean;
11
+ allowPublicSubnet?: boolean;
12
+ architecture?: lambda.Architecture;
10
13
  code: lambda.Code | string;
14
+ codeSigningConfig?: lambda.ICodeSigningConfig;
11
15
  datadogApiKeyArn?: string;
16
+ deadLetterQueue?: import("aws-cdk-lib/aws-sqs").IQueue;
17
+ deadLetterQueueEnabled?: boolean;
18
+ deadLetterTopic?: import("aws-cdk-lib/aws-sns").ITopic;
19
+ description?: string;
12
20
  environment?: {
13
21
  [key: string]: string;
14
22
  };
23
+ environmentEncryption?: import("aws-cdk-lib/aws-kms").IKey;
15
24
  envSecrets?: {
16
25
  [key: string]: secretsmanager.ISecret;
17
26
  };
27
+ ephemeralStorageSize?: import("aws-cdk-lib").Size;
28
+ filesystem?: lambda.FileSystem;
18
29
  handler: string;
30
+ initialPolicy?: iam.PolicyStatement[];
19
31
  layers?: lambda.ILayerVersion[];
20
32
  logRetention?: number;
33
+ logRetentionRole?: iam.IRole;
34
+ logRetentionRetryOptions?: lambda.LogRetentionRetryOptions;
35
+ maxEventAge?: Duration;
21
36
  memorySize?: number;
22
37
  paramsAndSecrets?: lambda.ParamsAndSecretsLayerVersion | boolean;
23
38
  paramsAndSecretsOptions?: {
@@ -26,13 +41,18 @@ export interface JaypieLambdaProps {
26
41
  parameterStoreTtl?: number;
27
42
  secretsManagerTtl?: number;
28
43
  };
44
+ profiling?: boolean;
45
+ profilingGroup?: import("aws-cdk-lib/aws-codeguruprofiler").IProfilingGroup;
29
46
  provisionedConcurrentExecutions?: number;
30
47
  reservedConcurrentExecutions?: number;
48
+ retryAttempts?: number;
31
49
  roleTag?: string;
32
50
  runtime?: lambda.Runtime;
51
+ runtimeManagementMode?: lambda.RuntimeManagementMode;
33
52
  secrets?: JaypieEnvSecret[];
34
53
  securityGroups?: ec2.ISecurityGroup[];
35
54
  timeout?: Duration | number;
55
+ tracing?: lambda.Tracing;
36
56
  vendorTag?: string;
37
57
  vpc?: ec2.IVpc;
38
58
  vpcSubnets?: ec2.SubnetSelection;
@@ -40,22 +60,10 @@ export interface JaypieLambdaProps {
40
60
  export declare class JaypieLambda extends Construct implements lambda.IFunction {
41
61
  private readonly _lambda;
42
62
  private readonly _provisioned?;
43
- private readonly _code;
44
63
  private readonly _reference;
45
- private readonly _handler;
46
- private readonly _memorySize;
47
- private readonly _timeout;
48
- private readonly _runtime;
49
- private readonly _environment;
50
- private readonly _vpc?;
51
- private readonly _vpcSubnets?;
52
- private readonly _securityGroups?;
53
- private readonly _reservedConcurrentExecutions?;
54
- private readonly _layers;
55
64
  constructor(scope: Construct, id: string, props: JaypieLambdaProps);
56
65
  get lambda(): lambda.Function;
57
66
  get provisioned(): lambda.Alias | undefined;
58
- get code(): lambda.Code;
59
67
  get reference(): lambda.IFunction;
60
68
  get functionArn(): string;
61
69
  get functionName(): string;
@@ -72,63 +80,21 @@ export declare class JaypieLambda extends Construct implements lambda.IFunction
72
80
  addFunctionUrl(options?: lambda.FunctionUrlOptions): lambda.FunctionUrl;
73
81
  addPermission(id: string, permission: lambda.Permission): void;
74
82
  addToRolePolicy(statement: iam.PolicyStatement): void;
75
- addEnvironment(key: string, value: string, options?: lambda.EnvironmentOptions): lambda.Function;
76
83
  configureAsyncInvoke(options: lambda.EventInvokeConfigOptions): void;
77
84
  grantInvoke(grantee: iam.IGrantable): iam.Grant;
78
85
  grantInvokeCompositePrincipal(compositePrincipal: iam.CompositePrincipal): iam.Grant[];
79
86
  grantInvokeUrl(grantee: iam.IGrantable): iam.Grant;
87
+ grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
88
+ grantInvokeVersion(grantee: iam.IGrantable, version: lambda.IVersion): iam.Grant;
80
89
  metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
81
90
  metricDuration(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
82
91
  metricErrors(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
83
92
  metricInvocations(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
84
93
  metricThrottles(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
85
- grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
86
- grantInvokeVersion(grantee: iam.IGrantable, version: lambda.Version): iam.Grant;
87
94
  get env(): {
88
95
  account: string;
89
96
  region: string;
90
97
  };
91
98
  get stack(): Stack;
92
99
  applyRemovalPolicy(policy: RemovalPolicy): void;
93
- get currentVersion(): lambda.Version;
94
- get deadLetterQueue(): import("aws-cdk-lib/aws-sqs").IQueue | undefined;
95
- get deadLetterTopic(): import("aws-cdk-lib/aws-sns").ITopic | undefined;
96
- get logGroup(): import("aws-cdk-lib/aws-logs").ILogGroup;
97
- get runtime(): lambda.Runtime;
98
- get timeout(): Duration | undefined;
99
- addAlias(aliasName: string, options?: lambda.AliasOptions): lambda.Alias;
100
- addLayers(...layers: lambda.ILayerVersion[]): void;
101
- invalidateVersionBasedOn(x: string): void;
102
- metricConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
103
- metricUnreservedConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
104
- addVersion(name: string, codeSha256?: string, description?: string, provisionedExecutions?: number, asyncInvokeConfig?: lambda.EventInvokeConfigOptions): lambda.Version;
105
- get memorySize(): number | undefined;
106
- get handler(): string;
107
- get environment(): {
108
- [key: string]: string;
109
- } | undefined;
110
- get layers(): lambda.ILayerVersion[] | undefined;
111
- get maxEventAge(): Duration | undefined;
112
- get retryAttempts(): number | undefined;
113
- get reservedConcurrentExecutions(): number | undefined;
114
- get description(): string | undefined;
115
- get initialPolicy(): iam.PolicyDocument[] | undefined;
116
- get logRetentionRole(): iam.IRole | undefined;
117
- get logRetentionRetryOptions(): lambda.LogRetentionRetryOptions | undefined;
118
- get tracing(): lambda.Tracing | undefined;
119
- get profiling(): boolean | undefined;
120
- get profilingGroup(): import("aws-cdk-lib/aws-codeguruprofiler").IProfilingGroup | undefined;
121
- get environmentEncryption(): import("aws-cdk-lib/aws-kms").IKey | undefined;
122
- get codeSigningConfig(): lambda.ICodeSigningConfig | undefined;
123
- get filesystemConfig(): lambda.FileSystemConfig | undefined;
124
- get filesystemConfigs(): lambda.FileSystemConfig[] | undefined;
125
- get ephemeralStorageSize(): number | undefined;
126
- get runtimeManagementMode(): lambda.RuntimeManagementMode | undefined;
127
- get architectureLabel(): string;
128
- get vpc(): ec2.IVpc | undefined;
129
- get vpcSubnets(): ec2.SubnetSelection | undefined;
130
- get securityGroups(): ec2.ISecurityGroup[] | undefined;
131
- get allowAllOutbound(): boolean | undefined;
132
- get allowPublicSubnet(): boolean | undefined;
133
- get canCreateLambdaLogGroup(): boolean;
134
100
  }
@@ -12,7 +12,6 @@ var s3n = require('aws-cdk-lib/aws-s3-notifications');
12
12
  var lambda = require('aws-cdk-lib/aws-lambda');
13
13
  var sqs = require('aws-cdk-lib/aws-sqs');
14
14
  var lambdaEventSources = require('aws-cdk-lib/aws-lambda-event-sources');
15
- var cloudwatch = require('aws-cdk-lib/aws-cloudwatch');
16
15
  var secretsmanager = require('aws-cdk-lib/aws-secretsmanager');
17
16
  var awsIam = require('aws-cdk-lib/aws-iam');
18
17
  var awsLogs = require('aws-cdk-lib/aws-logs');
@@ -47,7 +46,6 @@ var s3n__namespace = /*#__PURE__*/_interopNamespaceDefault(s3n);
47
46
  var lambda__namespace = /*#__PURE__*/_interopNamespaceDefault(lambda);
48
47
  var sqs__namespace = /*#__PURE__*/_interopNamespaceDefault(sqs);
49
48
  var lambdaEventSources__namespace = /*#__PURE__*/_interopNamespaceDefault(lambdaEventSources);
50
- var cloudwatch__namespace = /*#__PURE__*/_interopNamespaceDefault(cloudwatch);
51
49
  var secretsmanager__namespace = /*#__PURE__*/_interopNamespaceDefault(secretsmanager);
52
50
  var sso__namespace = /*#__PURE__*/_interopNamespaceDefault(sso);
53
51
  var cloudfront__namespace = /*#__PURE__*/_interopNamespaceDefault(cloudfront);
@@ -323,7 +321,7 @@ class JaypieAppStack extends JaypieStack {
323
321
  class JaypieLambda extends constructs.Construct {
324
322
  constructor(scope, id, props) {
325
323
  super(scope, id);
326
- const { code, datadogApiKeyArn, environment: initialEnvironment = {}, envSecrets = {}, handler = "index.handler", layers = [], logRetention = cdk.CDK.LAMBDA.LOG_RETENTION, memorySize = cdk.CDK.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, provisionedConcurrentExecutions, reservedConcurrentExecutions, roleTag = cdk.CDK.ROLE.PROCESSING, runtime = lambda__namespace.Runtime.NODEJS_22_X, secrets = [], securityGroups, timeout = cdk$1.Duration.seconds(cdk.CDK.DURATION.LAMBDA_WORKER), vendorTag, vpc, vpcSubnets, } = props;
324
+ const { allowAllOutbound, allowPublicSubnet, architecture = lambda__namespace.Architecture.X86_64, code, codeSigningConfig, datadogApiKeyArn, deadLetterQueue, deadLetterQueueEnabled, deadLetterTopic, description, environment: initialEnvironment = {}, environmentEncryption, envSecrets = {}, ephemeralStorageSize, filesystem, handler = "index.handler", initialPolicy, layers = [], logRetention = cdk.CDK.LAMBDA.LOG_RETENTION, logRetentionRole, logRetentionRetryOptions, maxEventAge, memorySize = cdk.CDK.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, profiling, profilingGroup, provisionedConcurrentExecutions, reservedConcurrentExecutions, retryAttempts, roleTag = cdk.CDK.ROLE.PROCESSING, runtime = lambda__namespace.Runtime.NODEJS_22_X, runtimeManagementMode, secrets = [], securityGroups, timeout = cdk$1.Duration.seconds(cdk.CDK.DURATION.LAMBDA_WORKER), tracing, vendorTag, vpc, vpcSubnets, } = props;
327
325
  // Create a mutable copy of the environment variables
328
326
  let environment = { ...initialEnvironment };
329
327
  // Default environment values
@@ -369,7 +367,7 @@ class JaypieLambda extends constructs.Construct {
369
367
  environment[envVar] = process.env[envVar];
370
368
  }
371
369
  });
372
- this._code = typeof code === "string" ? lambda__namespace.Code.fromAsset(code) : code;
370
+ const codeAsset = typeof code === "string" ? lambda__namespace.Code.fromAsset(code) : code;
373
371
  // Create a working copy of layers
374
372
  const resolvedLayers = [...layers];
375
373
  // Determine if we should add Datadog integration
@@ -437,21 +435,41 @@ class JaypieLambda extends constructs.Construct {
437
435
  }, {});
438
436
  // Create Lambda Function
439
437
  this._lambda = new lambda__namespace.Function(this, "Function", {
440
- code: this._code,
438
+ allowAllOutbound,
439
+ allowPublicSubnet,
440
+ architecture,
441
+ code: codeAsset,
442
+ codeSigningConfig,
443
+ deadLetterQueue,
444
+ deadLetterQueueEnabled,
445
+ deadLetterTopic,
446
+ description,
441
447
  environment: {
442
448
  ...environment,
443
449
  ...secretsEnvironment,
444
450
  ...jaypieSecretsEnvironment,
445
451
  },
452
+ environmentEncryption,
453
+ ephemeralStorageSize,
454
+ filesystem,
446
455
  handler,
456
+ initialPolicy,
447
457
  layers: resolvedLayers,
448
458
  logRetention,
459
+ logRetentionRole,
460
+ logRetentionRetryOptions,
461
+ maxEventAge,
449
462
  memorySize,
450
463
  paramsAndSecrets: resolvedParamsAndSecrets,
464
+ profiling,
465
+ profilingGroup,
451
466
  reservedConcurrentExecutions,
467
+ retryAttempts,
452
468
  runtime,
469
+ runtimeManagementMode,
453
470
  securityGroups,
454
471
  timeout: typeof timeout === "number" ? cdk$1.Duration.seconds(timeout) : timeout,
472
+ tracing,
455
473
  vpc,
456
474
  vpcSubnets,
457
475
  // Enable auto-publishing of versions when using provisioned concurrency
@@ -495,22 +513,6 @@ class JaypieLambda extends constructs.Construct {
495
513
  if (vendorTag) {
496
514
  cdk$1.Tags.of(this._lambda).add(cdk.CDK.TAG.VENDOR, vendorTag);
497
515
  }
498
- // Store constructor props for later access
499
- this._handler = handler;
500
- this._memorySize = memorySize;
501
- this._timeout =
502
- typeof timeout === "number" ? cdk$1.Duration.seconds(timeout) : timeout;
503
- this._runtime = runtime;
504
- this._environment = {
505
- ...environment,
506
- ...secretsEnvironment,
507
- ...jaypieSecretsEnvironment,
508
- };
509
- this._vpc = vpc;
510
- this._vpcSubnets = vpcSubnets;
511
- this._securityGroups = securityGroups;
512
- this._reservedConcurrentExecutions = reservedConcurrentExecutions;
513
- this._layers = resolvedLayers;
514
516
  // Assign _reference based on provisioned state
515
517
  this._reference =
516
518
  this._provisioned !== undefined ? this._provisioned : this._lambda;
@@ -522,9 +524,6 @@ class JaypieLambda extends constructs.Construct {
522
524
  get provisioned() {
523
525
  return this._provisioned;
524
526
  }
525
- get code() {
526
- return this._code;
527
- }
528
527
  get reference() {
529
528
  return this._reference;
530
529
  }
@@ -574,9 +573,6 @@ class JaypieLambda extends constructs.Construct {
574
573
  addToRolePolicy(statement) {
575
574
  this._reference.addToRolePolicy(statement);
576
575
  }
577
- addEnvironment(key, value, options) {
578
- return this._lambda.addEnvironment(key, value, options);
579
- }
580
576
  configureAsyncInvoke(options) {
581
577
  this._reference.configureAsyncInvoke(options);
582
578
  }
@@ -589,6 +585,12 @@ class JaypieLambda extends constructs.Construct {
589
585
  grantInvokeUrl(grantee) {
590
586
  return this._reference.grantInvokeUrl(grantee);
591
587
  }
588
+ grantInvokeLatestVersion(grantee) {
589
+ return this._reference.grantInvokeLatestVersion(grantee);
590
+ }
591
+ grantInvokeVersion(grantee, version) {
592
+ return this._reference.grantInvokeVersion(grantee, version);
593
+ }
592
594
  metric(metricName, props) {
593
595
  return this._reference.metric(metricName, props);
594
596
  }
@@ -604,13 +606,6 @@ class JaypieLambda extends constructs.Construct {
604
606
  metricThrottles(props) {
605
607
  return this._reference.metricThrottles(props);
606
608
  }
607
- // Additional IFunction implementation
608
- grantInvokeLatestVersion(grantee) {
609
- return this._reference.grantInvokeLatestVersion(grantee);
610
- }
611
- grantInvokeVersion(grantee, version) {
612
- return this._reference.grantInvokeVersion(grantee, version);
613
- }
614
609
  get env() {
615
610
  return {
616
611
  account: cdk$1.Stack.of(this).account,
@@ -623,141 +618,6 @@ class JaypieLambda extends constructs.Construct {
623
618
  applyRemovalPolicy(policy) {
624
619
  this._reference.applyRemovalPolicy(policy);
625
620
  }
626
- // Additional Lambda Function specific methods
627
- get currentVersion() {
628
- return this._lambda.currentVersion;
629
- }
630
- get deadLetterQueue() {
631
- return this._lambda.deadLetterQueue;
632
- }
633
- get deadLetterTopic() {
634
- return this._lambda.deadLetterTopic;
635
- }
636
- get logGroup() {
637
- return this._lambda.logGroup;
638
- }
639
- get runtime() {
640
- return this._runtime;
641
- }
642
- get timeout() {
643
- return this._timeout;
644
- }
645
- addAlias(aliasName, options) {
646
- return this._lambda.addAlias(aliasName, options);
647
- }
648
- addLayers(...layers) {
649
- this._lambda.addLayers(...layers);
650
- }
651
- invalidateVersionBasedOn(x) {
652
- this._lambda.invalidateVersionBasedOn(x);
653
- }
654
- metricConcurrentExecutions(props) {
655
- return new cloudwatch__namespace.Metric({
656
- namespace: "AWS/Lambda",
657
- metricName: "ConcurrentExecutions",
658
- dimensionsMap: {
659
- FunctionName: this.functionName,
660
- },
661
- ...props,
662
- });
663
- }
664
- metricUnreservedConcurrentExecutions(props) {
665
- return new cloudwatch__namespace.Metric({
666
- namespace: "AWS/Lambda",
667
- metricName: "UnreservedConcurrentExecutions",
668
- ...props,
669
- });
670
- }
671
- addVersion(name, codeSha256, description, provisionedExecutions, asyncInvokeConfig) {
672
- return new lambda__namespace.Version(this, name, {
673
- lambda: this._lambda,
674
- codeSha256,
675
- description,
676
- provisionedConcurrentExecutions: provisionedExecutions,
677
- ...asyncInvokeConfig,
678
- });
679
- }
680
- get memorySize() {
681
- return this._memorySize;
682
- }
683
- get handler() {
684
- return this._handler;
685
- }
686
- get environment() {
687
- return this._environment;
688
- }
689
- get layers() {
690
- return this._layers;
691
- }
692
- get maxEventAge() {
693
- return undefined;
694
- }
695
- get retryAttempts() {
696
- return undefined;
697
- }
698
- get reservedConcurrentExecutions() {
699
- return this._reservedConcurrentExecutions;
700
- }
701
- get description() {
702
- return undefined;
703
- }
704
- get initialPolicy() {
705
- return undefined;
706
- }
707
- get logRetentionRole() {
708
- return undefined;
709
- }
710
- get logRetentionRetryOptions() {
711
- return undefined;
712
- }
713
- get tracing() {
714
- return undefined;
715
- }
716
- get profiling() {
717
- return undefined;
718
- }
719
- get profilingGroup() {
720
- return undefined;
721
- }
722
- get environmentEncryption() {
723
- return undefined;
724
- }
725
- get codeSigningConfig() {
726
- return undefined;
727
- }
728
- get filesystemConfig() {
729
- return undefined;
730
- }
731
- get filesystemConfigs() {
732
- return undefined;
733
- }
734
- get ephemeralStorageSize() {
735
- return undefined;
736
- }
737
- get runtimeManagementMode() {
738
- return undefined;
739
- }
740
- get architectureLabel() {
741
- return this._lambda.architecture.name;
742
- }
743
- get vpc() {
744
- return this._vpc;
745
- }
746
- get vpcSubnets() {
747
- return this._vpcSubnets;
748
- }
749
- get securityGroups() {
750
- return this._securityGroups;
751
- }
752
- get allowAllOutbound() {
753
- return undefined;
754
- }
755
- get allowPublicSubnet() {
756
- return undefined;
757
- }
758
- get canCreateLambdaLogGroup() {
759
- return true;
760
- }
761
621
  }
762
622
 
763
623
  class JaypieQueuedLambda extends constructs.Construct {