Skip to main content

NotesClient

Struct NotesClient 

Source
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>

Source

pub const NAMESPACE: &'static str = "notes"

The activation namespace this client speaks to.

Source

pub fn new(transport: T) -> Self

Wrap a transport.

Source

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>

Source

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).

Source

pub fn path(&self) -> &str

The dotted path this client’s calls go to: the namespace, or the child path it was built at.

Source

pub fn transport(&self) -> &T

Borrow the underlying transport — for reading a MemoryTransport‘s recorded calls, or sharing one transport across several activations’ clients.

Source

pub fn into_transport(self) -> T

Unwrap the transport.

Source§

impl<T: Transport> NotesClient<T>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const METHOD_RENAME: MethodRef

Retitle a note; yields renamed { id, title, revision, at, by }. Editor.

Calls notes.rename.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const METHOD_REPLY: MethodRef

Answer in a thread — words, links, images; yields replied { thread }, said on watch. Editor.

Calls notes.reply.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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>

Source§

type Event = NotesAggregate

The activation’s own aggregate.
Source§

impl<T: Clone, L: Clone> Clone for NotesClient<T, L>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, L> Debug for NotesClient<T, L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for NotesClient<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> FromRoute<T> for NotesClient<T>

Source§

fn from_route(transport: T, route: Route) -> Self

The client of the node at route, over transport.
Source§

impl<__T, __L> ParentHash for NotesClient<__T, __L>

Source§

fn method_hash(method: &str) -> Option<String>

The shape hash of the method named method on the wire.
Source§

impl<__T, __L> ParentShape for NotesClient<__T, __L>

Source§

fn namespace() -> &'static str

The activation namespace the client speaks to.
Source§

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>

Source§

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.

Auto Trait Implementations§

§

impl<T, L> Forget for NotesClient<T, L>

§

impl<T, L> Freeze for NotesClient<T, L>
where T: Freeze, L: Freeze,

§

impl<T, L> Move for NotesClient<T, L>

§

impl<T, L> RefUnwindSafe for NotesClient<T, L>

§

impl<T, L> Send for NotesClient<T, L>
where T: Send, L: Send,

§

impl<T, L> Sync for NotesClient<T, L>
where T: Sync, L: Sync,

§

impl<T, L> Unpin for NotesClient<T, L>
where T: Unpin, L: Unpin,

§

impl<T, L> UnsafeUnpin for NotesClient<T, L>
where T: UnsafeUnpin, L: UnsafeUnpin,

§

impl<T, L> UnwindSafe for NotesClient<T, L>
where T: UnwindSafe, L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<M> Meta for M
where M: Default,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more