Skip to content

v1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 17 Nov 10:09
· 7 commits to main since this release

SQLite as a database option, and everything built since the untagged 1.0.0 baseline:
self-service accounts and API keys with daily limits, the service site, client programs in
eight languages, the website, UDC collections on @jsudc/* 0.3. A small installation on one
host runs memento on a single SQLite file (DATABASE_URL=file:<path>), with no database
service and no Redis; PostgreSQL stays the default.

The first tagged release, and the first under the npm scope @jsmemento/*: the tag
v1.1.0 publishes the image ghcr.io/digital-cube/jsmemento as :1.1.0, :1.1, :1 and
:latest, and @jsmemento/core, server, cli, react and lookups 1.1.0 on npm.
[1.0.0] below is the baseline of 2026-10-31, which was never tagged or published.

Code that embeds @jsmemento/server, probes the health check or reads the error codes has to
change, as Breaking for code that embeds the server lists. The version is still minor
because no package was ever published under @memento/* or @jsmemento/* and no release was
ever tagged, so nobody can depend on the old names or the old behaviour.

Breaking for code that embeds the server

Against 1.0.0, the untagged baseline:

  • The package names. The npm packages are @jsmemento/core, server, cli, react and
    lookups, no longer in the @memento scope, which on npm belongs to someone else: change
    the dependency names and imports. The memento command, the image, the MEMENTO_*
    variables and the /memento prefix stay as they are.
  • DatabaseHandle carries dialect (the new Dialect type) instead of pool
    (node-postgres' pg.Pool).
  • Database is drizzle's query builder without a driver in its type,
    PgDatabase<PgQueryResultHKT, typeof schema> instead of NodePgDatabase<typeof schema>, so
    it has no $client. Code that reached for handle.pool or db.$client uses handle.db
    for queries and handle.close() on shutdown.
  • connect(url) picks the database from the URL's scheme: postgres:// /
    postgresql://, or SQLite for file:<path>, file:///abs/path and :memory:. Any other
    URL throws an error naming only the scheme (before, every URL went to node-postgres). One
    process speaks one dialect: a connect to the other database while a handle is open throws.
  • schema is the tables of the connected database (PostgreSQL until connect opens a
    SQLite file, which swaps in twins with the same row types). Read a table when a query is
    built, not into a module-level constant. The PostgreSQL tables live in
    db/schema-postgres.ts.
  • runMigrations(db) applies the migration set of the process's database:
    MIGRATIONS_FOLDER (drizzle/) for PostgreSQL, the new SQLITE_MIGRATIONS_FOLDER
    (drizzle-sqlite/) for SQLite. On PostgreSQL it runs under an advisory lock.
  • Ids of new rows are generated by the application as UUID v7 (uuidv7()), no longer by
    the database's gen_random_uuid(), which stays the column default (no migration).
  • The health check moved from GET <prefix>/health to GET <prefix>/api/health
    (default /memento/api/health). The image's memento-healthcheck follows it; external
    monitors and load-balancer probes have to be pointed at the new path.
  • Error codes: a framework 415 (unsupported content type) answers with the code
    unsupported_media_type instead of bad_request, and a 429 with rate_limited.
  • Text sorts (listTemplates, listTenants, the retention sweep, every UDC sort on a text
    field) are in Unicode code-point order on every database: USER_LOGIN before _generic,
    upper case before lower case (see Fixed).

Against the image of main between 1.0.0 and this release (:main, :edge), for code that
used what was added there:

  • A boolean UDC field (is_admin, verified, disabled, …) filters on true / false
    (a JSON boolean or the string) and refuses anything else with validation_error. Before,
    the value went to PostgreSQL as a string and its cast decided (t, 1 and yes passed).
    The rows answer a JSON boolean on both databases.
  • The UDC field maps EVENTS_FIELDS, CPU_LOAD_FIELDS and API_KEY_EVENT_FIELD read
    their columns when a query is built (the tables of the connected database), and
    FieldKind gains "bool". isoOf takes epoch milliseconds too.
  • @jsudc/* 0.3: an application that builds or extends the UDC registry itself (the udc
    option, MementoRegistry, eventCollections, EventCollectionSource) with its own
    @jsudc/core / @jsudc/server has to be on 0.3 too. The registry, its sources and their
    schemas are @jsudc 0.3 types, and 0.3 stops the start when a lookup field or row_link
    names a collection nobody serves. @jsmemento/react does not depend on @jsudc/*, and no
    @jsmemento/* package has @jsudc/* as a peer dependency.
  • Metering: a key of a tenant with an account member is metered and held to its daily
    limit on every server process, not only on one with MEMENTO_ACCOUNTS (see Fixed). An
    embedding application without accounts now answers 429 quota_exceeded for such a key past
    its limit.

Added

  • memento --version (also -V, @jsmemento/cli) prints the package's version, read from
    its package.json; in the image, docker run --rm ghcr.io/digital-cube/jsmemento:1.1.0 memento --version prints 1.1.0.

  • The website says how fresh it is. The footer of every page (the home page beside
    "MIT licence.", the docs under Starlight's footer) shows the version, the date of its release
    tag (the CHANGELOG.md heading while there is no tag), when the site was built (UTC) and the
    commit; the Packages list and table show when each package's newest version went to npm, and
    that version when it is not the repository's (not on npm yet while a package has never been
    published); beside the image, the release tag's date. Read once per build
    (apps/website/src/build-info.mjs); the registry never fails the build, and SITE_NPM=off
    builds without asking it (apps/website/README.md).
    deploy/website/stage.sh fetches the tags and rebuilds when a release tag lands on a built
    commit.

  • SQLite as a database option for installations that must not depend on a database
    service (the first user: a customer's local machine with neither PostgreSQL nor Redis):
    DATABASE_URL=file:<path> (or file:///abs/path, :memory: for tests) instead of
    postgresql://…. PostgreSQL stays the default. On SQLite everything works — events,
    queries, rendering, chats, UDC collections with the same answers, the /ws stream, accounts,
    quotas, usage, retention, the CLI — with one limit: one server process on one host per
    file, so that process serves either the examples site or the service site, not both. Redis
    is optional there as on PostgreSQL and not needed at all: without it the stream runs on the
    in-process bus, the quota counter reads the usage table and the rate limits live in memory;
    with it, still one server process. The guide, from an empty directory to a running server
    (which database fits, the quick start, the image and a Compose file without postgres and
    redis, embedding, accounts, the CLI next to the server, backups and the limits), is
    docs/SQLITE.md; the README and docs/DEPLOYMENT.md link to it.

    • The driver is Node's built-in node:sqlite under drizzle's sqlite-proxy, no native
      dependency. One writer connection behind an in-process FIFO gate (every transaction
      BEGIN IMMEDIATE, a nested one a savepoint), a read-only second connection for reads, WAL,
      foreign_keys = ON; another process holding the write lock (a memento CLI command next to
      the server) is waited for on a timer, up to 10 s, without stopping the server.
    • Its own migration set, packages/server/drizzle-sqlite/ (with the event immutability
      triggers), shipped in the package next to drizzle/; pnpm db:generate writes both, the
      server at start and memento migrate apply the set of the URL's database.
    • DATABASE_URL / TEST_DATABASE_URL accept file:<path>, file:///abs/path and
      :memory:. The tables of db/schema.ts are those of the connected database
      (db/schema-postgres.ts or db/schema-sqlite.ts, the same row types, checked at compile
      time); a process speaks one dialect. New exports: dialectOf, describeDatabase,
      SQLITE_MIGRATIONS_FOLDER.
    • The server and CLI suites run on both databases (vitest projects, MEMENTO_TEST_DIALECT,
      test:pg / test:sqlite); test/parity.test.ts pins what both must answer alike.
  • The website (apps/website, @jsmemento/website, docs/DEPLOYMENT.md):
    Astro + Starlight with memento's own identity (ink and bone, the red thread, Bodoni Moda),
    dark and light, Pagefind search, a home hero (one USER_LOGIN and its EN / SR sentence),
    the sidebar Get started / Concepts / Reference / Examples / Clients / Packages (an index each
    for now) and its own 404. SITE_URL, EXAMPLE_URL, SERVICE_URL at build time;
    starlight-links-validator fails the build on a broken internal link (CI job Website
    build
    ). Served at stage.memento-service.org by deploy/website/stage.sh
    (build-and-swap, nginx vhost in deploy/website/nginx/). Not part of the image.
    The home page below the hero: one event read back every way (entity history, en / sr,
    Filter DSL, a /ws frame), the eight examples as real screenshots, the API, four quick
    starts and the packages; Get started with Docker, a client and embedded in Node. Its code
    is repository files imported raw (apps/website/snippets/, clients/): requests and answers
    recorded by npm run capture, screenshots by npm run shots, the snippets compiled by
    check:snippets in typecheck.
    The rest of the sidebar: Concepts (events and instances, tenants and keys, rendering,
    streaming, chats, UDC collections, accounts and retention, deployment modes), Reference
    generated from docs/ by npm run gen (the HTTP API, the Filter DSL, streaming, chats, the
    CLI, the environment variables; not in git, each page naming its file and commit),
    Examples (the examples site, one page per example with its screenshot, the service site),
    Clients (clients/ rendered at build time: the READMEs and the programs' sources, a page
    per language) and Packages (versions from the workspace, the image tags, which ones you
    install, the changelog generated from this file).

  • The /clients page of the service site (apps/service, docs/CLIENTS.md):
    public, a tab per language at /clients/<lang> (remembered in localStorage), the two
    environment lines with this origin and a mk_… placeholder (Copy; the hint links to /keys),
    the README's install / variables / run, the source with line numbers, Copy and the manifest as
    a second tab, and Download <lang>.zip. Built by vite-plugin-clients.ts from
    clients/ at build time: virtual:clients (shiki-highlighted HTML, no grammars in the
    browser) and dist/clients/<lang>.zip (fflate; without node_modules, target, build).
    Logged out, the header links to it. No key is ever embedded.

  • Client programs (clients/<lang>, docs/CLIENTS.md): one complete
    program each in JavaScript, TypeScript, Python, PHP, Java, Rust, Go and C++ — push a
    USER_LOGIN event, query the last ten of user/<you>, tail the stream for 10 s (not in PHP
    and C++) — with MEMENTO_API_KEY / MEMENTO_URL from the environment, exit 2 without a key
    and 1 on an HTTP error, and a README each; the service site serves them for download.
    clients/check.sh runs one against a local server, and the Client programs workflow
    (.github/workflows/clients.yml) runs all eight on every change.

  • API keys users manage (@jsmemento/server, MEMENTO_ACCOUNTS): session routes
    POST /keys ({name, scopes: read|write, expires_at?, daily_limit?} → the plaintext once;
    409 limit_reached past max_keys), PATCH /keys/:id (name, daily_limit),
    POST /keys/:id/disable|enable (pause / resume), DELETE /keys/:id (soft delete). Disabled
    and deleted keys fail auth like revoked ones; revoke-key (CLI) unchanged. Admin routes
    POST /admin/users/:id/disable|enable (disabling deletes the user's sessions) and
    POST /admin/keys/:id/disable|enable.

  • Lifecycle events: APIKEY_CREATED, APIKEY_DISABLED, APIKEY_ENABLED,
    APIKEY_DELETED, APIKEY_LIMIT_CHANGED (instance type api_key, instance id the prefix,
    actor the user's email) in lookups.yaml, translations.csv and EN + SR templates.

  • api_key_id on events: every event stored with a key records it (EventSchema gains an
    optional api_key_id); the events UDC collection gains api_key (the prefix, filterable).

  • Daily limits per key (daily_limit ?? MEMENTO_DEFAULT_DAILY_LIMIT events per UTC day):
    429 quota_exceeded with {limit, used, resets_at}, quota_warning (80 %) and
    quota_exceeded mails once a day each (EN + SR, via the mailer); counters in Redis
    (memento:quota:<key>:<day>) or summed from the usage table.

  • Usage meter (UsageMeter): requests, bytes in, events written, rows read and stream
    seconds per key and hour, flushed to memento_apikey_usage every 5 s and on close.

  • Self-service UDC collections: api_keys, api_key_events, api_key_activity,
    api_key_usage (session) and admin_users, admin_api_keys (admin), on the new
    TableCollectionSource (a read-only UDC source over any SQL query).

  • Retention: memento retention [--tenant slug] [--dry-run] archives events older than a
    tenant's retention_days in batches of 10 000; a retention service (profile demo) in
    docker-compose.yaml runs it daily.

  • Migration 0005_apikey_lifecycle; error codes quota_exceeded (429), limit_reached (409);
    ApiKey gains status, daily_limit, used_today, created_by; compose passes
    DEFAULT_MAX_KEYS, DEFAULT_DAILY_LIMIT, MAX_DAILY_LIMIT.

  • Self-service accounts, server side (@jsmemento/server, behind MEMENTO_ACCOUNTS, off by
    default): POST /auth/register (a user, a tenant of their own t-xxxxxxxx, the owner
    membership, a verify mail, a session), /auth/verify, /auth/resend, /auth/login,
    /auth/logout, /auth/forgot, /auth/reset, GET/PATCH /auth/me. Passwords argon2id
    (@node-rs/argon2); single-use mail tokens stored as SHA-256 (verify 24 h, reset 1 h);
    rate limits (@fastify/rate-limit, Redis store with REDIS_URL) 10 per IP per 15 min,
    login also per email. Migration 0004_accounts: memento_user, memento_tenant_user,
    memento_session, memento_user_token, and plan / max_keys / retention_days on
    memento_tenant.

  • The session credential: cookie memento_session (HttpOnly, SameSite=Lax, Secure over
    https, sliding MEMENTO_SESSION_DAYS), config.auth: "session" | "admin" on routes next
    to config.scope — the two never accept each other's credential; cookie writes need
    Content-Type: application/json (415 otherwise). TenantContext gains userId,
    userEmail, isAdmin; apiKeyId is null for a session. UDC collections registered in
    the new MementoRegistry with auth: "session" | "admin" are read with the cookie.

  • Mail (@jsmemento/server): Mailer, BrevoMailer (Brevo transactional API; a refusal is
    logged, never fails the request), LogMailer, MemoryMailer; templates
    packages/server/mail/{verify,reset}.{en,sr}.hbs (first line the subject) rendered with the
    event templates' Handlebars sandbox.

  • Config: MEMENTO_ACCOUNTS, MEMENTO_SERVICE_URL, MEMENTO_BREVO_API_KEY,
    MEMENTO_MAIL_FROM, MEMENTO_TRUST_PROXY, MEMENTO_SESSION_DAYS,
    MEMENTO_DEFAULT_MAX_KEYS, MEMENTO_DEFAULT_DAILY_LIMIT, MEMENTO_MAX_DAILY_LIMIT;
    docker-compose.yaml passes ACCOUNTS, SERVICE_URL, BREVO_API_KEY, MAIL_FROM,
    TRUST_PROXY. buildApp({ trustProxy, accounts }).

  • CLI (@jsmemento/cli): list-users, make-admin / revoke-admin, disable-user /
    enable-user, verify-user.

  • Error codes (@jsmemento/core): unsupported_media_type (415), rate_limited (429).

  • activity UDC collection (@jsmemento/server): the tenant's events counted per minute and
    per event_type, computed per request with a GROUP BY over memento_event (no migration,
    no new index: the inner query is bounded on occurred_at and reads the tenant/time index).
    Fields minute, event_type, count, plus one integer column per event type of
    lookups.yaml and other (the chart's series). Last 60 minutes unless the filter names
    minute; Filter DSL, sort, offset paging, total = buckets. Chart (default) + table.
    EventCollectionSource's filter compiler is now SqlFilterCompiler, shared by both.

  • Examples site: the Activity chart (/examples/chart, replaces its planned page — the
    last one): UdcDataView on activity, chart tab first, a window selector (15 min / 1 h /
    6 h / 24 h) that writes the minute range into ?f= and slides with the clock, refreshed
    by the stream at most once per 5 s.

  • Examples site: the Chat page (/examples/chat, replaces its planned page): the
    simulator's demo room in MementoChat, read as one participant picked in a selector
    (?as=), with seen markers, "X was added" lines in the header's language, a disabled
    composer ("read-only demo key"), live over the WebSocket; an empty state with the compose
    command while the room does not exist.

  • memento simulate chat scene (@jsmemento/cli): makes sure chat-demo-room exists
    (created with four of the cast, an existing one reused) and plays messages about the
    desk's tickets in English and Serbian, read markers and the odd new member; --no-chat
    turns it off. TicketDesk.nextStep() returns events and chat calls; next() stays the
    event-only story.

  • MementoChat readOnly, seenMarkers, systemEvents (@jsmemento/react), with
    useMementoChat(…, { seen, system }) returning participants and notices, and the
    helpers seenMarkers() / applyChatEvent().

  • MementoClient.createChat(), .listChats(), .markSeen(), .addParticipant() and
    chatMessages({ event_type }) (@jsmemento/core).

  • UDC collections (@jsmemento/server): POST <prefix>/udc/<action> serves the tenant's
    events through @jsudc/server 0.2.1 — events (every event) and cpu_load (CPU_LOAD
    events with the load averages as columns, table + chart). Filter DSL, sort, offset paging
    and exact totals over SQL, tenant-scoped by the API key (read; refused in-protocol with
    forbidden). mementoPlugin({ udc }) takes another CollectionRegistry, or false.

  • memento cpu-monitor (@jsmemento/cli): pushes os.loadavg() as CPU_LOAD events every
    --interval seconds; logs and retries network/server failures, stops on a refused key.

  • cpu-monitor service in docker-compose.yaml (compose profile demo, off by
    default): runs memento cpu-monitor from the same image against memento:3000, with
    restart: unless-stopped, so the CPU monitor demo stays live across server and host
    restarts. Configured by CPU_MONITOR_API_KEY (write scope), CPU_MONITOR_TENANT,
    CPU_MONITOR_INTERVAL and CPU_MONITOR_INSTANCE_ID; see docs/DEPLOYMENT.md "Demo pusher".

  • memento simulate (@jsmemento/cli): plays a ticket desk — a cast of six users and a
    desk-bot logging in and out, creating, modifying, noting and closing tickets
    (ticket/T-<n>), newcomers (USER_CREATED) now and then — one event every --interval
    seconds (default 3), deterministic from --seed, --once for one scene. Payloads carry the
    fields the bundled templates read, so every event renders as a sentence. Flags and env like
    cpu-monitor.

  • simulator service in docker-compose.yaml (profile demo): memento simulate from the
    same image, key SIMULATOR_API_KEY (write; may be the CPU monitor's), SIMULATOR_TENANT,
    SIMULATOR_INTERVAL; see docs/DEPLOYMENT.md "Demo pusher".

  • X-Memento-Locale on POST /udc/* (@jsmemento/server): the events and cpu_load
    rows' rendered text in that locale, like ?locale= of GET /events; a malformed value is
    refused in-protocol with validation_error.

  • Examples site: the Activity feed (/examples/activity): the tenant's events except
    CPU_LOAD as rendered sentences, newest first, infinite paging over the events UDC
    collection, refreshed by the stream, in the header's language (EN / SR). Every example of the
    series
    is in menu.yaml; the ones not built yet open a "planned" page.

  • MementoClient.pushEvent() and .describe() (@jsmemento/core).

  • apps/examples (@jsmemento/examples, replaces apps/cpu-monitor): the examples site,
    served by the server at / and /en/. A sidebar drawn from the menu UDC collection
    (ported from the jsudc example's shell: tree, expand state, en/sr labels), react-router routes
    (/examples/cpu-monitor, /udc/:collection), and the CPU monitor as its first example —
    UdcDataView over cpu_load, refreshed by the WebSocket stream, with a live/offline health
    indicator. Connects by itself with the server's demo key; settings (base URL, own key) in the
    header.

  • menu UDC collection (@jsmemento/server): menu.yaml at the repository root
    (MEMENTO_MENU_PATH; image /app/config/menu.yaml) served by @jsudc/server's yaml_menu
    source, udc:collections resolved against the live registry. mementoPlugin({ menu }).

  • GET <prefix>/api/demo (@jsmemento/server, no auth): the read-only demo key of
    MEMENTO_DEMO_API_KEY (compose: DEMO_API_KEY) for the examples site; 404 without one. The
    server refuses to start when that key is unknown, revoked or not exactly read.

  • Vocabulary: event type CPU_LOAD, instance type SERVER, and the CPU_LOAD templates
    (Server {{instance_id}} — CPU: …).

Changed

  • @jsmemento/server: the database layer goes through one dialect seam (what breaks for
    embedding code is listed above). Everything PostgreSQL-only sits behind db/dialect.ts (the
    Dialect interface) and db/postgres.ts: SQLSTATE 23505, the :: casts, jsonb_typeof /
    ->>, ILIKE, date_trunc, to_char, greatest, array_to_string, is distinct from,
    nulls last, now() - interval, with db/sqlite.ts as the second implementation. The SQL
    each PostgreSQL helper renders is the SQL the services ran before (test/dialect.test.ts).
    db/client.ts is now db/index.ts.

  • The CLI's send-message writes with apiKeyId: null (was the placeholder "cli"): events
    now reference memento_apikey, and the CLI uses no key.

  • Docs read as the website's Reference pages: the "(Phase N)" suffixes are gone from the titles,
    docs/CLI.md lists simulate (with its own section) and retention, docs/TEMPLATES.md the
    CPU_LOAD and APIKEY_* templates, and docs/ARCHITECTURE.md the standalone entry
    dist/server.js and the UDC collections and accounts as implemented.

  • @jsudc/* 0.3 (@jsudc/core 0.3.0, @jsudc/server 0.3.0, @jsudc/react 0.3.1, the
    lookups and row_link release) in @jsmemento/server, @jsmemento/ui-shell, the examples site
    and the service site. Nothing changes on the wire: the rows, filters, sorts and paging of
    events, cpu_load, activity, menu and the self-service collections are as before.
    @jsudc/server 0.3 checks at startup that every lookup field and row_link of the
    registry names a served collection with the named fields; memento has neither (its
    lookups.yaml values — event, instance and actor types — are plain string fields), so the
    check stays on and passes (test/udc.test.ts), and a collection an embedder registers with
    a lookup into a collection nobody serves now stops the start. 0.3 still ships no transport
    for capabilities.subscribe (memento's sources answer subscribe: false); the live updates
    keep riding memento's own /ws stream (docs/STREAMING.md).

Fixed

  • Text sorts no longer depend on the database's collation. listTemplates (by event type
    then locale), listTenants and the retention sweep (by slug) and every UDC sort on a text
    field (event_type, source, an API key's name, …) order in Unicode code-point order on
    PostgreSQL and SQLite alike — USER_LOGIN before _generic, upper before lower case —
    through the new dialect.bytewise (COLLATE "C" / COLLATE BINARY). Before, a PostgreSQL
    created with a linguistic collation (the postgres image's en_US.utf8 default) listed
    _generic first, since such a collation ignores punctuation.
  • Two server processes can start together on PostgreSQL. The startup migrations run under
    a session-level advisory lock (pg_advisory_lock, on one connection of the pool): one process
    migrates, the others wait and find nothing pending. Before, two processes on a database with
    pending migrations (two replicas, or memento and service started by one
    docker compose up) both ran the same CREATE … and one exited with a unique violation.
    SQLite is unchanged (one process per file).
  • A self-service key is metered and held to its daily limit on every server process, not
    only on one with MEMENTO_ACCOUNTS. Stage runs service (accounts on) and memento
    (accounts off) on one database, and a key made on the service site works on both: events
    written through memento were missing from the key's usage and "today" count, and its daily
    limit did not apply there. Now a key of a tenant with an account member is metered and
    limited wherever it writes (one count in Redis when REDIS_URL is set); a process with
    accounts still meters every key, and one without leaves other keys (CLI keys of operator
    tenants) alone. A process without accounts sends the quota mails when it has
    MEMENTO_SERVICE_URL, and without it leaves the day's mail to one that can. New plugin
    options metering (redis, usage, mail, now) and limits; accounts.redis,
    .usage and .now still work.

Docker: docker pull ghcr.io/digital-cube/jsmemento:1.1.0