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

arcgis-query-builder

v1.0.5

Published

Lightweight query builder for ArcGIS FeatureLayers

Readme

ArcGIS Query Builder

npm version Build license

A lightweight and fluent query builder for ArcGIS FeatureLayers, inspired by modern query builders. This package provides an intuitive API for building complex queries for ArcGIS FeatureLayers with TypeScript support.

Installation

npm install arcgis-query-builder

Features

  • Fluent API for building ArcGIS FeatureLayer queries
  • Full TypeScript support
  • Advanced query operations (where, select, orderBy, groupBy, etc.)
  • Rich date-time query helpers
  • Spatial query support
  • Statistics and aggregation functions
  • Query chaining and composition

Quick Start

import { QueryBuilder } from 'arcgis-query-builder'
import FeatureLayer from '@arcgis/core/layers/FeatureLayer'

// Create a query builder from a FeatureLayer
const layer = new FeatureLayer({ url: 'your-feature-layer-url' })
const query = QueryBuilder.from(layer)

// Build and execute a query
const results = await query
  .select(['NAME', 'POPULATION'])
  .where('POPULATION', '>', 1000000)
  .orderBy('POPULATION', 'DESC')
  .limit(10)
  .exec()

Basic Usage

Simple Queries

// Basic where clause
query.where('field', '=', 'value')

// Multiple conditions
query.where('age', '>=', 18).where('status', '=', 'active')

// OR conditions
query.where('type', '=', 'A').orWhere('type', '=', 'B')

Advanced Queries

// Complex where clauses
query.where(qb => {
  qb.where('status', '=', 'active').where('age', '>=', 18)
})

// Between values
query.whereBetween('price', 10, 100)

// IN clause
query.whereIn('category', ['A', 'B', 'C'])

// NULL checks
query.whereNull('optional_field')
query.whereNotNull('required_field')

Date Queries

// Date specific queries
query.whereDate('created_at', '=', '2025-01-01')
query.whereToday('timestamp')
query.whereThisWeek('date_field')
query.whereThisMonth('date_field')
query.whereLastDays('date_field', 7)

// Business hours
query.whereBusinessHours('time_field')
query.whereWeekdays('date_field')

Aggregations and Statistics

// Group by with statistics
query.groupBy('category').stats([
  { field: 'price', type: 'avg', alias: 'average_price' },
  { field: 'quantity', type: 'sum', alias: 'total_quantity' }
])

// Single statistic
query.addStat('population', 'sum', 'total_population')

Pagination

// Using limit and offset
query.limit(10).offset(20)

// Or using paginate
query.paginate(2, 10) // page 2, 10 items per page

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Install dependencies (npm install)
  4. Make your changes
  5. Run the tests (npm test)
  6. Commit your changes (git commit -m 'Add some AmazingFeature')
  7. Push to the branch (git push origin feature/AmazingFeature)
  8. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/vdhuyme/arcgis-query-builder.git

# Install dependencies
npm install

# Run tests
npm test

# Build the package
npm run build

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

  • Create an issue on GitHub
  • Contact the maintainer: vdhuyme

Acknowledgments

  • Thanks to all contributors who have helped with code, bug reports, and suggestions
  • Inspired by modern query builders
  • Built with TypeScript and ArcGIS API for JavaScript