Acquire installed portable operations with explicit authority and input coverage
This commit is contained in:
+108
@@ -0,0 +1,108 @@
|
||||
workspace Reader id "workspace:reader" revision "workspace:reader@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" {
|
||||
import interface DocumentData;
|
||||
import interface HighlightData;
|
||||
import interface CommentData;
|
||||
import interface DocumentActions;
|
||||
import interface DocumentFactory;
|
||||
import package ReaderRuntime;
|
||||
import package CommentRuntime;
|
||||
import interface DocumentMetadata;
|
||||
import interface CommentFactory;
|
||||
// Shared record definitions, repeated explicitly in independently locked resources.
|
||||
|
||||
type SourceRange = record {
|
||||
sourceRevision: string;
|
||||
start: int32;
|
||||
end: int32;
|
||||
};
|
||||
|
||||
type CommentContent = record {
|
||||
text: string;
|
||||
tags: list<string>;
|
||||
};
|
||||
|
||||
type DocumentSeed = record { sourceRevision: string; content: string; };
|
||||
|
||||
atom Document id "atom:reader:document";
|
||||
atom Highlight id "atom:reader:highlight";
|
||||
atom Comment id "atom:reader:comment";
|
||||
|
||||
conform Document as DocumentData id "conformance:reader:document-data" {
|
||||
private state Revision id "slot:document:revision"
|
||||
on Document : string policy register;
|
||||
private state Content id "slot:document:content"
|
||||
on Document : string policy register;
|
||||
private edge DocumentHighlights id "edge:document-highlights" {
|
||||
atom Document projection highlights id "projection:highlights" many-unique;
|
||||
atom Highlight projection document id "projection:document"
|
||||
exactly-one public-traversal;
|
||||
}
|
||||
initialize {
|
||||
sourceRevision to state Revision;
|
||||
content to state Content;
|
||||
};
|
||||
bind sourceRevision.get to state Revision.read;
|
||||
bind content.get to state Content.read;
|
||||
bind highlights.resolve to edge DocumentHighlights.highlights.resolve;
|
||||
bind highlights.connect to edge DocumentHighlights.highlights.connect;
|
||||
}
|
||||
|
||||
conform Document as DocumentActions id "conformance:reader:document-actions" {
|
||||
|
||||
bind annotate.call to package ReaderRuntime.addHighlight with {
|
||||
document to interface DocumentData;
|
||||
highlight to creation Highlight with { HighlightData from input; };
|
||||
comments to interface CommentFactory;
|
||||
};
|
||||
}
|
||||
|
||||
conform Document as CommentFactory id "conformance:reader:comment-factory" {
|
||||
bind prepareComment.call to package CommentRuntime.prepareComment with {
|
||||
comment to creation Comment with { CommentData from input; };
|
||||
};
|
||||
}
|
||||
|
||||
conform Document as DocumentMetadata id "conformance:reader:document-metadata" {
|
||||
private state Label id "slot:document:label" on Document : string policy register;
|
||||
initialize { label to state Label; };
|
||||
bind label.get to state Label.read;
|
||||
}
|
||||
|
||||
conform Document as DocumentFactory id "conformance:reader:document-factory" {
|
||||
bind create.call to package ReaderRuntime.createDocument with {
|
||||
document to creation Document with { DocumentData from input.document; DocumentMetadata from input.metadata; };
|
||||
};
|
||||
}
|
||||
|
||||
conform Highlight as HighlightData id "conformance:reader:highlight-data" {
|
||||
private state Range id "slot:highlight:range"
|
||||
on Highlight : SourceRange policy register;
|
||||
private state Color id "slot:highlight:color"
|
||||
on Highlight : string policy register default "yellow";
|
||||
private edge HighlightComments id "edge:highlight-comments" {
|
||||
atom Highlight projection comments id "projection:comments" many-unique;
|
||||
atom Comment projection highlight id "projection:highlight"
|
||||
exactly-one public-traversal;
|
||||
}
|
||||
initialize {
|
||||
range to state Range;
|
||||
comments to edge HighlightComments.comments;
|
||||
};
|
||||
bind range.get to state Range.read;
|
||||
bind color.get to state Color.read;
|
||||
bind color.set to state Color.write;
|
||||
bind comments.resolve to edge HighlightComments.comments.resolve;
|
||||
bind excerpt.get to package ReaderRuntime.excerpt with {
|
||||
range to state Range;
|
||||
document to interface DocumentData via edge DocumentHighlights.document;
|
||||
};
|
||||
}
|
||||
|
||||
conform Comment as CommentData id "conformance:reader:comment-data" {
|
||||
private state CommentBody id "slot:comment:content"
|
||||
on Comment : CommentContent policy crdt(CommentContent);
|
||||
initialize { content to state CommentBody; };
|
||||
bind content.get to state CommentBody.read;
|
||||
bind content.edit to state CommentBody.edit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user