@kumori/aurora-backend-handler 1.0.28 → 1.0.30
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/helpers/revision-helper.ts +30 -33
- package/package.json +1 -1
- package/websocket-manager.ts +34 -6
|
@@ -528,39 +528,52 @@ export const processRevisionData = (
|
|
|
528
528
|
revisionData: any,
|
|
529
529
|
): Service => {
|
|
530
530
|
const { solution } = revisionData;
|
|
531
|
+
|
|
532
|
+
const config = revisionData?.config?.config || {};
|
|
533
|
+
const parameters = extractParametersFromConfig(
|
|
534
|
+
config.parameter || {},
|
|
535
|
+
);
|
|
536
|
+
const resources = extractResources(config.resource || {});
|
|
537
|
+
|
|
531
538
|
const deploymentName = solution.top || service.name;
|
|
532
539
|
const deployment = solution.deployments[deploymentName];
|
|
533
540
|
|
|
534
541
|
if (!deployment) {
|
|
535
|
-
console.warn(
|
|
536
|
-
`No deployment found with name ${deploymentName} in solution. Available deployments:`,
|
|
537
|
-
Object.keys(solution.deployments),
|
|
538
|
-
);
|
|
539
542
|
const firstDeploymentKey = Object.keys(solution.deployments)[0];
|
|
540
543
|
if (firstDeploymentKey) {
|
|
541
|
-
console.warn(`Using first available deployment: ${firstDeploymentKey}`);
|
|
542
544
|
return processDeployment(
|
|
543
545
|
service,
|
|
544
546
|
solution.deployments[firstDeploymentKey],
|
|
545
547
|
revisionData,
|
|
548
|
+
parameters,
|
|
549
|
+
resources,
|
|
546
550
|
);
|
|
547
551
|
}
|
|
548
|
-
return
|
|
552
|
+
return {
|
|
553
|
+
...service,
|
|
554
|
+
parameters: parameters,
|
|
555
|
+
resources: resources,
|
|
556
|
+
};
|
|
549
557
|
}
|
|
550
558
|
|
|
551
|
-
return processDeployment(
|
|
559
|
+
return processDeployment(
|
|
560
|
+
service,
|
|
561
|
+
deployment,
|
|
562
|
+
revisionData,
|
|
563
|
+
parameters,
|
|
564
|
+
resources,
|
|
565
|
+
);
|
|
552
566
|
};
|
|
567
|
+
|
|
553
568
|
export const processDeployment = (
|
|
554
569
|
service: Service,
|
|
555
570
|
deployment: any,
|
|
556
571
|
revisionData: any,
|
|
572
|
+
parameters: { [key: string]: string }[],
|
|
573
|
+
resources: Resource[],
|
|
557
574
|
): Service => {
|
|
558
575
|
const artifact = deployment.artifact;
|
|
559
576
|
const deploymentConfig = deployment.config || {};
|
|
560
|
-
const serviceResources = extractResources(deploymentConfig.resource || {});
|
|
561
|
-
const allServiceParameters = extractParametersFromConfig(
|
|
562
|
-
deploymentConfig.parameter || {},
|
|
563
|
-
);
|
|
564
577
|
|
|
565
578
|
const rolesDefinition = artifact.description?.role || {};
|
|
566
579
|
const hasRoles = Object.keys(rolesDefinition).length > 0;
|
|
@@ -569,19 +582,6 @@ export const processDeployment = (
|
|
|
569
582
|
if (hasRoles) {
|
|
570
583
|
Object.entries(rolesDefinition).forEach(
|
|
571
584
|
([roleName, roleData]: [string, any]) => {
|
|
572
|
-
const fileSystemParameters = extractParametersFromFilesystem(
|
|
573
|
-
roleData.artifact.description?.code?.[roleName]?.mapping
|
|
574
|
-
?.filesystem || [],
|
|
575
|
-
allServiceParameters,
|
|
576
|
-
);
|
|
577
|
-
allServiceParameters.push(...fileSystemParameters);
|
|
578
|
-
const fileSystemResources = extractResourcesFromFilesystem(
|
|
579
|
-
roleData.artifact.description?.code?.[roleName]?.mapping
|
|
580
|
-
?.filesystem || [],
|
|
581
|
-
serviceResources,
|
|
582
|
-
);
|
|
583
|
-
serviceResources.push(...fileSystemResources);
|
|
584
|
-
const roleResources = extractResources(roleData.config?.resource || {});
|
|
585
585
|
const existingRole = service.role.find((r) => r.name === roleName);
|
|
586
586
|
let hsize = 1;
|
|
587
587
|
if (roleData.config?.scale?.hsize !== undefined) {
|
|
@@ -601,8 +601,8 @@ export const processDeployment = (
|
|
|
601
601
|
logo: service.logo,
|
|
602
602
|
description:
|
|
603
603
|
roleData.artifact?.ref?.module || roleData.ref?.module || "",
|
|
604
|
-
resource:
|
|
605
|
-
parameters:
|
|
604
|
+
resource: resources,
|
|
605
|
+
parameters: parameters,
|
|
606
606
|
hsize: hsize,
|
|
607
607
|
category: hasDuplex || hasVolumeResource ? "stateful" : "",
|
|
608
608
|
};
|
|
@@ -612,17 +612,14 @@ export const processDeployment = (
|
|
|
612
612
|
) {
|
|
613
613
|
role.scalling = processScalingConfig(deployment.meta);
|
|
614
614
|
}
|
|
615
|
-
|
|
616
615
|
updatedRoles.push(role);
|
|
617
616
|
},
|
|
618
617
|
);
|
|
619
618
|
} else {
|
|
620
619
|
let hsize = 1;
|
|
621
|
-
|
|
622
620
|
if (deploymentConfig.scale?.hsize !== undefined) {
|
|
623
621
|
hsize = deploymentConfig.scale.hsize;
|
|
624
622
|
}
|
|
625
|
-
|
|
626
623
|
if (deploymentConfig.scale?.detail?.[""]?.hsize !== undefined) {
|
|
627
624
|
hsize = deploymentConfig.scale.detail[""].hsize;
|
|
628
625
|
}
|
|
@@ -634,8 +631,8 @@ export const processDeployment = (
|
|
|
634
631
|
description:
|
|
635
632
|
artifact.ref?.module ||
|
|
636
633
|
(artifact.description?.builtin ? "Builtin Service" : ""),
|
|
637
|
-
resource:
|
|
638
|
-
parameters:
|
|
634
|
+
resource: resources,
|
|
635
|
+
parameters: parameters,
|
|
639
636
|
hsize: hsize,
|
|
640
637
|
...(deployment.meta?.scaling &&
|
|
641
638
|
Object.keys(deployment.meta.scaling.simple || {}).length > 0 && {
|
|
@@ -647,8 +644,8 @@ export const processDeployment = (
|
|
|
647
644
|
|
|
648
645
|
return {
|
|
649
646
|
...service,
|
|
650
|
-
resources:
|
|
651
|
-
parameters:
|
|
647
|
+
resources: resources,
|
|
648
|
+
parameters: parameters,
|
|
652
649
|
role: updatedRoles,
|
|
653
650
|
};
|
|
654
651
|
};
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { v7 as uuidv7 } from "uuid";
|
|
2
2
|
import { environment } from "./environment";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Account,
|
|
5
|
+
Channel,
|
|
6
|
+
ClusterToken,
|
|
7
|
+
Environment,
|
|
8
|
+
Instance,
|
|
9
|
+
Link,
|
|
10
|
+
MarketplaceService,
|
|
11
|
+
Notification,
|
|
12
|
+
Organization,
|
|
13
|
+
Plan,
|
|
14
|
+
PlanProvider,
|
|
15
|
+
Platform,
|
|
16
|
+
Registry,
|
|
17
|
+
Resource,
|
|
18
|
+
Service,
|
|
19
|
+
Tenant,
|
|
20
|
+
tenantRole,
|
|
21
|
+
Token,
|
|
22
|
+
Usage,
|
|
23
|
+
User,
|
|
24
|
+
UserData,
|
|
25
|
+
} from "@kumori/aurora-interfaces";
|
|
4
26
|
import { loadMarketplaceItemsForTenant } from "./api/marketplace-api-service";
|
|
5
27
|
import { getReporting } from "./api/reporting-api-service";
|
|
6
28
|
import { parseKeyPath } from "./utils/utils";
|
|
@@ -17,7 +39,10 @@ import {
|
|
|
17
39
|
handleEnvironmentOperationError,
|
|
18
40
|
handleEnvironmentOperationSuccess,
|
|
19
41
|
} from "./helpers/environment-helper";
|
|
20
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
handleRevisionEvent,
|
|
44
|
+
processRevisionData,
|
|
45
|
+
} from "./helpers/revision-helper";
|
|
21
46
|
import {
|
|
22
47
|
handleServiceEvent,
|
|
23
48
|
handleServiceOperationError,
|
|
@@ -355,8 +380,8 @@ export const initializeGlobalWebSocketClient = async (
|
|
|
355
380
|
wsConnection?.addEventListener("error", (error) => {
|
|
356
381
|
console.error("Global WebSocket error:", error);
|
|
357
382
|
userData.status = "notlogged";
|
|
358
|
-
|
|
359
|
-
|
|
383
|
+
user = new User(userData);
|
|
384
|
+
eventHelper.user.publish.loaded(user);
|
|
360
385
|
connectionPromise = null;
|
|
361
386
|
reject(error);
|
|
362
387
|
});
|
|
@@ -594,6 +619,7 @@ const rebuildHierarchy = () => {
|
|
|
594
619
|
status: preservedUserData.status,
|
|
595
620
|
notifications: preservedUserData.notifications || [],
|
|
596
621
|
plans: preservedUserData.plans || [],
|
|
622
|
+
discoveryMethod: preservedUserData.discoveryMethod,
|
|
597
623
|
};
|
|
598
624
|
};
|
|
599
625
|
const handleEvent = async (message: WSMessage) => {
|
|
@@ -948,7 +974,7 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
948
974
|
eventData,
|
|
949
975
|
parentParts,
|
|
950
976
|
tenantsMap,
|
|
951
|
-
secretsMap
|
|
977
|
+
secretsMap,
|
|
952
978
|
});
|
|
953
979
|
|
|
954
980
|
if (registryResult.tenantFound && registryResult.updatedTenant) {
|
|
@@ -1820,6 +1846,8 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
|
|
|
1820
1846
|
notifications: preservedNotifications,
|
|
1821
1847
|
plans: updatedUserData.plans,
|
|
1822
1848
|
status: updatedUserData.status,
|
|
1849
|
+
discoveryMethod:
|
|
1850
|
+
updatedUserData.discoveryMethod || userData.discoveryMethod,
|
|
1823
1851
|
};
|
|
1824
1852
|
user = new User(
|
|
1825
1853
|
userData,
|
|
@@ -1832,4 +1860,4 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
|
|
|
1832
1860
|
console.error("Error updating user in websocket-manager:", error);
|
|
1833
1861
|
return user;
|
|
1834
1862
|
}
|
|
1835
|
-
};
|
|
1863
|
+
};
|