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

dax-optimizer-sdk

v0.2.0

Published

Programmatic DAX Optimizer analysis for Power BI and Analysis Services models

Readme

dax-optimizer-sdk

Programmatic DAX Optimizer analysis for Power BI, Fabric, and Analysis Services models. Exports a model to VPAX format, uploads it to the DAX Optimizer service, and returns structured performance analysis results — all from a single function call.

Prerequisites

| Tool | Purpose | Install | |------|---------|---------| | .NET 8.0+ | Runtime for vpax-bridge and DAX Optimizer CLI | Download | | DAX Optimizer CLI | Uploads VPAX and runs analysis | dotnet tool install --global Dax.Optimizer.CLI |

vpax-bridge (bundled) is built automatically on npm install via dotnet build.

You also need a DAX Optimizer account with a workspace ID.

Authentication

DAX Optimizer auth (for analysis upload)

Three modes — pass an auth object:

// PAT (CI/CD, automation — requires Enterprise license)
auth: { method: 'pat', username: 'group:automation', token: process.env.TOKEN! }

// Interactive (opens browser, credentials cached by CLI)
auth: { method: 'interactive' }

// Group (opens browser, switches to group account)
auth: { method: 'group', username: 'my-team' }

Fabric auth (for VPAX export from cloud models)

For Fabric / Power BI Service models, add interactive: true to open a browser for Azure AD sign-in:

interactive: true

Or pass a pre-acquired token:

accessToken: '<bearer-token>'

Not needed for local Power BI Desktop models.

Quick start

Local Power BI Desktop

import { analyzeDaxModel } from 'dax-optimizer-sdk'

const result = await analyzeDaxModel({
  auth: { method: 'pat', username: 'group:automation', token: process.env.TOKEN! },
  server: 'localhost:65072',
  databaseId: 'f97515be-bbb7-434b-83fc-b2599bf8a754',
  workspaceId: process.env.WORKSPACE_ID!,
  modelName: 'My Model',
  modelCreate: true,
  contractId: '...',
})

Fabric / Power BI Service

const result = await analyzeDaxModel({
  auth: { method: 'pat', username: 'group:automation', token: process.env.TOKEN! },
  server: 'powerbi://api.powerbi.com/v1.0/myorg/My Workspace',
  databaseId: 'My Dataset',
  interactive: true,  // opens browser for Azure AD sign-in
  workspaceId: process.env.WORKSPACE_ID!,
  modelName: 'My Dataset',
  modelCreate: true,
  contractId: '...',
})

Where do server and databaseId come from?

This library does not include Power BI model discovery. The caller provides the connection details:

  • Local PBI Desktop — use Power BI MCP ListLocalInstances + Connect + database_operations List
  • Fabric — use the XMLA endpoint URL: powerbi://api.powerbi.com/v1.0/myorg/<workspace> and the dataset name as databaseId

API

analyzeDaxModel(options): Promise<DaxOptimizerResult>

End-to-end: preflight check → VPAX export → analysis → results → cleanup.

checkPrerequisites(): PreflightResult

Returns { dotnet, daxoptimizer, vpaxBridge } booleans.

exportVpax(options): Promise<string>

Exports a model to VPAX. Supports local, Fabric (interactive), and Fabric (token).

runAnalysis(options): Promise<DaxOptimizerResult>

Analyzes an existing VPAX file.

logout(): Promise<void>

Clears cached DAX Optimizer CLI credentials.

isInteractive(auth): boolean

Returns true if the DAX Optimizer auth mode may open a browser.

Error handling

| Error class | When | |-------------|------| | AuthError | Invalid auth config or login/logout failure | | PrerequisiteError | Missing tool (includes install command) | | VpaxExportError | VPAX export failed | | AnalysisError | DAX Optimizer CLI failed or results couldn't be parsed |

Known limitations

  • Direct Lake models (compat level 1604) are not yet supported by DAX Optimizer
  • TMDL/PBIP offline export produces a VPAX without data statistics, which DAX Optimizer rejects

License

MIT