@kumori/aurora-backend-handler 1.0.74 → 1.0.76

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.
@@ -209,30 +209,52 @@ export const restartService = async (data: Service, security: string) => {
209
209
  }
210
210
  };
211
211
  const generateLinkBody = (data: Service, link: Link) => {
212
- const originInClient = data.clientChannels.find(
213
- (channel) =>
214
- channel.name === link.originChannel || channel.from === link.originChannel
215
- );
216
- const originInServer = data.serverChannels.find(
217
- (channel) =>
218
- channel.name === link.originChannel || channel.from === link.originChannel
219
- );
220
- const originInDuplex = data.duplexChannels.find(
221
- (channel) =>
222
- channel.name === link.originChannel || channel.from === link.originChannel
223
- );
224
- const targetInClient = data.clientChannels.find(
225
- (channel) =>
226
- channel.name === link.targetChannel || channel.from === link.targetChannel
227
- );
228
- const targetInServer = data.serverChannels.find(
229
- (channel) =>
230
- channel.name === link.targetChannel || channel.from === link.targetChannel
231
- );
232
- const targetInDuplex = data.duplexChannels.find(
233
- (channel) =>
234
- channel.name === link.targetChannel || channel.from === link.targetChannel
235
- );
212
+ const generateLinkBody = (data: Service, link: Link) => {
213
+ const isOrigin = data.name === link.origin;
214
+ const isTarget = data.name === link.target;
215
+
216
+ const originInClient = isOrigin
217
+ ? data.clientChannels.find(
218
+ (channel) =>
219
+ channel.name === link.originChannel ||
220
+ channel.from === link.originChannel,
221
+ )
222
+ : undefined;
223
+ const originInServer = isOrigin
224
+ ? data.serverChannels.find(
225
+ (channel) =>
226
+ channel.name === link.originChannel ||
227
+ channel.from === link.originChannel,
228
+ )
229
+ : undefined;
230
+ const originInDuplex = isOrigin
231
+ ? data.duplexChannels.find(
232
+ (channel) =>
233
+ channel.name === link.originChannel ||
234
+ channel.from === link.originChannel,
235
+ )
236
+ : undefined;
237
+ const targetInClient = isTarget
238
+ ? data.clientChannels.find(
239
+ (channel) =>
240
+ channel.name === link.targetChannel ||
241
+ channel.from === link.targetChannel,
242
+ )
243
+ : undefined;
244
+ const targetInServer = isTarget
245
+ ? data.serverChannels.find(
246
+ (channel) =>
247
+ channel.name === link.targetChannel ||
248
+ channel.from === link.targetChannel,
249
+ )
250
+ : undefined;
251
+ const targetInDuplex = isTarget
252
+ ? data.duplexChannels.find(
253
+ (channel) =>
254
+ channel.name === link.targetChannel ||
255
+ channel.from === link.targetChannel,
256
+ )
257
+ : undefined;
236
258
 
237
259
  let linkBody;
238
260
  if (originInClient) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -773,17 +773,11 @@ const handleEvent = async (message: WSMessage) => {
773
773
  eventHelper.service.publish.deployed(serviceResult.service);
774
774
  }
775
775
  const serviceState = eventData.status?.state?.code;
776
- console.log("DEBUG service state:", serviceState);
777
776
  if (serviceState === "SERVICE_READY") {
778
777
  const serviceKey = `${parentParts.tenant}/${entityId}`;
779
778
  const serviceToRefresh = recentlyUpdatedServices.get(serviceKey);
780
- console.log(
781
- "DEBUG service to refresh after SERVICE_READY:",
782
- serviceToRefresh,
783
- );
784
779
  if (serviceToRefresh) {
785
780
  recentlyUpdatedServices.delete(serviceKey);
786
- console.log("DEBUG map after delete:", recentlyUpdatedServices);
787
781
  requestRevisionData(serviceToRefresh, "").catch((err) => {
788
782
  console.error(
789
783
  `[ws] Error fetching revision data after SERVICE_READY for ${serviceKey}:`,
@@ -1172,8 +1166,6 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
1172
1166
  const service = servicesMap.get(serviceKey);
1173
1167
  if (service) {
1174
1168
  recentlyUpdatedServices.set(serviceKey, service);
1175
- console.log('DEBUG recentlyUpdatedServices after UPDATE_CONFIG:', recentlyUpdatedServices);
1176
- console.log(`DEBUG Added ${serviceKey} to recentlyUpdatedServices after UPDATE_CONFIG`);
1177
1169
  }
1178
1170
  }
1179
1171
  }