@kedaruma/revlm-client 1.0.56 → 1.0.58
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/dist/{chunk-USEUCPFK.mjs → chunk-YHUJ52AP.mjs} +4 -19
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -19
- package/dist/index.mjs +1 -1
- package/dist/revlm-compat.js +4 -19
- package/dist/revlm-compat.mjs +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@kedaruma/revlm-client",
|
|
11
|
-
version: "1.0.
|
|
11
|
+
version: "1.0.58",
|
|
12
12
|
private: false,
|
|
13
13
|
description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
|
|
14
14
|
keywords: [
|
|
@@ -424,21 +424,6 @@ var Revlm = class {
|
|
|
424
424
|
return null;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
logTokenTtl(event, path, tokenOverride) {
|
|
428
|
-
const token = tokenOverride || this._token;
|
|
429
|
-
if (!token) return;
|
|
430
|
-
const payload = this.decodeJwtPayload(token);
|
|
431
|
-
if (!payload || typeof payload.exp !== "number") return;
|
|
432
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
433
|
-
const ttlSec = payload.exp - now;
|
|
434
|
-
this.logDebug("### token ttl", {
|
|
435
|
-
event,
|
|
436
|
-
path,
|
|
437
|
-
ttlSec,
|
|
438
|
-
exp: payload.exp,
|
|
439
|
-
iat: payload.iat
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
427
|
async signIfNeeded(_url, _method, headers, _body) {
|
|
443
428
|
return { signedUrl: _url, signedHeaders: headers };
|
|
444
429
|
}
|
|
@@ -478,11 +463,12 @@ var Revlm = class {
|
|
|
478
463
|
if (refreshRes.reason === "not_expired") {
|
|
479
464
|
return this.requestWithRetry(path, method, body, { allowAuthRetry: false, retrying: true });
|
|
480
465
|
}
|
|
481
|
-
|
|
466
|
+
const refreshFailed = {
|
|
482
467
|
reason: refreshRes.reason,
|
|
483
468
|
status: refreshRes.status,
|
|
484
469
|
error: refreshRes.error
|
|
485
|
-
}
|
|
470
|
+
};
|
|
471
|
+
this.logDebug("### refresh failed:", refreshFailed, JSON.stringify(refreshFailed));
|
|
486
472
|
if (refreshRes.reason === "no_refresh_secret") {
|
|
487
473
|
const missingError = new Error("Refresh cookie missing. Provide a cookie-aware fetch implementation for Node/RN.");
|
|
488
474
|
missingError.revlmReason = "no_refresh_secret";
|
|
@@ -505,7 +491,6 @@ var Revlm = class {
|
|
|
505
491
|
}
|
|
506
492
|
}
|
|
507
493
|
if (out.ok && !this.shouldSkipCookieCheck(path)) {
|
|
508
|
-
this.logTokenTtl("request_ok", path);
|
|
509
494
|
}
|
|
510
495
|
return out;
|
|
511
496
|
} catch (err) {
|
package/dist/index.d.mts
CHANGED
|
@@ -237,7 +237,6 @@ declare class Revlm {
|
|
|
237
237
|
private shouldSkipAuthRetry;
|
|
238
238
|
private shouldSkipCookieCheck;
|
|
239
239
|
private decodeJwtPayload;
|
|
240
|
-
private logTokenTtl;
|
|
241
240
|
private signIfNeeded;
|
|
242
241
|
private requestWithRetry;
|
|
243
242
|
login(authId: string, password: string): Promise<LoginResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -237,7 +237,6 @@ declare class Revlm {
|
|
|
237
237
|
private shouldSkipAuthRetry;
|
|
238
238
|
private shouldSkipCookieCheck;
|
|
239
239
|
private decodeJwtPayload;
|
|
240
|
-
private logTokenTtl;
|
|
241
240
|
private signIfNeeded;
|
|
242
241
|
private requestWithRetry;
|
|
243
242
|
login(authId: string, password: string): Promise<LoginResponse>;
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@kedaruma/revlm-client",
|
|
38
|
-
version: "1.0.
|
|
38
|
+
version: "1.0.58",
|
|
39
39
|
private: false,
|
|
40
40
|
description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
|
|
41
41
|
keywords: [
|
|
@@ -467,21 +467,6 @@ var Revlm = class {
|
|
|
467
467
|
return null;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
logTokenTtl(event, path, tokenOverride) {
|
|
471
|
-
const token = tokenOverride || this._token;
|
|
472
|
-
if (!token) return;
|
|
473
|
-
const payload = this.decodeJwtPayload(token);
|
|
474
|
-
if (!payload || typeof payload.exp !== "number") return;
|
|
475
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
476
|
-
const ttlSec = payload.exp - now;
|
|
477
|
-
this.logDebug("### token ttl", {
|
|
478
|
-
event,
|
|
479
|
-
path,
|
|
480
|
-
ttlSec,
|
|
481
|
-
exp: payload.exp,
|
|
482
|
-
iat: payload.iat
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
470
|
async signIfNeeded(_url, _method, headers, _body) {
|
|
486
471
|
return { signedUrl: _url, signedHeaders: headers };
|
|
487
472
|
}
|
|
@@ -521,11 +506,12 @@ var Revlm = class {
|
|
|
521
506
|
if (refreshRes.reason === "not_expired") {
|
|
522
507
|
return this.requestWithRetry(path, method, body, { allowAuthRetry: false, retrying: true });
|
|
523
508
|
}
|
|
524
|
-
|
|
509
|
+
const refreshFailed = {
|
|
525
510
|
reason: refreshRes.reason,
|
|
526
511
|
status: refreshRes.status,
|
|
527
512
|
error: refreshRes.error
|
|
528
|
-
}
|
|
513
|
+
};
|
|
514
|
+
this.logDebug("### refresh failed:", refreshFailed, JSON.stringify(refreshFailed));
|
|
529
515
|
if (refreshRes.reason === "no_refresh_secret") {
|
|
530
516
|
const missingError = new Error("Refresh cookie missing. Provide a cookie-aware fetch implementation for Node/RN.");
|
|
531
517
|
missingError.revlmReason = "no_refresh_secret";
|
|
@@ -548,7 +534,6 @@ var Revlm = class {
|
|
|
548
534
|
}
|
|
549
535
|
}
|
|
550
536
|
if (out.ok && !this.shouldSkipCookieCheck(path)) {
|
|
551
|
-
this.logTokenTtl("request_ok", path);
|
|
552
537
|
}
|
|
553
538
|
return out;
|
|
554
539
|
} catch (err) {
|
package/dist/index.mjs
CHANGED
package/dist/revlm-compat.js
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@kedaruma/revlm-client",
|
|
38
|
-
version: "1.0.
|
|
38
|
+
version: "1.0.58",
|
|
39
39
|
private: false,
|
|
40
40
|
description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
|
|
41
41
|
keywords: [
|
|
@@ -465,21 +465,6 @@ var Revlm = class {
|
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
logTokenTtl(event, path, tokenOverride) {
|
|
469
|
-
const token = tokenOverride || this._token;
|
|
470
|
-
if (!token) return;
|
|
471
|
-
const payload = this.decodeJwtPayload(token);
|
|
472
|
-
if (!payload || typeof payload.exp !== "number") return;
|
|
473
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
474
|
-
const ttlSec = payload.exp - now;
|
|
475
|
-
this.logDebug("### token ttl", {
|
|
476
|
-
event,
|
|
477
|
-
path,
|
|
478
|
-
ttlSec,
|
|
479
|
-
exp: payload.exp,
|
|
480
|
-
iat: payload.iat
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
468
|
async signIfNeeded(_url, _method, headers, _body) {
|
|
484
469
|
return { signedUrl: _url, signedHeaders: headers };
|
|
485
470
|
}
|
|
@@ -519,11 +504,12 @@ var Revlm = class {
|
|
|
519
504
|
if (refreshRes.reason === "not_expired") {
|
|
520
505
|
return this.requestWithRetry(path, method, body, { allowAuthRetry: false, retrying: true });
|
|
521
506
|
}
|
|
522
|
-
|
|
507
|
+
const refreshFailed = {
|
|
523
508
|
reason: refreshRes.reason,
|
|
524
509
|
status: refreshRes.status,
|
|
525
510
|
error: refreshRes.error
|
|
526
|
-
}
|
|
511
|
+
};
|
|
512
|
+
this.logDebug("### refresh failed:", refreshFailed, JSON.stringify(refreshFailed));
|
|
527
513
|
if (refreshRes.reason === "no_refresh_secret") {
|
|
528
514
|
const missingError = new Error("Refresh cookie missing. Provide a cookie-aware fetch implementation for Node/RN.");
|
|
529
515
|
missingError.revlmReason = "no_refresh_secret";
|
|
@@ -546,7 +532,6 @@ var Revlm = class {
|
|
|
546
532
|
}
|
|
547
533
|
}
|
|
548
534
|
if (out.ok && !this.shouldSkipCookieCheck(path)) {
|
|
549
|
-
this.logTokenTtl("request_ok", path);
|
|
550
535
|
}
|
|
551
536
|
return out;
|
|
552
537
|
} catch (err) {
|
package/dist/revlm-compat.mjs
CHANGED