@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.
- package/api/service-api-service.ts +0 -1
- package/helpers/revision-helper.ts +11 -15
- package/package.json +1 -1
|
@@ -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,
|