diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index 69230ed793f4..32cc3351c480 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -1,3 +1,4 @@ +import type React from "react"; import type { HttpMethod } from "api/Api"; import API from "api/Api"; import type { ApiResponse } from "./ApiResponses"; @@ -7,40 +8,15 @@ import axios from "axios"; import type { Action, ActionViewMode } from "entities/Action"; import type { APIRequest } from "constants/AppsmithActionConstants/ActionConstants"; import type { WidgetType } from "constants/WidgetConstants"; -import { omit } from "lodash"; import type { OtlpSpan } from "UITelemetry/generateTraces"; import { wrapFnWithParentTraceContext } from "UITelemetry/generateTraces"; import type { ActionParentEntityTypeInterface } from "@appsmith/entities/Engine/actionHelpers"; -export interface CreateActionRequest extends APIRequest { - datasourceId: string; - pageId: string; - name: string; - actionConfiguration: T; -} - -export interface UpdateActionRequest extends CreateActionRequest { - actionId: string; -} - export interface Property { key: string; value?: string; } -export interface BodyFormData { - editable: boolean; - mandatory: boolean; - description: string; - key: string; - value?: string; - type: string; -} - -export interface QueryConfig { - queryString: string; -} - export type ActionCreateUpdateResponse = ApiResponse & { id: string; jsonPathKeys: Record; @@ -66,10 +42,6 @@ export interface ExecuteActionRequest extends APIRequest { analyticsProperties?: Record; } -export type ExecuteActionResponse = ApiResponse & { - actionId: string; -}; - export interface ActionApiResponseReq { headers: Record; body: Record | null; @@ -136,11 +108,6 @@ export interface MoveActionRequest { destinationPageId: string; } -export interface CopyActionRequest { - action: Action; - pageId: string; -} - export interface UpdateActionNameRequest { pageId?: string; actionId: string; @@ -193,11 +160,18 @@ class ActionAPI extends API { ActionAPI.apiUpdateCancelTokenSource.cancel(); } ActionAPI.apiUpdateCancelTokenSource = axios.CancelToken.source(); - let action = Object.assign({}, apiConfig); - // While this line is not required, name can not be changed from this endpoint - delete action.name; - // Removing datasource storages from the action object since embedded datasources don't have storages - action = omit(action, ["datasource.datasourceStorages"]); + const action: Partial = { + ...apiConfig, + name: undefined, + entityReferenceType: undefined, + }; + if (action.datasource != null) { + action.datasource = { + ...(action as any).datasource, + datasourceStorages: undefined, + isValid: undefined, + }; + } return API.put(`${ActionAPI.url}/${action.id}`, action, undefined, { cancelToken: ActionAPI.apiUpdateCancelTokenSource.token, });