@jaypie/constructs 1.2.33 → 1.2.34
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.
- package/dist/cjs/JaypieDynamoDb.d.ts +1 -0
- package/dist/cjs/JaypieMigration.d.ts +21 -0
- package/dist/cjs/__tests__/JaypieMigration.spec.d.ts +1 -0
- package/dist/cjs/index.cjs +36 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/esm/JaypieDynamoDb.d.ts +1 -0
- package/dist/esm/JaypieMigration.d.ts +21 -0
- package/dist/esm/__tests__/JaypieMigration.spec.d.ts +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +35 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ export declare class JaypieDynamoDb extends Construct implements dynamodb.ITable
|
|
|
89
89
|
get tableRef(): dynamodb.TableReference;
|
|
90
90
|
get tableStreamArn(): string | undefined;
|
|
91
91
|
get encryptionKey(): import("aws-cdk-lib/aws-kms").IKey | undefined;
|
|
92
|
+
get grants(): dynamodb.TableGrants;
|
|
92
93
|
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
93
94
|
grant(grantee: import("aws-cdk-lib/aws-iam").IGrantable, ...actions: string[]): import("aws-cdk-lib/aws-iam").Grant;
|
|
94
95
|
grantFullAccess(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
3
|
+
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
4
|
+
import { JaypieLambda } from "./JaypieLambda";
|
|
5
|
+
import type { SecretsArrayItem } from "./helpers/index.js";
|
|
6
|
+
export interface JaypieMigrationProps {
|
|
7
|
+
/** Path to the bundled migration code (esbuild output directory) */
|
|
8
|
+
code: lambda.Code | string;
|
|
9
|
+
/** Constructs that must be created before the migration runs */
|
|
10
|
+
dependencies?: Construct[];
|
|
11
|
+
/** Lambda handler entry point */
|
|
12
|
+
handler?: string;
|
|
13
|
+
/** Secrets to make available to the migration Lambda */
|
|
14
|
+
secrets?: SecretsArrayItem[];
|
|
15
|
+
/** DynamoDB tables to grant read/write access */
|
|
16
|
+
tables?: dynamodb.ITable[];
|
|
17
|
+
}
|
|
18
|
+
export declare class JaypieMigration extends Construct {
|
|
19
|
+
readonly lambda: JaypieLambda;
|
|
20
|
+
constructor(scope: Construct, id: string, props: JaypieMigrationProps);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var origins = require('aws-cdk-lib/aws-cloudfront-origins');
|
|
|
24
24
|
var wafv2 = require('aws-cdk-lib/aws-wafv2');
|
|
25
25
|
var dynamodb = require('aws-cdk-lib/aws-dynamodb');
|
|
26
26
|
var fabric = require('@jaypie/fabric');
|
|
27
|
+
var cr = require('aws-cdk-lib/custom-resources');
|
|
27
28
|
var cdkNextjsStandalone = require('cdk-nextjs-standalone');
|
|
28
29
|
var path = require('path');
|
|
29
30
|
var awsAccessanalyzer = require('aws-cdk-lib/aws-accessanalyzer');
|
|
@@ -67,6 +68,7 @@ var cloudfront__namespace = /*#__PURE__*/_interopNamespaceDefault(cloudfront);
|
|
|
67
68
|
var origins__namespace = /*#__PURE__*/_interopNamespaceDefault(origins);
|
|
68
69
|
var wafv2__namespace = /*#__PURE__*/_interopNamespaceDefault(wafv2);
|
|
69
70
|
var dynamodb__namespace = /*#__PURE__*/_interopNamespaceDefault(dynamodb);
|
|
71
|
+
var cr__namespace = /*#__PURE__*/_interopNamespaceDefault(cr);
|
|
70
72
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
71
73
|
var apigatewayv2__namespace = /*#__PURE__*/_interopNamespaceDefault(apigatewayv2);
|
|
72
74
|
var apigatewayv2Integrations__namespace = /*#__PURE__*/_interopNamespaceDefault(apigatewayv2Integrations);
|
|
@@ -2702,7 +2704,6 @@ class JaypieDistribution extends constructs.Construct {
|
|
|
2702
2704
|
if (wafLogBucketProp === true) {
|
|
2703
2705
|
// Create inline WAF logging bucket with Datadog forwarding
|
|
2704
2706
|
const createdBucket = new s3__namespace.Bucket(this, constructEnvName("WafLogBucket"), {
|
|
2705
|
-
autoDeleteObjects: true,
|
|
2706
2707
|
bucketName: `aws-waf-logs-${constructEnvName("waf").toLowerCase()}`,
|
|
2707
2708
|
lifecycleRules: [
|
|
2708
2709
|
{
|
|
@@ -2716,7 +2717,7 @@ class JaypieDistribution extends constructs.Construct {
|
|
|
2716
2717
|
},
|
|
2717
2718
|
],
|
|
2718
2719
|
objectOwnership: s3__namespace.ObjectOwnership.OBJECT_WRITER,
|
|
2719
|
-
removalPolicy: cdk.RemovalPolicy.
|
|
2720
|
+
removalPolicy: cdk.RemovalPolicy.RETAIN,
|
|
2720
2721
|
});
|
|
2721
2722
|
cdk.Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
|
|
2722
2723
|
// Add Datadog forwarder notification
|
|
@@ -3059,6 +3060,9 @@ class JaypieDynamoDb extends constructs.Construct {
|
|
|
3059
3060
|
get encryptionKey() {
|
|
3060
3061
|
return this._table.encryptionKey;
|
|
3061
3062
|
}
|
|
3063
|
+
get grants() {
|
|
3064
|
+
return this._table.grants;
|
|
3065
|
+
}
|
|
3062
3066
|
applyRemovalPolicy(policy) {
|
|
3063
3067
|
this._table.applyRemovalPolicy(policy);
|
|
3064
3068
|
}
|
|
@@ -3417,6 +3421,35 @@ class JaypieInfrastructureStack extends JaypieStack {
|
|
|
3417
3421
|
}
|
|
3418
3422
|
}
|
|
3419
3423
|
|
|
3424
|
+
class JaypieMigration extends constructs.Construct {
|
|
3425
|
+
constructor(scope, id, props) {
|
|
3426
|
+
super(scope, id);
|
|
3427
|
+
const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3428
|
+
// Migration Lambda — 5 minute timeout for long-running migrations
|
|
3429
|
+
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3430
|
+
code,
|
|
3431
|
+
description: "DynamoDB migration custom resource",
|
|
3432
|
+
handler,
|
|
3433
|
+
roleTag: CDK$2.ROLE.PROCESSING,
|
|
3434
|
+
secrets,
|
|
3435
|
+
tables,
|
|
3436
|
+
timeout: cdk__namespace.Duration.minutes(5),
|
|
3437
|
+
});
|
|
3438
|
+
// Custom Resource provider wrapping the Lambda
|
|
3439
|
+
const provider = new cr__namespace.Provider(this, "MigrationProvider", {
|
|
3440
|
+
onEventHandler: this.lambda,
|
|
3441
|
+
});
|
|
3442
|
+
// Custom Resource that triggers on every deploy
|
|
3443
|
+
const resource = new cdk__namespace.CustomResource(this, "MigrationResource", {
|
|
3444
|
+
serviceToken: provider.serviceToken,
|
|
3445
|
+
});
|
|
3446
|
+
// Ensure dependencies are created before the migration runs
|
|
3447
|
+
for (const dep of dependencies) {
|
|
3448
|
+
resource.node.addDependency(dep);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3420
3453
|
class JaypieMongoDbSecret extends JaypieEnvSecret {
|
|
3421
3454
|
constructor(scope, id = "MongoConnectionString", props) {
|
|
3422
3455
|
const defaultProps = {
|
|
@@ -4785,6 +4818,7 @@ exports.JaypieGitHubDeployRole = JaypieGitHubDeployRole;
|
|
|
4785
4818
|
exports.JaypieHostedZone = JaypieHostedZone;
|
|
4786
4819
|
exports.JaypieInfrastructureStack = JaypieInfrastructureStack;
|
|
4787
4820
|
exports.JaypieLambda = JaypieLambda;
|
|
4821
|
+
exports.JaypieMigration = JaypieMigration;
|
|
4788
4822
|
exports.JaypieMongoDbSecret = JaypieMongoDbSecret;
|
|
4789
4823
|
exports.JaypieNextJs = JaypieNextJs;
|
|
4790
4824
|
exports.JaypieOpenAiSecret = JaypieOpenAiSecret;
|