@kumori/aurora-backend-handler 1.1.11 → 1.1.13

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.
@@ -458,6 +458,7 @@ export const handleServiceOperationError = ({
458
458
  export const mapChannelsFromApiData = (
459
459
  apiData: any,
460
460
  entityId: string,
461
+ existingChannels?: { serverChannels: Channel[]; clientChannels: Channel[]; duplexChannels: Channel[] },
461
462
  ): {
462
463
  serverChannels: Channel[];
463
464
  clientChannels: Channel[];
@@ -467,7 +468,6 @@ export const mapChannelsFromApiData = (
467
468
  const clientChannels: Channel[] = [];
468
469
  const duplexChannels: Channel[] = [];
469
470
  const inboundSuffix = "_inbound.inbound";
470
-
471
471
  const publicChannelNames = new Set<string>();
472
472
 
473
473
  const collectPublic = (section: any) => {
@@ -486,11 +486,12 @@ 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[], existing: 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 existingChannel = existing.find((ch) => ch.name === channelName);
494
495
  target.push({
495
496
  name: channelName,
496
497
  from: entityId,
@@ -498,15 +499,15 @@ export const mapChannelsFromApiData = (
498
499
  protocol: channelData.protocol as "http" | "tcp" | "https",
499
500
  port: channelData.port,
500
501
  portNum: channelData.port,
501
- isPublic: publicChannelNames.has(channelName),
502
+ isPublic: publicChannelNames.has(channelName) || existingChannel?.isPublic || false,
502
503
  });
503
504
  },
504
505
  );
505
506
  };
506
507
 
507
- mapChannels(apiData.server, serverChannels);
508
- mapChannels(apiData.client, clientChannels);
509
- mapChannels(apiData.duplex, duplexChannels);
508
+ mapChannels(apiData.server, serverChannels, existingChannels?.serverChannels);
509
+ mapChannels(apiData.client, clientChannels, existingChannels?.clientChannels);
510
+ mapChannels(apiData.duplex, duplexChannels, existingChannels?.duplexChannels);
510
511
 
511
512
  return { serverChannels, clientChannels, duplexChannels };
512
- };
513
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -1274,6 +1274,11 @@ 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
1282
  );
1278
1283
  service.serverChannels = channelsInfo.serverChannels;
1279
1284
  service.clientChannels = channelsInfo.clientChannels;