@kumori/aurora-backend-handler 1.1.12 → 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.
@@ -436,10 +436,6 @@ export function handleParametersToGenerateData(
436
436
  * @returns A ServiceSpecForm object with the data of the service.
437
437
  */
438
438
  export function transformServiceToForm(service: Service): ServiceSpecForm {
439
- console.log(
440
- "DEBUG - transformServiceToForm (channels)",
441
- service.serverChannels,
442
- );
443
439
  return {
444
440
  tenantId: service.tenant,
445
441
  accountId: service.account,
@@ -14,7 +14,6 @@ let pendingLinks = new Map<string, Link[]>();
14
14
  * @param data Service object with the data of the service
15
15
  */
16
16
  export const deployService = async (data: Service, token: string) => {
17
- console.log("DEBUG - deployService", data);
18
17
  try {
19
18
  const url = new URL(
20
19
  `${environment.apiServer.baseUrl}/api/${environment.apiServer.apiVersion}/tenant/${data.tenant}/service/${data.name}`,
@@ -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,6 +458,7 @@ export const handleServiceOperationError = ({
458
458
  export const mapChannelsFromApiData = (
459
459
  apiData: any,
460
460
  entityId: string,
461
+ existingResources?: Resource[],
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) => {
@@ -491,6 +491,12 @@ export const mapChannelsFromApiData = (
491
491
  Object.entries(section).forEach(
492
492
  ([channelName, channelData]: [string, any]) => {
493
493
  if (channelName.endsWith(inboundSuffix)) return;
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
+
494
500
  target.push({
495
501
  name: channelName,
496
502
  from: entityId,
@@ -498,7 +504,7 @@ export const mapChannelsFromApiData = (
498
504
  protocol: channelData.protocol as "http" | "tcp" | "https",
499
505
  port: channelData.port,
500
506
  portNum: channelData.port,
501
- isPublic: publicChannelNames.has(channelName),
507
+ isPublic: publicChannelNames.has(channelName) || hasGatewayResource,
502
508
  });
503
509
  },
504
510
  );
@@ -509,4 +515,4 @@ export const mapChannelsFromApiData = (
509
515
  mapChannels(apiData.duplex, duplexChannels);
510
516
 
511
517
  return { serverChannels, clientChannels, duplexChannels };
512
- };
518
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -1274,6 +1274,7 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
1274
1274
  const channelsInfo = mapChannelsFromApiData(
1275
1275
  response.payload.data,
1276
1276
  serviceName,
1277
+ service.resources,
1277
1278
  );
1278
1279
  service.serverChannels = channelsInfo.serverChannels;
1279
1280
  service.clientChannels = channelsInfo.clientChannels;