@kumori/aurora-backend-handler 1.0.37 → 1.0.39

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.
@@ -370,7 +370,14 @@ export const handleRevisionEvent = ({
370
370
  serviceId,
371
371
  roleMap,
372
372
  );
373
+ const existingRevision = revisionsMap.get(revisionKey);
373
374
  const newRevision = createRevision(entityId, eventData, usedCpu, usedMemory);
375
+ if (
376
+ existingRevision?.schema &&
377
+ Object.keys(existingRevision.schema).length > 0
378
+ ) {
379
+ newRevision.schema = existingRevision.schema;
380
+ }
374
381
 
375
382
  let updatedService: Service | null = null;
376
383
  let updatedEnvironment: Environment | null = null;
@@ -585,10 +592,14 @@ export const processRevisionData = (
585
592
  const parameters = extractParametersFromConfig(config.parameter || {});
586
593
  const resources = extractResources(config.resource || {});
587
594
 
595
+ let schema: any = {};
596
+ if (revisionData.revision) {
597
+ schema = extractStructuredSchema(revisionData);
598
+ }
599
+
588
600
  if (revisionsMap && serviceId && revisionData.revision) {
589
601
  const revisionId: string = revisionData.revision;
590
602
  const revisionKey = `${serviceId}-${revisionId}`;
591
- const schema = extractStructuredSchema(revisionData);
592
603
  const existing = revisionsMap.get(revisionKey);
593
604
  if (existing) {
594
605
  revisionsMap.set(revisionKey, { ...existing, schema });
@@ -638,26 +649,35 @@ export const processRevisionData = (
638
649
  const deploymentName = solution.top || service.name;
639
650
  const deployment = solution.deployments[deploymentName];
640
651
 
652
+ const applySchemaToService = (svc: Service): Service => {
653
+ if (!revisionData.revision || !schema) return svc;
654
+ const revisionId: string = revisionData.revision;
655
+ return {
656
+ ...svc,
657
+ revisions: svc.revisions.map((rev) =>
658
+ rev.id === revisionId ? { ...rev, schema } : rev,
659
+ ),
660
+ };
661
+ };
662
+
641
663
  if (!deployment) {
642
664
  const firstDeploymentKey = Object.keys(solution.deployments)[0];
643
665
  if (firstDeploymentKey) {
644
- return processDeployment(
645
- service,
646
- solution.deployments[firstDeploymentKey],
647
- revisionData,
648
- parameters,
649
- resources,
666
+ return applySchemaToService(
667
+ processDeployment(
668
+ service,
669
+ solution.deployments[firstDeploymentKey],
670
+ revisionData,
671
+ parameters,
672
+ resources,
673
+ ),
650
674
  );
651
675
  }
652
- return { ...service, parameters, resources };
676
+ return applySchemaToService({ ...service, parameters, resources });
653
677
  }
654
678
 
655
- return processDeployment(
656
- service,
657
- deployment,
658
- revisionData,
659
- parameters,
660
- resources,
679
+ return applySchemaToService(
680
+ processDeployment(service, deployment, revisionData, parameters, resources),
661
681
  );
662
682
  };
663
683
 
@@ -946,4 +966,3 @@ const extractResourceName = (resourcePath: string): string => {
946
966
  }
947
967
  return resourcePath;
948
968
  };
949
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {