diff --git a/test/emit-managed.ts b/test/emit-managed.ts index 69b31c8..4036cef 100644 --- a/test/emit-managed.ts +++ b/test/emit-managed.ts @@ -23,6 +23,9 @@ interface EntryFactory id "interface:entry-factory" revision "interface:entry-fa assert.ok(factory.ok && factory.resource.kind === "interface", JSON.stringify(factory.diagnostics)); const data = compileCapabilityResourceSource( `interface Data id "interface:data" revision "interface:data@1" { + queryable value body id "body" : string { get id "body:get" execution snapshot targets [browser, server]; edit id "body:edit" execution transaction targets [browser, server]; } + queryable value notes id "notes" : string { get id "notes:get" execution snapshot targets [browser, server]; edit id "notes:edit" execution transaction targets [browser, server]; } + operation revise id "revise" : record {body:change; notes:change; reject:bool;} -> unit {call id "revise:call" execution transaction targets [browser, server];} queryable value label id "label" : string { get id "label:get" execution snapshot targets [browser, server]; set id "label:set" execution transaction targets [browser, server]; @@ -56,8 +59,12 @@ package Owner id "package:owner" revision "package:owner@1" { session ? `function createOne id "create-one" : string -> atom-ref execution transaction targets [browser, server] requires { creation entry id "one:birth" : Entry input unit; }; function createTwo id "create-two" : unit -> atom-ref execution transaction targets [browser, server] requires { creation entry id "two:birth" : Independent input unit; }; + operation revise id "revise" : record {body:change; notes:change; reject:bool;} -> unit mode call execution transaction targets [browser, server] receiver any requires { + state body id "revise:body" : string [edit]; state notes id "revise:notes" : string [edit]; + }; query Inputs id "inputs" root workspace Data document "inputs.graphql" operation "Inputs" { replica; } query View id "view" root workspace Data document "view.graphql" operation "View" { local from Inputs; watch; } + query EditorView id "editor-view" root Data document "editor-view.graphql" operation "EditorView" { local from EditorInputs; watch; } query EditorInputs id "editor-inputs" root Data document "editor.graphql" operation "Editor" { replica; }` : "" } @@ -82,7 +89,8 @@ package Owner id "package:owner" revision "package:owner@1" { "query Inputs($label: String!) { root { objects(all: 100, where: {label: {eq: $label}}) { entries { key node { _qx {ref} label } } } } }", "view.graphql": "query View { root { availableObjects(all: 100) { entries { key node { _qx {ref} label } } } } }", - "editor.graphql": "query Editor { root { _qx {ref} label } }", + "editor.graphql": "query Editor { root { _qx {ref} label body notes } }", + "editor-view.graphql": "query EditorView { root { label body notes } }", })[name]!, ), ), @@ -94,7 +102,7 @@ package Owner id "package:owner" revision "package:owner@1" { session ? `import interface Data; import interface Factories; conform Entry as Factories id "owner:factories" { bind createOne.call to package Owner.createOne with { entry to creation Entry with {}; }; bind createTwo.call to package Owner.createTwo with { entry to creation Independent with {}; }; } - ${["Entry", "Independent"].map((atom) => `conform ${atom} as Data id "owner:${atom}:data" { private state ${atom}Label id "label:${atom}" on ${atom} : string policy register default "${atom}"; bind label.get to state ${atom}Label.read; bind label.set to state ${atom}Label.write; }`).join("\n")} + ${["Entry", "Independent"].map((atom) => `conform ${atom} as Data id "owner:${atom}:data" { private state ${atom}Label id "label:${atom}" on ${atom} : string policy register default "${atom}"; bind label.get to state ${atom}Label.read; bind label.set to state ${atom}Label.write; private state ${atom}Body id "body:${atom}" on ${atom} : string policy crdt(string) default "hello 🌍"; private state ${atom}Notes id "notes:${atom}" on ${atom} : string policy crdt(string) default "notes"; bind body.get to state ${atom}Body.read; bind body.edit to state ${atom}Body.edit; bind notes.get to state ${atom}Notes.read; bind notes.edit to state ${atom}Notes.edit; bind revise.call to package Owner.revise with {body to state ${atom}Body; notes to state ${atom}Notes;}; }`).join("\n")} ` : "" }