1- import { mapKeys, merge, keys } from "lodash-es";
1+ import { mapKeys, keys } from "lodash-es";
22import type { EnsembleContext, EnsembleInterface } from "../shared/ensemble";
33import type {
44 ApplicationContextDefinition,
@@ -29,22 +29,20 @@ export const createEvaluationContext = ({
2929 context,
3030}: EvaluationContextProps): EnsembleContext => {
3131 const theme = applicationContext.selectedTheme;
32- const appInputs = merge(
33- {},
34- applicationContext.env,
35- applicationContext.secrets,
36- mapKeys(theme?.Tokens ?? {}, (_, key) => key.toLowerCase()),
37- { styles: theme?.Styles },
38- );
32+ const appInputs = {
33+ ...applicationContext.env,
34+ ...applicationContext.secrets,
35+ ...mapKeys(theme?.Tokens ?? {}, (_, key) => key.toLowerCase()),
36+ ...{ styles: theme?.Styles },
37+ } as Partial<ApplicationContextDefinition>;
3938
40- const screenInputs = merge(
41- {},
42- screenContext.inputs,
43- screenContext.widgets
39+ const screenInputs = {
40+ ...screenContext.inputs,
41+ ...(screenContext.widgets
4442 ? Object.fromEntries(widgetStatesToInvokables(screenContext.widgets))
45- : {},
46- screenContext.data,
47- ) ;
43+ : {}) ,
44+ ... screenContext.data,
45+ } ;
4846
4947 const app = {
5048 languages: applicationContext.application?.languages,
@@ -58,11 +56,12 @@ export const createEvaluationContext = ({
5856 const env = applicationContext.env;
5957
6058 // FIXME: this requires ensemble interface to be built outside of this function
61- return merge(
62- {},
63- { app, ensemble, env },
64- appInputs,
65- screenInputs,
66- context,
67- ) as EnsembleContext;
59+ return {
60+ app,
61+ ensemble,
62+ env,
63+ ...appInputs,
64+ ...screenInputs,
65+ ...context,
66+ } as EnsembleContext;
6867};
0 commit comments