cdk-real-drift 0.12.34 → 0.12.35

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
@@ -7933,6 +7933,37 @@ async function pageAppSyncFunctions(client, apiId) {
7933
7933
  } while (next);
7934
7934
  return out;
7935
7935
  }
7936
+ function bareApiKeyId(physicalId) {
7937
+ return physicalId.includes("/") ? physicalId.slice(physicalId.lastIndexOf("/") + 1) : physicalId;
7938
+ }
7939
+ function diffGraphQLApiApiKeys(input) {
7940
+ if (input.hasUnresolvedDeclaredApiKey) return [];
7941
+ const declared = new Set(input.declaredApiKeyIds);
7942
+ const added = [];
7943
+ for (const k of input.liveApiKeys) {
7944
+ if (declared.has(k.id)) continue;
7945
+ added.push({
7946
+ resourceType: "AWS::AppSync::ApiKey",
7947
+ identifier: k.id,
7948
+ label: k.label ?? k.id,
7949
+ live: { ApiKeyId: k.id }
7950
+ });
7951
+ }
7952
+ return added;
7953
+ }
7954
+ async function pageApiKeys(client, apiId) {
7955
+ const out = [];
7956
+ let next;
7957
+ do {
7958
+ const res = await client.send(new ListApiKeysCommand({
7959
+ apiId,
7960
+ nextToken: next
7961
+ }));
7962
+ out.push(...res.apiKeys ?? []);
7963
+ next = res.nextToken;
7964
+ } while (next);
7965
+ return out;
7966
+ }
7936
7967
  function bareApiId(physicalId) {
7937
7968
  return physicalId.includes("/") ? physicalId.slice(physicalId.lastIndexOf("/") + 1) : physicalId;
7938
7969
  }
@@ -7980,6 +8011,20 @@ async function enumerateGraphQLApiChildren(ctx) {
7980
8011
  }
7981
8012
  declaredFunctionArns.push(r.physicalId);
7982
8013
  }
8014
+ const declaredApiKeyIds = [];
8015
+ let apiKeyIdUnresolved = false;
8016
+ for (const r of desired.resources) {
8017
+ if (r.resourceType !== "AWS::AppSync::ApiKey") continue;
8018
+ const declaredApiId = r.declared.ApiId;
8019
+ if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
8020
+ if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
8021
+ }
8022
+ if (!r.physicalId) {
8023
+ apiKeyIdUnresolved = true;
8024
+ continue;
8025
+ }
8026
+ declaredApiKeyIds.push(bareApiKeyId(r.physicalId));
8027
+ }
7983
8028
  const client = new AppSyncClient({
7984
8029
  region,
7985
8030
  ...READ_RETRY
@@ -8016,10 +8061,19 @@ async function enumerateGraphQLApiChildren(ctx) {
8016
8061
  label: f.name ?? f.functionArn
8017
8062
  }))
8018
8063
  });
8064
+ const apiKeyAdded = diffGraphQLApiApiKeys({
8065
+ declaredApiKeyIds,
8066
+ liveApiKeys: (await pageApiKeys(client, apiId)).filter((k) => typeof k.id === "string").map((k) => ({
8067
+ id: k.id,
8068
+ label: k.description ? `${k.id} (${k.description})` : k.id
8069
+ })),
8070
+ hasUnresolvedDeclaredApiKey: apiKeyIdUnresolved
8071
+ });
8019
8072
  return [
8020
8073
  ...datasourceAdded,
8021
8074
  ...resolverAdded,
8022
- ...functionAdded
8075
+ ...functionAdded,
8076
+ ...apiKeyAdded
8023
8077
  ];
8024
8078
  }
8025
8079
  function diffLogGroupFilters(logGroupName, resourceType, declaredFilterNames, liveFilters, identifierOf) {