activity

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package activity writes the journal of the accounts (domain.Activity): what each did, on which item, from which client. The processes a client calls write it in their own transaction; the server's rounds and the admin's commands have no source and write nothing.

Index

Constants

View Source
const (
	App = "app"
	CLI = "cli"
	MCP = "mcp"
	API = "api"
)

The clients an entry comes from: the web app's session, the CLI's login (tide and tide mcp), an OAuth connection (the MCP over HTTP), or an API token (a script, or an agent given one).

View Source
const (
	Create       = "create"
	Edit         = "edit"
	Rename       = "rename"
	Move         = "move"
	Delete       = "delete"
	Restore      = "restore"
	EmptyTrash   = "empty_trash"
	Import       = "import"
	Replace      = "replace"
	Login        = "login"
	TokenCreated = "token_created"
	TokenDeleted = "token_deleted"
)

The kinds of an entry.

View Source
const EditPause = 30 * time.Minute

EditPause ends an edit's entry: the saves of a note from one client, each less than EditPause after the last, are one entry, else autosave would write one per keystroke pause.

View Source
const Header = "Tide-Client"

Header tells the API a request comes from an MCP server (tide mcp, the MCP over HTTP), not the CLI or a script.

Variables

This section is empty.

Functions

func Edited

func Edited(ctx context.Context, db bun.IDB, itemID, title string) error

Edited notes a save of the note itemID, now titled title: it moves the entry of the same note and client saved less than EditPause ago to now, or adds one.

func Quiet

func Quiet(ctx context.Context) context.Context

Quiet is ctx for a process nested in another that writes its own entry: an import does not write each note it creates.

func Source

func Source(ctx context.Context) string

Source is the client of ctx, "" without one.

func WithSource

func WithSource(ctx context.Context, source string) context.Context

WithSource gives ctx the client its request comes from: the processes it runs write their entries from it.

func Write

func Write(ctx context.Context, db bun.IDB, entries ...Entry) error

Write adds entries for the account of ctx, from its source, in db: the action's transaction, so a failed action leaves none. Nothing without a source.

Types

type Entry

type Entry struct {
	Kind   string
	ItemID string
	Title  string
	Count  int
}

Entry is what a process did: Kind on the item ItemID titled Title, or on Count notes.

func Items

func Items(kind string, items []domain.Item, asked ...string) []Entry

Items is one entry of kind per item; with asked, of those items only: a folder's subtree, trashed or restored with it, is not listed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL