Kysoql

Introduction

Execute Kysoql queries through Salesforce REST without JSforce.

@kysoql/rest is Kysoql's native Salesforce transport. It uses fetch, so you can execute typed queries without adding JSforce to the application.

The executor handles normal Query, QueryAll, scalar counts, Salesforce pagination, selected child relationship continuations, cancellation, and renewable access tokens.

Install

pnpm add @kysoql/core @kysoql/rest

Connect it to Kysoql

import { Kysoql } from "@kysoql/core";
import { createRestExecutor } from "@kysoql/rest";
import type { SalesforceSchema } from "./kysoql/salesforce.generated";

export function createDatabase(instanceUrl: string, accessToken: string) {
  return new Kysoql<SalesforceSchema>({
    executor: createRestExecutor({ instanceUrl, accessToken }),
  });
}

That is enough for a static access token. Production applications usually pass an access-token provider so an expired Salesforce session can be renewed safely. See authentication and token refresh.

What happens during execution?

For ordinary record queries, the executor follows Salesforce continuation links until the query is complete. Selected child subqueries are completed too, including nested child relationships, while respecting each query level's compiled LIMIT.

You can collect the whole result with .execute(), use QueryAll with .executeAll(), or process larger root result sets through the executor's async page and record iterators.

Start with native REST execution for the full execution model, limits, cancellation, and error handling.

On this page