supertokens-website
Advanced tools
Comparing version 13.1.1 to 14.0.0
@@ -10,2 +10,10 @@ # Changelog | ||
## [14.0.0] - 2022-10-17 | ||
### Added | ||
- Adding an interceptor for XMLHttpRequest by default upon initializing SuperTokens | ||
- Marked `addAxiosInterceptors` as deprecated | ||
- Request interception can now be disabled by adding `superTokensDoNotDoInterception` to the hash of the request (works as a queryparam as well) | ||
## [13.1.1] - 2022-10-14 | ||
@@ -12,0 +20,0 @@ |
@@ -277,11 +277,14 @@ "use strict"; | ||
(0, logger_1.logDebugMessage)("responseInterceptor: started"); | ||
(0, | ||
logger_1.logDebugMessage)("responseInterceptor: already intercepted: " + response.headers["x-supertokens-xhr-intercepted"]); | ||
url = getUrlFromConfig(response.config); | ||
try { | ||
doNotDoInterception = | ||
typeof url === "string" && | ||
!(0, utils_1.shouldDoInterceptionBasedOnUrl)( | ||
url, | ||
fetch_1.default.config.apiDomain, | ||
fetch_1.default.config.cookieDomain | ||
); | ||
(typeof url === "string" && | ||
!(0, utils_1.shouldDoInterceptionBasedOnUrl)( | ||
url, | ||
fetch_1.default.config.apiDomain, | ||
fetch_1.default.config.cookieDomain | ||
)) || | ||
!!response.headers["x-supertokens-xhr-intercepted"]; | ||
} catch (err) { | ||
@@ -293,7 +296,10 @@ if (err.message === "Please provide a valid domain name") { | ||
// .origin gives the port as well.. | ||
doNotDoInterception = !(0, utils_1.shouldDoInterceptionBasedOnUrl)( | ||
windowHandler_1.default.getReferenceOrThrow().windowHandler.location.getOrigin(), | ||
fetch_1.default.config.apiDomain, | ||
fetch_1.default.config.cookieDomain | ||
); | ||
doNotDoInterception = | ||
!(0, utils_1.shouldDoInterceptionBasedOnUrl)( | ||
windowHandler_1.default | ||
.getReferenceOrThrow() | ||
.windowHandler.location.getOrigin(), | ||
fetch_1.default.config.apiDomain, | ||
fetch_1.default.config.cookieDomain | ||
) || !!response.headers["x-supertokens-xhr-intercepted"]; | ||
} else { | ||
@@ -338,2 +344,3 @@ throw err; | ||
response, | ||
undefined, | ||
true | ||
@@ -414,2 +421,7 @@ ) | ||
(0, logger_1.logDebugMessage)("responseErrorInterceptor: called"); | ||
(0, | ||
logger_1.logDebugMessage)("responseErrorInterceptor: already intercepted: " + (error.response && error.response.headers["x-supertokens-xhr-intercepted"])); | ||
if (error.response.headers["x-supertokens-xhr-intercepted"]) { | ||
throw error; | ||
} | ||
if ( | ||
@@ -416,0 +428,0 @@ !( |
@@ -51,3 +51,3 @@ import { RecipeInterface, NormalisedInputType, ResponseWithBody } from "./types"; | ||
export declare function onInvalidClaimResponse(response: ResponseWithBody): Promise<void>; | ||
declare type IdRefreshTokenType = { | ||
export declare type IdRefreshTokenType = { | ||
status: "NOT_EXISTS" | "MAY_EXIST"; | ||
@@ -63,2 +63,1 @@ } | { | ||
export declare function setFrontToken(frontToken: string | undefined): Promise<void>; | ||
export {}; |
@@ -15,2 +15,5 @@ import { ClaimValidationError, InputType, RecipeInterface, SessionClaim, SessionClaimValidator } from "./types"; | ||
}) => Promise<boolean>; | ||
/** | ||
* @deprecated | ||
*/ | ||
static addAxiosInterceptors: (axiosInstance: any, userContext?: any) => void; | ||
@@ -39,2 +42,5 @@ static signOut: (input?: { | ||
}) => Promise<boolean>; | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare let addAxiosInterceptors: (axiosInstance: any, userContext?: any) => void; | ||
@@ -41,0 +47,0 @@ export declare let signOut: (input?: { |
@@ -212,2 +212,5 @@ "use strict"; | ||
}; | ||
/** | ||
* @deprecated | ||
*/ | ||
AuthHttpRequest.addAxiosInterceptors = function(axiosInstance, userContext) { | ||
@@ -296,2 +299,5 @@ if (!fetch_1.default.initCalled) { | ||
exports.doesSessionExist = AuthHttpRequest.doesSessionExist; | ||
/** | ||
* @deprecated | ||
*/ | ||
exports.addAxiosInterceptors = AuthHttpRequest.addAxiosInterceptors; | ||
@@ -298,0 +304,0 @@ exports.signOut = AuthHttpRequest.signOut; |
@@ -153,4 +153,9 @@ "use strict"; | ||
var error_1 = require("./error"); | ||
var xmlhttprequest_1 = require("./xmlhttprequest"); | ||
function RecipeImplementation(recipeImplInput) { | ||
return { | ||
addXMLHttpRequestInterceptor: function(_) { | ||
(0, logger_1.logDebugMessage)("addXMLHttpRequestInterceptorAndReturnModified: called"); | ||
(0, xmlhttprequest_1.addInterceptorsToXMLHttpRequest)(); | ||
}, | ||
addFetchInterceptorsAndReturnModifiedFetch: function(input) { | ||
@@ -368,3 +373,7 @@ (0, logger_1.logDebugMessage)("addFetchInterceptorsAndReturnModifiedFetch: called"); | ||
case 2: | ||
body = input.response.data; | ||
if (typeof input.response.data === "string") { | ||
body = JSON.parse(input.response.data); | ||
} else { | ||
body = input.response.data; | ||
} | ||
_a.label = 3; | ||
@@ -371,0 +380,0 @@ case 3: |
@@ -82,2 +82,5 @@ import OverrideableBuilder from "supertokens-js-override"; | ||
}) => typeof fetch; | ||
addXMLHttpRequestInterceptor: (input: { | ||
userContext: any; | ||
}) => void; | ||
addAxiosInterceptors: (input: { | ||
@@ -84,0 +87,0 @@ axiosInstance: any; |
@@ -309,2 +309,7 @@ "use strict"; | ||
} | ||
// The safest/best way to add this is the hash as the browser strips it before sending | ||
// but we don't have a reason to limit checking to that part. | ||
if (toCheckUrl.includes("superTokensDoNotDoInterception")) { | ||
return false; | ||
} | ||
toCheckUrl = normaliseURLDomainOrThrowError(toCheckUrl); | ||
@@ -311,0 +316,0 @@ var urlObj = new URL(toCheckUrl); |
@@ -1,2 +0,2 @@ | ||
export declare const package_version = "13.1.1"; | ||
export declare const package_version = "14.0.0"; | ||
export declare const supported_fdi: string[]; |
@@ -18,3 +18,3 @@ "use strict"; | ||
*/ | ||
exports.package_version = "13.1.1"; | ||
exports.package_version = "14.0.0"; | ||
exports.supported_fdi = ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15"]; |
{ | ||
"name": "supertokens-website", | ||
"version": "13.1.1", | ||
"version": "14.0.0", | ||
"description": "frontend sdk for website to be used for auth solution.", | ||
@@ -68,3 +68,3 @@ "main": "index.js", | ||
"path": "lib/build/bundleEntry.js", | ||
"limit": "17kb" | ||
"limit": "18kb" | ||
} | ||
@@ -71,0 +71,0 @@ ], |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
341356
70
6815