chore: Refactoring entity types and updating DS action create permission to fix some bugs on EE (#29573)

## Description

Refactoring entity types and updating DS action create permission to fix
some bugs on EE

#### PR fixes following issue(s)
Fixes # (issue number)

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [x] Jest
- [x] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined entity type naming conventions across the application for
better consistency.
- Enhanced type definitions for improved code clarity and
maintainability.
- Updated function calls to use object parameters with named properties
for better readability.

- **New Features**
- Introduced a new entity type for module instances, expanding the
application's data handling capabilities.

- **Bug Fixes**
- Corrected improper type assertions to ensure accurate entity
recognition and processing.

- **Documentation**
- Added comments to clarify the non-introduction of certain dependencies
in specific components.

- **Style**
- Adjusted import statements to align with the updated naming
conventions.

- **Tests**
- Updated test cases to reflect changes in entity type references and
assertions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Ankita Kinger 2023-12-14 20:14:30 +05:30 committed by GitHub
parent eedd3fb857
commit cf6c77194b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 470 additions and 359 deletions

View File

@ -9,23 +9,23 @@ import {
JsFileIconV2,
} from "pages/Editor/Explorer/ExplorerIcons";
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
export const getIconForEntity: Record<
string,
(props: LogItemProps, pluginGroups: Record<string, Plugin>) => any
> = {
[ENTITY_TYPE_VALUE.WIDGET]: (props) => {
[ENTITY_TYPE.WIDGET]: (props) => {
if (props.source?.pluginType) {
return (
<WidgetIcon height={16} type={props.source.pluginType} width={16} />
);
}
},
[ENTITY_TYPE_VALUE.JSACTION]: () => {
[ENTITY_TYPE.JSACTION]: () => {
return JsFileIconV2(16, 16, true, true);
},
[ENTITY_TYPE_VALUE.ACTION]: (props, pluginGroups) => {
[ENTITY_TYPE.ACTION]: (props, pluginGroups) => {
const { iconId, source } = props;
if (source?.pluginType === PluginType.API && source.httpMethod) {
// If the source is an API action.

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { TEditorModes } from "components/editorComponents/CodeEditor/EditorConfig";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
export const APPSMITH_AI = "Appsmith AI";
@ -17,7 +17,7 @@ export const getAIContext = ({
cursorPosition,
editor,
}: {
entityType?: ENTITY_TYPE;
entityType?: EntityTypeValue;
slashIndex?: number;
currentLineValue?: string;
cursorPosition: CodeMirror.Position;

View File

@ -1,5 +1,5 @@
import type { DependencyMap, DynamicPath } from "utils/DynamicBindingUtils";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { ActionData } from "@appsmith/reducers/entityReducers/actionsReducer";
import {
getBindingAndReactivePathsOfAction,
@ -67,7 +67,7 @@ export const generateDataTreeAction = (
headers: action.data?.headers,
},
config: action.config.actionConfiguration,
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
datasourceUrl,
},
configEntity: {
@ -76,7 +76,7 @@ export const generateDataTreeAction = (
pluginId: action.config.pluginId,
pluginType: action.config.pluginType,
dynamicBindingPathList,
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths,
reactivePaths,
dependencyMap,

View File

@ -1,4 +1,4 @@
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { JSCollectionData } from "@appsmith/reducers/entityReducers/jsActionsReducer";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import type { DependencyMap } from "utils/DynamicBindingUtils";
@ -62,7 +62,7 @@ export const generateDataTreeJSAction = (
...variableList,
...actionsData,
body: removeThisReference,
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
actionId: js.config.id,
},
configEntity: {
@ -70,7 +70,7 @@ export const generateDataTreeJSAction = (
meta: meta,
name: js.config.name,
pluginType: js.config.pluginType,
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
bindingPaths: bindingPaths, // As all js object function referred to as action is user javascript code, we add them as binding paths.
reactivePaths: { ...bindingPaths },
dynamicBindingPathList: dynamicBindingPathList,

View File

@ -5,8 +5,8 @@ import type {
WidgetEntity,
} from "@appsmith/entities/DataTree/types";
import {
type ENTITY_TYPE,
ENTITY_TYPE_VALUE,
type EntityTypeValue,
ENTITY_TYPE,
} from "entities/DataTree/dataTreeFactory";
import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes";
@ -17,9 +17,9 @@ export function isDynamicEntity(
): entity is DynamicEntityType {
return (
[
ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE_VALUE.ACTION,
] as Array<ENTITY_TYPE>
ENTITY_TYPE.JSACTION,
ENTITY_TYPE.WIDGET,
ENTITY_TYPE.ACTION,
] as Array<EntityTypeValue>
).includes(entity.ENTITY_TYPE);
}

View File

@ -22,15 +22,18 @@ import type { ModuleInstance } from "@appsmith/constants/ModuleInstanceConstants
export type ActionDispatcher = (...args: any[]) => ActionDescription;
export enum ENTITY_TYPE {
ACTION = "ACTION",
WIDGET = "WIDGET",
APPSMITH = "APPSMITH",
JSACTION = "JSACTION",
}
export const ENTITY_TYPE = {
ACTION: "ACTION",
WIDGET: "WIDGET",
APPSMITH: "APPSMITH",
JSACTION: "JSACTION",
} as const;
export const JSACTION_TYPE = ENTITY_TYPE.JSACTION;
export const ACTION_TYPE = ENTITY_TYPE.ACTION;
type ValueOf<T> = T[keyof T];
export type EntityTypeValue = ValueOf<typeof ENTITY_TYPE>;
export enum EvaluationSubstitutionType {
TEMPLATE = "TEMPLATE",
PARAMETER = "PARAMETER",
@ -49,7 +52,7 @@ export interface ActionEntity {
isExecutionSuccess: boolean;
headers?: unknown;
};
ENTITY_TYPE: ENTITY_TYPE.ACTION;
ENTITY_TYPE: typeof ENTITY_TYPE.ACTION;
config: Partial<ActionConfig>;
datasourceUrl: string;
}
@ -58,7 +61,7 @@ export interface ActionEntityConfig extends EntityConfig {
dynamicBindingPathList: DynamicPath[];
bindingPaths: Record<string, EvaluationSubstitutionType>;
reactivePaths: Record<string, EvaluationSubstitutionType>;
ENTITY_TYPE: ENTITY_TYPE.ACTION;
ENTITY_TYPE: typeof ENTITY_TYPE.ACTION;
dependencyMap: DependencyMap;
logBlackList: Record<string, true>;
pluginType: PluginType;
@ -86,7 +89,7 @@ export interface JSActionEntityConfig extends EntityConfig {
dependencyMap: DependencyMap;
pluginType: PluginType.JS;
name: string;
ENTITY_TYPE: ENTITY_TYPE.JSACTION;
ENTITY_TYPE: typeof ENTITY_TYPE.JSACTION;
actionId: string;
moduleId?: string;
moduleInstanceId?: string;
@ -96,7 +99,7 @@ export interface JSActionEntityConfig extends EntityConfig {
export interface JSActionEntity {
[propName: string]: any;
body: string;
ENTITY_TYPE: ENTITY_TYPE.JSACTION;
ENTITY_TYPE: typeof ENTITY_TYPE.JSACTION;
actionId: string;
}
export type PagelistEntity = Page[];
@ -134,7 +137,7 @@ export interface WidgetConfig extends EntityConfig {
reactivePaths: Record<string, EvaluationSubstitutionType>;
triggerPaths: Record<string, boolean>;
validationPaths: Record<string, ValidationConfig>;
ENTITY_TYPE: ENTITY_TYPE.WIDGET;
ENTITY_TYPE: typeof ENTITY_TYPE.WIDGET;
logBlackList: Record<string, true>;
propertyOverrideDependency: PropertyOverrideDependency;
overridingPropertyPaths: OverridingPropertyPaths;
@ -158,7 +161,7 @@ export type UnEvalTreeEntityObject =
export interface WidgetEntity extends WidgetProps {
meta: Record<string, unknown>;
ENTITY_TYPE: ENTITY_TYPE.WIDGET;
ENTITY_TYPE: typeof ENTITY_TYPE.WIDGET;
}
export type DataTreeEntityObject =
| ActionEntity
@ -177,7 +180,7 @@ export interface WidgetEntityConfig
}
export interface AppsmithEntity extends Omit<AppDataState, "store"> {
ENTITY_TYPE: ENTITY_TYPE.APPSMITH;
ENTITY_TYPE: typeof ENTITY_TYPE.APPSMITH;
store: Record<string, unknown>;
theme: AppTheme["properties"];
}

View File

@ -55,11 +55,11 @@ export const useHeaderActions = (
);
if (editorType === EditorNames.APPLICATION) {
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isFeatureEnabled,
datasource?.userPermissions ?? [],
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasource?.userPermissions ?? [],
pagePermissions,
);
});
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,

View File

@ -5,7 +5,7 @@ import {
import { matchPath } from "react-router";
export const EditorNames = {
APPLICATION: "appEditor",
APPLICATION: "app",
};
export interface EditorType {

View File

@ -3,7 +3,7 @@ import {
convertPathToString,
getEntityNameAndPropertyPath,
} from "@appsmith/workers/Evaluation/evaluationUtils";
import { ENTITY_TYPE_VALUE } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { DependencyMap as TDependencyMap } from "utils/DynamicBindingUtils";
import { getPropertyPath } from "utils/DynamicBindingUtils";
import { getDynamicBindings } from "utils/DynamicBindingUtils";
@ -23,11 +23,10 @@ export const getDependencies: Record<
string,
(entity: IEntity) => TDependencyMap
> = {
[ENTITY_TYPE_VALUE.ACTION]: (entity) =>
[ENTITY_TYPE.ACTION]: (entity) =>
getActionDependencies(entity as ActionEntity),
[ENTITY_TYPE_VALUE.JSACTION]: (entity) =>
getJSDependencies(entity as JSEntity),
[ENTITY_TYPE_VALUE.WIDGET]: (entity) =>
[ENTITY_TYPE.JSACTION]: (entity) => getJSDependencies(entity as JSEntity),
[ENTITY_TYPE.WIDGET]: (entity) =>
getWidgetDependencies(entity as WidgetEntity),
};
@ -35,11 +34,11 @@ export const getPathDependencies: Record<
string,
(entity: IEntity, fullPropertyPath: string) => TDependencyMap
> = {
[ENTITY_TYPE_VALUE.ACTION]: (entity, fullPropertyPath) =>
[ENTITY_TYPE.ACTION]: (entity, fullPropertyPath) =>
getActionPropertyPathDependencies(entity as ActionEntity, fullPropertyPath),
[ENTITY_TYPE_VALUE.JSACTION]: (entity, fullPropertyPath) =>
[ENTITY_TYPE.JSACTION]: (entity, fullPropertyPath) =>
getJSPropertyPathDependencies(entity as JSEntity, fullPropertyPath),
[ENTITY_TYPE_VALUE.WIDGET]: (entity, fullPropertyPath) =>
[ENTITY_TYPE.WIDGET]: (entity, fullPropertyPath) =>
getWidgetPropertyPathDependencies(entity as WidgetEntity, fullPropertyPath),
};

View File

@ -1,12 +1,12 @@
import type { JSActionEntity } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes";
const entityUniqueIdGetterMap: Record<
string,
(entity: DataTreeEntity) => string
> = {
[ENTITY_TYPE_VALUE.JSACTION]: (entity) => {
[ENTITY_TYPE.JSACTION]: (entity) => {
return (entity as JSActionEntity).actionId;
},
};

View File

@ -15,6 +15,8 @@ import canvasLevelsReducer from "reducers/entityReducers/autoHeightReducers/canv
/* Reducers which are integrated into the core system when registering a pluggable module
or done so by a module that is designed to be eventually pluggable */
import layoutElementPositionsReducer from "layoutSystems/anvil/integrations/reducers/layoutElementPositionsReducer";
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import type { AppState } from "..";
export const entityReducerObject = {
canvasWidgets: canvasWidgetsReducer,
@ -31,4 +33,8 @@ export const entityReducerObject = {
autoHeightLayoutTree: autoHeightLayoutTreeReducer,
canvasLevels: canvasLevelsReducer,
layoutElementPositions: layoutElementPositionsReducer,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
moduleInstanceEntities: (state: AppState, action: ReduxAction<any>) => {
return {};
},
};

View File

@ -159,6 +159,7 @@ export interface AppState {
autoHeightLayoutTree: AutoHeightLayoutTreeReduxState;
canvasLevels: CanvasLevelsReduxState;
layoutElementPositions: LayoutElementPositionsReduxState;
moduleInstanceEntities: any;
};
evaluations: {
tree: EvaluatedTreeState;

View File

@ -5,7 +5,7 @@ import {
ReduxActionErrorTypes,
} from "@appsmith/constants/ReduxActionConstants";
import get from "lodash/get";
import type { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { EntityTypeValue } from "entities/DataTree/dataTreeFactory";
import { DEFAULT_ENTITY_EXPLORER_WIDTH } from "constants/AppConstants";
export enum ExplorerPinnedState {
@ -25,7 +25,7 @@ export interface ExplorerReduxState {
active: boolean;
entityInfo: {
show: boolean;
entityType?: ENTITY_TYPE;
entityType?: EntityTypeValue;
entityId: string;
entityName?: string;
};
@ -44,7 +44,7 @@ export const initialState: ExplorerReduxState = {
export const setEntityInfo = (
state: ExplorerReduxState,
action: ReduxAction<{ entityId: string; entityType: ENTITY_TYPE }>,
action: ReduxAction<{ entityId: string; entityType: EntityTypeValue }>,
) => ({
...state,
entityInfo: {

View File

@ -40,6 +40,7 @@ import { hasExecuteActionPermission as hasExecuteActionPermission_EE } from "@ap
import { hasAuditLogsReadPermission as hasAuditLogsReadPermission_CE } from "ce/utils/permissionHelpers";
import { hasAuditLogsReadPermission as hasAuditLogsReadPermission_EE } from "@appsmith/utils/permissionHelpers";
import { EditorNames } from "@appsmith/hooks";
export const getHasCreateWorkspacePermission = (
isEnabled: boolean,
@ -153,13 +154,19 @@ export const getHasAuditLogsReadPermission = (
else return hasAuditLogsReadPermission_CE(permissions);
};
export const hasCreateDSActionPermissionInApp = (
isEnabled: boolean,
dsPermissions?: string[],
pagePermissions?: string[],
) => {
return (
getHasCreateDatasourceActionPermission(isEnabled, dsPermissions) &&
getHasCreateActionPermission(isEnabled, pagePermissions)
);
export const hasCreateDSActionPermissionInApp = ({
dsPermissions,
editorType,
isEnabled,
pagePermissions,
}: {
dsPermissions?: string[];
editorType?: string;
isEnabled: boolean;
pagePermissions?: string[];
}) => {
return !editorType || editorType === EditorNames.APPLICATION
? getHasCreateDatasourceActionPermission(isEnabled, dsPermissions) &&
getHasCreateActionPermission(isEnabled, pagePermissions)
: getHasCreateDatasourceActionPermission(isEnabled, dsPermissions);
};

View File

@ -1,4 +1,4 @@
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type {
ActionEntity,
WidgetEntity,
@ -24,13 +24,13 @@ export const getEntityPeekData: Record<
configTree: ConfigTree;
}) => unknown
> = {
[ENTITY_TYPE_VALUE.ACTION]: ({ dataTree, objectName }) => {
[ENTITY_TYPE.ACTION]: ({ dataTree, objectName }) => {
return getActionChildrenPeekData(objectName, dataTree)?.peekData;
},
[ENTITY_TYPE_VALUE.APPSMITH]: ({ dataTree }) => {
[ENTITY_TYPE.APPSMITH]: ({ dataTree }) => {
return getAppsmithPeekData(dataTree).peekData;
},
[ENTITY_TYPE_VALUE.JSACTION]: ({ dataTree, dataTreeEntity, jsActions }) => {
[ENTITY_TYPE.JSACTION]: ({ dataTree, dataTreeEntity, jsActions }) => {
const entity = dataTreeEntity as ActionEntity;
const jsAction = jsActions.find(
(jsAction) => jsAction.config.id === entity.actionId,
@ -39,7 +39,7 @@ export const getEntityPeekData: Record<
? getJsActionPeekData(jsAction, dataTree)?.peekData
: entity;
},
[ENTITY_TYPE_VALUE.WIDGET]: ({
[ENTITY_TYPE.WIDGET]: ({
configTree,
dataTree,
dataTreeEntity,

View File

@ -5,7 +5,7 @@ import {
type ActionEntity,
type AppsmithEntity,
type JSActionEntity,
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
} from "@appsmith/entities/DataTree/types";
import type {
ConfigTree,
@ -41,7 +41,7 @@ export type EntityDefGeneratorMap = Record<
>;
export const entityDefGeneratorMap: EntityDefGeneratorMap = {
[ENTITY_TYPE_VALUE.ACTION]: (props) => {
[ENTITY_TYPE.ACTION]: (props) => {
const { def, entity, entityMap, entityName, extraDefsToDefine } = props;
def[entityName] = entityDefinitions.ACTION(
entity as ActionEntity,
@ -49,22 +49,22 @@ export const entityDefGeneratorMap: EntityDefGeneratorMap = {
);
flattenDef(def, entityName);
entityMap.set(entityName, {
type: ENTITY_TYPE_VALUE.ACTION,
type: ENTITY_TYPE.ACTION,
subType: "ACTION",
});
},
[ENTITY_TYPE_VALUE.APPSMITH]: (props) => {
[ENTITY_TYPE.APPSMITH]: (props) => {
const { def, entity, entityMap, extraDefsToDefine } = props;
def.appsmith = entityDefinitions.APPSMITH(
entity as AppsmithEntity,
extraDefsToDefine,
);
entityMap.set("appsmith", {
type: ENTITY_TYPE_VALUE.APPSMITH,
subType: ENTITY_TYPE_VALUE.APPSMITH,
type: ENTITY_TYPE.APPSMITH,
subType: ENTITY_TYPE.APPSMITH,
});
},
[ENTITY_TYPE_VALUE.JSACTION]: (props) => {
[ENTITY_TYPE.JSACTION]: (props) => {
const {
configTree,
def,
@ -97,11 +97,11 @@ export const entityDefGeneratorMap: EntityDefGeneratorMap = {
def[entityName] = jsPropertiesDef;
entityMap.set(entityName, {
type: ENTITY_TYPE_VALUE.JSACTION,
type: ENTITY_TYPE.JSACTION,
subType: "JSACTION",
});
},
[ENTITY_TYPE_VALUE.WIDGET]: (props) => {
[ENTITY_TYPE.WIDGET]: (props) => {
const {
configTree,
def,
@ -132,7 +132,7 @@ export const entityDefGeneratorMap: EntityDefGeneratorMap = {
flattenDef(def, entityName);
entityMap.set(entityName, {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: widgetType,
});
}

View File

@ -5,7 +5,7 @@ import type {
} from "@appsmith/entities/DataTree/types";
import {
type WidgetEntityConfig,
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
} from "@appsmith/entities/DataTree/types";
import type { PluginType } from "entities/Action";
@ -17,7 +17,7 @@ export const getEntityPayloadInfo: Record<
pluginType?: PluginType | string;
}
> = {
[ENTITY_TYPE_VALUE.WIDGET]: (entityConfig) => {
[ENTITY_TYPE.WIDGET]: (entityConfig) => {
const config = entityConfig as WidgetEntityConfig;
return {
iconId: config.widgetId,
@ -25,7 +25,7 @@ export const getEntityPayloadInfo: Record<
pluginType: config.type,
};
},
[ENTITY_TYPE_VALUE.JSACTION]: (entityConfig) => {
[ENTITY_TYPE.JSACTION]: (entityConfig) => {
const config = entityConfig as JSActionEntityConfig;
return {
iconId: config.actionId,
@ -33,7 +33,7 @@ export const getEntityPayloadInfo: Record<
pluginType: config.pluginType,
};
},
[ENTITY_TYPE_VALUE.ACTION]: (entityConfig) => {
[ENTITY_TYPE.ACTION]: (entityConfig) => {
const config = entityConfig as ActionEntityConfig;
return {
iconId: config.pluginId,

View File

@ -10,7 +10,7 @@ import type {
JSActionEntity,
} from "@appsmith/entities/DataTree/types";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
import type {
@ -64,7 +64,7 @@ const BASE_WIDGET: WidgetEntity = {
type: "SKELETON_WIDGET",
parentId: "0",
version: 1,
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
};
@ -76,7 +76,7 @@ const BASE_WIDGET_CONFIG: WidgetEntityConfig = {
reactivePaths: {},
triggerPaths: {},
validationPaths: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
propertyOverrideDependency: {},
overridingPropertyPaths: {},
@ -480,7 +480,7 @@ describe("4. translateDiffEvent", () => {
diffs.map((diff) =>
translateDiffEventToDataTreeDiffEvent(diff, {
JsObject: {
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
} as unknown as DataTreeEntity,
}),
),
@ -861,7 +861,7 @@ describe("convertJSFunctionsToString", () => {
},
name: "JSObject1",
actionId: "63ef4cb1a01b764626f2a6e5",
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
pluginType: PluginType.JS,
bindingPaths: {
body: EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -884,7 +884,7 @@ describe("convertJSFunctionsToString", () => {
},
},
JSObject2: {
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
meta: {
myFun1: {
arguments: [],
@ -942,7 +942,7 @@ describe("convertJSFunctionsToString", () => {
JSObject1: {
myFun1: JSObject1MyFun1,
body: 'export default {\nmyFun1: ()=>{ \n\treturn "name"\n} \n}',
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
actionId: "63ef4cb1a01b764626f2a6e5",
},
@ -952,7 +952,7 @@ describe("convertJSFunctionsToString", () => {
myFun1: JSObject2MyFun1,
myFun2: JSObject2MyFun2,
body: "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tmyFun1: () => {\n\t\t//write code here\n\t},\n\tmyFun2: async () => {\n\t\t//use async-await or promises\n\t}\n}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
actionId: "63f78437d1a4ef55755952f1",
},

View File

@ -13,7 +13,7 @@ import type {
DataTree,
ConfigTree,
} from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import _, { difference, find, get, has, isEmpty, isNil, set } from "lodash";
import type { WidgetTypeConfigMap } from "WidgetProvider/factory";
import { PluginType } from "entities/Action";
@ -357,7 +357,7 @@ export function isWidget(
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.WIDGET
entity.ENTITY_TYPE === ENTITY_TYPE.WIDGET
);
}
@ -373,7 +373,7 @@ export function isAction(
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.ACTION
entity.ENTITY_TYPE === ENTITY_TYPE.ACTION
);
}
@ -383,7 +383,7 @@ export function isAppsmithEntity(
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.APPSMITH
entity.ENTITY_TYPE === ENTITY_TYPE.APPSMITH
);
}
@ -391,7 +391,7 @@ export function isJSAction(entity: DataTreeEntity): entity is JSActionEntity {
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.JSACTION
entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION
);
}
/**
@ -408,7 +408,7 @@ export function isJSActionConfig(
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.JSACTION
entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION
);
}
@ -416,7 +416,7 @@ export function isJSObject(entity: DataTreeEntity): entity is JSActionEntity {
return (
typeof entity === "object" &&
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.JSACTION &&
entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION &&
"pluginType" in entity &&
entity.pluginType === PluginType.JS
);

View File

@ -1,4 +1,4 @@
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes";
import { getJSActionForEvalContext } from "workers/Evaluation/getJSActionForEvalContext";
@ -6,7 +6,7 @@ export const getEntityForEvalContextMap: Record<
string,
(entityName: string, entity: DataTreeEntity) => unknown
> = {
[ENTITY_TYPE_VALUE.JSACTION]: (entityName, entity) => {
[ENTITY_TYPE.JSACTION]: (entityName, entity) => {
return getJSActionForEvalContext(entityName, entity);
},
};

View File

@ -3,7 +3,7 @@ import {
getEntityNameAndPropertyPath,
isATriggerPath,
} from "@appsmith/workers/Evaluation/evaluationUtils";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type {
ActionEntity,
ActionEntityConfig,
@ -20,7 +20,7 @@ import type { DataTreeEntityObject } from "@appsmith/entities/DataTree/types";
import { getDependencyFromEntityPath } from "workers/common/DependencyMap/utils/getEntityDependencies";
export const getDependencies = {
[ENTITY_TYPE_VALUE.ACTION]: (
[ENTITY_TYPE.ACTION]: (
entity: DataTreeEntityObject,
entityConfig: DataTreeEntityConfig,
allKeys: Record<string, true>,
@ -31,7 +31,7 @@ export const getDependencies = {
allKeys,
);
},
[ENTITY_TYPE_VALUE.JSACTION]: (
[ENTITY_TYPE.JSACTION]: (
entity: DataTreeEntityObject,
entityConfig: DataTreeEntityConfig,
allKeys: Record<string, true>,
@ -42,7 +42,7 @@ export const getDependencies = {
allKeys,
);
},
[ENTITY_TYPE_VALUE.WIDGET]: (
[ENTITY_TYPE.WIDGET]: (
entity: DataTreeEntityObject,
entityConfig: DataTreeEntityConfig,
) => {
@ -166,7 +166,7 @@ export function getActionDependencies(
}
export const getPathDependencies = {
[ENTITY_TYPE_VALUE.ACTION]: (
[ENTITY_TYPE.ACTION]: (
entity: DataTreeEntity,
entityConfig: DataTreeEntityConfig,
fullPropertyPath: string,
@ -179,7 +179,7 @@ export const getPathDependencies = {
allKeys,
);
},
[ENTITY_TYPE_VALUE.JSACTION]: (
[ENTITY_TYPE.JSACTION]: (
entity: DataTreeEntity,
entityConfig: DataTreeEntityConfig,
fullPropertyPath: string,
@ -192,7 +192,7 @@ export const getPathDependencies = {
allKeys,
);
},
[ENTITY_TYPE_VALUE.WIDGET]: (
[ENTITY_TYPE.WIDGET]: (
entity: DataTreeEntity,
entityConfig: DataTreeEntityConfig,
fullPropertyPath: string,

View File

@ -110,7 +110,7 @@ export function getFieldFromValue(
const entity = dataTree && dataTree[entityProps.entityName];
if (entity && "ENTITY_TYPE" in entity) {
if (isAction(entity)) {
if (isAction(entity as DataTreeEntity)) {
// get fields for API action
return getActionEntityFields(
fields,

View File

@ -3,7 +3,10 @@ import type {
TreeDropdownOption,
IconName,
} from "design-system-old";
import type { ENTITY_TYPE, MetaArgs } from "@appsmith/entities/DataTree/types";
import type {
EntityTypeValue,
MetaArgs,
} from "@appsmith/entities/DataTree/types";
import type React from "react";
import type { AdditionalDynamicDataTree } from "utils/autocomplete/customTreeTypeDefCreator";
import type { FieldType, ViewTypes, AppsmithFunction } from "./constants";
@ -157,7 +160,7 @@ export interface AppsmithFunctionConfigType {
export interface DataTreeForActionCreator {
[key: string]: {
ENTITY_TYPE?: ENTITY_TYPE;
ENTITY_TYPE?: EntityTypeValue;
meta?: Record<string, MetaArgs>;
};
}

View File

@ -1,5 +1,5 @@
import type CodeMirror from "codemirror";
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import type { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
import type { EntityNavigationData } from "selectors/navigationSelectors";
@ -55,7 +55,7 @@ export const EditorThemes: Record<EditorTheme, string> = {
export interface FieldEntityInformation {
entityName?: string;
expectedType?: AutocompleteDataType;
entityType?: ENTITY_TYPE;
entityType?: EntityTypeValue;
entityId?: string;
propertyPath?: string;
isTriggerPath?: boolean;

View File

@ -8,7 +8,7 @@ import { generateQuickCommands } from "./generateQuickCommands";
import type { Datasource } from "entities/Datasource";
import AnalyticsUtil from "utils/AnalyticsUtil";
import log from "loglevel";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { checkIfCursorInsideBinding } from "components/editorComponents/CodeEditor/codeEditorUtils";
import type { SlashCommandPayload } from "entities/Action";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
@ -51,7 +51,7 @@ export const slashCommandHintHelper: HintHelper = (
// @ts-expect-error: Types are not available
editor.closeHint();
const { entityType } = entityInfo;
const currentEntityType = entityType || ENTITY_TYPE_VALUE.ACTION;
const currentEntityType = entityType || ENTITY_TYPE.ACTION;
const filteredEntitiesForSuggestions = entitiesForSuggestions.filter(
(entity) => {
return entity.type !== currentEntityType;

View File

@ -4,7 +4,7 @@ import type { CommandsCompletion } from "utils/autocomplete/CodemirrorTernServic
import ReactDOM from "react-dom";
import type { SlashCommandPayload } from "entities/Action";
import { SlashCommand } from "entities/Action";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { EntityIcon, JsFileIconV2 } from "pages/Editor/Explorer/ExplorerIcons";
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
@ -15,7 +15,7 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import BetaCard from "../BetaCard";
import type { NavigationData } from "selectors/navigationSelectors";
import type { AIEditorContext } from "@appsmith/components/editorComponents/GPT";
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
export enum Shortcuts {
PLUS = "PLUS",
@ -116,7 +116,7 @@ export function Command(props: {
export const generateQuickCommands = (
entitiesForSuggestions: NavigationData[],
currentEntityType: ENTITY_TYPE,
currentEntityType: EntityTypeValue,
searchText: string,
{
aiContext,
@ -160,19 +160,19 @@ export const generateQuickCommands = (
const name = suggestion.name;
return {
text:
suggestion.type === ENTITY_TYPE_VALUE.ACTION
suggestion.type === ENTITY_TYPE.ACTION
? `{{${name}.data}}`
: suggestion.type === ENTITY_TYPE_VALUE.JSACTION
: suggestion.type === ENTITY_TYPE.JSACTION
? `{{${name}.}}`
: `{{${name}}}`,
displayText: `${name}`,
className: "CodeMirror-commands",
data: suggestion,
triggerCompletionsPostPick: suggestion.type !== ENTITY_TYPE_VALUE.ACTION,
triggerCompletionsPostPick: suggestion.type !== ENTITY_TYPE.ACTION,
render: (element: HTMLElement, _: unknown, data: CommandsCompletion) => {
let icon = null;
const completionData = data.data as NavigationData;
if (completionData.type === ENTITY_TYPE_VALUE.JSACTION) {
if (completionData.type === ENTITY_TYPE.JSACTION) {
icon = JsFileIconV2(16, 16);
} else if (
completionData.pluginId &&
@ -246,7 +246,7 @@ export const generateQuickCommands = (
commonCommands.unshift(askGPT);
}
if (currentEntityType !== ENTITY_TYPE_VALUE.JSACTION) {
if (currentEntityType !== ENTITY_TYPE.JSACTION) {
// New binding command is not applicable in JS Objects
commonCommands.push(newBinding);
}
@ -259,7 +259,7 @@ export const generateQuickCommands = (
filteredCommands.push(...commonCommandsMatchingSearchText);
if (currentEntityType !== ENTITY_TYPE_VALUE.JSACTION) {
if (currentEntityType !== ENTITY_TYPE.JSACTION) {
// Binding suggestions and create query commands are not applicable in JS Objects
// Get top 5 matching suggestions
@ -277,7 +277,7 @@ export const generateQuickCommands = (
filteredCommands.push(...suggestionsMatchingSearchText);
}
if (currentEntityType === ENTITY_TYPE_VALUE.WIDGET) {
if (currentEntityType === ENTITY_TYPE.WIDGET) {
const createNewCommands: CommandsCompletion[] = [];
createNewCommands.push(...datasourceCommands);

View File

@ -8,7 +8,7 @@ import {
checkIfCursorInsideBinding,
isCursorOnEmptyToken,
} from "components/editorComponents/CodeEditor/codeEditorUtils";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { isEmpty, isString } from "lodash";
import type { getAllDatasourceTableKeys } from "@appsmith/selectors/entitiesSelector";
import {
@ -48,7 +48,7 @@ export const bindingHintHelper: HintHelper = (editor: CodeMirror.Editor) => {
const entityType = entityInformation?.entityType;
let shouldShow = false;
if (entityType === ENTITY_TYPE_VALUE.JSACTION) {
if (entityType === ENTITY_TYPE.JSACTION) {
if (additionalData?.enableAIAssistance) {
shouldShow = !isAISlashCommand(editor);
} else {

View File

@ -30,7 +30,7 @@ import type { WrappedFieldInputProps } from "redux-form";
import _, { debounce, isEqual, isNumber } from "lodash";
import scrollIntoView from "scroll-into-view-if-needed";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { EvaluationSubstitutionType } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { Skin } from "constants/DefaultTheme";
@ -550,8 +550,7 @@ class CodeEditor extends Component<Props, State> {
getEditorIdentifier(this.props) !== getEditorIdentifier(prevProps);
const entityInformation = this.getEntityInformation();
const isWidgetType =
entityInformation.entityType === ENTITY_TYPE_VALUE.WIDGET;
const isWidgetType = entityInformation.entityType === ENTITY_TYPE.WIDGET;
const hasFocusedValueChanged =
getEditorIdentifier(this.props) !== this.props.focusedProperty;
@ -1010,7 +1009,7 @@ class CodeEditor extends Component<Props, State> {
}
if (navigationData.url) {
if (navigationData.type === ENTITY_TYPE_VALUE.ACTION) {
if (navigationData.type === ENTITY_TYPE.ACTION) {
AnalyticsUtil.logEvent("EDIT_ACTION_CLICK", {
actionId: navigationData?.id,
datasourceId: navigationData?.datasourceId,

View File

@ -8,7 +8,7 @@ import type { ValidationTypes } from "constants/WidgetValidation";
import type { Datasource } from "entities/Datasource";
import { PluginPackageName, PluginType } from "entities/Action";
import type { WidgetType } from "constants/WidgetConstants";
import type { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { EntityTypeValue } from "entities/DataTree/dataTreeFactory";
import { getPluginByPackageName } from "@appsmith/selectors/entitiesSelector";
import type { AppState } from "@appsmith/reducers";
import WidgetFactory from "WidgetProvider/factory";
@ -91,19 +91,20 @@ export interface SnippetBody {
shortTitle?: string;
}
export type FilterEntity = WidgetType | ENTITY_TYPE;
export type FilterEntity = WidgetType | EntityTypeValue;
export const filterEntityTypeLabels: Partial<Record<ENTITY_TYPE, string>> = {
ACTION: "All Queries",
WIDGET: "All Widgets",
JSACTION: "JS Objects",
};
export const filterEntityTypeLabels: Partial<Record<EntityTypeValue, string>> =
{
ACTION: "All Queries",
WIDGET: "All Widgets",
JSACTION: "JS Objects",
};
export const getSnippetFilterLabel = (state: AppState, label: string) => {
return (
WidgetFactory.widgetConfigMap.get(label as WidgetType)?.widgetName ||
getPluginByPackageName(state, label)?.name ||
filterEntityTypeLabels[label as ENTITY_TYPE] ||
filterEntityTypeLabels[label as EntityTypeValue] ||
label
);
};

View File

@ -35,7 +35,7 @@ import { Indices } from "constants/Layers";
import { getExpectedValue } from "utils/validation/common";
import { ValidationTypes } from "constants/WidgetValidation";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { getDataTree } from "selectors/dataTreeSelectors";
import type { KeyValuePair } from "entities/Action";
import equal from "fast-deep-equal/es6";
@ -424,10 +424,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<
if (!entity) return "";
if (
"ENTITY_TYPE" in entity &&
entity.ENTITY_TYPE === ENTITY_TYPE_VALUE.ACTION
) {
if ("ENTITY_TYPE" in entity && entity.ENTITY_TYPE === ENTITY_TYPE.ACTION) {
let evaluatedPath = "path" in entity.config ? entity.config.path : "";
if (evaluatedPath) {

View File

@ -7,7 +7,7 @@ import apiActionEditorConfig from "constants/AppsmithActionConstants/formConfig/
import saasActionSettingsConfig from "constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig";
import apiActionDependencyConfig from "constants/AppsmithActionConstants/formConfig/ApiDependencyConfigs";
import apiActionDatasourceFormButtonConfig from "constants/AppsmithActionConstants/formConfig/ApiDatasourceFormsButtonConfig";
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
export interface ExecuteActionPayloadEvent {
type: EventType;
@ -21,7 +21,7 @@ export interface ExecutionResult {
export interface TriggerSource {
id: string;
name: string;
entityType?: ENTITY_TYPE;
entityType?: EntityTypeValue;
collectionId?: string;
isJSAction?: boolean;
actionId?: string;

View File

@ -1,8 +1,10 @@
export * from "ce/entities/DataTree/types";
import { ENTITY_TYPE as CE_ENTITY_TYPE } from "ce/entities/DataTree/types";
export type ENTITY_TYPE = CE_ENTITY_TYPE;
export const ENTITY_TYPE_VALUE = {
export const ENTITY_TYPE = {
...CE_ENTITY_TYPE,
};
MODULE_INSTANCE: "MODULE_INSTANCE",
} as const;
type ValueOf<T> = T[keyof T];
export type EntityTypeValue = ValueOf<typeof ENTITY_TYPE>;

View File

@ -3,14 +3,14 @@ import { generateDataTreeJSAction } from "@appsmith/entities/DataTree/dataTreeJS
import { generateDataTreeWidget } from "entities/DataTree/dataTreeWidget";
import log from "loglevel";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "@appsmith/entities/DataTree/types";
import { generateDataTreeModuleInputs } from "@appsmith/entities/DataTree/utils";
import type {
DataTreeSeed,
AppsmithEntity,
ENTITY_TYPE,
EntityTypeValue,
} from "@appsmith/entities/DataTree/types";
import type {
unEvalAndConfigTree,
@ -110,8 +110,7 @@ export class DataTreeFactory {
store: appData.store,
theme,
} as AppsmithEntity;
(dataTree.appsmith as AppsmithEntity).ENTITY_TYPE =
ENTITY_TYPE_VALUE.APPSMITH;
(dataTree.appsmith as AppsmithEntity).ENTITY_TYPE = ENTITY_TYPE.APPSMITH;
const startMetaWidgets = performance.now();
@ -141,5 +140,5 @@ export class DataTreeFactory {
}
}
export { ENTITY_TYPE_VALUE, EvaluationSubstitutionType };
export type { ENTITY_TYPE };
export { ENTITY_TYPE, EvaluationSubstitutionType };
export type { EntityTypeValue };

View File

@ -4,7 +4,7 @@ import {
getSetterConfig,
} from "entities/DataTree/dataTreeWidget";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
import WidgetFactory from "WidgetProvider/factory";
@ -226,7 +226,7 @@ describe("generateDataTreeWidget", () => {
topRow: 0,
widgetId: "123",
widgetName: "Input1",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
componentWidth: 0,
componentHeight: 0,
defaultText: "",
@ -248,7 +248,7 @@ describe("generateDataTreeWidget", () => {
};
const expectedConfig = {
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
widgetId: "123",
bindingPaths,
reactivePaths: {

View File

@ -8,7 +8,7 @@ import type {
WidgetEntityConfig,
WidgetEntity,
} from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE_VALUE } from "./dataTreeFactory";
import { ENTITY_TYPE } from "./dataTreeFactory";
import type {
OverridingPropertyPaths,
PropertyOverrideDependency,
@ -295,7 +295,7 @@ const generateDataTreeWidgetWithoutMeta = (
const dataTreeWidgetWithoutMetaProps = _.merge(
{
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
},
_.omit(widget, widgetPathsToOmit),
unInitializedDefaultProps,
@ -329,7 +329,7 @@ const generateDataTreeWidgetWithoutMeta = (
triggerPaths,
validationPaths,
dependencyMap,
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {
...widget.privateWidgets,
},

View File

@ -1,3 +1,4 @@
/* DO NOT INTRODUCE PAGE AND APPLICATION DEPENDENCIES IN THIS COMPONENT */
import React, { useState } from "react";
import FormTitle from "./FormTitle";
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";

View File

@ -23,6 +23,8 @@ import {
getPagePermissions,
} from "selectors/editorSelectors";
import { get } from "lodash";
import { useEditorType } from "@appsmith/hooks";
import history from "utils/history";
interface FetchPreviewData {
datasourceId: string;
@ -146,15 +148,18 @@ export const useShowPageGenerationOnHeader = (
getGenerateCRUDEnabledPluginMap,
);
const editorType = useEditorType(history.location.pathname);
const canCreatePages = getHasCreatePagePermission(
isGACEnabled,
userAppPermissions,
);
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isGACEnabled,
datasourcePermissions,
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isGACEnabled,
dsPermissions: datasourcePermissions,
pagePermissions,
);
editorType,
});
const canGeneratePage = canCreateDatasourceActions && canCreatePages;

View File

@ -21,6 +21,8 @@ import { Virtuoso } from "react-virtuoso";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
import { hasCreateDSActionPermissionInApp } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import { useEditorType } from "@appsmith/hooks";
import history from "utils/history";
interface DatasourceStructureItemProps {
dbStructure: DatasourceTable;
@ -62,12 +64,14 @@ const DatasourceStructureItem = memo((props: DatasourceStructureItemProps) => {
const datasourcePermissions = datasource?.userPermissions || [];
const pagePermissions = useSelector(getPagePermissions);
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const editorType = useEditorType(history.location.pathname);
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isFeatureEnabled,
datasourcePermissions,
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasourcePermissions,
pagePermissions,
);
editorType,
});
const onSelect = () => {
setActive(false);

View File

@ -47,6 +47,8 @@ import {
TableWrapper,
ViewModeSchemaContainer,
} from "./SchemaViewModeCSS";
import { useEditorType } from "@appsmith/hooks";
import history from "utils/history";
interface Props {
datasource: Datasource;
@ -73,16 +75,19 @@ const DatasourceViewModeSchema = (props: Props) => {
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const editorType = useEditorType(history.location.pathname);
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,
);
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isFeatureEnabled,
datasourcePermissions,
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasourcePermissions,
pagePermissions,
);
editorType,
});
const applicationId: string = useSelector(getCurrentApplicationId);
const { pageId: currentPageId } = useParams<ExplorerURLParams>();

View File

@ -48,6 +48,8 @@ import Entity from "../Explorer/Entity";
import DatasourceField from "./DatasourceField";
import { setEntityCollapsibleState } from "actions/editorContextActions";
import ItemLoadingIndicator from "./ItemLoadingIndicator";
import { useEditorType } from "@appsmith/hooks";
import history from "utils/history";
interface Props {
datasourceId: string;
@ -343,16 +345,19 @@ function GoogleSheetSchema(props: Props) {
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const editorType = useEditorType(history.location.pathname);
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,
);
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isFeatureEnabled,
datasourcePermissions,
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasourcePermissions,
pagePermissions,
);
editorType,
});
const refreshSpreadSheetButton = (option: DropdownOption) => (
<Button

View File

@ -11,7 +11,7 @@ import { getPageListAsOptions } from "@appsmith/selectors/entitiesSelector";
import history from "utils/history";
import { useNewActionName } from "./helpers";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { inGuidedTour } from "selectors/onboardingSelectors";
import { toggleShowDeviationDialog } from "actions/onboardingActions";
import {
@ -102,7 +102,7 @@ export function ActionEntityContextMenu(props: EntityContextMenuProps) {
payload: {
entityId: actionId,
entityName: actionName,
entityType: ENTITY_TYPE_VALUE.ACTION,
entityType: ENTITY_TYPE.ACTION,
show: true,
},
}),

View File

@ -6,7 +6,7 @@ import {
entityDefinitions,
getPropsForJSActionEntity,
} from "@appsmith/utils/autocomplete/EntityDefinitions";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { useDispatch, useSelector } from "react-redux";
import PerformanceTracker, {
PerformanceTransactionName,
@ -23,6 +23,7 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import { EntityClassNames } from ".";
import { Button } from "design-system";
import WidgetFactory from "WidgetProvider/factory";
import type { ActionData } from "@appsmith/reducers/entityReducers/actionsReducer";
// const CloseIcon = ControlIcons.CLOSE_CONTROL;
@ -42,6 +43,70 @@ const EntityInfoContainer = styled.div`
const selectEntityInfo = (state: AppState) => state.ui.explorer.entityInfo;
const getJSActionBindings = (
entity: JSCollectionData,
entityProperties: any,
entityType: string,
) => {
const jsCollection = entity as JSCollectionData;
const properties = getPropsForJSActionEntity(jsCollection);
if (properties) {
entityProperties = Object.keys(properties).map((actionProperty: string) => {
const value = properties[actionProperty];
return {
propertyName: actionProperty,
entityName: jsCollection.config.name,
value: value,
entityType,
};
});
}
return entityProperties;
};
const getActionBindings = (
entity: any,
entityDefinitions: any,
entityProperties: any,
entityType: string,
entityName?: string,
) => {
const config = (entityDefinitions.ACTION as any)(entity as any);
if (config) {
entityProperties = Object.keys(config)
.filter((k) => k.indexOf("!") === -1)
.map((actionProperty: string) => {
let value = entity[actionProperty];
if (actionProperty === "isLoading") {
value = entity.isLoading;
}
if (actionProperty === "run") {
value = "Function";
actionProperty = actionProperty + "()";
}
if (actionProperty === "clear") {
value = "Function";
actionProperty = actionProperty + "()";
}
if (actionProperty === "data") {
if (isEmpty(entity.data) || !entity.data.hasOwnProperty("body")) {
value = {};
} else {
value = entity.data.body;
}
}
return {
propertyName: actionProperty,
entityName: entityName,
value,
entityType,
};
});
}
return entityProperties;
};
export function EntityProperties() {
const ref = React.createRef<HTMLDivElement>();
const dispatch = useDispatch();
@ -86,6 +151,21 @@ export function EntityProperties() {
state.entities.jsActions.find((js) => js.config.id === entityId),
);
const moduleInstanceQueryEntity = useSelector(
(state: AppState) =>
state.entities.moduleInstanceEntities?.actions?.find(
(action: ActionData) => action.config.moduleInstanceId === entityId,
),
);
const moduleInstanceJSEntity = useSelector(
(state: AppState) =>
state.entities.moduleInstanceEntities?.jsCollections?.find(
(action: JSCollectionData) =>
action.config.moduleInstanceId === entityId,
),
);
const closeContainer = useCallback((e) => {
e.stopPropagation();
dispatch({
@ -129,65 +209,33 @@ export function EntityProperties() {
}
}, [entityId]);
const entity: any = widgetEntity || actionEntity || jsActionEntity;
let config: any;
const entity: any =
widgetEntity ||
actionEntity ||
jsActionEntity ||
moduleInstanceQueryEntity ||
moduleInstanceJSEntity;
let entityProperties: any = [];
if (!entity) return null;
switch (entityType) {
case ENTITY_TYPE_VALUE.JSACTION:
const jsCollection = entity as JSCollectionData;
const properties = getPropsForJSActionEntity(jsCollection);
if (properties) {
entityProperties = Object.keys(properties).map(
(actionProperty: string) => {
const value = properties[actionProperty];
return {
propertyName: actionProperty,
entityName: jsCollection.config.name,
value: value,
entityType,
};
},
);
}
case ENTITY_TYPE.JSACTION:
entityProperties = getJSActionBindings(
entity,
entityProperties,
entityType,
);
break;
case ENTITY_TYPE_VALUE.ACTION:
config = (entityDefinitions.ACTION as any)(entity as any);
if (config) {
entityProperties = Object.keys(config)
.filter((k) => k.indexOf("!") === -1)
.map((actionProperty: string) => {
let value = entity[actionProperty];
if (actionProperty === "isLoading") {
value = entity.isLoading;
}
if (actionProperty === "run") {
value = "Function";
actionProperty = actionProperty + "()";
}
if (actionProperty === "clear") {
value = "Function";
actionProperty = actionProperty + "()";
}
if (actionProperty === "data") {
if (isEmpty(entity.data) || !entity.data.hasOwnProperty("body")) {
value = {};
} else {
value = entity.data.body;
}
}
return {
propertyName: actionProperty,
entityName: entityName,
value,
entityType,
};
});
}
case ENTITY_TYPE.ACTION:
entityProperties = getActionBindings(
entity,
entityDefinitions,
entityProperties,
entityType,
entityName,
);
break;
case ENTITY_TYPE_VALUE.WIDGET:
case ENTITY_TYPE.WIDGET:
const type: Exclude<
EntityDefinitionsOptions,
| "CANVAS_WIDGET"
@ -195,7 +243,7 @@ export function EntityProperties() {
| "SKELETON_WIDGET"
| "TABS_MIGRATOR_WIDGET"
> = entity.type;
config = WidgetFactory.getAutocompleteDefinitions(type);
let config = WidgetFactory.getAutocompleteDefinitions(type);
if (!config) {
return null;
}
@ -216,6 +264,23 @@ export function EntityProperties() {
};
});
break;
case ENTITY_TYPE.MODULE_INSTANCE:
if (moduleInstanceQueryEntity) {
entityProperties = getActionBindings(
moduleInstanceQueryEntity,
entityDefinitions,
entityProperties,
entityType,
entityName,
);
} else if (moduleInstanceJSEntity) {
entityProperties = getJSActionBindings(
moduleInstanceJSEntity,
entityProperties,
entityType,
);
}
break;
}
return (
<EntityInfoContainer

View File

@ -9,7 +9,7 @@ import noop from "lodash/noop";
import { getJSEntityName } from "./helpers";
import { initExplorerEntityNameEdit } from "actions/explorerActions";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import {
CONTEXT_COPY,
CONTEXT_DELETE,
@ -45,7 +45,7 @@ export function JSCollectionEntityContextMenu(props: EntityContextMenuProps) {
payload: {
entityId: actionId,
entityName: actionName,
entityType: ENTITY_TYPE_VALUE.JSACTION,
entityType: ENTITY_TYPE.JSACTION,
show: true,
},
}),

View File

@ -7,7 +7,7 @@ import {
WidgetReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants";
import WidgetFactory from "WidgetProvider/factory";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { toggleShowDeviationDialog } from "actions/onboardingActions";
import { inGuidedTour } from "selectors/onboardingSelectors";
import type { TreeDropdownOption } from "pages/Editor/Explorer/ContextMenu";
@ -64,7 +64,7 @@ export function WidgetContextMenu(props: {
payload: {
entityId: widgetId,
entityName: widgetName,
entityType: ENTITY_TYPE_VALUE.WIDGET,
entityType: ENTITY_TYPE.WIDGET,
show: true,
},
});

View File

@ -21,6 +21,7 @@ import {
DATASOURCE_LIST_BLANK_TITLE,
} from "@appsmith/constants/messages";
import PaneHeader from "./PaneHeader";
import { useEditorType } from "@appsmith/hooks";
const PaneContainer = styled.div`
width: 300px;
@ -52,6 +53,7 @@ const DatasourceIcon = styled.img`
`;
const DataSidePane = () => {
const editorType = useEditorType(history.location.pathname);
const [currentSelectedDatasource, setCurrentSelectedDatasource] = useState<
string | undefined
>("");
@ -109,7 +111,7 @@ const DataSidePane = () => {
onClick: () => goToDatasource(data.id),
description: `${
actionCount[data.id] || "No"
} queries in this app`,
} queries in this ${editorType}`,
descriptionType: "block",
isSelected: currentSelectedDatasource === data.id,
startIcon: (

View File

@ -55,6 +55,7 @@ import {
getHasManageDatasourcePermission,
hasCreateDSActionPermissionInApp,
} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import { useEditorType } from "@appsmith/hooks";
const Wrapper = styled.div`
padding: 15px;
@ -172,16 +173,19 @@ function DatasourceCard(props: DatasourceCardProps) {
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const editorType = useEditorType(history.location.pathname);
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,
);
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp(
isFeatureEnabled,
datasourcePermissions,
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasourcePermissions,
pagePermissions,
);
editorType,
});
const canEditDatasource = getHasManageDatasourcePermission(
isFeatureEnabled,

View File

@ -172,6 +172,7 @@ import {
getJSActionPathNameToDisplay,
getPluginActionNameToDisplay,
} from "@appsmith/utils/actionExecutionUtils";
import type { JSAction, JSCollection } from "entities/JSCollection";
enum ActionResponseDataTypes {
BINARY = "BINARY",
@ -1023,13 +1024,15 @@ export function* runActionSaga(
}
function* executeOnPageLoadJSAction(pageAction: PageAction) {
const collectionId = pageAction.collectionId;
const collectionId: string = pageAction.collectionId || "";
const pageId: string | undefined = yield select(getCurrentPageId);
if (!collectionId) return;
const collection: ReturnType<typeof getJSCollectionFromAllEntities> =
yield select(getJSCollectionFromAllEntities, collectionId);
const collection: JSCollection = yield select(
getJSCollectionFromAllEntities,
collectionId,
);
if (!collection) {
Sentry.captureException(
@ -1048,7 +1051,7 @@ function* executeOnPageLoadJSAction(pageAction: PageAction) {
}
const jsAction = collection.actions.find(
(action) => action.id === pageAction.id,
(action: JSAction) => action.id === pageAction.id,
);
if (!!jsAction) {
if (jsAction.confirmBeforeExecute) {

View File

@ -1,7 +1,7 @@
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
import { ACTION_TYPE, JSACTION_TYPE } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { createSelector } from "reselect";
import {
getCurrentActions,
@ -29,7 +29,7 @@ import type { Datasource } from "entities/Datasource";
export interface NavigationData {
name: string;
id: string;
type: ENTITY_TYPE;
type: EntityTypeValue;
isfunction?: boolean;
url: string | undefined;
navigable: boolean;
@ -82,7 +82,7 @@ export const getEntitiesForNavigation = createSelector(
navigationData[action.config.name] = createNavData({
id: action.config.id,
name: action.config.name,
type: ENTITY_TYPE_VALUE.ACTION,
type: ENTITY_TYPE.ACTION,
url: config.getURL(
pageId,
action.config.id,
@ -106,7 +106,7 @@ export const getEntitiesForNavigation = createSelector(
navigationData[jsAction.config.name] = createNavData({
id: jsAction.config.id,
name: jsAction.config.name,
type: ENTITY_TYPE_VALUE.JSACTION,
type: ENTITY_TYPE.JSACTION,
url: jsCollectionIdURL({ pageId, collectionId: jsAction.config.id }),
children: result?.childNavData || {},
});
@ -123,7 +123,7 @@ export const getEntitiesForNavigation = createSelector(
navigationData[widget.widgetName] = createNavData({
id: widget.widgetId,
name: widget.widgetName,
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
url: widgetURL({ pageId, selectedWidgets: [widget.widgetId] }),
children: result?.childNavData || {},
widgetType: widget.type,

View File

@ -1,6 +1,6 @@
import { filterInternalProperties } from "..";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
import type {
@ -25,7 +25,7 @@ describe("filterInternalProperties tests", () => {
renderMode: "CANVAS",
text: "yo",
type: "INPUT_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
parentColumnSpace: 1,
parentRowSpace: 2,
leftColumn: 2,
@ -58,7 +58,7 @@ describe("filterInternalProperties tests", () => {
widgetId: "yolo",
widgetName: "Input1",
type: "INPUT_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
};
const dataTree = {
Input1: dataTreeEntity,

View File

@ -1,6 +1,6 @@
import type { JSActionEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { keyBy } from "lodash";
import type { JSCollectionData } from "@appsmith/reducers/entityReducers/jsActionsReducer";
import { jsCollectionIdURL } from "@appsmith/RouteBuilder";
@ -24,7 +24,7 @@ export const getJsChildrenNavData = (
return createNavData({
id: `${jsAction.config.name}.${jsChild.name}`,
name: `${jsAction.config.name}.${jsChild.name}`,
type: ENTITY_TYPE_VALUE.JSACTION,
type: ENTITY_TYPE.JSACTION,
isfunction: true, // use this to identify function
url: jsCollectionIdURL({
pageId,
@ -41,7 +41,7 @@ export const getJsChildrenNavData = (
return createNavData({
id: `${jsAction.config.name}.${jsChild.name}`,
name: `${jsAction.config.name}.${jsChild.name}`,
type: ENTITY_TYPE_VALUE.JSACTION,
type: ENTITY_TYPE.JSACTION,
isfunction: false,
url: jsCollectionIdURL({
pageId,

View File

@ -1,6 +1,6 @@
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { builderURL } from "@appsmith/RouteBuilder";
import type { EntityNavigationData } from "selectors/navigationSelectors";
import { createNavData } from "./common";
@ -22,7 +22,7 @@ export const getWidgetChildrenNavData = (
formChildren[childWidgetName] = createNavData({
id: `${widgetName}.data.${childWidgetName}`,
name: childWidgetName,
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
url: builderURL({ pageId, hash: childWidgetId }),
children: {},
});

View File

@ -1,4 +1,4 @@
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
import type {
EntityNavigationData,
NavigationData,
@ -7,7 +7,7 @@ import type {
export const createNavData = (general: {
name: string;
id: string;
type: ENTITY_TYPE;
type: EntityTypeValue;
isfunction?: boolean;
children: EntityNavigationData;
key?: string;

View File

@ -4,7 +4,7 @@ import type {
ActionEntity,
JSActionEntity,
} from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import {
findLoadingEntities,
getEntityDependantPaths,
@ -15,7 +15,7 @@ import WidgetFactory from "../WidgetProvider/factory";
const JS_object_tree: JSActionEntity = {
pluginType: PluginType.JS,
name: "",
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
body: "",
meta: {},
dynamicBindingPathList: [],
@ -28,7 +28,7 @@ const JS_object_tree: JSActionEntity = {
// @ts-expect-error: meta property not provided
const Select_tree: WidgetEntity = {
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
widgetId: "",
type: "",
widgetName: "",
@ -50,7 +50,7 @@ const Query_tree: ActionEntity = {
config: {},
run: {},
clear: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
datasourceUrl: "",
responseMeta: {
isExecutionSuccess: true,
@ -64,7 +64,7 @@ const Api_tree: ActionEntity = {
config: {},
run: {},
clear: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
datasourceUrl: "",
responseMeta: {
isExecutionSuccess: true,
@ -73,7 +73,7 @@ const Api_tree: ActionEntity = {
};
const Table_tree: WidgetEntity = {
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
widgetId: "",
type: "TABLE_WIDGET",
widgetName: "",

View File

@ -8,8 +8,8 @@ import {
isDynamicValue,
} from "utils/DynamicBindingUtils";
import type { FieldEntityInformation } from "components/editorComponents/CodeEditor/EditorConfig";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import type { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import type { EntityTypeValue } from "@appsmith/entities/DataTree/types";
import { AutocompleteSorter } from "./AutocompleteSortRules";
import { getCompletionsForKeyword } from "./keywordCompletion";
import TernWorkerServer from "./TernWorkerService";
@ -95,7 +95,7 @@ interface RequestQuery {
}
export interface DataTreeDefEntityInformation {
type: ENTITY_TYPE;
type: EntityTypeValue;
subType: string;
}
@ -510,7 +510,7 @@ class CodeMirrorTernService {
}
const shouldComputeBestMatch =
this.fieldEntityInformation.entityType !== ENTITY_TYPE_VALUE.JSACTION;
this.fieldEntityInformation.entityType !== ENTITY_TYPE.JSACTION;
completions = AutocompleteSorter.sort(
completions,

View File

@ -5,7 +5,7 @@ import type {
DataTreeDefEntityInformation,
TernCompletionResult,
} from "../CodemirrorTernService";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
describe("Autocomplete Ranking", () => {
it("Blocks platform functions in data fields", () => {
@ -174,7 +174,7 @@ describe("Autocomplete Ranking", () => {
},
};
const entityInfo: DataTreeDefEntityInformation = {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET_V2",
};
const sortedCompletionsText = AutocompleteSorter.sort(

View File

@ -7,7 +7,7 @@ import CodemirrorTernService, {
} from "../CodemirrorTernService";
import { AutocompleteDataType } from "../AutocompleteDataType";
import { MockCodemirrorEditor } from "../../../../test/__mocks__/CodeMirrorEditorMock";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import _ from "lodash";
import { AutocompleteSorter, ScoredCompletion } from "../AutocompleteSortRules";
import type CodeMirror from "codemirror";
@ -254,11 +254,11 @@ describe("Tern server sorting", () => {
data: {},
};
defEntityInformation.set("sameEntity", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET",
});
defEntityInformation.set("sameEntity", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET_V2",
});
@ -269,11 +269,11 @@ describe("Tern server sorting", () => {
data: {},
};
defEntityInformation.set("sameType", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET",
});
defEntityInformation.set("sameType", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET_V2",
});
@ -285,11 +285,11 @@ describe("Tern server sorting", () => {
};
defEntityInformation.set("diffType", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET",
});
defEntityInformation.set("diffType", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET_V2",
});
@ -301,8 +301,8 @@ describe("Tern server sorting", () => {
};
defEntityInformation.set("diffEntity", {
type: ENTITY_TYPE_VALUE.ACTION,
subType: ENTITY_TYPE_VALUE.ACTION,
type: ENTITY_TYPE.ACTION,
subType: ENTITY_TYPE.ACTION,
});
const dataTreeCompletion: Completion<any> = {
@ -313,7 +313,7 @@ describe("Tern server sorting", () => {
};
defEntityInformation.set("otherDataTree", {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TEXT_WIDGET",
});
@ -363,7 +363,7 @@ describe("Tern server sorting", () => {
MockCodemirrorEditor as unknown as CodeMirror.Editor,
{
entityName: "sameEntity",
entityType: ENTITY_TYPE_VALUE.WIDGET,
entityType: ENTITY_TYPE.WIDGET,
expectedType: AutocompleteDataType.OBJECT,
},
);
@ -372,11 +372,11 @@ describe("Tern server sorting", () => {
_.shuffle(completions),
{
entityName: "sameEntity",
entityType: ENTITY_TYPE_VALUE.WIDGET,
entityType: ENTITY_TYPE.WIDGET,
expectedType: AutocompleteDataType.STRING,
},
{
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET",
},
);
@ -393,12 +393,12 @@ describe("Tern server sorting", () => {
it("tests score of completions", function () {
AutocompleteSorter.entityDefInfo = {
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET",
};
AutocompleteSorter.currentFieldInfo = {
entityName: "sameEntity",
entityType: ENTITY_TYPE_VALUE.WIDGET,
entityType: ENTITY_TYPE.WIDGET,
expectedType: AutocompleteDataType.STRING,
};
//completion that matches type and is present in dataTree.

View File

@ -4,7 +4,7 @@ import type {
WidgetEntityConfig,
} from "@appsmith/entities/DataTree/types";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
@ -27,7 +27,7 @@ describe("dataTreeTypeDefCreator", () => {
renderMode: "CANVAS",
text: "yo",
type: "INPUT_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
parentColumnSpace: 1,
parentRowSpace: 2,
leftColumn: 2,
@ -57,7 +57,7 @@ describe("dataTreeTypeDefCreator", () => {
widgetId: "yolo",
widgetName: "Input1",
type: "INPUT_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
};
const { def, entityInfo } = dataTreeTypeDefCreator(
{
@ -73,7 +73,7 @@ describe("dataTreeTypeDefCreator", () => {
expect(def).toHaveProperty("Input1.isDisabled");
expect(entityInfo.get("Input1")).toStrictEqual({
type: ENTITY_TYPE_VALUE.WIDGET,
type: ENTITY_TYPE.WIDGET,
subType: "INPUT_WIDGET_V2",
});
});

View File

@ -7,7 +7,7 @@ import type {
WidgetEntityConfig,
} from "@appsmith/entities/DataTree/types";
import type { ConfigTree, DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { pick } from "lodash";
import {
WIDGET_DSL_STRUCTURE_PROPS,
@ -101,7 +101,7 @@ export const createLoadingWidget = (
canvasWidget?.type !== "MODAL_WIDGET"
? WidgetTypes.SKELETON_WIDGET
: canvasWidget?.type,
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
bindingPaths: {},
reactivePaths: {},
triggerPaths: {},

View File

@ -1,5 +1,5 @@
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { createEvaluationContext } from "workers/Evaluation/evaluate";
import JSObjectCollection from "../Collection";
import ExecutionMetaData from "workers/Evaluation/fns/utils/ExecutionMetaData";
@ -69,7 +69,7 @@ describe("Mutation", () => {
var: {},
var2: new Set([1, 2]),
variables: ["var", "var2"],
ENTITY_TYPE: ENTITY_TYPE_VALUE.JSACTION,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
},
};

View File

@ -1,6 +1,6 @@
import type { ActionEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { PluginType } from "entities/Action";
import type { EvalContext } from "workers/Evaluation/evaluate";
import { createEvaluationContext } from "workers/Evaluation/evaluate";
@ -35,7 +35,7 @@ describe("Add functions", () => {
run: {},
clear: {},
responseMeta: { isExecutionSuccess: false },
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
dependencyMap: {},
logBlackList: {},
} as ActionEntity,

View File

@ -1,7 +1,7 @@
import evaluate, { evaluateAsync } from "workers/Evaluation/evaluate";
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { RenderModes } from "constants/WidgetConstants";
import setupEvalEnv from "../handlers/setupEvalEnv";
import { resetJSLibraries } from "workers/common/JSLibrary/resetJSLibraries";
@ -23,7 +23,7 @@ describe("evaluateSync", () => {
widgetId: "",
widgetName: "",
text: "value",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
bindingPaths: {},
reactivePaths: {},
triggerPaths: {},

View File

@ -6,7 +6,7 @@ import type {
} from "@appsmith/entities/DataTree/types";
import type { UnEvalTree, ConfigTree } from "entities/DataTree/dataTreeTypes";
import {
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";
import type { WidgetTypeConfigMap } from "WidgetProvider/factory";
@ -245,7 +245,7 @@ const BASE_WIDGET = {
type: "SKELETON_WIDGET",
parentId: "0",
version: 1,
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity;
@ -253,7 +253,7 @@ const BASE_WIDGET_CONFIG = {
logBlackList: {},
widgetId: "randomID",
type: "SKELETON_WIDGET",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
} as unknown as WidgetEntityConfig;
export const BASE_ACTION: ActionEntity = {
@ -267,7 +267,7 @@ export const BASE_ACTION: ActionEntity = {
run: {},
data: {},
responseMeta: { isExecutionSuccess: false },
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
};
export const BASE_ACTION_CONFIG: ActionEntityConfig = {
actionId: "randomId",
@ -276,7 +276,7 @@ export const BASE_ACTION_CONFIG: ActionEntityConfig = {
name: "randomActionName",
dynamicBindingPathList: [],
pluginType: PluginType.API,
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {},
reactivePaths: {
isLoading: EvaluationSubstitutionType.TEMPLATE,

View File

@ -1,7 +1,7 @@
import { PluginType } from "entities/Action";
import type { ActionEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { createEvaluationContext } from "../evaluate";
import { addPlatformFunctionsToEvalContext } from "@appsmith/workers/Evaluation/Actions";
import { overrideWebAPIs } from "../fns/overrides";
@ -103,7 +103,7 @@ describe("Expects appsmith setTimeout to pass the following criteria", () => {
run: {},
clear: {},
responseMeta: { isExecutionSuccess: false },
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
dependencyMap: {},
logBlackList: {},
} as ActionEntity,

View File

@ -4,7 +4,7 @@ import { EventType } from "constants/AppsmithActionConstants/ActionConstants";
import { PluginType } from "entities/Action";
import type { ActionEntity } from "@appsmith/entities/DataTree/types";
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
import { overrideWebAPIs } from "../overrides";
import ExecutionMetaData from "../utils/ExecutionMetaData";
import { addPlatformFunctionsToEvalContext } from "@appsmith/workers/Evaluation/Actions";
@ -26,7 +26,7 @@ const dataTree: DataTree = {
run: {},
clear: {},
responseMeta: { isExecutionSuccess: false },
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
dependencyMap: {},
logBlackList: {},
} as ActionEntity,

View File

@ -35,7 +35,7 @@ import type {
UnEvalTree,
} from "entities/DataTree/dataTreeTypes";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE_VALUE } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import type { DataTreeDiff } from "@appsmith/workers/Evaluation/evaluationUtils";
import {
@ -1080,7 +1080,7 @@ export default class DataTreeEvaluator {
const entityType = entity.ENTITY_TYPE;
if (!propertyPath) continue;
switch (entityType) {
case ENTITY_TYPE_VALUE.WIDGET: {
case ENTITY_TYPE.WIDGET: {
if (isATriggerPath) continue;
const isNewWidget =
@ -1131,7 +1131,7 @@ export default class DataTreeEvaluator {
);
break;
}
case ENTITY_TYPE_VALUE.ACTION: {
case ENTITY_TYPE.ACTION: {
const actionEntity = entity as ActionEntity;
const configProperty = propertyPath.replace(
@ -1176,7 +1176,7 @@ export default class DataTreeEvaluator {
set(safeTree, fullPropertyPath, klona(evalPropertyValue));
break;
}
case ENTITY_TYPE_VALUE.JSACTION: {
case ENTITY_TYPE.JSACTION: {
const variableList =
(entityConfig as JSActionEntityConfig).variables || [];
if (variableList.indexOf(propertyPath) === -1) break;
@ -1385,7 +1385,7 @@ export default class DataTreeEvaluator {
triggerMeta: {
source: {
id: getEntityId(entity) || "",
entityType: getEntityType(entity) || ENTITY_TYPE_VALUE.WIDGET,
entityType: getEntityType(entity) || ENTITY_TYPE.WIDGET,
name: getEntityName(entity, entityConfig) || "",
},
triggerPropertyName: fullPropertyPath?.split(".")[1] || "",

View File

@ -8,7 +8,7 @@ import type {
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import {
EvaluationSubstitutionType,
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
} from "entities/DataTree/dataTreeFactory";
export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
@ -43,7 +43,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
responseMeta: {
isExecutionSuccess: false,
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
} as unknown as ActionEntity,
@ -78,7 +78,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -158,7 +158,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -194,7 +194,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -253,7 +253,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -289,7 +289,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -364,7 +364,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -400,7 +400,7 @@ export const arrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -414,7 +414,7 @@ export const arrayAccessorCyclicDependencyConfig = {
pluginId: "5ca385dc81b37f0004b4db85",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -458,7 +458,7 @@ export const arrayAccessorCyclicDependencyConfig = {
],
dynamicTriggerPathList: [],
privateWidgets: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
defaultProps: {},
defaultMetaProps: [],
logBlackList: {
@ -558,7 +558,7 @@ export const arrayAccessorCyclicDependencyConfig = {
pluginId: "5ca385dc81b37f0004b4db85",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -594,7 +594,7 @@ export const arrayAccessorCyclicDependencyConfig = {
},
],
privateWidgets: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
defaultProps: {},
defaultMetaProps: [],
logBlackList: {
@ -694,7 +694,7 @@ export const arrayAccessorCyclicDependencyConfig = {
pluginId: "5ca385dc81b37f0004b4db85",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -729,7 +729,7 @@ export const arrayAccessorCyclicDependencyConfig = {
},
],
widgetId: "1p9hcl50i8",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
defaultProps: {},
defaultMetaProps: [],
@ -830,7 +830,7 @@ export const arrayAccessorCyclicDependencyConfig = {
actionId: "6285d928db0f9c6e620d454a",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -865,7 +865,7 @@ export const arrayAccessorCyclicDependencyConfig = {
},
],
widgetId: "1p9hcl50i8",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
defaultProps: {},
defaultMetaProps: [],

View File

@ -8,7 +8,7 @@ import type {
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import {
EvaluationSubstitutionType,
ENTITY_TYPE_VALUE,
ENTITY_TYPE,
} from "entities/DataTree/dataTreeFactory";
export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
@ -43,7 +43,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
responseMeta: {
isExecutionSuccess: false,
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
} as unknown as ActionEntity,
@ -78,7 +78,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -205,7 +205,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -241,7 +241,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -300,7 +300,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -336,7 +336,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -441,7 +441,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -476,7 +476,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -582,7 +582,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
"X-APPSMITH-DATATYPE": ["JSON"],
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
isLoading: false,
datasourceUrl: "https://jsonplaceholder.typicode.com",
},
@ -618,7 +618,7 @@ export const nestedArrayAccessorCyclicDependency: Record<string, DataTree> = {
borderRadius: "{{appsmith.theme.borderRadius.appBorderRadius}}",
fontSize: "1rem",
value: "{{ Text1.text }}",
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
} as unknown as WidgetEntity,
},
@ -632,7 +632,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
pluginId: "5ca385dc81b37f0004b4db85",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -661,7 +661,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
type: "TEXT_WIDGET",
widgetId: "1p9hcl50i8",
privateWidgets: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
defaultProps: {},
defaultMetaProps: [],
logBlackList: {
@ -776,7 +776,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
actionId: "6285d928db0f9c6e620d454a",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -811,7 +811,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
key: "value",
},
],
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
defaultProps: {},
defaultMetaProps: [],
@ -912,7 +912,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
actionId: "6285d928db0f9c6e620d454a",
pluginType: PluginType.API,
dynamicBindingPathList: [],
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
bindingPaths: {
"config.path": EvaluationSubstitutionType.TEMPLATE,
"config.body": EvaluationSubstitutionType.SMART_SUBSTITUTE,
@ -948,7 +948,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
],
widgetId: "1p9hcl50i8",
privateWidgets: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
defaultProps: {},
defaultMetaProps: [],
logBlackList: {
@ -1043,7 +1043,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
},
apiSuccessConfigTree2: {
Api1: {
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
name: "Api1",
actionId: "6285d928db0f9c6e620d454a",
pluginId: "5ca385dc81b37f0004b4db85",
@ -1174,12 +1174,12 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
type: "TEXT",
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
} as unknown as WidgetEntityConfig,
},
apiSuccessConfigTree3: {
Api1: {
ENTITY_TYPE: ENTITY_TYPE_VALUE.ACTION,
ENTITY_TYPE: ENTITY_TYPE.ACTION,
name: "Api1",
actionId: "6285d928db0f9c6e620d454a",
pluginId: "5ca385dc81b37f0004b4db85",
@ -1220,7 +1220,7 @@ export const nestedArrayAccessorCyclicDependencyConfig = {
key: "value",
},
],
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
defaultProps: {},
defaultMetaProps: [],
logBlackList: {

View File

@ -1,4 +1,4 @@
import { ENTITY_TYPE_VALUE } from "@appsmith/entities/DataTree/types";
import { ENTITY_TYPE } from "@appsmith/entities/DataTree/types";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
export const configTree = {
@ -14,7 +14,7 @@ export const configTree = {
reactivePaths: {},
triggerPaths: {},
validationPaths: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
bindingPaths: {},
dynamicTriggerPathList: [],
@ -26,7 +26,7 @@ export const configTree = {
defaultProps: {},
defaultMetaProps: ["recaptchaToken"],
logBlackList: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
widgetName: "Button1",
propertyOverrideDependency: {},
@ -99,7 +99,7 @@ export const configTree = {
type: "BUTTON_WIDGET",
dynamicTriggerPathList: [],
privateWidgets: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
propertyOverrideDependency: {},
overridingPropertyPaths: {},
defaultProps: {},
@ -365,7 +365,7 @@ export const unEvalTreeWidgetSelectWidgetConfig = {
type: "TEXT",
},
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
privateWidgets: {},
},
};

View File

@ -1,4 +1,4 @@
import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory";
import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory";
export const unEvalTree = {
MainContainer: {
@ -21,7 +21,7 @@ export const unEvalTree = {
leftColumn: 0,
children: ["j9dpft2lpu", "l0yem4eh6l"],
meta: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
},
Button1: {
widgetName: "Button1",
@ -51,7 +51,7 @@ export const unEvalTree = {
buttonVariant: "PRIMARY",
placement: "CENTER",
meta: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
},
Button2: {
widgetName: "Button2",
@ -81,7 +81,7 @@ export const unEvalTree = {
buttonVariant: "PRIMARY",
placement: "CENTER",
meta: {},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
},
appsmith: {
user: {
@ -128,7 +128,7 @@ export const unEvalTree = {
canBeRequested: true,
},
mode: "EDIT",
ENTITY_TYPE: ENTITY_TYPE_VALUE.APPSMITH,
ENTITY_TYPE: ENTITY_TYPE.APPSMITH,
},
};
@ -181,7 +181,7 @@ export const unEvalTreeWidgetSelectWidget = {
meta: {
filterText: "",
},
ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET,
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
filterText: "",
isDirty: false,
},