How to use the infusion.find function in infusion

To help you get started, we’ve selected a few infusion 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 GPII / universal / gpii / node_modules / matchMaker / src / MatchMaker.js View on Github external
return fluid.remove_if(fluid.copy(solutions), function (solution) {
            // Match on device solutions.
            var matchesSolutions = fluid.find(device.solutions, function (devSolution) {
                if (devSolution.id === solution.id &&
                    (!solution.version ||
                     !devSolution.version ||
                     semver.satisfies(devSolution.version, solution.version)
                    )) {
                    return true;
                }
            });
            if (!matchesSolutions) {
                return solutions;
            }
        });
    };
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
gpii.pspChannel.modelChangeListener = function (handler, pspChannel, value, oldValue, path, transaction) {
    fluid.log("PSPChannel's PSP-facing modelChangeListener, sources are ", fluid.keys(transaction.sources));
    if (!transaction.sources.PSP && !transaction.sources.SessionCleanup) {
        fluid.log("Model change source is not PSP - candidate for update message");
        if (pspChannel.outputBlocked) {
            // Ensure that we queue just a single outgoing message for when the channel unblocks
            if (!pspChannel.outputBlocked.queued) {
                pspChannel.outputBlocked.queued = true;
                pspChannel.outputBlocked.then(function () {
                    fluid.log("PSPChannel sending unblocked full update message", JSON.stringify(pspChannel.model, null, 2));
                    handler.sendTypedMessage("modelChanged", {path: [], type: "ADD", value: pspChannel.model});
                });
            }
        } else {
            var changes = fluid.modelPairToChanges(value, oldValue);
            var hasDeletion = fluid.find(changes, function (change) {
                return change.type === "DELETE";
            });
            if (hasDeletion) {
                changes.forEach(function (change) {
                    handler.sendTypedMessage("modelChanged", change);
                });
            } else {
                handler.sendTypedMessage("modelChanged", {path: [], type: "ADD", value: value});
            }
        }
    }
};
github GPII / universal / gpii / node_modules / matchMakerFramework / src / MatchMakerFramework.js View on Github external
fluid.each(solutions, function (solution, solutionId) {
        // Match on device solutions.
        var matchesSolutions = fluid.find(device.solutions, function (devSolution) {
            if (devSolution.id === solutionId &&
                (!solution.version ||
                !devSolution.version ||
                semver.satisfies(devSolution.version, solution.version)
                )) {
                return true;
            }
        });
        if (matchesSolutions) {
            filteredSolutions[solutionId] = solution;
        }
    });
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
gpii.pspChannel.modelChangeListener = function (handler, pspChannel, value, oldValue, path, transaction) {
    fluid.log("PSPChannel's PSP-facing modelChangeListener, sources are ", fluid.keys(transaction.sources));
    if (!transaction.sources.PSP && !transaction.sources.SessionCleanup) {
        fluid.log("Model change source is not PSP - candidate for update message");
        if (pspChannel.outputBlocked) {
            // Ensure that we queue just a single outgoing message for when the channel unblocks
            if (!pspChannel.outputBlocked.queued) {
                pspChannel.outputBlocked.queued = true;
                pspChannel.outputBlocked.then(function () {
                    fluid.log("PSPChannel sending unblocked full update message", JSON.stringify(pspChannel.model, null, 2));
                    handler.sendTypedMessage("modelChanged", {path: [], type: "ADD", value: pspChannel.model});
                });
            }
        } else {
            var changes = fluid.modelPairToChanges(value, oldValue);
            var hasDeletion = fluid.find(changes, function (change) {
                return change.type === "DELETE";
            });
            if (hasDeletion) {
                changes.forEach(function (change) {
                    handler.sendTypedMessage("modelChanged", change);
                });
            } else {
                handler.sendTypedMessage("modelChanged", {path: [], type: "ADD", value: value});
            }
        }
    }
};
github GPII / universal / tests / ProductionConfigTests.js View on Github external
gpii.tests.productionConfigTesting.getKeyOrPrefsFromFile = function (filePath, id) {
    var dataArray = JSON.parse(fs.readFileSync(filePath, "utf-8"));
    return fluid.find(dataArray, function (anEntry) {
        if (anEntry._id === id) {
            return anEntry;
        }
    }, null);
};
github GPII / universal / gpii / node_modules / matchMaker / src / MatchMaker.js View on Github external
fluid.remove_if(solutions, function (solution) {
            var solutionOSVersion = fluid.find(fluid.get(solution, "contexts.OS"), function (OSEntry) {
                return OSEntry.id === os ? OSEntry.version : undefined;
            });
            if (!semver.satisfies(version, solutionOSVersion)) {
                return true;
            }
        });
    };
github GPII / universal / scripts / deleteAndLoadSnapsets.js View on Github external
gpii.dataLoader.loadStaticDataFromDisk = function (options) {
    var data = gpii.dataLoader.getDataFromDirectory(options.staticDataDir);
    var views = fluid.find(data, function (anElement) {
        if (anElement._id && anElement._id === "_design/views") {
            return anElement;
        } else {
            return undefined;
        }
    });
    options.staticData = data;
    options.newViews = views;
    fluid.log("Retrieved static data from: '" + options.staticDataDir + "'");
    fluid.log("\tViews data " + ( views ? "read." : "missing." ));
};
github GPII / universal / gpii / node_modules / userListeners / src / pcsc.js View on Github external
gpii.userListeners.pcsc.detectCard = function (atr) {
    if (!atr instanceof Buffer) {
        fluid.fail("atr needs to be a Buffer.");
    }

    var knownCards = gpii.userListeners.pcsc.knownCards;

    var card = fluid.find(knownCards, function (card) {
        return fluid.find(card.atrs, function (atrTest) {
            return atrTest.equals(atr) ? card : undefined;
        });
    });

    return card || null;
};
github GPII / universal / scripts / deleteAndLoadSnapsets.js View on Github external
fluid.each(gpiiKeyRecords.rows, function (gpiiKeyRecord) {
        var gpiiKey = fluid.find(snapSets, function (aSnapSet) {
            if (gpiiKeyRecord.value.prefsSafeId === aSnapSet._id) {
                return gpiiKeyRecord.value;
            }
        }, null);
        if (gpiiKey !== null) {
            gpiiKey._deleted = true;
            gpiiKeysToDelete.push(gpiiKey);
        }
    });
    return gpiiKeysToDelete;
github GPII / universal / gpii / node_modules / deviceReporter / src / DeviceReporter.js View on Github external
fluid.each(entries, function (entry, entryId) {
        if (!installedSolutions.some(function (s) { return s.id === entryId; })) {
            var foundEntryId = fluid.find(entry.isInstalled, function (installedSolutionsReporter) {
                var resolvedName = deviceReporter.nameResolver.resolveName(installedSolutionsReporter.type, "deviceReporter");
                if (fluid.invokeGradedFunction(resolvedName, installedSolutionsReporter)) {
                    return entryId;
                }
            }, null);
            if  (foundEntryId !== null) {
                installedSolutions.push({ "id": foundEntryId });
            }
        }
    });
    return installedSolutions;