@jaypie/constructs 1.2.58 → 1.2.60
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/JaypieEnvSecret.d.ts +10 -35
- package/dist/cjs/JaypieLambda.d.ts +3 -2
- package/dist/cjs/JaypieNextJs.d.ts +2 -2
- package/dist/cjs/JaypieSecret.d.ts +59 -0
- package/dist/cjs/__tests__/JaypieSecret.spec.d.ts +1 -0
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/resolveSecrets.d.ts +10 -10
- package/dist/cjs/helpers/wafManagedRuleNames.d.ts +33 -0
- package/dist/cjs/index.cjs +326 -104
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/esm/JaypieEnvSecret.d.ts +10 -35
- package/dist/esm/JaypieLambda.d.ts +3 -2
- package/dist/esm/JaypieNextJs.d.ts +2 -2
- package/dist/esm/JaypieSecret.d.ts +59 -0
- package/dist/esm/__tests__/JaypieSecret.spec.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/resolveSecrets.d.ts +10 -10
- package/dist/esm/helpers/wafManagedRuleNames.d.ts +33 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +325 -106
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { DomainNameConfig, JaypieNextJs, JaypieNextjsProps, } from "./JaypieNext
|
|
|
24
24
|
export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
|
|
25
25
|
export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
|
|
26
26
|
export { JaypieQueuedLambda } from "./JaypieQueuedLambda";
|
|
27
|
+
export { JaypieSecret, JaypieSecretProps } from "./JaypieSecret";
|
|
27
28
|
export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
|
|
28
29
|
export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
|
|
29
30
|
export { JaypieStack, JaypieStackProps } from "./JaypieStack";
|
|
@@ -1,43 +1,18 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
-
import { SecretValue, RemovalPolicy, Stack } from "aws-cdk-lib";
|
|
3
2
|
import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { Grant, IGrantable, PolicyStatement, AddToResourcePolicyResult } from "aws-cdk-lib/aws-iam";
|
|
7
|
-
export interface JaypieEnvSecretProps {
|
|
3
|
+
import { BuildSecretContext, JaypieSecret, JaypieSecretProps } from "./JaypieSecret";
|
|
4
|
+
export interface JaypieEnvSecretProps extends JaypieSecretProps {
|
|
8
5
|
consumer?: boolean;
|
|
9
|
-
envKey?: string;
|
|
10
6
|
export?: string;
|
|
11
|
-
generateSecretString?: secretsmanager.SecretStringGenerator;
|
|
12
7
|
provider?: boolean;
|
|
13
|
-
removalPolicy?: boolean | RemovalPolicy;
|
|
14
|
-
roleTag?: string;
|
|
15
|
-
vendorTag?: string;
|
|
16
|
-
value?: string;
|
|
17
8
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use {@link JaypieSecret}. JaypieEnvSecret layers an
|
|
11
|
+
* environment-driven provider/consumer cross-stack pattern on top of
|
|
12
|
+
* JaypieSecret and will be removed in 2.0.
|
|
13
|
+
*/
|
|
14
|
+
export declare class JaypieEnvSecret extends JaypieSecret {
|
|
15
|
+
protected static readonly shorthandPrefix: string;
|
|
21
16
|
constructor(scope: Construct, idOrEnvKey: string, props?: JaypieEnvSecretProps);
|
|
22
|
-
|
|
23
|
-
get env(): {
|
|
24
|
-
account: string;
|
|
25
|
-
region: string;
|
|
26
|
-
};
|
|
27
|
-
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
28
|
-
get secretArn(): string;
|
|
29
|
-
get secretFullArn(): string | undefined;
|
|
30
|
-
get secretName(): string;
|
|
31
|
-
get secretRef(): secretsmanager.SecretReference;
|
|
32
|
-
get encryptionKey(): IKey | undefined;
|
|
33
|
-
get secretValue(): SecretValue;
|
|
34
|
-
secretValueFromJson(key: string): SecretValue;
|
|
35
|
-
grantRead(grantee: IGrantable, versionStages?: string[]): Grant;
|
|
36
|
-
grantWrite(grantee: IGrantable): Grant;
|
|
37
|
-
addRotationSchedule(id: string, options: RotationScheduleOptions): RotationSchedule;
|
|
38
|
-
addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult;
|
|
39
|
-
denyAccountRootDelete(): void;
|
|
40
|
-
attach(target: ISecretAttachmentTarget): ISecret;
|
|
41
|
-
cfnDynamicReferenceKey(options?: Parameters<ISecret["cfnDynamicReferenceKey"]>[0]): string;
|
|
42
|
-
get envKey(): string | undefined;
|
|
17
|
+
protected buildSecret(context: BuildSecretContext): secretsmanager.ISecret;
|
|
43
18
|
}
|
|
@@ -64,13 +64,14 @@ export interface JaypieLambdaProps {
|
|
|
64
64
|
/**
|
|
65
65
|
* Secrets to make available to the Lambda function.
|
|
66
66
|
*
|
|
67
|
-
* Supports both
|
|
68
|
-
* - JaypieEnvSecret: used directly
|
|
67
|
+
* Supports both JaypieSecret instances and strings:
|
|
68
|
+
* - JaypieSecret (including JaypieEnvSecret): used directly
|
|
69
69
|
* - String: creates a JaypieEnvSecret with the string as envKey
|
|
70
70
|
* (reuses existing secrets within the same scope)
|
|
71
71
|
*/
|
|
72
72
|
secrets?: SecretsArrayItem[];
|
|
73
73
|
securityGroups?: ec2.ISecurityGroup[];
|
|
74
|
+
serviceTag?: string;
|
|
74
75
|
timeout?: Duration | number;
|
|
75
76
|
tracing?: lambda.Tracing;
|
|
76
77
|
vendorTag?: string;
|
|
@@ -44,8 +44,8 @@ export interface JaypieNextjsProps {
|
|
|
44
44
|
/**
|
|
45
45
|
* Secrets to make available to the Next.js application.
|
|
46
46
|
*
|
|
47
|
-
* Supports both
|
|
48
|
-
* - JaypieEnvSecret: used directly
|
|
47
|
+
* Supports both JaypieSecret instances and strings:
|
|
48
|
+
* - JaypieSecret (including JaypieEnvSecret): used directly
|
|
49
49
|
* - String: creates a JaypieEnvSecret with the string as envKey
|
|
50
50
|
* (reuses existing secrets within the same scope)
|
|
51
51
|
*/
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { RemovalPolicy, SecretValue, Stack } from "aws-cdk-lib";
|
|
3
|
+
import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
|
|
4
|
+
import { ISecret, ISecretAttachmentTarget, RotationSchedule, RotationScheduleOptions } from "aws-cdk-lib/aws-secretsmanager";
|
|
5
|
+
import { IKey } from "aws-cdk-lib/aws-kms";
|
|
6
|
+
import { AddToResourcePolicyResult, Grant, IGrantable, PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
7
|
+
export interface JaypieSecretProps {
|
|
8
|
+
envKey?: string;
|
|
9
|
+
generateSecretString?: secretsmanager.SecretStringGenerator;
|
|
10
|
+
removalPolicy?: boolean | RemovalPolicy;
|
|
11
|
+
roleTag?: string;
|
|
12
|
+
vendorTag?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Context handed to {@link JaypieSecret.buildSecret} so subclasses can build the
|
|
17
|
+
* underlying secret differently (e.g. import vs. create) while reusing the
|
|
18
|
+
* shared id/envKey resolution and the full ISecret passthrough.
|
|
19
|
+
*/
|
|
20
|
+
export interface BuildSecretContext {
|
|
21
|
+
envKey?: string;
|
|
22
|
+
id: string;
|
|
23
|
+
props: JaypieSecretProps;
|
|
24
|
+
treatAsEnvKey: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare class JaypieSecret extends Construct implements ISecret {
|
|
27
|
+
protected static readonly shorthandPrefix: string;
|
|
28
|
+
protected readonly _envKey?: string;
|
|
29
|
+
protected readonly _secret: secretsmanager.ISecret;
|
|
30
|
+
constructor(scope: Construct, idOrEnvKey: string, props?: JaypieSecretProps);
|
|
31
|
+
/**
|
|
32
|
+
* Builds the underlying secret. The base implementation always creates a new
|
|
33
|
+
* Secrets Manager secret from an envKey value, an explicit value, or a
|
|
34
|
+
* generated string. Subclasses may override to import an existing secret or
|
|
35
|
+
* emit cross-stack outputs.
|
|
36
|
+
*/
|
|
37
|
+
protected buildSecret(context: BuildSecretContext): secretsmanager.ISecret;
|
|
38
|
+
get stack(): Stack;
|
|
39
|
+
get env(): {
|
|
40
|
+
account: string;
|
|
41
|
+
region: string;
|
|
42
|
+
};
|
|
43
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
44
|
+
get secretArn(): string;
|
|
45
|
+
get secretFullArn(): string | undefined;
|
|
46
|
+
get secretName(): string;
|
|
47
|
+
get secretRef(): secretsmanager.SecretReference;
|
|
48
|
+
get encryptionKey(): IKey | undefined;
|
|
49
|
+
get secretValue(): SecretValue;
|
|
50
|
+
secretValueFromJson(key: string): SecretValue;
|
|
51
|
+
grantRead(grantee: IGrantable, versionStages?: string[]): Grant;
|
|
52
|
+
grantWrite(grantee: IGrantable): Grant;
|
|
53
|
+
addRotationSchedule(id: string, options: RotationScheduleOptions): RotationSchedule;
|
|
54
|
+
addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult;
|
|
55
|
+
denyAccountRootDelete(): void;
|
|
56
|
+
attach(target: ISecretAttachmentTarget): ISecret;
|
|
57
|
+
cfnDynamicReferenceKey(options?: Parameters<ISecret["cfnDynamicReferenceKey"]>[0]): string;
|
|
58
|
+
get envKey(): string | undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,3 +19,4 @@ export { resolveEnvironment, EnvironmentArrayItem, EnvironmentInput, } from "./r
|
|
|
19
19
|
export { resolveHostedZone } from "./resolveHostedZone";
|
|
20
20
|
export { resolveParamsAndSecrets } from "./resolveParamsAndSecrets";
|
|
21
21
|
export { resolveSecrets, SecretsArrayItem, clearSecretsCache, clearAllSecretsCaches, } from "./resolveSecrets";
|
|
22
|
+
export { assertValidWafRuleNames, AWS_MANAGED_RULE_GROUPS, } from "./wafManagedRuleNames";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
-
import {
|
|
2
|
+
import { JaypieSecret } from "../JaypieSecret.js";
|
|
3
3
|
/**
|
|
4
|
-
* Secrets input type that supports both
|
|
5
|
-
* - JaypieEnvSecret: passed through as-is
|
|
6
|
-
* - string: converted to JaypieEnvSecret with the string as envKey
|
|
4
|
+
* Secrets input type that supports both JaypieSecret instances and strings
|
|
5
|
+
* - JaypieSecret (including JaypieEnvSecret subclasses): passed through as-is
|
|
6
|
+
* - string: converted to a JaypieEnvSecret with the string as envKey
|
|
7
7
|
*/
|
|
8
|
-
export type SecretsArrayItem =
|
|
8
|
+
export type SecretsArrayItem = JaypieSecret | string;
|
|
9
9
|
/**
|
|
10
|
-
* Resolves secrets input to an array of
|
|
10
|
+
* Resolves secrets input to an array of JaypieSecret instances.
|
|
11
11
|
*
|
|
12
|
-
* When an item is already a JaypieEnvSecret, it's
|
|
13
|
-
* When an item is a string, a JaypieEnvSecret is created
|
|
14
|
-
* with the string as the envKey.
|
|
12
|
+
* When an item is already a JaypieSecret (including a JaypieEnvSecret), it's
|
|
13
|
+
* passed through as-is. When an item is a string, a JaypieEnvSecret is created
|
|
14
|
+
* (or reused from cache) with the string as the envKey.
|
|
15
15
|
*
|
|
16
16
|
* Secrets are cached per scope to avoid creating duplicate secrets when
|
|
17
17
|
* multiple constructs in the same scope reference the same secret.
|
|
@@ -39,7 +39,7 @@ export type SecretsArrayItem = JaypieEnvSecret | string;
|
|
|
39
39
|
* const secrets2 = resolveSecrets(scope, ["SHARED_SECRET"]);
|
|
40
40
|
* // secrets1[0] === secrets2[0] (same instance)
|
|
41
41
|
*/
|
|
42
|
-
export declare function resolveSecrets(scope: Construct, secrets?: SecretsArrayItem[]):
|
|
42
|
+
export declare function resolveSecrets(scope: Construct, secrets?: SecretsArrayItem[]): JaypieSecret[];
|
|
43
43
|
/**
|
|
44
44
|
* Clears the secrets cache for a given scope.
|
|
45
45
|
* Primarily useful for testing.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as wafv2 from "aws-cdk-lib/aws-wafv2";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical sub-rule names for each AWS managed rule group, as published in the
|
|
4
|
+
* AWS WAF developer guide. Used to validate `waf.allow` and
|
|
5
|
+
* `waf.managedRuleOverrides` rule names at synth time — AWS WAF matches
|
|
6
|
+
* `RuleActionOverride` on the exact rule *name* and silently ignores names that
|
|
7
|
+
* match no rule, so a typo or a label/name casing mismatch (e.g. the label
|
|
8
|
+
* `…:NoUserAgent_Header` vs the rule name `NoUserAgent_HEADER`) becomes an
|
|
9
|
+
* undiagnosable no-op.
|
|
10
|
+
*
|
|
11
|
+
* Groups absent from this map (custom rule groups, or AWS groups not yet
|
|
12
|
+
* mirrored here) are not validated.
|
|
13
|
+
*
|
|
14
|
+
* @see https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-list.html
|
|
15
|
+
*/
|
|
16
|
+
export declare const AWS_MANAGED_RULE_GROUPS: Record<string, readonly string[]>;
|
|
17
|
+
/** One entry in a `waf.allow` list. Mirrors JaypieWafAllowEntry structurally. */
|
|
18
|
+
interface WafAllowEntryLike {
|
|
19
|
+
path: string | string[];
|
|
20
|
+
[ruleGroupKey: string]: string | string[] | undefined;
|
|
21
|
+
}
|
|
22
|
+
interface AssertValidWafRuleNamesOptions {
|
|
23
|
+
allow?: WafAllowEntryLike | WafAllowEntryLike[];
|
|
24
|
+
managedRuleOverrides?: Record<string, wafv2.CfnWebACL.RuleActionOverrideProperty[]>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Throw a ConfigurationError if any `waf.allow` or `waf.managedRuleOverrides`
|
|
28
|
+
* rule name does not exist in its AWS managed rule group. Groups not present in
|
|
29
|
+
* AWS_MANAGED_RULE_GROUPS (custom groups) are skipped. A name that matches no
|
|
30
|
+
* rule would otherwise be silently ignored by AWS WAF.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assertValidWafRuleNames({ allow, managedRuleOverrides, }?: AssertValidWafRuleNamesOptions): void;
|
|
33
|
+
export {};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { DomainNameConfig, JaypieNextJs, JaypieNextjsProps, } from "./JaypieNext
|
|
|
24
24
|
export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
|
|
25
25
|
export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
|
|
26
26
|
export { JaypieQueuedLambda } from "./JaypieQueuedLambda";
|
|
27
|
+
export { JaypieSecret, JaypieSecretProps } from "./JaypieSecret";
|
|
27
28
|
export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
|
|
28
29
|
export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
|
|
29
30
|
export { JaypieStack, JaypieStackProps } from "./JaypieStack";
|