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C,EAAoBqD,EAAIrD,EAAoB4C,EAAEH,GAE9D,EAGD,IAAI0B,EAAqB3Z,KAA2B,qBAAIA,KAA2B,sBAAK,GACpF4Z,EAA6BD,EAAmB1d,KAAKsQ,KAAKoN,GAC9DA,EAAmB1d,KAzBC4N,IACnB,IAAIuM,EAAWvM,EAAK,GAChBgQ,EAAchQ,EAAK,GACnBiQ,EAAUjQ,EAAK,GACnB,IAAI,IAAI4L,KAAYoE,EAChBrE,EAAoBoC,EAAEiC,EAAapE,KACrCD,EAAoBO,EAAEN,GAAYoE,EAAYpE,IAIhD,IADGqE,GAASA,EAAQtE,GACdY,EAASja,QACdud,EAAgBtD,EAAS2D,OAAS,EACnCH,EAA2B/P,EAAK,C,KCrBjC2L,EAAoBwE,QAAKvc,E,MCAzB,IAAIwc,EAAOzE,EAAoBtE,EAC/BsE,EAAoBtE,EAAI,IAChB7O,QAAQ6V,IAAI,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAKnb,IAAIyY,EAAoBxO,EAAGwO,IAAsB9L,KAAKuQ,E,KCD/EzE,EAAoBtE,G","sources":["../packages/ast/src/utils.ts","ce/workers/Evaluation/getEntityForEvalContextMap.ts","workers/Evaluation/getEntityForContext.ts","ce/workers/Evaluation/Actions.ts","workers/common/JSLibrary/index.ts","utils/DynamicBindingUtils.ts","workers/Evaluation/handlers/workerEnv.ts","workers/common/DependencyMap/utils.ts","workers/Evaluation/evaluate.ts","utils/TypeHelpers.ts","../packages/ast/src/index.ts","workers/Evaluation/JSObject/index.ts","workers/Evaluation/setters.ts","../packages/ast/src/jsObject/index.ts","ce/entities/DataTree/types.ts","ee/entities/DataTree/types.ts","workers/Evaluation/fns/index.ts","ce/workers/Evaluation/evaluationUtils.ts","utils/autocomplete/types.ts","utils/autocomplete/AutocompleteDataType.ts","ce/utils/autocomplete/helpers.ts","ce/utils/autocomplete/EntityDefinitions.ts","workers/Tern/tern.worker.ts","components/editorComponents/ActionCreator/constants.ts","ce/constants/routes/appRoutes.ts","../packages/ast/src/constants/ast.ts","../webpack/bootstrap","../webpack/runtime/amd options","../webpack/runtime/chunk loaded","../webpack/runtime/compat get default export","../webpack/runtime/create fake namespace object","../webpack/runtime/define property getters","../webpack/runtime/ensure chunk","../webpack/runtime/get javascript chunk filename","../webpack/runtime/get mini-css chunk filename","../webpack/runtime/global","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/make namespace object","../webpack/runtime/node module decorator","../webpack/runtime/runtimeId","../webpack/runtime/publicPath","../webpack/runtime/compat","../webpack/runtime/importScripts chunk loading","../webpack/runtime/nonce","../webpack/runtime/startup chunk dependencies","../webpack/startup"],"sourcesContent":["import unescapeJS from \"unescape-js\";\nimport type { PropertyNode } from \"../index\";\nimport { isLiteralNode } from \"../index\";\n\nconst beginsWithLineBreakRegex = /^\\s+|\\s+$/;\n\nexport function sanitizeScript(js: string, evaluationVersion: number) {\n // We remove any line breaks from the beginning of the script because that\n // makes the final function invalid. We also unescape any escaped characters\n // so that eval can happen\n //default value of evalutaion version is 2\n evaluationVersion = evaluationVersion ? evaluationVersion : 2;\n const trimmedJS = js.replace(beginsWithLineBreakRegex, \"\");\n\n return evaluationVersion > 1 ? trimmedJS : unescapeJS(trimmedJS);\n}\n\n// For the times when you need to know if something truly an object like { a: 1, b: 2}\n// typeof, lodash.isObject and others will return false positives for things like array, null, etc\nexport const isTrueObject = (\n item: unknown,\n): item is Record => {\n return Object.prototype.toString.call(item) === \"[object Object]\";\n};\n\nexport const getNameFromPropertyNode = (node: PropertyNode): string =>\n isLiteralNode(node.key) ? String(node.key.value) : node.key.name;\n\ninterface Position {\n line: number;\n ch: number;\n}\n\nexport const extractContentByPosition = (\n content: string,\n position: { from: Position; to: Position },\n) => {\n const eachLine = content.split(\"\\n\");\n\n let returnedString = \"\";\n\n for (let i = position.from.line; i <= position.to.line; i++) {\n if (i === position.from.line) {\n returnedString =\n position.from.line !== position.to.line\n ? eachLine[position.from.line].slice(position.from.ch)\n : eachLine[position.from.line].slice(\n position.from.ch,\n position.to.ch + 1,\n );\n } else if (i === position.to.line) {\n returnedString += eachLine[position.to.line].slice(0, position.to.ch + 1);\n } else {\n returnedString += eachLine[i];\n }\n\n if (i !== position.to.line) {\n returnedString += \"\\n\";\n }\n }\n\n return returnedString;\n};\n\nexport const getStringValue = (\n inputValue: string | number | boolean | RegExp,\n) => {\n if (typeof inputValue === \"object\" || typeof inputValue === \"boolean\") {\n inputValue = JSON.stringify(inputValue);\n } else if (typeof inputValue === \"number\" || typeof inputValue === \"string\") {\n inputValue += \"\";\n }\n\n return inputValue;\n};\n","import { ENTITY_TYPE } from \"ee/entities/DataTree/types\";\nimport type { DataTreeEntity } from \"entities/DataTree/dataTreeTypes\";\nimport { getJSActionForEvalContext } from \"ee/workers/Evaluation/getJSActionForEvalContext\";\n\nexport const getEntityForEvalContextMap: Record<\n string,\n (entityName: string, entity: DataTreeEntity) => unknown\n> = {\n [ENTITY_TYPE.JSACTION]: (entityName, entity) => {\n return getJSActionForEvalContext(entityName, entity);\n },\n};\n","import { getEntityForEvalContextMap } from \"ee/workers/Evaluation/getEntityForEvalContextMap\";\nimport type { DataTreeEntity } from \"entities/DataTree/dataTreeTypes\";\n\nexport function getEntityForEvalContext(\n entity: DataTreeEntity,\n entityName: string,\n) {\n const getterMethod = getEntityForEvalContextMap[entity.ENTITY_TYPE];\n\n if (!getterMethod) return entity;\n\n return getterMethod(entityName, entity);\n}\n","/* eslint-disable @typescript-eslint/ban-types */\n\nimport set from \"lodash/set\";\nimport type { DataTreeEntityConfig } from \"ee/entities/DataTree/types\";\nimport type {\n ConfigTree,\n DataTree,\n DataTreeEntity,\n} from \"entities/DataTree/dataTreeTypes\";\nimport type { EvalContext } from \"workers/Evaluation/evaluate\";\nimport type { EvaluationVersion } from \"constants/EvalConstants\";\nimport { addFn } from \"workers/Evaluation/fns/utils/fnGuard\";\nimport {\n getEntityFunctions,\n getPlatformFunctions,\n} from \"ee/workers/Evaluation/fns\";\nimport { getEntityForEvalContext } from \"workers/Evaluation/getEntityForContext\";\nimport { klona } from \"klona/full\";\nimport { isEmpty } from \"lodash\";\nimport setters from \"workers/Evaluation/setters\";\ndeclare global {\n /** All identifiers added to the worker global scope should also\n * be included in the DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS in\n * app/client/src/constants/WidgetValidation.ts\n * */\n\n interface Window {\n $isDataField: boolean;\n $isAsync: boolean;\n $evaluationVersion: EvaluationVersion;\n $cloudHosting: boolean;\n }\n}\n\nexport enum ExecutionType {\n PROMISE = \"PROMISE\",\n TRIGGER = \"TRIGGER\",\n}\n\n/**\n * This method returns new dataTree with entity function and platform function\n */\nexport const getDataTreeContext = (args: {\n dataTree: Readonly;\n removeEntityFunctions?: boolean;\n isTriggerBased: boolean;\n configTree: ConfigTree;\n}) => {\n const {\n configTree,\n dataTree,\n isTriggerBased,\n removeEntityFunctions = false,\n } = args;\n const EVAL_CONTEXT: EvalContext = {};\n\n const dataTreeEntries = Object.entries(dataTree);\n const entityFunctionCollection: Record> = {};\n\n if (isTriggerBased && !removeEntityFunctions) setters.clear();\n\n for (const [entityName, entity] of dataTreeEntries) {\n EVAL_CONTEXT[entityName] = getEntityForEvalContext(entity, entityName);\n\n // when we evaluate data field and removeEntityFunctions is true then we skip adding entity function to evalContext\n const skipEntityFunctions = !removeEntityFunctions && !isTriggerBased;\n\n if (skipEntityFunctions) continue;\n\n for (const entityFn of getEntityFunctions()) {\n if (!entityFn.qualifier(entity)) continue;\n\n const func = entityFn.fn(entity, entityName);\n const fullPath = `${entityFn.path || `${entityName}.${entityFn.name}`}`;\n\n set(entityFunctionCollection, fullPath, func);\n }\n\n // Don't add entity function ( setter method ) to evalContext if removeEntityFunctions is true\n if (removeEntityFunctions) continue;\n\n const entityConfig = configTree[entityName];\n const entityMethodMap = setters.getEntitySettersFromConfig(\n entityConfig,\n entityName,\n entity,\n );\n\n if (isEmpty(entityMethodMap)) continue;\n\n EVAL_CONTEXT[entityName] = Object.assign(\n {},\n dataTree[entityName],\n entityMethodMap,\n );\n }\n\n if (removeEntityFunctions) {\n removeEntityFunctionsFromEvalContext(\n entityFunctionCollection,\n EVAL_CONTEXT,\n );\n\n return EVAL_CONTEXT;\n }\n\n if (!isTriggerBased) {\n return EVAL_CONTEXT;\n }\n\n // if eval is not trigger based i.e., sync eval then we skip adding entity function to evalContext\n addEntityFunctionsToEvalContext(EVAL_CONTEXT, entityFunctionCollection);\n\n return EVAL_CONTEXT;\n};\n\nexport const addEntityFunctionsToEvalContext = (\n evalContext: EvalContext,\n entityFunctionCollection: Record>,\n) => {\n for (const [entityName, funcObj] of Object.entries(\n entityFunctionCollection,\n )) {\n evalContext[entityName] = Object.assign(\n {},\n evalContext[entityName],\n funcObj,\n );\n }\n};\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const addPlatformFunctionsToEvalContext = (context: any) => {\n for (const fnDef of getPlatformFunctions()) {\n addFn(context, fnDef.name, fnDef.fn.bind(context));\n }\n};\n\nexport function getAllSetterFunctions(\n dataTree: DataTree,\n configTree: ConfigTree,\n) {\n const entitiesSetterFunctions: Record = {};\n const dataTreeEntries = Object.entries(dataTree);\n\n for (const [entityName, entity] of dataTreeEntries) {\n const entityConfig = configTree[entityName];\n const entityMethodMap = setters.getEntitySettersFromConfig(\n entityConfig,\n entityName,\n entity,\n );\n\n if (isEmpty(entityMethodMap)) continue;\n\n for (const methodName of Object.keys(entityMethodMap)) {\n entitiesSetterFunctions[`${entityName}.${methodName}`] = true;\n }\n }\n\n return entitiesSetterFunctions;\n}\n\nexport function getEntitySetterFunctions(\n entityConfig: DataTreeEntityConfig,\n entityName: string,\n entity: DataTreeEntity,\n) {\n const entitySetterFunctions: Record = {};\n const entityMethodMap = setters.getEntitySettersFromConfig(\n entityConfig,\n entityName,\n entity,\n );\n\n for (const methodName of Object.keys(entityMethodMap)) {\n entitySetterFunctions[`${entityName}.${methodName}`] = true;\n }\n\n return entitySetterFunctions;\n}\n\nexport const getAllAsyncFunctions = (\n dataTree: DataTree,\n configTree: ConfigTree,\n) => {\n let allAsyncFunctions: Record = {};\n const dataTreeEntries = Object.entries(dataTree);\n\n for (const [entityName, entity] of dataTreeEntries) {\n for (const entityFn of getEntityFunctions()) {\n if (!entityFn.qualifier(entity)) continue;\n\n const fullPath = `${entityFn.path || `${entityName}.${entityFn.name}`}`;\n\n allAsyncFunctions[fullPath] = true;\n }\n }\n\n const setterMethods = getAllSetterFunctions(dataTree, configTree);\n\n allAsyncFunctions = { ...allAsyncFunctions, ...setterMethods };\n\n for (const platformFn of getPlatformFunctions()) {\n allAsyncFunctions[platformFn.name] = true;\n }\n\n return allAsyncFunctions;\n};\n\nexport const removeEntityFunctionsFromEvalContext = (\n entityFunctionCollection: Record>,\n evalContext: EvalContext,\n) => {\n for (const [entityName, funcObj] of Object.entries(\n entityFunctionCollection,\n )) {\n const entity = klona(evalContext[entityName]);\n\n Object.keys(funcObj).forEach((entityFn) => {\n delete entity[entityFn];\n });\n evalContext[entityName] = entity;\n }\n};\n","import lodashPackageJson from \"lodash/package.json\";\nimport momentPackageJson from \"moment-timezone/package.json\";\n\nexport interface JSLibrary {\n version?: string;\n docsURL: string;\n name: string;\n accessor: string[];\n url?: string;\n id?: string;\n}\n\nexport const defaultLibraries: JSLibrary[] = [\n {\n accessor: [\"_\"],\n version: lodashPackageJson.version,\n docsURL: `https://lodash.com/docs/${lodashPackageJson.version}`,\n name: \"lodash\",\n },\n {\n accessor: [\"moment\"],\n version: momentPackageJson.version,\n docsURL: `https://momentjs.com/docs/`,\n name: \"moment\",\n },\n {\n accessor: [\"forge\"],\n version: \"1.3.0\",\n docsURL: \"https://github.com/digitalbazaar/forge\",\n name: \"forge\",\n },\n];\n\nexport const JSLibraries = [...defaultLibraries];\n\nconst JSLibraryAccessorModifier = () => {\n let jsLibraryAccessorSet = new Set(\n JSLibraries.flatMap((lib) => lib.accessor),\n );\n\n return {\n regenerateSet: () => {\n jsLibraryAccessorSet = new Set(\n JSLibraries.flatMap((lib) => lib.accessor),\n );\n\n return;\n },\n getSet: () => {\n return jsLibraryAccessorSet;\n },\n };\n};\n\nexport const JSLibraryAccessor = JSLibraryAccessorModifier();\n\nexport const libraryReservedIdentifiers = defaultLibraries.reduce(\n (acc, lib) => {\n lib.accessor.forEach((a) => (acc[a] = true));\n\n return acc;\n },\n {} as Record,\n);\n","import _, { get, isString } from \"lodash\";\nimport { DATA_BIND_REGEX } from \"constants/BindingsConstants\";\nimport type { Action } from \"entities/Action\";\nimport type { WidgetProps } from \"widgets/BaseWidget\";\nimport type { Severity } from \"entities/AppsmithConsole\";\nimport {\n getEntityNameAndPropertyPath,\n isAction,\n isJSAction,\n isTrueObject,\n isWidget,\n} from \"ee/workers/Evaluation/evaluationUtils\";\nimport type { DataTreeEntityConfig } from \"ee/entities/DataTree/types\";\nimport type { DataTreeEntity } from \"entities/DataTree/dataTreeTypes\";\nimport { getType, Types } from \"./TypeHelpers\";\nimport { ViewTypes } from \"components/formControls/utils\";\n\nexport type DependencyMap = Record>;\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormEditorConfigs = Record;\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormSettingsConfigs = Record;\nexport type FormDependencyConfigs = Record;\nexport type FormDatasourceButtonConfigs = Record;\n\nfunction hasNonStringSemicolons(stringifiedJS: string) {\n // This regex pattern matches semicolons that are not inside single or double quotes\n const regex = /;(?=(?:[^']*'[^']*')*[^']*$)(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/g;\n\n return regex.test(stringifiedJS);\n}\n\n// referencing DATA_BIND_REGEX fails for the value \"{{Table1.tableData[Table1.selectedRowIndex]}}\" if you run it multiple times and don't recreate\nexport const isDynamicValue = (value: string): boolean =>\n DATA_BIND_REGEX.test(value);\n\n//{{}}{{}}}\nexport function getDynamicStringSegments(dynamicString: string): string[] {\n let stringSegments = [];\n const indexOfDoubleParanStart = dynamicString.indexOf(\"{{\");\n\n if (indexOfDoubleParanStart === -1) {\n return [dynamicString];\n }\n\n //{{}}{{}}}\n const firstString = dynamicString.substring(0, indexOfDoubleParanStart);\n\n firstString && stringSegments.push(firstString);\n let rest = dynamicString.substring(\n indexOfDoubleParanStart,\n dynamicString.length,\n );\n //{{}}{{}}}\n let sum = 0;\n\n for (let i = 0; i <= rest.length - 1; i++) {\n const char = rest[i];\n const prevChar = rest[i - 1];\n\n if (char === \"{\") {\n sum++;\n } else if (char === \"}\") {\n sum--;\n\n if (prevChar === \"}\" && sum === 0) {\n stringSegments.push(rest.substring(0, i + 1));\n rest = rest.substring(i + 1, rest.length);\n\n if (rest) {\n stringSegments = stringSegments.concat(\n getDynamicStringSegments(rest),\n );\n break;\n }\n }\n }\n }\n\n if (sum !== 0 && dynamicString !== \"\") {\n return [dynamicString];\n }\n\n return stringSegments;\n}\n\n//{{}}{{}}}\nexport const getDynamicBindings = (\n dynamicString: string,\n entity?: DataTreeEntity,\n): { stringSegments: string[]; jsSnippets: string[] } => {\n // Protect against bad string parse\n if (!isString(dynamicString)) {\n return { stringSegments: [], jsSnippets: [] };\n }\n\n const sanitisedString = dynamicString.trim();\n\n if (entity && isJSAction(entity)) {\n return { stringSegments: [sanitisedString], jsSnippets: [sanitisedString] };\n }\n\n // Get the {{binding}} bound values\n const stringSegments = getDynamicStringSegments(sanitisedString);\n // Get the \"binding\" path values\n const jsSnippets = stringSegments.map((segment) => {\n const length = segment.length;\n const matches = isDynamicValue(segment);\n\n if (matches) {\n return segment.substring(2, length - 2);\n }\n\n return \"\";\n });\n\n return { stringSegments, jsSnippets };\n};\n\nexport const combineDynamicBindings = (\n jsSnippets: string[],\n stringSegments: string[],\n) => {\n return stringSegments\n .map((segment, index) => {\n if (jsSnippets[index] && jsSnippets[index].length > 0) {\n return addOperatorPrecedenceIfNeeded(jsSnippets[index]);\n } else {\n return JSON.stringify(segment);\n }\n })\n .join(\" + \");\n};\n\n/**\n * Operator precedence example: JSCode = Color is {{ currentItem.color || \"Blue\"}} PS: currentItem.color is undefined\n * Previously this code would be transformed to (() => \"Color is\" + currentItem.color || \"Blue\")() which evaluates to \"Color is undefined\" rather than \"Color is Blue\"\n * with precedence we'd have (() => \"Color is\" + (currentItem.color || \"Blue\"))() which evaluates to Color is Blue, because the parentheses change the order of evaluation, giving higher precedence in this case to (currentItem.color || \"Blue\").\n */\nfunction addOperatorPrecedenceIfNeeded(stringifiedJS: string) {\n /**\n * parenthesis doesn't work with ; i.e Color is {{ currentItem.color || \"Blue\" ;}} cant be (() => \"Color is\" + (currentItem.color || \"Blue\";))()\n */\n if (!hasNonStringSemicolons(stringifiedJS)) {\n return `(${stringifiedJS})`;\n }\n\n return stringifiedJS;\n}\n\nexport enum EvalErrorTypes {\n CYCLICAL_DEPENDENCY_ERROR = \"CYCLICAL_DEPENDENCY_ERROR\",\n EVAL_PROPERTY_ERROR = \"EVAL_PROPERTY_ERROR\",\n EVAL_TREE_ERROR = \"EVAL_TREE_ERROR\",\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n BAD_UNEVAL_TREE_ERROR = \"BAD_UNEVAL_TREE_ERROR\",\n PARSE_JS_ERROR = \"PARSE_JS_ERROR\",\n EXTRACT_DEPENDENCY_ERROR = \"EXTRACT_DEPENDENCY_ERROR\",\n CLONE_ERROR = \"CLONE_ERROR\",\n SERIALIZATION_ERROR = \"SERIALIZATION_ERROR\",\n}\n\nexport interface EvalError {\n type: EvalErrorTypes;\n message: string;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n context?: Record;\n}\n\nexport interface DynamicPath {\n key: string;\n value?: string;\n}\n\nexport interface WidgetDynamicPathListProps {\n dynamicBindingPathList?: DynamicPath[];\n dynamicTriggerPathList?: DynamicPath[];\n dynamicPropertyPathList?: DynamicPath[];\n}\n\nexport interface EntityWithBindings {\n dynamicBindingPathList?: DynamicPath[];\n}\n\nexport const getEntityDynamicBindingPathList = (\n entity: EntityWithBindings,\n): DynamicPath[] => {\n if (\n entity &&\n entity.dynamicBindingPathList &&\n Array.isArray(entity.dynamicBindingPathList)\n ) {\n return [...entity.dynamicBindingPathList];\n }\n\n return [];\n};\n\nexport const isPathADynamicBinding = (\n entity: EntityWithBindings,\n path: string,\n): boolean => {\n if (\n entity &&\n entity.dynamicBindingPathList &&\n Array.isArray(entity.dynamicBindingPathList)\n ) {\n return _.find(entity.dynamicBindingPathList, { key: path }) !== undefined;\n }\n\n return false;\n};\n/**\n * Get property path from full property path\n * Input: \"Table1.meta.searchText\" => Output: \"meta.searchText\"\n * @param {string} fullPropertyPath\n * @return {*}\n */\nexport const getPropertyPath = (fullPropertyPath: string) => {\n return fullPropertyPath.substring(fullPropertyPath.indexOf(\".\") + 1);\n};\n\nexport const getWidgetDynamicTriggerPathList = (\n widget: WidgetProps,\n): DynamicPath[] => {\n if (\n widget &&\n widget.dynamicTriggerPathList &&\n Array.isArray(widget.dynamicTriggerPathList)\n ) {\n return [...widget.dynamicTriggerPathList];\n }\n\n return [];\n};\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isPathDynamicTrigger = (widget: any, path: string): boolean => {\n if (\n widget &&\n widget.dynamicTriggerPathList &&\n Array.isArray(widget.dynamicTriggerPathList)\n ) {\n return _.find(widget.dynamicTriggerPathList, { key: path }) !== undefined;\n }\n\n return false;\n};\n\nexport const getWidgetDynamicPropertyPathList = (\n widget: WidgetProps,\n): DynamicPath[] => {\n if (\n widget &&\n widget.dynamicPropertyPathList &&\n Array.isArray(widget.dynamicPropertyPathList)\n ) {\n return [...widget.dynamicPropertyPathList];\n }\n\n return [];\n};\n\nexport const isPathDynamicProperty = (\n widget: WidgetProps,\n path: string,\n): boolean => {\n if (\n widget &&\n widget.dynamicPropertyPathList &&\n Array.isArray(widget.dynamicPropertyPathList)\n ) {\n return _.find(widget.dynamicPropertyPathList, { key: path }) !== undefined;\n }\n\n return false;\n};\n\nexport const THEME_BINDING_REGEX = /{{.*appsmith\\.theme\\..*}}/;\n\nexport const isThemeBoundProperty = (\n widget: WidgetProps,\n path: string,\n): boolean => {\n return widget && widget[path] && THEME_BINDING_REGEX.test(widget[path]);\n};\n\nexport const unsafeFunctionForEval = [\n \"XMLHttpRequest\",\n \"setImmediate\",\n \"Navigator\",\n];\n\nexport const isChildPropertyPath = (\n parentPropertyPath: string,\n childPropertyPath: string,\n // In non-strict mode, an exact match is treated as a child path\n // Eg. \"Api1\" is a child property path of \"Api1\"\n strict = false,\n): boolean => {\n return (\n (!strict && parentPropertyPath === childPropertyPath) ||\n childPropertyPath.startsWith(`${parentPropertyPath}.`) ||\n childPropertyPath.startsWith(`${parentPropertyPath}[`)\n );\n};\n\n/**\n * Paths set via evaluator on entities\n * During evaluation, the evaluator will set various data points\n * on the entity objects to describe their state while evaluating.\n * This information can be found on the following paths\n * These paths are meant to be objects with\n * information about the properties in\n * a single place\n *\n * Stored in a flattened object like\n * widget.__evaluation__.errors.primaryColumns.customColumn.computedValue = [...]\n **/\nexport const EVALUATION_PATH = \"__evaluation__\";\nexport const EVAL_ERROR_PATH = `${EVALUATION_PATH}.errors`;\nexport const EVAL_VALUE_PATH = `${EVALUATION_PATH}.evaluatedValues`;\n\n/**\n * non-populated object\n {\n __evaluation__:{\n evaluatedValues:{\n primaryColumns: [...],\n primaryColumns.status: {...},\n primaryColumns.action: {...}\n }\n }\n }\n\n * Populated Object\n {\n __evaluation__:{\n evaluatedValues:{\n primaryColumns: {\n status: [...],\n action:[...]\n }\n }\n }\n }\n\n */\nconst getNestedEvalPath = (\n fullPropertyPath: string,\n pathType: string,\n fullPath = true,\n isPopulated = false,\n) => {\n const { entityName, propertyPath } =\n getEntityNameAndPropertyPath(fullPropertyPath);\n const nestedPath = isPopulated\n ? `${pathType}.${propertyPath}`\n : `${pathType}.['${propertyPath}']`;\n\n if (fullPath) {\n return `${entityName}.${nestedPath}`;\n }\n\n return nestedPath;\n};\n\nexport const getEvalErrorPath = (\n fullPropertyPath: string,\n options = {\n fullPath: true,\n isPopulated: false,\n },\n) => {\n return getNestedEvalPath(\n fullPropertyPath,\n EVAL_ERROR_PATH,\n options.fullPath,\n options.isPopulated,\n );\n};\n\nexport const getEvalValuePath = (\n fullPropertyPath: string,\n options = {\n fullPath: true,\n isPopulated: false,\n },\n) => {\n return getNestedEvalPath(\n fullPropertyPath,\n EVAL_VALUE_PATH,\n options.fullPath,\n options.isPopulated,\n );\n};\n\nexport enum PropertyEvaluationErrorType {\n VALIDATION = \"VALIDATION\",\n PARSE = \"PARSE\",\n LINT = \"LINT\",\n}\n\nexport enum PropertyEvaluationErrorCategory {\n ACTION_INVOCATION_IN_DATA_FIELD = \"ACTION_INVOCATION_IN_DATA_FIELD\",\n}\nexport interface PropertyEvaluationErrorKind {\n category: PropertyEvaluationErrorCategory;\n rootcause: string;\n}\n\nexport interface DataTreeError {\n raw: string;\n errorMessage: Error;\n severity: Severity.WARNING | Severity.ERROR;\n}\n\nexport interface EvaluationError extends DataTreeError {\n errorType:\n | PropertyEvaluationErrorType.PARSE\n | PropertyEvaluationErrorType.VALIDATION;\n originalBinding?: string;\n kind?: Partial;\n}\n\nexport interface LintError extends DataTreeError {\n errorType: PropertyEvaluationErrorType.LINT;\n errorSegment: string;\n originalBinding: string;\n variables: (string | undefined | null)[];\n code: string;\n line: number;\n ch: number;\n originalPath?: string;\n lintLength?: number;\n}\n\nexport interface DataTreeEvaluationProps {\n __evaluation__?: {\n errors: Record;\n evaluatedValues?: Record;\n };\n}\n\nexport const PropertyEvalErrorTypeDebugMessage: Record<\n PropertyEvaluationErrorType,\n (propertyPath: string) => string\n> = {\n [PropertyEvaluationErrorType.VALIDATION]: (propertyPath: string) =>\n `The value at ${propertyPath} is invalid`,\n [PropertyEvaluationErrorType.PARSE]: () => `Could not parse the binding`,\n [PropertyEvaluationErrorType.LINT]: () => `Errors found while evaluating`,\n};\n\n// this variable temporarily holds dynamic paths generated by the recursive function (getDynamicValuePaths - Line 468).\nlet temporaryDynamicPathStore: DynamicPath[] = [];\n\n// recursive function to get full key path of any object that has dynamic bindings.\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getDynamicValuePaths = (val: any, parentPath: string) => {\n if (isString(val) && isDynamicValue(val)) {\n return temporaryDynamicPathStore.push({ key: `${parentPath}` });\n }\n\n if (Array.isArray(val)) {\n val.forEach((obj, index) => {\n return getDynamicValuePaths(obj, `${parentPath}[${index}]`);\n });\n }\n\n if (isTrueObject(val)) {\n Object.entries(val).forEach(([key, value]) => {\n getDynamicValuePaths(value, `${parentPath}.${key}`);\n });\n }\n};\n\nexport function getDynamicBindingsChangesSaga(\n action: Action,\n value: unknown,\n field: string,\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formData?: any,\n) {\n const bindingField = field.replace(\"actionConfiguration.\", \"\");\n // we listen to any viewType changes.\n const viewType = field.endsWith(\".viewType\");\n let dynamicBindings: DynamicPath[] = action.dynamicBindingPathList\n ? [...action.dynamicBindingPathList]\n : [];\n\n if (field.endsWith(\".jsonData\") || field.endsWith(\".componentData\")) {\n return dynamicBindings;\n }\n\n if (\n action.datasource &&\n (\"datasourceConfiguration\" in action.datasource ||\n \"datasourceConfiguration\" in (formData?.datasource || {})) &&\n field === \"datasource\"\n ) {\n // only the datasource.datasourceConfiguration.url can be a dynamic field\n dynamicBindings = dynamicBindings.filter(\n (binding) => binding.key !== \"datasourceUrl\" && binding.key !== \"path\",\n );\n // ideally as we check for the datasource url, we should check for the path field as well.\n const datasourceUrl = action.datasource?.datasourceConfiguration?.url || \"\";\n const datasourcePathField = action.actionConfiguration?.path;\n const datasourceFormPathField = formData?.actionConfiguration?.path;\n\n isDynamicValue(datasourceUrl) &&\n dynamicBindings.push({ key: \"datasourceUrl\" });\n\n // as we check the datasource url for bindings, check the path too.\n isDynamicValue(datasourcePathField || datasourceFormPathField) &&\n dynamicBindings.push({ key: \"path\" });\n\n return dynamicBindings;\n }\n\n // When a key-value pair is added or deleted from a fieldArray\n // Value is an Array representing the new fieldArray.\n\n if (Array.isArray(value)) {\n // first we clear the dynamic bindings of any paths that is a child of the current path.\n dynamicBindings = dynamicBindings.filter(\n (binding) => !isChildPropertyPath(bindingField, binding.key),\n );\n\n // then we recursively go through the value and find paths with dynamic bindings\n temporaryDynamicPathStore = [];\n\n if (!!value) {\n getDynamicValuePaths(value, bindingField);\n }\n\n if (!!temporaryDynamicPathStore && temporaryDynamicPathStore.length > 0) {\n dynamicBindings = [...dynamicBindings, ...temporaryDynamicPathStore];\n }\n } else if (getType(value) === Types.OBJECT) {\n dynamicBindings = dynamicBindings.filter((dynamicPath) => {\n if (isChildPropertyPath(bindingField, dynamicPath.key)) {\n const childPropertyValue = _.get(value, dynamicPath.key);\n\n return isDynamicValue(childPropertyValue);\n }\n\n return !!dynamicPath;\n });\n } else if (typeof value === \"string\") {\n const fieldExists = _.some(dynamicBindings, { key: bindingField });\n\n const isDynamic = isDynamicValue(value);\n\n if (!isDynamic && fieldExists) {\n dynamicBindings = dynamicBindings.filter((d) => d.key !== bindingField);\n }\n\n if (isDynamic && !fieldExists) {\n dynamicBindings = [...dynamicBindings, { key: bindingField }];\n }\n }\n\n // the reason this is done is to change the dynamicBindingsPathlist of a component when a user toggles the form control\n // from component mode to json mode and vice versa.\n\n // when in json mode, we want to get rid of all the existing componentData paths and replace it with a single path for the json mode\n // for example: [{key: 'formData.sortBy.data[0].column'}, {key: 'formData.sortBy.data[1].column'}] will be replaced with just this [{key: 'formData.sortBy.data'}]\n\n // when in component mode, we want to first remove all the paths for json mode and\n // get back all the paths in the componentData that have dynamic bindings and add them to the the dynamic bindings pathlist.\n // for example: [{key: 'formData.sortBy.data'}] will be replaced with this [{key: 'formData.sortBy.data[0].column'}, {key: 'formData.sortBy.data[1].column'}]\n\n // if the currently changing field is a component's view type\n if (!!viewType) {\n const dataBindingField = bindingField.replace(\".viewType\", \".data\");\n\n // then we filter the field of any paths that includes the binding fields\n dynamicBindings = dynamicBindings.filter(\n (dynamicPath) => !dynamicPath?.key?.includes(dataBindingField),\n );\n\n // if the value of the viewType is of json and, we push in the field\n if (value === ViewTypes.JSON) {\n const jsonFieldPath = field.replace(\".viewType\", \".jsonData\");\n const jsonFieldValue = get(action, jsonFieldPath);\n\n if (isDynamicValue(jsonFieldValue)) {\n dynamicBindings.push({ key: dataBindingField });\n }\n } else if (value === ViewTypes.COMPONENT) {\n const componentFieldPath = field.replace(\".viewType\", \".componentData\");\n const componentFieldValue = get(action, componentFieldPath);\n\n temporaryDynamicPathStore = [];\n\n if (!!componentFieldValue) {\n getDynamicValuePaths(componentFieldValue, dataBindingField);\n }\n\n if (!!temporaryDynamicPathStore && temporaryDynamicPathStore.length > 0) {\n dynamicBindings = [...dynamicBindings, ...temporaryDynamicPathStore];\n }\n }\n }\n\n return dynamicBindings;\n}\n\nexport function getEntityType(entity: DataTreeEntity) {\n return \"ENTITY_TYPE\" in entity && entity.ENTITY_TYPE;\n}\n\nexport function getEntityId(entity: DataTreeEntity) {\n if (isAction(entity)) return entity.actionId;\n\n if (isWidget(entity)) return entity.widgetId;\n\n if (isJSAction(entity)) return entity.actionId;\n}\n\nexport function getEntityName(\n entity: DataTreeEntity,\n entityConfig: DataTreeEntityConfig,\n) {\n if (isAction(entity)) return entityConfig.name;\n\n if (isWidget(entity)) return entity.widgetName;\n\n if (isJSAction(entity)) return entityConfig.name;\n}\n","import type { FeatureFlags } from \"ee/entities/FeatureFlag\";\n\nexport class WorkerEnv {\n static flags: FeatureFlags = {} as FeatureFlags;\n static cloudHosting: boolean;\n\n static setFeatureFlags(featureFlags: FeatureFlags) {\n WorkerEnv.flags = featureFlags;\n }\n\n static setCloudHosting(cloudHosting: boolean) {\n WorkerEnv.cloudHosting = cloudHosting;\n }\n\n static getFeatureFlags() {\n return WorkerEnv.flags;\n }\n\n static getCloudHosting() {\n return WorkerEnv.cloudHosting;\n }\n}\n","import { find, toPath, union } from \"lodash\";\nimport type { EvalError } from \"utils/DynamicBindingUtils\";\nimport { EvalErrorTypes } from \"utils/DynamicBindingUtils\";\nimport { extractIdentifierInfoFromCode } from \"@shared/ast\";\nimport {\n convertPathToString,\n getEntityNameAndPropertyPath,\n isJSActionConfig,\n isWidget,\n} from \"ee/workers/Evaluation/evaluationUtils\";\n\nimport type { WidgetEntityConfig } from \"ee/entities/DataTree/types\";\nimport type {\n ConfigTree,\n DataTreeEntity,\n} from \"entities/DataTree/dataTreeTypes\";\nimport {\n DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS,\n JAVASCRIPT_KEYWORDS,\n} from \"constants/WidgetValidation\";\nimport { libraryReservedIdentifiers } from \"workers/common/JSLibrary\";\n\n/** This function extracts validReferences and invalidReferences from a binding {{}}\n * @param script\n * @param allPaths\n * @returns validReferences - Valid references from bindings\n * invalidReferences- References which are currently invalid\n * @example - For binding {{unknownEntity.name + Api1.name}}, it returns\n * {\n * validReferences:[Api1.name],\n * invalidReferences: [unknownEntity.name]\n * }\n */\nexport const extractInfoFromBinding = (\n script: string,\n allKeys: Record,\n) => {\n const { references } = extractIdentifierInfoFromCode(\n script,\n self.evaluationVersion,\n invalidEntityIdentifiers,\n );\n\n return getPrunedReferences(references, allKeys);\n};\n\nexport const getPrunedReferences = (\n references: string[],\n allKeys: Record,\n) => {\n const prunedReferences: Set = new Set();\n\n references.forEach((reference: string) => {\n // If the identifier exists directly, add it and return\n if (allKeys.hasOwnProperty(reference)) {\n prunedReferences.add(reference);\n\n return;\n }\n\n const subpaths = toPath(reference);\n let current = \"\";\n\n // We want to keep going till we reach top level, but not add top level\n // Eg: Input1.text should not depend on entire Table1 unless it explicitly asked for that.\n // This is mainly to avoid a lot of unnecessary evals, if we feel this is wrong\n // we can remove the length requirement, and it will still work\n while (subpaths.length > 1) {\n current = convertPathToString(subpaths);\n\n // We've found the dep, add it and return\n if (allKeys.hasOwnProperty(current)) {\n prunedReferences.add(current);\n\n return;\n }\n\n subpaths.pop();\n }\n\n // If no valid reference is derived, add reference as is\n prunedReferences.add(reference);\n });\n\n return Array.from(prunedReferences);\n};\n\ninterface BindingsInfo {\n references: string[];\n errors: EvalError[];\n}\nexport const extractInfoFromBindings = (\n bindings: string[],\n allKeys: Record,\n) => {\n return bindings.reduce(\n (bindingsInfo: BindingsInfo, binding) => {\n try {\n const references = extractInfoFromBinding(binding, allKeys);\n\n return {\n ...bindingsInfo,\n references: union(bindingsInfo.references, references),\n };\n } catch (error) {\n const newEvalError: EvalError = {\n type: EvalErrorTypes.EXTRACT_DEPENDENCY_ERROR,\n message: (error as Error).message,\n context: {\n script: binding,\n },\n };\n\n return {\n ...bindingsInfo,\n errors: union(bindingsInfo.errors, [newEvalError]),\n };\n }\n },\n { references: [], errors: [] },\n );\n};\n\n/**This function returns a unique array containing a merge of both arrays\n * @param currentArr\n * @param updateArr\n * @returns A unique array containing a merge of both arrays\n */\nexport const mergeArrays = (currentArr: T[], updateArr: T[]): T[] => {\n if (!currentArr) return updateArr;\n\n return union(currentArr, updateArr);\n};\n\n/**\n * Identifiers which can not be valid names of entities and are not dynamic in nature.\n * therefore should be removed from the list of references extracted from code.\n * NB: DATA_TREE_KEYWORDS in app/client/src/constants/WidgetValidation.ts isn't included, although they are not valid entity names,\n * they can refer to potentially dynamic entities.\n * Eg. \"appsmith\"\n */\nexport const invalidEntityIdentifiers: Record = {\n ...JAVASCRIPT_KEYWORDS,\n ...DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS,\n ...libraryReservedIdentifiers,\n};\n\nexport function isADynamicTriggerPath(\n entity: DataTreeEntity,\n propertyPath: string,\n entityConfig: WidgetEntityConfig,\n) {\n if (isWidget(entity)) {\n const dynamicTriggerPathlist = entityConfig?.dynamicTriggerPathList;\n const isTriggerPath = find(dynamicTriggerPathlist, { key: propertyPath });\n\n if (isTriggerPath) {\n return true;\n }\n\n return false;\n }\n}\n\nexport function isJSFunction(configTree: ConfigTree, fullPath: string) {\n const { entityName, propertyPath } = getEntityNameAndPropertyPath(fullPath);\n const entityConfig = configTree[entityName];\n\n return (\n isJSActionConfig(entityConfig) &&\n propertyPath &&\n propertyPath in entityConfig.meta\n );\n}\nexport function convertArrayToObject(arr: string[]) {\n return arr.reduce(\n (acc, item) => {\n return { ...acc, [item]: true } as const;\n },\n {} as Record,\n );\n}\n","/* eslint-disable no-console */\nimport type {\n ConfigTree,\n DataTree,\n DataTreeEntity,\n} from \"entities/DataTree/dataTreeTypes\";\nimport type { EvaluationError } from \"utils/DynamicBindingUtils\";\nimport { PropertyEvaluationErrorType } from \"utils/DynamicBindingUtils\";\nimport unescapeJS from \"unescape-js\";\nimport { Severity } from \"entities/AppsmithConsole\";\nimport type { EventType } from \"constants/AppsmithActionConstants/ActionConstants\";\nimport type { TriggerMeta } from \"ee/sagas/ActionExecution/ActionExecutionSagas\";\nimport indirectEval from \"./indirectEval\";\nimport DOM_APIS from \"./domApis\";\nimport {\n JSLibraryAccessor,\n libraryReservedIdentifiers,\n} from \"../common/JSLibrary\";\nimport {\n ActionInDataFieldErrorModifier,\n errorModifier,\n FoundPromiseInSyncEvalError,\n PrimitiveErrorModifier,\n TypeErrorModifier,\n} from \"./errorModifier\";\nimport { getDataTreeContext } from \"ee/workers/Evaluation/Actions\";\nimport { set } from \"lodash\";\nimport { klona } from \"klona\";\nimport { getEntityNameAndPropertyPath } from \"ee/workers/Evaluation/evaluationUtils\";\n\nexport interface EvalResult {\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: any;\n errors: EvaluationError[];\n}\n\nexport enum EvaluationScriptType {\n EXPRESSION = \"EXPRESSION\",\n ANONYMOUS_FUNCTION = \"ANONYMOUS_FUNCTION\",\n ASYNC_ANONYMOUS_FUNCTION = \"ASYNC_ANONYMOUS_FUNCTION\",\n TRIGGERS = \"TRIGGERS\",\n OBJECT_PROPERTY = \"OBJECT_PROPERTY\",\n}\n\nexport const ScriptTemplate = \"<>\";\n\nexport const EvaluationScripts: Record = {\n [EvaluationScriptType.EXPRESSION]: `\n function $$closedFn () {\n const $$result = ${ScriptTemplate}\n return $$result\n }\n $$closedFn.call(THIS_CONTEXT)\n `,\n [EvaluationScriptType.ANONYMOUS_FUNCTION]: `\n function $$closedFn (script) {\n const $$userFunction = script;\n const $$result = $$userFunction?.apply(THIS_CONTEXT, ARGUMENTS);\n return $$result\n }\n $$closedFn(${ScriptTemplate})\n `,\n [EvaluationScriptType.ASYNC_ANONYMOUS_FUNCTION]: `\n async function $$closedFn (script) {\n const $$userFunction = script;\n const $$result = $$userFunction?.apply(THIS_CONTEXT, ARGUMENTS);\n return await $$result;\n }\n $$closedFn(${ScriptTemplate})\n `,\n [EvaluationScriptType.TRIGGERS]: `\n async function $$closedFn () {\n const $$result = ${ScriptTemplate};\n return await $$result\n }\n $$closedFn.call(THIS_CONTEXT)\n `,\n [EvaluationScriptType.OBJECT_PROPERTY]: `\n function $$closedFn () {\n const $$result = {${ScriptTemplate}}\n return $$result\n }\n $$closedFn.call(THIS_CONTEXT)\n `,\n};\n\nconst topLevelWorkerAPIs = Object.keys(self).reduce(\n (acc, key: string) => {\n acc[key] = true;\n\n return acc;\n },\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {} as any,\n);\n\nconst ignoreGlobalObjectKeys = new Set([\n \"evaluationVersion\",\n \"window\",\n \"document\",\n \"location\",\n]);\n\nexport function resetWorkerGlobalScope() {\n const jsLibraryAccessorSet = JSLibraryAccessor.getSet();\n\n for (const key of Object.keys(self)) {\n if (topLevelWorkerAPIs[key] || DOM_APIS[key]) continue;\n\n //TODO: Remove this once we have a better way to handle this\n if (ignoreGlobalObjectKeys.has(key)) continue;\n\n if (jsLibraryAccessorSet.has(key)) continue;\n\n if (libraryReservedIdentifiers[key]) continue;\n\n try {\n // @ts-expect-error: Types are not available\n delete self[key];\n } catch (e) {\n // @ts-expect-error: Types are not available\n self[key] = undefined;\n }\n }\n}\n\nexport const getScriptType = (\n evalArgumentsExist = false,\n isTriggerBased = false,\n): EvaluationScriptType => {\n let scriptType = EvaluationScriptType.EXPRESSION;\n\n if (evalArgumentsExist && isTriggerBased) {\n scriptType = EvaluationScriptType.ASYNC_ANONYMOUS_FUNCTION;\n } else if (evalArgumentsExist && !isTriggerBased) {\n scriptType = EvaluationScriptType.ANONYMOUS_FUNCTION;\n } else if (isTriggerBased && !evalArgumentsExist) {\n scriptType = EvaluationScriptType.TRIGGERS;\n }\n\n return scriptType;\n};\n\nexport const additionalLibrariesNames: string[] = [];\n\nexport const getScriptToEval = (\n userScript: string,\n type: EvaluationScriptType,\n): string => {\n // Using replace here would break scripts with replacement patterns (ex: $&, $$)\n const buffer = EvaluationScripts[type].split(ScriptTemplate);\n\n return `${buffer[0]}${userScript}${buffer[1]}`;\n};\n\nconst beginsWithLineBreakRegex = /^\\s+|\\s+$/;\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type EvalContext = Record;\n\nexport interface createEvaluationContextArgs {\n dataTree: DataTree;\n configTree?: ConfigTree;\n context?: EvaluateContext;\n isTriggerBased: boolean;\n evalArguments?: Array;\n /*\n Whether to remove functions like \"run\", \"clear\" from entities in global context\n use case => To show lint warning when Api.run is used in a function bound to a data field (Eg. Button.text)\n */\n removeEntityFunctions?: boolean;\n}\n\n/**\n * overrideContext is a set of key-value pairs where they key is a path\n * and the value is any value.\n *\n * The purpose of overrideContext is to update the EVAL_CONTEXT's entity properties\n * with new value during runtime.\n * An example of runtime would be execution of a query where some parameters are passed\n * to the .run function.\n * This enables to override the entities and their values in EVAL_CONTEXT without any side-effects\n * to the actual dataTree since this is a non-persistent transient state of evaluation.\n *\n * Example:\n * overrideContext = {\n * \"Input1.text\": \"hello\"\n * }\n * // before overriding\n * EVAL_CONTEXT = {\n * \"Input1\": {\n * \"text\": \"Hey!\"\n * }\n * \"Text1\": {\n * \"text\": \"YOLO\"\n * }\n * }\n *\n * // after overriding just for the particular evaluation\n * EVAL_CONTEXT = {\n * \"Input1\": {\n * \"text\": \"Hello\"\n * },\n * \"Text1\": {\n * \"text\": \"YOLO\"\n * }\n *\n * Where is this overriding actually used?\n * At the time of writing this, the use case originated to evaluate run-time params of a\n * query module instance as pass them off as inputs.\n * Eg. QueryModule1.run({ input1: \"10\" }) and the bindings for this could be QueryModule1.inputs.input1\n * So the executionParams needs to be put in the EVAL_CONTEXT with the above path and the supplied value.\n * Therefore an overriding of the EVAL_CONTEXT is required during runtime execution.\n *\n * Why klona is used to cloned here?\n * Since EVAL_CONTEXT is build from the dataTree by adding the entities directly referentially\n * Eg. EVAL_CONTEXT[\"Input1\"] = dataTree[\"Input1\"]\n * Overriding the EVAL_CONTEXT directly using set(EVAL_CONTEXT, path, value); would mutate the dataTree\n * thus polluting the dataTree for the next evaluation.\n * To avoid this, all the unique entities of present in the overrideContext is identified and cloned once for\n * the particular entities only. This avoid unnecessary cloning of every entity and further multiple times.\n *\n */\nconst overrideEvalContext = (\n EVAL_CONTEXT: EvalContext,\n overrideContext?: Record,\n) => {\n if (overrideContext) {\n const entitiesClonedSoFar = new Set();\n\n Object.keys(overrideContext).forEach((path) => {\n const { entityName } = getEntityNameAndPropertyPath(path);\n\n if (entityName in EVAL_CONTEXT && !entitiesClonedSoFar.has(entityName)) {\n entitiesClonedSoFar.add(entityName);\n EVAL_CONTEXT[entityName] = klona(EVAL_CONTEXT[entityName]);\n }\n });\n\n Object.entries(overrideContext).forEach(([path, value]) => {\n set(EVAL_CONTEXT, path, value);\n });\n }\n};\n\n/**\n * This method created an object with dataTree and appsmith's framework actions that needs to be added to worker global scope for the JS code evaluation to then consume it.\n *\n * Example:\n * - For `eval(\"Table1.tableData\")` code to work as expected, we define Table1.tableData in worker global scope and for that we use `createEvaluationContext` to get the object to set in global scope.\n */\nexport const createEvaluationContext = (args: createEvaluationContextArgs) => {\n const {\n configTree = {},\n context,\n dataTree,\n evalArguments,\n isTriggerBased,\n removeEntityFunctions,\n } = args;\n\n const EVAL_CONTEXT: EvalContext = {};\n\n ///// Adding callback data\n EVAL_CONTEXT.ARGUMENTS = evalArguments;\n //// Adding contextual data not part of data tree\n EVAL_CONTEXT.THIS_CONTEXT = context?.thisContext || {};\n\n if (context?.globalContext) {\n Object.assign(EVAL_CONTEXT, context.globalContext);\n }\n\n const dataTreeContext = getDataTreeContext({\n dataTree,\n configTree,\n removeEntityFunctions: !!removeEntityFunctions,\n isTriggerBased,\n });\n\n Object.assign(EVAL_CONTEXT, dataTreeContext);\n\n overrideEvalContext(EVAL_CONTEXT, context?.overrideContext);\n\n return EVAL_CONTEXT;\n};\n\nexport function sanitizeScript(js: string) {\n // We remove any line breaks from the beginning of the script because that\n // makes the final function invalid. We also unescape any escaped characters\n // so that eval can happen\n const trimmedJS = js.replace(beginsWithLineBreakRegex, \"\");\n\n return self.evaluationVersion > 1 ? trimmedJS : unescapeJS(trimmedJS);\n}\n\n/** Define a context just for this script\n * thisContext will define it on the `this`\n * globalContext will define it globally\n * requestId is used for completing promises\n */\nexport interface EvaluateContext {\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisContext?: Record;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n globalContext?: Record;\n requestId?: string;\n eventType?: EventType;\n triggerMeta?: TriggerMeta;\n overrideContext?: Record;\n}\n\nexport const getUserScriptToEvaluate = (\n userScript: string,\n isTriggerBased: boolean,\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n evalArguments?: Array,\n) => {\n const unescapedJS = sanitizeScript(userScript);\n\n // If nothing is present to evaluate, return\n if (!unescapedJS.length) {\n return {\n script: \"\",\n };\n }\n\n const scriptType = getScriptType(!!evalArguments, isTriggerBased);\n const script = getScriptToEval(unescapedJS, scriptType);\n\n return { script };\n};\n\nexport function setEvalContext({\n configTree,\n context,\n dataTree,\n evalArguments,\n isDataField,\n isTriggerBased,\n}: {\n context?: EvaluateContext;\n dataTree: DataTree;\n configTree?: ConfigTree;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n evalArguments?: Array;\n isDataField: boolean;\n isTriggerBased: boolean;\n}) {\n self[\"$isDataField\"] = isDataField;\n\n const evalContext = createEvaluationContext({\n dataTree,\n configTree,\n context,\n evalArguments,\n isTriggerBased,\n });\n\n Object.assign(self, evalContext);\n}\n\nexport function evaluateSync(\n userScript: string,\n dataTree: DataTree,\n isJSCollection: boolean,\n context?: EvaluateContext,\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n evalArguments?: Array,\n configTree: ConfigTree = {},\n evalContextCache?: EvalContext,\n): EvalResult {\n return (function () {\n const errors: EvaluationError[] = [];\n let result;\n\n const { script } = getUserScriptToEvaluate(\n userScript,\n false,\n evalArguments,\n );\n\n // If nothing is present to evaluate, return instead of evaluating\n if (!script.length) {\n return {\n errors: [],\n result: undefined,\n triggers: [],\n };\n }\n\n self[\"$isDataField\"] = true;\n const EVAL_CONTEXT: EvalContext = {};\n\n ///// Adding callback data\n EVAL_CONTEXT.ARGUMENTS = evalArguments;\n //// Adding contextual data not part of data tree\n EVAL_CONTEXT.THIS_CONTEXT = context?.thisContext || {};\n\n if (context?.globalContext) {\n Object.assign(EVAL_CONTEXT, context.globalContext);\n }\n\n if (evalContextCache) {\n Object.assign(EVAL_CONTEXT, evalContextCache);\n } else {\n const dataTreeContext = getDataTreeContext({\n dataTree,\n configTree,\n removeEntityFunctions: false,\n isTriggerBased: isJSCollection,\n });\n\n Object.assign(EVAL_CONTEXT, dataTreeContext);\n }\n\n overrideEvalContext(EVAL_CONTEXT, context?.overrideContext);\n\n Object.assign(self, EVAL_CONTEXT);\n\n try {\n result = indirectEval(script);\n\n if (result instanceof Promise) {\n /**\n * If a promise is returned in data field then show the error to help understand data field doesn't await to resolve promise.\n * NOTE: Awaiting for promise will make data field evaluation slower.\n */\n throw new FoundPromiseInSyncEvalError();\n }\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const { errorCategory, errorMessage, rootcause } = errorModifier.run(\n error,\n { userScript: error.userScript || userScript, source: error.source },\n [ActionInDataFieldErrorModifier, TypeErrorModifier],\n );\n\n errors.push({\n errorMessage,\n severity: Severity.ERROR,\n raw: script,\n errorType: PropertyEvaluationErrorType.PARSE,\n originalBinding: userScript,\n kind: {\n category: errorCategory,\n rootcause,\n },\n });\n } finally {\n self[\"$isDataField\"] = false;\n }\n\n return { result, errors };\n })();\n}\n\nexport async function evaluateAsync(\n userScript: string,\n dataTree: DataTree,\n configTree: ConfigTree,\n context?: EvaluateContext,\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n evalArguments?: Array,\n) {\n return (async function () {\n resetWorkerGlobalScope();\n const errors: EvaluationError[] = [];\n let result;\n\n const { script } = getUserScriptToEvaluate(userScript, true, evalArguments);\n\n setEvalContext({\n dataTree,\n configTree,\n isDataField: false,\n isTriggerBased: true,\n context,\n evalArguments,\n });\n\n try {\n result = await indirectEval(script);\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const { errorMessage } = errorModifier.run(\n error,\n { userScript: error.userScript || userScript, source: error.source },\n [PrimitiveErrorModifier, TypeErrorModifier],\n );\n\n errors.push({\n errorMessage: errorMessage,\n severity: Severity.ERROR,\n raw: script,\n errorType: PropertyEvaluationErrorType.PARSE,\n originalBinding: userScript,\n });\n } finally {\n return {\n result,\n errors,\n };\n }\n })();\n}\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function shouldAddSetter(setter: any, entity: DataTreeEntity) {\n const isDisabledExpression = setter.disabled;\n\n if (!isDisabledExpression) return true;\n\n const isDisabledFn = new Function(\"options\", isDisabledExpression);\n\n return !isDisabledFn({ entity });\n}\n","import _ from \"lodash\";\n\nexport enum Types {\n URL = \"URL\",\n STRING = \"STRING\",\n NUMBER = \"NUMBER\",\n BOOLEAN = \"BOOLEAN\",\n OBJECT = \"OBJECT\",\n ARRAY = \"ARRAY\",\n FUNCTION = \"FUNCTION\",\n UNDEFINED = \"UNDEFINED\",\n NULL = \"NULL\",\n UNKNOWN = \"UNKNOWN\",\n}\n\nexport const getType = (value: unknown) => {\n if (_.isString(value)) return Types.STRING;\n\n if (_.isNumber(value)) return Types.NUMBER;\n\n if (_.isBoolean(value)) return Types.BOOLEAN;\n\n if (Array.isArray(value)) return Types.ARRAY;\n\n if (_.isFunction(value)) return Types.FUNCTION;\n\n if (_.isObject(value)) return Types.OBJECT;\n\n if (_.isUndefined(value)) return Types.UNDEFINED;\n\n if (_.isNull(value)) return Types.NULL;\n\n return Types.UNKNOWN;\n};\n\nexport function isURL(str: string) {\n const pattern = new RegExp(\n \"^((blob:)?https?:\\\\/\\\\/)?\" + //protocol\n \"((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|\" + // domain name\n \"((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))\" + // OR ip (v4) address\n \"(\\\\:\\\\d+)?(/[^?#]*)?\" + // port and path\n \"(\\\\?[;&a-z\\\\d%_.~+=-]*)?\" + // query string\n \"(\\\\#[-a-z\\\\d_]*)?$\",\n \"i\",\n ); // fragment locator\n\n return !!pattern.test(str);\n}\n\nexport type TruthyPrimitiveTypes = number | string | boolean | bigint | symbol;\n","import type { Node, SourceLocation, Options, Comment } from \"acorn\";\nimport { parse } from \"acorn\";\nimport { ancestor, simple } from \"acorn-walk\";\nimport { ECMA_VERSION, NodeTypes } from \"./constants\";\nimport { has, isFinite, isNil, isString, toPath } from \"lodash\";\nimport { getStringValue, isTrueObject, sanitizeScript } from \"./utils\";\nimport { jsObjectDeclaration } from \"./jsObject\";\nimport { attachComments } from \"astravel\";\nimport { generate } from \"astring\";\n/*\n * Valuable links:\n *\n * * ESTree spec: Javascript AST is called ESTree.\n * Each es version has its md file in the repo to find features\n * implemented and their node type\n * https://github.com/estree/estree\n *\n * * Acorn: The parser we use to get the AST\n * https://github.com/acornjs/acorn\n *\n * * Acorn walk: The walker we use to traverse the AST\n * https://github.com/acornjs/acorn/tree/master/acorn-walk\n *\n * * AST Explorer: Helpful web tool to see ASTs and its parts\n * https://astexplorer.net/\n *\n */\n\ntype Pattern =\n | IdentifierNode\n | AssignmentPatternNode\n | ArrayPatternNode\n | ObjectPatternNode\n | RestElementNode;\ntype Expression = Node;\nexport type ArgumentTypes =\n | LiteralNode\n | ArrowFunctionExpressionNode\n | ObjectExpression\n | MemberExpressionNode\n | CallExpressionNode\n | BinaryExpressionNode\n | BlockStatementNode\n | IdentifierNode;\n// doc: https://github.com/estree/estree/blob/master/es5.md#memberexpression\nexport interface MemberExpressionNode extends Node {\n type: NodeTypes.MemberExpression;\n object: MemberExpressionNode | IdentifierNode | CallExpressionNode;\n property: IdentifierNode | LiteralNode;\n computed: boolean;\n // doc: https://github.com/estree/estree/blob/master/es2020.md#chainexpression\n optional?: boolean;\n}\n\nexport interface BinaryExpressionNode extends Node {\n type: NodeTypes.BinaryExpression;\n left: BinaryExpressionNode | IdentifierNode;\n right: BinaryExpressionNode | IdentifierNode;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#identifier\nexport interface IdentifierNode extends Node {\n type: NodeTypes.Identifier;\n name: string;\n}\n\nexport interface ArrayPatternNode extends Node {\n type: NodeTypes.ArrayPattern;\n elements: Array;\n}\n\nexport interface AssignmentProperty extends Node {\n type: NodeTypes.Property;\n key: Expression;\n value: Pattern;\n kind: \"init\";\n method: false;\n shorthand: boolean;\n computed: boolean;\n}\n\nexport interface RestElementNode extends Node {\n type: NodeTypes.RestElement;\n argument: Pattern;\n}\n\nexport interface ObjectPatternNode extends Node {\n type: NodeTypes.ObjectPattern;\n properties: Array;\n}\n\n//Using this to handle the Variable property refactor\ninterface RefactorIdentifierNode extends Node {\n type: NodeTypes.Identifier;\n name: string;\n property?: IdentifierNode;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#variabledeclarator\ninterface VariableDeclaratorNode extends Node {\n type: NodeTypes.VariableDeclarator;\n id: IdentifierNode;\n init: Expression | null;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#functions\ninterface Function extends Node {\n id: IdentifierNode | null;\n params: Pattern[];\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#functiondeclaration\ninterface FunctionDeclarationNode extends Node, Function {\n type: NodeTypes.FunctionDeclaration;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#functionexpression\ninterface FunctionExpressionNode extends Expression, Function {\n type: NodeTypes.FunctionExpression;\n async: boolean;\n}\n\nexport interface ArrowFunctionExpressionNode extends Expression, Function {\n type: NodeTypes.ArrowFunctionExpression;\n async: boolean;\n}\n\nexport interface ObjectExpression extends Expression {\n type: NodeTypes.ObjectExpression;\n properties: Array;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es2015.md#assignmentpattern\ninterface AssignmentPatternNode extends Node {\n type: NodeTypes.AssignmentPattern;\n left: Pattern;\n right: ArgumentTypes;\n}\n\n// doc: https://github.com/estree/estree/blob/master/es5.md#literal\nexport interface LiteralNode extends Node {\n type: NodeTypes.Literal;\n value: string | boolean | null | number | RegExp;\n raw: string;\n}\n\nexport interface CallExpressionNode extends Node {\n type: NodeTypes.CallExpression;\n callee: CallExpressionNode | IdentifierNode | MemberExpressionNode;\n arguments: ArgumentTypes[];\n}\n\n// https://github.com/estree/estree/blob/master/es5.md#thisexpression\nexport interface ThisExpressionNode extends Expression {\n type: \"ThisExpression\";\n}\n\n// https://github.com/estree/estree/blob/master/es5.md#conditionalexpression\nexport interface ConditionalExpressionNode extends Expression {\n type: \"ConditionalExpression\";\n test: Expression;\n alternate: Expression;\n consequent: Expression;\n}\n\n// https://github.com/estree/estree/blob/master/es2017.md#awaitexpression\nexport interface AwaitExpressionNode extends Expression {\n type: \"AwaitExpression\";\n argument: Expression;\n}\n\nexport interface BlockStatementNode extends Node {\n type: \"BlockStatement\";\n body: [Node];\n}\n\ninterface NodeList {\n references: Set;\n functionalParams: Set;\n variableDeclarations: Set;\n identifierList: Array;\n}\n\n// https://github.com/estree/estree/blob/master/es5.md#property\nexport interface PropertyNode extends Node {\n type: NodeTypes.Property;\n key: LiteralNode | IdentifierNode;\n value: Node;\n kind: \"init\" | \"get\" | \"set\";\n}\n\nexport interface ExpressionStatement extends Node {\n type: \"ExpressionStatement\";\n expression: Expression;\n}\n\nexport interface Program extends Node {\n type: \"Program\";\n body: [Directive | Statement];\n}\n\nexport type Statement = Node;\n\nexport interface Directive extends ExpressionStatement {\n expression: LiteralNode;\n directive: string;\n}\n\nexport interface ExportDefaultDeclarationNode extends Node {\n declaration: Node;\n}\n\n// Node with location details\nexport type NodeWithLocation = NodeType & {\n loc: SourceLocation;\n};\n\ntype AstOptions = Omit;\n\ninterface EntityRefactorResponse {\n isSuccess: boolean;\n body: { script: string; refactorCount: number } | { error: string };\n}\n\n/* We need these functions to typescript casts the nodes with the correct types */\nexport const isIdentifierNode = (node: Node): node is IdentifierNode => {\n return node.type === NodeTypes.Identifier;\n};\n\nexport const isMemberExpressionNode = (\n node: Node,\n): node is MemberExpressionNode => {\n return node.type === NodeTypes.MemberExpression;\n};\n\nexport const isThisExpressionNode = (\n node: Node,\n): node is ThisExpressionNode => {\n return node.type === NodeTypes.ThisExpression;\n};\n\nexport const isConditionalExpressionNode = (\n node: Node,\n): node is ConditionalExpressionNode =>\n node.type === NodeTypes.ConditionalExpression;\n\nexport const isAwaitExpressionNode = (\n node: Node,\n): node is AwaitExpressionNode => node.type === NodeTypes.AwaitExpression;\n\nexport const isBinaryExpressionNode = (\n node: Node,\n): node is BinaryExpressionNode => {\n return node.type === NodeTypes.BinaryExpression;\n};\n\nexport const isVariableDeclarator = (\n node: Node,\n): node is VariableDeclaratorNode => {\n return node.type === NodeTypes.VariableDeclarator;\n};\n\nconst isFunctionDeclaration = (node: Node): node is FunctionDeclarationNode => {\n return node.type === NodeTypes.FunctionDeclaration;\n};\n\nconst isFunctionExpression = (node: Node): node is FunctionExpressionNode => {\n return node.type === NodeTypes.FunctionExpression;\n};\n\nexport const isArrowFunctionExpression = (\n node: Node,\n): node is ArrowFunctionExpressionNode => {\n return node.type === NodeTypes.ArrowFunctionExpression;\n};\n\nexport const isAssignmentExpression = (\n node: Node,\n): node is AssignmentExpressionNode => {\n return node.type === NodeTypes.AssignmentExpression;\n};\n\nexport const isObjectExpression = (node: Node): node is ObjectExpression => {\n return node.type === NodeTypes.ObjectExpression;\n};\n\nconst isAssignmentPatternNode = (node: Node): node is AssignmentPatternNode => {\n return node.type === NodeTypes.AssignmentPattern;\n};\n\nexport const isArrayPatternNode = (node: Node): node is ArrayPatternNode => {\n return node.type === NodeTypes.ArrayPattern;\n};\n\nexport const isObjectPatternNode = (node: Node): node is ObjectPatternNode => {\n return node.type === NodeTypes.ObjectPattern;\n};\n\nexport const isRestElementNode = (node: Node): node is RestElementNode => {\n return node.type === NodeTypes.RestElement;\n};\n\nexport const isLiteralNode = (node: Node): node is LiteralNode => {\n return node.type === NodeTypes.Literal;\n};\n\nexport const isPropertyNode = (node: Node): node is PropertyNode => {\n return node.type === NodeTypes.Property;\n};\n\nexport const isCallExpressionNode = (\n node: Node,\n): node is CallExpressionNode => {\n return node.type === NodeTypes.CallExpression;\n};\n\nexport const isBlockStatementNode = (\n node: Node,\n): node is BlockStatementNode => {\n return node.type === NodeTypes.BlockStatement;\n};\n\nexport const isExpressionStatementNode = (\n node: Node,\n): node is ExpressionStatement => {\n return node.type === NodeTypes.ExpressionStatement;\n};\n\nexport const isExportDefaultDeclarationNode = (\n node: Node,\n): node is ExportDefaultDeclarationNode => {\n return node.type === NodeTypes.ExportDefaultDeclaration;\n};\n\nexport const isPropertyAFunctionNode = (\n node: Node,\n): node is ArrowFunctionExpressionNode | FunctionExpressionNode => {\n return (\n node.type === NodeTypes.ArrowFunctionExpression ||\n node.type === NodeTypes.FunctionExpression\n );\n};\n\nconst isArrayAccessorNode = (node: Node): node is MemberExpressionNode => {\n return (\n isMemberExpressionNode(node) &&\n node.computed &&\n isLiteralNode(node.property) &&\n isFinite(node.property.value)\n );\n};\n\nexport const wrapCode = (code: string) => {\n return `\n (function() {\n return ${code}\n })\n `;\n};\n\n//Tech-debt: should upgrade this to better logic\n//Used slice for a quick resolve of critical bug\nconst unwrapCode = (code: string) => {\n const unwrapedCode = code.slice(32);\n\n return unwrapedCode.slice(0, -10);\n};\n\nconst getFunctionalParamNamesFromNode = (\n node:\n | FunctionDeclarationNode\n | FunctionExpressionNode\n | ArrowFunctionExpressionNode,\n) => {\n return Array.from(getFunctionalParamsFromNode(node)).map(\n (functionalParam) => functionalParam.paramName,\n );\n};\n\n// Memoize the ast generation code to improve performance.\n// Since this will be used by both the server and the client, we want to prevent regeneration of ast\n// for the the same code snippet\nexport const getAST = (code: string, options?: AstOptions) =>\n parse(code, { ...options, ecmaVersion: ECMA_VERSION });\n\nexport const attachCommentsToAst = (\n ast: Node,\n commentArray: Array,\n) => {\n return attachComments(ast, commentArray);\n};\n/**\n * An AST based extractor that fetches all possible references in a given\n * piece of code. We use this to get any references to the global entities in Appsmith\n * and create dependencies on them. If the reference was updated, the given piece of code\n * should run again.\n * @param code: The piece of script where references need to be extracted from\n */\n\nexport interface IdentifierInfo {\n references: string[];\n functionalParams: string[];\n variables: string[];\n isError: boolean;\n}\nexport const extractIdentifierInfoFromCode = (\n code: string,\n evaluationVersion: number,\n invalidIdentifiers?: Record,\n): IdentifierInfo => {\n let ast: Node = { end: 0, start: 0, type: \"\" };\n\n try {\n const sanitizedScript = sanitizeScript(code, evaluationVersion);\n /* wrapCode - Wrapping code in a function, since all code/script get wrapped with a function during evaluation.\n Some syntax won't be valid unless they're at the RHS of a statement.\n Since we're assigning all code/script to RHS during evaluation, we do the same here.\n So that during ast parse, those errors are neglected.\n */\n /* e.g. IIFE without braces\n function() { return 123; }() -> is invalid\n let result = function() { return 123; }() -> is valid\n */\n const wrappedCode = wrapCode(sanitizedScript);\n\n ast = getAST(wrappedCode);\n const { functionalParams, references, variableDeclarations }: NodeList =\n ancestorWalk(ast);\n const referencesArr = Array.from(references).filter((reference) => {\n // To remove references derived from declared variables and function params,\n // We extract the topLevelIdentifier Eg. Api1.name => Api1\n const topLevelIdentifier = toPath(reference)[0];\n\n return !(\n functionalParams.has(topLevelIdentifier) ||\n variableDeclarations.has(topLevelIdentifier) ||\n has(invalidIdentifiers, topLevelIdentifier)\n );\n });\n\n return {\n references: referencesArr,\n functionalParams: Array.from(functionalParams),\n variables: Array.from(variableDeclarations),\n isError: false,\n };\n } catch (e) {\n if (e instanceof SyntaxError) {\n // Syntax error. Ignore and return empty list\n return {\n references: [],\n functionalParams: [],\n variables: [],\n isError: true,\n };\n }\n\n throw e;\n }\n};\n\nexport const entityRefactorFromCode = (\n script: string,\n oldName: string,\n newName: string,\n isJSObject: boolean,\n evaluationVersion: number,\n invalidIdentifiers?: Record,\n): EntityRefactorResponse => {\n //Sanitizing leads to removal of special charater.\n //Hence we are not sanatizing the script. Fix(#18492)\n //If script is a JSObject then replace export default to decalartion.\n if (isJSObject) script = jsObjectToCode(script);\n else script = wrapCode(script);\n\n let ast: Node = { end: 0, start: 0, type: \"\" };\n //Copy of script to refactor\n let refactorScript = script;\n //Difference in length of oldName and newName\n const nameLengthDiff: number = newName.length - oldName.length;\n //Offset index used for deciding location of oldName.\n let refactorOffset = 0;\n //Count of refactors on the script\n let refactorCount = 0;\n\n try {\n ast = getAST(script);\n const {\n functionalParams,\n identifierList,\n references,\n variableDeclarations,\n }: NodeList = ancestorWalk(ast);\n const identifierArray = Array.from(\n identifierList,\n ) as Array;\n //To handle if oldName has property (\"JSObject.myfunc\")\n const oldNameArr = oldName.split(\".\");\n const referencesArr = Array.from(references).filter((reference) => {\n // To remove references derived from declared variables and function params,\n // We extract the topLevelIdentifier Eg. Api1.name => Api1\n const topLevelIdentifier = toPath(reference)[0];\n\n return !(\n functionalParams.has(topLevelIdentifier) ||\n variableDeclarations.has(topLevelIdentifier) ||\n has(invalidIdentifiers, topLevelIdentifier)\n );\n });\n\n //Traverse through all identifiers in the script\n identifierArray.forEach((identifier) => {\n if (identifier.name === oldNameArr[0]) {\n let index = 0;\n\n while (index < referencesArr.length) {\n if (identifier.name === referencesArr[index].split(\".\")[0]) {\n //Replace the oldName by newName\n //Get start index from node and get subarray from index 0 till start\n //Append above with new name\n //Append substring from end index from the node till end of string\n //Offset variable is used to alter the position based on `refactorOffset`\n //In case of nested JS action get end postion fro the property.\n ///Default end index\n let endIndex = identifier.end;\n const propertyNode = identifier.property;\n //Flag variable : true if property should be updated\n //false if property should not be updated\n const propertyCondFlag =\n oldNameArr.length > 1 &&\n propertyNode &&\n oldNameArr[1] === propertyNode.name;\n\n //Condition to validate if Identifier || Property should be updated??\n if (oldNameArr.length === 1 || propertyCondFlag) {\n //Condition to extend end index in case of property match\n if (propertyCondFlag && propertyNode) {\n endIndex = propertyNode.end;\n }\n\n refactorScript =\n refactorScript.substring(0, identifier.start + refactorOffset) +\n newName +\n refactorScript.substring(endIndex + refactorOffset);\n refactorOffset += nameLengthDiff;\n ++refactorCount;\n //We are only looking for one match in refrence for the identifier name.\n break;\n }\n }\n\n index++;\n }\n }\n });\n\n //If script is a JSObject then revert decalartion to export default.\n if (isJSObject) refactorScript = jsCodeToObject(refactorScript);\n else refactorScript = unwrapCode(refactorScript);\n\n return {\n isSuccess: true,\n body: { script: refactorScript, refactorCount },\n };\n } catch (e) {\n if (e instanceof SyntaxError) {\n // Syntax error. Ignore and return empty list\n return { isSuccess: false, body: { error: \"Syntax Error\" } };\n }\n\n throw e;\n }\n};\n\nexport interface functionParam {\n paramName: string;\n defaultValue: unknown;\n}\n\nexport const getFunctionalParamsFromNode = (\n node:\n | FunctionDeclarationNode\n | FunctionExpressionNode\n | ArrowFunctionExpressionNode,\n needValue = false,\n code = \"\",\n): Set => {\n const functionalParams = new Set();\n\n node.params.forEach((paramNode) => {\n if (isIdentifierNode(paramNode)) {\n functionalParams.add({\n paramName: paramNode.name,\n defaultValue: undefined,\n });\n } else if (isAssignmentPatternNode(paramNode)) {\n if (isIdentifierNode(paramNode.left)) {\n const paramName = paramNode.left.name;\n\n if (!needValue || !code) {\n functionalParams.add({ paramName, defaultValue: undefined });\n } else {\n const defaultValueInString = code.slice(\n paramNode.right.start,\n paramNode.right.end,\n );\n const defaultValue =\n paramNode.right.type === \"Literal\" &&\n typeof paramNode.right.value === \"string\"\n ? paramNode.right.value\n : `{{${defaultValueInString}}}`;\n\n functionalParams.add({\n paramName,\n defaultValue,\n });\n }\n } else if (\n isObjectPatternNode(paramNode.left) ||\n isArrayPatternNode(paramNode.left)\n ) {\n functionalParams.add({\n paramName: \"\",\n defaultValue: undefined,\n });\n }\n // The below computations are very basic and can be evolved into nested\n // parsing logic to find param and it's default value.\n } else if (isObjectPatternNode(paramNode)) {\n functionalParams.add({\n paramName: \"\",\n defaultValue: `{{{}}}`,\n });\n } else if (isArrayPatternNode(paramNode)) {\n functionalParams.add({\n paramName: \"\",\n defaultValue: \"{{[]}}\",\n });\n } else if (isRestElementNode(paramNode)) {\n if (\"name\" in paramNode.argument) {\n functionalParams.add({\n paramName: paramNode.argument.name,\n defaultValue: undefined,\n });\n }\n }\n });\n\n return functionalParams;\n};\n\nconst constructFinalMemberExpIdentifier = (\n node: MemberExpressionNode,\n child = \"\",\n): string => {\n const propertyAccessor = getPropertyAccessor(node.property);\n\n if (isIdentifierNode(node.object)) {\n return `${node.object.name}${propertyAccessor}${child}`;\n } else {\n const propertyAccessor = getPropertyAccessor(node.property);\n const nestedChild = `${propertyAccessor}${child}`;\n\n return constructFinalMemberExpIdentifier(\n node.object as MemberExpressionNode,\n nestedChild,\n );\n }\n};\n\nconst getPropertyAccessor = (propertyNode: IdentifierNode | LiteralNode) => {\n if (isIdentifierNode(propertyNode)) {\n return `.${propertyNode.name}`;\n } else if (isLiteralNode(propertyNode) && isString(propertyNode.value)) {\n // is string literal search a['b']\n return `.${propertyNode.value}`;\n } else if (isLiteralNode(propertyNode) && isFinite(propertyNode.value)) {\n // is array index search - a[9]\n return `[${propertyNode.value}]`;\n }\n};\n\nexport const isTypeOfFunction = (type: string) => {\n return (\n type === NodeTypes.ArrowFunctionExpression ||\n type === NodeTypes.FunctionExpression\n );\n};\n\nexport interface MemberExpressionData {\n property: NodeWithLocation;\n object: NodeWithLocation;\n}\n\nexport interface AssignmentExpressionData {\n property: NodeWithLocation;\n object: NodeWithLocation;\n parentNode: NodeWithLocation;\n}\n\nexport interface CallExpressionData {\n property: NodeWithLocation;\n params: NodeWithLocation[];\n}\n\n// This interface is used for storing call expression nodes with callee as member node\n// example of such case is when a function is called on object like obj.func()\n// This is required to understand whether appsmith.store.test.func() is present in script\n// in order to display mutation error on such statements.\nexport interface MemberCallExpressionData {\n property: NodeWithLocation;\n object: NodeWithLocation;\n parentNode: NodeWithLocation;\n}\n\nexport interface AssignmentExpressionNode extends Node {\n operator: string;\n left: Expression;\n Right: Expression;\n}\n\n/** Function returns Invalid top-level member expressions from code\n * @param code\n * @param data\n * @param evaluationVersion\n * @returns information about all invalid property/method assessment in code\n * @example Given data {\n * JSObject1: {\n * name:\"JSObject\",\n * data:[]\n * },\n * Api1:{\n * name: \"Api1\",\n * data: []\n * }\n * },\n * For code {{Api1.name + JSObject.unknownProperty}}, function returns information about \"JSObject.unknownProperty\" node.\n */\nexport const extractExpressionsFromCode = (\n code: string,\n data: Record,\n evaluationVersion: number,\n): {\n invalidTopLevelMemberExpressionsArray: MemberExpressionData[];\n assignmentExpressionsData: AssignmentExpressionData[];\n callExpressionsData: CallExpressionData[];\n memberCallExpressionData: MemberCallExpressionData[];\n} => {\n const assignmentExpressionsData = new Set();\n const callExpressionsData = new Set();\n const memberCallExpressionData = new Set();\n const invalidTopLevelMemberExpressions = new Set();\n const variableDeclarations = new Set();\n let functionalParams = new Set();\n let ast: Node = { end: 0, start: 0, type: \"\" };\n\n try {\n const sanitizedScript = sanitizeScript(code, evaluationVersion);\n const wrappedCode = wrapCode(sanitizedScript);\n\n ast = getAST(wrappedCode, { locations: true });\n } catch (e) {\n if (e instanceof SyntaxError) {\n // Syntax error. Ignore and return empty list\n return {\n invalidTopLevelMemberExpressionsArray: [],\n assignmentExpressionsData: [],\n callExpressionsData: [],\n memberCallExpressionData: [],\n };\n }\n\n throw e;\n }\n simple(ast, {\n MemberExpression(node: Node) {\n const { computed, object, property } = node as MemberExpressionNode;\n\n // We are only interested in top-level MemberExpression nodes\n // Eg. for Api1.data.name, we are only interested in Api1.data\n if (!isIdentifierNode(object)) return;\n\n if (!(object.name in data) || !isTrueObject(data[object.name])) return;\n\n // For computed member expressions (assessed via [], eg. JSObject1[\"name\"] ),\n // We are only interested in strings\n if (\n isLiteralNode(property) &&\n isString(property.value) &&\n !(property.value in data[object.name])\n ) {\n invalidTopLevelMemberExpressions.add({\n object,\n property,\n } as MemberExpressionData);\n }\n\n // We ignore computed member expressions if property is an identifier (JSObject[name])\n // This is because we can't statically determine what the value of the identifier might be.\n if (\n isIdentifierNode(property) &&\n !computed &&\n !(property.name in data[object.name])\n ) {\n invalidTopLevelMemberExpressions.add({\n object,\n property,\n } as MemberExpressionData);\n }\n },\n VariableDeclarator(node: Node) {\n if (isVariableDeclarator(node)) {\n variableDeclarations.add(node.id.name);\n }\n },\n FunctionDeclaration(node: Node) {\n if (!isFunctionDeclaration(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n FunctionExpression(node: Node) {\n if (!isFunctionExpression(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n ArrowFunctionExpression(node: Node) {\n if (!isArrowFunctionExpression(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n AssignmentExpression(node: Node) {\n if (\n !isAssignmentExpression(node) ||\n node.operator !== \"=\" ||\n !isMemberExpressionNode(node.left)\n )\n return;\n\n const { object, property } = node.left;\n\n assignmentExpressionsData.add({\n object,\n property,\n parentNode: node,\n } as AssignmentExpressionData);\n },\n CallExpression(node: Node) {\n if (isCallExpressionNode(node)) {\n if (isIdentifierNode(node.callee)) {\n callExpressionsData.add({\n property: node.callee,\n params: node.arguments,\n } as CallExpressionData);\n }\n\n if (isMemberExpressionNode(node.callee)) {\n const { object, property } = node.callee;\n\n memberCallExpressionData.add({\n object,\n property,\n parentNode: node,\n } as MemberCallExpressionData);\n }\n }\n },\n });\n\n const invalidTopLevelMemberExpressionsArray = Array.from(\n invalidTopLevelMemberExpressions,\n ).filter((MemberExpression) => {\n return !(\n variableDeclarations.has(MemberExpression.object.name) ||\n functionalParams.has(MemberExpression.object.name)\n );\n });\n\n return {\n invalidTopLevelMemberExpressionsArray,\n assignmentExpressionsData: [...assignmentExpressionsData],\n callExpressionsData: [...callExpressionsData],\n memberCallExpressionData: [...memberCallExpressionData],\n };\n};\n\nconst ancestorWalk = (ast: Node): NodeList => {\n //List of all Identifier nodes with their property(if exists).\n const identifierList = new Array();\n // List of all references found\n const references = new Set();\n // List of variables declared within the script. All identifiers and member expressions derived from declared variables will be removed\n const variableDeclarations = new Set();\n // List of functional params declared within the script. All identifiers and member expressions derived from functional params will be removed\n let functionalParams = new Set();\n\n /*\n * We do an ancestor walk on the AST in order to extract all references. For example, for member expressions and identifiers, we need to know\n * what surrounds the identifier (its parent and ancestors), ancestor walk will give that information in the callback\n * doc: https://github.com/acornjs/acorn/tree/master/acorn-walk\n */\n ancestor(ast, {\n Identifier(node: Node, ancestors: Node[]) {\n /*\n * We are interested in identifiers. Due to the nature of AST, Identifier nodes can\n * also be nested inside MemberExpressions. For deeply nested object references, there\n * could be nesting of many MemberExpressions. To find the final reference, we will\n * try to find the top level MemberExpression that does not have a MemberExpression parent.\n * */\n let candidateTopLevelNode: IdentifierNode | MemberExpressionNode =\n node as IdentifierNode;\n let depth = ancestors.length - 2; // start \"depth\" with first parent\n\n while (depth > 0) {\n const parent = ancestors[depth];\n\n if (\n isMemberExpressionNode(parent) &&\n /* Member expressions that are \"computed\" (with [ ] search)\n and the ones that have optional chaining ( a.b?.c )\n will be considered top level node.\n We will stop looking for further parents */\n /* \"computed\" exception - isArrayAccessorNode\n Member expressions that are array accessors with static index - [9]\n will not be considered top level.\n We will continue looking further. */\n (!parent.computed || isArrayAccessorNode(parent)) &&\n !parent.optional\n ) {\n candidateTopLevelNode = parent;\n depth = depth - 1;\n } else {\n // Top level found\n break;\n }\n }\n\n //If parent is a Member expression then attach property to the Node.\n //else push Identifier Node.\n const parentNode = ancestors[ancestors.length - 2];\n\n if (isMemberExpressionNode(parentNode)) {\n identifierList.push({\n ...(node as IdentifierNode),\n property: parentNode.property as IdentifierNode,\n });\n } else identifierList.push(node as RefactorIdentifierNode);\n\n if (isIdentifierNode(candidateTopLevelNode)) {\n // If the node is an Identifier, just save that\n references.add(candidateTopLevelNode.name);\n } else {\n // For MemberExpression Nodes, we will construct a final reference string and then add\n // it to the references list\n const memberExpIdentifier = constructFinalMemberExpIdentifier(\n candidateTopLevelNode,\n );\n\n references.add(memberExpIdentifier);\n }\n },\n VariableDeclarator(node: Node) {\n // keep a track of declared variables so they can be\n // removed from the final list of references\n if (isVariableDeclarator(node)) {\n variableDeclarations.add(node.id.name);\n }\n },\n FunctionDeclaration(node: Node) {\n // params in function declarations are also counted as references so we keep\n // track of them and remove them from the final list of references\n if (!isFunctionDeclaration(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n FunctionExpression(node: Node) {\n // params in function expressions are also counted as references so we keep\n // track of them and remove them from the final list of references\n if (!isFunctionExpression(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n ArrowFunctionExpression(node: Node) {\n // params in arrow function expressions are also counted as references so we keep\n // track of them and remove them from the final list of references\n if (!isArrowFunctionExpression(node)) return;\n\n functionalParams = new Set([\n ...functionalParams,\n ...getFunctionalParamNamesFromNode(node),\n ]);\n },\n });\n\n return {\n references,\n functionalParams,\n variableDeclarations,\n identifierList,\n };\n};\n\n//Replace export default by a variable declaration.\n//This is required for acorn to parse code into AST.\nconst jsObjectToCode = (script: string) => {\n return script.replace(/export default/g, jsObjectDeclaration);\n};\n\n//Revert the string replacement from 'jsObjectToCode'.\n//variable declaration is replaced back by export default.\nconst jsCodeToObject = (script: string) => {\n return script.replace(jsObjectDeclaration, \"export default\");\n};\n\nexport const isFunctionPresent = (\n script: string,\n evaluationVersion: number,\n) => {\n try {\n const sanitizedScript = sanitizeScript(script, evaluationVersion);\n const ast = getAST(sanitizedScript, {\n locations: true,\n ranges: true,\n });\n\n let isFunction = false;\n\n simple(ast, {\n FunctionDeclaration() {\n isFunction = true;\n },\n FunctionExpression() {\n isFunction = true;\n },\n ArrowFunctionExpression() {\n isFunction = true;\n },\n });\n\n return isFunction;\n } catch (e) {\n return false;\n }\n};\n\nexport function getMemberExpressionObjectFromProperty(\n propertyName: string,\n code: string,\n evaluationVersion = 2,\n) {\n if (!propertyName) return [];\n\n const memberExpressionObjects = new Set();\n let ast: Node = { end: 0, start: 0, type: \"\" };\n\n try {\n const sanitizedScript = sanitizeScript(code, evaluationVersion);\n const wrappedCode = wrapCode(sanitizedScript);\n\n ast = getAST(wrappedCode, { locations: true });\n simple(ast, {\n MemberExpression(node: Node) {\n const { object, property } = node as MemberExpressionNode;\n\n if (!isLiteralNode(property) && !isIdentifierNode(property)) return;\n\n const propName = isLiteralNode(property)\n ? property.value\n : property.name;\n\n if (!isNil(propName) && getStringValue(propName) === propertyName) {\n const memberExpressionObjectString = generate(object);\n\n memberExpressionObjects.add(memberExpressionObjectString);\n }\n },\n });\n\n return Array.from(memberExpressionObjects);\n } catch (e) {\n return [];\n }\n}\n","import { get, isEmpty, isUndefined, set } from \"lodash\";\nimport type { JSActionEntity } from \"ee/entities/DataTree/types\";\nimport type { ConfigTree, DataTree } from \"entities/DataTree/dataTreeTypes\";\nimport { EvalErrorTypes, getEvalValuePath } from \"utils/DynamicBindingUtils\";\nimport type { JSUpdate, ParsedJSSubAction } from \"utils/JSPaneUtils\";\nimport { parseJSObject, isJSFunctionProperty } from \"@shared/ast\";\nimport type DataTreeEvaluator from \"workers/common/DataTreeEvaluator\";\nimport { evaluateSync } from \"workers/Evaluation/evaluate\";\nimport type { DataTreeDiff } from \"ee/workers/Evaluation/evaluationUtils\";\nimport {\n DataTreeDiffEvent,\n getEntityNameAndPropertyPath,\n isJSAction,\n} from \"ee/workers/Evaluation/evaluationUtils\";\nimport {\n removeFunctionsAndVariableJSCollection,\n updateJSCollectionInUnEvalTree,\n} from \"workers/Evaluation/JSObject/utils\";\nimport { dataTreeEvaluator } from \"../handlers/evalTree\";\nimport JSObjectCollection from \"./Collection\";\nimport ExecutionMetaData from \"../fns/utils/ExecutionMetaData\";\nimport { jsPropertiesState } from \"./jsPropertiesState\";\nimport { getFixedTimeDifference } from \"workers/common/DataTreeEvaluator/utils\";\n\n/**\n * Here we update our unEvalTree according to the change in JSObject's body\n *\n * @param jsUpdates\n * @param localUnEvalTree\n * @returns\n */\nexport const getUpdatedLocalUnEvalTreeAfterJSUpdates = (\n jsUpdates: Record,\n localUnEvalTree: DataTree,\n configTree: ConfigTree,\n) => {\n if (!isEmpty(jsUpdates)) {\n Object.entries(jsUpdates).forEach(([entityName, jsEntity]) => {\n const entity = localUnEvalTree[entityName] as JSActionEntity;\n const parsedBody = jsEntity.parsedBody;\n\n if (isJSAction(entity)) {\n if (!!parsedBody) {\n //add/delete/update functions from dataTree\n localUnEvalTree = updateJSCollectionInUnEvalTree(\n parsedBody,\n entity,\n localUnEvalTree,\n configTree,\n entityName,\n );\n } else {\n //if parse error remove functions and variables from dataTree\n localUnEvalTree = removeFunctionsAndVariableJSCollection(\n localUnEvalTree,\n entity,\n entityName,\n configTree,\n );\n }\n }\n });\n }\n\n return localUnEvalTree;\n};\n\nexport const validJSBodyRegex = new RegExp(/^export default[\\s]*?({[\\s\\S]*?})/);\n\n/**\n * Here we parse the JSObject and then determine\n * 1. it's nature : async or sync\n * 2. Find arguments of JS Actions\n *\n * @param dataTreeEvalRef\n * @param entity\n * @param jsUpdates\n * @param unEvalDataTree\n * @param entityName\n * @returns\n */\nexport function saveResolvedFunctionsAndJSUpdates(\n dataTreeEvalRef: DataTreeEvaluator,\n entity: JSActionEntity,\n jsUpdates: Record,\n unEvalDataTree: DataTree,\n entityName: string,\n) {\n jsPropertiesState.delete(entityName);\n const correctFormat =\n entity.hasOwnProperty(\"body\") &&\n !isUndefined(entity.body) &&\n validJSBodyRegex.test(entity.body);\n const isEmptyBody =\n entity.hasOwnProperty(\"body\") &&\n !isUndefined(entity.body) &&\n entity?.body.trim() === \"\";\n\n if (!isUndefined(entity.body) && (correctFormat || isEmptyBody)) {\n try {\n JSObjectCollection.deleteResolvedFunction(entityName);\n JSObjectCollection.deleteUnEvalState(entityName);\n JSObjectCollection.clearCachedVariablesForEvaluationContext(entityName);\n\n const parseStartTime = performance.now();\n const { parsedObject, success } = parseJSObject(entity.body);\n const parseEndTime = performance.now();\n const JSObjectASTParseTime = getFixedTimeDifference(\n parseEndTime,\n parseStartTime,\n );\n\n dataTreeEvalRef.logs.push({\n JSObjectName: entityName,\n JSObjectASTParseTime,\n });\n\n const actionsMap: Record = {};\n const variablesMap: Record = {};\n\n if (success) {\n if (!!parsedObject) {\n jsPropertiesState.update(entityName, parsedObject);\n parsedObject.forEach((parsedElement) => {\n if (isJSFunctionProperty(parsedElement)) {\n if (actionsMap[parsedElement.key]) return;\n\n try {\n ExecutionMetaData.setExecutionMetaData({\n enableJSVarUpdateTracking: false,\n enableJSFnPostProcessors: false,\n });\n const { result } = evaluateSync(\n parsedElement.value,\n unEvalDataTree,\n false,\n );\n\n ExecutionMetaData.setExecutionMetaData({\n enableJSVarUpdateTracking: true,\n enableJSFnPostProcessors: true,\n });\n\n if (!!result) {\n let params: Array<{ name: string; value: unknown }> = [];\n\n if (parsedElement.arguments) {\n params = parsedElement.arguments.map(\n ({ defaultValue, paramName }) => ({\n name: paramName,\n value: defaultValue,\n }),\n );\n }\n\n const functionString = parsedElement.value;\n\n JSObjectCollection.updateResolvedFunctions(\n `${entityName}.${parsedElement.key}`,\n result,\n );\n JSObjectCollection.updateUnEvalState(\n `${entityName}.${parsedElement.key}`,\n functionString,\n );\n actionsMap[parsedElement.key] = {\n name: parsedElement.key,\n body: functionString,\n arguments: params,\n };\n }\n } catch {\n // in case we need to handle error state\n }\n } else if (parsedElement.type !== \"literal\") {\n // when a jsobject property is of the type \"prop1\" or 'prop1', ast outputs the\n // key as \"\\\"prop1\\\"\" or \"\\'prop1\\'\". We need to remove the extra quotes.\n const isStringRepresentation =\n parsedElement.key.startsWith(\"'\") ||\n parsedElement.key.startsWith('\"');\n const parsedKey = isStringRepresentation\n ? parsedElement.key.slice(1, -1)\n : parsedElement.key;\n\n variablesMap[parsedKey] = {\n name: parsedKey,\n value: parsedElement.value,\n };\n JSObjectCollection.updateUnEvalState(\n `${entityName}.${parsedElement.key}`,\n parsedElement.value,\n );\n }\n });\n const parsedBody = {\n body: entity.body,\n actions: Object.values(actionsMap),\n variables: Object.values(variablesMap),\n };\n\n set(jsUpdates, `${entityName}`, {\n parsedBody,\n id: entity.actionId,\n });\n } else {\n set(jsUpdates, `${entityName}`, {\n parsedBody: undefined,\n id: entity.actionId,\n });\n }\n }\n } catch (e) {\n //if we need to push error as popup in case\n }\n } else {\n const parsedBody = {\n body: entity.body,\n actions: [],\n variables: [],\n };\n\n set(jsUpdates, `${entityName}`, {\n parsedBody: parsedBody,\n id: entity.actionId,\n });\n }\n\n if (!correctFormat && !isUndefined(entity.body)) {\n const errors = {\n type: EvalErrorTypes.PARSE_JS_ERROR,\n context: {\n entity: entity,\n propertyPath: entityName + \".body\",\n },\n message: \"Start object with export default\",\n };\n\n dataTreeEvalRef.errors.push(errors);\n }\n\n return jsUpdates;\n}\n\nexport function parseJSActions(\n dataTreeEvalRef: DataTreeEvaluator,\n unEvalDataTree: DataTree,\n oldUnEvalTree?: DataTree,\n differences?: DataTreeDiff[],\n) {\n const resolvedFunctions = JSObjectCollection.getResolvedFunctions();\n const unEvalState = JSObjectCollection.getUnEvalState();\n let jsUpdates: Record = {};\n\n if (!!differences && !!oldUnEvalTree) {\n differences.forEach((diff) => {\n const { entityName, propertyPath } = getEntityNameAndPropertyPath(\n diff.payload.propertyPath,\n );\n const entity = unEvalDataTree[entityName];\n\n if (!isJSAction(entity)) return false;\n\n if (diff.event === DataTreeDiffEvent.DELETE) {\n // when JSObject is deleted, we remove it from currentJSCollectionState & resolvedFunctions\n if (unEvalState && unEvalState[diff.payload.propertyPath]) {\n JSObjectCollection.deleteUnEvalState(diff.payload.propertyPath);\n }\n\n if (resolvedFunctions && resolvedFunctions[diff.payload.propertyPath]) {\n JSObjectCollection.deleteResolvedFunction(diff.payload.propertyPath);\n }\n }\n\n if (\n (diff.event === DataTreeDiffEvent.EDIT && propertyPath === \"body\") ||\n (diff.event === DataTreeDiffEvent.NEW && propertyPath === \"\")\n ) {\n jsUpdates = saveResolvedFunctionsAndJSUpdates(\n dataTreeEvalRef,\n entity,\n jsUpdates,\n unEvalDataTree,\n entityName,\n );\n }\n });\n } else {\n Object.keys(unEvalDataTree).forEach((entityName) => {\n const entity = unEvalDataTree[entityName];\n\n if (!isJSAction(entity)) {\n return;\n }\n\n jsUpdates = saveResolvedFunctionsAndJSUpdates(\n dataTreeEvalRef,\n entity,\n jsUpdates,\n unEvalDataTree,\n entityName,\n );\n });\n }\n\n Object.keys(jsUpdates).forEach((entityName) => {\n const parsedBody = jsUpdates[entityName].parsedBody;\n\n if (!parsedBody) return;\n\n parsedBody.actions = parsedBody.actions.map((action) => {\n return {\n ...action,\n } as ParsedJSSubAction;\n });\n });\n\n return { jsUpdates };\n}\n\nexport function getJSEntities(dataTree: DataTree) {\n const jsCollections: Record = {};\n\n Object.keys(dataTree).forEach((entityName: string) => {\n const entity = dataTree[entityName];\n\n if (isJSAction(entity)) {\n jsCollections[entityName] = entity;\n }\n });\n\n return jsCollections;\n}\n\nexport function updateEvalTreeWithJSCollectionState(evalTree: DataTree) {\n // loop through jsCollectionState and set all values to evalTree\n const jsCollections = JSObjectCollection.getVariableState();\n const jsCollectionEntries = Object.entries(jsCollections);\n\n for (const [jsObjectName, variableState] of jsCollectionEntries) {\n if (!evalTree[jsObjectName]) continue;\n\n evalTree[jsObjectName] = Object.assign(\n evalTree[jsObjectName],\n variableState,\n );\n }\n}\n\nexport function updateEvalTreeValueFromContext(paths: string[][]) {\n const currentEvalContext = self;\n\n if (!dataTreeEvaluator) return;\n\n const evalTree = dataTreeEvaluator.getEvalTree();\n\n for (const fullPathArray of paths) {\n const [jsObjectName, variableName] = fullPathArray;\n const entity = evalTree[jsObjectName];\n\n if (jsObjectName && variableName && isJSAction(entity)) {\n if (!(jsObjectName in currentEvalContext)) continue;\n\n const variableValue = get(currentEvalContext, [\n jsObjectName,\n variableName,\n ]);\n const value = variableValue;\n\n JSObjectCollection.setVariableValue(\n value,\n `${jsObjectName}.${variableName}`,\n );\n /*\n JSobject variable values are picked from evalProps until the unevalValue is not modified.\n Hence, we need to set the value in evalProps to ensure it doesn't have stale values.\n */\n set(\n dataTreeEvaluator.evalProps,\n getEvalValuePath(`${jsObjectName}.${variableName}`, {\n isPopulated: true,\n fullPath: true,\n }),\n value,\n );\n }\n }\n}\n","import {\n getEntityNameAndPropertyPath,\n isWidget,\n overrideWidgetProperties,\n} from \"ee/workers/Evaluation/evaluationUtils\";\nimport type { EvalMetaUpdates } from \"ee/workers/common/DataTreeEvaluator/types\";\nimport { evalTreeWithChanges } from \"./evalTreeWithChanges\";\nimport { dataTreeEvaluator } from \"./handlers/evalTree\";\nimport { get, set } from \"lodash\";\nimport { validate } from \"./validations\";\nimport type {\n DataTreeEntityConfig,\n WidgetEntity,\n} from \"ee/entities/DataTree/types\";\nimport type {\n ConfigTree,\n DataTree,\n DataTreeEntity,\n} from \"entities/DataTree/dataTreeTypes\";\nimport { getFnWithGuards, isAsyncGuard } from \"./fns/utils/fnGuard\";\nimport { shouldAddSetter } from \"./evaluate\";\nimport { EVAL_WORKER_SYNC_ACTION } from \"ee/workers/Evaluation/evalWorkerActions\";\n\nclass Setters {\n /** stores the setter method accessor as key and true as value\n *\n * example - ```{ \"Table1.setVisibility\": true, \"Table1.setData\": true }```\n */\n private setterMethodLookup: Record = {};\n /** stores the setter property accessor as key and setter method name as value\n *\n * example - ```{ \"Table1.tableData\": \"Table1.setData\" }```\n */\n private setterAccessorMap: Record = {};\n\n private async applySetterMethod(\n path: string,\n value: unknown,\n setterMethodName: string,\n ) {\n const { entityName, propertyPath } = getEntityNameAndPropertyPath(path);\n\n if (!dataTreeEvaluator) return;\n\n const evalTree = dataTreeEvaluator.getEvalTree();\n const configTree = dataTreeEvaluator.getConfigTree();\n\n const entity = evalTree[entityName];\n const entityConfig = configTree[entityName];\n\n const updatedProperties: string[][] = [];\n const overriddenProperties: string[] = [];\n const evalMetaUpdates: EvalMetaUpdates = [];\n\n let parsedValue = value;\n\n if (value === undefined) {\n const error = new Error(\n `The value passed to ${entityName}.${setterMethodName}() evaluates to undefined.`,\n );\n\n error.name = entityName + \".\" + setterMethodName + \" failed\";\n throw error;\n }\n\n const { validationPaths } = entityConfig;\n\n if (validationPaths) {\n const validationConfig = validationPaths[propertyPath] || {};\n\n const config = {\n ...validationConfig,\n params: { ...(validationConfig.params || {}) },\n };\n\n config.params.strict = true;\n\n const { isValid, messages, parsed } = validate(\n config,\n value,\n entity as Record,\n propertyPath,\n );\n\n parsedValue = parsed;\n\n if (!isValid) {\n const message = messages && messages[0] ? messages[0].message : \"\";\n const error = new Error(\n `${entityName + \".\" + setterMethodName}: ${message}`,\n );\n\n error.name = entityName + \".\" + setterMethodName + \" failed\";\n throw error;\n }\n }\n\n if (isWidget(entity)) {\n overrideWidgetProperties({\n entity: entity as WidgetEntity,\n propertyPath,\n value: parsedValue,\n currentTree: evalTree,\n configTree,\n evalMetaUpdates,\n fullPropertyPath: path,\n isNewWidget: false,\n shouldUpdateGlobalContext: true,\n overriddenProperties,\n });\n\n overriddenProperties.forEach((propPath) => {\n updatedProperties.push([entityName, propPath]);\n });\n }\n\n set(evalTree, path, parsedValue);\n set(self, path, parsedValue);\n\n /**\n * Making the update to dataTree async as there could be queue microtask updates that need to execute before this update.\n * Issue:- https://github.com/appsmithorg/appsmith/issues/25364\n */\n return new Promise((resolve) => {\n resolve(parsedValue);\n }).then((res) => {\n updatedProperties.push([entityName, propertyPath]);\n\n evalTreeWithChanges({\n data: {\n updatedValuePaths: updatedProperties,\n metaUpdates: evalMetaUpdates,\n },\n method: EVAL_WORKER_SYNC_ACTION.EVAL_TREE_WITH_CHANGES,\n webworkerTelemetry: {},\n });\n\n return res;\n });\n }\n /** Generates a new setter method */\n private createSetter(\n path: string,\n setterMethodName: string,\n entityName: string,\n ) {\n /** register the setter method in the lookup */\n set(this.setterMethodLookup, [entityName, setterMethodName], true);\n\n const fn = async (value: unknown) => {\n if (!dataTreeEvaluator) return;\n\n return this.applySetterMethod(path, value, setterMethodName);\n };\n\n return getFnWithGuards(fn, setterMethodName, [isAsyncGuard]);\n }\n\n clear() {\n this.setterMethodLookup = {};\n }\n\n has(entityName: string, propertyName: string) {\n return get(this.setterMethodLookup, [entityName, propertyName], false);\n }\n\n getMap() {\n return this.setterMethodLookup;\n }\n\n getSetterAccessorMap() {\n return this.setterAccessorMap;\n }\n\n getEntitySettersFromConfig(\n entityConfig: DataTreeEntityConfig,\n entityName: string,\n entity: DataTreeEntity,\n ) {\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const setterMethodMap: Record = {};\n\n if (!entityConfig) return setterMethodMap;\n\n if (entityConfig.__setters) {\n for (const setterMethodName of Object.keys(entityConfig.__setters)) {\n const pathToSet = entityConfig.__setters[setterMethodName].path;\n\n if (!shouldAddSetter(entityConfig.__setters[setterMethodName], entity))\n continue;\n\n this.setterAccessorMap[pathToSet] = `${entityName}.${setterMethodName}`;\n\n setterMethodMap[setterMethodName] = this.createSetter(\n pathToSet,\n setterMethodName,\n entityName,\n );\n }\n }\n\n return setterMethodMap;\n }\n\n init(configTree: ConfigTree, dataTree: DataTree) {\n const configTreeEntries = Object.entries(configTree);\n\n for (const [entityName, entityConfig] of configTreeEntries) {\n const entity = dataTree[entityName];\n\n this.getEntitySettersFromConfig(entityConfig, entityName, entity);\n }\n }\n}\n\nconst setters = new Setters();\n\nexport default setters;\n","import { parseExpressionAt, type Node } from \"acorn\";\nimport { simple } from \"acorn-walk\";\nimport type {\n IdentifierNode,\n LiteralNode,\n NodeWithLocation,\n PropertyNode,\n} from \"../index\";\nimport {\n getAST,\n isExportDefaultDeclarationNode,\n isObjectExpression,\n isTypeOfFunction,\n} from \"../index\";\nimport { generate } from \"astring\";\nimport type { functionParam } from \"../index\";\nimport { getFunctionalParamsFromNode, isPropertyAFunctionNode } from \"../index\";\nimport { ECMA_VERSION, SourceType } from \"../../index\";\nimport escodegen, { attachComments } from \"escodegen\";\nimport { extractContentByPosition } from \"../utils\";\n\nconst jsObjectVariableName =\n \"____INTERNAL_JS_OBJECT_NAME_USED_FOR_PARSING_____\";\n\nexport const jsObjectDeclaration = `var ${jsObjectVariableName} =`;\n\nexport interface JSPropertyPosition {\n startLine: number;\n startColumn: number;\n endLine: number;\n endColumn: number;\n keyStartLine: number;\n keyEndLine: number;\n keyStartColumn: number;\n keyEndColumn: number;\n}\n\ninterface BaseJSProperty {\n key: string;\n value: string;\n type: string;\n position: Partial;\n rawContent: string;\n}\n\nexport type JSFunctionProperty = BaseJSProperty & {\n arguments: functionParam[];\n // If function uses the \"async\" keyword\n isMarkedAsync: boolean;\n};\nexport type JSVarProperty = BaseJSProperty;\n\nexport type TParsedJSProperty = JSVarProperty | JSFunctionProperty;\n\ninterface Property extends PropertyNode {\n key: IdentifierNode;\n}\n\nexport const isJSFunctionProperty = (\n t: TParsedJSProperty,\n): t is JSFunctionProperty => {\n return isTypeOfFunction(t.type);\n};\n\nexport const parseJSObject = (code: string) => {\n let ast: Node = { end: 0, start: 0, type: \"\" };\n const result: TParsedJSProperty[] = [];\n\n try {\n const comments: any = [];\n const token: any = [];\n\n ast = getAST(code, {\n sourceType: SourceType.module,\n onComment: comments,\n onToken: token,\n ranges: true,\n locations: true,\n });\n attachComments(ast, comments, token);\n } catch (e) {\n return { parsedObject: result, success: false };\n }\n\n const parsedObjectProperties = new Set();\n let JSObjectProperties: NodeWithLocation[] = [];\n\n simple(ast, {\n ExportDefaultDeclaration(node: Node) {\n if (\n !isExportDefaultDeclarationNode(node) ||\n !isObjectExpression(node.declaration)\n )\n return;\n\n JSObjectProperties = node.declaration\n .properties as NodeWithLocation[];\n },\n });\n\n JSObjectProperties.forEach((node) => {\n const propertyKey = node.key as NodeWithLocation<\n LiteralNode | IdentifierNode\n >;\n let property: TParsedJSProperty = {\n key: generate(node.key),\n value: generate(node.value),\n rawContent: extractContentByPosition(code, {\n from: {\n line: node.loc.start.line - 1,\n ch: node.loc.start.column,\n },\n to: {\n line: node.loc.end.line - 1,\n ch: node.loc.end.column - 1,\n },\n }),\n type: node.value.type,\n position: {\n startLine: node.loc.start.line,\n startColumn: node.loc.start.column,\n endLine: node.loc.end.line,\n endColumn: node.loc.end.column,\n keyStartLine: propertyKey.loc.start.line,\n keyEndLine: propertyKey.loc.end.line,\n keyStartColumn: propertyKey.loc.start.column,\n keyEndColumn: propertyKey.loc.end.column,\n },\n };\n\n if (isPropertyAFunctionNode(node.value)) {\n const params = getFunctionalParamsFromNode(node.value, true, code);\n\n property = {\n ...property,\n arguments: [...params],\n isMarkedAsync: node.value.async,\n };\n }\n\n parsedObjectProperties.add(property);\n });\n\n return { parsedObject: [...parsedObjectProperties], success: true };\n};\n\nexport const addPropertiesToJSObjectCode = (\n code: string,\n obj: Record,\n) => {\n try {\n const ast = getAST(code, { sourceType: \"module\" });\n\n simple(ast, {\n ExportDefaultDeclaration(node: any) {\n const properties: Property[] = node?.declaration?.properties;\n\n Object.entries(obj).forEach(([key, value]) => {\n // Check if a property with the same name already exists\n const existingPropertyIndex = properties.findIndex(\n (property) => property.key.name === key,\n );\n\n const astValue = parseExpressionAt(value, 0, {\n ecmaVersion: ECMA_VERSION,\n });\n\n // Create a new property\n const newProperty = {\n type: \"Property\",\n key: { type: \"Identifier\", name: key },\n value: astValue,\n kind: \"init\",\n method: false,\n shorthand: false,\n computed: false,\n } as unknown as Property;\n\n if (existingPropertyIndex >= 0) {\n // Replace the existing property\n properties[existingPropertyIndex] = newProperty;\n } else {\n // Add the new property\n properties.push(newProperty);\n }\n });\n },\n });\n\n return escodegen.generate(ast);\n } catch (e) {\n return code;\n }\n};\n","import type { ActionResponse } from \"api/ActionAPI\";\nimport type { PluginType, PluginId } from \"entities/Plugin\";\nimport type { ValidationConfig } from \"constants/PropertyControlConstants\";\nimport type { ActionConfig } from \"entities/Action\";\nimport type { ActionDescription } from \"ee/workers/Evaluation/fns\";\nimport type { Variable } from \"entities/JSCollection\";\nimport type { DependencyMap, DynamicPath } from \"utils/DynamicBindingUtils\";\nimport type { Page } from \"entities/Page\";\nimport type { MetaWidgetsReduxState } from \"reducers/entityReducers/metaWidgetsReducer\";\nimport type { WidgetConfigProps } from \"WidgetProvider/constants\";\nimport type { ActionDataState } from \"ee/reducers/entityReducers/actionsReducer\";\nimport type { WidgetProps } from \"widgets/BaseWidget\";\nimport type { CanvasWidgetsReduxState } from \"ee/reducers/entityReducers/canvasWidgetsReducer\";\nimport type { MetaState } from \"reducers/entityReducers/metaReducer\";\nimport type { AppDataState } from \"reducers/entityReducers/appReducer\";\nimport type { JSCollectionDataState } from \"ee/reducers/entityReducers/jsActionsReducer\";\nimport type { AppTheme } from \"entities/AppTheming\";\nimport type { LoadingEntitiesState } from \"reducers/evaluationReducers/loadingEntitiesReducer\";\nimport type { LayoutSystemTypes } from \"layoutSystems/types\";\nimport type { Module } from \"ee/constants/ModuleConstants\";\nimport type { ModuleInstance } from \"ee/constants/ModuleInstanceConstants\";\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ActionDispatcher = (...args: any[]) => ActionDescription;\n\nexport const ENTITY_TYPE = {\n ACTION: \"ACTION\",\n WIDGET: \"WIDGET\",\n APPSMITH: \"APPSMITH\",\n JSACTION: \"JSACTION\",\n} as const;\nexport const JSACTION_TYPE = ENTITY_TYPE.JSACTION;\nexport const ACTION_TYPE = ENTITY_TYPE.ACTION;\n\ntype ValueOf = T[keyof T];\nexport type EntityTypeValue = ValueOf;\n\nexport enum EvaluationSubstitutionType {\n TEMPLATE = \"TEMPLATE\",\n PARAMETER = \"PARAMETER\",\n SMART_SUBSTITUTE = \"SMART_SUBSTITUTE\",\n}\n\n// Action entity types\nexport interface ActionEntity {\n actionId: string;\n isLoading: boolean;\n data: ActionResponse[\"body\"];\n run: ActionDispatcher | Record;\n clear: ActionDispatcher | Record;\n responseMeta: {\n statusCode?: string;\n isExecutionSuccess: boolean;\n headers?: unknown;\n };\n ENTITY_TYPE: typeof ENTITY_TYPE.ACTION;\n config: Partial;\n datasourceUrl: string;\n}\n\nexport interface ActionEntityConfig extends EntityConfig {\n dynamicBindingPathList: DynamicPath[];\n bindingPaths: Record;\n reactivePaths: Record;\n ENTITY_TYPE: typeof ENTITY_TYPE.ACTION;\n dependencyMap: DependencyMap;\n logBlackList: Record;\n pluginType: PluginType;\n pluginId: PluginId;\n actionId: string;\n name: string;\n moduleId?: string;\n moduleInstanceId?: string;\n isPublic?: boolean;\n}\n\n// JSAction (JSObject) entity Types\n\nexport interface MetaArgs {\n arguments: Variable[];\n confirmBeforeExecute: boolean;\n}\n\nexport interface JSActionEntityConfig extends EntityConfig {\n meta: Record;\n dynamicBindingPathList: DynamicPath[];\n bindingPaths: Record;\n reactivePaths: Record;\n variables?: Array;\n dependencyMap: DependencyMap;\n pluginType: PluginType.JS;\n name: string;\n ENTITY_TYPE: typeof ENTITY_TYPE.JSACTION;\n actionId: string;\n moduleId?: string;\n moduleInstanceId?: string;\n isPublic?: boolean;\n actionNames: Set;\n}\n\nexport interface JSActionEntity {\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [propName: string]: any;\n body?: string;\n ENTITY_TYPE: typeof ENTITY_TYPE.JSACTION;\n actionId: string;\n}\nexport type PagelistEntity = Page[];\n\n// Widget entity Types\n\n// Private widgets do not get evaluated\n// For example, for widget Button1 in a List widget List1, List1.template.Button1.text gets evaluated,\n// so there is no need to evaluate Button1.text\nexport type PrivateWidgets = Record;\n\n/**\n * Map of overriding property as key and overridden property as values\n */\nexport type OverridingPropertyPaths = Record;\n\nexport enum OverridingPropertyType {\n META = \"META\",\n DEFAULT = \"DEFAULT\",\n}\nexport interface overrideDependency {\n DEFAULT: string;\n META: string;\n}\n/**\n * Map of property name as key and value as object with defaultPropertyName and metaPropertyName which it depends on.\n */\nexport type PropertyOverrideDependency = Record<\n string,\n Partial\n>;\n\nexport interface WidgetConfig extends EntityConfig {\n bindingPaths: Record;\n reactivePaths: Record;\n triggerPaths: Record;\n validationPaths: Record;\n ENTITY_TYPE: typeof ENTITY_TYPE.WIDGET;\n logBlackList: Record;\n propertyOverrideDependency: PropertyOverrideDependency;\n overridingPropertyPaths: OverridingPropertyPaths;\n privateWidgets: PrivateWidgets;\n}\n\nexport interface EntityConfig {\n __setters?: Record;\n bindingPaths?: Record;\n reactivePaths?: Record;\n validationPaths?: Record;\n dynamicBindingPathList?: DynamicPath[];\n dependencyMap?: Record;\n}\n\n//data factory types\nexport type UnEvalTreeEntityObject =\n | ActionEntity\n | JSActionEntity\n | WidgetEntity;\n\nexport interface WidgetEntity extends WidgetProps {\n meta: Record;\n ENTITY_TYPE: typeof ENTITY_TYPE.WIDGET;\n}\nexport type DataTreeEntityObject =\n | ActionEntity\n | JSActionEntity\n | WidgetEntity\n | AppsmithEntity;\n\nexport interface WidgetEntityConfig\n extends Partial,\n Omit,\n WidgetConfig {\n widgetId: string;\n defaultMetaProps: Array;\n type: string;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n __setters?: Record;\n}\n\nexport interface AppsmithEntity extends Omit {\n ENTITY_TYPE: typeof ENTITY_TYPE.APPSMITH;\n store: Record;\n theme: AppTheme[\"properties\"];\n currentPageName: string;\n workspaceName: string;\n appName: string;\n currentEnvironmentName: string;\n}\n\nexport interface DataTreeSeed {\n actions: ActionDataState;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorConfigs: Record;\n pluginDependencyConfig: Record;\n widgets: CanvasWidgetsReduxState;\n widgetsMeta: MetaState;\n appData: AppDataState;\n jsActions: JSCollectionDataState;\n theme: AppTheme[\"properties\"];\n metaWidgets: MetaWidgetsReduxState;\n isMobile: boolean;\n moduleInputs: Module[\"inputsForm\"];\n moduleInstances: Record | null;\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n moduleInstanceEntities: any;\n layoutSystemType: LayoutSystemTypes;\n loadingEntities: LoadingEntitiesState;\n}\n\nexport type DataTreeEntityConfig =\n | WidgetEntityConfig\n | ActionEntityConfig\n | JSActionEntityConfig;\n","export * from \"ce/entities/DataTree/types\";\nimport { ENTITY_TYPE as CE_ENTITY_TYPE } from \"ce/entities/DataTree/types\";\n\nexport const ENTITY_TYPE = {\n ...CE_ENTITY_TYPE,\n MODULE_INPUT: \"MODULE_INPUT\",\n MODULE_INSTANCE: \"MODULE_INSTANCE\",\n} as const;\n\ntype ValueOf = T[keyof T];\nexport type EntityTypeValue = ValueOf;\n","import type {\n TNavigateToActionType,\n TNavigateToDescription,\n} from \"./navigateTo\";\nimport navigateTo from \"./navigateTo\";\nimport type { TShowAlertActionType, TShowAlertDescription } from \"./showAlert\";\nimport showAlert from \"./showAlert\";\nimport type {\n TCloseModalActionType,\n TCloseModalDescription,\n TShowModalActionType,\n TShowModalDescription,\n} from \"./modalFns\";\nimport { closeModal, showModal } from \"./modalFns\";\nimport type { TDownloadActionType, TDownloadDescription } from \"./download\";\nimport download from \"./download\";\nimport type {\n TPostWindowMessageActionType,\n TPostWindowMessageDescription,\n} from \"./postWindowMessage\";\nimport postWindowMessage from \"./postWindowMessage\";\nimport type {\n TCopyToClipboardActionType,\n TCopyToClipboardDescription,\n} from \"./copyToClipboard\";\nimport copyToClipboard from \"./copyToClipboard\";\nimport type {\n TResetWidgetActionType,\n TResetWidgetDescription,\n} from \"./resetWidget\";\nimport resetWidget from \"./resetWidget\";\nimport type {\n TClearStoreDescription,\n TRemoveValueDescription,\n TStoreValueDescription,\n} from \"./storeFns\";\nimport { clearStore, removeValue, storeValue } from \"./storeFns\";\nimport type {\n TClearActionType,\n TClearDescription,\n TRunActionType,\n TRunDescription,\n} from \"./actionFns\";\nimport run, { clear } from \"./actionFns\";\nimport { isAppsmithEntity } from \"ee/workers/Evaluation/evaluationUtils\";\nimport type { ActionEntity } from \"ee/entities/DataTree/types\";\nimport type { DataTreeEntity } from \"entities/DataTree/dataTreeTypes\";\nimport type {\n TGetGeoLocationActionType,\n TGetGeoLocationDescription,\n TStopWatchGeoLocationActionType,\n TStopWatchGeoLocationDescription,\n TWatchGeoLocationActionType,\n TWatchGeoLocationDescription,\n} from \"./geolocationFns\";\nimport {\n getGeoLocation,\n stopWatchGeoLocation,\n watchGeoLocation,\n} from \"./geolocationFns\";\nimport { getFnWithGuards, isAsyncGuard } from \"./utils/fnGuard\";\nimport { isRunNClearFnQualifierEntity } from \"ee/workers/Evaluation/fns/utils/isRunNClearFnQualifierEntity\";\n\nexport const getPlatformFunctions = () => {\n return platformFns;\n};\n\nexport const getEntityFunctions = () => {\n return entityFns;\n};\n\nconst platformFns = [\n {\n name: \"navigateTo\",\n fn: navigateTo,\n },\n {\n name: \"showAlert\",\n fn: showAlert,\n },\n {\n name: \"showModal\",\n fn: showModal,\n },\n {\n name: \"closeModal\",\n fn: closeModal,\n },\n {\n name: \"download\",\n fn: download,\n },\n {\n name: \"postWindowMessage\",\n fn: postWindowMessage,\n },\n {\n name: \"copyToClipboard\",\n fn: copyToClipboard,\n },\n {\n name: \"resetWidget\",\n fn: resetWidget,\n },\n {\n name: \"storeValue\",\n fn: storeValue,\n },\n {\n name: \"removeValue\",\n fn: removeValue,\n },\n {\n name: \"clearStore\",\n fn: clearStore,\n },\n];\n\nconst entityFns = [\n {\n name: \"run\",\n qualifier: (entity: DataTreeEntity) => isRunNClearFnQualifierEntity(entity),\n fn: (entity: DataTreeEntity, entityName: string) => {\n const actionEntity = entity as ActionEntity;\n\n // @ts-expect-error: name is not defined on ActionEntity\n actionEntity.name = entityName;\n\n return getFnWithGuards(\n run.bind(actionEntity as ActionEntity),\n `${entityName}.run`,\n [isAsyncGuard],\n );\n },\n },\n {\n name: \"clear\",\n qualifier: (entity: DataTreeEntity) => isRunNClearFnQualifierEntity(entity),\n fn: (entity: DataTreeEntity, entityName: string) =>\n getFnWithGuards(\n clear.bind(entity as ActionEntity),\n `${entityName}.clear`,\n [isAsyncGuard],\n ),\n },\n {\n name: \"getGeoLocation\",\n path: \"appsmith.geolocation.getCurrentPosition\",\n qualifier: (entity: DataTreeEntity) => isAppsmithEntity(entity),\n fn: () =>\n getFnWithGuards(\n getGeoLocation,\n \"appsmith.geolocation.getCurrentPosition\",\n [isAsyncGuard],\n ),\n },\n {\n name: \"watchGeoLocation\",\n path: \"appsmith.geolocation.watchPosition\",\n qualifier: (entity: DataTreeEntity) => isAppsmithEntity(entity),\n fn: () =>\n getFnWithGuards(watchGeoLocation, \"appsmith.geolocation.watchPosition\", [\n isAsyncGuard,\n ]),\n },\n {\n name: \"stopWatchGeoLocation\",\n path: \"appsmith.geolocation.clearWatch\",\n qualifier: (entity: DataTreeEntity) => isAppsmithEntity(entity),\n fn: () =>\n getFnWithGuards(stopWatchGeoLocation, \"appsmith.geolocation.clearWatch\", [\n isAsyncGuard,\n ]),\n },\n];\n\nexport type ActionTriggerKeys =\n | TClearActionType\n | TRunActionType\n | TDownloadActionType\n | TShowModalActionType\n | TCloseModalActionType\n | TShowAlertActionType\n | TDownloadActionType\n | TNavigateToActionType\n | TResetWidgetActionType\n | TCopyToClipboardActionType\n | TPostWindowMessageActionType\n | TGetGeoLocationActionType\n | TWatchGeoLocationActionType\n | TStopWatchGeoLocationActionType;\n\nexport const getActionTriggerFunctionNames = (): Record => {\n return ActionTriggerFunctionNames;\n};\n\nconst ActionTriggerFunctionNames: Record = {\n CLEAR_INTERVAL: \"clearInterval\",\n CLEAR_PLUGIN_ACTION: \"action.clear\",\n CLOSE_MODAL: \"closeModal\",\n COPY_TO_CLIPBOARD: \"copyToClipboard\",\n DOWNLOAD: \"download\",\n NAVIGATE_TO: \"navigateTo\",\n RESET_WIDGET_META_RECURSIVE_BY_NAME: \"resetWidget\",\n RUN_PLUGIN_ACTION: \"action.run\",\n SET_INTERVAL: \"setInterval\",\n SHOW_ALERT: \"showAlert\",\n SHOW_MODAL_BY_NAME: \"showModal\",\n STORE_VALUE: \"storeValue\",\n REMOVE_VALUE: \"removeValue\",\n CLEAR_STORE: \"clearStore\",\n GET_CURRENT_LOCATION: \"getCurrentLocation\",\n WATCH_CURRENT_LOCATION: \"watchLocation\",\n STOP_WATCHING_CURRENT_LOCATION: \"stopWatch\",\n POST_MESSAGE: \"postWindowMessage\",\n SET_TIMEOUT: \"setTimeout\",\n CLEAR_TIMEOUT: \"clearTimeout\",\n};\n\nexport type ActionDescription =\n | TRunDescription\n | TClearDescription\n | TShowModalDescription\n | TCloseModalDescription\n | TClearDescription\n | TStoreValueDescription\n | TClearStoreDescription\n | TRemoveValueDescription\n | TDownloadDescription\n | TPostWindowMessageDescription\n | TNavigateToDescription\n | TShowAlertDescription\n | TResetWidgetDescription\n | TCopyToClipboardDescription\n | TGetGeoLocationDescription\n | TWatchGeoLocationDescription\n | TStopWatchGeoLocationDescription;\n","import type { DependencyMap, EvaluationError } from \"utils/DynamicBindingUtils\";\nimport {\n EVAL_ERROR_PATH,\n isChildPropertyPath,\n isDynamicValue,\n PropertyEvaluationErrorType,\n isPathDynamicTrigger,\n isPathADynamicBinding,\n} from \"utils/DynamicBindingUtils\";\nimport type { Diff } from \"deep-diff\";\nimport type {\n DataTreeEntity,\n DataTree,\n ConfigTree,\n} from \"entities/DataTree/dataTreeTypes\";\nimport { ENTITY_TYPE } from \"ee/entities/DataTree/types\";\nimport _, { difference, get, has, isEmpty, isNil, set } from \"lodash\";\nimport type { WidgetTypeConfigMap } from \"WidgetProvider/factory\";\nimport { PluginType } from \"entities/Plugin\";\nimport { klona } from \"klona/full\";\nimport { warn as logWarn } from \"loglevel\";\nimport type { EvalMetaUpdates } from \"ee/workers/common/DataTreeEvaluator/types\";\nimport type {\n JSActionEntityConfig,\n PrivateWidgets,\n JSActionEntity,\n ActionEntity,\n AppsmithEntity,\n WidgetEntity,\n DataTreeEntityConfig,\n WidgetEntityConfig,\n} from \"ee/entities/DataTree/types\";\nimport type { EvalProps } from \"workers/common/DataTreeEvaluator\";\nimport { validateWidgetProperty } from \"workers/common/DataTreeEvaluator/validationUtils\";\nimport { isWidgetActionOrJsObject } from \"ee/entities/DataTree/utils\";\nimport type { Difference } from \"microdiff\";\n\n// Dropdown1.options[1].value -> Dropdown1.options[1]\n// Dropdown1.options[1] -> Dropdown1.options\n// Dropdown1.options -> Dropdown1\nexport const IMMEDIATE_PARENT_REGEX = /^(.*)(\\..*|\\[.*\\])$/;\n\nexport enum DataTreeDiffEvent {\n NEW = \"NEW\",\n DELETE = \"DELETE\",\n EDIT = \"EDIT\",\n NOOP = \"NOOP\", // No Operation (don’t do anything)\n}\n\nexport interface DataTreeDiff {\n payload: {\n propertyPath: string;\n value?: string;\n };\n event: DataTreeDiffEvent;\n}\n\nexport class CrashingError extends Error {}\n\nexport const convertPathToString = (arrPath: Array) => {\n let string = \"\";\n\n arrPath.forEach((segment) => {\n if (isInt(segment)) {\n string = string + \"[\" + segment + \"]\";\n } else {\n if (string.length !== 0) {\n string = string + \".\";\n }\n\n string = string + segment;\n }\n });\n\n return string;\n};\n\n// Todo: improve the logic here\n// Right now NaN, Infinity, floats, everything works\nfunction isInt(val: string | number): boolean {\n return Number.isInteger(val) || (_.isString(val) && /^\\d+$/.test(val));\n}\n\n// Removes the entity name from the property path\nexport function getEntityNameAndPropertyPath(fullPath: string): {\n entityName: string;\n propertyPath: string;\n} {\n const indexOfFirstDot = fullPath.indexOf(\".\");\n\n if (indexOfFirstDot === -1) {\n // No dot was found so path is the entity name itself\n return {\n entityName: fullPath,\n propertyPath: \"\",\n };\n }\n\n const entityName = fullPath.substring(0, indexOfFirstDot);\n const propertyPath = fullPath.substring(indexOfFirstDot + 1);\n\n return { entityName, propertyPath };\n}\n\nexport function translateCollectionDiffs(\n propertyPath: string,\n data: unknown,\n event: DataTreeDiffEvent,\n) {\n const dataTreeDiffs: DataTreeDiff[] = [];\n\n if (Array.isArray(data)) {\n data.forEach((diff, idx) => {\n dataTreeDiffs.push({\n event,\n payload: {\n propertyPath: `${propertyPath}[${idx}]`,\n },\n });\n });\n } else if (isTrueObject(data)) {\n Object.keys(data).forEach((diffKey) => {\n const path = `${propertyPath}.${diffKey}`;\n\n dataTreeDiffs.push({\n event,\n payload: {\n propertyPath: path,\n },\n });\n });\n }\n\n return dataTreeDiffs;\n}\n\n//these paths are not required to go through evaluate tree as these are internal properties\nconst ignorePathsForEvalRegex =\n \".(reactivePaths|bindingPaths|triggerPaths|validationPaths|dynamicBindingPathList)\";\n\n//match if paths are part of ignorePathsForEvalRegex\nconst isUninterestingChangeForDependencyUpdate = (path: string) => {\n return path.match(ignorePathsForEvalRegex);\n};\n\nexport const translateDiffEventToDataTreeDiffEvent = (\n // TODO: Fix this the next time the file is edited\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n difference: Diff,\n unEvalDataTree: DataTree,\n): DataTreeDiff | DataTreeDiff[] => {\n let result: DataTreeDiff | DataTreeDiff[] = {\n payload: {\n propertyPath: \"\",\n value: \"\",\n },\n event: DataTreeDiffEvent.NOOP,\n };\n\n if (!difference.path) {\n return result;\n }\n\n const propertyPath = convertPathToString(difference.path);\n\n // add propertyPath to NOOP event\n result.payload = {\n propertyPath,\n value: \"\",\n };\n\n //we do not need evaluate these paths because these are internal paths\n const isUninterestingPathForUpdateTree =\n isUninterestingChangeForDependencyUpdate(propertyPath);\n\n if (!!isUninterestingPathForUpdateTree) {\n return result;\n }\n\n const { entityName } = getEntityNameAndPropertyPath(propertyPath);\n const entity = unEvalDataTree[entityName];\n const isJsAction = isJSAction(entity);\n\n switch (difference.kind) {\n case \"N\": {\n result.event = DataTreeDiffEvent.NEW;\n result.payload = {\n propertyPath,\n };\n break;\n }\n case \"D\": {\n result.event = DataTreeDiffEvent.DELETE;\n result.payload = { propertyPath };\n break;\n }\n case \"E\": {\n const rhsChange =\n typeof difference.rhs === \"string\" &&\n (isDynamicValue(difference.rhs) || isJsAction);\n\n const lhsChange =\n typeof difference.lhs === \"string\" &&\n (isDynamicValue(difference.lhs) || isJsAction);\n\n if (rhsChange || lhsChange) {\n result = [\n {\n event:\n difference.lhs === undefined\n ? DataTreeDiffEvent.NEW\n : DataTreeDiffEvent.EDIT,\n payload: {\n propertyPath,\n value: difference.rhs,\n },\n },\n ];\n /**\n * If lhs is an array/object\n * Add delete events for all memberExpressions\n */\n\n const dataTreeDeleteDiffs = translateCollectionDiffs(\n propertyPath,\n difference.lhs,\n DataTreeDiffEvent.DELETE,\n );\n\n result = result.concat(dataTreeDeleteDiffs);\n } else if (difference.lhs === undefined || difference.rhs === undefined) {\n // Handle static value changes that change structure that can lead to\n // old bindings being eligible\n if (difference.lhs === undefined && !isNil(difference.rhs)) {\n result.event = DataTreeDiffEvent.NEW;\n result.payload = { propertyPath };\n }\n\n if (difference.rhs === undefined && !isNil(difference.lhs)) {\n result = [\n {\n event: DataTreeDiffEvent.EDIT,\n payload: {\n propertyPath,\n value: difference.rhs,\n },\n },\n ];\n\n const dataTreeDeleteDiffs = translateCollectionDiffs(\n propertyPath,\n difference.lhs,\n DataTreeDiffEvent.DELETE,\n );\n\n result = dataTreeDeleteDiffs.concat(result);\n }\n } else if (\n isTrueObject(difference.lhs) &&\n !isTrueObject(difference.rhs)\n ) {\n // This will happen for static value changes where a property went\n // from being an object to any other type like string or number\n // in such a case we want to delete all nested paths of the\n // original lhs object\n\n result = translateCollectionDiffs(\n propertyPath,\n difference.lhs,\n DataTreeDiffEvent.DELETE,\n );\n\n // when an object is being replaced by an array\n // list all new array accessors that are being added\n // so dependencies will be created based on existing bindings\n if (Array.isArray(difference.rhs)) {\n result = result.concat(\n translateCollectionDiffs(\n propertyPath,\n difference.rhs,\n DataTreeDiffEvent.NEW,\n ),\n );\n }\n } else if (\n !isTrueObject(difference.lhs) &&\n isTrueObject(difference.rhs)\n ) {\n // This will happen for static value changes where a property went\n // from being any other type like string or number to an object\n // in such a case we want to add all nested paths of the\n // new rhs object\n result = translateCollectionDiffs(\n propertyPath,\n difference.rhs,\n DataTreeDiffEvent.NEW,\n );\n\n // when an array is being replaced by an object\n // remove all array accessors that are deleted\n // so dependencies by existing bindings are removed\n if (Array.isArray(difference.lhs)) {\n result = result.concat(\n translateCollectionDiffs(\n propertyPath,\n difference.lhs,\n DataTreeDiffEvent.DELETE,\n ),\n );\n }\n }\n\n break;\n }\n case \"A\": {\n return translateDiffEventToDataTreeDiffEvent(\n {\n ...difference.item,\n path: [...difference.path, difference.index],\n },\n unEvalDataTree,\n );\n }\n default: {\n break;\n }\n }\n\n return result;\n};\n\nexport const translateDiffArrayIndexAccessors = (\n propertyPath: string,\n array: unknown[],\n event: DataTreeDiffEvent,\n) => {\n const result: DataTreeDiff[] = [];\n\n array.forEach((data, index) => {\n const path = `${propertyPath}[${index}]`;\n\n result.push({\n event,\n payload: {\n propertyPath: path,\n },\n });\n });\n\n return result;\n};\n/*\n Table1.selectedRow\n Table1.selectedRow.email: [\"Input1.defaultText\"]\n */\n\nexport const addDependantsOfNestedPropertyPaths = (\n parentPaths: Array,\n inverseMap: DependencyMap,\n): Set => {\n const withNestedPaths: Set = new Set();\n const dependantNodes = Object.keys(inverseMap);\n\n parentPaths.forEach((propertyPath) => {\n withNestedPaths.add(propertyPath);\n dependantNodes\n .filter((dependantNodePath) =>\n isChildPropertyPath(propertyPath, dependantNodePath),\n )\n .forEach((dependantNodePath) => {\n inverseMap[dependantNodePath].forEach((path) => {\n withNestedPaths.add(path);\n });\n });\n });\n\n return withNestedPaths;\n};\n\nexport function isWidget(\n entity: Partial | DataTreeEntityConfig,\n): entity is WidgetEntity | WidgetEntityConfig {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.WIDGET\n );\n}\n\nexport const shouldSuppressAutoComplete = (widget: WidgetEntity) =>\n Boolean(widget.suppressAutoComplete);\n\nexport const shouldSuppressDebuggerError = (widget: WidgetEntity) =>\n Boolean(widget.suppressDebuggerError);\n\nexport function isAction(\n entity: Partial,\n): entity is ActionEntity {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.ACTION\n );\n}\n\nexport function isAppsmithEntity(\n entity: DataTreeEntity,\n): entity is AppsmithEntity {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.APPSMITH\n );\n}\n\nexport function isJSAction(entity: DataTreeEntity): entity is JSActionEntity {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION\n );\n}\n/**\n *\n * isAnyJSAction checks if the entity is a JSAction ( or a JSModuleInstance on EE )\n */\nexport function isAnyJSAction(entity: DataTreeEntity) {\n return isJSAction(entity);\n}\n\nexport function isJSActionConfig(\n entity: DataTreeEntityConfig,\n): entity is JSActionEntityConfig {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION\n );\n}\n\nexport function isJSObject(entity: DataTreeEntity): entity is JSActionEntity {\n return (\n typeof entity === \"object\" &&\n \"ENTITY_TYPE\" in entity &&\n entity.ENTITY_TYPE === ENTITY_TYPE.JSACTION &&\n \"pluginType\" in entity &&\n entity.pluginType === PluginType.JS\n );\n}\n\nexport function isDataTreeEntity(entity: unknown) {\n return !!entity && typeof entity === \"object\" && \"ENTITY_TYPE\" in entity;\n}\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const serialiseToBigInt = (value: any) =>\n JSON.stringify(value, (_, v) => (typeof v === \"bigint\" ? v.toString() : v));\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const removeFunctionsAndSerialzeBigInt = (value: any) =>\n JSON.parse(serialiseToBigInt(value));\n// We need to remove functions from data tree to avoid any unexpected identifier while JSON parsing\n// Check issue https://github.com/appsmithorg/appsmith/issues/719\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const removeFunctions = (value: any) => {\n if (_.isFunction(value)) {\n return \"Function call\";\n } else if (_.isObject(value)) {\n return removeFunctionsAndSerialzeBigInt(value);\n } else {\n return value;\n }\n};\n\nexport const makeParentsDependOnChildren = (\n depMap: DependencyMap,\n allkeys: Record,\n): DependencyMap => {\n //return depMap;\n // Make all parents depend on child\n Object.keys(depMap).forEach((key) => {\n depMap = makeParentsDependOnChild(depMap, key, allkeys);\n depMap[key].forEach((path) => {\n depMap = makeParentsDependOnChild(depMap, path, allkeys);\n });\n });\n\n return depMap;\n};\n\nexport const makeParentsDependOnChild = (\n depMap: DependencyMap,\n child: string,\n allkeys: Record,\n): DependencyMap => {\n const result: DependencyMap = depMap;\n let curKey = child;\n\n if (!allkeys[curKey]) {\n logWarn(\n `makeParentsDependOnChild - ${curKey} is not present in dataTree.`,\n \"This might result in a cyclic dependency.\",\n );\n }\n\n let matches: Array | null;\n\n // Note: The `=` is intentional\n // Stops looping when match is null\n while ((matches = curKey.match(IMMEDIATE_PARENT_REGEX)) !== null) {\n const parentKey = matches[1];\n // Todo: switch everything to set.\n const existing = new Set(result[parentKey] || []);\n\n existing.add(curKey);\n result[parentKey] = Array.from(existing);\n curKey = parentKey;\n }\n\n return result;\n};\n\n// The idea is to find the immediate parents of the property paths\n// e.g. For Table1.selectedRow.email, the parent is Table1.selectedRow\nexport const getImmediateParentsOfPropertyPaths = (\n propertyPaths: Array,\n): Array => {\n // Use a set to ensure that we dont have duplicates\n const parents: Set = new Set();\n\n propertyPaths.forEach((path) => {\n const matches = path.match(IMMEDIATE_PARENT_REGEX);\n\n if (matches !== null) {\n parents.add(matches[1]);\n }\n });\n\n return Array.from(parents);\n};\n\nexport const getAllPaths = (\n records: Record | unknown,\n curKey = \"\",\n result: Record = {},\n): Record => {\n // Add the key if it exists\n if (curKey) result[curKey] = true;\n\n if (Array.isArray(records)) {\n for (let i = 0; i < records.length; i++) {\n const tempKey = curKey ? `${curKey}[${i}]` : `${i}`;\n\n getAllPaths(records[i], tempKey, result);\n }\n } else if (isTrueObject(records)) {\n for (const key of Object.keys(records)) {\n const tempKey = curKey ? `${curKey}.${key}` : `${key}`;\n\n getAllPaths(records[key], tempKey, result);\n }\n }\n\n return result;\n};\nexport const getAllPathsBasedOnDiffPaths = (\n records: Record | unknown,\n diff: DataTreeDiff[],\n // this argument would be mutable\n previousResult: Record = {},\n): Record => {\n const newResult = previousResult;\n\n diff.forEach((curr) => {\n const { event, payload } = curr;\n\n if (event === DataTreeDiffEvent.DELETE) {\n delete newResult[payload.propertyPath];\n }\n\n if (event === DataTreeDiffEvent.NEW || event === DataTreeDiffEvent.EDIT) {\n const newDataSegments = get(records, payload.propertyPath);\n\n // directly mutates on the result so we don't have to merge it back to the result\n getAllPaths(newDataSegments, payload.propertyPath, newResult);\n }\n });\n\n return newResult;\n};\nexport const trimDependantChangePaths = (\n changePaths: Set,\n dependencyMap: DependencyMap,\n): Array => {\n const trimmedPaths = [];\n\n for (const path of changePaths) {\n let foundADependant = false;\n\n if (path in dependencyMap) {\n const dependants = dependencyMap[path];\n\n for (const dependantPath of dependants) {\n if (changePaths.has(dependantPath)) {\n foundADependant = true;\n break;\n }\n }\n }\n\n if (!foundADependant) {\n trimmedPaths.push(path);\n }\n }\n\n return trimmedPaths;\n};\n\nexport function getSafeToRenderDataTree(\n tree: DataTree,\n widgetTypeConfigMap: WidgetTypeConfigMap,\n configTree: ConfigTree,\n) {\n return Object.keys(tree).reduce((tree, entityKey: string) => {\n const entity = tree[entityKey];\n\n if (!isWidget(entity)) {\n return tree;\n }\n\n const entityConfig = configTree[entityKey] as WidgetEntityConfig;\n\n const safeToRenderEntity = { ...entity };\n\n // Set user input values to their parsed values\n Object.entries(entityConfig.validationPaths).forEach(\n ([property, validation]) => {\n const value = _.get(entity, property);\n // Pass it through parse\n const { parsed } = validateWidgetProperty(\n validation,\n value,\n entityConfig,\n property,\n );\n\n _.set(safeToRenderEntity, property, parsed);\n },\n );\n // Set derived values to undefined or else they would go as bindings\n Object.keys(\n widgetTypeConfigMap[entityConfig.type].derivedProperties,\n ).forEach((property) => {\n _.set(safeToRenderEntity, property, undefined);\n });\n\n return { ...tree, [entityKey]: safeToRenderEntity };\n }, tree);\n}\n\nexport const addErrorToEntityProperty = ({\n configTree,\n errors,\n evalProps,\n fullPropertyPath,\n}: {\n errors: EvaluationError[];\n fullPropertyPath: string;\n evalProps: EvalProps;\n configTree: ConfigTree;\n}) => {\n const { entityName, propertyPath } =\n getEntityNameAndPropertyPath(fullPropertyPath);\n const isPrivateEntityPath =\n getAllPrivateWidgetsInDataTree(configTree)[entityName];\n const logBlackList = get(configTree, `${entityName}.logBlackList`, {});\n\n if (propertyPath && !(propertyPath in logBlackList) && !isPrivateEntityPath) {\n const errorPath = `${entityName}.${EVAL_ERROR_PATH}['${propertyPath}']`;\n const existingErrors = get(evalProps, errorPath, []) as EvaluationError[];\n\n set(evalProps, errorPath, existingErrors.concat(errors));\n }\n};\n\nexport const resetValidationErrorsForEntityProperty = ({\n evalProps,\n fullPropertyPath,\n}: {\n fullPropertyPath: string;\n evalProps: EvalProps;\n}) => {\n const { entityName, propertyPath } =\n getEntityNameAndPropertyPath(fullPropertyPath);\n\n if (propertyPath) {\n const errorPath = `${entityName}.${EVAL_ERROR_PATH}['${propertyPath}']`;\n const existingErrorsExceptValidation = (\n _.get(evalProps, errorPath, []) as EvaluationError[]\n ).filter(\n (error) => error.errorType !== PropertyEvaluationErrorType.VALIDATION,\n );\n\n _.set(evalProps, errorPath, existingErrorsExceptValidation);\n }\n};\n\n// For the times when you need to know if something truly an object like { a: 1, b: 2}\n// typeof, lodash.isObject and others will return false positives for things like array, null, etc\nexport const isTrueObject = (\n item: unknown,\n): item is Record => {\n return Object.prototype.toString.call(item) === \"[object Object]\";\n};\n\n/**\n * This function finds the datatype of the given value.\n * typeof, lodash and others will return false positives for things like array, wrapper objects, etc\n * @param value\n * @returns datatype of the received value as string\n */\nexport const findDatatype = (value: unknown) => {\n return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();\n};\n\nexport const isDynamicLeaf = (\n unEvalTree: DataTree,\n propertyPath: string,\n configTree: ConfigTree,\n) => {\n const [entityName, ...propPathEls] = _.toPath(propertyPath);\n\n // Framework feature: Top level items are never leaves\n if (entityName === propertyPath) return false;\n\n // Ignore if this was a delete op\n if (!unEvalTree.hasOwnProperty(entityName)) return false;\n\n const entityConfig = configTree[entityName];\n const entity = unEvalTree[entityName];\n\n if (!isWidgetActionOrJsObject(entity)) return false;\n\n const relativePropertyPath = convertPathToString(propPathEls);\n\n return (\n (!isEmpty(entityConfig.reactivePaths) &&\n relativePropertyPath in entityConfig.reactivePaths) ||\n (isWidget(entityConfig) &&\n relativePropertyPath in entityConfig?.triggerPaths)\n );\n};\n\nexport const addWidgetPropertyDependencies = ({\n widgetConfig,\n widgetName,\n}: {\n widgetConfig: WidgetEntityConfig;\n widgetName: string;\n}) => {\n const dependencies: DependencyMap = {};\n\n Object.entries(widgetConfig.propertyOverrideDependency).forEach(\n ([overriddenPropertyKey, overridingPropertyKeyMap]) => {\n const existingDependenciesSet = new Set(\n dependencies[`${widgetName}.${overriddenPropertyKey}`] || [],\n );\n\n // add meta dependency\n overridingPropertyKeyMap.META &&\n existingDependenciesSet.add(\n `${widgetName}.${overridingPropertyKeyMap.META}`,\n );\n // add default dependency\n overridingPropertyKeyMap.DEFAULT &&\n existingDependenciesSet.add(\n `${widgetName}.${overridingPropertyKeyMap.DEFAULT}`,\n );\n\n dependencies[`${widgetName}.${overriddenPropertyKey}`] = [\n ...existingDependenciesSet,\n ];\n },\n );\n\n return dependencies;\n};\n\nexport const isPrivateEntityPath = (\n privateWidgets: PrivateWidgets,\n fullPropertyPath: string,\n) => {\n const entityName = fullPropertyPath.split(\".\")[0];\n\n if (Object.keys(privateWidgets).indexOf(entityName) !== -1) {\n return true;\n }\n\n return false;\n};\n\nexport const getAllPrivateWidgetsInDataTree = (\n configTree: ConfigTree,\n): PrivateWidgets => {\n let privateWidgets: PrivateWidgets = {};\n\n Object.keys(configTree).forEach((entityName) => {\n const entityConfig = configTree[entityName] as WidgetEntityConfig;\n\n if (isWidget(entityConfig) && !_.isEmpty(entityConfig.privateWidgets)) {\n privateWidgets = { ...privateWidgets, ...entityConfig.privateWidgets };\n }\n });\n\n return privateWidgets;\n};\n\nexport const getDataTreeWithoutPrivateWidgets = (\n dataTree: DataTree,\n configTree: ConfigTree,\n): DataTree => {\n const privateWidgets = getAllPrivateWidgetsInDataTree(configTree);\n const privateWidgetNames = Object.keys(privateWidgets);\n const treeWithoutPrivateWidgets = _.omit(dataTree, privateWidgetNames);\n\n return treeWithoutPrivateWidgets;\n};\n\nconst getDataTreeWithoutSuppressedAutoComplete = (\n dataTree: DataTree,\n): DataTree => {\n const entityIds = Object.keys(dataTree).filter((entityName) => {\n const entity = dataTree[entityName];\n\n return (\n isWidget(entity) && shouldSuppressAutoComplete(entity as WidgetEntity)\n );\n });\n\n return _.omit(dataTree, entityIds);\n};\n\nexport const getDataTreeForAutocomplete = (\n dataTree: DataTree,\n configTree: ConfigTree,\n): DataTree => {\n const treeWithoutPrivateWidgets = getDataTreeWithoutPrivateWidgets(\n dataTree,\n configTree,\n );\n const treeWithoutSuppressedAutoComplete =\n getDataTreeWithoutSuppressedAutoComplete(treeWithoutPrivateWidgets);\n\n return treeWithoutSuppressedAutoComplete;\n};\n\n/**\n * overrideWidgetProperties method has logic to update overriddenPropertyPaths when overridingPropertyPaths are evaluated.\n *\n * when we evaluate widget's overridingPropertyPaths for example defaultText of input widget,\n * we override the values like text and meta.text in dataTree, these values are called as overriddenPropertyPaths\n *\n * @param {{\n * entity: WidgetEntity;\n * propertyPath: string;\n * value: unknown;\n * currentTree: DataTree;\n * evalMetaUpdates: EvalMetaUpdates;\n * }} params\n * @return {*}\n */\nexport const overrideWidgetProperties = (params: {\n entity: WidgetEntity;\n propertyPath: string;\n value: unknown;\n currentTree: DataTree;\n configTree: ConfigTree;\n evalMetaUpdates: EvalMetaUpdates;\n fullPropertyPath: string;\n isNewWidget: boolean;\n shouldUpdateGlobalContext?: boolean;\n overriddenProperties?: string[];\n safeTree?: DataTree;\n}) => {\n const {\n configTree,\n currentTree,\n entity,\n evalMetaUpdates,\n fullPropertyPath,\n isNewWidget,\n overriddenProperties,\n propertyPath,\n safeTree,\n shouldUpdateGlobalContext,\n value,\n } = params;\n const { entityName } = getEntityNameAndPropertyPath(fullPropertyPath);\n\n const configEntity = configTree[entityName] as WidgetEntityConfig;\n\n if (propertyPath in configEntity.overridingPropertyPaths) {\n const clonedValue = klona(value);\n const overridingPropertyPaths =\n configEntity.overridingPropertyPaths[propertyPath];\n\n const pathsNotToOverride = widgetPathsNotToOverride(\n isNewWidget,\n propertyPath,\n configEntity,\n );\n\n overridingPropertyPaths.forEach((overriddenPropertyPath) => {\n const overriddenPropertyPathArray = overriddenPropertyPath.split(\".\");\n\n if (pathsNotToOverride.includes(overriddenPropertyPath)) return;\n\n const fullPath = [entityName, ...overriddenPropertyPathArray];\n\n _.set(currentTree, fullPath, clonedValue);\n\n if (safeTree) _.set(safeTree, fullPath, klona(value));\n\n if (shouldUpdateGlobalContext) {\n _.set(self, fullPath, clonedValue);\n }\n\n overriddenProperties?.push(overriddenPropertyPath);\n\n // evalMetaUpdates has all updates from property which overrides meta values.\n if (\n propertyPath.split(\".\")[0] !== \"meta\" &&\n overriddenPropertyPathArray[0] === \"meta\"\n ) {\n const metaPropertyPath = overriddenPropertyPathArray.slice(1);\n\n evalMetaUpdates.push({\n widgetId: entity.widgetId,\n metaPropertyPath,\n value: clonedValue,\n });\n }\n });\n } else if (\n propertyPath in configEntity.propertyOverrideDependency &&\n value === undefined\n ) {\n // When a reset a widget its meta value becomes undefined, ideally they should reset to default value.\n // below we handle logic to reset meta values to default values.\n const propertyOverridingKeyMap =\n configEntity.propertyOverrideDependency[propertyPath];\n\n if (propertyOverridingKeyMap.DEFAULT) {\n const defaultValue = entity[propertyOverridingKeyMap.DEFAULT];\n\n if (defaultValue !== undefined) {\n const clonedDefaultValue = klona(defaultValue);\n const fullPath = [entityName, ...propertyPath.split(\".\")];\n\n _.set(currentTree, fullPath, clonedDefaultValue);\n\n if (safeTree) _.set(safeTree, fullPath, klona(defaultValue));\n\n if (shouldUpdateGlobalContext) {\n _.set(self, fullPath, clonedDefaultValue);\n }\n\n return {\n overwriteParsedValue: true,\n newValue: clonedDefaultValue,\n };\n }\n }\n }\n};\n\nexport const isATriggerPath = (\n entityConfig: DataTreeEntityConfig,\n propertyPath: string,\n) => {\n return (\n isWidget(entityConfig) && isPathDynamicTrigger(entityConfig, propertyPath)\n );\n};\n\n// Checks if entity newly got added to the unevalTree\nexport const isNewEntity = (updates: Set, entityName: string) => {\n return updates.has(entityName);\n};\n\nconst widgetPathsNotToOverride = (\n isNewWidget: boolean,\n propertyPath: string,\n entityConfig: WidgetEntityConfig,\n) => {\n let pathsNotToOverride: string[] = [];\n const overriddenPropertyPaths =\n entityConfig.overridingPropertyPaths[propertyPath];\n\n // Check if widget has pre-existing meta values (although newly added to the unevalTree)\n if (isNewWidget && entityConfig.isMetaPropDirty) {\n const overriddenMetaPaths = overriddenPropertyPaths.filter(\n (path) => path.split(\".\")[0] === \"meta\",\n );\n\n // If widget is newly added but has pre-existing meta values, this meta values take precedence and should not be overridden\n pathsNotToOverride = [...overriddenMetaPaths];\n // paths which these meta values override should also not get overridden\n overriddenMetaPaths.forEach((path) => {\n if (entityConfig.overridingPropertyPaths.hasOwnProperty(path)) {\n pathsNotToOverride = [\n ...pathsNotToOverride,\n ...entityConfig.overridingPropertyPaths[path],\n ];\n }\n });\n }\n\n return pathsNotToOverride;\n};\n\nconst isWidgetDefaultPropertyPath = (\n widget: WidgetEntityConfig,\n propertyPath: string,\n) => {\n for (const property of Object.keys(widget.propertyOverrideDependency)) {\n const overrideDependency = widget.propertyOverrideDependency[property];\n\n if (overrideDependency.DEFAULT === propertyPath) return true;\n }\n\n return false;\n};\n\nconst isMetaWidgetTemplate = (widget: WidgetEntity) => {\n return !!widget.siblingMetaWidgets;\n};\n\n// When a default value changes in a template(widgets used to generate other widgets), meta values of metaWidgets not present in the unevalTree become stale\nexport function getStaleMetaStateIds(args: {\n entity: WidgetEntity;\n entityConfig: WidgetEntityConfig;\n propertyPath: string;\n isNewWidget: boolean;\n metaWidgets: string[];\n}) {\n const { entity, entityConfig, isNewWidget, metaWidgets, propertyPath } = args;\n\n return !isNewWidget &&\n isWidgetDefaultPropertyPath(entityConfig, propertyPath) &&\n isMetaWidgetTemplate(entity)\n ? difference(entity.siblingMetaWidgets, metaWidgets)\n : [];\n}\n\nexport function convertJSFunctionsToString(\n jscollections: Record,\n configTree: ConfigTree,\n) {\n const collections = klona(jscollections);\n\n Object.keys(collections).forEach((collectionName) => {\n const jsCollection = collections[collectionName];\n const jsCollectionConfig = configTree[\n collectionName\n ] as JSActionEntityConfig;\n const jsFunctions = jsCollectionConfig.meta;\n\n for (const funcName in jsFunctions) {\n if (jsCollection[funcName] instanceof String) {\n if (has(jsCollection, [funcName, \"data\"])) {\n set(jsCollection, [`${funcName}.data`], {});\n }\n\n set(jsCollection, funcName, jsCollection[funcName].toString());\n }\n }\n });\n\n return collections;\n}\n\nexport const isAPathDynamicBindingPath = (\n entity: DataTreeEntity,\n entityConfig: DataTreeEntityConfig,\n propertyPath: string,\n) => {\n return (\n isWidgetActionOrJsObject(entity) &&\n isPathADynamicBinding(entityConfig, propertyPath)\n );\n};\n\nexport const isNotEntity = (entity: DataTreeEntity) => {\n return !isAction(entity) && !isWidget(entity) && !isJSAction(entity);\n};\n\nexport const isEntityAction = (entity: DataTreeEntity) => {\n return isAction(entity);\n};\n\nexport const isPropertyAnEntityAction = (\n entity: DataTreeEntity,\n propertyPath: string,\n entityConfig: DataTreeEntityConfig,\n) => {\n if (!isJSAction(entity)) return false;\n\n const { actionNames } = entityConfig as JSActionEntityConfig;\n\n return actionNames.has(propertyPath);\n};\n\nexport const convertMicroDiffToDeepDiff = (\n microDiffDifferences: Difference[],\n): Diff[] =>\n microDiffDifferences.map((microDifference) => {\n const { path, type } = microDifference;\n\n //convert microDiff format to deepDiff format\n if (type === \"CREATE\") {\n return {\n kind: \"N\",\n path,\n rhs: microDifference.value,\n };\n }\n\n if (type === \"REMOVE\") {\n return {\n kind: \"D\",\n path,\n lhs: microDifference.oldValue,\n };\n }\n\n return {\n kind: \"E\",\n path,\n lhs: microDifference.oldValue,\n rhs: microDifference.value,\n };\n });\n","import type { Def } from \"tern\";\n\nexport enum TernWorkerAction {\n INIT = \"INIT\",\n ADD_FILE = \"ADD_FILE\",\n DELETE_FILE = \"DELETE_FILE\",\n REQUEST = \"REQUEST\",\n GET_FILE = \"GET_FILE\",\n DELETE_DEF = \"DELETE_DEF\",\n ADD_DEF = \"ADD_DEF\",\n DEBUG = \"DEBUG\",\n}\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CallbackFn = (...args: any) => any;\n\nexport type ExtraDef = Record;\n","export enum AutocompleteDataType {\n OBJECT = \"OBJECT\",\n NUMBER = \"NUMBER\",\n ARRAY = \"ARRAY\",\n FUNCTION = \"FUNCTION\",\n BOOLEAN = \"BOOLEAN\",\n STRING = \"STRING\",\n UNKNOWN = \"UNKNOWN\",\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Def } from \"tern\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const eeAppsmithAutocompleteDefs = (generatedTypeDef: Def) => ({});\n","import type { ExtraDef } from \"utils/autocomplete/defCreatorUtils\";\nimport { generateTypeDef } from \"utils/autocomplete/defCreatorUtils\";\nimport { ENTITY_TYPE, type AppsmithEntity } from \"ee/entities/DataTree/types\";\nimport _ from \"lodash\";\nimport { EVALUATION_PATH } from \"utils/DynamicBindingUtils\";\nimport type { Def } from \"tern\";\nimport type {\n ActionEntity,\n ActionEntityConfig,\n DataTreeEntityConfig,\n WidgetEntityConfig,\n} from \"ee/entities/DataTree/types\";\nimport type { FieldEntityInformation } from \"components/editorComponents/CodeEditor/EditorConfig\";\nimport { AutocompleteDataType } from \"utils/autocomplete/AutocompleteDataType\";\nimport { eeAppsmithAutocompleteDefs } from \"ee/utils/autocomplete/helpers\";\n\nexport const entityDefinitions = {\n APPSMITH: (entity: AppsmithEntity, extraDefsToDefine: ExtraDef) => {\n const generatedTypeDef = generateTypeDef(\n _.omit(entity, \"ENTITY_TYPE\", EVALUATION_PATH),\n extraDefsToDefine,\n );\n\n if (\n typeof generatedTypeDef === \"object\" &&\n typeof generatedTypeDef.geolocation === \"object\"\n ) {\n return {\n ...generatedTypeDef,\n \"!doc\":\n \"A global object that provides access to information and functionalities within an application\",\n \"!url\": \"https://docs.appsmith.com/reference/appsmith-framework\",\n store: {\n ...(generatedTypeDef.store as Def),\n \"!doc\":\n \"Object to access any app-level data or temporary state that is stored on the user's browser\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#store-object\",\n },\n user: {\n ...(generatedTypeDef.user as Def),\n \"!doc\":\n \"Object that contains the data of the currently authenticated user.\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#user-object\",\n },\n URL: {\n ...(generatedTypeDef.URL as Def),\n \"!doc\": \"Object containing all the attributes of the current URL\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#url-object\",\n },\n theme: {\n ...(generatedTypeDef.theme as Def),\n \"!doc\":\n \"Object containing the details of the theme properties applied to the application\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#theme-object\",\n },\n mode: {\n \"!type\": generatedTypeDef.mode as Def,\n \"!doc\":\n \"An enum that contains whether the app runs in view or edit mode. It takes the values VIEW or EDIT\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#mode-enum\",\n },\n geolocation: {\n ...generatedTypeDef.geolocation,\n \"!doc\":\n \"Object containing functions that allow you to retrieve the current user's location and the coordinates received from the user's device using the Geolocation API.\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#geolocation-object\",\n getCurrentPosition: {\n \"!type\":\n \"fn(onSuccess: fn() -> void, onError: fn() -> void, options: object) -> +Promise|void\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#geolocationgetcurrentposition\",\n },\n watchPosition: {\n \"!type\": \"fn(options: object) -> void\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#geolocationwatchposition\",\n },\n clearWatch: {\n \"!type\": \"fn() -> +Promise|void\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/context-object#geolocationclearwatch\",\n },\n },\n ...eeAppsmithAutocompleteDefs(generatedTypeDef),\n };\n }\n\n return generatedTypeDef;\n },\n ACTION: (entity: ActionEntity, extraDefsToDefine: ExtraDef) => {\n const dataDef = generateTypeDef(entity.data, extraDefsToDefine);\n let responseMetaDef = generateTypeDef(\n entity.responseMeta,\n extraDefsToDefine,\n );\n\n if (_.isString(responseMetaDef)) {\n responseMetaDef = {\n \"!type\": responseMetaDef,\n };\n }\n\n let dataCustomDef: Def = {\n \"!doc\":\n \"A read-only property that contains the response body from the last successful execution of this query.\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/query-object#data-array\",\n };\n\n if (_.isString(dataDef)) {\n dataCustomDef[\"!type\"] = dataDef;\n } else {\n dataCustomDef = { ...dataCustomDef, ...dataDef };\n }\n\n return {\n \"!doc\":\n \"Object that contains the properties required to run queries and access the query data.\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/query-object\",\n isLoading: {\n \"!type\": \"bool\",\n \"!doc\":\n \"Boolean that indicates whether the query is currently being executed.\",\n },\n data: dataCustomDef,\n responseMeta: {\n \"!doc\":\n \"Object that contains details about the response, such as the status code, headers, and other relevant information related to the query's execution and the server's response.\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/query-object#responsemeta-object\",\n ...responseMetaDef,\n },\n run: {\n \"!type\": \"fn(params?: {}) -> +Promise\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/query-object#queryrun\",\n \"!doc\": \"Executes the query with the given parameters.\",\n },\n clear: {\n \"!type\": \"fn() -> +Promise\",\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/query-object#queryclear\",\n \"!doc\": \"Clears the query data.\",\n },\n };\n },\n};\n\n/*\n $__name__$ is just to reduce occurrences of global def showing up in auto completion for user as `$` is less commonly used as entityName/\n\n GLOBAL_DEFS are maintained to support definition for array of objects which currently aren't supported by our generateTypeDef.\n*/\nexport const GLOBAL_DEFS = {\n $__dropdownOption__$: {\n label: \"string\",\n value: \"string\",\n },\n $__dropdrowOptionWithChildren__$: {\n label: \"string\",\n value: \"string\",\n children: \"[$__dropdrowOptionWithChildren__$]\",\n },\n $__chartDataPoint__$: {\n x: \"string\",\n y: \"string\",\n },\n $__file__$: {\n data: \"string\",\n dataFormat: \"string\",\n name: \"text\",\n type: \"file\",\n },\n $__mapMarker__$: {\n lat: \"number\",\n long: \"number\",\n title: \"string\",\n description: \"string\",\n },\n};\n\nexport const GLOBAL_FUNCTIONS = {\n \"!name\": \"DATA_TREE.APPSMITH.FUNCTIONS\",\n navigateTo: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/navigate-to\",\n \"!doc\":\n \"Enables navigation between the internal pages of the App or to an external URL.\",\n \"!type\":\n \"fn(pageNameOrUrl: string, params: {}, target?: string) -> +Promise\",\n },\n showAlert: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/show-alert\",\n \"!doc\":\n \"Displays a temporary toast-style alert message to the user for precisely 5 seconds. The duration of the alert message can't be modified.\",\n \"!type\": \"fn(message: string, style: string) -> +Promise\",\n },\n showModal: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/show-modal\",\n \"!doc\":\n \"Opens an existing Modal widget and bring it into focus on the page\",\n \"!type\": \"fn(modalName: string) -> +Promise\",\n },\n closeModal: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/close-modal\",\n \"!doc\": \"Close a modal\",\n \"!type\": \"fn(modalName: string) -> +Promise\",\n },\n storeValue: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/store-value\",\n \"!doc\":\n \"Stores the data in the browser's local storage as key-value pairs that represent storage objects and can be later accessed anywhere in the application via appsmith.store.\",\n \"!type\": \"fn(key: string, value: any, persist?: bool) -> +Promise\",\n },\n removeValue: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/remove-value\",\n \"!doc\": \"Remove key value data locally\",\n \"!type\": \"fn(key: string) -> +Promise\",\n },\n clearStore: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/clear-store\",\n \"!doc\": \"Clear all key value data locally\",\n \"!type\": \"fn() -> +Promise\",\n },\n download: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/download\",\n \"!doc\":\n \"Download any data as a file, leveraging the capabilities of the downloadjs library.\",\n \"!type\":\n \"fn(data: string|+Blob, fileName: string, fileType?: string) -> +Promise\",\n },\n copyToClipboard: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/copy-to-clipboard\",\n \"!doc\": \"Copies the given text to clipboard\",\n \"!type\": \"fn(data: string, options: object) -> +Promise\",\n },\n resetWidget: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/reset-widget\",\n \"!doc\":\n \"Resets a widget to its default state. All user input changes are reverted and its properties' default values are applied.\",\n \"!type\": \"fn(widgetName: string, resetChildren: bool) -> +Promise\",\n },\n setInterval: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/intervals-time-events\",\n \"!doc\": \"Executes a function at a given interval\",\n \"!type\":\n \"fn(callback: fn() -> void, interval: number, id?: string) -> number\",\n },\n clearInterval: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/clear-interval\",\n \"!doc\": \"Stop executing a setInterval with id\",\n \"!type\": \"fn(id: string) -> void\",\n },\n postWindowMessage: {\n \"!url\":\n \"https://docs.appsmith.com/reference/appsmith-framework/widget-actions/post-message\",\n \"!doc\":\n \"Establish cross-origin communication between Window objects/page and iframes\",\n \"!type\": \"fn(message: unknown, source: string, targetOrigin: string)\",\n },\n};\n\n// TODO: Fix this the next time the file is edited\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const ternDocsInfo: Record = {\n showAlert: {\n exampleArgs: [\n \"'This is a success message', 'success'\",\n \"'This is an error message', 'error'\",\n ],\n },\n showModal: {\n exampleArgs: [\"Modal1.name\"],\n },\n closeModal: {\n exampleArgs: [\"Modal1.name\"],\n },\n navigateTo: {\n exampleArgs: [\n \"'Page1', { id: 1 }\",\n \"'https://appsmith.com', {}, 'NEW_WINDOW'\",\n ],\n },\n copyToClipboard: {\n exampleArgs: [\"'Hello'\"],\n },\n download: {\n exampleArgs: [\n \"'Hello World', 'hello.txt', 'text/plain'\",\n \"FilePicker1.files[0].data, 'data.json'\",\n ],\n },\n storeValue: {\n exampleArgs: [\"'key', 'value'\"],\n },\n removeValue: {\n exampleArgs: [\"'key'\"],\n },\n clearStore: {\n exampleArgs: [\"\"],\n },\n resetWidget: {\n exampleArgs: [\"'Table1', false\"],\n },\n setInterval: {\n exampleArgs: [\"() => showAlert('Hello'), 1000, 'id'\"],\n },\n clearInterval: {\n exampleArgs: [\"'id'\"],\n },\n postWindowMessage: {\n exampleArgs: [\"message, 'Iframe1', '*'\"],\n },\n};\n\nexport type EntityDefinitionsOptions = keyof typeof entityDefinitions;\n\nexport const getEachEntityInformation = {\n [ENTITY_TYPE.ACTION]: (\n entity: DataTreeEntityConfig,\n entityInformation: FieldEntityInformation,\n ): FieldEntityInformation => {\n const actionEntity = entity as ActionEntityConfig;\n\n entityInformation.entityId = actionEntity.actionId;\n\n return entityInformation;\n },\n [ENTITY_TYPE.WIDGET]: (\n entity: DataTreeEntityConfig,\n entityInformation: FieldEntityInformation,\n propertyPath: string,\n ): FieldEntityInformation => {\n const widgetEntity = entity as WidgetEntityConfig;\n const isTriggerPath = widgetEntity.triggerPaths[propertyPath];\n\n entityInformation.entityId = widgetEntity.widgetId;\n\n if (isTriggerPath)\n entityInformation.expectedType = AutocompleteDataType.FUNCTION;\n\n entityInformation.isTriggerPath = isTriggerPath;\n entityInformation.widgetType = widgetEntity.type;\n\n return entityInformation;\n },\n [ENTITY_TYPE.JSACTION]: (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n entity: DataTreeEntityConfig,\n entityInformation: FieldEntityInformation,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n propertyPath: string,\n ): FieldEntityInformation => {\n entityInformation.isTriggerPath = true;\n\n return entityInformation;\n },\n};\n","import type { Server, Def } from \"tern\";\nimport tern from \"tern\";\nimport type { CallbackFn } from \"utils/autocomplete/types\";\nimport { TernWorkerAction } from \"utils/autocomplete/types\";\nimport ecma from \"constants/defs/ecmascript.json\";\nimport lodash from \"constants/defs/lodash.json\";\nimport base64 from \"constants/defs/base64-js.json\";\nimport moment from \"constants/defs/moment.json\";\nimport forge from \"constants/defs/forge.json\";\nimport browser from \"constants/defs/browser.json\";\nimport {\n GLOBAL_DEFS,\n GLOBAL_FUNCTIONS,\n} from \"ee/utils/autocomplete/EntityDefinitions\";\n\nlet server: Server;\n\nlet nextId = 0;\nconst pending: { [x: number]: CallbackFn } = {};\n\nself.onmessage = function (e) {\n const data = e.data;\n\n switch (data.type) {\n case TernWorkerAction.INIT:\n return startServer(data.plugins, data.scripts);\n case TernWorkerAction.ADD_FILE:\n return server.addFile(data.name, data.text);\n case TernWorkerAction.DELETE_FILE:\n return server.delFile(data.name);\n case TernWorkerAction.REQUEST:\n return server.request(data.body, function (err, reqData) {\n postMessage({ id: data.id, body: reqData, err: err && String(err) });\n });\n case TernWorkerAction.GET_FILE:\n const c = pending[data.id];\n\n delete pending[data.id];\n\n return c(data.err, data.text);\n case TernWorkerAction.DELETE_DEF:\n return server.deleteDefs(data.name);\n case TernWorkerAction.ADD_DEF:\n return server.addDefs(data.defs);\n default:\n throw new Error(\"Unknown message type: \" + data.type);\n }\n};\n\nfunction getFile(file: string, c: CallbackFn) {\n postMessage({ type: TernWorkerAction.GET_FILE, name: file, id: ++nextId });\n pending[nextId] = c;\n}\n\nfunction startServer(plugins = {}, scripts?: string[]) {\n if (scripts) self.importScripts.apply(null, scripts);\n\n server = new tern.Server({\n getFile: getFile,\n async: true,\n defs: [\n ecma,\n browser,\n GLOBAL_FUNCTIONS,\n GLOBAL_DEFS,\n lodash,\n base64,\n moment,\n forge,\n ] as Def[],\n plugins: plugins,\n });\n}\n\nself.console = {\n ...self.console,\n log: function (v) {\n postMessage({ type: TernWorkerAction.DEBUG, message: v });\n },\n};\n","import { APPSMITH_NAMESPACED_FUNCTIONS as EE_APPSMITH_NAMESPACED_FUNCTIONS } from \"ee/entities/Engine/actionHelpers\";\n\nexport enum APPSMITH_GLOBAL_FUNCTIONS {\n navigateTo = \"navigateTo\",\n showAlert = \"showAlert\",\n showModal = \"showModal\",\n closeModal = \"closeModal\",\n storeValue = \"storeValue\",\n removeValue = \"removeValue\",\n clearStore = \"clearStore\",\n download = \"download\",\n copyToClipboard = \"copyToClipboard\",\n resetWidget = \"resetWidget\",\n setInterval = \"setInterval\",\n clearInterval = \"clearInterval\",\n postWindowMessage = \"postWindowMessage\",\n}\n\nexport enum APPSMITH_NAMESPACED_FUNCTIONS {\n getGeolocation = \"appsmith.geolocation.getCurrentPosition\",\n watchGeolocation = \"appsmith.geolocation.watchPosition\",\n stopWatchGeolocation = \"appsmith.geolocation.clearWatch\",\n}\n\nexport enum APPSMITH_INTEGRATIONS {\n none = \"none\",\n integration = \"integration\",\n jsFunction = \"jsFunction\",\n}\n\nexport const AppsmithFunction = {\n ...APPSMITH_INTEGRATIONS,\n ...APPSMITH_GLOBAL_FUNCTIONS,\n ...APPSMITH_NAMESPACED_FUNCTIONS,\n ...EE_APPSMITH_NAMESPACED_FUNCTIONS,\n};\n\nexport const AppsmithFunctionsWithFields = [\n ...Object.values(APPSMITH_NAMESPACED_FUNCTIONS),\n ...Object.keys(APPSMITH_GLOBAL_FUNCTIONS),\n];\n\nexport const RESET_CHILDREN_OPTIONS = [\n { label: \"true\", value: \"true\", id: \"true\" },\n { label: \"false\", value: \"false\", id: \"false\" },\n];\n\nexport const FILE_TYPE_OPTIONS = [\n { label: \"Select file type (optional)\", value: \"\", id: \"\" },\n { label: \"Plain text\", value: \"'text/plain'\", id: \"text/plain\" },\n { label: \"HTML\", value: \"'text/html'\", id: \"text/html\" },\n { label: \"CSV\", value: \"'text/csv'\", id: \"text/csv\" },\n { label: \"JSON\", value: \"'application/json'\", id: \"application/json\" },\n { label: \"JPEG\", value: \"'image/jpeg'\", id: \"image/jpeg\" },\n { label: \"PNG\", value: \"'image/png'\", id: \"image/png\" },\n { label: \"SVG\", value: \"'image/svg+xml'\", id: \"image/svg+xml\" },\n];\n\nexport const NAVIGATION_TARGET_FIELD_OPTIONS = [\n {\n label: \"Same window\",\n value: \"'SAME_WINDOW'\",\n id: \"SAME_WINDOW\",\n },\n {\n label: \"New window\",\n value: \"'NEW_WINDOW'\",\n id: \"NEW_WINDOW\",\n },\n];\n\nexport const ViewTypes = {\n SELECTOR_VIEW: \"SELECTOR_VIEW\",\n KEY_VALUE_VIEW: \"KEY_VALUE_VIEW\",\n TEXT_VIEW: \"TEXT_VIEW\",\n BOOL_VIEW: \"BOOL_VIEW\",\n TAB_VIEW: \"TAB_VIEW\",\n NO_VIEW: \"NO_VIEW\",\n ACTION_SELECTOR_VIEW: \"ACTION_SELECTOR_VIEW\",\n};\n\nexport const NAVIGATE_TO_TAB_OPTIONS = {\n PAGE_NAME: \"page-name\",\n URL: \"url\",\n};\n\nexport const NEW_MODAL_LABEL = \"New Modal\";\nconst SELECT_OPTIONS_LABEL = \"Select file type (optional)\";\n\nexport const DEFAULT_LABELS = [NEW_MODAL_LABEL, SELECT_OPTIONS_LABEL];\n\nexport const DEFAULT_SELECTOR_VIEW_TEXT = \"Select Action\";\n\nexport const EMPTY_BINDING = \"{{}}\";\nexport const EMPTY_BINDING_WITH_EMPTY_OBJECT = \"{{{}}}\";\n\nexport enum FieldType {\n PARAMS_FIELD = \"PARAMS_FIELD\",\n ACTION_SELECTOR_FIELD = \"ACTION_SELECTOR_FIELD\",\n ON_SUCCESS_FIELD = \"ON_SUCCESS_FIELD\",\n ON_ERROR_FIELD = \"ON_ERROR_FIELD\",\n SHOW_MODAL_FIELD = \"SHOW_MODAL_FIELD\",\n CLOSE_MODAL_FIELD = \"CLOSE_MODAL_FIELD\",\n PAGE_SELECTOR_FIELD = \"PAGE_SELECTOR_FIELD\",\n KEY_VALUE_FIELD = \"KEY_VALUE_FIELD\",\n URL_FIELD = \"URL_FIELD\",\n ALERT_TEXT_FIELD = \"ALERT_TEXT_FIELD\",\n ALERT_TYPE_SELECTOR_FIELD = \"ALERT_TYPE_SELECTOR_FIELD\",\n KEY_TEXT_FIELD_REMOVE_VALUE = \"KEY_TEXT_FIELD_REMOVE_VALUE\",\n KEY_TEXT_FIELD_STORE_VALUE = \"KEY_TEXT_FIELD_STORE_VALUE\",\n VALUE_TEXT_FIELD = \"VALUE_TEXT_FIELD\",\n QUERY_PARAMS_FIELD = \"QUERY_PARAMS_FIELD\",\n DOWNLOAD_DATA_FIELD = \"DOWNLOAD_DATA_FIELD\",\n DOWNLOAD_FILE_NAME_FIELD = \"DOWNLOAD_FILE_NAME_FIELD\",\n DOWNLOAD_FILE_TYPE_FIELD = \"DOWNLOAD_FILE_TYPE_FIELD\",\n COPY_TEXT_FIELD = \"COPY_TEXT_FIELD\",\n NAVIGATION_TARGET_FIELD = \"NAVIGATION_TARGET_FIELD\",\n WIDGET_NAME_FIELD = \"WIDGET_NAME_FIELD\",\n RESET_CHILDREN_FIELD = \"RESET_CHILDREN_FIELD\",\n ARGUMENT_KEY_VALUE_FIELD = \"ARGUMENT_KEY_VALUE_FIELD\",\n CALLBACK_FUNCTION_FIELD_SET_INTERVAL = \"CALLBACK_FUNCTION_FIELD_SET_INTERVAL\",\n CALLBACK_FUNCTION_FIELD_GEOLOCATION = \"CALLBACK_FUNCTION_FIELD_GEOLOCATION\",\n DELAY_FIELD = \"DELAY_FIELD\",\n ID_FIELD = \"ID_FIELD\",\n CLEAR_INTERVAL_ID_FIELD = \"CLEAR_INTERVAL_ID_FIELD\",\n MESSAGE_FIELD = \"MESSAGE_FIELD\",\n TARGET_ORIGIN_FIELD = \"TARGET_ORIGIN_FIELD\",\n SOURCE_FIELD = \"SOURCE_FIELD\",\n PAGE_NAME_AND_URL_TAB_SELECTOR_FIELD = \"PAGE_NAME_AND_URL_TAB_SELECTOR_FIELD\",\n API_AND_QUERY_SUCCESS_FAILURE_TAB_FIELD = \"API_AND_QUERY_SUCCESS_FAILURE_TAB_FIELD\",\n CALLBACK_FUNCTION_API_AND_QUERY = \"CALLBACK_FUNCTION_API_AND_QUERY\",\n ADD_ACTION = \"ADD_ACTION\",\n}\n\nexport const Variants = {\n mainBlock: \"mainBlock\",\n callbackBlock: \"callbackBlock\",\n hoverBorder: \"hoverBorder\",\n};\n","// Leaving this require here. The path-to-regexp module has a commonJS version and an ESM one.\n// We are loading the correct one with the typings with our compilerOptions property \"moduleResolution\" set to \"node\". Ref: https://stackoverflow.com/questions/59013618/unable-to-find-module-path-to-regexp\n// All solutions from closed issues on their repo have been tried. Ref: https://github.com/pillarjs/path-to-regexp/issues/193\n\nimport { matchPath } from \"react-router\";\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { match } = require(\"path-to-regexp\");\n\n// Regex to extract the id from the URL path which supports both the formats:\n// 1. With Mongo ObjectIds\n// 2. With UUID\nconst MONGO_OBJECT_ID_REGEX = \"[0-9a-f]{24}\";\nconst UUID_REGEX =\n \"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\";\n\nexport const ID_EXTRACTION_REGEX = `(${MONGO_OBJECT_ID_REGEX}|${UUID_REGEX})`;\n\nexport const BUILDER_BASE_PATH_DEPRECATED = \"/applications\";\nexport const BUILDER_VIEWER_PATH_PREFIX = \"/app/\";\nexport const BUILDER_PATH = `${BUILDER_VIEWER_PATH_PREFIX}:applicationSlug/:pageSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}/edit`;\nexport const BUILDER_CUSTOM_PATH = `${BUILDER_VIEWER_PATH_PREFIX}:customSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}/edit`;\nexport const VIEWER_PATH = `${BUILDER_VIEWER_PATH_PREFIX}:applicationSlug/:pageSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}`;\nexport const VIEWER_CUSTOM_PATH = `${BUILDER_VIEWER_PATH_PREFIX}:customSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}`;\nexport const getViewerPath = (\n applicationSlug: string,\n pageSlug: string,\n basePageId: string,\n) =>\n `${BUILDER_VIEWER_PATH_PREFIX}${applicationSlug}/${pageSlug}-${basePageId}`;\nexport const getViewerCustomPath = (customSlug: string, basePageId: string) =>\n `${BUILDER_VIEWER_PATH_PREFIX}${customSlug}-${basePageId}`;\nexport const BUILDER_PATH_DEPRECATED = `/applications/:baseApplicationId${ID_EXTRACTION_REGEX}/pages/:basePageId${ID_EXTRACTION_REGEX}/edit`;\nexport const VIEWER_PATH_DEPRECATED = `/applications/:baseApplicationId${ID_EXTRACTION_REGEX}/pages/:basePageId${ID_EXTRACTION_REGEX}`;\nexport const VIEWER_PATH_DEPRECATED_REGEX =\n /\\/applications\\/[^/]+\\/pages\\/[^/]+/;\n\nexport const VIEWER_FORK_PATH = `/fork`;\nexport const INTEGRATION_EDITOR_PATH = `/datasources/:selectedTab`;\n\nexport const WIDGETS_EDITOR_BASE_PATH = `/widgets`;\nexport const WIDGETS_EDITOR_ID_PATH = `${WIDGETS_EDITOR_BASE_PATH}/:widgetIds`;\n\n/*\n * CUSTOM WIDGET BUILDER PATHS\n */\nexport const CUSTOM_WIDGETS_EDITOR_ID_PATH = `${BUILDER_PATH}${WIDGETS_EDITOR_ID_PATH}/builder`;\nexport const CUSTOM_WIDGETS_EDITOR_ID_PATH_CUSTOM = `${BUILDER_CUSTOM_PATH}${WIDGETS_EDITOR_ID_PATH}/builder`;\nexport const CUSTOM_WIDGETS_DEPRECATED_EDITOR_ID_PATH = `${BUILDER_PATH_DEPRECATED}${WIDGETS_EDITOR_ID_PATH}/builder`;\n/* */\n\nexport const API_EDITOR_BASE_PATH = `/api`;\nexport const API_EDITOR_ID_PATH = `${API_EDITOR_BASE_PATH}/:baseApiId`;\nexport const API_EDITOR_ID_ADD_PATH = `${API_EDITOR_BASE_PATH}/:baseApiId/add`;\nexport const API_EDITOR_PATH_WITH_SELECTED_PAGE_ID = `${API_EDITOR_BASE_PATH}?importTo=:importTo`;\nexport const QUERIES_EDITOR_BASE_PATH = `/queries`;\nexport const ADD_PATH = `/add`;\nexport const LIST_PATH = \"/list\";\n\nexport const ENTITY_PATH = \"/:entity\";\nexport const QUERIES_EDITOR_ID_PATH = `${QUERIES_EDITOR_BASE_PATH}/:baseQueryId`;\nexport const QUERIES_EDITOR_ADD_PATH = `${QUERIES_EDITOR_BASE_PATH}${ADD_PATH}`;\nexport const QUERIES_EDITOR_ID_ADD_PATH = `${QUERIES_EDITOR_BASE_PATH}/:baseQueryId/add`;\nexport const JS_COLLECTION_EDITOR_PATH = `/jsObjects`;\nexport const JS_COLLECTION_ID_PATH = `${JS_COLLECTION_EDITOR_PATH}/:baseCollectionId`;\nexport const JS_COLLECTION_ID_ADD_PATH = `${JS_COLLECTION_EDITOR_PATH}/:baseCollectionId/add`;\nexport const DATA_SOURCES_EDITOR_LIST_PATH = `/datasource`;\nexport const DATA_SOURCES_EDITOR_ID_PATH = `/datasource/:datasourceId`;\nexport const APP_LIBRARIES_EDITOR_PATH = `/libraries`;\nexport const APP_PACKAGES_EDITOR_PATH = `/packages`;\nexport const APP_SETTINGS_EDITOR_PATH = `/settings`;\nexport const SAAS_GSHEET_EDITOR_ID_PATH = `/saas/google-sheets-plugin/datasources/:datasourceId`;\nexport const BUILDER_CHECKLIST_PATH = `/checklist`;\nexport const ADMIN_SETTINGS_PATH = \"/settings\";\nexport const ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH = \"/settings/general\";\nexport const ADMIN_SETTINGS_CATEGORY_ACL_PATH = \"/settings/groups\";\nexport const ADMIN_SETTINGS_CATEGORY_AUDIT_LOGS_PATH = \"/settings/audit-logs\";\nexport const ADMIN_SETTINGS_CATEGORY_PATH = \"/settings/:category/:selected?\";\nexport const BUILDER_PATCH_PATH = `/:applicationSlug/:pageSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}/edit`;\nexport const VIEWER_PATCH_PATH = `/:applicationSlug/:pageSlug(.*\\-):basePageId${ID_EXTRACTION_REGEX}`;\n\nexport const matchApiBasePath = match(API_EDITOR_BASE_PATH);\nexport const matchApiPath = match(API_EDITOR_ID_PATH);\nexport const matchDatasourcePath = (pathname: string) =>\n matchPath(pathname, {\n path: [`${BUILDER_PATH}${DATA_SOURCES_EDITOR_ID_PATH}`],\n strict: false,\n exact: false,\n });\n\nexport const matchSAASGsheetsPath = (pathname: string) =>\n matchPath(pathname, {\n path: [`${BUILDER_PATH}${SAAS_GSHEET_EDITOR_ID_PATH}`],\n strict: false,\n exact: false,\n });\nexport const matchQueryBasePath = match(QUERIES_EDITOR_BASE_PATH);\nexport const matchQueryPath = match(QUERIES_EDITOR_ID_PATH);\nexport const matchQueryBuilderPath = match(\n BUILDER_PATH + QUERIES_EDITOR_ID_PATH,\n);\nexport const matchBuilderPath = (\n pathName: string,\n options?: { end?: boolean },\n) =>\n match(BUILDER_PATH, options)(pathName) ||\n match(BUILDER_PATH_DEPRECATED, options)(pathName) ||\n match(BUILDER_CUSTOM_PATH, options)(pathName) ||\n match(BUILDER_PATH + WIDGETS_EDITOR_ID_PATH, options)(pathName) ||\n match(BUILDER_CUSTOM_PATH + WIDGETS_EDITOR_ID_PATH, options)(pathName) ||\n match(BUILDER_PATH_DEPRECATED + WIDGETS_EDITOR_ID_PATH, options)(pathName) ||\n match(BUILDER_PATH + WIDGETS_EDITOR_ID_PATH + ADD_PATH, options)(pathName);\n\nexport const matchJSObjectPath = match(JS_COLLECTION_ID_PATH);\nexport const matchViewerPath = (pathName: string) =>\n match(VIEWER_PATH)(pathName) ||\n match(VIEWER_PATH_DEPRECATED)(pathName) ||\n match(VIEWER_CUSTOM_PATH)(pathName);\nexport const matchViewerForkPath = (pathName: string) =>\n match(`${VIEWER_PATH}${VIEWER_FORK_PATH}`)(pathName) ||\n match(`${VIEWER_CUSTOM_PATH}${VIEWER_FORK_PATH}`)(pathName) ||\n match(`${VIEWER_PATH_DEPRECATED}${VIEWER_FORK_PATH}`)(pathName);\n\nexport const matchAppLibrariesPath = (pathName: string) =>\n match(`${BUILDER_PATH}${APP_LIBRARIES_EDITOR_PATH}`)(pathName);\n\nexport const matchAppPackagesPath = (pathName: string) =>\n match(`${BUILDER_PATH}${APP_PACKAGES_EDITOR_PATH}`)(pathName);\n\nexport const addBranchParam = (branch: string) => {\n const url = new URL(window.location.href);\n\n url.searchParams.set(GIT_BRANCH_QUERY_KEY, encodeURIComponent(branch));\n\n return url.toString().slice(url.origin.length);\n};\n\nexport interface BuilderRouteParams {\n basePageId: string;\n baseApplicationId: string;\n}\n\nexport interface AppViewerRouteParams {\n basePageId: string;\n baseApplicationId?: string;\n}\n\nexport interface APIEditorRouteParams {\n basePageId: string;\n baseApiId?: string;\n}\n\nexport interface QueryEditorRouteParams {\n basePageId: string;\n baseQueryId?: string;\n baseApiId?: string;\n}\n\nexport interface JSEditorRouteParams {\n basePageId: string;\n baseCollectionId?: string;\n}\n\nexport const GIT_BRANCH_QUERY_KEY = \"branch\";\n\nexport const INTEGRATION_TABS = {\n ACTIVE: \"ACTIVE\",\n NEW: \"NEW\",\n};\n\nexport const INTEGRATION_EDITOR_MODES = {\n AUTO: \"auto\",\n MOCK: \"mock\",\n};\n\nexport const PLACEHOLDER_APP_SLUG = \"application\";\nexport const PLACEHOLDER_PAGE_ID = \"basePageId\";\nexport const PLACEHOLDER_PAGE_SLUG = \"page\";\n\nexport const SHOW_FILE_PICKER_KEY = \"showPicker\";\nexport const RESPONSE_STATUS = \"response_status\";\n\nexport const basePathForActiveAction = [BUILDER_PATH, BUILDER_PATH_DEPRECATED];\n","export const ECMA_VERSION = 11;\n\n/* Indicates the mode the code should be parsed in. \nThis influences global strict mode and parsing of import and export declarations.\n*/\nexport enum SourceType {\n script = \"script\",\n module = \"module\",\n}\n\n// Each node has an attached type property which further defines\n// what all properties can the node have.\n// We will just define the ones we are working with\nexport enum NodeTypes {\n Identifier = \"Identifier\",\n AssignmentPattern = \"AssignmentPattern\",\n Literal = \"Literal\",\n Property = \"Property\",\n RestElement = \"RestElement\",\n ObjectPattern = \"ObjectPattern\",\n ArrayPattern = \"ArrayPattern\",\n // Declaration - https://github.com/estree/estree/blob/master/es5.md#declarations\n FunctionDeclaration = \"FunctionDeclaration\",\n ExportDefaultDeclaration = \"ExportDefaultDeclaration\",\n VariableDeclarator = \"VariableDeclarator\",\n // Expression - https://github.com/estree/estree/blob/master/es5.md#expressions\n MemberExpression = \"MemberExpression\",\n FunctionExpression = \"FunctionExpression\",\n ArrowFunctionExpression = \"ArrowFunctionExpression\",\n AssignmentExpression = \"AssignmentExpression\",\n ObjectExpression = \"ObjectExpression\",\n ArrayExpression = \"ArrayExpression\",\n ThisExpression = \"ThisExpression\",\n CallExpression = \"CallExpression\",\n BinaryExpression = \"BinaryExpression\",\n ExpressionStatement = \"ExpressionStatement\",\n BlockStatement = \"BlockStatement\",\n ConditionalExpression = \"ConditionalExpression\",\n AwaitExpression = \"AwaitExpression\",\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [9222,5477,9922,3172,2327,976], () => (__webpack_require__(76209)))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","__webpack_require__.amdO = {};","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"static/js/\" + ({\"248\":\"auto-track\",\"521\":\"remoteMiddleware\",\"3104\":\"schemaFilter\",\"5021\":\"blueprint-icons\",\"5050\":\"ajs-destination\",\"6999\":\"remix-icons\",\"7538\":\"queryString\",\"9010\":\"tsub-middleware\",\"9222\":\"svg-icons\",\"9694\":\"legacyVideos\"}[chunkId] || chunkId) + \".\" + {\"248\":\"f008a257\",\"521\":\"0e5b22a7\",\"976\":\"bbc6732f\",\"2327\":\"a2e54e7a\",\"3104\":\"1b02f095\",\"3172\":\"a6b6ed24\",\"3646\":\"038bfa00\",\"4831\":\"89c721f8\",\"4996\":\"e58b4ba4\",\"5021\":\"9cef11d0\",\"5050\":\"c80d51a1\",\"5477\":\"d91710cb\",\"6999\":\"cf894592\",\"7538\":\"1b09bb08\",\"8081\":\"8867453f\",\"8627\":\"3466c660\",\"9010\":\"03b316e9\",\"9222\":\"bf84475d\",\"9694\":\"dd96c20e\",\"9922\":\"b2cf3dde\"}[chunkId] + \".chunk.js\";\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","__webpack_require__.j = 8332;","__webpack_require__.p = \"/\";","(() => {\n if (typeof __webpack_require__ !== 'undefined') {\n var oldGetScript = __webpack_require__.u;\n var oldLoadScript = __webpack_require__.e;\n var queryMap = {};\n var countMap = {};\n var getRetryDelay = function () {\n return 3000;\n };\n __webpack_require__.u = function (chunkId) {\n var result = oldGetScript(chunkId);\n return (\n result +\n (queryMap.hasOwnProperty(chunkId) ? '?' + queryMap[chunkId] : '')\n );\n };\n __webpack_require__.e = function (chunkId) {\n var result = oldLoadScript(chunkId);\n return result.catch(function (error) {\n var retries = countMap.hasOwnProperty(chunkId) ? countMap[chunkId] : 2;\n if (retries < 1) {\n var realSrc = oldGetScript(chunkId);\n error.message =\n 'Loading chunk ' +\n chunkId +\n ' failed after 2 retries.\\n(' +\n realSrc +\n ')';\n error.request = realSrc;\n window.location.href = '/404.html';\n throw error;\n }\n return new Promise(function (resolve) {\n var retryAttempt = 2 - retries + 1;\n setTimeout(function () {\n var retryAttemptString = '&retry-attempt=' + retryAttempt;\n var cacheBust = 'cache-bust=true' + retryAttemptString;\n queryMap[chunkId] = cacheBust;\n countMap[chunkId] = retries - 1;\n resolve(__webpack_require__.e(chunkId));\n }, getRetryDelay(retryAttempt));\n });\n });\n };\n }\n})();\n","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t8332: 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunkappsmith\"] = self[\"webpackChunkappsmith\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","__webpack_require__.nc = undefined;","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn Promise.all([9222,5477,9922,3172,2327,976].map(__webpack_require__.e, __webpack_require__)).then(next);\n};","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n"],"names":["beginsWithLineBreakRegex","sanitizeScript","js","evaluationVersion","trimmedJS","replace","unescapeJS","getStringValue","inputValue","JSON","stringify","getEntityForEvalContextMap","ENTITY_TYPE","JSACTION","entityName","entity","getJSActionForEvalContext","getEntityForEvalContext","getterMethod","getDataTreeContext","args","configTree","dataTree","isTriggerBased","removeEntityFunctions","EVAL_CONTEXT","dataTreeEntries","Object","entries","entityFunctionCollection","setters","clear","entityFn","getEntityFunctions","qualifier","func","fn","fullPath","path","name","set","entityConfig","entityMethodMap","getEntitySettersFromConfig","_isEmpty","assign","removeEntityFunctionsFromEvalContext","addEntityFunctionsToEvalContext","evalContext","funcObj","getAllAsyncFunctions","allAsyncFunctions","setterMethods","entitiesSetterFunctions","methodName","keys","getAllSetterFunctions","platformFn","getPlatformFunctions","klona","forEach","defaultLibraries","accessor","version","lodashPackageJson","docsURL","momentPackageJson","JSLibraries","libraryReservedIdentifiers","JSLibraryAccessorModifier","jsLibraryAccessorSet","Set","flatMap","lib","reduce","acc","a","isDynamicValue","value","DATA_BIND_REGEX","test","getDynamicStringSegments","dynamicString","stringSegments","indexOfDoubleParanStart","indexOf","firstString","substring","push","rest","length","sum","i","char","prevChar","concat","getDynamicBindings","_isString","jsSnippets","sanitisedString","trim","isJSAction","map","segment","EvalErrorTypes","getEntityDynamicBindingPathList","dynamicBindingPathList","Array","isArray","isPathDynamicTrigger","widget","dynamicTriggerPathList","undefined","_find","key","EVALUATION_PATH","EVAL_ERROR_PATH","EVAL_VALUE_PATH","getNestedEvalPath","fullPropertyPath","pathType","arguments","isPopulated","propertyPath","getEntityNameAndPropertyPath","nestedPath","getEvalValuePath","options","PropertyEvaluationErrorType","PropertyEvaluationErrorCategory","VALIDATION","PARSE","LINT","WorkerEnv","setFeatureFlags","featureFlags","flags","setCloudHosting","cloudHosting","getFeatureFlags","getCloudHosting","JAVASCRIPT_KEYWORDS","DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS","EvaluationScriptType","ScriptTemplate","EvaluationScripts","EXPRESSION","ANONYMOUS_FUNCTION","ASYNC_ANONYMOUS_FUNCTION","TRIGGERS","OBJECT_PROPERTY","self","overrideEvalContext","overrideContext","entitiesClonedSoFar","has","add","_ref","_set","createEvaluationContext","context","evalArguments","ARGUMENTS","THIS_CONTEXT","thisContext","globalContext","dataTreeContext","getUserScriptToEvaluate","userScript","unescapedJS","script","scriptType","evalArgumentsExist","getScriptType","getScriptToEval","type","buffer","split","setEvalContext","_ref2","isDataField","evaluateSync","isJSCollection","evalContextCache","errors","result","triggers","indirectEval","Promise","FoundPromiseInSyncEvalError","error","errorCategory","errorMessage","rootcause","errorModifier","run","source","ActionInDataFieldErrorModifier","TypeErrorModifier","severity","Severity","ERROR","raw","errorType","originalBinding","kind","category","shouldAddSetter","setter","isDisabledExpression","disabled","Function","isDisabledFn","Types","getType","STRING","_isNumber","NUMBER","_isBoolean","BOOLEAN","ARRAY","_isFunction","FUNCTION","_isObject","OBJECT","_isUndefined","UNDEFINED","_isNull","NULL","UNKNOWN","isIdentifierNode","node","NodeTypes","Identifier","isLiteralNode","Literal","wrapCode","code","getAST","parse","ecmaVersion","ECMA_VERSION","isTypeOfFunction","ArrowFunctionExpression","FunctionExpression","getMemberExpressionObjectFromProperty","propertyName","memberExpressionObjects","ast","end","start","sanitizedScript","wrappedCode","locations","simple","MemberExpression","object","property","propName","isNil","memberExpressionObjectString","generate","from","e","updateEvalTreeValueFromContext","paths","currentEvalContext","dataTreeEvaluator","evalTree","getEvalTree","fullPathArray","jsObjectName","variableName","_get","JSObjectCollection","setVariableValue","evalProps","constructor","setterMethodLookup","setterAccessorMap","applySetterMethod","setterMethodName","getConfigTree","updatedProperties","overriddenProperties","evalMetaUpdates","parsedValue","Error","validationPaths","validationConfig","config","params","strict","isValid","messages","parsed","validate","message","isWidget","overrideWidgetProperties","currentTree","isNewWidget","shouldUpdateGlobalContext","propPath","resolve","then","res","evalTreeWithChanges","data","updatedValuePaths","metaUpdates","method","EVAL_WORKER_SYNC_ACTION","EVAL_TREE_WITH_CHANGES","webworkerTelemetry","createSetter","this","getFnWithGuards","async","isAsyncGuard","getMap","getSetterAccessorMap","setterMethodMap","__setters","pathToSet","init","configTreeEntries","isJSFunctionProperty","t","ACTION","WIDGET","APPSMITH","CE_ENTITY_TYPE","MODULE_INPUT","MODULE_INSTANCE","platformFns","entityFns","navigateTo","showAlert","showModal","closeModal","download","postWindowMessage","copyToClipboard","resetWidget","storeValue","removeValue","clearStore","isRunNClearFnQualifierEntity","actionEntity","bind","isAppsmithEntity","getGeoLocation","watchGeoLocation","stopWatchGeoLocation","IMMEDIATE_PARENT_REGEX","convertPathToString","arrPath","string","val","Number","isInteger","indexOfFirstDot","isAction","serialiseToBigInt","_","v","toString","addErrorToEntityProperty","isPrivateEntityPath","getAllPrivateWidgetsInDataTree","logBlackList","errorPath","existingErrors","resetValidationErrorsForEntityProperty","_ref3","existingErrorsExceptValidation","filter","isTrueObject","item","prototype","call","addWidgetPropertyDependencies","_ref4","widgetConfig","widgetName","dependencies","propertyOverrideDependency","_ref5","overriddenPropertyKey","overridingPropertyKeyMap","existingDependenciesSet","META","DEFAULT","privateWidgets","safeTree","configEntity","overridingPropertyPaths","clonedValue","pathsNotToOverride","widgetPathsNotToOverride","overriddenPropertyPath","overriddenPropertyPathArray","includes","metaPropertyPath","slice","widgetId","propertyOverridingKeyMap","defaultValue","clonedDefaultValue","overwriteParsedValue","newValue","isATriggerPath","overriddenPropertyPaths","isMetaPropDirty","overriddenMetaPaths","hasOwnProperty","TernWorkerAction","AutocompleteDataType","GLOBAL_DEFS","$__dropdownOption__$","label","$__dropdrowOptionWithChildren__$","children","$__chartDataPoint__$","x","y","$__file__$","dataFormat","$__mapMarker__$","lat","long","title","description","GLOBAL_FUNCTIONS","setInterval","clearInterval","server","nextId","pending","getFile","file","c","postMessage","GET_FILE","id","onmessage","INIT","plugins","scripts","importScripts","apply","tern","defs","ecma","browser","lodash","base64","moment","forge","startServer","ADD_FILE","addFile","text","DELETE_FILE","delFile","REQUEST","request","body","err","reqData","String","DELETE_DEF","deleteDefs","ADD_DEF","addDefs","console","log","DEBUG","APPSMITH_GLOBAL_FUNCTIONS","APPSMITH_NAMESPACED_FUNCTIONS","EE_APPSMITH_NAMESPACED_FUNCTIONS","values","match","require","ID_EXTRACTION_REGEX","BUILDER_VIEWER_PATH_PREFIX","BUILDER_PATH","API_EDITOR_BASE_PATH","API_EDITOR_ID_PATH","QUERIES_EDITOR_BASE_PATH","QUERIES_EDITOR_ID_PATH","JS_COLLECTION_EDITOR_PATH","JS_COLLECTION_ID_PATH","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","loaded","__webpack_modules__","m","__webpack_exports__","O","amdO","deferred","chunkIds","priority","notFulfilled","Infinity","fulfilled","j","every","splice","r","n","getter","__esModule","d","leafPrototypes","getProto","getPrototypeOf","obj","mode","ns","create","def","current","getOwnPropertyNames","definition","o","defineProperty","enumerable","get","f","chunkId","all","promises","u","miniCssF","g","globalThis","window","prop","Symbol","toStringTag","nmd","p","oldGetScript","oldLoadScript","queryMap","countMap","catch","retries","realSrc","location","href","retryAttempt","setTimeout","cacheBust","installedChunks","chunkLoadingGlobal","parentChunkLoadingFunction","moreModules","runtime","pop","nc","next"],"sourceRoot":""}