@kumori/aurora-backend-handler 1.1.72 → 1.1.74

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.
@@ -686,9 +686,10 @@ export const processRevisionData = (
686
686
  const schemaResult = revisionData.revision
687
687
  ? extractStructuredSchema(revisionData)
688
688
  : {};
689
+ console.log("DEBUG schemaResult", schemaResult);
689
690
  const schema =
690
691
  schemaResult && "parameters" in schemaResult ? schemaResult : {};
691
-
692
+ console.log("DEBUG schema", schema);
692
693
  if (
693
694
  revisionsMap &&
694
695
  serviceId &&
@@ -699,7 +700,9 @@ export const processRevisionData = (
699
700
  const revisionKey = `${serviceId}-${revisionId}`;
700
701
  const existing = revisionsMap.get(revisionKey);
701
702
  if (existing) {
703
+ console.log("DEBUG: Updating existing revision in revisionsMap", revisionKey, existing);
702
704
  revisionsMap.set(revisionKey, { ...existing, schema });
705
+ console.log("DEBUG: Updated revision in revisionsMap", revisionKey, revisionsMap.get(revisionKey));
703
706
  } else {
704
707
  revisionsMap.set(revisionKey, {
705
708
  id: revisionId,
@@ -740,6 +743,7 @@ export const processRevisionData = (
740
743
  errorMsg: "",
741
744
  createdAt: "",
742
745
  });
746
+ console.log("DEBUG: Added new revision to revisionsMap", revisionKey, revisionsMap.get(revisionKey));
743
747
  }
744
748
  }
745
749
 
@@ -808,6 +812,11 @@ export const processRevisionData = (
808
812
  ),
809
813
  );
810
814
  }
815
+ console.log("DEBUG: No deployment found in revisionData, applying schema to service with top-level parameters and resources.", service, topLevelParameters, topLevelResources, applySchemaToService({
816
+ ...service,
817
+ parameters: topLevelParameters,
818
+ resources: topLevelResources,
819
+ }));
811
820
  return applySchemaToService({
812
821
  ...service,
813
822
  parameters: topLevelParameters,
@@ -98,7 +98,7 @@ const parseKeyPath = (key: string): { [entity: string]: string } => {
98
98
  return result;
99
99
  };
100
100
 
101
- const getDefaultUsage = (): Usage => ({
101
+ const getDefaultUsage = (eventData?: any): Usage => ({
102
102
  current: {
103
103
  cpu: 0,
104
104
  memory: 0,
@@ -108,12 +108,12 @@ const getDefaultUsage = (): Usage => ({
108
108
  persistentStorage: 0,
109
109
  },
110
110
  limit: {
111
- cpu: { max: 0, min: 0 },
112
- memory: { max: 0, min: 0 },
113
- storage: { max: 0, min: 0 },
114
- volatileStorage: { max: 0, min: 0 },
115
- nonReplicatedStorage: { max: 0, min: 0 },
116
- persistentStorage: { max: 0, min: 0 },
111
+ cpu: { max: eventData.vcpu || 0, min: eventData.vcpu || 0 },
112
+ memory: { max: eventData.ram || 0, min: eventData.ram || 0 },
113
+ storage: { max: eventData.shared_disk || 0, min: eventData.shared_disk || 0 },
114
+ volatileStorage: { max: eventData.volatile_disk || 0, min: eventData.volatile_disk || 0 },
115
+ nonReplicatedStorage: { max: eventData.persistent_disk || 0, min: eventData.persistent_disk || 0 },
116
+ persistentStorage: { max: eventData.persistent_disk || 0, min: eventData.persistent_disk || 0 },
117
117
  },
118
118
  cost: 0,
119
119
  });
@@ -193,7 +193,12 @@ export const handleServiceEvent = ({
193
193
 
194
194
  const projectLabel = eventData.meta?.labels?.project;
195
195
  const serviceRoles = roleMap.get(serviceFullKey) || [];
196
- const serviceUsage = currentRevision?.usage || getDefaultUsage();
196
+ const serviceUsage = currentRevision?.usage || getDefaultUsage(eventData);
197
+ console.log("DEBUG currentRevision", currentRevision);
198
+ console.log("DEBUG currentRevision.usage", currentRevision?.usage);
199
+ console.log("DEBUG defaultData", getDefaultUsage(eventData));
200
+ console.log("DEBUG: serviceUsage", serviceUsage);
201
+
197
202
 
198
203
  const serviceRevisions: Revision[] = [];
199
204
  revisionsMap.forEach((revision, key) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.72",
3
+ "version": "1.1.74",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {