@meyicloud/meyi-cost-server 1.8.3 → 1.8.4

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.3",
3
+ "version": "1.8.4",
4
4
  "description": "Tenant-aware AWS CUR and Athena cost plugin server for MeyiConnect",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -40,25 +40,28 @@ export class AwsOnboardingRepository {
40
40
  if (!connections.length) return { accounts: [], meta: {}, sources: [] };
41
41
 
42
42
  const connectionIds = connections.map((connection) => connection.connection_id);
43
+ // Bind every connection ID independently. Passing an untyped JavaScript array
44
+ // to PostgreSQL ANY() fails for the varchar connection_id column.
45
+ const connectionIdList = sql.join(connectionIds.map((connectionId) => sql`${connectionId}`), sql`, `);
43
46
  const curConfigs = relations.cur_config_table ? rows(await this.db.execute(sql`
44
47
  SELECT export_arn, bucket, prefix, region, tenant_partition, status, last_data_at
45
48
  , connection_id
46
49
  FROM ${sql.raw(this.curConfigTable)}
47
- WHERE tenant_id::text = ${tenant} AND connection_id = ANY(${connectionIds})
50
+ WHERE tenant_id::text = ${tenant} AND connection_id IN (${connectionIdList})
48
51
  `)) : [];
49
52
 
50
53
  const discoveries = relations.cur_discovery_table ? rows(await this.db.execute(sql`
51
54
  SELECT id, status, attempt_count, glue_database, glue_table, table_location,
52
55
  cur_s3_uri, last_data_at, last_error, last_started_at, last_finished_at, next_run_at, connection_id
53
56
  FROM ${sql.raw(this.curDiscoveryTable)}
54
- WHERE tenant_id = ${tenant} AND connection_id = ANY(${connectionIds})
57
+ WHERE tenant_id = ${tenant} AND connection_id IN (${connectionIdList})
55
58
  `)) : [];
56
59
 
57
60
  const allAccounts = relations.accounts_table ? rows(await this.db.execute(sql`
58
61
  SELECT connection_id, account_id, account_name, status
59
62
  FROM ${sql.raw(this.accountsTable)}
60
63
  WHERE tenant_id::text = ${tenant}
61
- AND connection_id = ANY(${connectionIds})
64
+ AND connection_id IN (${connectionIdList})
62
65
  AND LOWER(status) = 'active'
63
66
  ORDER BY account_name
64
67
  `)) : [];