@kumori/aurora-backend-handler 1.1.62 → 1.1.64

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.
@@ -587,9 +587,9 @@ const deleteResourceBase = async (
587
587
  body,
588
588
  30000,
589
589
  "DELETE",
590
- resource.name
590
+ resource.name,
591
+ "resource"
591
592
  );
592
-
593
593
  //eventHelper.resource.publish.deleted(resource);
594
594
  const resourceNotification: Notification = {
595
595
  type: "success",
@@ -239,7 +239,9 @@ export const handleResourceEvent = ({
239
239
  if (existingIndex !== -1) {
240
240
  existingResource = tenant.resources[existingIndex];
241
241
  publishUpdate = true;
242
- tenant.resources[existingIndex] = resource;
242
+ tenant.resources[existingIndex] = existingResource.deleting
243
+ ? { ...resource, deleting: true }
244
+ : resource;
243
245
  } else {
244
246
  tenant.resources.push(resource);
245
247
  }
@@ -376,6 +378,22 @@ export const handleVolumeEvent = (
376
378
  hasRequestingServices: false
377
379
  });
378
380
  };
381
+ export const setResourceDeleting = (
382
+ tenantsMap: Map<string, any>,
383
+ tenantName: string,
384
+ resourceName: string,
385
+ resourceType: string,
386
+ ) => {
387
+ const tenant = tenantsMap.get(tenantName);
388
+ if (!tenant) return;
389
+ const index = tenant.resources.findIndex(
390
+ (res: Resource) => res.name === resourceName && res.type === resourceType,
391
+ );
392
+ if (index === -1) return;
393
+ tenant.resources[index] = { ...tenant.resources[index], deleting: true };
394
+ tenantsMap.set(tenantName, tenant);
395
+ };
396
+
379
397
  export const processResourceResult = (
380
398
  result: any,
381
399
  tenantsMap: Map<string, any>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.62",
3
+ "version": "1.1.64",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "glob": "^11.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "@kumori/aurora-interfaces": "1.0.15",
14
+ "@kumori/aurora-interfaces": "1.0.16",
15
15
  "@kumori/kumori-dsl-generator": "1.0.6",
16
16
  "@kumori/kumori-module-generator": "^1.1.6",
17
17
  "ts-node": "^10.9.2",
@@ -61,6 +61,7 @@ import {
61
61
  handleSecretEvent,
62
62
  handleVolumeEvent,
63
63
  processResourceResult,
64
+ setResourceDeleting,
64
65
  } from "./helpers/resource-helper";
65
66
  import {
66
67
  handlePlanInstanceEvent,
@@ -1475,6 +1476,16 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
1475
1476
  user = new User(userData);
1476
1477
  }
1477
1478
  break;
1479
+ case "resource":
1480
+ if (action === "DELETE") {
1481
+ const tenant = originalData?.payload?.tenant;
1482
+ const resourceName = originalData?.payload?.resource;
1483
+ const resourceType = originalData?.payload?.kind;
1484
+ if (tenant && resourceName && resourceType) {
1485
+ setResourceDeleting(tenantsMap, tenant, resourceName, resourceType);
1486
+ }
1487
+ }
1488
+ break;
1478
1489
  }
1479
1490
 
1480
1491
  setTimeout(async () => {
@@ -2114,3 +2125,4 @@ export const fetchAndStoreMarketplaceSchema = async (
2114
2125
  rebuildHierarchy();
2115
2126
  await updateUserWithPlatformInfo();
2116
2127
  };
2128
+