@go-to-k/cdkd 0.224.0 → 0.226.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as withErrorHandling, B as generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-DZGYMsjN.js";
4
+ import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-DM557Qjg.js";
5
5
  import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
@@ -50,7 +50,7 @@ import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBCluster
50
50
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$4, CreateDBClusterCommand as CreateDBClusterCommand$2, CreateDBInstanceCommand as CreateDBInstanceCommand$2, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$2, DeleteDBClusterCommand as DeleteDBClusterCommand$2, DeleteDBInstanceCommand as DeleteDBInstanceCommand$2, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$2, DescribeDBClustersCommand as DescribeDBClustersCommand$2, DescribeDBInstancesCommand as DescribeDBInstancesCommand$2, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$2, ListTagsForResourceCommand as ListTagsForResourceCommand$13, ModifyDBClusterCommand as ModifyDBClusterCommand$2, ModifyDBInstanceCommand as ModifyDBInstanceCommand$2, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$2, NeptuneClient, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$4 } from "@aws-sdk/client-neptune";
51
51
  import { CreateWebACLCommand, DeleteWebACLCommand, GetWebACLCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListWebACLsCommand, TagResourceCommand as TagResourceCommand$13, UntagResourceCommand as UntagResourceCommand$12, UpdateWebACLCommand, WAFNonexistentItemException, WAFV2Client } from "@aws-sdk/client-wafv2";
52
52
  import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
53
- import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
53
+ import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceAttributesCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceAttributesCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceAttributesCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
54
54
  import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$13, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
55
55
  import { parse, print } from "graphql";
