@kumori/aurora-backend-handler 1.0.54 → 1.0.55
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/helpers/revision-helper.ts +45 -7
- package/package.json +1 -1
|
@@ -551,6 +551,20 @@ export const extractStructuredSchema = (
|
|
|
551
551
|
},
|
|
552
552
|
);
|
|
553
553
|
|
|
554
|
+
const resolveResourceValue = (configValue: any): string => {
|
|
555
|
+
if (!configValue || typeof configValue !== "object") return "";
|
|
556
|
+
if (typeof configValue.secret === "string") return extractResourceName(configValue.secret);
|
|
557
|
+
if (typeof configValue.domain === "string") return extractResourceName(configValue.domain);
|
|
558
|
+
if (typeof configValue.port === "string") return extractResourceName(configValue.port);
|
|
559
|
+
if (typeof configValue.certificate === "string") return extractResourceName(configValue.certificate);
|
|
560
|
+
if (typeof configValue.ca === "string") return extractResourceName(configValue.ca);
|
|
561
|
+
if (configValue.volume) {
|
|
562
|
+
const vol = configValue.volume;
|
|
563
|
+
return convertToGigabytes(vol.size, vol.unit)?.toString() ?? String(vol.size ?? "");
|
|
564
|
+
}
|
|
565
|
+
return "";
|
|
566
|
+
};
|
|
567
|
+
|
|
554
568
|
const resolveResourceType = (
|
|
555
569
|
configValue: any,
|
|
556
570
|
): { type: string; kind?: string } | null => {
|
|
@@ -599,12 +613,15 @@ export const extractStructuredSchema = (
|
|
|
599
613
|
type: string;
|
|
600
614
|
kind?: string;
|
|
601
615
|
required: boolean;
|
|
616
|
+
value?: string;
|
|
602
617
|
} = {
|
|
603
618
|
name,
|
|
604
619
|
type: resolved.type,
|
|
605
620
|
required: requiredResources.includes(name),
|
|
606
621
|
};
|
|
607
622
|
if (resolved.kind) entry.kind = resolved.kind;
|
|
623
|
+
const value = resolveResourceValue(configValue);
|
|
624
|
+
if (value) entry.value = value;
|
|
608
625
|
return entry;
|
|
609
626
|
})
|
|
610
627
|
.filter(Boolean) as {
|
|
@@ -612,6 +629,7 @@ export const extractStructuredSchema = (
|
|
|
612
629
|
type: string;
|
|
613
630
|
kind?: string;
|
|
614
631
|
required: boolean;
|
|
632
|
+
value?: string;
|
|
615
633
|
}[];
|
|
616
634
|
|
|
617
635
|
return { parameters, resources };
|
|
@@ -693,13 +711,33 @@ export const processRevisionData = (
|
|
|
693
711
|
|
|
694
712
|
const applySchemaToService = (svc: Service): Service => {
|
|
695
713
|
if (!revisionData.revision || !("parameters" in schema)) return svc;
|
|
696
|
-
const revisionId: string = revisionData.revision;
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
714
|
+
const revisionId: string = String(revisionData.revision);
|
|
715
|
+
const found = svc.revisions.some((rev) => String(rev.id) === revisionId);
|
|
716
|
+
const updatedRevisions = found
|
|
717
|
+
? svc.revisions.map((rev) =>
|
|
718
|
+
String(rev.id) === revisionId ? { ...rev, schema } : rev,
|
|
719
|
+
)
|
|
720
|
+
: [
|
|
721
|
+
...svc.revisions,
|
|
722
|
+
{
|
|
723
|
+
id: revisionId,
|
|
724
|
+
schema,
|
|
725
|
+
usage: svc.usage || {
|
|
726
|
+
current: { cpu: 0, memory: 0, storage: 0, volatileStorage: 0, nonReplicatedStorage: 0, persistentStorage: 0 },
|
|
727
|
+
limit: {
|
|
728
|
+
cpu: { max: 0, min: 0 }, memory: { max: 0, min: 0 },
|
|
729
|
+
storage: { max: 0, min: 0 }, volatileStorage: { max: 0, min: 0 },
|
|
730
|
+
nonReplicatedStorage: { max: 0, min: 0 }, persistentStorage: { max: 0, min: 0 },
|
|
731
|
+
},
|
|
732
|
+
cost: 0,
|
|
733
|
+
},
|
|
734
|
+
status: { code: "", message: "", timestamp: "", args: [] },
|
|
735
|
+
errorCode: "",
|
|
736
|
+
errorMsg: "",
|
|
737
|
+
createdAt: "",
|
|
738
|
+
},
|
|
739
|
+
];
|
|
740
|
+
return { ...svc, revisions: updatedRevisions, currentRevision: revisionId };
|
|
703
741
|
};
|
|
704
742
|
|
|
705
743
|
if (!deployment) {
|