How to use the @node-red/registry.get function in @node-red/registry

To help you get started, we’ve selected a few @node-red/registry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / flows / index.js View on Github external
function updateMissingTypes() {
    var subflowInstanceRE = /^subflow:(.+)$/;
    activeFlowConfig.missingTypes = [];

    for (var id in activeFlowConfig.allNodes) {
        if (activeFlowConfig.allNodes.hasOwnProperty(id)) {
            var node = activeFlowConfig.allNodes[id];
            if (node.type !== 'tab' && node.type !== 'subflow') {
                var subflowDetails = subflowInstanceRE.exec(node.type);
                if ( (subflowDetails && !activeFlowConfig.subflows[subflowDetails[1]]) || (!subflowDetails && !typeRegistry.get(node.type)) ) {
                    if (activeFlowConfig.missingTypes.indexOf(node.type) === -1) {
                        activeFlowConfig.missingTypes.push(node.type);
                    }
                }
            }
        }
    }
}
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / flows / util.js View on Github external
config.forEach(function(n) {
            if (n.type !== 'subflow' && n.type !== 'tab') {
                var subflowDetails = subflowInstanceRE.exec(n.type);

                if ( (subflowDetails && !flow.subflows[subflowDetails[1]]) || (!subflowDetails && !typeRegistry.get(n.type)) ) {
                    if (flow.missingTypes.indexOf(n.type) === -1) {
                        flow.missingTypes.push(n.type);
                    }
                }
                var container = null;
                if (flow.flows[n.z]) {
                    container = flow.flows[n.z];
                } else if (flow.subflows[n.z]) {
                    container = flow.subflows[n.z];
                }
                if (n.hasOwnProperty('x') && n.hasOwnProperty('y')) {
                    if (subflowDetails) {
                        var subflowType = subflowDetails[1]
                        n.subflow = subflowType;
                        flow.subflows[subflowType].instances.push(n)
                    }
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / flows / util.js View on Github external
createNode: function(flow,config) {
        var newNode = null;
        var type = config.type;
        try {
            var nodeTypeConstructor = typeRegistry.get(type);
            if (nodeTypeConstructor) {
                var conf = clone(config);
                delete conf.credentials;
                for (var p in conf) {
                    if (conf.hasOwnProperty(p)) {
                        mapEnvVarProperties(conf,p,flow);
                    }
                }
                try {
                    Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true })
                    newNode = new nodeTypeConstructor(conf);
                } catch (err) {
                    Log.log({
                        level: Log.ERROR,
                        id:conf.id,
                        type: type,