@kumori/aurora-backend-handler 1.0.134 → 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.
@@ -1,5 +1,4 @@
1
1
  import { Account, errors, Notification } from "@kumori/aurora-interfaces";
2
- import { AccountStatus } from "@kumori/aurora-interfaces/enums/accountStatusEnum";
3
2
  import {
4
3
  initializeGlobalWebSocketClient,
5
4
  getWebSocketStatus,
@@ -622,11 +621,7 @@ export const createAccount = async (account: Account, security: Security) => {
622
621
  "account",
623
622
  account,
624
623
  );
625
- const updatedAccount: Account = {
626
- ...account,
627
- status: AccountStatus.ACTIVE,
628
- };
629
- eventHelper.account.publish.created(updatedAccount);
624
+ eventHelper.account.publish.created(account);
630
625
  return response;
631
626
  } catch (error) {
632
627
  console.error("Error creating account:", {
@@ -348,11 +348,6 @@ export const handleAccountEvent = ({
348
348
  };
349
349
 
350
350
 
351
- const resolveStatusAfterCreate = (existingAccount?: Account): string =>
352
- existingAccount?.status && existingAccount.status !== "pending"
353
- ? existingAccount.status
354
- : AccountStatus.ACTIVE;
355
-
356
351
  /**
357
352
  * Handles successful account operations (CREATE, UPDATE, DELETE).
358
353
  */
@@ -382,9 +377,7 @@ export const handleAccountOperationSuccess = ({
382
377
  const isCreate = action === "CREATE";
383
378
  const updatedAccount: Account = {
384
379
  ...originalData,
385
- status: isCreate
386
- ? resolveStatusAfterCreate(existingAccount)
387
- : existingAccount?.status || AccountStatus.ACTIVE,
380
+ status: existingAccount?.status || AccountStatus.ACTIVE,
388
381
  };
389
382
 
390
383
  return {
@@ -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),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.134",
3
+ "version": "1.0.136",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {