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

@longsightgroup/qti3-pnp

v0.13.3

Published

Dependency-free TypeScript resolver for QTI 3 Personal Needs and Preferences records.

Downloads

1,909

Readme

@longsightgroup/qti3-pnp

Dependency-free TypeScript resolver for QTI 3 Personal Needs and Preferences data.

The package accepts PNP data supplied by a host application, normalizes it into stable preference records, validates profile-level issues, and resolves those preferences against player capabilities and QTI catalog support metadata.

It does not fetch, store, authorize, or transmit PNP records. LMS identity, consent, institutional policy, persistence, LTI launch handling, and AfA PNP service access belong outside this package.

import {
  createDefaultQti3PnpCapabilities,
  normalizeQti3Pnp,
  parseQti3PnpXml,
  resolveQti3Pnp,
} from "@longsightgroup/qti3-pnp";

const parsed = parseQti3PnpXml(pnpXml);
const normalized = normalizeQti3Pnp(parsed);

const resolution = resolveQti3Pnp(normalized.profile, {
  capabilities: createDefaultQti3PnpCapabilities(),
  qti: { catalogResolution },
  activity: { language: "en" },
});

console.log(resolution.display);
console.log(resolution.catalogRequests);
console.log(resolution.diagnostics);

Default player integration

createPnpPlayerOptions(resolution) maps an already resolved profile to properties accepted by @longsightgroup/qti3-player and its React/Preact adapters. It is a pure function with no player dependency, DOM access, fetching, persistence, or institutional policy enforcement.

import { createPnpPlayerOptions } from "@longsightgroup/qti3-pnp";

const { playerOptions, hostRequired } = createPnpPlayerOptions(resolution);
player.keywordEmphasisEnabled = playerOptions.keywordEmphasisEnabled;
player.catalogRequestPolicy = playerOptions.catalogRequestPolicy;

// Review hostRequired.diagnostics and hostRequired.unresolved, and implement
// any remaining display, tools, media, session, or extension requirements.

Assign both properties each time the profile changes. These are replacement values: missing or disabled keyword emphasis becomes false, and an empty catalog request list produces an exact selection list of [], disabling all catalog request controls. The mapping replaces any previous host catalog request policy; it does not merge with it. Re-resolve against the current item's catalog metadata when loading a different item, then apply the new options.

| Resolution data | Mapping behavior | | ------------------------------------------------------------- | ---------------------------------------------------------------- | | display.keywordEmphasis | Sets keywordEmphasisEnabled | | catalogRequests | Enables controls for exact catalog/support/entry-language tuples | | Other display settings, tools, media, session | Returned in hostRequired; no player behavior is claimed | | Extensions, prohibitions, unresolved preferences, diagnostics | Retained in hostRequired for host handling/review |

Catalog selections preserve the resolver's chosen language, including its fallback result. The player does not repeat language fallback or enable other catalogs with the same support. An absent entryLanguage matches only content without a language. Duplicate selections do not duplicate delivered content. The tuple identifies all authored entries sharing those three values; it is not an individual card-entry identifier.

The host must handle qti-catalogrequest to present the player's sanitized delivery content. hostRequired.catalogRequests retains the original requests and their reasons, including pnp-initial; the mapper never opens presentations or fires requests automatically. Enabling controls alone does not fulfill a required accommodation. The general resolver's default capabilities describe resolution capabilities, not a promise that the default player implements every resulting setting. Supply the capabilities your host actually delivers.

The mapper does not reinterpret policy or decide whether diagnostics permit delivery. Review the resolution before applying it. hostRequired retains input records by reference; treat them as read-only. The player settings are newly constructed and do not mutate the resolution.

Support Metadata

qti3PnpSupportDefinitions reports supportLevel as the precise support classification: recognized, catalog, runtime, or runtime-and-catalog. The implemented boolean is a summary flag for supports that are more than recognized-only; use supportLevel when you need to distinguish catalog activation from player/runtime behavior.