elements
Start Docs Blog Demos UI Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
  • JSON
  • Async
  • Style
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
  • Issues
  • Changelog
    • 0.34.0
    • 0.33.0
    • 0.32.2
    • 0.32.1
    • 0.32.0
    • 0.31.1
    • 0.31.0
    • 0.30.0
    • 0.29.0
    • 0.28.1
    • 0.28.0
Manual / Changelog/ 0.34.0

0.34.0

elements man changelog/v0-34-0

On This Page

  • Changes
  • Upgrade

Queries are run with db.query and transactions with db.tx, and SQL text is always written in a template. A LiveTable custom select returns a query and Elements runs it. Browser code reads an env file value through config.jsoc and not through process.env. This release and @elements/app 0.30.0 go together: upgrade the package in every project after upgrading Elements.

Changes

  • db.query runs a query. It replaces sql(). Write the SQL as a template directly after it, with no parentheses: db.query<User>`select * from users where id = ${id}` . It does not accept a string. Requires @elements/app 0.30.0.
  • db.tx(fn) runs fn in a transaction. It replaces tx(). The async variants are db.queryAsync and db.txAsync, replacing sqlAsync and txAsync.
  • sql builds a part of a query and does not run it. sql`and createdAt < ${cursor}` returns a Sql, which you place in a db.query template or in another sql template with ${}. db.query(part) runs a Sql that a function built.
  • sql.join(parts, separator) joins an array of Sql values. sql.ident(name) returns a Sql whose text is the column or table name in the string name, and throws when the string is anything other than a name.
  • sql.raw is removed. sql replaces it for SQL text written in your code, and sql.ident replaces it for a name held in a variable.
  • A connection from checkoutDb() has query and tx in place of sql and tx: conn.query`select 1` .
  • A LiveTable custom select returns a query written with sql and does not run it. It takes the partition and no second argument. Elements adds the ORDER BY, the LIMIT and the condition for the next page outside your query, so w.keyset(), w.order() and w.page() are removed, and so is the SelectWindow type.
  • After a write to a LiveTable with a custom select, Elements runs that select for the written row and sends each browser the row the select returns. The browser receives the columns the select returns, and does not receive a row the select does not return.
  • The server sends a windowed view only the written rows that sort inside the range the view has loaded.
  • new LiveTable(config) gets its table name from the variable it is assigned to when config is declared in another statement, the same as when the config is written in the call.
  • In your project's browser code, the one allowed use of process.env is ENV or NODE_ENV compared with a literal, as in process.env.ENV === "production". Every other read is compile error 230047: process.env.X, process.env["X"], process.env[NAME] where NAME is a JavaScript variable, a comparison on another variable, and ENV or NODE_ENV read without a comparison. In an installed package's browser code each of those reads is written as undefined.
  • In browser code, NODE_ENV is the active environment's name when the env file and the build server's environment do not set it. Set NODE_ENV in an env file to give it another value.
  • A read of a config key that holds a string, a number, a boolean or null is written as that value in the emitted code.
  • In a function that runs in the browser, passing a server function by name, as in setTimeout(deleteUserRows, 10), is compile error 230001, as calling it is.
  • The shorthand attribute {name} on an element is type checked as name={name} is.
  • An e:elseif or e:else element can have a comment between it and the branch before it.
  • An e:elseif or e:else element with text, an interpolation or another element between it and the branch before it, or with no e:if before it, is compile error 230048.
  • e:key on a template call is checked as it is on an element. <Card e:for={row of rows} e:key={row.id} /> is compile error 230046.
  • An error that says what to try has a try array and a see string in -json, and its message no longer contains the fixes or the manual page name. Each try entry has a text sentence, a code example, a command to run on the command line, or several of them. see is the name of a manual page: for "config", run elements man config. The terminal lists each entry under Try: with a dash, and writes > before a command.
  • When a newer release exists, elements build and elements start print a line, and that line now has the address of the changelog on elements.dev: Elements version 0.35.0 is available. Read https://elements.dev/man/changelog before you run elements upgrade. elements build -json has the address in changelog and the version in upgrade. elements man changelog says which changelog pages to read before you run elements upgrade.
  • The recipe in elements man browser starts headless Chrome, runs the checks and closes Chrome with Browser.close in one script. Chrome deletes its profile folder when it is closed with Browser.close.
  • In VS Code, the file explorer of an Elements project does not list the .elements folder or the .claude, .codex, .gemini, .cursor and .vscode folders, unless the workspace has its own files.exclude setting.
  • elements issue list lists the issues you filed, voted for or commented on, with the issue that changed last first. -state=resolved,released keeps the issues in those states, -since=2026-11-01 keeps the issues that changed on or after that date, and -limit sets how many are listed. It replaces elements issue search -mine, which is removed. See elements man issues.
  • Every command, option and example description in elements help is one short line.

