Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Jul 12, 2023
1 parent e5f6e9e commit 15d6cbc
Show file tree
Hide file tree
Showing 23 changed files with 16 additions and 97 deletions.
7 changes: 2 additions & 5 deletions lib/build/recipe/multitenancy/error.d.ts
Original file line number Diff line number Diff line change
@@ -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 });
}
12 changes: 3 additions & 9 deletions lib/build/recipe/multitenancy/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 0 additions & 2 deletions lib/build/recipe/multitenancy/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 };
15 changes: 1 addition & 14 deletions lib/build/recipe/multitenancy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions lib/build/recipe/thirdparty/api/authorisationUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions lib/build/recipe/thirdparty/api/signinup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdparty/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default class Wrapper {
): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
static manuallyCreateOrUpdateUser(
thirdPartyId: string,
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdparty/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export declare type RecipeInterface = {
}): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
signInUp(input: {
thirdPartyId: string;
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdpartyemailpassword/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default class Wrapper {
): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
static thirdPartyManuallyCreateOrUpdateUser(
thirdPartyId: string,
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdpartyemailpassword/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export declare type RecipeInterface = {
}): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
thirdPartySignInUp(input: {
thirdPartyId: string;
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdpartypasswordless/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default class Wrapper {
): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
static thirdPartyManuallyCreateOrUpdateUser(
thirdPartyId: string,
Expand Down
1 change: 0 additions & 1 deletion lib/build/recipe/thirdpartypasswordless/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export declare type RecipeInterface = {
}): Promise<{
status: "OK";
provider: TypeProvider;
thirdPartyEnabled: boolean;
}>;
createCode: (
input: (
Expand Down
13 changes: 3 additions & 10 deletions lib/ts/recipe/multitenancy/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
2 changes: 0 additions & 2 deletions lib/ts/recipe/multitenancy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 };
11 changes: 0 additions & 11 deletions lib/ts/recipe/thirdparty/api/authorisationUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 0 additions & 11 deletions lib/ts/recipe/thirdparty/api/signinup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdparty/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdpartyemailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdpartypasswordless/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down

0 comments on commit 15d6cbc

Please sign in to comment.