Introduction
Use the optional JSforce adapter when an application already owns a JSforce connection.
Use @kysoql/jsforce when your application already has a JSforce connection and you want Kysoql queries to run through it.
For a new application that only needs SOQL execution, @kysoql/rest is the simpler default.
Install
pnpm add @kysoql/core @kysoql/jsforce jsforceUse your existing connection
import { Kysoql } from "@kysoql/core";
import { createJsforceExecutor } from "@kysoql/jsforce";
import type { Connection } from "jsforce";
import type { SalesforceSchema } from "./kysoql/salesforce.generated";
export function createDatabase(connection: Connection) {
return new Kysoql<SalesforceSchema>({
executor: createJsforceExecutor(connection),
});
}Authentication, token refresh, connection lifetime, and API-version selection remain part of your JSforce setup.
Normal queries and QueryAll
import { db } from "./db";
const accounts = await db
.selectFrom("Account")
.select(["Id", "Name"])
.limit(100)
.execute();
const accountsIncludingDeleted = await db
.selectFrom("Account")
.select(["Id", "Name", "IsDeleted"])
.executeAll();The adapter follows JSforce queryMore pagination for root results. .executeAll() starts the query in Salesforce QueryAll mode through JSforce's scanAll option.
Builder execution accepts { signal }. When the signal aborts, the adapter stops waiting for the current JSforce promise and will not issue more queryMore calls. It cannot cancel a JSforce request that is already in flight.
No. The JSforce adapter follows root pagination only. If you need automatic continuation for selected child relationship results, use the native REST executor or query the child object directly.
No. Async page and record iteration are features of @kysoql/rest.
Failures from Salesforce, authentication, and JSforce pass through to your application. Handle retries and session renewal at the same boundary where you manage the JSforce connection.
For transport-specific limits and alternatives, see custom executors and troubleshooting.