@jaypie/constructs 1.2.55 → 1.2.56

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,7 @@ class JaypieEnvSecret extends constructs.Construct {
1022
1022
  this._envKey = envKey;
1023
1023
  let exportName;
1024
1024
  if (!exportParam) {
1025
- exportName = exportEnvName$1(id);
1025
+ exportName = exportEnvName$1(envKey || id, process.env, consumer);
1026
1026
  }
1027
1027
  else {
1028
1028
  exportName = cleanName$1(exportParam);
@@ -3669,7 +3669,7 @@ const DYNAMODB_CONTROL_PLANE_ACTIONS = [
3669
3669
  class JaypieMigration extends constructs.Construct {
3670
3670
  constructor(scope, id, props) {
3671
3671
  super(scope, id);
3672
- const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], timeout = cdk__namespace.Duration.minutes(15), } = props;
3672
+ 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
3673
  this.lambda = new JaypieLambda(this, "MigrationLambda", {
3674
3674
  code,
3675
3675
  description: "DynamoDB migration custom resource",
@@ -3692,9 +3692,14 @@ class JaypieMigration extends constructs.Construct {
3692
3692
  ]),
3693
3693
  }));
3694
3694
  }
3695
- // Custom Resource provider wrapping the Lambda
3695
+ // cr.Provider with isCompleteHandler enables the waiter pattern: onEventHandler
3696
+ // returns PhysicalResourceId immediately; isCompleteHandler is polled via Step
3697
+ // Functions until migrationHandler returns pending: false (or omits pending).
3696
3698
  const provider = new cr__namespace.Provider(this, "MigrationProvider", {
3699
+ isCompleteHandler: this.lambda,
3697
3700
  onEventHandler: this.lambda,
3701
+ queryInterval,
3702
+ totalTimeout,
3698
3703
  });
3699
3704
  // Custom Resource that triggers on every deploy.
3700
3705
  // deployNonce forces CloudFormation to re-invoke the custom resource