How to use the infusion.transform 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 / UntrustedPSPIntegrationTests.js View on Github external
var sequenceAtEnd = fluid.copy(gpii.test.untrusted.pspIntegration.endSequence);
    fluid.set(sequenceAtEnd[1], ["args"], ["{that}", "{arguments}.0", i]);
    gpii.test.push(testDef.sequence, sequenceAtEnd);

    return testDef;
});

// Test PSP integration with:
// 1. auto-save only saves preferences that are allowed to be autosaved to the cloud.
gpii.test.runCouchTestDefs(gpii.tests.untrusted.pspIntegration.testDefs);

// Test PSP integration with:
// 1. preferences that are not allowed to be autosaved should not be autosaved to the cloud;
// 2. explicit save, such as when the save button is clicked, saves all updated preferences to the cloud.
gpii.test.runCouchTestDefs(fluid.transform(gpii.tests.pspIntegration.saveTestDefs, function (testDefIn) {
    return gpii.tests.untrusted.pspIntegration.addConfig(testDefIn);
}));
github GPII / universal / gpii / node_modules / flowManager / src / FlowManager.js View on Github external
matchMakingPromise.then(function (payload) {
            var activePrefsSetName = payload.activePrefsSetName || "gpii-default";
            // convert the matchmaker output to lifecycle instructions
            var defaultLifecycleInstructions = gpii.transformer.configurationToSettings(payload.matchMakerOutput.inferredConfiguration[activePrefsSetName], payload.solutionsRegistryEntries);
            // convert lifecycle instructions to snapshots
            var defaultSnapshot = fluid.transform(defaultLifecycleInstructions, function (handlerResponse) {
                return gpii.settingsHandlers.settingsPayloadToChanges(handlerResponse);
            });
            promiseTogo.resolve({
                defaultSettings: defaultSettings,
                defaultLifecycleInstructions: defaultLifecycleInstructions,
                defaultSnapshot: defaultSnapshot
            });
            defaultSettingsDataCreatedEvent.fire();
        });
    } else {
github GPII / universal / tests / SolutionsRegistryTests.js View on Github external
jqUnit.test("Validating preferences test data.", function () {
        var settingsIndex = gpii.tests.universal.solutionsRegistry.indexAllSettings(that);

        var resolvedPath = fluid.module.resolvePath(that.options.settingsDataPath);
        var pathFiles = fs.readdirSync(resolvedPath);
        var jsonFiles = pathFiles.filter(function (singlePath) { return singlePath.match(/.json5?$/i); });
        var pathedJsonFiles = fluid.transform(jsonFiles, function (jsonFile) {
            return path.resolve(resolvedPath, jsonFile);
        });
        fluid.each(pathedJsonFiles, function (settingsFilePath) {
            gpii.tests.universal.solutionsRegistry.validateSettingsFile(that, settingsFilePath, settingsIndex);
        });
    });
};
github GPII / universal / tests / AcceptanceTests.js View on Github external
return fluid.transform(togo, function (settingHandler) {
        return fluid.transform(settingHandler, function (solutionBlocks) {
            return fluid.transform(solutionBlocks, function (solutionBlock) {
                return {settings: solutionBlock.settings};
            });
        });
    });
};
github GPII / universal / tests / AcceptanceTests.js View on Github external
gpii.acceptanceTesting.removeOptionsBlocks = function (payload) {
    var togo = fluid.copy(payload);
    return fluid.transform(togo, function (settingHandler) {
        return fluid.transform(settingHandler, function (solutionBlocks) {
            return fluid.transform(solutionBlocks, function (solutionBlock) {
                return {settings: solutionBlock.settings};
            });
        });
    });
};
github GPII / universal / tests / UntrustedUserLogonHandlersTests.js View on Github external
gpii.tests.untrusted.userLogonHandling.buildTestDefs = function (testDefs) {
    return fluid.transform(testDefs, function (testDefIn) {
        var testDef = fluid.extend(true, {}, testDefIn, {
            config: {
                configName: "gpii.tests.acceptance.untrusted.userLogon.config",
                configPath: "%gpii-universal/tests/configs"
            },
            gradeNames: ["gpii.tests.userLogonHandlers.testCaseHolder", "gpii.test.integration.testCaseHolder.linux"],
            gpiiKey: testDefIn.gpiiKey || gpii.tests.userLogonHandlers.gpiiKey
        });

        return testDef;
    });
};
github GPII / universal / gpii / node_modules / flowManager / src / PSPChannel.js View on Github external
gpii.pspChannel.filterSolution = function (solution) {
    return {
        name: solution.name,
        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
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"));
            var activeSolutions = fluid.filterKeys(model.solutionsRegistryEntries, activeSolutionIds);
            var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(activeSolutions, prefsKey);
            gpii.pspChannel.emitSettingControl(settingControls, schemas[prefsKey], prefsVal, [prefsKey], liveness);
        }
    });
    outModel.settingControls = settingControls;
    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 / journal / src / Journal.js View on Github external
gpii.journal.readJournals = function (that) {
    var dir = that.settingsDir.getGpiiSettingsDir();
    var journalFileNames = glob.sync(dir + "/journal-*.json");
    fluid.log("Got journalFileNames ", journalFileNames);
    var journalFiles = fluid.transform(journalFileNames, function (journalFileName) {
        var readPromise = kettle.JSON.readFileSync(journalFileName, "reading journal file " + journalFileName);
        var togo;
        readPromise.then(function (read) {
            togo = read;
        }, function (err) {
            fluid.log(fluid.logLevel.WARN, "Error reading journal file " + journalFileName + ": " + err.message);
            togo = err;
        });
        togo.journalFileName = journalFileName;
        return togo;
    });
    journalFiles.sort(gpii.journal.dateComparator);
    that.journalFiles = journalFiles;
};
github GPII / universal / gpii / node_modules / gpiiFramework / request.js View on Github external
that.registerListeners = function () {
            return fluid.transform(that.options.middleware, function (middlewareObject) {
                return middlewareObject.handle;
            });
        };