suiteportal 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# suiteportal
|
|
2
|
+
|
|
3
|
+
**The Prisma for NetSuite** — a typed, metadata-driven ORM over NetSuite's SuiteQL and REST APIs.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/suiteportal)
|
|
6
|
+
[](https://github.com/Suite-Portal/netsuite-orm/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install suiteportal
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Initialize config and .env
|
|
18
|
+
npx suiteportal init
|
|
19
|
+
|
|
20
|
+
# Introspect your NetSuite account schema
|
|
21
|
+
npx suiteportal introspect
|
|
22
|
+
|
|
23
|
+
# Generate typed client
|
|
24
|
+
npx suiteportal generate
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createClient } from './.suiteportal/client';
|
|
31
|
+
|
|
32
|
+
const ns = await createClient({
|
|
33
|
+
accountId: process.env.NETSUITE_ACCOUNT_ID!,
|
|
34
|
+
consumerKey: process.env.NETSUITE_CONSUMER_KEY!,
|
|
35
|
+
consumerSecret: process.env.NETSUITE_CONSUMER_SECRET!,
|
|
36
|
+
tokenId: process.env.NETSUITE_TOKEN_ID!,
|
|
37
|
+
tokenSecret: process.env.NETSUITE_TOKEN_SECRET!,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Find records with typed filters
|
|
41
|
+
const customers = await ns.customer.findMany({
|
|
42
|
+
where: { balance: { gt: 1000 }, isInactive: { equals: false } },
|
|
43
|
+
select: { companyName: true, email: true, balance: true },
|
|
44
|
+
orderBy: { balance: 'desc' },
|
|
45
|
+
take: 50,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Get a single record
|
|
49
|
+
const order = await ns.salesorder.findFirst({
|
|
50
|
+
where: { entity: { equals: 42 } },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Count records
|
|
54
|
+
const total = await ns.customer.count({
|
|
55
|
+
where: { isInactive: { equals: false } },
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Create a record
|
|
59
|
+
const newCustomer = await ns.customer.create({
|
|
60
|
+
data: { companyName: 'Acme Corp', email: 'info@acme.com' },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Update a record
|
|
64
|
+
await ns.customer.update({
|
|
65
|
+
where: { id: 123 },
|
|
66
|
+
data: { email: 'new@acme.com' },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Delete a record
|
|
70
|
+
await ns.customer.delete({
|
|
71
|
+
where: { id: 123 },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Raw SuiteQL escape hatch
|
|
75
|
+
const raw = await ns.$queryRaw<{ id: string; companyname: string }>(
|
|
76
|
+
'SELECT id, companyname FROM customer WHERE balance > 1000'
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
- **Prisma-like API** — `findMany`, `findFirst`, `count`, `create`, `update`, `delete`
|
|
83
|
+
- **Full TypeScript types** — generated from your NetSuite schema with autocomplete
|
|
84
|
+
- **Schema introspection** — auto-discovers record types, fields, and relations
|
|
85
|
+
- **SuiteQL query builder** — `where`, `select`, `orderBy`, `take`, `skip`, `include`
|
|
86
|
+
- **REST Record CRUD** — create, update, delete via NetSuite REST API
|
|
87
|
+
- **Raw SuiteQL** — `$queryRaw<T>()` for complex queries
|
|
88
|
+
- **Local Studio** — `npx suiteportal studio` for a web UI to browse data
|
|
89
|
+
- **Zero runtime deps** — connector uses only Node.js built-ins
|
|
90
|
+
|
|
91
|
+
## Documentation
|
|
92
|
+
|
|
93
|
+
Visit [suiteportal.io/docs](https://suiteportal.io/docs) for full documentation.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
[MIT](https://github.com/Suite-Portal/netsuite-orm/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suiteportal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The NetSuite application layer — typed ORM, CLI tooling, and platform SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"clean": "rm -rf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@suiteportal/client-runtime": "^0.
|
|
35
|
-
"@suiteportal/cli": "^0.
|
|
36
|
-
"@suiteportal/connector": "^0.
|
|
34
|
+
"@suiteportal/client-runtime": "^0.4.0",
|
|
35
|
+
"@suiteportal/cli": "^0.4.0",
|
|
36
|
+
"@suiteportal/connector": "^0.4.0"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|