- Package manager is
pnpm(lockfile + CI usepnpm); usepnpm installandpnpm <script>. - This is a single-package ESM TypeScript library (
"type": "module"), not a monorepo. - Public entrypoint is
src/index.ts, default export target issrc/client.ts(NetsuiteApiClient).
- Build:
pnpm build(runstsc --build --clean && tsc, outputs todist/). - Tests:
pnpm test(Vitest). - Coverage (CI command):
pnpm coverage. - Single test file:
pnpm test -- test/request.test.ts. - Single test case:
pnpm test -- test/request.test.ts -t "should work with base_url".
- Tests are integration-heavy, not unit-only: they call real NetSuite endpoints.
- Required env vars are loaded from
.envviadotenv/config; copy.env.samplekeys exactly. test/request.test.tscreates and then deletes a customer record; avoid running against sensitive production data.- CI injects NetSuite secrets and runs coverage on pull requests (
.github/workflows/node.js.yml). - Vitest timeout is
20000ms (vitest.config.ts), so network tests are expected.
- URL construction defaults to
https://{realm}.suitetalk.api.netsuite.com/services/rest/{path}. base_urloverrides realm-host construction and is sanitized to remove trailing slash.pathis sanitized to remove one leading slash;restletUrlbypasses normal URL construction entirely.request()parses JSON response bodies and wrapsgotHTTPErrorasNetsuiteErrorwith NetSuite detail text when possible.query()enforceslimit <= 1000and strips tabs/newlines before sending SuiteQL.