How to use the infusion.filterKeys 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 / tests / JournalIntegrationTests.js View on Github external
gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsStore, testCaseHolder) {
    // Like the effect of gpii.test.snapshotSettings
    settingsStore.orig = fluid.transform(settingsHandlersPayload, gpii.settingsHandlers.extractSettingsBlocks);
    // Like the effect of gpii.test.expandSettings with 2 blocks missing
    var settingsHandlers = fluid.copy(testCaseHolder.options.settingsHandlers);
    // We eliminate the last blocks since our initial settings state does not include them, and the blocks
    // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration
    settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing");
    settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier");
    testCaseHolder.settingsHandlers = settingsHandlers;
};
github GPII / universal / gpii / node_modules / flowManager / src / SettingsGetHandler.js View on Github external
gpii.flowManager.cloudBased.matchToSettings = function (finalPayload, event) {
    // Note that we send the filtered preferences to assist a PSP - we may do more filtering here at some point
    var settings = fluid.filterKeys(finalPayload, [
        "gpiiKey", "activeContextName", "preferences",
        "activeConfiguration", "solutionsRegistryEntries", "matchMakerOutput"
    ]);
    settings.preferences = gpii.matchMakerFramework.utils.filterPreferencesFromInferredConfig(settings.preferences, settings.matchMakerOutput.inferredConfiguration);
    fluid.log("cloudBased flowManager: /settings endpoint responding settings ", settings);
    event.fire(settings);
};
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
gpii.pspChannel.sessionToPSP = function (model, transformSpec) {
    var that = transformSpec.pspChannel;
    // populate the default setting controls with schema defaults at the first time
    if (!that.defaultSettingControls) {
        that.defaultSettingControlsPromise.then(function (defaultSettingControls) {
            that.defaultSettingControls = defaultSettingControls;
        });
    }
    var schemas = that.options.settingsSchema;
    var outModel = fluid.filterKeys(model, ["gpiiKey", "activePrefsSetName"]);
    var settingControls = {};
    var activePreferences = fluid.get(model, ["preferences", "contexts", model.activePrefsSetName, "preferences"]);

    var activeSolutionIds, activeSolutions;
    var applications = fluid.get(model, "activeConfiguration.inferredConfiguration.applications");
    if (applications) {
        activeSolutionIds = Object.keys(applications);
        activeSolutions = fluid.filterKeys(model.solutionsRegistryEntries, activeSolutionIds);
    }

    fluid.each(activePreferences, function (prefsVal, prefsKey) {
        var prefsInfo = gpii.pspChannel.getPreferenceInfo(schemas, prefsKey, prefsVal);
        var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(activeSolutions, prefsInfo.presentedCommonTerm);
        gpii.pspChannel.emitSettingControl(settingControls, prefsInfo.schema, prefsInfo.prefsValue, prefsInfo.prefsKeySegs, liveness);
    });
    outModel.settingControls = fluid.extend(true, {}, settingControls, that.defaultSettingControls || {});
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
// populate the default setting controls with schema defaults at the first time
    if (!that.defaultSettingControls) {
        that.defaultSettingControlsPromise.then(function (defaultSettingControls) {
            that.defaultSettingControls = defaultSettingControls;
        });
    }
    var schemas = that.options.settingsSchema;
    var outModel = fluid.filterKeys(model, ["gpiiKey", "activePrefsSetName"]);
    var settingControls = {};
    var activePreferences = fluid.get(model, ["preferences", "contexts", model.activePrefsSetName, "preferences"]);

    var activeSolutionIds, activeSolutions;
    var applications = fluid.get(model, "activeConfiguration.inferredConfiguration.applications");
    if (applications) {
        activeSolutionIds = Object.keys(applications);
        activeSolutions = fluid.filterKeys(model.solutionsRegistryEntries, activeSolutionIds);
    }

    fluid.each(activePreferences, function (prefsVal, prefsKey) {
        var prefsInfo = gpii.pspChannel.getPreferenceInfo(schemas, prefsKey, prefsVal);
        var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(activeSolutions, prefsInfo.presentedCommonTerm);
        gpii.pspChannel.emitSettingControl(settingControls, prefsInfo.schema, prefsInfo.prefsValue, prefsInfo.prefsKeySegs, liveness);
    });
    outModel.settingControls = fluid.extend(true, {}, settingControls, that.defaultSettingControls || {});
    outModel.preferences = {
        name: fluid.get(model, "preferences.name"),
        contexts: fluid.transform(fluid.get(model, "preferences.contexts"), function (contextVal) {
            return fluid.filterKeys(contextVal, ["name"]);
        })
    };
    return outModel;
};
github GPII / universal / gpii / node_modules / testing / src / RunTestDefs.js View on Github external
gpii.test.testDefToEnvironment = function (testDef, environmentType, sequenceGrade) {
    var configurationName = testDef.configType || kettle.config.createDefaults(testDef.config);
    //var caseHolderOptions = fluid.filterKeys(testDef, ["modules", "sequence", "config"], true);
    var caseHolderOptions = fluid.filterKeys(testDef, ["modules", "sequence"], true);
    caseHolderOptions.modules = [{
        name: configurationName + " tests",
        tests: [{
            name: testDef.name,
            expect: testDef.expect,
            sequence: testDef.sequence,
            sequenceGrade: testDef.sequenceGrade || sequenceGrade
        }]
    }];

    return {
        type: environmentType,
        options: {
            configurationName: configurationName,
            components: {
                tests: {
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
contexts: fluid.transform(fluid.get(model, "preferences.contexts"), function (contextVal) {
            return fluid.filterKeys(contextVal, ["name"]);
        })
    };
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
gpii.pspChannel.sessionToPSP = function (model, transformSpec) {
    var schemas = transformSpec.ontologyMetadata.flat.schemas;
    var outModel = fluid.filterKeys(model, ["gpiiKey", "activeContextName"]);
    var settingControls = {};
    var activePreferences = fluid.get(model, ["preferences", "contexts", model.activeContextName, "preferences"]);
    var prefApplicationPrefix = "http://registry.gpii.net/applications/";

    fluid.each(activePreferences, function (prefsVal, prefsKey) {
        if (prefsKey.startsWith(prefApplicationPrefix)) {
            var solKey = prefsKey.substring(prefApplicationPrefix.length);
            var solution = model.solutionsRegistryEntries[solKey];
            if (solution) {
                fluid.each(prefsVal, function (innerPrefsVal, innerPrefsKey) {
                    var liveness = gpii.matchMakerFramework.utils.getLeastLiveness([ solution ], innerPrefsKey);
                    gpii.pspChannel.emitSettingControl(settingControls, schemas[innerPrefsKey], innerPrefsVal, [prefsKey, innerPrefsKey], liveness, solution.name);
                });
            }
        } else {
            var activeSolutionIds = Object.keys(fluid.get(model, "activeConfiguration.inferredConfiguration.applications"));
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
settingsHandlers: fluid.transform(solution.settingsHandlers, function (oneHandler) {
            return fluid.filterKeys(oneHandler, ["supportedSettings"]);
        })
    };
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
settingsHandlers: fluid.transform(solution.settingsHandlers, function (oneHandler) {
            return fluid.filterKeys(oneHandler, ["supportedSettings"]);
        })
    };
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
contexts: fluid.transform(fluid.get(model, "preferences.contexts"), function (contextVal) {
            return fluid.filterKeys(contextVal, ["name"]);
        })
    };