Standard library

The named exports from @backfill-io/sdk that every script imports.

Every script and declaration file uses the same small standard library, exported from @backfill-io/sdk.

ExportWhat it doesReference
EntityGeneric CRUD against any entity.Entities
LogStructured logging — debug, info, warn, error.Logging
HttpOutbound HTTPS. URLs gated by permissions.http.Outbound HTTP
SettingsRead merged extension settings.Settings
SecretsRead/write encrypted secrets.Secrets
apiHelper for declaring API route handlers and building responses.API routes
RoutesBuild links between extension pages and to entity detail views.UI pages
CryptoHMAC/hash primitives and timing-safe comparison.Webhook verification
verifyPrebuilt webhook signature verifiers (Stripe, Shopify, Standard Webhooks, HMAC-SHA256).Webhook verification
OAuthConnector-only access to host-managed provider OAuth tokens and metadata.Connector OAuth
syncConnector-only checkpoint, paging, schedule, and run-status state machine.Sync API
ingestConnector-only canonical record ingestion with idempotency and batching.Ingest API
import { Entity, Log, Settings } from "@backfill-io/sdk";

The runtime also exposes these as globals — at deploy, @backfill-io/sdk imports are stripped and the same identifiers are injected onto globalThis. Either style runs identically; the docs use imports because they give you autocomplete, type-checking, and a clear edit-time signal of what each script depends on.

@backfill-io/sdk also exports declaration helpers — defineExtension, defineConnector, defineEntity, defineEntityField, defineLineField — used in the manifest and discovered declaration files. They return the declaration object for type-checking and build-time discovery; they are not runtime APIs. Each is documented alongside the file it belongs in: configuration, connectors, custom entities, and custom fields.

Entity classes

The SDK exports a typed class for each first-class entity, pre-bound to the type:

Invoice    Customer    Payment       Expense       SalesReceipt
Item       VendorBill  BillPayment   PurchaseOrder CreditMemo
Quote      SalesOrder  RefundReceipt VendorCredit  Account
Vendor     JournalEntry Deposit      BankTransfer
import { Invoice } from "@backfill-io/sdk";

So instead of Entity.query("Invoice", { ... }) you write Invoice.query({ ... }). Both work and read against the same data. Custom entities you declare via defineEntity get the same treatment — once the CLI regenerates types, they’re importable by their PascalCase name.

Package entry points

@backfill-io/sdk ships four entry points; each import path serves one job:

Import pathContentsUsed in
@backfill-io/sdkThe standard library above, declaration helpers, entity classes, and all runtime types.Every script.
@backfill-io/sdk/uiUI components (Page, Form, Table, …), contribution helpers (defineTab, defineAction, …), and action result helpers.UI render and action scripts — see Components.
@backfill-io/sdk/jsx-runtimeThe JSX transform. You don’t import it directly — the /** @jsxImportSource @backfill-io/sdk */ pragma (or jsxImportSource in tsconfig.json) wires it up.TSX page files.
@backfill-io/sdk/testingThe in-memory test runtime (connectorTestRuntime) with mocked standard library.Local tests only — never in deployed code. See Testing.