function changeGraphQLSchema()

in src/changes.js [44:73]


function changeGraphQLSchema(schema, changes) {
    const changesDirectives = JSON.parse(changes);


    let lines = schema.split('\n');
    let r = ''; 

    let currentType = '';
    for (const linel of lines) {
        let line = linel.trim();
        let parts = line.split(' ');
        
        if (line.startsWith('type ')) {
            currentType = parts[1];
        }

        if (line.startsWith('}')) {
            r += addChanges(changesDirectives, currentType);            
            currentType = '';
        }
        
        line = removeChanges(changesDirectives, currentType, line);
        
        if (line != '*** REMOVE ***') {
            r += line + '\n';
        }
    }

    return r;
}