Skip to content

Commit

Permalink
chore: merge release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sharat87 committed Nov 15, 2024
2 parents 86c7684 + 7f2c4c6 commit e356d5a
Show file tree
Hide file tree
Showing 22 changed files with 344 additions and 288 deletions.
2 changes: 1 addition & 1 deletion .github/config.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,6 @@ Cypress.Commands.add("SignupFromAPI", (uname, pword) => {
cy.request({
method: "POST",
url: "api/v1/users",
headers: {
"content-type": "application/json",
},
followRedirect: false,
form: true,
body: {
Expand Down
9 changes: 9 additions & 0 deletions app/client/packages/rts/src/constants/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const BASE_API_URL = "http://localhost:8091";

export const RTS_BASE_PATH = "/rts";
export const RTS_BASE_API_PATH = "/rts-api/v1";
export const RTS_BASE_API_URL = `${BASE_API_URL}${RTS_BASE_API_PATH}`;

export const BASE_APPSMITH_API_URL =
process.env.APPSMITH_API_BASE_URL || "http://localhost:8080/api/v1";
export const INTERNAL_BASE_URL = "http://localhost:8080/internal/v1";
4 changes: 2 additions & 2 deletions app/client/packages/rts/src/middlewares/socket-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Socket } from "socket.io";
import log from "loglevel";
import axios from "axios";

const API_BASE_URL = process.env.APPSMITH_API_BASE_URL;
import { BASE_APPSMITH_API_URL } from "@constants/routes";

export async function tryAuth(socket: Socket) {
/* ********************************************************* */
Expand Down Expand Up @@ -35,7 +35,7 @@ export async function tryAuth(socket: Socket) {
try {
response = await axios.request({
method: "GET",
url: API_BASE_URL + "/users/me",
url: BASE_APPSMITH_API_URL + "/users/me",
headers: {
Cookie: sessionCookie,
},
Expand Down
11 changes: 1 addition & 10 deletions app/client/packages/rts/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ import ast_routes from "./routes/ast_routes";
import dsl_routes from "./routes/dsl_routes";
import health_check_routes from "./routes/health_check_routes";

const RTS_BASE_PATH = "/rts";

export const RTS_BASE_API_PATH = "/rts-api/v1";
import { RTS_BASE_PATH, RTS_BASE_API_PATH } from "@constants/routes";

// Setting the logLevel for all log messages
const logLevel: LogLevelDesc = (process.env.APPSMITH_LOG_LEVEL ||
"debug") as LogLevelDesc;

log.setLevel(logLevel);

const API_BASE_URL = process.env.APPSMITH_API_BASE_URL;

if (API_BASE_URL == null || API_BASE_URL === "") {
log.error("Please provide a valid value for `APPSMITH_API_BASE_URL`.");
process.exit(1);
}

const APPSMITH_RTS_PORT = process.env.APPSMITH_RTS_PORT || 8091;

//Disable x-powered-by header to prevent information disclosure
Expand Down
3 changes: 2 additions & 1 deletion app/client/packages/rts/src/test/server.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import app, { RTS_BASE_API_PATH } from "../server";
import app from "../server";
import { RTS_BASE_API_PATH } from "@constants/routes";
import supertest from "supertest";

const singleScript = {
Expand Down
36 changes: 0 additions & 36 deletions app/client/src/ce/api/UserApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ import type { ApiResponse } from "api/ApiResponses";
import type { FeatureFlags } from "ee/entities/FeatureFlag";
import type { ProductAlert } from "../../reducers/uiReducers/usersReducer";

export interface LoginUserRequest {
email: string;
password: string;
}

export interface CreateUserRequest {
email: string;
password: string;
}

export type CreateUserResponse = ApiResponse & {
email: string;
id: string;
};

export interface ForgotPasswordRequest {
email: string;
}
Expand All @@ -34,14 +19,6 @@ export interface VerifyTokenRequest {
token: string;
}

export type FetchUserResponse = ApiResponse & {
id: string;
};

export interface FetchUserRequest {
id: string;
}

export interface LeaveWorkspaceRequest {
workspaceId: string;
}
Expand Down Expand Up @@ -79,7 +56,6 @@ export class UserApi extends Api {
static inviteUserURL = "v1/users/invite";
static verifyInviteTokenURL = `${UserApi.inviteUserURL}/verify`;
static confirmUserInviteURL = `${UserApi.inviteUserURL}/confirm`;
static addWorkspaceURL = `${UserApi.usersURL}/addWorkspace`;
static leaveWorkspaceURL = `${UserApi.usersURL}/leaveWorkspace`;
static logoutURL = "v1/logout";
static currentUserURL = "v1/users/me";
Expand All @@ -89,24 +65,12 @@ export class UserApi extends Api {
static restartServerURL = "v1/admin/restart";
static sendTestEmailURL = "/v1/admin/send-test-email";

static async createUser(
request: CreateUserRequest,
): Promise<AxiosPromise<CreateUserResponse>> {
return Api.post(UserApi.usersURL, request);
}

static async updateUser(
request: UpdateUserRequest,
): Promise<AxiosPromise<ApiResponse>> {
return Api.put(UserApi.usersURL, request);
}

static async fetchUser(
request: FetchUserRequest,
): Promise<AxiosPromise<FetchUserResponse>> {
return Api.get(UserApi.usersURL + "/" + request.id);
}

static async getCurrentUser(): Promise<AxiosPromise<ApiResponse>> {
return Api.get(UserApi.currentUserURL);
}
Expand Down
3 changes: 0 additions & 3 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ const SnippingModeActionTypes = {
};

const UserAuthActionTypes = {
CREATE_USER_INIT: "CREATE_USER_INIT",
CREATE_USER_SUCCESS: "CREATE_USER_SUCCESS",
RESET_USER_PASSWORD_INIT: "RESET_USER_PASSWORD_INIT",
RESET_USER_PASSWORD_SUCCESS: "RESET_USER_PASSWORD_SUCCESS",
FORGOT_PASSWORD_INIT: "FORGOT_PASSWORD_INIT",
Expand All @@ -370,7 +368,6 @@ const UserAuthActionTypes = {
GET_OAUTH_ACCESS_TOKEN_SUCCESS: "GET_OAUTH_ACCESS_TOKEN_SUCCESS",
};
const UserAuthActionErrorTypes = {
CREATE_USER_ERROR: "CREATE_USER_ERROR",
RESET_USER_PASSWORD_ERROR: "RESET_USER_PASSWORD_ERROR",
FORGOT_PASSWORD_ERROR: "FORGOT_PASSWORD_ERROR",
RESET_PASSWORD_VERIFY_TOKEN_ERROR: "RESET_PASSWORD_VERIFY_TOKEN_ERROR",
Expand Down
52 changes: 0 additions & 52 deletions app/client/src/ce/sagas/userSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
} from "ee/constants/ReduxActionConstants";
import { reset } from "redux-form";
import type {
CreateUserRequest,
CreateUserResponse,
ForgotPasswordRequest,
VerifyTokenRequest,
TokenPasswordUpdateRequest,
Expand Down Expand Up @@ -87,56 +85,6 @@ import type {
} from "reducers/uiReducers/usersReducer";
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";
import * as Sentry from "@sentry/react";
import { Severity } from "@sentry/react";
export function* createUserSaga(
action: ReduxActionWithPromise<CreateUserRequest>,
) {
const { email, password, reject, resolve } = action.payload;

try {
const request: CreateUserRequest = { email, password };
const response: CreateUserResponse = yield callAPI(
UserApi.createUser,
request,
);
//TODO(abhinav): DRY this
const isValidResponse: boolean = yield validateResponse(response);

if (!isValidResponse) {
const errorMessage = getResponseErrorMessage(response);

yield call(reject, { _error: errorMessage });
} else {
//@ts-expect-error: response is of type unknown
const { email, id, name } = response.data;

yield put({
type: ReduxActionTypes.CREATE_USER_SUCCESS,
payload: {
email,
name,
id,
},
});
yield call(resolve);
}
} catch (error) {
yield call(reject, { _error: (error as Error).message });
yield put({
type: ReduxActionErrorTypes.CREATE_USER_ERROR,
payload: {
error,
},
});
Sentry.captureException("Sign up failed", {
level: Severity.Error,
extra: {
error: error,
},
});
}
}

export function* waitForSegmentInit(skipWithAnonymousId: boolean) {
if (skipWithAnonymousId && AnalyticsUtil.getAnonymousId()) return;
Expand Down
2 changes: 0 additions & 2 deletions app/client/src/ee/sagas/userSagas.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from "ce/sagas/userSagas";
import {
createUserSaga,
getCurrentUserSaga,
runUserSideEffectsSaga,
forgotPasswordSaga,
Expand All @@ -23,7 +22,6 @@ import { takeLatest, all } from "redux-saga/effects";

export default function* userSagas() {
yield all([
takeLatest(ReduxActionTypes.CREATE_USER_INIT, createUserSaga),
takeLatest(ReduxActionTypes.FETCH_USER_INIT, getCurrentUserSaga),
takeLatest(
ReduxActionTypes.FETCH_USER_DETAILS_SUCCESS,
Expand Down
74 changes: 7 additions & 67 deletions app/client/src/pages/UserAuth/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import { SubmissionError } from "redux-form";
import { useCallback, useEffect, useState } from "react";
import type { Dispatch } from "redux";
import * as Sentry from "@sentry/react";
import UserApi from "ee/api/UserApi";
import { toast } from "@appsmith/ads";
Expand All @@ -24,48 +25,17 @@ export interface ResetPasswordFormValues {
email?: string;
}

export type CreatePasswordFormValues = ResetPasswordFormValues;

export interface ForgotPasswordFormValues {
email?: string;
}

export const signupFormSubmitHandler = async (
values: SignupFormValues,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch: any,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
const { email, password } = values;

return new Promise((resolve, reject) => {
dispatch({
type: ReduxActionTypes.CREATE_USER_INIT,
payload: {
resolve,
reject,
email,
password,
},
});
}).catch((error) => {
throw new SubmissionError(error);
});
};

export const resetPasswordSubmitHandler = async (
values: ResetPasswordFormValues,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch: any,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
dispatch: Dispatch,
): Promise<undefined> => {
const { email, password, token } = values;

return new Promise((resolve, reject) => {
return new Promise<undefined>((resolve, reject) => {
dispatch({
type: ReduxActionTypes.RESET_USER_PASSWORD_INIT,
payload: {
Expand All @@ -81,43 +51,13 @@ export const resetPasswordSubmitHandler = async (
});
};

export const createPasswordSubmitHandler = async (
values: CreatePasswordFormValues,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch: any,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
const { email, password, token } = values;

return new Promise((resolve, reject) => {
dispatch({
type: ReduxActionTypes.INVITED_USER_SIGNUP_INIT,
payload: {
resolve,
reject,
token,
email,
password,
},
});
}).catch((error) => {
throw new SubmissionError(error);
});
};

export const forgotPasswordSubmitHandler = async (
values: ForgotPasswordFormValues,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch: any,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
dispatch: Dispatch,
): Promise<undefined> => {
const { email } = values;

return new Promise((resolve, reject) => {
return new Promise<undefined>((resolve, reject) => {
dispatch({
type: ReduxActionTypes.FORGOT_PASSWORD_INIT,
payload: {
Expand Down
2 changes: 1 addition & 1 deletion app/server/appsmith-interfaces/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<version>2.17.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Loading

0 comments on commit e356d5a

Please sign in to comment.