src/deploy/helpers/delta.js
function stringify(arc) {
  let fmtTbl = obj=> {
    let name = Object.keys(obj)[0]
    let keys = Object.keys(obj[name])
    let result = `${name}\n`
    keys.forEach(key=> {
      let val = obj[name][key]
      result += `  ${key} ${val}\n`
    })
    return result
  }
  let str = `@app\n${arc.app[0]}\n`
  /////////////////////////////////
  if (arc.http.length > 0)
    str += `\n@http\n` + arc.http.map(tuple=> tuple.join(' ') + '\n').join('')

  if (arc.events.length > 0)
    str += `\n@events\n` + arc.events.join('\n') + '\n'

  if (arc.queues.length > 0)
    str += `\n@queues\n` + arc.queues.join('\n') + '\n'

  if (arc.scheduled.length > 0)
    str += `\n@scheduled\n` + arc.scheduled.map(v=> v.join(' ')).join('\n') + '\n'

  if (arc.tables.length > 0)
    str += `\n@tables\n` + arc.tables.map(fmtTbl).join('\n')

  if (arc.aws.length > 0)
    str += `\n@aws\n` + arc.aws.map(tuple=> tuple.join(' ') + '\n').join('')
  //////////
  return str
}
function stringify(arc) {
  let fmtTbl = obj=> {
    let name = Object.keys(obj)[0]
    let keys = Object.keys(obj[name])
    let result = `${name}\n`
    keys.forEach(key=> {
      let val = obj[name][key]
      result += `  ${key} ${val}\n`
    })
    return result
  }
  let str = `@app\n${arc.app[0]}\n`
  /////////////////////////////////
  if (arc.http.length > 0)
    str += `\n@http\n` + arc.http.map(tuple=> tuple.join(' ') + '\n').join('')

  if (arc.events.length > 0)
    str += `\n@events\n` + arc.events.join('\n') + '\n'

  if (arc.queues.length > 0)
    str += `\n@queues\n` + arc.queues.join('\n') + '\n'

  if (arc.scheduled.length > 0)
    str += `\n@scheduled\n` + arc.scheduled.map(v=> v.join(' ')).join('\n') + '\n'

  if (arc.tables.length > 0)
    str += `\n@tables\n` + arc.tables.map(fmtTbl).join('\n')

  if (arc.aws.length > 0)
    str += `\n@aws\n` + arc.aws.map(tuple=> tuple.join(' ') + '\n').join('')
  //////////
  return str
}
function stringify ( arc ) { let fmtTbl = obj => { let name = Object . keys ( obj ) [ 0 ] let keys = Object . keys ( obj [ name ] ) let result = ` ${ name } \n ` keys . forEach ( key => { let val = obj [ name ] [ key ] result += ` ${ key } ${ val } \n ` } ) return result } let str = ` \n ${ arc . app [ 0 ] } \n ` ///////////////////////////////// if ( arc . http . length > 0 ) str += ` \n \n ` + arc . http . map ( tuple => tuple . join ( ' ' ) + '\n' ) . join ( '' ) if ( arc . events . length > 0 ) str += ` \n \n ` + arc . events . join ( '\n' ) + '\n' if ( arc . queues . length > 0 ) str += ` \n \n ` + arc . queues . join ( '\n' ) + '\n' if ( arc . scheduled . length > 0 ) str += ` \n \n ` + arc . scheduled . map ( v => v . join ( ' ' ) ) . join ( '\n' ) + '\n' if ( arc . tables . length > 0 ) str += ` \n \n ` + arc . tables . map ( fmtTbl ) . join ( '\n' ) if ( arc . aws . length > 0 ) str += ` \n \n ` + arc . aws . map ( tuple => tuple . join ( ' ' ) + '\n' ) . join ( '' ) ////////// return str }
create a .arc string from arc object
create a . arc string from arc object