ahmader / node-zoho

Zoho API access for NodeJS
21 stars 15 forks source link

Wrong response parsing in generated code #27

Closed pahan35 closed 6 years ago

pahan35 commented 6 years ago

I noticed that method getRecordsById in crm-module.coffee doesn't work correctly cause this code

if response.data?[@name]
  row = _.first(response.data?[@name])
  processed = @processRecord(_.first(row.row))
  response.data = processed

compiled like

if ((_ref = response.data) != null ? _ref.Events : void 0) {
  row = _.first((_ref1 = response.data) != null ? _ref1.Events : void 0);
  processed = _this.processRecord(_.first(row.row));
  response.data = processed;
}

and not overrides in each child component to correct module name like Contacts etc

if ((_ref = response.data) != null ? _ref.Contacts : void 0) {
  row = _.first((_ref1 = response.data) != null ? _ref1.Contacts : void 0);
  processed = _this.processRecord(_.first(row.row));
  response.data = processed;
}

Have you any idea how to fix it?

UPD: actually I see error code in node package 0.0.26. When I build it manually it compiled correctly

ahmader commented 6 years ago

Can you give me in steps how to reproduce the problem ?

It should compile the code while installing from npm exactly like if you build it manually.

Thank you

ahmader commented 6 years ago

What is your node and npm versions ?

$ node --version && npm --version
pahan35 commented 6 years ago

I have node 8.9.3 and npm 5.5.1

Steps to reproduce:

  1. npm init -y
  2. npm i --save node-zoho

Clean bad compiled node-zoho image

ahmader commented 6 years ago

@pahan35 I have bumped the version to v0.0.29

Can you confirm if the problem is fixed now

pahan35 commented 6 years ago

@ahmader yes. After installing this package problem this problem is fixed.

Thanks a lot.

ahmader commented 6 years ago

Great,

I will close this issue, and hopefully to see you around