Implement main-thread Camino sessions and synchronous CRDT editing

This commit is contained in:
Timothy J. Aveni
2026-09-27 23:57:29 -07:00
parent ad72185a6c
commit 696023b4ba
24 changed files with 3784 additions and 3218 deletions
+21
View File
@@ -126,8 +126,29 @@ export function querySchema(
);
return views[0]!.interfaceRevisionId;
};
const variants = new Map<string, GraphQLScalarType>();
const scalar = (type: ValueType): GraphQLOutputType & GraphQLInputType => {
if (type.kind === "optional") return scalar(type.value);
if (type.kind === "variant") {
const name = `QxVariant_${createHash("sha256").update(JSON.stringify(type)).digest("hex").slice(0, 16)}`;
let result = variants.get(name);
if (!result) {
result = new GraphQLScalarType({
name,
description: "Whole checked Camino variant value. Branch selection and predicates are not supported.",
serialize: (value) => value,
parseValue() {
throw new QueryCompileError("QUERY_TYPE", "Variant query inputs are not supported");
},
parseLiteral() {
throw new QueryCompileError("QUERY_TYPE", "Variant query inputs are not supported");
},
});
variants.set(name, result);
scalarTypes.set(name, type);
}
return result;
}
if (type.kind !== "scalar")
throw new QueryCompileError("QUERY_TYPE", "Only scalar/optional scalar query fields are supported");
return queryScalars[type.name];