@go-to-k/cdkd 0.51.1 → 0.51.2

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
@@ -15839,6 +15839,7 @@ import {
15839
15839
  DeleteEventSourceMappingCommand,
15840
15840
  UpdateEventSourceMappingCommand,
15841
15841
  GetEventSourceMappingCommand,
15842
+ ListTagsCommand as ListTagsCommand2,
15842
15843
  TagResourceCommand as TagResourceCommand3,
15843
15844
  UntagResourceCommand as UntagResourceCommand3,
15844
15845
  ResourceNotFoundException as ResourceNotFoundException4
@@ -16152,21 +16153,24 @@ var LambdaEventSourceMappingProvider = class {
16152
16153
  * `LastProcessingResult`, `State`, `StateTransitionReason`,
16153
16154
  * `EventSourceMappingArn`) are filtered at the wire layer.
16154
16155
  *
16155
- * `FunctionName` is surfaced as the AWS `FunctionArn` (which is what
16156
- * `GetEventSourceMapping` returns) cdkd state typically holds this
16157
- * resolved ARN form already after intrinsic resolution. The drift
16158
- * comparator can match against both forms when state holds a name vs an
16159
- * ARN; mismatched-shape false positives are out of scope for v1.
16156
+ * `FunctionName`: AWS's `GetEventSourceMapping` always returns the
16157
+ * resolved ARN. cdkd state typically holds the same ARN after intrinsic
16158
+ * resolution, but a hand-authored state might carry the bare function
16159
+ * name. We surface the form that matches state when possible: if the
16160
+ * `properties?.FunctionName` is the bare name AND the AWS-current
16161
+ * ARN's last segment matches that name, emit the bare name; otherwise
16162
+ * emit the ARN. (The two forms address the same Lambda function — the
16163
+ * shape-mismatch was the only reason a clean run fired drift.)
16160
16164
  *
16161
- * `Tags` is omitted: cdkd `create()` reshapes CFn tag arrays into a
16162
- * tags map at create time, but `GetEventSourceMapping` does not return
16163
- * tags (`ListTags(Resource: arn)` does). Same shape-decision rationale
16164
- * as Lambda function tags drift — out of scope for v1.
16165
+ * `Tags` are surfaced via a follow-up `ListTags(Resource=<ESM ARN>)`
16166
+ * call. Always-emit `[]` so a console-side tag ADD on a previously-
16167
+ * untagged event source mapping is detectable on the v3
16168
+ * observedProperties baseline.
16165
16169
  *
16166
16170
  * Returns `undefined` when the mapping is gone
16167
16171
  * (`ResourceNotFoundException`).
16168
16172
  */
16169
- async readCurrentState(physicalId, _logicalId, _resourceType) {
16173
+ async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
16170
16174
  let resp;
16171
16175
  try {
16172
16176
  resp = await this.lambdaClient.send(new GetEventSourceMappingCommand({ UUID: physicalId }));
@@ -16176,8 +16180,15 @@ var LambdaEventSourceMappingProvider = class {
16176
16180
  throw err;
16177
16181
  }
16178
16182
  const result = {};
16179
- if (resp.FunctionArn !== void 0)
16180
- result["FunctionName"] = resp.FunctionArn;
16183
+ if (resp.FunctionArn !== void 0) {
16184
+ const stateFn = properties?.["FunctionName"];
16185
+ const arnTail = resp.FunctionArn.split(":").pop();
16186
+ if (typeof stateFn === "string" && !stateFn.includes(":") && stateFn === arnTail) {
16187
+ result["FunctionName"] = stateFn;
16188
+ } else {
16189
+ result["FunctionName"] = resp.FunctionArn;
16190
+ }
16191
+ }
16181
16192
  if (resp.EventSourceArn !== void 0)
16182
16193
  result["EventSourceArn"] = resp.EventSourceArn;
16183
16194
  if (resp.BatchSize !== void 0)
@@ -16236,6 +16247,20 @@ var LambdaEventSourceMappingProvider = class {
16236
16247
  const enabled = resp.State === "Enabled" || resp.State === "Enabling" || resp.State === "Updating";
16237
16248
  result["Enabled"] = enabled;
16238
16249
  }
16250
+ let tags = [];
16251
+ if (resp.EventSourceMappingArn) {
16252
+ try {
16253
+ const tagsResp = await this.lambdaClient.send(
16254
+ new ListTagsCommand2({ Resource: resp.EventSourceMappingArn })
16255
+ );
16256
+ const tagMap = tagsResp.Tags ?? {};
16257
+ tags = Object.entries(tagMap).filter(([k]) => !k.startsWith("aws:")).map(([Key, Value]) => ({ Key, Value })).sort((a, b) => a.Key.localeCompare(b.Key));
16258
+ } catch (err) {
16259
+ if (err instanceof ResourceNotFoundException4)
16260
+ return void 0;
16261
+ }
16262
+ }
16263
+ result["Tags"] = tags;
16239
16264
  return result;
16240
16265
  }
16241
16266
  /**
@@ -16267,7 +16292,7 @@ import {
16267
16292
  DeleteLayerVersionCommand,
16268
16293
  GetLayerVersionByArnCommand,
16269
16294
  ListLayersCommand,
16270
- ListTagsCommand as ListTagsCommand2,
16295
+ ListTagsCommand as ListTagsCommand3,
16271
16296
  ResourceNotFoundException as ResourceNotFoundException5
16272
16297
  } from "@aws-sdk/client-lambda";
16273
16298
  init_aws_clients();
@@ -16526,7 +16551,7 @@ var LambdaLayerVersionProvider = class {
16526
16551
  continue;
16527
16552
  try {
16528
16553
  const tagsResp = await this.lambdaClient.send(
16529
- new ListTagsCommand2({ Resource: layer.LayerArn })
16554
+ new ListTagsCommand3({ Resource: layer.LayerArn })
16530
16555
  );
16531
16556
  if (tagsResp.Tags?.[CDK_PATH_TAG] === input.cdkPath) {
16532
16557
  return {
@@ -17005,6 +17030,7 @@ var DynamoDBTableProvider = class {
17005
17030
  import {
17006
17031
  CreateLogGroupCommand,
17007
17032
  DeleteLogGroupCommand,
17033
+ DescribeIndexPoliciesCommand,
17008
17034
  DescribeLogGroupsCommand,
17009
17035
  GetDataProtectionPolicyCommand,
17010
17036
  ListTagsForResourceCommand as ListTagsForResourceCommand2,
@@ -17258,16 +17284,26 @@ var LogsLogGroupProvider = class {
17258
17284
  * `RetentionInDays`).
17259
17285
  *
17260
17286
  * Coverage: `LogGroupName`, `KmsKeyId`, `RetentionInDays`,
17261
- * `LogGroupClass`, `Tags`, plus `DataProtectionPolicy` (via
17287
+ * `LogGroupClass`, `Tags`, `DataProtectionPolicy` (via
17262
17288
  * `GetDataProtectionPolicy`, JSON-parsed back to the object form
17263
- * cdkd state holds). Still out of scope: `FieldIndexPolicies`
17264
- * (separate `DescribeFieldIndexPolicies` call, follow-up),
17289
+ * cdkd state holds), `DeletionProtectionEnabled` and
17290
+ * `BearerTokenAuthenticationEnabled` (both surfaced directly from
17291
+ * `DescribeLogGroups` — the SDK's LogGroup type carries them as
17292
+ * `deletionProtectionEnabled` / `bearerTokenAuthenticationEnabled`),
17293
+ * and `FieldIndexPolicies` (via `DescribeIndexPolicies`, filtered to
17294
+ * log-group-level policies and JSON-parsed). Still out of scope:
17265
17295
  * `ResourcePolicyDocument` (managed by the separate
17266
17296
  * `AWS::Logs::ResourcePolicy` resource type — account-wide, not
17267
- * per-log-group), `DeletionProtectionEnabled` (not surfaced by
17268
- * `DescribeLogGroups`; would need a yet-undocumented separate API),
17269
- * `BearerTokenAuthenticationEnabled` (specialized X-Ray / service-log
17270
- * endpoint feature, also not in `DescribeLogGroups`).
17297
+ * per-log-group).
17298
+ *
17299
+ * Known limitation: cdkd's `create()` / `update()` flows do NOT yet
17300
+ * apply `FieldIndexPolicies` / `DeletionProtectionEnabled` /
17301
+ * `BearerTokenAuthenticationEnabled` — they're in `handledProperties`
17302
+ * to prevent CC API fallback but no actual `PutIndexPolicy` /
17303
+ * `PutLogGroupDeletionProtection` / `PutBearerTokenAuthentication`
17304
+ * calls fire. Surfacing these in `readCurrentState` means a user
17305
+ * who templates them will see drift on the first run; a follow-up
17306
+ * needs to wire the create/update flow.
17271
17307
  *
17272
17308
  * Tags are read via `ListTagsForResource` (using the log-group ARN from
17273
17309
  * the same `DescribeLogGroups` response). CDK's `aws:*` auto-tags are
@@ -17291,6 +17327,8 @@ var LogsLogGroupProvider = class {
17291
17327
  result["RetentionInDays"] = found.retentionInDays ?? 0;
17292
17328
  if (found.logGroupClass !== void 0)
17293
17329
  result["LogGroupClass"] = found.logGroupClass;
17330
+ result["DeletionProtectionEnabled"] = found.deletionProtectionEnabled ?? false;
17331
+ result["BearerTokenAuthenticationEnabled"] = found.bearerTokenAuthenticationEnabled ?? false;
17294
17332
  let tags = [];
17295
17333
  if (found.arn) {
17296
17334
  const arnForTags = found.arn.replace(/:\*$/, "");
@@ -17321,6 +17359,24 @@ var LogsLogGroupProvider = class {
17321
17359
  } catch {
17322
17360
  }
17323
17361
  result["DataProtectionPolicy"] = dpp;
17362
+ let fieldIndexPolicies = [];
17363
+ try {
17364
+ const idxResp = await this.logsClient.send(
17365
+ new DescribeIndexPoliciesCommand({ logGroupIdentifiers: [physicalId] })
17366
+ );
17367
+ const logGroupLevel = (idxResp.indexPolicies ?? []).filter((p) => p.source !== "ACCOUNT");
17368
+ fieldIndexPolicies = logGroupLevel.map((p) => {
17369
+ if (!p.policyDocument)
17370
+ return void 0;
17371
+ try {
17372
+ return JSON.parse(p.policyDocument);
17373
+ } catch {
17374
+ return p.policyDocument;
17375
+ }
17376
+ }).filter((p) => p !== void 0);
17377
+ } catch {
17378
+ }
17379
+ result["FieldIndexPolicies"] = fieldIndexPolicies;
17324
17380
  return result;
17325
17381
  } catch (err) {
17326
17382
  if (err instanceof ResourceNotFoundException7)
@@ -18394,10 +18450,21 @@ var SSMParameterProvider = class {
18394
18450
  *
18395
18451
  * `Name` is set to the physical id. `Tags` is surfaced via a follow-up
18396
18452
  * `ListTagsForResource(ResourceType=Parameter)` call, with CDK's `aws:*`
18397
- * auto-tags filtered out. `Policies` is intentionally out of scope:
18398
- * `DescribeParameters.Policies` returns a structured array but cdkd state
18399
- * holds the raw JSON string the user typed — comparing the two accurately
18400
- * needs more work.
18453
+ * auto-tags filtered out.
18454
+ *
18455
+ * `Policies` is surfaced from the same `DescribeParameters` response.
18456
+ * AWS returns `Parameters[0].Policies` as
18457
+ * `[{PolicyText, PolicyType, PolicyStatus}]`; cdkd state holds a JSON
18458
+ * string of the user-templated policy array (CFn's documented shape).
18459
+ * To compare cleanly we parse each `PolicyText` (itself JSON) into
18460
+ * objects, drop the AWS-managed `PolicyStatus` (Pending / InSync /
18461
+ * Expired), and emit the parsed object array. On the v3
18462
+ * `observedProperties` baseline this matches `observedProperties` (which
18463
+ * stored our parsed output at deploy time) exactly. On the v2 fallback
18464
+ * baseline (state.properties = JSON string) the comparator reports a
18465
+ * one-time drift on first run; users resolve via
18466
+ * `cdkd state refresh-observed`. Always-emit `[]` placeholder for
18467
+ * console-side ADD detection.
18401
18468
  *
18402
18469
  * **Note**: For `SecureString` parameters, AWS returns the encrypted
18403
18470
  * blob in `Value` (we pass `WithDecryption: false`). cdkd state usually
@@ -18429,6 +18496,7 @@ var SSMParameterProvider = class {
18429
18496
  result["Value"] = param.Value;
18430
18497
  if (param.DataType !== void 0)
18431
18498
  result["DataType"] = param.DataType;
18499
+ let policiesEmitted = false;
18432
18500
  try {
18433
18501
  const desc = await this.ssmClient.send(
18434
18502
  new DescribeParametersCommand({
@@ -18441,8 +18509,22 @@ var SSMParameterProvider = class {
18441
18509
  if (meta?.Tier !== void 0) {
18442
18510
  result["Tier"] = meta.Tier;
18443
18511
  }
18512
+ const parsedPolicies = [];
18513
+ for (const p of meta?.Policies ?? []) {
18514
+ if (!p.PolicyText)
18515
+ continue;
18516
+ try {
18517
+ parsedPolicies.push(JSON.parse(p.PolicyText));
18518
+ } catch {
18519
+ parsedPolicies.push(p.PolicyText);
18520
+ }
18521
+ }
18522
+ result["Policies"] = parsedPolicies;
18523
+ policiesEmitted = true;
18444
18524
  } catch {
18445
18525
  }
18526
+ if (!policiesEmitted)
18527
+ result["Policies"] = [];
18446
18528
  try {
18447
18529
  const tagsResp = await this.ssmClient.send(
18448
18530
  new ListTagsForResourceCommand4({
@@ -24930,10 +25012,13 @@ var AgentCoreRuntimeProvider = class {
24930
25012
  *
24931
25013
  * `ProtocolConfiguration` parity: `create()` accepts a CFn-style string
24932
25014
  * (`"HTTP"`) and converts it to `{serverProtocol: "HTTP"}` for the SDK.
24933
- * The SDK returns the object form. We surface the object form here; if
24934
- * cdkd state holds the original string the comparator will report drift
24935
- * — users can inspect and dismiss this case manually. (A more elaborate
24936
- * shape negotiation belongs in a follow-up that knows about both forms.)
25015
+ * The SDK returns the object form. We surface the **string form** here
25016
+ * (extract `serverProtocol` from the SDK object) since CFn's
25017
+ * `AWS::BedrockAgentCore::Runtime.ProtocolConfiguration` is documented
25018
+ * as a string and that's what cdkd state typically holds after CDK
25019
+ * synth. If state happens to carry the object form (legacy / hand-
25020
+ * authored), the comparator will report a one-time drift the user can
25021
+ * resolve via `cdkd state refresh-observed`.
24937
25022
  *
24938
25023
  * `ClientToken` is omitted: AWS does not surface it back via
24939
25024
  * `GetAgentRuntime` (it's an idempotency token only meaningful at create
@@ -24968,7 +25053,13 @@ var AgentCoreRuntimeProvider = class {
24968
25053
  result["AuthorizerConfiguration"] = camelToPascalCaseKeys(resp.authorizerConfiguration);
24969
25054
  }
24970
25055
  if (resp.protocolConfiguration !== void 0) {
24971
- result["ProtocolConfiguration"] = camelToPascalCaseKeys(resp.protocolConfiguration);
25056
+ const proto = resp.protocolConfiguration;
25057
+ const keys = Object.keys(proto);
25058
+ if (keys.length === 1 && keys[0] === "serverProtocol" && typeof proto["serverProtocol"] === "string") {
25059
+ result["ProtocolConfiguration"] = proto["serverProtocol"];
25060
+ } else {
25061
+ result["ProtocolConfiguration"] = camelToPascalCaseKeys(resp.protocolConfiguration);
25062
+ }
24972
25063
  }
24973
25064
  if (resp.lifecycleConfiguration !== void 0) {
24974
25065
  result["LifecycleConfiguration"] = camelToPascalCaseKeys(resp.lifecycleConfiguration);
@@ -35270,7 +35361,7 @@ import {
35270
35361
  GetEventSelectorsCommand,
35271
35362
  GetInsightSelectorsCommand,
35272
35363
  ListTrailsCommand,
35273
- ListTagsCommand as ListTagsCommand3,
35364
+ ListTagsCommand as ListTagsCommand4,
35274
35365
  AddTagsCommand as AddTagsCommand2,
35275
35366
  RemoveTagsCommand as RemoveTagsCommand2,
35276
35367
  TrailNotFoundException
@@ -35647,7 +35738,7 @@ var CloudTrailProvider = class {
35647
35738
  if (trail.TrailARN) {
35648
35739
  try {
35649
35740
  const tagsResp = await this.getClient().send(
35650
- new ListTagsCommand3({ ResourceIdList: [trail.TrailARN] })
35741
+ new ListTagsCommand4({ ResourceIdList: [trail.TrailARN] })
35651
35742
  );
35652
35743
  tags = normalizeAwsTagsToCfn(tagsResp.ResourceTagList?.[0]?.TagsList);
35653
35744
  } catch (err) {
@@ -35683,7 +35774,7 @@ var CloudTrailProvider = class {
35683
35774
  continue;
35684
35775
  try {
35685
35776
  const tagsResp = await this.getClient().send(
35686
- new ListTagsCommand3({ ResourceIdList: [trail.TrailARN] })
35777
+ new ListTagsCommand4({ ResourceIdList: [trail.TrailARN] })
35687
35778
  );
35688
35779
  const list2 = tagsResp.ResourceTagList?.[0];
35689
35780
  if (matchesCdkPath(list2?.TagsList, input.cdkPath)) {
@@ -36160,6 +36251,98 @@ var CodeBuildProvider = class {
36160
36251
  cache2["Modes"] = project.cache.modes;
36161
36252
  result["Cache"] = cache2;
36162
36253
  }
36254
+ result["SecondarySources"] = (project.secondarySources ?? []).map((s) => {
36255
+ const out = {};
36256
+ if (s.type !== void 0)
36257
+ out["Type"] = s.type;
36258
+ if (s.location !== void 0)
36259
+ out["Location"] = s.location;
36260
+ if (s.buildspec !== void 0)
36261
+ out["BuildSpec"] = s.buildspec;
36262
+ if (s.gitCloneDepth !== void 0)
36263
+ out["GitCloneDepth"] = s.gitCloneDepth;
36264
+ if (s.insecureSsl !== void 0)
36265
+ out["InsecureSsl"] = s.insecureSsl;
36266
+ if (s.reportBuildStatus !== void 0)
36267
+ out["ReportBuildStatus"] = s.reportBuildStatus;
36268
+ if (s.sourceIdentifier !== void 0)
36269
+ out["SourceIdentifier"] = s.sourceIdentifier;
36270
+ return out;
36271
+ });
36272
+ result["SecondaryArtifacts"] = (project.secondaryArtifacts ?? []).map((a) => {
36273
+ const out = {};
36274
+ if (a.type !== void 0)
36275
+ out["Type"] = a.type;
36276
+ if (a.location !== void 0)
36277
+ out["Location"] = a.location;
36278
+ if (a.path !== void 0)
36279
+ out["Path"] = a.path;
36280
+ if (a.name !== void 0)
36281
+ out["Name"] = a.name;
36282
+ if (a.namespaceType !== void 0)
36283
+ out["NamespaceType"] = a.namespaceType;
36284
+ if (a.packaging !== void 0)
36285
+ out["Packaging"] = a.packaging;
36286
+ if (a.encryptionDisabled !== void 0)
36287
+ out["EncryptionDisabled"] = a.encryptionDisabled;
36288
+ if (a.overrideArtifactName !== void 0) {
36289
+ out["OverrideArtifactName"] = a.overrideArtifactName;
36290
+ }
36291
+ if (a.artifactIdentifier !== void 0)
36292
+ out["ArtifactIdentifier"] = a.artifactIdentifier;
36293
+ return out;
36294
+ });
36295
+ result["SecondarySourceVersions"] = (project.secondarySourceVersions ?? []).map((v) => {
36296
+ const out = {};
36297
+ if (v.sourceIdentifier !== void 0)
36298
+ out["SourceIdentifier"] = v.sourceIdentifier;
36299
+ if (v.sourceVersion !== void 0)
36300
+ out["SourceVersion"] = v.sourceVersion;
36301
+ return out;
36302
+ });
36303
+ result["FileSystemLocations"] = (project.fileSystemLocations ?? []).map((f) => {
36304
+ const out = {};
36305
+ if (f.type !== void 0)
36306
+ out["Type"] = f.type;
36307
+ if (f.location !== void 0)
36308
+ out["Location"] = f.location;
36309
+ if (f.mountPoint !== void 0)
36310
+ out["MountPoint"] = f.mountPoint;
36311
+ if (f.identifier !== void 0)
36312
+ out["Identifier"] = f.identifier;
36313
+ if (f.mountOptions !== void 0)
36314
+ out["MountOptions"] = f.mountOptions;
36315
+ return out;
36316
+ });
36317
+ if (project.buildBatchConfig) {
36318
+ const bbc = {};
36319
+ if (project.buildBatchConfig.serviceRole !== void 0) {
36320
+ bbc["ServiceRole"] = project.buildBatchConfig.serviceRole;
36321
+ }
36322
+ if (project.buildBatchConfig.restrictions !== void 0) {
36323
+ const r = {};
36324
+ if (project.buildBatchConfig.restrictions.maximumBuildsAllowed !== void 0) {
36325
+ r["MaximumBuildsAllowed"] = project.buildBatchConfig.restrictions.maximumBuildsAllowed;
36326
+ }
36327
+ if (project.buildBatchConfig.restrictions.computeTypesAllowed !== void 0) {
36328
+ r["ComputeTypesAllowed"] = project.buildBatchConfig.restrictions.computeTypesAllowed;
36329
+ }
36330
+ bbc["Restrictions"] = r;
36331
+ }
36332
+ if (project.buildBatchConfig.timeoutInMins !== void 0) {
36333
+ bbc["TimeoutInMins"] = project.buildBatchConfig.timeoutInMins;
36334
+ }
36335
+ if (project.buildBatchConfig.batchReportMode !== void 0) {
36336
+ bbc["BatchReportMode"] = project.buildBatchConfig.batchReportMode;
36337
+ }
36338
+ if (project.buildBatchConfig.combineArtifacts !== void 0) {
36339
+ bbc["CombineArtifacts"] = project.buildBatchConfig.combineArtifacts;
36340
+ }
36341
+ result["BuildBatchConfig"] = bbc;
36342
+ } else {
36343
+ result["BuildBatchConfig"] = {};
36344
+ }
36345
+ result["ResourceAccessRole"] = project.resourceAccessRole ?? "";
36163
36346
  const tags = normalizeAwsTagsToCfn(project.tags);
36164
36347
  result["Tags"] = tags;
36165
36348
  return result;
@@ -44299,7 +44482,7 @@ function reorderArgs(argv) {
44299
44482
  }
44300
44483
  async function main() {
44301
44484
  const program = new Command14();
44302
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.51.1");
44485
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.51.2");
44303
44486
  program.addCommand(createBootstrapCommand());
44304
44487
  program.addCommand(createSynthCommand());
44305
44488
  program.addCommand(createListCommand());