cdk-real-drift 0.12.30 → 0.12.32

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
@@ -2451,7 +2451,9 @@ const KNOWN_DEFAULTS = {
2451
2451
  "AWS::AutoScaling::ScheduledAction": { EndTime: "null" },
2452
2452
  "AWS::DocDB::DBCluster": {
2453
2453
  Port: 27017,
2454
- BackupRetentionPeriod: 1
2454
+ BackupRetentionPeriod: 1,
2455
+ StorageType: "standard",
2456
+ NetworkType: "IPV4"
2455
2457
  },
2456
2458
  "AWS::DocDB::DBInstance": { CACertificateIdentifier: "rds-ca-rsa2048-g1" },
2457
2459
  "AWS::EC2::VolumeAttachment": { EbsCardIndex: 0 },
@@ -5591,7 +5593,7 @@ function matchesKnownDefault(live, def) {
5591
5593
  if (!isNestedObject(live) || !isNestedObject(def)) return false;
5592
5594
  return Object.entries(live).every(([k, v]) => k in def ? matchesKnownDefault(v, def[k]) : isTrivialEmpty(v));
5593
5595
  }
5594
- function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayIdentity) {
5596
+ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayIdentity, declaredAbsent = false) {
5595
5597
  if (Array.isArray(declaredVal) && Array.isArray(liveVal)) {
5596
5598
  if (declaredVal.length === 0 || liveVal.length === 0) return;
5597
5599
  const regId = nestedArrayIdentity?.[path.replace(/\[[^\]]*\]/g, "")];
@@ -5635,7 +5637,7 @@ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayId
5635
5637
  }
5636
5638
  if (!isNestedObject(declaredVal) || !isNestedObject(liveVal)) return;
5637
5639
  if (Object.keys(liveVal).some((k) => PATH_UNSAFE_KEY.test(k))) {
5638
- if (Object.keys(declaredVal).length === 0) emit(path, liveVal);
5640
+ if (declaredAbsent) emit(path, liveVal);
5639
5641
  return;
5640
5642
  }
5641
5643
  for (const [k, val] of Object.entries(liveVal)) {
@@ -6685,7 +6687,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6685
6687
  }) ?? false);
6686
6688
  if (!offStateIsMeaningful && (isTrivialEmpty(v) || isSelfEchoTrivialEmpty(v, physicalId) || isEmptyPolicyShell(v))) continue;
6687
6689
  if (isNestedObject(v) && DESCEND_UNDECLARED_OBJECT_PATHS[resourceType]?.has(k)) {
6688
- collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
6690
+ collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType], true);
6689
6691
  continue;
6690
6692
  }
6691
6693
  const subsetSpecU = IDENTITY_KEYED_SUBSET_ARRAYS[resourceType]?.[k];
@@ -6789,6 +6791,8 @@ function unqualifiedFunctionRef(ref) {
6789
6791
  if (seg.length >= 8 && seg[5] === "function") return seg.slice(0, 7).join(":");
6790
6792
  return ref;
6791
6793
  }
6794
+ const partial = ref.match(/^\d{12}:function:([^:]+)/);
6795
+ if (partial) return partial[1];
6792
6796
  const i = ref.indexOf(":");
6793
6797
  return i === -1 ? ref : ref.slice(0, i);
6794
6798
  }
