@go-to-k/cdkd 0.225.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-D0CE-sUC.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.225.0";
1556
+ return "0.226.0";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -26700,7 +26700,8 @@ var ServiceDiscoveryProvider = class {
26700
26700
  "Description",
26701
26701
  "HealthCheckConfig",
26702
26702
  "Tags",
26703
- "Type"
26703
+ "Type",
26704
+ "ServiceAttributes"
26704
26705
  ])]]);
26705
26706
  getClient() {
26706
26707
  if (!this.client) this.client = new ServiceDiscoveryClient(this.providerRegion ? { region: this.providerRegion } : {});
@@ -26853,11 +26854,30 @@ var ServiceDiscoveryProvider = class {
26853
26854
  ...type && { Type: type }
26854
26855
  }))).Service;
26855
26856
  if (!service || !service.Id) throw new Error("CreateService did not return Service ID");
26856
- 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
+ }
26857
26877
  return {
26858
- physicalId: service.Id,
26878
+ physicalId: serviceId,
26859
26879
  attributes: {
26860
- Id: service.Id,
26880
+ Id: serviceId,
26861
26881
  Arn: service.Arn || "",
26862
26882
  Name: service.Name || name || ""
26863
26883
  }
@@ -26884,7 +26904,7 @@ var ServiceDiscoveryProvider = class {
26884
26904
  * full AWS-current snapshot as `properties`, so the round-trip is
26885
26905
  * value-preserving.
26886
26906
  */
26887
- async updateService(logicalId, physicalId, resourceType, properties, _previousProperties) {
26907
+ async updateService(logicalId, physicalId, resourceType, properties, previousProperties) {
26888
26908
  this.logger.debug(`Updating service discovery service ${logicalId}: ${physicalId}`);
26889
26909
  const client = this.getClient();
26890
26910
  const serviceChange = {};
@@ -26892,7 +26912,15 @@ var ServiceDiscoveryProvider = class {
26892
26912
  const dnsConfig = properties["DnsConfig"];
26893
26913
  if (dnsConfig?.DnsRecords !== void 0) serviceChange.DnsConfig = { DnsRecords: dnsConfig.DnsRecords };
26894
26914
  if (properties["HealthCheckConfig"] !== void 0) serviceChange.HealthCheckConfig = properties["HealthCheckConfig"];
26895
- 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) {
26896
26924
  this.logger.debug(`No mutable diff for ServiceDiscovery Service ${logicalId}, skipping update`);
26897
26925
  return {
26898
26926
  physicalId,
@@ -26900,11 +26928,27 @@ var ServiceDiscoveryProvider = class {
26900
26928
  };
26901
26929
  }
26902
26930
  try {
26903
- const operationId = (await client.send(new UpdateServiceCommand$1({
26904
- Id: physicalId,
26905
- Service: serviceChange
26906
- }))).OperationId;
26907
- 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
+ }
26908
26952
  this.logger.debug(`Successfully updated service discovery service ${logicalId}`);
26909
26953
  return {
26910
26954
  physicalId,
@@ -27044,9 +27088,31 @@ var ServiceDiscoveryProvider = class {
27044
27088
  if (svc.DnsConfig) result["DnsConfig"] = svc.DnsConfig;
27045
27089
  if (svc.HealthCheckConfig) result["HealthCheckConfig"] = svc.HealthCheckConfig;
27046
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
+ }
27047
27096
  if (svc.Arn) await this.attachTags(result, svc.Arn);
27048
27097
  return result;
27049
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
+ }
27050
27116
  /** Best-effort tag fetch via `ListTagsForResource(ResourceARN)`. */
27051
27117
  async attachTags(result, arn) {
27052
27118
  try {
@@ -54615,7 +54681,7 @@ function reorderArgs(argv) {
54615
54681
  async function main() {
54616
54682
  installPipeCloseHandler();
54617
54683
  const program = new Command();
54618
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.225.0");
54684
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.226.0");
54619
54685
  program.addCommand(createBootstrapCommand());
54620
54686
  program.addCommand(createSynthCommand());
54621
54687
  program.addCommand(createListCommand());