core/server/data/importer/index.js
function (file, importOptions = {}) {
        var self = this;

        // Step 1: Handle converting the file to usable data
        return this.loadFile(file).then(function (importData) {
            // Step 2: Let the importers pre-process the data
            return self.preProcess(importData);
        }).then(function (importData) {
            // Step 3: Actually do the import
            // @TODO: It would be cool to have some sort of dry run flag here
            return self.doImport(importData, importOptions);
        }).then(function (importData) {
            // Step 4: Report on the import
            return self.generateReport(importData);
        }).finally(() => self.cleanUp()); // Step 5: Cleanup any files
    }
function (file, importOptions = {}) {
        var self = this;

        // Step 1: Handle converting the file to usable data
        return this.loadFile(file).then(function (importData) {
            // Step 2: Let the importers pre-process the data
            return self.preProcess(importData);
        }).then(function (importData) {
            // Step 3: Actually do the import
            // @TODO: It would be cool to have some sort of dry run flag here
            return self.doImport(importData, importOptions);
        }).then(function (importData) {
            // Step 4: Report on the import
            return self.generateReport(importData);
        }).finally(() => self.cleanUp()); // Step 5: Cleanup any files
    }
function ( file , importOptions = { } ) { var self = this ; // Step 1: Handle converting the file to usable data return this . loadFile ( file ) . then ( function ( importData ) { // Step 2: Let the importers pre-process the data return self . preProcess ( importData ) ; } ) . then ( function ( importData ) { // Step 3: Actually do the import // @TODO: It would be cool to have some sort of dry run flag here return self . doImport ( importData , importOptions ) ; } ) . then ( function ( importData ) { // Step 4: Report on the import return self . generateReport ( importData ) ; } ) . finally ( ( ) => self . cleanUp ( ) ) ; // Step 5: Cleanup any files }
Import From File
The main method of the ImportManager, call this to kick everything off!
@param {File} file
@param {importOptions} importOptions to allow override of certain import features such as locking a user
@returns {Promise}
Import From File The main method of the ImportManager call this to kick everything off!