@kumori/aurora-backend-handler 1.1.7 → 1.1.8

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": "@kumori/aurora-backend-handler",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -192,6 +192,7 @@ const REPORTING_ITERATIONS = 5;
192
192
  const REPORTING_INTERVAL = 1000;
193
193
  let hasLoadedReportingOnce = false;
194
194
  let recentlyUpdatedServices = new Map<string, Service>();
195
+ let pendingTenantStatus = new Map<string, string>();
195
196
  /**
196
197
  * Helper function to safely stringify error objects
197
198
  */
@@ -639,6 +640,18 @@ const handleEvent = async (message: WSMessage) => {
639
640
  parseKeyPath,
640
641
  eventHelper,
641
642
  });
643
+ Object.entries(eventData.status.tenants).forEach(
644
+ ([tenantId, tenantInfo]: [string, any]) => {
645
+ if (tenantInfo.status === "rejected") {
646
+ const tenant = tenantsMap.get(tenantId);
647
+ if (tenant) {
648
+ tenantsMap.set(tenantId, { ...tenant, status: "leaving" });
649
+ } else {
650
+ pendingTenantStatus.set(tenantId, "leaving");
651
+ }
652
+ }
653
+ },
654
+ );
642
655
  userData = userEventResult.userData;
643
656
  tempProviders = userEventResult.tempProviders;
644
657
  userEventResult.deletedTenantKeys.forEach((key) => {
@@ -850,6 +863,12 @@ const handleEvent = async (message: WSMessage) => {
850
863
  }
851
864
 
852
865
  tenantsMap.set(entityId, newTenant);
866
+ if (pendingTenantStatus.has(entityId)) {
867
+ const pendingStatus = pendingTenantStatus.get(entityId)!;
868
+ tenantsMap.set(entityId, { ...newTenant, status: pendingStatus });
869
+ pendingTenantStatus.delete(entityId);
870
+ }
871
+
853
872
  loadMarketplaceItemsForTenant(entityId, "") //TODO Move to helper
854
873
  .then((items) => {
855
874
  const tenant = tenantsMap.get(entityId);
@@ -952,13 +971,17 @@ const handleEvent = async (message: WSMessage) => {
952
971
  break;
953
972
 
954
973
  case "ca":
955
- const caResult = handleCAEvent(eventData, parentParts, tenantsMap, hasRequestingServices,);
974
+ const caResult = handleCAEvent(
975
+ eventData,
976
+ parentParts,
977
+ tenantsMap,
978
+ hasRequestingServices,
979
+ );
956
980
  processResourceResult(
957
981
  caResult,
958
982
  tenantsMap,
959
983
  pendingDomains,
960
984
  eventHelper,
961
-
962
985
  );
963
986
  break;
964
987