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

velocious-search

v0.2.0

Published

Reusable relationship-aware filtering for Velocious applications.

Readme

velocious-search

Reusable relationship-aware filters for Velocious frontend-model resources.

The package provides one React Native-compatible JSX component that discovers the attributes and relationships exposed by a generated Velocious model. It produces a versioned filter value that can be applied to normal frontend-model queries without replacing their count, pagination, preload, or serialization behavior.

import applySearch from "velocious-search/apply-search"
import SearchFilter from "velocious-search/search-filter"

const searchableFields = [
  {attribute: "name", path: []},
  {attribute: "name", path: ["builds"]}
]

<SearchFilter
  filter={filter}
  modelClass={BuildGroup}
  onFilterChange={onFilterChange}
  searchableFields={searchableFields}
  testID="buildGroupSearchFilter"
  translate={translate}
/>

const buildGroups = await applySearch(BuildGroup.all(), filter).toArray()

translate is optional and receives every built-in control, predicate, and generated catalog label. Omit it when English identity labels are appropriate.

Backend resources opt in once through their shared base resource:

import SearchableResource from "velocious-search/searchable-resource"

/**
 * @template {typeof import("velocious/build/src/database/record/index.js").default} [TModelClass=typeof import("velocious/build/src/database/record/index.js").default]
 * @augments {SearchableResource<TModelClass>}
 */
export default class BaseResource extends SearchableResource {
  // Existing application authorization and resource helpers stay here.
}

SearchableResource preserves the consuming resource base's generic backend model type, so typed methods such as authorizedQuery() continue returning the application's concrete record class.

Every resource must explicitly allow the safe root and relationship fields it needs. Relationship searches also inspect related rows outside the root resource's authorization scope, so relationship paths require a second explicit opt-in:

export default class BuildGroupResource extends BaseResource {
  static searchableFields() {
    return [
      {attribute: "name", path: []},
      {attribute: "name", path: ["builds"]}
    ]
  }

  static searchableRelationshipPaths() {
    return [["builds"]]
  }
}

Only database-backed attributes can be searched. Polymorphic, through, and cross-database relationship paths are rejected. The SearchFilter searchableFields prop is presentation metadata and should mirror the backend resource's authoritative searchableFields() declaration.

SearchFilter edits flat root conditions. The filter contract supports nested groups for programmatic clients, but the component rejects nested groups it cannot display. See docs/filter-contract.md for the filter format and security boundary.

Development

  • npm run lint checks ESLint and JSDoc/TypeScript contracts.
  • npm test -- spec/path-to-spec.js runs a focused spec.
  • npm run test:package-entrypoints builds and loads every published subpath.
  • npm run build generates publishable JavaScript and declarations under build/.
  • npm pack --dry-run verifies package contents and entrypoints.

Frontend and backend source compile in separate TypeScript projects. The frontend project skips dependency declaration checking because React Native and Node intentionally declare overlapping runtime globals; package source remains fully checked, and the backend project checks dependency declarations normally.

License

ISC