@@ -7509,7 +7513,7 @@ async function enumerateLambdaFunctionChildren(ctx) {
7509
7513
  for (const r of desired.resources) {
7510
7514
  if (r.resourceType !== "AWS::Lambda::Url") continue;
7511
7515
  const target = r.declared.TargetFunctionArn;
7512
- if (parentRefMatches(target, functionName, fnArn)) {
7516
+ if (lambdaFunctionRefMatches(target, functionName, fnArn)) {
7513
7517
  if (fnArn !== void 0) declaredUrlArns.push(fnArn);
7514
7518
  if (r.physicalId) declaredUrlArns.push(r.physicalId);
7515
7519
  } else if (r.physicalId) declaredUrlArns.push(r.physicalId);
@@ -7517,7 +7521,7 @@ async function enumerateLambdaFunctionChildren(ctx) {
7517
7521
  const declaredAliasArns = [];
7518
7522
  for (const r of desired.resources) {
7519
7523
  if (r.resourceType !== "AWS::Lambda::Alias" || !r.physicalId) continue;
7520
- if (parentRefMatches(r.declared.FunctionName, functionName, fnArn)) declaredAliasArns.push(r.physicalId);
7524
+ if (lambdaFunctionRefMatches(r.declared.FunctionName, functionName, fnArn)) declaredAliasArns.push(r.physicalId);
7521
7525
  }
7522
7526
  const declaredVersionArns = [];
7523
7527
  for (const r of desired.resources) {
@@ -10030,6 +10034,54 @@ const readSchedulerSchedule = async ({ physicalId, declared, region }) => {
10030
10034
  ...s.Target !== void 0 && { Target: s.Target }
10031
10035
  };
10032
10036
  };
10037
+ const projectCodeBuildSource = (src) => ({
10038
+ ...src.type !== void 0 && { Type: src.type },
10039
+ ...src.location !== void 0 && { Location: src.location },
10040
+ ...src.buildspec !== void 0 && { BuildSpec: src.buildspec },
10041
+ ...src.gitCloneDepth !== void 0 && { GitCloneDepth: src.gitCloneDepth },
10042
+ ...src.insecureSsl !== void 0 && { InsecureSsl: src.insecureSsl },
10043
+ ...src.reportBuildStatus !== void 0 && { ReportBuildStatus: src.reportBuildStatus },
10044
+ ...src.sourceIdentifier !== void 0 && { SourceIdentifier: src.sourceIdentifier }
10045
+ });
10046
+ const projectCodeBuildArtifacts = (art) => ({
10047
+ ...art.type !== void 0 && { Type: art.type },
10048
+ ...art.location !== void 0 && { Location: art.location },
10049
+ ...art.name !== void 0 && { Name: art.name },
10050
+ ...art.namespaceType !== void 0 && { NamespaceType: art.namespaceType },
10051
+ ...art.packaging !== void 0 && { Packaging: art.packaging },
10052
+ ...art.path !== void 0 && { Path: art.path },
10053
+ ...art.artifactIdentifier !== void 0 && { ArtifactIdentifier: art.artifactIdentifier },
10054
+ ...art.overrideArtifactName !== void 0 && { OverrideArtifactName: art.overrideArtifactName },
10055
+ ...art.encryptionDisabled !== void 0 && { EncryptionDisabled: art.encryptionDisabled }
10056
+ });
10057
+ const projectCodeBuildTriggers = (w) => ({
10058
+ Webhook: true,
10059
+ ...w.buildType !== void 0 && { BuildType: w.buildType },
10060
+ ...Array.isArray(w.filterGroups) && { FilterGroups: w.filterGroups.map((group) => (group ?? []).map((f) => ({
10061
+ ...f.type !== void 0 && { Type: f.type },
10062
+ ...f.pattern !== void 0 && { Pattern: f.pattern },
10063
+ ...f.excludeMatchedPattern !== void 0 && { ExcludeMatchedPattern: f.excludeMatchedPattern }
10064
+ }))) },
10065
+ ...w.scopeConfiguration && { ScopeConfiguration: {
10066
+ ...w.scopeConfiguration.name !== void 0 && { Name: w.scopeConfiguration.name },
10067
+ ...w.scopeConfiguration.domain !== void 0 && { Domain: w.scopeConfiguration.domain },
10068
+ ...w.scopeConfiguration.scope !== void 0 && { Scope: w.scopeConfiguration.scope }
10069
+ } }
10070
+ });
10071
+ const projectCodeBuildBatchConfig = (b) => ({
10072
+ ...b.serviceRole !== void 0 && { ServiceRole: b.serviceRole },
10073
+ ...b.combineArtifacts !== void 0 && { CombineArtifacts: b.combineArtifacts },
10074
+ ...b.timeoutInMins !== void 0 && { TimeoutInMins: b.timeoutInMins },
10075
+ ...b.batchReportMode !== void 0 && { BatchReportMode: b.batchReportMode },
10076
+ ...b.restrictions && { Restrictions: {
10077
+ ...b.restrictions.maximumBuildsAllowed !== void 0 && { MaximumBuildsAllowed: b.restrictions.maximumBuildsAllowed },
10078
+ ...b.restrictions.computeTypesAllowed !== void 0 && { ComputeTypesAllowed: b.restrictions.computeTypesAllowed }
10079
+ } }
10080
+ });
10081
+ const projectCodeBuildSourceVersion = (v) => ({
10082
+ ...v.sourceIdentifier !== void 0 && { SourceIdentifier: v.sourceIdentifier },
10083
+ ...v.sourceVersion !== void 0 && { SourceVersion: v.sourceVersion }
10084
+ });
10033
10085
  const readCodeBuildProject = async ({ physicalId, declared, region }) => {
10034
10086
  const name = str$1(physicalId) ?? str$1(declared.Name);
10035
10087
  if (!name) return void 0;
@@ -10044,27 +10096,11 @@ const readCodeBuildProject = async ({ physicalId, declared, region }) => {
10044
10096
  if (p.timeoutInMinutes !== void 0) model.TimeoutInMinutes = p.timeoutInMinutes;
10045
10097
  if (p.queuedTimeoutInMinutes !== void 0) model.QueuedTimeoutInMinutes = p.queuedTimeoutInMinutes;
10046
10098
  if (p.encryptionKey !== void 0) model.EncryptionKey = p.encryptionKey;
10047
- const src = p.source;
10048
- if (src) model.Source = {
10049
- ...src.type !== void 0 && { Type: src.type },
10050
- ...src.location !== void 0 && { Location: src.location },
10051
- ...src.buildspec !== void 0 && { BuildSpec: src.buildspec },
10052
- ...src.gitCloneDepth !== void 0 && { GitCloneDepth: src.gitCloneDepth },
10053
- ...src.insecureSsl !== void 0 && { InsecureSsl: src.insecureSsl },
10054
- ...src.reportBuildStatus !== void 0 && { ReportBuildStatus: src.reportBuildStatus }
10055
- };
10056
- const art = p.artifacts;
10057
- if (art) model.Artifacts = {
10058
- ...art.type !== void 0 && { Type: art.type },
10059
- ...art.location !== void 0 && { Location: art.location },
10060
- ...art.name !== void 0 && { Name: art.name },
10061
- ...art.namespaceType !== void 0 && { NamespaceType: art.namespaceType },
10062
- ...art.packaging !== void 0 && { Packaging: art.packaging },
10063
- ...art.path !== void 0 && { Path: art.path },
10064
- ...art.artifactIdentifier !== void 0 && { ArtifactIdentifier: art.artifactIdentifier },
10065
- ...art.overrideArtifactName !== void 0 && { OverrideArtifactName: art.overrideArtifactName },
10066
- ...art.encryptionDisabled !== void 0 && { EncryptionDisabled: art.encryptionDisabled }
10067
- };
10099
+ if (p.source) model.Source = projectCodeBuildSource(p.source);
10100
+ if (p.artifacts) model.Artifacts = projectCodeBuildArtifacts(p.artifacts);
10101
+ if (Array.isArray(p.secondarySources) && p.secondarySources.length > 0) model.SecondarySources = p.secondarySources.map(projectCodeBuildSource);
10102
+ if (Array.isArray(p.secondaryArtifacts) && p.secondaryArtifacts.length > 0) model.SecondaryArtifacts = p.secondaryArtifacts.map(projectCodeBuildArtifacts);
10103
+ if (Array.isArray(p.secondarySourceVersions) && p.secondarySourceVersions.length > 0) model.SecondarySourceVersions = p.secondarySourceVersions.map(projectCodeBuildSourceVersion);
10068
10104
  const env = p.environment;
10069
10105
  if (env) model.Environment = {
10070
10106
  ...env.type !== void 0 && { Type: env.type },
@@ -10119,6 +10155,9 @@ const readCodeBuildProject = async ({ physicalId, declared, region }) => {
10119
10155
  ...cache.location !== void 0 && { Location: cache.location },
10120
10156
  ...cache.modes?.length && { Modes: cache.modes }
10121
10157
  };
10158
+ if (p.webhook) model.Triggers = projectCodeBuildTriggers(p.webhook);
10159
+ if (p.buildBatchConfig) model.BuildBatchConfig = projectCodeBuildBatchConfig(p.buildBatchConfig);
10160
+ if (typeof p.autoRetryLimit === "number" && p.autoRetryLimit > 0) model.AutoRetryLimit = p.autoRetryLimit;
10122
10161
  if (Array.isArray(p.tags) && p.tags.length > 0) model.Tags = p.tags.map((t) => ({
10123
10162
  Key: t.key,
10124
10163
  Value: t.value
@@ -10218,6 +10257,13 @@ const readDocDbCluster = async ({ physicalId, declared, region, accountId }) =>
10218
10257
  if (cl.DBClusterParameterGroup !== void 0) model.DBClusterParameterGroupName = cl.DBClusterParameterGroup;
10219
10258
  const sgs = (cl.VpcSecurityGroups ?? []).map((g) => g.VpcSecurityGroupId).filter((s) => s !== void 0);
10220
10259
  if (sgs.length > 0) model.VpcSecurityGroupIds = sgs;
10260
+ if (cl.ServerlessV2ScalingConfiguration !== void 0) model.ServerlessV2ScalingConfiguration = {
10261
+ ...cl.ServerlessV2ScalingConfiguration.MinCapacity !== void 0 && { MinCapacity: cl.ServerlessV2ScalingConfiguration.MinCapacity },
10262
+ ...cl.ServerlessV2ScalingConfiguration.MaxCapacity !== void 0 && { MaxCapacity: cl.ServerlessV2ScalingConfiguration.MaxCapacity }
10263
+ };
10264
+ if (cl.StorageType !== void 0) model.StorageType = cl.StorageType;
10265
+ if (cl.NetworkType !== void 0) model.NetworkType = cl.NetworkType;
10266
+ if (cl.DBSubnetGroup !== void 0) model.DBSubnetGroupName = cl.DBSubnetGroup;
10221
10267
  const tagArn = str$1(cl.DBClusterArn) ?? (accountId && id ? `arn:${partitionForRegion(region).partition}:rds:${region}:${accountId}:cluster:${id}` : void 0);
10222
10268
  if (tagArn) await attachDocDbTags(c, tagArn, declared, model, "DBCluster");
10223
10269
  return model;
@@ -11698,7 +11744,8 @@ function buildSiblingListenerPorts(desired) {
11698
11744
  const ranges = r.declared?.PortRanges;
11699
11745
  const first = Array.isArray(ranges) ? ranges[0] : void 0;
11700
11746
  const from = first && typeof first === "object" ? first.FromPort : void 0;
11701
- if (typeof from === "number") map[r.physicalId] = from;
11747
+ const port = typeof from === "number" ? from : typeof from === "string" && /^\d+$/.test(from) ? Number(from) : void 0;
11748
+ if (port !== void 0) map[r.physicalId] = port;
11702
11749
  }
11703
11750
  return map;
11704
11751
  }