From 778a377d8155dc87c83ff95dbd2d253d0b8c2ac6 Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Wed, 18 Feb 2026 01:48:23 -0600 Subject: [PATCH 1/3] Add unit test for conditionToDatalog utility function --- tests/conditionToDatalog.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/conditionToDatalog.test.ts diff --git a/tests/conditionToDatalog.test.ts b/tests/conditionToDatalog.test.ts new file mode 100644 index 00000000..3efe66cb --- /dev/null +++ b/tests/conditionToDatalog.test.ts @@ -0,0 +1,23 @@ +import { expect, test } from "@playwright/test"; +import conditionToDatalog from "../src/utils/conditionToDatalog"; + +test("has title {date} compiles to :log/id clause", () => { + const clauses = conditionToDatalog({ + type: "clause", + uid: "test", + relation: "has title", + source: "node", + target: "{date}", + }); + + expect(clauses).toEqual([ + { + type: "data-pattern", + arguments: [ + { type: "variable", value: "node" }, + { type: "constant", value: ":log/id" }, + { type: "variable", value: "node-log-id" }, + ], + }, + ]); +}); From c961829f9c042d823d101bfbd1706914c56fb592 Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Wed, 18 Feb 2026 01:48:31 -0600 Subject: [PATCH 2/3] Refactor getTitleDatalog function to update argument structure - Changed the arguments in the getTitleDatalog function to replace title-related constants with log-related constants. - Updated variable names to reflect the new log ID context. --- src/utils/conditionToDatalog.ts | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/utils/conditionToDatalog.ts b/src/utils/conditionToDatalog.ts index 24537569..508d5ba4 100644 --- a/src/utils/conditionToDatalog.ts +++ b/src/utils/conditionToDatalog.ts @@ -63,30 +63,8 @@ const getTitleDatalog = ({ type: "data-pattern", arguments: [ { type: "variable", value: source }, - { type: "constant", value: ":node/title" }, - { type: "variable", value: `${source}-Title` }, - ], - }, - { - type: "fn-expr", - fn: "re-pattern", - arguments: [ - { - type: "constant", - value: `"${DAILY_NOTE_PAGE_TITLE_REGEX.source}"`, - }, - ], - binding: { - type: "bind-scalar", - variable: { type: "variable", value: `date-regex` }, - }, - }, - { - type: "pred-expr", - pred: "re-find", - arguments: [ - { type: "variable", value: "date-regex" }, - { type: "variable", value: `${source}-Title` }, + { type: "constant", value: ":log/id" }, + { type: "variable", value: `${source}-log-id` }, ], }, ]; From eb2d89ab1079bee8f16538a9654a4b5213d0f26d Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Wed, 18 Feb 2026 14:31:05 -0600 Subject: [PATCH 3/3] 1.37.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 53f1664a..6e678b8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "query-builder", - "version": "1.36.1", + "version": "1.37.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "query-builder", - "version": "1.36.1", + "version": "1.37.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 2352a957..9ef446c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "query-builder", - "version": "1.36.1", + "version": "1.37.0", "description": "Introduces new user interfaces for building queries in Roam", "main": "./build/main.js", "author": {