JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q28238F
  • License MIT

SQLite database seeded from Inflow Inventory API

Package Exports

  • inflow-get
  • inflow-get/schema

Readme

inflow-get

SQLite database seeded from the Inflow Inventory API. Uses inflow-api-types for schema validation.

Setup

npm install

Database Setup

Generate and run migrations:

npm run db:generate
npm run db:migrate

Seed from Inflow API

INFLOW_API_KEY=your-api-key INFLOW_COMPANY_ID=your-company-id npm run seed

This will:

  1. Fetch all data from your Inflow account
  2. Validate responses using Zod schemas
  3. Insert into SQLite at ./data/inflow.db

Seed Individual Entities

npm run seed:reference   # Categories, locations, currencies, etc.
npm run seed:products    # Products with prices, inventory, BOM
npm run seed:vendors     # Vendors with vendor items
npm run seed:customers   # Customers
npm run seed:orders      # PO, SO, MO

Browse Data

npm run db:studio

Opens Drizzle Studio to browse the SQLite database.

Use as a Library

import { db, products, salesOrders } from 'inflow-get';

// Query products
const allProducts = db.select().from(products).all();

// Query with joins
const ordersWithCustomers = db
  .select()
  .from(salesOrders)
  .leftJoin(customers, eq(salesOrders.customerId, customers.customerId))
  .all();

Schema

Tables match the Inflow API structure (normalized):

Reference:

  • categories, locations, currencies, pricing_schemes
  • payment_terms, tax_codes, taxing_schemes
  • operation_types, adjustment_reasons, team_members

Core:

  • products + product_prices, product_barcodes, inventory_lines, item_boms, product_operations, reorder_settings
  • vendors + vendor_items
  • customers

Orders:

  • purchase_orders + purchase_order_lines
  • sales_orders + sales_order_lines
  • manufacturing_orders

Transactions:

  • stock_transfers + stock_transfer_lines
  • stock_adjustments + stock_adjustment_lines
  • product_cost_adjustments + product_cost_adjustment_lines