@oxyhq/core 1.4.0 → 1.5.0
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.
|
@@ -251,6 +251,8 @@ function OxyServicesAuthMixin(Base) {
|
|
|
251
251
|
return await this.makeRequest('GET', `/api/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
252
252
|
}
|
|
253
253
|
catch (error) {
|
|
254
|
+
// Session is invalid — clear any cached user data for this session (#196)
|
|
255
|
+
this.clearCacheEntry(`GET:/api/session/user/${sessionId}`);
|
|
254
256
|
throw this.handleError(error);
|
|
255
257
|
}
|
|
256
258
|
}
|
|
@@ -85,7 +85,6 @@ async function retryAsync(operation, maxRetries = 3, baseDelay = 1000, shouldRet
|
|
|
85
85
|
*/
|
|
86
86
|
function debounceAsync(func, delay) {
|
|
87
87
|
let timeoutId;
|
|
88
|
-
const lastPromise = null;
|
|
89
88
|
return (...args) => {
|
|
90
89
|
return new Promise((resolve, reject) => {
|
|
91
90
|
clearTimeout(timeoutId);
|
|
@@ -248,6 +248,8 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
248
248
|
return await this.makeRequest('GET', `/api/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
249
249
|
}
|
|
250
250
|
catch (error) {
|
|
251
|
+
// Session is invalid — clear any cached user data for this session (#196)
|
|
252
|
+
this.clearCacheEntry(`GET:/api/session/user/${sessionId}`);
|
|
251
253
|
throw this.handleError(error);
|
|
252
254
|
}
|
|
253
255
|
}
|
|
@@ -71,7 +71,6 @@ export async function retryAsync(operation, maxRetries = 3, baseDelay = 1000, sh
|
|
|
71
71
|
*/
|
|
72
72
|
export function debounceAsync(func, delay) {
|
|
73
73
|
let timeoutId;
|
|
74
|
-
const lastPromise = null;
|
|
75
74
|
return (...args) => {
|
|
76
75
|
return new Promise((resolve, reject) => {
|
|
77
76
|
clearTimeout(timeoutId);
|
package/package.json
CHANGED
|
@@ -341,25 +341,27 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
341
341
|
* Validate session
|
|
342
342
|
*/
|
|
343
343
|
async validateSession(
|
|
344
|
-
sessionId: string,
|
|
344
|
+
sessionId: string,
|
|
345
345
|
options: {
|
|
346
346
|
deviceFingerprint?: string;
|
|
347
347
|
useHeaderValidation?: boolean;
|
|
348
348
|
} = {}
|
|
349
|
-
): Promise<{
|
|
350
|
-
valid: boolean;
|
|
351
|
-
expiresAt: string;
|
|
352
|
-
lastActivity: string;
|
|
349
|
+
): Promise<{
|
|
350
|
+
valid: boolean;
|
|
351
|
+
expiresAt: string;
|
|
352
|
+
lastActivity: string;
|
|
353
353
|
user: User;
|
|
354
354
|
sessionId?: string;
|
|
355
355
|
source?: string;
|
|
356
356
|
}> {
|
|
357
357
|
try {
|
|
358
|
-
const urlParams:
|
|
358
|
+
const urlParams: Record<string, string> = {};
|
|
359
359
|
if (options.deviceFingerprint) urlParams.deviceFingerprint = options.deviceFingerprint;
|
|
360
360
|
if (options.useHeaderValidation) urlParams.useHeaderValidation = 'true';
|
|
361
361
|
return await this.makeRequest('GET', `/api/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
362
362
|
} catch (error) {
|
|
363
|
+
// Session is invalid — clear any cached user data for this session (#196)
|
|
364
|
+
this.clearCacheEntry(`GET:/api/session/user/${sessionId}`);
|
|
363
365
|
throw this.handleError(error);
|
|
364
366
|
}
|
|
365
367
|
}
|
package/src/utils/asyncUtils.ts
CHANGED
|
@@ -103,8 +103,7 @@ export function debounceAsync<T extends (...args: any[]) => Promise<any>>(
|
|
|
103
103
|
delay: number
|
|
104
104
|
): (...args: Parameters<T>) => Promise<ReturnType<T>> {
|
|
105
105
|
let timeoutId: ReturnType<typeof setTimeout>;
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
return (...args: Parameters<T>): Promise<ReturnType<T>> => {
|
|
109
108
|
return new Promise((resolve, reject) => {
|
|
110
109
|
clearTimeout(timeoutId);
|