pub struct NotesClient<T, L = Root> { /* private fields */ }Expand description
Typed client for the notes activation, generated by #[plexus_macros::activation(client)].
Generic over the transport: construct it with any plexus_client::Transport — in-process for tests, WebSocket JSON-RPC or REST + SSE against a server.
A one-item method is an async fn returning Result<item, ClientError>; a many-item method returns a MethodStream. The parameter and item types are the activation’s own, so a change to either is a compile error here, not a runtime surprise.
Implementations§
Source§impl<T> NotesClient<T>
impl<T> NotesClient<T>
Sourcepub fn at(transport: T, path: impl Into<RoutePath>) -> Self
pub fn at(transport: T, path: impl Into<RoutePath>) -> Self
Wrap a transport, for this activation mounted at path —
the dotted route from the service, e.g. "tickets.inputs"
for a #[child]. new is at(transport, NAMESPACE). Its
events are this activation’s own aggregate; a parent’s child
accessor builds one whose events are the parent’s.
Source§impl<T, L> NotesClient<T, L>
impl<T, L> NotesClient<T, L>
Sourcepub fn lifted(transport: T, route: Route, lift: L) -> Self
pub fn lifted(transport: T, route: Route, lift: L) -> Self
RETURNS-46: a client on route whose calls’ .events() are
lifted by lift — what a parent’s child accessor builds
(TreeClient::branch() lifts into TreeEvent).
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
The dotted path this client’s calls go to: the namespace, or the child path it was built at.
Sourcepub fn transport(&self) -> &T
pub fn transport(&self) -> &T
Borrow the underlying transport — for reading a
MemoryTransport‘s recorded calls, or sharing one transport
across several activations’ clients.
Sourcepub fn into_transport(self) -> T
pub fn into_transport(self) -> T
Unwrap the transport.
Source§impl<T: Transport> NotesClient<T>
impl<T: Transport> NotesClient<T>
Sourcepub const METHOD_CREATE: MethodRef
pub const METHOD_CREATE: MethodRef
Make a note in an organization you write in; yields created { note } (revision 1, its id 8 characters, opened at #/note/
org names the organization (acme); without it, the first one you
write notes in. Who may read and write the note is the roles
held on its organization (acme:) or on *. Refused in band:
not_found { org } for an organization you are not in, refused { forbidden } for one you only read. Editor.
Calls notes.create.
Sourcepub const METHOD_GET: MethodRef
pub const METHOD_GET: MethodRef
A note whole; yields note { note } — its title, its body (the markdown its CRDT holds now), its revision, who made it and who wrote it last — or not_found.
A note in an organization you do not read is not_found, as one
there is not. replay reads it as it stood at a moment. Viewer.
Calls notes.get.
Sourcepub const METHOD_LIST: MethodRef
pub const METHOD_LIST: MethodRef
The notes you read, newest made first, without their bodies; yields rows { items: [note { note }] } then page { next, remaining }.
query keeps those whose title holds every word of it, case-blind.
A page is 50 rows unless limit says (at most 1,000); after is the
last row’s id of the page before (page.next). Viewer.
Calls notes.list.
Sourcepub const METHOD_SAVE: MethodRef
pub const METHOD_SAVE: MethodRef
Write a note’s body whole — merged with whatever else is being written; yields saved { id, revision, at, by } (stale: true when base was not the revision it found).
For an agent or a script over synapse: the body given is diffed
against the text now and made into the CRDT’s own inserts and deletes,
so it merges with live typing instead of overwriting it (a hand typing
in a paragraph the body did not change keeps its words). base is the
revision you read (note.revision). A body equal to the text writes
nothing. The editor sends updates instead. Editor.
Calls notes.save.
Sourcepub const METHOD_UPDATE: MethodRef
pub const METHOD_UPDATE: MethodRef
Apply a Yjs update to a note’s body — the editor’s live typing; yields applied { id, revision }.
update is a Yjs v1 update of the note’s body text (base64),
as the page’s ydoc made it; it is merged into the note’s CRDT,
kept as a change with you and the moment, and said to everyone on the
note (watch’s updated) — not back to session, when you name
the presence it came from. Editor.
Calls notes.update.
Sourcepub const METHOD_STATE: MethodRef
pub const METHOD_STATE: MethodRef
What your copy of a note’s CRDT lacks; yields state { id, update, vector, revision } — the Yjs update to apply, and the note’s own state vector.
vector is your state vector (Y.encodeStateVector, base64); with
none, the whole note. Send back what the note lacks of yours
(Y.encodeStateAsUpdate(ydoc, vector)) as an update. Viewer.
Calls notes.state.
Sourcepub const METHOD_HISTORY: MethodRef
pub const METHOD_HISTORY: MethodRef
Every change of a note, newest first; yields change { change: { seq, kind, at, by, principal, bytes, title?, authors? } } each.
Every change is kept with who and when until squashed: create,
update (live typing), save (a whole body, merged), rename,
delete, and snapshot (a squash: its authors say who wrote what
in it). at is unix milliseconds. before pages back by seq. Viewer.
Calls notes.history.
Sourcepub const METHOD_REPLAY: MethodRef
pub const METHOD_REPLAY: MethodRef
A note as it stood at a moment; yields note { note } — its title and body then, revision the change it stood at — or not_found { revision }.
seq stands it after that change (history’s); at (unix
milliseconds) after the last change made by then. A moment before the
first change kept — squashed away — is not_found. With neither, now.
Viewer.
Calls notes.replay.
Sourcepub const METHOD_SQUASH: MethodRef
pub const METHOD_SQUASH: MethodRef
Collapse a note’s changes up to a moment into one snapshot, keeping who wrote what; yields squashed { id, until, removed, at, by }, said on watch.
The changes up to until (a seq) become one snapshot change whose
authors say each writer’s changes and bytes; later changes stay as
they are. A replay before until is not_found after. Needs its own
grant, notes.squash, on the note’s organization — admin’s by
default, grantable to a role by the role table; refused typed
without it. Admin.
Calls notes.squash.
Sourcepub const METHOD_PRESENT: MethodRef
pub const METHOD_PRESENT: MethodRef
Who is on a note now; yields present { present: { session, principal, name, agent, colour, client?, awareness?, at } } each.
A connection is on it while its watch { id, session } is open; a
writer without one (an agent’s save) while it writes, idling out
after 30 s. Viewer.
Calls notes.present.
Sourcepub const METHOD_HERE: MethodRef
pub const METHOD_HERE: MethodRef
Say where your caret is on a note; yields present { present }, said to everyone on it.
awareness is your page’s Yjs awareness update (base64) — your
caret, your selection — and client your Yjs client id; session
your page’s, as your watch named it (one someone else holds is
refused). Viewer.
Calls notes.here.
Sourcepub const METHOD_RENAME: MethodRef
pub const METHOD_RENAME: MethodRef
Retitle a note; yields renamed { id, title, revision, at, by }. Editor.
Calls notes.rename.
Sourcepub const METHOD_DELETE: MethodRef
pub const METHOD_DELETE: MethodRef
Delete a note; yields deleted { id, at, by }. Its changes stay in the service’s file. Admin.
Calls notes.delete.
Sourcepub const METHOD_RESTORE: MethodRef
pub const METHOD_RESTORE: MethodRef
Put a note’s body back as it stood after a change; yields saved { id, revision, at, by } — the restore is a change more, merged like a save. Editor.
Calls notes.restore.
Sourcepub const METHOD_MAY: MethodRef
pub const METHOD_MAY: MethodRef
Whether you hold a role on a note — viewer | editor | admin — as the gate says on its organization now; yields may { id, role, held }, or not_found for one you do not read.
The question another service asks through the seam before it keeps
something of a note’s, as the caller (the service that keeps
images asks editor before it keeps one for a note, viewer
before it answers one). Nothing is written. Viewer.
Calls notes.may.
Sourcepub const METHOD_ASK: MethodRef
pub const METHOD_ASK: MethodRef
Ask a question on a range of a note — it stays beside that text as the text changes; yields asked { thread }, said on watch.
from and to are the range in characters of the text now (as
get’s body counts them). The range is anchored in the note’s
CRDT, so it follows the text through every edit (thread.from,
thread.to where it stands now; deleted whole, the thread is
detached). text is the question (markdown: links, images).
to_whom asks it of an agent (builder, or agent for any); such
a question is listed by waiting and said to every watch of the
organization’s notes, so an agent picks it up, and may answer
with reply or edit the note itself. Editor.
Calls notes.ask.
Sourcepub const METHOD_REPLY: MethodRef
pub const METHOD_REPLY: MethodRef
Answer in a thread — words, links, images; yields replied { thread }, said on watch. Editor.
Calls notes.reply.
Sourcepub const METHOD_RESOLVE: MethodRef
pub const METHOD_RESOLVE: MethodRef
Resolve a thread (it folds in the margin), or open it again; yields resolved { thread }, said on watch. Editor.
Calls notes.resolve.
Sourcepub const METHOD_THREADS: MethodRef
pub const METHOD_THREADS: MethodRef
A note’s threads, in the order their ranges stand in the text, the detached ones last; yields thread { thread } each.
Each thread is whole: its anchor (two Yjs relative positions, for a page to resolve in its own copy), its range now in characters, the text it quoted, the question, whom it was asked of, its answers, and whether it is resolved. Viewer.
Calls notes.threads.
Sourcepub const METHOD_WAITING: MethodRef
pub const METHOD_WAITING: MethodRef
The open questions asked of someone, in the notes you read, oldest first; yields thread { thread } each — an agent’s queue.
to keeps those asked of that name (builder, or agent for the
ones asked of any agent). Viewer.
Calls notes.waiting.
Sourcepub const METHOD_SLOT: MethodRef
pub const METHOD_SLOT: MethodRef
NOTES-4: a note’s slot whole; yields slot { slot: { id, fill?, props, fills, building? } } — what fills it now, its props, every fill newest first, the build under way.
A fill is { n, component, version, say?, by, principal, at }; a
build { component, step?, say?, failed, by, principal, started, at }.
The page draws fill by a mark pinned to its version. Viewer.
Calls notes.slot.
Sourcepub const METHOD_FILL: MethodRef
pub const METHOD_FILL: MethodRef
NOTES-4: fill a note’s slot with a component of a kept version; yields filled { slot }, said on watch as slot_changed; the build under way ends.
The ui service is asked whether version (a hash, or its first 6 hex
digits or more) holds component: refused unknown_version or
unknown_component naming both, the slot unchanged. props replaces
the slot’s props (none: they stay); say is one line of what this
fill does. Every open page draws it in place. Editor.
Calls notes.fill.
Sourcepub const METHOD_EMPTY: MethodRef
pub const METHOD_EMPTY: MethodRef
NOTES-4: empty a note’s slot — nothing drawn, its props cleared, its fills kept; yields emptied { slot }, said on watch as slot_changed. Editor.
Calls notes.empty.
Sourcepub const METHOD_BUILDING: MethodRef
pub const METHOD_BUILDING: MethodRef
NOTES-4: say a slot is being built — a step, a line, a failure; yields building { slot }, said on watch as building_changed.
step is the last reached: heard, written or compiled; say
one line; failed: true with say holding the refusal (the
compiler’s line) marks a build that failed. The component that is in
the slot stays drawn. A fill or an empty ends it; so do ten minutes
without a word, and a restart: it is kept in memory only. Editor.
Calls notes.building.
Sourcepub const METHOD_PROPS: MethodRef
pub const METHOD_PROPS: MethodRef
NOTES-4: merge a patch into a slot’s props — what its component keeps its state in; yields props { slot }, said on watch as props_changed { id, props, by, slot }.
A key set to null is taken away. The props are held to 64 KiB
written as JSON: past it, refused { too_large } and nothing
written. Every page open on the note hands the new props to the
component it has mounted. Editor.
Calls notes.props.
Sourcepub const METHOD_MARK: MethodRef
pub const METHOD_MARK: MethodRef
Mark a range of a note — an underline that follows its words, with a link, a line of state, a component under its passage, or any of them; or change a mark; yields marked { mark }, said on watch. The note’s text is not changed.
A new mark names from and to, the range in characters of the
text now (as get’s body counts them); it is anchored in the note’s
CRDT as a question’s range is, so it follows its words through every
edit (mark.from, mark.to where they stand now; every character
deleted, it is detached, kept and drawn nowhere). With mark
instead, that mark is changed: its link and label set as given,
an empty one taken off. link is a ticket (KILN-12), an address of
the app (#/…) or an https address; a click on the underline opens
it. label is one line of state, drawn under the passage with who
left it. component and version place a component of a version the
ui service keeps under the passage that holds the range — never in
the text — with props its props (a JSON object, at most 64 KiB):
the ui service is asked whether the version holds it, refused
unknown_version or unknown_component naming both, nothing written;
mark_props patches the props after. Nothing here writes the note:
its body and its revision stay as they are. Editor.
Calls notes.mark.
Sourcepub const METHOD_MARK_PROPS: MethodRef
pub const METHOD_MARK_PROPS: MethodRef
Merge a patch into the props of the component a mark places — what the component keeps its state in; yields marked { mark }, said on watch as mark_changed. The note’s text is not changed.
A key set to null is taken away. The props are held to 64 KiB
written as JSON: past it, refused { too_large } and nothing
written; a mark that places no component is refused { no_component }.
Every page open on the note hands the new props to the component it
has mounted under the passage, in place. Editor.
Calls notes.mark_props.
Sourcepub const METHOD_UNMARK: MethodRef
pub const METHOD_UNMARK: MethodRef
Take a mark off a note; yields unmarked { id, mark }, said on watch as mark_removed. The note’s text is not changed. Editor.
Calls notes.unmark.
Sourcepub const METHOD_MARKS: MethodRef
pub const METHOD_MARKS: MethodRef
A note’s marks, in the order their ranges stand in the text, the detached ones last; yields mark { mark } each — where each stands now and the words it holds.
Each mark is whole: its anchor (two Yjs relative positions, for a page
to resolve in its own copy), its range now in characters (from,
to), the words it holds now and the quote it held when made,
its link and label, who left it and when. Viewer.
Calls notes.marks.
Sourcepub const METHOD_WATCH: MethodRef
pub const METHOD_WATCH: MethodRef
Follow notes: watching { id? } first, then created, updated { id, seq, update, by }, renamed, deleted, squashed, asked, replied, resolved, slot_changed, building_changed, props_changed, mark_changed, mark_removed — and, on one note, present and left, and with text the body as words — as they happen; open-ended, ends with watch_closed { reason, message }.
With id, one note’s: each updated carries the Yjs update to
apply (the stream ends after its deleted), and who comes and goes
(present { present }, left { session, client? }); with session
as well, this watch is your presence on it while it is open, and your
own updates (sent with that session) are not said back. Without id,
every note’s you read, note without its body. Held to you by the
gate: asked again when the grants move, a sign-out or the expiry comes,
and closed with a typed reason (signed_out, expired, revoked,
refused); each write is asked of the gate on its organization as it
stands then. lagged { missed } when it fell behind: read again
(state with your vector). NOTES-5: mark_changed { id, mark } (a
mark made or changed, whole) and mark_removed { id, mark }; with
text: true (and id) the note’s markdown as words — text { id, revision, body, by, at } once as the watch opens, then a second
after the first change not yet said, holding every change since:
at most one a second, the last change always said. Viewer.
Calls notes.watch.
Sourcepub const METHOD_USAGE: MethodRef
pub const METHOD_USAGE: MethodRef
Every principal’s notes made and bytes written (admin of *): yields usage { principal, count, bytes } each — what quota.recount reads.
V2-31: from the changes kept — count the notes a principal
made, bytes every change they wrote (a squash’s snapshot is
nobody’s). Admin of *: KEEL-48, everywhere — the gate refuses a
holder on a narrower scope before it runs.
Calls notes.usage.
Source§impl<T: Transport, L: Lift<NotesAggregate>> NotesClient<T, L>
impl<T: Transport, L: Lift<NotesAggregate>> NotesClient<T, L>
Sourcepub fn create(
&self,
title: NoteTitle,
body: Option<NoteBody>,
org: Option<OrgId>,
) -> NotesCreateStream<'_, L>
pub fn create( &self, title: NoteTitle, body: Option<NoteBody>, org: Option<OrgId>, ) -> NotesCreateStream<'_, L>
Make a note in an organization you write in; yields created { note } (revision 1, its id 8 characters, opened at #/note/
org names the organization (acme); without it, the first one you
write notes in. Who may read and write the note is the roles
held on its organization (acme:) or on *. Refused in band:
not_found { org } for an organization you are not in, refused { forbidden } for one you only read. Editor.
Calls notes.create.
Many items, as a stream of Result<item, ClientError> — a NotesCreateStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Create — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn get(&self, id: NoteId) -> NotesGetStream<'_, L>
pub fn get(&self, id: NoteId) -> NotesGetStream<'_, L>
A note whole; yields note { note } — its title, its body (the markdown its CRDT holds now), its revision, who made it and who wrote it last — or not_found.
A note in an organization you do not read is not_found, as one
there is not. replay reads it as it stood at a moment. Viewer.
Calls notes.get.
Many items, as a stream of Result<item, ClientError> — a NotesGetStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Get — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn list(
&self,
query: Option<NoteQuery>,
limit: Option<u32>,
after: Option<NoteId>,
) -> NotesListStream<'_, L>
pub fn list( &self, query: Option<NoteQuery>, limit: Option<u32>, after: Option<NoteId>, ) -> NotesListStream<'_, L>
The notes you read, newest made first, without their bodies; yields rows { items: [note { note }] } then page { next, remaining }.
query keeps those whose title holds every word of it, case-blind.
A page is 50 rows unless limit says (at most 1,000); after is the
last row’s id of the page before (page.next). Viewer.
Calls notes.list.
Many items, as a stream of Result<item, ClientError> — a NotesListStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::List — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn save(
&self,
id: NoteId,
body: NoteBody,
base: Option<u32>,
) -> NotesSaveStream<'_, L>
pub fn save( &self, id: NoteId, body: NoteBody, base: Option<u32>, ) -> NotesSaveStream<'_, L>
Write a note’s body whole — merged with whatever else is being written; yields saved { id, revision, at, by } (stale: true when base was not the revision it found).
For an agent or a script over synapse: the body given is diffed
against the text now and made into the CRDT’s own inserts and deletes,
so it merges with live typing instead of overwriting it (a hand typing
in a paragraph the body did not change keeps its words). base is the
revision you read (note.revision). A body equal to the text writes
nothing. The editor sends updates instead. Editor.
Calls notes.save.
Many items, as a stream of Result<item, ClientError> — a NotesSaveStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Save — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn update(
&self,
id: NoteId,
update: NoteUpdate,
session: Option<NoteSession>,
) -> NotesUpdateStream<'_, L>
pub fn update( &self, id: NoteId, update: NoteUpdate, session: Option<NoteSession>, ) -> NotesUpdateStream<'_, L>
Apply a Yjs update to a note’s body — the editor’s live typing; yields applied { id, revision }.
update is a Yjs v1 update of the note’s body text (base64),
as the page’s ydoc made it; it is merged into the note’s CRDT,
kept as a change with you and the moment, and said to everyone on the
note (watch’s updated) — not back to session, when you name
the presence it came from. Editor.
Calls notes.update.
Many items, as a stream of Result<item, ClientError> — a NotesUpdateStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Update — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn state(
&self,
id: NoteId,
vector: Option<NoteVector>,
) -> NotesStateStream<'_, L>
pub fn state( &self, id: NoteId, vector: Option<NoteVector>, ) -> NotesStateStream<'_, L>
What your copy of a note’s CRDT lacks; yields state { id, update, vector, revision } — the Yjs update to apply, and the note’s own state vector.
vector is your state vector (Y.encodeStateVector, base64); with
none, the whole note. Send back what the note lacks of yours
(Y.encodeStateAsUpdate(ydoc, vector)) as an update. Viewer.
Calls notes.state.
Many items, as a stream of Result<item, ClientError> — a NotesStateStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::State — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn history(
&self,
id: NoteId,
limit: Option<u32>,
before: Option<u32>,
) -> NotesHistoryStream<'_, L>
pub fn history( &self, id: NoteId, limit: Option<u32>, before: Option<u32>, ) -> NotesHistoryStream<'_, L>
Every change of a note, newest first; yields change { change: { seq, kind, at, by, principal, bytes, title?, authors? } } each.
Every change is kept with who and when until squashed: create,
update (live typing), save (a whole body, merged), rename,
delete, and snapshot (a squash: its authors say who wrote what
in it). at is unix milliseconds. before pages back by seq. Viewer.
Calls notes.history.
Many items, as a stream of Result<item, ClientError> — a NotesHistoryStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::History — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn replay(
&self,
id: NoteId,
seq: Option<u32>,
at: Option<i64>,
) -> NotesReplayStream<'_, L>
pub fn replay( &self, id: NoteId, seq: Option<u32>, at: Option<i64>, ) -> NotesReplayStream<'_, L>
A note as it stood at a moment; yields note { note } — its title and body then, revision the change it stood at — or not_found { revision }.
seq stands it after that change (history’s); at (unix
milliseconds) after the last change made by then. A moment before the
first change kept — squashed away — is not_found. With neither, now.
Viewer.
Calls notes.replay.
Many items, as a stream of Result<item, ClientError> — a NotesReplayStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Replay — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn squash(&self, id: NoteId, until: u32) -> NotesSquashStream<'_, L>
pub fn squash(&self, id: NoteId, until: u32) -> NotesSquashStream<'_, L>
Collapse a note’s changes up to a moment into one snapshot, keeping who wrote what; yields squashed { id, until, removed, at, by }, said on watch.
The changes up to until (a seq) become one snapshot change whose
authors say each writer’s changes and bytes; later changes stay as
they are. A replay before until is not_found after. Needs its own
grant, notes.squash, on the note’s organization — admin’s by
default, grantable to a role by the role table; refused typed
without it. Admin.
Calls notes.squash.
Many items, as a stream of Result<item, ClientError> — a NotesSquashStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Squash — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn present(&self, id: NoteId) -> NotesPresentStream<'_, L>
pub fn present(&self, id: NoteId) -> NotesPresentStream<'_, L>
Who is on a note now; yields present { present: { session, principal, name, agent, colour, client?, awareness?, at } } each.
A connection is on it while its watch { id, session } is open; a
writer without one (an agent’s save) while it writes, idling out
after 30 s. Viewer.
Calls notes.present.
Many items, as a stream of Result<item, ClientError> — a NotesPresentStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Present — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn here(
&self,
id: NoteId,
session: NoteSession,
client: Option<u64>,
awareness: Option<NoteAwareness>,
) -> NotesHereStream<'_, L>
pub fn here( &self, id: NoteId, session: NoteSession, client: Option<u64>, awareness: Option<NoteAwareness>, ) -> NotesHereStream<'_, L>
Say where your caret is on a note; yields present { present }, said to everyone on it.
awareness is your page’s Yjs awareness update (base64) — your
caret, your selection — and client your Yjs client id; session
your page’s, as your watch named it (one someone else holds is
refused). Viewer.
Calls notes.here.
Many items, as a stream of Result<item, ClientError> — a NotesHereStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Here — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn rename(&self, id: NoteId, title: NoteTitle) -> NotesRenameStream<'_, L>
pub fn rename(&self, id: NoteId, title: NoteTitle) -> NotesRenameStream<'_, L>
Retitle a note; yields renamed { id, title, revision, at, by }. Editor.
Calls notes.rename.
Many items, as a stream of Result<item, ClientError> — a NotesRenameStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Rename — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn delete(&self, id: NoteId) -> NotesDeleteStream<'_, L>
pub fn delete(&self, id: NoteId) -> NotesDeleteStream<'_, L>
Delete a note; yields deleted { id, at, by }. Its changes stay in the service’s file. Admin.
Calls notes.delete.
Many items, as a stream of Result<item, ClientError> — a NotesDeleteStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Delete — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn restore(&self, id: NoteId, seq: u32) -> NotesRestoreStream<'_, L>
pub fn restore(&self, id: NoteId, seq: u32) -> NotesRestoreStream<'_, L>
Put a note’s body back as it stood after a change; yields saved { id, revision, at, by } — the restore is a change more, merged like a save. Editor.
Calls notes.restore.
Many items, as a stream of Result<item, ClientError> — a NotesRestoreStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Restore — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn may(&self, id: NoteId, role: Role) -> NotesMayStream<'_, L>
pub fn may(&self, id: NoteId, role: Role) -> NotesMayStream<'_, L>
Whether you hold a role on a note — viewer | editor | admin — as the gate says on its organization now; yields may { id, role, held }, or not_found for one you do not read.
The question another service asks through the seam before it keeps
something of a note’s, as the caller (the service that keeps
images asks editor before it keeps one for a note, viewer
before it answers one). Nothing is written. Viewer.
Calls notes.may.
Many items, as a stream of Result<item, ClientError> — a NotesMayStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::May — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn ask(
&self,
id: NoteId,
from: u32,
to: u32,
text: ThreadText,
to_whom: Option<AgentName>,
) -> NotesAskStream<'_, L>
pub fn ask( &self, id: NoteId, from: u32, to: u32, text: ThreadText, to_whom: Option<AgentName>, ) -> NotesAskStream<'_, L>
Ask a question on a range of a note — it stays beside that text as the text changes; yields asked { thread }, said on watch.
from and to are the range in characters of the text now (as
get’s body counts them). The range is anchored in the note’s
CRDT, so it follows the text through every edit (thread.from,
thread.to where it stands now; deleted whole, the thread is
detached). text is the question (markdown: links, images).
to_whom asks it of an agent (builder, or agent for any); such
a question is listed by waiting and said to every watch of the
organization’s notes, so an agent picks it up, and may answer
with reply or edit the note itself. Editor.
Calls notes.ask.
Many items, as a stream of Result<item, ClientError> — a NotesAskStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Ask — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn reply(
&self,
id: NoteId,
thread: ThreadId,
body: ThreadText,
) -> NotesReplyStream<'_, L>
pub fn reply( &self, id: NoteId, thread: ThreadId, body: ThreadText, ) -> NotesReplyStream<'_, L>
Answer in a thread — words, links, images; yields replied { thread }, said on watch. Editor.
Calls notes.reply.
Many items, as a stream of Result<item, ClientError> — a NotesReplyStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Reply — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn resolve(
&self,
id: NoteId,
thread: ThreadId,
open: Option<bool>,
) -> NotesResolveStream<'_, L>
pub fn resolve( &self, id: NoteId, thread: ThreadId, open: Option<bool>, ) -> NotesResolveStream<'_, L>
Resolve a thread (it folds in the margin), or open it again; yields resolved { thread }, said on watch. Editor.
Calls notes.resolve.
Many items, as a stream of Result<item, ClientError> — a NotesResolveStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Resolve — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn threads(&self, id: NoteId) -> NotesThreadsStream<'_, L>
pub fn threads(&self, id: NoteId) -> NotesThreadsStream<'_, L>
A note’s threads, in the order their ranges stand in the text, the detached ones last; yields thread { thread } each.
Each thread is whole: its anchor (two Yjs relative positions, for a page to resolve in its own copy), its range now in characters, the text it quoted, the question, whom it was asked of, its answers, and whether it is resolved. Viewer.
Calls notes.threads.
Many items, as a stream of Result<item, ClientError> — a NotesThreadsStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Threads — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn waiting(&self, to: Option<AgentName>) -> NotesWaitingStream<'_, L>
pub fn waiting(&self, to: Option<AgentName>) -> NotesWaitingStream<'_, L>
The open questions asked of someone, in the notes you read, oldest first; yields thread { thread } each — an agent’s queue.
to keeps those asked of that name (builder, or agent for the
ones asked of any agent). Viewer.
Calls notes.waiting.
Many items, as a stream of Result<item, ClientError> — a NotesWaitingStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Waiting — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn slot(&self, id: NoteId) -> NotesSlotStream<'_, L>
pub fn slot(&self, id: NoteId) -> NotesSlotStream<'_, L>
NOTES-4: a note’s slot whole; yields slot { slot: { id, fill?, props, fills, building? } } — what fills it now, its props, every fill newest first, the build under way.
A fill is { n, component, version, say?, by, principal, at }; a
build { component, step?, say?, failed, by, principal, started, at }.
The page draws fill by a mark pinned to its version. Viewer.
Calls notes.slot.
Many items, as a stream of Result<item, ClientError> — a NotesSlotStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Slot — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn fill(
&self,
id: NoteId,
component: ComponentName,
version: VersionRef,
props: Option<SlotProps>,
say: Option<SlotSay>,
) -> NotesFillStream<'_, L>
pub fn fill( &self, id: NoteId, component: ComponentName, version: VersionRef, props: Option<SlotProps>, say: Option<SlotSay>, ) -> NotesFillStream<'_, L>
NOTES-4: fill a note’s slot with a component of a kept version; yields filled { slot }, said on watch as slot_changed; the build under way ends.
The ui service is asked whether version (a hash, or its first 6 hex
digits or more) holds component: refused unknown_version or
unknown_component naming both, the slot unchanged. props replaces
the slot’s props (none: they stay); say is one line of what this
fill does. Every open page draws it in place. Editor.
Calls notes.fill.
Many items, as a stream of Result<item, ClientError> — a NotesFillStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Fill — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn empty(&self, id: NoteId) -> NotesEmptyStream<'_, L>
pub fn empty(&self, id: NoteId) -> NotesEmptyStream<'_, L>
NOTES-4: empty a note’s slot — nothing drawn, its props cleared, its fills kept; yields emptied { slot }, said on watch as slot_changed. Editor.
Calls notes.empty.
Many items, as a stream of Result<item, ClientError> — a NotesEmptyStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Empty — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn building(
&self,
id: NoteId,
component: ComponentName,
step: Option<BuildStep>,
say: Option<SlotSay>,
failed: Option<bool>,
) -> NotesBuildingStream<'_, L>
pub fn building( &self, id: NoteId, component: ComponentName, step: Option<BuildStep>, say: Option<SlotSay>, failed: Option<bool>, ) -> NotesBuildingStream<'_, L>
NOTES-4: say a slot is being built — a step, a line, a failure; yields building { slot }, said on watch as building_changed.
step is the last reached: heard, written or compiled; say
one line; failed: true with say holding the refusal (the
compiler’s line) marks a build that failed. The component that is in
the slot stays drawn. A fill or an empty ends it; so do ten minutes
without a word, and a restart: it is kept in memory only. Editor.
Calls notes.building.
Many items, as a stream of Result<item, ClientError> — a NotesBuildingStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Building — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn props(&self, id: NoteId, patch: SlotProps) -> NotesPropsStream<'_, L>
pub fn props(&self, id: NoteId, patch: SlotProps) -> NotesPropsStream<'_, L>
NOTES-4: merge a patch into a slot’s props — what its component keeps its state in; yields props { slot }, said on watch as props_changed { id, props, by, slot }.
A key set to null is taken away. The props are held to 64 KiB
written as JSON: past it, refused { too_large } and nothing
written. Every page open on the note hands the new props to the
component it has mounted. Editor.
Calls notes.props.
Many items, as a stream of Result<item, ClientError> — a NotesPropsStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Props — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn mark(
&self,
id: NoteId,
from: Option<u32>,
to: Option<u32>,
mark: Option<MarkId>,
link: Option<MarkLink>,
label: Option<MarkLabel>,
component: Option<ComponentName>,
version: Option<VersionRef>,
props: Option<SlotProps>,
) -> NotesMarkStream<'_, L>
pub fn mark( &self, id: NoteId, from: Option<u32>, to: Option<u32>, mark: Option<MarkId>, link: Option<MarkLink>, label: Option<MarkLabel>, component: Option<ComponentName>, version: Option<VersionRef>, props: Option<SlotProps>, ) -> NotesMarkStream<'_, L>
Mark a range of a note — an underline that follows its words, with a link, a line of state, a component under its passage, or any of them; or change a mark; yields marked { mark }, said on watch. The note’s text is not changed.
A new mark names from and to, the range in characters of the
text now (as get’s body counts them); it is anchored in the note’s
CRDT as a question’s range is, so it follows its words through every
edit (mark.from, mark.to where they stand now; every character
deleted, it is detached, kept and drawn nowhere). With mark
instead, that mark is changed: its link and label set as given,
an empty one taken off. link is a ticket (KILN-12), an address of
the app (#/…) or an https address; a click on the underline opens
it. label is one line of state, drawn under the passage with who
left it. component and version place a component of a version the
ui service keeps under the passage that holds the range — never in
the text — with props its props (a JSON object, at most 64 KiB):
the ui service is asked whether the version holds it, refused
unknown_version or unknown_component naming both, nothing written;
mark_props patches the props after. Nothing here writes the note:
its body and its revision stay as they are. Editor.
Calls notes.mark.
Many items, as a stream of Result<item, ClientError> — a NotesMarkStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Mark — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn mark_props(
&self,
id: NoteId,
mark: MarkId,
patch: SlotProps,
) -> NotesMarkPropsStream<'_, L>
pub fn mark_props( &self, id: NoteId, mark: MarkId, patch: SlotProps, ) -> NotesMarkPropsStream<'_, L>
Merge a patch into the props of the component a mark places — what the component keeps its state in; yields marked { mark }, said on watch as mark_changed. The note’s text is not changed.
A key set to null is taken away. The props are held to 64 KiB
written as JSON: past it, refused { too_large } and nothing
written; a mark that places no component is refused { no_component }.
Every page open on the note hands the new props to the component it
has mounted under the passage, in place. Editor.
Calls notes.mark_props.
Many items, as a stream of Result<item, ClientError> — a NotesMarkPropsStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::MarkProps — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn unmark(&self, id: NoteId, mark: MarkId) -> NotesUnmarkStream<'_, L>
pub fn unmark(&self, id: NoteId, mark: MarkId) -> NotesUnmarkStream<'_, L>
Take a mark off a note; yields unmarked { id, mark }, said on watch as mark_removed. The note’s text is not changed. Editor.
Calls notes.unmark.
Many items, as a stream of Result<item, ClientError> — a NotesUnmarkStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Unmark — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn marks(&self, id: NoteId) -> NotesMarksStream<'_, L>
pub fn marks(&self, id: NoteId) -> NotesMarksStream<'_, L>
A note’s marks, in the order their ranges stand in the text, the detached ones last; yields mark { mark } each — where each stands now and the words it holds.
Each mark is whole: its anchor (two Yjs relative positions, for a page
to resolve in its own copy), its range now in characters (from,
to), the words it holds now and the quote it held when made,
its link and label, who left it and when. Viewer.
Calls notes.marks.
Many items, as a stream of Result<item, ClientError> — a NotesMarksStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Marks — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn watch(
&self,
id: Option<NoteId>,
session: Option<NoteSession>,
text: Option<bool>,
) -> NotesWatchStream<'_, L>
pub fn watch( &self, id: Option<NoteId>, session: Option<NoteSession>, text: Option<bool>, ) -> NotesWatchStream<'_, L>
Follow notes: watching { id? } first, then created, updated { id, seq, update, by }, renamed, deleted, squashed, asked, replied, resolved, slot_changed, building_changed, props_changed, mark_changed, mark_removed — and, on one note, present and left, and with text the body as words — as they happen; open-ended, ends with watch_closed { reason, message }.
With id, one note’s: each updated carries the Yjs update to
apply (the stream ends after its deleted), and who comes and goes
(present { present }, left { session, client? }); with session
as well, this watch is your presence on it while it is open, and your
own updates (sent with that session) are not said back. Without id,
every note’s you read, note without its body. Held to you by the
gate: asked again when the grants move, a sign-out or the expiry comes,
and closed with a typed reason (signed_out, expired, revoked,
refused); each write is asked of the gate on its organization as it
stands then. lagged { missed } when it fell behind: read again
(state with your vector). NOTES-5: mark_changed { id, mark } (a
mark made or changed, whole) and mark_removed { id, mark }; with
text: true (and id) the note’s markdown as words — text { id, revision, body, by, at } once as the watch opens, then a second
after the first change not yet said, holding every change since:
at most one a second, the last change always said. Viewer.
Calls notes.watch.
Many items, as a stream of Result<item, ClientError> — a NotesWatchStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Watch — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn usage(
&self,
everyone: Option<bool>,
daily: Option<bool>,
) -> NotesUsageStream<'_, L>
pub fn usage( &self, everyone: Option<bool>, daily: Option<bool>, ) -> NotesUsageStream<'_, L>
Every principal’s notes made and bytes written (admin of *): yields usage { principal, count, bytes } each — what quota.recount reads.
V2-31: from the changes kept — count the notes a principal
made, bytes every change they wrote (a squash’s snapshot is
nobody’s). Admin of *: KEEL-48, everywhere — the gate refuses a
holder on a narrower scope before it runs.
Calls notes.usage.
Many items, as a stream of Result<item, ClientError> — a NotesUsageStream; progress is dropped unless opted in with .with_progress(), and .events() yields NotesAggregate::Usage — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Trait Implementations§
Source§impl<T, L> Aggregated for NotesClient<T, L>
impl<T, L> Aggregated for NotesClient<T, L>
Source§type Event = NotesAggregate
type Event = NotesAggregate
Source§impl<T: Debug, L> Debug for NotesClient<T, L>
impl<T: Debug, L> Debug for NotesClient<T, L>
Source§impl<T: Default> Default for NotesClient<T>
impl<T: Default> Default for NotesClient<T>
Source§impl<T> FromRoute<T> for NotesClient<T>
impl<T> FromRoute<T> for NotesClient<T>
Source§fn from_route(transport: T, route: Route) -> Self
fn from_route(transport: T, route: Route) -> Self
route, over transport.Source§impl<__T, __L> ParentHash for NotesClient<__T, __L>
impl<__T, __L> ParentHash for NotesClient<__T, __L>
Source§impl<__T, __L> ParentShape for NotesClient<__T, __L>
impl<__T, __L> ParentShape for NotesClient<__T, __L>
Source§fn resolve(segments: &[&str]) -> Option<(String, Option<String>)>
fn resolve(segments: &[&str]) -> Option<(String, Option<String>)>
segments are a call chain’s names as the Rust code wrote them
(["ui", "slots", "list", "collect"]). The wire path of the method the
chain calls, below this client’s node ("ui.slots.list"), and its
shape hash where known; None when the chain names no method of this
client (a dynamic child’s or a peer slot’s accessor, which take a name
only known when the code runs).Source§impl<__T, __L> ShapeCheck for NotesClient<__T, __L>
impl<__T, __L> ShapeCheck for NotesClient<__T, __L>
Source§fn shape_check(path: &str, schema: &Value) -> Result<(), ClientError>
fn shape_check(path: &str, schema: &Value) -> Result<(), ClientError>
Ok when schema — the node at path’s answer to schema — serves
every method this client calls under the same shape; else
ClientError::ShapeMismatch naming those it does not.