Upgrade

Every call to a removed function is a type error after @elements/app is upgraded, so elements build -json lists each place to change. Make the changes in this order, then build until the error count is zero.

  1. Upgrade @elements/app in each project. With an older @elements/app installed, the build reports error 220017, which names the package and the versions this release works with. A project that pins @elements/app to an exact version changes the pin to 0.30.0 or later in config.jsoc first. Restart elements start after the install.

    Terminal
    elements install @elements/app -u -json elements build -json
  2. Rewrite each query call. The template is unchanged; the name changes and the parentheses are removed.

    Query call
    // before let user = sql<User>(`select * from users where id = ${id}`).first(); // after let user = db.query<User>`select * from users where id = ${id}`.first();

    sqlAsync<T>(...) becomes db.queryAsync<T>`...` the same way.

  3. Rewrite tx( to db.tx( and txAsync( to db.txAsync(.

  4. Rewrite each sql.raw. Text written in your code becomes a sql template. A column or table name held in a variable becomes sql.ident.

    sql.raw
    // before let older = cursor ? sql.raw(`and createdAt < ${cursor}`) : sql.raw(""); let column = sql.raw(sortColumn); // after let older = cursor ? sql`and createdAt < ${cursor}` : sql``; let column = sql.ident(sortColumn);
  5. Fix the imports from @elements/app. Add db to every file that now calls db.query or db.tx. Remove tx, sqlAsync and txAsync. Keep sql only in a file that still writes a sql template.

  6. Rename any local variable named db. After using db = checkoutDb(), db in the enclosing block is the connection and not the imported db. Name the connection conn, and change conn.sql(...) to conn.query`...` .

  7. Rewrite each LiveTable custom select. Return a sql template in place of the sql() call, remove the second parameter, and delete the w.keyset() condition, the order by ${w.order()} line and the ${w.page()} line. The query must return id, each partition column and each orderBy column.

    Custom select
    // before select: ({ roomId }, w) => sql<Message>(` select m.* from messages m where m.roomId = ${roomId} and ${w.keyset("m")} order by ${w.order("m")} ${w.page()} `), // after select: ({ roomId }) => sql` select m.* from messages m where m.roomId = ${roomId} `,
  8. A template filter() that hides rows a custom select already excludes can be deleted, because those rows are no longer sent to the browser.

  9. For each process.env read in browser code that the build reports, add a key to config.jsoc that holds env("X") with the @browser build tag, and read the key in place of process.env.X.

    config.jsoc
    { /** @browser */ stripePublishableKey: env("STRIPE_PUBLISHABLE_KEY"), }
    Browser code
    // before let key = process.env.STRIPE_PUBLISHABLE_KEY; // after let key = config.stripePublishableKey;

A query passed as a string in a variable, sql(text), has no direct replacement. Write the query as a template where it is run, and build its variable parts with sql, sql.join and sql.ident. See database/sql.

Prev ChangelogNext 0.33.0
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026