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

@emdzej/ncsx-fa-asw

v0.8.0

Published

FA token string → ASW bit set converter. Spec: ../../docs/ecu-selection.md §3.3

Downloads

922

Readme

@emdzej/ncsx-fa-asw

Converts a user-facing FA string (Auftrag — the comma/space-separated list of factory option codes like "0205 0502 0524") into the ASW bit set that the @emdzej/ncsx-predicate evaluator consumes to match AUFTRAGSAUSDRUCK rows in <BR>SGET.000 and <BR>CVT.000.

NCSEXPER equivalent: coapiGetAswFromAuftragRecFncAsw.

Spec: ../../docs/ecu-selection.md §3.3.

Mental model

   FA string             AT records              SWTASW                ASW bit set
"$0902 $0524 $0205" ──→ ['SWA', 'CL', …] ──→  KEYID lookups   ──→  Set<u16>
                          (FSW names)            (per FSW)
  1. Tokenise the FA string (whitespace / commas; strip $ and category-letter prefixes).
  2. Look each token up in chassis.at to get the FSW names it implies.
  3. Look each FSW name up in chassis.swtAsw to get its u16 KEYID.
  4. Optionally pull in additional Zwang (forced-inclusion) codes from chassis.atM00.

Install

pnpm add @emdzej/ncsx-fa-asw
# or:
"@emdzej/ncsx-fa-asw": "workspace:*"

Quick start

import { loadChassis } from '@emdzej/ncsx-chassis';
import { nodeChassisSource } from '@emdzej/ncsx-chassis/node';
import { faToAsw } from '@emdzej/ncsx-fa-asw';

const chassis = await loadChassis(nodeChassisSource('…/DATEN'), 'E46');
const asw = faToAsw('$0902 $0524 $0205', { chassis });
// asw is a Set<number> of u16 KEYIDs that the predicate evaluator consumes.

// Feed it to a predicate (typically via ecu-select, but you can call it directly):
import { evalAuftragsausdruck } from '@emdzej/ncsx-predicate';
evalAuftragsausdruck(predicateBytes, asw);

API

| Export | Purpose | |--------------------|------------------------------------------------------------------| | faToAsw(fa, opts) | The pipeline: FA string → ASW bit set | | tokenizeFa(fa) | Just the FA tokeniser (handy for UI input echo / validation) | | aswFromIds(ids) | Build an AswSet directly from a list of KEYIDs | | AswSet | Type alias: Set<number> |

faToAsw options

faToAsw(fa, {
  chassis,                  // required — supplies AT + SWTASW + AT.M00
  strict: false,            // when true, throws on unknown FA codes / FSWs
  includeZwang: true,       // when true, add KEYIDs from AT.M00 Z records
  onWarning: (w) => { … },  // unknown FA code, unknown FSW, no SWT table, …
});

FA-string syntax accepted

  • Whitespace OR commas as separators: "0902,0524,0205" works the same as "0902 0524 0205".
  • Optional $ prefix per token: "$0902" (matches the convention NCSEXPER's editor uses).
  • Optional leading category letter: "W0902" is the same as "0902".
  • Leading zeros are tolerated — "0205" and "205" both resolve.

Warnings

onWarning receives objects like:

  • { kind: 'unknown-fa-code', code: '999', message: … } — token not in chassis.at.
  • { kind: 'unknown-fsw', fsw: 'GHOST', message: … } — AT record references a FSW not in SWTASW.
  • { kind: 'no-swt', message: … } — chassis bundle has no SWTASW table loaded.

In strict: true mode each of these throws instead.

What this doesn't do (yet)

  • ZCS → ASW decoding. A car's ZCS (Zentral-Codier-Schlüssel) is another way of expressing FA; converting it requires the per-module ZCS decoder. Wait for a future zcs-asw package or do it yourself via chassis.zcsut.
  • FSW-keyword to ASW lookup. The predicate's S<id> opcode references SA codes, not FSW IDs. If you want to test "is FSW SWA active?", use chassis.zst to find which SA codes contribute to that FSW, then check whether those SAs are in the ASW.

Related