@farseerdev/farseer-client
TypeScript client for the Farseer API. Farseer Apps use it to read and write models, run imports and exports, and work with files.
Documentation: https://client-docs.farseer.io
Install
npm install farseer-client@npm:@farseerdev/farseer-client
This installs the package under the name farseer-client, which is how Farseer Apps import it. A Farseer App folder created with the Farseer CLI already has it.
The xlsx dependency installs from cdn.sheetjs.com, not from npm. pnpm 11 refuses such a dependency by default (ERR_PNPM_EXOTIC_SUBDEP), so set blockExoticSubdeps to false. Networks that block cdn.sheetjs.com cannot install the package.
Use
import { FarseerClient, User, handleUnknownError } from 'farseer-client';
async function main() {
const client = new FarseerClient();
const users: User[] = await client.users.list();
}
main().catch(handleUnknownError);
handleUnknownError prints the status and body of a failed request, and ends the script.
Inside a Farseer App, the client reads its settings from the environment variables TENANT_ID, FARSEER_URL and FARSEER_API_KEY. Anywhere else, pass them in:
const client = new FarseerClient('<tenant ID>', '<API key>', 'https://<your-company>.farseer.io');
An API key belongs to a service user: in Farseer, open Users & groups, choose Create service user, and copy the key it shows. The tenant ID is the tenant's name, as listed under Switch Tenants in the user menu.