@kumori/aurora-backend-handler 1.0.132 → 1.0.133

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,4 +1,5 @@
1
1
  import { Account, errors, Notification } from "@kumori/aurora-interfaces";
2
+ import { AccountStatus } from "@kumori/aurora-interfaces/enums/accountStatusEnum";
2
3
  import {
3
4
  initializeGlobalWebSocketClient,
4
5
  getWebSocketStatus,
@@ -621,7 +622,10 @@ export const createAccount = async (account: Account, security: Security) => {
621
622
  "account",
622
623
  account,
623
624
  );
624
- const updatedAccount: Account = { ...account, status: "pending" };
625
+ const updatedAccount: Account = {
626
+ ...account,
627
+ status: AccountStatus.ACTIVE,
628
+ };
625
629
  eventHelper.account.publish.created(updatedAccount);
626
630
  return response;
627
631
  } catch (error) {
@@ -128,11 +128,13 @@ const extractCloudProviderCredentials = (
128
128
  *
129
129
  * Priority order:
130
130
  * 1. Soft-deleted accounts → 'deleting'
131
- * 2. validCredentials status reported by the backend (covers both
131
+ * 2. No validCredentials object in the event → 'pending' (the
132
+ * credentials have not been validated yet)
133
+ * 3. validCredentials status reported by the backend (covers both
132
134
  * success and the async credential-validation path)
133
- * 3. Keep the existing status so we never regress a terminal state
135
+ * 4. Keep the existing status so we never regress a terminal state
134
136
  * (e.g. don't overwrite 'invalid_credentials' with 'pending')
135
- * 4. Default to 'pending' for brand-new accounts
137
+ * 5. Default to 'pending' for brand-new accounts
136
138
  */
137
139
  const determineAccountStatus = (
138
140
  eventData: any,
@@ -141,6 +143,9 @@ const determineAccountStatus = (
141
143
  if (eventData.meta?.deleted) {
142
144
  return "deleting";
143
145
  }
146
+ if (!eventData.status?.validCredentials) {
147
+ return "pending";
148
+ }
144
149
  const rawStatus: string | undefined =
145
150
  eventData.status?.validCredentials?.status;
146
151
  if (rawStatus) {
@@ -346,7 +351,7 @@ export const handleAccountEvent = ({
346
351
  const resolveStatusAfterCreate = (existingAccount?: Account): string =>
347
352
  existingAccount?.status && existingAccount.status !== "pending"
348
353
  ? existingAccount.status
349
- : "pending";
354
+ : AccountStatus.ACTIVE;
350
355
 
351
356
  /**
352
357
  * Handles successful account operations (CREATE, UPDATE, DELETE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.132",
3
+ "version": "1.0.133",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {