suiteportal
v0.5.0
Published
The NetSuite application layer — typed ORM, CLI tooling, and platform SDK
Maintainers
Readme
suiteportal
The Prisma for NetSuite — a typed, metadata-driven ORM over NetSuite's SuiteQL and REST APIs.
Install
npm install suiteportalQuick Start
# Initialize config and .env
npx suiteportal init
# Introspect your NetSuite account schema
npx suiteportal introspect
# Generate typed client
npx suiteportal generateUsage
import { createClient } from './.suiteportal/client';
const ns = await createClient({
accountId: process.env.NETSUITE_ACCOUNT_ID!,
consumerKey: process.env.NETSUITE_CONSUMER_KEY!,
consumerSecret: process.env.NETSUITE_CONSUMER_SECRET!,
tokenId: process.env.NETSUITE_TOKEN_ID!,
tokenSecret: process.env.NETSUITE_TOKEN_SECRET!,
});
// Find records with typed filters
const customers = await ns.customer.findMany({
where: { balance: { gt: 1000 }, isInactive: { equals: false } },
select: { companyName: true, email: true, balance: true },
orderBy: { balance: 'desc' },
take: 50,
});
// Get a single record
const order = await ns.salesorder.findFirst({
where: { entity: { equals: 42 } },
});
// Count records
const total = await ns.customer.count({
where: { isInactive: { equals: false } },
});
// Create a record
const newCustomer = await ns.customer.create({
data: { companyName: 'Acme Corp', email: '[email protected]' },
});
// Update a record
await ns.customer.update({
where: { id: 123 },
data: { email: '[email protected]' },
});
// Delete a record
await ns.customer.delete({
where: { id: 123 },
});
// Raw SuiteQL escape hatch
const raw = await ns.$queryRaw<{ id: string; companyname: string }>(
'SELECT id, companyname FROM customer WHERE balance > 1000'
);Features
- Prisma-like API —
findMany,findFirst,count,create,update,delete - Full TypeScript types — generated from your NetSuite schema with autocomplete
- Schema introspection — auto-discovers record types, fields, and relations
- SuiteQL query builder —
where,select,orderBy,take,skip,include - REST Record CRUD — create, update, delete via NetSuite REST API
- Raw SuiteQL —
$queryRaw<T>()for complex queries - Local Studio —
npx suiteportal studiofor a web UI to browse data - Zero runtime deps — connector uses only Node.js built-ins
Documentation
Visit suiteportal.io/docs for full documentation.
