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

@geomatika/isigeo_http_api

v1.1.0

Published

Client HTTP API pour Isigeo

Readme

@geomatika/isigeo_http_api

SDK JavaScript/TypeScript pour communiquer avec les API Isigéo (authentification + accès aux données). Compatible navigateur, Node.js et Cordova.

Installation

Depuis npm

npm install @geomatika/isigeo_http_api

Depuis une source locale (avant publication)

cd http_api
npm run build
npm link
cd /path/to/your/project
npm link @geomatika/isigeo_http_api

Formats disponibles

Le SDK est livré sous plusieurs formats pour s'adapter à tous les contextes :

| Format | Fichier | Usage typique | | ------ | -------------------------------- | ---------------------------------------------------- | | ESM | dist/isigeo_http_api.es.js | Applications Vite / Web modernes | | CJS | dist/isigeo_http_api.cjs.js | Node.js ou outils CommonJS | | IIFE | dist/isigeo_http_api.iife.js | Cordova ou HTML classique (window.IsigeoHttpApi) |

Fonctionnalités

  • Authentification
    • par username/password
    • par token permanent
    • gestion automatique du JWT
  • Accès aux données (CRUD)
    • lecture (getData) avec pagination (page, limit, offset), colonnes (fields), filtres (eq., like., in.…), Geo-Format (geojson / wkt) et Geo-SRID
    • création (createData, POST)
    • mise à jour (updateData, PUT) avec filtre
    • suppression (deleteData, DELETE) avec filtre
  • Compatible navigateur / Cordova (WebView), Node.js 18+, TypeScript

Utilisation

Exemple complet (ESM)

import { IsigeoApi } from "@geomatika/isigeo_http_api";

const api = new IsigeoApi({
  baseUrl: "https://deploiement.geomatika.fr",
  version: 1,
});

const { token } = await api.auth.authWithPassword("admin", "••••••");

const supports = await api.data.getData(token, "ep_support", {
  page: 1,
  geoFormat: "geojson",
});

console.log("Résultats:", supports);

Authentification

const { token, expires } = await api.auth.authWithPassword("admin", "••••••");
console.log("JWT:", token);
console.log("Expire:", new Date(expires * 1000).toLocaleString());

Ou via token permanent :

const { token } = await api.auth.authWithToken("TOKEN_PERMANENT_GENERE_PAR_ISIGEO");

Requêtes data

Pagination

const rows = await api.data.getData(token, "ep_support", {
  page: 1,
  geoFormat: "geojson",
});

Limit / offset

const rows = await api.data.getData(token, "ep_support", {
  limit: 10,
  offset: 0,
});

Colonnes spécifiques

const rows = await api.data.getData(token, "chiffrage_client_travaux", {
  columns: ["date_obs", "photo1", "photo2", "typ_desor", "obs"],
});

Filtres

const rows = await api.data.getData(token, "support", {
  filter: { idsup: "eq.18294" },
});

SRID / format

const rows = await api.data.getData(token, "ep_support", {
  geoFormat: "wkt",
  geoSrid: 2154,
});

Création (POST)

const created = await api.data.createData(token, "support", {
  ref_support: "SUP-001",
  nature_du_support: "Candélabres",
  idnature_du_support: "5",
});

Mise à jour (PUT)

await api.data.updateData(
  token,
  "support",
  { nature_du_support: "Poteau bois", idnature_du_support: "2" },
  { filter: { idsup: "eq.18294" } }
);

Suppression (DELETE)

const res = await api.data.deleteData(token, "support", {
  filter: { idsup: "eq.18294" },
});
// { status: 200, message: "Deleted ( support.18294 )" }

Format de réponse (lecture)

Les appels getData retournent l'enveloppe renvoyée par le serveur :

{
  "metadata": { "total": 1, "sent": 1, "range": { "start": 1, "end": 1 } },
  "data": [ /* lignes */ ]
}

Utilisation dans Cordova

1. Ajouter au npmFileToImport.json

{
  "@geomatika/isigeo_http_api": [
    {
      "from": ["dist", "isigeo_http_api.iife.js"],
      "to": ["js", "extras", "isigeo", "isigeo-http-api.js"]
    }
  ]
}

2. Inclure dans index.html

<script src="js/extras/isigeo/isigeo-http-api.js"></script>
<script>
  document.addEventListener("deviceready", async () => {
    const { IsigeoApi } = window.IsigeoHttpApi;

    const api = new IsigeoApi({
      baseUrl: "https://deploiement.geomatika.fr",
      version: 1,
    });

    const { token } = await api.auth.authWithPassword("admin", "•••••");
    const supports = await api.data.getData(token, "ep_support", { page: 1 });
    console.log(supports);
  });
</script>

window.IsigeoHttpApi est automatiquement défini par le bundle IIFE.

Types TypeScript

Les méthodes sont typées. Tu peux typer les retours pour tes données :

interface Support {
  idsup: number;
  geom: any;
}

const rows = await api.data.getData<Support[]>(token, "support", {
  page: 1,
});

Tests

Tests unitaires (mock fetch, pas de réseau) :

npm test

Tests d'intégration (round-trip réel insert → get → update → get → delete → get contre une instance Isigéo). Skippés automatiquement si les variables ci-dessous ne sont pas définies.

Configuration via .env (recommandé) : copier .env.example en .env (gitignoré) et renseigner les valeurs.

cp .env.example .env
# éditer .env puis :
npm run test:integration

Ou en inline :

ISIGEO_TEST_URL="https://deploiement.geomatika.fr/dev6" \
ISIGEO_TEST_USER="monuser" \
ISIGEO_TEST_PASSWORD="monpass" \
ISIGEO_TEST_TABLE="support" \
npm run test:integration

ISIGEO_TEST_TABLE est optionnel (défaut : support). L'utilisateur doit avoir les droits POST/PUT/DELETE sur la table — chaque run crée puis supprime une ligne marquée ref_support = "npmtest-<timestamp>".

Les scripts scripts/test-auth.js et scripts/test-data.js consomment les mêmes variables d'environnement et ne contiennent aucun secret. Le fichier .env est automatiquement chargé via dotenv.

Build local

# Compilation TS + bundle Vite
npm run build

Produit :

dist/
├── isigeo_http_api.cjs.js
├── isigeo_http_api.es.js
├── isigeo_http_api.iife.js
└── index.d.ts

Publication npm

npm login
npm version patch
npm publish --access public

Vérifie le contenu publié :

npm pack

Exemple d'intégration dans Vite + Cordova

// src/lib/isigeo.ts
import { IsigeoApi } from "@geomatika/isigeo_http_api";

export const isigeo = new IsigeoApi({
  baseUrl: import.meta.env.VITE_ISIGEO_URL,
  version: Number(import.meta.env.VITE_ISIGEO_VERSION ?? 1),
});