@kumori/aurora-backend-handler 1.0.42 → 1.0.44

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.
@@ -435,7 +435,6 @@ export const updateService = async (
435
435
  }
436
436
 
437
437
  const jsonResponse = await response.json();
438
-
439
438
  const isTimeout = jsonResponse?.events?.some(
440
439
  (event: any) => event.content === "_timeout_",
441
440
  );
@@ -253,25 +253,21 @@ const updateServiceWithRevision = (
253
253
  const existingRevisionIndex = existingService.revisions.findIndex(
254
254
  (rev) => rev === entityId,
255
255
  );
256
- const shouldIncludeInList =
257
- newRevision.errorCode !== "COMPUTE_ERROR" &&
258
- eventData.status?.error?.code !== "COMPUTE_ERROR";
259
-
260
- let updatedRevisions;
261
- if (shouldIncludeInList) {
262
- updatedRevisions =
263
- existingRevisionIndex === -1
264
- ? [...existingService.revisions, entityId]
265
- : existingService.revisions;
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {