@kumori/aurora-backend-handler 1.0.32 → 1.0.34

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.
@@ -61,6 +61,8 @@ export const createUser = async (user: User) => {
61
61
  }
62
62
  if (!response.ok) {
63
63
  const error = await response.json();
64
+ user.name = error.code;
65
+ eventHelper.user.publish.creationError(user);
64
66
  throw new Error(
65
67
  `HTTP Error ${response.status}: ${error.message || "Unknown error"}`
66
68
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -784,11 +784,36 @@ const handleEvent = async (message: WSMessage) => {
784
784
  break;
785
785
 
786
786
  case "tenant":
787
+ const existingTenant = tenantsMap.get(entityId);
787
788
  const newTenant: Tenant = handleTenantEvent(
788
789
  entityId,
789
790
  eventData,
790
791
  userData,
791
792
  );
793
+ if (existingTenant) {
794
+ if (
795
+ !newTenant.resources?.length &&
796
+ existingTenant.resources?.length
797
+ ) {
798
+ newTenant.resources = existingTenant.resources;
799
+ }
800
+ if (!newTenant.registry?.length && existingTenant.registry?.length) {
801
+ newTenant.registry = existingTenant.registry;
802
+ }
803
+ if (!newTenant.services?.length && existingTenant.services?.length) {
804
+ newTenant.services = existingTenant.services;
805
+ }
806
+ if (
807
+ !newTenant.environments?.length &&
808
+ existingTenant.environments?.length
809
+ ) {
810
+ newTenant.environments = existingTenant.environments;
811
+ }
812
+ if (!newTenant.projects?.length && existingTenant.projects?.length) {
813
+ newTenant.projects = existingTenant.projects;
814
+ }
815
+ }
816
+
792
817
  tenantsMap.set(entityId, newTenant);
793
818
  loadMarketplaceItemsForTenant(entityId, "") //TODO Move to helper
794
819
  .then((items) => {
@@ -1131,7 +1156,12 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
1131
1156
  tenantsMap.set(entityName, newTenant);
1132
1157
  eventHelper.tenant.publish.created(newTenant);
1133
1158
  } else if (action === "UPDATE") {
1134
- const updatedTenant = { ...originalData, status: "active" };
1159
+ const existingTenant = tenantsMap.get(entityName);
1160
+ const updatedTenant = {
1161
+ ...existingTenant,
1162
+ ...originalData,
1163
+ status: "active",
1164
+ };
1135
1165
  tenantsMap.set(entityName, updatedTenant);
1136
1166
  eventHelper.tenant.publish.updated(updatedTenant);
1137
1167
  }