alchemy 0.60.2 → 0.62.0
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/README.md +1 -2
- package/bin/alchemy.js +1480 -1498
- package/bin/commands/init.ts +94 -25
- package/bin/services/execute-alchemy.ts +32 -23
- package/lib/alchemy.d.ts +2 -2
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +1 -0
- package/lib/alchemy.js.map +1 -1
- package/lib/aws/client-props.d.ts +149 -0
- package/lib/aws/client-props.d.ts.map +1 -0
- package/lib/aws/client-props.js +1 -0
- package/lib/aws/client-props.js.map +1 -0
- package/lib/aws/credentials.d.ts +68 -5
- package/lib/aws/credentials.d.ts.map +1 -1
- package/lib/aws/credentials.js +148 -0
- package/lib/aws/credentials.js.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.d.ts +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.js +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -1
- package/lib/aws/ec2/internet-gateway.d.ts +68 -40
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway.js +68 -40
- package/lib/aws/ec2/internet-gateway.js.map +1 -1
- package/lib/aws/ec2/nat-gateway.d.ts +99 -18
- package/lib/aws/ec2/nat-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/nat-gateway.js +113 -37
- package/lib/aws/ec2/nat-gateway.js.map +1 -1
- package/lib/aws/ec2/route-table-association.d.ts +1 -1
- package/lib/aws/ec2/route-table-association.js +1 -1
- package/lib/aws/ec2/route-table.d.ts +64 -1
- package/lib/aws/ec2/route-table.d.ts.map +1 -1
- package/lib/aws/ec2/route-table.js +64 -1
- package/lib/aws/ec2/route-table.js.map +1 -1
- package/lib/aws/ec2/route.d.ts +60 -1
- package/lib/aws/ec2/route.d.ts.map +1 -1
- package/lib/aws/ec2/route.js +60 -1
- package/lib/aws/ec2/route.js.map +1 -1
- package/lib/aws/ec2/security-group.d.ts +96 -3
- package/lib/aws/ec2/security-group.d.ts.map +1 -1
- package/lib/aws/ec2/security-group.js +96 -3
- package/lib/aws/ec2/security-group.js.map +1 -1
- package/lib/aws/ec2/subnet.d.ts +61 -3
- package/lib/aws/ec2/subnet.d.ts.map +1 -1
- package/lib/aws/ec2/subnet.js +61 -3
- package/lib/aws/ec2/subnet.js.map +1 -1
- package/lib/aws/ec2/utils.d.ts +10 -2
- package/lib/aws/ec2/utils.d.ts.map +1 -1
- package/lib/aws/ec2/utils.js +68 -7
- package/lib/aws/ec2/utils.js.map +1 -1
- package/lib/aws/ec2/vpc.d.ts +50 -2
- package/lib/aws/ec2/vpc.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.js +50 -2
- package/lib/aws/ec2/vpc.js.map +1 -1
- package/lib/aws/index.d.ts +2 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +2 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/cloudflare/api-response.js +2 -2
- package/lib/cloudflare/api-response.js.map +1 -1
- package/lib/cloudflare/api.d.ts +19 -0
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +4 -0
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +3 -4
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/bucket.d.ts +5 -3
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +28 -20
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-compat-warning.js +7 -7
- package/lib/cloudflare/bundle/plugin-compat-warning.js.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.gen.js +1 -1
- package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
- package/lib/cloudflare/d1-migrations.js +3 -2
- package/lib/cloudflare/d1-migrations.js.map +1 -1
- package/lib/cloudflare/index.d.ts +2 -1
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +2 -1
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +2 -2
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/miniflare/build-worker-options.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/build-worker-options.js +16 -3
- package/lib/cloudflare/miniflare/build-worker-options.js.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-controller.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-controller.js +3 -0
- package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
- package/lib/cloudflare/oauth.js +3 -3
- package/lib/cloudflare/oauth.js.map +1 -1
- package/lib/cloudflare/quick-tunnel.d.ts +17 -0
- package/lib/cloudflare/quick-tunnel.d.ts.map +1 -0
- package/lib/cloudflare/quick-tunnel.js +26 -0
- package/lib/cloudflare/quick-tunnel.js.map +1 -0
- package/lib/cloudflare/sveltekit/plugin.d.ts +2 -2
- package/lib/cloudflare/sveltekit/plugin.d.ts.map +1 -1
- package/lib/cloudflare/sveltekit/plugin.js +5 -4
- package/lib/cloudflare/sveltekit/plugin.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +26 -97
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-bundle.d.ts.map +1 -1
- package/lib/cloudflare/worker-bundle.js +11 -9
- package/lib/cloudflare/worker-bundle.js.map +1 -1
- package/lib/cloudflare/worker-tail.d.ts.map +1 -1
- package/lib/cloudflare/worker-tail.js +6 -6
- package/lib/cloudflare/worker-tail.js.map +1 -1
- package/lib/resource.d.ts +1 -0
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +13 -2
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +38 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +44 -19
- package/lib/scope.js.map +1 -1
- package/lib/state/cloudflare-state-store.d.ts.map +1 -1
- package/lib/state/cloudflare-state-store.js +2 -1
- package/lib/state/cloudflare-state-store.js.map +1 -1
- package/lib/util/idempotent-spawn.d.ts +24 -0
- package/lib/util/idempotent-spawn.d.ts.map +1 -0
- package/lib/util/idempotent-spawn.js +237 -0
- package/lib/util/idempotent-spawn.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/safe-fetch.d.ts +24 -0
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +72 -0
- package/lib/util/safe-fetch.js.map +1 -1
- package/package.json +9 -5
- package/src/alchemy.ts +3 -2
- package/src/aws/client-props.ts +156 -0
- package/src/aws/credentials.ts +165 -4
- package/src/aws/ec2/internet-gateway-attachment.ts +59 -4
- package/src/aws/ec2/internet-gateway.ts +70 -41
- package/src/aws/ec2/nat-gateway.ts +123 -33
- package/src/aws/ec2/route-table-association.ts +1 -1
- package/src/aws/ec2/route-table.ts +66 -2
- package/src/aws/ec2/route.ts +62 -2
- package/src/aws/ec2/security-group.ts +98 -4
- package/src/aws/ec2/subnet.ts +63 -4
- package/src/aws/ec2/utils.ts +73 -7
- package/src/aws/ec2/vpc.ts +52 -3
- package/src/aws/index.ts +2 -0
- package/src/cloudflare/api-response.ts +2 -2
- package/src/cloudflare/api.ts +23 -0
- package/src/cloudflare/assets.ts +3 -4
- package/src/cloudflare/bucket.ts +39 -29
- package/src/cloudflare/bundle/plugin-compat-warning.ts +7 -7
- package/src/cloudflare/cloudflare-env-proxy.ts +2 -2
- package/src/cloudflare/compatibility-date.gen.ts +1 -1
- package/src/cloudflare/d1-migrations.ts +4 -5
- package/src/cloudflare/index.ts +2 -1
- package/src/cloudflare/kv-namespace.ts +26 -27
- package/src/cloudflare/miniflare/build-worker-options.ts +16 -3
- package/src/cloudflare/miniflare/miniflare-controller.ts +4 -0
- package/src/cloudflare/oauth.ts +3 -3
- package/src/cloudflare/quick-tunnel.ts +30 -0
- package/src/cloudflare/sveltekit/plugin.ts +5 -5
- package/src/cloudflare/website.ts +30 -111
- package/src/cloudflare/worker-bundle.ts +11 -9
- package/src/cloudflare/worker-tail.ts +6 -8
- package/src/resource.ts +19 -2
- package/src/scope.ts +111 -20
- package/src/state/cloudflare-state-store.ts +2 -1
- package/src/util/idempotent-spawn.ts +303 -0
- package/src/util/index.ts +1 -0
- package/src/util/safe-fetch.ts +114 -0
- package/templates/rwsdk/package.json +1 -1
package/lib/aws/credentials.js
CHANGED
|
@@ -1 +1,149 @@
|
|
|
1
|
+
import { alchemy } from "../alchemy.js";
|
|
2
|
+
import { isSecret } from "../secret.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validate AWS client properties to ensure they are strings.
|
|
5
|
+
* This follows the same pattern as Cloudflare credential validation.
|
|
6
|
+
*/
|
|
7
|
+
function validateAwsClientProps(props, context) {
|
|
8
|
+
const validKeys = [
|
|
9
|
+
"accessKeyId",
|
|
10
|
+
"secretAccessKey",
|
|
11
|
+
"sessionToken",
|
|
12
|
+
"region",
|
|
13
|
+
"profile",
|
|
14
|
+
"roleArn",
|
|
15
|
+
"externalId",
|
|
16
|
+
"roleSessionName",
|
|
17
|
+
];
|
|
18
|
+
for (const [key, value] of Object.entries(props)) {
|
|
19
|
+
if (!validKeys.includes(key)) {
|
|
20
|
+
continue; // Ignore unknown properties
|
|
21
|
+
}
|
|
22
|
+
if (value !== undefined && typeof value !== "string" && !isSecret(value)) {
|
|
23
|
+
throw new Error(`Invalid AWS configuration in ${context}: Property '${key}' must be a string or Secret, got ${typeof value}. ` +
|
|
24
|
+
"Please ensure all AWS credential properties are strings or Secret objects.");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get global AWS configuration from environment variables.
|
|
30
|
+
* This provides the base layer of AWS credential configuration.
|
|
31
|
+
*/
|
|
32
|
+
export function getGlobalAwsConfig() {
|
|
33
|
+
return {
|
|
34
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID
|
|
35
|
+
? alchemy.secret(process.env.AWS_ACCESS_KEY_ID)
|
|
36
|
+
: undefined,
|
|
37
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
|
38
|
+
? alchemy.secret(process.env.AWS_SECRET_ACCESS_KEY)
|
|
39
|
+
: undefined,
|
|
40
|
+
sessionToken: process.env.AWS_SESSION_TOKEN
|
|
41
|
+
? alchemy.secret(process.env.AWS_SESSION_TOKEN)
|
|
42
|
+
: undefined,
|
|
43
|
+
region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION,
|
|
44
|
+
profile: process.env.AWS_PROFILE,
|
|
45
|
+
roleArn: process.env.AWS_ROLE_ARN,
|
|
46
|
+
externalId: process.env.AWS_EXTERNAL_ID,
|
|
47
|
+
roleSessionName: process.env.AWS_ROLE_SESSION_NAME,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve AWS credentials using three-tier resolution: global → scope → resource.
|
|
52
|
+
*
|
|
53
|
+
* This function implements a comprehensive credential resolution system that allows
|
|
54
|
+
* for flexible AWS credential management across different levels of your application.
|
|
55
|
+
* It enables multi-account and multi-region deployments by providing a consistent
|
|
56
|
+
* way to override credentials at different scopes.
|
|
57
|
+
*
|
|
58
|
+
* The resolution follows this precedence order:
|
|
59
|
+
* 1. Resource-level credentials (highest priority)
|
|
60
|
+
* 2. Scope-level credentials (medium priority)
|
|
61
|
+
* 3. Global environment variables (lowest priority)
|
|
62
|
+
*
|
|
63
|
+
* Supported credential properties include:
|
|
64
|
+
* - `region`: AWS region (e.g., 'us-west-2', 'eu-central-1')
|
|
65
|
+
* - `profile`: AWS profile name from credentials file
|
|
66
|
+
* - `accessKeyId`: AWS access key ID
|
|
67
|
+
* - `secretAccessKey`: AWS secret access key
|
|
68
|
+
* - `sessionToken`: AWS session token for temporary credentials
|
|
69
|
+
* - `roleArn`: AWS role ARN to assume
|
|
70
|
+
* - `roleSessionName`: Session name when assuming a role
|
|
71
|
+
* - `externalId`: External ID when assuming a role
|
|
72
|
+
*
|
|
73
|
+
* @param resourceProps - Resource-level AWS credential properties (optional)
|
|
74
|
+
* @returns Resolved AWS client properties with validation
|
|
75
|
+
*
|
|
76
|
+
* @throws {Error} When scope contains invalid AWS configuration
|
|
77
|
+
* @throws {Error} When resource properties contain invalid AWS configuration
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Basic usage with resource-level credentials
|
|
82
|
+
* const credentials = resolveAwsCredentials({
|
|
83
|
+
* region: "us-west-2",
|
|
84
|
+
* profile: "production"
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // Usage with scope-level credentials
|
|
91
|
+
* await alchemy.run("my-app", {
|
|
92
|
+
* aws: {
|
|
93
|
+
* region: "eu-west-1",
|
|
94
|
+
* profile: "staging"
|
|
95
|
+
* }
|
|
96
|
+
* }, async () => {
|
|
97
|
+
* // Resources created here will use the scope credentials by default
|
|
98
|
+
* const vpc = await Vpc("main-vpc", {
|
|
99
|
+
* cidrBlock: "10.0.0.0/16"
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* // Resources can override scope credentials
|
|
103
|
+
* const crossRegionSubnet = await Subnet("cross-region-subnet", {
|
|
104
|
+
* vpc,
|
|
105
|
+
* cidrBlock: "10.0.1.0/24",
|
|
106
|
+
* region: "us-east-1" // Override scope region
|
|
107
|
+
* });
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export async function resolveAwsCredentials(resourceProps) {
|
|
112
|
+
// 1. Start with global environment variables (lowest priority)
|
|
113
|
+
const globalConfig = getGlobalAwsConfig();
|
|
114
|
+
// 2. Layer in scope-level credentials (medium priority)
|
|
115
|
+
let scopeConfig = {};
|
|
116
|
+
try {
|
|
117
|
+
// Import Scope dynamically to avoid circular dependency
|
|
118
|
+
const { Scope } = await import("../scope.js");
|
|
119
|
+
const currentScope = Scope.getScope();
|
|
120
|
+
if (currentScope?.providerCredentials?.aws) {
|
|
121
|
+
scopeConfig = currentScope.providerCredentials.aws;
|
|
122
|
+
// Validate scope-level credentials if provided
|
|
123
|
+
validateAwsClientProps(scopeConfig, "scope");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
// If we can't access scope (e.g., not running in scope context), just continue
|
|
128
|
+
// with empty scope config unless it's a validation error
|
|
129
|
+
if (error instanceof Error &&
|
|
130
|
+
error.message.includes("Invalid AWS configuration")) {
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// 3. Layer in resource-level credentials (highest priority)
|
|
135
|
+
const resourceConfig = resourceProps || {};
|
|
136
|
+
// Validate resource-level credentials if provided
|
|
137
|
+
if (resourceProps && Object.keys(resourceProps).length > 0) {
|
|
138
|
+
validateAwsClientProps(resourceProps, "resource properties");
|
|
139
|
+
}
|
|
140
|
+
// Merge configurations with proper precedence (later properties override earlier ones)
|
|
141
|
+
const resolvedConfig = {
|
|
142
|
+
...globalConfig,
|
|
143
|
+
...scopeConfig,
|
|
144
|
+
...resourceConfig,
|
|
145
|
+
};
|
|
146
|
+
// Filter out undefined values from the final result
|
|
147
|
+
return Object.fromEntries(Object.entries(resolvedConfig).filter(([_, value]) => value !== undefined));
|
|
148
|
+
}
|
|
1
149
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/aws/credentials.ts"],"names":[],"mappings":""}
|
|
1
|
+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AA4D;IAC5D,MAAM,cAAc,GAAG,aAAa,IAAI,EAAE,CAAC;IAE3C,kDAAkD;IAClD,IAAI,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3D,sBAAsB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IAC/D,CAAC;IAED,uFAAuF;IACvF,MAAM,cAAc,GAAG;QACrB,GAAG,YAAY;QACf,GAAG,WAAW;QACd,GAAG,cAAc;KAClB,CAAC;IAEF,oDAAoD;IACpD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACzD,CAAC;AACtB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
import type { InternetGateway } from "./internet-gateway.ts";
|
|
5
6
|
import type { Vpc } from "./vpc.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Properties for creating or updating an Internet Gateway Attachment
|
|
8
9
|
*/
|
|
9
|
-
export interface InternetGatewayAttachmentProps {
|
|
10
|
+
export interface InternetGatewayAttachmentProps extends AwsClientProps {
|
|
10
11
|
/**
|
|
11
12
|
* The Internet Gateway to attach
|
|
12
13
|
*/
|
|
@@ -50,6 +51,9 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
50
51
|
* allowing traffic to flow between the VPC and the internet when combined with proper
|
|
51
52
|
* routing configuration.
|
|
52
53
|
*
|
|
54
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Internet Gateway Attachments
|
|
55
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
56
|
+
*
|
|
53
57
|
* @example
|
|
54
58
|
* // Basic Internet Gateway attachment for internet connectivity
|
|
55
59
|
* const vpc = await Vpc("main-vpc", {
|
|
@@ -64,6 +68,36 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
64
68
|
* });
|
|
65
69
|
*
|
|
66
70
|
* @example
|
|
71
|
+
* // Internet Gateway Attachment with AWS credential overrides
|
|
72
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
73
|
+
* internetGateway: igw,
|
|
74
|
+
* vpc: vpc,
|
|
75
|
+
* // Override AWS credentials for this specific resource
|
|
76
|
+
* region: "us-east-1",
|
|
77
|
+
* profile: "production-account",
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Internet Gateway Attachment in different region with role assumption
|
|
82
|
+
* const multiRegionAttachment = await InternetGatewayAttachment("multi-region-attachment", {
|
|
83
|
+
* internetGateway: euIgw,
|
|
84
|
+
* vpc: euVpc,
|
|
85
|
+
* region: "eu-west-1",
|
|
86
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
87
|
+
* roleSessionName: "igw-attachment-deployment",
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Internet Gateway Attachment with explicit credentials
|
|
92
|
+
* const explicitCredsAttachment = await InternetGatewayAttachment("explicit-creds-attachment", {
|
|
93
|
+
* internetGateway: testIgw,
|
|
94
|
+
* vpc: testVpc,
|
|
95
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
96
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
97
|
+
* region: "us-west-2",
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
67
101
|
* // Internet Gateway attachment with custom timeout configuration
|
|
68
102
|
* // for environments with slower AWS API responses
|
|
69
103
|
* const attachment = await InternetGatewayAttachment("slow-env-attachment", {
|
|
@@ -92,7 +126,7 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
92
126
|
*
|
|
93
127
|
* // Create public subnet and route table for internet access
|
|
94
128
|
* const publicSubnet = await Subnet("public-subnet", {
|
|
95
|
-
* vpc,
|
|
129
|
+
* vpc: vpc,
|
|
96
130
|
* cidrBlock: "10.0.1.0/24",
|
|
97
131
|
* availabilityZone: "us-east-1a"
|
|
98
132
|
* });
|
|
@@ -104,7 +138,27 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
104
138
|
* const internetRoute = await Route("internet-route", {
|
|
105
139
|
* routeTable: publicRouteTable,
|
|
106
140
|
* destinationCidrBlock: "0.0.0.0/0",
|
|
107
|
-
*
|
|
141
|
+
* target: { internetGateway: igw }
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
146
|
+
* await alchemy.run("production", {
|
|
147
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
148
|
+
* }, async () => {
|
|
149
|
+
* // This Internet Gateway Attachment uses scope credentials (main-account, us-west-2)
|
|
150
|
+
* const mainAttachment = await InternetGatewayAttachment("main-attachment", {
|
|
151
|
+
* internetGateway: mainIgw,
|
|
152
|
+
* vpc: mainVpc
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // This Internet Gateway Attachment overrides to use different account
|
|
156
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
157
|
+
* internetGateway: crossIgw,
|
|
158
|
+
* vpc: crossVpc,
|
|
159
|
+
* profile: "secondary-account",
|
|
160
|
+
* region: "us-east-1", // Also override region
|
|
161
|
+
* });
|
|
108
162
|
* });
|
|
109
163
|
*/
|
|
110
164
|
export declare const InternetGatewayAttachment: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<InternetGatewayAttachment>, _id: string, props: InternetGatewayAttachmentProps) => Promise<InternetGatewayAttachment>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internet-gateway-attachment.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"internet-gateway-attachment.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE;;OAEG;IACH,eAAe,EAAE,eAAe,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ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the VPC and the internet when combined with proper
|
|
17
17
|
* routing configuration.
|
|
18
18
|
*
|
|
19
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Internet Gateway Attachments
|
|
20
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
21
|
+
*
|
|
19
22
|
* @example
|
|
20
23
|
* // Basic Internet Gateway attachment for internet connectivity
|
|
21
24
|
* const vpc = await Vpc("main-vpc", {
|
|
@@ -30,6 +33,36 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
30
33
|
* });
|
|
31
34
|
*
|
|
32
35
|
* @example
|
|
36
|
+
* // Internet Gateway Attachment with AWS credential overrides
|
|
37
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
38
|
+
* internetGateway: igw,
|
|
39
|
+
* vpc: vpc,
|
|
40
|
+
* // Override AWS credentials for this specific resource
|
|
41
|
+
* region: "us-east-1",
|
|
42
|
+
* profile: "production-account",
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Internet Gateway Attachment in different region with role assumption
|
|
47
|
+
* const multiRegionAttachment = await InternetGatewayAttachment("multi-region-attachment", {
|
|
48
|
+
* internetGateway: euIgw,
|
|
49
|
+
* vpc: euVpc,
|
|
50
|
+
* region: "eu-west-1",
|
|
51
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
52
|
+
* roleSessionName: "igw-attachment-deployment",
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Internet Gateway Attachment with explicit credentials
|
|
57
|
+
* const explicitCredsAttachment = await InternetGatewayAttachment("explicit-creds-attachment", {
|
|
58
|
+
* internetGateway: testIgw,
|
|
59
|
+
* vpc: testVpc,
|
|
60
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
61
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
62
|
+
* region: "us-west-2",
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
33
66
|
* // Internet Gateway attachment with custom timeout configuration
|
|
34
67
|
* // for environments with slower AWS API responses
|
|
35
68
|
* const attachment = await InternetGatewayAttachment("slow-env-attachment", {
|
|
@@ -58,7 +91,7 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
58
91
|
*
|
|
59
92
|
* // Create public subnet and route table for internet access
|
|
60
93
|
* const publicSubnet = await Subnet("public-subnet", {
|
|
61
|
-
* vpc,
|
|
94
|
+
* vpc: vpc,
|
|
62
95
|
* cidrBlock: "10.0.1.0/24",
|
|
63
96
|
* availabilityZone: "us-east-1a"
|
|
64
97
|
* });
|
|
@@ -70,11 +103,32 @@ import { callEC2Api, createEC2Client } from "./utils.js";
|
|
|
70
103
|
* const internetRoute = await Route("internet-route", {
|
|
71
104
|
* routeTable: publicRouteTable,
|
|
72
105
|
* destinationCidrBlock: "0.0.0.0/0",
|
|
73
|
-
*
|
|
106
|
+
* target: { internetGateway: igw }
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
111
|
+
* await alchemy.run("production", {
|
|
112
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
113
|
+
* }, async () => {
|
|
114
|
+
* // This Internet Gateway Attachment uses scope credentials (main-account, us-west-2)
|
|
115
|
+
* const mainAttachment = await InternetGatewayAttachment("main-attachment", {
|
|
116
|
+
* internetGateway: mainIgw,
|
|
117
|
+
* vpc: mainVpc
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* // This Internet Gateway Attachment overrides to use different account
|
|
121
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
122
|
+
* internetGateway: crossIgw,
|
|
123
|
+
* vpc: crossVpc,
|
|
124
|
+
* profile: "secondary-account",
|
|
125
|
+
* region: "us-east-1", // Also override region
|
|
126
|
+
* });
|
|
74
127
|
* });
|
|
75
128
|
*/
|
|
76
129
|
export const InternetGatewayAttachment = Resource("aws::InternetGatewayAttachment", async function (_id, props) {
|
|
77
|
-
|
|
130
|
+
// Create EC2 client with credential resolution handled internally
|
|
131
|
+
const client = await createEC2Client(props);
|
|
78
132
|
const timeoutConfig = mergeTimeoutConfig(INTERNET_GATEWAY_ATTACHMENT_TIMEOUT, props.timeout);
|
|
79
133
|
const internetGatewayId = typeof props.internetGateway === "string"
|
|
80
134
|
? props.internetGateway
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internet-gateway-attachment.js","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAElB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"internet-gateway-attachment.js","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAElB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA8CzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,IAAI;wBACxB,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC;oBAC5B,CAAC,CAAC,EAAE,CAAC;gBAEP,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI;oBAC3B,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;wBAC9B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI;wBACjB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;oBACrB,CAAC,CAAC,EAAE,CAAC;gBAEP,OAAO;oBACL,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;oBACxC,KAAK,EAAE,WAAW,EAAE,yCAAyC;oBAC7D,WAAW,EAAE,WAAW,CAAC,GAAG,CAC1B,CAAC,UAAU,EAAuB,EAAE,CAAC,CAAC;wBACpC,KAAK,EAAE,UAAU,CAAC,KAAK;wBACvB,KAAK,EAAE,UAAU,CAAC,KAAK;qBACxB,CAAC,CACH;oBACD,IAAI,EACF,IAAI,CAAC,MAAM,GAAG,CAAC;wBACb,CAAC,CAAC,IAAI,CAAC,GAAG,CACN,CAAC,GAAG,EAAgB,EAAE,CAAC,CAAC;4BACtB,GAAG,EAAE,GAAG,CAAC,GAAG;4BACZ,KAAK,EAAE,GAAG,CAAC,KAAK;yBACjB,CAAC,CACH;wBACH,CAAC,CAAC,SAAS;oBACf,OAAO,EAAE,GAAG,CAAC,OAAO;iBACrB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Properties for creating or updating an Internet Gateway
|
|
6
7
|
*/
|
|
7
|
-
export interface InternetGatewayProps {
|
|
8
|
+
export interface InternetGatewayProps extends AwsClientProps {
|
|
8
9
|
/**
|
|
9
10
|
* Tags to apply to the Internet Gateway
|
|
10
11
|
*/
|
|
@@ -47,12 +48,15 @@ export interface InternetGateway extends Resource<"aws::InternetGateway">, Inter
|
|
|
47
48
|
* 1. Provide a target in your VPC route tables for internet-routable traffic
|
|
48
49
|
* 2. Perform network address translation (NAT) for instances with public IPv4 addresses
|
|
49
50
|
*
|
|
51
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Internet Gateways
|
|
52
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
53
|
+
*
|
|
50
54
|
* @example
|
|
51
55
|
* ```typescript
|
|
52
56
|
* // Create a basic Internet Gateway
|
|
53
|
-
* const igw =
|
|
57
|
+
* const igw = await InternetGateway("main-igw", {
|
|
54
58
|
* tags: {
|
|
55
|
-
* Name: "
|
|
59
|
+
* Name: "main-internet-gateway",
|
|
56
60
|
* Environment: "production"
|
|
57
61
|
* }
|
|
58
62
|
* });
|
|
@@ -60,59 +64,49 @@ export interface InternetGateway extends Resource<"aws::InternetGateway">, Inter
|
|
|
60
64
|
*
|
|
61
65
|
* @example
|
|
62
66
|
* ```typescript
|
|
63
|
-
* // Create Internet Gateway with
|
|
64
|
-
* const
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* // Create Internet Gateway with AWS credential overrides
|
|
68
|
+
* const crossAccountIgw = await InternetGateway("cross-account-igw", {
|
|
69
|
+
* // Override AWS credentials for this specific resource
|
|
70
|
+
* region: "us-east-1",
|
|
71
|
+
* profile: "production-account",
|
|
72
|
+
* tags: {
|
|
73
|
+
* Name: "cross-account-internet-gateway",
|
|
74
|
+
* Environment: "production"
|
|
69
75
|
* }
|
|
70
76
|
* });
|
|
71
77
|
* ```
|
|
72
78
|
*
|
|
73
79
|
* @example
|
|
74
80
|
* ```typescript
|
|
75
|
-
* // Create Internet Gateway
|
|
76
|
-
* const
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* vpcId: vpc.vpcId
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* // Access Internet Gateway properties
|
|
87
|
-
* const igw = new InternetGateway({ tags: { Name: "example-igw" } });
|
|
88
|
-
* logger.log(`Internet Gateway ID: ${igw.internetGatewayId}`);
|
|
89
|
-
* logger.log(`State: ${igw.state}`);
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* Creates and manages Internet Gateways that provide internet access to VPCs.
|
|
93
|
-
* Note: Use InternetGatewayAttachment to attach the gateway to a VPC.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* // Create a basic Internet Gateway
|
|
97
|
-
* const igw = await InternetGateway("main-igw", {
|
|
81
|
+
* // Create Internet Gateway in different region with role assumption
|
|
82
|
+
* const multiRegionIgw = await InternetGateway("multi-region-igw", {
|
|
83
|
+
* region: "eu-west-1",
|
|
84
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
85
|
+
* roleSessionName: "internet-gateway-deployment",
|
|
98
86
|
* tags: {
|
|
99
|
-
* Name: "
|
|
100
|
-
*
|
|
87
|
+
* Name: "eu-internet-gateway",
|
|
88
|
+
* Region: "europe"
|
|
101
89
|
* }
|
|
102
90
|
* });
|
|
91
|
+
* ```
|
|
103
92
|
*
|
|
104
93
|
* @example
|
|
105
|
-
*
|
|
106
|
-
*
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Create Internet Gateway with explicit credentials
|
|
96
|
+
* const explicitCredsIgw = await InternetGateway("explicit-creds-igw", {
|
|
97
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
98
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
99
|
+
* region: "us-west-2",
|
|
107
100
|
* tags: {
|
|
108
|
-
* Name: "
|
|
109
|
-
*
|
|
110
|
-
* Team: "backend"
|
|
101
|
+
* Name: "explicit-credentials-igw",
|
|
102
|
+
* Purpose: "testing"
|
|
111
103
|
* }
|
|
112
104
|
* });
|
|
105
|
+
* ```
|
|
113
106
|
*
|
|
114
107
|
* @example
|
|
115
|
-
*
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // Create Internet Gateway with custom timeout configuration
|
|
116
110
|
* const customIgw = await InternetGateway("custom-igw", {
|
|
117
111
|
* timeout: {
|
|
118
112
|
* maxAttempts: 90,
|
|
@@ -123,6 +117,40 @@ export interface InternetGateway extends Resource<"aws::InternetGateway">, Inter
|
|
|
123
117
|
* Purpose: "high-availability"
|
|
124
118
|
* }
|
|
125
119
|
* });
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* // Create Internet Gateway and attach to VPC
|
|
125
|
+
* const vpc = await VPC("main-vpc", { cidrBlock: "10.0.0.0/16" });
|
|
126
|
+
* const igw = await InternetGateway("vpc-igw", {
|
|
127
|
+
* tags: { Name: "vpc-internet-gateway" }
|
|
128
|
+
* });
|
|
129
|
+
* const attachment = await InternetGatewayAttachment("igw-attachment", {
|
|
130
|
+
* internetGatewayId: igw.internetGatewayId,
|
|
131
|
+
* vpcId: vpc.vpcId
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
138
|
+
* await alchemy.run("production", {
|
|
139
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
140
|
+
* }, async () => {
|
|
141
|
+
* // This IGW uses scope credentials (main-account, us-west-2)
|
|
142
|
+
* const mainIgw = await InternetGateway("main-igw", {
|
|
143
|
+
* tags: { Name: "main-account-igw" }
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* // This IGW overrides to use different account
|
|
147
|
+
* const crossAccountIgw = await InternetGateway("cross-account-igw", {
|
|
148
|
+
* profile: "secondary-account",
|
|
149
|
+
* region: "us-east-1", // Also override region
|
|
150
|
+
* tags: { Name: "secondary-account-igw" }
|
|
151
|
+
* });
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
126
154
|
*/
|
|
127
155
|
export declare const InternetGateway: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<InternetGateway>, _id: string, props: InternetGatewayProps) => Promise<InternetGateway>);
|
|
128
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internet-gateway.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"internet-gateway.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;;OA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