From dca689945e259102748546770d31e773947b80be Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Sun, 16 Aug 2026 12:06:54 -0700 Subject: [PATCH] docs: configure the opening example Create an isolated SQLite runtime before constructing the Cart reference. The front-door TypeScript snippet now uses only public APIs available in the published 0.13.0 package and closes its database cleanly. --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ddb245..8c43bb4 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ invalidations are stored in the database the application already operates. ## The programming model ```typescript -import { Actor } from "solid-objects" +import { Actor, createRuntime } from "solid-objects" +import { sqlite } from "solid-objects/database/sqlite" class Cart extends Actor { static override readonly actorType = "Cart" @@ -34,8 +35,20 @@ class Cart extends Actor { } } -const cart = Cart.ref("cart-123") -await Promise.all([cart.add({ sku: "blue-shirt" }), cart.add({ sku: "green-hat" })]) +const runtime = createRuntime({ + database: sqlite({ path: "cart.sqlite3" }), + authorizeMessage: () => true, + authorizeQuery: () => true, +}) + +await runtime.install() + +try { + const cart = runtime.ref(Cart, "cart-123") + await Promise.all([cart.add({ sku: "blue-shirt" }), cart.add({ sku: "green-hat" })]) +} finally { + await runtime.close() +} ``` Both calls enter the durable mailbox for `cart-123`. They execute in order and