MCPcopy Index your code
hub / github.com/bugy/script-server / UPDATE_SCRIPT_CONFIG

Function UPDATE_SCRIPT_CONFIG

web-src/src/main-app/store/scriptConfig.js:148–180  ·  view source on GitHub ↗
(state, config)

Source from the content-addressed store, hash-verified

146 },
147
148 UPDATE_SCRIPT_CONFIG(state, config) {
149 state.scriptConfig = config;
150
151 const newParameters = config.parameters;
152 for (const parameter of newParameters) {
153 _preprocessParameter(parameter, state.scriptConfig);
154 }
155
156 if (isEmptyArray(state.parameters)) {
157 state.parameters = newParameters;
158 return;
159 }
160
161 const oldParametersDict = toDict(state.parameters, 'name');
162 const newParametersDict = toDict(newParameters, 'name');
163
164 forEachKeyValue(oldParametersDict, function (name, parameter) {
165 if (name in newParametersDict) {
166 return;
167 }
168
169 removeElement(state.parameters, parameter);
170 });
171
172 forEachKeyValue(newParametersDict, (name, parameter) => {
173 if (name in oldParametersDict) {
174 const index = state.parameters.indexOf(oldParametersDict[name]);
175 Vue.set(state.parameters, index, parameter);
176 } else {
177 state.parameters.push(parameter);
178 }
179 });
180 },
181
182 ADD_PARAMETER(state, parameter) {
183 _preprocessParameter(parameter, state.scriptConfig);

Callers

nothing calls this directly

Calls 7

isEmptyArrayFunction · 0.90
toDictFunction · 0.90
forEachKeyValueFunction · 0.90
removeElementFunction · 0.90
_preprocessParameterFunction · 0.85
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected