npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xrmforge/dataverse-client

v0.1.0

Published

Browser-first Dataverse Web API client: cookie-based fetch transport and retrieveAll paging

Downloads

80

Readme

@xrmforge/dataverse-client

Browser-first Dataverse Web API client for model-driven-app web resources and form scripts. Cookie-based fetch (no bearer token) plus retrieveAll for @odata.nextLink paging. Built on @xrmforge/dataverse-core. Zero runtime dependencies beyond core, sideEffects: false.

Why this exists: Xrm.WebApi.retrieveMultipleRecords cannot follow OData paging across arbitrary result sizes ergonomically. retrieveAll wraps the @odata.nextLink loop, resilience, and cancellation behind one call, verified against a live Dataverse org (cookie auth via credentials: "include").

Install

npm install @xrmforge/dataverse-client

Requires @types/xrm as a peer dependency (for Xrm.Utility.getGlobalContext).

Usage

import { retrieveAll } from '@xrmforge/dataverse-client';
import type { Account } from './generated/entities/account';

// entitySetName is the PLURAL set name ("accounts"), used as the REST path
// segment - not the singular logical name that Xrm.WebApi uses.
const accounts = await retrieveAll<Account>('accounts', '$select=name,address1_city&$filter=statecode eq 0');

retrieveAll follows every @odata.nextLink up to a safety cap (maxPages, default 100; each page holds up to 5000 records). Pass onMaxPagesReached to observe a truncation, or raise maxPages for genuinely larger result sets:

const rows = await retrieveAll<Account>('accounts', '$select=name', {
  maxPages: 500,
  signal: abortController.signal,
  onMaxPagesReached: ({ pages, records }) => console.warn(`Stopped at ${pages} pages / ${records} records`),
});

Same-origin only

The cookie-based transport works for web resources served under the org URL (same-origin to the Web API). A cross-origin (foreign-origin) web resource is blocked by CORS - Dataverse sends no Access-Control-Allow-Origin.

API

  • retrieveAll<T>(entitySetName, odataQuery?, options?) - retrieve all pages.
  • BrowserTransport - the cookie-based DataverseTransport (used by default).
  • Re-exports from @xrmforge/dataverse-core: DataverseError, DataverseHttpError, isDataverseError, sanitizeIdentifier, sanitizeGuid, escapeODataString.

Testing

Inject a fake transport to test code that calls retrieveAll without a real fetch, using FakeTransport from @xrmforge/testing:

import { FakeTransport } from '@xrmforge/testing';

const transport = new FakeTransport([
  { body: { value: [{ accountid: '1' }], '@odata.nextLink': 'https://org/api/data/v9.2/accounts?$skiptoken=p2' } },
  { body: { value: [{ accountid: '2' }] } },
]);
const rows = await retrieveAll('accounts', undefined, { transport });

License

MIT