@kumori/aurora-backend-handler 1.1.13 → 1.1.14
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/service-helper.ts +13 -8
- package/package.json +1 -1
- package/websocket-manager.ts +1 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel, Service, Tenant, Usage } from "@kumori/aurora-interfaces";
|
|
1
|
+
import { Channel, Resource, Service, Tenant, Usage } from "@kumori/aurora-interfaces";
|
|
2
2
|
import { Revision } from "@kumori/aurora-interfaces/interfaces/revision-interface";
|
|
3
3
|
import { getTimestamp } from "../utils/utils";
|
|
4
4
|
|
|
@@ -458,7 +458,7 @@ export const handleServiceOperationError = ({
|
|
|
458
458
|
export const mapChannelsFromApiData = (
|
|
459
459
|
apiData: any,
|
|
460
460
|
entityId: string,
|
|
461
|
-
|
|
461
|
+
existingResources?: Resource[],
|
|
462
462
|
): {
|
|
463
463
|
serverChannels: Channel[];
|
|
464
464
|
clientChannels: Channel[];
|
|
@@ -486,12 +486,17 @@ export const mapChannelsFromApiData = (
|
|
|
486
486
|
collectPublic(apiData.client);
|
|
487
487
|
collectPublic(apiData.duplex);
|
|
488
488
|
|
|
489
|
-
const mapChannels = (section: any, target: Channel[]
|
|
489
|
+
const mapChannels = (section: any, target: Channel[]) => {
|
|
490
490
|
if (!section) return;
|
|
491
491
|
Object.entries(section).forEach(
|
|
492
492
|
([channelName, channelData]: [string, any]) => {
|
|
493
493
|
if (channelName.endsWith(inboundSuffix)) return;
|
|
494
|
-
const
|
|
494
|
+
const hasGatewayResource = existingResources?.some(
|
|
495
|
+
(r) =>
|
|
496
|
+
(r.type === "port" || r.type === "domain") &&
|
|
497
|
+
(r.name === `${channelName}_port` || r.name === `${channelName}_domain`),
|
|
498
|
+
) ?? false;
|
|
499
|
+
|
|
495
500
|
target.push({
|
|
496
501
|
name: channelName,
|
|
497
502
|
from: entityId,
|
|
@@ -499,15 +504,15 @@ export const mapChannelsFromApiData = (
|
|
|
499
504
|
protocol: channelData.protocol as "http" | "tcp" | "https",
|
|
500
505
|
port: channelData.port,
|
|
501
506
|
portNum: channelData.port,
|
|
502
|
-
isPublic: publicChannelNames.has(channelName) ||
|
|
507
|
+
isPublic: publicChannelNames.has(channelName) || hasGatewayResource,
|
|
503
508
|
});
|
|
504
509
|
},
|
|
505
510
|
);
|
|
506
511
|
};
|
|
507
512
|
|
|
508
|
-
mapChannels(apiData.server, serverChannels
|
|
509
|
-
mapChannels(apiData.client, clientChannels
|
|
510
|
-
mapChannels(apiData.duplex, duplexChannels
|
|
513
|
+
mapChannels(apiData.server, serverChannels);
|
|
514
|
+
mapChannels(apiData.client, clientChannels);
|
|
515
|
+
mapChannels(apiData.duplex, duplexChannels);
|
|
511
516
|
|
|
512
517
|
return { serverChannels, clientChannels, duplexChannels };
|
|
513
518
|
};
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -1274,11 +1274,7 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
|
|
|
1274
1274
|
const channelsInfo = mapChannelsFromApiData(
|
|
1275
1275
|
response.payload.data,
|
|
1276
1276
|
serviceName,
|
|
1277
|
-
|
|
1278
|
-
serverChannels: service.serverChannels,
|
|
1279
|
-
clientChannels: service.clientChannels,
|
|
1280
|
-
duplexChannels: service.duplexChannels
|
|
1281
|
-
}
|
|
1277
|
+
service.resources,
|
|
1282
1278
|
);
|
|
1283
1279
|
service.serverChannels = channelsInfo.serverChannels;
|
|
1284
1280
|
service.clientChannels = channelsInfo.clientChannels;
|