@kumori/aurora-backend-handler 1.0.55 → 1.0.57

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.
@@ -215,19 +215,32 @@ const updateServiceWithRevision = (
215
215
  roles: Role[],
216
216
  ): { updatedService: Service; deploymentErrorEvent: Service | null } => {
217
217
  const existingRevisionIndex = existingService.revisions.findIndex(
218
- (rev) => rev.id === entityId,
218
+ (rev) => String(rev.id) === String(entityId),
219
219
  );
220
+ const existingRevision = existingRevisionIndex !== -1
221
+ ? existingService.revisions[existingRevisionIndex]
222
+ : null;
223
+ const hasExistingSchema = existingRevision?.schema &&
224
+ ("parameters" in existingRevision.schema || "resources" in existingRevision.schema);
225
+ const hasNewSchema = newRevision.schema &&
226
+ ("parameters" in newRevision.schema || "resources" in newRevision.schema);
227
+ if (hasExistingSchema && !hasNewSchema) {
228
+ newRevision.schema = existingRevision!.schema;
229
+ }
230
+
220
231
  const updatedRevisions: Revision[] =
221
232
  existingRevisionIndex === -1
222
233
  ? [...existingService.revisions, newRevision]
223
234
  : existingService.revisions.map((rev) =>
224
- rev.id === entityId ? newRevision : rev,
235
+ String(rev.id) === String(entityId) ? newRevision : rev,
225
236
  );
226
237
 
227
238
  const updatedService: Service = {
228
239
  ...existingService,
229
240
  revisions: updatedRevisions,
230
- currentRevision: entityId,
241
+ currentRevision: Number(entityId) >= Number(existingService.currentRevision ?? 0)
242
+ ? entityId
243
+ : existingService.currentRevision,
231
244
  role: roles.length > 0 ? roles : existingService.role,
232
245
  usage: newRevision.usage,
233
246
  startedAt: newRevision.createdAt || existingService.startedAt,
@@ -737,7 +750,12 @@ export const processRevisionData = (
737
750
  createdAt: "",
738
751
  },
739
752
  ];
740
- return { ...svc, revisions: updatedRevisions, currentRevision: revisionId };
753
+ const currentRevId = String(svc.currentRevision ?? "0");
754
+ return {
755
+ ...svc,
756
+ revisions: updatedRevisions,
757
+ currentRevision: Number(revisionId) >= Number(currentRevId) ? revisionId : svc.currentRevision,
758
+ };
741
759
  };
742
760
 
743
761
  if (!deployment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {