@jaypie/constructs 1.2.55 → 1.2.57

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.
@@ -13,12 +13,16 @@ export interface JaypieMigrationProps {
13
13
  environment?: Record<string, string> | (Record<string, string> | string)[];
14
14
  /** Lambda handler entry point */
15
15
  handler?: string;
16
+ /** Polling interval between isCompleteHandler invocations. Default: 60 seconds. */
17
+ queryInterval?: cdk.Duration;
16
18
  /** Secrets to make available to the migration Lambda */
17
19
  secrets?: SecretsArrayItem[];
18
20
  /** DynamoDB tables to grant read/write access */
19
21
  tables?: dynamodb.ITable[];
20
- /** Lambda timeout. Defaults to 15 minutes (Lambda max). */
22
+ /** Lambda timeout per invocation. Defaults to 15 minutes (Lambda max). */
21
23
  timeout?: cdk.Duration;
24
+ /** Maximum total wall time across all isCompleteHandler invocations. Default: 2 hours. */
25
+ totalTimeout?: cdk.Duration;
22
26
  }
23
27
  export declare class JaypieMigration extends Construct {
24
28
  readonly lambda: JaypieLambda;
@@ -986,7 +986,7 @@ function checkEnvIsProvider$1(env = process.env) {
986
986
  function cleanName$1(name) {
987
987
  return name.replace(/[^a-zA-Z0-9:-]/g, "");
988
988
  }
989
- function exportEnvName$1(name, env = process.env) {
989
+ function exportEnvName$1(name, env = process.env, consumer = false) {
990
990
  let rawName;
991
991
  if (checkEnvIsProvider$1(env)) {
992
992
  rawName = `env-${env.PROJECT_ENV}-${env.PROJECT_KEY}-${name}`;
@@ -994,7 +994,7 @@ function exportEnvName$1(name, env = process.env) {
994
994
  return cleanName$1(rawName);
995
995
  }
996
996
  else {
997
- if (checkEnvIsConsumer$1(env)) {
997
+ if (consumer || checkEnvIsConsumer$1(env)) {
998
998
  rawName = `env-${CDK$2.ENV.SANDBOX}-${env.PROJECT_KEY}-${name}`;
999
999
  }
1000
1000
  else {
@@ -1022,7 +1022,12 @@ class JaypieEnvSecret extends constructs.Construct {
1022
1022
  this._envKey = envKey;
1023
1023
  let exportName;
1024
1024
  if (!exportParam) {
1025
- exportName = exportEnvName$1(id);
1025
+ // When shorthand detection is active, use the full construct id (which
1026
+ // includes the "EnvSecret_" prefix) so the export name matches what was
1027
+ // produced by earlier versions of this construct. Using the raw envKey
1028
+ // here produces a shorter name that breaks existing cross-stack imports.
1029
+ const exportSource = treatAsEnvKey ? id : envKey || id;
1030
+ exportName = exportEnvName$1(exportSource, process.env, consumer);
1026
1031
  }
1027
1032
  else {
1028
1033
  exportName = cleanName$1(exportParam);
@@ -3669,7 +3674,7 @@ const DYNAMODB_CONTROL_PLANE_ACTIONS = [
3669
3674
  class JaypieMigration extends constructs.Construct {
3670
3675
  constructor(scope, id, props) {
3671
3676
  super(scope, id);
3672
- const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], timeout = cdk__namespace.Duration.minutes(15), } = props;
3677
+ const { code, dependencies = [], environment, handler = "index.handler", queryInterval = cdk__namespace.Duration.seconds(60), secrets = [], tables = [], timeout = cdk__namespace.Duration.minutes(15), totalTimeout = cdk__namespace.Duration.hours(2), } = props;
3673
3678
  this.lambda = new JaypieLambda(this, "MigrationLambda", {
3674
3679
  code,
3675
3680
  description: "DynamoDB migration custom resource",
@@ -3692,9 +3697,14 @@ class JaypieMigration extends constructs.Construct {
3692
3697
  ]),
3693
3698
  }));
3694
3699
  }
3695
- // Custom Resource provider wrapping the Lambda
3700
+ // cr.Provider with isCompleteHandler enables the waiter pattern: onEventHandler
3701
+ // returns PhysicalResourceId immediately; isCompleteHandler is polled via Step
3702
+ // Functions until migrationHandler returns pending: false (or omits pending).
3696
3703
  const provider = new cr__namespace.Provider(this, "MigrationProvider", {
3704
+ isCompleteHandler: this.lambda,
3697
3705
  onEventHandler: this.lambda,
3706
+ queryInterval,
3707
+ totalTimeout,
3698
3708
  });
3699
3709
  // Custom Resource that triggers on every deploy.
3700
3710
  // deployNonce forces CloudFormation to re-invoke the custom resource