@jaypie/constructs 1.1.31 → 1.1.33

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.
@@ -35,9 +35,11 @@ export interface JaypieLambdaProps {
35
35
  }
36
36
  export declare class JaypieLambda extends Construct implements lambda.IFunction {
37
37
  private readonly _lambda;
38
+ private readonly _alias?;
38
39
  private readonly _code;
39
40
  constructor(scope: Construct, id: string, props: JaypieLambdaProps);
40
41
  get lambda(): lambda.Function;
42
+ get alias(): lambda.Alias | undefined;
41
43
  get code(): lambda.Code;
42
44
  get functionArn(): string;
43
45
  get functionName(): string;
package/dist/esm/index.js CHANGED
@@ -390,6 +390,14 @@ class JaypieLambda extends Construct {
390
390
  reservedConcurrentExecutions,
391
391
  runtime,
392
392
  timeout: typeof timeout === "number" ? Duration.seconds(timeout) : timeout,
393
+ // Enable auto-publishing of versions when using provisioned concurrency
394
+ currentVersionOptions: provisionedConcurrentExecutions !== undefined
395
+ ? {
396
+ removalPolicy: RemovalPolicy.RETAIN,
397
+ description: "Auto-published version for provisioned concurrency",
398
+ // Don't set provisioned concurrency here - it will be set on the alias
399
+ }
400
+ : undefined,
393
401
  });
394
402
  // Grant secret read permissions
395
403
  Object.values(envSecrets).forEach((secret) => {
@@ -407,11 +415,16 @@ class JaypieLambda extends Construct {
407
415
  }
408
416
  // Configure provisioned concurrency if specified
409
417
  if (provisionedConcurrentExecutions !== undefined) {
410
- new lambda.Alias(this, "ProvisionedAlias", {
418
+ // Use currentVersion which is auto-published with proper configuration
419
+ const version = this._lambda.currentVersion;
420
+ // Create alias for provisioned concurrency
421
+ this._alias = new lambda.Alias(this, "ProvisionedAlias", {
411
422
  aliasName: "provisioned",
412
- version: this._lambda.currentVersion,
423
+ version,
413
424
  provisionedConcurrentExecutions,
414
425
  });
426
+ // Add explicit dependencies to ensure proper creation order
427
+ this._alias.node.addDependency(version);
415
428
  }
416
429
  if (roleTag) {
417
430
  Tags.of(this._lambda).add(CDK$2.TAG.ROLE, roleTag);
@@ -424,15 +437,18 @@ class JaypieLambda extends Construct {
424
437
  get lambda() {
425
438
  return this._lambda;
426
439
  }
440
+ get alias() {
441
+ return this._alias;
442
+ }
427
443
  get code() {
428
444
  return this._code;
429
445
  }
430
446
  // IFunction implementation
431
447
  get functionArn() {
432
- return this._lambda.functionArn;
448
+ return this._alias?.functionArn ?? this._lambda.functionArn;
433
449
  }
434
450
  get functionName() {
435
- return this._lambda.functionName;
451
+ return this._alias?.functionName ?? this._lambda.functionName;
436
452
  }
437
453
  get grantPrincipal() {
438
454
  return this._lambda.grantPrincipal;
@@ -456,7 +472,8 @@ class JaypieLambda extends Construct {
456
472
  return this._lambda.permissionsNode;
457
473
  }
458
474
  get resourceArnsForGrantInvoke() {
459
- return this._lambda.resourceArnsForGrantInvoke;
475
+ return (this._alias?.resourceArnsForGrantInvoke ??
476
+ this._lambda.resourceArnsForGrantInvoke);
460
477
  }
461
478
  addEventSource(source) {
462
479
  this._lambda.addEventSource(source);
@@ -480,7 +497,7 @@ class JaypieLambda extends Construct {
480
497
  this._lambda.configureAsyncInvoke(options);
481
498
  }
482
499
  grantInvoke(grantee) {
483
- return this._lambda.grantInvoke(grantee);
500
+ return (this._alias?.grantInvoke(grantee) ?? this._lambda.grantInvoke(grantee));
484
501
  }
485
502
  grantInvokeCompositePrincipal(compositePrincipal) {
486
503
  return this._lambda.grantInvokeCompositePrincipal(compositePrincipal);