headintheclouddev / typings-suitescript-2.0

TypeScript typings for SuiteScript version 2.0
MIT License
145 stars 92 forks source link

QueryResultMap - Should this be "export" instead of just internal? #256

Closed Rvice closed 1 year ago

Rvice commented 1 year ago

I've wrote a paged query that I unwrap the merged data to do a variety of sorts. As a result, I'm using the iterator to unwind the mapped data.

The code I have working, I just exposed the QueryResultMap. I supposed, I could recreate the object where I use the code, but why re-invent the wheel.

I'm sure, I may hit some form of limitation on the unwinding of pages. But haven't had time to optimize.

Before creating a PR, I figured I'd ask and see if maybe there's something better I should be doing.

Here's an example snippet I'm running off the query.PageData iterator

` let mappedResults: Array = [];

queryIterator.iterator().each(result => {
  mappedResults = mappedResults.concat(result.value.data.asMappedResults());
  log.debug({
    title: 'Last Message Date',
    details: mappedResults[this.lastMessageFieldCol]
  });
  return true;
});

`

Created the PR anyway in case it's OK to expose: https://github.com/headintheclouddev/typings-suitescript-2.0/pull/257

MrRob commented 1 year ago

Hey Rob,

I think it sounds like a valid reason, I'm merging in the pull request.

Thank you!