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

@jsm-mit/map-places-replicated-shards-package

v0.2.0

Published

The package of map-places: address search (autocomplete) and reverse geocoding from a replicated-shards group of IC canisters (a coordinator, a ticket core and worker copies) that hold OpenStreetMap indexes.

Readme

@jsm-mit/map-places-replicated-shards-package

The package of map-places: address search (autocomplete) and reverse geocoding from a group of Internet Computer canisters (replicated shards): a coordinator, a ticket core and copies of workers, each holding an OpenStreetMap index of one area (© OpenStreetMap contributors, ODbL). Queries cost the caller nothing. It replaces the deprecated @jsm-mit/tigi-geo-package.

The group (0.2): MapPlacesClient

import { coordinatorTicketProvider, errorKeyOf, isTimeoutError, MapPlacesClient } from "@jsm-mit/map-places-replicated-shards-package";

const geo = new MapPlacesClient({
    coordinatorId,                                 // the coordinator of the group
    identity: user,                                // the caller of the queries (a ticket names it)
    ticketProvider,                                // where tickets come from (below)
});
const search = await geo.searchAsyncUnsafe("Family Mall", {
    near: position,                                // { lat, lng }: nearest first; picks the area
    limit: 5,                                      // default 5, at most 10
    lang: "en",                                    // "en" / "pl" names where OSM has them
    timeoutMs: 3_000,
});
// search.places[i]: { label, area, location: { lat, lng }, kind }   like the front's Place
// search.nearInArea === false → the rider is outside every area: ask Photon instead

const pin = await geo.reverseAsyncUnsafe(point);   // { label, area, location, kind, meters } | null
  • The client reads the areas and their live copies from the coordinator and keeps them ttlSeconds. reverse asks the area that holds the point; search the area that holds near (without near: options.area, else the first area). A point outside every area makes no call: reverse gives null, search no places with nearInArea: false.
  • A ticket (replicated-shards.md) names the user, the area, a bbox, a time and one copy. The client keeps it per area, asks for the next one in the background in the last quarter of its life, and at once (with one retry of the call) when the worker refuses it (TicketExpired, TicketInvalid, TicketMissing, OutsideBbox).
  • Ticket providers:
    • a system registered at the coordinator signs issueTicket itself at the ticket core of the user (the coordinator names it, issuerFor): coordinatorTicketProvider({ coordinatorId, system: identity, user });
    • a front asks its own backend canister (a registered system), which asks the ticket core for the front's user: ticketProvider: (request) => backend.placesTicket(request).
  • Without a provider the client draws a live copy and sends no ticket — only while the copies do not require tickets.
  • A copy that does not answer: the list is read again and the call is tried once more.

Errors: CanisterError with errorKeyOf(error) = NotReady (no live copy, no index), InvalidData (a point that is not on Earth), the ticket refusals above (after the renewal), and the refusals of the provider: Blocked (the user — a clear reason; show it), RateLimited, Waiting, NotAuthorized. Timeout (isTimeoutError; renewals and retries count) and CriticalCanisterError (transport; also a system the coordinator does not know). The front falls back to Photon / Nominatim when the group throws, when nearInArea is false, when places is empty, or when reverseAsyncUnsafe gives null.

From 0.1

0.2 is breaking: MapPlacesActor and MAP_PLACES_CANISTER_ID (the single canister backend8) are gone from the public API; searchPlacesAsyncUnsafe is searchAsyncUnsafe of MapPlacesClient. The place shapes (Place, PlaceSearch, ReversePlace) are the same.

Local replica: host: "http://127.0.0.1:4943".

Scripts

  • npm run test-unit — no canister (the client on a fake transport).
  • npm run test-smoke — one copy (map-places-worker) on the LOCAL replica with the Iraq index (data/iraq-261104.tgi, or INDEX=…).
  • npm run test-group — the group on the LOCAL replica: the coordinator, two copies of Iraq, tickets required (../scripts/check/local-coordinator-check.sh iraq, local test identity mrc-system as the system).
  • npm run sync-declarations — declarations/ from ../worker/map-places-worker.did, ../coordinator/map-places-coordinator.did and ../core/map-places-core.did.
  • npm run publish-public — human-run; see the script for its refusals.

Before 0.2 the package was @jsm-mit/map-places-package (0.1, one canister: MapPlacesActor).