@kumori/aurora-backend-handler 1.1.21 → 1.1.23

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -599,7 +599,7 @@ const rebuildHierarchy = () => {
599
599
  notificationsEnabled: preservedUserData.notificationsEnabled,
600
600
  organizations: Array.from(organizationsMap.values()),
601
601
  clusterTokens: Array.from(clusterTokensMap.values()),
602
- tokens: preservedUserData.tokens || [],
602
+ tokens: tokenMap.size > 0 ? (preservedUserData.tokens || []).filter(t => tokenMap.has(t.name)) : (preservedUserData.tokens || []),
603
603
  tenants: Array.from(tenantsMap.values()),
604
604
  axebowPlan: preservedUserData.axebowPlan,
605
605
  companyName: preservedUserData.companyName,
@@ -1823,7 +1823,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1823
1823
  if (tokenIndex !== -1) {
1824
1824
  const deletedToken = userData.tokens[tokenIndex];
1825
1825
  userData.tokens.splice(tokenIndex, 1);
1826
-
1826
+ tokenMap.delete(tokenId);
1827
1827
  const tokenNotification: Notification = {
1828
1828
  type: "success",
1829
1829
  subtype: "token-deleted",
@@ -1966,10 +1966,9 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
1966
1966
  const localOnlyTokens = (userData.tokens || []).filter(
1967
1967
  (t) => !incomingTokenNames.has(t.name)
1968
1968
  );
1969
- const mergedTokens = [
1970
- ...(updatedUserData.tokens || []),
1971
- ...localOnlyTokens,
1972
- ];
1969
+ const mergedTokens = [...(updatedUserData.tokens || []), ...localOnlyTokens]
1970
+ .filter((t, index, arr) => arr.findIndex(x => x.name === t.name) === index)
1971
+ .filter(t => tokenMap.size === 0 || tokenMap.has(t.name));
1973
1972
 
1974
1973
  userData = {
1975
1974
  id: updatedUserData.id || userData.id,