utils#retryWrapper TypeScript Examples

The following examples show how to use utils#retryWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From exevo-pan with The Unlicense 7 votes vote down vote up
fetchItemPage = retryWrapper(
  async (itemName: string, index: number): Promise<RareItemBlock> => {
    const url = buildItemPageUrl(itemName, index)

    const helper = new AuctionList()
    const html = await HttpClient.getHtml(url)

    const lastPageIndex = helper.lastPageIndex(html)
    const ids = helper.auctionBlocks(html).map(({ id }) => id)

    return { name: itemName, lastPageIndex, ids }
  },
)
Example #2
Source File: utils.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
getPostData = retryWrapper((args: PostHtmlProps) => {
  logRequest(args)
  return HttpClient.postHtml(args)
})
Example #3
Source File: fetchHighestAuctionId.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
fetchHighestAuctionId = retryWrapper(async (): Promise<number> => {
  broadcast('Scraping new highest auction id...', 'neutral')

  const helper = new AuctionList()
  const html = await HttpClient.getHtml(SORTED_NEWEST_HISTORY_URL)
  const auctionBlocks = helper.auctionBlocks(html)

  return Math.max(...auctionBlocks.map(({ id }) => id))
})
Example #4
Source File: utils.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
fetchAuctionPage = retryWrapper(async (auctionId: number) =>
  HttpClient.getHtml(`${AUCTION_PAGE_URL}&auctionid=${auctionId}`),
)
Example #5
Source File: utils.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
fetchAuctionPage = retryWrapper(async (auctionId: number) =>
  HttpClient.getHtml(`${AUCTION_PAGE_URL}&auctionid=${auctionId}`),
)
Example #6
Source File: utils.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
fetchServerPage = retryWrapper(() =>
  HttpClient.getHtml(SERVER_LIST_URL),
)
Example #7
Source File: fetchAuctionPageIndexes.ts    From exevo-pan with The Unlicense 6 votes vote down vote up
fetchAuctionPageIndexes = retryWrapper(
  async (): Promise<number[]> => {
    broadcast('Fetching for all auction pages indexes...', 'neutral')

    const helper = new AuctionList()
    const html = await HttpClient.getHtml(FIRST_PAGE_AUCTION_LIST)

    const lastPageIndex = helper.lastPageIndex(html)
    return Array.from({ length: lastPageIndex }, (_, index) => index + 1)
  },
)
Example #8
Source File: fetchHighlightedAuctionData.ts    From exevo-pan with The Unlicense 5 votes vote down vote up
fetchData = retryWrapper(async () =>
  HttpClient.getJSON<RawHighlightedData[]>(`${DATA_ENDPOINT}/api`),
)
Example #9
Source File: index.ts    From exevo-pan with The Unlicense 5 votes vote down vote up
dispatchRevalidate = retryWrapper(RevalidateClient.route)
Example #10
Source File: fetchAuctionsFromPage.ts    From exevo-pan with The Unlicense 5 votes vote down vote up
fetchAuctionsFromPage = retryWrapper(async (pageIndex) => {
  const helper = new AuctionList()
  const html = await HttpClient.getHtml(
    `${AUCTION_LIST_URL}/?currentpage=${pageIndex}`,
  )
  return helper.auctionBlocks(html)
})
Example #11
Source File: fetchNewAuctions.ts    From exevo-pan with The Unlicense 5 votes vote down vote up
fetchAuctionPage = retryWrapper(async (auctionId: number) =>
  HttpClient.getHtml(`${AUCTION_PAGE_URL}&auctionid=${auctionId}`),
)