@kumori/aurora-backend-handler 1.1.23 → 1.1.25
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/api/marketplace-api-service.ts +26 -77
- package/api/user-api-service.ts +0 -4
- package/backend-handler.ts +356 -330
- package/event-helper.ts +9 -0
- package/event-names.ts +3 -0
- package/helpers/tenant-helper.ts +0 -5
- package/package.json +1 -1
- package/websocket-manager.ts +17 -0
package/event-helper.ts
CHANGED
|
@@ -406,6 +406,9 @@ export class EventHelper {
|
|
|
406
406
|
deletionError: this.createEvent<Service>(EventNames.MarketplaceItemDeletionError).publish,
|
|
407
407
|
loadItems: this.createEvent<string[]>(EventNames.LoadMarketplaceItems).publish,
|
|
408
408
|
itemsLoaded: this.createEvent<MarketplaceItem[]>(EventNames.MarketplaceItemsLoaded).publish,
|
|
409
|
+
loadSchema: this.createEvent<string>(EventNames.LoadMarketplaceSchema).publish,
|
|
410
|
+
schemaLoaded: this.createEvent<MarketplaceItem>(EventNames.MarketplaceSchemaLoaded).publish,
|
|
411
|
+
schemaLoadError: this.createEvent<string>(EventNames.MarketplaceSchemaLoadError).publish,
|
|
409
412
|
},
|
|
410
413
|
subscribe: {
|
|
411
414
|
deployItem: this.createEvent<MarketplaceService>(EventNames.DeployMarketplaceItem).subscribe,
|
|
@@ -419,6 +422,9 @@ export class EventHelper {
|
|
|
419
422
|
deletionError: this.createEvent<Service>(EventNames.MarketplaceItemDeletionError).subscribe,
|
|
420
423
|
loadItems: this.createEvent<string[]>(EventNames.LoadMarketplaceItems).subscribe,
|
|
421
424
|
itemsLoaded: this.createEvent<MarketplaceItem[]>(EventNames.MarketplaceItemsLoaded).subscribe,
|
|
425
|
+
loadSchema: this.createEvent<string>(EventNames.LoadMarketplaceSchema).subscribe,
|
|
426
|
+
schemaLoaded: this.createEvent<MarketplaceItem>(EventNames.MarketplaceSchemaLoaded).subscribe,
|
|
427
|
+
schemaLoadError: this.createEvent<string>(EventNames.MarketplaceSchemaLoadError).subscribe,
|
|
422
428
|
},
|
|
423
429
|
unsubscribe: {
|
|
424
430
|
deployItem: this.createEvent<MarketplaceService>(EventNames.DeployMarketplaceItem).unsubscribe,
|
|
@@ -432,6 +438,9 @@ export class EventHelper {
|
|
|
432
438
|
deletionError: this.createEvent<Service>(EventNames.MarketplaceItemDeletionError).unsubscribe,
|
|
433
439
|
loadItems: this.createEvent<string[]>(EventNames.LoadMarketplaceItems).unsubscribe,
|
|
434
440
|
itemsLoaded: this.createEvent<MarketplaceItem[]>(EventNames.MarketplaceItemsLoaded).unsubscribe,
|
|
441
|
+
loadSchema: this.createEvent<string>(EventNames.LoadMarketplaceSchema).unsubscribe,
|
|
442
|
+
schemaLoaded: this.createEvent<MarketplaceItem>(EventNames.MarketplaceSchemaLoaded).unsubscribe,
|
|
443
|
+
schemaLoadError: this.createEvent<string>(EventNames.MarketplaceSchemaLoadError).unsubscribe,
|
|
435
444
|
},
|
|
436
445
|
};
|
|
437
446
|
}
|
package/event-names.ts
CHANGED
|
@@ -117,6 +117,9 @@ export enum EventNames {
|
|
|
117
117
|
MarketplaceItemDeletionError = "marketplaceItemDeletionError",
|
|
118
118
|
LoadMarketplaceItems = "loadMarketplaceItems",
|
|
119
119
|
MarketplaceItemsLoaded = "marketplaceItemsLoaded",
|
|
120
|
+
LoadMarketplaceSchema = "loadMarketplaceSchema",
|
|
121
|
+
MarketplaceSchemaLoaded = "marketplaceSchemaLoaded",
|
|
122
|
+
MarketplaceSchemaLoadError = "marketplaceSchemaLoadError",
|
|
120
123
|
// * Resource
|
|
121
124
|
CreateResource = "createResource",
|
|
122
125
|
ResourceCreated = "resourceCreated",
|
package/helpers/tenant-helper.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import { Tenant, tenantRole, User, UserData } from "@kumori/aurora-interfaces";
|
|
3
2
|
import { parseKeyPath } from "../utils/utils";
|
|
4
3
|
|
|
@@ -98,10 +97,6 @@ export const handleTenantEvent: (
|
|
|
98
97
|
) {
|
|
99
98
|
newTenant.npmRegistry.domain = Object.keys(eventData.spec.domains)[0];
|
|
100
99
|
}
|
|
101
|
-
} else {
|
|
102
|
-
console.warn(
|
|
103
|
-
`No se encontró información de registry en eventData para el tenant ${newTenant.name}`,
|
|
104
|
-
);
|
|
105
100
|
}
|
|
106
101
|
return newTenant;
|
|
107
102
|
};
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ClusterToken,
|
|
7
7
|
Environment,
|
|
8
8
|
Instance,
|
|
9
|
+
MarketplaceItem,
|
|
9
10
|
Notification,
|
|
10
11
|
Organization,
|
|
11
12
|
Plan,
|
|
@@ -2038,3 +2039,19 @@ const resolveServiceStatus = (service: Service): Service => {
|
|
|
2038
2039
|
status: currentRevision.status,
|
|
2039
2040
|
};
|
|
2040
2041
|
};
|
|
2042
|
+
export const loadMarketplaceItemSchema = async (
|
|
2043
|
+
item: MarketplaceItem,
|
|
2044
|
+
schema: any,
|
|
2045
|
+
): Promise<void> => {
|
|
2046
|
+
const tenant = tenantsMap.get(item.tenant);
|
|
2047
|
+
if (tenant) {
|
|
2048
|
+
tenant.marketplaceItems = (tenant.marketplaceItems || []).map((i) =>
|
|
2049
|
+
i.name === item.name && i.domain === item.domain
|
|
2050
|
+
? { ...i, schema }
|
|
2051
|
+
: i,
|
|
2052
|
+
);
|
|
2053
|
+
tenantsMap.set(item.tenant, tenant);
|
|
2054
|
+
}
|
|
2055
|
+
rebuildHierarchy();
|
|
2056
|
+
await updateUserWithPlatformInfo();
|
|
2057
|
+
};
|