Private
constructorNot meant to be used directly, use factory methods such as load
or from
the netsuite search object to wrap
optional pagesize, can be up to 1000
Protected
currentProtected
currentProtected
indexProtected
logPrivate
pageoptional pagesize, can be up to 1000
Protected
pagedPrivate
searchthe netsuite search object to wrap
Static
LOGNAMEthe name of the custom logger for this component for independent logging control
per the iterator protocol, retrieves the next element. Also returns null
if done as the specification for
the protocol says the value property is optional when 'done'
You don't typically call this function yourself - libraries like ImmutableJS do.
Static
fromCreates a lazy search from an existing NS search.
create a search and begin lazy processing of results
import {Seq} from './NFT-X.Y.Z/immutable'
import * as search from 'N/search
import {governanceRemains, LazySearch, nsSearchResult2obj} from './NFT-X.Y.Z/search'
Seq(LazySearch.from(search.create({
filters: [['internalid', 'anyof', [1,2]),
columns:['item', 'description'],
type: search.Type.ITEM,
})))
.takeWhile(governanceRemains()) // process until we drop below default governance threshold
.map(nsSearchResult2obj()) // convert search results to plain objects with properties
.forEach( r => log.debug(r))
Optional
pageSize: numberStatic
loadLoads an existing NS search by id and prepares it for lazy evaluation
do something for each search result, automatically exiting if out of governance.
import {Seq} from './NFT-X.Y.Z/immutable'
import {governanceRemains, LazySearch, nsSearchResult2obj} from './NFT-X.Y.Z/search'
Seq(LazySearch.load('1234'))
.takeWhile(governanceRemains()) // process until we drop below default governance threshold
.map(nsSearchResult2obj()) // convert search results to plain objects with properties
.forEach( r => log.debug(r))
internal id of the search to load
Optional
pageSize: numberhow many records to retrieve per page (paging is automatic) Maximum value: 1000
Generated using TypeDoc
Makes a NetSuite search an ES2015 style Iterator. That is, it follows the Iterator Protocol for iterating over search results in a forward-only fashion. The result can be passed to any library that accepts Iterators (such as ImmutableJS) to provide easy chainable logic on arbitrary length search result sets.
Started with this as a class due to other library requirements and left it as a class just as an easy way to contain state about currentpage and index into that page.
This is exposed as an iterator so that it could be used with other libraries. For example I've heard Ramda may support iterators so if we choose to go a more pure FP route down the road this class would be useful - i.e. it remains untied to any particular library.
Example
take the first result of a search as a plain object (ImmutableJS)