Implement shared live fields and checked query hydration
Add native register acknowledgments and idempotent mutation replay, shared optimistic field controllers, overlapping custom setters, non-suspending hooks and explicit Suspense. Carry checked @live provenance through batched queries and hydrate shared browser fields with coverage leases. Update tracker/scaffolds/guides and verify compiler, PostgreSQL, browser and immutable workspace paths.
This commit is contained in:
Vendored
+13
-4
@@ -8,7 +8,7 @@ export const queryFixtureSource = {
|
||||
repository: "https://query-fixture.example.test/source.git",
|
||||
commit: "1".repeat(40),
|
||||
};
|
||||
export async function queryWorkspaceFixture() {
|
||||
export async function queryWorkspaceFixture(options: { live?: boolean } = {}) {
|
||||
const interfaces = new Map<string, InterfaceRevision>();
|
||||
const sources: Record<string, string> = {};
|
||||
function iface(name: string, members: string, parameters = "") {
|
||||
@@ -29,7 +29,7 @@ export async function queryWorkspaceFixture() {
|
||||
`
|
||||
queryable value title id "title" : string {get id "title:get"; set id "title:set";}
|
||||
queryable value done id "done" : bool {get id "done:get";}
|
||||
queryable value rank id "rank" : int64 {get id "rank:get";}
|
||||
queryable value rank id "rank" : int64 {get id "rank:get"; set id "rank:set";}
|
||||
queryable relation assignee id "assignee" : optional-one interface PersonFacts {resolve id "assignee:resolve";}
|
||||
queryable rpc value score id "score" : int32 {get id "score:get";}
|
||||
`,
|
||||
@@ -81,7 +81,16 @@ export async function queryWorkspaceFixture() {
|
||||
"score-totals.graphql": `query ScoreTotals {root {_qx {relations {items {aggregate {count sum {score}}}}}}}`,
|
||||
};
|
||||
pkg.checkedQueries = await Promise.all(
|
||||
pkg.queries!.map((query) => compileQuery(query, allInterfaces, async (name) => documents[name]!)),
|
||||
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]!,
|
||||
),
|
||||
),
|
||||
);
|
||||
const implementation = (atom: string) => `conform ${atom} as TaskFacts id "${atom}-facts" {
|
||||
private state Title${atom} id "${atom}:title" on ${atom} : string policy crdt(string) default "Untitled";
|
||||
@@ -92,7 +101,7 @@ export async function queryWorkspaceFixture() {
|
||||
interface PersonFacts projection tasks id "${atom}:assignee:inverse" many;
|
||||
}
|
||||
bind title.get to state Title${atom}.read;
|
||||
bind title.set to package Queries.titleSet with {title to state Title${atom};};
|
||||
${options.live ? `bind title.set to state Title${atom}.write;` : `bind title.set to package Queries.titleSet with {title to state Title${atom};};`}
|
||||
bind done to state Done${atom}; bind rank to state Rank${atom};
|
||||
bind assignee.resolve to edge Assignee${atom}.assignee.resolve;
|
||||
bind score.get to package Queries.score query-reason "Explicit bounded score computation";
|
||||
|
||||
Reference in New Issue
Block a user