@finos/legend-graph
Version:
Legend graph and graph manager
75 lines • 2.8 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { computed, makeObservable, observable } from 'mobx';
import { skipObserved } from './CoreObserverHelper.js';
import { observe_ConnectionPointer } from './DSL_Mapping_ObserverHelper.js';
import { DeploymentOwner, UserList, } from '../../../graph/metamodel/pure/packageableElements/function/Ownership.js';
export const observe_SnowflakeAppDeploymentConfiguration = skipObserved((metamodel) => {
makeObservable(metamodel, {
activationConnection: observable,
});
if (metamodel.activationConnection) {
observe_ConnectionPointer(metamodel.activationConnection);
}
return metamodel;
});
export const observe_DeploymentOwnership = skipObserved((metamodel) => {
makeObservable(metamodel, {
id: observable,
hashCode: computed,
});
return metamodel;
});
export const observe_UserListOwnership = skipObserved((metamodel) => {
makeObservable(metamodel, {
users: observable,
hashCode: computed,
});
return metamodel;
});
export const observe_FunctionActivatorOwnership = (metamodel) => {
if (metamodel instanceof DeploymentOwner) {
return observe_DeploymentOwnership(metamodel);
}
else if (metamodel instanceof UserList) {
return observe_UserListOwnership(metamodel);
}
return metamodel;
};
export const observe_HostedServiceDeploymentConfiguration = skipObserved((metamodel) => {
if (metamodel.host && metamodel.port && metamodel.path) {
makeObservable(metamodel, {
host: observable,
port: observable,
path: observable,
});
}
return metamodel;
});
export const observe_HostedServicePostDeploymentAction = (metamodel, context) => {
makeObservable(metamodel, {
properties: observable,
automated: observable,
});
const extraObservers = context.plugins.flatMap((plugin) => plugin.getExtraFunctionActivatorPostDeploymentPropertiesObservers?.() ?? []);
for (const observer of extraObservers) {
if (metamodel.properties) {
observer(metamodel.properties);
}
}
return metamodel;
};
//# sourceMappingURL=DSL_FunctionActivatorObserverHelper.js.map