@kumori/aurora-backend-handler 1.1.57 → 1.1.58
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.
|
@@ -169,11 +169,14 @@ export const syncAccountStatusFromNotifications = (
|
|
|
169
169
|
const accountName: string = notification.data?.account;
|
|
170
170
|
if (!accountName) continue;
|
|
171
171
|
|
|
172
|
-
const
|
|
172
|
+
const accountTenant: string = notification.data?.tenant ?? "";
|
|
173
|
+
const accountKey = accountTenant ? `${accountTenant}/${accountName}` : accountName;
|
|
174
|
+
|
|
175
|
+
const account = accountsMap.get(accountKey);
|
|
173
176
|
if (!account || ACCOUNT_ERROR_STATUSES.has(account.status)) continue;
|
|
174
177
|
|
|
175
178
|
const code: string = notification.info_content?.code ?? "";
|
|
176
|
-
accountsMap.set(
|
|
179
|
+
accountsMap.set(accountKey, {
|
|
177
180
|
...account,
|
|
178
181
|
status: resolveErrorStatus(code),
|
|
179
182
|
});
|
|
@@ -194,7 +197,8 @@ export const handleAccountEvent = ({
|
|
|
194
197
|
extractCloudProviderCredentials(eventData);
|
|
195
198
|
const accountLabels: Record<string, string> = eventData.meta.labels;
|
|
196
199
|
const hasCredentials = "__axebow::managedCredentials" in accountLabels;
|
|
197
|
-
const
|
|
200
|
+
const accountKey = accountTenantId ? `${accountTenantId}/${entityId}` : entityId;
|
|
201
|
+
const existingAccount = accountsMap.get(accountKey);
|
|
198
202
|
const accountStatus = determineAccountStatus(eventData, existingAccount);
|
|
199
203
|
|
|
200
204
|
const newAccount: Account = {
|
|
@@ -357,7 +361,6 @@ export const handleAccountOperationError = ({
|
|
|
357
361
|
const notification: Notification = {
|
|
358
362
|
type: "error",
|
|
359
363
|
subtype: errEntry.subtype,
|
|
360
|
-
title: errEntry.title,
|
|
361
364
|
date: Date.now().toString(),
|
|
362
365
|
status: "unread",
|
|
363
366
|
info_content: {
|
|
@@ -250,7 +250,6 @@ export const handleEnvironmentOperationError = ({
|
|
|
250
250
|
const envErrorNotification: Notification = {
|
|
251
251
|
type: "error",
|
|
252
252
|
subtype: envErrEntry.subtype,
|
|
253
|
-
title: envErrEntry.title,
|
|
254
253
|
date: Date.now().toString(),
|
|
255
254
|
status: "unread",
|
|
256
255
|
info_content: {
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -715,7 +715,9 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
715
715
|
}
|
|
716
716
|
if (revisionResult.updatedAccount) {
|
|
717
717
|
const accId = revisionResult.updatedService?.account;
|
|
718
|
-
|
|
718
|
+
const accRevTenant = revisionResult.updatedAccount.tenant;
|
|
719
|
+
const accRevKey = accRevTenant && accId ? `${accRevTenant}/${accId}` : accId;
|
|
720
|
+
if (accRevKey) accountsMap.set(accRevKey, revisionResult.updatedAccount);
|
|
719
721
|
}
|
|
720
722
|
if (revisionResult.pendingRevisionError) {
|
|
721
723
|
pendingRevisionErrors.push(revisionResult.pendingRevisionError);
|
|
@@ -808,7 +810,8 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
808
810
|
});
|
|
809
811
|
|
|
810
812
|
if (!message.payload.deleted) {
|
|
811
|
-
|
|
813
|
+
const accountKey = parentParts.tenant ? `${parentParts.tenant}/${entityId}` : entityId;
|
|
814
|
+
accountsMap.set(accountKey, accountResult.account);
|
|
812
815
|
updateEnvironmentsCloudProvider(entityId, eventData.spec.api);
|
|
813
816
|
}
|
|
814
817
|
break;
|
|
@@ -1395,16 +1398,18 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
|
|
|
1395
1398
|
originalData: originalData as Account,
|
|
1396
1399
|
});
|
|
1397
1400
|
|
|
1401
|
+
const accTenant = (originalData as Account)?.tenant;
|
|
1402
|
+
const accSuccessKey = accTenant ? `${accTenant}/${entityName}` : entityName;
|
|
1398
1403
|
if (accSuccessResult.shouldDelete) {
|
|
1399
|
-
const acc = accountsMap.get(
|
|
1404
|
+
const acc = accountsMap.get(accSuccessKey);
|
|
1400
1405
|
if (acc) {
|
|
1401
|
-
accountsMap.delete(
|
|
1406
|
+
accountsMap.delete(accSuccessKey);
|
|
1402
1407
|
eventHelper.notification.publish.creation(
|
|
1403
1408
|
accSuccessResult.notification,
|
|
1404
1409
|
);
|
|
1405
1410
|
}
|
|
1406
1411
|
} else if (accSuccessResult.updatedAccount) {
|
|
1407
|
-
accountsMap.set(
|
|
1412
|
+
accountsMap.set(accSuccessKey, accSuccessResult.updatedAccount);
|
|
1408
1413
|
if (accSuccessResult.eventType === "created") {
|
|
1409
1414
|
eventHelper.account.publish.created(accSuccessResult.updatedAccount);
|
|
1410
1415
|
} else if (accSuccessResult.eventType === "updated") {
|
|
@@ -1527,10 +1532,12 @@ const handleOperationError = (operation: PendingOperation, error: any) => {
|
|
|
1527
1532
|
error,
|
|
1528
1533
|
});
|
|
1529
1534
|
|
|
1535
|
+
const accErrorTenant = (originalData as Account)?.tenant;
|
|
1536
|
+
const accErrorKey = accErrorTenant ? `${accErrorTenant}/${entityName}` : entityName;
|
|
1530
1537
|
if (accErrorResult.shouldDelete) {
|
|
1531
|
-
accountsMap.delete(
|
|
1538
|
+
accountsMap.delete(accErrorKey);
|
|
1532
1539
|
} else if (accErrorResult.updatedAccount) {
|
|
1533
|
-
accountsMap.set(
|
|
1540
|
+
accountsMap.set(accErrorKey, accErrorResult.updatedAccount);
|
|
1534
1541
|
}
|
|
1535
1542
|
|
|
1536
1543
|
if (accErrorResult.eventType === "creationError") {
|
|
@@ -1607,7 +1614,8 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1607
1614
|
}
|
|
1608
1615
|
if (keyParts.account && !keyParts.environment) {
|
|
1609
1616
|
const accountName = keyParts.account;
|
|
1610
|
-
const
|
|
1617
|
+
const accountDeleteKey = tenantName ? `${tenantName}/${accountName}` : accountName;
|
|
1618
|
+
const deletedAccount = accountsMap.get(accountDeleteKey)!;
|
|
1611
1619
|
eventHelper.account.publish.deleted(deletedAccount);
|
|
1612
1620
|
const accountNotification: Notification = {
|
|
1613
1621
|
type: "success",
|
|
@@ -1621,7 +1629,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1621
1629
|
},
|
|
1622
1630
|
};
|
|
1623
1631
|
eventHelper.notification.publish.creation(accountNotification);
|
|
1624
|
-
accountsMap.delete(
|
|
1632
|
+
accountsMap.delete(accountDeleteKey);
|
|
1625
1633
|
}
|
|
1626
1634
|
if (keyParts.domain) {
|
|
1627
1635
|
const domainName = keyParts.domain;
|