Acquire installed portable operations with explicit authority and input coverage
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
// Shared record definitions, repeated explicitly in independently locked resources.
|
||||
external atom Document id "atom:reader:document";
|
||||
external atom Highlight id "atom:reader:highlight";
|
||||
external atom Comment id "atom:reader:comment";
|
||||
|
||||
type SourceRange = record {
|
||||
sourceRevision: string;
|
||||
start: int32;
|
||||
end: int32;
|
||||
};
|
||||
|
||||
type CommentContent = record {
|
||||
text: string;
|
||||
tags: list<string>;
|
||||
};
|
||||
|
||||
type DocumentSeed = record { document: record { sourceRevision: string; content: string; }; metadata: record { label: string; }; };
|
||||
|
||||
import interface DocumentData;
|
||||
import interface CommentFactory;
|
||||
import interface HighlightData;
|
||||
import interface CommentData;
|
||||
type CommentSeed = record { content: CommentContent; };
|
||||
type HighlightSeed = record {
|
||||
range: SourceRange;
|
||||
comments: list<record { key: string; target: atom-ref<Comment>; }>;
|
||||
};
|
||||
|
||||
package ReaderRuntime id "package:reader-runtime"
|
||||
revision "package:reader-runtime@1" {
|
||||
operation addHighlight id "reader:add-highlight"
|
||||
: SourceRange -> atom-ref<Highlight>
|
||||
mode call execution transaction targets [browser, server]
|
||||
receiver atom Document requires {
|
||||
interface document id "reader:add:document" : DocumentData
|
||||
using [sourceRevision.get, content.get, highlights.connect];
|
||||
creation highlight id "reader:add:highlight" : Highlight input HighlightSeed;
|
||||
interface comments id "reader:add:comments" : CommentFactory using [prepareComment.call];
|
||||
};
|
||||
|
||||
operation excerpt id "reader:excerpt" : unit -> string
|
||||
mode call execution snapshot targets [browser, server]
|
||||
receiver atom Highlight requires {
|
||||
state range id "reader:excerpt:range" : SourceRange [read];
|
||||
interface document id "reader:excerpt:document" : DocumentData
|
||||
using [sourceRevision.get, content.get];
|
||||
};
|
||||
|
||||
// A receiverless function needs no synthetic service object.
|
||||
function validateRange id "reader:validate-range"
|
||||
: record { range: SourceRange; content: string; } -> bool
|
||||
execution snapshot targets [browser, server];
|
||||
|
||||
function createDocument id "reader:create-document"
|
||||
: DocumentSeed -> atom-ref<Document>
|
||||
execution transaction targets [browser, server] requires {
|
||||
creation document id "reader:create:document" : Document input DocumentSeed;
|
||||
};
|
||||
query ReplicaInputs id "reader:replica-inputs" root DocumentData
|
||||
document "queries/replica-inputs.graphql" operation "ReplicaInputs" {
|
||||
replica;
|
||||
view Highlight as HighlightData;
|
||||
view Comment as CommentData;
|
||||
max rows 5000;
|
||||
max depth 8;
|
||||
max result-bytes 8388608;
|
||||
}
|
||||
|
||||
query ReaderScreen id "reader:screen" root DocumentData
|
||||
document "queries/reader-screen.graphql" operation "ReaderScreen" {
|
||||
local from ReplicaInputs;
|
||||
view Highlight as HighlightData;
|
||||
view Comment as CommentData;
|
||||
max rows 5000;
|
||||
max depth 8;
|
||||
max result-bytes 8388608;
|
||||
watch;
|
||||
}
|
||||
|
||||
query HighlightScope id "reader:highlight-scope" root workspace HighlightData document "queries/highlight-scope.graphql" operation "HighlightScope" { view Comment as CommentData; replica; max rows 200; }
|
||||
query HighlightList id "reader:highlight-list" root workspace HighlightData document "queries/highlight-list.graphql" operation "HighlightList" { view Comment as CommentData; local from HighlightScope; max rows 200; watch; }
|
||||
query HighlightEditorInputs id "reader:editor-inputs" root HighlightData document "queries/editor-inputs.graphql" operation "HighlightEditorInputs" { view Comment as CommentData; replica; max rows 1; }
|
||||
query HighlightEditorView id "reader:editor-view" root HighlightData document "queries/editor-view.graphql" operation "HighlightEditorView" { view Comment as CommentData; local from HighlightEditorInputs; max rows 1; watch; }
|
||||
}
|
||||
Reference in New Issue
Block a user