@meyicloud/meyi-cost-server 1.8.1 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meyicloud/meyi-cost-server",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Tenant-aware AWS CUR and Athena cost plugin server for MeyiConnect",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -175,6 +175,7 @@ export class CostAnalyserService {
175
175
  if (!athena.enabled) throw Object.assign(new Error("CUR discovery has not produced a queryable Athena table for this tenant"), { name: "CurDataNotReadyError", statusCode: 503 });
176
176
  const targetRoleArn = required(customer.meta?.payerRoleArn, "customer TARGET_ROLE_ARN");
177
177
  const targetAccountId = required(customer.meta?.managementAccountId || customer.accounts?.[0]?.id, "customer management account ID");
178
+ const targetAccountName = customer.accounts?.find((account) => account.id === targetAccountId)?.name || targetAccountId;
178
179
  const prefix = `tenants/${tenantId}/reports/${reportId}`;
179
180
  let providerSecretArn;
180
181
  try {
@@ -189,6 +190,7 @@ export class CostAnalyserService {
189
190
  REPORT_BUCKET: this.reportBucket,
190
191
  REPORT_BUCKET_REGION: this.region,
191
192
  TARGET_ACCOUNT_ID: targetAccountId,
193
+ TARGET_ACCOUNT_NAME: targetAccountName,
192
194
  TARGET_ROLE_ARN: targetRoleArn,
193
195
  TARGET_ROLE_EXTERNAL_ID: customer.meta?.externalId,
194
196
  TARGET_REGIONS: this.targetRegions,
@@ -17,9 +17,9 @@ export class CostIncidentSyncService {
17
17
  if (!this.incidentSink) return false;
18
18
  try {
19
19
  const key = this.ticketsKey(report);
20
- if (!report.artifact_bucket || !key) throw new Error("FinOps ticket artifact location is missing");
20
+ if (!report.artifact_bucket || !key) throw new Error("Cost ticket artifact location is missing");
21
21
  const data = await this.artifactService.get(report.artifact_bucket, key);
22
- if (!data) throw new Error("FinOps ticket artifact is empty");
22
+ if (!data) throw new Error("Cost ticket artifact is empty");
23
23
  const parsed = JSON.parse(data.toString("utf8"));
24
24
  const tickets = Array.isArray(parsed?.tickets) ? parsed.tickets.filter((ticket) => ticket?.ticket_id) : [];
25
25