Compare commits

..
12 changed files with 82 additions and 419 deletions
-4
View File
@@ -1,4 +0,0 @@
{
"monorepoCommit": "15b93e42825a3f8055f6305999a12c5b1cc73330",
"sourcePath": "quixos-instance/packages/todo-runtime"
}
-8
View File
@@ -1,8 +0,0 @@
{
"messages": {
"org.quixos.web-studio.SearchDocument": {
"module": "../messages.js",
"export": "searchDocumentBinding"
}
}
}
Generated
+7 -7
View File
@@ -37,17 +37,17 @@
"quixosNixHelpers": {
"flake": false,
"locked": {
"lastModified": 1789354913,
"narHash": "sha256-vCdz/2jZ15GpA7YkmjLGOuO/LoZIeI8v7joDD5EI0oE=",
"ref": "refs/tags/quixos-reachability/8b2a224698da3659dd9a81e237dfe79238ee2836",
"rev": "8b2a224698da3659dd9a81e237dfe79238ee2836",
"revCount": 18,
"lastModified": 1788543053,
"narHash": "sha256-3YReATWEVxZinYVi/l3cwOz+oFoZUrwj24kUBQTmUpQ=",
"ref": "refs/tags/quixos-reachability/56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a",
"rev": "56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a",
"revCount": 8,
"type": "git",
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
},
"original": {
"ref": "refs/tags/quixos-reachability/8b2a224698da3659dd9a81e237dfe79238ee2836",
"rev": "8b2a224698da3659dd9a81e237dfe79238ee2836",
"ref": "refs/tags/quixos-reachability/56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a",
"rev": "56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a",
"type": "git",
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
}
+1 -2
View File
@@ -6,7 +6,7 @@
flake-utils.url = "github:numtide/flake-utils";
quixosNixHelpers = {
url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?ref=refs/tags/quixos-reachability/8b2a224698da3659dd9a81e237dfe79238ee2836&rev=8b2a224698da3659dd9a81e237dfe79238ee2836";
url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?ref=refs/tags/quixos-reachability/56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a&rev=56bbcd22d17f8c7f120b1e0b5bd1d5a86e91a80a";
flake = false;
};
};
@@ -18,7 +18,6 @@
quixosHelpers.mkCaminoTsYarnNixifyFlake {
inherit inputs nixpkgs flake-utils;
packageRoot = ./.;
bindingOptions = builtins.fromJSON (builtins.readFile ./bindings.json);
promptName = "todo-runtime";
bundle = {
entry = "dist/server.js";
+1 -1
View File
@@ -12,7 +12,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=110e41b268c8ac309e6757f2af3331de417ff9b0"
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=a998690446ecf647e3af78e369492c1a3663b66d"
},
"devDependencies": {
"@types/node": "^24",
+1 -1
View File
@@ -1,6 +1,6 @@
quixos-lock version 1 {
quixos source {
repository "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos.git";
commit "15b93e42825a3f8055f6305999a12c5b1cc73330";
commit "9c3ab572ecfbc83785038c3d9f174516df15d63f";
}
}
-354
View File
File diff suppressed because one or more lines are too long
-11
View File
@@ -1,11 +0,0 @@
import { encodeQxValue, decodeQxValue, type MessageBinding, type QxValueType } from "@quixos/camino-package-runtime";
type SearchDocument = { title: string; subtitle: string; keywords: string[] };
const schema: QxValueType = { kind: "record", fields: {
title: { kind: "scalar", name: "string" }, subtitle: { kind: "scalar", name: "string" },
keywords: { kind: "list", value: { kind: "scalar", name: "string" } },
}};
export const searchDocumentBinding: MessageBinding<SearchDocument> = {
encode: value => encodeQxValue(schema, value, {}),
decode: value => decodeQxValue(schema, value, {}),
};
+24 -8
View File
@@ -1,10 +1,26 @@
import { servePackageRuntime } from "@quixos/camino-package-runtime";
import { createRuntime, type Implementation } from "./gen/qx.js";
import { archive, complete, createTask, displayLabel, reopen, searchDocument, stopWatch } from "./task.impl.js";
import {
archive,
complete,
createTask,
displayLabel,
reopen,
searchDocument,
stopWatch,
} from "./task.impl.js";
const implementation: Implementation = {
complete, reopen, archive, createTask,
displayLabelGet: displayLabel, displayLabelWatch: displayLabel, displayLabelWatchStop: stopWatch,
searchDocumentGet: searchDocument, searchDocumentWatch: searchDocument, searchDocumentWatchStop: stopWatch,
};
servePackageRuntime(createRuntime(implementation));
servePackageRuntime({
packageRevisionId: "package:todo-runtime@1",
exports: {
"export:todo-runtime:complete": complete,
"export:todo-runtime:reopen": reopen,
"export:todo-runtime:archive": archive,
"export:todo-runtime:display-label-get": displayLabel,
"export:todo-runtime:display-label-watch": displayLabel,
"export:todo-runtime:display-label-watch-stop": stopWatch,
"export:todo-runtime:search-document-get": searchDocument,
"export:todo-runtime:search-document-watch": searchDocument,
"export:todo-runtime:search-document-watch-stop": stopWatch,
"export:todo-runtime:create-task": createTask,
},
});
+43 -18
View File
@@ -1,32 +1,57 @@
import type { Contexts } from "./gen/qx.js";
import { derived, type RuntimeContext } from "@quixos/camino-package-runtime";
export const complete = async ({ ports }: Contexts["complete"]) => {
await ports.status.set("DONE");
const status = (context: RuntimeContext) =>
context.state<string>("port:todo-actions:status");
export const complete = async (context: RuntimeContext) => {
await status(context).set("DONE");
return "DONE";
};
export const reopen = async ({ ports }: Contexts["reopen"]) => {
await ports.status.set("OPEN");
export const reopen = async (context: RuntimeContext) => {
await status(context).set("OPEN");
return "OPEN";
};
export const archive = async ({ ports }: Contexts["archive"]) => {
await ports.status.set("ARCHIVED");
export const archive = async (context: RuntimeContext) => {
await status(context).set("ARCHIVED");
return "ARCHIVED";
};
export const displayLabel = { kind: "derived" as const, get: async ({ ports }: Contexts["displayLabelGet"]) => {
const [title, status, priority] = await Promise.all([ports.title.get(), ports.status.get(), ports.priority.get()]);
const priorityText = priority && priority !== "NORMAL" ? ` ${priority.toLowerCase()}` : "";
return `[${status || "OPEN"}]${priorityText} ${title || "Untitled task"}`;
}};
export const searchDocument = { kind: "derived" as const, get: async ({ ports }: Contexts["searchDocumentGet"]) => {
const [title, status, priority, dueDate] = await Promise.all([ports.title.get(), ports.status.get(), ports.priority.get(), ports.dueDate.get()]);
export const displayLabel = derived(
async (context) => {
const [title, status, priority] = await Promise.all([
context.state<string>("port:todo-label:title").get(),
context.state<string>("port:todo-label:status").get(),
context.state<string>("port:todo-label:priority").get(),
]);
const statusText = status ?? "OPEN";
const priorityText =
priority && priority !== "NORMAL" ? ` ${priority.toLowerCase()}` : "";
return `[${statusText}]${priorityText} ${title ?? "Untitled task"}`;
},
);
export const searchDocument = derived(async (context) => {
const [title, status, priority, dueDate] = await Promise.all([
context.state<string>("port:todo-search:title").get(),
context.state<string>("port:todo-search:status").get(),
context.state<string>("port:todo-search:priority").get(),
context.state<string>("port:todo-search:due-date").get(),
]);
return {
title: title || "Untitled task",
subtitle: `Task · ${status || "OPEN"}${dueDate ? ` · due ${dueDate}` : ""}`,
keywords: ["task", status || "open", priority || "normal", dueDate || ""],
};
}};
export const createTask = async ({ ports, input, objectId }: Contexts["createTask"]) => {
await ports.title.set(input.trim() || "Untitled task");
return objectId;
});
export const createTask = async (context: RuntimeContext) => {
const title = typeof context.input.value === "string" && context.input.value.trim()
? context.input.value.trim()
: "Untitled task";
await context.state<string>("port:todo-constructor:title").set(title);
return context.objectId;
};
export const stopWatch = () => null;
+1 -1
View File
@@ -159,7 +159,7 @@ cacheEntries = {
"@bufbuild/protobuf@npm:2.12.1" = { filename = "@bufbuild-protobuf-npm-2.12.1-d8afb467b3-2d40cfe4ec.zip"; hash = "sha512-LUDP5Ow7sOPwarLih3HcXcVm6qywVfvok9dWIbBAfQJy1I9ApJCtR97YOe1UFRThr3G7E68CSzrjbvDFbVbdqQ=="; };
"@connectrpc/connect-node@npm:2.1.2" = { filename = "@connectrpc-connect-node-npm-2.1.2-021434d5d5-ba8b0c9384.zip"; hash = "sha512-uosMk4TDgps3eqeoJtwM1Qpgk1J9LscBRgSRKDYzbqlgSitazqQrEEd/i+RWnknd7WbKD8d/X1sCcDXgKeE+qQ=="; };
"@connectrpc/connect@npm:2.1.2" = { filename = "@connectrpc-connect-npm-2.1.2-ab34825de3-4e15000890.zip"; hash = "sha512-ThUACJAjt1Lv1E+pQKWuHh+gDhvrxLoM7ScruTWSDYw7hbd0UOZErUQruMqaJ1sMFxNviWuo7/A2F4Ex2wHWFQ=="; };
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=110e41b268c8ac309e6757f2af3331de417ff9b0" = { filename = "@quixos-camino-package-runtime-https-5a5a438f14-75b1ffcea9.zip"; hash = "sha512-dbH/zqm6gwFck1pSrJAEXNUl6wfHpOL+jj4IwdHCyf5VOMKInCLr73Yx9NYUvqn3zw3AOfdm/8bUeTz2Htxo/A=="; };
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=a998690446ecf647e3af78e369492c1a3663b66d" = { filename = "@quixos-camino-package-runtime-https-683bcbf33c-c90d5d5c53.zip"; hash = "sha512-yQ1dXFMR2k+xbkka2rrhsAcrQFZlJAZEYM0hqwGzdV5RJ+fhQEh3BEgoPiL2yxrxulU4zg/jsj8BTBFRp1feyg=="; };
"@types/node@npm:24.13.3" = { filename = "@types-node-npm-24.13.3-b512a0bbeb-a5bc08f49b.zip"; hash = "sha512-pbwI9JuVgdzcqQ4CzXcZejx5mECAdmSULlzVFhpVPU0q6AZPfjKUQQ10jX0Ji1wYSL5/pQwG8pxBk6sWvk5Z6w=="; };
"@typescript/typescript-linux-arm64@npm:7.0.2" = { filename = "@typescript-typescript-linux-arm64-npm-7.0.2-9cacfc53a0-10c0.zip"; hash = "sha512-s4c7nGT/lQIw6x0IfrL0b3ECy/D0g7UoDLdiIWJoM6EGXk5N/dmXdxUdA8Cr3hV/3nO2BYKTQ6Ai8/zGhiSQ3A=="; };
"@typescript/typescript-linux-x64@npm:7.0.2" = { filename = "@typescript-typescript-linux-x64-npm-7.0.2-8dd7ff8d24-10c0.zip"; hash = "sha512-k9EUK5CZ3OOPnyslp8SAAonHJpnpPmlaulppI/NmFyCzNs3UN/TLPUkyQia3KIxgbyTzKoXI5L5fl8Uj9bJ7Cg=="; };
+4 -4
View File
@@ -31,14 +31,14 @@ __metadata:
languageName: node
linkType: hard
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=110e41b268c8ac309e6757f2af3331de417ff9b0":
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=a998690446ecf647e3af78e369492c1a3663b66d":
version: 0.1.0
resolution: "@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=110e41b268c8ac309e6757f2af3331de417ff9b0"
resolution: "@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=a998690446ecf647e3af78e369492c1a3663b66d"
dependencies:
"@bufbuild/protobuf": "npm:^2.12.1"
"@connectrpc/connect": "npm:^2.1.2"
"@connectrpc/connect-node": "npm:^2.1.2"
checksum: 10c0/75b1ffcea9ba83015c935a52ac90045cd525eb07c7a4e2fe8e3e08c1d1c2c9fe5538c2889c22ebef7631f4d614bea9f7cf0dc039f766ffc6d4793cf61edc68fc
checksum: 10c0/c90d5d5c5311da4fb16e491adabae1b0072b40566524064460cd21ab01b3755e5127e7e14048770448283e22f6cb1af1ba5538ce0fe3b23f014c1151a757deca
languageName: node
linkType: hard
@@ -46,7 +46,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@quixos/todo-runtime@workspace:."
dependencies:
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=110e41b268c8ac309e6757f2af3331de417ff9b0"
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=a998690446ecf647e3af78e369492c1a3663b66d"
"@types/node": "npm:^24"
typescript: "npm:^7.0.2"
bin: