@kumori/aurora-backend-handler 1.1.19 → 1.1.21
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 +1 -1
- package/websocket-manager.ts +16 -1
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -626,6 +626,7 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
626
626
|
: {};
|
|
627
627
|
switch (kind) {
|
|
628
628
|
case "user":
|
|
629
|
+
const previousTokens = userData.tokens || [];
|
|
629
630
|
const userEventResult = handleUserEvent({
|
|
630
631
|
eventData,
|
|
631
632
|
tenantsMap,
|
|
@@ -648,6 +649,9 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
648
649
|
},
|
|
649
650
|
);
|
|
650
651
|
userData = userEventResult.userData;
|
|
652
|
+
if (!userData.tokens?.length && previousTokens.length) {
|
|
653
|
+
userData.tokens = previousTokens;
|
|
654
|
+
}
|
|
651
655
|
tempProviders = userEventResult.tempProviders;
|
|
652
656
|
userEventResult.deletedTenantKeys.forEach((key) => {
|
|
653
657
|
tenantsMap.delete(key);
|
|
@@ -1956,6 +1960,17 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
|
|
|
1956
1960
|
try {
|
|
1957
1961
|
const preservedNotifications =
|
|
1958
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
|
+
|
|
1959
1974
|
userData = {
|
|
1960
1975
|
id: updatedUserData.id || userData.id,
|
|
1961
1976
|
name: updatedUserData.name || userData.name,
|
|
@@ -1967,7 +1982,7 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
|
|
|
1967
1982
|
"",
|
|
1968
1983
|
organizations: updatedUserData.organizations || [],
|
|
1969
1984
|
clusterTokens: updatedUserData.clusterTokens || [],
|
|
1970
|
-
tokens:
|
|
1985
|
+
tokens: mergedTokens,
|
|
1971
1986
|
tenants: updatedUserData.tenants || [],
|
|
1972
1987
|
axebowPlan:
|
|
1973
1988
|
updatedUserData.axebowPlan || userData.axebowPlan || "freemium",
|