@kumori/aurora-backend-handler 1.0.53 → 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.
@@ -110,7 +110,7 @@ const processRolesAndInstances = (
110
110
 
111
111
  const instance: Instance = {
112
112
  id: instanceId,
113
- name: `${roleName}::${instanceId}`,
113
+ name: `${instanceId}`,
114
114
  status: instanceData.status.status,
115
115
  usage: {
116
116
  current: {
@@ -520,31 +520,9 @@ export const extractStructuredSchema = (
520
520
  | {} => {
521
521
  const configSchema = revisionData?.configSchema;
522
522
  if (!configSchema) return {};
523
-
524
- const deploymentName = revisionData?.solution?.top;
525
- const deployment = deploymentName
526
- ? revisionData?.solution?.deployments?.[deploymentName]
527
- : Object.values(revisionData?.solution?.deployments ?? {})[0];
528
- const rolesDefinition: Record<string, any> =
529
- (deployment as any)?.artifact?.description?.role ?? {};
530
-
531
- const mergedParameterValues: Record<string, any> = {};
532
- const mergedResourceValues: Record<string, any> = {};
533
-
534
- Object.values(rolesDefinition).forEach((roleData: any) => {
535
- const roleConfig = roleData?.artifact?.description?.config ?? {};
536
- Object.assign(mergedParameterValues, roleConfig.parameter ?? {});
537
- Object.assign(mergedResourceValues, roleConfig.resource ?? {});
538
- });
539
- const topLevelConfig = (deployment as any)?.config ?? {};
540
- const parameterValues: Record<string, any> = {
541
- ...topLevelConfig.parameter ?? {},
542
- ...mergedParameterValues,
543
- };
544
- const configResourceValues: Record<string, any> = {
545
- ...topLevelConfig.resource ?? {},
546
- ...mergedResourceValues,
547
- };
523
+ const deployedConfig = revisionData?.config?.config ?? {};
524
+ const parameterValues: Record<string, any> = deployedConfig.parameter ?? {};
525
+ const configResourceValues: Record<string, any> = deployedConfig.resource ?? {};
548
526
 
549
527
  const requiredParams: string[] =
550
528
  configSchema?.properties?.config?.required ?? [];
@@ -573,6 +551,20 @@ export const extractStructuredSchema = (
573
551
  },
574
552
  );
575
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
+
576
568
  const resolveResourceType = (
577
569
  configValue: any,
578
570
  ): { type: string; kind?: string } | null => {
@@ -621,12 +613,15 @@ export const extractStructuredSchema = (
621
613
  type: string;
622
614
  kind?: string;
623
615
  required: boolean;
616
+ value?: string;
624
617
  } = {
625
618
  name,
626
619
  type: resolved.type,
627
620
  required: requiredResources.includes(name),
628
621
  };
629
622
  if (resolved.kind) entry.kind = resolved.kind;
623
+ const value = resolveResourceValue(configValue);
624
+ if (value) entry.value = value;
630
625
  return entry;
631
626
  })
632
627
  .filter(Boolean) as {
@@ -634,6 +629,7 @@ export const extractStructuredSchema = (
634
629
  type: string;
635
630
  kind?: string;
636
631
  required: boolean;
632
+ value?: string;
637
633
  }[];
638
634
 
639
635
  return { parameters, resources };
@@ -715,13 +711,33 @@ export const processRevisionData = (
715
711
 
716
712
  const applySchemaToService = (svc: Service): Service => {
717
713
  if (!revisionData.revision || !("parameters" in schema)) return svc;
718
- const revisionId: string = revisionData.revision;
719
- return {
720
- ...svc,
721
- revisions: svc.revisions.map((rev) =>
722
- rev.id === revisionId ? { ...rev, schema } : rev,
723
- ),
724
- };
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 };
725
741
  };
726
742
 
727
743
  if (!deployment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {