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
OAuthConnector-only access to host-managed provider OAuth tokens and metadata.Connector OAuth
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.