Standardize Camino query references and retire live field sidecars

This commit is contained in:
Timothy J. Aveni
2026-09-22 15:41:27 -07:00
parent 152f58a3c6
commit eba85ba158
28 changed files with 88 additions and 217 deletions
+1 -1
View File
@@ -1 +1 @@
query Enabled {root {objects(all:64, where:{enabled:{eq:true}}) {entries {node {_qx {ref}}}}}}
query Enabled {root {objects(all:64, where:{enabled:{eq:true}}) {entries {node {_camino {ref}}}}}}
@@ -1 +1 @@
query HighlightEditorInputs { root { _qx {ref} color range {sourceRevision start end} } }
query HighlightEditorInputs { root { _camino {ref} color range {sourceRevision start end} } }
@@ -1 +1 @@
query HighlightEditorView { root { _qx {ref} color @live range {sourceRevision start end} } }
query HighlightEditorView { root { _camino {ref} color range {sourceRevision start end} } }
@@ -1 +1 @@
query HighlightList($color: String!) { root { availableObjects(all: 200, where: {color: {eq: $color}}, orderBy: {range: {start: ASC}}) { entries { key node { _qx {ref} color @live range {sourceRevision start end} } } } } }
query HighlightList($color: String!) { root { availableObjects(all: 200, where: {color: {eq: $color}}, orderBy: {range: {start: ASC}}) { entries { key node { _camino {ref} color range {sourceRevision start end} } } } } }
@@ -1 +1 @@
query HighlightScope($color: String!) { root { objects(all: 200, where: {color: {eq: $color}}) { entries { key node { _qx {ref} color range {sourceRevision start end} } } } } }
query HighlightScope($color: String!) { root { objects(all: 200, where: {color: {eq: $color}}) { entries { key node { _camino {ref} color range {sourceRevision start end} } } } } }
@@ -1,7 +1,7 @@
query HighlightWindow($color: String!) {
root {
objects(first: 2, where: {color: {eq: $color}}, orderBy: {range: {start: ASC}}) {
entries { key node { _qx {ref} color range {sourceRevision start end} } }
entries { key node { _camino {ref} color range {sourceRevision start end} } }
pageInfo { hasNextPage endCursor }
}
}
@@ -6,16 +6,16 @@ query ReaderScreen($color: String!) {
entries {
key
node {
_qx { ref }
_camino { ref }
range { sourceRevision start end }
color @live
color
excerpt
comments(all: 200) {
entries { key node { _qx { ref } content @live { text tags } } }
entries { key node { _camino { ref } content { text tags } } }
}
}
}
}
_qx { relations { highlights { aggregate { count } } } }
_camino { relations { highlights { aggregate { count } } } }
}
}
@@ -6,12 +6,12 @@ query ReplicaInputs {
entries {
key
node {
_qx { ref }
_camino { ref }
range { sourceRevision start end }
color
excerpt
comments(all: 200) {
entries { key node { _qx { ref } content { text tags } } }
entries { key node { _camino { ref } content { text tags } } }
}
}
}
+1 -1
View File
@@ -67,5 +67,5 @@ export const compileAggregation = (body: string, variables = "") =>
compileQuery(
declaration,
interfaces,
async () => `query Report${variables} { root { _qx { relations { tasks { ${body} } } } } }`,
async () => `query Report${variables} { root { _camino { relations { tasks { ${body} } } } } }`,
);
+7 -10
View File
@@ -76,22 +76,19 @@ export async function queryWorkspaceFixture(options: { live?: boolean } = {}) {
const pkg: PackageRevision = pkgResult.resource.revision;
const allInterfaces = [...interfaces.values(), ...(pkgResult.resource.specializations ?? [])];
const documents: Record<string, string> = {
"extent.graphql": `query Extent($text: String! = "") {root {objects(first: 30, where: {title: {containsInsensitive: $text}}, orderBy: [{rank: ASC}]) {entries {node {_qx {ref} title rank}}}}}`,
"upcoming.graphql": `query Upcoming($first: Int!, $after: Cursor) {root {items(first: $first, after: $after, where: {done: {eq: false}}, orderBy: [{rank: ASC}]) {entries {key cursor node {_qx {ref} ...TaskRow}} pageInfo {hasNextPage endCursor}}}}`,
"extent.graphql": `query Extent($text: String! = "") {root {objects(first: 30, where: {title: {containsInsensitive: $text}}, orderBy: [{rank: ASC}]) {entries {node {_camino {ref} title rank}}}}}`,
"upcoming.graphql": `query Upcoming($first: Int!, $after: Cursor) {root {items(first: $first, after: $after, where: {done: {eq: false}}, orderBy: [{rank: ASC}]) {entries {key cursor node {_camino {ref} ...TaskRow}} pageInfo {hasNextPage endCursor}}}}`,
"row.graphql": `fragment TaskRow on TaskFacts {title rank done assignee {name}}`,
"enriched.graphql": `query Enriched {root {items(first: 3) {entries {key node {_qx {ref} title score}}}}}`,
"ranked.graphql": `query Ranked {root {items(first: 3, where: {score: {gt: 0}}, orderBy: [{score: DESC}]) {entries {key node {_qx {ref} title}}}}}`,
"totals.graphql": `query Totals {root {_qx {relations {items {aggregate {count sum {rank}} groups(by: {done: true}, first: 10) {entries {group {done} aggregate {count sum {rank}}}}}}}}}`,
"score-totals.graphql": `query ScoreTotals {root {_qx {relations {items {aggregate {count sum {score}}}}}}}`,
"enriched.graphql": `query Enriched {root {items(first: 3) {entries {key node {_camino {ref} title score}}}}}`,
"ranked.graphql": `query Ranked {root {items(first: 3, where: {score: {gt: 0}}, orderBy: [{score: DESC}]) {entries {key node {_camino {ref} title}}}}}`,
"totals.graphql": `query Totals {root {_camino {relations {items {aggregate {count sum {rank}} groups(by: {done: true}, first: 10) {entries {group {done} aggregate {count sum {rank}}}}}}}}}`,
"score-totals.graphql": `query ScoreTotals {root {_camino {relations {items {aggregate {count sum {score}}}}}}}`,
};
pkg.checkedQueries = await Promise.all(
pkg.queries!.map((query) =>
compileQuery(query, allInterfaces, async (name) =>
options.live
? documents[name]!.replace(/\btitle\b/g, "title @live").replace(
"title @live rank done",
"title @live rank @live done @live",
)
? documents[name]!.replace(/\btitle\b/g, "title").replace("title rank done", "title rank done")
: documents[name]!,
),
),