@go-to-k/cdkd 0.201.1 → 0.202.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/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-DWUnLza1.js";
|
|
3
|
-
import { $ as uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-
|
|
3
|
+
import { $ as uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-CuJDHhTs.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -32011,7 +32011,7 @@ var S3TablesProvider = class {
|
|
|
32011
32011
|
providerRegion = process.env["AWS_REGION"];
|
|
32012
32012
|
logger = getLogger().child("S3TablesProvider");
|
|
32013
32013
|
handledProperties = new Map([
|
|
32014
|
-
["AWS::S3Tables::TableBucket", new Set(["TableBucketName"])],
|
|
32014
|
+
["AWS::S3Tables::TableBucket", new Set(["TableBucketName", "Tags"])],
|
|
32015
32015
|
["AWS::S3Tables::Namespace", new Set(["TableBucketARN", "Namespace"])],
|
|
32016
32016
|
["AWS::S3Tables::Table", new Set([
|
|
32017
32017
|
"TableBucketARN",
|
|
@@ -32037,6 +32037,7 @@ var S3TablesProvider = class {
|
|
|
32037
32037
|
}
|
|
32038
32038
|
async update(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
32039
32039
|
if (resourceType === "AWS::S3Tables::Table") await this.applyTableTagsDiff(logicalId, physicalId, resourceType, previousProperties["Tags"], properties["Tags"]);
|
|
32040
|
+
else if (resourceType === "AWS::S3Tables::TableBucket") await this.applyTableBucketTagsDiff(logicalId, physicalId, resourceType, previousProperties["Tags"], properties["Tags"]);
|
|
32040
32041
|
else this.logger.debug(`Update is no-op for ${resourceType} ${logicalId}`);
|
|
32041
32042
|
return {
|
|
32042
32043
|
physicalId,
|
|
@@ -32055,8 +32056,12 @@ var S3TablesProvider = class {
|
|
|
32055
32056
|
this.logger.debug(`Creating S3 Table Bucket ${logicalId}`);
|
|
32056
32057
|
const tableBucketName = properties["TableBucketName"];
|
|
32057
32058
|
if (!tableBucketName) throw new ProvisioningError(`TableBucketName is required for S3 Table Bucket ${logicalId}`, resourceType, logicalId);
|
|
32059
|
+
const tags = this.cfnTagsToSdkMap(properties["Tags"]);
|
|
32058
32060
|
try {
|
|
32059
|
-
const tableBucketARN = (await this.getClient().send(new CreateTableBucketCommand({
|
|
32061
|
+
const tableBucketARN = (await this.getClient().send(new CreateTableBucketCommand({
|
|
32062
|
+
name: tableBucketName,
|
|
32063
|
+
...tags !== void 0 && { tags }
|
|
32064
|
+
}))).arn;
|
|
32060
32065
|
this.logger.debug(`Successfully created S3 Table Bucket ${logicalId}: ${tableBucketARN}`);
|
|
32061
32066
|
return {
|
|
32062
32067
|
physicalId: tableBucketARN,
|
|
@@ -32248,6 +32253,7 @@ var S3TablesProvider = class {
|
|
|
32248
32253
|
}
|
|
32249
32254
|
const result = {};
|
|
32250
32255
|
if (bucket.name !== void 0) result["TableBucketName"] = bucket.name;
|
|
32256
|
+
result["Tags"] = await this.readTagsBestEffort(physicalId);
|
|
32251
32257
|
return result;
|
|
32252
32258
|
}
|
|
32253
32259
|
async readNamespaceCurrentState(physicalId) {
|
|
@@ -32567,6 +32573,47 @@ var S3TablesProvider = class {
|
|
|
32567
32573
|
throw new ProvisioningError(`applyTableTagsDiff: TagResource failed for ${resourceArn} (keys: ${Object.keys(upserts).join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
|
|
32568
32574
|
}
|
|
32569
32575
|
}
|
|
32576
|
+
/**
|
|
32577
|
+
* Apply a tag-diff against a TableBucket resource ARN. Mirrors
|
|
32578
|
+
* `applyTableTagsDiff` for the Table case, but simpler: TableBucket's
|
|
32579
|
+
* `physicalId` IS the bucket ARN, so no `GetTableBucket` lookup hop
|
|
32580
|
+
* is needed (the Table version needs `GetTable` to recover the real
|
|
32581
|
+
* ARN from the cdkd-compound `<bucketArn>|<namespace>|<name>` physical id).
|
|
32582
|
+
*
|
|
32583
|
+
* Same throw semantics as `applyTableTagsDiff` (per issue #740 / PR
|
|
32584
|
+
* #741): tag-side failures THROW `ProvisioningError` so state is NOT
|
|
32585
|
+
* written, and the next deploy retries against the still-old state.
|
|
32586
|
+
* `update()` for AWS::S3Tables::TableBucket is otherwise a no-op (the
|
|
32587
|
+
* bucket itself is immutable), so a tag-side throw cleanly turns the
|
|
32588
|
+
* whole update into a clean retry with no side-effects.
|
|
32589
|
+
*/
|
|
32590
|
+
async applyTableBucketTagsDiff(logicalId, physicalId, resourceType, previousTags, newTags) {
|
|
32591
|
+
const prev = this.cfnTagsToSdkMap(previousTags) ?? {};
|
|
32592
|
+
const next = this.cfnTagsToSdkMap(newTags) ?? {};
|
|
32593
|
+
const removedKeys = Object.keys(prev).filter((k) => !(k in next));
|
|
32594
|
+
const upserts = {};
|
|
32595
|
+
for (const [k, v] of Object.entries(next)) if (prev[k] !== v) upserts[k] = v;
|
|
32596
|
+
if (removedKeys.length === 0 && Object.keys(upserts).length === 0) return;
|
|
32597
|
+
const resourceArn = physicalId;
|
|
32598
|
+
if (removedKeys.length > 0) try {
|
|
32599
|
+
await this.getClient().send(new UntagResourceCommand$15({
|
|
32600
|
+
resourceArn,
|
|
32601
|
+
tagKeys: removedKeys
|
|
32602
|
+
}));
|
|
32603
|
+
} catch (err) {
|
|
32604
|
+
const cause = err instanceof Error ? err : void 0;
|
|
32605
|
+
throw new ProvisioningError(`applyTableBucketTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
|
|
32606
|
+
}
|
|
32607
|
+
if (Object.keys(upserts).length > 0) try {
|
|
32608
|
+
await this.getClient().send(new TagResourceCommand$16({
|
|
32609
|
+
resourceArn,
|
|
32610
|
+
tags: upserts
|
|
32611
|
+
}));
|
|
32612
|
+
} catch (err) {
|
|
32613
|
+
const cause = err instanceof Error ? err : void 0;
|
|
32614
|
+
throw new ProvisioningError(`applyTableBucketTagsDiff: TagResource failed for ${resourceArn} (keys: ${Object.keys(upserts).join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
|
|
32615
|
+
}
|
|
32616
|
+
}
|
|
32570
32617
|
};
|
|
32571
32618
|
|
|
32572
32619
|
//#endregion
|
|
@@ -51877,7 +51924,7 @@ function reorderArgs(argv) {
|
|
|
51877
51924
|
*/
|
|
51878
51925
|
async function main() {
|
|
51879
51926
|
const program = new Command();
|
|
51880
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
51927
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.202.0");
|
|
51881
51928
|
program.addCommand(createBootstrapCommand());
|
|
51882
51929
|
program.addCommand(createSynthCommand());
|
|
51883
51930
|
program.addCommand(createListCommand());
|