Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f0e5c616a | ||
|
|
dd09b39a74 |
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"monorepoCommit": "4c88728f144add3457b4273d4b9a04ee53c53be3",
|
||||
"monorepoCommit": "ba8d4f92667f39bb02d542cb492b71a32ec914bf",
|
||||
"sourcePath": "quixos-instance/packages/web-studio-canvas-runtime"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"messages": {
|
||||
"org.quixos.web-studio.CanvasPosition": {
|
||||
"module": "../messages.js",
|
||||
"export": "positionBinding"
|
||||
},
|
||||
"org.quixos.web-studio.CanvasSize": {
|
||||
"module": "../messages.js",
|
||||
"export": "sizeBinding"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# Generated from the checked package contract
|
||||
# Generated by qx-scaffold-v1
|
||||
package_id: "package:org.quixos.web-studio:canvas-runtime"
|
||||
package_revision_id: "package:org.quixos.web-studio:canvas-runtime@1"
|
||||
runtime_protocol_version: "quixos-capabilities-v1"
|
||||
|
||||
Generated
+7
-7
@@ -37,17 +37,17 @@
|
||||
"quixosNixHelpers": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1789602549,
|
||||
"narHash": "sha256-DD66dQ3dzEvG13Zju/4sVSV4pnktSUkJ/Rbr1KkHMdg=",
|
||||
"ref": "refs/tags/quixos-reachability/e2747066ca7d9d001dcb5dd936e17969ed88fc5f",
|
||||
"rev": "e2747066ca7d9d001dcb5dd936e17969ed88fc5f",
|
||||
"revCount": 32,
|
||||
"lastModified": 1789364768,
|
||||
"narHash": "sha256-6tINqOSLd3TTACk/HAfhXqo07H69yjX3Q/DrrAPWzus=",
|
||||
"ref": "refs/tags/quixos-reachability/cf7945abb6ee2533a34dff4a7d4a956e70efe007",
|
||||
"rev": "cf7945abb6ee2533a34dff4a7d4a956e70efe007",
|
||||
"revCount": 22,
|
||||
"type": "git",
|
||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "refs/tags/quixos-reachability/e2747066ca7d9d001dcb5dd936e17969ed88fc5f",
|
||||
"rev": "e2747066ca7d9d001dcb5dd936e17969ed88fc5f",
|
||||
"ref": "refs/tags/quixos-reachability/cf7945abb6ee2533a34dff4a7d4a956e70efe007",
|
||||
"rev": "cf7945abb6ee2533a34dff4a7d4a956e70efe007",
|
||||
"type": "git",
|
||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
||||
}
|
||||
|
||||
@@ -6,18 +6,12 @@
|
||||
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/e2747066ca7d9d001dcb5dd936e17969ed88fc5f&rev=e2747066ca7d9d001dcb5dd936e17969ed88fc5f";
|
||||
url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?ref=refs/tags/quixos-reachability/cf7945abb6ee2533a34dff4a7d4a956e70efe007&rev=cf7945abb6ee2533a34dff4a7d4a956e70efe007";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
quixosNixHelpers,
|
||||
...
|
||||
}:
|
||||
outputs = inputs@{ nixpkgs, flake-utils, quixosNixHelpers, ... }:
|
||||
let
|
||||
quixosHelpers = import "${quixosNixHelpers}/quixos-package-helpers.nix";
|
||||
in
|
||||
@@ -25,6 +19,7 @@
|
||||
inherit inputs nixpkgs flake-utils;
|
||||
packageRoot = ./.;
|
||||
migrationEntrypoint = "dist/migrate.js";
|
||||
bindingOptions = builtins.fromJSON (builtins.readFile ./bindings.json);
|
||||
promptName = "web-studio-canvas-runtime";
|
||||
bundle = {
|
||||
entry = "dist/server.js";
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=446fd4e36e9700cf27ce20b472a8d512133e9370"
|
||||
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=d3d050d9cb84421fd8043ebe34fd0cae9132f6a2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24",
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
quixos-lock version 1 {
|
||||
quixos source {
|
||||
repository "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos.git";
|
||||
commit "4c88728f144add3457b4273d4b9a04ee53c53be3";
|
||||
commit "ba8d4f92667f39bb02d542cb492b71a32ec914bf";
|
||||
}
|
||||
interface WebStudioCanvasPlacement source {
|
||||
repository "https://repos.quixos.org/quixos-templates/interface-canvas-placement.git";
|
||||
commit "5785ced8b4f6220b50d6c1a5ccfc4f7a14bcb911";
|
||||
commit "8dd3e248d9d8add9c9eeed3e6e0df543fa074b93";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"generatedBy": "qx-scaffold-v1",
|
||||
"name": "WebStudioCanvasRuntime",
|
||||
"id": "package:org.quixos.web-studio:canvas-runtime",
|
||||
"revision": "package:org.quixos.web-studio:canvas-runtime@1",
|
||||
"exports": [
|
||||
{
|
||||
"name": "createCanvas",
|
||||
"id": "export:org.quixos.web-studio.canvas-runtime:create-canvas",
|
||||
"file": "src/impl/createCanvas.ts"
|
||||
},
|
||||
{
|
||||
"name": "createPlacement",
|
||||
"id": "export:org.quixos.web-studio.canvas-runtime:create-placement",
|
||||
"file": "src/impl/createPlacement.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
+7
-2
@@ -1,4 +1,7 @@
|
||||
import { objectRef, type QxObjectRef } from "@quixos/camino-package-runtime";
|
||||
import {
|
||||
objectRef,
|
||||
type QxObjectRef,
|
||||
} from "@quixos/camino-package-runtime";
|
||||
import type { Contexts } from "./gen/qx.js";
|
||||
|
||||
export type PlacementInput = {
|
||||
@@ -22,7 +25,9 @@ const objectId = (value: unknown, field: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const normalizePlacementInput = (input: Record<string, unknown>): PlacementInput => ({
|
||||
export const normalizePlacementInput = (
|
||||
input: Record<string, unknown>,
|
||||
): PlacementInput => ({
|
||||
canvas_id: objectId(input.canvas_id, "canvas_id"),
|
||||
subject_id: objectId(input.subject_id, "subject_id"),
|
||||
x: finiteNumber(input.x, 0),
|
||||
|
||||
+2
-11
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
// This adapter keeps the implementation file hand-authored.
|
||||
export { createCanvas as handler } from "../canvas.impl.js";
|
||||
export {createCanvas as handler} from "../canvas.impl.js";
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// This adapter keeps the implementation file hand-authored.
|
||||
export { createPlacement as handler } from "../canvas.impl.js";
|
||||
export {createPlacement as handler} from "../canvas.impl.js";
|
||||
|
||||
+6
-14
@@ -1,18 +1,10 @@
|
||||
import { encodeQxValue, decodeQxValue, type MessageBinding, type QxValueType } from "@quixos/camino-package-runtime";
|
||||
|
||||
const position: QxValueType = {
|
||||
kind: "record",
|
||||
fields: { x: { kind: "scalar", name: "double" }, y: { kind: "scalar", name: "double" } },
|
||||
const position: QxValueType = {kind: "record", fields: {x: {kind: "scalar", name: "double"}, y: {kind: "scalar", name: "double"}}};
|
||||
const size: QxValueType = {kind: "record", fields: {width: {kind: "scalar", name: "double"}, height: {kind: "scalar", name: "double"}}};
|
||||
export const positionBinding: MessageBinding<{x: number; y: number}> = {
|
||||
encode: value => encodeQxValue(position, value, {}), decode: value => decodeQxValue(position, value, {}),
|
||||
};
|
||||
const size: QxValueType = {
|
||||
kind: "record",
|
||||
fields: { width: { kind: "scalar", name: "double" }, height: { kind: "scalar", name: "double" } },
|
||||
};
|
||||
export const positionBinding: MessageBinding<{ x: number; y: number }> = {
|
||||
encode: (value) => encodeQxValue(position, value, {}),
|
||||
decode: (value) => decodeQxValue(position, value, {}),
|
||||
};
|
||||
export const sizeBinding: MessageBinding<{ width: number; height: number }> = {
|
||||
encode: (value) => encodeQxValue(size, value, {}),
|
||||
decode: (value) => decodeQxValue(size, value, {}),
|
||||
export const sizeBinding: MessageBinding<{width: number; height: number}> = {
|
||||
encode: value => encodeQxValue(size, value, {}), decode: value => decodeQxValue(size, value, {}),
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// Generated by qx-scaffold-v1
|
||||
import { serveMigration } from "@quixos/camino-package-runtime";
|
||||
import {serveMigration} from "@quixos/camino-package-runtime";
|
||||
await serveMigration({});
|
||||
|
||||
+8
-10
@@ -1,11 +1,9 @@
|
||||
// Generated by qx-scaffold-v1
|
||||
import { servePackageRuntime } from "@quixos/camino-package-runtime";
|
||||
import { createRuntime } from "./gen/qx.js";
|
||||
import { handler as impl0 } from "./impl/createCanvas.js";
|
||||
import { handler as impl1 } from "./impl/createPlacement.js";
|
||||
servePackageRuntime(
|
||||
createRuntime({
|
||||
createCanvas: impl0,
|
||||
createPlacement: impl1,
|
||||
}),
|
||||
);
|
||||
import {servePackageRuntime} from "@quixos/camino-package-runtime";
|
||||
import {createRuntime} from "./gen/qx.js";
|
||||
import {handler as impl0} from "./impl/createCanvas.js";
|
||||
import {handler as impl1} from "./impl/createPlacement.js";
|
||||
servePackageRuntime(createRuntime({
|
||||
"createCanvas": impl0,
|
||||
"createPlacement": impl1,
|
||||
}));
|
||||
|
||||
+20
-27
@@ -3,31 +3,27 @@ import test from "node:test";
|
||||
import { normalizePlacementInput } from "../dist/canvas.impl.js";
|
||||
import { protoValueToJs } from "@quixos/camino-package-runtime";
|
||||
|
||||
const reference = (objectId) => protoValueToJs({ kind: { case: "refValue", value: { objectId } } });
|
||||
const canvas = reference("obj:canvas"),
|
||||
subject = reference("obj:subject");
|
||||
const reference = (objectId) => protoValueToJs({kind: {case: "refValue", value: {objectId}}});
|
||||
const canvas = reference("obj:canvas"), subject = reference("obj:subject");
|
||||
|
||||
test("placement input is bounded and normalized", () => {
|
||||
assert.deepEqual(
|
||||
normalizePlacementInput({
|
||||
canvas_id: canvas,
|
||||
subject_id: subject,
|
||||
x: 12.5,
|
||||
y: -30,
|
||||
width: 12,
|
||||
height: 80,
|
||||
z: 3.8,
|
||||
}),
|
||||
{
|
||||
canvas_id: canvas,
|
||||
subject_id: subject,
|
||||
x: 12.5,
|
||||
y: -30,
|
||||
width: 220,
|
||||
height: 150,
|
||||
z: 3,
|
||||
},
|
||||
);
|
||||
assert.deepEqual(normalizePlacementInput({
|
||||
canvas_id: canvas,
|
||||
subject_id: subject,
|
||||
x: 12.5,
|
||||
y: -30,
|
||||
width: 12,
|
||||
height: 80,
|
||||
z: 3.8,
|
||||
}), {
|
||||
canvas_id: canvas,
|
||||
subject_id: subject,
|
||||
x: 12.5,
|
||||
y: -30,
|
||||
width: 220,
|
||||
height: 150,
|
||||
z: 3,
|
||||
});
|
||||
});
|
||||
|
||||
test("placement input requires Camino object references", () => {
|
||||
@@ -35,8 +31,5 @@ test("placement input requires Camino object references", () => {
|
||||
() => normalizePlacementInput({ canvas_id: "canvas", subject_id: "obj:subject" }),
|
||||
/canvas_id must be a managed object reference/,
|
||||
);
|
||||
assert.throws(
|
||||
() => normalizePlacementInput({ canvas_id: "obj:canvas", subject_id: subject }),
|
||||
/managed object reference/,
|
||||
);
|
||||
assert.throws(() => normalizePlacementInput({canvas_id: "obj:canvas", subject_id: subject}), /managed object reference/);
|
||||
});
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ cacheEntries = {
|
||||
"@bufbuild/protobuf@npm:2.14.1" = { filename = "@bufbuild-protobuf-npm-2.14.1-78e9ea56a2-3f913aca03.zip"; hash = "sha512-P5E6ygPfhBnEsh2ADqVNf2yDalND5l1vaGJ57DVmxJB3KZOO8vlKXifZLo0/StzW4CcRi6Kbp2TSHhxjfN3HAg=="; };
|
||||
"@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=446fd4e36e9700cf27ce20b472a8d512133e9370" = { filename = "@quixos-camino-package-runtime-https-84d8fd5109-6d173f9220.zip"; hash = "sha512-bRc/kiD/ODsJqBNX4+RTqdsczILibHLhB+X8MckDCoK+j32c4Hszh87obb1Rwjb5o35aI0fzArQqCwK270zzlw=="; };
|
||||
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=d3d050d9cb84421fd8043ebe34fd0cae9132f6a2" = { filename = "@quixos-camino-package-runtime-https-08b8790f1a-5bde059ead.zip"; hash = "sha512-W94Fnq0rn4MyBqRUUhH0ZcTzVv9MfF59dHtwpFLhg+/jK4QG5wi/uNgRR3xEVszpN8yrBWO6uiJGlkGmNnrczA=="; };
|
||||
"@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=="; };
|
||||
|
||||
@@ -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=446fd4e36e9700cf27ce20b472a8d512133e9370":
|
||||
"@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=d3d050d9cb84421fd8043ebe34fd0cae9132f6a2":
|
||||
version: 0.1.0
|
||||
resolution: "@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=446fd4e36e9700cf27ce20b472a8d512133e9370"
|
||||
resolution: "@quixos/camino-package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=d3d050d9cb84421fd8043ebe34fd0cae9132f6a2"
|
||||
dependencies:
|
||||
"@bufbuild/protobuf": "npm:^2.12.1"
|
||||
"@connectrpc/connect": "npm:^2.1.2"
|
||||
"@connectrpc/connect-node": "npm:^2.1.2"
|
||||
checksum: 10c0/6d173f9220ff383b09a81357e3e453a9db1ccc82e26c72e107e5fc31c9030a82be8f7d9ce07b3387cee86dbd51c236f9a37e5a2347f302b42a0b02b6ef4cf397
|
||||
checksum: 10c0/5bde059ead2b9f833206a4545211f465c4f356ff4c7c5e7d747b70a452e183efe32b8406e708bfb8d811477c4456cce937ccab0563baba22469641a6367adccc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -46,7 +46,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@quixos/web-studio-canvas-runtime@workspace:."
|
||||
dependencies:
|
||||
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=446fd4e36e9700cf27ce20b472a8d512133e9370"
|
||||
"@quixos/camino-package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git#commit=d3d050d9cb84421fd8043ebe34fd0cae9132f6a2"
|
||||
"@types/node": "npm:^24"
|
||||
typescript: "npm:^7.0.2"
|
||||
bin:
|
||||
|
||||
Reference in New Issue
Block a user