# Introduction (/docs/jsforce)



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`](/docs/rest) is the simpler default.

## Install [#install]

<Tabs items="[&#x22;npm&#x22;, &#x22;yarn&#x22;, &#x22;pnpm&#x22;, &#x22;bun&#x22;]" defaultIndex="2">
  <Tab value="npm">
    ```bash
    npm install @kysoql/core @kysoql/jsforce jsforce
    ```
  </Tab>

  <Tab value="yarn">
    ```bash
    yarn add @kysoql/core @kysoql/jsforce jsforce
    ```
  </Tab>

  <Tab value="pnpm">
    ```bash
    pnpm add @kysoql/core @kysoql/jsforce jsforce
    ```
  </Tab>

  <Tab value="bun">
    ```bash
    bun add @kysoql/core @kysoql/jsforce jsforce
    ```
  </Tab>
</Tabs>

## Use your existing connection [#use-your-existing-connection]

```ts
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 [#normal-queries-and-queryall]

```ts
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.

<Accordions type="single">
  <Accordion title="What does cancellation do?">
    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.
  </Accordion>

  <Accordion title="Does it drain child relationship pages?">
    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.
  </Accordion>

  <Accordion title="Does it stream records?">
    No. Async page and record iteration are features of `@kysoql/rest`.
  </Accordion>
</Accordions>

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](/docs/core/reference/custom-executors) and [troubleshooting](/docs/core/reference/troubleshooting).
