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

@natrave/facility-service-types

v0.1.1

Published

Tipos compartilhados do serviço de quadras da NaTrave

Readme

@natrave/facility-service-types

Tipos e contratos compartilhados do facility-service da plataforma NaTrave. Centraliza as interfaces de domínio (estabelecimentos e endereços) e os contratos de request/response usados pelo serviço e por seus consumidores (ex.: tournaments-service), para que servidor e clientes falem exatamente o mesmo shape.

É um pacote types-first: quase tudo é interface (apagada na compilação). A única exportação de runtime é o enum FacilityResolution.

Requisitos

  • Node.js 20+
  • pnpm como gerenciador de pacotes

Instalação

Publicado no npm sob o escopo @natrave (always-auth habilitado). Configure um token antes de instalar — crie um .npmrc no projeto consumidor:

@natrave:registry=https://registry.npmjs.org
always-auth=true
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Em seguida:

pnpm add @natrave/facility-service-types

Uso

O src/index.ts reexporta tudo:

import {
  IFacility,
  ICreateFacilityDto,
  IResolveFacilitiesDto,
  IResolveFacilitiesResponse,
  FacilityResolution,
} from '@natrave/facility-service-types';

Conteúdo

Entidades (visão de tipo)

  • IFacility — estabelecimento. Inclui googlePlaceId: string | null, a identidade canônica do lugar (Google Place ID). null em registros legados/manuais ainda não resolvidos. O endereço é dado de atributo, não identidade.
  • IAddress — endereço completo (logradouro, número, bairro, cidade, UF, CEP, país, lat/long).

Criação direta

  • ICreateAddressDto, ICreateFacilityDto, ICreateFacilitiesDto e as respostas ICreateFacilityResponse / ICreateFacilitiesResponse — usados pelo fluxo de create-or-fetch em lote (POST /facilities/batch).

Resolução de estabelecimentos

Contrato preferido para vincular um lugar a um serviço. Resolução é responsabilidade única do facility-service (Place ID → geocoding → chave natural); o chamador correlaciona por ref e nunca re-casa por endereço.

// request → POST /facilities/resolve
const body: IResolveFacilitiesDto = {
  items: [
    {
      ref: 'tmp-1', // id opaco do chamador, devolvido intacto
      name: 'Hammer Futebol Society',
      placeId: 'ChIJ...', // identidade canônica (quando vem do Maps)
      // address?: ICreateAddressDto  → hint p/ geocoding manual / fallback
    },
  ],
};

// response
const res: IResolveFacilitiesResponse = {
  items: [
    {
      ref: 'tmp-1', // mesmo ref → correlação
      facilityId: 482,
      googlePlaceId: 'ChIJ...',
      resolution: FacilityResolution.MATCHED_BY_PLACE_ID,
      facility: {
        /* ICreateFacilityResponse: snapshot canônico */
      },
    },
  ],
};

FacilityResolution:

| valor | significado | | ------------------------ | ------------------------------------------------- | | matched_by_place_id | casou por Google Place ID | | matched_by_natural_key | sem Place ID; casou por name + CEP normalizados | | created | não existia; criado agora |

Build & release

pnpm build          # tsc (declarations) + esbuild (ESM, extensões .js)
pnpm check:types    # tsc --noEmit
pnpm lint

Versionamento via changesets: adicione um .changeset/*.md na PR; ao mergear na main, o workflow release.yml roda changeset version e publica no npm.