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.
| Export | What it does | Reference |
|---|---|---|
Entity | Generic CRUD against any entity. | Entities |
Log | Structured logging — debug, info, warn, error. | Logging |
Http | Outbound HTTPS. URLs gated by permissions.http. | Outbound HTTP |
Settings | Read merged extension settings. | Settings |
Secrets | Read/write encrypted secrets. | Secrets |
api | Helper for declaring API route handlers and building responses. | API routes |
OAuth | Connector-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.