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

@1dex-fr/connector

v0.2.0

Published

JavaScript connector for the public and professional 1dex API surface: overview, subscriber address details, autocomplete, score, preview, account usage, and map routes.

Readme

@1dex-fr/connector

JavaScript and TypeScript connector for the public and professional 1dex.fr API surface.

Install the npm package:

npm i @1dex-fr/connector
import { OneDexClient } from "@1dex-fr/connector";

Public reads

Public overview access is intended for manual, one-off checks within public quotas. Automation and integrations require active API rights. Some map layers also require an authorized Explorer session; an API key alone does not grant access to detailed DVF or works layers.

import { OneDexClient } from "@1dex-fr/connector";

const client = new OneDexClient();

const overview = await client.overview.address({
  address: "10 rue des cordeliers aix",
  dvf_radius_m: 600,
});

const suggestions = await client.autocomplete.address({
  q: "10 rue des cordeliers aix",
  limit: 5,
});

const score = await client.score.address({
  items: [{ address: "10 rue des cordeliers aix" }],
});

const viewport = await client.map.viewport({
  layers: "context,iris",
  address: "10 rue des cordeliers aix",
});

Authentication and detailed reads

Complete address details and unlock flows require a 1dex API key. Professional Free accounts can issue a demo key only when a demo is published in that environment. Demo keys are pinned to the configured address; live keys use the account's subscription and activation rights. Check current offer availability on 1dex.fr. Keep live keys in your backend, never in browser code or URLs. Create or manage keys at https://1dex.fr/compte/api.

Pass the key explicitly or through ONEDEX_API_KEY:

import { OneDexApiError, OneDexClient } from "@1dex-fr/connector";

const client = new OneDexClient({
  apiKey: process.env.ONEDEX_API_KEY,
});

Recommended subscriber flow:

  1. Check the V2 api_addresses usage view (or the legacy V1 response during rollout) with client.account.usage().
  2. Try client.address.details(...) with an address, parcel, coordinates, or a normalizedAddressKey, plus a caller-generated idempotency key.
  3. If the API raises address_unlock_required, call client.address.unlock(...) with the returned normalized_address_key, or post the returned unlock_request object when present.
  4. Follow the returned details_url with client.address.detailsUrl(...); the helper rejects another origin or route.
import { randomUUID } from "node:crypto";

const usage = await client.account.usage();

try {
  const details = await client.address.details({
    address: "10 rue des cordeliers aix",
    fields: ["summary", "rail"],
    idempotencyKey: randomUUID(),
  }, { retry: true });
  console.log(details.fields);
} catch (error) {
  if (!(error instanceof OneDexApiError)) {
    throw error;
  }
  if (error.status !== 402 || error.body?.error !== "address_unlock_required") {
    throw error;
  }

  const unlockIdempotencyKey = randomUUID();
  const unlock = error.body.unlock_request
    ? await client.address.unlock({
        ...error.body.unlock_request,
        idempotencyKey: unlockIdempotencyKey,
      }, { retry: true })
    : await client.address.unlock({
        normalizedAddressKey: error.body.normalized_address_key,
        idempotencyKey: unlockIdempotencyKey,
      }, { retry: true });

  const details = unlock.details_url
    ? await client.address.detailsUrl(unlock.details_url, {
        idempotencyKey: randomUUID(),
        retry: true,
      })
    : await client.address.details({
        normalizedAddressKey: unlock.normalized_address_key,
        fields: ["summary", "rail"],
        idempotencyKey: randomUUID(),
      }, { retry: true });

  console.log(usage.version, details.fields);
}

retry: true retries 202, 429, and 503 with the exact same idempotency key and honors Retry-After. A 409 is never retried: it means the key identifies another intention. Pass an AbortSignal to cancel both the active request and any retry wait.

Common professional API errors:

  • invalid_api_key: the API key is missing, invalid, or revoked.
  • api_subscription_required: the account needs an active subscription.
  • api_professional_required: the endpoint requires a professional plan.
  • address_unlock_required: the detailed address must be unlocked before reading.
  • insufficient_credits: the account has no remaining address credits for the requested unlock.

Helpers

The client exposes helpers for the current /api/v1 routes:

  • client.overview.address(...)
  • client.address.details(...)
  • client.address.detailsUrl(...)
  • client.address.unlock(...)
  • client.account.usage()
  • client.autocomplete.address(...)
  • client.communes.search(...)
  • client.score.address(...), client.score.compare(...), client.score.grid(...), client.score.addressSuggest(...)
  • client.preview.byPath(...)
  • client.addressPages.state(...)
  • client.map.layer(...), client.map.viewport(...), client.map.focus.address(...), client.map.focus.publicLocation(...), client.map.focus.parcelle(...), client.map.focus.parcelles(...), client.map.focus.feature(...)

For command-line usage, install @1dex-fr/1dex.

Supported runtimes: Node 22 and 24. Type declarations cover both legacy account usage and account-usage-v2 during rollout.

Transport limits

The base URL accepts either https://1dex.fr or https://1dex.fr/api/v1. HTTP redirects are rejected so credentials and mutations are never forwarded to an unexpected URL. A retry wait budget stops retries when Retry-After exceeds it; it never shortens the server’s delay. Errors retain the HTTP status even when an upstream response contains text or HTML.