diff --git a/lib/build/recipe/multitenancy/error.d.ts b/lib/build/recipe/multitenancy/error.d.ts index 14c210693..486758b61 100644 --- a/lib/build/recipe/multitenancy/error.d.ts +++ b/lib/build/recipe/multitenancy/error.d.ts @@ -1,8 +1,5 @@ // @ts-nocheck import STError from "../../error"; -export declare class TenantDoesNotExistError extends STError { - constructor(options: { type: "TENANT_DOES_NOT_EXIST_ERROR"; message: string }); -} -export declare class RecipeDisabledForTenantError extends STError { - constructor(options: { type: "RECIPE_DISABLED_FOR_TENANT_ERROR"; message: string }); +export default class SessionError extends STError { + constructor(options: { type: "BAD_INPUT_ERROR"; message: string }); } diff --git a/lib/build/recipe/multitenancy/error.js b/lib/build/recipe/multitenancy/error.js index 734760c67..c6c1f6ccc 100644 --- a/lib/build/recipe/multitenancy/error.js +++ b/lib/build/recipe/multitenancy/error.js @@ -19,17 +19,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.RecipeDisabledForTenantError = exports.TenantDoesNotExistError = void 0; const error_1 = __importDefault(require("../../error")); -class TenantDoesNotExistError extends error_1.default { +class SessionError extends error_1.default { constructor(options) { super(Object.assign({}, options)); + this.fromRecipe = "multitenancy"; } } -exports.TenantDoesNotExistError = TenantDoesNotExistError; -class RecipeDisabledForTenantError extends error_1.default { - constructor(options) { - super(Object.assign({}, options)); - } -} -exports.RecipeDisabledForTenantError = RecipeDisabledForTenantError; +exports.default = SessionError; diff --git a/lib/build/recipe/multitenancy/index.d.ts b/lib/build/recipe/multitenancy/index.d.ts index ff639cb9e..48fe84c57 100644 --- a/lib/build/recipe/multitenancy/index.d.ts +++ b/lib/build/recipe/multitenancy/index.d.ts @@ -2,7 +2,6 @@ import Recipe from "./recipe"; import { RecipeInterface, APIOptions, APIInterface } from "./types"; import { ProviderConfig } from "../thirdparty/types"; -import { RecipeDisabledForTenantError, TenantDoesNotExistError } from "./error"; import { AllowedDomainsClaim } from "./allowedDomainsClaim"; export default class Wrapper { static init: typeof Recipe.init; @@ -120,6 +119,5 @@ export declare let createOrUpdateThirdPartyConfig: typeof Wrapper.createOrUpdate export declare let deleteThirdPartyConfig: typeof Wrapper.deleteThirdPartyConfig; export declare let associateUserToTenant: typeof Wrapper.associateUserToTenant; export declare let disassociateUserFromTenant: typeof Wrapper.disassociateUserFromTenant; -export { RecipeDisabledForTenantError, TenantDoesNotExistError }; export { AllowedDomainsClaim }; export type { RecipeInterface, APIOptions, APIInterface }; diff --git a/lib/build/recipe/multitenancy/index.js b/lib/build/recipe/multitenancy/index.js index 24ab093be..4d1b70484 100644 --- a/lib/build/recipe/multitenancy/index.js +++ b/lib/build/recipe/multitenancy/index.js @@ -50,21 +50,8 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AllowedDomainsClaim = exports.TenantDoesNotExistError = exports.RecipeDisabledForTenantError = exports.disassociateUserFromTenant = exports.associateUserToTenant = exports.deleteThirdPartyConfig = exports.createOrUpdateThirdPartyConfig = exports.listAllTenants = exports.getTenant = exports.deleteTenant = exports.createOrUpdateTenant = exports.init = void 0; +exports.AllowedDomainsClaim = exports.disassociateUserFromTenant = exports.associateUserToTenant = exports.deleteThirdPartyConfig = exports.createOrUpdateThirdPartyConfig = exports.listAllTenants = exports.getTenant = exports.deleteTenant = exports.createOrUpdateTenant = exports.init = void 0; const recipe_1 = __importDefault(require("./recipe")); -const error_1 = require("./error"); -Object.defineProperty(exports, "RecipeDisabledForTenantError", { - enumerable: true, - get: function () { - return error_1.RecipeDisabledForTenantError; - }, -}); -Object.defineProperty(exports, "TenantDoesNotExistError", { - enumerable: true, - get: function () { - return error_1.TenantDoesNotExistError; - }, -}); const allowedDomainsClaim_1 = require("./allowedDomainsClaim"); Object.defineProperty(exports, "AllowedDomainsClaim", { enumerable: true, diff --git a/lib/build/recipe/thirdparty/api/authorisationUrl.js b/lib/build/recipe/thirdparty/api/authorisationUrl.js index b2b86fd3c..bec8d8c52 100644 --- a/lib/build/recipe/thirdparty/api/authorisationUrl.js +++ b/lib/build/recipe/thirdparty/api/authorisationUrl.js @@ -52,8 +52,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); const error_1 = __importDefault(require("../error")); -const multitenancy_1 = require("../../multitenancy"); -const constants_1 = require("../../multitenancy/constants"); function authorisationUrlAPI(apiImplementation, tenantId, options, userContext) { return __awaiter(this, void 0, void 0, function* () { if (apiImplementation.authorisationUrlGET === undefined) { @@ -80,14 +78,6 @@ function authorisationUrlAPI(apiImplementation, tenantId, options, userContext) tenantId, userContext, }); - if (!providerResponse.thirdPartyEnabled) { - throw new multitenancy_1.RecipeDisabledForTenantError({ - type: "RECIPE_DISABLED_FOR_TENANT_ERROR", - message: `The third party recipe is disabled for ${ - tenantId === undefined || tenantId === constants_1.DEFAULT_TENANT_ID ? "default tenant" : tenantId - }`, - }); - } const provider = providerResponse.provider; let result = yield apiImplementation.authorisationUrlGET({ provider, diff --git a/lib/build/recipe/thirdparty/api/signinup.js b/lib/build/recipe/thirdparty/api/signinup.js index 4bf7a9d4c..0fe96430d 100644 --- a/lib/build/recipe/thirdparty/api/signinup.js +++ b/lib/build/recipe/thirdparty/api/signinup.js @@ -52,8 +52,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const error_1 = __importDefault(require("../error")); const utils_1 = require("../../../utils"); -const multitenancy_1 = require("../../multitenancy"); -const constants_1 = require("../../multitenancy/constants"); function signInUpAPI(apiImplementation, tenantId, options, userContext) { return __awaiter(this, void 0, void 0, function* () { if (apiImplementation.signInUpPOST === undefined) { @@ -92,14 +90,6 @@ function signInUpAPI(apiImplementation, tenantId, options, userContext) { clientType, userContext, }); - if (!providerResponse.thirdPartyEnabled) { - throw new multitenancy_1.RecipeDisabledForTenantError({ - type: "RECIPE_DISABLED_FOR_TENANT_ERROR", - message: `The third party recipe is disabled for ${ - tenantId === undefined || tenantId === constants_1.DEFAULT_TENANT_ID ? "default tenant" : tenantId - }`, - }); - } const provider = providerResponse.provider; let result = yield apiImplementation.signInUpPOST({ provider, diff --git a/lib/build/recipe/thirdparty/index.d.ts b/lib/build/recipe/thirdparty/index.d.ts index edb505be3..edb66d5f2 100644 --- a/lib/build/recipe/thirdparty/index.d.ts +++ b/lib/build/recipe/thirdparty/index.d.ts @@ -13,7 +13,6 @@ export default class Wrapper { ): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; static manuallyCreateOrUpdateUser( thirdPartyId: string, diff --git a/lib/build/recipe/thirdparty/types.d.ts b/lib/build/recipe/thirdparty/types.d.ts index cbda028bc..618047787 100644 --- a/lib/build/recipe/thirdparty/types.d.ts +++ b/lib/build/recipe/thirdparty/types.d.ts @@ -154,7 +154,6 @@ export declare type RecipeInterface = { }): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; signInUp(input: { thirdPartyId: string; diff --git a/lib/build/recipe/thirdpartyemailpassword/index.d.ts b/lib/build/recipe/thirdpartyemailpassword/index.d.ts index b0638f1fb..6b9c81dae 100644 --- a/lib/build/recipe/thirdpartyemailpassword/index.d.ts +++ b/lib/build/recipe/thirdpartyemailpassword/index.d.ts @@ -15,7 +15,6 @@ export default class Wrapper { ): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; static thirdPartyManuallyCreateOrUpdateUser( thirdPartyId: string, diff --git a/lib/build/recipe/thirdpartyemailpassword/types.d.ts b/lib/build/recipe/thirdpartyemailpassword/types.d.ts index 168877371..6eaf8f068 100644 --- a/lib/build/recipe/thirdpartyemailpassword/types.d.ts +++ b/lib/build/recipe/thirdpartyemailpassword/types.d.ts @@ -93,7 +93,6 @@ export declare type RecipeInterface = { }): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; thirdPartySignInUp(input: { thirdPartyId: string; diff --git a/lib/build/recipe/thirdpartypasswordless/index.d.ts b/lib/build/recipe/thirdpartypasswordless/index.d.ts index 3709b8d4d..980449135 100644 --- a/lib/build/recipe/thirdpartypasswordless/index.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/index.d.ts @@ -22,7 +22,6 @@ export default class Wrapper { ): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; static thirdPartyManuallyCreateOrUpdateUser( thirdPartyId: string, diff --git a/lib/build/recipe/thirdpartypasswordless/types.d.ts b/lib/build/recipe/thirdpartypasswordless/types.d.ts index d27303681..a057b8a39 100644 --- a/lib/build/recipe/thirdpartypasswordless/types.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/types.d.ts @@ -179,7 +179,6 @@ export declare type RecipeInterface = { }): Promise<{ status: "OK"; provider: TypeProvider; - thirdPartyEnabled: boolean; }>; createCode: ( input: ( diff --git a/lib/ts/recipe/multitenancy/error.ts b/lib/ts/recipe/multitenancy/error.ts index d009616e4..be361ff9c 100644 --- a/lib/ts/recipe/multitenancy/error.ts +++ b/lib/ts/recipe/multitenancy/error.ts @@ -15,18 +15,11 @@ import STError from "../../error"; -export class TenantDoesNotExistError extends STError { - constructor(options: { type: "TENANT_DOES_NOT_EXIST_ERROR"; message: string }) { - super({ - ...options, - }); - } -} - -export class RecipeDisabledForTenantError extends STError { - constructor(options: { type: "RECIPE_DISABLED_FOR_TENANT_ERROR"; message: string }) { +export default class SessionError extends STError { + constructor(options: { type: "BAD_INPUT_ERROR"; message: string }) { super({ ...options, }); + this.fromRecipe = "multitenancy"; } } diff --git a/lib/ts/recipe/multitenancy/index.ts b/lib/ts/recipe/multitenancy/index.ts index 2a30bda96..28c8acd7d 100644 --- a/lib/ts/recipe/multitenancy/index.ts +++ b/lib/ts/recipe/multitenancy/index.ts @@ -16,7 +16,6 @@ import Recipe from "./recipe"; import { RecipeInterface, APIOptions, APIInterface } from "./types"; import { ProviderConfig } from "../thirdparty/types"; -import { RecipeDisabledForTenantError, TenantDoesNotExistError } from "./error"; import { AllowedDomainsClaim } from "./allowedDomainsClaim"; export default class Wrapper { @@ -195,6 +194,5 @@ export let deleteThirdPartyConfig = Wrapper.deleteThirdPartyConfig; export let associateUserToTenant = Wrapper.associateUserToTenant; export let disassociateUserFromTenant = Wrapper.disassociateUserFromTenant; -export { RecipeDisabledForTenantError, TenantDoesNotExistError }; export { AllowedDomainsClaim }; export type { RecipeInterface, APIOptions, APIInterface }; diff --git a/lib/ts/recipe/thirdparty/api/authorisationUrl.ts b/lib/ts/recipe/thirdparty/api/authorisationUrl.ts index 6e8d5e814..a25f6546f 100644 --- a/lib/ts/recipe/thirdparty/api/authorisationUrl.ts +++ b/lib/ts/recipe/thirdparty/api/authorisationUrl.ts @@ -16,8 +16,6 @@ import { send200Response } from "../../../utils"; import STError from "../error"; import { APIInterface, APIOptions } from "../"; -import { RecipeDisabledForTenantError } from "../../multitenancy"; -import { DEFAULT_TENANT_ID } from "../../multitenancy/constants"; export default async function authorisationUrlAPI( apiImplementation: APIInterface, @@ -54,15 +52,6 @@ export default async function authorisationUrlAPI( userContext, }); - if (!providerResponse.thirdPartyEnabled) { - throw new RecipeDisabledForTenantError({ - type: "RECIPE_DISABLED_FOR_TENANT_ERROR", - message: `The third party recipe is disabled for ${ - tenantId === undefined || tenantId === DEFAULT_TENANT_ID ? "default tenant" : tenantId - }`, - }); - } - const provider = providerResponse.provider; let result = await apiImplementation.authorisationUrlGET({ provider, diff --git a/lib/ts/recipe/thirdparty/api/signinup.ts b/lib/ts/recipe/thirdparty/api/signinup.ts index 862df5e59..a1c715a15 100644 --- a/lib/ts/recipe/thirdparty/api/signinup.ts +++ b/lib/ts/recipe/thirdparty/api/signinup.ts @@ -16,8 +16,6 @@ import STError from "../error"; import { send200Response } from "../../../utils"; import { APIInterface, APIOptions } from "../"; -import { RecipeDisabledForTenantError } from "../../multitenancy"; -import { DEFAULT_TENANT_ID } from "../../multitenancy/constants"; export default async function signInUpAPI( apiImplementation: APIInterface, @@ -73,15 +71,6 @@ export default async function signInUpAPI( userContext, }); - if (!providerResponse.thirdPartyEnabled) { - throw new RecipeDisabledForTenantError({ - type: "RECIPE_DISABLED_FOR_TENANT_ERROR", - message: `The third party recipe is disabled for ${ - tenantId === undefined || tenantId === DEFAULT_TENANT_ID ? "default tenant" : tenantId - }`, - }); - } - const provider = providerResponse.provider; let result = await apiImplementation.signInUpPOST({ diff --git a/lib/ts/recipe/thirdparty/types.ts b/lib/ts/recipe/thirdparty/types.ts index ac3aa0528..4de6726d8 100644 --- a/lib/ts/recipe/thirdparty/types.ts +++ b/lib/ts/recipe/thirdparty/types.ts @@ -160,7 +160,7 @@ export type RecipeInterface = { tenantId: string; clientType?: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }>; + }): Promise<{ status: "OK"; provider: TypeProvider }>; signInUp(input: { thirdPartyId: string; diff --git a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts index fe6c22a46..2768d8b87 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts +++ b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts @@ -86,7 +86,7 @@ export default function getRecipeInterface( clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }> { + }): Promise<{ status: "OK"; provider: TypeProvider }> { if (originalThirdPartyImplementation === undefined) { throw new Error("No thirdparty provider configured"); } diff --git a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/thirdPartyRecipeImplementation.ts b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/thirdPartyRecipeImplementation.ts index 5e828113d..279276910 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/thirdPartyRecipeImplementation.ts +++ b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/thirdPartyRecipeImplementation.ts @@ -91,7 +91,7 @@ export default function getRecipeInterface(recipeInterface: ThirdPartyEmailPassw clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }> { + }): Promise<{ status: "OK"; provider: TypeProvider }> { return await recipeInterface.thirdPartyGetProvider(input); }, diff --git a/lib/ts/recipe/thirdpartyemailpassword/types.ts b/lib/ts/recipe/thirdpartyemailpassword/types.ts index 5f62c9665..5b2325423 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/types.ts +++ b/lib/ts/recipe/thirdpartyemailpassword/types.ts @@ -115,7 +115,7 @@ export type RecipeInterface = { clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }>; + }): Promise<{ status: "OK"; provider: TypeProvider }>; thirdPartySignInUp(input: { thirdPartyId: string; diff --git a/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/index.ts b/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/index.ts index 59f6ae4c6..9e04ad89e 100644 --- a/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/index.ts +++ b/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/index.ts @@ -110,7 +110,7 @@ export default function getRecipeInterface( clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }> { + }): Promise<{ status: "OK"; provider: TypeProvider }> { if (originalThirdPartyImplementation === undefined) { throw new Error("No thirdparty provider configured"); } diff --git a/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/thirdPartyRecipeImplementation.ts b/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/thirdPartyRecipeImplementation.ts index f4053c207..da2098122 100644 --- a/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/thirdPartyRecipeImplementation.ts +++ b/lib/ts/recipe/thirdpartypasswordless/recipeImplementation/thirdPartyRecipeImplementation.ts @@ -73,7 +73,7 @@ export default function getRecipeInterface(recipeInterface: ThirdPartyPasswordle clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }> { + }): Promise<{ status: "OK"; provider: TypeProvider }> { return await recipeInterface.thirdPartyGetProvider(input); }, diff --git a/lib/ts/recipe/thirdpartypasswordless/types.ts b/lib/ts/recipe/thirdpartypasswordless/types.ts index c3144df30..c61f2e8e6 100644 --- a/lib/ts/recipe/thirdpartypasswordless/types.ts +++ b/lib/ts/recipe/thirdpartypasswordless/types.ts @@ -192,7 +192,7 @@ export type RecipeInterface = { clientType?: string; tenantId: string; userContext: any; - }): Promise<{ status: "OK"; provider: TypeProvider; thirdPartyEnabled: boolean }>; + }): Promise<{ status: "OK"; provider: TypeProvider }>; createCode: ( input: (