Kysoql

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 jsforce

Use 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.

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.

On this page