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

@spatialflow/sdk

v1.1.0

Published

Official Node.js SDK for SpatialFlow - Real-time geospatial automation platform

Readme

SpatialFlow Node.js SDK

The official Node.js/TypeScript SDK for SpatialFlow - a real-time geospatial automation platform.

Installation

npm install @spatialflow/sdk
# or
yarn add @spatialflow/sdk
# or
pnpm add @spatialflow/sdk

Quick Start

import { SpatialFlow } from "@spatialflow/sdk";

// Initialize with API key
const client = new SpatialFlow({ apiKey: "sf_xxx" });

// List geofences
const response = await client.geofences.appsGeofencesApiListGeofences();
for (const geofence of response.data.results) {
  console.log(`${geofence.name}: ${geofence.id}`);
}

// Create a geofence
const geofence = await client.geofences.appsGeofencesApiCreateGeofence({
  createGeofenceRequest: {
    name: "My Region",
    geometry: {
      type: "Polygon",
      coordinates: [[[-122.4, 37.8], [-122.4, 37.7], [-122.3, 37.7], [-122.3, 37.8], [-122.4, 37.8]]]
    }
  }
});

Authentication

API Key (Recommended for server-side)

const client = new SpatialFlow({ apiKey: "sf_xxx" });

JWT Token (For client-side apps)

const client = new SpatialFlow({ accessToken: "eyJ..." });

Resources

  • Geofences - Create and manage geofences
  • Workflows - Automate location-based actions
  • Webhooks - Receive real-time event notifications
  • Devices - Track device locations

Method Naming

API methods are auto-generated from the OpenAPI spec and follow the pattern: apps{Resource}Api{Operation}. For example:

// Geofences
client.geofences.appsGeofencesApiListGeofences()
client.geofences.appsGeofencesApiCreateGeofence({ createGeofenceRequest: {...} })
client.geofences.appsGeofencesApiGetGeofence({ id: "..." })
client.geofences.appsGeofencesApiUpdateGeofence({ id: "...", ... })
client.geofences.appsGeofencesApiDeleteGeofence({ id: "..." })

// Workflows
client.workflows.appsWorkflowsApiListWorkflows()
client.workflows.appsWorkflowsApiCreateWorkflow({ ... })

// Webhooks
client.webhooks.appsWebhooksApiListWebhooks()
client.webhooks.appsWebhooksApiCreateWebhook({ ... })

Use your IDE's autocomplete to discover available methods, or see the API Reference for the full list.

Webhook Verification

import { verifyWebhookSignature, WebhookSignatureError } from "@spatialflow/sdk";

// In your Express webhook handler
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  try {
    const event = verifyWebhookSignature({
      payload: req.body,
      signature: req.headers["x-sf-signature"] as string,
      secret: process.env.WEBHOOK_SECRET!,
    });

    // Process verified event
    console.log(event.type, event.data);
    res.sendStatus(200);
  } catch (e) {
    if (e instanceof WebhookSignatureError) {
      res.status(400).json({ error: e.message });
    } else {
      throw e;
    }
  }
});

Pagination

Use the async iterator to paginate through all results:

import { paginate } from "@spatialflow/sdk";

// Iterate through all geofences
for await (const geofence of paginate({
  fetchPage: (offset, limit) =>
    client.geofences.appsGeofencesApiListGeofences({ offset, limit }),
})) {
  console.log(geofence.name);
}

// Or collect all into an array
import { collectAll } from "@spatialflow/sdk";

const allGeofences = await collectAll({
  fetchPage: (offset, limit) =>
    client.geofences.appsGeofencesApiListGeofences({ offset, limit }),
});

File Uploads

Upload geofence files (GeoJSON, KML, GPX) with automatic job polling:

import { uploadGeofences } from "@spatialflow/sdk";

const result = await uploadGeofences({
  client,
  filePath: "boundaries.geojson",
  groupName: "my-region",
  timeout: 120000,
  onStatus: (status) => console.log(`Status: ${status}`),
});

console.log(`Created ${result.createdCount} geofences`);
for (const geofence of result.createdGeofences) {
  console.log(`  - ${geofence.name} (${geofence.id})`);
}

Async Job Polling

For lower-level control over job polling:

import { pollJob, JobTimeoutError, JobFailedError } from "@spatialflow/sdk";

try {
  const result = await pollJob({
    fetchStatus: () =>
      client.geofences.appsGeofencesApiGetUploadJobStatus({ jobId }),
    timeout: 120000,
    pollInterval: 2000,
    onStatus: (status) => console.log(`Status: ${status}`),
  });

  console.log(`Job completed: ${result.createdCount} created`);
} catch (e) {
  if (e instanceof JobTimeoutError) {
    console.log(`Job timed out (last status: ${e.lastStatus})`);
  } else if (e instanceof JobFailedError) {
    console.log(`Job failed: ${e.errorMessage}`);
  }
}

Documentation

Support

  • GitHub Issues: https://github.com/spatialflow-io/spatialflow-node/issues
  • Email: [email protected]

License

MIT License - see LICENSE for details.