@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;
|
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,12 @@ class JaypieEnvSecret extends Construct {
|
|
|
986
986
|
this._envKey = envKey;
|
|
987
987
|
let exportName;
|
|
988
988
|
if (!exportParam) {
|
|
989
|
-
|
|
989
|
+
// When shorthand detection is active, use the full construct id (which
|
|
990
|
+
// includes the "EnvSecret_" prefix) so the export name matches what was
|
|
991
|
+
// produced by earlier versions of this construct. Using the raw envKey
|
|
992
|
+
// here produces a shorter name that breaks existing cross-stack imports.
|
|
993
|
+
const exportSource = treatAsEnvKey ? id : envKey || id;
|
|
994
|
+
exportName = exportEnvName$1(exportSource, process.env, consumer);
|
|
990
995
|
}
|
|
991
996
|
else {
|
|
992
997
|
exportName = cleanName$1(exportParam);
|
|
@@ -3633,7 +3638,7 @@ const DYNAMODB_CONTROL_PLANE_ACTIONS = [
|
|
|
3633
3638
|
class JaypieMigration extends Construct {
|
|
3634
3639
|
constructor(scope, id, props) {
|
|
3635
3640
|
super(scope, id);
|
|
3636
|
-
const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], timeout = cdk.Duration.minutes(15), } = props;
|
|
3641
|
+
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
3642
|
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3638
3643
|
code,
|
|
3639
3644
|
description: "DynamoDB migration custom resource",
|
|
@@ -3656,9 +3661,14 @@ class JaypieMigration extends Construct {
|
|
|
3656
3661
|
]),
|
|
3657
3662
|
}));
|
|
3658
3663
|
}
|
|
3659
|
-
//
|
|
3664
|
+
// cr.Provider with isCompleteHandler enables the waiter pattern: onEventHandler
|
|
3665
|
+
// returns PhysicalResourceId immediately; isCompleteHandler is polled via Step
|
|
3666
|
+
// Functions until migrationHandler returns pending: false (or omits pending).
|
|
3660
3667
|
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3668
|
+
isCompleteHandler: this.lambda,
|
|
3661
3669
|
onEventHandler: this.lambda,
|
|
3670
|
+
queryInterval,
|
|
3671
|
+
totalTimeout,
|
|
3662
3672
|
});
|
|
3663
3673
|
// Custom Resource that triggers on every deploy.
|
|
3664
3674
|
// deployNonce forces CloudFormation to re-invoke the custom resource
|