@jaypie/constructs 1.2.33 → 1.2.35
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 +43 -3
- 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 +42 -4
- 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';
|
|
@@ -370,11 +371,16 @@ function envHostname({ component, domain, env, subdomain, } = {}) {
|
|
|
370
371
|
if (!resolvedDomain) {
|
|
371
372
|
throw new ConfigurationError("No hostname `domain` provided. Set CDK_ENV_DOMAIN or CDK_ENV_HOSTED_ZONE to use environment domain");
|
|
372
373
|
}
|
|
374
|
+
const personal = process.env.CDK_ENV_PERSONAL;
|
|
373
375
|
const resolvedComponent = component === "@" || component === "" ? undefined : component;
|
|
374
376
|
const providedSubdomain = subdomain === "@" || subdomain === "" ? undefined : subdomain;
|
|
375
377
|
const resolvedSubdomain = providedSubdomain || process.env.CDK_ENV_SUBDOMAIN;
|
|
376
378
|
const resolvedEnv = env || process.env.PROJECT_ENV;
|
|
377
|
-
const filteredEnv = resolvedEnv === CDK$2.ENV.PRODUCTION
|
|
379
|
+
const filteredEnv = resolvedEnv === CDK$2.ENV.PRODUCTION
|
|
380
|
+
? undefined
|
|
381
|
+
: personal && resolvedEnv === personal
|
|
382
|
+
? undefined
|
|
383
|
+
: resolvedEnv;
|
|
378
384
|
// Check if parts are already contained in the domain to avoid duplication
|
|
379
385
|
const domainParts = resolvedDomain.split(".");
|
|
380
386
|
const isPartInDomain = (part) => {
|
|
@@ -383,6 +389,7 @@ function envHostname({ component, domain, env, subdomain, } = {}) {
|
|
|
383
389
|
return domainParts.includes(part);
|
|
384
390
|
};
|
|
385
391
|
const parts = [
|
|
392
|
+
personal && !isPartInDomain(personal) ? personal : undefined,
|
|
386
393
|
isPartInDomain(resolvedComponent) ? undefined : resolvedComponent,
|
|
387
394
|
isPartInDomain(resolvedSubdomain) ? undefined : resolvedSubdomain,
|
|
388
395
|
isPartInDomain(filteredEnv) ? undefined : filteredEnv,
|
|
@@ -2667,7 +2674,6 @@ class JaypieDistribution extends Construct {
|
|
|
2667
2674
|
if (wafLogBucketProp === true) {
|
|
2668
2675
|
// Create inline WAF logging bucket with Datadog forwarding
|
|
2669
2676
|
const createdBucket = new s3.Bucket(this, constructEnvName("WafLogBucket"), {
|
|
2670
|
-
autoDeleteObjects: true,
|
|
2671
2677
|
bucketName: `aws-waf-logs-${constructEnvName("waf").toLowerCase()}`,
|
|
2672
2678
|
lifecycleRules: [
|
|
2673
2679
|
{
|
|
@@ -2681,7 +2687,7 @@ class JaypieDistribution extends Construct {
|
|
|
2681
2687
|
},
|
|
2682
2688
|
],
|
|
2683
2689
|
objectOwnership: s3.ObjectOwnership.OBJECT_WRITER,
|
|
2684
|
-
removalPolicy: RemovalPolicy.
|
|
2690
|
+
removalPolicy: RemovalPolicy.RETAIN,
|
|
2685
2691
|
});
|
|
2686
2692
|
Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
|
|
2687
2693
|
// Add Datadog forwarder notification
|
|
@@ -3024,6 +3030,9 @@ class JaypieDynamoDb extends Construct {
|
|
|
3024
3030
|
get encryptionKey() {
|
|
3025
3031
|
return this._table.encryptionKey;
|
|
3026
3032
|
}
|
|
3033
|
+
get grants() {
|
|
3034
|
+
return this._table.grants;
|
|
3035
|
+
}
|
|
3027
3036
|
applyRemovalPolicy(policy) {
|
|
3028
3037
|
this._table.applyRemovalPolicy(policy);
|
|
3029
3038
|
}
|
|
@@ -3382,6 +3391,35 @@ class JaypieInfrastructureStack extends JaypieStack {
|
|
|
3382
3391
|
}
|
|
3383
3392
|
}
|
|
3384
3393
|
|
|
3394
|
+
class JaypieMigration extends Construct {
|
|
3395
|
+
constructor(scope, id, props) {
|
|
3396
|
+
super(scope, id);
|
|
3397
|
+
const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3398
|
+
// Migration Lambda — 5 minute timeout for long-running migrations
|
|
3399
|
+
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3400
|
+
code,
|
|
3401
|
+
description: "DynamoDB migration custom resource",
|
|
3402
|
+
handler,
|
|
3403
|
+
roleTag: CDK$2.ROLE.PROCESSING,
|
|
3404
|
+
secrets,
|
|
3405
|
+
tables,
|
|
3406
|
+
timeout: cdk.Duration.minutes(5),
|
|
3407
|
+
});
|
|
3408
|
+
// Custom Resource provider wrapping the Lambda
|
|
3409
|
+
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3410
|
+
onEventHandler: this.lambda,
|
|
3411
|
+
});
|
|
3412
|
+
// Custom Resource that triggers on every deploy
|
|
3413
|
+
const resource = new cdk.CustomResource(this, "MigrationResource", {
|
|
3414
|
+
serviceToken: provider.serviceToken,
|
|
3415
|
+
});
|
|
3416
|
+
// Ensure dependencies are created before the migration runs
|
|
3417
|
+
for (const dep of dependencies) {
|
|
3418
|
+
resource.node.addDependency(dep);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3385
3423
|
class JaypieMongoDbSecret extends JaypieEnvSecret {
|
|
3386
3424
|
constructor(scope, id = "MongoConnectionString", props) {
|
|
3387
3425
|
const defaultProps = {
|
|
@@ -4731,5 +4769,5 @@ class JaypieWebSocketTable extends Construct {
|
|
|
4731
4769
|
}
|
|
4732
4770
|
}
|
|
4733
4771
|
|
|
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 };
|
|
4772
|
+
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
4773
|
//# sourceMappingURL=index.js.map
|