@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;
|
package/dist/esm/index.js
CHANGED
|
@@ -950,7 +950,7 @@ function checkEnvIsProvider$1(env = process.env) {
|
|
|
950
950
|
function cleanName$1(name) {
|
|
951
951
|
return name.replace(/[^a-zA-Z0-9:-]/g, "");
|
|
952
952
|
}
|
|
953
|
-
function exportEnvName$1(name, env = process.env) {
|
|
953
|
+
function exportEnvName$1(name, env = process.env, consumer = false) {
|
|
954
954
|
let rawName;
|
|
955
955
|
if (checkEnvIsProvider$1(env)) {
|
|
956
956
|
rawName = `env-${env.PROJECT_ENV}-${env.PROJECT_KEY}-${name}`;
|
|
@@ -958,7 +958,7 @@ function exportEnvName$1(name, env = process.env) {
|
|
|
958
958
|
return cleanName$1(rawName);
|
|
959
959
|
}
|
|
960
960
|
else {
|
|
961
|
-
if (checkEnvIsConsumer$1(env)) {
|
|
961
|
+
if (consumer || checkEnvIsConsumer$1(env)) {
|
|
962
962
|
rawName = `env-${CDK$2.ENV.SANDBOX}-${env.PROJECT_KEY}-${name}`;
|
|
963
963
|
}
|
|
964
964
|
else {
|
|
@@ -986,7 +986,7 @@ class JaypieEnvSecret extends Construct {
|
|
|
986
986
|
this._envKey = envKey;
|
|
987
987
|
let exportName;
|
|
988
988
|
if (!exportParam) {
|
|
989
|
-
exportName = exportEnvName$1(id);
|
|
989
|
+
exportName = exportEnvName$1(envKey || id, process.env, consumer);
|
|
990
990
|
}
|
|
991
991
|
else {
|
|
992
992
|
exportName = cleanName$1(exportParam);
|
|
@@ -3633,7 +3633,7 @@ const DYNAMODB_CONTROL_PLANE_ACTIONS = [
|
|
|
3633
3633
|
class JaypieMigration extends Construct {
|
|
3634
3634
|
constructor(scope, id, props) {
|
|
3635
3635
|
super(scope, id);
|
|
3636
|
-
const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], timeout = cdk.Duration.minutes(15), } = props;
|
|
3636
|
+
const { code, dependencies = [], environment, handler = "index.handler", queryInterval = cdk.Duration.seconds(60), secrets = [], tables = [], timeout = cdk.Duration.minutes(15), totalTimeout = cdk.Duration.hours(2), } = props;
|
|
3637
3637
|
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3638
3638
|
code,
|
|
3639
3639
|
description: "DynamoDB migration custom resource",
|
|
@@ -3656,9 +3656,14 @@ class JaypieMigration extends Construct {
|
|
|
3656
3656
|
]),
|
|
3657
3657
|
}));
|
|
3658
3658
|
}
|
|
3659
|
-
//
|
|
3659
|
+
// cr.Provider with isCompleteHandler enables the waiter pattern: onEventHandler
|
|
3660
|
+
// returns PhysicalResourceId immediately; isCompleteHandler is polled via Step
|
|
3661
|
+
// Functions until migrationHandler returns pending: false (or omits pending).
|
|
3660
3662
|
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3663
|
+
isCompleteHandler: this.lambda,
|
|
3661
3664
|
onEventHandler: this.lambda,
|
|
3665
|
+
queryInterval,
|
|
3666
|
+
totalTimeout,
|
|
3662
3667
|
});
|
|
3663
3668
|
// Custom Resource that triggers on every deploy.
|
|
3664
3669
|
// deployNonce forces CloudFormation to re-invoke the custom resource
|