56
56
  import { CrawlerRunningException, CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetDatabasesCommand, GetJobCommand, GetSecurityConfigurationCommand, GetSecurityConfigurationsCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, ListWorkflowsCommand, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
@@ -1553,7 +1553,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1553
1553
  const FLUSH_EVENT_THRESHOLD = 50;
1554
1554
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1555
1555
  function getCdkdVersion() {
1556
- return "0.224.0";
1556
+ return "0.226.0";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -17323,6 +17323,7 @@ var ApiGatewayV2Provider = class {
17323
17323
  "IdentitySource",
17324
17324
  "JwtConfiguration",
17325
17325
  "AuthorizerUri",
17326
+ "AuthorizerCredentialsArn",
17326
17327
  "AuthorizerPayloadFormatVersion",
17327
17328
  "AuthorizerResultTtlInSeconds",
17328
17329
  "EnableSimpleResponses",
@@ -17618,6 +17619,7 @@ var ApiGatewayV2Provider = class {
17618
17619
  IdentitySource: properties["IdentitySource"] ? typeof properties["IdentitySource"] === "string" ? [properties["IdentitySource"]] : properties["IdentitySource"] : void 0,
17619
17620
  JwtConfiguration: properties["JwtConfiguration"],
17620
17621
  AuthorizerUri: properties["AuthorizerUri"],
17622
+ AuthorizerCredentialsArn: properties["AuthorizerCredentialsArn"],
17621
17623
  AuthorizerPayloadFormatVersion: properties["AuthorizerPayloadFormatVersion"],
17622
17624
  AuthorizerResultTtlInSeconds: properties["AuthorizerResultTtlInSeconds"],
17623
17625
  EnableSimpleResponses: properties["EnableSimpleResponses"],
@@ -17775,6 +17777,7 @@ var ApiGatewayV2Provider = class {
17775
17777
  else if (resp.AuthorizerType === "REQUEST") {
17776
17778
  result["AuthorizerUri"] = resp.AuthorizerUri ?? "";
17777
17779
  result["AuthorizerPayloadFormatVersion"] = resp.AuthorizerPayloadFormatVersion ?? "";
17780
+ if (resp.AuthorizerCredentialsArn !== void 0) result["AuthorizerCredentialsArn"] = resp.AuthorizerCredentialsArn;
17778
17781
  if (resp.AuthorizerResultTtlInSeconds !== void 0) result["AuthorizerResultTtlInSeconds"] = resp.AuthorizerResultTtlInSeconds;
17779
17782
  if (resp.EnableSimpleResponses !== void 0) result["EnableSimpleResponses"] = resp.EnableSimpleResponses;
17780
17783
  if (resp.IdentityValidationExpression !== void 0) result["IdentityValidationExpression"] = resp.IdentityValidationExpression;
@@ -18071,7 +18074,7 @@ var ApiGatewayV2Provider = class {
18071
18074
  /**
18072
18075
  * `UpdateAuthorizer` keys on `(ApiId, AuthorizerId)`. Mutable fields
18073
18076
  * cdkd manages: `AuthorizerType` / `Name` / `IdentitySource` /
18074
- * `JwtConfiguration` / `AuthorizerUri` /
18077
+ * `JwtConfiguration` / `AuthorizerUri` / `AuthorizerCredentialsArn` /
18075
18078
  * `AuthorizerPayloadFormatVersion` / `AuthorizerResultTtlInSeconds` /
18076
18079
  * `EnableSimpleResponses`.
18077
18080
  */
@@ -18108,6 +18111,10 @@ var ApiGatewayV2Provider = class {
18108
18111
  input.AuthorizerUri = properties["AuthorizerUri"];
18109
18112
  changed = true;
18110
18113
  }
18114
+ if (properties["AuthorizerCredentialsArn"] !== void 0 && properties["AuthorizerCredentialsArn"] !== previousProperties["AuthorizerCredentialsArn"]) {
18115
+ input.AuthorizerCredentialsArn = properties["AuthorizerCredentialsArn"];
18116
+ changed = true;
18117
+ }
18111
18118
  if (properties["AuthorizerPayloadFormatVersion"] !== void 0 && properties["AuthorizerPayloadFormatVersion"] !== previousProperties["AuthorizerPayloadFormatVersion"]) {
18112
18119
  input.AuthorizerPayloadFormatVersion = properties["AuthorizerPayloadFormatVersion"];
18113
18120
  changed = true;
@@ -26693,7 +26700,8 @@ var ServiceDiscoveryProvider = class {
26693
26700
  "Description",
26694
26701
  "HealthCheckConfig",
26695
26702
  "Tags",
26696
- "Type"
26703
+ "Type",
26704
+ "ServiceAttributes"
26697
26705
  ])]]);
26698
26706
  getClient() {
26699
26707
  if (!this.client) this.client = new ServiceDiscoveryClient(this.providerRegion ? { region: this.providerRegion } : {});
@@ -26846,11 +26854,30 @@ var ServiceDiscoveryProvider = class {
26846
26854
  ...type && { Type: type }
26847
26855
  }))).Service;
26848
26856
  if (!service || !service.Id) throw new Error("CreateService did not return Service ID");
26849
- this.logger.debug(`Successfully created service discovery service ${logicalId}: ${service.Id}`);
26857
+ const serviceId = service.Id;
26858
+ this.logger.debug(`Successfully created service discovery service ${logicalId}: ${serviceId}`);
26859
+ try {
26860
+ const attrs = this.normalizeServiceAttributes(properties["ServiceAttributes"]);
26861
+ if (Object.keys(attrs).length > 0) {
26862
+ await withRetry(() => client.send(new UpdateServiceAttributesCommand({
26863
+ ServiceId: serviceId,
26864
+ Attributes: attrs
26865
+ })), logicalId, { logger: this.logger });
26866
+ this.logger.debug(`Applied ${Object.keys(attrs).length} ServiceAttribute(s) for ${logicalId}`);
26867
+ }
26868
+ } catch (innerError) {
26869
+ try {
26870
+ await client.send(new DeleteServiceCommand$1({ Id: serviceId }));
26871
+ this.logger.debug(`Cleaned up partially-created ServiceDiscovery Service ${logicalId} (${serviceId}) after ServiceAttributes wiring failure`);
26872
+ } catch (cleanupError) {
26873
+ this.logger.warn(`Failed to clean up partially-created ServiceDiscovery Service ${logicalId} (${serviceId}) after ServiceAttributes wiring failure: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws servicediscovery delete-service --id ${serviceId}`);
26874
+ }
26875
+ throw innerError;
26876
+ }
26850
26877
  return {
26851
- physicalId: service.Id,
26878
+ physicalId: serviceId,
26852
26879
  attributes: {
26853
- Id: service.Id,
26880
+ Id: serviceId,
26854
26881
  Arn: service.Arn || "",
26855
26882
  Name: service.Name || name || ""
26856
26883
  }
@@ -26877,7 +26904,7 @@ var ServiceDiscoveryProvider = class {
26877
26904
  * full AWS-current snapshot as `properties`, so the round-trip is
26878
26905
  * value-preserving.
26879
26906
  */
26880
- async updateService(logicalId, physicalId, resourceType, properties, _previousProperties) {
26907
+ async updateService(logicalId, physicalId, resourceType, properties, previousProperties) {
26881
26908
  this.logger.debug(`Updating service discovery service ${logicalId}: ${physicalId}`);
26882
26909
  const client = this.getClient();
26883
26910
  const serviceChange = {};
@@ -26885,7 +26912,15 @@ var ServiceDiscoveryProvider = class {
26885
26912
  const dnsConfig = properties["DnsConfig"];
26886
26913
  if (dnsConfig?.DnsRecords !== void 0) serviceChange.DnsConfig = { DnsRecords: dnsConfig.DnsRecords };
26887
26914
  if (properties["HealthCheckConfig"] !== void 0) serviceChange.HealthCheckConfig = properties["HealthCheckConfig"];
26888
- if (Object.keys(serviceChange).length === 0) {
26915
+ const newAttrs = this.normalizeServiceAttributes(properties["ServiceAttributes"]);
26916
+ const oldAttrs = this.normalizeServiceAttributes(previousProperties["ServiceAttributes"]);
26917
+ const upsertAttrs = {};
26918
+ for (const [k, v] of Object.entries(newAttrs)) if (oldAttrs[k] !== v) upsertAttrs[k] = v;
26919
+ const removedAttrKeys = Object.keys(oldAttrs).filter((k) => !(k in newAttrs));
26920
+ const hasServiceChange = Object.keys(serviceChange).length > 0;
26921
+ const hasAttrUpsert = Object.keys(upsertAttrs).length > 0;
26922
+ const hasAttrRemove = removedAttrKeys.length > 0;
26923
+ if (!hasServiceChange && !hasAttrUpsert && !hasAttrRemove) {
26889
26924
  this.logger.debug(`No mutable diff for ServiceDiscovery Service ${logicalId}, skipping update`);
26890
26925
  return {
26891
26926
  physicalId,
@@ -26893,11 +26928,27 @@ var ServiceDiscoveryProvider = class {
26893
26928
  };
26894
26929
  }
26895
26930
  try {
26896
- const operationId = (await client.send(new UpdateServiceCommand$1({
26897
- Id: physicalId,
26898
- Service: serviceChange
26899
- }))).OperationId;
26900
- if (operationId) await this.pollOperation(operationId, logicalId, resourceType);
26931
+ if (hasServiceChange) {
26932
+ const operationId = (await client.send(new UpdateServiceCommand$1({
26933
+ Id: physicalId,
26934
+ Service: serviceChange
26935
+ }))).OperationId;
26936
+ if (operationId) await this.pollOperation(operationId, logicalId, resourceType);
26937
+ }
26938
+ if (hasAttrUpsert) {
26939
+ await withRetry(() => client.send(new UpdateServiceAttributesCommand({
26940
+ ServiceId: physicalId,
26941
+ Attributes: upsertAttrs
26942
+ })), logicalId, { logger: this.logger });
26943
+ this.logger.debug(`Applied ${Object.keys(upsertAttrs).length} ServiceAttribute change(s) for ${logicalId}`);
26944
+ }
26945
+ if (hasAttrRemove) {
26946
+ await withRetry(() => client.send(new DeleteServiceAttributesCommand({
26947
+ ServiceId: physicalId,
26948
+ Attributes: removedAttrKeys
26949
+ })), logicalId, { logger: this.logger });
26950
+ this.logger.debug(`Removed ${removedAttrKeys.length} ServiceAttribute(s) for ${logicalId}`);
26951
+ }
26901
26952
  this.logger.debug(`Successfully updated service discovery service ${logicalId}`);
26902
26953
  return {
26903
26954
  physicalId,
@@ -27037,9 +27088,31 @@ var ServiceDiscoveryProvider = class {
27037
27088
  if (svc.DnsConfig) result["DnsConfig"] = svc.DnsConfig;
27038
27089
  if (svc.HealthCheckConfig) result["HealthCheckConfig"] = svc.HealthCheckConfig;
27039
27090
  if (svc.HealthCheckCustomConfig) result["HealthCheckCustomConfig"] = svc.HealthCheckCustomConfig;
27091
+ try {
27092
+ result["ServiceAttributes"] = (await this.getClient().send(new GetServiceAttributesCommand({ ServiceId: physicalId }))).ServiceAttributes?.Attributes ?? {};
27093
+ } catch (err) {
27094
+ this.logger.debug(`ServiceDiscovery GetServiceAttributes(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
27095
+ }
27040
27096
  if (svc.Arn) await this.attachTags(result, svc.Arn);
27041
27097
  return result;
27042
27098
  }
27099
+ /**
27100
+ * Normalize a CFn `ServiceAttributes` value (a bare key→value JSON map) into
27101
+ * the SDK's `Attributes` shape (`Record<string,string>`). Only string /
27102
+ * number / boolean values are coerced via `String()`; a non-scalar value is
27103
+ * malformed input and is dropped rather than stringified to `[object
27104
+ * Object]`. A non-object input (absent / null / array) yields `{}` so callers
27105
+ * can branch on `Object.keys(...).length`.
27106
+ */
27107
+ normalizeServiceAttributes(raw) {
27108
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return {};
27109
+ const out = {};
27110
+ for (const [k, v] of Object.entries(raw)) {
27111
+ if (v === void 0 || v === null) continue;
27112
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") out[k] = String(v);
27113
+ }
27114
+ return out;
27115
+ }
27043
27116
  /** Best-effort tag fetch via `ListTagsForResource(ResourceARN)`. */
27044
27117
  async attachTags(result, arn) {
27045
27118
  try {
@@ -54608,7 +54681,7 @@ function reorderArgs(argv) {
54608
54681
  async function main() {
54609
54682
  installPipeCloseHandler();
54610
54683
  const program = new Command();
54611
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.224.0");
54684
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.226.0");
54612
54685
  program.addCommand(createBootstrapCommand());
54613
54686
  program.addCommand(createSynthCommand());
54614
54687
  program.addCommand(createListCommand());