@kedaruma/revlm-client 1.0.43 → 1.0.44
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -181,6 +181,7 @@ type RevlmOptions = {
|
|
|
181
181
|
provisionalAuthDomain?: string;
|
|
182
182
|
autoSetToken?: boolean;
|
|
183
183
|
autoRefreshOn401?: boolean;
|
|
184
|
+
strictRefreshCookie?: boolean;
|
|
184
185
|
};
|
|
185
186
|
type RevlmResponse<T = any> = {
|
|
186
187
|
ok: boolean;
|
|
@@ -200,6 +201,7 @@ declare class Revlm {
|
|
|
200
201
|
private provisionalAuthDomain;
|
|
201
202
|
private autoSetToken;
|
|
202
203
|
private autoRefreshOn401;
|
|
204
|
+
private strictRefreshCookie;
|
|
203
205
|
constructor(baseUrl: string, opts?: RevlmOptions);
|
|
204
206
|
setToken(token: string): void;
|
|
205
207
|
getToken(): string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ type RevlmOptions = {
|
|
|
181
181
|
provisionalAuthDomain?: string;
|
|
182
182
|
autoSetToken?: boolean;
|
|
183
183
|
autoRefreshOn401?: boolean;
|
|
184
|
+
strictRefreshCookie?: boolean;
|
|
184
185
|
};
|
|
185
186
|
type RevlmResponse<T = any> = {
|
|
186
187
|
ok: boolean;
|
|
@@ -200,6 +201,7 @@ declare class Revlm {
|
|
|
200
201
|
private provisionalAuthDomain;
|
|
201
202
|
private autoSetToken;
|
|
202
203
|
private autoRefreshOn401;
|
|
204
|
+
private strictRefreshCookie;
|
|
203
205
|
constructor(baseUrl: string, opts?: RevlmOptions);
|
|
204
206
|
setToken(token: string): void;
|
|
205
207
|
getToken(): string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -156,6 +156,7 @@ var Revlm = class {
|
|
|
156
156
|
provisionalAuthDomain;
|
|
157
157
|
autoSetToken;
|
|
158
158
|
autoRefreshOn401;
|
|
159
|
+
strictRefreshCookie;
|
|
159
160
|
constructor(baseUrl, opts = {}) {
|
|
160
161
|
if (!baseUrl) throw new Error("baseUrl is required");
|
|
161
162
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -166,6 +167,7 @@ var Revlm = class {
|
|
|
166
167
|
this.provisionalAuthDomain = opts.provisionalAuthDomain || "";
|
|
167
168
|
this.autoSetToken = opts.autoSetToken ?? true;
|
|
168
169
|
this.autoRefreshOn401 = opts.autoRefreshOn401 || false;
|
|
170
|
+
this.strictRefreshCookie = opts.strictRefreshCookie || false;
|
|
169
171
|
if (!this.fetchImpl) {
|
|
170
172
|
throw new Error("No fetch implementation available. Provide fetchImpl in options or run in Node 18+ with global fetch.");
|
|
171
173
|
}
|
|
@@ -262,6 +264,9 @@ var Revlm = class {
|
|
|
262
264
|
}
|
|
263
265
|
if (allowAuthRetry && !retrying && res.status === 401 && !this.shouldSkipAuthRetry(path)) {
|
|
264
266
|
const refreshRes = await this.refreshToken();
|
|
267
|
+
if (this.strictRefreshCookie && !refreshRes.ok && refreshRes.reason === "no_refresh_secret") {
|
|
268
|
+
throw new Error("Refresh cookie missing. Provide a cookie-aware fetch implementation for Node/RN.");
|
|
269
|
+
}
|
|
265
270
|
if (refreshRes && refreshRes.ok && refreshRes.token) {
|
|
266
271
|
return this.requestWithRetry(path, method, body, { allowAuthRetry: false, retrying: true });
|
|
267
272
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -113,6 +113,7 @@ var Revlm = class {
|
|
|
113
113
|
provisionalAuthDomain;
|
|
114
114
|
autoSetToken;
|
|
115
115
|
autoRefreshOn401;
|
|
116
|
+
strictRefreshCookie;
|
|
116
117
|
constructor(baseUrl, opts = {}) {
|
|
117
118
|
if (!baseUrl) throw new Error("baseUrl is required");
|
|
118
119
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -123,6 +124,7 @@ var Revlm = class {
|
|
|
123
124
|
this.provisionalAuthDomain = opts.provisionalAuthDomain || "";
|
|
124
125
|
this.autoSetToken = opts.autoSetToken ?? true;
|
|
125
126
|
this.autoRefreshOn401 = opts.autoRefreshOn401 || false;
|
|
127
|
+
this.strictRefreshCookie = opts.strictRefreshCookie || false;
|
|
126
128
|
if (!this.fetchImpl) {
|
|
127
129
|
throw new Error("No fetch implementation available. Provide fetchImpl in options or run in Node 18+ with global fetch.");
|
|
128
130
|
}
|
|
@@ -219,6 +221,9 @@ var Revlm = class {
|
|
|
219
221
|
}
|
|
220
222
|
if (allowAuthRetry && !retrying && res.status === 401 && !this.shouldSkipAuthRetry(path)) {
|
|
221
223
|
const refreshRes = await this.refreshToken();
|
|
224
|
+
if (this.strictRefreshCookie && !refreshRes.ok && refreshRes.reason === "no_refresh_secret") {
|
|
225
|
+
throw new Error("Refresh cookie missing. Provide a cookie-aware fetch implementation for Node/RN.");
|
|
226
|
+
}
|
|
222
227
|
if (refreshRes && refreshRes.ok && refreshRes.token) {
|
|
223
228
|
return this.requestWithRetry(path, method, body, { allowAuthRetry: false, retrying: true });
|
|
224
229
|
}
|