@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
package/dist/cjs/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGi
|
|
|
18
18
|
export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZone";
|
|
19
19
|
export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
|
|
20
20
|
export { JaypieLambda, JaypieLambdaProps } from "./JaypieLambda";
|
|
21
|
+
export { JaypieMigration, JaypieMigrationProps } from "./JaypieMigration";
|
|
21
22
|
export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
|
|
22
23
|
export { DomainNameConfig, JaypieNextJs, JaypieNextjsProps, } from "./JaypieNextJs";
|
|
23
24
|
export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
|
|
@@ -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/esm/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGi
|
|
|
18
18
|
export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZone";
|
|
19
19
|
export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
|
|
20
20
|
export { JaypieLambda, JaypieLambdaProps } from "./JaypieLambda";
|
|
21
|
+
export { JaypieMigration, JaypieMigrationProps } from "./JaypieMigration";
|
|
21
22
|
export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
|
|
22
23
|
export { DomainNameConfig, JaypieNextJs, JaypieNextjsProps, } from "./JaypieNextJs";
|
|
23
24
|
export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
|
package/dist/esm/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
|
27
27
|
import * as wafv2 from 'aws-cdk-lib/aws-wafv2';
|
|
28
28
|
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
29
29
|
import { generateIndexName, DEFAULT_SORT_KEY } from '@jaypie/fabric';
|
|
30
|
+
import * as cr from 'aws-cdk-lib/custom-resources';
|
|
30
31
|
import { Nextjs } from 'cdk-nextjs-standalone';
|
|
31
32
|
import * as path from 'path';
|
|
32
33
|
import { CfnAnalyzer } from 'aws-cdk-lib/aws-accessanalyzer';
|
|
@@ -2667,7 +2668,6 @@ class JaypieDistribution extends Construct {
|
|
|
2667
2668
|
if (wafLogBucketProp === true) {
|
|
2668
2669
|
// Create inline WAF logging bucket with Datadog forwarding
|
|
2669
2670
|
const createdBucket = new s3.Bucket(this, constructEnvName("WafLogBucket"), {
|
|
2670
|
-
autoDeleteObjects: true,
|
|
2671
2671
|
bucketName: `aws-waf-logs-${constructEnvName("waf").toLowerCase()}`,
|
|
2672
2672
|
lifecycleRules: [
|
|
2673
2673
|
{
|
|
@@ -2681,7 +2681,7 @@ class JaypieDistribution extends Construct {
|
|
|
2681
2681
|
},
|
|
2682
2682
|
],
|
|
2683
2683
|
objectOwnership: s3.ObjectOwnership.OBJECT_WRITER,
|
|
2684
|
-
removalPolicy: RemovalPolicy.
|
|
2684
|
+
removalPolicy: RemovalPolicy.RETAIN,
|
|
2685
2685
|
});
|
|
2686
2686
|
Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
|
|
2687
2687
|
// Add Datadog forwarder notification
|
|
@@ -3024,6 +3024,9 @@ class JaypieDynamoDb extends Construct {
|
|
|
3024
3024
|
get encryptionKey() {
|
|
3025
3025
|
return this._table.encryptionKey;
|
|
3026
3026
|
}
|
|
3027
|
+
get grants() {
|
|
3028
|
+
return this._table.grants;
|
|
3029
|
+
}
|
|
3027
3030
|
applyRemovalPolicy(policy) {
|
|
3028
3031
|
this._table.applyRemovalPolicy(policy);
|
|
3029
3032
|
}
|
|
@@ -3382,6 +3385,35 @@ class JaypieInfrastructureStack extends JaypieStack {
|
|
|
3382
3385
|
}
|
|
3383
3386
|
}
|
|
3384
3387
|
|
|
3388
|
+
class JaypieMigration extends Construct {
|
|
3389
|
+
constructor(scope, id, props) {
|
|
3390
|
+
super(scope, id);
|
|
3391
|
+
const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3392
|
+
// Migration Lambda — 5 minute timeout for long-running migrations
|
|
3393
|
+
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3394
|
+
code,
|
|
3395
|
+
description: "DynamoDB migration custom resource",
|
|
3396
|
+
handler,
|
|
3397
|
+
roleTag: CDK$2.ROLE.PROCESSING,
|
|
3398
|
+
secrets,
|
|
3399
|
+
tables,
|
|
3400
|
+
timeout: cdk.Duration.minutes(5),
|
|
3401
|
+
});
|
|
3402
|
+
// Custom Resource provider wrapping the Lambda
|
|
3403
|
+
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3404
|
+
onEventHandler: this.lambda,
|
|
3405
|
+
});
|
|
3406
|
+
// Custom Resource that triggers on every deploy
|
|
3407
|
+
const resource = new cdk.CustomResource(this, "MigrationResource", {
|
|
3408
|
+
serviceToken: provider.serviceToken,
|
|
3409
|
+
});
|
|
3410
|
+
// Ensure dependencies are created before the migration runs
|
|
3411
|
+
for (const dep of dependencies) {
|
|
3412
|
+
resource.node.addDependency(dep);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3385
3417
|
class JaypieMongoDbSecret extends JaypieEnvSecret {
|
|
3386
3418
|
constructor(scope, id = "MongoConnectionString", props) {
|
|
3387
3419
|
const defaultProps = {
|
|
@@ -4731,5 +4763,5 @@ class JaypieWebSocketTable extends Construct {
|
|
|
4731
4763
|
}
|
|
4732
4764
|
}
|
|
4733
4765
|
|
|
4734
|
-
export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieCertificate, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieDynamoDb, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, JaypieWebSocket, JaypieWebSocketLambda, JaypieWebSocketTable, addDatadogLayers, clearAllCertificateCaches, clearAllSecretsCaches, clearCertificateCache, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveCertificate, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
|
|
4766
|
+
export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieCertificate, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieDynamoDb, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMigration, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, JaypieWebSocket, JaypieWebSocketLambda, JaypieWebSocketTable, addDatadogLayers, clearAllCertificateCaches, clearAllSecretsCaches, clearCertificateCache, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveCertificate, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
|
|
4735
4767
|
//# sourceMappingURL=index.js.map
|