@kumori/aurora-backend-handler 1.1.20 → 1.1.22

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.20",
3
+ "version": "1.1.22",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -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",
@@ -1960,6 +1960,17 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
1960
1960
  try {
1961
1961
  const preservedNotifications =
1962
1962
  userData.notifications || updatedUserData.notifications || [];
1963
+ const incomingTokenNames = new Set(
1964
+ (updatedUserData.tokens || []).map((t) => t.name)
1965
+ );
1966
+ const localOnlyTokens = (userData.tokens || []).filter(
1967
+ (t) => !incomingTokenNames.has(t.name)
1968
+ );
1969
+ const mergedTokens = [
1970
+ ...(updatedUserData.tokens || []),
1971
+ ...localOnlyTokens,
1972
+ ];
1973
+
1963
1974
  userData = {
1964
1975
  id: updatedUserData.id || userData.id,
1965
1976
  name: updatedUserData.name || userData.name,
@@ -1971,7 +1982,7 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
1971
1982
  "",
1972
1983
  organizations: updatedUserData.organizations || [],
1973
1984
  clusterTokens: updatedUserData.clusterTokens || [],
1974
- tokens: updatedUserData.tokens || [],
1985
+ tokens: mergedTokens,
1975
1986
  tenants: updatedUserData.tenants || [],
1976
1987
  axebowPlan:
1977
1988
  updatedUserData.axebowPlan || userData.axebowPlan || "freemium",