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 🙏

© 2024 – Pkg Stats / Ryan Hefner

overpass-ql-ts

v1.8.0

Published

Overpass Query Language query builder and client

Downloads

138

Readme

Overpass QL TS

This package aims to make creating dynamic overpassql queries easier by providing a query builder.
You wont need to worry about making small mistakes with syntax, and neither about changing existing queries.

npm version install size tests Coverage Status

import { DefaultOverpassApi, OverpassOutputVerbosity } from "overpass-ql-ts";

const api = DefaultOverpassApi();

const result = await api.execJson((s) => [s.node.query({ name: /^Hospital/, amenity: "hospital" })], {
	verbosity: OverpassOutputVerbosity.Geometry,
});

const someHospital = result.elements[0];

console.log(someHospital.lat, someHospital.lon);

Instalation

npm install overpass-ql-ts

Features & "Roadmap"

The package is usable though many features we intend to implement are WIP.

This package can:

  1. Build queries declaratively
  2. Execute those queries
  3. Execute string queries
  4. Validate the results of queries
  5. Query overpass api instances for status
  6. Point to any overpass instance
  7. Use broser fetch or XMLHttpRequest
  8. Use nodejs http or https
  9. Use any other http client that you adapt to this package

Roadmap

  1. String sanitization
  2. Recurse filter, way_cnt, way_link
  3. More evaluator support
  4. Flow control statements
  5. Around
  6. etc

Examples

To run the examples you may need to include some options due to the package being a module.

node --experimental-specifier-resolution=node --loader ts-node/esm ./examples/simple.ts

Development

We currently use rollup to bundle esm and commonjs versions of the code.

npm run build

The build script configures the path transform plugin and generates the .mjs, .cjs and .d.ts bundles.

npm run check

The check script runs tsc to check for errors.

Contribution

If you find a bug and wish to fix it, remember to update the tests! Fork & Pull request.

If you want to add features, do let us know, some things may not align with what we want from the package.
We would prefer to avoid production dependencies, though development dependencies are aceptable

If you would like to add just more tests to improve coverage and edge case handling, thank you!

Testing

We currently use jest with ts-jest preset, test are run on pushes or pull requests to master.
We've setup a docker image with static data, to facilitate testing.

Local testing

If you want to run tests locally, you'll need a docker engine to run the static image.

npm run overpass-container

The overpass-container script will setup the test image and start it.

If the docker engine you are using its not in your local machine, you can run the tests with

npm run test-in-container

The test-in-container script will create an image from this package,
and run it in a network with the test image that is launched from the overpass-container script.

Environment

The following are env variables used in testing, they can be configured via .env file in the project root.

| Variable | Optional | Description | Example | | ---------------------- | -------- | -------------------------------- | -------------------------------- | | OVERPASS_QL_TS_URL | No | Url to api/interpreter | http://localhost/api/interpreter | | OVERPASS_QL_BUNDLING | Yes | Wether to do bundling tests | Yes / No / Y / N / true / false | | OVERPASS_QL_BROWSER | Yes | Path to browser executable | | | OVERPASS_QL_TIMEOUT | Yes | Jest timeout | 2000 | | OVERPASS_QL_TS_NODE_I | Yes | Discard type checking on tests | Yes / No / Y / N / true / false | | OVERPASS_QL_TEST_BUNCH | Yes | Group all tests in a single file | Yes / No / Y / N / true / false |