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

@acuris-geo/commercetools-extension

v0.1.0

Published

commercetools API Extension handler for Acuris Address Validation & Geocoding — gates Cart updates server-side.

Downloads

40

Readme

@acuris-geo/commercetools-extension

commercetools API Extension handler for Acuris Address Validation & Geocoding. Synchronously validates setShippingAddress / setBillingAddress on Cart updates and either rewrites to the canonical address or rejects with InvalidInput. Server-side, no bypass.

Status: beta (0.1.0).

Install

npm install @acuris-geo/commercetools-extension

Why server-side

Storefront-only address validation can be bypassed: a buyer can call POST /me/carts/{id} directly with bad data. The API Extension closes that hole by running on every Cart update inside commercetools, before the cart persists. Per docs.commercetools.com/api/projects/api-extensions, the handler can either return replacement update actions (200) or abort with structured errors (400). We expose both modes.

Quick start (AWS Lambda)

import { buildLambdaHandler } from "@acuris-geo/commercetools-extension";

export const handler = buildLambdaHandler({
  apiKey: process.env.ACURIS_API_KEY!,
  mode: "rewrite",        // rewrite (default), reject, or annotate
  minConfidence: 0.8,
});

Register the Lambda URL in Merchant Center → Settings → Developer settings → API Extensions with trigger Cart: Update and authentication of your choice (AWS Lambda authorizer / X-API-Key / basic auth — the extension itself is transport-agnostic).

Modes

| Mode | Behaviour | |---|---| | rewrite (default) | Replace the inbound address with Acuris's standardized form. Below minConfidence the inbound stays as-is. | | reject | Return InvalidInput if confidence is below minConfidence. Cart update aborts; buyer sees the error. | | annotate | Don't change the address; future minor release will attach Custom Fields (acurisConfidence, acurisAccuracyType). Currently a no-op placeholder for the merchant to slot their own logic. |

Identity fields (firstName, lastName, company, apartment, building, pOBox, phone, …) are preserved verbatim in rewrite mode — only the geographical components are updated.

Other runtime adapters

// Generic async (your own router):
import { buildExtensionHandler } from "@acuris-geo/commercetools-extension";
const handler = buildExtensionHandler({ apiKey });
const responseBody = await handler(requestBody);

// Raw Node http (Express, fastify wrappers, etc):
import { buildNodeHttpHandler } from "@acuris-geo/commercetools-extension";
app.post("/acuris-extension", buildNodeHttpHandler({ apiKey }));

For commercetools Connect deployments, wrap processExtension in a Connect-conformant handler — the processExtension core takes a parsed request body and returns the response payload directly.

Configuration

| Option | Default | Notes | |---|---|---| | apiKey | process.env.ACURIS_API_KEY | Required. | | mode | "rewrite" | See above. | | minConfidence | 0.8 | Below this, treated as a no-match. | | baseUrl | https://api.acuris-geo.com | Override for self-hosted. | | timeoutMs | 3500 | commercetools enforces ≤ 10 s; we default well under. | | skipCountries | [] | ISO-2 codes to bypass entirely. |

Failure semantics

Network errors and Acuris-side outages do not block Cart updates. The handler logs internally and lets the inbound action stand — the opposite of the buyer-blocking failure mode you'd get from a strict implementation. If you want fail-closed behaviour, raise an issue.

License

MIT © Acuris GmbH