pub enum NotesActivationMethod {
Show 31 variants
Create {
title: NoteTitle,
body: Option<NoteBody>,
org: Option<OrgId>,
},
Get {
id: NoteId,
},
List {
query: Option<NoteQuery>,
limit: Option<u32>,
after: Option<NoteId>,
},
Save {
id: NoteId,
body: NoteBody,
base: Option<u32>,
},
Update {
id: NoteId,
update: NoteUpdate,
session: Option<NoteSession>,
},
State {
id: NoteId,
vector: Option<NoteVector>,
},
History {
id: NoteId,
limit: Option<u32>,
before: Option<u32>,
},
Replay {
id: NoteId,
seq: Option<u32>,
at: Option<i64>,
},
Squash {
id: NoteId,
until: u32,
},
Present {
id: NoteId,
},
Here {
id: NoteId,
session: NoteSession,
client: Option<u64>,
awareness: Option<NoteAwareness>,
},
Rename {
id: NoteId,
title: NoteTitle,
},
Delete {
id: NoteId,
},
Restore {
id: NoteId,
seq: u32,
},
May {
id: NoteId,
role: Role,
},
Ask {
id: NoteId,
from: u32,
to: u32,
text: ThreadText,
to_whom: Option<AgentName>,
},
Reply {
id: NoteId,
thread: ThreadId,
body: ThreadText,
},
Resolve {
id: NoteId,
thread: ThreadId,
open: Option<bool>,
},
Threads {
id: NoteId,
},
Waiting {
to: Option<AgentName>,
},
Slot {
id: NoteId,
},
Fill {
id: NoteId,
component: ComponentName,
version: VersionRef,
props: Option<SlotProps>,
say: Option<SlotSay>,
},
Empty {
id: NoteId,
},
Building {
id: NoteId,
component: ComponentName,
step: Option<BuildStep>,
say: Option<SlotSay>,
failed: Option<bool>,
},
Props {
id: NoteId,
patch: SlotProps,
},
Mark {
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>,
},
MarkProps {
id: NoteId,
mark: MarkId,
patch: SlotProps,
},
Unmark {
id: NoteId,
mark: MarkId,
},
Marks {
id: NoteId,
},
Watch {
id: Option<NoteId>,
session: Option<NoteSession>,
text: Option<bool>,
},
Usage {
everyone: Option<bool>,
daily: Option<bool>,
},
}Expand description
Auto-generated method enum for schema extraction
Variants§
Create
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.
Get
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.
List
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.
Save
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.
Update
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.
State
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.
History
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.
Replay
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.
Squash
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.
Present
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.
Here
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.
Rename
Retitle a note; yields renamed { id, title, revision, at, by }. Editor.
Delete
Delete a note; yields deleted { id, at, by }. Its changes stay in the service’s file. Admin.
Restore
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.
May
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.
Ask
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.
Reply
Answer in a thread — words, links, images; yields replied { thread }, said on watch. Editor.
Resolve
Resolve a thread (it folds in the margin), or open it again; yields resolved { thread }, said on watch. Editor.
Threads
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.
Waiting
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.
Slot
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.
Fill
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.
Empty
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.
Building
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.
Fields
component: ComponentNameProps
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.
Mark
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.
MarkProps
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.
Unmark
Take a mark off a note; yields unmarked { id, mark }, said on watch as mark_removed. The note’s text is not changed. Editor.
Marks
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.
Watch
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.
Usage
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.
Implementations§
Source§impl NotesActivationMethod
impl NotesActivationMethod
pub fn all_method_names() -> &'static [&'static str]
Source§impl NotesActivationMethod
impl NotesActivationMethod
Sourcepub fn method_schemas() -> Vec<MethodSchema>
pub fn method_schemas() -> Vec<MethodSchema>
Get per-method schema info including params, return types, and content hashes
Note: This method has O(1) schema lookup cost after first call due to caching.
RETURNS-10: each schema’s hash is its content hash, computed
once, inside that cache.
Trait Implementations§
Source§impl Clone for NotesActivationMethod
impl Clone for NotesActivationMethod
Source§impl Debug for NotesActivationMethod
impl Debug for NotesActivationMethod
Source§impl<'de> Deserialize<'de> for NotesActivationMethod
impl<'de> Deserialize<'de> for NotesActivationMethod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for NotesActivationMethod
impl JsonSchema for NotesActivationMethod
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more