bullhorn / taurus

Typescript client for the Bullhorn REST API
MIT License
10 stars 6 forks source link

Add Node.js support #16

Closed martinmicunda closed 6 years ago

martinmicunda commented 6 years ago

Hi,

I would like to use your library however it mainly seems to build for UI and not Node.js so I have made a small change to support both UI and Node.js.

The document doesn't exist in Node.js. The same apply for HTMLDocument, HTMLElement, NodeList, Window so I have commented them out in Is.ts but they don't seem to be used in your project anyway so let me know if you need to clean up the file.

I am more than open to discuss the changes or make more fixes so this PR could be submitted.

martinmicunda commented 6 years ago

@bvkimball or @jgodi could you review the PR?

bvkimball commented 6 years ago

Look into this hopefully have some comments soon, thank you for the effort.

bvkimball commented 6 years ago

I will be rebase-ing this into our f/rxjs6 branch which we plan on release this month too. Please let us know if there is a regression on that.

Thank you again for the help!

martinmicunda commented 6 years ago

@bvkimball that's fine as I actually tested the PR against rxjs6 branch :) When you rebase master to rxjs6 could publish to npm too?

I have one question: is there a way that I could obtain Auth Code without passing username and password details in the request (see my comment here)? I have looked all over Bullhorn documentation but it seems the auth API was more built for UI not backend.

There seems to be an issue how taurus inherited Observable.toPromise. The below code doesn't print test and there isn't any error either. I had to debug the code and I can see taurus send the request to Bullhorn but it's doesn't resolve or reject promise and the execution of code get stack on await list$.toPromise(); line.

try {
  const list$: EntityList<JobOrder> = new EntityList(EntityTypes.JobOrder, {});
  await list$.toPromise();
  console.log('test');
} catch(error) {
  console.error(error);
}