services/assistant/v1-workspace-manager.js
function processFileForWorkspace(info, method) {
    var workspaceObject = null;

    switch (method) {
    case 'createWorkspace':
    case 'updateWorkspace':
    case 'createIntent':
    case 'updateIntent':
    case 'createEntity':
    case 'updateEntity':
    case 'updateEntityValue':
    case 'createDialogNode':
    case 'updateDialogNode':
      try {
        workspaceObject = JSON.parse(fs.readFileSync(info.path, 'utf8'));
      } catch (err) {
        workspaceObject = fs.createReadStream(info.path);
      }
    }

    return Promise.resolve(workspaceObject);
  }
function processFileForWorkspace(info, method) {
    var workspaceObject = null;

    switch (method) {
    case 'createWorkspace':
    case 'updateWorkspace':
    case 'createIntent':
    case 'updateIntent':
    case 'createEntity':
    case 'updateEntity':
    case 'updateEntityValue':
    case 'createDialogNode':
    case 'updateDialogNode':
      try {
        workspaceObject = JSON.parse(fs.readFileSync(info.path, 'utf8'));
      } catch (err) {
        workspaceObject = fs.createReadStream(info.path);
      }
    }

    return Promise.resolve(workspaceObject);
  }
function processFileForWorkspace ( info , method ) { var workspaceObject = null ; switch ( method ) { case 'createWorkspace' : case 'updateWorkspace' : case 'createIntent' : case 'updateIntent' : case 'createEntity' : case 'updateEntity' : case 'updateEntityValue' : case 'createDialogNode' : case 'updateDialogNode' : try { workspaceObject = JSON . parse ( fs . readFileSync ( info . path , 'utf8' ) ) ; } catch ( err ) { workspaceObject = fs . createReadStream ( info . path ) ; } } return Promise . resolve ( workspaceObject ) ; }
I know this says workspace, but its actually a json object that works both for workspace, intent and entity
I know this says workspace but its actually a json object that works both for workspace intent and entity