@kumori/aurora-backend-handler 1.0.135 → 1.0.136
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.
|
@@ -98,6 +98,11 @@ const parseKeyPath = (key: string): { [entity: string]: string } => {
|
|
|
98
98
|
return result;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
const firstString = (value: unknown): string => {
|
|
102
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
103
|
+
return typeof first === "string" ? first : "";
|
|
104
|
+
};
|
|
105
|
+
|
|
101
106
|
const getDefaultUsage = (eventData?: any): Usage => ({
|
|
102
107
|
current: {
|
|
103
108
|
cpu: 0,
|
|
@@ -222,9 +227,9 @@ export const handleServiceEvent = ({
|
|
|
222
227
|
|
|
223
228
|
const baseServiceData = {
|
|
224
229
|
tenant: serviceTenantId,
|
|
225
|
-
account: eventData.spec.metadata.targetAccount || pathParts.account,
|
|
230
|
+
account: firstString(eventData.spec.metadata.targetAccount) || pathParts.account,
|
|
226
231
|
environment:
|
|
227
|
-
eventData.spec.metadata.targetEnvironment || pathParts.environment,
|
|
232
|
+
firstString(eventData.spec.metadata.targetEnvironment) || pathParts.environment,
|
|
228
233
|
name: entityId,
|
|
229
234
|
revisions: [...serviceRevisions].sort(
|
|
230
235
|
(a, b) => Number(b.id) - Number(a.id),
|