@kumori/aurora-backend-handler 1.0.42 → 1.0.43
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/api/service-api-service.ts +7 -1
- package/helpers/revision-helper.ts +11 -15
- package/package.json +1 -1
|
@@ -410,11 +410,15 @@ export const updateService = async (
|
|
|
410
410
|
const url = new URL(
|
|
411
411
|
`${environment.apiServer.baseUrl}/api/${environment.apiServer.apiVersion}/tenant/${data.tenant}/service/${data.name}/revision/${data.currentRevision}`,
|
|
412
412
|
);
|
|
413
|
+
console.log('DEBUG data', data);
|
|
413
414
|
if (data.dsl) {
|
|
414
415
|
url.searchParams.append("dsl", "true");
|
|
415
416
|
}
|
|
416
417
|
if (data.serviceData) {
|
|
418
|
+
console.log('DEBUG - Updating service with bundle data, URL:', url.toString());
|
|
419
|
+
console.log('DEBUG - Service data to update:', data.serviceData);
|
|
417
420
|
const formData = new FormData();
|
|
421
|
+
console.log('DEBUG - FormData before appending:', formData);
|
|
418
422
|
formData.append("type", "update-bundle");
|
|
419
423
|
formData.append("bundle", data.serviceData);
|
|
420
424
|
formData.append(
|
|
@@ -426,16 +430,18 @@ export const updateService = async (
|
|
|
426
430
|
);
|
|
427
431
|
formData.append("labels", JSON.stringify({ project: data.project }));
|
|
428
432
|
formData.append("comment", " ");
|
|
433
|
+
console.log('DEBUG - loaded FormData:', formData);
|
|
429
434
|
const response = await fetch(url.toString(), {
|
|
430
435
|
method: "POST",
|
|
431
436
|
body: formData,
|
|
432
437
|
});
|
|
438
|
+
console.log('DEBUG - Update service response:', response);
|
|
433
439
|
if (!response.ok) {
|
|
434
440
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
435
441
|
}
|
|
436
442
|
|
|
437
443
|
const jsonResponse = await response.json();
|
|
438
|
-
|
|
444
|
+
console.log('DEBUG - Update service JSON response:', jsonResponse);
|
|
439
445
|
const isTimeout = jsonResponse?.events?.some(
|
|
440
446
|
(event: any) => event.content === "_timeout_",
|
|
441
447
|
);
|
|
@@ -253,25 +253,21 @@ const updateServiceWithRevision = (
|
|
|
253
253
|
const existingRevisionIndex = existingService.revisions.findIndex(
|
|
254
254
|
(rev) => rev === entityId,
|
|
255
255
|
);
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} else {
|
|
267
|
-
updatedRevisions = existingService.revisions.filter(
|
|
268
|
-
(rev) => rev !== entityId,
|
|
269
|
-
);
|
|
270
|
-
}
|
|
256
|
+
const updatedRevisions =
|
|
257
|
+
existingRevisionIndex === -1
|
|
258
|
+
? [...existingService.revisions, entityId]
|
|
259
|
+
: existingService.revisions;
|
|
260
|
+
const currentRevisionTimestamp = Number(existingService.currentRevision) || 0;
|
|
261
|
+
const incomingRevisionTimestamp = Number(entityId) || 0;
|
|
262
|
+
const updatedCurrentRevision =
|
|
263
|
+
incomingRevisionTimestamp > currentRevisionTimestamp
|
|
264
|
+
? entityId
|
|
265
|
+
: existingService.currentRevision;
|
|
271
266
|
|
|
272
267
|
const updatedService: Service = {
|
|
273
268
|
...existingService,
|
|
274
269
|
revisions: updatedRevisions,
|
|
270
|
+
currentRevision: updatedCurrentRevision,
|
|
275
271
|
role: roles.length > 0 ? roles : existingService.role,
|
|
276
272
|
usage: newRevision.usage,
|
|
277
273
|
startedAt: newRevision.createdAt || existingService.startedAt,
|